@origintrail-official/dkg-node-ui 10.0.16 → 10.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/chain-cursor-stores.d.ts +48 -0
  2. package/dist/chain-cursor-stores.d.ts.map +1 -1
  3. package/dist/chain-cursor-stores.js +145 -0
  4. package/dist/chain-cursor-stores.js.map +1 -1
  5. package/dist/chain-event-log-store.d.ts +84 -0
  6. package/dist/chain-event-log-store.d.ts.map +1 -0
  7. package/dist/chain-event-log-store.js +289 -0
  8. package/dist/chain-event-log-store.js.map +1 -0
  9. package/dist/db.d.ts +16 -58
  10. package/dist/db.d.ts.map +1 -1
  11. package/dist/db.js +125 -144
  12. package/dist/db.js.map +1 -1
  13. package/dist/index.d.ts +3 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/protocol-outbox-store.d.ts +67 -0
  18. package/dist/protocol-outbox-store.d.ts.map +1 -0
  19. package/dist/protocol-outbox-store.js +199 -0
  20. package/dist/protocol-outbox-store.js.map +1 -0
  21. package/dist-ui/assets/{3d-force-graph-bUKbeTGZ.js → 3d-force-graph-DGF2sXeK.js} +1 -1
  22. package/dist-ui/assets/ActivityFeed-DNatshHL.js +99 -0
  23. package/dist-ui/assets/{AgentHub-4c4sH_Jd.js → AgentHub-lOm96XuE.js} +1 -1
  24. package/dist-ui/assets/{AgentProfilePage-ClhUeZxy.js → AgentProfilePage-BRtazufK.js} +1 -1
  25. package/dist-ui/assets/ApproveWalletsModal-BMtRgndO.js +3 -0
  26. package/dist-ui/assets/{ContextGraphPrimitives-Bwc2i7EX.js → ContextGraphPrimitives-CBc6kvmp.js} +1 -1
  27. package/dist-ui/assets/ConvictionDetailView-DOTYSm7p.js +2 -0
  28. package/dist-ui/assets/{MemoryLayerView-DxL2MjyA.js → MemoryLayerView-DDFI2ngR.js} +2 -2
  29. package/dist-ui/assets/{MemoryStackView-BLhA3bn0.js → MemoryStackView-Bol2eMyq.js} +1 -1
  30. package/dist-ui/assets/{Network-BNhbBzOD.js → Network-B49IxpAj.js} +1 -1
  31. package/dist-ui/assets/{OnChainProvenanceCard-DKyfVEjF.js → OnChainProvenanceCard-BpUoHg4b.js} +1 -1
  32. package/dist-ui/assets/{Operations-mCPe0E-j.js → Operations-BCQ545Yk.js} +1 -1
  33. package/dist-ui/assets/{ProjectView-jrGPu5ON.js → ProjectView-BaQQSy8L.js} +20 -20
  34. package/dist-ui/assets/PublishingConviction-B5nWRsUP.js +2 -0
  35. package/dist-ui/assets/Settings-DeZKX_Ry.js +1 -0
  36. package/dist-ui/assets/browserWalletTransaction-B6wyaMOV.js +55 -0
  37. package/dist-ui/assets/ccip-B_vQl40F.js +1 -0
  38. package/dist-ui/assets/{index-VYV5TH6q.css → index-BLQUVvVz.css} +1 -1
  39. package/dist-ui/assets/index-CT-LdpBE.js +1175 -0
  40. package/dist-ui/assets/{index-UvxrSkC_.js → index-DHd3qhAk.js} +3 -3
  41. package/dist-ui/assets/{jsonld-32FQRO67-Dl6_9Lk9.js → jsonld-32FQRO67-BYu8pE-5.js} +2 -2
  42. package/dist-ui/assets/{jsonld-Dj4KMENF.js → jsonld-Crm5iwcE.js} +1 -1
  43. package/dist-ui/assets/{renderer-3d-2EVDZII7-DfnhcMkF.js → renderer-3d-2EVDZII7-C2z5aUgo.js} +2 -2
  44. package/dist-ui/assets/{shikiHighlighter-ByXDJnWi.js → shikiHighlighter-DW1fRfBU.js} +1 -1
  45. package/dist-ui/assets/{useEntityOnChainReceipt-BRK_O_sb.js → useEntityOnChainReceipt-0Ub24t6e.js} +1 -1
  46. package/dist-ui/assets/{useProjectActivity-OdoQs9mK.js → useProjectActivity-CLza3psq.js} +1 -1
  47. package/dist-ui/index.html +2 -2
  48. package/package.json +3 -3
  49. package/dist-ui/assets/ActivityFeed-CC5S_gk9.js +0 -100
  50. package/dist-ui/assets/ApproveWalletsModal-CBKp6zQB.js +0 -57
  51. package/dist-ui/assets/ConvictionDetailView-a3v7xwcm.js +0 -2
  52. package/dist-ui/assets/PublishingConviction-BGi128uo.js +0 -2
  53. package/dist-ui/assets/Settings-D1oxLo1Y.js +0 -1
  54. package/dist-ui/assets/ccip-WHHgwjp-.js +0 -1
  55. package/dist-ui/assets/index-RLb1kuzE.js +0 -1174
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonld-Dj4KMENF.js","assets/index-RLb1kuzE.js","assets/index-VYV5TH6q.css","assets/ntriples-ZWBY2WET-DH7OofPp.js","assets/N3Parser-CI_4owEm.js"])))=>i.map(i=>d[i]);
2
- import{_ as y}from"./index-RLb1kuzE.js";async function _(a){const e=typeof a=="string"?JSON.parse(a):a;try{const n=await(await y(()=>import("./jsonld-Dj4KMENF.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
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jsonld-Crm5iwcE.js","assets/index-CT-LdpBE.js","assets/index-BLQUVvVz.css","assets/ntriples-ZWBY2WET-DH7OofPp.js","assets/N3Parser-CI_4owEm.js"])))=>i.map(i=>d[i]);
2
+ import{_ as y}from"./index-CT-LdpBE.js";async function _(a){const e=typeof a=="string"?JSON.parse(a):a;try{const n=await(await y(()=>import("./jsonld-Crm5iwcE.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{x as rt,ax as Kt,ay as Wt}from"./index-RLb1kuzE.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}/*!
1
+ import{x as rt,ay as Kt,az as Wt}from"./index-CT-LdpBE.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.
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/3d-force-graph-bUKbeTGZ.js","assets/three.module-BXIk8GZS.js","assets/index-RLb1kuzE.js","assets/index-VYV5TH6q.css","assets/index-UvxrSkC_.js","assets/string-DtUow4KV.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-RLb1kuzE.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-bUKbeTGZ.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-DGF2sXeK.js","assets/three.module-BXIk8GZS.js","assets/index-CT-LdpBE.js","assets/index-BLQUVvVz.css","assets/index-DHd3qhAk.js","assets/string-DtUow4KV.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-CT-LdpBE.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-DGF2sXeK.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,4 +1,4 @@
1
- var zt=Object.defineProperty;var Vt=(n,e,t)=>e in n?zt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>Vt(n,typeof e!="symbol"?e+"":e,t);import{bM as He,bm as gt,al as Kt,bk as Yt,bl as Qt,v as Ye,aC as Jt,aW as Xt,_ as Zt}from"./index-RLb1kuzE.js";const Qe={}.hasOwnProperty;function en(n,e){const t=e||{};function r(s,...o){let i=r.invalid;const c=r.handlers;if(s&&Qe.call(s,n)){const a=String(s[n]);i=Qe.call(c,a)?c[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}var v=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function tn(n){return De(n)}function De(n){return Array.isArray(n)?nn(n):n instanceof RegExp?n:typeof n=="object"?rn(n):n}function nn(n){let e=[];for(let t=0,r=n.length;t<r;t++)e[t]=De(n[t]);return e}function rn(n){let e={};for(let t in n)e[t]=De(n[t]);return e}function pt(n,...e){return e.forEach(t=>{for(let r in t)n[r]=t[r]}),n}function mt(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?mt(n.substring(0,n.length-1)):n.substr(~e+1)}var Be=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,te=class{static hasCaptures(n){return n===null?!1:(Be.lastIndex=0,Be.test(n))}static replaceCaptures(n,e,t){return n.replace(Be,(r,s,o,i)=>{let c=t[parseInt(s||o,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function bt(n,e){return n<e?-1:n>e?1:0}function _t(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,r=e.length;if(t===r){for(let s=0;s<t;s++){let o=bt(n[s],e[s]);if(o!==0)return o}return 0}return t-r}function Je(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function yt(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kt=class{constructor(n){g(this,"cache",new Map);this.fn=n}get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},ae=class{constructor(n,e,t){g(this,"_cachedMatchRoot",new kt(n=>this._root.match(n)));this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(an(n),e)}static createFromParsedTheme(n,e){return ln(n,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,r=this._cachedMatchRoot.get(e).find(s=>sn(n.parent,s.parentScopes));return r?new St(r.fontStyle,r.foreground,r.background):null}},Re=class oe{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const r of t)e=new oe(e,r);return e}static from(...e){let t=null;for(let r=0;r<e.length;r++)t=new oe(t,e[r]);return t}push(e){return new oe(this,e)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}};function sn(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let r=e[t],s=!1;if(r===">"){if(t===e.length-1)return!1;r=e[++t],s=!0}for(;n&&!on(n.scopeName,r);){if(s)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function on(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var St=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function an(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let c;if(typeof i.scope=="string"){let u=i.scope;u=u.replace(/^[,]+/,""),u=u.replace(/[,]+$/,""),c=u.split(",")}else Array.isArray(i.scope)?c=i.scope:c=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let u=i.settings.fontStyle.split(" ");for(let f=0,h=u.length;f<h;f++)switch(u[f]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof i.settings.foreground=="string"&&Je(i.settings.foreground)&&(l=i.settings.foreground);let d=null;typeof i.settings.background=="string"&&Je(i.settings.background)&&(d=i.settings.background);for(let u=0,f=c.length;u<f;u++){let p=c[u].trim().split(" "),k=p[p.length-1],y=null;p.length>1&&(y=p.slice(0,p.length-1),y.reverse()),t[r++]=new cn(k,y,s,a,l,d)}}return t}var cn=class{constructor(n,e,t,r,s,o){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=r,this.foreground=s,this.background=o}},T=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(T||{});function ln(n,e){n.sort((a,l)=>{let d=bt(a.scope,l.scope);return d!==0||(d=_t(a.parentScopes,l.parentScopes),d!==0)?d:a.index-l.index});let t=0,r="#000000",s="#ffffff";for(;n.length>=1&&n[0].scope==="";){let a=n.shift();a.fontStyle!==-1&&(t=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new un(e),i=new St(t,o.getId(r),o.getId(s)),c=new fn(new Ee(0,null,-1,0,0),[]);for(let a=0,l=n.length;a<l;a++){let d=n[a];c.insert(0,d.scope,d.parentScopes,d.fontStyle,o.getId(d.foreground),o.getId(d.background))}return new ae(o,i,c)}var un=class{constructor(n){g(this,"_isFrozen");g(this,"_lastColorId");g(this,"_id2color");g(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},dn=Object.freeze([]),Ee=class wt{constructor(e,t,r,s,o){g(this,"scopeDepth");g(this,"parentScopes");g(this,"fontStyle");g(this,"foreground");g(this,"background");this.scopeDepth=e,this.parentScopes=t||dn,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new wt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,s=e.length;r<s;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},fn=class Pe{constructor(e,t=[],r={}){g(this,"_rulesWithParentScopes");this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,t.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=t.parentScopes.length);){const o=t.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Pe._cmpBySpecificity),t}insert(e,t,r,s,o,i){if(t===""){this._doInsertHere(e,r,s,o,i);return}let c=t.indexOf("."),a,l;c===-1?(a=t,l=""):(a=t.substring(0,c),l=t.substring(c+1));let d;this._children.hasOwnProperty(a)?d=this._children[a]:(d=new Pe(this._mainRule.clone(),Ee.cloneArr(this._rulesWithParentScopes)),this._children[a]=d),d.insert(e+1,l,r,s,o,i)}_doInsertHere(e,t,r,s,o){if(t===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,c=this._rulesWithParentScopes.length;i<c;i++){let a=this._rulesWithParentScopes[i];if(_t(a.parentScopes,t)===0){a.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Ee(e,t,r,s,o))}},q=class E{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=E.getLanguageId(e),r=E.getTokenType(e),s=E.getFontStyle(e),o=E.getForeground(e),i=E.getBackground(e);console.log({languageId:t,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,r,s,o,i,c){let a=E.getLanguageId(e),l=E.getTokenType(e),d=E.containsBalancedBrackets(e)?1:0,u=E.getFontStyle(e),f=E.getForeground(e),h=E.getBackground(e);return t!==0&&(a=t),r!==8&&(l=r),s!==null&&(d=s?1:0),o!==-1&&(u=o),i!==0&&(f=i),c!==0&&(h=c),(a<<0|l<<8|d<<10|u<<11|f<<15|h<<24)>>>0}};function ce(n,e){const t=[],r=hn(n);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(t.push({matcher:l,priority:a}),s!==",")break;s=r.next()}return t;function o(){if(s==="-"){s=r.next();const a=o();return l=>!!a&&!a(l)}if(s==="("){s=r.next();const a=c();return s===")"&&(s=r.next()),a}if(Xe(s)){const a=[];do a.push(s),s=r.next();while(Xe(s));return l=>e(a,l)}return null}function i(){const a=[];let l=o();for(;l;)a.push(l),l=o();return d=>a.every(u=>u(d))}function c(){const a=[];let l=i();for(;l&&(a.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return d=>a.some(u=>u(d))}}function Xe(n){return!!n&&!!n.match(/[\w\.:]+/)}function hn(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const r=t[0];return t=e.exec(n),r}}}function Ct(n){typeof n.dispose=="function"&&n.dispose()}var Q=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},gn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},pn=class{constructor(){g(this,"_references",[]);g(this,"_seenReferenceKeys",new Set);g(this,"visitedRule",new Set)}get references(){return this._references}add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},mn=class{constructor(n,e){g(this,"seenFullScopeRequests",new Set);g(this,"seenPartialScopeRequests",new Set);g(this,"Q");this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Q(this.initialScopeName)]}processQueue(){const n=this.Q;this.Q=[];const e=new pn;for(const t of n)bn(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof Q){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function bn(n,e,t,r){const s=t.lookup(n.scopeName);if(!s){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=t.lookup(e);n instanceof Q?ie({baseGrammar:o,selfGrammar:s},r):Le(n.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=t.injections(n.scopeName);if(i)for(const c of i)r.add(new Q(c))}function Le(n,e,t){if(e.repository&&e.repository[n]){const r=e.repository[n];le([r],e,t)}}function ie(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&le(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&le(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function le(n,e,t){for(const r of n){if(t.visitedRule.has(r))continue;t.visitedRule.add(r);const s=r.repository?pt({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&le(r.patterns,{...e,repository:s},t);const o=r.include;if(!o)continue;const i=vt(o);switch(i.kind){case 0:ie({...e,selfGrammar:e.baseGrammar},t);break;case 1:ie(e,t);break;case 2:Le(i.ruleName,{...e,repository:s},t);break;case 3:case 4:const c=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:s};i.kind===4?Le(i.ruleName,a,t):ie(a,t)}else i.kind===4?t.add(new gn(i.scopeName,i.ruleName)):t.add(new Q(i.scopeName));break}}}var _n=class{constructor(){g(this,"kind",0)}},yn=class{constructor(){g(this,"kind",1)}},kn=class{constructor(n){g(this,"kind",2);this.ruleName=n}},Sn=class{constructor(n){g(this,"kind",3);this.scopeName=n}},wn=class{constructor(n,e){g(this,"kind",4);this.scopeName=n,this.ruleName=e}};function vt(n){if(n==="$base")return new _n;if(n==="$self")return new yn;const e=n.indexOf("#");if(e===-1)return new Sn(n);if(e===0)return new kn(n.substring(1));{const t=n.substring(0,e),r=n.substring(e+1);return new wn(t,r)}}var Cn=/\\(\d+)/,Ze=/\\(\d+)/g,vn=-1,Bt=-2;var ee=class{constructor(n,e,t,r){g(this,"$location");g(this,"id");g(this,"_nameIsCapturing");g(this,"_name");g(this,"_contentNameIsCapturing");g(this,"_contentName");this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=te.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=te.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${mt(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:te.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:te.replaceCaptures(this._contentName,n,e)}},Bn=class extends ee{constructor(e,t,r,s,o){super(e,t,r,s);g(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,r,s){throw new Error("Not supported!")}},Rn=class extends ee{constructor(e,t,r,s,o){super(e,t,r,null);g(this,"_match");g(this,"captures");g(this,"_cachedCompiledPatterns");this._match=new J(s,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},et=class extends ee{constructor(e,t,r,s,o){super(e,t,r,s);g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ge=class extends ee{constructor(e,t,r,s,o,i,c,a,l,d){super(e,t,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"_end");g(this,"endHasBackReferences");g(this,"endCaptures");g(this,"applyEndPatternLast");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this._begin=new J(o,this.id),this.beginCaptures=i,this._end=new J(c||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const r of this.patterns)e.getRule(r).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},ue=class extends ee{constructor(e,t,r,s,o,i,c,a,l){super(e,t,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"whileCaptures");g(this,"_while");g(this,"whileHasBackReferences");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");g(this,"_cachedCompiledWhilePatterns");this._begin=new J(o,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new J(c,Bt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,r,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new X,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Rt=class A{static createCaptureRule(e,t,r,s,o){return e.registerRule(i=>new Bn(t,i,r,s,o))}static getCompiledRuleId(e,t,r){return e.id||t.registerRule(s=>{if(e.id=s,e.match)return new Rn(e.$vscodeTextmateLocation,e.id,e.name,e.match,A._compileCaptures(e.captures,t,r));if(typeof e.begin>"u"){e.repository&&(r=pt({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new et(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,A._compilePatterns(o,t,r))}return e.while?new ue(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,A._compileCaptures(e.beginCaptures||e.captures,t,r),e.while,A._compileCaptures(e.whileCaptures||e.captures,t,r),A._compilePatterns(e.patterns,t,r)):new Ge(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,A._compileCaptures(e.beginCaptures||e.captures,t,r),e.end,A._compileCaptures(e.endCaptures||e.captures,t,r),e.applyEndPatternLast,A._compilePatterns(e.patterns,t,r))}),e.id}static _compileCaptures(e,t,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);c>o&&(o=c)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);let a=0;e[i].patterns&&(a=A.getCompiledRuleId(e[i],t,r)),s[c]=A.createCaptureRule(t,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,a)}}return s}static _compilePatterns(e,t,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const c=e[o];let a=-1;if(c.include){const l=vt(c.include);switch(l.kind){case 0:case 1:a=A.getCompiledRuleId(r[c.include],t,r);break;case 2:let d=r[l.ruleName];d&&(a=A.getCompiledRuleId(d,t,r));break;case 3:case 4:const u=l.scopeName,f=l.kind===4?l.ruleName:null,h=t.getExternalGrammar(u,r);if(h)if(f){let p=h.repository[f];p&&(a=A.getCompiledRuleId(p,t,h.repository))}else a=A.getCompiledRuleId(h.repository.$self,t,h.repository);break}}else a=A.getCompiledRuleId(c,t,r);if(a!==-1){const l=t.getRule(a);let d=!1;if((l instanceof et||l instanceof Ge||l instanceof ue)&&l.hasMissingPatterns&&l.patterns.length===0&&(d=!0),d)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},J=class Nt{constructor(e,t){g(this,"source");g(this,"ruleId");g(this,"hasAnchor");g(this,"hasBackReferences");g(this,"_anchorCache");if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let c=0;c<r;c++)if(e.charAt(c)==="\\"&&c+1<r){const l=e.charAt(c+1);l==="z"?(o.push(e.substring(s,c)),o.push("$(?!\\n)(?<!\\n)"),s=c+2):(l==="A"||l==="G")&&(i=!0),c++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=Cn.test(this.source):this.hasBackReferences=!1}clone(){return new Nt(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=t.map(s=>e.substring(s.start,s.end));return Ze.lastIndex=0,this.source.replace(Ze,(s,o)=>yt(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],r=[],s=[],o,i,c,a;for(o=0,i=this.source.length;o<i;o++)c=this.source.charAt(o),e[o]=c,t[o]=c,r[o]=c,s[o]=c,c==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(e[o+1]="￿",t[o+1]="￿",r[o+1]="A",s[o+1]="A"):a==="G"?(e[o+1]="￿",t[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=a,t[o+1]=a,r[o+1]=a,s[o+1]=a),o++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},X=class{constructor(){g(this,"_items");g(this,"_hasAnchors");g(this,"_cached");g(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new tt(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let r=this._items.map(s=>s.resolveAnchors(e,t));return new tt(n,r,this._items.map(s=>s.ruleId))}},tt=class{constructor(n,e,t){g(this,"scanner");this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
1
+ var zt=Object.defineProperty;var Vt=(n,e,t)=>e in n?zt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var g=(n,e,t)=>Vt(n,typeof e!="symbol"?e+"":e,t);import{bO as He,bo as gt,al as Kt,bm as Yt,bn as Qt,v as Ye,aD as Jt,aX as Xt,_ as Zt}from"./index-CT-LdpBE.js";const Qe={}.hasOwnProperty;function en(n,e){const t=e||{};function r(s,...o){let i=r.invalid;const c=r.handlers;if(s&&Qe.call(s,n)){const a=String(s[n]);i=Qe.call(c,a)?c[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=t.handlers||{},r.invalid=t.invalid,r.unknown=t.unknown,r}var v=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function tn(n){return De(n)}function De(n){return Array.isArray(n)?nn(n):n instanceof RegExp?n:typeof n=="object"?rn(n):n}function nn(n){let e=[];for(let t=0,r=n.length;t<r;t++)e[t]=De(n[t]);return e}function rn(n){let e={};for(let t in n)e[t]=De(n[t]);return e}function pt(n,...e){return e.forEach(t=>{for(let r in t)n[r]=t[r]}),n}function mt(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?mt(n.substring(0,n.length-1)):n.substr(~e+1)}var Be=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,te=class{static hasCaptures(n){return n===null?!1:(Be.lastIndex=0,Be.test(n))}static replaceCaptures(n,e,t){return n.replace(Be,(r,s,o,i)=>{let c=t[parseInt(s||o,10)];if(c){let a=e.substring(c.start,c.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function bt(n,e){return n<e?-1:n>e?1:0}function _t(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,r=e.length;if(t===r){for(let s=0;s<t;s++){let o=bt(n[s],e[s]);if(o!==0)return o}return 0}return t-r}function Je(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function yt(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kt=class{constructor(n){g(this,"cache",new Map);this.fn=n}get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},ae=class{constructor(n,e,t){g(this,"_cachedMatchRoot",new kt(n=>this._root.match(n)));this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(an(n),e)}static createFromParsedTheme(n,e){return ln(n,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,r=this._cachedMatchRoot.get(e).find(s=>sn(n.parent,s.parentScopes));return r?new St(r.fontStyle,r.foreground,r.background):null}},Re=class oe{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const r of t)e=new oe(e,r);return e}static from(...e){let t=null;for(let r=0;r<e.length;r++)t=new oe(t,e[r]);return t}push(e){return new oe(this,e)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let r=this;for(;r&&r!==e;)t.push(r.scopeName),r=r.parent;return r===e?t.reverse():void 0}};function sn(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let r=e[t],s=!1;if(r===">"){if(t===e.length-1)return!1;r=e[++t],s=!0}for(;n&&!on(n.scopeName,r);){if(s)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function on(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var St=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function an(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let c;if(typeof i.scope=="string"){let u=i.scope;u=u.replace(/^[,]+/,""),u=u.replace(/[,]+$/,""),c=u.split(",")}else Array.isArray(i.scope)?c=i.scope:c=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let u=i.settings.fontStyle.split(" ");for(let f=0,h=u.length;f<h;f++)switch(u[f]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let l=null;typeof i.settings.foreground=="string"&&Je(i.settings.foreground)&&(l=i.settings.foreground);let d=null;typeof i.settings.background=="string"&&Je(i.settings.background)&&(d=i.settings.background);for(let u=0,f=c.length;u<f;u++){let p=c[u].trim().split(" "),k=p[p.length-1],y=null;p.length>1&&(y=p.slice(0,p.length-1),y.reverse()),t[r++]=new cn(k,y,s,a,l,d)}}return t}var cn=class{constructor(n,e,t,r,s,o){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=r,this.foreground=s,this.background=o}},T=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(T||{});function ln(n,e){n.sort((a,l)=>{let d=bt(a.scope,l.scope);return d!==0||(d=_t(a.parentScopes,l.parentScopes),d!==0)?d:a.index-l.index});let t=0,r="#000000",s="#ffffff";for(;n.length>=1&&n[0].scope==="";){let a=n.shift();a.fontStyle!==-1&&(t=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new un(e),i=new St(t,o.getId(r),o.getId(s)),c=new fn(new Ee(0,null,-1,0,0),[]);for(let a=0,l=n.length;a<l;a++){let d=n[a];c.insert(0,d.scope,d.parentScopes,d.fontStyle,o.getId(d.foreground),o.getId(d.background))}return new ae(o,i,c)}var un=class{constructor(n){g(this,"_isFrozen");g(this,"_lastColorId");g(this,"_id2color");g(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},dn=Object.freeze([]),Ee=class wt{constructor(e,t,r,s,o){g(this,"scopeDepth");g(this,"parentScopes");g(this,"fontStyle");g(this,"foreground");g(this,"background");this.scopeDepth=e,this.parentScopes=t||dn,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new wt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let r=0,s=e.length;r<s;r++)t[r]=e[r].clone();return t}acceptOverwrite(e,t,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},fn=class Pe{constructor(e,t=[],r={}){g(this,"_rulesWithParentScopes");this._mainRule=e,this._children=r,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,t.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=t.parentScopes.length);){const o=t.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Pe._cmpBySpecificity),t}insert(e,t,r,s,o,i){if(t===""){this._doInsertHere(e,r,s,o,i);return}let c=t.indexOf("."),a,l;c===-1?(a=t,l=""):(a=t.substring(0,c),l=t.substring(c+1));let d;this._children.hasOwnProperty(a)?d=this._children[a]:(d=new Pe(this._mainRule.clone(),Ee.cloneArr(this._rulesWithParentScopes)),this._children[a]=d),d.insert(e+1,l,r,s,o,i)}_doInsertHere(e,t,r,s,o){if(t===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,c=this._rulesWithParentScopes.length;i<c;i++){let a=this._rulesWithParentScopes[i];if(_t(a.parentScopes,t)===0){a.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Ee(e,t,r,s,o))}},q=class E{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=E.getLanguageId(e),r=E.getTokenType(e),s=E.getFontStyle(e),o=E.getForeground(e),i=E.getBackground(e);console.log({languageId:t,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,t,r,s,o,i,c){let a=E.getLanguageId(e),l=E.getTokenType(e),d=E.containsBalancedBrackets(e)?1:0,u=E.getFontStyle(e),f=E.getForeground(e),h=E.getBackground(e);return t!==0&&(a=t),r!==8&&(l=r),s!==null&&(d=s?1:0),o!==-1&&(u=o),i!==0&&(f=i),c!==0&&(h=c),(a<<0|l<<8|d<<10|u<<11|f<<15|h<<24)>>>0}};function ce(n,e){const t=[],r=hn(n);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(t.push({matcher:l,priority:a}),s!==",")break;s=r.next()}return t;function o(){if(s==="-"){s=r.next();const a=o();return l=>!!a&&!a(l)}if(s==="("){s=r.next();const a=c();return s===")"&&(s=r.next()),a}if(Xe(s)){const a=[];do a.push(s),s=r.next();while(Xe(s));return l=>e(a,l)}return null}function i(){const a=[];let l=o();for(;l;)a.push(l),l=o();return d=>a.every(u=>u(d))}function c(){const a=[];let l=i();for(;l&&(a.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return d=>a.some(u=>u(d))}}function Xe(n){return!!n&&!!n.match(/[\w\.:]+/)}function hn(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const r=t[0];return t=e.exec(n),r}}}function Ct(n){typeof n.dispose=="function"&&n.dispose()}var Q=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},gn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},pn=class{constructor(){g(this,"_references",[]);g(this,"_seenReferenceKeys",new Set);g(this,"visitedRule",new Set)}get references(){return this._references}add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},mn=class{constructor(n,e){g(this,"seenFullScopeRequests",new Set);g(this,"seenPartialScopeRequests",new Set);g(this,"Q");this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Q(this.initialScopeName)]}processQueue(){const n=this.Q;this.Q=[];const e=new pn;for(const t of n)bn(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof Q){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function bn(n,e,t,r){const s=t.lookup(n.scopeName);if(!s){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=t.lookup(e);n instanceof Q?ie({baseGrammar:o,selfGrammar:s},r):Le(n.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=t.injections(n.scopeName);if(i)for(const c of i)r.add(new Q(c))}function Le(n,e,t){if(e.repository&&e.repository[n]){const r=e.repository[n];le([r],e,t)}}function ie(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&le(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&le(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function le(n,e,t){for(const r of n){if(t.visitedRule.has(r))continue;t.visitedRule.add(r);const s=r.repository?pt({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&le(r.patterns,{...e,repository:s},t);const o=r.include;if(!o)continue;const i=vt(o);switch(i.kind){case 0:ie({...e,selfGrammar:e.baseGrammar},t);break;case 1:ie(e,t);break;case 2:Le(i.ruleName,{...e,repository:s},t);break;case 3:case 4:const c=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const a={baseGrammar:e.baseGrammar,selfGrammar:c,repository:s};i.kind===4?Le(i.ruleName,a,t):ie(a,t)}else i.kind===4?t.add(new gn(i.scopeName,i.ruleName)):t.add(new Q(i.scopeName));break}}}var _n=class{constructor(){g(this,"kind",0)}},yn=class{constructor(){g(this,"kind",1)}},kn=class{constructor(n){g(this,"kind",2);this.ruleName=n}},Sn=class{constructor(n){g(this,"kind",3);this.scopeName=n}},wn=class{constructor(n,e){g(this,"kind",4);this.scopeName=n,this.ruleName=e}};function vt(n){if(n==="$base")return new _n;if(n==="$self")return new yn;const e=n.indexOf("#");if(e===-1)return new Sn(n);if(e===0)return new kn(n.substring(1));{const t=n.substring(0,e),r=n.substring(e+1);return new wn(t,r)}}var Cn=/\\(\d+)/,Ze=/\\(\d+)/g,vn=-1,Bt=-2;var ee=class{constructor(n,e,t,r){g(this,"$location");g(this,"id");g(this,"_nameIsCapturing");g(this,"_name");g(this,"_contentNameIsCapturing");g(this,"_contentName");this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=te.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=te.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${mt(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:te.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:te.replaceCaptures(this._contentName,n,e)}},Bn=class extends ee{constructor(e,t,r,s,o){super(e,t,r,s);g(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,r,s){throw new Error("Not supported!")}},Rn=class extends ee{constructor(e,t,r,s,o){super(e,t,r,null);g(this,"_match");g(this,"captures");g(this,"_cachedCompiledPatterns");this._match=new J(s,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},et=class extends ee{constructor(e,t,r,s,o){super(e,t,r,s);g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const r of this.patterns)e.getRule(r).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ge=class extends ee{constructor(e,t,r,s,o,i,c,a,l,d){super(e,t,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"_end");g(this,"endHasBackReferences");g(this,"endCaptures");g(this,"applyEndPatternLast");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this._begin=new J(o,this.id),this.beginCaptures=i,this._end=new J(c||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=d.patterns,this.hasMissingPatterns=d.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,r,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const r of this.patterns)e.getRule(r).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},ue=class extends ee{constructor(e,t,r,s,o,i,c,a,l){super(e,t,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"whileCaptures");g(this,"_while");g(this,"whileHasBackReferences");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");g(this,"_cachedCompiledWhilePatterns");this._begin=new J(o,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new J(c,Bt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,r,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,r,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new X,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Rt=class A{static createCaptureRule(e,t,r,s,o){return e.registerRule(i=>new Bn(t,i,r,s,o))}static getCompiledRuleId(e,t,r){return e.id||t.registerRule(s=>{if(e.id=s,e.match)return new Rn(e.$vscodeTextmateLocation,e.id,e.name,e.match,A._compileCaptures(e.captures,t,r));if(typeof e.begin>"u"){e.repository&&(r=pt({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new et(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,A._compilePatterns(o,t,r))}return e.while?new ue(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,A._compileCaptures(e.beginCaptures||e.captures,t,r),e.while,A._compileCaptures(e.whileCaptures||e.captures,t,r),A._compilePatterns(e.patterns,t,r)):new Ge(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,A._compileCaptures(e.beginCaptures||e.captures,t,r),e.end,A._compileCaptures(e.endCaptures||e.captures,t,r),e.applyEndPatternLast,A._compilePatterns(e.patterns,t,r))}),e.id}static _compileCaptures(e,t,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);c>o&&(o=c)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);let a=0;e[i].patterns&&(a=A.getCompiledRuleId(e[i],t,r)),s[c]=A.createCaptureRule(t,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,a)}}return s}static _compilePatterns(e,t,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const c=e[o];let a=-1;if(c.include){const l=vt(c.include);switch(l.kind){case 0:case 1:a=A.getCompiledRuleId(r[c.include],t,r);break;case 2:let d=r[l.ruleName];d&&(a=A.getCompiledRuleId(d,t,r));break;case 3:case 4:const u=l.scopeName,f=l.kind===4?l.ruleName:null,h=t.getExternalGrammar(u,r);if(h)if(f){let p=h.repository[f];p&&(a=A.getCompiledRuleId(p,t,h.repository))}else a=A.getCompiledRuleId(h.repository.$self,t,h.repository);break}}else a=A.getCompiledRuleId(c,t,r);if(a!==-1){const l=t.getRule(a);let d=!1;if((l instanceof et||l instanceof Ge||l instanceof ue)&&l.hasMissingPatterns&&l.patterns.length===0&&(d=!0),d)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},J=class Nt{constructor(e,t){g(this,"source");g(this,"ruleId");g(this,"hasAnchor");g(this,"hasBackReferences");g(this,"_anchorCache");if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let c=0;c<r;c++)if(e.charAt(c)==="\\"&&c+1<r){const l=e.charAt(c+1);l==="z"?(o.push(e.substring(s,c)),o.push("$(?!\\n)(?<!\\n)"),s=c+2):(l==="A"||l==="G")&&(i=!0),c++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source=="string"?this.hasBackReferences=Cn.test(this.source):this.hasBackReferences=!1}clone(){return new Nt(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=t.map(s=>e.substring(s.start,s.end));return Ze.lastIndex=0,this.source.replace(Ze,(s,o)=>yt(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],r=[],s=[],o,i,c,a;for(o=0,i=this.source.length;o<i;o++)c=this.source.charAt(o),e[o]=c,t[o]=c,r[o]=c,s[o]=c,c==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(e[o+1]="￿",t[o+1]="￿",r[o+1]="A",s[o+1]="A"):a==="G"?(e[o+1]="￿",t[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=a,t[o+1]=a,r[o+1]=a,s[o+1]=a),o++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},X=class{constructor(){g(this,"_items");g(this,"_hasAnchors");g(this,"_cached");g(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new tt(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let r=this._items.map(s=>s.resolveAnchors(e,t));return new tt(n,r,this._items.map(s=>s.ruleId))}},tt=class{constructor(n,e,t){g(this,"scanner");this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
2
2
  `)}findNextMatchSync(n,e,t){const r=this.scanner.findNextMatchSync(n,e,t);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ne=class{constructor(n,e){this.languageId=n,this.tokenType=e}},M,Nn=(M=class{constructor(e,t){g(this,"_defaultAttributes");g(this,"_embeddedLanguagesMatcher");g(this,"_getBasicScopeAttributes",new kt(e=>{const t=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Ne(t,r)}));this._defaultAttributes=new Ne(e,8),this._embeddedLanguagesMatcher=new An(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?M._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(M.STANDARD_TOKEN_TYPE_REGEXP);if(!t)return 8;switch(t[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},g(M,"_NULL_SCOPE_METADATA",new Ne(0,0)),g(M,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),M),An=class{constructor(n){g(this,"values");g(this,"scopesRegExp");if(n.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(n);const e=n.map(([t,r])=>yt(t));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(n){if(!this.scopesRegExp)return;const e=n.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},nt=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function At(n,e,t,r,s,o,i,c){const a=e.content.length;let l=!1,d=-1;if(i){const h=Tn(n,e,t,r,s,o);s=h.stack,r=h.linePos,t=h.isFirstLine,d=h.anchorPosition}const u=Date.now();for(;!l;){if(c!==0&&Date.now()-u>c)return new nt(s,!0);f()}return new nt(s,!1);function f(){const h=In(n,e,t,r,s,d);if(!h){o.produce(s,a),l=!0;return}const p=h.captureIndices,k=h.matchedRuleId,y=p&&p.length>0?p[0].end>r:!1;if(k===vn){const _=s.getRule(n);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),K(n,e,t,s,o,_.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,d=m.getAnchorPos(),!y&&m.getEnterPos()===r){s=m,o.produce(s,a),l=!0;return}}else{const _=n.getRule(k);o.produce(s,p[0].start);const m=s,b=_.getName(e.content,p),w=s.contentNameScopesList.pushAttributed(b,n);if(s=s.push(k,r,d,p[0].end===a,null,w,w),_ instanceof Ge){const S=_;K(n,e,t,s,o,S.beginCaptures,p),o.produce(s,p[0].end),d=p[0].end;const C=S.getContentName(e.content,p),I=w.pushAttributed(C,n);if(s=s.withContentNameScopesList(I),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,p))),!y&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),l=!0;return}}else if(_ instanceof ue){const S=_;K(n,e,t,s,o,S.beginCaptures,p),o.produce(s,p[0].end),d=p[0].end;const C=S.getContentName(e.content,p),I=w.pushAttributed(C,n);if(s=s.withContentNameScopesList(I),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,p))),!y&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),l=!0;return}}else if(K(n,e,t,s,o,_.captures,p),o.produce(s,p[0].end),s=s.pop(),!y){s=s.safePop(),o.produce(s,a),l=!0;return}}p[0].end>r&&(r=p[0].end,t=!1)}}function Tn(n,e,t,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const c=[];for(let a=s;a;a=a.pop()){const l=a.getRule(n);l instanceof ue&&c.push({rule:l,stack:a})}for(let a=c.pop();a;a=c.pop()){const{ruleScanner:l,findOptions:d}=Pn(a.rule,n,a.stack.endRule,t,r===i),u=l.findNextMatchSync(e,r,d);if(u){if(u.ruleId!==Bt){s=a.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(a.stack,u.captureIndices[0].start),K(n,e,t,a.stack,o,a.rule.whileCaptures,u.captureIndices),o.produce(a.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,t=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:t}}function In(n,e,t,r,s,o){const i=xn(n,e,t,r,s,o),c=n.getInjections();if(c.length===0)return i;const a=En(c,n,e,t,r,s,o);if(!a)return i;if(!i)return a;const l=i.captureIndices[0].start,d=a.captureIndices[0].start;return d<l||a.priorityMatch&&d===l?a:i}function xn(n,e,t,r,s,o){const i=s.getRule(n),{ruleScanner:c,findOptions:a}=Tt(i,n,s.endRule,t,r===o),l=c.findNextMatchSync(e,r,a);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function En(n,e,t,r,s,o,i){let c=Number.MAX_VALUE,a=null,l,d=0;const u=o.contentNameScopesList.getScopeNames();for(let f=0,h=n.length;f<h;f++){const p=n[f];if(!p.matcher(u))continue;const k=e.getRule(p.ruleId),{ruleScanner:y,findOptions:_}=Tt(k,e,null,r,s===i),m=y.findNextMatchSync(t,s,_);if(!m)continue;const b=m.captureIndices[0].start;if(!(b>=c)&&(c=b,a=m.captureIndices,l=m.ruleId,d=p.priority,c===s))break}return a?{priorityMatch:d===-1,captureIndices:a,matchedRuleId:l}:null}function Tt(n,e,t,r,s){return{ruleScanner:n.compileAG(e,t,r,s),findOptions:0}}function Pn(n,e,t,r,s){return{ruleScanner:n.compileWhileAG(e,t,r,s),findOptions:0}}function K(n,e,t,r,s,o,i){if(o.length===0)return;const c=e.content,a=Math.min(o.length,i.length),l=[],d=i[0].end;for(let u=0;u<a;u++){const f=o[u];if(f===null)continue;const h=i[u];if(h.length===0)continue;if(h.start>d)break;for(;l.length>0&&l[l.length-1].endPos<=h.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,h.start):s.produce(r,h.start),f.retokenizeCapturedWithRuleId){const k=f.getName(c,i),y=r.contentNameScopesList.pushAttributed(k,n),_=f.getContentName(c,i),m=y.pushAttributed(_,n),b=r.push(f.retokenizeCapturedWithRuleId,h.start,-1,!1,null,y,m),w=n.createOnigString(c.substring(0,h.end));At(n,w,t&&h.start===0,h.start,b,s,!1,0),Ct(w);continue}const p=f.getName(c,i);if(p!==null){const y=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,n);l.push(new Ln(y,h.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Ln=class{constructor(n,e){g(this,"scopes");g(this,"endPos");this.scopes=n,this.endPos=e}};function Gn(n,e,t,r,s,o,i,c){return new Mn(n,e,t,r,s,o,i,c)}function rt(n,e,t,r,s){const o=ce(e,de),i=Rt.getCompiledRuleId(t,r,s.repository);for(const c of o)n.push({debugSelector:e,matcher:c.matcher,ruleId:i,grammar:s,priority:c.priority})}function de(n,e){if(e.length<n.length)return!1;let t=0;return n.every(r=>{for(let s=t;s<e.length;s++)if(On(e[s],r))return t=s+1,!0;return!1})}function On(n,e){if(!n)return!1;if(n===e)return!0;const t=e.length;return n.length>t&&n.substr(0,t)===e&&n[t]==="."}var Mn=class{constructor(n,e,t,r,s,o,i,c){g(this,"_rootId");g(this,"_lastRuleId");g(this,"_ruleId2desc");g(this,"_includedGrammars");g(this,"_grammarRepository");g(this,"_grammar");g(this,"_injections");g(this,"_basicScopeAttributesProvider");g(this,"_tokenTypeMatchers");if(this._rootScopeName=n,this.balancedBracketSelectors=o,this._onigLib=c,this._basicScopeAttributesProvider=new Nn(t,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=st(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const l=ce(a,de);for(const d of l)this._tokenTypeMatchers.push({matcher:d.matcher,type:s[a]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const n of this._ruleId2desc)n&&n.dispose()}createOnigScanner(n){return this._onigLib.createOnigScanner(n)}createOnigString(n){return this._onigLib.createOnigString(n)}getMetadataForScope(n){return this._basicScopeAttributesProvider.getBasicScopeAttributes(n)}_collectInjections(){const n={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],t=this._rootScopeName,r=n.lookup(t);if(r){const s=r.injections;if(s)for(let i in s)rt(e,i,s[i],this,r);const o=this._grammarRepository.injections(t);o&&o.forEach(i=>{const c=this.getExternalGrammar(i);if(c){const a=c.injectionSelector;a&&rt(e,a,c,this,c)}})}return e.sort((s,o)=>s.priority-o.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(n){const e=++this._lastRuleId,t=n(e);return this._ruleId2desc[e]=t,t}getRule(n){return this._ruleId2desc[n]}getExternalGrammar(n,e){if(this._includedGrammars[n])return this._includedGrammars[n];if(this._grammarRepository){const t=this._grammarRepository.lookup(n);if(t)return this._includedGrammars[n]=st(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const r=this._tokenize(n,e,!1,t);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(n,e,t=0){const r=this._tokenize(n,e,!0,t);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(n,e,t,r){this._rootId===-1&&(this._rootId=Rt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Oe.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),d=this.themeProvider.getDefaults(),u=q.set(0,l.languageId,l.tokenType,null,d.fontStyle,d.foregroundId,d.backgroundId),f=this.getRule(this._rootId).getName(null,null);let h;f?h=Y.createRootAndLookUpScopeName(f,u,this):h=Y.createRoot("unknown",u),e=new Oe(null,this._rootId,-1,-1,!1,null,h,h)}else s=!1,e.reset();n=n+`
3
3
  `;const o=this.createOnigString(n),i=o.content.length,c=new $n(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),a=At(this,o,s,0,e,c,!0,r);return Ct(o),{lineLength:i,lineTokens:c,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function st(n,e){return n=tn(n),n.repository=n.repository||{},n.repository.$self={$vscodeTextmateLocation:n.$vscodeTextmateLocation,patterns:n.patterns,name:n.scopeName},n.repository.$base=e||n.repository.$self,n}var Y=class L{constructor(e,t,r){this.parent=e,this.scopePath=t,this.tokenAttributes=r}static fromExtension(e,t){let r=e,s=(e==null?void 0:e.scopePath)??null;for(const o of t)s=Re.push(s,o.scopeNames),r=new L(r,s,o.encodedTokenAttributes);return r}static createRoot(e,t){return new L(null,new Re(null,e),t)}static createRootAndLookUpScopeName(e,t,r){const s=r.getMetadataForScope(e),o=new Re(null,e),i=r.themeProvider.themeMatch(o),c=L.mergeAttributes(t,s,i);return new L(null,o,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return L.equals(this,e)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),q.set(e,t.languageId,t.tokenType,null,s,o,i)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return L._pushAttributed(this,e,t);const r=e.split(/ /g);let s=this;for(const o of r)s=L._pushAttributed(s,o,t);return s}static _pushAttributed(e,t,r){const s=r.getMetadataForScope(t),o=e.scopePath.push(t),i=r.themeProvider.themeMatch(o),c=L.mergeAttributes(e.tokenAttributes,s,i);return new L(e,o,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const t=[];let r=this;for(;r&&r!==e;)t.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===e?t.reverse():void 0}},P,Oe=(P=class{constructor(e,t,r,s,o,i,c,a){g(this,"_stackElementBrand");g(this,"_enterPos");g(this,"_anchorPos");g(this,"depth");this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=c,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(e){return e===null?!1:P._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Y.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){P._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,r,s,o,i,c){return new P(this,e,t,r,s,o,i,c)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){var r,s;return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new P(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){var e,t,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((t=this.nameScopesList)==null?void 0:t.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,t){const r=Y.fromExtension((e==null?void 0:e.nameScopesList)??null,t.nameScopesList);return new P(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,r,Y.fromExtension(r,t.contentNameScopesList))}},g(P,"NULL",new P(null,0,0,0,!1,null,null,null)),P),Fn=class{constructor(n,e){g(this,"balancedBracketScopes");g(this,"unbalancedBracketScopes");g(this,"allowAny",!1);this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):ce(t,de).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>ce(t,de).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(n){for(const e of this.unbalancedBracketScopes)if(e(n))return!1;for(const e of this.balancedBracketScopes)if(e(n))return!0;return this.allowAny}},$n=class{constructor(n,e,t,r){g(this,"_emitBinaryTokens");g(this,"_lineText");g(this,"_tokens");g(this,"_binaryTokens");g(this,"_lastTokenEndIndex");g(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=n,this._tokenTypeOverrides=t,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(n,e){this.produceFromScopes(n.contentNameScopesList,e)}produceFromScopes(n,e){var r;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(n==null?void 0:n.tokenAttributes)??0,o=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(n==null?void 0:n.getScopeNames())??[];for(const c of this._tokenTypeOverrides)c.matcher(i)&&(s=q.set(s,0,c.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(i))}if(o&&(s=q.set(s,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const t=(n==null?void 0:n.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:t}),this._lastTokenEndIndex=e}getResult(n,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(n,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._binaryTokens[this._binaryTokens.length-2]=0);const t=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)t[r]=this._binaryTokens[r];return t}},jn=class{constructor(n,e){g(this,"_grammars",new Map);g(this,"_rawGrammars",new Map);g(this,"_injectionGrammars",new Map);g(this,"_theme");this._onigLib=e,this._theme=n}dispose(){for(const n of this._grammars.values())n.dispose()}setTheme(n){this._theme=n}getColorMap(){return this._theme.getColorMap()}addGrammar(n,e){this._rawGrammars.set(n.scopeName,n),e&&this._injectionGrammars.set(n.scopeName,e)}lookup(n){return this._rawGrammars.get(n)}injections(n){return this._injectionGrammars.get(n)}getDefaults(){return this._theme.getDefaults()}themeMatch(n){return this._theme.match(n)}grammarForScopeName(n,e,t,r,s){if(!this._grammars.has(n)){let o=this._rawGrammars.get(n);if(!o)return null;this._grammars.set(n,Gn(n,o,e,t,r,s,this,this._onigLib))}return this._grammars.get(n)}},Hn=class{constructor(e){g(this,"_options");g(this,"_syncRegistry");g(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new jn(ae.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(ae.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,r){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,t,r){return this._loadGrammar(e,t,r.embeddedLanguages,r.tokenTypes,new Fn(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,r,s,o){const i=new mn(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(c=>this._loadSingleGrammar(c.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,r)}}addGrammar(e,t=[],r=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,t=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,r,s,o)}},Me=Oe.NULL;function fe(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},r=typeof n=="string"?n:n.name;for(const[s,o]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof o=="string"?t[s]=o:s===r&&Object.assign(t,o);return t}function $(n,e){return n&&((e==null?void 0:e[n==null?void 0:n.toLowerCase()])||n)}function Dn(n){return Array.isArray(n)?n:[n]}async function It(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function be(n){return!n||["plaintext","txt","text","plain"].includes(n)}function Wn(n){return n==="ansi"||be(n)}function _e(n){return n==="none"}function Un(n){return _e(n)}function ye(n,e=!1){var o;if(n.length===0)return[["",0]];const t=n.split(/(\r?\n)/g);let r=0;const s=[];for(let i=0;i<t.length;i+=2){const c=e?t[i]+(t[i+1]||""):t[i];s.push([c,r]),r+=t[i].length,r+=((o=t[i+1])==null?void 0:o.length)||0}return s}const ot={light:"#333333",dark:"#bbbbbb"},it={light:"#fffffe",dark:"#1e1e1e"},at="__shiki_resolved";function We(n){var c,a,l,d,u;if(n!=null&&n[at])return n;const e={...n};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:t,fg:r}=e;if(!t||!r){const f=e.settings?e.settings.find(h=>!h.name&&!h.scope):void 0;(c=f==null?void 0:f.settings)!=null&&c.foreground&&(r=f.settings.foreground),(a=f==null?void 0:f.settings)!=null&&a.background&&(t=f.settings.background),!r&&((l=e==null?void 0:e.colors)!=null&&l["editor.foreground"])&&(r=e.colors["editor.foreground"]),!t&&((d=e==null?void 0:e.colors)!=null&&d["editor.background"])&&(t=e.colors["editor.background"]),r||(r=e.type==="light"?ot.light:ot.dark),t||(t=e.type==="light"?it.light:it.dark),e.fg=r,e.bg=t}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(f){var p;if(o.has(f))return o.get(f);s+=1;const h=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(p=e.colorReplacements)!=null&&p[`#${h}`]?i(f):(o.set(f,h),h)}e.settings=e.settings.map(f=>{var y,_;const h=((y=f.settings)==null?void 0:y.foreground)&&!f.settings.foreground.startsWith("#"),p=((_=f.settings)==null?void 0:_.background)&&!f.settings.background.startsWith("#");if(!h&&!p)return f;const k={...f,settings:{...f.settings}};if(h){const m=i(f.settings.foreground);e.colorReplacements[m]=f.settings.foreground,k.settings.foreground=m}if(p){const m=i(f.settings.background);e.colorReplacements[m]=f.settings.background,k.settings.background=m}return k});for(const f of Object.keys(e.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((u=e.colors[f])!=null&&u.startsWith("#"))){const h=i(e.colors[f]);e.colorReplacements[h]=e.colors[f],e.colors[f]=h}return Object.defineProperty(e,at,{enumerable:!1,writable:!1,value:!0}),e}async function xt(n){return Array.from(new Set((await Promise.all(n.filter(e=>!Wn(e)).map(async e=>await It(e).then(t=>Array.isArray(t)?t:[t])))).flat()))}async function Et(n){return(await Promise.all(n.map(async e=>Un(e)?null:We(await It(e))))).filter(e=>!!e)}function Pt(n,e){if(!e)return n;if(e[n]){const t=new Set([n]);for(;e[n];){if(n=e[n],t.has(n))throw new v(`Circular alias \`${Array.from(t).join(" -> ")} -> ${n}\``);t.add(n)}}return n}var qn=class extends Hn{constructor(e,t,r,s={}){super(e);g(this,"_resolvedThemes",new Map);g(this,"_resolvedGrammars",new Map);g(this,"_langMap",new Map);g(this,"_langGraph",new Map);g(this,"_textmateThemeCache",new WeakMap);g(this,"_loadedThemesCache",null);g(this,"_loadedLanguagesCache",null);this._resolver=e,this._themes=t,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=We(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=ae.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Pt(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){var o,i,c,a;if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(l=>{var d;return(d=l.embeddedLangsLazy)==null?void 0:d.includes(e.name)}));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(l=>{this._alias[l]=e.name}),this._loadedLanguagesCache=null,t.size)for(const l of t)this._resolvedGrammars.delete(l.name),this._loadedLanguagesCache=null,(i=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||i.delete(l.scopeName),(a=(c=this._syncRegistry)==null?void 0:c._grammars)==null||a.delete(l.scopeName),this.loadLanguage(this._langMap.get(l.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const t=Array.from(this._langGraph.entries()),r=t.filter(([s,o])=>!o);if(r.length){const s=t.filter(([o,i])=>{var c;return i?(c=i.embeddedLanguages||i.embeddedLangs)==null?void 0:c.some(a=>r.map(([l])=>l).includes(a)):!1}).filter(o=>!r.includes(o));throw new v(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of t)this._resolver.addLanguage(o);for(const[s,o]of t)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const r of t)this._langGraph.set(r,this._langMap.get(r))}},zn=class{constructor(n,e){g(this,"_langs",new Map);g(this,"_scopeToLang",new Map);g(this,"_injections",new Map);g(this,"_onigLib");this._onigLib={createOnigScanner:t=>n.createScanner(t),createOnigString:t=>n.createString(t)},e.forEach(t=>this.addLanguage(t))}get onigLib(){return this._onigLib}getLangRegistration(n){return this._langs.get(n)}loadGrammar(n){return this._scopeToLang.get(n)}addLanguage(n){this._langs.set(n.name,n),n.aliases&&n.aliases.forEach(e=>{this._langs.set(e,n)}),this._scopeToLang.set(n.scopeName,n),n.injectTo&&n.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(n.scopeName)})}getInjections(n){const e=n.split(".");let t=[];for(let r=1;r<=e.length;r++){const s=e.slice(0,r).join(".");t=[...t,...this._injections.get(s)||[]]}return t}};let V=0;function Vn(n){V+=1,n.warnings!==!1&&V>=10&&V%10===0&&console.warn(`[Shiki] ${V} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!n.engine)throw new v("`engine` option is required for synchronous mode");const t=(n.langs||[]).flat(1),r=(n.themes||[]).flat(1).map(We),s=new qn(new zn(n.engine,t),r,t,n.langAlias);let o;function i(m){return Pt(m,n.langAlias)}function c(m){y();const b=s.getGrammar(typeof m=="string"?m:m.name);if(!b)throw new v(`Language \`${m}\` not found, you may need to load it first`);return b}function a(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};y();const b=s.getTheme(m);if(!b)throw new v(`Theme \`${m}\` not found, you may need to load it first`);return b}function l(m){y();const b=a(m);return o!==m&&(s.setTheme(b),o=m),{theme:b,colorMap:s.getColorMap()}}function d(){return y(),s.getLoadedThemes()}function u(){return y(),s.getLoadedLanguages()}function f(...m){y(),s.loadLanguages(m.flat(1))}async function h(...m){return f(await xt(m))}function p(...m){y();for(const b of m.flat(1))s.loadTheme(b)}async function k(...m){return y(),p(await Et(m))}function y(){if(e)throw new v("Shiki instance has been disposed")}function _(){e||(e=!0,s.dispose(),V-=1)}return{setTheme:l,getTheme:a,getLanguage:c,getLoadedThemes:d,getLoadedLanguages:u,resolveLangAlias:i,loadLanguage:h,loadLanguageSync:f,loadTheme:k,loadThemeSync:p,dispose:_,[Symbol.dispose]:_}}async function Kn(n){n.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,t,r]=await Promise.all([Et(n.themes||[]),xt(n.langs||[]),n.engine]);return Vn({...n,themes:e,langs:t,engine:r})}const Lt=new WeakMap;function ke(n,e){Lt.set(n,e)}function Z(n){return Lt.get(n)}var Se=class Gt{constructor(...e){g(this,"_stacks",{});g(this,"lang");if(e.length===2){const[t,r]=e;this.lang=r,this._stacks=t}else{const[t,r,s]=e;this.lang=r,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new Gt(Object.fromEntries(Dn(t).map(r=>[r,Me])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Yn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Yn(n){const e=[],t=new Set;function r(s){var i;if(t.has(s))return;t.add(s);const o=(i=s==null?void 0:s.nameScopesList)==null?void 0:i.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(n),e}function Qn(n,e){if(!(n instanceof Se))throw new v("Invalid grammar state");return n.getInternalStack(e)}function Ot(n,e,t={}){const{theme:r=n.getLoadedThemes()[0]}=t;if(be(n.resolveLangAlias(t.lang||"text"))||_e(r))return ye(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:s,colorMap:o}=n.setTheme(r),i=n.getLanguage(t.lang||"text");if(t.grammarState){if(t.grammarState.lang!==i.name)throw new v(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${i.name}"`);if(!t.grammarState.themes.includes(s.name))throw new v(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Xn(e,i,s,o,t)}function Jn(...n){if(n.length===2)return Z(n[1]);const[e,t,r={}]=n,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(be(s)||_e(o))throw new v("Plain language does not have grammar state");if(s==="ansi")throw new v("ANSI language does not have grammar state");const{theme:i,colorMap:c}=e.setTheme(o),a=e.getLanguage(s);return new Se(Ue(t,a,i,c,r).stateStack,a.name,i.name)}function Xn(n,e,t,r,s){const o=Ue(n,e,t,r,s),i=new Se(o.stateStack,e.name,t.name);return ke(o.tokens,i),o.tokens}function Ue(n,e,t,r,s){const o=fe(t,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:c=500}=s,a=ye(n);let l=s.grammarState?Qn(s.grammarState,t.name)??Me:s.grammarContextCode!=null?Ue(s.grammarContextCode,e,t,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Me,d=[];const u=[];for(let f=0,h=a.length;f<h;f++){const[p,k]=a[f];if(p===""){d=[],u.push([]);continue}if(i>0&&p.length>=i){d=[],u.push([{content:p,offset:k,color:"",fontStyle:0}]);continue}let y,_,m;s.includeExplanation&&(y=e.tokenizeLine(p,l,c),_=y.tokens,m=0);const b=e.tokenizeLine2(p,l,c),w=b.tokens.length/2;for(let S=0;S<w;S++){const C=b.tokens[2*S],I=S+1<w?b.tokens[2*S+2]:p.length;if(C===I)continue;const z=b.tokens[2*S+1],x=$(r[q.getForeground(z)],o),F=q.getFontStyle(z),H={content:p.substring(C,I),offset:k+C,color:x,fontStyle:F};if(s.includeExplanation){const D=[];if(s.includeExplanation!=="scopeName")for(const O of t.settings){let W;switch(typeof O.scope){case"string":W=O.scope.split(/,/).map(ve=>ve.trim());break;case"object":W=O.scope;break;default:continue}D.push({settings:O,selectors:W.map(ve=>ve.split(/ /))})}H.explanation=[];let Ke=0;for(;C+Ke<I;){const O=_[m],W=p.substring(O.startIndex,O.endIndex);Ke+=W.length,H.explanation.push({content:W,scopes:s.includeExplanation==="scopeName"?Zn(O.scopes):er(D,O.scopes)}),m+=1}}d.push(H)}u.push(d),d=[],l=b.ruleStack}return{tokens:u,stateStack:l}}function Zn(n){return n.map(e=>({scopeName:e}))}function er(n,e){const t=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];t[r]={scopeName:o,themeMatches:nr(n,o,e.slice(0,r))}}return t}function ct(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function tr(n,e,t){if(!ct(n[n.length-1],e))return!1;let r=n.length-2,s=t.length-1;for(;r>=0&&s>=0;)ct(n[r],t[s])&&(r-=1),s-=1;return r===-1}function nr(n,e,t){const r=[];for(const{selectors:s,settings:o}of n)for(const i of s)if(tr(i,e,t)){r.push(o);break}return r}function Mt(n,e,t,r=Ot){const s=Object.entries(t.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const d=r(n,e,{...t,theme:l.theme});return{tokens:d,state:Z(d),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),i=rr(...o.map(l=>l.tokens)),c=i[0].map((l,d)=>l.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(h.explanation=u.explanation),i.forEach((p,k)=>{const{content:y,explanation:_,offset:m,...b}=p[d][f];h.variants[s[k].color]=b}),h})),a=o[0].state?new Se(Object.fromEntries(o.map(l=>{var d;return[l.theme,(d=l.state)==null?void 0:d.getInternalStack(l.theme)]})),o[0].state.lang):void 0;return a&&ke(c,a),c}function rr(...n){const e=n.map(()=>[]),t=n.length;for(let r=0;r<n[0].length;r++){const s=n.map(a=>a[r]),o=e.map(()=>[]);e.forEach((a,l)=>a.push(o[l]));const i=s.map(()=>0),c=s.map(a=>a[0]);for(;c.every(a=>a);){const a=Math.min(...c.map(l=>l.content.length));for(let l=0;l<t;l++){const d=c[l];d.content.length===a?(o[l].push(d),i[l]+=1,c[l]=s[l][i[l]]):(o[l].push({...d,content:d.content.slice(0,a)}),c[l]={...d,content:d.content.slice(a),offset:d.offset+a})}}}return e}const sr=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],or=/["&'<>`]/g,ir=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ar=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,cr=/[|\\{}()[\]^$+*?.]/g,lt=new WeakMap;function lr(n,e){if(n=n.replace(e.subset?ur(e.subset):or,r),e.subset||e.escapeOnly)return n;return n.replace(ir,t).replace(ar,r);function t(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function ur(n){let e=lt.get(n);return e||(e=dr(n),lt.set(n,e)),e}function dr(n){const e=[];let t=-1;for(;++t<n.length;)e.push(n[t].replace(cr,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const fr=/[\dA-Fa-f]/;function hr(n,e,t){const r="&#x"+n.toString(16).toUpperCase();return t&&e&&!fr.test(String.fromCharCode(e))?r:r+";"}const gr=/\d/;function pr(n,e,t){const r="&#"+String(n);return t&&e&&!gr.test(String.fromCharCode(e))?r:r+";"}const mr=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Ae={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},br=["cent","copy","divide","gt","lt","not","para","times"],Ft={}.hasOwnProperty,Fe={};let ne;for(ne in Ae)Ft.call(Ae,ne)&&(Fe[Ae[ne]]=ne);const _r=/[^\dA-Za-z]/;function yr(n,e,t,r){const s=String.fromCharCode(n);if(Ft.call(Fe,s)){const o=Fe[s],i="&"+o;return t&&mr.includes(o)&&!br.includes(o)&&(!r||e&&e!==61&&_r.test(String.fromCharCode(e)))?i:i+";"}return""}function kr(n,e,t){let r=hr(n,e,t.omitOptionalSemicolons),s;if((t.useNamedReferences||t.useShortestReferences)&&(s=yr(n,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!s)&&t.useShortestReferences){const o=pr(n,e,t.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!t.useShortestReferences||s.length<r.length)?s:r}function U(n,e){return lr(n,Object.assign({format:kr},e))}const Sr=/^>|^->|<!--|-->|--!>|<!-$/g,wr=[">"],Cr=["<",">"];function vr(n,e,t,r){return r.settings.bogusComments?"<?"+U(n.value,Object.assign({},r.settings.characterReferences,{subset:wr}))+">":"<!--"+n.value.replace(Sr,s)+"-->";function s(o){return U(o,Object.assign({},r.settings.characterReferences,{subset:Cr}))}}function Br(n,e,t,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const R=jt(1),$t=jt(-1),Rr=[];function jt(n){return e;function e(t,r,s){const o=t?t.children:Rr;let i=(r||0)+n,c=o[i];if(!s)for(;c&&He(c);)i+=n,c=o[i];return c}}const Nr={}.hasOwnProperty;function Ht(n){return e;function e(t,r,s){return Nr.call(n,t.tagName)&&n[t.tagName](t,r,s)}}const qe=Ht({body:Tr,caption:Te,colgroup:Te,dd:Pr,dt:Er,head:Te,html:Ar,li:xr,optgroup:Lr,option:Gr,p:Ir,rp:ut,rt:ut,tbody:Mr,td:dt,tfoot:Fr,th:dt,thead:Or,tr:$r});function Te(n,e,t){const r=R(t,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&He(r.value.charAt(0)))}function Ar(n,e,t){const r=R(t,e);return!r||r.type!=="comment"}function Tr(n,e,t){const r=R(t,e);return!r||r.type!=="comment"}function Ir(n,e,t){const r=R(t,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function xr(n,e,t){const r=R(t,e);return!r||r.type==="element"&&r.tagName==="li"}function Er(n,e,t){const r=R(t,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Pr(n,e,t){const r=R(t,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function ut(n,e,t){const r=R(t,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Lr(n,e,t){const r=R(t,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Gr(n,e,t){const r=R(t,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Or(n,e,t){const r=R(t,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Mr(n,e,t){const r=R(t,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Fr(n,e,t){return!R(t,e)}function $r(n,e,t){const r=R(t,e);return!r||r.type==="element"&&r.tagName==="tr"}function dt(n,e,t){const r=R(t,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const jr=Ht({body:Wr,colgroup:Ur,head:Dr,html:Hr,tbody:qr});function Hr(n){const e=R(n,-1);return!e||e.type!=="comment"}function Dr(n){const e=new Set;for(const r of n.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const t=n.children[0];return!t||t.type==="element"}function Wr(n){const e=R(n,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&He(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Ur(n,e,t){const r=$t(t,e),s=R(n,-1,!0);return t&&r&&r.type==="element"&&r.tagName==="colgroup"&&qe(r,t.children.indexOf(r),t)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function qr(n,e,t){const r=$t(t,e),s=R(n,-1);return t&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&qe(r,t.children.indexOf(r),t)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const re={name:[[`
4
4
  \f\r &/=>`.split(""),`
@@ -1,4 +1,4 @@
1
- import{ba as A,O as b}from"./index-RLb1kuzE.js";const D="http://dkg.io/ontology/",Q="http://www.w3.org/ns/prov#";function x(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object"&&"value"in t){const n=t.value;return n==null?"":String(n)}return String(t)}function $(t){const n=x(t);if(!n)return"";const r=n.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return r?r[1]:n}function Y(t){const n=x(t);if(!n)return"";const r=n.trim();return r.startsWith("<")&&r.endsWith(">")?r.slice(1,-1):r}function K(t,n){return`PREFIX dkg: <${D}>
1
+ import{bc as A,O as b}from"./index-CT-LdpBE.js";const D="http://dkg.io/ontology/",Q="http://www.w3.org/ns/prov#";function x(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="object"&&"value"in t){const n=t.value;return n==null?"":String(n)}return String(t)}function $(t){const n=x(t);if(!n)return"";const r=n.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return r?r[1]:n}function Y(t){const n=x(t);if(!n)return"";const r=n.trim();return r.startsWith("<")&&r.endsWith(">")?r.slice(1,-1):r}function K(t,n){return`PREFIX dkg: <${D}>
2
2
  SELECT ?owner WHERE {
3
3
  GRAPH ?g { <${n}> dkg:workspaceOwner ?owner . }
4
4
  FILTER(
@@ -1 +1 @@
1
- import{ba as T,u as w,bs as v}from"./index-RLb1kuzE.js";const M=["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"],U="http://www.w3.org/ns/prov#wasAttributedTo",I=new Set(["http://dkg.io/ontology/decisions/Decision","http://dkg.io/ontology/tasks/Task","http://dkg.io/ontology/github/PullRequest","http://dkg.io/ontology/github/Issue","http://dkg.io/ontology/github/Commit"]);function g(i){const s=i.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),a=new Date(s);return Number.isFinite(a.getTime())?a:null}function m(i,s,a,o){const r=a?a.toISOString():"no-ts";return o&&o!==s?`${i}|${s}|${o}|${r}`:`${i}|${s}|${r}`}function E(i){for(const s of M){const a=i.properties.get(s);if(a!=null&&a.length)for(const o of a){const r=g(o);if(r)return r}}return null}function G(i){for(const s of i.connections)if(s.predicate===U)return s.targetUri;return null}function S(i){for(const s of i.types)if(I.has(s))return s;return null}function A(i){for(const s of i.subGraphs)if(s!=="meta")return s;return null}function $(i,s={}){const{limit:a=200,agentUri:o,typeIri:r,subGraph:f,includeUndated:e=!0,excludeEvents:t}=s,l=t?[...t].sort().join(","):"";return T.useMemo(()=>{const d=t&&t.length>0?new Set(t):null,n=[];for(const u of i){const c=S(u);if(r&&c!==r)continue;const h=E(u);if(!h&&(!e||!c))continue;const y=G(u);if(o&&y!==o)continue;const b=A(u);if(f&&b!==f)continue;const p=c?"typed":"added";if(d&&d.has(p))continue;const k=m(p,u.uri,h);n.push({id:k,entity:u,at:h,authorUri:y,kindUri:c,subGraph:b,layer:u.trustLevel,event:p,clickable:!0})}return n.sort((u,c)=>u.at&&c.at?c.at.getTime()-u.at.getTime():u.at&&!c.at?-1:!u.at&&c.at?1:u.entity.label.localeCompare(c.entity.label)),{items:n.slice(0,a),hasMore:n.length>a}},[i,a,o,r,f,e,l])}function C(i,s=new Date){const a=n=>{const u=new Date(n);return u.setHours(0,0,0,0),u},o=a(s),r=new Date(o.getTime()-1440*60*1e3),f=new Date(o.getTime()-10080*60*1e3),e={},t=[],l=(n,u,c)=>{e[n]||(e[n]={key:n,label:u,items:[]},t.push(n)),e[n].items.push(c)};for(const n of i){if(!n.at){l("undated","Undated",n);continue}const u=a(n.at);if(u.getTime()===o.getTime())l("today","Today",n);else if(u.getTime()===r.getTime())l("yesterday","Yesterday",n);else if(n.at.getTime()>=f.getTime())l("this-week","Earlier this week",n);else{const c=n.at.toLocaleString(void 0,{month:"long",year:"numeric"});l(`m-${c}`,c,n)}}const d=t.indexOf("undated");return d!==-1&&d<t.length-1&&(t.splice(d,1),t.push("undated")),t.map(n=>e[n])}function D(i,s){const{entitiesByUri:a,agentUri:o,subGraph:r,limit:f=200}=s,e=[];for(const t of i){if(o&&t.agent!==o||r&&t.subGraph!==r)continue;const l=g(t.publishedAt);if(!l)continue;const d=w(t.rootUri),n=a.get(d),u=n!=null;e.push({id:m("promoted",t.opUri,l,d),entity:n??x(d),at:l,authorUri:t.agent,kindUri:null,subGraph:t.subGraph??null,layer:"shared",event:"promoted",clickable:u})}return e.sort((t,l)=>t.at&&l.at?l.at.getTime()-t.at.getTime():t.at&&!l.at?-1:!t.at&&l.at?1:t.entity.label.localeCompare(l.entity.label)),e.slice(0,f)}function x(i){return{uri:i,label:v(i),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function O(i,s={}){const{agentUri:a,subGraph:o,limit:r=200}=s,f=[];for(const e of i){if(a&&e.agentUri!==a||o&&e.subGraph!==o)continue;const t=g(e.publishedAt);if(!t)continue;const l=e.kind==="promoted"?"promoted":"added",d=e.kind==="promoted"?"shared":"working",n=w(e.assertionUri);f.push({id:m(l,e.eventUri,t,n),entity:{uri:n,label:e.assertionName||v(n),types:[],trustLevel:d,layers:new Set([d]),subGraphs:e.subGraph?new Set([e.subGraph]):new Set,properties:new Map,connections:[]},at:t,authorUri:e.agentUri,kindUri:null,subGraph:e.subGraph??null,layer:d,event:l,entityCount:e.entityCount,clickable:!1})}return f.sort((e,t)=>e.at&&t.at?t.at.getTime()-e.at.getTime():e.at&&!t.at?-1:!e.at&&t.at?1:e.entity.label.localeCompare(t.entity.label)),f.slice(0,r)}function N(i,s={}){const{swmEvents:a,lifecycleEvents:o,...r}=s,f=o!=null,t=$(i,{...r,excludeEvents:f?["added"]:void 0});return T.useMemo(()=>{const l=r.limit??200;if(s.typeIri)return{items:t.items,hasMore:t.hasMore};if(!f&&(!a||a.length===0))return{items:t.items,hasMore:t.hasMore};let d;if(f)d=O(o,{agentUri:r.agentUri,subGraph:r.subGraph,limit:Number.POSITIVE_INFINITY});else{const c=new Map;for(const h of i)c.set(h.uri,h);d=D(a,{entitiesByUri:c,agentUri:r.agentUri,subGraph:r.subGraph,limit:Number.POSITIVE_INFINITY})}const n=[...t.items,...d];n.sort((c,h)=>c.at&&h.at?h.at.getTime()-c.at.getTime():c.at&&!h.at?-1:!c.at&&h.at?1:c.entity.label.localeCompare(h.entity.label));const u=t.hasMore||n.length>l;return{items:n.slice(0,l),hasMore:u}},[t,a,o,f,i,r.agentUri,r.subGraph,r.limit,s.typeIri])}function R(i,s=new Date){if(!i)return"—";const a=s.getTime()-i.getTime(),o=Math.abs(a),r=a<0,f=6e4,e=f*60,t=e*24;return o<f?r?"in a moment":"just now":o<e?r?`in ${Math.floor(o/f)}m`:`${Math.floor(o/f)}m ago`:o<t?r?`in ${Math.floor(o/e)}h`:`${Math.floor(o/e)}h ago`:o<7*t?r?`in ${Math.floor(o/t)}d`:`${Math.floor(o/t)}d ago`:i.toLocaleDateString(void 0,{month:"short",day:"numeric"})}export{C as b,R as r,N as u};
1
+ import{bc as T,u as w,bu as v}from"./index-CT-LdpBE.js";const M=["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"],U="http://www.w3.org/ns/prov#wasAttributedTo",I=new Set(["http://dkg.io/ontology/decisions/Decision","http://dkg.io/ontology/tasks/Task","http://dkg.io/ontology/github/PullRequest","http://dkg.io/ontology/github/Issue","http://dkg.io/ontology/github/Commit"]);function g(i){const s=i.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),a=new Date(s);return Number.isFinite(a.getTime())?a:null}function m(i,s,a,o){const r=a?a.toISOString():"no-ts";return o&&o!==s?`${i}|${s}|${o}|${r}`:`${i}|${s}|${r}`}function E(i){for(const s of M){const a=i.properties.get(s);if(a!=null&&a.length)for(const o of a){const r=g(o);if(r)return r}}return null}function G(i){for(const s of i.connections)if(s.predicate===U)return s.targetUri;return null}function S(i){for(const s of i.types)if(I.has(s))return s;return null}function A(i){for(const s of i.subGraphs)if(s!=="meta")return s;return null}function $(i,s={}){const{limit:a=200,agentUri:o,typeIri:r,subGraph:f,includeUndated:e=!0,excludeEvents:t}=s,l=t?[...t].sort().join(","):"";return T.useMemo(()=>{const d=t&&t.length>0?new Set(t):null,n=[];for(const u of i){const c=S(u);if(r&&c!==r)continue;const h=E(u);if(!h&&(!e||!c))continue;const y=G(u);if(o&&y!==o)continue;const b=A(u);if(f&&b!==f)continue;const p=c?"typed":"added";if(d&&d.has(p))continue;const k=m(p,u.uri,h);n.push({id:k,entity:u,at:h,authorUri:y,kindUri:c,subGraph:b,layer:u.trustLevel,event:p,clickable:!0})}return n.sort((u,c)=>u.at&&c.at?c.at.getTime()-u.at.getTime():u.at&&!c.at?-1:!u.at&&c.at?1:u.entity.label.localeCompare(c.entity.label)),{items:n.slice(0,a),hasMore:n.length>a}},[i,a,o,r,f,e,l])}function C(i,s=new Date){const a=n=>{const u=new Date(n);return u.setHours(0,0,0,0),u},o=a(s),r=new Date(o.getTime()-1440*60*1e3),f=new Date(o.getTime()-10080*60*1e3),e={},t=[],l=(n,u,c)=>{e[n]||(e[n]={key:n,label:u,items:[]},t.push(n)),e[n].items.push(c)};for(const n of i){if(!n.at){l("undated","Undated",n);continue}const u=a(n.at);if(u.getTime()===o.getTime())l("today","Today",n);else if(u.getTime()===r.getTime())l("yesterday","Yesterday",n);else if(n.at.getTime()>=f.getTime())l("this-week","Earlier this week",n);else{const c=n.at.toLocaleString(void 0,{month:"long",year:"numeric"});l(`m-${c}`,c,n)}}const d=t.indexOf("undated");return d!==-1&&d<t.length-1&&(t.splice(d,1),t.push("undated")),t.map(n=>e[n])}function D(i,s){const{entitiesByUri:a,agentUri:o,subGraph:r,limit:f=200}=s,e=[];for(const t of i){if(o&&t.agent!==o||r&&t.subGraph!==r)continue;const l=g(t.publishedAt);if(!l)continue;const d=w(t.rootUri),n=a.get(d),u=n!=null;e.push({id:m("promoted",t.opUri,l,d),entity:n??x(d),at:l,authorUri:t.agent,kindUri:null,subGraph:t.subGraph??null,layer:"shared",event:"promoted",clickable:u})}return e.sort((t,l)=>t.at&&l.at?l.at.getTime()-t.at.getTime():t.at&&!l.at?-1:!t.at&&l.at?1:t.entity.label.localeCompare(l.entity.label)),e.slice(0,f)}function x(i){return{uri:i,label:v(i),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function O(i,s={}){const{agentUri:a,subGraph:o,limit:r=200}=s,f=[];for(const e of i){if(a&&e.agentUri!==a||o&&e.subGraph!==o)continue;const t=g(e.publishedAt);if(!t)continue;const l=e.kind==="promoted"?"promoted":"added",d=e.kind==="promoted"?"shared":"working",n=w(e.assertionUri);f.push({id:m(l,e.eventUri,t,n),entity:{uri:n,label:e.assertionName||v(n),types:[],trustLevel:d,layers:new Set([d]),subGraphs:e.subGraph?new Set([e.subGraph]):new Set,properties:new Map,connections:[]},at:t,authorUri:e.agentUri,kindUri:null,subGraph:e.subGraph??null,layer:d,event:l,entityCount:e.entityCount,clickable:!1})}return f.sort((e,t)=>e.at&&t.at?t.at.getTime()-e.at.getTime():e.at&&!t.at?-1:!e.at&&t.at?1:e.entity.label.localeCompare(t.entity.label)),f.slice(0,r)}function N(i,s={}){const{swmEvents:a,lifecycleEvents:o,...r}=s,f=o!=null,t=$(i,{...r,excludeEvents:f?["added"]:void 0});return T.useMemo(()=>{const l=r.limit??200;if(s.typeIri)return{items:t.items,hasMore:t.hasMore};if(!f&&(!a||a.length===0))return{items:t.items,hasMore:t.hasMore};let d;if(f)d=O(o,{agentUri:r.agentUri,subGraph:r.subGraph,limit:Number.POSITIVE_INFINITY});else{const c=new Map;for(const h of i)c.set(h.uri,h);d=D(a,{entitiesByUri:c,agentUri:r.agentUri,subGraph:r.subGraph,limit:Number.POSITIVE_INFINITY})}const n=[...t.items,...d];n.sort((c,h)=>c.at&&h.at?h.at.getTime()-c.at.getTime():c.at&&!h.at?-1:!c.at&&h.at?1:c.entity.label.localeCompare(h.entity.label));const u=t.hasMore||n.length>l;return{items:n.slice(0,l),hasMore:u}},[t,a,o,f,i,r.agentUri,r.subGraph,r.limit,s.typeIri])}function R(i,s=new Date){if(!i)return"—";const a=s.getTime()-i.getTime(),o=Math.abs(a),r=a<0,f=6e4,e=f*60,t=e*24;return o<f?r?"in a moment":"just now":o<e?r?`in ${Math.floor(o/f)}m`:`${Math.floor(o/f)}m ago`:o<t?r?`in ${Math.floor(o/e)}h`:`${Math.floor(o/e)}h ago`:o<7*t?r?`in ${Math.floor(o/t)}d`:`${Math.floor(o/t)}d ago`:i.toLocaleDateString(void 0,{month:"short",day:"numeric"})}export{C as b,R as r,N as u};
@@ -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-RLb1kuzE.js"></script>
9
- <link rel="stylesheet" crossorigin href="/ui/assets/index-VYV5TH6q.css">
8
+ <script type="module" crossorigin src="/ui/assets/index-CT-LdpBE.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/ui/assets/index-BLQUVvVz.css">
10
10
  </head>
11
11
  <body>
12
12
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@origintrail-official/dkg-node-ui",
3
- "version": "10.0.16",
3
+ "version": "10.0.18",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,8 +26,8 @@
26
26
  "viem": "^2.53.1",
27
27
  "zod": "^3.25.76",
28
28
  "zustand": "^5.0.12",
29
- "@origintrail-official/dkg-core": "10.0.16",
30
- "@origintrail-official/dkg-graph-viz": "10.0.16"
29
+ "@origintrail-official/dkg-core": "10.0.18",
30
+ "@origintrail-official/dkg-graph-viz": "10.0.18"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@playwright/test": "^1.59.1",
@@ -1,100 +0,0 @@
1
- var Ze=Object.defineProperty;var Je=(e,r,t)=>r in e?Ze(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var w=(e,r,t)=>Je(e,typeof r!="symbol"?r+"":r,t);import{aK as et,bj as ke,ba as f,R as K,O as Ie,bb as tt,aN as d}from"./index-RLb1kuzE.js";import{u as rt,b as at,r as nt}from"./useProjectActivity-OdoQs9mK.js";function st(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function le(e,r,t=""){const o=st(e),a=e==null?void 0:e.length;if(!o||r!==void 0){const i=t&&`"${t}" `,s="",u=o?`length=${a}`:`type=${typeof e}`,p=i+"expected Uint8Array"+s+", got "+u;throw o?new RangeError(p):new TypeError(p)}return e}function be(e,r=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(r&&e.finished)throw new Error("Hash#digest() has already been called")}function ot(e,r){le(e,void 0,"digestInto() output");const t=r.outputLen;if(e.length<t)throw new RangeError('"digestInto() output" expected to be of length >='+t)}function ce(...e){for(let r=0;r<e.length;r++)e[r].fill(0)}function se(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function x(e,r){return e<<32-r|e>>>r}const it=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ct=Array.from({length:256},(e,r)=>r.toString(16).padStart(2,"0"));function lt(e){if(le(e),it)return e.toHex();let r="";for(let t=0;t<e.length;t++)r+=ct[e[t]];return r}function ut(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function pt(e,r={}){const t=(a,n)=>e(n).update(a).digest(),o=e(void 0);return t.outputLen=o.outputLen,t.blockLen=o.blockLen,t.canXOF=o.canXOF,t.create=a=>e(a),Object.assign(t,r),Object.freeze(t)}const dt=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function ft(e,r,t){return e&r^~e&t}function ht(e,r,t){return e&r^e&t^r&t}class mt{constructor(r,t,o,a){w(this,"blockLen");w(this,"outputLen");w(this,"canXOF",!1);w(this,"padOffset");w(this,"isLE");w(this,"buffer");w(this,"view");w(this,"finished",!1);w(this,"length",0);w(this,"pos",0);w(this,"destroyed",!1);this.blockLen=r,this.outputLen=t,this.padOffset=o,this.isLE=a,this.buffer=new Uint8Array(r),this.view=se(this.buffer)}update(r){be(this),le(r);const{view:t,buffer:o,blockLen:a}=this,n=r.length;for(let i=0;i<n;){const s=Math.min(a-this.pos,n-i);if(s===a){const u=se(r);for(;a<=n-i;i+=a)this.process(u,i);continue}o.set(r.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===a&&(this.process(t,0),this.pos=0)}return this.length+=r.length,this.roundClean(),this}digestInto(r){be(this),ot(r,this),this.finished=!0;const{buffer:t,view:o,blockLen:a,isLE:n}=this;let{pos:i}=this;t[i++]=128,ce(this.buffer.subarray(i)),this.padOffset>a-i&&(this.process(o,0),i=0);for(let l=i;l<a;l++)t[l]=0;o.setBigUint64(a-8,BigInt(this.length*8),n),this.process(o,0);const s=se(r),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=u/4,h=this.get();if(p>h.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<p;l++)s.setUint32(4*l,h[l],n)}digest(){const{buffer:r,outputLen:t}=this;this.digestInto(r);const o=r.slice(0,t);return this.destroy(),o}_cloneInto(r){r||(r=new this.constructor),r.set(...this.get());const{blockLen:t,buffer:o,length:a,finished:n,destroyed:i,pos:s}=this;return r.destroyed=i,r.finished=n,r.length=a,r.pos=s,a%t&&r.buffer.set(o),r}clone(){return this._cloneInto()}}const $=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),gt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),L=new Uint32Array(64);class bt extends mt{constructor(r){super(64,r,8,!1)}get(){const{A:r,B:t,C:o,D:a,E:n,F:i,G:s,H:u}=this;return[r,t,o,a,n,i,s,u]}set(r,t,o,a,n,i,s,u){this.A=r|0,this.B=t|0,this.C=o|0,this.D=a|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=u|0}process(r,t){for(let l=0;l<16;l++,t+=4)L[l]=r.getUint32(t,!1);for(let l=16;l<64;l++){const b=L[l-15],g=L[l-2],S=x(b,7)^x(b,18)^b>>>3,v=x(g,17)^x(g,19)^g>>>10;L[l]=v+L[l-7]+S+L[l-16]|0}let{A:o,B:a,C:n,D:i,E:s,F:u,G:p,H:h}=this;for(let l=0;l<64;l++){const b=x(s,6)^x(s,11)^x(s,25),g=h+b+ft(s,u,p)+gt[l]+L[l]|0,v=(x(o,2)^x(o,13)^x(o,22))+ht(o,a,n)|0;h=p,p=u,u=s,s=i+g|0,i=n,n=a,a=o,o=g+v|0}o=o+this.A|0,a=a+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,u=u+this.F|0,p=p+this.G|0,h=h+this.H|0,this.set(o,a,n,i,s,u,p,h)}roundClean(){ce(L)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ce(this.buffer)}}class yt extends bt{constructor(){super(32);w(this,"A",$[0]|0);w(this,"B",$[1]|0);w(this,"C",$[2]|0);w(this,"D",$[3]|0);w(this,"E",$[4]|0);w(this,"F",$[5]|0);w(this,"G",$[6]|0);w(this,"H",$[7]|0)}}const wt=pt(()=>new yt,dt(1));var A;(function(e){e.WorkingMemory="WM",e.SharedWorkingMemory="SWM",e.VerifiableMemory="VM"})(A||(A={}));function oe(e){switch(e){case A.WorkingMemory:return"_working_memory";case A.SharedWorkingMemory:return"_shared_memory";case A.VerifiableMemory:return"_verifiable_memory"}}var ye;(function(e){e[e.SelfAttested=0]="SelfAttested",e[e.Endorsed=1]="Endorsed",e[e.PartiallyVerified=2]="PartiallyVerified",e[e.ConsensusVerified=3]="ConsensusVerified"})(ye||(ye={}));var we;(function(e){e.CREATE="CREATE",e.UPDATE="UPDATE"})(we||(we={}));A.WorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory,A.VerifiableMemory;A.WorkingMemory,A.SharedWorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory;const vt=["working-memory","shared-working-memory","verifiable-memory"],At=(1n<<72n)-1n;At.toString();oe(A.WorkingMemory),A.WorkingMemory,oe(A.SharedWorkingMemory),A.SharedWorkingMemory,oe(A.VerifiableMemory),A.VerifiableMemory;function Oe(e,r){return`did:dkg:context-graph:${e}/${r}`}function $e(e){return!e||e.length===0?{valid:!1,reason:"Sub-graph name cannot be empty"}:e.startsWith("_")?{valid:!1,reason:'Sub-graph names starting with "_" are reserved for protocol graphs'}:e.includes("/")?{valid:!1,reason:'Sub-graph names cannot contain "/"'}:/[<>"{}|^`\\\s]/.test(e)?{valid:!1,reason:"Sub-graph name contains characters unsafe for IRIs"}:e==="context"||e==="assertion"||e==="draft"?{valid:!1,reason:`"${e}" is a reserved path segment`}:{valid:!0}}const St=["string","integer","number","boolean","iri"],Et=/^[A-Za-z][A-Za-z0-9_]*$/,Ct=/^[+-]?\d+$/,xt=/^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;function F(e){if(e==null||e==="")return[];if(!Array.isArray(e))throw new Error("Query parameters must be an array.");const r=new Set;return e.map((t,o)=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Query parameter at index ${o} must be an object.`);const a=t,n=typeof a.name=="string"?a.name.trim():"";if(!Et.test(n))throw new Error(`Query parameter at index ${o} has an invalid name: ${n||"<empty>"}.`);if(r.has(n))throw new Error(`Duplicate query parameter: ${n}.`);r.add(n);const i=a.type;if(typeof i!="string"||!St.includes(i))throw new Error(`Query parameter ${n} has an unsupported type: ${String(i)}.`);const s={name:n,type:i};typeof a.label=="string"&&a.label.trim()&&(s.label=a.label.trim()),typeof a.description=="string"&&a.description.trim()&&(s.description=a.description.trim());let u;if(a.required!==void 0){if(typeof a.required!="boolean")throw new Error(`Query parameter ${n} required must be a boolean.`);u=a.required}const p=a.defaultValue!==void 0;if(p){if(!je(a.defaultValue))throw new Error(`Query parameter ${n} has an invalid defaultValue.`);Te(s,a.defaultValue),s.defaultValue=a.defaultValue}if(u===!0&&p)throw new Error(`Required query parameter ${n} cannot declare a defaultValue.`);if(u===!1&&!p)throw new Error(`Optional query parameter ${n} must declare a defaultValue.`);return s})}function fr(e){return e.defaultValue===void 0}function Nt(e){return JSON.stringify(F(e))}function Pt(e){const r=[];for(const t of _e(e))r.includes(t.name)||r.push(t.name);return r}function Le(e,r){const t=F(r),o=new Set(t.map(n=>n.name)),a=new Set(Pt(e));for(const n of a)if(!o.has(n))throw new Error(`SPARQL template uses undeclared query parameter: ${n}.`);for(const n of t)if(!a.has(n.name))throw new Error(`Query parameter ${n.name} is not used by the SPARQL template.`)}function Rt(e,r,t){const o=F(r);Le(e,o);const a=new Set(o.map(p=>p.name));for(const p of Object.keys(t))if(!a.has(p))throw new Error(`Unknown query parameter: ${p}.`);const n=new Map;for(const p of o){const h=t[p.name],l=ve(h)?p.defaultValue:h;if(ve(l))throw new Error(`Missing required query parameter: ${p.name}.`);if(!je(l))throw new Error(`Query parameter ${p.name} must be a string, number, or boolean.`);n.set(p.name,Te(p,l))}const i=_e(e);let s="",u=0;for(const p of i)s+=e.slice(u,p.start),s+=n.get(p.name),u=p.end;return s+e.slice(u)}function Te(e,r){switch(e.type){case"string":return ke(String(r));case"integer":{const t=String(r).trim();if(!Ct.test(t))throw new Error(`Query parameter ${e.name} must be an integer.`);return t}case"number":{const t=String(r).trim();if(!xt.test(t))throw new Error(`Query parameter ${e.name} must be a number.`);return t}case"boolean":{if(r===!0||r==="true")return"true";if(r===!1||r==="false")return"false";throw new Error(`Query parameter ${e.name} must be true or false.`)}case"iri":{const t=String(r).trim();if(!et(t))throw new Error(`Query parameter ${e.name} must be a safe absolute IRI.`);return`<${t}>`}}}function je(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ve(e){return e==null}function _e(e){const r=[];let t=0,o,a=!1,n=!1;for(;t<e.length;){const i=e[t];if(a){(i===`
2
- `||i==="\r")&&(a=!1),t+=1;continue}if(o){if(i==="\\"){t+=2;continue}e.startsWith(o,t)?(t+=o.length,o=void 0):t+=1;continue}if(n){if(i==="\\"){t+=2;continue}i===">"&&(n=!1),t+=1;continue}if(i==="#"){a=!0,t+=1;continue}if(e.startsWith("'''",t)||e.startsWith('"""',t)){o=e.slice(t,t+3),t+=3;continue}if(i==="'"||i==='"'){o=i,t+=1;continue}if(i==="<"&&e[t+1]!=="="&&e[t+1]!=="{"&&!/\s/.test(e[t+1]??"")){n=!0,t+=1;continue}if(e.startsWith("{{",t)){const s=e.slice(t).match(/^\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/);if(s){const u=t+s[0].length,p=e[t-1],h=e[u];if(p&&/[A-Za-z0-9_?:.%~-]/.test(p)||h&&/[A-Za-z0-9_?:.%~-]/.test(h))throw new Error(`Query parameter ${s[1]} must occupy a complete SPARQL term position.`);r.push({name:s[1],start:t,end:u}),t=u;continue}}t+=1}return r}const kt=2,ue="__context_graph",hr="ui-saved-queries",mr="Saved queries",E="http://dkg.io/ontology/profile/",Ae="http://schema.org/",Se="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",It="http://www.w3.org/2001/XMLSchema#integer";class k extends Error{constructor(t="Incompatible query-catalog daemon contract. Upgrade the daemon and retry."){super(t);w(this,"code","QUERY_CATALOG_CONTRACT_INCOMPATIBLE");this.name="QueryCatalogContractError"}}function Ot(e,r){if(r===ue)return`did:dkg:context-graph:${e}`;const t=$e(r);if(!t.valid)throw new Error(`Invalid query-catalog subgraph "${r}": ${t.reason}`);return Oe(e,r)}function $t(e,r){const t=`did:dkg:context-graph:${e}`;if(r===t)return ue;const o=`${t}/`;if(!r.startsWith(o))throw new Error(`Query-catalog scope graph <${r}> is outside context graph "${e}".`);const a=r.slice(o.length),n=$e(a);if(!n.valid)throw new Error(`Invalid query-catalog scope graph <${r}>: ${n.reason}`);if(Oe(e,a)!==r)throw new Error(`Query-catalog scope graph <${r}> is not a canonical subgraph IRI.`);return a}function gr(e,r={}){return{sparql:Rt(e.sparql,e.parameters,r),...e.view?{view:e.view}:{},...e.subGraph&&e.subGraph!==ue?{subGraphName:e.subGraph}:{}}}function Lt(e){return vt.includes(e)?e:void 0}function Tt(e){if(!e||typeof e!="object"||Array.isArray(e))throw new k;const r=e,t=r.capabilities;if(r.schemaVersion!==kt||(t==null?void 0:t.canonicalItems)!==!0||(t==null?void 0:t.queryParameters)!==!0||(t==null?void 0:t.executionView)!==!0||(t==null?void 0:t.graphScopeIri)!==!0||!Array.isArray(r.items))throw new k;return r.items.map((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))throw new k(`Invalid query-catalog item at index ${a}.`);const n=o,i=["queryIri","catalogIri","slug","name","sparql","catalogSlug","catalogName","subGraph","scopeGraph"];for(const l of i)if(typeof n[l]!="string")throw new k(`Invalid query-catalog item ${a}: ${l} must be a string.`);if(typeof n.rank!="number"||!Number.isFinite(n.rank)||typeof n.catalogRank!="number"||!Number.isFinite(n.catalogRank))throw new k(`Invalid query-catalog item ${a}: ranks must be finite numbers.`);const s=n.view===void 0?void 0:Lt(String(n.view));if(n.view!==void 0&&s===void 0)throw new k(`Invalid query-catalog item ${a}: unsupported execution view.`);const u=n.scopeGraph,p=typeof r.contextGraphId=="string"?r.contextGraphId:void 0;if(!p)throw new k("Invalid query-catalog response: contextGraphId must be a string.");let h;try{h=$t(p,u)}catch(l){throw new k(`Invalid query-catalog item ${a}: ${l instanceof Error?l.message:String(l)}`)}if(h!==n.subGraph)throw new k(`Invalid query-catalog item ${a}: scopeGraph and subGraph do not match.`);return{queryIri:n.queryIri,catalogIri:n.catalogIri,slug:n.slug,name:n.name,...typeof n.description=="string"?{description:n.description}:{},sparql:n.sparql,...typeof n.resultColumn=="string"?{resultColumn:n.resultColumn}:{},rank:n.rank,catalogSlug:n.catalogSlug,catalogName:n.catalogName,...typeof n.catalogDescription=="string"?{catalogDescription:n.catalogDescription}:{},catalogRank:n.catalogRank,subGraph:n.subGraph,scopeGraph:u,parameters:F(n.parameters),...s?{view:s}:{}}})}function jt(e){const r=new Map;for(const t of e){const o=`${t.subGraph}|${t.catalogSlug}`,a=r.get(o);if(a){if(a.name!==t.catalogName||a.description!==t.catalogDescription||a.rank!==t.catalogRank)throw new Error(`Query catalog ${t.catalogSlug} has conflicting metadata.`);a.queries.push(t);continue}r.set(o,{slug:t.catalogSlug,subGraph:t.subGraph,name:t.catalogName,description:t.catalogDescription,rank:t.catalogRank,queries:[t]})}return[...r.values()].map(t=>({...t,queries:[...t.queries].sort((o,a)=>o.rank-a.rank||o.name.localeCompare(a.name))})).sort((t,o)=>t.subGraph.localeCompare(o.subGraph)||t.rank-o.rank||t.name.localeCompare(o.name))}function _t(e){return e.trim().toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Ee(e,r,t){return`urn:dkg:profile:${encodeURIComponent(e)}:${r}:${encodeURIComponent(t)}`}function Mt(e){return lt(wt(ut(e)))}function N(e){return JSON.stringify(e)}function Ce(e){return`"${e}"^^<${It}>`}function br(e){const r=F(e.parameters),t=JSON.stringify({subGraph:e.subGraph,catalogSlug:e.catalogSlug,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,parameters:r,view:e.view}),o=`${_t(e.name)}-${Mt(t)}`,a=Ee(e.contextGraphId,"catalog",e.catalogSlug),n=Ee(e.contextGraphId,"query",o),i=Ot(e.contextGraphId,e.subGraph);Le(e.sparql,r);const s=[{subject:a,predicate:Se,object:`${E}QueryCatalog`,graph:""},{subject:a,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:a,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:a,predicate:`${E}displayName`,object:N(e.catalogName),graph:""},{subject:a,predicate:`${E}rank`,object:Ce(e.catalogRank),graph:""},{subject:n,predicate:Se,object:`${E}SavedQuery`,graph:""},{subject:n,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:n,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:n,predicate:`${E}inCatalog`,object:a,graph:""},{subject:n,predicate:`${E}displayName`,object:N(e.name),graph:""},{subject:n,predicate:`${E}sparqlQuery`,object:N(e.sparql),graph:""},{subject:n,predicate:`${E}rank`,object:Ce(e.rank),graph:""}];return e.catalogDescription&&s.push({subject:a,predicate:`${Ae}description`,object:N(e.catalogDescription),graph:""}),e.description&&s.push({subject:n,predicate:`${Ae}description`,object:N(e.description),graph:""}),e.resultColumn&&s.push({subject:n,predicate:`${E}resultColumn`,object:N(e.resultColumn),graph:""}),r.length>0&&s.push({subject:n,predicate:`${E}queryParameters`,object:N(Nt(r)),graph:""}),e.view&&s.push({subject:n,predicate:`${E}executionView`,object:N(e.view),graph:""}),{savedQuery:{queryIri:n,catalogIri:a,slug:o,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,catalogSlug:e.catalogSlug,catalogName:e.catalogName,catalogDescription:e.catalogDescription,catalogRank:e.catalogRank,subGraph:e.subGraph,scopeGraph:i,parameters:r,view:e.view,queryUri:n,catalogUri:a},quads:s}}const Gt=new Set(["meta"]),Me="__root__";function yr(e){return!Gt.has(e.name)}function G(e){const r=`did:dkg:context-graph:${e}/meta`;return`FILTER(strstarts(str(?g), ${ke(r)}))`}async function H(e,r){var o;const t=await Ie(e,{contextGraphId:r});return((o=t==null?void 0:t.result)==null?void 0:o.bindings)??[]}async function Ut(e){const r=await tt(e);return Tt(r)}const P={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},xe=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),Qt={slug:Me,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},Ne=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),B="http://dkg.io/ontology/profile/";function Ge(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const r=e.value;return r==null?"":String(r)}return String(e)}function m(e){const r=Ge(e);if(!r)return"";const t=r.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return t?t[1].replace(/\\"/g,'"').replace(/\\n/g,`
3
- `).replace(/\\\\/g,"\\"):r}function qt(e){const r=m(e),t=parseInt(r,10);return Number.isFinite(t)?t:0}function Ht(e){return`PREFIX prof: <${B}>
4
- PREFIX schema: <http://schema.org/>
5
- SELECT ?profile ?name ?description ?primary ?accent
6
- WHERE {
7
- GRAPH ?g {
8
- ?profile a prof:Profile .
9
- OPTIONAL { ?profile prof:displayName ?name }
10
- OPTIONAL { ?profile schema:description ?description }
11
- OPTIONAL { ?profile prof:primaryColor ?primary }
12
- OPTIONAL { ?profile prof:accentColor ?accent }
13
- }
14
- ${G(e)}
15
- } LIMIT 1`}function Ft(e){return`PREFIX prof: <${B}>
16
- PREFIX schema: <http://schema.org/>
17
- SELECT ?slug ?displayName ?description ?icon ?color ?rank ?timelinePredicate ?sourceAssertion
18
- WHERE {
19
- GRAPH ?g {
20
- ?b a prof:SubGraphBinding ;
21
- prof:forSubGraph ?slug .
22
- OPTIONAL { ?b prof:displayName ?displayName }
23
- OPTIONAL { ?b schema:description ?description }
24
- OPTIONAL { ?b prof:icon ?icon }
25
- OPTIONAL { ?b prof:color ?color }
26
- OPTIONAL { ?b prof:rank ?rank }
27
- OPTIONAL { ?b prof:timelinePredicate ?timelinePredicate }
28
- OPTIONAL { ?b prof:sourceAssertion ?sourceAssertion }
29
- }
30
- ${G(e)}
31
- }`}function Bt(e){return`PREFIX prof: <${B}>
32
- SELECT ?chip ?subGraph ?type ?predicate ?label
33
- (GROUP_CONCAT(DISTINCT ?v; separator="|") AS ?values)
34
- WHERE {
35
- GRAPH ?g {
36
- ?chip a prof:FilterChip ;
37
- prof:forSubGraph ?subGraph ;
38
- prof:forType ?type ;
39
- prof:onPredicate ?predicate ;
40
- prof:chipValue ?v .
41
- OPTIONAL { ?chip prof:label ?label }
42
- }
43
- ${G(e)}
44
- }
45
- GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function Vt(e){const r=e.map(s=>s.catalogIri?s:{...s,catalogSlug:`default:${s.subGraph}`}),t=r.map(s=>({slug:s.slug,subGraph:s.subGraph,catalogSlug:s.catalogSlug,catalogName:s.catalogName,catalogDescription:s.catalogDescription,catalogRank:s.catalogRank,name:s.name,description:s.description,sparql:s.sparql,resultColumn:s.resultColumn??"",rank:s.rank,view:s.view,parameters:s.parameters})),o=new Map(r.map((s,u)=>[s.queryIri,t[u]])),a=jt(r).map(s=>({slug:s.slug,subGraph:s.subGraph,name:s.name,description:s.description,rank:s.rank,queries:s.queries.map(u=>o.get(u.queryIri)).filter(u=>!!u)})),n=new Map,i=new Map;for(const s of a){const u=n.get(s.subGraph)??[];u.push(s),n.set(s.subGraph,u);const p=i.get(s.subGraph)??[];p.push(...s.queries),i.set(s.subGraph,p)}return{queryCatalogs:a,savedQueries:t,catalogsBySubGraph:n,queriesBySubGraph:i}}function Dt(e){return`PREFIX prof: <${B}>
46
- SELECT ?type ?label ?icon ?color ?detailHint
47
- ?promoteLabel ?promoteHint ?publishLabel ?publishHint
48
- WHERE {
49
- GRAPH ?g {
50
- ?b a prof:EntityTypeBinding ;
51
- prof:forType ?type .
52
- OPTIONAL { ?b prof:label ?label }
53
- OPTIONAL { ?b prof:icon ?icon }
54
- OPTIONAL { ?b prof:color ?color }
55
- OPTIONAL { ?b prof:detailHint ?detailHint }
56
- OPTIONAL { ?b prof:promoteLabel ?promoteLabel }
57
- OPTIONAL { ?b prof:promoteHint ?promoteHint }
58
- OPTIONAL { ?b prof:publishLabel ?publishLabel }
59
- OPTIONAL { ?b prof:publishHint ?publishHint }
60
- }
61
- ${G(e)}
62
- }`}function Wt(e){return`PREFIX prof: <${B}>
63
- PREFIX schema: <http://schema.org/>
64
- SELECT ?view ?name ?description ?nodeSize
65
- (GROUP_CONCAT(DISTINCT ?incType; separator="|") AS ?includeTypes)
66
- (GROUP_CONCAT(DISTINCT ?empPred; separator="|") AS ?emphasizePredicates)
67
- WHERE {
68
- GRAPH ?g {
69
- ?view a prof:ViewConfig .
70
- OPTIONAL { ?view prof:displayName ?name }
71
- OPTIONAL { ?view schema:description ?description }
72
- OPTIONAL { ?view prof:nodeSize ?nodeSize }
73
- OPTIONAL { ?view prof:includeType ?incType }
74
- OPTIONAL { ?view prof:emphasizePredicate ?empPred }
75
- }
76
- ${G(e)}
77
- }
78
- GROUP BY ?view ?name ?description ?nodeSize`}function T(e){const r=Ge(e);if(!r)return"";const t=r.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function wr(e){const[r,t]=f.useState(!0),[o,a]=f.useState(),[n,i]=f.useState(P.displayName),[s,u]=f.useState(),[p,h]=f.useState(P.primaryColor),[l,b]=f.useState(P.accentColor),[g,S]=f.useState([]),[v,I]=f.useState([]),[U,V]=f.useState([]),[pe,D]=f.useState([]),[W,Q]=f.useState([]),[z,j]=f.useState([]),M=f.useRef(new Map),Z=f.useRef(new Map),J=f.useRef(new Map),ee=f.useRef(new Map),te=f.useRef(new Map),re=f.useRef(new Map),O=f.useRef();f.useEffect(()=>{if(O.current=void 0,i(e??P.displayName),u(void 0),h(P.primaryColor),b(P.accentColor),S([]),I([]),V([]),D([]),Q([]),j([]),M.current=new Map,Z.current=new Map,J.current=new Map,ee.current=new Map,te.current=new Map,re.current=new Map,a(void 0),!e){t(!1);return}let y=!1;return(async()=>{t(!0);try{const[_,We,ze,Xe,Ye,ae]=await Promise.all([H(Ht(e),e).catch(()=>[]),H(Ft(e),e).catch(()=>[]),H(Dt(e),e).catch(()=>[]),H(Wt(e),e).catch(()=>[]),H(Bt(e),e).catch(()=>[]),Ut(e).then(c=>({rows:c,error:void 0})).catch(c=>({rows:[],error:c instanceof Error?c.message:String(c)}))]);if(y)return;const de=e;if(_[0]){const c=_[0];i(m(c.name)||de),u(m(c.description)||void 0),h(m(c.primary)||P.primaryColor),b(m(c.accent)||P.accentColor)}else i(de),u(void 0),h(P.primaryColor),b(P.accentColor);const fe=We.map(c=>({slug:m(c.slug),displayName:m(c.displayName)||m(c.slug),description:m(c.description)||void 0,icon:m(c.icon)||void 0,color:m(c.color)||void 0,rank:qt(c.rank)||99,timelinePredicate:T(c.timelinePredicate)||void 0,sourceAssertion:m(c.sourceAssertion)||void 0})).filter(c=>c.slug).sort((c,C)=>c.rank-C.rank);S(fe),Z.current=new Map(fe.map(c=>[c.slug,c]));const he=ze.map(c=>({typeIri:T(c.type),label:m(c.label)||void 0,icon:m(c.icon)||void 0,color:m(c.color)||void 0,detailHint:m(c.detailHint)||void 0,promoteLabel:m(c.promoteLabel)||void 0,promoteHint:m(c.promoteHint)||void 0,publishLabel:m(c.publishLabel)||void 0,publishHint:m(c.publishHint)||void 0})).filter(c=>c.typeIri);I(he),M.current=new Map(he.map(c=>[c.typeIri,c]));const me=Xe.map(c=>{const C=T(c.view),Y=C.split(":view:").pop()??C;return{slug:Y,name:m(c.name)||Y,description:m(c.description)||void 0,nodeSize:m(c.nodeSize)||void 0,includeTypes:m(c.includeTypes).split("|").map(q=>T(q.trim())).filter(Boolean),emphasizePredicates:m(c.emphasizePredicates).split("|").map(q=>T(q.trim())).filter(Boolean)}});V(me),J.current=new Map(me.map(c=>[c.slug,c]));const ge=Ye.map(c=>{const C=T(c.chip),Y=C.split(":chip:").pop()??C,q=m(c.values).split("|").map(Ke=>m(Ke.trim())).filter(Boolean);return{slug:Y,subGraph:m(c.subGraph),typeIri:T(c.type),predicate:T(c.predicate),label:m(c.label)||"Filter",values:q}}).filter(c=>c.subGraph&&c.predicate&&c.values.length>0);D(ge);const ne=new Map;for(const c of ge){const C=ne.get(c.subGraph)??[];C.push(c),ne.set(c.subGraph,C)}ee.current=ne;const X=Vt(ae.rows);Q(X.queryCatalogs),j(X.savedQueries),te.current=X.catalogsBySubGraph,re.current=X.queriesBySubGraph,O.current=e,ae.error&&a(ae.error)}catch(_){y||a((_==null?void 0:_.message)??String(_))}finally{y||t(!1)}})(),()=>{y=!0}},[e]);const qe=f.useCallback(y=>y===Me?Qt:O.current!==e?xe(y):Z.current.get(y)??xe(y),[e]),He=f.useCallback(y=>O.current===e?M.current.get(y)??Ne(y):Ne(y),[e]),Fe=f.useCallback(y=>O.current===e?J.current.get(y):void 0,[e]),Be=f.useCallback(y=>O.current===e?ee.current.get(y)??[]:[],[e]),Ve=f.useCallback(y=>O.current===e?te.current.get(y)??[]:[],[e]),De=f.useCallback(y=>O.current===e?re.current.get(y)??[]:[],[e]);return{contextGraphId:e??"",displayName:n,description:s,primaryColor:p,accentColor:l,subGraphs:g,typeBindings:v,views:U,filterChips:pe,queryCatalogs:W,savedQueries:z,loading:r,error:o,forSubGraph:qe,forType:He,view:Fe,chipsFor:Be,savedQueryCatalogsFor:Ve,savedQueriesFor:De}}const zt=K.createContext(null);function Xt(){return f.useContext(zt)}const Yt="http://dkg.io/ontology/agent/";function Kt(e){return`PREFIX ag: <${Yt}>
79
- PREFIX schema: <http://schema.org/>
80
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
81
- SELECT ?a ?kind ?name ?label ?fw ?op ?wallet ?peerId ?avatar ?reputation
82
- WHERE {
83
- GRAPH ?g {
84
- ?a a ag:Agent .
85
- OPTIONAL { ?a a ag:HumanAgent . BIND("human" AS ?kind) }
86
- OPTIONAL { ?a a ag:AIAgent . BIND("ai" AS ?kindAi) }
87
- OPTIONAL { ?a schema:name ?name }
88
- OPTIONAL { ?a rdfs:label ?label }
89
- OPTIONAL { ?a ag:framework ?fw }
90
- OPTIONAL { ?a ag:operator ?op }
91
- OPTIONAL { ?a ag:walletAddress ?wallet }
92
- OPTIONAL { ?a ag:peerId ?peerId }
93
- OPTIONAL { ?a ag:avatar ?avatar }
94
- OPTIONAL { ?a ag:reputation ?reputation }
95
- }
96
- ${G(e)}
97
- }`}function Ue(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const r=e.value;return r==null?"":String(r)}return String(e)}function R(e){const r=Ue(e);if(!r)return"";const t=r.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return t?t[1].replace(/\\"/g,'"').replace(/\\n/g,`
98
- `).replace(/\\\\/g,"\\"):r}function Pe(e){const r=Ue(e);if(!r)return"";const t=r.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function Zt(e){let r=0;for(let a=0;a<e.length;a++)r=r*31+e.charCodeAt(a)|0;return`hsl(${((r%360+360)%360+25)%360}, 55%, 58%)`}function Jt(e){const r=new Map;for(const t of e){const o=Pe(t.a);if(!o)continue;const a=r.get(o),n=R(t.kindAi)==="ai"||R(t.kind)==="ai"?"ai":R(t.kind)==="human"?"human":(a==null?void 0:a.kind)??"ai",i={uri:o,name:R(t.name)||R(t.label)||o.split(":").pop()||o,kind:n,framework:R(t.fw)||(a==null?void 0:a.framework),operatorUri:Pe(t.op)||(a==null?void 0:a.operatorUri),walletAddress:R(t.wallet)||(a==null?void 0:a.walletAddress),peerId:R(t.peerId)||(a==null?void 0:a.peerId),avatar:R(t.avatar)||(a==null?void 0:a.avatar),reputation:R(t.reputation)||(a==null?void 0:a.reputation),color:Zt(o)};i.kind==="human"&&!i.framework&&(i.framework="human"),r.set(o,i)}for(const t of r.values())if(t.operatorUri){const o=r.get(t.operatorUri);o&&(t.operatorName=o.name)}return r}function vr(e){const[r,t]=f.useState(()=>new Map),[o,a]=f.useState(!0),[n,i]=f.useState(),s=f.useRef(new Map);f.useEffect(()=>{if(!e){a(!1);return}let l=!1;return(async()=>{var b;a(!0),i(void 0);try{const g=await Ie(Kt(e),{contextGraphId:e});if(l)return;const S=((b=g==null?void 0:g.result)==null?void 0:b.bindings)??[],v=Jt(S);t(v),s.current=v}catch(g){l||i((g==null?void 0:g.message)??String(g))}finally{l||a(!1)}})(),()=>{l=!0}},[e]);const u=f.useCallback(l=>s.current.get(l),[]),p=K.useMemo(()=>[...r.values()].sort((l,b)=>l.name.localeCompare(b.name)),[r]),h=f.useCallback(l=>{},[]);return{agents:r,list:p,loading:o,error:n,get:u,openAgent:h}}const er=K.createContext(null);function Qe(){return f.useContext(er)}const Re={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function tr(e,r){return e&&Re[e]?Re[e]:r==="human"?"👤":"◉"}function rr(e){const r=e.trim();if(!r)return"?";const t=r.split(/[\s_-]+/).filter(Boolean);return t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+(t[1][0]??"")).toUpperCase()}function ar(e){const r=e.trim();return r.length<=11?r:`${r.slice(0,6)}…${r.slice(-4)}`}const nr=({agent:e,fallbackUri:r,size:t="sm",showOperator:o=!1,onOpenAgent:a,className:n=""})=>{const i=Qe();if(!e&&!r)return null;const s=a??(i==null?void 0:i.openAgent),u=(e==null?void 0:e.uri)??r,p=(e==null?void 0:e.name)??(r?ar(r.split(":").pop()??r):"unknown"),h=(e==null?void 0:e.kind)??"ai",l=e==null?void 0:e.framework,b=tr(l,h),g=(e==null?void 0:e.color)??"hsl(0, 0%, 55%)",S=[p,l?`framework: ${l}`:null,e!=null&&e.operatorName?`operator: ${e.operatorName}`:null,e!=null&&e.walletAddress?`wallet: ${e.walletAddress}`:null,e!=null&&e.peerId?`peer: ${e.peerId.slice(0,20)}…`:null,e!=null&&e.reputation?`— ${e.reputation}`:null,u].filter(Boolean).join(`
99
- `),v=s?()=>s(u):void 0,I=!!v;return d.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${t}${I?" interactive":""} ${n}`,style:{"--agent-color":g},onClick:v?U=>{U.stopPropagation(),v()}:void 0,title:S,role:I?"button":void 0,tabIndex:I?0:void 0,children:[d.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:g},children:[d.jsx("span",{className:"v10-agent-chip-initials",children:rr(p)}),d.jsx("span",{className:"v10-agent-chip-glyph",title:l??h,children:b})]}),d.jsxs("span",{className:"v10-agent-chip-body",children:[d.jsx("span",{className:"v10-agent-chip-name",children:p}),t==="lg"&&((e==null?void 0:e.operatorName)||l)&&d.jsxs("span",{className:"v10-agent-chip-sub",children:[l&&h==="ai"&&d.jsx("span",{className:"v10-agent-chip-fw",children:l}),(e==null?void 0:e.operatorName)&&h==="ai"&&d.jsxs(d.Fragment,{children:[l&&d.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),d.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),h==="human"&&d.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),t==="md"&&o&&(e==null?void 0:e.operatorName)&&h==="ai"&&d.jsx("span",{className:"v10-agent-chip-sub",children:d.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},ie={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},sr={working:"◇",shared:"◈",verified:"◉"},or=200,Ar=({entities:e,agentUri:r,typeIri:t,subGraph:o,limit:a,includeUndated:n=!0,swmEvents:i,lifecycleEvents:s,lifecycleError:u,title:p,onSelectEntity:h,onOpenAgent:l,emptyHint:b,className:g=""})=>{const{items:S,hasMore:v}=rt(e,{agentUri:r,typeIri:t,subGraph:o,limit:a,includeUndated:n,swmEvents:i,lifecycleEvents:s}),I=K.useMemo(()=>at(S),[S]),U=Qe(),V=Xt(),D=v?`${a??or}+`:String(S.length),W=u!=null&&S.length===0,Q=p?d.jsxs("div",{className:"v10-activity-feed-title",children:[d.jsx("span",{className:"v10-activity-feed-title-label",children:p}),d.jsx("span",{className:"v10-activity-feed-title-count","data-state":W?"error":void 0,children:W?"—":D})]}):null,z=u?d.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:u,children:"Couldn't load recent activity."}):null;return S.length===0?d.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${g}`,children:[Q,z??d.jsx("div",{className:"v10-activity-feed-empty-hint",children:b??"No activity with a timestamp yet."})]}):d.jsxs("div",{className:`v10-activity-feed ${g}`,children:[Q,z,I.map(j=>d.jsxs("div",{className:"v10-activity-feed-bucket",children:[d.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[d.jsx("span",{className:"v10-activity-feed-bucket-label",children:j.label}),d.jsx("span",{className:"v10-activity-feed-bucket-count",children:j.items.length})]}),d.jsx("div",{className:"v10-activity-feed-items",children:j.items.map(M=>d.jsx(ir,{item:M,agents:U,profile:V,onSelectEntity:h,onOpenAgent:l},M.id))})]},j.key))]})};function ir({item:e,agents:r,profile:t,onSelectEntity:o,onOpenAgent:a}){const n=e.authorUri?r==null?void 0:r.get(e.authorUri):null,i=e.event==="typed",s=i&&e.kindUri?t==null?void 0:t.forType(e.kindUri):null,u=e.event==="added"?"Added":e.event==="promoted"?e.entityCount!=null&&e.entityCount>0?`Promoted to SWM · ${e.entityCount} ${e.entityCount===1?"entity":"entities"}`:"Promoted to SWM":e.event==="published"?"Published to VM":(s==null?void 0:s.label)??(e.kindUri?e.kindUri.split(/[#/]/).pop():null)??"Entity",p=e.event==="added"?"+":e.event==="promoted"?"⇡":e.event==="published"?"◉":(s==null?void 0:s.icon)??"◆",h=e.event==="promoted"?ie.shared:e.event==="published"?ie.verified:e.event==="added"?"#64748b":(s==null?void 0:s.color)??"#a855f7",l=ie[e.layer],b=i?cr(e.entity):null,g=(()=>{const v=[];return e.event!=="typed"&&v.push(u),v.push(e.entity.label),e.at&&v.push(e.at.toISOString()),v.join(`
100
- `)})(),S=d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"v10-activity-feed-layer",style:{color:l},title:`${e.layer} memory`,children:sr[e.layer]}),d.jsxs("span",{className:"v10-activity-feed-type",style:{"--type-color":h},children:[d.jsx("span",{className:"v10-activity-feed-type-icon",children:p}),d.jsx("span",{className:"v10-activity-feed-type-label",children:u})]}),d.jsx("span",{className:"v10-activity-feed-title-text",children:e.entity.label}),b&&d.jsx("span",{className:`v10-activity-feed-status status-${lr(b)}`,children:b}),(n||e.authorUri)&&d.jsx("span",{className:"v10-activity-feed-author",children:d.jsx(nr,{agent:n??void 0,fallbackUri:e.authorUri??void 0,size:"sm",onOpenAgent:a})}),d.jsx("span",{className:"v10-activity-feed-time",title:e.at?e.at.toLocaleString():"no timestamp",children:nt(e.at)})]});return e.clickable?d.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>o(e.entity.uri),title:g,children:S}):d.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:g,"aria-disabled":"true",children:S})}function cr(e){var t;const r=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const o of r){const a=(t=e.properties.get(o))==null?void 0:t[0];if(a)return a}return null}function lr(e){switch(e){case"accepted":case"done":case"merged":return"good";case"proposed":case"in_progress":case"open":return"warn";case"rejected":case"superseded":case"blocked":case"cancelled":return"bad";default:return"neutral"}}export{Ar as A,ue as C,zt as P,Me as R,mr as U,nr as a,er as b,hr as c,br as d,yr as e,Qe as f,wr as g,Xt as h,fr as i,gr as p,_t as q,vr as u};