1import{r as p,j as e}from"./vendor-react-DR-s3MyR.js";import{A as Ne}from"./AppShell-DVzmjVRN.js";import{b as Se,aC as ke,au as Pe,T as _,a4 as Z,u as y,A as X,f as h,B as x,S as ee,L as te,I as se,k as Me}from"./App-DrNoFNrD.js";import{S as Ce}from"./switch-BIyanlER.js";import{L as Ae}from"./LazyRecharts-tAtqHiCK.js";import{U as $e}from"./UpgradeBanner-CJv2dJci.js";import{S as Oe}from"./shield-off-C2UhsvSs.js";import{B as re}from"./bitcoin-BqDWSMWz.js";import{G as Ee}from"./globe-B33i_rgH.js";import{D as Ie}from"./dollar-sign-VUhwv8Qn.js";import{G as ae}from"./gavel-DcndmUVx.js";import{A as Te}from"./arrow-up-right-2CN0J9AY.js";import{A as Fe}from"./arrow-down-right-B4FzG_bC.js";import{C as ie}from"./circle-check-DuuIr2_q.js";import"./sheet-DEuYVHM-.js";import"./radix-dialog-BeZ4gGxl.js";import"./radix-primitive-BUriELsH.js";import"./radix-slot-DnLuwATg.js";import"./radix-compose-refs-D6dqqAdo.js";import"./radix-context-PrlSO5z7.js";import"./radix-id-BRVmICFe.js";import"./radix-use-layout-effect-CIo0b4zP.js";import"./radix-use-controllable-state-pUF16jyx.js";import"./radix-dismissable-layer-6HGUYkYJ.js";import"./radix-use-callback-ref-_8_ho4y0.js";import"./radix-use-escape-keydown-ByAYFp_N.js";import"./radix-focus-scope-C7NswZYd.js";import"./radix-portal-xSClgmal.js";import"./radix-presence-BbBgUYEO.js";import"./radix-focus-guards-arAEqobq.js";import"./radix-visually-hidden-CIGFplQ_.js";import"./EnergyField-DfZLO_Mv.js";import"./dropdown-menu-UINLPrIv.js";import"./radix-dropdown-menu-CtW-JYBN.js";import"./radix-menu-BnhYZqMv.js";import"./radix-collection-30cVg4Vi.js";import"./radix-direction-CID-gv9T.js";import"./radix-popper-B0p01UYd.js";import"./radix-arrow-BfTiT5zn.js";import"./radix-use-size-BbCXqNyQ.js";import"./radix-roving-focus-EJ24vwhn.js";import"./circle-Bo7IP0UH.js";import"./countries-C4EN_AQP.js";import"./useSubscription-CnE3nUpn.js";import"./stripe-BaeDzDOG.js";import"./settings-BkmNv4H2.js";import"./sun-medium-CxQm5yN_.js";import"./moon-DMkKbABv.js";import"./monitor-BxUTHqyK.js";import"./serviceNavigation-CsSu5JiE.js";import"./wind-DInBKhtm.js";import"./battery-charging-DKuB1_zX.js";import"./users-IaCrOTH_.js";import"./book-open-CG058Lez.js";import"./en-US-BjzaYKam.js";import"./crown-Dq9yjBwz.js";import"./log-out-8stXlDDr.js";import"./log-in-Ci_zOOrJ.js";import"./index-Bku6MSn9.js";import"./vendor-data-BkyUpT8a.js";import"./radix-toast-D0Eg9mYr.js";import"./radix-tooltip-BUM68zcN.js";import"./radix-label-B4hKXXVP.js";import"./radix-select-D4l0cAFC.js";import"./radix-number-BdQq_4o_.js";import"./radix-use-previous-D31bNXQt.js";import"./radix-switch-B8FuwtoU.js";function De({density:t=18,className:s=""}){const i=p.useMemo(()=>Array.from({length:t}).map((a,n)=>({id:n,left:Math.random()*100,delay:Math.random()*12,duration:10+Math.random()*14,size:1+Math.random()*2.5,hue:Math.random()>.5?"var(--eco-glow)":"var(--primary-glow)"})),[t]);return e.jsx("div",{className:`pointer-events-none absolute inset-0 overflow-hidden ${s}`,"aria-hidden":!0,children:i.map(a=>e.jsx("span",{className:"absolute bottom-[-10px] rounded-full opacity-0 animate-particle-float",style:{left:`${a.left}%`,width:`${a.size}px`,height:`${a.size}px`,background:`hsl(${a.hue})`,boxShadow:`0 0 ${6+a.size*3}px hsl(${a.hue} / 0.8)`,animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},a.id))})}const W="ecopowerhub.trading.v1",G="ecopowerhub.auctions.v1",N=()=>Math.random().toString(36).slice(2,10);function ne(){const t=Date.now(),s=(i,a)=>({id:N(),ts:new Date(t-i*9e4).toISOString(),side:"bid",type:"P2P",party:"Annapolis Co-op",priceUsd:48,mwh:.5,status:"open",...a});return[s(0,{side:"ask",type:"DA",party:"Frederick Solar A",priceUsd:52.4,mwh:1.2,status:"open"}),s(1,{side:"bid",type:"DA",party:"PJM AECO",priceUsd:51.8,mwh:.8,status:"open"}),s(2,{side:"ask",type:"P2P",party:"Annapolis BESS-1",priceUsd:64,mwh:.6,status:"open"}),s(3,{side:"bid",type:"RT",party:"Eastern Shore Coop",priceUsd:47.1,mwh:.4,status:"open"}),s(4,{side:"bid",type:"VPP",party:"PJM RegD",priceUsd:72,mwh:1,status:"filled",settlementChain:"PJM"}),s(5,{side:"ask",type:"P2P",party:"Salisbury Rural",priceUsd:58.5,mwh:.3,status:"settled",settlementChain:"ckBTC"}),s(6,{side:"ask",type:"RT",party:"Frederick BESS-2",priceUsd:49.9,mwh:.5,status:"open"}),s(7,{side:"bid",type:"P2P",party:"Annapolis Co-op",priceUsd:46,mwh:.7,status:"settled",settlementChain:"ICP"})]}function oe(){return[{id:N(),title:"Evening Peak VPP â PJM AECO",window:"17:00â19:00 ET",premiumPct:28,capacityMw:2.4,closesInMin:120,participants:14,status:"open"},{id:N(),title:"Frequency Reg (RegD) Block",window:"00:00â24:00",premiumPct:11,capacityMw:.8,closesInMin:45,participants:6,status:"filling"},{id:N(),title:"Capacity Reserve â Heat Wave",window:"Tomorrow 14:00â20:00",premiumPct:42,capacityMw:3.1,closesInMin:360,participants:22,status:"open"}]}function w(){try{const t=localStorage.getItem(W);if(!t){const s=ne();return localStorage.setItem(W,JSON.stringify(s)),s}return JSON.parse(t)}catch{return ne()}}function k(t){localStorage.setItem(W,JSON.stringify(t))}function ce(){try{const t=localStorage.getItem(G);if(!t){const s=oe();return localStorage.setItem(G,JSON.stringify(s)),s}return JSON.parse(t)}catch{return oe()}}function Be(t){localStorage.setItem(G,JSON.stringify(t))}const m={listOrders:()=>w(),placeOrder:t=>{const s={...t,id:N(),ts:new Date().toISOString(),status:"open"},i=[s,...w()];return k(i),s},cancelOrder:t=>{const s=w().map(i=>i.id===t?{...i,status:"cancelled"}:i);k(s)},settleOrder:(t,s)=>{const i=w().map(a=>a.id===t?{...a,status:"settling",settlementChain:s}:a);k(i),setTimeout(()=>{const a=w().map(n=>n.id===t?{...n,status:"settled"}:n);k(a)},2200)},listAuctions:()=>ce(),joinAuction:t=>{const s=ce().map(i=>i.id===t?{...i,participants:i.participants+1,status:i.participants+1>=20?"filling":i.status}:i);return Be(s),s.find(i=>i.id===t)}};function Je(){const t=[];for(let s=0;s<24;s++){const i=s>=17&&s<=20?28:0,a=Math.max(0,Math.exp(-(((s-13)/4)**2)))*-6;t.push({t:`${s.toString().padStart(2,"0")}:00`,lmp:Math.round((42+i+a+Math.sin(s/2)*4)*10)/10})}return t}function Ue(t){const s=t.filter(c=>c.status==="settled"||c.status==="filled"),i=s.reduce((c,d)=>c+d.mwh,0),a=s.reduce((c,d)=>c+d.mwh*d.priceUsd*(d.side==="ask"?1:-.4),0),n=t.filter(c=>c.status==="filled"||c.status==="settled").length,l=t.length?Math.round(n/t.length*100):0,u=s.length?s.reduce((c,d)=>
1c+d.priceUsd,0)/s.length:0;return{pnlUsd:Math.round(a),mwh:Math.round(i*10)/10,avgLmp:Math.round(u*10)/10,winRate:l}}async function Ke(t,s){await new Promise(n=>setTimeout(n,900));const i=Math.round(s/65e3*1e8);return{txid:"ckbtc_"+Math.random().toString(36).slice(2,10)+t.slice(0,4),sats:i}}const v="ecopowerhub.solar.v2",O=()=>Math.random().toString(36).slice(2,10);function He(t){if(!t||typeof t!="object")return!1;const s=t;return typeof s.id=="string"&&typeof s.name=="string"&&typeof s.capacityKw=="number"&&typeof s.panelCount=="number"&&typeof s.lat=="number"&&typeof s.lng=="number"}function B(){return[{id:O(),name:"Annapolis Co-op Array A",location:"Annapolis, MD",lat:38.9784,lng:-76.4922,capacityKw:480,panelCount:1200,inverterType:"SolarEdge SE100K",tiltDeg:30,installedAt:"2025-04-12"},{id:O(),name:"Frederick Community Solar",location:"Frederick, MD",lat:39.4143,lng:-77.4105,capacityKw:720,panelCount:1800,inverterType:"SMA Sunny Tripower",tiltDeg:28,installedAt:"2025-07-03"},{id:O(),name:"Salisbury Rural Grid",location:"Salisbury, MD",lat:38.3607,lng:-75.5994,capacityKw:320,panelCount:800,inverterType:"Enphase IQ8",tiltDeg:32,installedAt:"2026-01-22"}]}function P(){try{const t=localStorage.getItem(v);if(!t){const a=B();return localStorage.setItem(v,JSON.stringify(a)),a}const s=JSON.parse(t);if(!Array.isArray(s))throw new Error("bad shape");const i=s.filter(He);if(i.length===0){const a=B();return localStorage.setItem(v,JSON.stringify(a)),a}return i}catch{const t=B();try{localStorage.setItem(v,JSON.stringify(t))}catch{}return t}}function J(t){localStorage.setItem(v,JSON.stringify(t))}const U={list:()=>P(),create:t=>{const s=P(),i={...t,id:O(),installedAt:new Date().toISOString().slice(0,10)};return s.unshift(i),J(s),i},update:(t,s)=>{const i=P().map(a=>a.id===t?{...a,...s}:a);return J(i),i.find(a=>a.id===t)},remove:t=>{J(P().filter(s=>s.id!==t))}},Y="ecopowerhub.hvac.v1",j=()=>Math.random().toString(36).slice(2,10);function le(){return[{id:j(),name:"Annapolis HQ â Lobby",site:"Annapolis, MD",setpointF:72,currentF:73.4,mode:"cool",occupancy:.62,fanPct:55,filterHealth:78},{id:j(),name:"Annapolis HQ â Server Room",site:"Annapolis, MD",setpointF:6
15,currentF:66.1,mode:"cool",occupancy:.05,fanPct:80,filterHealth:91},{id:j(),name:"Frederick Warehouse â Bay 1",site:"Frederick, MD",setpointF:68,currentF:70.9,mode:"cool",occupancy:.34,fanPct:60,filterHealth:42},{id:j(),name:"Frederick Warehouse â Office",site:"Frederick, MD",setpointF:71,currentF:71.2,mode:"auto",occupancy:.48,fanPct:40,filterHealth:65},{id:j(),name:"Salisbury Co-op â Floor",site:"Salisbury, MD",setpointF:72,currentF:74,mode:"cool",occupancy:.71,fanPct:70,filterHealth:58}]}function de(){try{const t=localStorage.getItem(Y);if(!t){const s=le();return localStorage.setItem(Y,JSON.stringify(s)),s}return JSON.parse(t)}catch{return le()}}function Le(t){localStorage.setItem(Y,JSON.stringify(t))}const K={list:()=>de(),update:(t,s)=>{const i=de().map(a=>a.id===t?{...a,...s}:a);return Le(i),i.find(a=>a.id===t)}},q="ecopowerhub.gen.v1",M=()=>Math.random().toString(36).slice(2,10);function me(){return[{id:M(),name:"GEN-01 Annapolis Primary",site:"Annapolis, MD",fuelType:"diesel",capacityKw:800,fuelPct:84,runtimeHrs:132,serviceIntervalHrs:250,status:"standby",lastTest:"2026-04-28",efficiency:96,autoStart:!0},{id:M(),name:"GEN-02 Annapolis Backup",site:"Annapolis, MD",fuelType:"natgas",capacityKw:500,fuelPct:91,runtimeHrs:58,serviceIntervalHrs:300,status:"standby",lastTest:"2026-05-01",efficiency:94,autoStart:!0},{id:M(),name:"GEN-04 Frederick MEC",site:"Frederick, MD",fuelType:"diesel",capacityKw:1e3,fuelPct:62,runtimeHrs:248,serviceIntervalHrs:250,status:"standby",lastTest:"2026-04-22",efficiency:91,autoStart:!0},{id:M(),name:"GEN-07 Salisbury Hybrid",site:"Salisbury, MD",fuelType:"hybrid",capacityKw:600,fuelPct:78,runtimeHrs:96,serviceIntervalHrs:280,status:"test",lastTest:"2026-05-04",efficiency:97,autoStart:!0}]}function pe(){try{const t=localStorage.getItem(q);if(!t){const s=me();return localStorage.setItem(q,JSON.stringify(s)),s}return JSON.parse(t)}catch{return me()}}function Re(t){localStorage.setItem(q,JSON.stringify(t))}const H={list:()=>pe(),update:(t,s)=>{const i=pe().map(a=>a.id===t?{...a,...s}:a);return Re(i),i.find(a=>a.id===t)}},Q="ecopowerhub.storage.v1",L=()=>Math.random().toString(36).slice(2,10);function ue(){return[{id:L(),name:"Annapolis BESS-1",site:"Annapolis, MD",capacityKwh:1e3,powerKw:500,soc:72,soh:98,cycles:412,tempC:28,mode:"auto",vppEnrolled:!0,chemistry:"LFP",installedAt:"2025-05-04"},{id:L(),name:"Frederick BESS-2",site:"Frederick, MD",capacityKwh:800,powerKw:400,soc:58,soh:96,cycles:891,tempC:31,mode:"charge",vppEnrolled:!0,chemistry:"LFP",installedAt:"2025-08-19"},{id:L(),name:"Salisbury BESS-3",site:"Salisbury, MD",capacityKwh:600,powerKw:300,soc:41,soh:94,cycles:1182,tempC:33,mode:"vpp",vppEnrolled:!0,chemistry:"NMC",installedAt:"2026-01-12"}]}function xe(){try{const t=localStorage.getItem(Q);if(!t){const s=ue();return localStorage.setItem(Q,JSON.stringify(s)),s}return JSON.parse(t)}catch{return ue()}}function ze(t){localStorage.setItem(Q,JSON.stringify(t))}const R={list:()=>xe(),update:(t,s)=>{const i=xe().map(a=>a.id===t?{...a,...s}:a);return ze(i),i.find(a=>a.id===t)}};let C=null;function A(){return C||(C={async getSolarFleet(){return U.list()},async addSolarArray(t){return U.create(t)},async getHvacZones(){return K.list()},async setHvacZone(t,s){return K.update(t,s)},async getGenerators(){return H.list()},async setGenerator(t,s){return H.update(t,s)},async getBatteries(){return R.list()},async setBattery(t,s){return R.update(t,s)},async getOrderBook(){return m.listOrders()},async placeOrder(t){return m.placeOrder(t)},async settleOrder(t,s){m.settleOrder(t,s)},async getAuctions(){return m.listAuctions()},async joinAuction(t){return m.joinAuction(t)},async settleCkBtc(t,s){return Ke(t,s)},async getFleetSnapshot(){return{solar:U.list(),hvac:K.list(),generators:H.list(),batteries:R.list(),orders:m.listOrders(),auctions:m.listAuctions(),takenAt:new Date().toISOString()}}},C)}function as(){Se({title:"Energy trading & VPP energy OS | EcoPowerHub",description:"Coordinate energy orders, market signals and VPP workflows through EcoPowerHub's decentralized energy OS and auditable settlement tools.",canonical:"/trading",jsonLd:[ke({name:"Energy Trading & VPP",description:"P2P energy orders, VPP auctions and market tape with on-chain settlement for sovereign producers.",path:"/trading",serviceType:"Energy trading and virtual power plant software"}),Pe([{name:"Home",url:"/"},{name:"Trading",url:"/trading"}])]});const[t,s]=p.useState(()=>m.listOrders()),[i,a]=p.useState(()=>m.listAuctions()),[n,l]=p.useState(!1),[u,c]=p.useState("bid"),[d,ge]=p.useState("52.0"),[E,fe]=p.useState("0.5"),f=()=>{s(m.listOrders()),a(m.listAuctions())};p.useEffect(()=>{const r=setInterval(f,3500);return()=>clearInterval(r)},[]);const I=p.useMemo(()=>Je(),[]),S=p.useMemo(()=>Ue(t),[t]),T=t.filter(r=>r.side==="bid"&&r.status==="open").sort((r,o)=>o.priceUsd-r.priceUsd),F=t.filter(r=>r.side==="ask"&&r.status==="open").sort((r,o)=>r.priceUsd-o.priceUsd),be=async()=>{const r=parseFloat(d),o=parseFloat(E);!r||!o||(await A().placeOrder({side:u,type:"P2P",party:"You · Annapolis Co-op",priceUsd:r,mwh:o}),y.success(`${u.toUpperCase()} ${o} MWh @ $${r}`),f())},D=async(r,o)=>{if(await A().settleOrder(r,o),y.success(`Settling via ${o}â¦`),f(),o==="ckBTC"){const b=t.find(g=>g.id===r);if(b){const g=await A().settleCkBtc(r,b.priceUsd*b.mwh);y.success(`ckBTC tx ${g.txid.slice(0,14)}
1⦠(${g.sats.toLocaleString()} sats)`)}}setTimeout(f,2400)},ye=async r=>{const o=await A().joinAuction(r);y.success(`Joined ${o==null?void 0:o.title}`),f()};return e.jsxs(Ne,{children:[e.jsxs("div",{className:"relative overflow-hidden bg-gradient-hero text-white",children:[e.jsx(De,{}),e.jsx("div",{className:"absolute inset-0 opacity-30 pointer-events-none",style:{backgroundImage:"radial-gradient(circle at 20% 30%, hsl(var(--primary-glow)) 0, transparent 40%), radial-gradient(circle at 85% 70%, hsl(var(--eco-glow)) 0, transparent 40%)"}}),e.jsx("div",{className:"absolute inset-0 opacity-[0.07]",style:{backgroundImage:"linear-gradient(hsl(var(--primary-glow)) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--primary-glow)) 1px, transparent 1px)",backgroundSize:"40px 40px"}}),e.jsxs("div",{className:"relative max-w-7xl mx-auto px-6 md:px-10 py-10",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/10 backdrop-blur-sm border border-white/20 text-xs font-medium mb-3",children:[e.jsx(_,{className:"h-3.5 w-3.5"})," Energy Trading · Live · PJM AECO + P2P + VPP"]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight",children:"Trading Cockpit & VPP Auction Engine"}),e.jsx("p",{className:"mt-2 text-white/80 max-w-2xl",children:"P2P order book, live VPP auctions, cross-chain settlement (PJM, ICP, ckBTC) for Maryland co-ops."}),e.jsxs("div",{className:"mt-5 flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs border backdrop-blur-sm ${n?"bg-eco/20 border-eco/40 text-eco-glow":"bg-white/10 border-white/20"}`,children:[n?e.jsx(Z,{className:"h-3.5 w-3.5"}):e.jsx(Oe,{className:"h-3.5 w-3.5"}),"zk-Private Bidding",e.jsx(Ce,{checked:n,onCheckedChange:r=>{l(r),y.success(r?"zk-SNARK proofs enabled â bids masked":"Private mode off")}})]}),e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs bg-white/10 backdrop-blur-sm border border-white/20",children:[e.jsx(re,{className:"h-3.5 w-3.5 text-warning"})," ckBTC bridge: connected"]}),e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs bg-white/10 backdrop-blur-sm border border-white/20",children:[e.jsx(Ee,{className:"h-3.5 w-3.5 text-eco-glow"})," ICP canister: ecopowerhub"]})]})]})]}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 md:px-10 py-8 space-y-8",children:[e.jsx($e,{feature:"priority VPP bidding & front-of-queue auctions"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx($,{accent:!0,icon:e.jsx(Ie,{className:"h-4 w-4"}),label:"PnL (MTD)",value:`$${S.pnlUsd.toLocaleString()}`,sub:"+18% vs plan"}),e.jsx($,{icon:e.jsx(X,{className:"h-4 w-4"}),label:"Cleared MWh",value:`${S.mwh}`,sub:"DA + RT + P2P"}),e.jsx($,{icon:e.jsx(_,{className:"h-4 w-4"}),label:"Avg LMP",value:`$${S.avgLmp}`,sub:"PJM AECO"}),e.jsx($,{icon:e.jsx(ae,{className:"h-4 w-4"}),label:"Win rate",value:`${S.winRate}%`,sub:"Bid acceptance"})]}),e.jsxs(h,{className:"p-5 bg-card/60 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"PJM AECO LMP · 24h tape"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"$/MWh · evening peak window highlighted"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Last: ",e.jsxs("span",{className:"text-eco-glow font-semibold tabular-nums",children:["$",I[I.length-1].lmp]})]})]}),e.jsx("div",{className:"h-44",children:e.jsx(Ae,{children:({Area:r,AreaChart:o,ResponsiveContainer:b,Tooltip:g,XAxis:we,YAxis:je,CartesianGrid:ve})=>e.jsx(b,{width:"100%",height:"100%",children:e.jsxs(o,{data:I,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"lmpFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--eco-glow))",stopOpacity:.5}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--eco-glow))",stopOpacity:0})]})}),e.jsx(ve,{stroke:"hsl(var(--border))",strokeDasharray:"3 3"}),e.jsx(we,{dataKey:"t",stroke:"hsl(var(--muted-foreground))",fontSize:11}),e.jsx(je,{stroke:"hsl(var(--muted-foreground))",fontSize:11}),e.jsx(g,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8}}),e.jsx(r,{type:"monotone",dataKey:"lmp",stroke:"hsl(var(--eco-glow))",fill:"url(#lmpFill)",strokeWidth:2})]})})})})]}),e.jsxs(h,{className:"p-5 bg-card/60 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(ae,{className:"h-4 w-4 text-eco-glow"}),e.jsx("div",{className:"font-semibold",children:"VPP Auction Engine"}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Live PJM AECO · auto-bid via canister"})]}),e.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:i.map(r=>e.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-4 hover:shadow-glow transition-smooth",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsx("div",{className:"font-semibold text-sm",children:r.title}),e.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded border ${r.status==="open"?"bg-eco/20 border-eco/40 text-eco-glow":r.status==="filling"?"bg-warning/20 border-warning/40 text-warning":"bg-muted text-muted-foreground"}`,children:r.status})]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:r.window}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-3 text-center",children:[e.jsx(z,{label:"Premium",value:`+${r.premiumPct}%`,accent:!0}),e.jsx(z,{label:"Capacity",value:`${r.capacityMw} MW`}),e.jsx(z,{label:"Closes",value:`${r.closesInMin}m`})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[r.participants," co-ops in"]}),e.jsxs(x,{size:"sm",onClick:()=>
1ye(r.id),className:"bg-gradient-eco text-eco-foreground",children:[e.jsx(ee,{className:"h-3.5 w-3.5 mr-1"})," Participate"]})]})]},r.id))})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-4",children:[e.jsxs(h,{className:"p-5 lg:col-span-2 bg-card/60 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"font-semibold flex items-center gap-2",children:[e.jsx(X,{className:"h-4 w-4"})," P2P Order Book"]}),e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Spread: $",F[0]&&T[0]?(F[0].priceUsd-T[0].priceUsd).toFixed(2):"â"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-eco-glow mb-1 flex items-center gap-1",children:[e.jsx(Te,{className:"h-3 w-3"})," Bids"]}),e.jsx(he,{rows:T,side:"bid",privateMode:n})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-[10px] uppercase tracking-wider text-warning mb-1 flex items-center gap-1",children:[e.jsx(Fe,{className:"h-3 w-3"})," Asks"]}),e.jsx(he,{rows:F,side:"ask",privateMode:n})]})]})]}),e.jsxs(h,{className:"p-5 bg-card/60 backdrop-blur-sm",children:[e.jsx("div",{className:"font-semibold mb-3",children:"Place Order"}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsx(x,{size:"sm",variant:u==="bid"?"default":"outline",onClick:()=>c("bid"),className:u==="bid"?"bg-eco text-eco-foreground hover:bg-eco/90":"",children:"BID"}),e.jsx(x,{size:"sm",variant:u==="ask"?"default":"outline",onClick:()=>c("ask"),className:u==="ask"?"bg-warning text-warning-foreground hover:bg-warning/90":"",children:"ASK"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(te,{className:"text-xs",children:"Price ($/MWh)"}),e.jsx(se,{value:d,onChange:r=>ge(r.target.value),type:"number",step:"0.1"})]}),e.jsxs("div",{children:[e.jsx(te,{className:"text-xs",children:"Quantity (MWh)"}),e.jsx(se,{value:E,onChange:r=>fe(r.target.value),type:"number",step:"0.1"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground rounded border border-border bg-muted/30 p-2",children:["Notional: ",e.jsxs("span",{className:"text-foreground font-semibold tabular-nums",children:["$",(parseFloat(d||"0")*parseFloat(E||"0")).toFixed(2)]}),n&&e.jsxs("div",{className:"mt-1 text-eco-glow flex items-center gap-1",children:[e.jsx(Z,{className:"h-3 w-3"})," zk-proof will mask quantity"]})]}),e.jsx(x,{className:"w-full",onClick:be,children:"Submit P2P Order"})]})]})]}),e.jsxs(h,{className:"p-5 bg-card/60 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(ie,{className:"h-4 w-4 text-eco-glow"}),e.jsx("div",{className:"font-semibold",children:"Settlements & Cross-chain"}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"PJM eSuite · ICP ledger · ckBTC bridge"})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-[10px] uppercase tracking-wider text-muted-foreground border-b border-border",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left py-2",children:"Counterparty"}),e.jsx("th",{className:"text-left",children:"Type"}),e.jsx("th",{className:"text-right",children:"Price"}),e.jsx("th",{className:"text-right",children:"MWh"}),e.jsx("th",{className:"text-right",children:"Notional"}),e.jsx("th",{className:"text-center",children:"Status"}),e.jsx("th",{className:"text-right",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:t.slice(0,8).map(r=>e.jsxs("tr",{className:"hover:bg-accent/40",children:[e.jsx("td",{className:"py-2",children:n&&r.status!=="settled"?"â â â (zk)":r.party}),e.jsxs("td",{children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-muted",children:r.type})," ",e.jsx("span",{className:`text-[10px] ml-1 ${r.side==="bid"?"text-eco-glow":"text-warning"}`,children:r.side})]}),e.jsxs("td",{className:"text-right tabular-nums",children:["$",r.priceUsd]}),e.jsx("td",{className:"text-right tabular-nums",children:r.mwh}),e.jsxs("td",{className:"text-right tabular-nums",children:["$",(r.priceUsd*r.mwh).toFixed(2)]}),e.jsx("td",{className:"text-center",children:e.jsxs("span",{className:`text-[10px] px-1.5 py-0.5 rounded border inline-flex items-center gap-1 ${r.status==="settled"?"bg-eco/20 border-eco/40 text-eco-glow":r.status==="settling"?"bg-warning/20 border-warning/40 text-warning":r.status==="filled"?"bg-primary/20 border-primary/40 text-primary-glow":r.status==="cancelled"?"bg-muted text-muted-foreground":"bg-muted/50 text-muted-foreground"}`,children:[r.status==="settling"&&e.jsx(Me,{className:"h-3 w-3 animate-spin"}),r.status==="settled"&&e.jsx(ie,{className:"h-3 w-3"}),r.status,r.settlementChain?` · ${r.settlementChain}`:""]})}),e.jsx("td",{className:"text-right",children:r.status==="open"||r.status==="filled"?e.jsxs("div",{className:"inline-flex gap-1",children:[e.jsx(x,{size:"sm",variant:"outline",className:"h-6 px-2 text-[10px]",onClick:()=>
1D(r.id,"PJM"),children:"PJM"}),e.jsx(x,{size:"sm",variant:"outline",className:"h-6 px-2 text-[10px]",onClick:()=>D(r.id,"ICP"),children:"ICP"}),e.jsxs(x,{size:"sm",variant:"outline",className:"h-6 px-2 text-[10px] text-warning border-warning/40",onClick:()=>D(r.id,"ckBTC"),children:[e.jsx(re,{className:"h-3 w-3 mr-0.5"}),"ckBTC"]})]}):e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"â"})})]},r.id))})]})})]}),e.jsxs(h,{className:"p-5 bg-card/60 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"h-8 w-8 rounded-md bg-gradient-eco grid place-items-center",children:e.jsx(ee,{className:"h-4 w-4 text-eco-foreground"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"AI nudges · Trading opportunities"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"From LMP forecast + VPP auction telemetry"})]})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-3",children:[e.jsx(V,{tone:"good",title:"VPP event in 2 hours",body:"Evening Peak auction premium 28% above spot â bid 1.2 MW Annapolis BESS at $72/MWh floor for est. +$840 net."}),e.jsx(V,{tone:"info",title:"Tighten DA bid",body:"Frederick solar over-forecast by 6% last 7 days â reduce day-ahead generation bid by 4% to avoid imbalance penalties."}),e.jsx(V,{tone:"warn",title:"3 SRECs eligible",body:"Maryland Tier-1 SRECs at ~$58 â list 3 this week, est. revenue $174. Settle via ckBTC for instant treasury."})]})]})]})]})}function $({icon:t,label:s,value:i,sub:a,accent:n}){return e.jsxs(h,{className:`p-4 relative overflow-hidden hover:-translate-y-0.5 transition-smooth ${n?"bg-gradient-eco text-eco-foreground border-0 shadow-glow":"bg-card/60 backdrop-blur-sm hover:shadow-glow"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium opacity-80 uppercase tracking-wider",children:[t,s]}),e.jsx("div",{className:"text-2xl font-bold mt-2 tabular-nums",children:i}),a&&e.jsx("div",{className:"text-[11px] opacity-70 mt-0.5",children:a})]})}function z({label:t,value:s,accent:i}){return e.jsxs("div",{className:"rounded-md bg-card/60 border border-border p-1.5",children:[e.jsx("div",{className:"text-[9px] uppercase text-muted-foreground tracking-wider",children:t}),e.jsx("div",{className:`text-sm font-semibold tabular-nums ${i?"text-eco-glow":""}`,children:s})]})}function he({rows:t,side:s,privateMode:i}){const a=Math.max(...t.map(l=>l.mwh),.1),n=s==="bid"?"bg-eco/15":"bg-warning/15";return e.jsxs("div",{className:"space-y-1",children:[t.length===0&&e.jsx("div",{className:"text-xs text-muted-foreground p-2",children:"No open orders."}),t.slice(0,6).map(l=>e.jsxs("div",{className:"relative text-xs py-1.5 px-2 rounded overflow-hidden border border-border/50",children:[e.jsx("div",{className:`absolute inset-y-0 left-0 ${n}`,style:{width:`${l.mwh/a*100}%`}}),e.jsxs("div",{className:"relative flex items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate text-muted-foreground",children:i?"â â â":l.party}),e.jsxs("span",{className:"font-semibold tabular-nums",children:["$",l.priceUsd]}),e.jsxs("span",{className:"tabular-nums text-muted-foreground",children:[l.mwh," MWh"]})]})]},l.id))]})}function V({tone:t,title:s,body:i}){const a=t==="good"?"border-success/40 bg-success/5":t==="warn"?"border-warning/40 bg-warning/5":"border-primary/40 bg-primary/5";return e.jsxs("div",{className:`rounded-lg border ${a} p-3`,children:[e.jsx("div",{className:"text-sm font-semibold mb-1",children:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:i})]})}export{as as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.