@origintrail-official/dkg-node-ui 10.0.16 → 10.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chain-cursor-stores.d.ts +48 -0
- package/dist/chain-cursor-stores.d.ts.map +1 -1
- package/dist/chain-cursor-stores.js +145 -0
- package/dist/chain-cursor-stores.js.map +1 -1
- package/dist/chain-event-log-store.d.ts +84 -0
- package/dist/chain-event-log-store.d.ts.map +1 -0
- package/dist/chain-event-log-store.js +289 -0
- package/dist/chain-event-log-store.js.map +1 -0
- package/dist/db.d.ts +16 -58
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +125 -144
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol-outbox-store.d.ts +67 -0
- package/dist/protocol-outbox-store.d.ts.map +1 -0
- package/dist/protocol-outbox-store.js +199 -0
- package/dist/protocol-outbox-store.js.map +1 -0
- package/dist-ui/assets/{3d-force-graph-bUKbeTGZ.js → 3d-force-graph-DGF2sXeK.js} +1 -1
- package/dist-ui/assets/ActivityFeed-DNatshHL.js +99 -0
- package/dist-ui/assets/{AgentHub-4c4sH_Jd.js → AgentHub-lOm96XuE.js} +1 -1
- package/dist-ui/assets/{AgentProfilePage-ClhUeZxy.js → AgentProfilePage-BRtazufK.js} +1 -1
- package/dist-ui/assets/ApproveWalletsModal-BMtRgndO.js +3 -0
- package/dist-ui/assets/{ContextGraphPrimitives-Bwc2i7EX.js → ContextGraphPrimitives-CBc6kvmp.js} +1 -1
- package/dist-ui/assets/ConvictionDetailView-DOTYSm7p.js +2 -0
- package/dist-ui/assets/{MemoryLayerView-DxL2MjyA.js → MemoryLayerView-DDFI2ngR.js} +2 -2
- package/dist-ui/assets/{MemoryStackView-BLhA3bn0.js → MemoryStackView-Bol2eMyq.js} +1 -1
- package/dist-ui/assets/{Network-BNhbBzOD.js → Network-B49IxpAj.js} +1 -1
- package/dist-ui/assets/{OnChainProvenanceCard-DKyfVEjF.js → OnChainProvenanceCard-BpUoHg4b.js} +1 -1
- package/dist-ui/assets/{Operations-mCPe0E-j.js → Operations-BCQ545Yk.js} +1 -1
- package/dist-ui/assets/{ProjectView-jrGPu5ON.js → ProjectView-BaQQSy8L.js} +20 -20
- package/dist-ui/assets/PublishingConviction-B5nWRsUP.js +2 -0
- package/dist-ui/assets/Settings-DeZKX_Ry.js +1 -0
- package/dist-ui/assets/browserWalletTransaction-B6wyaMOV.js +55 -0
- package/dist-ui/assets/ccip-B_vQl40F.js +1 -0
- package/dist-ui/assets/{index-VYV5TH6q.css → index-BLQUVvVz.css} +1 -1
- package/dist-ui/assets/index-CT-LdpBE.js +1175 -0
- package/dist-ui/assets/{index-UvxrSkC_.js → index-DHd3qhAk.js} +3 -3
- package/dist-ui/assets/{jsonld-32FQRO67-Dl6_9Lk9.js → jsonld-32FQRO67-BYu8pE-5.js} +2 -2
- package/dist-ui/assets/{jsonld-Dj4KMENF.js → jsonld-Crm5iwcE.js} +1 -1
- package/dist-ui/assets/{renderer-3d-2EVDZII7-DfnhcMkF.js → renderer-3d-2EVDZII7-C2z5aUgo.js} +2 -2
- package/dist-ui/assets/{shikiHighlighter-ByXDJnWi.js → shikiHighlighter-DW1fRfBU.js} +1 -1
- package/dist-ui/assets/{useEntityOnChainReceipt-BRK_O_sb.js → useEntityOnChainReceipt-0Ub24t6e.js} +1 -1
- package/dist-ui/assets/{useProjectActivity-OdoQs9mK.js → useProjectActivity-CLza3psq.js} +1 -1
- package/dist-ui/index.html +2 -2
- package/package.json +3 -3
- package/dist-ui/assets/ActivityFeed-CC5S_gk9.js +0 -100
- package/dist-ui/assets/ApproveWalletsModal-CBKp6zQB.js +0 -57
- package/dist-ui/assets/ConvictionDetailView-a3v7xwcm.js +0 -2
- package/dist-ui/assets/PublishingConviction-BGi128uo.js +0 -2
- package/dist-ui/assets/Settings-D1oxLo1Y.js +0 -1
- package/dist-ui/assets/ccip-WHHgwjp-.js +0 -1
- package/dist-ui/assets/index-RLb1kuzE.js +0 -1174
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{aO as t,bc as g,aw as Ie,N as fe,b6 as st,bN as K,b8 as Ct,b5 as Nt,b3 as kt,z as jt,a7 as oe,ai as Fe,b4 as Tt,aH as Pt,aB as St,aS as Rt,bF as Et,bv as Ot,by as ke,aN as Ue,bJ as he,aq as We,H as Be,aI as It,B as ot}from"./index-CT-LdpBE.js";import{Q as Wt,e as ge,C as it,W as $t,B as Ht,d as ce,E as Dt,O as ct,r as Lt,i as Bt,q as lt,o as Y,c as Ke,f as Ve}from"./browserWalletTransaction-B6wyaMOV.js";const _t={healthy:{glyph:"✓",label:"Healthy",toneClass:"badge-success",hint:"Active, solvent, and not expiring soon."},expiring:{glyph:"⏳",label:"Expiring soon",toneClass:"badge-warn",hint:"The lock period ends soon — top-up does NOT extend it; renew to keep the discount."},expired:{glyph:"✕",label:"Expired",toneClass:"badge-error",hint:"The lock period has ended — publishes no longer get this discount. Renew to continue."},insolvent:{glyph:"⚠",label:"Insolvent",toneClass:"badge-error",hint:"The spendable buffer is depleted — publishes will quietly pay the direct cost. Top up."},swept:{glyph:"⊘",label:"Fully swept",toneClass:"badge",hint:"Every epoch budget has been swept to the staker reward pool."},"cap-near":{glyph:"⚠",label:"Cap near 100",toneClass:"badge-warn",hint:"Approaching the 100 approved-publishing-wallet cap."}};function Ba({state:e,label:a,className:n=""}){const s=_t[e],r=a??s.label,o=[...new Set(["badge",s.toneClass,"v10-pca-health-chip",n])].filter(Boolean).join(" ");return t.jsxs("span",{className:o,"data-testid":"pca-health-chip","data-health":e,title:s.hint,children:[t.jsx("span",{className:"v10-pca-health-glyph","aria-hidden":"true",children:s.glyph}),t.jsx("span",{className:"v10-pca-health-label",children:r})]})}const Mt=t.jsxs(t.Fragment,{children:["Paste the ",t.jsx("strong",{children:"operational wallet address"})," — the address that signs its publish transactions (on-chain ",t.jsx("code",{children:"msg.sender"}),"). ",t.jsx("strong",{children:"NOT"})," its peerId."," ",t.jsx("strong",{children:"NOT"})," its admin wallet. ",t.jsx("strong",{children:"NOT"})," a content-author identity. The other operator gets these from ",t.jsx("code",{children:"dkg wallet"}),", or from their node's"," ",t.jsx("em",{children:"Get added to a PCA"})," panel."]});function Ft({value:e,onChange:a,mode:n="single",label:s="Operational wallet (the address that signs publishes)",cruxNote:r=Mt,placeholder:o,error:i,disabled:c=!1,rows:f=5,id:x,testId:v,className:w=""}){const A=g.useId(),N=x??`pca-addr-${A}`,R=`${N}-help`,H=`${N}-error`,h=[i?H:null,R].filter(Boolean).join(" ")||void 0,l=n==="bulk"?"0x… (one per line)":"0x…";return t.jsxs("div",{className:["v10-pca-address-crux",w].filter(Boolean).join(" "),children:[t.jsx("label",{className:"v10-form-label",htmlFor:N,children:s}),r!=null&&t.jsx("p",{className:"v10-pca-crux-note",children:r}),n==="bulk"?t.jsx("textarea",{id:N,"data-testid":v,className:"v10-form-textarea",value:e,onChange:k=>a(k.target.value),placeholder:o??l,disabled:c,rows:f,"aria-describedby":h,"aria-invalid":i?!0:void 0,spellCheck:!1}):t.jsx("input",{id:N,"data-testid":v,type:"text",className:"v10-form-input",value:e,onChange:k=>a(k.target.value),placeholder:o??l,disabled:c,"aria-describedby":h,"aria-invalid":i?!0:void 0,spellCheck:!1,autoComplete:"off"}),t.jsxs("p",{id:R,className:"v10-pca-crux-help",children:[t.jsx("abbr",{title:"On-chain authorization to publish under this account — unrelated to the ERC-20 token approve() that grants a spending allowance.",children:"“Approve”"})," ","is on-chain authorization to publish under this account — unrelated to ERC-20 token"," ",t.jsx("code",{children:"approve()"}),". The wallet owner doesn't sign anything."]}),i!=null&&t.jsx("p",{id:H,className:"v10-pca-crux-error",role:"alert",children:i})]})}const _e=[{minTrac:0,bps:0,tracLabel:"< 25,000 TRAC",pctLabel:"0%"},{minTrac:25e3,bps:1e3,tracLabel:"25,000 TRAC",pctLabel:"10%"},{minTrac:5e4,bps:2e3,tracLabel:"50,000 TRAC",pctLabel:"20%"},{minTrac:1e5,bps:3e3,tracLabel:"100,000 TRAC",pctLabel:"30%"},{minTrac:25e4,bps:4e3,tracLabel:"250,000 TRAC",pctLabel:"40%"},{minTrac:5e5,bps:5e3,tracLabel:"500,000 TRAC",pctLabel:"50%"},{minTrac:1e6,bps:7500,tracLabel:"1,000,000+ TRAC",pctLabel:"75%"}];function dt(e){const a=typeof e=="number"&&Number.isFinite(e)?e:0;let n=_e[0];for(const s of _e)a>=s.minTrac&&(n=s);return n}function Ut({committedTrac:e,caption:a="Discount tier for the entered commitment.",className:n=""}){const s=e==null?null:dt(e);return t.jsxs("div",{className:["v10-pca-tier-ladder",n].filter(Boolean).join(" "),"data-testid":"pca-tier-ladder",children:[t.jsx("ul",{className:"v10-pca-tier-list",role:"list",children:_e.map(r=>{const o=s!=null&&s.minTrac===r.minTrac;return t.jsxs("li",{className:["v10-pca-tier-row",o?"active":""].filter(Boolean).join(" "),"data-bps":r.bps,...o?{"aria-current":"true"}:{},children:[t.jsx("span",{className:"v10-pca-tier-trac",children:r.tracLabel}),t.jsx("span",{className:"v10-pca-tier-pct",children:r.pctLabel})]},r.minTrac)})}),a!=null&&t.jsx("p",{className:"v10-pca-tier-caption",children:a})]})}function Kt({wallets:e=[],accountId:a,role:n="edge",className:s=""}){const{copied:r,copy:o}=Wt(),i=e.join(`
|
|
2
|
+
`);return t.jsxs("div",{className:["v10-pca-handshake",s].filter(Boolean).join(" "),children:[t.jsxs("section",{className:"v10-pca-handshake-half","data-emphasis":n==="edge"?"true":"false",children:[t.jsxs("header",{className:"v10-pca-handshake-head",children:[t.jsx("span",{className:"v10-pca-handshake-title",children:"Operational wallets"}),t.jsx("span",{className:"v10-pca-handshake-sub",children:"The edge node shares these; the PCA owner approves them."})]}),e.length===0?t.jsx("p",{className:"v10-pca-handshake-empty",children:"No operational wallets detected on this node."}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"v10-pca-handshake-wallets",children:e.map(c=>t.jsx(ge,{address:c},c))}),t.jsx("button",{type:"button",className:"v10-pca-handshake-copyall",onClick:()=>o(i),"aria-label":r?"Copied all wallets":"Copy all wallet addresses",children:r?"Copied":"Copy all"})]})]}),t.jsxs("section",{className:"v10-pca-handshake-half","data-emphasis":n==="core"?"true":"false",children:[t.jsxs("header",{className:"v10-pca-handshake-head",children:[t.jsx("span",{className:"v10-pca-handshake-title",children:"PCA ID from owner"}),t.jsx("span",{className:"v10-pca-handshake-sub",children:"The PCA owner sends this back after approving the wallets."})]}),a?t.jsxs("div",{className:"v10-pca-handshake-account",children:[t.jsxs("span",{className:"v10-pca-handshake-account-id",children:["PCA #",a]}),t.jsx(it,{value:a,label:`Copy account id ${a}`})]}):t.jsx("p",{className:"v10-pca-handshake-empty",children:"Pending - enter it once the PCA owner confirms the approval."})]})]})}const Vt=50;function qt({nodes:e,loading:a,error:n,onRetry:s,value:r,onChange:o,ownIdentityId:i,role:c,required:f=!1}){const[x,v]=g.useState(""),[w,A]=g.useState(!1),[N,R]=g.useState(-1),[H,h]=g.useState(""),[l,k]=g.useState(null),u=g.useId(),p=g.useMemo(()=>{const m=x.trim().toLowerCase();return m?e.filter(L=>L.nodeId.toLowerCase().includes(m)||L.identityId.toLowerCase().includes(m)):e},[e,x]),b=p.slice(0,Vt),y=p.length>b.length,j=m=>{o(m.identityId),v(""),A(!1),R(-1),k(null)},D=m=>{m.key==="ArrowDown"?(m.preventDefault(),A(!0),R(L=>Math.min(L+1,b.length-1))):m.key==="ArrowUp"?(m.preventDefault(),A(!0),R(L=>Math.max(L-1,0))):m.key==="Enter"?w&&N>=0&&b[N]&&(m.preventDefault(),j(b[N])):m.key==="Escape"&&w&&(m.stopPropagation(),A(!1),R(-1))},E=()=>{const m=H.trim().replace(/^#/,"");if(!m)return;const L=e.find(P=>P.identityId===m||P.nodeId.toLowerCase()===m.toLowerCase());if(!L){k("Not a staked sharding-table node.");return}j(L),h("")},I=r?e.find(m=>m.identityId===r):void 0,Q=r!==""&&i!=null&&r===i,ne=r!==""&&(i==null||r!==i),re=c==="edge"||i==null,W=I?Ie(I.stake):null,F=r!==""?`Selected node #${r}${W?` · ${W} TRAC staked`:""}${Q?" · this node":""}`:null,J=F?`${u}-selected`:void 0;return t.jsxs("div",{className:"v10-pca-node-picker","data-testid":"pca-primary-node-picker",children:[t.jsx("p",{className:"v10-pca-create-hint",children:"Primary node = where reward weight goes. It’s separate from which wallets publish and from your discount."}),a?t.jsx("p",{className:"v10-pca-create-hint",role:"status",children:"Loading staked nodes…"}):n?t.jsxs("div",{className:"v10-modal-warning",role:"alert","data-testid":"pca-primary-node-error",children:["Couldn’t load the staked-node list — a primary node is required to create."," ",t.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-primary-node-retry",onClick:s,children:"Retry"}),r!==""&&t.jsxs("p",{className:"v10-pca-create-hint","data-testid":"pca-primary-node-error-selected",children:["Using node #",r,Q?" (this node)":""," for now — Retry to pick another."]})]}):e.length===0?t.jsx("p",{className:"v10-pca-create-hint",role:"status",children:"No staked nodes found."}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:["v10-pca-node-picker-combo",F?"has-selection":""].filter(Boolean).join(" "),children:[t.jsx("input",{type:"text",role:"combobox","aria-expanded":w,"aria-controls":w?u:void 0,"aria-autocomplete":"list","aria-label":"Search staked nodes","aria-describedby":J,"aria-required":f,"aria-invalid":f&&r==="","aria-activedescendant":w&&N>=0&&b[N]?`${u}-opt-${b[N].identityId}`:void 0,className:"v10-form-input","data-testid":"pca-primary-node-search",value:x,placeholder:F??"Search staked nodes by id…",autoComplete:"off",onFocus:()=>A(!0),onChange:m=>{v(m.target.value),A(!0),R(-1)},onKeyDown:D}),w&&t.jsxs("ul",{role:"listbox",id:u,"aria-label":"Staked sharding-table nodes",className:"v10-pca-node-picker-list",children:[b.map((m,L)=>{const P=m.identityId===r,B=i!=null&&m.identityId===i;return t.jsxs("li",{id:`${u}-opt-${m.identityId}`,role:"option","aria-selected":P,"data-testid":"pca-primary-node-option",className:["v10-pca-node-picker-option",L===N?"active":"",P?"selected":""].filter(Boolean).join(" "),"aria-label":`Node ${m.identityId}, peer ${m.nodeId}, stake ${Ie(m.stake)} TRAC${B?", this node":""}`,onMouseDown:$=>{$.preventDefault(),j(m)},children:[t.jsxs("span",{className:"v10-pca-node-picker-id",children:["#",m.identityId]}),t.jsx("span",{className:"v10-pca-node-picker-peer",title:m.nodeId,children:m.nodeId}),t.jsx("span",{className:"badge",title:"Node labels are not verified — match on id",children:"unverified"}),t.jsxs("span",{className:"v10-pca-node-picker-stake",children:[Ie(m.stake)," TRAC staked"]}),B&&t.jsx("span",{className:"v10-pca-node-picker-own",children:"✓ this node"})]},m.identityId)}),y&&t.jsxs("li",{role:"presentation",className:"v10-pca-node-picker-more",children:["showing ",b.length," of ",p.length," — refine your search"]})]})]}),F&&t.jsxs("div",{className:"v10-pca-node-picker-selected","data-testid":"pca-primary-node-selected",id:J,role:"status",children:[t.jsx("span",{children:"Selected primary node"}),t.jsxs("strong",{children:["Node #",r,W?` · ${W} TRAC staked`:"",Q?" · this node":""]})]}),t.jsxs("div",{className:"v10-pca-node-picker-paste",children:[t.jsx("input",{type:"text",className:"v10-form-input","data-testid":"pca-primary-node-paste",value:H,placeholder:"…or paste a node id","aria-label":"Paste a node id",autoComplete:"off",onChange:m=>{h(m.target.value),k(null)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),E())}}),t.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-primary-node-paste-use",onClick:E,children:"Use"}),l&&t.jsx("p",{className:"v10-pca-crux-error",role:"alert","data-testid":"pca-primary-node-paste-error",children:l})]}),re?t.jsx("p",{className:"v10-pca-create-hint","data-testid":"pca-primary-node-donation",children:"You get the discount; the reward weight from this account accrues to the node you pick — not to you."}):ne&&t.jsxs("p",{className:"v10-pca-create-warn",role:"status","data-testid":"pca-primary-node-heads-up",children:["Reward weight will go to node #",r," instead of this node."]})]})]})}function Gt(e){return t.jsx($t,{...e,description:t.jsx(t.Fragment,{children:"Hardware wallet recommended. If your provider uses a device, verify the amount and contract on the device. Hot publishing wallets can publish without prompts; their spend is bounded by the per-epoch allowance, not the committed TRAC."})})}function zt(e){return e==="confirmed"?"OK":e==="submitted"?"TX":e==="failed"?"ERR":e==="aborted"?"STOP":e==="active"?"...":"-"}function ut({steps:e,currentLabel:a,blockExplorerUrl:n}){const s=e.some(r=>r.state==="failed"||r.state==="aborted");return t.jsxs("div",{className:"v10-pca-device-progress",role:s?"alert":"status","aria-live":s?"assertive":"polite",children:[t.jsx("p",{className:"v10-pca-device-progress-title",children:a??"Confirm on your device"}),t.jsx("p",{className:"v10-pca-device-progress-note",children:"Verify the amount and contract address on the device before approving."}),t.jsx("ol",{className:"v10-pca-device-progress-list",children:e.map(r=>{const o=r.txHash&&n?`${n.replace(/\/$/,"")}/tx/${r.txHash}`:null;return t.jsxs("li",{className:"v10-pca-device-progress-row","data-state":r.state,children:[t.jsx("span",{className:"v10-pca-device-progress-glyph",children:zt(r.state)}),t.jsx("span",{children:r.label}),r.txHash&&(o?t.jsx("a",{href:o,target:"_blank",rel:"noreferrer",className:"v10-pca-device-progress-tx",children:"tx"}):t.jsx("code",{className:"v10-pca-device-progress-tx",children:r.txHash})),r.error&&t.jsx("span",{className:"v10-pca-device-progress-error",children:r.error})]},r.id)})})]})}class Xt extends Ht{constructor({value:a}){super(`Number \`${a}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function Yt(e,a){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new Xt({value:e});let[n,s="0"]=e.split(".");const r=n.startsWith("-");if(r&&(n=n.slice(1)),s=s.replace(/(0+)$/,""),s.length>a){const[o,i,c]=[s.slice(0,a-1),s.slice(a-1,a),s.slice(a)],f=Math.round(+`${i}.${c}`);f>9?s=`${BigInt(o)+BigInt(1)}0`.padStart(o.length+1,"0"):s=`${o}${f}`,s.length>a&&(s=s.slice(1),n=`${BigInt(n)+1n}`),s=s.slice(0,a)}else s=s.padEnd(a,"0");return BigInt(`${r?"-":""}${n}${s}`)}const Qt=[{type:"function",name:"createAccount",stateMutability:"nonpayable",inputs:[{name:"committedTRAC",type:"uint96"},{name:"primaryNode",type:"uint72"}],outputs:[{name:"accountId",type:"uint256"}]},{type:"function",name:"topUp",stateMutability:"nonpayable",inputs:[{name:"accountId",type:"uint256"},{name:"amount",type:"uint96"}],outputs:[]},{type:"function",name:"registerAgent",stateMutability:"nonpayable",inputs:[{name:"accountId",type:"uint256"},{name:"agent",type:"address"}],outputs:[]},{type:"function",name:"deregisterAgent",stateMutability:"nonpayable",inputs:[{name:"accountId",type:"uint256"},{name:"agent",type:"address"}],outputs:[]},{type:"function",name:"settle",stateMutability:"nonpayable",inputs:[{name:"accountId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"owner",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenOfOwnerByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"getDiscountBps",stateMutability:"view",inputs:[{name:"committedTRAC",type:"uint96"}],outputs:[{type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0},{name:"to",type:"address",indexed:!0},{name:"tokenId",type:"uint256",indexed:!0}]}],Jt="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",Zt="0x0000000000000000000000000000000000000000000000000000000000000000";function ea(e){return`0x${e.slice(-40)}`.toLowerCase()}function ta(e,a,n){var o,i;const s=a.toLowerCase(),r=n==null?void 0:n.toLowerCase();for(const c of e.logs){if(c.address.toLowerCase()!==s)continue;const f=c.topics;if(((o=f[0])==null?void 0:o.toLowerCase())===Jt&&f.length===4&&((i=f[1])==null?void 0:i.toLowerCase())===Zt&&!(r&&ea(f[2])!==r))return BigInt(f[3])}throw new Error("No PCA mint Transfer found in the create receipt")}function aa(e,a){return e?"ready":a?"unreadable":"loading"}function na(e,a){return e==="daemon"||e==="wallet"&&!a}function ra(e,a,n){return e.mode==="wallet"&&e.writesEnabled?!0:e.mode==="unknown"?!!n&&(!a||fe(a,n)):!1}function qe(e){const{owner:a,primaryWallet:n,connectedWallet:s,walletWrongNetwork:r=!1,primaryWalletState:o="ready"}=e;if(o==="loading")return{mode:"unknown",wrongNetwork:r,writesEnabled:!1,ownerUnknownCause:"wallets-loading"};if(o==="unreadable")return{mode:"unknown",wrongNetwork:r,writesEnabled:!1,ownerUnknownCause:"wallets-unreadable"};if(!a)return{mode:"unknown",wrongNetwork:r,writesEnabled:!1,ownerUnknownCause:"no-snapshot"};let i;fe(a,n)?i="daemon":s&&fe(a,s)&&!fe(a,n)?i="wallet":i="external";const c=r,f=na(i,c);return{mode:i,wrongNetwork:c,writesEnabled:f}}const sa=(1n<<72n)-1n,oa=(1n<<96n)-1n;class V extends Error{constructor(a){super(a),this.name="WalletOwnerActionSubmitterError"}}class Ge extends V{constructor(a){super(a),this.name="WalletOwnerActionUnavailableError"}}class ze extends V{constructor(a){super(a),this.name="WalletOwnerActionAbortError"}}function je(e,a){return Bt(e,a,n=>new V(n))}function $e(e){const a=e.trim();if(!/^\d+$/.test(a))throw new V("accountId must be a non-negative integer string.");return BigInt(a)}function tt(e,a){const n=e.trim();if(!/^\d+(\.\d+)?$/.test(n))throw new V(`${a} must be a positive decimal number of TRAC tokens.`);let s;try{s=Yt(n,18)}catch(r){const o=r instanceof Error&&r.message?r.message:String(r);throw new V(`${a} parse error: ${o}`)}if(s<=0n)throw new V(`${a} must be > 0.`);if(s>oa)throw new V(`${a} exceeds the uint96 TRAC amount range.`);return s}function ia(e){if(typeof e!="string"&&typeof e!="number")throw new V("primaryNode must be a positive integer node identityId.");const a=String(e).trim();if(!/^\d+$/.test(a))throw new V("primaryNode must be a positive integer node identityId.");const n=BigInt(a);if(n<=0n)throw new V("primaryNode must be > 0 before signing; choose a staked node for this PCA.");if(n>sa)throw new V("primaryNode exceeds the uint72 node identityId range.");return n}function at(e){const a=Lt(e,18);return a.includes(".")?a:`${a}.0`}function ye(e){return e.blockNumber==null?void 0:Number(e.blockNumber)}const Te={error:e=>new V(e),unavailableError:e=>new Ge(e),abortedError:e=>new ze(e),messages:{disconnected:"Connect the PCA owner wallet before signing.",wrongNetwork:"Switch the connected wallet to this node's PCA network.",providerChanged:"Wallet provider changed before the signature prompt. Reconnect and retry.",addressChanged:"Connected wallet changed before the signature prompt. Reconnect the owner wallet.",networkChanged:"Wallet network changed before the signature prompt. Switch back and retry.",accountChanged:"Wallet account changed before the signature prompt. Reconnect the owner wallet."}};function xe(e){const a=e.getWalletState??(()=>{const{provider:o,address:i,chainId:c}=K.getState();return{provider:o,address:i,chainId:c}}),n=e.bootstrap??K.getState().bootstrap;if(!n)throw Te.unavailableError("PCA contract addresses are not bootstrapped yet.");const s={bootstrap:n,getWalletState:a,...e.publicClientFor?{publicClientFor:e.publicClientFor}:{},...e.walletClientFromProvider?{walletClientFromProvider:e.walletClientFromProvider}:{}},r=Dt(s,Te);return{...r,runtimeDeps:s,owner:r.account,nft:je(r.bootstrap.nft,"PCA NFT contract"),token:je(r.bootstrap.token,"TRAC token contract")}}async function nt(e){return await e.publicClient.readContract({address:e.token,abi:lt,functionName:"allowance",args:[e.owner,e.nft]})}async function rt(e,a,n){var s;if(await nt(e)>=n){(s=a.onProgress)==null||s.call(a,{step:"approve",state:"skipped"});return}if(await ct(e,e.runtimeDeps,Te,r=>r.writeContract({account:e.account,chain:e.chain,address:e.token,abi:lt,functionName:"approve",args:[e.nft,n]}),"approve",{signing:()=>{var r;return(r=a.onProgress)==null?void 0:r.call(a,{step:"approve",state:"active"})},submitted:r=>{var o;return(o=a.onProgress)==null?void 0:o.call(a,{step:"approve",state:"submitted",txHash:r})},confirmed:r=>{var o;return(o=a.onProgress)==null?void 0:o.call(a,{step:"approve",state:"confirmed",txHash:r})},failed:(r,o)=>{var i;return(i=a.onProgress)==null?void 0:i.call(a,{step:"approve",state:"failed",txHash:o,error:r})}}),await nt(e)<n)throw new V("TRAC approval confirmed but allowance is still too low.")}async function Ae(e,a,n){return ct(e,e.runtimeDeps,Te,s=>s.writeContract({account:e.account,chain:e.chain,address:e.nft,abi:Qt,...n}),"action",{signing:()=>{var s;return(s=a.onProgress)==null?void 0:s.call(a,{step:"action",state:"active"})},submitted:s=>{var r;return(r=a.onProgress)==null?void 0:r.call(a,{step:"action",state:"submitted",txHash:s})},confirmed:s=>{var r;return(r=a.onProgress)==null?void 0:r.call(a,{step:"action",state:"confirmed",txHash:s})},failed:(s,r)=>{var o;return(o=a.onProgress)==null?void 0:o.call(a,{step:"action",state:"failed",txHash:r,error:s})}})}function pt(e={}){return{async create(a){const n=ia(a.primaryNode),s=tt(a.tokens,"tokens"),r=xe(e);await rt(r,e,s);const{hash:o,receipt:i}=await Ae(r,e,{functionName:"createAccount",args:[s,n]});let c;try{c=ta(i,r.nft,r.owner).toString()}catch(f){throw new ce(i.transactionHash??o,f,"action")}return{accountId:c,txHash:i.transactionHash??o,blockNumber:ye(i),committedTokens:at(s)}},async registerAgent(a,n){const s=$e(a),r=je(n,"Publishing wallet"),o=xe(e),{hash:i,receipt:c}=await Ae(o,e,{functionName:"registerAgent",args:[s,r]});return{accountId:a,agent:r,registered:!0,adapterSupported:!0,txHash:c.transactionHash??i,blockNumber:ye(c)}},async deregisterAgent(a,n){const s=$e(a),r=je(n,"Publishing wallet"),o=xe(e),{hash:i,receipt:c}=await Ae(o,e,{functionName:"deregisterAgent",args:[s,r]});return{accountId:a,agent:r,deregistered:!0,txHash:c.transactionHash??i,blockNumber:ye(c)}},async topUp(a,n){const s=$e(a),r=tt(n,"tokens"),o=xe(e);await rt(o,e,r);const{hash:i,receipt:c}=await Ae(o,e,{functionName:"topUp",args:[s,r]});return{accountId:a,addedTokens:at(r),txHash:c.transactionHash??i,blockNumber:ye(c)}},settle:st}}const le={create:jt,registerAgent:kt,deregisterAgent:Nt,topUp:Ct,settle:st};class ca extends Error{constructor(a="Connect the PCA owner wallet to manage this account."){super(a),this.name="ReadOnlyOwnerActionError"}}class ht extends Error{constructor(a,n){super(a),this.name="OwnerActionUnavailableError",this.cause=n==null?void 0:n.cause}}async function Ce(){throw new ca}function He(e,a){async function n(){throw new ht(e,{cause:a})}return{create:n,registerAgent:n,deregisterAgent:n,topUp:n,settle:le.settle}}const la={create:Ce,registerAgent:Ce,deregisterAgent:Ce,topUp:Ce,settle:le.settle};function mt(){const e=K.getState();return!e.provider||!e.address?"Connect the PCA owner wallet before signing.":!e.bootstrap||e.expectedChainId==null?"PCA contract addresses are not bootstrapped yet.":e.chainId!==e.expectedChainId?"Switch the connected wallet to this node's PCA network.":null}function Pe(e){return e==="daemon"?"daemon":e==="wallet"?"wallet":"read-only"}function da({owner:e,primaryWallet:a,connectedWallet:n}){return Pe(qe({owner:e,primaryWallet:a,connectedWallet:n}).mode)}async function ua(e){const{accountId:a,primaryWallet:n,connectedWallet:s,walletWrongNetwork:r}=e;if(!a)return;const o=await oe(a).catch(()=>null);if(!(o!=null&&o.owner))return;const i=qe({owner:o.owner,primaryWallet:n??null,connectedWallet:s,walletWrongNetwork:r}),c=Pe(i.mode);if(c==="daemon")return"daemon";if(c==="wallet"&&i.writesEnabled)return"wallet"}function ft(e,a={}){return e==="daemon"?le:e==="read-only"?la:pt(a)}async function De(e,a={}){let n;try{n=await oe(e)}catch(i){return He("Could not verify the PCA owner before signing.",i)}let s;try{s=(await Fe()).wallets??[]}catch(i){return He("Could not verify this node's primary wallet before signing.",i)}const r=K.getState().address,o=da({owner:n.owner,primaryWallet:s[0]??null,connectedWallet:r});if(o==="wallet"){const i=mt();if(i)return He(i)}return ft(o,a)}function gt(e){return async a=>{if(e.ownerKey!=="hardware")return le.create(a);const n=mt();if(n)throw new ht(n);return pt({onProgress:e.onWalletProgress}).create(a)}}function vt(e={}){return{create:gt(e),async registerAgent(a,n){return(await De(a,{onProgress:e.onWalletProgress})).registerAgent(a,n)},async deregisterAgent(a,n){return(await De(a,{onProgress:e.onWalletProgress})).deregisterAgent(a,n)},async topUp(a,n){return(await De(a,{onProgress:e.onWalletProgress})).topUp(a,n)},settle:le.settle}}function pa(e,a){if(e.mode==="unknown"||Pe(e.mode)==="wallet")return vt({onWalletProgress:a});const n=ft(Pe(e.mode),{onProgress:a});return{create:gt({onWalletProgress:a}),registerAgent:n.registerAgent,deregisterAgent:n.deregisterAgent,topUp:n.topUp,settle:le.settle}}function Me(e={}){return vt(e)}function ha(e){return pa(e.access,e.onWalletProgress)}function ma(e,a){return[{address:e,kind:"daemon"},{address:a,kind:"wallet"}]}function fa(e){return(Array.isArray(e)?e:e!=null?[e]:[]).flatMap(n=>typeof n=="string"?n?[{address:n,kind:"daemon"}]:[]:n.address?[{address:n.address,kind:n.kind??"daemon"}]:[])}async function wt(e,a){const n=fa(a),s=await Tt(e).catch(()=>{});if(s===void 0)return{wallet:e,boundTo:null,canOwn:!1,boundLive:!1,inconclusive:!0};const r=s.accountId;if(r==null)return{wallet:e,boundTo:null,canOwn:!1,boundLive:!1,inconclusive:!1};const o=await oe(r).catch(()=>null);if(o===null)return{wallet:e,boundTo:r,canOwn:!1,boundLive:!1,inconclusive:!0};const i=n.find(c=>fe(o.owner,c.address));return{wallet:e,boundTo:r,canOwn:!!i,signerKind:i==null?void 0:i.kind,boundLive:!Pt(o)&&St(o),inconclusive:!1}}async function ga(e,a){return Promise.all(e.map(n=>wt(n,a)))}function bt(e){return e.inconclusive||e.boundTo==null?{kind:"register"}:e.canOwn?{kind:"deregisterThenRegister",prevAccountId:e.boundTo}:e.boundLive?{kind:"skipSponsored",prevAccountId:e.boundTo}:{kind:"conflictSponsorDead",prevAccountId:e.boundTo}}function va(e){const a=e.map(w=>({binding:w,kind:bt(w).kind})),n=w=>a.filter(A=>A.kind===w).map(A=>A.binding),s=n("register"),r=s.filter(w=>w.inconclusive),o=s.filter(w=>!w.inconclusive),i=n("deregisterThenRegister"),c=n("skipSponsored"),f=n("conflictSponsorDead"),x=[...o,...i],v=e.length>0&&x.length===0&&r.length===0;return{selfCoverable:x,ownBound:i,sponsorBound:c,sponsorDead:f,inconclusive:r,zeroSelfCoverage:v}}const wa=(e,a)=>{try{const n=BigInt(e.stake),s=BigInt(a.stake);return n===s?0:n>s?-1:1}catch{return 0}};function ba(e=!0){const[a,n]=g.useState([]),[s,r]=g.useState(!0),[o,i]=g.useState(!1),c=g.useRef(!0),f=g.useRef(!1),x=g.useCallback(async w=>{r(!0),i(!1);try{const A=await Rt(w?{fresh:!0}:void 0);c.current&&n([...A.nodes].sort(wa))}catch{c.current&&(n([]),i(!0))}finally{c.current&&r(!1)}},[]);g.useEffect(()=>(c.current=!0,()=>{c.current=!1}),[]),g.useEffect(()=>{e&&!f.current&&(f.current=!0,x(!1))},[e,x]);const v=g.useCallback(()=>{x(!0)},[x]);return{nodes:a,loading:s,error:o,refresh:v}}function ya(e){const{seedPrimaryNode:a,replacingAccountId:n,identityId:s,stakedNodes:r,nodesError:o,nodesLoading:i,enabled:c=!0}=e,[f,x]=g.useState(a??""),v=s&&s!=="0"?String(s):null,w=g.useMemo(()=>v&&r.some(N=>N.identityId===v)?v:null,[v,r]);g.useEffect(()=>{!c||f||!v||i||(w?x(w):o&&x(v))},[c,f,v,w,o,i]),g.useEffect(()=>{!c||n||o||i||v&&f===v&&!w&&x("")},[c,n,o,i,r.length,v,f,w]);const A=g.useCallback(()=>x(""),[]);return{primaryNode:f,setPrimaryNode:x,ownStaked:w,onRejected:A}}const xa="Approve exact TRAC allowance",Aa="Confirm on-chain receipt";function Ca(e){const a=[];return e.requiresApproval&&a.push({id:"approve",label:e.approveLabel??xa,state:"pending"}),a.push({id:"action",label:e.actionLabel,state:"pending"}),a.push({id:"confirm",label:e.confirmLabel??Aa,state:"pending"}),a}function Na({labels:e,flow:a,describeApproveError:n,describeActionError:s}){const r=g.useRef(void 0),[o,i]=g.useState([]),[c,f]=g.useState(e.idle),x=h=>Ca(a(h)),v=n??(h=>Y(h,"approve").message),w=s??(h=>Y(h,"action").message),A=h=>typeof e.actionActive=="function"?e.actionActive(h):e.actionActive;return{steps:o,currentLabel:c,onProgress:h=>{const l=r.current;f(()=>h.step==="approve"?h.state==="skipped"||h.state==="confirmed"?e.approveReady:h.state==="failed"?e.failed:e.approveActive:h.state==="active"?A(l):h.state==="submitted"?e.submitted:h.state==="confirmed"?e.confirmed:e.failed),i(k=>{const u=(k.length?k:x(l)).map(j=>({...j})),p=u.find(j=>j.id==="approve"),b=u.find(j=>j.id==="action"),y=u.find(j=>j.id==="confirm");return h.step==="approve"?(p&&(h.state==="skipped"?(p.state="confirmed",p.label="TRAC allowance already sufficient"):h.state==="active"||h.state==="submitted"?(p.state="active",p.txHash=h.txHash):h.state==="confirmed"?(p.state="confirmed",p.txHash=h.txHash):h.state==="failed"&&(p.state="failed",p.txHash=h.txHash,p.error=v(h.error))),u):(h.state==="active"?((p==null?void 0:p.state)==="pending"&&(p.state="confirmed"),b.state="active"):h.state==="submitted"?((p==null?void 0:p.state)==="pending"&&(p.state="confirmed"),b.state="confirmed",b.txHash=h.txHash,y.state="active"):h.state==="confirmed"?((p==null?void 0:p.state)==="pending"&&(p.state="confirmed"),b.state="confirmed",b.txHash=h.txHash,y.state="confirmed",y.txHash=h.txHash):h.state==="failed"&&(b.state="failed",b.txHash=h.txHash,b.error=w(h.error,l)),u)})},begin:h=>{r.current=h;const l=x(h);i(l);const k=l.some(u=>u.id==="approve");f(k?e.approveActive:A(h))},reset:()=>{r.current=void 0,i([]),f(e.idle)},initialSteps:x}}function me({onClose:e,title:a,subtitle:n,testId:s,children:r,dismissDisabled:o=!1}){const i=g.useCallback(()=>{o||e()},[o,e]),{dialogRef:c,onBackdropClick:f}=Et(!0,i),x=g.useRef(null);return g.useEffect(()=>{queueMicrotask(()=>{var v;return(v=x.current)==null?void 0:v.focus()})},[]),t.jsx("div",{className:"v10-modal-overlay",onClick:f,role:"presentation",children:t.jsxs("div",{className:"v10-modal-box v10-pca-modal-box","data-testid":s,ref:c,role:"dialog","aria-modal":"true","aria-labelledby":"pca-modal-title",children:[t.jsx("button",{type:"button",className:"v10-modal-close",onClick:i,"aria-label":o?"Close disabled while signing":"Close dialog",title:o?"Finish or reject the wallet prompt first":"Close (Esc)",disabled:o,style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:o?"not-allowed":"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1,opacity:o?.45:1},children:"×"}),t.jsxs("div",{className:"v10-modal-header",children:[t.jsx("h2",{id:"pca-modal-title",className:"v10-modal-title",tabIndex:-1,ref:x,children:a}),n&&t.jsx("div",{className:"v10-modal-subtitle",children:n})]}),r]})})}function Ne(e){const a=e/100;return`${a%1===0?a.toFixed(0):a.toFixed(1)}%`}const ka=/^\d+(\.\d+)?$/;function _a({onClose:e,onApproveOwnWallets:a,onManage:n,onGetSponsored:s,seed:r,replacingAccountId:o,initialOwnerKey:i}){var Qe,Je,Ze;const c=Ot(d=>d.nodeStatus),f=(c==null?void 0:c.nodeRole)==="edge"||(c==null?void 0:c.hasIdentity)===!1,x=c==null,v=(c==null?void 0:c.blockExplorerUrl)??null,{data:w}=ke(Fe,[],0),A=(w==null?void 0:w.wallets)??[],N=A[0],R=(Je=(Qe=w==null?void 0:w.balances)==null?void 0:Qe.find(d=>d.address===N))==null?void 0:Je.trac,H=R!=null?Number(R):NaN,h=A.join(","),[l,k]=g.useState(i??"hardware"),u=K(d=>d.address),p=K(d=>d.provider),b=K(d=>d.bootstrap),y=K(d=>d.expectedChainId),j=K(d=>d.chainId),D=K(d=>Ue(d)),E=l==="hardware",I=Na({labels:{idle:"Confirm on your device",approveActive:"Confirm on your device (1 of 2): approve TRAC",approveReady:"Allowance ready — continue to Create PCA",actionActive:"Confirm on your device (2 of 2): Create PCA",submitted:"Waiting for on-chain confirmation",confirmed:"Create confirmed on-chain",failed:"Wallet transaction failed"},flow:()=>({requiresApproval:!0,actionLabel:"Sign Create PCA"})}),Q=Me({ownerKey:l,onWalletProgress:I.onProgress}),ne=he(d=>d.finishCreate),re=he(d=>d.setCreatePending),W=he(d=>d.clearCreatePending),F=he.getState().createPending,J=he(d=>d.createPendingPersisted),[m,L]=g.useState((r==null?void 0:r.tokens)??""),[P,B]=g.useState(F?"reconcile":"form"),[$,Se]=g.useState(null),[Z,se]=g.useState(F==null?void 0:F.txHash),[ve,U]=g.useState(null),z=P==="form"&&!x,we=g.useMemo(()=>[{address:N,kind:"daemon"},...E?[{address:u,kind:"wallet"}]:[]],[E,N,u]),{data:de}=ke(()=>z?ga(A,we):Promise.resolve([]),[h,N,u,E,z],0),q=g.useMemo(()=>va(de??[]),[de]),{nodes:ue,loading:pe,error:O,refresh:ie}=ba(z),{primaryNode:ee,setPrimaryNode:Re,ownStaked:C,onRejected:S}=ya({seedPrimaryNode:r==null?void 0:r.primaryNode,replacingAccountId:o,identityId:c==null?void 0:c.identityId,stakedNodes:ue,nodesError:O,nodesLoading:pe,enabled:z}),_=ka.test(m.trim())?Number(m.trim()):NaN,M=Number.isFinite(_)&&_>0,G=l!=="hardware"&&M&&Number.isFinite(H)&&_>H,te=M&&_<25e3,ae=g.useMemo(()=>dt(M?_:null),[_,M]),be=/^\d+$/.test(ee.trim())&&Number(ee.trim())>0,Xe=!!p&&!!u&&!!b&&y!=null&&j===y,Ye=!E||ue.some(d=>String(d.identityId)===ee.trim()),X=E?u??void 0:N,yt=M&&!G&&be&&!!X&&!x&&P==="form"&&(!E||Xe&&Ye),Ee=E&&P==="creating",Oe=u?D?"Switch the connected wallet to this node's PCA network before signing.":b?null:"PCA contract addresses are still loading for wallet signing.":"Connect the owner wallet before choosing the hardware path.",xt=async()=>{if(E){if(!Xe){U(Oe??"Connect the owner wallet before signing.");return}if(!Ye){S(),ie(),U("The selected primary node is no longer in the live staked-node list. Pick another staked node before signing.");return}}if(B("creating"),U(null),E?I.begin("create"):I.reset(),X&&!re({ownerEoa:X,submittedAt:Date.now()})){W(),U("Create is blocked because this browser cannot save the create-pending safety marker. Enable local storage or use a browser profile where site storage is available."),B("form");return}try{const d=await Q.create({tokens:m.trim(),primaryNode:ee.trim()});ne(d.accountId);const T=await oe(d.accountId).catch(()=>null);Se({...d,snapshot:T}),B("success")}catch(d){if(d instanceof Be&&(d.status===400||It(d))){W();const T=ot(d);(T==null?void 0:T.code)==="PrimaryNodeNotInShardingTable"&&(S(),ie()),U((T==null?void 0:T.message)??(d==null?void 0:d.message)??"Create failed."),B("form");return}if(d instanceof ce){if(d.txStep==="action"&&d.txHash){se(d.txHash),X&&re({ownerEoa:X,submittedAt:Date.now(),txHash:d.txHash}),B("reconcile");return}W();const T=Y(d,"approve");U(`${T.message} Retry will re-check the allowance before asking you to sign again.`),B("form");return}if(d instanceof Ke){W(),U(Y(d,"action").message),B("form");return}if(E){W();const T=Y(d,"action");T.kind==="revert"&&T.revertName==="PrimaryNodeNotInShardingTable"&&(S(),ie()),U(T.kind==="rejected"?"The TRAC allowance is set, but account not created because you rejected the Create PCA signature. Retry to finish (no new approval needed).":T.message),B("form");return}if(d instanceof Be&&d.status===504){const T=d.body??{};T.txHash&&(se(T.txHash),X&&re({ownerEoa:X,submittedAt:Date.now(),txHash:T.txHash}))}B("reconcile")}};if(P==="reconcile"){const d=v&&Z?`${v}/tx/${Z}`:void 0,T=(F==null?void 0:F.ownerEoa)??X??N;return t.jsxs(me,{onClose:e,testId:"pca-create-modal",title:"Confirm before retrying",children:[t.jsxs("div",{className:"v10-modal-body",children:[t.jsxs("div",{className:"v10-modal-warning",role:"alert",children:["⚠ Your create transaction was submitted but we lost confirmation. We’re checking the chain before letting you retry — creating again could lock a ",t.jsx("strong",{children:"second"})," commitment of TRAC."]}),t.jsxs("div",{className:"v10-pca-create-recon",children:[Z&&t.jsxs("p",{children:["Broadcast tx"," ",d?t.jsxs("a",{href:d,target:"_blank",rel:"noreferrer",children:[Z," ↗"]}):t.jsx("code",{children:Z})]}),J?t.jsxs("p",{children:["A “create-pending” marker is saved, so this guard survives a refresh. Verify on the explorer whether a PCA was minted to ",t.jsx("code",{children:T??"your owner wallet"}),":"]}):t.jsxs("p",{className:"v10-pca-create-warn",role:"alert",children:["⚠ This browser blocked saving the safety marker (storage disabled or full), so this guard will ",t.jsx("strong",{children:"NOT"})," survive a refresh. Do not create again until you’ve verified on the explorer whether a PCA was minted to"," ",t.jsx("code",{children:T??"your owner wallet"}),":"]}),t.jsxs("ul",{className:"v10-pca-create-recon-actions",children:[t.jsxs("li",{children:["If a PCA ",t.jsx("strong",{children:"was"})," minted → close this, then use “Track PCA by ID” on the overview."]}),t.jsxs("li",{children:["If ",t.jsx("strong",{children:"none"})," was minted → clear the marker below, then you can create again."]})]})]})]}),t.jsxs("div",{className:"v10-modal-footer",children:[d&&t.jsx("a",{className:"v10-modal-btn",href:d,target:"_blank",rel:"noreferrer",children:"Recheck on explorer ↗"}),t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:()=>{W(),se(void 0),B("form")},children:"No PCA minted — clear & retry"}),t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:e,children:"Close"})]})]})}if(x)return t.jsxs(me,{onClose:e,testId:"pca-create-modal",title:"Checking node eligibility…",children:[t.jsx("div",{className:"v10-modal-body",children:t.jsx("p",{className:"v10-pca-create-hint",role:"status",children:"Confirming this node can create a Publisher Conviction Account…"})}),t.jsx("div",{className:"v10-modal-footer",children:t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:e,children:"Close"})})]});if(P==="success"&&$){const d=(Ze=$.snapshot)==null?void 0:Ze.discountBps,T=ae.bps,At=typeof d=="number"&&d!==T,et=v&&$.txHash?`${v}/tx/${$.txHash}`:void 0;return t.jsxs(me,{onClose:e,testId:"pca-create-modal",title:`PCA #${$.accountId} created`,children:[t.jsx("div",{className:"v10-modal-body",children:t.jsxs("div",{className:"v10-pca-create-success","data-testid":"pca-create-success",children:[t.jsxs("div",{className:"v10-pca-create-success-stats",children:[t.jsxs("span",{children:["Account ",t.jsxs("strong",{children:["#",$.accountId]})]}),typeof d=="number"&&t.jsxs("span",{children:["Discount tier ",t.jsx("strong",{children:Ne(d)})]}),t.jsxs("span",{children:["Committed ",t.jsxs("strong",{children:[We($.committedTokens)," TRAC"]})]})]}),At&&t.jsxs("p",{className:"v10-pca-create-warn",children:["Heads up: the created account returned a ",Ne(d)," discount tier instead of the previewed ",Ne(T)," tier."]}),$.txHash&&t.jsxs("p",{className:"v10-pca-create-tx",children:["Tx"," ",et?t.jsxs("a",{href:et,target:"_blank",rel:"noreferrer",children:[$.txHash," ↗"]}):t.jsx("code",{children:$.txHash})]}),t.jsx("div",{className:"v10-pca-create-warn",role:"alert",children:"⚠ 0/100 wallets approved — this PCA discounts nothing yet. It covers nothing until you approve this node’s operational (signing) wallets."})]})}),t.jsxs("div",{className:"v10-modal-footer",children:[t.jsx("button",{type:"button",className:"v10-modal-btn primary","data-testid":"pca-approve-own-wallets",onClick:()=>a($.accountId),children:o?`Re-approve PCA #${o}’s wallets`:"Approve this node’s operational wallets"}),t.jsxs("button",{type:"button",className:"v10-modal-btn",onClick:()=>n($.accountId),children:["Manage PCA #",$.accountId]})]})]})}return t.jsxs(me,{onClose:e,testId:"pca-create-modal",title:o?`Renew — new PCA to replace #${o}`:"Create a Publisher Conviction Account",subtitle:o?"Re-mint a fresh account seeded from the expiring one.":"Lock TRAC up front to publish at a discount.",dismissDisabled:Ee,children:[t.jsxs("div",{className:"v10-modal-body",children:[ve&&t.jsx("div",{className:"v10-modal-error",role:"alert",children:ve}),E&&P==="creating"&&t.jsx("div",{className:"v10-modal-warning",role:"status","data-testid":"pca-create-hw-lock",children:"Finish or reject the prompt in your wallet. Closing, backdrop click, and Esc are disabled while the approve-to-create sequence is in flight."}),E&&P==="creating"&&t.jsx(ut,{steps:I.steps.length?I.steps:I.initialSteps(),currentLabel:I.currentLabel,blockExplorerUrl:v}),t.jsxs("section",{className:"v10-pca-create-section","data-testid":"pca-create-owner-key",children:[t.jsx("h3",{className:"v10-pca-create-section-title",children:"1 · Owner key"}),t.jsxs("div",{className:"v10-pca-owner-key-grid",role:"radiogroup","aria-label":"PCA owner key",children:[t.jsxs("label",{className:`v10-pca-owner-key-card${l==="hardware"?" selected":""}`,children:[t.jsx("input",{type:"radio",name:"pca-owner-key",value:"hardware",checked:l==="hardware",onChange:()=>k("hardware"),disabled:P==="creating"}),t.jsxs("span",{children:[t.jsx("strong",{children:"Hardware wallet (recommended)"}),t.jsx("small",{children:"If your browser wallet is backed by a device, verify the amount and contract there. The app cannot verify hardware backing from provider metadata."})]})]}),t.jsxs("label",{className:`v10-pca-owner-key-card${l==="hot"?" selected":""}`,children:[t.jsx("input",{type:"radio",name:"pca-owner-key",value:"hot",checked:l==="hot",onChange:()=>k("hot"),disabled:P==="creating"}),t.jsxs("span",{children:[t.jsx("strong",{children:"This node's hot wallet"}),t.jsx("small",{children:"No connected browser wallet is required. The daemon signs with this node's primary operational wallet."})]})]})]}),E?t.jsxs("div",{className:"v10-pca-owner-key-readiness",children:[t.jsx(Gt,{testId:"pca-wallet-connect"}),Oe&&t.jsx("p",{className:"v10-pca-create-warn",role:"status","data-testid":"pca-create-hw-readiness",children:Oe})]}):N?t.jsxs("div",{className:"v10-pca-create-owner",children:[t.jsx("span",{className:"v10-pca-card-owner-lbl",children:"Hot owner"}),t.jsx(ge,{address:N})]}):null]}),f&&!o&&t.jsx("div",{className:"v10-modal-tip",role:"status","data-testid":"pca-create-no-identity-note",children:"This node has no staked identity of its own — you can still create a PCA by choosing a staked node as its primary node below (you get the discount; the reward weight accrues to the node you pick)."}),q.zeroSelfCoverage&&t.jsxs("div",{className:"v10-modal-warning",role:"alert","data-testid":"pca-b1-zero-coverage",children:["⚠ All of this node’s operational wallets are already approved on other PCAs",q.sponsorBound.length>0?" (you already get the discount free where those are live)":"",". This new account will ",t.jsx("strong",{children:"NOT"})," discount your own publishes. Create it only if you intend to approve publishing wallets for other nodes; otherwise getting added to an existing PCA avoids locking TRAC."]}),q.sponsorDead.length>0&&t.jsxs("div",{className:"v10-modal-warning",role:"alert","data-testid":"pca-b1-sponsor-dead",children:["Warning: ",q.sponsorDead.length," of this node's wallet(s) are approved on another PCA that is",t.jsx("strong",{children:" expired or swept"})," - they are ",t.jsx("strong",{children:"not covered"}),", and this node cannot free them (it does not own that account). Ask that PCA owner to remove you, then re-approve them here; otherwise they stay uncovered."]}),!q.zeroSelfCoverage&&q.sponsorBound.length>0&&t.jsxs("div",{className:"v10-modal-tip",role:"status","data-testid":"pca-b1-preview",children:["After creating, ",q.sponsorBound.length," of your wallet(s) stay on another PCA (already discounted) and will not be moved; the rest are approved on the new account (any already on a PCA you own are deregistered from it first)."]}),!q.zeroSelfCoverage&&q.ownBound.length>0&&t.jsxs("div",{className:"v10-modal-warning",role:"status","data-testid":"pca-b1-own-bound",children:["⚠ ",q.ownBound.length," of this node’s wallet(s) are already approved on a PCA you own. Self-coverage will ",t.jsx("strong",{children:"move"})," them — deregister from that account, then approve on the new one. The old account’s committed TRAC stays locked until its own expiry and would then cover nothing, so only proceed if you’re replacing it."]}),o&&t.jsxs("div",{className:"v10-modal-warning",role:"status","data-testid":"pca-renew-note",children:["ⓘ This creates a ",t.jsx("strong",{children:"new, separate"})," account (a new id) — it does not extend or reclaim PCA #",o,". The old account’s committed TRAC stays locked until its own expiry (it can’t be withdrawn early), and the new account starts at ",t.jsx("strong",{children:"0/100"}),"approved wallets. The next step is pre-filled with the old account’s wallets for one-step re-approval."]}),t.jsxs("section",{className:"v10-pca-create-section",children:[t.jsx("h3",{className:"v10-pca-create-section-title",children:"2 · Commitment"}),t.jsxs("div",{className:"v10-form-group",children:[t.jsx("label",{className:"v10-form-label",htmlFor:"pca-create-tokens",children:"Commit amount (TRAC)"}),t.jsx("input",{id:"pca-create-tokens","data-testid":"pca-create-tokens",className:"v10-form-input",type:"text",inputMode:"decimal",value:m,onChange:d=>L(d.target.value),placeholder:"100000",autoComplete:"off"})]}),l!=="hardware"&&R!=null&&t.jsxs("p",{className:"v10-pca-create-balance",children:["Owner wallet balance: ",We(R)," TRAC",G&&t.jsx("span",{className:"v10-pca-create-err",children:" — exceeds balance"})]}),te&&t.jsx("div",{className:"v10-modal-warning",children:"⚠ Under 25,000 TRAC earns a 0% discount — you’d lock TRAC for no benefit."}),t.jsx(Ut,{committedTrac:M?_:null})]}),t.jsxs("section",{className:"v10-pca-create-section","data-testid":"pca-create-primary-node",children:[t.jsx("h3",{className:"v10-pca-create-section-title",children:"3 · Primary node"}),o&&(r==null?void 0:r.primaryNodeUnknown)&&t.jsxs("p",{className:"v10-pca-create-hint",role:"status","data-testid":"pca-renew-primary-unknown",children:["ⓘ Couldn’t read PCA #",o,"’s primary node — defaulting to this node. Pick a different staked node below if the replacement should point elsewhere."]}),t.jsx(qt,{nodes:ue,loading:pe,error:O,onRetry:ie,value:ee,onChange:Re,ownIdentityId:C,role:(c==null?void 0:c.nodeRole)==="edge"?"edge":(c==null?void 0:c.nodeRole)==="core"?"core":void 0,required:!0})]}),t.jsxs("section",{className:"v10-pca-create-section",children:[t.jsx("h3",{className:"v10-pca-create-section-title",children:"4 · Review"}),t.jsxs("div",{className:"v10-pca-create-review",children:[t.jsxs("div",{children:[t.jsx("span",{children:"Commit"}),t.jsx("strong",{children:M?`${We(m)} TRAC`:"—"})]}),t.jsxs("div",{children:[t.jsx("span",{children:"Discount tier"}),t.jsx("strong",{children:Ne(ae.bps)})]}),t.jsxs("div",{children:[t.jsx("span",{children:"Primary node"}),t.jsx("strong",{children:be?`#${ee.trim()}`:"—"})]})]}),X&&t.jsxs("div",{className:"v10-pca-create-owner",children:[t.jsx("span",{className:"v10-pca-card-owner-lbl",children:"Owner"}),t.jsx(ge,{address:X,status:E?"connected wallet":"hot wallet"})]}),t.jsxs("p",{className:"v10-pca-create-owner-note",children:["Owner = the wallet that signs the create. ",t.jsx("strong",{children:"Being the owner does not discount your own publishes"})," — you approve your publishing wallets in the next step."]}),t.jsx("div",{className:"v10-modal-tip",children:"Committed TRAC is locked for the lock period (a global protocol parameter — there’s no lock-length input). The owner wallet still needs native gas to create the account."})]})]}),t.jsxs("div",{className:"v10-modal-footer",children:[t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:()=>{Ee||e()},disabled:Ee,children:"Cancel"}),t.jsx("button",{type:"button",className:"v10-modal-btn primary","data-testid":"pca-create-submit",onClick:xt,disabled:!yt,children:P==="creating"?t.jsx("span",{role:"status",children:"Creating…"}):"Create PCA"})]})]})}function ja(e){const a=K(s=>s.address),n=K(s=>Ue(s));return qe({owner:e.owner,primaryWallet:e.primaryWallet,connectedWallet:a,walletWrongNetwork:n,primaryWalletState:e.primaryWalletState})}const Ta={pending:"approving…",approved:"approved on-chain",submitted:"submitted — verify",skipped:"already approved here (skipped)",sponsored:"left on another PCA (already discounted)",stranded:"removed from the old PCA, not yet on the new one — retry to finish",conflict:"on another PCA",cap:"cap reached",error:"failed",aborted:"aborted",unverified:"already approved somewhere — couldn’t verify; retry"},Pa={pending:"neutral",approved:"success",submitted:"neutral",skipped:"neutral",sponsored:"neutral",stranded:"warn",conflict:"danger",cap:"warn",error:"danger",aborted:"neutral",unverified:"neutral"};function Sa(e){if(e instanceof ze||e instanceof Ge)return e.message;if(e instanceof ce)return`${Y(e,e.txStep??"action").message} Stop here and verify before continuing.`;if(e instanceof Ke)return Y(e,"action").message;const a=Y(e,e instanceof Ve?e.txStep:"action");return a.kind==="rejected"||a.kind==="insufficient_funds"||a.kind==="rpc_timeout"||a.kind==="unknown"?a.message:null}function Le(e){return e instanceof ze||e instanceof Ge||e instanceof ce||e instanceof Ke||e instanceof Ve?Sa(e):null}function Ra(e,a){const n=Y(e,e instanceof Ve?e.txStep:"action");if(n.kind!=="revert")return null;switch(n.revertName){case"AgentAlreadyRegistered":return{code:"AgentAlreadyRegistered",status:400,message:"This operational wallet is already approved on another PCA - deregister it there first."};case"AgentCapReached":return{code:"AgentCapReached",status:400,message:`PCA #${a} already has the maximum 100 approved publishing wallets.`};case"NotAccountOwner":return{code:"NotAccountOwner",status:403,message:`This wallet is not the owner of PCA #${a}, so it cannot manage it.`};default:return null}}const Ea={order:[],rows:{},running:!1,done:!1,aborted:null,verificationDelayed:null,deviceSteps:[],deviceLabel:void 0,walletBatchSigning:!1};function Oa(e,a){var n;switch(a.type){case"BATCH_START":return{...e,order:a.order,rows:Object.fromEntries(a.order.map(s=>[s,{address:s,status:"pending"}])),running:!0,done:!1,aborted:null,verificationDelayed:null,deviceSteps:[],deviceLabel:void 0,walletBatchSigning:!1};case"SET_WALLET_BATCH_SIGNING":return{...e,walletBatchSigning:a.signing};case"ROW_SET":return{...e,rows:{...e.rows,[a.address]:a.row}};case"MARK_REMAINING":{const s={...e.rows,[a.current.address]:a.current};for(const r of e.order)((n=s[r])==null?void 0:n.status)==="pending"&&(s[r]={address:r,status:a.status,message:a.message});return{...e,rows:s}}case"SET_ABORTED":return{...e,aborted:a.message};case"SET_VERIFICATION_DELAYED":return{...e,verificationDelayed:a.message};case"DEVICE_PROMPT_START":return{...e,deviceLabel:a.indexLabel,deviceSteps:[...e.deviceSteps,{id:a.id,label:a.label,state:"active"}]};case"DEVICE_PROMPT_CONFIRMED":return{...e,deviceSteps:e.deviceSteps.map(s=>s.id===a.id?{...s,state:"confirmed",txHash:a.txHash}:s)};case"DEVICE_PROMPT_SUBMITTED":return{...e,deviceSteps:e.deviceSteps.map(s=>s.id===a.id?{...s,state:"submitted",txHash:a.txHash,error:"confirmation delayed - recheck on-chain"}:s)};case"DEVICE_PROMPT_FAILED":return{...e,deviceSteps:e.deviceSteps.map(s=>s.id===a.id?{...s,state:"failed",error:a.error}:s)};case"BATCH_DONE":return{...e,running:!1,walletBatchSigning:!1,done:!0};default:return e}}function Ia(e){const a=e.order.map(n=>e.rows[n]).filter(Boolean);return{confirmed:a.filter(n=>n.status==="approved").length,submitted:a.filter(n=>n.status==="submitted").length,skipped:a.filter(n=>n.status==="skipped").length,sponsored:a.filter(n=>n.status==="sponsored").length,stranded:a.filter(n=>n.status==="stranded").length,conflict:a.filter(n=>n.status==="conflict").length,error:a.filter(n=>n.status==="error"||n.status==="cap").length,aborted:a.filter(n=>n.status==="aborted").length,unverified:a.filter(n=>n.status==="unverified").length}}function Wa(e){return e.order.filter(a=>{var s;const n=(s=e.rows[a])==null?void 0:s.status;return n==="approved"||n==="submitted"})}async function $a(e,a,n,s){var h;const{addresses:r,accountId:o,mode:i,selfCoverage:c,deregisterFrom:f,targetWalletManaged:x,signableOwners:v}=e;n({type:"BATCH_START",order:r});const w=new Map;if(c&&i==="self")for(const l of r){const k=await a.resolveWalletBinding(l,v);w.set(l,{action:a.planSelfCoverage(k),signerKind:k.signerKind})}const A=await a.signerKindForAccount(f),N=r.reduce((l,k)=>{if(f)return l+(A==="wallet"?1:0)+(x?1:0);if(c&&i==="self"){const u=w.get(k);if((u==null?void 0:u.action.kind)==="skipSponsored"||(u==null?void 0:u.action.kind)==="conflictSponsorDead")return l;const p=(u==null?void 0:u.action.kind)==="deregisterThenRegister"&&u.signerKind==="wallet"?1:0;return l+p+(x?1:0)}return l+(x?1:0)},0);n({type:"SET_WALLET_BATCH_SIGNING",signing:N>0});let R=0;const H=async(l,k,u=!1)=>{if(!u)return k();const p=R+1;R=p;const b=Math.max(N,p),y=`${p}-${l}`;n({type:"DEVICE_PROMPT_START",id:y,label:l,indexLabel:`Confirm on your device (${p} of ${b})`});try{const j=await k();return n({type:"DEVICE_PROMPT_CONFIRMED",id:y,txHash:j.txHash}),j}catch(j){throw j instanceof ce&&j.txHash?n({type:"DEVICE_PROMPT_SUBMITTED",id:y,txHash:j.txHash}):n({type:"DEVICE_PROMPT_FAILED",id:y,error:(j==null?void 0:j.message)??"Action failed."}),j}};for(const l of r){if(s()){n({type:"ROW_SET",address:l,row:{address:l,status:"error",message:"stopped"}});continue}let k=null;try{if(f)try{await H(`Deregister ${l} from PCA #${f}`,()=>a.deregisterRenew(f,l),A==="wallet"),k=f}catch(p){if(A==="wallet"&&Le(p))throw p}else if(c&&i==="self"){let p=w.get(l);if(!p){const y=await a.resolveWalletBinding(l,v);p={action:a.planSelfCoverage(y),signerKind:y.signerKind}}const b=p.action;if(b.kind==="skipSponsored"){n({type:"ROW_SET",address:l,row:{address:l,status:"sponsored",message:`Stays on PCA #${b.prevAccountId} - already discounted.`}});continue}if(b.kind==="conflictSponsorDead"){n({type:"ROW_SET",address:l,row:{address:l,status:"conflict",message:`Approved on PCA #${b.prevAccountId}, but it’s expired/swept (not covering) — ask its owner to deregister you; this node can’t free it.`}});continue}if(b.kind==="deregisterThenRegister")try{await H(`Deregister ${l} from PCA #${b.prevAccountId}`,()=>a.deregisterSelf(b.prevAccountId,l),p.signerKind==="wallet"),k=b.prevAccountId}catch(y){if(p.signerKind==="wallet"&&Le(y))throw y}}const u=await H(`Approve ${l} on PCA #${o}`,()=>a.registerAgent(o,l),x);n({type:"ROW_SET",address:l,row:{address:l,status:u.registered?"approved":"submitted",txHash:u.txHash}})}catch(u){const p=()=>({address:l,status:"stranded",message:`Removed from PCA #${k}, not yet on #${o} — retry to finish.`}),b=Le(u);if(u instanceof ce&&u.txHash&&(u.txStep??"action")==="action"){n({type:"SET_VERIFICATION_DELAYED",message:`Transaction ${u.txHash} was broadcast, but receipt verification failed. Recheck on-chain before retrying.`}),n({type:"MARK_REMAINING",current:{address:l,status:"submitted",txHash:u.txHash,message:"Broadcast; verify on-chain before retrying."},status:"aborted",message:"not run - verify the previous transaction first"});break}if(b){n({type:"SET_ABORTED",message:b}),n({type:"MARK_REMAINING",current:k?p():{address:l,status:"error",message:b},status:"aborted",message:"aborted"});break}if(u instanceof Be&&u.status===403){n({type:"SET_ABORTED",message:`This node isn’t the owner of PCA #${o} — approval aborted.`}),n({type:"MARK_REMAINING",current:k?p():{address:l,status:"error",message:"owner-only"},status:"error",message:"aborted"});break}const y=a.describePcaError(u,{accountId:o})??Ra(u,o);if((y==null?void 0:y.code)==="AgentCapReached"){n({type:"MARK_REMAINING",current:{address:l,status:"cap",message:y.message},status:"cap"});break}if((y==null?void 0:y.code)==="AgentAlreadyRegistered"){const j=await a.probePca(o,l).catch(()=>null),D=j==null?void 0:j.probedKey;(D==null?void 0:D.registered)===!0?n({type:"ROW_SET",address:l,row:{address:l,status:"skipped",message:"Already an approved publishing wallet here."}}):(D==null?void 0:D.registered)===!1&&D.adapterSupported!==!1?n({type:"ROW_SET",address:l,row:{address:l,status:"conflict",message:y.message}}):n({type:"ROW_SET",address:l,row:{address:l,status:"unverified"}})}else n({type:"ROW_SET",address:l,row:k?p():{address:l,status:"error",message:(y==null?void 0:y.message)??(u==null?void 0:u.message)}})}}n({type:"BATCH_DONE"}),(h=a.onApproved)==null||h.call(a)}const Ha=/^0x[0-9a-fA-F]{40}$/;function Ma({accountId:e,initialMode:a="sponsor",onClose:n,onApproved:s,seedBulk:r,deregisterFrom:o,seedAgentsResolved:i,selfCoverage:c}){const{data:f,error:x}=ke(Fe,[],0),{data:v}=ke(()=>oe(e),[e]),w=Me(),A=(f==null?void 0:f.wallets)??[],N=A[0],R=K(C=>C.address),H=K(C=>Ue(C)),h=aa(f,x),l=ja({owner:v==null?void 0:v.owner,primaryWallet:N,primaryWalletState:h}),k=ha({access:l}),u=Me(),p=(v==null?void 0:v.agentCount)??0,b=Math.max(0,100-p),[y,j]=g.useState(a),[D,E]=g.useState({}),[I,Q]=g.useState({}),[ne,re]=g.useState(r??""),[W,F]=g.useReducer(Oa,Ea),J=g.useRef(!1),m=g.useMemo(()=>{const C=new Set,S=[];let _=0;for(const M of ne.split(`
|
|
3
|
+
`).map(G=>G.trim()).filter(Boolean)){if(!Ha.test(M)){_+=1;continue}const G=M.toLowerCase();C.has(G)||(C.add(G),S.push(M))}return{valid:S,invalid:_}},[ne]);g.useEffect(()=>{let C=!1;async function S(){const _=await Promise.all(A.map(async G=>{var te;try{const ae=await oe(e,G,{extended:!0});return[G,String(ae.accountId)===String(e)&&((te=ae.probedKey)==null?void 0:te.registered)===!0]}catch{return[G,!1]}}));if(C)return;const M=Object.fromEntries(_);Q(M),E(G=>{const te={...G};for(const[ae,be]of _)be&&te[ae]===void 0&&(te[ae]=!0);return te})}return A.length===0?(Q({}),()=>{C=!0}):(S(),()=>{C=!0})},[e,A.join("|")]);const L=g.useMemo(()=>A.filter(C=>!I[C]&&!D[C]),[I,A,D]),P=y==="self"?L:m.valid,B=P.length>b,$=ra(l,v==null?void 0:v.owner,R),Se=ma(N,R),Z=async()=>{P.length!==0&&(J.current=!1,await $a({addresses:P,accountId:e,mode:y,selfCoverage:c,deregisterFrom:o,targetWalletManaged:$,signableOwners:Se},{registerAgent:k.registerAgent,deregisterRenew:w.deregisterAgent,deregisterSelf:u.deregisterAgent,resolveWalletBinding:wt,planSelfCoverage:bt,signerKindForAccount:C=>ua({accountId:C,primaryWallet:N,connectedWallet:R,walletWrongNetwork:H}),probePca:oe,describePcaError:ot,onApproved:s},F,()=>J.current))},{order:se,rows:ve,running:U,done:z,aborted:we,verificationDelayed:de,deviceSteps:q,deviceLabel:ue,walletBatchSigning:pe}=W,O=g.useMemo(()=>Ia(W),[W.order,W.rows]),ie=Wa(W),ee=se.length>0,Re=A.filter(C=>I[C]).length;return t.jsxs(me,{onClose:n,testId:"pca-approve-modal",title:`Approve publishing wallets — PCA #${e}`,dismissDisabled:pe,children:[t.jsxs("div",{className:"v10-modal-body",children:[t.jsx("div",{className:"v10-form-group",children:t.jsxs("div",{className:"v10-form-radio-group",role:"radiogroup","aria-label":"Approval mode",children:[t.jsxs("label",{className:"v10-form-radio",children:[t.jsx("input",{type:"radio",checked:y==="self",onChange:()=>j("self"),disabled:U}),"Approve my own node’s wallets"]}),t.jsxs("label",{className:"v10-form-radio",children:[t.jsx("input",{type:"radio",checked:y==="sponsor",onChange:()=>j("sponsor"),disabled:U}),"Approve another node’s wallets"]})]})}),y==="self"?t.jsxs("section",{className:"v10-pca-approve-self",children:[t.jsxs("p",{className:"v10-pca-create-warn",children:[p," / 100 slots used — ",Re," of this node's wallets are already approved here. Unapproved wallets pay the direct cost until you approve them."]}),t.jsxs("div",{className:"v10-pca-approve-checklist",children:[A.map((C,S)=>t.jsxs("label",{className:"v10-pca-approve-self-row",children:[t.jsx("input",{type:"checkbox",checked:!I[C]&&!D[C],onChange:_=>E(M=>({...M,[C]:!_.target.checked})),disabled:U||I[C],"aria-label":`Approve ${C}`}),t.jsx(ge,{address:C,status:I[C]?"already approved here":S===0?"primary signer":void 0,statusTone:I[C]?"success":"neutral"})]},C)),A.length===0&&t.jsx("p",{className:"v10-pca-handshake-empty",children:"No operational wallets detected on this node."})]}),t.jsx("div",{className:"v10-modal-tip",children:"A new PCA covers NOTHING until you approve your own signing wallets. Each is a separate on-chain tx you sign (~30s, owner gas)."})]}):t.jsxs("section",{className:"v10-pca-approve-sponsor",children:[t.jsx(Ft,{mode:"bulk",testId:"pca-approve-address",value:ne,onChange:re,label:"Wallet address(es) — one per line",disabled:U}),t.jsxs("p",{className:"v10-pca-approve-counts",children:[m.valid.length," valid · ",m.invalid," invalid ·"," ",p," → ",p+m.valid.length," of 100 after this"]}),o?t.jsxs("div",{className:"v10-modal-warning","data-testid":"pca-renew-reapprove-note",children:["ⓘ Re-approving PCA #",o,"’s wallets on #",e,". Each wallet is MOVED — deregistered from #",o,", then approved on #",e," (two txs per wallet, owner gas). Account expiry alone doesn’t free a wallet, so this is required to re-use them.",i===!1&&t.jsxs(t.Fragment,{children:[" ",t.jsxs("strong",{children:["Couldn’t load PCA #",o,"’s wallets — add them manually below."]})]})]}):t.jsx("div",{className:"v10-modal-warning",children:"⚠ We can only check the address is well-formed — we can’t verify it’s the node’s real signing wallet. A typo / admin / author address still “approves” and burns a cap slot. Confirm it shows as approved in the other operator's Get added to a PCA panel."})]}),B&&t.jsxs("div",{className:"v10-modal-warning",role:"status",children:["⚠ Up to ",b," of these can be approved. Any already approved here are skipped (no slot used); any genuinely beyond the ",b,"-slot cap are marked “cap reached”."]}),we&&t.jsx("div",{className:"v10-modal-error",role:"alert",children:we}),de&&t.jsx("div",{className:"v10-modal-warning",role:"status",children:de}),q.length>0&&t.jsx(ut,{steps:q,currentLabel:ue??"Confirm on your device"}),ee&&t.jsxs("div",{className:"v10-pca-approve-results",role:"status","aria-live":"polite",children:[se.map(C=>{const S=ve[C];return S?t.jsx(ge,{address:C,status:S.message&&(S.status==="conflict"||S.status==="error"||S.status==="sponsored"||S.status==="stranded"||S.status==="submitted"||S.status==="aborted")?S.message:Ta[S.status],statusTone:Pa[S.status]},C):null}),z&&t.jsxs("p",{className:"v10-pca-approve-summary",children:["Approved ",O.confirmed," confirmed",O.submitted>0?` · ${O.submitted} submitted (verify)`:""," ","· ",O.skipped," already here · ",O.conflict," conflict",O.sponsored>0?` · ${O.sponsored} left on another PCA`:"",O.stranded>0?` · ${O.stranded} need a retry`:"",O.error>0?` · ${O.error} failed`:"",O.unverified>0?` · ${O.unverified} unverified`:""," (of ",se.length,")."]})]}),z&&O.stranded>0&&t.jsxs("div",{className:"v10-modal-warning",role:"alert","data-testid":"pca-approve-stranded",children:["⚠ ",O.stranded," wallet",O.stranded===1?" was":"s were"," removed from the old PCA but not yet re-approved on #",e," — temporarily UNCOVERED. Click “Retry to finish” to complete the move."]}),z&&y==="sponsor"&&!o&&t.jsxs("div",{className:"v10-pca-approve-handoff",children:[t.jsx("div",{className:"v10-modal-warning",children:"Remind the other operator: these wallets must hold NATIVE GAS to publish — the account covers TRAC, never gas."}),t.jsx(Kt,{wallets:ie,accountId:e,role:"core"}),t.jsxs("p",{className:"v10-pca-approve-counts",children:["Account id to share back: ",t.jsxs("strong",{children:["#",e]})," ",t.jsx(it,{value:e,label:`Copy account id ${e}`})]})]})]}),t.jsxs("div",{className:"v10-modal-footer",children:[t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:n,disabled:pe,children:z?"Done":"Cancel"}),U?t.jsx("button",{type:"button",className:"v10-modal-btn",onClick:()=>{J.current=!0},children:"Stop"}):z?O.stranded>0?t.jsx("button",{type:"button",className:"v10-modal-btn primary","data-testid":"pca-approve-retry-stranded",onClick:Z,children:"Retry to finish"}):null:t.jsxs("button",{type:"button",className:"v10-modal-btn primary","data-testid":"pca-approve-submit",onClick:Z,disabled:P.length===0,children:["Approve ",P.length," wallet",P.length===1?"":"s"]})]})]})}export{Ft as A,_a as C,ut as D,Ba as H,me as P,Ma as a,Gt as b,aa as c,ha as d,Na as e,na as o,Qt as p,qe as r,ja as u};
|
package/dist-ui/assets/{ContextGraphPrimitives-Bwc2i7EX.js → ContextGraphPrimitives-CBc6kvmp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aO as t}from"./index-CT-LdpBE.js";const d={neutral:"var(--border-strong)",wm:"var(--layer-working, #64748b)",swm:"var(--layer-shared, #f59e0b)",vm:"var(--layer-verified, #22c55e)",danger:"var(--text-danger)",query:"#38bdf8",warning:"var(--text-warning)"};function m(e){return e}function h({icon:e,title:s,description:r,actions:n=[],tone:i="neutral",compact:a=!1,inline:c=!1,className:v=""}){const o={"--v10-empty-accent":d[i]};return t.jsxs("div",{className:["v10-empty-state",a?"compact":"",c?"inline":"",v].filter(Boolean).join(" "),"data-tone":i,style:o,children:[e&&t.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),t.jsxs("div",{className:"v10-empty-state-copy",children:[t.jsx("div",{className:"v10-empty-state-title",children:s}),r&&t.jsx("div",{className:"v10-empty-state-desc",children:r}),n.length>0&&t.jsx("div",{className:"v10-empty-state-actions",children:n.map(l=>t.jsx("button",{type:"button",className:`v10-empty-state-action ${l.variant??"secondary"}`,onClick:l.onClick,"data-testid":l.testId,children:l.label},l.label))})]})]})}function y({items:e,layer:s,compact:r=!1,className:n=""}){const i=s?{"--v10-stat-accent":d[s]}:void 0;return t.jsx("div",{className:["v10-stat-strip",r?"compact":"",n].filter(Boolean).join(" "),"data-layer":s,style:i,children:e.map((a,c)=>t.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":a.id,title:a.tooltip,children:[t.jsx("span",{className:"v10-stat-strip-label",children:a.label}),t.jsx("span",{className:"v10-stat-strip-value",children:a.value}),a.hint&&t.jsx("span",{className:"v10-stat-strip-hint",children:a.hint})]},a.id??c))})}export{h as E,y as S,m as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aO as e,bN as $,bJ as R,bc as y,aW as G,b7 as J,aq as P,H as Q,B as E,by as S,aV as M,a7 as W,bL as X,ar as V,ai as Z,bv as I,N as O,aC as ee,aw as ae}from"./index-CT-LdpBE.js";import{A as te,a as Y,C as ne,u as se,e as re,d as le,H as oe,b as ie,D as ce,c as de}from"./ApproveWalletsModal-BMtRgndO.js";import{e as U,o as q,L as pe,d as B,f as ue,c as me,b as he}from"./browserWalletTransaction-B6wyaMOV.js";import{S as ve}from"./ContextGraphPrimitives-CBc6kvmp.js";const D=(a,t)=>!!a&&!!t&&a.toLowerCase()===t.toLowerCase();function we({agents:a,nodeWallets:t,ownerIsPrimary:r,ownerTitle:l,confirmRemove:s,onAskRemove:n,onCancelRemove:i,onConfirmRemove:v,removeBusy:u,explorer:p}){return e.jsx("div",{className:"v10-pca-detail-agentlist","data-testid":"pca-agent-list",children:a.map(c=>{const h=t.some(f=>D(f,c)),o=D(s??void 0,c);return e.jsx("div",{className:"v10-pca-agent-row","data-testid":"pca-agent-row",children:e.jsx(U,{address:c,status:h?"approved · this node":"approved",statusTone:"success",trailing:o?e.jsxs("span",{className:"v10-pca-agent-confirm",children:[e.jsx("span",{children:h?"This is one of this node’s own signing wallets — its publishes will pay the direct cost (and revert if it holds no TRAC). Remove?":"Publishes from this wallet will pay the direct cost (and revert if it holds no TRAC). Remove?"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-deregister-btn","aria-label":`Confirm removing ${c}`,onClick:()=>v(c),disabled:u,children:u?"Removing…":"Yes, remove"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","aria-label":`Cancel removing ${c}`,onClick:i,disabled:u,children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[p&&e.jsx("a",{className:"v10-pca-card-explorer",href:`${p}/address/${c}`,target:"_blank",rel:"noreferrer","aria-label":`View ${c} on explorer`,children:"↗"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","aria-label":`Remove ${c}`,onClick:()=>n(c),disabled:!r,title:l,children:"Remove"})]})})},c)})})}function ge(){const a=$(l=>l.setBootstrap),t=$(l=>l.initWallet),r=R(l=>l.setScope);y.useEffect(()=>{let l=!1;return G().then(s=>{l||(r(J(s)),a(s))}).catch(()=>{}).finally(()=>{l||t()}),()=>{l=!0}},[t,r,a])}function be(a){return a==="topup"?{requiresApproval:!0,actionLabel:"Sign top-up"}:{requiresApproval:!1,actionLabel:"Sign remove wallet"}}function _(a,t){const r=q(a,"action");return t==="remove"&&r.kind==="rejected"?"You rejected the remove-wallet transaction. No wallet was removed.":r.message}const fe={busy:!1,error:null,result:null};function K(){return y.useState(fe)}function xe({accountId:a,setFund:t,refresh:r}){const l=R(i=>i.topUpPending[a]??null),s=R(i=>i.clearTopUpPending),n=$(i=>i.bootstrap);y.useEffect(()=>{var p;if(!l||!((p=n==null?void 0:n.rpcUrls)!=null&&p.length))return;let i=!1,v=null;const u=async()=>{try{const h=await pe(n.chainId,n.rpcUrls).getTransactionReceipt({hash:l.txHash});if(i)return;s(a),h.status==="success"?(t({busy:!1,error:null,warning:null,result:{txHash:l.txHash,message:"Top-up confirmed on-chain."}}),r()):t({busy:!1,error:"The pending top-up transaction reverted on-chain.",warning:null,result:null})}catch{i||(v=setTimeout(u,5e3))}};return u(),()=>{i=!0,v&&clearTimeout(v)}},[a,s,r,t,l,n])}function ye({accountId:a,snapshot:t,ownerTrac:r,explorer:l,access:s,ownerTitle:n,owner:i,deviceProgress:v,refresh:u}){const p=R(b=>b.topUpPending[a]??null),c=R(b=>b.setTopUpPending),h=R(b=>b.clearTopUpPending),[o,f]=y.useState(""),[m,w]=K();xe({accountId:a,setFund:w,refresh:u});const C=async()=>{var b,x;s.mode==="wallet"?v.begin("topup"):v.reset(),w({busy:!0,error:null,result:null,warning:null});try{const d=await i.topUp(a,o.trim());h(a),w({busy:!1,error:null,result:{txHash:d.txHash,message:`Added ${P(d.addedTokens)} TRAC.`}}),f(""),u()}catch(d){if(d instanceof Q&&d.status===504){const j=(b=d.body)==null?void 0:b.txHash;if(j){c({accountId:a,ownerEoa:t.owner,submittedAt:Date.now(),txHash:j,tokens:o.trim(),previousTopUpBufferTrac:t.topUpBufferTrac}),w({busy:!1,error:null,result:null,warning:{txHash:j,message:"Your top-up was submitted but we lost confirmation — it may already be on-chain. Verify on the explorer before adding again; a second top-up would lock additional TRAC."}});return}}if(d instanceof B&&d.txStep==="action"&&d.txHash){c({accountId:a,ownerEoa:t.owner,submittedAt:Date.now(),txHash:d.txHash,tokens:o.trim(),previousTopUpBufferTrac:t.topUpBufferTrac}),w({busy:!1,error:null,result:null,warning:{txHash:d.txHash,message:"Your top-up was submitted but we lost confirmation - it may already be on-chain. This exact transaction is being checked; do not add again until it resolves."}});return}if(s.mode==="wallet"){const j=q(d,d instanceof ue?d.txStep:d instanceof B?d.txStep??"action":"action");w({busy:!1,error:j.message,result:null,warning:d instanceof me?null:void 0});return}w({busy:!1,error:((x=E(d,{accountId:a}))==null?void 0:x.message)??(d==null?void 0:d.message)??"Top-up failed.",result:null})}};return e.jsxs("section",{className:"v10-pca-detail-section",children:[e.jsx("h3",{className:"v10-pca-detail-section-title",children:"Funding"}),e.jsxs("p",{className:"v10-pca-detail-hint",children:["Top-up raises the spendable buffer. It does ",e.jsx("strong",{children:"not"})," extend the lock period — when the account expires you create a new one."]}),r!=null&&e.jsxs("p",{className:"v10-pca-detail-hint",children:["Owner balance: ",P(r)," TRAC"]}),e.jsxs("div",{className:"v10-pca-detail-form",children:[e.jsx("input",{className:"v10-form-input",type:"text",inputMode:"decimal",value:o,onChange:b=>f(b.target.value),placeholder:"Top up (TRAC)",disabled:!s.writesEnabled||m.busy||!!p,"aria-label":"Top-up amount in TRAC"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn primary","data-testid":"pca-topup-btn",onClick:C,disabled:!s.writesEnabled||m.busy||!!p||!/^\d+(\.\d+)?$/.test(o.trim())||Number(o.trim())<=0,title:n,children:m.busy?"Adding…":"Add funds"})]}),e.jsx(Ce,{state:m,explorer:l,onRecheck:u}),p&&e.jsxs("p",{className:"v10-pca-create-warn","data-testid":"pca-topup-pending",role:"alert",children:["Top-up transaction ",e.jsx("code",{children:p.txHash})," is pending confirmation. The top-up button is disabled while this exact receipt is checked; adding again could lock more TRAC."," ",e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:u,children:"Recheck account"})]})]})}function Ce({state:a,explorer:t,onRecheck:r}){if(a.warning){const s=t&&a.warning.txHash?`${t}/tx/${a.warning.txHash}`:void 0;return e.jsxs("p",{className:"v10-pca-create-warn","data-testid":"pca-action-warning",role:"alert",children:[a.warning.message," ",a.warning.txHash&&(s?e.jsxs("a",{href:s,target:"_blank",rel:"noreferrer",children:[a.warning.txHash," ↗"]}):e.jsx("code",{children:a.warning.txHash}))," ",r&&e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:r,children:"Recheck"})]})}if(a.error)return e.jsx("p",{className:"v10-modal-error",role:"alert",children:a.error});if(!a.result)return null;const l=t&&a.result.txHash?`${t}/tx/${a.result.txHash}`:void 0;return e.jsxs("p",{className:"v10-pca-detail-result","data-testid":"pca-action-result",role:"status",children:[a.result.message," ",l&&e.jsx("a",{href:l,target:"_blank",rel:"noreferrer",children:"tx ↗"})," ","Still pending? You can close this and verify here."]})}const je=/^0x[0-9a-fA-F]{40}$/;function Ne({accountId:a,snapshot:t,wallets:r,explorer:l,access:s,ownerTitle:n,owner:i,deviceProgress:v,refresh:u}){const[p,c]=y.useState(""),[h,o]=y.useState(null),[f,m]=y.useState(null),[w,C]=K(),[b,x]=y.useState(!1),{data:d,loading:j,refresh:N}=S(()=>M(a),[a]),k=d&&d.accountId===a?d:null,z=async()=>{var T,A;o(null);const g=p.trim();if(!je.test(g)){o("Enter a valid 0x address.");return}try{const L=(T=(await W(a,g)).probedKey)==null?void 0:T.registered;o(L===!0?`✓ ${g} is an approved publishing wallet here.`:L===!1?`✗ ${g} is NOT approved here.`:`Couldn’t determine whether ${g} is approved here — retry.`)}catch(F){o(((A=E(F,{accountId:a}))==null?void 0:A.message)??"Probe failed.")}},H=async g=>{var T;s.mode==="wallet"?v.begin("remove"):v.reset(),C({busy:!0,error:null,result:null});try{await i.deregisterAgent(a,g),C({busy:!1,error:null,result:{message:`Removed ${g}.`}}),m(null),u(),N()}catch(A){C({busy:!1,error:s.mode==="wallet"?_(A,"remove"):((T=E(A,{accountId:a}))==null?void 0:T.message)??(A==null?void 0:A.message)??"Remove failed.",result:null})}};return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"v10-pca-detail-section",children:[e.jsxs("h3",{className:"v10-pca-detail-section-title",children:["Publishing wallets — ",t.agentCount," / 100"]}),e.jsxs("div",{className:"v10-pca-detail-form",children:[e.jsx(te,{mode:"single",value:p,onChange:c,label:"Check a wallet",cruxNote:null}),e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:z,children:"Probe"})]}),h&&e.jsx("p",{className:"v10-pca-detail-hint",role:"status",children:h}),j&&!k?e.jsx("p",{className:"v10-pca-detail-hint",role:"status",children:"Loading approved wallets…"}):k?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"v10-pca-detail-subhead",children:"Approved publishing wallets:"}),k.agents.length>0?e.jsx(we,{agents:k.agents,nodeWallets:r,ownerIsPrimary:s.writesEnabled,ownerTitle:n,confirmRemove:f,onAskRemove:g=>m(g),onCancelRemove:()=>m(null),onConfirmRemove:g=>H(g),removeBusy:w.busy,explorer:l}):e.jsx("div",{className:"v10-pca-detail-agentlist","data-testid":"pca-agent-list",children:e.jsx("p",{className:"v10-pca-handshake-empty",children:"No approved publishing wallets yet."})})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"v10-pca-detail-subhead",children:"This node’s wallets:"}),e.jsxs("div",{className:"v10-pca-detail-agentlist","data-testid":"pca-agent-list",children:[r.map(g=>e.jsx(Ae,{accountId:a,wallet:g,ownerIsPrimary:s.writesEnabled,ownerTitle:n,confirming:f===g,onAskRemove:()=>m(g),onCancelRemove:()=>m(null),onConfirmRemove:()=>H(g),removeBusy:w.busy},g)),r.length===0&&e.jsx("p",{className:"v10-pca-handshake-empty",children:"No operational wallets on this node."})]}),e.jsx("p",{className:"v10-pca-overview-caveat",children:"ⓘ The chain exposes how many wallets are approved, not the full list — only this node’s wallets and any you probe are shown here."})]}),w.error&&e.jsx("p",{className:"v10-modal-error",role:"alert",children:w.error}),w.result&&e.jsx("p",{className:"v10-pca-detail-result",role:"status","data-testid":"pca-remove-result",children:w.result.message}),e.jsx("button",{type:"button",className:"v10-pca-card-btn primary",onClick:()=>x(!0),disabled:!s.writesEnabled,title:n,children:"+ Approve publishing wallet"})]}),b&&e.jsx(Y,{accountId:a,initialMode:"self",onClose:()=>{x(!1),u(),N()}})]})}function Ae({accountId:a,wallet:t,ownerIsPrimary:r,ownerTitle:l,confirming:s,onAskRemove:n,onCancelRemove:i,onConfirmRemove:v,removeBusy:u}){var m;const{data:p,loading:c,error:h}=S(()=>W(a,t),[a,t]),o=(m=p==null?void 0:p.probedKey)==null?void 0:m.registered,f=!c&&(h!=null||p!=null&&o==null);return e.jsx("div",{className:"v10-pca-agent-row","data-testid":"pca-agent-row",children:e.jsx(U,{address:t,status:o===!0?"approved":o===!1?"not approved":f?"couldn’t determine":"checking…",statusTone:o===!0?"success":o===!1?"danger":"neutral",trailing:o===!0?s?e.jsxs("span",{className:"v10-pca-agent-confirm",children:[e.jsx("span",{children:"This is one of this node’s own signing wallets — its publishes will pay the direct cost (and revert if it holds no TRAC). Remove?"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","data-testid":"pca-deregister-btn","aria-label":`Confirm removing ${t}`,onClick:v,disabled:u,children:u?"Removing…":"Yes, remove"}),e.jsx("button",{type:"button",className:"v10-pca-card-btn","aria-label":`Cancel removing ${t}`,onClick:i,disabled:u,children:"Cancel"})]}):e.jsx("button",{type:"button",className:"v10-pca-card-btn","aria-label":`Remove ${t}`,onClick:n,disabled:!r,title:l,children:"Remove"}):void 0})})}function Re(a){const[t,r]=y.useState(!1),[l,s]=y.useState(!1),[n,i]=y.useState(null),v=X(c=>c.openTab);return{renewOpen:t,renewChaining:l,renewApprove:n,openRenew:()=>r(!0),closeRenew:()=>r(!1),onRenewSuccess:c=>{r(!1),s(!0),M(a).then(h=>({agents:h.agents,resolved:!0})).catch(()=>({agents:[],resolved:!1})).then(({agents:h,resolved:o})=>{s(!1),i({newAccountId:c,seedBulk:h.join(`
|
|
2
|
+
`),agentsResolved:o})})},onManageNew:c=>{r(!1),v({id:`conviction:${c}`,label:`PCA #${c}`,closable:!0})},clearRenewApprove:()=>i(null)}}function Te({accountId:a,snapshot:t,access:r,ownerTitle:l,health:s}){const n=Re(a);return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"v10-pca-detail-section",children:[e.jsx("h3",{className:"v10-pca-detail-section-title",children:"Lifecycle"}),(s==="expiring"||s==="expired")&&e.jsxs("p",{className:"v10-pca-card-warn",children:[V(t.expiresAtTimestamp),". The lock period can’t be extended — Renew creates a fresh replacement account seeded from this one (the old TRAC stays locked until its own expiry)."]}),e.jsx("button",{type:"button",className:`v10-pca-card-btn${s==="expiring"||s==="expired"?" primary":""}`,"data-testid":"pca-renew-btn",onClick:()=>n.openRenew(),disabled:!r.writesEnabled,title:l,children:"Renew — create a replacement PCA"})]}),n.renewOpen&&e.jsx(ne,{seed:{tokens:t.committedTRACTrac,primaryNode:t.primaryNode&&t.primaryNode!=="0"?String(t.primaryNode):void 0,primaryNodeUnknown:t.primaryNode==null},replacingAccountId:a,initialOwnerKey:r.mode==="wallet"?"hardware":"hot",onClose:()=>n.closeRenew(),onApproveOwnWallets:n.onRenewSuccess,onManage:n.onManageNew,onGetSponsored:()=>n.closeRenew()}),n.renewChaining&&e.jsx("div",{className:"lazy-spinner",role:"status","data-testid":"pca-renew-chaining",children:"Preparing re-approval…"}),n.renewApprove&&e.jsx(Y,{accountId:n.renewApprove.newAccountId,initialMode:"sponsor",seedBulk:n.renewApprove.seedBulk,deregisterFrom:a,seedAgentsResolved:n.renewApprove.agentsResolved,onClose:()=>n.clearRenewApprove()})]})}function Pe(a){return V(a).replace(/^Expires in /,"")}function Ue({accountId:a}){var d,j;const{data:t,loading:r,error:l,refresh:s}=S(()=>W(a,void 0,{extended:!0}),[a]),n=(t==null?void 0:t.accountId)===a?t:null,{data:i,error:v,refresh:u}=S(Z,[],0),p=I(N=>N.nodeStatus),c=(p==null?void 0:p.blockExplorerUrl)??null,h=$(N=>N.address),o=(i==null?void 0:i.wallets)??[],f=de(i,v),m=se({owner:n==null?void 0:n.owner,primaryWallet:o[0],primaryWalletState:f});if(ge(),r&&!n)return e.jsxs("div",{className:"lazy-spinner",children:["Loading PCA #",a,"…"]});if(l||!n)return e.jsx("div",{className:"v10-pca-detail",children:e.jsx("div",{className:"card",children:e.jsxs("div",{className:"card-body v10-pca-card-error",children:[e.jsxs("p",{children:["Couldn’t load PCA #",a,"."]}),e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:()=>s(),children:"Retry"})]})})});const w=o.some(N=>O(N,n.owner)),C=m.ownerUnknownCause==="wallets-loading",b=m.ownerUnknownCause==="wallets-unreadable",x=C?`Confirming ownership of PCA #${a}…`:b?`Couldn't load this node's wallets - can't confirm ownership of PCA #${a}.`:m.mode==="wallet"&&m.wrongNetwork?`Wrong network - switch the connected wallet to this node's PCA network to manage PCA #${a}.`:m.mode==="wallet"?`Connected wallet ${n.owner} owns PCA #${a}; device-signed owner actions are enabled.`:w?`Owner-only - PCA #${a} is owned by ${n.owner}, not this node's primary operational wallet, so node-UI can't sign for it.`:h?`Owner-only - connected as ${h}; switch to ${n.owner} to manage PCA #${a}.`:`Owner-only - connect ${n.owner} to manage PCA #${a}.`;return e.jsx(ke,{accountId:a,snapshot:n,wallets:o,ownerTrac:(j=(d=i==null?void 0:i.balances)==null?void 0:d.find(N=>O(N.address,n.owner)))==null?void 0:j.trac,explorer:c,access:m,connectedWallet:h,ownerOnlyReason:x,walletsLoading:C,walletsUnreadable:b,onRetryWallets:u,refresh:s})}function ke({accountId:a,snapshot:t,wallets:r,ownerTrac:l,explorer:s,access:n,connectedWallet:i,ownerOnlyReason:v,walletsLoading:u,walletsUnreadable:p,onRetryWallets:c,refresh:h}){const o=re({labels:{idle:"Confirm on your device",approveActive:"Confirm on your device (1 of 2): approve TRAC",approveReady:"Allowance ready — continue to the owner action",actionActive:x=>x==="remove"?"Confirm on your device: remove wallet":"Confirm on your device (2 of 2): top up",submitted:"Waiting for on-chain confirmation",confirmed:"Transaction confirmed on-chain",failed:"Wallet transaction failed"},flow:x=>be(x??"topup"),describeActionError:(x,d)=>_(x,d??"topup")}),f=le({access:n,onWalletProgress:n.mode==="wallet"?o.onProgress:void 0}),m=ee(t),w=n.writesEnabled?void 0:v,C=(t.discountBps/100).toFixed(t.discountBps%100===0?0:1),b=i?n.mode==="wallet"?n.wrongNetwork?"Owner wallet matches; switch network before signing owner actions.":"Connected owner wallet will sign top-up, approve, remove, and renewal actions.":n.mode==="daemon"?"Connected wallet is available for wallet-owned PCAs; this account uses the node daemon for owner actions.":`Connected as ${i}; switch to ${t.owner} to manage owner actions.`:n.mode==="external"?"Connect the PCA owner wallet to manage this account. Provider metadata is display-only.":"Connect a wallet to view and manage wallet-owned PCAs from this tab.";return e.jsxs("div",{className:"v10-pca-detail","data-testid":"pca-detail",children:[e.jsxs("div",{className:"v10-pca-detail-band",children:[e.jsxs("span",{className:"v10-pca-detail-id",children:["PCA #",a]}),e.jsxs("span",{className:"badge badge-info",children:["◉ ",C,"% discount"]}),e.jsxs("span",{className:"v10-pca-detail-committed",children:[P(t.committedTRACTrac)," TRAC committed"]}),e.jsx("span",{className:"v10-pca-card-spacer"}),e.jsx(oe,{state:m})]}),e.jsxs("div",{className:"v10-modal-tip",role:"status",children:[b,i?e.jsx(he,{}):e.jsx(ie,{testId:"pca-wallet-connect"})]}),o.steps.length>0&&e.jsx(ce,{steps:o.steps,currentLabel:o.currentLabel,blockExplorerUrl:s}),!n.writesEnabled&&(u?e.jsx("div",{className:"v10-modal-tip",role:"status",children:v}):e.jsxs("div",{className:"v10-modal-warning",role:"status",children:["ⓘ ",v," ",p?e.jsx("button",{type:"button",className:"v10-pca-card-btn",onClick:c,children:"Retry"}):"Wallet probe stays available."]})),e.jsx(ve,{items:[{id:"buffer",label:"Top-up buffer",value:`${P(t.topUpBufferTrac)} TRAC`},{id:"per-epoch",label:"TRAC per epoch",value:`${ae(t.baseEpochAllowance)} TRAC`},...t.remainingAllowanceTrac!=null?[{id:"remaining",label:"Remaining this epoch",value:`${P(t.remainingAllowanceTrac)} TRAC`,tooltip:t.currentEpoch!=null?`Current epoch ${t.currentEpoch}`:void 0}]:[],{id:"wallets",label:"Publishing wallets",value:`${t.agentCount} / 100`},{id:"expires",label:"Expires in",value:Pe(t.expiresAtTimestamp),tooltip:`Expiry epoch ${t.expiresAtEpoch}`},...t.primaryNode!=null?[{id:"primary-node",label:"Primary node",value:t.primaryNode==="0"?"None set":`Node #${t.primaryNode}`,tooltip:t.lastPrimaryNodeChangeEpoch!=null?`Last changed epoch ${t.lastPrimaryNodeChangeEpoch}`:void 0}]:[]]}),e.jsxs("div",{className:"v10-pca-detail-owner",children:[e.jsx("span",{className:"v10-pca-card-owner-lbl",children:"Owner"}),e.jsx(U,{address:t.owner,trailing:s?e.jsx("a",{className:"v10-pca-card-explorer",href:`${s}/address/${t.owner}`,target:"_blank",rel:"noreferrer","aria-label":"View owner on explorer",children:"↗"}):void 0})]}),e.jsx(ye,{accountId:a,snapshot:t,ownerTrac:l,explorer:s,access:n,ownerTitle:w,owner:f,deviceProgress:o,refresh:h}),e.jsx(Ne,{accountId:a,snapshot:t,wallets:r,explorer:s,access:n,ownerTitle:w,owner:f,deviceProgress:o,refresh:h}),e.jsx(Te,{accountId:a,snapshot:t,access:n,ownerTitle:w,health:m})]})}export{Ue as ConvictionDetailView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{ba as i,$ as ve,aj as G,q as oe,bD as be,aN as e,R as K,bw as D,O as ge,bC as B,af as xe,aQ as de,b9 as fe,b1 as je,f as Ne,b8 as ie,F as we,E as re,_ as q,aX as ye}from"./index-RLb1kuzE.js";import{t as he}from"./truncate-BaiMkAOo.js";const Se={"application/pdf":"pdf","application/json":"text","text/plain":"text","text/csv":"text","text/markdown":"markdown","image/png":"image","image/jpeg":"image","image/gif":"image","image/webp":"image"};function ne(s){const c=Se[s];return c?c==="markdown"?"text":c:"binary"}async function ce(s){const c=await fetch(s,{headers:oe()});if(!c.ok)throw new Error(`HTTP ${c.status}`);const l=await c.blob();return URL.createObjectURL(l)}function ke({open:s,onClose:c,assertionName:l,contextGraphId:g,subGraphName:d}){const[r,p]=i.useState(null),[N,C]=i.useState(null),[m,w]=i.useState(null),[y,x]=i.useState(!0),[v,S]=i.useState(null);i.useEffect(()=>{if(s)return x(!0),S(null),p(null),C(null),w(null),ve(l,g,d).then(async b=>{p(b);const P=ne(b.detectedContentType),E=G(b.fileHash,b.detectedContentType);if(P==="text"){const t=await fetch(E,{headers:oe()});t.ok&&C(await t.text())}else if(P==="pdf"||P==="image"){const t=await ce(E);w(t)}}).catch(b=>S(b.message??"Failed to load file info")).finally(()=>x(!1)),()=>{m&&URL.revokeObjectURL(m)}},[s,l,g,d]),i.useEffect(()=>()=>{m&&URL.revokeObjectURL(m)},[m]);const{dialogRef:n,onBackdropClick:u}=be(s,c);if(!s)return null;const o=r?ne(r.detectedContentType):null,f=r?G(r.fileHash,r.detectedContentType):null,k=async(b,P)=>{try{const E=await ce(b),t=document.createElement("a");t.href=E,t.download=P,t.click(),URL.revokeObjectURL(E)}catch{window.open(b,"_blank")}};return e.jsx("div",{className:"v10-modal-overlay",onClick:u,role:"presentation",children:e.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[e.jsxs("div",{className:"v10-modal-header",children:[e.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:l}),e.jsx("button",{type:"button",className:"v10-modal-close",onClick:c,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),y&&e.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),v&&e.jsxs("div",{className:"v10-file-preview-error",children:[e.jsx("p",{children:v}),e.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),r&&!y&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"v10-file-preview-meta",children:[e.jsx("span",{className:"v10-file-preview-meta-item",children:r.detectedContentType}),e.jsxs("span",{className:"v10-file-preview-meta-item",children:[r.tripleCount," triples extracted"]}),e.jsx("span",{className:"v10-file-preview-meta-item",children:r.pipelineUsed}),r.completedAt&&e.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(r.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"v10-file-preview-content",children:[o==="pdf"&&m&&e.jsx("iframe",{src:m,className:"v10-file-preview-iframe",title:`Preview: ${l}`}),o==="image"&&m&&e.jsx("img",{src:m,alt:l,className:"v10-file-preview-image"}),o==="text"&&N!=null&&e.jsx("pre",{className:"v10-file-preview-text",children:N}),o==="binary"&&e.jsxs("div",{className:"v10-file-preview-binary",children:[e.jsx("p",{children:"This file type cannot be previewed directly."}),f&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(f,l),children:"Download file"})]})]}),e.jsxs("div",{className:"v10-file-preview-footer",children:[f&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(f,l),children:"Download original"}),r.mdIntermediateHash&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(G(r.mdIntermediateHash,"text/markdown"),`${l}.md`),children:"Download markdown intermediate"})]})]})]})})}const Ce=i.lazy(()=>q(()=>import("./index-UvxrSkC_.js").then(s=>s.h),__vite__mapDeps([0,1,2,3])).then(s=>({default:s.RdfGraph}))),Ee=i.lazy(()=>q(()=>import("./index-UvxrSkC_.js").then(s=>s.h),__vite__mapDeps([0,1,2,3])).then(s=>({default:s.NodePanel}))),Le=i.lazy(()=>q(()=>import("./OnChainProvenanceCard-DKyfVEjF.js"),__vite__mapDeps([4,1,2,0,3,5])).then(s=>({default:s.OnChainProvenanceCard}))),Pe={wm:{label:"Working Memory",color:"var(--layer-working)",icon:"◇",description:"Private agent drafts. Fast local storage."},swm:{label:"Shared Working Memory",color:"var(--layer-shared)",icon:"◈",description:"Shared proposals with collaborators. TTL-bounded."},vm:{label:"Verifiable Memory",color:"var(--layer-verified)",icon:"◉",description:"Endorsed, published, on-chain knowledge."}},Ae={labelMode:"humanized",renderer:"2d",labels:ye({extraPredicates:["http://schema.org/text"]}),style:{classColors:{"http://schema.org/Person":"#f472b6","http://schema.org/Organization":"#fb923c","http://schema.org/Place":"#34d399","http://schema.org/Product":"#c084fc","http://schema.org/Event":"#facc15","http://schema.org/CreativeWork":"#7dd3fc","http://schema.org/Thing":"#94a3b8"},defaultNodeColor:"#94a3b8",defaultEdgeColor:"#5f8598",edgeWidth:.9},hexagon:{baseSize:4,minSize:3,maxSize:6,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}},Re=e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),e.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),Te=e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"6",cy:"6",r:"3"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("circle",{cx:"18",cy:"18",r:"3"}),e.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),e.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function Ve({layer:s,contextGraphId:c,externalQuery:l,externalQueryKey:g,queryPresetOptions:d}){var le,te;const r=Pe[s],[p,N]=i.useState("graph"),[C,m]=i.useState(""),[w,y]=i.useState(""),[x,v]=i.useState(""),[S,n]=i.useState(""),[u,o]=i.useState("any"),[f,k]=i.useState(50),[b,P]=i.useState(""),[E,t]=i.useState("any"),[h,L]=i.useState(50),[U,A]=i.useState(s!=="vm"),j=K.useRef(s);K.useEffect(()=>{j.current!==s&&(j.current=s,m(""),A(s!=="vm"),y(""),v(""),n(""),o("any"),k(50),P(""),t("any"),L(50))},[s]),K.useEffect(()=>{l!==void 0&&(m(""),y(l),v(l))},[l,g]);const W=i.useMemo(()=>s==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${c}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:s==="vm"?$e({query:b,field:E,limit:h}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[c,s,E,h,b]),$=x||W,O=s==="swm"?"_shared_memory":void 0,Y=s==="swm",X=s==="vm"?"verifiable-memory":void 0,J=s==="wm"&&$===W,{data:T,loading:V,error:Z,refresh:R}=D(()=>ge($,{contextGraphId:c,includeSharedMemory:Y,graphSuffix:O,view:X,includeContextGraphPartitions:J}),[$,c,Y,O,X,J],0);B(c,R,{layers:[s]});const{data:I}=D(xe,[],3e4),me=I==null?void 0:I.blockExplorerUrl,ee=i.useCallback(()=>{const a=w.trim();if(a===x){R();return}v(a)},[x,w,R]),se=i.useCallback(()=>{const a=S!==b||u!==E||f!==h;if(a&&(P(S),t(u),L(f)),x){v("");return}a||R()},[x,E,h,b,u,f,S,R]),M=((le=T==null?void 0:T.result)==null?void 0:le.bindings)??((te=T==null?void 0:T.results)==null?void 0:te.bindings)??[],F=i.useMemo(()=>M.map(a=>({subject:_(a.s)??"",predicate:_(a.p)??"",object:_(a.o)??""})).filter(a=>a.subject&&a.predicate&&a.object),[M]),ue=i.useCallback(a=>{a!=null&&a.id&&v(`SELECT (<${a.id}> AS ?s) ?p ?o WHERE { <${a.id}> ?p ?o } LIMIT 100`)},[]);return e.jsxs("div",{className:"v10-memory-layer-view",children:[e.jsxs("div",{className:"v10-mlv-header",children:[e.jsx("span",{className:"v10-mlv-icon",style:{color:r.color},children:r.icon}),e.jsxs("div",{children:[e.jsx("h2",{className:"v10-mlv-title",children:r.label}),e.jsx("p",{className:"v10-mlv-desc",children:r.description})]})]}),s==="wm"&&e.jsx(Me,{contextGraphId:c,onPromoted:R}),s==="swm"&&e.jsx(_e,{contextGraphId:c,onPublished:R}),s==="vm"&&e.jsxs("div",{className:"v10-vm-search-panel",children:[e.jsxs("div",{className:"v10-vm-search-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),e.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),e.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>A(a=>!a),children:U?"Hide SPARQL":"Advanced SPARQL"})]}),e.jsxs("div",{className:"v10-vm-search-controls",children:[e.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:S,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&se()}}),e.jsxs("select",{className:"v10-vm-search-select",value:u,onChange:a=>o(a.target.value),children:[e.jsx("option",{value:"any",children:"Any field"}),e.jsx("option",{value:"subject",children:"Subject"}),e.jsx("option",{value:"predicate",children:"Predicate"}),e.jsx("option",{value:"object",children:"Object"})]}),e.jsxs("select",{className:"v10-vm-search-select",value:String(f),onChange:a=>k(Number.parseInt(a.target.value,10)||50),children:[e.jsx("option",{value:"25",children:"25 rows"}),e.jsx("option",{value:"50",children:"50 rows"}),e.jsx("option",{value:"100",children:"100 rows"}),e.jsx("option",{value:"200",children:"200 rows"})]}),e.jsx("button",{className:"v10-mlv-run-btn",onClick:se,children:"Search"})]})]}),(s!=="vm"||U)&&e.jsxs("div",{className:"v10-mlv-query-bar",children:[d!=null&&d.length?e.jsxs("select",{className:"v10-vm-search-select",value:C,onChange:a=>{const H=a.target.value;m(H);const z=d.find(pe=>pe.label===H),ae=(z==null?void 0:z.query)??"";y(ae),v(ae)},children:[e.jsx("option",{value:"",children:"Select common query..."}),d.map(a=>e.jsx("option",{value:a.label,children:a.label},a.label))]}):e.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:w,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Enter"&&ee()}}),e.jsx("button",{className:"v10-mlv-run-btn",onClick:ee,children:"Run"}),x&&e.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>v(""),title:"Reset to full layer overview",children:"Reset"}),e.jsxs("div",{className:"v10-mlv-view-toggle",children:[e.jsx("button",{className:`v10-mlv-toggle-btn ${p==="table"?"active":""}`,onClick:()=>N("table"),title:"Table view",children:Re}),e.jsx("button",{className:`v10-mlv-toggle-btn ${p==="graph"?"active":""}`,onClick:()=>N("graph"),title:"Graph view",children:Te})]})]}),V&&e.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),Z&&e.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",Z]}),!V&&M.length===0&&e.jsxs("div",{className:"v10-mlv-empty",children:[e.jsxs("p",{children:["No triples found in ",r.label.toLowerCase(),"."]}),e.jsxs("p",{style:{fontSize:11,marginTop:4},children:[s==="wm"&&"Import files or chat with your agent to generate working memory.",s==="swm"&&"Promote assertions from working memory to share with collaborators.",s==="vm"&&"Publish shared memory to create verified on-chain knowledge."]})]}),!V&&M.length>0&&p==="table"&&e.jsxs("div",{className:"v10-mlv-table-wrap",children:[e.jsxs("div",{className:"v10-mlv-result-count",children:[M.length," triples"]}),e.jsxs("table",{className:"v10-mlv-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Subject"}),e.jsx("th",{children:"Predicate"}),e.jsx("th",{children:"Object"})]})}),e.jsx("tbody",{children:M.map((a,H)=>e.jsxs("tr",{children:[e.jsx("td",{className:"v10-mlv-cell",children:Q(_(a.s))}),e.jsx("td",{className:"v10-mlv-cell",children:Q(_(a.p))}),e.jsx("td",{className:"v10-mlv-cell",children:Q(_(a.o))})]},H))})]})]}),!V&&F.length>0&&p==="graph"&&e.jsxs("div",{className:"v10-mlv-graph-container",children:[e.jsxs("div",{className:"v10-mlv-graph-info",children:[e.jsxs("span",{children:[F.length," triples"]}),x&&e.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),e.jsx(i.Suspense,{fallback:e.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:e.jsxs(Ce,{data:F,format:"triples",options:Ae,style:{width:"100%",height:"100%"},onNodeClick:ue,initialFit:!0,children:[e.jsx(Ee,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),e.jsx(Le,{contextGraphId:c,layer:s,explorerUrl:me})]})})]})]})}function Me({contextGraphId:s,onPromoted:c}){const{data:l,loading:g,refresh:d}=D(()=>de(s,"wm"),[s],0);B(s,d,{layers:["wm"]});const[r,p]=i.useState(null),[N,C]=i.useState(null),[m,w]=i.useState(null),[y,x]=i.useState(null),v=i.useCallback(async n=>{p(n.graphUri),C(null),w(null);try{const u=await ie(s,n.name,n.subGraph?{subGraphName:n.subGraph}:{}),o=we(n.name,u);C({message:o.message+(n.subGraph?` (in ${n.subGraph})`:""),kind:o.kind==="success"?"success":"noop",subGraph:n.subGraph}),d(),c()}catch(u){const o=re(n.name,u);w(o?{message:o.message,kind:"not-persisted"}:{message:(u==null?void 0:u.message)??"Promote failed",kind:"other"})}finally{p(null)}},[s,d,c]),S=i.useCallback(async()=>{if(!(l!=null&&l.length))return;p("__all__"),C(null),w(null);let n=0,u=null;try{for(const k of l)u=k.name,(await ie(s,k.name,k.subGraph?{subGraphName:k.subGraph}:{})).promotedCount===0&&(n+=1);const o=l.length-n,f=n>0?` (${n} already shared or still committing)`:"";C({message:o>0?`Shared ${o} complete Knowledge Asset${o===1?"":"s"} to Shared Working Memory${f}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:o>0?"success":"noop"}),d(),c()}catch(o){const f=re(u??"selected assertion",o);w(f?{message:f.message,kind:"not-persisted"}:{message:(o==null?void 0:o.message)??"Promote failed",kind:"other"})}finally{p(null)}},[l,s,d,c]);return g?e.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):l!=null&&l.length?e.jsxs("div",{className:"v10-assertion-list",children:[e.jsxs("div",{className:"v10-assertion-list-header",children:[e.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",l.length,")"]}),e.jsx("button",{className:"v10-btn-promote-all",disabled:r!==null,onClick:S,children:r==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),e.jsx("div",{className:"v10-assertion-items",children:l.map(n=>e.jsxs("div",{className:"v10-assertion-item",children:[e.jsxs("div",{className:"v10-assertion-item-info",children:[e.jsx("button",{className:"v10-assertion-item-name clickable",title:n.graphUri,onClick:()=>x({name:n.name,subGraph:n.subGraph}),children:n.name}),n.tripleCount!=null&&e.jsxs("span",{className:"v10-assertion-item-count",children:[n.tripleCount," triples"]}),n.subGraph&&e.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${n.subGraph}`,children:["› ",he(n.subGraph,18)]})]}),e.jsx("button",{className:"v10-btn-promote",disabled:r!==null,onClick:()=>v(n),title:"Share this complete Knowledge Asset to Shared Working Memory",children:r===n.graphUri?"Promoting...":"→ SWM"})]},n.graphUri))}),N&&e.jsx("div",{className:N.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:N.message}),m&&e.jsx("div",{className:"v10-promote-result error",children:m.message}),y&&e.jsx(ke,{open:!0,onClose:()=>x(null),assertionName:y.name,subGraphName:y.subGraph,contextGraphId:s})]}):null}function _e({contextGraphId:s,onPublished:c}){const{data:l,loading:g,refresh:d}=D(()=>de(s,"swm"),[s],0);B(s,d,{layers:["swm"]});const[r,p]=i.useState(new Set),[N,C]=i.useState(!1),[m,w]=i.useState(null),[y,x]=i.useState(null),v=(l==null?void 0:l.map(t=>t.graphUri))??[],S=v.length>0&&v.every(t=>r.has(t)),n=i.useCallback(t=>{p(h=>{const L=new Set(h);return L.has(t)?L.delete(t):L.add(t),L})},[]),u=i.useCallback(()=>{p(S?new Set:new Set(v))},[S,v]),o=i.useCallback(async t=>{if(t.length!==0){C(!0),w(null),x(null);try{w(await fe(s,t)),p(new Set),d(),c()}catch(h){x((h==null?void 0:h.message)??"Publish failed")}finally{C(!1)}}},[s,d,c]),f=i.useCallback(()=>{const t=(l??[]).filter(h=>r.has(h.graphUri));return o(t)},[l,r,o]),k=i.useCallback(()=>o(l??[]),[l,o]),b=(l==null?void 0:l.reduce((t,h)=>t+(h.tripleCount??0),0))??0,P=(l==null?void 0:l.filter(t=>r.has(t.graphUri)).reduce((t,h)=>t+(h.tripleCount??0),0))??0,E=!g&&(!l||l.length===0);return g?e.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):E?e.jsxs("div",{className:"v10-publish-panel",children:[e.jsx("div",{className:"v10-publish-panel-header",children:e.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),e.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):e.jsxs("div",{className:"v10-publish-panel",children:[e.jsxs("div",{className:"v10-publish-panel-header",children:[e.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",l.length," asset",l.length===1?"":"s"," · ",b," triples)"]}),e.jsxs("div",{className:"v10-publish-panel-header-actions",children:[e.jsx("button",{className:"v10-publish-panel-refresh",onClick:d,title:"Refresh",children:"↻"}),e.jsx("button",{className:"v10-btn-promote-all",disabled:N,onClick:k,children:N&&r.size===0?"Publishing...":"Publish All → VM"})]})]}),e.jsxs("div",{className:"v10-publish-select-bar",children:[e.jsxs("label",{className:"v10-publish-select-all",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:u}),e.jsx("span",{children:"Select all"})]}),r.size>0&&e.jsx("button",{className:"v10-btn-publish",disabled:N,onClick:f,children:N?"Publishing...":`Publish ${r.size} selected (${P} triples) → VM`})]}),e.jsx("div",{className:"v10-assertion-items",children:l.map(t=>e.jsxs("div",{className:`v10-assertion-item ${r.has(t.graphUri)?"selected":""}`,children:[e.jsx("label",{className:"v10-publish-entity-check",children:e.jsx("input",{type:"checkbox",checked:r.has(t.graphUri),onChange:()=>n(t.graphUri)})}),e.jsxs("div",{className:"v10-assertion-item-info",children:[e.jsx("span",{className:"v10-assertion-item-name",title:t.graphUri,children:t.name}),t.subGraph&&e.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${t.subGraph}`,children:["› ",he(t.subGraph,18)]}),t.tripleCount!=null&&e.jsxs("span",{className:"v10-assertion-item-count",children:[t.tripleCount," triples"]})]})]},t.graphUri))}),m&&(()=>{const{published:t,total:h,partial:L,partialError:U,failures:A,sample:j,convictionCostCovered:W}=m,$=t===h&&t>0&&L===0,O=(j==null?void 0:j.status)==="confirmed"&&!!j.txHash;return e.jsxs("div",{className:`v10-publish-result-card ${$?"success":"error"}`,children:[e.jsx("div",{className:"v10-publish-result-title",children:t>0?`Published ${t} of ${h} knowledge asset${h===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),L>0&&e.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",L," asset",L===1?"":"s",": ",je(U)]}),A.length>0&&e.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[A.length," asset",A.length===1?"":"s"," could not be published — ",A[0].name,": ",A[0].error,A.length>1?` (+${A.length-1} more)`:""]}),e.jsxs("div",{className:"v10-publish-result-details",children:[(j==null?void 0:j.kaId)!=null&&e.jsxs("div",{children:[e.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",j.kaId]}),O?e.jsxs("div",{className:"v10-publish-result-tx",children:[e.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",e.jsx("span",{className:"mono",title:j.txHash,children:j.txHash}),j.blockNumber!=null&&e.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",j.blockNumber,")"]})]}):e.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",e.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),e.jsx(Ne,{convictionCostCovered:W})]})]})})(),y&&e.jsx("div",{className:"v10-publish-result-card error",children:y})]})}function _(s){if(s!=null)return typeof s=="string"?s:typeof s=="object"&&"value"in s?String(s.value):String(s)}function Q(s){if(!s)return"—";const c=s.lastIndexOf("#"),l=s.lastIndexOf("/"),g=Math.max(c,l);return g>=0?s.slice(g+1):s}function $e(s){const c=Number.isFinite(s.limit)&&s.limit>0?Math.floor(s.limit):50,l=s.query.trim();if(!l)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${c}`;const g=Ue(l.toLowerCase()),d={subject:`CONTAINS(LCASE(STR(?s)), "${g}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${g}")`,object:`CONTAINS(LCASE(STR(?o)), "${g}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${s.field==="any"?`(${d.subject} || ${d.predicate} || ${d.object})`:d[s.field]}) } LIMIT ${c}`}function Ue(s){return s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}export{Ve as MemoryLayerView,_e as PublishPanel};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DHd3qhAk.js","assets/index-CT-LdpBE.js","assets/index-BLQUVvVz.css","assets/string-DtUow4KV.js","assets/OnChainProvenanceCard-BpUoHg4b.js","assets/useEntityOnChainReceipt-0Ub24t6e.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{bc as i,$ as ve,aj as G,q as oe,bF as be,aO as e,R as K,by as D,O as ge,bE as Q,af as xe,aR as de,bb as fe,b2 as je,f as Ne,ba as ie,F as we,E as re,_ as q,aY as ye}from"./index-CT-LdpBE.js";import{t as he}from"./truncate-BaiMkAOo.js";const Se={"application/pdf":"pdf","application/json":"text","text/plain":"text","text/csv":"text","text/markdown":"markdown","image/png":"image","image/jpeg":"image","image/gif":"image","image/webp":"image"};function ne(s){const c=Se[s];return c?c==="markdown"?"text":c:"binary"}async function ce(s){const c=await fetch(s,{headers:oe()});if(!c.ok)throw new Error(`HTTP ${c.status}`);const l=await c.blob();return URL.createObjectURL(l)}function ke({open:s,onClose:c,assertionName:l,contextGraphId:g,subGraphName:d}){const[r,p]=i.useState(null),[N,C]=i.useState(null),[m,w]=i.useState(null),[y,x]=i.useState(!0),[v,S]=i.useState(null);i.useEffect(()=>{if(s)return x(!0),S(null),p(null),C(null),w(null),ve(l,g,d).then(async b=>{p(b);const P=ne(b.detectedContentType),E=G(b.fileHash,b.detectedContentType);if(P==="text"){const t=await fetch(E,{headers:oe()});t.ok&&C(await t.text())}else if(P==="pdf"||P==="image"){const t=await ce(E);w(t)}}).catch(b=>S(b.message??"Failed to load file info")).finally(()=>x(!1)),()=>{m&&URL.revokeObjectURL(m)}},[s,l,g,d]),i.useEffect(()=>()=>{m&&URL.revokeObjectURL(m)},[m]);const{dialogRef:n,onBackdropClick:u}=be(s,c);if(!s)return null;const o=r?ne(r.detectedContentType):null,f=r?G(r.fileHash,r.detectedContentType):null,k=async(b,P)=>{try{const E=await ce(b),t=document.createElement("a");t.href=E,t.download=P,t.click(),URL.revokeObjectURL(E)}catch{window.open(b,"_blank")}};return e.jsx("div",{className:"v10-modal-overlay",onClick:u,role:"presentation",children:e.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:n,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[e.jsxs("div",{className:"v10-modal-header",children:[e.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:l}),e.jsx("button",{type:"button",className:"v10-modal-close",onClick:c,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),y&&e.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),v&&e.jsxs("div",{className:"v10-file-preview-error",children:[e.jsx("p",{children:v}),e.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),r&&!y&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"v10-file-preview-meta",children:[e.jsx("span",{className:"v10-file-preview-meta-item",children:r.detectedContentType}),e.jsxs("span",{className:"v10-file-preview-meta-item",children:[r.tripleCount," triples extracted"]}),e.jsx("span",{className:"v10-file-preview-meta-item",children:r.pipelineUsed}),r.completedAt&&e.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(r.completedAt).toLocaleString()})]}),e.jsxs("div",{className:"v10-file-preview-content",children:[o==="pdf"&&m&&e.jsx("iframe",{src:m,className:"v10-file-preview-iframe",title:`Preview: ${l}`}),o==="image"&&m&&e.jsx("img",{src:m,alt:l,className:"v10-file-preview-image"}),o==="text"&&N!=null&&e.jsx("pre",{className:"v10-file-preview-text",children:N}),o==="binary"&&e.jsxs("div",{className:"v10-file-preview-binary",children:[e.jsx("p",{children:"This file type cannot be previewed directly."}),f&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(f,l),children:"Download file"})]})]}),e.jsxs("div",{className:"v10-file-preview-footer",children:[f&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(f,l),children:"Download original"}),r.mdIntermediateHash&&e.jsx("button",{className:"v10-file-preview-download",onClick:()=>k(G(r.mdIntermediateHash,"text/markdown"),`${l}.md`),children:"Download markdown intermediate"})]})]})]})})}const Ce=i.lazy(()=>q(()=>import("./index-DHd3qhAk.js").then(s=>s.h),__vite__mapDeps([0,1,2,3])).then(s=>({default:s.RdfGraph}))),Ee=i.lazy(()=>q(()=>import("./index-DHd3qhAk.js").then(s=>s.h),__vite__mapDeps([0,1,2,3])).then(s=>({default:s.NodePanel}))),Le=i.lazy(()=>q(()=>import("./OnChainProvenanceCard-BpUoHg4b.js"),__vite__mapDeps([4,1,2,0,3,5])).then(s=>({default:s.OnChainProvenanceCard}))),Pe={wm:{label:"Working Memory",color:"var(--layer-working)",icon:"◇",description:"Private agent drafts. Fast local storage."},swm:{label:"Shared Working Memory",color:"var(--layer-shared)",icon:"◈",description:"Shared proposals with collaborators. TTL-bounded."},vm:{label:"Verifiable Memory",color:"var(--layer-verified)",icon:"◉",description:"Endorsed, published, on-chain knowledge."}},Ae={labelMode:"humanized",renderer:"2d",labels:ye({extraPredicates:["http://schema.org/text"]}),style:{classColors:{"http://schema.org/Person":"#f472b6","http://schema.org/Organization":"#fb923c","http://schema.org/Place":"#34d399","http://schema.org/Product":"#c084fc","http://schema.org/Event":"#facc15","http://schema.org/CreativeWork":"#7dd3fc","http://schema.org/Thing":"#94a3b8"},defaultNodeColor:"#94a3b8",defaultEdgeColor:"#5f8598",edgeWidth:.9},hexagon:{baseSize:4,minSize:3,maxSize:6,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}},Re=e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),e.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),e.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),Te=e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"6",cy:"6",r:"3"}),e.jsx("circle",{cx:"18",cy:"6",r:"3"}),e.jsx("circle",{cx:"6",cy:"18",r:"3"}),e.jsx("circle",{cx:"18",cy:"18",r:"3"}),e.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),e.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function Ve({layer:s,contextGraphId:c,externalQuery:l,externalQueryKey:g,queryPresetOptions:d}){var le,te;const r=Pe[s],[p,N]=i.useState("graph"),[C,m]=i.useState(""),[w,y]=i.useState(""),[x,v]=i.useState(""),[S,n]=i.useState(""),[u,o]=i.useState("any"),[f,k]=i.useState(50),[b,P]=i.useState(""),[E,t]=i.useState("any"),[h,L]=i.useState(50),[U,A]=i.useState(s!=="vm"),j=K.useRef(s);K.useEffect(()=>{j.current!==s&&(j.current=s,m(""),A(s!=="vm"),y(""),v(""),n(""),o("any"),k(50),P(""),t("any"),L(50))},[s]),K.useEffect(()=>{l!==void 0&&(m(""),y(l),v(l))},[l,g]);const W=i.useMemo(()=>s==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${c}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:s==="vm"?$e({query:b,field:E,limit:h}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[c,s,E,h,b]),$=x||W,O=s==="swm"?"_shared_memory":void 0,Y=s==="swm",J=s==="vm"?"verifiable-memory":void 0,X=s==="wm"&&$===W,{data:T,loading:V,error:Z,refresh:R}=D(()=>ge($,{contextGraphId:c,includeSharedMemory:Y,graphSuffix:O,view:J,includeContextGraphPartitions:X}),[$,c,Y,O,J,X],0);Q(c,R,{layers:[s]});const{data:F}=D(xe,[],3e4),me=F==null?void 0:F.blockExplorerUrl,ee=i.useCallback(()=>{const a=w.trim();if(a===x){R();return}v(a)},[x,w,R]),se=i.useCallback(()=>{const a=S!==b||u!==E||f!==h;if(a&&(P(S),t(u),L(f)),x){v("");return}a||R()},[x,E,h,b,u,f,S,R]),M=((le=T==null?void 0:T.result)==null?void 0:le.bindings)??((te=T==null?void 0:T.results)==null?void 0:te.bindings)??[],I=i.useMemo(()=>M.map(a=>({subject:_(a.s)??"",predicate:_(a.p)??"",object:_(a.o)??""})).filter(a=>a.subject&&a.predicate&&a.object),[M]),ue=i.useCallback(a=>{a!=null&&a.id&&v(`SELECT (<${a.id}> AS ?s) ?p ?o WHERE { <${a.id}> ?p ?o } LIMIT 100`)},[]);return e.jsxs("div",{className:"v10-memory-layer-view",children:[e.jsxs("div",{className:"v10-mlv-header",children:[e.jsx("span",{className:"v10-mlv-icon",style:{color:r.color},children:r.icon}),e.jsxs("div",{children:[e.jsx("h2",{className:"v10-mlv-title",children:r.label}),e.jsx("p",{className:"v10-mlv-desc",children:r.description})]})]}),s==="wm"&&e.jsx(Me,{contextGraphId:c,onPromoted:R}),s==="swm"&&e.jsx(_e,{contextGraphId:c,onPublished:R}),s==="vm"&&e.jsxs("div",{className:"v10-vm-search-panel",children:[e.jsxs("div",{className:"v10-vm-search-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),e.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),e.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>A(a=>!a),children:U?"Hide SPARQL":"Advanced SPARQL"})]}),e.jsxs("div",{className:"v10-vm-search-controls",children:[e.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:S,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&se()}}),e.jsxs("select",{className:"v10-vm-search-select",value:u,onChange:a=>o(a.target.value),children:[e.jsx("option",{value:"any",children:"Any field"}),e.jsx("option",{value:"subject",children:"Subject"}),e.jsx("option",{value:"predicate",children:"Predicate"}),e.jsx("option",{value:"object",children:"Object"})]}),e.jsxs("select",{className:"v10-vm-search-select",value:String(f),onChange:a=>k(Number.parseInt(a.target.value,10)||50),children:[e.jsx("option",{value:"25",children:"25 rows"}),e.jsx("option",{value:"50",children:"50 rows"}),e.jsx("option",{value:"100",children:"100 rows"}),e.jsx("option",{value:"200",children:"200 rows"})]}),e.jsx("button",{className:"v10-mlv-run-btn",onClick:se,children:"Search"})]})]}),(s!=="vm"||U)&&e.jsxs("div",{className:"v10-mlv-query-bar",children:[d!=null&&d.length?e.jsxs("select",{className:"v10-vm-search-select",value:C,onChange:a=>{const H=a.target.value;m(H);const z=d.find(pe=>pe.label===H),ae=(z==null?void 0:z.query)??"";y(ae),v(ae)},children:[e.jsx("option",{value:"",children:"Select common query..."}),d.map(a=>e.jsx("option",{value:a.label,children:a.label},a.label))]}):e.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:w,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Enter"&&ee()}}),e.jsx("button",{className:"v10-mlv-run-btn",onClick:ee,children:"Run"}),x&&e.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>v(""),title:"Reset to full layer overview",children:"Reset"}),e.jsxs("div",{className:"v10-mlv-view-toggle",children:[e.jsx("button",{className:`v10-mlv-toggle-btn ${p==="table"?"active":""}`,onClick:()=>N("table"),title:"Table view",children:Re}),e.jsx("button",{className:`v10-mlv-toggle-btn ${p==="graph"?"active":""}`,onClick:()=>N("graph"),title:"Graph view",children:Te})]})]}),V&&e.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),Z&&e.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",Z]}),!V&&M.length===0&&e.jsxs("div",{className:"v10-mlv-empty",children:[e.jsxs("p",{children:["No triples found in ",r.label.toLowerCase(),"."]}),e.jsxs("p",{style:{fontSize:11,marginTop:4},children:[s==="wm"&&"Import files or chat with your agent to generate working memory.",s==="swm"&&"Promote assertions from working memory to share with collaborators.",s==="vm"&&"Publish shared memory to create verified on-chain knowledge."]})]}),!V&&M.length>0&&p==="table"&&e.jsxs("div",{className:"v10-mlv-table-wrap",children:[e.jsxs("div",{className:"v10-mlv-result-count",children:[M.length," triples"]}),e.jsxs("table",{className:"v10-mlv-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Subject"}),e.jsx("th",{children:"Predicate"}),e.jsx("th",{children:"Object"})]})}),e.jsx("tbody",{children:M.map((a,H)=>e.jsxs("tr",{children:[e.jsx("td",{className:"v10-mlv-cell",children:B(_(a.s))}),e.jsx("td",{className:"v10-mlv-cell",children:B(_(a.p))}),e.jsx("td",{className:"v10-mlv-cell",children:B(_(a.o))})]},H))})]})]}),!V&&I.length>0&&p==="graph"&&e.jsxs("div",{className:"v10-mlv-graph-container",children:[e.jsxs("div",{className:"v10-mlv-graph-info",children:[e.jsxs("span",{children:[I.length," triples"]}),x&&e.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),e.jsx(i.Suspense,{fallback:e.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:e.jsxs(Ce,{data:I,format:"triples",options:Ae,style:{width:"100%",height:"100%"},onNodeClick:ue,initialFit:!0,children:[e.jsx(Ee,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),e.jsx(Le,{contextGraphId:c,layer:s,explorerUrl:me})]})})]})]})}function Me({contextGraphId:s,onPromoted:c}){const{data:l,loading:g,refresh:d}=D(()=>de(s,"wm"),[s],0);Q(s,d,{layers:["wm"]});const[r,p]=i.useState(null),[N,C]=i.useState(null),[m,w]=i.useState(null),[y,x]=i.useState(null),v=i.useCallback(async n=>{p(n.graphUri),C(null),w(null);try{const u=await ie(s,n.name,n.subGraph?{subGraphName:n.subGraph}:{}),o=we(n.name,u);C({message:o.message+(n.subGraph?` (in ${n.subGraph})`:""),kind:o.kind==="success"?"success":"noop",subGraph:n.subGraph}),d(),c()}catch(u){const o=re(n.name,u);w(o?{message:o.message,kind:"not-persisted"}:{message:(u==null?void 0:u.message)??"Promote failed",kind:"other"})}finally{p(null)}},[s,d,c]),S=i.useCallback(async()=>{if(!(l!=null&&l.length))return;p("__all__"),C(null),w(null);let n=0,u=null;try{for(const k of l)u=k.name,(await ie(s,k.name,k.subGraph?{subGraphName:k.subGraph}:{})).promotedCount===0&&(n+=1);const o=l.length-n,f=n>0?` (${n} already shared or still committing)`:"";C({message:o>0?`Shared ${o} complete Knowledge Asset${o===1?"":"s"} to Shared Working Memory${f}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:o>0?"success":"noop"}),d(),c()}catch(o){const f=re(u??"selected assertion",o);w(f?{message:f.message,kind:"not-persisted"}:{message:(o==null?void 0:o.message)??"Promote failed",kind:"other"})}finally{p(null)}},[l,s,d,c]);return g?e.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):l!=null&&l.length?e.jsxs("div",{className:"v10-assertion-list",children:[e.jsxs("div",{className:"v10-assertion-list-header",children:[e.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",l.length,")"]}),e.jsx("button",{className:"v10-btn-promote-all",disabled:r!==null,onClick:S,children:r==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),e.jsx("div",{className:"v10-assertion-items",children:l.map(n=>e.jsxs("div",{className:"v10-assertion-item",children:[e.jsxs("div",{className:"v10-assertion-item-info",children:[e.jsx("button",{className:"v10-assertion-item-name clickable",title:n.graphUri,onClick:()=>x({name:n.name,subGraph:n.subGraph}),children:n.name}),n.tripleCount!=null&&e.jsxs("span",{className:"v10-assertion-item-count",children:[n.tripleCount," triples"]}),n.subGraph&&e.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${n.subGraph}`,children:["› ",he(n.subGraph,18)]})]}),e.jsx("button",{className:"v10-btn-promote",disabled:r!==null,onClick:()=>v(n),title:"Share this complete Knowledge Asset to Shared Working Memory",children:r===n.graphUri?"Promoting...":"→ SWM"})]},n.graphUri))}),N&&e.jsx("div",{className:N.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:N.message}),m&&e.jsx("div",{className:"v10-promote-result error",children:m.message}),y&&e.jsx(ke,{open:!0,onClose:()=>x(null),assertionName:y.name,subGraphName:y.subGraph,contextGraphId:s})]}):null}function _e({contextGraphId:s,onPublished:c}){const{data:l,loading:g,refresh:d}=D(()=>de(s,"swm"),[s],0);Q(s,d,{layers:["swm"]});const[r,p]=i.useState(new Set),[N,C]=i.useState(!1),[m,w]=i.useState(null),[y,x]=i.useState(null),v=(l==null?void 0:l.map(t=>t.graphUri))??[],S=v.length>0&&v.every(t=>r.has(t)),n=i.useCallback(t=>{p(h=>{const L=new Set(h);return L.has(t)?L.delete(t):L.add(t),L})},[]),u=i.useCallback(()=>{p(S?new Set:new Set(v))},[S,v]),o=i.useCallback(async t=>{if(t.length!==0){C(!0),w(null),x(null);try{w(await fe(s,t)),p(new Set),d(),c()}catch(h){x((h==null?void 0:h.message)??"Publish failed")}finally{C(!1)}}},[s,d,c]),f=i.useCallback(()=>{const t=(l??[]).filter(h=>r.has(h.graphUri));return o(t)},[l,r,o]),k=i.useCallback(()=>o(l??[]),[l,o]),b=(l==null?void 0:l.reduce((t,h)=>t+(h.tripleCount??0),0))??0,P=(l==null?void 0:l.filter(t=>r.has(t.graphUri)).reduce((t,h)=>t+(h.tripleCount??0),0))??0,E=!g&&(!l||l.length===0);return g?e.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):E?e.jsxs("div",{className:"v10-publish-panel",children:[e.jsx("div",{className:"v10-publish-panel-header",children:e.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),e.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):e.jsxs("div",{className:"v10-publish-panel",children:[e.jsxs("div",{className:"v10-publish-panel-header",children:[e.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",l.length," asset",l.length===1?"":"s"," · ",b," triples)"]}),e.jsxs("div",{className:"v10-publish-panel-header-actions",children:[e.jsx("button",{className:"v10-publish-panel-refresh",onClick:d,title:"Refresh",children:"↻"}),e.jsx("button",{className:"v10-btn-promote-all",disabled:N,onClick:k,children:N&&r.size===0?"Publishing...":"Publish All → VM"})]})]}),e.jsxs("div",{className:"v10-publish-select-bar",children:[e.jsxs("label",{className:"v10-publish-select-all",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:u}),e.jsx("span",{children:"Select all"})]}),r.size>0&&e.jsx("button",{className:"v10-btn-publish",disabled:N,onClick:f,children:N?"Publishing...":`Publish ${r.size} selected (${P} triples) → VM`})]}),e.jsx("div",{className:"v10-assertion-items",children:l.map(t=>e.jsxs("div",{className:`v10-assertion-item ${r.has(t.graphUri)?"selected":""}`,children:[e.jsx("label",{className:"v10-publish-entity-check",children:e.jsx("input",{type:"checkbox",checked:r.has(t.graphUri),onChange:()=>n(t.graphUri)})}),e.jsxs("div",{className:"v10-assertion-item-info",children:[e.jsx("span",{className:"v10-assertion-item-name",title:t.graphUri,children:t.name}),t.subGraph&&e.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${t.subGraph}`,children:["› ",he(t.subGraph,18)]}),t.tripleCount!=null&&e.jsxs("span",{className:"v10-assertion-item-count",children:[t.tripleCount," triples"]})]})]},t.graphUri))}),m&&(()=>{const{published:t,total:h,partial:L,partialError:U,failures:A,sample:j,convictionCostCovered:W}=m,$=t===h&&t>0&&L===0,O=(j==null?void 0:j.status)==="confirmed"&&!!j.txHash;return e.jsxs("div",{className:`v10-publish-result-card ${$?"success":"error"}`,children:[e.jsx("div",{className:"v10-publish-result-title",children:t>0?`Published ${t} of ${h} knowledge asset${h===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),L>0&&e.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",L," asset",L===1?"":"s",": ",je(U)]}),A.length>0&&e.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[A.length," asset",A.length===1?"":"s"," could not be published — ",A[0].name,": ",A[0].error,A.length>1?` (+${A.length-1} more)`:""]}),e.jsxs("div",{className:"v10-publish-result-details",children:[(j==null?void 0:j.kaId)!=null&&e.jsxs("div",{children:[e.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",j.kaId]}),O?e.jsxs("div",{className:"v10-publish-result-tx",children:[e.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",e.jsx("span",{className:"mono",title:j.txHash,children:j.txHash}),j.blockNumber!=null&&e.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",j.blockNumber,")"]})]}):e.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",e.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),e.jsx(Ne,{convictionCostCovered:W})]})]})})(),y&&e.jsx("div",{className:"v10-publish-result-card error",children:y})]})}function _(s){if(s!=null)return typeof s=="string"?s:typeof s=="object"&&"value"in s?String(s.value):String(s)}function B(s){if(!s)return"—";const c=s.lastIndexOf("#"),l=s.lastIndexOf("/"),g=Math.max(c,l);return g>=0?s.slice(g+1):s}function $e(s){const c=Number.isFinite(s.limit)&&s.limit>0?Math.floor(s.limit):50,l=s.query.trim();if(!l)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${c}`;const g=Ue(l.toLowerCase()),d={subject:`CONTAINS(LCASE(STR(?s)), "${g}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${g}")`,object:`CONTAINS(LCASE(STR(?o)), "${g}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${s.field==="any"?`(${d.subject} || ${d.predicate} || ${d.object})`:d[s.field]}) } LIMIT ${c}`}function Ue(s){return s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}export{Ve as MemoryLayerView,_e as PublishPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bK as u,bz as x,bc as v,aO as e,bD as j,bL as b,bC as y}from"./index-CT-LdpBE.js";import{r as N}from"./useProjectActivity-CLza3psq.js";const k=[{key:"working",title:"Working Memory",short:"WM",icon:"◇",color:"#64748b",desc:"Private agent drafts",tabPrefix:"wm"},{key:"shared",title:"Shared Working Memory",short:"SWM",icon:"◈",color:"#f59e0b",desc:"Team proposals",tabPrefix:"swm"},{key:"verified",title:"Verifiable Memory",short:"VM",icon:"◉",color:"#22c55e",desc:"On-chain knowledge",tabPrefix:"vm"}],f=["http://purl.org/dc/terms/created","http://dkg.io/ontology/github/mergedAt","http://dkg.io/ontology/github/closedAt","http://dkg.io/ontology/decisions/date","http://dkg.io/ontology/tasks/dueDate"];function $(){const{contextGraphs:s}=u(),{hidden:a}=x(),l=v.useMemo(()=>s.filter(t=>!a.has(t.id)),[s,a]);return e.jsxs("div",{className:"v10-memstack",children:[e.jsxs("div",{className:"v10-memstack-head",children:[e.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),e.jsxs("p",{className:"v10-memstack-sub",children:["Every layer across every context graph, at a glance. ",l.length," visible context graph",l.length===1?"":"s"," · hidden context graphs are skipped."]})]}),l.length===0?e.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):e.jsxs("div",{className:"v10-memstack-table",children:[e.jsxs("div",{className:"v10-memstack-colheads",children:[e.jsx("div",{className:"v10-memstack-colhead project"}),k.map(t=>e.jsxs("div",{className:"v10-memstack-colhead",style:{color:t.color},children:[e.jsx("span",{className:"v10-memstack-colhead-icon",children:t.icon}),e.jsx("span",{className:"v10-memstack-colhead-title",children:t.title}),e.jsx("span",{className:"v10-memstack-colhead-desc",children:t.desc})]},t.key))]}),l.map(t=>e.jsx(g,{cg:t},t.id))]})]})}function g({cg:s}){const a=j(s.id),{openTab:l}=b(),t=y(a),r=v.useMemo(()=>{const c={working:{entities:[],tripleCount:t.wm},shared:{entities:[],tripleCount:t.swm},verified:{entities:[],tripleCount:t.vm}};for(const i of a.entityList)c[i.trustLevel].entities.push(i);for(const i of Object.keys(c))c[i].entities.sort((o,n)=>{const d=h(o),p=h(n);return d&&p?p-d:d?-1:p?1:o.label.localeCompare(n.label)});return c},[a.entityList,t]),m=()=>l({id:`project:${s.id}`,label:s.name||s.id.slice(0,16),closable:!0});return e.jsxs("div",{className:"v10-memstack-row",children:[e.jsxs("div",{className:"v10-memstack-project",children:[e.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:m,children:[e.jsx("span",{className:"v10-memstack-project-dot"}),e.jsx("span",{className:"v10-memstack-project-name",children:s.name||s.id})]}),s.description&&e.jsx("div",{className:"v10-memstack-project-desc",title:s.description,children:s.description}),a.loading&&!a.entityList.length&&e.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),a.error&&e.jsx("div",{className:"v10-memstack-project-status error",children:a.error})]}),k.map(c=>{const i=r[c.key];return e.jsx(C,{cgId:s.id,color:c.color,layerTitle:c.title,tabPrefix:c.tabPrefix,entityCount:i.entities.length,tripleCount:i.tripleCount,recent:i.entities.slice(0,4),onOpenLayer:()=>l({id:`${c.tabPrefix}:${s.id}`,label:`${c.short} · ${s.name||s.id.slice(0,12)}`,closable:!0})},c.key)})]})}function C({cgId:s,color:a,layerTitle:l,tabPrefix:t,entityCount:r,tripleCount:m,recent:c,onOpenLayer:i}){const o=r===0;return e.jsxs("div",{className:`v10-memstack-cell${o?" empty":""}`,style:{"--cell-color":a},children:[e.jsxs("div",{className:"v10-memstack-cell-stats",children:[e.jsx("span",{className:"v10-memstack-cell-n",children:r}),e.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",r===1?"y":"ies"]}),e.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),e.jsx("span",{className:"v10-memstack-cell-t",children:m.toLocaleString()}),e.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),c.length>0?e.jsx("ul",{className:"v10-memstack-cell-recent",children:c.map(n=>e.jsxs("li",{className:"v10-memstack-cell-recent-item",title:n.label,children:[e.jsx("span",{className:"v10-memstack-cell-recent-bullet"}),e.jsx("span",{className:"v10-memstack-cell-recent-label",children:n.label}),e.jsx("span",{className:"v10-memstack-cell-recent-time",children:N(w(n))})]},n.uri))}):e.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",t.toUpperCase()," yet"]}),!o&&e.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:i,title:`Open ${l}`,children:["Open ",t.toUpperCase()," →"]})]})}function h(s){var a;for(const l of f){const t=(a=s.properties.get(l))==null?void 0:a[0];if(!t)continue;const r=new Date(t.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(r.getTime()))return r.getTime()}return null}function w(s){const a=h(s);return a?new Date(a):null}export{$ as MemoryStackView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{by as r,aO as e,g as o,bh as d,an as l,V as h,Q as x}from"./index-CT-LdpBE.js";function j({agent:s}){if(s.connectionStatus==="self")return e.jsx("span",{className:"badge",style:{background:"var(--text-muted)"},children:"Self"});if(s.connectionStatus==="connected"){const n=s.connectionTransport==="relayed"?"Relayed":"Direct",i=s.connectedSinceMs?` · ${l(s.connectedSinceMs)}`:"";return e.jsxs("span",{className:"badge badge-success",title:`${s.connectionDirection??""} ${n.toLowerCase()} connection${i}`,children:[n,i]})}return e.jsx("span",{className:"badge",style:{background:"var(--error)"},children:"Disconnected"})}function v(){const{data:s}=r(h,[],1e4),{data:n}=r(x,[],15e3),i=(s==null?void 0:s.connections)??[],a=(n==null?void 0:n.agents)??[];return e.jsxs("div",{children:[e.jsxs(o,{to:"/",className:"page-back-link",style:{display:"inline-flex",alignItems:"center",gap:6,marginBottom:12,fontSize:13,color:"var(--text-secondary)",textDecoration:"none"},children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M19 12H5"}),e.jsx("path",{d:"M12 19l-7-7 7-7"})]}),"Back to dashboard"]}),e.jsx("h1",{className:"page-title",children:"Network"}),e.jsxs("div",{className:"stats-grid",children:[e.jsxs("div",{className:"stat-card",children:[e.jsx("div",{className:"stat-label",children:"Total Connections"}),e.jsx("div",{className:"stat-value",children:(s==null?void 0:s.total)??"—"})]}),e.jsxs("div",{className:"stat-card",children:[e.jsx("div",{className:"stat-label",children:"Direct"}),e.jsx("div",{className:"stat-value",children:(s==null?void 0:s.direct)??"—"})]}),e.jsxs("div",{className:"stat-card",children:[e.jsx("div",{className:"stat-label",children:"Relayed"}),e.jsx("div",{className:"stat-value",children:(s==null?void 0:s.relayed)??"—"})]}),e.jsxs("div",{className:"stat-card",children:[e.jsx("div",{className:"stat-label",children:"Known Agents"}),e.jsx("div",{className:"stat-value",children:a.length})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-title",children:"Active Connections"}),i.length===0?e.jsxs("div",{className:"empty-state empty-state--compact",children:[e.jsx("div",{className:"empty-state-icon",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M5 12h14"}),e.jsx("path",{d:"M12 5l7 7-7 7"})]})}),e.jsx("div",{className:"empty-state-title",children:"No active connections"}),e.jsx("div",{className:"empty-state-desc",children:"Connections will appear here as your node links with peers on the network."})]}):e.jsxs("table",{className:"data-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Peer"}),e.jsx("th",{children:"Transport"}),e.jsx("th",{children:"Direction"}),e.jsx("th",{children:"Remote Address"}),e.jsx("th",{children:"Duration"})]})}),e.jsx("tbody",{children:i.map((t,c)=>e.jsxs("tr",{children:[e.jsx("td",{className:"mono",children:d(t.peerId,12)}),e.jsx("td",{children:e.jsx("span",{className:`badge ${t.transport==="direct"?"badge-success":"badge-info"}`,children:t.transport})}),e.jsx("td",{children:t.direction}),e.jsx("td",{className:"mono",style:{fontSize:11},children:t.remoteAddr}),e.jsx("td",{children:l(t.durationMs)})]},c))})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-title",children:"Discovered Agents"}),a.length===0?e.jsxs("div",{className:"empty-state empty-state--compact",children:[e.jsx("div",{className:"empty-state-icon",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("div",{className:"empty-state-title",children:"No agents discovered"}),e.jsx("div",{className:"empty-state-desc",children:"Agents will be listed here as they are discovered through the network."})]}):e.jsxs("table",{className:"data-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Name"}),e.jsx("th",{children:"PeerId"}),e.jsx("th",{children:"Framework"}),e.jsx("th",{children:"Role"}),e.jsx("th",{children:"Connection"})]})}),e.jsx("tbody",{children:a.map((t,c)=>e.jsxs("tr",{children:[e.jsx("td",{style:{fontWeight:600},children:t.name}),e.jsx("td",{className:"mono",children:d(t.peerId,12)}),e.jsx("td",{children:t.framework??"—"}),e.jsx("td",{children:t.nodeRole??"—"}),e.jsx("td",{children:e.jsx(j,{agent:t})})]},c))})]})]})]})}export{v as NetworkPage};
|
package/dist-ui/assets/{OnChainProvenanceCard-DKyfVEjF.js → OnChainProvenanceCard-BpUoHg4b.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bc as h,aO as e}from"./index-CT-LdpBE.js";import{u as x}from"./index-DHd3qhAk.js";import{u as N,t as r}from"./useEntityOnChainReceipt-0Ub24t6e.js";import"./string-DtUow4KV.js";const b={wm:"This entity lives in Working Memory — a private local draft. It gets an on-chain anchor only after it is promoted and published to Verifiable Memory.",swm:"This entity lives in Shared Working Memory. It is not anchored on-chain until it is published to Verifiable Memory.",vm:"No on-chain receipt found for this entity yet. It may still be settling, or it was read back from a pre-cutover graph."},w=({contextGraphId:t,layer:a,explorerUrl:l})=>{const{selectedNode:n}=x(),[p,d]=h.useState(null),s=(n==null?void 0:n.id)??null;h.useEffect(()=>{d(null)},[s]);const v=!!s&&s!==p,i=N(t,s,v);if(!v||!n)return null;const o=y=>{var m;(m=navigator.clipboard)==null||m.writeText(y).catch(()=>{})},u=n.label||n.id,c=i.status==="verified";return e.jsxs("div",{className:`v10-graph-prov-card${c?" verified":""}`,role:"dialog","aria-label":"On-chain provenance",children:[e.jsxs("div",{className:"v10-graph-prov-head",children:[e.jsx("span",{className:"v10-graph-prov-glyph",children:c?"◉":"◌"}),e.jsx("span",{className:"v10-graph-prov-title",children:"On-chain provenance"}),c&&e.jsx("span",{className:"v10-graph-prov-badge",children:"VERIFIED"}),e.jsx("button",{type:"button",className:"v10-graph-prov-close",onClick:()=>d(s),"aria-label":"Dismiss",title:"Dismiss",children:"×"})]}),e.jsx("div",{className:"v10-graph-prov-entity",title:n.id,children:u}),i.status==="loading"&&e.jsx("div",{className:"v10-graph-prov-muted",children:"Resolving on-chain identity…"}),i.status==="error"&&e.jsx("div",{className:"v10-graph-prov-muted",children:"Couldn’t load on-chain identity."}),i.status==="offchain"&&e.jsxs("div",{className:"v10-graph-prov-offchain",children:[e.jsx("span",{className:"v10-graph-prov-offchain-tag",children:"Off-chain"}),e.jsx("p",{children:b[a??"vm"]})]}),c&&e.jsxs("div",{className:"v10-vm-identity",style:{margin:0,background:"none",border:"none",padding:0},children:[i.ual&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),e.jsx("span",{className:"v10-vm-identity-val mono",title:i.ual,children:i.ual}),e.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>o(i.ual),title:"Copy UAL",children:"⎘"})]}),i.txHash&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),l?e.jsxs("a",{className:"v10-vm-identity-val mono v10-graph-prov-link",href:`${l}/tx/${i.txHash}`,target:"_blank",rel:"noopener noreferrer",title:i.txHash,children:[r(i.txHash,10,8)," ↗"]}):e.jsx("span",{className:"v10-vm-identity-val mono",title:i.txHash,children:r(i.txHash,10,8)}),e.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>o(i.txHash),title:"Copy transaction hash",children:"⎘"})]}),i.blockNumber&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"Block"}),e.jsx("span",{className:"v10-vm-identity-val mono",children:j(i.blockNumber)})]}),i.kaId&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"KA id"}),e.jsx("span",{className:"v10-vm-identity-val mono",title:i.kaId,children:r(i.kaId,8,8)}),e.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>o(i.kaId),title:"Copy KA id",children:"⎘"})]}),i.author&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"Author"}),l?e.jsxs("a",{className:"v10-vm-identity-val mono v10-graph-prov-link",href:`${l}/address/${i.author}`,target:"_blank",rel:"noopener noreferrer",title:i.author,children:[r(i.author,6,4)," ↗"]}):e.jsx("span",{className:"v10-vm-identity-val mono",title:i.author,children:r(i.author,6,4)}),e.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>o(i.author),title:"Copy author address",children:"⎘"})]}),i.finalizedAt&&e.jsxs("div",{className:"v10-vm-identity-row",children:[e.jsx("span",{className:"v10-vm-identity-lbl",children:"Finalized"}),e.jsx("span",{className:"v10-vm-identity-val",children:f(i.finalizedAt)})]})]})]})};function j(t){const a=Number.parseInt(t,10);return Number.isFinite(a)?a.toLocaleString():t}function f(t){const a=new Date(t.replace(/^"|"$/g,""));return Number.isFinite(a.getTime())?a.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):t}export{w as OnChainProvenanceCard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as si,ay as le,ba as $,R as P,k as ne,aN as h,bw as Re,ac as Zx,ab as Jx,a9 as Qx,ad as e1,aa as t1,at as vt,a2 as r1,Z as n1,a0 as i1,a4 as a1,ag as o1,a8 as s1,an as lt,a6 as u1,a5 as c1,af as l1,bf as bi}from"./index-RLb1kuzE.js";import{h as fd,m as dd,o as Lg,d as at,a as f1,e as Gc,c as hd,f as pd,g as d1,b as Pt,i as h1}from"./string-DtUow4KV.js";function qg(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=qg(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function te(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=qg(e))&&(n&&(n+=" "),n+=t);return n}var Xa,vd;function Be(){if(vd)return Xa;vd=1;var e=Array.isArray;return Xa=e,Xa}var Ya,yd;function zg(){if(yd)return Ya;yd=1;var e=typeof si=="object"&&si&&si.Object===Object&&si;return Ya=e,Ya}var Za,md;function ht(){if(md)return Za;md=1;var e=zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Za=r,Za}var Ja,gd;function ei(){if(gd)return Ja;gd=1;var e=ht(),t=e.Symbol;return Ja=t,Ja}var Qa,bd;function p1(){if(bd)return Qa;bd=1;var e=ei(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(s?o[i]=u:delete o[i]),f}return Qa=a,Qa}var eo,xd;function v1(){if(xd)return eo;xd=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return eo=r,eo}var to,wd;function Tt(){if(wd)return to;wd=1;var e=ei(),t=p1(),r=v1(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return to=o,to}var ro,_d;function Et(){if(_d)return ro;_d=1;function e(t){return t!=null&&typeof t=="object"}return ro=e,ro}var no,Od;function Hr(){if(Od)return no;Od=1;var e=Tt(),t=Et(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return no=n,no}var io,Sd;function sf(){if(Sd)return io;Sd=1;var e=Be(),t=Hr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return io=i,io}var ao,jd;function qt(){if(jd)return ao;jd=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return ao=e,ao}var oo,Ad;function uf(){if(Ad)return oo;Ad=1;var e=Tt(),t=qt(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return oo=o,oo}var so,Pd;function y1(){if(Pd)return so;Pd=1;var e=ht(),t=e["__core-js_shared__"];return so=t,so}var uo,Td;function m1(){if(Td)return uo;Td=1;var e=y1(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return uo=r,uo}var co,Ed;function Fg(){if(Ed)return co;Ed=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return co=r,co}var lo,Md;function g1(){if(Md)return lo;Md=1;var e=uf(),t=m1(),r=qt(),n=Fg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,c=s.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(d){if(!r(d)||t(d))return!1;var v=e(d)?f:a;return v.test(n(d))}return lo=l,lo}var fo,Cd;function b1(){if(Cd)return fo;Cd=1;function e(t,r){return t==null?void 0:t[r]}return fo=e,fo}var ho,Id;function lr(){if(Id)return ho;Id=1;var e=g1(),t=b1();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return ho=r,ho}var po,kd;function ya(){if(kd)return po;kd=1;var e=lr(),t=e(Object,"create");return po=t,po}var vo,$d;function x1(){if($d)return vo;$d=1;var e=ya();function t(){this.__data__=e?e(null):{},this.size=0}return vo=t,vo}var yo,Nd;function w1(){if(Nd)return yo;Nd=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return yo=e,yo}var mo,Rd;function _1(){if(Rd)return mo;Rd=1;var e=ya(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return mo=i,mo}var go,Dd;function O1(){if(Dd)return go;Dd=1;var e=ya(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return go=n,go}var bo,Bd;function S1(){if(Bd)return bo;Bd=1;var e=ya(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return bo=r,bo}var xo,Ld;function j1(){if(Ld)return xo;Ld=1;var e=x1(),t=w1(),r=_1(),n=O1(),i=S1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,xo=a,xo}var wo,qd;function A1(){if(qd)return wo;qd=1;function e(){this.__data__=[],this.size=0}return wo=e,wo}var _o,zd;function cf(){if(zd)return _o;zd=1;function e(t,r){return t===r||t!==t&&r!==r}return _o=e,_o}var Oo,Fd;function ma(){if(Fd)return Oo;Fd=1;var e=cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Oo=t,Oo}var So,Wd;function P1(){if(Wd)return So;Wd=1;var e=ma(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return So=n,So}var jo,Ud;function T1(){if(Ud)return jo;Ud=1;var e=ma();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return jo=t,jo}var Ao,Gd;function E1(){if(Gd)return Ao;Gd=1;var e=ma();function t(r){return e(this.__data__,r)>-1}return Ao=t,Ao}var Po,Hd;function M1(){if(Hd)return Po;Hd=1;var e=ma();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Po=t,Po}var To,Kd;function ga(){if(Kd)return To;Kd=1;var e=A1(),t=P1(),r=T1(),n=E1(),i=M1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,To=a,To}var Eo,Vd;function lf(){if(Vd)return Eo;Vd=1;var e=lr(),t=ht(),r=e(t,"Map");return Eo=r,Eo}var Mo,Xd;function C1(){if(Xd)return Mo;Xd=1;var e=j1(),t=ga(),r=lf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Mo=n,Mo}var Co,Yd;function I1(){if(Yd)return Co;Yd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Co=e,Co}var Io,Zd;function ba(){if(Zd)return Io;Zd=1;var e=I1();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Io=t,Io}var ko,Jd;function k1(){if(Jd)return ko;Jd=1;var e=ba();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return ko=t,ko}var $o,Qd;function $1(){if(Qd)return $o;Qd=1;var e=ba();function t(r){return e(this,r).get(r)}return $o=t,$o}var No,eh;function N1(){if(eh)return No;eh=1;var e=ba();function t(r){return e(this,r).has(r)}return No=t,No}var Ro,th;function R1(){if(th)return Ro;th=1;var e=ba();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Ro=t,Ro}var Do,rh;function ff(){if(rh)return Do;rh=1;var e=C1(),t=k1(),r=$1(),n=N1(),i=R1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var Bo,nh;function Wg(){if(nh)return Bo;nh=1;var e=ff(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,o);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Bo=r,Bo}var Lo,ih;function D1(){if(ih)return Lo;ih=1;var e=Wg(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return Lo=r,Lo}var qo,ah;function B1(){if(ah)return qo;ah=1;var e=D1(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,c){a.push(u?c.replace(r,"$1"):s||o)}),a});return qo=n,qo}var zo,oh;function df(){if(oh)return zo;oh=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return zo=e,zo}var Fo,sh;function L1(){if(sh)return Fo;sh=1;var e=ei(),t=df(),r=Be(),n=Hr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Fo=o,Fo}var Wo,uh;function Ug(){if(uh)return Wo;uh=1;var e=L1();function t(r){return r==null?"":e(r)}return Wo=t,Wo}var Uo,ch;function Gg(){if(ch)return Uo;ch=1;var e=Be(),t=sf(),r=B1(),n=Ug();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return Uo=i,Uo}var Go,lh;function xa(){if(lh)return Go;lh=1;var e=Hr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Go=t,Go}var Ho,fh;function hf(){if(fh)return Ho;fh=1;var e=Gg(),t=xa();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return Ho=r,Ho}var Ko,dh;function Hg(){if(dh)return Ko;dh=1;var e=hf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return Ko=t,Ko}var q1=Hg();const Je=le(q1);var Vo,hh;function z1(){if(hh)return Vo;hh=1;function e(t){return t==null}return Vo=e,Vo}var F1=z1();const Q=le(F1);var Xo,ph;function W1(){if(ph)return Xo;ph=1;var e=Tt(),t=Be(),r=Et(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return Xo=i,Xo}var U1=W1();const ar=le(U1);var G1=uf();const Y=le(G1);var H1=qt();const Kr=le(H1);var Yo={exports:{}},ie={};/**
|
|
1
|
+
import{x as si,az as le,bc as $,R as P,k as ne,aO as h,by as Re,ac as Zx,ab as Jx,a9 as Qx,ad as e1,aa as t1,at as vt,a2 as r1,Z as n1,a0 as i1,a4 as a1,ag as o1,a8 as s1,an as lt,a6 as u1,a5 as c1,af as l1,bh as bi}from"./index-CT-LdpBE.js";import{h as fd,m as dd,o as Lg,d as at,a as f1,e as Gc,c as hd,f as pd,g as d1,b as Pt,i as h1}from"./string-DtUow4KV.js";function qg(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(r=qg(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function te(){for(var e,t,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(t=qg(e))&&(n&&(n+=" "),n+=t);return n}var Xa,vd;function Be(){if(vd)return Xa;vd=1;var e=Array.isArray;return Xa=e,Xa}var Ya,yd;function zg(){if(yd)return Ya;yd=1;var e=typeof si=="object"&&si&&si.Object===Object&&si;return Ya=e,Ya}var Za,md;function ht(){if(md)return Za;md=1;var e=zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Za=r,Za}var Ja,gd;function ei(){if(gd)return Ja;gd=1;var e=ht(),t=e.Symbol;return Ja=t,Ja}var Qa,bd;function p1(){if(bd)return Qa;bd=1;var e=ei(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var s=r.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=n.call(o);return c&&(s?o[i]=u:delete o[i]),f}return Qa=a,Qa}var eo,xd;function v1(){if(xd)return eo;xd=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return eo=r,eo}var to,wd;function Tt(){if(wd)return to;wd=1;var e=ei(),t=p1(),r=v1(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(s){return s==null?s===void 0?i:n:a&&a in Object(s)?t(s):r(s)}return to=o,to}var ro,_d;function Et(){if(_d)return ro;_d=1;function e(t){return t!=null&&typeof t=="object"}return ro=e,ro}var no,Od;function Hr(){if(Od)return no;Od=1;var e=Tt(),t=Et(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return no=n,no}var io,Sd;function sf(){if(Sd)return io;Sd=1;var e=Be(),t=Hr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return io=i,io}var ao,jd;function qt(){if(jd)return ao;jd=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return ao=e,ao}var oo,Ad;function uf(){if(Ad)return oo;Ad=1;var e=Tt(),t=qt(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return oo=o,oo}var so,Pd;function y1(){if(Pd)return so;Pd=1;var e=ht(),t=e["__core-js_shared__"];return so=t,so}var uo,Td;function m1(){if(Td)return uo;Td=1;var e=y1(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return uo=r,uo}var co,Ed;function Fg(){if(Ed)return co;Ed=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return co=r,co}var lo,Md;function g1(){if(Md)return lo;Md=1;var e=uf(),t=m1(),r=qt(),n=Fg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,c=s.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(d){if(!r(d)||t(d))return!1;var v=e(d)?f:a;return v.test(n(d))}return lo=l,lo}var fo,Cd;function b1(){if(Cd)return fo;Cd=1;function e(t,r){return t==null?void 0:t[r]}return fo=e,fo}var ho,Id;function lr(){if(Id)return ho;Id=1;var e=g1(),t=b1();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return ho=r,ho}var po,kd;function ya(){if(kd)return po;kd=1;var e=lr(),t=e(Object,"create");return po=t,po}var vo,$d;function x1(){if($d)return vo;$d=1;var e=ya();function t(){this.__data__=e?e(null):{},this.size=0}return vo=t,vo}var yo,Nd;function w1(){if(Nd)return yo;Nd=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return yo=e,yo}var mo,Rd;function _1(){if(Rd)return mo;Rd=1;var e=ya(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return mo=i,mo}var go,Dd;function O1(){if(Dd)return go;Dd=1;var e=ya(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return go=n,go}var bo,Bd;function S1(){if(Bd)return bo;Bd=1;var e=ya(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return bo=r,bo}var xo,Ld;function j1(){if(Ld)return xo;Ld=1;var e=x1(),t=w1(),r=_1(),n=O1(),i=S1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,xo=a,xo}var wo,qd;function A1(){if(qd)return wo;qd=1;function e(){this.__data__=[],this.size=0}return wo=e,wo}var _o,zd;function cf(){if(zd)return _o;zd=1;function e(t,r){return t===r||t!==t&&r!==r}return _o=e,_o}var Oo,Fd;function ma(){if(Fd)return Oo;Fd=1;var e=cf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return Oo=t,Oo}var So,Wd;function P1(){if(Wd)return So;Wd=1;var e=ma(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return So=n,So}var jo,Ud;function T1(){if(Ud)return jo;Ud=1;var e=ma();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return jo=t,jo}var Ao,Gd;function E1(){if(Gd)return Ao;Gd=1;var e=ma();function t(r){return e(this.__data__,r)>-1}return Ao=t,Ao}var Po,Hd;function M1(){if(Hd)return Po;Hd=1;var e=ma();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return Po=t,Po}var To,Kd;function ga(){if(Kd)return To;Kd=1;var e=A1(),t=P1(),r=T1(),n=E1(),i=M1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,To=a,To}var Eo,Vd;function lf(){if(Vd)return Eo;Vd=1;var e=lr(),t=ht(),r=e(t,"Map");return Eo=r,Eo}var Mo,Xd;function C1(){if(Xd)return Mo;Xd=1;var e=j1(),t=ga(),r=lf();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Mo=n,Mo}var Co,Yd;function I1(){if(Yd)return Co;Yd=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Co=e,Co}var Io,Zd;function ba(){if(Zd)return Io;Zd=1;var e=I1();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Io=t,Io}var ko,Jd;function k1(){if(Jd)return ko;Jd=1;var e=ba();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return ko=t,ko}var $o,Qd;function $1(){if(Qd)return $o;Qd=1;var e=ba();function t(r){return e(this,r).get(r)}return $o=t,$o}var No,eh;function N1(){if(eh)return No;eh=1;var e=ba();function t(r){return e(this,r).has(r)}return No=t,No}var Ro,th;function R1(){if(th)return Ro;th=1;var e=ba();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Ro=t,Ro}var Do,rh;function ff(){if(rh)return Do;rh=1;var e=C1(),t=k1(),r=$1(),n=N1(),i=R1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var c=o[s];this.set(c[0],c[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Do=a,Do}var Bo,nh;function Wg(){if(nh)return Bo;nh=1;var e=ff(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var c=n.apply(this,o);return a.cache=u.set(s,c)||u,c};return a.cache=new(r.Cache||e),a}return r.Cache=e,Bo=r,Bo}var Lo,ih;function D1(){if(ih)return Lo;ih=1;var e=Wg(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return Lo=r,Lo}var qo,ah;function B1(){if(ah)return qo;ah=1;var e=D1(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,c){a.push(u?c.replace(r,"$1"):s||o)}),a});return qo=n,qo}var zo,oh;function df(){if(oh)return zo;oh=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return zo=e,zo}var Fo,sh;function L1(){if(sh)return Fo;sh=1;var e=ei(),t=df(),r=Be(),n=Hr(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return Fo=o,Fo}var Wo,uh;function Ug(){if(uh)return Wo;uh=1;var e=L1();function t(r){return r==null?"":e(r)}return Wo=t,Wo}var Uo,ch;function Gg(){if(ch)return Uo;ch=1;var e=Be(),t=sf(),r=B1(),n=Ug();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return Uo=i,Uo}var Go,lh;function xa(){if(lh)return Go;lh=1;var e=Hr();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Go=t,Go}var Ho,fh;function hf(){if(fh)return Ho;fh=1;var e=Gg(),t=xa();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return Ho=r,Ho}var Ko,dh;function Hg(){if(dh)return Ko;dh=1;var e=hf();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return Ko=t,Ko}var q1=Hg();const Je=le(q1);var Vo,hh;function z1(){if(hh)return Vo;hh=1;function e(t){return t==null}return Vo=e,Vo}var F1=z1();const Q=le(F1);var Xo,ph;function W1(){if(ph)return Xo;ph=1;var e=Tt(),t=Be(),r=Et(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return Xo=i,Xo}var U1=W1();const ar=le(U1);var G1=uf();const Y=le(G1);var H1=qt();const Kr=le(H1);var Yo={exports:{}},ie={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|