@origintrail-official/dkg-node-ui 10.0.0 → 10.0.2
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/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/otlp-log-worker.d.ts +127 -0
- package/dist/otlp-log-worker.d.ts.map +1 -0
- package/dist/otlp-log-worker.js +268 -0
- package/dist/otlp-log-worker.js.map +1 -0
- package/dist/telemetry-resource.d.ts +41 -0
- package/dist/telemetry-resource.d.ts.map +1 -0
- package/dist/telemetry-resource.js +31 -0
- package/dist/telemetry-resource.js.map +1 -0
- package/dist/telemetry.d.ts +75 -16
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +152 -29
- package/dist/telemetry.js.map +1 -1
- package/dist-ui/assets/{3d-force-graph-CJApDMaR.js → 3d-force-graph-CcVMtgO4.js} +1 -1
- package/dist-ui/assets/Admin-DNNaF7rz.js +45 -0
- package/dist-ui/assets/{AgentHub-B2hxc5jq.js → AgentHub-eWb_Tns6.js} +1 -1
- package/dist-ui/assets/AgentProfilePage-D2T_V6PG.js +1 -0
- package/dist-ui/assets/Network-C6MDsv2e.js +1 -0
- package/dist-ui/assets/OnChainProvenanceCard-BbrU7jzL.js +1 -0
- package/dist-ui/assets/{Operations-F276JTZb.js → Operations-CCMDENBd.js} +3 -3
- package/dist-ui/assets/Settings-WaFKYtwQ.js +1 -0
- package/dist-ui/assets/ccip-CDdHldzo.js +1 -0
- package/dist-ui/assets/formatTrac-BTy0WudH.js +1 -0
- package/dist-ui/assets/{index--rkHgZxC.js → index-2Gzrk1k3.js} +164 -173
- package/dist-ui/assets/{index-DOgQqEa_.js → index-BrxEjqsW.js} +3 -3
- package/dist-ui/assets/{index-BgRu6zNc.css → index-CmliV5st.css} +1 -1
- package/dist-ui/assets/{index-IQUCPHDs.js → index-W4n8cdTA.js} +11 -11
- package/dist-ui/assets/{jsonld-32FQRO67-C6LUWPog.js → jsonld-32FQRO67-CbN9NJJW.js} +2 -2
- package/dist-ui/assets/{jsonld-RkISz_bF.js → jsonld-DkQdPwg5.js} +1 -1
- package/dist-ui/assets/{renderer-3d-2EVDZII7-DwK8fIlO.js → renderer-3d-2EVDZII7-CTUExXUn.js} +2 -2
- package/dist-ui/index.html +2 -2
- package/package.json +13 -4
- package/dist-ui/assets/AgentProfilePage-CDWiC_8K.js +0 -1
- package/dist-ui/assets/Network-DqdABbM7.js +0 -1
- package/dist-ui/assets/OnChainProvenanceCard-DDG5hBdy.js +0 -1
- package/dist-ui/assets/Settings-CXLPuyz1.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonld-
|
|
2
|
-
import{_ as y}from"./index
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonld-DkQdPwg5.js","assets/index-2Gzrk1k3.js","assets/index-CmliV5st.css","assets/ntriples-ZWBY2WET-DH7OofPp.js","assets/N3Parser-CI_4owEm.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as y}from"./index-2Gzrk1k3.js";async function _(a){const e=typeof a=="string"?JSON.parse(a):a;try{const n=await(await y(()=>import("./jsonld-DkQdPwg5.js").then(r=>r.j),__vite__mapDeps([0,1,2]))).default.toRDF(e,{format:"application/n-quads"}),{parseNQuads:o}=await y(async()=>{const{parseNQuads:r}=await import("./ntriples-ZWBY2WET-DH7OofPp.js");return{parseNQuads:r}},__vite__mapDeps([3,4]));return o(n)}catch{return d(e)}}function d(a){const e=[],p=Array.isArray(a["@graph"])?a["@graph"]:[a];for(const n of p){if(!n||typeof n!="object")continue;const o=n,r=o["@id"]||`_:b${Math.random().toString(36).slice(2,10)}`,f=Array.isArray(o["@type"])?o["@type"]:o["@type"]?[o["@type"]]:[];for(const s of f)e.push({subject:r,predicate:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",object:s});for(const[s,i]of Object.entries(o)){if(s.startsWith("@"))continue;const u=Array.isArray(i)?i:[i];for(const t of u)if(t&&typeof t=="object"&&"@id"in t)e.push({subject:r,predicate:s,object:t["@id"]});else if(t&&typeof t=="object"&&"@value"in t){const c=t;e.push({subject:r,predicate:s,object:c["@value"],datatype:c["@type"],language:c["@language"]})}else(typeof t=="string"||typeof t=="number"||typeof t=="boolean")&&e.push({subject:r,predicate:s,object:String(t)})}}return e}export{_ as parseJsonLd};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{h as rt,U as Kt,V as Wt}from"./index-2Gzrk1k3.js";function Yt(v,s){for(var g=0;g<s.length;g++){const p=s[g];if(typeof p!="string"&&!Array.isArray(p)){for(const A in p)if(A!=="default"&&!(A in v)){const r=Object.getOwnPropertyDescriptor(p,A);r&&Object.defineProperty(v,A,r.get?r:{enumerable:!0,get:()=>p[A]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var pe={},ge,it;function Ce(){return it||(it=1,ge=class Bt{constructor(s,g=new Map,p=0){this.prefix=s,this._existing=g,this.counter=p}clone(){const{prefix:s,_existing:g,counter:p}=this;return new Bt(s,new Map(g),p)}getId(s){const g=s&&this._existing.get(s);if(g)return g;const p=this.prefix+this.counter;return this.counter++,s&&this._existing.set(s,p),p}hasId(s){return this._existing.has(s)}getOldIds(){return[...this._existing.keys()]}}),ge}var ye={},st;function Ct(){return st||(st=1,(function(v,s){if(v.setImmediate)return;var g=1,p={},A=!1,r=v.document,t;function n(k){typeof k!="function"&&(k=new Function(""+k));for(var f=new Array(arguments.length-1),e=0;e<f.length;e++)f[e]=arguments[e+1];var i={callback:k,args:f};return p[g]=i,t(g),g++}function a(k){delete p[k]}function b(k){var f=k.callback,e=k.args;switch(e.length){case 0:f();break;case 1:f(e[0]);break;case 2:f(e[0],e[1]);break;case 3:f(e[0],e[1],e[2]);break;default:f.apply(s,e);break}}function N(k){if(A)setTimeout(N,0,k);else{var f=p[k];if(f){A=!0;try{b(f)}finally{a(k),A=!1}}}}function D(){t=function(k){process.nextTick(function(){N(k)})}}function u(){if(v.postMessage&&!v.importScripts){var k=!0,f=v.onmessage;return v.onmessage=function(){k=!1},v.postMessage("","*"),v.onmessage=f,k}}function l(){var k="setImmediate$"+Math.random()+"$",f=function(e){e.source===v&&typeof e.data=="string"&&e.data.indexOf(k)===0&&N(+e.data.slice(k.length))};v.addEventListener?v.addEventListener("message",f,!1):v.attachEvent("onmessage",f),t=function(e){v.postMessage(k+e,"*")}}function w(){var k=new MessageChannel;k.port1.onmessage=function(f){var e=f.data;N(e)},t=function(f){k.port2.postMessage(f)}}function _(){var k=r.documentElement;t=function(f){var e=r.createElement("script");e.onreadystatechange=function(){N(f),e.onreadystatechange=null,k.removeChild(e),e=null},k.appendChild(e)}}function O(){t=function(k){setTimeout(N,0,k)}}var H=Object.getPrototypeOf&&Object.getPrototypeOf(v);H=H&&H.setTimeout?H:v,{}.toString.call(v.process)==="[object process]"?D():u()?l():v.MessageChannel?w():r&&"onreadystatechange"in r.createElement("script")?_():O(),H.setImmediate=n,H.clearImmediate=a})(typeof self>"u"?typeof rt>"u"?ye:rt:self)),ye}/*!
|
|
2
2
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/var ve,at;function ue(){if(at)return ve;at=1,Ct();const v=self.crypto||self.msCrypto;return ve=class{constructor(g){if(!(v&&v.subtle))throw new Error("crypto.subtle not found.");if(g==="sha256")this.algorithm={name:"SHA-256"};else if(g==="sha1")this.algorithm={name:"SHA-1"};else throw new Error(`Unsupported algorithm "${g}".`);this._content=""}update(g){this._content+=g}async digest(){const g=new TextEncoder().encode(this._content),p=new Uint8Array(await v.subtle.digest(this.algorithm,g));let A="";for(let r=0;r<p.length;++r)A+=p[r].toString(16).padStart(2,"0");return A}},ve}/*!
|
|
4
4
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
package/dist-ui/assets/{renderer-3d-2EVDZII7-DwK8fIlO.js → renderer-3d-2EVDZII7-CTUExXUn.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/3d-force-graph-
|
|
2
|
-
var w=Object.defineProperty;var P=(e,a,i)=>a in e?w(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i;var d=(e,a,i)=>P(e,typeof a!="symbol"?a+"":a,i);import{_ as E}from"./index--rkHgZxC.js";var R=class{constructor(e){d(this,"_container");d(this,"_graph",null);d(this,"_hexPainter");d(this,"_styleEngine");d(this,"_events");d(this,"_currentNodes",new Map);d(this,"_positionCache",new Map);d(this,"_ForceGraph3D",null);d(this,"_THREE",null);d(this,"_textureCache",new Map);d(this,"_textureLoader",null);d(this,"_labelSprites",new Map);d(this,"_labelTimer",null);d(this,"_driftTimer",null);d(this,"_labelFraction",.08);d(this,"_labelMaxDistSq",62500);d(this,"_labelBaseScale",.06);d(this,"_riskPulseEnabled",!1);d(this,"_hoverTraceEnabled",!1);d(this,"_hoveredNodeId",null);d(this,"_fadeInEnabled",!1);d(this,"_loadTime",0);d(this,"_animTime",0);d(this,"_pulseTimer",null);this._container=e.container,this._hexPainter=e.hexPainter,this._styleEngine=e.styleEngine,this._events=e.events}async init(){if(this._graph)return;const[e,a]=await Promise.all([E(()=>import("./3d-force-graph-CJApDMaR.js"),__vite__mapDeps([0,1,2,3,4,5])),E(()=>import("./three.module-BXIk8GZS.js").then(s=>s.da),[])]);this._ForceGraph3D=e.default??e,this._THREE=a,this._textureLoader=new a.TextureLoader;const i=this._container.clientWidth||this._container.offsetWidth||800,n=this._container.clientHeight||this._container.offsetHeight||600;this._graph=this._ForceGraph3D()(this._container).width(i).height(n).backgroundColor("#0a0a0f").nodeColor(s=>{const r=s;return r._graphNode?r._graphNode.isHighRisk?"#e04040":this._styleEngine.getNodeColor(r._graphNode):"#334"}).nodeVal(s=>{const r=s;if(!r._graphNode)return 1;const t=this._hexPainter.getRadius(r._graphNode);let c=t*t*t*.05;if(this._riskPulseEnabled&&r._graphNode.isHighRisk){const o=C(r._graphNode.id),_=1+.25*Math.sin(this._animTime*2+o);c*=_}return c}).nodeOpacity(.85).nodeResolution(6).nodeThreeObject(s=>{var t;const r=s;if((t=r._graphNode)!=null&&t.imageUrl)return this._createIconSprite(r._graphNode)}).nodeThreeObjectExtend(!1).linkColor("#1a1a3a").linkWidth(0).linkOpacity(.15).onNodeClick(s=>{const r=s;r._graphNode&&this._events.emit("node:click",r._graphNode)}).onNodeDrag(s=>{try{this._graph.d3ReheatSimulation()}catch{}}).onNodeDragEnd(s=>{try{this._graph.d3ReheatSimulation()}catch{}}).onNodeHover(s=>{const r=s;r!=null&&r._graphNode?(this._hoveredNodeId=r._graphNode.id,this._events.emit("node:hover",r._graphNode),this._container.style.cursor="pointer"):(this._hoveredNodeId=null,this._events.emit("node:unhover",null),this._container.style.cursor="default")}).onLinkClick(s=>{const r=s;r._graphEdge&&this._events.emit("edge:click",r._graphEdge)}).onBackgroundClick(()=>{this._events.emit("background:click",{x:0,y:0})}).cooldownTicks(80).d3AlphaDecay(.05).d3VelocityDecay(.5).warmupTicks(30),this._labelTimer=setInterval(()=>this._updateProximityLabels(),500)}render(e,a,i){if(!this._graph){this.init().then(()=>this.render(e,a,i));return}if(this._loadTime===0&&(this._loadTime=performance.now(),this._fadeInEnabled)){this._graph.nodeOpacity(.05);const o=()=>{const _=performance.now()-this._loadTime;if(_<1500){const l=_/1500,h=1-Math.pow(1-l,3);this._graph.nodeOpacity(h*.85),requestAnimationFrame(o)}else this._graph.nodeOpacity(.85)};requestAnimationFrame(o)}let n=1;for(const o of e.values())o.degree>n&&(n=o.degree);this._hexPainter.setMaxDegree(n);const s=new Map;for(const[o,_]of e){if(i!=null&&i.has(o))continue;const l=this._currentNodes.get(o),h=this._positionCache.get(o);s.set(o,{id:o,x:(l==null?void 0:l.x)??(h==null?void 0:h.x)??(Math.random()-.5)*300,y:(l==null?void 0:l.y)??(h==null?void 0:h.y)??(Math.random()-.5)*300,vx:(l==null?void 0:l.vx)??(h==null?void 0:h.vx),vy:(l==null?void 0:l.vy)??(h==null?void 0:h.vy),fx:typeof(l==null?void 0:l.fx)=="number"?l.fx:typeof(h==null?void 0:h.fx)=="number"?h.fx:void 0,fy:typeof(l==null?void 0:l.fy)=="number"?l.fy:typeof(h==null?void 0:h.fy)=="number"?h.fy:void 0,_graphNode:_})}const r=new Set(s.keys()),t=[];for(const o of a.values())i!=null&&i.has(o.source)||i!=null&&i.has(o.target)||!r.has(o.source)||!r.has(o.target)||t.push({source:o.source,target:o.target,_graphEdge:o});this._currentNodes=s;const c=new Map;for(const[o,_]of s)c.set(o,{x:_.x,y:_.y,vx:_.vx,vy:_.vy,fx:typeof _.fx=="number"?_.fx:void 0,fy:typeof _.fy=="number"?_.fy:void 0});this._positionCache=c,this._labelSprites.clear(),this._graph.graphData({nodes:[...s.values()],links:t})}centerOnNode(e,a=350,i){const n=this._currentNodes.get(e);if(n&&this._graph){const s={x:n.x??0,y:n.y??0,z:0},r=i!=null&&Number.isFinite(i)&&i>0?i:1,t=Math.max(60,200/r);this._graph.cameraPosition({x:s.x,y:s.y,z:t},s,a)}}zoomToFit(e=40,a=500){var i;(i=this._graph)==null||i.zoomToFit(a,e)}getCanvas(){return this._graph?this._container.querySelector("canvas")??null:null}refresh(){if(!this._graph)return;const e=this._graph.refresh;typeof e=="function"&&e.call(this._graph)}resize(){this._graph&&(this._graph.width(this._container.clientWidth),this._graph.height(this._container.clientHeight))}destroy(){var e,a;this._labelTimer&&(clearInterval(this._labelTimer),this._labelTimer=null),this._driftTimer&&(clearInterval(this._driftTimer),this._driftTimer=null),this._pulseTimer&&(clearInterval(this._pulseTimer),this._pulseTimer=null),this._graph&&((a=(e=this._graph)._destructor)==null||a.call(e),this._graph=null),this._currentNodes.clear(),this._positionCache.clear(),this._labelSprites.clear(),this._textureCache.clear()}_createIconSprite(e){const a=this._THREE;if(!a||!e.imageUrl)return;const i=this._hexPainter.getRadius(e),n=Math.max(i*2.5,6),s=e.imageUrl;if(s.startsWith("data:image/svg+xml"))return this._createSvgSprite(s,n,e);let r=this._textureCache.get(s);r||(r=this._textureLoader.load(s),r.colorSpace=a.SRGBColorSpace,this._textureCache.set(s,r));const t=new a.SpriteMaterial({map:r,transparent:!0,opacity:.9}),c=new a.Sprite(t);return c.scale.set(n,n,1),c}_createSvgSprite(e,a,i){const n=this._THREE;let s=this._textureCache.get(e);if(s){const y=new n.SpriteMaterial({map:s,transparent:!0}),T=new n.Sprite(y);return T.scale.set(a,a,1),T}const r=document.createElement("canvas"),t=64;r.width=t,r.height=t;const c=r.getContext("2d"),o=this._styleEngine.getNodeColor(i);c.beginPath(),c.arc(t/2,t/2,t/2-2,0,Math.PI*2),c.fillStyle=o,c.fill();const _=new Image;_.onload=()=>{const y=t*.2;c.drawImage(_,y,y,t-y*2,t-y*2),s.needsUpdate=!0},_.src=e,s=new n.CanvasTexture(r),this._textureCache.set(e,s);const l=new n.SpriteMaterial({map:s,transparent:!0}),h=new n.Sprite(l);return h.scale.set(a,a,1),h}_updateProximityLabels(){var o,_,l,h,y,T;const e=this._THREE;if(!this._graph||!e)return;const a=this._graph.camera();if(!a)return;const i=a.position,n=this._currentNodes.size;if(n===0)return;const s=Math.max(3,Math.ceil(n*this._labelFraction)),r=[];for(const[f,u]of this._currentNodes){if(!((o=u._graphNode)!=null&&o.label)||u._graphNode.label===u._graphNode.id)continue;const p=i.x-(u.x??0),v=i.y-(u.y??0),x=i.z-(u.z??0),g=p*p+v*v+x*x;g>this._labelMaxDistSq||r.push({id:f,distSq:g})}r.sort((f,u)=>f.distSq-u.distSq);const t=new Map;for(const f of r.slice(0,s))t.set(f.id,f.distSq);const c=this._labelMaxDistSq*4;for(const[f,u]of this._currentNodes){const p=u._graphNode;if(!(p!=null&&p.label)||p.label===p.id||!(p.sizeMultiplier&&p.sizeMultiplier>1)&&!p.isHighRisk)continue;const v=i.x-(u.x??0),x=i.y-(u.y??0),g=i.z-(u.z??0),b=v*v+x*x+g*g;b<=c&&t.set(f,b)}for(const[f,u]of this._labelSprites)t.has(f)||((_=u.parent)==null||_.remove(u),(l=u.material.map)==null||l.dispose(),u.material.dispose(),this._labelSprites.delete(f));for(const[f,u]of t){const p=this._currentNodes.get(f);if(!((h=p==null?void 0:p._graphNode)!=null&&h.label))continue;const v=this._hexPainter.getRadius(p._graphNode),x=Math.sqrt(u),g=Math.max(.3,Math.min(1,120/Math.max(x,1))),b=this._labelSprites.get(f);if(b){const k=((y=b.userData)==null?void 0:y.baseW)??1,N=((T=b.userData)==null?void 0:T.baseH)??1;b.scale.set(k*g,N*g,1),b.material.opacity=.3+g*.6;continue}const m=this._createLabelSprite(p._graphNode.label);if(!m)continue;m.userData={baseW:m.scale.x,baseH:m.scale.y},m.scale.set(m.scale.x*g,m.scale.y*g,1),m.material.opacity=.3+g*.6;const S=p.__threeObj;S&&(m.position.set(0,-v-2,0),S.add(m),this._labelSprites.set(f,m))}}_createLabelSprite(e){const a=this._THREE;if(!a)return null;const i=document.createElement("canvas"),n=i.getContext("2d");if(!n)return null;const s=28,r=e.length>22?e.slice(0,21)+"…":e;n.font=`500 ${s}px system-ui, -apple-system, sans-serif`;const t=n.measureText(r).width;i.width=t+12,i.height=s+8,n.fillStyle="rgba(10, 10, 20, 0.6)",n.beginPath(),n.roundRect(0,0,i.width,i.height,4),n.fill(),n.font=`500 ${s}px system-ui, -apple-system, sans-serif`,n.fillStyle="#d0d4dc",n.textAlign="center",n.textBaseline="middle",n.fillText(r,i.width/2,i.height/2);const c=new a.CanvasTexture(i),o=new a.SpriteMaterial({map:c,transparent:!0,opacity:.8,depthTest:!1}),_=new a.Sprite(o);return _.scale.set(i.width*this._labelBaseScale,i.height*this._labelBaseScale,1),_}applyAnimation(e){if(!this._graph)return;this._riskPulseEnabled=e.riskPulse??!1,this._hoverTraceEnabled=e.hoverTrace??!1,this._fadeInEnabled=e.fadeIn??!1,this._pulseTimer&&(clearInterval(this._pulseTimer),this._pulseTimer=null),this._riskPulseEnabled&&(this._pulseTimer=setInterval(()=>{this._animTime+=.05,this._graph&&this._graph.nodeVal(this._graph.nodeVal())},50));const a=e.linkParticleSpeed??.003,i=e.linkParticleColor??"rgba(100,150,255,0.6)",n=e.linkParticleWidth??.8;if(e.linkParticles||e.hoverTrace)try{const s=e.linkParticleCount??1;this._hoverTraceEnabled?this._graph.linkDirectionalParticles(r=>{if(!this._hoveredNodeId)return e.linkParticles?s:0;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?4:e.linkParticles?s:0}).linkDirectionalParticleSpeed(r=>{if(!this._hoveredNodeId)return a;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?.015:a}).linkDirectionalParticleWidth(r=>{if(!this._hoveredNodeId)return n;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?2:n}).linkDirectionalParticleColor(r=>{if(!this._hoveredNodeId)return i;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?"#60a0ff":i}):this._graph.linkDirectionalParticles(s).linkDirectionalParticleSpeed(a).linkDirectionalParticleWidth(n).linkDirectionalParticleColor(()=>i)}catch{}else try{this._graph.linkDirectionalParticles(0)}catch{}if(this._driftTimer&&(clearInterval(this._driftTimer),this._driftTimer=null),e.drift){this._graph.d3AlphaDecay(.005),this._driftTimer=setInterval(()=>{if(this._graph)try{this._graph.d3ReheatSimulation()}catch{}},8e3);try{this._graph.d3ReheatSimulation()}catch{}}else this._graph.d3AlphaDecay(.05)}applyPalette(e){this._graph&&this._graph.backgroundColor(e.background)}};function C(e){let a=0;for(let i=0;i<e.length;i++)a=(a<<5)-a+e.charCodeAt(i)|0;return a}export{R as WebGL3DRenderer};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/3d-force-graph-CcVMtgO4.js","assets/three.module-BXIk8GZS.js","assets/index-2Gzrk1k3.js","assets/index-CmliV5st.css","assets/index-BrxEjqsW.js","assets/ordinal-DhEzRPdO.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var w=Object.defineProperty;var P=(e,a,i)=>a in e?w(e,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[a]=i;var d=(e,a,i)=>P(e,typeof a!="symbol"?a+"":a,i);import{_ as E}from"./index-2Gzrk1k3.js";var R=class{constructor(e){d(this,"_container");d(this,"_graph",null);d(this,"_hexPainter");d(this,"_styleEngine");d(this,"_events");d(this,"_currentNodes",new Map);d(this,"_positionCache",new Map);d(this,"_ForceGraph3D",null);d(this,"_THREE",null);d(this,"_textureCache",new Map);d(this,"_textureLoader",null);d(this,"_labelSprites",new Map);d(this,"_labelTimer",null);d(this,"_driftTimer",null);d(this,"_labelFraction",.08);d(this,"_labelMaxDistSq",62500);d(this,"_labelBaseScale",.06);d(this,"_riskPulseEnabled",!1);d(this,"_hoverTraceEnabled",!1);d(this,"_hoveredNodeId",null);d(this,"_fadeInEnabled",!1);d(this,"_loadTime",0);d(this,"_animTime",0);d(this,"_pulseTimer",null);this._container=e.container,this._hexPainter=e.hexPainter,this._styleEngine=e.styleEngine,this._events=e.events}async init(){if(this._graph)return;const[e,a]=await Promise.all([E(()=>import("./3d-force-graph-CcVMtgO4.js"),__vite__mapDeps([0,1,2,3,4,5])),E(()=>import("./three.module-BXIk8GZS.js").then(s=>s.da),[])]);this._ForceGraph3D=e.default??e,this._THREE=a,this._textureLoader=new a.TextureLoader;const i=this._container.clientWidth||this._container.offsetWidth||800,n=this._container.clientHeight||this._container.offsetHeight||600;this._graph=this._ForceGraph3D()(this._container).width(i).height(n).backgroundColor("#0a0a0f").nodeColor(s=>{const r=s;return r._graphNode?r._graphNode.isHighRisk?"#e04040":this._styleEngine.getNodeColor(r._graphNode):"#334"}).nodeVal(s=>{const r=s;if(!r._graphNode)return 1;const t=this._hexPainter.getRadius(r._graphNode);let c=t*t*t*.05;if(this._riskPulseEnabled&&r._graphNode.isHighRisk){const o=C(r._graphNode.id),_=1+.25*Math.sin(this._animTime*2+o);c*=_}return c}).nodeOpacity(.85).nodeResolution(6).nodeThreeObject(s=>{var t;const r=s;if((t=r._graphNode)!=null&&t.imageUrl)return this._createIconSprite(r._graphNode)}).nodeThreeObjectExtend(!1).linkColor("#1a1a3a").linkWidth(0).linkOpacity(.15).onNodeClick(s=>{const r=s;r._graphNode&&this._events.emit("node:click",r._graphNode)}).onNodeDrag(s=>{try{this._graph.d3ReheatSimulation()}catch{}}).onNodeDragEnd(s=>{try{this._graph.d3ReheatSimulation()}catch{}}).onNodeHover(s=>{const r=s;r!=null&&r._graphNode?(this._hoveredNodeId=r._graphNode.id,this._events.emit("node:hover",r._graphNode),this._container.style.cursor="pointer"):(this._hoveredNodeId=null,this._events.emit("node:unhover",null),this._container.style.cursor="default")}).onLinkClick(s=>{const r=s;r._graphEdge&&this._events.emit("edge:click",r._graphEdge)}).onBackgroundClick(()=>{this._events.emit("background:click",{x:0,y:0})}).cooldownTicks(80).d3AlphaDecay(.05).d3VelocityDecay(.5).warmupTicks(30),this._labelTimer=setInterval(()=>this._updateProximityLabels(),500)}render(e,a,i){if(!this._graph){this.init().then(()=>this.render(e,a,i));return}if(this._loadTime===0&&(this._loadTime=performance.now(),this._fadeInEnabled)){this._graph.nodeOpacity(.05);const o=()=>{const _=performance.now()-this._loadTime;if(_<1500){const l=_/1500,h=1-Math.pow(1-l,3);this._graph.nodeOpacity(h*.85),requestAnimationFrame(o)}else this._graph.nodeOpacity(.85)};requestAnimationFrame(o)}let n=1;for(const o of e.values())o.degree>n&&(n=o.degree);this._hexPainter.setMaxDegree(n);const s=new Map;for(const[o,_]of e){if(i!=null&&i.has(o))continue;const l=this._currentNodes.get(o),h=this._positionCache.get(o);s.set(o,{id:o,x:(l==null?void 0:l.x)??(h==null?void 0:h.x)??(Math.random()-.5)*300,y:(l==null?void 0:l.y)??(h==null?void 0:h.y)??(Math.random()-.5)*300,vx:(l==null?void 0:l.vx)??(h==null?void 0:h.vx),vy:(l==null?void 0:l.vy)??(h==null?void 0:h.vy),fx:typeof(l==null?void 0:l.fx)=="number"?l.fx:typeof(h==null?void 0:h.fx)=="number"?h.fx:void 0,fy:typeof(l==null?void 0:l.fy)=="number"?l.fy:typeof(h==null?void 0:h.fy)=="number"?h.fy:void 0,_graphNode:_})}const r=new Set(s.keys()),t=[];for(const o of a.values())i!=null&&i.has(o.source)||i!=null&&i.has(o.target)||!r.has(o.source)||!r.has(o.target)||t.push({source:o.source,target:o.target,_graphEdge:o});this._currentNodes=s;const c=new Map;for(const[o,_]of s)c.set(o,{x:_.x,y:_.y,vx:_.vx,vy:_.vy,fx:typeof _.fx=="number"?_.fx:void 0,fy:typeof _.fy=="number"?_.fy:void 0});this._positionCache=c,this._labelSprites.clear(),this._graph.graphData({nodes:[...s.values()],links:t})}centerOnNode(e,a=350,i){const n=this._currentNodes.get(e);if(n&&this._graph){const s={x:n.x??0,y:n.y??0,z:0},r=i!=null&&Number.isFinite(i)&&i>0?i:1,t=Math.max(60,200/r);this._graph.cameraPosition({x:s.x,y:s.y,z:t},s,a)}}zoomToFit(e=40,a=500){var i;(i=this._graph)==null||i.zoomToFit(a,e)}getCanvas(){return this._graph?this._container.querySelector("canvas")??null:null}refresh(){if(!this._graph)return;const e=this._graph.refresh;typeof e=="function"&&e.call(this._graph)}resize(){this._graph&&(this._graph.width(this._container.clientWidth),this._graph.height(this._container.clientHeight))}destroy(){var e,a;this._labelTimer&&(clearInterval(this._labelTimer),this._labelTimer=null),this._driftTimer&&(clearInterval(this._driftTimer),this._driftTimer=null),this._pulseTimer&&(clearInterval(this._pulseTimer),this._pulseTimer=null),this._graph&&((a=(e=this._graph)._destructor)==null||a.call(e),this._graph=null),this._currentNodes.clear(),this._positionCache.clear(),this._labelSprites.clear(),this._textureCache.clear()}_createIconSprite(e){const a=this._THREE;if(!a||!e.imageUrl)return;const i=this._hexPainter.getRadius(e),n=Math.max(i*2.5,6),s=e.imageUrl;if(s.startsWith("data:image/svg+xml"))return this._createSvgSprite(s,n,e);let r=this._textureCache.get(s);r||(r=this._textureLoader.load(s),r.colorSpace=a.SRGBColorSpace,this._textureCache.set(s,r));const t=new a.SpriteMaterial({map:r,transparent:!0,opacity:.9}),c=new a.Sprite(t);return c.scale.set(n,n,1),c}_createSvgSprite(e,a,i){const n=this._THREE;let s=this._textureCache.get(e);if(s){const y=new n.SpriteMaterial({map:s,transparent:!0}),T=new n.Sprite(y);return T.scale.set(a,a,1),T}const r=document.createElement("canvas"),t=64;r.width=t,r.height=t;const c=r.getContext("2d"),o=this._styleEngine.getNodeColor(i);c.beginPath(),c.arc(t/2,t/2,t/2-2,0,Math.PI*2),c.fillStyle=o,c.fill();const _=new Image;_.onload=()=>{const y=t*.2;c.drawImage(_,y,y,t-y*2,t-y*2),s.needsUpdate=!0},_.src=e,s=new n.CanvasTexture(r),this._textureCache.set(e,s);const l=new n.SpriteMaterial({map:s,transparent:!0}),h=new n.Sprite(l);return h.scale.set(a,a,1),h}_updateProximityLabels(){var o,_,l,h,y,T;const e=this._THREE;if(!this._graph||!e)return;const a=this._graph.camera();if(!a)return;const i=a.position,n=this._currentNodes.size;if(n===0)return;const s=Math.max(3,Math.ceil(n*this._labelFraction)),r=[];for(const[f,u]of this._currentNodes){if(!((o=u._graphNode)!=null&&o.label)||u._graphNode.label===u._graphNode.id)continue;const p=i.x-(u.x??0),v=i.y-(u.y??0),x=i.z-(u.z??0),g=p*p+v*v+x*x;g>this._labelMaxDistSq||r.push({id:f,distSq:g})}r.sort((f,u)=>f.distSq-u.distSq);const t=new Map;for(const f of r.slice(0,s))t.set(f.id,f.distSq);const c=this._labelMaxDistSq*4;for(const[f,u]of this._currentNodes){const p=u._graphNode;if(!(p!=null&&p.label)||p.label===p.id||!(p.sizeMultiplier&&p.sizeMultiplier>1)&&!p.isHighRisk)continue;const v=i.x-(u.x??0),x=i.y-(u.y??0),g=i.z-(u.z??0),b=v*v+x*x+g*g;b<=c&&t.set(f,b)}for(const[f,u]of this._labelSprites)t.has(f)||((_=u.parent)==null||_.remove(u),(l=u.material.map)==null||l.dispose(),u.material.dispose(),this._labelSprites.delete(f));for(const[f,u]of t){const p=this._currentNodes.get(f);if(!((h=p==null?void 0:p._graphNode)!=null&&h.label))continue;const v=this._hexPainter.getRadius(p._graphNode),x=Math.sqrt(u),g=Math.max(.3,Math.min(1,120/Math.max(x,1))),b=this._labelSprites.get(f);if(b){const k=((y=b.userData)==null?void 0:y.baseW)??1,N=((T=b.userData)==null?void 0:T.baseH)??1;b.scale.set(k*g,N*g,1),b.material.opacity=.3+g*.6;continue}const m=this._createLabelSprite(p._graphNode.label);if(!m)continue;m.userData={baseW:m.scale.x,baseH:m.scale.y},m.scale.set(m.scale.x*g,m.scale.y*g,1),m.material.opacity=.3+g*.6;const S=p.__threeObj;S&&(m.position.set(0,-v-2,0),S.add(m),this._labelSprites.set(f,m))}}_createLabelSprite(e){const a=this._THREE;if(!a)return null;const i=document.createElement("canvas"),n=i.getContext("2d");if(!n)return null;const s=28,r=e.length>22?e.slice(0,21)+"…":e;n.font=`500 ${s}px system-ui, -apple-system, sans-serif`;const t=n.measureText(r).width;i.width=t+12,i.height=s+8,n.fillStyle="rgba(10, 10, 20, 0.6)",n.beginPath(),n.roundRect(0,0,i.width,i.height,4),n.fill(),n.font=`500 ${s}px system-ui, -apple-system, sans-serif`,n.fillStyle="#d0d4dc",n.textAlign="center",n.textBaseline="middle",n.fillText(r,i.width/2,i.height/2);const c=new a.CanvasTexture(i),o=new a.SpriteMaterial({map:c,transparent:!0,opacity:.8,depthTest:!1}),_=new a.Sprite(o);return _.scale.set(i.width*this._labelBaseScale,i.height*this._labelBaseScale,1),_}applyAnimation(e){if(!this._graph)return;this._riskPulseEnabled=e.riskPulse??!1,this._hoverTraceEnabled=e.hoverTrace??!1,this._fadeInEnabled=e.fadeIn??!1,this._pulseTimer&&(clearInterval(this._pulseTimer),this._pulseTimer=null),this._riskPulseEnabled&&(this._pulseTimer=setInterval(()=>{this._animTime+=.05,this._graph&&this._graph.nodeVal(this._graph.nodeVal())},50));const a=e.linkParticleSpeed??.003,i=e.linkParticleColor??"rgba(100,150,255,0.6)",n=e.linkParticleWidth??.8;if(e.linkParticles||e.hoverTrace)try{const s=e.linkParticleCount??1;this._hoverTraceEnabled?this._graph.linkDirectionalParticles(r=>{if(!this._hoveredNodeId)return e.linkParticles?s:0;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?4:e.linkParticles?s:0}).linkDirectionalParticleSpeed(r=>{if(!this._hoveredNodeId)return a;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?.015:a}).linkDirectionalParticleWidth(r=>{if(!this._hoveredNodeId)return n;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?2:n}).linkDirectionalParticleColor(r=>{if(!this._hoveredNodeId)return i;const t=r,c=typeof t.source=="object"?t.source.id:t.source,o=typeof t.target=="object"?t.target.id:t.target;return c===this._hoveredNodeId||o===this._hoveredNodeId?"#60a0ff":i}):this._graph.linkDirectionalParticles(s).linkDirectionalParticleSpeed(a).linkDirectionalParticleWidth(n).linkDirectionalParticleColor(()=>i)}catch{}else try{this._graph.linkDirectionalParticles(0)}catch{}if(this._driftTimer&&(clearInterval(this._driftTimer),this._driftTimer=null),e.drift){this._graph.d3AlphaDecay(.005),this._driftTimer=setInterval(()=>{if(this._graph)try{this._graph.d3ReheatSimulation()}catch{}},8e3);try{this._graph.d3ReheatSimulation()}catch{}}else this._graph.d3AlphaDecay(.05)}applyPalette(e){this._graph&&this._graph.backgroundColor(e.background)}};function C(e){let a=0;for(let i=0;i<e.length;i++)a=(a<<5)-a+e.charCodeAt(i)|0;return a}export{R as WebGL3DRenderer};
|
package/dist-ui/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>DKG Node</title>
|
|
7
7
|
<link rel="icon" type="image/png" sizes="120x120" href="/ui/favicon.png" />
|
|
8
|
-
<script type="module" crossorigin src="/ui/assets/index
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/ui/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/ui/assets/index-2Gzrk1k3.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/ui/assets/index-CmliV5st.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@origintrail-official/dkg-node-ui",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@opentelemetry/api": "^1.9.1",
|
|
9
|
+
"@opentelemetry/core": "^2.8.0",
|
|
10
|
+
"@opentelemetry/exporter-metrics-otlp-proto": "^0.219.0",
|
|
11
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.219.0",
|
|
12
|
+
"@opentelemetry/resources": "^2.8.0",
|
|
13
|
+
"@opentelemetry/sdk-metrics": "^2.8.0",
|
|
14
|
+
"@opentelemetry/sdk-trace-node": "^2.8.0",
|
|
15
|
+
"@opentelemetry/semantic-conventions": "^1.41.1",
|
|
8
16
|
"@openuidev/react-lang": "^0.2.3",
|
|
9
|
-
"better-sqlite3": "
|
|
17
|
+
"better-sqlite3": "12.11.1",
|
|
10
18
|
"lucide-react": "^1.14.0",
|
|
11
19
|
"react-dropzone": "^15.0.0",
|
|
12
20
|
"react-markdown": "^10.1.0",
|
|
@@ -14,10 +22,11 @@
|
|
|
14
22
|
"remark-breaks": "^4.0.0",
|
|
15
23
|
"remark-gfm": "^4.0.1",
|
|
16
24
|
"shiki": "^4.0.2",
|
|
25
|
+
"viem": "^2.53.1",
|
|
17
26
|
"zod": "^3.25.76",
|
|
18
27
|
"zustand": "^5.0.12",
|
|
19
|
-
"@origintrail-official/dkg-core": "10.0.
|
|
20
|
-
"@origintrail-official/dkg-graph-viz": "10.0.
|
|
28
|
+
"@origintrail-official/dkg-core": "10.0.2",
|
|
29
|
+
"@origintrail-official/dkg-graph-viz": "10.0.2"
|
|
21
30
|
},
|
|
22
31
|
"devDependencies": {
|
|
23
32
|
"@playwright/test": "^1.59.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as w,a2 as A,M as x,K as e,a as N,A as P,a1 as C,X as T,a0 as R,a4 as E,a3 as M,R as j,c as $,b as D}from"./index--rkHgZxC.js";const S="http://www.w3.org/ns/prov#wasAttributedTo",k=[{iri:"http://dkg.io/ontology/decisions/Decision",label:"Decisions"},{iri:"http://dkg.io/ontology/tasks/Task",label:"Tasks"},{iri:"http://dkg.io/ontology/github/PullRequest",label:"Pull Requests"},{iri:"http://dkg.io/ontology/github/Issue",label:"Issues"},{iri:"http://dkg.io/ontology/github/Commit",label:"Commits"}],B=({agentUri:a,entityList:d,onSelectEntity:u,onOpenAgent:r,onBack:b})=>{const o=w(),c=A(),s=(o==null?void 0:o.get(a))??null,p=x.useMemo(()=>{const t=new Map;for(const l of d){if(!l.connections.some(f=>f.predicate===S&&f.targetUri===a))continue;const n=k.find(f=>l.types.includes(f.iri));if(!n)continue;const y=t.get(n.iri)??[];y.push(l),t.set(n.iri,y)}return t},[d,a]),g=x.useMemo(()=>{let t=0;for(const l of p.values())t+=l.length;return t},[p]),m=s!=null&&s.operatorUri?(o==null?void 0:o.get(s.operatorUri))??null:null,[v,h]=x.useState(null);return e.jsxs("div",{className:"v10-agent-profile",children:[e.jsxs("div",{className:"v10-agent-profile-header",children:[e.jsx("button",{type:"button",className:"v10-ka-back",onClick:b,children:"← Back"}),e.jsxs("div",{className:"v10-agent-profile-head",children:[e.jsx(N,{agent:s??void 0,fallbackUri:a,size:"lg",showOperator:!0}),(s==null?void 0:s.reputation)&&e.jsx("div",{className:"v10-agent-profile-reputation",children:s.reputation})]}),e.jsxs("div",{className:"v10-agent-profile-meta",children:[(s==null?void 0:s.walletAddress)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Wallet"}),e.jsxs("span",{className:"v10-agent-profile-meta-val mono v10-agent-profile-wallet",title:s.walletAddress,children:[s.walletAddress,e.jsx("button",{type:"button",className:"v10-agent-profile-copy",onClick:t=>{var l;t.stopPropagation(),(l=navigator.clipboard)==null||l.writeText(s.walletAddress).catch(()=>{})},title:"Copy wallet address",children:"⎘"})]})]}),e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"URI"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:a})]}),(s==null?void 0:s.peerId)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Peer ID"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:s.peerId})]}),m&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Driven by"}),e.jsx("span",{className:"v10-agent-profile-meta-val",children:e.jsx(N,{agent:m,size:"sm",onOpenAgent:r})})]}),(s==null?void 0:s.framework)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Framework"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:s.framework})]})]})]}),e.jsxs("div",{className:"v10-agent-profile-stats",children:[e.jsxs("button",{type:"button",className:`v10-agent-profile-stat${v===null?" active":""}`,onClick:()=>h(null),children:[e.jsx("span",{className:"v10-agent-profile-stat-val",children:g}),e.jsx("span",{className:"v10-agent-profile-stat-lbl",children:"All activity"})]}),k.map(t=>{const l=p.get(t.iri)??[];if(l.length===0)return null;const i=c==null?void 0:c.forType(t.iri),n=(i==null?void 0:i.color)??"#a855f7";return e.jsxs("button",{type:"button",className:`v10-agent-profile-stat${v===t.iri?" active":""}`,style:{"--stat-color":n},onClick:()=>h(t.iri),children:[e.jsx("span",{className:"v10-agent-profile-stat-val",children:l.length}),e.jsx("span",{className:"v10-agent-profile-stat-lbl",children:i!=null&&i.label?i.label:t.label})]},t.iri)})]}),e.jsx(P,{entities:d,agentUri:a,typeIri:v??void 0,onSelectEntity:u,onOpenAgent:r,title:e.jsxs(e.Fragment,{children:["All activity",s&&e.jsxs("span",{className:"v10-agent-profile-feed-sub",children:[" · authored by ",s.name]})]}),emptyHint:g===0?`${(s==null?void 0:s.name)??a} hasn't authored anything in this project yet.`:"No entries match the current filter."})]})},_=({contextGraphId:a,agentUri:d})=>{const u=C(a),r=T(a),b=R(a),{openTab:o,closeTab:c,activeTabId:s}=E(),{setActiveProject:p}=M(),g=j.useCallback(t=>{p(a),o({id:`project:${a}`,label:u.displayName||a.slice(0,16),closable:!0}),window.dispatchEvent(new CustomEvent("v10:open-entity",{detail:{contextGraphId:a,entityUri:t}}))},[a,o,u.displayName,p]),m=j.useCallback(t=>{var n;const l=t.startsWith("urn:dkg:agent:")?t.slice(14):t,i=((n=r.get(t))==null?void 0:n.name)??l;o({id:`agent:${a}|${l}`,label:`@ ${i}`,closable:!0})},[a,r,o]),v=j.useCallback(()=>{s&&c(s)},[s,c]),h=j.useMemo(()=>({...r,openAgent:m}),[r,m]);return e.jsx($.Provider,{value:u,children:e.jsx(D.Provider,{value:h,children:e.jsx(B,{agentUri:d,entityList:b.entityList,onSelectEntity:g,onOpenAgent:m,onBack:v})})})};export{_ as AgentProfilePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as a,h as o,g as h,K as e,L as x,N as d,D as l}from"./index--rkHgZxC.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}=a(o,[],1e4),{data:n}=a(h,[],15e3),i=(s==null?void 0:s.connections)??[],c=(n==null?void 0:n.agents)??[];return e.jsxs("div",{children:[e.jsxs(x,{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:c.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,r)=>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)})]},r))})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{className:"card-title",children:"Discovered Agents"}),c.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:c.map((t,r)=>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})})]},r))})]})]})]})}export{v as NetworkPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{M as h,Z as x,K as e,U as r}from"./index--rkHgZxC.js";import{u as N}from"./index-DOgQqEa_.js";import"./ordinal-DhEzRPdO.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."},I=({contextGraphId:t,layer:a,explorerUrl:l})=>{const{selectedNode:n}=N(),[p,d]=h.useState(null),s=(n==null?void 0:n.id)??null;h.useEffect(()=>{d(null)},[s]);const v=!!s&&s!==p,i=x(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{I as OnChainProvenanceCard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{K as e,$ as j,M as i,O as E,E as $,F as B,w as W,z as I,y as L,R,W as C,k as P,v as M,V as w,C as D}from"./index--rkHgZxC.js";function O(a,n){const t=(a??"").trim();if(!t)return"TRAC";const r=(n??"").includes(":")?(n??"").split(":")[1]:n??"";return r==="84532"||r==="11155111"||r==="31337"||r==="10200"||r==="20430"?/test/i.test(t)?t:`${t} (testnet)`:t}function T(a,n=2){if(a==null)return"—";let t;if(typeof a=="number")t=a;else{const r=String(a).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(r))return"—";t=Number(r)}return Number.isFinite(t)?t.toFixed(n):"—"}function U(a){if(T(a)!=="—")return`Exact: ${a}`}const k="************",H=/[A-Za-z0-9_-]{16,}/g;function F(a){if(!a)return"";let n;try{n=new URL(a)}catch{return a.replace(H,k)}(n.username||n.password)&&(n.username="",n.password="");const t=n.pathname.split("/").map(r=>r.length<16?r:/^[A-Za-z0-9_-]+$/.test(r)?k:r);if(n.pathname=t.join("/"),n.search){const r=new URLSearchParams(n.search);for(const s of Array.from(r.keys()))/key|token|secret|auth/i.test(s)&&r.set(s,k);n.search=r.toString()}return n.toString()}function x({label:a,value:n,mono:t=!1}){return e.jsxs("div",{style:{marginBottom:14},children:[e.jsx("div",{className:"settings-field-label",children:a}),e.jsx("div",{className:`settings-field-value${t?" mono":""}`,children:n})]})}function A({rpcUrl:a}){const[n,t]=i.useState(!1),r=n?a:F(a);return e.jsxs("div",{style:{marginBottom:14},children:[e.jsxs("div",{className:"settings-field-label",style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"RPC"}),e.jsx("button",{type:"button",onClick:()=>t(s=>!s),style:{background:"none",border:"1px solid var(--border)",color:"var(--text-dim)",cursor:"pointer",fontSize:9,fontWeight:600,padding:"1px 6px",borderRadius:4},"aria-label":n?"Redact RPC URL":"Reveal RPC URL",title:n?"Hide the path-token (recommended for screen-shares)":"Show full URL — careful, may contain a tenant secret",children:n?"Redact":"Reveal"})]}),e.jsx("div",{className:"settings-field-value mono",style:{wordBreak:"break-all"},children:r})]})}function _(){const{data:a}=j(L,[],6e4),[n,t]=i.useState(!1),[r,s]=i.useState(!1),[c,h]=i.useState(null),[m,l]=i.useState(!1),u=R.useRef(null),f=R.useRef(null);i.useEffect(()=>{a!=null&&t(a.enabled)},[a]);const g=i.useCallback(()=>{r||(h(null),n?(t(!1),s(!0),C(!1).catch(()=>{t(!0),h("Couldn’t update telemetry — try again.")}).finally(()=>s(!1))):l(!0))},[n,r]),y=i.useCallback(async()=>{var d;l(!1),h(null),t(!0),s(!0);try{await C(!0)}catch{t(!1),h("Couldn’t update telemetry — try again.")}finally{s(!1),(d=f.current)==null||d.focus()}},[]);return i.useEffect(()=>{var b;if(!m)return;const d=(b=u.current)==null?void 0:b.querySelector("button");d==null||d.focus();const o=S=>{var v;S.key==="Escape"&&(l(!1),(v=f.current)==null||v.focus())};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[m]),e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Network Telemetry"})}),e.jsxs("div",{className:"card-body",children:[e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginBottom:16,lineHeight:1.6},children:"Local metrics are stored in SQLite and displayed in the Observability page."}),e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"10px 0"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600},children:"Share telemetry with the network"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:2,lineHeight:1.5},children:"When enabled, metrics and logs are streamed to the OriginTrail network dashboard for network-wide diagnostics."})]}),e.jsx("button",{ref:f,type:"button",role:"switch","aria-checked":n,"aria-busy":r,"aria-disabled":r,"aria-label":"Share telemetry with the network",onClick:g,style:{width:38,height:22,borderRadius:11,border:"none",flexShrink:0,background:n?"var(--green)":"var(--border)",transition:"background .2s",position:"relative",marginLeft:16,cursor:r?"wait":"pointer",opacity:r?.6:1},children:e.jsx("span",{style:{position:"absolute",top:3,left:n?19:3,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left .2s",display:"block"}})})]}),e.jsx("div",{"aria-live":"polite",children:c&&e.jsx("div",{style:{fontSize:11,color:"var(--red)",marginTop:4},children:c})})]}),m&&e.jsx("div",{style:{position:"fixed",inset:0,zIndex:9999,background:"rgba(0,0,0,.55)",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Enable Telemetry Streaming?",style:{background:"var(--surface)",border:"1px solid var(--border)",borderRadius:12,padding:"24px 28px",maxWidth:440,width:"90%",boxShadow:"0 8px 32px rgba(0,0,0,.3)"},children:[e.jsx("div",{style:{fontSize:15,fontWeight:700,marginBottom:16},children:"Enable Telemetry Streaming?"}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.7,marginBottom:12},children:"When enabled, the following data is streamed to the OriginTrail team:"}),e.jsxs("ul",{style:{fontSize:12,color:"var(--text)",lineHeight:1.8,margin:"0 0 14px 18px",padding:0},children:[e.jsx("li",{children:"Operation logs (publish, query, sync, gossip events)"}),e.jsx("li",{children:"Performance metrics (durations, throughput, error rates)"}),e.jsx("li",{children:"Node identity (peer ID, node name, network)"})]}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted)",lineHeight:1.7,marginBottom:12},children:["The following data is ",e.jsx("strong",{style:{color:"var(--text)"},children:"NEVER"})," shared via telemetry:"]}),e.jsxs("ul",{style:{fontSize:12,color:"var(--text)",lineHeight:1.8,margin:"0 0 16px 18px",padding:0},children:[e.jsx("li",{children:"Private keys or wallet credentials"}),e.jsx("li",{children:"Authentication tokens or API keys"}),e.jsx("li",{children:"Private triple content or personal data"}),e.jsx("li",{children:"File system paths or environment variables"})]}),e.jsx("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:20,lineHeight:1.5},children:"You can disable streaming at any time from this page."}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[e.jsx("button",{type:"button",onClick:()=>{var d;l(!1),(d=f.current)==null||d.focus()},style:{padding:"7px 18px",borderRadius:7,fontSize:12,fontWeight:600,cursor:"pointer",border:"1px solid var(--border)",background:"var(--surface)",color:"var(--text-muted)"},children:"Cancel"}),e.jsx("button",{type:"button",onClick:y,style:{padding:"7px 18px",borderRadius:7,fontSize:12,fontWeight:700,cursor:"pointer",border:"1px solid rgba(74,222,128,.4)",background:"rgba(74,222,128,.1)",color:"var(--green)"},children:"Enable Streaming"})]})]})})]})}function q(){const{data:a}=j(P,[],3e4),{data:n}=j(M,[],6e4),[t,r]=i.useState(90),[s,c]=i.useState(!1),[h,m]=i.useState(null),[l,u]=i.useState(null),f=R.useRef(null);i.useEffect(()=>{n!=null&&n.retentionDays&&r(n.retentionDays)},[n]),i.useEffect(()=>{var o;l!=null&&((o=f.current)==null||o.focus())},[l]);const g=i.useCallback(async()=>{if(l==null)return;const o=l;c(!1),m(null),u(null);try{await w(o),r(o),c(!0),setTimeout(()=>c(!1),2e3)}catch{m("Couldn’t save retention — try again.")}},[l]),y=i.useCallback(o=>{m(null),o<t?(c(!1),u(o)):(c(!1),u(null),w(o).then(()=>{r(o),c(!0),setTimeout(()=>c(!1),2e3)}).catch(()=>m("Couldn’t save retention — try again.")))},[t]),d=(a==null?void 0:a.store_bytes)??null;return e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Local Data Retention"})}),e.jsxs("div",{className:"card-body",children:[e.jsx("label",{htmlFor:"retention-select",className:"settings-field-label",style:{display:"block",marginBottom:5},children:"Keep local data for"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsxs("select",{id:"retention-select",className:"input",value:l??t,onChange:o=>y(Number(o.target.value)),style:{width:160},children:[e.jsx("option",{value:7,children:"7 days"}),e.jsx("option",{value:30,children:"30 days"}),e.jsx("option",{value:90,children:"90 days"}),e.jsx("option",{value:180,children:"180 days"}),e.jsx("option",{value:365,children:"365 days"})]}),e.jsx("span",{"aria-live":"polite",children:s&&e.jsx("span",{style:{fontSize:10,color:"var(--green)",fontWeight:600},children:"Saved"})}),d!=null&&e.jsxs("span",{className:"mono",style:{fontSize:10,color:"var(--text-dim)"},children:["Store: ",D(d)]})]}),l!=null&&e.jsxs("div",{role:"group","aria-label":"Confirm retention reduction",style:{marginTop:8,padding:"10px 14px",borderRadius:8,background:"rgba(251,191,36,.06)",border:"1px solid rgba(251,191,36,.2)"},children:[e.jsxs("div",{style:{fontSize:11,color:"var(--amber)",fontWeight:600,marginBottom:4},children:["Reduce retention to ",l," days?"]}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted)",lineHeight:1.5,marginBottom:8},children:["Operations, logs, and metrics older than ",l," days will be permanently deleted."]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{ref:f,type:"button",onClick:g,style:{padding:"5px 14px",borderRadius:6,fontSize:11,fontWeight:700,cursor:"pointer",border:"1px solid rgba(251,191,36,.4)",background:"rgba(251,191,36,.1)",color:"var(--amber)"},children:"Prune & Save"}),e.jsx("button",{type:"button",onClick:()=>u(null),style:{padding:"5px 14px",borderRadius:6,fontSize:11,fontWeight:600,cursor:"pointer",border:"1px solid var(--border)",background:"var(--surface)",color:"var(--text-muted)"},children:"Cancel"})]})]}),l==null&&e.jsx("div",{style:{fontSize:10,color:"var(--text-dim)",marginTop:4},children:"Operations, logs, and metric snapshots older than this are pruned automatically."}),e.jsx("div",{"aria-live":"polite",children:h&&e.jsx("div",{style:{fontSize:11,color:"var(--red)",marginTop:4},children:h})})]})]})}function K(a){const n=Math.floor(a/1e3);if(n<60)return`${n}s`;const t=Math.floor(n/60);if(t<60)return`${t}m ${n%60}s`;const r=Math.floor(t/60);return r<24?`${r}h ${t%60}m`:`${Math.floor(r/24)}d ${r%24}h`}function Z(a){return a.length<=12?a:`${a.slice(0,6)}…${a.slice(-4)}`}function V(a){if(!a)return"Unknown";const n=a.includes(":")?a.split(":")[1]:a;switch(n){case"84532":return"Base Sepolia (Testnet)";case"8453":return"Base (Mainnet)";case"1":return"Ethereum Mainnet";case"11155111":return"Sepolia (Testnet)";case"31337":return"Local (Hardhat)";default:return`Chain ${n}`}}function Y(){return e.jsxs("div",{className:"page-section",children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Settings"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4},children:"Node configuration and preferences"})]}),e.jsx(G,{})]})}function G(){var g,y,d,o,b,S,v,N;const{data:a}=j(W,[],3e4),{data:n}=j(I,[],6e4),t=a,r=n,[s,c]=i.useState(!1),[h,m]=i.useState(!1),l=(t==null?void 0:t.connectedPeers)??0,u=(t==null?void 0:t.peerId)!=null,f=i.useCallback(async()=>{if(!s){c(!0),setTimeout(()=>c(!1),5e3);return}m(!0);try{await E()}catch{m(!1),c(!1)}},[s]);return e.jsxs("div",{className:"settings-stack",children:[e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Node Identity"})}),e.jsxs("div",{className:"card-body",children:[e.jsx(x,{label:"Name",value:(t==null?void 0:t.name)??"—"}),e.jsx(x,{label:"Peer ID",value:(t==null?void 0:t.peerId)??"—",mono:!0}),e.jsx(x,{label:"Role",value:(t==null?void 0:t.nodeRole)??"—"}),e.jsx(x,{label:"Network",value:(t==null?void 0:t.networkName)??(t!=null&&t.networkId?`Network ${t.networkId}`:"—")}),e.jsx(x,{label:"Store",value:(t==null?void 0:t.storeBackend)??"—",mono:!0}),e.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,background:u?"var(--green-dim)":"rgba(248,113,113,.05)",border:`1px solid ${u?"rgba(74,222,128,.2)":"rgba(248,113,113,.2)"}`},children:[e.jsx("div",{className:"mono",style:{fontSize:10,color:u?"var(--green)":"var(--red)",fontWeight:700},children:u?"● ONLINE":"● OFFLINE"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},title:"Peers = unique remote nodes. Direct + Relayed counts are libp2p connections — a single peer can hold both a direct and a relayed link, so they sum to ≥ Peers, not exactly equal to it.",children:u?`${l} peer${l!==1?"s":""} · ${((g=t==null?void 0:t.connections)==null?void 0:g.direct)??0} direct, ${((y=t==null?void 0:t.connections)==null?void 0:y.relayed)??0} relayed link${(((d=t==null?void 0:t.connections)==null?void 0:d.relayed)??0)===1?"":"s"} · up ${K((t==null?void 0:t.uptimeMs)??0)}`:"Node is not responding"})]})]})]}),e.jsxs("section",{className:"card",children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",children:"Blockchain Config"})}),e.jsxs("div",{className:"card-body",children:[e.jsx(x,{label:"Chain",value:V(r==null?void 0:r.chainId)}),((o=r==null?void 0:r.balances)==null?void 0:o.length)>0?r.balances.map((p,z)=>e.jsxs("div",{style:{marginBottom:10},children:[e.jsx(x,{label:r.balances.length>1?`Wallet ${z+1}`:"Operational Wallet",value:p.address,mono:!0}),e.jsxs("div",{style:{display:"flex",gap:16,marginTop:-6},children:[e.jsxs("span",{className:"mono",style:{fontSize:11,color:"var(--text-muted)"},title:B(p.eth),children:[$(p.eth)," ETH"]}),e.jsxs("span",{className:"mono",style:{fontSize:11,color:"var(--text-muted)"},title:U(p.trac),children:[T(p.trac)," ",O(p.symbol,r==null?void 0:r.chainId)]})]})]},p.address)):e.jsx(x,{label:"Operational Wallet",value:(b=r==null?void 0:r.wallets)!=null&&b[0]?Z(r.wallets[0]):"—",mono:!0}),(r==null?void 0:r.rpcUrl)&&e.jsx(A,{rpcUrl:r.rpcUrl}),r!=null&&r.error?e.jsxs("div",{style:{padding:"8px 12px",borderRadius:8,background:"rgba(248,113,113,.05)",border:"1px solid rgba(248,113,113,.2)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--red)",marginBottom:2},children:"⚠ Error"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:r.error})]}):(S=r==null?void 0:r.chainId)!=null&&S.includes("84532")||(v=r==null?void 0:r.chainId)!=null&&v.includes("31337")||(N=r==null?void 0:r.chainId)!=null&&N.includes("11155111")?e.jsxs("div",{style:{padding:"8px 12px",borderRadius:8,background:"var(--amber-dim)",border:"1px solid rgba(251,191,36,.2)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:700,color:"var(--amber)",marginBottom:2},children:"⚠ Testnet Mode"}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)"},children:"No real TRAC is spent. Perfect for development."})]}):null]})]}),e.jsx(_,{}),e.jsx(q,{}),e.jsxs("section",{className:"card",style:{borderColor:"rgba(248,113,113,.2)",background:"rgba(248,113,113,.03)"},children:[e.jsx("div",{className:"card-header",children:e.jsx("h2",{className:"card-title",style:{color:"var(--red)"},children:"Danger Zone"})}),e.jsx("div",{className:"card-body",children:e.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap",alignItems:"center"},children:[e.jsx("button",{onClick:f,disabled:h,style:{padding:"8px 16px",borderRadius:8,border:`1px solid ${s?"var(--red)":"rgba(251,191,36,.3)"}`,background:s?"rgba(248,113,113,.15)":"rgba(251,191,36,.07)",color:s?"var(--red)":"var(--amber)",fontSize:12,fontWeight:600,cursor:h?"not-allowed":"pointer",opacity:h?.5:1},children:h?"Shutting down…":s?"Confirm Shutdown":"Shutdown Node"}),e.jsx("span",{"aria-live":"polite",children:s&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Click again to confirm. The node process will terminate."})})]})})]})]})}export{Y as SettingsPage};
|