zframes 0.2.0 → 0.3.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 (68) hide show
  1. package/dist/index.js +866 -54
  2. package/package.json +5 -5
  3. package/runtime/assets/editor-DVTcqJo4.js +68 -0
  4. package/runtime/assets/editor-DnV0I9s-.css +1 -0
  5. package/runtime/assets/index-DEGnog6Q.css +1 -0
  6. package/runtime/assets/index-KRy1feFG.js +761 -0
  7. package/runtime/index.html +3 -3
  8. package/runtime/widget-icons/breakeven.png +0 -0
  9. package/runtime/widget-icons/breathing.png +0 -0
  10. package/runtime/widget-icons/btc-blocks.png +0 -0
  11. package/runtime/widget-icons/btc-difficulty.png +0 -0
  12. package/runtime/widget-icons/btc-fees.png +0 -0
  13. package/runtime/widget-icons/btc-hashrate.png +0 -0
  14. package/runtime/widget-icons/btc-mempool.png +0 -0
  15. package/runtime/widget-icons/calculator.png +0 -0
  16. package/runtime/widget-icons/checklist.png +0 -0
  17. package/runtime/widget-icons/coin-movers.png +0 -0
  18. package/runtime/widget-icons/countdown.png +0 -0
  19. package/runtime/widget-icons/day-meter.png +0 -0
  20. package/runtime/widget-icons/dex-volume-chart.png +0 -0
  21. package/runtime/widget-icons/dex-volume-treemap.png +0 -0
  22. package/runtime/widget-icons/dice.png +0 -0
  23. package/runtime/widget-icons/divider.png +0 -0
  24. package/runtime/widget-icons/drawdy.png +0 -0
  25. package/runtime/widget-icons/filings-feed.png +0 -0
  26. package/runtime/widget-icons/financial-stress.png +0 -0
  27. package/runtime/widget-icons/flappy-bird.png +0 -0
  28. package/runtime/widget-icons/fundamentals.png +0 -0
  29. package/runtime/widget-icons/holiday-calendar.png +0 -0
  30. package/runtime/widget-icons/journal-log.png +0 -0
  31. package/runtime/widget-icons/journal-open.png +0 -0
  32. package/runtime/widget-icons/journal-results.png +0 -0
  33. package/runtime/widget-icons/journal-score.png +0 -0
  34. package/runtime/widget-icons/labor-market.png +0 -0
  35. package/runtime/widget-icons/lightning-stats.png +0 -0
  36. package/runtime/widget-icons/link-grid.png +0 -0
  37. package/runtime/widget-icons/market-cap-treemap.png +0 -0
  38. package/runtime/widget-icons/marquee.png +0 -0
  39. package/runtime/widget-icons/mining-pools.png +0 -0
  40. package/runtime/widget-icons/national-debt.png +0 -0
  41. package/runtime/widget-icons/news-feed.png +0 -0
  42. package/runtime/widget-icons/open-interest.png +0 -0
  43. package/runtime/widget-icons/options-iv.png +0 -0
  44. package/runtime/widget-icons/options-oi-strike.png +0 -0
  45. package/runtime/widget-icons/options-put-call.png +0 -0
  46. package/runtime/widget-icons/pomodoro.png +0 -0
  47. package/runtime/widget-icons/portfolio-allocation.png +0 -0
  48. package/runtime/widget-icons/portfolio-holdings.png +0 -0
  49. package/runtime/widget-icons/portfolio-value.png +0 -0
  50. package/runtime/widget-icons/protocol-fees-treemap.png +0 -0
  51. package/runtime/widget-icons/protocol-tvl-chart.png +0 -0
  52. package/runtime/widget-icons/protocol-tvl-treemap.png +0 -0
  53. package/runtime/widget-icons/quote.png +0 -0
  54. package/runtime/widget-icons/returns-projector.png +0 -0
  55. package/runtime/widget-icons/risk-reward.png +0 -0
  56. package/runtime/widget-icons/rules-card.png +0 -0
  57. package/runtime/widget-icons/session-progress.png +0 -0
  58. package/runtime/widget-icons/short-volume.png +0 -0
  59. package/runtime/widget-icons/snake.png +0 -0
  60. package/runtime/widget-icons/spotify-embed.png +0 -0
  61. package/runtime/widget-icons/stopwatch.png +0 -0
  62. package/runtime/widget-icons/treasury-auctions.png +0 -0
  63. package/runtime/widget-icons/video.png +0 -0
  64. package/runtime/widget-icons/yield-curve.png +0 -0
  65. package/runtime/assets/editor-CY2XpG9x.js +0 -68
  66. package/runtime/assets/editor-DinyMxo6.css +0 -1
  67. package/runtime/assets/index-Bpmi3x1d.js +0 -597
  68. package/runtime/assets/index-CsheOEUr.css +0 -1
@@ -1,597 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DPlG_EDx.js","assets/react-qoZPGuNy.js","assets/editor-CY2XpG9x.js","assets/gridstack-BxxvPIFU.js","assets/gridstack-FIb_WQSt.css","assets/d3-B3esOK0k.js","assets/liveline-C5zt2WuS.js","assets/editor-DinyMxo6.css"])))=>i.map(i=>d[i]);
2
- var ki=Object.defineProperty;var Si=(e,t,n)=>t in e?ki(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var V=(e,t,n)=>Si(e,typeof t!="symbol"?t+"":t,n);import{r as p,j as o,R as Ni,c as ji}from"./react-qoZPGuNy.js";import{s as _i,i as Ci,h as Ti,l as Vn,a as Ee,m as zi,b as Mi,t as _n,c as Ei,d as Ls,e as Cn,f as Us,g as ur,j as Bs,k as Tn,n as Ri,o as zn,p as Ai,q as Pi,r as dr,u as $i,v as Di,w as mr,x as Ii,y as Fi}from"./d3-B3esOK0k.js";import{L as Hs}from"./liveline-C5zt2WuS.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const Oi="modulepreload",Li=function(e){return"/"+e},fr={},Vs=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let i=function(l){return Promise.all(l.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));s=i(n.map(l=>{if(l=Li(l),l in fr)return;fr[l]=!0;const d=l.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${m}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Oi,d||(h.as="script"),h.crossOrigin="",h.href=l,u&&h.setAttribute("nonce",u),document.head.appendChild(h),d)return new Promise((g,w)=>{h.addEventListener("load",g),h.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${l}`)))})}))}function a(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return s.then(i=>{for(const c of i||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};function Ui(e){return new Map(e.map(t=>[t.name,t]))}var hr;function C(e,t,n){function r(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);const l=i.prototype,d=Object.keys(l);for(let m=0;m<d.length;m++){const h=d[m];h in c||(c[h]=l[h].bind(c))}}const s=(n==null?void 0:n.Parent)??Object;class a extends s{}Object.defineProperty(a,"name",{value:e});function i(c){var u;const l=n!=null&&n.Parent?new a:this;r(l,c),(u=l._zod).deferred??(u.deferred=[]);for(const d of l._zod.deferred)d();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>{var u,l;return n!=null&&n.Parent&&c instanceof n.Parent?!0:(l=(u=c==null?void 0:c._zod)==null?void 0:u.traits)==null?void 0:l.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class at extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zs extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(hr=globalThis).__zod_globalConfig??(hr.__zod_globalConfig={});const Zn=globalThis.__zod_globalConfig;function Ie(e){return Zn}function Gs(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function Mn(e,t){return typeof t=="bigint"?t.toString():t}function Gn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Wn(e){return e==null}function Yn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Bi(e,t){const n=e/t,r=Math.round(n),s=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<s?0:n-r}const pr=Symbol("evaluating");function ee(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==pr)return r===void 0&&(r=pr,r=n()),r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Je(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ge(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function gr(e){return JSON.stringify(e)}function Hi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ws="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Vi=Gn(()=>{var e;if(Zn.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function it(e){if(Gt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Gt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ys(e){return it(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Zi=new Set(["string","number","symbol"]);function en(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function L(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Gi(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Wi={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Yi(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=Ge(e._zod.def,{get shape(){const i={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(i[c]=n.shape[c])}return Je(this,"shape",i),i},checks:[]});return We(e,a)}function Xi(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Ge(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete i[c]}return Je(this,"shape",i),i},checks:[]});return We(e,a)}function Ki(e,t){if(!it(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const a=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(a,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Ge(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return Je(this,"shape",a),a}});return We(e,s)}function qi(e,t){if(!it(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ge(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Je(this,"shape",r),r}});return We(e,n)}function Ji(e,t){var r;if((r=e._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=Ge(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return Je(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return We(e,n)}function Qi(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=Ge(t._zod.def,{get shape(){const c=t._zod.def.shape,u={...c};if(n)for(const l in n){if(!(l in c))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(u[l]=e?new e({type:"optional",innerType:c[l]}):c[l])}else for(const l in c)u[l]=e?new e({type:"optional",innerType:c[l]}):c[l];return Je(this,"shape",u),u},checks:[]});return We(t,i)}function ec(e,t,n){const r=Ge(t._zod.def,{get shape(){const s=t._zod.def.shape,a={...s};if(n)for(const i in n){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=new e({type:"nonoptional",innerType:s[i]}))}else for(const i in s)a[i]=new e({type:"nonoptional",innerType:s[i]});return Je(this,"shape",a),a}});return We(t,r)}function st(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function tc(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function ot(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function _t(e){return typeof e=="string"?e:e==null?void 0:e.message}function Fe(e,t,n){var u,l,d,m,h,g;const r=e.message?e.message:_t((d=(l=(u=e.inst)==null?void 0:u._zod.def)==null?void 0:l.error)==null?void 0:d.call(l,e))??_t((m=t==null?void 0:t.error)==null?void 0:m.call(t,e))??_t((h=n.customError)==null?void 0:h.call(n,e))??_t((g=n.localeError)==null?void 0:g.call(n,e))??"Invalid input",{inst:s,continue:a,input:i,...c}=e;return c.path??(c.path=[]),c.message=r,t!=null&&t.reportInput&&(c.input=i),c}function Xn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function vt(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Xs=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Mn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ks=C("$ZodError",Xs),qs=C("$ZodError",Xs,{Parent:Error});function nc(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function rc(e,t=n=>n.message){const n={_errors:[]},r=(s,a=[])=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>r({issues:c},[...a,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...a,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...a,...i.path]);else{const c=[...a,...i.path];if(c.length===0)n._errors.push(t(i));else{let u=n,l=0;for(;l<c.length;){const d=c[l];l===c.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(i))):u[d]=u[d]||{_errors:[]},u=u[d],l++}}}};return r(e),n}const Kn=e=>(t,n,r,s)=>{const a=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new at;if(i.issues.length){const c=new((s==null?void 0:s.Err)??e)(i.issues.map(u=>Fe(u,a,Ie())));throw Ws(c,s==null?void 0:s.callee),c}return i.value},qn=e=>async(t,n,r,s)=>{const a=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const c=new((s==null?void 0:s.Err)??e)(i.issues.map(u=>Fe(u,a,Ie())));throw Ws(c,s==null?void 0:s.callee),c}return i.value},tn=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new at;return a.issues.length?{success:!1,error:new(e??Ks)(a.issues.map(i=>Fe(i,s,Ie())))}:{success:!0,data:a.value}},sc=tn(qs),nn=e=>async(t,n,r)=>{const s=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},s);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(i=>Fe(i,s,Ie())))}:{success:!0,data:a.value}},oc=nn(qs),ac=e=>(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return Kn(e)(t,n,s)},ic=e=>(t,n,r)=>Kn(e)(t,n,r),cc=e=>async(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return qn(e)(t,n,s)},lc=e=>async(t,n,r)=>qn(e)(t,n,r),uc=e=>(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return tn(e)(t,n,s)},dc=e=>(t,n,r)=>tn(e)(t,n,r),mc=e=>async(t,n,r)=>{const s=r?{...r,direction:"backward"}:{direction:"backward"};return nn(e)(t,n,s)},fc=e=>async(t,n,r)=>nn(e)(t,n,r),hc=/^[cC][0-9a-z]{6,}$/,pc=/^[0-9a-z]+$/,gc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xc=/^[0-9a-vA-V]{20}$/,bc=/^[A-Za-z0-9]{27}$/,vc=/^[a-zA-Z0-9_-]{21}$/,yc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Sc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nc(){return new RegExp(Sc,"u")}const jc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,_c=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Cc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Tc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Js=/^[A-Za-z0-9_-]*$/,Mc=/^https?$/,Ec=/^\+[1-9]\d{6,14}$/,Qs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Rc=new RegExp(`^${Qs}$`);function eo(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ac(e){return new RegExp(`^${eo(e)}$`)}function Pc(e){const t=eo({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Qs}T(?:${r})$`)}const $c=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Dc=/^-?\d+$/,to=/^-?\d+(?:\.\d+)?$/,Ic=/^(?:true|false)$/i,Fc=/^[^A-Z]*$/,Oc=/^[^a-z]*$/,_e=C("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),no={number:"number",bigint:"bigint",object:"date"},ro=C("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);const n=no[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,a=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),so=C("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);const n=no[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,a=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Lc=C("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Bi(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Uc=C("$ZodCheckNumberFormat",(e,t)=>{var i;_e.init(e,t),t.format=t.format||"float64";const n=(i=t.format)==null?void 0:i.includes("int"),r=n?"int":"number",[s,a]=Wi[t.format];e._zod.onattach.push(c=>{const u=c._zod.bag;u.format=t.format,u.minimum=s,u.maximum=a,n&&(u.pattern=Dc)}),e._zod.check=c=>{const u=c.value;if(n){if(!Number.isInteger(u)){c.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?c.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):c.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<s&&c.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),u>a&&c.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Bc=C("$ZodCheckMaxLength",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Wn(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const i=Xn(s);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Hc=C("$ZodCheckMinLength",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Wn(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const i=Xn(s);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),Vc=C("$ZodCheckLengthEquals",(e,t)=>{var n;_e.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Wn(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,a=s.length;if(a===t.length)return;const i=Xn(s),c=a>t.length;r.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),rn=C("$ZodCheckStringFormat",(e,t)=>{var n,r;_e.init(e,t),e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Zc=C("$ZodCheckRegex",(e,t)=>{rn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Gc=C("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Fc),rn.init(e,t)}),Wc=C("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Oc),rn.init(e,t)}),Yc=C("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);const n=en(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const a=s._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),Xc=C("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);const n=new RegExp(`^${en(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Kc=C("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);const n=new RegExp(`.*${en(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),qc=C("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Jc{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
- `).filter(i=>i),s=Math.min(...r.map(i=>i.length-i.trimStart().length)),a=r.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(const i of a)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(a=>` ${a}`)];return new t(...n,s.join(`
4
- `))}}const Qc={major:4,minor:4,patch:3},ie=C("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qc;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const i of a._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const a=(c,u,l)=>{let d=st(c),m;for(const h of u){if(h._zod.def.when){if(tc(c)||!h._zod.def.when(c))continue}else if(d)continue;const g=c.issues.length,w=h._zod.check(c);if(w instanceof Promise&&(l==null?void 0:l.async)===!1)throw new at;if(m||w instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await w,c.issues.length!==g&&(d||(d=st(c,g)))});else{if(c.issues.length===g)continue;d||(d=st(c,g))}}return m?m.then(()=>c):c},i=(c,u,l)=>{if(st(c))return c.aborted=!0,c;const d=a(u,r,l);if(d instanceof Promise){if(l.async===!1)throw new at;return d.then(m=>e._zod.parse(m,l))}return e._zod.parse(d,l)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){const d=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return d instanceof Promise?d.then(m=>i(m,c,u)):i(d,c,u)}const l=e._zod.parse(c,u);if(l instanceof Promise){if(u.async===!1)throw new at;return l.then(d=>a(d,r,u))}return a(l,r,u)}}ee(e,"~standard",()=>({validate:a=>{var i;try{const c=sc(e,a);return c.success?{value:c.data}:{issues:(i=c.error)==null?void 0:i.issues}}catch{return oc(e,a).then(u=>{var l;return u.success?{value:u.data}:{issues:(l=u.error)==null?void 0:l.issues}})}},vendor:"zod",version:1}))}),Jn=C("$ZodString",(e,t)=>{var n;ie.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??$c(e._zod.bag),e._zod.parse=(r,s)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),se=C("$ZodStringFormat",(e,t)=>{rn.init(e,t),Jn.init(e,t)}),el=C("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wc),se.init(e,t)}),tl=C("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=xr(r))}else t.pattern??(t.pattern=xr());se.init(e,t)}),nl=C("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kc),se.init(e,t)}),rl=C("$ZodURL",(e,t)=>{se.init(e,t),e._zod.check=n=>{var r;try{const s=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===Mc.source&&!/^https?:\/\//i.test(s)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const a=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=a.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),sl=C("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Nc()),se.init(e,t)}),ol=C("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=vc),se.init(e,t)}),al=C("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hc),se.init(e,t)}),il=C("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=pc),se.init(e,t)}),cl=C("$ZodULID",(e,t)=>{t.pattern??(t.pattern=gc),se.init(e,t)}),ll=C("$ZodXID",(e,t)=>{t.pattern??(t.pattern=xc),se.init(e,t)}),ul=C("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bc),se.init(e,t)}),dl=C("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pc(t)),se.init(e,t)}),ml=C("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rc),se.init(e,t)}),fl=C("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ac(t)),se.init(e,t)}),hl=C("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=yc),se.init(e,t)}),pl=C("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=jc),se.init(e,t),e._zod.bag.format="ipv4"}),gl=C("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=_c),se.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),xl=C("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Cc),se.init(e,t)}),bl=C("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Tc),se.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[s,a]=r;if(!a)throw new Error;const i=Number(a);if(`${i}`!==a)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function oo(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const vl=C("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=zc),se.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{oo(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function yl(e){if(!Js.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return oo(n)}const wl=C("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Js),se.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{yl(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),kl=C("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ec),se.init(e,t)});function Sl(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const Nl=C("$ZodJWT",(e,t)=>{se.init(e,t),e._zod.check=n=>{Sl(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ao=C("$ZodNumber",(e,t)=>{ie.init(e,t),e._zod.pattern=e._zod.bag.pattern??to,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const a=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...a?{received:a}:{}}),n}}),jl=C("$ZodNumberFormat",(e,t)=>{Uc.init(e,t),ao.init(e,t)}),_l=C("$ZodBoolean",(e,t)=>{ie.init(e,t),e._zod.pattern=Ic,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),Cl=C("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=n=>n}),Tl=C("$ZodNever",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function br(e,t,n){e.issues.length&&t.issues.push(...ot(n,e.issues)),t.value[n]=e.value}const zl=C("$ZodArray",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const a=[];for(let i=0;i<s.length;i++){const c=s[i],u=t.element._zod.run({value:c,issues:[]},r);u instanceof Promise?a.push(u.then(l=>br(l,n,i))):br(u,n,i)}return a.length?Promise.all(a).then(()=>n):n}});function Wt(e,t,n,r,s,a){const i=n in r;if(e.issues.length){if(s&&a&&!i)return;t.issues.push(...ot(n,e.issues))}if(!i&&!s){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?i&&(t.value[n]=void 0):t.value[n]=e.value}function io(e){var r,s,a,i;const t=Object.keys(e.shape);for(const c of t)if(!((i=(a=(s=(r=e.shape)==null?void 0:r[c])==null?void 0:s._zod)==null?void 0:a.traits)!=null&&i.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const n=Gi(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function co(e,t,n,r,s,a){const i=[],c=s.keySet,u=s.catchall._zod,l=u.def.type,d=u.optin==="optional",m=u.optout==="optional";for(const h in t){if(h==="__proto__"||c.has(h))continue;if(l==="never"){i.push(h);continue}const g=u.run({value:t[h],issues:[]},r);g instanceof Promise?e.push(g.then(w=>Wt(w,n,h,t,d,m))):Wt(g,n,h,t,d,m)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const Ml=C("$ZodObject",(e,t)=>{ie.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}const r=Gn(()=>io(t));ee(e._zod,"propValues",()=>{const c=t.shape,u={};for(const l in c){const d=c[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(const m of d.values)u[l].add(m)}}return u});const s=Gt,a=t.catchall;let i;e._zod.parse=(c,u)=>{i??(i=r.value);const l=c.value;if(!s(l))return c.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),c;c.value={};const d=[],m=i.shape;for(const h of i.keys){const g=m[h],w=g._zod.optin==="optional",v=g._zod.optout==="optional",f=g._zod.run({value:l[h],issues:[]},u);f instanceof Promise?d.push(f.then(x=>Wt(x,c,h,l,w,v))):Wt(f,c,h,l,w,v)}return a?co(d,l,c,u,r.value,e):d.length?Promise.all(d).then(()=>c):c}}),El=C("$ZodObjectJIT",(e,t)=>{Ml.init(e,t);const n=e._zod.parse,r=Gn(()=>io(t)),s=h=>{var S,k;const g=new Jc(["shape","payload","ctx"]),w=r.value,v=T=>{const N=gr(T);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};g.write("const input = payload.value;");const f=Object.create(null);let x=0;for(const T of w.keys)f[T]=`key_${x++}`;g.write("const newResult = {};");for(const T of w.keys){const N=f[T],j=gr(T),b=h[T],_=((S=b==null?void 0:b._zod)==null?void 0:S.optin)==="optional",P=((k=b==null?void 0:b._zod)==null?void 0:k.optout)==="optional";g.write(`const ${N} = ${v(T)};`),_&&P?g.write(`
5
- if (${N}.issues.length) {
6
- if (${j} in input) {
7
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
8
- ...iss,
9
- path: iss.path ? [${j}, ...iss.path] : [${j}]
10
- })));
11
- }
12
- }
13
-
14
- if (${N}.value === undefined) {
15
- if (${j} in input) {
16
- newResult[${j}] = undefined;
17
- }
18
- } else {
19
- newResult[${j}] = ${N}.value;
20
- }
21
-
22
- `):_?g.write(`
23
- if (${N}.issues.length) {
24
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
25
- ...iss,
26
- path: iss.path ? [${j}, ...iss.path] : [${j}]
27
- })));
28
- }
29
-
30
- if (${N}.value === undefined) {
31
- if (${j} in input) {
32
- newResult[${j}] = undefined;
33
- }
34
- } else {
35
- newResult[${j}] = ${N}.value;
36
- }
37
-
38
- `):g.write(`
39
- const ${N}_present = ${j} in input;
40
- if (${N}.issues.length) {
41
- payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
42
- ...iss,
43
- path: iss.path ? [${j}, ...iss.path] : [${j}]
44
- })));
45
- }
46
- if (!${N}_present && !${N}.issues.length) {
47
- payload.issues.push({
48
- code: "invalid_type",
49
- expected: "nonoptional",
50
- input: undefined,
51
- path: [${j}]
52
- });
53
- }
54
-
55
- if (${N}_present) {
56
- if (${N}.value === undefined) {
57
- newResult[${j}] = undefined;
58
- } else {
59
- newResult[${j}] = ${N}.value;
60
- }
61
- }
62
-
63
- `)}g.write("payload.value = newResult;"),g.write("return payload;");const y=g.compile();return(T,N)=>y(h,T,N)};let a;const i=Gt,c=!Zn.jitless,l=c&&Vi.value,d=t.catchall;let m;e._zod.parse=(h,g)=>{m??(m=r.value);const w=h.value;return i(w)?c&&l&&(g==null?void 0:g.async)===!1&&g.jitless!==!0?(a||(a=s(t.shape)),h=a(h,g),d?co([],w,h,g,m,e):h):n(h,g):(h.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),h)}});function vr(e,t,n,r){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const s=e.filter(a=>!st(a));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(i=>Fe(i,r,Ie())))}),t)}const Rl=C("$ZodUnion",(e,t)=>{ie.init(e,t),ee(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ee(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ee(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),ee(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${r.map(s=>Yn(s.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,s)=>{if(n)return n(r,s);let a=!1;const i=[];for(const c of t.options){const u=c._zod.run({value:r.value,issues:[]},s);if(u instanceof Promise)i.push(u),a=!0;else{if(u.issues.length===0)return u;i.push(u)}}return a?Promise.all(i).then(c=>vr(c,r,e,s)):vr(i,r,e,s)}}),Al=C("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,a=t.left._zod.run({value:s,issues:[]},r),i=t.right._zod.run({value:s,issues:[]},r);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([u,l])=>yr(n,u,l)):yr(n,a,i)}});function En(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(it(e)&&it(t)){const n=Object.keys(t),r=Object.keys(e).filter(a=>n.indexOf(a)!==-1),s={...e,...t};for(const a of r){const i=En(e[a],t[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};s[a]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const s=e[r],a=t[r],i=En(s,a);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yr(e,t,n){const r=new Map;let s;for(const c of t.issues)if(c.code==="unrecognized_keys"){s??(s=c);for(const u of c.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const u of c.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(c);const a=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length&&s&&e.issues.push({...s,keys:a}),st(e))return e;const i=En(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Pl=C("$ZodRecord",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!it(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const a=[],i=t.keyType._zod.values;if(i){n.value={};const c=new Set;for(const l of i)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);const d=t.keyType._zod.run({value:l,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(g=>Fe(g,r,Ie())),input:l,path:[l],inst:e});continue}const m=d.value,h=t.valueType._zod.run({value:s[l],issues:[]},r);h instanceof Promise?a.push(h.then(g=>{g.issues.length&&n.issues.push(...ot(l,g.issues)),n.value[m]=g.value})):(h.issues.length&&n.issues.push(...ot(l,h.issues)),n.value[m]=h.value)}let u;for(const l in s)c.has(l)||(u=u??[],u.push(l));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u})}else{n.value={};for(const c of Reflect.ownKeys(s)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,c))continue;let u=t.keyType._zod.run({value:c,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&to.test(c)&&u.issues.length){const m=t.keyType._zod.run({value:Number(c),issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){t.mode==="loose"?n.value[c]=s[c]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>Fe(m,r,Ie())),input:c,path:[c],inst:e});continue}const d=t.valueType._zod.run({value:s[c],issues:[]},r);d instanceof Promise?a.push(d.then(m=>{m.issues.length&&n.issues.push(...ot(c,m.issues)),n.value[u.value]=m.value})):(d.issues.length&&n.issues.push(...ot(c,d.issues)),n.value[u.value]=d.value)}}return a.length?Promise.all(a).then(()=>n):n}}),$l=C("$ZodEnum",(e,t)=>{ie.init(e,t);const n=Gs(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(s=>Zi.has(typeof s)).map(s=>typeof s=="string"?en(s):s.toString()).join("|")})$`),e._zod.parse=(s,a)=>{const i=s.value;return r.has(i)||s.issues.push({code:"invalid_value",values:n,input:i,inst:e}),s}}),Dl=C("$ZodTransform",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zs(e.constructor.name);const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(n.value=i,n.fallback=!0,n));if(s instanceof Promise)throw new at;return n.value=s,n.fallback=!0,n}});function wr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const lo=C("$ZodOptional",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Yn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const s=n.value,a=t.innerType._zod.run(n,r);return a instanceof Promise?a.then(i=>wr(i,s)):wr(a,s)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Il=C("$ZodExactOptional",(e,t)=>{lo.init(e,t),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Fl=C("$ZodNullable",(e,t)=>{ie.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Yn(n.source)}|null)$`):void 0}),ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ol=C("$ZodDefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>kr(a,t)):kr(s,t)}});function kr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ll=C("$ZodPrefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Ul=C("$ZodNonOptional",(e,t)=>{ie.init(e,t),ee(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>Sr(a,e)):Sr(s,e)}});function Sr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Bl=C("$ZodCatch",(e,t)=>{ie.init(e,t),e._zod.optin="optional",ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(a=>(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>Fe(i,r,Ie()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>Fe(a,r,Ie()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),uo=C("$ZodPipe",(e,t)=>{ie.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const a=t.out._zod.run(n,r);return a instanceof Promise?a.then(i=>Ct(i,t.in,r)):Ct(a,t.in,r)}const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(a=>Ct(a,t.out,r)):Ct(s,t.out,r)}});function Ct(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Hl=C("$ZodPreprocess",(e,t)=>{uo.init(e,t)}),Vl=C("$ZodReadonly",(e,t)=>{ie.init(e,t),ee(e._zod,"propValues",()=>t.innerType._zod.propValues),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ee(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(Nr):Nr(s)}});function Nr(e){return e.value=Object.freeze(e.value),e}const Zl=C("$ZodCustom",(e,t)=>{_e.init(e,t),ie.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(a=>jr(a,n,r,e));jr(s,n,r,e)}});function jr(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(vt(s))}}var _r;class Gl{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const s={...r,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Wl(){return new Gl}(_r=globalThis).__zod_globalRegistry??(_r.__zod_globalRegistry=Wl());const gt=globalThis.__zod_globalRegistry;function Yl(e,t){return new e({type:"string",...L(t)})}function Xl(e,t){return new e({type:"string",coerce:!0,...L(t)})}function Kl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...L(t)})}function Cr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...L(t)})}function ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...L(t)})}function Jl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(t)})}function Ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(t)})}function eu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(t)})}function tu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}function nu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...L(t)})}function ru(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(t)})}function su(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...L(t)})}function ou(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(t)})}function au(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...L(t)})}function iu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...L(t)})}function cu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(t)})}function lu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(t)})}function uu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(t)})}function du(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(t)})}function mu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(t)})}function fu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...L(t)})}function hu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...L(t)})}function pu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...L(t)})}function gu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...L(t)})}function xu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(t)})}function bu(e,t){return new e({type:"string",format:"date",check:"string_format",...L(t)})}function vu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...L(t)})}function yu(e,t){return new e({type:"string",format:"duration",check:"string_format",...L(t)})}function wu(e,t){return new e({type:"number",checks:[],...L(t)})}function ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}function Su(e,t){return new e({type:"boolean",...L(t)})}function Nu(e){return new e({type:"unknown"})}function ju(e,t){return new e({type:"never",...L(t)})}function Tr(e,t){return new ro({check:"less_than",...L(t),value:e,inclusive:!1})}function dn(e,t){return new ro({check:"less_than",...L(t),value:e,inclusive:!0})}function zr(e,t){return new so({check:"greater_than",...L(t),value:e,inclusive:!1})}function mn(e,t){return new so({check:"greater_than",...L(t),value:e,inclusive:!0})}function Mr(e,t){return new Lc({check:"multiple_of",...L(t),value:e})}function mo(e,t){return new Bc({check:"max_length",...L(t),maximum:e})}function Yt(e,t){return new Hc({check:"min_length",...L(t),minimum:e})}function fo(e,t){return new Vc({check:"length_equals",...L(t),length:e})}function _u(e,t){return new Zc({check:"string_format",format:"regex",...L(t),pattern:e})}function Cu(e){return new Gc({check:"string_format",format:"lowercase",...L(e)})}function Tu(e){return new Wc({check:"string_format",format:"uppercase",...L(e)})}function zu(e,t){return new Yc({check:"string_format",format:"includes",...L(t),includes:e})}function Mu(e,t){return new Xc({check:"string_format",format:"starts_with",...L(t),prefix:e})}function Eu(e,t){return new Kc({check:"string_format",format:"ends_with",...L(t),suffix:e})}function ct(e){return new qc({check:"overwrite",tx:e})}function Ru(e){return ct(t=>t.normalize(e))}function Au(){return ct(e=>e.trim())}function Pu(){return ct(e=>e.toLowerCase())}function $u(){return ct(e=>e.toUpperCase())}function Du(){return ct(e=>Hi(e))}function Iu(e,t,n){return new e({type:"array",element:t,...L(n)})}function Fu(e,t,n){return new e({type:"custom",check:"custom",fn:t,...L(n)})}function Ou(e,t){const n=Lu(r=>(r.addIssue=s=>{if(typeof s=="string")r.issues.push(vt(s,r.value,n._zod.def));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=n),a.continue??(a.continue=!n._zod.def.abort),r.issues.push(vt(a))}},e(r.value,r)),t);return n}function Lu(e,t){const n=new _e({check:"custom",...L(t)});return n._zod.check=e,n}function Xt(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??gt,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function te(e,t,n={path:[],schemaPath:[]}){var d,m;var r;const s=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const c=(m=(d=e._zod).toJSONSchema)==null?void 0:m.call(d);if(c)i.schema=c;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,h);else{const w=i.schema,v=t.processors[s.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);v(e,t,w,h)}const g=e._zod.parent;g&&(i.ref||(i.ref=g),te(g,t,h),t.seen.get(g).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&be(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Kt(e,t){var i,c,u,l;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of e.seen.entries()){const m=(i=e.metadataRegistry.get(d[0]))==null?void 0:i.id;if(m){const h=r.get(m);if(h&&h!==d[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,d[0])}}const s=d=>{var v;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=(v=e.external.registry.get(d[0]))==null?void 0:v.id,x=e.external.uri??(S=>S);if(f)return{ref:x(f)};const y=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=y,{defId:y,ref:`${x("__shared")}#/${m}/${y}`}}if(d[1]===n)return{ref:"#"};const g=`#/${m}/`,w=d[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:g+w}},a=d=>{if(d[1].schema.$ref)return;const m=d[1],{ref:h,defId:g}=s(d);m.def={...m.schema},g&&(m.defId=g);const w=m.schema;for(const v in w)delete w[v];w.$ref=h};if(e.cycles==="throw")for(const d of e.seen.entries()){const m=d[1];if(m.cycle)throw new Error(`Cycle detected: #/${(c=m.cycle)==null?void 0:c.join("/")}/<root>
64
-
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const m=d[1];if(t===d[0]){a(d);continue}if(e.external){const g=(u=e.external.registry.get(d[0]))==null?void 0:u.id;if(t!==d[0]&&g){a(d);continue}}if((l=e.metadataRegistry.get(d[0]))==null?void 0:l.id){a(d);continue}if(m.cycle){a(d);continue}if(m.count>1&&e.reused==="ref"){a(d);continue}}}function qt(e,t){var c,u,l,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{const h=e.seen.get(m);if(h.ref===null)return;const g=h.def??h.schema,w={...g},v=h.ref;if(h.ref=null,v){r(v);const x=e.seen.get(v),y=x.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(y)):Object.assign(g,y),Object.assign(g,w),m._zod.parent===v)for(const k in g)k==="$ref"||k==="allOf"||k in w||delete g[k];if(y.$ref&&x.def)for(const k in g)k==="$ref"||k==="allOf"||k in x.def&&JSON.stringify(g[k])===JSON.stringify(x.def[k])&&delete g[k]}const f=m._zod.parent;if(f&&f!==v){r(f);const x=e.seen.get(f);if(x!=null&&x.schema.$ref&&(g.$ref=x.schema.$ref,x.def))for(const y in g)y==="$ref"||y==="allOf"||y in x.def&&JSON.stringify(g[y])===JSON.stringify(x.def[y])&&delete g[y]}e.override({zodSchema:m,jsonSchema:g,path:h.path??[]})};for(const m of[...e.seen.entries()].reverse())r(m[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const m=(u=e.external.registry.get(t))==null?void 0:u.id;if(!m)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(m)}Object.assign(s,n.def??n.schema);const a=(l=e.metadataRegistry.get(t))==null?void 0:l.id;a!==void 0&&s.id===a&&delete s.id;const i=((d=e.external)==null?void 0:d.defs)??{};for(const m of e.seen.entries()){const h=m[1];h.def&&h.defId&&(h.def.id===h.defId&&delete h.def.id,i[h.defId]=h.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{const m=JSON.parse(JSON.stringify(s));return Object.defineProperty(m,"~standard",{value:{...t["~standard"],jsonSchema:{input:Jt(t,"input",e.processors),output:Jt(t,"output",e.processors)}},enumerable:!1,writable:!1}),m}catch{throw new Error("Error converting schema to JSON.")}}function be(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return be(r.element,n);if(r.type==="set")return be(r.valueType,n);if(r.type==="lazy")return be(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return be(r.innerType,n);if(r.type==="intersection")return be(r.left,n)||be(r.right,n);if(r.type==="record"||r.type==="map")return be(r.keyType,n)||be(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:be(r.in,n)||be(r.out,n);if(r.type==="object"){for(const s in r.shape)if(be(r.shape[s],n))return!0;return!1}if(r.type==="union"){for(const s of r.options)if(be(s,n))return!0;return!1}if(r.type==="tuple"){for(const s of r.items)if(be(s,n))return!0;return!!(r.rest&&be(r.rest,n))}return!1}const Uu=(e,t={})=>n=>{const r=Xt({...n,processors:t});return te(e,r),Kt(r,e),qt(r,e)},Jt=(e,t,n={})=>r=>{const{libraryOptions:s,target:a}=r??{},i=Xt({...s??{},target:a,io:t,processors:n});return te(e,i),Kt(i,e),qt(i,e)},Bu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ho=(e,t,n,r)=>{const s=n;s.type="string";const{minimum:a,maximum:i,format:c,patterns:u,contentEncoding:l}=e._zod.bag;if(typeof a=="number"&&(s.minLength=a),typeof i=="number"&&(s.maxLength=i),c&&(s.format=Bu[c]??c,s.format===""&&delete s.format,c==="time"&&delete s.format),l&&(s.contentEncoding=l),u&&u.size>0){const d=[...u];d.length===1?s.pattern=d[0].source:d.length>1&&(s.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},po=(e,t,n,r)=>{const s=n,{minimum:a,maximum:i,format:c,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:d}=e._zod.bag;typeof c=="string"&&c.includes("int")?s.type="integer":s.type="number";const m=typeof d=="number"&&d>=(a??Number.NEGATIVE_INFINITY),h=typeof l=="number"&&l<=(i??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";m?g?(s.minimum=d,s.exclusiveMinimum=!0):s.exclusiveMinimum=d:typeof a=="number"&&(s.minimum=a),h?g?(s.maximum=l,s.exclusiveMaximum=!0):s.exclusiveMaximum=l:typeof i=="number"&&(s.maximum=i),typeof u=="number"&&(s.multipleOf=u)},go=(e,t,n,r)=>{n.type="boolean"},Hu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Vu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Zu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Gu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Wu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},xo=(e,t,n,r)=>{n.not={}},Yu=(e,t,n,r)=>{},bo=(e,t,n,r)=>{},Xu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vo=(e,t,n,r)=>{const s=e._zod.def,a=Gs(s.entries);a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),n.enum=a},Ku=(e,t,n,r)=>{const s=e._zod.def,a=[];for(const i of s.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(i))}else a.push(i);if(a.length!==0)if(a.length===1){const i=a[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),a.every(i=>typeof i=="boolean")&&(n.type="boolean"),a.every(i=>i===null)&&(n.type="null"),n.enum=a},qu=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Ju=(e,t,n,r)=>{const s=n,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");s.type="string",s.pattern=a.source},Qu=(e,t,n,r)=>{const s=n,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:c,mime:u}=e._zod.bag;i!==void 0&&(a.minLength=i),c!==void 0&&(a.maxLength=c),u?u.length===1?(a.contentMediaType=u[0],Object.assign(s,a)):(Object.assign(s,a),s.anyOf=u.map(l=>({contentMediaType:l}))):Object.assign(s,a)},ed=(e,t,n,r)=>{n.type="boolean"},yo=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},td=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},wo=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},nd=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},rd=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},ko=(e,t,n,r)=>{const s=n,a=e._zod.def,{minimum:i,maximum:c}=e._zod.bag;typeof i=="number"&&(s.minItems=i),typeof c=="number"&&(s.maxItems=c),s.type="array",s.items=te(a.element,t,{...r,path:[...r.path,"items"]})},So=(e,t,n,r)=>{var l;const s=n,a=e._zod.def;s.type="object",s.properties={};const i=a.shape;for(const d in i)s.properties[d]=te(i[d],t,{...r,path:[...r.path,"properties",d]});const c=new Set(Object.keys(i)),u=new Set([...c].filter(d=>{const m=a.shape[d]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(s.required=Array.from(u)),((l=a.catchall)==null?void 0:l._zod.def.type)==="never"?s.additionalProperties=!1:a.catchall?a.catchall&&(s.additionalProperties=te(a.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},No=(e,t,n,r)=>{const s=e._zod.def,a=s.inclusive===!1,i=s.options.map((c,u)=>te(c,t,{...r,path:[...r.path,a?"oneOf":"anyOf",u]}));a?n.oneOf=i:n.anyOf=i},jo=(e,t,n,r)=>{const s=e._zod.def,a=te(s.left,t,{...r,path:[...r.path,"allOf",0]}),i=te(s.right,t,{...r,path:[...r.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,u=[...c(a)?a.allOf:[a],...c(i)?i.allOf:[i]];n.allOf=u},sd=(e,t,n,r)=>{const s=n,a=e._zod.def;s.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=a.items.map((h,g)=>te(h,t,{...r,path:[...r.path,i,g]})),l=a.rest?te(a.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null;t.target==="draft-2020-12"?(s.prefixItems=u,l&&(s.items=l)):t.target==="openapi-3.0"?(s.items={anyOf:u},l&&s.items.anyOf.push(l),s.minItems=u.length,l||(s.maxItems=u.length)):(s.items=u,l&&(s.additionalItems=l));const{minimum:d,maximum:m}=e._zod.bag;typeof d=="number"&&(s.minItems=d),typeof m=="number"&&(s.maxItems=m)},_o=(e,t,n,r)=>{const s=n,a=e._zod.def;s.type="object";const i=a.keyType,c=i._zod.bag,u=c==null?void 0:c.patterns;if(a.mode==="loose"&&u&&u.size>0){const d=te(a.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});s.patternProperties={};for(const m of u)s.patternProperties[m.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=te(a.keyType,t,{...r,path:[...r.path,"propertyNames"]})),s.additionalProperties=te(a.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const l=i._zod.values;if(l){const d=[...l].filter(m=>typeof m=="string"||typeof m=="number");d.length>0&&(s.required=d)}},Co=(e,t,n,r)=>{const s=e._zod.def,a=te(s.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=s.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},To=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType},zo=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},Mo=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},Eo=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType;let i;try{i=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Ro=(e,t,n,r)=>{const s=e._zod.def,a=s.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?a?s.out:s.in:s.out;te(i,t,r);const c=t.seen.get(e);c.ref=i},Ao=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType,n.readOnly=!0},od=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType},Qn=(e,t,n,r)=>{const s=e._zod.def;te(s.innerType,t,r);const a=t.seen.get(e);a.ref=s.innerType},ad=(e,t,n,r)=>{const s=e._zod.innerType;te(s,t,r);const a=t.seen.get(e);a.ref=s},Er={string:ho,number:po,boolean:go,bigint:Hu,symbol:Vu,null:Zu,undefined:Gu,void:Wu,never:xo,any:Yu,unknown:bo,date:Xu,enum:vo,literal:Ku,nan:qu,template_literal:Ju,file:Qu,success:ed,custom:yo,function:td,transform:wo,map:nd,set:rd,array:ko,object:So,union:No,intersection:jo,tuple:sd,record:_o,nullable:Co,nonoptional:To,default:zo,prefault:Mo,catch:Eo,pipe:Ro,readonly:Ao,promise:od,optional:Qn,lazy:ad};function i1(e,t){if("_idmap"in e){const r=e,s=Xt({...t,processors:Er}),a={};for(const u of r._idmap.entries()){const[l,d]=u;te(d,s)}const i={},c={registry:r,uri:t==null?void 0:t.uri,defs:a};s.external=c;for(const u of r._idmap.entries()){const[l,d]=u;Kt(s,d),i[l]=qt(s,d)}if(Object.keys(a).length>0){const u=s.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:a}}return{schemas:i}}const n=Xt({...t,processors:Er});return te(e,n),Kt(n,e),qt(n,e)}const id=C("ZodISODateTime",(e,t)=>{dl.init(e,t),oe.init(e,t)});function cd(e){return xu(id,e)}const ld=C("ZodISODate",(e,t)=>{ml.init(e,t),oe.init(e,t)});function ud(e){return bu(ld,e)}const dd=C("ZodISOTime",(e,t)=>{fl.init(e,t),oe.init(e,t)});function md(e){return vu(dd,e)}const fd=C("ZodISODuration",(e,t)=>{hl.init(e,t),oe.init(e,t)});function hd(e){return yu(fd,e)}const pd=(e,t)=>{Ks.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>rc(e,n)},flatten:{value:n=>nc(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Mn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Mn,2)}},isEmpty:{get(){return e.issues.length===0}}})},ze=C("ZodError",pd,{Parent:Error}),gd=Kn(ze),xd=qn(ze),bd=tn(ze),vd=nn(ze),yd=ac(ze),wd=ic(ze),kd=cc(ze),Sd=lc(ze),Nd=uc(ze),jd=dc(ze),_d=mc(ze),Cd=fc(ze),Rr=new WeakMap;function wt(e,t,n){const r=Object.getPrototypeOf(e);let s=Rr.get(r);if(s||(s=new Set,Rr.set(r,s)),!s.has(t)){s.add(t);for(const a in n){const i=n[a];Object.defineProperty(r,a,{configurable:!0,enumerable:!1,get(){const c=i.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const ce=C("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Jt(e,"input"),output:Jt(e,"output")}}),e.toJSONSchema=Uu(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>gd(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>bd(e,n,r),e.parseAsync=async(n,r)=>xd(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>vd(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>yd(e,n,r),e.decode=(n,r)=>wd(e,n,r),e.encodeAsync=async(n,r)=>kd(e,n,r),e.decodeAsync=async(n,r)=>Sd(e,n,r),e.safeEncode=(n,r)=>Nd(e,n,r),e.safeDecode=(n,r)=>jd(e,n,r),e.safeEncodeAsync=async(n,r)=>_d(e,n,r),e.safeDecodeAsync=async(n,r)=>Cd(e,n,r),wt(e,"ZodType",{check(...n){const r=this.def;return this.clone(Ge(r,{checks:[...r.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return We(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(bm(n,r))},superRefine(n,r){return this.check(vm(n,r))},overwrite(n){return this.check(ct(n))},optional(){return Dr(this)},exactOptional(){return om(this)},nullable(){return Ir(this)},nullish(){return Dr(Ir(this))},nonoptional(n){return dm(this,n)},array(){return he(this)},or(n){return Qd([this,n])},and(n){return tm(this,n)},transform(n){return Fr(this,Io(n))},default(n){return cm(this,n)},prefault(n){return um(this,n)},catch(n){return fm(this,n)},pipe(n){return Fr(this,n)},readonly(){return gm(this)},describe(n){const r=this.clone();return gt.add(r,{description:n}),r},meta(...n){if(n.length===0)return gt.get(this);const r=this.clone();return gt.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=gt.get(e))==null?void 0:n.description},configurable:!0}),e)),Po=C("_ZodString",(e,t)=>{Jn.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,s,a)=>ho(e,r,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,wt(e,"_ZodString",{regex(...r){return this.check(_u(...r))},includes(...r){return this.check(zu(...r))},startsWith(...r){return this.check(Mu(...r))},endsWith(...r){return this.check(Eu(...r))},min(...r){return this.check(Yt(...r))},max(...r){return this.check(mo(...r))},length(...r){return this.check(fo(...r))},nonempty(...r){return this.check(Yt(1,...r))},lowercase(r){return this.check(Cu(r))},uppercase(r){return this.check(Tu(r))},trim(){return this.check(Au())},normalize(...r){return this.check(Ru(...r))},toLowerCase(){return this.check(Pu())},toUpperCase(){return this.check($u())},slugify(){return this.check(Du())}})}),$o=C("ZodString",(e,t)=>{Jn.init(e,t),Po.init(e,t),e.email=n=>e.check(Kl(Td,n)),e.url=n=>e.check(tu(zd,n)),e.jwt=n=>e.check(gu(Vd,n)),e.emoji=n=>e.check(nu(Md,n)),e.guid=n=>e.check(Cr(Ar,n)),e.uuid=n=>e.check(ql(Tt,n)),e.uuidv4=n=>e.check(Jl(Tt,n)),e.uuidv6=n=>e.check(Ql(Tt,n)),e.uuidv7=n=>e.check(eu(Tt,n)),e.nanoid=n=>e.check(ru(Ed,n)),e.guid=n=>e.check(Cr(Ar,n)),e.cuid=n=>e.check(su(Rd,n)),e.cuid2=n=>e.check(ou(Ad,n)),e.ulid=n=>e.check(au(Pd,n)),e.base64=n=>e.check(fu(Ud,n)),e.base64url=n=>e.check(hu(Bd,n)),e.xid=n=>e.check(iu($d,n)),e.ksuid=n=>e.check(cu(Dd,n)),e.ipv4=n=>e.check(lu(Id,n)),e.ipv6=n=>e.check(uu(Fd,n)),e.cidrv4=n=>e.check(du(Od,n)),e.cidrv6=n=>e.check(mu(Ld,n)),e.e164=n=>e.check(pu(Hd,n)),e.datetime=n=>e.check(cd(n)),e.date=n=>e.check(ud(n)),e.time=n=>e.check(md(n)),e.duration=n=>e.check(hd(n))});function Z(e){return Yl($o,e)}const oe=C("ZodStringFormat",(e,t)=>{se.init(e,t),Po.init(e,t)}),Td=C("ZodEmail",(e,t)=>{nl.init(e,t),oe.init(e,t)}),Ar=C("ZodGUID",(e,t)=>{el.init(e,t),oe.init(e,t)}),Tt=C("ZodUUID",(e,t)=>{tl.init(e,t),oe.init(e,t)}),zd=C("ZodURL",(e,t)=>{rl.init(e,t),oe.init(e,t)}),Md=C("ZodEmoji",(e,t)=>{sl.init(e,t),oe.init(e,t)}),Ed=C("ZodNanoID",(e,t)=>{ol.init(e,t),oe.init(e,t)}),Rd=C("ZodCUID",(e,t)=>{al.init(e,t),oe.init(e,t)}),Ad=C("ZodCUID2",(e,t)=>{il.init(e,t),oe.init(e,t)}),Pd=C("ZodULID",(e,t)=>{cl.init(e,t),oe.init(e,t)}),$d=C("ZodXID",(e,t)=>{ll.init(e,t),oe.init(e,t)}),Dd=C("ZodKSUID",(e,t)=>{ul.init(e,t),oe.init(e,t)}),Id=C("ZodIPv4",(e,t)=>{pl.init(e,t),oe.init(e,t)}),Fd=C("ZodIPv6",(e,t)=>{gl.init(e,t),oe.init(e,t)}),Od=C("ZodCIDRv4",(e,t)=>{xl.init(e,t),oe.init(e,t)}),Ld=C("ZodCIDRv6",(e,t)=>{bl.init(e,t),oe.init(e,t)}),Ud=C("ZodBase64",(e,t)=>{vl.init(e,t),oe.init(e,t)}),Bd=C("ZodBase64URL",(e,t)=>{wl.init(e,t),oe.init(e,t)}),Hd=C("ZodE164",(e,t)=>{kl.init(e,t),oe.init(e,t)}),Vd=C("ZodJWT",(e,t)=>{Nl.init(e,t),oe.init(e,t)}),Do=C("ZodNumber",(e,t)=>{ao.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,s,a)=>po(e,r,s),wt(e,"ZodNumber",{gt(r,s){return this.check(zr(r,s))},gte(r,s){return this.check(mn(r,s))},min(r,s){return this.check(mn(r,s))},lt(r,s){return this.check(Tr(r,s))},lte(r,s){return this.check(dn(r,s))},max(r,s){return this.check(dn(r,s))},int(r){return this.check(Pr(r))},safe(r){return this.check(Pr(r))},positive(r){return this.check(zr(0,r))},nonnegative(r){return this.check(mn(0,r))},negative(r){return this.check(Tr(0,r))},nonpositive(r){return this.check(dn(0,r))},multipleOf(r,s){return this.check(Mr(r,s))},step(r,s){return this.check(Mr(r,s))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function U(e){return wu(Do,e)}const Zd=C("ZodNumberFormat",(e,t)=>{jl.init(e,t),Do.init(e,t)});function Pr(e){return ku(Zd,e)}const Gd=C("ZodBoolean",(e,t)=>{_l.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>go(e,n,r)});function ke(e){return Su(Gd,e)}const Wd=C("ZodUnknown",(e,t)=>{Cl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>bo()});function Rn(){return Nu(Wd)}const Yd=C("ZodNever",(e,t)=>{Tl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>xo(e,n,r)});function Xd(e){return ju(Yd,e)}const Kd=C("ZodArray",(e,t)=>{zl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>ko(e,n,r,s),e.element=t.element,wt(e,"ZodArray",{min(n,r){return this.check(Yt(n,r))},nonempty(n){return this.check(Yt(1,n))},max(n,r){return this.check(mo(n,r))},length(n,r){return this.check(fo(n,r))},unwrap(){return this.element}})});function he(e,t){return Iu(Kd,e,t)}const qd=C("ZodObject",(e,t)=>{El.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>So(e,n,r,s),ee(e,"shape",()=>t.shape),wt(e,"ZodObject",{keyof(){return ne(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Rn()})},loose(){return this.clone({...this._zod.def,catchall:Rn()})},strict(){return this.clone({...this._zod.def,catchall:Xd()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ki(this,n)},safeExtend(n){return qi(this,n)},merge(n){return Ji(this,n)},pick(n){return Yi(this,n)},omit(n){return Xi(this,n)},partial(...n){return Qi(Fo,this,n[0])},required(...n){return ec(Oo,this,n[0])}})});function I(e,t){const n={type:"object",shape:e??{},...L(t)};return new qd(n)}const Jd=C("ZodUnion",(e,t)=>{Rl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>No(e,n,r,s),e.options=t.options});function Qd(e,t){return new Jd({type:"union",options:e,...L(t)})}const em=C("ZodIntersection",(e,t)=>{Al.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>jo(e,n,r,s)});function tm(e,t){return new em({type:"intersection",left:e,right:t})}const $r=C("ZodRecord",(e,t)=>{Pl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>_o(e,n,r,s),e.keyType=t.keyType,e.valueType=t.valueType});function nm(e,t,n){return!t||!t._zod?new $r({type:"record",keyType:Z(),valueType:e,...L(t)}):new $r({type:"record",keyType:e,valueType:t,...L(n)})}const An=C("ZodEnum",(e,t)=>{$l.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,s,a)=>vo(e,r,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const a={};for(const i of r)if(n.has(i))a[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new An({...t,checks:[],...L(s),entries:a})},e.exclude=(r,s)=>{const a={...t.entries};for(const i of r)if(n.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new An({...t,checks:[],...L(s),entries:a})}});function ne(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new An({type:"enum",entries:n,...L(t)})}const rm=C("ZodTransform",(e,t)=>{Dl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>wo(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zs(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(vt(a,n.value,t));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(vt(i))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(a=>(n.value=a,n.fallback=!0,n)):(n.value=s,n.fallback=!0,n)}});function Io(e){return new rm({type:"transform",transform:e})}const Fo=C("ZodOptional",(e,t)=>{lo.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Qn(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Dr(e){return new Fo({type:"optional",innerType:e})}const sm=C("ZodExactOptional",(e,t)=>{Il.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Qn(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function om(e){return new sm({type:"optional",innerType:e})}const am=C("ZodNullable",(e,t)=>{Fl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Co(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function Ir(e){return new am({type:"nullable",innerType:e})}const im=C("ZodDefault",(e,t)=>{Ol.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>zo(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cm(e,t){return new im({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ys(t)}})}const lm=C("ZodPrefault",(e,t)=>{Ll.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Mo(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function um(e,t){return new lm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ys(t)}})}const Oo=C("ZodNonOptional",(e,t)=>{Ul.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>To(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function dm(e,t){return new Oo({type:"nonoptional",innerType:e,...L(t)})}const mm=C("ZodCatch",(e,t)=>{Bl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Eo(e,n,r,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fm(e,t){return new mm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Lo=C("ZodPipe",(e,t)=>{uo.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ro(e,n,r,s),e.in=t.in,e.out=t.out});function Fr(e,t){return new Lo({type:"pipe",in:e,out:t})}const hm=C("ZodPreprocess",(e,t)=>{Lo.init(e,t),Hl.init(e,t)}),pm=C("ZodReadonly",(e,t)=>{Vl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>Ao(e,n,r,s),e.unwrap=()=>e._zod.def.innerType});function gm(e){return new pm({type:"readonly",innerType:e})}const xm=C("ZodCustom",(e,t)=>{Zl.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,r,s)=>yo(e,n)});function bm(e,t={}){return Fu(xm,e,t)}function vm(e,t){return Ou(e,t)}function ym(e,t){return new hm({type:"pipe",in:Io(e),out:t})}function wm(e){return Xl($o,e)}const km=I({x:U().int().min(0).describe("Column offset, 0-based"),y:U().int().min(0).describe("Row offset, 0-based"),w:U().int().min(1).describe("Width in grid columns"),h:U().int().min(1).describe("Height in grid rows")}),Sm=I({id:Z().describe("Unique instance id within the dashboard"),frame:Z().describe("Name of a registered frame"),title:Z().optional().describe(`Card title shown in the frame's chrome. Overrides the default (the frame type name) — set a meaningful per-instance label, e.g. the ticker on a price-chart ("TSLA"). Ignored by chrome-less frames like heading.`),position:km,config:nm(Z(),Rn()).default({}).describe("Frame config; validated against the frame's own schema at render time")}),Nm=I({type:ne(["none","gradient","unicorn"]).default("gradient").describe("Background style: 'gradient' (built-in dark glow), 'unicorn' (animated Unicorn Studio scene), or 'none'."),projectId:Z().optional().describe("Unicorn Studio public project id — required when type is 'unicorn'."),scale:U().min(.1).max(2).default(1).describe("Unicorn scene render scale."),dpi:U().min(.5).max(3).default(1.5).describe("Unicorn scene device-pixel-ratio cap (perf vs sharpness)."),opacity:U().min(0).max(1).default(.16).describe("Opacity of the unicorn scene (0–1). Keep moderate (~0.15) so the animation reads as a living backdrop in the gutters without competing with the (opaque) dashboard cards.")}).describe("Visual background rendered behind the whole dashboard."),jm=I({accentHue:U().int().min(0).max(360).default(242).describe("Brand accent hue in degrees on the HSL color wheel (0–360). Rotates the dashboard's accent — card rims, title dots, chart highlights, loading states — across the spectrum. 242 is the default zframes indigo; rough anchors: 0 red, 35 orange, 50 amber, 150 green, 190 teal, 210 blue, 280 violet, 330 pink. Semantic up/down green/red, asset logos, and per-frame chart colors stay fixed."),accentSat:U().min(0).max(100).default(90).describe("Accent saturation as an HSL percentage (0–100). 90 is the default vivid zframes accent; lower it for muted/pastel rims and dots, 0 for a near-grayscale monochrome accent. Pairs with accentHue — hue picks the color, saturation picks how vivid it is.")}).describe("Dashboard-wide color identity (accent hue + saturation)."),_m=I({radius:U().min(0).default(18).describe("Frame corner radius in pixels, applied to every card via --zf-frame-radius. 0 squares the corners; the editor's Appearance rail exposes this as a slider."),borderStrength:U().min(0).max(1).default(.22).describe("Opacity of each card's accent rim (0–1) via --zf-border-alpha. 0 = borderless flat cards, 1 = a solid outlined rim; 0.22 is the default soft edge. Hover lifts it a notch automatically."),surfaceOpacity:U().min(.3).max(1).default(1).describe("Opacity of the card surface (0.3–1) via --zf-surface-opacity. 1 = opaque cards (default); lower it toward 0.5 for frosted/glassy cards that let the dashboard background show through. Kept ≥0.3 so card content stays legible."),density:U().min(.6).max(1.4).default(1).describe("Card padding scale (0.6–1.4) via --zf-density. 1 = the comfortable default; <1 tightens padding for information-dense dashboards, >1 gives roomier breathing space."),elevation:U().min(0).max(2).default(1).describe("Card shadow depth (0–2) via --zf-elevation. 0 = flat (no drop shadow), 1 = the default resting shadow, 2 = a heavier floating lift. Scales the card's drop shadow only.")}).describe("Card surface treatment — corners, border, opacity, padding density, and shadow depth. Distinct from `grid` (geometry) and `theme` (accent color)."),Cm=ym(e=>{if(!e||typeof e!="object")return e;const t=e,n=t.grid;if(n&&typeof n=="object"&&"radius"in n){const{radius:r,...s}=n;return{...t,grid:s,appearance:{radius:r,...t.appearance??{}}}}return e},I({version:wm().default("1.0.0").describe('Spec version, a semver-style string like package.json\'s ("1.0.0"). A legacy numeric `1` from an older spec is coerced to "1".'),title:Z().describe("Dashboard name, like package.json's name."),author:Z().optional().describe(`Who made this dashboard — a free-form credit, like package.json's author ("You" or "You <you@example.com>"). Optional.`),grid:I({columns:U().int().min(1).default(12),rowHeight:U().min(8).default(96),gap:U().min(0).default(12).describe("Pixels of space between frames (the grid gutter). 0 makes the cards flush; the editor's Layout rail exposes this as a slider.")}).default({columns:12,rowHeight:96,gap:12}),background:Nm.default({type:"gradient",scale:1,dpi:1.5,opacity:.16}),theme:jm.default({accentHue:242,accentSat:90}),appearance:_m.default({radius:18,borderStrength:.22,surfaceOpacity:1,density:1,elevation:1}),frames:he(Sm)})),Uo=p.createContext([]);function Tm({providers:e,children:t}){const n=Array.isArray(e)?e:[e];return o.jsx(Uo.Provider,{value:n,children:t})}function Bo(){return p.useContext(Uo)}function X(e){return Bo().find(n=>n.capabilities.includes(e))??null}function K(e,t,n,r){const[s,a]=p.useState(t),[i,c]=p.useState(!0);return p.useEffect(()=>{if(!e){c(!1);return}let u=!1;a(t),c(!0);const l=()=>{e().then(h=>{u||(a(h),c(!1))}).catch(()=>{u||c(!1)})};l();let d;const m=()=>{d=setTimeout(()=>{l(),m()},r*(.85+Math.random()*.3))};return m(),()=>{u=!0,clearTimeout(d)}},n),{data:s,isLoading:i}}function er(e){const t=X("quote-stream"),[n,r]=p.useState({}),[s,a]=p.useState(!0),i=e.join(",");return p.useEffect(()=>{const c=i.split(",").filter(Boolean);if(r({}),!(t!=null&&t.subscribeMids)||c.length===0){a(!1);return}let u=!1,l=!1;a(!0);const d=setTimeout(()=>{!u&&!l&&a(!1)},8e3),m=t.subscribeMids(h=>{u||(l=!0,clearTimeout(d),a(!1),r(g=>{let w=!1;const v={};for(const f of c){const x=h[f];x!==void 0&&(v[f]=x,x!==g[f]&&(w=!0))}return Object.keys(g).length!==Object.keys(v).length&&(w=!0),w?v:g}))},c);return()=>{u=!0,clearTimeout(d),m()}},[t,i]),{mids:n,isLoading:s}}function tr(e){return er(e).mids}function nr(e,t=3e4){const n=X("day-stats"),r=e?e.join(","):"*",s=r==="*"?void 0:r.split(",").filter(Boolean),{data:a,isLoading:i}=K(n!=null&&n.getDayStats?()=>n.getDayStats(s):null,{},[n,r,t],t);return{stats:a,isLoading:i}}function Pn(e,t=3e4){return nr(e,t).stats}function Ho(e,t,n=5*6e4){const r=X("funding-history"),s=e.join(","),a=s.split(",").filter(Boolean),{data:i,isLoading:c}=K(r!=null&&r.getFundingHistory&&a.length>0?()=>r.getFundingHistory(a,t):null,{},[r,s,t,n],n);return{history:i,isLoading:c}}function zm(e,t,n,r=6e4){const s=X("ohlcv"),{data:a,isLoading:i}=K(s!=null&&s.getCandles&&e?()=>s.getCandles(e,t,n):null,[],[s,e,t,n,r],r);return{candles:a,isLoading:i}}function Mm(e,t,n,r=6e4){const s=X("ohlcv"),a=e.join(","),i=a.split(",").filter(Boolean),{data:c,isLoading:u}=K(s!=null&&s.getCandles&&i.length>0?async()=>{const l=await Promise.all(i.map(d=>s.getCandles(d,t,n).then(m=>[d,m]).catch(()=>[d,[]])));return Object.fromEntries(l)}:null,{},[s,a,t,n,r],r);return{candles:c,isLoading:u}}function Em(e=10*6e4){const t=X("tvl"),{data:n,isLoading:r}=K(t!=null&&t.getTvlByChain?()=>t.getTvlByChain():null,[],[t,e],e);return{entries:n,isLoading:r}}function Rm(e=10*6e4){const t=X("dex-volume"),{data:n,isLoading:r}=K(t!=null&&t.getDexVolume?()=>t.getDexVolume():null,[],[t,e],e);return{entries:n,isLoading:r}}function Am(e,t=5*6e4){const n=X("dex-volume"),r=e.join(","),s=r.split(",").filter(Boolean),{data:a,isLoading:i}=K(n!=null&&n.getDexVolumeHistory&&s.length>0?()=>n.getDexVolumeHistory(s):null,{},[n,r,t],t);return{history:a,isLoading:i}}function Pm(e=10*6e4){const t=X("protocol-tvl"),{data:n,isLoading:r}=K(t!=null&&t.getProtocolTvl?()=>t.getProtocolTvl():null,[],[t,e],e);return{entries:n,isLoading:r}}function $m(e,t=5*6e4){const n=X("protocol-tvl"),r=e.join(","),s=r.split(",").filter(Boolean),{data:a,isLoading:i}=K(n!=null&&n.getProtocolTvlHistory&&s.length>0?()=>n.getProtocolTvlHistory(s):null,{},[n,r,t],t);return{history:a,isLoading:i}}function Dm(e=10*6e4){const t=X("protocol-fees"),{data:n,isLoading:r}=K(t!=null&&t.getProtocolFees?()=>t.getProtocolFees():null,[],[t,e],e);return{entries:n,isLoading:r}}function Im(e=10*6e4){const t=X("coin-markets"),{data:n,isLoading:r}=K(t!=null&&t.getCoinMarkets?()=>t.getCoinMarkets():null,[],[t,e],e);return{entries:n,isLoading:r}}function Fm(e=300,t=15*6e4){const n=X("coin-movers"),{data:r,isLoading:s}=K(n!=null&&n.getCoinMovers?()=>n.getCoinMovers(e):null,[],[n,e,t],t);return{entries:r,isLoading:s}}function Om(e,t=3e4){const n=X("open-interest"),r=e?e.join(","):"*",s=r==="*"?void 0:r.split(",").filter(Boolean),{data:a,isLoading:i}=K(n!=null&&n.getOpenInterest?()=>n.getOpenInterest(s):null,[],[n,r,t],t);return{entries:a,isLoading:i}}function Lm(e=15*6e4){const t=X("global-market"),{data:n,isLoading:r}=K(t!=null&&t.getGlobalMarket?()=>t.getGlobalMarket():null,null,[t,e],e);return{market:n,isLoading:r}}function Um(e=30,t=60*6e4){const n=X("sentiment"),{data:r,isLoading:s}=K(n!=null&&n.getFearGreed?()=>n.getFearGreed(e):null,[],[n,e,t],t);return{points:r,isLoading:s}}function Bm(e=15*6e4){const t=X("reference-rates"),{data:n,isLoading:r}=K(t!=null&&t.getReferenceRates?()=>t.getReferenceRates():null,[],[t,e],e);return{rates:n,isLoading:r}}function Hm(e=360*6e4){const t=X("treasury-rates"),{data:n,isLoading:r}=K(t!=null&&t.getTreasuryAverageRates?()=>t.getTreasuryAverageRates():null,[],[t,e],e);return{rates:n,isLoading:r}}function Vm(e=360*6e4){const t=X("yield-curve"),{data:n,isLoading:r}=K(t!=null&&t.getYieldCurve?()=>t.getYieldCurve():null,null,[t,e],e);return{curve:n,isLoading:r}}function Zm(e=8,t=360*6e4){const n=X("treasury-auctions"),{data:r,isLoading:s}=K(n!=null&&n.getTreasuryAuctions?()=>n.getTreasuryAuctions(e):null,[],[n,e,t],t);return{auctions:r,isLoading:s}}function Gm(e=180,t=360*6e4){const n=X("national-debt"),{data:r,isLoading:s}=K(n!=null&&n.getNationalDebt?()=>n.getNationalDebt(e):null,null,[n,e,t],t);return{debt:r,isLoading:s}}function Wm(e=360*6e4){const t=X("financial-stress"),{data:n,isLoading:r}=K(t!=null&&t.getFinancialStress?()=>t.getFinancialStress():null,null,[t,e],e);return{stress:n,isLoading:r}}function $n(e,t,n,r=720*6e4){const s=X("macro-series"),{data:a,isLoading:i}=K(s!=null&&s.getMacroSeries&&e?()=>s.getMacroSeries(e,t,n):null,null,[s,e,t,n,r],r);return{series:a,isLoading:i}}function Ym(e,t=30*6e4){const n=X("filings"),{data:r,isLoading:s}=K(n!=null&&n.getCompanyFilings&&e?()=>n.getCompanyFilings(e):null,null,[n,e,t],t);return{data:r,isLoading:s}}function Xm(e,t=720*6e4){const n=X("fundamentals"),{data:r,isLoading:s}=K(n!=null&&n.getCompanyFacts&&e?()=>n.getCompanyFacts(e):null,null,[n,e,t],t);return{data:r,isLoading:s}}function Km(e,t=360*6e4){const n=X("short-volume"),r=e.join(","),s=r.split(",").filter(Boolean),{data:a,isLoading:i}=K(n!=null&&n.getShortVolume&&s.length>0?()=>n.getShortVolume(s):null,{},[n,r,t],t);return{data:a,isLoading:i}}function qm(e,t,n,r=5*6e4){const s=X("news"),a=t?t.join(","):"",{data:i,isLoading:c}=K(s!=null&&s.getNews&&e?()=>s.getNews({feed:e,symbols:a?a.split(","):void 0,limit:n}):null,[],[s,e,a,n,r],r);return{items:i,isLoading:c}}function Jm(e=3e4){const t=X("btc-fees"),{data:n,isLoading:r}=K(t!=null&&t.getBtcFees?()=>t.getBtcFees():null,null,[t,e],e);return{fees:n,isLoading:r}}function Qm(e=15e3){const t=X("btc-mempool"),{data:n,isLoading:r}=K(t!=null&&t.getMempoolState?()=>t.getMempoolState():null,null,[t,e],e);return{state:n,isLoading:r}}function ef(e=8,t=3e4){const n=X("btc-blocks"),{data:r,isLoading:s}=K(n!=null&&n.getBtcBlocks?()=>n.getBtcBlocks(e):null,[],[n,e,t],t);return{blocks:r,isLoading:s}}function tf(e="1y",t=30*6e4){const n=X("btc-hashrate"),{data:r,isLoading:s}=K(n!=null&&n.getNetworkHashrate?()=>n.getNetworkHashrate(e):null,null,[n,e,t],t);return{data:r,isLoading:s}}function nf(e=6e4){const t=X("btc-difficulty"),{data:n,isLoading:r}=K(t!=null&&t.getDifficultyAdjustment?()=>t.getDifficultyAdjustment():null,null,[t,e],e);return{adjustment:n,isLoading:r}}function rf(e="1w",t=5*6e4){const n=X("mining-pools"),{data:r,isLoading:s}=K(n!=null&&n.getMiningPools?()=>n.getMiningPools(e):null,null,[n,e,t],t);return{pools:r,isLoading:s}}function sf(e=30*6e4){const t=X("lightning-stats"),{data:n,isLoading:r}=K(t!=null&&t.getLightningStats?()=>t.getLightningStats():null,null,[t,e],e);return{stats:n,isLoading:r}}function Vo(e,t=5*6e4){const n=X("options-summary"),r=(e||"BTC").toUpperCase(),{data:s,isLoading:a}=K(n!=null&&n.getOptionsSummary?()=>n.getOptionsSummary(r):null,null,[n,r,t],t);return{summary:s,isLoading:a}}function of(e,t,n=43200,r=10*6e4){const s=X("volatility-index"),a=(e||"BTC").toUpperCase(),{data:i,isLoading:c}=K(s!=null&&s.getVolatilityIndex?()=>s.getVolatilityIndex(a,t,n):null,[],[s,a,t,n,r],r);return{points:i,isLoading:c}}const af=p.createContext(null);function cf(){return p.useContext(af)}const lf=`
66
- .zf-grid {
67
- display: grid;
68
- gap: var(--zf-gap, 12px);
69
- grid-template-columns: repeat(var(--zf-cols, 12), minmax(0, 1fr));
70
- grid-auto-rows: var(--zf-row-h, 96px);
71
- }
72
- .zf-frame {
73
- grid-column: var(--zf-col-start, auto) / span var(--zf-col-span, 1);
74
- grid-row: var(--zf-row-start, auto) / span var(--zf-row-span, 1);
75
- position: relative;
76
- display: flex;
77
- flex-direction: column;
78
- min-height: 0;
79
- overflow: hidden;
80
- padding: calc(16px * var(--zf-density, 1)) calc(18px * var(--zf-density, 1));
81
- background: var(--zf-frame-bg, linear-gradient(165deg, rgba(26, 27, 38, calc(0.82 * var(--zf-surface-opacity, 1))) 0%, rgba(14, 15, 22, calc(0.86 * var(--zf-surface-opacity, 1))) 60%, rgba(10, 11, 17, calc(0.9 * var(--zf-surface-opacity, 1))) 100%));
82
- border: 1px solid var(--zf-frame-border, hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76% / var(--zf-border-alpha, 0.22)));
83
- border-radius: var(--zf-frame-radius, 18px);
84
- box-shadow: var(--zf-frame-shadow, inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4), 0 calc(18px * var(--zf-elevation, 1)) calc(44px * var(--zf-elevation, 1)) -26px rgba(0, 0, 0, 0.9));
85
- transition:
86
- border-color 0.25s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
87
- background 0.25s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
88
- box-shadow 0.25s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
89
- transform 0.25s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
90
- /* Frames arrive in a soft top-down cascade on first paint. The translate
91
- property (not transform) carries the motion, so the hover lift stays
92
- independent; the backwards fill holds the hidden state through the stagger
93
- delay, then hands transform back to :hover once the entrance settles. */
94
- animation: zf-enter 0.45s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) backwards;
95
- animation-delay: min(calc((var(--zf-enter-i, 0) + 1) * 35ms), 350ms);
96
- }
97
- /* Hover lift is pointer-only — on touch it would stick after a tap. */
98
- @media (hover: hover) {
99
- .zf-frame:hover {
100
- border-color: var(--zf-frame-border-hover, hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76% / calc(var(--zf-border-alpha, 0.22) + 0.2)));
101
- background: var(--zf-frame-bg-hover, linear-gradient(165deg, rgba(34, 35, 50, calc(0.88 * var(--zf-surface-opacity, 1))) 0%, rgba(18, 19, 28, calc(0.9 * var(--zf-surface-opacity, 1))) 60%, rgba(12, 13, 20, calc(0.92 * var(--zf-surface-opacity, 1))) 100%));
102
- box-shadow: var(--zf-frame-shadow-hover, inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 1px 2px rgba(0, 0, 0, 0.4), 0 calc(26px * var(--zf-elevation, 1)) calc(56px * var(--zf-elevation, 1)) -26px rgba(0, 0, 0, 0.92), 0 0 0 1px hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76% / 0.12), 0 calc(20px * var(--zf-elevation, 1)) calc(60px * var(--zf-elevation, 1)) -28px hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76% / 0.4)));
103
- transform: translateY(-2px);
104
- }
105
- }
106
- /* Top edge sheen — inset past the corner radius so the bright line never
107
- pokes outside the rounded border (which read as a clipped corner). */
108
- .zf-frame::before {
109
- content: '';
110
- position: absolute;
111
- top: 0;
112
- left: 18px;
113
- right: 18px;
114
- height: 1px;
115
- background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
116
- pointer-events: none;
117
- z-index: 2;
118
- }
119
- .zf-frame-title {
120
- position: relative;
121
- z-index: 1;
122
- display: flex;
123
- align-items: center;
124
- gap: 7px;
125
- margin-bottom: 12px;
126
- font-family: var(--font-dmsans, inherit);
127
- font-size: 10px;
128
- font-weight: 700;
129
- letter-spacing: 0.14em;
130
- text-transform: uppercase;
131
- color: var(--zf-frame-title, rgba(255, 255, 255, 0.5));
132
- flex: none;
133
- }
134
- .zf-frame-title::before {
135
- content: '';
136
- width: 5px;
137
- height: 5px;
138
- border-radius: 9999px;
139
- background: var(--zf-frame-title-dot, hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76%));
140
- box-shadow: 0 0 8px var(--zf-frame-title-dot-glow, hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76% / 0.9));
141
- }
142
- /* A title with a leading icon (e.g. an asset logo) drops the status dot — the
143
- logo is the card's identity marker. */
144
- .zf-frame-title--icon::before { display: none; }
145
- /* The title label takes the remaining width and truncates so a long title
146
- never shoves the source credit off the card. */
147
- .zf-frame-title-text {
148
- min-width: 0;
149
- overflow: hidden;
150
- text-overflow: ellipsis;
151
- white-space: nowrap;
152
- }
153
- /* Data-source credit — a clickable provider link pinned to the right of the
154
- title row. Brand casing is preserved (text-transform reset) so DeFiLlama /
155
- alternative.me read correctly against the uppercase title. */
156
- .zf-frame-source {
157
- margin-left: auto;
158
- padding-left: 10px;
159
- display: inline-flex;
160
- align-items: center;
161
- gap: 5px;
162
- flex: none;
163
- text-transform: none;
164
- letter-spacing: 0;
165
- font-weight: 600;
166
- }
167
- .zf-frame-source a {
168
- color: var(--zf-frame-source, rgba(255, 255, 255, 0.42));
169
- text-decoration: none;
170
- transition: color 0.2s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
171
- white-space: nowrap;
172
- }
173
- @media (hover: hover) {
174
- .zf-frame-source a:hover {
175
- color: var(--zf-frame-source-hover, hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 80%));
176
- text-decoration: underline;
177
- }
178
- }
179
- .zf-frame-source-sep { color: rgba(255, 255, 255, 0.22); }
180
- .zf-frame-body {
181
- position: relative;
182
- z-index: 1;
183
- flex: 1;
184
- min-height: 0;
185
- display: flex;
186
- flex-direction: column;
187
- }
188
- .zf-frame-body > * {
189
- flex: 1;
190
- min-height: 0;
191
- }
192
- /* ── Error cards ────────────────────────────────────────────────────────────
193
- Unknown frame / missing capability / invalid config / runtime crash all share
194
- one centered empty-state: an alert glyph, a headline naming what's wrong, the
195
- frame's name, then the specific detail. Centered (not top-left) so the card
196
- reads as a deliberate state instead of a raw debug dump floating in a void —
197
- and a faint red top-bloom signals "error" across the whole surface, not just
198
- the 1px border. This is also the generating agent's feedback surface, so the
199
- detail stays precise (field paths, the exact missing capability/provider). */
200
- .zf-frame--error {
201
- border-color: var(--zf-frame-error-border, rgba(242, 21, 83, 0.42));
202
- background: var(
203
- --zf-frame-error-bg,
204
- radial-gradient(125% 80% at 50% -12%, rgba(242, 21, 83, 0.13), transparent 60%),
205
- linear-gradient(165deg, rgba(26, 27, 38, 0.82) 0%, rgba(14, 15, 22, 0.86) 60%, rgba(10, 11, 17, 0.9) 100%)
206
- );
207
- }
208
- @media (hover: hover) {
209
- .zf-frame--error:hover {
210
- border-color: var(--zf-frame-error-border-hover, rgba(242, 21, 83, 0.6));
211
- background: var(
212
- --zf-frame-error-bg,
213
- radial-gradient(125% 80% at 50% -12%, rgba(242, 21, 83, 0.13), transparent 60%),
214
- linear-gradient(165deg, rgba(26, 27, 38, 0.82) 0%, rgba(14, 15, 22, 0.86) 60%, rgba(10, 11, 17, 0.9) 100%)
215
- );
216
- box-shadow: var(--zf-frame-shadow, inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 44px -26px rgba(0, 0, 0, 0.9)), 0 0 0 1px rgba(242, 21, 83, 0.14), 0 20px 56px -30px rgba(242, 21, 83, 0.4);
217
- }
218
- }
219
- /* The centered stack. flex:1 lets it claim the whole card; the inner content
220
- stays its natural height and is centered around the card's middle, so a 2×1
221
- card and a 6×4 card both read as composed rather than top-anchored. */
222
- .zf-error {
223
- flex: 1;
224
- min-height: 0;
225
- display: flex;
226
- flex-direction: column;
227
- align-items: center;
228
- justify-content: center;
229
- gap: 8px;
230
- padding: 4px 2px;
231
- text-align: center;
232
- overflow: auto;
233
- }
234
- .zf-error-icon {
235
- flex: none;
236
- width: 38px;
237
- height: 38px;
238
- display: grid;
239
- place-items: center;
240
- border-radius: 12px;
241
- color: var(--zf-frame-error-text, #ff8b9d);
242
- background: rgba(242, 21, 83, 0.12);
243
- box-shadow: inset 0 0 0 1px rgba(242, 21, 83, 0.32),
244
- 0 0 24px -8px rgba(242, 21, 83, 0.6);
245
- }
246
- .zf-error-icon svg {
247
- display: block;
248
- width: 20px;
249
- height: 20px;
250
- }
251
- .zf-error-headline {
252
- font-family: var(--font-dmsans, inherit);
253
- font-size: 13px;
254
- font-weight: 700;
255
- letter-spacing: 0.01em;
256
- color: var(--zf-frame-error-headline, rgba(255, 255, 255, 0.92));
257
- }
258
- .zf-error-frame {
259
- margin-top: -3px;
260
- font-size: 10px;
261
- font-weight: 700;
262
- letter-spacing: 0.14em;
263
- text-transform: uppercase;
264
- color: var(--zf-frame-error-text, #ff8b9d);
265
- }
266
- .zf-error-detail {
267
- margin: 2px 0 0;
268
- max-width: 44ch;
269
- font-size: 12px;
270
- line-height: 1.5;
271
- color: var(--zf-frame-error-detail, rgba(255, 255, 255, 0.6));
272
- }
273
- .zf-error-detail code {
274
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
275
- font-size: 0.92em;
276
- }
277
- /* Per-issue rows for invalid config: the field path as a code chip, the Zod
278
- message beside it. Block-centered but left-aligned inside, so a one-field
279
- error sits dead-centre and a multi-field one reads as a tidy list. */
280
- .zf-error-issues {
281
- list-style: none;
282
- margin: 2px 0 0;
283
- padding: 0;
284
- max-width: 100%;
285
- display: flex;
286
- flex-direction: column;
287
- gap: 6px;
288
- text-align: left;
289
- }
290
- .zf-error-issue {
291
- display: flex;
292
- flex-wrap: wrap;
293
- align-items: baseline;
294
- gap: 7px;
295
- padding: 6px 10px;
296
- border-radius: 9px;
297
- background: rgba(0, 0, 0, 0.22);
298
- border: 1px solid rgba(242, 21, 83, 0.18);
299
- }
300
- .zf-error-field {
301
- flex: none;
302
- font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
303
- font-size: 11px;
304
- font-weight: 700;
305
- color: var(--zf-frame-error-text, #ff8b9d);
306
- background: rgba(242, 21, 83, 0.14);
307
- padding: 1px 6px;
308
- border-radius: 5px;
309
- }
310
- .zf-error-msg {
311
- min-width: 0;
312
- font-size: 12px;
313
- line-height: 1.4;
314
- color: var(--zf-frame-error-detail, rgba(255, 255, 255, 0.68));
315
- }
316
- /* Registered-frame list under an "unknown frame" card — quiet, it's reference. */
317
- .zf-error-list {
318
- margin-top: 4px;
319
- font-size: 11px;
320
- line-height: 1.5;
321
- color: rgba(255, 255, 255, 0.4);
322
- }
323
- /* Bare frames (headings) divide a dashboard into zones — positioned slot,
324
- no card chrome, no auto-title. */
325
- .zf-bare {
326
- grid-column: var(--zf-col-start, auto) / span var(--zf-col-span, 1);
327
- grid-row: var(--zf-row-start, auto) / span var(--zf-row-span, 1);
328
- display: flex;
329
- align-items: flex-end;
330
- min-height: 0;
331
- overflow: hidden;
332
- animation: zf-enter 0.45s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) backwards;
333
- animation-delay: min(calc((var(--zf-enter-i, 0) + 1) * 35ms), 350ms);
334
- }
335
- /* Phones: the absolute x/y/w grid can't shrink below ~30px columns, so collapse
336
- to a single full-width column. Frames flow in spec order and keep their row
337
- span (height), but ignore horizontal placement. */
338
- @media (max-width: 640px) {
339
- .zf-grid {
340
- grid-template-columns: 1fr;
341
- }
342
- .zf-frame,
343
- .zf-bare {
344
- grid-column: 1 / -1;
345
- grid-row: auto / span var(--zf-row-span, 1);
346
- }
347
- .zf-frame {
348
- padding: calc(12px * var(--zf-density, 1)) calc(14px * var(--zf-density, 1));
349
- }
350
- }
351
- @keyframes zf-enter {
352
- from { opacity: 0; translate: 0 10px; }
353
- to { opacity: 1; translate: 0 0; }
354
- }
355
- /* Reduced-motion entrance: same timing + stagger, but a plain fade with no
356
- positional movement (motion is what triggers vestibular discomfort). */
357
- @keyframes zf-fade {
358
- from { opacity: 0; }
359
- to { opacity: 1; }
360
- }
361
- @media (prefers-reduced-motion: reduce) {
362
- .zf-frame,
363
- .zf-bare {
364
- animation-name: zf-fade;
365
- }
366
- .zf-frame:hover {
367
- transform: none;
368
- }
369
- }
370
- `,Zo=()=>o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"}),o.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),o.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]});function fn({outerClassName:e,style:t,headline:n,frame:r,children:s}){return o.jsx("div",{className:e,style:t,children:o.jsxs("div",{className:"zf-error",children:[o.jsx("span",{className:"zf-error-icon",children:o.jsx(Zo,{})}),o.jsx("div",{className:"zf-error-headline",children:n}),o.jsx("div",{className:"zf-error-frame",children:r}),s]})})}function uf({sources:e}){return e.length===0?null:o.jsx("span",{className:"zf-frame-source",children:e.map((t,n)=>o.jsxs(p.Fragment,{children:[n>0&&o.jsx("span",{className:"zf-frame-source-sep",children:"·"}),o.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer noopener",title:`Data source: ${t.name}`,onMouseDown:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:t.name})]},t.url))})}class Or extends p.Component{constructor(){super(...arguments);V(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?o.jsxs("div",{className:"zf-error",children:[o.jsx("span",{className:"zf-error-icon",children:o.jsx(Zo,{})}),o.jsx("div",{className:"zf-error-headline",children:"Frame crashed"}),o.jsx("p",{className:"zf-error-detail",children:this.state.error.message})]}):this.props.children}}function df({instance:e,registry:t,style:n,className:r=""}){const s=Bo(),a=t.get(e.frame),i=(...g)=>g.filter(Boolean).join(" ");if(!a)return o.jsxs(fn,{outerClassName:i("zf-frame","zf-frame--error",r),style:n,headline:"Unknown frame",frame:e.frame,children:[o.jsxs("p",{className:"zf-error-detail",children:[o.jsx("code",{children:e.frame})," isn’t a registered frame."]}),o.jsxs("p",{className:"zf-error-list",children:["Available: ",[...t.keys()].join(", ")]})]});const c=new Set(s.flatMap(g=>[...g.capabilities])),u=a.capabilities.filter(g=>!c.has(g));if(u.length>0)return o.jsx(fn,{outerClassName:i("zf-frame","zf-frame--error",r),style:n,headline:"No data source",frame:e.frame,children:o.jsxs("p",{className:"zf-error-detail",children:["No registered provider supplies"," ",u.map((g,w)=>o.jsxs(p.Fragment,{children:[w>0&&", ",o.jsx("code",{children:g})]},g)),"."]})});const l=a.schema.safeParse(e.config);if(!l.success)return o.jsx(fn,{outerClassName:i("zf-frame","zf-frame--error",r),style:n,headline:"Invalid configuration",frame:e.frame,children:o.jsx("ul",{className:"zf-error-issues",children:l.error.issues.map((g,w)=>o.jsxs("li",{className:"zf-error-issue",children:[o.jsx("code",{className:"zf-error-field",children:g.path.join(".")||"(root)"}),o.jsx("span",{className:"zf-error-msg",children:g.message.replace(/^Invalid input:\s*/i,"")})]},w))})});const d=a.component,m=a.titleIcon,h=a.source?Array.isArray(a.source)?a.source:[a.source]:[];return a.chrome==="bare"?o.jsx("div",{className:i("zf-bare",r),style:n,children:o.jsx(Or,{children:o.jsx(d,{config:l.data})})}):o.jsxs("div",{className:i("zf-frame",r),style:n,children:[o.jsxs("div",{className:i("zf-frame-title",m?"zf-frame-title--icon":""),children:[m?o.jsx(m,{config:l.data}):null,o.jsx("span",{className:"zf-frame-title-text",children:e.title??e.frame.replace(/-/g," ")}),o.jsx(uf,{sources:h})]}),o.jsx("div",{className:"zf-frame-body",children:o.jsx(Or,{children:o.jsx(d,{config:l.data})})})]})}function mf(e,t){const{x:n,y:r,w:s,h:a}=e.position;return{"--zf-col-start":n+1,"--zf-col-span":s,"--zf-row-start":r+1,"--zf-row-span":a,"--zf-enter-i":t}}function Lr({spec:e,registry:t}){return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:lf}),o.jsx("div",{className:"zf-grid",style:{"--zf-cols":e.grid.columns,"--zf-row-h":`${e.grid.rowHeight}px`,"--zf-gap":`${e.grid.gap}px`,"--zf-accent-hue":e.theme.accentHue,"--zf-accent-sat":`${e.theme.accentSat}%`,"--zf-frame-radius":`${e.appearance.radius}px`,"--zf-border-alpha":e.appearance.borderStrength,"--zf-surface-opacity":e.appearance.surfaceOpacity,"--zf-density":e.appearance.density,"--zf-elevation":e.appearance.elevation},children:e.frames.map((n,r)=>o.jsx(df,{instance:n,registry:t,style:mf(n,r)},n.id))})]})}const ff="/__zframes/dashboard.json",hf="/__zframes/dashboard",pf="/__zframes/proxy",gf="/__zframes/agents",xf="/__zframes/ask";function le(e){const t=e.indexOf(":");return t===-1?e:e.slice(t+1)}function Go(e){return e.includes(":")}function Wo(e){const t=le(e);return Go(e)?`https://assets.parqet.com/logos/symbol/${encodeURIComponent(t)}?format=png`:`https://assets.coincap.io/assets/icons/${t.toLowerCase()}@2x.png`}const Ur=["#5b6cff","#9b59ff","#e0608f","#e08a3c","#3fb6a8","#4f93e8","#7a8c52","#c0556b"];function bf(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Ur[Math.abs(t)%Ur.length]}function Le({symbol:e,size:t=18,className:n=""}){const r=le(e),s=Go(e),[a,i]=p.useState(!1);p.useEffect(()=>i(!1),[e]);const c=s?"rounded-[5px]":"rounded-full",u={width:t,height:t};return a?o.jsx("span",{"aria-hidden":!0,className:`inline-flex shrink-0 items-center justify-center font-bold leading-none text-white ${c} ${n}`,style:{...u,background:bf(r),fontSize:Math.round(t*.42)},children:r.slice(0,2).toUpperCase()}):o.jsx("img",{src:Wo(e),width:t,height:t,alt:"","aria-hidden":!0,draggable:!1,loading:"lazy",onError:()=>i(!0),className:`shrink-0 object-contain ${c} ${s?"bg-white p-px":""} ${n}`,style:u})}function Yo(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Yo(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function vf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Yo(e))&&(r&&(r+=" "),r+=t);return r}const yf=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},wf=(e,t)=>({classGroupId:e,validator:t}),Xo=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Qt="-",Br=[],kf="arbitrary..",Sf=e=>{const t=jf(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Nf(i);const c=i.split(Qt),u=c[0]===""&&c.length>1?1:0;return Ko(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],l=n[i];return u?l?yf(l,u):u:l||Br}return n[i]||Br}}},Ko=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const l=Ko(e,t+1,a);if(l)return l}const i=n.validators;if(i===null)return;const c=t===0?e.join(Qt):e.slice(t).join(Qt),u=i.length;for(let l=0;l<u;l++){const d=i[l];if(d.validator(c))return d.classGroupId}},Nf=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?kf+r:void 0})(),jf=e=>{const{theme:t,classGroups:n}=e;return _f(n,t)},_f=(e,t)=>{const n=Xo();for(const r in e){const s=e[r];rr(s,n,r,t)}return n},rr=(e,t,n,r)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];Cf(i,t,n,r)}},Cf=(e,t,n,r)=>{if(typeof e=="string"){Tf(e,t,n);return}if(typeof e=="function"){zf(e,t,n,r);return}Mf(e,t,n,r)},Tf=(e,t,n)=>{const r=e===""?t:qo(t,e);r.classGroupId=n},zf=(e,t,n,r)=>{if(Ef(e)){rr(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(wf(n,e))},Mf=(e,t,n,r)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[c,u]=s[i];rr(u,qo(t,c),n,r)}},qo=(e,t)=>{let n=e;const r=t.split(Qt),s=r.length;for(let a=0;a<s;a++){const i=r[a];let c=n.nextPart.get(i);c||(c=Xo(),n.nextPart.set(i,c)),n=c}return n},Ef=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Rf=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(a,i)=>{n[a]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(a){let i=n[a];if(i!==void 0)return i;if((i=r[a])!==void 0)return s(a,i),i},set(a,i){a in n?n[a]=i:s(a,i)}}},Dn="!",Hr=":",Af=[],Vr=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),Pf=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const a=[];let i=0,c=0,u=0,l;const d=s.length;for(let v=0;v<d;v++){const f=s[v];if(i===0&&c===0){if(f===Hr){a.push(s.slice(u,v)),u=v+1;continue}if(f==="/"){l=v;continue}}f==="["?i++:f==="]"?i--:f==="("?c++:f===")"&&c--}const m=a.length===0?s:s.slice(u);let h=m,g=!1;m.endsWith(Dn)?(h=m.slice(0,-1),g=!0):m.startsWith(Dn)&&(h=m.slice(1),g=!0);const w=l&&l>u?l-u:void 0;return Vr(a,g,h,w)};if(t){const s=t+Hr,a=r;r=i=>i.startsWith(s)?a(i.slice(s.length)):Vr(Af,!1,i,void 0,!0)}if(n){const s=r;r=a=>n({className:a,parseClassName:s})}return r},$f=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let a=0;a<n.length;a++){const i=n[a],c=i[0]==="[",u=t.has(i);c||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},Df=e=>({cache:Rf(e.cacheSize),parseClassName:Pf(e),sortModifiers:$f(e),postfixLookupClassGroupIds:If(e),...Sf(e)}),If=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Ff=/\s+/,Of=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a,postfixLookupClassGroupIds:i}=t,c=[],u=e.trim().split(Ff);let l="";for(let d=u.length-1;d>=0;d-=1){const m=u[d],{isExternal:h,modifiers:g,hasImportantModifier:w,baseClassName:v,maybePostfixModifierPosition:f}=n(m);if(h){l=m+(l.length>0?" "+l:l);continue}let x=!!f,y;if(x){const j=v.substring(0,f);y=r(j);const b=y&&i[y]?r(v):void 0;b&&b!==y&&(y=b,x=!1)}else y=r(v);if(!y){if(!x){l=m+(l.length>0?" "+l:l);continue}if(y=r(v),!y){l=m+(l.length>0?" "+l:l);continue}x=!1}const S=g.length===0?"":g.length===1?g[0]:a(g).join(":"),k=w?S+Dn:S,T=k+y;if(c.indexOf(T)>-1)continue;c.push(T);const N=s(y,x);for(let j=0;j<N.length;++j){const b=N[j];c.push(k+b)}l=m+(l.length>0?" "+l:l)}return l},Lf=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=Jo(n))&&(s&&(s+=" "),s+=r);return s},Jo=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Jo(e[r]))&&(n&&(n+=" "),n+=t);return n},Uf=(e,...t)=>{let n,r,s,a;const i=u=>{const l=t.reduce((d,m)=>m(d),e());return n=Df(l),r=n.cache.get,s=n.cache.set,a=c,c(u)},c=u=>{const l=r(u);if(l)return l;const d=Of(u,n);return s(u,d),d};return a=i,(...u)=>a(Lf(...u))},Bf=[],de=e=>{const t=n=>n[e]||Bf;return t.isThemeGetter=!0,t},Qo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ea=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Hf=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Vf=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zf=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Gf=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Wf=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yf=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ue=e=>Hf.test(e),W=e=>!!e&&!Number.isNaN(Number(e)),Re=e=>!!e&&Number.isInteger(Number(e)),hn=e=>e.endsWith("%")&&W(e.slice(0,-1)),$e=e=>Vf.test(e),ta=()=>!0,Xf=e=>Zf.test(e)&&!Gf.test(e),sr=()=>!1,Kf=e=>Wf.test(e),qf=e=>Yf.test(e),Jf=e=>!$(e)&&!D(e),Qf=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),eh=e=>Ye(e,sa,sr),$=e=>Qo.test(e),Xe=e=>Ye(e,oa,Xf),Zr=e=>Ye(e,ch,W),th=e=>Ye(e,ia,ta),nh=e=>Ye(e,aa,sr),Gr=e=>Ye(e,na,sr),rh=e=>Ye(e,ra,qf),zt=e=>Ye(e,ca,Kf),D=e=>ea.test(e),dt=e=>Qe(e,oa),sh=e=>Qe(e,aa),Wr=e=>Qe(e,na),oh=e=>Qe(e,sa),ah=e=>Qe(e,ra),Mt=e=>Qe(e,ca,!0),ih=e=>Qe(e,ia,!0),Ye=(e,t,n)=>{const r=Qo.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qe=(e,t,n=!1)=>{const r=ea.exec(e);return r?r[1]?t(r[1]):n:!1},na=e=>e==="position"||e==="percentage",ra=e=>e==="image"||e==="url",sa=e=>e==="length"||e==="size"||e==="bg-size",oa=e=>e==="length",ch=e=>e==="number",aa=e=>e==="family-name",ia=e=>e==="number"||e==="weight",ca=e=>e==="shadow",lh=()=>{const e=de("color"),t=de("font"),n=de("text"),r=de("font-weight"),s=de("tracking"),a=de("leading"),i=de("breakpoint"),c=de("container"),u=de("spacing"),l=de("radius"),d=de("shadow"),m=de("inset-shadow"),h=de("text-shadow"),g=de("drop-shadow"),w=de("blur"),v=de("perspective"),f=de("aspect"),x=de("ease"),y=de("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...k(),D,$],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],b=()=>[D,$,u],_=()=>[Ue,"full","auto",...b()],P=()=>[Re,"none","subgrid",D,$],B=()=>["auto",{span:["full",Re,D,$]},Re,D,$],E=()=>[Re,"auto",D,$],z=()=>["auto","min","max","fr",D,$],F=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],M=()=>["start","end","center","stretch","center-safe","end-safe"],O=()=>["auto",...b()],H=()=>[Ue,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...b()],J=()=>[Ue,"screen","full","dvw","lvw","svw","min","max","fit",...b()],re=()=>[Ue,"screen","full","lh","dvh","lvh","svh","min","max","fit",...b()],R=()=>[e,D,$],ae=()=>[...k(),Wr,Gr,{position:[D,$]}],ye=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Me=()=>["auto","cover","contain",oh,eh,{size:[D,$]}],ut=()=>[hn,dt,Xe],ue=()=>["","none","full",l,D,$],xe=()=>["",W,dt,Xe],kt=()=>["solid","dashed","dotted","double"],cr=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[W,hn,Wr,Gr],lr=()=>["","none",w,D,$],St=()=>["none",W,D,$],Nt=()=>["none",W,D,$],un=()=>[W,D,$],jt=()=>[Ue,"full",...b()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$e],breakpoint:[$e],color:[ta],container:[$e],"drop-shadow":[$e],ease:["in","out","in-out"],font:[Jf],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$e],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$e],shadow:[$e],spacing:["px",W],text:[$e],"text-shadow":[$e],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ue,$,D,f]}],container:["container"],"container-type":[{"@container":["","normal","size",D,$]}],"container-named":[Qf],columns:[{columns:[W,$,D,c]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Re,"auto",D,$]}],basis:[{basis:[Ue,"full","auto",c,...b()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[W,Ue,"auto","initial","none",$]}],grow:[{grow:["",W,D,$]}],shrink:[{shrink:["",W,D,$]}],order:[{order:[Re,"first","last","none",D,$]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":z()}],"auto-rows":[{"auto-rows":z()}],gap:[{gap:b()}],"gap-x":[{"gap-x":b()}],"gap-y":[{"gap-y":b()}],"justify-content":[{justify:[...F(),"normal"]}],"justify-items":[{"justify-items":[...M(),"normal"]}],"justify-self":[{"justify-self":["auto",...M()]}],"align-content":[{content:["normal",...F()]}],"align-items":[{items:[...M(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...M(),{baseline:["","last"]}]}],"place-content":[{"place-content":F()}],"place-items":[{"place-items":[...M(),"baseline"]}],"place-self":[{"place-self":["auto",...M()]}],p:[{p:b()}],px:[{px:b()}],py:[{py:b()}],ps:[{ps:b()}],pe:[{pe:b()}],pbs:[{pbs:b()}],pbe:[{pbe:b()}],pt:[{pt:b()}],pr:[{pr:b()}],pb:[{pb:b()}],pl:[{pl:b()}],m:[{m:O()}],mx:[{mx:O()}],my:[{my:O()}],ms:[{ms:O()}],me:[{me:O()}],mbs:[{mbs:O()}],mbe:[{mbe:O()}],mt:[{mt:O()}],mr:[{mr:O()}],mb:[{mb:O()}],ml:[{ml:O()}],"space-x":[{"space-x":b()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":b()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...re()]}],"min-block-size":[{"min-block":["auto",...re()]}],"max-block-size":[{"max-block":["none",...re()]}],w:[{w:[c,"screen",...H()]}],"min-w":[{"min-w":[c,"screen","none",...H()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",n,dt,Xe]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ih,th]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hn,$]}],"font-family":[{font:[sh,nh,t]}],"font-features":[{"font-features":[$]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,D,$]}],"line-clamp":[{"line-clamp":[W,"none",D,Zr]}],leading:[{leading:[a,...b()]}],"list-image":[{"list-image":["none",D,$]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",D,$]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:R()}],"text-color":[{text:R()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...kt(),"wavy"]}],"text-decoration-thickness":[{decoration:[W,"from-font","auto",D,Xe]}],"text-decoration-color":[{decoration:R()}],"underline-offset":[{"underline-offset":[W,"auto",D,$]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"tab-size":[{tab:[Re,D,$]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",D,$]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",D,$]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:ye()}],"bg-size":[{bg:Me()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Re,D,$],radial:["",D,$],conic:[Re,D,$]},ah,rh]}],"bg-color":[{bg:R()}],"gradient-from-pos":[{from:ut()}],"gradient-via-pos":[{via:ut()}],"gradient-to-pos":[{to:ut()}],"gradient-from":[{from:R()}],"gradient-via":[{via:R()}],"gradient-to":[{to:R()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:xe()}],"border-w-x":[{"border-x":xe()}],"border-w-y":[{"border-y":xe()}],"border-w-s":[{"border-s":xe()}],"border-w-e":[{"border-e":xe()}],"border-w-bs":[{"border-bs":xe()}],"border-w-be":[{"border-be":xe()}],"border-w-t":[{"border-t":xe()}],"border-w-r":[{"border-r":xe()}],"border-w-b":[{"border-b":xe()}],"border-w-l":[{"border-l":xe()}],"divide-x":[{"divide-x":xe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":xe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...kt(),"hidden","none"]}],"divide-style":[{divide:[...kt(),"hidden","none"]}],"border-color":[{border:R()}],"border-color-x":[{"border-x":R()}],"border-color-y":[{"border-y":R()}],"border-color-s":[{"border-s":R()}],"border-color-e":[{"border-e":R()}],"border-color-bs":[{"border-bs":R()}],"border-color-be":[{"border-be":R()}],"border-color-t":[{"border-t":R()}],"border-color-r":[{"border-r":R()}],"border-color-b":[{"border-b":R()}],"border-color-l":[{"border-l":R()}],"divide-color":[{divide:R()}],"outline-style":[{outline:[...kt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[W,D,$]}],"outline-w":[{outline:["",W,dt,Xe]}],"outline-color":[{outline:R()}],shadow:[{shadow:["","none",d,Mt,zt]}],"shadow-color":[{shadow:R()}],"inset-shadow":[{"inset-shadow":["none",m,Mt,zt]}],"inset-shadow-color":[{"inset-shadow":R()}],"ring-w":[{ring:xe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:R()}],"ring-offset-w":[{"ring-offset":[W,Xe]}],"ring-offset-color":[{"ring-offset":R()}],"inset-ring-w":[{"inset-ring":xe()}],"inset-ring-color":[{"inset-ring":R()}],"text-shadow":[{"text-shadow":["none",h,Mt,zt]}],"text-shadow-color":[{"text-shadow":R()}],opacity:[{opacity:[W,D,$]}],"mix-blend":[{"mix-blend":[...cr(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":cr()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[W]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":R()}],"mask-image-linear-to-color":[{"mask-linear-to":R()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":R()}],"mask-image-t-to-color":[{"mask-t-to":R()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":R()}],"mask-image-r-to-color":[{"mask-r-to":R()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":R()}],"mask-image-b-to-color":[{"mask-b-to":R()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":R()}],"mask-image-l-to-color":[{"mask-l-to":R()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":R()}],"mask-image-x-to-color":[{"mask-x-to":R()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":R()}],"mask-image-y-to-color":[{"mask-y-to":R()}],"mask-image-radial":[{"mask-radial":[D,$]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":R()}],"mask-image-radial-to-color":[{"mask-radial-to":R()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[W]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":R()}],"mask-image-conic-to-color":[{"mask-conic-to":R()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:ye()}],"mask-size":[{mask:Me()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",D,$]}],filter:[{filter:["","none",D,$]}],blur:[{blur:lr()}],brightness:[{brightness:[W,D,$]}],contrast:[{contrast:[W,D,$]}],"drop-shadow":[{"drop-shadow":["","none",g,Mt,zt]}],"drop-shadow-color":[{"drop-shadow":R()}],grayscale:[{grayscale:["",W,D,$]}],"hue-rotate":[{"hue-rotate":[W,D,$]}],invert:[{invert:["",W,D,$]}],saturate:[{saturate:[W,D,$]}],sepia:[{sepia:["",W,D,$]}],"backdrop-filter":[{"backdrop-filter":["","none",D,$]}],"backdrop-blur":[{"backdrop-blur":lr()}],"backdrop-brightness":[{"backdrop-brightness":[W,D,$]}],"backdrop-contrast":[{"backdrop-contrast":[W,D,$]}],"backdrop-grayscale":[{"backdrop-grayscale":["",W,D,$]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[W,D,$]}],"backdrop-invert":[{"backdrop-invert":["",W,D,$]}],"backdrop-opacity":[{"backdrop-opacity":[W,D,$]}],"backdrop-saturate":[{"backdrop-saturate":[W,D,$]}],"backdrop-sepia":[{"backdrop-sepia":["",W,D,$]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":b()}],"border-spacing-x":[{"border-spacing-x":b()}],"border-spacing-y":[{"border-spacing-y":b()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",D,$]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[W,"initial",D,$]}],ease:[{ease:["linear","initial",x,D,$]}],delay:[{delay:[W,D,$]}],animate:[{animate:["none",y,D,$]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,D,$]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:St()}],"rotate-x":[{"rotate-x":St()}],"rotate-y":[{"rotate-y":St()}],"rotate-z":[{"rotate-z":St()}],scale:[{scale:Nt()}],"scale-x":[{"scale-x":Nt()}],"scale-y":[{"scale-y":Nt()}],"scale-z":[{"scale-z":Nt()}],"scale-3d":["scale-3d"],skew:[{skew:un()}],"skew-x":[{"skew-x":un()}],"skew-y":[{"skew-y":un()}],transform:[{transform:[D,$,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:jt()}],"translate-x":[{"translate-x":jt()}],"translate-y":[{"translate-y":jt()}],"translate-z":[{"translate-z":jt()}],"translate-none":["translate-none"],zoom:[{zoom:[Re,D,$]}],accent:[{accent:R()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:R()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",D,$]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":R()}],"scrollbar-track-color":[{"scrollbar-track":R()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mbs":[{"scroll-mbs":b()}],"scroll-mbe":[{"scroll-mbe":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pbs":[{"scroll-pbs":b()}],"scroll-pbe":[{"scroll-pbe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",D,$]}],fill:[{fill:["none",...R()]}],"stroke-w":[{stroke:[W,dt,Xe,Zr]}],stroke:[{stroke:["none",...R()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},uh=Uf(lh);function ve(...e){return uh(vf(e))}const mt="4px",Et="4px",dh=2.5,mh=(e,t,n,r,s)=>{const a=e.children;if(!a||a.length===0)return;const i=(v,f,x,y,S)=>{if(y===0)return 1/0;const k=f/y*S;if(k===0)return 1/0;let T=0;for(const N of v){const b=(N.value||0)/f*x,_=k/b,P=Math.abs(_-dh);T=Math.max(T,P)}return T},c=(v,f,x,y,S,k,T)=>{const N=f/x*S;let j=T;for(const b of v){const P=(b.value||0)/f*y;b.x0=k,b.y0=j,b.x1=k+N,b.y1=j+P,j+=P}return N},u=r-t,l=s-n,d=a.reduce((v,f)=>v+(f.value||0),0);if(d===0)return;let m=[...a],h=t,g=u,w=d;for(;m.length>0;){let v=[],f=0;for(let y=0;y<m.length;y++){const S=m[y],k=S.value||0,T=[...v,S],N=f+k;if(v.length===0)v=T,f=N;else{const j=i(v,f,l,w,g);if(i(T,N,l,w,g)<=j)v=T,f=N;else break}}const x=c(v,f,w,l,g,h,n);m=m.slice(v.length),h+=x,g-=x,w-=f}};function fh({data:e,className:t,LeafComponent:n,getColorValue:r,tileMode:s="squarify"}){const a=p.useRef(null),i=p.useRef(null),c=p.useRef(null),u=p.useRef(null),l=p.useRef(null),d=p.useRef(null),[,m]=p.useTransition(),[h,g]=p.useState({width:0,height:0});p.useEffect(()=>{const x=a.current;if(x){const y=new ResizeObserver(()=>{m(()=>{g({width:x.offsetWidth,height:x.offsetHeight})})});return y.observe(x),()=>{y.disconnect()}}},[]),p.useEffect(()=>{const x=i.current;if(x){const y=x.children;let S=y[0],k=y[0],T=y[0],N=y[0];for(let j=0;j<y.length;j++){const b=y[j],{x:_,y:P}=b.getBoundingClientRect(),B=S.getBoundingClientRect(),E=k.getBoundingClientRect(),z=T.getBoundingClientRect(),F=N.getBoundingClientRect();_<=B.x&&P<=B.y&&(S=b),_<=E.x&&P>=E.y&&(k=b),_>=z.x&&P<=z.y&&(T=b),_>=F.x&&P>=F.y&&(N=b)}c.current&&(c.current.style.borderTopLeftRadius=mt),c.current=S,c.current.style.borderTopLeftRadius=Et,u.current&&(u.current.style.borderBottomLeftRadius=mt),u.current=k,u.current.style.borderBottomLeftRadius=Et,l.current&&(l.current.style.borderTopRightRadius=mt),l.current=T,l.current.style.borderTopRightRadius=Et,d.current&&(d.current.style.borderBottomRightRadius=mt),d.current=N,d.current.style.borderBottomRightRadius=Et}},[h]);const w=p.useMemo(()=>{switch(s){case"vertical-rectangle":return mh;case"squarify":default:return _i}},[s]),v=p.useMemo(()=>Ci().size([h.width,h.height]).tile(w).paddingInner(4)(Ti({id:"root",value:0,children:e}).sum(x=>x.value).sort((x,y)=>y.data.value-x.data.value)),[e,h.width,h.height,w]),f=p.useMemo(()=>{const x=v.leaves(),y=x.map(z=>r?r(z.data):z.data.value),S=y.filter(z=>z>=0),k=y.filter(z=>z<0),T=S.length>0?Math.min(...S):0,N=S.length>0?Math.max(...S):0,j=k.length>0?Math.min(...k):0,b=k.length>0?Math.max(...k):0,_=z=>z<0?b===j?1:(z-b)/(j-b):N===T?1:(z-T)/(N-T),P=(z,F)=>{if(F>=0){const H=Math.round(34+z*16);return`hsl(152 ${Math.round(42+z*20)}% ${H}%)`}const M=Math.round(36+z*15);return`hsl(350 ${Math.round(48+z*22)}% ${M}%)`},B=[...new Set(x.map(z=>z.x0))].sort((z,F)=>z-F),E=new Map(B.map((z,F)=>[z,F]));return x.map(z=>{const F=z.x1-z.x0,M=z.y1-z.y0,O=r?r(z.data):z.data.value,H=_(O),J=E.get(z.x0)??0,re=P(H,O);return o.jsx("div",{className:"group absolute cursor-pointer rounded-sm 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:z.x0,top:z.y0,width:F,height:M,borderRadius:mt,backgroundColor:re},children:o.jsx(n,{width:F,height:M,data:z.data,columnIndex:J})},`${z.data.id}-box`)})},[v,n,r]);return o.jsx("div",{className:ve("h-full w-full",t),ref:a,children:o.jsx("div",{className:"relative overflow-hidden rounded-lg",style:{height:h.height,width:h.width},ref:i,children:f})})}const lt=fh,hh="4px",ph=6,gh=80,xh=24;function bh({data:e,className:t,CellComponent:n,getColorValue:r,gap:s=ph,showLabels:a=!1,rowLabelWidth:i=gh,columnLabelHeight:c=xh}){const u=p.useRef(null),[,l]=p.useTransition(),[d,m]=p.useState({width:0,height:0});p.useEffect(()=>{const j=u.current;if(j){const b=new ResizeObserver(()=>{l(()=>{m({width:j.offsetWidth,height:j.offsetHeight})})});return b.observe(j),()=>{b.disconnect()}}},[]);const{uniqueRows:h,uniqueColumns:g,rowToIndex:w,columnToIndex:v}=p.useMemo(()=>{const j=new Set,b=new Set,_=[],P=[];for(const z of e)j.has(z.row)||(j.add(z.row),_.push(z.row)),b.has(z.column)||(b.add(z.column),P.push(z.column));const B=new Map(_.map((z,F)=>[z,F])),E=new Map(P.map((z,F)=>[z,F]));return{uniqueRows:_,uniqueColumns:P,rowToIndex:B,columnToIndex:E}},[e]),f=p.useMemo(()=>{const j=a?i:0,b=a?c:0;return{x:j,y:b,width:Math.max(0,d.width-j),height:Math.max(0,d.height-b)}},[d,a,i,c]),x=p.useMemo(()=>{const j=g.length,b=h.length,_=j>0?Math.max(0,(f.width-s*(j-1))/j):0,P=b>0?Math.max(0,(f.height-s*(b-1))/b):0;return{cellWidth:_,cellHeight:P,columnX:z=>z*(_+s),rowY:z=>z*(P+s)}},[h.length,g.length,f,s]),y=p.useMemo(()=>{const j=e.map(M=>r?r(M):M.value),b=j.filter(M=>M>=0),_=j.filter(M=>M<0),P=b.length>0?Math.min(...b):0,B=b.length>0?Math.max(...b):0,E=_.length>0?Math.min(..._):0,z=_.length>0?Math.max(..._):0,F=M=>M<0?z===E?1:(M-z)/(E-z):B===P?1:(M-P)/(B-P);return e.map(M=>{const O=r?r(M):M.value,H=F(O),J=O>=0;return{cell:M,colorValue:O,intensity:H,isPositive:J}})},[e,r]),S=(j,b)=>{if(b){const B=Math.round(34+j*16);return`hsl(152 ${Math.round(42+j*20)}% ${B}%)`}const _=Math.round(36+j*15);return`hsl(350 ${Math.round(48+j*22)}% ${_}%)`},k=p.useMemo(()=>{const{cellWidth:j,cellHeight:b,columnX:_,rowY:P}=x;return j<=0||b<=0?null:y.map(({cell:B,intensity:E,isPositive:z})=>{const F=w.get(B.row),M=v.get(B.column);if(F===void 0||M===void 0)return null;const O=S(E,z);return o.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:f.x+_(M),top:f.y+P(F),width:j,height:b,borderRadius:hh,backgroundColor:O},children:o.jsx(n,{width:j,height:b,data:B,rowIndex:F,columnIndex:M,colorIntensity:E,isPositive:z})},B.id)})},[y,x,f,w,v,n]),T=p.useMemo(()=>{if(!a)return null;const{cellHeight:j,rowY:b}=x;return h.map((_,P)=>o.jsx("div",{className:"absolute flex items-center justify-end pr-2 text-xs text-white/60",style:{left:0,top:f.y+b(P),width:i,height:j},children:o.jsx("span",{className:"truncate",children:_})},`row-${_}`))},[a,h,x,f,i]),N=p.useMemo(()=>{if(!a)return null;const{cellWidth:j,columnX:b}=x;return g.map((_,P)=>o.jsx("div",{className:"absolute flex items-end justify-center pb-1 text-xs text-white/60",style:{left:f.x+b(P),top:0,width:j,height:c},children:o.jsx("span",{className:"truncate",children:_})},`col-${_}`))},[a,g,x,f,c]);return o.jsx("div",{className:ve("h-full w-full",t),ref:u,children:o.jsxs("div",{className:"relative overflow-hidden",style:{height:d.height,width:d.width},children:[T,N,k]})})}const vh=bh,Ve={top:20,right:110,bottom:40,left:50},or={sm:640},pn={height:400,yAxisPadding:15,fontSize:12},Yr={rectHeight:22,paddingX:4},yh={offsetX:80},Rt={ticks:6,opacity:.05,color:"#FFFFFF"},we={xTicks:5,xSubTicks:36,yTicks:5,tickSize:10,subTickSize:6,tickColor:"#404146",domainColor:"#FFFFFF",domainOpacity:.05,textOpacity:.5},Xr=1e12,Kr=1e9,gn=1e6,fe=e=>e==null?"-":e===0?"0":e<.001?kh(e):e<1||e<10?parseFloat(e.toPrecision(4)).toString():e<gn?e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:2}):e>Xr?`${(e/Xr).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}T`:e>Kr?`${(e/Kr).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}B`:e>gn?`${(e/gn).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}M`:e.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),wh=e=>{const t=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"];return e.toString().split("").map(n=>t[parseInt(n)]).join("")},kh=e=>{const t=e<0,r=Math.abs(e).toFixed(20).replace(/\.?0+$/,""),s=r.match(/^0\.0+/);if(s){const a=s[0].length-2,c=r.slice(s[0].length).slice(0,3).replace(/0+$/,""),u=`0.${wh(a)}${c}`;return t?`-${u}`:u}return Number.isInteger(e)?String(e):String(Math.round(e*100)/100)},Sh=({width:e,height:t=pn.height,yDomain:n,formatValue:r,containerRef:s,svgRef:a})=>{const[i,c]=p.useState(e);p.useLayoutEffect(()=>{const w=()=>{if(s.current){const v=s.current.getBoundingClientRect();c(v.width)}};return w(),window.addEventListener("resize",w),()=>window.removeEventListener("resize",w)},[s]);const u=w=>{const v=Ee(a.current);if(!v.node())return Ve.left;const f=v.append("text").style("font-size",`${pn.fontSize}px`).style("font-family","var(--font-dmsans)").style("font-weight","700").style("visibility","hidden"),[x,y]=w.domain(),S=[],k=5;for(let N=0;N<k;N++){const j=x+(y-x)/(k-1)*N;S.push(j)}let T=0;return S.forEach(N=>{var _;const j=r?r(N):fe(N);f.text(j);const b=((_=f.node())==null?void 0:_.getBBox().width)||0;T=Math.max(T,b)}),f.remove(),Math.ceil(T)+pn.yAxisPadding};let l=i??null;if(!l&&s.current){const w=s.current.getBoundingClientRect();w.width>0&&(l=w.width)}l=l||e||null;const d=t-Ve.top-Ve.bottom,m=Vn().domain(n).range([d,0]),h=l&&l>0?u(m):null,g=l&&l>0&&h&&h>0?l-h-(l>640?Ve.right:20):null;return{width:l,height:t,innerWidth:g,innerHeight:d,dynamicLeftMargin:h}},Nh=e=>{const t=p.useMemo(()=>{const i=new Set;return e.forEach(c=>{c.seriesGroup&&i.add(c.seriesGroup)}),Array.from(i)},[e]),[n,r]=p.useState(()=>new Set(t));p.useEffect(()=>{r(i=>{const c=new Set(i);return t.forEach(u=>{c.has(u)||c.add(u)}),c})},[t]);const s=p.useMemo(()=>e.filter(i=>i.seriesGroup?n.has(i.seriesGroup):!0),[e,n]);return{seriesGroups:t,visibleGroups:n,filteredSeries:s,toggleGroup:i=>{r(c=>{const u=new Set(c);return u.has(i)?u.delete(i):u.add(i),u})}}},jh=e=>({seriesColors:p.useMemo(()=>e.reduce((n,r)=>(n[r.id]=r.color,n),{}),[e]),isColorLoading:!1}),_h=({group:e,isVisible:t,onClick:n})=>o.jsxs("button",{onClick:n,className:ve("flex cursor-pointer items-center justify-center gap-2 text-xs font-semibold",t?"text-white":"text-white/30"),children:[o.jsx("div",{className:ve("h-3 w-3",t?"bg-white/80":"bg-white/30")}),e]}),Ch=_h;var Ne=(e=>(e["30m"]="30m",e["24h"]="24h",e["3D"]="3D",e["7D"]="7D",e["1M"]="1M",e["3M"]="3M",e.YTD="YTD",e))(Ne||{});const Th=(e,t)=>{const n=new Date(e);return t===Ne["24h"]?_n("%H:%M")(n):_n("%b %d")(n)},zh=(e,t=.1)=>{const n=e.map(u=>u.value),r=zi(n)||0,s=Mi(n)||0,a=s-r,i=s+a*t;let c=r-a*t;return r>=0&&c<0&&(c=0),[c,i]},Se=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#06B6D4","#84CC16","#F97316"],Mh=(e,t)=>Th(e,t),qr=(e,t)=>{const n=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),s=parseInt(e.slice(5,7),16);return`rgba(${n}, ${r}, ${s}, ${t})`},Eh=e=>{const t=e.flatMap(n=>n.data);return zh(t)},Rh=e=>{const t=new Set;return e.forEach(n=>{n.data.forEach(r=>t.add(r.date))}),Array.from(t).sort()},Ah=(e,t)=>e.map(n=>{const r={};return t.forEach(s=>{const a=s.data.find(i=>i.date===n);r[s.id]=a?a.value:0}),{date:new Date(n),values:r}}),Ph=(e,t,n)=>{const r=t.invert(e),s=Ei(u=>u.date).left,a=s(n,r,1),i=n[a-1],c=n[a];return!i||!c?null:r.getTime()-i.date.getTime()>c.date.getTime()-r.getTime()?c:i},In=(e,t)=>{const n=t===e,r=t!==null&&t!==e;return n?1:r?.3:1},$h=({legendItems:e,containerWidth:t,hoveredSeriesId:n,onSeriesHover:r,onLabelClick:s,unitPrefix:a,unitSuffix:i,legendRef:c})=>t&&t>or.sm?o.jsx("div",{className:ve("pointer-events-none absolute left-0 top-0 w-full flex-wrap items-center gap-2 max-sm:overflow-hidden"),children:e.map(l=>o.jsx("div",{className:ve("pointer-events-auto absolute flex h-[22px] w-fit cursor-pointer items-center justify-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{left:`${l.left}px`,top:`${l.top}px`,backgroundColor:qr(l.color,.3),opacity:In(l.id,n)},onClick:()=>s==null?void 0:s(l.id),onPointerEnter:d=>{d.preventDefault(),d.stopPropagation(),r(l.id)},onPointerLeave:d=>{d.preventDefault(),d.stopPropagation(),r(null)},children:o.jsxs("div",{className:"relative flex select-none items-center justify-center gap-1",children:[l.seriesData.iconImageUrl&&o.jsx("div",{className:"size-4 rounded-full",children:o.jsx("img",{src:l.seriesData.iconImageUrl,width:16,height:16,alt:l.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),o.jsxs("div",{className:"text-normal relative flex items-center justify-center whitespace-nowrap text-[11px] font-semibold leading-4",children:[o.jsx("span",{className:ve("mr-1 max-w-12 truncate",l.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:l.displayText}),a&&o.jsx("span",{className:"mr-0.5 [&_svg]:!text-white/70",children:a}),o.jsx("span",{children:l.value}),i&&o.jsx("span",{children:i})]})]})},l.id))}):o.jsx("div",{className:ve("pointer-events-none left-0 top-0 flex w-full flex-wrap items-center gap-1 max-sm:overflow-hidden"),ref:c,children:e.map(l=>o.jsx("div",{className:ve("pointer-events-auto flex h-[22px] w-fit min-w-[112px] cursor-pointer items-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{backgroundColor:qr(l.color,.3),opacity:In(l.id,n)},onClick:()=>s==null?void 0:s(l.id),onPointerEnter:d=>{d.preventDefault(),d.stopPropagation(),r(l.id)},onPointerLeave:d=>{d.preventDefault(),d.stopPropagation(),r(null)},children:o.jsxs("div",{className:"relative flex select-none items-center gap-1",children:[l.seriesData.iconImageUrl&&o.jsx("div",{className:"size-4 rounded-full",children:o.jsx("img",{src:l.seriesData.iconImageUrl,width:16,height:16,alt:l.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),o.jsxs("div",{className:"text-normal relative flex items-center whitespace-nowrap text-[11px] font-semibold leading-none",children:[o.jsx("span",{className:ve("mr-1 max-w-12 truncate",l.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:l.displayText}),o.jsx("span",{"data-legend-value":l.id,children:l.value}),i&&o.jsx("span",{children:i})]})]})},l.id))}),Dh=$h,Ih=({containerWidth:e,tooltipRef:t,series:n,seriesColors:r,unitPrefix:s,unitSuffix:a})=>e&&e>or.sm?o.jsx("div",{ref:t,className:"pointer-events-none absolute left-0 top-0 z-50 rounded-md bg-slate-700 px-6 py-3 text-xs text-white opacity-0 transition-opacity duration-300",children:o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"body-md font-semibold text-white/50","data-tooltip-date":!0}),o.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5",children:n.map(c=>o.jsxs(Ni.Fragment,{children:[o.jsxs("span",{className:"text-soft flex max-w-[126px] items-center gap-1",children:[o.jsx("div",{className:"h-full w-0.5 rounded-full",style:{backgroundColor:r[c.id]}}),c.iconImageUrl&&o.jsx("img",{src:c.iconImageUrl,width:20,height:20,alt:c.name,className:"rounded-full"}),o.jsx("span",{className:"text-normal body-sm font-bold capitalize",children:c.name})]}),o.jsxs("div",{className:"font-dmsans text-normal flex flex-row items-center font-bold",children:[o.jsx("div",{className:"mr-1",children:s}),o.jsx("span",{className:"text-normal text-right text-xs font-bold","data-tooltip-value":c.id}),a]})]},c.id))})]})}):o.jsx("div",{ref:t,className:"pointer-events-none absolute left-0 top-0 z-50 min-w-[130px] rounded-md bg-slate-700 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-300 ease-out",children:o.jsx("div",{className:"flex flex-col items-center justify-center gap-3",children:o.jsx("div",{className:"caption font-semibold text-white/50","data-tooltip-date":!0})})}),Fh=Ih,Oh=(e,t,n,r)=>{const s=Ls().domain(Cn(e,i=>i.date)).range([0,n]),a=Vn().domain(t).range([r,0]);return{xScale:s,yScale:a}},Lh=(e,t,n)=>{const[r,s]=t.domain(),a=[];for(let i=0;i<Rt.ticks;i++){const c=r+(s-r)/(Rt.ticks-1)*i;a.push(c)}e.append("g").attr("class","grid").call(Us(t).tickValues(a).tickSize(-n).tickFormat(()=>"")).call(i=>i.select(".domain").remove()).selectAll("line").attr("stroke",Rt.color).attr("stroke-opacity",Rt.opacity)},Uh=(e,t,n,r,s,a,i)=>{const c=i!==void 0?Math.max(2,Math.min(we.xTicks,Math.floor(i/70))):we.xTicks,u=e.append("g").attr("transform",`translate(0,${r})`).call(ur(t).ticks(c).tickSize(we.tickSize).tickFormat(v=>v instanceof Date?Mh(v.toISOString(),s):String(v))).style("font-size","12px").style("font-weight","700").style("font-family","var(--font-manrope)");u.select(".domain").attr("stroke",we.domainColor).attr("stroke-width",1).attr("stroke-opacity",we.domainOpacity),u.selectAll(".tick line").attr("stroke",we.tickColor).attr("transform","translate(0, 4)"),u.selectAll(".tick text").attr("dy","1.2em").style("fill",we.domainColor).style("opacity",we.textOpacity);const l=e.append("g").attr("transform",`translate(0,${r})`).call(ur(t).ticks(we.xSubTicks).tickSize(we.subTickSize).tickFormat(()=>""));l.select(".domain").remove(),l.selectAll(".tick line").attr("stroke",we.tickColor).attr("transform","translate(0, 4)");const[d,m]=n.domain(),h=[],g=5;for(let v=0;v<g;v++){const f=d+(m-d)/(g-1)*v;h.push(f)}const w=e.append("g").call(Us(n).tickValues(h).tickSize(we.yTicks).tickFormat(v=>a?a(v):fe(v))).style("font-size","12px").style("color",we.domainColor).style("font-family","var(--font-dmsans)").style("opacity",we.textOpacity).style("font-weight","700");w.select(".domain").attr("stroke","none"),w.selectAll(".tick line").attr("stroke","none")},Bh=(e,t,n,r,s)=>{const a=Bs().x(i=>r(i.date)).y(i=>s(i.value)).curve(Tn);t.forEach(i=>{const c=i.data.map(m=>({date:new Date(m.date),value:m.value})),u=n[i.id],l=e.append("path").datum(c).attr("fill","none").attr("stroke",u).attr("stroke-width",1.2).attr("opacity",1).attr("data-series-id",i.id).attr("d",a),d=l.node().getTotalLength();l.attr("stroke-dasharray",d+" "+d).attr("stroke-dashoffset",d),l.transition("draw").duration(1200).ease(Ri).attr("stroke-dashoffset",0).on("end",function(){Ee(this).attr("stroke-dasharray",null)})})},Hh=({g:e,containerWidth:t,innerWidth:n,innerHeight:r,xScale:s,yScale:a,combinedData:i,filteredSeries:c,tooltipRef:u,containerRef:l,legendRef:d,highestValue:m,formatValue:h})=>{var F;const g=e.append("line").attr("class","hover-line").attr("stroke","white").attr("stroke-width",1).attr("stroke-dasharray","4,4").attr("stroke-opacity",.6).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",r).attr("opacity",0),w=e.append("g").attr("class","hover-dots");let v=!0,f=((F=l.current)==null?void 0:F.getBoundingClientRect().width)||n,x=0,y=0;const S=M=>{v?(g.attr("x1",M-.75),g.attr("x2",M-.75),g.transition().duration(150).ease(zn).attr("opacity",1),v=!1):g.transition().duration(100).ease(dr).attr("x1",M-.75).attr("x2",M-.75).attr("opacity",1)},k=(M,O)=>{const J=w.selectAll("g.hover-circle-group").data(c.filter(R=>M.values[R.id]!==void 0));J.exit().remove();const re=J.enter().append("g").attr("class","hover-circle-group").style("opacity",0);re.append("circle").attr("class","hover-dot-glow").attr("r",9).attr("fill","white").attr("fill-opacity",.18),re.append("circle").attr("class","hover-dot-core").attr("r",4.5).attr("fill","white").attr("stroke","rgba(10, 12, 20, 0.55)").attr("stroke-width",1.5),re.attr("transform",R=>{const ae=M.values[R.id];return`translate(${O}, ${a(ae)}) scale(0.5)`}).style("opacity",1).transition().duration(200).ease($i).attr("transform",R=>{const ae=M.values[R.id];return`translate(${O}, ${a(ae)}) scale(1)`}),J.transition().duration(100).ease(dr).attr("transform",R=>{const ae=M.values[R.id];return`translate(${O}, ${a(ae)})`})},T=(M,O)=>{u.current&&x===0&&y===0&&(x=u.current.getBoundingClientRect().height,y=u.current.getBoundingClientRect().width);let H=M+yh.offsetX;return H+y>f&&(H=M-y),H<0&&(H=0),{x:H,y:O-x/2+20}},N=M=>{let H=M-65+Ve.left;const J=a(m);return M+130/2>f-Ve.left&&(H=f-130),H<0&&(H=0),{x:H,y:J}},j=(M,O)=>{if(!u.current)return;const H=u.current.querySelector("[data-tooltip-date]");H&&H.textContent!==M&&(H.textContent=M),c.forEach(J=>{var ye;const re=O[J.id];if(re===void 0)return;const R=(ye=u.current)==null?void 0:ye.querySelector(`[data-tooltip-value="${J.id}"]`),ae=h?h(re):fe(re);R&&R.textContent!==ae&&(R.textContent=ae)})},b=M=>{if(!u.current)return;const O=u.current.querySelector("[data-tooltip-date]");O&&O.textContent!==M&&(O.textContent=M)},_=M=>{d.current&&c.forEach(O=>{var re;const H=M[O.id];if(H===void 0)return;const J=(re=d.current)==null?void 0:re.querySelector(`[data-legend-value="${O.id}"]`);if(J){const R=h?h(H):fe(H);J.textContent=R}})},P=(M,O)=>{u.current&&(u.current.style.opacity="1",u.current.style.transform=`translate3d(${M}px, ${O}px, 0)`)},B=M=>{const H=window.TouchEvent&&M instanceof TouchEvent?M.touches[0]:M,[J,re]=Pi(H,e.node()),R=Ph(J,s,i);if(!R)return;const ae=s(R.date),ye=_n("%b %d, %Y - %H:%M")(R.date);if(t>or.sm){const Me=T(J,re);P(Me.x,Me.y),j(ye,R.values)}else{const Me=N(J);P(Me.x,Me.y),b(ye),_(R.values)}S(ae),k(R,ae)},E=()=>{g.transition().duration(150).ease(zn).attr("opacity",0),v=!0,u.current&&(u.current.style.opacity="0"),w.selectAll("g").transition().duration(150).ease(Ai).style("opacity",0).attr("transform",(M,O,H)=>{const re=Ee(H[O]).attr("transform"),R=re.match(/translate\(([^,]+),\s*([^)]+)\)/);if(R){const ae=parseFloat(R[1]),ye=parseFloat(R[2]);return`translate(${ae}, ${ye}) scale(0.3)`}return re}).remove()},z=new ResizeObserver(()=>{l.current&&(f=l.current.getBoundingClientRect().width)});return l.current&&z.observe(l.current),{onMouseMove:B,onMouseLeave:E,destroy:()=>z.disconnect()}},Vh=(e,t,{xScale:n,yScale:r},s,a,i)=>{const c=Yr.rectHeight,u=Yr.paddingX,l=[];return e.forEach(m=>{const h=m.data.map(g=>({date:new Date(g.date),value:g.value}));if(h.length>0){const g=h[h.length-1],w=n(g.date)+8,v=r(g.value),f=w-u;let x=v-c/2;const y=l.findLast(S=>x+c>=S.top&&x<=S.bottom);y&&(x=y.top+c),l.push({top:x,bottom:x+c,id:m.id,left:f})}}),l.reverse().reduce((m,h)=>{const g=m.find(w=>h.top+c>=w.top&&h.top<=w.bottom&&w.id!==h.id);return g&&(h.top=g.top-c),[h,...m]},[]),l.map(m=>{var v,f;const h=e.find(x=>x.id===m.id);if(!h)return null;const g=t[m.id],w=i?i(((v=h.data.at(-1))==null?void 0:v.value)??0):fe(((f=h.data.at(-1))==null?void 0:f.value)??0);return{id:m.id,left:m.left+s,top:m.top+a,seriesData:h,color:g,value:w,displayText:h.name}}).filter(Boolean)},Zh=({className:e})=>o.jsx("div",{className:ve("relative size-8",e),children:o.jsx("div",{className:"absolute left-1/2 top-1/2 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center",children:o.jsxs("div",{className:"relative h-6 w-full",children:[Array.from({length:5}).map((t,n)=>o.jsx("div",{className:"absolute size-1.5 rounded-full will-change-transform",style:{left:`${n/6*100}%`,animation:`dnaStrand1Move 2s infinite ease-in-out ${-n*.2}s, dnaStrand1Scale 2s infinite ease-in-out ${-n*.2}s, dnaStrand1Color 2s infinite ease-in-out ${-n*.2}s`}},`strand1-${n}`)),Array.from({length:5}).map((t,n)=>o.jsx("div",{className:"absolute size-1.5 rounded-full",style:{left:`${n/6*100}%`,animation:`dnaStrand2Move 2s infinite ease-in-out ${-n*.2}s, dnaStrand2Scale 2s infinite ease-in-out ${-n*.2}s, dnaStrand2Color 2s infinite ease-in-out ${-n*.2}s`}},`strand2-${n}`))]})})}),Gh=({series:e,width:t,height:n=400,timeframe:r,className:s,isLoading:a=!1,formatValue:i,unitPrefix:c,unitSuffix:u,onLabelClick:l})=>{const d=p.useRef(null),m=p.useRef(null),h=p.useRef(null),g=p.useRef(null),[w,v]=p.useState(null),f=p.useMemo(()=>[...e].sort((M,O)=>{const H=M.data.length>0?M.data[M.data.length-1].value:0;return(O.data.length>0?O.data[O.data.length-1].value:0)-H}),[e]),x=p.useCallback(M=>{v(M)},[]),{seriesGroups:y,visibleGroups:S,filteredSeries:k,toggleGroup:T}=Nh(f),{seriesColors:N,isColorLoading:j}=jh(f),b=p.useMemo(()=>Eh(f),[f]),_=Sh({width:t,height:n,yDomain:b,formatValue:i,containerRef:m,svgRef:d}),P=p.useMemo(()=>Rh(f),[f]),B=p.useMemo(()=>Ah(P,f),[P,f]),E=p.useMemo(()=>Math.max(...k.map(M=>M.data.map(O=>O.value)).flat().filter(M=>M!==void 0)),[k]),z=p.useMemo(()=>!_.innerWidth||!_.innerHeight?null:Oh(B,b,_.innerWidth,_.innerHeight),[B,b,_.innerWidth,_.innerHeight]),F=p.useMemo(()=>!z||!_.dynamicLeftMargin?[]:Vh(k,N,z,_.dynamicLeftMargin,Ve.top,i),[z,_.dynamicLeftMargin,k,N,i]);return p.useEffect(()=>{if(!d.current||e.length===0||j||!z||_.width===null||_.innerWidth===null||_.dynamicLeftMargin===null)return;const M=Ee(d.current),{innerWidth:O,innerHeight:H,dynamicLeftMargin:J}=_;M.selectAll("*").remove();const{xScale:re,yScale:R}=z,ae=M.append("g").attr("transform",`translate(${J},${Ve.top})`);Lh(ae,R,O),Uh(ae,re,R,H,r,i,O),Bh(ae,k,N,re,R);const{onMouseMove:ye,onMouseLeave:Me,destroy:ut}=Hh({g:ae,containerWidth:_.width,innerWidth:O,innerHeight:_.innerHeight,xScale:re,yScale:R,combinedData:B,filteredSeries:k,tooltipRef:h,containerRef:m,legendRef:g,highestValue:E,formatValue:i}),ue=ae.append("rect").attr("class","overlay").attr("width",O).attr("height",H).attr("fill","transparent").style("cursor","crosshair").style("pointer-events","all");return ue.on("mousemove",ye).on("mouseleave",Me).on("touchstart",ye).on("touchmove",ye).on("touchend",Me),ue.raise(),()=>{ut(),ue.on("mousemove",null).on("mouseleave",null).on("touchstart",null).on("touchmove",null).on("touchend",null),M.selectAll("*").interrupt(),M.selectAll("*").remove()}},[B,b,e.length,k,z,_.innerWidth,_.innerHeight,_.dynamicLeftMargin,n,r,j,N,i]),p.useEffect(()=>{if(!d.current||e.length===0||j)return;Ee(d.current).select("g").selectAll("path[data-series-id]").transition().duration(200).ease(zn).attr("opacity",function(){const H=Ee(this).attr("data-series-id");return In(H,w)})},[w,e,N,j]),!a&&e.length===0?o.jsx("div",{className:ve("relative w-full",s),children:o.jsx("div",{className:ve("mx-auto flex w-full items-center justify-center text-sm text-gray-400"),style:{height:n},children:"No data available"})}):o.jsx("div",{ref:m,className:ve("relative w-full",s),style:{width:t,minHeight:n},children:a?o.jsx(Zh,{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}):o.jsxs(o.Fragment,{children:[y.length>0&&o.jsx("div",{className:"mb-3 flex flex-wrap items-center justify-center gap-2",children:y.map(M=>o.jsx(Ch,{group:M,isVisible:S.has(M),onClick:()=>T(M)},M))}),_.width!==null&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"relative z-20",children:o.jsx(Dh,{legendRef:g,legendItems:F,containerWidth:_.width,hoveredSeriesId:w,onSeriesHover:x,onLabelClick:l,unitPrefix:c,unitSuffix:u})}),o.jsxs("div",{className:"relative select-none",children:[o.jsx("svg",{ref:d,width:_.width,height:n,className:"relative z-0",style:{maxWidth:"100%",width:"100%",display:"block",overflow:"visible"}}),o.jsx("div",{className:"z-10",children:o.jsx(Fh,{containerWidth:_.width,tooltipRef:h,series:k,seriesColors:N,unitPrefix:c,unitSuffix:u})})]})]})]})})},sn=Gh,Wh=["#FF1F5F","#81FE90"],Yh=({data:e,width:t=270,height:n=270,innerRadius:r=90,outerRadius:s=100,colors:a=Wh,children:i})=>{const c=p.useRef(null);return p.useEffect(()=>{if(!c.current||!e.length)return;Ee(c.current).selectAll("*").remove();const u=Ee(c.current),l=t/2,d=n/2,m=u.append("defs");m.append("filter").attr("id","glow").append("feGaussianBlur").attr("stdDeviation","3").attr("result","coloredBlur"),m.select("#glow").append("feMerge").selectAll("feMergeNode").data(["coloredBlur","SourceGraphic"]).enter().append("feMergeNode").attr("in",y=>y),m.append("filter").attr("id","glow-layer").append("feGaussianBlur").attr("stdDeviation","6").attr("result","glowBlur"),m.select("#glow-layer").append("feColorMatrix").attr("type","matrix").attr("values","1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.5 0").attr("result","glowColor");const h=Di().value(y=>y.value).padAngle(.02),g=mr().innerRadius(r).outerRadius(s).cornerRadius(100),w=mr().innerRadius(r).outerRadius(s).cornerRadius(100),v=Ii().domain(e.map((y,S)=>S.toString())).range(a),x=u.append("g").attr("transform",`translate(${l}, ${d})`).selectAll("g").data(h(e)).enter().append("g");x.append("path").attr("class","glow-layer").attr("d",w).attr("fill",(y,S)=>v(S.toString())).attr("filter","url(#glow-layer)").style("opacity",0).style("pointer-events","none"),x.append("path").attr("class","main-slice").attr("d",g).attr("fill",(y,S)=>v(S.toString())).attr("stroke","none"),x.on("mouseenter",function(){Ee(this).select(".glow-layer").transition().duration(300).style("opacity",1)}).on("mouseleave",function(){Ee(this).select(".glow-layer").transition().duration(300).style("opacity",0)})},[e,t,n,r,s,a]),o.jsxs("div",{className:"relative flex flex-col items-center justify-center rounded-full",style:{background:"linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%)"},children:[o.jsx("svg",{ref:c,width:t,height:n,className:"relative z-10"}),o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:i}),o.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"linear-gradient(0deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%)",maskImage:"radial-gradient(farthest-side, transparent calc(100% - 1px),#fff 0)",WebkitMaskComposite:"destination-out",maskComposite:"exclude"}}),o.jsx("div",{className:"pointer-events-none absolute inset-[10%] rounded-full",style:{background:"linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%)",maskImage:"radial-gradient(farthest-side, transparent calc(100% - 1px),#fff 0)",WebkitMaskComposite:"destination-out",maskComposite:"exclude"}})]})},et=({data:e,width:t=120,height:n=40,color:r,className:s,variant:a="default"})=>{const i=p.useRef(null),{strokeColor:c,isPositive:u,variantType:l,customColor:d}=p.useMemo(()=>{var h,g;if(r)return{strokeColor:r,isPositive:!0,variantType:"custom",customColor:r};if(a==="auto"&&e.length>0){const w=((h=e[0])==null?void 0:h.value)??0,f=(((g=e[e.length-1])==null?void 0:g.value)??0)>=w;return{strokeColor:f?"var(--color-green-500)":"var(--color-red-500)",isPositive:f,variantType:f?"green":"red",customColor:void 0}}switch(a){case"green":return{strokeColor:"var(--color-green-500)",isPositive:!0,variantType:"green",customColor:void 0};case"red":return{strokeColor:"var(--color-red-500)",isPositive:!1,variantType:"red",customColor:void 0};case"blue":return{strokeColor:"#75A3FF",isPositive:!0,variantType:"blue",customColor:void 0};default:return{strokeColor:"var(--color-blue-600)",isPositive:!0,variantType:"blue",customColor:void 0}}},[r,a,e]),m=p.useMemo(()=>{if(!e||e.length===0)return[];const h=e.map(f=>({...f,date:new Date(f.date)})),g=Math.max(30,Math.floor(t/4));if(h.length<=g)return h;const w=Math.floor(h.length/g),v=[];for(let f=0;f<h.length;f+=w)v.push(h[f]);return v[v.length-1]!==h[h.length-1]&&v.push(h[h.length-1]),v},[e,t]);return p.useEffect(()=>{if(!i.current||!m.length)return;const h=Ee(i.current),g={top:2,right:0,bottom:2,left:0},w=t-g.left-g.right,v=n-g.top-g.bottom;h.selectAll("*").remove();const f=Ls().domain(Cn(m,E=>E.date)).range([0,w]),[x,y]=Cn(m,E=>E.value),S=(y-x)*.4,k=Vn().domain([x-S,y]).range([v,0]),T=Bs().x(E=>f(E.date)).y(E=>k(E.value)).curve(Tn),N=h.append("g").attr("transform",`translate(${g.left},${g.top})`),j=Fi().x(E=>f(E.date)).y0(v).y1(E=>k(E.value)).curve(Tn),b=`mini-chart-gradient-${Math.random().toString(36).slice(2,11)}`,P=h.append("defs").append("linearGradient").attr("id",b).attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%"),B=(E,z)=>{if(E.startsWith("var("))return E.includes("blue")?`rgba(59, 130, 246, ${z})`:E.includes("green")?`rgba(37, 255, 205, ${z})`:E.includes("red")?`rgba(239, 68, 68, ${z})`:`rgba(59, 130, 246, ${z})`;if(E.startsWith("#")){const F=E.slice(1),M=F.length===3?parseInt(F[0]+F[0],16):parseInt(F.slice(0,2),16),O=F.length===3?parseInt(F[1]+F[1],16):parseInt(F.slice(2,4),16),H=F.length===3?parseInt(F[2]+F[2],16):parseInt(F.slice(4,6),16);return`rgba(${M}, ${O}, ${H}, ${z})`}if(E.startsWith("rgb")){const F=E.match(/\d+/g);if(F&&F.length>=3)return`rgba(${F[0]}, ${F[1]}, ${F[2]}, ${z})`}return`rgba(59, 130, 246, ${z})`};l==="custom"&&d?(P.append("stop").attr("offset","45.9%").attr("stop-color",B(d,.16)),P.append("stop").attr("offset","96.67%").attr("stop-color",B(d,0))):l==="blue"?(P.append("stop").attr("offset","45.9%").attr("stop-color","rgba(7, 77, 215, 0.3)"),P.append("stop").attr("offset","96.67%").attr("stop-color","rgba(7, 77, 215, 0.3)")):l==="green"||u&&l!=="red"?(P.append("stop").attr("offset","45.9%").attr("stop-color","rgba(63, 194, 167, 0.1)"),P.append("stop").attr("offset","96.67%").attr("stop-color","rgba(63, 194, 167, 0)")):(P.append("stop").attr("offset","0%").attr("stop-color","rgba(255, 93, 127, 0.1)"),P.append("stop").attr("offset","91.8%").attr("stop-color","rgba(255, 63, 105, 0)")),N.append("path").datum(m).attr("fill",`url(#${b})`).attr("d",j),N.append("path").datum(m).attr("fill","none").attr("stroke",c).attr("stroke-width",1).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("d",T)},[m,t,n,c,u,l,d]),!e||e.length===0?o.jsx(o.Fragment,{}):o.jsx("svg",{ref:i,width:t,height:n,viewBox:`0 0 ${t} ${n}`,className:ve("h-auto max-w-full",s),style:{width:t,height:"auto"}})},Y=e=>`/widget-icons/${e}.png`,G={hyperliquid:{name:"Hyperliquid",url:"https://hyperliquid.xyz"},defillama:{name:"DeFiLlama",url:"https://defillama.com"},coingecko:{name:"CoinGecko",url:"https://www.coingecko.com"},alternativeMe:{name:"alternative.me",url:"https://alternative.me/crypto/fear-and-greed-index/"},bls:{name:"BLS",url:"https://www.bls.gov"},nyFed:{name:"NY Fed",url:"https://www.newyorkfed.org/markets/reference-rates"},treasury:{name:"U.S. Treasury",url:"https://fiscaldata.treasury.gov"},secEdgar:{name:"SEC EDGAR",url:"https://www.sec.gov/edgar"},finra:{name:"FINRA",url:"https://www.finra.org/finra-data/browse-catalog/short-sale-volume-data"},ofr:{name:"OFR",url:"https://www.financialresearch.gov/financial-stress-index/"},mempool:{name:"mempool.space",url:"https://mempool.space"},deribit:{name:"Deribit",url:"https://www.deribit.com"},coinpaprika:{name:"Coinpaprika",url:"https://coinpaprika.com"}},la={name:"clock",iconUrl:Y("clock"),layout:{w:3,h:2,minW:2,minH:1},description:"Digital clock showing the current time, ticking every second. Configurable IANA timezone (defaults to the viewer's local zone), 12/24-hour format, optional seconds and date, the timezone abbreviation, and a caption label. Drop several with different timezones for a trading-desk world clock. Needs no data provider.",capabilities:[],schema:I({timezone:Z().default("").describe(`IANA timezone, e.g. "America/New_York", "Europe/London", "Asia/Tokyo", "UTC". Empty = the viewer's local timezone.`),label:Z().default("").describe('Caption under the time, e.g. "New York" or "Local". Empty hides it.'),hour12:ke().default(!1).describe("12-hour clock with AM/PM (true) or 24-hour (false)."),showSeconds:ke().default(!0).describe("Show seconds (HH:MM:SS) instead of just HH:MM."),showMillis:ke().default(!1).describe("Show milliseconds (HH:MM:SS.mmm), updated smoothly each animation frame. Implies seconds."),showDate:ke().default(!1).describe("Show the weekday and date under the time."),showTimezone:ke().default(!0).describe('Show the timezone abbreviation (e.g. "EST", "GMT+7", "UTC") in the caption. Combines with the label when set, e.g. "New York · EST".')})},ua={name:"market-hours",iconUrl:Y("market-hours"),layout:{w:4,h:4,minW:3,minH:3},description:"Which world stock exchanges are open right now — each row shows an open / closed / holiday status dot and a live countdown to the next open or close. Computed entirely client-side from each exchange's timezone and regular trading hours (no API); a bundled 2026 holiday list keeps the major Western exchanges accurate on market holidays. Intraday lunch breaks and half-day early closes are not modelled. Needs no data provider.",capabilities:[],schema:I({exchanges:he(Z()).default([]).describe('Exchange codes to show, e.g. ["NYSE","LSE","TSE","HKEX","SET"]. Empty = a global default set. Known codes: NYSE, NASDAQ, TSX, B3, LSE, XETRA, EURONEXT, SIX, TSE, HKEX, SSE, NSE, KRX, SGX, SET, ASX, JSE, TADAWUL.'),sort:ne(["region","status","name"]).default("region").describe("Order rows by world region (Americas → Europe → Asia-Pacific → Middle East/Africa), by status (open first), or alphabetically by name.")})},da={name:"fear-greed",iconUrl:Y("fear-greed"),layout:{w:3,h:3,minW:2,minH:2},description:"Crypto Fear & Greed index (0 = extreme fear, 100 = extreme greed) with a recent-history sparkline. A one-number market mood gauge from alternative.me.",capabilities:["sentiment"],source:G.alternativeMe,schema:I({sparklineDays:U().int().min(7).max(90).default(30).describe("How many days of index history to show in the sparkline.")})},ma={name:"funding-rate-chart",iconUrl:Y("funding-rate-chart"),layout:{w:6,h:3,minW:3,minH:2},description:"Multi-series line chart comparing hourly perp funding rates across symbols over a configurable lookback window. Positive funding = longs pay shorts. Useful for spotting crowded trades.",capabilities:["funding-history"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(1).max(6).describe('Hyperliquid symbols to compare funding for, e.g. ["xyz:TSLA", "xyz:NVDA"]. Up to 6.'),lookback:ne(["24h","7D","1M"]).default("7D").describe("History window for the funding chart.")})},fa={name:"note",iconUrl:Y("note"),layout:{w:4,h:3,minW:2,minH:2},description:"Free-form text note pinned to the dashboard — trading plans, reminders, watch levels. Needs no data provider.",capabilities:[],schema:I({text:Z().min(1).describe("The note's text content. Plain text; newlines are preserved."),align:ne(["left","center"]).default("left").describe("Text alignment inside the card.")})},ha={name:"price-chart",iconUrl:Y("price-chart"),layout:{w:6,h:3,minW:3,minH:2},description:"Live animated price chart (candlestick or line) for one symbol — canvas-rendered at 60fps via liveline, streaming live off the Hyperliquid WebSocket. Works for HIP-3 stock perps (xyz:TSLA) and crypto (BTC). The centerpiece frame.",capabilities:["ohlcv","quote-stream"],source:G.hyperliquid,schema:I({symbol:Z().min(1).describe('Hyperliquid symbol to chart. Stocks/HIP-3: "xyz:TSLA", "xyz:NVDA", "xyz:AAPL". Crypto: "BTC", "ETH".'),interval:ne(["1m","5m","15m","1h","4h","1d"]).default("1h").describe("Candle interval."),mode:ne(["candle","line"]).default("candle").describe("Candlestick or smooth line rendering."),color:Z().default("#8b8df9").describe("Accent color (hex). The whole palette derives from it.")})},pa={name:"price-liveline",iconUrl:Y("price-liveline"),layout:{w:6,h:3,minW:4,minH:2},description:"Multi-asset live price liveline — several Hyperliquid symbols streaming in one canvas chart. Defaults to normalized % movement so stocks and crypto can share one axis, while the legend still shows each asset's live raw price. Use when the dashboard needs one compact live race view instead of several single-symbol charts.",capabilities:["quote-stream","day-stats"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(2).max(8).describe('Hyperliquid symbols to stream together, e.g. ["xyz:TSLA", "xyz:NVDA", "xyz:AAPL"] or ["BTC", "ETH", "SOL"]. 2 to 8.'),windowSec:U().int().min(10).max(300).default(30).describe("Rolling live window in seconds. 30 mirrors the zhive liveline view; use 60–300 for slower dashboards."),normalize:ke().default(!0).describe("Show each asset as % movement from its first live tick (recommended when prices differ). Off = raw price overlay.")})},ga={name:"price-ticker",iconUrl:Y("price-ticker"),layout:{w:3,h:3,minW:2,minH:2},description:"Live watchlist streaming mid prices over the Hyperliquid WebSocket with 24h change per symbol. The bread-and-butter frame for any dashboard.",capabilities:["quote-stream","day-stats"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(1).describe('Hyperliquid symbols to track, e.g. ["xyz:TSLA", "xyz:NVDA", "xyz:AAPL"]. Crypto works too: "BTC", "ETH".')})},xa={name:"top-movers",iconUrl:Y("top-movers"),layout:{w:5,h:3,minW:3,minH:3},description:"Today's biggest stock and commodity HIP-3 gainers and losers (no bare crypto), side by side with current price and 24h change.",capabilities:["day-stats"],source:G.hyperliquid,schema:I({count:U().int().min(3).max(10).default(5).describe("How many gainers and losers to list (each).")})},ba={name:"tvl-treemap",iconUrl:Y("tvl-treemap"),layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of total value locked (TVL) across the largest blockchain ecosystems, sized by TVL. Data from DeFiLlama. Good single-glance answer to 'where does on-chain capital live right now'.",capabilities:["tvl"],source:G.defillama,schema:I({topN:U().int().min(3).max(30).default(12).describe("How many of the largest chains to show in the treemap.")})},va={name:"bitcoin-dominance",iconUrl:Y("bitcoin-dominance"),layout:{w:4,h:2,minW:3,minH:2},description:"BTC / ETH / Others market-cap dominance as a segmented bar, with optional total marketcap line. Shifts in BTC dominance hint at where the market rotates next.",capabilities:["global-market"],source:G.coingecko,schema:I({showTotalMarketCap:ke().default(!0).describe("Show total crypto marketcap and its 24h change below the bar.")})},ya={name:"rates-board",iconUrl:Y("rates-board"),layout:{w:4,h:4,minW:3,minH:3},description:"Official US rates board from free public APIs: New York Fed reference rates (SOFR, effective fed funds, repo rates) plus Treasury average interest rates by security class. Daily/reference data, not a real-time stock quote feed.",capabilities:["reference-rates","treasury-rates"],source:[G.nyFed,G.treasury],schema:I({maxReferenceRates:U().int().min(2).max(8).default(5).describe("How many New York Fed reference rates to show."),showTreasuryAverageRates:ke().default(!0).describe("Also show Treasury average interest rates by security class from Fiscal Data."),maxTreasuryRates:U().int().min(1).max(8).default(4).describe("How many Treasury average-rate rows to show.")})},wa={name:"inflation-pulse",iconUrl:Y("inflation-pulse"),layout:{w:4,h:3,minW:3,minH:2},description:"BLS CPI pulse from the public no-key API: latest CPI-U all-items index with month-over-month and year-over-year changes plus a small trend sparkline. Monthly macro context for stock dashboards; not a live price feed.",capabilities:["macro-series"],source:G.bls,schema:I({months:U().int().min(13).max(36).default(18).describe("How many monthly CPI observations to show in the trend.")})},ka={name:"financial-stress",iconUrl:Y("financial-stress"),layout:{w:4,h:3,minW:3,minH:2},description:"The OFR Financial Stress Index — a daily, market-based gauge of systemic financial stress from the U.S. Office of Financial Research. One headline value where 0 is the long-run average (positive = elevated stress, negative = calmer than normal), an optional breakdown of the five contributing categories (credit, equity valuation, safe assets, funding, volatility), and a trend line. Keyless official data, updated each business day; needs the zframes runtime's data proxy (ships with `zframes serve` / `vite dev`). Not a price feed.",capabilities:["financial-stress"],source:G.ofr,schema:I({trendDays:U().int().min(20).max(90).default(60).describe("How many recent daily readings to plot in the trend line."),showCategories:ke().default(!0).describe("Show the five category contributions (credit, equity valuation, safe assets, funding, volatility) under the headline.")})},Sa={name:"national-debt",iconUrl:Y("national-debt"),layout:{w:4,h:3,minW:3,minH:2},description:"U.S. total public debt outstanding from the Treasury's keyless 'Debt to the Penny' dataset — the headline total in trillions, the change over the chosen window, an optional split into debt held by the public vs intragovernmental holdings, and a trend line. Official data updated each business day; CORS-safe (no proxy needed). Macro context, not a live price feed.",capabilities:["national-debt"],source:G.treasury,schema:I({trendDays:U().int().min(30).max(365).default(180).describe("How many business days of history to load for the trend and the change figure."),showSplit:ke().default(!0).describe("Show the debt-held-by-the-public vs intragovernmental-holdings split.")})},Na={name:"labor-market",iconUrl:Y("labor-market"),layout:{w:4,h:3,minW:3,minH:2},description:"U.S. labor-market snapshot from the BLS keyless public API: the headline unemployment rate, the latest monthly change in nonfarm payrolls (jobs added or lost), the total payroll level, and an unemployment-rate trend line. Monthly macro context for stock dashboards; updates on the BLS jobs-report schedule, not a live feed.",capabilities:["macro-series"],source:G.bls,schema:I({months:U().int().min(13).max(36).default(18).describe("How many monthly observations to show in the trend.")})},ja={name:"treasury-auctions",iconUrl:Y("treasury-auctions"),layout:{w:5,h:4,minW:3,minH:3},description:"Recent completed U.S. Treasury auctions from the keyless Fiscal Data API — each row shows the security (bill/note/bond + term), the high awarded yield, and the bid-to-cover ratio (demand: total bids ÷ amount accepted; higher = stronger). Newest first. Official market-plumbing data, CORS-safe; updates as auctions settle, not a live price feed.",capabilities:["treasury-auctions"],source:G.treasury,schema:I({count:U().int().min(3).max(20).default(8).describe("How many recent auctions to list (newest first).")})},_a={name:"filings-feed",iconUrl:Y("filings-feed"),layout:{w:5,h:4,minW:3,minH:3},description:"Recent SEC EDGAR filings for one US-listed company — each row shows the form type (10-K, 10-Q, 8-K, Form 4…), a plain-English label, the filing date, and a click-through to the document on sec.gov, under a header with the company name, exchange, and filer category. Official data from SEC's free, CORS-safe submissions endpoint; event-driven (updates when the company files), not a price feed. Resolve by ticker (a bundled snapshot of the ~500 largest US issuers) or by raw SEC CIK for anything else.",capabilities:["filings"],source:G.secEdgar,schema:I({symbol:Z().min(1).describe('Company to show filings for — a ticker ("AAPL", "NVDA"), a HIP-3 symbol ("xyz:TSLA"), or a raw SEC CIK ("320193"). Tickers outside the bundled top-500 map need a CIK.'),forms:ne(["important","all","insider"]).default("important").describe('Which filings to surface: "important" = periodic & material reports (10-K, 10-Q, 8-K, S-1, proxies, 13D/G…); "insider" = ownership forms (3/4/5/144); "all" = unfiltered. Always newest first.'),count:U().int().min(3).max(25).default(8).describe("How many filings to list (newest first).")})},Ca={name:"yield-curve",iconUrl:Y("yield-curve"),layout:{w:4,h:3,minW:3,minH:3},description:"The U.S. Treasury daily par yield curve — a line from 1-month to 30-year yields, the headline 2s10s spread (10Y minus 2Y; negative = inverted, the classic recession signal), and a configurable row of key maturities. Keyless official data from the U.S. Treasury, updated each business day; not a live intraday feed.",capabilities:["yield-curve"],source:G.treasury,schema:I({maturities:he(ne(["1M","2M","3M","4M","6M","1Y","2Y","3Y","5Y","7Y","10Y","20Y","30Y"])).min(2).max(8).default(["3M","2Y","5Y","10Y","30Y"]).describe("Maturities to show as labelled cells under the curve (the full curve line always shows every maturity).")})},Ta={name:"fundamentals",iconUrl:Y("fundamentals"),layout:{w:4,h:3,minW:3,minH:3},description:"Headline financials for one US-listed company from SEC EDGAR XBRL company facts — revenue, net income, total assets, shareholders' equity, diluted EPS, and shares outstanding, each labelled with its fiscal period. Income-statement figures are the latest full fiscal year; balance-sheet figures are the latest reported quarter. Keyless official data that updates only when the company files (annual/quarterly), not a live feed. Requires the zframes runtime's data proxy (it ships with `zframes serve` / `vite dev`); resolve by ticker (bundled top-500 map) or raw SEC CIK.",capabilities:["fundamentals"],source:G.secEdgar,schema:I({symbol:Z().min(1).describe('Company to show financials for — a ticker ("AAPL", "NVDA"), a HIP-3 symbol ("xyz:NVDA"), or a raw SEC CIK ("320193"). Tickers outside the bundled top-500 map need a CIK.')})},za={name:"short-volume",iconUrl:Y("short-volume"),layout:{w:5,h:4,minW:3,minH:3},description:"Daily reported short-sale volume for a watchlist of US-listed stocks, from FINRA's free consolidated file — each row shows the % of the day's reported volume that was sold short, with a bar and the raw short/total share counts. IMPORTANT: this is reported short volume (sell-side short flow, which includes market-maker hedging), NOT short interest (outstanding short positions), and is not a directional signal on its own. Daily data published the next business day; not a live feed. US equities only.",capabilities:["short-volume"],source:G.finra,schema:I({symbols:he(Z()).min(1).max(12).describe('US-listed stock tickers to show, e.g. ["TSLA","NVDA","AAPL"]. HIP-3 symbols ("xyz:TSLA") work too — the dex prefix is stripped. Crypto has no SEC/FINRA short-volume and is ignored.'),sort:ne(["shortPct","volume","symbol"]).default("shortPct").describe("Order rows by short % of volume (highest first), by total volume (highest first), or alphabetically by symbol.")})},Ma={name:"funding-heatmap",iconUrl:Y("funding-heatmap"),layout:{w:6,h:3,minW:4,minH:3},description:"Heatmap of perp funding rates — symbols as rows, daily average over the last 7 days as columns, green positive / red negative. Spots persistent funding regimes at a glance.",capabilities:["funding-history"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(2).max(8).describe('Hyperliquid symbols as heatmap rows — at least 2, since the heatmap compares funding across symbols, e.g. ["xyz:TSLA", "xyz:NVDA", "xyz:AAPL"].')})},Xh={name:"dino-game",iconUrl:Y("dino-game"),layout:{w:4,h:3,minW:3,minH:3},description:"Chrome-dino style runner game on canvas — jump cacti with SPACE or tap. High score persists locally. For when the market is boring. Needs no data provider.",capabilities:[],schema:I({})},Ea={name:"image",iconUrl:Y("image"),layout:{w:3,h:3,minW:1,minH:1},description:"Displays an image from a URL — logos, memes, chart screenshots, banners. Needs no data provider.",capabilities:[],schema:I({url:Z().min(1).describe("Image URL (https)."),alt:Z().default("").describe("Alt text for accessibility."),fit:ne(["cover","contain"]).default("cover").describe("How the image fills the frame: cover crops, contain letterboxes.")})},Ra={name:"heading",iconUrl:Y("heading"),layout:{w:12,h:1,minW:2,minH:1,maxH:1},description:"Section divider that titles a region of the dashboard ('Markets', 'On-chain', 'Desk'). Renders as a label with a hairline rule — no card. Use to group frames into zones: place full-width (w: 12) and 1 row tall (h: 1) above each group. Needs no data provider.",capabilities:[],chrome:"bare",schema:I({title:Z().min(1).describe("The heading text."),subtitle:Z().optional().describe("Smaller supporting line under the title.")})},Aa={name:"daily-analysis",iconUrl:Y("daily-analysis"),layout:{w:6,h:3,minW:3,minH:2},description:"Daily market brief written by the /zframes-brief loop — a dated analysis of the symbols on your dashboard, the calls it is making today, and how yesterday's calls scored (with a running hit-rate). Reads a local log file the loop appends to; needs no market data provider. Add one per dashboard.",capabilities:[],schema:I({src:Z().default("/daily-analysis.json").describe("URL of the analysis log the loop writes, served from the app's public/ dir. Leave as the default unless you renamed the file."),entries:U().int().min(1).max(5).default(1).describe("How many of the most recent daily entries to show (newest first)."),refreshSec:U().int().min(30).default(300).describe("How often (seconds) to re-fetch the log so a fresh brief appears without a manual reload.")})},Pa={name:"price-compare",iconUrl:Y("price-compare"),layout:{w:6,h:3,minW:3,minH:2},description:"Multi-series line chart overlaying the price history of several symbols over a lookback window — see how TSLA, NVDA and BTC moved against each other. Normalized by default to % change from the window start so symbols at very different price levels (BTC vs a $20 stock) stay comparable on one axis. Candles from Hyperliquid.",capabilities:["ohlcv"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(2).max(6).describe('Hyperliquid symbols to overlay, e.g. ["xyz:TSLA", "xyz:NVDA", "BTC"]. 2 to 6.'),lookback:ne(["24h","7D","1M"]).default("7D").describe("History window for the comparison."),normalize:ke().default(!0).describe("Rebase each series to % change from the window start (recommended — lets symbols at different price levels share one axis). Off = raw price, only sensible when comparing similarly-priced symbols.")})},$a={name:"allocation",iconUrl:Y("allocation"),layout:{w:4,h:4,minW:3,minH:3},description:"Donut of a portfolio's live allocation — list holdings (symbol + amount) and each slice is sized by current USD value off the Hyperliquid mid stream, with total portfolio value in the center. A live 'where is my money right now' view.",capabilities:["quote-stream"],source:G.hyperliquid,schema:I({holdings:he(I({symbol:Z().min(1).describe('Hyperliquid symbol, e.g. "BTC", "ETH", "xyz:TSLA".'),amount:U().positive().describe("Units held (e.g. 0.5 BTC, 10 shares). Weights the slice by USD value = amount × live price.")})).min(2).max(8).describe("The holdings to chart. 2 to 8 positions.")})},Da={name:"news-feed",layout:{w:4,h:4,minW:3,minH:3},description:'Scrolling feed of the latest news headlines from a chosen outlet — each row is a clickable headline with its publish time, newest first. Free, keyless RSS sources: crypto press (CoinDesk, Cointelegraph, Decrypt), broad markets/macro (CNBC, Nasdaq), or — source "stocks" — per-company headlines (via Google News) scoped to the specific tickers in `symbols`. IMPORTANT: news feeds are CORS-blocked, so this frame reads them through the zframes runtime\'s data proxy (it ships with `zframes serve` / `vite dev`); on a fully static host with no runtime it shows an empty state.',capabilities:["news"],schema:I({source:ne(["coindesk","cointelegraph","decrypt","cnbc","nasdaq","stocks"]).default("coindesk").describe('Which feed to show. Crypto press: "coindesk", "cointelegraph", "decrypt". Markets/macro: "cnbc", "nasdaq". "stocks" = per-company headlines (Google News) for the tickers in `symbols`.'),symbols:he(Z()).default([]).describe('Only used when source is "stocks": stock tickers to pull headlines for, e.g. ["TSLA","NVDA","AAPL"]. HIP-3 symbols ("xyz:TSLA") work too — the dex prefix is stripped. Ignored for the other sources.'),count:U().int().min(3).max(20).default(8).describe("How many headlines to list (newest first).")})},Ia={name:"dex-volume-treemap",layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of decentralized-exchange (DEX) protocols sized by trailing-24h trading volume, tiles colored green/red by 1-day change. Data from DeFiLlama. One-glance read on where on-chain trading flow is concentrated right now.",capabilities:["dex-volume"],source:G.defillama,schema:I({topN:U().int().min(3).max(30).default(12).describe("How many of the highest-volume DEX protocols to show.")})},Fa={name:"dex-volume-chart",layout:{w:6,h:3,minW:3,minH:2},description:"Multi-series line chart of daily DEX trading volume for several protocols over a lookback window — compare how Uniswap, PancakeSwap, Aerodrome etc. trend against each other. Data from DeFiLlama (daily granularity).",capabilities:["dex-volume"],source:G.defillama,schema:I({protocols:he(Z()).min(1).max(6).describe('DeFiLlama DEX protocol slugs (lowercase, hyphenated), e.g. ["uniswap", "pancakeswap", "aerodrome-slipstream"]. 1 to 6.'),lookback:ne(["7D","1M","3M"]).default("1M").describe("History window for the chart.")})},Oa={name:"protocol-tvl-treemap",layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of DeFi protocols sized by current total value locked (TVL), tiles colored green/red by 1-day change. Data from DeFiLlama. Unlike tvl-treemap (which groups by blockchain), this ranks individual protocols (Lido, Aave, EigenLayer…).",capabilities:["protocol-tvl"],source:G.defillama,schema:I({topN:U().int().min(3).max(30).default(12).describe("How many of the largest protocols by TVL to show.")})},La={name:"protocol-tvl-chart",layout:{w:6,h:3,minW:3,minH:2},description:"Multi-series line chart of total value locked (TVL) for several DeFi protocols over a lookback window. Data from DeFiLlama (daily granularity).",capabilities:["protocol-tvl"],source:G.defillama,schema:I({protocols:he(Z()).min(1).max(6).describe('DeFiLlama protocol slugs (lowercase, hyphenated), e.g. ["lido", "aave", "eigenlayer"]. 1 to 6.'),lookback:ne(["7D","1M","3M"]).default("1M").describe("History window for the chart.")})},Ua={name:"protocol-fees-treemap",layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of protocols sized by the fees they generated in the last 24h, tiles colored green/red by 1-day change. Data from DeFiLlama. Shows where on-chain users are actually paying for blockspace and services right now.",capabilities:["protocol-fees"],source:G.defillama,schema:I({topN:U().int().min(3).max(30).default(12).describe("How many of the highest fee-earning protocols to show.")})},Ba={name:"market-cap-treemap",layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of the largest cryptocurrencies sized by market capitalisation, tiles colored green/red by 24h price change. Data from CoinGecko (free tier). A heat-map of the whole crypto market at a glance.",capabilities:["coin-markets"],source:G.coingecko,schema:I({topN:U().int().min(5).max(50).default(20).describe("How many of the largest coins by market cap to show (up to 50).")})},Ha={name:"open-interest",layout:{w:4,h:3,minW:3,minH:2},description:'Live open interest across a watchlist of Hyperliquid perps — each symbol is a horizontal bar sized by USD notional, largest first, refreshed on a ~30s poll. Single-venue (Hyperliquid only), so read it as a relative gauge across your symbols, not a market-wide total. Stocks (HIP-3, e.g. "xyz:TSLA") and crypto both work.',capabilities:["open-interest"],source:G.hyperliquid,schema:I({symbols:he(Z()).min(1).max(20).describe(`Hyperliquid symbols to compare open interest for, e.g. ["BTC", "ETH", "xyz:TSLA"]. A "<dex>:*" wildcard (e.g. "xyz:*") pulls that dex's entire universe.`)})},Kh={name:"snake",layout:{w:4,h:4,minW:3,minH:3},description:"Classic snake game on canvas — steer with the arrow keys (or swipe), eat dots to grow, avoid the walls and your own tail. High score persists locally. For when the market is flat. Needs no data provider.",capabilities:[],schema:I({})},qh={name:"flappy-bird",layout:{w:4,h:4,minW:3,minH:3},description:"Flappy-bird style game on canvas — tap or press SPACE to flap through the gaps between pipes. High score persists locally. Needs no data provider.",capabilities:[],schema:I({})},Va={name:"video",layout:{w:4,h:3,minW:2,minH:2},description:"Embeds a video from a YouTube or Vimeo link (or any direct embed URL) as an iframe — a livestream, a market-news clip, a focus playlist. Needs no data provider.",capabilities:[],schema:I({url:Z().min(1).describe("Video URL — a YouTube watch/share link, a Vimeo link, or a direct embeddable URL (https)."),title:Z().default("Video").describe("Accessible title for the embedded player (iframe title).")})},Jh={name:"drawdy",layout:{w:8,h:6,minW:2,minH:2},description:"Embeds drawdy.io as an interactive whiteboard canvas. No configuration needed.",capabilities:[],schema:I({})},Za={name:"countdown",layout:{w:3,h:2,minW:2,minH:1},description:"Live countdown to a target date and time — FOMC decisions, CPI prints, options expiry, earnings, a token unlock, the next market open. Counts down in days / hours / minutes / seconds, ticking every second, and flips to a 'reached' state once the moment passes. Needs no data provider.",capabilities:[],schema:I({target:Z().default("").describe(`The moment to count down to, as an ISO 8601 string. Add a timezone for an unambiguous instant, e.g. "2026-07-30T18:00:00-04:00" or "2026-12-31T23:59:59Z"; a bare "2026-07-30T18:00" is read in the viewer's local timezone. Empty shows a "set a target" prompt.`),label:Z().default("").describe('Caption above the countdown, e.g. "FOMC Decision". Empty hides it.'),showTarget:ke().default(!0).describe("Show the formatted target date and time under the countdown.")})},Ga={name:"link-grid",layout:{w:3,h:2,minW:2,minH:1},description:"A grid of quick-launch tiles linking to your favourite sites — TradingView, exchanges, news, docs, your own dashboards. Each tile opens in a new tab and shows the destination site's favicon by default (fetched keyless from a public favicon service), with an optional per-link icon override and a first-letter fallback. Needs no data provider.",capabilities:[],schema:I({links:he(I({label:Z().min(1).describe('Tile caption, e.g. "TradingView".'),url:Z().min(1).describe("Destination URL (https). Opens in a new tab."),icon:Z().default("").describe(`Optional icon override: an emoji (e.g. "📈") or an https image URL. Empty uses the destination site's favicon, falling back to the label's first letter.`)})).min(1).default([{label:"TradingView",url:"https://www.tradingview.com",icon:"📈"},{label:"Hyperliquid",url:"https://app.hyperliquid.xyz",icon:"⚡"}]).describe("The links to show as tiles. At least one."),columns:U().int().min(1).max(4).default(2).describe("How many tiles per row.")})},Wa={name:"calculator",layout:{w:3,h:3,minW:2,minH:2},description:"Position-size & risk calculator. Enter account size, risk-per-trade %, entry and stop price; it computes the dollars at risk, the per-unit risk, the position size (units) that respects that risk budget, the resulting position value, and whether the setup is long or short. All math runs client-side — no data provider. Inputs are editable live; the configured values are the starting point.",capabilities:[],schema:I({account:U().positive().default(1e4).describe("Account size used as the risk base, in the quote currency."),riskPct:U().positive().max(100).default(1).describe("Percent of the account risked on the trade, e.g. 1 = 1%."),entry:U().positive().default(100).describe("Entry price."),stop:U().positive().default(95).describe("Stop-loss price. Its distance from entry sets the per-unit risk; below entry = long, above = short."),currency:Z().default("$").describe("Currency symbol shown next to money values.")})},Ya={name:"quote",layout:{w:4,h:2,minW:2,minH:1},description:'Displays a market or trading quote, centered — set one or rotate through several. A calm bit of wall-art for the dashboard: trading maxims, reminders of your own rules, mantras. Write any attribution into the text itself (e.g. "… — Buffett"). Needs no data provider.',capabilities:[],schema:I({quotes:he(Z().min(1)).min(1).default(["Be fearful when others are greedy, and greedy when others are fearful. — Warren Buffett","The trend is your friend until the end when it bends.","Plan the trade, trade the plan."]).describe("One or more quotes. With more than one, the frame rotates through them."),intervalSec:U().int().min(0).default(12).describe("Seconds between rotations when there are multiple quotes. 0 shows the first quote, fixed.")})},Xa={name:"divider",layout:{w:12,h:1,minW:1,minH:1},description:"A plain rule that separates regions of the dashboard, with an optional centered label. Renders chrome-less (no card) — lighter than a heading. Use a horizontal divider full-width between stacked zones, or set orientation to vertical for a 1-column-wide column separator. Needs no data provider.",capabilities:[],chrome:"bare",schema:I({label:Z().default("").describe("Optional text shown in the middle of the rule. Empty = a clean line."),orientation:ne(["horizontal","vertical"]).default("horizontal").describe("Horizontal rule (spans the width) or vertical rule (spans the height)."),style:ne(["solid","dashed","dotted"]).default("solid").describe("Line style.")})},Ka={name:"btc-fees",iconUrl:Y("btc-fees"),layout:{w:3,h:2,minW:2,minH:2},description:"Recommended Bitcoin on-chain fee rates (sat/vB) from mempool.space — the next-block ('fastest'), ~30-minute, ~1-hour, economy, and minimum tiers, as a compact gauge. Live mempool data, keyless; updates every ~30s.",capabilities:["btc-fees"],source:G.mempool,schema:I({tiers:he(ne(["fastest","halfHour","hour","economy","minimum"])).min(1).max(5).default(["fastest","halfHour","hour","economy"]).describe('Which fee tiers to show, in order. "fastest" = next block, "halfHour"/"hour" = within ~30/60 min, "economy"/"minimum" = cheapest relayable.')})},qa={name:"btc-mempool",iconUrl:Y("btc-mempool"),layout:{w:5,h:3,minW:3,minH:2},description:"Bitcoin mempool congestion at a glance — unconfirmed transaction count, total pending vsize, and a row of projected ('template') blocks the network will likely mine next, each labelled with its median fee rate (sat/vB) and tx count. Live mempool data from mempool.space, keyless.",capabilities:["btc-mempool"],source:G.mempool,schema:I({projectedBlocks:U().int().min(1).max(8).default(5).describe("How many projected (yet-to-be-mined) blocks to show, next-to-mine first.")})},Ja={name:"btc-blocks",iconUrl:Y("btc-blocks"),layout:{w:5,h:4,minW:3,minH:3},description:"Feed of the most recently mined Bitcoin blocks — each row shows the height, how long ago it was mined, transaction count, the mining pool that found it, total fees (BTC), and size. Live data from mempool.space, keyless; newest first.",capabilities:["btc-blocks"],source:G.mempool,schema:I({count:U().int().min(3).max(15).default(8).describe("How many recent blocks to list (newest first).")})},Qa={name:"btc-hashrate",iconUrl:Y("btc-hashrate"),layout:{w:6,h:3,minW:3,minH:2},description:"Bitcoin network hashrate over time as a line chart, with the current hashrate (EH/s) and difficulty as headline figures. Shows the long-run security trend of the network. Data from mempool.space (daily granularity), keyless.",capabilities:["btc-hashrate"],source:G.mempool,schema:I({window:ne(["1y","2y","3y"]).default("1y").describe("History window for the hashrate line.")})},ei={name:"btc-difficulty",iconUrl:Y("btc-difficulty"),layout:{w:4,h:3,minW:3,minH:2},description:"Countdown to the next Bitcoin difficulty adjustment — a progress bar through the current 2016-block epoch, the estimated change (+ = mining gets harder), blocks remaining, and the estimated retarget date. Also shows the previous adjustment. Data from mempool.space, keyless.",capabilities:["btc-difficulty"],source:G.mempool,schema:I({showPrevious:ke().default(!0).describe("Also show the percentage change applied at the previous retarget.")})},ti={name:"mining-pools",iconUrl:Y("mining-pools"),layout:{w:6,h:4,minW:3,minH:3},description:"Treemap of Bitcoin mining-pool dominance over a window — each tile is a pool sized by the share of blocks it mined, so you can see how concentrated hashpower is right now (Foundry, AntPool, ViaBTC…). Data from mempool.space, keyless.",capabilities:["mining-pools"],source:G.mempool,schema:I({window:ne(["24h","3d","1w","1m"]).default("1w").describe("Window over which to measure each pool's block share."),topN:U().int().min(3).max(25).default(12).describe("How many of the largest pools to show; the rest fold into 'Other'.")})},ni={name:"lightning-stats",iconUrl:Y("lightning-stats"),layout:{w:4,h:3,minW:3,minH:2},description:"Bitcoin Lightning Network snapshot — public node count, channel count, and total network capacity (BTC), with a day-over-day delta and the Tor/clearnet node split. Data from mempool.space, keyless; updates roughly daily.",capabilities:["lightning-stats"],source:G.mempool,schema:I({showSplit:ke().default(!0).describe("Show the Tor vs clearnet node split under the headline stats.")})},ri={name:"options-put-call",iconUrl:Y("options-put-call"),layout:{w:4,h:3,minW:3,minH:2},description:"Deribit options put/call ratio for BTC or ETH — the headline ratio (by open interest or 24h volume), a call-vs-put open-interest split bar, and the open-interest-weighted average implied volatility. A ratio above 1 means puts outweigh calls (defensive positioning). Keyless Deribit market data.",capabilities:["options-summary"],source:G.deribit,schema:I({currency:ne(["BTC","ETH"]).default("BTC").describe("Which Deribit options book to summarise — BTC or ETH (the only deeply liquid books)."),basis:ne(["oi","volume"]).default("oi").describe('Headline put/call ratio basis: "oi" = by open interest (positioning), "volume" = by 24h traded volume (flow). The other is shown smaller.')})},si={name:"options-iv",iconUrl:Y("options-iv"),layout:{w:6,h:3,minW:3,minH:2},description:"Deribit DVOL implied-volatility index for BTC or ETH over time — the crypto equivalent of the VIX, as a line chart with the current reading and its change over the window. Rising DVOL = the market is pricing bigger expected swings. Keyless Deribit market data.",capabilities:["volatility-index"],source:G.deribit,schema:I({currency:ne(["BTC","ETH"]).default("BTC").describe("Which DVOL volatility index to plot — BTC or ETH."),lookback:ne(["7D","1M","3M"]).default("1M").describe("History window for the volatility-index line.")})},oi={name:"options-oi-strike",iconUrl:Y("options-oi-strike"),layout:{w:6,h:4,minW:4,minH:3},description:"Open interest by strike for the nearest Deribit options expiry (BTC or ETH) — a grouped histogram of call vs put open interest across strikes, with the current spot marked. Surfaces the strike 'walls' where positioning is concentrated. Keyless Deribit market data.",capabilities:["options-summary"],source:G.deribit,schema:I({currency:ne(["BTC","ETH"]).default("BTC").describe("Which Deribit options book — BTC or ETH."),strikes:U().int().min(6).max(30).default(14).describe("How many strikes nearest the current spot to show (centered on the underlying price).")})},ai={name:"coin-movers",iconUrl:Y("coin-movers"),layout:{w:5,h:4,minW:3,minH:3},description:"Broad-market crypto gainers and losers across the top ~300 coins by market cap, over a selectable window (1h / 24h / 7d / 30d) — the biggest movers side by side with price and % change. Unlike a top-coins heatmap, this surfaces mid- and small-caps that ripped or dumped, not just the megacaps. Keyless data from Coinpaprika. Crypto only.",capabilities:["coin-movers"],source:G.coinpaprika,schema:I({window:ne(["1h","24h","7d","30d"]).default("24h").describe("Which price-change window ranks the movers: 1h (intraday momentum), 24h (daily), 7d (weekly), 30d (monthly)."),count:U().int().min(3).max(15).default(6).describe("How many gainers and how many losers to list (each side)."),minRank:U().int().min(20).max(300).default(150).describe("Only consider coins ranked at or above this market-cap rank — a liquidity floor that keeps illiquid micro-cap dust (which posts absurd % moves on no volume) out of the list. Lower = stricter (megacaps only); higher = includes more small-caps.")})},on="min-h-0 flex-1 overflow-y-auto pr-1 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-white/[0.08] hover:[&::-webkit-scrollbar-thumb]:bg-white/15";function A({loading:e=!1,children:t}){return e?o.jsx("div",{className:"flex h-full min-h-[72px] w-full items-center justify-center overflow-hidden rounded-md",role:"status","aria-live":"polite","aria-busy":"true",children:o.jsxs("div",{className:"flex w-full max-w-sm flex-col gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"relative h-2.5 w-2.5 shrink-0 rounded-full",style:{background:"hsl(var(--zf-accent-hue, 242) 90% 76%)",boxShadow:"0 0 12px hsl(var(--zf-accent-hue, 242) 90% 76% / 0.72)"},children:o.jsx("span",{className:"absolute inset-0 animate-ping rounded-full opacity-60",style:{background:"hsl(var(--zf-accent-hue, 242) 90% 76%)"}})}),o.jsx("span",{className:"body-sm text-soft truncate",children:t})]}),o.jsxs("div",{className:"grid min-h-0 grid-cols-4 gap-2",children:[o.jsx("span",{className:"h-11 animate-pulse rounded bg-white/[0.07]"}),o.jsx("span",{className:"h-11 animate-pulse rounded bg-white/[0.05]"}),o.jsx("span",{className:"h-11 animate-pulse rounded bg-white/[0.08]"}),o.jsx("span",{className:"h-11 animate-pulse rounded bg-white/[0.04]"})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("span",{className:"h-2.5 w-11/12 animate-pulse rounded-full bg-white/[0.07]"}),o.jsx("span",{className:"h-2.5 w-7/12 animate-pulse rounded-full bg-white/[0.05]"})]})]})}):o.jsx("div",{className:"body-sm text-soft flex h-full min-h-0 items-center justify-center text-center",children:t})}$a.schema;function Jr(e){return e>=1e9?`$${(e/1e9).toFixed(2)}B`:e>=1e6?`$${(e/1e6).toFixed(2)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function Qh({config:e}){const t=p.useMemo(()=>e.holdings.map(i=>i.symbol),[e.holdings]),{mids:n,isLoading:r}=er(t),s=p.useMemo(()=>e.holdings.map((i,c)=>({name:le(i.symbol),value:(n[i.symbol]??0)*i.amount,color:Se[c%Se.length]})).filter(i=>i.value>0).sort((i,c)=>c.value-i.value),[e.holdings,n]),a=s.reduce((i,c)=>i+c.value,0);return r?o.jsx(A,{loading:!0,children:"loading allocation..."}):s.length===0?o.jsx(A,{children:"no live prices yet"}):o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4",children:[o.jsx(Yh,{data:s,width:200,height:200,innerRadius:58,outerRadius:92,colors:s.map(i=>i.color),children:o.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[o.jsx("span",{className:"caption text-soft",children:"total"}),o.jsx("span",{className:"font-dmsans text-strong text-3xl font-bold tabular-nums",children:Jr(a)})]})}),o.jsx("div",{className:"flex w-full max-w-xs flex-wrap justify-center gap-x-5 gap-y-1.5",children:s.map(i=>o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"h-2 w-2 flex-shrink-0 rounded-full",style:{background:i.color}}),o.jsx("span",{className:"body-sm text-soft",children:i.name}),o.jsxs("span",{className:"body-sm text-normal font-bold tabular-nums",children:[(i.value/a*100).toFixed(1),"%"]}),o.jsx("span",{className:"caption text-soft tabular-nums",children:Jr(i.value)})]},i.name))})]})}const ep={...$a,component:Qh};function Oe(e){return e>=1e3?`$${e.toLocaleString("en-US",{maximumFractionDigits:0})}`:e>=1?`$${e.toLocaleString("en-US",{maximumFractionDigits:2})}`:`$${e.toPrecision(4)}`}function qe(e){return`${e>=0?"+":""}${e.toFixed(2)}%`}function je(e){return e>=0?"#3fd08f":"#ff6b81"}function ii(e){const t=e/1e8;return t>=100?`${t.toFixed(0)} BTC`:t>=1?`${t.toFixed(2)} BTC`:t>=.001?`${t.toFixed(4)} BTC`:`${Math.round(e).toLocaleString("en-US")} sats`}function tp(e){const t=["H/s","kH/s","MH/s","GH/s","TH/s","PH/s","EH/s","ZH/s"];let n=e,r=0;for(;n>=1e3&&r<t.length-1;)n/=1e3,r++;return`${n.toFixed(n>=100?0:n>=10?1:2)} ${t[r]}`}function ci(e){const t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.round(t/60);if(n<60)return`${n}m`;const r=Math.round(n/60);if(r<24)return`${r}h`;const s=Math.round(r/24);if(s<7)return`${s}d`;const a=Math.round(s/7);return a<5?`${a}w`:new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric"})}va.schema;const Qr={BTC:"linear-gradient(90deg, #FF810F 0%, #FF9E37 100%)",ETH:"#6366F1",Others:"#7C3AED"};function np({config:e}){const{market:t,isLoading:n}=Lm(),r=p.useMemo(()=>{if(!t)return[];const a=t.dominance.btc??0,i=t.dominance.eth??0;return[{type:"BTC",value:a},{type:"ETH",value:i},{type:"Others",value:Math.max(0,100-a-i)}].sort((c,u)=>u.value-c.value)},[t]);if(n)return o.jsx(A,{loading:!0,children:"loading dominance…"});if(!t)return o.jsx(A,{children:"no market data"});const s=r[0];return o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsxs("span",{className:"font-dmsans text-strong text-5xl font-bold tabular-nums",children:[s.value.toFixed(1),"%"]}),o.jsx("span",{className:"body-md text-soft",children:s.type})]}),o.jsx("div",{className:"flex h-3 w-full max-w-sm gap-1 overflow-hidden rounded-full",children:r.map((a,i)=>o.jsx("div",{className:`h-full ${i===0?"rounded-l-full":""} ${i===r.length-1?"rounded-r-full":""}`,style:{width:`${a.value}%`,background:Qr[a.type]}},a.type))}),o.jsx("div",{className:"grid w-full max-w-sm grid-cols-3",children:r.map(a=>o.jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[o.jsx("div",{className:"h-2 w-2 flex-shrink-0 rounded-full",style:{background:Qr[a.type]}}),o.jsx("span",{className:"body-sm text-soft",children:a.type}),o.jsxs("span",{className:"body-sm text-normal font-bold tabular-nums",children:[a.value.toFixed(1),"%"]})]},a.type))}),e.showTotalMarketCap&&o.jsxs("div",{className:"caption text-soft",children:["total mcap $",(t.totalMarketCapUsd/1e12).toFixed(2),"T ·"," ",o.jsxs("span",{style:{color:je(t.marketCapChangePct24h)},children:[qe(t.marketCapChangePct24h)," 24h"]})]})]})}const rp={...va,component:np};let li=typeof window<"u"?window.scrollY:0,ui=typeof window<"u"?window.innerHeight:0,At;typeof window<"u"&&(window.addEventListener("scroll",()=>{At!=null&&(window.clearTimeout(At),At=void 0),At=window.setTimeout(()=>{li=window.scrollY},200)},{passive:!0}),window.addEventListener("resize",()=>{ui=window.innerHeight},{passive:!0}));const Fn={_callbacks:[],register(e){this._callbacks.push(e)},unregister(e){this._callbacks=this._callbacks.filter(t=>t!==e)},tick(){setInterval(()=>{this._callbacks.forEach(t=>t())},1e3/24)}};typeof window<"u"&&Fn.tick();function De({ref:e,getRemainingMs:t,format:n}){const r=p.useRef({getRemainingMs:t,format:n});r.current={getRemainingMs:t,format:n};const s=p.useRef(0);p.useLayoutEffect(()=>{const a=()=>{e.current&&(s.current=e.current.getBoundingClientRect().top+window.scrollY)};return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[e]),p.useEffect(()=>{const a=()=>{if(!e.current)return;const i=s.current-li;if(i>ui||i<0)return;const c=r.current.getRemainingMs();e.current&&(e.current.textContent=r.current.format(c))};return Fn.register(a),()=>{Fn.unregister(a)}},[e])}la.schema;function ft(e){const t={hour:"",minute:"",second:"",fractional:"",period:""};for(const n of e.formatToParts(new Date))n.type==="hour"?t.hour=n.value:n.type==="minute"?t.minute=n.value:n.type==="second"?t.second=n.value:n.type==="fractionalSecond"?t.fractional=n.value:n.type==="dayPeriod"&&(t.period=n.value);return t}function sp({config:e}){const t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),s=p.useRef(null),a=p.useRef(null),i=e.timezone.trim()||void 0,c=e.showSeconds||e.showMillis,u=p.useMemo(()=>{var h;try{const g=new Intl.DateTimeFormat(void 0,{timeZone:i,hour:"2-digit",minute:"2-digit",second:c?"2-digit":void 0,fractionalSecondDigits:e.showMillis?3:void 0,hour12:e.hour12}),w=e.showDate?new Intl.DateTimeFormat(void 0,{timeZone:i,weekday:"short",month:"short",day:"numeric"}):null;let v="";return e.showTimezone&&(v=((h=new Intl.DateTimeFormat(void 0,{timeZone:i,hour:"2-digit",timeZoneName:"short"}).formatToParts(new Date).find(x=>x.type==="timeZoneName"))==null?void 0:h.value)??""),{time:g,date:w,zone:v,error:null}}catch{return{time:null,date:null,zone:"",error:i??"invalid timezone"}}},[i,c,e.showMillis,e.hour12,e.showDate,e.showTimezone]);if(De({ref:t,getRemainingMs:()=>Date.now(),format:()=>{if(!u.time)return"";const h=ft(u.time);return`${h.hour}:${h.minute}`}}),De({ref:n,getRemainingMs:()=>Date.now(),format:()=>u.time?`:${ft(u.time).second}`:""}),De({ref:r,getRemainingMs:()=>Date.now(),format:()=>u.time?`.${ft(u.time).fractional}`:""}),De({ref:s,getRemainingMs:()=>Date.now(),format:()=>u.time?ft(u.time).period:""}),De({ref:a,getRemainingMs:()=>Date.now(),format:()=>u.date?u.date.format(new Date):""}),u.error)return o.jsxs(A,{children:["unknown timezone: ",u.error]});const l=ft(u.time),d="hsl(var(--zf-accent-hue, 242) 96% 82%)",m="0 0 22px hsl(var(--zf-accent-hue, 242) 92% 70% / 0.45)";return o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-center [container-type:size]",children:[o.jsxs("div",{className:"text-strong inline-flex max-w-full items-baseline justify-center whitespace-nowrap font-dmsans font-extrabold leading-none tracking-[-0.01em] tabular-nums",style:{fontSize:"clamp(1.6rem, 37cqmin, 5.5rem)"},children:[o.jsx("span",{ref:t,suppressHydrationWarning:!0,children:`${l.hour}:${l.minute}`}),c&&o.jsx("span",{ref:n,suppressHydrationWarning:!0,className:"font-bold",style:{fontSize:"0.46em",color:d,textShadow:m},children:`:${l.second}`}),e.showMillis&&o.jsx("span",{ref:r,suppressHydrationWarning:!0,className:"font-semibold",style:{fontSize:"0.3em",color:d,opacity:.65},children:`.${l.fractional}`}),e.hour12&&o.jsx("span",{ref:s,suppressHydrationWarning:!0,className:"text-soft ml-[0.3em] self-center font-semibold uppercase",style:{fontSize:"0.3em",letterSpacing:"0.08em"},children:l.period})]}),e.showDate&&u.date&&o.jsx("div",{ref:a,suppressHydrationWarning:!0,className:"caption text-soft tabular-nums",children:u.date.format(new Date)}),(e.label||u.zone)&&o.jsxs("div",{className:"caption text-soft inline-flex items-center gap-1.5 uppercase tracking-[0.18em]",children:[o.jsx("span",{"aria-hidden":!0,className:"inline-block h-1 w-1 rounded-full",style:{background:d,boxShadow:m}}),e.label&&u.zone?`${e.label} · ${u.zone}`:e.label||u.zone]})]})}const op={...la,component:sp};Aa.schema;const xn={bullish:"#76d275",bearish:"#e6464f",neutral:"#9aa0aa"},ap={hit:"#76d275",miss:"#e6464f",partial:"#f4a259"};function ip(e){let t=0,n=0;for(const r of e)for(const s of r.grades??[])n++,s.verdict==="hit"?t+=1:s.verdict==="partial"&&(t+=.5);return{rate:n?t/n:0,n}}function cp({config:e}){const[t,n]=p.useState(null),[r,s]=p.useState(!1);if(p.useEffect(()=>{let l=!1;const d=()=>{fetch(e.src,{cache:"no-store"}).then(g=>{if(!g.ok)throw new Error(`HTTP ${g.status}`);return g.json()}).then(g=>{l||(n(g),s(!0))}).catch(()=>{l||s(!0)})};d();const m=()=>d();window.addEventListener("focus",m);const h=window.setInterval(d,e.refreshSec*1e3);return()=>{l=!0,window.removeEventListener("focus",m),window.clearInterval(h)}},[e.src,e.refreshSec]),!r)return o.jsx(A,{loading:!0,children:"loading brief…"});const a=(t==null?void 0:t.entries)??[];if(a.length===0)return o.jsx(A,{children:"no brief yet — run /zframes-brief"});const i=a.slice(-e.entries).reverse(),{rate:c,n:u}=ip(a);return o.jsxs("div",{className:"body-sm flex h-full flex-col gap-3 overflow-auto",children:[u>0&&o.jsxs("div",{className:"caption text-soft flex items-center justify-between",children:[o.jsx("span",{className:"uppercase tracking-wide",children:"track record"}),o.jsxs("span",{className:"font-bold tabular-nums text-white",children:[Math.round(c*100),"% · ",u," call",u===1?"":"s"]})]}),i.map((l,d)=>{var m,h,g,w,v,f;return o.jsxs("div",{className:"flex flex-col gap-1.5",children:[(l.date||((m=l.run)==null?void 0:m.model))&&o.jsxs("div",{className:"caption text-soft flex items-baseline justify-between gap-2",children:[o.jsx("span",{className:"uppercase tracking-wide",children:l.date}),((h=l.run)==null?void 0:h.model)&&o.jsxs("span",{className:"truncate opacity-70",title:l.run.timestamp??"",children:[l.run.model,l.run.effort?` · ${l.run.effort}`:""]})]}),l.summary&&o.jsx("div",{className:"text-normal whitespace-pre-wrap",children:l.summary}),(((g=l.calls)==null?void 0:g.length)??0)>0&&o.jsx("div",{className:"flex flex-col gap-1",children:(w=l.calls)==null?void 0:w.map((x,y)=>o.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)] items-baseline gap-2",children:[o.jsx("span",{className:"caption font-bold uppercase tracking-wide",style:{color:xn[x.direction??"neutral"]??xn.neutral},children:x.symbol?le(x.symbol):x.direction??"•"}),o.jsx("span",{className:"text-normal",children:x.claim})]},x.id??y))}),(((v=l.grades)==null?void 0:v.length)??0)>0&&o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.jsx("span",{className:"caption text-soft uppercase tracking-wide",children:"graded"}),(f=l.grades)==null?void 0:f.map((x,y)=>o.jsx("span",{className:"caption rounded px-1.5 py-0.5 font-bold uppercase",style:{color:ap[x.verdict??""]??xn.neutral,background:"rgba(255,255,255,0.06)"},title:x.note??"",children:x.verdict??"—"},x.callId??y))]})]},l.date??d)})]})}const lp={...Aa,component:cp},up=.6,dp=-12,Ht=40,mp=40,xt=44,es=24,fp=40,ts=3,hp=5e-4,ge={ground:"rgba(255, 255, 255, 0.1)",groundTexture:"rgba(255, 255, 255, 0.06)",dino:"rgba(255, 255, 255, 1)",eye:"rgba(0, 0, 0, 0.8)",cactus:"#25A78D",text:"rgba(255, 255, 255, 0.85)",textSoft:"rgba(255, 255, 255, 0.6)",score:"hsla(246, 100%, 70%, 1)",gameOver:"hsla(347, 100%, 62%, 1)"};function di(e,t,n,r){e.fillStyle=ge.dino,e.fillRect(t+10,n+10,25,24),e.fillRect(t+20,n,20,16),e.fillStyle=ge.eye,e.fillRect(t+32,n+4,4,4),e.fillStyle=ge.dino,e.fillRect(t,n+16,14,8),e.fillRect(t-4,n+12,8,8),r===null?(e.fillRect(t+12,n+34,6,10),e.fillRect(t+24,n+34,6,10)):(e.fillRect(t+12,n+34,6,r===0?10:6),e.fillRect(t+24,n+34,6,r===1?10:6)),e.fillRect(t+30,n+18,4,10)}function pp(e,t,n,r,s){const a=n-s;e.fillStyle=ge.cactus,e.fillRect(t+r/2-4,a,8,s),e.fillRect(t,a+10,8,6),e.fillRect(t,a+10,4,14),e.fillRect(t+r-8,a+18,8,6),e.fillRect(t+r-4,a+18,4,12)}function ns(e,t,n,r,s){const a=e.height-Ht;t.clearRect(0,0,e.width,e.height),t.fillStyle=ge.ground,t.fillRect(0,a,e.width,2),di(t,50,a-xt,null),t.textAlign="center",n==="idle"?(t.fillStyle=ge.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText("Press SPACE or tap to start",e.width/2,e.height/2-30)):(t.fillStyle=ge.gameOver,t.font='bold 20px "DM Sans", sans-serif',t.fillText("GAME OVER",e.width/2,e.height/2-40),t.fillStyle=ge.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText(`Score: ${r}`,e.width/2,e.height/2-10),t.fillStyle=ge.textSoft,t.fillText("Press SPACE or tap to restart",e.width/2,e.height/2+20)),t.textAlign="left",t.font='bold 12px "DM Sans", monospace',t.fillStyle=ge.textSoft,t.fillText("HI",10,30),t.fillStyle=ge.score,t.fillText(String(s).padStart(5,"0"),30,30)}function gp(){const e=p.useRef(null),t=p.useRef(null),[n,r]=p.useState("idle"),[s,a]=p.useState(0),[i,c]=p.useState(()=>{if(typeof window<"u"){const f=localStorage.getItem("zframes-dino-high-score");return f?parseInt(f,10):0}return 0}),[u,l]=p.useState(!1),d=p.useRef(0),m=p.useRef(i),h=p.useRef(n);p.useEffect(()=>{m.current=i,i>0&&localStorage.setItem("zframes-dino-high-score",String(i))},[i]),p.useEffect(()=>{h.current=n},[n]);const g=p.useRef({dinoY:0,dinoVelocity:0,isJumping:!1,obstacles:[],speed:ts,frameCount:0,groundOffset:0}),w=p.useCallback(()=>{const f=e.current;f&&(g.current={dinoY:f.height-Ht-xt,dinoVelocity:0,isJumping:!1,obstacles:[],speed:ts,frameCount:0,groundOffset:0},d.current=0,a(0))},[]),v=p.useCallback(()=>{var x;if((x=t.current)==null||x.focus(),n!=="playing"){w(),r("playing");return}const f=g.current;f.isJumping||(f.dinoVelocity=dp,f.isJumping=!0)},[n,w]);return p.useEffect(()=>{const f=y=>{const S=y.target;S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.isContentEditable||(y.code==="Space"||y.code==="ArrowUp")&&(y.preventDefault(),v())},x=t.current;if(x)return x.addEventListener("keydown",f),()=>x.removeEventListener("keydown",f)},[v]),p.useLayoutEffect(()=>{const f=e.current;if(!f)return;const x=()=>{const S=f.parentElement;if(S&&S.clientWidth>0&&S.clientHeight>0){f.width=S.clientWidth,f.height=S.clientHeight,g.current.dinoY=f.height-Ht-xt;const k=f.getContext("2d");k&&h.current!=="playing"&&ns(f,k,h.current,d.current,m.current),l(T=>!T)}};x();const y=new ResizeObserver(x);return y.observe(f.parentElement),()=>y.disconnect()},[]),p.useEffect(()=>{if(n!=="playing")return;const f=e.current,x=f==null?void 0:f.getContext("2d");if(!f||!x)return;let y;const S=f.height-Ht,k=()=>{x.fillStyle=ge.ground,x.fillRect(0,S,f.width,2),x.fillStyle=ge.groundTexture;const b=g.current.groundOffset%30;for(let _=-b;_<f.width;_+=30)x.beginPath(),x.arc(_,S+12,1.5,0,Math.PI*2),x.fill(),x.beginPath(),x.arc(_+15,S+20,1,0,Math.PI*2),x.fill()},T=()=>{x.font='bold 12px "DM Sans", monospace',x.textAlign="left",x.fillStyle=ge.textSoft,x.fillText("HI",10,30),x.fillStyle=ge.score,x.fillText(String(m.current).padStart(5,"0"),30,30),x.textAlign="right",x.fillStyle=ge.text,x.fillText(String(d.current).padStart(5,"0"),f.width-10,30)},N=b=>{const P=g.current.dinoY;return 50+mp-5>b.x&&55<b.x+b.width&&P+xt>S-b.height&&P+5<S},j=()=>{const b=g.current;x.clearRect(0,0,f.width,f.height),b.dinoVelocity+=up,b.dinoY+=b.dinoVelocity;const _=S-xt;b.dinoY>=_&&(b.dinoY=_,b.dinoVelocity=0,b.isJumping=!1),b.obstacles=b.obstacles.filter(E=>E.x>-es),b.obstacles.forEach(E=>{E.x-=b.speed});const P=b.obstacles[b.obstacles.length-1],B=300+Math.random()*200;(!P||P.x<f.width-B)&&Math.random()<.02&&b.obstacles.push({x:f.width,width:es,height:fp});for(const E of b.obstacles)if(N(E)){d.current>m.current&&(m.current=d.current,c(d.current)),r("gameover");return}b.frameCount++,b.frameCount%6===0&&(d.current+=1,a(d.current)),b.speed+=hp,b.groundOffset+=b.speed,k(),di(x,50,b.dinoY,b.isJumping?null:Math.floor(b.frameCount/5)%2),b.obstacles.forEach(E=>pp(x,E.x,S,E.width,E.height)),T(),y=requestAnimationFrame(j)};return y=requestAnimationFrame(j),()=>cancelAnimationFrame(y)},[n]),p.useEffect(()=>{if(n==="playing")return;const f=e.current,x=f==null?void 0:f.getContext("2d");!f||!x||ns(f,x,n,s,i)},[n,s,i,u]),o.jsx("div",{ref:t,tabIndex:0,className:"relative h-full w-full cursor-pointer select-none overflow-hidden outline-none",onClick:v,onTouchStart:v,role:"application","aria-label":"Dino running game. Press space or tap to jump over obstacles.",children:o.jsx("canvas",{ref:e,className:"h-full w-full"})})}const xp={...Xh,component:gp};da.schema;function bp(e){return e<=25?"#F21553":e<=45?"#F97316":e<=55?"#F59E0B":e<=75?"#84CC16":"#25A78D"}function vp({config:e}){const{points:t,isLoading:n}=Um(e.sparklineDays),r=t[0],s=p.useMemo(()=>[...t].reverse().map(i=>({date:new Date(i.time).toISOString(),value:i.value})),[t]);if(n)return o.jsx(A,{loading:!0,children:"loading index…"});if(!r)return o.jsx(A,{children:"no sentiment data"});const a=bp(r.value);return o.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2.5",children:[o.jsx("div",{className:"font-dmsans text-5xl font-bold leading-none tracking-tight tabular-nums",style:{color:a,textShadow:`0 0 28px ${a}55`},children:r.value}),o.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:r.classification}),o.jsxs("div",{className:"relative w-full max-w-[180px] overflow-hidden rounded-xl",children:[o.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%)"}}),o.jsx("div",{className:"absolute left-0 top-0 h-full w-full",style:{background:"repeating-linear-gradient(to right, #14181D, #14181D 2px, transparent 2px, transparent 3px)"}}),o.jsx("div",{className:"absolute top-1/2 h-3 w-[3px] -translate-x-1/2 -translate-y-1/2 rounded-xs",style:{left:`${r.value}%`,background:a}})]}),o.jsx(et,{data:s,width:150,height:30,color:a}),o.jsxs("div",{className:"caption text-soft",children:["crypto fear & greed · ",e.sparklineDays,"d"]})]})}const yp={...da,component:vp};_a.schema;const Pt={"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"},wp=/^(10-K|10-Q|8-K|20-F|40-F|6-K|S-|F-|424|DEF |DEFA|DEFM|11-K|SC 13|25)/i,kp=/^(3|4|5|144)(\/A)?$/;function ar(e){return e.replace(/^SCHEDULE /i,"SC ").trim()}function Sp(e,t){return t==="all"?!0:t==="insider"?kp.test(e):wp.test(e)}function Np(e){const t=ar(e.form);if(Pt[t])return Pt[t];const n=t.replace(/\/A$/,"");return n!==t&&Pt[n]?`${Pt[n]} (amended)`:e.description&&e.description.toUpperCase()!==e.form.toUpperCase()?e.description:t}function jp({filing:e}){return o.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",className:"group flex min-w-0 items-center gap-3 border-b border-white/[0.06] py-1.5 no-underline transition-colors last:border-b-0 hover:bg-white/[0.03]",children:[o.jsx("span",{title:e.form,className:"font-dmsans text-strong inline-flex w-16 shrink-0 justify-center truncate rounded bg-white/[0.06] px-1.5 py-1 text-[11px] font-bold",children:ar(e.form)}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"body-sm text-normal block truncate font-medium",children:Np(e)}),o.jsx("span",{className:"caption text-soft block truncate",children:e.reportDate?`period ${e.reportDate}`:e.items?`items ${e.items}`:e.accessionNumber})]}),o.jsx("span",{className:"caption text-soft shrink-0 tabular-nums",children:e.filingDate}),o.jsx("span",{className:"caption text-soft shrink-0 opacity-0 transition-opacity group-hover:opacity-100",children:"↗"})]})}function _p({config:e}){const{data:t,isLoading:n}=Ym(e.symbol),r=p.useMemo(()=>((t==null?void 0:t.filings)??[]).filter(c=>Sp(ar(c.form),e.forms)).slice(0,e.count),[t==null?void 0:t.filings,e.forms,e.count]);if(n)return o.jsx(A,{loading:!0,children:"loading SEC filings…"});if(!t)return o.jsxs(A,{children:['no SEC data for "',le(e.symbol),'"']});const s=t.tickers[0],a=e.symbol.includes(":")?e.symbol:s?`xyz:${s}`:null,i=[t.exchanges[0],t.category].filter(Boolean).join(" · ");return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a&&o.jsx(Le,{symbol:a,size:22}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:t.name||s||le(e.symbol)}),i&&o.jsx("div",{className:"caption text-soft truncate",children:i})]})]}),o.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"filings"})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.length>0?r.map(c=>o.jsx(jp,{filing:c},c.accessionNumber)):o.jsxs("div",{className:"body-sm text-soft flex h-full items-center justify-center text-center",children:["no ",e.forms==="all"?"":`${e.forms} `,"filings"]})})]})}const Cp={..._a,component:_p};Ta.schema;function Tp(e){if(e.unit==="USD/shares")return`$${e.value.toFixed(2)}`;const t=Math.abs(e.value);if(e.unit==="shares")return t>=1e9?`${(e.value/1e9).toFixed(2)}B`:t>=1e6?`${(e.value/1e6).toFixed(1)}M`:e.value.toLocaleString("en-US");const n=e.value<0?"-":"";return t>=1e12?`${n}$${(t/1e12).toFixed(2)}T`:t>=1e9?`${n}$${(t/1e9).toFixed(2)}B`:t>=1e6?`${n}$${(t/1e6).toFixed(1)}M`:`${n}$${t.toLocaleString("en-US")}`}function zp({config:e}){const{data:t,isLoading:n}=Xm(e.symbol);return n?o.jsx(A,{loading:!0,children:"loading SEC financials…"}):!t||t.metrics.length===0?o.jsxs(A,{children:['no SEC financials for "',le(e.symbol),'"']}):o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:t.entityName||le(e.symbol)}),o.jsx("div",{className:"caption text-soft truncate",children:"SEC EDGAR · XBRL company facts"})]}),o.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"on filing"})]}),o.jsx("div",{className:"grid min-h-0 flex-1 grid-cols-2 content-start gap-2 overflow-y-auto",children:t.metrics.map(r=>o.jsxs("div",{className:"rounded bg-white/[0.04] px-3 py-2",children:[o.jsx("div",{className:"caption text-soft truncate",children:r.label}),o.jsx("div",{className:"font-dmsans text-strong text-lg font-bold tabular-nums",children:Tp(r)}),o.jsx("div",{className:"caption text-soft truncate",children:r.fiscalPeriod})]},r.label))})]})}const Mp={...Ta,component:zp};ka.schema;function rs(e){return e>0?"#ff6b81":"#3fd08f"}function Ep(e){return e>=2.5?"high stress":e>=1?"elevated":e>-1?"near average":"below average"}function Rp({config:e}){const{stress:t,isLoading:n}=Wm(),r=p.useMemo(()=>((t==null?void 0:t.trend)??[]).slice(-e.trendDays).map(a=>({date:new Date(a.time).toISOString(),value:a.value})),[e.trendDays,t==null?void 0:t.trend]);if(n)return o.jsx(A,{loading:!0,children:"loading stress index…"});if(!t)return o.jsx(A,{children:"no stress-index data"});const s=rs(t.value);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"OFR FSI"}),o.jsx("div",{className:"body-sm text-normal",children:t.date})]}),o.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"font-dmsans text-5xl font-bold leading-none tabular-nums",style:{color:s,textShadow:`0 0 24px ${s}44`},children:[t.value>0?"+":"",t.value.toFixed(2)]}),o.jsx("div",{className:"caption text-soft mt-1",children:Ep(t.value)})]}),o.jsxs("div",{className:"caption text-soft max-w-[46%] text-right leading-snug",children:["0 = long-run average",o.jsx("br",{}),"higher = more stress"]})]}),o.jsx(et,{data:r,width:210,height:42,color:s}),e.showCategories&&t.categories.length>0&&o.jsx("div",{className:"grid grid-cols-2 gap-1.5 border-t border-white/[0.08] pt-2",children:t.categories.map(a=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"caption text-soft truncate",children:a.label}),o.jsxs("span",{className:"body-sm font-bold tabular-nums",style:{color:rs(a.value)},children:[a.value>0?"+":"",a.value.toFixed(2)]})]},a.label))})]})}const Ap={...ka,component:Rp};Na.schema;const Pp="LNS14000000",$p="CES0000000001";function Dp(e){const t=e>=0?"+":"";return Math.abs(e)>=1e3?`${t}${(e/1e3).toFixed(2)}M`:`${t}${Math.round(e)}K`}function Ip({config:e}){const n=new Date().getUTCFullYear(),r=n-2,{series:s,isLoading:a}=$n(Pp,r,n),{series:i,isLoading:c}=$n($p,r,n),u=p.useMemo(()=>((s==null?void 0:s.points)??[]).slice(-e.months),[e.months,s==null?void 0:s.points]),l=p.useMemo(()=>u.map(w=>({date:new Date(w.time).toISOString(),value:w.value})),[u]);if(a&&c)return o.jsx(A,{loading:!0,children:"loading labor data…"});const d=u.at(-1);if(!s||!d)return o.jsx(A,{children:"no labor data"});const m=i==null?void 0:i.points.at(-1),h=i==null?void 0:i.points.at(-2),g=m&&h?m.value-h.value:null;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"unemployment rate"}),o.jsx("div",{className:"body-sm text-normal",children:d.date})]}),o.jsx("div",{className:"caption text-soft text-right",children:"monthly"})]}),o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"font-dmsans text-strong text-5xl font-bold leading-none tabular-nums",children:[d.value.toFixed(1),"%"]}),o.jsxs("div",{className:"caption text-soft mt-1",children:[s.source," · U-3"]})]}),g!==null&&m&&o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"caption text-soft",children:"nonfarm payrolls"}),o.jsx("div",{className:"body-md font-bold tabular-nums",style:{color:je(g)},children:Dp(g)}),o.jsxs("div",{className:"caption text-soft mt-1 tabular-nums",children:[(m.value/1e3).toFixed(1),"M jobs"]})]})]}),o.jsx(et,{data:l,width:210,height:44,color:"#ff6b81"}),o.jsxs("div",{className:"caption text-soft",children:[s.label," · ",u.length," monthly observations"]})]})}const Fp={...Na,component:Ip};Sa.schema;function $t(e){const t=Math.abs(e),n=e<0?"-":"";return t>=1e12?`${n}$${(t/1e12).toFixed(2)}T`:t>=1e9?`${n}$${(t/1e9).toFixed(1)}B`:t>=1e6?`${n}$${(t/1e6).toFixed(1)}M`:`${n}$${t.toLocaleString("en-US",{maximumFractionDigits:0})}`}function Op({config:e}){const{debt:t,isLoading:n}=Gm(e.trendDays),r=p.useMemo(()=>((t==null?void 0:t.trend)??[]).map(i=>({date:new Date(i.time).toISOString(),value:i.total})),[t==null?void 0:t.trend]);if(n)return o.jsx(A,{loading:!0,children:"loading national debt…"});if(!t)return o.jsx(A,{children:"no debt data"});const s=t.trend[0],a=s?t.total-s.total:null;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"total public debt"}),o.jsxs("div",{className:"body-sm text-normal",children:["as of ",t.date]})]}),o.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsx("div",{className:"font-dmsans text-strong text-5xl font-bold leading-none tabular-nums",children:$t(t.total)}),a!==null&&s&&o.jsxs("div",{className:"text-right",children:[o.jsxs("div",{className:"body-md text-normal font-bold tabular-nums",children:[a>=0?"+":"",$t(a)]}),o.jsxs("div",{className:"caption text-soft",children:["since ",s.date]})]})]}),o.jsx(et,{data:r,width:210,height:42,color:"hsl(var(--zf-accent-hue, 242) 85% 72%)"}),e.showSplit&&o.jsxs("div",{className:"grid grid-cols-2 gap-1.5 border-t border-white/[0.08] pt-2",children:[o.jsxs("div",{className:"rounded bg-white/[0.04] px-2 py-1.5",children:[o.jsx("div",{className:"caption text-soft truncate",children:"Held by public"}),o.jsx("div",{className:"body-sm text-strong font-bold tabular-nums",children:$t(t.heldByPublic)})]}),o.jsxs("div",{className:"rounded bg-white/[0.04] px-2 py-1.5",children:[o.jsx("div",{className:"caption text-soft truncate",children:"Intragovernmental"}),o.jsx("div",{className:"body-sm text-strong font-bold tabular-nums",children:$t(t.intragovernmental)})]})]})]})}const Lp={...Sa,component:Op};ja.schema;function Up({auction:e}){const t=[e.securityTerm,e.securityType].filter(Boolean).join(" ");return o.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 border-b border-white/[0.06] py-1.5 last:border-b-0",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"body-sm text-normal truncate font-semibold",children:t||e.securityType}),o.jsxs("div",{className:"caption text-soft truncate",children:[e.auctionDate,e.bidToCover!==null?` · ${e.bidToCover.toFixed(2)}× bid-to-cover`:""]})]}),o.jsx("div",{className:"font-dmsans text-strong text-lg font-bold tabular-nums",children:e.rate!==null?`${e.rate.toFixed(2)}%`:"—"})]})}function Bp({config:e}){const{auctions:t,isLoading:n}=Zm(e.count);if(n)return o.jsx(A,{loading:!0,children:"loading auctions…"});if(!t.length)return o.jsx(A,{children:"no auction data"});const r=t.slice(0,e.count);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"treasury auctions"}),o.jsx("div",{className:"body-sm text-normal",children:"high yield · bid-to-cover"})]}),o.jsx("div",{className:"caption text-soft text-right",children:"results"})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.map((s,a)=>o.jsx(Up,{auction:s},`${s.auctionDate}-${s.securityType}-${s.securityTerm}-${a}`))})]})}const Hp={...ja,component:Bp};Ma.schema;const ss=1440*60*1e3,Vp=10080*60*1e3;function Zp({data:e,width:t}){return t<44?null:o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("span",{className:"text-[10px] font-medium text-white/90 tabular-nums",children:[(e.rate*100).toFixed(4),"%"]})})}function Gp({config:e}){const t=p.useMemo(()=>Date.now()-Vp,[]),{history:n,isLoading:r}=Ho(e.symbols,t),s=p.useMemo(()=>{const a=[];for(const i of e.symbols){const c=n[i]??[],u=new Map;for(const l of c){const d=Math.floor(l.time/ss)*ss,m=u.get(d)??{sum:0,n:0};m.sum+=l.fundingRate,m.n+=1,u.set(d,m)}for(const[l,{sum:d,n:m}]of u){const h=d/m,w=new Date(l).toLocaleDateString("en-US",{month:"short",day:"numeric"});a.push({id:`${i}-${l}`,row:le(i),column:w,value:h*1e4,rate:h})}}return a},[n,e.symbols]);return r?o.jsx(A,{loading:!0,children:"loading funding…"}):s.length===0?o.jsx(A,{children:"no funding data"}):o.jsx(vh,{data:s,CellComponent:Zp,gap:3,showLabels:!0,rowLabelWidth:48,columnLabelHeight:20})}const Wp={...Ma,component:Gp},Yp={"24h":{ms:1440*60*1e3,timeframe:Ne["24h"]},"7D":{ms:10080*60*1e3,timeframe:Ne["7D"]},"1M":{ms:720*60*60*1e3,timeframe:Ne["1M"]}};ma.schema;function Xp({config:e}){const{ms:t,timeframe:n}=Yp[e.lookback],r=p.useMemo(()=>Date.now()-t,[t]),{history:s,isLoading:a}=Ho(e.symbols,r),i=p.useMemo(()=>e.symbols.map((c,u)=>({id:c,name:le(c),color:Se[u%Se.length],data:(s[c]??[]).map(l=>({date:new Date(l.time).toISOString(),value:l.fundingRate*100}))})),[e.symbols,s]);return o.jsx(sn,{series:i,timeframe:n,height:250,isLoading:a,formatValue:c=>`${c.toFixed(4)}%`})}const Kp={...ma,component:Xp};Ra.schema;function qp({config:e}){return o.jsxs("div",{className:"flex h-full w-full items-end gap-3 pb-2",children:[o.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"h-[5px] w-[5px] shrink-0 rounded-full",style:{background:"var(--color-highlight)",boxShadow:"0 0 8px var(--color-highlight)"}}),o.jsx("h2",{className:"font-dmsans text-strong text-[0.8rem] font-extrabold uppercase leading-none tracking-[0.16em]",children:e.title})]}),e.subtitle&&o.jsx("p",{className:"caption text-soft pl-[13px] leading-none",children:e.subtitle})]}),o.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 Jp={...Ra,component:qp};Ea.schema;function Qp({config:e}){const[t,n]=p.useState("loading");return p.useEffect(()=>n("loading"),[e.url]),t==="error"?o.jsx(A,{children:"image unavailable"}):o.jsxs("div",{className:"relative flex h-full w-full items-center justify-center overflow-hidden rounded-md",children:[t==="loading"&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(A,{loading:!0,children:"loading image..."})}),o.jsx("img",{src:e.url,alt:e.alt,className:`h-full w-full transition-opacity duration-300 ${t==="loaded"?"opacity-100":"opacity-0"}`,style:{objectFit:e.fit},onLoad:()=>n("loaded"),onError:()=>n("error")})]})}const e0={...Ea,component:Qp};wa.schema;const t0="CUUR0000SA0";function os(e,t){return!t||t<=0?null:(e/t-1)*100}function n0({config:e}){const n=new Date().getUTCFullYear(),r=n-2,{series:s,isLoading:a}=$n(t0,r,n),i=p.useMemo(()=>((s==null?void 0:s.points)??[]).slice(-e.months),[e.months,s==null?void 0:s.points]),c=i.at(-1),u=i.at(-2),l=c?i.find(v=>{const f=new Date(v.time),x=new Date(c.time);return f.getUTCFullYear()===x.getUTCFullYear()-1&&f.getUTCMonth()===x.getUTCMonth()}):void 0,d=p.useMemo(()=>i.map(v=>({date:new Date(v.time).toISOString(),value:v.value})),[i]);if(a)return o.jsx(A,{loading:!0,children:"loading CPI…"});if(!s||!c)return o.jsx(A,{children:"no CPI data"});const m=os(c.value,u==null?void 0:u.value),h=os(c.value,l==null?void 0:l.value),w=je(h??m??0);return o.jsxs("div",{className:"flex h-full flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"BLS CPI-U"}),o.jsx("div",{className:"body-sm text-normal",children:c.date})]}),o.jsx("div",{className:"caption text-soft text-right",children:"monthly"})]}),o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"font-dmsans text-5xl font-bold leading-none tabular-nums",style:{color:w,textShadow:`0 0 24px ${w}44`},children:h!==null?qe(h):"--"}),o.jsx("div",{className:"caption text-soft mt-1",children:"year over year"})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"caption text-soft",children:"index"}),o.jsx("div",{className:"body-md text-strong font-bold tabular-nums",children:c.value.toFixed(3)}),o.jsx("div",{className:"caption text-soft mt-2",children:"month over month"}),o.jsx("div",{className:"body-md font-bold tabular-nums",style:{color:je(m??0)},children:m!==null?qe(m):"--"})]})]}),o.jsx(et,{data:d,width:210,height:46,color:w}),o.jsxs("div",{className:"caption text-soft",children:[s.label," · ",i.length," monthly observations"]})]})}const r0={...wa,component:n0},pe=[1,2,3,4,5],s0=[0,1,2,3,4],o0={US:["2026-01-01","2026-01-19","2026-02-16","2026-04-03","2026-05-25","2026-06-19","2026-07-03","2026-09-07","2026-11-26","2026-12-25"],TSX:["2026-01-01","2026-02-16","2026-04-03","2026-05-18","2026-07-01","2026-08-03","2026-09-07","2026-10-12","2026-12-25","2026-12-28"],B3:["2026-01-01","2026-02-16","2026-02-17","2026-04-03","2026-04-21","2026-05-01","2026-06-04","2026-09-07","2026-10-12","2026-11-02","2026-11-20","2026-12-25"],LSE:["2026-01-01","2026-04-03","2026-04-06","2026-05-04","2026-05-25","2026-08-31","2026-12-25","2026-12-28"],XETRA:["2026-01-01","2026-04-03","2026-04-06","2026-05-01","2026-12-24","2026-12-25","2026-12-31"],EURONEXT:["2026-01-01","2026-04-03","2026-04-06","2026-05-01","2026-12-25"],SIX:["2026-01-01","2026-01-02","2026-04-03","2026-04-06","2026-05-01","2026-05-14","2026-05-25","2026-12-24","2026-12-25","2026-12-31"],TSE:["2026-01-01","2026-01-02","2026-01-12","2026-02-11","2026-02-23","2026-03-20","2026-04-29","2026-05-04","2026-05-05","2026-05-06","2026-07-20","2026-08-11","2026-09-21","2026-09-22","2026-09-23","2026-10-12","2026-11-03","2026-11-23","2026-12-31"],HKEX:["2026-01-01","2026-02-17","2026-02-18","2026-02-19","2026-04-03","2026-04-06","2026-05-01","2026-05-25","2026-06-19","2026-07-01","2026-10-01","2026-10-19","2026-12-25"],CN:["2026-01-01","2026-02-16","2026-02-17","2026-02-18","2026-02-19","2026-02-20","2026-02-23","2026-02-24","2026-04-06","2026-05-01","2026-05-04","2026-05-05","2026-06-19","2026-10-01","2026-10-02","2026-10-05","2026-10-06","2026-10-07","2026-10-08"],NSE:["2026-01-26","2026-04-03","2026-05-01","2026-08-15","2026-10-02","2026-12-25"],KRX:["2026-01-01","2026-03-01","2026-05-05","2026-06-06","2026-08-15","2026-10-03","2026-10-09","2026-12-25"],SGX:["2026-01-01","2026-05-01","2026-08-10","2026-12-25"],SET:["2026-01-01","2026-01-02","2026-03-03","2026-04-06","2026-04-13","2026-04-14","2026-04-15","2026-05-01","2026-05-04","2026-06-01","2026-06-03","2026-07-28","2026-07-29","2026-08-12","2026-10-13","2026-10-23","2026-12-07","2026-12-10","2026-12-31"],ASX:["2026-01-01","2026-01-26","2026-04-03","2026-04-06","2026-04-07","2026-04-25","2026-06-08","2026-12-25","2026-12-28"],JSE:["2026-01-01","2026-03-21","2026-04-03","2026-04-06","2026-04-27","2026-05-01","2026-06-16","2026-08-10","2026-09-24","2026-12-16","2026-12-25"],TADAWUL:["2026-09-23"]},a0={NYSE:{code:"NYSE",name:"New York Stock Exchange",city:"New York",country:"US",website:"https://www.nyse.com",mark:"NY",tz:"America/New_York",open:"09:30",close:"16:00",days:pe,region:"Americas",holidayGroup:"US"},NASDAQ:{code:"NASDAQ",name:"Nasdaq",city:"New York",country:"US",website:"https://www.nasdaq.com",mark:"NQ",tz:"America/New_York",open:"09:30",close:"16:00",days:pe,region:"Americas",holidayGroup:"US"},TSX:{code:"TSX",name:"Toronto Stock Exchange",city:"Toronto",country:"CA",website:"https://www.tsx.com",mark:"TX",tz:"America/Toronto",open:"09:30",close:"16:00",days:pe,region:"Americas"},B3:{code:"B3",name:"B3",city:"São Paulo",country:"BR",website:"https://www.b3.com.br/en_us/",mark:"B3",tz:"America/Sao_Paulo",open:"10:00",close:"17:00",days:pe,region:"Americas"},LSE:{code:"LSE",name:"London Stock Exchange",city:"London",country:"GB",website:"https://www.londonstockexchange.com",mark:"LS",tz:"Europe/London",open:"08:00",close:"16:30",days:pe,region:"Europe"},XETRA:{code:"XETRA",name:"Deutsche Börse Xetra",city:"Frankfurt",country:"DE",website:"https://www.boerse-frankfurt.de/en",mark:"DX",tz:"Europe/Berlin",open:"09:00",close:"17:30",days:pe,region:"Europe"},EURONEXT:{code:"EURONEXT",name:"Euronext Paris",city:"Paris",country:"FR",website:"https://www.euronext.com",mark:"EN",tz:"Europe/Paris",open:"09:00",close:"17:30",days:pe,region:"Europe"},SIX:{code:"SIX",name:"SIX Swiss Exchange",city:"Zurich",country:"CH",website:"https://www.six-group.com/en/products-services/the-swiss-stock-exchange.html",mark:"SX",tz:"Europe/Zurich",open:"09:00",close:"17:30",days:pe,region:"Europe"},TSE:{code:"TSE",name:"Tokyo Stock Exchange",city:"Tokyo",country:"JP",website:"https://www.jpx.co.jp/english/",mark:"JP",tz:"Asia/Tokyo",open:"09:00",close:"15:30",days:pe,region:"Asia-Pacific"},HKEX:{code:"HKEX",name:"Hong Kong Exchange",city:"Hong Kong",country:"HK",website:"https://www.hkex.com.hk",mark:"HK",tz:"Asia/Hong_Kong",open:"09:30",close:"16:00",days:pe,region:"Asia-Pacific"},SSE:{code:"SSE",name:"Shanghai Stock Exchange",city:"Shanghai",country:"CN",website:"https://english.sse.com.cn",mark:"SH",tz:"Asia/Shanghai",open:"09:30",close:"15:00",days:pe,region:"Asia-Pacific",holidayGroup:"CN"},NSE:{code:"NSE",name:"National Stock Exchange",city:"Mumbai",country:"IN",website:"https://www.nseindia.com",mark:"NS",tz:"Asia/Kolkata",open:"09:15",close:"15:30",days:pe,region:"Asia-Pacific"},KRX:{code:"KRX",name:"Korea Exchange",city:"Seoul",country:"KR",website:"https://global.krx.co.kr",mark:"KR",tz:"Asia/Seoul",open:"09:00",close:"15:30",days:pe,region:"Asia-Pacific"},SGX:{code:"SGX",name:"Singapore Exchange",city:"Singapore",country:"SG",website:"https://www.sgx.com",mark:"SG",tz:"Asia/Singapore",open:"09:00",close:"17:00",days:pe,region:"Asia-Pacific"},SET:{code:"SET",name:"Stock Exchange of Thailand",city:"Bangkok",country:"TH",website:"https://www.set.or.th/en/home",mark:"SET",tz:"Asia/Bangkok",open:"10:00",close:"16:30",days:pe,region:"Asia-Pacific"},ASX:{code:"ASX",name:"Australian Securities Exchange",city:"Sydney",country:"AU",website:"https://www.asx.com.au",mark:"AS",tz:"Australia/Sydney",open:"10:00",close:"16:00",days:pe,region:"Asia-Pacific"},JSE:{code:"JSE",name:"Johannesburg Stock Exchange",city:"Johannesburg",country:"ZA",website:"https://www.jse.co.za",mark:"JS",tz:"Africa/Johannesburg",open:"09:00",close:"17:00",days:pe,region:"Middle East / Africa"},TADAWUL:{code:"TADAWUL",name:"Saudi Exchange",city:"Riyadh",country:"SA",website:"https://www.saudiexchange.sa",mark:"SA",tz:"Asia/Riyadh",open:"10:00",close:"15:00",days:s0,region:"Middle East / Africa"}},i0=["NYSE","NASDAQ","LSE","XETRA","EURONEXT","TSE","HKEX","SSE","NSE","SET","ASX"],c0={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function as(e,t){const n=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short"}),r={};for(const s of n.formatToParts(e))s.type!=="literal"&&(r[s.type]=s.value);return{ymd:`${r.year}-${r.month}-${r.day}`,dow:c0[r.weekday]??0,minutes:Number(r.hour)*60+Number(r.minute)+Number(r.second)/60}}function is(e){const[t,n]=e.split(":").map(Number);return t*60+n}const l0=864e5,bt=1440;function u0(e,t){const n=o0[e.holidayGroup??e.code]??[],r=is(e.open),s=is(e.close),a=as(t,e.tz),i=(m,h)=>e.days.includes(m)&&!n.includes(h),c={code:e.code,name:e.name,city:e.city,country:e.country,website:e.website,mark:e.mark,tz:e.tz,open:e.open,close:e.close,region:e.region};if(i(a.dow,a.ymd)&&a.minutes>=r&&a.minutes<s)return{...c,status:"open",nextChangeMin:s-a.minutes};let l;if(i(a.dow,a.ymd)&&a.minutes<r)l=r-a.minutes;else{l=bt-a.minutes+r;let m=!1;for(let h=1;h<=10;h++){const g=as(new Date(t.getTime()+h*l0),e.tz);if(i(g.dow,g.ymd)){l=bt-a.minutes+(h-1)*bt+r,m=!0;break}}m||(l=-1)}const d=e.days.includes(a.dow)&&n.includes(a.ymd);return{...c,status:d?"holiday":"closed",nextChangeMin:l}}const cs=["Americas","Europe","Asia-Pacific","Middle East / Africa"],ls={open:0,holiday:1,closed:2};function d0(e,t){const n=[...e];return t==="name"?n.sort((r,s)=>r.name.localeCompare(s.name)):t==="status"?n.sort((r,s)=>ls[r.status]-ls[s.status]||r.nextChangeMin-s.nextChangeMin):n.sort((r,s)=>cs.indexOf(r.region)-cs.indexOf(s.region)),n}function m0(e){if(e<0)return"—";if(e<1)return"<1m";const t=Math.floor(e),n=Math.floor(t/bt),r=Math.floor(t%bt/60),s=t%60;return n>0?`${n}d ${r}h`:r>0?`${r}h ${s}m`:`${s}m`}ua.schema;const mi={open:{color:"#34e2a3",chipBg:"rgba(52, 226, 163, 0.13)",label:"Open",verb:"closes",rail:"#34e2a3",railOpacity:1,wash:"linear-gradient(90deg, rgba(52, 226, 163, 0.08), transparent 40%)"},closed:{color:"#8b92a1",chipBg:"rgba(255, 255, 255, 0.045)",label:"Closed",verb:"opens",rail:"rgba(255, 255, 255, 0.22)",railOpacity:.55,wash:"none"},holiday:{color:"#f2b066",chipBg:"rgba(242, 176, 102, 0.13)",label:"Holiday",verb:"opens",rail:"#f2b066",railOpacity:1,wash:"linear-gradient(90deg, rgba(242, 176, 102, 0.07), transparent 40%)"}};function f0(){return o.jsxs("svg",{"aria-hidden":"true",className:"shrink-0",fill:"none",height:"15",viewBox:"0 0 20 20",width:"15",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7.25",stroke:"currentColor",strokeOpacity:"0.75",strokeWidth:"1.5"}),o.jsx("path",{d:"M2.75 10h14.5M10 2.75c2 2 3 4.42 3 7.25s-1 5.25-3 7.25M10 2.75c-2 2-3 4.42-3 7.25s1 5.25 3 7.25",stroke:"currentColor",strokeLinecap:"round",strokeOpacity:"0.55",strokeWidth:"1.2"}),o.jsx("path",{d:"m5.25 12.75 2.6-2.3 2.1 1.55 3.95-4.8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})]})}function h0(e,t){try{return new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"2-digit",minute:"2-digit",hour12:!1,timeZoneName:"short"}).format(e)}catch{return t}}function p0(e){return/^[A-Z]{2}$/i.test(e)?[...e.toUpperCase()].map(t=>String.fromCodePoint(127462+t.charCodeAt(0)-65)).join(""):e}function g0(){return o.jsxs("svg",{"aria-hidden":"true",className:"opacity-50 transition group-hover:translate-x-0.5 group-hover:-translate-y-0.5 group-hover:opacity-95",fill:"none",height:"12",viewBox:"0 0 16 16",width:"12",children:[o.jsx("path",{d:"M6 4.5H4.5a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h5a2 2 0 0 0 2-2V10",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.5"}),o.jsx("path",{d:"M9 2.5h4.5V7M8.25 7.75l5-5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})]})}function x0({state:e}){return o.jsx("span",{"aria-hidden":"true",className:"grid h-[30px] w-[30px] shrink-0 place-items-center overflow-hidden rounded-[9px] border border-white/10 shadow-[inset_0_1px_0_rgba(255,255,255,0.12),0_4px_10px_-7px_rgba(0,0,0,0.8)]",style:{background:"linear-gradient(150deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02) 48%, rgba(0,0,0,0.22))"},children:o.jsx("span",{className:"text-[1.15rem] leading-none drop-shadow-[0_1px_3px_rgba(0,0,0,0.5)]",children:p0(e.country)})})}function b0({state:e}){const t=mi[e.status],n=e.status==="closed";return o.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border px-2 py-[3px] font-dmsans text-[0.5rem] font-bold uppercase leading-none tracking-[0.09em]",style:{borderColor:n?"rgba(255,255,255,0.1)":`${t.color}33`,background:t.chipBg,color:n?"rgba(255,255,255,0.62)":t.color},children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:n?"rgba(255,255,255,0.45)":t.color,boxShadow:e.status==="open"?`0 0 6px ${t.color}`:void 0}}),t.label]})}function v0({now:e,state:t}){const n=mi[t.status],r=m0(t.nextChangeMin),s=h0(e,t.tz);return o.jsxs("a",{"aria-label":`${t.name} website`,className:"group relative grid min-h-[42px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 overflow-hidden rounded-xl border border-white/[0.06] bg-white/[0.022] py-1.5 pr-2.5 pl-3 text-white/90 transition duration-200 hover:-translate-y-px hover:border-white/[0.14] hover:bg-white/[0.05] hover:text-white focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white/50",href:t.website,rel:"noreferrer",style:{backgroundImage:n.wash},target:"_blank",title:`${t.name} · ${t.city} · ${t.open}-${t.close}`,children:[o.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-[5px] left-0 w-[3px] rounded-r-full",style:{background:n.rail,opacity:n.railOpacity}}),o.jsx(x0,{state:t}),o.jsxs("span",{className:"relative min-w-0 pl-0.5",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx("span",{className:"truncate font-dmsans text-[0.78rem] font-bold leading-[1.05rem] text-white",children:t.name}),o.jsx(g0,{})]}),o.jsxs("span",{className:"text-soft flex min-w-0 items-center gap-1.5 font-dmsans text-[0.66rem] leading-[0.85rem] tabular-nums",children:[o.jsx("span",{className:"truncate",children:t.city}),o.jsx("span",{className:"h-[3px] w-[3px] shrink-0 rounded-full bg-white/25"}),o.jsx("span",{className:"shrink-0",children:s})]})]}),o.jsxs("span",{className:"relative flex min-w-[84px] flex-col items-end gap-1",children:[o.jsx(b0,{state:t}),o.jsxs("span",{className:"whitespace-nowrap text-right font-dmsans text-[0.66rem] leading-[0.8rem] tabular-nums",style:{color:t.status==="closed"?"rgba(255,255,255,0.55)":n.color},children:[n.verb," ",r]})]})]})}function y0({config:e}){const[t,n]=p.useState(()=>new Date);p.useEffect(()=>{const c=window.setInterval(()=>n(new Date),3e4);return()=>window.clearInterval(c)},[]);const r=e.exchanges.length?e.exchanges:i0,s=r.join(","),a=p.useMemo(()=>{const c=r.map(u=>a0[u.toUpperCase()]).filter(u=>!!u).map(u=>u0(u,t));return d0(c,e.sort)},[s,t,e.sort]);if(a.length===0)return o.jsx(A,{children:"no known exchanges — check the codes"});const i=a.filter(c=>c.status==="open").length;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[o.jsxs("div",{className:"caption text-soft mb-2 flex items-center justify-between gap-3 uppercase tracking-wide",children:[o.jsx("span",{className:"truncate",children:"exchange sessions"}),o.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1.5 rounded-full border border-white/[0.08] bg-white/[0.045] px-2 py-0.5 tabular-nums",children:[i>0&&o.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{background:"#34e2a3",boxShadow:"0 0 6px #34e2a3"}}),o.jsx("span",{className:"font-bold text-white",children:i}),o.jsxs("span",{className:"text-soft",children:["/ ",a.length," open"]})]})]}),o.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-1 overflow-auto pr-0.5",children:a.map(c=>o.jsx(v0,{now:t,state:c},c.code))})]})}const w0={...ua,component:y0,titleIcon:f0};Da.schema;const k0={coindesk:"CoinDesk",cointelegraph:"Cointelegraph",decrypt:"Decrypt",cnbc:"CNBC Markets",nasdaq:"Nasdaq",stocks:"Google News"};function S0({src:e}){const[t,n]=p.useState(!1);return t?null:o.jsx("img",{src:e,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",onError:()=>n(!0),className:"size-12 shrink-0 rounded-md bg-white/[0.04] object-cover ring-1 ring-white/10"})}function N0({item:e}){return o.jsxs("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",className:"group relative flex min-w-0 items-start gap-3 border-b border-white/[0.06] py-2 pl-3 no-underline transition-colors last:border-b-0 before:absolute before:bottom-1.5 before:left-0 before:top-1.5 before:w-0.5 before:rounded-full before:bg-highlight before:opacity-0 before:transition-opacity hover:bg-white/[0.03] group-hover:before:opacity-100 hover:before:opacity-100",children:[e.imageUrl&&o.jsx(S0,{src:e.imageUrl}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"body-sm text-normal line-clamp-2 block font-medium leading-snug transition-colors group-hover:text-white",children:e.title}),e.summary&&o.jsx("span",{className:"caption text-soft mt-1 line-clamp-2 block leading-relaxed",children:e.summary})]}),o.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 pt-px",children:[e.publishedAt!==void 0&&o.jsx("span",{className:"caption text-soft tabular-nums",children:ci(e.publishedAt)}),o.jsx("span",{className:"caption text-highlight/70 -mr-0.5 w-2 opacity-0 transition-opacity group-hover:opacity-100",children:"↗"})]})]})}function j0({config:e}){var c;const t=e.source==="stocks",n=t&&e.symbols.length===0,r=n?"":e.source,{items:s,isLoading:a}=qm(r,t?e.symbols:void 0,e.count);if(n)return o.jsx(A,{children:"add stock symbols to show company headlines"});if(a)return o.jsx(A,{loading:!0,children:"loading headlines…"});const i=((c=s[0])==null?void 0:c.source)??k0[e.source]??"news";return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("span",{className:"caption text-soft truncate",children:i}),o.jsx("span",{className:"caption text-soft shrink-0",children:"headlines"})]}),o.jsx("div",{className:on,children:s.length>0?s.map(u=>o.jsx(N0,{item:u},u.url)):o.jsxs("div",{className:"body-sm text-soft flex h-full items-center justify-center text-center",children:["no headlines ",t?"for these symbols":"available"," — the runtime proxy may be offline"]})})]})}const _0={...Da,component:j0};fa.schema;function C0({config:e}){const t=cf(),[n,r]=p.useState(!1),[s,a]=p.useState(e.text),i=p.useRef(null);p.useEffect(()=>{a(e.text)},[e.text]),p.useEffect(()=>{var l;n&&((l=i.current)==null||l.focus())},[n]);const c=p.useCallback(()=>{s!==e.text&&(t==null||t({text:s})),r(!1)},[t,s,e.text]),u=e.align==="center"?"flex items-center justify-center text-center":"";return n?o.jsx("textarea",{ref:i,className:`body-md text-normal h-full w-full resize-none bg-transparent outline-none placeholder:text-white/30 ${u}`,value:s,onChange:l=>a(l.target.value),onBlur:c,onKeyDown:l=>{l.key==="Escape"&&(a(e.text),r(!1))},placeholder:"Write a note…"}):o.jsx("div",{className:`body-md text-normal h-full overflow-auto whitespace-pre-wrap ${u} ${t?"cursor-text":""}`,onClick:()=>t&&r(!0),title:t?"Click to edit":void 0,children:e.text||o.jsx("span",{className:"text-soft italic",children:t?"Click to add a note…":"New note"})})}const T0={...fa,component:C0},bn={"1m":6e4,"5m":5*6e4,"15m":15*6e4,"1h":60*6e4,"4h":240*6e4,"1d":1440*6e4},us=60,z0={top:12,right:56,bottom:28,left:12};ha.schema;function M0({config:e}){const t=bn[e.interval],n=p.useMemo(()=>Date.now()-t*us,[t]),{candles:r,isLoading:s}=zm(e.symbol,e.interval,n,Math.min(t,6e4)),i=tr([e.symbol])[e.symbol],[c,u]=p.useState([]);p.useEffect(()=>{i!==void 0&&u(v=>{const f=[...v,{time:Date.now()/1e3,value:i}];return f.length>900?f.slice(-600):f})},[i]),p.useEffect(()=>u([]),[e.symbol]);const l=p.useMemo(()=>r.slice(0,-1).map(v=>({time:v.time/1e3,open:v.open,high:v.high,low:v.low,close:v.close})),[r]),d=r[r.length-1],m=p.useMemo(()=>{if(!d)return;const v=i??d.close;return{time:d.time/1e3,open:d.open,high:Math.max(d.high,v),low:Math.min(d.low,v),close:v}},[d,i]),h=i??(d==null?void 0:d.close)??0,g=p.useMemo(()=>t>=bn["1d"]?v=>new Date(v*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric"}):t>=bn["1h"]?v=>{const f=new Date(v*1e3);return`${f.toLocaleDateString("en-US",{month:"short",day:"numeric"})} ${String(f.getHours()).padStart(2,"0")}h`}:v=>new Date(v*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),[t]),w=p.useMemo(()=>{const v=r.map(x=>({time:x.time/1e3,value:x.close}));if(c.length===0)return v;const f=c[0].time;return[...v.filter(x=>x.time<f),...c]},[r,c]);return s&&r.length===0?o.jsx(A,{loading:!0,children:"loading chart..."}):o.jsx("div",{className:"h-full min-h-0",children:o.jsx(Hs,{mode:e.mode,data:w,value:h,candles:l,candleWidth:t/1e3,liveCandle:m,window:t/1e3*us,color:e.color,theme:"dark",loading:s,formatValue:v=>Oe(v),formatTime:g,padding:z0,showValue:!0,fill:!0,pulse:!0})})}const E0={...ha,component:M0,titleIcon:({config:e})=>o.jsx(Le,{symbol:e.symbol,size:14})},R0={"24h":{ms:1440*60*1e3,interval:"15m",timeframe:Ne["24h"]},"7D":{ms:10080*60*1e3,interval:"1h",timeframe:Ne["7D"]},"1M":{ms:720*60*60*1e3,interval:"4h",timeframe:Ne["1M"]}};Pa.schema;function A0({config:e}){const{ms:t,interval:n,timeframe:r}=R0[e.lookback],s=p.useMemo(()=>Date.now()-t,[t]),{candles:a,isLoading:i}=Mm(e.symbols,n,s),c=p.useMemo(()=>e.symbols.map((u,l)=>{var h;const d=a[u]??[],m=(h=d[0])==null?void 0:h.close;return{id:u,name:le(u),iconImageUrl:Wo(u),color:Se[l%Se.length],data:d.map(g=>({date:new Date(g.time).toISOString(),value:e.normalize&&m?(g.close/m-1)*100:g.close}))}}),[e.symbols,e.normalize,a]);return o.jsx(sn,{series:c,timeframe:r,height:250,isLoading:i,formatValue:e.normalize?u=>`${u>=0?"+":""}${u.toFixed(1)}%`:u=>Oe(u)})}const P0={...Pa,component:A0},ds=720,$0=1e3,fi=3,D0={top:12,right:58,bottom:28,left:8};pa.schema;function hi(e){return e!==void 0&&Number.isFinite(e)}function I0(e,t,n,r){let s=!1;const a={...e};for(const i of t){const c=n[i];if(!hi(c))continue;const u=a[i]??[],l=u[u.length-1];if(l&&Math.abs(r-l.time)<.5&&l.value===c)continue;const d=u.length===0?[{time:r-fi,value:c},{time:r,value:c}]:[...u,{time:r,value:c}];a[i]=d.length>ds?d.slice(-ds):d,s=!0}return s?a:e}function ms(e,t){return t===0?0:(e/t-1)*100}function F0(e){const t=Math.abs(e)>=10?1:2;return`${e>=0?"+":""}${e.toFixed(t)}%`}function O0({config:e}){const t=e.symbols,n=t.join("|"),r=tr(t),s=Pn(t),[a,i]=p.useState({}),[c,u]=p.useState(()=>new Set),l=p.useMemo(()=>{var x;const f={};for(const y of t){const S=r[y]??((x=s[y])==null?void 0:x.markPx);hi(S)&&(f[y]=S)}return f},[r,s,t]),d=p.useRef(l);p.useEffect(()=>{d.current=l},[l]),p.useEffect(()=>{const f=new Set(t);i(x=>{let y=!1;const S={};for(const[k,T]of Object.entries(x)){if(!f.has(k)){y=!0;continue}S[k]=T}return y?S:x}),u(x=>{const y=new Set([...x].filter(S=>f.has(S)));return y.size===x.size?x:y})},[n,t]);const m=p.useCallback(f=>{u(x=>{const y=new Set(x);return y.has(f)?(y.delete(f),y):t.length-y.size<=1?x:(y.add(f),y)})},[t]),h=p.useCallback(()=>{const f=d.current;if(Object.keys(f).length===0)return;const x=Date.now()/1e3;i(y=>I0(y,t,f,x))},[n,t]);p.useEffect(()=>{h()},[h,l]),p.useEffect(()=>{const f=window.setInterval(h,$0);return()=>window.clearInterval(f)},[h]);const g=p.useMemo(()=>t.flatMap((f,x)=>{var T,N;if(c.has(f))return[];const y=a[f]??[],S=(T=y[0])==null?void 0:T.value;if(!S||y.length===0)return[];const k=e.normalize?y.map(j=>({time:j.time,value:ms(j.value,S)})):y;return[{id:f,label:le(f),color:Se[x%Se.length],data:k,value:((N=k[k.length-1])==null?void 0:N.value)??0}]}),[a,c,t,e.normalize]),w=p.useMemo(()=>{var S,k;let f=1/0,x=-1/0;for(const T of t){const N=a[T]??[];N.length!==0&&(f=Math.min(f,((S=N[0])==null?void 0:S.time)??1/0),x=Math.max(x,((k=N[N.length-1])==null?void 0:k.time)??-1/0))}const y=Number.isFinite(f)&&Number.isFinite(x)?x-f:0;return Math.min(e.windowSec,Math.max(fi,Math.ceil(y)))},[a,t,e.windowSec]),v=g.some(f=>f.data.length>1);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.jsx("div",{className:"grid flex-none grid-cols-1 gap-x-3 gap-y-1.5 border-b border-white/[0.06] pb-2 sm:grid-cols-2",children:t.map((f,x)=>{var j,b;const y=l[f],S=(b=(j=a[f])==null?void 0:j[0])==null?void 0:b.value,k=y!==void 0&&S?ms(y,S):void 0,T=Se[x%Se.length],N=c.has(f);return o.jsxs("button",{type:"button","aria-pressed":!N,title:`${N?"Show":"Hide"} ${le(f)}`,className:`grid min-w-0 grid-cols-[auto_auto_minmax(0,1fr)_auto] items-center gap-1.5 rounded-md px-1.5 py-0.5 text-left text-[10px] leading-4 transition ${N?"opacity-40 hover:opacity-70":"bg-white/[0.035] opacity-100 hover:bg-white/[0.06]"}`,onClick:_=>{_.stopPropagation(),m(f)},onPointerDown:_=>_.stopPropagation(),children:[o.jsx("span",{className:"h-1.5 w-1.5 rounded-full",style:{backgroundColor:T}}),o.jsx(Le,{symbol:f,size:14}),o.jsx("span",{className:"truncate font-semibold text-white/75",children:le(f)}),o.jsxs("span",{className:"tabular-nums text-white/85",children:[y!==void 0?Oe(y):"…",k!==void 0?o.jsx("span",{className:"ml-1 tabular-nums",style:{color:je(k)},children:qe(k)}):null]})]},f)})}),o.jsx("div",{className:"min-h-0 flex-1 [&>div[style*='align-items']]:!hidden",children:o.jsx(Hs,{data:[],value:0,series:g,theme:"dark",window:w,grid:!0,loading:!v,scrub:!1,badge:!1,formatValue:e.normalize?F0:Oe,padding:D0,seriesToggleCompact:t.length>4,style:{width:"100%",height:"100%"}})})]})}const L0={...pa,component:O0};ga.schema;function U0({config:e}){const{mids:t,isLoading:n}=er(e.symbols),{stats:r,isLoading:s}=nr(e.symbols),a=e.symbols.some(i=>{var c;return t[i]!==void 0||((c=r[i])==null?void 0:c.markPx)!==void 0});return(n||s)&&!a?o.jsx(A,{loading:!0,children:"loading prices..."}):o.jsx("div",{className:"flex flex-col gap-1.5 overflow-auto",children:e.symbols.map(i=>{var l,d;const c=t[i]??((l=r[i])==null?void 0:l.markPx),u=(d=r[i])==null?void 0:d.changePct;return o.jsxs("div",{className:"body-sm grid grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-3",children:[o.jsx(Le,{symbol:i,size:18}),o.jsx("span",{className:"truncate font-semibold text-white",title:le(i),children:le(i)}),o.jsx("span",{className:"tabular-nums",children:c!==void 0?Oe(c):"—"}),o.jsx("span",{className:"min-w-[64px] text-right tabular-nums",style:{color:u!==void 0?je(u):void 0,opacity:u!==void 0?1:.4},children:u!==void 0?qe(u):"…"})]},i)})})}const B0={...ga,component:U0};ya.schema;function Vt(e){return`${e.toFixed(2)}%`}function H0({label:e,value:t,meta:n}){return o.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 border-b border-white/[0.06] py-1.5 last:border-b-0",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"body-sm text-normal truncate font-semibold",children:e}),o.jsx("div",{className:"caption text-soft truncate",children:n})]}),o.jsx("div",{className:"font-dmsans text-strong text-lg font-bold tabular-nums",children:Vt(t)})]})}function V0({config:e}){var l,d;const{rates:t,isLoading:n}=Bm(),{rates:r,isLoading:s}=Hm();if(n&&s)return o.jsx(A,{loading:!0,children:"loading official rates…"});if(!t.length&&!r.length)return o.jsx(A,{children:"no rates data"});const a=t.slice(0,e.maxReferenceRates),i=r.slice(0,e.maxTreasuryRates),c=(l=a[0])==null?void 0:l.date,u=(d=i[0])==null?void 0:d.date;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"official rates"}),o.jsx("div",{className:"body-sm text-normal",children:c?`as of ${c}`:"reference rates"})]}),o.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:a.map(m=>{const h=m.targetRateFrom!==void 0&&m.targetRateTo!==void 0?`target ${Vt(m.targetRateFrom)}-${Vt(m.targetRateTo)}`:m.volumeInBillions!==void 0?`$${m.volumeInBillions.toFixed(0)}B volume`:m.source;return o.jsx(H0,{label:m.label,value:m.rate,meta:h},m.code)})}),e.showTreasuryAverageRates&&i.length>0&&o.jsxs("div",{className:"border-t border-white/[0.08] pt-2",children:[o.jsxs("div",{className:"caption text-soft mb-1 flex justify-between",children:[o.jsx("span",{children:"Treasury average rates"}),o.jsx("span",{children:u})]}),o.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:i.map(m=>o.jsxs("div",{className:"rounded bg-white/[0.04] px-2 py-1.5",children:[o.jsx("div",{className:"caption text-soft truncate",children:m.security}),o.jsx("div",{className:"body-sm text-strong font-bold tabular-nums",children:Vt(m.rate)})]},`${m.date}-${m.security}`))})]})]})}const Z0={...ya,component:V0};za.schema;function fs(e){return e>=1e9?`${(e/1e9).toFixed(2)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:`${Math.round(e)}`}const hs=(e=1)=>`hsl(var(--zf-accent-hue, 242) 85% 68% / ${e})`;function G0({symbol:e,entry:t}){const n=e.includes(":")?e:`xyz:${t.symbol}`,r=Math.max(0,Math.min(100,t.shortPct));return o.jsxs("div",{className:"flex min-w-0 items-center gap-3 border-b border-white/[0.06] py-2 last:border-b-0",children:[o.jsx(Le,{symbol:n,size:20}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[o.jsx("span",{className:"body-sm text-strong truncate font-semibold",children:t.symbol}),o.jsxs("span",{className:"font-dmsans text-strong text-sm font-bold tabular-nums",children:[r.toFixed(1),"%"]})]}),o.jsx("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-white/[0.07]",children:o.jsx("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:hs(.85),boxShadow:`0 0 8px ${hs(.5)}`}})}),o.jsxs("div",{className:"caption text-soft mt-1 tabular-nums",children:["short ",fs(t.shortVolume)," / ",fs(t.totalVolume)]})]})]})}function W0({config:e}){const{data:t,isLoading:n}=Km(e.symbols),r=p.useMemo(()=>{const a=e.symbols.map(i=>({symbol:i,entry:t[i]})).filter(i=>!!i.entry);return a.sort((i,c)=>e.sort==="symbol"?i.entry.symbol.localeCompare(c.entry.symbol):e.sort==="volume"?c.entry.totalVolume-i.entry.totalVolume:c.entry.shortPct-i.entry.shortPct),a},[t,e.symbols,e.sort]);if(n)return o.jsx(A,{loading:!0,children:"loading short volume…"});if(r.length===0)return o.jsx(A,{children:"no FINRA short-volume data"});const s=r[0].entry.date;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"short volume"}),o.jsx("div",{className:"body-sm text-normal",children:s?`FINRA · ${s}`:"FINRA"})]}),o.jsxs("div",{className:"caption text-soft text-right",children:["reported volume",o.jsx("br",{}),"not short interest"]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:r.map(({symbol:a,entry:i})=>o.jsx(G0,{symbol:a,entry:i},a))})]})}const Y0={...za,component:W0};xa.schema;const X0=["xyz:*","km:GOLD","km:SILVER","km:USOIL","km:USENERGY","km:US500","km:SMALL2000","km:USTECH","km:SEMI","km:GLDMINE"];function ps({symbol:e,markPx:t,changePct:n}){return o.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-2",title:`${le(e)} · ${Oe(t)}`,children:[o.jsx(Le,{symbol:e,size:16}),o.jsx("span",{className:"body-sm truncate font-bold text-white",children:le(e)}),o.jsx("span",{className:"caption text-soft text-right tabular-nums",children:Oe(t)}),o.jsx("span",{className:"caption text-right font-bold tabular-nums",style:{color:je(n)},children:qe(n)})]})}function K0({config:e}){const{stats:t,isLoading:n}=nr(X0,6e4),{gainers:r,losers:s}=p.useMemo(()=>{const a=Object.entries(t).map(([i,c])=>({symbol:i,...c})).filter(i=>i.symbol.includes(":")&&i.markPx>0&&i.prevDayPx>0).sort((i,c)=>c.changePct-i.changePct);return{gainers:a.slice(0,e.count),losers:a.slice(-e.count).reverse()}},[t,e.count]);return n?o.jsx(A,{loading:!0,children:"loading movers..."}):r.length===0?o.jsx(A,{children:"no mover data yet"}):o.jsxs("div",{className:"grid h-full grid-cols-2 gap-x-4 overflow-hidden",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("div",{className:"caption text-soft uppercase tracking-wide",children:"gainers"}),r.map(a=>o.jsx(ps,{...a},a.symbol))]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx("div",{className:"caption text-soft uppercase tracking-wide",children:"losers"}),s.map(a=>o.jsx(ps,{...a},a.symbol))]})]})}const q0={...xa,component:K0};ba.schema;function J0({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · $${fe(n.tvl)}`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/70",children:["$",fe(n.tvl)]})]})}function Q0({config:e}){const{entries:t,isLoading:n}=Em(),r=p.useMemo(()=>t.slice(0,e.topN).map(s=>({id:s.name,value:s.tvl,tvl:s.tvl})),[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading TVL…"}):r.length===0?o.jsx(A,{children:"no TVL data"}):o.jsx(lt,{data:r,LeafComponent:J0,getColorValue:s=>s.tvl})}const eg={...ba,component:Q0};Ca.schema;const gs=(e=1)=>`hsl(var(--zf-accent-hue, 242) 85% 68% / ${e})`;function tg({rates:e}){const t=Math.min(...e),n=Math.max(...e),r=Math.max(.01,n-t),s=e.length,a=u=>100*u/(s-1),i=u=>4+32*(1-(u-t)/r),c=e.map((u,l)=>`${l?"L":"M"}${a(l).toFixed(2)},${i(u).toFixed(2)}`).join(" ");return o.jsxs("svg",{viewBox:"0 0 100 40",preserveAspectRatio:"none",className:"h-20 w-full","aria-hidden":!0,children:[o.jsx("path",{d:`${c} L100,40 L0,40 Z`,fill:gs(.14)}),o.jsx("path",{d:c,fill:"none",stroke:gs(.9),strokeWidth:1.5,vectorEffect:"non-scaling-stroke",strokeLinejoin:"round"})]})}function ng({config:e}){const{curve:t,isLoading:n}=Vm();if(n)return o.jsx(A,{loading:!0,children:"loading yield curve…"});if(!t||t.points.length<2)return o.jsx(A,{children:"no yield-curve data"});const r=l=>{var d;return(d=t.points.find(m=>m.label===l))==null?void 0:d.rate},s=r("2Y"),a=r("10Y"),i=s!=null&&a!=null?Math.round((a-s)*100):null,c=i!=null&&i<0,u=e.maturities;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"Treasury yield curve"}),o.jsxs("div",{className:"body-sm text-normal",children:["U.S. Treasury · ",t.date]})]}),o.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),i!=null&&o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsxs("span",{className:"font-dmsans text-2xl font-bold leading-none tabular-nums",style:{color:je(i),textShadow:`0 0 24px ${je(i)}44`},children:[i>=0?"+":"",i," bps"]}),o.jsxs("span",{className:"caption text-soft",children:["2s10s · ",c?"inverted":"normal"]})]}),o.jsx(tg,{rates:t.points.map(l=>l.rate)}),o.jsx("div",{className:"grid gap-1",style:{gridTemplateColumns:`repeat(${u.length}, minmax(0, 1fr))`},children:u.map(l=>{const d=r(l);return o.jsxs("div",{className:"rounded bg-white/[0.04] px-1.5 py-1 text-center",children:[o.jsx("div",{className:"caption text-soft",children:l}),o.jsx("div",{className:"body-sm text-strong font-bold tabular-nums",children:d!=null?`${d.toFixed(2)}%`:"—"})]},l)})})]})}const rg={...Ca,component:ng};Ia.schema;function sg({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · $${fe(n.volume24h)} 24h volume`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/70",children:["$",fe(n.volume24h)]})]})}function og({config:e}){const{entries:t,isLoading:n}=Rm(),r=p.useMemo(()=>t.slice(0,e.topN).map(s=>({id:s.name,value:s.volume24h,volume24h:s.volume24h,changePct:s.changePct??0})),[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading DEX volume…"}):r.length===0?o.jsx(A,{children:"no DEX volume data"}):o.jsx(lt,{data:r,LeafComponent:sg,getColorValue:s=>s.changePct})}const ag={...Ia,component:og},ig={"7D":{ms:10080*60*1e3,timeframe:Ne["7D"]},"1M":{ms:720*60*60*1e3,timeframe:Ne["1M"]},"3M":{ms:2160*60*60*1e3,timeframe:Ne["3M"]}};Fa.schema;function cg({config:e}){const{ms:t,timeframe:n}=ig[e.lookback],r=p.useMemo(()=>Date.now()-t,[t]),{history:s,isLoading:a}=Am(e.protocols),i=p.useMemo(()=>e.protocols.map((c,u)=>({id:c,name:c,color:Se[u%Se.length],data:(s[c]??[]).filter(l=>l.time>=r).map(l=>({date:new Date(l.time).toISOString(),value:l.value}))})),[e.protocols,s,r]);return o.jsx(sn,{series:i,timeframe:n,height:250,isLoading:a,formatValue:c=>`$${fe(c)}`})}const lg={...Fa,component:cg};Oa.schema;function ug({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · $${fe(n.tvl)} TVL`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/70",children:["$",fe(n.tvl)]})]})}function dg({config:e}){const{entries:t,isLoading:n}=Pm(),r=p.useMemo(()=>t.slice(0,e.topN).map(s=>({id:s.name,value:s.tvl,tvl:s.tvl,changePct:s.changePct??0})),[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading protocol TVL…"}):r.length===0?o.jsx(A,{children:"no protocol TVL data"}):o.jsx(lt,{data:r,LeafComponent:ug,getColorValue:s=>s.changePct})}const mg={...Oa,component:dg},fg={"7D":{ms:10080*60*1e3,timeframe:Ne["7D"]},"1M":{ms:720*60*60*1e3,timeframe:Ne["1M"]},"3M":{ms:2160*60*60*1e3,timeframe:Ne["3M"]}};La.schema;function hg({config:e}){const{ms:t,timeframe:n}=fg[e.lookback],r=p.useMemo(()=>Date.now()-t,[t]),{history:s,isLoading:a}=$m(e.protocols),i=p.useMemo(()=>e.protocols.map((c,u)=>({id:c,name:c,color:Se[u%Se.length],data:(s[c]??[]).filter(l=>l.time>=r).map(l=>({date:new Date(l.time).toISOString(),value:l.value}))})),[e.protocols,s,r]);return o.jsx(sn,{series:i,timeframe:n,height:250,isLoading:a,formatValue:c=>`$${fe(c)}`})}const pg={...La,component:hg};Ua.schema;function gg({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · $${fe(n.fees24h)} 24h fees`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/70",children:["$",fe(n.fees24h)]})]})}function xg({config:e}){const{entries:t,isLoading:n}=Dm(),r=p.useMemo(()=>t.slice(0,e.topN).map(s=>({id:s.name,value:s.fees24h,fees24h:s.fees24h,changePct:s.changePct??0})),[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading protocol fees…"}):r.length===0?o.jsx(A,{children:"no protocol fee data"}):o.jsx(lt,{data:r,LeafComponent:gg,getColorValue:s=>s.changePct})}const bg={...Ua,component:xg};Ba.schema;function vg({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44,s=n.changePct24h;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · $${fe(n.marketCapUsd)} mcap · ${s>=0?"+":""}${s.toFixed(2)}%`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/80",children:[s>=0?"+":"",s.toFixed(1),"%"]})]})}function yg({config:e}){const{entries:t,isLoading:n}=Im(),r=p.useMemo(()=>t.slice(0,e.topN).map(s=>({id:s.symbol,value:s.marketCapUsd,marketCapUsd:s.marketCapUsd,changePct24h:s.changePct24h??0})),[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading market caps…"}):r.length===0?o.jsx(A,{children:"no market data"}):o.jsx(lt,{data:r,LeafComponent:vg,getColorValue:s=>s.changePct24h})}const wg={...Ba,component:yg};Ha.schema;const kg=25;function Sg({config:e}){const{entries:t,isLoading:n}=Om(e.symbols),r=p.useMemo(()=>t.slice(0,kg),[t]),s=p.useMemo(()=>r.reduce((a,i)=>Math.max(a,i.openInterestUsd),0),[r]);return n?o.jsx(A,{loading:!0,children:"loading open interest…"}):r.length===0?o.jsx(A,{children:"no open-interest data"}):o.jsx("div",{className:"flex h-full flex-col gap-1.5 overflow-y-auto",children:r.map(a=>o.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2",title:`${a.symbol} · $${fe(a.openInterestUsd)} open interest`,children:[o.jsx(Le,{symbol:a.symbol,size:16}),o.jsxs("div",{className:"relative h-4 w-full overflow-hidden rounded-sm bg-white/[0.06]",children:[o.jsx("div",{className:"absolute inset-y-0 left-0 rounded-sm",style:{width:`${s>0?a.openInterestUsd/s*100:0}%`,background:"hsl(var(--zf-accent-hue, 242) 85% 65% / 0.5)"}}),o.jsx("span",{className:"absolute inset-y-0 left-1.5 flex items-center",children:o.jsx("span",{className:"body-sm truncate font-bold text-white",children:le(a.symbol)})})]}),o.jsxs("span",{className:"caption text-soft text-right tabular-nums",children:["$",fe(a.openInterestUsd)]})]},a.symbol))})}const Ng={...Ha,component:Sg},Ze=18,jg=14,_g=0,Pe={snake:"hsla(246, 100%, 70%, 0.92)",snakeHead:"rgba(255, 255, 255, 0.95)",food:"hsla(347, 100%, 62%, 1)",text:"rgba(255, 255, 255, 0.85)",textSoft:"rgba(255, 255, 255, 0.6)",score:"hsla(246, 100%, 70%, 1)",gameOver:"hsla(347, 100%, 62%, 1)"};function xs(e,t,n,r,s){e.fillStyle=r,e.fillRect(t.originX+n.x*Ze+s,t.originY+n.y*Ze+s,Ze-s*2,Ze-s*2)}function pi(e,t,n,r){t.font='bold 12px "DM Sans", monospace',t.textAlign="left",t.fillStyle=Pe.textSoft,t.fillText("HI",10,22),t.fillStyle=Pe.score,t.fillText(String(r).padStart(4,"0"),30,22),t.textAlign="right",t.fillStyle=Pe.text,t.fillText(String(n).padStart(4,"0"),e.width-10,22)}function Cg(e,t,n,r,s){t.clearRect(0,0,e.width,e.height),xs(t,n,n.food,Pe.food,3),n.snake.forEach((a,i)=>xs(t,n,a,i===0?Pe.snakeHead:Pe.snake,2)),pi(e,t,r,s)}function bs(e,t,n,r,s){t.clearRect(0,0,e.width,e.height),t.textAlign="center",n==="idle"?(t.fillStyle=Pe.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText("Arrow keys or swipe to start",e.width/2,e.height/2)):(t.fillStyle=Pe.gameOver,t.font='bold 20px "DM Sans", sans-serif',t.fillText("GAME OVER",e.width/2,e.height/2-30),t.fillStyle=Pe.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText(`Score: ${r}`,e.width/2,e.height/2),t.fillStyle=Pe.textSoft,t.fillText("Press an arrow or tap to play again",e.width/2,e.height/2+28)),t.textAlign="left",pi(e,t,r,s)}function Tg(){const e=p.useRef(null),t=p.useRef(null),[n,r]=p.useState("idle"),[s,a]=p.useState(0),[i,c]=p.useState(()=>{if(typeof window<"u"){const k=localStorage.getItem("zframes-snake-high-score");return k?parseInt(k,10):0}return 0}),[,u]=p.useState(!1),l=p.useRef(0),d=p.useRef(i),m=p.useRef(n),h=p.useRef(null);p.useEffect(()=>{d.current=i,i>0&&localStorage.setItem("zframes-snake-high-score",String(i))},[i]),p.useEffect(()=>{m.current=n},[n]);const g=p.useRef({snake:[],dir:{x:1,y:0},pendingDir:{x:1,y:0},food:{x:0,y:0},cols:0,rows:0,originX:0,originY:0,stepCounter:0}),w=p.useCallback(()=>{const k=g.current;if(k.cols<=0||k.rows<=0)return;let T,N=0;do T={x:Math.floor(Math.random()*k.cols),y:Math.floor(Math.random()*k.rows)},N++;while(k.snake.some(j=>j.x===T.x&&j.y===T.y)&&N<400);k.food=T},[]),v=p.useCallback(()=>{const k=g.current,T=Math.floor(k.cols/2),N=Math.floor(k.rows/2);k.snake=[{x:T,y:N},{x:T-1,y:N},{x:T-2,y:N}],k.dir={x:1,y:0},k.pendingDir={x:1,y:0},k.stepCounter=0,w(),l.current=0,a(0)},[w]),f=p.useCallback(()=>{g.current.cols<=0||(v(),r("playing"))},[v]),x=p.useCallback((k,T)=>{const N=g.current;N.dir.x===-k&&N.dir.y===-T||(N.pendingDir={x:k,y:T})},[]);p.useEffect(()=>{const k=N=>{const j=N.target;if(j.tagName==="INPUT"||j.tagName==="TEXTAREA"||j.isContentEditable)return;const b=m.current==="playing";let _=!0;switch(N.code){case"ArrowUp":case"KeyW":b?x(0,-1):f();break;case"ArrowDown":case"KeyS":b?x(0,1):f();break;case"ArrowLeft":case"KeyA":b?x(-1,0):f();break;case"ArrowRight":case"KeyD":b?x(1,0):f();break;case"Space":b||f();break;default:_=!1}_&&N.preventDefault()},T=t.current;if(T)return T.addEventListener("keydown",k),()=>T.removeEventListener("keydown",k)},[x,f]),p.useLayoutEffect(()=>{const k=e.current;if(!k)return;const T=()=>{const j=k.parentElement;if(j&&j.clientWidth>0&&j.clientHeight>0){k.width=j.clientWidth,k.height=j.clientHeight-_g;const b=g.current;b.cols=Math.max(5,Math.floor(k.width/Ze)),b.rows=Math.max(5,Math.floor(k.height/Ze)),b.originX=Math.floor((k.width-b.cols*Ze)/2),b.originY=Math.floor((k.height-b.rows*Ze)/2);const _=k.getContext("2d");_&&m.current!=="playing"&&bs(k,_,m.current,l.current,d.current),u(P=>!P)}};T();const N=new ResizeObserver(T);return N.observe(k.parentElement),()=>N.disconnect()},[]),p.useEffect(()=>{if(n!=="playing")return;const k=e.current,T=k==null?void 0:k.getContext("2d");if(!k||!T)return;let N;const j=()=>{l.current>d.current&&(d.current=l.current,c(l.current)),r("gameover")},b=()=>{const _=g.current;if(_.stepCounter++,_.stepCounter>=jg){_.stepCounter=0,_.dir=_.pendingDir;const P=_.snake[0],B=P.x+_.dir.x,E=P.y+_.dir.y;if(B<0||E<0||B>=_.cols||E>=_.rows){j();return}const z=B===_.food.x&&E===_.food.y;if((z?_.snake:_.snake.slice(0,-1)).some(M=>M.x===B&&M.y===E)){j();return}_.snake.unshift({x:B,y:E}),z?(l.current+=1,a(l.current),w()):_.snake.pop()}Cg(k,T,_,l.current,d.current),N=requestAnimationFrame(b)};return N=requestAnimationFrame(b),()=>cancelAnimationFrame(N)},[n]),p.useEffect(()=>{if(n==="playing")return;const k=e.current,T=k==null?void 0:k.getContext("2d");!k||!T||bs(k,T,n,s,i)},[n,s,i]);const y=k=>{const T=k.touches[0];T&&(h.current={x:T.clientX,y:T.clientY})},S=k=>{var _;const T=h.current;h.current=null;const N=k.changedTouches[0];if((_=t.current)==null||_.focus(),m.current!=="playing"){f();return}if(!T||!N)return;const j=N.clientX-T.x,b=N.clientY-T.y;Math.abs(j)<12&&Math.abs(b)<12||(Math.abs(j)>Math.abs(b)?x(j>0?1:-1,0):x(0,b>0?1:-1))};return o.jsx("div",{ref:t,tabIndex:0,className:"relative h-full w-full cursor-pointer select-none overflow-hidden outline-none",onTouchStart:y,onTouchEnd:S,onClick:()=>{var k;return(k=t.current)==null?void 0:k.focus()},role:"application","aria-label":"Snake game. Use the arrow keys or swipe to steer.",children:o.jsx("canvas",{ref:e,className:"h-full w-full"})})}const zg={...Kh,component:Tg},Mg=.225,Eg=-3.6,ht=52,Dt=132,Rg=210,Ag=1.3,Zt=64,He=12,On=28,vs=28,Ce={bird:"rgba(255, 255, 255, 0.95)",eye:"rgba(0, 0, 0, 0.8)",wing:"hsla(246, 100%, 70%, 1)",pipe:"hsla(160, 64%, 40%, 0.9)",ground:"rgba(255, 255, 255, 0.1)",text:"rgba(255, 255, 255, 0.85)",textSoft:"rgba(255, 255, 255, 0.6)",score:"hsla(246, 100%, 70%, 1)",gameOver:"hsla(347, 100%, 62%, 1)"};function gi(e,t,n){e.save(),e.translate(Zt,t),e.rotate(Math.max(-.5,Math.min(.9,n*.06))),e.fillStyle=Ce.bird,e.beginPath(),e.arc(0,0,He,0,Math.PI*2),e.fill(),e.fillStyle=Ce.wing,e.fillRect(-He+2,0,10,5),e.fillStyle=Ce.eye,e.beginPath(),e.arc(5,-4,2,0,Math.PI*2),e.fill(),e.restore()}function xi(e,t,n,r){t.font='bold 12px "DM Sans", monospace',t.textAlign="left",t.fillStyle=Ce.textSoft,t.fillText("HI",10,22),t.fillStyle=Ce.score,t.fillText(String(r).padStart(4,"0"),30,22),t.textAlign="right",t.fillStyle=Ce.text,t.fillText(String(n).padStart(4,"0"),e.width-10,22)}function ys(e,t,n,r,s){t.clearRect(0,0,e.width,e.height);const a=e.height-On;t.fillStyle=Ce.ground,t.fillRect(0,a,e.width,2),gi(t,e.height/2,0),t.textAlign="center",n==="idle"?(t.fillStyle=Ce.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText("Press SPACE or tap to fly",e.width/2,e.height/2-40)):(t.fillStyle=Ce.gameOver,t.font='bold 20px "DM Sans", sans-serif',t.fillText("GAME OVER",e.width/2,e.height/2-50),t.fillStyle=Ce.text,t.font='bold 14px "DM Sans", sans-serif',t.fillText(`Score: ${r}`,e.width/2,e.height/2-22),t.fillStyle=Ce.textSoft,t.fillText("Press SPACE or tap to retry",e.width/2,e.height/2+6)),t.textAlign="left",xi(e,t,r,s)}function Pg(){const e=p.useRef(null),t=p.useRef(null),[n,r]=p.useState("idle"),[s,a]=p.useState(0),[i,c]=p.useState(()=>{if(typeof window<"u"){const f=localStorage.getItem("zframes-flappy-bird-high-score");return f?parseInt(f,10):0}return 0}),[,u]=p.useState(!1),l=p.useRef(0),d=p.useRef(i),m=p.useRef(n);p.useEffect(()=>{d.current=i,i>0&&localStorage.setItem("zframes-flappy-bird-high-score",String(i))},[i]),p.useEffect(()=>{m.current=n},[n]);const h=p.useRef({birdY:0,birdVel:0,pipes:[],frameCount:0}),g=p.useCallback(f=>{const x=f.height-On,y=vs,S=x-vs-Dt;return y+Math.random()*Math.max(0,S-y)},[]),w=p.useCallback(()=>{const f=e.current;f&&(h.current={birdY:f.height/2,birdVel:0,pipes:[{x:f.width+60,gapY:g(f),passed:!1}],frameCount:0},l.current=0,a(0))},[g]),v=p.useCallback(()=>{var f;if((f=t.current)==null||f.focus(),m.current!=="playing"){w(),r("playing");return}h.current.birdVel=Eg},[w]);return p.useEffect(()=>{const f=y=>{const S=y.target;S.tagName==="INPUT"||S.tagName==="TEXTAREA"||S.isContentEditable||(y.code==="Space"||y.code==="ArrowUp")&&(y.preventDefault(),v())},x=t.current;if(x)return x.addEventListener("keydown",f),()=>x.removeEventListener("keydown",f)},[v]),p.useLayoutEffect(()=>{const f=e.current;if(!f)return;const x=()=>{const S=f.parentElement;if(S&&S.clientWidth>0&&S.clientHeight>0){f.width=S.clientWidth,f.height=S.clientHeight;const k=f.getContext("2d");m.current!=="playing"&&(h.current.birdY=f.height/2,k&&ys(f,k,m.current,l.current,d.current)),u(T=>!T)}};x();const y=new ResizeObserver(x);return y.observe(f.parentElement),()=>y.disconnect()},[]),p.useEffect(()=>{if(n!=="playing")return;const f=e.current,x=f==null?void 0:f.getContext("2d");if(!f||!x)return;let y;const S=f.height-On,k=()=>{l.current>d.current&&(d.current=l.current,c(l.current)),r("gameover")},T=()=>{const N=h.current;x.clearRect(0,0,f.width,f.height),N.birdVel+=Mg,N.birdY+=N.birdVel,N.pipes=N.pipes.filter(b=>b.x>-ht),N.pipes.forEach(b=>b.x-=Ag);const j=N.pipes[N.pipes.length-1];if((!j||j.x<f.width-Rg)&&N.pipes.push({x:f.width,gapY:g(f),passed:!1}),N.birdY-He<=0||N.birdY+He>=S){k();return}for(const b of N.pipes){if(Zt+He>b.x&&Zt-He<b.x+ht&&(N.birdY-He<b.gapY||N.birdY+He>b.gapY+Dt)){k();return}!b.passed&&b.x+ht<Zt&&(b.passed=!0,l.current+=1,a(l.current))}x.fillStyle=Ce.pipe;for(const b of N.pipes)x.fillRect(b.x,0,ht,b.gapY),x.fillRect(b.x,b.gapY+Dt,ht,S-(b.gapY+Dt));x.fillStyle=Ce.ground,x.fillRect(0,S,f.width,2),gi(x,N.birdY,N.birdVel),xi(f,x,l.current,d.current),N.frameCount++,y=requestAnimationFrame(T)};return y=requestAnimationFrame(T),()=>cancelAnimationFrame(y)},[n]),p.useEffect(()=>{if(n==="playing")return;const f=e.current,x=f==null?void 0:f.getContext("2d");!f||!x||ys(f,x,n,s,i)},[n,s,i]),o.jsx("div",{ref:t,tabIndex:0,className:"relative h-full w-full cursor-pointer select-none overflow-hidden outline-none",onClick:v,onTouchStart:v,role:"application","aria-label":"Flappy bird game. Press space or tap to flap.",children:o.jsx("canvas",{ref:e,className:"h-full w-full"})})}const $g={...qh,component:Pg};Va.schema;function Dg(e){let t;try{t=new URL(e.trim())}catch{return null}const n=t.hostname.replace(/^www\./,"");if(n==="youtu.be"){const r=t.pathname.slice(1).split("/")[0];return r?`https://www.youtube.com/embed/${r}`:null}if(n==="youtube.com"||n==="m.youtube.com"){if(t.pathname==="/watch"){const s=t.searchParams.get("v");return s?`https://www.youtube.com/embed/${s}`:null}const r=t.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);return r?`https://www.youtube.com/embed/${r[1]}`:null}if(n==="vimeo.com"){const r=t.pathname.split("/").filter(Boolean)[0];return r&&/^\d+$/.test(r)?`https://player.vimeo.com/video/${r}`:null}return n==="player.vimeo.com"||t.protocol==="https:"?t.toString():null}function Ig({config:e}){const[t,n]=p.useState("loading"),r=p.useMemo(()=>Dg(e.url),[e.url]);return p.useEffect(()=>n("loading"),[r]),r?t==="error"?o.jsx(A,{children:"video unavailable"}):o.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-md",children:[t==="loading"&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(A,{loading:!0,children:"loading video…"})}),o.jsx("iframe",{src:r,title:e.title,className:`h-full w-full border-0 transition-opacity duration-300 ${t==="loaded"?"opacity-100":"opacity-0"}`,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,onLoad:()=>n("loaded"),onError:()=>n("error")},r)]}):o.jsx(A,{children:"invalid video URL"})}const Fg={...Va,component:Ig};function Og(){const[e,t]=p.useState("loading");return e==="error"?o.jsx(A,{children:"canvas unavailable"}):o.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-md",children:[e==="loading"&&o.jsx("div",{className:"absolute inset-0 z-10",children:o.jsx(A,{loading:!0,children:"loading canvas…"})}),o.jsx("iframe",{src:"https://drawdy.io",title:"Drawdy Canvas",className:`h-full w-full border-0 transition-opacity duration-300 ${e==="loaded"?"opacity-100":"opacity-0"}`,allow:"clipboard-read; clipboard-write",onLoad:()=>t("loaded"),onError:()=>t("error")})]})}const Lg={...Jh,component:Og};Za.schema;const ws=864e5,ks=36e5,Ss=6e4;function pt(e){let t=Math.max(0,e);const n=Math.floor(t/ws);t-=n*ws;const r=Math.floor(t/ks);t-=r*ks;const s=Math.floor(t/Ss);t-=s*Ss;const a=Math.floor(t/1e3);return{days:n,hours:r,minutes:s,seconds:a}}const vn="hsl(var(--zf-accent-hue, 242) 96% 82%)",yn="0 0 16px hsl(var(--zf-accent-hue, 242) 92% 70% / 0.4)",tt=e=>String(e).padStart(2,"0");function Ug({config:e}){const t=p.useRef(null),n=p.useRef(null),r=p.useRef(null),s=p.useRef(null),a=e.target.trim(),i=p.useMemo(()=>{if(!a)return null;const w=new Date(a).getTime();return Number.isFinite(w)?w:NaN},[a]),c=i!=null&&!Number.isNaN(i),[u,l]=p.useState(c&&i<=Date.now());p.useEffect(()=>{if(!c)return;const w=i-Date.now();if(w<=0){l(!0);return}l(!1);const v=window.setTimeout(()=>l(!0),w);return()=>window.clearTimeout(v)},[c,i]);const d=()=>c?i-Date.now():0;De({ref:t,getRemainingMs:d,format:w=>String(pt(w).days)}),De({ref:n,getRemainingMs:d,format:w=>tt(pt(w).hours)}),De({ref:r,getRemainingMs:d,format:w=>tt(pt(w).minutes)}),De({ref:s,getRemainingMs:d,format:w=>tt(pt(w).seconds)});const m=p.useMemo(()=>c?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(i)):"",[c,i]);if(!a)return o.jsx(A,{children:"set a target date & time"});if(!c)return o.jsxs(A,{children:["invalid target date: ",a]});const h=pt(d()),g=[[t,String(h.days),"days"],[n,tt(h.hours),"hrs"],[r,tt(h.minutes),"min"],[s,tt(h.seconds),"sec"]];return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 text-center [container-type:size]",children:[e.label&&o.jsxs("div",{className:"caption text-soft inline-flex items-center gap-1.5 uppercase tracking-[0.18em]",children:[o.jsx("span",{"aria-hidden":!0,className:"inline-block h-1 w-1 rounded-full",style:{background:vn,boxShadow:yn}}),e.label]}),o.jsx("div",{className:"flex items-start justify-center gap-[0.5em] leading-none tabular-nums",style:{fontSize:"clamp(0.9rem, 20cqmin, 2.8rem)"},children:g.map(([w,v,f],x)=>o.jsxs("div",{className:"flex flex-col items-center gap-[0.25em]",children:[o.jsx("span",{ref:w,suppressHydrationWarning:!0,className:"text-strong font-dmsans font-extrabold tracking-[-0.01em]",style:{fontSize:"1em",color:x===3&&!u?vn:void 0,textShadow:x===3&&!u?yn:void 0},children:v}),o.jsx("span",{className:"text-soft uppercase tracking-[0.12em]",style:{fontSize:"0.26em"},children:f})]},f))}),u?o.jsx("div",{className:"caption font-semibold uppercase tracking-[0.2em]",style:{color:vn,textShadow:yn},children:"reached"}):e.showTarget&&m&&o.jsx("div",{className:"caption text-soft tabular-nums",children:m})]})}const Bg={...Za,component:Ug};Ga.schema;const Hg=e=>/^https?:\/\//i.test(e);function Vg(e){for(const t of[e,`https://${e}`])try{const n=new URL(t).hostname;if(n)return n}catch{}return null}function Zg(e){const t=Vg(e);return t?`https://www.google.com/s2/favicons?sz=64&domain=${encodeURIComponent(t)}`:null}function Gg({link:e}){const[t,n]=p.useState(!1),r=e.icon.trim(),s=r&&Hg(r)?r:null,a=r&&!s?r:null,i=s??(a?null:Zg(e.url)),c=i!=null&&!t;return o.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",title:e.url,className:"group flex items-center gap-2 rounded-lg border border-white/[0.08] bg-white/[0.04] px-2.5 py-2 transition-colors hover:border-white/20 hover:bg-white/[0.08]",children:[o.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-md bg-white/[0.06] text-base leading-none","aria-hidden":!0,children:a?o.jsx("span",{children:a}):c?o.jsx("img",{src:i,alt:"",className:"h-full w-full object-contain",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>n(!0)}):o.jsx("span",{className:"text-soft font-dmsans font-bold uppercase",children:e.label.charAt(0)})}),o.jsx("span",{className:"body-sm text-normal min-w-0 flex-1 truncate font-medium group-hover:text-white",children:e.label})]})}function Wg({config:e}){return o.jsx("div",{className:on,children:o.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:`repeat(${e.columns}, minmax(0, 1fr))`},children:e.links.map((t,n)=>o.jsx(Gg,{link:t},`${t.url}-${n}`))})})}const Yg={...Ga,component:Wg};Wa.schema;const Xg="hsl(var(--zf-accent-hue, 242) 96% 82%)";function It(e){const t=Number(e);return Number.isFinite(t)?t:0}function Ft({label:e,value:t,onChange:n,prefix:r,suffix:s}){return o.jsxs("label",{className:"flex flex-col gap-1",children:[o.jsx("span",{className:"caption text-soft uppercase tracking-[0.12em]",children:e}),o.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-white/[0.08] bg-white/[0.04] px-2 py-1.5 focus-within:border-white/25",children:[r&&o.jsx("span",{className:"body-sm text-soft",children:r}),o.jsx("input",{type:"number",inputMode:"decimal",value:t,onChange:a=>n(a.target.value),className:"body-sm text-normal min-w-0 flex-1 bg-transparent text-right tabular-nums outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"}),s&&o.jsx("span",{className:"body-sm text-soft",children:s})]})]})}function Kg({config:e}){const[t,n]=p.useState(String(e.account)),[r,s]=p.useState(String(e.riskPct)),[a,i]=p.useState(String(e.entry)),[c,u]=p.useState(String(e.stop));p.useEffect(()=>n(String(e.account)),[e.account]),p.useEffect(()=>s(String(e.riskPct)),[e.riskPct]),p.useEffect(()=>i(String(e.entry)),[e.entry]),p.useEffect(()=>u(String(e.stop)),[e.stop]);const l=p.useMemo(()=>{const g=It(t),w=It(r),v=It(a),f=It(c),x=g*w/100,y=Math.abs(v-f),S=y>0?x/y:0,k=S*v,T=v===f?"—":f<v?"long":"short";return{riskAmount:x,perUnit:y,size:S,value:k,side:T,hasStop:y>0}},[t,r,a,c]),d=e.currency,m=g=>`${d}${g.toLocaleString(void 0,{maximumFractionDigits:2})}`,h=g=>g.toLocaleString(void 0,{maximumFractionDigits:g>=1?2:4});return o.jsxs("div",{className:`${on} flex flex-col gap-3`,children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(Ft,{label:"Account",value:t,onChange:n,prefix:d}),o.jsx(Ft,{label:"Risk",value:r,onChange:s,suffix:"%"}),o.jsx(Ft,{label:"Entry",value:a,onChange:i,prefix:d}),o.jsx(Ft,{label:"Stop",value:c,onChange:u,prefix:d})]}),o.jsxs("div",{className:"flex flex-col gap-1.5 rounded-lg border border-white/[0.07] bg-white/[0.03] p-2.5",children:[o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsx("span",{className:"caption text-soft uppercase tracking-[0.12em]",children:"Position size"}),o.jsx("span",{className:"font-dmsans text-base font-extrabold tabular-nums",style:{color:l.hasStop?Xg:void 0},children:l.hasStop?h(l.size):"—"})]}),o.jsx(Ot,{label:"Risk amount",value:m(l.riskAmount)}),o.jsx(Ot,{label:"Per-unit risk",value:l.hasStop?m(l.perUnit):"set a stop"}),o.jsx(Ot,{label:"Position value",value:l.hasStop?m(l.value):"—"}),o.jsx(Ot,{label:"Direction",value:l.side})]})]})}function Ot({label:e,value:t}){return o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsx("span",{className:"body-sm text-soft",children:e}),o.jsx("span",{className:"body-sm text-normal tabular-nums",children:t})]})}const qg={...Wa,component:Kg};Ya.schema;const Ns="hsl(var(--zf-accent-hue, 242) 96% 82%)";function Jg({config:e}){const t=e.quotes,[n,r]=p.useState(0);p.useEffect(()=>r(0),[e.quotes]),p.useEffect(()=>{if(e.intervalSec<=0||t.length<=1)return;const a=window.setInterval(()=>r(i=>(i+1)%t.length),e.intervalSec*1e3);return()=>window.clearInterval(a)},[e.intervalSec,t.length]);const s=t[Math.min(n,t.length-1)]??"";return o.jsx("div",{className:"flex h-full w-full items-center justify-center [container-type:size]",children:o.jsxs("figure",{className:"relative max-h-full overflow-auto px-3 text-center",children:[o.jsx("span",{"aria-hidden":!0,className:"block font-dmsans font-black leading-none",style:{fontSize:"clamp(1.5rem, 14cqmin, 3rem)",color:Ns},children:"“"}),o.jsx("blockquote",{className:"body-md text-normal -mt-[0.3em] whitespace-pre-wrap italic leading-snug",style:{fontSize:"clamp(0.85rem, 8cqmin, 1.25rem)"},children:s}),t.length>1&&o.jsx("figcaption",{className:"mt-2 flex justify-center gap-1.5","aria-hidden":!0,children:t.map((a,i)=>o.jsx("span",{className:"h-1 w-1 rounded-full transition-colors",style:{background:i===Math.min(n,t.length-1)?Ns:"rgba(255,255,255,0.2)"}},i))})]})})}const Qg={...Ya,component:Jg};Xa.schema;const js="rgba(255,255,255,0.16)";function ex({config:e}){const t=e.orientation==="vertical",n=e.label.trim(),r=s=>o.jsx("span",{className:`shrink ${t?"w-0 flex-1":"h-0 flex-1"} `,style:t?{borderLeftWidth:1,borderLeftStyle:e.style,borderColor:js}:{borderTopWidth:1,borderTopStyle:e.style,borderColor:js}});return n?o.jsxs("div",{className:`flex h-full w-full items-center justify-center gap-3 ${t?"flex-col py-1":"px-1"}`,children:[r(),o.jsx("span",{className:"caption text-soft shrink-0 whitespace-nowrap uppercase tracking-[0.18em]",style:t?{writingMode:"vertical-rl"}:void 0,children:n}),r()]}):o.jsx("div",{className:`flex h-full w-full items-center justify-center ${t?"flex-col":""}`,children:r()})}const tx={...Xa,component:ex};Ka.schema;const nx={fastest:"Next block",halfHour:"~30 min",hour:"~1 hour",economy:"Economy",minimum:"Minimum"},rx={fastest:"#ff6b81",halfHour:"#ffa057",hour:"#ffd166",economy:"#9bd45f",minimum:"#3fd08f"};function sx({config:e}){const{fees:t,isLoading:n}=Jm();return n?o.jsx(A,{loading:!0,children:"loading fees…"}):t?o.jsx("div",{className:"flex h-full flex-wrap content-center items-stretch justify-center gap-2",children:e.tiers.map(r=>{const s=rx[r];return o.jsxs("div",{className:"flex min-w-[64px] flex-1 flex-col items-center justify-center rounded-lg px-2 py-2",style:{background:`${s}14`,border:`1px solid ${s}33`},children:[o.jsx("span",{className:"font-dmsans text-2xl font-bold leading-none tabular-nums",style:{color:s},children:t[r]}),o.jsx("span",{className:"caption text-soft mt-0.5",children:"sat/vB"}),o.jsx("span",{className:"caption text-soft mt-1 text-center",children:nx[r]})]},r)})}):o.jsx(A,{children:"no fee data"})}const ox={...Ka,component:sx};qa.schema;function ax(e){return e>=100?"#ff6b81":e>=50?"#ffa057":e>=20?"#ffd166":e>=5?"#9bd45f":"#3fd08f"}function ix({config:e}){const{state:t,isLoading:n}=Qm();if(n)return o.jsx(A,{loading:!0,children:"loading mempool…"});if(!t)return o.jsx(A,{children:"no mempool data"});const r=t.projected.slice(0,e.projectedBlocks),s=(t.vsize/1e6).toFixed(1);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"unconfirmed"}),o.jsx("div",{className:"font-dmsans text-strong text-4xl font-bold leading-none tabular-nums",children:t.count.toLocaleString("en-US")}),o.jsx("div",{className:"body-sm text-soft",children:"transactions"})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("div",{className:"body-md text-normal font-bold tabular-nums",children:[s," MvB"]}),o.jsx("div",{className:"caption text-soft",children:"pending vsize"})]})]}),o.jsx("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:r.map((a,i)=>{const c=ax(a.medianFee);return o.jsxs("div",{className:"flex min-w-[72px] flex-col items-center justify-center rounded-md px-2 py-2",style:{background:`${c}14`,border:`1px solid ${c}33`},children:[o.jsxs("span",{className:"body-md font-bold tabular-nums",style:{color:c},children:["~",Math.round(a.medianFee)]}),o.jsx("span",{className:"caption text-soft",children:"sat/vB"}),o.jsxs("span",{className:"caption text-soft mt-1",children:[a.nTx.toLocaleString("en-US")," tx"]})]},i)})})]})}const cx={...qa,component:ix};Ja.schema;function lx({config:e}){const{blocks:t,isLoading:n}=ef(e.count);return n?o.jsx(A,{loading:!0,children:"loading blocks…"}):t.length===0?o.jsx(A,{children:"no block data"}):o.jsx("div",{className:"flex h-full min-h-0 flex-col",children:o.jsx("div",{className:on,children:o.jsx("div",{className:"flex flex-col gap-1.5",children:t.map(r=>o.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md bg-white/[0.03] px-2 py-1.5",title:`Block ${r.height} · ${r.poolName} · ${r.txCount.toLocaleString("en-US")} txs`,children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"body-sm font-bold tabular-nums text-white",children:r.height.toLocaleString("en-US")}),o.jsx("span",{className:"caption text-soft",children:ci(r.time)})]}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("span",{className:"body-sm text-normal block truncate",children:r.poolName}),o.jsxs("span",{className:"caption text-soft",children:[r.txCount.toLocaleString("en-US")," txs"]})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("span",{className:"body-sm text-normal block font-bold tabular-nums",children:ii(r.totalFees)}),o.jsxs("span",{className:"caption text-soft",children:["~",Math.round(r.medianFee)," sat/vB"]})]})]},r.id))})})})}const ux={...Ja,component:lx};Qa.schema;function dx(e){return e>=1e12?`${(e/1e12).toFixed(2)}T`:e>=1e9?`${(e/1e9).toFixed(2)}G`:e.toLocaleString("en-US",{maximumFractionDigits:0})}function mx({config:e}){const{data:t,isLoading:n}=tf(e.window),r=p.useMemo(()=>((t==null?void 0:t.hashrates)??[]).map(s=>({date:new Date(s.time).toISOString(),value:s.hashrate})),[t==null?void 0:t.hashrates]);return n?o.jsx(A,{loading:!0,children:"loading hashrate…"}):t?o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"network hashrate"}),o.jsx("div",{className:"font-dmsans text-strong text-4xl font-bold leading-none tabular-nums",children:tp(t.currentHashrate)})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"body-md text-normal font-bold tabular-nums",children:dx(t.currentDifficulty)}),o.jsx("div",{className:"caption text-soft",children:"difficulty"})]})]}),o.jsx(et,{data:r,width:320,height:54,color:"hsl(var(--zf-accent-hue, 242) 85% 72%)"}),o.jsxs("div",{className:"caption text-soft",children:["past ",e.window]})]}):o.jsx(A,{children:"no hashrate data"})}const fx={...Qa,component:mx};ei.schema;function hx(e){const t=Math.max(0,Math.round((e-Date.now())/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60);return n>0?`in ${n}d ${r}h`:r>0?`in ${r}h ${s}m`:`in ${s}m`}function px({config:e}){const{adjustment:t,isLoading:n}=nf();if(n)return o.jsx(A,{loading:!0,children:"loading difficulty…"});if(!t)return o.jsx(A,{children:"no difficulty data"});const{progressPercent:r,difficultyChange:s,remainingBlocks:a}=t,i=je(s);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("div",{className:"caption text-soft uppercase",children:"next adjustment"}),o.jsxs("div",{className:"font-dmsans text-4xl font-bold leading-none tabular-nums",style:{color:i},children:[s>=0?"+":"",s.toFixed(2),"%"]}),o.jsx("div",{className:"body-sm text-soft",children:s>=0?"harder":"easier"})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"body-md text-normal font-bold tabular-nums",children:hx(t.estimatedRetargetDate)}),o.jsxs("div",{className:"caption text-soft",children:[a.toLocaleString("en-US")," blocks left"]})]})]}),o.jsxs("div",{children:[o.jsx("div",{className:"relative h-2.5 w-full overflow-hidden rounded-full bg-white/[0.08]",children:o.jsx("div",{className:"absolute left-0 top-0 h-full rounded-full",style:{width:`${Math.min(100,Math.max(0,r))}%`,background:"hsl(var(--zf-accent-hue, 242) 85% 66%)"}})}),o.jsxs("div",{className:"caption text-soft mt-1 tabular-nums",children:[r.toFixed(1),"% through this epoch"]})]}),e.showPrevious&&o.jsxs("div",{className:"caption text-soft border-t border-white/[0.08] pt-2",children:["previous retarget"," ",o.jsxs("span",{className:"font-bold tabular-nums",style:{color:je(t.previousRetarget)},children:[t.previousRetarget>=0?"+":"",t.previousRetarget.toFixed(2),"%"]})]})]})}const gx={...ei,component:px};ti.schema;function xx({width:e,height:t,data:n}){if(e<48||t<30)return null;const r=e<70||t<44;return o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center overflow-hidden p-1 text-center",title:`${n.id} · ${n.sharePct.toFixed(1)}% of blocks`,children:[o.jsx("span",{className:"body-sm truncate font-bold text-white",children:n.id}),!r&&o.jsxs("span",{className:"caption text-white/80",children:[n.sharePct.toFixed(1),"%"]})]})}function bx({config:e}){const{pools:t,isLoading:n}=rf(e.window),r=p.useMemo(()=>{const s=(t==null?void 0:t.pools)??[],i=s.slice(0,e.topN).map(u=>({id:u.name,value:u.blockCount,sharePct:u.sharePct})),c=s.slice(e.topN);if(c.length>0){const u=c.reduce((d,m)=>d+m.blockCount,0),l=c.reduce((d,m)=>d+m.sharePct,0);u>0&&i.push({id:"Other",value:u,sharePct:l})}return i},[t,e.topN]);return n?o.jsx(A,{loading:!0,children:"loading pools…"}):r.length===0?o.jsx(A,{children:"no mining data"}):o.jsx(lt,{data:r,LeafComponent:xx,getColorValue:s=>s.sharePct})}const vx={...ti,component:bx};ni.schema;function wn(e,t){return t==null||t===0?null:(e-t)/t*100}function kn({label:e,value:t,delta:n}){return o.jsxs("div",{className:"flex flex-col items-center justify-center rounded-md bg-white/[0.04] px-2 py-2 text-center",children:[o.jsx("span",{className:"font-dmsans text-strong text-xl font-bold leading-none tabular-nums",children:t}),o.jsx("span",{className:"caption text-soft mt-1",children:e}),n!==null&&o.jsxs("span",{className:"caption mt-0.5 font-bold tabular-nums",style:{color:je(n)},children:[n>=0?"+":"",n.toFixed(2),"%"]})]})}function yx({config:e}){const{stats:t,isLoading:n}=sf();return n?o.jsx(A,{loading:!0,children:"loading lightning…"}):t?o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-2",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-1.5",children:[o.jsx(kn,{label:"nodes",value:t.nodeCount.toLocaleString("en-US"),delta:wn(t.nodeCount,t.prevNodeCount)}),o.jsx(kn,{label:"channels",value:t.channelCount.toLocaleString("en-US"),delta:wn(t.channelCount,t.prevChannelCount)}),o.jsx(kn,{label:"capacity",value:ii(t.totalCapacity),delta:wn(t.totalCapacity,t.prevTotalCapacity)})]}),e.showSplit&&o.jsxs("div",{className:"caption text-soft text-center",children:[t.clearnetNodes.toLocaleString("en-US")," clearnet ·"," ",t.torNodes.toLocaleString("en-US")," tor"]})]}):o.jsx(A,{children:"no lightning data"})}const wx={...ni,component:yx};ri.schema;const Ln="#3fd08f",Un="#ff6b81";function kx(e){return e>1?Un:Ln}function Sx({config:e}){const{summary:t,isLoading:n}=Vo(e.currency);if(n)return o.jsx(A,{loading:!0,children:"loading options…"});if(!t)return o.jsx(A,{children:"no options data"});const r=e.basis==="oi"?t.putCallRatioOi:t.putCallRatioVolume,s=e.basis==="oi"?t.putCallRatioVolume:t.putCallRatioOi,a=t.callOi+t.putOi,i=a>0?t.callOi/a*100:50,c=100-i,u=kx(r);return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"caption text-soft uppercase",children:[e.currency," put/call · ",e.basis==="oi"?"OI":"vol"]}),o.jsx("div",{className:"font-dmsans text-5xl font-bold leading-none tabular-nums",style:{color:u},children:r.toFixed(2)})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"body-md text-normal font-bold tabular-nums",children:s.toFixed(2)}),o.jsxs("div",{className:"caption text-soft",children:["by ",e.basis==="oi"?"volume":"OI"]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex h-3 w-full gap-1 overflow-hidden rounded-full",children:[o.jsx("div",{className:"h-full rounded-l-full",style:{width:`${i}%`,background:Ln}}),o.jsx("div",{className:"h-full rounded-r-full",style:{width:`${c}%`,background:Un}})]}),o.jsxs("div",{className:"caption text-soft mt-1 flex justify-between tabular-nums",children:[o.jsxs("span",{children:[o.jsx("span",{style:{color:Ln},children:"calls"})," ",i.toFixed(0),"%"]}),o.jsxs("span",{children:[c.toFixed(0),"% ",o.jsx("span",{style:{color:Un},children:"puts"})]})]})]}),o.jsxs("div",{className:"caption text-soft",children:["avg implied vol ",t.avgIv.toFixed(1),"%"]})]})}const Nx={...ri,component:Sx};si.schema;const jx={"7D":{ms:7*864e5,res:3600},"1M":{ms:30*864e5,res:43200},"3M":{ms:90*864e5,res:86400}};function _x({config:e}){const{ms:t,res:n}=jx[e.lookback],r=p.useMemo(()=>Date.now()-t,[t]),{points:s,isLoading:a}=of(e.currency,r,n),i=p.useMemo(()=>s.map(l=>({date:new Date(l.time).toISOString(),value:l.value})),[s]);if(a)return o.jsx(A,{loading:!0,children:"loading volatility…"});if(s.length===0)return o.jsx(A,{children:"no volatility data"});const c=s[s.length-1].value,u=c-s[0].value;return o.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[o.jsxs("div",{className:"flex items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"caption text-soft uppercase",children:[e.currency," DVOL · implied vol"]}),o.jsx("div",{className:"font-dmsans text-strong text-4xl font-bold leading-none tabular-nums",children:c.toFixed(1)})]}),o.jsxs("div",{className:"text-right",children:[o.jsxs("div",{className:"body-md font-bold tabular-nums",style:{color:je(u)},children:[u>=0?"+":"",u.toFixed(1)]}),o.jsxs("div",{className:"caption text-soft",children:["past ",e.lookback]})]})]}),o.jsx(et,{data:i,width:320,height:54,color:"hsl(var(--zf-accent-hue, 242) 85% 72%)"})]})}const Cx={...si,component:_x};oi.schema;const _s="#3fd08f",Cs="#ff6b81";function Ts(e){return e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}k`:String(e)}function Tx({config:e}){const{summary:t,isLoading:n}=Vo(e.currency),r=p.useMemo(()=>{if(!t)return null;const S=t.underlyingPrice,k=t.nearestExpiry.strikes;if(k.length===0)return null;const T=[...k].sort((j,b)=>Math.abs(j.strike-S)-Math.abs(b.strike-S)).slice(0,e.strikes).sort((j,b)=>j.strike-b.strike),N=Math.max(1,...T.map(j=>Math.max(j.callOi,j.putOi)));return{near:T,maxOi:N,spot:S,expiry:t.nearestExpiry.expiry}},[t,e.strikes]);if(n)return o.jsx(A,{loading:!0,children:"loading strikes…"});if(!r)return o.jsx(A,{children:"no options data"});const{near:s,maxOi:a,spot:i,expiry:c}=r,u=600,l=200,d=6,h=l-d-4,g=s.length,w=u/g,v=Math.max(2,w*.34),f=S=>S*w+w/2,x=S=>S/a*h;let y=null;if(i<=s[0].strike)y=f(0);else if(i>=s[g-1].strike)y=f(g-1);else for(let S=0;S<g-1;S++)if(i>=s[S].strike&&i<=s[S+1].strike){const k=s[S+1].strike-s[S].strike||1,T=(i-s[S].strike)/k;y=f(S)+T*(f(S+1)-f(S));break}return o.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[o.jsxs("div",{className:"caption text-soft mb-1 flex justify-between",children:[o.jsxs("span",{children:["OI by strike · ",c]}),o.jsxs("span",{children:[o.jsx("span",{style:{color:_s},children:"calls"})," ·"," ",o.jsx("span",{style:{color:Cs},children:"puts"})]})]}),o.jsxs("svg",{viewBox:`0 0 ${u} ${l}`,preserveAspectRatio:"none",className:"min-h-0 w-full flex-1",children:[o.jsx("line",{x1:0,y1:d+h,x2:u,y2:d+h,stroke:"rgba(255,255,255,0.12)",strokeWidth:1}),s.map((S,k)=>{const T=f(k),N=x(S.callOi),j=x(S.putOi);return o.jsxs("g",{children:[o.jsx("rect",{x:T-v-1,y:d+h-N,width:v,height:N,fill:_s}),o.jsx("rect",{x:T+1,y:d+h-j,width:v,height:j,fill:Cs})]},S.strike)}),y!==null&&o.jsx("line",{x1:y,y1:d,x2:y,y2:d+h,stroke:"rgba(255,255,255,0.65)",strokeWidth:1,strokeDasharray:"4 3"})]}),o.jsxs("div",{className:"caption text-soft mt-1 flex justify-between tabular-nums",children:[o.jsx("span",{children:Ts(s[0].strike)}),o.jsxs("span",{className:"text-normal",children:["spot $",i.toLocaleString("en-US",{maximumFractionDigits:0})]}),o.jsx("span",{children:Ts(s[g-1].strike)})]})]})}const zx={...oi,component:Tx};ai.schema;function zs({symbol:e,price:t,changePct:n}){return o.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-2",title:`${e} · ${Oe(t)}`,children:[o.jsx(Le,{symbol:e,size:16}),o.jsx("span",{className:"body-sm truncate font-bold text-white",children:e}),o.jsx("span",{className:"caption text-soft text-right tabular-nums",children:Oe(t)}),o.jsx("span",{className:"caption text-right font-bold tabular-nums",style:{color:je(n)},children:qe(n)})]})}function Mx({config:e}){const{entries:t,isLoading:n}=Fm(),{gainers:r,losers:s}=p.useMemo(()=>{const a=t.filter(i=>i.rank<=e.minRank&&i.volume24hUsd>0).map(i=>({symbol:i.symbol,price:i.priceUsd,chg:i.changePct[e.window]??0})).sort((i,c)=>c.chg-i.chg);return{gainers:a.slice(0,e.count),losers:a.slice(-e.count).reverse()}},[t,e.window,e.count,e.minRank]);return n?o.jsx(A,{loading:!0,children:"loading movers…"}):r.length===0?o.jsx(A,{children:"no mover data"}):o.jsxs("div",{className:"grid h-full grid-cols-2 gap-x-4 overflow-hidden",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"caption text-soft uppercase tracking-wide",children:["gainers · ",e.window]}),r.map(a=>o.jsx(zs,{symbol:a.symbol,price:a.price,changePct:a.chg},a.symbol))]}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"caption text-soft uppercase tracking-wide",children:["losers · ",e.window]}),s.map(a=>o.jsx(zs,{symbol:a.symbol,price:a.price,changePct:a.chg},a.symbol))]})]})}const Ex={...ai,component:Mx},Rx=[ep,rp,op,lp,xp,yp,Cp,Mp,Ap,Fp,Lp,Hp,Wp,Kp,Jp,e0,r0,w0,_0,T0,E0,P0,L0,B0,Z0,Y0,q0,eg,rg,ag,lg,mg,pg,bg,wg,Ng,zg,$g,Fg,Lg,Bg,Yg,qg,Qg,tx,ox,cx,ux,fx,gx,vx,wx,Nx,Cx,zx,Ex];class q{constructor(t){V(this,"entries",new Map);V(this,"inflight",new Map);V(this,"namespace");V(this,"ttlMs");V(this,"persist");V(this,"staleOnError");V(this,"revive");this.namespace=t.namespace,this.ttlMs=t.ttlMs,this.persist=t.persist??!1,this.staleOnError=t.staleOnError??!0,this.revive=t.revive}get(t,n){const r=this.read(t);if(r&&Date.now()-r.at<this.ttlMs)return Promise.resolve(r.value);const s=this.inflight.get(t);if(s)return s;const a=n().then(i=>(this.write(t,i),i)).catch(i=>{if(this.staleOnError&&r)return r.value;throw i}).finally(()=>{this.inflight.delete(t)});return this.inflight.set(t,a),a}read(t){const n=this.entries.get(t);if(n)return n;if(!this.persist||typeof localStorage>"u")return null;try{const r=localStorage.getItem(this.storageKey(t));if(!r)return null;const s=JSON.parse(r);if(typeof(s==null?void 0:s.at)!="number")return null;let a;if(this.revive){const c=this.revive(s.value);if(c===null)return null;a=c}else a=s.value;const i={at:s.at,value:a};return this.entries.set(t,i),i}catch{return null}}write(t,n){const r={at:Date.now(),value:n};if(this.entries.set(t,r),!(!this.persist||typeof localStorage>"u"))try{localStorage.setItem(this.storageKey(t),JSON.stringify(r))}catch{}}storageKey(t){return`${this.namespace}:${t}`}}const Ax=1e4,Px="zframes (+https://github.com/zentryhq/zframes)";async function bi(e,{timeoutMs:t=Ax,init:n,proxied:r}){const s=new Headers(n==null?void 0:n.headers);typeof document>"u"&&!s.has("User-Agent")&&s.set("User-Agent",Px);const a=r&&typeof document<"u"?`${pf}?url=${encodeURIComponent(e)}`:e,i=await fetch(a,{...n,headers:s,signal:(n==null?void 0:n.signal)??AbortSignal.timeout(t)});if(!i.ok)throw new Error(`${e} failed: ${i.status}`);return i}async function Q(e,t,n={}){const s=await(await bi(e,n)).json();return t?t.parse(s):s}async function Bn(e,t={}){return(await bi(e,t)).text()}const $x="https://api.alternative.me/fng/",Dx=new q({namespace:"zframes:alternativeme:fng",ttlMs:45*6e4,persist:!0,revive:e=>Array.isArray(e)?e:null});class Ix{constructor(){V(this,"name","alternative.me");V(this,"capabilities",["sentiment"])}async getFearGreed(t=30){return Dx.get(String(t),async()=>{const n=await Q(`${$x}?limit=${t}`);if(!Array.isArray(n==null?void 0:n.data))throw new Error("alternative.me fng: unexpected response shape");return n.data.map(r=>({value:Number(r.value),classification:r.value_classification??"",time:Number(r.timestamp)*1e3})).filter(r=>Number.isFinite(r.value)&&Number.isFinite(r.time))})}}const Fx="https://api.bls.gov/publicAPI/v2/timeseries/data/",Ox={CUUR0000SA0:"CPI-U all items",LNS14000000:"Unemployment rate",CES0000000001:"Nonfarm payrolls",CES0500000003:"Avg hourly earnings",LNS11300000:"Labor force participation"};function Lx(e){const t=Number(e);return Number.isFinite(t)?t:null}function Ux(e,t){const n=/^M(0[1-9]|1[0-2])$/.exec(t??""),r=Number(e);if(!n||!Number.isFinite(r))return null;const s=Number(n[1]);return Date.UTC(r,s-1,1)}function Bx(e){return new Intl.DateTimeFormat("en-US",{month:"short",year:"numeric",timeZone:"UTC"}).format(e)}const Hx=new q({namespace:"zframes:macro",ttlMs:360*6e4,persist:!0,revive:e=>e&&Array.isArray(e.points)?e:null});class Vx{constructor(){V(this,"name","bls");V(this,"capabilities",["macro-series"])}async getMacroSeries(t,n,r){return Hx.get(`${t}:${n}:${r}`,()=>this.fetchMacroSeries(t,n,r))}async fetchMacroSeries(t,n,r){var u,l,d;const s=`${Fx}${encodeURIComponent(t)}?startyear=${n}&endyear=${r}`,a=await Q(s);if(a.status!=="REQUEST_SUCCEEDED")throw new Error(`bls series ${t}: ${((u=a.message)==null?void 0:u.join(", "))||"request failed"}`);const i=(d=(l=a.Results)==null?void 0:l.series)==null?void 0:d[0];if(!(i!=null&&i.data))throw new Error("bls series: unexpected response shape");const c=i.data.map(m=>{const h=Lx(m.value),g=Ux(m.year,m.period);return h===null||g===null?null:{time:g,date:Bx(g),value:h,period:`${m.year}-${m.period}`}}).filter(m=>m!==null).sort((m,h)=>m.time-h.time);return{seriesId:i.seriesID??t,label:Ox[t]??t,source:"BLS",points:c}}}const Zx="https://api.coingecko.com/api/v3/global",Gx="https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=50&page=1&sparkline=false&price_change_percentage=24h",Wx=new q({namespace:"zframes:coingecko:global",ttlMs:12*6e4,persist:!0}),Yx=new q({namespace:"zframes:coingecko:markets",ttlMs:10*6e4,persist:!0});class Xx{constructor(){V(this,"name","coingecko");V(this,"capabilities",["global-market","coin-markets"])}async getGlobalMarket(){return Wx.get("global",async()=>{var r;const t=await Q(Zx);if(!((r=t==null?void 0:t.data)!=null&&r.total_market_cap)||!t.data.market_cap_percentage)throw new Error("coingecko global: unexpected response shape");const n=Number(t.data.market_cap_change_percentage_24h_usd);return{totalMarketCapUsd:t.data.total_market_cap.usd??0,marketCapChangePct24h:Number.isFinite(n)?n:0,dominance:t.data.market_cap_percentage}})}async getCoinMarkets(){return Yx.get("markets",async()=>{const t=await Q(Gx);if(!Array.isArray(t))throw new Error("coingecko markets: unexpected response shape");return t.filter(n=>Number.isFinite(n.market_cap)&&n.market_cap>0).map(n=>({symbol:(n.symbol??"").toUpperCase(),name:n.name,marketCapUsd:n.market_cap,changePct24h:Number.isFinite(n.price_change_percentage_24h)?n.price_change_percentage_24h:void 0}))})}}const Kx=300,qx=e=>`https://api.coinpaprika.com/v1/tickers?quotes=USD&limit=${e}`,Jx=new q({namespace:"zframes:coinpaprika:movers",ttlMs:12*6e4,persist:!0}),Lt=e=>Number.isFinite(e)?e:0;class Qx{constructor(){V(this,"name","coinpaprika");V(this,"capabilities",["coin-movers"])}async getCoinMovers(t=Kx){return Jx.get(`movers:${t}`,async()=>{const n=await Q(qx(t));if(!Array.isArray(n))throw new Error("coinpaprika tickers: unexpected response shape");return n.filter(r=>{var s;return((s=r==null?void 0:r.quotes)==null?void 0:s.USD)&&Number.isFinite(r.quotes.USD.price)}).map(r=>{const s=r.quotes.USD;return{symbol:(r.symbol??"").toUpperCase(),name:r.name,rank:r.rank,priceUsd:s.price,marketCapUsd:s.market_cap,volume24hUsd:s.volume_24h,changePct:{"1h":Lt(s.percent_change_1h),"24h":Lt(s.percent_change_24h),"7d":Lt(s.percent_change_7d),"30d":Lt(s.percent_change_30d)}}})})}}const eb="https://api.llama.fi/v2/chains",tb="https://api.llama.fi/overview/dexs",nb="https://api.llama.fi/overview/fees",rb="https://api.llama.fi/protocols",an=8*6e4,vi=30*6e4,sb=new q({namespace:"zframes:defillama:tvl",ttlMs:an}),ob=new q({namespace:"zframes:defillama:dex-volume",ttlMs:an}),ab=new q({namespace:"zframes:defillama:protocol-tvl",ttlMs:an}),ib=new q({namespace:"zframes:defillama:protocol-fees",ttlMs:an}),cb=new q({namespace:"zframes:defillama:dex-history",ttlMs:vi}),lb=new q({namespace:"zframes:defillama:protocol-history",ttlMs:vi}),Ms=e=>[...e].sort().join(",");function ub(e){return Array.isArray(e)?e.map(([t,n])=>({time:t*1e3,value:Number(n)})).filter(t=>Number.isFinite(t.time)&&Number.isFinite(t.value)):[]}const Sn=e=>Number.isFinite(e)?e:void 0;class db{constructor(){V(this,"name","defillama");V(this,"capabilities",["tvl","dex-volume","protocol-tvl","protocol-fees"])}async getTvlByChain(){return sb.get("chains",async()=>{const t=await Q(eb);if(!Array.isArray(t))throw new Error("defillama chains: unexpected response shape");return t.filter(n=>Number.isFinite(n.tvl)&&n.tvl>0).sort((n,r)=>r.tvl-n.tvl).map(n=>({name:n.name,tvl:n.tvl}))})}async getDexVolume(){return ob.get("overview",async()=>{const t=await Q(tb),n=t==null?void 0:t.protocols;if(!Array.isArray(n))throw new Error("defillama dexs: unexpected response shape");return n.filter(r=>Number.isFinite(r.total24h)&&(r.total24h??0)>0).map(r=>({name:r.name,volume24h:r.total24h,changePct:Sn(r.change_1d)})).sort((r,s)=>s.volume24h-r.volume24h)})}async getDexVolumeHistory(t){return cb.get(Ms(t),async()=>{const n=await Promise.all(t.map(r=>Q(`https://api.llama.fi/summary/dexs/${encodeURIComponent(r)}?excludeTotalDataChartBreakdown=true`).then(s=>[r,ub(s.totalDataChart)]).catch(()=>[r,[]])));return Object.fromEntries(n)})}async getProtocolTvl(){return ab.get("overview",async()=>{const t=await Q(rb);if(!Array.isArray(t))throw new Error("defillama protocols: unexpected response shape");return t.filter(n=>Number.isFinite(n.tvl)&&(n.tvl??0)>0).map(n=>({name:n.name,tvl:n.tvl,category:n.category,changePct:Sn(n.change_1d)})).sort((n,r)=>r.tvl-n.tvl)})}async getProtocolTvlHistory(t){return lb.get(Ms(t),async()=>{const n=await Promise.all(t.map(r=>Q(`https://api.llama.fi/protocol/${encodeURIComponent(r)}`).then(s=>[r,(s.tvl??[]).map(a=>({time:a.date*1e3,value:Number(a.totalLiquidityUSD)})).filter(a=>Number.isFinite(a.time)&&Number.isFinite(a.value))]).catch(()=>[r,[]])));return Object.fromEntries(n)})}async getProtocolFees(){return ib.get("overview",async()=>{const t=await Q(nb),n=t==null?void 0:t.protocols;if(!Array.isArray(n))throw new Error("defillama fees: unexpected response shape");return n.filter(r=>Number.isFinite(r.total24h)&&(r.total24h??0)>0).map(r=>({name:r.name,fees24h:r.total24h,changePct:Sn(r.change_1d)})).sort((r,s)=>s.fees24h-r.fees24h)})}}const Es="https://www.deribit.com/api/v2/public",mb=new q({namespace:"zframes:deribit:summary",ttlMs:4*6e4,persist:!0}),fb=new q({namespace:"zframes:deribit:dvol",ttlMs:9*6e4,persist:!0}),hb={JAN:0,FEB:1,MAR:2,APR:3,MAY:4,JUN:5,JUL:6,AUG:7,SEP:8,OCT:9,NOV:10,DEC:11},pb=/^[A-Z]+-(\d{1,2}[A-Z]{3}\d{2})-(\d+(?:\.\d+)?)-([CP])$/;function gb(e){const t=/^(\d{1,2})([A-Z]{3})(\d{2})$/.exec(e);if(!t)return Number.POSITIVE_INFINITY;const n=Number(t[1]),r=hb[t[2]],s=2e3+Number(t[3]);return r===void 0?Number.POSITIVE_INFINITY:Date.UTC(s,r,n,8,0,0)}class xb{constructor(){V(this,"name","deribit");V(this,"capabilities",["options-summary","volatility-index"])}async getOptionsSummary(t){const n=t.toUpperCase();return mb.get(n,async()=>{const r=await Q(`${Es}/get_book_summary_by_currency?currency=${n}&kind=option`),s=r==null?void 0:r.result;if(!Array.isArray(s)||s.length===0)throw new Error("deribit options: unexpected response shape");let a=0,i=0,c=0,u=0,l=0,d=0,m=0;const h=new Map;for(const x of s){const y=pb.exec(x.instrument_name);if(!y)continue;const[,S,k,T]=y,N=Number(k),j=x.open_interest??0,b=x.volume??0,_=T==="C";_?(a+=j,c+=b):(i+=j,u+=b),Number.isFinite(x.mark_iv)&&j>0&&(l+=x.mark_iv*j,d+=j),!m&&Number.isFinite(x.underlying_price)&&(m=x.underlying_price);let P=h.get(S);P||(P=new Map,h.set(S,P));let B=P.get(N);B||(B={callOi:0,putOi:0},P.set(N,B)),_?B.callOi+=j:B.putOi+=j}const g=Date.now(),w=[...h.keys()].map(x=>({expiry:x,expiryMs:gb(x)}));w.sort((x,y)=>x.expiryMs-y.expiryMs);const v=w.find(x=>x.expiryMs>g)??w[0]??null;let f={expiry:(v==null?void 0:v.expiry)??"",expiryMs:(v==null?void 0:v.expiryMs)??0,strikes:[]};if(v){const x=h.get(v.expiry);f={expiry:v.expiry,expiryMs:v.expiryMs,strikes:[...x.entries()].map(([y,S])=>({strike:y,callOi:S.callOi,putOi:S.putOi})).sort((y,S)=>y.strike-S.strike)}}return{currency:n,underlyingPrice:m,putCallRatioOi:a>0?i/a:0,putCallRatioVolume:c>0?u/c:0,callOi:a,putOi:i,callVolume:c,putVolume:u,avgIv:d>0?l/d:0,nearestExpiry:f,asOf:Date.now()}})}async getVolatilityIndex(t,n,r){const s=t.toUpperCase();return fb.get(`${s}:${r}`,async()=>{var c;const a=await Q(`${Es}/get_volatility_index_data?currency=${s}&start_timestamp=${n}&end_timestamp=${Date.now()}&resolution=${r}`),i=(c=a==null?void 0:a.result)==null?void 0:c.data;if(!Array.isArray(i))throw new Error("deribit dvol: unexpected response shape");return i.map(u=>({time:u[0],value:u[4]})).sort((u,l)=>u.time-l.time)})}}const bb=e=>`https://cdn.finra.org/equity/regsho/daily/CNMSshvol${e}.txt`,vb="zframes (+https://github.com/zentryhq/zframes)",yb=7,wb=60*6e4,kb=new q({namespace:"zframes:finra:shortvol",ttlMs:wb});function Sb(e){const t=e.indexOf(":");return t===-1?e:e.slice(t+1)}function Nb(e){return`${e.getUTCFullYear()}${String(e.getUTCMonth()+1).padStart(2,"0")}${String(e.getUTCDate()).padStart(2,"0")}`}async function jb(e,t=15e3){const n=new Headers;typeof document>"u"&&n.set("User-Agent",vb);const r=await fetch(e,{headers:n,signal:AbortSignal.timeout(t)});if(!r.ok)throw new Error(`${e} failed: ${r.status}`);return r.text()}function _b(e){const t=e.split(/\r?\n/),n=new Map;let r="";for(let s=1;s<t.length;s++){const a=t[s].split("|");if(a.length<5)continue;const[i,c,u,l,d]=a;if(!c)continue;const m=Number(u),h=Number(d);!Number.isFinite(m)||!Number.isFinite(h)||(!r&&/^\d{8}$/.test(i)&&(r=`${i.slice(0,4)}-${i.slice(4,6)}-${i.slice(6,8)}`),n.set(c.toUpperCase(),{date:r||i,symbol:c,shortVolume:m,shortExemptVolume:Number(l)||0,totalVolume:h,shortPct:h>0?m/h*100:0}))}if(n.size===0)throw new Error("finra: empty or unparseable short-volume file");return{date:r,bySymbol:n}}class Cb{constructor(){V(this,"name","finra");V(this,"capabilities",["short-volume"])}async getShortVolume(t){const n=await this.loadReport(),r={};for(const s of t){const a=n.bySymbol.get(Sb(s).toUpperCase());a&&(r[s]=a)}return r}loadReport(){return kb.get("latest",()=>this.fetchLatest())}async fetchLatest(){const t=Date.now();for(let n=0;n<=yb;n++){const r=new Date(t-n*864e5);try{return _b(await jb(bb(Nb(r))))}catch{}}throw new Error("finra: no recent short-volume file found")}}const Tb="wss://api.hyperliquid.xyz/ws",zb="https://api.hyperliquid.xyz/info",Nn=e=>e.includes(":")?e.split(":")[0]:"";async function Ut(e){return Q(zb,void 0,{init:{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}})}class Mb{constructor(){V(this,"name","hyperliquid");V(this,"capabilities",["quote-stream","day-stats","funding-history","ohlcv","open-interest"]);V(this,"ws",null);V(this,"listeners",new Set);V(this,"reconnectTimer",null);V(this,"closedByUser",!1);V(this,"wantedDexes",new Set([""]));V(this,"subscribedDexes",new Set);V(this,"mergedMids",{})}subscribeMids(t,n){this.listeners.add(t);for(const r of n??[])this.wantedDexes.add(Nn(r));return this.ensureSocket(),this.subscribeMissingDexes(),()=>{this.listeners.delete(t),this.listeners.size===0&&this.teardown()}}async getDayStats(t){const n=new Set,r=new Set;if(!t)n.add("");else for(const i of t)i.endsWith(":*")?n.add(i.slice(0,-2)):r.add(i);const s=new Set(n);for(const i of r)s.add(Nn(i));const a={};return await Promise.all([...s].map(async i=>{const c={type:"metaAndAssetCtxs"};i&&(c.dex=i);const[u,l]=await Ut(c),d=n.has(i);u.universe.forEach((m,h)=>{if(!d&&!r.has(m.name))return;const g=l[h];if(!g)return;const w=Number(g.markPx),v=Number(g.prevDayPx);!Number.isFinite(w)||!Number.isFinite(v)||(a[m.name]={markPx:w,prevDayPx:v,changePct:v?(w-v)/v*100:0})})})),a}async getOpenInterest(t){const n=new Set,r=new Set;if(!t)n.add("");else for(const i of t)i.endsWith(":*")?n.add(i.slice(0,-2)):r.add(i);const s=new Set(n);for(const i of r)s.add(Nn(i));const a=[];return await Promise.all([...s].map(async i=>{const c={type:"metaAndAssetCtxs"};i&&(c.dex=i);const[u,l]=await Ut(c),d=n.has(i);u.universe.forEach((m,h)=>{if(!d&&!r.has(m.name))return;const g=l[h];if(!g)return;const w=Number(g.markPx),v=Number(g.openInterest);!Number.isFinite(w)||!Number.isFinite(v)||a.push({symbol:m.name,openInterestUsd:v*w})})})),a.sort((i,c)=>c.openInterestUsd-i.openInterestUsd)}async getFundingHistory(t,n){const r=await Promise.all(t.map(async s=>{const i=(await Ut({type:"fundingHistory",coin:s,startTime:n})).map(c=>({time:c.time,fundingRate:Number(c.fundingRate)})).filter(c=>Number.isFinite(c.fundingRate)&&Number.isFinite(c.time));return[s,i]}));return Object.fromEntries(r)}async getCandles(t,n,r){return(await Ut({type:"candleSnapshot",req:{coin:t,interval:n,startTime:r}})).map(a=>({time:a.t,open:Number(a.o),high:Number(a.h),low:Number(a.l),close:Number(a.c),volume:Number(a.v)}))}ensureSocket(){if(this.ws)return;this.closedByUser=!1,this.subscribedDexes=new Set;const t=new WebSocket(Tb);this.ws=t,t.onopen=()=>{this.subscribeMissingDexes()},t.onmessage=n=>{var s;let r;try{r=JSON.parse(String(n.data))}catch{return}if(!(r.channel!=="allMids"||!((s=r.data)!=null&&s.mids))){for(const[a,i]of Object.entries(r.data.mids))this.mergedMids[a]=Number(i);for(const a of this.listeners)a(this.mergedMids)}},t.onclose=()=>{this.ws=null,!this.closedByUser&&this.listeners.size>0&&(this.reconnectTimer=setTimeout(()=>this.ensureSocket(),2e3))}}subscribeMissingDexes(){const t=this.ws;if(!(!t||t.readyState!==WebSocket.OPEN))for(const n of this.wantedDexes){if(this.subscribedDexes.has(n))continue;const r={type:"allMids"};n&&(r.dex=n),t.send(JSON.stringify({method:"subscribe",subscription:r})),this.subscribedDexes.add(n)}}teardown(){var t;this.closedByUser=!0,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),(t=this.ws)==null||t.close(),this.ws=null,this.subscribedDexes=new Set,this.mergedMids={}}}const Be="https://mempool.space/api",Eb=new q({namespace:"zframes:mempool:fees",ttlMs:25e3,persist:!0}),Rb=new q({namespace:"zframes:mempool:state",ttlMs:12e3,persist:!0}),Ab=new q({namespace:"zframes:mempool:blocks",ttlMs:25e3,persist:!0}),Pb=new q({namespace:"zframes:mempool:hashrate",ttlMs:25*6e4,persist:!0}),$b=new q({namespace:"zframes:mempool:difficulty",ttlMs:5e4,persist:!0}),Db=new q({namespace:"zframes:mempool:pools",ttlMs:4*6e4,persist:!0}),Ib=new q({namespace:"zframes:mempool:lightning",ttlMs:25*6e4,persist:!0});class Fb{constructor(){V(this,"name","mempool");V(this,"capabilities",["btc-fees","btc-mempool","btc-blocks","btc-hashrate","btc-difficulty","mining-pools","lightning-stats"])}async getBtcFees(){return Eb.get("latest",async()=>{const t=await Q(`${Be}/v1/fees/recommended`);if(!t||typeof t.fastestFee!="number")throw new Error("mempool fees: unexpected response shape");return{fastest:t.fastestFee,halfHour:t.halfHourFee,hour:t.hourFee,economy:t.economyFee,minimum:t.minimumFee}})}async getMempoolState(){return Rb.get("latest",async()=>{const[t,n]=await Promise.all([Q(`${Be}/mempool`),Q(`${Be}/v1/fees/mempool-blocks`)]);if(!t||typeof t.count!="number")throw new Error("mempool state: unexpected response shape");const r=(Array.isArray(n)?n:[]).map(s=>({medianFee:s.medianFee,feeRange:Array.isArray(s.feeRange)?s.feeRange:[],totalFees:s.totalFees,nTx:s.nTx,blockVSize:s.blockVSize}));return{count:t.count,vsize:t.vsize,totalFee:t.total_fee,projected:r}})}async getBtcBlocks(t=8){return Ab.get(String(t),async()=>{const n=await Q(`${Be}/v1/blocks`);if(!Array.isArray(n))throw new Error("mempool blocks: unexpected response shape");return n.slice(0,t).map(r=>{var s,a,i,c,u,l;return{id:r.id,height:r.height,time:r.timestamp*1e3,txCount:r.tx_count,size:r.size,totalFees:((s=r.extras)==null?void 0:s.totalFees)??0,medianFee:((a=r.extras)==null?void 0:a.medianFee)??0,poolName:((c=(i=r.extras)==null?void 0:i.pool)==null?void 0:c.name)??"Unknown",poolSlug:((l=(u=r.extras)==null?void 0:u.pool)==null?void 0:l.slug)??"unknown"}})})}async getNetworkHashrate(t){return Pb.get(t,async()=>{const n=await Q(`${Be}/v1/mining/hashrate/${encodeURIComponent(t)}`);if(!n||!Array.isArray(n.hashrates))throw new Error("mempool hashrate: unexpected response shape");return{currentHashrate:n.currentHashrate,currentDifficulty:n.currentDifficulty,hashrates:n.hashrates.map(r=>({time:r.timestamp*1e3,hashrate:r.avgHashrate})),difficulty:(n.difficulty??[]).map(r=>({time:r.time*1e3,difficulty:r.difficulty}))}})}async getDifficultyAdjustment(){return $b.get("latest",async()=>{const t=await Q(`${Be}/v1/difficulty-adjustment`);if(!t||typeof t.progressPercent!="number")throw new Error("mempool difficulty: unexpected response shape");return{progressPercent:t.progressPercent,difficultyChange:t.difficultyChange,previousRetarget:t.previousRetarget,remainingBlocks:t.remainingBlocks,remainingTimeMs:t.remainingTime,estimatedRetargetDate:t.estimatedRetargetDate,nextRetargetHeight:t.nextRetargetHeight,avgBlockTimeMs:t.timeAvg}})}async getMiningPools(t){return Db.get(t,async()=>{const n=await Q(`${Be}/v1/mining/pools/${encodeURIComponent(t)}`);if(!n||!Array.isArray(n.pools))throw new Error("mempool pools: unexpected response shape");const r=n.blockCount||0;return{window:t,totalBlocks:r,pools:n.pools.map(s=>({name:s.name,slug:s.slug,blockCount:s.blockCount,sharePct:r>0?s.blockCount/r*100:0,rank:s.rank}))}})}async getLightningStats(){return Ib.get("latest",async()=>{var r,s,a;const t=await Q(`${Be}/v1/lightning/statistics/latest`),n=t==null?void 0:t.latest;if(!n||typeof n.node_count!="number")throw new Error("mempool lightning: unexpected response shape");return{nodeCount:n.node_count,channelCount:n.channel_count,totalCapacity:n.total_capacity,torNodes:n.tor_nodes,clearnetNodes:n.clearnet_nodes,medCapacity:n.med_capacity,prevNodeCount:(r=t.previous)==null?void 0:r.node_count,prevChannelCount:(s=t.previous)==null?void 0:s.channel_count,prevTotalCapacity:(a=t.previous)==null?void 0:a.total_capacity}})}}const Ob={coindesk:{url:"https://www.coindesk.com/arc/outboundfeeds/rss/",source:"CoinDesk"},cointelegraph:{url:"https://cointelegraph.com/rss",source:"Cointelegraph"},decrypt:{url:"https://decrypt.co/feed",source:"Decrypt"},cnbc:{url:"https://www.cnbc.com/id/20910258/device/rss/rss.html",source:"CNBC Markets"},nasdaq:{url:"https://www.nasdaq.com/feed/rssoutbound?category=Markets",source:"Nasdaq"}},Lb=e=>{const t=`(${e.join(" OR ")}) stock`;return`https://news.google.com/rss/search?q=${encodeURIComponent(t)}&hl=en-US&gl=US&ceid=US:en`},Rs={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};function yt(e){return e.replace(/&(#x?[0-9a-f]+|[a-z]+);/gi,(t,n)=>{const r=n.toLowerCase();if(Rs[r])return Rs[r];if(n[0]==="#"){const s=n[1]==="x"||n[1]==="X"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return Number.isFinite(s)?String.fromCodePoint(s):t}return t})}const cn=e=>e.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g,"$1");function As(e){return yt(cn(e).replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function Te(e,t){const n=e.match(new RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,"i"));return n?n[1]:void 0}function Ub(e){const t=[...e.matchAll(/<link\b[^>]*\bhref="([^"]+)"[^>]*>/gi)];if(t.length>0){const r=t.find(s=>/rel="alternate"/i.test(s[0]))??t.find(s=>!/\brel=/i.test(s[0]))??t[0];return yt(r[1]).trim()}const n=Te(e,"link");return n?yt(cn(n)).trim():void 0}function nt(e,t){const n=e.match(new RegExp(`\\b${t}\\s*=\\s*"([^"]*)"`,"i"));return n?yt(n[1]).trim():void 0}const Bt=e=>!!e&&/^https:\/\//i.test(e);function Bb(e){var s,a;const t=(s=e.match(/<media:thumbnail\b[^>]*>/i))==null?void 0:s[0];if(t){const i=nt(t,"url");if(Bt(i))return i}for(const i of e.matchAll(/<media:content\b[^>]*>/gi)){const c=nt(i[0],"medium"),u=nt(i[0],"type"),l=c==="image"||!c&&!(u!=null&&u.match(/^(audio|video)\//i)),d=nt(i[0],"url");if(l&&Bt(d))return d}for(const i of e.matchAll(/<enclosure\b[^>]*>/gi)){if(!((a=nt(i[0],"type"))!=null&&a.startsWith("image/")))continue;const c=nt(i[0],"url");if(Bt(c))return c}const n=Te(e,"content:encoded")??Te(e,"description")??Te(e,"content")??Te(e,"summary"),r=n?cn(n).match(/<img\b[^>]*\bsrc="([^"]+)"/i):null;if(r){const i=yt(r[1]).trim();if(Bt(i))return i}}function Hb(e){const t=Te(e,"pubDate")??Te(e,"published")??Te(e,"updated")??Te(e,"dc:date");if(!t)return;const n=Date.parse(cn(t).trim());return Number.isFinite(n)?n:void 0}function Ps(e,t,n){const r=[...e.matchAll(/<(item|entry)\b[\s\S]*?<\/\1>/gi)].map(a=>a[0]),s=[];for(const a of r){const i=Te(a,"title"),c=Ub(a);if(!i||!c)continue;const u=As(i);if(!u)continue;const l=Te(a,"description")??Te(a,"summary")??Te(a,"content"),d=l?As(l).slice(0,280):void 0,m=Hb(a),h=Bb(a);s.push({title:u,url:c,source:t,...d?{summary:d}:{},...m?{publishedAt:m}:{},...h?{imageUrl:h}:{}})}return s.some(a=>a.publishedAt!==void 0)&&s.sort((a,i)=>(i.publishedAt??0)-(a.publishedAt??0)),s.slice(0,n)}class Vb{constructor(){V(this,"name","news");V(this,"capabilities",["news"])}async getNews({feed:t,symbols:n,limit:r=12}){if(t==="stocks"){const i=(n??[]).map(u=>(u.split(":").pop()??"").toUpperCase()).filter(Boolean);if(i.length===0)return[];const c=await Bn(Lb(i),{proxied:!0,timeoutMs:12e3});return Ps(c,"Google News",r)}const s=Ob[t];if(!s)throw new Error(`news: unknown feed "${t}"`);const a=await Bn(s.url,{proxied:!0,timeoutMs:12e3});return Ps(a,s.source,r)}}const Zb="https://markets.newyorkfed.org/api/rates/all/latest.json",Gb={SOFR:"SOFR",SOFRAI:"SOFR averages",EFFR:"Effective fed funds",OBFR:"Overnight bank funding",TGCR:"Tri-party repo",BGCR:"Broad general collateral"},$s=["EFFR","SOFR","TGCR","BGCR","OBFR","SOFRAI"],Wb=new q({namespace:"zframes:nyfed:rates",ttlMs:12*6e4,persist:!0,revive:e=>Array.isArray(e)?e:null});function Ke(e){const t=Number(e);return Number.isFinite(t)?t:null}function Yb(e,t){const n=$s.indexOf(e.code),r=$s.indexOf(t.code);return(n===-1?99:n)-(r===-1?99:r)}class Xb{constructor(){V(this,"name","nyfed");V(this,"capabilities",["reference-rates"])}async getReferenceRates(){return Wb.get("latest",async()=>{const t=await Q(Zb);if(!Array.isArray(t==null?void 0:t.refRates))throw new Error("ny fed rates: unexpected response shape");return t.refRates.map(n=>{const r=String(n.type??""),s=Ke(n.percentRate??n.average30day);if(!r||!n.effectiveDate||s===null)return null;const a={code:r,label:Gb[r]??r,date:n.effectiveDate,rate:s,source:"New York Fed"},i=Ke(n.volumeInBillions),c=Ke(n.targetRateFrom),u=Ke(n.targetRateTo),l=Ke(n.average30day),d=Ke(n.average90day),m=Ke(n.average180day);return i!==null&&(a.volumeInBillions=i),c!==null&&(a.targetRateFrom=c),u!==null&&(a.targetRateTo=u),l!==null&&(a.average30Day=l),d!==null&&(a.average90Day=d),m!==null&&(a.average180Day=m),a}).filter(n=>n!==null).sort(Yb)})}}const Kb="https://www.financialresearch.gov/financial-stress-index/data/fsi.csv",qb=60*6e4,Jb=new q({namespace:"zframes:ofr:fsi",ttlMs:qb}),Qb=[[2,"Credit"],[3,"Equity valuation"],[4,"Safe assets"],[5,"Funding"],[6,"Volatility"]];function Ds(e){const t=Number(e);return Number.isFinite(t)?t:null}function ev(e){const t=e.split(/\r?\n/),n=[];let r=null;for(let i=1;i<t.length;i++){const c=t[i].split(",");if(c.length<7)continue;const u=c[0],l=Ds(c[1]),d=Date.parse(`${u}T00:00:00Z`);!u||l===null||!Number.isFinite(d)||(n.push({time:d,date:u,value:l}),r=c)}if(!r||n.length===0)throw new Error("ofr fsi: empty or unparseable CSV");const s=n[n.length-1],a=Qb.map(([i,c])=>({label:c,value:Ds(r[i])??0}));return{value:s.value,date:s.date,categories:a,trend:n.slice(-90),source:"OFR"}}class tv{constructor(){V(this,"name","ofr");V(this,"capabilities",["financial-stress"])}async getFinancialStress(){return Jb.get("latest",()=>Bn(Kb,{proxied:!0}).then(ev))}}const nv={A:1090872,AAPL:320193,ABBV:1551152,ABEV:1565025,ABNB:1559720,ABT:1800,ACGL:947484,ACN:1467373,ADBE:796343,ADI:6281,ADM:7084,ADP:8670,ADSK:769397,AEE:1002910,AEM:2809,AEP:4904,AFL:4977,AIG:5272,AJG:354190,ALAB:1736297,ALC:1167379,ALL:899051,ALNY:1178670,AMAT:6951,AMD:2488,AME:1037868,AMGN:318154,AMP:820027,AMRZ:2035989,AMT:1053507,AMX:1129137,AMZN:1018724,ANET:1596532,AON:315293,APD:2969,APH:820313,APO:1858681,APP:1751008,ARES:1176948,ARGX:1697862,ARM:1973239,ASML:937966,ASTS:1780312,ASX:1122411,ATEYY:1158838,ATO:731802,AU:1973832,AVGO:1730168,AXON:1069183,AXP:4962,AZN:901832,AZO:866787,B:756894,BA:12927,BABA:1577552,BAC:70858,BAESY:895564,BAM:1937926,BBD:1160330,BBVA:842180,BCS:312069,BDX:10795,BE:1664703,BHP:811809,BIDU:1329099,BIIB:875045,BKNG:1075531,BKR:1701605,BLK:2012383,BMO:927971,BMWKY:1446250,BMY:14272,BN:1001085,BNS:9631,BNY:1390777,BP:313807,"BRK-A":1067983,"BRK-B":1067983,BSBR:1471055,BSX:885725,BTI:1303523,BUD:1668717,BX:1393818,C:831001,CAH:721371,CARR:1783180,CAT:18230,CB:896159,CBOE:1374310,CBRE:1138118,CBRS:2021728,CCEP:1650107,CCI:1051470,CCJ:1009001,CCL:815097,CDNS:813672,CEG:1868275,CHT:1132924,CI:1739940,CIEN:936395,CKHGF:1469059,CL:21665,CLS:1030894,CM:1045520,CMCSA:1166691,CME:1156375,CMG:1058090,CMI:26172,CNC:1071739,CNI:16868,CNQ:1017413,COF:927628,COHR:820318,COIN:1679788,COP:1163165,COR:1140859,COST:909832,CP:16875,CPRT:900075,CQP:1383650,CRDO:1807794,CRH:849395,CRM:1108524,CRWD:1535527,CRWV:1769628,CSCO:858877,CSLLY:1274152,CSX:277948,CTAS:723254,CTVA:1755672,CVE:1475260,CVNA:1690820,CVS:64803,CVX:93410,CYATY:2070829,D:715957,DAL:27904,DASH:1792789,DB:1159508,DDOG:1561550,DE:315189,DELL:1571996,DEO:835403,DHI:882184,DHR:313616,DIA:1041130,DIS:1744489,DLMAY:2073893,DLR:1297996,DOV:29905,DTE:936340,DTEGY:946770,DUK:1326160,DVN:1090012,E:1002242,EA:712515,EBAY:1065088,EC:1444406,ECL:31462,ED:1047862,EIX:827052,EL:1001250,ELV:1156039,EME:105634,EMR:32604,ENB:895728,EOG:821189,EONGY:1136808,EPD:1061219,EQIX:1101239,EQNR:1140625,EQT:33213,ERIC:717826,ESLT:1027664,ET:1276187,ETN:1551182,ETR:65984,EW:1099800,EXC:1109357,EXR:1289490,F:37996,FANG:1539838,FAST:815556,FCX:831259,FDX:1048911,FER:1468522,FERG:2011641,FISV:798354,FITB:35527,FIX:1035983,FLEX:866374,FMX:1061736,FNV:1456346,FOX:1754301,FOXA:1754301,FRFHF:915191,FSLR:1274494,FTNT:1262039,FTS:1666175,GALDY:2021390,GD:40533,GE:40545,GEHC:1932393,GEV:1996810,GFI:1172724,GFS:1709048,GILD:882095,GLD:1222333,GLW:24741,GM:1467858,GOOG:1652044,GOOGL:1652044,GRMN:1121788,GS:886982,GSK:1131399,GWLIF:850918,GWW:277135,HAL:45012,HBAN:49196,HCA:860730,HD:354950,HDB:1144967,HEI:46619,HIG:874766,HLN:1900304,HLT:1585689,HMC:715153,HON:773840,HOOD:1783879,HPE:1645590,HSBC:1089113,HSY:47111,HTHIY:47710,HUM:49071,HWM:4281,IBKR:1381197,IBM:51143,IBN:1103838,ICE:1571949,IDXX:874716,IFNNY:1107457,IMO:49938,INFY:1067491,ING:1039765,INTC:50863,INTU:896878,IQV:1478242,IR:1699150,IRM:1020569,ISRG:1035267,ITUB:1132597,ITW:49826,IX:1070304,JBL:898293,JCI:833444,JD:1549802,JHPCY:2071868,JNJ:200406,JPM:19617,KB:1445930,KBGGY:1535759,KDP:1418135,KEYS:1601046,KGC:701818,KKR:1404912,KLAC:319201,KMB:55785,KMI:1506307,KO:21344,KR:56873,KVUE:1944048,KXIAY:2053383,LHX:202058,LIN:1707925,LITE:1633978,LLY:59478,LMT:936468,LNG:3570,LOW:60667,LRCX:707549,LSEGY:1842726,LVS:1300514,LYG:1160106,LYV:1335258,MA:1141391,MAR:1048286,MCD:63908,MCHP:827054,MCK:927653,MCO:1059556,MDLN:2046386,MDLZ:1103982,MDT:1613103,MELI:1099590,MET:1099219,META:1326801,MFC:1086888,MFG:1335730,MGCLY:2039784,MLM:916076,MMM:66740,MNST:865752,MO:764180,MPC:1510295,MPLX:1552e3,MPWR:1280452,MRK:310158,MRSH:62709,MRVL:1835632,MS:895421,MSCI:1408198,MSFT:789019,MSI:68505,MSTR:1050446,MT:1243429,MTB:36270,MTZ:15615,MU:723125,MUFG:67088,NBIS:1513845,NDAQ:1120193,NEE:753308,NEM:1164727,NET:1477333,NFLX:1065280,NGG:1004315,NKE:320187,NOC:1133421,NOK:924613,NOW:1373715,NSC:702165,NTAP:1002047,NTES:1110646,NTR:1725964,NTRA:1604821,NTRS:73124,NU:1691493,NUE:73309,NVDA:1045810,NVO:353278,NVS:1114448,NWG:844150,NWS:1564708,NWSA:1564708,NXPI:1413447,O:726728,ODFL:878927,OKE:1039684,ON:1097864,ORCL:1341439,ORLY:898173,OXY:797468,PANW:1327567,PAYX:723531,PBA:1546066,PBR:1119639,PCAR:75362,PCG:1004980,PDD:1737806,PEG:788784,PEP:77476,PFE:78003,PG:80424,PGR:80661,PH:76334,PLD:1045609,PLTR:1321655,PM:1413329,PNC:713676,PRU:1137774,PSA:1393311,PSX:1534701,PUK:1116578,PWR:1050915,PYPL:1633917,Q:2058873,QCOM:804328,QQQ:1067839,QSR:1618756,RACE:1648416,RBLX:1315098,RCL:884887,RDDT:1713445,REGN:872589,RELX:929869,RIO:863064,RJF:720005,RKLB:1819994,RKT:1805284,RMD:943819,ROK:1024478,ROP:882835,ROST:745732,RPRX:1802768,RSG:1060391,RSHGY:1447391,RTNTF:887028,RTX:101829,RVMD:1628171,RY:1000275,RYAAY:1038683,SAN:891478,SAP:1000184,SATS:1415404,SBUX:829224,SCCO:1001838,SCHW:316709,SCMWY:1069336,SE:1703399,SHEL:1306965,SHG:1263043,SHOP:1594805,SHW:89800,SLB:87347,SLF:1097362,SLV:1330568,SMERY:1830056,SMFG:1022837,SNDK:2023554,SNHIY:2098326,SNOW:1640147,SNPS:883241,SNY:1121404,SO:92122,SONY:313838,SPG:1063761,SPGI:64040,SPOT:1639920,SPY:884394,SRE:1032208,STLD:1022671,STM:932787,STT:93751,STX:1137789,SU:311337,SUNB:2083785,SYK:310764,SYY:96021,T:732717,TAK:1395064,TCOM:1269238,TD:947263,TDG:1260221,TECK:886986,TEL:1385157,TER:97210,TEVA:818686,TFC:92230,TGT:27419,TJX:109198,TKO:1973266,TM:1094517,TMO:97745,TMUS:1283699,TPR:1116132,TRGP:1389170,TRI:1075124,TRMOY:2071881,TRP:1232384,TRV:86312,TS:1190723,TSLA:1318605,TT:1466258,TTE:879764,TTWO:946581,TWLO:1447669,TXN:97476,TYHOY:2018139,UA:1336917,UAA:1336917,UAL:100517,UBER:1543151,UBS:1610520,UI:1511737,UL:217410,UMC:1033767,UNH:731766,UNP:100885,UPS:1090727,URI:1067701,USB:36104,V:1403161,VALE:917851,VG:2007855,VICI:1705696,VIK:1745201,VLO:1035002,VMC:1396009,VOD:839923,VRT:1674101,VRTX:875320,VST:1692819,VTR:740260,VZ:732712,WAB:943452,WAT:1000697,WBD:1437107,WCN:1318220,WDAY:1327811,WDC:106040,WEC:783325,WELL:766704,WFC:72971,WM:823768,WMB:107263,WMT:104169,WPM:1323404,XEL:72903,XOM:34088,XYZ:1512673,YUM:1041061,ZM:1585521,ZTS:1555280};function Hn(e){return String(e).replace(/\D/g,"").padStart(10,"0")}function Is(e){const t=e.trim(),n=/^cik[-\s]?(\d{1,10})$/i.exec(t)??/^(\d{1,10})$/.exec(t);if(n)return n[1].padStart(10,"0");const r=(t.includes(":")?t.slice(t.lastIndexOf(":")+1):t).toUpperCase().replace(/[^A-Z0-9.-]/g,""),s=nv[r];return s===void 0?null:Hn(s)}const rv=e=>`https://data.sec.gov/submissions/CIK${e}.json`,sv=e=>`https://data.sec.gov/api/xbrl/companyfacts/CIK${e}.json`,yi=15*6e4,ov=new q({namespace:"zframes:sec:filings",ttlMs:yi}),av=new q({namespace:"zframes:sec:facts",ttlMs:yi});function iv(e,t,n){const r=String(Number(e)),s=t.replace(/-/g,""),a=`https://www.sec.gov/Archives/edgar/data/${r}/${s}`;return n?`${a}/${n}`:`${a}/`}const cv=[{label:"Revenue",unit:"USD",taxonomy:"us-gaap",kind:"flow",concepts:["RevenueFromContractWithCustomerExcludingAssessedTax","Revenues","SalesRevenueNet"]},{label:"Net income",unit:"USD",taxonomy:"us-gaap",kind:"flow",concepts:["NetIncomeLoss"]},{label:"Total assets",unit:"USD",taxonomy:"us-gaap",kind:"instant",concepts:["Assets"]},{label:"Shareholders' equity",unit:"USD",taxonomy:"us-gaap",kind:"instant",concepts:["StockholdersEquity"]},{label:"Diluted EPS",unit:"USD/shares",taxonomy:"us-gaap",kind:"flow",concepts:["EarningsPerShareDiluted","EarningsPerShareBasic"]},{label:"Shares outstanding",unit:"shares",taxonomy:"dei",kind:"instant",concepts:["EntityCommonStockSharesOutstanding"]}];function lv(e){return e.fy?e.fp==="FY"?`FY${e.fy}`:`${e.fp??""} ${e.fy}`.trim():e.end??""}function uv(e,t){const n=e.filter(s=>s.end&&s.form&&Number.isFinite(s.val));return(t==="flow"&&n.some(s=>s.fp==="FY")?n.filter(s=>s.fp==="FY"):n).reduce((s,a)=>!s||a.end>s.end?a:s,null)}function dv(e){var n,r;if(!e)return[];const t=[];for(const s of cv){const a=e[s.taxonomy];if(!a)continue;let i=null;for(const c of s.concepts){const u=(r=(n=a[c])==null?void 0:n.units)==null?void 0:r[s.unit];if(!(u!=null&&u.length))continue;const l=uv(u,s.kind);l&&(!i||l.end>i.end)&&(i=l)}i&&t.push({label:s.label,value:i.val,unit:s.unit,end:i.end,fiscalPeriod:lv(i),form:i.form})}return t}class mv{constructor(t){V(this,"name","sec");V(this,"capabilities",["filings","fundamentals"]);this.contact=t}nodeInit(){return this.contact&&typeof document>"u"?{init:{headers:{"User-Agent":`zframes (${this.contact})`}}}:void 0}async getCompanyFacts(t){const n=Is(t);if(!n)throw new Error(`sec: unknown ticker "${t}" — not in the bundled map; pass a CIK (e.g. "320193") instead`);return av.get(n,()=>this.fetchCompanyFacts(n))}async fetchCompanyFacts(t){const n=await Q(sv(t),void 0,{proxied:!0,...this.nodeInit()}),r=dv(n.facts);if(r.length===0)throw new Error("sec companyfacts: no headline metrics found");return{cik:Hn(n.cik??t),entityName:n.entityName??"",metrics:r}}async getCompanyFilings(t){const n=Is(t);if(!n)throw new Error(`sec: unknown ticker "${t}" — not in the bundled map; pass a CIK (e.g. "320193") instead`);return ov.get(n,()=>this.fetchFilings(n))}async fetchFilings(t){var i,c,u,l,d,m,h;const n=await Q(rv(t),void 0,this.nodeInit()),r=(i=n.filings)==null?void 0:i.recent;if(!r||!Array.isArray(r.accessionNumber))throw new Error("sec submissions: unexpected response shape");const s=r.accessionNumber.length,a=[];for(let g=0;g<s;g++){const w=r.accessionNumber[g],v=(c=r.form)==null?void 0:c[g],f=(u=r.filingDate)==null?void 0:u[g];if(!w||!v||!f)continue;const x=(l=r.reportDate)==null?void 0:l[g],y=(d=r.primaryDocDescription)==null?void 0:d[g],S=(m=r.items)==null?void 0:m[g];a.push({form:v,filingDate:f,accessionNumber:w,url:iv(t,w,(h=r.primaryDocument)==null?void 0:h[g]),...x?{reportDate:x}:{},...y?{description:y}:{},...S?{items:S}:{}})}return{cik:Hn(n.cik??t),name:n.name??"",tickers:n.tickers??[],exchanges:n.exchanges??[],filings:a,...n.sic?{sic:n.sic}:{},...n.sicDescription?{sicDescription:n.sicDescription}:{},...n.category?{category:n.category}:{},...n.fiscalYearEnd?{fiscalYearEnd:n.fiscalYearEnd}:{}}}}const fv="https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/avg_interest_rates?sort=-record_date&page%5Bsize%5D=20&format=json",hv=e=>`https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?sort=-record_date&page%5Bsize%5D=${e}&format=json`,pv=e=>`https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/auctions_query?sort=-auction_date&filter=bid_to_cover_ratio:gt:0&fields=auction_date,security_type,security_term,high_yield,high_discnt_rate,high_investment_rate,bid_to_cover_ratio,offering_amt,total_accepted&page%5Bsize%5D=${e}&format=json`,gv=e=>`https://home.treasury.gov/resource-center/data-chart-center/interest-rates/pages/xml?data=daily_treasury_yield_curve&field_tdr_date_value_month=${e}`,xv="zframes (+https://github.com/zentryhq/zframes)",ln=180*6e4,bv=new q({namespace:"zframes:treasury:yield-curve",ttlMs:ln,persist:!0}),vv=new q({namespace:"zframes:treasury:avg-rates",ttlMs:ln,persist:!0}),yv=new q({namespace:"zframes:treasury:national-debt",ttlMs:ln,persist:!0}),wv=new q({namespace:"zframes:treasury:auctions",ttlMs:ln,persist:!0}),kv=[["BC_1MONTH","1M",1],["BC_2MONTH","2M",2],["BC_3MONTH","3M",3],["BC_4MONTH","4M",4],["BC_6MONTH","6M",6],["BC_1YEAR","1Y",12],["BC_2YEAR","2Y",24],["BC_3YEAR","3Y",36],["BC_5YEAR","5Y",60],["BC_7YEAR","7Y",84],["BC_10YEAR","10Y",120],["BC_20YEAR","20Y",240],["BC_30YEAR","30Y",360]];function Ae(e){const t=Number(e);return Number.isFinite(t)?t:null}async function Sv(e,t=15e3){const n=new Headers;typeof document>"u"&&n.set("User-Agent",xv);const r=await fetch(e,{headers:n,signal:AbortSignal.timeout(t)});if(!r.ok)throw new Error(`${e} failed: ${r.status}`);return r.text()}function Nv(e){return`${e.getUTCFullYear()}${String(e.getUTCMonth()+1).padStart(2,"0")}`}function jv(e){const t=e.match(/<m:properties>[\s\S]*?<\/m:properties>/g);if(!(t!=null&&t.length))return null;let n=null;for(const s of t){const a=/<d:NEW_DATE[^>]*>([^<]+)<\/d:NEW_DATE>/.exec(s);if(!a)continue;const i=a[1].slice(0,10);(!n||i>n.date)&&(n={date:i,raw:s})}if(!n)return null;const r=[];for(const[s,a,i]of kv){const c=new RegExp(`<d:${s}[^>]*>([^<]*)</d:${s}>`).exec(n.raw),u=c?Number(c[1]):NaN;Number.isFinite(u)&&r.push({label:a,months:i,rate:u})}return r.length?{date:n.date,points:r}:null}class _v{constructor(){V(this,"name","treasury");V(this,"capabilities",["treasury-rates","yield-curve","treasury-auctions","national-debt"])}async getYieldCurve(){return bv.get("latest",()=>this.fetchYieldCurve())}async fetchYieldCurve(){const t=new Date;for(let n=0;n<=1;n++){const r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()-n,1)),s=await Sv(gv(Nv(r))).catch(()=>""),a=jv(s);if(a)return a}throw new Error("treasury yield curve: no recent data")}async getTreasuryAverageRates(){return vv.get("latest",()=>this.fetchTreasuryAverageRates())}async fetchTreasuryAverageRates(){var r;const t=await Q(fv);if(!Array.isArray(t==null?void 0:t.data))throw new Error("treasury average rates: unexpected response shape");const n=(r=t.data.find(s=>s.record_date))==null?void 0:r.record_date;return n?t.data.filter(s=>s.record_date===n).map(s=>{const a=Ae(s.avg_interest_rate_amt);return a===null||!s.security_type_desc||!s.security_desc?null:{date:n,securityType:s.security_type_desc,security:s.security_desc,rate:a}}).filter(s=>s!==null):[]}async getNationalDebt(t=180){return yv.get(String(t),()=>this.fetchNationalDebt(t))}async fetchNationalDebt(t){const n=Math.max(2,Math.min(t,400)),r=await Q(hv(n),void 0,{proxied:!0});if(!Array.isArray(r==null?void 0:r.data)||r.data.length===0)throw new Error("treasury debt to the penny: unexpected response shape");const s=[];for(let i=r.data.length-1;i>=0;i--){const c=r.data[i],u=Ae(c.tot_pub_debt_out_amt),l=Date.parse(`${c.record_date}T00:00:00Z`);!c.record_date||u===null||!Number.isFinite(l)||s.push({time:l,date:c.record_date,total:u})}if(s.length===0)throw new Error("treasury debt to the penny: no usable rows");const a=r.data[0];return{date:a.record_date??s[s.length-1].date,total:Ae(a.tot_pub_debt_out_amt)??s[s.length-1].total,heldByPublic:Ae(a.debt_held_public_amt)??0,intragovernmental:Ae(a.intragov_hold_amt)??0,trend:s}}async getTreasuryAuctions(t=8){return wv.get(String(t),()=>this.fetchTreasuryAuctions(t))}async fetchTreasuryAuctions(t){const n=Math.max(1,Math.min(t,30)),r=await Q(pv(n),void 0,{proxied:!0});if(!Array.isArray(r==null?void 0:r.data))throw new Error("treasury auctions: unexpected response shape");return r.data.map(s=>{if(!s.auction_date||!s.security_type)return null;const a=Ae(s.high_yield)??Ae(s.high_investment_rate);return{auctionDate:s.auction_date,securityType:s.security_type,securityTerm:s.security_term??"",rate:a,bidToCover:Ae(s.bid_to_cover_ratio),offeringAmount:Ae(s.offering_amt),totalAccepted:Ae(s.total_accepted)}}).filter(s=>s!==null)}}const Cv=p.lazy(()=>Vs(()=>import("./index-DPlG_EDx.js"),__vite__mapDeps([0,1]))),Tv="/unicornStudio.umd.mjs",zv="invert(1) hue-rotate(180deg) saturate(1.25)",Mv="opacity 0.5s var(--zf-ease-out), filter 0.5s var(--zf-ease-out)",Ev=e=>Math.min(.42,e*2.4);function Rv({background:e,active:t=!1}){return e.type!=="unicorn"||!e.projectId?null:o.jsx("div",{"aria-hidden":!0,style:{position:"fixed",inset:0,zIndex:0,overflow:"hidden",pointerEvents:"none"},children:o.jsx("div",{style:{position:"absolute",inset:0,opacity:t?Ev(e.opacity):e.opacity,filter:t?zv:"none",transition:Mv,willChange:"opacity, filter"},children:o.jsx(p.Suspense,{fallback:null,children:o.jsx(Cv,{projectId:e.projectId,width:"100vw",height:"100vh",scale:e.scale,dpi:e.dpi,sdkUrl:Tv})})})})}const Av=["xyz:*"],Pv=200,$v="#3fd08f",Dv="#ff6b81";function Iv(e){return e>=1e3?`$${e.toLocaleString("en-US",{maximumFractionDigits:0})}`:e>=1?`$${e.toLocaleString("en-US",{maximumFractionDigits:2})}`:`$${e.toPrecision(4)}`}const Fv=`
371
- .zf-tape {
372
- position: fixed;
373
- left: 0;
374
- right: 0;
375
- bottom: 0;
376
- z-index: 30;
377
- height: 36px;
378
- display: flex;
379
- align-items: center;
380
- overflow: hidden;
381
- background: rgba(10, 11, 17, 0.86);
382
- backdrop-filter: blur(10px);
383
- -webkit-backdrop-filter: blur(10px);
384
- border-top: 1px solid rgba(255, 255, 255, 0.08);
385
- font-family: var(--font-dmsans, system-ui, sans-serif);
386
- -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
387
- mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
388
- }
389
- .zf-tape-track {
390
- display: flex;
391
- flex-shrink: 0;
392
- align-items: center;
393
- white-space: nowrap;
394
- will-change: transform;
395
- animation-name: zf-tape-scroll;
396
- animation-timing-function: linear;
397
- animation-iteration-count: infinite;
398
- }
399
- .zf-tape:hover .zf-tape-track { animation-play-state: paused; }
400
- .zf-tape-item {
401
- display: inline-flex;
402
- align-items: center;
403
- gap: 7px;
404
- padding: 0 15px;
405
- border-right: 1px solid rgba(255, 255, 255, 0.06);
406
- font-size: 12px;
407
- line-height: 1;
408
- }
409
- .zf-tape-sym { font-weight: 700; color: rgba(255, 255, 255, 0.92); letter-spacing: 0.02em; }
410
- .zf-tape-px { color: rgba(255, 255, 255, 0.58); font-variant-numeric: tabular-nums; }
411
- .zf-tape-chg { font-weight: 600; font-variant-numeric: tabular-nums; }
412
- @keyframes zf-tape-scroll {
413
- from { transform: translateX(0); }
414
- to { transform: translateX(-50%); }
415
- }
416
- @media (prefers-reduced-motion: reduce) {
417
- .zf-tape { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
418
- .zf-tape-track { animation: none; }
419
- }
420
- `;function Ov(){const e=Pn(Av,6e4),t=Pn(void 0,6e4),{symbols:n,stats:r}=p.useMemo(()=>{const c=l=>Object.entries(l).filter(([,d])=>d.markPx>0&&d.prevDayPx>0).map(([d])=>d).sort();return{symbols:[...c(e),...c(t)].slice(0,Pv),stats:{...t,...e}}},[e,t]),s=tr(n);if(n.length===0)return null;const a=Math.max(40,n.length*2.2),i=c=>n.map(u=>{const l=r[u];if(!l)return null;const d=s[u]??l.markPx,m=l.changePct>=0?$v:Dv,h=l.changePct>=0?"+":"";return o.jsxs("span",{className:"zf-tape-item",children:[o.jsx(Le,{symbol:u,size:15}),o.jsx("span",{className:"zf-tape-sym",children:le(u)}),o.jsx("span",{className:"zf-tape-px",children:Iv(d)}),o.jsxs("span",{className:"zf-tape-chg",style:{color:m},children:[h,l.changePct.toFixed(2),"%"]})]},`${c}-${u}`)});return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:Fv}),o.jsx("div",{className:"zf-tape","aria-label":"live ticker tape",children:o.jsxs("div",{className:"zf-tape-track",style:{animationDuration:`${a}s`},children:[i("a"),o.jsx("span",{"aria-hidden":!0,style:{display:"contents"},children:i("b")})]})})]})}const Fs="(max-width: 640px)";function Lv(){const[e,t]=p.useState(()=>window.matchMedia(Fs).matches);return p.useEffect(()=>{const n=window.matchMedia(Fs),r=()=>t(n.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const Uv="/unicornStudio.legacy.umd.mjs";let rt=null;function Bv(){return typeof window>"u"||typeof document>"u"?Promise.reject(new Error("UnicornStudio needs a browser")):rt||(rt=(async()=>{const t=`const module={exports:{}};const exports=module.exports;
421
- `+await fetch(Uv).then(r=>{if(!r.ok)throw new Error(`failed to load UnicornStudio (${r.status})`);return r.text()})+`
422
- export default module.exports;`,n=URL.createObjectURL(new Blob([t],{type:"text/javascript"}));try{const s=(await import(n)).default;if(!(s!=null&&s.addScene))throw new Error("UnicornStudio engine missing addScene");return s}finally{URL.revokeObjectURL(n)}})(),rt.catch(()=>{rt=null}),rt)}class Hv{constructor(t){V(this,"_url");this._raw=t;const n=URL.createObjectURL(new Blob([JSON.stringify(this._raw)],{type:"application/json"}));this._url=n}get url(){return this._url}}const Os=new Hv({history:[{breakpoints:[],visible:!0,aspectRatio:1,userDownsample:1,layerType:"effect",type:"gradient",usesPingPong:!1,speed:.25,trackMouse:0,mouseMomentum:0,texture:!1,animating:!1,isMask:0,compiledFragmentShaders:[`#version 300 es
423
- precision highp float;in vec2 vTextureCoord;uniform vec2 uMousePos;vec3 getColor(int index) { switch(index) { case 0: return vec3(1, 1, 1); case 1: return vec3(0, 0, 0); case 2: return vec3(0, 0, 0); case 3: return vec3(0, 0, 0); case 4: return vec3(0, 0, 0); case 5: return vec3(0, 0, 0); case 6: return vec3(0, 0, 0); case 7: return vec3(0, 0, 0); case 8: return vec3(0, 0, 0); case 9: return vec3(0, 0, 0); case 10: return vec3(0, 0, 0); case 11: return vec3(0, 0, 0); case 12: return vec3(0, 0, 0); case 13: return vec3(0, 0, 0); case 14: return vec3(0, 0, 0); case 15: return vec3(0, 0, 0); default: return vec3(0.0); } }const float PI = 3.14159265;vec2 rotate(vec2 coord, float angle) { float s = sin(angle); float c = cos(angle); return vec2( coord.x * c - coord.y * s, coord.x * s + coord.y * c ); }out vec4 fragColor;vec3 getColor(vec2 uv) {return vec3(1, 1, 1); }void main() {vec2 uv = vTextureCoord; vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); uv -= pos; uv /= (0.5000*2.); uv = rotate(uv, (0.0000 - 0.5) * 2. * PI); vec4 color = vec4(getColor(uv), 1.); fragColor = color; }`],compiledVertexShaders:[`#version 300 es
424
- precision mediump float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vTextureCoord = aTextureCoord; }`],data:{downSample:.5,depth:!1,uniforms:{},isBackground:!0},id:"effect"},{breakpoints:[],visible:!0,locked:!1,aspectRatio:1.0793650793650795,layerName:"",userDownsample:1,isElement:!0,opacity:1,effects:[],displace:0,trackMouse:0,anchorPoint:"center",mouseMomentum:0,blendMode:"NORMAL",bgDisplace:0,mask:0,maskBackground:{type:"Vec3",_x:0,_y:0,_z:0},maskAlpha:0,maskDepth:0,dispersion:0,axisTilt:0,states:{appear:[],scroll:[],hover:[]},layerType:"shape",width:.49660178547135064,widthMode:"relative",height:.4600869483043395,heightMode:"auto",left:.35409161821999585,leftMode:"relative",top:.6850280273460352,topMode:"relative",rotation:0,pos:{type:"Vec2",_x:.5,_y:.5},borderRadius:0,gradientAngle:0,strokeWidth:0,coords:[[0,0],[.49660178547135064,0],[.49660178547135064,.4600869483043395],[0,.4600869483043395]],fill:["#7001D7"],fitToCanvas:!1,gradientType:"linear",type:"circle",stroke:["#000000"],numSides:3,compiledFragmentShaders:[`#version 300 es
425
- precision highp float; in vec2 vTextureCoord; in vec3 vVertexPosition;uniform sampler2D uBgTexture; uniform sampler2D uTexture; uniform vec2 uMousePos; uniform int uSampleBg;out vec4 fragColor;void main() { vec2 uv = vTextureCoord; vec2 pos = mix(vec2(0), (uMousePos - 0.5), 0.0000);uv = uv - pos;vec4 color = texture(uTexture, uv); vec4 background = vec4(0);if(uSampleBg == 1) { background = texture(uBgTexture, vTextureCoord); }color = mix(background, color / max(color.a, 0.0001), color.a * 1.0000);fragColor = color; }`],compiledVertexShaders:[`#version 300 es
426
- precision highp float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix; uniform vec2 uMousePos;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { float angleX = uMousePos.y * 0.5 - 0.25; float angleY = (1.-uMousePos.x) * 0.5 - 0.25;mat4 rotateX = mat4(1.0, 0.0, 0.0, 0.0, 0.0, cos(angleX), -sin(angleX), 0.0, 0.0, sin(angleX), cos(angleX), 0.0, 0.0, 0.0, 0.0, 1.0); mat4 rotateY = mat4(cos(angleY), 0.0, sin(angleY), 0.0, 0.0, 1.0, 0.0, 0.0, -sin(angleY), 0.0, cos(angleY), 0.0, 0.0, 0.0, 0.0, 1.0);mat4 rotationMatrix = rotateX * rotateY; gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vVertexPosition = (rotationMatrix * vec4(aVertexPosition, 1.0)).xyz; vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{uniforms:{}},id:"shape"},{breakpoints:[],visible:!0,locked:!1,aspectRatio:1.0158730158730158,layerName:"",userDownsample:1,isElement:!0,opacity:1,effects:[],displace:0,trackMouse:0,anchorPoint:"center",mouseMomentum:0,blendMode:"MULTIPLY",bgDisplace:0,mask:0,maskBackground:{type:"Vec3",_x:0,_y:0,_z:0},maskAlpha:0,maskDepth:0,dispersion:0,axisTilt:0,states:{appear:[],scroll:[],hover:[]},layerType:"shape",width:.46738991573774175,widthMode:"relative",height:.46008694830433955,heightMode:"auto",left:.7457263018329404,leftMode:"relative",top:.5757566919333954,topMode:"relative",rotation:0,pos:{type:"Vec2",_x:.5,_y:.5},borderRadius:0,gradientAngle:0,strokeWidth:0,coords:[[0,0],[.46738991573774175,0],[.46738991573774175,.46008694830433955],[0,.46008694830433955]],fill:["#4E21AC"],fitToCanvas:!1,gradientType:"linear",type:"circle",stroke:["#000000"],numSides:3,compiledFragmentShaders:[`#version 300 es
427
- precision highp float; in vec2 vTextureCoord; in vec3 vVertexPosition;uniform vec2 uResolution; uniform vec2 uMousePos; uniform sampler2D uBgTexture; uniform sampler2D uPreviousLayerTexture; uniform sampler2D uTexture; uniform int uSampleBg;vec3 blend (int blendMode, vec3 src, vec3 dst) { return src * dst; }const float STEPS = 24.0; const float PI = 3.1415926;vec2 perspectiveUV(vec2 uv) { float aspectRatio = uResolution.x/uResolution.y; vec2 centeredUV = uv - 0.5; centeredUV.x *= aspectRatio; float strength = 1.0 + (vVertexPosition.z * 0.0000); vec2 perspectiveUV = centeredUV / strength; perspectiveUV.x /= aspectRatio; perspectiveUV += 0.5; return perspectiveUV; }out vec4 fragColor;void main() { vec2 uv = vTextureCoord; vec2 pos = mix(vec2(0), (uMousePos - 0.5), 0.0000); uv = perspectiveUV(uv) - pos; vec4 background = vec4(0);if(uSampleBg == 1) { background = texture(uBgTexture, vTextureCoord); } vec4 color = texture(uTexture, uv);if (0.0000 == 1.00) { if(0 == 2) { background *= (1. - color.a); color = background; } else { background *= color.a; color.rgb = background.rgb; color.rgb = 0.0000 > 0. ? mix(vec3(0, 0, 0), color.rgb, color.a) : color.rgb; color.a = min(1., color.a + 0.0000); if(0 == 1) { vec4 previousLayer = texture(uPreviousLayerTexture, vTextureCoord); color = mix(previousLayer, color/max(color.a, 0.0001), color.a * 1.0000); } } fragColor = color; return; }if (3 > 0) { vec3 unpremultColor = color.rgb / max(color.a, 0.0001); vec3 blendedColor = blend(3, unpremultColor, background.rgb); color = vec4(blendedColor, 1.0) * (color.a * 1.0000); color = color + background * (1.0 - color.a); } else { color = mix(background, color + background * (1.0 - color.a), 1.0000); }fragColor = color; }`],compiledVertexShaders:[`#version 300 es
428
- precision highp float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix; uniform vec2 uMousePos;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { float angleX = uMousePos.y * 0.5 - 0.25; float angleY = (1.-uMousePos.x) * 0.5 - 0.25;mat4 rotateX = mat4(1.0, 0.0, 0.0, 0.0, 0.0, cos(angleX), -sin(angleX), 0.0, 0.0, sin(angleX), cos(angleX), 0.0, 0.0, 0.0, 0.0, 1.0); mat4 rotateY = mat4(cos(angleY), 0.0, sin(angleY), 0.0, 0.0, 1.0, 0.0, 0.0, -sin(angleY), 0.0, cos(angleY), 0.0, 0.0, 0.0, 0.0, 1.0);mat4 rotationMatrix = rotateX * rotateY; gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vVertexPosition = (rotationMatrix * vec4(aVertexPosition, 1.0)).xyz; vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{uniforms:{}},id:"shape1"},{breakpoints:[],visible:!0,locked:!1,aspectRatio:.996031746031746,layerName:"",userDownsample:1,isElement:!0,opacity:1,effects:[],displace:0,trackMouse:0,anchorPoint:"center",mouseMomentum:0,blendMode:"MULTIPLY",bgDisplace:0,mask:0,maskBackground:{type:"Vec3",_x:0,_y:0,_z:0},maskAlpha:0,maskDepth:0,dispersion:0,axisTilt:0,states:{appear:[],scroll:[],hover:[]},layerType:"shape",width:.45826120644598894,widthMode:"relative",height:.4600869483043395,heightMode:"auto",left:.49185679854495884,leftMode:"relative",top:.35992750274551055,topMode:"relative",rotation:0,pos:{type:"Vec2",_x:.5,_y:.5},borderRadius:0,gradientAngle:0,strokeWidth:0,coords:[[0,0],[.45826120644598894,0],[.45826120644598894,.4600869483043395],[0,.4600869483043395]],fill:["#FFC7E6"],fitToCanvas:!1,gradientType:"linear",type:"rectangle",stroke:["#000000"],numSides:3,compiledFragmentShaders:[`#version 300 es
429
- precision highp float; in vec2 vTextureCoord; in vec3 vVertexPosition;uniform vec2 uResolution; uniform vec2 uMousePos; uniform sampler2D uBgTexture; uniform sampler2D uPreviousLayerTexture; uniform sampler2D uTexture; uniform int uSampleBg;vec3 blend (int blendMode, vec3 src, vec3 dst) { return src * dst; }const float STEPS = 24.0; const float PI = 3.1415926;vec2 perspectiveUV(vec2 uv) { float aspectRatio = uResolution.x/uResolution.y; vec2 centeredUV = uv - 0.5; centeredUV.x *= aspectRatio; float strength = 1.0 + (vVertexPosition.z * 0.0000); vec2 perspectiveUV = centeredUV / strength; perspectiveUV.x /= aspectRatio; perspectiveUV += 0.5; return perspectiveUV; }out vec4 fragColor;void main() { vec2 uv = vTextureCoord; vec2 pos = mix(vec2(0), (uMousePos - 0.5), 0.0000); uv = perspectiveUV(uv) - pos; vec4 background = vec4(0);if(uSampleBg == 1) { background = texture(uBgTexture, vTextureCoord); } vec4 color = texture(uTexture, uv);if (0.0000 == 1.00) { if(0 == 2) { background *= (1. - color.a); color = background; } else { background *= color.a; color.rgb = background.rgb; color.rgb = 0.0000 > 0. ? mix(vec3(0, 0, 0), color.rgb, color.a) : color.rgb; color.a = min(1., color.a + 0.0000); if(0 == 1) { vec4 previousLayer = texture(uPreviousLayerTexture, vTextureCoord); color = mix(previousLayer, color/max(color.a, 0.0001), color.a * 1.0000); } } fragColor = color; return; }if (3 > 0) { vec3 unpremultColor = color.rgb / max(color.a, 0.0001); vec3 blendedColor = blend(3, unpremultColor, background.rgb); color = vec4(blendedColor, 1.0) * (color.a * 1.0000); color = color + background * (1.0 - color.a); } else { color = mix(background, color + background * (1.0 - color.a), 1.0000); }fragColor = color; }`],compiledVertexShaders:[`#version 300 es
430
- precision highp float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix; uniform vec2 uMousePos;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { float angleX = uMousePos.y * 0.5 - 0.25; float angleY = (1.-uMousePos.x) * 0.5 - 0.25;mat4 rotateX = mat4(1.0, 0.0, 0.0, 0.0, 0.0, cos(angleX), -sin(angleX), 0.0, 0.0, sin(angleX), cos(angleX), 0.0, 0.0, 0.0, 0.0, 1.0); mat4 rotateY = mat4(cos(angleY), 0.0, sin(angleY), 0.0, 0.0, 1.0, 0.0, 0.0, -sin(angleY), 0.0, cos(angleY), 0.0, 0.0, 0.0, 0.0, 1.0);mat4 rotationMatrix = rotateX * rotateY; gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vVertexPosition = (rotationMatrix * vec4(aVertexPosition, 1.0)).xyz; vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{uniforms:{}},id:"shape2"},{breakpoints:[],visible:!0,aspectRatio:1,userDownsample:1,layerType:"effect",type:"blur",usesPingPong:!1,trackMouse:0,mouseMomentum:0,texture:!1,animating:!1,isMask:0,compiledFragmentShaders:[`#version 300 es
431
- precision highp float; precision highp int;in vec3 vVertexPosition; in vec2 vTextureCoord;uniform sampler2D uTexture; uniform vec2 uMousePos; uniform vec2 uResolution; float ease (int easingFunc, float t) { return t; }out vec4 fragColor;const int kernelSize = 36; float getGaussianWeight(int index) { switch(index) { case 0: return 0.00094768; case 1: return 0.00151965; case 2: return 0.00237008; case 3: return 0.00359517; case 4: return 0.0053041; case 5: return 0.00761097; case 6: return 0.01062197; case 7: return 0.01441804; case 8: return 0.01903459; case 9: return 0.0244409; case 10: return 0.03052299; case 11: return 0.03707432; case 12: return 0.04379813; case 13: return 0.05032389; case 14: return 0.05623791; case 15: return 0.06112521; case 16: return 0.06461716; case 17: return 0.06643724; case 18: return 0.06643724; case 19: return 0.06461716; case 20: return 0.06112521; case 21: return 0.05623791; case 22: return 0.05032389; case 23: return 0.04379813; case 24: return 0.03707432; case 25: return 0.03052299; case 26: return 0.0244409; case 27: return 0.01903459; case 28: return 0.01441804; case 29: return 0.01062197; case 30: return 0.00761097; case 31: return 0.0053041; case 32: return 0.00359517; case 33: return 0.00237008; case 34: return 0.00151965; case 35: return 0.00094768; default: return 0.0; } }vec4 GaussianBlur(sampler2D tex, vec2 uv, vec2 direction) { vec4 color = vec4(0.0); vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); float inner = distance(uv, pos); float outer = max(0., 1.-distance(uv, pos));float amt = 0 <= 1 ? 6. : 11.; float amount = (1.0000 * amt) * ease(0, mix(inner, outer, 0.1000)); color += texture(tex, uv) * getGaussianWeight(0); for (int i = 0; i < kernelSize; i++) { float x = float(i - kernelSize / 2) * amount; color += texture(tex, uv + vec2(x * 0.001) * direction * vec2(1.0000, 1. - 1.0000)) * getGaussianWeight(i); } return color; }vec4 blur(vec2 uv, vec2 direction) { return GaussianBlur(uTexture, uv, direction); }void main() { vec2 uv = vTextureCoord; vec4 color = vec4(0); int dir = 0 % 2; vec2 direction = dir == 1 ? vec2(0, uResolution.x/uResolution.y) : vec2(1, 0);color = blur(uv, direction); fragColor = color;}`,`#version 300 es
432
- precision highp float; precision highp int;in vec3 vVertexPosition; in vec2 vTextureCoord;uniform sampler2D uTexture; uniform vec2 uMousePos; uniform vec2 uResolution; float ease (int easingFunc, float t) { return t; }out vec4 fragColor;const int kernelSize = 36; float getGaussianWeight(int index) { switch(index) { case 0: return 0.00094768; case 1: return 0.00151965; case 2: return 0.00237008; case 3: return 0.00359517; case 4: return 0.0053041; case 5: return 0.00761097; case 6: return 0.01062197; case 7: return 0.01441804; case 8: return 0.01903459; case 9: return 0.0244409; case 10: return 0.03052299; case 11: return 0.03707432; case 12: return 0.04379813; case 13: return 0.05032389; case 14: return 0.05623791; case 15: return 0.06112521; case 16: return 0.06461716; case 17: return 0.06643724; case 18: return 0.06643724; case 19: return 0.06461716; case 20: return 0.06112521; case 21: return 0.05623791; case 22: return 0.05032389; case 23: return 0.04379813; case 24: return 0.03707432; case 25: return 0.03052299; case 26: return 0.0244409; case 27: return 0.01903459; case 28: return 0.01441804; case 29: return 0.01062197; case 30: return 0.00761097; case 31: return 0.0053041; case 32: return 0.00359517; case 33: return 0.00237008; case 34: return 0.00151965; case 35: return 0.00094768; default: return 0.0; } }vec4 GaussianBlur(sampler2D tex, vec2 uv, vec2 direction) { vec4 color = vec4(0.0); vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); float inner = distance(uv, pos); float outer = max(0., 1.-distance(uv, pos));float amt = 1 <= 1 ? 6. : 11.; float amount = (1.0000 * amt) * ease(0, mix(inner, outer, 0.1000)); color += texture(tex, uv) * getGaussianWeight(0); for (int i = 0; i < kernelSize; i++) { float x = float(i - kernelSize / 2) * amount; color += texture(tex, uv + vec2(x * 0.001) * direction * vec2(1.0000, 1. - 1.0000)) * getGaussianWeight(i); } return color; }vec4 blur(vec2 uv, vec2 direction) { return GaussianBlur(uTexture, uv, direction); }void main() { vec2 uv = vTextureCoord; vec4 color = vec4(0); int dir = 1 % 2; vec2 direction = dir == 1 ? vec2(0, uResolution.x/uResolution.y) : vec2(1, 0);color = blur(uv, direction); fragColor = color;}`,`#version 300 es
433
- precision highp float; precision highp int;in vec3 vVertexPosition; in vec2 vTextureCoord;uniform sampler2D uTexture; uniform vec2 uMousePos; uniform vec2 uResolution; float ease (int easingFunc, float t) { return t; }out vec4 fragColor;const int kernelSize = 36; float getGaussianWeight(int index) { switch(index) { case 0: return 0.00094768; case 1: return 0.00151965; case 2: return 0.00237008; case 3: return 0.00359517; case 4: return 0.0053041; case 5: return 0.00761097; case 6: return 0.01062197; case 7: return 0.01441804; case 8: return 0.01903459; case 9: return 0.0244409; case 10: return 0.03052299; case 11: return 0.03707432; case 12: return 0.04379813; case 13: return 0.05032389; case 14: return 0.05623791; case 15: return 0.06112521; case 16: return 0.06461716; case 17: return 0.06643724; case 18: return 0.06643724; case 19: return 0.06461716; case 20: return 0.06112521; case 21: return 0.05623791; case 22: return 0.05032389; case 23: return 0.04379813; case 24: return 0.03707432; case 25: return 0.03052299; case 26: return 0.0244409; case 27: return 0.01903459; case 28: return 0.01441804; case 29: return 0.01062197; case 30: return 0.00761097; case 31: return 0.0053041; case 32: return 0.00359517; case 33: return 0.00237008; case 34: return 0.00151965; case 35: return 0.00094768; default: return 0.0; } }vec4 GaussianBlur(sampler2D tex, vec2 uv, vec2 direction) { vec4 color = vec4(0.0); vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); float inner = distance(uv, pos); float outer = max(0., 1.-distance(uv, pos));float amt = 2 <= 1 ? 6. : 11.; float amount = (1.0000 * amt) * ease(0, mix(inner, outer, 0.1000)); color += texture(tex, uv) * getGaussianWeight(0); for (int i = 0; i < kernelSize; i++) { float x = float(i - kernelSize / 2) * amount; color += texture(tex, uv + vec2(x * 0.001) * direction * vec2(1.0000, 1. - 1.0000)) * getGaussianWeight(i); } return color; }vec4 blur(vec2 uv, vec2 direction) { return GaussianBlur(uTexture, uv, direction); }void main() { vec2 uv = vTextureCoord; vec4 color = vec4(0); int dir = 2 % 2; vec2 direction = dir == 1 ? vec2(0, uResolution.x/uResolution.y) : vec2(1, 0);color = blur(uv, direction); fragColor = color;}`,`#version 300 es
434
- precision highp float; precision highp int;in vec3 vVertexPosition; in vec2 vTextureCoord;uniform sampler2D uTexture; uniform vec2 uMousePos; uniform vec2 uResolution; float ease (int easingFunc, float t) { return t; } uvec2 pcg2d(uvec2 v) { v = v * 1664525u + 1013904223u; v.x += v.y * v.y * 1664525u + 1013904223u; v.y += v.x * v.x * 1664525u + 1013904223u; v ^= v >> 16; v.x += v.y * v.y * 1664525u + 1013904223u; v.y += v.x * v.x * 1664525u + 1013904223u; return v; }float randFibo(vec2 p) { uvec2 v = floatBitsToUint(p); v = pcg2d(v); uint r = v.x ^ v.y; return float(r) / float(0xffffffffu); }out vec4 fragColor;const int kernelSize = 36; float getGaussianWeight(int index) { switch(index) { case 0: return 0.00094768; case 1: return 0.00151965; case 2: return 0.00237008; case 3: return 0.00359517; case 4: return 0.0053041; case 5: return 0.00761097; case 6: return 0.01062197; case 7: return 0.01441804; case 8: return 0.01903459; case 9: return 0.0244409; case 10: return 0.03052299; case 11: return 0.03707432; case 12: return 0.04379813; case 13: return 0.05032389; case 14: return 0.05623791; case 15: return 0.06112521; case 16: return 0.06461716; case 17: return 0.06643724; case 18: return 0.06643724; case 19: return 0.06461716; case 20: return 0.06112521; case 21: return 0.05623791; case 22: return 0.05032389; case 23: return 0.04379813; case 24: return 0.03707432; case 25: return 0.03052299; case 26: return 0.0244409; case 27: return 0.01903459; case 28: return 0.01441804; case 29: return 0.01062197; case 30: return 0.00761097; case 31: return 0.0053041; case 32: return 0.00359517; case 33: return 0.00237008; case 34: return 0.00151965; case 35: return 0.00094768; default: return 0.0; } }vec4 GaussianBlur(sampler2D tex, vec2 uv, vec2 direction) { vec4 color = vec4(0.0); vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); float inner = distance(uv, pos); float outer = max(0., 1.-distance(uv, pos));float amt = 3 <= 1 ? 6. : 11.; float amount = (1.0000 * amt) * ease(0, mix(inner, outer, 0.1000)); color += texture(tex, uv) * getGaussianWeight(0); for (int i = 0; i < kernelSize; i++) { float x = float(i - kernelSize / 2) * amount; color += texture(tex, uv + vec2(x * 0.001) * direction * vec2(1.0000, 1. - 1.0000)) * getGaussianWeight(i); } return color; }vec4 blur(vec2 uv, vec2 direction) { return GaussianBlur(uTexture, uv, direction); }void main() { vec2 uv = vTextureCoord; vec4 color = vec4(0); int dir = 3 % 2; vec2 direction = dir == 1 ? vec2(0, uResolution.x/uResolution.y) : vec2(1, 0);color = blur(uv, direction);float dither = (randFibo(gl_FragCoord.xy) - 0.5) / 255.0; color.rgb += dither; fragColor = color;}`],compiledVertexShaders:[`#version 300 es
435
- precision mediump float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{downSample:.25,depth:!1,uniforms:{},isBackground:!1,passes:[{prop:"vertical",value:1,downSample:.25},{prop:"vertical",value:2,downSample:.5},{prop:"vertical",value:3,downSample:.5}]},id:"effect1"},{breakpoints:[],visible:!0,aspectRatio:1,userDownsample:1,layerType:"effect",type:"sdf_shape",usesPingPong:!1,texture:!1,speed:1,trackMouseMove:0,mouseMomentum:1,trackMouse:.15,animating:!0,isMask:0,compiledFragmentShaders:[`#version 300 es
436
- precision highp float; precision highp int;in vec2 vTextureCoord; uniform sampler2D uTexture;uniform float uTime;uniform vec2 uMousePos; uniform vec2 uResolution;uvec2 pcg2d(uvec2 v) { v = v * 1664525u + 1013904223u; v.x += v.y * v.y * 1664525u + 1013904223u; v.y += v.x * v.x * 1664525u + 1013904223u; v ^= v >> 16; v.x += v.y * v.y * 1664525u + 1013904223u; v.y += v.x * v.x * 1664525u + 1013904223u; return v; }float randFibo(vec2 p) { uvec2 v = floatBitsToUint(p); v = pcg2d(v); uint r = v.x ^ v.y; return float(r) / float(0xffffffffu); }const float PI = 3.141592653; const float PI2 = 6.283185306; const int DISP_STEPS = 12; const vec3 viewDir = vec3(0,0, -4.25);ivec2 customTexSize; float customTexAspect;const mat3 ROT_Y_90 = mat3( 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0 );const mat3 ROT_Z_90 = mat3( 0.0, -1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 );const mat3 ROT_X_90 = mat3( 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0 );mat3 rotY(float ang) { float c = cos(ang), s = sin(ang); return mat3(c, 0.0, s, 0.0, 1.0, 0.0, -s, 0.0, c); }mat3 rotX(float ang) { float c = cos(ang), s = sin(ang); return mat3(1.0, 0.0, 0.0, 0.0, c, -s, 0.0, s, c); }mat3 rotZ(float ang) { float c = cos(ang), s = sin(ang); return mat3(c, -s, 0.0, s, c, 0.0, 0.0, 0.0, 1.0); }mat2 rot(float a) { float s = sin(a); float c = cos(a); return mat2(c, -s, s, c); }vec3 twistY(vec3 p, float amount) { float c = cos(amount * p.y); float s = sin(amount * p.y); mat2 m = mat2(c, -s, s, c); return vec3(m * p.xz, p.y); }vec3 twistX(vec3 p, float amount) { float c = cos(amount * p.x); float s = sin(amount * p.x); mat2 m = mat2(c, -s, s, c); return vec3(p.x, m * p.yz); }float smin(float a, float b, float k) { float h = max(k - abs(a - b), 0.0); return min(a, b) - h * h * 0.25 / k; }float sphere(vec3 p, float r) { return length(p) - r; }float sdfCylinder(vec3 p, float radius, float height) { vec2 d = abs(vec2(length(p.xz) - radius, p.y)) - vec2(radius, height * 0.5); return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)); }float sdStar5(vec2 p, float r, float rf) { const vec2 k1 = vec2(0.809016994375, -0.587785252292); const vec2 k2 = vec2(-k1.x,k1.y); p.x = abs(p.x); p -= 2.0*max(dot(k1,p),0.0)*k1; p -= 2.0*max(dot(k2,p),0.0)*k2; p.x = abs(p.x); p.y -= r; vec2 ba = rf*vec2(-k1.y,k1.x) - vec2(0,1); float h = clamp( dot(p,ba)/dot(ba,ba), 0.0, r ); return length(p-ba*h) * sign(p.y*ba.x-p.x*ba.y); }float mergedDiscs(vec3 p) { float result = sdfCylinder(p, 0.7, 0.01 + 0.0000 * 0.5);for(float i = 1.; i < 4.; i++) { float angle = (i * 45.)/360. * 2.0 * PI; mat2 rotZMat = rot(angle); vec3 rotatedP = vec3(rotZMat * p.xy, p.z);result = smin( result, sdfCylinder(rotatedP, 0.7, 0.01 + 0.0000 * 0.5), 0.2 ); }return max(result, sphere(p, 1.4)); }vec3 getRepeat(vec3 p) { float spacing = (0.5000 + 0.4800 * 0.38) * 8.; return p; }vec3 getThreeDRepeat(vec3 p) { float spacing = (0.5000 + 0.4800 * 0.38) * 8.; return p; }vec3 getAdjustedP(vec3 p) { float scale = max(0.2600, 0.000000001); float scaleFactor = 1.0/scale; vec3 adjustedP = p * scaleFactor;vec2 twist = vec2(0.7, 0.82);adjustedP.xy *= vec2(uResolution.x / uResolution.y, 1);adjustedP *= (1. + (0.4800 + 0.01));vec2 mousePos = mix(vec2(0), uMousePos - 0.5, 0.1500); vec2 axis = vec2(-1. * vec3(0.48503740648379057, 0.5187032418952618, 0.6966).y - 1. + mousePos.y/PI, vec3(0.48503740648379057, 0.5187032418952618, 0.6966).x + mousePos.x/PI) * 2.;adjustedP = getRepeat(adjustedP);float baseTime = uTime * 0.02; float timeX = vec3(0, 1.2, 0).x * baseTime; float timeY = vec3(0, 1.2, 0).y * baseTime; float timeZ = vec3(0, 1.2, 0).z * baseTime;mat3 rotYMat = rotY(axis.y * PI); mat3 rotXMat = rotX(axis.x * PI); mat3 rotZMat = rotZ(vec3(0.48503740648379057, 0.5187032418952618, 0.6966).z * 2.0 * PI);mat3 combinedRotation = rotZMat * rotYMat * rotXMat; mat3 combinedAnimation = rotZ(timeZ) * rotX(timeX) * rotY(timeY);adjustedP = combinedRotation * adjustedP; adjustedP = combinedAnimation * adjustedP; adjustedP = getThreeDRepeat(adjustedP); adjustedP = mix(adjustedP, twistY(adjustedP, -1.0 * twist.y), step(0.0, abs(twist.y))); adjustedP = mix(adjustedP, twistX(adjustedP, -1.0 * twist.x), step(0.0, abs(twist.x)));return adjustedP; }float getMergedSDF(vec3 p) { p = getAdjustedP(p); return mergedDiscs(p); }float fresnel(vec3 eyeVector, vec3 worldNormal, float power) { float NdotV = abs(dot(eyeVector, worldNormal)); float width = fwidth(dot(eyeVector, worldNormal)); float threshold = 0.2; float edgeDampFactor = smoothstep(threshold, -threshold, width); float fresnelFactor = 1.0 - NdotV; return pow(fresnelFactor, power) * mix(1., edgeDampFactor * 2., 0.5); }vec3 noFrostOrDispersion(vec3 rd, vec3 normal) { float ior = 1.0 / (1.0 + 0.7000 * 0.25); vec3 refractedRay = refract(rd, normal, ior); return texture(uTexture, vTextureCoord - refractedRay.xy).rgb; }vec3 frostOrDispersion(vec3 rd, vec3 normal) { vec3 refractionColor = vec3(0); float iorBase = 1. + 0.7000 * 0.25;vec3 dispCoefficients = vec3(0.03, 0.06, 0.1) * 0.2500 * 1.2;for (int i = 0; i < DISP_STEPS; ++i) { float step = float(i) / float(DISP_STEPS); vec3 disp = step * dispCoefficients; vec3 ior = 1.0 / (iorBase + disp);vec3 refractedRayR = refract(rd, normal, ior.r); vec3 refractedRayG = refract(rd, normal, ior.g); vec3 refractedRayB = refract(rd, normal, ior.b);refractionColor.r += texture(uTexture, vTextureCoord - refractedRayR.xy).r; refractionColor.g += texture(uTexture, vTextureCoord - refractedRayG.xy).g; refractionColor.b += texture(uTexture, vTextureCoord - refractedRayB.xy).b; }return clamp(refractionColor / float(DISP_STEPS), 0.0, 1.0); }vec3 calculateNormal(vec3 p, float eps) { vec2 e = vec2(1.0, -1.0) * eps * 0.5; return normalize( e.xyy * getMergedSDF(p + e.xyy) + e.yyx * getMergedSDF(p + e.yyx) + e.yxy * getMergedSDF(p + e.yxy) + e.xxx * getMergedSDF(p + e.xxx) ); }vec3 sampleTexture(vec3 rd, vec3 normal) {return frostOrDispersion(rd, normal); return noFrostOrDispersion(rd, normal); }float scene(vec3 p) { return max(0.0000000001, getMergedSDF(p) - (0.4800 + 0.005)) * max(0.2600, 0.000000001); }const int STEPS = 128; const float MAX_DISTANCE = 100.0;vec4 rayMarch(vec3 ro, vec3 rd) { float pixelSize = 0.0025; float traveled = 0.; vec3 entryPoint = vec3(0.0); vec3 entryNormal = vec3(0.0); float partialAlpha = 0.0; float lastDistance = 0.0; float smoothing = mix(1., 4., 1.0000);for (int i = 0; i < STEPS; ++i) { vec3 currentPos = ro + rd * traveled; float distance = scene(currentPos); float progress = float(i)/float(STEPS); float step = distance * mix(1., 1.5, progress);if (distance > MAX_DISTANCE) break;if (distance < pixelSize) { partialAlpha = 1.; entryPoint = currentPos; entryNormal = calculateNormal(entryPoint, pixelSize * smoothing); break; }lastDistance = distance;traveled += max(step, pixelSize); if (traveled > MAX_DISTANCE) break; }if (partialAlpha == 0.0) { return texture(uTexture, vTextureCoord); }vec3 samplePosition = mix(rd, entryPoint, 0.0000);vec3 refractionColor = vec3(0.0);refractionColor = sampleTexture(samplePosition, entryNormal); vec3 lightDir = vec3(((vec2(vec3(0.25, 0.25, -3).x, 1.-vec3(0.25, 0.25, -3).y) - 0.333) * 3.) - vec2(0.5, 0.5), vec3(0.25, 0.25, -3).z); vec3 normLightDir = normalize(lightDir);float lightAndShadow = dot(entryNormal, normLightDir); vec3 lightColor = mix(vec3(1), vec3(1, 1, 1), 1. - 0.0000); vec3 fresnelEffect = vec3(0.0);fresnelEffect = fresnel(rd, entryNormal, 8.0) * 0.3000 * vec3(1, 1, 1);vec3 specularEffect = vec3(0.0);vec3 halfwayDir = normalize(lightDir + rd); float specFactor = pow(max(dot(entryNormal, halfwayDir), 0.0), 64.0 * 0.3000 + 0.01); specularEffect = specFactor * 0.3000 * lightColor;vec3 combinedEffects = fresnelEffect + specularEffect; vec3 finalColor = mix(refractionColor, vec3(1, 1, 1) * lightAndShadow, 0.0000); finalColor += combinedEffects;vec4 outputColor = vec4(finalColor, 1.);return outputColor; }out vec4 fragColor;void main() { vec4 col = vec4(0); vec4 bg = texture(uTexture, vTextureCoord);if(0.2600 <= 0.0001 || 0.5000 <= 0.0001) { col = vec4(0); if(1 == 1) { col = bg; } fragColor = col; return; }vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); vec2 uv = vTextureCoord - pos; float fovFactor = tan(radians(20.) * 0.5); vec3 rd = vec3(uv * fovFactor, 0.5); col = rayMarch(viewDir, rd); float dither = (randFibo(vTextureCoord.xy) - 0.5) / 255.0; col += dither;col = mix(bg, col, 0.5000); fragColor = col;}`],compiledVertexShaders:[`#version 300 es
437
- precision mediump float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{depth:!1,uniforms:{},isBackground:!1},id:"effect2"},{breakpoints:[],visible:!0,aspectRatio:1,userDownsample:1,layerType:"effect",type:"sphere",usesPingPong:!1,trackMouse:0,mouseMomentum:0,texture:!1,animating:!1,isMask:0,compiledFragmentShaders:[`#version 300 es
438
- precision mediump float; in vec3 vVertexPosition; in vec2 vTextureCoord; uniform sampler2D uTexture; uniform vec2 uMousePos; uniform vec2 uResolution;const float STEPS = 16.0; const float PI = 3.1415926;vec3 chromaticAbberation(vec2 st, float angle, float amount, float blend) { float aspectRatio = uResolution.x/uResolution.y; float rotation = angle * 360.0 * PI / 180.0; vec2 aberrated = amount * vec2(0.1 * sin(rotation) * aspectRatio, 0.1 * cos(rotation)); aberrated *= distance(st, vec2(0.5)) * 2.0; vec4 red = vec4(0); vec4 blue = vec4(0); vec4 green = vec4(0); float invSteps = 1.0 / STEPS; float invStepsHalf = invSteps * 0.5; for(float i = 1.0; i <= STEPS; i++) { vec2 offset = aberrated * (i * invSteps); red += texture(uTexture, st - offset) * invSteps; blue += texture(uTexture, st + offset) * invSteps; }for (float i = 0.0; i <= STEPS; i++) { vec2 offset = aberrated * ((i * invSteps) - 0.5); green += texture(uTexture, st + offset) * invSteps; } return vec3(red.r, green.g, blue.b); }vec2 sphericalTransformation( float u, float v, float uCenter, float vCenter, float lensRadius, float tau) { float aspectRatio = uResolution.x/uResolution.y; u -= uCenter; v -= vCenter;float s = sqrt(u * u + v * v); if (s > lensRadius) return vec2(u + uCenter, v + vCenter);float z = sqrt(lensRadius * lensRadius - s * s);float uAlpha = (1.0 - (1.0 / tau)) * asin(u / lensRadius); float vAlpha = (1.0 - (1.0 / tau)) * asin(v / lensRadius);u = uCenter + z * sin(uAlpha); v = vCenter + z * sin(vAlpha);return vec2(u/aspectRatio, v); }float circularIn(float t) { return 1.0 - sqrt(1.0 - t * t); }vec2 fisheyeTransformation( float u, float v, float uCenter, float vCenter, float lensRadius, float distortionScale ) { float aspectRatio = uResolution.x / uResolution.y;vec2 dir = vec2(u - uCenter, v - vCenter);dir.x /= lensRadius; dir.y /= lensRadius;float dist = length(dir) * 0.15;if (dist < 1.0) { float theta = atan(dir.y, dir.x);float r = dist * 2.0 * PI; float z = sqrt(1.0 - r * r) + 0.25; float rDist = atan(r, z) / PI; float newDist = mix(dist, rDist, 5.);dir.x = newDist * cos(theta); dir.y = newDist * sin(theta); }dir.x *= lensRadius; dir.y *= lensRadius;return mix(vec2(u/aspectRatio, v), vec2(uCenter/aspectRatio, vCenter) + dir, 1.0000); }vec2 discTransformation( float u, float v, float uCenter, float vCenter, float lensRadius, float distortionScale) { float aspectRatio = uResolution.x/uResolution.y; u -= uCenter; v -= vCenter;float s = sqrt(u * u + v * v); if (s > lensRadius) return vec2(u + uCenter, v + vCenter); float r = sqrt(u * u + v * v) / lensRadius; if(r == 0.0) return vec2(uCenter, vCenter);r = pow(r, distortionScale); float theta = atan(r); float rad = theta / r;u = rad * u + uCenter; v = rad * v + vCenter;return vec2(u/aspectRatio, v); }out vec4 fragColor; void main() { vec2 uv = vTextureCoord; vec4 color = texture(uTexture, uv); float aspectRatio = uResolution.x/uResolution.y; uv.x = uv.x * aspectRatio; vec2 sphereCoords = uv; vec2 pos = vec2(0.5, 0.5) + mix(vec2(0), (uMousePos-0.5), 0.0000); pos.x *= aspectRatio;float radius = 0.5000 * uResolution.x/max(uResolution.x, uResolution.y);if(1 == 0) { sphereCoords = sphericalTransformation( mix(sphereCoords.x, 1.-sphereCoords.x, 0.0000), mix(sphereCoords.y, 1.-sphereCoords.y, 0.0000), mix(pos.x, 1.-pos.x, 0.0000), mix(pos.y, 1.-pos.y, 0.0000), radius/2., 1. + 1.0000 * 9. ); } else if(1 == 1) { sphereCoords = discTransformation( mix(sphereCoords.x, 1.-sphereCoords.x, 0.0000), mix(sphereCoords.y, 1.-sphereCoords.y, 0.0000), mix(pos.x, 1.-pos.x, 0.0000), mix(pos.y, 1.-pos.y, 0.0000), radius/2., 1. + 1.0000 * 9. ); } else if(1 == 2) { sphereCoords = fisheyeTransformation( mix(sphereCoords.x, 1.-sphereCoords.x, 0.0000), mix(sphereCoords.y, 1.-sphereCoords.y, 0.0000), mix(pos.x, 1.-pos.x, 0.0000), mix(pos.y, 1.-pos.y, 0.0000), radius/2., 1. + 1.0000 * 9. ); }vec2 scaledCoords = (sphereCoords - 0.5) + 0.5; vec4 sphere = texture(uTexture, clamp(scaledCoords, 0.0, 1.0)); float distFromPos = distance(uv, pos); float edgeSmooth = 0.001; float insideSphere = 1.0 - smoothstep(radius/2.0 - edgeSmooth, radius/2.0, distFromPos); float insideSphereAlpha = 1.0 - smoothstep(radius/2.0 + 0.002 - edgeSmooth, radius/2.0 + 0.002, distFromPos); sphere.rgb = chromaticAbberation(scaledCoords, atan(scaledCoords.y, scaledCoords.x), distFromPos * 1.0000, 1.0); color = mix(color, sphere, insideSphere); color.rgb += vec3((0.5000-0.5)*2.) * mix(0., circularIn(smoothstep(0., radius, distFromPos)), insideSphere); if(1 == 1) { color.a = insideSphereAlpha; color.rgb = mix(vec3(0), color.rgb, insideSphereAlpha); } fragColor = color;}`],compiledVertexShaders:[`#version 300 es
439
- precision mediump float;in vec3 aVertexPosition; in vec2 aTextureCoord;uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform mat4 uTextureMatrix;out vec2 vTextureCoord; out vec3 vVertexPosition;void main() { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vTextureCoord = (uTextureMatrix * vec4(aTextureCoord, 0.0, 1.0)).xy; }`],data:{depth:!1,uniforms:{},isBackground:!1},id:"effect3"}],options:{name:"zAI Orb final",fps:60,dpi:1.5,scale:1,includeLogo:!1,isProduction:!1},version:"1.4.29",id:"l9tOlEGo3rE5cxAzUCHg"});function Vv({className:e,dpi:t=2,scale:n=1,fps:r=60,onScene:s,onError:a}){const i=p.useRef(null),c=p.useId();return p.useEffect(()=>{if(!i.current)return;let u=!1,l=null;return(async()=>{try{const d=await Bv();if(u||!i.current)return;i.current.setAttribute("data-us-project-src",Os.url),l=d.addScene({filePath:Os.url,elementId:c,dpi:t,scale:n,fps:r});const m=await l;if(u){m.destroy();return}s(m)}catch{u||a()}})(),()=>{u=!0,s(null),l==null||l.then(d=>d.destroy()).catch(()=>{})}},[c,t,n,r]),o.jsx("div",{ref:i,id:c,className:e,role:"img","aria-hidden":!0})}const Zv=1,Gv=5,Wv="effect2",Yv=`
440
- .zai-dock {
441
- position: fixed;
442
- right: 18px;
443
- bottom: 50px;
444
- z-index: 40;
445
- display: flex;
446
- align-items: center;
447
- gap: 10px;
448
- font-family: var(--font-dmsans, system-ui, sans-serif);
449
- }
450
- .zai-panel {
451
- display: flex;
452
- align-items: center;
453
- width: 0;
454
- opacity: 0;
455
- overflow: hidden;
456
- transition:
457
- width 0.34s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
458
- opacity 0.22s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
459
- }
460
- .zai-dock[data-open="true"] .zai-panel {
461
- width: 330px;
462
- opacity: 1;
463
- }
464
- .zai-input-wrap {
465
- display: flex;
466
- align-items: center;
467
- gap: 8px;
468
- width: 330px;
469
- padding: 9px 10px 9px 14px;
470
- border-radius: 9999px;
471
- background: rgba(12, 13, 20, 0.72);
472
- backdrop-filter: blur(12px);
473
- -webkit-backdrop-filter: blur(12px);
474
- border: 1px solid hsla(263, 80%, 72%, 0.24);
475
- box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
476
- }
477
- .zai-input {
478
- flex: 1;
479
- min-width: 0;
480
- background: transparent;
481
- border: 0;
482
- outline: 0;
483
- color: #e7e9f3;
484
- font-size: 13px;
485
- }
486
- .zai-input::placeholder { color: rgba(255, 255, 255, 0.4); }
487
- .zai-agent {
488
- flex: none;
489
- font-size: 10px;
490
- font-weight: 700;
491
- letter-spacing: 0.05em;
492
- text-transform: uppercase;
493
- color: hsla(263, 85%, 82%, 0.95);
494
- background: hsla(263, 80%, 60%, 0.16);
495
- border-radius: 7px;
496
- padding: 4px 7px;
497
- cursor: pointer;
498
- user-select: none;
499
- white-space: nowrap;
500
- transition: background 0.15s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
501
- }
502
- .zai-agent:hover { background: hsla(263, 80%, 60%, 0.28); }
503
-
504
- /* The WebGL orb scene IS the orb — clipped to a circle and faded in once ready.
505
- The button is just a transparent container; nothing is drawn behind the orb. */
506
- .zai-orb-canvas {
507
- position: absolute;
508
- inset: 0;
509
- border-radius: 9999px;
510
- overflow: hidden;
511
- opacity: 0;
512
- transition: opacity 0.45s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
513
- pointer-events: none;
514
- }
515
- .zai-orb[data-webgl="true"] .zai-orb-canvas { opacity: 1; }
516
- .zai-orb-canvas canvas {
517
- width: 100% !important;
518
- height: 100% !important;
519
- display: block;
520
- }
521
-
522
- .zai-orb {
523
- position: relative;
524
- width: 60px;
525
- height: 60px;
526
- flex: none;
527
- padding: 0;
528
- border: 0;
529
- border-radius: 9999px;
530
- cursor: pointer;
531
- background: transparent;
532
- transition: transform 0.2s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
533
- }
534
- .zai-orb:hover { transform: scale(1.06); }
535
- .zai-orb:active { transform: scale(0.97); }
536
- /* Minimal fallback gradient, shown only if the WebGL scene fails to load, so
537
- the orb stays visible + clickable instead of being an invisible button. */
538
- .zai-orb[data-fallback="true"] {
539
- background:
540
- radial-gradient(circle at 34% 28%, hsla(263, 95%, 86%, 0.95), transparent 45%),
541
- radial-gradient(circle at 62% 70%, #7a17e0 0%, #4a0a92 55%, #2c0560 100%);
542
- }
543
-
544
- .zai-history {
545
- position: absolute;
546
- right: 70px;
547
- bottom: 72px;
548
- width: 344px;
549
- display: flex;
550
- flex-direction: column;
551
- justify-content: flex-end;
552
- gap: 8px;
553
- max-height: 52vh;
554
- overflow: hidden;
555
- pointer-events: none;
556
- -webkit-mask-image: linear-gradient(180deg, transparent, #000 16%);
557
- mask-image: linear-gradient(180deg, transparent, #000 16%);
558
- }
559
- .zai-msg {
560
- width: fit-content;
561
- max-width: 100%;
562
- padding: 8px 12px;
563
- border-radius: 14px;
564
- font-size: 13px;
565
- line-height: 1.45;
566
- white-space: pre-wrap;
567
- word-break: break-word;
568
- backdrop-filter: blur(10px);
569
- -webkit-backdrop-filter: blur(10px);
570
- animation: zai-rise 0.28s var(--zf-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) both;
571
- }
572
- .zai-msg-user {
573
- align-self: flex-end;
574
- background: hsla(263, 70%, 55%, 0.28);
575
- border: 1px solid hsla(263, 80%, 75%, 0.3);
576
- color: #f0ecff;
577
- }
578
- .zai-msg-zai {
579
- align-self: flex-start;
580
- background: rgba(12, 13, 20, 0.66);
581
- border: 1px solid rgba(255, 255, 255, 0.08);
582
- color: #dfe3ef;
583
- }
584
- .zai-msg-error {
585
- color: #ffb4bd;
586
- border-color: rgba(255, 107, 129, 0.4);
587
- }
588
- @keyframes zai-rise {
589
- from { opacity: 0; transform: translateY(6px); }
590
- to { opacity: 1; transform: translateY(0); }
591
- }
592
-
593
- @media (prefers-reduced-motion: reduce) {
594
- .zai-msg { animation: none; }
595
- .zai-panel { transition: none; }
596
- }
597
- `;function Xv({onOpenChange:e}={}){var B;const[t,n]=p.useState(null),[r,s]=p.useState(null),[a,i]=p.useState(!1),[c,u]=p.useState(""),[l,d]=p.useState(!1),[m,h]=p.useState([]),[g,w]=p.useState(!1),[v,f]=p.useState(!1),x=p.useRef(null),y=p.useRef(null),S=p.useCallback((E,z)=>{var M;const F=(M=E.layers)==null?void 0:M.find(O=>O.id===Wv&&O.layerType==="effect");F&&F.layerType==="effect"&&(F.speed=z?Gv:Zv)},[]),k=p.useCallback(E=>{y.current=E,E?(S(E,!1),f(!1),w(!0)):w(!1)},[S]),T=p.useCallback(()=>{w(!1),f(!0)},[]);p.useEffect(()=>{y.current&&S(y.current,l)},[l,S]),p.useEffect(()=>{let E=!1;return fetch(gf,{cache:"no-store"}).then(z=>z.ok?z.json():{agents:[]}).then(z=>{var M;if(E)return;const F=z.agents??[];n(F),s(((M=F[0])==null?void 0:M.id)??null)}).catch(()=>{E||n([])}),()=>{E=!0}},[]),p.useEffect(()=>{var E;a&&((E=x.current)==null||E.focus())},[a]),p.useEffect(()=>{e==null||e(a)},[a,e]);const N=E=>h(z=>[...z,E].slice(-8));async function j(){var z;const E=c.trim();if(!(!E||l)){N({role:"user",text:E}),u(""),d(!0);try{const F=await fetch(xf,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({question:E,agent:r})}),M=await F.json();F.ok&&M.ok&&M.answer?N({role:"zai",text:M.answer}):N({role:"zai",text:M.error??`request failed (HTTP ${F.status})`,error:!0})}catch(F){N({role:"zai",text:String(F),error:!0})}finally{d(!1),(z=x.current)==null||z.focus()}}}function b(E){E.key==="Enter"&&!E.shiftKey?(E.preventDefault(),j()):E.key==="Escape"&&i(!1)}function _(){if(!t||t.length<2||!r)return;const E=t.findIndex(z=>z.id===r);s(t[(E+1)%t.length].id)}if(!t||t.length===0)return null;const P=((B=t.find(E=>E.id===r))==null?void 0:B.label)??t[0].label;return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:Yv}),o.jsxs("div",{className:"zai-dock","data-open":a,"data-busy":l,children:[a&&m.length>0&&o.jsx("div",{className:"zai-history","aria-live":"polite",children:m.map((E,z)=>o.jsx("div",{className:E.role==="user"?"zai-msg zai-msg-user":`zai-msg zai-msg-zai${E.error?" zai-msg-error":""}`,children:E.text},z))}),o.jsx("div",{className:"zai-panel",children:o.jsxs("div",{className:"zai-input-wrap",children:[o.jsx("input",{ref:x,className:"zai-input",value:c,onChange:E=>u(E.target.value),onKeyDown:b,placeholder:l?"thinking…":"what's going on?",disabled:l,"aria-label":"Ask zAI"}),o.jsx("span",{className:"zai-agent",onClick:_,title:t.length>1?"Click to switch agent":`Answered by ${P}`,children:P})]})}),o.jsx("button",{type:"button",className:"zai-orb","data-webgl":g,"data-fallback":v,onClick:()=>i(E=>!E),"aria-label":a?"Close zAI":"Ask zAI","aria-expanded":a,children:o.jsx(Vv,{className:"zai-orb-canvas",onScene:k,onError:T})})]})]})}const Kv=p.lazy(()=>Vs(()=>import("./editor-CY2XpG9x.js"),__vite__mapDeps([2,1,3,4,5,6,7])).then(e=>({default:e.DashboardEditor}))),jn=Ui(Rx),qv=[new Mb,new db,new Ix,new Xx,new Qx,new Xb,new _v,new Vx,new mv,new Cb,new tv,new Vb,new Fb,new xb];function ir({children:e}){return o.jsx("main",{className:"mx-auto max-w-2xl px-6 py-16",children:e})}function Jv(){return o.jsx(ir,{children:o.jsx("p",{className:"body-sm text-soft",children:"loading dashboard…"})})}function Qv({message:e}){return o.jsxs(ir,{children:[o.jsx("h1",{className:"font-dmsans text-strong mb-2 text-lg font-extrabold",children:"couldn’t load your dashboard"}),o.jsxs("p",{className:"body-sm text-soft mb-4",children:["The zframes runtime couldn’t read ",o.jsx("code",{children:"dashboard.json"}),". Make sure you’re running ",o.jsx("code",{children:"zframes serve"})," next to it."]}),o.jsx("p",{className:"caption text-soft",children:o.jsx("code",{children:e})})]})}function e1({issues:e}){return o.jsxs(ir,{children:[o.jsx("h1",{className:"font-dmsans text-strong mb-2 text-lg font-extrabold",children:"dashboard.json is not a valid spec"}),o.jsxs("p",{className:"body-sm text-soft mb-4",children:["Fix the issues below (or run ",o.jsx("code",{children:"zframes lint dashboard.json"}),"), then reload."]}),o.jsx("ul",{className:"body-sm text-normal list-disc space-y-1 pl-5",children:e.map((t,n)=>o.jsxs("li",{children:[o.jsx("code",{children:t.path.join(".")||"(root)"}),": ",t.message]},n))})]})}async function t1(e){try{const t=await fetch(hf,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP ${t.status}`);window.location.reload()}catch(t){console.error("zframes: failed to save dashboard.json",t),window.alert("Couldn't save dashboard.json — is `zframes serve` still running? Your edits are still on screen; try Save again.")}}function n1(){const[e,t]=p.useState({status:"loading"}),[n,r]=p.useState(null),[s,a]=p.useState(null),i=Lv(),[c,u]=p.useState(!1),l=s??(e.status==="ready"?e.spec.theme.accentHue:null);if(p.useEffect(()=>{l!=null&&document.documentElement.style.setProperty("--zf-accent-hue",String(l))},[l]),p.useEffect(()=>{let m=!1;return fetch(ff,{cache:"no-store"}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.json()}).then(h=>{if(m)return;const g=Cm.safeParse(h);t(g.success?{status:"ready",spec:g.data}:{status:"invalid",issues:g.error.issues})}).catch(h=>{m||t({status:"error",message:String(h)})}),()=>{m=!0}},[]),e.status==="loading")return o.jsx(Jv,{});if(e.status==="error")return o.jsx(Qv,{message:e.message});if(e.status==="invalid")return o.jsx(e1,{issues:e.issues});const d=e.spec;return o.jsxs(Tm,{providers:qv,children:[o.jsx(Rv,{background:d.background,active:c}),o.jsxs("main",{className:"relative z-10 mx-auto max-w-[1320px] px-4 pb-24 pt-5 sm:px-6",style:{"--zf-accent-hue":l??d.theme.accentHue,"--zf-accent-sat":`${d.theme.accentSat}%`},children:[o.jsxs("header",{className:"mb-5 flex flex-col gap-2 border-b border-white/[0.06] pb-4 sm:flex-row sm:items-center sm:justify-between",children:[o.jsxs("div",{className:"flex items-baseline gap-3",children:[o.jsxs("h1",{className:"font-dmsans text-strong text-lg font-extrabold tracking-tight",children:["/",o.jsx("span",{style:{color:"hsl(var(--zf-accent-hue, 242) var(--zf-accent-sat, 90%) 76%)"},children:"zframes"})]}),o.jsx("span",{className:"body-sm text-soft",children:d.title}),o.jsxs("span",{className:"caption text-soft rounded-full border border-white/[0.08] px-1.5 py-0.5 font-mono leading-none",title:"zframes runtime version",children:["v","0.2.0"]})]}),o.jsx("div",{ref:r,className:"flex min-h-9 items-center justify-end"})]}),i?o.jsx(Lr,{spec:d,registry:jn}):o.jsx(p.Suspense,{fallback:o.jsx(Lr,{spec:d,registry:jn}),children:o.jsx(Kv,{spec:d,registry:jn,onSave:t1,customiseButtonTarget:n,onAccentHueChange:a})})]}),o.jsx(Ov,{}),o.jsx(Xv,{onOpenChange:u})]})}const wi=document.getElementById("root");if(!wi)throw new Error("missing #root element");ji.createRoot(wi).render(o.jsx(p.StrictMode,{children:o.jsx(n1,{})}));export{Tm as F,af as a,df as b,lf as c,i1 as t,Bo as u};