@origintrail-official/dkg-node-ui 10.0.13 → 10.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-memory.d.ts +43 -2
- package/dist/chat-memory.d.ts.map +1 -1
- package/dist/chat-memory.js +31 -7
- package/dist/chat-memory.js.map +1 -1
- package/dist/db.d.ts +23 -16
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +217 -108
- package/dist/db.js.map +1 -1
- package/dist/gelf-push-worker.d.ts +1 -1
- package/dist/gelf-push-worker.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/otlp-log-worker.d.ts +3 -5
- package/dist/otlp-log-worker.d.ts.map +1 -1
- package/dist/otlp-log-worker.js +7 -5
- package/dist/otlp-log-worker.js.map +1 -1
- package/dist/routine-log-retention.d.ts +40 -0
- package/dist/routine-log-retention.d.ts.map +1 -0
- package/dist/routine-log-retention.js +262 -0
- package/dist/routine-log-retention.js.map +1 -0
- package/dist/structured-logger.d.ts.map +1 -1
- package/dist/structured-logger.js.map +1 -1
- package/dist-ui/assets/{3d-force-graph-C9KowW4u.js → 3d-force-graph-CnBoK4hA.js} +1 -1
- package/dist-ui/assets/{AgentHub-BVrcom9_.js → AgentHub-BOUZTvCO.js} +1 -1
- package/dist-ui/assets/{AgentProfilePage-C9XaTt7j.js → AgentProfilePage-DpF722ai.js} +1 -1
- package/dist-ui/assets/{ApproveWalletsModal-BdR2mshx.js → ApproveWalletsModal-CYQqAWZs.js} +3 -3
- package/dist-ui/assets/{ConvictionDetailView-cao48GL1.js → ConvictionDetailView-DYsWNc9M.js} +1 -1
- package/dist-ui/assets/{Network-B3jCYzr5.js → Network-JVFsFYhR.js} +1 -1
- package/dist-ui/assets/{OnChainProvenanceCard-DboMX4Aq.js → OnChainProvenanceCard-DISbYKx1.js} +1 -1
- package/dist-ui/assets/{Operations-Dg1gfLXv.js → Operations-Cmt3YpaX.js} +1 -1
- package/dist-ui/assets/{PublishingConviction-Byp6t69e.js → PublishingConviction-L-wHlnRP.js} +1 -1
- package/dist-ui/assets/{Settings-CxI0SKeV.js → Settings-CvBKeoTW.js} +1 -1
- package/dist-ui/assets/{ccip-wJ3OMRuz.js → ccip-m-rmKwvf.js} +1 -1
- package/dist-ui/assets/index-BfrYentv.js +1645 -0
- package/dist-ui/assets/{index-5DS6xjw0.js → index-UAg6wmCv.js} +3 -3
- package/dist-ui/assets/index-VYV5TH6q.css +1 -0
- package/dist-ui/assets/{jsonld-32FQRO67-CDirPi8u.js → jsonld-32FQRO67-iGNyLix6.js} +2 -2
- package/dist-ui/assets/{jsonld-CwHW9UDN.js → jsonld-CDhTpz6H.js} +1 -1
- package/dist-ui/assets/{renderer-3d-2EVDZII7-BNXV6iSu.js → renderer-3d-2EVDZII7-BdEgi2VZ.js} +2 -2
- package/dist-ui/assets/{shikiHighlighter-C-LWPPSu.js → shikiHighlighter-Dhz3-Gg5.js} +1 -1
- package/dist-ui/index.html +2 -2
- package/package.json +5 -4
- package/dist-ui/assets/index-DOjsv0r7.css +0 -1
- package/dist-ui/assets/index-KoAnx9JE.js +0 -1661
|
@@ -0,0 +1,1645 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-UAg6wmCv.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-DISbYKx1.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/Operations-Cmt3YpaX.js","assets/PublishingConviction-L-wHlnRP.js","assets/ApproveWalletsModal-CYQqAWZs.js","assets/ConvictionDetailView-DYsWNc9M.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var w2=Object.defineProperty;var k2=(e,t,n)=>t in e?w2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rt=(e,t,n)=>k2(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var rQ=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function aQ(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Oh={exports:{}},Cl={};/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/var n1;function S2(){if(n1)return Cl;n1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,i,o){var c=null;if(o!==void 0&&(c=""+o),i.key!==void 0&&(c=""+i.key),"key"in i){o={};for(var d in i)d!=="key"&&(o[d]=i[d])}else o=i;return i=o.ref,{$$typeof:e,type:r,key:c,ref:i!==void 0?i:null,props:o}}return Cl.Fragment=t,Cl.jsx=n,Cl.jsxs=n,Cl}var r1;function j2(){return r1||(r1=1,Oh.exports=S2()),Oh.exports}var l=j2(),Mh={exports:{}},Xe={};/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/var a1;function C2(){if(a1)return Xe;a1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),v=Symbol.iterator;function b(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function S(U,Z,I){this.props=U,this.context=Z,this.refs=C,this.updater=I||k}S.prototype.isReactComponent={},S.prototype.setState=function(U,Z){if(typeof U!="object"&&typeof U!="function"&&U!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,U,Z,"setState")},S.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function N(){}N.prototype=S.prototype;function A(U,Z,I){this.props=U,this.context=Z,this.refs=C,this.updater=I||k}var O=A.prototype=new N;O.constructor=A,j(O,S.prototype),O.isPureReactComponent=!0;var M=Array.isArray;function T(){}var L={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function _(U,Z,I){var ae=I.ref;return{$$typeof:e,type:U,key:Z,ref:ae!==void 0?ae:null,props:I}}function R(U,Z){return _(U.type,Z,U.props)}function z(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function F(U){var Z={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(I){return Z[I]})}var Y=/\/+/g;function D(U,Z){return typeof U=="object"&&U!==null&&U.key!=null?F(""+U.key):Z.toString(36)}function q(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(Z){U.status==="pending"&&(U.status="fulfilled",U.value=Z)},function(Z){U.status==="pending"&&(U.status="rejected",U.reason=Z)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function G(U,Z,I,ae,le){var oe=typeof U;(oe==="undefined"||oe==="boolean")&&(U=null);var we=!1;if(U===null)we=!0;else switch(oe){case"bigint":case"string":case"number":we=!0;break;case"object":switch(U.$$typeof){case e:case t:we=!0;break;case g:return we=U._init,G(we(U._payload),Z,I,ae,le)}}if(we)return le=le(U),we=ae===""?"."+D(U,0):ae,M(le)?(I="",we!=null&&(I=we.replace(Y,"$&/")+"/"),G(le,Z,I,"",function(He){return He})):le!=null&&(z(le)&&(le=R(le,I+(le.key==null||U&&U.key===le.key?"":(""+le.key).replace(Y,"$&/")+"/")+we)),Z.push(le)),1;we=0;var Ee=ae===""?".":ae+":";if(M(U))for(var Oe=0;Oe<U.length;Oe++)ae=U[Oe],oe=Ee+D(ae,Oe),we+=G(ae,Z,I,oe,le);else if(Oe=b(U),typeof Oe=="function")for(U=Oe.call(U),Oe=0;!(ae=U.next()).done;)ae=ae.value,oe=Ee+D(ae,Oe++),we+=G(ae,Z,I,oe,le);else if(oe==="object"){if(typeof U.then=="function")return G(q(U),Z,I,ae,le);throw Z=String(U),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return we}function W(U,Z,I){if(U==null)return U;var ae=[],le=0;return G(U,ae,"","",function(oe){return Z.call(I,oe,le++)}),ae}function Q(U){if(U._status===-1){var Z=U._result;Z=Z(),Z.then(function(I){(U._status===0||U._status===-1)&&(U._status=1,U._result=I)},function(I){(U._status===0||U._status===-1)&&(U._status=2,U._result=I)}),U._status===-1&&(U._status=0,U._result=Z)}if(U._status===1)return U._result.default;throw U._result}var H=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},$={map:W,forEach:function(U,Z,I){W(U,function(){Z.apply(this,arguments)},I)},count:function(U){var Z=0;return W(U,function(){Z++}),Z},toArray:function(U){return W(U,function(Z){return Z})||[]},only:function(U){if(!z(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Xe.Activity=m,Xe.Children=$,Xe.Component=S,Xe.Fragment=n,Xe.Profiler=i,Xe.PureComponent=A,Xe.StrictMode=r,Xe.Suspense=p,Xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,Xe.__COMPILER_RUNTIME={__proto__:null,c:function(U){return L.H.useMemoCache(U)}},Xe.cache=function(U){return function(){return U.apply(null,arguments)}},Xe.cacheSignal=function(){return null},Xe.cloneElement=function(U,Z,I){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var ae=j({},U.props),le=U.key;if(Z!=null)for(oe in Z.key!==void 0&&(le=""+Z.key),Z)!B.call(Z,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&Z.ref===void 0||(ae[oe]=Z[oe]);var oe=arguments.length-2;if(oe===1)ae.children=I;else if(1<oe){for(var we=Array(oe),Ee=0;Ee<oe;Ee++)we[Ee]=arguments[Ee+2];ae.children=we}return _(U.type,le,ae)},Xe.createContext=function(U){return U={$$typeof:c,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Xe.createElement=function(U,Z,I){var ae,le={},oe=null;if(Z!=null)for(ae in Z.key!==void 0&&(oe=""+Z.key),Z)B.call(Z,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(le[ae]=Z[ae]);var we=arguments.length-2;if(we===1)le.children=I;else if(1<we){for(var Ee=Array(we),Oe=0;Oe<we;Oe++)Ee[Oe]=arguments[Oe+2];le.children=Ee}if(U&&U.defaultProps)for(ae in we=U.defaultProps,we)le[ae]===void 0&&(le[ae]=we[ae]);return _(U,oe,le)},Xe.createRef=function(){return{current:null}},Xe.forwardRef=function(U){return{$$typeof:d,render:U}},Xe.isValidElement=z,Xe.lazy=function(U){return{$$typeof:g,_payload:{_status:-1,_result:U},_init:Q}},Xe.memo=function(U,Z){return{$$typeof:h,type:U,compare:Z===void 0?null:Z}},Xe.startTransition=function(U){var Z=L.T,I={};L.T=I;try{var ae=U(),le=L.S;le!==null&&le(I,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(T,H)}catch(oe){H(oe)}finally{Z!==null&&I.types!==null&&(Z.types=I.types),L.T=Z}},Xe.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},Xe.use=function(U){return L.H.use(U)},Xe.useActionState=function(U,Z,I){return L.H.useActionState(U,Z,I)},Xe.useCallback=function(U,Z){return L.H.useCallback(U,Z)},Xe.useContext=function(U){return L.H.useContext(U)},Xe.useDebugValue=function(){},Xe.useDeferredValue=function(U,Z){return L.H.useDeferredValue(U,Z)},Xe.useEffect=function(U,Z){return L.H.useEffect(U,Z)},Xe.useEffectEvent=function(U){return L.H.useEffectEvent(U)},Xe.useId=function(){return L.H.useId()},Xe.useImperativeHandle=function(U,Z,I){return L.H.useImperativeHandle(U,Z,I)},Xe.useInsertionEffect=function(U,Z){return L.H.useInsertionEffect(U,Z)},Xe.useLayoutEffect=function(U,Z){return L.H.useLayoutEffect(U,Z)},Xe.useMemo=function(U,Z){return L.H.useMemo(U,Z)},Xe.useOptimistic=function(U,Z){return L.H.useOptimistic(U,Z)},Xe.useReducer=function(U,Z,I){return L.H.useReducer(U,Z,I)},Xe.useRef=function(U){return L.H.useRef(U)},Xe.useState=function(U){return L.H.useState(U)},Xe.useSyncExternalStore=function(U,Z,I){return L.H.useSyncExternalStore(U,Z,I)},Xe.useTransition=function(){return L.H.useTransition()},Xe.version="19.2.4",Xe}var i1;function Gg(){return i1||(i1=1,Mh.exports=C2()),Mh.exports}var w=Gg();const Je=mc(w);var Lh={exports:{}},Nl={},Ih={exports:{}},Dh={};/**
|
|
19
|
+
* @license React
|
|
20
|
+
* scheduler.production.js
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the MIT license found in the
|
|
25
|
+
* LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var s1;function N2(){return s1||(s1=1,(function(e){function t(G,W){var Q=G.length;G.push(W);e:for(;0<Q;){var H=Q-1>>>1,$=G[H];if(0<i($,W))G[H]=W,G[Q]=$,Q=H;else break e}}function n(G){return G.length===0?null:G[0]}function r(G){if(G.length===0)return null;var W=G[0],Q=G.pop();if(Q!==W){G[0]=Q;e:for(var H=0,$=G.length,U=$>>>1;H<U;){var Z=2*(H+1)-1,I=G[Z],ae=Z+1,le=G[ae];if(0>i(I,Q))ae<$&&0>i(le,I)?(G[H]=le,G[ae]=Q,H=ae):(G[H]=I,G[Z]=Q,H=Z);else if(ae<$&&0>i(le,Q))G[H]=le,G[ae]=Q,H=ae;else break e}}return W}function i(G,W){var Q=G.sortIndex-W.sortIndex;return Q!==0?Q:G.id-W.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var p=[],h=[],g=1,m=null,v=3,b=!1,k=!1,j=!1,C=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function O(G){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=G)r(h),W.sortIndex=W.expirationTime,t(p,W);else break;W=n(h)}}function M(G){if(j=!1,O(G),!k)if(n(p)!==null)k=!0,T||(T=!0,F());else{var W=n(h);W!==null&&q(M,W.startTime-G)}}var T=!1,L=-1,B=5,_=-1;function R(){return C?!0:!(e.unstable_now()-_<B)}function z(){if(C=!1,T){var G=e.unstable_now();_=G;var W=!0;try{e:{k=!1,j&&(j=!1,N(L),L=-1),b=!0;var Q=v;try{t:{for(O(G),m=n(p);m!==null&&!(m.expirationTime>G&&R());){var H=m.callback;if(typeof H=="function"){m.callback=null,v=m.priorityLevel;var $=H(m.expirationTime<=G);if(G=e.unstable_now(),typeof $=="function"){m.callback=$,O(G),W=!0;break t}m===n(p)&&r(p),O(G)}else r(p);m=n(p)}if(m!==null)W=!0;else{var U=n(h);U!==null&&q(M,U.startTime-G),W=!1}}break e}finally{m=null,v=Q,b=!1}W=void 0}}finally{W?F():T=!1}}}var F;if(typeof A=="function")F=function(){A(z)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,D=Y.port2;Y.port1.onmessage=z,F=function(){D.postMessage(null)}}else F=function(){S(z,0)};function q(G,W){L=S(function(){G(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(G){switch(v){case 1:case 2:case 3:var W=3;break;default:W=v}var Q=v;v=W;try{return G()}finally{v=Q}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(G,W){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var Q=v;v=G;try{return W()}finally{v=Q}},e.unstable_scheduleCallback=function(G,W,Q){var H=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?H+Q:H):Q=H,G){case 1:var $=-1;break;case 2:$=250;break;case 5:$=1073741823;break;case 4:$=1e4;break;default:$=5e3}return $=Q+$,G={id:g++,callback:W,priorityLevel:G,startTime:Q,expirationTime:$,sortIndex:-1},Q>H?(G.sortIndex=Q,t(h,G),n(p)===null&&G===n(h)&&(j?(N(L),L=-1):j=!0,q(M,Q-H))):(G.sortIndex=$,t(p,G),k||b||(k=!0,T||(T=!0,F()))),G},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(G){var W=v;return function(){var Q=v;v=W;try{return G.apply(this,arguments)}finally{v=Q}}}})(Dh)),Dh}var o1;function E2(){return o1||(o1=1,Ih.exports=N2()),Ih.exports}var zh={exports:{}},Rn={};/**
|
|
27
|
+
* @license React
|
|
28
|
+
* react-dom.production.js
|
|
29
|
+
*
|
|
30
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
31
|
+
*
|
|
32
|
+
* This source code is licensed under the MIT license found in the
|
|
33
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
|
+
*/var l1;function A2(){if(l1)return Rn;l1=1;var e=Gg();function t(p){var h="https://react.dev/errors/"+p;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+p+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(p,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:p,containerInfo:h,implementation:g}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(p,h){if(p==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Rn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Rn.createPortal=function(p,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return o(p,h,null,g)},Rn.flushSync=function(p){var h=c.T,g=r.p;try{if(c.T=null,r.p=2,p)return p()}finally{c.T=h,r.p=g,r.d.f()}},Rn.preconnect=function(p,h){typeof p=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(p,h))},Rn.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Rn.preinit=function(p,h){if(typeof p=="string"&&h&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(p,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:v,fetchPriority:b}):g==="script"&&r.d.X(p,{crossOrigin:m,integrity:v,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Rn.preinitModule=function(p,h){if(typeof p=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);r.d.M(p,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(p)},Rn.preload=function(p,h){if(typeof p=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin);r.d.L(p,g,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Rn.preloadModule=function(p,h){if(typeof p=="string")if(h){var g=d(h.as,h.crossOrigin);r.d.m(p,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(p)},Rn.requestFormReset=function(p){r.d.r(p)},Rn.unstable_batchedUpdates=function(p,h){return p(h)},Rn.useFormState=function(p,h,g){return c.H.useFormState(p,h,g)},Rn.useFormStatus=function(){return c.H.useHostTransitionStatus()},Rn.version="19.2.4",Rn}var c1;function tj(){if(c1)return zh.exports;c1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),zh.exports=A2(),zh.exports}/**
|
|
35
|
+
* @license React
|
|
36
|
+
* react-dom-client.production.js
|
|
37
|
+
*
|
|
38
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
39
|
+
*
|
|
40
|
+
* This source code is licensed under the MIT license found in the
|
|
41
|
+
* LICENSE file in the root directory of this source tree.
|
|
42
|
+
*/var u1;function T2(){if(u1)return Nl;u1=1;var e=E2(),t=Gg(),n=tj();function r(a){var s="https://react.dev/errors/"+a;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)s+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+a+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function o(a){var s=a,u=a;if(a.alternate)for(;s.return;)s=s.return;else{a=s;do s=a,(s.flags&4098)!==0&&(u=s.return),a=s.return;while(a)}return s.tag===3?u:null}function c(a){if(a.tag===13){var s=a.memoizedState;if(s===null&&(a=a.alternate,a!==null&&(s=a.memoizedState)),s!==null)return s.dehydrated}return null}function d(a){if(a.tag===31){var s=a.memoizedState;if(s===null&&(a=a.alternate,a!==null&&(s=a.memoizedState)),s!==null)return s.dehydrated}return null}function p(a){if(o(a)!==a)throw Error(r(188))}function h(a){var s=a.alternate;if(!s){if(s=o(a),s===null)throw Error(r(188));return s!==a?null:a}for(var u=a,f=s;;){var y=u.return;if(y===null)break;var x=y.alternate;if(x===null){if(f=y.return,f!==null){u=f;continue}break}if(y.child===x.child){for(x=y.child;x;){if(x===u)return p(y),a;if(x===f)return p(y),s;x=x.sibling}throw Error(r(188))}if(u.return!==f.return)u=y,f=x;else{for(var E=!1,P=y.child;P;){if(P===u){E=!0,u=y,f=x;break}if(P===f){E=!0,f=y,u=x;break}P=P.sibling}if(!E){for(P=x.child;P;){if(P===u){E=!0,u=x,f=y;break}if(P===f){E=!0,f=x,u=y;break}P=P.sibling}if(!E)throw Error(r(189))}}if(u.alternate!==f)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?a:s}function g(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a;for(a=a.child;a!==null;){if(s=g(a),s!==null)return s;a=a.sibling}return null}var m=Object.assign,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),A=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function F(a){return a===null||typeof a!="object"?null:(a=z&&a[z]||a["@@iterator"],typeof a=="function"?a:null)}var Y=Symbol.for("react.client.reference");function D(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Y?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case j:return"Fragment";case S:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case T:return"SuspenseList";case _:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case A:return a.displayName||"Context";case N:return(a._context.displayName||"Context")+".Consumer";case O:var s=a.render;return a=a.displayName,a||(a=s.displayName||s.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case L:return s=a.displayName||null,s!==null?s:D(a.type)||"Memo";case B:s=a._payload,a=a._init;try{return D(a(s))}catch{}}return null}var q=Array.isArray,G=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},H=[],$=-1;function U(a){return{current:a}}function Z(a){0>$||(a.current=H[$],H[$]=null,$--)}function I(a,s){$++,H[$]=a.current,a.current=s}var ae=U(null),le=U(null),oe=U(null),we=U(null);function Ee(a,s){switch(I(oe,s),I(le,a),I(ae,null),s.nodeType){case 9:case 11:a=(a=s.documentElement)&&(a=a.namespaceURI)?Cx(a):0;break;default:if(a=s.tagName,s=s.namespaceURI)s=Cx(s),a=Nx(s,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Z(ae),I(ae,a)}function Oe(){Z(ae),Z(le),Z(oe)}function He(a){a.memoizedState!==null&&I(we,a);var s=ae.current,u=Nx(s,a.type);s!==u&&(I(le,a),I(ae,u))}function ke(a){le.current===a&&(Z(ae),Z(le)),we.current===a&&(Z(we),wl._currentValue=Q)}var ve,Re;function Ge(a){if(ve===void 0)try{throw Error()}catch(u){var s=u.stack.trim().match(/\n( *(at )?)/);ve=s&&s[1]||"",Re=-1<u.stack.indexOf(`
|
|
43
|
+
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
+
`+ve+a+Re}var We=!1;function de(a,s){if(!a||We)return"";We=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(s){var ge=function(){throw Error()};if(Object.defineProperty(ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ge,[])}catch(ce){var se=ce}Reflect.construct(a,[],ge)}else{try{ge.call()}catch(ce){se=ce}a.call(ge.prototype)}}else{try{throw Error()}catch(ce){se=ce}(ge=a())&&typeof ge.catch=="function"&&ge.catch(function(){})}}catch(ce){if(ce&&se&&typeof ce.stack=="string")return[ce.stack,se.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),E=x[0],P=x[1];if(E&&P){var K=E.split(`
|
|
45
|
+
`),ne=P.split(`
|
|
46
|
+
`);for(y=f=0;f<K.length&&!K[f].includes("DetermineComponentFrameRoot");)f++;for(;y<ne.length&&!ne[y].includes("DetermineComponentFrameRoot");)y++;if(f===K.length||y===ne.length)for(f=K.length-1,y=ne.length-1;1<=f&&0<=y&&K[f]!==ne[y];)y--;for(;1<=f&&0<=y;f--,y--)if(K[f]!==ne[y]){if(f!==1||y!==1)do if(f--,y--,0>y||K[f]!==ne[y]){var pe=`
|
|
47
|
+
`+K[f].replace(" at new "," at ");return a.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",a.displayName)),pe}while(1<=f&&0<=y);break}}}finally{We=!1,Error.prepareStackTrace=u}return(u=a?a.displayName||a.name:"")?Ge(u):""}function Pe(a,s){switch(a.tag){case 26:case 27:case 5:return Ge(a.type);case 16:return Ge("Lazy");case 13:return a.child!==s&&s!==null?Ge("Suspense Fallback"):Ge("Suspense");case 19:return Ge("SuspenseList");case 0:case 15:return de(a.type,!1);case 11:return de(a.type.render,!1);case 1:return de(a.type,!0);case 31:return Ge("Activity");default:return""}}function Ze(a){try{var s="",u=null;do s+=Pe(a,u),u=a,a=a.return;while(a);return s}catch(f){return`
|
|
48
|
+
Error generating stack: `+f.message+`
|
|
49
|
+
`+f.stack}}var ot=Object.prototype.hasOwnProperty,be=e.unstable_scheduleCallback,bt=e.unstable_cancelCallback,at=e.unstable_shouldYield,rn=e.unstable_requestPaint,mt=e.unstable_now,Se=e.unstable_getCurrentPriorityLevel,X=e.unstable_ImmediatePriority,fe=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,ie=e.unstable_LowPriority,V=e.unstable_IdlePriority,xe=e.log,Le=e.unstable_setDisableYieldValue,Ae=null,De=null;function Qe(a){if(typeof xe=="function"&&Le(a),De&&typeof De.setStrictMode=="function")try{De.setStrictMode(Ae,a)}catch{}}var Te=Math.clz32?Math.clz32:An,jt=Math.log,ft=Math.LN2;function An(a){return a>>>=0,a===0?32:31-(jt(a)/ft|0)|0}var Mn=256,yn=262144,Ga=4194304;function ar(a){var s=a&42;if(s!==0)return s;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Va(a,s,u){var f=a.pendingLanes;if(f===0)return 0;var y=0,x=a.suspendedLanes,E=a.pingedLanes;a=a.warmLanes;var P=f&134217727;return P!==0?(f=P&~x,f!==0?y=ar(f):(E&=P,E!==0?y=ar(E):u||(u=P&~a,u!==0&&(y=ar(u))))):(P=f&~x,P!==0?y=ar(P):E!==0?y=ar(E):u||(u=f&~a,u!==0&&(y=ar(u)))),y===0?0:s!==0&&s!==y&&(s&x)===0&&(x=y&-y,u=s&-s,x>=u||x===32&&(u&4194048)!==0)?s:y}function pa(a,s){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&s)===0}function ks(a,s){switch(a){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wa(){var a=Ga;return Ga<<=1,(Ga&62914560)===0&&(Ga=4194304),a}function Li(a){for(var s=[],u=0;31>u;u++)s.push(a);return s}function Za(a,s){a.pendingLanes|=s,s!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function Ii(a,s,u,f,y,x){var E=a.pendingLanes;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=u,a.entangledLanes&=u,a.errorRecoveryDisabledLanes&=u,a.shellSuspendCounter=0;var P=a.entanglements,K=a.expirationTimes,ne=a.hiddenUpdates;for(u=E&~u;0<u;){var pe=31-Te(u),ge=1<<pe;P[pe]=0,K[pe]=-1;var se=ne[pe];if(se!==null)for(ne[pe]=null,pe=0;pe<se.length;pe++){var ce=se[pe];ce!==null&&(ce.lane&=-536870913)}u&=~ge}f!==0&&Ss(a,f,0),x!==0&&y===0&&a.tag!==0&&(a.suspendedLanes|=x&~(E&~s))}function Ss(a,s,u){a.pendingLanes|=s,a.suspendedLanes&=~s;var f=31-Te(s);a.entangledLanes|=s,a.entanglements[f]=a.entanglements[f]|1073741824|u&261930}function me(a,s){var u=a.entangledLanes|=s;for(a=a.entanglements;u;){var f=31-Te(u),y=1<<f;y&s|a[f]&s&&(a[f]|=s),u&=~y}}function _e(a,s){var u=s&-s;return u=(u&42)!==0?1:ue(u),(u&(a.suspendedLanes|s))!==0?0:u}function ue(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Ce(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Me(){var a=W.p;return a!==0?a:(a=window.event,a===void 0?32:Qx(a.type))}function tt(a,s){var u=W.p;try{return W.p=a,s()}finally{W.p=u}}var Ke=Math.random().toString(36).slice(2),$e="__reactFiber$"+Ke,Ye="__reactProps$"+Ke,Tn="__reactContainer$"+Ke,ha="__reactEvents$"+Ke,Do="__reactListeners$"+Ke,Ac="__reactHandles$"+Ke,Qa="__reactResources$"+Ke,Wr="__reactMarker$"+Ke;function js(a){delete a[$e],delete a[Ye],delete a[ha],delete a[Do],delete a[Ac]}function ma(a){var s=a[$e];if(s)return s;for(var u=a.parentNode;u;){if(s=u[Tn]||u[$e]){if(u=s.alternate,s.child!==null||u!==null&&u.child!==null)for(a=Mx(a);a!==null;){if(u=a[$e])return u;a=Mx(a)}return s}a=u,u=a.parentNode}return null}function bn(a){if(a=a[$e]||a[Tn]){var s=a.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return a}return null}function Ln(a){var s=a.tag;if(s===5||s===26||s===27||s===6)return a.stateNode;throw Error(r(33))}function xr(a){var s=a[Qa];return s||(s=a[Qa]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Wt(a){a[Wr]=!0}var Gn=new Set,Zr={};function In(a,s){wr(a,s),wr(a+"Capture",s)}function wr(a,s){for(Zr[a]=s,a=0;a<s.length;a++)Gn.add(s[a])}var Ka=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),zo={},Tc={};function jf(a){return ot.call(Tc,a)?!0:ot.call(zo,a)?!1:Ka.test(a)?Tc[a]=!0:(zo[a]=!0,!1)}function Dn(a,s,u){if(jf(s))if(u===null)a.removeAttribute(s);else{switch(typeof u){case"undefined":case"function":case"symbol":a.removeAttribute(s);return;case"boolean":var f=s.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){a.removeAttribute(s);return}}a.setAttribute(s,""+u)}}function Di(a,s,u){if(u===null)a.removeAttribute(s);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(s);return}a.setAttribute(s,""+u)}}function Vn(a,s,u,f){if(f===null)a.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(u);return}a.setAttributeNS(s,u,""+f)}}function lt(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function fn(a){var s=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ga(a,s,u){var f=Object.getOwnPropertyDescriptor(a.constructor.prototype,s);if(!a.hasOwnProperty(s)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var y=f.get,x=f.set;return Object.defineProperty(a,s,{configurable:!0,get:function(){return y.call(this)},set:function(E){u=""+E,x.call(this,E)}}),Object.defineProperty(a,s,{enumerable:f.enumerable}),{getValue:function(){return u},setValue:function(E){u=""+E},stopTracking:function(){a._valueTracker=null,delete a[s]}}}}function Cf(a){if(!a._valueTracker){var s=fn(a)?"checked":"value";a._valueTracker=ga(a,s,""+a[s])}}function yy(a){if(!a)return!1;var s=a._valueTracker;if(!s)return!0;var u=s.getValue(),f="";return a&&(f=fn(a)?a.checked?"true":"false":a.value),a=f,a!==u?(s.setValue(a),!0):!1}function Rc(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var mA=/[\n"\\]/g;function kr(a){return a.replace(mA,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Nf(a,s,u,f,y,x,E,P){a.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?a.type=E:a.removeAttribute("type"),s!=null?E==="number"?(s===0&&a.value===""||a.value!=s)&&(a.value=""+lt(s)):a.value!==""+lt(s)&&(a.value=""+lt(s)):E!=="submit"&&E!=="reset"||a.removeAttribute("value"),s!=null?Ef(a,E,lt(s)):u!=null?Ef(a,E,lt(u)):f!=null&&a.removeAttribute("value"),y==null&&x!=null&&(a.defaultChecked=!!x),y!=null&&(a.checked=y&&typeof y!="function"&&typeof y!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?a.name=""+lt(P):a.removeAttribute("name")}function by(a,s,u,f,y,x,E,P){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(a.type=x),s!=null||u!=null){if(!(x!=="submit"&&x!=="reset"||s!=null)){Cf(a);return}u=u!=null?""+lt(u):"",s=s!=null?""+lt(s):u,P||s===a.value||(a.value=s),a.defaultValue=s}f=f??y,f=typeof f!="function"&&typeof f!="symbol"&&!!f,a.checked=P?a.checked:!!f,a.defaultChecked=!!f,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(a.name=E),Cf(a)}function Ef(a,s,u){s==="number"&&Rc(a.ownerDocument)===a||a.defaultValue===""+u||(a.defaultValue=""+u)}function Cs(a,s,u,f){if(a=a.options,s){s={};for(var y=0;y<u.length;y++)s["$"+u[y]]=!0;for(u=0;u<a.length;u++)y=s.hasOwnProperty("$"+a[u].value),a[u].selected!==y&&(a[u].selected=y),y&&f&&(a[u].defaultSelected=!0)}else{for(u=""+lt(u),s=null,y=0;y<a.length;y++){if(a[y].value===u){a[y].selected=!0,f&&(a[y].defaultSelected=!0);return}s!==null||a[y].disabled||(s=a[y])}s!==null&&(s.selected=!0)}}function xy(a,s,u){if(s!=null&&(s=""+lt(s),s!==a.value&&(a.value=s),u==null)){a.defaultValue!==s&&(a.defaultValue=s);return}a.defaultValue=u!=null?""+lt(u):""}function wy(a,s,u,f){if(s==null){if(f!=null){if(u!=null)throw Error(r(92));if(q(f)){if(1<f.length)throw Error(r(93));f=f[0]}u=f}u==null&&(u=""),s=u}u=lt(s),a.defaultValue=u,f=a.textContent,f===u&&f!==""&&f!==null&&(a.value=f),Cf(a)}function Ns(a,s){if(s){var u=a.firstChild;if(u&&u===a.lastChild&&u.nodeType===3){u.nodeValue=s;return}}a.textContent=s}var gA=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function ky(a,s,u){var f=s.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?a.setProperty(s,""):s==="float"?a.cssFloat="":a[s]="":f?a.setProperty(s,u):typeof u!="number"||u===0||gA.has(s)?s==="float"?a.cssFloat=u:a[s]=(""+u).trim():a[s]=u+"px"}function Sy(a,s,u){if(s!=null&&typeof s!="object")throw Error(r(62));if(a=a.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||s!=null&&s.hasOwnProperty(f)||(f.indexOf("--")===0?a.setProperty(f,""):f==="float"?a.cssFloat="":a[f]="");for(var y in s)f=s[y],s.hasOwnProperty(y)&&u[y]!==f&&ky(a,y,f)}else for(var x in s)s.hasOwnProperty(x)&&ky(a,x,s[x])}function Af(a){if(a.indexOf("-")===-1)return!1;switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vA=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),yA=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function _c(a){return yA.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function va(){}var Tf=null;function Rf(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var Es=null,As=null;function jy(a){var s=bn(a);if(s&&(a=s.stateNode)){var u=a[Ye]||null;e:switch(a=s.stateNode,s.type){case"input":if(Nf(a,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),s=u.name,u.type==="radio"&&s!=null){for(u=a;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+kr(""+s)+'"][type="radio"]'),s=0;s<u.length;s++){var f=u[s];if(f!==a&&f.form===a.form){var y=f[Ye]||null;if(!y)throw Error(r(90));Nf(f,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(s=0;s<u.length;s++)f=u[s],f.form===a.form&&yy(f)}break e;case"textarea":xy(a,u.value,u.defaultValue);break e;case"select":s=u.value,s!=null&&Cs(a,!!u.multiple,s,!1)}}}var _f=!1;function Cy(a,s,u){if(_f)return a(s,u);_f=!0;try{var f=a(s);return f}finally{if(_f=!1,(Es!==null||As!==null)&&(yu(),Es&&(s=Es,a=As,As=Es=null,jy(s),a)))for(s=0;s<a.length;s++)jy(a[s])}}function $o(a,s){var u=a.stateNode;if(u===null)return null;var f=u[Ye]||null;if(f===null)return null;u=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(a=a.type,f=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!f;break e;default:a=!1}if(a)return null;if(u&&typeof u!="function")throw Error(r(231,s,typeof u));return u}var ya=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Of=!1;if(ya)try{var Po={};Object.defineProperty(Po,"passive",{get:function(){Of=!0}}),window.addEventListener("test",Po,Po),window.removeEventListener("test",Po,Po)}catch{Of=!1}var Ya=null,Mf=null,Oc=null;function Ny(){if(Oc)return Oc;var a,s=Mf,u=s.length,f,y="value"in Ya?Ya.value:Ya.textContent,x=y.length;for(a=0;a<u&&s[a]===y[a];a++);var E=u-a;for(f=1;f<=E&&s[u-f]===y[x-f];f++);return Oc=y.slice(a,1<f?1-f:void 0)}function Mc(a){var s=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&s===13&&(a=13)):a=s,a===10&&(a=13),32<=a||a===13?a:0}function Lc(){return!0}function Ey(){return!1}function Wn(a){function s(u,f,y,x,E){this._reactName=u,this._targetInst=y,this.type=f,this.nativeEvent=x,this.target=E,this.currentTarget=null;for(var P in a)a.hasOwnProperty(P)&&(u=a[P],this[P]=u?u(x):x[P]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Lc:Ey,this.isPropagationStopped=Ey,this}return m(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Lc)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Lc)},persist:function(){},isPersistent:Lc}),s}var zi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ic=Wn(zi),Uo=m({},zi,{view:0,detail:0}),bA=Wn(Uo),Lf,If,Bo,Dc=m({},Uo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zf,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Bo&&(Bo&&a.type==="mousemove"?(Lf=a.screenX-Bo.screenX,If=a.screenY-Bo.screenY):If=Lf=0,Bo=a),Lf)},movementY:function(a){return"movementY"in a?a.movementY:If}}),Ay=Wn(Dc),xA=m({},Dc,{dataTransfer:0}),wA=Wn(xA),kA=m({},Uo,{relatedTarget:0}),Df=Wn(kA),SA=m({},zi,{animationName:0,elapsedTime:0,pseudoElement:0}),jA=Wn(SA),CA=m({},zi,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),NA=Wn(CA),EA=m({},zi,{data:0}),Ty=Wn(EA),AA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TA={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},RA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _A(a){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(a):(a=RA[a])?!!s[a]:!1}function zf(){return _A}var OA=m({},Uo,{key:function(a){if(a.key){var s=AA[a.key]||a.key;if(s!=="Unidentified")return s}return a.type==="keypress"?(a=Mc(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?TA[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zf,charCode:function(a){return a.type==="keypress"?Mc(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Mc(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),MA=Wn(OA),LA=m({},Dc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ry=Wn(LA),IA=m({},Uo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zf}),DA=Wn(IA),zA=m({},zi,{propertyName:0,elapsedTime:0,pseudoElement:0}),$A=Wn(zA),PA=m({},Dc,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),UA=Wn(PA),BA=m({},zi,{newState:0,oldState:0}),FA=Wn(BA),qA=[9,13,27,32],$f=ya&&"CompositionEvent"in window,Fo=null;ya&&"documentMode"in document&&(Fo=document.documentMode);var HA=ya&&"TextEvent"in window&&!Fo,_y=ya&&(!$f||Fo&&8<Fo&&11>=Fo),Oy=" ",My=!1;function Ly(a,s){switch(a){case"keyup":return qA.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iy(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ts=!1;function GA(a,s){switch(a){case"compositionend":return Iy(s);case"keypress":return s.which!==32?null:(My=!0,Oy);case"textInput":return a=s.data,a===Oy&&My?null:a;default:return null}}function VA(a,s){if(Ts)return a==="compositionend"||!$f&&Ly(a,s)?(a=Ny(),Oc=Mf=Ya=null,Ts=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return _y&&s.locale!=="ko"?null:s.data;default:return null}}var WA={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Dy(a){var s=a&&a.nodeName&&a.nodeName.toLowerCase();return s==="input"?!!WA[a.type]:s==="textarea"}function zy(a,s,u,f){Es?As?As.push(f):As=[f]:Es=f,s=Cu(s,"onChange"),0<s.length&&(u=new Ic("onChange","change",null,u,f),a.push({event:u,listeners:s}))}var qo=null,Ho=null;function ZA(a){bx(a,0)}function zc(a){var s=Ln(a);if(yy(s))return a}function $y(a,s){if(a==="change")return s}var Py=!1;if(ya){var Pf;if(ya){var Uf="oninput"in document;if(!Uf){var Uy=document.createElement("div");Uy.setAttribute("oninput","return;"),Uf=typeof Uy.oninput=="function"}Pf=Uf}else Pf=!1;Py=Pf&&(!document.documentMode||9<document.documentMode)}function By(){qo&&(qo.detachEvent("onpropertychange",Fy),Ho=qo=null)}function Fy(a){if(a.propertyName==="value"&&zc(Ho)){var s=[];zy(s,Ho,a,Rf(a)),Cy(ZA,s)}}function QA(a,s,u){a==="focusin"?(By(),qo=s,Ho=u,qo.attachEvent("onpropertychange",Fy)):a==="focusout"&&By()}function KA(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return zc(Ho)}function YA(a,s){if(a==="click")return zc(s)}function XA(a,s){if(a==="input"||a==="change")return zc(s)}function JA(a,s){return a===s&&(a!==0||1/a===1/s)||a!==a&&s!==s}var ir=typeof Object.is=="function"?Object.is:JA;function Go(a,s){if(ir(a,s))return!0;if(typeof a!="object"||a===null||typeof s!="object"||s===null)return!1;var u=Object.keys(a),f=Object.keys(s);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var y=u[f];if(!ot.call(s,y)||!ir(a[y],s[y]))return!1}return!0}function qy(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Hy(a,s){var u=qy(a);a=0;for(var f;u;){if(u.nodeType===3){if(f=a+u.textContent.length,a<=s&&f>=s)return{node:u,offset:s-a};a=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=qy(u)}}function Gy(a,s){return a&&s?a===s?!0:a&&a.nodeType===3?!1:s&&s.nodeType===3?Gy(a,s.parentNode):"contains"in a?a.contains(s):a.compareDocumentPosition?!!(a.compareDocumentPosition(s)&16):!1:!1}function Vy(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var s=Rc(a.document);s instanceof a.HTMLIFrameElement;){try{var u=typeof s.contentWindow.location.href=="string"}catch{u=!1}if(u)a=s.contentWindow;else break;s=Rc(a.document)}return s}function Bf(a){var s=a&&a.nodeName&&a.nodeName.toLowerCase();return s&&(s==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||s==="textarea"||a.contentEditable==="true")}var eT=ya&&"documentMode"in document&&11>=document.documentMode,Rs=null,Ff=null,Vo=null,qf=!1;function Wy(a,s,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;qf||Rs==null||Rs!==Rc(f)||(f=Rs,"selectionStart"in f&&Bf(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Vo&&Go(Vo,f)||(Vo=f,f=Cu(Ff,"onSelect"),0<f.length&&(s=new Ic("onSelect","select",null,s,u),a.push({event:s,listeners:f}),s.target=Rs)))}function $i(a,s){var u={};return u[a.toLowerCase()]=s.toLowerCase(),u["Webkit"+a]="webkit"+s,u["Moz"+a]="moz"+s,u}var _s={animationend:$i("Animation","AnimationEnd"),animationiteration:$i("Animation","AnimationIteration"),animationstart:$i("Animation","AnimationStart"),transitionrun:$i("Transition","TransitionRun"),transitionstart:$i("Transition","TransitionStart"),transitioncancel:$i("Transition","TransitionCancel"),transitionend:$i("Transition","TransitionEnd")},Hf={},Zy={};ya&&(Zy=document.createElement("div").style,"AnimationEvent"in window||(delete _s.animationend.animation,delete _s.animationiteration.animation,delete _s.animationstart.animation),"TransitionEvent"in window||delete _s.transitionend.transition);function Pi(a){if(Hf[a])return Hf[a];if(!_s[a])return a;var s=_s[a],u;for(u in s)if(s.hasOwnProperty(u)&&u in Zy)return Hf[a]=s[u];return a}var Qy=Pi("animationend"),Ky=Pi("animationiteration"),Yy=Pi("animationstart"),tT=Pi("transitionrun"),nT=Pi("transitionstart"),rT=Pi("transitioncancel"),Xy=Pi("transitionend"),Jy=new Map,Gf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Gf.push("scrollEnd");function zr(a,s){Jy.set(a,s),In(s,[a])}var $c=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Sr=[],Os=0,Vf=0;function Pc(){for(var a=Os,s=Vf=Os=0;s<a;){var u=Sr[s];Sr[s++]=null;var f=Sr[s];Sr[s++]=null;var y=Sr[s];Sr[s++]=null;var x=Sr[s];if(Sr[s++]=null,f!==null&&y!==null){var E=f.pending;E===null?y.next=y:(y.next=E.next,E.next=y),f.pending=y}x!==0&&eb(u,y,x)}}function Uc(a,s,u,f){Sr[Os++]=a,Sr[Os++]=s,Sr[Os++]=u,Sr[Os++]=f,Vf|=f,a.lanes|=f,a=a.alternate,a!==null&&(a.lanes|=f)}function Wf(a,s,u,f){return Uc(a,s,u,f),Bc(a)}function Ui(a,s){return Uc(a,null,null,s),Bc(a)}function eb(a,s,u){a.lanes|=u;var f=a.alternate;f!==null&&(f.lanes|=u);for(var y=!1,x=a.return;x!==null;)x.childLanes|=u,f=x.alternate,f!==null&&(f.childLanes|=u),x.tag===22&&(a=x.stateNode,a===null||a._visibility&1||(y=!0)),a=x,x=x.return;return a.tag===3?(x=a.stateNode,y&&s!==null&&(y=31-Te(u),a=x.hiddenUpdates,f=a[y],f===null?a[y]=[s]:f.push(s),s.lane=u|536870912),x):null}function Bc(a){if(50<hl)throw hl=0,nh=null,Error(r(185));for(var s=a.return;s!==null;)a=s,s=a.return;return a.tag===3?a.stateNode:null}var Ms={};function aT(a,s,u,f){this.tag=a,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sr(a,s,u,f){return new aT(a,s,u,f)}function Zf(a){return a=a.prototype,!(!a||!a.isReactComponent)}function ba(a,s){var u=a.alternate;return u===null?(u=sr(a.tag,s,a.key,a.mode),u.elementType=a.elementType,u.type=a.type,u.stateNode=a.stateNode,u.alternate=a,a.alternate=u):(u.pendingProps=s,u.type=a.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=a.flags&65011712,u.childLanes=a.childLanes,u.lanes=a.lanes,u.child=a.child,u.memoizedProps=a.memoizedProps,u.memoizedState=a.memoizedState,u.updateQueue=a.updateQueue,s=a.dependencies,u.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},u.sibling=a.sibling,u.index=a.index,u.ref=a.ref,u.refCleanup=a.refCleanup,u}function tb(a,s){a.flags&=65011714;var u=a.alternate;return u===null?(a.childLanes=0,a.lanes=s,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=u.childLanes,a.lanes=u.lanes,a.child=u.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=u.memoizedProps,a.memoizedState=u.memoizedState,a.updateQueue=u.updateQueue,a.type=u.type,s=u.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),a}function Fc(a,s,u,f,y,x){var E=0;if(f=a,typeof a=="function")Zf(a)&&(E=1);else if(typeof a=="string")E=c2(a,u,ae.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case _:return a=sr(31,u,s,y),a.elementType=_,a.lanes=x,a;case j:return Bi(u.children,y,x,s);case C:E=8,y|=24;break;case S:return a=sr(12,u,s,y|2),a.elementType=S,a.lanes=x,a;case M:return a=sr(13,u,s,y),a.elementType=M,a.lanes=x,a;case T:return a=sr(19,u,s,y),a.elementType=T,a.lanes=x,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case A:E=10;break e;case N:E=9;break e;case O:E=11;break e;case L:E=14;break e;case B:E=16,f=null;break e}E=29,u=Error(r(130,a===null?"null":typeof a,"")),f=null}return s=sr(E,u,s,y),s.elementType=a,s.type=f,s.lanes=x,s}function Bi(a,s,u,f){return a=sr(7,a,f,s),a.lanes=u,a}function Qf(a,s,u){return a=sr(6,a,null,s),a.lanes=u,a}function nb(a){var s=sr(18,null,null,0);return s.stateNode=a,s}function Kf(a,s,u){return s=sr(4,a.children!==null?a.children:[],a.key,s),s.lanes=u,s.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},s}var rb=new WeakMap;function jr(a,s){if(typeof a=="object"&&a!==null){var u=rb.get(a);return u!==void 0?u:(s={value:a,source:s,stack:Ze(s)},rb.set(a,s),s)}return{value:a,source:s,stack:Ze(s)}}var Ls=[],Is=0,qc=null,Wo=0,Cr=[],Nr=0,Xa=null,Qr=1,Kr="";function xa(a,s){Ls[Is++]=Wo,Ls[Is++]=qc,qc=a,Wo=s}function ab(a,s,u){Cr[Nr++]=Qr,Cr[Nr++]=Kr,Cr[Nr++]=Xa,Xa=a;var f=Qr;a=Kr;var y=32-Te(f)-1;f&=~(1<<y),u+=1;var x=32-Te(s)+y;if(30<x){var E=y-y%5;x=(f&(1<<E)-1).toString(32),f>>=E,y-=E,Qr=1<<32-Te(s)+y|u<<y|f,Kr=x+a}else Qr=1<<x|u<<y|f,Kr=a}function Yf(a){a.return!==null&&(xa(a,1),ab(a,1,0))}function Xf(a){for(;a===qc;)qc=Ls[--Is],Ls[Is]=null,Wo=Ls[--Is],Ls[Is]=null;for(;a===Xa;)Xa=Cr[--Nr],Cr[Nr]=null,Kr=Cr[--Nr],Cr[Nr]=null,Qr=Cr[--Nr],Cr[Nr]=null}function ib(a,s){Cr[Nr++]=Qr,Cr[Nr++]=Kr,Cr[Nr++]=Xa,Qr=s.id,Kr=s.overflow,Xa=a}var Sn=null,$t=null,gt=!1,Ja=null,Er=!1,Jf=Error(r(519));function ei(a){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Zo(jr(s,a)),Jf}function sb(a){var s=a.stateNode,u=a.type,f=a.memoizedProps;switch(s[$e]=a,s[Ye]=f,u){case"dialog":ut("cancel",s),ut("close",s);break;case"iframe":case"object":case"embed":ut("load",s);break;case"video":case"audio":for(u=0;u<gl.length;u++)ut(gl[u],s);break;case"source":ut("error",s);break;case"img":case"image":case"link":ut("error",s),ut("load",s);break;case"details":ut("toggle",s);break;case"input":ut("invalid",s),by(s,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":ut("invalid",s);break;case"textarea":ut("invalid",s),wy(s,f.value,f.defaultValue,f.children)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||s.textContent===""+u||f.suppressHydrationWarning===!0||Sx(s.textContent,u)?(f.popover!=null&&(ut("beforetoggle",s),ut("toggle",s)),f.onScroll!=null&&ut("scroll",s),f.onScrollEnd!=null&&ut("scrollend",s),f.onClick!=null&&(s.onclick=va),s=!0):s=!1,s||ei(a,!0)}function ob(a){for(Sn=a.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:Er=!1;return;case 27:case 3:Er=!0;return;default:Sn=Sn.return}}function Ds(a){if(a!==Sn)return!1;if(!gt)return ob(a),gt=!0,!1;var s=a.tag,u;if((u=s!==3&&s!==27)&&((u=s===5)&&(u=a.type,u=!(u!=="form"&&u!=="button")||vh(a.type,a.memoizedProps)),u=!u),u&&$t&&ei(a),ob(a),s===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));$t=Ox(a)}else if(s===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));$t=Ox(a)}else s===27?(s=$t,hi(a.type)?(a=kh,kh=null,$t=a):$t=s):$t=Sn?Tr(a.stateNode.nextSibling):null;return!0}function Fi(){$t=Sn=null,gt=!1}function ep(){var a=Ja;return a!==null&&(Yn===null?Yn=a:Yn.push.apply(Yn,a),Ja=null),a}function Zo(a){Ja===null?Ja=[a]:Ja.push(a)}var tp=U(null),qi=null,wa=null;function ti(a,s,u){I(tp,s._currentValue),s._currentValue=u}function ka(a){a._currentValue=tp.current,Z(tp)}function np(a,s,u){for(;a!==null;){var f=a.alternate;if((a.childLanes&s)!==s?(a.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),a===u)break;a=a.return}}function rp(a,s,u,f){var y=a.child;for(y!==null&&(y.return=a);y!==null;){var x=y.dependencies;if(x!==null){var E=y.child;x=x.firstContext;e:for(;x!==null;){var P=x;x=y;for(var K=0;K<s.length;K++)if(P.context===s[K]){x.lanes|=u,P=x.alternate,P!==null&&(P.lanes|=u),np(x.return,u,a),f||(E=null);break e}x=P.next}}else if(y.tag===18){if(E=y.return,E===null)throw Error(r(341));E.lanes|=u,x=E.alternate,x!==null&&(x.lanes|=u),np(E,u,a),E=null}else E=y.child;if(E!==null)E.return=y;else for(E=y;E!==null;){if(E===a){E=null;break}if(y=E.sibling,y!==null){y.return=E.return,E=y;break}E=E.return}y=E}}function zs(a,s,u,f){a=null;for(var y=s,x=!1;y!==null;){if(!x){if((y.flags&524288)!==0)x=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var E=y.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var P=y.type;ir(y.pendingProps.value,E.value)||(a!==null?a.push(P):a=[P])}}else if(y===we.current){if(E=y.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(a!==null?a.push(wl):a=[wl])}y=y.return}a!==null&&rp(s,a,u,f),s.flags|=262144}function Hc(a){for(a=a.firstContext;a!==null;){if(!ir(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Hi(a){qi=a,wa=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function jn(a){return lb(qi,a)}function Gc(a,s){return qi===null&&Hi(a),lb(a,s)}function lb(a,s){var u=s._currentValue;if(s={context:s,memoizedValue:u,next:null},wa===null){if(a===null)throw Error(r(308));wa=s,a.dependencies={lanes:0,firstContext:s},a.flags|=524288}else wa=wa.next=s;return u}var iT=typeof AbortController<"u"?AbortController:function(){var a=[],s=this.signal={aborted:!1,addEventListener:function(u,f){a.push(f)}};this.abort=function(){s.aborted=!0,a.forEach(function(u){return u()})}},sT=e.unstable_scheduleCallback,oT=e.unstable_NormalPriority,an={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ap(){return{controller:new iT,data:new Map,refCount:0}}function Qo(a){a.refCount--,a.refCount===0&&sT(oT,function(){a.controller.abort()})}var Ko=null,ip=0,$s=0,Ps=null;function lT(a,s){if(Ko===null){var u=Ko=[];ip=0,$s=lh(),Ps={status:"pending",value:void 0,then:function(f){u.push(f)}}}return ip++,s.then(cb,cb),s}function cb(){if(--ip===0&&Ko!==null){Ps!==null&&(Ps.status="fulfilled");var a=Ko;Ko=null,$s=0,Ps=null;for(var s=0;s<a.length;s++)(0,a[s])()}}function cT(a,s){var u=[],f={status:"pending",value:null,reason:null,then:function(y){u.push(y)}};return a.then(function(){f.status="fulfilled",f.value=s;for(var y=0;y<u.length;y++)(0,u[y])(s)},function(y){for(f.status="rejected",f.reason=y,y=0;y<u.length;y++)(0,u[y])(void 0)}),f}var ub=G.S;G.S=function(a,s){W0=mt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&lT(a,s),ub!==null&&ub(a,s)};var Gi=U(null);function sp(){var a=Gi.current;return a!==null?a:Lt.pooledCache}function Vc(a,s){s===null?I(Gi,Gi.current):I(Gi,s.pool)}function db(){var a=sp();return a===null?null:{parent:an._currentValue,pool:a}}var Us=Error(r(460)),op=Error(r(474)),Wc=Error(r(542)),Zc={then:function(){}};function fb(a){return a=a.status,a==="fulfilled"||a==="rejected"}function pb(a,s,u){switch(u=a[u],u===void 0?a.push(s):u!==s&&(s.then(va,va),s=u),s.status){case"fulfilled":return s.value;case"rejected":throw a=s.reason,mb(a),a;default:if(typeof s.status=="string")s.then(va,va);else{if(a=Lt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=s,a.status="pending",a.then(function(f){if(s.status==="pending"){var y=s;y.status="fulfilled",y.value=f}},function(f){if(s.status==="pending"){var y=s;y.status="rejected",y.reason=f}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw a=s.reason,mb(a),a}throw Wi=s,Us}}function Vi(a){try{var s=a._init;return s(a._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Wi=u,Us):u}}var Wi=null;function hb(){if(Wi===null)throw Error(r(459));var a=Wi;return Wi=null,a}function mb(a){if(a===Us||a===Wc)throw Error(r(483))}var Bs=null,Yo=0;function Qc(a){var s=Yo;return Yo+=1,Bs===null&&(Bs=[]),pb(Bs,a,s)}function Xo(a,s){s=s.props.ref,a.ref=s!==void 0?s:null}function Kc(a,s){throw s.$$typeof===v?Error(r(525)):(a=Object.prototype.toString.call(s),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":a)))}function gb(a){function s(ee,J){if(a){var te=ee.deletions;te===null?(ee.deletions=[J],ee.flags|=16):te.push(J)}}function u(ee,J){if(!a)return null;for(;J!==null;)s(ee,J),J=J.sibling;return null}function f(ee){for(var J=new Map;ee!==null;)ee.key!==null?J.set(ee.key,ee):J.set(ee.index,ee),ee=ee.sibling;return J}function y(ee,J){return ee=ba(ee,J),ee.index=0,ee.sibling=null,ee}function x(ee,J,te){return ee.index=te,a?(te=ee.alternate,te!==null?(te=te.index,te<J?(ee.flags|=67108866,J):te):(ee.flags|=67108866,J)):(ee.flags|=1048576,J)}function E(ee){return a&&ee.alternate===null&&(ee.flags|=67108866),ee}function P(ee,J,te,he){return J===null||J.tag!==6?(J=Qf(te,ee.mode,he),J.return=ee,J):(J=y(J,te),J.return=ee,J)}function K(ee,J,te,he){var Ue=te.type;return Ue===j?pe(ee,J,te.props.children,he,te.key):J!==null&&(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===B&&Vi(Ue)===J.type)?(J=y(J,te.props),Xo(J,te),J.return=ee,J):(J=Fc(te.type,te.key,te.props,null,ee.mode,he),Xo(J,te),J.return=ee,J)}function ne(ee,J,te,he){return J===null||J.tag!==4||J.stateNode.containerInfo!==te.containerInfo||J.stateNode.implementation!==te.implementation?(J=Kf(te,ee.mode,he),J.return=ee,J):(J=y(J,te.children||[]),J.return=ee,J)}function pe(ee,J,te,he,Ue){return J===null||J.tag!==7?(J=Bi(te,ee.mode,he,Ue),J.return=ee,J):(J=y(J,te),J.return=ee,J)}function ge(ee,J,te){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Qf(""+J,ee.mode,te),J.return=ee,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return te=Fc(J.type,J.key,J.props,null,ee.mode,te),Xo(te,J),te.return=ee,te;case k:return J=Kf(J,ee.mode,te),J.return=ee,J;case B:return J=Vi(J),ge(ee,J,te)}if(q(J)||F(J))return J=Bi(J,ee.mode,te,null),J.return=ee,J;if(typeof J.then=="function")return ge(ee,Qc(J),te);if(J.$$typeof===A)return ge(ee,Gc(ee,J),te);Kc(ee,J)}return null}function se(ee,J,te,he){var Ue=J!==null?J.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Ue!==null?null:P(ee,J,""+te,he);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return te.key===Ue?K(ee,J,te,he):null;case k:return te.key===Ue?ne(ee,J,te,he):null;case B:return te=Vi(te),se(ee,J,te,he)}if(q(te)||F(te))return Ue!==null?null:pe(ee,J,te,he,null);if(typeof te.then=="function")return se(ee,J,Qc(te),he);if(te.$$typeof===A)return se(ee,J,Gc(ee,te),he);Kc(ee,te)}return null}function ce(ee,J,te,he,Ue){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return ee=ee.get(te)||null,P(J,ee,""+he,Ue);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case b:return ee=ee.get(he.key===null?te:he.key)||null,K(J,ee,he,Ue);case k:return ee=ee.get(he.key===null?te:he.key)||null,ne(J,ee,he,Ue);case B:return he=Vi(he),ce(ee,J,te,he,Ue)}if(q(he)||F(he))return ee=ee.get(te)||null,pe(J,ee,he,Ue,null);if(typeof he.then=="function")return ce(ee,J,te,Qc(he),Ue);if(he.$$typeof===A)return ce(ee,J,te,Gc(J,he),Ue);Kc(J,he)}return null}function Ie(ee,J,te,he){for(var Ue=null,xt=null,ze=J,it=J=0,ht=null;ze!==null&&it<te.length;it++){ze.index>it?(ht=ze,ze=null):ht=ze.sibling;var wt=se(ee,ze,te[it],he);if(wt===null){ze===null&&(ze=ht);break}a&&ze&&wt.alternate===null&&s(ee,ze),J=x(wt,J,it),xt===null?Ue=wt:xt.sibling=wt,xt=wt,ze=ht}if(it===te.length)return u(ee,ze),gt&&xa(ee,it),Ue;if(ze===null){for(;it<te.length;it++)ze=ge(ee,te[it],he),ze!==null&&(J=x(ze,J,it),xt===null?Ue=ze:xt.sibling=ze,xt=ze);return gt&&xa(ee,it),Ue}for(ze=f(ze);it<te.length;it++)ht=ce(ze,ee,it,te[it],he),ht!==null&&(a&&ht.alternate!==null&&ze.delete(ht.key===null?it:ht.key),J=x(ht,J,it),xt===null?Ue=ht:xt.sibling=ht,xt=ht);return a&&ze.forEach(function(bi){return s(ee,bi)}),gt&&xa(ee,it),Ue}function Ve(ee,J,te,he){if(te==null)throw Error(r(151));for(var Ue=null,xt=null,ze=J,it=J=0,ht=null,wt=te.next();ze!==null&&!wt.done;it++,wt=te.next()){ze.index>it?(ht=ze,ze=null):ht=ze.sibling;var bi=se(ee,ze,wt.value,he);if(bi===null){ze===null&&(ze=ht);break}a&&ze&&bi.alternate===null&&s(ee,ze),J=x(bi,J,it),xt===null?Ue=bi:xt.sibling=bi,xt=bi,ze=ht}if(wt.done)return u(ee,ze),gt&&xa(ee,it),Ue;if(ze===null){for(;!wt.done;it++,wt=te.next())wt=ge(ee,wt.value,he),wt!==null&&(J=x(wt,J,it),xt===null?Ue=wt:xt.sibling=wt,xt=wt);return gt&&xa(ee,it),Ue}for(ze=f(ze);!wt.done;it++,wt=te.next())wt=ce(ze,ee,it,wt.value,he),wt!==null&&(a&&wt.alternate!==null&&ze.delete(wt.key===null?it:wt.key),J=x(wt,J,it),xt===null?Ue=wt:xt.sibling=wt,xt=wt);return a&&ze.forEach(function(x2){return s(ee,x2)}),gt&&xa(ee,it),Ue}function Ot(ee,J,te,he){if(typeof te=="object"&&te!==null&&te.type===j&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case b:e:{for(var Ue=te.key;J!==null;){if(J.key===Ue){if(Ue=te.type,Ue===j){if(J.tag===7){u(ee,J.sibling),he=y(J,te.props.children),he.return=ee,ee=he;break e}}else if(J.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===B&&Vi(Ue)===J.type){u(ee,J.sibling),he=y(J,te.props),Xo(he,te),he.return=ee,ee=he;break e}u(ee,J);break}else s(ee,J);J=J.sibling}te.type===j?(he=Bi(te.props.children,ee.mode,he,te.key),he.return=ee,ee=he):(he=Fc(te.type,te.key,te.props,null,ee.mode,he),Xo(he,te),he.return=ee,ee=he)}return E(ee);case k:e:{for(Ue=te.key;J!==null;){if(J.key===Ue)if(J.tag===4&&J.stateNode.containerInfo===te.containerInfo&&J.stateNode.implementation===te.implementation){u(ee,J.sibling),he=y(J,te.children||[]),he.return=ee,ee=he;break e}else{u(ee,J);break}else s(ee,J);J=J.sibling}he=Kf(te,ee.mode,he),he.return=ee,ee=he}return E(ee);case B:return te=Vi(te),Ot(ee,J,te,he)}if(q(te))return Ie(ee,J,te,he);if(F(te)){if(Ue=F(te),typeof Ue!="function")throw Error(r(150));return te=Ue.call(te),Ve(ee,J,te,he)}if(typeof te.then=="function")return Ot(ee,J,Qc(te),he);if(te.$$typeof===A)return Ot(ee,J,Gc(ee,te),he);Kc(ee,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,J!==null&&J.tag===6?(u(ee,J.sibling),he=y(J,te),he.return=ee,ee=he):(u(ee,J),he=Qf(te,ee.mode,he),he.return=ee,ee=he),E(ee)):u(ee,J)}return function(ee,J,te,he){try{Yo=0;var Ue=Ot(ee,J,te,he);return Bs=null,Ue}catch(ze){if(ze===Us||ze===Wc)throw ze;var xt=sr(29,ze,null,ee.mode);return xt.lanes=he,xt.return=ee,xt}finally{}}}var Zi=gb(!0),vb=gb(!1),ni=!1;function lp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function cp(a,s){a=a.updateQueue,s.updateQueue===a&&(s.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function ri(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function ai(a,s,u){var f=a.updateQueue;if(f===null)return null;if(f=f.shared,(Ct&2)!==0){var y=f.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),f.pending=s,s=Bc(a),eb(a,null,u),s}return Uc(a,f,s,u),Bc(a)}function Jo(a,s,u){if(s=s.updateQueue,s!==null&&(s=s.shared,(u&4194048)!==0)){var f=s.lanes;f&=a.pendingLanes,u|=f,s.lanes=u,me(a,u)}}function up(a,s){var u=a.updateQueue,f=a.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var y=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var E={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?y=x=E:x=x.next=E,u=u.next}while(u!==null);x===null?y=x=s:x=x.next=s}else y=x=s;u={baseState:f.baseState,firstBaseUpdate:y,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},a.updateQueue=u;return}a=u.lastBaseUpdate,a===null?u.firstBaseUpdate=s:a.next=s,u.lastBaseUpdate=s}var dp=!1;function el(){if(dp){var a=Ps;if(a!==null)throw a}}function tl(a,s,u,f){dp=!1;var y=a.updateQueue;ni=!1;var x=y.firstBaseUpdate,E=y.lastBaseUpdate,P=y.shared.pending;if(P!==null){y.shared.pending=null;var K=P,ne=K.next;K.next=null,E===null?x=ne:E.next=ne,E=K;var pe=a.alternate;pe!==null&&(pe=pe.updateQueue,P=pe.lastBaseUpdate,P!==E&&(P===null?pe.firstBaseUpdate=ne:P.next=ne,pe.lastBaseUpdate=K))}if(x!==null){var ge=y.baseState;E=0,pe=ne=K=null,P=x;do{var se=P.lane&-536870913,ce=se!==P.lane;if(ce?(pt&se)===se:(f&se)===se){se!==0&&se===$s&&(dp=!0),pe!==null&&(pe=pe.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var Ie=a,Ve=P;se=s;var Ot=u;switch(Ve.tag){case 1:if(Ie=Ve.payload,typeof Ie=="function"){ge=Ie.call(Ot,ge,se);break e}ge=Ie;break e;case 3:Ie.flags=Ie.flags&-65537|128;case 0:if(Ie=Ve.payload,se=typeof Ie=="function"?Ie.call(Ot,ge,se):Ie,se==null)break e;ge=m({},ge,se);break e;case 2:ni=!0}}se=P.callback,se!==null&&(a.flags|=64,ce&&(a.flags|=8192),ce=y.callbacks,ce===null?y.callbacks=[se]:ce.push(se))}else ce={lane:se,tag:P.tag,payload:P.payload,callback:P.callback,next:null},pe===null?(ne=pe=ce,K=ge):pe=pe.next=ce,E|=se;if(P=P.next,P===null){if(P=y.shared.pending,P===null)break;ce=P,P=ce.next,ce.next=null,y.lastBaseUpdate=ce,y.shared.pending=null}}while(!0);pe===null&&(K=ge),y.baseState=K,y.firstBaseUpdate=ne,y.lastBaseUpdate=pe,x===null&&(y.shared.lanes=0),ci|=E,a.lanes=E,a.memoizedState=ge}}function yb(a,s){if(typeof a!="function")throw Error(r(191,a));a.call(s)}function bb(a,s){var u=a.callbacks;if(u!==null)for(a.callbacks=null,a=0;a<u.length;a++)yb(u[a],s)}var Fs=U(null),Yc=U(0);function xb(a,s){a=_a,I(Yc,a),I(Fs,s),_a=a|s.baseLanes}function fp(){I(Yc,_a),I(Fs,Fs.current)}function pp(){_a=Yc.current,Z(Fs),Z(Yc)}var or=U(null),Ar=null;function ii(a){var s=a.alternate;I(Yt,Yt.current&1),I(or,a),Ar===null&&(s===null||Fs.current!==null||s.memoizedState!==null)&&(Ar=a)}function hp(a){I(Yt,Yt.current),I(or,a),Ar===null&&(Ar=a)}function wb(a){a.tag===22?(I(Yt,Yt.current),I(or,a),Ar===null&&(Ar=a)):si()}function si(){I(Yt,Yt.current),I(or,or.current)}function lr(a){Z(or),Ar===a&&(Ar=null),Z(Yt)}var Yt=U(0);function Xc(a){for(var s=a;s!==null;){if(s.tag===13){var u=s.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||xh(u)||wh(u)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break;for(;s.sibling===null;){if(s.return===null||s.return===a)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Sa=0,nt=null,Rt=null,sn=null,Jc=!1,qs=!1,Qi=!1,eu=0,nl=0,Hs=null,uT=0;function Qt(){throw Error(r(321))}function mp(a,s){if(s===null)return!1;for(var u=0;u<s.length&&u<a.length;u++)if(!ir(a[u],s[u]))return!1;return!0}function gp(a,s,u,f,y,x){return Sa=x,nt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,G.H=a===null||a.memoizedState===null?a0:_p,Qi=!1,x=u(f,y),Qi=!1,qs&&(x=Sb(s,u,f,y)),kb(a),x}function kb(a){G.H=il;var s=Rt!==null&&Rt.next!==null;if(Sa=0,sn=Rt=nt=null,Jc=!1,nl=0,Hs=null,s)throw Error(r(300));a===null||on||(a=a.dependencies,a!==null&&Hc(a)&&(on=!0))}function Sb(a,s,u,f){nt=a;var y=0;do{if(qs&&(Hs=null),nl=0,qs=!1,25<=y)throw Error(r(301));if(y+=1,sn=Rt=null,a.updateQueue!=null){var x=a.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}G.H=i0,x=s(u,f)}while(qs);return x}function dT(){var a=G.H,s=a.useState()[0];return s=typeof s.then=="function"?rl(s):s,a=a.useState()[0],(Rt!==null?Rt.memoizedState:null)!==a&&(nt.flags|=1024),s}function vp(){var a=eu!==0;return eu=0,a}function yp(a,s,u){s.updateQueue=a.updateQueue,s.flags&=-2053,a.lanes&=~u}function bp(a){if(Jc){for(a=a.memoizedState;a!==null;){var s=a.queue;s!==null&&(s.pending=null),a=a.next}Jc=!1}Sa=0,sn=Rt=nt=null,qs=!1,nl=eu=0,Hs=null}function zn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?nt.memoizedState=sn=a:sn=sn.next=a,sn}function Xt(){if(Rt===null){var a=nt.alternate;a=a!==null?a.memoizedState:null}else a=Rt.next;var s=sn===null?nt.memoizedState:sn.next;if(s!==null)sn=s,Rt=a;else{if(a===null)throw nt.alternate===null?Error(r(467)):Error(r(310));Rt=a,a={memoizedState:Rt.memoizedState,baseState:Rt.baseState,baseQueue:Rt.baseQueue,queue:Rt.queue,next:null},sn===null?nt.memoizedState=sn=a:sn=sn.next=a}return sn}function tu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function rl(a){var s=nl;return nl+=1,Hs===null&&(Hs=[]),a=pb(Hs,a,s),s=nt,(sn===null?s.memoizedState:sn.next)===null&&(s=s.alternate,G.H=s===null||s.memoizedState===null?a0:_p),a}function nu(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return rl(a);if(a.$$typeof===A)return jn(a)}throw Error(r(438,String(a)))}function xp(a){var s=null,u=nt.updateQueue;if(u!==null&&(s=u.memoCache),s==null){var f=nt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(s={data:f.data.map(function(y){return y.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),u===null&&(u=tu(),nt.updateQueue=u),u.memoCache=s,u=s.data[s.index],u===void 0)for(u=s.data[s.index]=Array(a),f=0;f<a;f++)u[f]=R;return s.index++,u}function ja(a,s){return typeof s=="function"?s(a):s}function ru(a){var s=Xt();return wp(s,Rt,a)}function wp(a,s,u){var f=a.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=u;var y=a.baseQueue,x=f.pending;if(x!==null){if(y!==null){var E=y.next;y.next=x.next,x.next=E}s.baseQueue=y=x,f.pending=null}if(x=a.baseState,y===null)a.memoizedState=x;else{s=y.next;var P=E=null,K=null,ne=s,pe=!1;do{var ge=ne.lane&-536870913;if(ge!==ne.lane?(pt&ge)===ge:(Sa&ge)===ge){var se=ne.revertLane;if(se===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),ge===$s&&(pe=!0);else if((Sa&se)===se){ne=ne.next,se===$s&&(pe=!0);continue}else ge={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(P=K=ge,E=x):K=K.next=ge,nt.lanes|=se,ci|=se;ge=ne.action,Qi&&u(x,ge),x=ne.hasEagerState?ne.eagerState:u(x,ge)}else se={lane:ge,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},K===null?(P=K=se,E=x):K=K.next=se,nt.lanes|=ge,ci|=ge;ne=ne.next}while(ne!==null&&ne!==s);if(K===null?E=x:K.next=P,!ir(x,a.memoizedState)&&(on=!0,pe&&(u=Ps,u!==null)))throw u;a.memoizedState=x,a.baseState=E,a.baseQueue=K,f.lastRenderedState=x}return y===null&&(f.lanes=0),[a.memoizedState,f.dispatch]}function kp(a){var s=Xt(),u=s.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=a;var f=u.dispatch,y=u.pending,x=s.memoizedState;if(y!==null){u.pending=null;var E=y=y.next;do x=a(x,E.action),E=E.next;while(E!==y);ir(x,s.memoizedState)||(on=!0),s.memoizedState=x,s.baseQueue===null&&(s.baseState=x),u.lastRenderedState=x}return[x,f]}function jb(a,s,u){var f=nt,y=Xt(),x=gt;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=s();var E=!ir((Rt||y).memoizedState,u);if(E&&(y.memoizedState=u,on=!0),y=y.queue,Cp(Eb.bind(null,f,y,a),[a]),y.getSnapshot!==s||E||sn!==null&&sn.memoizedState.tag&1){if(f.flags|=2048,Gs(9,{destroy:void 0},Nb.bind(null,f,y,u,s),null),Lt===null)throw Error(r(349));x||(Sa&127)!==0||Cb(f,s,u)}return u}function Cb(a,s,u){a.flags|=16384,a={getSnapshot:s,value:u},s=nt.updateQueue,s===null?(s=tu(),nt.updateQueue=s,s.stores=[a]):(u=s.stores,u===null?s.stores=[a]:u.push(a))}function Nb(a,s,u,f){s.value=u,s.getSnapshot=f,Ab(s)&&Tb(a)}function Eb(a,s,u){return u(function(){Ab(s)&&Tb(a)})}function Ab(a){var s=a.getSnapshot;a=a.value;try{var u=s();return!ir(a,u)}catch{return!0}}function Tb(a){var s=Ui(a,2);s!==null&&Xn(s,a,2)}function Sp(a){var s=zn();if(typeof a=="function"){var u=a;if(a=u(),Qi){Qe(!0);try{u()}finally{Qe(!1)}}}return s.memoizedState=s.baseState=a,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:a},s}function Rb(a,s,u,f){return a.baseState=u,wp(a,Rt,typeof f=="function"?f:ja)}function fT(a,s,u,f,y){if(su(a))throw Error(r(485));if(a=s.action,a!==null){var x={payload:y,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){x.listeners.push(E)}};G.T!==null?u(!0):x.isTransition=!1,f(x),u=s.pending,u===null?(x.next=s.pending=x,_b(s,x)):(x.next=u.next,s.pending=u.next=x)}}function _b(a,s){var u=s.action,f=s.payload,y=a.state;if(s.isTransition){var x=G.T,E={};G.T=E;try{var P=u(y,f),K=G.S;K!==null&&K(E,P),Ob(a,s,P)}catch(ne){jp(a,s,ne)}finally{x!==null&&E.types!==null&&(x.types=E.types),G.T=x}}else try{x=u(y,f),Ob(a,s,x)}catch(ne){jp(a,s,ne)}}function Ob(a,s,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){Mb(a,s,f)},function(f){return jp(a,s,f)}):Mb(a,s,u)}function Mb(a,s,u){s.status="fulfilled",s.value=u,Lb(s),a.state=u,s=a.pending,s!==null&&(u=s.next,u===s?a.pending=null:(u=u.next,s.next=u,_b(a,u)))}function jp(a,s,u){var f=a.pending;if(a.pending=null,f!==null){f=f.next;do s.status="rejected",s.reason=u,Lb(s),s=s.next;while(s!==f)}a.action=null}function Lb(a){a=a.listeners;for(var s=0;s<a.length;s++)(0,a[s])()}function Ib(a,s){return s}function Db(a,s){if(gt){var u=Lt.formState;if(u!==null){e:{var f=nt;if(gt){if($t){t:{for(var y=$t,x=Er;y.nodeType!==8;){if(!x){y=null;break t}if(y=Tr(y.nextSibling),y===null){y=null;break t}}x=y.data,y=x==="F!"||x==="F"?y:null}if(y){$t=Tr(y.nextSibling),f=y.data==="F!";break e}}ei(f)}f=!1}f&&(s=u[0])}}return u=zn(),u.memoizedState=u.baseState=s,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ib,lastRenderedState:s},u.queue=f,u=t0.bind(null,nt,f),f.dispatch=u,f=Sp(!1),x=Rp.bind(null,nt,!1,f.queue),f=zn(),y={state:s,dispatch:null,action:a,pending:null},f.queue=y,u=fT.bind(null,nt,y,x,u),y.dispatch=u,f.memoizedState=a,[s,u,!1]}function zb(a){var s=Xt();return $b(s,Rt,a)}function $b(a,s,u){if(s=wp(a,s,Ib)[0],a=ru(ja)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var f=rl(s)}catch(E){throw E===Us?Wc:E}else f=s;s=Xt();var y=s.queue,x=y.dispatch;return u!==s.memoizedState&&(nt.flags|=2048,Gs(9,{destroy:void 0},pT.bind(null,y,u),null)),[f,x,a]}function pT(a,s){a.action=s}function Pb(a){var s=Xt(),u=Rt;if(u!==null)return $b(s,u,a);Xt(),s=s.memoizedState,u=Xt();var f=u.queue.dispatch;return u.memoizedState=a,[s,f,!1]}function Gs(a,s,u,f){return a={tag:a,create:u,deps:f,inst:s,next:null},s=nt.updateQueue,s===null&&(s=tu(),nt.updateQueue=s),u=s.lastEffect,u===null?s.lastEffect=a.next=a:(f=u.next,u.next=a,a.next=f,s.lastEffect=a),a}function Ub(){return Xt().memoizedState}function au(a,s,u,f){var y=zn();nt.flags|=a,y.memoizedState=Gs(1|s,{destroy:void 0},u,f===void 0?null:f)}function iu(a,s,u,f){var y=Xt();f=f===void 0?null:f;var x=y.memoizedState.inst;Rt!==null&&f!==null&&mp(f,Rt.memoizedState.deps)?y.memoizedState=Gs(s,x,u,f):(nt.flags|=a,y.memoizedState=Gs(1|s,x,u,f))}function Bb(a,s){au(8390656,8,a,s)}function Cp(a,s){iu(2048,8,a,s)}function hT(a){nt.flags|=4;var s=nt.updateQueue;if(s===null)s=tu(),nt.updateQueue=s,s.events=[a];else{var u=s.events;u===null?s.events=[a]:u.push(a)}}function Fb(a){var s=Xt().memoizedState;return hT({ref:s,nextImpl:a}),function(){if((Ct&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function qb(a,s){return iu(4,2,a,s)}function Hb(a,s){return iu(4,4,a,s)}function Gb(a,s){if(typeof s=="function"){a=a();var u=s(a);return function(){typeof u=="function"?u():s(null)}}if(s!=null)return a=a(),s.current=a,function(){s.current=null}}function Vb(a,s,u){u=u!=null?u.concat([a]):null,iu(4,4,Gb.bind(null,s,a),u)}function Np(){}function Wb(a,s){var u=Xt();s=s===void 0?null:s;var f=u.memoizedState;return s!==null&&mp(s,f[1])?f[0]:(u.memoizedState=[a,s],a)}function Zb(a,s){var u=Xt();s=s===void 0?null:s;var f=u.memoizedState;if(s!==null&&mp(s,f[1]))return f[0];if(f=a(),Qi){Qe(!0);try{a()}finally{Qe(!1)}}return u.memoizedState=[f,s],f}function Ep(a,s,u){return u===void 0||(Sa&1073741824)!==0&&(pt&261930)===0?a.memoizedState=s:(a.memoizedState=u,a=Q0(),nt.lanes|=a,ci|=a,u)}function Qb(a,s,u,f){return ir(u,s)?u:Fs.current!==null?(a=Ep(a,u,f),ir(a,s)||(on=!0),a):(Sa&42)===0||(Sa&1073741824)!==0&&(pt&261930)===0?(on=!0,a.memoizedState=u):(a=Q0(),nt.lanes|=a,ci|=a,s)}function Kb(a,s,u,f,y){var x=W.p;W.p=x!==0&&8>x?x:8;var E=G.T,P={};G.T=P,Rp(a,!1,s,u);try{var K=y(),ne=G.S;if(ne!==null&&ne(P,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var pe=cT(K,f);al(a,s,pe,dr(a))}else al(a,s,f,dr(a))}catch(ge){al(a,s,{then:function(){},status:"rejected",reason:ge},dr())}finally{W.p=x,E!==null&&P.types!==null&&(E.types=P.types),G.T=E}}function mT(){}function Ap(a,s,u,f){if(a.tag!==5)throw Error(r(476));var y=Yb(a).queue;Kb(a,y,s,Q,u===null?mT:function(){return Xb(a),u(f)})}function Yb(a){var s=a.memoizedState;if(s!==null)return s;s={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:Q},next:null};var u={};return s.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ja,lastRenderedState:u},next:null},a.memoizedState=s,a=a.alternate,a!==null&&(a.memoizedState=s),s}function Xb(a){var s=Yb(a);s.next===null&&(s=a.alternate.memoizedState),al(a,s.next.queue,{},dr())}function Tp(){return jn(wl)}function Jb(){return Xt().memoizedState}function e0(){return Xt().memoizedState}function gT(a){for(var s=a.return;s!==null;){switch(s.tag){case 24:case 3:var u=dr();a=ri(u);var f=ai(s,a,u);f!==null&&(Xn(f,s,u),Jo(f,s,u)),s={cache:ap()},a.payload=s;return}s=s.return}}function vT(a,s,u){var f=dr();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},su(a)?n0(s,u):(u=Wf(a,s,u,f),u!==null&&(Xn(u,a,f),r0(u,s,f)))}function t0(a,s,u){var f=dr();al(a,s,u,f)}function al(a,s,u,f){var y={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(su(a))n0(s,y);else{var x=a.alternate;if(a.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var E=s.lastRenderedState,P=x(E,u);if(y.hasEagerState=!0,y.eagerState=P,ir(P,E))return Uc(a,s,y,0),Lt===null&&Pc(),!1}catch{}finally{}if(u=Wf(a,s,y,f),u!==null)return Xn(u,a,f),r0(u,s,f),!0}return!1}function Rp(a,s,u,f){if(f={lane:2,revertLane:lh(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},su(a)){if(s)throw Error(r(479))}else s=Wf(a,u,f,2),s!==null&&Xn(s,a,2)}function su(a){var s=a.alternate;return a===nt||s!==null&&s===nt}function n0(a,s){qs=Jc=!0;var u=a.pending;u===null?s.next=s:(s.next=u.next,u.next=s),a.pending=s}function r0(a,s,u){if((u&4194048)!==0){var f=s.lanes;f&=a.pendingLanes,u|=f,s.lanes=u,me(a,u)}}var il={readContext:jn,use:nu,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};il.useEffectEvent=Qt;var a0={readContext:jn,use:nu,useCallback:function(a,s){return zn().memoizedState=[a,s===void 0?null:s],a},useContext:jn,useEffect:Bb,useImperativeHandle:function(a,s,u){u=u!=null?u.concat([a]):null,au(4194308,4,Gb.bind(null,s,a),u)},useLayoutEffect:function(a,s){return au(4194308,4,a,s)},useInsertionEffect:function(a,s){au(4,2,a,s)},useMemo:function(a,s){var u=zn();s=s===void 0?null:s;var f=a();if(Qi){Qe(!0);try{a()}finally{Qe(!1)}}return u.memoizedState=[f,s],f},useReducer:function(a,s,u){var f=zn();if(u!==void 0){var y=u(s);if(Qi){Qe(!0);try{u(s)}finally{Qe(!1)}}}else y=s;return f.memoizedState=f.baseState=y,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:y},f.queue=a,a=a.dispatch=vT.bind(null,nt,a),[f.memoizedState,a]},useRef:function(a){var s=zn();return a={current:a},s.memoizedState=a},useState:function(a){a=Sp(a);var s=a.queue,u=t0.bind(null,nt,s);return s.dispatch=u,[a.memoizedState,u]},useDebugValue:Np,useDeferredValue:function(a,s){var u=zn();return Ep(u,a,s)},useTransition:function(){var a=Sp(!1);return a=Kb.bind(null,nt,a.queue,!0,!1),zn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,s,u){var f=nt,y=zn();if(gt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=s(),Lt===null)throw Error(r(349));(pt&127)!==0||Cb(f,s,u)}y.memoizedState=u;var x={value:u,getSnapshot:s};return y.queue=x,Bb(Eb.bind(null,f,x,a),[a]),f.flags|=2048,Gs(9,{destroy:void 0},Nb.bind(null,f,x,u,s),null),u},useId:function(){var a=zn(),s=Lt.identifierPrefix;if(gt){var u=Kr,f=Qr;u=(f&~(1<<32-Te(f)-1)).toString(32)+u,s="_"+s+"R_"+u,u=eu++,0<u&&(s+="H"+u.toString(32)),s+="_"}else u=uT++,s="_"+s+"r_"+u.toString(32)+"_";return a.memoizedState=s},useHostTransitionStatus:Tp,useFormState:Db,useActionState:Db,useOptimistic:function(a){var s=zn();s.memoizedState=s.baseState=a;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=u,s=Rp.bind(null,nt,!0,u),u.dispatch=s,[a,s]},useMemoCache:xp,useCacheRefresh:function(){return zn().memoizedState=gT.bind(null,nt)},useEffectEvent:function(a){var s=zn(),u={impl:a};return s.memoizedState=u,function(){if((Ct&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},_p={readContext:jn,use:nu,useCallback:Wb,useContext:jn,useEffect:Cp,useImperativeHandle:Vb,useInsertionEffect:qb,useLayoutEffect:Hb,useMemo:Zb,useReducer:ru,useRef:Ub,useState:function(){return ru(ja)},useDebugValue:Np,useDeferredValue:function(a,s){var u=Xt();return Qb(u,Rt.memoizedState,a,s)},useTransition:function(){var a=ru(ja)[0],s=Xt().memoizedState;return[typeof a=="boolean"?a:rl(a),s]},useSyncExternalStore:jb,useId:Jb,useHostTransitionStatus:Tp,useFormState:zb,useActionState:zb,useOptimistic:function(a,s){var u=Xt();return Rb(u,Rt,a,s)},useMemoCache:xp,useCacheRefresh:e0};_p.useEffectEvent=Fb;var i0={readContext:jn,use:nu,useCallback:Wb,useContext:jn,useEffect:Cp,useImperativeHandle:Vb,useInsertionEffect:qb,useLayoutEffect:Hb,useMemo:Zb,useReducer:kp,useRef:Ub,useState:function(){return kp(ja)},useDebugValue:Np,useDeferredValue:function(a,s){var u=Xt();return Rt===null?Ep(u,a,s):Qb(u,Rt.memoizedState,a,s)},useTransition:function(){var a=kp(ja)[0],s=Xt().memoizedState;return[typeof a=="boolean"?a:rl(a),s]},useSyncExternalStore:jb,useId:Jb,useHostTransitionStatus:Tp,useFormState:Pb,useActionState:Pb,useOptimistic:function(a,s){var u=Xt();return Rt!==null?Rb(u,Rt,a,s):(u.baseState=a,[a,u.queue.dispatch])},useMemoCache:xp,useCacheRefresh:e0};i0.useEffectEvent=Fb;function Op(a,s,u,f){s=a.memoizedState,u=u(f,s),u=u==null?s:m({},s,u),a.memoizedState=u,a.lanes===0&&(a.updateQueue.baseState=u)}var Mp={enqueueSetState:function(a,s,u){a=a._reactInternals;var f=dr(),y=ri(f);y.payload=s,u!=null&&(y.callback=u),s=ai(a,y,f),s!==null&&(Xn(s,a,f),Jo(s,a,f))},enqueueReplaceState:function(a,s,u){a=a._reactInternals;var f=dr(),y=ri(f);y.tag=1,y.payload=s,u!=null&&(y.callback=u),s=ai(a,y,f),s!==null&&(Xn(s,a,f),Jo(s,a,f))},enqueueForceUpdate:function(a,s){a=a._reactInternals;var u=dr(),f=ri(u);f.tag=2,s!=null&&(f.callback=s),s=ai(a,f,u),s!==null&&(Xn(s,a,u),Jo(s,a,u))}};function s0(a,s,u,f,y,x,E){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(f,x,E):s.prototype&&s.prototype.isPureReactComponent?!Go(u,f)||!Go(y,x):!0}function o0(a,s,u,f){a=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(u,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(u,f),s.state!==a&&Mp.enqueueReplaceState(s,s.state,null)}function Ki(a,s){var u=s;if("ref"in s){u={};for(var f in s)f!=="ref"&&(u[f]=s[f])}if(a=a.defaultProps){u===s&&(u=m({},u));for(var y in a)u[y]===void 0&&(u[y]=a[y])}return u}function l0(a){$c(a)}function c0(a){console.error(a)}function u0(a){$c(a)}function ou(a,s){try{var u=a.onUncaughtError;u(s.value,{componentStack:s.stack})}catch(f){setTimeout(function(){throw f})}}function d0(a,s,u){try{var f=a.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Lp(a,s,u){return u=ri(u),u.tag=3,u.payload={element:null},u.callback=function(){ou(a,s)},u}function f0(a){return a=ri(a),a.tag=3,a}function p0(a,s,u,f){var y=u.type.getDerivedStateFromError;if(typeof y=="function"){var x=f.value;a.payload=function(){return y(x)},a.callback=function(){d0(s,u,f)}}var E=u.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(a.callback=function(){d0(s,u,f),typeof y!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var P=f.stack;this.componentDidCatch(f.value,{componentStack:P!==null?P:""})})}function yT(a,s,u,f,y){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(s=u.alternate,s!==null&&zs(s,u,y,!0),u=or.current,u!==null){switch(u.tag){case 31:case 13:return Ar===null?bu():u.alternate===null&&Kt===0&&(Kt=3),u.flags&=-257,u.flags|=65536,u.lanes=y,f===Zc?u.flags|=16384:(s=u.updateQueue,s===null?u.updateQueue=new Set([f]):s.add(f),ih(a,f,y)),!1;case 22:return u.flags|=65536,f===Zc?u.flags|=16384:(s=u.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=s):(u=s.retryQueue,u===null?s.retryQueue=new Set([f]):u.add(f)),ih(a,f,y)),!1}throw Error(r(435,u.tag))}return ih(a,f,y),bu(),!1}if(gt)return s=or.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=y,f!==Jf&&(a=Error(r(422),{cause:f}),Zo(jr(a,u)))):(f!==Jf&&(s=Error(r(423),{cause:f}),Zo(jr(s,u))),a=a.current.alternate,a.flags|=65536,y&=-y,a.lanes|=y,f=jr(f,u),y=Lp(a.stateNode,f,y),up(a,y),Kt!==4&&(Kt=2)),!1;var x=Error(r(520),{cause:f});if(x=jr(x,u),pl===null?pl=[x]:pl.push(x),Kt!==4&&(Kt=2),s===null)return!0;f=jr(f,u),u=s;do{switch(u.tag){case 3:return u.flags|=65536,a=y&-y,u.lanes|=a,a=Lp(u.stateNode,f,a),up(u,a),!1;case 1:if(s=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ui===null||!ui.has(x))))return u.flags|=65536,y&=-y,u.lanes|=y,y=f0(y),p0(y,a,u,f),up(u,y),!1}u=u.return}while(u!==null);return!1}var Ip=Error(r(461)),on=!1;function Cn(a,s,u,f){s.child=a===null?vb(s,null,u,f):Zi(s,a.child,u,f)}function h0(a,s,u,f,y){u=u.render;var x=s.ref;if("ref"in f){var E={};for(var P in f)P!=="ref"&&(E[P]=f[P])}else E=f;return Hi(s),f=gp(a,s,u,E,x,y),P=vp(),a!==null&&!on?(yp(a,s,y),Ca(a,s,y)):(gt&&P&&Yf(s),s.flags|=1,Cn(a,s,f,y),s.child)}function m0(a,s,u,f,y){if(a===null){var x=u.type;return typeof x=="function"&&!Zf(x)&&x.defaultProps===void 0&&u.compare===null?(s.tag=15,s.type=x,g0(a,s,x,f,y)):(a=Fc(u.type,null,f,s,s.mode,y),a.ref=s.ref,a.return=s,s.child=a)}if(x=a.child,!qp(a,y)){var E=x.memoizedProps;if(u=u.compare,u=u!==null?u:Go,u(E,f)&&a.ref===s.ref)return Ca(a,s,y)}return s.flags|=1,a=ba(x,f),a.ref=s.ref,a.return=s,s.child=a}function g0(a,s,u,f,y){if(a!==null){var x=a.memoizedProps;if(Go(x,f)&&a.ref===s.ref)if(on=!1,s.pendingProps=f=x,qp(a,y))(a.flags&131072)!==0&&(on=!0);else return s.lanes=a.lanes,Ca(a,s,y)}return Dp(a,s,u,f,y)}function v0(a,s,u,f){var y=f.children,x=a!==null?a.memoizedState:null;if(a===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((s.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,a!==null){for(f=s.child=a.child,y=0;f!==null;)y=y|f.lanes|f.childLanes,f=f.sibling;f=y&~x}else f=0,s.child=null;return y0(a,s,x,u,f)}if((u&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},a!==null&&Vc(s,x!==null?x.cachePool:null),x!==null?xb(s,x):fp(),wb(s);else return f=s.lanes=536870912,y0(a,s,x!==null?x.baseLanes|u:u,u,f)}else x!==null?(Vc(s,x.cachePool),xb(s,x),si(),s.memoizedState=null):(a!==null&&Vc(s,null),fp(),si());return Cn(a,s,y,u),s.child}function sl(a,s){return a!==null&&a.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function y0(a,s,u,f,y){var x=sp();return x=x===null?null:{parent:an._currentValue,pool:x},s.memoizedState={baseLanes:u,cachePool:x},a!==null&&Vc(s,null),fp(),wb(s),a!==null&&zs(a,s,f,!0),s.childLanes=y,null}function lu(a,s){return s=uu({mode:s.mode,children:s.children},a.mode),s.ref=a.ref,a.child=s,s.return=a,s}function b0(a,s,u){return Zi(s,a.child,null,u),a=lu(s,s.pendingProps),a.flags|=2,lr(s),s.memoizedState=null,a}function bT(a,s,u){var f=s.pendingProps,y=(s.flags&128)!==0;if(s.flags&=-129,a===null){if(gt){if(f.mode==="hidden")return a=lu(s,f),s.lanes=536870912,sl(null,a);if(hp(s),(a=$t)?(a=_x(a,Er),a=a!==null&&a.data==="&"?a:null,a!==null&&(s.memoizedState={dehydrated:a,treeContext:Xa!==null?{id:Qr,overflow:Kr}:null,retryLane:536870912,hydrationErrors:null},u=nb(a),u.return=s,s.child=u,Sn=s,$t=null)):a=null,a===null)throw ei(s);return s.lanes=536870912,null}return lu(s,f)}var x=a.memoizedState;if(x!==null){var E=x.dehydrated;if(hp(s),y)if(s.flags&256)s.flags&=-257,s=b0(a,s,u);else if(s.memoizedState!==null)s.child=a.child,s.flags|=128,s=null;else throw Error(r(558));else if(on||zs(a,s,u,!1),y=(u&a.childLanes)!==0,on||y){if(f=Lt,f!==null&&(E=_e(f,u),E!==0&&E!==x.retryLane))throw x.retryLane=E,Ui(a,E),Xn(f,a,E),Ip;bu(),s=b0(a,s,u)}else a=x.treeContext,$t=Tr(E.nextSibling),Sn=s,gt=!0,Ja=null,Er=!1,a!==null&&ib(s,a),s=lu(s,f),s.flags|=4096;return s}return a=ba(a.child,{mode:f.mode,children:f.children}),a.ref=s.ref,s.child=a,a.return=s,a}function cu(a,s){var u=s.ref;if(u===null)a!==null&&a.ref!==null&&(s.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(a===null||a.ref!==u)&&(s.flags|=4194816)}}function Dp(a,s,u,f,y){return Hi(s),u=gp(a,s,u,f,void 0,y),f=vp(),a!==null&&!on?(yp(a,s,y),Ca(a,s,y)):(gt&&f&&Yf(s),s.flags|=1,Cn(a,s,u,y),s.child)}function x0(a,s,u,f,y,x){return Hi(s),s.updateQueue=null,u=Sb(s,f,u,y),kb(a),f=vp(),a!==null&&!on?(yp(a,s,x),Ca(a,s,x)):(gt&&f&&Yf(s),s.flags|=1,Cn(a,s,u,x),s.child)}function w0(a,s,u,f,y){if(Hi(s),s.stateNode===null){var x=Ms,E=u.contextType;typeof E=="object"&&E!==null&&(x=jn(E)),x=new u(f,x),s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Mp,s.stateNode=x,x._reactInternals=s,x=s.stateNode,x.props=f,x.state=s.memoizedState,x.refs={},lp(s),E=u.contextType,x.context=typeof E=="object"&&E!==null?jn(E):Ms,x.state=s.memoizedState,E=u.getDerivedStateFromProps,typeof E=="function"&&(Op(s,u,E,f),x.state=s.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(E=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),E!==x.state&&Mp.enqueueReplaceState(x,x.state,null),tl(s,f,x,y),el(),x.state=s.memoizedState),typeof x.componentDidMount=="function"&&(s.flags|=4194308),f=!0}else if(a===null){x=s.stateNode;var P=s.memoizedProps,K=Ki(u,P);x.props=K;var ne=x.context,pe=u.contextType;E=Ms,typeof pe=="object"&&pe!==null&&(E=jn(pe));var ge=u.getDerivedStateFromProps;pe=typeof ge=="function"||typeof x.getSnapshotBeforeUpdate=="function",P=s.pendingProps!==P,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(P||ne!==E)&&o0(s,x,f,E),ni=!1;var se=s.memoizedState;x.state=se,tl(s,f,x,y),el(),ne=s.memoizedState,P||se!==ne||ni?(typeof ge=="function"&&(Op(s,u,ge,f),ne=s.memoizedState),(K=ni||s0(s,u,K,f,se,ne,E))?(pe||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(s.flags|=4194308)):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=ne),x.props=f,x.state=ne,x.context=E,f=K):(typeof x.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{x=s.stateNode,cp(a,s),E=s.memoizedProps,pe=Ki(u,E),x.props=pe,ge=s.pendingProps,se=x.context,ne=u.contextType,K=Ms,typeof ne=="object"&&ne!==null&&(K=jn(ne)),P=u.getDerivedStateFromProps,(ne=typeof P=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E!==ge||se!==K)&&o0(s,x,f,K),ni=!1,se=s.memoizedState,x.state=se,tl(s,f,x,y),el();var ce=s.memoizedState;E!==ge||se!==ce||ni||a!==null&&a.dependencies!==null&&Hc(a.dependencies)?(typeof P=="function"&&(Op(s,u,P,f),ce=s.memoizedState),(pe=ni||s0(s,u,pe,f,se,ce,K)||a!==null&&a.dependencies!==null&&Hc(a.dependencies))?(ne||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,ce,K),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,ce,K)),typeof x.componentDidUpdate=="function"&&(s.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof x.componentDidUpdate!="function"||E===a.memoizedProps&&se===a.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&se===a.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=ce),x.props=f,x.state=ce,x.context=K,f=pe):(typeof x.componentDidUpdate!="function"||E===a.memoizedProps&&se===a.memoizedState||(s.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===a.memoizedProps&&se===a.memoizedState||(s.flags|=1024),f=!1)}return x=f,cu(a,s),f=(s.flags&128)!==0,x||f?(x=s.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:x.render(),s.flags|=1,a!==null&&f?(s.child=Zi(s,a.child,null,y),s.child=Zi(s,null,u,y)):Cn(a,s,u,y),s.memoizedState=x.state,a=s.child):a=Ca(a,s,y),a}function k0(a,s,u,f){return Fi(),s.flags|=256,Cn(a,s,u,f),s.child}var zp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $p(a){return{baseLanes:a,cachePool:db()}}function Pp(a,s,u){return a=a!==null?a.childLanes&~u:0,s&&(a|=ur),a}function S0(a,s,u){var f=s.pendingProps,y=!1,x=(s.flags&128)!==0,E;if((E=x)||(E=a!==null&&a.memoizedState===null?!1:(Yt.current&2)!==0),E&&(y=!0,s.flags&=-129),E=(s.flags&32)!==0,s.flags&=-33,a===null){if(gt){if(y?ii(s):si(),(a=$t)?(a=_x(a,Er),a=a!==null&&a.data!=="&"?a:null,a!==null&&(s.memoizedState={dehydrated:a,treeContext:Xa!==null?{id:Qr,overflow:Kr}:null,retryLane:536870912,hydrationErrors:null},u=nb(a),u.return=s,s.child=u,Sn=s,$t=null)):a=null,a===null)throw ei(s);return wh(a)?s.lanes=32:s.lanes=536870912,null}var P=f.children;return f=f.fallback,y?(si(),y=s.mode,P=uu({mode:"hidden",children:P},y),f=Bi(f,y,u,null),P.return=s,f.return=s,P.sibling=f,s.child=P,f=s.child,f.memoizedState=$p(u),f.childLanes=Pp(a,E,u),s.memoizedState=zp,sl(null,f)):(ii(s),Up(s,P))}var K=a.memoizedState;if(K!==null&&(P=K.dehydrated,P!==null)){if(x)s.flags&256?(ii(s),s.flags&=-257,s=Bp(a,s,u)):s.memoizedState!==null?(si(),s.child=a.child,s.flags|=128,s=null):(si(),P=f.fallback,y=s.mode,f=uu({mode:"visible",children:f.children},y),P=Bi(P,y,u,null),P.flags|=2,f.return=s,P.return=s,f.sibling=P,s.child=f,Zi(s,a.child,null,u),f=s.child,f.memoizedState=$p(u),f.childLanes=Pp(a,E,u),s.memoizedState=zp,s=sl(null,f));else if(ii(s),wh(P)){if(E=P.nextSibling&&P.nextSibling.dataset,E)var ne=E.dgst;E=ne,f=Error(r(419)),f.stack="",f.digest=E,Zo({value:f,source:null,stack:null}),s=Bp(a,s,u)}else if(on||zs(a,s,u,!1),E=(u&a.childLanes)!==0,on||E){if(E=Lt,E!==null&&(f=_e(E,u),f!==0&&f!==K.retryLane))throw K.retryLane=f,Ui(a,f),Xn(E,a,f),Ip;xh(P)||bu(),s=Bp(a,s,u)}else xh(P)?(s.flags|=192,s.child=a.child,s=null):(a=K.treeContext,$t=Tr(P.nextSibling),Sn=s,gt=!0,Ja=null,Er=!1,a!==null&&ib(s,a),s=Up(s,f.children),s.flags|=4096);return s}return y?(si(),P=f.fallback,y=s.mode,K=a.child,ne=K.sibling,f=ba(K,{mode:"hidden",children:f.children}),f.subtreeFlags=K.subtreeFlags&65011712,ne!==null?P=ba(ne,P):(P=Bi(P,y,u,null),P.flags|=2),P.return=s,f.return=s,f.sibling=P,s.child=f,sl(null,f),f=s.child,P=a.child.memoizedState,P===null?P=$p(u):(y=P.cachePool,y!==null?(K=an._currentValue,y=y.parent!==K?{parent:K,pool:K}:y):y=db(),P={baseLanes:P.baseLanes|u,cachePool:y}),f.memoizedState=P,f.childLanes=Pp(a,E,u),s.memoizedState=zp,sl(a.child,f)):(ii(s),u=a.child,a=u.sibling,u=ba(u,{mode:"visible",children:f.children}),u.return=s,u.sibling=null,a!==null&&(E=s.deletions,E===null?(s.deletions=[a],s.flags|=16):E.push(a)),s.child=u,s.memoizedState=null,u)}function Up(a,s){return s=uu({mode:"visible",children:s},a.mode),s.return=a,a.child=s}function uu(a,s){return a=sr(22,a,null,s),a.lanes=0,a}function Bp(a,s,u){return Zi(s,a.child,null,u),a=Up(s,s.pendingProps.children),a.flags|=2,s.memoizedState=null,a}function j0(a,s,u){a.lanes|=s;var f=a.alternate;f!==null&&(f.lanes|=s),np(a.return,s,u)}function Fp(a,s,u,f,y,x){var E=a.memoizedState;E===null?a.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:y,treeForkCount:x}:(E.isBackwards=s,E.rendering=null,E.renderingStartTime=0,E.last=f,E.tail=u,E.tailMode=y,E.treeForkCount=x)}function C0(a,s,u){var f=s.pendingProps,y=f.revealOrder,x=f.tail;f=f.children;var E=Yt.current,P=(E&2)!==0;if(P?(E=E&1|2,s.flags|=128):E&=1,I(Yt,E),Cn(a,s,f,u),f=gt?Wo:0,!P&&a!==null&&(a.flags&128)!==0)e:for(a=s.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&j0(a,u,s);else if(a.tag===19)j0(a,u,s);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(y){case"forwards":for(u=s.child,y=null;u!==null;)a=u.alternate,a!==null&&Xc(a)===null&&(y=u),u=u.sibling;u=y,u===null?(y=s.child,s.child=null):(y=u.sibling,u.sibling=null),Fp(s,!1,y,u,x,f);break;case"backwards":case"unstable_legacy-backwards":for(u=null,y=s.child,s.child=null;y!==null;){if(a=y.alternate,a!==null&&Xc(a)===null){s.child=y;break}a=y.sibling,y.sibling=u,u=y,y=a}Fp(s,!0,u,null,x,f);break;case"together":Fp(s,!1,null,null,void 0,f);break;default:s.memoizedState=null}return s.child}function Ca(a,s,u){if(a!==null&&(s.dependencies=a.dependencies),ci|=s.lanes,(u&s.childLanes)===0)if(a!==null){if(zs(a,s,u,!1),(u&s.childLanes)===0)return null}else return null;if(a!==null&&s.child!==a.child)throw Error(r(153));if(s.child!==null){for(a=s.child,u=ba(a,a.pendingProps),s.child=u,u.return=s;a.sibling!==null;)a=a.sibling,u=u.sibling=ba(a,a.pendingProps),u.return=s;u.sibling=null}return s.child}function qp(a,s){return(a.lanes&s)!==0?!0:(a=a.dependencies,!!(a!==null&&Hc(a)))}function xT(a,s,u){switch(s.tag){case 3:Ee(s,s.stateNode.containerInfo),ti(s,an,a.memoizedState.cache),Fi();break;case 27:case 5:He(s);break;case 4:Ee(s,s.stateNode.containerInfo);break;case 10:ti(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,hp(s),null;break;case 13:var f=s.memoizedState;if(f!==null)return f.dehydrated!==null?(ii(s),s.flags|=128,null):(u&s.child.childLanes)!==0?S0(a,s,u):(ii(s),a=Ca(a,s,u),a!==null?a.sibling:null);ii(s);break;case 19:var y=(a.flags&128)!==0;if(f=(u&s.childLanes)!==0,f||(zs(a,s,u,!1),f=(u&s.childLanes)!==0),y){if(f)return C0(a,s,u);s.flags|=128}if(y=s.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),I(Yt,Yt.current),f)break;return null;case 22:return s.lanes=0,v0(a,s,u,s.pendingProps);case 24:ti(s,an,a.memoizedState.cache)}return Ca(a,s,u)}function N0(a,s,u){if(a!==null)if(a.memoizedProps!==s.pendingProps)on=!0;else{if(!qp(a,u)&&(s.flags&128)===0)return on=!1,xT(a,s,u);on=(a.flags&131072)!==0}else on=!1,gt&&(s.flags&1048576)!==0&&ab(s,Wo,s.index);switch(s.lanes=0,s.tag){case 16:e:{var f=s.pendingProps;if(a=Vi(s.elementType),s.type=a,typeof a=="function")Zf(a)?(f=Ki(a,f),s.tag=1,s=w0(null,s,a,f,u)):(s.tag=0,s=Dp(null,s,a,f,u));else{if(a!=null){var y=a.$$typeof;if(y===O){s.tag=11,s=h0(null,s,a,f,u);break e}else if(y===L){s.tag=14,s=m0(null,s,a,f,u);break e}}throw s=D(a)||a,Error(r(306,s,""))}}return s;case 0:return Dp(a,s,s.type,s.pendingProps,u);case 1:return f=s.type,y=Ki(f,s.pendingProps),w0(a,s,f,y,u);case 3:e:{if(Ee(s,s.stateNode.containerInfo),a===null)throw Error(r(387));f=s.pendingProps;var x=s.memoizedState;y=x.element,cp(a,s),tl(s,f,null,u);var E=s.memoizedState;if(f=E.cache,ti(s,an,f),f!==x.cache&&rp(s,[an],u,!0),el(),f=E.element,x.isDehydrated)if(x={element:f,isDehydrated:!1,cache:E.cache},s.updateQueue.baseState=x,s.memoizedState=x,s.flags&256){s=k0(a,s,f,u);break e}else if(f!==y){y=jr(Error(r(424)),s),Zo(y),s=k0(a,s,f,u);break e}else{switch(a=s.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for($t=Tr(a.firstChild),Sn=s,gt=!0,Ja=null,Er=!0,u=vb(s,null,f,u),s.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Fi(),f===y){s=Ca(a,s,u);break e}Cn(a,s,f,u)}s=s.child}return s;case 26:return cu(a,s),a===null?(u=zx(s.type,null,s.pendingProps,null))?s.memoizedState=u:gt||(u=s.type,a=s.pendingProps,f=Nu(oe.current).createElement(u),f[$e]=s,f[Ye]=a,Nn(f,u,a),Wt(f),s.stateNode=f):s.memoizedState=zx(s.type,a.memoizedProps,s.pendingProps,a.memoizedState),null;case 27:return He(s),a===null&>&&(f=s.stateNode=Lx(s.type,s.pendingProps,oe.current),Sn=s,Er=!0,y=$t,hi(s.type)?(kh=y,$t=Tr(f.firstChild)):$t=y),Cn(a,s,s.pendingProps.children,u),cu(a,s),a===null&&(s.flags|=4194304),s.child;case 5:return a===null&>&&((y=f=$t)&&(f=KT(f,s.type,s.pendingProps,Er),f!==null?(s.stateNode=f,Sn=s,$t=Tr(f.firstChild),Er=!1,y=!0):y=!1),y||ei(s)),He(s),y=s.type,x=s.pendingProps,E=a!==null?a.memoizedProps:null,f=x.children,vh(y,x)?f=null:E!==null&&vh(y,E)&&(s.flags|=32),s.memoizedState!==null&&(y=gp(a,s,dT,null,null,u),wl._currentValue=y),cu(a,s),Cn(a,s,f,u),s.child;case 6:return a===null&>&&((a=u=$t)&&(u=YT(u,s.pendingProps,Er),u!==null?(s.stateNode=u,Sn=s,$t=null,a=!0):a=!1),a||ei(s)),null;case 13:return S0(a,s,u);case 4:return Ee(s,s.stateNode.containerInfo),f=s.pendingProps,a===null?s.child=Zi(s,null,f,u):Cn(a,s,f,u),s.child;case 11:return h0(a,s,s.type,s.pendingProps,u);case 7:return Cn(a,s,s.pendingProps,u),s.child;case 8:return Cn(a,s,s.pendingProps.children,u),s.child;case 12:return Cn(a,s,s.pendingProps.children,u),s.child;case 10:return f=s.pendingProps,ti(s,s.type,f.value),Cn(a,s,f.children,u),s.child;case 9:return y=s.type._context,f=s.pendingProps.children,Hi(s),y=jn(y),f=f(y),s.flags|=1,Cn(a,s,f,u),s.child;case 14:return m0(a,s,s.type,s.pendingProps,u);case 15:return g0(a,s,s.type,s.pendingProps,u);case 19:return C0(a,s,u);case 31:return bT(a,s,u);case 22:return v0(a,s,u,s.pendingProps);case 24:return Hi(s),f=jn(an),a===null?(y=sp(),y===null&&(y=Lt,x=ap(),y.pooledCache=x,x.refCount++,x!==null&&(y.pooledCacheLanes|=u),y=x),s.memoizedState={parent:f,cache:y},lp(s),ti(s,an,y)):((a.lanes&u)!==0&&(cp(a,s),tl(s,null,null,u),el()),y=a.memoizedState,x=s.memoizedState,y.parent!==f?(y={parent:f,cache:f},s.memoizedState=y,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=y),ti(s,an,f)):(f=x.cache,ti(s,an,f),f!==y.cache&&rp(s,[an],u,!0))),Cn(a,s,s.pendingProps.children,u),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Na(a){a.flags|=4}function Hp(a,s,u,f,y){if((s=(a.mode&32)!==0)&&(s=!1),s){if(a.flags|=16777216,(y&335544128)===y)if(a.stateNode.complete)a.flags|=8192;else if(J0())a.flags|=8192;else throw Wi=Zc,op}else a.flags&=-16777217}function E0(a,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!Fx(s))if(J0())a.flags|=8192;else throw Wi=Zc,op}function du(a,s){s!==null&&(a.flags|=4),a.flags&16384&&(s=a.tag!==22?Wa():536870912,a.lanes|=s,Qs|=s)}function ol(a,s){if(!gt)switch(a.tailMode){case"hidden":s=a.tail;for(var u=null;s!==null;)s.alternate!==null&&(u=s),s=s.sibling;u===null?a.tail=null:u.sibling=null;break;case"collapsed":u=a.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?s||a.tail===null?a.tail=null:a.tail.sibling=null:f.sibling=null}}function Pt(a){var s=a.alternate!==null&&a.alternate.child===a.child,u=0,f=0;if(s)for(var y=a.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags&65011712,f|=y.flags&65011712,y.return=a,y=y.sibling;else for(y=a.child;y!==null;)u|=y.lanes|y.childLanes,f|=y.subtreeFlags,f|=y.flags,y.return=a,y=y.sibling;return a.subtreeFlags|=f,a.childLanes=u,s}function wT(a,s,u){var f=s.pendingProps;switch(Xf(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(s),null;case 1:return Pt(s),null;case 3:return u=s.stateNode,f=null,a!==null&&(f=a.memoizedState.cache),s.memoizedState.cache!==f&&(s.flags|=2048),ka(an),Oe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(a===null||a.child===null)&&(Ds(s)?Na(s):a===null||a.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ep())),Pt(s),null;case 26:var y=s.type,x=s.memoizedState;return a===null?(Na(s),x!==null?(Pt(s),E0(s,x)):(Pt(s),Hp(s,y,null,f,u))):x?x!==a.memoizedState?(Na(s),Pt(s),E0(s,x)):(Pt(s),s.flags&=-16777217):(a=a.memoizedProps,a!==f&&Na(s),Pt(s),Hp(s,y,a,f,u)),null;case 27:if(ke(s),u=oe.current,y=s.type,a!==null&&s.stateNode!=null)a.memoizedProps!==f&&Na(s);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Pt(s),null}a=ae.current,Ds(s)?sb(s):(a=Lx(y,f,u),s.stateNode=a,Na(s))}return Pt(s),null;case 5:if(ke(s),y=s.type,a!==null&&s.stateNode!=null)a.memoizedProps!==f&&Na(s);else{if(!f){if(s.stateNode===null)throw Error(r(166));return Pt(s),null}if(x=ae.current,Ds(s))sb(s);else{var E=Nu(oe.current);switch(x){case 1:x=E.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:x=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":x=E.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":x=E.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":x=E.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof f.is=="string"?E.createElement("select",{is:f.is}):E.createElement("select"),f.multiple?x.multiple=!0:f.size&&(x.size=f.size);break;default:x=typeof f.is=="string"?E.createElement(y,{is:f.is}):E.createElement(y)}}x[$e]=s,x[Ye]=f;e:for(E=s.child;E!==null;){if(E.tag===5||E.tag===6)x.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===s)break e;for(;E.sibling===null;){if(E.return===null||E.return===s)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}s.stateNode=x;e:switch(Nn(x,y,f),y){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Na(s)}}return Pt(s),Hp(s,s.type,a===null?null:a.memoizedProps,s.pendingProps,u),null;case 6:if(a&&s.stateNode!=null)a.memoizedProps!==f&&Na(s);else{if(typeof f!="string"&&s.stateNode===null)throw Error(r(166));if(a=oe.current,Ds(s)){if(a=s.stateNode,u=s.memoizedProps,f=null,y=Sn,y!==null)switch(y.tag){case 27:case 5:f=y.memoizedProps}a[$e]=s,a=!!(a.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||Sx(a.nodeValue,u)),a||ei(s,!0)}else a=Nu(a).createTextNode(f),a[$e]=s,s.stateNode=a}return Pt(s),null;case 31:if(u=s.memoizedState,a===null||a.memoizedState!==null){if(f=Ds(s),u!==null){if(a===null){if(!f)throw Error(r(318));if(a=s.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[$e]=s}else Fi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),a=!1}else u=ep(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=u),a=!0;if(!a)return s.flags&256?(lr(s),s):(lr(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Pt(s),null;case 13:if(f=s.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(y=Ds(s),f!==null&&f.dehydrated!==null){if(a===null){if(!y)throw Error(r(318));if(y=s.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[$e]=s}else Fi(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),y=!1}else y=ep(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=y),y=!0;if(!y)return s.flags&256?(lr(s),s):(lr(s),null)}return lr(s),(s.flags&128)!==0?(s.lanes=u,s):(u=f!==null,a=a!==null&&a.memoizedState!==null,u&&(f=s.child,y=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(y=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==y&&(f.flags|=2048)),u!==a&&u&&(s.child.flags|=8192),du(s,s.updateQueue),Pt(s),null);case 4:return Oe(),a===null&&fh(s.stateNode.containerInfo),Pt(s),null;case 10:return ka(s.type),Pt(s),null;case 19:if(Z(Yt),f=s.memoizedState,f===null)return Pt(s),null;if(y=(s.flags&128)!==0,x=f.rendering,x===null)if(y)ol(f,!1);else{if(Kt!==0||a!==null&&(a.flags&128)!==0)for(a=s.child;a!==null;){if(x=Xc(a),x!==null){for(s.flags|=128,ol(f,!1),a=x.updateQueue,s.updateQueue=a,du(s,a),s.subtreeFlags=0,a=u,u=s.child;u!==null;)tb(u,a),u=u.sibling;return I(Yt,Yt.current&1|2),gt&&xa(s,f.treeForkCount),s.child}a=a.sibling}f.tail!==null&&mt()>gu&&(s.flags|=128,y=!0,ol(f,!1),s.lanes=4194304)}else{if(!y)if(a=Xc(x),a!==null){if(s.flags|=128,y=!0,a=a.updateQueue,s.updateQueue=a,du(s,a),ol(f,!0),f.tail===null&&f.tailMode==="hidden"&&!x.alternate&&!gt)return Pt(s),null}else 2*mt()-f.renderingStartTime>gu&&u!==536870912&&(s.flags|=128,y=!0,ol(f,!1),s.lanes=4194304);f.isBackwards?(x.sibling=s.child,s.child=x):(a=f.last,a!==null?a.sibling=x:s.child=x,f.last=x)}return f.tail!==null?(a=f.tail,f.rendering=a,f.tail=a.sibling,f.renderingStartTime=mt(),a.sibling=null,u=Yt.current,I(Yt,y?u&1|2:u&1),gt&&xa(s,f.treeForkCount),a):(Pt(s),null);case 22:case 23:return lr(s),pp(),f=s.memoizedState!==null,a!==null?a.memoizedState!==null!==f&&(s.flags|=8192):f&&(s.flags|=8192),f?(u&536870912)!==0&&(s.flags&128)===0&&(Pt(s),s.subtreeFlags&6&&(s.flags|=8192)):Pt(s),u=s.updateQueue,u!==null&&du(s,u.retryQueue),u=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),f=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(f=s.memoizedState.cachePool.pool),f!==u&&(s.flags|=2048),a!==null&&Z(Gi),null;case 24:return u=null,a!==null&&(u=a.memoizedState.cache),s.memoizedState.cache!==u&&(s.flags|=2048),ka(an),Pt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function kT(a,s){switch(Xf(s),s.tag){case 1:return a=s.flags,a&65536?(s.flags=a&-65537|128,s):null;case 3:return ka(an),Oe(),a=s.flags,(a&65536)!==0&&(a&128)===0?(s.flags=a&-65537|128,s):null;case 26:case 27:case 5:return ke(s),null;case 31:if(s.memoizedState!==null){if(lr(s),s.alternate===null)throw Error(r(340));Fi()}return a=s.flags,a&65536?(s.flags=a&-65537|128,s):null;case 13:if(lr(s),a=s.memoizedState,a!==null&&a.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Fi()}return a=s.flags,a&65536?(s.flags=a&-65537|128,s):null;case 19:return Z(Yt),null;case 4:return Oe(),null;case 10:return ka(s.type),null;case 22:case 23:return lr(s),pp(),a!==null&&Z(Gi),a=s.flags,a&65536?(s.flags=a&-65537|128,s):null;case 24:return ka(an),null;case 25:return null;default:return null}}function A0(a,s){switch(Xf(s),s.tag){case 3:ka(an),Oe();break;case 26:case 27:case 5:ke(s);break;case 4:Oe();break;case 31:s.memoizedState!==null&&lr(s);break;case 13:lr(s);break;case 19:Z(Yt);break;case 10:ka(s.type);break;case 22:case 23:lr(s),pp(),a!==null&&Z(Gi);break;case 24:ka(an)}}function ll(a,s){try{var u=s.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var y=f.next;u=y;do{if((u.tag&a)===a){f=void 0;var x=u.create,E=u.inst;f=x(),E.destroy=f}u=u.next}while(u!==y)}}catch(P){At(s,s.return,P)}}function oi(a,s,u){try{var f=s.updateQueue,y=f!==null?f.lastEffect:null;if(y!==null){var x=y.next;f=x;do{if((f.tag&a)===a){var E=f.inst,P=E.destroy;if(P!==void 0){E.destroy=void 0,y=s;var K=u,ne=P;try{ne()}catch(pe){At(y,K,pe)}}}f=f.next}while(f!==x)}}catch(pe){At(s,s.return,pe)}}function T0(a){var s=a.updateQueue;if(s!==null){var u=a.stateNode;try{bb(s,u)}catch(f){At(a,a.return,f)}}}function R0(a,s,u){u.props=Ki(a.type,a.memoizedProps),u.state=a.memoizedState;try{u.componentWillUnmount()}catch(f){At(a,s,f)}}function cl(a,s){try{var u=a.ref;if(u!==null){switch(a.tag){case 26:case 27:case 5:var f=a.stateNode;break;case 30:f=a.stateNode;break;default:f=a.stateNode}typeof u=="function"?a.refCleanup=u(f):u.current=f}}catch(y){At(a,s,y)}}function Yr(a,s){var u=a.ref,f=a.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(y){At(a,s,y)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(y){At(a,s,y)}else u.current=null}function _0(a){var s=a.type,u=a.memoizedProps,f=a.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(y){At(a,a.return,y)}}function Gp(a,s,u){try{var f=a.stateNode;HT(f,a.type,u,s),f[Ye]=s}catch(y){At(a,a.return,y)}}function O0(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&hi(a.type)||a.tag===4}function Vp(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||O0(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&hi(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Wp(a,s,u){var f=a.tag;if(f===5||f===6)a=a.stateNode,s?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(a,s):(s=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,s.appendChild(a),u=u._reactRootContainer,u!=null||s.onclick!==null||(s.onclick=va));else if(f!==4&&(f===27&&hi(a.type)&&(u=a.stateNode,s=null),a=a.child,a!==null))for(Wp(a,s,u),a=a.sibling;a!==null;)Wp(a,s,u),a=a.sibling}function fu(a,s,u){var f=a.tag;if(f===5||f===6)a=a.stateNode,s?u.insertBefore(a,s):u.appendChild(a);else if(f!==4&&(f===27&&hi(a.type)&&(u=a.stateNode),a=a.child,a!==null))for(fu(a,s,u),a=a.sibling;a!==null;)fu(a,s,u),a=a.sibling}function M0(a){var s=a.stateNode,u=a.memoizedProps;try{for(var f=a.type,y=s.attributes;y.length;)s.removeAttributeNode(y[0]);Nn(s,f,u),s[$e]=a,s[Ye]=u}catch(x){At(a,a.return,x)}}var Ea=!1,ln=!1,Zp=!1,L0=typeof WeakSet=="function"?WeakSet:Set,xn=null;function ST(a,s){if(a=a.containerInfo,mh=Mu,a=Vy(a),Bf(a)){if("selectionStart"in a)var u={start:a.selectionStart,end:a.selectionEnd};else e:{u=(u=a.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var y=f.anchorOffset,x=f.focusNode;f=f.focusOffset;try{u.nodeType,x.nodeType}catch{u=null;break e}var E=0,P=-1,K=-1,ne=0,pe=0,ge=a,se=null;t:for(;;){for(var ce;ge!==u||y!==0&&ge.nodeType!==3||(P=E+y),ge!==x||f!==0&&ge.nodeType!==3||(K=E+f),ge.nodeType===3&&(E+=ge.nodeValue.length),(ce=ge.firstChild)!==null;)se=ge,ge=ce;for(;;){if(ge===a)break t;if(se===u&&++ne===y&&(P=E),se===x&&++pe===f&&(K=E),(ce=ge.nextSibling)!==null)break;ge=se,se=ge.parentNode}ge=ce}u=P===-1||K===-1?null:{start:P,end:K}}else u=null}u=u||{start:0,end:0}}else u=null;for(gh={focusedElem:a,selectionRange:u},Mu=!1,xn=s;xn!==null;)if(s=xn,a=s.child,(s.subtreeFlags&1028)!==0&&a!==null)a.return=s,xn=a;else for(;xn!==null;){switch(s=xn,x=s.alternate,a=s.flags,s.tag){case 0:if((a&4)!==0&&(a=s.updateQueue,a=a!==null?a.events:null,a!==null))for(u=0;u<a.length;u++)y=a[u],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&x!==null){a=void 0,u=s,y=x.memoizedProps,x=x.memoizedState,f=u.stateNode;try{var Ie=Ki(u.type,y);a=f.getSnapshotBeforeUpdate(Ie,x),f.__reactInternalSnapshotBeforeUpdate=a}catch(Ve){At(u,u.return,Ve)}}break;case 3:if((a&1024)!==0){if(a=s.stateNode.containerInfo,u=a.nodeType,u===9)bh(a);else if(u===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":bh(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(r(163))}if(a=s.sibling,a!==null){a.return=s.return,xn=a;break}xn=s.return}}function I0(a,s,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Ta(a,u),f&4&&ll(5,u);break;case 1:if(Ta(a,u),f&4)if(a=u.stateNode,s===null)try{a.componentDidMount()}catch(E){At(u,u.return,E)}else{var y=Ki(u.type,s.memoizedProps);s=s.memoizedState;try{a.componentDidUpdate(y,s,a.__reactInternalSnapshotBeforeUpdate)}catch(E){At(u,u.return,E)}}f&64&&T0(u),f&512&&cl(u,u.return);break;case 3:if(Ta(a,u),f&64&&(a=u.updateQueue,a!==null)){if(s=null,u.child!==null)switch(u.child.tag){case 27:case 5:s=u.child.stateNode;break;case 1:s=u.child.stateNode}try{bb(a,s)}catch(E){At(u,u.return,E)}}break;case 27:s===null&&f&4&&M0(u);case 26:case 5:Ta(a,u),s===null&&f&4&&_0(u),f&512&&cl(u,u.return);break;case 12:Ta(a,u);break;case 31:Ta(a,u),f&4&&$0(a,u);break;case 13:Ta(a,u),f&4&&P0(a,u),f&64&&(a=u.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(u=OT.bind(null,u),XT(a,u))));break;case 22:if(f=u.memoizedState!==null||Ea,!f){s=s!==null&&s.memoizedState!==null||ln,y=Ea;var x=ln;Ea=f,(ln=s)&&!x?Ra(a,u,(u.subtreeFlags&8772)!==0):Ta(a,u),Ea=y,ln=x}break;case 30:break;default:Ta(a,u)}}function D0(a){var s=a.alternate;s!==null&&(a.alternate=null,D0(s)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(s=a.stateNode,s!==null&&js(s)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Ft=null,Zn=!1;function Aa(a,s,u){for(u=u.child;u!==null;)z0(a,s,u),u=u.sibling}function z0(a,s,u){if(De&&typeof De.onCommitFiberUnmount=="function")try{De.onCommitFiberUnmount(Ae,u)}catch{}switch(u.tag){case 26:ln||Yr(u,s),Aa(a,s,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:ln||Yr(u,s);var f=Ft,y=Zn;hi(u.type)&&(Ft=u.stateNode,Zn=!1),Aa(a,s,u),yl(u.stateNode),Ft=f,Zn=y;break;case 5:ln||Yr(u,s);case 6:if(f=Ft,y=Zn,Ft=null,Aa(a,s,u),Ft=f,Zn=y,Ft!==null)if(Zn)try{(Ft.nodeType===9?Ft.body:Ft.nodeName==="HTML"?Ft.ownerDocument.body:Ft).removeChild(u.stateNode)}catch(x){At(u,s,x)}else try{Ft.removeChild(u.stateNode)}catch(x){At(u,s,x)}break;case 18:Ft!==null&&(Zn?(a=Ft,Tx(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,u.stateNode),ro(a)):Tx(Ft,u.stateNode));break;case 4:f=Ft,y=Zn,Ft=u.stateNode.containerInfo,Zn=!0,Aa(a,s,u),Ft=f,Zn=y;break;case 0:case 11:case 14:case 15:oi(2,u,s),ln||oi(4,u,s),Aa(a,s,u);break;case 1:ln||(Yr(u,s),f=u.stateNode,typeof f.componentWillUnmount=="function"&&R0(u,s,f)),Aa(a,s,u);break;case 21:Aa(a,s,u);break;case 22:ln=(f=ln)||u.memoizedState!==null,Aa(a,s,u),ln=f;break;default:Aa(a,s,u)}}function $0(a,s){if(s.memoizedState===null&&(a=s.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{ro(a)}catch(u){At(s,s.return,u)}}}function P0(a,s){if(s.memoizedState===null&&(a=s.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{ro(a)}catch(u){At(s,s.return,u)}}function jT(a){switch(a.tag){case 31:case 13:case 19:var s=a.stateNode;return s===null&&(s=a.stateNode=new L0),s;case 22:return a=a.stateNode,s=a._retryCache,s===null&&(s=a._retryCache=new L0),s;default:throw Error(r(435,a.tag))}}function pu(a,s){var u=jT(a);s.forEach(function(f){if(!u.has(f)){u.add(f);var y=MT.bind(null,a,f);f.then(y,y)}})}function Qn(a,s){var u=s.deletions;if(u!==null)for(var f=0;f<u.length;f++){var y=u[f],x=a,E=s,P=E;e:for(;P!==null;){switch(P.tag){case 27:if(hi(P.type)){Ft=P.stateNode,Zn=!1;break e}break;case 5:Ft=P.stateNode,Zn=!1;break e;case 3:case 4:Ft=P.stateNode.containerInfo,Zn=!0;break e}P=P.return}if(Ft===null)throw Error(r(160));z0(x,E,y),Ft=null,Zn=!1,x=y.alternate,x!==null&&(x.return=null),y.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)U0(s,a),s=s.sibling}var $r=null;function U0(a,s){var u=a.alternate,f=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Qn(s,a),Kn(a),f&4&&(oi(3,a,a.return),ll(3,a),oi(5,a,a.return));break;case 1:Qn(s,a),Kn(a),f&512&&(ln||u===null||Yr(u,u.return)),f&64&&Ea&&(a=a.updateQueue,a!==null&&(f=a.callbacks,f!==null&&(u=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var y=$r;if(Qn(s,a),Kn(a),f&512&&(ln||u===null||Yr(u,u.return)),f&4){var x=u!==null?u.memoizedState:null;if(f=a.memoizedState,u===null)if(f===null)if(a.stateNode===null){e:{f=a.type,u=a.memoizedProps,y=y.ownerDocument||y;t:switch(f){case"title":x=y.getElementsByTagName("title")[0],(!x||x[Wr]||x[$e]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=y.createElement(f),y.head.insertBefore(x,y.querySelector("head > title"))),Nn(x,f,u),x[$e]=a,Wt(x),f=x;break e;case"link":var E=Ux("link","href",y).get(f+(u.href||""));if(E){for(var P=0;P<E.length;P++)if(x=E[P],x.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&x.getAttribute("rel")===(u.rel==null?null:u.rel)&&x.getAttribute("title")===(u.title==null?null:u.title)&&x.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){E.splice(P,1);break t}}x=y.createElement(f),Nn(x,f,u),y.head.appendChild(x);break;case"meta":if(E=Ux("meta","content",y).get(f+(u.content||""))){for(P=0;P<E.length;P++)if(x=E[P],x.getAttribute("content")===(u.content==null?null:""+u.content)&&x.getAttribute("name")===(u.name==null?null:u.name)&&x.getAttribute("property")===(u.property==null?null:u.property)&&x.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&x.getAttribute("charset")===(u.charSet==null?null:u.charSet)){E.splice(P,1);break t}}x=y.createElement(f),Nn(x,f,u),y.head.appendChild(x);break;default:throw Error(r(468,f))}x[$e]=a,Wt(x),f=x}a.stateNode=f}else Bx(y,a.type,a.stateNode);else a.stateNode=Px(y,f,a.memoizedProps);else x!==f?(x===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):x.count--,f===null?Bx(y,a.type,a.stateNode):Px(y,f,a.memoizedProps)):f===null&&a.stateNode!==null&&Gp(a,a.memoizedProps,u.memoizedProps)}break;case 27:Qn(s,a),Kn(a),f&512&&(ln||u===null||Yr(u,u.return)),u!==null&&f&4&&Gp(a,a.memoizedProps,u.memoizedProps);break;case 5:if(Qn(s,a),Kn(a),f&512&&(ln||u===null||Yr(u,u.return)),a.flags&32){y=a.stateNode;try{Ns(y,"")}catch(Ie){At(a,a.return,Ie)}}f&4&&a.stateNode!=null&&(y=a.memoizedProps,Gp(a,y,u!==null?u.memoizedProps:y)),f&1024&&(Zp=!0);break;case 6:if(Qn(s,a),Kn(a),f&4){if(a.stateNode===null)throw Error(r(162));f=a.memoizedProps,u=a.stateNode;try{u.nodeValue=f}catch(Ie){At(a,a.return,Ie)}}break;case 3:if(Tu=null,y=$r,$r=Eu(s.containerInfo),Qn(s,a),$r=y,Kn(a),f&4&&u!==null&&u.memoizedState.isDehydrated)try{ro(s.containerInfo)}catch(Ie){At(a,a.return,Ie)}Zp&&(Zp=!1,B0(a));break;case 4:f=$r,$r=Eu(a.stateNode.containerInfo),Qn(s,a),Kn(a),$r=f;break;case 12:Qn(s,a),Kn(a);break;case 31:Qn(s,a),Kn(a),f&4&&(f=a.updateQueue,f!==null&&(a.updateQueue=null,pu(a,f)));break;case 13:Qn(s,a),Kn(a),a.child.flags&8192&&a.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(mu=mt()),f&4&&(f=a.updateQueue,f!==null&&(a.updateQueue=null,pu(a,f)));break;case 22:y=a.memoizedState!==null;var K=u!==null&&u.memoizedState!==null,ne=Ea,pe=ln;if(Ea=ne||y,ln=pe||K,Qn(s,a),ln=pe,Ea=ne,Kn(a),f&8192)e:for(s=a.stateNode,s._visibility=y?s._visibility&-2:s._visibility|1,y&&(u===null||K||Ea||ln||Yi(a)),u=null,s=a;;){if(s.tag===5||s.tag===26){if(u===null){K=u=s;try{if(x=K.stateNode,y)E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{P=K.stateNode;var ge=K.memoizedProps.style,se=ge!=null&&ge.hasOwnProperty("display")?ge.display:null;P.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ie){At(K,K.return,Ie)}}}else if(s.tag===6){if(u===null){K=s;try{K.stateNode.nodeValue=y?"":K.memoizedProps}catch(Ie){At(K,K.return,Ie)}}}else if(s.tag===18){if(u===null){K=s;try{var ce=K.stateNode;y?Rx(ce,!0):Rx(K.stateNode,!1)}catch(Ie){At(K,K.return,Ie)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===a)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;u===s&&(u=null),s=s.return}u===s&&(u=null),s.sibling.return=s.return,s=s.sibling}f&4&&(f=a.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,pu(a,u))));break;case 19:Qn(s,a),Kn(a),f&4&&(f=a.updateQueue,f!==null&&(a.updateQueue=null,pu(a,f)));break;case 30:break;case 21:break;default:Qn(s,a),Kn(a)}}function Kn(a){var s=a.flags;if(s&2){try{for(var u,f=a.return;f!==null;){if(O0(f)){u=f;break}f=f.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var y=u.stateNode,x=Vp(a);fu(a,x,y);break;case 5:var E=u.stateNode;u.flags&32&&(Ns(E,""),u.flags&=-33);var P=Vp(a);fu(a,P,E);break;case 3:case 4:var K=u.stateNode.containerInfo,ne=Vp(a);Wp(a,ne,K);break;default:throw Error(r(161))}}catch(pe){At(a,a.return,pe)}a.flags&=-3}s&4096&&(a.flags&=-4097)}function B0(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var s=a;B0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),a=a.sibling}}function Ta(a,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)I0(a,s.alternate,s),s=s.sibling}function Yi(a){for(a=a.child;a!==null;){var s=a;switch(s.tag){case 0:case 11:case 14:case 15:oi(4,s,s.return),Yi(s);break;case 1:Yr(s,s.return);var u=s.stateNode;typeof u.componentWillUnmount=="function"&&R0(s,s.return,u),Yi(s);break;case 27:yl(s.stateNode);case 26:case 5:Yr(s,s.return),Yi(s);break;case 22:s.memoizedState===null&&Yi(s);break;case 30:Yi(s);break;default:Yi(s)}a=a.sibling}}function Ra(a,s,u){for(u=u&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var f=s.alternate,y=a,x=s,E=x.flags;switch(x.tag){case 0:case 11:case 15:Ra(y,x,u),ll(4,x);break;case 1:if(Ra(y,x,u),f=x,y=f.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ne){At(f,f.return,ne)}if(f=x,y=f.updateQueue,y!==null){var P=f.stateNode;try{var K=y.shared.hiddenCallbacks;if(K!==null)for(y.shared.hiddenCallbacks=null,y=0;y<K.length;y++)yb(K[y],P)}catch(ne){At(f,f.return,ne)}}u&&E&64&&T0(x),cl(x,x.return);break;case 27:M0(x);case 26:case 5:Ra(y,x,u),u&&f===null&&E&4&&_0(x),cl(x,x.return);break;case 12:Ra(y,x,u);break;case 31:Ra(y,x,u),u&&E&4&&$0(y,x);break;case 13:Ra(y,x,u),u&&E&4&&P0(y,x);break;case 22:x.memoizedState===null&&Ra(y,x,u),cl(x,x.return);break;case 30:break;default:Ra(y,x,u)}s=s.sibling}}function Qp(a,s){var u=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),a=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),a!==u&&(a!=null&&a.refCount++,u!=null&&Qo(u))}function Kp(a,s){a=null,s.alternate!==null&&(a=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==a&&(s.refCount++,a!=null&&Qo(a))}function Pr(a,s,u,f){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)F0(a,s,u,f),s=s.sibling}function F0(a,s,u,f){var y=s.flags;switch(s.tag){case 0:case 11:case 15:Pr(a,s,u,f),y&2048&&ll(9,s);break;case 1:Pr(a,s,u,f);break;case 3:Pr(a,s,u,f),y&2048&&(a=null,s.alternate!==null&&(a=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==a&&(s.refCount++,a!=null&&Qo(a)));break;case 12:if(y&2048){Pr(a,s,u,f),a=s.stateNode;try{var x=s.memoizedProps,E=x.id,P=x.onPostCommit;typeof P=="function"&&P(E,s.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(K){At(s,s.return,K)}}else Pr(a,s,u,f);break;case 31:Pr(a,s,u,f);break;case 13:Pr(a,s,u,f);break;case 23:break;case 22:x=s.stateNode,E=s.alternate,s.memoizedState!==null?x._visibility&2?Pr(a,s,u,f):ul(a,s):x._visibility&2?Pr(a,s,u,f):(x._visibility|=2,Vs(a,s,u,f,(s.subtreeFlags&10256)!==0||!1)),y&2048&&Qp(E,s);break;case 24:Pr(a,s,u,f),y&2048&&Kp(s.alternate,s);break;default:Pr(a,s,u,f)}}function Vs(a,s,u,f,y){for(y=y&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var x=a,E=s,P=u,K=f,ne=E.flags;switch(E.tag){case 0:case 11:case 15:Vs(x,E,P,K,y),ll(8,E);break;case 23:break;case 22:var pe=E.stateNode;E.memoizedState!==null?pe._visibility&2?Vs(x,E,P,K,y):ul(x,E):(pe._visibility|=2,Vs(x,E,P,K,y)),y&&ne&2048&&Qp(E.alternate,E);break;case 24:Vs(x,E,P,K,y),y&&ne&2048&&Kp(E.alternate,E);break;default:Vs(x,E,P,K,y)}s=s.sibling}}function ul(a,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var u=a,f=s,y=f.flags;switch(f.tag){case 22:ul(u,f),y&2048&&Qp(f.alternate,f);break;case 24:ul(u,f),y&2048&&Kp(f.alternate,f);break;default:ul(u,f)}s=s.sibling}}var dl=8192;function Ws(a,s,u){if(a.subtreeFlags&dl)for(a=a.child;a!==null;)q0(a,s,u),a=a.sibling}function q0(a,s,u){switch(a.tag){case 26:Ws(a,s,u),a.flags&dl&&a.memoizedState!==null&&u2(u,$r,a.memoizedState,a.memoizedProps);break;case 5:Ws(a,s,u);break;case 3:case 4:var f=$r;$r=Eu(a.stateNode.containerInfo),Ws(a,s,u),$r=f;break;case 22:a.memoizedState===null&&(f=a.alternate,f!==null&&f.memoizedState!==null?(f=dl,dl=16777216,Ws(a,s,u),dl=f):Ws(a,s,u));break;default:Ws(a,s,u)}}function H0(a){var s=a.alternate;if(s!==null&&(a=s.child,a!==null)){s.child=null;do s=a.sibling,a.sibling=null,a=s;while(a!==null)}}function fl(a){var s=a.deletions;if((a.flags&16)!==0){if(s!==null)for(var u=0;u<s.length;u++){var f=s[u];xn=f,V0(f,a)}H0(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)G0(a),a=a.sibling}function G0(a){switch(a.tag){case 0:case 11:case 15:fl(a),a.flags&2048&&oi(9,a,a.return);break;case 3:fl(a);break;case 12:fl(a);break;case 22:var s=a.stateNode;a.memoizedState!==null&&s._visibility&2&&(a.return===null||a.return.tag!==13)?(s._visibility&=-3,hu(a)):fl(a);break;default:fl(a)}}function hu(a){var s=a.deletions;if((a.flags&16)!==0){if(s!==null)for(var u=0;u<s.length;u++){var f=s[u];xn=f,V0(f,a)}H0(a)}for(a=a.child;a!==null;){switch(s=a,s.tag){case 0:case 11:case 15:oi(8,s,s.return),hu(s);break;case 22:u=s.stateNode,u._visibility&2&&(u._visibility&=-3,hu(s));break;default:hu(s)}a=a.sibling}}function V0(a,s){for(;xn!==null;){var u=xn;switch(u.tag){case 0:case 11:case 15:oi(8,u,s);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Qo(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,xn=f;else e:for(u=a;xn!==null;){f=xn;var y=f.sibling,x=f.return;if(D0(f),f===u){xn=null;break e}if(y!==null){y.return=x,xn=y;break e}xn=x}}}var CT={getCacheForType:function(a){var s=jn(an),u=s.data.get(a);return u===void 0&&(u=a(),s.data.set(a,u)),u},cacheSignal:function(){return jn(an).controller.signal}},NT=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Lt=null,ct=null,pt=0,Et=0,cr=null,li=!1,Zs=!1,Yp=!1,_a=0,Kt=0,ci=0,Xi=0,Xp=0,ur=0,Qs=0,pl=null,Yn=null,Jp=!1,mu=0,W0=0,gu=1/0,vu=null,ui=null,pn=0,di=null,Ks=null,Oa=0,eh=0,th=null,Z0=null,hl=0,nh=null;function dr(){return(Ct&2)!==0&&pt!==0?pt&-pt:G.T!==null?lh():Me()}function Q0(){if(ur===0)if((pt&536870912)===0||gt){var a=yn;yn<<=1,(yn&3932160)===0&&(yn=262144),ur=a}else ur=536870912;return a=or.current,a!==null&&(a.flags|=32),ur}function Xn(a,s,u){(a===Lt&&(Et===2||Et===9)||a.cancelPendingCommit!==null)&&(Ys(a,0),fi(a,pt,ur,!1)),Za(a,u),((Ct&2)===0||a!==Lt)&&(a===Lt&&((Ct&2)===0&&(Xi|=u),Kt===4&&fi(a,pt,ur,!1)),Xr(a))}function K0(a,s,u){if((Ct&6)!==0)throw Error(r(327));var f=!u&&(s&127)===0&&(s&a.expiredLanes)===0||pa(a,s),y=f?TT(a,s):ah(a,s,!0),x=f;do{if(y===0){Zs&&!f&&fi(a,s,0,!1);break}else{if(u=a.current.alternate,x&&!ET(u)){y=ah(a,s,!1),x=!1;continue}if(y===2){if(x=s,a.errorRecoveryDisabledLanes&x)var E=0;else E=a.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){s=E;e:{var P=a;y=pl;var K=P.current.memoizedState.isDehydrated;if(K&&(Ys(P,E).flags|=256),E=ah(P,E,!1),E!==2){if(Yp&&!K){P.errorRecoveryDisabledLanes|=x,Xi|=x,y=4;break e}x=Yn,Yn=y,x!==null&&(Yn===null?Yn=x:Yn.push.apply(Yn,x))}y=E}if(x=!1,y!==2)continue}}if(y===1){Ys(a,0),fi(a,s,0,!0);break}e:{switch(f=a,x=y,x){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:fi(f,s,ur,!li);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(y=mu+300-mt(),10<y)){if(fi(f,s,ur,!li),Va(f,0,!0)!==0)break e;Oa=s,f.timeoutHandle=Ex(Y0.bind(null,f,u,Yn,vu,Jp,s,ur,Xi,Qs,li,x,"Throttled",-0,0),y);break e}Y0(f,u,Yn,vu,Jp,s,ur,Xi,Qs,li,x,null,-0,0)}}break}while(!0);Xr(a)}function Y0(a,s,u,f,y,x,E,P,K,ne,pe,ge,se,ce){if(a.timeoutHandle=-1,ge=s.subtreeFlags,ge&8192||(ge&16785408)===16785408){ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:va},q0(s,x,ge);var Ie=(x&62914560)===x?mu-mt():(x&4194048)===x?W0-mt():0;if(Ie=d2(ge,Ie),Ie!==null){Oa=x,a.cancelPendingCommit=Ie(ix.bind(null,a,s,x,u,f,y,E,P,K,pe,ge,null,se,ce)),fi(a,x,E,!ne);return}}ix(a,s,x,u,f,y,E,P,K)}function ET(a){for(var s=a;;){var u=s.tag;if((u===0||u===11||u===15)&&s.flags&16384&&(u=s.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var y=u[f],x=y.getSnapshot;y=y.value;try{if(!ir(x(),y))return!1}catch{return!1}}if(u=s.child,s.subtreeFlags&16384&&u!==null)u.return=s,s=u;else{if(s===a)break;for(;s.sibling===null;){if(s.return===null||s.return===a)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function fi(a,s,u,f){s&=~Xp,s&=~Xi,a.suspendedLanes|=s,a.pingedLanes&=~s,f&&(a.warmLanes|=s),f=a.expirationTimes;for(var y=s;0<y;){var x=31-Te(y),E=1<<x;f[x]=-1,y&=~E}u!==0&&Ss(a,u,s)}function yu(){return(Ct&6)===0?(ml(0),!1):!0}function rh(){if(ct!==null){if(Et===0)var a=ct.return;else a=ct,wa=qi=null,bp(a),Bs=null,Yo=0,a=ct;for(;a!==null;)A0(a.alternate,a),a=a.return;ct=null}}function Ys(a,s){var u=a.timeoutHandle;u!==-1&&(a.timeoutHandle=-1,WT(u)),u=a.cancelPendingCommit,u!==null&&(a.cancelPendingCommit=null,u()),Oa=0,rh(),Lt=a,ct=u=ba(a.current,null),pt=s,Et=0,cr=null,li=!1,Zs=pa(a,s),Yp=!1,Qs=ur=Xp=Xi=ci=Kt=0,Yn=pl=null,Jp=!1,(s&8)!==0&&(s|=s&32);var f=a.entangledLanes;if(f!==0)for(a=a.entanglements,f&=s;0<f;){var y=31-Te(f),x=1<<y;s|=a[y],f&=~x}return _a=s,Pc(),u}function X0(a,s){nt=null,G.H=il,s===Us||s===Wc?(s=hb(),Et=3):s===op?(s=hb(),Et=4):Et=s===Ip?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,cr=s,ct===null&&(Kt=1,ou(a,jr(s,a.current)))}function J0(){var a=or.current;return a===null?!0:(pt&4194048)===pt?Ar===null:(pt&62914560)===pt||(pt&536870912)!==0?a===Ar:!1}function ex(){var a=G.H;return G.H=il,a===null?il:a}function tx(){var a=G.A;return G.A=CT,a}function bu(){Kt=4,li||(pt&4194048)!==pt&&or.current!==null||(Zs=!0),(ci&134217727)===0&&(Xi&134217727)===0||Lt===null||fi(Lt,pt,ur,!1)}function ah(a,s,u){var f=Ct;Ct|=2;var y=ex(),x=tx();(Lt!==a||pt!==s)&&(vu=null,Ys(a,s)),s=!1;var E=Kt;e:do try{if(Et!==0&&ct!==null){var P=ct,K=cr;switch(Et){case 8:rh(),E=6;break e;case 3:case 2:case 9:case 6:or.current===null&&(s=!0);var ne=Et;if(Et=0,cr=null,Xs(a,P,K,ne),u&&Zs){E=0;break e}break;default:ne=Et,Et=0,cr=null,Xs(a,P,K,ne)}}AT(),E=Kt;break}catch(pe){X0(a,pe)}while(!0);return s&&a.shellSuspendCounter++,wa=qi=null,Ct=f,G.H=y,G.A=x,ct===null&&(Lt=null,pt=0,Pc()),E}function AT(){for(;ct!==null;)nx(ct)}function TT(a,s){var u=Ct;Ct|=2;var f=ex(),y=tx();Lt!==a||pt!==s?(vu=null,gu=mt()+500,Ys(a,s)):Zs=pa(a,s);e:do try{if(Et!==0&&ct!==null){s=ct;var x=cr;t:switch(Et){case 1:Et=0,cr=null,Xs(a,s,x,1);break;case 2:case 9:if(fb(x)){Et=0,cr=null,rx(s);break}s=function(){Et!==2&&Et!==9||Lt!==a||(Et=7),Xr(a)},x.then(s,s);break e;case 3:Et=7;break e;case 4:Et=5;break e;case 7:fb(x)?(Et=0,cr=null,rx(s)):(Et=0,cr=null,Xs(a,s,x,7));break;case 5:var E=null;switch(ct.tag){case 26:E=ct.memoizedState;case 5:case 27:var P=ct;if(E?Fx(E):P.stateNode.complete){Et=0,cr=null;var K=P.sibling;if(K!==null)ct=K;else{var ne=P.return;ne!==null?(ct=ne,xu(ne)):ct=null}break t}}Et=0,cr=null,Xs(a,s,x,5);break;case 6:Et=0,cr=null,Xs(a,s,x,6);break;case 8:rh(),Kt=6;break e;default:throw Error(r(462))}}RT();break}catch(pe){X0(a,pe)}while(!0);return wa=qi=null,G.H=f,G.A=y,Ct=u,ct!==null?0:(Lt=null,pt=0,Pc(),Kt)}function RT(){for(;ct!==null&&!at();)nx(ct)}function nx(a){var s=N0(a.alternate,a,_a);a.memoizedProps=a.pendingProps,s===null?xu(a):ct=s}function rx(a){var s=a,u=s.alternate;switch(s.tag){case 15:case 0:s=x0(u,s,s.pendingProps,s.type,void 0,pt);break;case 11:s=x0(u,s,s.pendingProps,s.type.render,s.ref,pt);break;case 5:bp(s);default:A0(u,s),s=ct=tb(s,_a),s=N0(u,s,_a)}a.memoizedProps=a.pendingProps,s===null?xu(a):ct=s}function Xs(a,s,u,f){wa=qi=null,bp(s),Bs=null,Yo=0;var y=s.return;try{if(yT(a,y,s,u,pt)){Kt=1,ou(a,jr(u,a.current)),ct=null;return}}catch(x){if(y!==null)throw ct=y,x;Kt=1,ou(a,jr(u,a.current)),ct=null;return}s.flags&32768?(gt||f===1?a=!0:Zs||(pt&536870912)!==0?a=!1:(li=a=!0,(f===2||f===9||f===3||f===6)&&(f=or.current,f!==null&&f.tag===13&&(f.flags|=16384))),ax(s,a)):xu(s)}function xu(a){var s=a;do{if((s.flags&32768)!==0){ax(s,li);return}a=s.return;var u=wT(s.alternate,s,_a);if(u!==null){ct=u;return}if(s=s.sibling,s!==null){ct=s;return}ct=s=a}while(s!==null);Kt===0&&(Kt=5)}function ax(a,s){do{var u=kT(a.alternate,a);if(u!==null){u.flags&=32767,ct=u;return}if(u=a.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!s&&(a=a.sibling,a!==null)){ct=a;return}ct=a=u}while(a!==null);Kt=6,ct=null}function ix(a,s,u,f,y,x,E,P,K){a.cancelPendingCommit=null;do wu();while(pn!==0);if((Ct&6)!==0)throw Error(r(327));if(s!==null){if(s===a.current)throw Error(r(177));if(x=s.lanes|s.childLanes,x|=Vf,Ii(a,u,x,E,P,K),a===Lt&&(ct=Lt=null,pt=0),Ks=s,di=a,Oa=u,eh=x,th=y,Z0=f,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,LT(Ne,function(){return ux(),null})):(a.callbackNode=null,a.callbackPriority=0),f=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||f){f=G.T,G.T=null,y=W.p,W.p=2,E=Ct,Ct|=4;try{ST(a,s,u)}finally{Ct=E,W.p=y,G.T=f}}pn=1,sx(),ox(),lx()}}function sx(){if(pn===1){pn=0;var a=di,s=Ks,u=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||u){u=G.T,G.T=null;var f=W.p;W.p=2;var y=Ct;Ct|=4;try{U0(s,a);var x=gh,E=Vy(a.containerInfo),P=x.focusedElem,K=x.selectionRange;if(E!==P&&P&&P.ownerDocument&&Gy(P.ownerDocument.documentElement,P)){if(K!==null&&Bf(P)){var ne=K.start,pe=K.end;if(pe===void 0&&(pe=ne),"selectionStart"in P)P.selectionStart=ne,P.selectionEnd=Math.min(pe,P.value.length);else{var ge=P.ownerDocument||document,se=ge&&ge.defaultView||window;if(se.getSelection){var ce=se.getSelection(),Ie=P.textContent.length,Ve=Math.min(K.start,Ie),Ot=K.end===void 0?Ve:Math.min(K.end,Ie);!ce.extend&&Ve>Ot&&(E=Ot,Ot=Ve,Ve=E);var ee=Hy(P,Ve),J=Hy(P,Ot);if(ee&&J&&(ce.rangeCount!==1||ce.anchorNode!==ee.node||ce.anchorOffset!==ee.offset||ce.focusNode!==J.node||ce.focusOffset!==J.offset)){var te=ge.createRange();te.setStart(ee.node,ee.offset),ce.removeAllRanges(),Ve>Ot?(ce.addRange(te),ce.extend(J.node,J.offset)):(te.setEnd(J.node,J.offset),ce.addRange(te))}}}}for(ge=[],ce=P;ce=ce.parentNode;)ce.nodeType===1&&ge.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ge.length;P++){var he=ge[P];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Mu=!!mh,gh=mh=null}finally{Ct=y,W.p=f,G.T=u}}a.current=s,pn=2}}function ox(){if(pn===2){pn=0;var a=di,s=Ks,u=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||u){u=G.T,G.T=null;var f=W.p;W.p=2;var y=Ct;Ct|=4;try{I0(a,s.alternate,s)}finally{Ct=y,W.p=f,G.T=u}}pn=3}}function lx(){if(pn===4||pn===3){pn=0,rn();var a=di,s=Ks,u=Oa,f=Z0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?pn=5:(pn=0,Ks=di=null,cx(a,a.pendingLanes));var y=a.pendingLanes;if(y===0&&(ui=null),Ce(u),s=s.stateNode,De&&typeof De.onCommitFiberRoot=="function")try{De.onCommitFiberRoot(Ae,s,void 0,(s.current.flags&128)===128)}catch{}if(f!==null){s=G.T,y=W.p,W.p=2,G.T=null;try{for(var x=a.onRecoverableError,E=0;E<f.length;E++){var P=f[E];x(P.value,{componentStack:P.stack})}}finally{G.T=s,W.p=y}}(Oa&3)!==0&&wu(),Xr(a),y=a.pendingLanes,(u&261930)!==0&&(y&42)!==0?a===nh?hl++:(hl=0,nh=a):hl=0,ml(0)}}function cx(a,s){(a.pooledCacheLanes&=s)===0&&(s=a.pooledCache,s!=null&&(a.pooledCache=null,Qo(s)))}function wu(){return sx(),ox(),lx(),ux()}function ux(){if(pn!==5)return!1;var a=di,s=eh;eh=0;var u=Ce(Oa),f=G.T,y=W.p;try{W.p=32>u?32:u,G.T=null,u=th,th=null;var x=di,E=Oa;if(pn=0,Ks=di=null,Oa=0,(Ct&6)!==0)throw Error(r(331));var P=Ct;if(Ct|=4,G0(x.current),F0(x,x.current,E,u),Ct=P,ml(0,!1),De&&typeof De.onPostCommitFiberRoot=="function")try{De.onPostCommitFiberRoot(Ae,x)}catch{}return!0}finally{W.p=y,G.T=f,cx(a,s)}}function dx(a,s,u){s=jr(u,s),s=Lp(a.stateNode,s,2),a=ai(a,s,2),a!==null&&(Za(a,2),Xr(a))}function At(a,s,u){if(a.tag===3)dx(a,a,u);else for(;s!==null;){if(s.tag===3){dx(s,a,u);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(ui===null||!ui.has(f))){a=jr(u,a),u=f0(2),f=ai(s,u,2),f!==null&&(p0(u,f,s,a),Za(f,2),Xr(f));break}}s=s.return}}function ih(a,s,u){var f=a.pingCache;if(f===null){f=a.pingCache=new NT;var y=new Set;f.set(s,y)}else y=f.get(s),y===void 0&&(y=new Set,f.set(s,y));y.has(u)||(Yp=!0,y.add(u),a=_T.bind(null,a,s,u),s.then(a,a))}function _T(a,s,u){var f=a.pingCache;f!==null&&f.delete(s),a.pingedLanes|=a.suspendedLanes&u,a.warmLanes&=~u,Lt===a&&(pt&u)===u&&(Kt===4||Kt===3&&(pt&62914560)===pt&&300>mt()-mu?(Ct&2)===0&&Ys(a,0):Xp|=u,Qs===pt&&(Qs=0)),Xr(a)}function fx(a,s){s===0&&(s=Wa()),a=Ui(a,s),a!==null&&(Za(a,s),Xr(a))}function OT(a){var s=a.memoizedState,u=0;s!==null&&(u=s.retryLane),fx(a,u)}function MT(a,s){var u=0;switch(a.tag){case 31:case 13:var f=a.stateNode,y=a.memoizedState;y!==null&&(u=y.retryLane);break;case 19:f=a.stateNode;break;case 22:f=a.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(s),fx(a,u)}function LT(a,s){return be(a,s)}var ku=null,Js=null,sh=!1,Su=!1,oh=!1,pi=0;function Xr(a){a!==Js&&a.next===null&&(Js===null?ku=Js=a:Js=Js.next=a),Su=!0,sh||(sh=!0,DT())}function ml(a,s){if(!oh&&Su){oh=!0;do for(var u=!1,f=ku;f!==null;){if(a!==0){var y=f.pendingLanes;if(y===0)var x=0;else{var E=f.suspendedLanes,P=f.pingedLanes;x=(1<<31-Te(42|a)+1)-1,x&=y&~(E&~P),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,gx(f,x))}else x=pt,x=Va(f,f===Lt?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(x&3)===0||pa(f,x)||(u=!0,gx(f,x));f=f.next}while(u);oh=!1}}function IT(){px()}function px(){Su=sh=!1;var a=0;pi!==0&&VT()&&(a=pi);for(var s=mt(),u=null,f=ku;f!==null;){var y=f.next,x=hx(f,s);x===0?(f.next=null,u===null?ku=y:u.next=y,y===null&&(Js=u)):(u=f,(a!==0||(x&3)!==0)&&(Su=!0)),f=y}pn!==0&&pn!==5||ml(a),pi!==0&&(pi=0)}function hx(a,s){for(var u=a.suspendedLanes,f=a.pingedLanes,y=a.expirationTimes,x=a.pendingLanes&-62914561;0<x;){var E=31-Te(x),P=1<<E,K=y[E];K===-1?((P&u)===0||(P&f)!==0)&&(y[E]=ks(P,s)):K<=s&&(a.expiredLanes|=P),x&=~P}if(s=Lt,u=pt,u=Va(a,a===s?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),f=a.callbackNode,u===0||a===s&&(Et===2||Et===9)||a.cancelPendingCommit!==null)return f!==null&&f!==null&&bt(f),a.callbackNode=null,a.callbackPriority=0;if((u&3)===0||pa(a,u)){if(s=u&-u,s===a.callbackPriority)return s;switch(f!==null&&bt(f),Ce(u)){case 2:case 8:u=fe;break;case 32:u=Ne;break;case 268435456:u=V;break;default:u=Ne}return f=mx.bind(null,a),u=be(u,f),a.callbackPriority=s,a.callbackNode=u,s}return f!==null&&f!==null&&bt(f),a.callbackPriority=2,a.callbackNode=null,2}function mx(a,s){if(pn!==0&&pn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var u=a.callbackNode;if(wu()&&a.callbackNode!==u)return null;var f=pt;return f=Va(a,a===Lt?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),f===0?null:(K0(a,f,s),hx(a,mt()),a.callbackNode!=null&&a.callbackNode===u?mx.bind(null,a):null)}function gx(a,s){if(wu())return null;K0(a,s,!0)}function DT(){ZT(function(){(Ct&6)!==0?be(X,IT):px()})}function lh(){if(pi===0){var a=$s;a===0&&(a=Mn,Mn<<=1,(Mn&261888)===0&&(Mn=256)),pi=a}return pi}function vx(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:_c(""+a)}function yx(a,s){var u=s.ownerDocument.createElement("input");return u.name=s.name,u.value=s.value,a.id&&u.setAttribute("form",a.id),s.parentNode.insertBefore(u,s),a=new FormData(a),u.parentNode.removeChild(u),a}function zT(a,s,u,f,y){if(s==="submit"&&u&&u.stateNode===y){var x=vx((y[Ye]||null).action),E=f.submitter;E&&(s=(s=E[Ye]||null)?vx(s.formAction):E.getAttribute("formAction"),s!==null&&(x=s,E=null));var P=new Ic("action","action",null,f,y);a.push({event:P,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(pi!==0){var K=E?yx(y,E):new FormData(y);Ap(u,{pending:!0,data:K,method:y.method,action:x},null,K)}}else typeof x=="function"&&(P.preventDefault(),K=E?yx(y,E):new FormData(y),Ap(u,{pending:!0,data:K,method:y.method,action:x},x,K))},currentTarget:y}]})}}for(var ch=0;ch<Gf.length;ch++){var uh=Gf[ch],$T=uh.toLowerCase(),PT=uh[0].toUpperCase()+uh.slice(1);zr($T,"on"+PT)}zr(Qy,"onAnimationEnd"),zr(Ky,"onAnimationIteration"),zr(Yy,"onAnimationStart"),zr("dblclick","onDoubleClick"),zr("focusin","onFocus"),zr("focusout","onBlur"),zr(tT,"onTransitionRun"),zr(nT,"onTransitionStart"),zr(rT,"onTransitionCancel"),zr(Xy,"onTransitionEnd"),wr("onMouseEnter",["mouseout","mouseover"]),wr("onMouseLeave",["mouseout","mouseover"]),wr("onPointerEnter",["pointerout","pointerover"]),wr("onPointerLeave",["pointerout","pointerover"]),In("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),In("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),In("onBeforeInput",["compositionend","keypress","textInput","paste"]),In("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),In("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),In("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),UT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gl));function bx(a,s){s=(s&4)!==0;for(var u=0;u<a.length;u++){var f=a[u],y=f.event;f=f.listeners;e:{var x=void 0;if(s)for(var E=f.length-1;0<=E;E--){var P=f[E],K=P.instance,ne=P.currentTarget;if(P=P.listener,K!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ne;try{x(y)}catch(pe){$c(pe)}y.currentTarget=null,x=K}else for(E=0;E<f.length;E++){if(P=f[E],K=P.instance,ne=P.currentTarget,P=P.listener,K!==x&&y.isPropagationStopped())break e;x=P,y.currentTarget=ne;try{x(y)}catch(pe){$c(pe)}y.currentTarget=null,x=K}}}}function ut(a,s){var u=s[ha];u===void 0&&(u=s[ha]=new Set);var f=a+"__bubble";u.has(f)||(xx(s,a,2,!1),u.add(f))}function dh(a,s,u){var f=0;s&&(f|=4),xx(u,a,f,s)}var ju="_reactListening"+Math.random().toString(36).slice(2);function fh(a){if(!a[ju]){a[ju]=!0,Gn.forEach(function(u){u!=="selectionchange"&&(UT.has(u)||dh(u,!1,a),dh(u,!0,a))});var s=a.nodeType===9?a:a.ownerDocument;s===null||s[ju]||(s[ju]=!0,dh("selectionchange",!1,s))}}function xx(a,s,u,f){switch(Qx(s)){case 2:var y=h2;break;case 8:y=m2;break;default:y=Eh}u=y.bind(null,s,u,a),y=void 0,!Of||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(y=!0),f?y!==void 0?a.addEventListener(s,u,{capture:!0,passive:y}):a.addEventListener(s,u,!0):y!==void 0?a.addEventListener(s,u,{passive:y}):a.addEventListener(s,u,!1)}function ph(a,s,u,f,y){var x=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var E=f.tag;if(E===3||E===4){var P=f.stateNode.containerInfo;if(P===y)break;if(E===4)for(E=f.return;E!==null;){var K=E.tag;if((K===3||K===4)&&E.stateNode.containerInfo===y)return;E=E.return}for(;P!==null;){if(E=ma(P),E===null)return;if(K=E.tag,K===5||K===6||K===26||K===27){f=x=E;continue e}P=P.parentNode}}f=f.return}Cy(function(){var ne=x,pe=Rf(u),ge=[];e:{var se=Jy.get(a);if(se!==void 0){var ce=Ic,Ie=a;switch(a){case"keypress":if(Mc(u)===0)break e;case"keydown":case"keyup":ce=MA;break;case"focusin":Ie="focus",ce=Df;break;case"focusout":Ie="blur",ce=Df;break;case"beforeblur":case"afterblur":ce=Df;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=Ay;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=wA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=DA;break;case Qy:case Ky:case Yy:ce=jA;break;case Xy:ce=$A;break;case"scroll":case"scrollend":ce=bA;break;case"wheel":ce=UA;break;case"copy":case"cut":case"paste":ce=NA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=Ry;break;case"toggle":case"beforetoggle":ce=FA}var Ve=(s&4)!==0,Ot=!Ve&&(a==="scroll"||a==="scrollend"),ee=Ve?se!==null?se+"Capture":null:se;Ve=[];for(var J=ne,te;J!==null;){var he=J;if(te=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||te===null||ee===null||(he=$o(J,ee),he!=null&&Ve.push(vl(J,he,te))),Ot)break;J=J.return}0<Ve.length&&(se=new ce(se,Ie,null,u,pe),ge.push({event:se,listeners:Ve}))}}if((s&7)===0){e:{if(se=a==="mouseover"||a==="pointerover",ce=a==="mouseout"||a==="pointerout",se&&u!==Tf&&(Ie=u.relatedTarget||u.fromElement)&&(ma(Ie)||Ie[Tn]))break e;if((ce||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,ce?(Ie=u.relatedTarget||u.toElement,ce=ne,Ie=Ie?ma(Ie):null,Ie!==null&&(Ot=o(Ie),Ve=Ie.tag,Ie!==Ot||Ve!==5&&Ve!==27&&Ve!==6)&&(Ie=null)):(ce=null,Ie=ne),ce!==Ie)){if(Ve=Ay,he="onMouseLeave",ee="onMouseEnter",J="mouse",(a==="pointerout"||a==="pointerover")&&(Ve=Ry,he="onPointerLeave",ee="onPointerEnter",J="pointer"),Ot=ce==null?se:Ln(ce),te=Ie==null?se:Ln(Ie),se=new Ve(he,J+"leave",ce,u,pe),se.target=Ot,se.relatedTarget=te,he=null,ma(pe)===ne&&(Ve=new Ve(ee,J+"enter",Ie,u,pe),Ve.target=te,Ve.relatedTarget=Ot,he=Ve),Ot=he,ce&&Ie)t:{for(Ve=BT,ee=ce,J=Ie,te=0,he=ee;he;he=Ve(he))te++;he=0;for(var Ue=J;Ue;Ue=Ve(Ue))he++;for(;0<te-he;)ee=Ve(ee),te--;for(;0<he-te;)J=Ve(J),he--;for(;te--;){if(ee===J||J!==null&&ee===J.alternate){Ve=ee;break t}ee=Ve(ee),J=Ve(J)}Ve=null}else Ve=null;ce!==null&&wx(ge,se,ce,Ve,!1),Ie!==null&&Ot!==null&&wx(ge,Ot,Ie,Ve,!0)}}e:{if(se=ne?Ln(ne):window,ce=se.nodeName&&se.nodeName.toLowerCase(),ce==="select"||ce==="input"&&se.type==="file")var xt=$y;else if(Dy(se))if(Py)xt=XA;else{xt=KA;var ze=QA}else ce=se.nodeName,!ce||ce.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ne&&Af(ne.elementType)&&(xt=$y):xt=YA;if(xt&&(xt=xt(a,ne))){zy(ge,xt,u,pe);break e}ze&&ze(a,se,ne),a==="focusout"&&ne&&se.type==="number"&&ne.memoizedProps.value!=null&&Ef(se,"number",se.value)}switch(ze=ne?Ln(ne):window,a){case"focusin":(Dy(ze)||ze.contentEditable==="true")&&(Rs=ze,Ff=ne,Vo=null);break;case"focusout":Vo=Ff=Rs=null;break;case"mousedown":qf=!0;break;case"contextmenu":case"mouseup":case"dragend":qf=!1,Wy(ge,u,pe);break;case"selectionchange":if(eT)break;case"keydown":case"keyup":Wy(ge,u,pe)}var it;if($f)e:{switch(a){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else Ts?Ly(a,u)&&(ht="onCompositionEnd"):a==="keydown"&&u.keyCode===229&&(ht="onCompositionStart");ht&&(_y&&u.locale!=="ko"&&(Ts||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&Ts&&(it=Ny()):(Ya=pe,Mf="value"in Ya?Ya.value:Ya.textContent,Ts=!0)),ze=Cu(ne,ht),0<ze.length&&(ht=new Ty(ht,a,null,u,pe),ge.push({event:ht,listeners:ze}),it?ht.data=it:(it=Iy(u),it!==null&&(ht.data=it)))),(it=HA?GA(a,u):VA(a,u))&&(ht=Cu(ne,"onBeforeInput"),0<ht.length&&(ze=new Ty("onBeforeInput","beforeinput",null,u,pe),ge.push({event:ze,listeners:ht}),ze.data=it)),zT(ge,a,ne,u,pe)}bx(ge,s)})}function vl(a,s,u){return{instance:a,listener:s,currentTarget:u}}function Cu(a,s){for(var u=s+"Capture",f=[];a!==null;){var y=a,x=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||x===null||(y=$o(a,u),y!=null&&f.unshift(vl(a,y,x)),y=$o(a,s),y!=null&&f.push(vl(a,y,x))),a.tag===3)return f;a=a.return}return[]}function BT(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function wx(a,s,u,f,y){for(var x=s._reactName,E=[];u!==null&&u!==f;){var P=u,K=P.alternate,ne=P.stateNode;if(P=P.tag,K!==null&&K===f)break;P!==5&&P!==26&&P!==27||ne===null||(K=ne,y?(ne=$o(u,x),ne!=null&&E.unshift(vl(u,ne,K))):y||(ne=$o(u,x),ne!=null&&E.push(vl(u,ne,K)))),u=u.return}E.length!==0&&a.push({event:s,listeners:E})}var FT=/\r\n?/g,qT=/\u0000|\uFFFD/g;function kx(a){return(typeof a=="string"?a:""+a).replace(FT,`
|
|
50
|
+
`).replace(qT,"")}function Sx(a,s){return s=kx(s),kx(a)===s}function _t(a,s,u,f,y,x){switch(u){case"children":typeof f=="string"?s==="body"||s==="textarea"&&f===""||Ns(a,f):(typeof f=="number"||typeof f=="bigint")&&s!=="body"&&Ns(a,""+f);break;case"className":Di(a,"class",f);break;case"tabIndex":Di(a,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Di(a,u,f);break;case"style":Sy(a,f,x);break;case"data":if(s!=="object"){Di(a,"data",f);break}case"src":case"href":if(f===""&&(s!=="a"||u!=="href")){a.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){a.removeAttribute(u);break}f=_c(""+f),a.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){a.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof x=="function"&&(u==="formAction"?(s!=="input"&&_t(a,s,"name",y.name,y,null),_t(a,s,"formEncType",y.formEncType,y,null),_t(a,s,"formMethod",y.formMethod,y,null),_t(a,s,"formTarget",y.formTarget,y,null)):(_t(a,s,"encType",y.encType,y,null),_t(a,s,"method",y.method,y,null),_t(a,s,"target",y.target,y,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){a.removeAttribute(u);break}f=_c(""+f),a.setAttribute(u,f);break;case"onClick":f!=null&&(a.onclick=va);break;case"onScroll":f!=null&&ut("scroll",a);break;case"onScrollEnd":f!=null&&ut("scrollend",a);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(r(60));a.innerHTML=u}}break;case"multiple":a.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":a.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){a.removeAttribute("xlink:href");break}u=_c(""+f),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?a.setAttribute(u,""+f):a.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?a.setAttribute(u,""):a.removeAttribute(u);break;case"capture":case"download":f===!0?a.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?a.setAttribute(u,f):a.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?a.setAttribute(u,f):a.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?a.removeAttribute(u):a.setAttribute(u,f);break;case"popover":ut("beforetoggle",a),ut("toggle",a),Dn(a,"popover",f);break;case"xlinkActuate":Vn(a,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Vn(a,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Vn(a,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Vn(a,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Vn(a,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Vn(a,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Vn(a,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Vn(a,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Vn(a,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Dn(a,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=vA.get(u)||u,Dn(a,u,f))}}function hh(a,s,u,f,y,x){switch(u){case"style":Sy(a,f,x);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(r(61));if(u=f.__html,u!=null){if(y.children!=null)throw Error(r(60));a.innerHTML=u}}break;case"children":typeof f=="string"?Ns(a,f):(typeof f=="number"||typeof f=="bigint")&&Ns(a,""+f);break;case"onScroll":f!=null&&ut("scroll",a);break;case"onScrollEnd":f!=null&&ut("scrollend",a);break;case"onClick":f!=null&&(a.onclick=va);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zr.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(y=u.endsWith("Capture"),s=u.slice(2,y?u.length-7:void 0),x=a[Ye]||null,x=x!=null?x[u]:null,typeof x=="function"&&a.removeEventListener(s,x,y),typeof f=="function")){typeof x!="function"&&x!==null&&(u in a?a[u]=null:a.hasAttribute(u)&&a.removeAttribute(u)),a.addEventListener(s,f,y);break e}u in a?a[u]=f:f===!0?a.setAttribute(u,""):Dn(a,u,f)}}}function Nn(a,s,u){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",a),ut("load",a);var f=!1,y=!1,x;for(x in u)if(u.hasOwnProperty(x)){var E=u[x];if(E!=null)switch(x){case"src":f=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:_t(a,s,x,E,u,null)}}y&&_t(a,s,"srcSet",u.srcSet,u,null),f&&_t(a,s,"src",u.src,u,null);return;case"input":ut("invalid",a);var P=x=E=y=null,K=null,ne=null;for(f in u)if(u.hasOwnProperty(f)){var pe=u[f];if(pe!=null)switch(f){case"name":y=pe;break;case"type":E=pe;break;case"checked":K=pe;break;case"defaultChecked":ne=pe;break;case"value":x=pe;break;case"defaultValue":P=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,s));break;default:_t(a,s,f,pe,u,null)}}by(a,x,P,K,ne,E,y,!1);return;case"select":ut("invalid",a),f=E=x=null;for(y in u)if(u.hasOwnProperty(y)&&(P=u[y],P!=null))switch(y){case"value":x=P;break;case"defaultValue":E=P;break;case"multiple":f=P;default:_t(a,s,y,P,u,null)}s=x,u=E,a.multiple=!!f,s!=null?Cs(a,!!f,s,!1):u!=null&&Cs(a,!!f,u,!0);return;case"textarea":ut("invalid",a),x=y=f=null;for(E in u)if(u.hasOwnProperty(E)&&(P=u[E],P!=null))switch(E){case"value":f=P;break;case"defaultValue":y=P;break;case"children":x=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:_t(a,s,E,P,u,null)}wy(a,f,y,x);return;case"option":for(K in u)if(u.hasOwnProperty(K)&&(f=u[K],f!=null))switch(K){case"selected":a.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:_t(a,s,K,f,u,null)}return;case"dialog":ut("beforetoggle",a),ut("toggle",a),ut("cancel",a),ut("close",a);break;case"iframe":case"object":ut("load",a);break;case"video":case"audio":for(f=0;f<gl.length;f++)ut(gl[f],a);break;case"image":ut("error",a),ut("load",a);break;case"details":ut("toggle",a);break;case"embed":case"source":case"link":ut("error",a),ut("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in u)if(u.hasOwnProperty(ne)&&(f=u[ne],f!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:_t(a,s,ne,f,u,null)}return;default:if(Af(s)){for(pe in u)u.hasOwnProperty(pe)&&(f=u[pe],f!==void 0&&hh(a,s,pe,f,u,void 0));return}}for(P in u)u.hasOwnProperty(P)&&(f=u[P],f!=null&&_t(a,s,P,f,u,null))}function HT(a,s,u,f){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,x=null,E=null,P=null,K=null,ne=null,pe=null;for(ce in u){var ge=u[ce];if(u.hasOwnProperty(ce)&&ge!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":K=ge;default:f.hasOwnProperty(ce)||_t(a,s,ce,null,f,ge)}}for(var se in f){var ce=f[se];if(ge=u[se],f.hasOwnProperty(se)&&(ce!=null||ge!=null))switch(se){case"type":x=ce;break;case"name":y=ce;break;case"checked":ne=ce;break;case"defaultChecked":pe=ce;break;case"value":E=ce;break;case"defaultValue":P=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(r(137,s));break;default:ce!==ge&&_t(a,s,se,ce,f,ge)}}Nf(a,E,P,K,ne,pe,x,y);return;case"select":ce=E=P=se=null;for(x in u)if(K=u[x],u.hasOwnProperty(x)&&K!=null)switch(x){case"value":break;case"multiple":ce=K;default:f.hasOwnProperty(x)||_t(a,s,x,null,f,K)}for(y in f)if(x=f[y],K=u[y],f.hasOwnProperty(y)&&(x!=null||K!=null))switch(y){case"value":se=x;break;case"defaultValue":P=x;break;case"multiple":E=x;default:x!==K&&_t(a,s,y,x,f,K)}s=P,u=E,f=ce,se!=null?Cs(a,!!u,se,!1):!!f!=!!u&&(s!=null?Cs(a,!!u,s,!0):Cs(a,!!u,u?[]:"",!1));return;case"textarea":ce=se=null;for(P in u)if(y=u[P],u.hasOwnProperty(P)&&y!=null&&!f.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:_t(a,s,P,null,f,y)}for(E in f)if(y=f[E],x=u[E],f.hasOwnProperty(E)&&(y!=null||x!=null))switch(E){case"value":se=y;break;case"defaultValue":ce=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(r(91));break;default:y!==x&&_t(a,s,E,y,f,x)}xy(a,se,ce);return;case"option":for(var Ie in u)if(se=u[Ie],u.hasOwnProperty(Ie)&&se!=null&&!f.hasOwnProperty(Ie))switch(Ie){case"selected":a.selected=!1;break;default:_t(a,s,Ie,null,f,se)}for(K in f)if(se=f[K],ce=u[K],f.hasOwnProperty(K)&&se!==ce&&(se!=null||ce!=null))switch(K){case"selected":a.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:_t(a,s,K,se,f,ce)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ve in u)se=u[Ve],u.hasOwnProperty(Ve)&&se!=null&&!f.hasOwnProperty(Ve)&&_t(a,s,Ve,null,f,se);for(ne in f)if(se=f[ne],ce=u[ne],f.hasOwnProperty(ne)&&se!==ce&&(se!=null||ce!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,s));break;default:_t(a,s,ne,se,f,ce)}return;default:if(Af(s)){for(var Ot in u)se=u[Ot],u.hasOwnProperty(Ot)&&se!==void 0&&!f.hasOwnProperty(Ot)&&hh(a,s,Ot,void 0,f,se);for(pe in f)se=f[pe],ce=u[pe],!f.hasOwnProperty(pe)||se===ce||se===void 0&&ce===void 0||hh(a,s,pe,se,f,ce);return}}for(var ee in u)se=u[ee],u.hasOwnProperty(ee)&&se!=null&&!f.hasOwnProperty(ee)&&_t(a,s,ee,null,f,se);for(ge in f)se=f[ge],ce=u[ge],!f.hasOwnProperty(ge)||se===ce||se==null&&ce==null||_t(a,s,ge,se,f,ce)}function jx(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function GT(){if(typeof performance.getEntriesByType=="function"){for(var a=0,s=0,u=performance.getEntriesByType("resource"),f=0;f<u.length;f++){var y=u[f],x=y.transferSize,E=y.initiatorType,P=y.duration;if(x&&P&&jx(E)){for(E=0,P=y.responseEnd,f+=1;f<u.length;f++){var K=u[f],ne=K.startTime;if(ne>P)break;var pe=K.transferSize,ge=K.initiatorType;pe&&jx(ge)&&(K=K.responseEnd,E+=pe*(K<P?1:(P-ne)/(K-ne)))}if(--f,s+=8*(x+E)/(y.duration/1e3),a++,10<a)break}}if(0<a)return s/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var mh=null,gh=null;function Nu(a){return a.nodeType===9?a:a.ownerDocument}function Cx(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Nx(a,s){if(a===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&s==="foreignObject"?0:a}function vh(a,s){return a==="textarea"||a==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var yh=null;function VT(){var a=window.event;return a&&a.type==="popstate"?a===yh?!1:(yh=a,!0):(yh=null,!1)}var Ex=typeof setTimeout=="function"?setTimeout:void 0,WT=typeof clearTimeout=="function"?clearTimeout:void 0,Ax=typeof Promise=="function"?Promise:void 0,ZT=typeof queueMicrotask=="function"?queueMicrotask:typeof Ax<"u"?function(a){return Ax.resolve(null).then(a).catch(QT)}:Ex;function QT(a){setTimeout(function(){throw a})}function hi(a){return a==="head"}function Tx(a,s){var u=s,f=0;do{var y=u.nextSibling;if(a.removeChild(u),y&&y.nodeType===8)if(u=y.data,u==="/$"||u==="/&"){if(f===0){a.removeChild(y),ro(s);return}f--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")f++;else if(u==="html")yl(a.ownerDocument.documentElement);else if(u==="head"){u=a.ownerDocument.head,yl(u);for(var x=u.firstChild;x;){var E=x.nextSibling,P=x.nodeName;x[Wr]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=E}}else u==="body"&&yl(a.ownerDocument.body);u=y}while(u);ro(s)}function Rx(a,s){var u=a;a=0;do{var f=u.nextSibling;if(u.nodeType===1?s?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(s?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),f&&f.nodeType===8)if(u=f.data,u==="/$"){if(a===0)break;a--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||a++;u=f}while(u)}function bh(a){var s=a.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var u=s;switch(s=s.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":bh(u),js(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}a.removeChild(u)}}function KT(a,s,u,f){for(;a.nodeType===1;){var y=u;if(a.nodeName.toLowerCase()!==s.toLowerCase()){if(!f&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(f){if(!a[Wr])switch(s){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(x=a.getAttribute("rel"),x==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(x!==y.rel||a.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||a.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||a.getAttribute("title")!==(y.title==null?null:y.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(x=a.getAttribute("src"),(x!==(y.src==null?null:y.src)||a.getAttribute("type")!==(y.type==null?null:y.type)||a.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&x&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(s==="input"&&a.type==="hidden"){var x=y.name==null?null:""+y.name;if(y.type==="hidden"&&a.getAttribute("name")===x)return a}else return a;if(a=Tr(a.nextSibling),a===null)break}return null}function YT(a,s,u){if(s==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!u||(a=Tr(a.nextSibling),a===null))return null;return a}function _x(a,s){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!s||(a=Tr(a.nextSibling),a===null))return null;return a}function xh(a){return a.data==="$?"||a.data==="$~"}function wh(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function XT(a,s){var u=a.ownerDocument;if(a.data==="$~")a._reactRetry=s;else if(a.data!=="$?"||u.readyState!=="loading")s();else{var f=function(){s(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),a._reactRetry=f}}function Tr(a){for(;a!=null;a=a.nextSibling){var s=a.nodeType;if(s===1||s===3)break;if(s===8){if(s=a.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return a}var kh=null;function Ox(a){a=a.nextSibling;for(var s=0;a;){if(a.nodeType===8){var u=a.data;if(u==="/$"||u==="/&"){if(s===0)return Tr(a.nextSibling);s--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||s++}a=a.nextSibling}return null}function Mx(a){a=a.previousSibling;for(var s=0;a;){if(a.nodeType===8){var u=a.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(s===0)return a;s--}else u!=="/$"&&u!=="/&"||s++}a=a.previousSibling}return null}function Lx(a,s,u){switch(s=Nu(u),a){case"html":if(a=s.documentElement,!a)throw Error(r(452));return a;case"head":if(a=s.head,!a)throw Error(r(453));return a;case"body":if(a=s.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function yl(a){for(var s=a.attributes;s.length;)a.removeAttributeNode(s[0]);js(a)}var Rr=new Map,Ix=new Set;function Eu(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Ma=W.d;W.d={f:JT,r:e2,D:t2,C:n2,L:r2,m:a2,X:s2,S:i2,M:o2};function JT(){var a=Ma.f(),s=yu();return a||s}function e2(a){var s=bn(a);s!==null&&s.tag===5&&s.type==="form"?Xb(s):Ma.r(a)}var eo=typeof document>"u"?null:document;function Dx(a,s,u){var f=eo;if(f&&typeof s=="string"&&s){var y=kr(s);y='link[rel="'+a+'"][href="'+y+'"]',typeof u=="string"&&(y+='[crossorigin="'+u+'"]'),Ix.has(y)||(Ix.add(y),a={rel:a,crossOrigin:u,href:s},f.querySelector(y)===null&&(s=f.createElement("link"),Nn(s,"link",a),Wt(s),f.head.appendChild(s)))}}function t2(a){Ma.D(a),Dx("dns-prefetch",a,null)}function n2(a,s){Ma.C(a,s),Dx("preconnect",a,s)}function r2(a,s,u){Ma.L(a,s,u);var f=eo;if(f&&a&&s){var y='link[rel="preload"][as="'+kr(s)+'"]';s==="image"&&u&&u.imageSrcSet?(y+='[imagesrcset="'+kr(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(y+='[imagesizes="'+kr(u.imageSizes)+'"]')):y+='[href="'+kr(a)+'"]';var x=y;switch(s){case"style":x=to(a);break;case"script":x=no(a)}Rr.has(x)||(a=m({rel:"preload",href:s==="image"&&u&&u.imageSrcSet?void 0:a,as:s},u),Rr.set(x,a),f.querySelector(y)!==null||s==="style"&&f.querySelector(bl(x))||s==="script"&&f.querySelector(xl(x))||(s=f.createElement("link"),Nn(s,"link",a),Wt(s),f.head.appendChild(s)))}}function a2(a,s){Ma.m(a,s);var u=eo;if(u&&a){var f=s&&typeof s.as=="string"?s.as:"script",y='link[rel="modulepreload"][as="'+kr(f)+'"][href="'+kr(a)+'"]',x=y;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=no(a)}if(!Rr.has(x)&&(a=m({rel:"modulepreload",href:a},s),Rr.set(x,a),u.querySelector(y)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(xl(x)))return}f=u.createElement("link"),Nn(f,"link",a),Wt(f),u.head.appendChild(f)}}}function i2(a,s,u){Ma.S(a,s,u);var f=eo;if(f&&a){var y=xr(f).hoistableStyles,x=to(a);s=s||"default";var E=y.get(x);if(!E){var P={loading:0,preload:null};if(E=f.querySelector(bl(x)))P.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":s},u),(u=Rr.get(x))&&Sh(a,u);var K=E=f.createElement("link");Wt(K),Nn(K,"link",a),K._p=new Promise(function(ne,pe){K.onload=ne,K.onerror=pe}),K.addEventListener("load",function(){P.loading|=1}),K.addEventListener("error",function(){P.loading|=2}),P.loading|=4,Au(E,s,f)}E={type:"stylesheet",instance:E,count:1,state:P},y.set(x,E)}}}function s2(a,s){Ma.X(a,s);var u=eo;if(u&&a){var f=xr(u).hoistableScripts,y=no(a),x=f.get(y);x||(x=u.querySelector(xl(y)),x||(a=m({src:a,async:!0},s),(s=Rr.get(y))&&jh(a,s),x=u.createElement("script"),Wt(x),Nn(x,"link",a),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(y,x))}}function o2(a,s){Ma.M(a,s);var u=eo;if(u&&a){var f=xr(u).hoistableScripts,y=no(a),x=f.get(y);x||(x=u.querySelector(xl(y)),x||(a=m({src:a,async:!0,type:"module"},s),(s=Rr.get(y))&&jh(a,s),x=u.createElement("script"),Wt(x),Nn(x,"link",a),u.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},f.set(y,x))}}function zx(a,s,u,f){var y=(y=oe.current)?Eu(y):null;if(!y)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(s=to(u.href),u=xr(y).hoistableStyles,f=u.get(s),f||(f={type:"style",instance:null,count:0,state:null},u.set(s,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){a=to(u.href);var x=xr(y).hoistableStyles,E=x.get(a);if(E||(y=y.ownerDocument||y,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(a,E),(x=y.querySelector(bl(a)))&&!x._p&&(E.instance=x,E.state.loading=5),Rr.has(a)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Rr.set(a,u),x||l2(y,a,u,E.state))),s&&f===null)throw Error(r(528,""));return E}if(s&&f!==null)throw Error(r(529,""));return null;case"script":return s=u.async,u=u.src,typeof u=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=no(u),u=xr(y).hoistableScripts,f=u.get(s),f||(f={type:"script",instance:null,count:0,state:null},u.set(s,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function to(a){return'href="'+kr(a)+'"'}function bl(a){return'link[rel="stylesheet"]['+a+"]"}function $x(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function l2(a,s,u,f){a.querySelector('link[rel="preload"][as="style"]['+s+"]")?f.loading=1:(s=a.createElement("link"),f.preload=s,s.addEventListener("load",function(){return f.loading|=1}),s.addEventListener("error",function(){return f.loading|=2}),Nn(s,"link",u),Wt(s),a.head.appendChild(s))}function no(a){return'[src="'+kr(a)+'"]'}function xl(a){return"script[async]"+a}function Px(a,s,u){if(s.count++,s.instance===null)switch(s.type){case"style":var f=a.querySelector('style[data-href~="'+kr(u.href)+'"]');if(f)return s.instance=f,Wt(f),f;var y=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(a.ownerDocument||a).createElement("style"),Wt(f),Nn(f,"style",y),Au(f,u.precedence,a),s.instance=f;case"stylesheet":y=to(u.href);var x=a.querySelector(bl(y));if(x)return s.state.loading|=4,s.instance=x,Wt(x),x;f=$x(u),(y=Rr.get(y))&&Sh(f,y),x=(a.ownerDocument||a).createElement("link"),Wt(x);var E=x;return E._p=new Promise(function(P,K){E.onload=P,E.onerror=K}),Nn(x,"link",f),s.state.loading|=4,Au(x,u.precedence,a),s.instance=x;case"script":return x=no(u.src),(y=a.querySelector(xl(x)))?(s.instance=y,Wt(y),y):(f=u,(y=Rr.get(x))&&(f=m({},u),jh(f,y)),a=a.ownerDocument||a,y=a.createElement("script"),Wt(y),Nn(y,"link",f),a.head.appendChild(y),s.instance=y);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(f=s.instance,s.state.loading|=4,Au(f,u.precedence,a));return s.instance}function Au(a,s,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=f.length?f[f.length-1]:null,x=y,E=0;E<f.length;E++){var P=f[E];if(P.dataset.precedence===s)x=P;else if(x!==y)break}x?x.parentNode.insertBefore(a,x.nextSibling):(s=u.nodeType===9?u.head:u,s.insertBefore(a,s.firstChild))}function Sh(a,s){a.crossOrigin==null&&(a.crossOrigin=s.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=s.referrerPolicy),a.title==null&&(a.title=s.title)}function jh(a,s){a.crossOrigin==null&&(a.crossOrigin=s.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=s.referrerPolicy),a.integrity==null&&(a.integrity=s.integrity)}var Tu=null;function Ux(a,s,u){if(Tu===null){var f=new Map,y=Tu=new Map;y.set(u,f)}else y=Tu,f=y.get(u),f||(f=new Map,y.set(u,f));if(f.has(a))return f;for(f.set(a,null),u=u.getElementsByTagName(a),y=0;y<u.length;y++){var x=u[y];if(!(x[Wr]||x[$e]||a==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var E=x.getAttribute(s)||"";E=a+E;var P=f.get(E);P?P.push(x):f.set(E,[x])}}return f}function Bx(a,s,u){a=a.ownerDocument||a,a.head.insertBefore(u,s==="title"?a.querySelector("head > title"):null)}function c2(a,s,u){if(u===1||s.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return a=s.disabled,typeof s.precedence=="string"&&a==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function Fx(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function u2(a,s,u,f){if(u.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var y=to(f.href),x=s.querySelector(bl(y));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(a.count++,a=Ru.bind(a),s.then(a,a)),u.state.loading|=4,u.instance=x,Wt(x);return}x=s.ownerDocument||s,f=$x(f),(y=Rr.get(y))&&Sh(f,y),x=x.createElement("link"),Wt(x);var E=x;E._p=new Promise(function(P,K){E.onload=P,E.onerror=K}),Nn(x,"link",f),u.instance=x}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(u,s),(s=u.state.preload)&&(u.state.loading&3)===0&&(a.count++,u=Ru.bind(a),s.addEventListener("load",u),s.addEventListener("error",u))}}var Ch=0;function d2(a,s){return a.stylesheets&&a.count===0&&Ou(a,a.stylesheets),0<a.count||0<a.imgCount?function(u){var f=setTimeout(function(){if(a.stylesheets&&Ou(a,a.stylesheets),a.unsuspend){var x=a.unsuspend;a.unsuspend=null,x()}},6e4+s);0<a.imgBytes&&Ch===0&&(Ch=62500*GT());var y=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Ou(a,a.stylesheets),a.unsuspend)){var x=a.unsuspend;a.unsuspend=null,x()}},(a.imgBytes>Ch?50:800)+s);return a.unsuspend=u,function(){a.unsuspend=null,clearTimeout(f),clearTimeout(y)}}:null}function Ru(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ou(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var _u=null;function Ou(a,s){a.stylesheets=null,a.unsuspend!==null&&(a.count++,_u=new Map,s.forEach(f2,a),_u=null,Ru.call(a))}function f2(a,s){if(!(s.state.loading&4)){var u=_u.get(a);if(u)var f=u.get(null);else{u=new Map,_u.set(a,u);for(var y=a.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<y.length;x++){var E=y[x];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(u.set(E.dataset.precedence,E),f=E)}f&&u.set(null,f)}y=s.instance,E=y.getAttribute("data-precedence"),x=u.get(E)||f,x===f&&u.set(null,y),u.set(E,y),this.count++,f=Ru.bind(this),y.addEventListener("load",f),y.addEventListener("error",f),x?x.parentNode.insertBefore(y,x.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(y,a.firstChild)),s.state.loading|=4}}var wl={$$typeof:A,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function p2(a,s,u,f,y,x,E,P,K){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Li(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Li(0),this.hiddenUpdates=Li(null),this.identifierPrefix=f,this.onUncaughtError=y,this.onCaughtError=x,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function qx(a,s,u,f,y,x,E,P,K,ne,pe,ge){return a=new p2(a,s,u,E,K,ne,pe,ge,P),s=1,x===!0&&(s|=24),x=sr(3,null,null,s),a.current=x,x.stateNode=a,s=ap(),s.refCount++,a.pooledCache=s,s.refCount++,x.memoizedState={element:f,isDehydrated:u,cache:s},lp(x),a}function Hx(a){return a?(a=Ms,a):Ms}function Gx(a,s,u,f,y,x){y=Hx(y),f.context===null?f.context=y:f.pendingContext=y,f=ri(s),f.payload={element:u},x=x===void 0?null:x,x!==null&&(f.callback=x),u=ai(a,f,s),u!==null&&(Xn(u,a,s),Jo(u,a,s))}function Vx(a,s){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var u=a.retryLane;a.retryLane=u!==0&&u<s?u:s}}function Nh(a,s){Vx(a,s),(a=a.alternate)&&Vx(a,s)}function Wx(a){if(a.tag===13||a.tag===31){var s=Ui(a,67108864);s!==null&&Xn(s,a,67108864),Nh(a,67108864)}}function Zx(a){if(a.tag===13||a.tag===31){var s=dr();s=ue(s);var u=Ui(a,s);u!==null&&Xn(u,a,s),Nh(a,s)}}var Mu=!0;function h2(a,s,u,f){var y=G.T;G.T=null;var x=W.p;try{W.p=2,Eh(a,s,u,f)}finally{W.p=x,G.T=y}}function m2(a,s,u,f){var y=G.T;G.T=null;var x=W.p;try{W.p=8,Eh(a,s,u,f)}finally{W.p=x,G.T=y}}function Eh(a,s,u,f){if(Mu){var y=Ah(f);if(y===null)ph(a,s,f,Lu,u),Kx(a,f);else if(v2(y,a,s,u,f))f.stopPropagation();else if(Kx(a,f),s&4&&-1<g2.indexOf(a)){for(;y!==null;){var x=bn(y);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var E=ar(x.pendingLanes);if(E!==0){var P=x;for(P.pendingLanes|=2,P.entangledLanes|=2;E;){var K=1<<31-Te(E);P.entanglements[1]|=K,E&=~K}Xr(x),(Ct&6)===0&&(gu=mt()+500,ml(0))}}break;case 31:case 13:P=Ui(x,2),P!==null&&Xn(P,x,2),yu(),Nh(x,2)}if(x=Ah(f),x===null&&ph(a,s,f,Lu,u),x===y)break;y=x}y!==null&&f.stopPropagation()}else ph(a,s,f,null,u)}}function Ah(a){return a=Rf(a),Th(a)}var Lu=null;function Th(a){if(Lu=null,a=ma(a),a!==null){var s=o(a);if(s===null)a=null;else{var u=s.tag;if(u===13){if(a=c(s),a!==null)return a;a=null}else if(u===31){if(a=d(s),a!==null)return a;a=null}else if(u===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;a=null}else s!==a&&(a=null)}}return Lu=a,null}function Qx(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Se()){case X:return 2;case fe:return 8;case Ne:case ie:return 32;case V:return 268435456;default:return 32}default:return 32}}var Rh=!1,mi=null,gi=null,vi=null,kl=new Map,Sl=new Map,yi=[],g2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Kx(a,s){switch(a){case"focusin":case"focusout":mi=null;break;case"dragenter":case"dragleave":gi=null;break;case"mouseover":case"mouseout":vi=null;break;case"pointerover":case"pointerout":kl.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sl.delete(s.pointerId)}}function jl(a,s,u,f,y,x){return a===null||a.nativeEvent!==x?(a={blockedOn:s,domEventName:u,eventSystemFlags:f,nativeEvent:x,targetContainers:[y]},s!==null&&(s=bn(s),s!==null&&Wx(s)),a):(a.eventSystemFlags|=f,s=a.targetContainers,y!==null&&s.indexOf(y)===-1&&s.push(y),a)}function v2(a,s,u,f,y){switch(s){case"focusin":return mi=jl(mi,a,s,u,f,y),!0;case"dragenter":return gi=jl(gi,a,s,u,f,y),!0;case"mouseover":return vi=jl(vi,a,s,u,f,y),!0;case"pointerover":var x=y.pointerId;return kl.set(x,jl(kl.get(x)||null,a,s,u,f,y)),!0;case"gotpointercapture":return x=y.pointerId,Sl.set(x,jl(Sl.get(x)||null,a,s,u,f,y)),!0}return!1}function Yx(a){var s=ma(a.target);if(s!==null){var u=o(s);if(u!==null){if(s=u.tag,s===13){if(s=c(u),s!==null){a.blockedOn=s,tt(a.priority,function(){Zx(u)});return}}else if(s===31){if(s=d(u),s!==null){a.blockedOn=s,tt(a.priority,function(){Zx(u)});return}}else if(s===3&&u.stateNode.current.memoizedState.isDehydrated){a.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Iu(a){if(a.blockedOn!==null)return!1;for(var s=a.targetContainers;0<s.length;){var u=Ah(a.nativeEvent);if(u===null){u=a.nativeEvent;var f=new u.constructor(u.type,u);Tf=f,u.target.dispatchEvent(f),Tf=null}else return s=bn(u),s!==null&&Wx(s),a.blockedOn=u,!1;s.shift()}return!0}function Xx(a,s,u){Iu(a)&&u.delete(s)}function y2(){Rh=!1,mi!==null&&Iu(mi)&&(mi=null),gi!==null&&Iu(gi)&&(gi=null),vi!==null&&Iu(vi)&&(vi=null),kl.forEach(Xx),Sl.forEach(Xx)}function Du(a,s){a.blockedOn===s&&(a.blockedOn=null,Rh||(Rh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,y2)))}var zu=null;function Jx(a){zu!==a&&(zu=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zu===a&&(zu=null);for(var s=0;s<a.length;s+=3){var u=a[s],f=a[s+1],y=a[s+2];if(typeof f!="function"){if(Th(f||u)===null)continue;break}var x=bn(u);x!==null&&(a.splice(s,3),s-=3,Ap(x,{pending:!0,data:y,method:u.method,action:f},f,y))}}))}function ro(a){function s(K){return Du(K,a)}mi!==null&&Du(mi,a),gi!==null&&Du(gi,a),vi!==null&&Du(vi,a),kl.forEach(s),Sl.forEach(s);for(var u=0;u<yi.length;u++){var f=yi[u];f.blockedOn===a&&(f.blockedOn=null)}for(;0<yi.length&&(u=yi[0],u.blockedOn===null);)Yx(u),u.blockedOn===null&&yi.shift();if(u=(a.ownerDocument||a).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var y=u[f],x=u[f+1],E=y[Ye]||null;if(typeof x=="function")E||Jx(u);else if(E){var P=null;if(x&&x.hasAttribute("formAction")){if(y=x,E=x[Ye]||null)P=E.formAction;else if(Th(y)!==null)continue}else P=E.action;typeof P=="function"?u[f+1]=P:(u.splice(f,3),f-=3),Jx(u)}}}function e1(){function a(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(E){return y=E})},focusReset:"manual",scroll:"manual"})}function s(){y!==null&&(y(),y=null),f||setTimeout(u,20)}function u(){if(!f&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,y=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(u,100),function(){f=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),y!==null&&(y(),y=null)}}}function _h(a){this._internalRoot=a}$u.prototype.render=_h.prototype.render=function(a){var s=this._internalRoot;if(s===null)throw Error(r(409));var u=s.current,f=dr();Gx(u,f,a,s,null,null)},$u.prototype.unmount=_h.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var s=a.containerInfo;Gx(a.current,2,null,a,null,null),yu(),s[Tn]=null}};function $u(a){this._internalRoot=a}$u.prototype.unstable_scheduleHydration=function(a){if(a){var s=Me();a={blockedOn:null,target:a,priority:s};for(var u=0;u<yi.length&&s!==0&&s<yi[u].priority;u++);yi.splice(u,0,a),u===0&&Yx(a)}};var t1=t.version;if(t1!=="19.2.4")throw Error(r(527,t1,"19.2.4"));W.findDOMNode=function(a){var s=a._reactInternals;if(s===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(s),a=a!==null?g(a):null,a=a===null?null:a.stateNode,a};var b2={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pu.isDisabled&&Pu.supportsFiber)try{Ae=Pu.inject(b2),De=Pu}catch{}}return Nl.createRoot=function(a,s){if(!i(a))throw Error(r(299));var u=!1,f="",y=l0,x=c0,E=u0;return s!=null&&(s.unstable_strictMode===!0&&(u=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(x=s.onCaughtError),s.onRecoverableError!==void 0&&(E=s.onRecoverableError)),s=qx(a,1,!1,null,null,u,f,null,y,x,E,e1),a[Tn]=s.current,fh(a),new _h(s)},Nl.hydrateRoot=function(a,s,u){if(!i(a))throw Error(r(299));var f=!1,y="",x=l0,E=c0,P=u0,K=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(y=u.identifierPrefix),u.onUncaughtError!==void 0&&(x=u.onUncaughtError),u.onCaughtError!==void 0&&(E=u.onCaughtError),u.onRecoverableError!==void 0&&(P=u.onRecoverableError),u.formState!==void 0&&(K=u.formState)),s=qx(a,1,!0,s,u??null,f,y,K,x,E,P,e1),s.context=Hx(null),u=s.current,f=dr(),f=ue(f),y=ri(f),y.callback=null,ai(u,y,f),u=f,s.current.lanes=u,Za(s,u),Xr(s),a[Tn]=s.current,fh(a),new $u(s)},Nl.version="19.2.4",Nl}var d1;function R2(){if(d1)return Lh.exports;d1=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Lh.exports=T2(),Lh.exports}var _2=R2();/**
|
|
51
|
+
* react-router v7.17.0
|
|
52
|
+
*
|
|
53
|
+
* Copyright (c) Remix Software Inc.
|
|
54
|
+
*
|
|
55
|
+
* This source code is licensed under the MIT license found in the
|
|
56
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
57
|
+
*
|
|
58
|
+
* @license MIT
|
|
59
|
+
*/var f1="popstate";function p1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function O2(e={}){function t(r,i){var h;let o=(h=i.state)==null?void 0:h.masked,{pathname:c,search:d,hash:p}=o||r.location;return eg("",{pathname:c,search:d,hash:p},i.state&&i.state.usr||null,i.state&&i.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:rc(i)}return L2(t,n,null,e)}function Gt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Hr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function M2(){return Math.random().toString(36).substring(2,10)}function h1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function eg(e,t,n=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?No(t):t,state:n,key:t&&t.key||r||M2(),mask:i}}function rc({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function No(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function L2(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:o=!1}=r,c=i.history,d="POP",p=null,h=g();h==null&&(h=0,c.replaceState({...c.state,idx:h},""));function g(){return(c.state||{idx:null}).idx}function m(){d="POP";let C=g(),S=C==null?null:C-h;h=C,p&&p({action:d,location:j.location,delta:S})}function v(C,S){d="PUSH";let N=p1(C)?C:eg(j.location,C,S);h=g()+1;let A=h1(N,h),O=j.createHref(N.mask||N);try{c.pushState(A,"",O)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;i.location.assign(O)}o&&p&&p({action:d,location:j.location,delta:1})}function b(C,S){d="REPLACE";let N=p1(C)?C:eg(j.location,C,S);h=g();let A=h1(N,h),O=j.createHref(N.mask||N);c.replaceState(A,"",O),o&&p&&p({action:d,location:j.location,delta:0})}function k(C){return I2(i,C)}let j={get action(){return d},get location(){return e(i,c)},listen(C){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(f1,m),p=C,()=>{i.removeEventListener(f1,m),p=null}},createHref(C){return t(i,C)},createURL:k,encodeLocation(C){let S=k(C);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:v,replace:b,go(C){return c.go(C)}};return j}function I2(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Gt(r,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:rc(t);return i=i.replace(/ $/,"%20"),!n&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function nj(e,t,n="/"){return D2(e,t,n,!1)}function D2(e,t,n,r,i){let o=typeof t=="string"?No(t):t,c=Ua(o.pathname||"/",n);if(c==null)return null;let d=z2(e),p=null,h=Q2(c);for(let g=0;p==null&&g<d.length;++g)p=W2(d[g],h,r);return p}function z2(e){let t=rj(e);return $2(t),t}function rj(e,t=[],n=[],r="",i=!1){let o=(c,d,p=i,h)=>{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&p)return;Gt(g.relativePath.startsWith(r),`Absolute route path "${g.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(r.length)}let m=Fr([r,g.relativePath]),v=n.concat(g);c.children&&c.children.length>0&&(Gt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),rj(c.children,t,v,m,p)),!(c.path==null&&!c.index)&&t.push({path:m,score:G2(m,c.index),routesMeta:v})};return e.forEach((c,d)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))o(c,d);else for(let h of aj(c.path))o(c,d,!0,h)}),t}function aj(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let c=aj(r.join("/")),d=[];return d.push(...c.map(p=>p===""?o:[o,p].join("/"))),i&&d.push(...c),d.map(p=>e.startsWith("/")&&p===""?"/":p)}function $2(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:V2(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var P2=/^:[\w-]+$/,U2=3,B2=2,F2=1,q2=10,H2=-2,m1=e=>e==="*";function G2(e,t){let n=e.split("/"),r=n.length;return n.some(m1)&&(r+=H2),t&&(r+=B2),n.filter(i=>!m1(i)).reduce((i,o)=>i+(P2.test(o)?U2:o===""?F2:q2),r)}function V2(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function W2(e,t,n=!1){let{routesMeta:r}=e,i={},o="/",c=[];for(let d=0;d<r.length;++d){let p=r[d],h=d===r.length-1,g=o==="/"?t:t.slice(o.length)||"/",m=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:h},g),v=p.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=jd({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},g)),!m)return null;Object.assign(i,m.params),c.push({params:i,pathname:Fr([o,m.pathname]),pathnameBase:J2(Fr([o,m.pathnameBase])),route:v}),m.pathnameBase!=="/"&&(o=Fr([o,m.pathnameBase]))}return c}function jd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Z2(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],c=o.replace(/(.)\/+$/,"$1"),d=i.slice(1);return{params:r.reduce((h,{paramName:g,isOptional:m},v)=>{if(g==="*"){let k=d[v]||"";c=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const b=d[v];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:c,pattern:e}}function Z2(e,t=!1,n=!0){Hr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,p,h,g)=>{if(r.push({paramName:d,isOptional:p!=null}),p){let m=g.charAt(h+c.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function Q2(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Hr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ua(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var K2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Y2(e,t="/"){let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?No(e):e,o;return n?(n=ij(n),n.startsWith("/")?o=g1(n.substring(1),"/"):o=g1(n,t)):o=t,{pathname:o,search:eR(r),hash:tR(i)}}function g1(e,t){let n=Cd(t).split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function $h(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function X2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Vg(e){let t=X2(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Jd(e,t,n,r=!1){let i;typeof e=="string"?i=No(e):(i={...e},Gt(!i.pathname||!i.pathname.includes("?"),$h("?","pathname","search",i)),Gt(!i.pathname||!i.pathname.includes("#"),$h("#","pathname","hash",i)),Gt(!i.search||!i.search.includes("#"),$h("#","search","hash",i)));let o=e===""||i.pathname==="",c=o?"/":i.pathname,d;if(c==null)d=n;else{let m=t.length-1;if(!r&&c.startsWith("..")){let v=c.split("/");for(;v[0]==="..";)v.shift(),m-=1;i.pathname=v.join("/")}d=m>=0?t[m]:"/"}let p=Y2(i,d),h=c&&c!=="/"&&c.endsWith("/"),g=(o||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(h||g)&&(p.pathname+="/"),p}var ij=e=>e.replace(/\/\/+/g,"/"),Fr=e=>ij(e.join("/")),Cd=e=>e.replace(/\/+$/,""),J2=e=>Cd(e).replace(/^\/*/,"/"),eR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,tR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,nR=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function rR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function aR(e){let t=e.map(n=>n.route.path).filter(Boolean);return Fr(t)||"/"}var sj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function oj(e,t){let n=e;if(typeof n!="string"||!K2.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(sj)try{let o=new URL(window.location.href),c=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Ua(c.pathname,t);c.origin===o.origin&&d!=null?n=d+c.search+c.hash:i=!0}catch{Hr(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var lj=["POST","PUT","PATCH","DELETE"];new Set(lj);var iR=["GET",...lj];new Set(iR);var Eo=w.createContext(null);Eo.displayName="DataRouter";var ef=w.createContext(null);ef.displayName="DataRouterState";var cj=w.createContext(!1);function sR(){return w.useContext(cj)}var uj=w.createContext({isTransitioning:!1});uj.displayName="ViewTransition";var oR=w.createContext(new Map);oR.displayName="Fetchers";var lR=w.createContext(null);lR.displayName="Await";var br=w.createContext(null);br.displayName="Navigation";var gc=w.createContext(null);gc.displayName="Location";var da=w.createContext({outlet:null,matches:[],isDataRoute:!1});da.displayName="Route";var Wg=w.createContext(null);Wg.displayName="RouteError";var dj="REACT_ROUTER_ERROR",cR="REDIRECT",uR="ROUTE_ERROR_RESPONSE";function dR(e){if(e.startsWith(`${dj}:${cR}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function fR(e){if(e.startsWith(`${dj}:${uR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new nR(t.status,t.statusText,t.data)}catch{}}function pR(e,{relative:t}={}){Gt(Ao(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(br),{hash:i,pathname:o,search:c}=vc(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:Fr([n,o])),r.createHref({pathname:d,search:c,hash:i})}function Ao(){return w.useContext(gc)!=null}function Vr(){return Gt(Ao(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(gc).location}var fj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function pj(e){w.useContext(br).static||w.useLayoutEffect(e)}function Zg(){let{isDataRoute:e}=w.useContext(da);return e?NR():hR()}function hR(){Gt(Ao(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(Eo),{basename:t,navigator:n}=w.useContext(br),{matches:r}=w.useContext(da),{pathname:i}=Vr(),o=JSON.stringify(Vg(r)),c=w.useRef(!1);return pj(()=>{c.current=!0}),w.useCallback((p,h={})=>{if(Hr(c.current,fj),!c.current)return;if(typeof p=="number"){n.go(p);return}let g=Jd(p,JSON.parse(o),i,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Fr([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,o,i,e])}w.createContext(null);function vc(e,{relative:t}={}){let{matches:n}=w.useContext(da),{pathname:r}=Vr(),i=JSON.stringify(Vg(n));return w.useMemo(()=>Jd(e,JSON.parse(i),r,t==="path"),[e,i,r,t])}function mR(e,t){return hj(e,t)}function hj(e,t,n){var C;Gt(Ao(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(br),{matches:i}=w.useContext(da),o=i[i.length-1],c=o?o.params:{},d=o?o.pathname:"/",p=o?o.pathnameBase:"/",h=o&&o.route;{let S=h&&h.path||"";gj(d,!h||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
|
+
|
|
61
|
+
Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let g=Vr(),m;if(t){let S=typeof t=="string"?No(t):t;Gt(p==="/"||((C=S.pathname)==null?void 0:C.startsWith(p)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${S.pathname}" was given in the \`location\` prop.`),m=S}else m=g;let v=m.pathname||"/",b=v;if(p!=="/"){let S=p.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=n&&n.state.matches.length?n.state.matches.map(S=>Object.assign(S,{route:n.manifest[S.route.id]||S.route})):nj(e,{pathname:b});Hr(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Hr(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=xR(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},c,S.params),pathname:Fr([p,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?p:Fr([p,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n);return t&&j?w.createElement(gc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function gR(){let e=CR(),t=rR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:o},"ErrorBoundary")," or"," ",w.createElement("code",{style:o},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:i},n):null,c)}var vR=w.createElement(gR,null),mj=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=fR(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(da.Provider,{value:this.props.routeContext},w.createElement(Wg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(yR,{error:e},t):t}};mj.contextType=cj;var Ph=new WeakMap;function yR({children:e,error:t}){let{basename:n}=w.useContext(br);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=dR(t.digest);if(r){let i=Ph.get(t);if(i)throw i;let o=oj(r.location,n);if(sj&&!Ph.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw Ph.set(t,c),c}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function bR({routeContext:e,match:t,children:n}){let r=w.useContext(Eo);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(da.Provider,{value:e},n)}function xR(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,o=r==null?void 0:r.errors;if(o!=null){let g=i.findIndex(m=>m.route.id&&(o==null?void 0:o[m.route.id])!==void 0);Gt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,g+1))}let c=!1,d=-1;if(n&&r){c=r.renderFallback;for(let g=0;g<i.length;g++){let m=i[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=g),m.route.id){let{loaderData:v,errors:b}=r,k=m.route.loader&&!v.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(c=!0),d>=0?i=i.slice(0,d+1):i=[i[0]];break}}}}let p=n==null?void 0:n.onError,h=r&&p?(g,m)=>{var v,b;p(g,{location:r.location,params:((b=(v=r.matches)==null?void 0:v[0])==null?void 0:b.params)??{},pattern:aR(r.matches),errorInfo:m})}:void 0;return i.reduceRight((g,m,v)=>{let b,k=!1,j=null,C=null;r&&(b=o&&m.route.id?o[m.route.id]:void 0,j=m.route.errorElement||vR,c&&(d<0&&v===0?(gj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,C=null):d===v&&(k=!0,C=m.route.hydrateFallbackElement||null)));let S=t.concat(i.slice(0,v+1)),N=()=>{let A;return b?A=j:k?A=C:m.route.Component?A=w.createElement(m.route.Component,null):m.route.element?A=m.route.element:A=g,w.createElement(bR,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:r!=null},children:A})};return r&&(m.route.ErrorBoundary||m.route.errorElement||v===0)?w.createElement(mj,{location:r.location,revalidation:r.revalidation,component:j,error:b,children:N(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):N()},null)}function Qg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function wR(e){let t=w.useContext(Eo);return Gt(t,Qg(e)),t}function kR(e){let t=w.useContext(ef);return Gt(t,Qg(e)),t}function SR(e){let t=w.useContext(da);return Gt(t,Qg(e)),t}function Kg(e){let t=SR(e),n=t.matches[t.matches.length-1];return Gt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function jR(){return Kg("useRouteId")}function CR(){var r;let e=w.useContext(Wg),t=kR("useRouteError"),n=Kg("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function NR(){let{router:e}=wR("useNavigate"),t=Kg("useNavigate"),n=w.useRef(!1);return pj(()=>{n.current=!0}),w.useCallback(async(i,o={})=>{Hr(n.current,fj),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...o}))},[e,t])}var v1={};function gj(e,t,n){!t&&!v1[e]&&(v1[e]=!0,Hr(!1,n))}w.memo(ER);function ER({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:o}){return hj(e,void 0,{manifest:t,state:r,isStatic:i,onError:o})}function ql({to:e,replace:t,state:n,relative:r}){Gt(Ao(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=w.useContext(br);Hr(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=w.useContext(da),{pathname:c}=Vr(),d=Zg(),p=Jd(e,Vg(o),c,r==="path"),h=JSON.stringify(p);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:r})},[d,h,r,t,n]),null}function Ci(e){Gt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function AR({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:i,static:o=!1,useTransitions:c}){Gt(!Ao(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),p=w.useMemo(()=>({basename:d,navigator:i,static:o,useTransitions:c,future:{}}),[d,i,o,c]);typeof n=="string"&&(n=No(n));let{pathname:h="/",search:g="",hash:m="",state:v=null,key:b="default",mask:k}=n,j=w.useMemo(()=>{let C=Ua(h,d);return C==null?null:{location:{pathname:C,search:g,hash:m,state:v,key:b,mask:k},navigationType:r}},[d,h,g,m,v,b,r,k]);return Hr(j!=null,`<Router basename="${d}"> is not able to match the URL "${h}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:w.createElement(br.Provider,{value:p},w.createElement(gc.Provider,{children:t,value:j}))}function TR({children:e,location:t}){return mR(tg(e),t)}function tg(e,t=[]){let n=[];return w.Children.forEach(e,(r,i)=>{if(!w.isValidElement(r))return;let o=[...t,i];if(r.type===w.Fragment){n.push.apply(n,tg(r.props.children,o));return}Gt(r.type===Ci,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Gt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let c={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=tg(r.props.children,o)),n.push(c)}),n}var ud="get",dd="application/x-www-form-urlencoded";function tf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function RR(e){return tf(e)&&e.tagName.toLowerCase()==="button"}function _R(e){return tf(e)&&e.tagName.toLowerCase()==="form"}function OR(e){return tf(e)&&e.tagName.toLowerCase()==="input"}function MR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function LR(e,t){return e.button===0&&(!t||t==="_self")&&!MR(e)}var Uu=null;function IR(){if(Uu===null)try{new FormData(document.createElement("form"),0),Uu=!1}catch{Uu=!0}return Uu}var DR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Uh(e){return e!=null&&!DR.has(e)?(Hr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dd}"`),null):e}function zR(e,t){let n,r,i,o,c;if(_R(e)){let d=e.getAttribute("action");r=d?Ua(d,t):null,n=e.getAttribute("method")||ud,i=Uh(e.getAttribute("enctype"))||dd,o=new FormData(e)}else if(RR(e)||OR(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||d.getAttribute("action");if(r=p?Ua(p,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||ud,i=Uh(e.getAttribute("formenctype"))||Uh(d.getAttribute("enctype"))||dd,o=new FormData(d,e),!IR()){let{name:h,type:g,value:m}=e;if(g==="image"){let v=h?`${h}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else h&&o.append(h,m)}}else{if(tf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ud,r=null,i=dd,c=e}return o&&i==="text/plain"&&(c=o,o=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:o,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Yg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vj(e,t,n,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:t&&Ua(i.pathname,t)==="/"?i.pathname=`${Cd(t)}/_root.${r}`:i.pathname=`${Cd(i.pathname)}.${r}`,i}async function $R(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function PR(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function UR(e,t,n){let r=await Promise.all(e.map(async i=>{let o=t.routes[i.route.id];if(o){let c=await $R(o,n);return c.links?c.links():[]}return[]}));return HR(r.flat(1).filter(PR).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function y1(e,t,n,r,i,o){let c=(p,h)=>n[h]?p.route.id!==n[h].route.id:!0,d=(p,h)=>{var g;return n[h].pathname!==p.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==p.params["*"]};return o==="assets"?t.filter((p,h)=>c(p,h)||d(p,h)):o==="data"?t.filter((p,h)=>{var m;let g=r.routes[p.route.id];if(!g||!g.hasLoader)return!1;if(c(p,h)||d(p,h))return!0;if(p.route.shouldRevalidate){let v=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function BR(e,t,{includeHydrateFallback:n}={}){return FR(e.map(r=>{let i=t.routes[r.route.id];if(!i)return[];let o=[i.module];return i.clientActionModule&&(o=o.concat(i.clientActionModule)),i.clientLoaderModule&&(o=o.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(o=o.concat(i.hydrateFallbackModule)),i.imports&&(o=o.concat(i.imports)),o}).flat(1))}function FR(e){return[...new Set(e)]}function qR(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function HR(e,t){let n=new Set;return new Set(t),e.reduce((r,i)=>{let o=JSON.stringify(qR(i));return n.has(o)||(n.add(o),r.push({key:o,link:i})),r},[])}function Xg(){let e=w.useContext(Eo);return Yg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function GR(){let e=w.useContext(ef);return Yg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Jg=w.createContext(void 0);Jg.displayName="FrameworkContext";function ev(){let e=w.useContext(Jg);return Yg(e,"You must render this element inside a <HydratedRouter> element"),e}function VR(e,t){let n=w.useContext(Jg),[r,i]=w.useState(!1),[o,c]=w.useState(!1),{onFocus:d,onBlur:p,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,v=w.useRef(null);w.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=S=>{S.forEach(N=>{c(N.isIntersecting)})},C=new IntersectionObserver(j,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[e]),w.useEffect(()=>{if(r){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[r]);let b=()=>{i(!0)},k=()=>{i(!1),c(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:El(d,b),onBlur:El(p,k),onMouseEnter:El(h,b),onMouseLeave:El(g,k),onTouchStart:El(m,b)}]:[!1,v,{}]}function El(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function WR({page:e,...t}){let n=sR(),{router:r}=Xg(),i=w.useMemo(()=>nj(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?n?w.createElement(QR,{page:e,matches:i,...t}):w.createElement(KR,{page:e,matches:i,...t}):null}function ZR(e){let{manifest:t,routeModules:n}=ev(),[r,i]=w.useState([]);return w.useEffect(()=>{let o=!1;return UR(e,t,n).then(c=>{o||i(c)}),()=>{o=!0}},[e,t,n]),r}function QR({page:e,matches:t,...n}){let r=Vr(),{future:i}=ev(),{basename:o}=Xg(),c=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=vj(e,o,i.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?p=!0:h.push(g.route.id);return p&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[o,i.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,c.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function KR({page:e,matches:t,...n}){let r=Vr(),{future:i,manifest:o,routeModules:c}=ev(),{basename:d}=Xg(),{loaderData:p,matches:h}=GR(),g=w.useMemo(()=>y1(e,t,h,o,r,"data"),[e,t,h,o,r]),m=w.useMemo(()=>y1(e,t,h,o,r,"assets"),[e,t,h,o,r]),v=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,C=!1;if(t.forEach(N=>{var O;let A=o.routes[N.route.id];!A||!A.hasLoader||(!g.some(M=>M.route.id===N.route.id)&&N.route.id in p&&((O=c[N.route.id])!=null&&O.shouldRevalidate)||A.hasClientLoader?C=!0:j.add(N.route.id))}),j.size===0)return[];let S=vj(e,d,i.v8_trailingSlashAwareDataRequests,"data");return C&&j.size>0&&S.searchParams.set("_routes",t.filter(N=>j.has(N.route.id)).map(N=>N.route.id).join(",")),[S.pathname+S.search]},[d,i.v8_trailingSlashAwareDataRequests,p,r,o,g,t,e,c]),b=w.useMemo(()=>BR(m,o),[m,o]),k=ZR(m);return w.createElement(w.Fragment,null,v.map(j=>w.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>w.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),k.map(({key:j,link:C})=>w.createElement("link",{key:j,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function YR(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var XR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{XR&&(window.__reactRouterVersion="7.17.0")}catch{}function JR({basename:e,children:t,useTransitions:n,window:r}){let i=w.useRef();i.current==null&&(i.current=O2({window:r,v5Compat:!0}));let o=i.current,[c,d]=w.useState({action:o.action,location:o.location}),p=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>o.listen(p),[o,p]),w.createElement(AR,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:o,useTransitions:n})}var yj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bj=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:i,reloadDocument:o,replace:c,mask:d,state:p,target:h,to:g,preventScrollReset:m,viewTransition:v,defaultShouldRevalidate:b,...k},j){let{basename:C,navigator:S,useTransitions:N}=w.useContext(br),A=typeof g=="string"&&yj.test(g),O=oj(g,C);g=O.to;let M=pR(g,{relative:i}),T=Vr(),L=null;if(d){let q=Jd(d,[],T.mask?T.mask.pathname:"/",!0);C!=="/"&&(q.pathname=q.pathname==="/"?C:Fr([C,q.pathname])),L=S.createHref(q)}let[B,_,R]=VR(r,k),z=r_(g,{replace:c,mask:d,state:p,target:h,preventScrollReset:m,relative:i,viewTransition:v,defaultShouldRevalidate:b,useTransitions:N});function F(q){t&&t(q),q.defaultPrevented||z(q)}let Y=!(O.isExternal||o),D=w.createElement("a",{...k,...R,href:(Y?L:void 0)||O.absoluteURL||M,onClick:Y?F:t,ref:YR(j,_),target:h,"data-discover":!A&&n==="render"?"true":void 0});return B&&!A?w.createElement(w.Fragment,null,D,w.createElement(WR,{page:M})):D});bj.displayName="Link";var e_=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:i=!1,style:o,to:c,viewTransition:d,children:p,...h},g){let m=vc(c,{relative:h.relative}),v=Vr(),b=w.useContext(ef),{navigator:k,basename:j}=w.useContext(br),C=b!=null&&l_(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,N=v.pathname,A=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(N=N.toLowerCase(),A=A?A.toLowerCase():null,S=S.toLowerCase()),A&&j&&(A=Ua(A,j)||A);const O=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let M=N===S||!i&&N.startsWith(S)&&N.charAt(O)==="/",T=A!=null&&(A===S||!i&&A.startsWith(S)&&A.charAt(S.length)==="/"),L={isActive:M,isPending:T,isTransitioning:C},B=M?t:void 0,_;typeof r=="function"?_=r(L):_=[r,M?"active":null,T?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let R=typeof o=="function"?o(L):o;return w.createElement(bj,{...h,"aria-current":B,className:_,ref:g,style:R,to:c,viewTransition:d},typeof p=="function"?p(L):p)});e_.displayName="NavLink";var t_=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:o,method:c=ud,action:d,onSubmit:p,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:v,...b},k)=>{let{useTransitions:j}=w.useContext(br),C=s_(),S=o_(d,{relative:h}),N=c.toLowerCase()==="get"?"get":"post",A=typeof d=="string"&&yj.test(d),O=M=>{if(p&&p(M),M.defaultPrevented)return;M.preventDefault();let T=M.nativeEvent.submitter,L=(T==null?void 0:T.getAttribute("formmethod"))||c,B=()=>C(T||M.currentTarget,{fetcherKey:t,method:L,navigate:n,replace:i,state:o,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:v});j&&n!==!1?w.startTransition(()=>B()):B()};return w.createElement("form",{ref:k,method:N,action:S,onSubmit:r?p:O,...b,"data-discover":!A&&e==="render"?"true":void 0})});t_.displayName="Form";function n_(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xj(e){let t=w.useContext(Eo);return Gt(t,n_(e)),t}function r_(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p,useTransitions:h}={}){let g=Zg(),m=Vr(),v=vc(e,{relative:c});return w.useCallback(b=>{if(LR(b,t)){b.preventDefault();let k=n!==void 0?n:rc(m)===rc(v),j=()=>g(e,{replace:k,mask:r,state:i,preventScrollReset:o,relative:c,viewTransition:d,defaultShouldRevalidate:p});h?w.startTransition(()=>j()):j()}},[m,g,v,n,r,i,t,e,o,c,d,p,h])}var a_=0,i_=()=>`__${String(++a_)}__`;function s_(){let{router:e}=xj("useSubmit"),{basename:t}=w.useContext(br),n=jR(),r=e.fetch,i=e.navigate;return w.useCallback(async(o,c={})=>{let{action:d,method:p,encType:h,formData:g,body:m}=zR(o,t);if(c.navigate===!1){let v=c.fetcherKey||i_();await r(v,n,c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:m,formMethod:c.method||p,formEncType:c.encType||h,flushSync:c.flushSync})}else await i(c.action||d,{defaultShouldRevalidate:c.defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:g,body:m,formMethod:c.method||p,formEncType:c.encType||h,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[r,i,t,n])}function o_(e,{relative:t}={}){let{basename:n}=w.useContext(br),r=w.useContext(da);Gt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),o={...vc(e||".",{relative:t})},c=Vr();if(e==null){o.search=c.search;let d=new URLSearchParams(o.search),p=d.getAll("index");if(p.some(g=>g==="")){d.delete("index"),p.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();o.search=g?`?${g}`:""}}return(!e||e===".")&&i.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Fr([n,o.pathname])),rc(o)}function l_(e,{relative:t}={}){let n=w.useContext(uj);Gt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=xj("useViewTransitionState"),i=vc(e,{relative:t});if(!n.isTransitioning)return!1;let o=Ua(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=Ua(n.nextLocation.pathname,r)||n.nextLocation.pathname;return jd(i.pathname,c)!=null||jd(i.pathname,o)!=null}var c_=tj();const u_="modulepreload",d_=function(e){return"/ui/"+e},b1={},kt=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=c(n.map(h=>{if(h=d_(h),h in b1)return;b1[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const v=document.createElement("link");if(v.rel=g?"stylesheet":u_,g||(v.as="script"),v.crossOrigin="",v.href=h,p&&v.setAttribute("nonce",p),document.head.appendChild(v),g)return new Promise((b,k)=>{v.addEventListener("load",b),v.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return i.then(c=>{for(const d of c||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})},x1=e=>{let t;const n=new Set,r=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const v=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,v))}},i=()=>t,d={setState:r,getState:i,getInitialState:()=>p,subscribe:h=>(n.add(h),()=>n.delete(h))},p=t=e(r,i,d);return d},f_=(e=>e?x1(e):x1),p_=e=>e;function h_(e,t=p_){const n=Je.useSyncExternalStore(e.subscribe,Je.useCallback(()=>t(e.getState()),[e,t]),Je.useCallback(()=>t(e.getInitialState()),[e,t]));return Je.useDebugValue(n),n}const w1=e=>{const t=f_(e),n=r=>h_(t,r);return Object.assign(n,t),n},hs=(e=>e?w1(e):w1),wj="dkg-layout",m_=260,Jr={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:m_},kj=140,Sj=400,jj=200,Cj=500,Nj=120,Nd=600,g_=240;function v_(e,t){if(typeof document>"u")return t;const n=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),r=parseFloat(n);return Number.isFinite(r)?r:t}function Ed(){const e=v_("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return Nd;const n=t-e-g_;return Math.max(0,Math.min(Nd,n))}function fd(e,t,n){return Math.max(t,Math.min(n,e))}function Bh(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:fd(e,n,r)}function y_(){try{const e=localStorage.getItem(wj);if(!e)return Jr;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Jr.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Jr.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Jr.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Jr.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Jr.leftSectionIntegrationsOpen,leftWidth:Bh(t.leftWidth,Jr.leftWidth,kj,Sj),rightWidth:Bh(t.rightWidth,Jr.rightWidth,jj,Cj),bottomHeight:Bh(t.bottomHeight,Jr.bottomHeight,Nj,Nd)}}catch{return Jr}}let Bu=null;function La(e){Bu&&clearTimeout(Bu),Bu=setTimeout(()=>{Bu=null;try{localStorage.setItem(wj,JSON.stringify(e))}catch{}},150)}function Ia(e){return{leftCollapsed:e.leftCollapsed,rightCollapsed:e.rightCollapsed,bottomCollapsed:e.bottomCollapsed,leftSectionMyProjectsOpen:e.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:e.leftSectionIntegrationsOpen,leftWidth:e.leftWidth,rightWidth:e.rightWidth,bottomHeight:e.bottomHeight}}const xi=y_(),tr=hs((e,t)=>({leftCollapsed:xi.leftCollapsed,rightCollapsed:xi.rightCollapsed,bottomCollapsed:xi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:xi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:xi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:xi.leftWidth,rightWidth:xi.rightWidth,bottomHeight:xi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),La(Ia(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),La(Ia(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),La(Ia(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),La(Ia(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),La(Ia(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),La(Ia(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:fd(n,kj,Sj)}),La(Ia(t()))},setRightWidth:n=>{e({rightWidth:fd(n,jj,Cj)}),La(Ia(t()))},setBottomHeight:n=>{const r=Math.min(Nj,Ed());e({bottomHeight:fd(n,r,Nd)}),La(Ia(t()))}})),tv=hs(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),b_=[{id:"dashboard",label:"Dashboard",closable:!1}],gn=hs((e,t)=>({tabs:b_,activeTabId:"dashboard",openTab:n=>{const{tabs:r}=t();r.find(i=>i.id===n.id)?e({activeTabId:n.id}):e({tabs:[...r,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:r,activeTabId:i}=t(),o=r.filter(p=>p.id!==n);if(o.length===0)return;const c=i===n?((d=o[Math.max(0,r.findIndex(p=>p.id===n)-1)])==null?void 0:d.id)??o[0].id:i;e({tabs:o,activeTabId:c})},setActiveTab:n=>e({activeTabId:n})})),Ir="";function Bt(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class Hn extends Error{constructor(n,r,i){super(r??`HTTP ${n}`);rt(this,"status");rt(this,"body");this.status=n,this.body=i}}async function nv(e,t={},n=1e4){try{return await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(r){throw r instanceof Error&&r.name==="TimeoutError"?new Error(`Request timed out after ${Math.round(n/1e3)}s`):r}}async function yt(e){const t=await fetch(`${Ir}${e}`,{headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Hn(t.status,r,n)}return t.json()}async function To(e){const t=await fetch(`${Ir}${e}`,{headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Hn(t.status,r,n)}return t.json()}async function Ej(e,t){const n=await nv(`${Ir}${e}`,{headers:Bt()},t);if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Hn(n.status,i,r)}return n.json()}async function un(e,t){const n=await fetch(`${Ir}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Hn(n.status,i,r)}return n.json()}async function rv(e,t){const n=await fetch(`${Ir}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(i)}return n.json()}async function x_(e){const t=await fetch(`${Ir}${e}`,{method:"DELETE",headers:Bt()});if(!t.ok){const n=await t.json().catch(()=>({})),r=(n==null?void 0:n.error)??`HTTP ${t.status}`;throw new Hn(t.status,r,n)}return t.json()}class w_{constructor(t,n=()=>!0){rt(this,"maxEntries");rt(this,"shouldAdmit");rt(this,"entries",new Map);if(this.maxEntries=t,this.shouldAdmit=n,!Number.isSafeInteger(t)||t<1)throw new RangeError("maxEntries must be a positive safe integer")}get size(){return this.entries.size}has(t){return this.entries.has(t)}get(t){if(!this.entries.has(t))return;const n=this.entries.get(t);return this.entries.delete(t),this.entries.set(t,n),n}set(t,n){if(!this.shouldAdmit(t)||(this.entries.delete(t),this.entries.set(t,n),this.entries.size<=this.maxEntries))return;const r=this.entries.keys().next();r.done||this.entries.delete(r.value)}}function k_(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function k1(e){return e<=1114111&&!(e>=55296&&e<=57343)}function en(e,t){if(t<0||t>=e.length)return null;const n=e.charCodeAt(t);if(n!==92){const d=e.codePointAt(t);return d===void 0||!k1(d)?null:{codePoint:d,rawWidth:d>65535?2:1}}const r=e[t+1];if(r!=="u"&&r!=="U")return{codePoint:n,rawWidth:1};const i=r==="u"?4:8,o=t+2+i;if(o>e.length)return null;let c=0;for(let d=t+2;d<o;d++){const p=e.charCodeAt(d);if(!k_(p))return null;c=c*16+Number.parseInt(e[d],16)}return k1(c)?{codePoint:c,rawWidth:2+i}:null}function Aj(e){return e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function nf(e){return e===95||Aj(e)}function S_(e){return nf(e)||e===45||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}function Ro(e,t,n){const r=en(e,t);return r&&n(r.codePoint)?r.rawWidth:0}function Tj(e,t){return Ro(e,t,Aj)}function j_(e,t){return Ro(e,t,nf)}function Ad(e,t){return Ro(e,t,S_)}function ng(e,t){return Ro(e,t,n=>n>=48&&n<=57)}function C_(e){return nf(e)||e>=48&&e<=57}function N_(e){return nf(e)||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}function E_(e,t){return Ro(e,t,C_)}function S1(e,t){return Ro(e,t,N_)}function A_(e,t){const n=en(e,t);if(!n||n.codePoint!==63&&n.codePoint!==36)return null;let r=t+n.rawWidth;const i=E_(e,r);if(!i)return null;r+=i;let o=S1(e,r);for(;o;)r+=o,o=S1(e,r);return r}function T_(e,t,n){const r=en(e,t);return(r==null?void 0:r.codePoint)===n?r.rawWidth:0}function R_(e,t){const n=en(e,t);if(!n||n.codePoint!==34&&n.codePoint!==39)return null;const r=n.codePoint,i=n.rawWidth>1,o=m=>{if(i)return T_(e,m,r);const v=e.codePointAt(m);return v===r?v>65535?2:1:0};let c=t+n.rawWidth;const d=o(c),p=d?o(c+d):0,h=d>0&&p>0;h&&(c+=d+p);let g=!1;for(;c<e.length;){if(!i&&e.charCodeAt(c)===92){if(e[c+1]==="u"||e[c+1]==="U"){const S=en(e,c);S||(g=!0),c+=(S==null?void 0:S.rawWidth)??1;continue}const C=e.codePointAt(c+1);c+=1+(C!==void 0&&C>65535?2:1);continue}const m=en(e,c);if(!m){g=!0,c++;continue}if(m.codePoint===92){const C=en(e,c+m.rawWidth);c+=m.rawWidth+((C==null?void 0:C.rawWidth)??0);continue}const v=o(c);if(!v){c+=m.rawWidth;continue}if(!h)return{end:c+v,closed:!0,malformedUchar:g};const b=c+v,k=o(b),j=k?o(b+k):0;if(k&&j)return{end:b+k+j,closed:!0,malformedUchar:g};c+=m.rawWidth}return{end:e.length,closed:!1,malformedUchar:g}}function __(e){return e>32&&e!==60&&e!==62&&e!==34&&e!==123&&e!==125&&e!==124&&e!==94&&e!==96&&e!==92}function O_(e,t,n){let r=t;for(;r<e.length;){const i=en(e,r);if(!i)return null;if(!n&&e.charCodeAt(r)===92){if(e[r+1]!=="u"&&e[r+1]!=="U")return null;r+=i.rawWidth;continue}if(n&&i.codePoint===62||!n&&e.codePointAt(r)===62)return r+i.rawWidth;if(!__(i.codePoint))return null;r+=i.rawWidth}return null}function M_(e,t){const n=en(e,t);return!n||n.codePoint!==60?null:O_(e,t+n.rawWidth,n.rawWidth>1)}function ac(e,t,n){const r=en(e,t);return(r==null?void 0:r.codePoint)===n?r.rawWidth:0}function j1(e,t){const n=en(e,t);return n&&(n.codePoint>=48&&n.codePoint<=57||n.codePoint>=65&&n.codePoint<=70||n.codePoint>=97&&n.codePoint<=102)?n.rawWidth:0}function Rj(e,t){const n=en(e,t);if(!n)return 0;if(n.codePoint===37){const o=j1(e,t+n.rawWidth);if(!o)return 0;const c=j1(e,t+n.rawWidth+o);return c?n.rawWidth+o+c:0}if(n.codePoint!==92)return 0;const r=en(e,t+n.rawWidth);if(!r)return 0;const i=String.fromCodePoint(r.codePoint);return"_~.-!$&'()*+,;=/?#@%".includes(i)?n.rawWidth+r.rawWidth:0}function L_(e,t){return j_(e,t)||ng(e,t)||ac(e,t,58)||Rj(e,t)}function I_(e,t){return Ad(e,t)||ac(e,t,58)||Rj(e,t)}function C1(e,t){let n=t,r=L_(e,n);if(!r)return n;n+=r;let i=n;for(;n<e.length;){if(r=I_(e,n),r){n+=r,i=n;continue}const o=ac(e,n,46);if(o){n+=o;continue}break}return i}function D_(e,t){const n=Tj(e,t);if(!n)return;let r=t+n,i=r;for(;r<e.length;){const c=Ad(e,r);if(c){r+=c,i=r;continue}const d=ac(e,r,46);if(d){r+=d;continue}break}const o=ac(e,r,58);return o&&r===i?{end:r+o}:void 0}function z_(e){return/\s/u.test(String.fromCodePoint(e))}function Fh(e,t,n){for(let r=t;r<n;r++)e[r]=" "}function $_(e,t,n){const r=en(e,t);if(!r||r.codePoint!==60)return null;const i=[];let o=t+r.rawWidth;for(;o<n;){const c=en(e,o);if(!c||o+c.rawWidth>n)return null;if(o+c.rawWidth===n)return c.codePoint===62?i.join(""):null;i.push(String.fromCodePoint(c.codePoint)),o+=c.rawWidth}return null}function P_(e,t,n){const r=[];let i=t;for(;i<n;){const o=en(e,i);if(!o||i+o.rawWidth>n)return null;r.push(String.fromCodePoint(o.codePoint)),i+=o.rawWidth}return r.join("")}function qh(e,t){let n=t,r=0,i=ng(e,n);for(;i>0;)n+=i,r++,i=ng(e,n);return{end:n,count:r}}function U_(e,t){let n=t;const r=en(e,n);((r==null?void 0:r.codePoint)===43||(r==null?void 0:r.codePoint)===45)&&(n+=r.rawWidth);const i=qh(e,n);n=i.end;const o=n,c=en(e,n);let d=0,p=!1;if((c==null?void 0:c.codePoint)===46){p=!0;const g=qh(e,n+c.rawWidth);n=g.end,d=g.count}if(i.count===0&&d===0)return null;const h=en(e,n);if((h==null?void 0:h.codePoint)===69||(h==null?void 0:h.codePoint)===101){let g=n+h.rawWidth;const m=en(e,g);((m==null?void 0:m.codePoint)===43||(m==null?void 0:m.codePoint)===45)&&(g+=m.rawWidth);const v=qh(e,g);if(v.count>0)return v.end}return p&&d===0?i.count>0?o:null:n}function Al(e,t,n,r,i=P_(t,n,r)){if(i===null)return null;const o={raw:t.slice(n,r),logicalValue:i,start:n,end:r};return e==="word"?{kind:e,...o,upper:i.toUpperCase()}:{kind:e,...o}}function B_(e){return e?e.kind==="variable"||e.kind==="prefixed-name"||e.kind==="number"||e.kind==="iri"||e.kind==="string"?!0:e.kind==="word"?e.upper==="TRUE"||e.upper==="FALSE":e.logicalValue===")":!1}function F_(e,t){return!(t[t.length-1]==="("&&B_(e[e.length-1]))}function q_(e,t){if(t==="("||t==="{"){e.push(t);return}const n=t===")"?"(":t==="}"?"{":void 0;n!==void 0&&e[e.length-1]===n&&e.pop()}function H_(e){var r;const t=[];let n=0;for(;n<e.length;){const i=e[n];if((i==null?void 0:i.kind)!=="word")break;if(i.upper==="BASE"&&((r=e[n+1])==null?void 0:r.kind)==="iri"){n+=2;continue}if(i.upper!=="PREFIX")break;const o=e[n+1],c=e[n+2];if((o==null?void 0:o.kind)!=="prefixed-name"||i.end===o.start||(c==null?void 0:c.kind)!=="iri"||o.logicalValue.indexOf(":")!==o.logicalValue.length-1)break;t.push(o.logicalValue.slice(0,-1)),n+=3}return{endTokenIndex:n,declaredPrefixes:t}}function N1(e){const t=e.split(""),n=[],r=[],i=[];let o=!1,c=0;for(;c<e.length;){const h=en(e,c);if(!h)return null;if(z_(h.codePoint)){n.push(String.fromCodePoint(h.codePoint)),c+=h.rawWidth;continue}if(h.codePoint===35){const k=c;c+=h.rawWidth;const j=c;for(;c<e.length&&e[c]!==`
|
|
62
|
+
`&&e[c]!=="\r";)c++;n.push(String.fromCodePoint(h.codePoint),e.slice(j,c)),Fh(t,k,c);continue}if(h.codePoint===34||h.codePoint===39){const k=c,j=R_(e,k);if(!j){n.push(String.fromCodePoint(h.codePoint)),c+=h.rawWidth;continue}if(j.malformedUchar)return null;c=j.end,n.push(e.slice(k,c)),Fh(t,k,c),r.push({kind:"string",raw:e.slice(k,c),start:k,end:c}),j.closed||(o=!0);continue}if(h.codePoint===60&&F_(r,i)){const k=M_(e,c);if(k!==null){const j=c;c=k;const C=$_(e,j,c);if(C===null){o=!0;continue}n.push(e.slice(j,c)),Fh(t,j,c),r.push({kind:"iri",raw:e.slice(j,c),logicalValue:C,start:j,end:c});continue}}if(h.codePoint===63||h.codePoint===36){const k=A_(e,c);if(k!==null){const j=c;c=k;const C=Al("variable",e,j,c);if(!C)return null;r.push(C),n.push(C.logicalValue);continue}}const g=U_(e,c);if(g!==null){const k=c;c=g;const j=Al("number",e,k,c);if(!j)return null;r.push(j),n.push(j.logicalValue);continue}if(h.codePoint===58){const k=c;c=C1(e,c+h.rawWidth);const j=Al("prefixed-name",e,k,c);if(!j)return null;r.push(j),n.push(j.logicalValue);continue}const m=Tj(e,c);if(m){const k=c,j=D_(e,c);let C;if(j)C="prefixed-name",c=C1(e,j.end);else{C="word",c+=m;let N=Ad(e,c);for(;N;)c+=N,N=Ad(e,c)}const S=Al(C,e,k,c);if(!S)return null;r.push(S),n.push(S.logicalValue);continue}const v=c;c+=h.rawWidth;const b=Al("symbol",e,v,c,String.fromCodePoint(h.codePoint));if(!b)return null;r.push(b),n.push(b.logicalValue),q_(i,b.logicalValue)}const d=t.join(""),p=new Set;for(const h of r)h.kind==="word"&&p.add(h.upper);return{masked:d,materialized:n.join(""),tokens:r,unterminated:o,wordTokens:p,prologue:H_(r)}}function E1(e){return{status:"malformed-uchar",source:e,masked:" ".repeat(e.length),materialized:e,tokens:[],unterminated:!1,wordTokens:new Set,prologue:{endTokenIndex:0,declaredPrefixes:[]}}}function G_(e,t){return e.unterminated!==t.unterminated||e.tokens.length!==t.tokens.length?!1:e.tokens.every((n,r)=>{const i=t.tokens[r];return(i==null?void 0:i.kind)!==n.kind?!1:n.kind==="string"?i.raw===n.raw:i.kind==="string"?!1:i.logicalValue===n.logicalValue})}function V_(e){const t=N1(e);if(t===null)return E1(e);if(t.materialized!==e){const n=N1(t.materialized);if(n===null||n.materialized!==t.materialized||!G_(t,n))return E1(e)}return{status:"valid",source:e,masked:t.masked,materialized:t.materialized,tokens:t.tokens,unterminated:t.unterminated,wordTokens:new Set(t.wordTokens),prologue:t.prologue}}function Hh(e,t,n){const r=[],i=Array(e.length).fill(-1),o=[],c=[];let d=0,p=!0;for(let h=0;h<e.length;h++){r.push(d);const g=e[h];if(g.kind!=="symbol")continue;if(g.logicalValue===t){c.push(h),d++;continue}if(g.logicalValue!==n)continue;const m=c.pop();m===void 0?p=!1:(i[m]=h,i[h]=m,o.push({openingTokenIndex:m,closingTokenIndex:h,depth:r[m]})),d--}return Object.freeze({depthBefore:Object.freeze(r),matchingTokenIndexes:Object.freeze(i),ranges:Object.freeze(o.sort((h,g)=>h.openingTokenIndex-g.openingTokenIndex)),balanced:p&&c.length===0&&d===0})}function W_(e){const{tokens:t}=e;return Object.freeze({braces:Hh(t,"{","}"),parentheses:Hh(t,"(",")"),brackets:Hh(t,"[","]")})}function A1(e,t,n=0,r=e.depthBefore.length){const i=[];for(let o=n;o<r;o++)e.depthBefore[o]===t&&i.push(o);return i}function _j(e){return(e==null?void 0:e.kind)==="iri"?e.logicalValue:null}function Z_(e){const t=new Map;for(let n=0;n+2<e.prologue.endTokenIndex;n++){const r=e.tokens[n],i=e.tokens[n+1],o=e.tokens[n+2];if((r==null?void 0:r.kind)!=="word"||r.upper!=="PREFIX"||(i==null?void 0:i.kind)!=="prefixed-name"||!i.logicalValue.endsWith(":"))continue;const c=_j(o);c!==null&&t.set(i.logicalValue.slice(0,-1),c),n+=2}return t}function Q_(e,t){const{tokens:n}=e,r=[];let i=-1;for(const h of A1(t.braces,0)){const g=n[h];if((g==null?void 0:g.kind)==="word"&&g.upper==="WHERE"){const m=n[h+1];if((m==null?void 0:m.kind)!=="symbol"||m.logicalValue!=="{")return null;i=h+1;break}(g==null?void 0:g.kind)==="symbol"&&g.logicalValue==="{"&&r.push(h)}const o=i>=0?i:t.braces.balanced?r.at(-1)??-1:-1;if(o<0)return null;const c=t.braces.matchingTokenIndexes[o]??-1;if(c<0)return null;const d=t.braces.depthBefore[o]+1,p=A1(t.braces,d,o+1,c).some(h=>{const g=n[h];return(g==null?void 0:g.kind)==="word"&&g.upper==="UNION"});return{openStart:n[o].start,openEnd:n[o].end,close:n[c].start,hasUnion:p,openingTokenIndex:o,closingTokenIndex:c}}function T1(e,t,n){const r=[],i=new Set;for(let o=t;o<n;o++){const c=e.tokens[o];if((c==null?void 0:c.kind)!=="variable")continue;const d=c.logicalValue.slice(1);i.has(d)||(i.add(d),r.push({source:c.raw,logicalName:d}))}return r}function K_(e){const t=W_(e),n=Q_(e,t),r=e.tokens[e.prologue.endTokenIndex],i=Z_(e),o=t.braces.depthBefore,c=[],d=[],p=new Set;let h=!1;for(let g=0;g<e.tokens.length;g++){const m=e.tokens[g];if(m.kind!=="word"||(m.upper==="FROM"&&(h=!0),m.upper!=="GRAPH"))continue;const v=e.tokens[g+1];if((v==null?void 0:v.kind)==="variable"){const k={source:v.raw,logicalName:v.logicalValue.slice(1)};c.push({kind:"variable",variable:k,keywordTokenIndex:g,targetTokenIndex:g+1,braceDepth:o[g]}),p.has(k.logicalName)||(p.add(k.logicalName),d.push(k));continue}const b=_j(v);if(b!==null){c.push({kind:"iri",iri:b,keywordTokenIndex:g,targetTokenIndex:g+1,braceDepth:o[g]});continue}if((v==null?void 0:v.kind)==="prefixed-name"){const k=v.logicalValue.indexOf(":"),j=i.get(v.logicalValue.slice(0,k));if(k>=0&&j!==void 0){c.push({kind:"iri",iri:`${j}${v.logicalValue.slice(k+1)}`,keywordTokenIndex:g,targetTokenIndex:g+1,braceDepth:o[g]});continue}}c.push({kind:"invalid",keywordTokenIndex:g,targetTokenIndex:g+1,braceDepth:o[g]})}return{source:e.source,prepared:e,structure:t,operation:(r==null?void 0:r.kind)==="word"?r.upper:null,where:n,queryVariables:T1(e,0,e.tokens.length),whereVariables:n?T1(e,n.openingTokenIndex+1,n.closingTokenIndex):[],prefixes:i,hasDatasetClause:h,hasGraphClause:c.length>0,graphTargets:c,graphVariables:d}}const Y_=["SELECT","CONSTRUCT","ASK","DESCRIBE"],Oj=["INSERT","DELETE","LOAD","CLEAR","DROP","CREATE","COPY","MOVE","ADD"],X_=[...Oj,"WITH"],J_=256,eO=64*1024,R1=new w_(J_,e=>e.length<=eO),tO=new Set(Oj),nO=new Set(X_),rO=new Set(Y_);function aO(e){const{operation:t}=e;return t===null?"UNKNOWN":Mj(t)||Lj(t)?t:"UNKNOWN"}function Mj(e){return rO.has(e)}function Lj(e){return nO.has(e)}function iO(e){return Mj(e)?{kind:"read",form:e}:Lj(e)?{kind:"update"}:{kind:"unknown"}}function Gh(e){return{operation:iO(e.form),mutatingKeyword:e.mutatingKeyword}}function _1(e){if(e.status!=="valid")return{form:"UNKNOWN",mutatingKeyword:null};const t=K_(e),n=aO(t),r=e.tokens.find(i=>i.kind==="word"&&tO.has(i.upper));return{form:n,mutatingKeyword:(r==null?void 0:r.kind)==="word"?r.raw:null}}function sO(e){if(typeof e!="string")return Gh(_1(e));const t=R1.get(e);if(t)return Gh(t);const n=_1(V_(e));return R1.set(e,n),Gh(n)}function oO(e){return sO(e).operation}const Td=(e,t,n)=>{const r=new URLSearchParams;t&&r.set("key",t),n!=null&&n.extended&&r.set("extended","1");const i=r.toString();return To(`/api/pca/${encodeURIComponent(e)}${i?`?${i}`:""}`).then(o=>n!=null&&n.extended?{...o,extendedRequested:!0}:o)},iQ=e=>un("/api/pca",{tokens:e.tokens,primaryNode:e.primaryNode}),sQ=(e,t)=>un(`/api/pca/${encodeURIComponent(e)}/agent`,{agent:t}),oQ=(e,t)=>x_(`/api/pca/${encodeURIComponent(e)}/agent/${encodeURIComponent(t)}`),lQ=(e,t)=>un(`/api/pca/${encodeURIComponent(e)}/funds`,{tokens:t}),cQ=e=>un(`/api/pca/${encodeURIComponent(e)}/settle`,{}),uQ=e=>To(`/api/pca/${encodeURIComponent(e)}/agents`),lO=e=>To(`/api/pca/agent/${encodeURIComponent(e)}`),dQ=e=>To("/api/pca/mine?hydrate=1"),fQ=e=>To(`/api/pca/designatable-nodes${e!=null&&e.fresh?"?fresh=1":""}`),cO=()=>To("/api/pca/contracts");function Ij(e){var n;if(!(e instanceof Hn))return!1;const t=(n=e.body)==null?void 0:n.code;return typeof t=="string"&&(t.startsWith("RPC_")||t==="TIMEOUT")}function pQ(e){return e instanceof Hn&&e.status===503&&!Ij(e)}function hQ(e){if(!(e instanceof Hn)||e.status!==503)return!1;const t=e.body;return(t==null?void 0:t.code)==="PCA_LOOKUP_READ_FAILED"||(t==null?void 0:t.error)==="PCA_LOOKUP_READ_FAILED"}const uO=["PrimaryNodeNotInShardingTable","PrimaryNodeUnchanged","PrimaryNodeChangeRateLimited","ZeroPrimaryNode","InvalidAmount","ZeroAgentAddress","TokenTransferFailed","NotAccountOwner","AgentAlreadyRegistered","AgentNotRegistered","AgentCapReached","AccountExpired","AccountAlreadyFullySettled","UnknownAccount"];function mQ(e,t={}){if(!(e instanceof Hn))return null;const n=e.status,r=e.body??{},i=typeof r.error=="string"&&r.error.length>0?r.error:e.message,o=t.accountId?`PCA #${t.accountId}`:"this Publisher Conviction Account",c=r.existingAccountId!=null?String(r.existingAccountId):void 0;if(Ij(e))return{code:"ServerError",status:n,message:"The chain RPC is temporarily unavailable — try again."};if(n===503)return{code:"FEATURE_UNAVAILABLE",status:n,message:"Publisher Conviction Accounts aren't available on this network."};const d=uO.find(p=>new RegExp(`\\b${p}\\b`).test(i));if(d){let p;switch(d){case"InvalidAmount":p="Enter a TRAC amount greater than 0.";break;case"PrimaryNodeNotInShardingTable":p="That primary node isn't a staked node in the sharding table.";break;case"ZeroPrimaryNode":p="Choose a staked node as the primary node.";break;case"PrimaryNodeUnchanged":p="That's already this account's primary node.";break;case"PrimaryNodeChangeRateLimited":p="The primary node was changed too recently — try again later.";break;case"ZeroAgentAddress":p="Enter a valid operational wallet address.";break;case"TokenTransferFailed":p="The TRAC transfer failed — check the owner wallet's TRAC balance and allowance.";break;case"NotAccountOwner":p=`This node isn't the owner of ${o}, so it can't manage it.`;break;case"UnknownAccount":p=`${o} doesn't exist.`;break;case"AgentAlreadyRegistered":p=c?`This operational wallet is already an approved publishing wallet on PCA #${c} — deregister it there first.`:"This operational wallet is already approved on another PCA — deregister it there first.";break;case"AgentNotRegistered":p=`This operational wallet isn't an approved publishing wallet on ${o}.`;break;case"AgentCapReached":p=`${o} already has the maximum 100 approved publishing wallets.`;break;case"AccountExpired":p=`${o} has expired.`;break;case"AccountAlreadyFullySettled":p=`${o} is already fully settled.`;break;default:p=i}return{code:d,status:n,message:p,...c?{existingAccountId:c}:{}}}return n===404?{code:"UnknownAccount",status:n,message:`${o} doesn't exist.`}:n===403?{code:"NotAccountOwner",status:n,message:`This node isn't the owner of ${o}, so it can't manage it.`}:n===400?{code:"BadRequest",status:n,message:i}:n===409?{code:"Conflict",status:n,message:i}:n>=500?{code:"ServerError",status:n,message:"Something went wrong talking to the chain — try again."}:{code:"Unknown",status:n,message:i}}const O1="did:dkg:context-graph:",Dj=6e4;function zj(e){const t=e.trim();return t.startsWith(O1)?t.slice(O1.length):t}class Rd extends Error{constructor(n,r={}){super(n);rt(this,"status");rt(this,"code");rt(this,"source");rt(this,"details");rt(this,"correlationId");rt(this,"timeoutMs");rt(this,"target");rt(this,"route");rt(this,"integrationId");rt(this,"retryable");rt(this,"text");rt(this,"timedOut");this.name="LocalAgentApiError",Object.assign(this,r)}}const av=()=>yt("/api/status"),gQ=()=>yt("/api/settings/retention"),vQ=e=>rv("/api/settings/retention",{retentionDays:e}),yQ=()=>yt("/api/settings/telemetry"),bQ=e=>rv("/api/settings/telemetry",{enabled:e}),dO=()=>yt("/api/connections"),fO=(e,t=1e4)=>nv(`${Ir}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(i)}return n.json()}),pO=(e,t=2e4)=>nv(`${Ir}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(i)}return n.json()}),iv=()=>yt("/api/agents"),hO=()=>yt("/api/metrics"),xQ=(e,t,n=300)=>yt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),mO=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return yt(`/api/operations?${t}`)},wQ=e=>yt(`/api/operations/${e}`),kQ=e=>{const t=e?`?periodMs=${e}`:"";return yt(`/api/error-hotspots${t}`)},SQ=(e={})=>{const t=new URLSearchParams;e.phase&&t.set("phase",e.phase),e.operationName&&t.set("operationName",e.operationName),e.periodMs&&t.set("periodMs",String(e.periodMs)),e.q&&t.set("q",e.q),e.limit&&t.set("limit",String(e.limit));const n=t.toString();return yt(`/api/failed-operations${n?"?"+n:""}`)},jQ=e=>yt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),CQ=e=>yt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),NQ=(e={})=>{const t=new URLSearchParams;e.periodMs&&t.set("periodMs",String(e.periodMs)),e.bucketMs&&t.set("bucketMs",String(e.bucketMs)),e.cg&&t.set("cg",e.cg);const n=t.toString();return yt(`/api/replication/timeline${n?"?"+n:""}`)},EQ=()=>yt("/api/replication/cursors"),AQ=(e,t=100)=>yt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),TQ=e=>yt(`/api/success-rates?periodMs=${e}`),RQ=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return yt(`/api/per-type-stats?${n}`)},gO=(e={})=>{const t=new URLSearchParams;e.lines&&t.set("lines",String(e.lines)),e.q&&t.set("q",e.q);const n=t.toString();return yt(`/api/node-log${n?"?"+n:""}`)};async function rf(){return{contextGraphs:((await Ej("/api/context-graph/list",Dj)).contextGraphs??[]).filter(n=>!n.isSystem)}}const yc=()=>yt("/api/agent/identity");async function vO(e,t,n,r){const i=new AbortController,o=setTimeout(()=>i.abort(),3e4);try{const c=await fetch(`${Ir}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({id:e,name:t,description:n,...r!=null&&r.register?{register:!0}:{},...r!=null&&r.allowedAgents?{allowedAgents:r.allowedAgents}:{},...(r==null?void 0:r.accessPolicy)!==void 0?{accessPolicy:r.accessPolicy}:{},...(r==null?void 0:r.publishPolicy)!==void 0?{publishPolicy:r.publishPolicy}:{}}),signal:i.signal});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${c.status}`)}return c.json()}catch(c){throw c.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):c}finally{clearTimeout(o)}}const yO=(e,t)=>un(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),$j=e=>yt(`/api/context-graph/${encodeURIComponent(e)}/participants`),bO=e=>un(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),xO=(e,t)=>un(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),Pj=e=>yt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),sv=(e,t)=>un(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),ov=(e,t)=>un(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),wO={md:"text/markdown",markdown:"text/markdown",txt:"text/plain",csv:"text/csv",json:"application/json",xml:"application/xml",yaml:"text/yaml",yml:"text/yaml",pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",doc:"application/msword",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",epub:"application/epub+zip",ttl:"text/turtle",rdf:"application/rdf+xml",owl:"application/rdf+xml",html:"text/html",htm:"text/html",py:"text/x-python",ts:"text/typescript",js:"text/javascript",tsx:"text/typescript",jsx:"text/javascript",java:"text/x-java",go:"text/x-go",rs:"text/x-rust",c:"text/x-c",cpp:"text/x-c++",h:"text/x-c",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp"};function kO(e){var n;if(e.type&&e.type!=="application/octet-stream")return e.type;const t=((n=e.name.split(".").pop())==null?void 0:n.toLowerCase())??"";return wO[t]}async function Uj(e,t,n,r){const i=new FormData;i.append("file",n),i.append("contextGraphId",t);const o=kO(n);o&&i.append("contentType",o);const c=await fetch(`${Ir}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Bt(),body:i});if(!c.ok){const d=await c.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${c.status}`)}return c.json()}function SO(e,t){var d;const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.result??n.results,i=r&&typeof r=="object"&&!Array.isArray(r)?r:{};if(i.type==="boolean"&&typeof i.value=="boolean")return{result:{type:"boolean",value:i.value}};if(i.type==="quads"&&Array.isArray(i.quads))return{result:{type:"quads",quads:i.quads}};if(i.type==="bindings"&&Array.isArray(i.bindings))return{result:{type:"bindings",bindings:i.bindings}};const o=oO(t),c=Array.isArray(i.bindings)?i.bindings:[];if(o.kind==="read"&&o.form==="ASK"){const p=(d=c[0])==null?void 0:d.result,h=p&&typeof p=="object"&&!Array.isArray(p)?p.value:p;return{result:{type:"boolean",value:String(h).toLowerCase()==="true"}}}return o.kind==="read"&&(o.form==="CONSTRUCT"||o.form==="DESCRIBE")?{result:{type:"quads",quads:Array.isArray(i.quads)?i.quads:[]}}:{result:{type:"bindings",bindings:c}}}const Vh=new Map;function _d(e){const t=JSON.stringify(e),n=Vh.get(t);if(n)return n;const r=(async()=>{const i=await fetch(`${Ir}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:t});if(!i.ok){const o=await i.json().catch(()=>({})),c=(o==null?void 0:o.error)??`HTTP ${i.status}`;throw new Hn(i.status,c,o)}return SO(await i.json(),String(e.sparql??""))})().finally(()=>{Vh.delete(t)});return Vh.set(t,r),r}const gr=(e,t={})=>_d({sparql:e,...t});async function jO(e){var o,c,d;const n=`SELECT ?name ?ual WHERE {
|
|
63
|
+
GRAPH <${`did:dkg:context-graph:${e}/_meta`}> {
|
|
64
|
+
?lc <http://dkg.io/ontology/assertionName> ?name ;
|
|
65
|
+
<http://dkg.io/ontology/reservedUal> ?ual .
|
|
66
|
+
}
|
|
67
|
+
}`,r=await gr(n,{contextGraphId:e}),i={};for(const p of((o=r==null?void 0:r.result)==null?void 0:o.bindings)??[]){const h=typeof p.name=="string"?p.name:(c=p.name)==null?void 0:c.value,g=typeof p.ual=="string"?p.ual:(d=p.ual)==null?void 0:d.value;h&&g&&!i[h]&&(i[h]=g)}return i}const CO=(e,t)=>un("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),NO=e=>un("/api/profile/query-catalog/read",{contextGraphId:e}),EO=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),AO=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},TO=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(o=>!EO.has(o)&&!t.includes(o));if(n.length>0)throw new Error(`Unsupported finalized publish option(s): ${n.join(", ")}`);const r={};e.clearAfter!==void 0&&(r.clearSharedMemoryAfter=e.clearAfter),e.publishEpochs!==void 0&&(r.publishEpochs=e.publishEpochs);const i=e.publisherNodeIdentityIdOverride;return i!==void 0&&(r.publisherNodeIdentityIdOverride=AO(i)),Object.keys(r).length>0?r:void 0};function RO(e){const t=e;if(Array.isArray(t.entities))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.entities!==void 0&&t.entities!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(t.skipSeal===!0)throw Object.assign(new Error("Knowledge Assets are always sealed before sharing"),{code:"UNSEALED_SHARE_BLOCKED"});if(t.skipSeal!==void 0&&t.skipSeal!==!1)throw new TypeError("skipSeal must be false or omitted");if(t.awaitCuratorAck!==void 0&&typeof t.awaitCuratorAck!="boolean")throw new TypeError("awaitCuratorAck must be a boolean when supplied");return{...t.subGraphName?{subGraphName:t.subGraphName}:{},awaitCuratorAck:t.awaitCuratorAck??!0}}const _O=(e,t,n={})=>{const r=RO(n);return un(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:zj(e),...r.subGraphName?{subGraphName:r.subGraphName}:{},awaitCuratorAck:r.awaitCuratorAck})},lv=(e,t,n={})=>{const r=TO(n,["subGraphName"]);return un(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:zj(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...r?{options:r}:{}})};async function cv(e,t){let n=0,r=0,i;const o=[];let c=null,d=0n,p=0n,h=0n,g=0n,m,v=!0,b=!0;for(const j of t)try{const C=await lv(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{});n+=1,C.contextGraphError&&(r+=1,i===void 0&&(i=C.contextGraphError));const S=C;(!c||S.status==="confirmed"&&S.txHash&&!S.contextGraphError)&&(c=S);const N=S.convictionCostCovered;if(N)try{d+=BigInt(N.baseCost),p+=BigInt(N.discountedCost),h+=BigInt(N.drawnFromEpoch),g+=BigInt(N.drawnFromTopUp),m?(N.accountId!==m.accountId&&(v=!1),N.epoch!==m.epoch&&(b=!1)):m=N}catch{}}catch(C){const S=(C==null?void 0:C.message)??"publish failed";o.push({name:j.name,...j.subGraph?{subGraph:j.subGraph}:{},error:S})}const k=m?{...v&&m.accountId?{accountId:m.accountId}:{},...b&&m.epoch!=null?{epoch:m.epoch}:{},baseCost:d.toString(),discountedCost:p.toString(),drawnFromEpoch:h.toString(),drawnFromTopUp:g.toString()}:void 0;return{published:n,total:t.length,partial:r,partialError:i,failures:o,sample:c,convictionCostCovered:k}}async function bo(e,t="wm",n={}){var N,A,O,M,T,L,B,_;const r=n.includeQueryCatalog??!1,i=(R,z)=>R!=="meta"||r&&z.startsWith("query-catalog-");if(t==="swm"){const R=`did:dkg:context-graph:${e}/_meta`,z=`did:dkg:context-graph:${e}/`,F=`urn:dkg:assertion:${e}:`,D=`SELECT ?g ?vm WHERE {
|
|
68
|
+
GRAPH <${R}> {
|
|
69
|
+
?g <http://dkg.io/ontology/memoryLayer> "SWM"
|
|
70
|
+
OPTIONAL { ?g <http://dkg.io/ontology/vmCurrentAssertion> ?vm }
|
|
71
|
+
}
|
|
72
|
+
${r?"":'FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))'}
|
|
73
|
+
}`,q=await gr(D,{contextGraphId:e}),G=((N=q==null?void 0:q.result)==null?void 0:N.bindings)??[],W=new Set,Q=[];for(const U of G){const Z=typeof U.g=="string"?U.g:(A=U.g)==null?void 0:A.value;if(!Z)continue;const I=typeof U.vm=="string"?U.vm:(O=U.vm)==null?void 0:O.value;let ae,le;if(Z.startsWith(z)){const we=Z.slice(z.length).split("/");if(we.length===3&&we[0]==="assertion")le=we[2];else if(we.length===4&&we[1]==="assertion")ae=we[0],le=we[3];else continue}else if(Z.startsWith(F)){const we=Z.slice(F.length);let Ee=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(we);Ee?le=Ee[2]:(Ee=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(we),Ee&&(ae=Ee[1],le=Ee[3]))}else continue;if(!le||!i(ae,le))continue;const oe=`${ae??""} ${le}`;Q.push({key:oe,name:le,subGraph:ae,g:Z}),I&&W.add(oe)}const H=new Set,$=[];for(const U of Q)W.has(U.key)||H.has(U.key)||(H.add(U.key),$.push({name:U.name,graphUri:U.g,subGraph:U.subGraph}));return $}const o=`did:dkg:context-graph:${e}/_meta`,c=`did:dkg:context-graph:${e}/`,d=r?"":'FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',p=`SELECT ?g WHERE {
|
|
74
|
+
GRAPH <${o}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" }
|
|
75
|
+
${d}
|
|
76
|
+
}`,h=`SELECT ?g (COUNT(*) AS ?cnt) WHERE {
|
|
77
|
+
GRAPH <${o}> {
|
|
78
|
+
?g <http://dkg.io/ontology/memoryLayer> "WM" ;
|
|
79
|
+
<http://dkg.io/ontology/assertionGraph> ?dg
|
|
80
|
+
}
|
|
81
|
+
GRAPH ?dg { ?s ?p ?o }
|
|
82
|
+
${d}
|
|
83
|
+
} GROUP BY ?g`,[g,m]=await Promise.all([_d({sparql:p,contextGraphId:e,includeContextGraphPartitions:!0}),_d({sparql:h,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),v=((M=g==null?void 0:g.result)==null?void 0:M.bindings)??[],b=new Map;for(const R of((T=m==null?void 0:m.result)==null?void 0:T.bindings)??[]){const z=typeof R.g=="string"?R.g:(L=R.g)==null?void 0:L.value,F=typeof R.cnt=="string"?R.cnt:(B=R.cnt)==null?void 0:B.value,Y=typeof F=="string"?F.match(/^"?(\d+)/):null,D=Y?parseInt(Y[1],10):NaN;z&&Number.isFinite(D)&&b.set(z,D)}const k=[],j=new Set,C=`urn:dkg:assertion:${e}:`,S=[...v].sort((R,z)=>{var D,q;const F=(typeof R.g=="string"?R.g:(D=R.g)==null?void 0:D.value)??"",Y=(typeof z.g=="string"?z.g:(q=z.g)==null?void 0:q.value)??"";return(F.startsWith(c)?0:1)-(Y.startsWith(c)?0:1)});for(const R of S){const z=typeof R.g=="string"?R.g:(_=R.g)==null?void 0:_.value;if(!z)continue;let F,Y;if(z.startsWith(c)){const G=z.slice(c.length).split("/");if(G.length===3&&G[0]==="assertion")Y=G[2];else if(G.length===4&&G[1]==="assertion")F=G[0],Y=G[3];else continue}else if(z.startsWith(C)){const G=z.slice(C.length);let W=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(G);W?Y=W[2]:(W=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(G),W&&(F=W[1],Y=W[3]))}else continue;if(!Y||!i(F,Y))continue;const D=`${F??""}\0${Y}`;if(j.has(D))continue;j.add(D);const q=b.get(z);k.push({name:Y,graphUri:z,tripleCount:q,subGraph:F})}return k}const xo=(e,t,n,r)=>{if(Array.isArray(n))throw Object.assign(new Error("Knowledge Assets are shared atomically; root-entity selection is not supported"),{code:"KA_ATOMIC_SHARE_REQUIRED"});if(typeof n=="string"&&n!=="all")throw Object.assign(new Error("Knowledge Assets are shared atomically; omit entities to share the complete asset"),{code:"KA_ATOMIC_SHARE_REQUIRED"});const i=n===void 0||typeof n=="string"?{subGraphName:r}:{...n,subGraphName:n.subGraphName??r};return _O(e,t,i)};function uv(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Shared the complete Knowledge Asset ${e} to Shared Working Memory (${t.promotedCount} triple${t.promotedCount===1?"":"s"}).`}:{kind:"noop",message:`${e} was not newly shared. Its complete Knowledge Asset may already be in Shared Working Memory, or its content is still being committed — refresh and try again.`}}function wo(e,t){if(t instanceof Hn&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE")return{kind:"payload-too-large",actualBytes:typeof n.actualBytes=="number"?n.actualBytes:void 0,limitBytes:typeof n.limitBytes=="number"?n.limitBytes:void 0,message:`${e} is too large to share atomically. Split its content into smaller Knowledge Assets before sharing.`}}if(t instanceof Hn&&t.status===409){const n=t.body;if((n==null?void 0:n.code)==="ASSERTION_NOT_PERSISTED"){const r=typeof n.expectedTripleCount=="number"?n.expectedTripleCount:void 0;return{kind:"not-persisted",expectedTripleCount:r,message:r?`${e} was imported with ${r} extracted triple${r===1?"":"s"} but the data graph is empty. Re-import the source file (or re-write the assertion) before promoting.`:`${e}'s data graph is empty but its extraction metadata says it should hold content. Re-import the source file before promoting.`}}}return null}const OO=(e,t,n)=>{const r=new URLSearchParams({contextGraphId:t});return n&&r.set("subGraphName",n),yt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${r}`)};function pd(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,r=t?`?contentType=${encodeURIComponent(t)}`:"";return`${Ir}/api/file/${encodeURIComponent(n)}${r}`}const MO="binding incomplete";function ic(e){const t="Published on-chain, but linking it into the context graph did not complete, so context-graph views may be incomplete.";return e?`${t} (${e})`:t}const LO=(e=20)=>yt(`/api/memory/sessions?limit=${e}`),IO=(e,t={})=>{const n=new URLSearchParams;t.limit&&Number.isInteger(t.limit)&&t.limit>0&&n.set("limit",String(t.limit)),(t.order==="desc"||t.order==="asc")&&n.set("order",t.order);const r=n.toString();return yt(`/api/memory/sessions/${encodeURIComponent(e)}${r?`?${r}`:""}`)};function Bj(e,t){var n,r,i;return{text:e,correlationId:(t==null?void 0:t.correlationId)??crypto.randomUUID(),...t!=null&&t.identity?{identity:t.identity}:{},...t!=null&&t.sessionId?{sessionId:t.sessionId}:{},...t!=null&&t.profile?{profile:t.profile}:{},...t!=null&&t.persistUserMessage?{persistUserMessage:t.persistUserMessage}:{},...(n=t==null?void 0:t.attachments)!=null&&n.length?{attachmentRefs:t.attachments}:{},...(r=t==null?void 0:t.attachmentImportResults)!=null&&r.length?{attachmentImportResults:t.attachmentImportResults}:{},...(i=t==null?void 0:t.contextEntries)!=null&&i.length?{contextEntries:t.contextEntries}:{},...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}}async function DO(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Bt()},body:JSON.stringify(Bj(e,t)),signal:t.signal});if(!n.ok){const v=await n.json().catch(()=>({}));throw sc(v,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const v=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...v}),v}const i=n.body.getReader(),o=new TextDecoder;let c="",d,p;const h=v=>{var b;(b=t.onEvent)==null||b.call(t,v),v.type==="error"?p=sc(v,v.error||"Stream failed"):v.type==="final"&&(d={text:v.text,correlationId:v.correlationId,...v.sessionId?{sessionId:v.sessionId}:{},...v.turnId?{turnId:v.turnId}:{}})},g=v=>{let b=c.indexOf(`
|
|
84
|
+
`);for(;b!==-1;){const k=c.slice(0,b).trim();if(c=c.slice(b+1),b=c.indexOf(`
|
|
85
|
+
`),!k.startsWith("data:"))continue;const j=k.slice(5).trim();if(j){try{h(JSON.parse(j))}catch{}if(p)return}}if(v&&c.trim().startsWith("data:")){const k=c.trim().slice(5).trim();if(!k)return;try{h(JSON.parse(k))}catch{}c=""}};for(;;){const{done:v,value:b}=await i.read();if(v||(c+=o.decode(b,{stream:!0}),g(!1),p))break;if(d)return i.cancel().catch(()=>{}),d}if(c+=o.decode(),g(!0),p)throw p;if(!d)throw new Error("Stream ended without final payload");return d}const zO=()=>yt("/api/openclaw-channel/health");async function Fj(e,t,n={}){var b;const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Bt()},body:JSON.stringify(Bj(t,n)),signal:n.signal});if(!r.ok){const k=await r.json().catch(()=>({}));throw sc(k,`Request failed (${r.status})`,r.status)}const i=(r.headers.get("content-type")??"").toLowerCase();if(!r.body||!i.includes("text/event-stream")){const k=await r.json();return(b=n.onEvent)==null||b.call(n,{type:"final",...k}),k}const o=r.body.getReader(),c=new TextDecoder;let d="",p,h;const g=k=>k.type==="delta"?{type:"text_delta",delta:k.text??""}:k,m=k=>{var j;(j=n.onEvent)==null||j.call(n,k),k.type==="error"?h=sc(k,k.error||"Stream failed"):k.type==="final"&&(p={text:k.text,correlationId:k.correlationId,...k.sessionId?{sessionId:k.sessionId}:{},...k.turnId?{turnId:k.turnId}:{}})},v=k=>{let j=d.indexOf(`
|
|
86
|
+
`);for(;j!==-1;){const C=d.slice(0,j).trim();if(d=d.slice(j+1),j=d.indexOf(`
|
|
87
|
+
`),!C.startsWith("data:"))continue;const S=C.slice(5).trim();if(S){try{m(g(JSON.parse(S)))}catch{}if(h)return}}if(k&&d.trim().startsWith("data:")){const C=d.trim().slice(5).trim();if(!C)return;try{m(g(JSON.parse(C)))}catch{}d=""}};for(;;){const{done:k,value:j}=await o.read();if(k||(d+=c.decode(j,{stream:!0}),v(!1),h))break;if(p)return o.cancel().catch(()=>{}),p}if(d+=c.decode(),v(!0),h)throw h;if(!p)throw new Error("Stream ended without final payload");return p}const $O=(e,t={})=>Fj("/api/hermes-channel/stream",e,t),PO=()=>yt("/api/hermes-channel/health"),UO=(e,t={})=>Fj("/api/prime-agent-channel/stream",e,t),BO=()=>yt("/api/prime-agent-channel/health"),FO=()=>yt("/api/local-llm/health");async function qO(e,t){const n=(t==null?void 0:t.correlationId)??crypto.randomUUID(),r=await fetch("/api/local-llm/chat",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({message:e,sessionId:"local-llm:dkg-ui",...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}),signal:t==null?void 0:t.signal});if(!r.ok){const o=await r.json().catch(()=>({}));throw sc(o,`Request failed (${r.status})`,r.status)}return{...await r.json(),correlationId:n,turnId:n}}async function HO(e,t={}){var r;const n=await qO(e,t);return(r=t.onEvent)==null||r.call(t,{type:"final",...n}),n}const GO=()=>un("/api/local-llm/session/clear",{});function VO(e,t){if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e,r=typeof n.error=="string"&&n.error.trim()?n.error.trim():t;if(n.details===void 0||n.details===null)return r;const i=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!i||i===r?r:`${r}: ${i}`}function sc(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new Rd(t,{status:n});const r=e,i=VO(r,t),o=h=>{const g=r[h];return typeof g=="string"&&g.trim()?g.trim():void 0},c=h=>{const g=r[h];return typeof g=="number"&&Number.isFinite(g)?g:void 0},d=h=>{const g=r[h];return typeof g=="boolean"?g:void 0},p=typeof r.text=="string"&&r.text.trim()?r.text:void 0;return new Rd(i,{status:n,code:o("code"),source:o("source"),details:o("details"),correlationId:o("correlationId"),timeoutMs:c("timeoutMs"),target:o("target"),route:o("route"),integrationId:o("integrationId"),retryable:d("retryable"),text:p,timedOut:d("timedOut")})}const af={"local-llm":{connectSupported:!1,chatSupported:!0,defaultSessionId:()=>"local-llm:dkg-ui",resolveChatContext:()=>({}),fetchHealth:FO,streamChat:HO},openclaw:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e})=>`${e}:dkg-ui`,resolveChatContext:({integrationId:e,sessionId:t})=>{if(!t)return{};const n=`${e}:dkg-ui:`;if(!t.startsWith(n))return{};const r=t.slice(n.length).trim();return r?{identity:r}:{}},fetchHealth:zO,streamChat:DO},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>YO(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:PO,streamChat:$O},"prime-agent":{connectSupported:!0,chatSupported:!0,defaultSessionId:({record:e,health:t})=>JO(e,t),resolveChatContext:({sessionId:e,liveSession:t})=>{if(!t)return{};if(e&&t.sessionId!==e)throw new Error("Prime Agent live session does not match the selected conversation");return{sessionId:t.rawSessionId}},fetchHealth:BO,streamChat:UO}};function rs(e){var n,r;const t=e.trim().toLowerCase();return((r=(n=af[t])==null?void 0:n.defaultSessionId)==null?void 0:r.call(n,{integrationId:t}))??null}function WO(e,t){return t!=null&&t.trim()?t.trim():rs(e)}async function ZO(e,t=50){const n=r=>{if(r.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(r.turnId)}:${encodeURIComponent(r.author)}`;const i=`${e}
|
|
88
|
+
${r.author}
|
|
89
|
+
${r.ts}
|
|
90
|
+
${r.text}`;let o=2166136261;for(let c=0;c<i.length;c+=1)o^=i.charCodeAt(c),o=Math.imul(o,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(o>>>0).toString(16)}`};try{return[...(await IO(e,{limit:t,order:"desc"})).messages].reverse().map(i=>({uri:i.uri||n(i),text:i.text,author:i.author,ts:i.ts,turnId:i.turnId,persistStatus:i.persistStatus,failureReason:i.failureReason,attachmentRefs:i.attachmentRefs,toolCalls:i.toolCalls}))}catch(r){if(r instanceof Hn&&r.status===404)return[];throw r}}function QO(e){var t,n,r;return!!((t=e.transport)!=null&&t.bridgeUrl||(n=e.transport)!=null&&n.gatewayUrl||(r=e.transport)!=null&&r.healthUrl)}function Od(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function KO(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||dv(e)}function dv(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function YO(e,t,n){const r=(t==null?void 0:t.metadata)??{},i=Od(n==null?void 0:n.profile,r.profileName,r.profile),o=Od(r.hermesHome),c=o?null:XO(t),d=[i?`profile-${KO(i)}`:null,o?`home-${dv(o)}`:null,c].filter(p=>p!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function XO(e){const t=e==null?void 0:e.transport;if(!t)return null;const n=[t.kind,t.bridgeUrl,t.gatewayUrl,t.healthUrl].filter(r=>typeof r=="string"&&r.trim().length>0);return n.length?`transport-${dv(n.join("|"))}`:null}function JO(e,t){var n,r,i;return Od((n=e==null?void 0:e.metadata)==null?void 0:n.activeMemorySessionId,(i=(r=t==null?void 0:t.sessions)==null?void 0:r[0])==null?void 0:i.memorySessionId)??void 0}function eM(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function tM(e,t){if(e==="degraded")return!0;const n=String((t==null?void 0:t.status)??"").toLowerCase(),r=t==null?void 0:t.memory;return n.includes("degraded")||n.includes("conflict")||typeof r=="object"&&r!=null&&r.conflict===!0}function qj(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function M1(e){if(!qj(e))return-1;let t=e.ok===!1?100:0;return e.profile&&(t+=10),e.memory&&(t+=10),e.status&&(t+=10),e.error&&(t+=10),e.ok===!0&&(t+=1),t}function nM(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=M1(e.bridge),n=M1(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function rM(e){if(!e)return null;const{target:t,details:n}=nM(e);if(!qj(n))return e;const r=typeof n.ok=="boolean"?n.ok:void 0;return{...n,...e,ok:e.ok===!1?!1:r??e.ok,target:e.target??t,profile:e.profile??n.profile,memory:e.memory??n.memory,status:e.status??n.status,error:e.error??n.error}}function aM(e,t){if(String(e.id??"").toLowerCase()!=="hermes")return null;const n=t==null?void 0:t.profile,r=n?`profile ${n}`:"the configured profile",i=eM(t==null?void 0:t.memory),o=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(o==null?void 0:o.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${r} has a memory provider conflict${i?` (${i})`:""}.`:t!=null&&t.ok?`${e.name} ${r} is connected${i?` with ${i} memory`:""}.`:t!=null&&t.status?`${e.name} ${r} reports ${t.status}${i?` (${i})`:""}.`:null}async function fv(e){var L,B,_,R,z,F,Y,D,q,G,W,Q,H,$,U,Z;const t=String(e.id??"").toLowerCase(),n=af[t],r=((L=e.capabilities)==null?void 0:L.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,i=r&&((B=e.capabilities)==null?void 0:B.chatAttachments)===!0,o=((_=e.capabilities)==null?void 0:_.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,c=e.enabled===!0,d=(R=e.runtime)==null?void 0:R.status,p=c&&r&&(n!=null&&n.fetchHealth)?rM(await n.fetchHealth().catch(()=>null)):null,h=tM(d,p),g=(p==null?void 0:p.ok)===!0&&!h,m=g,b=c&&r&&(t==="local-llm"&&c&&r||g||d==="connecting"||d==="degraded"||((z=e.runtime)==null?void 0:z.ready)===!0||QO(e)),k=aM(e,p),j=(F=n==null?void 0:n.defaultSessionId)==null?void 0:F.call(n,{integrationId:t,record:e,health:p}),C=t==="prime-agent"&&(p==null?void 0:p.busy)===!0&&p.clientConnected===!1,S=t==="prime-agent"&&Array.isArray(p==null?void 0:p.sessions)?p.sessions.filter(I=>typeof(I==null?void 0:I.rawSessionId)=="string"&&I.rawSessionId.trim()&&typeof I.memorySessionId=="string"&&I.memorySessionId.trim()).map(I=>({...I,sessionId:I.memorySessionId.trim(),rawSessionId:I.rawSessionId.trim()})):void 0,N=t==="hermes"?Od(p==null?void 0:p.profile,(Y=e.metadata)==null?void 0:Y.profileName,(D=e.metadata)==null?void 0:D.profile)??void 0:void 0;let A,O,M;b&&h?(A="degraded",O="Degraded",M=k??(p==null?void 0:p.error)??((q=e.runtime)==null?void 0:q.lastError)??`${e.name} is attached to this node, but one capability is degraded.`):b&&((G=e.runtime)==null?void 0:G.status)==="connecting"?(A="connecting",O="Connecting",M=((W=e.runtime)==null?void 0:W.lastError)??`${e.name} is registered and still starting up.`):m?(A="chat_ready",O=C?"Still working":p!=null&&p.busy?"Working":"Chat ready",M=C?`${e.name} is still working after the browser stream disconnected. Wait for it to finish before sending another message.`:p!=null&&p.busy?`${e.name} is working on the current turn.`:`${e.name} is connected to this node and ready for chat.`):b?(A="bridge_offline",O="Bridge offline",M=k??(p==null?void 0:p.error)??((Q=e.runtime)==null?void 0:Q.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(A="available",O=o?"Ready to connect":"Awaiting chat bridge",M=c?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((H=e.runtime)==null?void 0:H.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(A="coming_soon",O=c?"Registered, panel pending":"Next integration",M=c?`${e.name} is registered on the node, but the right-panel chat bridge is not wired yet.`:"The local-agent registry is in place so this framework can plug into the same side-panel flow next.");const T=m?"Connected":A==="connecting"?"Connecting":A==="degraded"?"Degraded":b?"Unavailable":o?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:j,profile:N,chatSupported:r,chatAttachments:i,connectSupported:o,configured:c,detected:c||g,persistentChat:b,chatReady:g,bridgeOnline:m,bridgeStatusLabel:T,status:A,statusLabel:O,detail:M,error:g?void 0:(p==null?void 0:p.error)??(($=e.runtime)==null?void 0:$.lastError)??void 0,target:p==null?void 0:p.target,source:c||n?"live":"planned",...typeof((U=e.metadata)==null?void 0:U.sessionCount)=="number"?{sessionCount:e.metadata.sessionCount}:{},...typeof((Z=e.metadata)==null?void 0:Z.activeSessionId)=="string"?{activeSessionId:e.metadata.activeSessionId}:{},...S!=null&&S.length?{liveSessions:S}:{},...typeof(p==null?void 0:p.busy)=="boolean"?{busy:p.busy}:{}}}async function sf(){const e=await yt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(fv));return t.sort((n,r)=>{const i=n.id==="openclaw"?0:1,o=r.id==="openclaw"?0:1;return i!==o?i-o:n.persistentChat!==r.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(r.name)}),{integrations:t}}async function iM(e){const t=e.trim().toLowerCase(),n=af[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const r=await un("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),i=r.integration?await fv(r.integration):(await sf()).integrations.find(o=>o.id===t);if(!i)throw new Error(`Missing local agent integration: ${t}`);return{integration:i,notice:r.notice}}async function sM(e){const t=e.trim().toLowerCase();await rv(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function oM(e){const t=e.trim().toLowerCase(),n=await un(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),r=n.integration?await fv(n.integration):(await sf()).integrations.find(i=>i.id===t);if(!r)throw new Error(`Missing local agent integration: ${t}`);return{integration:r,notice:n.notice}}async function L1(e,t=50,n={}){if(e.trim().toLowerCase()==="local-llm")return[];const r=WO(e,n.sessionId);return r?ZO(r,t):[]}async function lM(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return un("/api/hermes-channel/persist-turn",{sessionId:t,userMessage:e.userMessage,assistantReply:e.assistantReply??"",correlationId:e.correlationId,attachmentRefs:e.attachments,persistenceState:"failed",failureReason:e.failureReason,contextGraphId:e.contextGraphId,profile:e.profile,metadata:{source:"node-ui-failed-turn"}})}async function cM(e,t){if(e.trim().toLowerCase()==="hermes")return lM(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function uM(e,t,n={}){const r=e.trim().toLowerCase(),i=af[r];if(i!=null&&i.streamChat){const{sessionId:o,liveSession:c,profile:d,...p}=n,h=(g,m)=>{var v;return{...p,...(v=i.resolveChatContext)==null?void 0:v.call(i,{integrationId:r,sessionId:g,liveSession:m,profile:d})}};try{return await i.streamChat(t,h(o,c))}catch(g){if(r==="prime-agent"&&c&&g instanceof Rd&&g.code==="PRIME_AGENT_NO_SESSION")return i.streamChat(t,h());throw g}}throw new Error(`${e} local chat is not available yet.`)}const dM=()=>yt("/api/economics"),pv=()=>yt("/api/wallets/balances"),_Q=()=>un("/api/shutdown",{}),fM=(e,t)=>un("/api/subscribe",{contextGraphId:e,syncMode:(t==null?void 0:t.syncMode)??"on-demand"}),pM=()=>yt("/api/notifications"),Hj=e=>un("/api/notifications/read",e?{ids:e}:{}),hM=e=>Ej(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,Dj),mM={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},gM={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},vM={agents:[{name:"my-dkg-node",peerId:"QmYourNode123",connectionStatus:"self"},{name:"research-agent",peerId:"QmResearch456",connectionStatus:"connected",lastSeen:Date.now()},{name:"data-curator",peerId:"QmCurator789",connectionStatus:"connected",lastSeen:Date.now()-6e4},{name:"pharma-bot",peerId:"QmPharma012",connectionStatus:"discovered",lastSeen:Date.now()-3e5}]},yM={contextGraphs:[{id:"cg:pharma-drug-interactions",name:"Pharma Drug Interactions",description:"Drug interaction knowledge graph for clinical decision support",assetCount:227,agentCount:3,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:climate-science",name:"Climate Science",description:"Climate research data and projections",assetCount:45,agentCount:2,callerInvolved:!0,curator:"did:dkg:agent:0x1111111111111111111111111111111111111111"},{id:"cg:supply-chain-eu",name:"EU Supply Chain",description:"European supply chain provenance tracking",assetCount:89,agentCount:1,callerInvolved:!0,curator:"did:dkg:agent:0x5555555555555555555555555555555555555555"}]},bM={"cg:pharma-drug-interactions":{contextGraphId:"cg:pharma-drug-interactions",allowedAgents:["0x2222222222222222222222222222222222222222","0x3333333333333333333333333333333333333333"]},"cg:climate-science":{contextGraphId:"cg:climate-science",allowedAgents:["0x4444444444444444444444444444444444444444"]},"cg:supply-chain-eu":{contextGraphId:"cg:supply-chain-eu",allowedAgents:[]}},xM={operations:[{id:"op-1",name:"publish",status:"completed",startedAt:Date.now()-12e4},{id:"op-2",name:"query",status:"completed",startedAt:Date.now()-3e5},{id:"op-3",name:"publish",status:"completed",startedAt:Date.now()-6e5},{id:"op-4",name:"chat",status:"completed",startedAt:Date.now()-9e5},{id:"op-5",name:"sync",status:"failed",startedAt:Date.now()-18e5},{id:"op-6",name:"publish",status:"completed",startedAt:Date.now()-36e5}],total:6},wM={periods:[{label:"24h",publishCount:3,successCount:3,totalGasEth:7e-4,totalTrac:9.1,avgGasEth:23e-5,avgTrac:3.03},{label:"7d",publishCount:14,successCount:12,totalGasEth:.0034,totalTrac:42.5,avgGasEth:24e-5,avgTrac:3.04},{label:"30d",publishCount:47,successCount:43,totalGasEth:.012,totalTrac:156.8,avgGasEth:26e-5,avgTrac:3.34}]},kM={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},SM={wallets:["0xA1b2C3d4E5f60718293a4B5c6D7e8F9012345678","0xB2c3D4e5F60718293a4B5c6D7e8F90123456789a","0xC3d4E5f60718293a4B5c6D7e8F90123456789aB1"],balances:[{address:"0xA1b2C3d4E5f60718293a4B5c6D7e8F9012345678",eth:"0.842",trac:"1250.50",symbol:"TRAC"},{address:"0xB2c3D4e5F60718293a4B5c6D7e8F90123456789a",eth:"0.310",trac:"480.00",symbol:"TRAC"},{address:"0xC3d4E5f60718293a4B5c6D7e8F90123456789aB1",eth:"0.005",trac:"0.00",symbol:"TRAC"}],chainId:"8453",rpcUrl:"https://mock.rpc",symbol:"TRAC"},jM={notifications:[{type:"join_request",id:101,ts:Date.now()-12e4,read:0,contextGraphId:"cg:pharma-drug-interactions",meta:{contextGraphName:"Pharma Drug Interactions",agentAddress:"0xab12cd34ef56ab78cd90ab12cd34ef56ab78cd90",agentName:"research-agent"}},{type:"assertion_activity",id:"activity:cg:pharma-drug-interactions:promoted:29812",ts:Date.now()-3e5,read:0,contextGraphId:"cg:pharma-drug-interactions",meta:{contextGraphName:"Pharma Drug Interactions",kind:"promoted",count:3,actorAgentDid:"did:dkg:agent:0xdana00000000000000000000000000000000dana",actorAgentName:"Dana",soleAuthor:!0}},{type:"join_approved",id:102,ts:Date.now()-9e5,read:1,contextGraphId:"cg:climate-arctic",meta:{contextGraphName:"Arctic Climate",agentAddress:"0x0000000000000000000000000000000000000001"}}],badgeCount:2},CM={lines:["[2026-04-11 10:30:01] INFO Node started on port 8900","[2026-04-11 10:30:02] INFO Connected to DKG mainnet","[2026-04-11 10:30:03] INFO Discovered 12 peers","[2026-04-11 10:30:05] INFO Syncing context graph cg:pharma-drug-interactions","[2026-04-11 10:30:08] INFO Sync complete: 227 assets, 3 agents","[2026-04-11 10:30:15] INFO Agent research-agent connected via libp2p","[2026-04-11 10:31:00] INFO Publish operation started: warfarin-aspirin-001","[2026-04-11 10:31:12] INFO Triple store updated: +34 triples","[2026-04-11 10:31:15] INFO Publish complete: warfarin-aspirin-001 → Verifiable Memory","[2026-04-11 10:32:00] DEBUG SPARQL query executed in 23ms (42 results)","[2026-04-11 10:33:00] INFO Gossip: received 3 proposals from data-curator","[2026-04-11 10:34:00] INFO SWM cleanup: 0 expired triples removed","[2026-04-11 10:35:00] INFO Heartbeat: 12 peers, 1842 KAs, memory 245MB"],totalSize:13},NM={sessions:[{session:"sess-abc123",messages:[{author:"user",text:"What drug interactions should I know about warfarin?",ts:"2026-04-11T10:00:00Z"},{author:"assistant",text:"Warfarin has significant interactions with aspirin, NSAIDs, and several antibiotics. The most critical ones involve...",ts:"2026-04-11T10:00:05Z"}]},{session:"sess-def456",messages:[{author:"user",text:"Summarize the latest climate data for Arctic ice",ts:"2026-04-10T14:00:00Z"},{author:"assistant",text:"Based on the latest projections in the verifiable memory...",ts:"2026-04-10T14:00:03Z"}]}]},EM={"cg:pharma-drug-interactions":{contextGraphId:"cg:pharma-drug-interactions",subGraphs:[{name:"interactions",uri:"did:dkg:context-graph:cg:pharma-drug-interactions/interactions",description:"Pairwise drug interaction records",createdBy:"did:dkg:agent:0x1111111111111111111111111111111111111111",createdAt:"2026-04-02T09:15:00Z",entityCount:148,tripleCount:1721},{name:"contraindications",uri:"did:dkg:context-graph:cg:pharma-drug-interactions/contraindications",createdBy:"did:dkg:agent:0x2222222222222222222222222222222222222222",createdAt:"2026-04-05T16:40:00Z",entityCount:79,tripleCount:604}]},"cg:climate-science":{contextGraphId:"cg:climate-science",subGraphs:[{name:"arctic-ice",uri:"did:dkg:context-graph:cg:climate-science/arctic-ice",description:"Sea-ice extent projections",createdBy:"did:dkg:agent:0x3333333333333333333333333333333333333333",createdAt:"2026-04-11T08:05:00Z",entityCount:32,tripleCount:410}]}};function fr(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const pr={fetchStatus:()=>fr(mM),fetchMetrics:()=>fr(gM),fetchAgents:()=>fr(vM),fetchContextGraphs:()=>fr(yM),fetchOperationsWithPhases:()=>fr(xM),fetchEconomics:()=>fr(wM),fetchWalletsBalances:()=>fr(SM),fetchCurrentAgent:()=>fr(kM),listParticipants:e=>fr(bM[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>fr(EM[e]??{contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>fr(jM),fetchNodeLog:()=>fr(CM),fetchMemorySessions:()=>fr(NM)};let za=null,Tl=null;const AM=5e3,I1=2,TM=250,rg=new Set;function RM(){return za===!0}function _M(e){return rg.add(e),e(za===!0),()=>{rg.delete(e)}}function OM(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}function MM(e){return new Promise(t=>setTimeout(t,e))}async function LM(){for(let e=1;e<=I1;e+=1){try{const t=await fetch("/api/status",{cache:"no-store",headers:OM(),signal:AbortSignal.timeout(AM)});if(t.ok||t.status===401)return!1}catch{}e<I1&&await MM(TM)}return!0}async function IM(){if(za!==null)return za;if(Tl)return Tl;Tl=(async()=>(za=await LM(),typeof window<"u"&&(window.__DKG_USING_MOCKS__=za,za&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),rg.forEach(e=>e(za)),za))();try{return await Tl}finally{Tl=null}}async function hr(e,t){return await IM()?t():e()}const kn={fetchStatus:()=>hr(av,pr.fetchStatus),fetchMetrics:()=>hr(hO,pr.fetchMetrics),fetchAgents:()=>hr(iv,pr.fetchAgents),fetchContextGraphs:()=>hr(rf,pr.fetchContextGraphs),fetchOperationsWithPhases:e=>hr(()=>mO(e),pr.fetchOperationsWithPhases),fetchEconomics:()=>hr(dM,pr.fetchEconomics),fetchWalletsBalances:()=>hr(pv,pr.fetchWalletsBalances),fetchCurrentAgent:()=>hr(yc,pr.fetchCurrentAgent),listParticipants:e=>hr(()=>$j(e),()=>pr.listParticipants(e)),fetchSubGraphs:e=>hr(()=>hM(e),()=>pr.fetchSubGraphs(e)),fetchNotificationsFeed:()=>hr(pM,pr.fetchNotificationsFeed),fetchNodeLog:e=>hr(()=>gO(e),pr.fetchNodeLog),fetchMemorySessions:e=>hr(()=>LO(e),pr.fetchMemorySessions),markNotificationsRead:Hj,executeQuery:gr},DM=6e4;let Ti={data:null,loading:!0,error:null},sa=null,Zl=null,Hl=0,Ai="";const Md=new Set;function as(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function hd(e){Ai=e,Ti={data:null,loading:!0,error:null}}function Wh(){const e=as();return e!==Ai&&hd(e),Ti}function md(){for(const e of Md)e()}function Zh(e){Ti=e,md()}function Ld(){const e=Hl,t=as();if((sa==null?void 0:sa.authKey)===t)return sa.promise;t!==Ai?(hd(t),md()):Zh({...Ti,loading:!0,error:null});const n=kn.fetchCurrentAgent().then(r=>{if(e===Hl){if(t!==as()){const i=as(),o=Ai!==i||Ti.loading;Ai!==i&&(hd(i),md()),o&&Ld();return}Zh({data:r,loading:!1,error:null})}}).catch(r=>{if(e===Hl){if(t!==as()){const i=as(),o=Ai!==i||Ti.loading;Ai!==i&&(hd(i),md()),o&&Ld();return}Zh({data:Ti.data,loading:!1,error:r instanceof Error?r.message:"Failed to load current agent"})}}).finally(()=>{e===Hl&&(sa==null?void 0:sa.promise)===n&&(sa=null)});return sa={authKey:t,promise:n},n}function zM(){Ld(),!Zl&&(Zl=setInterval(()=>{Ld()},DM))}function $M(){Md.size>0||!Zl||(clearInterval(Zl),Zl=null,Hl+=1,sa=null,Ti={data:null,loading:!0,error:null},Ai=as())}function of(){const[e,t]=w.useState(Wh);return w.useEffect(()=>{const n=()=>t(Wh());return Md.add(n),t(Wh()),zM(),()=>{Md.delete(n),$M()}},[]),e}const Mr=hs(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),po=new Set;let wn=null,gd=null;const PM=350;function D1(e){return e==="wm"||e==="swm"||e==="vm"}function UM(e){const t=e.layers;return Array.isArray(t)?t.filter(D1):D1(e.layer)?[e.layer]:[]}function BM(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const r=UM(e);return r.length===0?!0:n.some(i=>r.includes(i))}function Gj(){if(wn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";wn=new EventSource(t);const n=r=>i=>{let o={};try{o=JSON.parse(i.data)}catch{}const c={type:r,data:o};for(const d of po)try{d(c)}catch{}};wn.addEventListener("join_request",n("join_request")),wn.addEventListener("join_approved",n("join_approved")),wn.addEventListener("join_rejected",n("join_rejected")),wn.addEventListener("project_synced",n("project_synced")),wn.addEventListener("memory_graph_changed",n("memory_graph_changed")),wn.addEventListener("notification",n("notification")),wn.addEventListener("connected",n("connected")),wn.onerror=()=>{wn==null||wn.close(),wn=null,po.size>0&&(gd=setTimeout(Gj,3e3))}}function FM(){gd&&(clearTimeout(gd),gd=null),wn==null||wn.close(),wn=null}function qM(e){return po.add(e),po.size===1&&Gj(),()=>{po.delete(e),po.size===0&&FM()}}function ms(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>qM(n=>t.current(n)),[])}function _o(e,t,n={}){var p;const r=w.useRef(t),i=w.useRef(null);r.current=t;const o=n.debounceMs??PM,c=w.useMemo(()=>n.layers??[],[(p=n.layers)==null?void 0:p.join("|")]),d=w.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);ms(w.useCallback(h=>{h.type==="memory_graph_changed"&&BM(h.data,e,c)&&(d(),i.current=setTimeout(()=>{i.current=null,r.current(h.data)},o))},[d,e,o,c])),w.useEffect(()=>d,[d])}function bc(e,t,n={}){const r=w.useRef(e);r.current=e;const i=w.useRef(n);i.current=n,w.useEffect(()=>{if(t<=0)return;let o=null,c=!1;const d=()=>{o||c||(o=setInterval(()=>r.current(),t))},p=()=>{o&&(clearInterval(o),o=null)},h=()=>{if(document.hidden){p();return}r.current(),d()};return i.current.runImmediately!==!1&&!document.hidden&&r.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{c=!0,document.removeEventListener("visibilitychange",h),p()}},[t])}const HM="No pending join request found";function GM(e){const t=[];for(const n of e)n.type==="join_request"&&t.push({id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,agentAddress:n.meta.agentAddress,agentName:n.meta.agentName,ts:n.ts,read:n.read===1});return t.sort((n,r)=>r.ts-n.ts),t}function VM(e){const t=[];for(const n of e)n.type==="assertion_activity"?t.push({kind:"digest",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,event:n.meta.kind,count:n.meta.count,...n.meta.soleAuthor&&n.meta.actorAgentDid?{actorAgentDid:n.meta.actorAgentDid,actorAgentName:n.meta.actorAgentName}:{},...n.meta.bySelf?{bySelf:!0}:{},ts:n.ts,read:n.read===1}):n.type==="join_approved"||n.type==="join_rejected"?t.push({kind:n.type,id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,ts:n.ts,read:n.read===1}):n.type==="pca_cost_covered"&&t.push({kind:"pca_cost_covered",id:n.id,cgId:n.contextGraphId,contextGraphName:n.meta.contextGraphName,covered:n.meta,publisherAddress:n.meta.publisherAddress,ts:n.ts,read:n.read===1});return t.sort((n,r)=>r.ts-n.ts),t}function z1(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function $1(e){const t=e instanceof Error?e.message:String(e);if(t.includes(HM))return{ok:!0,alreadyHandled:!0};const n=/context graph creator|manage (invitations|join requests)|curator/i.test(t);return{ok:!1,error:t,roleError:n}}function WM(){const[e,t]=w.useState(null),[n,r]=w.useState("loading"),[i,o]=w.useState(!1),c=w.useRef(!1),d=w.useCallback(()=>{kn.fetchNotificationsFeed().then(A=>{c.current=!0,t(A),o(!1),r(A.scopeUnknown?"identity-pending":"ready")}).catch(()=>{c.current?o(!0):r("error")})},[]);bc(d,6e4);const p=w.useRef(null),h=w.useCallback(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,d()},400)},[d]);w.useEffect(()=>()=>{p.current&&clearTimeout(p.current)},[]),ms(w.useCallback(A=>{A.type==="notification"&&h()},[h]));const g=w.useMemo(()=>GM((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>VM((e==null?void 0:e.notifications)??[]),[e]),v=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>z1((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(A=>{A.length!==0&&(t(O=>{if(!O)return O;const M=new Set(A.map(String));return{...O,notifications:O.notifications.map(T=>M.has(String(T.id))?{...T,read:1}:T)}}),Hj(A).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(z1((e==null?void 0:e.notifications)??[]))},[e,k]),C=w.useCallback(async(A,O)=>{try{return await sv(A,O),d(),{ok:!0}}catch(M){const T=$1(M);return T.ok&&T.alreadyHandled&&d(),T}},[d]),S=w.useCallback(async(A,O)=>{try{return await ov(A,O),d(),{ok:!0}}catch(M){const T=$1(M);return T.ok&&T.alreadyHandled&&d(),T}},[d]),N=w.useCallback(()=>{o(!1),r(c.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:v,hasInformationalUnread:b,status:n,refreshError:i,partialActivityError:!1,approve:C,deny:S,markSeen:k,markAllInformationalSeen:j,retry:N}}const ZM="dkg-pca",QM=150;function KM(e){return[String(e.chainId).toLowerCase(),e.nft.toLowerCase(),e.token.toLowerCase()].join(":")}function Ni(e){return e?`${ZM}:${e}`:null}const Qh={trackedIds:[],createPending:null,topUpPending:{}};function Ql(e){return typeof e=="string"&&/^\d+$/.test(e)}function YM(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e)Ql(r)&&!t.has(r)&&(t.add(r),n.push(r));return n}function XM(e){if(e==null||typeof e!="object")return null;const t=e;return typeof t.ownerEoa!="string"||t.ownerEoa.length===0||typeof t.submittedAt!="number"||!Number.isFinite(t.submittedAt)?null:{ownerEoa:t.ownerEoa,submittedAt:t.submittedAt,...typeof t.txHash=="string"&&t.txHash.length>0?{txHash:t.txHash}:{}}}function JM(e){if(e==null||typeof e!="object")return{};const t={};for(const[n,r]of Object.entries(e)){if(!Ql(n)||r==null||typeof r!="object")continue;const i=r;i.accountId===n&&(typeof i.ownerEoa!="string"||i.ownerEoa.length===0||typeof i.txHash!="string"||i.txHash.length===0||typeof i.submittedAt!="number"||!Number.isFinite(i.submittedAt)||(t[n]={accountId:n,ownerEoa:i.ownerEoa,txHash:i.txHash,submittedAt:i.submittedAt,...typeof i.tokens=="string"?{tokens:i.tokens}:{},...typeof i.previousTopUpBufferTrac=="string"?{previousTopUpBufferTrac:i.previousTopUpBufferTrac}:{}}))}return t}function Vj(e){const t=Ni(e);if(!t)return{...Qh};try{const n=localStorage.getItem(t);if(!n)return{...Qh};const r=JSON.parse(n);return{trackedIds:YM(r.trackedIds),createPending:XM(r.createPending),topUpPending:JM(r.topUpPending)}}catch{return{...Qh}}}let la=null;function Fu(e,t){e&&(la&&clearTimeout(la),la=setTimeout(()=>{la=null;try{localStorage.setItem(e,JSON.stringify(t))}catch{}},QM))}function Kh(e,t){if(la&&(clearTimeout(la),la=null),!e)return!1;try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}function Ji(e){return{trackedIds:e.trackedIds,createPending:e.createPending,topUpPending:e.topUpPending}}const qu=Vj(null),oc=hs((e,t)=>({scopeKey:null,trackedIds:qu.trackedIds,createPending:qu.createPending,topUpPending:qu.topUpPending,createPendingPersisted:qu.createPending!=null,setScope:n=>{if(t().scopeKey===n)return;la&&(clearTimeout(la),la=null);const r=Vj(n);e({scopeKey:n,trackedIds:r.trackedIds,createPending:r.createPending,topUpPending:r.topUpPending,createPendingPersisted:r.createPending!=null})},trackAccount:n=>{Ql(n)&&(e(r=>r.trackedIds.includes(n)?r:{trackedIds:[...r.trackedIds,n]}),Fu(Ni(t().scopeKey),Ji(t())))},untrackAccount:n=>{e(r=>r.trackedIds.includes(n)?{trackedIds:r.trackedIds.filter(i=>i!==n)}:r),Fu(Ni(t().scopeKey),Ji(t()))},isTracked:n=>t().trackedIds.includes(n),setCreatePending:n=>{e({createPending:n});const r=Kh(Ni(t().scopeKey),Ji(t()));return e({createPendingPersisted:r}),r},clearCreatePending:()=>{e({createPending:null,createPendingPersisted:!1}),Fu(Ni(t().scopeKey),Ji(t()))},setTopUpPending:n=>{Ql(n.accountId)&&(e(r=>({topUpPending:{...r.topUpPending,[n.accountId]:n}})),Kh(Ni(t().scopeKey),Ji(t())))},clearTopUpPending:n=>{e(r=>{if(!r.topUpPending[n])return r;const i={...r.topUpPending};return delete i[n],{topUpPending:i}}),Fu(Ni(t().scopeKey),Ji(t()))},finishCreate:n=>{e(r=>({createPending:null,createPendingPersisted:!1,trackedIds:Ql(n)&&!r.trackedIds.includes(n)?[...r.trackedIds,n]:r.trackedIds})),Kh(Ni(t().scopeKey),Ji(t()))}}));function Yh(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function Wj(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n}=e;return typeof n=="number"&&n>0&&t>=n}function Zj(e,t){return Wj(e,t)||!!e.fullySwept}function hv(e){return Yh(e.topUpBuffer)?!0:e.remainingAllowance!==void 0?Yh(e.remainingAllowance):e.extendedRequested?null:Yh(e.baseEpochAllowance)}function e4(e){return hv(e)===!0}function t4(e){return e.remainingAllowance!==void 0&&hv(e)===!1}const Qj=90,Kj=10080*60;function n4(e,t=Math.floor(Date.now()/1e3)){const{expiresAtTimestamp:n,fullySwept:r,agentCount:i}=e,o=typeof n=="number"&&n>0;return Wj(e,t)?"expired":r?"swept":t4(e)?"insolvent":typeof i=="number"&&i>=Qj?"cap-near":o&&n-t<=Kj?"expiring":"healthy"}function r4(e,t){return!Zj(e,t)&&e4(e)}function a4(e){return(e==null?void 0:e.adapterSupported)===!1?null:(e==null?void 0:e.registered)??null}function ag(e,t){var c;const n=a4(e.probedKey);if(n===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:((c=e.probedKey)==null?void 0:c.adapterSupported)===!1};if(n===!1)return{outcome:"unregistered",registered:!1};const r=Zj(e,t),i=hv(e);if(i===null)return{outcome:"inconclusive",registered:null,adapterUnsupported:!1};const o=i;return!r&&o?{outcome:"covers",registered:!0}:{outcome:"uncovered",registered:!0,dead:r,hasBudget:o}}const P1=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();async function i4(e,t){const n={accountId:e,snapshot:null,error:null,notFound:!1,classification:"unknown",ownerIsPrimaryWallet:!1,health:null,walletProbes:[],approvedCount:0,walletCount:t.length,probesInconclusive:!1};let r;try{r=await Td(e,void 0,{extended:!0})}catch(h){return{...n,error:h,notFound:h instanceof Hn&&h.status===404}}const i=await Promise.all(t.map(h=>Td(e,h,{extended:!0}).then(g=>({wallet:h,registered:ag(g).registered})).catch(()=>({wallet:h,registered:null})))),o=i.filter(h=>h.registered===!0).length,c=i.some(h=>h.registered===null),p=t.some(h=>P1(h,r.owner))?"owned":o>0?"approved":"unknown";return{accountId:e,snapshot:r,error:null,notFound:!1,classification:p,ownerIsPrimaryWallet:P1(t[0],r.owner),health:n4(r),walletProbes:i,approvedCount:o,walletCount:t.length,probesInconclusive:c}}const ho=new Map;function U1(e){for(const t of e.subs)t()}async function Id(e){const t=++e.seq;if(e.ids.length===0){if(t!==e.seq)return;e.data={wallets:[],walletsError:!1,accounts:[]},e.error=null,e.loading=!1,U1(e);return}try{const n=await pv().catch(()=>null),r=(n==null?void 0:n.wallets)??[],i=!n||!!n.error,o=await Promise.all(e.ids.map(c=>i4(c,r)));if(t!==e.seq)return;e.data={wallets:r,walletsError:i,accounts:o},e.error=null}catch(n){if(t!==e.seq)return;e.error=(n==null?void 0:n.message)??"Failed to resolve PCAs."}finally{t===e.seq&&(e.loading=!1,U1(e))}}function Xh(e){e.timer||e.intervalMs<=0||typeof document<"u"&&document.hidden||(e.timer=setInterval(()=>Id(e),e.intervalMs))}function Jh(e){e.timer&&(clearInterval(e.timer),e.timer=null)}function s4(e,t,n,r){let i=ho.get(e);const o=!i;if(i||(i={ids:t,data:null,loading:!0,error:null,subs:new Set,timer:null,intervalMs:n,onVisibility:null,seq:0},ho.set(e,i)),i.subs.add(r),o){const c=i,d=()=>{typeof document>"u"||(document.hidden?Jh(c):(Id(c),Xh(c)))};i.onVisibility=d,typeof document<"u"&&document.addEventListener("visibilitychange",d),Id(i),Xh(i)}else n<i.intervalMs&&(i.intervalMs=n,Jh(i),Xh(i));return()=>{const c=ho.get(e);c&&(c.subs.delete(r),c.subs.size===0&&(Jh(c),c.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",c.onVisibility),ho.delete(e)))}}const o4=[];function Yj(e=3e4,t=[]){var j,C,S;const n=oc(N=>N.trackedIds),r=t.join(","),i=w.useMemo(()=>[...n,...t.filter(N=>!n.includes(N))],[n.join(","),r]),o=i.join(","),[,c]=w.useReducer(N=>N+1,0);w.useEffect(()=>s4(o,i,e,c),[o,e]);const d=ho.get(o),p=((j=d==null?void 0:d.data)==null?void 0:j.accounts)??o4,h=d?d.loading:!0,g=(d==null?void 0:d.error)??null,{bestCoveringDiscountBps:m,covered:v}=w.useMemo(()=>{let N=null;for(const A of p){if(!A.snapshot||A.approvedCount<=0||!r4(A.snapshot))continue;const O=A.snapshot.discountBps;typeof O=="number"&&(N==null||O>N)&&(N=O)}return{bestCoveringDiscountBps:N,covered:N!=null}},[p]),b=((C=d==null?void 0:d.data)==null?void 0:C.wallets)??[],k=((S=d==null?void 0:d.data)==null?void 0:S.walletsError)??!1;return{accounts:p,wallets:b,walletsError:k,walletsInconclusive:k&&b.length===0,loading:h,error:g,refresh:()=>{const N=ho.get(o);N&&Id(N)},bestCoveringDiscountBps:m,covered:v}}let em=null;function Xj(){const e=oc(n=>n.scopeKey),t=oc(n=>n.setScope);w.useEffect(()=>{e||em||(em=cO().then(n=>{t(KM(n))}).catch(()=>{}).finally(()=>{em=null}))},[e,t])}function l4(){Xj();const{accounts:e}=Yj(3e4);return w.useMemo(()=>{const t=[],n=Math.floor(Date.now()/1e3);for(const r of e){const i=r.snapshot;if(!i)continue;const o=r.accountId,c=typeof i.expiresAtTimestamp=="number"&&i.expiresAtTimestamp>0,d=c&&n>=i.expiresAtTimestamp;d?t.push({id:`pca-${o}-expired`,accountId:o,kind:"expired",severity:"danger",title:`PCA #${o} has expired`,message:"Publishes no longer get its discount. Create a replacement account to keep saving."}):c&&i.expiresAtTimestamp-n<=Kj&&t.push({id:`pca-${o}-expiring`,accountId:o,kind:"expiring",severity:"warn",title:`PCA #${o} is expiring soon`,message:"Top-up can’t extend the lock period — plan a replacement before it expires."}),i.fullySwept&&t.push({id:`pca-${o}-swept`,accountId:o,kind:"swept",severity:"warn",title:`PCA #${o} is fully swept`,message:"Its epoch budgets have been swept to the staker reward pool."}),typeof i.agentCount=="number"&&i.agentCount>=Qj&&t.push({id:`pca-${o}-cap`,accountId:o,kind:"cap-near",severity:"warn",title:`PCA #${o} is near the 100-wallet cap`,message:"Deregister unused wallets to make room before approving more."}),r.classification==="owned"&&r.approvedCount===0&&!r.probesInconclusive&&!d&&t.push({id:`pca-${o}-fallthrough`,accountId:o,kind:"fallthrough",severity:"warn",title:`PCA #${o} discounts nothing yet`,message:"Publishes from this node pay the direct cost until you approve this node’s operational wallets."})}return t},[e])}function lc(e,t=new Date){if(e==null||e==="")return"";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});const i=new Date(t);if(i.setDate(t.getDate()-1),n.toDateString()===i.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`;const o=t.getTime()-n.getTime();return o>=0&&o<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`:n.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}/**
|
|
91
|
+
* @license lucide-react v1.14.0 - ISC
|
|
92
|
+
*
|
|
93
|
+
* This source code is licensed under the ISC license.
|
|
94
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
+
*/const Jj=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
96
|
+
* @license lucide-react v1.14.0 - ISC
|
|
97
|
+
*
|
|
98
|
+
* This source code is licensed under the ISC license.
|
|
99
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
+
*/const c4=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
101
|
+
* @license lucide-react v1.14.0 - ISC
|
|
102
|
+
*
|
|
103
|
+
* This source code is licensed under the ISC license.
|
|
104
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
+
*/const u4=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
106
|
+
* @license lucide-react v1.14.0 - ISC
|
|
107
|
+
*
|
|
108
|
+
* This source code is licensed under the ISC license.
|
|
109
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
+
*/const B1=e=>{const t=u4(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
111
|
+
* @license lucide-react v1.14.0 - ISC
|
|
112
|
+
*
|
|
113
|
+
* This source code is licensed under the ISC license.
|
|
114
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
+
*/var tm={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
116
|
+
* @license lucide-react v1.14.0 - ISC
|
|
117
|
+
*
|
|
118
|
+
* This source code is licensed under the ISC license.
|
|
119
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
+
*/const d4=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},f4=w.createContext({}),p4=()=>w.useContext(f4),h4=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:o,iconNode:c,...d},p)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:v="currentColor",className:b=""}=p4()??{},k=r??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:p,...tm,width:t??h??tm.width,height:t??h??tm.height,stroke:e??v,strokeWidth:k,className:Jj("lucide",b,i),...!o&&!d4(d)&&{"aria-hidden":"true"},...d},[...c.map(([j,C])=>w.createElement(j,C)),...Array.isArray(o)?o:[o]])});/**
|
|
121
|
+
* @license lucide-react v1.14.0 - ISC
|
|
122
|
+
*
|
|
123
|
+
* This source code is licensed under the ISC license.
|
|
124
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
+
*/const dn=(e,t)=>{const n=w.forwardRef(({className:r,...i},o)=>w.createElement(h4,{ref:o,iconNode:t,className:Jj(`lucide-${c4(B1(e))}`,`lucide-${e}`,r),...i}));return n.displayName=B1(e),n};/**
|
|
126
|
+
* @license lucide-react v1.14.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const m4=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],g4=dn("arrow-down",m4);/**
|
|
131
|
+
* @license lucide-react v1.14.0 - ISC
|
|
132
|
+
*
|
|
133
|
+
* This source code is licensed under the ISC license.
|
|
134
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
+
*/const v4=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],y4=dn("arrow-up",v4);/**
|
|
136
|
+
* @license lucide-react v1.14.0 - ISC
|
|
137
|
+
*
|
|
138
|
+
* This source code is licensed under the ISC license.
|
|
139
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
+
*/const b4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],x4=dn("ban",b4);/**
|
|
141
|
+
* @license lucide-react v1.14.0 - ISC
|
|
142
|
+
*
|
|
143
|
+
* This source code is licensed under the ISC license.
|
|
144
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
+
*/const w4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],k4=dn("check",w4);/**
|
|
146
|
+
* @license lucide-react v1.14.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const S4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],j4=dn("chevron-down",S4);/**
|
|
151
|
+
* @license lucide-react v1.14.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const C4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ig=dn("chevron-right",C4);/**
|
|
156
|
+
* @license lucide-react v1.14.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const N4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],E4=dn("copy",N4);/**
|
|
161
|
+
* @license lucide-react v1.14.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const A4=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],T4=dn("ellipsis",A4);/**
|
|
166
|
+
* @license lucide-react v1.14.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const R4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],_4=dn("folder",R4);/**
|
|
171
|
+
* @license lucide-react v1.14.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const O4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],M4=dn("globe",O4);/**
|
|
176
|
+
* @license lucide-react v1.14.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const L4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],I4=dn("loader-circle",L4);/**
|
|
181
|
+
* @license lucide-react v1.14.0 - ISC
|
|
182
|
+
*
|
|
183
|
+
* This source code is licensed under the ISC license.
|
|
184
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
+
*/const D4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],z4=dn("lock",D4);/**
|
|
186
|
+
* @license lucide-react v1.14.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/const $4=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],P4=dn("paperclip",$4);/**
|
|
191
|
+
* @license lucide-react v1.14.0 - ISC
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the ISC license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/const U4=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],F1=dn("share-2",U4);/**
|
|
196
|
+
* @license lucide-react v1.14.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/const B4=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],F4=dn("square",B4);/**
|
|
201
|
+
* @license lucide-react v1.14.0 - ISC
|
|
202
|
+
*
|
|
203
|
+
* This source code is licensed under the ISC license.
|
|
204
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
+
*/const q4=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],H4=dn("trending-up",q4);/**
|
|
206
|
+
* @license lucide-react v1.14.0 - ISC
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the ISC license.
|
|
209
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
+
*/const G4=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],V4=dn("upload",G4);/**
|
|
211
|
+
* @license lucide-react v1.14.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/const W4=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],Z4=dn("users-round",W4);/**
|
|
216
|
+
* @license lucide-react v1.14.0 - ISC
|
|
217
|
+
*
|
|
218
|
+
* This source code is licensed under the ISC license.
|
|
219
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
+
*/const Q4=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],K4=dn("wallet",Q4);/**
|
|
221
|
+
* @license lucide-react v1.14.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/const Y4=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X4=dn("x",Y4),nm={1:"ETH",8453:"ETH",84532:"ETH",11155111:"ETH",31337:"ETH",100:"xDAI",10200:"xDAI",2043:"NEURO",20430:"NEURO"};function eC(e){var r;if(e==null)return"ETH";const t=String(e);if(nm[t])return nm[t];const n=(r=t.match(/(\d+)\s*$/))==null?void 0:r[1];return n&&nm[n]||"ETH"}function OQ(e,t=6,n=4){const r=(e??"").trim();return r.length<=t+n+1?r:`${r.slice(0,t)}…${r.slice(-n)}`}const rm="—";function J4(e,t=2){if(e==null)return rm;let n;if(typeof e=="number")n=e;else{const o=String(e).trim();if(!/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(o))return rm;n=Number(o)}if(!Number.isFinite(n))return rm;const r=Math.abs(n),i=r>0&&r<10?t:0;return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:i}).format(n)}function eL(e,t=2){if(e==null||e==="")return"—";let n;try{n=BigInt(e)}catch{return"—"}const r=n<0n;r&&(n=-n);const i=10n**18n,o=n/i,c=(n%i+i).toString().slice(1).slice(0,t);return J4(`${r?"-":""}${o}.${c||"0"}`,t)}const tL=new Set(["84532","11155111","31337","10200","20430"]);function MQ(e){if(e==null)return!1;const t=String(e),n=t.includes(":")?t.split(":").pop():t;return tL.has(n)}function LQ(e,t=Math.floor(Date.now()/1e3)){if(!e||e<=0)return"Expiry unknown";const n=e-t,r=Math.round(Math.abs(n)/86400);return n<=0?r===0?"Expired today":`Expired ~${r} day${r===1?"":"s"} ago`:`Expires in ~${r} day${r===1?"":"s"}`}function tC(e){if(!e)return null;let t,n;try{t=BigInt(e.baseCost),n=BigInt(e.discountedCost)}catch{return null}return t<=0n||n<0n||n>=t?null:Number(((t-n)*10000n+t/2n)/t)}function nC({convictionCostCovered:e,className:t=""}){const n=tC(e);if(e==null||n==null)return null;const r=(n/100).toFixed(n%100===0?0:1),i=e.accountId?`via PCA #${e.accountId}`:"across multiple PCAs";return l.jsxs("span",{className:["badge","badge-success","v10-pca-discount-applied",t].filter(Boolean).join(" "),"data-testid":"pca-discount-badge",role:"status",children:[l.jsx("span",{"aria-hidden":"true",children:"◉ "}),"Discount applied — −",r,"% ",i]})}function nL(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return null;const t=e/100;return`${t.toFixed(t%1===0?0:1)}%`}const rL={eligible:{glyph:"◉",toneClass:"v10-pca-verdict-green"},fallthrough:{glyph:"⚠",toneClass:"v10-pca-verdict-amber"},"fallthrough-no-funds":{glyph:"⚠",toneClass:"v10-pca-verdict-danger"},unknown:{glyph:"◌",toneClass:"v10-pca-verdict-neutral"}};function aL({verdict:e,accountId:t,discountBps:n,accountUntracked:r=!1,reasons:i=[],ownerPublish:o=!1,variant:c="banner",children:d,className:p=""}){const h=rL[e],g=e==="fallthrough"||e==="fallthrough-no-funds",m=g?"alert":"status",v=g?"assertive":"polite",b=t?`PCA #${t}`:"a PCA",k=r?" (not tracked by this node)":"",j=nL(n),C=" unless this graph’s registration escrow already covers it",S=i.length>0?` Reason: ${i.join("; ")}.`:"";if(c==="chip"){const A=e==="eligible"?`Funded by ${b}${k}${j?` (${j} discount)`:""}`:e==="fallthrough"?"⚠ No PCA discount":e==="fallthrough-no-funds"?"⚠ Publish will fail":"PCA status unknown";return l.jsx("span",{className:["v10-pca-verdict-chip",h.toneClass,p].filter(Boolean).join(" "),"data-testid":"pca-eligibility-chip","data-verdict":e,children:l.jsx("span",{className:"v10-pca-verdict-chip-label",role:m,"aria-live":v,children:A})})}let N;return e==="eligible"?N=l.jsxs(l.Fragment,{children:["This publish will use ",b,k,j?` (${j} discount)`:"",".",o?`${C}.`:""]}):e==="fallthrough"?N=l.jsxs(l.Fragment,{children:["No PCA discount on this publish — it will attempt to pay the direct cost from the signing wallet’s TRAC",j?`, forfeiting ${b}’s ${j} discount`:"",o?C:"","; the publish fails if that TRAC is below the fee.",S]}):e==="fallthrough-no-funds"?N=l.jsxs(l.Fragment,{children:["This publish will FAIL — no signing wallet can cover it",j?`, forfeiting ${b}’s ${j} discount`:"",o?C:"",".",S]}):N=l.jsx(l.Fragment,{children:"Couldn’t confirm PCA eligibility — you may pay the direct cost."}),l.jsxs("div",{className:["v10-pca-verdict-banner",h.toneClass,p].filter(Boolean).join(" "),"data-testid":"pca-eligibility-verdict","data-verdict":e,role:m,"aria-live":v,children:[l.jsxs("p",{className:"v10-pca-verdict-message",children:[l.jsx("span",{className:"v10-pca-verdict-glyph","aria-hidden":"true",children:h.glyph}),N]}),d&&l.jsx("div",{className:"v10-pca-verdict-actions",children:d})]})}const Dd=new Map,sg=new Set;let q1=!1;function iL(){const e=[...Dd.values()];for(const t of sg)t(e)}function sL(e){const t=e.detail;Dd.has(t.info.uuid)||(Dd.set(t.info.uuid,t),iL())}function oL(){q1||typeof window>"u"||(q1=!0,window.addEventListener("eip6963:announceProvider",sL),window.dispatchEvent(new Event("eip6963:requestProvider")))}function lL(e){return sg.add(e),e([...Dd.values()]),()=>{sg.delete(e)}}function og(e){var r;if(typeof e=="number")return e;const t=(r=String(e).match(/(\d+)\s*$/))==null?void 0:r[1],n=t?Number(t):NaN;if(!Number.isFinite(n))throw new Error(`Unrecognized chainId: ${e}`);return n}function cL(e){return`0x${og(e).toString(16)}`}const mv="dkg-node-ui:wallet-provider-rdns";function uL(e){var t;try{(t=globalThis.localStorage)==null||t.setItem(mv,e)}catch{}}function dL(){var e;try{return((e=globalThis.localStorage)==null?void 0:e.getItem(mv))??null}catch{return null}}function H1(){var e;try{(e=globalThis.localStorage)==null||e.removeItem(mv)}catch{}}const rC=new Set(["app.phantom"]),fL=300;function pL(e){return e.filter(t=>!rC.has(t.info.rdns))}function hL(e,t){if(!t)return null;const n=e.filter(r=>r.info.rdns===t);return n.length===1?n[0]:null}function IQ(e){return e.address!=null&&e.expectedChainId!=null&&e.chainId!==e.expectedChainId}function mL(e){return(e.walletRpcUrls??[]).filter(t=>/^https?:\/\//i.test(t))}let Hu=!1,Gu=null,G1=!1;const DQ=hs((e,t)=>{function n(i){i.on&&(i.on("accountsChanged",(...o)=>{const c=o[0],d=(c==null?void 0:c[0])??null;if(d===null){t().disconnect();return}e({address:d})}),i.on("chainChanged",(...o)=>{e({chainId:parseInt(o[0],16)})}),i.on("disconnect",()=>t().disconnect()))}async function r(i){const o=i.provider;try{const c=await o.request({method:"eth_accounts"});if(c.length===0){H1();return}const d=await o.request({method:"eth_chainId"});n(o),e({provider:o,providerInfo:i.info,address:c[0],chainId:parseInt(d,16)})}catch(c){console.warn("[wallet] silent reconnect failed",c)}}return{discovered:[],unsupported:[],provider:null,providerInfo:null,address:null,chainId:null,expectedChainId:null,bootstrap:null,setBootstrap(i){e({bootstrap:i,expectedChainId:og(i.chainId)})},initWallet(){if(typeof window>"u"||(oL(),G1))return;G1=!0;const i=dL();lL(o=>{e({discovered:pL(o),unsupported:o.filter(c=>rC.has(c.info.rdns))}),!(!i||Hu)&&(Gu&&clearTimeout(Gu),Gu=setTimeout(()=>{if(Gu=null,Hu)return;const c=hL(t().discovered,i);c&&(Hu=!0,r(c))},fL))})},async connect(i){const o=i.provider,c=await o.request({method:"eth_requestAccounts"}),d=await o.request({method:"eth_chainId"});n(o),e({provider:o,providerInfo:i.info,address:c[0]??null,chainId:parseInt(d,16)}),uL(i.info.rdns),Hu=!1},disconnect(){e({provider:null,providerInfo:null,address:null,chainId:null}),H1()},async switchToExpectedChain(){const{provider:i,bootstrap:o}=t();if(!i)throw new Error("Wallet not connected.");if(!o)throw new Error("Chain not bootstrapped.");const c=cL(o.chainId);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:c}]})}catch(d){if((d==null?void 0:d.code)===4902){const p=eC(o.chainId),h=mL(o);if(h.length===0)throw new Error("Wallet does not know this chain and the node did not provide wallet-public RPC URLs. Add the network in your wallet, then try again.");await i.request({method:"wallet_addEthereumChain",params:[{chainId:c,chainName:`chain-${og(o.chainId)}`,nativeCurrency:{name:p,symbol:p,decimals:18},rpcUrls:h}]})}else throw d}}}});function gv(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function V1(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function gL({item:e,onApprove:t,onDeny:n,onOpen:r}){var g;const[i,o]=w.useState({kind:"idle"}),c=gv(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||V1(e.agentAddress),p=async m=>{o({kind:"working",action:m});const b=await(m==="approve"?t:n)(e.cgId,e.agentAddress);if(b.ok){const k=b.alreadyHandled?"Already handled":m==="approve"?`Approved — ${d} can now access ${c}`:`Request from ${d} declined`;o({kind:"done",label:k})}else{const k=b.roleError?`You're no longer the curator of ${c}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";o({kind:"error",action:m,message:k})}};if(i.kind==="done")return l.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[l.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),l.jsx("span",{className:"v10-notif-terminal-text",children:i.label})]});const h=i.kind==="working";return l.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[l.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),l.jsxs("div",{className:"v10-notif-row-body",children:[l.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),l.jsxs("div",{className:"v10-notif-row-detail",children:[l.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",l.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>r(e.cgId),title:`Open ${c}`,children:c})]}),l.jsxs("div",{className:"v10-notif-row-sub",children:[l.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:V1(e.agentAddress)}),l.jsx("span",{className:"v10-notif-dot",children:"·"}),l.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:lc(e.ts)})]}),i.kind==="error"&&l.jsxs("div",{className:"v10-notif-row-error",role:"status","aria-live":"polite",children:[i.message," ",l.jsx("button",{type:"button",className:"v10-notif-retry",onClick:()=>p(i.action),children:"Retry"})]}),l.jsx("span",{className:"v10-sr-only",role:"status","aria-live":"polite",children:h?i.action==="approve"?"Approving…":"Denying…":""})]}),l.jsx("div",{className:"v10-notif-row-actions",children:i.kind==="confirming-deny"?l.jsxs("span",{className:"v10-notif-deny-confirm",role:"group","aria-label":"Confirm deny",onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),o({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||o({kind:"idle"})},children:[l.jsx("span",{className:"v10-notif-deny-confirm-label",children:"Deny?"}),l.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-deny",onClick:()=>p("deny"),"aria-label":`Confirm deny join request from ${d} for ${c}`,children:"Yes"}),l.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>o({kind:"idle"}),autoFocus:!0,children:"Cancel"})]}):l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-approve",onClick:()=>p("approve"),disabled:h,"aria-label":`Approve join request from ${d} for ${c}`,children:h&&i.action==="approve"?"…":"Approve"}),l.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>o({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${c}`,children:h&&i.action==="deny"?"…":"Deny"})]})})]})}const vL={created:"+",promoted:"⇡",published:"◉"};function yL(e,t,n){const r=t,i=r===1?"assertion":"assertions";return e==="created"?n?`${n} added ${r} ${i}`:`${r} new ${i} added`:e==="promoted"?n?`${n} promoted ${r} ${i}`:`${r} ${i} promoted`:n?`${n} published ${r} ${i} to Verifiable Memory`:`${r} ${i} published to Verifiable Memory`}function bL({item:e,onOpen:t}){var d;const n=gv(e.contextGraphName,e.cgId),r=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,i=yL(e.event,e.count,r),o=lc(e.ts),c=`${i} in ${n}${o?`, ${o}`:""}. Open ${n} recent activity.`;return l.jsxs("button",{type:"button",className:`v10-notif-row v10-notif-row-activity v10-notif-activity-${e.event}${e.bySelf?" v10-notif-by-self":""}${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n} · recent activity`,"aria-label":c,children:[l.jsx("span",{className:`v10-notif-glyph v10-notif-glyph-${e.event}`,"aria-hidden":"true",children:vL[e.event]}),l.jsx("span",{className:"v10-notif-row-body","aria-hidden":"true",children:l.jsxs("span",{className:"v10-notif-row-detail",children:[i," in ",l.jsx("span",{className:"v10-notif-cg-name",children:n})]})}),l.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:o})]})}function xL({item:e,onOpen:t}){const n=gv(e.contextGraphName,e.cgId),r=e.kind==="join_approved",i=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:`v10-notif-glyph ${r?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:r?"✓":"✕"}),l.jsxs("span",{className:"v10-notif-row-body",children:[l.jsx("span",{className:"v10-notif-row-title",children:r?"Request approved":"Request declined"}),l.jsx("span",{className:"v10-notif-row-detail",children:r?l.jsxs(l.Fragment,{children:["You can now access ",l.jsx("span",{className:"v10-notif-cg-name",children:n})]}):l.jsxs(l.Fragment,{children:["Your request to join ",l.jsx("span",{className:"v10-notif-cg-name",children:n})," wasn’t approved"]})})]}),l.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:lc(e.ts)})]});if(r){const o=lc(e.ts);return l.jsx("button",{type:"button",className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-approved${e.read?"":" v10-notif-unread"}`,onClick:()=>t(e.cgId),title:`Open ${n}`,"aria-label":`Request approved: you can now access ${n}${o?`, ${o}`:""}. Open ${n}.`,children:i})}return l.jsx("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-rejected${e.read?"":" v10-notif-unread"}`,"aria-disabled":"true",children:i})}function wL({item:e}){var h;const t=tC(e.covered),n=t!=null?(t/100).toFixed(t%100===0?0:1):null;let r=null;try{const g=BigInt(e.covered.baseCost),m=BigInt(e.covered.discountedCost);g>0n&&m>=0n&&m<g&&(r=eL((g-m).toString()))}catch{r=null}const i=`PCA #${e.covered.accountId}`,o=(h=e.contextGraphName)!=null&&h.trim()?` in ${e.contextGraphName.trim()}`:"",c=n!=null?"Publishing discount applied":"Publishing fee covered",d=n!=null?`−${n}% via ${i}${r?` · saved ${r} TRAC`:""}${o}`:`via ${i}${o}`,p=lc(e.ts);return l.jsxs("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-pca-discount${e.read?"":" v10-notif-unread"}`,role:"status","aria-label":`${c}, ${d}${p?`, ${p}`:""}.`,children:[l.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-approved","aria-hidden":"true",children:"◉"}),l.jsxs("span",{className:"v10-notif-row-body","aria-hidden":"true",children:[l.jsx("span",{className:"v10-notif-row-title",children:c}),l.jsx("span",{className:"v10-notif-row-detail",children:d})]}),l.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:p})]})}function kL({feed:e,onOpenContextGraph:t,pcaAlerts:n=[],onOpenPca:r,id:i,paneRef:o}){const{joinRequests:c,activity:d,status:p,refreshError:h,partialActivityError:g,hasInformationalUnread:m,approve:v,deny:b,markSeen:k,markAllInformationalSeen:j}=e,C=(M,T)=>{k([T]),t(M)},S=c.length>0,N=d.length>0,A=n.length>0,O=!S&&!N&&!A;return l.jsxs("div",{className:"v10-notif-pane",role:"region","aria-label":"Notifications",id:i,ref:o,tabIndex:-1,children:[l.jsxs("div",{className:"v10-notif-pane-titlebar",children:[l.jsx("div",{className:"v10-notif-pane-title",children:"Notifications"}),m&&l.jsx("button",{type:"button",className:"v10-notif-pane-markread",onClick:j,title:"Mark informational notifications as read",children:"Mark all read"})]}),l.jsxs("div",{className:"v10-notif-pane-body",children:[A&&l.jsxs("section",{className:"v10-notif-section v10-notif-section-pca","aria-label":"Publisher Conviction",children:[l.jsxs("div",{className:"v10-notif-section-head",children:[l.jsx("span",{className:"v10-notif-section-label",children:"Publisher Conviction"}),l.jsx("span",{className:"v10-notif-section-count",children:n.length})]}),l.jsx("div",{className:"v10-notif-section-rows",children:n.map(M=>l.jsxs("div",{className:"v10-pca-alert-row","data-severity":M.severity,"data-testid":"pca-bell-alert",role:M.severity==="danger"?"alert":"status",children:[l.jsx("div",{className:"v10-pca-alert-title",children:M.title}),l.jsx("div",{className:"v10-pca-alert-msg",children:M.message}),r&&l.jsxs("button",{type:"button",className:"v10-pca-alert-action",onClick:()=>r(M.accountId),children:["Manage PCA #",M.accountId]})]},M.id))})]}),p==="identity-pending"?l.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):p==="loading"&&O?l.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):p==="error"&&O?l.jsxs("div",{className:"v10-notif-pane-error",role:"status","aria-live":"polite",children:["Couldn’t load notifications."," ",l.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}):O?l.jsxs("div",{className:"v10-notif-pane-empty",role:"status",children:[l.jsx("div",{className:"v10-notif-pane-empty-lead",children:"You’re all caught up."}),l.jsx("div",{className:"v10-notif-pane-empty-sub",children:"Join requests, approvals, and new activity in your context graphs will show up here."})]}):l.jsxs(l.Fragment,{children:[h&&l.jsxs("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:["Couldn’t refresh notifications."," ",l.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}),S&&l.jsxs("section",{className:"v10-notif-section v10-notif-section-action","aria-label":"Needs your action",children:[l.jsxs("div",{className:"v10-notif-section-head",children:[l.jsx("span",{className:"v10-notif-section-label",children:"Needs your action"}),l.jsx("span",{className:"v10-notif-section-count",children:c.length})]}),l.jsx("div",{className:"v10-notif-section-rows",children:c.map(M=>l.jsx(gL,{item:M,onApprove:v,onDeny:b,onOpen:t},M.id))})]}),l.jsxs("section",{className:"v10-notif-section v10-notif-section-activity","aria-label":"Activity",children:[l.jsx("div",{className:"v10-notif-section-head",children:l.jsx("span",{className:"v10-notif-section-label",children:"Activity"})}),g&&l.jsx("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:"Recent activity couldn’t load."}),N?l.jsx("div",{className:"v10-notif-section-rows",children:d.map(M=>M.kind==="digest"?l.jsx(bL,{item:M,onOpen:T=>C(T,M.id)},M.id):M.kind==="pca_cost_covered"?l.jsx(wL,{item:M},M.id):l.jsx(xL,{item:M,onOpen:T=>C(T,M.id)},M.id))}):!g&&l.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})]})]})}const SL=l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),l.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),W1="v10-notifications-pane";function jL(){const e=WM(),t=l4(),[n,r]=w.useState(!1),i=w.useRef(null),o=w.useRef(null),c=Mr(b=>b.setActiveProject),{openTab:d}=gn(),p=w.useRef(null),h=w.useCallback((b=!1)=>{var k;r(!1),b&&((k=o.current)==null||k.focus())},[]);w.useEffect(()=>{if(!n)return;const b=k=>{i.current&&!i.current.contains(k.target)&&h()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n,h]),w.useEffect(()=>{if(!n)return;const b=p.current;if(!b)return;const k=b.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),j=b.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),C=b.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(k??j??C??b).focus()},[n]);const g=w.useCallback(b=>{c(b),d({id:`project:${b}`,label:b.slice(0,16),closable:!0}),h()},[c,d,h]),m=w.useCallback(b=>{d({id:`conviction:${b}`,label:`PCA #${b}`,closable:!0}),h()},[d,h]),v=e.unread+t.length;return l.jsxs("div",{className:"v10-header-notif-wrap",ref:i,onKeyDown:n?b=>{b.key==="Escape"&&(b.stopPropagation(),h(!0))}:void 0,children:[l.jsxs("button",{ref:o,className:"v10-header-icon-btn",onClick:()=>r(b=>!b),title:v>0?`Notifications (${v} unread)`:"Notifications","aria-label":v>0?`Notifications, ${v} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":n?W1:void 0,children:[SL,v>0&&l.jsx("span",{className:"v10-header-notif-badge",children:v})]}),n&&l.jsx(kL,{id:W1,paneRef:p,feed:e,onOpenContextGraph:g,pcaAlerts:t,onOpenPca:m})]})}function CL(e,t,n,r,i){const o=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${r} relayed)`];return i>0&&o.push(`Uptime ${NL(i)}`),o.join(`
|
|
226
|
+
`)}function NL(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),o=[];return n>0&&o.push(`${n}d`),(r>0||n>0)&&o.push(`${r}h`),o.push(`${i}m`),o.join(" ")}const EL=l.jsx("span",{className:"v10-header-ot-wordmark",children:l.jsxs("svg",{width:"60",height:"13",viewBox:"0 0 180 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[l.jsx("path",{d:"M55.0428 28.0111C59.7903 28.0111 62.6388 24.531 62.6388 20.3908C62.6388 16.2806 59.7903 12.8005 55.0428 12.8005C50.325 12.8005 47.4766 16.2806 47.4766 20.3908C47.4766 24.531 50.325 28.0111 55.0428 28.0111ZM55.0428 24.621C52.6988 24.621 51.3932 22.6709 51.3932 20.3908C51.3932 18.1407 52.6988 16.1906 55.0428 16.1906C57.3869 16.1906 58.7221 18.1407 58.7221 20.3908C58.7221 22.6709 57.3869 24.621 55.0428 24.621Z",fill:"currentColor"}),l.jsx("path",{d:"M65.4344 27.6511H69.2027V18.0807C69.8258 17.1507 71.4874 16.4606 72.7336 16.4606C73.149 16.4606 73.5051 16.4906 73.7721 16.5507V12.8305C71.9918 12.8305 70.2115 13.8505 69.2027 15.1406V13.1605H65.4344V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M77.9959 11.0304C79.2421 11.0304 80.251 10.0104 80.251 8.75031C80.251 7.49026 79.2421 6.47021 77.9959 6.47021C76.7794 6.47021 75.7409 7.49026 75.7409 8.75031C75.7409 10.0104 76.7794 11.0304 77.9959 11.0304ZM76.1266 27.6511H79.8949V13.1605H76.1266V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M83.3347 31.3713C85.115 32.9614 87.0437 33.5314 89.5064 33.5314C93.0373 33.5314 97.2507 32.1813 97.2507 26.6611V13.1605H93.4527V15.0206C92.2955 13.5505 90.7526 12.8005 89.0317 12.8005C85.4117 12.8005 82.7116 15.4406 82.7116 20.1808C82.7116 25.011 85.4414 27.5611 89.0317 27.5611C90.7823 27.5611 92.3252 26.7211 93.4527 25.281V26.7511C93.4527 29.6012 91.3164 30.4113 89.5064 30.4113C87.6964 30.4113 86.1832 29.9012 85.026 28.6112L83.3347 31.3713ZM93.4527 22.5209C92.8296 23.4509 91.4647 24.171 90.2185 24.171C88.0822 24.171 86.5986 22.6709 86.5986 20.1808C86.5986 17.6907 88.0822 16.1906 90.2185 16.1906C91.4647 16.1906 92.8296 16.8807 93.4527 17.8407V22.5209Z",fill:"currentColor"}),l.jsx("path",{d:"M102.857 11.0304C104.104 11.0304 105.113 10.0104 105.113 8.75031C105.113 7.49026 104.104 6.47021 102.857 6.47021C101.641 6.47021 100.602 7.49026 100.602 8.75031C100.602 10.0104 101.641 11.0304 102.857 11.0304ZM100.988 27.6511H104.756V13.1605H100.988V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M118.166 27.6511H121.934V17.4207C121.934 14.6006 120.421 12.8005 117.276 12.8005C114.932 12.8005 113.181 13.9405 112.261 15.0506V13.1605H108.493V27.6511H112.261V17.9007C112.884 17.0307 114.042 16.1906 115.525 16.1906C117.127 16.1906 118.166 16.8807 118.166 18.8908V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M130.483 28.0111C132.055 28.0111 133.064 27.5911 133.628 27.0811L132.827 24.201C132.619 24.411 132.085 24.621 131.521 24.621C130.69 24.621 130.216 23.931 130.216 23.0309V16.4906H133.123V13.1605H130.216V9.20033H126.418V13.1605H124.044V16.4906H126.418V24.051C126.418 26.6311 127.842 28.0111 130.483 28.0111Z",fill:"currentColor"}),l.jsx("path",{d:"M135.702 27.6511H139.47V18.0807C140.093 17.1507 141.755 16.4606 143.001 16.4606C143.416 16.4606 143.772 16.4906 144.039 16.5507V12.8305C142.259 12.8305 140.479 13.8505 139.47 15.1406V13.1605H135.702V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M156.245 27.6511H160.043V13.1605H156.245V15.0206C155.117 13.5505 153.515 12.8005 151.824 12.8005C148.174 12.8005 145.474 15.6806 145.474 20.4208C145.474 25.251 148.204 28.0111 151.824 28.0111C153.545 28.0111 155.117 27.2311 156.245 25.8211V27.6511ZM156.245 22.9709C155.592 23.931 154.257 24.621 152.981 24.621C150.845 24.621 149.361 22.9109 149.361 20.4208C149.361 17.9007 150.845 16.2206 152.981 16.2206C154.257 16.2206 155.592 16.9107 156.245 17.8707V22.9709Z",fill:"currentColor"}),l.jsx("path",{d:"M165.649 11.0304C166.895 11.0304 167.904 10.0104 167.904 8.75031C167.904 7.49026 166.895 6.47021 165.649 6.47021C164.432 6.47021 163.394 7.49026 163.394 8.75031C163.394 10.0104 164.432 11.0304 165.649 11.0304ZM163.78 27.6511H167.548V13.1605H163.78V27.6511Z",fill:"currentColor"}),l.jsx("path",{d:"M175.32 28.0111C176.863 28.0111 177.871 27.5911 178.435 27.0811L177.634 24.201C177.456 24.411 176.922 24.621 176.358 24.621C175.527 24.621 175.053 23.931 175.053 23.0309V7.64026H171.284V24.051C171.284 26.6311 172.679 28.0111 175.32 28.0111Z",fill:"currentColor"}),l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M19.781 9.94781C14.2903 9.94781 9.8385 14.4484 9.8385 20.0008C9.8385 25.5525 14.2903 30.0531 19.781 30.0531C22.833 30.0531 25.5632 28.6622 27.3869 26.4736L34.9141 32.8796C31.2855 37.2341 25.8532 40.0016 19.781 40.0016C8.85592 40.0016 0 31.0467 0 20.0008C0 8.95432 8.85592 0 19.781 0V9.94781ZM36.8737 30.0724L28.3719 25.0628C28.662 24.5606 28.9105 24.0308 29.112 23.4781L38.3464 26.9194C37.9453 28.0192 37.4508 29.0732 36.8737 30.0724ZM29.7216 20.0007H39.5609C39.5609 18.8159 39.4583 17.6554 39.2628 16.5272L29.5719 18.2549C29.6701 18.822 29.7216 19.4053 29.7216 20.0007ZM34.988 7.20831L27.425 13.5712C27.0546 13.1215 26.646 12.7054 26.2045 12.3272L32.5596 4.73338C33.4381 5.4858 34.251 6.31374 34.988 7.20831Z",fill:"currentColor"})]})}),AL=l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("circle",{cx:"12",cy:"12",r:"5"}),l.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),l.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),l.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),l.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),l.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),l.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),l.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),l.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),TL=l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),RL=l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),l.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),_L=l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),l.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]}),OL=l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"12",cy:"12",r:"3"}),l.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),ML=l.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),LL=l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.78 4.78 4 4 0 0 1-6.74 0 4 4 0 0 1-4.78-4.78 4 4 0 0 1 0-6.75z"}),l.jsx("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),l.jsx("circle",{cx:"9.5",cy:"9.5",r:".5"}),l.jsx("circle",{cx:"14.5",cy:"14.5",r:".5"})]});function IL(){var C,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:r,rightCollapsed:i,toggleRight:o}=tr(),c=tv(N=>N.nodeStatus),d=of().data,{openTab:p}=gn(),h=(c==null?void 0:c.connectedPeers)??(c==null?void 0:c.peerCount)??0,g=((C=c==null?void 0:c.connections)==null?void 0:C.direct)??0,m=((S=c==null?void 0:c.connections)==null?void 0:S.relayed)??0,v=(c==null?void 0:c.uptimeMs)??0,k=c!=null&&(c==null?void 0:c.synced)!==!1,j=CL(k,h,g,m,v);return l.jsxs("header",{className:"v10-header",children:[l.jsxs("div",{className:"v10-header-logo",children:[l.jsxs("span",{className:"v10-header-logo-text",children:["DKG ",l.jsx("span",{className:"v10-header-logo-version",children:"v10"})]}),l.jsxs("div",{className:"v10-header-logo-ot","aria-label":"Powered by OriginTrail",children:[l.jsx("span",{className:"v10-header-logo-ot-by",children:"powered by"}),EL]})]}),l.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:r,title:"Toggle sidebar",children:RL}),l.jsx("div",{className:"v10-header-sep"}),l.jsxs("div",{className:"v10-header-agent-switcher",title:d?`${d.agentDid}
|
|
227
|
+
${d.agentAddress}`:void 0,children:[l.jsx("span",{className:"v10-header-agent-dot"}),l.jsx("span",{className:"v10-header-agent-name",children:(d!=null&&d.name&&d.name!=="**"?d.name:null)||(c==null?void 0:c.name)||"Agent"}),(d==null?void 0:d.agentAddress)&&l.jsxs("span",{className:"v10-header-agent-addr",children:[d.agentAddress.slice(0,6),"…",d.agentAddress.slice(-4)]})]}),l.jsx("div",{className:"v10-header-spacer"}),l.jsxs("div",{className:"v10-header-meta",title:j,children:[l.jsx("span",{className:`v10-header-status-dot ${k?"online":"offline"}`}),l.jsx("span",{children:k?"synced":"syncing"}),l.jsx("span",{className:"v10-header-meta-sep",children:"·"}),l.jsxs("span",{children:[h," peer",h!==1?"s":""]})]}),l.jsxs("div",{className:"v10-header-actions",children:[l.jsx(jL,{}),l.jsx("button",{className:"v10-header-icon-btn",onClick:()=>p({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:ML}),l.jsx("button",{className:"v10-header-icon-btn","data-testid":"pca-launch-btn",onClick:()=>p({id:"conviction",label:"Publisher Conviction",closable:!0}),title:"Publisher Conviction - publishing discounts",children:LL}),l.jsx("button",{className:"v10-header-icon-btn",onClick:()=>p({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:OL}),l.jsx("button",{className:"v10-header-icon-btn",onClick:()=>t(e==="dark"?"light":"dark"),title:e==="dark"?"Switch to light mode":"Switch to dark mode",children:e==="dark"?AL:TL}),l.jsx("button",{className:`v10-header-icon-btn ${i?"":"active-toggle"}`,onClick:o,title:"Toggle agent panel",children:_L})]})]})}function DL(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const vv=hs((e,t)=>({stage:DL(),setStage:n=>{localStorage.setItem("dkg-journey-stage",String(n)),e({stage:n})},advance:()=>{const n=Math.min(t().stage+1,2);localStorage.setItem("dkg-journey-stage",String(n)),e({stage:n})}})),zL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
228
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
229
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
230
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
231
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
232
|
+
@prefix schema: <http://schema.org/> .
|
|
233
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
234
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
235
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
236
|
+
@prefix bibo: <http://purl.org/ontology/bibo/> .
|
|
237
|
+
@prefix fabio: <http://purl.org/spar/fabio/> .
|
|
238
|
+
@prefix cito: <http://purl.org/spar/cito/> .
|
|
239
|
+
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
|
|
240
|
+
|
|
241
|
+
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
242
|
+
@prefix dkg: <http://dkg.io/ontology/> .
|
|
243
|
+
@prefix : <http://dkg.io/ontology/book-research/> .
|
|
244
|
+
|
|
245
|
+
<http://dkg.io/ontology/book-research/>
|
|
246
|
+
a owl:Ontology ;
|
|
247
|
+
dcterms:title "DKG Book Research Project Ontology (v1)" ;
|
|
248
|
+
dcterms:description """Starter ontology for projects that research and
|
|
249
|
+
write books, papers, or long-form non-fiction. Built on schema.org +
|
|
250
|
+
BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with
|
|
251
|
+
existing scholarly publishing infrastructure.""" ;
|
|
252
|
+
owl:versionInfo "1.0.0" ;
|
|
253
|
+
dcterms:created "2026-04-18"^^xsd:date ;
|
|
254
|
+
owl:imports
|
|
255
|
+
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
256
|
+
<http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,
|
|
257
|
+
<http://www.w3.org/2004/02/skos/core#> ,
|
|
258
|
+
<http://purl.org/ontology/bibo/> ,
|
|
259
|
+
<http://purl.org/spar/fabio/> ,
|
|
260
|
+
<http://purl.org/spar/cito/> ,
|
|
261
|
+
<http://purl.org/vocab/frbr/core#> .
|
|
262
|
+
|
|
263
|
+
# ─── Universal annotation predicates (shared across all starters) ───
|
|
264
|
+
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
265
|
+
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
266
|
+
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
|
|
267
|
+
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
|
|
268
|
+
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
|
|
269
|
+
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
270
|
+
|
|
271
|
+
# ─── Universal annotation entities ──────────────────────────────────
|
|
272
|
+
:Concept rdfs:subClassOf skos:Concept .
|
|
273
|
+
:Topic rdfs:subClassOf skos:Concept .
|
|
274
|
+
:Question rdfs:subClassOf schema:Question .
|
|
275
|
+
:Finding rdfs:subClassOf prov:Entity .
|
|
276
|
+
|
|
277
|
+
# ─── Book-research specific ─────────────────────────────────────────
|
|
278
|
+
|
|
279
|
+
:Hypothesis a owl:Class ;
|
|
280
|
+
rdfs:label "Hypothesis" ;
|
|
281
|
+
rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;
|
|
282
|
+
rdfs:subClassOf prov:Entity .
|
|
283
|
+
|
|
284
|
+
:Argument a owl:Class ;
|
|
285
|
+
rdfs:label "Argument" ;
|
|
286
|
+
rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;
|
|
287
|
+
rdfs:subClassOf prov:Entity .
|
|
288
|
+
|
|
289
|
+
:Counterexample a owl:Class ;
|
|
290
|
+
rdfs:label "Counterexample" ;
|
|
291
|
+
rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;
|
|
292
|
+
rdfs:subClassOf prov:Entity .
|
|
293
|
+
|
|
294
|
+
:Quote a owl:Class ;
|
|
295
|
+
rdfs:label "Quote" ;
|
|
296
|
+
rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;
|
|
297
|
+
rdfs:subClassOf bibo:Quote .
|
|
298
|
+
|
|
299
|
+
:supports a owl:ObjectProperty ;
|
|
300
|
+
rdfs:label "supports" ;
|
|
301
|
+
rdfs:comment "An Argument or Quote supports a Hypothesis." ;
|
|
302
|
+
rdfs:subPropertyOf cito:agreesWith .
|
|
303
|
+
|
|
304
|
+
:refutes a owl:ObjectProperty ;
|
|
305
|
+
rdfs:label "refutes" ;
|
|
306
|
+
rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;
|
|
307
|
+
rdfs:subPropertyOf cito:disagreesWith .
|
|
308
|
+
|
|
309
|
+
:cites a owl:ObjectProperty ;
|
|
310
|
+
rdfs:label "cites" ;
|
|
311
|
+
rdfs:subPropertyOf cito:cites ;
|
|
312
|
+
rdfs:range bibo:Document .
|
|
313
|
+
|
|
314
|
+
# ─── URI patterns ───────────────────────────────────────────────────
|
|
315
|
+
:UriPattern rdfs:label "URI minting pattern" .
|
|
316
|
+
|
|
317
|
+
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
318
|
+
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
319
|
+
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
320
|
+
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
321
|
+
:hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
|
|
322
|
+
:argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .
|
|
323
|
+
:quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .
|
|
324
|
+
:citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;
|
|
325
|
+
skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .
|
|
326
|
+
|
|
327
|
+
:slug-normalisation a skos:Note ;
|
|
328
|
+
skos:definition "Lowercase → ASCII-fold → strip stopwords (the/a/an/of/for/and/or/to/in/on/with) → hyphenate → ≤60 chars. Apply BEFORE comparing free-text recall results (\`dkg_memory_search\`) to decide reuse-vs-mint." .
|
|
329
|
+
`,$L=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
330
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
331
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
332
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
333
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
334
|
+
@prefix schema: <http://schema.org/> .
|
|
335
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
336
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
337
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
338
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
|
339
|
+
|
|
340
|
+
# DKG project namespaces — v1 ontology for any "coding project"
|
|
341
|
+
# context graph. Imports widely-adopted Linked Data vocabs first;
|
|
342
|
+
# only declares extensions for genuinely net-new concepts.
|
|
343
|
+
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
344
|
+
@prefix code: <http://dkg.io/ontology/code/> .
|
|
345
|
+
@prefix github: <http://dkg.io/ontology/github/> .
|
|
346
|
+
@prefix decisions: <http://dkg.io/ontology/decisions/> .
|
|
347
|
+
@prefix tasks: <http://dkg.io/ontology/tasks/> .
|
|
348
|
+
@prefix agent: <http://dkg.io/ontology/agent/> .
|
|
349
|
+
@prefix dkg: <http://dkg.io/ontology/> .
|
|
350
|
+
|
|
351
|
+
@prefix : <http://dkg.io/ontology/coding-project/> .
|
|
352
|
+
|
|
353
|
+
# ─── Ontology header ────────────────────────────────────────────────
|
|
354
|
+
<http://dkg.io/ontology/coding-project/>
|
|
355
|
+
a owl:Ontology ;
|
|
356
|
+
dcterms:title "DKG Coding Project Ontology (v1)" ;
|
|
357
|
+
dcterms:description """The starter ontology for any DKG context graph that
|
|
358
|
+
represents a software project — its decisions, tasks, code structure, GitHub
|
|
359
|
+
activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project
|
|
360
|
+
ontologies, which add their own extensions on top.
|
|
361
|
+
|
|
362
|
+
Every predicate is either reused from a globally-adopted vocabulary
|
|
363
|
+
(schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a
|
|
364
|
+
project-specific extension. Companion document \`agent-guide.md\` translates
|
|
365
|
+
this formal model into operational instructions for AI coding agents.""" ;
|
|
366
|
+
dcterms:creator "branarakic" ;
|
|
367
|
+
owl:versionInfo "1.0.0" ;
|
|
368
|
+
dcterms:created "2026-04-18"^^xsd:date ;
|
|
369
|
+
owl:imports
|
|
370
|
+
<http://schema.org/> ,
|
|
371
|
+
<http://purl.org/dc/terms/> ,
|
|
372
|
+
<http://www.w3.org/ns/prov#> ,
|
|
373
|
+
<http://xmlns.com/foaf/0.1/> ,
|
|
374
|
+
<http://www.w3.org/2004/02/skos/core#> ,
|
|
375
|
+
<http://usefulinc.com/ns/doap#> .
|
|
376
|
+
|
|
377
|
+
# ─── Section 1 — Universal annotation primitives ────────────────────
|
|
378
|
+
# Predicates expressing what each chat turn was ABOUT — written into
|
|
379
|
+
# the project's \`chat\` sub-graph by the capture-chat hook (and later
|
|
380
|
+
# read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply
|
|
381
|
+
# to ANY project type, not just coding.
|
|
382
|
+
|
|
383
|
+
chat:topic
|
|
384
|
+
a owl:DatatypeProperty ;
|
|
385
|
+
rdfs:label "topic" ;
|
|
386
|
+
rdfs:comment "Free-text topical bucket the chat turn lives under. Multiple per turn; emit liberally. Renderer can use these to cluster the activity feed." ;
|
|
387
|
+
rdfs:domain chat:Turn ;
|
|
388
|
+
rdfs:range xsd:string .
|
|
389
|
+
|
|
390
|
+
chat:mentions
|
|
391
|
+
a owl:ObjectProperty ;
|
|
392
|
+
rdfs:label "mentions" ;
|
|
393
|
+
rdfs:comment "An entity the chat turn referenced. The most common edge in the graph. To find existing entities to reuse before minting fresh URIs, use \`dkg_memory_search\` (free-text recall across WM/SWM/VM)." ;
|
|
394
|
+
rdfs:domain chat:Turn ;
|
|
395
|
+
rdfs:range owl:Thing ;
|
|
396
|
+
rdfs:subPropertyOf schema:mentions .
|
|
397
|
+
|
|
398
|
+
chat:examines
|
|
399
|
+
a owl:ObjectProperty ;
|
|
400
|
+
rdfs:label "examines" ;
|
|
401
|
+
rdfs:comment "Entity the chat turn walked through in detail (vs just mentioning in passing). Implies the agent or operator is ANALYSING the entity, not merely citing it." ;
|
|
402
|
+
rdfs:domain chat:Turn ;
|
|
403
|
+
rdfs:range owl:Thing .
|
|
404
|
+
|
|
405
|
+
chat:proposes
|
|
406
|
+
a owl:ObjectProperty ;
|
|
407
|
+
rdfs:label "proposes" ;
|
|
408
|
+
rdfs:comment "An idea/decision/task the chat turn put forward. Often points at a freshly-minted Decision or Task entity created in the same write batch." ;
|
|
409
|
+
rdfs:domain chat:Turn ;
|
|
410
|
+
rdfs:range owl:Thing .
|
|
411
|
+
|
|
412
|
+
chat:concludes
|
|
413
|
+
a owl:ObjectProperty ;
|
|
414
|
+
rdfs:label "concludes" ;
|
|
415
|
+
rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;
|
|
416
|
+
rdfs:domain chat:Turn ;
|
|
417
|
+
rdfs:range :Finding .
|
|
418
|
+
|
|
419
|
+
chat:asks
|
|
420
|
+
a owl:ObjectProperty ;
|
|
421
|
+
rdfs:label "asks" ;
|
|
422
|
+
rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;
|
|
423
|
+
rdfs:domain chat:Turn ;
|
|
424
|
+
rdfs:range :Question .
|
|
425
|
+
|
|
426
|
+
# ─── Section 2 — Universal annotation entity classes ────────────────
|
|
427
|
+
|
|
428
|
+
:Concept
|
|
429
|
+
a owl:Class ;
|
|
430
|
+
rdfs:label "Concept" ;
|
|
431
|
+
rdfs:comment "A free-text concept emerging from chat that doesn't fit into a more specific class. Aligned with skos:Concept so it composes with any knowledge organisation system." ;
|
|
432
|
+
rdfs:subClassOf skos:Concept .
|
|
433
|
+
|
|
434
|
+
:Topic
|
|
435
|
+
a owl:Class ;
|
|
436
|
+
rdfs:label "Topic" ;
|
|
437
|
+
rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;
|
|
438
|
+
rdfs:subClassOf skos:Concept .
|
|
439
|
+
|
|
440
|
+
:Question
|
|
441
|
+
a owl:Class ;
|
|
442
|
+
rdfs:label "Question" ;
|
|
443
|
+
rdfs:comment "An open question raised in chat that hasn't been answered yet. URI pattern: urn:dkg:question:<slug>. Resolved by linking a chat:Turn or :Finding via :answers." ;
|
|
444
|
+
rdfs:subClassOf schema:Question .
|
|
445
|
+
|
|
446
|
+
:Finding
|
|
447
|
+
a owl:Class ;
|
|
448
|
+
rdfs:label "Finding" ;
|
|
449
|
+
rdfs:comment "A claim or observation worth preserving as a first-class entity, separate from the chat turn that produced it. URI pattern: urn:dkg:finding:<slug>. Findings can be cited by future Decisions, Tasks, and chat turns." ;
|
|
450
|
+
rdfs:subClassOf prov:Entity .
|
|
451
|
+
|
|
452
|
+
:answers
|
|
453
|
+
a owl:ObjectProperty ;
|
|
454
|
+
rdfs:label "answers" ;
|
|
455
|
+
rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;
|
|
456
|
+
rdfs:domain owl:Thing ;
|
|
457
|
+
rdfs:range :Question .
|
|
458
|
+
|
|
459
|
+
:supersedes
|
|
460
|
+
a owl:ObjectProperty ;
|
|
461
|
+
rdfs:label "supersedes" ;
|
|
462
|
+
rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;
|
|
463
|
+
rdfs:range owl:Thing ;
|
|
464
|
+
owl:inverseOf prov:wasRevisionOf .
|
|
465
|
+
|
|
466
|
+
# ─── Section 3 — Coding-project-specific classes ────────────────────
|
|
467
|
+
# Formalises the predicates already used informally in
|
|
468
|
+
# scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.
|
|
469
|
+
|
|
470
|
+
decisions:Decision
|
|
471
|
+
a owl:Class ;
|
|
472
|
+
rdfs:label "Decision" ;
|
|
473
|
+
rdfs:comment "An architectural decision the project made — context, outcome, consequences. Modelled as a prov:Activity because it represents a deliberate act of choosing." ;
|
|
474
|
+
rdfs:subClassOf prov:Activity, schema:Action .
|
|
475
|
+
|
|
476
|
+
decisions:context
|
|
477
|
+
a owl:DatatypeProperty ;
|
|
478
|
+
rdfs:label "context" ;
|
|
479
|
+
rdfs:domain decisions:Decision ;
|
|
480
|
+
rdfs:range xsd:string ;
|
|
481
|
+
rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .
|
|
482
|
+
|
|
483
|
+
decisions:outcome
|
|
484
|
+
a owl:DatatypeProperty ;
|
|
485
|
+
rdfs:label "outcome" ;
|
|
486
|
+
rdfs:domain decisions:Decision ;
|
|
487
|
+
rdfs:range xsd:string ;
|
|
488
|
+
rdfs:comment "The chosen direction — the decision itself, in one paragraph." .
|
|
489
|
+
|
|
490
|
+
decisions:consequences
|
|
491
|
+
a owl:DatatypeProperty ;
|
|
492
|
+
rdfs:label "consequences" ;
|
|
493
|
+
rdfs:domain decisions:Decision ;
|
|
494
|
+
rdfs:range xsd:string ;
|
|
495
|
+
rdfs:comment "What this implies going forward — trade-offs, follow-ups." .
|
|
496
|
+
|
|
497
|
+
decisions:status
|
|
498
|
+
a owl:DatatypeProperty ;
|
|
499
|
+
rdfs:label "status" ;
|
|
500
|
+
rdfs:domain decisions:Decision ;
|
|
501
|
+
rdfs:range xsd:string ;
|
|
502
|
+
rdfs:comment "One of: proposed | accepted | rejected | superseded." .
|
|
503
|
+
|
|
504
|
+
tasks:Task
|
|
505
|
+
a owl:Class ;
|
|
506
|
+
rdfs:label "Task" ;
|
|
507
|
+
rdfs:comment "A piece of planned or in-flight work on the project." ;
|
|
508
|
+
rdfs:subClassOf schema:Action .
|
|
509
|
+
|
|
510
|
+
tasks:status
|
|
511
|
+
a owl:DatatypeProperty ;
|
|
512
|
+
rdfs:label "status" ;
|
|
513
|
+
rdfs:domain tasks:Task ;
|
|
514
|
+
rdfs:range xsd:string ;
|
|
515
|
+
rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .
|
|
516
|
+
|
|
517
|
+
tasks:priority
|
|
518
|
+
a owl:DatatypeProperty ;
|
|
519
|
+
rdfs:label "priority" ;
|
|
520
|
+
rdfs:domain tasks:Task ;
|
|
521
|
+
rdfs:range xsd:string ;
|
|
522
|
+
rdfs:comment "One of: p0 | p1 | p2 | p3." .
|
|
523
|
+
|
|
524
|
+
tasks:relatedDecision
|
|
525
|
+
a owl:ObjectProperty ;
|
|
526
|
+
rdfs:label "related decision" ;
|
|
527
|
+
rdfs:domain tasks:Task ;
|
|
528
|
+
rdfs:range decisions:Decision ;
|
|
529
|
+
rdfs:comment "The Decision this task implements or follows from." .
|
|
530
|
+
|
|
531
|
+
tasks:dependsOn
|
|
532
|
+
a owl:ObjectProperty ;
|
|
533
|
+
rdfs:label "depends on" ;
|
|
534
|
+
rdfs:domain tasks:Task ;
|
|
535
|
+
rdfs:range tasks:Task .
|
|
536
|
+
|
|
537
|
+
tasks:touches
|
|
538
|
+
a owl:ObjectProperty ;
|
|
539
|
+
rdfs:label "touches" ;
|
|
540
|
+
rdfs:domain tasks:Task ;
|
|
541
|
+
rdfs:range owl:Thing ;
|
|
542
|
+
rdfs:comment "A code:File or code:Package this task edits." .
|
|
543
|
+
|
|
544
|
+
# Code structure — aligned with schema:SoftwareSourceCode + DOAP.
|
|
545
|
+
|
|
546
|
+
code:Package
|
|
547
|
+
a owl:Class ;
|
|
548
|
+
rdfs:label "Package" ;
|
|
549
|
+
rdfs:subClassOf doap:Project, schema:SoftwareApplication .
|
|
550
|
+
|
|
551
|
+
code:File
|
|
552
|
+
a owl:Class ;
|
|
553
|
+
rdfs:label "Source file" ;
|
|
554
|
+
rdfs:subClassOf schema:SoftwareSourceCode .
|
|
555
|
+
|
|
556
|
+
code:Function a owl:Class ; rdfs:label "Function" .
|
|
557
|
+
code:Class a owl:Class ; rdfs:label "Class" .
|
|
558
|
+
code:Interface a owl:Class ; rdfs:label "Interface" .
|
|
559
|
+
|
|
560
|
+
# GitHub — minimal aliasing onto schema.org where sensible.
|
|
561
|
+
|
|
562
|
+
github:Repository
|
|
563
|
+
a owl:Class ;
|
|
564
|
+
rdfs:label "GitHub repository" ;
|
|
565
|
+
rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .
|
|
566
|
+
|
|
567
|
+
github:PullRequest
|
|
568
|
+
a owl:Class ;
|
|
569
|
+
rdfs:label "Pull request" ;
|
|
570
|
+
rdfs:subClassOf schema:CreativeWork .
|
|
571
|
+
|
|
572
|
+
github:Issue
|
|
573
|
+
a owl:Class ;
|
|
574
|
+
rdfs:label "GitHub issue" ;
|
|
575
|
+
rdfs:subClassOf schema:Question, schema:CreativeWork .
|
|
576
|
+
|
|
577
|
+
# ─── Section 4 — Chat sub-graph classes ─────────────────────────────
|
|
578
|
+
|
|
579
|
+
chat:Session
|
|
580
|
+
a owl:Class ;
|
|
581
|
+
rdfs:label "Chat session" ;
|
|
582
|
+
rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;
|
|
583
|
+
rdfs:subClassOf schema:Conversation .
|
|
584
|
+
|
|
585
|
+
chat:Turn
|
|
586
|
+
a owl:Class ;
|
|
587
|
+
rdfs:label "Chat turn" ;
|
|
588
|
+
rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;
|
|
589
|
+
rdfs:subClassOf schema:Message, prov:Entity .
|
|
590
|
+
|
|
591
|
+
chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
592
|
+
chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
593
|
+
chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .
|
|
594
|
+
chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .
|
|
595
|
+
chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;
|
|
596
|
+
rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .
|
|
597
|
+
chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;
|
|
598
|
+
rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .
|
|
599
|
+
|
|
600
|
+
# ─── Section 5 — Agent identity ─────────────────────────────────────
|
|
601
|
+
|
|
602
|
+
agent:Agent
|
|
603
|
+
a owl:Class ;
|
|
604
|
+
rdfs:label "Agent" ;
|
|
605
|
+
rdfs:subClassOf prov:Agent, foaf:Agent .
|
|
606
|
+
|
|
607
|
+
agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .
|
|
608
|
+
agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .
|
|
609
|
+
|
|
610
|
+
agent:framework
|
|
611
|
+
a owl:DatatypeProperty ;
|
|
612
|
+
rdfs:label "framework" ;
|
|
613
|
+
rdfs:domain agent:AIAgent ;
|
|
614
|
+
rdfs:range xsd:string ;
|
|
615
|
+
rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .
|
|
616
|
+
|
|
617
|
+
agent:operator
|
|
618
|
+
a owl:ObjectProperty ;
|
|
619
|
+
rdfs:label "operator" ;
|
|
620
|
+
rdfs:domain agent:AIAgent ;
|
|
621
|
+
rdfs:range agent:HumanAgent ;
|
|
622
|
+
rdfs:comment "The human operator who runs and is responsible for this AI agent." .
|
|
623
|
+
|
|
624
|
+
# ─── Section 6 — URI minting conventions (machine-readable) ─────────
|
|
625
|
+
# These are encoded as SKOS notes so an agent reading the ontology can
|
|
626
|
+
# pull them out programmatically. The agent guide repeats them in
|
|
627
|
+
# prose for human readability.
|
|
628
|
+
|
|
629
|
+
:UriPattern
|
|
630
|
+
a owl:Class ;
|
|
631
|
+
rdfs:label "URI minting pattern" ;
|
|
632
|
+
rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .
|
|
633
|
+
|
|
634
|
+
:concept-pattern a :UriPattern ;
|
|
635
|
+
skos:notation "urn:dkg:concept:<slug>" ;
|
|
636
|
+
skos:definition "Free-text concept; aligned with skos:Concept." .
|
|
637
|
+
:topic-pattern a :UriPattern ;
|
|
638
|
+
skos:notation "urn:dkg:topic:<slug>" ;
|
|
639
|
+
skos:definition "Broad topical bucket grouping related entities." .
|
|
640
|
+
:question-pattern a :UriPattern ;
|
|
641
|
+
skos:notation "urn:dkg:question:<slug>" ;
|
|
642
|
+
skos:definition "An open question awaiting an answer." .
|
|
643
|
+
:finding-pattern a :UriPattern ;
|
|
644
|
+
skos:notation "urn:dkg:finding:<slug>" ;
|
|
645
|
+
skos:definition "A claim or observation worth preserving as a first-class node." .
|
|
646
|
+
:decision-pattern a :UriPattern ;
|
|
647
|
+
skos:notation "urn:dkg:decision:<slug>" ;
|
|
648
|
+
skos:definition "An architectural decision (coding-project specific)." .
|
|
649
|
+
:task-pattern a :UriPattern ;
|
|
650
|
+
skos:notation "urn:dkg:task:<slug>" ;
|
|
651
|
+
skos:definition "A piece of planned or in-flight work (coding-project specific)." .
|
|
652
|
+
|
|
653
|
+
# ─── Section 7 — Slug normalisation rule (deterministic) ────────────
|
|
654
|
+
|
|
655
|
+
:slug-normalisation a skos:Note ;
|
|
656
|
+
skos:prefLabel "slug normalisation" ;
|
|
657
|
+
skos:definition """To compute the canonical slug from a free-text label:
|
|
658
|
+
1. Lowercase.
|
|
659
|
+
2. Apply Unicode NFKD then strip combining marks (ASCII fold).
|
|
660
|
+
3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).
|
|
661
|
+
4. Replace any run of non-[a-z0-9] with a single hyphen.
|
|
662
|
+
5. Trim leading/trailing hyphens.
|
|
663
|
+
6. Truncate to 60 characters max.
|
|
664
|
+
|
|
665
|
+
Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all
|
|
666
|
+
normalise to "tree-sitter". Always apply this BEFORE comparing free-text
|
|
667
|
+
recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .
|
|
668
|
+
`,PL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
669
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
670
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
671
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
672
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
673
|
+
@prefix schema: <http://schema.org/> .
|
|
674
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
675
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
676
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
677
|
+
@prefix bibo: <http://purl.org/ontology/bibo/> .
|
|
678
|
+
|
|
679
|
+
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
680
|
+
@prefix : <http://dkg.io/ontology/narrative-writing/> .
|
|
681
|
+
|
|
682
|
+
<http://dkg.io/ontology/narrative-writing/>
|
|
683
|
+
a owl:Ontology ;
|
|
684
|
+
dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;
|
|
685
|
+
dcterms:description """Starter for fiction or narrative non-fiction
|
|
686
|
+
projects: novels, screenplays, biographies. Tracks Characters, Scenes,
|
|
687
|
+
Plot Points, Themes, and the relationships between them.""" ;
|
|
688
|
+
owl:versionInfo "1.0.0" ;
|
|
689
|
+
dcterms:created "2026-04-18"^^xsd:date ;
|
|
690
|
+
owl:imports
|
|
691
|
+
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
692
|
+
<http://xmlns.com/foaf/0.1/> ,
|
|
693
|
+
<http://www.w3.org/2004/02/skos/core#> ,
|
|
694
|
+
<http://purl.org/ontology/bibo/> .
|
|
695
|
+
|
|
696
|
+
# ─── Universal annotation predicates ────────────────────────────────
|
|
697
|
+
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
698
|
+
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
699
|
+
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
700
|
+
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
701
|
+
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
|
|
702
|
+
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
703
|
+
|
|
704
|
+
# ─── Universal annotation entities ──────────────────────────────────
|
|
705
|
+
:Concept rdfs:subClassOf skos:Concept .
|
|
706
|
+
:Topic rdfs:subClassOf skos:Concept .
|
|
707
|
+
:Question rdfs:subClassOf schema:Question .
|
|
708
|
+
:Finding rdfs:subClassOf prov:Entity .
|
|
709
|
+
|
|
710
|
+
# ─── Narrative-writing-specific ─────────────────────────────────────
|
|
711
|
+
|
|
712
|
+
:Character a owl:Class ;
|
|
713
|
+
rdfs:label "Character" ;
|
|
714
|
+
rdfs:comment "A character in the narrative — fictional or historical." ;
|
|
715
|
+
rdfs:subClassOf foaf:Person, schema:Person .
|
|
716
|
+
|
|
717
|
+
:Scene a owl:Class ;
|
|
718
|
+
rdfs:label "Scene" ;
|
|
719
|
+
rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;
|
|
720
|
+
rdfs:subClassOf schema:Event .
|
|
721
|
+
|
|
722
|
+
:PlotPoint a owl:Class ;
|
|
723
|
+
rdfs:label "Plot point" ;
|
|
724
|
+
rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .
|
|
725
|
+
|
|
726
|
+
:Theme a owl:Class ;
|
|
727
|
+
rdfs:label "Theme" ;
|
|
728
|
+
rdfs:comment "A unifying idea explored across the narrative." ;
|
|
729
|
+
rdfs:subClassOf skos:Concept .
|
|
730
|
+
|
|
731
|
+
:Setting a owl:Class ;
|
|
732
|
+
rdfs:label "Setting" ;
|
|
733
|
+
rdfs:comment "A place + time context within which Scenes occur." .
|
|
734
|
+
|
|
735
|
+
:appearsIn a owl:ObjectProperty ;
|
|
736
|
+
rdfs:label "appears in" ;
|
|
737
|
+
rdfs:domain :Character ;
|
|
738
|
+
rdfs:range :Scene .
|
|
739
|
+
|
|
740
|
+
:setIn a owl:ObjectProperty ;
|
|
741
|
+
rdfs:label "set in" ;
|
|
742
|
+
rdfs:domain :Scene ;
|
|
743
|
+
rdfs:range :Setting .
|
|
744
|
+
|
|
745
|
+
:develops a owl:ObjectProperty ;
|
|
746
|
+
rdfs:label "develops" ;
|
|
747
|
+
rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;
|
|
748
|
+
rdfs:range owl:Thing .
|
|
749
|
+
|
|
750
|
+
:precedes a owl:ObjectProperty ;
|
|
751
|
+
rdfs:label "precedes" ;
|
|
752
|
+
rdfs:domain :Scene ;
|
|
753
|
+
rdfs:range :Scene .
|
|
754
|
+
|
|
755
|
+
# ─── URI patterns ───────────────────────────────────────────────────
|
|
756
|
+
:UriPattern rdfs:label "URI minting pattern" .
|
|
757
|
+
|
|
758
|
+
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
759
|
+
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
760
|
+
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
761
|
+
:character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .
|
|
762
|
+
:scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .
|
|
763
|
+
:plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .
|
|
764
|
+
:theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .
|
|
765
|
+
:setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .
|
|
766
|
+
|
|
767
|
+
:slug-normalisation a skos:Note ;
|
|
768
|
+
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
769
|
+
`,UL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
770
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
771
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
772
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
773
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
774
|
+
@prefix schema: <http://schema.org/> .
|
|
775
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
776
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
777
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
778
|
+
@prefix time: <http://www.w3.org/2006/time#> .
|
|
779
|
+
|
|
780
|
+
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
781
|
+
@prefix : <http://dkg.io/ontology/pkm/> .
|
|
782
|
+
|
|
783
|
+
<http://dkg.io/ontology/pkm/>
|
|
784
|
+
a owl:Ontology ;
|
|
785
|
+
dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;
|
|
786
|
+
dcterms:description """Starter for personal/team knowledge gardens.
|
|
787
|
+
Notes, highlights, questions, insights — the daily-driver vocabulary
|
|
788
|
+
of an Obsidian/Roam-style PKM workflow, but graph-native and shareable
|
|
789
|
+
with teammates' agents.""" ;
|
|
790
|
+
owl:versionInfo "1.0.0" ;
|
|
791
|
+
dcterms:created "2026-04-18"^^xsd:date ;
|
|
792
|
+
owl:imports
|
|
793
|
+
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
794
|
+
<http://xmlns.com/foaf/0.1/> ,
|
|
795
|
+
<http://www.w3.org/2004/02/skos/core#> ,
|
|
796
|
+
<http://www.w3.org/2006/time#> .
|
|
797
|
+
|
|
798
|
+
# ─── Universal annotation predicates ────────────────────────────────
|
|
799
|
+
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
800
|
+
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
801
|
+
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
802
|
+
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
803
|
+
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .
|
|
804
|
+
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
805
|
+
|
|
806
|
+
# ─── Universal annotation entities ──────────────────────────────────
|
|
807
|
+
:Concept rdfs:subClassOf skos:Concept .
|
|
808
|
+
:Topic rdfs:subClassOf skos:Concept .
|
|
809
|
+
:Question rdfs:subClassOf schema:Question .
|
|
810
|
+
:Finding rdfs:subClassOf prov:Entity .
|
|
811
|
+
|
|
812
|
+
# ─── PKM-specific ────────────────────────────────────────────────────
|
|
813
|
+
|
|
814
|
+
:Note a owl:Class ;
|
|
815
|
+
rdfs:label "Note" ;
|
|
816
|
+
rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;
|
|
817
|
+
rdfs:subClassOf schema:CreativeWork .
|
|
818
|
+
|
|
819
|
+
:Highlight a owl:Class ;
|
|
820
|
+
rdfs:label "Highlight" ;
|
|
821
|
+
rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;
|
|
822
|
+
rdfs:subClassOf schema:Quotation .
|
|
823
|
+
|
|
824
|
+
:Insight a owl:Class ;
|
|
825
|
+
rdfs:label "Insight" ;
|
|
826
|
+
rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;
|
|
827
|
+
rdfs:subClassOf prov:Entity .
|
|
828
|
+
|
|
829
|
+
:relatedTo a owl:ObjectProperty ;
|
|
830
|
+
rdfs:label "related to" ;
|
|
831
|
+
rdfs:subPropertyOf skos:related .
|
|
832
|
+
|
|
833
|
+
:references a owl:ObjectProperty ;
|
|
834
|
+
rdfs:label "references" ;
|
|
835
|
+
rdfs:subPropertyOf dcterms:references .
|
|
836
|
+
|
|
837
|
+
:source a owl:ObjectProperty ;
|
|
838
|
+
rdfs:label "source" ;
|
|
839
|
+
rdfs:domain :Highlight ;
|
|
840
|
+
rdfs:range schema:CreativeWork ;
|
|
841
|
+
rdfs:comment "Where a Highlight was extracted from." ;
|
|
842
|
+
rdfs:subPropertyOf dcterms:source .
|
|
843
|
+
|
|
844
|
+
# ─── URI patterns ───────────────────────────────────────────────────
|
|
845
|
+
:UriPattern rdfs:label "URI minting pattern" .
|
|
846
|
+
|
|
847
|
+
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
848
|
+
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
849
|
+
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
850
|
+
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
851
|
+
:note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .
|
|
852
|
+
:highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .
|
|
853
|
+
:insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .
|
|
854
|
+
|
|
855
|
+
:slug-normalisation a skos:Note ;
|
|
856
|
+
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
857
|
+
`,BL=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
858
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
859
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
860
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
861
|
+
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
862
|
+
@prefix schema: <http://schema.org/> .
|
|
863
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
864
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
865
|
+
@prefix dcat: <http://www.w3.org/ns/dcat#> .
|
|
866
|
+
@prefix fabio: <http://purl.org/spar/fabio/> .
|
|
867
|
+
@prefix time: <http://www.w3.org/2006/time#> .
|
|
868
|
+
|
|
869
|
+
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
870
|
+
@prefix : <http://dkg.io/ontology/scientific-research/> .
|
|
871
|
+
|
|
872
|
+
<http://dkg.io/ontology/scientific-research/>
|
|
873
|
+
a owl:Ontology ;
|
|
874
|
+
dcterms:title "DKG Scientific Research Project Ontology (v1)" ;
|
|
875
|
+
dcterms:description """Starter for empirical scientific research:
|
|
876
|
+
hypotheses → experiments → results → reproducibility chains. Composes
|
|
877
|
+
with FaBiO for scholarly works, DCAT for datasets, PROV-O for
|
|
878
|
+
provenance, OWL Time for sequencing.""" ;
|
|
879
|
+
owl:versionInfo "1.0.0" ;
|
|
880
|
+
dcterms:created "2026-04-18"^^xsd:date ;
|
|
881
|
+
owl:imports
|
|
882
|
+
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
883
|
+
<http://www.w3.org/ns/prov#> ,
|
|
884
|
+
<http://www.w3.org/2004/02/skos/core#> ,
|
|
885
|
+
<http://www.w3.org/ns/dcat#> ,
|
|
886
|
+
<http://purl.org/spar/fabio/> ,
|
|
887
|
+
<http://www.w3.org/2006/time#> .
|
|
888
|
+
|
|
889
|
+
# ─── Universal annotation predicates ────────────────────────────────
|
|
890
|
+
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
891
|
+
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
892
|
+
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
893
|
+
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
894
|
+
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .
|
|
895
|
+
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
896
|
+
|
|
897
|
+
# ─── Universal annotation entities ──────────────────────────────────
|
|
898
|
+
:Concept rdfs:subClassOf skos:Concept .
|
|
899
|
+
:Topic rdfs:subClassOf skos:Concept .
|
|
900
|
+
:Question rdfs:subClassOf schema:Question .
|
|
901
|
+
:Finding rdfs:subClassOf prov:Entity .
|
|
902
|
+
|
|
903
|
+
# ─── Scientific-research-specific ───────────────────────────────────
|
|
904
|
+
|
|
905
|
+
:Hypothesis a owl:Class ;
|
|
906
|
+
rdfs:label "Hypothesis" ;
|
|
907
|
+
rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;
|
|
908
|
+
rdfs:subClassOf prov:Entity .
|
|
909
|
+
|
|
910
|
+
:Experiment a owl:Class ;
|
|
911
|
+
rdfs:label "Experiment" ;
|
|
912
|
+
rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;
|
|
913
|
+
rdfs:subClassOf prov:Activity .
|
|
914
|
+
|
|
915
|
+
:Method a owl:Class ;
|
|
916
|
+
rdfs:label "Method" ;
|
|
917
|
+
rdfs:comment "A reusable methodology applied within Experiments." ;
|
|
918
|
+
rdfs:subClassOf prov:Plan .
|
|
919
|
+
|
|
920
|
+
:Result a owl:Class ;
|
|
921
|
+
rdfs:label "Result" ;
|
|
922
|
+
rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;
|
|
923
|
+
rdfs:subClassOf prov:Entity .
|
|
924
|
+
|
|
925
|
+
:Dataset a owl:Class ;
|
|
926
|
+
rdfs:label "Dataset" ;
|
|
927
|
+
rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;
|
|
928
|
+
rdfs:subClassOf dcat:Dataset .
|
|
929
|
+
|
|
930
|
+
:testedBy a owl:ObjectProperty ;
|
|
931
|
+
rdfs:label "tested by" ;
|
|
932
|
+
rdfs:domain :Hypothesis ;
|
|
933
|
+
rdfs:range :Experiment .
|
|
934
|
+
|
|
935
|
+
:supportedBy a owl:ObjectProperty ;
|
|
936
|
+
rdfs:label "supported by" ;
|
|
937
|
+
rdfs:domain :Hypothesis ;
|
|
938
|
+
rdfs:range :Result .
|
|
939
|
+
|
|
940
|
+
:refutedBy a owl:ObjectProperty ;
|
|
941
|
+
rdfs:label "refuted by" ;
|
|
942
|
+
rdfs:domain :Hypothesis ;
|
|
943
|
+
rdfs:range :Result .
|
|
944
|
+
|
|
945
|
+
:usesDataset a owl:ObjectProperty ;
|
|
946
|
+
rdfs:label "uses dataset" ;
|
|
947
|
+
rdfs:domain :Experiment ;
|
|
948
|
+
rdfs:range :Dataset .
|
|
949
|
+
|
|
950
|
+
:reproducedBy a owl:ObjectProperty ;
|
|
951
|
+
rdfs:label "reproduced by" ;
|
|
952
|
+
rdfs:domain :Experiment ;
|
|
953
|
+
rdfs:range :Experiment ;
|
|
954
|
+
rdfs:comment "An Experiment that successfully reproduced this one's Results." .
|
|
955
|
+
|
|
956
|
+
# ─── URI patterns ───────────────────────────────────────────────────
|
|
957
|
+
:UriPattern rdfs:label "URI minting pattern" .
|
|
958
|
+
|
|
959
|
+
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
960
|
+
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
961
|
+
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
962
|
+
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
963
|
+
:hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
|
|
964
|
+
:experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .
|
|
965
|
+
:method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .
|
|
966
|
+
:result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .
|
|
967
|
+
:dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .
|
|
968
|
+
|
|
969
|
+
:slug-normalisation a skos:Note ;
|
|
970
|
+
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
971
|
+
`,FL=`# Book-research agent guide
|
|
972
|
+
|
|
973
|
+
This starter ships an RDF ontology for **book-research projects** —
|
|
974
|
+
research notebooks anchored in scholarly sources (citations, quotes,
|
|
975
|
+
arguments, hypotheses). The formal schema lives in \`ontology.ttl\`
|
|
976
|
+
alongside this guide.
|
|
977
|
+
|
|
978
|
+
For V10 MCP tool usage, see
|
|
979
|
+
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
980
|
+
The tool surface to use against this ontology:
|
|
981
|
+
|
|
982
|
+
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
983
|
+
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
984
|
+
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
985
|
+
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
986
|
+
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
987
|
+
|
|
988
|
+
The longer per-domain agent-guide walkthrough format will return when
|
|
989
|
+
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
990
|
+
`,qL=`# Coding-project agent guide
|
|
991
|
+
|
|
992
|
+
This starter ships an RDF ontology for **coding projects** —
|
|
993
|
+
shared project memory for AI coding agents (decisions, tasks, code
|
|
994
|
+
references, GitHub activity, chat turns). The formal schema lives in
|
|
995
|
+
\`ontology.ttl\` alongside this guide.
|
|
996
|
+
|
|
997
|
+
For V10 MCP tool usage, see
|
|
998
|
+
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
999
|
+
The tool surface to use against this ontology:
|
|
1000
|
+
|
|
1001
|
+
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1002
|
+
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1003
|
+
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1004
|
+
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1005
|
+
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1006
|
+
|
|
1007
|
+
The longer per-domain agent-guide walkthrough format will return when
|
|
1008
|
+
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1009
|
+
`,HL=`# Narrative-writing agent guide
|
|
1010
|
+
|
|
1011
|
+
This starter ships an RDF ontology for **narrative-writing projects** —
|
|
1012
|
+
the structural elements of long-form narrative (Characters, Scenes,
|
|
1013
|
+
PlotPoints, Themes, Settings) and their relationships. The formal
|
|
1014
|
+
schema lives in \`ontology.ttl\` alongside this guide.
|
|
1015
|
+
|
|
1016
|
+
For V10 MCP tool usage, see
|
|
1017
|
+
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1018
|
+
The tool surface to use against this ontology:
|
|
1019
|
+
|
|
1020
|
+
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1021
|
+
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1022
|
+
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1023
|
+
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1024
|
+
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1025
|
+
|
|
1026
|
+
The longer per-domain agent-guide walkthrough format will return when
|
|
1027
|
+
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1028
|
+
`,GL=`# PKM agent guide
|
|
1029
|
+
|
|
1030
|
+
This starter ships an RDF ontology for **PKM (Personal Knowledge
|
|
1031
|
+
Management) projects** — Notes, Highlights, Insights, and the links
|
|
1032
|
+
that grow a knowledge garden organically. The formal schema lives in
|
|
1033
|
+
\`ontology.ttl\` alongside this guide.
|
|
1034
|
+
|
|
1035
|
+
For V10 MCP tool usage, see
|
|
1036
|
+
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1037
|
+
The tool surface to use against this ontology:
|
|
1038
|
+
|
|
1039
|
+
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1040
|
+
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1041
|
+
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1042
|
+
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1043
|
+
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1044
|
+
|
|
1045
|
+
The longer per-domain agent-guide walkthrough format will return when
|
|
1046
|
+
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1047
|
+
`,VL=`# Scientific-research agent guide
|
|
1048
|
+
|
|
1049
|
+
This starter ships an RDF ontology for **scientific-research projects** —
|
|
1050
|
+
the empirical research arc (Hypotheses → Experiments → Results →
|
|
1051
|
+
Reproducibility chains), anchored in PROV-O and FaBiO so the graph
|
|
1052
|
+
composes with existing scholarly publishing infrastructure. The formal
|
|
1053
|
+
schema lives in \`ontology.ttl\` alongside this guide.
|
|
1054
|
+
|
|
1055
|
+
For V10 MCP tool usage, see
|
|
1056
|
+
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1057
|
+
The tool surface to use against this ontology:
|
|
1058
|
+
|
|
1059
|
+
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1060
|
+
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1061
|
+
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1062
|
+
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1063
|
+
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1064
|
+
|
|
1065
|
+
The longer per-domain agent-guide walkthrough format will return when
|
|
1066
|
+
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1067
|
+
`,WL=/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>"{}|\\^`\x00-\x20]+$/;function aC(e){return e?WL.test(e):!1}function yv(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function iC(e){return`"${yv(e)}"`}const Mt={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"http://schema.org/",dcterms:"http://purl.org/dc/terms/",xsd:"http://www.w3.org/2001/XMLSchema#",prov:"http://www.w3.org/ns/prov#",owl:"http://www.w3.org/2002/07/owl#"};function Ei(e){if(!aC(e))throw new Error(`Invalid /wm/write IRI object: ${e}`);return e}function _r(e){return`"${yv(e)}"`}function Vu(e,t){return`"${yv(e)}"^^<${Ei(t)}>`}function ZL({contextGraphId:e,starterSlug:t,ttl:n,guide:r,nowIso:i=new Date().toISOString()}){if(!e)throw new Error("contextGraphId is required");if(!t)throw new Error("starterSlug is required");const o=Ei(`urn:dkg:project:${e}:ontology`),c=Ei(`${o}:agent-guide`),d=[{subject:o,predicate:Mt.rdf+"type",object:Ei(Mt.owl+"Ontology")},{subject:o,predicate:Mt.rdf+"type",object:Ei(Mt.prov+"Entity")},{subject:o,predicate:Mt.rdfs+"label",object:_r(`Project ontology — ${e}`)},{subject:o,predicate:Mt.schema+"name",object:_r(`Project ontology — ${e}`)},{subject:o,predicate:Mt.dcterms+"title",object:_r(`Project ontology — ${e}`)},{subject:o,predicate:Mt.dcterms+"description",object:_r(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:o,predicate:Mt.dcterms+"created",object:Vu(i,Mt.xsd+"dateTime")},{subject:o,predicate:Mt.dcterms+"modified",object:Vu(i,Mt.xsd+"dateTime")},{subject:o,predicate:Mt.dcterms+"source",object:_r(t)},{subject:o,predicate:Mt.schema+"encodingFormat",object:_r("text/turtle")},{subject:o,predicate:Mt.schema+"text",object:_r(n)},{subject:o,predicate:Mt.dcterms+"references",object:Ei(c)},{subject:c,predicate:Mt.rdf+"type",object:Ei(Mt.schema+"DigitalDocument")},{subject:c,predicate:Mt.rdfs+"label",object:_r(`Agent guide — ${e} ontology`)},{subject:c,predicate:Mt.schema+"name",object:_r(`Agent guide — ${e} ontology`)},{subject:c,predicate:Mt.dcterms+"title",object:_r(`Agent guide — ${e} ontology`)},{subject:c,predicate:Mt.dcterms+"created",object:Vu(i,Mt.xsd+"dateTime")},{subject:c,predicate:Mt.dcterms+"modified",object:Vu(i,Mt.xsd+"dateTime")},{subject:c,predicate:Mt.schema+"encodingFormat",object:_r("text/markdown")},{subject:c,predicate:Mt.schema+"text",object:_r(r)},{subject:c,predicate:Mt.schema+"about",object:Ei(o)}];return{ontologyUri:o,guideUri:c,quads:d}}async function Wu(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),i=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(i)}return n.json()}const QL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":zL,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":$L,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":PL,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":UL,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":BL}),KL=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":FL,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":qL,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":HL,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":GL,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":VL});function YL(){const e={};for(const[t,n]of Object.entries(QL)){const r=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!r)continue;const i=r[1];e[i]={ttl:n,guide:""}}for(const[t,n]of Object.entries(KL)){const r=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!r)continue;const i=r[1];e[i]&&(e[i].guide=n)}return e}const bv=YL(),XL=[{slug:"coding-project",displayName:"Coding project",description:"Software projects: decisions, tasks, code, GitHub. The v1 reference ontology."},{slug:"book-research",displayName:"Book / paper research",description:"Long-form non-fiction: hypotheses, arguments, citations, quotes. Built on BIBO + SPAR."},{slug:"pkm",displayName:"Personal knowledge management",description:"Notes, highlights, insights — daily-driver PKM workflow. Composes with SKOS."},{slug:"scientific-research",displayName:"Scientific research",description:"Empirical research: hypotheses → experiments → results → reproducibility. Built on PROV-O + DCAT + FaBiO."},{slug:"narrative-writing",displayName:"Narrative writing",description:"Fiction or narrative non-fiction: characters, scenes, plot points, themes."}];function JL(){return XL.filter(e=>bv[e.slug])}function eI(e){return bv[e]??null}async function tI(e,t){const n=eI(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(bv).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await Wu("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{if(!String((d==null?void 0:d.message)??d).includes("already exists"))throw d});const{ontologyUri:r,guideUri:i,quads:o}=ZL({contextGraphId:e,starterSlug:t,ttl:n.ttl,guide:n.guide});await Wu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(d=>{const p=String((d==null?void 0:d.message)??d);if(!/404|not found/i.test(p))throw d}),await Wu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:o});const c=await Wu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta"});if(!c.swmShared||!c.sealed||!c.publishReady)throw new Error("Project ontology atomic share did not reach Shared Working Memory");return{ontologyUri:r,guideUri:i,tripleCount:o.length}}async function xv(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify(t)}),r=await n.text();let i;if(r)try{i=JSON.parse(r)}catch{i={raw:r}}if(!n.ok){const o=(i==null?void 0:i.error)??`HTTP ${n.status}`;throw new Error(typeof o=="string"?o:JSON.stringify(o))}return i}function nI(e,t={}){return xv(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function rI(e,t){return xv(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function aI(e,t){return xv(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const Z1="dkg.wireWorkspace.parentDir",Q1="dkg.wireWorkspace.nickname",K1="dkg.wireWorkspace.tools",am=[{value:"cursor",label:"Cursor",description:"Wires .cursor/mcp.json + hooks + rules into the workspace."},{value:"claude-code",label:"Claude Code",description:"Merges hooks into ~/.claude/settings.json. Requires Claude Code installed."},{value:"both",label:"Both Cursor and Claude Code",description:"Wires both tools so either can operate on this project."},{value:"cursor",label:"Codex (coming soon)",description:"Codex CLI integration isn't shipped yet — pick another tool for now.",disabled:!0,comingSoon:!0}];function iI(e,t){const n=t.split("/"),r=n[n.length-1]??"";return r||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function sI(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function Y1(e){return e==="both"?["cursor","claude-code"]:[e]}function sC({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:r,onCancel:i,variant:o}){var Y;const c=w.useMemo(()=>iI(t,e),[t,e]),[d,p]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(""),[b,k]=w.useState(""),[j,C]=w.useState("cursor"),[S,N]=w.useState(!1),[A,O]=w.useState(null),[M,T]=w.useState(null),[L,B]=w.useState(null);w.useEffect(()=>{let D=!1;return(async()=>{try{const[q,G]=await Promise.all([fetch("/api/host/info",{headers:Bt()}).then(H=>H.ok?H.json():null),yc().catch(()=>null)]);if(D)return;if(q){p(q);const H=typeof window<"u"&&window.localStorage.getItem(Z1)||q.defaultWorkspaceParent;v(`${H}/${c}`)}G&&g(G);const W=typeof window<"u"&&window.localStorage.getItem(Q1);n?k(n):W?k(W):q&&k(sI(q));const Q=typeof window<"u"&&window.localStorage.getItem(K1);Q&&(Q==="cursor"||Q==="claude-code"||Q==="both")&&C(Q)}catch(q){D||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",q)}})(),()=>{D=!0}},[c,n]);function _(D){typeof window>"u"||(window.localStorage.setItem(Z1,D),b&&window.localStorage.setItem(Q1,b),window.localStorage.setItem(K1,j))}async function R(){N(!0),O(null);try{const D=m.trim();if(!D||D.startsWith("~"))throw new Error("Workspace path must be an absolute path (start with `/`). The daemon will create the directory if it does not exist.");const q=await rI(e,{workspaceRoot:D,agentNickname:b.trim(),tools:Y1(j)});T(q);const G=D.lastIndexOf("/");G>0&&_(D.slice(0,G))}catch(D){O((D==null?void 0:D.message)||"Preview failed")}finally{N(!1)}}async function z(){N(!0),O(null);try{const D=m.trim(),q=await aI(e,{workspaceRoot:D,agentNickname:b.trim(),tools:Y1(j)});B(q)}catch(D){O((D==null?void 0:D.message)||"Install failed")}finally{N(!1)}}if(L)return l.jsxs("div",{children:[l.jsxs("div",{style:{padding:"12px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Workspace wired."}),"Open ",l.jsx("code",{style:{fontFamily:"var(--font-mono)"},children:m})," in ",j==="claude-code"?"Claude Code":j==="both"?"Cursor or Claude Code":"Cursor",". On the first chat, your agent will see the project ontology",o==="join"?", tasks, and decisions":" you publish via the canonical assertion-write flow","."]}),l.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginBottom:8},children:"Files written:"}),l.jsxs("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:200,overflow:"auto",padding:10,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0},children:[L.written.map(D=>`${D.action.padEnd(9)} ${D.absPath} (${D.bytesWritten.toLocaleString()} bytes)`).join(`
|
|
1068
|
+
`),L.skipped.length?`
|
|
1069
|
+
|
|
1070
|
+
Skipped:
|
|
1071
|
+
`+L.skipped.map(D=>` - ${D}`).join(`
|
|
1072
|
+
`):"",L.warnings.length?`
|
|
1073
|
+
|
|
1074
|
+
Warnings:
|
|
1075
|
+
`+L.warnings.map(D=>` - ${D}`).join(`
|
|
1076
|
+
`):""]}),l.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:l.jsx("button",{className:"v10-modal-btn primary",onClick:r,children:"Done"})})]});if(M)return l.jsxs("div",{children:[A&&l.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:A}),l.jsx("div",{style:{marginBottom:10,fontSize:11,color:"var(--text-secondary)"},children:"Review the install plan. Files are only written when you click Install."}),l.jsx("pre",{style:{fontSize:10,fontFamily:"var(--font-mono)",maxHeight:320,overflow:"auto",padding:12,borderRadius:6,background:"var(--bg-secondary)",border:"1px solid var(--border-primary)",margin:0,whiteSpace:"pre-wrap"},children:M.markdown}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[l.jsx("button",{className:"v10-modal-btn",onClick:()=>{T(null),O(null)},disabled:S,children:"← Back"}),l.jsxs("div",{style:{display:"flex",gap:8},children:[l.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),l.jsx("button",{className:"v10-modal-btn primary",onClick:z,disabled:S,children:S?"Installing…":"Install"})]})]})]});const F=((Y=am.find(D=>D.value===j&&!D.disabled))==null?void 0:Y.description)??am[0].description;return l.jsxs("div",{children:[l.jsxs("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:14,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:[l.jsx("div",{style:{fontWeight:600,marginBottom:4},children:o==="create"?"Wire your local workspace":"Wire this project locally"}),o==="create"?"Choose a directory for the new project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can join the project from turn one.":"Choose a local directory for this project and which coding tool you want it wired for. The daemon will populate the workspace with the right config files so your agent can collaborate on this project."]}),A&&l.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:A}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Workspace path"}),l.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:D=>v(D.target.value),placeholder:d?`${d.defaultWorkspaceParent}/${c}`:"/Users/you/code/project",spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:12}}),l.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Absolute path. Created if it doesn't exist. Daemon writes only inside this dir (plus optionally ",l.jsx("code",{children:"~/.claude/settings.json"})," if Claude Code is selected).",d&&l.jsxs(l.Fragment,{children:[" Defaulted from your ",l.jsx("code",{children:"$HOME"})," = ",l.jsx("code",{children:d.homedir}),"."]})]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Coding tool to wire"}),l.jsx("select",{className:"v10-form-select",value:j,onChange:D=>C(D.target.value),children:am.map((D,q)=>l.jsx("option",{value:D.disabled?"__disabled__":D.value,disabled:D.disabled,children:D.label},`${D.label}-${q}`))}),l.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:F})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Your agent identity"}),l.jsx("input",{className:"v10-form-input",type:"text",value:h?`urn:dkg:agent:${h.agentAddress.toLowerCase()}`:"fetching…",disabled:!0,spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:11,opacity:.75}}),l.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:["Cryptographic URI derived from this node's wallet address. Same on every project on this machine. Attribution (",l.jsx("code",{children:"prov:wasAttributedTo"}),") on every chat turn uses this URI."]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Nickname for this agent"}),l.jsx("input",{className:"v10-form-input",type:"text",value:b,onChange:D=>k(D.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),l.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:"Free-form human label rendered as the agent's name in chips, lists, and rdfs:label triples. Doesn't affect attribution — only changes how you appear to others."})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[i?l.jsx("button",{className:"v10-modal-btn",onClick:i,disabled:S,children:"Cancel"}):l.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),l.jsx("button",{className:"v10-modal-btn primary",onClick:R,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const X1='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function ls(e,t){const n=w.useRef(null),r=w.useRef(null);w.useEffect(()=>{if(e)return r.current=document.activeElement??null,queueMicrotask(()=>{const o=n.current;if(!o)return;const c=o.querySelector(X1),p=o.querySelector("[autofocus]")??c;p?p.focus():(o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1"),o.focus())}),()=>{var o,c;(c=(o=r.current)==null?void 0:o.focus)==null||c.call(o)}},[e]),w.useEffect(()=>{if(!e)return;const o=c=>{if(c.key==="Escape"){c.stopPropagation(),t();return}if(c.key!=="Tab")return;const d=n.current;if(!d)return;const p=Array.from(d.querySelectorAll(X1)).filter(v=>v.offsetParent!==null||v===document.activeElement);if(p.length===0){c.preventDefault(),d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus();return}const h=p[0],g=p[p.length-1],m=document.activeElement;if(m===d){c.preventDefault(),(c.shiftKey?g:h).focus();return}c.shiftKey&&m===h?(c.preventDefault(),g.focus()):!c.shiftKey&&m===g&&(c.preventDefault(),h.focus())};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[e,t]);const i=w.useCallback(o=>{o.target===o.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:i}}const ko=80,oI=/<\/?[a-z][^>]*>/i,lI=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,cI=/[a-z0-9]/i;function uI(e){let t="",n=0;for(;n<e.length;){if(e.charCodeAt(n)===60){const i=e.charCodeAt(n+1);if(i>=65&&i<=90||i>=97&&i<=122||i===47){const c=e.indexOf(">",n+1);if(c===-1)break;n=c+1;continue}}t+=e[n],n+=1}return t}function oC(e){if(typeof e!="string")return"";let t=uI(e);return t=t.replace(/[<>]/g,""),t=t.replace(lI,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>ko&&(t=t.slice(0,ko)),t}function J1(e){const t=oC(e);return t?cI.test(t)?oI.test(e)?"HTML tags are not allowed in the name — they have been stripped automatically.":/[<>]/.test(e)?"Angle brackets (< or >) are not allowed in the name — they and any text consumed by an unclosed tag have been stripped automatically.":e.length>ko?`Name was trimmed to ${ko} characters (was ${e.length}).`:null:"Name must contain at least one letter or digit.":"Enter a name with at least one letter or digit."}function ew(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function dI({open:e,onClose:t}){var mt,Se;const[n,r]=w.useState(""),[i,o]=w.useState(""),[c,d]=w.useState("curated"),[p,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[v,b]=w.useState("community"),k=JL(),[j,C]=w.useState(((mt=k[0])==null?void 0:mt.slug)??"coding-project"),[S,N]=w.useState(!1),[A,O]=w.useState("off"),[M,T]=w.useState("7d"),[L,B]=w.useState("100k"),[_,R]=w.useState(!1),[z,F]=w.useState(""),[Y,D]=w.useState(null),[q,G]=w.useState(null),[W,Q]=w.useState(null),[H,$]=w.useState(null),[U,Z]=w.useState(""),[I,ae]=w.useState(!0),[le,oe]=w.useState(!1),{setContextGraphs:we,contextGraphs:Ee,setActiveProject:Oe}=Mr(),{openTab:He}=gn(),{setStage:ke,stage:ve}=vv(),Re=()=>{ae(!0),oe(!1),yc().then(X=>{Q(X.agentAddress),oe(!1)}).catch(()=>{Q(null),oe(!0)}).finally(()=>ae(!1))};w.useEffect(()=>{e&&(G(null),Re())},[e]);const Ge=ls(e&&!H,t),We=ls(e&&!!H,()=>{$(null),Z(""),G(null),r(""),o(""),t()});if(!e)return null;const de=oC(n),Pe=ew(de),Ze=W&&Pe?`${W}/${Pe}`:Pe?`<agent-address>/${Pe}`:"",ot=n?J1(n):null,be=X=>{r(X)},bt=async()=>{const X=de;if(!X||ot)return;R(!0),D(null),G(null),F(g?"Registering context graph on the network…":"Creating context graph locally…");const fe=ew(X);if(!W){D("Agent identity is still loading. Please wait a moment and try again."),R(!1);return}const Ne=`${W}/${fe}`;try{const ie=setTimeout(()=>F(g?"On-chain registration in progress — this can take up to 30s…":"Setting up local context graph…"),5e3),V=c==="curated"?1:0,xe=p==="curator-only"?0:1,Le=c==="curated"?{accessPolicy:V,publishPolicy:xe,allowedAgents:W?[W]:[],register:g}:{accessPolicy:V,publishPolicy:xe,register:g},Ae=await vO(Ne,X,i.trim()||void 0,Le);if(clearTimeout(ie),g&&Ae.registered===!1){const Te=`On-chain registration failed: ${Ae.registerError??"unknown error"}. Project is created locally and usable for everything except Verifiable Memory publishing. Retry registration from the project's Settings when ready.`;console.warn("[CreateProjectModal]",Te),G(Te)}if(v==="community"||v==="agent")try{F(`Installing '${j}' ontology…`),await tI(Ae.created,j)}catch(Te){console.warn("[CreateProjectModal] ontology install failed:",Te),F(`Context graph created, but ontology install failed: ${(Te==null?void 0:Te.message)??Te}`)}let De=!0;try{F("Publishing context graph manifest…"),await nI(Ae.created,{})}catch(Te){De=!1,console.warn("[CreateProjectModal] manifest publish failed:",Te),F(`Context graph created, but manifest publish failed: ${(Te==null?void 0:Te.message)??Te}`)}F("Refreshing context graph list…");const{contextGraphs:Qe}=await rf();we(Qe??[]),Oe(Ae.created),He({id:`project:${Ae.created}`,label:X,closable:!0}),ve<2&&ke(2),De?(Z(X),$(Ae.created),F("")):setTimeout(()=>{r(""),o(""),F(""),t()},2500)}catch(ie){const V=(ie==null?void 0:ie.message)||"Failed to create context graph";V.includes("already exists")||V.includes("409")?D("A context graph with this ID already exists. Try a different name."):(V.includes("taking longer"),D(V)),F("")}finally{R(!1)}},at=Ee.length===0;function rn(){$(null),Z(""),G(null),r(""),o(""),t()}return H?l.jsx("div",{className:"v10-modal-overlay",onClick:We.onBackdropClick,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",ref:We.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-wire-modal-title",children:[l.jsx("button",{type:"button",className:"v10-modal-close",onClick:rn,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4},children:"×"}),l.jsxs("div",{className:"v10-modal-header",children:[l.jsxs("div",{id:"dkg-wire-modal-title",className:"v10-modal-title",children:["Wire workspace for ",U]}),l.jsx("div",{className:"v10-modal-subtitle",children:"Context graph created. Now wire a local workspace so you can plan it from your own Cursor."})]}),l.jsxs("div",{className:"v10-modal-body",children:[q&&l.jsx("div",{className:"v10-modal-warning",children:q}),l.jsx(sC,{contextGraphId:H,projectName:U,variant:"create",onDone:rn})]})]})}):l.jsx("div",{className:"v10-modal-overlay",onClick:Ge.onBackdropClick,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",ref:Ge.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[l.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close create context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),l.jsxs("div",{className:"v10-modal-header",children:[l.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),l.jsx("div",{id:"dkg-create-cg-subtitle",className:"v10-modal-subtitle",children:"A context graph gives your agent structured memory — a place to draft, share, and publish knowledge."})]}),l.jsxs("div",{className:"v10-modal-body",children:[Y&&l.jsx("div",{className:"v10-modal-error",children:Y}),q&&l.jsx("div",{className:"v10-modal-warning",children:q}),at&&l.jsxs("div",{className:"v10-modal-tip",children:[l.jsx("div",{className:"v10-modal-tip-title",children:"First context graph tip"}),"This is your agent's first memory space. Consider importing any existing knowledge your agent has — notes, documents, conversation logs — so it can build on what it already knows."]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-name",children:"Context Graph Name"}),l.jsx("input",{id:"dkg-cg-name",name:"dkg-cg-name",className:"v10-form-input",type:"text",placeholder:"e.g. Pharma Drug Interactions",value:n,onChange:X=>be(X.target.value),autoFocus:!0,maxLength:ko,"aria-invalid":ot?"true":"false","aria-describedby":"dkg-cg-name-help",autoComplete:"off",spellCheck:!0}),l.jsx("div",{id:"dkg-cg-name-help",style:{marginTop:4,fontSize:11,color:ot?"var(--red, #f87171)":"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:ot||(Ze?`ID: did:dkg:context-graph:${Ze}`:`${n.length}/${ko} characters`)})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-description",children:"Description"}),l.jsx("textarea",{id:"dkg-cg-description",name:"dkg-cg-description",className:"v10-form-textarea",placeholder:"What should your agent remember? Describe the domain, goals, or context...",value:i,onChange:X=>o(X.target.value),"aria-label":"Context graph description"})]}),l.jsx("div",{className:"v10-form-divider"}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Sharing"}),l.jsxs("div",{className:"v10-form-radio-group",children:[l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:c==="curated",onChange:()=>d("curated")}),"Invite-only — only invited agents can read and subscribe"]}),l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:c==="public",onChange:()=>d("public")}),"Open — publicly discoverable; anyone can subscribe"]})]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Contribution"}),l.jsxs("div",{className:"v10-form-radio-group",children:[l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:p==="curator-only",onChange:()=>h("curator-only")}),"Curators-only — only the curator may publish to Verifiable Memory"]}),l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:p==="open",onChange:()=>h("open")}),"Open — any wallet may publish to Verifiable Memory (not just members)"]})]}),c==="curated"&&p==="open"&&l.jsxs("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:["Note: an invite-only sharing graph with open contribution still lets ",l.jsx("em",{children:"any"})," wallet publish to Verifiable Memory — the on-chain publish check is not gated by the allowlist. See SPEC_CG_MEMORY_MODEL §2.5."]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"On-chain registration"}),l.jsxs("label",{className:"v10-form-radio",style:{display:"flex",alignItems:"flex-start",gap:8},children:[l.jsx("input",{type:"checkbox",checked:g,onChange:X=>m(X.target.checked),style:{marginTop:3}}),l.jsxs("span",{children:["Register on chain now (required for Verifiable Memory publishing)",l.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:"Off by default — the project is created locally and can be registered later from its Settings tab when your wallet is funded and a working RPC is configured."})]})]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Ontology"}),l.jsxs("div",{className:"v10-form-radio-group",children:[l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:v==="community",onChange:()=>b("community")}),"Choose a starter — install one of the bundled context-graph-type ontologies"]}),v==="community"&&l.jsxs("div",{style:{marginLeft:24,marginTop:4,marginBottom:8},children:[l.jsx("select",{className:"v10-form-select",value:j,onChange:X=>C(X.target.value),children:k.map(X=>l.jsx("option",{value:X.slug,children:X.displayName},X.slug))}),l.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(Se=k.find(X=>X.slug===j))==null?void 0:Se.description})]}),l.jsxs("label",{className:"v10-form-radio",children:[l.jsx("input",{type:"radio",checked:v==="agent",onChange:()=>b("agent")}),"Let agent decide — defaults to the closest starter (v1)"]}),v==="agent"&&l.jsxs("div",{className:"v10-form-radio-desc",style:{marginLeft:24,marginTop:4,marginBottom:8},children:["v1 installs the ",l.jsx("code",{children:j})," starter as a sensible default. A future release will have the agent draft a context-graph-specific ontology by extending the closest starter from the context graph description."]}),l.jsxs("label",{className:"v10-form-radio",style:{opacity:.5},children:[l.jsx("input",{type:"radio",checked:v==="upload",onChange:()=>b("upload"),disabled:!0}),"Upload an ontology file (.ttl, .owl, .rdf) ",l.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]})]})]}),l.jsxs("div",{className:"v10-form-advanced-toggle",onClick:()=>N(!S),children:[l.jsx("span",{className:`v10-form-adv-chevron ${S?"open":""}`,children:"▸"}),l.jsx("span",{children:"Advanced settings"})]}),S&&l.jsxs("div",{className:"v10-form-advanced-body",style:{opacity:.5,pointerEvents:"none"},children:[l.jsxs("div",{className:"v10-form-group",children:[l.jsxs("label",{className:"v10-form-label",children:["Consensus Quorum ",l.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),l.jsxs("select",{className:"v10-form-select",value:A,disabled:!0,children:[l.jsx("option",{value:"off",children:"Off — no consensus verification required"}),l.jsx("option",{value:"2of3",children:"2 of 3 — lightweight consensus"}),l.jsx("option",{value:"3of5",children:"3 of 5 — standard consensus (recommended for teams)"}),l.jsx("option",{value:"custom",children:"Custom — set your own M of N"})]})]}),l.jsxs("div",{className:"v10-form-group",children:[l.jsxs("label",{className:"v10-form-label",children:["SWM TTL ",l.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),l.jsxs("select",{className:"v10-form-select",value:M,disabled:!0,children:[l.jsx("option",{value:"7d",children:"7 days (default)"}),l.jsx("option",{value:"1h",children:"1 hour"}),l.jsx("option",{value:"1d",children:"1 day"}),l.jsx("option",{value:"30d",children:"30 days"})]})]}),l.jsxs("div",{className:"v10-form-group",style:{marginBottom:0},children:[l.jsxs("label",{className:"v10-form-label",children:["SWM Size Cap ",l.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),l.jsxs("select",{className:"v10-form-select",value:L,disabled:!0,children:[l.jsx("option",{value:"100k",children:"100K triples (default)"}),l.jsx("option",{value:"10k",children:"10K triples"}),l.jsx("option",{value:"1m",children:"1M triples"})]})]})]})]}),l.jsxs("div",{className:"v10-modal-footer",children:[l.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Cancel"}),le&&l.jsx("button",{className:"v10-modal-btn",onClick:Re,disabled:I,children:I?"Retrying…":"Retry Loading Agent"}),l.jsx("button",{className:"v10-modal-btn primary",onClick:bt,disabled:!n.trim()||!!J1(n)||_||!W||I,children:_?z||"Creating…":W?"Create Context Graph":le?"Agent unavailable":"Loading agent…"})]})]})})}function wv(e){return{agentDid:e.agentDid,peerId:e.peerId}}function cs(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function tn(e){let t=e.trim().replace(/^["']|["']$/g,"");t.startsWith("<")&&t.endsWith(">")&&(t=t.slice(1,-1));const n="did:dkg:agent:";if(t.length>=n.length&&t.slice(0,n.length).toLowerCase()===n.toLowerCase()){const i=t.slice(n.length),o=/^(0x[a-fA-F0-9]{40})$/i.exec(i);return o?`${n}${o[1].toLowerCase()}`:`${n}${i}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function lf(e,t){var n,r;return e.callerInvolved===!0?!0:e.callerInvolved===!1||!((n=t==null?void 0:t.agentDid)!=null&&n.trim())?!1:!!((r=e.curator)!=null&&r.trim()&&tn(e.curator)===tn(t.agentDid))}function fI(e,t,n){const r=e.filter(i=>lf(i,t));if(n&&!r.some(i=>i.id===n)){const i=e.find(o=>o.id===n);if(i)return[i,...r]}return r}function pI(e,t){return!(lf(e,t)||cs(e.accessPolicy)!=="public")}function hI(e){return e.subscribed===!0||e.synced===!0?"project":"catalogue"}function mI(e){return e.alreadyMember===!0||e.autoApproved===!0||e.status==="approved"||e.status==="already-member"}const tw=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function gI(e){var b;const t=e.trim().replace(/\\n/g,`
|
|
1077
|
+
`),n=t.split(`
|
|
1078
|
+
`).map(k=>k.trim()).filter(Boolean),r=n[0]??"",i=n.slice(1).join(" ").trim(),o=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),c=((b=o==null?void 0:o[1])==null?void 0:b.replace(/\s+/g,""))??null,d=i.replace(/\s+/g,""),p=d.startsWith("/")?d:c;let h=null;if(p){const k=p.match(/\/p2p\/([^/]+)$/);k&&tw.test(k[1])&&(h=k[1])}else for(const k of[i,...n.slice(1)]){const j=k.trim();if(tw.test(j)){h=j;break}}let g=r;c&&g.includes(c)&&(g=g.replace(c,"")),g=g.replace(/\s*@\s*$/,"").trim();const v=(n.length>1||i.length>0)&&h===null&&p===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:p,hasUnparsedExtra:v}}function vI(e,t){return!e.hasUnparsedExtra&&t.some(n=>n.id===e.cgId&&cs(n.accessPolicy)==="public")}function nw(e,t){const n=gI(e);return vI(n,t)?{kind:"publicSubscribe",invite:n,validationError:aw(n,{allowBareContextGraphId:!0}),idleLabel:"Subscribe",sendingLabel:"Subscribing…"}:{kind:"privateJoin",invite:n,validationError:aw(n),idleLabel:"Request to Join",sendingLabel:"Sending request…"}}async function rw(e){if(e.curatorPeerId){await pO(e.curatorPeerId).catch(()=>{});return}e.legacyMultiaddr&&(console.warn("[DKG] This invite uses a legacy multiaddr (deprecated). Ask the curator to regenerate using the current Share Context Graph modal — V10 invites carry a peer id and resolve via DHT, so they survive relay rotations."),await fO(e.legacyMultiaddr).catch(()=>{}))}function aw(e,t={}){if(!e.cgId)return"Missing context graph ID";if(e.hasUnparsedExtra)return"Invite contains a second line that is not a valid peer ID (12D3Koo…) or multiaddr (/ip4/…). Check for typos.";if(!e.curatorPeerId&&!e.legacyMultiaddr&&!t.allowBareContextGraphId)return"This invite is missing the curator peer id. Ask the curator to regenerate the invite from the Share Context Graph dialog.";if(e.legacyMultiaddr){if(!e.legacyMultiaddr.startsWith("/"))return"Invalid curator multiaddr";if(!e.legacyMultiaddr.includes("/p2p/"))return"Curator multiaddr is missing peer ID"}return null}function yI(e){if(e instanceof Hn&&e.status===502){const t=bI(e.body);if(t.length===0)return"Request signed, but we couldn't deliver it to any reachable curator. Try again in a moment once your node has discovered more peers, or ask the curator for an updated invite.";const n=t.join("; "),r=t.some(xI),i=r?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",o=wI(n,r);return o?`${i} Reason: ${n}. ${o}`:`${i} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function bI(e){if(!e||typeof e!="object")return[];const t=e.errors;return Array.isArray(t)?t.filter(n=>typeof n=="string"&&n.length>0):[]}function xI(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function wI(e,t){return t?/scope mismatch/i.test(e)?"This usually means your daemon's network config has a stale ContextGraphsHub address — pull the latest release (or `git pull && pnpm install && pnpm run build:runtime`) and try again.":/unknown CG/i.test(e)?"The curator doesn't recognise this context graph id — double-check the invite, or ask the curator to share an updated one.":null:/not curator/i.test(e)?"Your node reached other peers, but none of them curate this context graph. Make sure the curator's daemon is online and the invite carries the right curator peer id.":null}function kI({open:e,onClose:t,initialContextGraphId:n}){const[r,i]=w.useState(n??""),[o,c]=w.useState("idle"),[d,p]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(!1),[b,k]=w.useState(null),[j,C]=w.useState(""),{contextGraphs:S,setContextGraphs:N,setActiveProject:A}=Mr(),{openTab:O}=gn();w.useEffect(()=>{n&&i(n)},[n]),w.useEffect(()=>{e||(i(n??""),p(null),c("idle"),g(null),v(!1))},[e,n]);const M=w.useCallback(Q=>{A(Q.id),O({id:`project:${Q.id}`,label:Q.name||Q.id,closable:!0})},[A,O]),T=w.useCallback(async(Q,H)=>{const{contextGraphs:$}=await rf(),U=$??[];N(U);const Z=U.find(I=>I.id===Q)??H;return Z&&M(Z),Z},[N,M]),L=w.useCallback(async Q=>{c("approved");try{const H=await T(Q);H&&(C(H.name??Q),k(Q))}catch{}},[T]),B=w.useCallback(Q=>{var $;if(!(!h||Q.type!=="join_approved"&&Q.type!=="join_rejected"||(($=Q.data)==null?void 0:$.contextGraphId)!==h)){if(Q.type==="join_rejected"){c("rejected");return}L(h)}},[h,L]);ms(B);const _=ls(e&&!b,t),R=ls(e&&!!b,()=>{k(null),C(""),t()});if(!e)return null;const z=async()=>{const Q=nw(r,S);if(Q.validationError){p(Q.validationError);return}const{cgId:H,curatorPeerId:$}=Q.invite;if(p(null),Q.kind==="publicSubscribe"){c("sending");try{const Z=S.find(I=>I.id===H);await rw(Q.invite),await fM(H,{syncMode:m?"always-on":"on-demand"}),await T(H,Z),t()}catch(Z){p(Z instanceof Error?Z.message:"Could not subscribe to this public context graph."),c("idle")}return}const U=S.find(Z=>Z.id===H);if(U){M(U),t();return}c("sending");try{await rw(Q.invite);const Z=await bO(H),I=await yc().then(le=>le.name).catch(()=>{}),ae=await xO(H,{delegation:Z.delegation,agentName:I,curatorPeerId:$??void 0});if(g(H),mI(ae)){await L(H);return}c("pending")}catch(Z){p(yI(Z)),c("idle")}};function F(){k(null),C(""),t()}if(b)return l.jsx("div",{className:"v10-modal-overlay",onClick:R.onBackdropClick,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",ref:R.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[l.jsx("button",{type:"button",className:"v10-modal-close",onClick:F,"aria-label":"Close wire workspace dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),l.jsxs("div",{className:"v10-modal-header",children:[l.jsxs("div",{id:"dkg-join-wire-title",className:"v10-modal-title",children:["Wire workspace for ",j]}),l.jsx("div",{className:"v10-modal-subtitle",children:"Curator approved. Now wire a local workspace so this Cursor can collaborate on the context graph."})]}),l.jsx("div",{className:"v10-modal-body",children:l.jsx(sC,{contextGraphId:b,projectName:j,variant:"join",onDone:F})})]})});const Y=o==="sending",D=o==="pending",q=o==="approved",G=o==="rejected",W=nw(r,S);return l.jsx("div",{className:"v10-modal-overlay",onClick:_.onBackdropClick,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",ref:_.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-cg-title","aria-describedby":"dkg-join-cg-subtitle",children:[l.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close join context graph dialog",title:"Close (Esc)",style:{position:"absolute",top:12,right:12,background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:18,lineHeight:1,padding:4,zIndex:1},children:"×"}),l.jsxs("div",{className:"v10-modal-header",children:[l.jsx("div",{id:"dkg-join-cg-title",className:"v10-modal-title",children:"Join a Context Graph"}),l.jsx("div",{id:"dkg-join-cg-subtitle",className:"v10-modal-subtitle",children:"Enter a discovered public Context Graph ID to subscribe, or paste a curator invite for a private graph."})]}),l.jsxs("div",{className:"v10-modal-body",children:[d&&l.jsx("div",{className:"v10-modal-error",children:d}),D&&l.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(59, 130, 246, 0.08)",border:"1px solid rgba(59, 130, 246, 0.25)",color:"var(--accent-primary, #3b82f6)"},children:"Join request sent. Waiting for the curator to approve — this modal will move forward automatically once they do."}),q&&l.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(34, 197, 94, 0.08)",border:"1px solid rgba(34, 197, 94, 0.25)",color:"var(--accent-green)"},children:"Approved! Loading context graph…"}),G&&l.jsx("div",{style:{padding:"10px 14px",borderRadius:8,marginBottom:16,fontSize:12,background:"rgba(245, 158, 11, 0.08)",border:"1px solid rgba(245, 158, 11, 0.25)",color:"var(--accent-warning, #f59e0b)"},children:"The curator declined this join request."}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-invite",children:"Context Graph ID or Invite Code"}),l.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Public: paste a Context Graph ID
|
|
1079
|
+
|
|
1080
|
+
Private: paste the curator invite
|
|
1081
|
+
my-context-graph-abc123
|
|
1082
|
+
12D3KooW...`,value:r,onChange:Q=>i(Q.target.value),autoFocus:!0,rows:3,disabled:Y||D||q,style:{fontFamily:"var(--font-mono)",fontSize:11},"aria-label":"Context graph invite code",autoComplete:"off",spellCheck:!1})]}),W.kind==="publicSubscribe"&&l.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:8,fontSize:12,color:"var(--text-secondary)",cursor:Y?"default":"pointer"},children:[l.jsx("input",{type:"checkbox",checked:m,onChange:Q=>v(Q.target.checked),disabled:Y,"aria-label":"Keep this Context Graph synchronized after restart"}),l.jsxs("span",{children:["Keep synchronized after restart",l.jsx("span",{style:{display:"block",color:"var(--text-tertiary)",marginTop:2},children:"Off by default. This node otherwise syncs the graph only when you open it."})]})]})]}),l.jsxs("div",{className:"v10-modal-footer",children:[l.jsx("button",{className:"v10-modal-btn",onClick:t,children:D||q?"Close":"Cancel"}),l.jsx("button",{className:"v10-modal-btn primary",onClick:z,disabled:!r.trim()||Y||D||q,children:Y?W.sendingLabel:D?"Awaiting approval…":q?"Approved":W.idleLabel})]})]})})}const lC="v10:hiddenProjectIds",lg="v10:hidden-projects-change";function im(){try{const e=localStorage.getItem(lC);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function iw(e){try{localStorage.setItem(lC,JSON.stringify([...e])),window.dispatchEvent(new Event(lg))}catch{}}function kv(){const[e,t]=w.useState(()=>im());w.useEffect(()=>{const i=()=>t(im());return window.addEventListener(lg,i),window.addEventListener("storage",i),()=>{window.removeEventListener(lg,i),window.removeEventListener("storage",i)}},[]);const n=w.useCallback(i=>{const o=new Set(im());o.add(i),iw(o)},[]),r=w.useCallback(()=>{iw(new Set)},[]);return{hidden:e,hide:n,unhideAll:r}}function sw({cg:e,isActive:t,onSelect:n,onHide:r}){return l.jsx("div",{className:"v10-tree-section",children:l.jsxs("div",{className:`v10-tree-section-header ${t?"active":""}`,onClick:n,children:[l.jsx("span",{className:"v10-tree-project-dot"}),l.jsx("span",{className:"v10-tree-section-label",children:e.name||e.id.slice(0,16)}),l.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:i=>{i.stopPropagation(),r()},children:"×"})]})})}function SI({cg:e,isBrowsing:t,onBrowse:n,onSubscribe:r,onHide:i}){const o=e.name||e.id.slice(0,16);return l.jsx("div",{className:"v10-tree-section",children:l.jsxs("div",{className:`v10-tree-section-header catalogue ${t?"active":""}`,children:[l.jsx("span",{className:"v10-tree-project-dot"}),l.jsx("span",{className:"v10-tree-section-label",children:o}),l.jsx("button",{type:"button",className:"v10-tree-catalogue-btn","aria-label":`Browse ${o}`,onClick:n,children:"Browse"}),l.jsx("button",{type:"button",className:"v10-tree-catalogue-btn primary","aria-label":`Subscribe to ${o}`,onClick:r,children:"Subscribe"}),l.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:i,children:"×"})]})})}function jI(e){switch(e){case"chat_ready":return"var(--accent-green, #22c55e)";case"connecting":return"var(--accent-yellow, #eab308)";case"degraded":case"bridge_offline":return"var(--accent-orange, #f97316)";case"available":case"coming_soon":default:return"var(--text-tertiary, #6b7280)"}}function CI(){const[e,t]=w.useState([]),[n,r]=w.useState(null),i=w.useCallback(()=>{sf().then(o=>{t(o.integrations),r(null)}).catch(o=>r(o.message))},[]);return bc(i,3e4),l.jsxs("div",{className:"v10-tree-items",style:{display:"block"},children:[l.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 12px 2px 24px"},children:"Agents"}),n&&l.jsx("div",{style:{fontSize:11,color:"var(--accent-orange, #f97316)",padding:"4px 12px 4px 24px"},children:n}),!n&&e.length===0&&l.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 12px 4px 24px",fontStyle:"italic"},children:"No agents detected."}),e.map(o=>l.jsxs("div",{className:"v10-tree-item",title:o.detail,style:{cursor:"default"},children:[l.jsx("span",{"aria-label":o.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:jI(o.status),flexShrink:0}}),l.jsx("span",{className:"v10-tree-item-label",children:o.name}),l.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:o.statusLabel})]},o.id))]})}function NI(){const e=tr(H=>H.leftSectionMyProjectsOpen),t=tr(H=>H.leftSectionIntegrationsOpen),n=tr(H=>H.toggleLeftSectionMyProjects),r=tr(H=>H.toggleLeftSectionIntegrations),i=w.useId(),o=w.useId(),{openTab:c,activeTabId:d,setActiveTab:p}=gn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:v,setActiveProject:b}=Mr(),k=vv(H=>H.stage),[j,C]=w.useState("explorer"),{hidden:S,hide:N,unhideAll:A}=kv(),O=of().data,M=O?wv(O):null,T=h.filter(H=>!S.has(H.id)),L=T.filter(H=>lf(H,M)),B=T.filter(H=>pI(H,M)),_=h.length-T.length,[R,z]=w.useState(!1),[F,Y]=w.useState(!1),[D,q]=w.useState(),G=w.useCallback(H=>{q(H),Y(!0)},[]),W=w.useCallback(()=>{Y(!1),q(void 0)},[]),Q=w.useCallback(()=>{m(!0),kn.fetchContextGraphs().then(({contextGraphs:H})=>g(H??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return bc(Q,6e4),ms(w.useCallback(H=>{(H.type==="join_approved"||H.type==="project_synced")&&Q()},[Q])),l.jsxs("div",{className:"v10-panel-left",children:[l.jsxs("div",{style:{display:"flex",gap:4,padding:"8px 8px 4px"},children:[l.jsx("button",{className:"v10-new-project-btn",onClick:()=>z(!0),children:"+ New Context Graph"}),l.jsx("button",{className:"v10-new-project-btn",onClick:()=>G(),children:"↗ Join Context Graph"})]}),l.jsxs("div",{className:"v10-tree-header",children:[l.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>C("explorer"),children:"Context Graphs"}),l.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>C("oracle"),children:"Context Oracle"})]}),j==="explorer"&&l.jsxs("div",{className:"v10-tree-content",children:[l.jsxs("div",{className:`v10-tree-dashboard ${d==="dashboard"?"active":""}`,onClick:()=>{p("dashboard"),b(null)},children:[l.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&l.jsxs("div",{className:"v10-journey-empty-card",children:[l.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),l.jsx("div",{className:"v10-jec-hint",children:k===0?"Connect an agent to get started.":"Create your first context graph to give your agent structured memory."}),k===1&&l.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>z(!0),children:"+ Create First Context Graph"})]}),(h.length>0||k>=2)&&l.jsxs("div",{className:"v10-peer-group",children:[l.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":e,"aria-controls":i,onClick:n,children:[l.jsx(ig,{size:14,className:`v10-peer-group-chevron ${e?"expanded":""}`,"aria-hidden":"true"}),l.jsx("span",{className:"v10-peer-group-label",children:"My Context Graphs"})]}),e&&l.jsx("div",{id:i,className:"v10-peer-group-body",children:L.length===0?l.jsx("div",{className:"v10-tree-item",style:{cursor:"default",color:"var(--text-tertiary)",fontStyle:"italic"},children:l.jsx("span",{className:"v10-tree-item-label",children:"No context graphs in this view yet."})}):L.map(H=>l.jsx(sw,{cg:H,isActive:v===H.id,onSelect:()=>{b(H.id),c({id:`project:${H.id}`,label:H.name||H.id.slice(0,16),closable:!0})},onHide:()=>{N(H.id),v===H.id&&b(null)}},H.id))})]}),_>0&&l.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:A,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",_," hidden context graph",_!==1?"s":""]}),k>=1&&l.jsxs("div",{className:"v10-peer-group",children:[l.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":t,"aria-controls":o,onClick:r,children:[l.jsx(ig,{size:14,className:`v10-peer-group-chevron ${t?"expanded":""}`,"aria-hidden":"true"}),l.jsx("span",{className:"v10-peer-group-label",children:"Integrations"})]}),t&&l.jsx("div",{id:o,className:"v10-peer-group-body",children:l.jsx(CI,{})})]})]}),j==="oracle"&&l.jsxs("div",{className:"v10-tree-content",children:[B.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),B.map(H=>{const $=()=>{N(H.id),v===H.id&&b(null)};return hI(H)==="catalogue"?l.jsx(SI,{cg:H,isBrowsing:d===`project:${H.id}`,onBrowse:()=>{b(null),c({id:`project:${H.id}`,label:H.name||H.id.slice(0,16),closable:!0})},onSubscribe:()=>G(H.id),onHide:$},H.id):l.jsx(sw,{cg:H,isActive:v===H.id,onSelect:()=>{b(H.id),c({id:`project:${H.id}`,label:H.name||H.id.slice(0,16),closable:!0})},onHide:$},H.id)})]}),B.length===0&&l.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No discovered public Context Graphs yet. Public graphs appear here as soon as your node discovers them; use ",l.jsx("strong",{children:"Join Context Graph"})," to subscribe by ID."]}),_>0&&l.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:A,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",_," hidden context graph",_!==1?"s":""]})]}),l.jsx(dI,{open:R,onClose:()=>z(!1)}),l.jsx(kI,{open:F,onClose:W,initialContextGraphId:D})]})}function vr(e,t=[],n=0){const[r,i]=w.useState(null),[o,c]=w.useState(!0),[d,p]=w.useState(null),h=w.useRef(!0),g=w.useCallback(async()=>{try{const m=await e();h.current&&(i(m),p(null))}catch(m){if(h.current){if((m==null?void 0:m.status)===401){const v=!!window.__DKG_TOKEN__,b=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(v&&!b){sessionStorage.setItem("__dkg_401_reloaded","1"),window.location.reload();return}p("Authentication expired — please refresh the page.");return}p(m.message)}}finally{h.current&&c(!1)}},t);return w.useEffect(()=>{h.current=!0,c(!0),g();let m=null;const v=()=>{n<=0||m||(m=setInterval(g,n))},b=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?b():(g(),v()))};return(typeof document>"u"||!document.hidden)&&v(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,b(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:r,loading:o,error:d,refresh:g}}function zQ(e){return e==null?"—":e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<1073741824?`${(e/1048576).toFixed(1)} MB`:`${(e/1073741824).toFixed(2)} GB`}function ow(e){if(e==null)return"—";if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;if(e<36e5)return`${Math.floor(e/6e4)}m ${Math.floor(e%6e4/1e3)}s`;const t=Math.floor(e/36e5),n=Math.floor(e%36e5/6e4);return`${t}h ${n}m`}function EI(e,t=new Date){if(e==null||e==="")return"—";const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"—";if(n.toDateString()===t.toDateString())return n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"});const r=new Date(t);if(r.setDate(t.getDate()-1),n.toDateString()===r.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`;const i=t.getTime()-n.getTime();return i>=0&&i<10080*60*1e3?`${n.toLocaleDateString(void 0,{weekday:"short"})} ${n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`:n.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function lw(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function AI(){const e=Mr(m=>m.contextGraphs),t=Mr(m=>m.setContextGraphs),{hidden:n}=kv(),[r,i]=w.useState(null),[o,c]=w.useState(!0),[d,p]=w.useState(()=>e.length===0),h=w.useCallback(()=>{kn.fetchContextGraphs().then(({contextGraphs:m})=>t(m??[])).catch(()=>{}).finally(()=>p(!1))},[t]);return w.useEffect(()=>{h();const m=setInterval(h,6e4);return()=>clearInterval(m)},[h]),ms(w.useCallback(m=>{m.type!=="join_approved"&&m.type!=="join_rejected"&&m.type!=="project_synced"||h()},[h])),w.useEffect(()=>{let m=!0;return c(!0),kn.fetchCurrentAgent().then(v=>{m&&i(wv(v))}).catch(()=>{}).finally(()=>{m&&c(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>lf(m,r)),[e,n,r]),identity:r,identityLoading:o,cgsLoading:d}}const Sv=["http://schema.org/name","http://www.w3.org/2000/01/rdf-schema#label","http://purl.org/dc/terms/title","http://purl.org/dc/elements/1.1/title","http://xmlns.com/foaf/0.1/name"];function cf(e={}){const t={predicates:[...e.extraPredicates??[],...Sv]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function uf(e){if(!e)return"";const t=e.match(/^"([\s\S]*)"(?:\^\^<[^>]+>)?(?:@[A-Za-z0-9-]+)?$/);if(!t)return e;try{return JSON.parse(`"${t[1]}"`)}catch{return t[1]}}const cw="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",TI="http://dkg.io/ontology/profile/QueryCatalog";function Zu(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function vd(e){const t=Nt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function Nt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function mo(e){if(!e)return"—";if(e.startsWith('"'))return uf(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function jv(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=e.lastIndexOf(":"),i=Math.max(t,n,r),o=i>=0?e.slice(i+1):e;try{return decodeURIComponent(o)}catch{return o}}function RI(e){const t=jv(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function _I(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function OI(e,t){return e===t&&vd(t)}function MI(e){const t=RI(e.uri),n=e.types.map(mo).find(r=>r&&r!=="Thing"&&r!=="Entity");return/^urn:dkg:extraction:[^\s]+$/i.test(e.uri)?t?`Extraction ${t}`:"Extraction":n?t&&t!==n?`${n} ${t}`:n:t||mo(e.uri)}function LI(e){for(const n of Sv){const r=e.properties.get(n),i=r==null?void 0:r.find(o=>o.trim().length>0);if(i)return i}const t=mo(e.uri);return e.label&&(e.label!==t||!OI(e.label,e.uri))&&!_I(e.label,e.uri)?e.label:MI(e)}const cC=5e4,Kl=2e4,uC=2e4;function uw(e,t){const n=`did:dkg:context-graph:${e}`,r=t==="wm"?`(
|
|
1083
|
+
STRSTARTS(STR(?g), "${n}/meta/assertion/") ||
|
|
1084
|
+
STRSTARTS(STR(?g), "${n}/meta/_working_memory/")
|
|
1085
|
+
)`:`STRSTARTS(STR(?g), "${n}/meta/_shared_memory/")`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1086
|
+
GRAPH ?g {
|
|
1087
|
+
?catalog a <${TI}> .
|
|
1088
|
+
?s ?p ?o
|
|
1089
|
+
}
|
|
1090
|
+
FILTER(${r})
|
|
1091
|
+
} LIMIT ${Kl}`}function II(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1092
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1093
|
+
FILTER(
|
|
1094
|
+
STRSTARTS(STR(?g), "${t}/") &&
|
|
1095
|
+
(CONTAINS(STR(?g), "/assertion/") || CONTAINS(STR(?g), "/_working_memory/")) &&
|
|
1096
|
+
STR(?g) != "${t}/meta" &&
|
|
1097
|
+
!CONTAINS(STR(?g), "/meta/") &&
|
|
1098
|
+
!STRENDS(STR(?g), "/_meta")
|
|
1099
|
+
)
|
|
1100
|
+
} LIMIT ${cC}`}function DI(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1101
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1102
|
+
FILTER(
|
|
1103
|
+
STRSTARTS(STR(?g), "${t}") &&
|
|
1104
|
+
(STRENDS(STR(?g), "/_shared_memory") || CONTAINS(STR(?g), "/_shared_memory/")) &&
|
|
1105
|
+
STR(?g) != "${t}/meta/_shared_memory" &&
|
|
1106
|
+
!CONTAINS(STR(?g), "/meta/") &&
|
|
1107
|
+
!CONTAINS(STR(?g), "/_shared_memory/staging/") &&
|
|
1108
|
+
?p != <http://dkg.io/ontology/workspaceOwner>
|
|
1109
|
+
)
|
|
1110
|
+
} LIMIT ${Kl}`}function zI(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1111
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1112
|
+
FILTER(
|
|
1113
|
+
STRSTARTS(STR(?g), "${t}") &&
|
|
1114
|
+
!CONTAINS(STR(?g), "/assertion/") &&
|
|
1115
|
+
!CONTAINS(STR(?g), "/_working_memory") &&
|
|
1116
|
+
!CONTAINS(STR(?g), "/_shared_memory") &&
|
|
1117
|
+
!CONTAINS(STR(?g), "_verifiable_memory_meta") &&
|
|
1118
|
+
!STRENDS(STR(?g), "/_meta") &&
|
|
1119
|
+
STR(?g) != "${t}/meta" &&
|
|
1120
|
+
!CONTAINS(STR(?g), "/meta/") &&
|
|
1121
|
+
!CONTAINS(STR(?g), "/_private") &&
|
|
1122
|
+
!CONTAINS(STR(?g), "/_rules")
|
|
1123
|
+
)
|
|
1124
|
+
} LIMIT ${uC}`}function $I(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),i=r.indexOf("/"),o=i>=0?r.slice(0,i):r;if(!(!o||o.startsWith("_")||o==="assertion"||o==="meta"))return o}const dw={wm:"loading",swm:"loading",vm:"loading"},PI={wm:"error",swm:"error",vm:"error"};async function Rl(e,t,n){var r,i;try{const{layerLimit:o,...c}=n??{},d={sparql:e,contextGraphId:t,...c},p=await _d(d),h=((r=p==null?void 0:p.result)==null?void 0:r.bindings)??((i=p==null?void 0:p.results)==null?void 0:i.bindings)??[],g=typeof o=="number"&&h.length>=o;return{triples:h.map(v=>{const b=Zu(v.g);return{subject:Zu(v.s)??"",predicate:Zu(v.p)??"",object:Zu(v.o)??"",subGraph:b?$I(b,t):void 0}}).filter(v=>v.subject&&v.predicate&&v.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function UI(e){var p;const t=new Map,n=new Map,r=new Map,i=new Map,o=new Map;function c(h,g,m){let v=i.get(h);v||(v=new Map,i.set(h,v));let b=v.get(g);if(b||(b=new Set,v.set(g,b)),b.has(m))return!1;b.add(m);let k=o.get(h);return k||(k={working:0,shared:0,verified:0},o.set(h,k)),k[g]++,!0}function d(h){const g=Nt(h);let m=t.get(g);return m||(m={uri:g,label:mo(g),types:[],trustLevel:"working",layers:new Set,subGraphs:new Set,properties:new Map,connections:[],tripleCount:0},t.set(g,m)),m}for(const h of e){const g=d(h.subject);if(g.layers.add(h.layer),h.subGraph&&g.subGraphs.add(h.subGraph),h.predicate===cw){const m=Nt(h.object);g.types.includes(m)||g.types.push(m)}else if(vd(h.object)){const m=Nt(h.object),v=d(m);v.layers.add(h.layer),h.subGraph&&v.subGraphs.add(h.subGraph);const b=n.get(g.uri)??new Set,k=`${h.predicate}\0${m}`;b.has(k)||(b.add(k),n.set(g.uri,b),g.connections.push({predicate:h.predicate,targetUri:m,targetLabel:mo(m)}))}else{const m=r.get(g.uri)??new Set,v=`${h.predicate}\0${h.object}`;if(!m.has(v)){m.add(v),r.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(uf(h.object)),g.properties.set(h.predicate,b)}}}for(const h of t.values())h.label=LI(h),h.layers.has("verified")?h.trustLevel="verified":h.layers.has("shared")?h.trustLevel="shared":h.trustLevel="working";for(const h of e){const g=Nt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const v=vd(h.object)?Nt(h.object):h.object,b=vd(h.object);if(b){const j=t.get(v);if(j&&j.trustLevel!==h.layer)continue}const k=`${g}\0${h.predicate}\0${v}`;if(m&&c(m.uri,h.layer,k),h.predicate===cw){if(v!==g){const j=t.get(v);j&&c(j.uri,h.layer,k)}}else if(b&&v!==g){const j=t.get(v);j&&c(j.uri,h.layer,k)}}for(const h of t.values()){const g=o.get(h.uri);h.tripleCount=g?g[h.trustLevel]:0}for(const h of t.values())for(const g of h.connections)g.targetLabel=((p=t.get(g.targetUri))==null?void 0:p.label)??mo(g.targetUri);return t}const dC=UI;function fC(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function Cv(e,t){const n=(t==null?void 0:t.signalErrors)??!1,r=(t==null?void 0:t.includeQueryCatalog)??!1,[i,o]=w.useState([]),[c,d]=w.useState(!0),[p,h]=w.useState(null),[g,m]=w.useState(!1),[v,b]=w.useState(dw),k=w.useRef(0),j=w.useCallback(async()=>{if(!e)return;const M=++k.current;d(!0),h(null),m(!1),b(dw);try{const T={includeContextGraphPartitions:!0},L={triples:[],ok:!0,truncated:!1},[B,_,R,z,F]=await Promise.all([Rl(II(e),e,{...T,layerLimit:cC}),Rl(DI(e),e,{...T,layerLimit:Kl}),Rl(zI(e),e,{...T,layerLimit:uC}),r?Rl(uw(e,"wm"),e,{...T,layerLimit:Kl}):Promise.resolve(L),r?Rl(uw(e,"swm"),e,{...T,layerLimit:Kl}):Promise.resolve(L)]);if(M!==k.current)return;const Y=[...B.triples.map(H=>({...H,layer:"working"})),...z.triples.map(H=>({...H,layer:"working"})),..._.triples.map(H=>({...H,layer:"shared"})),...F.triples.map(H=>({...H,layer:"shared"})),...R.triples.map(H=>({...H,layer:"verified"}))],D=B.ok&&z.ok,q=_.ok&&F.ok;o(Y),b({wm:D?"ok":"error",swm:q?"ok":"error",vm:R.ok?"ok":"error"});const G=[{ok:D,truncated:B.truncated||z.truncated},{ok:q,truncated:_.truncated||F.truncated},R],W=G.filter(H=>!H.ok).length,Q=G.some(H=>H.truncated);m(W>0&&W<3||Q),h(n&&W===3?"Failed to load memory data":null)}catch(T){M===k.current&&(h(T.message??"Failed to load memory data"),b(PI))}finally{M===k.current&&d(!1)}},[e,r,n]);_o(e,j),w.useEffect(()=>{j()},[j]);const C=w.useMemo(()=>dC(i),[i]),S=w.useMemo(()=>[...C.values()].filter(fC).sort((M,T)=>{const L={verified:0,shared:1,working:2},B=L[M.trustLevel]-L[T.trustLevel];if(B!==0)return B;const _=M.tripleCount??0,R=T.tripleCount??0;return R!==_?R-_:M.label.localeCompare(T.label)}),[C]),N=w.useMemo(()=>{const M=new Set;return i.filter(T=>{const L=`${T.subject}|${T.predicate}|${T.object}`;return M.has(L)?!1:(M.add(L),!0)}).map(({subject:T,predicate:L,object:B,subGraph:_})=>({subject:T,predicate:L,object:B,subGraph:_}))},[i]),A=w.useMemo(()=>{const M=new Map;for(const[T,L]of C)M.set(T,L.trustLevel);return M},[C]),O=w.useMemo(()=>{let M=0,T=0,L=0;for(const B of S)B.trustLevel==="verified"?L++:B.trustLevel==="shared"?T++:M++;return{wm:M,swm:T,vm:L,total:S.length}},[S]);return{entities:C,entityList:S,allTriples:i,graphTriples:N,trustMap:A,counts:O,loading:c,error:p,partial:g,layerStatus:v,refresh:j}}const xc="http://dkg.io/viz/",pC=`${xc}OnChainAnchor`,hC=`${xc}AgentIdentity`,mC=`${xc}anchoredIn`,gC=`${xc}signedBy`,vC=`${xc}consensus`,fw="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",pw="http://schema.org/name",hw="http://schema.org/description";function _l(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function BI(e){const t=e.opId.slice(0,10);try{const r=new Date(e.publishedAt).toISOString().slice(11,16);return`anchor ${t} · ${r}UTC`}catch{return`anchor ${t}`}}function FI(e){if(e.startsWith("did:dkg:agent:")){const t=e.slice(14);return t.startsWith("0x")?t.slice(0,6)+"…"+t.slice(-4):t.slice(0,6)+"…"+t.slice(-6)}return e.length>18?e.slice(0,8)+"…"+e.slice(-6):e}function qI(e){return`PREFIX dkg: <http://dkg.io/ontology/>
|
|
1125
|
+
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1126
|
+
SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
|
|
1127
|
+
GRAPH ?g {
|
|
1128
|
+
?op a dkg:WorkspaceOperation ;
|
|
1129
|
+
dkg:rootEntity ?root ;
|
|
1130
|
+
dkg:publishedAt ?publishedAt ;
|
|
1131
|
+
prov:wasAttributedTo ?agent .
|
|
1132
|
+
}
|
|
1133
|
+
FILTER(
|
|
1134
|
+
STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
|
|
1135
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1136
|
+
)
|
|
1137
|
+
} ORDER BY ?publishedAt LIMIT 2000`}function HI(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),i=r.indexOf("/");if(i<0)return;const o=r.slice(0,i);if(!(!o||o.startsWith("_")))return o}function GI(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function VI(e,t){const n=[],r=new Set;for(const i of e){const o=t?i.roots.filter(d=>t.has(d)):i.roots;if(o.length===0)continue;const c=`urn:dkg:viz:anchor:${i.opId}`;n.push({subject:c,predicate:fw,object:pC,subGraph:i.subGraph}),n.push({subject:c,predicate:pw,object:`"${BI(i)}"`,subGraph:i.subGraph}),n.push({subject:c,predicate:hw,object:`"Published ${i.roots.length} KA${i.roots.length===1?"":"s"} · ${new Date(i.publishedAt).toISOString()}"`,subGraph:i.subGraph});for(const d of o)n.push({subject:d,predicate:mC,object:c,subGraph:i.subGraph}),n.push({subject:d,predicate:vC,object:`"${i.agents.length}-of-${i.agents.length}"`,subGraph:i.subGraph});for(const d of i.agents){const p=d.startsWith("did:")||d.startsWith("12D3")?d:`did:dkg:agent:${d}`,h=`urn:dkg:viz:agent:${encodeURIComponent(p)}`;n.push({subject:c,predicate:gC,object:h,subGraph:i.subGraph}),r.has(h)||(r.add(h),n.push({subject:h,predicate:fw,object:hC,subGraph:i.subGraph}),n.push({subject:h,predicate:pw,object:`"${FI(p)}"`,subGraph:i.subGraph}),n.push({subject:h,predicate:hw,object:`"${p}"`,subGraph:i.subGraph}))}}return n}function WI(e,t){const[n,r]=w.useState([]),[i,o]=w.useState(!1),[c,d]=w.useState(null),p=w.useRef(0);w.useEffect(()=>{if(!e){r([]),o(!1);return}const v=++p.current;o(!0),d(null),(async()=>{var b;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({sparql:qI(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),C=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const N of C){const A=_l(N.op),O=_l(N.root),M=_l(N.agent),T=_l(N.publishedAt),L=_l(N.g);if(!A||!O||!M||!T)continue;let B=S.get(A);B||(B={opId:GI(A),opUri:A,agents:[],roots:[],publishedAt:T,subGraph:L?HI(L,e):void 0},S.set(A,B)),B.roots.includes(O)||B.roots.push(O),B.agents.includes(M)||B.agents.push(M)}if(v!==p.current)return;r([...S.values()].sort((N,A)=>A.publishedAt.localeCompare(N.publishedAt)))}catch(k){if(v!==p.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),r([])}finally{v===p.current&&o(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const v=[];if(t instanceof Set)for(const b of t)v.push(b);else for(const b of t)v.push(b);return v.sort(),v.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>VI(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:i,error:c}}function ZI(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const is={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},ao={Person:{icon:"👤",group:"People"},SoftwareApplication:{icon:"💻",group:"Software"},SoftwareSourceCode:{icon:"📦",group:"Code"},Organization:{icon:"🏢",group:"Organizations"},Event:{icon:"📅",group:"Events"},ChooseAction:{icon:"⚡",group:"Decisions"},DefinedTerm:{icon:"📘",group:"Concepts"},CreativeWork:{icon:"📄",group:"Documents"},Product:{icon:"🪙",group:"Products"},ConversationTurn:{icon:"💬",group:"Conversations"},Thing:{icon:"◆",group:"Other"},Package:{icon:"📦",group:"Packages"},File:{icon:"📄",group:"Files"},Class:{icon:"🔷",group:"Classes"},Interface:{icon:"🔶",group:"Interfaces"},Function:{icon:"ƒ",group:"Functions"},TypeAlias:{icon:"🏷️",group:"Types"},Enum:{icon:"🔢",group:"Enums"},ExternalModule:{icon:"🌐",group:"External Modules"}},QI="http://www.w3.org/ns/prov#wasAttributedTo",Oo="http://dkg.io/ontology/agent/",KI=Oo+"createdBy",YI=Oo+"promotedBy",XI=Oo+"publishedBy",JI=Oo+"createdAt",eD=Oo+"promotedAt",tD=Oo+"publishedAt";function df(e){for(const t of e.connections)if(t.predicate===QI)return t.targetUri;return null}function nD(e,t){const n=t==="created"?KI:t==="promoted"?YI:XI;for(const r of e.connections)if(r.predicate===n)return r.targetUri;return df(e)}function rD(e,t){const n=t==="created"?JI:t==="promoted"?eD:tD,r=e.properties.get(n);return(r==null?void 0:r[0])??null}function mw(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function io(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return(r>=0?e.slice(r+1):e).replace(/([a-z])([A-Z])/g,"$1 $2").replace(/_/g," ")}function ff(e,t){var i,o;if(t)for(const c of e.types){const d=t.forType(c),p=mw(c),h=d.label??p;if(d.icon||d.color||d.label)return{icon:d.icon??((i=ao[p])==null?void 0:i.icon)??ao.Thing.icon,group:d.label??((o=ao[p])==null?void 0:o.group)??ao.Thing.group,color:d.color,type:h}}const n=e.types[0]?mw(e.types[0]):"Entity";return{...ao[n]??ao.Thing,type:n}}const qn={wm:{icon:"◇",color:"#64748b",title:"Working Memory",desc:"Private agent scratchpad — ephemeral, fast local storage",trustLabel:"Working",trustLevel:"working"},swm:{icon:"◈",color:"#f59e0b",title:"Shared Working Memory",desc:"Team workspace — shared proposals, TTL-bounded",trustLabel:"Shared",trustLevel:"shared"},vm:{icon:"◉",color:"#22c55e",title:"Verifiable Memory",desc:"Endorsed, published, on-chain knowledge",trustLabel:"Verifiable",trustLevel:"verified"}};function ua(e,t=2){const n=e==="working"?"wm":e==="shared"?"swm":e==="verified"?"vm":e,r=t!==1;return n==="vm"?r?"Knowledge Assets":"Knowledge Asset":r?"Entities":"Entity"}const er="http://dkg.io/ontology/code/",yC={[er+"Package"]:"#a855f7",[er+"File"]:"#3b82f6",[er+"Class"]:"#22c55e",[er+"Interface"]:"#06b6d4",[er+"Function"]:"#f59e0b",[er+"TypeAlias"]:"#ec4899",[er+"Enum"]:"#ef4444",[er+"ExternalModule"]:"#64748b",[pC]:"#f5a524",[hC]:"#c084fc"},bC={[er+"imports"]:"#60a5fa",[er+"contains"]:"#a855f7",[er+"definedIn"]:"#3b82f6",[er+"exports"]:"#f59e0b",[er+"extends"]:"#22c55e",[er+"implements"]:"#06b6d4",[mC]:"#f5a524",[gC]:"#c084fc",[vC]:"#22c55e"};function Nv(e){return{"https://schema.org/":e,"http://www.w3.org/ns/prov#":e,"http://xmlns.com/foaf/0.1/":e,"http://purl.org/dc/terms/":e}}function aD(e,t){const{color:n}=qn[e],r=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:cf({minZoomForLabels:r?.2:.3}),style:{classColors:yC,predicateColors:bC,namespaceColors:Nv(n),...t&&Object.keys(t).length>0?{nodeColors:t}:{},defaultNodeColor:n,defaultEdgeColor:r?"#4ade80":"#64748b",edgeWidth:r?1.8:1.2,fontSize:r?12:11,gradient:!0,gradientIntensity:r?.65:.4},hexagon:{baseSize:r?13:11,minSize:r?8:7,maxSize:r?42:28,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}}}function iD(e){const t=["http://schema.org/description","http://schema.org/text"];for(const n of t){const r=e.properties.get(n);if(r!=null&&r[0])return r[0]}return null}function sD(e,t,n=2){const r=d=>Nt(d.subject),i=d=>Nt(d.object),o=new Set([e]);let c=new Set([e]);for(let d=0;d<n;d++){const p=new Set;for(const h of t){const g=r(h),m=i(h);c.has(g)&&!o.has(m)&&p.add(m),c.has(m)&&!o.has(g)&&p.add(g)}for(const h of p)o.add(h);if(c=p,c.size===0)break}return t.filter(d=>o.has(r(d))&&o.has(i(d)))}function xC(e,t){const n=t.lastIndexOf("/"),r=t.lastIndexOf("#"),i=t.lastIndexOf(":"),o=Math.max(n,r,i),c=o>=0?t.slice(o+1):t,d=(()=>{try{return decodeURIComponent(c)}catch{return c}})();if(/^urn:dkg:extraction:[^\s]+$/i.test(t)){const p=d.replace(/-/g,"").replace(/_+/g," ").slice(0,12).trim();return p?`Extraction ${p}`:"Extraction"}return d||t}function Ev(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function cg(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?Ev(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function wC(e,t){const n=t.get(Nt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function kC(e,t){if(!Ev(e.object))return!1;const n=t.get(Nt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function SC(e,t){return wC(e,t)||kC(e,t)}function jC(e,t){return wC(e,t)&&kC(e,t)}function ug(e,t){const n=new Set,r=[];for(const i of e){if(jC(i,t))continue;const o=`${Nt(i.subject)}|${i.predicate}|${Nt(i.object)}`;n.has(o)||(n.add(o),r.push(i))}return r}function Av(e){return w.useMemo(()=>{const t=ug(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function CC(e){return w.useMemo(()=>{const t=new Set,n=new Set,r=new Set,i=new Set;let o=0,c=0,d=0,p=0;for(const h of e.allTriples){const g=`${Nt(h.subject)}|${h.predicate}|${Nt(h.object)}`;!jC(h,e.entities)&&!i.has(g)&&(i.add(g),p++),SC(h,e.entities)||(h.layer==="working"&&!t.has(g)?(t.add(g),o++):h.layer==="shared"&&!n.has(g)?(n.add(g),c++):h.layer==="verified"&&!r.has(g)&&(r.add(g),d++))}return{wm:o,swm:c,vm:d,canonical:p}},[e.allTriples,e.entities])}function oD(e,t){const n=qn[t].trustLevel;return w.useMemo(()=>{const r=new Set,i=[];for(const o of e.allTriples){if(o.layer!==n||SC(o,e.entities))continue;const c=`${Nt(o.subject)}|${o.predicate}|${Nt(o.object)}`;r.has(c)||(r.add(c),i.push(o))}return i},[e.allTriples,e.entities,n])}const lD="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function cD(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===lD}function zd(e,t,n){const r=[],i=n==null?void 0:n.focalSubjects;for(const o of e){const c=Nt(o.subject);!t.has(c)&&!(i!=null&&i.has(c))||Ev(o.object)&&!cD(o.predicate)&&!t.has(Nt(o.object))||r.push(o)}return r}const sm="http://dkg.io/ontology/sourceContentType",gw="http://dkg.io/ontology/markdownForm",vw="http://dkg.io/ontology/sourceFile",yw="http://dkg.io/ontology/size";function uD(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):t}function dD(e){const[t,n]=e.split("-"),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${r[i]} ${t}`}function yd(e,t){const n=e.properties.get(t),r=n==null?void 0:n[0];if(!r)return null;const i=r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),o=Date.parse(i);return Number.isNaN(o)?null:o}function fD(e){const t=Date.now()-e;if(t<0)return"just now";const n=Math.floor(t/1e3);if(n<45)return"just now";const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);return o<30?`${o}d ago`:new Date(e).toISOString().slice(0,10)}function pD(e,t=6){if(e==null||e==="")return"—";const n=typeof e=="number"?e:parseFloat(String(e));if(!Number.isFinite(n))return"—";if(n===0)return"0";const i=n.toFixed(t).replace(/\.?0+$/,"");return n>0&&Number(i)===0?`< ${1/Math.pow(10,t)}`:i}function hD(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}function mD(e){if(e==null)return"—";const t=e/100;return`${t%1===0?t.toFixed(0):t.toFixed(1)}%`}function gD(){Xj();const e=tv(o=>{var c;return(c=o.nodeStatus)==null?void 0:c.nodeRole}),t=gn(o=>o.openTab),{covered:n,bestCoveringDiscountBps:r,walletsInconclusive:i}=Yj();return l.jsxs("div",{className:"v10-ws-pca",children:[l.jsx("span",{className:"v10-ws-pca-label",children:"Publishing discount"}),l.jsx("span",{className:"v10-ws-pca-value","data-covered":n,children:i?"Couldn’t verify your wallets — retry":n?`${mD(r)} discount`:"None — publishing at the direct cost"}),l.jsxs("button",{type:"button",className:"v10-ws-pca-cta",onClick:()=>t({id:"conviction",label:"Publisher Conviction",closable:!0}),children:[e==="edge"?"Get added to a PCA":"Set up PCA"," ->"]})]})}const vD="Context graphs you created or joined — scoped knowledge domains with configurable access (private, curated and peer-shared, or public) where agents build and collaborate on shared context with verifiable provenance.",dg=[{key:"wm",label:"Working Memory",short:"WM",color:"var(--layer-working)",desc:"Private agent drafts — free, self-attested, persists locally."},{key:"swm",label:"Shared Working Memory",short:"SWM",color:"var(--layer-shared)",desc:"Team proposals — free, gossip-replicated across context-graph peers."},{key:"vm",label:"Verifiable Memory",short:"VM",color:"var(--layer-verified)",desc:"On-chain knowledge — permanent, verifiable, requires TRAC to publish."}],Qu={1:"Ethereum",8453:"Base",84532:"Base Sepolia",100:"Gnosis",10200:"Chiado",2043:"NeuroWeb",20430:"NeuroWeb Testnet"};function om(e){var i;const t=eC(e);if(e==null)return{name:"Unknown chain",gas:t};const n=String(e);if(Qu[n])return{name:Qu[n],gas:t};const r=(i=n.match(/(\d+)\s*$/))==null?void 0:i[1];return r&&Qu[r]?{name:Qu[r],gas:t}:{name:r?`Chain ${r}`:`Chain ${n}`,gas:t}}function Ol(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(e<1e4?1:0)}k`.replace(".0",""):`${(e/1e6).toFixed(1)}M`.replace(".0","")}function lm({label:e,value:t,sub:n,accentColor:r,children:i,icon:o,className:c}){return l.jsxs("div",{className:`stat-card v10-anim-mount${c?` ${c}`:""}`,children:[r&&l.jsx("div",{className:"accent",style:{background:r}}),l.jsxs("div",{className:"stat-label",children:[o,e]}),t!=null&&t!==""&&l.jsx("div",{className:"stat-value",children:t}),i,n!=null&&n!==""&&l.jsx("div",{className:"stat-sub",children:n})]})}function bw({counts:e}){const t=e.wm+e.swm+e.vm,n=dg.map(r=>`${r.short} ${e[r.key]}`).join(" · ");return l.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?l.jsx("span",{className:"v10-layerbar-empty"}):dg.map(r=>{const i=e[r.key]/t*100;return i<=0?null:l.jsx("span",{className:"v10-layerbar-seg",title:`${r.label} (${e[r.key]}) — ${r.desc}`,style:{width:`${i}%`,background:r.color}},r.key)})})}function yD(){return l.jsx("div",{className:"v10-layer-legend",children:dg.map(e=>l.jsxs("span",{className:"v10-layer-legend-item",title:`${e.label} — ${e.desc}`,children:[l.jsx("span",{className:"v10-layer-legend-dot",style:{background:e.color}}),e.short]},e.key))})}function bD({curator:e,joined:t,refreshing:n}){const r=e+t,i=`Curator ${e} · Joined ${t}`,o="var(--accent-green)",c="var(--text-secondary)";return l.jsxs("div",{className:`v10-cg-rolesplit${n?" is-refreshing":""}`,title:n?"Refreshing — agent identity is being re-checked":void 0,"aria-busy":n||void 0,children:[l.jsx("div",{className:"v10-layerbar","aria-label":i,children:r===0?l.jsx("span",{className:"v10-layerbar-empty"}):l.jsxs(l.Fragment,{children:[e>0&&l.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/r*100}%`,background:o}}),t>0&&l.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/r*100}%`,background:c}})]})}),l.jsxs("div",{className:"v10-layer-legend",children:[l.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[l.jsx("span",{className:"v10-layer-legend-dot",style:{background:o}}),"Curator ",e]}),l.jsxs("span",{className:"v10-layer-legend-item",title:"Joined — context graphs you joined as a member",children:[l.jsx("span",{className:"v10-layer-legend-dot",style:{background:c}}),"Joined ",t]})]})]})}function xD({cg:e,identity:t,onReport:n,onOpen:r}){var L,B;const i=Cv(e.id,{signalErrors:!0}),[o,c]=w.useState(null),[d,p]=w.useState(!1),h=o===null&&!d,g=w.useRef(!0),m=w.useRef(0),v=w.useCallback(()=>{const _=++m.current;kn.listParticipants(e.id).then(R=>{g.current&&_===m.current&&(c((R.allowedAgents??[]).map(tn)),p(!1))}).catch(()=>{g.current&&_===m.current&&(c(null),p(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,c(null),p(!1),v();const _=setInterval(v,3e4);return()=>{g.current=!1,clearInterval(_)}},[v]),ms(w.useCallback(_=>{var z,F;if(_.type!=="join_approved"&&_.type!=="join_rejected"&&_.type!=="project_synced")return;const R=((z=_.data)==null?void 0:z.contextGraphId)??((F=_.data)==null?void 0:F.projectId);R&&R!==e.id||v()},[e.id,v]));const b=cs(e.accessPolicy)==="public",k=w.useMemo(()=>{var F;if(b)return null;const _=(F=e.curator)==null?void 0:F.trim(),R=_?tn(_):null;if(o===null)return d&&R?[R]:null;const z=new Set(o);return R&&z.add(R),[...z]},[o,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,C=w.useMemo(()=>{if(i.error)return{wm:0,swm:0,vm:0,total:j};const _=new Set(i.allTriples.map(R=>R.subject)).size;return{wm:i.counts.wm,swm:i.counts.swm,vm:i.counts.vm,total:_}},[i.error,i.allTriples,i.counts.wm,i.counts.swm,i.counts.vm,j]),S=CC(i),N=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),A=[i.loading?1:0,i.error?1:0,i.partial?1:0,h?1:0,d?1:0,b?1:0,C.wm,C.swm,C.vm,C.total,N.wm,N.swm,N.vm,N.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:C,triples:N,agents:k??[],sizeLoading:i.loading,sizeError:!!i.error||i.partial,sizeFallback:!!i.error,agentsLoading:h,agentsError:d,agentsUnknown:b,sig:A})},[e.id,A]);const O=cs(e.accessPolicy),M=O==="private"?"Curated":O==="public"?"Public":"Unknown",T=!!((L=e.curator)!=null&&L.trim()&&((B=t==null?void 0:t.agentDid)!=null&&B.trim())&&tn(e.curator)===tn(t.agentDid));return l.jsxs("button",{className:"v10-cg-row",onClick:()=>r(e),children:[l.jsx("span",{className:"v10-cg-cell v10-cg-name",children:e.name||e.id.slice(0,16)}),l.jsx("span",{className:"v10-cg-cell v10-cg-type",title:`${M} context graph`,"aria-label":`${M} context graph`,children:O==="private"?l.jsx(z4,{size:13,"aria-hidden":"true"}):O==="public"?l.jsx(M4,{size:13,"aria-hidden":"true"}):l.jsx("span",{className:"v10-cg-dim",children:"—"})}),l.jsx("span",{className:"v10-cg-cell v10-cg-size",children:i.loading?l.jsx("span",{className:"v10-stat-loading",children:"loading…"}):i.error?l.jsxs("span",{title:"Live entity count unavailable — showing the published Knowledge-Asset summary, not the full WM/SWM/VM entity total",children:[Ol(C.total)," ",l.jsx("span",{className:"v10-cg-dim",children:"KA (summary)"})," · ",l.jsx("span",{className:"v10-cg-dim",children:"— triples"})]}):i.partial?l.jsxs("span",{title:"Partial — one or more memory layers were unavailable; counts are a lower bound",children:["~",Ol(C.total)," ",l.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",Ol(N.total)," ",l.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):l.jsxs(l.Fragment,{children:[Ol(C.total)," ",l.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",Ol(N.total)," ",l.jsx("span",{className:"v10-cg-dim",children:"triples"})]})}),l.jsx("span",{className:"v10-cg-cell v10-cg-agents",children:k===null?l.jsx("span",{className:"v10-cg-dim",children:"—"}):d?l.jsxs("span",{title:"Participant list unavailable — curator-only lower bound",children:["~",k.length]}):k.length}),l.jsx("span",{className:"v10-cg-cell v10-cg-role",children:l.jsx("span",{className:`v10-cg-badge v10-cg-badge-${T?"curator":"joined"}`,children:T?"CURATOR":"JOINED"})})]})}const xw={wm:0,swm:0,vm:0,total:0};function wD(){var T,L;const{data:e}=vr(kn.fetchStatus,[],1e4),{data:t}=vr(kn.fetchEconomics,[],6e4),{data:n,loading:r,error:i}=vr(kn.fetchWalletsBalances,[],3e4),{openTab:o}=gn(),{setActiveProject:c}=Mr(),{myCgs:d,identity:p,identityLoading:h,cgsLoading:g}=AI(),m=(h||g)&&d.length===0,[v,b]=w.useState({}),k=w.useCallback((B,_)=>{b(R=>{var z;return((z=R[B])==null?void 0:z.sig)===_.sig?R:{...R,[B]:_}})},[]);w.useEffect(()=>{const B=new Set(d.map(_=>_.id));b(_=>{const R=Object.keys(_);if(R.every(F=>B.has(F)))return _;const z={};for(const F of R)B.has(F)&&(z[F]=_[F]);return z})},[d]);const j=w.useMemo(()=>{const B={...xw},_={...xw},R=new Set;let z=!1,F=!1,Y=!1,D=!1,q=!1;for(const W of d){const Q=v[W.id];if(!Q){z=!0,F=!0;continue}Q.sizeLoading&&(z=!0),Q.agentsLoading&&(F=!0),Q.sizeError&&(Y=!0),Q.sizeFallback&&(q=!0),(Q.agentsError||Q.agentsUnknown)&&(D=!0);for(const H of["wm","swm","vm","total"])B[H]+=Q.entities[H],_[H]+=Q.triples[H];for(const H of Q.agents)R.add(H)}const G=d.length>0;return{entities:B,triples:_,agentCount:R.size,sizeLoading:G&&z,agentsLoading:G&&F,sizePartial:Y,agentsPartial:D,triplesUnknown:G&&Y&&_.total===0,sizeApprox:G&&q,hasCgs:G}},[d,v]),C=w.useMemo(()=>{var z,F;const B=(z=p==null?void 0:p.agentDid)!=null&&z.trim()?tn(p.agentDid):null;let _=0,R=0;for(const Y of d)!!(B&&((F=Y.curator)!=null&&F.trim())&&tn(Y.curator)===B)?_++:R++;return{curator:_,joined:R}},[d,p]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],N=B=>{if(B==null||typeof B=="string"&&B.trim()==="")return"—";const _=Number(B);return isFinite(_)?_.toLocaleString(void 0,{maximumFractionDigits:_>=1e3?0:2}):String(B)},A=S.map(B=>{var R;const _=(R=t==null?void 0:t.periods)==null?void 0:R.find(z=>z.label===B.label);return{display:B.display,publishes:_?String(_.publishCount):"—",trac:_?N(_.totalTrac):"—"}});n!=null&&n.symbol;const O=(n==null?void 0:n.balances)??[],M=B=>B.length>12?`${B.slice(0,6)}…${B.slice(-4)}`:B;return l.jsxs("div",{className:"v10-dashboard",children:[l.jsxs("div",{className:"v10-dash-header",children:[l.jsx("h1",{className:"v10-dash-title",children:"Dashboard"}),l.jsxs("p",{className:"v10-dash-subtitle",children:[(e==null?void 0:e.name)||"DKG Node"," · ",(e==null?void 0:e.networkName)||"network",(n==null?void 0:n.chainId)!=null?` · ${om(n.chainId).name}`:""]})]}),l.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[l.jsx(lm,{label:"My Context Graphs",className:"v10-stat-tight",icon:l.jsx(F1,{size:13,"aria-hidden":!0}),value:m?l.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:vD,children:j.hasCgs&&!m?l.jsx(bD,{curator:C.curator,joined:C.joined,refreshing:h}):null}),l.jsxs(lm,{label:"Context Graph Size",icon:l.jsx(H4,{size:13,"aria-hidden":!0}),className:"v10-stat-tight",accentColor:"var(--accent-green)",children:[j.hasCgs?j.sizeLoading?l.jsx("div",{className:"v10-stat-loading",children:"loading…"}):l.jsxs("div",{className:"v10-cg-size-detail",children:[l.jsxs("div",{className:"v10-cg-size-metric",children:[l.jsxs("div",{className:"v10-cg-size-num",children:[l.jsxs("span",{className:"v10-cg-size-big",children:[j.sizeApprox&&!j.triplesUnknown?"~":"",j.entities.total.toLocaleString()]}),j.triplesUnknown?l.jsx("span",{className:"v10-cg-dim",title:"Live entity count unavailable — showing the published Knowledge-Asset summary (not the full WM/SWM/VM entity total)",children:"Knowledge Assets (summary)"}):j.sizeApprox?l.jsx("span",{className:"v10-cg-dim",title:"Some context graphs reported only their Knowledge-Asset summary — this total mixes summary and live counts and is approximate",children:"entities / KA · approx."}):l.jsx("span",{className:"v10-cg-dim",children:"entities / Knowledge Assets"})]}),j.triplesUnknown||j.sizeApprox?null:l.jsx(bw,{counts:j.entities})]}),l.jsxs("div",{className:"v10-cg-size-metric",children:[l.jsxs("div",{className:"v10-cg-size-num",children:[l.jsx("span",{className:"v10-cg-size-big",children:j.triplesUnknown?"—":`${j.sizeApprox?"~":""}${j.triples.total.toLocaleString()}`}),l.jsx("span",{className:"v10-cg-dim",children:"triples"})]}),j.triplesUnknown||j.sizeApprox?null:l.jsx(bw,{counts:j.triples})]}),l.jsx(yD,{})]}):l.jsx("div",{className:"v10-stat-empty",children:"—"}),l.jsx("div",{className:"stat-sub",children:j.hasCgs?j.sizePartial?"Some context graphs could not report size; total is partial.":"Totals across all your context graphs, summed over Working, Shared Working & Verifiable Memory. Knowledge Assets are entities that have been published to Verifiable Memory.":"No context graphs yet."})]}),l.jsx(lm,{label:"Collaborating Agents",icon:l.jsx(Z4,{size:13,"aria-hidden":!0}),value:j.hasCgs?j.agentsLoading?l.jsx("span",{className:"v10-stat-loading",children:"loading…"}):j.agentsPartial?`~${j.agentCount}`:j.agentCount:l.jsx("span",{className:"v10-stat-empty",children:"—"}),sub:j.hasCgs?j.agentsPartial?"Some context graphs could not report agents; count is partial.":"Unique agents — your own and others' — allow-listed and collaborating across your context graphs.":"No context graphs yet.",accentColor:"var(--purple)"})]}),l.jsxs("div",{className:"v10-dash-grid v10-dash-grid-2",children:[l.jsxs("div",{className:"v10-dash-section v10-dash-section-wide v10-anim-mount",children:[l.jsxs("div",{className:"v10-dash-section-header",children:[l.jsxs("div",{className:"v10-dash-section-title",children:[l.jsx(F1,{size:13,"aria-hidden":!0}),l.jsx("h3",{children:"My Context Graphs"})]}),l.jsx("span",{className:"v10-dash-section-badge",children:d.length})]}),m?l.jsx("p",{className:"v10-cg-empty",children:"Loading context graphs…"}):d.length===0?l.jsx("p",{className:"v10-cg-empty",children:"No context graphs yet — create or join one from the sidebar."}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"v10-cg-colhead",children:[l.jsx("span",{className:"v10-cg-cell v10-cg-name",children:"Name"}),l.jsx("span",{className:"v10-cg-cell v10-cg-type",children:"Type"}),l.jsx("span",{className:"v10-cg-cell v10-cg-size",children:"Size"}),l.jsx("span",{className:"v10-cg-cell v10-cg-agents",title:"Agents allow-listed with access to this context graph",children:"Agents"}),l.jsx("span",{className:"v10-cg-cell v10-cg-role",children:"Role"})]}),l.jsx("div",{className:"v10-cg-list",children:d.map(B=>l.jsx(xD,{cg:B,identity:p,onReport:k,onOpen:_=>{c(_.id),o({id:`project:${_.id}`,label:_.name||_.id.slice(0,12),closable:!0})}},B.id))})]})]}),l.jsxs("div",{className:"v10-dash-section v10-anim-mount",children:[l.jsx("div",{className:"v10-dash-section-header",children:l.jsxs("div",{className:"v10-dash-section-title",children:[l.jsx(K4,{size:13,"aria-hidden":!0}),l.jsx("h3",{children:"Wallets and Spending"})]})}),(n==null?void 0:n.chainId)!=null?l.jsxs("div",{className:"v10-ws-chain-row",children:[l.jsx("span",{className:"v10-ws-chain-label",children:"Chain"}),l.jsx("span",{className:"v10-ws-chain-value",children:om(n.chainId).name})]}):null,l.jsx("div",{className:"v10-ws-subhead",children:"Node wallets"}),r&&!n?l.jsx("p",{className:"v10-cg-empty",children:"Loading wallets…"}):O.length>0?l.jsxs("div",{className:"v10-ws-wtable",children:[l.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[l.jsx("span",{children:"Wallet"}),l.jsx("span",{children:"TRAC"}),l.jsxs("span",{children:["Gas (",om(n==null?void 0:n.chainId).gas,")"]})]}),O.map(B=>l.jsxs("div",{className:"v10-ws-wrow",children:[l.jsx("span",{className:"v10-ws-addr",title:B.address,children:M(B.address)}),l.jsx("span",{className:"v10-ws-bal",children:N(B.trac)}),l.jsx("span",{className:"v10-ws-bal-sec",title:hD(B.eth),children:pD(B.eth)})]},B.address))]}):(((T=n==null?void 0:n.wallets)==null?void 0:T.length)??0)>0?l.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(B=>l.jsxs("li",{className:"v10-ws-wallet",children:[l.jsx("span",{className:"v10-ws-addr",title:B,children:M(B)}),l.jsx("span",{className:"v10-cg-dim",children:"—"})]},B))}):n!=null&&n.error||i?l.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):l.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||i)&&(O.length>0||(((L=n==null?void 0:n.wallets)==null?void 0:L.length)??0)>0)?l.jsx("p",{className:"v10-ws-note",children:"Balances may be stale — the chain/RPC reported an error."}):null,l.jsx("div",{className:"v10-ws-subhead",children:"Spending"}),l.jsxs("div",{className:"v10-ws-spend",children:[l.jsxs("div",{className:"v10-ws-spend-head",children:[l.jsx("span",{children:"Period"}),l.jsx("span",{title:"Publishes to Verifiable Memory that spent TRAC on-chain. Free SWM/local/testnet publishes are not counted (they don't burn TRAC).",children:"Publishes to VM"}),l.jsx("span",{children:"TRAC"})]}),A.map(B=>l.jsxs("div",{className:"v10-ws-spend-row",children:[l.jsx("span",{className:"v10-cg-dim",children:B.display}),l.jsx("span",{className:"v10-ws-spend-val",children:B.publishes}),l.jsx("span",{className:"v10-ws-spend-val",children:B.trac})]},B.display))]}),l.jsx(gD,{})]})]})]})}const kD=new Set(["meta"]),Ur="__root__";function Tv(e){return!kD.has(e.name)}const SD=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function ww(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function jD(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return["md","txt"].includes(t)?"📝":["pdf"].includes(t)?"📕":["docx","doc"].includes(t)?"📄":["csv","json","xml","yaml","yml"].includes(t)?"📊":["ttl","rdf","owl"].includes(t)?"🔗":["py","ts","js","tsx","jsx","java","go","rs","c","cpp"].includes(t)?"💻":["png","jpg","jpeg","webp"].includes(t)?"🖼️":"📄"}function CD({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){var Q;const[i,o]=w.useState([]),[c,d]=w.useState(!0),[p,h]=w.useState(!0),[g,m]=w.useState("idle"),[v,b]=w.useState(0),[k,j]=w.useState([]),[C,S]=w.useState(null),[N,A]=w.useState(!1),O=w.useRef(null),M=w.useCallback(H=>{const $=Array.from(H);o(U=>{const Z=new Set(U.map(ae=>`${ae.file.name}:${ae.file.size}`)),I=$.filter(ae=>!Z.has(`${ae.name}:${ae.size}`));return[...U,...I.map(ae=>({file:ae,id:`${ae.name}-${ae.size}-${Date.now()}`}))]})},[]),T=H=>{o($=>$.filter(U=>U.id!==H))},L=H=>{H.preventDefault(),H.stopPropagation(),A(!0)},B=H=>{H.preventDefault(),H.stopPropagation(),A(!1)},_=H=>{H.preventDefault(),H.stopPropagation(),A(!1),H.dataTransfer.files.length>0&&M(H.dataTransfer.files)},R=async()=>{if(i.length===0)return;m("uploading"),b(0),j([]),S(null);const H=[];for(let U=0;U<i.length;U++){b(U);const{file:Z}=i[U],I=Z.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ae=`${Date.now().toString(36)}-${U}-${I}`;try{const le=await Uj(ae,n,Z),oe=le.extraction.tripleCount??le.extraction.triplesWritten;H.push({fileName:Z.name,status:le.extraction.status==="completed"?"success":le.extraction.status==="skipped"?"skipped":"error",triplesWritten:oe,error:le.extraction.error})}catch(le){H.push({fileName:Z.name,status:"error",error:(le==null?void 0:le.message)??"Upload failed"})}}j(H),b(i.length);const $=H.some(U=>U.status==="error");m($?"error":"done")},z=()=>{g!=="uploading"&&(o([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:F,onBackdropClick:Y}=ls(e,z);if(!e)return null;const D=k.reduce((H,$)=>H+($.triplesWritten??0),0),q=k.filter(H=>H.status==="success").length,G=k.filter(H=>H.status==="skipped").length,W=k.filter(H=>H.status==="error").length;return l.jsx("div",{className:"v10-modal-overlay",onClick:Y,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:F,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[l.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),l.jsx("div",{className:"v10-modal-subtitle",children:r?l.jsxs(l.Fragment,{children:["Upload files to ",l.jsx("strong",{children:r})," — your agent will extract structured knowledge."]}):l.jsx(l.Fragment,{children:"Upload files — your agent will extract structured knowledge and add it to working memory."})})]}),l.jsx("button",{type:"button",className:"v10-modal-close",onClick:z,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),l.jsxs("div",{className:"v10-modal-body",children:[C&&l.jsx("div",{className:"v10-modal-error",children:C}),g==="idle"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:`v10-import-dropzone ${N?"drag-over":""}`,onClick:()=>{var H;return(H=O.current)==null?void 0:H.click()},onDragOver:L,onDragLeave:B,onDrop:_,children:[l.jsx("div",{className:"v10-import-dropzone-label",children:"Drag files here, or click to browse"}),l.jsx("div",{className:"v10-import-dropzone-hint",style:{marginTop:4},children:"Your agent will extract structured knowledge and add it to working memory."}),l.jsxs("div",{className:"v10-import-dropzone-hint",style:{marginTop:8},children:["Supported: ",SD]}),l.jsx("input",{ref:O,type:"file",multiple:!0,style:{display:"none"},onChange:H=>{H.target.files&&M(H.target.files),H.target.value=""}})]}),i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"v10-import-file-list",children:i.map(H=>l.jsxs("div",{className:"v10-import-file-item",children:[l.jsx("span",{className:"v10-import-file-icon",children:jD(H.file.name)}),l.jsx("span",{className:"v10-import-file-name",children:H.file.name}),l.jsx("span",{className:"v10-import-file-size",children:ww(H.file.size)}),l.jsx("button",{className:"v10-import-file-remove",onClick:()=>T(H.id),title:"Remove",children:"×"})]},H.id))}),l.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[i.length," file",i.length!==1?"s":""," selected · ",ww(i.reduce((H,$)=>H+$.file.size,0))," total"]})]}),l.jsx("div",{className:"v10-form-divider"}),l.jsxs("div",{className:"v10-form-label",style:{marginBottom:8},children:["Ingestion Options ",l.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),l.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[l.jsx("input",{type:"checkbox",checked:p,disabled:!0,readOnly:!0}),"Store original files as Knowledge Assets"]}),l.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[l.jsx("input",{type:"checkbox",checked:c,disabled:!0,readOnly:!0}),"Let agent extract structured knowledge from content"]})]}),g==="uploading"&&l.jsxs("div",{className:"v10-import-progress",children:[l.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:["Importing files… (",v+1," of ",i.length,")"]}),l.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:((Q=i[v])==null?void 0:Q.file.name)??"…"}),l.jsx("div",{className:"v10-import-progress-bar",children:l.jsx("div",{className:"v10-import-progress-fill",style:{width:`${(v+.5)/i.length*100}%`}})}),l.jsxs("div",{className:"v10-import-progress-text",children:[v," of ",i.length," files processed"]})]}),(g==="done"||g==="error")&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`v10-import-result ${W>0?"error":"success"}`,"data-testid":"import-result","data-import-status":W>0?"error":"success","data-import-triples":D,children:W===0?l.jsxs(l.Fragment,{children:[q>0&&l.jsxs(l.Fragment,{children:["Successfully imported ",q," file",q!==1?"s":"",".",D>0&&l.jsxs(l.Fragment,{children:[" Extracted ",l.jsx("strong",{children:D.toLocaleString()})," triples into working memory."]})]}),G>0&&l.jsxs(l.Fragment,{children:[q>0?" ":"","Stored ",G," file",G!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):l.jsxs(l.Fragment,{children:[q," file",q!==1?"s":""," imported",G>0&&l.jsxs(l.Fragment,{children:[", ",G," stored without extraction"]}),", ",W," failed.",D>0&&l.jsxs(l.Fragment,{children:[" ",D.toLocaleString()," triples extracted."]})]})}),k.length>0&&l.jsx("div",{className:"v10-import-file-list",style:{marginTop:12},children:k.map((H,$)=>l.jsxs("div",{className:"v10-import-file-item",children:[l.jsx("span",{className:"v10-import-file-icon",children:H.status==="success"?"✓":H.status==="skipped"?"–":"✗"}),l.jsx("span",{className:"v10-import-file-name",children:H.fileName}),l.jsx("span",{className:"v10-import-file-size",style:H.status==="error"?{color:"var(--text-danger)"}:void 0,children:H.status==="success"&&H.triplesWritten!=null?`${H.triplesWritten} triples`:H.status==="skipped"?"stored (no extraction)":H.error??"failed"})]},$))})]})]}),l.jsxs("div",{className:"v10-modal-footer",children:[g==="idle"&&l.jsxs(l.Fragment,{children:[l.jsx("button",{className:"v10-modal-btn",onClick:z,children:"Cancel"}),l.jsxs("button",{className:"v10-modal-btn primary",onClick:R,disabled:i.length===0,children:["Start Import (",i.length," file",i.length!==1?"s":"",")"]})]}),g==="uploading"&&l.jsx("button",{className:"v10-modal-btn",disabled:!0,children:"Importing…"}),(g==="done"||g==="error")&&l.jsx("button",{className:"v10-modal-btn primary",onClick:z,children:"Done"})]})]})})}function ND(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function ED({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){const[i,o]=w.useState(null),[c,d]=w.useState(null),[p,h]=w.useState([]),[g,m]=w.useState(null),[v,b]=w.useState([]),[k,j]=w.useState([]),[C,S]=w.useState(null),[N,A]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Bt()}).then(z=>z.json()).then(z=>{typeof(z==null?void 0:z.peerId)=="string"&&z.peerId.length>0&&d(z.peerId)}).catch(()=>{}),$j(n).then(z=>h(z.allowedAgents)).catch(()=>h([])),iv().then(z=>{const F=(z.agents??[]).filter(Y=>Y.connectionStatus!=="self");b(F)}).catch(()=>b([])),Pj(n).then(z=>j(z.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:O,onBackdropClick:M}=ls(e,t);if(!e)return null;const T=c?`${n}
|
|
1138
|
+
${c}`:null,L=(z,F)=>{navigator.clipboard.writeText(z).then(()=>{o(F),setTimeout(()=>o(null),2e3)}).catch(()=>{})},B=async z=>{try{await yO(n,z),h(F=>F.filter(Y=>Y!==z))}catch{}},_=async z=>{S(z);try{await sv(n,z),j(F=>F.filter(Y=>Y.agentAddress!==z)),h(F=>[...new Set([...F,z])])}catch(F){m((F==null?void 0:F.message)||"Failed to approve")}finally{S(null)}},R=async z=>{S(z);try{await ov(n,z),j(F=>F.filter(Y=>Y.agentAddress!==z))}catch(F){m((F==null?void 0:F.message)||"Failed to reject")}finally{S(null)}};return l.jsx("div",{className:"v10-modal-overlay",onClick:M,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:O,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[l.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[l.jsxs("div",{style:{flex:1,minWidth:0},children:[l.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),l.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",l.jsx("strong",{children:r}),"."]})]}),l.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),l.jsxs("div",{className:"v10-modal-body",children:[l.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[l.jsx("button",{onClick:()=>A("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:N==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:N==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:N==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),l.jsxs("button",{onClick:()=>A("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:N==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:N==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:N==="requests"?"2px solid var(--accent-primary)":"2px solid transparent",position:"relative"},children:["Join Requests",k.length>0&&l.jsx("span",{style:{position:"absolute",top:4,right:4,background:"var(--accent-red, #ef4444)",color:"var(--text-on-accent)",borderRadius:999,fontSize:9,fontWeight:700,padding:"1px 5px",minWidth:16,textAlign:"center"},children:k.length})]})]}),N==="allowlist"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Allowed Agents"}),l.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:["Only agents on this list can read and write to the context graph. To add someone, share the Invite Code below — they'll send a signed join request you can approve in the ",l.jsx("strong",{children:"Join Requests"})," tab."]}),p.length>0&&l.jsx("div",{style:{marginBottom:8,display:"flex",flexDirection:"column",gap:4},children:p.map(z=>{const F=v.find(Y=>{var D;return((D=Y.agentAddress)==null?void 0:D.toLowerCase())===z.toLowerCase()});return l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 10px",borderRadius:6,fontSize:11,fontFamily:"var(--font-mono)",background:"var(--bg-surface)",border:"1px solid var(--border-default)"},children:[l.jsx("span",{style:{color:"var(--text-primary)"},children:F?l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{fontFamily:"var(--font-body)",fontWeight:500},children:F.name})," ",l.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:ND(z)})]}):z}),l.jsx("button",{onClick:()=>B(z),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},z)})}),p.length===0&&l.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)",marginBottom:8},children:"No agents on allowlist — context graph is open to anyone who subscribes."})]}),l.jsx("div",{className:"v10-form-divider"}),l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Invite Code"}),T===null?l.jsx("div",{style:{padding:"8px 12px",borderRadius:6,fontSize:11,color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"Loading peer ID…"}):l.jsxs("div",{style:{position:"relative"},children:[l.jsx("pre",{style:{background:"var(--bg-surface)",border:"1px solid var(--border-default)",borderRadius:6,padding:"10px 12px",fontSize:11,lineHeight:1.6,fontFamily:"var(--font-mono)",color:"var(--text-primary)",overflow:"auto",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-all"},children:T}),l.jsx("button",{className:"v10-modal-btn primary",onClick:()=>L(T,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:i==="invite"?"Copied":"Copy Invite"})]})]})]}),N==="requests"&&l.jsxs("div",{className:"v10-form-group",children:[l.jsx("label",{className:"v10-form-label",children:"Pending Join Requests"}),l.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginBottom:8},children:"Agents who submitted a signed request to join this context graph. Approve to add them to the allowlist."}),k.length===0&&l.jsx("div",{style:{padding:"16px 12px",borderRadius:6,fontSize:11,textAlign:"center",color:"var(--text-tertiary)",background:"var(--bg-surface)",border:"1px dashed var(--border-default)"},children:"No pending join requests."}),k.map(z=>l.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 10px",borderRadius:6,fontSize:11,background:"var(--bg-surface)",border:"1px solid var(--border-default)",marginBottom:4},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[z.name&&l.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:z.name}),l.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:z.agentAddress}),l.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date(z.timestamp).toLocaleString()]})]}),l.jsxs("div",{style:{display:"flex",gap:6},children:[l.jsx("button",{onClick:()=>_(z.agentAddress),disabled:C===z.agentAddress,style:{background:"rgba(34, 197, 94, 0.15)",color:"var(--text-success)",border:"1px solid rgba(34, 197, 94, 0.3)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:C===z.agentAddress?"…":"Approve"}),l.jsx("button",{onClick:()=>R(z.agentAddress),disabled:C===z.agentAddress,style:{background:"rgba(239, 68, 68, 0.1)",color:"var(--text-danger)",border:"1px solid rgba(239, 68, 68, 0.2)",cursor:"pointer",borderRadius:4,fontSize:10,padding:"4px 10px",fontWeight:600},children:"Reject"})]})]},z.agentAddress)),g&&l.jsx("div",{style:{fontSize:10,color:"var(--text-danger)",marginTop:4},children:g})]})]}),l.jsx("div",{className:"v10-modal-footer",children:l.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Done"})})]})})}function AD(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Rv(e,t,n=""){const r=AD(e),i=e==null?void 0:e.length;if(!r||t!==void 0){const c=n&&`"${n}" `,d="",p=r?`length=${i}`:`type=${typeof e}`,h=c+"expected Uint8Array"+d+", got "+p;throw r?new RangeError(h):new TypeError(h)}return e}function kw(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function TD(e,t){Rv(e,void 0,"digestInto() output");const n=t.outputLen;if(e.length<n)throw new RangeError('"digestInto() output" expected to be of length >='+n)}function fg(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function cm(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ea(e,t){return e<<32-t|e>>>t}const RD=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",_D=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function OD(e){if(Rv(e),RD)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=_D[e[n]];return t}function MD(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function LD(e,t={}){const n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}const ID=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function DD(e,t,n){return e&t^~e&n}function zD(e,t,n){return e&t^e&n^t&n}class $D{constructor(t,n,r,i){rt(this,"blockLen");rt(this,"outputLen");rt(this,"canXOF",!1);rt(this,"padOffset");rt(this,"isLE");rt(this,"buffer");rt(this,"view");rt(this,"finished",!1);rt(this,"length",0);rt(this,"pos",0);rt(this,"destroyed",!1);this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=cm(this.buffer)}update(t){kw(this),Rv(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let c=0;c<o;){const d=Math.min(i-this.pos,o-c);if(d===i){const p=cm(t);for(;i<=o-c;c+=i)this.process(p,c);continue}r.set(t.subarray(c,c+d),this.pos),this.pos+=d,c+=d,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){kw(this),TD(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:o}=this;let{pos:c}=this;n[c++]=128,fg(this.buffer.subarray(c)),this.padOffset>i-c&&(this.process(r,0),c=0);for(let m=c;m<i;m++)n[m]=0;r.setBigUint64(i-8,BigInt(this.length*8),o),this.process(r,0);const d=cm(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=p/4,g=this.get();if(h>g.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)d.setUint32(4*m,g[m],o)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:o,destroyed:c,pos:d}=this;return t.destroyed=c,t.finished=o,t.length=i,t.pos=d,i%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const wi=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),PD=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]),ki=new Uint32Array(64);class UD extends $D{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:n,C:r,D:i,E:o,F:c,G:d,H:p}=this;return[t,n,r,i,o,c,d,p]}set(t,n,r,i,o,c,d,p){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=c|0,this.G=d|0,this.H=p|0}process(t,n){for(let m=0;m<16;m++,n+=4)ki[m]=t.getUint32(n,!1);for(let m=16;m<64;m++){const v=ki[m-15],b=ki[m-2],k=ea(v,7)^ea(v,18)^v>>>3,j=ea(b,17)^ea(b,19)^b>>>10;ki[m]=j+ki[m-7]+k+ki[m-16]|0}let{A:r,B:i,C:o,D:c,E:d,F:p,G:h,H:g}=this;for(let m=0;m<64;m++){const v=ea(d,6)^ea(d,11)^ea(d,25),b=g+v+DD(d,p,h)+PD[m]+ki[m]|0,j=(ea(r,2)^ea(r,13)^ea(r,22))+zD(r,i,o)|0;g=h,h=p,p=d,d=c+b|0,c=o,o=i,i=r,r=b+j|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,c=c+this.D|0,d=d+this.E|0,p=p+this.F|0,h=h+this.G|0,g=g+this.H|0,this.set(r,i,o,c,d,p,h,g)}roundClean(){fg(ki)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),fg(this.buffer)}}class BD extends UD{constructor(){super(32);rt(this,"A",wi[0]|0);rt(this,"B",wi[1]|0);rt(this,"C",wi[2]|0);rt(this,"D",wi[3]|0);rt(this,"E",wi[4]|0);rt(this,"F",wi[5]|0);rt(this,"G",wi[6]|0);rt(this,"H",wi[7]|0)}}const FD=LD(()=>new BD,ID(1));var mn;(function(e){e.WorkingMemory="WM",e.SharedWorkingMemory="SWM",e.VerifiableMemory="VM"})(mn||(mn={}));function um(e){switch(e){case mn.WorkingMemory:return"_working_memory";case mn.SharedWorkingMemory:return"_shared_memory";case mn.VerifiableMemory:return"_verifiable_memory"}}var Sw;(function(e){e[e.SelfAttested=0]="SelfAttested",e[e.Endorsed=1]="Endorsed",e[e.PartiallyVerified=2]="PartiallyVerified",e[e.ConsensusVerified=3]="ConsensusVerified"})(Sw||(Sw={}));var jw;(function(e){e.CREATE="CREATE",e.UPDATE="UPDATE"})(jw||(jw={}));mn.WorkingMemory,mn.SharedWorkingMemory,mn.VerifiableMemory,mn.VerifiableMemory;mn.WorkingMemory,mn.SharedWorkingMemory,mn.SharedWorkingMemory,mn.VerifiableMemory;const qD=["working-memory","shared-working-memory","verifiable-memory"],HD=(1n<<72n)-1n;HD.toString();um(mn.WorkingMemory),mn.WorkingMemory,um(mn.SharedWorkingMemory),mn.SharedWorkingMemory,um(mn.VerifiableMemory),mn.VerifiableMemory;function NC(e,t){return`did:dkg:context-graph:${e}/${t}`}function EC(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 GD=["string","integer","number","boolean","iri"],VD=/^[A-Za-z][A-Za-z0-9_]*$/,WD=/^[+-]?\d+$/,ZD=/^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;function wc(e){if(e==null||e==="")return[];if(!Array.isArray(e))throw new Error("Query parameters must be an array.");const t=new Set;return e.map((n,r)=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`Query parameter at index ${r} must be an object.`);const i=n,o=typeof i.name=="string"?i.name.trim():"";if(!VD.test(o))throw new Error(`Query parameter at index ${r} has an invalid name: ${o||"<empty>"}.`);if(t.has(o))throw new Error(`Duplicate query parameter: ${o}.`);t.add(o);const c=i.type;if(typeof c!="string"||!GD.includes(c))throw new Error(`Query parameter ${o} has an unsupported type: ${String(c)}.`);const d={name:o,type:c};typeof i.label=="string"&&i.label.trim()&&(d.label=i.label.trim()),typeof i.description=="string"&&i.description.trim()&&(d.description=i.description.trim());let p;if(i.required!==void 0){if(typeof i.required!="boolean")throw new Error(`Query parameter ${o} required must be a boolean.`);p=i.required}const h=i.defaultValue!==void 0;if(h){if(!RC(i.defaultValue))throw new Error(`Query parameter ${o} has an invalid defaultValue.`);TC(d,i.defaultValue),d.defaultValue=i.defaultValue}if(p===!0&&h)throw new Error(`Required query parameter ${o} cannot declare a defaultValue.`);if(p===!1&&!h)throw new Error(`Optional query parameter ${o} must declare a defaultValue.`);return d})}function QD(e){return e.defaultValue===void 0}function KD(e){return JSON.stringify(wc(e))}function YD(e){const t=[];for(const n of _C(e))t.includes(n.name)||t.push(n.name);return t}function AC(e,t){const n=wc(t),r=new Set(n.map(o=>o.name)),i=new Set(YD(e));for(const o of i)if(!r.has(o))throw new Error(`SPARQL template uses undeclared query parameter: ${o}.`);for(const o of n)if(!i.has(o.name))throw new Error(`Query parameter ${o.name} is not used by the SPARQL template.`)}function XD(e,t,n){const r=wc(t);AC(e,r);const i=new Set(r.map(h=>h.name));for(const h of Object.keys(n))if(!i.has(h))throw new Error(`Unknown query parameter: ${h}.`);const o=new Map;for(const h of r){const g=n[h.name],m=Cw(g)?h.defaultValue:g;if(Cw(m))throw new Error(`Missing required query parameter: ${h.name}.`);if(!RC(m))throw new Error(`Query parameter ${h.name} must be a string, number, or boolean.`);o.set(h.name,TC(h,m))}const c=_C(e);let d="",p=0;for(const h of c)d+=e.slice(p,h.start),d+=o.get(h.name),p=h.end;return d+e.slice(p)}function TC(e,t){switch(e.type){case"string":return iC(String(t));case"integer":{const n=String(t).trim();if(!WD.test(n))throw new Error(`Query parameter ${e.name} must be an integer.`);return n}case"number":{const n=String(t).trim();if(!ZD.test(n))throw new Error(`Query parameter ${e.name} must be a number.`);return n}case"boolean":{if(t===!0||t==="true")return"true";if(t===!1||t==="false")return"false";throw new Error(`Query parameter ${e.name} must be true or false.`)}case"iri":{const n=String(t).trim();if(!aC(n))throw new Error(`Query parameter ${e.name} must be a safe absolute IRI.`);return`<${n}>`}}}function RC(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function Cw(e){return e==null}function _C(e){const t=[];let n=0,r,i=!1,o=!1;for(;n<e.length;){const c=e[n];if(i){(c===`
|
|
1139
|
+
`||c==="\r")&&(i=!1),n+=1;continue}if(r){if(c==="\\"){n+=2;continue}e.startsWith(r,n)?(n+=r.length,r=void 0):n+=1;continue}if(o){if(c==="\\"){n+=2;continue}c===">"&&(o=!1),n+=1;continue}if(c==="#"){i=!0,n+=1;continue}if(e.startsWith("'''",n)||e.startsWith('"""',n)){r=e.slice(n,n+3),n+=3;continue}if(c==="'"||c==='"'){r=c,n+=1;continue}if(c==="<"&&e[n+1]!=="="&&e[n+1]!=="{"&&!/\s/.test(e[n+1]??"")){o=!0,n+=1;continue}if(e.startsWith("{{",n)){const d=e.slice(n).match(/^\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/);if(d){const p=n+d[0].length,h=e[n-1],g=e[p];if(h&&/[A-Za-z0-9_?:.%~-]/.test(h)||g&&/[A-Za-z0-9_?:.%~-]/.test(g))throw new Error(`Query parameter ${d[1]} must occupy a complete SPARQL term position.`);t.push({name:d[1],start:n,end:p}),n=p;continue}}n+=1}return t}const JD=2,Gr="__context_graph",$d="ui-saved-queries",Pd="Saved queries",$n="http://dkg.io/ontology/profile/",Nw="http://schema.org/",Ew="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",e3="http://www.w3.org/2001/XMLSchema#integer";class Da extends Error{constructor(n="Incompatible query-catalog daemon contract. Upgrade the daemon and retry."){super(n);rt(this,"code","QUERY_CATALOG_CONTRACT_INCOMPATIBLE");this.name="QueryCatalogContractError"}}function t3(e,t){if(t===Gr)return`did:dkg:context-graph:${e}`;const n=EC(t);if(!n.valid)throw new Error(`Invalid query-catalog subgraph "${t}": ${n.reason}`);return NC(e,t)}function n3(e,t){const n=`did:dkg:context-graph:${e}`;if(t===n)return Gr;const r=`${n}/`;if(!t.startsWith(r))throw new Error(`Query-catalog scope graph <${t}> is outside context graph "${e}".`);const i=t.slice(r.length),o=EC(i);if(!o.valid)throw new Error(`Invalid query-catalog scope graph <${t}>: ${o.reason}`);if(NC(e,i)!==t)throw new Error(`Query-catalog scope graph <${t}> is not a canonical subgraph IRI.`);return i}function Gl(e,t={}){return{sparql:XD(e.sparql,e.parameters,t),...e.view?{view:e.view}:{},...e.subGraph&&e.subGraph!==Gr?{subGraphName:e.subGraph}:{}}}function r3(e){return qD.includes(e)?e:void 0}function a3(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Da;const t=e,n=t.capabilities;if(t.schemaVersion!==JD||(n==null?void 0:n.canonicalItems)!==!0||(n==null?void 0:n.queryParameters)!==!0||(n==null?void 0:n.executionView)!==!0||(n==null?void 0:n.graphScopeIri)!==!0||!Array.isArray(t.items))throw new Da;return t.items.map((r,i)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Da(`Invalid query-catalog item at index ${i}.`);const o=r,c=["queryIri","catalogIri","slug","name","sparql","catalogSlug","catalogName","subGraph","scopeGraph"];for(const m of c)if(typeof o[m]!="string")throw new Da(`Invalid query-catalog item ${i}: ${m} must be a string.`);if(typeof o.rank!="number"||!Number.isFinite(o.rank)||typeof o.catalogRank!="number"||!Number.isFinite(o.catalogRank))throw new Da(`Invalid query-catalog item ${i}: ranks must be finite numbers.`);const d=o.view===void 0?void 0:r3(String(o.view));if(o.view!==void 0&&d===void 0)throw new Da(`Invalid query-catalog item ${i}: unsupported execution view.`);const p=o.scopeGraph,h=typeof t.contextGraphId=="string"?t.contextGraphId:void 0;if(!h)throw new Da("Invalid query-catalog response: contextGraphId must be a string.");let g;try{g=n3(h,p)}catch(m){throw new Da(`Invalid query-catalog item ${i}: ${m instanceof Error?m.message:String(m)}`)}if(g!==o.subGraph)throw new Da(`Invalid query-catalog item ${i}: scopeGraph and subGraph do not match.`);return{queryIri:o.queryIri,catalogIri:o.catalogIri,slug:o.slug,name:o.name,...typeof o.description=="string"?{description:o.description}:{},sparql:o.sparql,...typeof o.resultColumn=="string"?{resultColumn:o.resultColumn}:{},rank:o.rank,catalogSlug:o.catalogSlug,catalogName:o.catalogName,...typeof o.catalogDescription=="string"?{catalogDescription:o.catalogDescription}:{},catalogRank:o.catalogRank,subGraph:o.subGraph,scopeGraph:p,parameters:wc(o.parameters),...d?{view:d}:{}}})}function i3(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.catalogSlug}`,i=t.get(r);if(i){if(i.name!==n.catalogName||i.description!==n.catalogDescription||i.rank!==n.catalogRank)throw new Error(`Query catalog ${n.catalogSlug} has conflicting metadata.`);i.queries.push(n);continue}t.set(r,{slug:n.catalogSlug,subGraph:n.subGraph,name:n.catalogName,description:n.catalogDescription,rank:n.catalogRank,queries:[n]})}return[...t.values()].map(n=>({...n,queries:[...n.queries].sort((r,i)=>r.rank-i.rank||r.name.localeCompare(i.name))})).sort((n,r)=>n.subGraph.localeCompare(r.subGraph)||n.rank-r.rank||n.name.localeCompare(r.name))}function OC(e){return e.trim().toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Aw(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function s3(e){return OD(FD(MD(e)))}function ta(e){return JSON.stringify(e)}function Tw(e){return`"${e}"^^<${e3}>`}function o3(e){const t=wc(e.parameters),n=JSON.stringify({subGraph:e.subGraph,catalogSlug:e.catalogSlug,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,parameters:t,view:e.view}),r=`${OC(e.name)}-${s3(n)}`,i=Aw(e.contextGraphId,"catalog",e.catalogSlug),o=Aw(e.contextGraphId,"query",r),c=t3(e.contextGraphId,e.subGraph);AC(e.sparql,t);const d=[{subject:i,predicate:Ew,object:`${$n}QueryCatalog`,graph:""},{subject:i,predicate:`${$n}scopeGraph`,object:c,graph:""},{subject:i,predicate:`${$n}forSubGraph`,object:ta(e.subGraph),graph:""},{subject:i,predicate:`${$n}displayName`,object:ta(e.catalogName),graph:""},{subject:i,predicate:`${$n}rank`,object:Tw(e.catalogRank),graph:""},{subject:o,predicate:Ew,object:`${$n}SavedQuery`,graph:""},{subject:o,predicate:`${$n}scopeGraph`,object:c,graph:""},{subject:o,predicate:`${$n}forSubGraph`,object:ta(e.subGraph),graph:""},{subject:o,predicate:`${$n}inCatalog`,object:i,graph:""},{subject:o,predicate:`${$n}displayName`,object:ta(e.name),graph:""},{subject:o,predicate:`${$n}sparqlQuery`,object:ta(e.sparql),graph:""},{subject:o,predicate:`${$n}rank`,object:Tw(e.rank),graph:""}];return e.catalogDescription&&d.push({subject:i,predicate:`${Nw}description`,object:ta(e.catalogDescription),graph:""}),e.description&&d.push({subject:o,predicate:`${Nw}description`,object:ta(e.description),graph:""}),e.resultColumn&&d.push({subject:o,predicate:`${$n}resultColumn`,object:ta(e.resultColumn),graph:""}),t.length>0&&d.push({subject:o,predicate:`${$n}queryParameters`,object:ta(KD(t)),graph:""}),e.view&&d.push({subject:o,predicate:`${$n}executionView`,object:ta(e.view),graph:""}),{savedQuery:{queryIri:o,catalogIri:i,slug:r,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:c,parameters:t,view:e.view,queryUri:o,catalogUri:i},quads:d}}function Mo(e){const t=`did:dkg:context-graph:${e}/meta`;return`FILTER(strstarts(str(?g), ${iC(t)}))`}async function Ml(e,t){var r;const n=await gr(e,{contextGraphId:t});return((r=n==null?void 0:n.result)==null?void 0:r.bindings)??[]}async function l3(e){const t=await NO(e);return a3(t)}const na={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},Rw=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),c3={slug:Ur,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},_w=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),kc="http://dkg.io/ontology/profile/";function MC(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function Tt(e){const t=MC(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1140
|
+
`).replace(/\\\\/g,"\\"):t}function u3(e){const t=Tt(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function d3(e){return`PREFIX prof: <${kc}>
|
|
1141
|
+
PREFIX schema: <http://schema.org/>
|
|
1142
|
+
SELECT ?profile ?name ?description ?primary ?accent
|
|
1143
|
+
WHERE {
|
|
1144
|
+
GRAPH ?g {
|
|
1145
|
+
?profile a prof:Profile .
|
|
1146
|
+
OPTIONAL { ?profile prof:displayName ?name }
|
|
1147
|
+
OPTIONAL { ?profile schema:description ?description }
|
|
1148
|
+
OPTIONAL { ?profile prof:primaryColor ?primary }
|
|
1149
|
+
OPTIONAL { ?profile prof:accentColor ?accent }
|
|
1150
|
+
}
|
|
1151
|
+
${Mo(e)}
|
|
1152
|
+
} LIMIT 1`}function f3(e){return`PREFIX prof: <${kc}>
|
|
1153
|
+
PREFIX schema: <http://schema.org/>
|
|
1154
|
+
SELECT ?slug ?displayName ?description ?icon ?color ?rank ?timelinePredicate ?sourceAssertion
|
|
1155
|
+
WHERE {
|
|
1156
|
+
GRAPH ?g {
|
|
1157
|
+
?b a prof:SubGraphBinding ;
|
|
1158
|
+
prof:forSubGraph ?slug .
|
|
1159
|
+
OPTIONAL { ?b prof:displayName ?displayName }
|
|
1160
|
+
OPTIONAL { ?b schema:description ?description }
|
|
1161
|
+
OPTIONAL { ?b prof:icon ?icon }
|
|
1162
|
+
OPTIONAL { ?b prof:color ?color }
|
|
1163
|
+
OPTIONAL { ?b prof:rank ?rank }
|
|
1164
|
+
OPTIONAL { ?b prof:timelinePredicate ?timelinePredicate }
|
|
1165
|
+
OPTIONAL { ?b prof:sourceAssertion ?sourceAssertion }
|
|
1166
|
+
}
|
|
1167
|
+
${Mo(e)}
|
|
1168
|
+
}`}function p3(e){return`PREFIX prof: <${kc}>
|
|
1169
|
+
SELECT ?chip ?subGraph ?type ?predicate ?label
|
|
1170
|
+
(GROUP_CONCAT(DISTINCT ?v; separator="|") AS ?values)
|
|
1171
|
+
WHERE {
|
|
1172
|
+
GRAPH ?g {
|
|
1173
|
+
?chip a prof:FilterChip ;
|
|
1174
|
+
prof:forSubGraph ?subGraph ;
|
|
1175
|
+
prof:forType ?type ;
|
|
1176
|
+
prof:onPredicate ?predicate ;
|
|
1177
|
+
prof:chipValue ?v .
|
|
1178
|
+
OPTIONAL { ?chip prof:label ?label }
|
|
1179
|
+
}
|
|
1180
|
+
${Mo(e)}
|
|
1181
|
+
}
|
|
1182
|
+
GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function h3(e){const t=e.map(d=>d.catalogIri?d:{...d,catalogSlug:`default:${d.subGraph}`}),n=t.map(d=>({slug:d.slug,subGraph:d.subGraph,catalogSlug:d.catalogSlug,catalogName:d.catalogName,catalogDescription:d.catalogDescription,catalogRank:d.catalogRank,name:d.name,description:d.description,sparql:d.sparql,resultColumn:d.resultColumn??"",rank:d.rank,view:d.view,parameters:d.parameters})),r=new Map(t.map((d,p)=>[d.queryIri,n[p]])),i=i3(t).map(d=>({slug:d.slug,subGraph:d.subGraph,name:d.name,description:d.description,rank:d.rank,queries:d.queries.map(p=>r.get(p.queryIri)).filter(p=>!!p)})),o=new Map,c=new Map;for(const d of i){const p=o.get(d.subGraph)??[];p.push(d),o.set(d.subGraph,p);const h=c.get(d.subGraph)??[];h.push(...d.queries),c.set(d.subGraph,h)}return{queryCatalogs:i,savedQueries:n,catalogsBySubGraph:o,queriesBySubGraph:c}}function m3(e){return`PREFIX prof: <${kc}>
|
|
1183
|
+
SELECT ?type ?label ?icon ?color ?detailHint
|
|
1184
|
+
?promoteLabel ?promoteHint ?publishLabel ?publishHint
|
|
1185
|
+
WHERE {
|
|
1186
|
+
GRAPH ?g {
|
|
1187
|
+
?b a prof:EntityTypeBinding ;
|
|
1188
|
+
prof:forType ?type .
|
|
1189
|
+
OPTIONAL { ?b prof:label ?label }
|
|
1190
|
+
OPTIONAL { ?b prof:icon ?icon }
|
|
1191
|
+
OPTIONAL { ?b prof:color ?color }
|
|
1192
|
+
OPTIONAL { ?b prof:detailHint ?detailHint }
|
|
1193
|
+
OPTIONAL { ?b prof:promoteLabel ?promoteLabel }
|
|
1194
|
+
OPTIONAL { ?b prof:promoteHint ?promoteHint }
|
|
1195
|
+
OPTIONAL { ?b prof:publishLabel ?publishLabel }
|
|
1196
|
+
OPTIONAL { ?b prof:publishHint ?publishHint }
|
|
1197
|
+
}
|
|
1198
|
+
${Mo(e)}
|
|
1199
|
+
}`}function g3(e){return`PREFIX prof: <${kc}>
|
|
1200
|
+
PREFIX schema: <http://schema.org/>
|
|
1201
|
+
SELECT ?view ?name ?description ?nodeSize
|
|
1202
|
+
(GROUP_CONCAT(DISTINCT ?incType; separator="|") AS ?includeTypes)
|
|
1203
|
+
(GROUP_CONCAT(DISTINCT ?empPred; separator="|") AS ?emphasizePredicates)
|
|
1204
|
+
WHERE {
|
|
1205
|
+
GRAPH ?g {
|
|
1206
|
+
?view a prof:ViewConfig .
|
|
1207
|
+
OPTIONAL { ?view prof:displayName ?name }
|
|
1208
|
+
OPTIONAL { ?view schema:description ?description }
|
|
1209
|
+
OPTIONAL { ?view prof:nodeSize ?nodeSize }
|
|
1210
|
+
OPTIONAL { ?view prof:includeType ?incType }
|
|
1211
|
+
OPTIONAL { ?view prof:emphasizePredicate ?empPred }
|
|
1212
|
+
}
|
|
1213
|
+
${Mo(e)}
|
|
1214
|
+
}
|
|
1215
|
+
GROUP BY ?view ?name ?description ?nodeSize`}function Si(e){const t=MC(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function v3(e){const[t,n]=w.useState(!0),[r,i]=w.useState(),[o,c]=w.useState(na.displayName),[d,p]=w.useState(),[h,g]=w.useState(na.primaryColor),[m,v]=w.useState(na.accentColor),[b,k]=w.useState([]),[j,C]=w.useState([]),[S,N]=w.useState([]),[A,O]=w.useState([]),[M,T]=w.useState([]),[L,B]=w.useState([]),_=w.useRef(new Map),R=w.useRef(new Map),z=w.useRef(new Map),F=w.useRef(new Map),Y=w.useRef(new Map),D=w.useRef(new Map),q=w.useRef();w.useEffect(()=>{if(q.current=void 0,c(e??na.displayName),p(void 0),g(na.primaryColor),v(na.accentColor),k([]),C([]),N([]),O([]),T([]),B([]),_.current=new Map,R.current=new Map,z.current=new Map,F.current=new Map,Y.current=new Map,D.current=new Map,i(void 0),!e){n(!1);return}let Z=!1;return(async()=>{n(!0);try{const[I,ae,le,oe,we,Ee]=await Promise.all([Ml(d3(e),e).catch(()=>[]),Ml(f3(e),e).catch(()=>[]),Ml(m3(e),e).catch(()=>[]),Ml(g3(e),e).catch(()=>[]),Ml(p3(e),e).catch(()=>[]),l3(e).then(de=>({rows:de,error:void 0})).catch(de=>({rows:[],error:de instanceof Error?de.message:String(de)}))]);if(Z)return;const Oe=e;if(I[0]){const de=I[0];c(Tt(de.name)||Oe),p(Tt(de.description)||void 0),g(Tt(de.primary)||na.primaryColor),v(Tt(de.accent)||na.accentColor)}else c(Oe),p(void 0),g(na.primaryColor),v(na.accentColor);const He=ae.map(de=>({slug:Tt(de.slug),displayName:Tt(de.displayName)||Tt(de.slug),description:Tt(de.description)||void 0,icon:Tt(de.icon)||void 0,color:Tt(de.color)||void 0,rank:u3(de.rank)||99,timelinePredicate:Si(de.timelinePredicate)||void 0,sourceAssertion:Tt(de.sourceAssertion)||void 0})).filter(de=>de.slug).sort((de,Pe)=>de.rank-Pe.rank);k(He),R.current=new Map(He.map(de=>[de.slug,de]));const ke=le.map(de=>({typeIri:Si(de.type),label:Tt(de.label)||void 0,icon:Tt(de.icon)||void 0,color:Tt(de.color)||void 0,detailHint:Tt(de.detailHint)||void 0,promoteLabel:Tt(de.promoteLabel)||void 0,promoteHint:Tt(de.promoteHint)||void 0,publishLabel:Tt(de.publishLabel)||void 0,publishHint:Tt(de.publishHint)||void 0})).filter(de=>de.typeIri);C(ke),_.current=new Map(ke.map(de=>[de.typeIri,de]));const ve=oe.map(de=>{const Pe=Si(de.view),Ze=Pe.split(":view:").pop()??Pe;return{slug:Ze,name:Tt(de.name)||Ze,description:Tt(de.description)||void 0,nodeSize:Tt(de.nodeSize)||void 0,includeTypes:Tt(de.includeTypes).split("|").map(ot=>Si(ot.trim())).filter(Boolean),emphasizePredicates:Tt(de.emphasizePredicates).split("|").map(ot=>Si(ot.trim())).filter(Boolean)}});N(ve),z.current=new Map(ve.map(de=>[de.slug,de]));const Re=we.map(de=>{const Pe=Si(de.chip),Ze=Pe.split(":chip:").pop()??Pe,ot=Tt(de.values).split("|").map(be=>Tt(be.trim())).filter(Boolean);return{slug:Ze,subGraph:Tt(de.subGraph),typeIri:Si(de.type),predicate:Si(de.predicate),label:Tt(de.label)||"Filter",values:ot}}).filter(de=>de.subGraph&&de.predicate&&de.values.length>0);O(Re);const Ge=new Map;for(const de of Re){const Pe=Ge.get(de.subGraph)??[];Pe.push(de),Ge.set(de.subGraph,Pe)}F.current=Ge;const We=h3(Ee.rows);T(We.queryCatalogs),B(We.savedQueries),Y.current=We.catalogsBySubGraph,D.current=We.queriesBySubGraph,q.current=e,Ee.error&&i(Ee.error)}catch(I){Z||i((I==null?void 0:I.message)??String(I))}finally{Z||n(!1)}})(),()=>{Z=!0}},[e]);const G=w.useCallback(Z=>Z===Ur?c3:q.current!==e?Rw(Z):R.current.get(Z)??Rw(Z),[e]),W=w.useCallback(Z=>q.current===e?_.current.get(Z)??_w(Z):_w(Z),[e]),Q=w.useCallback(Z=>q.current===e?z.current.get(Z):void 0,[e]),H=w.useCallback(Z=>q.current===e?F.current.get(Z)??[]:[],[e]),$=w.useCallback(Z=>q.current===e?Y.current.get(Z)??[]:[],[e]),U=w.useCallback(Z=>q.current===e?D.current.get(Z)??[]:[],[e]);return{contextGraphId:e??"",displayName:o,description:d,primaryColor:h,accentColor:m,subGraphs:b,typeBindings:j,views:S,filterChips:A,queryCatalogs:M,savedQueries:L,loading:t,error:r,forSubGraph:G,forType:W,view:Q,chipsFor:H,savedQueryCatalogsFor:$,savedQueriesFor:U}}const LC=Je.createContext(null);function qa(){return w.useContext(LC)}const y3="http://dkg.io/ontology/agent/";function b3(e){return`PREFIX ag: <${y3}>
|
|
1216
|
+
PREFIX schema: <http://schema.org/>
|
|
1217
|
+
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
1218
|
+
SELECT ?a ?kind ?name ?label ?fw ?op ?wallet ?peerId ?avatar ?reputation
|
|
1219
|
+
WHERE {
|
|
1220
|
+
GRAPH ?g {
|
|
1221
|
+
?a a ag:Agent .
|
|
1222
|
+
OPTIONAL { ?a a ag:HumanAgent . BIND("human" AS ?kind) }
|
|
1223
|
+
OPTIONAL { ?a a ag:AIAgent . BIND("ai" AS ?kindAi) }
|
|
1224
|
+
OPTIONAL { ?a schema:name ?name }
|
|
1225
|
+
OPTIONAL { ?a rdfs:label ?label }
|
|
1226
|
+
OPTIONAL { ?a ag:framework ?fw }
|
|
1227
|
+
OPTIONAL { ?a ag:operator ?op }
|
|
1228
|
+
OPTIONAL { ?a ag:walletAddress ?wallet }
|
|
1229
|
+
OPTIONAL { ?a ag:peerId ?peerId }
|
|
1230
|
+
OPTIONAL { ?a ag:avatar ?avatar }
|
|
1231
|
+
OPTIONAL { ?a ag:reputation ?reputation }
|
|
1232
|
+
}
|
|
1233
|
+
${Mo(e)}
|
|
1234
|
+
}`}function IC(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function ra(e){const t=IC(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1235
|
+
`).replace(/\\\\/g,"\\"):t}function Ow(e){const t=IC(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function x3(e){let t=0;for(let i=0;i<e.length;i++)t=t*31+e.charCodeAt(i)|0;return`hsl(${((t%360+360)%360+25)%360}, 55%, 58%)`}function w3(e){const t=new Map;for(const n of e){const r=Ow(n.a);if(!r)continue;const i=t.get(r),o=ra(n.kindAi)==="ai"||ra(n.kind)==="ai"?"ai":ra(n.kind)==="human"?"human":(i==null?void 0:i.kind)??"ai",c={uri:r,name:ra(n.name)||ra(n.label)||r.split(":").pop()||r,kind:o,framework:ra(n.fw)||(i==null?void 0:i.framework),operatorUri:Ow(n.op)||(i==null?void 0:i.operatorUri),walletAddress:ra(n.wallet)||(i==null?void 0:i.walletAddress),peerId:ra(n.peerId)||(i==null?void 0:i.peerId),avatar:ra(n.avatar)||(i==null?void 0:i.avatar),reputation:ra(n.reputation)||(i==null?void 0:i.reputation),color:x3(r)};c.kind==="human"&&!c.framework&&(c.framework="human"),t.set(r,c)}for(const n of t.values())if(n.operatorUri){const r=t.get(n.operatorUri);r&&(n.operatorName=r.name)}return t}function k3(e){const[t,n]=w.useState(()=>new Map),[r,i]=w.useState(!0),[o,c]=w.useState(),d=w.useRef(new Map);w.useEffect(()=>{if(!e){i(!1);return}let m=!1;return(async()=>{var v;i(!0),c(void 0);try{const b=await gr(b3(e),{contextGraphId:e});if(m)return;const k=((v=b==null?void 0:b.result)==null?void 0:v.bindings)??[],j=w3(k);n(j),d.current=j}catch(b){m||c((b==null?void 0:b.message)??String(b))}finally{m||i(!1)}})(),()=>{m=!0}},[e]);const p=w.useCallback(m=>d.current.get(m),[]),h=Je.useMemo(()=>[...t.values()].sort((m,v)=>m.name.localeCompare(v.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:r,error:o,get:p,openAgent:g}}const DC=Je.createContext(null);function gs(){return w.useContext(DC)}const Vl=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],Mw=1e4;function Ll(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function S3(e){if(e.startsWith("did:dkg:agent:")){const t=e.slice(14);return t.startsWith("0x")?t.slice(0,6)+"…"+t.slice(-4):t.slice(0,6)+"…"+t.slice(-6)}return e.length>18?e.slice(0,8)+"…"+e.slice(-6):e}function j3(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function C3(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),i=r.indexOf("/");if(i<0)return;const o=r.slice(0,i);if(!(!o||o.startsWith("_")))return o}function N3(e){return`PREFIX dkg: <http://dkg.io/ontology/>
|
|
1236
|
+
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1237
|
+
SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
|
|
1238
|
+
GRAPH ?g {
|
|
1239
|
+
?op a dkg:WorkspaceOperation ;
|
|
1240
|
+
dkg:rootEntity ?root ;
|
|
1241
|
+
dkg:publishedAt ?publishedAt ;
|
|
1242
|
+
prov:wasAttributedTo ?agent .
|
|
1243
|
+
}
|
|
1244
|
+
FILTER(
|
|
1245
|
+
STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
|
|
1246
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1247
|
+
)
|
|
1248
|
+
} ORDER BY DESC(?publishedAt) LIMIT 5000`}function E3(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%Vl.length}function A3(e){const t=[...new Set(e)].sort(),n=new Set,r=new Map;for(const i of t){const o=E3(i);let c=o;if(n.size<Vl.length){for(let d=0;d<Vl.length;d++){const p=(o+d)%Vl.length;if(!n.has(p)){c=p;break}}n.add(c)}r.set(i,Vl[c])}return r}function zC(e){const[t,n]=w.useState(new Map),[r,i]=w.useState([]),[o,c]=w.useState([]),[d,p]=w.useState(new Map),[h,g]=w.useState(null),[m,v]=w.useState(!1),[b,k]=w.useState(void 0),j=w.useRef(0);w.useEffect(()=>{if(!e){j.current+=1,n(new Map),i([]),c([]),p(new Map),v(!1),k(void 0);return}const A=++j.current,O=new AbortController;let M=!1,T;const L=()=>!M&&A===j.current;return v(!0),g(null),(async()=>{var B;try{const _=new Promise((H,$)=>{T=setTimeout(()=>{O.abort(),$(new Error(`SWM attribution query timed out after ${Math.round(Mw/1e3)}s`))},Mw)}),R=(async()=>{const H=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},signal:O.signal,body:JSON.stringify({sparql:N3(e)})});if(!H.ok)throw new Error(`SPARQL query failed: ${H.status}`);return H.json()})(),z=await Promise.race([R,_]),Y=(((B=z==null?void 0:z.result)==null?void 0:B.bindings)??[]).slice().reverse(),D=new Map,q=new Map,G=[];for(const H of Y){const $=Ll(H.op),U=Ll(H.root),Z=Ll(H.agent),I=Ll(H.publishedAt),ae=Ll(H.g);if(!$||!U||!Z||!I)continue;const le=j3(Z),oe=ae?C3(ae,e):void 0;G.push({opUri:$,rootUri:U,agent:le,publishedAt:I,subGraph:oe});const we={agent:le,opUri:$,publishedAt:I,subGraph:oe},Ee=D.get(U);Ee?Ee.some(He=>He.agent===le)||Ee.push(we):D.set(U,[we]);let Oe=q.get(le);Oe||(Oe=new Set,q.set(le,Oe)),Oe.add(U)}const W=A3(q.keys()),Q=[...q.entries()].map(([H,$])=>({agent:H,color:W.get(H),label:S3(H),entityCount:$.size})).sort((H,$)=>$.entityCount-H.entityCount);if(!L())return;n(D),i(G),c(Q),p(W),k(e)}catch(_){if(!L())return;g((_==null?void 0:_.message)??"Failed to load SWM attributions"),n(new Map),i([]),c([]),p(new Map),k(e)}finally{T&&clearTimeout(T),L()&&v(!1)}})(),()=>{M=!0,T&&clearTimeout(T),O.abort()}},[e]);const{nodeColors:C,conflicts:S}=w.useMemo(()=>{const A={},O=[];for(const[M,T]of t)if(T.length!==0)if(T.length===1){const L=T[0].agent,B=d.get(L);B!==void 0&&(A[M]=B)}else O.push(M),A[M]="#f59e0b";return{nodeColors:A,conflicts:O}},[t,d]);return{resultContextGraphId:b,attributions:t,events:r,palette:o,nodeColors:C,conflicts:S,loading:!!(e&&(m||b!==e)),error:h}}function T3(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const i=e.slice(n.length).split("/");if(i[0]!=="assertion"&&i.length>=2&&i[1]==="assertion")return i[0]}const Lw=1e4,pg="http://dkg.io/ontology/";function R3(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${pg}>
|
|
1249
|
+
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1250
|
+
SELECT ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph (COUNT(DISTINCT ?root) AS ?entityCount) (COUNT(DISTINCT ?subjRoot) AS ?subjectEntityCount) WHERE {
|
|
1251
|
+
GRAPH <${t}> {
|
|
1252
|
+
?event a ?type ;
|
|
1253
|
+
prov:startedAtTime ?ts .
|
|
1254
|
+
FILTER(?type IN (dkg:AssertionCreated, dkg:AssertionPromoted))
|
|
1255
|
+
OPTIONAL { ?event prov:wasAssociatedWith ?agentAssoc }
|
|
1256
|
+
OPTIONAL { ?event prov:generated ?gen }
|
|
1257
|
+
OPTIONAL { ?event prov:used ?used }
|
|
1258
|
+
BIND(COALESCE(?gen, ?used) AS ?assertion)
|
|
1259
|
+
?assertion dkg:assertionName ?name .
|
|
1260
|
+
OPTIONAL { ?assertion prov:wasAttributedTo ?agentAttr }
|
|
1261
|
+
BIND(COALESCE(?agentAssoc, ?agentAttr) AS ?agent)
|
|
1262
|
+
OPTIONAL { ?assertion dkg:subGraphName ?subGraphName }
|
|
1263
|
+
OPTIONAL { ?assertion dkg:assertionGraph ?assertionGraph }
|
|
1264
|
+
OPTIONAL { ?event dkg:rootEntity ?root }
|
|
1265
|
+
OPTIONAL { ?assertion dkg:rootEntity ?subjRoot }
|
|
1266
|
+
}
|
|
1267
|
+
} GROUP BY ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph
|
|
1268
|
+
ORDER BY DESC(?ts) LIMIT 5000`}function aa(e){if(e!=null)return typeof e=="string"?e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>)?$/,""):e:typeof e=="object"&&e!==null&&"value"in e?String(e.value):String(e)}function _3(e){return e===`${pg}AssertionCreated`?"created":e===`${pg}AssertionPromoted`?"promoted":null}function O3(e){const[t,n]=w.useState([]),[r,i]=w.useState(!!e),[o,c]=w.useState(null),[d,p]=w.useState(void 0),h=w.useRef(void 0),g=w.useRef(void 0);return w.useEffect(()=>{if(!e){i(!1);return}h.current!=null&&h.current!==e&&(n([]),c(null),p(void 0),g.current=void 0);let m=!1;const v=new AbortController;let b;return h.current=e,i(!0),c(null),(async()=>{var k;try{const j=new Promise((O,M)=>{b=setTimeout(()=>{v.abort(),M(new Error(`Assertion-lifecycle query timed out after ${Math.round(Lw/1e3)}s`))},Lw)}),C=(async()=>{const O=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},signal:v.signal,body:JSON.stringify({sparql:R3(e),contextGraphId:e})});if(!O.ok)throw new Error(`SPARQL query failed: ${O.status}`);return O.json()})(),S=await Promise.race([C,j]);if(m||h.current!==e)return;const N=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],A=[];for(const O of N){const M=aa(O.event),T=aa(O.type),L=aa(O.assertion),B=aa(O.name),_=aa(O.agent),R=aa(O.ts);if(!M||!L||!_||!R)continue;const z=_3(T);if(!z)continue;let F;if(z==="promoted"){const q=aa(O.entityCount),G=q!=null?Number(q):NaN;if(Number.isFinite(G)&&G>0)F=G;else{const W=aa(O.subjectEntityCount),Q=W!=null?Number(W):NaN;Number.isFinite(Q)&&Q>=0&&(F=Q)}}let D=aa(O.subGraphName);if(D===void 0){const q=aa(O.assertionGraph);q&&(D=T3(q,e))}A.push({eventUri:M,kind:z,assertionUri:L,assertionName:B??"",agentUri:_,publishedAt:R,subGraph:D,entityCount:F})}n(A),p(e),g.current=e,c(null)}catch(j){if(m||(j==null?void 0:j.name)==="AbortError")return;c(j.message??String(j)),g.current!==e&&n([]),p(e),g.current=e}finally{b&&clearTimeout(b),m||i(!1)}})(),()=>{m=!0,v.abort(),b&&clearTimeout(b)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:r,error:o}),[d,t,r,o])}const M3=["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"],L3="http://www.w3.org/ns/prov#wasAttributedTo",I3=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 _v(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function Ov(e,t,n,r){const i=n?n.toISOString():"no-ts";return r&&r!==t?`${e}|${t}|${r}|${i}`:`${e}|${t}|${i}`}function D3(e){for(const t of M3){const n=e.properties.get(t);if(n!=null&&n.length)for(const r of n){const i=_v(r);if(i)return i}}return null}function z3(e){for(const t of e.connections)if(t.predicate===L3)return t.targetUri;return null}function $3(e){for(const t of e.types)if(I3.has(t))return t;return null}function P3(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function U3(e,t={}){const{limit:n=200,agentUri:r,typeIri:i,subGraph:o,includeUndated:c=!0,excludeEvents:d}=t,p=d?[...d].sort().join(","):"";return w.useMemo(()=>{const h=d&&d.length>0?new Set(d):null,g=[];for(const m of e){const v=$3(m);if(i&&v!==i)continue;const b=D3(m);if(!b&&(!c||!v))continue;const k=z3(m);if(r&&k!==r)continue;const j=P3(m);if(o&&j!==o)continue;const C=v?"typed":"added";if(h&&h.has(C))continue;const S=Ov(C,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:v,subGraph:j,layer:m.trustLevel,event:C,clickable:!0})}return g.sort((m,v)=>m.at&&v.at?v.at.getTime()-m.at.getTime():m.at&&!v.at?-1:!m.at&&v.at?1:m.entity.label.localeCompare(v.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,r,i,o,c,p])}function B3(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},r=n(t),i=new Date(r.getTime()-1440*60*1e3),o=new Date(r.getTime()-10080*60*1e3),c={},d=[],p=(g,m,v)=>{c[g]||(c[g]={key:g,label:m,items:[]},d.push(g)),c[g].items.push(v)};for(const g of e){if(!g.at){p("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===r.getTime())p("today","Today",g);else if(m.getTime()===i.getTime())p("yesterday","Yesterday",g);else if(g.at.getTime()>=o.getTime())p("this-week","Earlier this week",g);else{const v=g.at.toLocaleString(void 0,{month:"long",year:"numeric"});p(`m-${v}`,v,g)}}const h=d.indexOf("undated");return h!==-1&&h<d.length-1&&(d.splice(h,1),d.push("undated")),d.map(g=>c[g])}function F3(e,t){const{entitiesByUri:n,agentUri:r,subGraph:i,limit:o=200}=t,c=[];for(const d of e){if(r&&d.agent!==r||i&&d.subGraph!==i)continue;const p=_v(d.publishedAt);if(!p)continue;const h=Nt(d.rootUri),g=n.get(h),m=g!=null;c.push({id:Ov("promoted",d.opUri,p,h),entity:g??q3(h),at:p,authorUri:d.agent,kindUri:null,subGraph:d.subGraph??null,layer:"shared",event:"promoted",clickable:m})}return c.sort((d,p)=>d.at&&p.at?p.at.getTime()-d.at.getTime():d.at&&!p.at?-1:!d.at&&p.at?1:d.entity.label.localeCompare(p.entity.label)),c.slice(0,o)}function q3(e){return{uri:e,label:jv(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function H3(e,t={}){const{agentUri:n,subGraph:r,limit:i=200}=t,o=[];for(const c of e){if(n&&c.agentUri!==n||r&&c.subGraph!==r)continue;const d=_v(c.publishedAt);if(!d)continue;const p=c.kind==="promoted"?"promoted":"added",h=c.kind==="promoted"?"shared":"working",g=Nt(c.assertionUri);o.push({id:Ov(p,c.eventUri,d,g),entity:{uri:g,label:c.assertionName||jv(g),types:[],trustLevel:h,layers:new Set([h]),subGraphs:c.subGraph?new Set([c.subGraph]):new Set,properties:new Map,connections:[]},at:d,authorUri:c.agentUri,kindUri:null,subGraph:c.subGraph??null,layer:h,event:p,entityCount:c.entityCount,clickable:!1})}return o.sort((c,d)=>c.at&&d.at?d.at.getTime()-c.at.getTime():c.at&&!d.at?-1:!c.at&&d.at?1:c.entity.label.localeCompare(d.entity.label)),o.slice(0,i)}function G3(e,t={}){const{swmEvents:n,lifecycleEvents:r,...i}=t,o=r!=null,d=U3(e,{...i,excludeEvents:o?["added"]:void 0});return w.useMemo(()=>{const p=i.limit??200;if(t.typeIri)return{items:d.items,hasMore:d.hasMore};if(!o&&(!n||n.length===0))return{items:d.items,hasMore:d.hasMore};let h;if(o)h=H3(r,{agentUri:i.agentUri,subGraph:i.subGraph,limit:Number.POSITIVE_INFINITY});else{const v=new Map;for(const b of e)v.set(b.uri,b);h=F3(n,{entitiesByUri:v,agentUri:i.agentUri,subGraph:i.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((v,b)=>v.at&&b.at?b.at.getTime()-v.at.getTime():v.at&&!b.at?-1:!v.at&&b.at?1:v.entity.label.localeCompare(b.entity.label));const m=d.hasMore||g.length>p;return{items:g.slice(0,p),hasMore:m}},[d,n,r,o,e,i.agentUri,i.subGraph,i.limit,t.typeIri])}function $C(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),r=Math.abs(n),i=n<0,o=6e4,c=o*60,d=c*24;return r<o?i?"in a moment":"just now":r<c?i?`in ${Math.floor(r/o)}m`:`${Math.floor(r/o)}m ago`:r<d?i?`in ${Math.floor(r/c)}h`:`${Math.floor(r/c)}h ago`:r<7*d?i?`in ${Math.floor(r/d)}d`:`${Math.floor(r/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const Iw={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function V3(e,t){return e&&Iw[e]?Iw[e]:t==="human"?"👤":"◉"}function W3(e){const t=e.trim();if(!t)return"?";const n=t.split(/[\s_-]+/).filter(Boolean);return n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+(n[1][0]??"")).toUpperCase()}function Z3(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const us=({agent:e,fallbackUri:t,size:n="sm",showOperator:r=!1,onOpenAgent:i,className:o=""})=>{const c=gs();if(!e&&!t)return null;const d=i??(c==null?void 0:c.openAgent),p=(e==null?void 0:e.uri)??t,h=(e==null?void 0:e.name)??(t?Z3(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,v=V3(m,g),b=(e==null?void 0:e.color)??"hsl(0, 0%, 55%)",k=[h,m?`framework: ${m}`: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,p].filter(Boolean).join(`
|
|
1269
|
+
`),j=d?()=>d(p):void 0,C=!!j;return l.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${C?" interactive":""} ${o}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:C?"button":void 0,tabIndex:C?0:void 0,children:[l.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:b},children:[l.jsx("span",{className:"v10-agent-chip-initials",children:W3(h)}),l.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:v})]}),l.jsxs("span",{className:"v10-agent-chip-body",children:[l.jsx("span",{className:"v10-agent-chip-name",children:h}),n==="lg"&&((e==null?void 0:e.operatorName)||m)&&l.jsxs("span",{className:"v10-agent-chip-sub",children:[m&&g==="ai"&&l.jsx("span",{className:"v10-agent-chip-fw",children:m}),(e==null?void 0:e.operatorName)&&g==="ai"&&l.jsxs(l.Fragment,{children:[m&&l.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),l.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),g==="human"&&l.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),n==="md"&&r&&(e==null?void 0:e.operatorName)&&g==="ai"&&l.jsx("span",{className:"v10-agent-chip-sub",children:l.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},dm={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},Q3={working:"◇",shared:"◈",verified:"◉"},K3=200,Y3=({entities:e,agentUri:t,typeIri:n,subGraph:r,limit:i,includeUndated:o=!0,swmEvents:c,lifecycleEvents:d,lifecycleError:p,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:v,className:b=""})=>{const{items:k,hasMore:j}=G3(e,{agentUri:t,typeIri:n,subGraph:r,limit:i,includeUndated:o,swmEvents:c,lifecycleEvents:d}),C=Je.useMemo(()=>B3(k),[k]),S=gs(),N=qa(),O=j?`${i??K3}+`:String(k.length),M=p!=null&&k.length===0,T=h?l.jsxs("div",{className:"v10-activity-feed-title",children:[l.jsx("span",{className:"v10-activity-feed-title-label",children:h}),l.jsx("span",{className:"v10-activity-feed-title-count","data-state":M?"error":void 0,children:M?"—":O})]}):null,L=p?l.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:p,children:"Couldn't load recent activity."}):null;return k.length===0?l.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${b}`,children:[T,L??l.jsx("div",{className:"v10-activity-feed-empty-hint",children:v??"No activity with a timestamp yet."})]}):l.jsxs("div",{className:`v10-activity-feed ${b}`,children:[T,L,C.map(B=>l.jsxs("div",{className:"v10-activity-feed-bucket",children:[l.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[l.jsx("span",{className:"v10-activity-feed-bucket-label",children:B.label}),l.jsx("span",{className:"v10-activity-feed-bucket-count",children:B.items.length})]}),l.jsx("div",{className:"v10-activity-feed-items",children:B.items.map(_=>l.jsx(X3,{item:_,agents:S,profile:N,onSelectEntity:g,onOpenAgent:m},_.id))})]},B.key))]})};function X3({item:e,agents:t,profile:n,onSelectEntity:r,onOpenAgent:i}){const o=e.authorUri?t==null?void 0:t.get(e.authorUri):null,c=e.event==="typed",d=c&&e.kindUri?n==null?void 0:n.forType(e.kindUri):null,p=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":(d==null?void 0:d.label)??(e.kindUri?e.kindUri.split(/[#/]/).pop():null)??"Entity",h=e.event==="added"?"+":e.event==="promoted"?"⇡":e.event==="published"?"◉":(d==null?void 0:d.icon)??"◆",g=e.event==="promoted"?dm.shared:e.event==="published"?dm.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=dm[e.layer],v=c?J3(e.entity):null,b=(()=>{const j=[];return e.event!=="typed"&&j.push(p),j.push(e.entity.label),e.at&&j.push(e.at.toISOString()),j.join(`
|
|
1270
|
+
`)})(),k=l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"v10-activity-feed-layer",style:{color:m},title:`${e.layer} memory`,children:Q3[e.layer]}),l.jsxs("span",{className:"v10-activity-feed-type",style:{"--type-color":g},children:[l.jsx("span",{className:"v10-activity-feed-type-icon",children:h}),l.jsx("span",{className:"v10-activity-feed-type-label",children:p})]}),l.jsx("span",{className:"v10-activity-feed-title-text",children:e.entity.label}),v&&l.jsx("span",{className:`v10-activity-feed-status status-${ez(v)}`,children:v}),(o||e.authorUri)&&l.jsx("span",{className:"v10-activity-feed-author",children:l.jsx(us,{agent:o??void 0,fallbackUri:e.authorUri??void 0,size:"sm",onOpenAgent:i})}),l.jsx("span",{className:"v10-activity-feed-time",title:e.at?e.at.toLocaleString():"no timestamp",children:$C(e.at)})]});return e.clickable?l.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>r(e.entity.uri),title:b,children:k}):l.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:b,"aria-disabled":"true",children:k})}function J3(e){var n;const t=["http://dkg.io/ontology/decisions/status","http://dkg.io/ontology/tasks/status","http://dkg.io/ontology/github/state"];for(const r of t){const i=(n=e.properties.get(r))==null?void 0:n[0];if(i)return i}return null}function ez(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"}}const tz={wm:"working",swm:"shared",vm:"verified"};function nz(e){var v,b,k,j;const t=new Map;if(!e)return t;const n="http://dkg.io/ontology/decisions/status",r="http://dkg.io/ontology/tasks/status",i="http://dkg.io/ontology/tasks/priority",o="http://dkg.io/ontology/github/state",c="http://dkg.io/ontology/decisions/Decision",d="http://dkg.io/ontology/tasks/Task",p="http://dkg.io/ontology/github/PullRequest";let h=0,g=0,m=0;for(const C of e)if(C.types.includes(c))((v=C.properties.get(n))==null?void 0:v[0])==="proposed"&&h++;else if(C.types.includes(d)){const S=(b=C.properties.get(i))==null?void 0:b[0],N=(k=C.properties.get(r))==null?void 0:k[0];S==="p0"&&N!=="done"&&N!=="cancelled"&&g++}else C.types.includes(p)&&((j=C.properties.get(o))==null?void 0:j[0])==="open"&&m++;return h>0&&t.set("decisions",{label:`${h} proposed`,tone:"warn"}),g>0&&t.set("tasks",{label:`${g} p0`,tone:"danger"}),m>0&&t.set("github",{label:`${m} open`,tone:"info"}),t}const fm=({contextGraphId:e,profile:t,selected:n,onSelect:r,entities:i,layer:o,enabledScope:c,allTriplesTotal:d})=>{const[p,h]=Je.useState([]),[g,m]=Je.useState(!0),v=Je.useMemo(()=>nz(i),[i]),b=Je.useRef(0),k=Je.useMemo(()=>c&&c.size>0&&c.size<3?new Set(c):c&&c.size>=3?null:o?new Set([tz[o]]):null,[c,o]),j=Je.useMemo(()=>{if(!i)return null;const D=new Map;for(const q of i)if(!(k&&!k.has(q.trustLevel)))for(const G of q.subGraphs)D.set(G,(D.get(G)??0)+1);return D},[k,i]),C=Je.useMemo(()=>{if(!i)return null;let D=0;for(const q of i)k&&!k.has(q.trustLevel)||D++;return D},[k,i]),S=Je.useMemo(()=>{if(!i)return null;let D=0;for(const q of i)k&&!k.has(q.trustLevel)||q.subGraphs.size>0||D++;return D},[k,i]),N=Je.useCallback(()=>{const D=++b.current;m(!0),kn.fetchSubGraphs(e).then(q=>{D===b.current&&h(q.subGraphs??[])}).catch(()=>{}).finally(()=>{D===b.current&&m(!1)})},[e]);Je.useEffect(()=>(N(),()=>{b.current++}),[N]),_o(e,N);const A=Je.useMemo(()=>p.filter(Tv).map(D=>{const q=t.forSubGraph(D.name),G=j!==null?j.get(D.name)??0:D.entityCount;return{slug:D.name,icon:q.icon??"•",color:q.color??"#64748b",displayName:q.displayName??D.name,description:q.description??D.description,rank:q.rank??99,entityCount:G,tripleCount:D.tripleCount,layerScoped:j!==null}}).sort((D,q)=>D.rank-q.rank),[p,t,j]),M=S!==null&&S>0||n===Ur;if(g&&A.length===0&&!M||A.length===0&&!M)return null;const T=C??A.reduce((D,q)=>D+q.entityCount,0),L=A.reduce((D,q)=>D+q.tripleCount,0),B={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},_=k?[...k].map(D=>B[D]).join(" + "):null,R=_?` in ${_}`:"",F=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${T} entities${R}${_?"":` · ${d??L} triples`}`,Y=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${T} entities${R}.`;return l.jsxs("div",{className:"v10-subgraph-bar",children:[l.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),l.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>r(null),title:F,"aria-label":Y,children:[l.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),l.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),l.jsx("span",{className:"v10-subgraph-chip-count",children:T})]}),A.map(D=>{const q=v.get(D.slug);return l.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===D.slug?" active":""}${q?" has-badge":""}`,onClick:()=>r(D.slug,o),title:`${D.displayName}${D.description?" · "+D.description:""} · ${D.entityCount} entities${R}${_?"":` · ${D.tripleCount} triples`}${q?" · "+q.label:""}`,style:{"--sg-color":D.color},children:[l.jsx("span",{className:"v10-subgraph-chip-icon",style:{color:D.color},children:D.icon}),l.jsx("span",{className:"v10-subgraph-chip-label",children:D.displayName}),l.jsx("span",{className:"v10-subgraph-chip-count",children:D.entityCount}),q&&l.jsxs("span",{className:`v10-subgraph-chip-badge tone-${q.tone}`,children:[l.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),q.label]})]},D.slug)}),M&&(()=>{const D=S??0,q=n===Ur;return l.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${q?" active":""}`,"data-active":q,"data-count":D,onClick:()=>r(Ur,o),title:`Entities not in any subgraph (Context Graph root) · ${D} entities${R}`,"aria-label":"Entities not in any subgraph (Context Graph root)",children:[l.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊘"}),l.jsx("span",{className:"v10-subgraph-chip-label",children:"Root"}),l.jsx("span",{className:"v10-subgraph-chip-count",children:D})]})})()]})},Mv="context-graph-primer",PC={id:Mv,label:"What is a Context Graph?",closable:!0},UC={neutral:"var(--border-strong)",wm:"var(--layer-working, #64748b)",swm:"var(--layer-shared, #f59e0b)",vm:"var(--layer-verified, #22c55e)",danger:"var(--text-danger)",query:"#38bdf8",warning:"var(--text-warning)"};function Jt({icon:e,title:t,description:n,actions:r=[],tone:i="neutral",compact:o=!1,inline:c=!1,className:d=""}){const p={"--v10-empty-accent":UC[i]};return l.jsxs("div",{className:["v10-empty-state",o?"compact":"",c?"inline":"",d].filter(Boolean).join(" "),"data-tone":i,style:p,children:[e&&l.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),l.jsxs("div",{className:"v10-empty-state-copy",children:[l.jsx("div",{className:"v10-empty-state-title",children:t}),n&&l.jsx("div",{className:"v10-empty-state-desc",children:n}),r.length>0&&l.jsx("div",{className:"v10-empty-state-actions",children:r.map(h=>l.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,"data-testid":h.testId,children:h.label},h.label))})]})]})}function pf({items:e,layer:t,compact:n=!1,className:r=""}){const i=t?{"--v10-stat-accent":UC[t]}:void 0;return l.jsx("div",{className:["v10-stat-strip",n?"compact":"",r].filter(Boolean).join(" "),"data-layer":t,style:i,children:e.map((o,c)=>l.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":o.id,title:o.tooltip,children:[l.jsx("span",{className:"v10-stat-strip-label",children:o.label}),l.jsx("span",{className:"v10-stat-strip-value",children:o.value}),o.hint&&l.jsx("span",{className:"v10-stat-strip-hint",children:o.hint})]},o.id??c))})}const Lv=w.lazy(()=>kt(()=>import("./index-UAg6wmCv.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),rz="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",az=new Map(Sv.map((e,t)=>[e,t]));function hg(e){const t=e.trim();return!t||t.startsWith('"')?!1:t.startsWith("_:")||t.startsWith("<")&&t.endsWith(">")?!0:/\s/.test(t)?!1:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function $a(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function iz(e){const t=new Set,n=new Map,r=new Map,i=new Map;for(const d of e){const p=$a(d.subject);t.add(p);const h=az.get(d.predicate);if(h!==void 0){const m=uf(d.object).trim();if(m){const v=i.get(p);(v===void 0||h<v)&&(r.set(p,m),i.set(p,h))}}if($a(d.predicate)===rz||!hg(d.object))continue;const g=$a(d.object);n.set(p,(n.get(p)??0)+1),n.set(g,(n.get(g)??0)+1)}const o=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:r.get(d)??xC(void 0,d)})).sort((d,p)=>d.label.localeCompare(p.label));if(o.length===0)return{canvasTriples:e,singletonItems:o};const c=new Set(o.map(d=>d.uri));return{canvasTriples:e.filter(d=>!c.has($a(d.subject))&&!c.has($a(d.object))),singletonItems:o}}function sz(e){return e==="wm"?"Working Memory graph: local entities connected by entity-to-entity triples from loaded layer data.":e==="swm"?"Shared Working Memory graph: promoted shared entities connected by entity-to-entity triples from loaded layer data.":"Verifiable Memory graph: published knowledge assets, provenance anchors, and connected entity-to-entity triples from loaded layer data."}function oz({items:e,onSelect:t}){return e.length===0?null:l.jsxs("div",{className:"v10-graph-singleton-shelf","aria-label":"Standalone entities without visible links",children:[l.jsxs("div",{className:"v10-graph-singleton-head",title:"Entities with no visible links are grouped here to keep the graph readable.",children:[l.jsx("span",{children:"Standalone entities"}),l.jsx("span",{children:e.length})]}),l.jsx("div",{className:"v10-graph-singleton-list",children:e.map(({uri:n,label:r})=>l.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:r},n))})]})}const lz=2500;function Dw(e,t=lz){if(e.length<=t)return e;const n=new Map;for(const c of e)n.set(c.subject,(n.get(c.subject)??0)+1);const r=[...n.entries()].sort((c,d)=>d[1]-c[1]).map(([c])=>c),i=new Set;let o=0;for(const c of r){const d=n.get(c)??0;o+d>t||(i.add(c),o+=d)}return i.size===0&&r.length>0&&i.add(r[0]),e.filter(c=>i.has(c.subject)).slice(0,t)}function bd({title:e,scopeLabel:t,tone:n,className:r,rail:i,overlay:o,showScopeLabel:c=!0,singletonItems:d=[],onSingletonClick:p,renderGraph:h}){const[g,m]=w.useState(!1);w.useEffect(()=>{if(!g)return;const k=j=>{j.key==="Escape"&&m(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[g]);const v=l.jsx("button",{type:"button",className:`v10-graph-expand-btn${c?"":" in-canvas"}`,onClick:()=>m(!0),title:`Expand ${e}`,"aria-label":`Expand ${e}`,children:"⤢"}),b=k=>l.jsxs(l.Fragment,{children:[c&&!k&&l.jsxs("div",{className:"v10-graph-shell-bar",children:[l.jsx("div",{className:"v10-graph-scope",title:t,children:t}),v]}),l.jsxs("div",{className:"v10-graph-body",children:[l.jsxs("div",{className:"v10-graph-canvas",children:[!c&&!k&&v,l.jsx("div",{className:"v10-graph-view",children:h(k)}),o&&l.jsx("div",{className:"v10-graph-overlay",children:o}),l.jsx(oz,{items:d,onSelect:p})]}),i&&l.jsx("aside",{className:"v10-graph-rail",children:i})]})]});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${r?` ${r}`:""}`,children:!g&&b(!1)}),g&&l.jsx("div",{className:"v10-graph-expanded-backdrop",role:"dialog","aria-modal":"true","aria-label":`${e} expanded`,onClick:k=>{k.target===k.currentTarget&&m(!1)},children:l.jsxs("div",{className:`v10-graph-expanded-panel v10-graph-shell-${n}`,children:[l.jsxs("div",{className:"v10-graph-expanded-head",children:[l.jsxs("div",{children:[l.jsx("div",{className:"v10-graph-expanded-title",children:e}),l.jsx("div",{className:"v10-graph-expanded-subtitle",children:t})]}),l.jsx("button",{type:"button",className:"v10-graph-expanded-close",onClick:()=>m(!1),"aria-label":`Close expanded ${e}`,children:"×"})]}),l.jsx("div",{className:"v10-graph-expanded-body",children:b(!0)})]})})]})}function BC({layer:e,triples:t,onNodeClick:n,contextGraphId:r,scopeLabel:i,trustLegendActiveLayer:o,title:c,scopeEntities:d,swmAttribution:p,layerEntities:h,nodeColorsOverride:g}){const{title:m}=qn[e],v=c??m,b=tr($=>$.theme),k=w.useMemo(()=>{if(e!=="vm")return;const $=new Set;for(const U of t)$.add(U.subject),hg(U.object)&&$.add(U.object);return $},[t,e]),{anchors:j,decorationTriples:C}=WI(e==="vm"&&r?r:void 0,k),S=zC(e==="swm"&&r&&!p?r:void 0),N=p??S,A=w.useMemo(()=>{if(!h||h.length===0)return t;const $=new Set;for(const U of h)$.add(Nt(U.uri));return zd(t,$)},[t,h]),O=w.useMemo(()=>{const $=new Set,U=[],Z=I=>{const ae=`${I.subject}|${I.predicate}|${I.object}`;$.has(ae)||($.add(ae),U.push({subject:I.subject,predicate:I.predicate,object:I.object}))};for(const I of A)Z(I);for(const I of C)Z(I);return U},[A,C]),M=O,T=w.useMemo(()=>{const $=e==="swm"?N.nodeColors:void 0;if(!(!$&&!g))return $?g?{...$,...g}:$:g},[e,N.nodeColors,g]),L=w.useMemo(()=>aD(e,T),[e,T]),{canvasTriples:B,singletonItems:_}=w.useMemo(()=>iz(M),[M]),R=w.useMemo(()=>{if(!d||d.length===0)return _;const $=new Set(_.map(Z=>$a(Z.uri)));for(const Z of B)$.add($a(Z.subject)),hg(Z.object)&&$.add($a(Z.object));const U=[];for(const Z of d){const I=$a(Z.uri);$.has(I)||($.add(I),U.push({uri:I,label:Z.label||xC(void 0,I)}))}return U.length===0?_:[..._,...U].sort((Z,I)=>Z.label.localeCompare(I.label))},[_,B,d]),z=`${r??"context"}:${e}`,F=e==="swm"&&!!r&&N.loading,Y=`${v} graph`,D=i??sz(e),q=o===null&&!!i,G=o===null?void 0:o??e,Q=e==="vm"&&j.length>0||e==="swm"&&N.palette.length>0?l.jsxs(l.Fragment,{children:[e==="vm"&&j.length>0&&l.jsx(uz,{anchors:j}),e==="swm"&&N.palette.length>0&&l.jsx(cz,{palette:N.palette,conflicts:N.conflicts.length})]}):null,H=w.useMemo(()=>({name:`${z}:${b}`,palette:b}),[z,b]);return O.length===0&&R.length===0?l.jsx(bd,{title:Y,scopeLabel:D,tone:e,className:"v10-graph-view-fill",showScopeLabel:q,renderGraph:()=>l.jsx("div",{className:"v10-layer-empty-shell",children:l.jsx(Jt,{compact:!0,tone:e,icon:qn[e].icon,title:`No triples in ${v}`,description:"The graph will appear when this layer has connected triples."})})}):F?l.jsx(bd,{title:Y,scopeLabel:D,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:q,renderGraph:()=>l.jsx("div",{className:"v10-layer-empty-shell",children:l.jsx(Jt,{compact:!0,tone:"swm",icon:qn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):l.jsx(bd,{title:Y,scopeLabel:D,tone:e,className:"v10-graph-view-fill",overlay:Q,showScopeLabel:q,singletonItems:R,onSingletonClick:$=>n==null?void 0:n(G?{id:$,trustLayer:G}:{id:$}),renderGraph:$=>B.length>0?l.jsx(w.Suspense,{fallback:l.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:l.jsx(Lv,{data:B,format:"triples",options:L,viewConfig:H,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:G?U=>n==null?void 0:n({...U,trustLayer:G}):n,initialFit:!0},`${z}:${$?"expanded":"inline"}:${B.length}`)}):l.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function cz({palette:e,conflicts:t}){return l.jsxs("div",{className:"v10-swm-legend","aria-label":"SWM attribution legend",children:[l.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-head",children:[l.jsx("span",{children:"SWM attribution"}),l.jsxs("span",{className:"v10-swm-legend-count",children:[e.length," agent",e.length===1?"":"s"]})]}),e.slice(0,8).map(n=>l.jsxs("div",{className:"v10-swm-legend-row",title:n.agent,children:[l.jsx("span",{className:"v10-swm-legend-swatch",style:{background:n.color}}),l.jsx("span",{className:"v10-swm-legend-label",children:n.label}),l.jsx("span",{className:"v10-swm-legend-metric",children:n.entityCount})]},n.agent)),t>0&&l.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-conflict",children:[l.jsx("span",{className:"v10-swm-legend-swatch",style:{background:"#f59e0b"},children:"!"}),l.jsx("span",{className:"v10-swm-legend-label",children:"In review"}),l.jsx("span",{className:"v10-swm-legend-metric",children:t})]})]})}function uz({anchors:e}){var i;const t=w.useMemo(()=>{const o=new Set;for(const c of e)for(const d of c.agents)o.add(d);return o.size},[e]),n=(i=e[0])==null?void 0:i.publishedAt,r=(()=>{if(!n)return null;try{return new Date(n).toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return null}})();return l.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[l.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[l.jsx("span",{children:"VM provenance layer"}),l.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),l.jsxs("div",{className:"v10-vm-legend-row",children:[l.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),l.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),l.jsxs("div",{className:"v10-vm-legend-row",children:[l.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),l.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),l.jsxs("div",{className:"v10-vm-legend-row",children:[l.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),l.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),r&&l.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",r]})]})}function dz({active:e,counts:t,onSwitch:n,onShare:r,onImport:i,onRefresh:o}){const[c,d]=w.useState(!1),p=w.useRef(null),h=g=>{d(!1),n(g)};return w.useEffect(()=>{if(!c)return;const g=m=>{var b;const v=m.target;v&&((b=p.current)!=null&&b.contains(v))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[c]),l.jsxs("div",{className:"v10-layer-switcher",children:[l.jsxs("button",{className:`v10-layer-switch-btn ${e==="overview"?"active":""}`,"data-layer":"overview","aria-label":"Overview",title:"Overview",onClick:()=>h("overview"),children:[l.jsx("span",{className:"v10-layer-switch-icon",children:"◎"}),l.jsx("span",{className:"v10-layer-switch-label",children:"Overview"})]}),l.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),l.jsxs("button",{className:`v10-layer-switch-btn ${e==="wm"?"active":""}`,"data-layer":"wm","aria-label":"Working Memory",title:"Working Memory",onClick:()=>h("wm"),children:[l.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#64748b"},children:"◇"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Working Memory"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"WM"}),t.wm>0&&l.jsx("span",{className:"v10-layer-switch-count",children:t.wm})]}),l.jsxs("button",{className:`v10-layer-switch-btn ${e==="swm"?"active":""}`,"data-layer":"swm","aria-label":"Shared Working Memory",title:"Shared Working Memory",onClick:()=>h("swm"),children:[l.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#f59e0b"},children:"◈"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Shared Working Memory"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"SWM"}),t.swm>0&&l.jsx("span",{className:"v10-layer-switch-count",children:t.swm})]}),l.jsxs("button",{className:`v10-layer-switch-btn ${e==="vm"?"active":""}`,"data-layer":"vm","aria-label":"Verifiable Memory",title:"Verifiable Memory",onClick:()=>h("vm"),children:[l.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#22c55e"},children:"◉"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Verifiable Memory"}),l.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"VM"}),t.vm>0&&l.jsx("span",{className:"v10-layer-switch-count",children:t.vm})]}),l.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),l.jsxs("button",{className:`v10-layer-switch-btn ${e==="graph-overview"?"active":""}`,"data-layer":"graph-overview","aria-label":"Subgraphs",title:"Subgraphs",onClick:()=>h("graph-overview"),children:[l.jsx("span",{className:"v10-layer-switch-icon",children:"⌬"}),l.jsx("span",{className:"v10-layer-switch-label",children:"Subgraphs"})]}),l.jsxs("div",{ref:p,className:"v10-layer-more",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||d(!1)},children:[l.jsxs("button",{type:"button",className:`v10-layer-switch-btn v10-layer-more-btn ${e==="query"?"active":""}`,"data-layer":"query","aria-haspopup":"menu","aria-expanded":c,"aria-label":"More Context Graph views",title:"More Context Graph views",onClick:()=>d(g=>!g),children:[l.jsx("span",{className:"v10-layer-switch-icon",children:"⋯"}),l.jsx("span",{className:"v10-layer-switch-label",children:"More"})]}),c&&l.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:l.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[l.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),l.jsx("div",{className:"v10-layer-switcher-spacer"}),l.jsxs("div",{className:"v10-layer-switcher-actions",children:[l.jsxs("button",{className:"v10-layer-action-btn",onClick:r,"aria-label":"Share Context Graph",children:[l.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),l.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),l.jsxs("button",{className:"v10-layer-action-btn",onClick:i,"aria-label":"Import into Context Graph",children:[l.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),l.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),l.jsx("button",{className:"v10-layer-action-btn",onClick:o,"aria-label":"Refresh Context Graph data",children:l.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function fz({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:r}){const i=e.name||t.displayName||e.id;return l.jsxs("div",{className:"v10-project-strip",style:{"--sg-color":(n==null?void 0:n.color)??t.primaryColor},children:[l.jsx("span",{className:"v10-project-strip-dot",style:{background:t.primaryColor}}),l.jsx("button",{type:"button",className:"v10-project-strip-name",onClick:n?r:void 0,disabled:!n,title:n?"Back to context graph overview":e.id,children:i}),n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"v10-project-strip-sep",children:"›"}),l.jsxs("span",{className:"v10-project-strip-sg",children:[l.jsx("span",{className:"v10-project-strip-sg-icon",style:{color:n.color},children:n.icon??"•"}),n.displayName??n.slug]}),n.description&&l.jsx("span",{className:"v10-project-strip-desc",title:n.description,children:n.description})]}):e.description&&l.jsx("span",{className:"v10-project-strip-desc",title:e.description,children:e.description})]})}function pz(e,t,n,r,i){const o=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",c=new Set([t==null?void 0:t.agentDid,t==null?void 0:t.agentAddress].filter(h=>typeof h=="string"&&h.trim().length>0).map(tn)),d=c.size>0;return o&&d&&c.has(tn(o))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?o&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:o&&!d&&n==="error"?{label:"Role unknown",title:"This agent is involved in this Context Graph, but curator status could not be confirmed.",tone:"unknown"}:{label:"Joined",title:"This agent is involved in this Context Graph; curator status is shown only when identity metadata confirms it.",tone:"participant"}:(e==null?void 0:e.callerInvolved)===!1?{label:"Not joined",title:"This agent is not listed as curator or participant for this Context Graph.",tone:"viewer"}:i==="ok"&&r.map(h=>h.trim()).filter(Boolean).some(h=>c.has(tn(h)))?{label:"Joined",title:"This agent is listed as a participant for this Context Graph.",tone:"participant"}:{label:"Role unknown",title:"The node did not provide enough role metadata for this Context Graph.",tone:"unknown"}}function hz(e,t,n){if(cs(e==null?void 0:e.accessPolicy)==="public")return{id:"participants",value:"Open",label:"Public access",tooltip:"Public Context Graphs do not have an authoritative allowlist count."};if(n==="loading")return{id:"participants",value:"...",label:"Agents with access",tooltip:"Participant list is loading."};if(n==="error")return{id:"participants",value:"Unavailable",label:"Agents with access",tooltip:"Participant list unavailable; access count is unknown."};const i=new Set(t.map(c=>c.trim()).filter(Boolean).map(tn)),o=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return o&&i.add(tn(o)),{id:"participants",value:i.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function mz(e){const t=cs(e);return t==="public"?{label:"Public",title:"Public Context Graph.",tone:"public"}:t==="private"?{label:"Curated",title:"Curated Context Graph with access controlled by the curator.",tone:"curated"}:{label:"Access unknown",title:"The node did not provide an access policy for this Context Graph.",tone:"unknown"}}function gz({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,p;const r=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!r)return"unknown";const i=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",o=((p=t==null?void 0:t.agentAddress)==null?void 0:p.trim())??"",c=i||o;return c?tn(r)===tn(c)?"curator":"not-curator":"unknown"}function vz(e){return new Set([e==null?void 0:e.agentDid,e==null?void 0:e.agentAddress].filter(t=>typeof t=="string"&&t.trim().length>0).map(tn))}function yz({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:r=!1,participants:i,participantsStatus:o="ok",currentAgent:c,currentAgentStatus:d="ok",onSwitchLayer:p,onOpenPrimer:h}){var H,$,U;const{wm:g,swm:m,vm:v}=t.counts,b=g+m+v,k=pz(e,c??null,d,i,o),j=mz(e==null?void 0:e.accessPolicy),C=hz(e,i,o),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",N=S?tn(S):"",A=cs(e==null?void 0:e.accessPolicy)==="public",O=vz(c??null),M=Object.values(t.layerStatus??{}),T=M.filter(Z=>Z==="error").length,L=!t.loading&&M.length===3&&T===3,B=!t.loading&&T>0,_=t.loading?"Loading memory layers...":L||t.error?"Live memory counts are unavailable.":t.partial||B?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",R=L?"Unavailable":b.toLocaleString(),{total:z}=Av(t),F=!t.loading&&(t.partial||B),Y=L?"Unavailable":t.loading&&z===0?"...":F?`${z.toLocaleString()}+`:z.toLocaleString(),D=L?"Live triple counts are unavailable.":F?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",q=n==null?r?"Unavailable":"...":n.toLocaleString(),G=n==null?r?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",W=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((H=t.layerStatus)==null?void 0:H.wm)??"ok",color:"#64748b"},{key:"swm",label:"Shared Working Memory",desc:"Collaborative review",count:m,status:(($=t.layerStatus)==null?void 0:$.swm)??"ok",color:"#f59e0b"},{key:"vm",label:"Verifiable Memory",desc:"Published on-chain",count:v,status:((U=t.layerStatus)==null?void 0:U.vm)??"ok",color:"#22c55e"}],Q=W.some(Z=>Z.status==="error");return l.jsxs("div",{className:"v10-po",children:[l.jsxs("div",{className:"v10-po-identity","data-section":"identity",children:[l.jsxs("div",{className:"v10-po-identity-pairs",children:[l.jsxs("div",{className:"v10-po-identity-pair",children:[l.jsx("span",{className:"v10-po-identity-label",children:"Your role:"}),l.jsx("span",{className:"v10-po-badge","data-role":k.tone,title:k.title,children:k.label})]}),l.jsxs("div",{className:"v10-po-identity-pair",children:[l.jsx("span",{className:"v10-po-identity-label",children:"Context Graph:"}),l.jsx("span",{className:"v10-po-badge","data-cg-type":j.tone,title:j.title,children:j.label})]})]}),h&&l.jsx("button",{type:"button",className:"v10-po-identity-primer",onClick:h,title:"Open the Context Graph primer",children:"What is a Context Graph?"})]}),l.jsxs("div",{"data-section":"at-a-glance",className:"v10-po-stat-block",children:[l.jsx("div",{className:"v10-po-section-title",children:"At a glance"}),l.jsx(pf,{className:"v10-po-stat-strip",items:[{id:"entities",value:R,label:"Entities",tooltip:_},{id:"triples",value:Y,label:"Triples",tooltip:D},{id:"subgraphs",value:q,label:"Subgraphs",tooltip:G},C]})]}),l.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[l.jsx("div",{className:"v10-po-pipeline-head",children:l.jsxs("div",{children:[l.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),l.jsx("div",{className:"v10-po-section-desc",children:"Entities move from private staging to shared review; published assertion bundles become Knowledge Assets with on-chain provenance."})]})}),l.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!Q&&b>0?W.map(Z=>{const I=Z.count>0?Z.count/b*100:0;return l.jsx("span",{className:`v10-po-pipeline-seg ${Z.key}`,style:{width:`${I}%`,background:Z.color}},Z.key)}):l.jsx("span",{className:"v10-po-pipeline-empty"})}),l.jsx("div",{className:"v10-po-pipeline-steps",children:W.map((Z,I)=>l.jsxs("button",{type:"button",className:`v10-po-pipeline-step ${Z.key}`,onClick:()=>p==null?void 0:p(Z.key),style:{"--po-layer-color":Z.color},children:[l.jsx("span",{className:"v10-po-pipeline-step-index",children:I+1}),l.jsxs("span",{className:"v10-po-pipeline-step-copy",children:[l.jsx("span",{className:"v10-po-pipeline-step-label",children:Z.label}),l.jsx("span",{className:"v10-po-pipeline-step-desc",children:Z.desc})]}),l.jsx("span",{className:"v10-po-pipeline-step-count",children:Z.status==="error"?"Unavailable":`${Z.count.toLocaleString()} ${ua(Z.key,Z.count)}`})]},Z.key))})]}),l.jsxs("div",{className:"v10-po-people","data-section":"participants",children:[l.jsx("div",{className:"v10-po-section-title",children:"Participant agents"}),(()=>{const Z="did:dkg:agent:",I=oe=>oe.toLowerCase().startsWith(Z)?oe.slice(Z.length):oe,ae=new Set,le=[];if(S&&o==="ok"){const oe=tn(S);ae.add(oe),le.push({display:I(S),full:S,canonical:oe})}if(o==="ok")for(const oe of i){const we=tn(oe);ae.has(we)||(ae.add(we),le.push({display:I(oe),full:oe,canonical:we}))}if(le.length===0){const oe=A?"This Context Graph is public — anyone can subscribe.":o==="loading"?"Loading participant agents...":o==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return l.jsx("div",{className:"v10-po-people-empty",children:oe})}return l.jsx("div",{className:"v10-po-participants-list",children:le.map(({display:oe,full:we,canonical:Ee})=>{const Oe=O.has(Ee),He=!!N&&Ee===N,ke=`${oe.slice(0,6)}…${oe.slice(-4)}`,ve=[ke];return Oe&&ve.push("you"),He&&ve.push("curator"),l.jsxs("span",{className:`v10-po-participant${Oe?" is-self":""}${He?" is-curator":""}`,title:we,"aria-label":ve.join(" "),children:[l.jsx("span",{className:"v10-po-participant-name",children:ke}),Oe&&l.jsx("span",{className:"v10-po-participant-tag",children:"you"}),He&&l.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},Ee)})})})()]})]})}function bz({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[r,i]=w.useState([]),[o,c]=w.useState(null),[d,p]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){i([]),p("idle");return}const b=++h.current;p("loading"),Pj(e).then(k=>{h.current===b&&(i(k.requests.filter(j=>j.status==="pending")),p("idle"))}).catch(()=>{h.current===b&&(i([]),p("error"))})},[e,t]);if(w.useEffect(()=>(g(),()=>{h.current++}),[g]),ms(w.useCallback(b=>{var k;b.type!=="join_request"&&b.type!=="join_approved"&&b.type!=="join_rejected"||((k=b.data)==null?void 0:k.contextGraphId)===e&&g()},[e,g])),t==="not-curator")return null;if(t==="unknown")return l.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[l.jsx("header",{className:"v10-po-join-head",children:l.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"})}),l.jsx("div",{className:"v10-po-join-empty",children:"Verifying access…"})]});const m=async b=>{c(b);try{await sv(e,b),i(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{c(null)}},v=async b=>{c(b);try{await ov(e,b),i(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{c(null)}};return l.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[l.jsxs("header",{className:"v10-po-join-head",children:[l.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),l.jsx("span",{className:"v10-po-join-count","data-empty":r.length===0?"true":"false",children:r.length})]}),d==="loading"?l.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?l.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):r.length===0?l.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):l.jsx("div",{className:"v10-po-join-list",children:r.map(b=>l.jsxs("div",{className:"v10-po-join-item",children:[l.jsxs("div",{className:"v10-po-join-info",children:[l.jsx("span",{className:"v10-po-join-name",children:b.name||`${b.agentAddress.slice(0,6)}…${b.agentAddress.slice(-4)}`}),l.jsxs("span",{className:"v10-po-join-addr",title:b.agentAddress,children:[b.agentAddress.slice(0,10),"…"]})]}),l.jsxs("div",{className:"v10-po-join-actions",children:[l.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(b.agentAddress),disabled:o===b.agentAddress,children:o===b.agentAddress?"…":"✓ Approve"}),l.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>v(b.agentAddress),disabled:o===b.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},b.agentAddress))})]})}function xz({onOpenPrimer:e}){return l.jsxs("div",{className:"v10-po-primer-footer","data-section":"primer",children:[l.jsx("span",{className:"v10-po-primer-footer-lede",children:"New here?"}),l.jsx("span",{className:"v10-po-primer-footer-arrow","aria-hidden":"true",children:"→"}),l.jsx("button",{type:"button",className:"v10-po-primer-footer-link",onClick:e,children:"What is a Context Graph?"}),l.jsx("div",{className:"v10-po-primer-footer-sub",children:"A short primer on context graphs, the WM → SWM → VM pipeline, and how participant agents collaborate."})]})}const wz=(e,t)=>!!e&&!!t&&e.toLowerCase()===t.toLowerCase();function kz(e,t=0){const n=oc(c=>c.trackedIds),r=n.join(","),{data:i,loading:o}=vr(async()=>{if(n.length===0)return{wallets:[],ownerPublish:!1,resolved:!1};const c=await pv().catch(()=>null),d=(c==null?void 0:c.wallets)??[];let p=!1;try{const{contextGraphs:g}=await rf(),m=(g??[]).find(b=>(b==null?void 0:b.id)===e),v=m==null?void 0:m.curator;if(v){const b=await yc().catch(()=>null);p=!!(b!=null&&b.agentDid&&tn(v)===tn(b.agentDid))}}catch{p=!1}return{wallets:await Promise.all(d.map(async g=>{var O;const m=(O=c==null?void 0:c.balances)==null?void 0:O.find(M=>wz(M.address,g)),v=m==null,b=m!=null&&Number(m.eth)>0,k=m!=null&&Number(m.trac)>0;let j,C=!1,S=!1,N,A=!1;for(const M of n){const T=await Td(M,g,{extended:!0}).catch(()=>null);if(T===null){A=!0;continue}const L=ag(T);if(L.outcome==="inconclusive"){A=!0;continue}if(L.outcome!=="unregistered"){if(L.outcome==="covers"){j={accountId:M,discountBps:T.discountBps,untracked:!1};break}L.dead&&(C=!0,N||(N=M)),L.hasBudget||(S=!0)}}if(!j&&!A&&!C&&!S){const M=await lO(g).catch(()=>{});if(M===void 0)A=!0;else if(M.accountId!=null&&!n.includes(M.accountId)){const T=M.accountId,L=await Td(T,g,{extended:!0}).catch(()=>null);if(L===null)A=!0;else{const B=ag(L);B.outcome==="covers"?j={accountId:T,discountBps:L.discountBps,untracked:!0}:B.outcome==="uncovered"?(B.dead&&(C=!0,N||(N=T)),B.hasBudget||(S=!0)):A=!0}}}return{wallet:g,covered:!!j,accountId:j==null?void 0:j.accountId,discountBps:j==null?void 0:j.discountBps,coverUntracked:(j==null?void 0:j.untracked)??!1,deadAccountId:j?void 0:N,inconclusive:!j&&A,balanceUnknown:v,gasFunded:b,hasTrac:k,sawExpired:C,sawInsolvent:S}})),ownerPublish:p,resolved:d.length>0}},[r,e],t);return w.useMemo(()=>{const c=(i==null?void 0:i.wallets)??[],d=(i==null?void 0:i.ownerPublish)??!1,p=(i==null?void 0:i.resolved)??!1;if(n.length===0||!p||c.length===0)return{verdict:"unknown",loading:o,ownerPublish:d,anyGasFunded:!1,reasons:[],conditions:{approved:!1,gasFunded:!1,notExpired:!1,solvent:!1},wallets:c};const h=c.filter(S=>S.covered),g=c.filter(S=>!S.covered),m=g.filter(S=>!S.inconclusive&&!S.balanceUnknown),v=g.filter(S=>S.inconclusive||S.balanceUnknown),b={approved:g.length===0,gasFunded:c.every(S=>S.gasFunded),notExpired:!c.some(S=>S.sawExpired),solvent:!c.some(S=>S.sawInsolvent)};let k;const j=[];if(g.length===0)h.some(S=>S.gasFunded||S.balanceUnknown)?k="eligible":(k="fallthrough-no-funds",j.push("every approved signing wallet is out of gas"));else if(m.length===0&&v.length>0)k="unknown";else{const S=c.some(N=>(N.covered||N.hasTrac)&&N.gasFunded);!S&&v.length>0?k="unknown":(k=S?"fallthrough":"fallthrough-no-funds",j.push(`${h.length} of ${c.length} signing wallets approved`),c.some(N=>N.sawExpired)&&j.push("a PCA has expired or been fully swept"),c.some(N=>N.sawInsolvent)&&j.push("a PCA is out of budget"),b.gasFunded||j.push("a signing wallet has no gas"),g.some(N=>N.inconclusive)&&j.push("a wallet’s PCA coverage couldn’t be checked"),g.some(N=>N.balanceUnknown)&&j.push("a signing wallet’s balance couldn’t be checked"))}const C=h.reduce((S,N)=>(N.discountBps??-1)>((S==null?void 0:S.discountBps)??-1)?N:S,void 0);return{verdict:k,loading:o,accountId:C==null?void 0:C.accountId,discountBps:C==null?void 0:C.discountBps,accountUntracked:C==null?void 0:C.coverUntracked,ownerPublish:d,anyGasFunded:c.some(S=>S.gasFunded||S.balanceUnknown),reasons:j,conditions:b,wallets:c}},[i,o,n.length])}function Sz(e){return e.verdict==="fallthrough-no-funds"&&!(e.ownerPublish&&e.anyGasFunded)}function jz(e){const t=oc(c=>c.trackedIds),n=kz(e,3e4),r=Sz(n),i="Publish will fail — no signing wallet can fund it (coverage or gas).",o=t.length>0;return{blocked:r,reason:i,chipVisible:o,eligibility:n}}function Cz({verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:i,id:o}){return l.jsx("div",{className:"v10-pca-publish-chip",id:o,"data-testid":"pca-publish-eligibility",children:l.jsx(aL,{variant:"chip",verdict:e,accountId:t,discountBps:n,accountUntracked:r,ownerPublish:i})})}function Iv({title:e,agent:t,footnote:n,dismissed:r,onDismiss:i,children:o}){return l.jsxs("div",{className:`v10-gen-widget ${r?"dissolved":""}`,children:[l.jsxs("div",{className:"v10-gen-widget-header",children:[l.jsx("span",{className:"v10-gen-widget-title",children:e}),l.jsxs("div",{className:"v10-gen-widget-right",children:[t&&l.jsxs("span",{className:"v10-gen-widget-agent",children:[l.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),i&&l.jsx("button",{className:"v10-gen-widget-dismiss",onClick:i,children:"✕"})]})]}),l.jsx("div",{className:"v10-gen-widget-body",children:o}),n&&l.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function Nz({entities:e}){const t=qa(),n=w.useMemo(()=>{const r=new Map;for(const i of e){const{icon:o,type:c}=ff(i,t),d=r.get(c);d?d.count++:r.set(c,{icon:o,count:1})}return[...r.entries()].sort((i,o)=>o[1].count-i[1].count)},[e,t]);return n.length===0?null:l.jsx(Iv,{title:"Entity Types",children:l.jsx(pf,{compact:!0,items:n.map(([r,{icon:i,count:o}])=>({id:r,label:`${i} ${r}`,value:o}))})})}function Ez({entities:e,entityCount:t,triples:n,layer:r}){const i=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),o=w.useMemo(()=>e.reduce((d,p)=>d+p.connections.length,0),[e]),c=e.length>0?(o/e.length).toFixed(1):"0";return l.jsx(Iv,{title:"Layer Stats",children:l.jsx(pf,{compact:!0,layer:r,items:[{id:"entities",label:ua(r,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:o},{id:"avg",label:"Avg. connections / entity",value:c},...i>0?[{id:"documents",label:"Documents",value:i}]:[]]})})}function FC(e,t){const[n,r]=w.useState(!1),[i,o]=w.useState(null),[c,d]=w.useState(null),p=w.useCallback(async(h,g)=>{r(!0),d(null),o(null);try{const m=await h();o(m),e==null||e({ok:!0,text:m}),t==null||t()}catch(m){const v=g(m);d(v),e==null||e({ok:!1,text:v})}finally{r(!1)}},[e,t]);return{busy:n,result:i,error:c,run:p}}function qC({title:e,footnote:t,context:n,result:r,error:i,extras:o,children:c}){return l.jsxs(Iv,{title:e,footnote:t,children:[l.jsx("div",{className:"v10-decision-context",style:{marginBottom:10},children:n}),r&&l.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",r]}),i&&l.jsxs("div",{"data-testid":"layer-action-error",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",i]}),o,l.jsx("div",{className:"v10-decision-actions",children:c})]})}function Az({count:e,contextGraphId:t,onComplete:n,onResult:r}){const{busy:i,result:o,error:c,run:d}=FC(r,n),p=w.useCallback(()=>{let m=null;d(async()=>{const v=await bo(t,"wm");let b=0;for(const j of v)m=j.name,(await xo(t,j.name,j.subGraph?{subGraphName:j.subGraph}:{})).promotedCount===0&&(b+=1);const k=v.length-b;if(k>0){const j=b>0?` (${b} already shared or still committing)`:"";return`Shared ${k} complete Knowledge Asset${k!==1?"s":""} to Shared Memory${j}`}return"No Knowledge Assets were newly shared — all were already in Shared Memory or still committing."},v=>{const b=wo(m??"an assertion",v);return b?b.message:(v==null?void 0:v.message)??"Action failed"})},[t,d]);if(e===0)return null;const h="#f59e0b",g=ua("wm",e).toLowerCase();return l.jsx(qC,{title:"Share complete Knowledge Assets",footnote:"Shares each complete owning Knowledge Asset atomically to Shared Working Memory.",context:l.jsxs(l.Fragment,{children:[e," eligible ",g," will be shared through their complete owning Knowledge Assets for collaborative review."]}),result:o,error:c,children:l.jsx("button",{"data-testid":"widget-promote-all-btn",className:"v10-decision-btn approve",style:{borderColor:`${h}50`,color:"var(--text-warning)",background:`${h}15`,opacity:i?.5:1},disabled:i,onClick:p,children:i?"...":"✓ Share Complete KAs → Shared"})})}function Tz({count:e,contextGraphId:t,onComplete:n,onResult:r}){const[i,o]=w.useState(null),{busy:c,result:d,error:p,run:h}=FC(r,n),g=jz(t),m=w.useId(),v=w.useId(),b=[g.chipVisible?m:null,g.blocked?v:null].filter(Boolean).join(" ")||void 0,k=w.useCallback(()=>{g.blocked||h(async()=>{o(null);const C=await bo(t,"swm"),S=await cv(t,C);if(S.published>0){const N=S.failures.length?` (${S.failures.length} assertion${S.failures.length===1?"":"s"} could not be published)`:"",A=S.partial>0?` — ⚠ ${S.partial}: ${ic(S.partialError)}`:"";return o(S.convictionCostCovered??null),`Published ${S.published} knowledge asset${S.published!==1?"s":""} to Verifiable Memory${N}${A}`}if(C.length===0)return"Nothing to publish — promote assertions to Shared Memory first.";throw new Error(S.failures[0]?`${S.failures[0].name}: ${S.failures[0].error}`:"Publish failed")},C=>(C==null?void 0:C.message)??"Action failed")},[t,h,g.blocked]);if(e===0)return null;const j=ua("swm",e).toLowerCase();return l.jsx(qC,{title:"Publish",footnote:`Moves ${j} from this layer to Verifiable Memory.`,context:l.jsxs(l.Fragment,{children:[e," ",j," in this layer can be published to Verifiable Memory on-chain."]}),result:d,error:p,extras:l.jsxs(l.Fragment,{children:[l.jsx(nC,{convictionCostCovered:i}),g.chipVisible&&l.jsx(Cz,{...g.eligibility,id:m}),g.blocked&&l.jsx("span",{id:v,className:"v10-sr-only",children:g.reason})]}),children:l.jsx("button",{"data-testid":"widget-publish-vm-btn",className:"v10-decision-btn primary-cta publish-vm",style:{opacity:c||g.blocked?.5:1},disabled:c,"aria-disabled":g.blocked||void 0,title:g.blocked?g.reason:void 0,"aria-describedby":b,onClick:k,children:c?"...":"◉ Publish to Verifiable Memory"})})}function Rz({layer:e,entities:t,entityCount:n,actionEntityCount:r=n,tripleCount:i,contextGraphId:o,onComplete:c}){const[d,p]=w.useState(null),h=d&&l.jsxs("div",{"data-testid":d.ok?"layer-action-result":"layer-action-error",style:{fontSize:11,color:d.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[d.ok?"✓":"✕"," ",d.text]});return n===0?l.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[h,l.jsx(Jt,{compact:!0,tone:e,icon:qn[e].icon,title:`No ${ua(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Seal and share complete Knowledge Assets from Working Memory with the team.":"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):l.jsxs("div",{className:"v10-layer-widgets-strip",children:[l.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[l.jsx(Ez,{entities:t,entityCount:n,triples:i,layer:e}),l.jsx(Nz,{entities:t})]}),(e==="wm"||e==="swm")&&o&&r>0&&l.jsx("div",{className:"v10-layer-widgets-strip-action",children:e==="wm"?l.jsx(Az,{count:r,contextGraphId:o,onComplete:c,onResult:p}):l.jsx(Tz,{count:r,contextGraphId:o,onComplete:c,onResult:p})})]})}const Dv="doc:";function _z(e,t,n){return`${Dv}${e}|${t}|${n}`}function Oz(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function Mz(e){const t=e.slice(Dv.length),n=t.indexOf("|"),r=t.lastIndexOf("|");return n<0?{docRef:t,contentType:""}:{docRef:t.slice(n+1,r),contentType:t.slice(r+1)}}function zv(e,t){if(e.length<=t)return e;const n=t-1,r=Math.ceil(n/2),i=n-r;return`${e.slice(0,r)}…${e.slice(-i)}`}const Lz={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}},Iz=new Set(["http://dkg.io/ontology/profile/QueryCatalog","http://dkg.io/ontology/profile/SavedQuery"]);function Dz(e){return e.types.some(t=>Iz.has(t))}function HC({entities:e,layerKey:t,layerIcon:n,onSelectEntity:r,onOpenAgent:i,externallySorted:o=!1,sortLabel:c,headerExtra:d,timestampPredicate:p,perEntityTrustBadge:h=!1}){const g=qa(),m=gs(),v=ua(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(o)return e;const C=[...e];return C.sort((S,N)=>{const A=S.tripleCount??0;return(N.tripleCount??0)-A}),C},[e,o]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return l.jsx("div",{className:"v10-entity-list empty",children:l.jsx(Jt,{compact:!0,tone:t,icon:n,title:`No ${ua(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${ua(t,2).toLowerCase()} are available.`})});const j=c??(o?"click to open":"sorted by triples · click to open");return l.jsxs("div",{className:"v10-entity-list",children:[l.jsxs("div",{className:"v10-entity-list-header",children:[l.jsxs("span",{className:"v10-entity-list-count",children:[b.length," ",v]}),l.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&l.jsx("span",{className:"v10-entity-list-extra",children:d})]}),b.map(C=>{const{icon:S,type:N}=ff(C,g),A=C.tripleCount??0,O=df(C),M=O?m==null?void 0:m.get(O):null,T=p?yd(C,p):null;return l.jsxs("div",{className:"v10-entity-card",onClick:L=>{L.stopPropagation(),r(C.uri)},children:[l.jsx("span",{className:"v10-entity-card-icon",children:S}),l.jsxs("div",{className:"v10-entity-card-main",children:[l.jsx("div",{className:"v10-entity-card-title",children:C.label}),l.jsxs("div",{className:"v10-entity-card-meta",children:[(M||O)&&l.jsx(us,{agent:M??void 0,fallbackUri:O??void 0,size:"sm",onOpenAgent:i}),N&&N!=="Entity"&&l.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",N]}),T!=null&&l.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(T).toLocaleString(),children:fD(T)}),l.jsxs("span",{className:"v10-entity-card-triples",children:[A," triples"]})]})]}),h?(()=>{const L=Lz[C.trustLevel];return l.jsxs("span",{className:`v10-trust-badge ${L.layerKey}`,title:`${L.label} Memory`,children:[L.icon," ",L.label]})})():l.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},C.uri)})]})}function zz({layer:e,entities:t,tripleCount:n,layerTriples:r,contextGraphId:i,memory:o,activeTab:c,onTabChange:d,onSelectEntity:p,onNodeClick:h,footer:g,swmAttribution:m,showQueryCatalog:v=!1,onShowQueryCatalogChange:b}){var L;const k=qn[e],j=ua(e,2),C=w.useMemo(()=>t.filter(B=>!Dz(B)).length,[t]),S=((L=o.layerStatus)==null?void 0:L.vm)??(o.loading?"loading":o.error?"error":"ok"),N=e==="vm"&&S==="loading"&&t.length===0,A=e==="vm"&&S==="error"&&t.length===0,O=e==="vm"&&S==="ok"&&t.length===0,M=o.counts[e],T=B=>_=>{_.stopPropagation(),d(B)};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"v10-layer-expand-tabs",children:[l.jsx("button",{className:`v10-layer-expand-tab ${c==="items"?"active":""}`,onClick:T("items"),children:j}),e!=="vm"&&l.jsx("button",{className:`v10-layer-expand-tab ${c==="assertions"?"active":""}`,onClick:T("assertions"),children:"Assertions"}),l.jsx("button",{className:`v10-layer-expand-tab ${c==="graph"?"active":""}`,onClick:T("graph"),children:"Graph"}),l.jsx("button",{className:`v10-layer-expand-tab ${c==="docs"?"active":""}`,onClick:T("docs"),children:"Documents"}),e!=="vm"&&b&&l.jsxs("label",{className:"v10-query-catalog-visibility",children:[l.jsx("input",{type:"checkbox",checked:v,onChange:B=>b(B.target.checked)}),l.jsx("span",{children:"Show query catalog"})]})]}),c==="items"&&l.jsxs("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`layer:${e}:items`,children:[e==="vm"&&!N&&!A&&l.jsx($z,{entities:t,tripleCount:n,contextGraphId:i}),N?l.jsx("div",{className:"v10-layer-widgets-strip empty",children:l.jsx(Jt,{compact:!0,tone:"vm",icon:qn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):A?l.jsx("div",{className:"v10-layer-widgets-strip empty",children:l.jsx(Jt,{compact:!0,tone:"vm",icon:qn.vm.icon,title:"Verifiable Memory status unavailable.",description:"This node could not read the verified layer right now."})}):!O&&l.jsxs(l.Fragment,{children:[l.jsx(Rz,{layer:e,entities:t,entityCount:M,actionEntityCount:C,tripleCount:n,contextGraphId:i,onComplete:o.refresh}),l.jsx(HC,{entities:t,layerKey:e,layerIcon:k.icon,onSelectEntity:p})]}),g]}),c==="assertions"&&e!=="vm"&&l.jsx("div",{className:"v10-layer-expand-body full-width",children:l.jsx(Pz,{contextGraphId:i,layer:e,includeQueryCatalog:v,onComplete:o.refresh,scrollKey:`layer:${e}:assertions`})}),c==="graph"&&l.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`layer:${e}:graph`,children:l.jsx(BC,{layer:e,triples:r,onNodeClick:h,contextGraphId:i,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),c==="docs"&&l.jsx("div",{className:"v10-layer-expand-body full-width",children:l.jsx(GC,{entities:t,contextGraphId:i,scrollKey:`layer:${e}:docs`})})]})}function $z({entities:e,tripleCount:t,contextGraphId:n}){const r=e.length,i=new Set;for(const c of e)for(const d of c.types)i.add(d);const o=i.size;return r===0?l.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[l.jsxs("div",{className:"v10-vm-hero-title",children:[l.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),l.jsxs("div",{className:"v10-vm-hero-heading",children:[l.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),l.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),l.jsx(Jt,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:qn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish complete Knowledge Assets from Shared Working Memory to verify them on-chain."})]}):l.jsxs("div",{className:"v10-vm-hero",children:[l.jsxs("div",{className:"v10-vm-hero-title",children:[l.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),l.jsxs("div",{className:"v10-vm-hero-heading",children:[l.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),l.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),l.jsx(pf,{className:"v10-vm-hero-stats",layer:"vm",items:[{id:"assets",value:r,label:"Knowledge Assets"},{id:"triples",value:t.toLocaleString(),label:"Verifiable Triples"},{id:"types",value:o,label:"Entity Types"}]}),l.jsxs("div",{className:"v10-vm-hero-strip",children:[l.jsxs("div",{className:"v10-vm-hero-chip",title:"Multi-agent endorsement",children:[l.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#22c55e"}}),"Consensus"]}),l.jsxs("div",{className:"v10-vm-hero-chip",title:"Published to the DKG blockchain anchor",children:[l.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#3b82f6"}}),"On-chain"]}),l.jsxs("div",{className:"v10-vm-hero-chip",title:"Each contribution bound to a DID",children:[l.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#a855f7"}}),"Agent Identity"]}),l.jsxs("div",{className:"v10-vm-hero-chip",title:"Tamper-evident via content hashing",children:[l.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#f59e0b"}}),"Content Hash"]})]})]})}function Pz({contextGraphId:e,layer:t,includeQueryCatalog:n=!1,onComplete:r,scrollKey:i}){const{data:o,loading:c,refresh:d}=vr(()=>bo(e,t,{includeQueryCatalog:n}),[e,t,n],0),{data:p}=vr(()=>jO(e),[e,t],0),[h,g]=w.useState(null),[m,v]=w.useState(null),[b,k]=w.useState(null),j=w.useCallback(async M=>{g(M.graphUri),v(null),k(null);try{if(t==="wm"){const T=await xo(e,M.name,M.subGraph?{subGraphName:M.subGraph}:{}),L=uv(M.name,T);v(L.message)}else{const T=await lv(e,M.name,M.subGraph?{subGraphName:M.subGraph}:{});v(T.contextGraphError?`Published ${M.name} on-chain — ⚠ ${ic(T.contextGraphError)}`:`Published ${M.name} to Verifiable Memory`)}d(),r()}catch(T){const L=wo(M.name,T);k(L?L.message:(T==null?void 0:T.message)??"Action failed")}finally{g(null)}},[e,t,d,r]),C=w.useCallback(async()=>{g("__all__"),v(null),k(null);let M=null;try{const T=await bo(e,t);if(T.length===0){v(t==="wm"?"No user Knowledge Assets are ready to share.":"No user Knowledge Assets are ready to publish.");return}if(t==="wm"){let L=0;for(const _ of T)M=_.name,(await xo(e,_.name,_.subGraph?{subGraphName:_.subGraph}:{})).promotedCount===0&&(L+=1);const B=T.length-L;if(B>0){const _=L>0?` (${L} already shared or still committing)`:"";v(`Shared ${B} complete Knowledge Asset${B!==1?"s":""}${_}`)}else v("No Knowledge Assets were newly shared — all were already in Shared Memory or still committing.")}else{const L=await cv(e,T);if(L.published>0){const B=L.failures.length?` (${L.failures.length} could not be published)`:"",_=L.partial>0?` — ⚠ ${L.partial}: ${ic(L.partialError)}`:"";v(`Published ${L.published} knowledge asset${L.published!==1?"s":""} to Verifiable Memory${B}${_}`)}else throw new Error(L.failures[0]?`${L.failures[0].name}: ${L.failures[0].error}`:"Publish failed")}d(),r()}catch(T){const L=wo(M??"selected assertion",T);k(L?L.message:(T==null?void 0:T.message)??"Action failed")}finally{g(null)}},[e,t,d,r]),S={flex:1,overflow:"auto"};if(c)return l.jsx("div",{className:"v10-layer-empty-shell",style:S,"data-cg-scroll-key":i,children:l.jsx(Jt,{compact:!0,tone:t,icon:qn[t].icon,title:"Loading assertions..."})});if(!(o!=null&&o.length))return l.jsx("div",{className:"v10-layer-empty-shell",style:S,"data-cg-scroll-key":i,children:l.jsx(Jt,{tone:t,icon:qn[t].icon,title:t==="swm"?"No Shared Working Memory assertions listed yet.":"No Working Memory assertions yet.",description:t==="swm"?"Promoted assertion contents are available as Shared Working Memory entities. The assertion list will populate once promoted assertions are exposed by the node.":"Create or import data to stage assertions in Working Memory."})});const N=t==="wm"?"Share Complete KA → Shared":"Publish to VM",A=t==="wm"?"Share Complete KAs → Shared":"Publish all to Verifiable Memory",O=o.filter(M=>M.subGraph!=="meta"||!M.name.startsWith("query-catalog-")).length;return l.jsxs("div",{style:S,"data-cg-scroll-key":i,children:[l.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[l.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[o.length," assertion",o.length!==1?"s":""]}),O>0&&l.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:h!==null,onClick:C,style:{opacity:h==="__all__"?.5:1},children:h==="__all__"?"...":A})]}),m&&l.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",m]}),b&&l.jsxs("div",{"data-testid":t==="wm"?"assertion-promote-result":"assertion-publish-result",style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",b]}),o.map(M=>l.jsxs("div",{className:"v10-item-row","data-testid":"assertion-list-row",children:[l.jsx("span",{className:"v10-item-icon",children:"▤"}),l.jsxs("div",{className:"v10-item-info",children:[l.jsx("div",{className:"v10-item-name",style:{fontFamily:"var(--font-mono)",fontSize:11},children:M.name}),(p==null?void 0:p[M.name])&&l.jsx("div",{className:"v10-item-ual",style:{fontFamily:"var(--font-mono)",fontSize:10,color:"var(--text-tertiary)",opacity:.7,wordBreak:"break-all",marginTop:1},title:p[M.name],children:p[M.name]}),l.jsxs("div",{className:"v10-item-meta-row",children:[M.tripleCount!=null&&l.jsxs("span",{className:"v10-item-count",children:[M.tripleCount," triples"]}),M.subGraph&&l.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${M.subGraph}`,children:["› ",zv(M.subGraph,18)]})]})]}),l.jsx("button",{"data-testid":"assertion-row-action",className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:h!==null,onClick:T=>{T.stopPropagation(),j(M)},style:{opacity:h===M.graphUri?.5:1,flexShrink:0},children:h===M.graphUri?"...":N})]},M.graphUri))]})}function Uz({layer:e,memory:t,onNodeClick:n,onSelectEntity:r,contextGraphId:i,activeTab:o,onTabChange:c,swmAttribution:d,showQueryCatalog:p=!1,onShowQueryCatalogChange:h}){const g=qn[e],m=w.useMemo(()=>t.entityList.filter(b=>b.trustLevel===g.trustLevel),[t.entityList,g.trustLevel]),v=oD(t,e);return l.jsxs("div",{className:"v10-layer-detail",children:[l.jsxs("div",{className:"v10-layer-detail-header",children:[l.jsx("span",{className:"v10-layer-detail-icon",style:{color:g.color},children:g.icon}),l.jsxs("div",{children:[l.jsx("div",{className:"v10-layer-detail-title",children:g.title}),l.jsx("div",{className:"v10-layer-detail-desc",children:g.desc})]}),l.jsx("div",{className:"v10-layer-detail-actions"})]}),l.jsx("div",{className:"v10-layer-detail-body",children:l.jsx(zz,{layer:e,entities:m,tripleCount:v.length,layerTriples:v,contextGraphId:i,memory:t,activeTab:o,onTabChange:c,onSelectEntity:r,onNodeClick:n,swmAttribution:d,showQueryCatalog:p,onShowQueryCatalogChange:h})})]})}function GC({entities:e,contextGraphId:t,scrollKey:n}){const r=gn(c=>c.openTab),i=w.useMemo(()=>e.filter(c=>c.properties.has(sm)),[e]),o=c=>{var v,b,k;const d=(v=c.connections.find(j=>j.predicate===gw))==null?void 0:v.targetUri,p=(b=c.connections.find(j=>j.predicate===vw))==null?void 0:b.targetUri,h=((k=c.properties.get(sm))==null?void 0:k[0])??"",{ref:g,contentType:m}=Oz(d,p,h);r({id:_z(t??"",g??c.uri,m),label:c.label,closable:!0,icon:"📄"})};return i.length===0?l.jsx("div",{className:"v10-docs-placeholder v10-layer-empty-shell",style:{flex:1},"data-cg-scroll-key":n,children:l.jsx(Jt,{compact:!0,title:"No documents in this layer yet.",description:"Import a file to add document-backed entities."})}):l.jsx("div",{className:"v10-layer-detail-content","data-cg-scroll-key":n,children:l.jsx("div",{className:"v10-items-list",children:i.map(c=>{var m,v,b,k;const d=((m=c.properties.get(sm))==null?void 0:m[0])??"",p=(v=c.connections.find(j=>j.predicate===gw||j.predicate===vw))==null?void 0:v.targetUri,h=p?e.find(j=>j.uri===p):void 0,g=((b=h==null?void 0:h.properties.get(yw))==null?void 0:b[0])??((k=c.properties.get(yw))==null?void 0:k[0]);return l.jsxs("div",{className:"v10-item-row",onClick:()=>o(c),children:[l.jsx("span",{className:"v10-item-icon",children:"📄"}),l.jsxs("div",{className:"v10-item-info",children:[l.jsx("div",{className:"v10-item-name",children:c.label}),l.jsxs("div",{className:"v10-item-meta-row",children:[d&&l.jsx("span",{className:"v10-item-type",children:d}),g&&l.jsxs("span",{className:"v10-item-count",children:["· ",Math.round(parseInt(g)/1024),"KB"]})]})]}),l.jsx("button",{className:"v10-item-promote-btn",onClick:j=>{j.stopPropagation(),o(c)},children:"Open →"})]},c.uri)})})})}function VC(e){return`SELECT ?g ?s ?p ?o WHERE {
|
|
1271
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1272
|
+
${mg(e)}
|
|
1273
|
+
}
|
|
1274
|
+
LIMIT 1000`}const Ud="User-created SPARQL saved in this node profile for this Context Graph.";function zw(e){return JSON.stringify(e)}function mg(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
|
|
1275
|
+
(
|
|
1276
|
+
STR(?g) = ${zw(t)} ||
|
|
1277
|
+
STRSTARTS(STR(?g), ${zw(n)})
|
|
1278
|
+
) &&
|
|
1279
|
+
!CONTAINS(STR(?g), "/_private")
|
|
1280
|
+
)`}function Bz(e){const t="whole-context-graph",n="Context graph",i=Gr,o=c=>({subGraph:i,catalogSlug:t,catalogName:n,catalogDescription:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",catalogRank:-100,resultColumn:"",parameters:[],...c});return{slug:t,subGraph:i,name:n,description:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",rank:-100,queries:[o({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:VC(e),resultColumn:"o",rank:1}),o({slug:"graphs",name:"Graphs",description:"List available non-private named graphs and triple counts.",sparql:`SELECT ?g (COUNT(*) AS ?triples) WHERE {
|
|
1281
|
+
GRAPH ?g { ?s ?p ?o }
|
|
1282
|
+
${mg(e)}
|
|
1283
|
+
}
|
|
1284
|
+
GROUP BY ?g
|
|
1285
|
+
ORDER BY DESC(?triples)
|
|
1286
|
+
LIMIT 100`,resultColumn:"g",rank:2}),o({slug:"types",name:"Types",description:"Count entities by RDF type across the context graph.",sparql:`SELECT ?type (COUNT(DISTINCT ?s) AS ?entities) WHERE {
|
|
1287
|
+
GRAPH ?g { ?s a ?type }
|
|
1288
|
+
${mg(e)}
|
|
1289
|
+
}
|
|
1290
|
+
GROUP BY ?type
|
|
1291
|
+
ORDER BY DESC(?entities)
|
|
1292
|
+
LIMIT 100`,resultColumn:"type",rank:3})]}}function Fz(e,t,n,r,i=[],o,c=Gr){const d=Date.now(),p=c===Gr?$d:`${$d}-${OC(c)}`,h=o3({contextGraphId:e,name:t,description:n||void 0,sparql:r,subGraph:c,catalogSlug:p,catalogName:Pd,catalogDescription:Ud,rank:d,catalogRank:50,parameters:i,view:o});return{query:{slug:h.savedQuery.slug,subGraph:c,catalogSlug:p,catalogName:Pd,catalogDescription:Ud,catalogRank:50,name:t,description:n||void 0,sparql:r,resultColumn:"",rank:d,parameters:[...i],view:o},quads:h.quads}}function qz(e,t){const n=`${t.subGraph}|${t.catalogSlug}`,r=e.map(o=>({...o,queries:[...o.queries]})),i=r.find(o=>`${o.subGraph}|${o.slug}`===n);return i?(i.queries=[...i.queries,t].sort((o,c)=>o.rank-c.rank||o.name.localeCompare(c.name)),r):[...r,{slug:t.catalogSlug,subGraph:t.subGraph,name:Pd,description:Ud,rank:50,queries:[t]}]}function $w(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.slug}`,i=t.get(r);if(!i){t.set(r,{...n,queries:[...n.queries]});continue}const o=new Map(i.queries.map(c=>[`${c.subGraph}|${c.catalogSlug}|${c.slug}`,c]));for(const c of n.queries){const d=`${c.subGraph}|${c.catalogSlug}|${c.slug}`;o.has(d)||o.set(d,c)}i.queries=Array.from(o.values()).sort((c,d)=>c.rank-d.rank||c.name.localeCompare(d.name))}return Array.from(t.values()).sort((n,r)=>n.subGraph.localeCompare(r.subGraph)||n.rank-r.rank||n.name.localeCompare(r.name))}function Hz(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Gz(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function hf(e){return e.subGraph===Gr&&e.slug==="whole-context-graph"}function Vz(e){return e.subGraph===Gr?"context":"subgraph"}function Wz(e,t,n){return hf(e)?"Built-in presets":e.subGraph===Gr&&e.slug===$d?Pd:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function Zz(e){return hf(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===Gr&&e.slug===$d?Ud:e.description??""}function Qz(e,t){return hf(e)?"Preset":t==="context"?"Saved":"Subgraph"}function Kz(e){return l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Review the query or node response details, then try again."}),e&&l.jsx("span",{className:"v10-cg-query-error-detail",children:e})]})}function Yz({contextGraphId:e}){var He;const t=qa(),n=w.useMemo(()=>VC(e),[e]),[r,i]=w.useState({kind:"ad-hoc",draft:n}),[o,c]=w.useState({sparql:n}),[d,p]=w.useState([]),[h,g]=w.useState(!1),[m,v]=w.useState(""),[b,k]=w.useState(""),[j,C]=w.useState(!1),[S,N]=w.useState(null),[A,O]=w.useState(null),[M,T]=w.useState(null),L=w.useMemo(()=>Bz(e),[e]),B=w.useMemo(()=>$w([L,...d,...(t==null?void 0:t.queryCatalogs)??[]]),[L,d,t==null?void 0:t.queryCatalogs]),_=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?$w([L,...d]):B,[L,d,t==null?void 0:t.error,t==null?void 0:t.loading,B]),R=w.useMemo(()=>r.kind==="catalog"?r.query:void 0,[r]),z=r.kind==="catalog"?r.key:null,F=r.draft,Y=r.kind==="catalog"?r.values:{};w.useEffect(()=>{i({kind:"ad-hoc",draft:n}),c({sparql:n}),p([]),g(!1),v(""),k(""),N(null),O(null),T(null)},[n]);const{data:D,loading:q,error:G,refresh:W}=vr(()=>gr(o.sparql,{contextGraphId:e,view:o.view,subGraphName:o.subGraphName}),[o.sparql,o.subGraphName,o.view,e],0),Q=w.useMemo(()=>{if(r.kind!=="catalog")return!0;if(o.sourceKey!==r.key)return!1;try{const ke=Gl(r.query,r.values);return ke.sparql===o.sparql&&ke.view===o.view&&ke.subGraphName===o.subGraphName}catch{return!1}},[o,r]),H=Q?D==null?void 0:D.result:void 0,$=H==null?void 0:H.type,U=w.useMemo(()=>$==="quads"?H.quads:$==="bindings"?H.bindings:[],[H,$]),Z=$==="boolean"?H.value:void 0,I=w.useMemo(()=>B.some(ke=>!hf(ke)&&ke.queries.length>0),[B]),ae=w.useMemo(()=>{const ke=[];for(const ve of U)for(const Re of Object.keys(ve))ke.includes(Re)||ke.push(Re);return ke},[U]),le=w.useCallback(()=>{const ke=r.draft.trim();if(!ke)return;let ve;if(r.kind==="catalog"&&ke===r.query.sparql.trim())try{ve={...Gl(r.query,r.values),sourceKey:r.key},T(null)}catch(Re){T((Re==null?void 0:Re.message)??String(Re));return}else ve={sparql:ke},r.kind==="catalog"&&i({kind:"ad-hoc",draft:ke}),T(null);if(O(null),N(null),ve.sparql===o.sparql&&ve.view===o.view&&ve.subGraphName===o.subGraphName){c(ve),W();return}c(ve)},[o,W,r]),oe=w.useCallback(()=>{if(i({kind:"ad-hoc",draft:n}),O(null),N(null),T(null),o.sparql===n&&o.view===void 0&&o.subGraphName===void 0){W();return}c({sparql:n})},[o,n,W]),we=w.useCallback((ke,ve)=>{const Re=ve.sparql.trim();if(!Re)return;O(null),N(null),T(null);const Ge=ve.parameters??[],We=Object.fromEntries(Ge.filter(Pe=>Pe.defaultValue!==void 0).map(Pe=>[Pe.name,String(Pe.defaultValue)]));if(i({kind:"catalog",key:ke,query:ve,values:We,draft:Re}),Ge.length>0)return;const de={...Gl(ve,We),sourceKey:ke};if(o.sparql===de.sparql&&o.view===de.view&&o.subGraphName===de.subGraphName){c(de),W();return}c(de)},[o,W]),Ee=w.useCallback(()=>{const ke=F.trim().split(`
|
|
1293
|
+
`).find(ve=>ve.trim());v(ke?ke.replace(/\s+/g," ").slice(0,60):""),k(""),N(null),O(null),g(!0)},[F]),Oe=w.useCallback(async ke=>{ke.preventDefault();const ve=m.trim(),Re=b.trim(),Ge=F.trim();if(!ve){N("Name is required.");return}if(!Ge){N("Query is empty.");return}C(!0),N(null),O(null);try{const We=R&&R.sparql.trim()===Ge?R:void 0,{query:de,quads:Pe}=Fz(e,ve,Re,Ge,(We==null?void 0:We.parameters)??[],We==null?void 0:We.view,(We==null?void 0:We.subGraph)??Gr);await CO(e,Pe),p(be=>qz(be,de));const Ze=`${de.subGraph}|${de.catalogSlug}|${de.slug}`,ot=r.kind==="catalog"?r.values:{};i({kind:"catalog",key:Ze,query:de,values:ot,draft:de.sparql});try{const be=Gl(de,ot);c(bt=>bt.sparql===be.sparql&&bt.view===be.view&&bt.subGraphName===be.subGraphName?{...bt,sourceKey:Ze}:bt)}catch{}v(""),k(""),g(!1),O("Saved to catalogue.")}catch(We){N((We==null?void 0:We.message)??"Failed to save query.")}finally{C(!1)}},[e,F,b,m,R,r]);return l.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[l.jsxs("div",{className:"v10-mlv-header",children:[l.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),l.jsxs("div",{children:[l.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),l.jsx("p",{className:"v10-mlv-desc",children:"Reusable SPARQL for this Context Graph. Use UI presets or save queries for people and local agents to reuse."})]})]}),l.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[l.jsx("div",{className:"v10-cg-query-zone-header",children:l.jsxs("div",{children:[l.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),l.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),l.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&l.jsx(Jt,{compact:!0,inline:!0,tone:"query",icon:"?",title:"Loading saved queries...",description:"Built-in presets are available while saved queries load from this node profile."}),(t==null?void 0:t.error)&&l.jsx(Jt,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),_.length>0&&l.jsx("div",{className:"v10-cg-query-catalog-groups",children:_.map(ke=>{const ve=Vz(ke),Re=ve==="context"||t==null?void 0:t.forSubGraph(ke.subGraph),Ge=(Re==null?void 0:Re.color)??"#38bdf8",We=Wz(ke,ve,Re==null?void 0:Re.displayName),de=Zz(ke),Pe=Qz(ke,ve);return l.jsxs("div",{className:"v10-cg-query-catalog-group",style:{"--sg-color":Ge},children:[l.jsx("div",{className:"v10-cg-query-catalog-group-header",children:l.jsxs("div",{children:[l.jsxs("div",{className:"v10-cg-query-catalog-title-row",children:[l.jsx("span",{className:"v10-cg-query-catalog-kind",children:Pe}),l.jsx("h4",{children:We})]}),de&&l.jsx("p",{children:de})]})}),l.jsx("div",{className:"v10-cg-query-list",children:ke.queries.map(Ze=>{const ot=`${Ze.subGraph}|${Ze.catalogSlug}|${Ze.slug}`,be=z===ot,bt=Ze.description?`${Ze.name}. ${Ze.description}`:Ze.name;return l.jsxs("button",{type:"button",className:`v10-cg-query-chip${be?" active":""}`,title:bt,"aria-label":`Load query: ${bt}`,onClick:()=>we(ot,Ze),children:[l.jsx("span",{className:"v10-cg-query-chip-title",children:Ze.name}),Ze.description&&l.jsx("span",{className:"v10-cg-query-chip-desc",children:Ze.description})]},ot)})})]},`${ke.subGraph}|${ke.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&B.length>0&&!I&&l.jsx(Jt,{compact:!0,inline:!0,tone:"query",icon:"?",title:"No saved queries yet.",description:"Use Save after editing SPARQL to keep a reusable query for this Context Graph."})]}),l.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-editor","aria-labelledby":"query-catalogue-editor-title",children:[l.jsx("div",{className:"v10-cg-query-zone-header",children:l.jsxs("div",{children:[l.jsx("span",{className:"v10-cg-query-eyebrow",children:"Ad-hoc SPARQL"}),l.jsx("h3",{id:"query-catalogue-editor-title",children:"Editor and results"}),l.jsx("p",{children:"Run a one-off query against this Context Graph, or save it when it should become reusable."})]})}),l.jsxs("div",{className:"v10-cg-query-editor",children:[R&&(((He=R.parameters)==null?void 0:He.length)??0)>0&&l.jsx("div",{className:"v10-cg-query-parameters","aria-label":"Query parameters",children:(R.parameters??[]).map(ke=>l.jsxs("label",{className:"v10-cg-query-parameter",children:[l.jsx("span",{children:ke.label??ke.name}),ke.type==="boolean"?l.jsxs("select",{className:"v10-form-input","aria-label":ke.label??ke.name,value:Y[ke.name]??"",onChange:ve=>i(Re=>Re.kind==="catalog"?{...Re,values:{...Re.values,[ke.name]:ve.target.value}}:Re),children:[l.jsx("option",{value:"",children:"Choose..."}),l.jsx("option",{value:"true",children:"True"}),l.jsx("option",{value:"false",children:"False"})]}):l.jsx("input",{className:"v10-form-input","aria-label":ke.label??ke.name,type:ke.type==="integer"||ke.type==="number"?"number":"text",step:ke.type==="integer"?"1":ke.type==="number"?"any":void 0,required:QD(ke),value:Y[ke.name]??"",placeholder:ke.description,onChange:ve=>i(Re=>Re.kind==="catalog"?{...Re,values:{...Re.values,[ke.name]:ve.target.value}}:Re)}),ke.description&&l.jsx("small",{children:ke.description})]},ke.name))}),M&&l.jsx("span",{className:"v10-cg-query-error-detail",children:M}),l.jsx("textarea",{className:"v10-cg-query-textarea","aria-label":"SPARQL editor",value:F,onChange:ke=>{i({kind:"ad-hoc",draft:ke.target.value}),T(null)},spellCheck:!1}),l.jsxs("div",{className:"v10-cg-query-actions",children:[l.jsx("button",{className:"v10-mlv-run-btn",type:"button",onClick:le,children:"Run"}),l.jsx("button",{className:"v10-mlv-save-btn",type:"button",onClick:Ee,children:"Save"}),l.jsx("button",{className:"v10-mlv-clear-btn",type:"button",onClick:oe,children:"Reset"})]})]}),h&&l.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:Oe,children:[l.jsxs("label",{className:"v10-cg-query-save-field",children:[l.jsx("span",{children:"Name"}),l.jsx("input",{type:"text",value:m,onChange:ke=>v(ke.target.value),placeholder:"Query name",maxLength:80})]}),l.jsxs("label",{className:"v10-cg-query-save-field",children:[l.jsx("span",{children:"Description"}),l.jsx("input",{type:"text",value:b,onChange:ke=>k(ke.target.value),placeholder:"Optional",maxLength:180})]}),l.jsxs("div",{className:"v10-cg-query-save-actions",children:[l.jsx("button",{type:"button",className:"v10-mlv-clear-btn",onClick:()=>g(!1),disabled:j,children:"Cancel"}),l.jsx("button",{type:"submit",className:"v10-mlv-run-btn",disabled:j,children:j?"Saving...":"Save query"})]})]}),A&&l.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:A}),S&&l.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:S}),l.jsxs("div",{className:"v10-cg-query-results",children:[!Q&&l.jsx(Jt,{compact:!0,tone:"query",icon:"?",title:"Enter parameters, then run this query.",description:"Previous query results are hidden so they are not presented as results for the newly selected template."}),Q&&q&&l.jsx(Jt,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),Q&&G&&l.jsx(Jt,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:Kz(G)}),Q&&!q&&!G&&Z===void 0&&U.length===0&&l.jsx(Jt,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),Q&&!q&&!G&&Z!==void 0&&l.jsxs("div",{className:"v10-mlv-table-wrap","aria-label":"ASK result",children:[l.jsx("div",{className:"v10-mlv-result-count",children:"ASK result"}),l.jsx("strong",{children:String(Z)})]}),Q&&!q&&!G&&Z===void 0&&U.length>0&&l.jsxs("div",{className:"v10-mlv-table-wrap",children:[l.jsxs("div",{className:"v10-mlv-result-count",children:[U.length," ",$==="quads"?`quad${U.length===1?"":"s"}`:`result${U.length===1?"":"s"}`]}),l.jsxs("table",{className:"v10-mlv-table",children:[l.jsx("thead",{children:l.jsx("tr",{children:ae.map(ke=>l.jsx("th",{children:ke},ke))})}),l.jsx("tbody",{children:U.map((ke,ve)=>l.jsx("tr",{children:ae.map(Re=>{const Ge=Hz(ke[Re]);return l.jsx("td",{className:"v10-mlv-cell",title:Ge,children:Gz(Ge)},Re)})},ve))})]})]})]})]})]})}const WC="http://dkg.io/ontology/",Xz="http://www.w3.org/ns/prov#";function ZC(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function pm(e){const t=ZC(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function Jz(e){const t=ZC(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function e$(e,t){return`PREFIX dkg: <${WC}>
|
|
1294
|
+
SELECT ?owner WHERE {
|
|
1295
|
+
GRAPH ?g { <${t}> dkg:workspaceOwner ?owner . }
|
|
1296
|
+
FILTER(
|
|
1297
|
+
STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
|
|
1298
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1299
|
+
)
|
|
1300
|
+
} LIMIT 1`}function t$(e,t){return`PREFIX dkg: <${WC}>
|
|
1301
|
+
PREFIX prov: <${Xz}>
|
|
1302
|
+
SELECT ?op ?publishedAt ?agent WHERE {
|
|
1303
|
+
GRAPH ?g {
|
|
1304
|
+
?op a dkg:WorkspaceOperation ;
|
|
1305
|
+
dkg:rootEntity <${t}> ;
|
|
1306
|
+
dkg:publishedAt ?publishedAt .
|
|
1307
|
+
OPTIONAL { ?op prov:wasAttributedTo ?agent }
|
|
1308
|
+
}
|
|
1309
|
+
FILTER(
|
|
1310
|
+
STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
|
|
1311
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1312
|
+
)
|
|
1313
|
+
} ORDER BY DESC(?publishedAt) LIMIT 1`}const hm={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function n$(e,t,n=!0){const[r,i]=w.useState(()=>({...hm})),o=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){i({...hm});return}const c=++o.current;i(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,p;try{const[h,g]=await Promise.all([gr(e$(e,t),{contextGraphId:e}).catch(()=>null),gr(t$(e,t),{contextGraphId:e}).catch(()=>null)]);if(c!==o.current)return;const m=(((d=h==null?void 0:h.result)==null?void 0:d.bindings)??[])[0],v=(((p=g==null?void 0:g.result)==null?void 0:p.bindings)??[])[0],b=v?Jz(v.op):null,k=v?pm(v.publishedAt):null,j=v!=null&&v.agent?pm(v.agent):null,C=m?pm(m.owner):null;i({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:C,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(c!==o.current)return;i({...hm,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),r}function Pw(e,t){if(!e)return null;for(const n of t.values())if(n.peerId&&n.peerId===e)return n.uri;return null}function so(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const $v="http://dkg.io/ontology/",es={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function En(e){if(e==null)return"";if(typeof e=="string")return e.startsWith('"')?e.replace(/^"/,"").replace(/"(\^\^<[^>]*>|@[\w-]+)?$/,""):e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function Ku(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function _i(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function Uw(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function r$(e,t){const n=`did:dkg:context-graph:${e}/_meta`,r=_i(t);return`PREFIX dkg: <${$v}>
|
|
1314
|
+
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1315
|
+
SELECT ?asrt ?tx ?block ?kaId ?batchId ?finalizedAt ?ual ?agentLc ?ualSelf ?agentSelf WHERE {
|
|
1316
|
+
GRAPH <${n}> {
|
|
1317
|
+
?asrt dkg:publishedAtTx ?tx ;
|
|
1318
|
+
dkg:publishedAtBlock ?block .
|
|
1319
|
+
FILTER(
|
|
1320
|
+
STRSTARTS("${r}", STR(?asrt)) ||
|
|
1321
|
+
EXISTS { ?asrt dkg:assertionRootEntity <${t}> } ||
|
|
1322
|
+
EXISTS { ?asrt dkg:assertionEntity <${t}> }
|
|
1323
|
+
)
|
|
1324
|
+
OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
|
|
1325
|
+
OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
|
|
1326
|
+
OPTIONAL {
|
|
1327
|
+
?lc dkg:rootEntity <${t}> ;
|
|
1328
|
+
dkg:reservedUal ?ual .
|
|
1329
|
+
# Pin the lifecycle URN to the FULL assertion scope (cg + optional
|
|
1330
|
+
# subGraphName), not just {addr}:{name} — otherwise a same-named
|
|
1331
|
+
# assertion in a sibling sub-graph (urn:dkg:assertion:{cg}:{other}:{addr}:{name})
|
|
1332
|
+
# also STRENDS-matches and leaks the wrong reservedUal/agent/batchId.
|
|
1333
|
+
# cgId is a build-time constant, so anchor on it as a literal and keep its
|
|
1334
|
+
# slashes intact (wallet-scoped cgIds like "<addr>/<name>" embed RAW in the
|
|
1335
|
+
# URN via assertionLifecycleUri); only the [/sub]/{addr}/{name} tail derived
|
|
1336
|
+
# from ?asrt is "/"->":" converted (sub/addr/name cannot contain "/").
|
|
1337
|
+
FILTER(STRENDS(STR(?lc), CONCAT(
|
|
1338
|
+
":${_i(e)}",
|
|
1339
|
+
REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${_i(e)}"), "/assertion/"), "/", ":"),
|
|
1340
|
+
":",
|
|
1341
|
+
REPLACE(STRAFTER(STR(?asrt), "/assertion/"), "/", ":")
|
|
1342
|
+
)))
|
|
1343
|
+
OPTIONAL { ?lc prov:wasAttributedTo ?agentLc . }
|
|
1344
|
+
}
|
|
1345
|
+
OPTIONAL { ?asrt dkg:reservedUal ?ualSelf . }
|
|
1346
|
+
OPTIONAL { ?asrt prov:wasAttributedTo ?agentSelf . }
|
|
1347
|
+
BIND(IRI(COALESCE(?ualSelf, ?ual)) AS ?ualNode)
|
|
1348
|
+
OPTIONAL { ?ualNode dkg:batchId ?batchId . }
|
|
1349
|
+
}
|
|
1350
|
+
} ORDER BY DESC(STRSTARTS("${r}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function a$(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function i$(e,t){return`PREFIX dkg: <${$v}>
|
|
1351
|
+
SELECT ?source ?agent ?ts WHERE {
|
|
1352
|
+
GRAPH ?g {
|
|
1353
|
+
?op a dkg:ShareTransition ;
|
|
1354
|
+
dkg:entities <${t}> ;
|
|
1355
|
+
dkg:source ?source ;
|
|
1356
|
+
dkg:agent ?agent ;
|
|
1357
|
+
dkg:timestamp ?ts .
|
|
1358
|
+
}
|
|
1359
|
+
FILTER(
|
|
1360
|
+
STRSTARTS(STR(?g), "did:dkg:context-graph:${_i(e)}/") &&
|
|
1361
|
+
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1362
|
+
)
|
|
1363
|
+
} ORDER BY DESC(?ts) LIMIT 1`}function s$(e,t,n,r){const i=`did:dkg:context-graph:${e}/_meta`,o=`/assertion/${n}/${r}`,c=_i(t);return`PREFIX dkg: <${$v}>
|
|
1364
|
+
SELECT ?ual ?tx ?block ?kaId ?finalizedAt WHERE {
|
|
1365
|
+
GRAPH <${i}> {
|
|
1366
|
+
?asrt dkg:publishedAtTx ?tx ;
|
|
1367
|
+
dkg:publishedAtBlock ?block .
|
|
1368
|
+
OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
|
|
1369
|
+
FILTER(STRENDS(STR(?asrt), "${_i(o)}"))
|
|
1370
|
+
OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
|
|
1371
|
+
OPTIONAL {
|
|
1372
|
+
?lc dkg:rootEntity <${t}> ;
|
|
1373
|
+
dkg:reservedUal ?ual .
|
|
1374
|
+
FILTER(STRENDS(STR(?lc), "${_i(`:${n}:${r}`)}"))
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
} ORDER BY DESC(STRSTARTS("${c}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function o$(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function l$(e,t,n=!0){const[r,i]=w.useState(()=>({...es})),o=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){i({...es});return}const c=++o.current;i({...es,status:"loading"}),(async()=>{var d,p,h;try{const g=Uw(t);if(!g){i({...es,status:"offchain"});return}const m=await gr(r$(e,g),{contextGraphId:e});if(c!==o.current)return;const v=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(v!=null&&v.tx){const R=v.asrt?Ku(En(v.asrt)):"",z=a$(R),F=(z==null?void 0:z.addr)??null,D=(v.agentSelf?Ku(En(v.agentSelf)):"")||(v.agentLc?Ku(En(v.agentLc)):"")||(F?`did:dkg:agent:${F.toLowerCase()}`:null),q=(v.ualSelf?En(v.ualSelf):"")||(v.ual?En(v.ual):""),G=(v.kaId?En(v.kaId):"")||(v.batchId?En(v.batchId):"");i({status:"verified",ual:q||null,txHash:En(v.tx)||null,blockNumber:v.block?En(v.block):null,kaId:G||null,author:F,finalizedAt:v.finalizedAt?En(v.finalizedAt):null,agent:D});return}const b=await gr(i$(e,g));if(c!==o.current)return;const k=(((p=b==null?void 0:b.result)==null?void 0:p.bindings)??[])[0];if(!k){i({...es,status:"offchain"});return}const j=En(k.source),C=o$(j),S=k.agent?Ku(En(k.agent)):null,N=(C==null?void 0:C.addr)??null;if(!C||!Uw(C.addr)||!_i(C.name)){i({...es,status:"offchain",author:N,agent:S});return}const A=await gr(s$(e,g,C.addr,C.name),{contextGraphId:e});if(c!==o.current)return;const O=(((h=A==null?void 0:A.result)==null?void 0:h.bindings)??[])[0],M=O!=null&&O.ual?En(O.ual):null,T=O!=null&&O.tx?En(O.tx):null,L=O!=null&&O.block?En(O.block):null,B=O!=null&&O.kaId?En(O.kaId):null,_=O!=null&&O.finalizedAt?En(O.finalizedAt):null;i({status:T?"verified":"offchain",ual:M||null,txHash:T||null,blockNumber:L||null,kaId:B||null,author:N,finalizedAt:_||null,agent:S})}catch(g){if(c!==o.current)return;i({...es,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),r}const c$=({contextGraphId:e,entityUri:t,enabled:n})=>{const r=gs(),i=n$(e,t,n),o=l$(e,t,n),{data:c}=vr(av,[],6e4),d=c==null?void 0:c.blockExplorerUrl,p=o.ual??i.ual,h=o.status==="verified";if(!n||i.loading||!i.ual&&!i.owner&&!i.publishedAt&&!h)return null;const g=i.publishedAt?u$(i.publishedAt):null,m=i.publisherPeerId&&r?Pw(i.publisherPeerId,r.agents):null,v=m?(r==null?void 0:r.get(m))??null:null,b=i.owner&&r?Pw(i.owner,r.agents):null,k=b?(r==null?void 0:r.get(b))??null:null,j=C=>{var S;(S=navigator.clipboard)==null||S.writeText(C).catch(()=>{})};return l.jsxs("div",{className:"v10-vm-identity",children:[l.jsxs("div",{className:"v10-vm-identity-head",children:[l.jsx("span",{className:"v10-vm-identity-glyph",children:"◉"}),l.jsx("span",{className:"v10-vm-identity-title",children:"On-chain identity"}),l.jsx("span",{className:"v10-vm-identity-badge",children:"VERIFIED"})]}),p&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),l.jsx("span",{className:"v10-vm-identity-val mono",title:p,children:p}),l.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(p),title:"Copy UAL",children:"⎘"})]}),h&&o.txHash&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),d?l.jsxs("a",{className:"v10-vm-identity-val mono",href:`${d}/tx/${o.txHash}`,target:"_blank",rel:"noopener noreferrer",title:o.txHash,children:[so(o.txHash,10,8)," ↗"]}):l.jsx("span",{className:"v10-vm-identity-val mono",title:o.txHash,children:so(o.txHash,10,8)}),l.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(o.txHash),title:"Copy transaction hash",children:"⎘"}),o.blockNumber&&l.jsxs("span",{className:"v10-vm-identity-opid mono",children:["· block ",o.blockNumber]})]}),h&&o.kaId&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"KA id"}),l.jsx("span",{className:"v10-vm-identity-val mono",title:o.kaId,children:so(o.kaId,8,8)}),l.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(o.kaId),title:"Copy KA id",children:"⎘"})]}),(k||i.owner)&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"Owner"}),k?l.jsxs("span",{className:"v10-vm-identity-val",children:[l.jsx(us,{agent:k,size:"sm"}),k.walletAddress&&l.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:so(k.walletAddress,6,4)})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"v10-vm-identity-val mono",title:i.owner??"",children:so(i.owner,8,6)}),l.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(i.owner),title:"Copy owner id",children:"⎘"})]})]}),g&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"Published"}),l.jsx("span",{className:"v10-vm-identity-val",title:i.publishedAt??"",children:g}),i.opId&&l.jsxs("span",{className:"v10-vm-identity-opid mono",title:`Anchor op: ${i.opId}`,children:["· anchor ",i.opId.slice(0,10)]})]}),(v||i.publisherPeerId)&&l.jsxs("div",{className:"v10-vm-identity-row",children:[l.jsx("span",{className:"v10-vm-identity-lbl",children:"By"}),v?l.jsx(us,{agent:v,size:"sm"}):l.jsx("span",{className:"v10-vm-identity-val mono",title:i.publisherPeerId??"",children:so(i.publisherPeerId,8,6)})]})]})};function u$(e){const t=new Date(e.replace(/^"|"$/g,""));return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):e}function ye(e,t,n){function r(d,p){var h;Object.defineProperty(d,"_zod",{value:d._zod??{},enumerable:!1}),(h=d._zod).traits??(h.traits=new Set),d._zod.traits.add(e),t(d,p);for(const g in c.prototype)g in d||Object.defineProperty(d,g,{value:c.prototype[g].bind(d)});d._zod.constr=c,d._zod.def=p}const i=(n==null?void 0:n.Parent)??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function c(d){var p;const h=n!=null&&n.Parent?new o:this;r(h,d),(p=h._zod).deferred??(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:d=>{var p,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(p=d==null?void 0:d._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class cc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const QC={};function ds(e){return QC}function KC(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function d$(e,t){return typeof t=="bigint"?t.toString():t}function YC(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Pv(e){return e==null}function Uv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function f$(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=Number.parseInt(e.toFixed(i).replace(".","")),c=Number.parseInt(t.toFixed(i).replace(".",""));return o%c/10**i}function Ht(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Bv(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Il(e){return JSON.stringify(e)}const XC=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function gg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const p$=YC(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function vg(e){if(gg(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(gg(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const h$=new Set(["string","number","symbol"]);function mf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vs(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function qe(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function m$(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const g$={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function v$(e,t){const n={},r=e._zod.def;for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(n[i]=r.shape[i])}return vs(e,{...e._zod.def,shape:n,checks:[]})}function y$(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete n[i]}return vs(e,{...e._zod.def,shape:n,checks:[]})}function b$(e,t){if(!vg(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Bv(this,"shape",r),r},checks:[]};return vs(e,n)}function x$(e,t){return vs(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Bv(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function w$(e,t,n){const r=t._zod.def.shape,i={...r};if(n)for(const o in n){if(!(o in r))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=e?new e({type:"optional",innerType:r[o]}):r[o])}else for(const o in r)i[o]=e?new e({type:"optional",innerType:r[o]}):r[o];return vs(t,{...t._zod.def,shape:i,checks:[]})}function k$(e,t,n){const r=t._zod.def.shape,i={...r};if(n)for(const o in n){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);n[o]&&(i[o]=new e({type:"nonoptional",innerType:r[o]}))}else for(const o in r)i[o]=new e({type:"nonoptional",innerType:r[o]});return vs(t,{...t._zod.def,shape:i,checks:[]})}function Yl(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Fv(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Yu(e){return typeof e=="string"?e:e==null?void 0:e.message}function fs(e,t,n){var i,o,c,d,p,h;const r={...e,path:e.path??[]};if(!e.message){const g=Yu((c=(o=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:o.error)==null?void 0:c.call(o,e))??Yu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??Yu((p=n.customError)==null?void 0:p.call(n,e))??Yu((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=g}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function qv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function uc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const JC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,d$,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eN=ye("$ZodError",JC),tN=ye("$ZodError",JC,{Parent:Error});function S$(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function j$(e,t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(d=>i({issues:d}));else if(c.code==="invalid_key")i({issues:c.issues});else if(c.code==="invalid_element")i({issues:c.issues});else if(c.path.length===0)r._errors.push(n(c));else{let d=r,p=0;for(;p<c.path.length;){const h=c.path[p];p===c.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(c))):d[h]=d[h]||{_errors:[]},d=d[h],p++}}};return i(e),r}const C$=e=>(t,n,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new cc;if(c.issues.length){const d=new((i==null?void 0:i.Err)??e)(c.issues.map(p=>fs(p,o,ds())));throw XC(d,i==null?void 0:i.callee),d}return c.value},N$=e=>async(t,n,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise&&(c=await c),c.issues.length){const d=new((i==null?void 0:i.Err)??e)(c.issues.map(p=>fs(p,o,ds())));throw XC(d,i==null?void 0:i.callee),d}return c.value},nN=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new cc;return o.issues.length?{success:!1,error:new(e??eN)(o.issues.map(c=>fs(c,i,ds())))}:{success:!0,data:o.value}},E$=nN(tN),rN=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(c=>fs(c,i,ds())))}:{success:!0,data:o.value}},A$=rN(tN),T$=/^[cC][^\s-]{8,}$/,R$=/^[0-9a-z]+$/,_$=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,O$=/^[0-9a-vA-V]{20}$/,M$=/^[A-Za-z0-9]{27}$/,L$=/^[a-zA-Z0-9_-]{21}$/,I$=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,D$=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bw=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,z$=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function P$(){return new RegExp($$,"u")}const U$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,B$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,F$=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,q$=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,H$=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,aN=/^[A-Za-z0-9_-]*$/,G$=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,V$=/^\+(?:[0-9]){6,14}[0-9]$/,iN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",W$=new RegExp(`^${iN}$`);function sN(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Z$(e){return new RegExp(`^${sN(e)}$`)}function Q$(e){const t=sN({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${iN}T(?:${r})$`)}const K$=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Y$=/^\d+$/,X$=/^-?\d+(?:\.\d+)?/i,J$=/^[^A-Z]*$/,e6=/^[^a-z]*$/,nr=ye("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),oN={number:"number",bigint:"bigint",object:"date"},lN=ye("$ZodCheckLessThan",(e,t)=>{nr.init(e,t);const n=oN[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cN=ye("$ZodCheckGreaterThan",(e,t)=>{nr.init(e,t);const n=oN[typeof t.value];e._zod.onattach.push(r=>{const i=r._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),t6=ye("$ZodCheckMultipleOf",(e,t)=>{nr.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):f$(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),n6=ye("$ZodCheckNumberFormat",(e,t)=>{var c;nr.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),r=n?"int":"number",[i,o]=g$[t.format];e._zod.onattach.push(d=>{const p=d._zod.bag;p.format=t.format,p.minimum=i,p.maximum=o,n&&(p.pattern=Y$)}),e._zod.check=d=>{const p=d.value;if(n){if(!Number.isInteger(p)){d.issues.push({expected:r,format:t.format,code:"invalid_type",input:p,inst:e});return}if(!Number.isSafeInteger(p)){p>0?d.issues.push({input:p,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):d.issues.push({input:p,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}p<i&&d.issues.push({origin:"number",input:p,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),p>o&&d.issues.push({origin:"number",input:p,code:"too_big",maximum:o,inst:e})}}),r6=ye("$ZodCheckMaxLength",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Pv(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const c=qv(i);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),a6=ye("$ZodCheckMinLength",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Pv(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const c=qv(i);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),i6=ye("$ZodCheckLengthEquals",(e,t)=>{var n;nr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Pv(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const c=qv(i),d=o>t.length;r.issues.push({origin:c,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),gf=ye("$ZodCheckStringFormat",(e,t)=>{var n,r;nr.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),s6=ye("$ZodCheckRegex",(e,t)=>{gf.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),o6=ye("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=J$),gf.init(e,t)}),l6=ye("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=e6),gf.init(e,t)}),c6=ye("$ZodCheckIncludes",(e,t)=>{nr.init(e,t);const n=mf(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),u6=ye("$ZodCheckStartsWith",(e,t)=>{nr.init(e,t);const n=new RegExp(`^${mf(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),d6=ye("$ZodCheckEndsWith",(e,t)=>{nr.init(e,t);const n=new RegExp(`.*${mf(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),f6=ye("$ZodCheckOverwrite",(e,t)=>{nr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class p6{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
1378
|
+
`).filter(c=>c),i=Math.min(...r.map(c=>c.length-c.trimStart().length)),o=r.map(c=>c.slice(i)).map(c=>" ".repeat(this.indent*2)+c);for(const c of o)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`
|
|
1379
|
+
`))}}const h6={major:4,minor:0,patch:0},nn=ye("$ZodType",(e,t)=>{var i;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=h6;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const c of o._zod.onattach)c(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(i=e._zod.deferred)==null||i.push(()=>{e._zod.run=e._zod.parse});else{const o=(c,d,p)=>{let h=Yl(c),g;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(c))continue}else if(h)continue;const v=c.issues.length,b=m._zod.check(c);if(b instanceof Promise&&(p==null?void 0:p.async)===!1)throw new cc;if(g||b instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await b,c.issues.length!==v&&(h||(h=Yl(c,v)))});else{if(c.issues.length===v)continue;h||(h=Yl(c,v))}}return g?g.then(()=>c):c};e._zod.run=(c,d)=>{const p=e._zod.parse(c,d);if(p instanceof Promise){if(d.async===!1)throw new cc;return p.then(h=>o(h,r,d))}return o(p,r,d)}}e["~standard"]={validate:o=>{var c;try{const d=E$(e,o);return d.success?{value:d.data}:{issues:(c=d.error)==null?void 0:c.issues}}catch{return A$(e,o).then(p=>{var h;return p.success?{value:p.data}:{issues:(h=p.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),Hv=ye("$ZodString",(e,t)=>{var n;nn.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??K$(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Vt=ye("$ZodStringFormat",(e,t)=>{gf.init(e,t),Hv.init(e,t)}),m6=ye("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=D$),Vt.init(e,t)}),g6=ye("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bw(r))}else t.pattern??(t.pattern=Bw());Vt.init(e,t)}),v6=ye("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=z$),Vt.init(e,t)}),y6=ye("$ZodURL",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{try{const r=n.value,i=new URL(r),o=i.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:G$.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&o.endsWith("/")?n.value=o.slice(0,-1):n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),b6=ye("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=P$()),Vt.init(e,t)}),x6=ye("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=L$),Vt.init(e,t)}),w6=ye("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=T$),Vt.init(e,t)}),k6=ye("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=R$),Vt.init(e,t)}),S6=ye("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_$),Vt.init(e,t)}),j6=ye("$ZodXID",(e,t)=>{t.pattern??(t.pattern=O$),Vt.init(e,t)}),C6=ye("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=M$),Vt.init(e,t)}),N6=ye("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Q$(t)),Vt.init(e,t)}),E6=ye("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=W$),Vt.init(e,t)}),A6=ye("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Z$(t)),Vt.init(e,t)}),T6=ye("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=I$),Vt.init(e,t)}),R6=ye("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=U$),Vt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),_6=ye("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=B$),Vt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),O6=ye("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=F$),Vt.init(e,t)}),M6=ye("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=q$),Vt.init(e,t),e._zod.check=n=>{const[r,i]=n.value.split("/");try{if(!i)throw new Error;const o=Number(i);if(`${o}`!==i)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function uN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const L6=ye("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=H$),Vt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{uN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function I6(e){if(!aN.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return uN(n)}const D6=ye("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=aN),Vt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{I6(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),z6=ye("$ZodE164",(e,t)=>{t.pattern??(t.pattern=V$),Vt.init(e,t)});function $6(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const P6=ye("$ZodJWT",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{$6(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),dN=ye("$ZodNumber",(e,t)=>{nn.init(e,t),e._zod.pattern=e._zod.bag.pattern??X$,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const i=n.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),U6=ye("$ZodNumber",(e,t)=>{n6.init(e,t),dN.init(e,t)}),B6=ye("$ZodUnknown",(e,t)=>{nn.init(e,t),e._zod.parse=n=>n}),F6=ye("$ZodNever",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Fw(e,t,n){e.issues.length&&t.issues.push(...Fv(n,e.issues)),t.value[n]=e.value}const q6=ye("$ZodArray",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let c=0;c<i.length;c++){const d=i[c],p=t.element._zod.run({value:d,issues:[]},r);p instanceof Promise?o.push(p.then(h=>Fw(h,n,c))):Fw(p,n,c)}return o.length?Promise.all(o).then(()=>n):n}});function Xu(e,t,n){e.issues.length&&t.issues.push(...Fv(n,e.issues)),t.value[n]=e.value}function qw(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...Fv(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const H6=ye("$ZodObject",(e,t)=>{nn.init(e,t);const n=YC(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof nn))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const v=m$(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(v)}});Ht(e._zod,"propValues",()=>{const m=t.shape,v={};for(const b in m){const k=m[b]._zod;if(k.values){v[b]??(v[b]=new Set);for(const j of k.values)v[b].add(j)}}return v});const r=m=>{const v=new p6(["shape","payload","ctx"]),b=n.value,k=N=>{const A=Il(N);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};v.write("const input = payload.value;");const j=Object.create(null);let C=0;for(const N of b.keys)j[N]=`key_${C++}`;v.write("const newResult = {}");for(const N of b.keys)if(b.optionalKeys.has(N)){const A=j[N];v.write(`const ${A} = ${k(N)};`);const O=Il(N);v.write(`
|
|
1380
|
+
if (${A}.issues.length) {
|
|
1381
|
+
if (input[${O}] === undefined) {
|
|
1382
|
+
if (${O} in input) {
|
|
1383
|
+
newResult[${O}] = undefined;
|
|
1384
|
+
}
|
|
1385
|
+
} else {
|
|
1386
|
+
payload.issues = payload.issues.concat(
|
|
1387
|
+
${A}.issues.map((iss) => ({
|
|
1388
|
+
...iss,
|
|
1389
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}],
|
|
1390
|
+
}))
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
} else if (${A}.value === undefined) {
|
|
1394
|
+
if (${O} in input) newResult[${O}] = undefined;
|
|
1395
|
+
} else {
|
|
1396
|
+
newResult[${O}] = ${A}.value;
|
|
1397
|
+
}
|
|
1398
|
+
`)}else{const A=j[N];v.write(`const ${A} = ${k(N)};`),v.write(`
|
|
1399
|
+
if (${A}.issues.length) payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
1400
|
+
...iss,
|
|
1401
|
+
path: iss.path ? [${Il(N)}, ...iss.path] : [${Il(N)}]
|
|
1402
|
+
})));`),v.write(`newResult[${Il(N)}] = ${A}.value`)}v.write("payload.value = newResult;"),v.write("return payload;");const S=v.compile();return(N,A)=>S(m,N,A)};let i;const o=gg,c=!QC.jitless,p=c&&p$.value,h=t.catchall;let g;e._zod.parse=(m,v)=>{g??(g=n.value);const b=m.value;if(!o(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const k=[];if(c&&p&&(v==null?void 0:v.async)===!1&&v.jitless!==!0)i||(i=r(t.shape)),m=i(m,v);else{m.value={};const A=g.shape;for(const O of g.keys){const M=A[O],T=M._zod.run({value:b[O],issues:[]},v),L=M._zod.optin==="optional"&&M._zod.optout==="optional";T instanceof Promise?k.push(T.then(B=>L?qw(B,m,O,b):Xu(B,m,O))):L?qw(T,m,O,b):Xu(T,m,O)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],C=g.keySet,S=h._zod,N=S.def.type;for(const A of Object.keys(b)){if(C.has(A))continue;if(N==="never"){j.push(A);continue}const O=S.run({value:b[A],issues:[]},v);O instanceof Promise?k.push(O.then(M=>Xu(M,m,A))):Xu(O,m,A)}return j.length&&m.issues.push({code:"unrecognized_keys",keys:j,input:b,inst:e}),k.length?Promise.all(k).then(()=>m):m}});function Hw(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(o=>fs(o,r,ds())))}),t}const G6=ye("$ZodUnion",(e,t)=>{nn.init(e,t),Ht(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ht(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ht(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Ht(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>Uv(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let i=!1;const o=[];for(const c of t.options){const d=c._zod.run({value:n.value,issues:[]},r);if(d instanceof Promise)o.push(d),i=!0;else{if(d.issues.length===0)return d;o.push(d)}}return i?Promise.all(o).then(c=>Hw(c,n,e,r)):Hw(o,n,e,r)}}),V6=ye("$ZodIntersection",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),c=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||c instanceof Promise?Promise.all([o,c]).then(([p,h])=>Gw(n,p,h)):Gw(n,o,c)}});function yg(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(vg(e)&&vg(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const c=yg(e[o],t[o]);if(!c.valid)return{valid:!1,mergeErrorPath:[o,...c.mergeErrorPath]};i[o]=c.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t[r],c=yg(i,o);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Gw(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Yl(e))return e;const r=yg(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const W6=ye("$ZodEnum",(e,t)=>{nn.init(e,t);const n=KC(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>h$.has(typeof r)).map(r=>typeof r=="string"?mf(r):r.toString()).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:n,input:o,inst:e}),r}}),Z6=ye("$ZodTransform",(e,t)=>{nn.init(e,t),e._zod.parse=(n,r)=>{const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(c=>(n.value=c,n));if(i instanceof Promise)throw new cc;return n.value=i,n}}),Q6=ye("$ZodOptional",(e,t)=>{nn.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ht(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ht(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uv(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),K6=ye("$ZodNullable",(e,t)=>{nn.init(e,t),Ht(e._zod,"optin",()=>t.innerType._zod.optin),Ht(e._zod,"optout",()=>t.innerType._zod.optout),Ht(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Uv(n.source)}|null)$`):void 0}),Ht(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Y6=ye("$ZodDefault",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Vw(o,t)):Vw(i,t)}});function Vw(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const X6=ye("$ZodPrefault",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),J6=ye("$ZodNonOptional",(e,t)=>{nn.init(e,t),Ht(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>Ww(o,e)):Ww(i,e)}});function Ww(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const e5=ye("$ZodCatch",(e,t)=>{nn.init(e,t),e._zod.optin="optional",Ht(e._zod,"optout",()=>t.innerType._zod.optout),Ht(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>fs(c,r,ds()))},input:n.value}),n.issues=[]),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>fs(o,r,ds()))},input:n.value}),n.issues=[]),n)}}),t5=ye("$ZodPipe",(e,t)=>{nn.init(e,t),Ht(e._zod,"values",()=>t.in._zod.values),Ht(e._zod,"optin",()=>t.in._zod.optin),Ht(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>Zw(o,t,r)):Zw(i,t,r)}});function Zw(e,t,n){return Yl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const n5=ye("$ZodReadonly",(e,t)=>{nn.init(e,t),Ht(e._zod,"propValues",()=>t.innerType._zod.propValues),Ht(e._zod,"values",()=>t.innerType._zod.values),Ht(e._zod,"optin",()=>t.innerType._zod.optin),Ht(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(Qw):Qw(i)}});function Qw(e){return e.value=Object.freeze(e.value),e}const r5=ye("$ZodCustom",(e,t)=>{nr.init(e,t),nn.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(o=>Kw(o,n,r,e));Kw(i,n,r,e)}});function Kw(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(uc(i))}}class fN{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function pN(){return new fN}const Wl=pN();function a5(e,t){return new e({type:"string",...qe(t)})}function i5(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...qe(t)})}function Yw(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...qe(t)})}function s5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...qe(t)})}function o5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...qe(t)})}function l5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...qe(t)})}function c5(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...qe(t)})}function u5(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...qe(t)})}function d5(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...qe(t)})}function f5(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...qe(t)})}function p5(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...qe(t)})}function h5(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...qe(t)})}function m5(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...qe(t)})}function g5(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...qe(t)})}function v5(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...qe(t)})}function y5(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...qe(t)})}function b5(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...qe(t)})}function x5(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...qe(t)})}function w5(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...qe(t)})}function k5(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...qe(t)})}function S5(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...qe(t)})}function j5(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...qe(t)})}function C5(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...qe(t)})}function N5(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...qe(t)})}function E5(e,t){return new e({type:"string",format:"date",check:"string_format",...qe(t)})}function A5(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...qe(t)})}function T5(e,t){return new e({type:"string",format:"duration",check:"string_format",...qe(t)})}function R5(e,t){return new e({type:"number",checks:[],...qe(t)})}function _5(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...qe(t)})}function O5(e){return new e({type:"unknown"})}function M5(e,t){return new e({type:"never",...qe(t)})}function Xw(e,t){return new lN({check:"less_than",...qe(t),value:e,inclusive:!1})}function mm(e,t){return new lN({check:"less_than",...qe(t),value:e,inclusive:!0})}function Jw(e,t){return new cN({check:"greater_than",...qe(t),value:e,inclusive:!1})}function gm(e,t){return new cN({check:"greater_than",...qe(t),value:e,inclusive:!0})}function ek(e,t){return new t6({check:"multiple_of",...qe(t),value:e})}function hN(e,t){return new r6({check:"max_length",...qe(t),maximum:e})}function Bd(e,t){return new a6({check:"min_length",...qe(t),minimum:e})}function mN(e,t){return new i6({check:"length_equals",...qe(t),length:e})}function L5(e,t){return new s6({check:"string_format",format:"regex",...qe(t),pattern:e})}function I5(e){return new o6({check:"string_format",format:"lowercase",...qe(e)})}function D5(e){return new l6({check:"string_format",format:"uppercase",...qe(e)})}function z5(e,t){return new c6({check:"string_format",format:"includes",...qe(t),includes:e})}function $5(e,t){return new u6({check:"string_format",format:"starts_with",...qe(t),prefix:e})}function P5(e,t){return new d6({check:"string_format",format:"ends_with",...qe(t),suffix:e})}function Sc(e){return new f6({check:"overwrite",tx:e})}function U5(e){return Sc(t=>t.normalize(e))}function B5(){return Sc(e=>e.trim())}function F5(){return Sc(e=>e.toLowerCase())}function q5(){return Sc(e=>e.toUpperCase())}function H5(e,t,n){return new e({type:"array",element:t,...qe(n)})}function G5(e,t,n){return new e({type:"custom",check:"custom",fn:t,...qe(n)})}class tk{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Wl,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var m,v,b;var r;const i=t._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},c=this.seen.get(t);if(c)return c.count++,n.schemaPath.includes(t)&&(c.cycle=n.path),c.schema;const d={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,d);const p=(v=(m=t._zod).toJSONSchema)==null?void 0:v.call(m);if(p)d.schema=p;else{const k={...n,schemaPath:[...n.schemaPath,t],path:n.path},j=t._zod.parent;if(j)d.ref=j,this.process(j,k),this.seen.get(j).isParent=!0;else{const C=d.schema;switch(i.type){case"string":{const S=C;S.type="string";const{minimum:N,maximum:A,format:O,patterns:M,contentEncoding:T}=t._zod.bag;if(typeof N=="number"&&(S.minLength=N),typeof A=="number"&&(S.maxLength=A),O&&(S.format=o[O]??O,S.format===""&&delete S.format),T&&(S.contentEncoding=T),M&&M.size>0){const L=[...M];L.length===1?S.pattern=L[0].source:L.length>1&&(d.schema.allOf=[...L.map(B=>({...this.target==="draft-7"?{type:"string"}:{},pattern:B.source}))])}break}case"number":{const S=C,{minimum:N,maximum:A,format:O,multipleOf:M,exclusiveMaximum:T,exclusiveMinimum:L}=t._zod.bag;typeof O=="string"&&O.includes("int")?S.type="integer":S.type="number",typeof L=="number"&&(S.exclusiveMinimum=L),typeof N=="number"&&(S.minimum=N,typeof L=="number"&&(L>=N?delete S.minimum:delete S.exclusiveMinimum)),typeof T=="number"&&(S.exclusiveMaximum=T),typeof A=="number"&&(S.maximum=A,typeof T=="number"&&(T<=A?delete S.maximum:delete S.exclusiveMaximum)),typeof M=="number"&&(S.multipleOf=M);break}case"boolean":{const S=C;S.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{C.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{C.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=C,{minimum:N,maximum:A}=t._zod.bag;typeof N=="number"&&(S.minItems=N),typeof A=="number"&&(S.maxItems=A),S.type="array",S.items=this.process(i.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=C;S.type="object",S.properties={};const N=i.shape;for(const M in N)S.properties[M]=this.process(N[M],{...k,path:[...k.path,"properties",M]});const A=new Set(Object.keys(N)),O=new Set([...A].filter(M=>{const T=i.shape[M]._zod;return this.io==="input"?T.optin===void 0:T.optout===void 0}));O.size>0&&(S.required=Array.from(O)),((b=i.catchall)==null?void 0:b._zod.def.type)==="never"?S.additionalProperties=!1:i.catchall?i.catchall&&(S.additionalProperties=this.process(i.catchall,{...k,path:[...k.path,"additionalProperties"]})):this.io==="output"&&(S.additionalProperties=!1);break}case"union":{const S=C;S.anyOf=i.options.map((N,A)=>this.process(N,{...k,path:[...k.path,"anyOf",A]}));break}case"intersection":{const S=C,N=this.process(i.left,{...k,path:[...k.path,"allOf",0]}),A=this.process(i.right,{...k,path:[...k.path,"allOf",1]}),O=T=>"allOf"in T&&Object.keys(T).length===1,M=[...O(N)?N.allOf:[N],...O(A)?A.allOf:[A]];S.allOf=M;break}case"tuple":{const S=C;S.type="array";const N=i.items.map((M,T)=>this.process(M,{...k,path:[...k.path,"prefixItems",T]}));if(this.target==="draft-2020-12"?S.prefixItems=N:S.items=N,i.rest){const M=this.process(i.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=M:S.additionalItems=M}i.rest&&(S.items=this.process(i.rest,{...k,path:[...k.path,"items"]}));const{minimum:A,maximum:O}=t._zod.bag;typeof A=="number"&&(S.minItems=A),typeof O=="number"&&(S.maxItems=O);break}case"record":{const S=C;S.type="object",S.propertyNames=this.process(i.keyType,{...k,path:[...k.path,"propertyNames"]}),S.additionalProperties=this.process(i.valueType,{...k,path:[...k.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const S=C,N=KC(i.entries);N.every(A=>typeof A=="number")&&(S.type="number"),N.every(A=>typeof A=="string")&&(S.type="string"),S.enum=N;break}case"literal":{const S=C,N=[];for(const A of i.values)if(A===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof A=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");N.push(Number(A))}else N.push(A);if(N.length!==0)if(N.length===1){const A=N[0];S.type=A===null?"null":typeof A,S.const=A}else N.every(A=>typeof A=="number")&&(S.type="number"),N.every(A=>typeof A=="string")&&(S.type="string"),N.every(A=>typeof A=="boolean")&&(S.type="string"),N.every(A=>A===null)&&(S.type="null"),S.enum=N;break}case"file":{const S=C,N={type:"string",format:"binary",contentEncoding:"binary"},{minimum:A,maximum:O,mime:M}=t._zod.bag;A!==void 0&&(N.minLength=A),O!==void 0&&(N.maxLength=O),M?M.length===1?(N.contentMediaType=M[0],Object.assign(S,N)):S.anyOf=M.map(T=>({...N,contentMediaType:T})):Object.assign(S,N);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(i.innerType,k);C.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(i.innerType,k),d.ref=i.innerType;break}case"success":{const S=C;S.type="boolean";break}case"default":{this.process(i.innerType,k),d.ref=i.innerType,C.default=JSON.parse(JSON.stringify(i.defaultValue));break}case"prefault":{this.process(i.innerType,k),d.ref=i.innerType,this.io==="input"&&(C._prefault=JSON.parse(JSON.stringify(i.defaultValue)));break}case"catch":{this.process(i.innerType,k),d.ref=i.innerType;let S;try{S=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}C.default=S;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const S=C,N=t._zod.pattern;if(!N)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=N.source;break}case"pipe":{const S=this.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(i.innerType,k),d.ref=i.innerType,C.readOnly=!0;break}case"promise":{this.process(i.innerType,k),d.ref=i.innerType;break}case"optional":{this.process(i.innerType,k),d.ref=i.innerType;break}case"lazy":{const S=t._zod.innerType;this.process(S,k),d.ref=S;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const h=this.metadataRegistry.get(t);return h&&Object.assign(d.schema,h),this.io==="input"&&hn(t)&&(delete d.schema.examples,delete d.schema.default),this.io==="input"&&d.schema._prefault&&((r=d.schema).default??(r.default=d.schema._prefault)),delete d.schema._prefault,this.seen.get(t).schema}emit(t,n){var g,m,v,b,k,j;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},i=this.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=C=>{var M;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const T=(M=r.external.registry.get(C[0]))==null?void 0:M.id,L=r.external.uri??(_=>_);if(T)return{ref:L(T)};const B=C[1].defId??C[1].schema.id??`schema${this.counter++}`;return C[1].defId=B,{defId:B,ref:`${L("__shared")}#/${S}/${B}`}}if(C[1]===i)return{ref:"#"};const A=`#/${S}/`,O=C[1].schema.id??`__schema${this.counter++}`;return{defId:O,ref:A+O}},c=C=>{if(C[1].schema.$ref)return;const S=C[1],{ref:N,defId:A}=o(C);S.def={...S.schema},A&&(S.defId=A);const O=S.schema;for(const M in O)delete O[M];O.$ref=N};if(r.cycles==="throw")for(const C of this.seen.entries()){const S=C[1];if(S.cycle)throw new Error(`Cycle detected: #/${(g=S.cycle)==null?void 0:g.join("/")}/<root>
|
|
1403
|
+
|
|
1404
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const C of this.seen.entries()){const S=C[1];if(t===C[0]){c(C);continue}if(r.external){const A=(m=r.external.registry.get(C[0]))==null?void 0:m.id;if(t!==C[0]&&A){c(C);continue}}if((v=this.metadataRegistry.get(C[0]))==null?void 0:v.id){c(C);continue}if(S.cycle){c(C);continue}if(S.count>1&&r.reused==="ref"){c(C);continue}}const d=(C,S)=>{const N=this.seen.get(C),A=N.def??N.schema,O={...A};if(N.ref===null)return;const M=N.ref;if(N.ref=null,M){d(M,S);const T=this.seen.get(M).schema;T.$ref&&S.target==="draft-7"?(A.allOf=A.allOf??[],A.allOf.push(T)):(Object.assign(A,T),Object.assign(A,O))}N.isParent||this.override({zodSchema:C,jsonSchema:A,path:N.path??[]})};for(const C of[...this.seen.entries()].reverse())d(C[0],{target:this.target});const p={};if(this.target==="draft-2020-12"?p.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?p.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(b=r.external)!=null&&b.uri){const C=(k=r.external.registry.get(t))==null?void 0:k.id;if(!C)throw new Error("Schema is missing an `id` property");p.$id=r.external.uri(C)}Object.assign(p,i.def);const h=((j=r.external)==null?void 0:j.defs)??{};for(const C of this.seen.entries()){const S=C[1];S.def&&S.defId&&(h[S.defId]=S.def)}r.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?p.$defs=h:p.definitions=h);try{return JSON.parse(JSON.stringify(p))}catch{throw new Error("Error converting schema to JSON.")}}}function V5(e,t){if(e instanceof fN){const r=new tk(t),i={};for(const d of e._idmap.entries()){const[p,h]=d;r.process(h)}const o={},c={registry:e,uri:t==null?void 0:t.uri,defs:i};for(const d of e._idmap.entries()){const[p,h]=d;o[p]=r.emit(h,{...t,external:c})}if(Object.keys(i).length>0){const d=r.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[d]:i}}return{schemas:o}}const n=new tk(t);return n.process(e),n.emit(e,t)}function hn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;switch(i.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return hn(i.element,n);case"object":{for(const o in i.shape)if(hn(i.shape[o],n))return!0;return!1}case"union":{for(const o of i.options)if(hn(o,n))return!0;return!1}case"intersection":return hn(i.left,n)||hn(i.right,n);case"tuple":{for(const o of i.items)if(hn(o,n))return!0;return!!(i.rest&&hn(i.rest,n))}case"record":return hn(i.keyType,n)||hn(i.valueType,n);case"map":return hn(i.keyType,n)||hn(i.valueType,n);case"set":return hn(i.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return hn(i.innerType,n);case"lazy":return hn(i.getter(),n);case"default":return hn(i.innerType,n);case"prefault":return hn(i.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return hn(i.in,n)||hn(i.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${i.type}`)}const W5=ye("ZodISODateTime",(e,t)=>{N6.init(e,t),Zt.init(e,t)});function Z5(e){return N5(W5,e)}const Q5=ye("ZodISODate",(e,t)=>{E6.init(e,t),Zt.init(e,t)});function K5(e){return E5(Q5,e)}const Y5=ye("ZodISOTime",(e,t)=>{A6.init(e,t),Zt.init(e,t)});function X5(e){return A5(Y5,e)}const J5=ye("ZodISODuration",(e,t)=>{T6.init(e,t),Zt.init(e,t)});function eP(e){return T5(J5,e)}const tP=(e,t)=>{eN.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>j$(e,n)},flatten:{value:n=>S$(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},vf=ye("ZodError",tP,{Parent:Error}),nP=C$(vf),rP=N$(vf),aP=nN(vf),iP=rN(vf),vn=ye("ZodType",(e,t)=>(nn.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>vs(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>nP(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>aP(e,n,r),e.parseAsync=async(n,r)=>rP(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>iP(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(ZP(n,r)),e.superRefine=n=>e.check(QP(n)),e.overwrite=n=>e.check(Sc(n)),e.optional=()=>ik(e),e.nullable=()=>sk(e),e.nullish=()=>ik(sk(e)),e.nonoptional=n=>UP(e,n),e.array=()=>Ba(e),e.or=n=>Gv([e,n]),e.and=n=>OP(e,n),e.transform=n=>ok(e,LP(n)),e.default=n=>zP(e,n),e.prefault=n=>PP(e,n),e.catch=n=>FP(e,n),e.pipe=n=>ok(e,n),e.readonly=()=>GP(e),e.describe=n=>{const r=e.clone();return Wl.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Wl.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Wl.get(e);const r=e.clone();return Wl.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),gN=ye("_ZodString",(e,t)=>{Hv.init(e,t),vn.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(L5(...r)),e.includes=(...r)=>e.check(z5(...r)),e.startsWith=(...r)=>e.check($5(...r)),e.endsWith=(...r)=>e.check(P5(...r)),e.min=(...r)=>e.check(Bd(...r)),e.max=(...r)=>e.check(hN(...r)),e.length=(...r)=>e.check(mN(...r)),e.nonempty=(...r)=>e.check(Bd(1,...r)),e.lowercase=r=>e.check(I5(r)),e.uppercase=r=>e.check(D5(r)),e.trim=()=>e.check(B5()),e.normalize=(...r)=>e.check(U5(...r)),e.toLowerCase=()=>e.check(F5()),e.toUpperCase=()=>e.check(q5())}),sP=ye("ZodString",(e,t)=>{Hv.init(e,t),gN.init(e,t),e.email=n=>e.check(i5(oP,n)),e.url=n=>e.check(u5(lP,n)),e.jwt=n=>e.check(C5(SP,n)),e.emoji=n=>e.check(d5(cP,n)),e.guid=n=>e.check(Yw(nk,n)),e.uuid=n=>e.check(s5(Ju,n)),e.uuidv4=n=>e.check(o5(Ju,n)),e.uuidv6=n=>e.check(l5(Ju,n)),e.uuidv7=n=>e.check(c5(Ju,n)),e.nanoid=n=>e.check(f5(uP,n)),e.guid=n=>e.check(Yw(nk,n)),e.cuid=n=>e.check(p5(dP,n)),e.cuid2=n=>e.check(h5(fP,n)),e.ulid=n=>e.check(m5(pP,n)),e.base64=n=>e.check(k5(xP,n)),e.base64url=n=>e.check(S5(wP,n)),e.xid=n=>e.check(g5(hP,n)),e.ksuid=n=>e.check(v5(mP,n)),e.ipv4=n=>e.check(y5(gP,n)),e.ipv6=n=>e.check(b5(vP,n)),e.cidrv4=n=>e.check(x5(yP,n)),e.cidrv6=n=>e.check(w5(bP,n)),e.e164=n=>e.check(j5(kP,n)),e.datetime=n=>e.check(Z5(n)),e.date=n=>e.check(K5(n)),e.time=n=>e.check(X5(n)),e.duration=n=>e.check(eP(n))});function Be(e){return a5(sP,e)}const Zt=ye("ZodStringFormat",(e,t)=>{Vt.init(e,t),gN.init(e,t)}),oP=ye("ZodEmail",(e,t)=>{v6.init(e,t),Zt.init(e,t)}),nk=ye("ZodGUID",(e,t)=>{m6.init(e,t),Zt.init(e,t)}),Ju=ye("ZodUUID",(e,t)=>{g6.init(e,t),Zt.init(e,t)}),lP=ye("ZodURL",(e,t)=>{y6.init(e,t),Zt.init(e,t)}),cP=ye("ZodEmoji",(e,t)=>{b6.init(e,t),Zt.init(e,t)}),uP=ye("ZodNanoID",(e,t)=>{x6.init(e,t),Zt.init(e,t)}),dP=ye("ZodCUID",(e,t)=>{w6.init(e,t),Zt.init(e,t)}),fP=ye("ZodCUID2",(e,t)=>{k6.init(e,t),Zt.init(e,t)}),pP=ye("ZodULID",(e,t)=>{S6.init(e,t),Zt.init(e,t)}),hP=ye("ZodXID",(e,t)=>{j6.init(e,t),Zt.init(e,t)}),mP=ye("ZodKSUID",(e,t)=>{C6.init(e,t),Zt.init(e,t)}),gP=ye("ZodIPv4",(e,t)=>{R6.init(e,t),Zt.init(e,t)}),vP=ye("ZodIPv6",(e,t)=>{_6.init(e,t),Zt.init(e,t)}),yP=ye("ZodCIDRv4",(e,t)=>{O6.init(e,t),Zt.init(e,t)}),bP=ye("ZodCIDRv6",(e,t)=>{M6.init(e,t),Zt.init(e,t)}),xP=ye("ZodBase64",(e,t)=>{L6.init(e,t),Zt.init(e,t)}),wP=ye("ZodBase64URL",(e,t)=>{D6.init(e,t),Zt.init(e,t)}),kP=ye("ZodE164",(e,t)=>{z6.init(e,t),Zt.init(e,t)}),SP=ye("ZodJWT",(e,t)=>{P6.init(e,t),Zt.init(e,t)}),vN=ye("ZodNumber",(e,t)=>{dN.init(e,t),vn.init(e,t),e.gt=(r,i)=>e.check(Jw(r,i)),e.gte=(r,i)=>e.check(gm(r,i)),e.min=(r,i)=>e.check(gm(r,i)),e.lt=(r,i)=>e.check(Xw(r,i)),e.lte=(r,i)=>e.check(mm(r,i)),e.max=(r,i)=>e.check(mm(r,i)),e.int=r=>e.check(rk(r)),e.safe=r=>e.check(rk(r)),e.positive=r=>e.check(Jw(0,r)),e.nonnegative=r=>e.check(gm(0,r)),e.negative=r=>e.check(Xw(0,r)),e.nonpositive=r=>e.check(mm(0,r)),e.multipleOf=(r,i)=>e.check(ek(r,i)),e.step=(r,i)=>e.check(ek(r,i)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ca(e){return R5(vN,e)}const jP=ye("ZodNumberFormat",(e,t)=>{U6.init(e,t),vN.init(e,t)});function rk(e){return _5(jP,e)}const CP=ye("ZodUnknown",(e,t)=>{B6.init(e,t),vn.init(e,t)});function ak(){return O5(CP)}const NP=ye("ZodNever",(e,t)=>{F6.init(e,t),vn.init(e,t)});function EP(e){return M5(NP,e)}const AP=ye("ZodArray",(e,t)=>{q6.init(e,t),vn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Bd(n,r)),e.nonempty=n=>e.check(Bd(1,n)),e.max=(n,r)=>e.check(hN(n,r)),e.length=(n,r)=>e.check(mN(n,r)),e.unwrap=()=>e.element});function Ba(e,t){return H5(AP,e,t)}const TP=ye("ZodObject",(e,t)=>{H6.init(e,t),vn.init(e,t),Ht(e,"shape",()=>t.shape),e.keyof=()=>So(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ak()}),e.loose=()=>e.clone({...e._zod.def,catchall:ak()}),e.strict=()=>e.clone({...e._zod.def,catchall:EP()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>b$(e,n),e.merge=n=>x$(e,n),e.pick=n=>v$(e,n),e.omit=n=>y$(e,n),e.partial=(...n)=>w$(yN,e,n[0]),e.required=(...n)=>k$(bN,e,n[0])});function qt(e,t){const n={type:"object",get shape(){return Bv(this,"shape",{...e}),this.shape},...qe(t)};return new TP(n)}const RP=ye("ZodUnion",(e,t)=>{G6.init(e,t),vn.init(e,t),e.options=t.options});function Gv(e,t){return new RP({type:"union",options:e,...qe(t)})}const _P=ye("ZodIntersection",(e,t)=>{V6.init(e,t),vn.init(e,t)});function OP(e,t){return new _P({type:"intersection",left:e,right:t})}const bg=ye("ZodEnum",(e,t)=>{W6.init(e,t),vn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const c of r)if(n.has(c))o[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new bg({...t,checks:[],...qe(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const c of r)if(n.has(c))delete o[c];else throw new Error(`Key ${c} not found in enum`);return new bg({...t,checks:[],...qe(i),entries:o})}});function So(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new bg({type:"enum",entries:n,...qe(t)})}const MP=ye("ZodTransform",(e,t)=>{Z6.init(e,t),vn.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=o=>{if(typeof o=="string")n.issues.push(uc(o,n.value,t));else{const c=o;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),c.continue??(c.continue=!0),n.issues.push(uc(c))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n)):(n.value=i,n)}});function LP(e){return new MP({type:"transform",transform:e})}const yN=ye("ZodOptional",(e,t)=>{Q6.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ik(e){return new yN({type:"optional",innerType:e})}const IP=ye("ZodNullable",(e,t)=>{K6.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sk(e){return new IP({type:"nullable",innerType:e})}const DP=ye("ZodDefault",(e,t)=>{Y6.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zP(e,t){return new DP({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const $P=ye("ZodPrefault",(e,t)=>{X6.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function PP(e,t){return new $P({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const bN=ye("ZodNonOptional",(e,t)=>{J6.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function UP(e,t){return new bN({type:"nonoptional",innerType:e,...qe(t)})}const BP=ye("ZodCatch",(e,t)=>{e5.init(e,t),vn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function FP(e,t){return new BP({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const qP=ye("ZodPipe",(e,t)=>{t5.init(e,t),vn.init(e,t),e.in=t.in,e.out=t.out});function ok(e,t){return new qP({type:"pipe",in:e,out:t})}const HP=ye("ZodReadonly",(e,t)=>{n5.init(e,t),vn.init(e,t)});function GP(e){return new HP({type:"readonly",innerType:e})}const VP=ye("ZodCustom",(e,t)=>{r5.init(e,t),vn.init(e,t)});function WP(e){const t=new nr({check:"custom"});return t._zod.check=e,t}function ZP(e,t={}){return G5(VP,e,t)}function QP(e){const t=WP(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(uc(r,n.value,t._zod.def));else{const i=r;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(uc(i))}},e(n.value,n)));return t}function vm(e,t){if(!t||e==null)return;if(!t.includes("."))return e[t];let n=e;for(const r of t.split(".")){if(n==null)return;n=n[r]}return n}function et(e){if(typeof e=="number")return e;if(typeof e=="string"){const t=Number(e);return isNaN(t)?0:t}return typeof e=="boolean"&&e?1:0}const Vv={Count:{name:"Count",signature:"Count(array) → number",description:"Returns array length",fn:e=>Array.isArray(e)?e.length:0},First:{name:"First",signature:"First(array) → element",description:"Returns first element of array",fn:e=>Array.isArray(e)?e[0]??null:null},Last:{name:"Last",signature:"Last(array) → element",description:"Returns last element of array",fn:e=>Array.isArray(e)?e[e.length-1]??null:null},Sum:{name:"Sum",signature:"Sum(numbers[]) → number",description:"Sum of numeric array",fn:e=>Array.isArray(e)?e.reduce((t,n)=>t+et(n),0):0},Avg:{name:"Avg",signature:"Avg(numbers[]) → number",description:"Average of numeric array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>t+et(n),0)/e.length:0},Min:{name:"Min",signature:"Min(numbers[]) → number",description:"Minimum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.min(t,et(n)),et(e[0])):0},Max:{name:"Max",signature:"Max(numbers[]) → number",description:"Maximum value in array",fn:e=>Array.isArray(e)&&e.length?e.reduce((t,n)=>Math.max(t,et(n)),et(e[0])):0},Sort:{name:"Sort",signature:"Sort(array, field, direction?) → sorted array",description:'Sort array by field. Direction: "asc" (default) or "desc"',fn:(e,t,n)=>{if(!Array.isArray(e))return e;const r=String(t??""),i=String(n??"asc")==="desc";return[...e].sort((o,c)=>{const d=r?vm(o,r):o,p=r?vm(c,r):c,h=typeof d=="number"||typeof d=="string"&&!isNaN(Number(d))&&d!=="",g=typeof p=="number"||typeof p=="string"&&!isNaN(Number(p))&&p!=="";if(h&&g){const v=et(d)-et(p);return i?-v:v}const m=String(d??"").localeCompare(String(p??""));return i?-m:m})}},Filter:{name:"Filter",signature:'Filter(array, field, operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "contains", value) → filtered array',description:"Filter array by field value",fn:(e,t,n,r)=>{if(!Array.isArray(e))return[];const i=String(t??""),o=String(n??"==");return e.filter(c=>{const d=i?vm(c,i):c;switch(o){case"==":return d==r;case"!=":return d!=r;case">":return et(d)>et(r);case"<":return et(d)<et(r);case">=":return et(d)>=et(r);case"<=":return et(d)<=et(r);case"contains":return String(d??"").includes(String(r??""));default:return!1}})}},Round:{name:"Round",signature:"Round(number, decimals?) → number",description:"Round to N decimal places (default 0)",fn:(e,t)=>{const n=et(e),r=t!=null?et(t):0,i=Math.pow(10,r);return Math.round(n*i)/i}},Abs:{name:"Abs",signature:"Abs(number) → number",description:"Absolute value",fn:e=>Math.abs(et(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(et(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(et(e))}},Wv=new Set(["Each"]),KP={Each:{signature:"Each(array, varName, template)",description:"Evaluate template for each element. varName is the loop variable — use it ONLY inside the template expression (inline). Do NOT create a separate statement for the template."}},Br={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},xN=new Set(["Action",...Object.keys(Br)]),YP=new Set([...Object.keys(Vv),...Wv,...xN]);function dc(e){return YP.has(e)}const Ri={Query:"Query",Mutation:"Mutation"};function Fd(e){return e in Ri}function qd(e){const t=e.type;if(t==="string"){const n=e.enum;return n?n.map(r=>`"${r}"`).join(" | "):"string"}if(t==="number"||t==="integer")return"number";if(t==="boolean")return"boolean";if(t==="array"){const n=e.items;return n?`${qd(n)}[]`:"any[]"}if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r=e.required??[];return`{${Object.entries(n).map(([i,o])=>`${i}${r.includes(i)?"":"?"}: ${qd(o)}`).join(", ")}}`}return"object"}return"any"}function wN(e){const t=e.type;if(t==="string")return"";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(t==="array")return[];if(t==="object"){const n=e.properties;if(n&&Object.keys(n).length>0){const r={};for(const[i,o]of Object.entries(n))r[i]=wN(o);return r}return{}}return null}const XP="You are an AI assistant that responds using openui-lang, a declarative UI language. Your ENTIRE response must be valid openui-lang code — no markdown, no explanations, just openui-lang.";function JP(e,t){const n=["## Syntax Rules","","1. Each statement is on its own line: `identifier = Expression`",`2. \`root\` is the entry point — every program must define \`root = ${e}(...)\``,'3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)',"4. Use references for readability: define `name = ...` on one line, then use `name` later","5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.",'6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks',"7. Optional arguments can be omitted from the end"];let r=8;return t.bindings&&n.push(`${r++}. Declare mutable state with \`$varName = defaultValue\`. Components marked with \`$binding\` can read/write these. Undeclared $variables are auto-created with null default.`),t.supportsExpressions&&n.push(`${r++}. String concatenation: \`"text" + $var + "more"\``,`${r++}. Dot member access: \`query.field\` reads a field; on arrays it extracts that field from every element`,`${r++}. Index access: \`arr[0]\`, \`data[index]\``,`${r++}. Arithmetic operators: +, -, *, /, % (work on numbers; + is string concat when either side is a string)`,`${r++}. Comparison: ==, !=, >, <, >=, <=`,`${r++}. Logical: &&, ||, ! (prefix)`,`${r++}. Ternary: \`condition ? valueIfTrue : valueIfFalse\``,`${r++}. Parentheses for grouping: \`(a + b) * c\``),n.push("- Strings use double quotes with backslash escaping"),n.join(`
|
|
1405
|
+
`)}function eU(){const e=Object.values(Vv).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(KP).map(n=>`@${n.signature} — ${n.description}`);return`## Built-in Functions
|
|
1406
|
+
|
|
1407
|
+
Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.
|
|
1408
|
+
Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.
|
|
1409
|
+
|
|
1410
|
+
${[...e,...t].join(`
|
|
1411
|
+
`)}
|
|
1412
|
+
|
|
1413
|
+
Builtins compose — output of one is input to the next:
|
|
1414
|
+
\`@Count(@Filter(data.rows, "field", "==", "val"))\` for KPIs/chart values, \`@Round(@Avg(data.rows.score), 1)\`, \`@Each(data.rows, "item", Comp(item.field))\` for per-item rendering.
|
|
1415
|
+
Array pluck: \`data.rows.field\` extracts a field from every row → use with @Sum, @Avg, charts, tables.
|
|
1416
|
+
|
|
1417
|
+
IMPORTANT @Each rule: The loop variable (e.g. "item") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.
|
|
1418
|
+
CORRECT: \`Col("Actions", @Each(rows, "t", Button("Edit", Action([@Set($id, t.id)]))))\`
|
|
1419
|
+
WRONG: \`myBtn = Button("Edit", Action([@Set($id, t.id)]))\` then \`Col("Actions", @Each(rows, "t", myBtn))\` — t is undefined in myBtn.`}function tU(){return`## Query — Live Data Fetching
|
|
1420
|
+
|
|
1421
|
+
Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
|
|
1422
|
+
|
|
1423
|
+
\`\`\`
|
|
1424
|
+
metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
|
|
1425
|
+
\`\`\`
|
|
1426
|
+
|
|
1427
|
+
- First arg: tool name (string)
|
|
1428
|
+
- Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
|
|
1429
|
+
- Third arg: default data (rendered immediately before fetch resolves)
|
|
1430
|
+
- Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
|
|
1431
|
+
- Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
|
|
1432
|
+
- Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
|
|
1433
|
+
- Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
|
|
1434
|
+
- Refresh all queries: create Action with @Run for each query`}function nU(){return`## Mutation — Write Operations
|
|
1435
|
+
|
|
1436
|
+
Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
|
|
1437
|
+
|
|
1438
|
+
\`\`\`
|
|
1439
|
+
result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
|
|
1440
|
+
\`\`\`
|
|
1441
|
+
|
|
1442
|
+
- First arg: tool name (string)
|
|
1443
|
+
- Second arg: arguments object (evaluated with current $binding values at click time)
|
|
1444
|
+
- result.status: "idle" | "loading" | "success" | "error"
|
|
1445
|
+
- result.data: tool response on success
|
|
1446
|
+
- result.error: error message on failure
|
|
1447
|
+
- Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
|
|
1448
|
+
- Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}function rU(e){const t=['- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")','- @OpenUrl("https://...") — Navigate to a URL'];e.bindings&&t.push("- @Set($variable, value) — Set a $variable to a specific value",'- @Reset($var1, $var2, ...) — Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")'),e.toolCalls&&t.unshift("- @Run(queryOrMutationRef) — Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)");const n=[];e.toolCalls&&n.push('Example — mutation + refresh + reset (PREFERRED pattern):\n```\n$binding = "default"\nresult = Mutation("tool_name", {field: $binding})\ndata = Query("tool_name", {}, {rows: []})\nonSubmit = Action([@Run(result), @Run(data), @Reset($binding)])\n```'),n.push('Example — simple nav:\n```\nviewBtn = Button("View", Action([@OpenUrl("https://example.com")]))\n```');const r=['- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work'];return e.toolCalls&&r.push("- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)","- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)"),`## Action — Button Behavior
|
|
1449
|
+
|
|
1450
|
+
Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
|
|
1451
|
+
Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
|
|
1452
|
+
|
|
1453
|
+
Available steps:
|
|
1454
|
+
${t.join(`
|
|
1455
|
+
`)}
|
|
1456
|
+
|
|
1457
|
+
${n.join(`
|
|
1458
|
+
|
|
1459
|
+
`)}
|
|
1460
|
+
|
|
1461
|
+
${r.join(`
|
|
1462
|
+
`)}`}function aU(){return`## Interactive Filters
|
|
1463
|
+
|
|
1464
|
+
To let the user filter data with a dropdown:
|
|
1465
|
+
1. Declare a $variable with a default: \`$dateRange = "14"\`
|
|
1466
|
+
2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
|
|
1467
|
+
3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
|
|
1468
|
+
4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
|
|
1469
|
+
5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
|
|
1470
|
+
|
|
1471
|
+
FILTER WIRING RULE: If a $binding filter is visible in the UI, EVERY relevant Query MUST reference that $binding in its args. Never show a filter dropdown while hardcoding the query args.
|
|
1472
|
+
|
|
1473
|
+
Rules for $variables:
|
|
1474
|
+
- $variables hold simple values (strings or numbers), NOT arrays or objects
|
|
1475
|
+
- $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
|
|
1476
|
+
- Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
|
|
1477
|
+
- **Auto-declare**: You do NOT need to explicitly declare $variables. If you use \`$foo\` without declaring it, the parser auto-creates \`$foo = null\`. You can still declare explicitly to set a default: \`$days = "14"\`
|
|
1478
|
+
|
|
1479
|
+
## Forms
|
|
1480
|
+
|
|
1481
|
+
Simple form — no $bindings needed. Field values are managed internally by the Form via the name prop:
|
|
1482
|
+
\`\`\`
|
|
1483
|
+
contactForm = Form("contact", submitBtn, [nameField, emailField])
|
|
1484
|
+
nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
|
|
1485
|
+
emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
|
|
1486
|
+
submitBtn = Button("Submit")
|
|
1487
|
+
\`\`\`
|
|
1488
|
+
|
|
1489
|
+
Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
|
|
1490
|
+
\`\`\`
|
|
1491
|
+
$role = "engineer"
|
|
1492
|
+
contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
|
|
1493
|
+
nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
|
|
1494
|
+
emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
|
|
1495
|
+
roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
|
|
1496
|
+
submitBtn = Button("Submit")
|
|
1497
|
+
\`\`\`
|
|
1498
|
+
|
|
1499
|
+
For form + mutation patterns (create, refresh, reset), see the Action section example above.
|
|
1500
|
+
|
|
1501
|
+
IMPORTANT: Always add validation rules to form fields used with Mutations. Use OBJECT syntax: {required: true, email: true, minLength: 8}. The renderer shows error messages automatically and blocks submit when validation fails.`}function iU(){return`## Edit Mode
|
|
1502
|
+
|
|
1503
|
+
The runtime merges by statement name: same name = replace, new name = append.
|
|
1504
|
+
Output ONLY statements that changed or are new. Everything else is kept automatically.
|
|
1505
|
+
|
|
1506
|
+
### Delete
|
|
1507
|
+
To remove a component, update the parent to exclude it from its children array. Orphaned statements are automatically garbage-collected.
|
|
1508
|
+
Example — remove chart: \`root = Stack([header, kpiRow, table])\` — chart is no longer in the children list, so it and any statements only it referenced are auto-deleted.
|
|
1509
|
+
|
|
1510
|
+
### Patch size guide
|
|
1511
|
+
- Changing a title or label: 1 statement
|
|
1512
|
+
- Adding a component: 2-3 statements (the new component + parent update)
|
|
1513
|
+
- Removing a component: 1 statement (re-declare parent without the removed child)
|
|
1514
|
+
- Adding a filter + wiring to query: 3-5 statements
|
|
1515
|
+
- Restructuring into tabs: 5-10 statements
|
|
1516
|
+
|
|
1517
|
+
### Rules
|
|
1518
|
+
- Reuse existing statement names exactly — do not rename
|
|
1519
|
+
- Do NOT re-emit unchanged statements — the runtime keeps them
|
|
1520
|
+
- A typical edit patch is 1-10 statements, not 20+
|
|
1521
|
+
- If the existing code already satisfies the request, output only the root statement
|
|
1522
|
+
- NEVER output the entire program as a patch. Only output what actually changes
|
|
1523
|
+
- If you are about to output more than 10 statements, reconsider — most edits need fewer`}function sU(e,t){const n=[`1. \`root = ${e}(...)\` — UI shell appears immediately`];return t.supportsExpressions?(n.push("2. $variable declarations — state ready for bindings"),n.push("3. Query statements — defaults resolve immediately so components render with data"),n.push("4. Component definitions — fill in with data already available"),n.push("5. Data values — leaf content last")):(n.push("2. Component definitions — fill in as they stream"),n.push("3. Data values — leaf content last")),`## Hoisting & Streaming (CRITICAL)
|
|
1524
|
+
|
|
1525
|
+
openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
|
|
1526
|
+
|
|
1527
|
+
During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
|
|
1528
|
+
|
|
1529
|
+
**Recommended statement order for optimal streaming:**
|
|
1530
|
+
${n.join(`
|
|
1531
|
+
`)}
|
|
1532
|
+
|
|
1533
|
+
Always write the root = ${e}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`}function oU(){return`## Inline Mode
|
|
1534
|
+
|
|
1535
|
+
You are in inline mode. You can respond in two ways:
|
|
1536
|
+
|
|
1537
|
+
### 1. Code response (when the user wants to CREATE or CHANGE the UI)
|
|
1538
|
+
Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
|
|
1539
|
+
|
|
1540
|
+
Here's your dashboard:
|
|
1541
|
+
|
|
1542
|
+
\`\`\`openui-lang
|
|
1543
|
+
root = RootComp([header, content])
|
|
1544
|
+
header = SomeHeader("Title")
|
|
1545
|
+
content = SomeContent("Hello world")
|
|
1546
|
+
\`\`\`
|
|
1547
|
+
|
|
1548
|
+
I created a simple layout with a header.
|
|
1549
|
+
|
|
1550
|
+
### 2. Text-only response (when the user asks a QUESTION)
|
|
1551
|
+
If the user asks "what is this?", "explain the chart", "how does this work", etc. — respond with plain text. Do NOT output any openui-lang code. The existing dashboard stays unchanged.
|
|
1552
|
+
|
|
1553
|
+
### Rules
|
|
1554
|
+
- When the user asks for changes, output ONLY the changed/new statements in a fenced block
|
|
1555
|
+
- When the user asks a question, respond with text only — NO code. The dashboard stays unchanged.
|
|
1556
|
+
- The parser extracts code from fences automatically. Text outside fences is shown as chat.`}function lU(){return`## Data Workflow
|
|
1557
|
+
|
|
1558
|
+
When tools are available, follow this workflow:
|
|
1559
|
+
1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
|
|
1560
|
+
2. Use Query() for READ operations (data that should stay live) — NEVER hardcode tool results as literal arrays or objects
|
|
1561
|
+
3. Use Mutation() for WRITE operations (create, update, delete) — triggered by button clicks via Action([@Run(mutationRef)])
|
|
1562
|
+
4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
|
|
1563
|
+
5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations — the runtime evaluates these live on every refresh
|
|
1564
|
+
6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
|
|
1565
|
+
|
|
1566
|
+
WRONG — you called a tool and got data back, but you inlined the results:
|
|
1567
|
+
\`\`\`
|
|
1568
|
+
openCount = 2
|
|
1569
|
+
item1 = SomeComp("first item title")
|
|
1570
|
+
item2 = SomeComp("second item title")
|
|
1571
|
+
list = Stack([item1, item2])
|
|
1572
|
+
chart = SomeChart(["A", "B"], [12, 8])
|
|
1573
|
+
\`\`\`
|
|
1574
|
+
This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
|
|
1575
|
+
|
|
1576
|
+
RIGHT — use Query() for live data, Mutation() for writes, @builtins to derive values:
|
|
1577
|
+
\`\`\`
|
|
1578
|
+
data = Query("tool_name", {}, {rows: []})
|
|
1579
|
+
openCount = @Count(@Filter(data.rows, "field", "==", "value"))
|
|
1580
|
+
list = @Each(data.rows, "item", SomeComp(item.title, item.field))
|
|
1581
|
+
createResult = Mutation("create_tool", {title: $title})
|
|
1582
|
+
submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
|
|
1583
|
+
\`\`\`
|
|
1584
|
+
Everything derives from the Query — when data refreshes, the entire dashboard updates automatically.`}function cU(e,t){const n=[`1. root = ${e}(...) is the FIRST line (for optimal streaming).`,"2. Every referenced name is defined. Every defined name (other than root) is reachable from root."];return t.toolCalls&&n.push("3. Every Query result is referenced by at least one component."),t.bindings&&n.push(`${t.toolCalls?"4":"3"}. Every $binding appears in at least one component or expression.`),`## Important Rules
|
|
1585
|
+
- When asked about data, generate realistic/plausible data
|
|
1586
|
+
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
|
|
1587
|
+
|
|
1588
|
+
## Final Verification
|
|
1589
|
+
Before finishing, walk your output and verify:
|
|
1590
|
+
${n.join(`
|
|
1591
|
+
`)}`}function uU(e){let t="";if(e.inputSchema){const i=e.inputSchema.properties,o=e.inputSchema.required??[];i&&Object.keys(i).length>0&&(t=Object.entries(i).map(([c,d])=>`${c}${o.includes(c)?"":"?"}: ${qd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${qd(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
|
|
1592
|
+
${e.description}`),r}function dU(e){const t=[],n=[],r=[];for(const o of e)typeof o=="string"?n.push(o):r.push(o);t.push("## Available Tools"),t.push(""),t.push("Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose."),t.push("");for(const o of n)t.push(`- ${o}`);for(const o of r)t.push(uU(o));const i=r.filter(o=>o.outputSchema);if(i.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const o of i){const c=wN(o.outputSchema);t.push(`- ${o.name}: \`${JSON.stringify(c)}\``)}}return t.push(""),t.push("CRITICAL: Use ONLY the tools listed above in Query() and Mutation() calls. Do NOT invent or guess tool names. If the user asks for functionality that doesn't match any available tool, use realistic mock data instead of fabricating a tool call."),t.join(`
|
|
1593
|
+
`)}function fU(e,t){var i,o;const n=["## Component Signatures","","Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming."];if(t.usesActionExpression){const c=[t.toolCalls?"@Run":"","@ToAssistant","@OpenUrl",t.bindings?"@Set":"",t.bindings?"@Reset":""].filter(Boolean);n.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${c.join(", ")}).`)}(t.bindings||Object.values(e.components).some(c=>{var d;return(d=c.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const r=c=>c.description?`${c.signature} — ${c.description}`:c.signature;if((i=e.componentGroups)!=null&&i.length){const c=new Set;for(const p of e.componentGroups){n.push("",`### ${p.name}`);for(const h of p.components){if(c.has(h))continue;const g=e.components[h];g&&(c.add(h),n.push(r(g)))}if((o=p.notes)!=null&&o.length)for(const h of p.notes)n.push(h)}const d=Object.keys(e.components).filter(p=>!c.has(p));if(d.length){n.push("","### Other");for(const p of d){const h=e.components[p];n.push(r(h))}}}else{n.push("");for(const[,c]of Object.entries(e.components))n.push(r(c))}return n.join(`
|
|
1594
|
+
`)}function pU(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),r=e.toolCalls??n,i=e.bindings??r,o=r||i,c=Object.values(e.components).some(v=>{var b;return(b=v.signature)==null?void 0:b.includes("ActionExpression")}),d=[];d.push(e.preamble??XP),d.push(""),d.push(JP(t,{supportsExpressions:o,bindings:i})),d.push(""),d.push(fU(e,{toolCalls:r,bindings:i,usesActionExpression:c})),o&&(d.push(""),d.push(eU())),r&&(d.push(""),d.push(tU()),d.push(""),d.push(nU())),c&&(d.push(""),d.push(rU({toolCalls:r,bindings:i}))),r&&i&&(d.push(""),d.push(aU())),r&&(d.push(""),d.push(lU())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(dU(e.tools))),d.push(""),d.push(sU(t,{supportsExpressions:o}));const p=[...e.examples??[],...e.toolExamples??[]];if(p.length){d.push(""),d.push("## Examples"),d.push("");for(const v of p)d.push(v),d.push("")}if(e.editMode&&(d.push(""),d.push(iU())),e.inlineMode&&(d.push(""),d.push(oU())),d.push(cU(t,{toolCalls:r,bindings:i})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const v of e.additionalRules)d.push(`- ${v}`)}return d.join(`
|
|
1595
|
+
`)}const hU=new WeakSet;function Xl(e){return typeof e=="object"&&e!==null&&hU.has(e)}const kN=new WeakMap;function mU(e,t){if(e!=null&&typeof e=="object"&&"_def"in e&&!("_zod"in e))throw new Error(`[OpenUI] Component "${t}" was defined with a Zod 3 schema. OpenUI requires Zod 4 schemas. If you're on zod@3.25+, import from "zod/v4" instead of "zod". See: https://zod.dev/v4/versioning`)}function gU(e){return mU(e.props,e.name),kN.set(e.props,e.name),{...e,ref:e.props}}function Fa(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function Zv(e){var t;return(t=Fa(e))==null?void 0:t.type}function SN(e){const t=Zv(e);return t==="optional"||t==="default"||t==="nullable"}function jc(e){let t=e,n=Fa(t);for(;(n==null?void 0:n.type)==="optional"||(n==null?void 0:n.type)==="default"||(n==null?void 0:n.type)==="nullable";)t=n.innerType,n=Fa(t);return t}function jN(e){return Zv(jc(e))==="array"}function vU(e){const t=Fa(jc(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function yU(e){const t=Fa(jc(e));if((t==null?void 0:t.type)==="enum"){if(Array.isArray(t.values))return t.values;if(t.entries&&typeof t.entries=="object")return Object.keys(t.entries)}}function bU(e,t){try{const n=t.get(e);if(n!=null&&n.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return kN.get(e)}function lk(e){const t=Fa(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function xU(e){const t=Fa(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function uo(e,t){const n=Xl(e),r=wU(jc(e),t);if(r)return n?`$binding<${r}>`:r}function wU(e,t){var d;const n=bU(e,t);if(n)return n;const r=lk(e);if(r){const p=r.map(h=>uo(h,t)).filter(Boolean);if(p.length>0)return p.join(" | ")}if(jN(e)){const p=vU(e);if(!p)return;const h=uo(p,t);return h?lk(jc(p))!==void 0?`(${h})[]`:`${h}[]`:void 0}const i=Zv(e);if(i==="string")return"string";if(i==="number")return"number";if(i==="boolean")return"boolean";if(i==="any")return"any";if(i==="record"){const p=Fa(e);return`Record<${uo(p==null?void 0:p.keyType,t)??"string"}, ${uo(p==null?void 0:p.valueType,t)??"any"}>`}const o=yU(e);if(o)return o.map(p=>`"${p}"`).join(" | ");if(i==="literal"){const p=(d=Fa(e))==null?void 0:d.values;if(Array.isArray(p)&&p.length===1){const h=p[0];return typeof h=="string"?`"${h}"`:String(h)}}const c=xU(e);return c?`{${Object.entries(c).map(([p,h])=>{const g=SN(h)?"?":"",m=uo(h,t);return m?`${p}${g}: ${m}`:`${p}${g}`}).join(", ")}}`:"any"}function kU(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:SN(r),isArray:jN(r),typeAnnotation:uo(r,t)}))}function SU(e,t){return`${e}(${t.map(n=>n.typeAnnotation?n.isOptional?`${n.name}?: ${n.typeAnnotation}`:`${n.name}: ${n.typeAnnotation}`:n.isArray?n.isOptional?`[${n.name}]?`:`[${n.name}]`:n.isOptional?`${n.name}?`:n.name).join(", ")})`}function ck(e,t){const n={};for(const[r,i]of Object.entries(e))n[r]={signature:SU(r,kU(i.props.shape,t)),description:i.description};return n}function jU(e){const t={},n=pN();for(const r of e.components)n.add(r.props,{id:r.name}),t[r.name]=r;if(e.root&&!t[e.root]){const r=Object.keys(t).join(", ");throw new Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${r}`)}return{components:t,componentGroups:e.componentGroups,root:e.root,prompt(r){return pU({root:e.root,components:ck(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:ck(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const r=qt(Object.fromEntries(Object.entries(t).map(([i,o])=>[i,o.props])));return V5(r,{metadata:n})}}}function Pa(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}let ed=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function CU(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}const NU=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function go(e){return!e||typeof e!="object"||Array.isArray(e)?!1:NU.has(e.k)}function EU(e,t){const n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,i])=>n(i));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}let re=(function(e){return e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall",e})({});const AU=1,uk=2,dk=3,ym=4,Dl=5,bm=6,td=7,fk=8,TU=9;function pk(e){let t=0;const n=()=>e[t]??{t:re.EOF},r=()=>{const v=n();return t++,v},i=v=>{n().t===v&&t++};function o(v){switch(v.t){case re.Question:return AU;case re.Or:return uk;case re.And:return dk;case re.EqEq:case re.NotEq:return ym;case re.Greater:case re.Less:case re.GreaterEq:case re.LessEq:return Dl;case re.Plus:case re.Minus:return bm;case re.Star:case re.Slash:case re.Percent:return td;case re.Dot:case re.LBrack:return TU;default:return 0}}function c(v=0){let b=d();for(;o(n())>v;)b=p(b);return b}function d(){var b,k;const v=n();if(v.t===re.Str)return r(),{k:"Str",v:v.v};if(v.t===re.Num)return r(),{k:"Num",v:v.v};if(v.t===re.True)return r(),{k:"Bool",v:!0};if(v.t===re.False)return r(),{k:"Bool",v:!1};if(v.t===re.Null)return r(),{k:"Null"};if(v.t===re.LBrack)return g();if(v.t===re.LBrace)return m();if(v.t===re.StateVar){const j=v.v;return r(),n().t===re.Equals?(r(),{k:"Assign",target:j,value:c(0)}):{k:"StateRef",n:j}}if(v.t===re.Type){const j=v.v;return((b=e[t+1])==null?void 0:b.t)===re.LParen&&(!dc(j)||j==="Action")?h():(r(),{k:"Ref",n:j})}if(v.t===re.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===re.LParen?h():(r(),{k:"Ref",n:v.v});if(v.t===re.Ident)return r(),{k:"Ref",n:v.v};if(v.t===re.Not)return r(),{k:"UnaryOp",op:"!",operand:c(fk)};if(v.t===re.Minus)return r(),{k:"UnaryOp",op:"-",operand:c(fk)};if(v.t===re.LParen){r();const j=c(0);return i(re.RParen),j}return r(),{k:"Null"}}function p(v){const b=n();if(b.t===re.Plus)return r(),{k:"BinOp",op:"+",left:v,right:c(bm)};if(b.t===re.Minus)return r(),{k:"BinOp",op:"-",left:v,right:c(bm)};if(b.t===re.Star)return r(),{k:"BinOp",op:"*",left:v,right:c(td)};if(b.t===re.Slash)return r(),{k:"BinOp",op:"/",left:v,right:c(td)};if(b.t===re.Percent)return r(),{k:"BinOp",op:"%",left:v,right:c(td)};if(b.t===re.EqEq)return r(),{k:"BinOp",op:"==",left:v,right:c(ym)};if(b.t===re.NotEq)return r(),{k:"BinOp",op:"!=",left:v,right:c(ym)};if(b.t===re.Greater)return r(),{k:"BinOp",op:">",left:v,right:c(Dl)};if(b.t===re.Less)return r(),{k:"BinOp",op:"<",left:v,right:c(Dl)};if(b.t===re.GreaterEq)return r(),{k:"BinOp",op:">=",left:v,right:c(Dl)};if(b.t===re.LessEq)return r(),{k:"BinOp",op:"<=",left:v,right:c(Dl)};if(b.t===re.And)return r(),{k:"BinOp",op:"&&",left:v,right:c(dk)};if(b.t===re.Or)return r(),{k:"BinOp",op:"||",left:v,right:c(uk)};if(b.t===re.Question){r();const k=c(0);return i(re.Colon),{k:"Ternary",cond:v,then:k,else:c(0)}}if(b.t===re.Dot){r();const k=n();return{k:"Member",obj:v,field:k.t===re.Ident||k.t===re.Type||k.t===re.Str||k.t===re.Num?(r(),String(k.v)):k.t===re.StateVar?(r(),k.v.replace(/^\$/,"")):(r(),"?")}}if(b.t===re.LBrack){r();const k=c(0);return i(re.RBrack),{k:"Index",obj:v,index:k}}return v}function h(){const v=n().v;r(),i(re.LParen);const b=[];for(;n().t!==re.RParen&&n().t!==re.EOF;)b.push(c(0)),n().t===re.Comma&&r();return i(re.RParen),{k:"Comp",name:v,args:b}}function g(){r();const v=[];for(;n().t!==re.RBrack&&n().t!==re.EOF;)v.push(c(0)),n().t===re.Comma&&r();return i(re.RBrack),{k:"Arr",els:v}}function m(){r();const v=[];for(;n().t!==re.RBrace&&n().t!==re.EOF;){const b=n(),k=b.t===re.Ident||b.t===re.Str||b.t===re.Type||b.t===re.Num?(r(),String(b.v)):b.t===re.StateVar?(r(),b.v.replace(/^\$/,"")):(r(),"?");i(re.Colon),v.push([k,c(0)]),n().t===re.Comma&&r()}return i(re.RBrace),{k:"Obj",entries:v}}return c(0)}function hk(e){const t=[];let n=0;const r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;const i=e[n];if(i===`
|
|
1596
|
+
`){t.push({t:re.Newline}),n++;continue}if(i==="("){t.push({t:re.LParen}),n++;continue}if(i===")"){t.push({t:re.RParen}),n++;continue}if(i==="["){t.push({t:re.LBrack}),n++;continue}if(i==="]"){t.push({t:re.RBrack}),n++;continue}if(i==="{"){t.push({t:re.LBrace}),n++;continue}if(i==="}"){t.push({t:re.RBrace}),n++;continue}if(i===","){t.push({t:re.Comma}),n++;continue}if(i===":"){t.push({t:re.Colon}),n++;continue}if(i==="="){n+1<r&&e[n+1]==="="?(t.push({t:re.EqEq}),n+=2):(t.push({t:re.Equals}),n++);continue}if(i==="!"){n+1<r&&e[n+1]==="="?(t.push({t:re.NotEq}),n+=2):(t.push({t:re.Not}),n++);continue}if(i===">"){n+1<r&&e[n+1]==="="?(t.push({t:re.GreaterEq}),n+=2):(t.push({t:re.Greater}),n++);continue}if(i==="<"){n+1<r&&e[n+1]==="="?(t.push({t:re.LessEq}),n+=2):(t.push({t:re.Less}),n++);continue}if(i==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:re.And}),n+=2):(t.push({t:re.And}),n++);continue}if(i==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:re.Or}),n+=2):(t.push({t:re.Or}),n++);continue}if(i==="."){t.push({t:re.Dot}),n++;continue}if(i==="?"){t.push({t:re.Question}),n++;continue}if(i==="+"){t.push({t:re.Plus}),n++;continue}if(i==="*"){t.push({t:re.Star}),n++;continue}if(i==="/"){t.push({t:re.Slash}),n++;continue}if(i==="%"){t.push({t:re.Percent}),n++;continue}if(i==='"'){const d=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;const h=e.slice(d,n);try{const g=p?h:h+'"';t.push({t:re.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:re.Str,v:g})}continue}if(i==="'"){n++;let d="";for(;n<r;)if(e[n]==="\\"){if(n++,n<r){const p=e[n];p==="'"?d+="'":p==="\\"?d+="\\":p==="n"?d+=`
|
|
1597
|
+
`:p==="t"?d+=" ":d+=p,n++}}else if(e[n]==="'"){n++;break}else d+=e[n],n++;t.push({t:re.Str,v:d});continue}if(i==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===re.Num||d.t===re.Str||d.t===re.Ident||d.t===re.Type||d.t===re.RParen||d.t===re.RBrack||d.t===re.True||d.t===re.False||d.t===re.Null||d.t===re.StateVar||d.t===re.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:re.Minus}),n++;continue}}const o=i>="0"&&i<="9",c=i==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(o||c){const d=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:re.Num,v:+e.slice(d,n)});continue}if(i==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){const d=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:re.StateVar,v:e.slice(d,n)});continue}if(i>="a"&&i<="z"||i>="A"&&i<="Z"||i==="_"){const d=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;const p=e.slice(d,n);if(p==="true"){t.push({t:re.True});continue}if(p==="false"){t.push({t:re.False});continue}if(p==="null"){t.push({t:re.Null});continue}const h=i>="A"&&i<="Z"?re.Type:re.Ident;t.push({t:h,v:p});continue}if(i==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;const d=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:re.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:re.EOF}),t}function xd(e){return e==null||typeof e!="object"?!1:go(e)?!0:Array.isArray(e)?e.some(xd):Pa(e)?Object.values(e.props).some(xd):Object.values(e).some(xd)}function CN(e,t,n){var o;if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;const r=t.syms.get(e);if((o=t.unreached)==null||o.delete(e),r.k==="Comp"&&Fd(r.name))return{k:"RuntimeRef",n:e,refType:r.name===Ri.Mutation?"mutation":"query"};t.visited.add(e);const i=t.currentStatementId;t.currentStatementId=e;try{const c=n==="value"?vo(r,t):xg(r,t);return n==="value"&&Pa(c)&&(c.statementId=e),c}finally{t.currentStatementId=i,t.visited.delete(e)}}function NN(e,t,n){if(!Wv.has(e.name)||e.args.length<3)return null;const r=e.args[1],i=r.k==="Ref"?r.n:r.k==="Str"?r.v:null;if(!i)return null;const o=new Set(n);o.add(i);const c=e.args.map((d,p)=>p===1?d:Bn(d,t,o));return{...e,args:c}}function Bn(e,t,n){var r;switch(e.k){case"Ref":return n.has(e.n)?e:CN(e.n,t,"expr");case"Ph":return e;case"Comp":{const i=NN(e,t,n);if(i)return i;const o=e.args.map(d=>Bn(d,t,n));if(dc(e.name)||Fd(e.name))return{...e,args:o};const c=(r=t.cat)==null?void 0:r.get(e.name);if(c){const d={};for(let p=0;p<c.params.length&&p<o.length;p++)d[c.params[p].name]=o[p];return{...e,args:o,mappedProps:d}}return t.errors.push({code:"unknown-component",component:e.name,path:"",message:`Unknown component "${e.name}" — not found in catalog or builtins`,statementId:t.currentStatementId}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(i=>Bn(i,t,n))};case"Obj":return{...e,entries:e.entries.map(([i,o])=>[i,Bn(o,t,n)])};case"BinOp":return{...e,left:Bn(e.left,t,n),right:Bn(e.right,t,n)};case"UnaryOp":return{...e,operand:Bn(e.operand,t,n)};case"Ternary":return{...e,cond:Bn(e.cond,t,n),then:Bn(e.then,t,n),else:Bn(e.else,t,n)};case"Member":return{...e,obj:Bn(e.obj,t,n)};case"Index":return{...e,obj:Bn(e.obj,t,n),index:Bn(e.index,t,n)};case"Assign":return{...e,value:Bn(e.value,t,n)};default:return e}}function xg(e,t){return Bn(e,t,new Set)}function vo(e,t){var n;switch(e.k){case"Ref":return CN(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{const r=[];for(const i of e.els){if(i.k==="Ph")continue;const o=vo(i,t);o===null&&(i.k==="Comp"||i.k==="Ref")||r.push(o)}return r}case"Obj":{const r={};for(const[i,o]of e.entries)r[i]=vo(o,t);return r}case"Comp":{const{name:r,args:i}=e;if(dc(r)){const p=NN(e,t,new Set);return p||{...e,args:i.map(h=>xg(h,t))}}if(Fd(r))return t.errors.push({code:"inline-reserved",component:r,path:"",message:`${r}() must be declared as a top-level statement, not used inline as a value`,statementId:t.currentStatementId}),null;const o=(n=t.cat)==null?void 0:n.get(r),c={};if(o){for(let h=0;h<o.params.length&&h<i.length;h++)c[o.params[h].name]=vo(i[h],t);if(i.length>o.params.length){const h=i.length-o.params.length;t.errors.push({code:"excess-args",component:r,path:"",message:`${r} takes ${o.params.length} arg(s), got ${i.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const p=o.params.filter(h=>h.required&&(!(h.name in c)||c[h.name]===null));if(p.length){const h=p.filter(g=>g.defaultValue!==void 0?(c[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in c;t.errors.push({code:m?"null-required":"missing-required",component:r,path:`/${g.name}`,message:m?`required field "${g.name}" cannot be null`:`missing required field "${g.name}"`,statementId:t.currentStatementId})}return null}}}else if(!dc(r)&&!Fd(r))return t.errors.push({code:"unknown-component",component:r,path:"",message:`Unknown component "${r}" — not found in catalog or builtins`,statementId:t.currentStatementId}),null;const d=Object.values(c).some(p=>xd(p));return{type:"element",typeName:r,props:c,partial:t.partial,hasDynamicProps:d}}default:return CU(e)?xg(e,t):e}}function RU(e){const t=[];let n=!1,r=!1;for(let o=0;o<e.length;o++){const c=e[o];if(r){r=!1;continue}if(c==="\\"&&n){r=!0;continue}if(n){c===n&&(n=!1);continue}if(c==='"'||c==="'"){n=c;continue}c==="("||c==="["||c==="{"?t.push(c):(c===")"&&t[t.length-1]==="("||c==="]"&&t[t.length-1]==="["||c==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let i=e;n&&(r&&(i+="\\"),i+=n);for(let o=t.length-1;o>=0;o--)i+=t[o]==="("?")":t[o]==="["?"]":"}";return{text:i,wasIncomplete:!0}}function mk(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===re.Newline;)n++;if(n>=e.length||e[n].t===re.EOF)break;const r=e[n];if(r.t!==re.Ident&&r.t!==re.Type&&r.t!==re.StateVar){for(;n<e.length&&e[n].t!==re.Newline&&e[n].t!==re.EOF;)n++;continue}const i=r.v,o=r.t;if(n++,n>=e.length||e[n].t!==re.Equals){for(;n<e.length&&e[n].t!==re.Newline&&e[n].t!==re.EOF;)n++;continue}n++;const c=[];let d=0,p=0;for(;n<e.length&&e[n].t!==re.EOF;){const h=e[n].t;if(h===re.Newline&&d<=0&&p<=0){let g=n+1;for(;g<e.length&&e[g].t===re.Newline;)g++;const m=g<e.length?e[g].t:re.EOF;if(m===re.Question||m===re.Colon&&p>0){n++;continue}break}if(h===re.Newline){n++;continue}h===re.LParen||h===re.LBrack||h===re.LBrace?d++:(h===re.RParen||h===re.RBrack||h===re.RBrace)&&d>0?d--:h===re.Question&&d===0?p++:h===re.Colon&&d===0&&p>0&&p--,c.push(e[n++])}c.length&&t.push({id:i,idTokenType:o,tokens:c})}return t}function wd(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function EN(e){if(!go(e))return[];const t=new Set;return EU(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function gk(e,t){if(t.k==="Comp"&&t.name===Ri.Query){const n=EN(t.args[1]);return{kind:"query",id:e.id,call:{callee:Ri.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Ri.Mutation?{kind:"mutation",id:e.id,call:{callee:Ri.Mutation,args:t.args},expr:t}:e.idTokenType===re.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function _U(e,t){const n={},r=[],i=[];for(const o of e)switch(o.kind){case"state":n[o.id]=vo(o.init,t);break;case"query":r.push({statementId:o.id,toolAST:o.call.args[0]??null,argsAST:o.call.args[1]??null,defaultsAST:o.call.args[2]??null,refreshAST:o.call.args[3]??null,deps:o.deps,complete:!0});break;case"mutation":i.push({statementId:o.id,toolAST:o.call.args[0]??null,argsAST:o.call.args[1]??null});break}for(const o of e){const c=o.kind==="state"?[o.init]:o.kind==="value"?[o.expr]:o.kind==="query"||o.kind==="mutation"?o.call.args:[];for(const d of c)for(const p of EN(d))p in n||(n[p]=null)}return{stateDeclarations:n,queryStatements:r,mutationStatements:i}}const vk="root";function yk(e){return e.kind==="value"&&e.expr.k==="Comp"&&!dc(e.expr.name)&&e.expr.name!==Ri.Query&&e.expr.name!==Ri.Mutation}function OU(e,t,n,r){var o;if(e.has(vk))return vk;if(r&&e.has(r))return r;const i=r?t.find(c=>yk(c)&&c.expr.name===r):void 0;return i?i.id:((o=t.find(yk))==null?void 0:o.id)??n}function nd(e,t,n,r,i,o,c){const d=OU(e,t,n,c);if(!e.has(d))return wd(r);const p=new Map;for(const[N,A]of e)p.set(N,A.kind==="state"?A.init:A.expr);const h=[],g=[],m=new Set;for(const[N,A]of e)N!==d&&(A.kind==="state"||A.kind==="query"||A.kind==="mutation"||m.add(N));const v={syms:p,cat:o,errors:g,unres:h,visited:new Set,partial:r,currentStatementId:d,unreached:m},b=vo(p.get(d),v),k=Pa(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:C,mutationStatements:S}=_U(t,v);return{root:k,meta:{incomplete:r,unresolved:h,orphaned:[...m],statementCount:i,errors:g},stateDeclarations:j,queryStatements:C,mutationStatements:S}}function MU(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("```",n);if(r===-1)break;let i=r+3;for(;i<e.length&&e[i]!==`
|
|
1598
|
+
`;)i++;if(i>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}i++;let o=!1,c=-1,d=i;for(;d<e.length;){const p=e[d];if(o){if(p==="\\"&&d+1<e.length){d+=2;continue}p==='"'&&(o=!1),d++;continue}if(p==='"'){o=!0,d++;continue}if(p==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){c=d;break}d++}c!==-1?(t.push(e.slice(i,c)),n=c+3):(t.push(e.slice(i)),n=e.length)}if(t.length>0)return t.join(`
|
|
1599
|
+
`);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
|
|
1600
|
+
`;)r++;const i=r<e.length?r+1:3,o=e.slice(i),c=o.lastIndexOf("```");return c!==-1?o.slice(0,c):o}return e}function bk(e){return e.split(`
|
|
1601
|
+
`).map(t=>{let n=!1;for(let r=0;r<t.length;r++){const i=t[r];if(n){if(i==="\\"&&r+1<t.length){r++;continue}i===n&&(n=!1);continue}if(i==='"'||i==="'"){n=i;continue}if(i==="/"&&t[r+1]==="/"||i==="#")return t.substring(0,r).trimEnd()}return t}).join(`
|
|
1602
|
+
`)}function LU(e,t){let n="",r=0;const i=new Map;let o=0,c="";function d(m){const v=bk(m).trim();if(!(!v||/^```/.test(v)))for(const b of mk(hk(v))){const k=gk(b,pk(b.tokens));i.set(b.id,k),o++,c||(c=b.id)}}function p(){let m=0,v=0,b=!1,k=!1,j=r;for(let C=r;C<n.length;C++){const S=n[C];if(k){k=!1;continue}if(S==="\\"&&b){k=!0;continue}if(b){S===b&&(b=!1);continue}if(S==='"'||S==="'"){b=S;continue}if(S==="("||S==="["||S==="{")m++;else if(S===")"||S==="]"||S==="}")m=Math.max(0,m-1);else if(S==="?"&&m===0)v++;else if(S===":"&&m===0&&v>0)v--;else if(S===`
|
|
1603
|
+
`&&m<=0&&v<=0){let N=C+1;for(;N<n.length&&(n[N]===" "||n[N]===" "||n[N]==="\r"||n[N]===`
|
|
1604
|
+
`);)N++;if(N<n.length&&(n[N]==="?"||n[N]===":"&&v>0))continue;const A=n.slice(j,C).trim();A&&d(A),j=C+1,r=C+1}}return j}function h(){const m=p(),v=n.slice(m).trim();if(!v)return o===0?wd():nd(i,[...i.values()],c,!1,o,e,t);const b=bk(MU(v)).trim();if(!b)return o===0?wd():nd(i,[...i.values()],c,!1,o,e,t);const{text:k,wasIncomplete:j}=RU(b),C=mk(hk(k));if(!C.length)return o===0?wd(j):nd(i,[...i.values()],c,j,o,e,t);const S=new Map(i);for(const N of C){if(i.has(N.id))continue;const A=gk(N,pk(N.tokens));S.set(N.id,A)}return nd(S,[...S.values()],c||C[0].id,j,o+C.length,e,t)}function g(){n="",r=0,i.clear(),o=0,c=""}return{push(m){return n+=m,h()},set(m){(m.length<n.length||!m.startsWith(n))&&g();const v=m.slice(n.length);return v&&(n+=v),h()},getResult:h}}function IU(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function DU(e){const t=new Map,n=e.$defs??{};for(const[r,i]of Object.entries(n)){const o=i.properties??{},c=i.required??[],d=Object.keys(o).map(p=>({name:p,required:c.includes(p),defaultValue:IU(o[p])}));t.set(r,{params:d})}return t}function zU(e,t){return LU(DU(e),t)}function $U(e,t){if(!(t!=null&&t.properties))return;const n=new Set(t.required??[]);return`Signature: ${e}(${Object.keys(t.properties).map(r=>n.has(r)?`${r}*`:r).join(", ")}) — * marks required`}function PU(e,t,n){return e.map(r=>{var o;const i={source:"parser",code:r.code,message:r.message,component:r.component,path:r.path||void 0,statementId:r.statementId};return r.code==="unknown-component"&&n.length?i.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?i.hint=$U(r.component,(o=t.$defs)==null?void 0:o[r.component]):r.code==="inline-reserved"&&(i.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),i})}function UU(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function St(e,t,n){var r,i,o;switch(e.k){case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"StateRef":return((r=t.extraScope)==null?void 0:r[e.n])??t.getState(e.n);case"Ref":case"RuntimeRef":return t.resolveRef(e.n);case"Arr":return e.els.map(c=>St(c,t));case"Obj":return Object.fromEntries(e.entries.map(([c,d])=>[c,St(d,t)]));case"Comp":{if(Wv.has(e.name))return FU(e.name,e.args,t,n);const c=Vv[e.name];if(c){const d=e.args.map(p=>St(p,t));return c.fn(...d)}if(xN.has(e.name))return BU(e.name,e.args,t);if(e.mappedProps){const d=n==null?void 0:n.library.components[e.name],p={};for(const[g,m]of Object.entries(e.mappedProps)){const v=(o=(i=d==null?void 0:d.props)==null?void 0:i.shape)==null?void 0:o[g];m.k==="StateRef"&&v&&Xl(v)?p[g]={__reactive:"assign",target:m.n,expr:{k:"StateRef",n:"$value"}}:m.k==="StateRef"?p[g]=n?t.getState(m.n):m:p[g]=St(m,t,n)}const h={type:"element",typeName:e.name,props:p,partial:!1,hasDynamicProps:!0};if(n)for(const[g,m]of Object.entries(p))Pa(m)?p[g]=Hd(m,t,n):Array.isArray(m)&&(p[g]=m.map(v=>Pa(v)?Hd(v,t,n):v));return h}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const p=St(e.left,t);return p&&St(e.right,t)}if(e.op==="||"){const p=St(e.left,t);return p||St(e.right,t)}const c=St(e.left,t),d=St(e.right,t);switch(e.op){case"+":return typeof c=="string"||typeof d=="string"?String(c??"")+String(d??""):et(c)+et(d);case"-":return et(c)-et(d);case"*":return et(c)*et(d);case"/":return et(d)===0?0:et(c)/et(d);case"%":return et(d)===0?0:et(c)%et(d);case"==":return c==d;case"!=":return c!=d;case">":return et(c)>et(d);case"<":return et(c)<et(d);case">=":return et(c)>=et(d);case"<=":return et(c)<=et(d);default:return null}}case"UnaryOp":return e.op==="!"?!St(e.operand,t):e.op==="-"?-et(St(e.operand,t)):null;case"Ternary":return St(e.cond,t)?St(e.then,t):St(e.else,t);case"Member":{const c=St(e.obj,t);return c==null?null:Array.isArray(c)?e.field==="length"?c.length:c.map(d=>(d==null?void 0:d[e.field])??null):c[e.field]}case"Index":{const c=St(e.obj,t),d=St(e.index,t);return c==null||d==null?null:Array.isArray(c)?c[et(d)]:c[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function Hd(e,t,n){var o,c;if(e.hasDynamicProps===!1)return e;const r=n.library.components[e.typeName],i={};for(const[d,p]of Object.entries(e.props)){const h=(c=(o=r==null?void 0:r.props)==null?void 0:o.shape)==null?void 0:c[d];i[d]=AN(p,t,n,h)}return{...e,props:i}}function AN(e,t,n,r){return TN(e,t,n,r,{recurseElement:i=>Hd(i,t,n),recurse:(i,o)=>AN(i,t,n,o)})}function wg(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(wg)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,wg(n)])}:{k:"Null"}}function BU(e,t,n){switch(e){case"Action":{const r=t.length>0?St(t[0],n):[];return{steps:(Array.isArray(r)?r:[]).filter(i=>i!=null&&typeof i=="object"&&"type"in i)}}case"Run":{if(t.length===0)return null;const r=t[0];return r.k==="RuntimeRef"?{type:Br.Run,statementId:r.n,refType:r.refType}:null}case"ToAssistant":{const r=t.length>0?String(St(t[0],n)??""):"",i=t.length>1?String(St(t[1],n)??""):void 0;return{type:Br.ToAssistant,message:r,context:i}}case"OpenUrl":{const r=t.length>0?String(St(t[0],n)??""):"";return{type:Br.OpenUrl,url:r}}case"Set":{if(t.length<2)return null;const r=t[0];return r.k!=="StateRef"?null:{type:Br.Set,target:r.n,valueAST:t[1]}}case"Reset":{const r=t.filter(i=>i.k==="StateRef").map(i=>i.n);return r.length===0?null:{type:Br.Reset,targets:r}}default:return null}}function Un(e,t,n){switch(e.k){case"Ref":return e.n===t?wg(n):e;case"Member":if(go(e.obj)){const r=Un(e.obj,t,n);if(r.k==="Obj"){const i=r.entries.find(([o])=>o===e.field);if(i)return i[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:go(e.obj)?Un(e.obj,t,n):e.obj,index:go(e.index)?Un(e.index,t,n):e.index};case"BinOp":return{...e,left:Un(e.left,t,n),right:Un(e.right,t,n)};case"UnaryOp":return{...e,operand:Un(e.operand,t,n)};case"Ternary":return{...e,cond:Un(e.cond,t,n),then:Un(e.then,t,n),else:Un(e.else,t,n)};case"Arr":return{...e,els:e.els.map(r=>Un(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,i])=>[r,Un(i,t,n)])};case"Comp":{const r={...e,args:e.args.map(i=>Un(i,t,n))};if(e.mappedProps){const i={};for(const[o,c]of Object.entries(e.mappedProps))i[o]=Un(c,t,n);r.mappedProps=i}return r}case"Assign":return{...e,value:Un(e.value,t,n)};default:return e}}function FU(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const i=St(t[0],n);if(!Array.isArray(i))return[];const o=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!o)return[];const c=t[2];return i.map((d,p)=>{const h=Un(c,o,d),g={...n,resolveRef:v=>v===o?d:n.resolveRef(v)},m=St(h,g,r);return r&&Pa(m)?Hd(m,g,r):m})}return null}function TN(e,t,n,r,i){if(e==null||typeof e!="object")return e;if(go(e)){if(e.k==="StateRef"&&r&&Xl(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=St(e,t,n);return Pa(d)?i.recurseElement(d):Array.isArray(d)?d.map(p=>Pa(p)?i.recurseElement(p):p):UU(d)&&!(r&&Xl(r))?t.getState(d.target)??null:d}if(typeof e=="string"&&r&&Xl(r))return e;if(Array.isArray(e))return e.map(d=>i.recurse(d,r));if(Pa(e))return i.recurseElement(e);const o=e;if("steps"in o&&Array.isArray(o.steps)||"type"in o&&"valueAST"in o)return e;let c=!1;for(const d of Object.values(o))if(typeof d=="object"&&d!==null){c=!0;break}if(c){const d={};for(const[p,h]of Object.entries(o))d[p]=i.recurse(h,r);return d}return e}function RN(e,t){var o,c,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},r=t.library.components[e.typeName],i={};for(const[p,h]of Object.entries(e.props)){const g=(c=(o=r==null?void 0:r.props)==null?void 0:o.shape)==null?void 0:c[p];try{i[p]=_N(h,t,n,g)}catch(m){i[p]=h;const v=m instanceof Error?m.message:String(m);(d=t.errors)==null||d.push({source:"runtime",code:"runtime-error",component:e.typeName,statementId:e.statementId,message:`Evaluating prop "${p}" on ${e.typeName} failed: ${v}`,hint:`Check the expression used for prop "${p}"`})}}return{...e,props:i}}function _N(e,t,n,r){return TN(e,t.ctx,n,r,{recurseElement:i=>RN(i,t),recurse:(i,o)=>_N(i,t,n,o)})}var kg=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);rt(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function qU(e){var n,r;if(e.isError){const i=(n=e.content)==null?void 0:n.filter(o=>o.type==="text").map(o=>o.text).join(`
|
|
1605
|
+
`);throw new kg(i||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(r=e.content)==null?void 0:r.filter(i=>i.type==="text").map(i=>i.text??"");if(t!=null&&t.length){const i=t.join("");try{return JSON.parse(i)}catch{return i}}return null}var Sg=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);rt(this,"toolName");rt(this,"availableTools");this.name="ToolNotFoundError",this.toolName=t,this.availableTools=n}};function xk(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const r={};for(const i of Object.keys(n).sort())r[i]=n[i];return r}if(n===void 0)return"__undefined__";if(typeof n=="number"){if(Number.isNaN(n))return"__NaN__";if(n===1/0)return"__Inf__";if(n===-1/0)return"__-Inf__"}return n})}function HU(e,t,n){const r=n!=null?"::"+xk(n):"";return e+"::"+xk(t)+r}function GU(e){const t=new Map,n=new Map,r=new Map,i=new Set;let o={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},c=JSON.stringify(o),d=!1,p=0;function h(){const _={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[R,z]of t){const F=r.get(z.cacheKey);if(F&&F.data!==void 0)_[R]=F.data;else if(z.prevCacheKey){const Y=r.get(z.prevCacheKey);Y&&Y.data!==void 0?_[R]=Y.data:_[R]=z.defaults}else _[R]=z.defaults;z.loading&&(_.__openui_loading.push(R),z.everFetched&&_.__openui_refetching.push(R)),z.error&&_.__openui_errors.push(z.error)}for(const[R,z]of n)_[R]=z.result,z.error&&_.__openui_errors.push(z.error);try{const R=JSON.stringify(_);if(R===c)return!1;o=_,c=R}catch{o=_,c=""}return!0}function g(){for(const _ of[...i])_()}async function m(_,R){if(!e)return;const z=t.get(R);if(!z)return;const F=_,Y=z.toolName,D=z.args;let q=r.get(F);q?q.inFlight=!0:(q={data:void 0,inFlight:!0},r.set(F,q)),z.loading=!0,h(),g();try{const G=await e.callTool(Y,D??{});if(d)return;const W=t.get(R);if(!W||W.cacheKey!==F){q.inFlight=!1;return}if(q.data=G??null,W.everFetched=!0,W.error=void 0,W.prevCacheKey&&W.prevCacheKey!==F){const Q=W.prevCacheKey;W.prevCacheKey=void 0,v(Q)}}catch(G){const W=t.get(R);W&&W.cacheKey===F&&(G instanceof Sg?W.error={source:"query",code:"tool-not-found",message:`Query tool "${Y}" not found`,statementId:R,component:"Query",toolName:Y,hint:G.availableTools.length?`Available tools: ${G.availableTools.join(", ")}`:void 0}:G instanceof kg?W.error={source:"query",code:"mcp-error",message:`Query "${Y}" returned an error: ${G.toolErrorText}`,statementId:R,component:"Query",toolName:Y}:W.error={source:"query",code:"tool-error",message:`Query "${Y}" failed: ${G instanceof Error?G.message:String(G)}`,statementId:R,component:"Query",toolName:Y}),console.error(`Query "${Y}" failed:`,G)}finally{q.inFlight=!1;const G=t.get(R);G&&G.cacheKey===F?(G.loading=!1,h()&&g(),G.needsRefetch&&(G.needsRefetch=!1,m(G.cacheKey,R))):h()&&g()}}function v(_){for(const R of t.values())if(R.cacheKey===_||R.prevCacheKey===_)return;r.delete(_)}function b(_){if(d)return;const R=new Set(_.map(z=>z.statementId));for(const[z,F]of t)R.has(z)||(F.timer&&clearInterval(F.timer),t.delete(z),v(F.cacheKey),F.prevCacheKey&&v(F.prevCacheKey));for(const z of _){if(!z.complete)continue;const F=HU(z.toolName,z.args,z.deps),Y=t.get(z.statementId);Y?(Y.cacheKey!==F&&(Y.prevCacheKey=Y.cacheKey),Y.toolName=z.toolName,Y.args=z.args,Y.defaults=z.defaults,Y.cacheKey=F):t.set(z.statementId,{toolName:z.toolName,args:z.args,defaults:z.defaults,cacheKey:F,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const D=t.get(z.statementId),q=r.get(F),G=q&&q.data!==void 0&&!q.inFlight;e&&!G&&!(q!=null&&q.inFlight)&&m(F,z.statementId);const W=z.refreshInterval??0;W!==D.refreshInterval&&(D.timer&&(clearInterval(D.timer),D.timer=void 0),W>0&&(D.timer=setInterval(()=>{var Q;d||!e||(Q=r.get(D.cacheKey))!=null&&Q.inFlight||m(D.cacheKey,z.statementId)},W*1e3)),D.refreshInterval=W)}h()&&g()}function k(_){const R=t.get(_);if(!R)return null;const z=r.get(R.cacheKey);if(z&&z.data!==void 0)return z.data;if(R.prevCacheKey){const F=r.get(R.prevCacheKey);if(F&&F.data!==void 0)return F.data}return R.defaults}function j(_){var R;return((R=t.get(_))==null?void 0:R.loading)??!1}function C(){for(const _ of t.values())if(_.loading)return!0;return!1}function S(_){var z;if(d||!e)return;const R=_!=null&&_.length?_.filter(F=>t.has(F)):[...t.keys()];for(const F of R){const Y=t.get(F);Y&&((z=r.get(Y.cacheKey))!=null&&z.inFlight?Y.needsRefetch=!0:m(Y.cacheKey,F))}}function N(_){const R=new Set(_.map(z=>z.statementId));for(const z of n.keys())R.has(z)||n.delete(z);for(const z of _){const F=n.get(z.statementId);F?F.toolName!==z.toolName&&(F.toolName=z.toolName,F.result={status:"idle",data:null,error:null},F.error=void 0):n.set(z.statementId,{toolName:z.toolName,result:{status:"idle"}})}h()&&g()}async function A(_,R,z){if(d||!e)return!1;const F=n.get(_);if(!F||F.result.status==="loading")return!1;const Y=p;F.result={status:"loading"},h(),g();let D=!1;try{const q=await e.callTool(F.toolName,R);if(d||Y!==p)return!1;F.result={status:"success",data:q},F.error=void 0,D=!0}catch(q){if(d||Y!==p)return!1;const G=q instanceof Error?q.message:String(q);F.result={status:"error",error:G},q instanceof Sg?F.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${F.toolName}" not found`,statementId:_,component:"Mutation",toolName:F.toolName,hint:q.availableTools.length?`Available tools: ${q.availableTools.join(", ")}`:void 0}:q instanceof kg?F.error={source:"mutation",code:"mcp-error",message:`Mutation "${F.toolName}" returned an error: ${q.toolErrorText}`,statementId:_,component:"Mutation",toolName:F.toolName}:F.error={source:"mutation",code:"tool-error",message:`Mutation "${F.toolName}" failed: ${G}`,statementId:_,component:"Mutation",toolName:F.toolName}}return h(),g(),D&&(z!=null&&z.length)&&S(z),D}function O(_){var R;return((R=n.get(_))==null?void 0:R.result)??null}function M(_){return i.add(_),()=>i.delete(_)}function T(){return o}function L(){d=!1}function B(){d=!0,p++,i.clear();for(const _ of t.values())_.timer&&(clearInterval(_.timer),_.timer=void 0),_.loading=!1,_.needsRefetch=!1;n.clear()}return{evaluateQueries:b,getResult:k,isLoading:j,isAnyLoading:C,invalidate:S,registerMutations:N,fireMutation:A,getMutationResult:O,subscribe:M,getSnapshot:T,activate:L,dispose:B}}function VU(){const e=new Map,t=new Set;let n={};function r(){const m=[...t];for(const v of m)v()}function i(){n=Object.fromEntries(e)}function o(m){return e.get(m)}function c(m,v){const b=e.get(m);if(!Object.is(b,v)){if(v&&b&&typeof v=="object"&&typeof b=="object"&&!Array.isArray(v)&&!Array.isArray(b)){const k=Object.keys(v),j=Object.keys(b);if(k.length===j.length&&k.every(C=>Object.is(v[C],b[C])))return}e.set(m,v),i(),r()}}function d(m){return t.add(m),()=>{t.delete(m)}}function p(){return n}function h(m,v){for(const b of Object.keys(v))e.set(b,v[b]);for(const b of Object.keys(m))e.has(b)||e.set(b,m[b]);i(),r()}function g(){e.clear(),t.clear(),n={}}return{get:o,set:c,subscribe:d,getSnapshot:p,initialize:h,dispose:g}}function Dr(e){return gU(e)}function WU(e){return jU(e)}const ON=w.createContext(null);function MN(){const e=w.useContext(ON);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function ZU(){return MN().renderNode}w.createContext(void 0);function xm(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function QU({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:i,initialState:o,toolProvider:c,onError:d},p){const h=w.useMemo(()=>zU(t.toJSONSchema(),t.root),[t]),g=w.useRef(null),m=w.useMemo(()=>{if(g.current=null,!e)return null;try{return h.set(e)}catch(W){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${W instanceof Error?W.message:String(W)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),v=w.useMemo(()=>VU(),[]),b=w.useMemo(()=>GU(c??null),[c]);w.useEffect(()=>(b.activate(),()=>b.dispose()),[b]);const k=w.useRef(Symbol());w.useEffect(()=>{if(!(m!=null&&m.stateDeclarations)&&!o)return;const W=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(o)}`;if(k.current===W)return;k.current=W;const Q={};if(o)for(const[H,$]of Object.entries(o))H.startsWith("$")?Q[H]=$:v.set(H,$);v.initialize((m==null?void 0:m.stateDeclarations)??{},Q)},[m==null?void 0:m.stateDeclarations,v,o]);const j=w.useSyncExternalStore(v.subscribe,v.getSnapshot,v.getSnapshot),C=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:W=>xm(v.get(W)),resolveRef:W=>{const Q=b.getMutationResult(W);return Q||b.getResult(W)}}),[v,b]);w.useEffect(()=>{if(n)return;const W=((m==null?void 0:m.queryStatements)??[]).map(Q=>{const H={};if(Q.deps)for(const $ of Q.deps)H[$]=j[$];return{statementId:Q.statementId,toolName:Q.toolAST?St(Q.toolAST,S):"",args:Q.argsAST?St(Q.argsAST,S):null,defaults:Q.defaultsAST?St(Q.defaultsAST,S):null,refreshInterval:Q.refreshAST?St(Q.refreshAST,S):void 0,deps:Object.keys(H).length>0?H:void 0,complete:Q.complete}});b.evaluateQueries(W)},[n,m==null?void 0:m.queryStatements,S,b,j]),w.useEffect(()=>{if(n)return;const W=((m==null?void 0:m.mutationStatements)??[]).map(Q=>({statementId:Q.statementId,toolName:Q.toolAST?St(Q.toolAST,S):""}));b.registerMutations(W)},[n,m==null?void 0:m.mutationStatements,S,b]);const N=w.useRef({onAction:r,onStateUpdate:i,onError:d});N.current={onAction:r,onStateUpdate:i,onError:d};const A=w.useRef(m);A.current=m;const O=w.useRef(null);w.useEffect(()=>(O.current=v.getSnapshot(),v.subscribe(()=>{var Q,H;const W=v.getSnapshot();W!==O.current&&(O.current=null,(H=(Q=N.current).onStateUpdate)==null||H.call(Q,W))})),[v]);const M=w.useCallback((W,Q)=>{if(!W)return xm(v.get(Q));const H=v.get(W);if(!(!H||typeof H!="object"||Array.isArray(H)))return xm(H[Q])},[v]),T=w.useCallback((W,Q,H,$,U=!0)=>{var I,ae;const Z={value:$,componentType:Q};if(!W)v.set(H,Z);else{const le=v.get(W),oe=le&&typeof le=="object"&&!Array.isArray(le)?le:{};v.set(W,{...oe,[H]:Z})}U&&((ae=(I=N.current).onStateUpdate)==null||ae.call(I,v.getSnapshot()))},[v]),L=w.useCallback(W=>{if(W){const Q=v.get(W);if(Q&&typeof Q=="object"&&!Array.isArray(Q))return{[W]:Q}}return v.getSnapshot()},[v]),B=w.useCallback(async(W,Q,H)=>{var I,ae,le;const $=L(Q),{onAction:U}=N.current;if(H&&!("steps"in H)){const oe=H.type||ed.ContinueConversation,we={...H.params||{}};H.url&&(we.url=H.url),H.context&&(we.context=H.context),U==null||U({type:oe,params:we,humanFriendlyMessage:W,formState:$,formName:Q});return}const Z=H;if(Z!=null&&Z.steps){for(const oe of Z.steps)switch(oe.type){case Br.Run:if(oe.refType==="mutation"){const we=(ae=(I=A.current)==null?void 0:I.mutationStatements)==null?void 0:ae.find(Oe=>Oe.statementId===oe.statementId),Ee=we!=null&&we.argsAST?St(we.argsAST,S):{};if(!await b.fireMutation(oe.statementId,Ee))return}else b.invalidate([oe.statementId]);break;case Br.ToAssistant:U==null||U({type:ed.ContinueConversation,params:oe.context?{context:oe.context}:{},humanFriendlyMessage:oe.message,formState:$,formName:Q});break;case Br.OpenUrl:U==null||U({type:ed.OpenUrl,params:{url:oe.url},humanFriendlyMessage:"",formState:$,formName:Q});break;case Br.Set:{if(!oe.valueAST){console.warn(`[openui] Set action for ${oe.target} has no valueAST — skipping`);break}const we=St(oe.valueAST,S);v.set(oe.target,we);break}case Br.Reset:{const we=((le=A.current)==null?void 0:le.stateDeclarations)??{};for(const Ee of oe.targets)v.set(Ee,we[Ee]??null);break}}return}U==null||U({type:ed.ContinueConversation,params:{},humanFriendlyMessage:W,formState:$,formName:Q})},[b,S,L,v]),_=w.useRef([]),R=w.useRef(n);R.current=n;const z=w.useCallback(W=>{R.current||_.current.push(W)},[]),F=w.useMemo(()=>({library:t,renderNode:p,triggerAction:B,isStreaming:n,getFieldValue:M,setFieldValue:T,store:v,evaluationContext:S,reportError:z}),[t,p,n,B,M,T,v,S,z]),Y=w.useRef([]),D=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const W=[],Q={ctx:S,library:t,store:v,errors:W};try{const H=RN(m.root,Q);return Y.current=W,{...m,root:H}}catch(H){const $=H instanceof Error?H.message:String(H);return W.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${$}`}),Y.current=W,m}},[m,S,t,v,j,C]),q=C.__openui_loading.length>0,G=w.useRef("");return w.useEffect(()=>{var H,$,U,Z;if(n){G.current!==""&&(G.current="",($=(H=N.current).onError)==null||$.call(H,[]));return}const W=[];g.current&&W.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&W.push({source:"parser",code:"parse-failed",message:m?"Code parsed but produced no renderable root component":"Response could not be parsed as valid openui-lang",hint:`The entire response must be valid openui-lang code starting with root = ${t.root??"Root"}(...)`}),(Z=(U=m==null?void 0:m.meta)==null?void 0:U.errors)!=null&&Z.length&&W.push(...PU(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),W.push(...Y.current),W.push(..._.current),_.current=[],W.push(...C.__openui_errors??[]);const Q=JSON.stringify(W);if(Q!==G.current){if(G.current=Q,N.current.onError)N.current.onError(W);else if(W.length>0)for(const I of W)console.warn(`[openui] ${I.source}/${I.code}: ${I.message}`)}},[n,e,m,D,C,t]),{result:D,parseResult:m,contextValue:F,isQueryLoading:q}}var KU=class extends w.Component{constructor(t){super(t);rt(this,"lastValidChildren",null);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidMount(){this.state.hasError||(this.lastValidChildren=this.props.children)}componentDidUpdate(t){this.state.hasError||(this.lastValidChildren=this.props.children),this.state.hasError&&t.children!==this.props.children&&this.setState({hasError:!1})}componentDidCatch(t){var r,i;const n=this.props.componentName??"Unknown";(i=(r=this.props).onError)==null||i.call(r,{source:"runtime",code:"render-error",component:n,message:`Component ${n} render failed: ${t.message}`})}render(){return this.state.hasError?this.lastValidChildren:this.props.children}};function LN(e){if(e==null)return null;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map((t,n)=>l.jsx(w.Fragment,{children:LN(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return l.jsx(IN,{node:t})}return null}function IN({node:e}){var i;const{library:t,reportError:n}=MN(),r=(i=t.components[e.typeName])==null?void 0:i.component;return r?l.jsx(KU,{componentName:e.typeName,onError:n,children:l.jsx(YU,{el:e,Comp:r})}):null}function YU({el:e,Comp:t}){const n=ZU();return l.jsx(t,{props:e.props,renderNode:n})}let wk=!1;function XU(){if(wk||typeof document>"u")return;wk=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const JU=()=>l.jsx("div",{style:{position:"absolute",top:8,right:8,width:16,height:16,border:"2px solid #e5e7eb",borderTopColor:"#3b82f6",borderRadius:"50%",animation:"openui-spin 0.6s linear infinite",zIndex:10}});function e8({response:e,library:t,isStreaming:n=!1,onAction:r,onStateUpdate:i,initialState:o,onParseResult:c,toolProvider:d,queryLoader:p,onError:h}){w.useInsertionEffect(()=>{XU()},[]);const g=w.useRef(c);g.current=c;const m=w.useRef(d);m.current=d;const v=w.useRef({async callTool(S,N){const A=m.current??null;if(A==null)throw new Error("[openui] toolProvider is null");if(typeof A.callTool=="function")return qU(await A.callTool({name:S,arguments:N}));const O=A,M=O[S];if(!M)throw new Sg(S,Object.keys(O));return M(N)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:C}=QU({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:i,initialState:o,toolProvider:d!=null?v.current:null,onError:h},LN);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),b!=null&&b.root?l.jsx(ON.Provider,{value:j,children:l.jsxs("div",{style:{position:"relative"},children:[C&&(p??l.jsx(JU,{})),l.jsx("div",{style:{opacity:C?.7:1,transition:"opacity 0.2s ease"},children:l.jsx(IN,{node:b.root})})]})}):null}w.createContext(null);function t8(e){if(typeof e!="string")return null;const t=e.trim();if(!t)return null;try{const n=new URL(t,"https://placeholder.invalid");return n.origin==="https://placeholder.invalid"||n.protocol==="http:"||n.protocol==="https:"||n.protocol==="mailto:"?t:null}catch{return null}}const n8=({props:e,renderNode:t})=>{const n=e.children;return l.jsxs("div",{className:"v10-genui-root",children:[e.title?l.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((r,i)=>l.jsx(Je.Fragment,{children:t(r)},i)):t(n)]})},r8=({props:e})=>{var t;return l.jsxs("div",{className:"v10-genui-card v10-genui-entity-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.typeLabel?l.jsx("div",{className:"v10-genui-card-type",children:e.typeLabel}):null]}),e.subtitle?l.jsx("div",{className:"v10-genui-card-subtitle",children:e.subtitle}):null,(t=e.chips)!=null&&t.length?l.jsx("div",{className:"v10-genui-chips",children:e.chips.map((n,r)=>l.jsxs("span",{className:`v10-genui-chip tone-${n.tone??"default"}`,children:[l.jsx("span",{className:"v10-genui-chip-label",children:n.label}),l.jsx("span",{className:"v10-genui-chip-value",children:n.value})]},r))}):null]})},a8=({props:e})=>l.jsx("div",{className:"v10-genui-stats-grid",children:e.stats.map((t,n)=>l.jsxs("div",{className:"v10-genui-stat",title:t.hint,children:[l.jsx("div",{className:"v10-genui-stat-value",children:t.value}),l.jsx("div",{className:"v10-genui-stat-label",children:t.label})]},n))}),i8=({props:e})=>l.jsxs("div",{className:"v10-genui-section",children:[e.heading?l.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,l.jsx("div",{className:"v10-genui-triple-table",children:e.rows.map((t,n)=>l.jsxs("div",{className:"v10-genui-triple-row",children:[l.jsx("div",{className:"v10-genui-triple-predicate",children:Qv(t.predicate)}),l.jsx("div",{className:"v10-genui-triple-object",children:h8(t.object)})]},n))})]}),s8=({props:e})=>l.jsxs("div",{className:"v10-genui-section",children:[e.heading?l.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,l.jsx("div",{className:"v10-genui-type-groups",children:e.groups.map((t,n)=>l.jsxs("div",{className:"v10-genui-type-group",children:[l.jsxs("div",{className:"v10-genui-type-group-head",children:[t.icon?l.jsx("span",{className:"v10-genui-type-icon",children:t.icon}):null,l.jsx("span",{className:"v10-genui-type-label",children:t.typeLabel}),l.jsx("span",{className:"v10-genui-type-count",children:t.items.length})]}),l.jsx("div",{className:"v10-genui-type-items",children:t.items.map((r,i)=>l.jsxs("div",{className:"v10-genui-type-item",title:r.uri,children:[l.jsx("div",{className:"v10-genui-type-item-label",children:r.label}),r.sub?l.jsx("div",{className:"v10-genui-type-item-sub",children:r.sub}):null]},i))})]},n))})]}),o8=({props:e})=>l.jsxs("div",{className:"v10-genui-section",children:[l.jsxs("div",{className:"v10-genui-section-heading",children:[l.jsx("span",{children:e.heading}),e.predicate?l.jsxs("span",{className:"v10-genui-section-sub",children:["· ",Qv(e.predicate)]}):null]}),l.jsx("div",{className:"v10-genui-crossref",children:e.items.map((t,n)=>l.jsxs("div",{className:"v10-genui-crossref-item",title:t.uri,children:[l.jsx("span",{className:"v10-genui-crossref-label",children:t.label}),t.sub?l.jsx("span",{className:"v10-genui-crossref-sub",children:t.sub}):null]},n))})]}),l8=({props:e})=>l.jsxs("div",{className:"v10-genui-card v10-genui-package-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("span",{className:"v10-genui-card-icon",style:{color:"#a855f7"},children:"📦"}),l.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.folder?l.jsxs("div",{className:"v10-genui-card-type",children:["packages/",e.folder]}):null]}),e.description?l.jsx("div",{className:"v10-genui-card-subtitle",children:e.description}):null,l.jsxs("div",{className:"v10-genui-stats-grid",children:[typeof e.fileCount=="number"&&l.jsx(rd,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&l.jsx(rd,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&l.jsx(rd,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&l.jsx(rd,{label:"Interfaces",value:e.interfaceCount})]})]}),c8=({props:e})=>l.jsxs("div",{className:"v10-genui-card v10-genui-file-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("span",{className:"v10-genui-card-icon",style:{color:"#3b82f6"},children:"📄"}),l.jsx("div",{className:"v10-genui-card-title",children:g8(e.path)}),e.language?l.jsxs("div",{className:"v10-genui-card-type",children:[".",e.language]}):null]}),l.jsx("div",{className:"v10-genui-card-subtitle",children:e.path}),l.jsxs("div",{className:"v10-genui-chips",children:[e.packageName?l.jsxs("span",{className:"v10-genui-chip tone-info",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"pkg"}),l.jsx("span",{className:"v10-genui-chip-value",children:e.packageName})]}):null,typeof e.lineCount=="number"?l.jsxs("span",{className:"v10-genui-chip",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"lines"}),l.jsx("span",{className:"v10-genui-chip-value",children:e.lineCount})]}):null]})]}),u8=({props:e})=>l.jsxs("div",{className:"v10-genui-card v10-genui-decision-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("span",{className:"v10-genui-card-icon",style:{color:"#ef4444"},children:"◆"}),l.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?l.jsx("div",{className:`v10-genui-status-chip status-${e.status}`,children:e.status}):null]}),e.date?l.jsxs("div",{className:"v10-genui-card-subtitle",children:["Decided ",e.date]}):null,e.context?l.jsx(ad,{heading:"Context",body:e.context}):null,e.outcome?l.jsx(ad,{heading:"Outcome",body:e.outcome}):null,e.consequences?l.jsx(ad,{heading:"Consequences",body:e.consequences}):null,e.alternatives?l.jsx(ad,{heading:"Alternatives considered",body:e.alternatives}):null]}),d8=({props:e})=>l.jsxs("div",{className:"v10-genui-card v10-genui-pr-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("span",{className:"v10-genui-card-icon",style:{color:"#f59e0b"},children:"⇄"}),l.jsxs("div",{className:"v10-genui-card-title",children:[typeof e.number=="number"?l.jsxs("span",{className:"v10-genui-pr-num",children:["#",e.number]}):null,e.title]}),e.state?l.jsx("div",{className:`v10-genui-status-chip pr-state-${e.state}`,children:e.state}):null]}),l.jsxs("div",{className:"v10-genui-chips",children:[e.author?l.jsxs("span",{className:"v10-genui-chip",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"by"}),l.jsx("span",{className:"v10-genui-chip-value",children:e.author})]}):null,e.mergedAt?l.jsxs("span",{className:"v10-genui-chip tone-success",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"merged"}),l.jsx("span",{className:"v10-genui-chip-value",children:e.mergedAt.split("T")[0]})]}):null,(()=>{const t=t8(e.url);return t?l.jsxs("a",{className:"v10-genui-chip tone-info",href:t,target:"_blank",rel:"noopener noreferrer",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"view"}),l.jsx("span",{className:"v10-genui-chip-value",children:"github"})]}):null})()]}),e.body?l.jsx("div",{className:"v10-genui-pr-body",children:e.body}):null]}),f8=({props:e})=>l.jsxs("div",{className:"v10-genui-card v10-genui-task-card",children:[l.jsxs("div",{className:"v10-genui-card-head",children:[l.jsx("span",{className:"v10-genui-card-icon",style:{color:"#06b6d4"},children:"✓"}),l.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?l.jsx("div",{className:`v10-genui-status-chip task-status-${e.status}`,children:e.status.replace("_"," ")}):null,e.priority?l.jsx("div",{className:`v10-genui-priority-chip priority-${e.priority}`,children:e.priority.toUpperCase()}):null]}),l.jsxs("div",{className:"v10-genui-chips",children:[e.assignee?l.jsxs("span",{className:"v10-genui-chip",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"assignee"}),l.jsxs("span",{className:"v10-genui-chip-value",children:["@",e.assignee]})]}):null,typeof e.estimate=="number"?l.jsxs("span",{className:"v10-genui-chip",children:[l.jsx("span",{className:"v10-genui-chip-label",children:"est"}),l.jsxs("span",{className:"v10-genui-chip-value",children:[e.estimate,"h"]})]}):null]})]}),p8=({props:e})=>{var t;return l.jsxs("div",{className:"v10-genui-vm-panel",children:[l.jsxs("div",{className:"v10-genui-vm-panel-head",children:[l.jsxs("div",{className:"v10-genui-vm-badge",children:[l.jsx("span",{className:"v10-genui-vm-badge-dot"}),"Verifiable Memory"]}),l.jsx("div",{className:"v10-genui-vm-title",children:"On-chain provenance"})]}),l.jsxs("div",{className:"v10-genui-vm-grid",children:[e.onChain?l.jsxs("div",{className:"v10-genui-vm-block",children:[l.jsx("div",{className:"v10-genui-vm-block-heading",children:"Anchoring"}),e.onChain.txHash?l.jsx(ts,{label:"tx",value:kk(e.onChain.txHash),mono:!0}):null,e.onChain.blockNumber?l.jsx(ts,{label:"block",value:String(e.onChain.blockNumber),mono:!0}):null,e.onChain.chain?l.jsx(ts,{label:"chain",value:e.onChain.chain}):null]}):null,e.consensus?l.jsxs("div",{className:"v10-genui-vm-block",children:[l.jsxs("div",{className:"v10-genui-vm-block-heading",children:["Consensus ",e.consensus.quorum?l.jsx("span",{className:"v10-genui-vm-quorum",children:e.consensus.quorum}):null]}),(e.consensus.signers??[]).map((n,r)=>l.jsxs("div",{className:"v10-genui-vm-signer",children:[l.jsx("div",{className:"v10-genui-vm-signer-dot"}),l.jsxs("div",{className:"v10-genui-vm-signer-body",children:[l.jsx("div",{className:"v10-genui-vm-signer-label",children:n.label??m8(n.did)}),l.jsx("div",{className:"v10-genui-vm-signer-did",children:n.did})]}),typeof n.reputation=="number"?l.jsxs("div",{className:"v10-genui-vm-rep",children:["rep ",n.reputation]}):null]},r))]}):null,e.knowledgeAsset?l.jsxs("div",{className:"v10-genui-vm-block",children:[l.jsx("div",{className:"v10-genui-vm-block-heading",children:"Knowledge asset"}),e.knowledgeAsset.ual?l.jsx(ts,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?l.jsx(ts,{label:"hash",value:kk(e.knowledgeAsset.contentHash),mono:!0}):null,e.knowledgeAsset.tracLocked?l.jsx(ts,{label:"trac",value:e.knowledgeAsset.tracLocked}):null,e.knowledgeAsset.tokenId?l.jsx(ts,{label:"nft",value:`#${e.knowledgeAsset.tokenId}`}):null]}):null,(t=e.timeline)!=null&&t.length?l.jsxs("div",{className:"v10-genui-vm-block",children:[l.jsx("div",{className:"v10-genui-vm-block-heading",children:"Timeline"}),e.timeline.map((n,r)=>l.jsxs("div",{className:"v10-genui-vm-timeline-row",children:[l.jsx("div",{className:"v10-genui-vm-timeline-dot"}),l.jsx("div",{className:"v10-genui-vm-timeline-label",children:n.label}),l.jsx("div",{className:"v10-genui-vm-timeline-at",children:n.at})]},r))]}):null]})]})},rd=({label:e,value:t})=>l.jsxs("div",{className:"v10-genui-stat",children:[l.jsx("div",{className:"v10-genui-stat-value",children:t}),l.jsx("div",{className:"v10-genui-stat-label",children:e})]}),ad=({heading:e,body:t})=>l.jsxs("div",{className:"v10-genui-decision-section",children:[l.jsx("div",{className:"v10-genui-decision-section-heading",children:e}),l.jsx("div",{className:"v10-genui-decision-section-body",children:t})]}),ts=({label:e,value:t,mono:n})=>l.jsxs("div",{className:"v10-genui-prov-row",children:[l.jsx("span",{className:"v10-genui-prov-label",children:e}),l.jsx("span",{className:`v10-genui-prov-value${n?" mono":""}`,children:t})]});function Qv(e){return e.replace(/^"|"$/g,"").replace(/^<|>$/g,"").replace("http://www.w3.org/1999/02/22-rdf-syntax-ns#","rdf:").replace("http://www.w3.org/2000/01/rdf-schema#","rdfs:").replace("http://www.w3.org/2001/XMLSchema#","xsd:").replace("http://schema.org/","schema:").replace("http://dkg.io/ontology/code/","code:").replace("http://dkg.io/ontology/github/","gh:").replace("http://dkg.io/ontology/decisions/","dec:").replace("http://dkg.io/ontology/tasks/","task:").replace("http://dkg.io/ontology/profile/","prof:")}function h8(e){return Qv(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function kk(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function m8(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function g8(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const v8=Dr({name:"EntityDetail",description:"Root container for a single-entity detail view. Accepts any number of child blocks (EntityCard, PackageCard, VerifiedProvenancePanel, etc.). Always use this as the outermost element.",props:qt({title:Be().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:n8}),y8=Dr({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:qt({name:Be().describe("Display name / label of the entity"),typeLabel:Be().optional().describe('Human-readable rdf:type label (e.g. "Package", "Pull Request")'),subtitle:Be().optional().describe("Short supporting text (e.g. path, author, date)"),chips:Ba(qt({label:Be(),value:Be(),tone:So(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:r8}),b8=Dr({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:qt({stats:Ba(qt({label:Be(),value:Gv([Be(),ca()]),hint:Be().optional()})).min(1).max(8)}),component:a8}),x8=Dr({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:qt({heading:Be().optional(),rows:Ba(qt({predicate:Be(),object:Be()})).max(60)}),component:i8}),w8=Dr({name:"EntityTypeList",description:"Grouped list of child entities by rdf:type. Great for showing a File's contained classes/functions/interfaces as separate sections.",props:qt({heading:Be().optional(),groups:Ba(qt({typeLabel:Be(),icon:Be().optional(),items:Ba(qt({label:Be(),uri:Be().optional(),sub:Be().optional()})).max(30)})).max(8)}),component:s8}),k8=Dr({name:"CrossRefList",description:"List of cross-references following a single predicate (e.g. code:imports, github:affects, decisions:affects). Each item can show a short subtitle.",props:qt({heading:Be().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:Be().optional(),items:Ba(qt({label:Be(),uri:Be().optional(),sub:Be().optional()})).max(40)}),component:o8}),S8=Dr({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:qt({name:Be(),folder:Be().optional(),description:Be().optional(),fileCount:ca().optional(),classCount:ca().optional(),functionCount:ca().optional(),interfaceCount:ca().optional()}),component:l8}),j8=Dr({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:qt({path:Be(),language:Be().optional(),lineCount:ca().optional(),packageName:Be().optional()}),component:c8}),C8=Dr({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:qt({title:Be(),status:So(["proposed","accepted","rejected","superseded"]).optional(),date:Be().optional(),context:Be().optional(),outcome:Be().optional(),consequences:Be().optional(),alternatives:Be().optional()}),component:u8}),N8=Dr({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:qt({title:Be(),number:ca().optional(),state:So(["open","closed","merged"]).optional(),author:Be().optional(),mergedAt:Be().optional(),body:Be().optional(),url:Be().optional()}),component:d8}),E8=Dr({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:qt({title:Be(),status:So(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:So(["p0","p1","p2","p3"]).optional(),assignee:Be().optional(),estimate:ca().optional()}),component:f8}),A8=Dr({name:"VerifiedProvenancePanel",description:"The Verifiable Memory hero block. Use at the top of any entity in the VM layer. Surfaces on-chain anchor (tx hash, block), consensus (signing agents with reputation), knowledge-asset identity (UAL, content hash, TRAC locked, NFT token id), and finalisation timeline.",props:qt({onChain:qt({txHash:Be().optional(),blockNumber:Gv([Be(),ca()]).optional(),chain:Be().optional()}).optional(),consensus:qt({signers:Ba(qt({did:Be(),label:Be().optional(),reputation:ca().optional(),signature:Be().optional()})).max(10).optional(),quorum:Be().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:qt({ual:Be().optional(),contentHash:Be().optional(),tracLocked:Be().optional(),tokenId:Be().optional()}).optional(),timeline:Ba(qt({label:Be(),at:Be()})).max(6).optional()}),component:p8}),DN=WU({components:[v8,y8,b8,x8,w8,k8,S8,j8,C8,N8,E8,A8],root:"EntityDetail",componentGroups:[{name:"Generic",components:["EntityDetail","EntityCard","EntityStatsGrid","EntityTypeList","CrossRefList","TripleTable"]},{name:"Code domain",components:["PackageCard","FileCard"]},{name:"GitHub domain",components:["PRCard"]},{name:"Decisions & tasks",components:["DecisionCard","TaskCard"]},{name:"Verifiable memory",components:["VerifiedProvenancePanel"]}]});let wm=null;function T8(){return wm===null&&(wm=DN.prompt({preamble:"You are composing a single-entity detail panel for the DKG Node UI. Use only the components below to build a rich, structured view. Always wrap the response in the EntityDetail root element.",additionalRules:["Prefer specialised cards (PackageCard, PRCard, DecisionCard, TaskCard, FileCard) when the rdf:type matches.","Include VerifiedProvenancePanel at the very top if the entity appears in verifiable memory or has on-chain / signature triples.","Keep the tree compact: aim for 3–8 top-level blocks.","Do not invent triple data — only use values present in the provided triples."]})),wm}async function*R8(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Bt()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let o=`HTTP ${t.status}`;try{const c=await t.json();c!=null&&c.error&&(o=c.error)}catch{}yield{type:"error",error:o};return}const n=t.body.getReader(),r=new TextDecoder;let i="";try{for(;;){const{value:o,done:c}=await n.read();if(c)break;i+=r.decode(o,{stream:!0});let d;for(;(d=i.indexOf(`
|
|
1606
|
+
|
|
1607
|
+
`))!==-1;){const p=i.slice(0,d);i=i.slice(d+2);const h=Sk(p);h&&(yield h)}}if(i.trim()){const o=Sk(i);o&&(yield o)}}finally{n.releaseLock()}}function Sk(e){let t="message",n="";for(const r of e.split(`
|
|
1608
|
+
`))r.startsWith("event:")?t=r.slice(6).trim():r.startsWith("data:")&&(n+=r.slice(5).trim());if(!n)return null;try{const r=JSON.parse(n);switch(t){case"start":return{type:"start",...r};case"delta":return{type:"delta",text:r.text??""};case"final":return{type:"final",content:r.content??""};case"error":return{type:"error",error:r.error??"unknown error"};case"done":return{type:"done"};default:return null}}catch{return null}}const _8=({contextGraphId:e,entityUri:t,placeholder:n,fallback:r})=>{const[i,o]=Je.useState(""),[c,d]=Je.useState(!0),[p,h]=Je.useState(null);return Je.useEffect(()=>{const g=new AbortController;let m="";return o(""),h(null),d(!0),(async()=>{try{const v=T8();for await(const b of R8({contextGraphId:e,entityUri:t,libraryPrompt:v,signal:g.signal}))if(b.type==="delta")m+=b.text,o(m);else if(b.type==="final")b.content&&(m=b.content,o(b.content));else if(b.type==="error"){h(b.error);break}else if(b.type==="done")break}catch(v){v.name!=="AbortError"&&h(v.message)}finally{d(!1)}})(),()=>g.abort()},[e,t]),p?r?l.jsx(l.Fragment,{children:r(p)}):l.jsx(M8,{error:p}):!i&&c?l.jsx(l.Fragment,{children:n??l.jsx("div",{className:"v10-genui-loading",children:"Composing detail view…"})}):l.jsx("div",{className:"v10-genui-panel",children:l.jsx(e8,{response:i,library:DN,isStreaming:c})})},O8="LLM not configured",M8=({error:e})=>{const t=gn(r=>r.openTab);return e.includes(O8)?l.jsxs("div",{className:"v10-genui-error v10-genui-error-cta",children:[l.jsxs("div",{className:"v10-genui-error-head",children:[l.jsx("span",{className:"v10-genui-error-icon",children:"⚙"}),l.jsxs("div",{children:[l.jsx("div",{className:"v10-genui-error-title",children:"Set up your LLM to enable GenUI"}),l.jsx("div",{className:"v10-genui-error-desc",children:"GenUI streams entity detail views from an OpenAI-compatible model. Add an API key in Settings and open this entity again."})]})]}),l.jsx("button",{className:"v10-genui-error-cta-btn",onClick:()=>t({id:"settings",label:"Settings",closable:!0}),children:"Open Settings →"})]}):l.jsxs("div",{className:"v10-genui-error",children:["GenUI unavailable: ",e]})};function jk({entity:e,profile:t}){const n=w.useMemo(()=>{for(const d of e.subGraphs)if(d!=="meta")return d;return null},[e.subGraphs]);if(!n||!t)return null;const r=t.forSubGraph(n),i=(r==null?void 0:r.color)??"#64748b",o=(r==null?void 0:r.icon)??"•",c=(r==null?void 0:r.displayName)??n;return l.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":i},title:`In sub-graph: ${c}`,children:[l.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:i},children:o}),l.jsx("span",{className:"v10-subgraph-badge-label",children:c})]})}function L8({entity:e,contextGraphId:t,onVerified:n}){const r=qa(),[i,o]=w.useState(!1),[c,d]=w.useState(null),[p,h]=w.useState(null),[g,m]=w.useState(null),v=e.trustLevel,b=w.useMemo(()=>{if(!r)return null;for(const A of e.types){const O=r.forType(A);if(O&&(v==="working"&&(O.promoteLabel||O.promoteHint)||v==="shared"&&(O.publishLabel||O.publishHint)))return O}return null},[e.types,r,v]),k=w.useMemo(()=>{if(!r)return null;for(const A of e.subGraphs){if(A==="meta")continue;const O=r.forSubGraph(A);if(O!=null&&O.sourceAssertion)return{binding:O,subGraph:A}}return null},[e.subGraphs,r]);if(v==="verified"||!b)return null;const j=v==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares the complete owning Knowledge Asset with the team.",busyCopy:"Sharing…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:`No sourceAssertion declared on the sub-graph profile — add profile:sourceAssertion to the SubGraphBinding for "${[...e.subGraphs].filter(A=>A!=="meta")[0]??"?"}".`}:{kind:"publish",label:b.publishLabel??"Verify on DKG",hint:b.publishHint??"Publishes the complete owning Knowledge Asset on-chain.",busyCopy:"Anchoring…",disabled:!(k!=null&&k.binding.sourceAssertion),disabledReason:k!=null&&k.binding.sourceAssertion?null:"This entity is not part of a named Shared-Memory asset, so it cannot be published to Verifiable Memory from here."},C=async()=>{if(j.disabled)return;o(!0),m(null),d(null),h(j.kind);const A=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const O=await xo(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(uv(A,O))}else{const O=await lv(t,k.binding.sourceAssertion,k.subGraph?{subGraphName:k.subGraph}:{});d(O)}n()}catch(O){const M=j.kind==="promote"?wo(A,O):null,T=M?M.message:(O==null?void 0:O.message)??"Action failed";m(T)}finally{o(!1)}},S=A=>!!A&&"status"in A,N=A=>!!A&&"kind"in A;return l.jsxs("div",{className:`v10-ka-verify v10-ka-verify-${j.kind}`,children:[l.jsxs("div",{className:"v10-ka-verify-head",children:[l.jsx("span",{className:"v10-ka-verify-arrow",children:j.kind==="promote"?"◈":"◉"}),l.jsx("span",{className:"v10-ka-verify-title",children:j.label})]}),l.jsx("div",{className:"v10-ka-verify-hint",children:j.hint}),j.disabledReason&&l.jsxs("div",{className:"v10-ka-verify-err",children:["! ",j.disabledReason]}),!c&&l.jsx("button",{className:`v10-ka-verify-btn ${j.kind}`,onClick:C,disabled:i||j.disabled,children:i?j.busyCopy:j.label}),g&&l.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),c&&p==="promote"&&N(c)&&c.kind==="success"&&l.jsxs("div",{className:"v10-ka-verify-ok",children:[l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Promoted"}),l.jsxs("span",{className:"v10-ka-verify-ok-val",children:["✓ ",c.promotedCount," triple",c.promotedCount===1?"":"s"," now in Shared Memory"]})]}),l.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:"Refresh the entity to see the next step appear."})]}),c&&p==="promote"&&N(c)&&c.kind!=="success"&&l.jsxs("div",{className:"v10-ka-verify-err",children:["! ",c.message]}),c&&p==="publish"&&S(c)&&(()=>{var M,T;const A=c.status==="confirmed"&&!!c.txHash,O=A&&!!c.contextGraphError;return l.jsxs("div",{className:A?O?"v10-ka-verify-warn":"v10-ka-verify-ok":"v10-ka-verify-err",children:[l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Status"}),l.jsxs("span",{className:"v10-ka-verify-ok-val",children:[A?O?"⚠":"✓":"✕"," ",c.status,A?O?` (${MO})`:"":" (NOT on-chain)"]})]}),O&&l.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:ic(c.contextGraphError)}),c.txHash?l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),l.jsx("span",{className:"v10-ka-verify-ok-val mono",title:c.txHash,children:c.txHash})]}):l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),l.jsx("span",{className:"v10-ka-verify-ok-val",children:"none — on-chain submission skipped"})]}),c.blockNumber!=null&&l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Block"}),l.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",c.blockNumber]})]}),((T=(M=c.kas)==null?void 0:M[0])==null?void 0:T.tokenId)&&l.jsxs("div",{className:"v10-ka-verify-ok-row",children:[l.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Token"}),l.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",c.kas[0].tokenId]})]})]})})()]})}function I8({entity:e,allEntities:t,allTriples:n,onNavigate:r,onClose:i,contextGraphId:o,onRefresh:c,onOpenAgent:d}){const[p,h]=w.useState("content"),g=tr(D=>D.theme),m=qa(),v=gs(),{icon:b,type:k}=ff(e,m),j=iD(e),C=df(e),S=C?(v==null?void 0:v.get(C))??null:null,N=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",A=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",O=ua(e.trustLevel,1),M=w.useMemo(()=>{const D=[];for(const[,q]of t)for(const G of q.connections)G.targetUri===e.uri&&D.push({pred:io(G.predicate),entity:q});return D},[e.uri,t]),T=w.useMemo(()=>n.filter(D=>Nt(D.subject)===e.uri||Nt(D.object)===e.uri),[e.uri,n]),L=w.useMemo(()=>sD(e.uri,n,1),[e.uri,n]),B=w.useMemo(()=>{const D=new Set;for(const q of t.values())fC(q)&&D.add(Nt(q.uri));return D},[t]),_=w.useMemo(()=>new Set([Nt(e.uri)]),[e.uri]),R=w.useMemo(()=>zd(L,B,{focalSubjects:_}),[L,B,_]),z=w.useMemo(()=>{const D=is[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:cf({minZoomForLabels:.2}),style:{namespaceColors:Nv(D),defaultNodeColor:D,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:11},hexagon:{baseSize:7,minSize:4,maxSize:10,scaleWithDegree:!0},focus:{maxNodes:500,hops:999}}},[e.trustLevel]),F=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),Y=T.length;return l.jsxs("div",{className:"v10-ka-detail",children:[l.jsxs("div",{className:"v10-ka-header",children:[l.jsx("button",{className:"v10-ka-back",onClick:i,children:"← Back to Context Graph"}),l.jsxs("div",{className:"v10-ka-header-left",children:[l.jsx("div",{className:"v10-ka-label",children:O}),l.jsxs("div",{className:"v10-ka-name",children:[b," ",e.label,l.jsx("span",{className:`v10-trust-badge ${N}`,children:A})]}),l.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",Y," triples"]})]}),(S||C)&&l.jsxs("div",{className:"v10-ka-header-author",children:[l.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),l.jsx(us,{agent:S??void 0,fallbackUri:C??void 0,size:"lg",showOperator:!0,onOpenAgent:d})]})]}),l.jsxs("div",{className:"v10-ka-split",children:[l.jsxs("div",{className:"v10-ka-left",children:[l.jsxs("div",{className:"v10-content-tabs",style:{margin:"0 -20px",padding:"0 20px",background:"transparent"},children:[l.jsx("button",{className:`v10-content-tab ${p==="content"?"active":""}`,onClick:()=>h("content"),children:"Content"}),l.jsx("button",{className:`v10-content-tab ${p==="triples"?"active":""}`,onClick:()=>h("triples"),children:"Triples"}),l.jsx("button",{className:`v10-content-tab ${p==="graph"?"active":""}`,onClick:()=>h("graph"),children:"Graph"})]}),p==="content"&&l.jsxs(l.Fragment,{children:[!e.types.map(q=>m==null?void 0:m.forType(q)).find(q=>q==null?void 0:q.detailHint)||!(m!=null&&m.contextGraphId)?null:l.jsx("div",{className:"v10-ka-section",children:l.jsx(_8,{contextGraphId:m.contextGraphId,entityUri:e.uri})}),j&&l.jsx("div",{className:"v10-ka-section",children:l.jsx("div",{className:"v10-ka-desc",children:l.jsx("p",{children:j})})}),e.properties.size>0&&l.jsxs("div",{className:"v10-ka-section",children:[l.jsx("div",{className:"v10-ka-section-title",children:"Properties"}),[...e.properties].map(([D,q])=>l.jsxs("div",{className:"v10-ka-prop",children:[l.jsx("span",{className:"v10-ka-prop-key",children:io(D)}),l.jsx("span",{className:"v10-ka-prop-val",children:q.join(", ")})]},D))]}),e.connections.length>0&&l.jsxs("div",{className:"v10-ka-section",children:[l.jsxs("div",{className:"v10-ka-section-title",children:["References (",e.connections.length,")"]}),e.connections.map((D,q)=>{const G=t.get(D.targetUri);return l.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(D.targetUri),children:[l.jsx("span",{className:"v10-ka-conn-pred",children:io(D.predicate)}),l.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),l.jsx("span",{className:"v10-ka-conn-target",children:D.targetLabel}),G&&l.jsx(jk,{entity:G,profile:m})]},q)})]}),M.length>0&&l.jsxs("div",{className:"v10-ka-section",children:[l.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",M.length,")"]}),M.map((D,q)=>l.jsxs("button",{className:"v10-ka-conn",onClick:()=>r(D.entity.uri),children:[l.jsx("span",{className:"v10-ka-conn-target",children:D.entity.label}),l.jsx(jk,{entity:D.entity,profile:m}),l.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),l.jsx("span",{className:"v10-ka-conn-pred",children:D.pred})]},q))]}),l.jsxs("div",{className:"v10-ka-meta",children:[l.jsxs("span",{className:"v10-ka-meta-item",children:[b," ",k]}),l.jsxs("span",{className:"v10-ka-meta-item",children:[Y," triples"]}),l.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),p==="triples"&&l.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[l.jsxs("table",{className:"v10-ka-triples-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Subject"}),l.jsx("th",{children:"Predicate"}),l.jsx("th",{children:"Object"})]})}),l.jsx("tbody",{children:T.slice(0,50).map((D,q)=>l.jsxs("tr",{children:[l.jsx("td",{title:D.subject,children:io(D.subject)}),l.jsx("td",{title:D.predicate,children:io(D.predicate)}),l.jsx("td",{title:D.object,children:D.object.startsWith('"')?uf(D.object).slice(0,60):io(D.object)})]},q))})]}),l.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",padding:"6px 8px"},children:[Math.min(T.length,50)," of ",T.length," triples shown"]})]}),p==="graph"&&l.jsx(bd,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:N,className:"v10-ka-graph-shell",renderGraph:D=>R.length>0?l.jsx(w.Suspense,{fallback:l.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:l.jsx(Lv,{data:R,format:"triples",options:z,viewConfig:F,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:q=>(q==null?void 0:q.id)&&q.id!==e.uri&&r(q.id),initialFit:!0,initialFocus:e.uri},`${e.uri}:${D?"expanded":"inline"}`)}):l.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"No neighborhood data"})})]}),l.jsxs("div",{className:"v10-ka-right",children:[l.jsx(c$,{contextGraphId:o,entityUri:e.uri,enabled:e.trustLevel==="verified"}),l.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),l.jsx(D8,{entity:e}),l.jsx(L8,{entity:e,contextGraphId:o,onVerified:c}),l.jsxs("div",{style:{marginTop:16,padding:"10px 12px",borderRadius:6,background:"var(--bg-surface)",border:"1px solid var(--border-subtle)"},children:[l.jsx("div",{className:"v10-ka-section-title",style:{marginBottom:6},children:"Entity Summary"}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,fontSize:10},children:[l.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Type"}),l.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:k})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Triples"}),l.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:Y})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Links"}),l.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:e.connections.length})]}),l.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[l.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Layer"}),l.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:A.split(" ")[0]})]})]})]})]})]})]})}function D8({entity:e}){const t=gs(),n=c=>{const d=nD(e,c),p=rD(e,c),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:p,agent:h}},r=n("created"),i=n("promoted"),o=n("published");return l.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&l.jsx(km,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:o.agent,agentUri:o.uri,at:o.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&l.jsx(km,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:i.agent,agentUri:i.uri,at:i.at}),l.jsx(km,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:r.agent,agentUri:r.uri,at:r.at})]})}function km({toneClass:e,title:t,actionWord:n,agent:r,agentUri:i,at:o}){const c=o?uD(o):null;return l.jsxs("div",{className:"v10-ka-event",children:[l.jsx("div",{className:`v10-ka-event-dot ${e}`}),l.jsxs("div",{className:"v10-ka-event-header",children:[l.jsx("span",{className:"v10-ka-event-title",children:t}),c&&l.jsx("time",{className:"v10-ka-event-time",dateTime:o??void 0,children:c})]}),(r||i)&&l.jsxs("div",{className:"v10-ka-event-attribution",children:[l.jsxs("span",{className:"v10-ka-event-attribution-prefix",children:[n," by"]}),l.jsx(us,{agent:r??void 0,fallbackUri:i??void 0,size:"sm"})]})]})}function Ck(){return l.jsxs("div",{className:"v10-subgraph-explorer-header",children:[l.jsx("div",{className:"v10-subgraph-explorer-title",children:"Subgraph Explorer"}),l.jsx("p",{className:"v10-subgraph-explorer-intro",children:"Subgraphs are optional topical partitions inside this Context Graph. An entity belongs to one or more memory layers and, optionally, to one or more subgraphs. Entities in no subgraph live in the context graph root."})]})}function z8({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:r}){const i=qa(),[o,c]=w.useState([]),[d,p]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let T=!1;return p(!0),g(null),kn.fetchSubGraphs(e).then(L=>{T||c(L.subGraphs??[])}).catch(L=>{T||g(L instanceof Error?L.message:"Failed to load subgraphs")}).finally(()=>{T||p(!1)}),()=>{T=!0}},[e]);const{total:m}=Av(t),v=Object.values(t.layerStatus??{}),b=t.loading||v.some(T=>T==="loading"),k=t.error!==null||t.partial||v.some(T=>T==="error"),j=w.useMemo(()=>{const T=new Map;for(const L of t.entityList){const B=Nt(L.uri);for(const _ of L.subGraphs){let R=T.get(_);R||(R=new Set,T.set(_,R)),R.add(B)}}return T},[t.entityList]),{triplesBySubGraph:C,tripleCountBySubGraph:S}=w.useMemo(()=>{const T=new Map;for(const _ of t.allTriples){if(!_.subGraph)continue;let R=T.get(_.subGraph);R||(R=[],T.set(_.subGraph,R)),R.push(_)}for(const _ of t.allTriples)if(!_.subGraph){for(const[R,z]of j)if(cg(_,{slug:R,isRoot:!1,scopedUris:z})){let F=T.get(R);F||(F=[],T.set(R,F)),F.push(_)}}const L=new Map,B=new Map;for(const[_,R]of T){const F=ug(R,t.entities).map(Y=>({subject:Y.subject,predicate:Y.predicate,object:Y.object}));B.set(_,F.length),L.set(_,Dw(F))}return{triplesBySubGraph:L,tripleCountBySubGraph:B}},[t.allTriples,t.entities,j]),N=w.useMemo(()=>{const T=new Map;for(const L of t.entityList)for(const B of L.subGraphs){let _=T.get(B);_||(_={wm:0,swm:0,vm:0},T.set(B,_)),L.trustLevel==="verified"?_.vm++:L.trustLevel==="shared"?_.swm++:_.wm++}return T},[t.entityList]),A=w.useMemo(()=>{const T=new Map;for(const L of t.entityList){const B=Nt(L.uri);for(const _ of L.subGraphs){let R=T.get(_);R||(R=new Map,T.set(_,R)),R.set(B,L.trustLevel),B!==L.uri&&R.set(L.uri,L.trustLevel)}}return T},[t.entityList]),O=w.useMemo(()=>o.filter(Tv).map(T=>{const L=(i==null?void 0:i.forSubGraph(T.name))??{},B=C.get(T.name)??[],_=j.get(T.name)??new Set,R=A.get(T.name)??new Map;return{slug:T.name,icon:L.icon??"•",color:L.color??"#64748b",displayName:L.displayName??T.name,description:L.description,rank:L.rank??99,entityCount:_.size>0?_.size:T.entityCount,tripleCount:S.get(T.name)??0,triples:zd(B,_),layerCounts:N.get(T.name)??{wm:0,swm:0,vm:0},entityTrustByUri:R}}).sort((T,L)=>T.rank-L.rank),[o,i,C,S,N,j,A]),M=w.useMemo(()=>{const T=[],L=new Set,B=new Map;let _=0,R=0,z=0;for(const Q of t.entityList){if(Q.subGraphs.size>0)continue;T.push(Q);const H=Nt(Q.uri);L.add(H),B.set(H,Q.trustLevel),H!==Q.uri&&B.set(Q.uri,Q.trustLevel),Q.trustLevel==="verified"?z++:Q.trustLevel==="shared"?R++:_++}const F=t.allTriples.filter(Q=>!Q.subGraph),Y=ug(F,t.entities).map(Q=>({subject:Q.subject,predicate:Q.predicate,object:Q.object})),D=Y.length,q=zd(Y,L),G=Dw(q),W=(i==null?void 0:i.forSubGraph(Ur))??{};return{slug:Ur,icon:W.icon??"⊘",color:W.color??"#64748b",displayName:W.displayName??"Root",description:W.description,rank:999,entityCount:T.length,tripleCount:D,triples:G,layerCounts:{wm:_,swm:R,vm:z},entityTrustByUri:B}},[t.entityList,t.allTriples,t.entities,i]);return d&&O.length===0?l.jsx(Jt,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&O.length===0?l.jsx(Jt,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):O.length===0&&M.entityCount===0?l.jsx(Jt,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:l.jsxs(l.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",l.jsx("code",{children:"recipes"}),", ",l.jsx("code",{children:"decisions"}),"). Agents create one when they scope an assertion to a subgraph. All current entities live in the Context Graph root."]}),actions:[{label:"View root",onClick:()=>r(Ur),variant:"primary"}],className:"v10-sgov-state"}):l.jsxs("div",{className:"v10-sgov",children:[l.jsxs("div",{className:"v10-sgov-header",children:[l.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),l.jsxs("div",{className:"v10-sgov-sub",children:[O.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),l.jsxs("div",{className:"v10-sgov-grid",children:[O.map(T=>l.jsx(Nk,{card:T,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(T.slug)},T.slug)),l.jsx(Nk,{card:M,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(Ur),variant:"root"},Ur)]})]})}function Nk({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:r,onOpen:i,variant:o}){const c=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=is[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:cf({minZoomForLabels:.8}),style:{classColors:yC,predicateColors:bC,namespaceColors:Nv(e.color),...Object.keys(c).length>0?{nodeColors:c}:{},defaultNodeColor:e.color,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:12,gradient:!0,gradientIntensity:.35},hexagon:{baseSize:6,minSize:3,maxSize:16,scaleWithDegree:!0},focus:{maxNodes:5e3,hops:999}}),[e.color,c]),p=o==="root";return l.jsxs("div",{className:`v10-sgov-card${p?" root":""}`,style:p?void 0:{"--sg-color":e.color,borderColor:e.color+"55"},children:[l.jsxs("div",{className:"v10-sgov-card-head",children:[l.jsx("span",{className:"v10-sgov-card-icon",style:p?void 0:{color:e.color},children:e.icon}),l.jsxs("div",{className:"v10-sgov-card-title-wrap",children:[l.jsx("div",{className:"v10-sgov-card-title",children:e.displayName}),e.description&&l.jsx("div",{className:"v10-sgov-card-desc",title:e.description,children:e.description})]}),l.jsx("button",{type:"button",className:"v10-sgov-card-open",onClick:i,title:`Focus on ${e.displayName}`,children:"↗"})]}),l.jsxs("div",{className:"v10-sgov-card-stats",children:[l.jsxs("span",{className:"v10-sgov-card-stat",children:[l.jsx("b",{children:e.entityCount})," entities"]}),l.jsxs("span",{className:"v10-sgov-card-stat",title:t&&e.tripleCount===0?"Loading triples for this subgraph…":n?e.tripleCount===0?"Some layers unavailable; count may be incomplete.":`${e.tripleCount} triples (some layers unavailable; count may be incomplete).`:t?`${e.tripleCount} triples (still loading; count may grow).`:e.tripleCount!==e.triples.length?`${e.tripleCount} triples in this subgraph's scope; ${e.triples.length} rendered (some in-scope edges aren't drawn — either endpoints outside this subgraph, or cap-trimmed in dense buckets).`:void 0,children:[l.jsx("b",{children:t&&e.tripleCount===0?"…":e.tripleCount})," triples"]})]}),l.jsx("div",{className:"v10-sgov-card-pyramid",children:l.jsx(zN,{counts:e.layerCounts,compact:!0})}),l.jsx("div",{className:"v10-sgov-card-graph",children:e.triples.length===0?l.jsx("div",{className:"v10-sgov-card-empty",children:e.entityCount>0?"Promoted — open to view":"No data yet"}):l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"v10-sgov-card-empty",children:"Loading…"}),children:l.jsx(Lv,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:r,initialFit:!0})})})]})}function zN({counts:e,activeLayers:t,onClickLayer:n,compact:r=!1}){const i=e.wm+e.swm+e.vm;if(i===0)return r?null:l.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const o=[{key:"verified",short:"VM",count:e.vm,color:"#22c55e",label:"Verifiable"},{key:"shared",short:"SWM",count:e.swm,color:"#f59e0b",label:"Shared"},{key:"working",short:"WM",count:e.wm,color:"#64748b",label:"Working"}],c=!!n;return l.jsxs("div",{className:`v10-minibar${r?" compact":""}`,children:[!r&&l.jsx("div",{className:"v10-minibar-bar",children:o.filter(d=>d.count>0).map(d=>{const p=d.count/i*100,h=t?t.has(d.key):!0;return l.jsx("div",{className:`v10-minibar-seg${h?"":" dim"}`,style:{width:`${p}%`,background:d.color},title:`${d.label}: ${d.count}`},d.key)})}),l.jsx("div",{className:"v10-minibar-legend",children:o.map(d=>{const p=t?t.has(d.key):!0;return l.jsxs("button",{type:"button",className:`v10-minibar-chip${p?"":" dim"}${c?" interactive":""}`,onClick:c?()=>n(d.key):void 0,disabled:!c,title:`${d.label} Memory — ${d.count} entities${c?" (click to toggle)":""}`,children:[l.jsx("span",{className:"v10-minibar-dot",style:{background:d.color}}),l.jsx("span",{className:"v10-minibar-short",children:d.short}),l.jsx("span",{className:"v10-minibar-count",children:d.count})]},d.key)})})]})}function $8({items:e,color:t,onSelectEntity:n,scrollKey:r}){const i=qa(),o=gs(),c=w.useMemo(()=>{const d=new Map;for(const p of e){const h=`${p.date.getFullYear()}-${String(p.date.getMonth()+1).padStart(2,"0")}`,g=d.get(h)??[];g.push(p),d.set(h,g)}return[...d.entries()].sort((p,h)=>p[0].localeCompare(h[0]))},[e]);return e.length===0?l.jsx("div",{className:"v10-subgraph-timeline-empty","data-cg-scroll-key":r,children:l.jsx(Jt,{compact:!0,title:"No timeline values yet.",description:"Entities in this sub-graph do not currently expose the configured timeline field."})}):l.jsx("div",{className:"v10-subgraph-timeline","data-cg-scroll-key":r,children:c.map(([d,p])=>l.jsxs("div",{className:"v10-subgraph-timeline-bucket",children:[l.jsxs("div",{className:"v10-subgraph-timeline-bucket-head",children:[l.jsx("span",{className:"v10-subgraph-timeline-bucket-dot",style:{background:t}}),l.jsx("span",{className:"v10-subgraph-timeline-bucket-label",children:dD(d)}),l.jsx("span",{className:"v10-subgraph-timeline-bucket-count",children:p.length})]}),l.jsx("div",{className:"v10-subgraph-timeline-items",children:p.map(({entity:h,date:g})=>{const{icon:m}=ff(h,i),v=df(h),b=v?o==null?void 0:o.get(v):null;return l.jsxs("button",{className:"v10-subgraph-timeline-item",onClick:()=>n(h.uri),title:`${h.label} · ${g.toISOString().slice(0,10)}`,children:[l.jsx("span",{className:"v10-subgraph-timeline-item-icon",children:m}),l.jsx("span",{className:"v10-subgraph-timeline-item-label",children:h.label}),(b||v)&&l.jsx(us,{agent:b??void 0,fallbackUri:v??void 0,size:"sm"}),l.jsx("span",{className:"v10-subgraph-timeline-item-date",children:g.toISOString().slice(0,10)})]},h.uri)})})]},d))})}function P8({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:r,onSelectEntity:i,activeTab:o,onTabChange:c,initialLayer:d,initialEnabledLayers:p,onEnabledLayersChange:h,onOpenQueryCatalog:g}){const m=qa(),v=m==null?void 0:m.forSubGraph(e),b=(m==null?void 0:m.chipsFor(e))??[],k=(m==null?void 0:m.savedQueryCatalogsFor(e))??[],j=v==null?void 0:v.timelinePredicate,[C,S]=w.useState("items"),N=o??C,A=N==="timeline"&&!j?"items":N,O=c??S,[M,T]=w.useState(v!=null&&v.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{T(v!=null&&v.timelinePredicate?"created-desc":"triples")},[e,v==null?void 0:v.timelinePredicate]);const L=w.useMemo(()=>p&&p.size>0?new Set(p):d==="wm"?new Set(["working"]):d==="swm"?new Set(["shared"]):d==="vm"?new Set(["verified"]):new Set(["working","shared","verified"]),[d,p]),[B,_]=w.useState(L);w.useEffect(()=>{h==null||h(B)},[B,h]);const[R,z]=w.useState(new Map),[F,Y]=w.useState(null),[D,q]=w.useState(null),[G,W]=w.useState(!1),[Q,H]=w.useState(null),$=e===Ur,U=w.useMemo(()=>{const ie=[];for(const V of t.entityList)($?V.subGraphs.size===0:V.subGraphs.has(e))&&ie.push(V);return ie},[t.entityList,e,$]),Z=w.useMemo(()=>new Set(U.map(ie=>ie.uri)),[U]),I=w.useMemo(()=>t.graphTriples.filter(ie=>cg(ie,{slug:e,isRoot:$,scopedUris:Z})),[t.graphTriples,Z,e,$]),ae=w.useMemo(()=>{let ie=0,V=0,xe=0;for(const Le of U)Le.trustLevel==="verified"?xe++:Le.trustLevel==="shared"?V++:ie++;return{wm:ie,swm:V,vm:xe,total:U.length}},[U]),le=w.useMemo(()=>{if(B.size!==1)return null;const ie=B.values().next().value;return ie==="verified"?"vm":ie==="shared"?"swm":ie==="working"?"wm":null},[B]),oe=w.useMemo(()=>{let ie=U;if(B.size<3&&(ie=ie.filter(V=>B.has(V.trustLevel))),R.size>0)for(const V of b){const xe=R.get(V.slug);!xe||xe.size===0||(ie=ie.filter(Le=>{const Ae=Le.properties.get(V.predicate);return!Ae||Ae.length===0?!1:Ae.some(De=>xe.has(De))}))}return D&&(ie=ie.filter(V=>D.has(V.uri))),ie},[U,B,R,b,D]),we=w.useMemo(()=>new Set(oe.map(ie=>ie.uri)),[oe]),Ee=w.useMemo(()=>oe.length===U.length?I:I.filter(ie=>we.has(ie.subject)||we.has(ie.object)),[I,U,oe,we]),He=w.useMemo(()=>{if(!le)return null;const ie=le==="vm"?"verified":le==="swm"?"shared":"working",V=U.filter(De=>{if(!De.layers.has(ie))return!1;if(R.size>0)for(const Qe of b){const Te=R.get(Qe.slug);if(!Te||Te.size===0)continue;const jt=De.properties.get(Qe.predicate);if(!jt||jt.length===0||!jt.some(ft=>Te.has(ft)))return!1}return!(D&&!D.has(De.uri))}),xe=new Set(V.map(De=>De.uri)),Le=new Set,Ae=[];for(const De of t.allTriples){if(De.layer!==ie||!cg(De,{slug:e,isRoot:$,scopedUris:Z,requireResourceObject:!0})||!(xe.has(De.subject)||xe.has(De.object)))continue;const Qe=`${De.subject}|${De.predicate}|${De.object}`;Le.has(Qe)||(Le.add(Qe),Ae.push({subject:De.subject,predicate:De.predicate,object:De.object,subGraph:De.subGraph}))}return Ae},[le,t.allTriples,Z,e,$,U,b,R,D])??Ee,ke=w.useMemo(()=>{if(le){const ie=le==="vm"?"verified":le==="swm"?"shared":"working";return U.filter(V=>{if(!V.layers.has(ie))return!1;if(R.size>0)for(const xe of b){const Le=R.get(xe.slug);if(!Le||Le.size===0)continue;const Ae=V.properties.get(xe.predicate);if(!Ae||Ae.length===0||!Ae.some(De=>Le.has(De)))return!1}return!(D&&!D.has(V.uri))})}return oe},[le,U,oe,b,R,D]),ve=w.useMemo(()=>ke.map(ie=>({uri:ie.uri,label:ie.label})),[ke]),Re=w.useMemo(()=>{if(le)return;const ie={};for(const V of ke){ie[V.uri]=is[V.trustLevel];const xe=Nt(V.uri);xe!==V.uri&&(ie[xe]=is[V.trustLevel])}return ie},[le,ke]),Ge=B.size===3?"All layers":le?qn[le].title:Array.from(B).map(ie=>qn[ie==="verified"?"vm":ie==="shared"?"swm":"wm"].trustLabel).join(" + "),We=w.useMemo(()=>{if(!j)return[];const ie=[];for(const V of oe){const xe=yd(V,j);xe!=null&&ie.push({entity:V,date:new Date(xe)})}return ie.sort((V,xe)=>V.date.getTime()-xe.date.getTime()),ie},[oe,j]),de=w.useMemo(()=>{const ie=[...oe];if((M==="created-desc"||M==="created-asc")&&j){const V=M==="created-desc"?-1:1;return ie.sort((xe,Le)=>{const Ae=yd(xe,j),De=yd(Le,j);return Ae==null&&De==null?0:Ae==null?1:De==null?-1:(Ae-De)*V}),ie}return M==="label"?(ie.sort((V,xe)=>(V.label??"").localeCompare(xe.label??"")),ie):(ie.sort((V,xe)=>{const Le=V.tripleCount??0;return(xe.tripleCount??0)-Le}),ie)},[oe,M,j]),Pe=M==="created-desc"?"newest first · click to open":M==="created-asc"?"oldest first · click to open":M==="label"?"A → Z · click to open":"sorted by triples · click to open",Ze=w.useCallback(ie=>{_(V=>{const xe=new Set(V);return xe.has(ie)?xe.size>1&&xe.delete(ie):xe.add(ie),xe})},[]),ot=w.useCallback((ie,V)=>{z(xe=>{const Le=new Map(xe),Ae=new Set(Le.get(ie)??[]);return Ae.has(V)?Ae.delete(V):Ae.add(V),Ae.size===0?Le.delete(ie):Le.set(ie,Ae),Le})},[]),be=w.useCallback(()=>{Y(null),q(null),H(null)},[]),bt=w.useCallback(async ie=>{var V;if((((V=ie.parameters)==null?void 0:V.length)??0)>0){g==null||g();return}W(!0),H(null),Y(ie.slug);try{const xe=Gl(ie),Ae=(await gr(xe.sparql,{contextGraphId:n,view:xe.view,subGraphName:xe.subGraphName})).result,De=Ae.type;if(De!=="bindings")throw new Error(`${ie.name} returns ${De==="boolean"?"an ASK result":"graph quads"} and cannot be used as an entity filter. Open it in Query Catalogue instead.`);const Qe=Ae.bindings,Te=ie.resultColumn||"uri",jt=new Set;for(const ft of Qe){const An=ft[Te];if(!An)continue;const Mn=typeof An=="string"?An:String(An),yn=Mn.startsWith("<")&&Mn.endsWith(">")?Mn.slice(1,-1):Mn;jt.add(yn)}q(jt)}catch(xe){H((xe==null?void 0:xe.message)??String(xe)),q(null),Y(null)}finally{W(!1)}},[n,g]),at=(v==null?void 0:v.color)??($?"var(--text-tertiary)":"#64748b"),rn=(v==null?void 0:v.icon)??"•",mt=(v==null?void 0:v.displayName)??e,Se=v==null?void 0:v.description;w.useEffect(()=>{_(L),z(new Map),be()},[e,be,L]),w.useEffect(()=>{o||S("items")},[e,o]),w.useEffect(()=>{N!==A&&O(A)},[N,A,O]);const fe=!(B.size===L.size&&[...B].every(ie=>L.has(ie)))||R.size>0||!!D,Ne=()=>{_(new Set(L)),z(new Map),be()};return l.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":at},children:[l.jsxs("div",{className:"v10-subgraph-detail-header",children:[l.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:at},children:rn}),l.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[l.jsx("div",{className:"v10-subgraph-detail-title",children:mt}),Se&&l.jsx("div",{className:"v10-subgraph-detail-desc",children:Se})]}),l.jsx(zN,{counts:{wm:ae.wm,swm:ae.swm,vm:ae.vm},activeLayers:B,onClickLayer:Ze,compact:!0})]}),l.jsxs("div",{className:"v10-subgraph-cross-layer",children:[l.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:$?"Root entities, across the three memory layers:":"This subgraph, across the three memory layers:"}),l.jsxs("div",{className:"v10-subgraph-cross-layer-strip","data-testid":"cross-layer-strip",children:[l.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"wm","aria-pressed":B.has("working"),onClick:()=>Ze("working"),children:[l.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:is.working},children:"◇"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Working"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:ae.wm})]}),l.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),l.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"swm","aria-pressed":B.has("shared"),onClick:()=>Ze("shared"),title:le==="swm"?"Showing Shared Working Memory only — graph is colored by contributing agent (see legend).":void 0,children:[l.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:is.shared},children:"◈"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Shared"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:ae.swm})]}),l.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),l.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"vm","aria-pressed":B.has("verified"),onClick:()=>Ze("verified"),children:[l.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:is.verified},children:"◉"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Verifiable"}),l.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:ae.vm})]})]}),l.jsxs("span",{className:`v10-subgraph-active-layer-pill${B.size===3?" all-layers":""}`,"data-testid":"active-layer-pill",children:[l.jsx("span",{className:"v10-subgraph-active-layer-pill-label",children:"Active layer:"}),l.jsx("span",{className:"v10-subgraph-active-layer-pill-value",children:Ge})]})]}),k.length>0&&l.jsxs("div",{className:"v10-subgraph-savedqueries",children:[l.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),k.map(ie=>l.jsxs(Je.Fragment,{children:[l.jsx("span",{className:"v10-subgraph-savedqueries-label",title:ie.description||ie.name,style:{marginLeft:8,opacity:.8},children:ie.name}),ie.queries.map(V=>{var Ae;const xe=F===V.slug,Le=(((Ae=V.parameters)==null?void 0:Ae.length)??0)>0;return l.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${xe?" active":""}`,onClick:()=>xe?be():bt(V),title:Le?`${V.description||V.name} Open Query Catalogue to enter parameters.`:V.description||V.name,disabled:G&&!xe,children:[l.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:Le?"↗":G&&xe?"…":xe?"✓":"◎"}),V.name]},V.slug)})]},ie.slug)),Q&&l.jsx("span",{className:"v10-subgraph-savedquery-error",title:Q,children:"✕ query failed"}),D&&F&&l.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[D.size," match",D.size===1?"":"es"]})]}),b.length>0&&l.jsxs("div",{className:"v10-subgraph-filters",children:[b.map(ie=>{const V=R.get(ie.slug)??new Set;return l.jsxs("div",{className:"v10-subgraph-filter-row",children:[l.jsx("span",{className:"v10-subgraph-filter-label",children:ie.label}),l.jsx("div",{className:"v10-subgraph-filter-chips",children:ie.values.map(xe=>{const Le=V.has(xe);return l.jsx("button",{type:"button",className:`v10-subgraph-filter-chip${Le?" active":""}`,onClick:()=>ot(ie.slug,xe),children:xe},xe)})})]},ie.slug)}),fe&&l.jsx("button",{type:"button",className:"v10-subgraph-filter-reset",onClick:Ne,children:"Reset filters"})]}),l.jsxs("div",{className:"v10-layer-detail-body",children:[l.jsxs("div",{className:"v10-layer-expand-tabs",children:[l.jsxs("button",{className:`v10-layer-expand-tab ${A==="items"?"active":""}`,onClick:()=>O("items"),children:["Entities (",oe.length,oe.length!==U.length?` / ${U.length}`:"",")"]}),l.jsx("button",{className:`v10-layer-expand-tab ${A==="graph"?"active":""}`,onClick:()=>O("graph"),children:"Graph"}),j&&l.jsx("button",{className:`v10-layer-expand-tab ${A==="timeline"?"active":""}`,onClick:()=>O("timeline"),children:"Timeline"}),l.jsx("button",{className:`v10-layer-expand-tab ${A==="docs"?"active":""}`,onClick:()=>O("docs"),children:"Documents"})]}),A==="items"&&l.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:l.jsx(HC,{entities:de,layerKey:"wm",layerIcon:rn,onSelectEntity:i,externallySorted:!0,sortLabel:Pe,timestampPredicate:j,perEntityTrustBadge:!0,headerExtra:l.jsxs("label",{className:"v10-entity-list-sort",children:[l.jsx("span",{className:"v10-entity-list-sort-label",children:"Sort"}),l.jsxs("select",{className:"v10-entity-list-sort-select",value:M,onChange:ie=>T(ie.target.value),"aria-label":"Sort entities",children:[j&&l.jsxs(l.Fragment,{children:[l.jsx("option",{value:"created-desc",children:"Newest first"}),l.jsx("option",{value:"created-asc",children:"Oldest first"})]}),l.jsx("option",{value:"triples",children:"Most triples"}),l.jsx("option",{value:"label",children:"Label (A→Z)"})]})]})})}),A==="graph"&&l.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`subgraph:${e}:graph`,children:l.jsx(BC,{layer:le??"wm",triples:He,onNodeClick:r,contextGraphId:n,title:mt,scopeLabel:`Subgraph graph: ${mt} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:le,scopeEntities:ve,layerEntities:ke,nodeColorsOverride:Re})}),A==="timeline"&&j&&l.jsx("div",{className:"v10-layer-expand-body full-width",children:l.jsx($8,{items:We,color:at,onSelectEntity:i,scrollKey:`subgraph:${e}:timeline`})}),A==="docs"&&l.jsx("div",{className:"v10-layer-expand-body full-width",children:l.jsx(GC,{entities:oe,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const U8={wm:"items",swm:"items",vm:"items"},Ek={wm:"working",swm:"shared",vm:"verified"};function Sm(e){return e==="wm"||e==="swm"||e==="vm"}function B8(e){const t=new Set;return e.filter(n=>{const r=`${Nt(n.subject)}|${n.predicate}|${Nt(n.object)}`;return t.has(r)?!1:(t.add(r),!0)})}function Ak(e,t){if(typeof document>"u")return t;const n=document.querySelectorAll("[data-cg-scroll-key]");for(const r of n)if(r.dataset.cgScrollKey===e)return r;return t}function F8({contextGraphId:e}){const{data:t,error:n,loading:r,refresh:i}=vr(kn.fetchContextGraphs,[],3e4),[o,c]=w.useState(!1),[d,p]=w.useState(!1),[h,g]=w.useState("overview"),[m,v]=w.useState(!1),[b,k]=w.useState(null);w.useEffect(()=>{v(!1)},[e]);const[j,C]=w.useState({contextGraphId:null,list:[],status:"loading"}),[S,N]=w.useState(null),[A,O]=w.useState(!1),M=w.useRef(0),[T,L]=w.useState(null),[B,_]=w.useState(null),R=w.useRef(null),[z,F]=w.useState(null),Y=w.useCallback(ue=>{R.current=ue,F(ue)},[]),D=w.useRef(null),q=w.useCallback(ue=>{D.current=ue,ue===null&&(R.current=null,F(null)),L(ue)},[]),[G,W]=w.useState(null),Q=w.useRef(null);w.useEffect(()=>{Q.current=b},[b]);const[H,$]=w.useState(U8),[U,Z]=w.useState({}),I=w.useRef(null),ae=w.useRef(null),le=w.useRef(null),oe=w.useRef(0),we=v3(e),Ee=k3(e),Oe=gn(ue=>ue.openTab),{data:He,loading:ke,error:ve}=of(),Re=w.useCallback(()=>T?`subgraph:${T}:${U[T]??"items"}`:Sm(h)?`layer:${h}:${H[h]}`:"page",[h,T,H,U]),Ge=w.useCallback(ue=>{const Ce=ue??Re(),Me=Ak(Ce,I.current);return{activeLayer:h,activeSubGraph:T,layerTabs:{...H},subGraphTabs:{...U},scroll:{key:Ce,top:(Me==null?void 0:Me.scrollTop)??0},subGraphEnabledLayers:T!==null&&R.current?new Set(R.current):null}},[h,T,Re,H,U]),We=w.useCallback(ue=>{const Ce=()=>{const Me=Ak(ue.key,I.current);Me&&(Me.scrollTop=ue.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(Ce):setTimeout(Ce,0)},[]),de=w.useCallback((ue,Ce)=>{(!Q.current||!ae.current)&&(ae.current=Ge(Ce)),k(ue)},[Ge]),Pe=w.useCallback(()=>{ae.current=null},[]);w.useEffect(()=>{if(b)return;const ue=le.current;ue&&(le.current=null,We(ue))},[b,h,T,H,U,We]),w.useEffect(()=>{const ue=Ce=>{const Me=Ce.detail;Me&&Me.contextGraphId===e&&typeof Me.entityUri=="string"&&(W(null),de(Me.entityUri))};return window.addEventListener("v10:open-entity",ue),()=>window.removeEventListener("v10:open-entity",ue)},[e,de]);const Ze=w.useCallback(ue=>{var tt;const Ce=ue.startsWith("urn:dkg:agent:")?ue.slice(14):ue,Me=((tt=Ee.get(ue))==null?void 0:tt.name)??Ce;Oe({id:`agent:${e}|${Ce}`,label:`@ ${Me}`,closable:!0})},[Ee,e,Oe]),ot=w.useMemo(()=>({...Ee,openAgent:Ze}),[Ee,Ze]),be=w.useMemo(()=>{var ue;return(ue=t==null?void 0:t.contextGraphs)==null?void 0:ue.find(Ce=>Ce.id===e)},[t,e]),at=Cv(e,{signalErrors:!0,includeQueryCatalog:m&&(h==="wm"||h==="swm")}),rn=Av(at).total,mt=ZI({activeLayer:h,activeSubGraph:T}),Se=zC(mt?e:void 0),X=!T&&h==="overview",fe=O3(X?e:void 0),Ne=X?fe.resultContextGraphId===e?fe.events:[]:void 0,ie=X&&fe.resultContextGraphId===e?fe.error:null,V=w.useCallback(()=>{const ue=be==null?void 0:be.id;if(!ue)return;const Ce=oe.current+1;oe.current=Ce,C({contextGraphId:ue,list:[],status:"loading"}),kn.listParticipants(ue).then(Me=>{oe.current===Ce&&C({contextGraphId:ue,list:Me.allowedAgents,status:"ok"})}).catch(()=>{oe.current===Ce&&C({contextGraphId:ue,list:[],status:"error"})})},[be==null?void 0:be.id]);w.useEffect(()=>{V()},[V]);const xe=w.useCallback(()=>{const ue=++M.current;kn.fetchSubGraphs(e).then(Ce=>{if(M.current!==ue)return;const Me=(Ce.subGraphs??[]).filter(Tv).length;N(Me),O(!1)}).catch(()=>{M.current===ue&&(N(null),O(!0))})},[e]);w.useEffect(()=>{N(null),O(!1),xe()},[xe]),_o(e,xe);const Le=G?Ek[G]:null,Ae=w.useMemo(()=>Le?at.allTriples.filter(ue=>ue.layer===Le):at.graphTriples,[at.allTriples,at.graphTriples,Le]),De=w.useMemo(()=>Le?B8(Ae):Ae,[Ae,Le]),Qe=w.useMemo(()=>Le?dC(Ae):at.entities,[Ae,at.entities,Le]),Te=w.useMemo(()=>b?Qe.get(b)??null:null,[b,Qe]);w.useEffect(()=>{!b||Te||at.loading||(k(null),W(null),Pe())},[b,Te,at.loading,Pe]);const jt=w.useCallback((ue,Ce)=>{const Me=D.current;if(Pe(),q(ue),ue===null)_(null);else if(Ce!==void 0){const tt=new Set([Ek[Ce]]);_(tt),R.current=tt,F(tt)}else{if(Me!==null&&ue===Me)return;if(Me!==null&&R.current){const tt=new Set(R.current);_(tt),R.current=tt,F(tt)}else _(null),R.current=null,F(null)}k(null),W(null)},[Pe,q]),ft=w.useCallback(ue=>{Pe(),g(ue),k(null),W(null),q(null),_(null)},[Pe,q]),An=w.useCallback((ue,Ce)=>{$(Me=>Me[ue]===Ce?Me:{...Me,[ue]:Ce})},[]),Mn=w.useCallback((ue,Ce)=>{Z(Me=>Me[ue]===Ce?Me:{...Me,[ue]:Ce})},[]),yn=w.useCallback((ue,Ce,Me)=>{const tt=Q.current!=null;de(ue,Ce),W(Ke=>Me??(tt?Ke:null))},[de]),Ga=w.useCallback(()=>{const ue=ae.current;if(ae.current=null,k(null),W(null),!!ue){if(g(ue.activeLayer),q(ue.activeSubGraph),ue.activeSubGraph!==null&&ue.subGraphEnabledLayers){const Ce=new Set(ue.subGraphEnabledLayers);_(Ce),R.current=Ce,F(Ce)}$(ue.layerTabs),Z(ue.subGraphTabs),le.current=ue.scroll}},[q]),ar=w.useCallback(ue=>{if(!(ue!=null&&ue.id))return;const Ce=Sm(ue.trustLayer)?ue.trustLayer:void 0;yn(ue.id,void 0,Ce)},[yn]),Va=w.useCallback(ue=>{const Ce=Sm(h)?h:void 0;yn(ue,void 0,Ce)},[h,yn]),pa=w.useCallback(ue=>{yn(ue,"page")},[yn]),ks=w.useCallback(()=>{Oe(PC)},[Oe]),Wa=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!be)return n||t&&!r?l.jsxs("div",{className:"v10-view-placeholder",children:[l.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?Wa?n:"Failed to load context graph.":"Context graph not found."}),Wa?l.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"}):l.jsx("button",{type:"button",className:"v10-retry-btn",onClick:i,children:"Retry"})]}):l.jsx("div",{className:"v10-view-placeholder",children:l.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading context graph..."})});const Li=T?we.forSubGraph(T):null,Ii=!at.loading&&!at.error&&!at.partial?at.entityList:void 0,Ss=Te?"entity":T?"subgraph":h,me=j.contextGraphId===be.id?j.list:[],_e=j.contextGraphId===be.id?j.status:"loading";return l.jsx(LC.Provider,{value:we,children:l.jsx(DC.Provider,{value:ot,children:l.jsxs("div",{className:"v10-memory-explorer",children:[n&&l.jsx("div",{className:"v10-stale-banner",role:"status",children:Wa?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:n}),l.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"Couldn’t refresh context-graph data — showing last known values."}),l.jsx("button",{type:"button",className:"v10-retry-btn",onClick:i,children:"Retry"})]})}),l.jsx(fz,{cg:be,profile:we,activeSubGraph:Li,onClearSubGraph:()=>jt(null)}),l.jsx(dz,{active:h,counts:at.counts,onSwitch:ft,onShare:()=>p(!0),onImport:()=>c(!0),onRefresh:at.refresh}),l.jsxs("main",{className:"v10-memory-explorer-page","data-view":Ss,"data-cg-scroll-key":"page",ref:I,children:[Te&&l.jsx(I8,{entity:Te,allEntities:Qe,allTriples:De,onNavigate:yn,onClose:Ga,contextGraphId:e,onRefresh:at.refresh}),T&&!Te&&l.jsxs(l.Fragment,{children:[l.jsx(Ck,{}),l.jsx(fm,{contextGraphId:e,profile:we,selected:T,entities:Ii,onSelect:jt,enabledScope:z??void 0,allTriplesTotal:rn}),l.jsx(P8,{slug:T,rawMemory:at,contextGraphId:e,onNodeClick:ar,onSelectEntity:yn,activeTab:U[T]??"items",onTabChange:ue=>Mn(T,ue),initialEnabledLayers:B??void 0,onEnabledLayersChange:Y,onOpenQueryCatalog:()=>{q(null),g("query")}})]}),!T&&h==="overview"&&!Te&&l.jsxs(l.Fragment,{children:[l.jsx(yz,{cg:be,memory:at,subGraphCount:S,subGraphFetchFailed:A,participants:me,participantsStatus:_e,currentAgent:He??null,currentAgentStatus:ke?"loading":ve?"error":"ok",onSwitchLayer:ft,onOpenPrimer:ks}),l.jsx(bz,{contextGraphId:e,curatorStatus:gz({cg:be,currentAgent:He??null,currentAgentStatus:ke?"loading":ve?"error":"ok"}),onParticipantsChanged:V}),at.loading&&l.jsx("div",{className:"v10-me-loading",children:l.jsx("div",{className:"v10-me-loading-text",children:"Loading memory..."})}),at.error&&l.jsxs("div",{className:"v10-me-error",children:["Error: ",at.error]}),l.jsx("div",{"data-section":"activity",children:l.jsx(Y3,{entities:at.entityList,lifecycleEvents:Ne,lifecycleError:ie,onSelectEntity:pa,title:"Recent activity",limit:40,includeUndated:!1,emptyHint:"Once knowledge starts being added and managed in this context graph, activities will show up here as a live feed.",className:"v10-overview-activity"})}),l.jsx(xz,{onOpenPrimer:ks})]}),!T&&h==="graph-overview"&&!Te&&l.jsxs(l.Fragment,{children:[l.jsx(Ck,{}),l.jsx(fm,{contextGraphId:e,profile:we,selected:null,entities:Ii,onSelect:jt,allTriplesTotal:rn}),l.jsx(z8,{contextGraphId:e,memory:at,onNodeClick:ar,onSelectSubGraph:jt})]}),!T&&h==="query"&&!Te&&l.jsx(Yz,{contextGraphId:e}),!T&&(h==="wm"||h==="swm"||h==="vm")&&!Te&&l.jsxs(l.Fragment,{children:[l.jsx(fm,{contextGraphId:e,profile:we,selected:T,entities:Ii,onSelect:jt,layer:h}),l.jsx(Uz,{layer:h,memory:at,onNodeClick:ar,onSelectEntity:Va,contextGraphId:e,activeTab:H[h],onTabChange:ue=>An(h,ue),swmAttribution:Se,showQueryCatalog:m,onShowQueryCatalogChange:v})]})]}),l.jsx(CD,{open:o,onClose:()=>c(!1),contextGraphId:be.id,contextGraphName:be.name}),l.jsx(ED,{open:d,onClose:()=>p(!1),contextGraphId:be.id,contextGraphName:be.name})]})})})}const q8=[{title:"Memory layers",body:"Working Memory is private staging, Shared Working Memory is the collaborative review layer, and Verifiable Memory is the published on-chain layer. Counts show where entities live now."},{title:"Subgraphs",body:"Subgraphs organize the same Context Graph by topic or source. They cut across memory layers, so a subgraph can contain Working, Shared Working, and Verifiable Memory at the same time."},{title:"Entities and Knowledge Assets",body:"Working Memory and Shared Working Memory contain entities. When published, an assertion/triple bundle is anchored as a Knowledge Asset in Verifiable Memory, giving included entities on-chain provenance."},{title:"Assertions",body:"Assertions are batches of triples that explain how entities entered or moved through the Context Graph. They are useful for reviewing provenance and lifecycle state."},{title:"Roles",body:"A curator controls access and publication policy. A participant can collaborate inside the Context Graph according to that policy."}];function H8(){const e=gn(n=>n.closeTab),t=Je.useCallback(()=>e(Mv),[e]);return Je.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),l.jsxs("div",{className:"v10-primer-view",children:[l.jsxs("header",{className:"v10-primer-header",children:[l.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),l.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),l.jsx("h1",{children:"What is a Context Graph?"}),l.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),l.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[l.jsx("span",{className:"wm",children:"Working Memory"}),l.jsx("span",{className:"connector","aria-hidden":"true"}),l.jsx("span",{className:"swm",children:"Shared Working Memory"}),l.jsx("span",{className:"connector","aria-hidden":"true"}),l.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),l.jsx("div",{className:"v10-primer-sections",children:q8.map(n=>l.jsxs("section",{className:"v10-primer-section",children:[l.jsx("h2",{children:n.title}),l.jsx("p",{children:n.body})]},n.title))})]})}const G8={"application/pdf":"pdf","application/json":"text","text/plain":"text","text/csv":"text","text/markdown":"markdown","image/png":"image","image/jpeg":"image","image/gif":"image","image/webp":"image"};function Tk(e){const t=G8[e];return t?t==="markdown"?"text":t:"binary"}async function Rk(e){const t=await fetch(e,{headers:Bt()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function V8({open:e,onClose:t,assertionName:n,contextGraphId:r,subGraphName:i}){const[o,c]=w.useState(null),[d,p]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(!0),[b,k]=w.useState(null);w.useEffect(()=>{if(e)return v(!0),k(null),c(null),p(null),g(null),OO(n,r,i).then(async O=>{c(O);const M=Tk(O.detectedContentType),T=pd(O.fileHash,O.detectedContentType);if(M==="text"){const L=await fetch(T,{headers:Bt()});L.ok&&p(await L.text())}else if(M==="pdf"||M==="image"){const L=await Rk(T);g(L)}}).catch(O=>k(O.message??"Failed to load file info")).finally(()=>v(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,r,i]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:C}=ls(e,t);if(!e)return null;const S=o?Tk(o.detectedContentType):null,N=o?pd(o.fileHash,o.detectedContentType):null,A=async(O,M)=>{try{const T=await Rk(O),L=document.createElement("a");L.href=T,L.download=M,L.click(),URL.revokeObjectURL(T)}catch{window.open(O,"_blank")}};return l.jsx("div",{className:"v10-modal-overlay",onClick:C,role:"presentation",children:l.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[l.jsxs("div",{className:"v10-modal-header",children:[l.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:n}),l.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),m&&l.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),b&&l.jsxs("div",{className:"v10-file-preview-error",children:[l.jsx("p",{children:b}),l.jsx("p",{style:{fontSize:11,marginTop:4},children:"File preview requires the extraction status to still be cached on the node. If the node was restarted, the preview metadata may be unavailable."})]}),o&&!m&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"v10-file-preview-meta",children:[l.jsx("span",{className:"v10-file-preview-meta-item",children:o.detectedContentType}),l.jsxs("span",{className:"v10-file-preview-meta-item",children:[o.tripleCount," triples extracted"]}),l.jsx("span",{className:"v10-file-preview-meta-item",children:o.pipelineUsed}),o.completedAt&&l.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(o.completedAt).toLocaleString()})]}),l.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&l.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&l.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&l.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&l.jsxs("div",{className:"v10-file-preview-binary",children:[l.jsx("p",{children:"This file type cannot be previewed directly."}),N&&l.jsx("button",{className:"v10-file-preview-download",onClick:()=>A(N,n),children:"Download file"})]})]}),l.jsxs("div",{className:"v10-file-preview-footer",children:[N&&l.jsx("button",{className:"v10-file-preview-download",onClick:()=>A(N,n),children:"Download original"}),o.mdIntermediateHash&&l.jsx("button",{className:"v10-file-preview-download",onClick:()=>A(pd(o.mdIntermediateHash,"text/markdown"),`${n}.md`),children:"Download markdown intermediate"})]})]})]})})}const W8=w.lazy(()=>kt(()=>import("./index-UAg6wmCv.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),Z8=w.lazy(()=>kt(()=>import("./index-UAg6wmCv.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),Q8=w.lazy(()=>kt(()=>import("./OnChainProvenanceCard-DISbYKx1.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),K8={wm:{label:"Working Memory",color:"var(--layer-working)",icon:"◇",description:"Private agent drafts. Fast local storage."},swm:{label:"Shared Working Memory",color:"var(--layer-shared)",icon:"◈",description:"Shared proposals with collaborators. TTL-bounded."},vm:{label:"Verifiable Memory",color:"var(--layer-verified)",icon:"◉",description:"Endorsed, published, on-chain knowledge."}},Y8={labelMode:"humanized",renderer:"2d",labels:cf({extraPredicates:["http://schema.org/text"]}),style:{classColors:{"http://schema.org/Person":"#f472b6","http://schema.org/Organization":"#fb923c","http://schema.org/Place":"#34d399","http://schema.org/Product":"#c084fc","http://schema.org/Event":"#facc15","http://schema.org/CreativeWork":"#7dd3fc","http://schema.org/Thing":"#94a3b8"},defaultNodeColor:"#94a3b8",defaultEdgeColor:"#5f8598",edgeWidth:.9},hexagon:{baseSize:4,minSize:3,maxSize:6,scaleWithDegree:!0},focus:{maxNodes:3e3,hops:999}},X8=l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),l.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),l.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),l.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),J8=l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("circle",{cx:"6",cy:"6",r:"3"}),l.jsx("circle",{cx:"18",cy:"6",r:"3"}),l.jsx("circle",{cx:"6",cy:"18",r:"3"}),l.jsx("circle",{cx:"18",cy:"18",r:"3"}),l.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),l.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function jm({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:r,queryPresetOptions:i}){var He,ke;const o=K8[e],[c,d]=w.useState("graph"),[p,h]=w.useState(""),[g,m]=w.useState(""),[v,b]=w.useState(""),[k,j]=w.useState(""),[C,S]=w.useState("any"),[N,A]=w.useState(50),[O,M]=w.useState(""),[T,L]=w.useState("any"),[B,_]=w.useState(50),[R,z]=w.useState(e!=="vm"),F=Je.useRef(e);Je.useEffect(()=>{F.current!==e&&(F.current=e,h(""),z(e!=="vm"),m(""),b(""),j(""),S("any"),A(50),M(""),L("any"),_(50))},[e]),Je.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,r]);const Y=w.useMemo(()=>e==="wm"?`SELECT ?s ?p ?o WHERE { GRAPH <${`did:dkg:context-graph:${t}/_meta`}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" } GRAPH ?g { ?s ?p ?o } FILTER(!CONTAINS(STR(?g), "/meta/assertion/")) } LIMIT 1000`:e==="vm"?n9({query:O,field:T,limit:B}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,T,B,O]),D=v||Y,q=e==="swm"?"_shared_memory":void 0,G=e==="swm",W=e==="vm"?"verifiable-memory":void 0,Q=e==="wm"&&D===Y,{data:H,loading:$,error:U,refresh:Z}=vr(()=>gr(D,{contextGraphId:t,includeSharedMemory:G,graphSuffix:q,view:W,includeContextGraphPartitions:Q}),[D,t,G,q,W,Q],0);_o(t,Z,{layers:[e]});const{data:I}=vr(av,[],3e4),ae=I==null?void 0:I.blockExplorerUrl,le=w.useCallback(()=>{const ve=g.trim();if(ve===v){Z();return}b(ve)},[v,g,Z]),oe=w.useCallback(()=>{const ve=k!==O||C!==T||N!==B;if(ve&&(M(k),L(C),_(N)),v){b("");return}ve||Z()},[v,T,B,O,C,N,k,Z]),we=((He=H==null?void 0:H.result)==null?void 0:He.bindings)??((ke=H==null?void 0:H.results)==null?void 0:ke.bindings)??[],Ee=w.useMemo(()=>we.map(ve=>({subject:oo(ve.s)??"",predicate:oo(ve.p)??"",object:oo(ve.o)??""})).filter(ve=>ve.subject&&ve.predicate&&ve.object),[we]),Oe=w.useCallback(ve=>{ve!=null&&ve.id&&b(`SELECT (<${ve.id}> AS ?s) ?p ?o WHERE { <${ve.id}> ?p ?o } LIMIT 100`)},[]);return l.jsxs("div",{className:"v10-memory-layer-view",children:[l.jsxs("div",{className:"v10-mlv-header",children:[l.jsx("span",{className:"v10-mlv-icon",style:{color:o.color},children:o.icon}),l.jsxs("div",{children:[l.jsx("h2",{className:"v10-mlv-title",children:o.label}),l.jsx("p",{className:"v10-mlv-desc",children:o.description})]})]}),e==="wm"&&l.jsx(e9,{contextGraphId:t,onPromoted:Z}),e==="swm"&&l.jsx(t9,{contextGraphId:t,onPublished:Z}),e==="vm"&&l.jsxs("div",{className:"v10-vm-search-panel",children:[l.jsxs("div",{className:"v10-vm-search-header",children:[l.jsxs("div",{children:[l.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),l.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),l.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>z(ve=>!ve),children:R?"Hide SPARQL":"Advanced SPARQL"})]}),l.jsxs("div",{className:"v10-vm-search-controls",children:[l.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:k,onChange:ve=>j(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&oe()}}),l.jsxs("select",{className:"v10-vm-search-select",value:C,onChange:ve=>S(ve.target.value),children:[l.jsx("option",{value:"any",children:"Any field"}),l.jsx("option",{value:"subject",children:"Subject"}),l.jsx("option",{value:"predicate",children:"Predicate"}),l.jsx("option",{value:"object",children:"Object"})]}),l.jsxs("select",{className:"v10-vm-search-select",value:String(N),onChange:ve=>A(Number.parseInt(ve.target.value,10)||50),children:[l.jsx("option",{value:"25",children:"25 rows"}),l.jsx("option",{value:"50",children:"50 rows"}),l.jsx("option",{value:"100",children:"100 rows"}),l.jsx("option",{value:"200",children:"200 rows"})]}),l.jsx("button",{className:"v10-mlv-run-btn",onClick:oe,children:"Search"})]})]}),(e!=="vm"||R)&&l.jsxs("div",{className:"v10-mlv-query-bar",children:[i!=null&&i.length?l.jsxs("select",{className:"v10-vm-search-select",value:p,onChange:ve=>{const Re=ve.target.value;h(Re);const Ge=i.find(de=>de.label===Re),We=(Ge==null?void 0:Ge.query)??"";m(We),b(We)},children:[l.jsx("option",{value:"",children:"Select common query..."}),i.map(ve=>l.jsx("option",{value:ve.label,children:ve.label},ve.label))]}):l.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:g,onChange:ve=>m(ve.target.value),onKeyDown:ve=>{ve.key==="Enter"&&le()}}),l.jsx("button",{className:"v10-mlv-run-btn",onClick:le,children:"Run"}),v&&l.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>b(""),title:"Reset to full layer overview",children:"Reset"}),l.jsxs("div",{className:"v10-mlv-view-toggle",children:[l.jsx("button",{className:`v10-mlv-toggle-btn ${c==="table"?"active":""}`,onClick:()=>d("table"),title:"Table view",children:X8}),l.jsx("button",{className:`v10-mlv-toggle-btn ${c==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:J8})]})]}),$&&l.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),U&&l.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",U]}),!$&&we.length===0&&l.jsxs("div",{className:"v10-mlv-empty",children:[l.jsxs("p",{children:["No triples found in ",o.label.toLowerCase(),"."]}),l.jsxs("p",{style:{fontSize:11,marginTop:4},children:[e==="wm"&&"Import files or chat with your agent to generate working memory.",e==="swm"&&"Promote assertions from working memory to share with collaborators.",e==="vm"&&"Publish shared memory to create verified on-chain knowledge."]})]}),!$&&we.length>0&&c==="table"&&l.jsxs("div",{className:"v10-mlv-table-wrap",children:[l.jsxs("div",{className:"v10-mlv-result-count",children:[we.length," triples"]}),l.jsxs("table",{className:"v10-mlv-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Subject"}),l.jsx("th",{children:"Predicate"}),l.jsx("th",{children:"Object"})]})}),l.jsx("tbody",{children:we.map((ve,Re)=>l.jsxs("tr",{children:[l.jsx("td",{className:"v10-mlv-cell",children:Cm(oo(ve.s))}),l.jsx("td",{className:"v10-mlv-cell",children:Cm(oo(ve.p))}),l.jsx("td",{className:"v10-mlv-cell",children:Cm(oo(ve.o))})]},Re))})]})]}),!$&&Ee.length>0&&c==="graph"&&l.jsxs("div",{className:"v10-mlv-graph-container",children:[l.jsxs("div",{className:"v10-mlv-graph-info",children:[l.jsxs("span",{children:[Ee.length," triples"]}),v&&l.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:l.jsxs(W8,{data:Ee,format:"triples",options:Y8,style:{width:"100%",height:"100%"},onNodeClick:Oe,initialFit:!0,children:[l.jsx(Z8,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),l.jsx(Q8,{contextGraphId:t,layer:e,explorerUrl:ae})]})})]})]})}function e9({contextGraphId:e,onPromoted:t}){const{data:n,loading:r,refresh:i}=vr(()=>bo(e,"wm"),[e],0);_o(e,i,{layers:["wm"]});const[o,c]=w.useState(null),[d,p]=w.useState(null),[h,g]=w.useState(null),[m,v]=w.useState(null),b=w.useCallback(async j=>{c(j.graphUri),p(null),g(null);try{const C=await xo(e,j.name,j.subGraph?{subGraphName:j.subGraph}:{}),S=uv(j.name,C);p({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),i(),t()}catch(C){const S=wo(j.name,C);g(S?{message:S.message,kind:"not-persisted"}:{message:(C==null?void 0:C.message)??"Promote failed",kind:"other"})}finally{c(null)}},[e,i,t]),k=w.useCallback(async()=>{if(!(n!=null&&n.length))return;c("__all__"),p(null),g(null);let j=0,C=null;try{for(const A of n)C=A.name,(await xo(e,A.name,A.subGraph?{subGraphName:A.subGraph}:{})).promotedCount===0&&(j+=1);const S=n.length-j,N=j>0?` (${j} already shared or still committing)`:"";p({message:S>0?`Shared ${S} complete Knowledge Asset${S===1?"":"s"} to Shared Working Memory${N}.`:"No Knowledge Assets were newly shared — all were already in Shared Working Memory or still committing.",kind:S>0?"success":"noop"}),i(),t()}catch(S){const N=wo(C??"selected assertion",S);g(N?{message:N.message,kind:"not-persisted"}:{message:(S==null?void 0:S.message)??"Promote failed",kind:"other"})}finally{c(null)}},[n,e,i,t]);return r?l.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?l.jsxs("div",{className:"v10-assertion-list",children:[l.jsxs("div",{className:"v10-assertion-list-header",children:[l.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),l.jsx("button",{className:"v10-btn-promote-all",disabled:o!==null,onClick:k,children:o==="__all__"?"Sharing...":"Share Complete KAs → SWM"})]}),l.jsx("div",{className:"v10-assertion-items",children:n.map(j=>l.jsxs("div",{className:"v10-assertion-item",children:[l.jsxs("div",{className:"v10-assertion-item-info",children:[l.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>v({name:j.name,subGraph:j.subGraph}),children:j.name}),j.tripleCount!=null&&l.jsxs("span",{className:"v10-assertion-item-count",children:[j.tripleCount," triples"]}),j.subGraph&&l.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${j.subGraph}`,children:["› ",zv(j.subGraph,18)]})]}),l.jsx("button",{className:"v10-btn-promote",disabled:o!==null,onClick:()=>b(j),title:"Share this complete Knowledge Asset to Shared Working Memory",children:o===j.graphUri?"Promoting...":"→ SWM"})]},j.graphUri))}),d&&l.jsx("div",{className:d.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:d.message}),h&&l.jsx("div",{className:"v10-promote-result error",children:h.message}),m&&l.jsx(V8,{open:!0,onClose:()=>v(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function t9({contextGraphId:e,onPublished:t}){const{data:n,loading:r,refresh:i}=vr(()=>bo(e,"swm"),[e],0);_o(e,i,{layers:["swm"]});const[o,c]=w.useState(new Set),[d,p]=w.useState(!1),[h,g]=w.useState(null),[m,v]=w.useState(null),b=(n==null?void 0:n.map(L=>L.graphUri))??[],k=b.length>0&&b.every(L=>o.has(L)),j=w.useCallback(L=>{c(B=>{const _=new Set(B);return _.has(L)?_.delete(L):_.add(L),_})},[]),C=w.useCallback(()=>{c(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async L=>{if(L.length!==0){p(!0),g(null),v(null);try{g(await cv(e,L)),c(new Set),i(),t()}catch(B){v((B==null?void 0:B.message)??"Publish failed")}finally{p(!1)}}},[e,i,t]),N=w.useCallback(()=>{const L=(n??[]).filter(B=>o.has(B.graphUri));return S(L)},[n,o,S]),A=w.useCallback(()=>S(n??[]),[n,S]),O=(n==null?void 0:n.reduce((L,B)=>L+(B.tripleCount??0),0))??0,M=(n==null?void 0:n.filter(L=>o.has(L.graphUri)).reduce((L,B)=>L+(B.tripleCount??0),0))??0,T=!r&&(!n||n.length===0);return r?l.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):T?l.jsxs("div",{className:"v10-publish-panel",children:[l.jsx("div",{className:"v10-publish-panel-header",children:l.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),l.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):l.jsxs("div",{className:"v10-publish-panel",children:[l.jsxs("div",{className:"v10-publish-panel-header",children:[l.jsxs("span",{className:"v10-publish-panel-title",children:["Knowledge assets in Shared Working Memory (",n.length," asset",n.length===1?"":"s"," · ",O," triples)"]}),l.jsxs("div",{className:"v10-publish-panel-header-actions",children:[l.jsx("button",{className:"v10-publish-panel-refresh",onClick:i,title:"Refresh",children:"↻"}),l.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:A,children:d&&o.size===0?"Publishing...":"Publish All → VM"})]})]}),l.jsxs("div",{className:"v10-publish-select-bar",children:[l.jsxs("label",{className:"v10-publish-select-all",children:[l.jsx("input",{type:"checkbox",checked:k,onChange:C}),l.jsx("span",{children:"Select all"})]}),o.size>0&&l.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:N,children:d?"Publishing...":`Publish ${o.size} selected (${M} triples) → VM`})]}),l.jsx("div",{className:"v10-assertion-items",children:n.map(L=>l.jsxs("div",{className:`v10-assertion-item ${o.has(L.graphUri)?"selected":""}`,children:[l.jsx("label",{className:"v10-publish-entity-check",children:l.jsx("input",{type:"checkbox",checked:o.has(L.graphUri),onChange:()=>j(L.graphUri)})}),l.jsxs("div",{className:"v10-assertion-item-info",children:[l.jsx("span",{className:"v10-assertion-item-name",title:L.graphUri,children:L.name}),L.subGraph&&l.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${L.subGraph}`,children:["› ",zv(L.subGraph,18)]}),L.tripleCount!=null&&l.jsxs("span",{className:"v10-assertion-item-count",children:[L.tripleCount," triples"]})]})]},L.graphUri))}),h&&(()=>{const{published:L,total:B,partial:_,partialError:R,failures:z,sample:F,convictionCostCovered:Y}=h,D=L===B&&L>0&&_===0,q=(F==null?void 0:F.status)==="confirmed"&&!!F.txHash;return l.jsxs("div",{className:`v10-publish-result-card ${D?"success":"error"}`,children:[l.jsx("div",{className:"v10-publish-result-title",children:L>0?`Published ${L} of ${B} knowledge asset${B===1?"":"s"} to Verifiable Memory`:"NOT published to Verifiable Memory"}),_>0&&l.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["⚠ ",_," asset",_===1?"":"s",": ",ic(R)]}),z.length>0&&l.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:[z.length," asset",z.length===1?"":"s"," could not be published — ",z[0].name,": ",z[0].error,z.length>1?` (+${z.length-1} more)`:""]}),l.jsxs("div",{className:"v10-publish-result-details",children:[(F==null?void 0:F.kaId)!=null&&l.jsxs("div",{children:[l.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",F.kaId]}),q?l.jsxs("div",{className:"v10-publish-result-tx",children:[l.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",l.jsx("span",{className:"mono",title:F.txHash,children:F.txHash}),F.blockNumber!=null&&l.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",F.blockNumber,")"]})]}):l.jsxs("div",{className:"v10-publish-result-details",children:["Verifiable Memory requires a confirmed ",l.jsx("code",{children:"KCCreated"})," event. If a publish did not land on-chain, check the node logs (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),l.jsx(nC,{convictionCostCovered:Y})]})]})})(),m&&l.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function oo(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Cm(e){if(!e)return"—";const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function n9(e){const t=Number.isFinite(e.limit)&&e.limit>0?Math.floor(e.limit):50,n=e.query.trim();if(!n)return`SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT ${t}`;const r=r9(n.toLowerCase()),i={subject:`CONTAINS(LCASE(STR(?s)), "${r}")`,predicate:`CONTAINS(LCASE(STR(?p)), "${r}")`,object:`CONTAINS(LCASE(STR(?o)), "${r}")`};return`SELECT ?s ?p ?o WHERE { ?s ?p ?o . FILTER(${e.field==="any"?`(${i.subject} || ${i.predicate} || ${i.object})`:i[e.field]}) } LIMIT ${t}`}function r9(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const $N=[{key:"working",title:"Working Memory",short:"WM",icon:"◇",color:"#64748b",desc:"Private agent drafts",tabPrefix:"wm"},{key:"shared",title:"Shared Working Memory",short:"SWM",icon:"◈",color:"#f59e0b",desc:"Team proposals",tabPrefix:"swm"},{key:"verified",title:"Verifiable Memory",short:"VM",icon:"◉",color:"#22c55e",desc:"On-chain knowledge",tabPrefix:"vm"}],a9=["http://purl.org/dc/terms/created","http://dkg.io/ontology/github/mergedAt","http://dkg.io/ontology/github/closedAt","http://dkg.io/ontology/decisions/date","http://dkg.io/ontology/tasks/dueDate"];function i9(){const{contextGraphs:e}=Mr(),{hidden:t}=kv(),n=w.useMemo(()=>e.filter(r=>!t.has(r.id)),[e,t]);return l.jsxs("div",{className:"v10-memstack",children:[l.jsxs("div",{className:"v10-memstack-head",children:[l.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),l.jsxs("p",{className:"v10-memstack-sub",children:["Every layer across every context graph, at a glance. ",n.length," visible context graph",n.length===1?"":"s"," · hidden context graphs are skipped."]})]}),n.length===0?l.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):l.jsxs("div",{className:"v10-memstack-table",children:[l.jsxs("div",{className:"v10-memstack-colheads",children:[l.jsx("div",{className:"v10-memstack-colhead project"}),$N.map(r=>l.jsxs("div",{className:"v10-memstack-colhead",style:{color:r.color},children:[l.jsx("span",{className:"v10-memstack-colhead-icon",children:r.icon}),l.jsx("span",{className:"v10-memstack-colhead-title",children:r.title}),l.jsx("span",{className:"v10-memstack-colhead-desc",children:r.desc})]},r.key))]}),n.map(r=>l.jsx(s9,{cg:r},r.id))]})]})}function s9({cg:e}){const t=Cv(e.id),{openTab:n}=gn(),r=CC(t),i=w.useMemo(()=>{const c={working:{entities:[],tripleCount:r.wm},shared:{entities:[],tripleCount:r.swm},verified:{entities:[],tripleCount:r.vm}};for(const d of t.entityList)c[d.trustLevel].entities.push(d);for(const d of Object.keys(c))c[d].entities.sort((p,h)=>{const g=jg(p),m=jg(h);return g&&m?m-g:g?-1:m?1:p.label.localeCompare(h.label)});return c},[t.entityList,r]),o=()=>n({id:`project:${e.id}`,label:e.name||e.id.slice(0,16),closable:!0});return l.jsxs("div",{className:"v10-memstack-row",children:[l.jsxs("div",{className:"v10-memstack-project",children:[l.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:o,children:[l.jsx("span",{className:"v10-memstack-project-dot"}),l.jsx("span",{className:"v10-memstack-project-name",children:e.name||e.id})]}),e.description&&l.jsx("div",{className:"v10-memstack-project-desc",title:e.description,children:e.description}),t.loading&&!t.entityList.length&&l.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),t.error&&l.jsx("div",{className:"v10-memstack-project-status error",children:t.error})]}),$N.map(c=>{const d=i[c.key];return l.jsx(o9,{cgId:e.id,color:c.color,layerTitle:c.title,tabPrefix:c.tabPrefix,entityCount:d.entities.length,tripleCount:d.tripleCount,recent:d.entities.slice(0,4),onOpenLayer:()=>n({id:`${c.tabPrefix}:${e.id}`,label:`${c.short} · ${e.name||e.id.slice(0,12)}`,closable:!0})},c.key)})]})}function o9({cgId:e,color:t,layerTitle:n,tabPrefix:r,entityCount:i,tripleCount:o,recent:c,onOpenLayer:d}){const p=i===0;return l.jsxs("div",{className:`v10-memstack-cell${p?" empty":""}`,style:{"--cell-color":t},children:[l.jsxs("div",{className:"v10-memstack-cell-stats",children:[l.jsx("span",{className:"v10-memstack-cell-n",children:i}),l.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",i===1?"y":"ies"]}),l.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),l.jsx("span",{className:"v10-memstack-cell-t",children:o.toLocaleString()}),l.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),c.length>0?l.jsx("ul",{className:"v10-memstack-cell-recent",children:c.map(h=>l.jsxs("li",{className:"v10-memstack-cell-recent-item",title:h.label,children:[l.jsx("span",{className:"v10-memstack-cell-recent-bullet"}),l.jsx("span",{className:"v10-memstack-cell-recent-label",children:h.label}),l.jsx("span",{className:"v10-memstack-cell-recent-time",children:$C(l9(h))})]},h.uri))}):l.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",r.toUpperCase()," yet"]}),!p&&l.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",r.toUpperCase()," →"]})]})}function jg(e){var t;for(const n of a9){const r=(t=e.properties.get(n))==null?void 0:t[0];if(!r)continue;const i=new Date(r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(i.getTime()))return i.getTime()}return null}function l9(e){const t=jg(e);return t?new Date(t):null}function c9(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const u9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,d9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f9={};function _k(e,t){return(f9.jsx?d9:u9).test(e)}const p9=/[ \t\n\f\r]/g;function h9(e){return typeof e=="object"?e.type==="text"?Ok(e.value):!1:Ok(e)}function Ok(e){return e.replace(p9,"")===""}class Cc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cc.prototype.normal={};Cc.prototype.property={};Cc.prototype.space=void 0;function PN(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cc(n,r,t)}function Cg(e){return e.toLowerCase()}class rr{constructor(t,n){this.attribute=n,this.property=t}}rr.prototype.attribute="";rr.prototype.booleanish=!1;rr.prototype.boolean=!1;rr.prototype.commaOrSpaceSeparated=!1;rr.prototype.commaSeparated=!1;rr.prototype.defined=!1;rr.prototype.mustUseProperty=!1;rr.prototype.number=!1;rr.prototype.overloadedBoolean=!1;rr.prototype.property="";rr.prototype.spaceSeparated=!1;rr.prototype.space=void 0;let m9=0;const st=ys(),cn=ys(),Ng=ys(),je=ys(),zt=ys(),yo=ys(),mr=ys();function ys(){return 2**++m9}const Eg=Object.freeze(Object.defineProperty({__proto__:null,boolean:st,booleanish:cn,commaOrSpaceSeparated:mr,commaSeparated:yo,number:je,overloadedBoolean:Ng,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Nm=Object.keys(Eg);class Kv extends rr{constructor(t,n,r,i){let o=-1;if(super(t,n),Mk(this,"space",i),typeof r=="number")for(;++o<Nm.length;){const c=Nm[o];Mk(this,Nm[o],(r&Eg[c])===Eg[c])}}}Kv.prototype.defined=!0;function Mk(e,t,n){n&&(e[t]=n)}function Lo(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const o=new Kv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Cg(r)]=r,n[Cg(o.attribute)]=r}return new Cc(t,n,e.space)}const UN=Lo({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:zt,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:je,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:zt,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:cn,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function BN(e,t){return t in e?e[t]:t}function FN(e,t){return BN(e,t.toLowerCase())}const g9=Lo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yo,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:st,allowPaymentRequest:st,allowUserMedia:st,alt:null,as:null,async:st,autoCapitalize:null,autoComplete:zt,autoFocus:st,autoPlay:st,blocking:zt,capture:null,charSet:null,checked:st,cite:null,className:zt,cols:je,colSpan:null,content:null,contentEditable:cn,controls:st,controlsList:zt,coords:je|yo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:st,defer:st,dir:null,dirName:null,disabled:st,download:Ng,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:st,formTarget:null,headers:zt,height:je,hidden:Ng,high:je,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:st,inputMode:null,integrity:null,is:null,isMap:st,itemId:null,itemProp:zt,itemRef:zt,itemScope:st,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:st,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:st,muted:st,name:null,nonce:null,noModule:st,noValidate:st,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:st,optimum:je,pattern:null,ping:zt,placeholder:null,playsInline:st,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:st,referrerPolicy:null,rel:zt,required:st,reversed:st,rows:je,rowSpan:je,sandbox:zt,scope:null,scoped:st,seamless:st,selected:st,shadowRootClonable:st,shadowRootDelegatesFocus:st,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:st,useMap:null,value:cn,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:st,declare:st,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:st,noHref:st,noShade:st,noWrap:st,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:st,disableRemotePlayback:st,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:FN}),v9=Lo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:mr,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:zt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:st,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yo,g2:yo,glyphName:yo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:je,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:mr,rev:mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:mr,requiredFeatures:mr,requiredFonts:mr,requiredFormats:mr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:mr,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:BN}),qN=Lo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),HN=Lo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:FN}),GN=Lo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),y9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},b9=/[A-Z]/g,Lk=/-[a-z]/g,x9=/^data[-\w.:]+$/i;function w9(e,t){const n=Cg(t);let r=t,i=rr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&x9.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Lk,S9);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Lk.test(o)){let c=o.replace(b9,k9);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}i=Kv}return new i(r,t)}function k9(e){return"-"+e.toLowerCase()}function S9(e){return e.charAt(1).toUpperCase()}const j9=PN([UN,g9,qN,HN,GN],"html"),Yv=PN([UN,v9,qN,HN,GN],"svg");function C9(e){return e.join(" ").trim()}var lo={},Em,Ik;function N9(){if(Ik)return Em;Ik=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,p=`
|
|
1609
|
+
`,h="/",g="*",m="",v="comment",b="declaration";function k(C,S){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];S=S||{};var N=1,A=1;function O(D){var q=D.match(t);q&&(N+=q.length);var G=D.lastIndexOf(p);A=~G?D.length-G:A+D.length}function M(){var D={line:N,column:A};return function(q){return q.position=new T(D),_(),q}}function T(D){this.start=D,this.end={line:N,column:A},this.source=S.source}T.prototype.content=C;function L(D){var q=new Error(S.source+":"+N+":"+A+": "+D);if(q.reason=D,q.filename=S.source,q.line=N,q.column=A,q.source=C,!S.silent)throw q}function B(D){var q=D.exec(C);if(q){var G=q[0];return O(G),C=C.slice(G.length),q}}function _(){B(n)}function R(D){var q;for(D=D||[];q=z();)q!==!1&&D.push(q);return D}function z(){var D=M();if(!(h!=C.charAt(0)||g!=C.charAt(1))){for(var q=2;m!=C.charAt(q)&&(g!=C.charAt(q)||h!=C.charAt(q+1));)++q;if(q+=2,m===C.charAt(q-1))return L("End of comment missing");var G=C.slice(2,q-2);return A+=2,O(G),C=C.slice(q),A+=2,D({type:v,comment:G})}}function F(){var D=M(),q=B(r);if(q){if(z(),!B(i))return L("property missing ':'");var G=B(o),W=D({type:b,property:j(q[0].replace(e,m)),value:G?j(G[0].replace(e,m)):m});return B(c),W}}function Y(){var D=[];R(D);for(var q;q=F();)q!==!1&&(D.push(q),R(D));return D}return _(),Y()}function j(C){return C?C.replace(d,m):m}return Em=k,Em}var Dk;function E9(){if(Dk)return lo;Dk=1;var e=lo&&lo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lo,"__esModule",{value:!0}),lo.default=n;const t=e(N9());function n(r,i){let o=null;if(!r||typeof r!="string")return o;const c=(0,t.default)(r),d=typeof i=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:h,value:g}=p;d?i(h,g,p):g&&(o=o||{},o[h]=g)}),o}return lo}var zl={},zk;function A9(){if(zk)return zl;zk=1,Object.defineProperty(zl,"__esModule",{value:!0}),zl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},c=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},p=function(h,g){return g===void 0&&(g={}),o(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(i,d):h=h.replace(r,d),h.replace(t,c))};return zl.camelCase=p,zl}var $l,$k;function T9(){if($k)return $l;$k=1;var e=$l&&$l.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(E9()),n=A9();function r(i,o){var c={};return!i||typeof i!="string"||(0,t.default)(i,function(d,p){d&&p&&(c[(0,n.camelCase)(d,o)]=p)}),c}return r.default=r,$l=r,$l}var R9=T9();const _9=mc(R9),VN=WN("end"),Xv=WN("start");function WN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function O9(e){const t=Xv(e),n=VN(e);if(t&&n)return{start:t,end:n}}function Jl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pk(e.position):"start"in e||"end"in e?Pk(e):"line"in e||"column"in e?Ag(e):""}function Ag(e){return Uk(e&&e.line)+":"+Uk(e&&e.column)}function Pk(e){return Ag(e&&e.start)+"-"+Ag(e&&e.end)}function Uk(e){return e&&typeof e=="number"?e:1}class On extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",o={},c=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?i=t:!o.cause&&t&&(c=!0,i=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const p=r.indexOf(":");p===-1?o.ruleId=r:(o.source=r.slice(0,p),o.ruleId=r.slice(p+1))}if(!o.place&&o.ancestors&&o.ancestors){const p=o.ancestors[o.ancestors.length-1];p&&(o.place=p.position)}const d=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=d?d.line:void 0,this.name=Jl(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=c&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}On.prototype.file="";On.prototype.name="";On.prototype.reason="";On.prototype.message="";On.prototype.stack="";On.prototype.column=void 0;On.prototype.line=void 0;On.prototype.ancestors=void 0;On.prototype.cause=void 0;On.prototype.fatal=void 0;On.prototype.place=void 0;On.prototype.ruleId=void 0;On.prototype.source=void 0;const Jv={}.hasOwnProperty,M9=new Map,L9=/[A-Z]/g,I9=new Set(["table","tbody","thead","tfoot","tr"]),D9=new Set(["td","th"]),ZN="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function z9(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=G9(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=H9(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Yv:j9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=QN(i,e,void 0);return o&&typeof o!="string"?o:i.create(e,i.Fragment,{children:o||void 0},void 0)}function QN(e,t,n){if(t.type==="element")return $9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return P9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return B9(e,t,n);if(t.type==="mdxjsEsm")return U9(e,t);if(t.type==="root")return F9(e,t,n);if(t.type==="text")return q9(e,t)}function $9(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Yv,e.schema=i),e.ancestors.push(t);const o=YN(e,t.tagName,!1),c=V9(e,t);let d=ty(e,t);return I9.has(t.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!h9(p):!0})),KN(e,c,o,t),ey(c,d),e.ancestors.pop(),e.schema=r,e.create(t,o,c,n)}function P9(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}fc(e,t.position)}function U9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fc(e,t.position)}function B9(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Yv,e.schema=i),e.ancestors.push(t);const o=t.name===null?e.Fragment:YN(e,t.name,!0),c=W9(e,t),d=ty(e,t);return KN(e,c,o,t),ey(c,d),e.ancestors.pop(),e.schema=r,e.create(t,o,c,n)}function F9(e,t,n){const r={};return ey(r,ty(e,t)),e.create(t,e.Fragment,r,n)}function q9(e,t){return t.value}function KN(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ey(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function H9(e,t,n){return r;function r(i,o,c,d){const h=Array.isArray(c.children)?n:t;return d?h(o,c,d):h(o,c)}}function G9(e,t){return n;function n(r,i,o,c){const d=Array.isArray(o.children),p=Xv(r);return t(i,o,c,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function V9(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Jv.call(t.properties,i)){const o=Z9(e,i,t.properties[i]);if(o){const[c,d]=o;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&D9.has(t.tagName)?r=d:n[c]=d}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function W9(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const c=o.expression;c.type;const d=c.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else fc(e,t.position);else{const i=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,o=e.evaluater.evaluateExpression(d.expression)}else fc(e,t.position);else o=r.value===null?!0:r.value;n[i]=o}return n}function ty(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:M9;for(;++r<t.children.length;){const o=t.children[r];let c;if(e.passKeys){const p=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(p){const h=i.get(p)||0;c=p+"-"+h,i.set(p,h+1)}}const d=QN(e,o,c);d!==void 0&&n.push(d)}return n}function Z9(e,t,n){const r=w9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?c9(n):C9(n)),r.property==="style"){let i=typeof n=="object"?n:Q9(e,String(n));return e.stylePropertyNameCase==="css"&&(i=K9(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?y9[r.property]||r.property:r.attribute,n]}}function Q9(e,t){try{return _9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new On("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=ZN+"#cannot-parse-style-attribute",i}}function YN(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let o=-1,c;for(;++o<i.length;){const d=_k(i[o])?{type:"Identifier",name:i[o]}:{type:"Literal",value:i[o]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(o&&d.type==="Literal"),optional:!1}:d}r=c}else r=_k(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Jv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);fc(e)}function fc(e,t){const n=new On("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ZN+"#cannot-handle-mdx-estrees-without-createevaluater",n}function K9(e){const t={};let n;for(n in e)Jv.call(e,n)&&(t[Y9(n)]=e[n]);return t}function Y9(e){let t=e.replace(L9,X9);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function X9(e){return"-"+e.toLowerCase()}const Am={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},J9={};function ny(e,t){const n=J9,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return XN(e,r,i)}function XN(e,t,n){if(eB(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Bk(e.children,t,n)}return Array.isArray(e)?Bk(e,t,n):""}function Bk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=XN(e[i],t,n);return r.join("")}function eB(e){return!!(e&&typeof e=="object")}const Fk=document.createElement("i");function ry(e){const t="&"+e+";";Fk.innerHTML=t;const n=Fk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yr(e,t,n,r){const i=e.length;let o=0,c;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)c=Array.from(r),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);o<r.length;)c=r.slice(o,o+1e4),c.unshift(t,0),e.splice(...c),o+=1e4,t+=1e4}function Or(e,t){return e.length>0?(yr(e,e.length,0,t),e):t}const qk={}.hasOwnProperty;function JN(e){const t={};let n=-1;for(;++n<e.length;)tB(t,e[n]);return t}function tB(e,t){let n;for(n in t){const i=(qk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let c;if(o)for(c in o){qk.call(i,c)||(i[c]=[]);const d=o[c];nB(i[c],Array.isArray(d)?d:d?[d]:[])}}}function nB(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yr(e,0,0,r)}function eE(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function qr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fn=Oi(/[A-Za-z]/),_n=Oi(/[\dA-Za-z]/),rB=Oi(/[#-'*+\--9=?A-Z^-~]/);function Gd(e){return e!==null&&(e<32||e===127)}const Tg=Oi(/\d/),aB=Oi(/[\dA-Fa-f]/),iB=Oi(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function dt(e){return e===-2||e===-1||e===32}const yf=Oi(new RegExp("\\p{P}|\\p{S}","u")),ps=Oi(/\s/);function Oi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Io(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const o=e.charCodeAt(n);let c="";if(o===37&&_n(e.charCodeAt(n+1))&&_n(e.charCodeAt(n+2)))i=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(c=String.fromCharCode(o));else if(o>55295&&o<57344){const d=e.charCodeAt(n+1);o<56320&&d>56319&&d<57344?(c=String.fromCharCode(o,d),i=1):c="�"}else c=String.fromCharCode(o);c&&(t.push(e.slice(r,n),encodeURIComponent(c)),r=n+i+1,c=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function vt(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let o=0;return c;function c(p){return dt(p)?(e.enter(n),d(p)):t(p)}function d(p){return dt(p)&&o++<i?(e.consume(p),d):(e.exit(n),t(p))}}const sB={tokenize:oB};function oB(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),vt(e,t,"linePrefix")}function i(d){return e.enter("paragraph"),o(d)}function o(d){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Fe(d)?(e.consume(d),e.exit("chunkText"),o):(e.consume(d),c)}}const lB={tokenize:cB},Hk={tokenize:uB};function cB(e){const t=this,n=[];let r=0,i,o,c;return d;function d(A){if(r<n.length){const O=n[r];return t.containerState=O[1],e.attempt(O[0].continuation,p,h)(A)}return h(A)}function p(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&N();const O=t.events.length;let M=O,T;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){T=t.events[M][1].end;break}S(r);let L=O;for(;L<t.events.length;)t.events[L][1].end={...T},L++;return yr(t.events,M+1,0,t.events.slice(O)),t.events.length=L,h(A)}return d(A)}function h(A){if(r===n.length){if(!i)return v(A);if(i.currentConstruct&&i.currentConstruct.concrete)return k(A);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Hk,g,m)(A)}function g(A){return i&&N(),S(r),v(A)}function m(A){return t.parser.lazy[t.now().line]=r!==n.length,c=t.now().offset,k(A)}function v(A){return t.containerState={},e.attempt(Hk,b,k)(A)}function b(A){return r++,n.push([t.currentConstruct,t.containerState]),v(A)}function k(A){if(A===null){i&&N(),S(0),e.consume(A);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:o}),j(A)}function j(A){if(A===null){C(e.exit("chunkFlow"),!0),S(0),e.consume(A);return}return Fe(A)?(e.consume(A),C(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(A),j)}function C(A,O){const M=t.sliceStream(A);if(O&&M.push(null),A.previous=o,o&&(o.next=A),o=A,i.defineSkip(A.start),i.write(M),t.parser.lazy[A.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<c&&(!i.events[T][1].end||i.events[T][1].end.offset>c))return;const L=t.events.length;let B=L,_,R;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(_){R=t.events[B][1].end;break}_=!0}for(S(r),T=L;T<t.events.length;)t.events[T][1].end={...R},T++;yr(t.events,B+1,0,t.events.slice(L)),t.events.length=T}}function S(A){let O=n.length;for(;O-- >A;){const M=n[O];t.containerState=M[1],M[0].exit.call(t,e)}n.length=A}function N(){i.write([null]),o=void 0,i=void 0,t.containerState._closeFlow=void 0}}function uB(e,t,n){return vt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function jo(e){if(e===null||Dt(e)||ps(e))return 1;if(yf(e))return 2}function bf(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const o=e[i].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Rg={name:"attention",resolveAll:dB,tokenize:fB};function dB(e,t){let n=-1,r,i,o,c,d,p,h,g;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const m={...e[r][1].end},v={...e[n][1].start};Gk(m,-p),Gk(v,p),c={type:p>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},d={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:v},o={type:p>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:p>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[r][1].end={...c.start},e[n][1].start={...d.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Or(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Or(h,[["enter",i,t],["enter",c,t],["exit",c,t],["enter",o,t]]),h=Or(h,bf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),h=Or(h,[["exit",o,t],["enter",d,t],["exit",d,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Or(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,yr(e,r-1,n-r+3,h),n=r+h.length-g-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function fB(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=jo(r);let o;return c;function c(p){return o=p,e.enter("attentionSequence"),d(p)}function d(p){if(p===o)return e.consume(p),d;const h=e.exit("attentionSequence"),g=jo(p),m=!g||g===2&&i||n.includes(p),v=!i||i===2&&g||n.includes(r);return h._open=!!(o===42?m:m&&(i||!v)),h._close=!!(o===42?v:v&&(g||!m)),t(p)}}function Gk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const pB={name:"autolink",tokenize:hB};function hB(e,t,n){let r=0;return i;function i(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(b){return Fn(b)?(e.consume(b),c):b===64?n(b):h(b)}function c(b){return b===43||b===45||b===46||_n(b)?(r=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),r=0,p):(b===43||b===45||b===46||_n(b))&&r++<32?(e.consume(b),d):(r=0,h(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Gd(b)?n(b):(e.consume(b),p)}function h(b){return b===64?(e.consume(b),g):rB(b)?(e.consume(b),h):n(b)}function g(b){return _n(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),r=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):v(b)}function v(b){if((b===45||_n(b))&&r++<63){const k=b===45?v:m;return e.consume(b),k}return n(b)}}const Nc={partial:!0,tokenize:mB};function mB(e,t,n){return r;function r(o){return dt(o)?vt(e,i,"linePrefix")(o):i(o)}function i(o){return o===null||Fe(o)?t(o):n(o)}}const tE={continuation:{tokenize:vB},exit:yB,name:"blockQuote",tokenize:gB};function gB(e,t,n){const r=this;return i;function i(c){if(c===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),o}return n(c)}function o(c){return dt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function vB(e,t,n){const r=this;return i;function i(c){return dt(c)?vt(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):o(c)}function o(c){return e.attempt(tE,t,n)(c)}}function yB(e){e.exit("blockQuote")}const nE={name:"characterEscape",tokenize:bB};function bB(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),i}function i(o){return iB(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const rE={name:"characterReference",tokenize:xB};function xB(e,t,n){const r=this;let i=0,o,c;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),p}function p(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,c=_n,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,c=aB,g):(e.enter("characterReferenceValue"),o=7,c=Tg,g(m))}function g(m){if(m===59&&i){const v=e.exit("characterReferenceValue");return c===_n&&!ry(r.sliceSerialize(v))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(m)&&i++<o?(e.consume(m),g):n(m)}}const Vk={partial:!0,tokenize:kB},Wk={concrete:!0,name:"codeFenced",tokenize:wB};function wB(e,t,n){const r=this,i={partial:!0,tokenize:M};let o=0,c=0,d;return p;function p(T){return h(T)}function h(T){const L=r.events[r.events.length-1];return o=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,d=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===d?(c++,e.consume(T),g):c<3?n(T):(e.exit("codeFencedFenceSequence"),dt(T)?vt(e,m,"whitespace")(T):m(T))}function m(T){return T===null||Fe(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(Vk,j,O)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===null||Fe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):dt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vt(e,b,"whitespace")(T)):T===96&&T===d?n(T):(e.consume(T),v)}function b(T){return T===null||Fe(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||Fe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===d?n(T):(e.consume(T),k)}function j(T){return e.attempt(i,O,C)(T)}function C(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),S}function S(T){return o>0&&dt(T)?vt(e,N,"linePrefix",o+1)(T):N(T)}function N(T){return T===null||Fe(T)?e.check(Vk,j,O)(T):(e.enter("codeFlowValue"),A(T))}function A(T){return T===null||Fe(T)?(e.exit("codeFlowValue"),N(T)):(e.consume(T),A)}function O(T){return e.exit("codeFenced"),t(T)}function M(T,L,B){let _=0;return R;function R(q){return T.enter("lineEnding"),T.consume(q),T.exit("lineEnding"),z}function z(q){return T.enter("codeFencedFence"),dt(q)?vt(T,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):F(q)}function F(q){return q===d?(T.enter("codeFencedFenceSequence"),Y(q)):B(q)}function Y(q){return q===d?(_++,T.consume(q),Y):_>=c?(T.exit("codeFencedFenceSequence"),dt(q)?vt(T,D,"whitespace")(q):D(q)):B(q)}function D(q){return q===null||Fe(q)?(T.exit("codeFencedFence"),L(q)):B(q)}}}function kB(e,t,n){const r=this;return i;function i(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o)}function o(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}const Tm={name:"codeIndented",tokenize:jB},SB={partial:!0,tokenize:CB};function jB(e,t,n){const r=this;return i;function i(h){return e.enter("codeIndented"),vt(e,o,"linePrefix",5)(h)}function o(h){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?c(h):n(h)}function c(h){return h===null?p(h):Fe(h)?e.attempt(SB,c,p)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Fe(h)?(e.exit("codeFlowValue"),c(h)):(e.consume(h),d)}function p(h){return e.exit("codeIndented"),t(h)}}function CB(e,t,n){const r=this;return i;function i(c){return r.parser.lazy[r.now().line]?n(c):Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):vt(e,o,"linePrefix",5)(c)}function o(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Fe(c)?i(c):n(c)}}const NB={name:"codeText",previous:AB,resolve:EB,tokenize:TB};function EB(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function AB(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TB(e,t,n){let r=0,i,o;return c;function c(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),r++,d):(e.exit("codeTextSequence"),p(m))}function p(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),p):m===96?(o=e.enter("codeTextSequence"),i=0,g(m)):Fe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),p):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Fe(m)?(e.exit("codeTextData"),p(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),i++,g):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(o.type="codeTextData",h(m))}}class RB{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Pl(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Pl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Pl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Pl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Pl(this.left,n.reverse())}}}function Pl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function aE(e){const t={};let n=-1,r,i,o,c,d,p,h;const g=new RB(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(r=g.get(n),n&&r[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,o=0,o<p.length&&p[o][1].type==="lineEndingBlank"&&(o+=2),o<p.length&&p[o][1].type==="content"))for(;++o<p.length&&p[o][1].type!=="content";)p[o][1].type==="chunkText"&&(p[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,_B(g,n)),n=t[n],h=!0);else if(r[1]._container){for(o=n,i=void 0;o--;)if(c=g.get(o),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(i&&(g.get(i)[1].type="lineEndingBlank"),c[1].type="lineEnding",i=o);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;i&&(r[1].end={...g.get(i)[1].start},d=g.slice(i,n),d.unshift(r),g.splice(i,n-i+1,d))}}return yr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function _B(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const o=[];let c=n._tokenizer;c||(c=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,p=[],h={};let g,m,v=-1,b=n,k=0,j=0;const C=[j];for(;b;){for(;e.get(++i)[1]!==b;);o.push(i),b._tokenizer||(g=r.sliceStream(b),b.next||g.push(null),m&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(g),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(j=v+1,C.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),v=C.length;v--;){const S=d.slice(C[v],C[v+1]),N=o.pop();p.push([N,N+S.length-1]),e.splice(N,2,S)}for(p.reverse(),v=-1;++v<p.length;)h[k+p[v][0]]=k+p[v][1],k+=p[v][1]-p[v][0]-1;return h}const OB={resolve:LB,tokenize:IB},MB={partial:!0,tokenize:DB};function LB(e){return aE(e),e}function IB(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(d)}function i(d){return d===null?o(d):Fe(d)?e.check(MB,c,o)(d):(e.consume(d),i)}function o(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function DB(e,t,n){const r=this;return i;function i(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),vt(e,o,"linePrefix")}function o(c){if(c===null||Fe(c))return n(c);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):e.interrupt(r.parser.constructs.flow,n,t)(c)}}function iE(e,t,n,r,i,o,c,d,p){const h=p||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(r),e.enter(i),e.enter(o),e.consume(S),e.exit(o),v):S===null||S===32||S===41||Gd(S)?n(S):(e.enter(r),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function v(S){return S===62?(e.enter(o),e.consume(S),e.exit(o),e.exit(i),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),b(S))}function b(S){return S===62?(e.exit("chunkString"),e.exit(d),v(S)):S===null||S===60||Fe(S)?n(S):(e.consume(S),S===92?k:b)}function k(S){return S===60||S===62||S===92?(e.consume(S),b):b(S)}function j(S){return!g&&(S===null||S===41||Dt(S))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(r),t(S)):g<h&&S===40?(e.consume(S),g++,j):S===41?(e.consume(S),g--,j):S===null||S===32||S===40||Gd(S)?n(S):(e.consume(S),S===92?C:j)}function C(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function sE(e,t,n,r,i,o){const c=this;let d=0,p;return h;function h(b){return e.enter(r),e.enter(i),e.consume(b),e.exit(i),e.enter(o),g}function g(b){return d>999||b===null||b===91||b===93&&!p||b===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(o),e.enter(i),e.consume(b),e.exit(i),e.exit(r),t):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Fe(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),p||(p=!dt(b)),b===92?v:m)}function v(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function oE(e,t,n,r,i,o){let c;return d;function d(v){return v===34||v===39||v===40?(e.enter(r),e.enter(i),e.consume(v),e.exit(i),c=v===40?41:v,p):n(v)}function p(v){return v===c?(e.enter(i),e.consume(v),e.exit(i),e.exit(r),t):(e.enter(o),h(v))}function h(v){return v===c?(e.exit(o),p(c)):v===null?n(v):Fe(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),vt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===c||v===null||Fe(v)?(e.exit("chunkString"),h(v)):(e.consume(v),v===92?m:g)}function m(v){return v===c||v===92?(e.consume(v),g):g(v)}}function ec(e,t){let n;return r;function r(i){return Fe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):dt(i)?vt(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const zB={name:"definition",tokenize:PB},$B={partial:!0,tokenize:UB};function PB(e,t,n){const r=this;let i;return o;function o(b){return e.enter("definition"),c(b)}function c(b){return sE.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return i=qr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return Dt(b)?ec(e,h)(b):h(b)}function h(b){return iE(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt($B,m,m)(b)}function m(b){return dt(b)?vt(e,v,"whitespace")(b):v(b)}function v(b){return b===null||Fe(b)?(e.exit("definition"),r.parser.defined.push(i),t(b)):n(b)}}function UB(e,t,n){return r;function r(d){return Dt(d)?ec(e,i)(d):n(d)}function i(d){return oE(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function o(d){return dt(d)?vt(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Fe(d)?t(d):n(d)}}const BB={name:"hardBreakEscape",tokenize:FB};function FB(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),i}function i(o){return Fe(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const qB={name:"headingAtx",resolve:HB,tokenize:GB};function HB(e,t){let n=e.length-2,r=3,i,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yr(e,r,n-r+1,[["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t]])),e}function GB(e,t,n){let r=0;return i;function i(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),c(g)}function c(g){return g===35&&r++<6?(e.consume(g),c):g===null||Dt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),p(g)):g===null||Fe(g)?(e.exit("atxHeading"),t(g)):dt(g)?vt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function p(g){return g===35?(e.consume(g),p):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||Dt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const VB=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zk=["pre","script","style","textarea"],WB={concrete:!0,name:"htmlFlow",resolveTo:KB,tokenize:YB},ZB={partial:!0,tokenize:JB},QB={partial:!0,tokenize:XB};function KB(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function YB(e,t,n){const r=this;let i,o,c,d,p;return h;function h(I){return g(I)}function g(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),m}function m(I){return I===33?(e.consume(I),v):I===47?(e.consume(I),o=!0,j):I===63?(e.consume(I),i=3,r.interrupt?t:$):Fn(I)?(e.consume(I),c=String.fromCharCode(I),C):n(I)}function v(I){return I===45?(e.consume(I),i=2,b):I===91?(e.consume(I),i=5,d=0,k):Fn(I)?(e.consume(I),i=4,r.interrupt?t:$):n(I)}function b(I){return I===45?(e.consume(I),r.interrupt?t:$):n(I)}function k(I){const ae="CDATA[";return I===ae.charCodeAt(d++)?(e.consume(I),d===ae.length?r.interrupt?t:F:k):n(I)}function j(I){return Fn(I)?(e.consume(I),c=String.fromCharCode(I),C):n(I)}function C(I){if(I===null||I===47||I===62||Dt(I)){const ae=I===47,le=c.toLowerCase();return!ae&&!o&&Zk.includes(le)?(i=1,r.interrupt?t(I):F(I)):VB.includes(c.toLowerCase())?(i=6,ae?(e.consume(I),S):r.interrupt?t(I):F(I)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):o?N(I):A(I))}return I===45||_n(I)?(e.consume(I),c+=String.fromCharCode(I),C):n(I)}function S(I){return I===62?(e.consume(I),r.interrupt?t:F):n(I)}function N(I){return dt(I)?(e.consume(I),N):R(I)}function A(I){return I===47?(e.consume(I),R):I===58||I===95||Fn(I)?(e.consume(I),O):dt(I)?(e.consume(I),A):R(I)}function O(I){return I===45||I===46||I===58||I===95||_n(I)?(e.consume(I),O):M(I)}function M(I){return I===61?(e.consume(I),T):dt(I)?(e.consume(I),M):A(I)}function T(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),p=I,L):dt(I)?(e.consume(I),T):B(I)}function L(I){return I===p?(e.consume(I),p=null,_):I===null||Fe(I)?n(I):(e.consume(I),L)}function B(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||Dt(I)?M(I):(e.consume(I),B)}function _(I){return I===47||I===62||dt(I)?A(I):n(I)}function R(I){return I===62?(e.consume(I),z):n(I)}function z(I){return I===null||Fe(I)?F(I):dt(I)?(e.consume(I),z):n(I)}function F(I){return I===45&&i===2?(e.consume(I),G):I===60&&i===1?(e.consume(I),W):I===62&&i===4?(e.consume(I),U):I===63&&i===3?(e.consume(I),$):I===93&&i===5?(e.consume(I),H):Fe(I)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(ZB,Z,Y)(I)):I===null||Fe(I)?(e.exit("htmlFlowData"),Y(I)):(e.consume(I),F)}function Y(I){return e.check(QB,D,Z)(I)}function D(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),q}function q(I){return I===null||Fe(I)?Y(I):(e.enter("htmlFlowData"),F(I))}function G(I){return I===45?(e.consume(I),$):F(I)}function W(I){return I===47?(e.consume(I),c="",Q):F(I)}function Q(I){if(I===62){const ae=c.toLowerCase();return Zk.includes(ae)?(e.consume(I),U):F(I)}return Fn(I)&&c.length<8?(e.consume(I),c+=String.fromCharCode(I),Q):F(I)}function H(I){return I===93?(e.consume(I),$):F(I)}function $(I){return I===62?(e.consume(I),U):I===45&&i===2?(e.consume(I),$):F(I)}function U(I){return I===null||Fe(I)?(e.exit("htmlFlowData"),Z(I)):(e.consume(I),U)}function Z(I){return e.exit("htmlFlow"),t(I)}}function XB(e,t,n){const r=this;return i;function i(c){return Fe(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):n(c)}function o(c){return r.parser.lazy[r.now().line]?n(c):t(c)}}function JB(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(Nc,t,n)}}const eF={name:"htmlText",tokenize:tF};function tF(e,t,n){const r=this;let i,o,c;return d;function d($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),p}function p($){return $===33?(e.consume($),h):$===47?(e.consume($),M):$===63?(e.consume($),A):Fn($)?(e.consume($),B):n($)}function h($){return $===45?(e.consume($),g):$===91?(e.consume($),o=0,k):Fn($)?(e.consume($),N):n($)}function g($){return $===45?(e.consume($),b):n($)}function m($){return $===null?n($):$===45?(e.consume($),v):Fe($)?(c=m,W($)):(e.consume($),m)}function v($){return $===45?(e.consume($),b):m($)}function b($){return $===62?G($):$===45?v($):m($)}function k($){const U="CDATA[";return $===U.charCodeAt(o++)?(e.consume($),o===U.length?j:k):n($)}function j($){return $===null?n($):$===93?(e.consume($),C):Fe($)?(c=j,W($)):(e.consume($),j)}function C($){return $===93?(e.consume($),S):j($)}function S($){return $===62?G($):$===93?(e.consume($),S):j($)}function N($){return $===null||$===62?G($):Fe($)?(c=N,W($)):(e.consume($),N)}function A($){return $===null?n($):$===63?(e.consume($),O):Fe($)?(c=A,W($)):(e.consume($),A)}function O($){return $===62?G($):A($)}function M($){return Fn($)?(e.consume($),T):n($)}function T($){return $===45||_n($)?(e.consume($),T):L($)}function L($){return Fe($)?(c=L,W($)):dt($)?(e.consume($),L):G($)}function B($){return $===45||_n($)?(e.consume($),B):$===47||$===62||Dt($)?_($):n($)}function _($){return $===47?(e.consume($),G):$===58||$===95||Fn($)?(e.consume($),R):Fe($)?(c=_,W($)):dt($)?(e.consume($),_):G($)}function R($){return $===45||$===46||$===58||$===95||_n($)?(e.consume($),R):z($)}function z($){return $===61?(e.consume($),F):Fe($)?(c=z,W($)):dt($)?(e.consume($),z):_($)}function F($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),i=$,Y):Fe($)?(c=F,W($)):dt($)?(e.consume($),F):(e.consume($),D)}function Y($){return $===i?(e.consume($),i=void 0,q):$===null?n($):Fe($)?(c=Y,W($)):(e.consume($),Y)}function D($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||Dt($)?_($):(e.consume($),D)}function q($){return $===47||$===62||Dt($)?_($):n($)}function G($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function W($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),Q}function Q($){return dt($)?vt(e,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):H($)}function H($){return e.enter("htmlTextData"),c($)}}const ay={name:"labelEnd",resolveAll:iF,resolveTo:sF,tokenize:oF},nF={tokenize:lF},rF={tokenize:cF},aF={tokenize:uF};function iF(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&yr(e,0,e.length,n),e}function sF(e,t){let n=e.length,r=0,i,o,c,d;for(;n--;)if(i=e[n][1],o){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(o=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(c=n);const p={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[c][1].end}},g={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",p,t],["enter",h,t]],d=Or(d,e.slice(o+1,o+r+3)),d=Or(d,[["enter",g,t]]),d=Or(d,bf(t.parser.constructs.insideSpan.null,e.slice(o+r+4,c-3),t)),d=Or(d,[["exit",g,t],e[c-2],e[c-1],["exit",h,t]]),d=Or(d,e.slice(c+1)),d=Or(d,[["exit",p,t]]),yr(e,o,e.length,d),e}function oF(e,t,n){const r=this;let i=r.events.length,o,c;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){o=r.events[i][1];break}return d;function d(v){return o?o._inactive?m(v):(c=r.parser.defined.includes(qr(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),p):n(v)}function p(v){return v===40?e.attempt(nF,g,c?g:m)(v):v===91?e.attempt(rF,g,c?h:m)(v):c?g(v):m(v)}function h(v){return e.attempt(aF,g,m)(v)}function g(v){return t(v)}function m(v){return o._balanced=!0,n(v)}}function lF(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),i}function i(m){return Dt(m)?ec(e,o)(m):o(m)}function o(m){return m===41?g(m):iE(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function c(m){return Dt(m)?ec(e,p)(m):g(m)}function d(m){return n(m)}function p(m){return m===34||m===39||m===40?oE(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Dt(m)?ec(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function cF(e,t,n){const r=this;return i;function i(d){return sE.call(r,e,o,c,"reference","referenceMarker","referenceString")(d)}function o(d){return r.parser.defined.includes(qr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function c(d){return n(d)}}function uF(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),i}function i(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const dF={name:"labelStartImage",resolveAll:ay.resolveAll,tokenize:fF};function fF(e,t,n){const r=this;return i;function i(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),o}function o(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):n(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const pF={name:"labelStartLink",resolveAll:ay.resolveAll,tokenize:hF};function hF(e,t,n){const r=this;return i;function i(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),o}function o(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const Rm={name:"lineEnding",tokenize:mF};function mF(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),vt(e,t,"linePrefix")}}const kd={name:"thematicBreak",tokenize:gF};function gF(e,t,n){let r=0,i;return o;function o(h){return e.enter("thematicBreak"),c(h)}function c(h){return i=h,d(h)}function d(h){return h===i?(e.enter("thematicBreakSequence"),p(h)):r>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function p(h){return h===i?(e.consume(h),r++,p):(e.exit("thematicBreakSequence"),dt(h)?vt(e,d,"whitespace")(h):d(h))}}const Jn={continuation:{tokenize:xF},exit:kF,name:"list",tokenize:bF},vF={partial:!0,tokenize:SF},yF={partial:!0,tokenize:wF};function bF(e,t,n){const r=this,i=r.events[r.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,c=0;return d;function d(b){const k=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Tg(b)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(kd,n,h)(b):h(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return Tg(b)&&++c<10?(e.consume(b),p):(!r.interrupt||c<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(Nc,r.interrupt?n:g,e.attempt(vF,v,m))}function g(b){return r.containerState.initialBlankLine=!0,o++,v(b)}function m(b){return dt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):n(b)}function v(b){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function xF(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Nc,i,o);function i(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vt(e,t,"listItemIndent",r.containerState.size+1)(d)}function o(d){return r.containerState.furtherBlankLines||!dt(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,c(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(yF,t,c)(d))}function c(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,vt(e,e.attempt(Jn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function wF(e,t,n){const r=this;return vt(e,i,"listItemIndent",r.containerState.size+1);function i(o){const c=r.events[r.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===r.containerState.size?t(o):n(o)}}function kF(e){e.exit(this.containerState.type)}function SF(e,t,n){const r=this;return vt(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const c=r.events[r.events.length-1];return!dt(o)&&c&&c[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const Qk={name:"setextUnderline",resolveTo:jF,tokenize:CF};function jF(e,t){let n=e.length,r,i,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const c={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",o?(e.splice(i,0,["enter",c,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=c,e.push(["exit",c,t]),e}function CF(e,t,n){const r=this;let i;return o;function o(h){let g=r.events.length,m;for(;g--;)if(r.events[g][1].type!=="lineEnding"&&r.events[g][1].type!=="linePrefix"&&r.events[g][1].type!=="content"){m=r.events[g][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(e.enter("setextHeadingLine"),i=h,c(h)):n(h)}function c(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===i?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),dt(h)?vt(e,p,"lineSuffix")(h):p(h))}function p(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const NF={tokenize:EF};function EF(e){const t=this,n=e.attempt(Nc,r,e.attempt(this.parser.constructs.flowInitial,i,vt(e,e.attempt(this.parser.constructs.flow,i,e.attempt(OB,i)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const AF={resolveAll:cE()},TF=lE("string"),RF=lE("text");function lE(e){return{resolveAll:cE(e==="text"?_F:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],o=n.attempt(i,c,d);return c;function c(g){return h(g)?o(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),p}function p(g){return h(g)?(n.exit("data"),o(g)):(n.consume(g),p)}function h(g){if(g===null)return!0;const m=i[g];let v=-1;if(m)for(;++v<m.length;){const b=m[v];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function cE(e){return t;function t(n,r){let i=-1,o;for(;++i<=n.length;)o===void 0?n[i]&&n[i][1].type==="data"&&(o=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==o+2&&(n[o][1].end=n[i-1][1].end,n.splice(o+2,i-o-2),i=o+2),o=void 0);return e?e(n,r):n}}function _F(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let o=i.length,c=-1,d=0,p;for(;o--;){const h=i[o];if(typeof h=="string"){for(c=h.length;h.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(h===-2)p=!0,d++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||p||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?c:r.start._bufferIndex+c,_index:r.start._index+o,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...h.start},r.start.offset===r.end.offset?Object.assign(r,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const OF={42:Jn,43:Jn,45:Jn,48:Jn,49:Jn,50:Jn,51:Jn,52:Jn,53:Jn,54:Jn,55:Jn,56:Jn,57:Jn,62:tE},MF={91:zB},LF={[-2]:Tm,[-1]:Tm,32:Tm},IF={35:qB,42:kd,45:[Qk,kd],60:WB,61:Qk,95:kd,96:Wk,126:Wk},DF={38:rE,92:nE},zF={[-5]:Rm,[-4]:Rm,[-3]:Rm,33:dF,38:rE,42:Rg,60:[pB,eF],91:pF,92:[BB,nE],93:ay,95:Rg,96:NB},$F={null:[Rg,AF]},PF={null:[42,95]},UF={null:[]},BF=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:PF,contentInitial:MF,disable:UF,document:OF,flow:IF,flowInitial:LF,insideSpan:$F,string:DF,text:zF},Symbol.toStringTag,{value:"Module"}));function FF(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},o=[];let c=[],d=[];const p={attempt:L(M),check:L(T),consume:N,enter:A,exit:O,interrupt:L(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:m};let g=t.tokenize.call(h,p);return t.resolveAll&&o.push(t),h;function m(z){return c=Or(c,z),C(),c[c.length-1]!==null?[]:(B(t,0),h.events=bf(o,h.events,h),h.events)}function v(z,F){return HF(b(z),F)}function b(z){return qF(c,z)}function k(){const{_bufferIndex:z,_index:F,line:Y,column:D,offset:q}=r;return{_bufferIndex:z,_index:F,line:Y,column:D,offset:q}}function j(z){i[z.line]=z.column,R()}function C(){let z;for(;r._index<c.length;){const F=c[r._index];if(typeof F=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<F.length;)S(F.charCodeAt(r._bufferIndex));else S(F)}}function S(z){g=g(z)}function N(z){Fe(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,R()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===c[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=z}function A(z,F){const Y=F||{};return Y.type=z,Y.start=k(),h.events.push(["enter",Y,h]),d.push(Y),Y}function O(z){const F=d.pop();return F.end=k(),h.events.push(["exit",F,h]),F}function M(z,F){B(z,F.from)}function T(z,F){F.restore()}function L(z,F){return Y;function Y(D,q,G){let W,Q,H,$;return Array.isArray(D)?Z(D):"tokenize"in D?Z([D]):U(D);function U(oe){return we;function we(Ee){const Oe=Ee!==null&&oe[Ee],He=Ee!==null&&oe.null,ke=[...Array.isArray(Oe)?Oe:Oe?[Oe]:[],...Array.isArray(He)?He:He?[He]:[]];return Z(ke)(Ee)}}function Z(oe){return W=oe,Q=0,oe.length===0?G:I(oe[Q])}function I(oe){return we;function we(Ee){return $=_(),H=oe,oe.partial||(h.currentConstruct=oe),oe.name&&h.parser.constructs.disable.null.includes(oe.name)?le():oe.tokenize.call(F?Object.assign(Object.create(h),F):h,p,ae,le)(Ee)}}function ae(oe){return z(H,$),q}function le(oe){return $.restore(),++Q<W.length?I(W[Q]):G}}}function B(z,F){z.resolveAll&&!o.includes(z)&&o.push(z),z.resolve&&yr(h.events,F,h.events.length-F,z.resolve(h.events.slice(F),h)),z.resolveTo&&(h.events=z.resolveTo(h.events,h))}function _(){const z=k(),F=h.previous,Y=h.currentConstruct,D=h.events.length,q=Array.from(d);return{from:D,restore:G};function G(){r=z,h.previous=F,h.currentConstruct=Y,h.events.length=D,d=q,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function qF(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,o=t.end._bufferIndex;let c;if(n===i)c=[e[n].slice(r,o)];else{if(c=e.slice(n,i),r>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(r):c.shift()}o>0&&c.push(e[i].slice(0,o))}return c}function HF(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const o=e[n];let c;if(typeof o=="string")c=o;else switch(o){case-5:{c="\r";break}case-4:{c=`
|
|
1610
|
+
`;break}case-3:{c=`\r
|
|
1611
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&i)continue;c=" ";break}default:c=String.fromCharCode(o)}i=o===-2,r.push(c)}return r.join("")}function GF(e){const r={constructs:JN([BF,...(e||{}).extensions||[]]),content:i(sB),defined:[],document:i(lB),flow:i(NF),lazy:{},string:i(TF),text:i(RF)};return r;function i(o){return c;function c(d){return FF(r,o,d)}}}function VF(e){for(;!aE(e););return e}const Kk=/[\0\t\n\r]/g;function WF(){let e=1,t="",n=!0,r;return i;function i(o,c,d){const p=[];let h,g,m,v,b;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(c||void 0).decode(o)),m=0,t="",n&&(o.charCodeAt(0)===65279&&m++,n=void 0);m<o.length;){if(Kk.lastIndex=m,h=Kk.exec(o),v=h&&h.index!==void 0?h.index:o.length,b=o.charCodeAt(v),!h){t=o.slice(m);break}if(b===10&&m===v&&r)p.push(-3),r=void 0;else switch(r&&(p.push(-5),r=void 0),m<v&&(p.push(o.slice(m,v)),e+=v-m),b){case 0:{p.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,p.push(-2);e++<g;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:r=!0,e=1}m=v+1}return d&&(r&&p.push(-5),t&&p.push(t),p.push(null)),p}}const ZF=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function QF(e){return e.replace(ZF,KF)}function KF(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),o=i===120||i===88;return eE(n.slice(o?2:1),o?16:10)}return ry(n)||e}const uE={}.hasOwnProperty;function YF(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XF(n)(VF(GF(n).document().write(WF()(e,t,!0))))}function XF(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ot),autolinkProtocol:_,autolinkEmail:_,atxHeading:o(We),blockQuote:o(He),characterEscape:_,characterReference:_,codeFenced:o(ke),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:o(ke,c),codeText:o(ve,c),codeTextData:_,data:_,codeFlowValue:_,definition:o(Re),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:o(Ge),hardBreakEscape:o(de),hardBreakTrailing:o(de),htmlFlow:o(Pe,c),htmlFlowData:_,htmlText:o(Pe,c),htmlTextData:_,image:o(Ze),label:c,link:o(ot),listItem:o(bt),listItemValue:v,listOrdered:o(be,m),listUnordered:o(be),paragraph:o(at),reference:I,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:o(We),strong:o(rn),thematicBreak:o(Se)},exit:{atxHeading:p(),atxHeadingSequence:M,autolink:p(),autolinkEmail:Oe,autolinkProtocol:Ee,blockQuote:p(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:oe,characterReference:we,codeFenced:p(C),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:R,codeIndented:p(S),codeText:p(q),codeTextData:R,data:R,definition:p(),definitionDestinationString:O,definitionLabelString:N,definitionTitleString:A,emphasis:p(),hardBreakEscape:p(F),hardBreakTrailing:p(F),htmlFlow:p(Y),htmlFlowData:R,htmlText:p(D),htmlTextData:R,image:p(W),label:H,labelText:Q,lineEnding:z,link:p(G),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ae,resourceDestinationString:$,resourceTitleString:U,resource:Z,setextHeading:p(B),setextHeadingLineSequence:L,setextHeadingText:T,strong:p(),thematicBreak:p()}};dE(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(X){let fe={type:"root",children:[]};const Ne={stack:[fe],tokenStack:[],config:t,enter:d,exit:h,buffer:c,resume:g,data:n},ie=[];let V=-1;for(;++V<X.length;)if(X[V][1].type==="listOrdered"||X[V][1].type==="listUnordered")if(X[V][0]==="enter")ie.push(V);else{const xe=ie.pop();V=i(X,xe,V)}for(V=-1;++V<X.length;){const xe=t[X[V][0]];uE.call(xe,X[V][1].type)&&xe[X[V][1].type].call(Object.assign({sliceSerialize:X[V][2].sliceSerialize},Ne),X[V][1])}if(Ne.tokenStack.length>0){const xe=Ne.tokenStack[Ne.tokenStack.length-1];(xe[1]||Yk).call(Ne,void 0,xe[0])}for(fe.position={start:ji(X.length>0?X[0][1].start:{line:1,column:1,offset:0}),end:ji(X.length>0?X[X.length-2][1].end:{line:1,column:1,offset:0})},V=-1;++V<t.transforms.length;)fe=t.transforms[V](fe)||fe;return fe}function i(X,fe,Ne){let ie=fe-1,V=-1,xe=!1,Le,Ae,De,Qe;for(;++ie<=Ne;){const Te=X[ie];switch(Te[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Te[0]==="enter"?V++:V--,Qe=void 0;break}case"lineEndingBlank":{Te[0]==="enter"&&(Le&&!Qe&&!V&&!De&&(De=ie),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!V&&Te[0]==="enter"&&Te[1].type==="listItemPrefix"||V===-1&&Te[0]==="exit"&&(Te[1].type==="listUnordered"||Te[1].type==="listOrdered")){if(Le){let jt=ie;for(Ae=void 0;jt--;){const ft=X[jt];if(ft[1].type==="lineEnding"||ft[1].type==="lineEndingBlank"){if(ft[0]==="exit")continue;Ae&&(X[Ae][1].type="lineEndingBlank",xe=!0),ft[1].type="lineEnding",Ae=jt}else if(!(ft[1].type==="linePrefix"||ft[1].type==="blockQuotePrefix"||ft[1].type==="blockQuotePrefixWhitespace"||ft[1].type==="blockQuoteMarker"||ft[1].type==="listItemIndent"))break}De&&(!Ae||De<Ae)&&(Le._spread=!0),Le.end=Object.assign({},Ae?X[Ae][1].start:Te[1].end),X.splice(Ae||ie,0,["exit",Le,Te[2]]),ie++,Ne++}if(Te[1].type==="listItemPrefix"){const jt={type:"listItem",_spread:!1,start:Object.assign({},Te[1].start),end:void 0};Le=jt,X.splice(ie,0,["enter",jt,Te[2]]),ie++,Ne++,De=void 0,Qe=!0}}}return X[fe][1]._spread=xe,Ne}function o(X,fe){return Ne;function Ne(ie){d.call(this,X(ie),ie),fe&&fe.call(this,ie)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(X,fe,Ne){this.stack[this.stack.length-1].children.push(X),this.stack.push(X),this.tokenStack.push([fe,Ne||void 0]),X.position={start:ji(fe.start),end:void 0}}function p(X){return fe;function fe(Ne){X&&X.call(this,Ne),h.call(this,Ne)}}function h(X,fe){const Ne=this.stack.pop(),ie=this.tokenStack.pop();if(ie)ie[0].type!==X.type&&(fe?fe.call(this,X,ie[0]):(ie[1]||Yk).call(this,X,ie[0]));else throw new Error("Cannot close `"+X.type+"` ("+Jl({start:X.start,end:X.end})+"): it’s not open");Ne.position.end=ji(X.end)}function g(){return ny(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function v(X){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(X),10),this.data.expectingFirstListItemValue=void 0}}function b(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=X}function k(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=X}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function C(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X.replace(/(\r?\n|\r)$/g,"")}function N(X){const fe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=fe,Ne.identifier=qr(this.sliceSerialize(X)).toLowerCase()}function A(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.title=X}function O(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.url=X}function M(X){const fe=this.stack[this.stack.length-1];if(!fe.depth){const Ne=this.sliceSerialize(X).length;fe.depth=Ne}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function L(X){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(X).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function _(X){const Ne=this.stack[this.stack.length-1].children;let ie=Ne[Ne.length-1];(!ie||ie.type!=="text")&&(ie=mt(),ie.position={start:ji(X.start),end:void 0},Ne.push(ie)),this.stack.push(ie)}function R(X){const fe=this.stack.pop();fe.value+=this.sliceSerialize(X),fe.position.end=ji(X.end)}function z(X){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=fe.children[fe.children.length-1];Ne.position.end=ji(X.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(fe.type)&&(_.call(this,X),R.call(this,X))}function F(){this.data.atHardBreak=!0}function Y(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function D(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function q(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.value=X}function G(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=fe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function W(){const X=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";X.type+="Reference",X.referenceType=fe,delete X.url,delete X.title}else delete X.identifier,delete X.label;this.data.referenceType=void 0}function Q(X){const fe=this.sliceSerialize(X),Ne=this.stack[this.stack.length-2];Ne.label=QF(fe),Ne.identifier=qr(fe).toLowerCase()}function H(){const X=this.stack[this.stack.length-1],fe=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const ie=X.children;Ne.children=ie}else Ne.alt=fe}function $(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.url=X}function U(){const X=this.resume(),fe=this.stack[this.stack.length-1];fe.title=X}function Z(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function ae(X){const fe=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=fe,Ne.identifier=qr(this.sliceSerialize(X)).toLowerCase(),this.data.referenceType="full"}function le(X){this.data.characterReferenceType=X.type}function oe(X){const fe=this.sliceSerialize(X),Ne=this.data.characterReferenceType;let ie;Ne?(ie=eE(fe,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ie=ry(fe);const V=this.stack[this.stack.length-1];V.value+=ie}function we(X){const fe=this.stack.pop();fe.position.end=ji(X.end)}function Ee(X){R.call(this,X);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(X)}function Oe(X){R.call(this,X);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(X)}function He(){return{type:"blockquote",children:[]}}function ke(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function Re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ge(){return{type:"emphasis",children:[]}}function We(){return{type:"heading",depth:0,children:[]}}function de(){return{type:"break"}}function Pe(){return{type:"html",value:""}}function Ze(){return{type:"image",title:null,url:"",alt:null}}function ot(){return{type:"link",title:null,url:"",children:[]}}function be(X){return{type:"list",ordered:X.type==="listOrdered",start:null,spread:X._spread,children:[]}}function bt(X){return{type:"listItem",spread:X._spread,checked:null,children:[]}}function at(){return{type:"paragraph",children:[]}}function rn(){return{type:"strong",children:[]}}function mt(){return{type:"text",value:""}}function Se(){return{type:"thematicBreak"}}}function ji(e){return{line:e.line,column:e.column,offset:e.offset}}function dE(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?dE(e,r):JF(e,r)}}function JF(e,t){let n;for(n in t)if(uE.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Yk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Jl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Jl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Jl({start:t.start,end:t.end})+") is still open")}function e7(e){const t=this;t.parser=n;function n(r){return YF(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function t7(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function n7(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
1612
|
+
`}]}function r7(e,t){const n=t.value?t.value+`
|
|
1613
|
+
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function a7(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function i7(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function s7(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=Io(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let c,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),c=e.footnoteOrder.length):c=o+1,d+=1,e.footnoteCounts.set(r,d);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const h={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,h),e.applyData(t,h)}function o7(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function l7(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fE(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const c=i[i.length-1];return c&&c.type==="text"?c.value+=r:i.push({type:"text",value:r}),i}function c7(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fE(e,t);const i={src:Io(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,o),e.applyData(t,o)}function u7(e,t){const n={src:Io(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function d7(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function f7(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fE(e,t);const i={href:Io(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const o={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function p7(e,t){const n={href:Io(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function h7(e,t,n){const r=e.all(t),i=n?m7(n):pE(t),o={},c=[];if(typeof t.checked=="boolean"){const g=r[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const g=r[d];(i||d!==0||g.type!=="element"||g.tagName!=="p")&&c.push({type:"text",value:`
|
|
1614
|
+
`}),g.type==="element"&&g.tagName==="p"&&!i?c.push(...g.children):c.push(g)}const p=r[r.length-1];p&&(i||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
1615
|
+
`});const h={type:"element",tagName:"li",properties:o,children:c};return e.patch(t,h),e.applyData(t,h)}function m7(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=pE(n[r])}return t}function pE(e){const t=e.spread;return t??e.children.length>1}function g7(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const c=r[i];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function v7(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function y7(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function b7(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function x7(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],c),i.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Xv(t.children[1]),p=VN(t.children[t.children.length-1]);d&&p&&(c.position={start:d,end:p}),i.push(c)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,o),e.applyData(t,o)}function w7(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,d=c?c.length:t.children.length;let p=-1;const h=[];for(;++p<d;){const m=t.children[p],v={},b=c?c[p]:void 0;b&&(v.align=b);let k={type:"element",tagName:o,properties:v,children:[]};m&&(k.children=e.all(m),e.patch(m,k),k=e.applyData(m,k)),h.push(k)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function k7(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Xk=9,Jk=32;function S7(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const o=[];for(;r;)o.push(eS(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return o.push(eS(t.slice(i),i>0,!1)),o.join("")}function eS(e,t,n){let r=0,i=e.length;if(t){let o=e.codePointAt(r);for(;o===Xk||o===Jk;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(i-1);for(;o===Xk||o===Jk;)i--,o=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function j7(e,t){const n={type:"text",value:S7(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function C7(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const N7={blockquote:t7,break:n7,code:r7,delete:a7,emphasis:i7,footnoteReference:s7,heading:o7,html:l7,imageReference:c7,image:u7,inlineCode:d7,linkReference:f7,link:p7,listItem:h7,list:g7,paragraph:v7,root:y7,strong:b7,table:x7,tableCell:k7,tableRow:w7,text:j7,thematicBreak:C7,toml:id,yaml:id,definition:id,footnoteDefinition:id};function id(){}const hE=-1,xf=0,tc=1,Vd=2,iy=3,sy=4,oy=5,ly=6,mE=7,gE=8,E7=typeof self=="object"?self:globalThis,tS=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new E7[e](t)},A7=(e,t)=>{const n=(i,o)=>(e.set(o,i),i),r=i=>{if(e.has(i))return e.get(i);const[o,c]=t[i];switch(o){case xf:case hE:return n(c,i);case tc:{const d=n([],i);for(const p of c)d.push(r(p));return d}case Vd:{const d=n({},i);for(const[p,h]of c)d[r(p)]=r(h);return d}case iy:return n(new Date(c),i);case sy:{const{source:d,flags:p}=c;return n(new RegExp(d,p),i)}case oy:{const d=n(new Map,i);for(const[p,h]of c)d.set(r(p),r(h));return d}case ly:{const d=n(new Set,i);for(const p of c)d.add(r(p));return d}case mE:{const{name:d,message:p}=c;return n(tS(d,p),i)}case gE:return n(BigInt(c),i);case"BigInt":return n(Object(BigInt(c)),i);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return n(new DataView(d),c)}}return n(tS(o,c),i)};return r},nS=e=>A7(new Map,e)(0),co="",{toString:T7}={},{keys:R7}=Object,Ul=e=>{const t=typeof e;if(t!=="object"||!e)return[xf,t];const n=T7.call(e).slice(8,-1);switch(n){case"Array":return[tc,co];case"Object":return[Vd,co];case"Date":return[iy,co];case"RegExp":return[sy,co];case"Map":return[oy,co];case"Set":return[ly,co];case"DataView":return[tc,n]}return n.includes("Array")?[tc,n]:n.includes("Error")?[mE,n]:[Vd,n]},sd=([e,t])=>e===xf&&(t==="function"||t==="symbol"),_7=(e,t,n,r)=>{const i=(c,d)=>{const p=r.push(c)-1;return n.set(d,p),p},o=c=>{if(n.has(c))return n.get(c);let[d,p]=Ul(c);switch(d){case xf:{let g=c;switch(p){case"bigint":d=gE,g=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);g=null;break;case"undefined":return i([hE],c)}return i([d,g],c)}case tc:{if(p){let v=c;return p==="DataView"?v=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(v=new Uint8Array(c)),i([p,[...v]],c)}const g=[],m=i([d,g],c);for(const v of c)g.push(o(v));return m}case Vd:{if(p)switch(p){case"BigInt":return i([p,c.toString()],c);case"Boolean":case"Number":case"String":return i([p,c.valueOf()],c)}if(t&&"toJSON"in c)return o(c.toJSON());const g=[],m=i([d,g],c);for(const v of R7(c))(e||!sd(Ul(c[v])))&&g.push([o(v),o(c[v])]);return m}case iy:return i([d,c.toISOString()],c);case sy:{const{source:g,flags:m}=c;return i([d,{source:g,flags:m}],c)}case oy:{const g=[],m=i([d,g],c);for(const[v,b]of c)(e||!(sd(Ul(v))||sd(Ul(b))))&&g.push([o(v),o(b)]);return m}case ly:{const g=[],m=i([d,g],c);for(const v of c)(e||!sd(Ul(v)))&&g.push(o(v));return m}}const{message:h}=c;return i([d,{name:p,message:h}],c)};return o},rS=(e,{json:t,lossy:n}={})=>{const r=[];return _7(!(t||n),!!t,new Map,r)(e),r},Wd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nS(rS(e,t)):structuredClone(e):(e,t)=>nS(rS(e,t));function O7(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function M7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function L7(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||O7,r=e.options.footnoteBackLabel||M7,i=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[p]);if(!h)continue;const g=e.all(h),m=String(h.identifier).toUpperCase(),v=Io(m.toLowerCase());let b=0;const k=[],j=e.footnoteCounts.get(m);for(;j!==void 0&&++b<=j;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(p,b);typeof N=="string"&&(N={type:"text",value:N}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(p,b),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const N=C.children[C.children.length-1];N&&N.type==="text"?N.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...k)}else g.push(...k);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(g,!0)};e.patch(h,S),d.push(S)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Wd(c),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
1616
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
1617
|
+
`}]}}const wf=(function(e){if(e==null)return $7;if(typeof e=="function")return kf(e);if(typeof e=="object")return Array.isArray(e)?I7(e):D7(e);if(typeof e=="string")return z7(e);throw new Error("Expected function, string, or object as test")});function I7(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=wf(e[n]);return kf(r);function r(...i){let o=-1;for(;++o<t.length;)if(t[o].apply(this,i))return!0;return!1}}function D7(e){const t=e;return kf(n);function n(r){const i=r;let o;for(o in e)if(i[o]!==t[o])return!1;return!0}}function z7(e){return kf(t);function t(n){return n&&n.type===e}}function kf(e){return t;function t(n,r,i){return!!(P7(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function $7(){return!0}function P7(e){return e!==null&&typeof e=="object"&&"type"in e}const vE=[],U7=!0,_g=!1,B7="skip";function yE(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const o=wf(i),c=r?-1:1;d(e,void 0,[])();function d(p,h,g){const m=p&&typeof p=="object"?p:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=vE,k,j,C;if((!t||o(p,h,g[g.length-1]||void 0))&&(b=F7(n(p,g)),b[0]===_g))return b;if("children"in p&&p.children){const S=p;if(S.children&&b[0]!==B7)for(j=(r?S.children.length:-1)+c,C=g.concat(S);j>-1&&j<S.children.length;){const N=S.children[j];if(k=d(N,j,C)(),k[0]===_g)return k;j=typeof k[1]=="number"?k[1]:j+c}}return b}}}function F7(e){return Array.isArray(e)?e:typeof e=="number"?[U7,e]:e==null?vE:[e]}function cy(e,t,n,r){let i,o,c;typeof t=="function"&&typeof n!="function"?(o=void 0,c=t,i=n):(o=t,c=n,i=r),yE(e,o,d,i);function d(p,h){const g=h[h.length-1],m=g?g.children.indexOf(p):void 0;return c(p,m,g)}}const Og={}.hasOwnProperty,q7={};function H7(e,t){const n=t||q7,r=new Map,i=new Map,o=new Map,c={...N7,...n.handlers},d={all:h,applyData:V7,definitionById:r,footnoteById:i,footnoteCounts:o,footnoteOrder:[],handlers:c,one:p,options:n,patch:G7,wrap:Z7};return cy(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?r:i,v=String(g.identifier).toUpperCase();m.has(v)||m.set(v,g)}}),d;function p(g,m){const v=g.type,b=d.handlers[v];if(Og.call(d.handlers,v)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(v)){if("children"in g){const{children:j,...C}=g,S=Wd(C);return S.children=d.all(g),S}return Wd(g)}return(d.options.unknownHandler||W7)(d,g,m)}function h(g){const m=[];if("children"in g){const v=g.children;let b=-1;for(;++b<v.length;){const k=d.one(v[b],g);if(k){if(b&&v[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=aS(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=aS(j.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function G7(e,t){e.position&&(t.position=O9(e))}function V7(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const c="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:c}}n.type==="element"&&o&&Object.assign(n.properties,Wd(o)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function W7(e,t){const n=t.data||{},r="value"in t&&!(Og.call(n,"hProperties")||Og.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Z7(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
1618
|
+
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
1619
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
1620
|
+
`}),n}function aS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function iS(e,t){const n=H7(e,t),r=n.one(e,void 0),i=L7(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&o.children.push({type:"text",value:`
|
|
1621
|
+
`},i),o}function Q7(e,t){return e&&"run"in e?async function(n,r){const i=iS(n,{file:r,...t});await e.run(i,r)}:function(n,r){return iS(n,{file:r,...e||t})}}function sS(e){if(e)throw e}var _m,oS;function K7(){if(oS)return _m;oS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var v;for(v in h);return typeof v>"u"||e.call(h,v)},c=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},d=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(r)return r(h,g).value}else return;return h[g]};return _m=function p(){var h,g,m,v,b,k,j=arguments[0],C=1,S=arguments.length,N=!1;for(typeof j=="boolean"&&(N=j,j=arguments[1]||{},C=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});C<S;++C)if(h=arguments[C],h!=null)for(g in h)m=d(j,g),v=d(h,g),j!==v&&(N&&v&&(o(v)||(b=i(v)))?(b?(b=!1,k=m&&i(m)?m:[]):k=m&&o(m)?m:{},c(j,{name:g,newValue:p(N,k,v)})):typeof v<"u"&&c(j,{name:g,newValue:v}));return j},_m}var Y7=K7();const Om=mc(Y7);function Mg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function X7(){const e=[],t={run:n,use:r};return t;function n(...i){let o=-1;const c=i.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...i);function d(p,...h){const g=e[++o];let m=-1;if(p){c(p);return}for(;++m<i.length;)(h[m]===null||h[m]===void 0)&&(h[m]=i[m]);i=h,g?J7(g,d)(...h):c(null,...h)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function J7(e,t){let n;return r;function r(...c){const d=e.length>c.length;let p;d&&c.push(i);try{p=e.apply(this,c)}catch(h){const g=h;if(d&&n)throw g;return i(g)}d||(p&&p.then&&typeof p.then=="function"?p.then(o,i):p instanceof Error?i(p):o(p))}function i(c,...d){n||(n=!0,t(c,...d))}function o(c){i(null,c)}}const oa={basename:eq,dirname:tq,extname:nq,join:rq,sep:"/"};function eq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ec(e);let n=0,r=-1,i=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else r<0&&(o=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let c=-1,d=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(o){n=i+1;break}}else c<0&&(o=!0,c=i+1),d>-1&&(e.codePointAt(i)===t.codePointAt(d--)?d<0&&(r=i):(d=-1,r=c));return n===r?r=c:r<0&&(r=e.length),e.slice(n,r)}function tq(e){if(Ec(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function nq(e){Ec(e);let t=e.length,n=-1,r=0,i=-1,o=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){r=t+1;break}continue}n<0&&(c=!0,n=t+1),d===46?i<0?i=t:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||n<0||o===0||o===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function rq(...e){let t=-1,n;for(;++t<e.length;)Ec(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":aq(n)}function aq(e){Ec(e);const t=e.codePointAt(0)===47;let n=iq(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function iq(e,t){let n="",r=0,i=-1,o=0,c=-1,d,p;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(i===c-1||o===1))if(i!==c-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",r=0):(n=n.slice(0,p),r=n.length-1-n.lastIndexOf("/")),i=c,o=0;continue}}else if(n.length>0){n="",r=0,i=c,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,c):n=e.slice(i+1,c),r=c-i-1;i=c,o=0}else d===46&&o>-1?o++:o=-1}return n}function Ec(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const sq={cwd:oq};function oq(){return"/"}function Lg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function lq(e){if(typeof e=="string")e=new URL(e);else if(!Lg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return cq(e)}function cq(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Mm=["history","path","basename","stem","extname","dirname"];class bE{constructor(t){let n;t?Lg(t)?n={path:t}:typeof t=="string"||uq(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":sq.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Mm.length;){const o=Mm[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let i;for(i in n)Mm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?oa.basename(this.path):void 0}set basename(t){Im(t,"basename"),Lm(t,"basename"),this.path=oa.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?oa.dirname(this.path):void 0}set dirname(t){lS(this.basename,"dirname"),this.path=oa.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?oa.extname(this.path):void 0}set extname(t){if(Lm(t,"extname"),lS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=oa.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Lg(t)&&(t=lq(t)),Im(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?oa.basename(this.path,this.extname):void 0}set stem(t){Im(t,"stem"),Lm(t,"stem"),this.path=oa.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new On(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lm(e,t){if(e&&e.includes(oa.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+oa.sep+"`")}function Im(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function lS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function uq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dq=(function(e){const r=this.constructor.prototype,i=r[e],o=function(){return i.apply(o,arguments)};return Object.setPrototypeOf(o,r),o}),fq={}.hasOwnProperty;class uy extends dq{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=X7()}copy(){const t=new uy;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Om(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($m("data",this.frozen),this.namespace[t]=n,this):fq.call(this.namespace,t)&&this.namespace[t]||void 0:t?($m("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=od(t),r=this.parser||this.Parser;return Dm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dm("process",this.parser||this.Parser),zm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(o,c){const d=od(t),p=r.parse(d);r.run(p,d,function(g,m,v){if(g||!m||!v)return h(g);const b=m,k=r.stringify(b,v);mq(k)?v.value=k:v.result=k,h(g,v)});function h(g,m){g||!m?c(g):o?o(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Dm("processSync",this.parser||this.Parser),zm("processSync",this.compiler||this.Compiler),this.process(t,i),uS("processSync","process",n),r;function i(o,c){n=!0,sS(o),r=c}}run(t,n,r){cS(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(c,d){const p=od(n);i.run(t,p,h);function h(g,m,v){const b=m||t;g?d(g):c?c(b):r(void 0,b,v)}}}runSync(t,n){let r=!1,i;return this.run(t,n,o),uS("runSync","run",r),i;function o(c,d){sS(c),i=d,r=!0}}stringify(t,n){this.freeze();const r=od(n),i=this.compiler||this.Compiler;return zm("stringify",i),cS(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if($m("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")p(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;p(g,m)}else c(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function c(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(h.plugins),h.settings&&(i.settings=Om(!0,i.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];o(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function p(h,g){let m=-1,v=-1;for(;++m<r.length;)if(r[m][0]===h){v=m;break}if(v===-1)r.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=r[v][1];Mg(j)&&Mg(b)&&(b=Om(!0,j,b)),r[v]=[h,b,...k]}}}}const pq=new uy().freeze();function Dm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $m(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cS(e){if(!Mg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function uS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function od(e){return hq(e)?e:new bE(e)}function hq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function mq(e){return typeof e=="string"||gq(e)}function gq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const vq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dS=[],fS={allowDangerousHtml:!0},yq=/^(https?|ircs?|mailto|xmpp)$/i,bq=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function xq(e){const t=wq(e),n=kq(e);return Sq(t.runSync(t.parse(n),n),e)}function wq(e){const t=e.rehypePlugins||dS,n=e.remarkPlugins||dS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fS}:fS;return pq().use(e7).use(n).use(Q7,r).use(t)}function kq(e){const t=e.children||"",n=new bE;return typeof t=="string"&&(n.value=t),n}function Sq(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,o=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,p=t.urlTransform||jq;for(const g of bq)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+vq+g.id,void 0);return cy(e,h),z9(e,{Fragment:l.Fragment,components:i,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(g,m,v){if(g.type==="raw"&&v&&typeof m=="number")return c?v.children.splice(m,1):v.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Am)if(Object.hasOwn(Am,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=Am[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=p(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):o?o.includes(g.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(g,m,v)),b&&v&&typeof m=="number")return d&&g.children?v.children.splice(m,1,...g.children):v.children.splice(m,1),m}}}function jq(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||yq.test(e.slice(0,t))?e:""}function pS(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Cq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function xE(e,t,n){const i=wf((n||{}).ignore||[]),o=Nq(t);let c=-1;for(;++c<o.length;)yE(e,"text",d);function d(h,g){let m=-1,v;for(;++m<g.length;){const b=g[m],k=v?v.children:void 0;if(i(b,k?k.indexOf(b):void 0,v))return;v=b}if(v)return p(h,g)}function p(h,g){const m=g[g.length-1],v=o[c][0],b=o[c][1];let k=0;const C=m.children.indexOf(h);let S=!1,N=[];v.lastIndex=0;let A=v.exec(h.value);for(;A;){const O=A.index,M={index:A.index,input:A.input,stack:[...g,h]};let T=b(...A,M);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?v.lastIndex=O+1:(k!==O&&N.push({type:"text",value:h.value.slice(k,O)}),Array.isArray(T)?N.push(...T):T&&N.push(T),k=O+A[0].length,S=!0),!v.global)break;A=v.exec(h.value)}return S?(k<h.value.length&&N.push({type:"text",value:h.value.slice(k)}),m.children.splice(C,1,...N)):N=[h],C+N.length}}function Nq(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const i=n[r];t.push([Eq(i[0]),Aq(i[1])])}return t}function Eq(e){return typeof e=="string"?new RegExp(Cq(e),"g"):e}function Aq(e){return typeof e=="function"?e:function(){return e}}const Pm="phrasing",Um=["autolink","link","image","label"];function Tq(){return{transforms:[Dq],enter:{literalAutolink:_q,literalAutolinkEmail:Bm,literalAutolinkHttp:Bm,literalAutolinkWww:Bm},exit:{literalAutolink:Iq,literalAutolinkEmail:Lq,literalAutolinkHttp:Oq,literalAutolinkWww:Mq}}}function Rq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Pm,notInConstruct:Um},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Pm,notInConstruct:Um},{character:":",before:"[ps]",after:"\\/",inConstruct:Pm,notInConstruct:Um}]}}function _q(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Bm(e){this.config.enter.autolinkProtocol.call(this,e)}function Oq(e){this.config.exit.autolinkProtocol.call(this,e)}function Mq(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Lq(e){this.config.exit.autolinkEmail.call(this,e)}function Iq(e){this.exit(e)}function Dq(e){xE(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,zq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),$q]],{ignore:["link","linkReference"]})}function zq(e,t,n,r,i){let o="";if(!wE(i)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!Pq(n)))return!1;const c=Uq(n+r);if(!c[0])return!1;const d={type:"link",title:null,url:o+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function $q(e,t,n,r){return!wE(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Pq(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Uq(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=pS(e,"(");let o=pS(e,")");for(;r!==-1&&i>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function wE(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ps(n)||yf(n))&&(!t||n!==47)}kE.peek=Qq;function Bq(){this.buffer()}function Fq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function qq(){this.buffer()}function Hq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Gq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vq(e){this.exit(e)}function Wq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=qr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Zq(e){this.exit(e)}function Qq(){return"["}function kE(e,t,n,r){const i=n.createTracker(r);let o=i.move("[^");const c=n.enter("footnoteReference"),d=n.enter("reference");return o+=i.move(n.safe(n.associationId(e),{after:"]",before:o})),d(),c(),o+=i.move("]"),o}function Kq(){return{enter:{gfmFootnoteCallString:Bq,gfmFootnoteCall:Fq,gfmFootnoteDefinitionLabelString:qq,gfmFootnoteDefinition:Hq},exit:{gfmFootnoteCallString:Gq,gfmFootnoteCall:Vq,gfmFootnoteDefinitionLabelString:Wq,gfmFootnoteDefinition:Zq}}}function Yq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:kE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,o,c){const d=o.createTracker(c);let p=d.move("[^");const h=o.enter("footnoteDefinition"),g=o.enter("label");return p+=d.move(o.safe(o.associationId(r),{before:p,after:"]"})),g(),p+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),p+=d.move((t?`
|
|
1622
|
+
`:" ")+o.indentLines(o.containerFlow(r,d.current()),t?SE:Xq))),h(),p}}function Xq(e,t,n){return t===0?e:SE(e,t,n)}function SE(e,t,n){return(n?"":" ")+e}const Jq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];jE.peek=aH;function eH(){return{canContainEols:["delete"],enter:{strikethrough:nH},exit:{strikethrough:rH}}}function tH(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Jq}],handlers:{delete:jE}}}function nH(e){this.enter({type:"delete",children:[]},e)}function rH(e){this.exit(e)}function jE(e,t,n,r){const i=n.createTracker(r),o=n.enter("strikethrough");let c=i.move("~~");return c+=n.containerPhrasing(e,{...i.current(),before:c,after:"~"}),c+=i.move("~~"),o(),c}function aH(){return"~"}function iH(e){return e.length}function sH(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||iH,o=[],c=[],d=[],p=[];let h=0,g=-1;for(;++g<e.length;){const j=[],C=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const N=oH(e[g][S]);if(n.alignDelimiters!==!1){const A=i(N);C[S]=A,(p[S]===void 0||A>p[S])&&(p[S]=A)}j.push(N)}c[g]=j,d[g]=C}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)o[m]=hS(r[m]);else{const j=hS(r);for(;++m<h;)o[m]=j}m=-1;const v=[],b=[];for(;++m<h;){const j=o[m];let C="",S="";j===99?(C=":",S=":"):j===108?C=":":j===114&&(S=":");let N=n.alignDelimiters===!1?1:Math.max(1,p[m]-C.length-S.length);const A=C+"-".repeat(N)+S;n.alignDelimiters!==!1&&(N=C.length+N+S.length,N>p[m]&&(p[m]=N),b[m]=N),v[m]=A}c.splice(1,0,v),d.splice(1,0,b),g=-1;const k=[];for(;++g<c.length;){const j=c[g],C=d[g];m=-1;const S=[];for(;++m<h;){const N=j[m]||"";let A="",O="";if(n.alignDelimiters!==!1){const M=p[m]-(C[m]||0),T=o[m];T===114?A=" ".repeat(M):T===99?M%2?(A=" ".repeat(M/2+.5),O=" ".repeat(M/2-.5)):(A=" ".repeat(M/2),O=A):O=" ".repeat(M)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&N==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(A),S.push(N),n.alignDelimiters!==!1&&S.push(O),n.padding!==!1&&S.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&S.push("|")}k.push(n.delimiterEnd===!1?S.join("").replace(/ +$/,""):S.join(""))}return k.join(`
|
|
1623
|
+
`)}function oH(e){return e==null?"":String(e)}function hS(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function lH(e,t,n,r){const i=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const c=n.indentLines(n.containerFlow(e,o.current()),cH);return i(),c}function cH(e,t,n){return">"+(n?"":" ")+e}function uH(e,t){return mS(e,t.inConstruct,!0)&&!mS(e,t.notInConstruct,!1)}function mS(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function gS(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
1624
|
+
`&&uH(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
1625
|
+
`}function dH(e,t){const n=String(e);let r=n.indexOf(t),i=r,o=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++o>c&&(c=o):o=1,i=r+t.length,r=n.indexOf(t,i);return c}function fH(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function pH(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function hH(e,t,n,r){const i=pH(n),o=e.value||"",c=i==="`"?"GraveAccent":"Tilde";if(fH(e,n)){const m=n.enter("codeIndented"),v=n.indentLines(o,mH);return m(),v}const d=n.createTracker(r),p=i.repeat(Math.max(dH(o,i)+1,3)),h=n.enter("codeFenced");let g=d.move(p);if(e.lang){const m=n.enter(`codeFencedLang${c}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${c}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
|
|
1626
|
+
`,encode:["`"],...d.current()})),m()}return g+=d.move(`
|
|
1627
|
+
`),o&&(g+=d.move(o+`
|
|
1628
|
+
`)),g+=d.move(p),h(),g}function mH(e,t,n){return(n?"":" ")+e}function dy(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gH(e,t,n,r){const i=dy(n),o=i==='"'?"Quote":"Apostrophe",c=n.enter("definition");let d=n.enter("label");const p=n.createTracker(r);let h=p.move("[");return h+=p.move(n.safe(n.associationId(e),{before:h,after:"]",...p.current()})),h+=p.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(d=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
1629
|
+
`,...p.current()}))),d(),e.title&&(d=n.enter(`title${o}`),h+=p.move(" "+i),h+=p.move(n.safe(e.title,{before:h,after:i,...p.current()})),h+=p.move(i),d()),c(),h}function vH(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function pc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Zd(e,t,n){const r=jo(e),i=jo(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}CE.peek=yH;function CE(e,t,n,r){const i=vH(n),o=n.enter("emphasis"),c=n.createTracker(r),d=c.move(i);let p=c.move(n.containerPhrasing(e,{after:i,before:d,...c.current()}));const h=p.charCodeAt(0),g=Zd(r.before.charCodeAt(r.before.length-1),h,i);g.inside&&(p=pc(h)+p.slice(1));const m=p.charCodeAt(p.length-1),v=Zd(r.after.charCodeAt(0),m,i);v.inside&&(p=p.slice(0,-1)+pc(m));const b=c.move(i);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},d+p+b}function yH(e,t,n){return n.options.emphasis||"*"}function bH(e,t){let n=!1;return cy(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,_g}),!!((!e.depth||e.depth<3)&&ny(e)&&(t.options.setext||n))}function xH(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(bH(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),v=n.containerPhrasing(e,{...o.current(),before:`
|
|
1630
|
+
`,after:`
|
|
1631
|
+
`});return m(),g(),v+`
|
|
1632
|
+
`+(i===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
1633
|
+
`))+1))}const c="#".repeat(i),d=n.enter("headingAtx"),p=n.enter("phrasing");o.move(c+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
1634
|
+
`,...o.current()});return/^[\t ]/.test(h)&&(h=pc(h.charCodeAt(0))+h.slice(1)),h=h?c+" "+h:c,n.options.closeAtx&&(h+=" "+c),p(),d(),h}NE.peek=wH;function NE(e){return e.value||""}function wH(){return"<"}EE.peek=kH;function EE(e,t,n,r){const i=dy(n),o=i==='"'?"Quote":"Apostrophe",c=n.enter("image");let d=n.enter("label");const p=n.createTracker(r);let h=p.move("![");return h+=p.move(n.safe(e.alt,{before:h,after:"]",...p.current()})),h+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=p.move("<"),h+=p.move(n.safe(e.url,{before:h,after:">",...p.current()})),h+=p.move(">")):(d=n.enter("destinationRaw"),h+=p.move(n.safe(e.url,{before:h,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=n.enter(`title${o}`),h+=p.move(" "+i),h+=p.move(n.safe(e.title,{before:h,after:i,...p.current()})),h+=p.move(i),d()),h+=p.move(")"),c(),h}function kH(){return"!"}AE.peek=SH;function AE(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let c=n.enter("label");const d=n.createTracker(r);let p=d.move("![");const h=n.safe(e.alt,{before:p,after:"]",...d.current()});p+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:p,after:"]",...d.current()});return c(),n.stack=g,o(),i==="full"||!h||h!==m?p+=d.move(m+"]"):i==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function SH(){return"!"}TE.peek=jH;function TE(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const c=n.unsafe[o],d=n.compilePattern(c);let p;if(c.atBreak)for(;p=d.exec(r);){let h=p.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(p.index+1)}}return i+r+i}function jH(){return"`"}function RE(e,t){const n=ny(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}_E.peek=CH;function _E(e,t,n,r){const i=dy(n),o=i==='"'?"Quote":"Apostrophe",c=n.createTracker(r);let d,p;if(RE(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let m=c.move("<");return m+=c.move(n.containerPhrasing(e,{before:m,after:">",...c.current()})),m+=c.move(">"),d(),n.stack=g,m}d=n.enter("link"),p=n.enter("label");let h=c.move("[");return h+=c.move(n.containerPhrasing(e,{before:h,after:"](",...c.current()})),h+=c.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(e.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(p=n.enter("destinationRaw"),h+=c.move(n.safe(e.url,{before:h,after:e.title?" ":")",...c.current()}))),p(),e.title&&(p=n.enter(`title${o}`),h+=c.move(" "+i),h+=c.move(n.safe(e.title,{before:h,after:i,...c.current()})),h+=c.move(i),p()),h+=c.move(")"),d(),h}function CH(e,t,n){return RE(e,n)?"<":"["}OE.peek=NH;function OE(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let c=n.enter("label");const d=n.createTracker(r);let p=d.move("[");const h=n.containerPhrasing(e,{before:p,after:"]",...d.current()});p+=d.move(h+"]["),c();const g=n.stack;n.stack=[],c=n.enter("reference");const m=n.safe(n.associationId(e),{before:p,after:"]",...d.current()});return c(),n.stack=g,o(),i==="full"||!h||h!==m?p+=d.move(m+"]"):i==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function NH(){return"["}function fy(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function EH(e){const t=fy(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function AH(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ME(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function TH(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let c=e.ordered?AH(n):fy(n);const d=e.ordered?c==="."?")":".":EH(n);let p=t&&n.bulletLastUsed?c===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),ME(n)===c&&g){let m=-1;for(;++m<e.children.length;){const v=e.children[m];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(c=d),n.bulletCurrent=c;const h=n.containerFlow(e,r);return n.bulletLastUsed=c,n.bulletCurrent=o,i(),h}function RH(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function _H(e,t,n,r){const i=RH(n);let o=n.bulletCurrent||fy(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let c=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=n.createTracker(r);d.move(o+" ".repeat(c-o.length)),d.shift(c);const p=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return p(),h;function g(m,v,b){return v?(b?"":" ".repeat(c))+m:(b?o:o+" ".repeat(c-o.length))+m}}function OH(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),c=n.containerPhrasing(e,r);return o(),i(),c}const MH=wf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function LH(e,t,n,r){return(e.children.some(function(c){return MH(c)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function IH(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}LE.peek=DH;function LE(e,t,n,r){const i=IH(n),o=n.enter("strong"),c=n.createTracker(r),d=c.move(i+i);let p=c.move(n.containerPhrasing(e,{after:i,before:d,...c.current()}));const h=p.charCodeAt(0),g=Zd(r.before.charCodeAt(r.before.length-1),h,i);g.inside&&(p=pc(h)+p.slice(1));const m=p.charCodeAt(p.length-1),v=Zd(r.after.charCodeAt(0),m,i);v.inside&&(p=p.slice(0,-1)+pc(m));const b=c.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:v.outside,before:g.outside},d+p+b}function DH(e,t,n){return n.options.strong||"*"}function zH(e,t,n,r){return n.safe(e.value,r)}function $H(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function PH(e,t,n){const r=(ME(n)+(n.options.ruleSpaces?" ":"")).repeat($H(n));return n.options.ruleSpaces?r.slice(0,-1):r}const IE={blockquote:lH,break:gS,code:hH,definition:gH,emphasis:CE,hardBreak:gS,heading:xH,html:NE,image:EE,imageReference:AE,inlineCode:TE,link:_E,linkReference:OE,list:TH,listItem:_H,paragraph:OH,root:LH,strong:LE,text:zH,thematicBreak:PH};function UH(){return{enter:{table:BH,tableData:vS,tableHeader:vS,tableRow:qH},exit:{codeText:HH,table:FH,tableData:Fm,tableHeader:Fm,tableRow:Fm}}}function BH(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function FH(e){this.exit(e),this.data.inTable=void 0}function qH(e){this.enter({type:"tableRow",children:[]},e)}function Fm(e){this.exit(e)}function vS(e){this.enter({type:"tableCell",children:[]},e)}function HH(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,GH));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function GH(e,t){return t==="|"?t:e}function VH(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
1635
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:c,tableCell:p,tableRow:d}};function c(b,k,j,C){return h(g(b,j,C),b.align)}function d(b,k,j,C){const S=m(b,j,C),N=h([S]);return N.slice(0,N.indexOf(`
|
|
1636
|
+
`))}function p(b,k,j,C){const S=j.enter("tableCell"),N=j.enter("phrasing"),A=j.containerPhrasing(b,{...C,before:o,after:o});return N(),S(),A}function h(b,k){return sH(b,{align:k,alignDelimiters:r,padding:n,stringLength:i})}function g(b,k,j){const C=b.children;let S=-1;const N=[],A=k.enter("table");for(;++S<C.length;)N[S]=m(C[S],k,j);return A(),N}function m(b,k,j){const C=b.children;let S=-1;const N=[],A=k.enter("tableRow");for(;++S<C.length;)N[S]=p(C[S],b,k,j);return A(),N}function v(b,k,j){let C=IE.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function WH(){return{exit:{taskListCheckValueChecked:yS,taskListCheckValueUnchecked:yS,paragraph:QH}}}function ZH(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:KH}}}function yS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function QH(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,c;for(;++o<i.length;){const d=i[o];if(d.type==="paragraph"){c=d;break}}c===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function KH(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);o&&d.move(c);let p=IE.listItem(e,t,n,{...r,...d.current()});return o&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),p;function h(g){return g+c}}function YH(){return[Tq(),Kq(),eH(),UH(),WH()]}function XH(e){return{extensions:[Rq(),Yq(e),tH(),VH(e),ZH()]}}const JH={tokenize:iG,partial:!0},DE={tokenize:sG,partial:!0},zE={tokenize:oG,partial:!0},$E={tokenize:lG,partial:!0},eG={tokenize:cG,partial:!0},PE={name:"wwwAutolink",tokenize:rG,previous:BE},UE={name:"protocolAutolink",tokenize:aG,previous:FE},Ha={name:"emailAutolink",tokenize:nG,previous:qE},fa={};function tG(){return{text:fa}}let ns=48;for(;ns<123;)fa[ns]=Ha,ns++,ns===58?ns=65:ns===91&&(ns=97);fa[43]=Ha;fa[45]=Ha;fa[46]=Ha;fa[95]=Ha;fa[72]=[Ha,UE];fa[104]=[Ha,UE];fa[87]=[Ha,PE];fa[119]=[Ha,PE];function nG(e,t,n){const r=this;let i,o;return c;function c(m){return!Ig(m)||!qE.call(r,r.previous)||py(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return Ig(m)?(e.consume(m),d):m===64?(e.consume(m),p):n(m)}function p(m){return m===46?e.check(eG,g,h)(m):m===45||m===95||_n(m)?(o=!0,e.consume(m),p):g(m)}function h(m){return e.consume(m),i=!0,p}function g(m){return o&&i&&Fn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function rG(e,t,n){const r=this;return i;function i(c){return c!==87&&c!==119||!BE.call(r,r.previous)||py(r.events)?n(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(JH,e.attempt(DE,e.attempt(zE,o),n),n)(c))}function o(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function aG(e,t,n){const r=this;let i="",o=!1;return c;function c(m){return(m===72||m===104)&&FE.call(r,r.previous)&&!py(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(Fn(m)&&i.length<5)return i+=String.fromCodePoint(m),e.consume(m),d;if(m===58){const v=i.toLowerCase();if(v==="http"||v==="https")return e.consume(m),p}return n(m)}function p(m){return m===47?(e.consume(m),o?h:(o=!0,p)):n(m)}function h(m){return m===null||Gd(m)||Dt(m)||ps(m)||yf(m)?n(m):e.attempt(DE,e.attempt(zE,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function iG(e,t,n){let r=0;return i;function i(c){return(c===87||c===119)&&r<3?(r++,e.consume(c),i):c===46&&r===3?(e.consume(c),o):n(c)}function o(c){return c===null?n(c):t(c)}}function sG(e,t,n){let r,i,o;return c;function c(h){return h===46||h===95?e.check($E,p,d)(h):h===null||Dt(h)||ps(h)||h!==45&&yf(h)?p(h):(o=!0,e.consume(h),c)}function d(h){return h===95?r=!0:(i=r,r=void 0),e.consume(h),c}function p(h){return i||r||!o?n(h):t(h)}}function oG(e,t){let n=0,r=0;return i;function i(c){return c===40?(n++,e.consume(c),i):c===41&&r<n?o(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check($E,t,o)(c):c===null||Dt(c)||ps(c)?t(c):(e.consume(c),i)}function o(c){return c===41&&r++,e.consume(c),i}}function lG(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),o):d===93?(e.consume(d),i):d===60||d===null||Dt(d)||ps(d)?t(d):n(d)}function i(d){return d===null||d===40||d===91||Dt(d)||ps(d)?t(d):r(d)}function o(d){return Fn(d)?c(d):n(d)}function c(d){return d===59?(e.consume(d),r):Fn(d)?(e.consume(d),c):n(d)}}function cG(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return _n(o)?n(o):t(o)}}function BE(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Dt(e)}function FE(e){return!Fn(e)}function qE(e){return!(e===47||Ig(e))}function Ig(e){return e===43||e===45||e===46||e===95||_n(e)}function py(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const uG={tokenize:yG,partial:!0};function dG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mG,continuation:{tokenize:gG},exit:vG}},text:{91:{name:"gfmFootnoteCall",tokenize:hG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fG,resolveTo:pG}}}}function fG(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c;for(;i--;){const p=r.events[i][1];if(p.type==="labelImage"){c=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return d;function d(p){if(!c||!c._balanced)return n(p);const h=qr(r.sliceSerialize({start:c.end,end:r.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function pG(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function hG(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,c;return d;function d(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),p}function p(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(o>999||m===93&&!c||m===null||m===91||Dt(m))return n(m);if(m===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return i.includes(qr(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Dt(m)||(c=!0),o++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),o++,h):h(m)}}function mG(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,c=0,d;return p;function p(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(k)}function g(k){if(c>999||k===93&&!d||k===null||k===91||Dt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return o=qr(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return Dt(k)||(d=!0),c++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),c++,g):g(k)}function v(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),i.includes(o)||i.push(o),vt(e,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return t(k)}}function gG(e,t,n){return e.check(Nc,t,e.attempt(uG,t,n))}function vG(e){e.exit("gfmFootnoteDefinition")}function yG(e,t,n){const r=this;return vt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const c=r.events[r.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(o):n(o)}}function bG(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(c,d){let p=-1;for(;++p<c.length;)if(c[p][0]==="enter"&&c[p][1].type==="strikethroughSequenceTemporary"&&c[p][1]._close){let h=p;for(;h--;)if(c[h][0]==="exit"&&c[h][1].type==="strikethroughSequenceTemporary"&&c[h][1]._open&&c[p][1].end.offset-c[p][1].start.offset===c[h][1].end.offset-c[h][1].start.offset){c[p][1].type="strikethroughSequence",c[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},c[h][1].start),end:Object.assign({},c[p][1].end)},m={type:"strikethroughText",start:Object.assign({},c[h][1].end),end:Object.assign({},c[p][1].start)},v=[["enter",g,d],["enter",c[h][1],d],["exit",c[h][1],d],["enter",m,d]],b=d.parser.constructs.insideSpan.null;b&&yr(v,v.length,0,bf(b,c.slice(h+1,p),d)),yr(v,v.length,0,[["exit",m,d],["enter",c[p][1],d],["exit",c[p][1],d],["exit",g,d]]),yr(c,h-1,p-h+3,v),p=h+v.length-2;break}}for(p=-1;++p<c.length;)c[p][1].type==="strikethroughSequenceTemporary"&&(c[p][1].type="data");return c}function o(c,d,p){const h=this.previous,g=this.events;let m=0;return v;function v(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?p(k):(c.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const j=jo(h);if(k===126)return m>1?p(k):(c.consume(k),m++,b);if(m<2&&!n)return p(k);const C=c.exit("strikethroughSequenceTemporary"),S=jo(k);return C._open=!S||S===2&&!!j,C._close=!j||j===2&&!!S,d(k)}}}class xG{constructor(){this.map=[]}add(t,n,r){wG(this,t,n,r)}consume(t){if(this.map.sort(function(o,c){return o[0]-c[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function wG(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function kG(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function SG(){return{flow:{null:{name:"table",tokenize:jG,resolveAll:CG}}}}function jG(e,t,n){const r=this;let i=0,o=0,c;return d;function d(R){let z=r.events.length-1;for(;z>-1;){const D=r.events[z][1].type;if(D==="lineEnding"||D==="linePrefix")z--;else break}const F=z>-1?r.events[z][1].type:null,Y=F==="tableHead"||F==="tableRow"?T:p;return Y===T&&r.parser.lazy[r.now().line]?n(R):Y(R)}function p(R){return e.enter("tableHead"),e.enter("tableRow"),h(R)}function h(R){return R===124||(c=!0,o+=1),g(R)}function g(R){return R===null?n(R):Fe(R)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),b):n(R):dt(R)?vt(e,g,"whitespace")(R):(o+=1,c&&(c=!1,i+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),c=!0,g):(e.enter("data"),m(R)))}function m(R){return R===null||R===124||Dt(R)?(e.exit("data"),g(R)):(e.consume(R),R===92?v:m)}function v(R){return R===92||R===124?(e.consume(R),m):m(R)}function b(R){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(R):(e.enter("tableDelimiterRow"),c=!1,dt(R)?vt(e,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):k(R))}function k(R){return R===45||R===58?C(R):R===124?(c=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),j):M(R)}function j(R){return dt(R)?vt(e,C,"whitespace")(R):C(R)}function C(R){return R===58?(o+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),S):R===45?(o+=1,S(R)):R===null||Fe(R)?O(R):M(R)}function S(R){return R===45?(e.enter("tableDelimiterFiller"),N(R)):M(R)}function N(R){return R===45?(e.consume(R),N):R===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(R))}function A(R){return dt(R)?vt(e,O,"whitespace")(R):O(R)}function O(R){return R===124?k(R):R===null||Fe(R)?!c||i!==o?M(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):M(R)}function M(R){return n(R)}function T(R){return e.enter("tableRow"),L(R)}function L(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),L):R===null||Fe(R)?(e.exit("tableRow"),t(R)):dt(R)?vt(e,L,"whitespace")(R):(e.enter("data"),B(R))}function B(R){return R===null||R===124||Dt(R)?(e.exit("data"),L(R)):(e.consume(R),R===92?_:B)}function _(R){return R===92||R===124?(e.consume(R),B):B(R)}}function CG(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],c=[0,0,0,0],d=!1,p=0,h,g,m;const v=new xG;for(;++n<e.length;){const b=e[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(d=!1,p!==0&&(bS(v,t,p,h,g),g=void 0,p=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,m=void 0,o=[0,0,0,0],c=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(n,0,[["enter",g,t]])),i=k.type==="tableDelimiterRow"?2:g?3:1):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,c[2]===0&&(o[1]!==0&&(c[0]=c[1],m=ld(v,t,o,i,void 0,m),o=[0,0,0,0]),c[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(c[0]=c[1],m=ld(v,t,o,i,void 0,m)),o=c,c=[o[1],n,0,0])):k.type==="tableHead"?(d=!0,p=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(p=n,o[1]!==0?(c[0]=c[1],m=ld(v,t,o,i,n,m)):c[1]!==0&&(m=ld(v,t,c,i,n,m)),i=0):i&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(c[3]=n)}for(p!==0&&bS(v,t,p,h,g),v.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=kG(t.events,n))}return e}function ld(e,t,n,r,i,o){const c=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(o.end=Object.assign({},fo(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const p=fo(t.events,n[1]);if(o={type:c,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=fo(t.events,n[2]),g=fo(t.events,n[3]),m={type:d,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),r!==2){const v=t.events[n[2]],b=t.events[n[3]];if(v[1].end=Object.assign({},b[1].end),v[1].type="chunkText",v[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,j=n[3]-n[2]-1;e.add(k,j,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return i!==void 0&&(o.end=Object.assign({},fo(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function bS(e,t,n,r,i){const o=[],c=fo(t.events,n);i&&(i.end=Object.assign({},c),o.push(["exit",i,t])),r.end=Object.assign({},c),o.push(["exit",r,t]),e.add(n+1,0,o)}function fo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const NG={name:"tasklistCheck",tokenize:AG};function EG(){return{text:{91:NG}}}function AG(e,t,n){const r=this;return i;function i(p){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),o)}function o(p){return Dt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),c):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),c):n(p)}function c(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(p)}function d(p){return Fe(p)?t(p):dt(p)?e.check({tokenize:TG},t,n)(p):n(p)}}function TG(e,t,n){return vt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function RG(e){return JN([tG(),dG(),bG(e),SG(),EG()])}const _G={};function OG(e){const t=this,n=e||_G,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),c=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(RG(n)),o.push(YH()),c.push(XH(n))}function MG(e){xE(e,[/\r?\n|\r/g,LG])}function LG(){return{type:"break"}}function IG(){return function(e){MG(e)}}const HE=[{aliases:{sh:"sh",shell:"sh",zsh:"sh",bash:"bash"},load:()=>kt(()=>import("./bash-Yzrsuije.js"),[])},{aliases:{css:"css"},load:()=>kt(()=>import("./css-CLj8gQPS.js"),[])},{aliases:{diff:"diff",patch:"diff"},load:()=>kt(()=>import("./diff-D97Zzqfu.js"),[])},{aliases:{dockerfile:"dockerfile",docker:"dockerfile"},load:()=>kt(()=>import("./dockerfile-BcOcwvcX.js"),[])},{aliases:{go:"go",golang:"go"},load:()=>kt(()=>import("./go-C27-OAKa.js"),[])},{aliases:{html:"html"},load:()=>kt(()=>import("./html-pp8916En.js"),__vite__mapDeps([3,4,5]))},{aliases:{js:"js",javascript:"js"},load:()=>kt(()=>import("./javascript-wDzz0qaB.js"),[])},{aliases:{json:"json"},load:()=>kt(()=>import("./json-Cp-IABpG.js"),[])},{aliases:{jsx:"jsx"},load:()=>kt(()=>import("./jsx-g9-lgVsj.js"),[])},{aliases:{md:"md",markdown:"md"},load:()=>kt(()=>import("./markdown-Cvjx9yec.js"),[])},{aliases:{py:"py",python:"py"},load:()=>kt(()=>import("./python-B6aJPvgy.js"),[])},{aliases:{rust:"rust",rs:"rust"},load:()=>kt(()=>import("./rust-B1yitclQ.js"),[])},{aliases:{solidity:"solidity",sol:"solidity"},load:()=>kt(()=>import("./solidity-rGO070M0.js"),[])},{aliases:{sparql:"sparql"},load:()=>kt(()=>import("./sparql-DVZY-KUA.js"),[])},{aliases:{sql:"sql"},load:()=>kt(()=>import("./sql-BLtJtn59.js"),[])},{aliases:{toml:"toml"},load:()=>kt(()=>import("./toml-vGWfd6FD.js"),[])},{aliases:{tsx:"tsx"},load:()=>kt(()=>import("./tsx-COt5Ahok.js"),[])},{aliases:{ts:"ts",typescript:"ts"},load:()=>kt(()=>import("./typescript-BPQ3VLAy.js"),[])},{aliases:{xml:"xml"},load:()=>kt(()=>import("./xml-B8PEiB0p.js"),[])},{aliases:{yaml:"yaml",yml:"yaml"},load:()=>kt(()=>import("./yaml-Buea-lGh.js"),[])}],GE=Object.freeze(Object.assign({},...HE.map(({aliases:e})=>e)));Object.freeze(Object.keys(GE));function DG(e){if(!e)return null;const t=e.toLowerCase().trim();return GE[t]??null}async function $Q(){return(await Promise.all(HE.map(({load:t})=>t()))).flatMap(({default:t})=>t).filter((t,n,r)=>r.findIndex(i=>i.name===t.name)===n)}let Bl=null;function zG(){return Bl||(Bl=kt(()=>import("./shikiHighlighter-Dhz3-Gg5.js"),[]).then(e=>e.createHighlighter()).catch(e=>{throw Bl=null,e}),Bl)}function $G({code:e,lang:t}){const n=DG(t),[r,i]=w.useState(null),[o,c]=w.useState(!1),p=tr(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){i(null);return}let m=!1;return zG().then(v=>{if(!m)try{i(v.codeToHtml(e,{lang:n,theme:p}))}catch{i(null)}}).catch(()=>{m||i(null)}),()=>{m=!0}},[e,n,p]),w.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const g=async()=>{try{await navigator.clipboard.writeText(e),c(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>c(!1),1200)}catch{}};return l.jsxs("div",{className:"v10-md-pre",children:[l.jsx("button",{type:"button",className:"v10-md-copy",onClick:g,"aria-label":o?"Copied":"Copy code",title:o?"Copied":"Copy code",children:o?l.jsx(k4,{size:14,"aria-hidden":"true"}):l.jsx(E4,{size:14,"aria-hidden":"true"})}),l.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:o?"Copied":""}),n&&l.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),r?l.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:r}}):l.jsx("pre",{className:"v10-md-pre-fallback",children:l.jsx("code",{children:e})})]})}function PG(){return e=>{let t="none",n=null;const r=new Set(["img","hr","br"]),i=(d,p)=>{const h=d.children;if(Array.isArray(h))for(let g=0;g<h.length;g++){const m=h[g];if(m.type==="text"&&typeof m.value=="string"&&m.value.trim().length>0)p?t="code":(n={siblings:h,index:g},t="text");else if(m.type==="element"){const v=m.tagName;v==="pre"?(t="code",i(m,!0)):v&&r.has(v)?t="leaf":i(m,p)}}},o=e;i(o,!1);const c={type:"element",tagName:"span",properties:{className:["v10-chat-cursor"]},children:[]};if(t==="text"&&n){const{siblings:d,index:p}=n;d.splice(p+1,0,c)}else t==="leaf"&&Array.isArray(o.children)&&o.children.push(c)}}function UG(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function VE({content:e,streaming:t}){return l.jsx("div",{className:"v10-md",children:l.jsx(xq,{remarkPlugins:[OG,IG],rehypePlugins:t?[PG]:[],components:{img:({src:n,alt:r,title:i})=>l.jsxs("span",{className:"v10-md-image-placeholder",title:i||(typeof n=="string"?n:void 0),children:["[image",r?`: ${r}`:"","]"]}),h1:({children:n})=>l.jsx("h1",{className:"v10-md-h1",children:n}),h2:({children:n})=>l.jsx("h2",{className:"v10-md-h2",children:n}),h3:({children:n})=>l.jsx("h3",{className:"v10-md-h3",children:n}),h4:({children:n})=>l.jsx("h4",{className:"v10-md-h4",children:n}),h5:({children:n})=>l.jsx("h5",{className:"v10-md-h5",children:n}),h6:({children:n})=>l.jsx("h6",{className:"v10-md-h6",children:n}),p:({children:n})=>l.jsx("p",{className:"v10-md-p",children:n}),ul:({children:n})=>l.jsx("ul",{className:"v10-md-ul",children:n}),ol:({children:n})=>l.jsx("ol",{className:"v10-md-ol",children:n}),li:({children:n})=>l.jsx("li",{className:"v10-md-li",children:n}),a:({href:n,children:r})=>{const i=UG(n);return i==="http"?l.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:r}):i==="mailto"?l.jsx("a",{className:"v10-md-link",href:n,children:r}):l.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:r})},blockquote:({children:n})=>l.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>l.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>l.jsx("div",{className:"v10-md-table-scroll",children:l.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:r,...i})=>l.jsx("thead",{className:"v10-md-thead",...i,children:n}),tbody:({children:n,node:r,...i})=>l.jsx("tbody",{className:"v10-md-tbody",...i,children:n}),tr:({children:n,node:r,...i})=>l.jsx("tr",{className:"v10-md-tr",...i,children:n}),th:({children:n,node:r,...i})=>l.jsx("th",{className:"v10-md-th",...i,children:n}),td:({children:n,node:r,...i})=>l.jsx("td",{className:"v10-md-td",...i,children:n}),pre:({children:n,node:r})=>{var o,c,d;const i=(o=r==null?void 0:r.children)==null?void 0:o[0];if((i==null?void 0:i.tagName)==="code"){const p=((d=(c=i.properties)==null?void 0:c.className)==null?void 0:d[0])??"",h=/language-([\w-]+)/.exec(p),g=(i.children??[]).map(m=>(m==null?void 0:m.value)??"").join("").replace(/\n$/,"");return l.jsx($G,{code:g,lang:h==null?void 0:h[1]})}return l.jsx("pre",{children:n})},code:({children:n})=>l.jsx("code",{className:"v10-md-code",children:n})},children:e})})}const BG=l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),l.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),FG=Je.lazy(()=>kt(()=>import("./Operations-Cmt3YpaX.js"),__vite__mapDeps([6,1])).then(e=>({default:e.OperationsPage}))),qG=Je.lazy(()=>kt(()=>import("./AgentHub-BOUZTvCO.js"),[]).then(e=>({default:e.AgentHubPage}))),HG=Je.lazy(()=>kt(()=>import("./Settings-CvBKeoTW.js"),[]).then(e=>({default:e.SettingsPage}))),GG=Je.lazy(()=>kt(()=>import("./AgentProfilePage-DpF722ai.js"),[]).then(e=>({default:e.AgentProfilePage}))),VG=Je.lazy(()=>kt(()=>import("./PublishingConviction-L-wHlnRP.js"),__vite__mapDeps([7,8])).then(e=>({default:e.PublishingConvictionPage}))),WG=Je.lazy(()=>kt(()=>import("./ConvictionDetailView-DYsWNc9M.js"),__vite__mapDeps([9,8])).then(e=>({default:e.ConvictionDetailView})));function ZG(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:r}=gn();return l.jsx("div",{className:"v10-center-tabs",children:e.map(i=>l.jsxs("button",{className:`v10-center-tab ${i.id===t?"active":""}`,onClick:()=>n(i.id),children:[l.jsx("span",{className:"v10-center-tab-label",children:i.label}),i.closable&&l.jsx("span",{className:"v10-center-tab-close",onClick:o=>{o.stopPropagation(),r(i.id)},children:BG})]},i.id))})}const QG=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function KG(e){return QG.some(t=>e.startsWith(t))}function YG({docRef:e,contentType:t}){const{tabs:n,activeTabId:r,closeTab:i}=gn(),o=gn(R=>R.setActiveTab),[c,d]=w.useState(null),[p,h]=w.useState(null),[g,m]=w.useState(""),[v,b]=w.useState(!0),[k,j]=w.useState(null),[C,S]=w.useState("formatted"),N=e.startsWith("urn:dkg:file:"),A=n.find(R=>R.id===r),O=(A==null?void 0:A.label)??"Document",M=()=>{const R=n.find(z=>z.id.startsWith("project:"));R&&o(R.id),i(r)};w.useEffect(()=>{let R=!1;if(b(!0),j(null),d(null),h(null),m(""),!N){b(!1);return}const z=e.replace("urn:dkg:file:",""),F=new AbortController;return fetch(pd(z,t||void 0),{headers:Bt(),signal:F.signal}).then(async Y=>{if(!Y.ok)throw new Error(`HTTP ${Y.status}`);const D=Y.headers.get("content-type")??"application/octet-stream";if(!R)if(m(D),KG(D)){const q=await Y.text();R||(d(q),b(!1))}else if(D.startsWith("image/")){const q=await Y.blob();R||(h(URL.createObjectURL(q)),b(!1))}else if(D==="application/pdf"){const q=await Y.blob();R||(h(URL.createObjectURL(q)),b(!1))}else{const q=await Y.text();R||(d(q),b(!1))}}).catch(Y=>{R||(j(Y.message),b(!1))}),()=>{R=!0,F.abort()}},[e,N,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const R=p;return()=>{R&&URL.revokeObjectURL(R)}},[p]);const T=g.startsWith("image/"),L=g==="application/pdf",B=g.startsWith("text/markdown")||t.startsWith("text/markdown"),_=!v&&!k&&N&&B&&c!==null;return l.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[l.jsxs("div",{style:{flexShrink:0,display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border-subtle)",background:"var(--bg-panel)"},children:[l.jsx("button",{onClick:M,style:{border:"1px solid var(--border-default)",borderRadius:5,background:"none",color:"var(--text-secondary)",fontSize:11,fontWeight:600,padding:"4px 10px",cursor:"pointer",fontFamily:"var(--font-sans)"},children:"← Back to Project"}),l.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:["📄 ",O]}),_&&l.jsx("div",{role:"group","aria-label":"Document view mode",style:{marginLeft:"auto",display:"flex",gap:2,padding:2,border:"1px solid var(--border-default)",borderRadius:6,background:"var(--bg-surface)"},children:["formatted","raw"].map(R=>{const z=C===R;return l.jsx("button",{type:"button","aria-pressed":z,onClick:()=>S(R),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:z?"var(--text-primary)":"var(--text-secondary)",background:z?"var(--bg-elevated)":"transparent"},children:R==="formatted"?"Formatted":"Raw"},R)})})]}),l.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:N?l.jsxs(l.Fragment,{children:[v&&l.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading document..."}),k&&l.jsxs("div",{style:{color:"var(--accent-red)",fontSize:12},children:["Failed to load: ",k]}),!v&&T&&p&&l.jsx("img",{src:p,alt:O,style:{maxWidth:"100%",borderRadius:8}}),!v&&L&&p&&l.jsx("iframe",{src:p,title:O,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),c!==null&&!T&&!L&&B&&C==="formatted"&&l.jsx("div",{style:{background:"var(--bg-surface)",borderRadius:8,padding:"16px 20px",border:"1px solid var(--border-default)",color:"var(--text-primary)"},children:l.jsx(VE,{content:c})}),c!==null&&!T&&!L&&!(B&&C==="formatted")&&l.jsx("pre",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.7,color:"var(--text-primary)",whiteSpace:"pre-wrap",wordBreak:"break-word",background:"var(--bg-surface)",borderRadius:8,padding:16,border:"1px solid var(--border-default)",margin:0},children:c})]}):l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,height:"100%",color:"var(--text-tertiary)",textAlign:"center"},children:[l.jsx("span",{style:{fontSize:28,opacity:.6},children:"📄"}),l.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)"},children:"Source file not available for this document"}),l.jsx("span",{style:{fontSize:12,maxWidth:360,lineHeight:1.6},children:"This document was indexed into the graph without a stored source file, so there is nothing to preview here. You can still explore its extracted entities and relationships in the graph."})]})})]})}function XG(){const e=gn(t=>t.activeTabId);if(e==="dashboard")return l.jsx(wD,{});if(e==="operations")return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:l.jsx(FG,{})});if(e==="agent-hub")return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:l.jsx(qG,{})});if(e==="settings")return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:l.jsx(HG,{})});if(e==="conviction")return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading Publisher Conviction..."}),children:l.jsx(VG,{})});if(e==="memory-stack")return l.jsx(i9,{});if(e===Mv)return l.jsx(H8,{});if(e.startsWith("project:")){const t=e.slice(8);return l.jsx(F8,{contextGraphId:t})}if(e.startsWith("conviction:")){const t=e.slice(11);return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading account..."}),children:l.jsx(WG,{accountId:t})})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const r=t.slice(0,n),i=t.slice(n+1),o=i.includes(":")?i:`urn:dkg:agent:${i}`;return l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading agent…"}),children:l.jsx(GG,{contextGraphId:r,agentUri:o})})}}if(e.startsWith(Dv)){const{docRef:t,contentType:n}=Mz(e);return l.jsx(YG,{docRef:t,contentType:n})}return e.startsWith("wm:")?l.jsx(jm,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?l.jsx(jm,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?l.jsx(jm,{layer:"vm",contextGraphId:e.slice(3)}):l.jsx("div",{className:"v10-view-placeholder",children:l.jsxs("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:['View "',e,'" coming soon.']})})}function JG(){return l.jsxs("div",{className:"v10-panel-center",children:[l.jsx(ZG,{}),l.jsx("div",{className:"v10-center-content",children:l.jsx(XG,{})})]})}const eV=["Node Log","Transactions"],tV=l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:l.jsx("polyline",{points:"6 9 12 15 18 9"})}),nV=l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("polyline",{points:"15 3 21 3 21 9"}),l.jsx("polyline",{points:"9 21 3 21 3 15"}),l.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),l.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),rV=l.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[l.jsx("polyline",{points:"4 14 10 14 10 20"}),l.jsx("polyline",{points:"20 10 14 10 14 4"}),l.jsx("line",{x1:"10",y1:"14",x2:"3",y2:"21"}),l.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"})]}),aV=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function iV(e){return e.replace(aV,"")}function xS(e){const t=e.toLowerCase();return t.includes("error")||t.includes(" err ")||t.includes("[error]")?"error":t.includes("warn")||t.includes("[warn]")?"warn":t.includes("debug")||t.includes("[debug]")||t.includes("trace")?"debug":"info"}const sV={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function oV(e){const t=w.useRef(null),n=w.useRef(!0);return w.useEffect(()=>{const r=t.current;if(!r)return;const i=()=>{n.current=r.scrollHeight-r.scrollTop-r.clientHeight<40};return r.addEventListener("scroll",i),()=>r.removeEventListener("scroll",i)},[]),w.useEffect(()=>{n.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),t}function lV(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[i,o]=w.useState("all"),c=w.useCallback(()=>{kn.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(iV))).catch(()=>{})},[n]);w.useEffect(()=>{c();const g=setInterval(c,3e3);return()=>clearInterval(g)},[c]);const d=e.filter(g=>i==="all"||xS(g)===i),p=d.length>0?d[d.length-1]:"",h=oV(p);return l.jsxs("div",{className:"v10-log-container",children:[l.jsxs("div",{className:"v10-log-toolbar",children:[l.jsx("input",{id:"dkg-node-log-filter",name:"dkg-node-log-filter",type:"text",placeholder:"Filter logs...",className:"v10-log-filter",value:n,onChange:g=>r(g.target.value),"aria-label":"Filter node log lines"}),l.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:i,onChange:g=>o(g.target.value),"aria-label":"Filter node log level",children:[l.jsx("option",{value:"all",children:"All"}),l.jsx("option",{value:"error",children:"Error"}),l.jsx("option",{value:"warn",children:"Warn"}),l.jsx("option",{value:"info",children:"Info"}),l.jsx("option",{value:"debug",children:"Debug"})]})]}),l.jsxs("div",{className:"v10-log-output",ref:h,children:[d.map((g,m)=>l.jsx("div",{className:"v10-log-line",style:{color:sV[xS(g)]},children:g},m)),d.length===0&&l.jsx("div",{className:"v10-log-line",style:{color:"var(--text-tertiary)"},children:"No log output"})]})]})}const cV=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),uV={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function dV(){const[e,t]=w.useState([]),[n,r]=w.useState(null),i=w.useCallback(()=>{const o=String(Date.now()-216e5),c=[...cV].join(",");kn.fetchOperationsWithPhases({limit:"100",from:o,names:c}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{i();const o=setInterval(i,1e4);return()=>clearInterval(o)},[i]),e.length===0?l.jsx("div",{style:{padding:"20px 16px",color:"var(--text-tertiary)",fontSize:12},children:"No publish, update, or verify activity in the last 6 hours."}):l.jsx("div",{className:"v10-log-output",style:{overflowY:"auto",flex:1},children:l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[l.jsx("thead",{children:l.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)",color:"var(--text-secondary)",textAlign:"left"},children:[l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Type"}),l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"ID"}),l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Status"}),l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Duration"}),l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Time"}),l.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Tx Hash"})]})}),l.jsx("tbody",{children:e.map(o=>{const c=(o.phases??[]).find(h=>h.phase==="chain"),d=o.tx_hash??(c==null?void 0:c.tx_hash),p=n===o.operation_id;return l.jsxs(Je.Fragment,{children:[l.jsxs("tr",{onClick:()=>r(h=>h===o.operation_id?null:o.operation_id),style:{borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",background:p?"rgba(255,255,255,.03)":void 0},children:[l.jsx("td",{style:{padding:"7px 12px",color:uV[o.operation_name]??"var(--text-secondary)",fontWeight:600},children:o.operation_name}),l.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)"},children:lw(o.operation_id)}),l.jsx("td",{style:{padding:"7px 12px"},children:l.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:600,background:o.status==="success"?"rgba(34,197,94,.15)":o.status==="error"?"rgba(239,68,68,.15)":"rgba(245,158,11,.15)",color:o.status==="success"?"#22c55e":o.status==="error"?"#ef4444":"#f59e0b"},children:o.status})}),l.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:o.duration_ms!=null?ow(o.duration_ms):"—"}),l.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:o.started_at?EI(o.started_at):"—"}),l.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-tertiary)",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d?`${d.slice(0,10)}…`:o.status==="success"?l.jsx("span",{style:{fontFamily:"var(--font-sans)",fontStyle:"italic",color:"var(--text-tertiary)"},children:"local"}):"—"})]}),p&&l.jsx("tr",{style:{background:"rgba(0,0,0,.2)"},children:l.jsxs("td",{colSpan:6,style:{padding:"8px 16px"},children:[l.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:16,fontSize:11,color:"var(--text-secondary)"},children:[l.jsxs("span",{children:[l.jsx("b",{children:"ID:"})," ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:o.operation_id})]}),d&&l.jsxs("span",{children:[l.jsx("b",{children:"Tx:"})," ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:d})]}),o.peer_id&&l.jsxs("span",{children:[l.jsx("b",{children:"Peer:"})," ",l.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:lw(o.peer_id)})]}),o.error_message&&l.jsxs("span",{style:{color:"#ef4444"},children:[l.jsx("b",{children:"Error:"})," ",o.error_message]})]}),(o.phases??[]).length>0&&l.jsx("div",{style:{marginTop:8,display:"flex",gap:6,flexWrap:"wrap"},children:o.phases.map(h=>l.jsxs("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:10,fontWeight:600,background:"rgba(255,255,255,.06)",color:"var(--text-secondary)"},children:[h.phase," ",h.duration_ms!=null?ow(h.duration_ms):""]},h.phase))})]})})]},o.operation_id)})})]})})}function fV(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:r,bottomHeight:i,setBottomHeight:o}=tr(),[c,d]=w.useState("Node Log"),p=w.useRef(null),h=w.useRef(i);h.current=i,w.useEffect(()=>{const m=p.current;if(!m)return;let v=0;const b=C=>{const S=v-C.clientY;v=C.clientY,o(h.current+S)},k=()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",k),document.body.style.cursor="",document.body.style.userSelect="",m.classList.remove("active")},j=C=>{C.preventDefault(),v=C.clientY,document.addEventListener("mousemove",b),document.addEventListener("mouseup",k),document.body.style.cursor="row-resize",document.body.style.userSelect="none",m.classList.add("active")};return m.addEventListener("mousedown",j),()=>m.removeEventListener("mousedown",j)},[o]);const g=e?void 0:n?"80vh":Math.min(i,Ed());return l.jsxs("div",{className:`v10-panel-bottom ${e?"collapsed":""} ${n?"maximised":""}`,style:e?void 0:{height:g},children:[!e&&!n&&l.jsx("div",{className:"v10-resize-handle-v",ref:p,title:"Drag to resize"}),l.jsxs("div",{className:"v10-bottom-tabs",children:[eV.map(m=>l.jsx("button",{className:`v10-bottom-tab ${m===c?"active":""}`,onClick:()=>{d(m),e&&t()},children:m},m)),l.jsx("div",{style:{flex:1}}),l.jsx("button",{className:"v10-bottom-toggle",onClick:r,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?rV:nV}),l.jsx("button",{className:"v10-bottom-toggle",onClick:t,title:e?"Expand":"Collapse",children:l.jsx("span",{style:{transform:e?"rotate(180deg)":"none",display:"flex",transition:"transform 0.15s"},children:tV})})]}),!e&&l.jsxs("div",{className:"v10-bottom-content",children:[c==="Node Log"&&l.jsx(lV,{}),c==="Transactions"&&l.jsx(dV,{})]})]})}function wS(e){const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Qd(e){if(e==null||e==="")return"";const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?typeof e=="string"?e:"":t.toLocaleString([],{dateStyle:"medium",timeStyle:"short"})}function Dg(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function pV(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function hV(e){var n;const t=((n=e.split(".").pop())==null?void 0:n.toLowerCase())??"";return["md","txt","csv","json","xml","yaml","yml"].includes(t)?"TXT":["pdf"].includes(t)?"PDF":["docx","doc"].includes(t)?"DOC":["png","jpg","jpeg","webp"].includes(t)?"IMG":["py","ts","js","tsx","jsx","java","go","rs","c","cpp"].includes(t)?"CODE":"FILE"}function zg(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.name)??t}function mV(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function gV(e){return String(e??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim()}function WE(e){if(e.length===0)return"";const t=e.map(n=>n.fileName);return t.length<=2?`Attached ${t.join(" and ")}.`:`Attached ${t[0]} and ${t.length-1} more files.`}function ZE(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function QE(e){return e.name.trim()}function vV(e){if(e.status!=="completed"||!e.result)return null;const t=e.result.extraction.mdIntermediateHash,n=t??(e.result.detectedContentType==="text/markdown"?e.result.fileHash:void 0);return{id:e.id,fileName:QE(e.file),contextGraphId:e.contextGraphId,assertionName:e.assertionName,assertionUri:e.result.assertionUri,fileHash:e.result.fileHash,detectedContentType:e.result.detectedContentType,rootEntity:e.result.rootEntity,extractionStatus:"completed",tripleCount:e.result.extraction.tripleCount??e.result.extraction.triplesWritten,...t?{mdIntermediateHash:t}:{},...n?{markdownHash:n,markdownForm:`urn:dkg:file:${n}`}:{}}}function yV(e){const t=[];return{results:e.flatMap(r=>{if(r.status!=="skipped"||!r.result)return[];t.push(r.id);const i=r.result,o=i.extraction;return[{id:r.id,fileName:QE(r.file),contextGraphId:r.contextGraphId,assertionName:r.assertionName,assertionUri:i.assertionUri,fileHash:i.fileHash,detectedContentType:i.detectedContentType,extractionStatus:"skipped",pipelineUsed:o.pipelineUsed??null,tripleCount:o.tripleCount??o.triplesWritten??0,...i.rootEntity?{rootEntity:i.rootEntity}:{},...o.mdIntermediateHash?{mdIntermediateHash:o.mdIntermediateHash}:{},...o.error?{error:o.error}:{}}]}),deliveredDraftIds:t}}function KE(e){return e.length===0?"":e.length===1?`Attachment import result: ${gV(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function bV(e,t){const n=[WE(e),KE(t)].filter(r=>r.length>0).map(r=>r.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function xV(e,t,n){const r=[];if(t){const i=zg(e,t);r.push({key:"target_context_graph",label:"Target context graph id",value:t}),r.push({key:"target_context_graph_uri",label:"Target context graph URI",value:mV(t)}),r.push({key:"target_context_graph_name",label:"Target context graph name",value:i})}return n!=null&&n.agentAddress&&r.push({key:"current_agent_address",label:"Current agent address",value:n.agentAddress}),n!=null&&n.agentDid&&r.push({key:"current_agent_did",label:"Current agent DID",value:n.agentDid}),n!=null&&n.peerId&&r.push({key:"current_agent_peer_id",label:"Current agent peer ID",value:n.peerId}),r}const wV="https://docs.openclaw.ai/",kV="https://github.com/openclaw/openclaw/releases",os="__add_agent__",SV=["openclaw"];function jV(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof Rd){if(t.code==="HERMES_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="HERMES_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="OPENCLAW_BRIDGE_RESPONSE_TIMEOUT")return`${e.name} bridge response timed out.`;if(t.code==="OPENCLAW_GATEWAY_RESPONSE_TIMEOUT")return`${e.name} gateway response timed out.`;if(t.code==="PRIME_AGENT_SESSION_BUSY")return`${e.name} session is busy — try again in a moment.`;if(t.code==="PRIME_AGENT_NO_SESSION")return`No live ${e.name} session is available. Start or resume a session, then send again.`;if(t.code==="PRIME_AGENT_PROVIDER_UNAUTHORIZED")return`${e.name} provider authentication failed. Check its provider credentials and try again.`;if(t.code==="PRIME_AGENT_PROVIDER_ERROR")return`${e.name} provider request failed. Check its provider configuration and try again.`;if(t.code==="PRIME_AGENT_TURN_ABORTED")return`${e.name} turn was aborted.`;if(t.code==="PRIME_AGENT_TURN_TIMEOUT")return`${e.name} turn exceeded its maximum run time.`;if(t.code==="PRIME_AGENT_DELIVERY_FAILED")return`${e.name} rejected the message before starting the turn.`;if(t.code==="SWM_SYNC_TIMEOUT"||t.source==="background-sync")return"Background sync timed out. The chat request was not marked as failed by the local-agent bridge."}return/OpenClaw bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/Hermes bridge unreachable/i.test(n)?`${e.name} is unavailable right now.`:/gateway response timeout/i.test(n)?`${e.name} gateway response timed out.`:/bridge response timeout/i.test(n)||/aborted due to timeout/i.test(n)?`${e.name} bridge response timed out.`:/Agent response timeout/i.test(n)?`${e.name} took too long to respond.`:/Agent returned no text response/i.test(n)||/\(no response\)/i.test(n)?`${e.name} did not return a text reply.`:n}function qm(e,t,n){return e+(t-e)*n}function YE(e){return e-Math.floor(e)}function Hm(e,t){const n=Math.floor(e),r=Math.floor(t);let i=e-n,o=t-r;i=i*i*(3-2*i),o=o*o*(3-2*o);const c=Lr(n,r),d=Lr(n+1,r),p=Lr(n,r+1),h=Lr(n+1,r+1);return c+(d-c)*i+(p-c)*o+(c-d-p+h)*i*o}function Lr(e,t){const n=Math.sin(e*12.9898+t*78.233)*43758.5453;return n-Math.floor(n)}function hy(e,t){const n=Math.PI*(3-Math.sqrt(5)),r=1-2*(e+.5)/t,i=Math.sqrt(1-r*r),o=e*n;return[i*Math.cos(o),r,i*Math.sin(o)]}function CV(e,t){return Math.atan2(Math.sin(e-t),Math.cos(e-t))}function bs(e,t,n,r,i){const o=Math.sin(t),c=Math.cos(t),d=Math.sin(e),p=Math.cos(e);return(h,g,m)=>{const v=h*p+m*d,b=-h*d+m*p,k=g*c-b*o,j=g*o+b*c;return[n+v*i,r-k*i,j]}}function Mi(e,t,n,r=.3){t.sort((i,o)=>i.z-o.z);for(const i of t){const o=i.a??1;if(o<.02)continue;const c=Math.min(1,Math.max(0,i.white)),d=Math.round((n?1-c:c)*255);e.fillStyle=`rgba(${d},${d},${d},${o})`,e.beginPath(),e.arc(i.x,i.y,Math.max(r,i.r),0,Math.PI*2),e.fill()}}function NV(e,t,n){for(const r of t){const i=r.a??1;if(i<.02)continue;const o=Math.min(1,Math.max(0,r.white)),c=Math.round((n?1-o:o)*255);e.strokeStyle=`rgba(${c},${c},${c},${i})`,e.lineWidth=r.w,e.beginPath(),e.moveTo(r.x1,r.y1),e.lineTo(r.x2,r.y2),e.stroke()}}function xs(e,t){return(e/300)**t}const EV=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.76,p=bs(n*.4,.3,o,c,1),h=xs(t,i.rsPow??.6),g=[],m=i.ghostN??150;for(let k=0;k<m;k++){const j=hy(k,m),[C,S,N]=p(j[0]*d,j[1]*d,j[2]*d),A=(N/d+1)/2;g.push({x:C,y:S,z:N,r:.8*h,white:.78,a:.1+.22*A})}const v=i.strandN??52,b=i.turns??3;for(let k=0;k<3;k++){const j=k/3*2*Math.PI;for(let C=0;C<v;C++){const S=(YE(C/v+n*.045)*2-1)*.96,N=Math.sqrt(Math.max(0,1-S*S)),A=Math.min(1,(1-Math.abs(S))/.1),O=S*Math.PI*b+j,M=1+.075*Math.sin(S*Math.PI*b*2+j*2+n*.8),T=N*d*M,[L,B,_]=p(Math.cos(O)*T,S*d*M,Math.sin(O)*T),R=(_/d+1)/2;g.push({x:L,y:B,z:_,r:((i.rBase??1.2)+(i.rDepth??1.8)*R)*h,white:.55-.45*R,a:A*(.45+.55*R)})}}Mi(e,g,r,i.rMin)};function AV(e,t,n,r){const i=2*t*n+r,o=e%i,c=new Array(t).fill(0);let d=-1;if(o<2*t*n){const p=Math.floor(o/n),h=(o-p*n)/n,g=1-(1-Math.min(1,h/.7))**3;if(p<t){for(let m=0;m<p;m++)c[m]=1;c[p]=g,d=p}else{const m=2*t-1-p;for(let v=0;v<m;v++)c[v]=1;c[m]=1-g,d=m}}return{amount:c,active:d}}function TV(e,t,n){let[r,i,o]=e,c=!1;for(let d=0;d<t.length;d++){if(n.amount[d]<=0)continue;const p=t[d],h=p.axis===0?r:p.axis===1?i:o;if(h<p.lo||h>=p.hi)continue;d===n.active&&(c=!0);const g=p.ang*n.amount[d],m=Math.cos(g),v=Math.sin(g);if(p.axis===0){const b=i*m-o*v;o=i*v+o*m,i=b}else if(p.axis===1){const b=r*m+o*v;o=-r*v+o*m,r=b}else{const b=r*m-i*v;i=r*v+i*m,r=b}}return[r,i,o,c]}function RV(e){const t=[];for(let n=0;n<e;n++){const r=Math.min(2,Math.floor(Lr(n,2.3)*3)),i=-1+.5*Math.min(3,Math.floor(Lr(n,5.9)*4)),o=Lr(n,7.7)<.5?1:-1;t.push({axis:r,lo:i,hi:i+.5,ang:o*Math.PI/2})}return t}const _V=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.82,p=.4+.06*Math.sin(n*.35),h=bs(n*.5,p,o,c,d),g=n*(.5+(1.7-.5)*(i.scanMul??1)),m=xs(t,i.rsPow??.6),v=i.dimBase??1,b=[],k=i.latRings??17,j=i.lonDensity??44;for(let C=0;C<=k;C++){const S=-Math.PI/2+C/k*Math.PI,N=Math.cos(S),A=Math.sin(S),O=Math.max(1,Math.round(Math.abs(N)*j));for(let M=0;M<O;M++){const T=M/O*2*Math.PI,[L,B,_]=h(N*Math.cos(T),A,N*Math.sin(T)),R=(_+1)/2,z=CV(T+n*.5,g),F=Math.exp(-(z*z)/.18)*Math.max(0,_);b.push({x:L,y:B,z:_,r:((i.rBase??.6)+(i.rDepth??1.7)*R+(i.rBoost??1)*F)*m,white:(i.inkFar??.62)-(i.inkSpan??.54)*R,a:v+(1-v)*Math.min(1,F)})}}Mi(e,b,r,i.rMin)},OV=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.82,p=bs(n*.55,.35+.1*Math.sin(n*.9),o,c,d),h=xs(t,i.rsPow??.6),g=i.moveCount??14,m=RV(g),v=AV(n,g,.42,1.2),b=[],k=i.latRings??15,j=i.lonDensity??40;for(let C=0;C<=k;C++){const S=-Math.PI/2+C/k*Math.PI,N=Math.cos(S),A=Math.sin(S),O=Math.max(1,Math.round(Math.abs(N)*j));for(let M=0;M<O;M++){const T=M/O*2*Math.PI,[L,B,_,R]=TV([N*Math.cos(T),A,N*Math.sin(T)],m,v),[z,F,Y]=p(L,B,_),D=(Y+1)/2;b.push({x:z,y:F,z:Y,r:((i.rBase??.6)+(i.rDepth??1.7)*D+(R?i.rActive??.3:0))*h,white:(i.inkFar??.62)-(i.inkSpan??.54)*D-(R?.14:0)})}}Mi(e,b,r,i.rMin)},MV=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.874,p=bs(n*.18,.38,o,c,1),h=xs(t,i.rsPow??.6),g=[],m=i.rings??15,v=i.lonDensity??40;for(let b=0;b<=m;b++){const k=-Math.PI/2+b/m*Math.PI,j=Math.cos(k),C=Math.sin(k),S=.62*Math.sin(n*2.1-b*.52)+.38*Math.sin(n*1.27+b*.83),N=d*(.88+.105*S),A=Math.max(1,Math.round(Math.abs(j)*v));for(let O=0;O<A;O++){const M=O/A*2*Math.PI,[T,L,B]=p(j*Math.cos(M)*N,C*N,j*Math.sin(M)*N),_=(B/d+1)/2,R=Math.max(0,S);g.push({x:T,y:L,z:B,r:((i.rBase??.6)+(i.rDepth??1.7)*_)*(1+.4*R)*h,white:.66-.56*_-.1*R})}}Mi(e,g,r,i.rMin)};function LV(e){return e*e*(3-2*e)}function XE(e){const t=e.length,n=[];let r=0;for(let i=0;i<t;i++){const o=e[i],c=e[(i+1)%t],d=Math.hypot(c[0]-o[0],c[1]-o[1]);n.push(d),r+=d}return i=>{let o=i*r,c=0;for(;o>n[c]&&c<t-1;)o-=n[c],c++;const d=e[c],p=e[(c+1)%t],h=n[c]?Math.min(1,o/n[c]):0;return[d[0]+(p[0]-d[0])*h,d[1]+(p[1]-d[1])*h]}}const IV=e=>{const t=-Math.PI/2+e*2*Math.PI;return[Math.cos(t)*.24,Math.sin(t)*.24]},DV=XE([[0,-.26],[.24,.16],[-.24,.16]]),zV=XE([[0,-.2],[.2,-.2],[.2,.2],[-.2,.2],[-.2,-.2]]),Gm=[IV,DV,zV];function $V(e){return Math.max(6,Math.round(34*e))}const $g=1.4,JE=.9,Vm=$g+JE,PV=(e,t,n,r,i)=>{const o=Gm.length,c=n%(Vm*o),d=Math.floor(c/Vm),p=c-d*Vm,h=p>$g?LV((p-$g)/JE):0,g=i.spread??1,m=Gm[d],v=Gm[(d+1)%o],b=160,k=[];for(let B=0;B<b;B++){const _=B/b,R=m(_),z=v(_);k.push([(R[0]+(z[0]-R[0])*h)*g,(R[1]+(z[1]-R[1])*h)*g])}const j=[];let C=0;for(let B=0;B<b;B++){const _=k[B],R=k[(B+1)%b],z=Math.hypot(R[0]-_[0],R[1]-_[1]);j.push(z),C+=z}const S=$V(i.iconD??1),N=(i.rDot??.021)*1.35*g,A=1+.02*Math.sin(p*3.1),O=[],M=t/2;let T=0,L=0;for(let B=0;B<S;B++){const _=B/S*C;for(;L+j[T]<_&&T<b-1;)L+=j[T],T++;const R=k[T],z=k[(T+1)%b],F=j[T]?Math.min(1,(_-L)/j[T]):0,Y=(R[0]+(z[0]-R[0])*F)*A,D=(R[1]+(z[1]-R[1])*F)*A;O.push({x:M+Y*t,y:M+D*t,z:0,r:Math.max(.35,N*t),white:.1})}Mi(e,O,r,i.rMin)},UV=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.82,p=bs(n*.12,.3,o,c,1),h=xs(t,i.rsPow??.6),g=[],m=i.orbitN??12,v=i.ghostN??40,b=i.particles??3;for(let k=0;k<m;k++){const j=Lr(k,1.7),C=Lr(k,5.2),S=Lr(k,8.9),N=d*(.45+.52*j),A=j*2*Math.PI,O=Math.acos(2*C-1),M=Math.sin(O)*Math.cos(A),T=Math.cos(O),L=Math.sin(O)*Math.sin(A);let B=-T,_=M;const R=0,z=Math.max(1e-6,Math.sqrt(B*B+_*_));B/=z,_/=z;const F=T*R-L*_,Y=L*B-M*R,D=M*_-T*B,q=(.25+.55*S)*(S>.5?1:-1);for(let G=0;G<v;G++){const W=G/v*2*Math.PI,[Q,H,$]=p((B*Math.cos(W)+F*Math.sin(W))*N,(_*Math.cos(W)+Y*Math.sin(W))*N,(R*Math.cos(W)+D*Math.sin(W))*N),U=($/N+1)/2;g.push({x:Q,y:H,z:$,r:(i.ghostR??.9)*h,white:.72,a:(i.ghostA??.5)*(.4+.6*U)})}for(let G=0;G<b;G++){const W=n*q+G/b*2*Math.PI+C*6,[Q,H,$]=p((B*Math.cos(W)+F*Math.sin(W))*N,(_*Math.cos(W)+Y*Math.sin(W))*N,(R*Math.cos(W)+D*Math.sin(W))*N),U=($/N+1)/2;g.push({x:Q,y:H,z:$,r:((i.partR??1.2)+(i.partRDepth??1.6)*U)*h,white:.3-.22*U})}}Mi(e,g,r,i.rMin)},kS=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.78,p=i.spin??1,h=.3,g=bs(n*.1*p,h,o,c,1),m=xs(t,i.rsPow??.6),v=[],b=i.ghostN??150;for(let D=0;D<b;D++){const q=hy(D,b),[G,W,Q]=g(q[0]*d,q[1]*d,q[2]*d),H=(Q/d+1)/2;v.push({x:G,y:W,z:Q,r:.8*m,white:.78,a:.1+.22*H})}const k=n*.24*p,j=i.faceOn?-h:.55+.3*Math.sin(n*.18)*p,C=Math.cos(k),S=0,N=Math.sin(k),A=-N*Math.sin(j),O=Math.cos(j),M=C*Math.sin(j),T=S*M-N*O,L=N*A-C*M,B=C*O-S*A,_=.23*(i.wobMul??1),R=i.faceOn?d/(1+.85*_):d,z=i.lanes??5,F=i.segs??88,Y=Math.max(1,Math.round(z*(i.bandMul??1)));for(let D=0;D<Y;D++){const q=(D-(Y-1)/2)*.075,G=Math.abs(D-(Y-1)/2)/Math.max(1,(Y-1)/2);for(let W=0;W<F;W++){const Q=W/F*2*Math.PI,H=(.16*Math.sin(Q*3-n*1.7+D*.22)+.07*Math.sin(Q*5+n*1.1))*(i.wobMul??1),$=i.faceOn?1+H:1,U=i.faceOn?q:q+H,Z=C*Math.cos(Q)+A*Math.sin(Q)+T*U,I=S*Math.cos(Q)+O*Math.sin(Q)+L*U,ae=N*Math.cos(Q)+M*Math.sin(Q)+B*U,le=Math.sqrt(Z*Z+I*I+ae*ae),oe=R*$,[we,Ee,Oe]=g(Z/le*oe,I/le*oe,ae/le*oe),He=(Oe/d+1)/2;v.push({x:we,y:Ee,z:Oe,r:((i.rBase??1.1)+(i.rDepth??1.7)*He)*(1-.25*G)*m,white:.52-.44*He+.18*G,a:.4+.6*He})}}Mi(e,v,r,i.rMin)},BV=(e,t,n,r,i)=>{const o=t/2,c=t/2,d=t/2*.8*(i.spread??1),p=bs(n*.12,.32,o,c,d),h=xs(t,i.rsPow??.6),g=i.nodeN??30,m=i.thr??.72,v=i.nodeR??1.4,b=i.nodeRDepth??1.8,k=[];for(let N=0;N<g;N++){const A=hy(N,g),O=A[0]+.3*(Hm(N*.31+9,n*.24)-.5)*2,M=A[1]+.3*(Hm(N*.53+27,n*.21)-.5)*2,T=A[2]+.3*(Hm(N*.77+55,n*.27)-.5)*2,L=Math.sqrt(O*O+M*M+T*T);k.push([O/L,M/L,T/L])}const j=[],C=[];for(let N=0;N<g;N++)for(let A=N+1;A<g;A++){const O=k[N][0]-k[A][0],M=k[N][1]-k[A][1],T=k[N][2]-k[A][2],L=Math.sqrt(O*O+M*M+T*T);if(L>=m)continue;const[B,_,R]=p(k[N][0],k[N][1],k[N][2]),[z,F,Y]=p(k[A][0],k[A][1],k[A][2]),D=((R+Y)/2+1)/2;j.push({x1:B,y1:_,x2:z,y2:F,white:.42,a:(1-L/m)*(.3+.55*D),w:Math.max(.6,(i.lineW??.8)*h)})}for(let N=0;N<g;N++){const[A,O,M]=p(k[N][0],k[N][1],k[N][2]),T=(M+1)/2,L=1+.25*Math.sin(n*1.4+N*2.7);C.push({x:A,y:O,z:M,r:(v+b*T)*L*h,white:.55-.45*T})}const S=i.signals??5;for(let N=0;N<S;N++){const A=Math.floor(n*.55+N*7.31),O=Math.floor(Lr(A,N*3.1+1.7)*g),M=Math.floor(Lr(A,N*5.7+4.2)*g);if(O===M)continue;const T=YE(n*.55+N*7.31),L=qm(k[O][0],k[M][0],T),B=qm(k[O][1],k[M][1],T),_=qm(k[O][2],k[M][2],T),R=Math.max(1e-6,Math.sqrt(L*L+B*B+_*_)),[z,F,Y]=p(L/R,B/R,_/R),D=(Y+1)/2;C.push({x:z,y:F,z:Y,r:(v*1.5+b*D)*h,white:.05,a:.5+.5*D})}NV(e,j,r),Mi(e,C,r,i.rMin)},FV={orbits:UV,globe:_V,rubik:OV,wave:MV,web:BV,braid:EV,ribbon:kS,ring:kS,morph:PV},qV=[["latRings","lonDensity"],["rings","lonDensity"],["lanes","segs"]],HV=["orbitN","ghostN","nodeN","strandN","signals"],GV=["iconD"],VV=["rBase","rDepth","rActive","rDot","ghostR","partR","partRDepth","nodeR","nodeRDepth"];function WV(e,t){const n={...e},r=new Set,i=Math.sqrt(t);for(const[o,c]of qV){const d=n[o],p=n[c];d!=null&&p!=null&&!r.has(o)&&!r.has(c)&&(n[o]=Math.max(2,Math.round(d*i)),n[c]=Math.max(2,Math.round(p*i)),r.add(o),r.add(c))}for(const o of HV){const c=n[o];c!=null&&c!==0&&!r.has(o)&&(n[o]=Math.max(1,Math.round(c*t)))}for(const o of GV){const c=n[o];c!=null&&(n[o]=Math.max(.02,c*t))}return n}function ZV(e,t){const n={...e};for(const r of VV){const i=n[r];i!=null&&(n[r]=i*t)}return n.rSizeMul=(n.rSizeMul??1)*t,n}const QV={globe:{latRings:17,lonDensity:44,rBase:.6,rDepth:1.7,rBoost:1,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},orbits:{orbitN:12,ghostN:40,ghostR:.9,ghostA:.5,particles:3,partR:1.2,partRDepth:1.6,rsPow:.6,rMin:.3},rubik:{latRings:15,lonDensity:40,moveCount:14,rBase:.6,rDepth:1.7,rActive:.3,inkFar:.62,inkSpan:.54,rsPow:.6,rMin:.3},wave:{rings:15,lonDensity:40,rBase:.6,rDepth:1.7,rsPow:.6,rMin:.3},web:{nodeN:30,thr:.72,signals:5,nodeR:1.4,nodeRDepth:1.8,lineW:.8,rsPow:.6,rMin:.3},braid:{strandN:52,turns:3,ghostN:150,rBase:1.2,rDepth:1.8,rsPow:.6,rMin:.3},ribbon:{lanes:5,segs:88,ghostN:150,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},ring:{lanes:5,segs:88,ghostN:0,faceOn:1,rBase:1.1,rDepth:1.7,rsPow:.6,rMin:.3},morph:{rDot:.021,iconD:1,rMin:.25}},KV={working:"orbits",searching:"globe",solving:"rubik",listening:"wave",connecting:"web",weaving:"braid",composing:"ribbon",breathing:"ring",shaping:"morph"},YV={orbits:{64:{speed:1.885,count:1,size:1},20:{speed:3.9,count:.238,size:2.4}},globe:{64:{speed:2.015,count:.42,size:1.15,extra:{scanMul:4.08,dimBase:.45}},20:{speed:2.665,count:.105,size:1.75,extra:{scanMul:4.335,dimBase:.45}}},rubik:{64:{speed:1.82,count:.35,size:1.05},20:{speed:1.95,count:.088,size:1.9}},wave:{64:{speed:4.388,count:.341,size:1},20:{speed:3.998,count:.105,size:1.6}},web:{64:{speed:3.315,count:1.35,size:.95},20:{speed:6.63,count:.25,size:1.52}},braid:{64:{speed:1.625,count:.5,size:1},20:{speed:2.75,count:.1125,size:1.36}},ribbon:{64:{speed:2.34,count:.25,size:.85,extra:{spin:0,bandMul:3.9,wobMul:1}},20:{speed:3.12,count:.051,size:1.073,extra:{spin:0,bandMul:4.94,wobMul:1}}},ring:{64:{speed:3.24,count:.25,size:.956,extra:{spin:0,bandMul:3.627,wobMul:.368}},20:{speed:3.78,count:.028,size:1.622,extra:{spin:0,bandMul:3.968,wobMul:.565}}},morph:{64:{speed:2.405,count:.702,size:.395,extra:{spread:1.45}},20:{speed:2.08,count:.53,size:1.011,extra:{spread:1.45}}}},SS=new Map;function XV(e,t){const n=`${e}-${t}`,r=SS.get(n);if(r)return r;const i=KV[e],o=YV[i][t];let c={...QV[i]};o.count!==1&&(c=WV(c,o.count)),o.size!==1&&(c=ZV(c,o.size)),o.extra&&(c={...c,...o.extra});const d={mode:i,speed:o.speed,opts:c};return SS.set(n,d),d}function JV(e){let t=e;for(;t;){const n=t.getAttribute("data-theme");if(n==="dark")return!0;if(n==="light")return!1;if(t.classList.contains("dark"))return!0;if(t.classList.contains("light"))return!1;t=t.parentElement}return null}function eW(){return typeof matchMedia>"u"||matchMedia("(prefers-color-scheme: dark)").matches}function tW(e,t){const[n,r]=w.useState(!0);return w.useEffect(()=>{if(e==="dark"){r(!0);return}if(e==="light"){r(!1);return}const i=()=>{const p=JV(t.current);r(p??eW())};i();const o=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null,c=()=>i();o==null||o.addEventListener("change",c);let d=null;return typeof MutationObserver<"u"&&t.current&&(d=new MutationObserver(i),d.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"],subtree:!0})),()=>{o==null||o.removeEventListener("change",c),d==null||d.disconnect()}},[e,t]),n}function nW(){const[e,t]=w.useState(!1);return w.useEffect(()=>{if(typeof matchMedia>"u")return;const n=matchMedia("(prefers-reduced-motion: reduce)");t(n.matches);const r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const rW={working:"Working…",searching:"Searching…",solving:"Solving…",listening:"Listening…",connecting:"Connecting…",weaving:"Weaving…",composing:"Composing…",breathing:"Thinking…",shaping:"Shaping…"};function aW({state:e="working",size:t=64,theme:n="auto",speed:r=1,paused:i=!1,style:o,"aria-label":c,...d}){const p=w.useRef(null),h=tW(n,p),g=nW();return w.useEffect(()=>{const m=p.current;if(!m)return;const v=Math.min(2,typeof devicePixelRatio<"u"&&devicePixelRatio||1);m.width=Math.round(t*v),m.height=Math.round(t*v);const b=m.getContext("2d");if(!b)return;const{mode:k,speed:j,opts:C}=XV(e,t),S=FV[k],N=j*r,A=F=>{b.setTransform(v,0,0,v,0,0),b.clearRect(0,0,t,t),S(b,t,F,h,C)};if(g){A(.6);return}let O=0,M=!1;const T=()=>{A(performance.now()/1e3*N),M&&(O=requestAnimationFrame(T))},L=()=>{M||i||(M=!0,O=requestAnimationFrame(T))},B=()=>{M=!1,cancelAnimationFrame(O)};A(performance.now()/1e3*N);let _=!0;const R=typeof IntersectionObserver<"u"?new IntersectionObserver(([F])=>{_=F.isIntersecting,_&&document.visibilityState!=="hidden"?L():B()}):null;R==null||R.observe(m);const z=()=>{document.visibilityState==="hidden"?B():_&&L()};return document.addEventListener("visibilitychange",z),R||L(),()=>{B(),R==null||R.disconnect(),document.removeEventListener("visibilitychange",z)}},[e,t,h,r,i,g]),l.jsx("canvas",{ref:p,role:"img","aria-label":c??rW[e],style:{width:t,height:t,display:"block",...o},...d})}let iW=0;function sW(e,t,n){const r=e.trim();return r?r===t?!0:n==="Request cancelled."&&r===n:!1}function oW(e,t,n,r){return e&&sW(e,t,n)?{content:e,synthesized:!0}:e?r==="hermes"?{content:e,failureNotice:t,synthesized:!1}:{content:e,synthesized:!1}:{content:"",failureNotice:t,synthesized:!0}}function lW(e,t){return e?{content:e,failureNotice:t,synthesized:!1}:{content:t,synthesized:!0}}function jS(e,t=""){const n=e.author.toLowerCase(),r=n.includes("assistant")||n.includes("agent")?"assistant":"user",i=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,o=r==="assistant"&&(e.persistStatus==="failed"||!!i),c=`Error: ${i??"The local agent turn failed."}`,d=o?oW(e.text,c,i,t):null,p=(d==null?void 0:d.content)??(e.text||WE(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++iW}`,uri:e.uri,turnId:e.turnId,role:r,content:p,ts:Qd(e.ts),tsRaw:Dg(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function cW(e){return e.turnId?`turn:${e.turnId}:${e.role}`:e.uri??`${e.role}:${e.ts??""}:${e.content}`}function Wm(e,t){const n=new Set,r=[];for(const i of[...t,...e]){const o=cW(i);n.has(o)||(n.add(o),r.push(i))}return r}function CS(e,t,n){const r=typeof n=="string"&&n.trim()?n.trim():t;return!r||r===t?e:e.map(i=>i.turnId===t?{...i,turnId:r}:i)}function NS(e){return e.replace(/\r\n/g,`
|
|
1637
|
+
`).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function uW(e,t,n,r,i){const o=NS(e),c=i?NS(i):"";if(t==="assistant"&&r&&o.trim()===""&&!c)return l.jsxs("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:[l.jsx(aW,{"aria-hidden":"true",className:"v10-chat-thinking-orb",state:"connecting",size:64,style:{width:28,height:28},theme:"auto"}),l.jsx("span",{children:"Connecting dots..."})]});if(t==="assistant"&&!n&&o.trim()!=="")return l.jsxs(l.Fragment,{children:[l.jsx(VE,{content:o,streaming:r&&!c}),c&&l.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[c,r&&l.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[o,c].filter(Boolean).join(`
|
|
1638
|
+
|
|
1639
|
+
`);return l.jsxs("span",{className:"v10-chat-plaintext",children:[d,r&&l.jsx("span",{className:"v10-chat-cursor"})]})}function Pg(){return Pg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Pg.apply(null,arguments)}function dW(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var fW=w.useLayoutEffect,pW=function(t){var n=Je.useRef(t);return fW(function(){n.current=t}),n},ES=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},hW=function(t,n){var r=Je.useRef();return Je.useCallback(function(i){t.current=i,r.current&&ES(r.current,null),r.current=n,n&&ES(n,i)},[n])},AS={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},mW=function(t){Object.keys(AS).forEach(function(n){t.style.setProperty(n,AS[n],"important")})},TS=mW,Pn=null,RS=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function gW(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),Pn||(Pn=document.createElement("textarea"),Pn.setAttribute("tabindex","-1"),Pn.setAttribute("aria-hidden","true"),TS(Pn)),Pn.parentNode===null&&document.body.appendChild(Pn);var i=e.paddingSize,o=e.borderSize,c=e.sizingStyle,d=c.boxSizing;Object.keys(c).forEach(function(v){var b=v;Pn.style[b]=c[b]}),TS(Pn),Pn.value=t;var p=RS(Pn,e);Pn.value=t,p=RS(Pn,e),Pn.value="x";var h=Pn.scrollHeight-i,g=h*n;d==="border-box"&&(g=g+i+o),p=Math.max(g,p);var m=h*r;return d==="border-box"&&(m=m+i+o),p=Math.min(m,p),[p,h]}var _S=function(){},vW=function(t,n){return t.reduce(function(r,i){return r[i]=n[i],r},{})},yW=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],bW=!!document.documentElement.currentStyle,xW=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=vW(yW,n),i=r.boxSizing;if(i==="")return null;bW&&i==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var o=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),c=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:o,borderSize:c}},wW=xW;function my(e,t,n){var r=pW(n);w.useLayoutEffect(function(){var i=function(c){return r.current(c)};if(e)return e.addEventListener(t,i),function(){return e.removeEventListener(t,i)}},[])}var kW=function(t,n){my(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},SW=function(t){my(window,"resize",t)},jW=function(t){my(document.fonts,"loadingdone",t)},CW=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],NW=function(t,n){var r=t.cacheMeasurements,i=t.maxRows,o=t.minRows,c=t.onChange,d=c===void 0?_S:c,p=t.onHeightChange,h=p===void 0?_S:p,g=dW(t,CW),m=g.value!==void 0,v=w.useRef(null),b=hW(v,n),k=w.useRef(0),j=w.useRef(),C=function(){var A=v.current,O=r&&j.current?j.current:wW(A);if(O){j.current=O;var M=gW(O,A.value||A.placeholder||"x",o,i),T=M[0],L=M[1];k.current!==T&&(k.current=T,A.style.setProperty("height",T+"px","important"),h(T,{rowHeight:L}))}},S=function(A){m||C(),d(A)};return w.useLayoutEffect(C),kW(v,function(){if(!m){var N=v.current.value;requestAnimationFrame(function(){var A=v.current;A&&N!==A.value&&C()})}}),SW(C),jW(C),w.createElement("textarea",Pg({},g,{onChange:S,ref:b}))},EW=w.forwardRef(NW),Zm={exports:{}},Qm,OS;function AW(){if(OS)return Qm;OS=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Qm=e,Qm}var Km,MS;function TW(){if(MS)return Km;MS=1;var e=AW();function t(){}function n(){}return n.resetWarningCache=t,Km=function(){function r(c,d,p,h,g,m){if(m!==e){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Km}var LS;function RW(){return LS||(LS=1,Zm.exports=TW()()),Zm.exports}var _W=RW();const It=mc(_W);function ws(e,t,n,r){function i(o){return o instanceof n?o:new n(function(c){c(o)})}return new(n||(n=Promise))(function(o,c){function d(g){try{h(r.next(g))}catch(m){c(m)}}function p(g){try{h(r.throw(g))}catch(m){c(m)}}function h(g){g.done?o(g.value):i(g.value).then(d,p)}h((r=r.apply(e,t||[])).next())})}const OW=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Co(e,t,n){const r=MW(e),{webkitRelativePath:i}=e,o=typeof t=="string"?t:typeof i=="string"&&i.length>0?i:`./${e.name}`;return typeof r.path!="string"&&IS(r,"path",o),IS(r,"relativePath",o),r}function MW(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),i=OW.get(r);i&&Object.defineProperty(e,"type",{value:i,writable:!1,configurable:!1,enumerable:!0})}return e}function IS(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const LW=[".DS_Store","Thumbs.db"];function IW(e){return ws(this,void 0,void 0,function*(){return Kd(e)&&DW(e.dataTransfer)?UW(e.dataTransfer,e.type):zW(e)?$W(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?PW(e):[]})}function DW(e){return Kd(e)}function zW(e){return Kd(e)&&Kd(e.target)}function Kd(e){return typeof e=="object"&&e!==null}function $W(e){return Ug(e.target.files).map(t=>Co(t))}function PW(e){return ws(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Co(n))})}function UW(e,t){return ws(this,void 0,void 0,function*(){if(e.items){const n=Ug(e.items).filter(i=>i.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(BW));return DS(eA(r))}return DS(Ug(e.files).map(n=>Co(n)))})}function DS(e){return e.filter(t=>LW.indexOf(t.name)===-1)}function Ug(e){if(e===null)return[];const t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r)}return t}function BW(e){if(typeof e.webkitGetAsEntry!="function")return zS(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?tA(t):zS(e,t)}function eA(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?eA(n):[n]],[])}function zS(e,t){return ws(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const o=yield e.getAsFileSystemHandle();if(o===null)throw new Error(`${e} is not a File`);if(o!==void 0){const c=yield o.getFile();return c.handle=o,Co(c)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return Co(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function FW(e){return ws(this,void 0,void 0,function*(){return e.isDirectory?tA(e):qW(e)})}function tA(e){const t=e.createReader();return new Promise((n,r)=>{const i=[];function o(){t.readEntries(c=>ws(this,void 0,void 0,function*(){if(c.length){const d=Promise.all(c.map(FW));i.push(d),o()}else try{const d=yield Promise.all(i);n(d)}catch(d){r(d)}}),c=>{r(c)})}o()})}function qW(e){return ws(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const i=Co(r,e.fullPath);t(i)},r=>{n(r)})})})}var cd={},$S;function HW(){return $S||($S=1,cd.__esModule=!0,cd.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",i=(e.type||"").toLowerCase(),o=i.replace(/\/.*$/,"");return n.some(function(c){var d=c.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?o===d.replace(/\/.*$/,""):i===d})}return!0}),cd}var GW=HW();const Ym=mc(GW);function PS(e){return ZW(e)||WW(e)||rA(e)||VW()}function VW(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1640
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WW(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ZW(e){if(Array.isArray(e))return Bg(e)}function US(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function BS(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?US(Object(n),!0).forEach(function(r){nA(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):US(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nA(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hc(e,t){return YW(e)||KW(e,t)||rA(e,t)||QW()}function QW(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1641
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rA(e,t){if(e){if(typeof e=="string")return Bg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bg(e,t)}}function Bg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function KW(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,c,d;try{for(n=n.call(e);!(i=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));i=!0);}catch(p){o=!0,d=p}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw d}}return r}}function YW(e){if(Array.isArray(e))return e}var XW=typeof Ym=="function"?Ym:Ym.default,JW="file-invalid-type",eZ="file-too-large",tZ="file-too-small",nZ="too-many-files",rZ=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:JW,message:"File type must be ".concat(r)}},FS=function(t){return{code:eZ,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},qS=function(t){return{code:tZ,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},aZ={code:nZ,message:"Too many files"};function iZ(e){return e.type===""&&typeof e.getAsFile=="function"}function aA(e,t){var n=e.type==="application/x-moz-file"||XW(e,t)||iZ(e);return[n,n?null:rZ(t)]}function iA(e,t,n){if(ss(e.size))if(ss(t)&&ss(n)){if(e.size>n)return[!1,FS(n)];if(e.size<t)return[!1,qS(t)]}else{if(ss(t)&&e.size<t)return[!1,qS(t)];if(ss(n)&&e.size>n)return[!1,FS(n)]}return[!0,null]}function ss(e){return e!=null}function sZ(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,o=e.multiple,c=e.maxFiles,d=e.validator;return!o&&t.length>1||o&&c>=1&&t.length>c?!1:t.every(function(p){var h=aA(p,n),g=hc(h,1),m=g[0],v=iA(p,r,i),b=hc(v,1),k=b[0],j=d?d(p):null;return m&&k&&!j})}function Yd(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Fl(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function HS(e){e.preventDefault()}function oZ(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function lZ(e){return e.indexOf("Edge/")!==-1}function cZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return oZ(e)||lZ(e)}function ia(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),c=1;c<i;c++)o[c-1]=arguments[c];return t.some(function(d){return!Yd(r)&&d&&d.apply(void 0,[r].concat(o)),Yd(r)})}}function uZ(){return"showOpenFilePicker"in window}function dZ(e){if(ss(e)){var t=Object.entries(e).filter(function(n){var r=hc(n,2),i=r[0],o=r[1],c=!0;return sA(i)||(console.warn('Skipped "'.concat(i,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),c=!1),(!Array.isArray(o)||!o.every(oA))&&(console.warn('Skipped "'.concat(i,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(n,r){var i=hc(r,2),o=i[0],c=i[1];return BS(BS({},n),{},nA({},o,c))},{});return[{description:"Files",accept:t}]}return e}function fZ(e){if(ss(e))return Object.entries(e).reduce(function(t,n){var r=hc(n,2),i=r[0],o=r[1];return[].concat(PS(t),[i],PS(o))},[]).filter(function(t){return sA(t)||oA(t)}).join(",")}function pZ(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function hZ(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function sA(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function oA(e){return/^.*\.[\w]+$/.test(e)}var mZ=["children"],gZ=["open"],vZ=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],yZ=["refKey","onChange","onClick"];function GS(e){return wZ(e)||xZ(e)||lA(e)||bZ()}function bZ(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1642
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wZ(e){if(Array.isArray(e))return Fg(e)}function Xm(e,t){return jZ(e)||SZ(e,t)||lA(e,t)||kZ()}function kZ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1643
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lA(e,t){if(e){if(typeof e=="string")return Fg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fg(e,t)}}function Fg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function SZ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,c,d;try{for(n=n.call(e);!(i=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));i=!0);}catch(p){o=!0,d=p}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw d}}return r}}function jZ(e){if(Array.isArray(e))return e}function VS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Ut(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?VS(Object(n),!0).forEach(function(r){qg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VS(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function qg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xd(e,t){if(e==null)return{};var n=CZ(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)r=o[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function CZ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var gy=w.forwardRef(function(e,t){var n=e.children,r=Xd(e,mZ),i=uA(r),o=i.open,c=Xd(i,gZ);return w.useImperativeHandle(t,function(){return{open:o}},[o]),Je.createElement(w.Fragment,null,n(Ut(Ut({},c),{},{open:o})))});gy.displayName="Dropzone";var cA={disabled:!1,getFilesFromEvent:IW,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};gy.defaultProps=cA;gy.propTypes={children:It.func,accept:It.objectOf(It.arrayOf(It.string)),multiple:It.bool,preventDropOnDocument:It.bool,noClick:It.bool,noKeyboard:It.bool,noDrag:It.bool,noDragEventsBubbling:It.bool,minSize:It.number,maxSize:It.number,maxFiles:It.number,disabled:It.bool,getFilesFromEvent:It.func,onFileDialogCancel:It.func,onFileDialogOpen:It.func,useFsAccessApi:It.bool,autoFocus:It.bool,onDragEnter:It.func,onDragLeave:It.func,onDragOver:It.func,onDrop:It.func,onDropAccepted:It.func,onDropRejected:It.func,onError:It.func,validator:It.func};var Hg={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function uA(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Ut(Ut({},cA),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,o=t.maxSize,c=t.minSize,d=t.multiple,p=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,v=t.onDrop,b=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,N=t.autoFocus,A=t.preventDropOnDocument,O=t.noClick,M=t.noKeyboard,T=t.noDrag,L=t.noDragEventsBubbling,B=t.onError,_=t.validator,R=w.useMemo(function(){return fZ(n)},[n]),z=w.useMemo(function(){return dZ(n)},[n]),F=w.useMemo(function(){return typeof C=="function"?C:WS},[C]),Y=w.useMemo(function(){return typeof j=="function"?j:WS},[j]),D=w.useRef(null),q=w.useRef(null),G=w.useReducer(NZ,Hg),W=Xm(G,2),Q=W[0],H=W[1],$=Q.isFocused,U=Q.isFileDialogActive,Z=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&uZ()),I=function(){!Z.current&&U&&setTimeout(function(){if(q.current){var X=q.current.files;X.length||(H({type:"closeDialog"}),Y())}},300)};w.useEffect(function(){return window.addEventListener("focus",I,!1),function(){window.removeEventListener("focus",I,!1)}},[q,U,Y,Z]);var ae=w.useRef([]),le=w.useRef([]),oe=function(X){D.current&&D.current.contains(X.target)||(X.preventDefault(),ae.current=[])};w.useEffect(function(){return A&&(document.addEventListener("dragover",HS,!1),document.addEventListener("drop",oe,!1)),function(){A&&(document.removeEventListener("dragover",HS),document.removeEventListener("drop",oe))}},[D,A]),w.useEffect(function(){var Se=function(V){le.current=[].concat(GS(le.current),[V.target]),Fl(V)&&H({isDragGlobal:!0,type:"setDragGlobal"})},X=function(V){le.current=le.current.filter(function(xe){return xe!==V.target&&xe!==null}),!(le.current.length>0)&&H({isDragGlobal:!1,type:"setDragGlobal"})},fe=function(){le.current=[],H({isDragGlobal:!1,type:"setDragGlobal"})},Ne=function(){le.current=[],H({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",Se,!1),document.addEventListener("dragleave",X,!1),document.addEventListener("dragend",fe,!1),document.addEventListener("drop",Ne,!1),function(){document.removeEventListener("dragenter",Se),document.removeEventListener("dragleave",X),document.removeEventListener("dragend",fe),document.removeEventListener("drop",Ne)}},[D]),w.useEffect(function(){return!r&&N&&D.current&&D.current.focus(),function(){}},[D,N,r]);var we=w.useCallback(function(Se){B?B(Se):console.error(Se)},[B]),Ee=w.useCallback(function(Se){Se.preventDefault(),Se.persist(),bt(Se),ae.current=[].concat(GS(ae.current),[Se.target]),Fl(Se)&&Promise.resolve(i(Se)).then(function(X){if(!(Yd(Se)&&!L)){var fe=X.length,Ne=fe>0&&sZ({files:X,accept:R,minSize:c,maxSize:o,multiple:d,maxFiles:p,validator:_}),ie=fe>0&&!Ne;H({isDragAccept:Ne,isDragReject:ie,isDragActive:!0,type:"setDraggedFiles"}),h&&h(Se)}}).catch(function(X){return we(X)})},[i,h,we,L,R,c,o,d,p,_]),Oe=w.useCallback(function(Se){Se.preventDefault(),Se.persist(),bt(Se);var X=Fl(Se);if(X&&Se.dataTransfer)try{Se.dataTransfer.dropEffect="copy"}catch{}return X&&m&&m(Se),!1},[m,L]),He=w.useCallback(function(Se){Se.preventDefault(),Se.persist(),bt(Se);var X=ae.current.filter(function(Ne){return D.current&&D.current.contains(Ne)}),fe=X.indexOf(Se.target);fe!==-1&&X.splice(fe,1),ae.current=X,!(X.length>0)&&(H({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Fl(Se)&&g&&g(Se))},[D,g,L]),ke=w.useCallback(function(Se,X){var fe=[],Ne=[];Se.forEach(function(ie){var V=aA(ie,R),xe=Xm(V,2),Le=xe[0],Ae=xe[1],De=iA(ie,c,o),Qe=Xm(De,2),Te=Qe[0],jt=Qe[1],ft=_?_(ie):null;if(Le&&Te&&!ft)fe.push(ie);else{var An=[Ae,jt];ft&&(An=An.concat(ft)),Ne.push({file:ie,errors:An.filter(function(Mn){return Mn})})}}),(!d&&fe.length>1||d&&p>=1&&fe.length>p)&&(fe.forEach(function(ie){Ne.push({file:ie,errors:[aZ]})}),fe.splice(0)),H({acceptedFiles:fe,fileRejections:Ne,type:"setFiles"}),v&&v(fe,Ne,X),Ne.length>0&&k&&k(Ne,X),fe.length>0&&b&&b(fe,X)},[H,d,R,c,o,p,v,b,k,_]),ve=w.useCallback(function(Se){Se.preventDefault(),Se.persist(),bt(Se),ae.current=[],Fl(Se)&&Promise.resolve(i(Se)).then(function(X){Yd(Se)&&!L||ke(X,Se)}).catch(function(X){return we(X)}),H({type:"reset"})},[i,ke,we,L]),Re=w.useCallback(function(){if(Z.current){H({type:"openDialog"}),F();var Se={multiple:d,types:z};window.showOpenFilePicker(Se).then(function(X){return i(X)}).then(function(X){ke(X,null),H({type:"closeDialog"})}).catch(function(X){pZ(X)?(Y(X),H({type:"closeDialog"})):hZ(X)?(Z.current=!1,q.current?(q.current.value=null,q.current.click()):we(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):we(X)});return}q.current&&(H({type:"openDialog"}),F(),q.current.value=null,q.current.click())},[H,F,Y,S,ke,we,z,d]),Ge=w.useCallback(function(Se){!D.current||!D.current.isEqualNode(Se.target)||(Se.key===" "||Se.key==="Enter"||Se.keyCode===32||Se.keyCode===13)&&(Se.preventDefault(),Re())},[D,Re]),We=w.useCallback(function(){H({type:"focus"})},[]),de=w.useCallback(function(){H({type:"blur"})},[]),Pe=w.useCallback(function(){O||(cZ()?setTimeout(Re,0):Re())},[O,Re]),Ze=function(X){return r?null:X},ot=function(X){return M?null:Ze(X)},be=function(X){return T?null:Ze(X)},bt=function(X){L&&X.stopPropagation()},at=w.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=Se.refKey,fe=X===void 0?"ref":X,Ne=Se.role,ie=Se.onKeyDown,V=Se.onFocus,xe=Se.onBlur,Le=Se.onClick,Ae=Se.onDragEnter,De=Se.onDragOver,Qe=Se.onDragLeave,Te=Se.onDrop,jt=Xd(Se,vZ);return Ut(Ut(qg({onKeyDown:ot(ia(ie,Ge)),onFocus:ot(ia(V,We)),onBlur:ot(ia(xe,de)),onClick:Ze(ia(Le,Pe)),onDragEnter:be(ia(Ae,Ee)),onDragOver:be(ia(De,Oe)),onDragLeave:be(ia(Qe,He)),onDrop:be(ia(Te,ve)),role:typeof Ne=="string"&&Ne!==""?Ne:"presentation"},fe,D),!r&&!M?{tabIndex:0}:{}),jt)}},[D,Ge,We,de,Pe,Ee,Oe,He,ve,M,T,r]),rn=w.useCallback(function(Se){Se.stopPropagation()},[]),mt=w.useMemo(function(){return function(){var Se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=Se.refKey,fe=X===void 0?"ref":X,Ne=Se.onChange,ie=Se.onClick,V=Xd(Se,yZ),xe=qg({accept:R,multiple:d,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:Ze(ia(Ne,ve)),onClick:Ze(ia(ie,rn)),tabIndex:-1},fe,q);return Ut(Ut({},xe),V)}},[q,n,d,ve,r]);return Ut(Ut({},Q),{},{isFocused:$&&!r,getRootProps:at,getInputProps:mt,rootRef:D,inputRef:q,open:Ze(Re)})}function NZ(e,t){switch(t.type){case"focus":return Ut(Ut({},e),{},{isFocused:!0});case"blur":return Ut(Ut({},e),{},{isFocused:!1});case"openDialog":return Ut(Ut({},Hg),{},{isFileDialogActive:!0});case"closeDialog":return Ut(Ut({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Ut(Ut({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Ut(Ut({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return Ut(Ut({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return Ut({},Hg);default:return e}}function WS(){}function ZS({value:e,onChange:t,options:n,placeholder:r="Select…",disabled:i=!1,className:o,ariaLabel:c,prefixIcon:d}){const[p,h]=w.useState(!1),[g,m]=w.useState(null),[v,b]=w.useState(()=>{const _=n.findIndex(R=>R.value===e);return _>=0?_:0}),k=w.useRef(null),j=w.useRef(null),C=w.useRef(null),S=n.find(_=>_.value===e),N=(S==null?void 0:S.label)??r,A=w.useCallback(()=>{var _;h(!1),(_=j.current)==null||_.focus()},[]),O=w.useCallback(()=>{const _=j.current;if(!_)return;const R=_.getBoundingClientRect(),z=Math.min(240,n.length*36+16),F=window.innerHeight-R.bottom,Y=R.top,D=F<z+16&&Y>F?"above":"below";m({left:R.left,top:D==="below"?R.bottom+4:R.top-4,width:R.width,placement:D})},[n.length]);w.useLayoutEffect(()=>{p&&O()},[p,O]),w.useEffect(()=>{if(!p)return;const _=()=>O(),R=()=>O(),z=Y=>{var q,G;const D=Y.target;(q=k.current)!=null&&q.contains(D)||(G=C.current)!=null&&G.contains(D)||h(!1)},F=Y=>{Y.key==="Escape"&&(Y.preventDefault(),A())};return window.addEventListener("scroll",_,!0),window.addEventListener("resize",R),document.addEventListener("mousedown",z),document.addEventListener("keydown",F),()=>{window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",R),document.removeEventListener("mousedown",z),document.removeEventListener("keydown",F)}},[p,A,O]),w.useEffect(()=>{if(p){const _=n.findIndex(R=>R.value===e);b(_>=0?_:0),requestAnimationFrame(()=>{var R;return(R=C.current)==null?void 0:R.focus()})}},[p,e,n]),w.useEffect(()=>{i&&p&&h(!1)},[i,p]);const M=_=>{i||(_.key==="ArrowDown"||_.key==="Enter"||_.key===" ")&&(_.preventDefault(),h(!0))},T=_=>{var R;if(_.key==="ArrowDown")_.preventDefault(),b(z=>{var F;for(let Y=1;Y<=n.length;Y++){const D=(z+Y)%n.length;if(!((F=n[D])!=null&&F.disabled))return D}return z});else if(_.key==="ArrowUp")_.preventDefault(),b(z=>{var F;for(let Y=1;Y<=n.length;Y++){const D=(z-Y+n.length)%n.length;if(!((F=n[D])!=null&&F.disabled))return D}return z});else if(_.key==="Enter"){_.preventDefault();const z=n[v];z&&!z.disabled&&(t(z.value),A())}else if(_.key==="Home"){_.preventDefault();const z=n.findIndex(F=>!F.disabled);z>=0&&b(z)}else if(_.key==="End"){_.preventDefault();let z=-1;for(let F=n.length-1;F>=0;F--)if(!((R=n[F])!=null&&R.disabled)){z=F;break}z>=0&&b(z)}},L=["v10-select",o,i?"disabled":"",p?"open":""].filter(Boolean).join(" "),B=g?g.placement==="below"?{position:"fixed",left:g.left,top:g.top,width:g.width}:{position:"fixed",left:g.left,top:g.top,width:g.width,transform:"translateY(-100%)"}:void 0;return l.jsxs("div",{ref:k,className:L,children:[l.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!i&&h(_=>!_),onKeyDown:M,disabled:i,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":c,children:[d&&l.jsx("span",{className:"v10-select-prefix","aria-hidden":"true",children:d}),l.jsx("span",{className:`v10-select-value ${S?"":"placeholder"}`,children:N}),l.jsx(j4,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),p&&g&&c_.createPortal(l.jsxs("ul",{ref:C,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:T,style:B,children:[n.length===0&&l.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((_,R)=>l.jsx("li",{role:"option","aria-selected":_.value===e,title:_.label,className:["v10-select-option",_.value===e?"selected":"",R===v?"highlighted":"",_.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(R),onMouseDown:z=>z.preventDefault(),onClick:()=>{i||_.disabled||(t(_.value),A())},children:_.label},_.value))]}),document.body)]})}function QS(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function EZ(e,t){return t?"Session history":e.chatReady?`${e.name} connected`:e.status==="connecting"?`${e.name} is connecting…`:e.status==="degraded"?`${e.name} degraded`:`${e.name} is unavailable`}function AZ(e){const[t,n]=w.useState(!1),[r,i]=w.useState(!1),o=w.useRef(null),c=w.useRef(null),d=w.useRef(null);w.useLayoutEffect(()=>{if(!t)return;const m=d.current,v=c.current;if(!m||!v)return;const k=(v.closest(".v10-panel-right")||document.body).getBoundingClientRect();v.getBoundingClientRect().left+m.offsetWidth>k.right-4?i(!0):i(!1)},[t]);const p=w.useCallback(()=>{var m;n(!1),(m=c.current)==null||m.focus()},[]);w.useEffect(()=>{if(!t)return;const m=b=>{var k;(k=o.current)!=null&&k.contains(b.target)||n(!1)},v=b=>{b.key==="Escape"&&(b.preventDefault(),p())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",v)}},[t,p]),w.useEffect(()=>{var v;if(!t)return;const m=(v=d.current)==null?void 0:v.querySelector(".v10-agent-tab-menu-item:not(:disabled)");m==null||m.focus()},[t]);const h=m=>{(m.key==="ArrowDown"||m.key==="Enter"||m.key===" ")&&(m.preventDefault(),n(!0))},g=m=>{var C,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const v=Array.from(((C=d.current)==null?void 0:C.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(v.length===0)return;const b=v.findIndex(N=>N===document.activeElement),k=m.key==="ArrowDown"?1:-1,j=b===-1?k===1?0:v.length-1:(b+k+v.length)%v.length;(S=v[j])==null||S.focus()};return l.jsxs("div",{className:"v10-agent-tab-menu",ref:o,children:[l.jsx("button",{ref:c,type:"button",className:"v10-agent-tab-menu-trigger","aria-label":`More actions for ${e.integration.name}`,"aria-haspopup":"menu","aria-expanded":t,title:`More actions for ${e.integration.name}`,onClick:m=>{m.stopPropagation(),n(v=>!v)},onKeyDown:h,children:l.jsx(T4,{"aria-hidden":"true",size:14})}),t&&l.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${r?" align-right":""}`,role:"menu",onKeyDown:g,children:[l.jsxs("div",{className:"v10-agent-tab-menu-status","aria-hidden":"true",children:[l.jsx("span",{className:`v10-agents-stat-dot ${e.statusDotClass}`}),l.jsx("span",{children:e.statusLabel})]}),l.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.refreshBusy,onClick:()=>{p(),e.onRefresh()},children:e.refreshBusy?"Refreshing…":"Refresh"}),e.canClearSession&&l.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.clearBusy,onClick:()=>{var m;p(),(m=e.onClearSession)==null||m.call(e)},children:e.clearBusy?"Clearing…":"Clear session"}),e.canDisconnect&&l.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item danger",onClick:()=>{p(),e.onDisconnect()},children:"Disconnect"})]})]})}function vy(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function nc(e){const t=e.sessionId??e.defaultSessionId??rs(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:vy(e.integrationId,t)}}function dA(e,t){for(const n of t)if(e===n.id||e.startsWith(`${n.id}:`))return{id:n.id,name:n.name};return null}function fA(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(r=>r.id===e.integrationId);return!(((n=dA(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&RZ(e.integrationId,e.selectedSessionId))}function TZ(e){return fA(e)}function RZ(e,t){return t===`${e}:dkg-ui`||t.startsWith(`${e}:dkg-ui:profile-`)||t.startsWith(`${e}:dkg-ui:home-`)||t.startsWith(`${e}:dkg-ui:transport-`)}function KS(e,t){const n=e.flatMap(r=>{var d;const i=dA(r.session,t);if(!i)return[];const o=r.messages.find(p=>p.author==="user"),c=r.messages[r.messages.length-1];return[{sessionId:r.session,integrationId:i.id,integrationName:i.name,preview:((d=o==null?void 0:o.text)==null?void 0:d.slice(0,60))||r.session,messageCount:r.messages.length,lastTs:c==null?void 0:c.ts}]});return n.sort((r,i)=>{const o=Date.parse(r.lastTs??""),c=Date.parse(i.lastTs??"");return Number.isFinite(o)&&Number.isFinite(c)?c-o:String(i.lastTs??"").localeCompare(String(r.lastTs??""))}),n}function pA(e,t,n,r,i){var c;const o=nc({integrationId:e,sessionId:t,defaultSessionId:i});return(((c=n[o.stateKey])==null?void 0:c.length)??0)>0||(o.sessionId?r.some(d=>d.sessionId===o.sessionId):!1)}function hA(e,t,n){const r=vy(e,null);return Object.entries(t).some(([i,o])=>o.length>0&&(i===r||i.startsWith(`${e}:`)))||n.some(i=>i.integrationId===e)}function _Z(e){const t=[...e.integrations].sort(Sf),n=t.filter(d=>d.persistentChat),r=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,i=r?nc({integrationId:r.id,sessionId:e.selectedSessionId,defaultSessionId:r.defaultSessionId}):null,o=r?pA(r.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,r.defaultSessionId):!1,c=r?hA(r.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:r,selectedConversation:i,selectedHasConversation:o,selectedIntegrationHasAnyConversation:c}}function OZ(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),r=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),i=r?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,o=e.selectedIntegrationId===os||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),c=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:r,visibleAgentTabs:i,showAddFlow:o,shouldShowConversationLoader:c}}function Sf(e,t){const n=e.id==="openclaw"?0:1,r=t.id==="openclaw"?0:1;return n!==r?n-r:e.persistentChat!==t.persistentChat?e.persistentChat?-1:1:e.name.localeCompare(t.name)}function Sd(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(Sf)}function MZ(e,t){const n=e.find(c=>c.id===t);if(!n)return e;const r=n.connectSupported,i=r?"available":"coming_soon",o=r?"Ready to connect":"Coming next";return Sd(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:o,status:i,statusLabel:o,detail:r?`${n.name} is no longer attached to this node. Reconnect from the + tab when you want live chat again.`:n.detail,error:void 0,target:void 0})}function LZ(e){const t=e.selectedItem;return e.selectedIntegrationId===os||t!=null&&(t.persistentChat||pA(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||hA(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}const IZ={openclaw:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEy0lEQVR42u2ba4hVVRTHf1OmM9GUjzITRmEyX4nglxwjzZKMIsFHGEJJJlLfJGTGBD8kRkRCVmrRA8ueSqmRqJFOpqb2QafR0sovvbTygaPQpONM3s6W/43D7Z65Zx/OuWcfuAsWM/fOXnut/9pr77322nugQhWqUIWiUzVwC1CXgu466a5OC/wdwA9ADugE9gCPAD0S1NlDOvZIp9H9I9CQhgOmA98BrwIfAG0yaDswIgF9I9S30XFGOo3uVs8h96QVBVf6fh8IvCADTwFTfH8bANztOWk+sBLYAHyhkfwKaAbWAyvUZhJwk09+ivrMScdA39+qXFsX7gV+Bi4Ay4GtPuNt+LQX2p8BL6ov0+fkLCyMozWiuZi5WX07S4OBNzVauYT4gnQMdg38w8DxBIEX8nHtBqlTL+ClMgIv5JdlQyp0LbAxRfB5/kS2lJWu0eqec4S3yqaykMnG1joEPs9rE85C/6MlDoLP89NJg5/sy8HDrNQ7gIMRwVwCWtTHiZAyF5NMi3sD31usztdLrqfODW0W4H8H7vPp7g+sCSlrbLwuzdBvVn5u5uMqL2r2Ard6ETEvpPw/3iHrQekcBuwE3tEAHAjZx5IksrwzIZU/7jM+/90qjcq5EPLHgFr1sdj3/RhgYUgbjK2D4nTA8xbh+5ivWPKGRu12L2HqE3Ia/OLpu1p9jAK+1kmxxsIBhp+LC3w/zcmwijcUyF+hn7O0sJWS79TRudhxd6flOtIvDgfMtVy9zRxuBK7y9WEi4FeLPg4XnPxMND0bYSeZE4cDXrPY+vxsQv8tYDPwdwT5c0q1V3u7yKEI8p2qGFnTDcBQb+Wt18pbo89TlWgccTgROiIbp8rmamGo1+f+3QE3CcQWJR3m3N3uhf9vwDYtPg+oElujUXEN/GrZVidbm7yp97kwtAvTSZ0b/pcszVYWVUrJX5rfPR2LhMOyqVE2hskYZ/uLmactlHWoYPmMQw5YKpsuWtYcLxdXn4igcGxEuaTY2HJbRDnrUlaHsqyljkXAIMsIyGlrvjx/bIRaIiQlSfOXsqnFUu5blCzYJhc3ezvDeYcccF422WJ5FF0whk1U9snTaxzcBt+WbftCtjeYh+Rz7U0hBMxBZriurbocdECXbBse8tD1qf+cMa7EAmISifuVSf3kcCZobLtRtraXyAPGFSZDTd10epdSyr0Og/dP096yOWiwGoPSYXNk3a3t4RttL30UVvszAD7P+2VzX2FoUZ1hF/BQmANRre/q+ymLapBL3Cbb89f4tVHvAFozCD7PrXHcFSzKsAMWxlEQGVpiRXWV25XjxELrM+iAj+OsCk9UrS8r4I2td8bpgCpVi7LigC1JPJ4aq6Ow6+A7VBtIhFZmwAErkrwdNhcNRx0GfzSuy5DuaJKjU6FDtpWFmhx0QFM53whV6cbIFfCvp/Fk1jxPW+cA+HVpPpUzNzHvpgj+PdmQKpnT1rIUwC8r16swm+eyf5QB+J/S5STVKyy7Eip6vq/yt/M0HvgQOBsD8LNa6MaTQZoT8P7vSWAB8Iq200X6fKmbN0eZpGkBo1rsn5waAtpOy7IDZgSAmlCk7YSAtjMqDsgwzQwANTGg6lSs7cwsO8DM64+K8MgibUcGtG2gQsnRv1P7PFimYrmBAAAAAElFTkSuQmCC",hermes:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAANwElEQVR42rVbCZAcVRn+Z3bume6ZnnN3dg0EEzmMiWCJpVUmIjEeWJZiqRRBEw8owERRU4pXieWBEsAyZUlQMXhfSCkBQUuU9RY8IhQaECMEEjAEYyRkQULWflPfW7/8eT3dvYtb1cl0v9fv/e//X//H9/9PRGRURMZEpCIiIyLSFpGeiORFpIS2Jto8EemLSA33LbxfFJEC3mujrYq+Pu6bGKuEsbsi0hGRHOY2bQ30bRBNOfTrRtDkK5raoKkAukZB5wj69LEOcx8IBusTAzp4yU7Wx2RZvDiOgbIYeIwYwJNV0ddH3ybGsgzoYS7Tt4y2Ovo2FE1d9M8RTQH6+pinGsGAMdCUBd3jWIelaTBJBZO20KmKxgBtNbT5ILaO9hraA0ffOvVtYVI7T4A57DwNtPk0j+3bpL4B9fUc8zSJfk1TE30q1NeMMeDaSIyEKuCcllCZJGS3aFlJqJ5CQkl2WBttVUVToOi3NPEOaxBNdocNBuxgwCIY0cZAFbQFaPMwqIf7AH0rmKSN94tYRBfSLGDyDvqWsLgmftfQVld9a0RTS9HUQF8f83DfDugpJ6B/IOlRMCCPRXQxeAntAb4/DxKp4b6J9hIG7IHQHMYbA4G27yiIKoCwNuasoK2Bvg3cV4imDt4ro83S5BP9OczfAz2W/ibaaqDJw/2AAfkIArsOAusRBHZwcV8mcEwR2FUEagYzgczgLt7POxgcOBjciWBwnZg2M3iACewWbWOyIjryFq2rz6aF/tx32BZtp9iivJ2TfmKWJvvZRNFf02bQ2lzrBxQdfoBWUlahsZKKM4N2HvMsQz6ET0p2DIt2+QFxZrBHNEWZQav4B/9ok9bE7ypeZtPTVCatGWHSPGU6PZKsmWueiDxdRI4TkWNF5Kloz2CRwRAz2yTz56cws57DzA44YaXZB9dykCabEWtyMnhxHISOgOM9/C6ibcBdkq55tlhEVoVjbxSRX4vIv0VkWkT2icgOEflVKMHPhP+vwNhl2mF5/O6QGZzAYjJY9Djm1zSV0NZAX2uazfgDrvi46iSpOt3bNl/dR/X1aOuuDNs+FT67RETeKiInYVsa4k8VkWvABH39UUTejjGKKWjyU/YdSN1yI0OucA6c72N3ZPDyBLZhBt9bX0mohuttInKnY2FTIRMmReQ0vGf+3kC7QV9mVywnbc87LIPnE9gRlv4x0GPpb6Othr72UzPrmiG4Tt9dDduljt8e3VcxaQPPa/Q7D6luiViMvjbSQl4qIv+K6LdXRF6PxTeIpgC0MP1MU0PRb/sy/Ye5wi4dUIkIVkoUVR2B7/eJhIu31w8gNcEio95/VETeTIGMtjLWFY7SAZGusLXhNXwGUVbAatw2iCjTjjkmlOBvUy7cLmpXyOjP0g7aOKT/dSKyEAtoYGF+Cvo9Rf/ACgzDA2w8HYUHmPsTReQOReiBIYv4h4jcH37320TkZSJyPBTeKuy8Ptq13vge9MoFMKENhQdE+QHD8ICBpbKRlvUEy3jWwYsFDN5VwUobjNsMSVpid4rIfSThg2oxRuLvFZHV2ParwMBPgzAz14WhxXhQRK7CWJeh79PwfDW2ck95gl3yBNvknVaI/jz+71lXuEAMYL/bBiuWAT0awDobhpD3iMgPsdDHQi5fDM1tFv8dfLdmkb8RkZtCBpwLzp+P7b4VfS8XkaVY0KJwsV8XkVNE5EuhhXgnpH8ZmHgzuc0+0dQjAXIAVUFbw8WAniOwcX0COfoEzCRHwpRNYGBj59eLyGtxvxzm7cMiskRE1sIRssStc3wel0LShpZfQtrb0fZIyPC78fsgrIaoTyCXABLjYKsptFWsErGxdxmEtEnheASSvE9ErghN1DtE5IVYqJHwnyGhu5Vtn4K3twXt9zgY8AcQlsH4wxTolRRtWvqtC90ipKuNZ0y/h/vGbMxgBjvkNmx5I42HhxCaxiz+M5zvI2Dk9WDatEOPWGV6HAVmgTLNvaSIUDXCEbL4W1U5HYZBy1IsbAe2b5K+ByhGuAUMngaDXZZlJekopr9KjpCmv6qcpkNc4azDFR5XrrB5cU0KqW5P6SPcA6VoJHwXGL0vwku8FBKekyvsp7yMYvloigX9B9p7KkHfgyR1vTO2R8QJVRXQ+erei1nPIeHwuEMHZFU4LPhOoxZxr0Mn/FREfj4LT5Gvvyt/YxpWYh5omnU43HSAHAHphkAFQRXY5ChCH4E5NJ7e37B9jT9wpoj8Dtv6r7AEO1Iw4EFcWsEupbC8GkG/BnR8yg8cAollyY7mFCSWJTPybIc0DsDLW0tJltfAz/+JiPxIRN5PQGsfKNDahAx4DLtAPz+bFsz052MgsZnMUIlsYocw/pYCIBlUNO1fIYlPw3F5tYicTjsqA/9gJzHJMOJVGFfg0OhF3Qo7f5PS/tsc1mADRag67+ACRYsaFNWweEnB4jkHLO7BE7wBfvyfoORug2u7jCRiwuQ3Ybt+F4y7CN9mBszQDDDO0u8BnOxXccYe1fdnlFAdpcwQw+LlCFh84Ad0yS/OE26vEyN5LHyUpNuGb38q0B8TGO0ml7cLs2Pc46/B3z+Nkh1GAq9IoQcexi7gZ7vhEJUV/Tbv0IVw85hvlELvQWLEQs5VLJpTY4zbFxRuXyDEpQTp347vvEC4vcXnngKNnaN4wIx/VgoGGDP5F4dn+EqKXWxqjOlvEv09on/AgJz6BIoqOcr5+7rK31vn6UhI4luUlQlUvF4mJdUjPHBDSnO43eFZnk8KTydHc5ib6w/qhIHMKD2ruat41kyQ8rbZnmPgx38QW/4EQl0Yt9eITR6QWBoG7MVc/GwzKT6mvxlBv0/0H2YGu8oV1unrCQpAbCS5BP77i4HyWLvLuH2THJUc6YetKRnwOMwtP7sfNLtc4TFKqbMrbJ2/maDBhfF7Ch32FbpqCw5egu/yFIAfPukBxukbymlZFBNJDnOKtG5YQSYuDf2RmaGxCFdYZ4bM31tAyDp4gb8Ix/m4iCwg3L6iJGT+Tp6lW7zfoQjXg67UrnBDYfxpOVgExjcN2OuM0PZvwk44j96tq3mKAFN0JPjQLGKEaTC94shaRdHvaVeYy11cmaGsgsSsDvCRD7BbcQ22Y5USkRmF21tn6vNqMRfCnKZhwHUInffC1AbkCueT6IA0VsBmVxeRD2AWc63y4loOK6Bx+5yyAFOAyG9JyQBjeq/G79cRAmStQDnOCuQIEovzA4pwXE4mZ6nokNo6jJGlChGrL9qEPnMKbRLKdFdKBnwj1Anvxu9PKmvm8gMOg8RcnmDH4Qla13ES+LwFJBdj+2lnZQlBUB5qAE4kBs9TIMduoD4PpGTAlaSENyH7vIwWHusJRsUC7Etbr24cEloBaZpn5wwxVZOIErdicfvhKpu/+QoPMLvhBcAN0jDgYwSxm+DsmSFzv0hFlbGxQFw0mCd4+Xho6S0IY5dTCny/AyOI8udXgQm30vM34tn6lAxYCcDFhuSjwCCPpoKqodFgHB5QonTz82HqXN7ZNxPiftNAhM5TDHsAKNHBFIvfA8bZ/MON+LTuBWjjx+AB1TSIkMDn3wx8z8Li9yEkvp6QmycS5gAuSrlgVxXJzXR/OT5PI4ijsJ5YRIgxwWoMJmgY8mUR+bGIfAAWYQUU0TQ5QwcSuLIvgg7ZOAcG6HnOAS07KTvE+Q2fMMGqyxXmYEWjwjYIasPrOgDQc4+SyLeHEDwFp2kpdpQNWz80C/Onr4dgDSwM7ydwhSs6L1Afgp/XaSc0kbG9HVt+JzTwakduX6O4a6i2x5bQmb9PUL+7yBxOYXG7AL1NRiRJroBg9kFZV2LW47uKpLJDXGEukqqA6HmY1Ciil2MHRAUrXB+wgOIJgwx/FYvbAMj9KliXM6HNj4X3eRLc5UuQhOV44EYw+FxKgycuknLl1oIEuTXDpHepxd4JizBMuRk7/YyQmC8A4roAWns+lOkdWPAIudBlbGUjnM9BFzHavAPp+JwjN+jKbwRcJMWlrMWURVIZwOEXwyE5CvZ4WKrscWzza7FdF8Jz3IRFHY0dZs8LcBmeFdLVSKTuhwu8kGqOc2mKpNqEkZcS1gd4Khc/Iv/7Oz0mdN0GTb0Y0jgC1WFnw56fQBUqVQdNVrqL8dlcQ7uDaSonqA8IbJHU6JBiaV0hwucFuDbfMOG5sAyPQnlN4Zu/AZ+GSY19n7bhfEhyMUpizgITG1T6HnVoqgK4/QxiVk6BrvoMg64Qac2lRqgHIgpUWt/HYp4XOkzPQtC0AIpnARypcSrDN/8/B+NN0Lg18tW7JN0Oubc18lR1jVCB8EquEXIWSaWtEssPqciyIESTymmrNG6WzgCUaHsHVHano7UubXGmqeYQiqapparEuEjKnmGYU52gPjeoj80lPTdYprxDNuG5wSBBnWAxSZ1gKwKxSVIpqlEkV1WmH4M4ldWxvJLKO5QVxl8ldKcUUb0aVynKNM3ZDLrOC0Sd6Miqg5lx6WuXGXSdF4grknKZwRlXuBaB2rqqxV3V1royuxaBxHpqnpoDtfUcqHNSmmZLv7NIaizleYE8FT20SfkNywz1Ep5IyRJqNfL/OC/gqcyN/yScGBn2bt3xrp+iL4/bmOOJEc+VGSrO8cyQDT0Dh4RcOqAfk3vsz+LMUC5NZihQgMiwU2OuE1p8aqxFuQR9aowPZ8edBNMHrgOV6Y07NaZPsgURp8aC/wJs6rIsXDWrggAAAABJRU5ErkJggg==","prime-agent":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAEUElEQVR42u2Za4hWRRjHf7uuklZ0pSuRG26WUdHVIilqsduHXa39UJBCJWWlkNLNCrthQR+iD4ZWFLFZEhWRKJYVka6Q+qnY7trFG9GuZRetzextBv4Lw2HOeed99z3nLNv8YfZlmTkzzzPnufyf50BERERERERERERERETEiMcRwAH/J4UPAqYAC4E1wE7gY+C4kaz0aOBSYDHwDVDxjPaRqPhhwGxgU4rSg+N5YOxIUnwMcCvwdRXF7XgMaG7UwQcD5wHnAseUpPxkY+4fBSj+BzCrkQdfDnwJ7NfoAz4E5ijSFuHn9wK/Byj/I3BFo33tu4wDrSlek6Pyk4D3AhS3Y6ustKE426SVf6scvA+4rcHnNgG3y9pClN8BnJPHGzjVmN+fAQLYS5jeoDNbgTcS+9uLeCfl7F3K/7lgArA38C1sA44d4nnX6226+/bIFR5NefMX5RmArg5wAXc8Wec59uK6Pfs9Z3L58cALnrkf8jJ7F695Dv7EpJq7UnJxfx3Us9PD4v4B7tP8ZZ5zdio+5YoLgQHP4VdpfmWKFcwN3P9IYInHwqzLzXTWnZJIgft1abnjrZS3byusccDmlAtYF8DAbK7u9Tz7C9ChNW3mz8PiIO6aZ4pQ/nzgb4+AMzR/ckZw3Kv5NF7xtLJG8rmfgalOJtjlzFlL3GAC7c1ASxEX4As6PeLiyA2yguEdnj3bZUGVlDc/NbH+YrlChy50VFGc+2gPARmQQIO4u8oF9Do0+XBlh4GM9XMcAjTPMLpVRulXlRlelys0F3UB13kE7E6seSkgJX5qeMSyjFhhx1+KNWOcam9bCscYV9QFLPf49GnO/KiAOjx0LJN5jzfnTjRF1iVKpe6aX03Ov7HIsnNDQoAVntL4+wYovxv4AvhANPdtFT5r9f/L4gKTiq67Z4qY7JGgt3gKlcnqt9Wj+JtKgyeojzda+05JWFqpaNHtV1KaC03K97Uq/xlwiGe/+WJ//XkWNrXA0s8tEnq5Z/6COpS3fYUzE/vYDLHUQ7YOLFP5WY75D5aiyTbYWTUqv0qVpWtB01PYYEX7l4K5KdXfnYl1zXIRG7Ce8tDVipjk+0bJrsRzV5o6490qqbGtDOWnZZCVrxSw0uDygs9NYFtkgt3pzrz1+xt0YdWsZXWRrG8QJ6rEzBJsXsbzC9Q5WqRiaazM+CZT6z/rxJNqY08RNb4P3QHC9Sv9pbXNJ6hGf8XEke01NlLSXK0QnCG/CxGwTxnCB+vbvw2BGD1RVuB7vEZBfxJtdXGoIVDf1qm4zf8PlKW8jcrr6xD6wcQ+HXUqvzXn7wpBX116axB4QGVqa2Kf++ukxOOHA+tbHWimK9Un9GFhDYpvSfT8SkdXhrC2LfViAD9vD1DcptlHgKMYZmjyBMI+fYhorSGWPKTWVrKXsNH83qP+/rBGpwqfxUOgoicB16p52amWdgsREREREREREREREREREaXhPxXZ1AH/I5YbAAAAAElFTkSuQmCC"};function DZ(e){return IZ[e.trim().toLowerCase()]}function YS({integrationId:e}){const t=DZ(e);return t?l.jsx("span",{className:"v10-local-agent-logo","aria-hidden":"true","data-agent-logo":e,style:{maskImage:`url("${t}")`,WebkitMaskImage:`url("${t}")`}}):null}function zZ(e){var Ne,ie;const{integrations:t,selectedIntegrationId:n,selectedIntegration:r,selectedSessionId:i,selectedHasConversation:o,selectedIntegrationHasAnyConversation:c,onSelectIntegration:d,onConnectIntegration:p,onDisconnectIntegration:h,onRefreshIntegration:g,onClearIntegrationSession:m,connectBusyId:v,refreshBusyId:b,clearBusyId:k,connectNotice:j,connectError:C,localMessages:S,localHistoryLoaded:N,localChatEndRef:A,localInput:O,onLocalInputChange:M,onSendLocalMessage:T,onStopLocalStream:L,localSending:B,activeProjectId:_,availableProjects:R,projectsLoading:z,onSelectProject:F,attachments:Y,onAddAttachments:D,onRemoveAttachment:q}=e,G=e.selectableProjects??R,W=Y,Q=W.some(ZE),H=[...new Set(W.map(V=>V.contextGraphId))],$=W.some(V=>V.status==="uploading"),Z=S.some(V=>V.streaming)?"streaming":$?"uploading":"idle",I=W.length>0&&W.some(V=>V.contextGraphId!==_),ae=w.useRef(null),le=w.useRef(null),[oe,we]=w.useState(null),Ee=w.useCallback(V=>{le.current=V,we(V)},[]),[Oe,He]=w.useState(!1),ke=w.useCallback(()=>{const V=le.current;if(!V)return;const xe=V.scrollHeight-V.scrollTop-V.clientHeight;He(xe>40)},[]),ve=w.useCallback(()=>{const V=le.current;V&&V.scrollTo({top:V.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const V=le.current;if(!V)return;const xe=requestAnimationFrame(()=>{const Le=V.scrollHeight-V.scrollTop-V.clientHeight;He(Le>40)});return()=>cancelAnimationFrame(xe)},[n,i,S.length]),w.useEffect(()=>{if(!oe||typeof MutationObserver>"u")return;const V=()=>{const Le=oe.scrollHeight-oe.scrollTop-oe.clientHeight;He(Le>40)};V();const xe=new MutationObserver(V);return xe.observe(oe,{childList:!0,subtree:!0,characterData:!0}),()=>xe.disconnect()},[oe]);const Re=(Ne=e.selectedIntegration)!=null&&Ne.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Ge=Re===null,We=w.useCallback(V=>{Ge&&D(V)},[Ge,D]),de=uA({onDrop:We,noClick:!0,noKeyboard:!0}),Pe=[...t].sort(Sf),Ze=Pe.filter(V=>V.persistentChat),ot=Pe.filter(V=>!V.persistentChat),be=r,{showingSessionHistory:bt,showingStoredSessions:at,visibleAgentTabs:rn,showAddFlow:mt,shouldShowConversationLoader:Se}=OZ({connectedAgents:Ze,selectedIntegration:r,selectedIntegrationId:n,selectedHasConversation:o,selectedIntegrationHasAnyConversation:c,localHistoryLoaded:N,localMessagesCount:S.length}),X=B||!(be!=null&&be.chatReady)||be.busy===!0,fe=!X&&!$&&(O.trim()!==""||Q);return l.jsxs("div",{className:"v10-agents-tab",children:[l.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[rn.map(V=>{const xe=(be==null?void 0:be.id)===V.id&&!mt;return l.jsxs("div",{className:`v10-agent-subtab-group ${xe?"active":""}`,children:[l.jsxs("button",{className:`v10-agent-subtab ${xe?"active":""}`,onClick:()=>d(V.id,{preserveSession:fA({integrationId:V.id,selectedSessionId:i,integrations:t}),sessionId:V.defaultSessionId}),role:"tab","aria-selected":xe,children:[l.jsx("span",{className:`v10-agents-stat-dot ${QS(V)}`}),l.jsx(YS,{integrationId:V.id}),l.jsx("span",{children:V.name})]}),xe&&l.jsx(AZ,{integration:V,statusLabel:EZ(V,bt),statusDotClass:QS(V),refreshBusy:b===V.id,clearBusy:k===V.id,canDisconnect:V.connectSupported&&V.persistentChat,canClearSession:V.id==="local-llm",onRefresh:()=>g(V.id),onDisconnect:()=>h(V.id),onClearSession:()=>m(V.id)})]},V.id)}),l.jsx("button",{className:`v10-agent-subtab add ${mt?"active":""}`,onClick:()=>d(os),role:"tab","aria-selected":mt,"aria-label":"Add another integrated agent",title:"Add another integrated agent",children:"+"})]}),mt?l.jsxs("div",{className:"v10-agent-add-surface",children:[l.jsx("div",{className:"v10-agents-section-label",children:"Connect Another Agent"}),j&&l.jsx("div",{className:"v10-local-agent-notice",children:j}),C&&l.jsx("div",{className:"v10-local-agent-error",children:C}),l.jsxs("div",{className:"v10-local-agent-list","aria-label":"Available agent integrations",children:[ot.length===0&&l.jsx("div",{className:"v10-agent-empty-state",children:"No additional local agent integrations are available yet."}),ot.map(V=>l.jsxs("div",{className:"v10-local-agent-detail v10-local-agent-choice",children:[l.jsxs("div",{className:"v10-local-agent-detail-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"v10-local-agent-title",children:[l.jsx(YS,{integrationId:V.id}),V.name]}),l.jsx("div",{className:"v10-local-agent-subtitle",children:V.description})]}),l.jsx("span",{className:`v10-local-agent-status-pill ${V.status}`,children:V.statusLabel})]}),l.jsx("p",{className:"v10-local-agent-copy",children:V.detail}),V.error&&l.jsx("div",{className:"v10-local-agent-warning offline",role:"status","data-testid":`local-agent-warning-${V.id}`,children:V.error}),V.id==="openclaw"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"v10-local-agent-copy",children:"Connect your local OpenClaw once, then this tab becomes the persistent chat surface for that agent. The node can retry the bridge without forcing you back through setup."}),l.jsxs("div",{className:"v10-local-agent-actions",children:[l.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>p(V.id),disabled:v===V.id,children:v===V.id?"Connecting...":"Connect OpenClaw"}),l.jsx("a",{className:"v10-agent-link-btn",href:wV,target:"_blank",rel:"noreferrer",children:"Docs"}),l.jsx("a",{className:"v10-agent-link-btn",href:kV,target:"_blank",rel:"noreferrer",children:"Release Notes"})]})]}),V.id==="prime-agent"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"v10-local-agent-copy",children:"Connect a local Prime Agent through the node, then this tab becomes the persistent chat surface for it. Prime Agent publishes a bridge per live session; the first chat pins one session, and you can switch explicitly when several are live."}),typeof V.sessionCount=="number"&&l.jsx("p",{className:"v10-local-agent-copy","data-testid":`local-agent-sessions-${V.id}`,children:V.sessionCount===0?"No live session. Start a Prime Agent session, then refresh — the extension publishes its bridge on session start.":V.sessionCount===1?"1 live session.":`${V.sessionCount} live sessions — choose which session this chat should use.`}),V.connectSupported&&l.jsx("div",{className:"v10-local-agent-actions",children:l.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>p(V.id),disabled:v===V.id,children:v===V.id?"Connecting...":"Connect Prime Agent"})})]}),V.id==="hermes"&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"v10-local-agent-copy",children:"Connect a local Hermes profile through the node, then this tab becomes the persistent chat surface for that profile."}),V.connectSupported&&l.jsx("div",{className:"v10-local-agent-actions",children:l.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>p(V.id),disabled:v===V.id,children:v===V.id?"Connecting...":"Connect Hermes"})})]})]},V.id))]})]}):be&&l.jsxs("div",{...de.getRootProps({className:"v10-local-agent-chat-shell"}),children:[l.jsx("input",{...de.getInputProps()}),j&&l.jsx("div",{className:"v10-local-agent-notice",children:j}),C&&l.jsx("div",{className:"v10-local-agent-error",children:C}),!be.chatReady&&l.jsx("div",{className:`v10-local-agent-warning ${be.status==="connecting"?"connecting":"offline"}`,children:bt?`${be.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:be.status==="connecting"?`${be.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:be.status==="degraded"?be.detail:at?`${be.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${be.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),be.id==="prime-agent"&&be.busy===!0&&l.jsx("div",{className:"v10-local-agent-warning connecting",role:"status","data-testid":"prime-agent-active-turn-status",children:be.detail}),be.id==="prime-agent"&&(((ie=be.liveSessions)==null?void 0:ie.length)??0)>1&&l.jsxs("div",{className:"v10-composer-target","data-testid":"prime-agent-session-picker",children:[l.jsx("span",{className:"v10-local-agent-target-label",children:"Prime session"}),l.jsx(ZS,{className:"v10-local-agent-target-select",value:i??be.defaultSessionId??"",onChange:V=>d(be.id,{sessionId:V}),options:be.liveSessions.map((V,xe)=>{var Le;return{value:V.sessionId,label:((Le=V.sessionName)==null?void 0:Le.trim())||`${xe===0?"Most recent":`Session ${xe+1}`} · ${V.sessionId.slice(0,8)}…`}}),ariaLabel:"Prime Agent session",disabled:B||be.busy===!0})]}),de.isDragActive&&l.jsx("div",{className:`v10-drop-overlay active ${Ge?"accept":"refuse"}`,role:"status","aria-live":"polite",children:l.jsxs("div",{className:"v10-drop-overlay-card",children:[Ge?l.jsx(V4,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):l.jsx(x4,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}),l.jsx("div",{className:"v10-drop-overlay-title",children:Ge?`Drop files to attach to ${zg(R,_)}`:Re==="sending"?"Wait for the current send to finish.":Re==="unsupported"?`${be.name} doesn't accept file attachments.`:"Choose a context graph before attaching files."}),l.jsx("div",{className:"v10-drop-overlay-hint",children:Ge?"Release to upload to this conversation.":Re==="sending"?"Drop will be accepted once the agent reply lands.":Re==="unsupported"?"Try a different agent that supports attachments.":"Use the picker below the composer."})]})}),l.jsxs("div",{className:"v10-chat-messages v10-local-agent-messages",ref:Ee,onScroll:ke,children:[Se&&l.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!Se&&S.length===0&&(()=>{const V=bt?{title:"No turns in this session yet.",hint:`Reconnect ${be.name} from the + tab to start a new live thread.`}:at?{title:`${be.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:be.chatReady?{title:`Start a conversation with ${be.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${be.name} is offline.`,hint:"Conversation history stays here while the bridge reconnects."};return l.jsxs("div",{className:"v10-agent-empty-state",children:[l.jsx("div",{className:"v10-agent-empty-state-title",children:V.title}),l.jsx("div",{className:"v10-agent-empty-state-hint",children:V.hint})]})})(),S.map(V=>{var xe,Le;return l.jsxs("div",{className:`v10-chat-msg ${V.role}`,children:[l.jsx("div",{className:`v10-chat-bubble ${V.role}`,children:uW(V.content,V.role,!!V.synthesized,!!V.streaming,V.failureNotice)}),V.attachments&&V.attachments.length>0&&l.jsx("div",{className:"v10-local-agent-attachment-row",style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:6},children:V.attachments.map(Ae=>l.jsx("span",{className:"v10-local-agent-attachment-chip",style:{padding:"2px 8px",borderRadius:999,background:"var(--bg-elevated)",fontSize:11},children:Ae.fileName},Ae.id??Ae.assertionUri??Ae.fileHash))}),V.role==="assistant"&&(((xe=V.toolCalls)==null?void 0:xe.length)||V.traceFile)&&l.jsxs("div",{className:"v10-local-agent-copy","data-testid":"local-llm-turn-metadata",children:[(Le=V.toolCalls)!=null&&Le.length?`Tools: ${V.toolCalls.map(Ae=>Ae.name).join(", ")}`:"Tools: none",V.traceFile?` · Trace: ${V.traceFile}`:""]}),V.ts&&l.jsx("time",{className:`v10-local-agent-msg-time ${V.role}`,dateTime:V.tsRaw,children:V.ts})]},V.id)}),l.jsx("div",{ref:A}),l.jsx("button",{type:"button",className:`v10-scroll-to-bottom ${Oe?"visible":""}`,onClick:ve,"aria-label":"Scroll to latest message",title:"Scroll to latest message",tabIndex:Oe?0:-1,"aria-hidden":!Oe,children:l.jsx(g4,{size:14,"aria-hidden":"true"})})]}),l.jsx("div",{className:"v10-agent-input-area",children:l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[W.length>0&&l.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:W.map(V=>{var Ae,De;const xe=((Ae=V.result)==null?void 0:Ae.extraction.tripleCount)??((De=V.result)==null?void 0:De.extraction.triplesWritten),Le=V.status==="queued"?"Queued":V.status==="uploading"?"Importing…":V.status==="completed"?xe!=null?`Ready · ${xe} triples`:"Ready":V.status==="skipped"?"Stored only":V.error??"Failed";return l.jsxs("div",{className:"v10-attachment-chip","data-status":V.status,role:"listitem",children:[l.jsx("div",{className:"v10-attachment-chip-badge","aria-hidden":"true",children:hV(V.file.name)}),l.jsxs("div",{className:"v10-attachment-chip-body",children:[l.jsx("div",{className:"v10-attachment-chip-name",title:V.file.name,children:V.file.name}),l.jsxs("div",{className:"v10-attachment-chip-meta",children:[l.jsx("span",{children:pV(V.file.size)}),l.jsx("span",{"aria-hidden":"true",children:"·"}),l.jsx("span",{className:"v10-attachment-chip-status",children:Le})]})]}),l.jsx("button",{type:"button",className:"v10-attachment-chip-remove",onClick:()=>q(V.id),disabled:B,"aria-label":`Remove ${V.file.name}`,title:"Remove attachment",children:l.jsx(X4,{size:12,"aria-hidden":"true"})})]},V.id)})}),I&&l.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:H.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${zg(R,H[0])}), not the active project.`}),l.jsx("input",{ref:ae,type:"file",multiple:!0,style:{display:"none"},onChange:V=>{V.target.files&&(D(V.target.files),V.target.value="")}}),l.jsx("div",{className:"v10-local-agent-composer-row",children:l.jsxs("div",{className:"v10-local-agent-composer-shell",children:[l.jsx(EW,{placeholder:bt?`Reconnect ${be.name} to resume live chat...`:be.chatReady?`Message ${be.name}...`:be.status==="connecting"?`${be.name} is still connecting...`:`${be.name} bridge offline...`,className:"v10-agent-input",value:O,onChange:V=>M(V.target.value),onKeyDown:V=>{if(!V.nativeEvent.isComposing){if(V.key==="Enter"&&!V.shiftKey&&!V.ctrlKey&&!V.metaKey){V.preventDefault(),fe&&T();return}if((V.ctrlKey||V.metaKey)&&V.key==="Enter"){V.preventDefault(),fe&&T();return}V.key==="Escape"&&O.length>0&&(V.preventDefault(),M(""))}},disabled:X,minRows:1,maxRows:8}),l.jsxs("div",{className:"v10-composer-controls",children:[l.jsxs("div",{className:"v10-composer-controls-left",children:[l.jsx("button",{type:"button",className:"v10-composer-attach",onClick:()=>{var V;return(V=ae.current)==null?void 0:V.click()},disabled:!Ge,title:Ge?"Attach files":Re==="noProject"?"Choose a context graph to attach files":Re==="sending"?"Wait for the current message to send":"This agent does not support attachments","aria-label":"Attach files",children:l.jsx(P4,{size:14,"aria-hidden":"true"})}),l.jsx("div",{className:"v10-composer-target",children:l.jsx(ZS,{className:"v10-local-agent-target-select",value:_??"",onChange:F,options:[..._?[{value:"",label:"No context graph (clear selection)"}]:[],...G.map(V=>({value:V.id,label:V.name}))],placeholder:z?"Loading context graphs…":"Choose a context graph",disabled:z||!_&&G.length===0,ariaLabel:"Active project",prefixIcon:l.jsx(_4,{size:12,"aria-hidden":"true"})})})]}),l.jsx("button",{type:"button",className:`v10-local-agent-inline-send v10-local-agent-inline-send-${Z}`,onClick:Z==="streaming"?L:T,disabled:Z==="streaming"?!1:Z==="uploading"?!0:!fe,"aria-label":Z==="streaming"?"Stop reply":Z==="uploading"?"Send message (attachments uploading)":"Send message",title:Z==="streaming"?"Stop reply":Z==="uploading"?"Send message (attachments uploading)…":"Send message",children:Z==="streaming"?l.jsx(F4,{size:12,"aria-hidden":"true"}):Z==="uploading"?l.jsx(I4,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):l.jsx(y4,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function Jm(e){return e.length>12?e.slice(-8):e}function $Z(e){if(!e)return"";const t=e.lastIndexOf(":"),n=t>=0?e.slice(t+1):e;return n.length>10?n.slice(-10):n||e.slice(-8)}function PZ(e,t){const n=new Map;for(const g of t){if(!g.peerId)continue;const m=n.get(g.peerId)??[];m.push(g),n.set(g.peerId,m)}const r=new Map;for(const g of e){if(!g.peerId)continue;const m=r.get(g.peerId)??{hasDirect:!1,hasRelay:!1,openedAt:null},v=m.hasDirect||g.transport==="direct",b=m.hasRelay||g.transport==="relayed",k=g.openedAt!=null?m.openedAt!=null?Math.min(m.openedAt,g.openedAt):g.openedAt:m.openedAt;r.set(g.peerId,{hasDirect:v,hasRelay:b,openedAt:k})}const i=g=>{var m;return(m=g.find(v=>v.name))==null?void 0:m.name},o=g=>g.reduce((m,v)=>v.lastSeen!=null&&(m==null||v.lastSeen>m)?v.lastSeen:m,void 0),c=[],d=new Set;for(const[g,m]of r){const v=n.get(g)??[];c.push({peerId:g,name:i(v),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:o(v),agents:v}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const v=m.filter(C=>C.connectionStatus==="connected");if(v.length===0)continue;const b=v.some(C=>C.connectionTransport==="direct"),k=v.some(C=>C.connectionTransport==="relayed"),j=k&&!b?"relayed":"direct";c.push({peerId:g,name:i(m),transport:j,hasDirect:b,hasRelay:k,openedAt:null,connected:!0,lastSeen:o(m),agents:m}),d.add(g)}const p=[];for(const[g,m]of n){if(d.has(g))continue;const v=o(m);v!=null&&p.push({peerId:g,name:i(m),transport:"direct",hasDirect:!1,hasRelay:!1,openedAt:null,connected:!1,lastSeen:v,agents:m})}p.sort((g,m)=>(m.lastSeen??0)-(g.lastSeen??0));const h=c.filter(g=>g.transport==="direct").length;return{connected:c,recentlySeen:p,directCount:h,relayedCount:c.length-h}}function UZ({peer:e}){var g;const[t,n]=w.useState(!1),r=w.useId(),i=3,o=e.connected?"connected":"offline",c=((g=e.name)==null?void 0:g.trim())||Jm(e.peerId),d=t?e.agents:e.agents.slice(0,i),p=e.connected?e.transport:"Disconnected",h=e.connected&&e.hasDirect&&e.hasRelay?"Direct + relay paths active — direct shown":void 0;return l.jsxs("div",{className:`v10-agent-card v10-peer-card ${o}`,children:[l.jsxs("div",{className:"v10-agent-card-header",children:[l.jsx("span",{className:`v10-agent-card-dot ${o}`}),l.jsx("span",{className:"v10-peer-card-name",children:c}),l.jsx("span",{className:"v10-agent-card-badge",title:h,children:p})]}),l.jsxs("div",{className:"v10-peer-card-meta",children:[l.jsx("span",{title:e.peerId,children:Jm(e.peerId)}),e.connected&&e.openedAt!=null&&l.jsxs("span",{children:["up ",wS(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&l.jsxs("span",{children:[wS(Date.now()-e.lastSeen)," ago"]}),e.agents.length>0&&l.jsxs("span",{children:[e.agents.length," agent",e.agents.length===1?"":"s"]})]}),e.agents.length>0&&l.jsxs("ul",{id:r,className:"v10-peer-card-chips","aria-label":`Agents on ${c}`,children:[d.map((m,v)=>l.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:l.jsx("span",{className:"v10-peer-chip-label",children:$Z(m.agentUri)||Jm(m.peerId)})},m.agentUri||`${e.peerId}:${v}`)),e.agents.length>i&&l.jsx("li",{children:l.jsx("button",{type:"button",className:"v10-peer-chip-more","aria-expanded":t,"aria-controls":r,onClick:()=>n(m=>!m),children:t?"Show less":`+${e.agents.length-i} more`})})]})]})}function XS(e){const{label:t,peers:n,expanded:r,onToggle:i,emptyMessage:o}=e;return l.jsxs("div",{className:"v10-peer-group",children:[l.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:i,"aria-expanded":r,children:[l.jsx(ig,{size:14,className:`v10-peer-group-chevron ${r?"expanded":""}`,"aria-hidden":"true"}),l.jsx("span",{className:"v10-peer-group-label",children:t}),l.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),r&&l.jsx("div",{className:"v10-peer-group-body",children:n.length===0?l.jsx("div",{className:"v10-agent-empty-state",children:o}):n.map(c=>l.jsx(UZ,{peer:c},c.peerId))})]})}function BZ(e){const{peerAgents:t,connections:n,loading:r,onRefresh:i}=e,[o,c]=w.useState(!0),[d,p]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:v}=PZ(n.rows,t);return l.jsxs("div",{className:"v10-agent-scroll-tab",children:[l.jsxs("div",{className:"v10-agents-summary",children:[l.jsxs("span",{className:"v10-agents-stat",children:[l.jsx("span",{className:`v10-agents-stat-dot ${h.length>0||n.total>0?"connected":"known"}`}),l.jsxs("span",{title:"Unique libp2p peers connected to this node — matches the count in the header.",children:[h.length," peer",h.length===1?"":"s"]})]}),l.jsxs("span",{className:"v10-agents-stat",title:"Preferred transport per peer (peers reachable via direct + relay are bucketed under direct)",children:[m," direct / ",v," relayed"]}),l.jsx("button",{className:"v10-agents-refresh",onClick:i,title:"Refresh network peers",children:"Refresh"})]}),r&&l.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!r&&h.length===0&&g.length===0&&n.total===0&&l.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!r&&h.length===0&&n.total>0&&l.jsxs("div",{className:"v10-agent-empty-state",children:["Connected to ",n.total," peer",n.total===1?"":"s"," (peer metadata syncing…)."]}),(h.length>0||g.length>0)&&l.jsxs(l.Fragment,{children:[l.jsx(XS,{label:"Connected",peers:h,expanded:o,onToggle:()=>c(b=>!b),emptyMessage:"No peers currently connected."}),l.jsx(XS,{label:"Recently seen",peers:g,expanded:d,onToggle:()=>p(b=>!b),emptyMessage:"No previously-seen peers."})]})]})}function FZ(e){const{sessions:t,onOpenSession:n}=e;return l.jsx("div",{className:"v10-agent-scroll-tab",children:l.jsxs("div",{className:"v10-sessions-list",children:[l.jsx("div",{className:"v10-local-agent-copy",style:{marginBottom:12},children:"Sessions track DKG-persisted conversations for your integrated agents."}),t.length===0?l.jsx("p",{className:"v10-agent-empty-state",children:"No integrated-agent sessions yet."}):t.map(r=>l.jsxs("button",{className:"v10-session-item",onClick:()=>n(r),children:[l.jsxs("span",{className:"v10-session-preview",children:[r.integrationName,": ",r.preview]}),l.jsxs("span",{className:"v10-session-count",children:[r.messageCount," msg",r.messageCount!==1?"s":"",r.lastTs?` - ${Qd(r.lastTs)}`:""]})]},r.sessionId))]})})}function qZ(){return of().data}function HZ(){const{stage:e,advance:t}=vv(),[n,r]=w.useState("agents"),[i,o]=w.useState([]),[c,d]=w.useState([]),[p,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),v=qZ(),[b,k]=w.useState([]),[j,C]=w.useState("openclaw"),[S,N]=w.useState(()=>rs("openclaw")),[A,O]=w.useState(null),[M,T]=w.useState(null),[L,B]=w.useState(null),[_,R]=w.useState(null),[z,F]=w.useState(null),[Y,D]=w.useState({}),[q,G]=w.useState({}),[W,Q]=w.useState({}),[H,$]=w.useState({}),[U,Z]=w.useState({}),I=w.useRef(new Map),ae=w.useRef(!1),le=w.useRef(null),oe=w.useRef([]),we=w.useRef({}),Ee=w.useRef("openclaw"),Oe=w.useRef(rs("openclaw")),He=Mr(me=>me.contextGraphs),ke=Mr(me=>me.loading),ve=Mr(me=>me.activeProjectId),Re=Mr(me=>me.setActiveProject),Ge=w.useMemo(()=>fI(He,v?wv(v):null,ve),[He,v,ve]),We=KS(i,b),{selectedIntegration:de,selectedConversation:Pe,selectedHasConversation:Ze,selectedIntegrationHasAnyConversation:ot}=_Z({integrations:b,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:Y,sessions:We}),be=(Pe==null?void 0:Pe.stateKey)??null,bt=be?Y[be]??[]:[],at=be?H[be]??!1:!1,rn=be?q[be]??"":"",mt=be?W[be]??!1:!1,Se=be?U[be]??[]:[],X=w.useCallback(()=>{var me;(me=le.current)==null||me.scrollIntoView({behavior:"smooth"})},[]);w.useEffect(X,[be,bt,X]),w.useEffect(()=>{oe.current=i},[i]),w.useEffect(()=>{we.current=Y},[Y]),w.useEffect(()=>{Ee.current=j},[j]),w.useEffect(()=>{Oe.current=S},[S]);const fe=w.useCallback((me,_e)=>{D(ue=>({...ue,[me]:_e(ue[me]??[])}))},[]),Ne=w.useCallback((me,_e)=>{me&&G(ue=>({...ue,[me]:_e}))},[]),ie=w.useCallback((me,_e)=>{Q(ue=>({...ue,[me]:_e}))},[]),V=w.useCallback((me,_e)=>{Z(ue=>({...ue,[me]:_e(ue[me]??[])}))},[]),xe=w.useCallback((me,_e,ue)=>{const Ce=Array.from(_e);if(Ce.length===0)return;const Me=new Set((U[me]??[]).map($e=>`${$e.contextGraphId}:${$e.file.name}:${$e.file.size}:${$e.file.lastModified}`)),tt=Ce.filter($e=>{const Ye=`${ue}:${$e.name}:${$e.size}:${$e.lastModified}`;return Me.has(Ye)?!1:(Me.add(Ye),!0)});if(tt.length===0)return;const Ke=tt.map($e=>({id:`${me}:${$e.name}:${$e.size}:${$e.lastModified}:${crypto.randomUUID()}`,file:$e,contextGraphId:ue,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${$e.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));V(me,$e=>[...$e,...Ke])},[U,V]),Le=w.useCallback(async(me,_e)=>{const ue=[];for(const Ce of _e){if(Ce.status==="completed"||Ce.status==="skipped"){ue.push(Ce);continue}V(me,Me=>Me.map(tt=>tt.id===Ce.id?{...tt,status:"uploading",error:void 0}:tt));try{const Me=await Uj(Ce.assertionName,Ce.contextGraphId,Ce.file),tt=Me.extraction.status==="completed"?"completed":Me.extraction.status==="skipped"?"skipped":"error",Ke={...Ce,status:tt,result:Me,error:Me.extraction.error};ue.push(Ke),V(me,$e=>$e.map(Ye=>Ye.id===Ce.id?Ke:Ye))}catch(Me){const tt={...Ce,status:"error",error:(Me==null?void 0:Me.message)??"Upload failed"};ue.push(tt),V(me,Ke=>Ke.map($e=>$e.id===Ce.id?tt:$e))}}return ue},[V]),Ae=w.useCallback((me,_e)=>{V(me,ue=>ue.filter(Ce=>Ce.id!==_e))},[V]),De=w.useCallback((me,_e)=>{const ue=new Set(_e);V(me,Ce=>Ce.filter(Me=>!ue.has(Me.id)))},[V]),Qe=w.useCallback((me,_e={})=>{C(me),me!==os&&(_e.preserveSession||N(_e.sessionId??rs(me)))},[]),Te=w.useCallback(()=>{kn.fetchMemorySessions(50).then(({sessions:me})=>o(me??[])).catch(()=>{})},[]),jt=w.useCallback(async()=>{try{const[me,_e]=await Promise.all([iv().catch(()=>({agents:[]})),dO().catch(()=>({total:0,direct:0,relayed:0,connections:[]}))]),ue=(me.agents??[]).filter(Ce=>Ce.connectionStatus!=="self");d(ue),h({total:_e.total??0,direct:_e.direct??0,relayed:_e.relayed??0,rows:Array.isArray(_e.connections)?_e.connections:[]})}catch{}m(!1)},[]),ft=w.useCallback(async()=>{try{const{integrations:me}=await sf();k(me);const _e=KS(oe.current,me),ue=[...me].sort(Sf).filter(Ye=>Ye.persistentChat),Ce=Ee.current,Me=Oe.current,tt=me.find(Ye=>Ye.id===Ce)??null,Ke=LZ({selectedIntegrationId:Ce,selectedItem:tt,selectedSessionId:Me,localMessagesByConversation:we.current,sessionSummaries:_e});if(!Ke){const Ye=ue[0];Qe((Ye==null?void 0:Ye.id)??os,{sessionId:(Ye==null?void 0:Ye.defaultSessionId)??null})}const $e=ue[0];$e&&!ae.current&&Ce!==os?(ae.current=!0,Qe($e.id,{sessionId:$e.defaultSessionId}),r("agents")):!$e&&!Ke&&(ae.current=!1,Qe(os))}catch{}},[Qe]),An=w.useCallback(async(me,_e=null,ue=null)=>{const Ce=nc({integrationId:me,sessionId:_e,defaultSessionId:ue});$(Me=>({...Me,[Ce.stateKey]:!1}));try{const tt=(await L1(me,100,{sessionId:Ce.sessionId??void 0})).map(Ke=>jS(Ke,me));fe(Ce.stateKey,Ke=>Wm(Ke,tt))}catch{fe(Ce.stateKey,Me=>Me)}finally{$(Me=>({...Me,[Ce.stateKey]:!0})),Te()}},[Te,fe]);w.useEffect(()=>{Te(),jt(),ft()},[Te,jt,ft]),w.useEffect(()=>{for(const me of SV)An(me,rs(me))},[]);const Mn=w.useCallback(()=>{Te(),jt()},[Te,jt]);bc(Mn,15e3,{runImmediately:!1});const yn=b.some(me=>me.persistentChat&&(!me.chatReady||me.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const me=setInterval(()=>{ft()},yn);return()=>clearInterval(me)},[yn,ft]),w.useEffect(()=>{if(!(de!=null&&de.chatSupported)||!de.persistentChat&&!Ze){be&&$(_e=>({..._e,[be]:!1}));return}let me=!1;return(async()=>await An(de.id,(Pe==null?void 0:Pe.sessionId)??null,de.defaultSessionId??null))(),()=>{me=!0}},[An,Pe==null?void 0:Pe.sessionId,be,Ze,de==null?void 0:de.defaultSessionId,de==null?void 0:de.chatSupported,de==null?void 0:de.id,de==null?void 0:de.persistentChat]);const Ga=w.useCallback(async()=>{var js,ma;const me=de,_e=Pe,ue=rn.trim(),Ce=Se,Me=Ce.some(ZE);if(!(me!=null&&me.chatSupported)||!me.chatReady||mt||!_e||!ue&&!Me)return;const tt=me.id,Ke=_e.stateKey;ie(Ke,!0),B(null);let $e=null,Ye="",Tn="",ha="",Do="",Ac=[],Qa=[],Wr=[];try{Qa=await Le(Ke,Ce);const bn=Qa.map(lt=>vV(lt)).filter(lt=>lt!=null),Ln=yV(Qa);if(!ue&&bn.length===0&&Ln.results.length===0)return;Tn=crypto.randomUUID();const xr=KE(Ln.results),Wt=[ue,xr].filter(lt=>lt.length>0).join(`
|
|
1644
|
+
|
|
1645
|
+
`);ha=ue?Wt:bV(bn,Ln.results);const Gn=ue?Wt:"";Ac=bn,Wr=[...bn.map(lt=>lt.id).filter(lt=>typeof lt=="string"&<.length>0),...Ln.deliveredDraftIds];const In=`local:${Ke}:${Tn}:user`;Ye=`local:${Ke}:${Tn}:assistant`;const wr=new Date,Ka=Qd(wr),zo=Dg(wr);fe(Ke,lt=>[...lt,{id:In,turnId:Tn,role:"user",content:ha,ts:Ka,tsRaw:zo,attachments:bn},{id:Ye,turnId:Tn,role:"assistant",content:"",ts:Ka,tsRaw:zo,streaming:!0}]),Ne(Ke,""),Wr.length>0&&De(Ke,Wr),$e=new AbortController,I.current.set(Ke,$e);const Tc=[...xV(He,ve,v)],jf=me.id==="prime-agent"?(js=me.liveSessions)==null?void 0:js.find(lt=>lt.sessionId===_e.sessionId):void 0,Dn=await uM(tt,Gn,{correlationId:Tn,signal:$e==null?void 0:$e.signal,sessionId:_e.sessionId??void 0,liveSession:jf,profile:me.profile,persistUserMessage:Gn?void 0:ha,attachments:bn,attachmentImportResults:Ln.results,contextEntries:Tc,contextGraphId:ve??void 0,onEvent:lt=>{lt.type==="text_delta"&&(Do+=lt.delta,fe(Ke,fn=>fn.map(ga=>ga.id===Ye?{...ga,content:ga.content+lt.delta}:ga)))}}),Di=new Date;fe(Ke,lt=>CS(lt,Tn,Dn.turnId).map(fn=>{var ga;return fn.id===Ye?{...fn,content:Dn.text||fn.content,turnId:((ga=Dn.turnId)==null?void 0:ga.trim())||fn.turnId,streaming:!1,synthesized:!Dn.text&&!fn.content?!0:fn.synthesized,ts:Qd(Di),tsRaw:Dg(Di),toolCalls:Dn.toolCalls,traceFile:Dn.traceFile,profile:Dn.profile,contextGraphId:Dn.contextGraphId,readOnly:Dn.readOnly}:fn}));const Vn=tt==="prime-agent"?(ma=Dn.sessionId)==null?void 0:ma.trim():void 0;if(Vn&&Vn!==_e.sessionId&&Ee.current===tt&&Oe.current===_e.sessionId){const lt=vy(tt,Vn);D(fn=>({...fn,[lt]:Wm(fn[lt]??[],fn[Ke]??[])})),$(fn=>({...fn,[lt]:fn[Ke]??!0})),Qe(tt,{sessionId:Vn}),T(`${me.name} restarted; switched chat to the live session.`)}Te(),e===0&&t()}catch(bn){const Ln=(bn==null?void 0:bn.name)==="AbortError",xr=Ln?"Request cancelled.":jV(me,bn),Wt=Ln?xr:`Error: ${xr}`;if(Ye){const Gn=lW(Do,Wt);fe(Ke,Zr=>Zr.map(In=>In.id===Ye?{...In,...Gn,streaming:!1}:In))}!Ln&&tt==="hermes"&&Ye&&ha&&(async()=>{try{const Gn=await cM(tt,{sessionId:_e.sessionId??void 0,correlationId:Tn||void 0,userMessage:ha,assistantReply:Do,failureReason:xr,profile:me.profile,attachments:Ac,contextGraphId:ve??void 0});Gn.turnId&&fe(Ke,Zr=>CS(Zr,Tn,Gn.turnId)),Te()}catch{}})(),Wr.length>0&&Qa.length>0&&Z(Gn=>{const Zr=Gn[Ke]??[],In=new Set(Zr.map(Ka=>Ka.id)),wr=Qa.filter(Ka=>!In.has(Ka.id));return wr.length===0?Gn:{...Gn,[Ke]:[...wr,...Zr]}}),ft()}finally{ie(Ke,!1),I.current.get(Ke)===$e&&I.current.delete(Ke)}},[ve,t,He,v,Te,rn,mt,Le,Se,ft,Pe,de,De,Ne,ie,Qe,e,fe]),ar=w.useCallback(()=>{if(!be)return;const me=I.current.get(be);me==null||me.abort()},[be]),Va=w.useCallback(async me=>{O(me),B(null),T(null);try{const _e=await iM(me);k(Me=>Sd(Me,_e.integration)),await ft();const ue=Sd(b,_e.integration),Ce=TZ({integrationId:me,selectedSessionId:S,integrations:ue});Qe(me,{preserveSession:Ce,sessionId:_e.integration.defaultSessionId}),ae.current=!0,T(_e.notice??(_e.integration.chatReady?`${_e.integration.name} is connected and chat-ready.`:`${_e.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),r("agents")}catch(_e){await ft(),B(_e.message)}finally{O(null)}},[b,ft,S,Qe]),pa=w.useCallback(async me=>{B(null),T(null);try{await sM(me),k(_e=>MZ(_e,me)),ae.current=!1,Qe(me,{preserveSession:j===me}),T("The local agent was disconnected from this node. Session history remains available here."),r("agents"),await ft()}catch(_e){B(_e.message)}},[ft,j,Qe]),ks=w.useCallback(async me=>{var Me,tt,Ke;if(_===me)return;R(me),B(null),T(null);const _e=nc({integrationId:me,sessionId:j===me?Oe.current:null,defaultSessionId:(Me=b.find($e=>$e.id===me))==null?void 0:Me.defaultSessionId}),[ue,Ce]=await Promise.allSettled([oM(me),L1(me,100,{sessionId:_e.sessionId??void 0})]);try{if(ue.status==="fulfilled"?(k($e=>Sd($e,ue.value.integration)),ue.value.notice&&T(ue.value.notice)):B(((tt=ue.reason)==null?void 0:tt.message)??"Failed to refresh integration."),Ce.status==="fulfilled"){const $e=Ce.value.map(Ye=>jS(Ye,me));fe(_e.stateKey,Ye=>Wm(Ye,$e)),$(Ye=>({...Ye,[_e.stateKey]:!0}))}else ue.status==="fulfilled"&&B(((Ke=Ce.reason)==null?void 0:Ke.message)??"Failed to refresh conversation.")}finally{R(null)}},[b,_,j,fe]),Wa=w.useCallback(async me=>{if(!(me!=="local-llm"||z)){F(me),B(null),T(null);try{await GO();const _e=nc({integrationId:me,sessionId:rs(me)});D(ue=>({...ue,[_e.stateKey]:[]})),G(ue=>({...ue,[_e.stateKey]:""})),Z(ue=>({...ue,[_e.stateKey]:[]})),$(ue=>({...ue,[_e.stateKey]:!0})),T("DKG Local LLM session cleared. You can now select a different Context Graph."),await ft()}catch(_e){B((_e==null?void 0:_e.message)??"Failed to clear the local LLM session.")}finally{F(null)}}},[z,ft]),Li=w.useCallback(me=>{Qe(me.integrationId,{sessionId:me.sessionId}),r("agents")},[Qe]),Za=w.useCallback(me=>{Re(me||null)},[Re]),Ii=w.useCallback(me=>{!be||!ve||xe(be,me,ve)},[ve,xe,be]),Ss=w.useCallback(me=>{be&&Ae(be,me)},[Ae,be]);return l.jsxs("div",{className:"v10-panel-right",children:[l.jsxs("div",{className:"v10-agent-mode-tabs",children:[l.jsx("button",{className:`v10-agent-mode-tab ${n==="agents"?"active":""}`,onClick:()=>r("agents"),children:"Agents"}),l.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>r("network"),children:"Network"}),l.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>r("sessions"),children:"Sessions"})]}),n==="agents"&&l.jsx(zZ,{integrations:b,selectedIntegrationId:j,selectedIntegration:de,selectedSessionId:S,selectedHasConversation:Ze,selectedIntegrationHasAnyConversation:ot,onSelectIntegration:Qe,onConnectIntegration:Va,onDisconnectIntegration:pa,onRefreshIntegration:ks,onClearIntegrationSession:Wa,connectBusyId:A,refreshBusyId:_,clearBusyId:z,connectNotice:M,connectError:L,localMessages:bt,localHistoryLoaded:at,localChatEndRef:le,localInput:rn,onLocalInputChange:me=>Ne(be,me),onSendLocalMessage:Ga,onStopLocalStream:ar,localSending:mt,activeProjectId:ve,availableProjects:He,selectableProjects:Ge,projectsLoading:ke,onSelectProject:Za,attachments:Se,onAddAttachments:Ii,onRemoveAttachment:Ss}),n==="network"&&l.jsx(BZ,{peerAgents:c,connections:p,loading:g,onRefresh:jt}),n==="sessions"&&l.jsx(FZ,{sessions:We,onOpenSession:Li})]})}function GZ(e,t=document){const n=e==="light";t.documentElement.setAttribute("data-theme",e),t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function VZ(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=tr();w.useEffect(()=>{const r=i=>{if(i.target instanceof HTMLInputElement||i.target instanceof HTMLTextAreaElement||!(i.metaKey||i.ctrlKey))return;const c=i.key.toLowerCase();if(i.shiftKey&&c==="b"){i.preventDefault(),t();return}if(!i.shiftKey){if(c==="b"){i.preventDefault(),e();return}if(c==="j"){i.preventDefault(),n();return}}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t,n])}const JS={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},WZ={operations:"/observability",settings:"/settings",dashboard:"/"};function ZZ(){const{pathname:e}=Vr(),t=Zg(),n=gn(i=>i.openTab),r=gn(i=>i.activeTabId);w.useEffect(()=>{const i=JS[e];i&&n({id:i.id,label:i.label,closable:!0})},[e,n]),w.useEffect(()=>{const i=WZ[r];if(i){i!==e&&t(i,{replace:!0});return}JS[e]&&t("/",{replace:!0})},[r,e,t])}function QZ(){const[e,t]=w.useState(RM());return w.useEffect(()=>_M(t),[]),e?l.jsxs("div",{className:"v10-mock-banner",role:"alert","aria-live":"polite",children:[l.jsx("span",{className:"v10-mock-banner-dot","aria-hidden":"true"}),l.jsxs("span",{children:[l.jsx("strong",{children:"Demo data"})," — the node isn’t responding (it may be down, timing out, or returning errors), so the UI is showing example data, not live node state. Check the daemon, then reload."]}),l.jsx("button",{type:"button",className:"v10-mock-banner-reload",onClick:()=>window.location.reload(),children:"Reload"})]}):null}function KZ(){const e=tv(t=>t.setNodeStatus);bc(()=>{kn.fetchStatus().then(e).catch(()=>{})},1e4)}function ej(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const r=t.current;if(!r)return;let i=0;const o=p=>{const h=p.clientX-i;i=p.clientX,n.current(h)},c=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",r.classList.remove("active")},d=p=>{p.preventDefault(),i=p.clientX,document.addEventListener("mousemove",o),document.addEventListener("mouseup",c),document.body.style.cursor="col-resize",document.body.style.userSelect="none",r.classList.add("active")};return r.addEventListener("mousedown",d),()=>r.removeEventListener("mousedown",d)},[]),t}function YZ(e){const t=w.useRef(e);t.current=e;const[n,r]=w.useState(null);return w.useEffect(()=>{if(!n)return;let i=0;const o=p=>{const h=p.clientY-i;i=p.clientY,t.current(h)},c=()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",c),document.body.style.cursor="",document.body.style.userSelect="",n.classList.remove("active")},d=p=>{p.preventDefault(),i=p.clientY,document.addEventListener("mousemove",o),document.addEventListener("mouseup",c),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),c()}},[n]),w.useCallback(i=>r(i),[])}function XZ(){KZ(),VZ(),ZZ();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:r,leftWidth:i,rightWidth:o,setLeftWidth:c,setRightWidth:d,setBottomHeight:p}=tr(),[,h]=w.useState(0);w.useEffect(()=>{GZ(r)},[r]),w.useEffect(()=>{const C=()=>h(S=>S+1);return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]),w.useLayoutEffect(()=>{const C=window.requestAnimationFrame(()=>{window.dispatchEvent(new Event("resize"))});return()=>window.cancelAnimationFrame(C)},[e,t]);const g=w.useCallback(C=>{const S=tr.getState().leftWidth;c(Math.max(140,Math.min(400,S+C)))},[c]),m=w.useCallback(C=>{const S=tr.getState().rightWidth;d(Math.max(200,Math.min(500,S-C)))},[d]),v=w.useCallback(C=>{const S=Math.min(tr.getState().bottomHeight,Ed());p(Math.min(S-C,Ed()))},[p]),b=ej(g),k=ej(m),j=YZ(v);return l.jsxs("div",{className:"v10-app",children:[l.jsx(QZ,{}),l.jsx(IL,{}),l.jsxs("div",{className:"v10-app-body",children:[!e&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"v10-panel-left",style:{width:i},children:l.jsx(NI,{})}),l.jsx("div",{className:"v10-resize-handle-h",ref:b})]}),l.jsxs("div",{className:"v10-center-region",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[l.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:l.jsx(JG,{})}),!n&&l.jsx("div",{className:"v10-resize-handle-v",ref:j}),l.jsx(fV,{})]}),!t&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"v10-resize-handle-h",ref:k}),l.jsx("div",{className:"v10-panel-right",style:{width:o},children:l.jsx(HZ,{})})]})]})]})}const JZ=Je.lazy(()=>kt(()=>import("./Network-JVFsFYhR.js"),[]).then(e=>({default:e.NetworkPage})));function eQ(){const e=gn(t=>t.openTab);return w.useLayoutEffect(()=>{e(PC)},[e]),l.jsx(ql,{to:"/",replace:!0})}function tQ(){return l.jsxs(TR,{children:[l.jsx(Ci,{path:"/network",element:l.jsx(Je.Suspense,{fallback:l.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:l.jsx(JZ,{})})}),l.jsx(Ci,{path:"/context-graph-primer",element:l.jsx(eQ,{})}),l.jsx(Ci,{path:"/agent",element:l.jsx(ql,{to:"/",replace:!0})}),l.jsx(Ci,{path:"/explorer",element:l.jsx(ql,{to:"/",replace:!0})}),l.jsx(Ci,{path:"/messages",element:l.jsx(ql,{to:"/",replace:!0})}),l.jsx(Ci,{path:"/apps/*",element:l.jsx(ql,{to:"/",replace:!0})}),l.jsx(Ci,{path:"*",element:l.jsx(XZ,{})})]})}_2.createRoot(document.getElementById("root")).render(l.jsx(Je.StrictMode,{children:l.jsx(JR,{basename:"/ui",children:l.jsx(tQ,{})})}));export{LQ as $,Y3 as A,RQ as B,k4 as C,EQ as D,Jt as E,AQ as F,CQ as G,Hn as H,jQ as I,NQ as J,gQ as K,bj as L,av as M,TQ as N,yQ as O,HZ as P,pv as Q,Je as R,pf as S,w9 as T,zQ as U,ow as V,K4 as W,pD as X,hD as Y,J4 as Z,kt as _,us as a,EI as a0,eL as a1,aQ as a2,mc as a3,e4 as a4,n4 as a5,j9 as a6,Zj as a7,pQ as a8,hQ as a9,k3 as aA,gs as aB,tv as aC,l$ as aD,vr as aE,Cv as aF,ls as aG,Yj as aH,Xj as aI,oc as aJ,v3 as aK,qa as aL,Mr as aM,gn as aN,DQ as aO,h9 as aP,r4 as aa,MQ as ab,IQ as ac,l as ad,fQ as ae,uQ as af,cO as ag,$Q as ah,eC as ai,og as aj,sQ as ak,lO as al,oQ as am,cQ as an,KM as ao,lQ as ap,w as aq,lw as ar,_Q as as,c9 as at,C9 as au,Yv as av,OQ as aw,so as ax,vQ as ay,bQ as az,DC as b,j4 as c,E4 as d,I4 as e,LC as f,It as g,Bt as h,pS as i,ag as j,rQ as k,dn as l,iQ as m,mQ as n,P1 as o,iv as p,dO as q,kQ as r,SQ as s,hO as t,xQ as u,dQ as v,gO as w,wQ as x,mO as y,Td as z};
|