@origintrail-official/dkg-node-ui 10.0.1 → 10.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chain-cursor-stores.d.ts +45 -0
- package/dist/chain-cursor-stores.d.ts.map +1 -0
- package/dist/chain-cursor-stores.js +107 -0
- package/dist/chain-cursor-stores.js.map +1 -0
- package/dist/chat-memory.d.ts +0 -17
- package/dist/chat-memory.d.ts.map +1 -1
- package/dist/chat-memory.js +6 -33
- package/dist/chat-memory.js.map +1 -1
- package/dist/db.d.ts +15 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +40 -1
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/notifications-scope.d.ts +19 -0
- package/dist/notifications-scope.d.ts.map +1 -1
- package/dist/notifications-scope.js +34 -2
- package/dist/notifications-scope.js.map +1 -1
- package/dist/otlp-log-worker.d.ts +127 -0
- package/dist/otlp-log-worker.d.ts.map +1 -0
- package/dist/otlp-log-worker.js +268 -0
- package/dist/otlp-log-worker.js.map +1 -0
- package/dist/telemetry-resource.d.ts +41 -0
- package/dist/telemetry-resource.d.ts.map +1 -0
- package/dist/telemetry-resource.js +31 -0
- package/dist/telemetry-resource.js.map +1 -0
- package/dist/telemetry.d.ts +75 -16
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +152 -29
- package/dist/telemetry.js.map +1 -1
- package/dist-ui/assets/{3d-force-graph-DII0C0lY.js → 3d-force-graph-DRDhpplH.js} +1 -1
- package/dist-ui/assets/AgentHub-DdUAxJoy.js +1 -0
- package/dist-ui/assets/AgentProfilePage-yI8fA4vv.js +1 -0
- package/dist-ui/assets/ApproveWalletsModal-9w2edv7e.js +57 -0
- package/dist-ui/assets/ConvictionDetailView-CcQMya-y.js +2 -0
- package/dist-ui/assets/Network-DpAKVzwi.js +1 -0
- package/dist-ui/assets/OnChainProvenanceCard-DMOm3jLz.js +1 -0
- package/dist-ui/assets/{Operations-BC6Cv6cR.js → Operations-DKJFp6hM.js} +3 -3
- package/dist-ui/assets/PublishingConviction-1CPHxNwp.js +2 -0
- package/dist-ui/assets/Settings-DaYMlGHD.js +1 -0
- package/dist-ui/assets/ccip-hCQYqfNz.js +1 -0
- package/dist-ui/assets/{index-D0Mz0SVt.js → index-Bh_8bMB0.js} +3 -3
- package/dist-ui/assets/{index-ByLJSVQ3.js → index-CVwCoJrM.js} +9 -9
- package/dist-ui/assets/index-D5UiTYlY.css +1 -0
- package/dist-ui/assets/index-DGpnb_b1.js +1661 -0
- package/dist-ui/assets/{jsonld-32FQRO67-B4_tUX65.js → jsonld-32FQRO67-C3B_LjZ-.js} +2 -2
- package/dist-ui/assets/{jsonld-D5RXTCJi.js → jsonld-CoPRWQuM.js} +1 -1
- package/dist-ui/assets/{renderer-3d-2EVDZII7-BTYEjwma.js → renderer-3d-2EVDZII7-Bx6o7Gge.js} +2 -2
- package/dist-ui/index.html +2 -2
- package/package.json +14 -3
- package/dist-ui/assets/AgentHub-D3eOrb3Z.js +0 -1
- package/dist-ui/assets/AgentProfilePage-jB-v9soG.js +0 -1
- package/dist-ui/assets/Network-d4igcZQ0.js +0 -1
- package/dist-ui/assets/OnChainProvenanceCard-BL6ou6s9.js +0 -1
- package/dist-ui/assets/Settings-DXSjvx2a.js +0 -1
- package/dist-ui/assets/index-B6UQm9N_.js +0 -1670
- package/dist-ui/assets/index-BgRu6zNc.css +0 -1
|
@@ -1,1670 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D0Mz0SVt.js","assets/ordinal-DhEzRPdO.js","assets/OnChainProvenanceCard-BL6ou6s9.js","assets/Operations-BC6Cv6cR.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var oT=Object.defineProperty;var lT=(e,t,n)=>t in e?oT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var kn=(e,t,n)=>lT(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerPolicy&&(c.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?c.credentials="include":s.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(s){if(s.ep)return;s.ep=!0;const c=n(s);fetch(s.href,c)}})();var R7=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function _7(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 s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}var Gf={exports:{}},rl={};/**
|
|
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 F0;function cT(){if(F0)return rl;F0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,c){var u=null;if(c!==void 0&&(u=""+c),s.key!==void 0&&(u=""+s.key),"key"in s){c={};for(var d in s)d!=="key"&&(c[d]=s[d])}else c=s;return s=c.ref,{$$typeof:e,type:r,key:u,ref:s!==void 0?s:null,props:c}}return rl.Fragment=t,rl.jsx=n,rl.jsxs=n,rl}var H0;function uT(){return H0||(H0=1,Gf.exports=cT()),Gf.exports}var o=uT(),Vf={exports:{}},Ge={};/**
|
|
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 q0;function dT(){if(q0)return Ge;q0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,E={};function S(P,q,O){this.props=P,this.context=q,this.refs=E,this.updater=O||k}S.prototype.isReactComponent={},S.prototype.setState=function(P,q){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,q,"setState")},S.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function T(){}T.prototype=S.prototype;function N(P,q,O){this.props=P,this.context=q,this.refs=E,this.updater=O||k}var R=N.prototype=new T;R.constructor=N,j(R,S.prototype),R.isPureReactComponent=!0;var H=Array.isArray;function A(){}var U={H:null,A:null,T:null,S:null},G=Object.prototype.hasOwnProperty;function M(P,q,O){var ne=O.ref;return{$$typeof:e,type:P,key:q,ref:ne!==void 0?ne:null,props:O}}function _(P,q){return M(P.type,q,P.props)}function I(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function B(P){var q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(O){return q[O]})}var Z=/\/+/g;function $(P,q){return typeof P=="object"&&P!==null&&P.key!=null?B(""+P.key):q.toString(36)}function D(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(A,A):(P.status="pending",P.then(function(q){P.status==="pending"&&(P.status="fulfilled",P.value=q)},function(q){P.status==="pending"&&(P.status="rejected",P.reason=q)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function F(P,q,O,ne,ue){var le=typeof P;(le==="undefined"||le==="boolean")&&(P=null);var be=!1;if(P===null)be=!0;else switch(le){case"bigint":case"string":case"number":be=!0;break;case"object":switch(P.$$typeof){case e:case t:be=!0;break;case g:return be=P._init,F(be(P._payload),q,O,ne,ue)}}if(be)return ue=ue(P),be=ne===""?"."+$(P,0):ne,H(ue)?(O="",be!=null&&(O=be.replace(Z,"$&/")+"/"),F(ue,q,O,"",function(Ie){return Ie})):ue!=null&&(I(ue)&&(ue=_(ue,O+(ue.key==null||P&&P.key===ue.key?"":(""+ue.key).replace(Z,"$&/")+"/")+be)),q.push(ue)),1;be=0;var Re=ne===""?".":ne+":";if(H(P))for(var Ee=0;Ee<P.length;Ee++)ne=P[Ee],le=Re+$(ne,Ee),be+=F(ne,q,O,le,ue);else if(Ee=b(P),typeof Ee=="function")for(P=Ee.call(P),Ee=0;!(ne=P.next()).done;)ne=ne.value,le=Re+$(ne,Ee++),be+=F(ne,q,O,le,ue);else if(le==="object"){if(typeof P.then=="function")return F(D(P),q,O,ne,ue);throw q=String(P),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return be}function V(P,q,O){if(P==null)return P;var ne=[],ue=0;return F(P,ne,"","",function(le){return q.call(O,le,ue++)}),ne}function X(P){if(P._status===-1){var q=P._result;q=q(),q.then(function(O){(P._status===0||P._status===-1)&&(P._status=1,P._result=O)},function(O){(P._status===0||P._status===-1)&&(P._status=2,P._result=O)}),P._status===-1&&(P._status=0,P._result=q)}if(P._status===1)return P._result.default;throw P._result}var Q=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},L={map:V,forEach:function(P,q,O){V(P,function(){q.apply(this,arguments)},O)},count:function(P){var q=0;return V(P,function(){q++}),q},toArray:function(P){return V(P,function(q){return q})||[]},only:function(P){if(!I(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ge.Activity=m,Ge.Children=L,Ge.Component=S,Ge.Fragment=n,Ge.Profiler=s,Ge.PureComponent=N,Ge.StrictMode=r,Ge.Suspense=f,Ge.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=U,Ge.__COMPILER_RUNTIME={__proto__:null,c:function(P){return U.H.useMemoCache(P)}},Ge.cache=function(P){return function(){return P.apply(null,arguments)}},Ge.cacheSignal=function(){return null},Ge.cloneElement=function(P,q,O){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var ne=j({},P.props),ue=P.key;if(q!=null)for(le in q.key!==void 0&&(ue=""+q.key),q)!G.call(q,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&q.ref===void 0||(ne[le]=q[le]);var le=arguments.length-2;if(le===1)ne.children=O;else if(1<le){for(var be=Array(le),Re=0;Re<le;Re++)be[Re]=arguments[Re+2];ne.children=be}return M(P.type,ue,ne)},Ge.createContext=function(P){return P={$$typeof:u,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Ge.createElement=function(P,q,O){var ne,ue={},le=null;if(q!=null)for(ne in q.key!==void 0&&(le=""+q.key),q)G.call(q,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ue[ne]=q[ne]);var be=arguments.length-2;if(be===1)ue.children=O;else if(1<be){for(var Re=Array(be),Ee=0;Ee<be;Ee++)Re[Ee]=arguments[Ee+2];ue.children=Re}if(P&&P.defaultProps)for(ne in be=P.defaultProps,be)ue[ne]===void 0&&(ue[ne]=be[ne]);return M(P,le,ue)},Ge.createRef=function(){return{current:null}},Ge.forwardRef=function(P){return{$$typeof:d,render:P}},Ge.isValidElement=I,Ge.lazy=function(P){return{$$typeof:g,_payload:{_status:-1,_result:P},_init:X}},Ge.memo=function(P,q){return{$$typeof:h,type:P,compare:q===void 0?null:q}},Ge.startTransition=function(P){var q=U.T,O={};U.T=O;try{var ne=P(),ue=U.S;ue!==null&&ue(O,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(A,Q)}catch(le){Q(le)}finally{q!==null&&O.types!==null&&(q.types=O.types),U.T=q}},Ge.unstable_useCacheRefresh=function(){return U.H.useCacheRefresh()},Ge.use=function(P){return U.H.use(P)},Ge.useActionState=function(P,q,O){return U.H.useActionState(P,q,O)},Ge.useCallback=function(P,q){return U.H.useCallback(P,q)},Ge.useContext=function(P){return U.H.useContext(P)},Ge.useDebugValue=function(){},Ge.useDeferredValue=function(P,q){return U.H.useDeferredValue(P,q)},Ge.useEffect=function(P,q){return U.H.useEffect(P,q)},Ge.useEffectEvent=function(P){return U.H.useEffectEvent(P)},Ge.useId=function(){return U.H.useId()},Ge.useImperativeHandle=function(P,q,O){return U.H.useImperativeHandle(P,q,O)},Ge.useInsertionEffect=function(P,q){return U.H.useInsertionEffect(P,q)},Ge.useLayoutEffect=function(P,q){return U.H.useLayoutEffect(P,q)},Ge.useMemo=function(P,q){return U.H.useMemo(P,q)},Ge.useOptimistic=function(P,q){return U.H.useOptimistic(P,q)},Ge.useReducer=function(P,q,O){return U.H.useReducer(P,q,O)},Ge.useRef=function(P){return U.H.useRef(P)},Ge.useState=function(P){return U.H.useState(P)},Ge.useSyncExternalStore=function(P,q,O){return U.H.useSyncExternalStore(P,q,O)},Ge.useTransition=function(){return U.H.useTransition()},Ge.version="19.2.4",Ge}var G0;function Um(){return G0||(G0=1,Vf.exports=dT()),Vf.exports}var w=Um();const Qe=Dl(w);var Wf={exports:{}},il={},Zf={exports:{}},Yf={};/**
|
|
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 V0;function pT(){return V0||(V0=1,(function(e){function t(F,V){var X=F.length;F.push(V);e:for(;0<X;){var Q=X-1>>>1,L=F[Q];if(0<s(L,V))F[Q]=V,F[X]=L,X=Q;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var V=F[0],X=F.pop();if(X!==V){F[0]=X;e:for(var Q=0,L=F.length,P=L>>>1;Q<P;){var q=2*(Q+1)-1,O=F[q],ne=q+1,ue=F[ne];if(0>s(O,X))ne<L&&0>s(ue,O)?(F[Q]=ue,F[ne]=X,Q=ne):(F[Q]=O,F[q]=X,Q=q);else if(ne<L&&0>s(ue,X))F[Q]=ue,F[ne]=X,Q=ne;else break e}}return V}function s(F,V){var X=F.sortIndex-V.sortIndex;return X!==0?X:F.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var f=[],h=[],g=1,m=null,y=3,b=!1,k=!1,j=!1,E=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(F){for(var V=n(h);V!==null;){if(V.callback===null)r(h);else if(V.startTime<=F)r(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(h)}}function H(F){if(j=!1,R(F),!k)if(n(f)!==null)k=!0,A||(A=!0,B());else{var V=n(h);V!==null&&D(H,V.startTime-F)}}var A=!1,U=-1,G=5,M=-1;function _(){return E?!0:!(e.unstable_now()-M<G)}function I(){if(E=!1,A){var F=e.unstable_now();M=F;var V=!0;try{e:{k=!1,j&&(j=!1,T(U),U=-1),b=!0;var X=y;try{t:{for(R(F),m=n(f);m!==null&&!(m.expirationTime>F&&_());){var Q=m.callback;if(typeof Q=="function"){m.callback=null,y=m.priorityLevel;var L=Q(m.expirationTime<=F);if(F=e.unstable_now(),typeof L=="function"){m.callback=L,R(F),V=!0;break t}m===n(f)&&r(f),R(F)}else r(f);m=n(f)}if(m!==null)V=!0;else{var P=n(h);P!==null&&D(H,P.startTime-F),V=!1}}break e}finally{m=null,y=X,b=!1}V=void 0}}finally{V?B():A=!1}}}var B;if(typeof N=="function")B=function(){N(I)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,$=Z.port2;Z.port1.onmessage=I,B=function(){$.postMessage(null)}}else B=function(){S(I,0)};function D(F,V){U=S(function(){F(e.unstable_now())},V)}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(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):G=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(F){switch(y){case 1:case 2:case 3:var V=3;break;default:V=y}var X=y;y=V;try{return F()}finally{y=X}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var X=y;y=F;try{return V()}finally{y=X}},e.unstable_scheduleCallback=function(F,V,X){var Q=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Q+X:Q):X=Q,F){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=X+L,F={id:g++,callback:V,priorityLevel:F,startTime:X,expirationTime:L,sortIndex:-1},X>Q?(F.sortIndex=X,t(h,F),n(f)===null&&F===n(h)&&(j?(T(U),U=-1):j=!0,D(H,X-Q))):(F.sortIndex=L,t(f,F),k||b||(k=!0,A||(A=!0,B()))),F},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(F){var V=y;return function(){var X=y;y=V;try{return F.apply(this,arguments)}finally{y=X}}}})(Yf)),Yf}var W0;function fT(){return W0||(W0=1,Zf.exports=pT()),Zf.exports}var Qf={exports:{}},Nn={};/**
|
|
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 Z0;function hT(){if(Z0)return Nn;Z0=1;var e=Um();function t(f){var h="https://react.dev/errors/"+f;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 #"+f+"; 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},s=Symbol.for("react.portal");function c(f,h,g){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:f,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Nn.createPortal=function(f,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 c(f,h,null,g)},Nn.flushSync=function(f){var h=u.T,g=r.p;try{if(u.T=null,r.p=2,f)return f()}finally{u.T=h,r.p=g,r.d.f()}},Nn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(f,h))},Nn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},Nn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):g==="script"&&r.d.X(f,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Nn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=d(h.as,h.crossOrigin);r.d.M(f,{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(f)},Nn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,m=d(g,h.crossOrigin);r.d.L(f,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})}},Nn.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=d(h.as,h.crossOrigin);r.d.m(f,{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(f)},Nn.requestFormReset=function(f){r.d.r(f)},Nn.unstable_batchedUpdates=function(f,h){return f(h)},Nn.useFormState=function(f,h,g){return u.H.useFormState(f,h,g)},Nn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Nn.version="19.2.4",Nn}var Y0;function fk(){if(Y0)return Qf.exports;Y0=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(),Qf.exports=hT(),Qf.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 Q0;function mT(){if(Q0)return il;Q0=1;var e=fT(),t=Um(),n=fk();function r(a){var i="https://react.dev/errors/"+a;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+a+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function c(a){var i=a,l=a;if(a.alternate)for(;i.return;)i=i.return;else{a=i;do i=a,(i.flags&4098)!==0&&(l=i.return),a=i.return;while(a)}return i.tag===3?l:null}function u(a){if(a.tag===13){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function d(a){if(a.tag===31){var i=a.memoizedState;if(i===null&&(a=a.alternate,a!==null&&(i=a.memoizedState)),i!==null)return i.dehydrated}return null}function f(a){if(c(a)!==a)throw Error(r(188))}function h(a){var i=a.alternate;if(!i){if(i=c(a),i===null)throw Error(r(188));return i!==a?null:a}for(var l=a,p=i;;){var v=l.return;if(v===null)break;var x=v.alternate;if(x===null){if(p=v.return,p!==null){l=p;continue}break}if(v.child===x.child){for(x=v.child;x;){if(x===l)return f(v),a;if(x===p)return f(v),i;x=x.sibling}throw Error(r(188))}if(l.return!==p.return)l=v,p=x;else{for(var C=!1,z=v.child;z;){if(z===l){C=!0,l=v,p=x;break}if(z===p){C=!0,p=v,l=x;break}z=z.sibling}if(!C){for(z=x.child;z;){if(z===l){C=!0,l=x,p=v;break}if(z===p){C=!0,p=x,l=v;break}z=z.sibling}if(!C)throw Error(r(189))}}if(l.alternate!==p)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?a:i}function g(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a;for(a=a.child;a!==null;){if(i=g(a),i!==null)return i;a=a.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),_=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function B(a){return a===null||typeof a!="object"?null:(a=I&&a[I]||a["@@iterator"],typeof a=="function"?a:null)}var Z=Symbol.for("react.client.reference");function $(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===Z?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case j:return"Fragment";case S:return"Profiler";case E:return"StrictMode";case H:return"Suspense";case A:return"SuspenseList";case M:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case k:return"Portal";case N:return a.displayName||"Context";case T:return(a._context.displayName||"Context")+".Consumer";case R:var i=a.render;return a=a.displayName,a||(a=i.displayName||i.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case U:return i=a.displayName||null,i!==null?i:$(a.type)||"Memo";case G:i=a._payload,a=a._init;try{return $(a(i))}catch{}}return null}var D=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},Q=[],L=-1;function P(a){return{current:a}}function q(a){0>L||(a.current=Q[L],Q[L]=null,L--)}function O(a,i){L++,Q[L]=a.current,a.current=i}var ne=P(null),ue=P(null),le=P(null),be=P(null);function Re(a,i){switch(O(le,i),O(ue,a),O(ne,null),i.nodeType){case 9:case 11:a=(a=i.documentElement)&&(a=a.namespaceURI)?d0(a):0;break;default:if(a=i.tagName,i=i.namespaceURI)i=d0(i),a=p0(i,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}q(ne),O(ne,a)}function Ee(){q(ne),q(ue),q(le)}function Ie(a){a.memoizedState!==null&&O(be,a);var i=ne.current,l=p0(i,a.type);i!==l&&(O(ue,a),O(ne,l))}function Ve(a){ue.current===a&&(q(ne),q(ue)),be.current===a&&(q(be),el._currentValue=X)}var Se,ft;function Me(a){if(Se===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);Se=i&&i[1]||"",ft=-1<l.stack.indexOf(`
|
|
43
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
44
|
-
`+Se+a+ft}var qe=!1;function ke(a,i){if(!a||qe)return"";qe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(i){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(oe){var se=oe}Reflect.construct(a,[],me)}else{try{me.call()}catch(oe){se=oe}a.call(me.prototype)}}else{try{throw Error()}catch(oe){se=oe}(me=a())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(oe){if(oe&&se&&typeof oe.stack=="string")return[oe.stack,se.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=p.DetermineComponentFrameRoot(),C=x[0],z=x[1];if(C&&z){var Y=C.split(`
|
|
45
|
-
`),re=z.split(`
|
|
46
|
-
`);for(v=p=0;p<Y.length&&!Y[p].includes("DetermineComponentFrameRoot");)p++;for(;v<re.length&&!re[v].includes("DetermineComponentFrameRoot");)v++;if(p===Y.length||v===re.length)for(p=Y.length-1,v=re.length-1;1<=p&&0<=v&&Y[p]!==re[v];)v--;for(;1<=p&&0<=v;p--,v--)if(Y[p]!==re[v]){if(p!==1||v!==1)do if(p--,v--,0>v||Y[p]!==re[v]){var pe=`
|
|
47
|
-
`+Y[p].replace(" at new "," at ");return a.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",a.displayName)),pe}while(1<=p&&0<=v);break}}}finally{qe=!1,Error.prepareStackTrace=l}return(l=a?a.displayName||a.name:"")?Me(l):""}function lt(a,i){switch(a.tag){case 26:case 27:case 5:return Me(a.type);case 16:return Me("Lazy");case 13:return a.child!==i&&i!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return ke(a.type,!1);case 11:return ke(a.type.render,!1);case 1:return ke(a.type,!0);case 31:return Me("Activity");default:return""}}function xe(a){try{var i="",l=null;do i+=lt(a,l),l=a,a=a.return;while(a);return i}catch(p){return`
|
|
48
|
-
Error generating stack: `+p.message+`
|
|
49
|
-
`+p.stack}}var Oe=Object.prototype.hasOwnProperty,_t=e.unstable_scheduleCallback,Dt=e.unstable_cancelCallback,Yt=e.unstable_shouldYield,Ft=e.unstable_requestPaint,ut=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,K=e.unstable_ImmediatePriority,W=e.unstable_UserBlockingPriority,ee=e.unstable_NormalPriority,ce=e.unstable_LowPriority,he=e.unstable_IdlePriority,Le=e.log,He=e.unstable_setDisableYieldValue,Ce=null,Fe=null;function et(a){if(typeof Le=="function"&&He(a),Fe&&typeof Fe.setStrictMode=="function")try{Fe.setStrictMode(Ce,a)}catch{}}var Ne=Math.clz32?Math.clz32:Ua,Gt=Math.log,At=Math.LN2;function Ua(a){return a>>>=0,a===0?32:31-(Gt(a)/At|0)|0}var la=256,Ur=262144,Br=4194304;function ca(a){var i=a&42;if(i!==0)return i;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 Ba(a,i,l){var p=a.pendingLanes;if(p===0)return 0;var v=0,x=a.suspendedLanes,C=a.pingedLanes;a=a.warmLanes;var z=p&134217727;return z!==0?(p=z&~x,p!==0?v=ca(p):(C&=z,C!==0?v=ca(C):l||(l=z&~a,l!==0&&(v=ca(l))))):(z=p&~x,z!==0?v=ca(z):C!==0?v=ca(C):l||(l=p&~a,l!==0&&(v=ca(l)))),v===0?0:i!==0&&i!==v&&(i&x)===0&&(x=v&-v,l=i&-i,x>=l||x===32&&(l&4194048)!==0)?i:v}function sr(a,i){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&i)===0}function Wl(a,i){switch(a){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Fr(){var a=Br;return Br<<=1,(Br&62914560)===0&&(Br=4194304),a}function wi(a){for(var i=[],l=0;31>l;l++)i.push(a);return i}function ge(a,i){a.pendingLanes|=i,i!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function ze(a,i,l,p,v,x){var C=a.pendingLanes;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=l,a.entangledLanes&=l,a.errorRecoveryDisabledLanes&=l,a.shellSuspendCounter=0;var z=a.entanglements,Y=a.expirationTimes,re=a.hiddenUpdates;for(l=C&~l;0<l;){var pe=31-Ne(l),me=1<<pe;z[pe]=0,Y[pe]=-1;var se=re[pe];if(se!==null)for(re[pe]=null,pe=0;pe<se.length;pe++){var oe=se[pe];oe!==null&&(oe.lane&=-536870913)}l&=~me}p!==0&&de(a,p,0),x!==0&&v===0&&a.tag!==0&&(a.suspendedLanes|=x&~(C&~i))}function de(a,i,l){a.pendingLanes|=i,a.suspendedLanes&=~i;var p=31-Ne(i);a.entangledLanes|=i,a.entanglements[p]=a.entanglements[p]|1073741824|l&261930}function je(a,i){var l=a.entangledLanes|=i;for(a=a.entanglements;l;){var p=31-Ne(l),v=1<<p;v&i|a[p]&i&&(a[p]|=i),l&=~v}}function Te(a,i){var l=i&-i;return l=(l&42)!==0?1:tt(l),(l&(a.suspendedLanes|i))!==0?0:l}function tt(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 Je(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function Ze(){var a=V.p;return a!==0?a:(a=window.event,a===void 0?32:M0(a.type))}function pt(a,i){var l=V.p;try{return V.p=a,i()}finally{V.p=l}}var fn=Math.random().toString(36).slice(2),Ht="__reactFiber$"+fn,ln="__reactProps$"+fn,or="__reactContainer$"+fn,lr="__reactEvents$"+fn,ss="__reactListeners$"+fn,Wn="__reactHandles$"+fn,ua="__reactResources$"+fn,Aa="__reactMarker$"+fn;function Hr(a){delete a[Ht],delete a[ln],delete a[lr],delete a[ss],delete a[Wn]}function hn(a){var i=a[Ht];if(i)return i;for(var l=a.parentNode;l;){if(i=l[or]||l[Ht]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(a=b0(a);a!==null;){if(l=a[Ht])return l;a=b0(a)}return i}a=l,l=a.parentNode}return null}function Cn(a){if(a=a[Ht]||a[or]){var i=a.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return a}return null}function cr(a){var i=a.tag;if(i===5||i===26||i===27||i===6)return a.stateNode;throw Error(r(33))}function da(a){var i=a[ua];return i||(i=a[ua]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function Ot(a){a[Aa]=!0}var go=new Set,Zl={};function pa(a,i){ur(a,i),ur(a+"Capture",i)}function ur(a,i){for(Zl[a]=i,a=0;a<i.length;a++)go.add(i[a])}var Jt=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]*$"),fa={},Fa={};function JC(a){return Oe.call(Fa,a)?!0:Oe.call(fa,a)?!1:Jt.test(a)?Fa[a]=!0:(fa[a]=!0,!1)}function Yl(a,i,l){if(JC(i))if(l===null)a.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":a.removeAttribute(i);return;case"boolean":var p=i.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(i);return}}a.setAttribute(i,""+l)}}function Ql(a,i,l){if(l===null)a.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(i);return}a.setAttribute(i,""+l)}}function dr(a,i,l,p){if(p===null)a.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(l);return}a.setAttributeNS(i,l,""+p)}}function ha(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function av(a){var i=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function eN(a,i,l){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,i);if(!a.hasOwnProperty(i)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,x=p.set;return Object.defineProperty(a,i,{configurable:!0,get:function(){return v.call(this)},set:function(C){l=""+C,x.call(this,C)}}),Object.defineProperty(a,i,{enumerable:p.enumerable}),{getValue:function(){return l},setValue:function(C){l=""+C},stopTracking:function(){a._valueTracker=null,delete a[i]}}}}function $d(a){if(!a._valueTracker){var i=av(a)?"checked":"value";a._valueTracker=eN(a,i,""+a[i])}}function rv(a){if(!a)return!1;var i=a._valueTracker;if(!i)return!0;var l=i.getValue(),p="";return a&&(p=av(a)?a.checked?"true":"false":a.value),a=p,a!==l?(i.setValue(a),!0):!1}function Kl(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 tN=/[\n"\\]/g;function ma(a){return a.replace(tN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Id(a,i,l,p,v,x,C,z){a.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?a.type=C:a.removeAttribute("type"),i!=null?C==="number"?(i===0&&a.value===""||a.value!=i)&&(a.value=""+ha(i)):a.value!==""+ha(i)&&(a.value=""+ha(i)):C!=="submit"&&C!=="reset"||a.removeAttribute("value"),i!=null?Pd(a,C,ha(i)):l!=null?Pd(a,C,ha(l)):p!=null&&a.removeAttribute("value"),v==null&&x!=null&&(a.defaultChecked=!!x),v!=null&&(a.checked=v&&typeof v!="function"&&typeof v!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?a.name=""+ha(z):a.removeAttribute("name")}function iv(a,i,l,p,v,x,C,z){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(a.type=x),i!=null||l!=null){if(!(x!=="submit"&&x!=="reset"||i!=null)){$d(a);return}l=l!=null?""+ha(l):"",i=i!=null?""+ha(i):l,z||i===a.value||(a.value=i),a.defaultValue=i}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=z?a.checked:!!p,a.defaultChecked=!!p,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(a.name=C),$d(a)}function Pd(a,i,l){i==="number"&&Kl(a.ownerDocument)===a||a.defaultValue===""+l||(a.defaultValue=""+l)}function os(a,i,l,p){if(a=a.options,i){i={};for(var v=0;v<l.length;v++)i["$"+l[v]]=!0;for(l=0;l<a.length;l++)v=i.hasOwnProperty("$"+a[l].value),a[l].selected!==v&&(a[l].selected=v),v&&p&&(a[l].defaultSelected=!0)}else{for(l=""+ha(l),i=null,v=0;v<a.length;v++){if(a[v].value===l){a[v].selected=!0,p&&(a[v].defaultSelected=!0);return}i!==null||a[v].disabled||(i=a[v])}i!==null&&(i.selected=!0)}}function sv(a,i,l){if(i!=null&&(i=""+ha(i),i!==a.value&&(a.value=i),l==null)){a.defaultValue!==i&&(a.defaultValue=i);return}a.defaultValue=l!=null?""+ha(l):""}function ov(a,i,l,p){if(i==null){if(p!=null){if(l!=null)throw Error(r(92));if(D(p)){if(1<p.length)throw Error(r(93));p=p[0]}l=p}l==null&&(l=""),i=l}l=ha(i),a.defaultValue=l,p=a.textContent,p===l&&p!==""&&p!==null&&(a.value=p),$d(a)}function ls(a,i){if(i){var l=a.firstChild;if(l&&l===a.lastChild&&l.nodeType===3){l.nodeValue=i;return}}a.textContent=i}var nN=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 lv(a,i,l){var p=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?p?a.setProperty(i,""):i==="float"?a.cssFloat="":a[i]="":p?a.setProperty(i,l):typeof l!="number"||l===0||nN.has(i)?i==="float"?a.cssFloat=l:a[i]=(""+l).trim():a[i]=l+"px"}function cv(a,i,l){if(i!=null&&typeof i!="object")throw Error(r(62));if(a=a.style,l!=null){for(var p in l)!l.hasOwnProperty(p)||i!=null&&i.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var v in i)p=i[v],i.hasOwnProperty(v)&&l[v]!==p&&lv(a,v,p)}else for(var x in i)i.hasOwnProperty(x)&&lv(a,x,i[x])}function Ud(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 aN=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"]]),rN=/^[\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 Xl(a){return rN.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function pr(){}var Bd=null;function Fd(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var cs=null,us=null;function uv(a){var i=Cn(a);if(i&&(a=i.stateNode)){var l=a[ln]||null;e:switch(a=i.stateNode,i.type){case"input":if(Id(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=a;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+ma(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var p=l[i];if(p!==a&&p.form===a.form){var v=p[ln]||null;if(!v)throw Error(r(90));Id(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(i=0;i<l.length;i++)p=l[i],p.form===a.form&&rv(p)}break e;case"textarea":sv(a,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&os(a,!!l.multiple,i,!1)}}}var Hd=!1;function dv(a,i,l){if(Hd)return a(i,l);Hd=!0;try{var p=a(i);return p}finally{if(Hd=!1,(cs!==null||us!==null)&&(Pc(),cs&&(i=cs,a=us,us=cs=null,uv(i),a)))for(i=0;i<a.length;i++)uv(a[i])}}function vo(a,i){var l=a.stateNode;if(l===null)return null;var p=l[ln]||null;if(p===null)return null;l=p[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(l&&typeof l!="function")throw Error(r(231,i,typeof l));return l}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qd=!1;if(fr)try{var yo={};Object.defineProperty(yo,"passive",{get:function(){qd=!0}}),window.addEventListener("test",yo,yo),window.removeEventListener("test",yo,yo)}catch{qd=!1}var qr=null,Gd=null,Jl=null;function pv(){if(Jl)return Jl;var a,i=Gd,l=i.length,p,v="value"in qr?qr.value:qr.textContent,x=v.length;for(a=0;a<l&&i[a]===v[a];a++);var C=l-a;for(p=1;p<=C&&i[l-p]===v[x-p];p++);return Jl=v.slice(a,1<p?1-p:void 0)}function ec(a){var i=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&i===13&&(a=13)):a=i,a===10&&(a=13),32<=a||a===13?a:0}function tc(){return!0}function fv(){return!1}function Dn(a){function i(l,p,v,x,C){this._reactName=l,this._targetInst=v,this.type=p,this.nativeEvent=x,this.target=C,this.currentTarget=null;for(var z in a)a.hasOwnProperty(z)&&(l=a[z],this[z]=l?l(x):x[z]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?tc:fv,this.isPropagationStopped=fv,this}return m(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=tc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=tc)},persist:function(){},isPersistent:tc}),i}var ki={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},nc=Dn(ki),bo=m({},ki,{view:0,detail:0}),iN=Dn(bo),Vd,Wd,xo,ac=m({},bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yd,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!==xo&&(xo&&a.type==="mousemove"?(Vd=a.screenX-xo.screenX,Wd=a.screenY-xo.screenY):Wd=Vd=0,xo=a),Vd)},movementY:function(a){return"movementY"in a?a.movementY:Wd}}),hv=Dn(ac),sN=m({},ac,{dataTransfer:0}),oN=Dn(sN),lN=m({},bo,{relatedTarget:0}),Zd=Dn(lN),cN=m({},ki,{animationName:0,elapsedTime:0,pseudoElement:0}),uN=Dn(cN),dN=m({},ki,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),pN=Dn(dN),fN=m({},ki,{data:0}),mv=Dn(fN),hN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mN={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"},gN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vN(a){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(a):(a=gN[a])?!!i[a]:!1}function Yd(){return vN}var yN=m({},bo,{key:function(a){if(a.key){var i=hN[a.key]||a.key;if(i!=="Unidentified")return i}return a.type==="keypress"?(a=ec(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?mN[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yd,charCode:function(a){return a.type==="keypress"?ec(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?ec(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),bN=Dn(yN),xN=m({},ac,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gv=Dn(xN),wN=m({},bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yd}),kN=Dn(wN),SN=m({},ki,{propertyName:0,elapsedTime:0,pseudoElement:0}),jN=Dn(SN),CN=m({},ac,{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}),NN=Dn(CN),EN=m({},ki,{newState:0,oldState:0}),TN=Dn(EN),AN=[9,13,27,32],Qd=fr&&"CompositionEvent"in window,wo=null;fr&&"documentMode"in document&&(wo=document.documentMode);var RN=fr&&"TextEvent"in window&&!wo,vv=fr&&(!Qd||wo&&8<wo&&11>=wo),yv=" ",bv=!1;function xv(a,i){switch(a){case"keyup":return AN.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wv(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ds=!1;function _N(a,i){switch(a){case"compositionend":return wv(i);case"keypress":return i.which!==32?null:(bv=!0,yv);case"textInput":return a=i.data,a===yv&&bv?null:a;default:return null}}function ON(a,i){if(ds)return a==="compositionend"||!Qd&&xv(a,i)?(a=pv(),Jl=Gd=qr=null,ds=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return vv&&i.locale!=="ko"?null:i.data;default:return null}}var LN={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 kv(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i==="input"?!!LN[a.type]:i==="textarea"}function Sv(a,i,l,p){cs?us?us.push(p):us=[p]:cs=p,i=Vc(i,"onChange"),0<i.length&&(l=new nc("onChange","change",null,l,p),a.push({event:l,listeners:i}))}var ko=null,So=null;function zN(a){i0(a,0)}function rc(a){var i=cr(a);if(rv(i))return a}function jv(a,i){if(a==="change")return i}var Cv=!1;if(fr){var Kd;if(fr){var Xd="oninput"in document;if(!Xd){var Nv=document.createElement("div");Nv.setAttribute("oninput","return;"),Xd=typeof Nv.oninput=="function"}Kd=Xd}else Kd=!1;Cv=Kd&&(!document.documentMode||9<document.documentMode)}function Ev(){ko&&(ko.detachEvent("onpropertychange",Tv),So=ko=null)}function Tv(a){if(a.propertyName==="value"&&rc(So)){var i=[];Sv(i,So,a,Fd(a)),dv(zN,i)}}function MN(a,i,l){a==="focusin"?(Ev(),ko=i,So=l,ko.attachEvent("onpropertychange",Tv)):a==="focusout"&&Ev()}function DN(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return rc(So)}function $N(a,i){if(a==="click")return rc(i)}function IN(a,i){if(a==="input"||a==="change")return rc(i)}function PN(a,i){return a===i&&(a!==0||1/a===1/i)||a!==a&&i!==i}var Zn=typeof Object.is=="function"?Object.is:PN;function jo(a,i){if(Zn(a,i))return!0;if(typeof a!="object"||a===null||typeof i!="object"||i===null)return!1;var l=Object.keys(a),p=Object.keys(i);if(l.length!==p.length)return!1;for(p=0;p<l.length;p++){var v=l[p];if(!Oe.call(i,v)||!Zn(a[v],i[v]))return!1}return!0}function Av(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Rv(a,i){var l=Av(a);a=0;for(var p;l;){if(l.nodeType===3){if(p=a+l.textContent.length,a<=i&&p>=i)return{node:l,offset:i-a};a=p}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Av(l)}}function _v(a,i){return a&&i?a===i?!0:a&&a.nodeType===3?!1:i&&i.nodeType===3?_v(a,i.parentNode):"contains"in a?a.contains(i):a.compareDocumentPosition?!!(a.compareDocumentPosition(i)&16):!1:!1}function Ov(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var i=Kl(a.document);i instanceof a.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)a=i.contentWindow;else break;i=Kl(a.document)}return i}function Jd(a){var i=a&&a.nodeName&&a.nodeName.toLowerCase();return i&&(i==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||i==="textarea"||a.contentEditable==="true")}var UN=fr&&"documentMode"in document&&11>=document.documentMode,ps=null,ep=null,Co=null,tp=!1;function Lv(a,i,l){var p=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;tp||ps==null||ps!==Kl(p)||(p=ps,"selectionStart"in p&&Jd(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Co&&jo(Co,p)||(Co=p,p=Vc(ep,"onSelect"),0<p.length&&(i=new nc("onSelect","select",null,i,l),a.push({event:i,listeners:p}),i.target=ps)))}function Si(a,i){var l={};return l[a.toLowerCase()]=i.toLowerCase(),l["Webkit"+a]="webkit"+i,l["Moz"+a]="moz"+i,l}var fs={animationend:Si("Animation","AnimationEnd"),animationiteration:Si("Animation","AnimationIteration"),animationstart:Si("Animation","AnimationStart"),transitionrun:Si("Transition","TransitionRun"),transitionstart:Si("Transition","TransitionStart"),transitioncancel:Si("Transition","TransitionCancel"),transitionend:Si("Transition","TransitionEnd")},np={},zv={};fr&&(zv=document.createElement("div").style,"AnimationEvent"in window||(delete fs.animationend.animation,delete fs.animationiteration.animation,delete fs.animationstart.animation),"TransitionEvent"in window||delete fs.transitionend.transition);function ji(a){if(np[a])return np[a];if(!fs[a])return a;var i=fs[a],l;for(l in i)if(i.hasOwnProperty(l)&&l in zv)return np[a]=i[l];return a}var Mv=ji("animationend"),Dv=ji("animationiteration"),$v=ji("animationstart"),BN=ji("transitionrun"),FN=ji("transitionstart"),HN=ji("transitioncancel"),Iv=ji("transitionend"),Pv=new Map,ap="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(" ");ap.push("scrollEnd");function Ra(a,i){Pv.set(a,i),pa(i,[a])}var ic=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=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(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},ga=[],hs=0,rp=0;function sc(){for(var a=hs,i=rp=hs=0;i<a;){var l=ga[i];ga[i++]=null;var p=ga[i];ga[i++]=null;var v=ga[i];ga[i++]=null;var x=ga[i];if(ga[i++]=null,p!==null&&v!==null){var C=p.pending;C===null?v.next=v:(v.next=C.next,C.next=v),p.pending=v}x!==0&&Uv(l,v,x)}}function oc(a,i,l,p){ga[hs++]=a,ga[hs++]=i,ga[hs++]=l,ga[hs++]=p,rp|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function ip(a,i,l,p){return oc(a,i,l,p),lc(a)}function Ci(a,i){return oc(a,null,null,i),lc(a)}function Uv(a,i,l){a.lanes|=l;var p=a.alternate;p!==null&&(p.lanes|=l);for(var v=!1,x=a.return;x!==null;)x.childLanes|=l,p=x.alternate,p!==null&&(p.childLanes|=l),x.tag===22&&(a=x.stateNode,a===null||a._visibility&1||(v=!0)),a=x,x=x.return;return a.tag===3?(x=a.stateNode,v&&i!==null&&(v=31-Ne(l),a=x.hiddenUpdates,p=a[v],p===null?a[v]=[i]:p.push(i),i.lane=l|536870912),x):null}function lc(a){if(50<Wo)throw Wo=0,mf=null,Error(r(185));for(var i=a.return;i!==null;)a=i,i=a.return;return a.tag===3?a.stateNode:null}var ms={};function qN(a,i,l,p){this.tag=a,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yn(a,i,l,p){return new qN(a,i,l,p)}function sp(a){return a=a.prototype,!(!a||!a.isReactComponent)}function hr(a,i){var l=a.alternate;return l===null?(l=Yn(a.tag,i,a.key,a.mode),l.elementType=a.elementType,l.type=a.type,l.stateNode=a.stateNode,l.alternate=a,a.alternate=l):(l.pendingProps=i,l.type=a.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=a.flags&65011712,l.childLanes=a.childLanes,l.lanes=a.lanes,l.child=a.child,l.memoizedProps=a.memoizedProps,l.memoizedState=a.memoizedState,l.updateQueue=a.updateQueue,i=a.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=a.sibling,l.index=a.index,l.ref=a.ref,l.refCleanup=a.refCleanup,l}function Bv(a,i){a.flags&=65011714;var l=a.alternate;return l===null?(a.childLanes=0,a.lanes=i,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=l.childLanes,a.lanes=l.lanes,a.child=l.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=l.memoizedProps,a.memoizedState=l.memoizedState,a.updateQueue=l.updateQueue,a.type=l.type,i=l.dependencies,a.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),a}function cc(a,i,l,p,v,x){var C=0;if(p=a,typeof a=="function")sp(a)&&(C=1);else if(typeof a=="string")C=YE(a,l,ne.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case M:return a=Yn(31,l,i,v),a.elementType=M,a.lanes=x,a;case j:return Ni(l.children,v,x,i);case E:C=8,v|=24;break;case S:return a=Yn(12,l,i,v|2),a.elementType=S,a.lanes=x,a;case H:return a=Yn(13,l,i,v),a.elementType=H,a.lanes=x,a;case A:return a=Yn(19,l,i,v),a.elementType=A,a.lanes=x,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case N:C=10;break e;case T:C=9;break e;case R:C=11;break e;case U:C=14;break e;case G:C=16,p=null;break e}C=29,l=Error(r(130,a===null?"null":typeof a,"")),p=null}return i=Yn(C,l,i,v),i.elementType=a,i.type=p,i.lanes=x,i}function Ni(a,i,l,p){return a=Yn(7,a,p,i),a.lanes=l,a}function op(a,i,l){return a=Yn(6,a,null,i),a.lanes=l,a}function Fv(a){var i=Yn(18,null,null,0);return i.stateNode=a,i}function lp(a,i,l){return i=Yn(4,a.children!==null?a.children:[],a.key,i),i.lanes=l,i.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},i}var Hv=new WeakMap;function va(a,i){if(typeof a=="object"&&a!==null){var l=Hv.get(a);return l!==void 0?l:(i={value:a,source:i,stack:xe(i)},Hv.set(a,i),i)}return{value:a,source:i,stack:xe(i)}}var gs=[],vs=0,uc=null,No=0,ya=[],ba=0,Gr=null,Ha=1,qa="";function mr(a,i){gs[vs++]=No,gs[vs++]=uc,uc=a,No=i}function qv(a,i,l){ya[ba++]=Ha,ya[ba++]=qa,ya[ba++]=Gr,Gr=a;var p=Ha;a=qa;var v=32-Ne(p)-1;p&=~(1<<v),l+=1;var x=32-Ne(i)+v;if(30<x){var C=v-v%5;x=(p&(1<<C)-1).toString(32),p>>=C,v-=C,Ha=1<<32-Ne(i)+v|l<<v|p,qa=x+a}else Ha=1<<x|l<<v|p,qa=a}function cp(a){a.return!==null&&(mr(a,1),qv(a,1,0))}function up(a){for(;a===uc;)uc=gs[--vs],gs[vs]=null,No=gs[--vs],gs[vs]=null;for(;a===Gr;)Gr=ya[--ba],ya[ba]=null,qa=ya[--ba],ya[ba]=null,Ha=ya[--ba],ya[ba]=null}function Gv(a,i){ya[ba++]=Ha,ya[ba++]=qa,ya[ba++]=Gr,Ha=i.id,qa=i.overflow,Gr=a}var yn=null,Lt=null,ct=!1,Vr=null,xa=!1,dp=Error(r(519));function Wr(a){var i=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Eo(va(i,a)),dp}function Vv(a){var i=a.stateNode,l=a.type,p=a.memoizedProps;switch(i[Ht]=a,i[ln]=p,l){case"dialog":at("cancel",i),at("close",i);break;case"iframe":case"object":case"embed":at("load",i);break;case"video":case"audio":for(l=0;l<Yo.length;l++)at(Yo[l],i);break;case"source":at("error",i);break;case"img":case"image":case"link":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"input":at("invalid",i),iv(i,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":at("invalid",i);break;case"textarea":at("invalid",i),ov(i,p.value,p.defaultValue,p.children)}l=p.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||p.suppressHydrationWarning===!0||c0(i.textContent,l)?(p.popover!=null&&(at("beforetoggle",i),at("toggle",i)),p.onScroll!=null&&at("scroll",i),p.onScrollEnd!=null&&at("scrollend",i),p.onClick!=null&&(i.onclick=pr),i=!0):i=!1,i||Wr(a,!0)}function Wv(a){for(yn=a.return;yn;)switch(yn.tag){case 5:case 31:case 13:xa=!1;return;case 27:case 3:xa=!0;return;default:yn=yn.return}}function ys(a){if(a!==yn)return!1;if(!ct)return Wv(a),ct=!0,!1;var i=a.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=a.type,l=!(l!=="form"&&l!=="button")||Rf(a.type,a.memoizedProps)),l=!l),l&&Lt&&Wr(a),Wv(a),i===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=y0(a)}else if(i===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(317));Lt=y0(a)}else i===27?(i=Lt,oi(a.type)?(a=Mf,Mf=null,Lt=a):Lt=i):Lt=yn?ka(a.stateNode.nextSibling):null;return!0}function Ei(){Lt=yn=null,ct=!1}function pp(){var a=Vr;return a!==null&&(Un===null?Un=a:Un.push.apply(Un,a),Vr=null),a}function Eo(a){Vr===null?Vr=[a]:Vr.push(a)}var fp=P(null),Ti=null,gr=null;function Zr(a,i,l){O(fp,i._currentValue),i._currentValue=l}function vr(a){a._currentValue=fp.current,q(fp)}function hp(a,i,l){for(;a!==null;){var p=a.alternate;if((a.childLanes&i)!==i?(a.childLanes|=i,p!==null&&(p.childLanes|=i)):p!==null&&(p.childLanes&i)!==i&&(p.childLanes|=i),a===l)break;a=a.return}}function mp(a,i,l,p){var v=a.child;for(v!==null&&(v.return=a);v!==null;){var x=v.dependencies;if(x!==null){var C=v.child;x=x.firstContext;e:for(;x!==null;){var z=x;x=v;for(var Y=0;Y<i.length;Y++)if(z.context===i[Y]){x.lanes|=l,z=x.alternate,z!==null&&(z.lanes|=l),hp(x.return,l,a),p||(C=null);break e}x=z.next}}else if(v.tag===18){if(C=v.return,C===null)throw Error(r(341));C.lanes|=l,x=C.alternate,x!==null&&(x.lanes|=l),hp(C,l,a),C=null}else C=v.child;if(C!==null)C.return=v;else for(C=v;C!==null;){if(C===a){C=null;break}if(v=C.sibling,v!==null){v.return=C.return,C=v;break}C=C.return}v=C}}function bs(a,i,l,p){a=null;for(var v=i,x=!1;v!==null;){if(!x){if((v.flags&524288)!==0)x=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var C=v.alternate;if(C===null)throw Error(r(387));if(C=C.memoizedProps,C!==null){var z=v.type;Zn(v.pendingProps.value,C.value)||(a!==null?a.push(z):a=[z])}}else if(v===be.current){if(C=v.alternate,C===null)throw Error(r(387));C.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(a!==null?a.push(el):a=[el])}v=v.return}a!==null&&mp(i,a,l,p),i.flags|=262144}function dc(a){for(a=a.firstContext;a!==null;){if(!Zn(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function Ai(a){Ti=a,gr=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function bn(a){return Zv(Ti,a)}function pc(a,i){return Ti===null&&Ai(a),Zv(a,i)}function Zv(a,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},gr===null){if(a===null)throw Error(r(308));gr=i,a.dependencies={lanes:0,firstContext:i},a.flags|=524288}else gr=gr.next=i;return l}var GN=typeof AbortController<"u"?AbortController:function(){var a=[],i=this.signal={aborted:!1,addEventListener:function(l,p){a.push(p)}};this.abort=function(){i.aborted=!0,a.forEach(function(l){return l()})}},VN=e.unstable_scheduleCallback,WN=e.unstable_NormalPriority,en={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gp(){return{controller:new GN,data:new Map,refCount:0}}function To(a){a.refCount--,a.refCount===0&&VN(WN,function(){a.controller.abort()})}var Ao=null,vp=0,xs=0,ws=null;function ZN(a,i){if(Ao===null){var l=Ao=[];vp=0,xs=wf(),ws={status:"pending",value:void 0,then:function(p){l.push(p)}}}return vp++,i.then(Yv,Yv),i}function Yv(){if(--vp===0&&Ao!==null){ws!==null&&(ws.status="fulfilled");var a=Ao;Ao=null,xs=0,ws=null;for(var i=0;i<a.length;i++)(0,a[i])()}}function YN(a,i){var l=[],p={status:"pending",value:null,reason:null,then:function(v){l.push(v)}};return a.then(function(){p.status="fulfilled",p.value=i;for(var v=0;v<l.length;v++)(0,l[v])(i)},function(v){for(p.status="rejected",p.reason=v,v=0;v<l.length;v++)(0,l[v])(void 0)}),p}var Qv=F.S;F.S=function(a,i){Lb=ut(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&ZN(a,i),Qv!==null&&Qv(a,i)};var Ri=P(null);function yp(){var a=Ri.current;return a!==null?a:Nt.pooledCache}function fc(a,i){i===null?O(Ri,Ri.current):O(Ri,i.pool)}function Kv(){var a=yp();return a===null?null:{parent:en._currentValue,pool:a}}var ks=Error(r(460)),bp=Error(r(474)),hc=Error(r(542)),mc={then:function(){}};function Xv(a){return a=a.status,a==="fulfilled"||a==="rejected"}function Jv(a,i,l){switch(l=a[l],l===void 0?a.push(i):l!==i&&(i.then(pr,pr),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,ty(a),a;default:if(typeof i.status=="string")i.then(pr,pr);else{if(a=Nt,a!==null&&100<a.shellSuspendCounter)throw Error(r(482));a=i,a.status="pending",a.then(function(p){if(i.status==="pending"){var v=i;v.status="fulfilled",v.value=p}},function(p){if(i.status==="pending"){var v=i;v.status="rejected",v.reason=p}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw a=i.reason,ty(a),a}throw Oi=i,ks}}function _i(a){try{var i=a._init;return i(a._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Oi=l,ks):l}}var Oi=null;function ey(){if(Oi===null)throw Error(r(459));var a=Oi;return Oi=null,a}function ty(a){if(a===ks||a===hc)throw Error(r(483))}var Ss=null,Ro=0;function gc(a){var i=Ro;return Ro+=1,Ss===null&&(Ss=[]),Jv(Ss,a,i)}function _o(a,i){i=i.props.ref,a.ref=i!==void 0?i:null}function vc(a,i){throw i.$$typeof===y?Error(r(525)):(a=Object.prototype.toString.call(i),Error(r(31,a==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":a)))}function ny(a){function i(te,J){if(a){var ae=te.deletions;ae===null?(te.deletions=[J],te.flags|=16):ae.push(J)}}function l(te,J){if(!a)return null;for(;J!==null;)i(te,J),J=J.sibling;return null}function p(te){for(var J=new Map;te!==null;)te.key!==null?J.set(te.key,te):J.set(te.index,te),te=te.sibling;return J}function v(te,J){return te=hr(te,J),te.index=0,te.sibling=null,te}function x(te,J,ae){return te.index=ae,a?(ae=te.alternate,ae!==null?(ae=ae.index,ae<J?(te.flags|=67108866,J):ae):(te.flags|=67108866,J)):(te.flags|=1048576,J)}function C(te){return a&&te.alternate===null&&(te.flags|=67108866),te}function z(te,J,ae,fe){return J===null||J.tag!==6?(J=op(ae,te.mode,fe),J.return=te,J):(J=v(J,ae),J.return=te,J)}function Y(te,J,ae,fe){var De=ae.type;return De===j?pe(te,J,ae.props.children,fe,ae.key):J!==null&&(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&_i(De)===J.type)?(J=v(J,ae.props),_o(J,ae),J.return=te,J):(J=cc(ae.type,ae.key,ae.props,null,te.mode,fe),_o(J,ae),J.return=te,J)}function re(te,J,ae,fe){return J===null||J.tag!==4||J.stateNode.containerInfo!==ae.containerInfo||J.stateNode.implementation!==ae.implementation?(J=lp(ae,te.mode,fe),J.return=te,J):(J=v(J,ae.children||[]),J.return=te,J)}function pe(te,J,ae,fe,De){return J===null||J.tag!==7?(J=Ni(ae,te.mode,fe,De),J.return=te,J):(J=v(J,ae),J.return=te,J)}function me(te,J,ae){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=op(""+J,te.mode,ae),J.return=te,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return ae=cc(J.type,J.key,J.props,null,te.mode,ae),_o(ae,J),ae.return=te,ae;case k:return J=lp(J,te.mode,ae),J.return=te,J;case G:return J=_i(J),me(te,J,ae)}if(D(J)||B(J))return J=Ni(J,te.mode,ae,null),J.return=te,J;if(typeof J.then=="function")return me(te,gc(J),ae);if(J.$$typeof===N)return me(te,pc(te,J),ae);vc(te,J)}return null}function se(te,J,ae,fe){var De=J!==null?J.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return De!==null?null:z(te,J,""+ae,fe);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:return ae.key===De?Y(te,J,ae,fe):null;case k:return ae.key===De?re(te,J,ae,fe):null;case G:return ae=_i(ae),se(te,J,ae,fe)}if(D(ae)||B(ae))return De!==null?null:pe(te,J,ae,fe,null);if(typeof ae.then=="function")return se(te,J,gc(ae),fe);if(ae.$$typeof===N)return se(te,J,pc(te,ae),fe);vc(te,ae)}return null}function oe(te,J,ae,fe,De){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return te=te.get(ae)||null,z(J,te,""+fe,De);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case b:return te=te.get(fe.key===null?ae:fe.key)||null,Y(J,te,fe,De);case k:return te=te.get(fe.key===null?ae:fe.key)||null,re(J,te,fe,De);case G:return fe=_i(fe),oe(te,J,ae,fe,De)}if(D(fe)||B(fe))return te=te.get(ae)||null,pe(J,te,fe,De,null);if(typeof fe.then=="function")return oe(te,J,ae,gc(fe),De);if(fe.$$typeof===N)return oe(te,J,ae,pc(J,fe),De);vc(J,fe)}return null}function Ae(te,J,ae,fe){for(var De=null,ht=null,_e=J,Ke=J=0,ot=null;_e!==null&&Ke<ae.length;Ke++){_e.index>Ke?(ot=_e,_e=null):ot=_e.sibling;var mt=se(te,_e,ae[Ke],fe);if(mt===null){_e===null&&(_e=ot);break}a&&_e&&mt.alternate===null&&i(te,_e),J=x(mt,J,Ke),ht===null?De=mt:ht.sibling=mt,ht=mt,_e=ot}if(Ke===ae.length)return l(te,_e),ct&&mr(te,Ke),De;if(_e===null){for(;Ke<ae.length;Ke++)_e=me(te,ae[Ke],fe),_e!==null&&(J=x(_e,J,Ke),ht===null?De=_e:ht.sibling=_e,ht=_e);return ct&&mr(te,Ke),De}for(_e=p(_e);Ke<ae.length;Ke++)ot=oe(_e,te,Ke,ae[Ke],fe),ot!==null&&(a&&ot.alternate!==null&&_e.delete(ot.key===null?Ke:ot.key),J=x(ot,J,Ke),ht===null?De=ot:ht.sibling=ot,ht=ot);return a&&_e.forEach(function(pi){return i(te,pi)}),ct&&mr(te,Ke),De}function Be(te,J,ae,fe){if(ae==null)throw Error(r(151));for(var De=null,ht=null,_e=J,Ke=J=0,ot=null,mt=ae.next();_e!==null&&!mt.done;Ke++,mt=ae.next()){_e.index>Ke?(ot=_e,_e=null):ot=_e.sibling;var pi=se(te,_e,mt.value,fe);if(pi===null){_e===null&&(_e=ot);break}a&&_e&&pi.alternate===null&&i(te,_e),J=x(pi,J,Ke),ht===null?De=pi:ht.sibling=pi,ht=pi,_e=ot}if(mt.done)return l(te,_e),ct&&mr(te,Ke),De;if(_e===null){for(;!mt.done;Ke++,mt=ae.next())mt=me(te,mt.value,fe),mt!==null&&(J=x(mt,J,Ke),ht===null?De=mt:ht.sibling=mt,ht=mt);return ct&&mr(te,Ke),De}for(_e=p(_e);!mt.done;Ke++,mt=ae.next())mt=oe(_e,te,Ke,mt.value,fe),mt!==null&&(a&&mt.alternate!==null&&_e.delete(mt.key===null?Ke:mt.key),J=x(mt,J,Ke),ht===null?De=mt:ht.sibling=mt,ht=mt);return a&&_e.forEach(function(sT){return i(te,sT)}),ct&&mr(te,Ke),De}function jt(te,J,ae,fe){if(typeof ae=="object"&&ae!==null&&ae.type===j&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case b:e:{for(var De=ae.key;J!==null;){if(J.key===De){if(De=ae.type,De===j){if(J.tag===7){l(te,J.sibling),fe=v(J,ae.props.children),fe.return=te,te=fe;break e}}else if(J.elementType===De||typeof De=="object"&&De!==null&&De.$$typeof===G&&_i(De)===J.type){l(te,J.sibling),fe=v(J,ae.props),_o(fe,ae),fe.return=te,te=fe;break e}l(te,J);break}else i(te,J);J=J.sibling}ae.type===j?(fe=Ni(ae.props.children,te.mode,fe,ae.key),fe.return=te,te=fe):(fe=cc(ae.type,ae.key,ae.props,null,te.mode,fe),_o(fe,ae),fe.return=te,te=fe)}return C(te);case k:e:{for(De=ae.key;J!==null;){if(J.key===De)if(J.tag===4&&J.stateNode.containerInfo===ae.containerInfo&&J.stateNode.implementation===ae.implementation){l(te,J.sibling),fe=v(J,ae.children||[]),fe.return=te,te=fe;break e}else{l(te,J);break}else i(te,J);J=J.sibling}fe=lp(ae,te.mode,fe),fe.return=te,te=fe}return C(te);case G:return ae=_i(ae),jt(te,J,ae,fe)}if(D(ae))return Ae(te,J,ae,fe);if(B(ae)){if(De=B(ae),typeof De!="function")throw Error(r(150));return ae=De.call(ae),Be(te,J,ae,fe)}if(typeof ae.then=="function")return jt(te,J,gc(ae),fe);if(ae.$$typeof===N)return jt(te,J,pc(te,ae),fe);vc(te,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint"?(ae=""+ae,J!==null&&J.tag===6?(l(te,J.sibling),fe=v(J,ae),fe.return=te,te=fe):(l(te,J),fe=op(ae,te.mode,fe),fe.return=te,te=fe),C(te)):l(te,J)}return function(te,J,ae,fe){try{Ro=0;var De=jt(te,J,ae,fe);return Ss=null,De}catch(_e){if(_e===ks||_e===hc)throw _e;var ht=Yn(29,_e,null,te.mode);return ht.lanes=fe,ht.return=te,ht}finally{}}}var Li=ny(!0),ay=ny(!1),Yr=!1;function xp(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wp(a,i){a=a.updateQueue,i.updateQueue===a&&(i.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function Qr(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Kr(a,i,l){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(vt&2)!==0){var v=p.pending;return v===null?i.next=i:(i.next=v.next,v.next=i),p.pending=i,i=lc(a),Uv(a,null,l),i}return oc(a,p,i,l),lc(a)}function Oo(a,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var p=i.lanes;p&=a.pendingLanes,l|=p,i.lanes=l,je(a,l)}}function kp(a,i){var l=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,l===p)){var v=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var C={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};x===null?v=x=C:x=x.next=C,l=l.next}while(l!==null);x===null?v=x=i:x=x.next=i}else v=x=i;l={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:x,shared:p.shared,callbacks:p.callbacks},a.updateQueue=l;return}a=l.lastBaseUpdate,a===null?l.firstBaseUpdate=i:a.next=i,l.lastBaseUpdate=i}var Sp=!1;function Lo(){if(Sp){var a=ws;if(a!==null)throw a}}function zo(a,i,l,p){Sp=!1;var v=a.updateQueue;Yr=!1;var x=v.firstBaseUpdate,C=v.lastBaseUpdate,z=v.shared.pending;if(z!==null){v.shared.pending=null;var Y=z,re=Y.next;Y.next=null,C===null?x=re:C.next=re,C=Y;var pe=a.alternate;pe!==null&&(pe=pe.updateQueue,z=pe.lastBaseUpdate,z!==C&&(z===null?pe.firstBaseUpdate=re:z.next=re,pe.lastBaseUpdate=Y))}if(x!==null){var me=v.baseState;C=0,pe=re=Y=null,z=x;do{var se=z.lane&-536870913,oe=se!==z.lane;if(oe?(st&se)===se:(p&se)===se){se!==0&&se===xs&&(Sp=!0),pe!==null&&(pe=pe.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Ae=a,Be=z;se=i;var jt=l;switch(Be.tag){case 1:if(Ae=Be.payload,typeof Ae=="function"){me=Ae.call(jt,me,se);break e}me=Ae;break e;case 3:Ae.flags=Ae.flags&-65537|128;case 0:if(Ae=Be.payload,se=typeof Ae=="function"?Ae.call(jt,me,se):Ae,se==null)break e;me=m({},me,se);break e;case 2:Yr=!0}}se=z.callback,se!==null&&(a.flags|=64,oe&&(a.flags|=8192),oe=v.callbacks,oe===null?v.callbacks=[se]:oe.push(se))}else oe={lane:se,tag:z.tag,payload:z.payload,callback:z.callback,next:null},pe===null?(re=pe=oe,Y=me):pe=pe.next=oe,C|=se;if(z=z.next,z===null){if(z=v.shared.pending,z===null)break;oe=z,z=oe.next,oe.next=null,v.lastBaseUpdate=oe,v.shared.pending=null}}while(!0);pe===null&&(Y=me),v.baseState=Y,v.firstBaseUpdate=re,v.lastBaseUpdate=pe,x===null&&(v.shared.lanes=0),ni|=C,a.lanes=C,a.memoizedState=me}}function ry(a,i){if(typeof a!="function")throw Error(r(191,a));a.call(i)}function iy(a,i){var l=a.callbacks;if(l!==null)for(a.callbacks=null,a=0;a<l.length;a++)ry(l[a],i)}var js=P(null),yc=P(0);function sy(a,i){a=Nr,O(yc,a),O(js,i),Nr=a|i.baseLanes}function jp(){O(yc,Nr),O(js,js.current)}function Cp(){Nr=yc.current,q(js),q(yc)}var Qn=P(null),wa=null;function Xr(a){var i=a.alternate;O(Qt,Qt.current&1),O(Qn,a),wa===null&&(i===null||js.current!==null||i.memoizedState!==null)&&(wa=a)}function Np(a){O(Qt,Qt.current),O(Qn,a),wa===null&&(wa=a)}function oy(a){a.tag===22?(O(Qt,Qt.current),O(Qn,a),wa===null&&(wa=a)):Jr()}function Jr(){O(Qt,Qt.current),O(Qn,Qn.current)}function Kn(a){q(Qn),wa===a&&(wa=null),q(Qt)}var Qt=P(0);function bc(a){for(var i=a;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Lf(l)||zf(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var yr=0,Ye=null,kt=null,tn=null,xc=!1,Cs=!1,zi=!1,wc=0,Mo=0,Ns=null,QN=0;function Vt(){throw Error(r(321))}function Ep(a,i){if(i===null)return!1;for(var l=0;l<i.length&&l<a.length;l++)if(!Zn(a[l],i[l]))return!1;return!0}function Tp(a,i,l,p,v,x){return yr=x,Ye=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=a===null||a.memoizedState===null?qy:Hp,zi=!1,x=l(p,v),zi=!1,Cs&&(x=cy(i,l,p,v)),ly(a),x}function ly(a){F.H=Io;var i=kt!==null&&kt.next!==null;if(yr=0,tn=kt=Ye=null,xc=!1,Mo=0,Ns=null,i)throw Error(r(300));a===null||nn||(a=a.dependencies,a!==null&&dc(a)&&(nn=!0))}function cy(a,i,l,p){Ye=a;var v=0;do{if(Cs&&(Ns=null),Mo=0,Cs=!1,25<=v)throw Error(r(301));if(v+=1,tn=kt=null,a.updateQueue!=null){var x=a.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}F.H=Gy,x=i(l,p)}while(Cs);return x}function KN(){var a=F.H,i=a.useState()[0];return i=typeof i.then=="function"?Do(i):i,a=a.useState()[0],(kt!==null?kt.memoizedState:null)!==a&&(Ye.flags|=1024),i}function Ap(){var a=wc!==0;return wc=0,a}function Rp(a,i,l){i.updateQueue=a.updateQueue,i.flags&=-2053,a.lanes&=~l}function _p(a){if(xc){for(a=a.memoizedState;a!==null;){var i=a.queue;i!==null&&(i.pending=null),a=a.next}xc=!1}yr=0,tn=kt=Ye=null,Cs=!1,Mo=wc=0,Ns=null}function Rn(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tn===null?Ye.memoizedState=tn=a:tn=tn.next=a,tn}function Kt(){if(kt===null){var a=Ye.alternate;a=a!==null?a.memoizedState:null}else a=kt.next;var i=tn===null?Ye.memoizedState:tn.next;if(i!==null)tn=i,kt=a;else{if(a===null)throw Ye.alternate===null?Error(r(467)):Error(r(310));kt=a,a={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},tn===null?Ye.memoizedState=tn=a:tn=tn.next=a}return tn}function kc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(a){var i=Mo;return Mo+=1,Ns===null&&(Ns=[]),a=Jv(Ns,a,i),i=Ye,(tn===null?i.memoizedState:tn.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?qy:Hp),a}function Sc(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Do(a);if(a.$$typeof===N)return bn(a)}throw Error(r(438,String(a)))}function Op(a){var i=null,l=Ye.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var p=Ye.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(i={data:p.data.map(function(v){return v.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=kc(),Ye.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(a),p=0;p<a;p++)l[p]=_;return i.index++,l}function br(a,i){return typeof i=="function"?i(a):i}function jc(a){var i=Kt();return Lp(i,kt,a)}function Lp(a,i,l){var p=a.queue;if(p===null)throw Error(r(311));p.lastRenderedReducer=l;var v=a.baseQueue,x=p.pending;if(x!==null){if(v!==null){var C=v.next;v.next=x.next,x.next=C}i.baseQueue=v=x,p.pending=null}if(x=a.baseState,v===null)a.memoizedState=x;else{i=v.next;var z=C=null,Y=null,re=i,pe=!1;do{var me=re.lane&-536870913;if(me!==re.lane?(st&me)===me:(yr&me)===me){var se=re.revertLane;if(se===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),me===xs&&(pe=!0);else if((yr&se)===se){re=re.next,se===xs&&(pe=!0);continue}else me={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(z=Y=me,C=x):Y=Y.next=me,Ye.lanes|=se,ni|=se;me=re.action,zi&&l(x,me),x=re.hasEagerState?re.eagerState:l(x,me)}else se={lane:me,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Y===null?(z=Y=se,C=x):Y=Y.next=se,Ye.lanes|=me,ni|=me;re=re.next}while(re!==null&&re!==i);if(Y===null?C=x:Y.next=z,!Zn(x,a.memoizedState)&&(nn=!0,pe&&(l=ws,l!==null)))throw l;a.memoizedState=x,a.baseState=C,a.baseQueue=Y,p.lastRenderedState=x}return v===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function zp(a){var i=Kt(),l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var p=l.dispatch,v=l.pending,x=i.memoizedState;if(v!==null){l.pending=null;var C=v=v.next;do x=a(x,C.action),C=C.next;while(C!==v);Zn(x,i.memoizedState)||(nn=!0),i.memoizedState=x,i.baseQueue===null&&(i.baseState=x),l.lastRenderedState=x}return[x,p]}function uy(a,i,l){var p=Ye,v=Kt(),x=ct;if(x){if(l===void 0)throw Error(r(407));l=l()}else l=i();var C=!Zn((kt||v).memoizedState,l);if(C&&(v.memoizedState=l,nn=!0),v=v.queue,$p(fy.bind(null,p,v,a),[a]),v.getSnapshot!==i||C||tn!==null&&tn.memoizedState.tag&1){if(p.flags|=2048,Es(9,{destroy:void 0},py.bind(null,p,v,l,i),null),Nt===null)throw Error(r(349));x||(yr&127)!==0||dy(p,i,l)}return l}function dy(a,i,l){a.flags|=16384,a={getSnapshot:i,value:l},i=Ye.updateQueue,i===null?(i=kc(),Ye.updateQueue=i,i.stores=[a]):(l=i.stores,l===null?i.stores=[a]:l.push(a))}function py(a,i,l,p){i.value=l,i.getSnapshot=p,hy(i)&&my(a)}function fy(a,i,l){return l(function(){hy(i)&&my(a)})}function hy(a){var i=a.getSnapshot;a=a.value;try{var l=i();return!Zn(a,l)}catch{return!0}}function my(a){var i=Ci(a,2);i!==null&&Bn(i,a,2)}function Mp(a){var i=Rn();if(typeof a=="function"){var l=a;if(a=l(),zi){et(!0);try{l()}finally{et(!1)}}}return i.memoizedState=i.baseState=a,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:a},i}function gy(a,i,l,p){return a.baseState=l,Lp(a,kt,typeof p=="function"?p:br)}function XN(a,i,l,p,v){if(Ec(a))throw Error(r(485));if(a=i.action,a!==null){var x={payload:v,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){x.listeners.push(C)}};F.T!==null?l(!0):x.isTransition=!1,p(x),l=i.pending,l===null?(x.next=i.pending=x,vy(i,x)):(x.next=l.next,i.pending=l.next=x)}}function vy(a,i){var l=i.action,p=i.payload,v=a.state;if(i.isTransition){var x=F.T,C={};F.T=C;try{var z=l(v,p),Y=F.S;Y!==null&&Y(C,z),yy(a,i,z)}catch(re){Dp(a,i,re)}finally{x!==null&&C.types!==null&&(x.types=C.types),F.T=x}}else try{x=l(v,p),yy(a,i,x)}catch(re){Dp(a,i,re)}}function yy(a,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(p){by(a,i,p)},function(p){return Dp(a,i,p)}):by(a,i,l)}function by(a,i,l){i.status="fulfilled",i.value=l,xy(i),a.state=l,i=a.pending,i!==null&&(l=i.next,l===i?a.pending=null:(l=l.next,i.next=l,vy(a,l)))}function Dp(a,i,l){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do i.status="rejected",i.reason=l,xy(i),i=i.next;while(i!==p)}a.action=null}function xy(a){a=a.listeners;for(var i=0;i<a.length;i++)(0,a[i])()}function wy(a,i){return i}function ky(a,i){if(ct){var l=Nt.formState;if(l!==null){e:{var p=Ye;if(ct){if(Lt){t:{for(var v=Lt,x=xa;v.nodeType!==8;){if(!x){v=null;break t}if(v=ka(v.nextSibling),v===null){v=null;break t}}x=v.data,v=x==="F!"||x==="F"?v:null}if(v){Lt=ka(v.nextSibling),p=v.data==="F!";break e}}Wr(p)}p=!1}p&&(i=l[0])}}return l=Rn(),l.memoizedState=l.baseState=i,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:wy,lastRenderedState:i},l.queue=p,l=By.bind(null,Ye,p),p.dispatch=l,p=Mp(!1),x=Fp.bind(null,Ye,!1,p.queue),p=Rn(),v={state:i,dispatch:null,action:a,pending:null},p.queue=v,l=XN.bind(null,Ye,v,x,l),v.dispatch=l,p.memoizedState=a,[i,l,!1]}function Sy(a){var i=Kt();return jy(i,kt,a)}function jy(a,i,l){if(i=Lp(a,i,wy)[0],a=jc(br)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var p=Do(i)}catch(C){throw C===ks?hc:C}else p=i;i=Kt();var v=i.queue,x=v.dispatch;return l!==i.memoizedState&&(Ye.flags|=2048,Es(9,{destroy:void 0},JN.bind(null,v,l),null)),[p,x,a]}function JN(a,i){a.action=i}function Cy(a){var i=Kt(),l=kt;if(l!==null)return jy(i,l,a);Kt(),i=i.memoizedState,l=Kt();var p=l.queue.dispatch;return l.memoizedState=a,[i,p,!1]}function Es(a,i,l,p){return a={tag:a,create:l,deps:p,inst:i,next:null},i=Ye.updateQueue,i===null&&(i=kc(),Ye.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=a.next=a:(p=l.next,l.next=a,a.next=p,i.lastEffect=a),a}function Ny(){return Kt().memoizedState}function Cc(a,i,l,p){var v=Rn();Ye.flags|=a,v.memoizedState=Es(1|i,{destroy:void 0},l,p===void 0?null:p)}function Nc(a,i,l,p){var v=Kt();p=p===void 0?null:p;var x=v.memoizedState.inst;kt!==null&&p!==null&&Ep(p,kt.memoizedState.deps)?v.memoizedState=Es(i,x,l,p):(Ye.flags|=a,v.memoizedState=Es(1|i,x,l,p))}function Ey(a,i){Cc(8390656,8,a,i)}function $p(a,i){Nc(2048,8,a,i)}function eE(a){Ye.flags|=4;var i=Ye.updateQueue;if(i===null)i=kc(),Ye.updateQueue=i,i.events=[a];else{var l=i.events;l===null?i.events=[a]:l.push(a)}}function Ty(a){var i=Kt().memoizedState;return eE({ref:i,nextImpl:a}),function(){if((vt&2)!==0)throw Error(r(440));return i.impl.apply(void 0,arguments)}}function Ay(a,i){return Nc(4,2,a,i)}function Ry(a,i){return Nc(4,4,a,i)}function _y(a,i){if(typeof i=="function"){a=a();var l=i(a);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return a=a(),i.current=a,function(){i.current=null}}function Oy(a,i,l){l=l!=null?l.concat([a]):null,Nc(4,4,_y.bind(null,i,a),l)}function Ip(){}function Ly(a,i){var l=Kt();i=i===void 0?null:i;var p=l.memoizedState;return i!==null&&Ep(i,p[1])?p[0]:(l.memoizedState=[a,i],a)}function zy(a,i){var l=Kt();i=i===void 0?null:i;var p=l.memoizedState;if(i!==null&&Ep(i,p[1]))return p[0];if(p=a(),zi){et(!0);try{a()}finally{et(!1)}}return l.memoizedState=[p,i],p}function Pp(a,i,l){return l===void 0||(yr&1073741824)!==0&&(st&261930)===0?a.memoizedState=i:(a.memoizedState=l,a=Mb(),Ye.lanes|=a,ni|=a,l)}function My(a,i,l,p){return Zn(l,i)?l:js.current!==null?(a=Pp(a,l,p),Zn(a,i)||(nn=!0),a):(yr&42)===0||(yr&1073741824)!==0&&(st&261930)===0?(nn=!0,a.memoizedState=l):(a=Mb(),Ye.lanes|=a,ni|=a,i)}function Dy(a,i,l,p,v){var x=V.p;V.p=x!==0&&8>x?x:8;var C=F.T,z={};F.T=z,Fp(a,!1,i,l);try{var Y=v(),re=F.S;if(re!==null&&re(z,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var pe=YN(Y,p);$o(a,i,pe,ea(a))}else $o(a,i,p,ea(a))}catch(me){$o(a,i,{then:function(){},status:"rejected",reason:me},ea())}finally{V.p=x,C!==null&&z.types!==null&&(C.types=z.types),F.T=C}}function tE(){}function Up(a,i,l,p){if(a.tag!==5)throw Error(r(476));var v=$y(a).queue;Dy(a,v,i,X,l===null?tE:function(){return Iy(a),l(p)})}function $y(a){var i=a.memoizedState;if(i!==null)return i;i={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:X},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:l},next:null},a.memoizedState=i,a=a.alternate,a!==null&&(a.memoizedState=i),i}function Iy(a){var i=$y(a);i.next===null&&(i=a.alternate.memoizedState),$o(a,i.next.queue,{},ea())}function Bp(){return bn(el)}function Py(){return Kt().memoizedState}function Uy(){return Kt().memoizedState}function nE(a){for(var i=a.return;i!==null;){switch(i.tag){case 24:case 3:var l=ea();a=Qr(l);var p=Kr(i,a,l);p!==null&&(Bn(p,i,l),Oo(p,i,l)),i={cache:gp()},a.payload=i;return}i=i.return}}function aE(a,i,l){var p=ea();l={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Ec(a)?Fy(i,l):(l=ip(a,i,l,p),l!==null&&(Bn(l,a,p),Hy(l,i,p)))}function By(a,i,l){var p=ea();$o(a,i,l,p)}function $o(a,i,l,p){var v={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Ec(a))Fy(i,v);else{var x=a.alternate;if(a.lanes===0&&(x===null||x.lanes===0)&&(x=i.lastRenderedReducer,x!==null))try{var C=i.lastRenderedState,z=x(C,l);if(v.hasEagerState=!0,v.eagerState=z,Zn(z,C))return oc(a,i,v,0),Nt===null&&sc(),!1}catch{}finally{}if(l=ip(a,i,v,p),l!==null)return Bn(l,a,p),Hy(l,i,p),!0}return!1}function Fp(a,i,l,p){if(p={lane:2,revertLane:wf(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Ec(a)){if(i)throw Error(r(479))}else i=ip(a,l,p,2),i!==null&&Bn(i,a,2)}function Ec(a){var i=a.alternate;return a===Ye||i!==null&&i===Ye}function Fy(a,i){Cs=xc=!0;var l=a.pending;l===null?i.next=i:(i.next=l.next,l.next=i),a.pending=i}function Hy(a,i,l){if((l&4194048)!==0){var p=i.lanes;p&=a.pendingLanes,l|=p,i.lanes=l,je(a,l)}}var Io={readContext:bn,use:Sc,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Io.useEffectEvent=Vt;var qy={readContext:bn,use:Sc,useCallback:function(a,i){return Rn().memoizedState=[a,i===void 0?null:i],a},useContext:bn,useEffect:Ey,useImperativeHandle:function(a,i,l){l=l!=null?l.concat([a]):null,Cc(4194308,4,_y.bind(null,i,a),l)},useLayoutEffect:function(a,i){return Cc(4194308,4,a,i)},useInsertionEffect:function(a,i){Cc(4,2,a,i)},useMemo:function(a,i){var l=Rn();i=i===void 0?null:i;var p=a();if(zi){et(!0);try{a()}finally{et(!1)}}return l.memoizedState=[p,i],p},useReducer:function(a,i,l){var p=Rn();if(l!==void 0){var v=l(i);if(zi){et(!0);try{l(i)}finally{et(!1)}}}else v=i;return p.memoizedState=p.baseState=v,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:v},p.queue=a,a=a.dispatch=aE.bind(null,Ye,a),[p.memoizedState,a]},useRef:function(a){var i=Rn();return a={current:a},i.memoizedState=a},useState:function(a){a=Mp(a);var i=a.queue,l=By.bind(null,Ye,i);return i.dispatch=l,[a.memoizedState,l]},useDebugValue:Ip,useDeferredValue:function(a,i){var l=Rn();return Pp(l,a,i)},useTransition:function(){var a=Mp(!1);return a=Dy.bind(null,Ye,a.queue,!0,!1),Rn().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,i,l){var p=Ye,v=Rn();if(ct){if(l===void 0)throw Error(r(407));l=l()}else{if(l=i(),Nt===null)throw Error(r(349));(st&127)!==0||dy(p,i,l)}v.memoizedState=l;var x={value:l,getSnapshot:i};return v.queue=x,Ey(fy.bind(null,p,x,a),[a]),p.flags|=2048,Es(9,{destroy:void 0},py.bind(null,p,x,l,i),null),l},useId:function(){var a=Rn(),i=Nt.identifierPrefix;if(ct){var l=qa,p=Ha;l=(p&~(1<<32-Ne(p)-1)).toString(32)+l,i="_"+i+"R_"+l,l=wc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=QN++,i="_"+i+"r_"+l.toString(32)+"_";return a.memoizedState=i},useHostTransitionStatus:Bp,useFormState:ky,useActionState:ky,useOptimistic:function(a){var i=Rn();i.memoizedState=i.baseState=a;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Fp.bind(null,Ye,!0,l),l.dispatch=i,[a,i]},useMemoCache:Op,useCacheRefresh:function(){return Rn().memoizedState=nE.bind(null,Ye)},useEffectEvent:function(a){var i=Rn(),l={impl:a};return i.memoizedState=l,function(){if((vt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},Hp={readContext:bn,use:Sc,useCallback:Ly,useContext:bn,useEffect:$p,useImperativeHandle:Oy,useInsertionEffect:Ay,useLayoutEffect:Ry,useMemo:zy,useReducer:jc,useRef:Ny,useState:function(){return jc(br)},useDebugValue:Ip,useDeferredValue:function(a,i){var l=Kt();return My(l,kt.memoizedState,a,i)},useTransition:function(){var a=jc(br)[0],i=Kt().memoizedState;return[typeof a=="boolean"?a:Do(a),i]},useSyncExternalStore:uy,useId:Py,useHostTransitionStatus:Bp,useFormState:Sy,useActionState:Sy,useOptimistic:function(a,i){var l=Kt();return gy(l,kt,a,i)},useMemoCache:Op,useCacheRefresh:Uy};Hp.useEffectEvent=Ty;var Gy={readContext:bn,use:Sc,useCallback:Ly,useContext:bn,useEffect:$p,useImperativeHandle:Oy,useInsertionEffect:Ay,useLayoutEffect:Ry,useMemo:zy,useReducer:zp,useRef:Ny,useState:function(){return zp(br)},useDebugValue:Ip,useDeferredValue:function(a,i){var l=Kt();return kt===null?Pp(l,a,i):My(l,kt.memoizedState,a,i)},useTransition:function(){var a=zp(br)[0],i=Kt().memoizedState;return[typeof a=="boolean"?a:Do(a),i]},useSyncExternalStore:uy,useId:Py,useHostTransitionStatus:Bp,useFormState:Cy,useActionState:Cy,useOptimistic:function(a,i){var l=Kt();return kt!==null?gy(l,kt,a,i):(l.baseState=a,[a,l.queue.dispatch])},useMemoCache:Op,useCacheRefresh:Uy};Gy.useEffectEvent=Ty;function qp(a,i,l,p){i=a.memoizedState,l=l(p,i),l=l==null?i:m({},i,l),a.memoizedState=l,a.lanes===0&&(a.updateQueue.baseState=l)}var Gp={enqueueSetState:function(a,i,l){a=a._reactInternals;var p=ea(),v=Qr(p);v.payload=i,l!=null&&(v.callback=l),i=Kr(a,v,p),i!==null&&(Bn(i,a,p),Oo(i,a,p))},enqueueReplaceState:function(a,i,l){a=a._reactInternals;var p=ea(),v=Qr(p);v.tag=1,v.payload=i,l!=null&&(v.callback=l),i=Kr(a,v,p),i!==null&&(Bn(i,a,p),Oo(i,a,p))},enqueueForceUpdate:function(a,i){a=a._reactInternals;var l=ea(),p=Qr(l);p.tag=2,i!=null&&(p.callback=i),i=Kr(a,p,l),i!==null&&(Bn(i,a,l),Oo(i,a,l))}};function Vy(a,i,l,p,v,x,C){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,x,C):i.prototype&&i.prototype.isPureReactComponent?!jo(l,p)||!jo(v,x):!0}function Wy(a,i,l,p){a=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,p),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,p),i.state!==a&&Gp.enqueueReplaceState(i,i.state,null)}function Mi(a,i){var l=i;if("ref"in i){l={};for(var p in i)p!=="ref"&&(l[p]=i[p])}if(a=a.defaultProps){l===i&&(l=m({},l));for(var v in a)l[v]===void 0&&(l[v]=a[v])}return l}function Zy(a){ic(a)}function Yy(a){console.error(a)}function Qy(a){ic(a)}function Tc(a,i){try{var l=a.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(p){setTimeout(function(){throw p})}}function Ky(a,i,l){try{var p=a.onCaughtError;p(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Vp(a,i,l){return l=Qr(l),l.tag=3,l.payload={element:null},l.callback=function(){Tc(a,i)},l}function Xy(a){return a=Qr(a),a.tag=3,a}function Jy(a,i,l,p){var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var x=p.value;a.payload=function(){return v(x)},a.callback=function(){Ky(i,l,p)}}var C=l.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(a.callback=function(){Ky(i,l,p),typeof v!="function"&&(ai===null?ai=new Set([this]):ai.add(this));var z=p.stack;this.componentDidCatch(p.value,{componentStack:z!==null?z:""})})}function rE(a,i,l,p,v){if(l.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(i=l.alternate,i!==null&&bs(i,l,v,!0),l=Qn.current,l!==null){switch(l.tag){case 31:case 13:return wa===null?Uc():l.alternate===null&&Wt===0&&(Wt=3),l.flags&=-257,l.flags|=65536,l.lanes=v,p===mc?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([p]):i.add(p),yf(a,p,v)),!1;case 22:return l.flags|=65536,p===mc?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([p])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([p]):l.add(p)),yf(a,p,v)),!1}throw Error(r(435,l.tag))}return yf(a,p,v),Uc(),!1}if(ct)return i=Qn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=v,p!==dp&&(a=Error(r(422),{cause:p}),Eo(va(a,l)))):(p!==dp&&(i=Error(r(423),{cause:p}),Eo(va(i,l))),a=a.current.alternate,a.flags|=65536,v&=-v,a.lanes|=v,p=va(p,l),v=Vp(a.stateNode,p,v),kp(a,v),Wt!==4&&(Wt=2)),!1;var x=Error(r(520),{cause:p});if(x=va(x,l),Vo===null?Vo=[x]:Vo.push(x),Wt!==4&&(Wt=2),i===null)return!0;p=va(p,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,a=v&-v,l.lanes|=a,a=Vp(l.stateNode,p,a),kp(l,a),!1;case 1:if(i=l.type,x=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(ai===null||!ai.has(x))))return l.flags|=65536,v&=-v,l.lanes|=v,v=Xy(v),Jy(v,a,l,p),kp(l,v),!1}l=l.return}while(l!==null);return!1}var Wp=Error(r(461)),nn=!1;function xn(a,i,l,p){i.child=a===null?ay(i,null,l,p):Li(i,a.child,l,p)}function eb(a,i,l,p,v){l=l.render;var x=i.ref;if("ref"in p){var C={};for(var z in p)z!=="ref"&&(C[z]=p[z])}else C=p;return Ai(i),p=Tp(a,i,l,C,x,v),z=Ap(),a!==null&&!nn?(Rp(a,i,v),xr(a,i,v)):(ct&&z&&cp(i),i.flags|=1,xn(a,i,p,v),i.child)}function tb(a,i,l,p,v){if(a===null){var x=l.type;return typeof x=="function"&&!sp(x)&&x.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=x,nb(a,i,x,p,v)):(a=cc(l.type,null,p,i,i.mode,v),a.ref=i.ref,a.return=i,i.child=a)}if(x=a.child,!tf(a,v)){var C=x.memoizedProps;if(l=l.compare,l=l!==null?l:jo,l(C,p)&&a.ref===i.ref)return xr(a,i,v)}return i.flags|=1,a=hr(x,p),a.ref=i.ref,a.return=i,i.child=a}function nb(a,i,l,p,v){if(a!==null){var x=a.memoizedProps;if(jo(x,p)&&a.ref===i.ref)if(nn=!1,i.pendingProps=p=x,tf(a,v))(a.flags&131072)!==0&&(nn=!0);else return i.lanes=a.lanes,xr(a,i,v)}return Zp(a,i,l,p,v)}function ab(a,i,l,p){var v=p.children,x=a!==null?a.memoizedState:null;if(a===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((i.flags&128)!==0){if(x=x!==null?x.baseLanes|l:l,a!==null){for(p=i.child=a.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~x}else p=0,i.child=null;return rb(a,i,x,l,p)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},a!==null&&fc(i,x!==null?x.cachePool:null),x!==null?sy(i,x):jp(),oy(i);else return p=i.lanes=536870912,rb(a,i,x!==null?x.baseLanes|l:l,l,p)}else x!==null?(fc(i,x.cachePool),sy(i,x),Jr(),i.memoizedState=null):(a!==null&&fc(i,null),jp(),Jr());return xn(a,i,v,l),i.child}function Po(a,i){return a!==null&&a.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function rb(a,i,l,p,v){var x=yp();return x=x===null?null:{parent:en._currentValue,pool:x},i.memoizedState={baseLanes:l,cachePool:x},a!==null&&fc(i,null),jp(),oy(i),a!==null&&bs(a,i,p,!0),i.childLanes=v,null}function Ac(a,i){return i=_c({mode:i.mode,children:i.children},a.mode),i.ref=a.ref,a.child=i,i.return=a,i}function ib(a,i,l){return Li(i,a.child,null,l),a=Ac(i,i.pendingProps),a.flags|=2,Kn(i),i.memoizedState=null,a}function iE(a,i,l){var p=i.pendingProps,v=(i.flags&128)!==0;if(i.flags&=-129,a===null){if(ct){if(p.mode==="hidden")return a=Ac(i,p),i.lanes=536870912,Po(null,a);if(Np(i),(a=Lt)?(a=v0(a,xa),a=a!==null&&a.data==="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Gr!==null?{id:Ha,overflow:qa}:null,retryLane:536870912,hydrationErrors:null},l=Fv(a),l.return=i,i.child=l,yn=i,Lt=null)):a=null,a===null)throw Wr(i);return i.lanes=536870912,null}return Ac(i,p)}var x=a.memoizedState;if(x!==null){var C=x.dehydrated;if(Np(i),v)if(i.flags&256)i.flags&=-257,i=ib(a,i,l);else if(i.memoizedState!==null)i.child=a.child,i.flags|=128,i=null;else throw Error(r(558));else if(nn||bs(a,i,l,!1),v=(l&a.childLanes)!==0,nn||v){if(p=Nt,p!==null&&(C=Te(p,l),C!==0&&C!==x.retryLane))throw x.retryLane=C,Ci(a,C),Bn(p,a,C),Wp;Uc(),i=ib(a,i,l)}else a=x.treeContext,Lt=ka(C.nextSibling),yn=i,ct=!0,Vr=null,xa=!1,a!==null&&Gv(i,a),i=Ac(i,p),i.flags|=4096;return i}return a=hr(a.child,{mode:p.mode,children:p.children}),a.ref=i.ref,i.child=a,a.return=i,a}function Rc(a,i){var l=i.ref;if(l===null)a!==null&&a.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(a===null||a.ref!==l)&&(i.flags|=4194816)}}function Zp(a,i,l,p,v){return Ai(i),l=Tp(a,i,l,p,void 0,v),p=Ap(),a!==null&&!nn?(Rp(a,i,v),xr(a,i,v)):(ct&&p&&cp(i),i.flags|=1,xn(a,i,l,v),i.child)}function sb(a,i,l,p,v,x){return Ai(i),i.updateQueue=null,l=cy(i,p,l,v),ly(a),p=Ap(),a!==null&&!nn?(Rp(a,i,x),xr(a,i,x)):(ct&&p&&cp(i),i.flags|=1,xn(a,i,l,x),i.child)}function ob(a,i,l,p,v){if(Ai(i),i.stateNode===null){var x=ms,C=l.contextType;typeof C=="object"&&C!==null&&(x=bn(C)),x=new l(p,x),i.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Gp,i.stateNode=x,x._reactInternals=i,x=i.stateNode,x.props=p,x.state=i.memoizedState,x.refs={},xp(i),C=l.contextType,x.context=typeof C=="object"&&C!==null?bn(C):ms,x.state=i.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(qp(i,l,C,p),x.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(C=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),C!==x.state&&Gp.enqueueReplaceState(x,x.state,null),zo(i,p,x,v),Lo(),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!0}else if(a===null){x=i.stateNode;var z=i.memoizedProps,Y=Mi(l,z);x.props=Y;var re=x.context,pe=l.contextType;C=ms,typeof pe=="object"&&pe!==null&&(C=bn(pe));var me=l.getDerivedStateFromProps;pe=typeof me=="function"||typeof x.getSnapshotBeforeUpdate=="function",z=i.pendingProps!==z,pe||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(z||re!==C)&&Wy(i,x,p,C),Yr=!1;var se=i.memoizedState;x.state=se,zo(i,p,x,v),Lo(),re=i.memoizedState,z||se!==re||Yr?(typeof me=="function"&&(qp(i,l,me,p),re=i.memoizedState),(Y=Yr||Vy(i,l,Y,p,se,re,C))?(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"&&(i.flags|=4194308)):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=p,i.memoizedState=re),x.props=p,x.state=re,x.context=C,p=Y):(typeof x.componentDidMount=="function"&&(i.flags|=4194308),p=!1)}else{x=i.stateNode,wp(a,i),C=i.memoizedProps,pe=Mi(l,C),x.props=pe,me=i.pendingProps,se=x.context,re=l.contextType,Y=ms,typeof re=="object"&&re!==null&&(Y=bn(re)),z=l.getDerivedStateFromProps,(re=typeof z=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C!==me||se!==Y)&&Wy(i,x,p,Y),Yr=!1,se=i.memoizedState,x.state=se,zo(i,p,x,v),Lo();var oe=i.memoizedState;C!==me||se!==oe||Yr||a!==null&&a.dependencies!==null&&dc(a.dependencies)?(typeof z=="function"&&(qp(i,l,z,p),oe=i.memoizedState),(pe=Yr||Vy(i,l,pe,p,se,oe,Y)||a!==null&&a.dependencies!==null&&dc(a.dependencies))?(re||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(p,oe,Y),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(p,oe,Y)),typeof x.componentDidUpdate=="function"&&(i.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof x.componentDidUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),i.memoizedProps=p,i.memoizedState=oe),x.props=p,x.state=oe,x.context=Y,p=pe):(typeof x.componentDidUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===a.memoizedProps&&se===a.memoizedState||(i.flags|=1024),p=!1)}return x=p,Rc(a,i),p=(i.flags&128)!==0,x||p?(x=i.stateNode,l=p&&typeof l.getDerivedStateFromError!="function"?null:x.render(),i.flags|=1,a!==null&&p?(i.child=Li(i,a.child,null,v),i.child=Li(i,null,l,v)):xn(a,i,l,v),i.memoizedState=x.state,a=i.child):a=xr(a,i,v),a}function lb(a,i,l,p){return Ei(),i.flags|=256,xn(a,i,l,p),i.child}var Yp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qp(a){return{baseLanes:a,cachePool:Kv()}}function Kp(a,i,l){return a=a!==null?a.childLanes&~l:0,i&&(a|=Jn),a}function cb(a,i,l){var p=i.pendingProps,v=!1,x=(i.flags&128)!==0,C;if((C=x)||(C=a!==null&&a.memoizedState===null?!1:(Qt.current&2)!==0),C&&(v=!0,i.flags&=-129),C=(i.flags&32)!==0,i.flags&=-33,a===null){if(ct){if(v?Xr(i):Jr(),(a=Lt)?(a=v0(a,xa),a=a!==null&&a.data!=="&"?a:null,a!==null&&(i.memoizedState={dehydrated:a,treeContext:Gr!==null?{id:Ha,overflow:qa}:null,retryLane:536870912,hydrationErrors:null},l=Fv(a),l.return=i,i.child=l,yn=i,Lt=null)):a=null,a===null)throw Wr(i);return zf(a)?i.lanes=32:i.lanes=536870912,null}var z=p.children;return p=p.fallback,v?(Jr(),v=i.mode,z=_c({mode:"hidden",children:z},v),p=Ni(p,v,l,null),z.return=i,p.return=i,z.sibling=p,i.child=z,p=i.child,p.memoizedState=Qp(l),p.childLanes=Kp(a,C,l),i.memoizedState=Yp,Po(null,p)):(Xr(i),Xp(i,z))}var Y=a.memoizedState;if(Y!==null&&(z=Y.dehydrated,z!==null)){if(x)i.flags&256?(Xr(i),i.flags&=-257,i=Jp(a,i,l)):i.memoizedState!==null?(Jr(),i.child=a.child,i.flags|=128,i=null):(Jr(),z=p.fallback,v=i.mode,p=_c({mode:"visible",children:p.children},v),z=Ni(z,v,l,null),z.flags|=2,p.return=i,z.return=i,p.sibling=z,i.child=p,Li(i,a.child,null,l),p=i.child,p.memoizedState=Qp(l),p.childLanes=Kp(a,C,l),i.memoizedState=Yp,i=Po(null,p));else if(Xr(i),zf(z)){if(C=z.nextSibling&&z.nextSibling.dataset,C)var re=C.dgst;C=re,p=Error(r(419)),p.stack="",p.digest=C,Eo({value:p,source:null,stack:null}),i=Jp(a,i,l)}else if(nn||bs(a,i,l,!1),C=(l&a.childLanes)!==0,nn||C){if(C=Nt,C!==null&&(p=Te(C,l),p!==0&&p!==Y.retryLane))throw Y.retryLane=p,Ci(a,p),Bn(C,a,p),Wp;Lf(z)||Uc(),i=Jp(a,i,l)}else Lf(z)?(i.flags|=192,i.child=a.child,i=null):(a=Y.treeContext,Lt=ka(z.nextSibling),yn=i,ct=!0,Vr=null,xa=!1,a!==null&&Gv(i,a),i=Xp(i,p.children),i.flags|=4096);return i}return v?(Jr(),z=p.fallback,v=i.mode,Y=a.child,re=Y.sibling,p=hr(Y,{mode:"hidden",children:p.children}),p.subtreeFlags=Y.subtreeFlags&65011712,re!==null?z=hr(re,z):(z=Ni(z,v,l,null),z.flags|=2),z.return=i,p.return=i,p.sibling=z,i.child=p,Po(null,p),p=i.child,z=a.child.memoizedState,z===null?z=Qp(l):(v=z.cachePool,v!==null?(Y=en._currentValue,v=v.parent!==Y?{parent:Y,pool:Y}:v):v=Kv(),z={baseLanes:z.baseLanes|l,cachePool:v}),p.memoizedState=z,p.childLanes=Kp(a,C,l),i.memoizedState=Yp,Po(a.child,p)):(Xr(i),l=a.child,a=l.sibling,l=hr(l,{mode:"visible",children:p.children}),l.return=i,l.sibling=null,a!==null&&(C=i.deletions,C===null?(i.deletions=[a],i.flags|=16):C.push(a)),i.child=l,i.memoizedState=null,l)}function Xp(a,i){return i=_c({mode:"visible",children:i},a.mode),i.return=a,a.child=i}function _c(a,i){return a=Yn(22,a,null,i),a.lanes=0,a}function Jp(a,i,l){return Li(i,a.child,null,l),a=Xp(i,i.pendingProps.children),a.flags|=2,i.memoizedState=null,a}function ub(a,i,l){a.lanes|=i;var p=a.alternate;p!==null&&(p.lanes|=i),hp(a.return,i,l)}function ef(a,i,l,p,v,x){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:p,tail:l,tailMode:v,treeForkCount:x}:(C.isBackwards=i,C.rendering=null,C.renderingStartTime=0,C.last=p,C.tail=l,C.tailMode=v,C.treeForkCount=x)}function db(a,i,l){var p=i.pendingProps,v=p.revealOrder,x=p.tail;p=p.children;var C=Qt.current,z=(C&2)!==0;if(z?(C=C&1|2,i.flags|=128):C&=1,O(Qt,C),xn(a,i,p,l),p=ct?No:0,!z&&a!==null&&(a.flags&128)!==0)e:for(a=i.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&ub(a,l,i);else if(a.tag===19)ub(a,l,i);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(v){case"forwards":for(l=i.child,v=null;l!==null;)a=l.alternate,a!==null&&bc(a)===null&&(v=l),l=l.sibling;l=v,l===null?(v=i.child,i.child=null):(v=l.sibling,l.sibling=null),ef(i,!1,v,l,x,p);break;case"backwards":case"unstable_legacy-backwards":for(l=null,v=i.child,i.child=null;v!==null;){if(a=v.alternate,a!==null&&bc(a)===null){i.child=v;break}a=v.sibling,v.sibling=l,l=v,v=a}ef(i,!0,l,null,x,p);break;case"together":ef(i,!1,null,null,void 0,p);break;default:i.memoizedState=null}return i.child}function xr(a,i,l){if(a!==null&&(i.dependencies=a.dependencies),ni|=i.lanes,(l&i.childLanes)===0)if(a!==null){if(bs(a,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(a!==null&&i.child!==a.child)throw Error(r(153));if(i.child!==null){for(a=i.child,l=hr(a,a.pendingProps),i.child=l,l.return=i;a.sibling!==null;)a=a.sibling,l=l.sibling=hr(a,a.pendingProps),l.return=i;l.sibling=null}return i.child}function tf(a,i){return(a.lanes&i)!==0?!0:(a=a.dependencies,!!(a!==null&&dc(a)))}function sE(a,i,l){switch(i.tag){case 3:Re(i,i.stateNode.containerInfo),Zr(i,en,a.memoizedState.cache),Ei();break;case 27:case 5:Ie(i);break;case 4:Re(i,i.stateNode.containerInfo);break;case 10:Zr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,Np(i),null;break;case 13:var p=i.memoizedState;if(p!==null)return p.dehydrated!==null?(Xr(i),i.flags|=128,null):(l&i.child.childLanes)!==0?cb(a,i,l):(Xr(i),a=xr(a,i,l),a!==null?a.sibling:null);Xr(i);break;case 19:var v=(a.flags&128)!==0;if(p=(l&i.childLanes)!==0,p||(bs(a,i,l,!1),p=(l&i.childLanes)!==0),v){if(p)return db(a,i,l);i.flags|=128}if(v=i.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),O(Qt,Qt.current),p)break;return null;case 22:return i.lanes=0,ab(a,i,l,i.pendingProps);case 24:Zr(i,en,a.memoizedState.cache)}return xr(a,i,l)}function pb(a,i,l){if(a!==null)if(a.memoizedProps!==i.pendingProps)nn=!0;else{if(!tf(a,l)&&(i.flags&128)===0)return nn=!1,sE(a,i,l);nn=(a.flags&131072)!==0}else nn=!1,ct&&(i.flags&1048576)!==0&&qv(i,No,i.index);switch(i.lanes=0,i.tag){case 16:e:{var p=i.pendingProps;if(a=_i(i.elementType),i.type=a,typeof a=="function")sp(a)?(p=Mi(a,p),i.tag=1,i=ob(null,i,a,p,l)):(i.tag=0,i=Zp(null,i,a,p,l));else{if(a!=null){var v=a.$$typeof;if(v===R){i.tag=11,i=eb(null,i,a,p,l);break e}else if(v===U){i.tag=14,i=tb(null,i,a,p,l);break e}}throw i=$(a)||a,Error(r(306,i,""))}}return i;case 0:return Zp(a,i,i.type,i.pendingProps,l);case 1:return p=i.type,v=Mi(p,i.pendingProps),ob(a,i,p,v,l);case 3:e:{if(Re(i,i.stateNode.containerInfo),a===null)throw Error(r(387));p=i.pendingProps;var x=i.memoizedState;v=x.element,wp(a,i),zo(i,p,null,l);var C=i.memoizedState;if(p=C.cache,Zr(i,en,p),p!==x.cache&&mp(i,[en],l,!0),Lo(),p=C.element,x.isDehydrated)if(x={element:p,isDehydrated:!1,cache:C.cache},i.updateQueue.baseState=x,i.memoizedState=x,i.flags&256){i=lb(a,i,p,l);break e}else if(p!==v){v=va(Error(r(424)),i),Eo(v),i=lb(a,i,p,l);break e}else{switch(a=i.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(Lt=ka(a.firstChild),yn=i,ct=!0,Vr=null,xa=!0,l=ay(i,null,p,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ei(),p===v){i=xr(a,i,l);break e}xn(a,i,p,l)}i=i.child}return i;case 26:return Rc(a,i),a===null?(l=S0(i.type,null,i.pendingProps,null))?i.memoizedState=l:ct||(l=i.type,a=i.pendingProps,p=Wc(le.current).createElement(l),p[Ht]=i,p[ln]=a,wn(p,l,a),Ot(p),i.stateNode=p):i.memoizedState=S0(i.type,a.memoizedProps,i.pendingProps,a.memoizedState),null;case 27:return Ie(i),a===null&&ct&&(p=i.stateNode=x0(i.type,i.pendingProps,le.current),yn=i,xa=!0,v=Lt,oi(i.type)?(Mf=v,Lt=ka(p.firstChild)):Lt=v),xn(a,i,i.pendingProps.children,l),Rc(a,i),a===null&&(i.flags|=4194304),i.child;case 5:return a===null&&ct&&((v=p=Lt)&&(p=DE(p,i.type,i.pendingProps,xa),p!==null?(i.stateNode=p,yn=i,Lt=ka(p.firstChild),xa=!1,v=!0):v=!1),v||Wr(i)),Ie(i),v=i.type,x=i.pendingProps,C=a!==null?a.memoizedProps:null,p=x.children,Rf(v,x)?p=null:C!==null&&Rf(v,C)&&(i.flags|=32),i.memoizedState!==null&&(v=Tp(a,i,KN,null,null,l),el._currentValue=v),Rc(a,i),xn(a,i,p,l),i.child;case 6:return a===null&&ct&&((a=l=Lt)&&(l=$E(l,i.pendingProps,xa),l!==null?(i.stateNode=l,yn=i,Lt=null,a=!0):a=!1),a||Wr(i)),null;case 13:return cb(a,i,l);case 4:return Re(i,i.stateNode.containerInfo),p=i.pendingProps,a===null?i.child=Li(i,null,p,l):xn(a,i,p,l),i.child;case 11:return eb(a,i,i.type,i.pendingProps,l);case 7:return xn(a,i,i.pendingProps,l),i.child;case 8:return xn(a,i,i.pendingProps.children,l),i.child;case 12:return xn(a,i,i.pendingProps.children,l),i.child;case 10:return p=i.pendingProps,Zr(i,i.type,p.value),xn(a,i,p.children,l),i.child;case 9:return v=i.type._context,p=i.pendingProps.children,Ai(i),v=bn(v),p=p(v),i.flags|=1,xn(a,i,p,l),i.child;case 14:return tb(a,i,i.type,i.pendingProps,l);case 15:return nb(a,i,i.type,i.pendingProps,l);case 19:return db(a,i,l);case 31:return iE(a,i,l);case 22:return ab(a,i,l,i.pendingProps);case 24:return Ai(i),p=bn(en),a===null?(v=yp(),v===null&&(v=Nt,x=gp(),v.pooledCache=x,x.refCount++,x!==null&&(v.pooledCacheLanes|=l),v=x),i.memoizedState={parent:p,cache:v},xp(i),Zr(i,en,v)):((a.lanes&l)!==0&&(wp(a,i),zo(i,null,null,l),Lo()),v=a.memoizedState,x=i.memoizedState,v.parent!==p?(v={parent:p,cache:p},i.memoizedState=v,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=v),Zr(i,en,p)):(p=x.cache,Zr(i,en,p),p!==v.cache&&mp(i,[en],l,!0))),xn(a,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(r(156,i.tag))}function wr(a){a.flags|=4}function nf(a,i,l,p,v){if((i=(a.mode&32)!==0)&&(i=!1),i){if(a.flags|=16777216,(v&335544128)===v)if(a.stateNode.complete)a.flags|=8192;else if(Pb())a.flags|=8192;else throw Oi=mc,bp}else a.flags&=-16777217}function fb(a,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!T0(i))if(Pb())a.flags|=8192;else throw Oi=mc,bp}function Oc(a,i){i!==null&&(a.flags|=4),a.flags&16384&&(i=a.tag!==22?Fr():536870912,a.lanes|=i,_s|=i)}function Uo(a,i){if(!ct)switch(a.tailMode){case"hidden":i=a.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?a.tail=null:l.sibling=null;break;case"collapsed":l=a.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?i||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function zt(a){var i=a.alternate!==null&&a.alternate.child===a.child,l=0,p=0;if(i)for(var v=a.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=a,v=v.sibling;else for(v=a.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=a,v=v.sibling;return a.subtreeFlags|=p,a.childLanes=l,i}function oE(a,i,l){var p=i.pendingProps;switch(up(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zt(i),null;case 1:return zt(i),null;case 3:return l=i.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),i.memoizedState.cache!==p&&(i.flags|=2048),vr(en),Ee(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(a===null||a.child===null)&&(ys(i)?wr(i):a===null||a.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,pp())),zt(i),null;case 26:var v=i.type,x=i.memoizedState;return a===null?(wr(i),x!==null?(zt(i),fb(i,x)):(zt(i),nf(i,v,null,p,l))):x?x!==a.memoizedState?(wr(i),zt(i),fb(i,x)):(zt(i),i.flags&=-16777217):(a=a.memoizedProps,a!==p&&wr(i),zt(i),nf(i,v,a,p,l)),null;case 27:if(Ve(i),l=le.current,v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&wr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return zt(i),null}a=ne.current,ys(i)?Vv(i):(a=x0(v,p,l),i.stateNode=a,wr(i))}return zt(i),null;case 5:if(Ve(i),v=i.type,a!==null&&i.stateNode!=null)a.memoizedProps!==p&&wr(i);else{if(!p){if(i.stateNode===null)throw Error(r(166));return zt(i),null}if(x=ne.current,ys(i))Vv(i);else{var C=Wc(le.current);switch(x){case 1:x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":x=C.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":x=C.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":x=C.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof p.is=="string"?C.createElement("select",{is:p.is}):C.createElement("select"),p.multiple?x.multiple=!0:p.size&&(x.size=p.size);break;default:x=typeof p.is=="string"?C.createElement(v,{is:p.is}):C.createElement(v)}}x[Ht]=i,x[ln]=p;e:for(C=i.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===i)break e;for(;C.sibling===null;){if(C.return===null||C.return===i)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}i.stateNode=x;e:switch(wn(x,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&wr(i)}}return zt(i),nf(i,i.type,a===null?null:a.memoizedProps,i.pendingProps,l),null;case 6:if(a&&i.stateNode!=null)a.memoizedProps!==p&&wr(i);else{if(typeof p!="string"&&i.stateNode===null)throw Error(r(166));if(a=le.current,ys(i)){if(a=i.stateNode,l=i.memoizedProps,p=null,v=yn,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}a[Ht]=i,a=!!(a.nodeValue===l||p!==null&&p.suppressHydrationWarning===!0||c0(a.nodeValue,l)),a||Wr(i,!0)}else a=Wc(a).createTextNode(p),a[Ht]=i,i.stateNode=a}return zt(i),null;case 31:if(l=i.memoizedState,a===null||a.memoizedState!==null){if(p=ys(i),l!==null){if(a===null){if(!p)throw Error(r(318));if(a=i.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(r(557));a[Ht]=i}else Ei(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;zt(i),a=!1}else l=pp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=l),a=!0;if(!a)return i.flags&256?(Kn(i),i):(Kn(i),null);if((i.flags&128)!==0)throw Error(r(558))}return zt(i),null;case 13:if(p=i.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(v=ys(i),p!==null&&p.dehydrated!==null){if(a===null){if(!v)throw Error(r(318));if(v=i.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[Ht]=i}else Ei(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;zt(i),v=!1}else v=pp(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=v),v=!0;if(!v)return i.flags&256?(Kn(i),i):(Kn(i),null)}return Kn(i),(i.flags&128)!==0?(i.lanes=l,i):(l=p!==null,a=a!==null&&a.memoizedState!==null,l&&(p=i.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),x=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(x=p.memoizedState.cachePool.pool),x!==v&&(p.flags|=2048)),l!==a&&l&&(i.child.flags|=8192),Oc(i,i.updateQueue),zt(i),null);case 4:return Ee(),a===null&&Cf(i.stateNode.containerInfo),zt(i),null;case 10:return vr(i.type),zt(i),null;case 19:if(q(Qt),p=i.memoizedState,p===null)return zt(i),null;if(v=(i.flags&128)!==0,x=p.rendering,x===null)if(v)Uo(p,!1);else{if(Wt!==0||a!==null&&(a.flags&128)!==0)for(a=i.child;a!==null;){if(x=bc(a),x!==null){for(i.flags|=128,Uo(p,!1),a=x.updateQueue,i.updateQueue=a,Oc(i,a),i.subtreeFlags=0,a=l,l=i.child;l!==null;)Bv(l,a),l=l.sibling;return O(Qt,Qt.current&1|2),ct&&mr(i,p.treeForkCount),i.child}a=a.sibling}p.tail!==null&&ut()>$c&&(i.flags|=128,v=!0,Uo(p,!1),i.lanes=4194304)}else{if(!v)if(a=bc(x),a!==null){if(i.flags|=128,v=!0,a=a.updateQueue,i.updateQueue=a,Oc(i,a),Uo(p,!0),p.tail===null&&p.tailMode==="hidden"&&!x.alternate&&!ct)return zt(i),null}else 2*ut()-p.renderingStartTime>$c&&l!==536870912&&(i.flags|=128,v=!0,Uo(p,!1),i.lanes=4194304);p.isBackwards?(x.sibling=i.child,i.child=x):(a=p.last,a!==null?a.sibling=x:i.child=x,p.last=x)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=ut(),a.sibling=null,l=Qt.current,O(Qt,v?l&1|2:l&1),ct&&mr(i,p.treeForkCount),a):(zt(i),null);case 22:case 23:return Kn(i),Cp(),p=i.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(i.flags|=8192):p&&(i.flags|=8192),p?(l&536870912)!==0&&(i.flags&128)===0&&(zt(i),i.subtreeFlags&6&&(i.flags|=8192)):zt(i),l=i.updateQueue,l!==null&&Oc(i,l.retryQueue),l=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),p=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(p=i.memoizedState.cachePool.pool),p!==l&&(i.flags|=2048),a!==null&&q(Ri),null;case 24:return l=null,a!==null&&(l=a.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),vr(en),zt(i),null;case 25:return null;case 30:return null}throw Error(r(156,i.tag))}function lE(a,i){switch(up(i),i.tag){case 1:return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 3:return vr(en),Ee(),a=i.flags,(a&65536)!==0&&(a&128)===0?(i.flags=a&-65537|128,i):null;case 26:case 27:case 5:return Ve(i),null;case 31:if(i.memoizedState!==null){if(Kn(i),i.alternate===null)throw Error(r(340));Ei()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 13:if(Kn(i),a=i.memoizedState,a!==null&&a.dehydrated!==null){if(i.alternate===null)throw Error(r(340));Ei()}return a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 19:return q(Qt),null;case 4:return Ee(),null;case 10:return vr(i.type),null;case 22:case 23:return Kn(i),Cp(),a!==null&&q(Ri),a=i.flags,a&65536?(i.flags=a&-65537|128,i):null;case 24:return vr(en),null;case 25:return null;default:return null}}function hb(a,i){switch(up(i),i.tag){case 3:vr(en),Ee();break;case 26:case 27:case 5:Ve(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Kn(i);break;case 13:Kn(i);break;case 19:q(Qt);break;case 10:vr(i.type);break;case 22:case 23:Kn(i),Cp(),a!==null&&q(Ri);break;case 24:vr(en)}}function Bo(a,i){try{var l=i.updateQueue,p=l!==null?l.lastEffect:null;if(p!==null){var v=p.next;l=v;do{if((l.tag&a)===a){p=void 0;var x=l.create,C=l.inst;p=x(),C.destroy=p}l=l.next}while(l!==v)}}catch(z){wt(i,i.return,z)}}function ei(a,i,l){try{var p=i.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var x=v.next;p=x;do{if((p.tag&a)===a){var C=p.inst,z=C.destroy;if(z!==void 0){C.destroy=void 0,v=i;var Y=l,re=z;try{re()}catch(pe){wt(v,Y,pe)}}}p=p.next}while(p!==x)}}catch(pe){wt(i,i.return,pe)}}function mb(a){var i=a.updateQueue;if(i!==null){var l=a.stateNode;try{iy(i,l)}catch(p){wt(a,a.return,p)}}}function gb(a,i,l){l.props=Mi(a.type,a.memoizedProps),l.state=a.memoizedState;try{l.componentWillUnmount()}catch(p){wt(a,i,p)}}function Fo(a,i){try{var l=a.ref;if(l!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof l=="function"?a.refCleanup=l(p):l.current=p}}catch(v){wt(a,i,v)}}function Ga(a,i){var l=a.ref,p=a.refCleanup;if(l!==null)if(typeof p=="function")try{p()}catch(v){wt(a,i,v)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(v){wt(a,i,v)}else l.current=null}function vb(a){var i=a.type,l=a.memoizedProps,p=a.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&p.focus();break e;case"img":l.src?p.src=l.src:l.srcSet&&(p.srcset=l.srcSet)}}catch(v){wt(a,a.return,v)}}function af(a,i,l){try{var p=a.stateNode;RE(p,a.type,l,i),p[ln]=i}catch(v){wt(a,a.return,v)}}function yb(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&oi(a.type)||a.tag===4}function rf(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||yb(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&&oi(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 sf(a,i,l){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(a,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(a),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=pr));else if(p!==4&&(p===27&&oi(a.type)&&(l=a.stateNode,i=null),a=a.child,a!==null))for(sf(a,i,l),a=a.sibling;a!==null;)sf(a,i,l),a=a.sibling}function Lc(a,i,l){var p=a.tag;if(p===5||p===6)a=a.stateNode,i?l.insertBefore(a,i):l.appendChild(a);else if(p!==4&&(p===27&&oi(a.type)&&(l=a.stateNode),a=a.child,a!==null))for(Lc(a,i,l),a=a.sibling;a!==null;)Lc(a,i,l),a=a.sibling}function bb(a){var i=a.stateNode,l=a.memoizedProps;try{for(var p=a.type,v=i.attributes;v.length;)i.removeAttributeNode(v[0]);wn(i,p,l),i[Ht]=a,i[ln]=l}catch(x){wt(a,a.return,x)}}var kr=!1,an=!1,of=!1,xb=typeof WeakSet=="function"?WeakSet:Set,mn=null;function cE(a,i){if(a=a.containerInfo,Tf=eu,a=Ov(a),Jd(a)){if("selectionStart"in a)var l={start:a.selectionStart,end:a.selectionEnd};else e:{l=(l=a.ownerDocument)&&l.defaultView||window;var p=l.getSelection&&l.getSelection();if(p&&p.rangeCount!==0){l=p.anchorNode;var v=p.anchorOffset,x=p.focusNode;p=p.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var C=0,z=-1,Y=-1,re=0,pe=0,me=a,se=null;t:for(;;){for(var oe;me!==l||v!==0&&me.nodeType!==3||(z=C+v),me!==x||p!==0&&me.nodeType!==3||(Y=C+p),me.nodeType===3&&(C+=me.nodeValue.length),(oe=me.firstChild)!==null;)se=me,me=oe;for(;;){if(me===a)break t;if(se===l&&++re===v&&(z=C),se===x&&++pe===p&&(Y=C),(oe=me.nextSibling)!==null)break;me=se,se=me.parentNode}me=oe}l=z===-1||Y===-1?null:{start:z,end:Y}}else l=null}l=l||{start:0,end:0}}else l=null;for(Af={focusedElem:a,selectionRange:l},eu=!1,mn=i;mn!==null;)if(i=mn,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,mn=a;else for(;mn!==null;){switch(i=mn,x=i.alternate,a=i.flags,i.tag){case 0:if((a&4)!==0&&(a=i.updateQueue,a=a!==null?a.events:null,a!==null))for(l=0;l<a.length;l++)v=a[l],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&x!==null){a=void 0,l=i,v=x.memoizedProps,x=x.memoizedState,p=l.stateNode;try{var Ae=Mi(l.type,v);a=p.getSnapshotBeforeUpdate(Ae,x),p.__reactInternalSnapshotBeforeUpdate=a}catch(Be){wt(l,l.return,Be)}}break;case 3:if((a&1024)!==0){if(a=i.stateNode.containerInfo,l=a.nodeType,l===9)Of(a);else if(l===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Of(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=i.sibling,a!==null){a.return=i.return,mn=a;break}mn=i.return}}function wb(a,i,l){var p=l.flags;switch(l.tag){case 0:case 11:case 15:jr(a,l),p&4&&Bo(5,l);break;case 1:if(jr(a,l),p&4)if(a=l.stateNode,i===null)try{a.componentDidMount()}catch(C){wt(l,l.return,C)}else{var v=Mi(l.type,i.memoizedProps);i=i.memoizedState;try{a.componentDidUpdate(v,i,a.__reactInternalSnapshotBeforeUpdate)}catch(C){wt(l,l.return,C)}}p&64&&mb(l),p&512&&Fo(l,l.return);break;case 3:if(jr(a,l),p&64&&(a=l.updateQueue,a!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{iy(a,i)}catch(C){wt(l,l.return,C)}}break;case 27:i===null&&p&4&&bb(l);case 26:case 5:jr(a,l),i===null&&p&4&&vb(l),p&512&&Fo(l,l.return);break;case 12:jr(a,l);break;case 31:jr(a,l),p&4&&jb(a,l);break;case 13:jr(a,l),p&4&&Cb(a,l),p&64&&(a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(l=yE.bind(null,l),IE(a,l))));break;case 22:if(p=l.memoizedState!==null||kr,!p){i=i!==null&&i.memoizedState!==null||an,v=kr;var x=an;kr=p,(an=i)&&!x?Cr(a,l,(l.subtreeFlags&8772)!==0):jr(a,l),kr=v,an=x}break;case 30:break;default:jr(a,l)}}function kb(a){var i=a.alternate;i!==null&&(a.alternate=null,kb(i)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(i=a.stateNode,i!==null&&Hr(i)),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 $t=null,$n=!1;function Sr(a,i,l){for(l=l.child;l!==null;)Sb(a,i,l),l=l.sibling}function Sb(a,i,l){if(Fe&&typeof Fe.onCommitFiberUnmount=="function")try{Fe.onCommitFiberUnmount(Ce,l)}catch{}switch(l.tag){case 26:an||Ga(l,i),Sr(a,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:an||Ga(l,i);var p=$t,v=$n;oi(l.type)&&($t=l.stateNode,$n=!1),Sr(a,i,l),Ko(l.stateNode),$t=p,$n=v;break;case 5:an||Ga(l,i);case 6:if(p=$t,v=$n,$t=null,Sr(a,i,l),$t=p,$n=v,$t!==null)if($n)try{($t.nodeType===9?$t.body:$t.nodeName==="HTML"?$t.ownerDocument.body:$t).removeChild(l.stateNode)}catch(x){wt(l,i,x)}else try{$t.removeChild(l.stateNode)}catch(x){wt(l,i,x)}break;case 18:$t!==null&&($n?(a=$t,m0(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,l.stateNode),Ps(a)):m0($t,l.stateNode));break;case 4:p=$t,v=$n,$t=l.stateNode.containerInfo,$n=!0,Sr(a,i,l),$t=p,$n=v;break;case 0:case 11:case 14:case 15:ei(2,l,i),an||ei(4,l,i),Sr(a,i,l);break;case 1:an||(Ga(l,i),p=l.stateNode,typeof p.componentWillUnmount=="function"&&gb(l,i,p)),Sr(a,i,l);break;case 21:Sr(a,i,l);break;case 22:an=(p=an)||l.memoizedState!==null,Sr(a,i,l),an=p;break;default:Sr(a,i,l)}}function jb(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Ps(a)}catch(l){wt(i,i.return,l)}}}function Cb(a,i){if(i.memoizedState===null&&(a=i.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Ps(a)}catch(l){wt(i,i.return,l)}}function uE(a){switch(a.tag){case 31:case 13:case 19:var i=a.stateNode;return i===null&&(i=a.stateNode=new xb),i;case 22:return a=a.stateNode,i=a._retryCache,i===null&&(i=a._retryCache=new xb),i;default:throw Error(r(435,a.tag))}}function zc(a,i){var l=uE(a);i.forEach(function(p){if(!l.has(p)){l.add(p);var v=bE.bind(null,a,p);p.then(v,v)}})}function In(a,i){var l=i.deletions;if(l!==null)for(var p=0;p<l.length;p++){var v=l[p],x=a,C=i,z=C;e:for(;z!==null;){switch(z.tag){case 27:if(oi(z.type)){$t=z.stateNode,$n=!1;break e}break;case 5:$t=z.stateNode,$n=!1;break e;case 3:case 4:$t=z.stateNode.containerInfo,$n=!0;break e}z=z.return}if($t===null)throw Error(r(160));Sb(x,C,v),$t=null,$n=!1,x=v.alternate,x!==null&&(x.return=null),v.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)Nb(i,a),i=i.sibling}var _a=null;function Nb(a,i){var l=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:In(i,a),Pn(a),p&4&&(ei(3,a,a.return),Bo(3,a),ei(5,a,a.return));break;case 1:In(i,a),Pn(a),p&512&&(an||l===null||Ga(l,l.return)),p&64&&kr&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(l=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=l===null?p:l.concat(p))));break;case 26:var v=_a;if(In(i,a),Pn(a),p&512&&(an||l===null||Ga(l,l.return)),p&4){var x=l!==null?l.memoizedState:null;if(p=a.memoizedState,l===null)if(p===null)if(a.stateNode===null){e:{p=a.type,l=a.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":x=v.getElementsByTagName("title")[0],(!x||x[Aa]||x[Ht]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=v.createElement(p),v.head.insertBefore(x,v.querySelector("head > title"))),wn(x,p,l),x[Ht]=a,Ot(x),p=x;break e;case"link":var C=N0("link","href",v).get(p+(l.href||""));if(C){for(var z=0;z<C.length;z++)if(x=C[z],x.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&x.getAttribute("rel")===(l.rel==null?null:l.rel)&&x.getAttribute("title")===(l.title==null?null:l.title)&&x.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){C.splice(z,1);break t}}x=v.createElement(p),wn(x,p,l),v.head.appendChild(x);break;case"meta":if(C=N0("meta","content",v).get(p+(l.content||""))){for(z=0;z<C.length;z++)if(x=C[z],x.getAttribute("content")===(l.content==null?null:""+l.content)&&x.getAttribute("name")===(l.name==null?null:l.name)&&x.getAttribute("property")===(l.property==null?null:l.property)&&x.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&x.getAttribute("charset")===(l.charSet==null?null:l.charSet)){C.splice(z,1);break t}}x=v.createElement(p),wn(x,p,l),v.head.appendChild(x);break;default:throw Error(r(468,p))}x[Ht]=a,Ot(x),p=x}a.stateNode=p}else E0(v,a.type,a.stateNode);else a.stateNode=C0(v,p,a.memoizedProps);else x!==p?(x===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):x.count--,p===null?E0(v,a.type,a.stateNode):C0(v,p,a.memoizedProps)):p===null&&a.stateNode!==null&&af(a,a.memoizedProps,l.memoizedProps)}break;case 27:In(i,a),Pn(a),p&512&&(an||l===null||Ga(l,l.return)),l!==null&&p&4&&af(a,a.memoizedProps,l.memoizedProps);break;case 5:if(In(i,a),Pn(a),p&512&&(an||l===null||Ga(l,l.return)),a.flags&32){v=a.stateNode;try{ls(v,"")}catch(Ae){wt(a,a.return,Ae)}}p&4&&a.stateNode!=null&&(v=a.memoizedProps,af(a,v,l!==null?l.memoizedProps:v)),p&1024&&(of=!0);break;case 6:if(In(i,a),Pn(a),p&4){if(a.stateNode===null)throw Error(r(162));p=a.memoizedProps,l=a.stateNode;try{l.nodeValue=p}catch(Ae){wt(a,a.return,Ae)}}break;case 3:if(Qc=null,v=_a,_a=Zc(i.containerInfo),In(i,a),_a=v,Pn(a),p&4&&l!==null&&l.memoizedState.isDehydrated)try{Ps(i.containerInfo)}catch(Ae){wt(a,a.return,Ae)}of&&(of=!1,Eb(a));break;case 4:p=_a,_a=Zc(a.stateNode.containerInfo),In(i,a),Pn(a),_a=p;break;case 12:In(i,a),Pn(a);break;case 31:In(i,a),Pn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,zc(a,p)));break;case 13:In(i,a),Pn(a),a.child.flags&8192&&a.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Dc=ut()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,zc(a,p)));break;case 22:v=a.memoizedState!==null;var Y=l!==null&&l.memoizedState!==null,re=kr,pe=an;if(kr=re||v,an=pe||Y,In(i,a),an=pe,kr=re,Pn(a),p&8192)e:for(i=a.stateNode,i._visibility=v?i._visibility&-2:i._visibility|1,v&&(l===null||Y||kr||an||Di(a)),l=null,i=a;;){if(i.tag===5||i.tag===26){if(l===null){Y=l=i;try{if(x=Y.stateNode,v)C=x.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{z=Y.stateNode;var me=Y.memoizedProps.style,se=me!=null&&me.hasOwnProperty("display")?me.display:null;z.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===6){if(l===null){Y=i;try{Y.stateNode.nodeValue=v?"":Y.memoizedProps}catch(Ae){wt(Y,Y.return,Ae)}}}else if(i.tag===18){if(l===null){Y=i;try{var oe=Y.stateNode;v?g0(oe,!0):g0(Y.stateNode,!1)}catch(Ae){wt(Y,Y.return,Ae)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===a)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}p&4&&(p=a.updateQueue,p!==null&&(l=p.retryQueue,l!==null&&(p.retryQueue=null,zc(a,l))));break;case 19:In(i,a),Pn(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,zc(a,p)));break;case 30:break;case 21:break;default:In(i,a),Pn(a)}}function Pn(a){var i=a.flags;if(i&2){try{for(var l,p=a.return;p!==null;){if(yb(p)){l=p;break}p=p.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var v=l.stateNode,x=rf(a);Lc(a,x,v);break;case 5:var C=l.stateNode;l.flags&32&&(ls(C,""),l.flags&=-33);var z=rf(a);Lc(a,z,C);break;case 3:case 4:var Y=l.stateNode.containerInfo,re=rf(a);sf(a,re,Y);break;default:throw Error(r(161))}}catch(pe){wt(a,a.return,pe)}a.flags&=-3}i&4096&&(a.flags&=-4097)}function Eb(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var i=a;Eb(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),a=a.sibling}}function jr(a,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)wb(a,i.alternate,i),i=i.sibling}function Di(a){for(a=a.child;a!==null;){var i=a;switch(i.tag){case 0:case 11:case 14:case 15:ei(4,i,i.return),Di(i);break;case 1:Ga(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&gb(i,i.return,l),Di(i);break;case 27:Ko(i.stateNode);case 26:case 5:Ga(i,i.return),Di(i);break;case 22:i.memoizedState===null&&Di(i);break;case 30:Di(i);break;default:Di(i)}a=a.sibling}}function Cr(a,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var p=i.alternate,v=a,x=i,C=x.flags;switch(x.tag){case 0:case 11:case 15:Cr(v,x,l),Bo(4,x);break;case 1:if(Cr(v,x,l),p=x,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(re){wt(p,p.return,re)}if(p=x,v=p.updateQueue,v!==null){var z=p.stateNode;try{var Y=v.shared.hiddenCallbacks;if(Y!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Y.length;v++)ry(Y[v],z)}catch(re){wt(p,p.return,re)}}l&&C&64&&mb(x),Fo(x,x.return);break;case 27:bb(x);case 26:case 5:Cr(v,x,l),l&&p===null&&C&4&&vb(x),Fo(x,x.return);break;case 12:Cr(v,x,l);break;case 31:Cr(v,x,l),l&&C&4&&jb(v,x);break;case 13:Cr(v,x,l),l&&C&4&&Cb(v,x);break;case 22:x.memoizedState===null&&Cr(v,x,l),Fo(x,x.return);break;case 30:break;default:Cr(v,x,l)}i=i.sibling}}function lf(a,i){var l=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(l=a.memoizedState.cachePool.pool),a=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),a!==l&&(a!=null&&a.refCount++,l!=null&&To(l))}function cf(a,i){a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&To(a))}function Oa(a,i,l,p){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Tb(a,i,l,p),i=i.sibling}function Tb(a,i,l,p){var v=i.flags;switch(i.tag){case 0:case 11:case 15:Oa(a,i,l,p),v&2048&&Bo(9,i);break;case 1:Oa(a,i,l,p);break;case 3:Oa(a,i,l,p),v&2048&&(a=null,i.alternate!==null&&(a=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==a&&(i.refCount++,a!=null&&To(a)));break;case 12:if(v&2048){Oa(a,i,l,p),a=i.stateNode;try{var x=i.memoizedProps,C=x.id,z=x.onPostCommit;typeof z=="function"&&z(C,i.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(Y){wt(i,i.return,Y)}}else Oa(a,i,l,p);break;case 31:Oa(a,i,l,p);break;case 13:Oa(a,i,l,p);break;case 23:break;case 22:x=i.stateNode,C=i.alternate,i.memoizedState!==null?x._visibility&2?Oa(a,i,l,p):Ho(a,i):x._visibility&2?Oa(a,i,l,p):(x._visibility|=2,Ts(a,i,l,p,(i.subtreeFlags&10256)!==0||!1)),v&2048&&lf(C,i);break;case 24:Oa(a,i,l,p),v&2048&&cf(i.alternate,i);break;default:Oa(a,i,l,p)}}function Ts(a,i,l,p,v){for(v=v&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var x=a,C=i,z=l,Y=p,re=C.flags;switch(C.tag){case 0:case 11:case 15:Ts(x,C,z,Y,v),Bo(8,C);break;case 23:break;case 22:var pe=C.stateNode;C.memoizedState!==null?pe._visibility&2?Ts(x,C,z,Y,v):Ho(x,C):(pe._visibility|=2,Ts(x,C,z,Y,v)),v&&re&2048&&lf(C.alternate,C);break;case 24:Ts(x,C,z,Y,v),v&&re&2048&&cf(C.alternate,C);break;default:Ts(x,C,z,Y,v)}i=i.sibling}}function Ho(a,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=a,p=i,v=p.flags;switch(p.tag){case 22:Ho(l,p),v&2048&&lf(p.alternate,p);break;case 24:Ho(l,p),v&2048&&cf(p.alternate,p);break;default:Ho(l,p)}i=i.sibling}}var qo=8192;function As(a,i,l){if(a.subtreeFlags&qo)for(a=a.child;a!==null;)Ab(a,i,l),a=a.sibling}function Ab(a,i,l){switch(a.tag){case 26:As(a,i,l),a.flags&qo&&a.memoizedState!==null&&QE(l,_a,a.memoizedState,a.memoizedProps);break;case 5:As(a,i,l);break;case 3:case 4:var p=_a;_a=Zc(a.stateNode.containerInfo),As(a,i,l),_a=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=qo,qo=16777216,As(a,i,l),qo=p):As(a,i,l));break;default:As(a,i,l)}}function Rb(a){var i=a.alternate;if(i!==null&&(a=i.child,a!==null)){i.child=null;do i=a.sibling,a.sibling=null,a=i;while(a!==null)}}function Go(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var p=i[l];mn=p,Ob(p,a)}Rb(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)_b(a),a=a.sibling}function _b(a){switch(a.tag){case 0:case 11:case 15:Go(a),a.flags&2048&&ei(9,a,a.return);break;case 3:Go(a);break;case 12:Go(a);break;case 22:var i=a.stateNode;a.memoizedState!==null&&i._visibility&2&&(a.return===null||a.return.tag!==13)?(i._visibility&=-3,Mc(a)):Go(a);break;default:Go(a)}}function Mc(a){var i=a.deletions;if((a.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var p=i[l];mn=p,Ob(p,a)}Rb(a)}for(a=a.child;a!==null;){switch(i=a,i.tag){case 0:case 11:case 15:ei(8,i,i.return),Mc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Mc(i));break;default:Mc(i)}a=a.sibling}}function Ob(a,i){for(;mn!==null;){var l=mn;switch(l.tag){case 0:case 11:case 15:ei(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var p=l.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:To(l.memoizedState.cache)}if(p=l.child,p!==null)p.return=l,mn=p;else e:for(l=a;mn!==null;){p=mn;var v=p.sibling,x=p.return;if(kb(p),p===l){mn=null;break e}if(v!==null){v.return=x,mn=v;break e}mn=x}}}var dE={getCacheForType:function(a){var i=bn(en),l=i.data.get(a);return l===void 0&&(l=a(),i.data.set(a,l)),l},cacheSignal:function(){return bn(en).controller.signal}},pE=typeof WeakMap=="function"?WeakMap:Map,vt=0,Nt=null,nt=null,st=0,xt=0,Xn=null,ti=!1,Rs=!1,uf=!1,Nr=0,Wt=0,ni=0,$i=0,df=0,Jn=0,_s=0,Vo=null,Un=null,pf=!1,Dc=0,Lb=0,$c=1/0,Ic=null,ai=null,cn=0,ri=null,Os=null,Er=0,ff=0,hf=null,zb=null,Wo=0,mf=null;function ea(){return(vt&2)!==0&&st!==0?st&-st:F.T!==null?wf():Ze()}function Mb(){if(Jn===0)if((st&536870912)===0||ct){var a=Ur;Ur<<=1,(Ur&3932160)===0&&(Ur=262144),Jn=a}else Jn=536870912;return a=Qn.current,a!==null&&(a.flags|=32),Jn}function Bn(a,i,l){(a===Nt&&(xt===2||xt===9)||a.cancelPendingCommit!==null)&&(Ls(a,0),ii(a,st,Jn,!1)),ge(a,l),((vt&2)===0||a!==Nt)&&(a===Nt&&((vt&2)===0&&($i|=l),Wt===4&&ii(a,st,Jn,!1)),Va(a))}function Db(a,i,l){if((vt&6)!==0)throw Error(r(327));var p=!l&&(i&127)===0&&(i&a.expiredLanes)===0||sr(a,i),v=p?mE(a,i):vf(a,i,!0),x=p;do{if(v===0){Rs&&!p&&ii(a,i,0,!1);break}else{if(l=a.current.alternate,x&&!fE(l)){v=vf(a,i,!1),x=!1;continue}if(v===2){if(x=i,a.errorRecoveryDisabledLanes&x)var C=0;else C=a.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){i=C;e:{var z=a;v=Vo;var Y=z.current.memoizedState.isDehydrated;if(Y&&(Ls(z,C).flags|=256),C=vf(z,C,!1),C!==2){if(uf&&!Y){z.errorRecoveryDisabledLanes|=x,$i|=x,v=4;break e}x=Un,Un=v,x!==null&&(Un===null?Un=x:Un.push.apply(Un,x))}v=C}if(x=!1,v!==2)continue}}if(v===1){Ls(a,0),ii(a,i,0,!0);break}e:{switch(p=a,x=v,x){case 0:case 1:throw Error(r(345));case 4:if((i&4194048)!==i)break;case 6:ii(p,i,Jn,!ti);break e;case 2:Un=null;break;case 3:case 5:break;default:throw Error(r(329))}if((i&62914560)===i&&(v=Dc+300-ut(),10<v)){if(ii(p,i,Jn,!ti),Ba(p,0,!0)!==0)break e;Er=i,p.timeoutHandle=f0($b.bind(null,p,l,Un,Ic,pf,i,Jn,$i,_s,ti,x,"Throttled",-0,0),v);break e}$b(p,l,Un,Ic,pf,i,Jn,$i,_s,ti,x,null,-0,0)}}break}while(!0);Va(a)}function $b(a,i,l,p,v,x,C,z,Y,re,pe,me,se,oe){if(a.timeoutHandle=-1,me=i.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:pr},Ab(i,x,me);var Ae=(x&62914560)===x?Dc-ut():(x&4194048)===x?Lb-ut():0;if(Ae=KE(me,Ae),Ae!==null){Er=x,a.cancelPendingCommit=Ae(Gb.bind(null,a,i,x,l,p,v,C,z,Y,pe,me,null,se,oe)),ii(a,x,C,!re);return}}Gb(a,i,x,l,p,v,C,z,Y)}function fE(a){for(var i=a;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var p=0;p<l.length;p++){var v=l[p],x=v.getSnapshot;v=v.value;try{if(!Zn(x(),v))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===a)break;for(;i.sibling===null;){if(i.return===null||i.return===a)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function ii(a,i,l,p){i&=~df,i&=~$i,a.suspendedLanes|=i,a.pingedLanes&=~i,p&&(a.warmLanes|=i),p=a.expirationTimes;for(var v=i;0<v;){var x=31-Ne(v),C=1<<x;p[x]=-1,v&=~C}l!==0&&de(a,l,i)}function Pc(){return(vt&6)===0?(Zo(0),!1):!0}function gf(){if(nt!==null){if(xt===0)var a=nt.return;else a=nt,gr=Ti=null,_p(a),Ss=null,Ro=0,a=nt;for(;a!==null;)hb(a.alternate,a),a=a.return;nt=null}}function Ls(a,i){var l=a.timeoutHandle;l!==-1&&(a.timeoutHandle=-1,LE(l)),l=a.cancelPendingCommit,l!==null&&(a.cancelPendingCommit=null,l()),Er=0,gf(),Nt=a,nt=l=hr(a.current,null),st=i,xt=0,Xn=null,ti=!1,Rs=sr(a,i),uf=!1,_s=Jn=df=$i=ni=Wt=0,Un=Vo=null,pf=!1,(i&8)!==0&&(i|=i&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=i;0<p;){var v=31-Ne(p),x=1<<v;i|=a[v],p&=~x}return Nr=i,sc(),l}function Ib(a,i){Ye=null,F.H=Io,i===ks||i===hc?(i=ey(),xt=3):i===bp?(i=ey(),xt=4):xt=i===Wp?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Xn=i,nt===null&&(Wt=1,Tc(a,va(i,a.current)))}function Pb(){var a=Qn.current;return a===null?!0:(st&4194048)===st?wa===null:(st&62914560)===st||(st&536870912)!==0?a===wa:!1}function Ub(){var a=F.H;return F.H=Io,a===null?Io:a}function Bb(){var a=F.A;return F.A=dE,a}function Uc(){Wt=4,ti||(st&4194048)!==st&&Qn.current!==null||(Rs=!0),(ni&134217727)===0&&($i&134217727)===0||Nt===null||ii(Nt,st,Jn,!1)}function vf(a,i,l){var p=vt;vt|=2;var v=Ub(),x=Bb();(Nt!==a||st!==i)&&(Ic=null,Ls(a,i)),i=!1;var C=Wt;e:do try{if(xt!==0&&nt!==null){var z=nt,Y=Xn;switch(xt){case 8:gf(),C=6;break e;case 3:case 2:case 9:case 6:Qn.current===null&&(i=!0);var re=xt;if(xt=0,Xn=null,zs(a,z,Y,re),l&&Rs){C=0;break e}break;default:re=xt,xt=0,Xn=null,zs(a,z,Y,re)}}hE(),C=Wt;break}catch(pe){Ib(a,pe)}while(!0);return i&&a.shellSuspendCounter++,gr=Ti=null,vt=p,F.H=v,F.A=x,nt===null&&(Nt=null,st=0,sc()),C}function hE(){for(;nt!==null;)Fb(nt)}function mE(a,i){var l=vt;vt|=2;var p=Ub(),v=Bb();Nt!==a||st!==i?(Ic=null,$c=ut()+500,Ls(a,i)):Rs=sr(a,i);e:do try{if(xt!==0&&nt!==null){i=nt;var x=Xn;t:switch(xt){case 1:xt=0,Xn=null,zs(a,i,x,1);break;case 2:case 9:if(Xv(x)){xt=0,Xn=null,Hb(i);break}i=function(){xt!==2&&xt!==9||Nt!==a||(xt=7),Va(a)},x.then(i,i);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:Xv(x)?(xt=0,Xn=null,Hb(i)):(xt=0,Xn=null,zs(a,i,x,7));break;case 5:var C=null;switch(nt.tag){case 26:C=nt.memoizedState;case 5:case 27:var z=nt;if(C?T0(C):z.stateNode.complete){xt=0,Xn=null;var Y=z.sibling;if(Y!==null)nt=Y;else{var re=z.return;re!==null?(nt=re,Bc(re)):nt=null}break t}}xt=0,Xn=null,zs(a,i,x,5);break;case 6:xt=0,Xn=null,zs(a,i,x,6);break;case 8:gf(),Wt=6;break e;default:throw Error(r(462))}}gE();break}catch(pe){Ib(a,pe)}while(!0);return gr=Ti=null,F.H=p,F.A=v,vt=l,nt!==null?0:(Nt=null,st=0,sc(),Wt)}function gE(){for(;nt!==null&&!Yt();)Fb(nt)}function Fb(a){var i=pb(a.alternate,a,Nr);a.memoizedProps=a.pendingProps,i===null?Bc(a):nt=i}function Hb(a){var i=a,l=i.alternate;switch(i.tag){case 15:case 0:i=sb(l,i,i.pendingProps,i.type,void 0,st);break;case 11:i=sb(l,i,i.pendingProps,i.type.render,i.ref,st);break;case 5:_p(i);default:hb(l,i),i=nt=Bv(i,Nr),i=pb(l,i,Nr)}a.memoizedProps=a.pendingProps,i===null?Bc(a):nt=i}function zs(a,i,l,p){gr=Ti=null,_p(i),Ss=null,Ro=0;var v=i.return;try{if(rE(a,v,i,l,st)){Wt=1,Tc(a,va(l,a.current)),nt=null;return}}catch(x){if(v!==null)throw nt=v,x;Wt=1,Tc(a,va(l,a.current)),nt=null;return}i.flags&32768?(ct||p===1?a=!0:Rs||(st&536870912)!==0?a=!1:(ti=a=!0,(p===2||p===9||p===3||p===6)&&(p=Qn.current,p!==null&&p.tag===13&&(p.flags|=16384))),qb(i,a)):Bc(i)}function Bc(a){var i=a;do{if((i.flags&32768)!==0){qb(i,ti);return}a=i.return;var l=oE(i.alternate,i,Nr);if(l!==null){nt=l;return}if(i=i.sibling,i!==null){nt=i;return}nt=i=a}while(i!==null);Wt===0&&(Wt=5)}function qb(a,i){do{var l=lE(a.alternate,a);if(l!==null){l.flags&=32767,nt=l;return}if(l=a.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(a=a.sibling,a!==null)){nt=a;return}nt=a=l}while(a!==null);Wt=6,nt=null}function Gb(a,i,l,p,v,x,C,z,Y){a.cancelPendingCommit=null;do Fc();while(cn!==0);if((vt&6)!==0)throw Error(r(327));if(i!==null){if(i===a.current)throw Error(r(177));if(x=i.lanes|i.childLanes,x|=rp,ze(a,l,x,C,z,Y),a===Nt&&(nt=Nt=null,st=0),Os=i,ri=a,Er=l,ff=x,hf=v,zb=p,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,xE(ee,function(){return Qb(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||p){p=F.T,F.T=null,v=V.p,V.p=2,C=vt,vt|=4;try{cE(a,i,l)}finally{vt=C,V.p=v,F.T=p}}cn=1,Vb(),Wb(),Zb()}}function Vb(){if(cn===1){cn=0;var a=ri,i=Os,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=F.T,F.T=null;var p=V.p;V.p=2;var v=vt;vt|=4;try{Nb(i,a);var x=Af,C=Ov(a.containerInfo),z=x.focusedElem,Y=x.selectionRange;if(C!==z&&z&&z.ownerDocument&&_v(z.ownerDocument.documentElement,z)){if(Y!==null&&Jd(z)){var re=Y.start,pe=Y.end;if(pe===void 0&&(pe=re),"selectionStart"in z)z.selectionStart=re,z.selectionEnd=Math.min(pe,z.value.length);else{var me=z.ownerDocument||document,se=me&&me.defaultView||window;if(se.getSelection){var oe=se.getSelection(),Ae=z.textContent.length,Be=Math.min(Y.start,Ae),jt=Y.end===void 0?Be:Math.min(Y.end,Ae);!oe.extend&&Be>jt&&(C=jt,jt=Be,Be=C);var te=Rv(z,Be),J=Rv(z,jt);if(te&&J&&(oe.rangeCount!==1||oe.anchorNode!==te.node||oe.anchorOffset!==te.offset||oe.focusNode!==J.node||oe.focusOffset!==J.offset)){var ae=me.createRange();ae.setStart(te.node,te.offset),oe.removeAllRanges(),Be>jt?(oe.addRange(ae),oe.extend(J.node,J.offset)):(ae.setEnd(J.node,J.offset),oe.addRange(ae))}}}}for(me=[],oe=z;oe=oe.parentNode;)oe.nodeType===1&&me.push({element:oe,left:oe.scrollLeft,top:oe.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<me.length;z++){var fe=me[z];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}eu=!!Tf,Af=Tf=null}finally{vt=v,V.p=p,F.T=l}}a.current=i,cn=2}}function Wb(){if(cn===2){cn=0;var a=ri,i=Os,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=F.T,F.T=null;var p=V.p;V.p=2;var v=vt;vt|=4;try{wb(a,i.alternate,i)}finally{vt=v,V.p=p,F.T=l}}cn=3}}function Zb(){if(cn===4||cn===3){cn=0,Ft();var a=ri,i=Os,l=Er,p=zb;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?cn=5:(cn=0,Os=ri=null,Yb(a,a.pendingLanes));var v=a.pendingLanes;if(v===0&&(ai=null),Je(l),i=i.stateNode,Fe&&typeof Fe.onCommitFiberRoot=="function")try{Fe.onCommitFiberRoot(Ce,i,void 0,(i.current.flags&128)===128)}catch{}if(p!==null){i=F.T,v=V.p,V.p=2,F.T=null;try{for(var x=a.onRecoverableError,C=0;C<p.length;C++){var z=p[C];x(z.value,{componentStack:z.stack})}}finally{F.T=i,V.p=v}}(Er&3)!==0&&Fc(),Va(a),v=a.pendingLanes,(l&261930)!==0&&(v&42)!==0?a===mf?Wo++:(Wo=0,mf=a):Wo=0,Zo(0)}}function Yb(a,i){(a.pooledCacheLanes&=i)===0&&(i=a.pooledCache,i!=null&&(a.pooledCache=null,To(i)))}function Fc(){return Vb(),Wb(),Zb(),Qb()}function Qb(){if(cn!==5)return!1;var a=ri,i=ff;ff=0;var l=Je(Er),p=F.T,v=V.p;try{V.p=32>l?32:l,F.T=null,l=hf,hf=null;var x=ri,C=Er;if(cn=0,Os=ri=null,Er=0,(vt&6)!==0)throw Error(r(331));var z=vt;if(vt|=4,_b(x.current),Tb(x,x.current,C,l),vt=z,Zo(0,!1),Fe&&typeof Fe.onPostCommitFiberRoot=="function")try{Fe.onPostCommitFiberRoot(Ce,x)}catch{}return!0}finally{V.p=v,F.T=p,Yb(a,i)}}function Kb(a,i,l){i=va(l,i),i=Vp(a.stateNode,i,2),a=Kr(a,i,2),a!==null&&(ge(a,2),Va(a))}function wt(a,i,l){if(a.tag===3)Kb(a,a,l);else for(;i!==null;){if(i.tag===3){Kb(i,a,l);break}else if(i.tag===1){var p=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(ai===null||!ai.has(p))){a=va(l,a),l=Xy(2),p=Kr(i,l,2),p!==null&&(Jy(l,p,i,a),ge(p,2),Va(p));break}}i=i.return}}function yf(a,i,l){var p=a.pingCache;if(p===null){p=a.pingCache=new pE;var v=new Set;p.set(i,v)}else v=p.get(i),v===void 0&&(v=new Set,p.set(i,v));v.has(l)||(uf=!0,v.add(l),a=vE.bind(null,a,i,l),i.then(a,a))}function vE(a,i,l){var p=a.pingCache;p!==null&&p.delete(i),a.pingedLanes|=a.suspendedLanes&l,a.warmLanes&=~l,Nt===a&&(st&l)===l&&(Wt===4||Wt===3&&(st&62914560)===st&&300>ut()-Dc?(vt&2)===0&&Ls(a,0):df|=l,_s===st&&(_s=0)),Va(a)}function Xb(a,i){i===0&&(i=Fr()),a=Ci(a,i),a!==null&&(ge(a,i),Va(a))}function yE(a){var i=a.memoizedState,l=0;i!==null&&(l=i.retryLane),Xb(a,l)}function bE(a,i){var l=0;switch(a.tag){case 31:case 13:var p=a.stateNode,v=a.memoizedState;v!==null&&(l=v.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(r(314))}p!==null&&p.delete(i),Xb(a,l)}function xE(a,i){return _t(a,i)}var Hc=null,Ms=null,bf=!1,qc=!1,xf=!1,si=0;function Va(a){a!==Ms&&a.next===null&&(Ms===null?Hc=Ms=a:Ms=Ms.next=a),qc=!0,bf||(bf=!0,kE())}function Zo(a,i){if(!xf&&qc){xf=!0;do for(var l=!1,p=Hc;p!==null;){if(a!==0){var v=p.pendingLanes;if(v===0)var x=0;else{var C=p.suspendedLanes,z=p.pingedLanes;x=(1<<31-Ne(42|a)+1)-1,x&=v&~(C&~z),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(l=!0,n0(p,x))}else x=st,x=Ba(p,p===Nt?x:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(x&3)===0||sr(p,x)||(l=!0,n0(p,x));p=p.next}while(l);xf=!1}}function wE(){Jb()}function Jb(){qc=bf=!1;var a=0;si!==0&&OE()&&(a=si);for(var i=ut(),l=null,p=Hc;p!==null;){var v=p.next,x=e0(p,i);x===0?(p.next=null,l===null?Hc=v:l.next=v,v===null&&(Ms=l)):(l=p,(a!==0||(x&3)!==0)&&(qc=!0)),p=v}cn!==0&&cn!==5||Zo(a),si!==0&&(si=0)}function e0(a,i){for(var l=a.suspendedLanes,p=a.pingedLanes,v=a.expirationTimes,x=a.pendingLanes&-62914561;0<x;){var C=31-Ne(x),z=1<<C,Y=v[C];Y===-1?((z&l)===0||(z&p)!==0)&&(v[C]=Wl(z,i)):Y<=i&&(a.expiredLanes|=z),x&=~z}if(i=Nt,l=st,l=Ba(a,a===i?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,l===0||a===i&&(xt===2||xt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&Dt(p),a.callbackNode=null,a.callbackPriority=0;if((l&3)===0||sr(a,l)){if(i=l&-l,i===a.callbackPriority)return i;switch(p!==null&&Dt(p),Je(l)){case 2:case 8:l=W;break;case 32:l=ee;break;case 268435456:l=he;break;default:l=ee}return p=t0.bind(null,a),l=_t(l,p),a.callbackPriority=i,a.callbackNode=l,i}return p!==null&&p!==null&&Dt(p),a.callbackPriority=2,a.callbackNode=null,2}function t0(a,i){if(cn!==0&&cn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var l=a.callbackNode;if(Fc()&&a.callbackNode!==l)return null;var p=st;return p=Ba(a,a===Nt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(Db(a,p,i),e0(a,ut()),a.callbackNode!=null&&a.callbackNode===l?t0.bind(null,a):null)}function n0(a,i){if(Fc())return null;Db(a,i,!0)}function kE(){zE(function(){(vt&6)!==0?_t(K,wE):Jb()})}function wf(){if(si===0){var a=xs;a===0&&(a=la,la<<=1,(la&261888)===0&&(la=256)),si=a}return si}function a0(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:Xl(""+a)}function r0(a,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,a.id&&l.setAttribute("form",a.id),i.parentNode.insertBefore(l,i),a=new FormData(a),l.parentNode.removeChild(l),a}function SE(a,i,l,p,v){if(i==="submit"&&l&&l.stateNode===v){var x=a0((v[ln]||null).action),C=p.submitter;C&&(i=(i=C[ln]||null)?a0(i.formAction):C.getAttribute("formAction"),i!==null&&(x=i,C=null));var z=new nc("action","action",null,p,v);a.push({event:z,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(si!==0){var Y=C?r0(v,C):new FormData(v);Up(l,{pending:!0,data:Y,method:v.method,action:x},null,Y)}}else typeof x=="function"&&(z.preventDefault(),Y=C?r0(v,C):new FormData(v),Up(l,{pending:!0,data:Y,method:v.method,action:x},x,Y))},currentTarget:v}]})}}for(var kf=0;kf<ap.length;kf++){var Sf=ap[kf],jE=Sf.toLowerCase(),CE=Sf[0].toUpperCase()+Sf.slice(1);Ra(jE,"on"+CE)}Ra(Mv,"onAnimationEnd"),Ra(Dv,"onAnimationIteration"),Ra($v,"onAnimationStart"),Ra("dblclick","onDoubleClick"),Ra("focusin","onFocus"),Ra("focusout","onBlur"),Ra(BN,"onTransitionRun"),Ra(FN,"onTransitionStart"),Ra(HN,"onTransitionCancel"),Ra(Iv,"onTransitionEnd"),ur("onMouseEnter",["mouseout","mouseover"]),ur("onMouseLeave",["mouseout","mouseover"]),ur("onPointerEnter",["pointerout","pointerover"]),ur("onPointerLeave",["pointerout","pointerover"]),pa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pa("onBeforeInput",["compositionend","keypress","textInput","paste"]),pa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yo="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(" "),NE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yo));function i0(a,i){i=(i&4)!==0;for(var l=0;l<a.length;l++){var p=a[l],v=p.event;p=p.listeners;e:{var x=void 0;if(i)for(var C=p.length-1;0<=C;C--){var z=p[C],Y=z.instance,re=z.currentTarget;if(z=z.listener,Y!==x&&v.isPropagationStopped())break e;x=z,v.currentTarget=re;try{x(v)}catch(pe){ic(pe)}v.currentTarget=null,x=Y}else for(C=0;C<p.length;C++){if(z=p[C],Y=z.instance,re=z.currentTarget,z=z.listener,Y!==x&&v.isPropagationStopped())break e;x=z,v.currentTarget=re;try{x(v)}catch(pe){ic(pe)}v.currentTarget=null,x=Y}}}}function at(a,i){var l=i[lr];l===void 0&&(l=i[lr]=new Set);var p=a+"__bubble";l.has(p)||(s0(i,a,2,!1),l.add(p))}function jf(a,i,l){var p=0;i&&(p|=4),s0(l,a,p,i)}var Gc="_reactListening"+Math.random().toString(36).slice(2);function Cf(a){if(!a[Gc]){a[Gc]=!0,go.forEach(function(l){l!=="selectionchange"&&(NE.has(l)||jf(l,!1,a),jf(l,!0,a))});var i=a.nodeType===9?a:a.ownerDocument;i===null||i[Gc]||(i[Gc]=!0,jf("selectionchange",!1,i))}}function s0(a,i,l,p){switch(M0(i)){case 2:var v=eT;break;case 8:v=tT;break;default:v=Uf}l=v.bind(null,i,l,a),v=void 0,!qd||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(v=!0),p?v!==void 0?a.addEventListener(i,l,{capture:!0,passive:v}):a.addEventListener(i,l,!0):v!==void 0?a.addEventListener(i,l,{passive:v}):a.addEventListener(i,l,!1)}function Nf(a,i,l,p,v){var x=p;if((i&1)===0&&(i&2)===0&&p!==null)e:for(;;){if(p===null)return;var C=p.tag;if(C===3||C===4){var z=p.stateNode.containerInfo;if(z===v)break;if(C===4)for(C=p.return;C!==null;){var Y=C.tag;if((Y===3||Y===4)&&C.stateNode.containerInfo===v)return;C=C.return}for(;z!==null;){if(C=hn(z),C===null)return;if(Y=C.tag,Y===5||Y===6||Y===26||Y===27){p=x=C;continue e}z=z.parentNode}}p=p.return}dv(function(){var re=x,pe=Fd(l),me=[];e:{var se=Pv.get(a);if(se!==void 0){var oe=nc,Ae=a;switch(a){case"keypress":if(ec(l)===0)break e;case"keydown":case"keyup":oe=bN;break;case"focusin":Ae="focus",oe=Zd;break;case"focusout":Ae="blur",oe=Zd;break;case"beforeblur":case"afterblur":oe=Zd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":oe=hv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":oe=oN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":oe=kN;break;case Mv:case Dv:case $v:oe=uN;break;case Iv:oe=jN;break;case"scroll":case"scrollend":oe=iN;break;case"wheel":oe=NN;break;case"copy":case"cut":case"paste":oe=pN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":oe=gv;break;case"toggle":case"beforetoggle":oe=TN}var Be=(i&4)!==0,jt=!Be&&(a==="scroll"||a==="scrollend"),te=Be?se!==null?se+"Capture":null:se;Be=[];for(var J=re,ae;J!==null;){var fe=J;if(ae=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ae===null||te===null||(fe=vo(J,te),fe!=null&&Be.push(Qo(J,fe,ae))),jt)break;J=J.return}0<Be.length&&(se=new oe(se,Ae,null,l,pe),me.push({event:se,listeners:Be}))}}if((i&7)===0){e:{if(se=a==="mouseover"||a==="pointerover",oe=a==="mouseout"||a==="pointerout",se&&l!==Bd&&(Ae=l.relatedTarget||l.fromElement)&&(hn(Ae)||Ae[or]))break e;if((oe||se)&&(se=pe.window===pe?pe:(se=pe.ownerDocument)?se.defaultView||se.parentWindow:window,oe?(Ae=l.relatedTarget||l.toElement,oe=re,Ae=Ae?hn(Ae):null,Ae!==null&&(jt=c(Ae),Be=Ae.tag,Ae!==jt||Be!==5&&Be!==27&&Be!==6)&&(Ae=null)):(oe=null,Ae=re),oe!==Ae)){if(Be=hv,fe="onMouseLeave",te="onMouseEnter",J="mouse",(a==="pointerout"||a==="pointerover")&&(Be=gv,fe="onPointerLeave",te="onPointerEnter",J="pointer"),jt=oe==null?se:cr(oe),ae=Ae==null?se:cr(Ae),se=new Be(fe,J+"leave",oe,l,pe),se.target=jt,se.relatedTarget=ae,fe=null,hn(pe)===re&&(Be=new Be(te,J+"enter",Ae,l,pe),Be.target=ae,Be.relatedTarget=jt,fe=Be),jt=fe,oe&&Ae)t:{for(Be=EE,te=oe,J=Ae,ae=0,fe=te;fe;fe=Be(fe))ae++;fe=0;for(var De=J;De;De=Be(De))fe++;for(;0<ae-fe;)te=Be(te),ae--;for(;0<fe-ae;)J=Be(J),fe--;for(;ae--;){if(te===J||J!==null&&te===J.alternate){Be=te;break t}te=Be(te),J=Be(J)}Be=null}else Be=null;oe!==null&&o0(me,se,oe,Be,!1),Ae!==null&&jt!==null&&o0(me,jt,Ae,Be,!0)}}e:{if(se=re?cr(re):window,oe=se.nodeName&&se.nodeName.toLowerCase(),oe==="select"||oe==="input"&&se.type==="file")var ht=jv;else if(kv(se))if(Cv)ht=IN;else{ht=DN;var _e=MN}else oe=se.nodeName,!oe||oe.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?re&&Ud(re.elementType)&&(ht=jv):ht=$N;if(ht&&(ht=ht(a,re))){Sv(me,ht,l,pe);break e}_e&&_e(a,se,re),a==="focusout"&&re&&se.type==="number"&&re.memoizedProps.value!=null&&Pd(se,"number",se.value)}switch(_e=re?cr(re):window,a){case"focusin":(kv(_e)||_e.contentEditable==="true")&&(ps=_e,ep=re,Co=null);break;case"focusout":Co=ep=ps=null;break;case"mousedown":tp=!0;break;case"contextmenu":case"mouseup":case"dragend":tp=!1,Lv(me,l,pe);break;case"selectionchange":if(UN)break;case"keydown":case"keyup":Lv(me,l,pe)}var Ke;if(Qd)e:{switch(a){case"compositionstart":var ot="onCompositionStart";break e;case"compositionend":ot="onCompositionEnd";break e;case"compositionupdate":ot="onCompositionUpdate";break e}ot=void 0}else ds?xv(a,l)&&(ot="onCompositionEnd"):a==="keydown"&&l.keyCode===229&&(ot="onCompositionStart");ot&&(vv&&l.locale!=="ko"&&(ds||ot!=="onCompositionStart"?ot==="onCompositionEnd"&&ds&&(Ke=pv()):(qr=pe,Gd="value"in qr?qr.value:qr.textContent,ds=!0)),_e=Vc(re,ot),0<_e.length&&(ot=new mv(ot,a,null,l,pe),me.push({event:ot,listeners:_e}),Ke?ot.data=Ke:(Ke=wv(l),Ke!==null&&(ot.data=Ke)))),(Ke=RN?_N(a,l):ON(a,l))&&(ot=Vc(re,"onBeforeInput"),0<ot.length&&(_e=new mv("onBeforeInput","beforeinput",null,l,pe),me.push({event:_e,listeners:ot}),_e.data=Ke)),SE(me,a,re,l,pe)}i0(me,i)})}function Qo(a,i,l){return{instance:a,listener:i,currentTarget:l}}function Vc(a,i){for(var l=i+"Capture",p=[];a!==null;){var v=a,x=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||x===null||(v=vo(a,l),v!=null&&p.unshift(Qo(a,v,x)),v=vo(a,i),v!=null&&p.push(Qo(a,v,x))),a.tag===3)return p;a=a.return}return[]}function EE(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function o0(a,i,l,p,v){for(var x=i._reactName,C=[];l!==null&&l!==p;){var z=l,Y=z.alternate,re=z.stateNode;if(z=z.tag,Y!==null&&Y===p)break;z!==5&&z!==26&&z!==27||re===null||(Y=re,v?(re=vo(l,x),re!=null&&C.unshift(Qo(l,re,Y))):v||(re=vo(l,x),re!=null&&C.push(Qo(l,re,Y)))),l=l.return}C.length!==0&&a.push({event:i,listeners:C})}var TE=/\r\n?/g,AE=/\u0000|\uFFFD/g;function l0(a){return(typeof a=="string"?a:""+a).replace(TE,`
|
|
50
|
-
`).replace(AE,"")}function c0(a,i){return i=l0(i),l0(a)===i}function St(a,i,l,p,v,x){switch(l){case"children":typeof p=="string"?i==="body"||i==="textarea"&&p===""||ls(a,p):(typeof p=="number"||typeof p=="bigint")&&i!=="body"&&ls(a,""+p);break;case"className":Ql(a,"class",p);break;case"tabIndex":Ql(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":Ql(a,l,p);break;case"style":cv(a,p,x);break;case"data":if(i!=="object"){Ql(a,"data",p);break}case"src":case"href":if(p===""&&(i!=="a"||l!=="href")){a.removeAttribute(l);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(l);break}p=Xl(""+p),a.setAttribute(l,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(l,"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"&&(l==="formAction"?(i!=="input"&&St(a,i,"name",v.name,v,null),St(a,i,"formEncType",v.formEncType,v,null),St(a,i,"formMethod",v.formMethod,v,null),St(a,i,"formTarget",v.formTarget,v,null)):(St(a,i,"encType",v.encType,v,null),St(a,i,"method",v.method,v,null),St(a,i,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(l);break}p=Xl(""+p),a.setAttribute(l,p);break;case"onClick":p!=null&&(a.onclick=pr);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=l}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}l=Xl(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,""+p):a.removeAttribute(l);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":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,""):a.removeAttribute(l);break;case"capture":case"download":p===!0?a.setAttribute(l,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(l,p):a.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(l,p):a.removeAttribute(l);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(l):a.setAttribute(l,p);break;case"popover":at("beforetoggle",a),at("toggle",a),Yl(a,"popover",p);break;case"xlinkActuate":dr(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":dr(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":dr(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":dr(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":dr(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":dr(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":dr(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":dr(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":dr(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Yl(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=aN.get(l)||l,Yl(a,l,p))}}function Ef(a,i,l,p,v,x){switch(l){case"style":cv(a,p,x);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(r(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(r(60));a.innerHTML=l}}break;case"children":typeof p=="string"?ls(a,p):(typeof p=="number"||typeof p=="bigint")&&ls(a,""+p);break;case"onScroll":p!=null&&at("scroll",a);break;case"onScrollEnd":p!=null&&at("scrollend",a);break;case"onClick":p!=null&&(a.onclick=pr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zl.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(v=l.endsWith("Capture"),i=l.slice(2,v?l.length-7:void 0),x=a[ln]||null,x=x!=null?x[l]:null,typeof x=="function"&&a.removeEventListener(i,x,v),typeof p=="function")){typeof x!="function"&&x!==null&&(l in a?a[l]=null:a.hasAttribute(l)&&a.removeAttribute(l)),a.addEventListener(i,p,v);break e}l in a?a[l]=p:p===!0?a.setAttribute(l,""):Yl(a,l,p)}}}function wn(a,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",a),at("load",a);var p=!1,v=!1,x;for(x in l)if(l.hasOwnProperty(x)){var C=l[x];if(C!=null)switch(x){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,x,C,l,null)}}v&&St(a,i,"srcSet",l.srcSet,l,null),p&&St(a,i,"src",l.src,l,null);return;case"input":at("invalid",a);var z=x=C=v=null,Y=null,re=null;for(p in l)if(l.hasOwnProperty(p)){var pe=l[p];if(pe!=null)switch(p){case"name":v=pe;break;case"type":C=pe;break;case"checked":Y=pe;break;case"defaultChecked":re=pe;break;case"value":x=pe;break;case"defaultValue":z=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(r(137,i));break;default:St(a,i,p,pe,l,null)}}iv(a,x,z,Y,re,C,v,!1);return;case"select":at("invalid",a),p=C=x=null;for(v in l)if(l.hasOwnProperty(v)&&(z=l[v],z!=null))switch(v){case"value":x=z;break;case"defaultValue":C=z;break;case"multiple":p=z;default:St(a,i,v,z,l,null)}i=x,l=C,a.multiple=!!p,i!=null?os(a,!!p,i,!1):l!=null&&os(a,!!p,l,!0);return;case"textarea":at("invalid",a),x=v=p=null;for(C in l)if(l.hasOwnProperty(C)&&(z=l[C],z!=null))switch(C){case"value":p=z;break;case"defaultValue":v=z;break;case"children":x=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:St(a,i,C,z,l,null)}ov(a,p,v,x);return;case"option":for(Y in l)if(l.hasOwnProperty(Y)&&(p=l[Y],p!=null))switch(Y){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:St(a,i,Y,p,l,null)}return;case"dialog":at("beforetoggle",a),at("toggle",a),at("cancel",a),at("close",a);break;case"iframe":case"object":at("load",a);break;case"video":case"audio":for(p=0;p<Yo.length;p++)at(Yo[p],a);break;case"image":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"embed":case"source":case"link":at("error",a),at("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(re in l)if(l.hasOwnProperty(re)&&(p=l[re],p!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,i));default:St(a,i,re,p,l,null)}return;default:if(Ud(i)){for(pe in l)l.hasOwnProperty(pe)&&(p=l[pe],p!==void 0&&Ef(a,i,pe,p,l,void 0));return}}for(z in l)l.hasOwnProperty(z)&&(p=l[z],p!=null&&St(a,i,z,p,l,null))}function RE(a,i,l,p){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,x=null,C=null,z=null,Y=null,re=null,pe=null;for(oe in l){var me=l[oe];if(l.hasOwnProperty(oe)&&me!=null)switch(oe){case"checked":break;case"value":break;case"defaultValue":Y=me;default:p.hasOwnProperty(oe)||St(a,i,oe,null,p,me)}}for(var se in p){var oe=p[se];if(me=l[se],p.hasOwnProperty(se)&&(oe!=null||me!=null))switch(se){case"type":x=oe;break;case"name":v=oe;break;case"checked":re=oe;break;case"defaultChecked":pe=oe;break;case"value":C=oe;break;case"defaultValue":z=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,i));break;default:oe!==me&&St(a,i,se,oe,p,me)}}Id(a,C,z,Y,re,pe,x,v);return;case"select":oe=C=z=se=null;for(x in l)if(Y=l[x],l.hasOwnProperty(x)&&Y!=null)switch(x){case"value":break;case"multiple":oe=Y;default:p.hasOwnProperty(x)||St(a,i,x,null,p,Y)}for(v in p)if(x=p[v],Y=l[v],p.hasOwnProperty(v)&&(x!=null||Y!=null))switch(v){case"value":se=x;break;case"defaultValue":z=x;break;case"multiple":C=x;default:x!==Y&&St(a,i,v,x,p,Y)}i=z,l=C,p=oe,se!=null?os(a,!!l,se,!1):!!p!=!!l&&(i!=null?os(a,!!l,i,!0):os(a,!!l,l?[]:"",!1));return;case"textarea":oe=se=null;for(z in l)if(v=l[z],l.hasOwnProperty(z)&&v!=null&&!p.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:St(a,i,z,null,p,v)}for(C in p)if(v=p[C],x=l[C],p.hasOwnProperty(C)&&(v!=null||x!=null))switch(C){case"value":se=v;break;case"defaultValue":oe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==x&&St(a,i,C,v,p,x)}sv(a,se,oe);return;case"option":for(var Ae in l)if(se=l[Ae],l.hasOwnProperty(Ae)&&se!=null&&!p.hasOwnProperty(Ae))switch(Ae){case"selected":a.selected=!1;break;default:St(a,i,Ae,null,p,se)}for(Y in p)if(se=p[Y],oe=l[Y],p.hasOwnProperty(Y)&&se!==oe&&(se!=null||oe!=null))switch(Y){case"selected":a.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:St(a,i,Y,se,p,oe)}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 Be in l)se=l[Be],l.hasOwnProperty(Be)&&se!=null&&!p.hasOwnProperty(Be)&&St(a,i,Be,null,p,se);for(re in p)if(se=p[re],oe=l[re],p.hasOwnProperty(re)&&se!==oe&&(se!=null||oe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,i));break;default:St(a,i,re,se,p,oe)}return;default:if(Ud(i)){for(var jt in l)se=l[jt],l.hasOwnProperty(jt)&&se!==void 0&&!p.hasOwnProperty(jt)&&Ef(a,i,jt,void 0,p,se);for(pe in p)se=p[pe],oe=l[pe],!p.hasOwnProperty(pe)||se===oe||se===void 0&&oe===void 0||Ef(a,i,pe,se,p,oe);return}}for(var te in l)se=l[te],l.hasOwnProperty(te)&&se!=null&&!p.hasOwnProperty(te)&&St(a,i,te,null,p,se);for(me in p)se=p[me],oe=l[me],!p.hasOwnProperty(me)||se===oe||se==null&&oe==null||St(a,i,me,se,p,oe)}function u0(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _E(){if(typeof performance.getEntriesByType=="function"){for(var a=0,i=0,l=performance.getEntriesByType("resource"),p=0;p<l.length;p++){var v=l[p],x=v.transferSize,C=v.initiatorType,z=v.duration;if(x&&z&&u0(C)){for(C=0,z=v.responseEnd,p+=1;p<l.length;p++){var Y=l[p],re=Y.startTime;if(re>z)break;var pe=Y.transferSize,me=Y.initiatorType;pe&&u0(me)&&(Y=Y.responseEnd,C+=pe*(Y<z?1:(z-re)/(Y-re)))}if(--p,i+=8*(x+C)/(v.duration/1e3),a++,10<a)break}}if(0<a)return i/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var Tf=null,Af=null;function Wc(a){return a.nodeType===9?a:a.ownerDocument}function d0(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 p0(a,i){if(a===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&i==="foreignObject"?0:a}function Rf(a,i){return a==="textarea"||a==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var _f=null;function OE(){var a=window.event;return a&&a.type==="popstate"?a===_f?!1:(_f=a,!0):(_f=null,!1)}var f0=typeof setTimeout=="function"?setTimeout:void 0,LE=typeof clearTimeout=="function"?clearTimeout:void 0,h0=typeof Promise=="function"?Promise:void 0,zE=typeof queueMicrotask=="function"?queueMicrotask:typeof h0<"u"?function(a){return h0.resolve(null).then(a).catch(ME)}:f0;function ME(a){setTimeout(function(){throw a})}function oi(a){return a==="head"}function m0(a,i){var l=i,p=0;do{var v=l.nextSibling;if(a.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"||l==="/&"){if(p===0){a.removeChild(v),Ps(i);return}p--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")p++;else if(l==="html")Ko(a.ownerDocument.documentElement);else if(l==="head"){l=a.ownerDocument.head,Ko(l);for(var x=l.firstChild;x;){var C=x.nextSibling,z=x.nodeName;x[Aa]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&x.rel.toLowerCase()==="stylesheet"||l.removeChild(x),x=C}}else l==="body"&&Ko(a.ownerDocument.body);l=v}while(l);Ps(i)}function g0(a,i){var l=a;a=0;do{var p=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),p&&p.nodeType===8)if(l=p.data,l==="/$"){if(a===0)break;a--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||a++;l=p}while(l)}function Of(a){var i=a.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Of(l),Hr(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}a.removeChild(l)}}function DE(a,i,l,p){for(;a.nodeType===1;){var v=l;if(a.nodeName.toLowerCase()!==i.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Aa])switch(i){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!==v.rel||a.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||a.getAttribute("title")!==(v.title==null?null:v.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(x=a.getAttribute("src"),(x!==(v.src==null?null:v.src)||a.getAttribute("type")!==(v.type==null?null:v.type)||a.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&x&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(i==="input"&&a.type==="hidden"){var x=v.name==null?null:""+v.name;if(v.type==="hidden"&&a.getAttribute("name")===x)return a}else return a;if(a=ka(a.nextSibling),a===null)break}return null}function $E(a,i,l){if(i==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!l||(a=ka(a.nextSibling),a===null))return null;return a}function v0(a,i){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!i||(a=ka(a.nextSibling),a===null))return null;return a}function Lf(a){return a.data==="$?"||a.data==="$~"}function zf(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function IE(a,i){var l=a.ownerDocument;if(a.data==="$~")a._reactRetry=i;else if(a.data!=="$?"||l.readyState!=="loading")i();else{var p=function(){i(),l.removeEventListener("DOMContentLoaded",p)};l.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function ka(a){for(;a!=null;a=a.nextSibling){var i=a.nodeType;if(i===1||i===3)break;if(i===8){if(i=a.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return a}var Mf=null;function y0(a){a=a.nextSibling;for(var i=0;a;){if(a.nodeType===8){var l=a.data;if(l==="/$"||l==="/&"){if(i===0)return ka(a.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}a=a.nextSibling}return null}function b0(a){a=a.previousSibling;for(var i=0;a;){if(a.nodeType===8){var l=a.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return a;i--}else l!=="/$"&&l!=="/&"||i++}a=a.previousSibling}return null}function x0(a,i,l){switch(i=Wc(l),a){case"html":if(a=i.documentElement,!a)throw Error(r(452));return a;case"head":if(a=i.head,!a)throw Error(r(453));return a;case"body":if(a=i.body,!a)throw Error(r(454));return a;default:throw Error(r(451))}}function Ko(a){for(var i=a.attributes;i.length;)a.removeAttributeNode(i[0]);Hr(a)}var Sa=new Map,w0=new Set;function Zc(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var Tr=V.d;V.d={f:PE,r:UE,D:BE,C:FE,L:HE,m:qE,X:VE,S:GE,M:WE};function PE(){var a=Tr.f(),i=Pc();return a||i}function UE(a){var i=Cn(a);i!==null&&i.tag===5&&i.type==="form"?Iy(i):Tr.r(a)}var Ds=typeof document>"u"?null:document;function k0(a,i,l){var p=Ds;if(p&&typeof i=="string"&&i){var v=ma(i);v='link[rel="'+a+'"][href="'+v+'"]',typeof l=="string"&&(v+='[crossorigin="'+l+'"]'),w0.has(v)||(w0.add(v),a={rel:a,crossOrigin:l,href:i},p.querySelector(v)===null&&(i=p.createElement("link"),wn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function BE(a){Tr.D(a),k0("dns-prefetch",a,null)}function FE(a,i){Tr.C(a,i),k0("preconnect",a,i)}function HE(a,i,l){Tr.L(a,i,l);var p=Ds;if(p&&a&&i){var v='link[rel="preload"][as="'+ma(i)+'"]';i==="image"&&l&&l.imageSrcSet?(v+='[imagesrcset="'+ma(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(v+='[imagesizes="'+ma(l.imageSizes)+'"]')):v+='[href="'+ma(a)+'"]';var x=v;switch(i){case"style":x=$s(a);break;case"script":x=Is(a)}Sa.has(x)||(a=m({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:a,as:i},l),Sa.set(x,a),p.querySelector(v)!==null||i==="style"&&p.querySelector(Xo(x))||i==="script"&&p.querySelector(Jo(x))||(i=p.createElement("link"),wn(i,"link",a),Ot(i),p.head.appendChild(i)))}}function qE(a,i){Tr.m(a,i);var l=Ds;if(l&&a){var p=i&&typeof i.as=="string"?i.as:"script",v='link[rel="modulepreload"][as="'+ma(p)+'"][href="'+ma(a)+'"]',x=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Is(a)}if(!Sa.has(x)&&(a=m({rel:"modulepreload",href:a},i),Sa.set(x,a),l.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Jo(x)))return}p=l.createElement("link"),wn(p,"link",a),Ot(p),l.head.appendChild(p)}}}function GE(a,i,l){Tr.S(a,i,l);var p=Ds;if(p&&a){var v=da(p).hoistableStyles,x=$s(a);i=i||"default";var C=v.get(x);if(!C){var z={loading:0,preload:null};if(C=p.querySelector(Xo(x)))z.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":i},l),(l=Sa.get(x))&&Df(a,l);var Y=C=p.createElement("link");Ot(Y),wn(Y,"link",a),Y._p=new Promise(function(re,pe){Y.onload=re,Y.onerror=pe}),Y.addEventListener("load",function(){z.loading|=1}),Y.addEventListener("error",function(){z.loading|=2}),z.loading|=4,Yc(C,i,p)}C={type:"stylesheet",instance:C,count:1,state:z},v.set(x,C)}}}function VE(a,i){Tr.X(a,i);var l=Ds;if(l&&a){var p=da(l).hoistableScripts,v=Is(a),x=p.get(v);x||(x=l.querySelector(Jo(v)),x||(a=m({src:a,async:!0},i),(i=Sa.get(v))&&$f(a,i),x=l.createElement("script"),Ot(x),wn(x,"link",a),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function WE(a,i){Tr.M(a,i);var l=Ds;if(l&&a){var p=da(l).hoistableScripts,v=Is(a),x=p.get(v);x||(x=l.querySelector(Jo(v)),x||(a=m({src:a,async:!0,type:"module"},i),(i=Sa.get(v))&&$f(a,i),x=l.createElement("script"),Ot(x),wn(x,"link",a),l.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},p.set(v,x))}}function S0(a,i,l,p){var v=(v=le.current)?Zc(v):null;if(!v)throw Error(r(446));switch(a){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=$s(l.href),l=da(v).hoistableStyles,p=l.get(i),p||(p={type:"style",instance:null,count:0,state:null},l.set(i,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){a=$s(l.href);var x=da(v).hoistableStyles,C=x.get(a);if(C||(v=v.ownerDocument||v,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(a,C),(x=v.querySelector(Xo(a)))&&!x._p&&(C.instance=x,C.state.loading=5),Sa.has(a)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Sa.set(a,l),x||ZE(v,a,l,C.state))),i&&p===null)throw Error(r(528,""));return C}if(i&&p!==null)throw Error(r(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Is(l),l=da(v).hoistableScripts,p=l.get(i),p||(p={type:"script",instance:null,count:0,state:null},l.set(i,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,a))}}function $s(a){return'href="'+ma(a)+'"'}function Xo(a){return'link[rel="stylesheet"]['+a+"]"}function j0(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function ZE(a,i,l,p){a.querySelector('link[rel="preload"][as="style"]['+i+"]")?p.loading=1:(i=a.createElement("link"),p.preload=i,i.addEventListener("load",function(){return p.loading|=1}),i.addEventListener("error",function(){return p.loading|=2}),wn(i,"link",l),Ot(i),a.head.appendChild(i))}function Is(a){return'[src="'+ma(a)+'"]'}function Jo(a){return"script[async]"+a}function C0(a,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var p=a.querySelector('style[data-href~="'+ma(l.href)+'"]');if(p)return i.instance=p,Ot(p),p;var v=m({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),Ot(p),wn(p,"style",v),Yc(p,l.precedence,a),i.instance=p;case"stylesheet":v=$s(l.href);var x=a.querySelector(Xo(v));if(x)return i.state.loading|=4,i.instance=x,Ot(x),x;p=j0(l),(v=Sa.get(v))&&Df(p,v),x=(a.ownerDocument||a).createElement("link"),Ot(x);var C=x;return C._p=new Promise(function(z,Y){C.onload=z,C.onerror=Y}),wn(x,"link",p),i.state.loading|=4,Yc(x,l.precedence,a),i.instance=x;case"script":return x=Is(l.src),(v=a.querySelector(Jo(x)))?(i.instance=v,Ot(v),v):(p=l,(v=Sa.get(x))&&(p=m({},l),$f(p,v)),a=a.ownerDocument||a,v=a.createElement("script"),Ot(v),wn(v,"link",p),a.head.appendChild(v),i.instance=v);case"void":return null;default:throw Error(r(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(p=i.instance,i.state.loading|=4,Yc(p,l.precedence,a));return i.instance}function Yc(a,i,l){for(var p=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,x=v,C=0;C<p.length;C++){var z=p[C];if(z.dataset.precedence===i)x=z;else if(x!==v)break}x?x.parentNode.insertBefore(a,x.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(a,i.firstChild))}function Df(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.title==null&&(a.title=i.title)}function $f(a,i){a.crossOrigin==null&&(a.crossOrigin=i.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=i.referrerPolicy),a.integrity==null&&(a.integrity=i.integrity)}var Qc=null;function N0(a,i,l){if(Qc===null){var p=new Map,v=Qc=new Map;v.set(l,p)}else v=Qc,p=v.get(l),p||(p=new Map,v.set(l,p));if(p.has(a))return p;for(p.set(a,null),l=l.getElementsByTagName(a),v=0;v<l.length;v++){var x=l[v];if(!(x[Aa]||x[Ht]||a==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var C=x.getAttribute(i)||"";C=a+C;var z=p.get(C);z?z.push(x):p.set(C,[x])}}return p}function E0(a,i,l){a=a.ownerDocument||a,a.head.insertBefore(l,i==="title"?a.querySelector("head > title"):null)}function YE(a,i,l){if(l===1||i.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return a=i.disabled,typeof i.precedence=="string"&&a==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function T0(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function QE(a,i,l,p){if(l.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var v=$s(p.href),x=i.querySelector(Xo(v));if(x){i=x._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(a.count++,a=Kc.bind(a),i.then(a,a)),l.state.loading|=4,l.instance=x,Ot(x);return}x=i.ownerDocument||i,p=j0(p),(v=Sa.get(v))&&Df(p,v),x=x.createElement("link"),Ot(x);var C=x;C._p=new Promise(function(z,Y){C.onload=z,C.onerror=Y}),wn(x,"link",p),l.instance=x}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(a.count++,l=Kc.bind(a),i.addEventListener("load",l),i.addEventListener("error",l))}}var If=0;function KE(a,i){return a.stylesheets&&a.count===0&&Jc(a,a.stylesheets),0<a.count||0<a.imgCount?function(l){var p=setTimeout(function(){if(a.stylesheets&&Jc(a,a.stylesheets),a.unsuspend){var x=a.unsuspend;a.unsuspend=null,x()}},6e4+i);0<a.imgBytes&&If===0&&(If=62500*_E());var v=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Jc(a,a.stylesheets),a.unsuspend)){var x=a.unsuspend;a.unsuspend=null,x()}},(a.imgBytes>If?50:800)+i);return a.unsuspend=l,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function Kc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Jc(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Xc=null;function Jc(a,i){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Xc=new Map,i.forEach(XE,a),Xc=null,Kc.call(a))}function XE(a,i){if(!(i.state.loading&4)){var l=Xc.get(a);if(l)var p=l.get(null);else{l=new Map,Xc.set(a,l);for(var v=a.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<v.length;x++){var C=v[x];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(l.set(C.dataset.precedence,C),p=C)}p&&l.set(null,p)}v=i.instance,C=v.getAttribute("data-precedence"),x=l.get(C)||p,x===p&&l.set(null,v),l.set(C,v),this.count++,p=Kc.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),x?x.parentNode.insertBefore(v,x.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(v,a.firstChild)),i.state.loading|=4}}var el={$$typeof:N,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function JE(a,i,l,p,v,x,C,z,Y){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=wi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wi(0),this.hiddenUpdates=wi(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=x,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function A0(a,i,l,p,v,x,C,z,Y,re,pe,me){return a=new JE(a,i,l,C,Y,re,pe,me,z),i=1,x===!0&&(i|=24),x=Yn(3,null,null,i),a.current=x,x.stateNode=a,i=gp(),i.refCount++,a.pooledCache=i,i.refCount++,x.memoizedState={element:p,isDehydrated:l,cache:i},xp(x),a}function R0(a){return a?(a=ms,a):ms}function _0(a,i,l,p,v,x){v=R0(v),p.context===null?p.context=v:p.pendingContext=v,p=Qr(i),p.payload={element:l},x=x===void 0?null:x,x!==null&&(p.callback=x),l=Kr(a,p,i),l!==null&&(Bn(l,a,i),Oo(l,a,i))}function O0(a,i){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var l=a.retryLane;a.retryLane=l!==0&&l<i?l:i}}function Pf(a,i){O0(a,i),(a=a.alternate)&&O0(a,i)}function L0(a){if(a.tag===13||a.tag===31){var i=Ci(a,67108864);i!==null&&Bn(i,a,67108864),Pf(a,67108864)}}function z0(a){if(a.tag===13||a.tag===31){var i=ea();i=tt(i);var l=Ci(a,i);l!==null&&Bn(l,a,i),Pf(a,i)}}var eu=!0;function eT(a,i,l,p){var v=F.T;F.T=null;var x=V.p;try{V.p=2,Uf(a,i,l,p)}finally{V.p=x,F.T=v}}function tT(a,i,l,p){var v=F.T;F.T=null;var x=V.p;try{V.p=8,Uf(a,i,l,p)}finally{V.p=x,F.T=v}}function Uf(a,i,l,p){if(eu){var v=Bf(p);if(v===null)Nf(a,i,p,tu,l),D0(a,p);else if(aT(v,a,i,l,p))p.stopPropagation();else if(D0(a,p),i&4&&-1<nT.indexOf(a)){for(;v!==null;){var x=Cn(v);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var C=ca(x.pendingLanes);if(C!==0){var z=x;for(z.pendingLanes|=2,z.entangledLanes|=2;C;){var Y=1<<31-Ne(C);z.entanglements[1]|=Y,C&=~Y}Va(x),(vt&6)===0&&($c=ut()+500,Zo(0))}}break;case 31:case 13:z=Ci(x,2),z!==null&&Bn(z,x,2),Pc(),Pf(x,2)}if(x=Bf(p),x===null&&Nf(a,i,p,tu,l),x===v)break;v=x}v!==null&&p.stopPropagation()}else Nf(a,i,p,null,l)}}function Bf(a){return a=Fd(a),Ff(a)}var tu=null;function Ff(a){if(tu=null,a=hn(a),a!==null){var i=c(a);if(i===null)a=null;else{var l=i.tag;if(l===13){if(a=u(i),a!==null)return a;a=null}else if(l===31){if(a=d(i),a!==null)return a;a=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;a=null}else i!==a&&(a=null)}}return tu=a,null}function M0(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(ye()){case K:return 2;case W:return 8;case ee:case ce:return 32;case he:return 268435456;default:return 32}default:return 32}}var Hf=!1,li=null,ci=null,ui=null,tl=new Map,nl=new Map,di=[],nT="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 D0(a,i){switch(a){case"focusin":case"focusout":li=null;break;case"dragenter":case"dragleave":ci=null;break;case"mouseover":case"mouseout":ui=null;break;case"pointerover":case"pointerout":tl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":nl.delete(i.pointerId)}}function al(a,i,l,p,v,x){return a===null||a.nativeEvent!==x?(a={blockedOn:i,domEventName:l,eventSystemFlags:p,nativeEvent:x,targetContainers:[v]},i!==null&&(i=Cn(i),i!==null&&L0(i)),a):(a.eventSystemFlags|=p,i=a.targetContainers,v!==null&&i.indexOf(v)===-1&&i.push(v),a)}function aT(a,i,l,p,v){switch(i){case"focusin":return li=al(li,a,i,l,p,v),!0;case"dragenter":return ci=al(ci,a,i,l,p,v),!0;case"mouseover":return ui=al(ui,a,i,l,p,v),!0;case"pointerover":var x=v.pointerId;return tl.set(x,al(tl.get(x)||null,a,i,l,p,v)),!0;case"gotpointercapture":return x=v.pointerId,nl.set(x,al(nl.get(x)||null,a,i,l,p,v)),!0}return!1}function $0(a){var i=hn(a.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){a.blockedOn=i,pt(a.priority,function(){z0(l)});return}}else if(i===31){if(i=d(l),i!==null){a.blockedOn=i,pt(a.priority,function(){z0(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){a.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}a.blockedOn=null}function nu(a){if(a.blockedOn!==null)return!1;for(var i=a.targetContainers;0<i.length;){var l=Bf(a.nativeEvent);if(l===null){l=a.nativeEvent;var p=new l.constructor(l.type,l);Bd=p,l.target.dispatchEvent(p),Bd=null}else return i=Cn(l),i!==null&&L0(i),a.blockedOn=l,!1;i.shift()}return!0}function I0(a,i,l){nu(a)&&l.delete(i)}function rT(){Hf=!1,li!==null&&nu(li)&&(li=null),ci!==null&&nu(ci)&&(ci=null),ui!==null&&nu(ui)&&(ui=null),tl.forEach(I0),nl.forEach(I0)}function au(a,i){a.blockedOn===i&&(a.blockedOn=null,Hf||(Hf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rT)))}var ru=null;function P0(a){ru!==a&&(ru=a,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ru===a&&(ru=null);for(var i=0;i<a.length;i+=3){var l=a[i],p=a[i+1],v=a[i+2];if(typeof p!="function"){if(Ff(p||l)===null)continue;break}var x=Cn(l);x!==null&&(a.splice(i,3),i-=3,Up(x,{pending:!0,data:v,method:l.method,action:p},p,v))}}))}function Ps(a){function i(Y){return au(Y,a)}li!==null&&au(li,a),ci!==null&&au(ci,a),ui!==null&&au(ui,a),tl.forEach(i),nl.forEach(i);for(var l=0;l<di.length;l++){var p=di[l];p.blockedOn===a&&(p.blockedOn=null)}for(;0<di.length&&(l=di[0],l.blockedOn===null);)$0(l),l.blockedOn===null&&di.shift();if(l=(a.ownerDocument||a).$$reactFormReplay,l!=null)for(p=0;p<l.length;p+=3){var v=l[p],x=l[p+1],C=v[ln]||null;if(typeof x=="function")C||P0(l);else if(C){var z=null;if(x&&x.hasAttribute("formAction")){if(v=x,C=x[ln]||null)z=C.formAction;else if(Ff(v)!==null)continue}else z=C.action;typeof z=="function"?l[p+1]=z:(l.splice(p,3),p-=3),P0(l)}}}function U0(){function a(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(C){return v=C})},focusReset:"manual",scroll:"manual"})}function i(){v!==null&&(v(),v=null),p||setTimeout(l,20)}function l(){if(!p&&!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 p=!1,v=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),v!==null&&(v(),v=null)}}}function qf(a){this._internalRoot=a}iu.prototype.render=qf.prototype.render=function(a){var i=this._internalRoot;if(i===null)throw Error(r(409));var l=i.current,p=ea();_0(l,p,a,i,null,null)},iu.prototype.unmount=qf.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var i=a.containerInfo;_0(a.current,2,null,a,null,null),Pc(),i[or]=null}};function iu(a){this._internalRoot=a}iu.prototype.unstable_scheduleHydration=function(a){if(a){var i=Ze();a={blockedOn:null,target:a,priority:i};for(var l=0;l<di.length&&i!==0&&i<di[l].priority;l++);di.splice(l,0,a),l===0&&$0(a)}};var B0=t.version;if(B0!=="19.2.4")throw Error(r(527,B0,"19.2.4"));V.findDOMNode=function(a){var i=a._reactInternals;if(i===void 0)throw typeof a.render=="function"?Error(r(188)):(a=Object.keys(a).join(","),Error(r(268,a)));return a=h(i),a=a!==null?g(a):null,a=a===null?null:a.stateNode,a};var iT={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!su.isDisabled&&su.supportsFiber)try{Ce=su.inject(iT),Fe=su}catch{}}return il.createRoot=function(a,i){if(!s(a))throw Error(r(299));var l=!1,p="",v=Zy,x=Yy,C=Qy;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onUncaughtError!==void 0&&(v=i.onUncaughtError),i.onCaughtError!==void 0&&(x=i.onCaughtError),i.onRecoverableError!==void 0&&(C=i.onRecoverableError)),i=A0(a,1,!1,null,null,l,p,null,v,x,C,U0),a[or]=i.current,Cf(a),new qf(i)},il.hydrateRoot=function(a,i,l){if(!s(a))throw Error(r(299));var p=!1,v="",x=Zy,C=Yy,z=Qy,Y=null;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(C=l.onCaughtError),l.onRecoverableError!==void 0&&(z=l.onRecoverableError),l.formState!==void 0&&(Y=l.formState)),i=A0(a,1,!0,i,l??null,p,v,Y,x,C,z,U0),i.context=R0(null),l=i.current,p=ea(),p=tt(p),v=Qr(p),v.callback=null,Kr(l,v,p),l=p,i.current.lanes=l,ge(i,l),Va(i),a[or]=i.current,Cf(a),new iu(i)},il.version="19.2.4",il}var K0;function gT(){if(K0)return Wf.exports;K0=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(),Wf.exports=mT(),Wf.exports}var vT=gT();/**
|
|
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 X0="popstate";function J0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function yT(e={}){function t(r,s){var h;let c=(h=s.state)==null?void 0:h.masked,{pathname:u,search:d,hash:f}=c||r.location;return Yh("",{pathname:u,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",c?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:Tl(s)}return xT(t,n,null,e)}function Ut(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ia(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function bT(){return Math.random().toString(36).substring(2,10)}function ex(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 Yh(e,t,n=null,r,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?lo(t):t,state:n,key:t&&t.key||r||bT(),mask:s}}function Tl({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 lo(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 xT(e,t,n,r={}){let{window:s=document.defaultView,v5Compat:c=!1}=r,u=s.history,d="POP",f=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function m(){d="POP";let E=g(),S=E==null?null:E-h;h=E,f&&f({action:d,location:j.location,delta:S})}function y(E,S){d="PUSH";let T=J0(E)?E:Yh(j.location,E,S);h=g()+1;let N=ex(T,h),R=j.createHref(T.mask||T);try{u.pushState(N,"",R)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;s.location.assign(R)}c&&f&&f({action:d,location:j.location,delta:1})}function b(E,S){d="REPLACE";let T=J0(E)?E:Yh(j.location,E,S);h=g();let N=ex(T,h),R=j.createHref(T.mask||T);u.replaceState(N,"",R),c&&f&&f({action:d,location:j.location,delta:0})}function k(E){return wT(s,E)}let j={get action(){return d},get location(){return e(s,u)},listen(E){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(X0,m),f=E,()=>{s.removeEventListener(X0,m),f=null}},createHref(E){return t(s,E)},createURL:k,encodeLocation(E){let S=k(E);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:y,replace:b,go(E){return u.go(E)}};return j}function wT(e,t,n=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Ut(r,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Tl(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=r+s),new URL(s,r)}function hk(e,t,n="/"){return kT(e,t,n,!1)}function kT(e,t,n,r,s){let c=typeof t=="string"?lo(t):t,u=zr(c.pathname||"/",n);if(u==null)return null;let d=ST(e),f=null,h=MT(u);for(let g=0;f==null&&g<d.length;++g)f=LT(d[g],h,r);return f}function ST(e){let t=mk(e);return jT(t),t}function mk(e,t=[],n=[],r="",s=!1){let c=(u,d,f=s,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(r)&&f)return;Ut(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=Da([r,g.relativePath]),y=n.concat(g);u.children&&u.children.length>0&&(Ut(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),mk(u.children,t,y,m,f)),!(u.path==null&&!u.index)&&t.push({path:m,score:_T(m,u.index),routesMeta:y})};return e.forEach((u,d)=>{var f;if(u.path===""||!((f=u.path)!=null&&f.includes("?")))c(u,d);else for(let h of gk(u.path))c(u,d,!0,h)}),t}function gk(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),c=n.replace(/\?$/,"");if(r.length===0)return s?[c,""]:[c];let u=gk(r.join("/")),d=[];return d.push(...u.map(f=>f===""?c:[c,f].join("/"))),s&&d.push(...u),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function jT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:OT(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var CT=/^:[\w-]+$/,NT=3,ET=2,TT=1,AT=10,RT=-2,tx=e=>e==="*";function _T(e,t){let n=e.split("/"),r=n.length;return n.some(tx)&&(r+=RT),t&&(r+=ET),n.filter(s=>!tx(s)).reduce((s,c)=>s+(CT.test(c)?NT:c===""?TT:AT),r)}function OT(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function LT(e,t,n=!1){let{routesMeta:r}=e,s={},c="/",u=[];for(let d=0;d<r.length;++d){let f=r[d],h=d===r.length-1,g=c==="/"?t:t.slice(c.length)||"/",m=Uu({path:f.relativePath,caseSensitive:f.caseSensitive,end:h},g),y=f.route;if(!m&&h&&n&&!r[r.length-1].route.index&&(m=Uu({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!m)return null;Object.assign(s,m.params),u.push({params:s,pathname:Da([c,m.pathname]),pathnameBase:PT(Da([c,m.pathnameBase])),route:y}),m.pathnameBase!=="/"&&(c=Da([c,m.pathnameBase]))}return u}function Uu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=zT(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let c=s[0],u=c.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:r.reduce((h,{paramName:g,isOptional:m},y)=>{if(g==="*"){let k=d[y]||"";u=c.slice(0,c.length-k.length).replace(/(.)\/+$/,"$1")}const b=d[y];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:u,pattern:e}}function zT(e,t=!1,n=!0){Ia(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=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,f,h,g)=>{if(r.push({paramName:d,isOptional:f!=null}),f){let m=g.charAt(h+u.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function MT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ia(!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 zr(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 DT=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $T(e,t="/"){let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?lo(e):e,c;return n?(n=vk(n),n.startsWith("/")?c=nx(n.substring(1),"/"):c=nx(n,t)):c=t,{pathname:c,search:UT(r),hash:BT(s)}}function nx(e,t){let n=Bu(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Kf(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 IT(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Bm(e){let t=IT(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function fd(e,t,n,r=!1){let s;typeof e=="string"?s=lo(e):(s={...e},Ut(!s.pathname||!s.pathname.includes("?"),Kf("?","pathname","search",s)),Ut(!s.pathname||!s.pathname.includes("#"),Kf("#","pathname","hash",s)),Ut(!s.search||!s.search.includes("#"),Kf("#","search","hash",s)));let c=e===""||s.pathname==="",u=c?"/":s.pathname,d;if(u==null)d=n;else{let m=t.length-1;if(!r&&u.startsWith("..")){let y=u.split("/");for(;y[0]==="..";)y.shift(),m-=1;s.pathname=y.join("/")}d=m>=0?t[m]:"/"}let f=$T(s,d),h=u&&u!=="/"&&u.endsWith("/"),g=(c||u===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var vk=e=>e.replace(/\/\/+/g,"/"),Da=e=>vk(e.join("/")),Bu=e=>e.replace(/\/+$/,""),PT=e=>Bu(e).replace(/^\/*/,"/"),UT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,BT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FT=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 HT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qT(e){let t=e.map(n=>n.route.path).filter(Boolean);return Da(t)||"/"}var yk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function bk(e,t){let n=e;if(typeof n!="string"||!DT.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(yk)try{let c=new URL(window.location.href),u=n.startsWith("//")?new URL(c.protocol+n):new URL(n),d=zr(u.pathname,t);u.origin===c.origin&&d!=null?n=d+u.search+u.hash:s=!0}catch{Ia(!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:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var xk=["POST","PUT","PATCH","DELETE"];new Set(xk);var GT=["GET",...xk];new Set(GT);var co=w.createContext(null);co.displayName="DataRouter";var hd=w.createContext(null);hd.displayName="DataRouterState";var wk=w.createContext(!1);function VT(){return w.useContext(wk)}var kk=w.createContext({isTransitioning:!1});kk.displayName="ViewTransition";var WT=w.createContext(new Map);WT.displayName="Fetchers";var ZT=w.createContext(null);ZT.displayName="Await";var oa=w.createContext(null);oa.displayName="Navigation";var $l=w.createContext(null);$l.displayName="Location";var nr=w.createContext({outlet:null,matches:[],isDataRoute:!1});nr.displayName="Route";var Fm=w.createContext(null);Fm.displayName="RouteError";var Sk="REACT_ROUTER_ERROR",YT="REDIRECT",QT="ROUTE_ERROR_RESPONSE";function KT(e){if(e.startsWith(`${Sk}:${YT}:{`))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 XT(e){if(e.startsWith(`${Sk}:${QT}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FT(t.status,t.statusText,t.data)}catch{}}function JT(e,{relative:t}={}){Ut(uo(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(oa),{hash:s,pathname:c,search:u}=Il(e,{relative:t}),d=c;return n!=="/"&&(d=c==="/"?n:Da([n,c])),r.createHref({pathname:d,search:u,hash:s})}function uo(){return w.useContext($l)!=null}function Pa(){return Ut(uo(),"useLocation() may be used only in the context of a <Router> component."),w.useContext($l).location}var jk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ck(e){w.useContext(oa).static||w.useLayoutEffect(e)}function Hm(){let{isDataRoute:e}=w.useContext(nr);return e?pA():eA()}function eA(){Ut(uo(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(co),{basename:t,navigator:n}=w.useContext(oa),{matches:r}=w.useContext(nr),{pathname:s}=Pa(),c=JSON.stringify(Bm(r)),u=w.useRef(!1);return Ck(()=>{u.current=!0}),w.useCallback((f,h={})=>{if(Ia(u.current,jk),!u.current)return;if(typeof f=="number"){n.go(f);return}let g=fd(f,JSON.parse(c),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Da([t,g.pathname])),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,c,s,e])}w.createContext(null);function Il(e,{relative:t}={}){let{matches:n}=w.useContext(nr),{pathname:r}=Pa(),s=JSON.stringify(Bm(n));return w.useMemo(()=>fd(e,JSON.parse(s),r,t==="path"),[e,s,r,t])}function tA(e,t){return Nk(e,t)}function Nk(e,t,n){var E;Ut(uo(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(oa),{matches:s}=w.useContext(nr),c=s[s.length-1],u=c?c.params:{},d=c?c.pathname:"/",f=c?c.pathnameBase:"/",h=c&&c.route;{let S=h&&h.path||"";Tk(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=Pa(),m;if(t){let S=typeof t=="string"?lo(t):t;Ut(f==="/"||((E=S.pathname)==null?void 0:E.startsWith(f)),`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 "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),m=S}else m=g;let y=m.pathname||"/",b=y;if(f!=="/"){let S=f.replace(/^\//,"").split("/");b="/"+y.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})):hk(e,{pathname:b});Ia(h||k!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Ia(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=sA(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},u,S.params),pathname:Da([f,r.encodeLocation?r.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Da([f,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),s,n);return t&&j?w.createElement($l.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},j):j}function nA(){let e=dA(),t=HT(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)",s={padding:"0.5rem",backgroundColor:r},c={padding:"2px 4px",backgroundColor:r},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=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:c},"ErrorBoundary")," or"," ",w.createElement("code",{style:c},"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:s},n):null,u)}var aA=w.createElement(nA,null),Ek=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=XT(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(nr.Provider,{value:this.props.routeContext},w.createElement(Fm.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(rA,{error:e},t):t}};Ek.contextType=wk;var Xf=new WeakMap;function rA({children:e,error:t}){let{basename:n}=w.useContext(oa);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=KT(t.digest);if(r){let s=Xf.get(t);if(s)throw s;let c=bk(r.location,n);if(yk&&!Xf.get(t))if(c.isExternal||r.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:r.replace}));throw Xf.set(t,u),u}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function iA({routeContext:e,match:t,children:n}){let r=w.useContext(co);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(nr.Provider,{value:e},n)}function sA(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 s=e,c=r==null?void 0:r.errors;if(c!=null){let g=s.findIndex(m=>m.route.id&&(c==null?void 0:c[m.route.id])!==void 0);Ut(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let u=!1,d=-1;if(n&&r){u=r.renderFallback;for(let g=0;g<s.length;g++){let m=s[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=g),m.route.id){let{loaderData:y,errors:b}=r,k=m.route.loader&&!y.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||k){n.isStatic&&(u=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=n==null?void 0:n.onError,h=r&&f?(g,m)=>{var y,b;f(g,{location:r.location,params:((b=(y=r.matches)==null?void 0:y[0])==null?void 0:b.params)??{},pattern:qT(r.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,y)=>{let b,k=!1,j=null,E=null;r&&(b=c&&m.route.id?c[m.route.id]:void 0,j=m.route.errorElement||aA,u&&(d<0&&y===0?(Tk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,E=null):d===y&&(k=!0,E=m.route.hydrateFallbackElement||null)));let S=t.concat(s.slice(0,y+1)),T=()=>{let N;return b?N=j:k?N=E:m.route.Component?N=w.createElement(m.route.Component,null):m.route.element?N=m.route.element:N=g,w.createElement(iA,{match:m,routeContext:{outlet:g,matches:S,isDataRoute:r!=null},children:N})};return r&&(m.route.ErrorBoundary||m.route.errorElement||y===0)?w.createElement(Ek,{location:r.location,revalidation:r.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:h}):T()},null)}function qm(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function oA(e){let t=w.useContext(co);return Ut(t,qm(e)),t}function lA(e){let t=w.useContext(hd);return Ut(t,qm(e)),t}function cA(e){let t=w.useContext(nr);return Ut(t,qm(e)),t}function Gm(e){let t=cA(e),n=t.matches[t.matches.length-1];return Ut(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function uA(){return Gm("useRouteId")}function dA(){var r;let e=w.useContext(Fm),t=lA("useRouteError"),n=Gm("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function pA(){let{router:e}=oA("useNavigate"),t=Gm("useNavigate"),n=w.useRef(!1);return Ck(()=>{n.current=!0}),w.useCallback(async(s,c={})=>{Ia(n.current,jk),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...c}))},[e,t])}var ax={};function Tk(e,t,n){!t&&!ax[e]&&(ax[e]=!0,Ia(!1,n))}w.memo(fA);function fA({routes:e,manifest:t,future:n,state:r,isStatic:s,onError:c}){return Nk(e,void 0,{manifest:t,state:r,isStatic:s,onError:c})}function bl({to:e,replace:t,state:n,relative:r}){Ut(uo(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=w.useContext(oa);Ia(!s,"<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:c}=w.useContext(nr),{pathname:u}=Pa(),d=Hm(),f=fd(e,Bm(c),u,r==="path"),h=JSON.stringify(f);return w.useEffect(()=>{d(JSON.parse(h),{replace:t,state:n,relative:r})},[d,h,r,t,n]),null}function mi(e){Ut(!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 hA({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:s,static:c=!1,useTransitions:u}){Ut(!uo(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:d,navigator:s,static:c,useTransitions:u,future:{}}),[d,s,c,u]);typeof n=="string"&&(n=lo(n));let{pathname:h="/",search:g="",hash:m="",state:y=null,key:b="default",mask:k}=n,j=w.useMemo(()=>{let E=zr(h,d);return E==null?null:{location:{pathname:E,search:g,hash:m,state:y,key:b,mask:k},navigationType:r}},[d,h,g,m,y,b,r,k]);return Ia(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(oa.Provider,{value:f},w.createElement($l.Provider,{children:t,value:j}))}function mA({children:e,location:t}){return tA(Qh(e),t)}function Qh(e,t=[]){let n=[];return w.Children.forEach(e,(r,s)=>{if(!w.isValidElement(r))return;let c=[...t,s];if(r.type===w.Fragment){n.push.apply(n,Qh(r.props.children,c));return}Ut(r.type===mi,`[${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>`),Ut(!r.props.index||!r.props.children,"An index route cannot have child routes.");let u={id:r.props.id||c.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&&(u.children=Qh(r.props.children,c)),n.push(u)}),n}var Nu="get",Eu="application/x-www-form-urlencoded";function md(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gA(e){return md(e)&&e.tagName.toLowerCase()==="button"}function vA(e){return md(e)&&e.tagName.toLowerCase()==="form"}function yA(e){return md(e)&&e.tagName.toLowerCase()==="input"}function bA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function xA(e,t){return e.button===0&&(!t||t==="_self")&&!bA(e)}var ou=null;function wA(){if(ou===null)try{new FormData(document.createElement("form"),0),ou=!1}catch{ou=!0}return ou}var kA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Jf(e){return e!=null&&!kA.has(e)?(Ia(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Eu}"`),null):e}function SA(e,t){let n,r,s,c,u;if(vA(e)){let d=e.getAttribute("action");r=d?zr(d,t):null,n=e.getAttribute("method")||Nu,s=Jf(e.getAttribute("enctype"))||Eu,c=new FormData(e)}else if(gA(e)||yA(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 f=e.getAttribute("formaction")||d.getAttribute("action");if(r=f?zr(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Nu,s=Jf(e.getAttribute("formenctype"))||Jf(d.getAttribute("enctype"))||Eu,c=new FormData(d,e),!wA()){let{name:h,type:g,value:m}=e;if(g==="image"){let y=h?`${h}.`:"";c.append(`${y}x`,"0"),c.append(`${y}y`,"0")}else h&&c.append(h,m)}}else{if(md(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Nu,r=null,s=Eu,u=e}return c&&s==="text/plain"&&(u=c,c=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Vm(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ak(e,t,n,r){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:t&&zr(s.pathname,t)==="/"?s.pathname=`${Bu(t)}/_root.${r}`:s.pathname=`${Bu(s.pathname)}.${r}`,s}async function jA(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 CA(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 NA(e,t,n){let r=await Promise.all(e.map(async s=>{let c=t.routes[s.route.id];if(c){let u=await jA(c,n);return u.links?u.links():[]}return[]}));return RA(r.flat(1).filter(CA).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function rx(e,t,n,r,s,c){let u=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,d=(f,h)=>{var g;return n[h].pathname!==f.pathname||((g=n[h].route.path)==null?void 0:g.endsWith("*"))&&n[h].params["*"]!==f.params["*"]};return c==="assets"?t.filter((f,h)=>u(f,h)||d(f,h)):c==="data"?t.filter((f,h)=>{var m;let g=r.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(u(f,h)||d(f,h))return!0;if(f.route.shouldRevalidate){let y=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((m=n[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function EA(e,t,{includeHydrateFallback:n}={}){return TA(e.map(r=>{let s=t.routes[r.route.id];if(!s)return[];let c=[s.module];return s.clientActionModule&&(c=c.concat(s.clientActionModule)),s.clientLoaderModule&&(c=c.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(c=c.concat(s.hydrateFallbackModule)),s.imports&&(c=c.concat(s.imports)),c}).flat(1))}function TA(e){return[...new Set(e)]}function AA(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function RA(e,t){let n=new Set;return new Set(t),e.reduce((r,s)=>{let c=JSON.stringify(AA(s));return n.has(c)||(n.add(c),r.push({key:c,link:s})),r},[])}function Wm(){let e=w.useContext(co);return Vm(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function _A(){let e=w.useContext(hd);return Vm(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zm=w.createContext(void 0);Zm.displayName="FrameworkContext";function Ym(){let e=w.useContext(Zm);return Vm(e,"You must render this element inside a <HydratedRouter> element"),e}function OA(e,t){let n=w.useContext(Zm),[r,s]=w.useState(!1),[c,u]=w.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,y=w.useRef(null);w.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let j=S=>{S.forEach(T=>{u(T.isIntersecting)})},E=new IntersectionObserver(j,{threshold:.5});return y.current&&E.observe(y.current),()=>{E.disconnect()}}},[e]),w.useEffect(()=>{if(r){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[r]);let b=()=>{s(!0)},k=()=>{s(!1),u(!1)};return n?e!=="intent"?[c,y,{}]:[c,y,{onFocus:sl(d,b),onBlur:sl(f,k),onMouseEnter:sl(h,b),onMouseLeave:sl(g,k),onTouchStart:sl(m,b)}]:[!1,y,{}]}function sl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LA({page:e,...t}){let n=VT(),{router:r}=Wm(),s=w.useMemo(()=>hk(r.routes,e,r.basename),[r.routes,e,r.basename]);return s?n?w.createElement(MA,{page:e,matches:s,...t}):w.createElement(DA,{page:e,matches:s,...t}):null}function zA(e){let{manifest:t,routeModules:n}=Ym(),[r,s]=w.useState([]);return w.useEffect(()=>{let c=!1;return NA(e,t,n).then(u=>{c||s(u)}),()=>{c=!0}},[e,t,n]),r}function MA({page:e,matches:t,...n}){let r=Pa(),{future:s}=Ym(),{basename:c}=Wm(),u=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let d=Ak(e,c,s.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?f=!0:h.push(g.route.id);return f&&h.length>0&&d.searchParams.set("_routes",h.join(",")),[d.pathname+d.search]},[c,s.v8_trailingSlashAwareDataRequests,e,r,t]);return w.createElement(w.Fragment,null,u.map(d=>w.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function DA({page:e,matches:t,...n}){let r=Pa(),{future:s,manifest:c,routeModules:u}=Ym(),{basename:d}=Wm(),{loaderData:f,matches:h}=_A(),g=w.useMemo(()=>rx(e,t,h,c,r,"data"),[e,t,h,c,r]),m=w.useMemo(()=>rx(e,t,h,c,r,"assets"),[e,t,h,c,r]),y=w.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let j=new Set,E=!1;if(t.forEach(T=>{var R;let N=c.routes[T.route.id];!N||!N.hasLoader||(!g.some(H=>H.route.id===T.route.id)&&T.route.id in f&&((R=u[T.route.id])!=null&&R.shouldRevalidate)||N.hasClientLoader?E=!0:j.add(T.route.id))}),j.size===0)return[];let S=Ak(e,d,s.v8_trailingSlashAwareDataRequests,"data");return E&&j.size>0&&S.searchParams.set("_routes",t.filter(T=>j.has(T.route.id)).map(T=>T.route.id).join(",")),[S.pathname+S.search]},[d,s.v8_trailingSlashAwareDataRequests,f,r,c,g,t,e,u]),b=w.useMemo(()=>EA(m,c),[m,c]),k=zA(m);return w.createElement(w.Fragment,null,y.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:E})=>w.createElement("link",{key:j,nonce:n.nonce,...E,crossOrigin:E.crossOrigin??n.crossOrigin})))}function $A(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var IA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{IA&&(window.__reactRouterVersion="7.17.0")}catch{}function PA({basename:e,children:t,useTransitions:n,window:r}){let s=w.useRef();s.current==null&&(s.current=yT({window:r,v5Compat:!0}));let c=s.current,[u,d]=w.useState({action:c.action,location:c.location}),f=w.useCallback(h=>{n===!1?d(h):w.startTransition(()=>d(h))},[n]);return w.useLayoutEffect(()=>c.listen(f),[c,f]),w.createElement(hA,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:n})}var Rk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_k=w.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:s,reloadDocument:c,replace:u,mask:d,state:f,target:h,to:g,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:b,...k},j){let{basename:E,navigator:S,useTransitions:T}=w.useContext(oa),N=typeof g=="string"&&Rk.test(g),R=bk(g,E);g=R.to;let H=JT(g,{relative:s}),A=Pa(),U=null;if(d){let D=fd(d,[],A.mask?A.mask.pathname:"/",!0);E!=="/"&&(D.pathname=D.pathname==="/"?E:Da([E,D.pathname])),U=S.createHref(D)}let[G,M,_]=OA(r,k),I=HA(g,{replace:u,mask:d,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:y,defaultShouldRevalidate:b,useTransitions:T});function B(D){t&&t(D),D.defaultPrevented||I(D)}let Z=!(R.isExternal||c),$=w.createElement("a",{...k,..._,href:(Z?U:void 0)||R.absoluteURL||H,onClick:Z?B:t,ref:$A(j,M),target:h,"data-discover":!N&&n==="render"?"true":void 0});return G&&!N?w.createElement(w.Fragment,null,$,w.createElement(LA,{page:H})):$});_k.displayName="Link";var UA=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:s=!1,style:c,to:u,viewTransition:d,children:f,...h},g){let m=Il(u,{relative:h.relative}),y=Pa(),b=w.useContext(hd),{navigator:k,basename:j}=w.useContext(oa),E=b!=null&&ZA(m)&&d===!0,S=k.encodeLocation?k.encodeLocation(m).pathname:m.pathname,T=y.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(T=T.toLowerCase(),N=N?N.toLowerCase():null,S=S.toLowerCase()),N&&j&&(N=zr(N,j)||N);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let H=T===S||!s&&T.startsWith(S)&&T.charAt(R)==="/",A=N!=null&&(N===S||!s&&N.startsWith(S)&&N.charAt(S.length)==="/"),U={isActive:H,isPending:A,isTransitioning:E},G=H?t:void 0,M;typeof r=="function"?M=r(U):M=[r,H?"active":null,A?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let _=typeof c=="function"?c(U):c;return w.createElement(_k,{...h,"aria-current":G,className:M,ref:g,style:_,to:u,viewTransition:d},typeof f=="function"?f(U):f)});UA.displayName="NavLink";var BA=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:s,state:c,method:u=Nu,action:d,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y,...b},k)=>{let{useTransitions:j}=w.useContext(oa),E=VA(),S=WA(d,{relative:h}),T=u.toLowerCase()==="get"?"get":"post",N=typeof d=="string"&&Rk.test(d),R=H=>{if(f&&f(H),H.defaultPrevented)return;H.preventDefault();let A=H.nativeEvent.submitter,U=(A==null?void 0:A.getAttribute("formmethod"))||u,G=()=>E(A||H.currentTarget,{fetcherKey:t,method:U,navigate:n,replace:s,state:c,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:y});j&&n!==!1?w.startTransition(()=>G()):G()};return w.createElement("form",{ref:k,method:T,action:S,onSubmit:r?f:R,...b,"data-discover":!N&&e==="render"?"true":void 0})});BA.displayName="Form";function FA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ok(e){let t=w.useContext(co);return Ut(t,FA(e)),t}function HA(e,{target:t,replace:n,mask:r,state:s,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:f,useTransitions:h}={}){let g=Hm(),m=Pa(),y=Il(e,{relative:u});return w.useCallback(b=>{if(xA(b,t)){b.preventDefault();let k=n!==void 0?n:Tl(m)===Tl(y),j=()=>g(e,{replace:k,mask:r,state:s,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:f});h?w.startTransition(()=>j()):j()}},[m,g,y,n,r,s,t,e,c,u,d,f,h])}var qA=0,GA=()=>`__${String(++qA)}__`;function VA(){let{router:e}=Ok("useSubmit"),{basename:t}=w.useContext(oa),n=uA(),r=e.fetch,s=e.navigate;return w.useCallback(async(c,u={})=>{let{action:d,method:f,encType:h,formData:g,body:m}=SA(c,t);if(u.navigate===!1){let y=u.fetcherKey||GA();await r(y,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:m,formMethod:u.method||f,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[r,s,t,n])}function WA(e,{relative:t}={}){let{basename:n}=w.useContext(oa),r=w.useContext(nr);Ut(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),c={...Il(e||".",{relative:t})},u=Pa();if(e==null){c.search=u.search;let d=new URLSearchParams(c.search),f=d.getAll("index");if(f.some(g=>g==="")){d.delete("index"),f.filter(m=>m).forEach(m=>d.append("index",m));let g=d.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(c.pathname=c.pathname==="/"?n:Da([n,c.pathname])),Tl(c)}function ZA(e,{relative:t}={}){let n=w.useContext(kk);Ut(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ok("useViewTransitionState"),s=Il(e,{relative:t});if(!n.isTransitioning)return!1;let c=zr(n.currentLocation.pathname,r)||n.currentLocation.pathname,u=zr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Uu(s.pathname,u)!=null||Uu(s.pathname,c)!=null}var YA=fk();const QA="modulepreload",KA=function(e){return"/ui/"+e},ix={},ar=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let u=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]"),f=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));s=u(n.map(h=>{if(h=KA(h),h in ix)return;ix[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const y=document.createElement("link");if(y.rel=g?"stylesheet":QA,g||(y.as="script"),y.crossOrigin="",y.href=h,f&&y.setAttribute("nonce",f),document.head.appendChild(y),g)return new Promise((b,k)=>{y.addEventListener("load",b),y.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return s.then(u=>{for(const d of u||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},sx=e=>{let t;const n=new Set,r=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const y=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,y))}},s=()=>t,d={setState:r,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(r,s,d);return d},XA=(e=>e?sx(e):sx),JA=e=>e;function e2(e,t=JA){const n=Qe.useSyncExternalStore(e.subscribe,Qe.useCallback(()=>t(e.getState()),[e,t]),Qe.useCallback(()=>t(e.getInitialState()),[e,t]));return Qe.useDebugValue(n),n}const ox=e=>{const t=XA(e),n=r=>e2(t,r);return Object.assign(n,t),n},Pl=(e=>e?ox(e):ox),Lk="dkg-layout",t2=260,Wa={leftCollapsed:!1,rightCollapsed:!1,bottomCollapsed:!0,leftSectionMyProjectsOpen:!0,leftSectionIntegrationsOpen:!1,leftWidth:240,rightWidth:360,bottomHeight:t2},zk=140,Mk=400,Dk=200,$k=500,Ik=120,Fu=600,n2=240;function a2(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 Hu(){const e=a2("--header-h",44),t=typeof window<"u"&&window.innerHeight?window.innerHeight:0;if(!t)return Fu;const n=t-e-n2;return Math.max(0,Math.min(Fu,n))}function Tu(e,t,n){return Math.max(t,Math.min(n,e))}function eh(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Tu(e,n,r)}function r2(){try{const e=localStorage.getItem(Lk);if(!e)return Wa;const t=JSON.parse(e);return{leftCollapsed:typeof t.leftCollapsed=="boolean"?t.leftCollapsed:Wa.leftCollapsed,rightCollapsed:typeof t.rightCollapsed=="boolean"?t.rightCollapsed:Wa.rightCollapsed,bottomCollapsed:typeof t.bottomCollapsed=="boolean"?t.bottomCollapsed:Wa.bottomCollapsed,leftSectionMyProjectsOpen:typeof t.leftSectionMyProjectsOpen=="boolean"?t.leftSectionMyProjectsOpen:Wa.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:typeof t.leftSectionIntegrationsOpen=="boolean"?t.leftSectionIntegrationsOpen:Wa.leftSectionIntegrationsOpen,leftWidth:eh(t.leftWidth,Wa.leftWidth,zk,Mk),rightWidth:eh(t.rightWidth,Wa.rightWidth,Dk,$k),bottomHeight:eh(t.bottomHeight,Wa.bottomHeight,Ik,Fu)}}catch{return Wa}}let lu=null;function Ar(e){lu&&clearTimeout(lu),lu=setTimeout(()=>{lu=null;try{localStorage.setItem(Lk,JSON.stringify(e))}catch{}},150)}function Rr(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 fi=r2(),qn=Pl((e,t)=>({leftCollapsed:fi.leftCollapsed,rightCollapsed:fi.rightCollapsed,bottomCollapsed:fi.bottomCollapsed,bottomMaximised:!1,leftSectionMyProjectsOpen:fi.leftSectionMyProjectsOpen,leftSectionIntegrationsOpen:fi.leftSectionIntegrationsOpen,theme:localStorage.getItem("dkg-theme")||"dark",leftWidth:fi.leftWidth,rightWidth:fi.rightWidth,bottomHeight:fi.bottomHeight,toggleLeft:()=>{e(n=>({leftCollapsed:!n.leftCollapsed})),Ar(Rr(t()))},toggleRight:()=>{e(n=>({rightCollapsed:!n.rightCollapsed})),Ar(Rr(t()))},toggleBottom:()=>{e(n=>({bottomCollapsed:!n.bottomCollapsed,bottomMaximised:!1})),Ar(Rr(t()))},toggleBottomMaximised:()=>{e(n=>({bottomMaximised:!n.bottomMaximised,bottomCollapsed:!1})),Ar(Rr(t()))},toggleLeftSectionMyProjects:()=>{e(n=>({leftSectionMyProjectsOpen:!n.leftSectionMyProjectsOpen})),Ar(Rr(t()))},toggleLeftSectionIntegrations:()=>{e(n=>({leftSectionIntegrationsOpen:!n.leftSectionIntegrationsOpen})),Ar(Rr(t()))},setTheme:n=>{localStorage.setItem("dkg-theme",n),e({theme:n})},setLeftWidth:n=>{e({leftWidth:Tu(n,zk,Mk)}),Ar(Rr(t()))},setRightWidth:n=>{e({rightWidth:Tu(n,Dk,$k)}),Ar(Rr(t()))},setBottomHeight:n=>{const r=Math.min(Ik,Hu());e({bottomHeight:Tu(n,r,Fu)}),Ar(Rr(t()))}})),Pk=Pl(e=>({agents:[],activeAgentName:null,nodeStatus:null,setAgents:t=>e({agents:t}),setActiveAgent:t=>e({activeAgentName:t}),setNodeStatus:t=>e({nodeStatus:t})})),i2=[{id:"dashboard",label:"Dashboard",closable:!1}],vn=Pl((e,t)=>({tabs:i2,activeTabId:"dashboard",openTab:n=>{const{tabs:r}=t();r.find(s=>s.id===n.id)?e({activeTabId:n.id}):e({tabs:[...r,n],activeTabId:n.id})},closeTab:n=>{var d;const{tabs:r,activeTabId:s}=t(),c=r.filter(f=>f.id!==n);if(c.length===0)return;const u=s===n?((d=c[Math.max(0,r.findIndex(f=>f.id===n)-1)])==null?void 0:d.id)??c[0].id:s;e({tabs:c,activeTabId:u})},setActiveTab:n=>e({activeTabId:n})})),rr="",lx="did:dkg:context-graph:",Uk=6e4;function Bk(e){const t=e.trim();return t.startsWith(lx)?t.slice(lx.length):t}function s2(e){if(e.authorAgentAddress!=null&&e.preSignedAuthorAttestation!=null)throw new Error("authorAgentAddress and preSignedAuthorAttestation are mutually exclusive")}function Zt(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}class Mr extends Error{constructor(n,r,s){super(r??`HTTP ${n}`);kn(this,"status");kn(this,"body");this.status=n,this.body=s}}class Kh extends Error{constructor(n,r={}){super(n);kn(this,"status");kn(this,"code");kn(this,"source");kn(this,"details");kn(this,"correlationId");kn(this,"timeoutMs");kn(this,"target");kn(this,"route");kn(this,"integrationId");kn(this,"retryable");this.name="LocalAgentApiError",Object.assign(this,r)}}async function Qm(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 bt(e){const t=await fetch(`${rr}${e}`,{headers:Zt()});if(!t.ok)throw new Mr(t.status);return t.json()}async function Fk(e,t){const n=await Qm(`${rr}${e}`,{headers:Zt()},t);if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Mr(n.status,s,r)}return n.json()}async function jn(e,t){const n=await fetch(`${rr}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Mr(n.status,s,r)}return n.json()}async function Km(e,t){const n=await fetch(`${rr}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const Xm=()=>bt("/api/status"),O7=()=>bt("/api/settings/retention"),L7=e=>Km("/api/settings/retention",{retentionDays:e}),z7=()=>bt("/api/settings/telemetry"),M7=e=>Km("/api/settings/telemetry",{enabled:e}),o2=()=>bt("/api/connections"),l2=(e,t=1e4)=>Qm(`${rr}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify({multiaddr:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),c2=(e,t=2e4)=>Qm(`${rr}/api/connect`,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify({peerId:e})},t).then(async n=>{if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}),Jm=()=>bt("/api/agents"),u2=()=>bt("/api/metrics"),D7=(e,t,n=300)=>bt(`/api/metrics/history?from=${e}&to=${t}&maxPoints=${n}`),d2=(e={})=>{const t=new URLSearchParams({...e,phases:"1"}).toString();return bt(`/api/operations?${t}`)},$7=e=>bt(`/api/operations/${e}`),I7=e=>{const t=e?`?periodMs=${e}`:"";return bt(`/api/error-hotspots${t}`)},P7=(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 bt(`/api/failed-operations${n?"?"+n:""}`)},U7=e=>bt(`/api/replication/summary${e?`?periodMs=${e}`:""}`),B7=e=>bt(`/api/replication/per-cg${e?`?periodMs=${e}`:""}`),F7=(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 bt(`/api/replication/timeline${n?"?"+n:""}`)},H7=()=>bt("/api/replication/cursors"),q7=(e,t=100)=>bt(`/api/replication/events?cg=${encodeURIComponent(e)}&limit=${t}`),G7=e=>bt(`/api/success-rates?periodMs=${e}`),V7=(e,t)=>{const n=`periodMs=${e}${t?`&bucketMs=${t}`:""}`;return bt(`/api/per-type-stats?${n}`)},p2=(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 bt(`/api/node-log${n?"?"+n:""}`)};async function gd(){return{contextGraphs:((await Fk("/api/context-graph/list",Uk)).contextGraphs??[]).filter(n=>!n.isSystem)}}const vd=()=>bt("/api/agent/identity");async function f2(e,t,n,r){const s=new AbortController,c=setTimeout(()=>s.abort(),3e4);try{const u=await fetch(`${rr}/api/context-graph/create`,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},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:s.signal});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}catch(u){throw u.name==="AbortError"?new Error("Creating project is taking longer than expected — it may still complete in the background. Refresh the page in a moment."):u}finally{clearTimeout(c)}}const h2=(e,t={})=>jn("/api/context-graph/register",{id:e,...t.accessPolicy!==void 0?{accessPolicy:t.accessPolicy}:{},...t.publishPolicy!==void 0?{publishPolicy:t.publishPolicy}:{}});async function qu(e){const{contextGraphs:t}=await gd(),n=(t??[]).find(s=>(s==null?void 0:s.id)===e);if(n!=null&&n.onChainId)return String(n.onChainId);const r=await h2(e);return r==null?void 0:r.onChainId}const m2=(e,t)=>jn(`/api/context-graph/${encodeURIComponent(e)}/remove-participant`,{agentAddress:t}),Hk=e=>bt(`/api/context-graph/${encodeURIComponent(e)}/participants`),g2=e=>jn(`/api/context-graph/${encodeURIComponent(e)}/sign-join`,{}),v2=(e,t)=>jn(`/api/context-graph/${encodeURIComponent(e)}/request-join`,t),qk=e=>bt(`/api/context-graph/${encodeURIComponent(e)}/join-requests`),eg=(e,t)=>jn(`/api/context-graph/${encodeURIComponent(e)}/approve-join`,{agentAddress:t}),tg=(e,t)=>jn(`/api/context-graph/${encodeURIComponent(e)}/reject-join`,{agentAddress:t}),y2={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 b2(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 y2[t]}async function Gk(e,t,n,r){const s=new FormData;s.append("file",n),s.append("contextGraphId",t);const c=b2(n);c&&s.append("contentType",c);const u=await fetch(`${rr}/api/knowledge-assets/${encodeURIComponent(e)}/wm/import-file`,{method:"POST",headers:Zt(),body:s});if(!u.ok){const d=await u.json().catch(()=>({}));throw new Error((d==null?void 0:d.error)??`HTTP ${u.status}`)}return u.json()}const th=new Map;function Gu(e){const t=JSON.stringify(e),n=th.get(t);if(n)return n;const r=(async()=>{const s=await fetch(`${rr}/api/query`,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:t});if(!s.ok){const c=await s.json().catch(()=>({})),u=(c==null?void 0:c.error)??`HTTP ${s.status}`;throw new Mr(s.status,u,c)}return s.json()})().finally(()=>{th.delete(t)});return th.set(t,r),r}const ia=(e,t,n,r,s,c)=>Gu({sparql:e,contextGraphId:t,includeSharedMemory:n,graphSuffix:r,view:s,includeContextGraphPartitions:c});async function x2(e){var c,u,d;const n=`SELECT ?name ?ual WHERE {
|
|
62
|
-
GRAPH <${`did:dkg:context-graph:${e}/_meta`}> {
|
|
63
|
-
?lc <http://dkg.io/ontology/assertionName> ?name ;
|
|
64
|
-
<http://dkg.io/ontology/reservedUal> ?ual .
|
|
65
|
-
}
|
|
66
|
-
}`,r=await ia(n,e),s={};for(const f of((c=r==null?void 0:r.result)==null?void 0:c.bindings)??[]){const h=typeof f.name=="string"?f.name:(u=f.name)==null?void 0:u.value,g=typeof f.ual=="string"?f.ual:(d=f.ual)==null?void 0:d.value;h&&g&&!s[h]&&(s[h]=g)}return s}const w2=(e,t)=>jn("/api/profile/query-catalog/write",{contextGraphId:e,quads:t}),k2=new Set(["clearAfter","publishEpochs","publisherNodeIdentityIdOverride"]),S2=e=>{if(typeof e=="string"&&/^\d+$/.test(e))return e;throw new Error("publisherNodeIdentityIdOverride must be passed as a decimal string")},j2=(e,t=[])=>{if(!e)return;const n=Object.keys(e).filter(c=>!k2.has(c)&&!t.includes(c));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 s=e.publisherNodeIdentityIdOverride;return s!==void 0&&(r.publisherNodeIdentityIdOverride=S2(s)),Object.keys(r).length>0?r:void 0},Xh=(e,t,n={})=>(s2(n),jn(`/api/knowledge-assets/${encodeURIComponent(t)}/wm/finalize`,{contextGraphId:Bk(e),...n})),Vk=(e,t,n={})=>{const r=j2(n,["subGraphName"]);return jn(`/api/knowledge-assets/${encodeURIComponent(t)}/vm/publish`,{contextGraphId:Bk(e),...n.subGraphName?{subGraphName:n.subGraphName}:{},...r?{options:r}:{}})};async function Vu(e,t="wm"){var j,E,S,T,N,R,H,A;if(t==="swm"){const U=`did:dkg:context-graph:${e}/_meta`,G=`did:dkg:context-graph:${e}/`,M=`urn:dkg:assertion:${e}:`,_=`SELECT ?g ?vm WHERE {
|
|
67
|
-
GRAPH <${U}> {
|
|
68
|
-
?g <http://dkg.io/ontology/memoryLayer> "SWM"
|
|
69
|
-
OPTIONAL { ?g <http://dkg.io/ontology/vmCurrentAssertion> ?vm }
|
|
70
|
-
}
|
|
71
|
-
FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))
|
|
72
|
-
}`,I=await ia(_,e),B=((j=I==null?void 0:I.result)==null?void 0:j.bindings)??[],Z=new Set,$=[];for(const V of B){const X=typeof V.g=="string"?V.g:(E=V.g)==null?void 0:E.value;if(!X)continue;const Q=typeof V.vm=="string"?V.vm:(S=V.vm)==null?void 0:S.value;let L,P;if(X.startsWith(G)){const O=X.slice(G.length).split("/");if(O.length===3&&O[0]==="assertion")P=O[2];else if(O.length===4&&O[1]==="assertion")L=O[0],P=O[3];else continue}else if(X.startsWith(M)){const O=X.slice(M.length);let ne=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(O);ne?P=ne[2]:(ne=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(O),ne&&(L=ne[1],P=ne[3]))}else continue;if(!P||L==="meta")continue;const q=`${L??""} ${P}`;$.push({key:q,name:P,subGraph:L,g:X}),Q&&Z.add(q)}const D=new Set,F=[];for(const V of $)Z.has(V.key)||D.has(V.key)||(D.add(V.key),F.push({name:V.name,graphUri:V.g,subGraph:V.subGraph}));return F}const n=`did:dkg:context-graph:${e}/_meta`,r=`did:dkg:context-graph:${e}/`,s='FILTER(!CONTAINS(STR(?g), "/meta/assertion/"))',c=`SELECT ?g WHERE {
|
|
73
|
-
GRAPH <${n}> { ?g <http://dkg.io/ontology/memoryLayer> "WM" }
|
|
74
|
-
${s}
|
|
75
|
-
}`,u=`SELECT ?g (COUNT(*) AS ?cnt) WHERE {
|
|
76
|
-
GRAPH <${n}> {
|
|
77
|
-
?g <http://dkg.io/ontology/memoryLayer> "WM" ;
|
|
78
|
-
<http://dkg.io/ontology/assertionGraph> ?dg
|
|
79
|
-
}
|
|
80
|
-
GRAPH ?dg { ?s ?p ?o }
|
|
81
|
-
${s}
|
|
82
|
-
} GROUP BY ?g`,[d,f]=await Promise.all([Gu({sparql:c,contextGraphId:e,includeContextGraphPartitions:!0}),Gu({sparql:u,contextGraphId:e,includeContextGraphPartitions:!0}).catch(()=>null)]),h=((T=d==null?void 0:d.result)==null?void 0:T.bindings)??[],g=new Map;for(const U of((N=f==null?void 0:f.result)==null?void 0:N.bindings)??[]){const G=typeof U.g=="string"?U.g:(R=U.g)==null?void 0:R.value,M=typeof U.cnt=="string"?U.cnt:(H=U.cnt)==null?void 0:H.value,_=typeof M=="string"?M.match(/^"?(\d+)/):null,I=_?parseInt(_[1],10):NaN;G&&Number.isFinite(I)&&g.set(G,I)}const m=[],y=new Set,b=`urn:dkg:assertion:${e}:`,k=[...h].sort((U,G)=>{var I,B;const M=(typeof U.g=="string"?U.g:(I=U.g)==null?void 0:I.value)??"",_=(typeof G.g=="string"?G.g:(B=G.g)==null?void 0:B.value)??"";return(M.startsWith(r)?0:1)-(_.startsWith(r)?0:1)});for(const U of k){const G=typeof U.g=="string"?U.g:(A=U.g)==null?void 0:A.value;if(!G)continue;let M,_;if(G.startsWith(r)){const Z=G.slice(r.length).split("/");if(Z.length===3&&Z[0]==="assertion")_=Z[2];else if(Z.length===4&&Z[1]==="assertion")M=Z[0],_=Z[3];else continue}else if(G.startsWith(b)){const Z=G.slice(b.length);let $=/^(0x[0-9a-fA-F]{40}):(.+)$/.exec(Z);$?_=$[2]:($=/^([^:]+):(0x[0-9a-fA-F]{40}):(.+)$/.exec(Z),$&&(M=$[1],_=$[3]))}else continue;if(!_||M==="meta")continue;const I=`${M??""}\0${_}`;if(y.has(I))continue;y.add(I);const B=g.get(G);m.push({name:_,graphUri:G,tripleCount:B,subGraph:M})}return m}const eo=(e,t,n="all",r)=>jn(`/api/knowledge-assets/${encodeURIComponent(t)}/swm/share`,{contextGraphId:e,entities:n,...r?{subGraphName:r}:{}});function ng(e,t){return t.promotedCount>0?{kind:"success",promotedCount:t.promotedCount,message:`Promoted ${t.promotedCount} triple${t.promotedCount===1?"":"s"} from ${e} to Shared Working Memory.`}:{kind:"noop",message:`${e} had no triples to promote. It may already be in Shared Working Memory, or the extracted content is still being committed — refresh and try again.`}}function to(e,t){if(t instanceof Mr&&t.status===413){const n=t.body;if((n==null?void 0:n.code)==="SWM_GOSSIP_PAYLOAD_TOO_LARGE"){const r=typeof n.hint=="string"&&n.hint.length>0?n.hint:"Promote fewer entities per call or split the assertion into smaller root-entity batches.";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 promote to Shared Working Memory. ${r}`}}}if(t instanceof Mr&&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}function Al(e){const t=/No operational wallet has enough funds/i;if(e instanceof Mr){const r=e.body;if((r==null?void 0:r.code)==="NO_FUNDED_PUBLISHER_WALLET")return r.error??e.message;if(typeof(r==null?void 0:r.error)=="string"&&t.test(r.error))return r.error}const n=e instanceof Error?e.message:typeof e=="string"?e:"";return t.test(n)?n:null}async function Wk(e,t,n){let r=0,s=null,c=null;for(const u of t){n==null||n(u.name);try{await Vk(e,u.name,u.subGraph?{subGraphName:u.subGraph}:{}),r+=1}catch(d){s=(d==null?void 0:d.message)??"publish failed",c=c??Al(d)}}return{published:r,total:t.length,lastErr:s,fundsErr:c}}function Zk(e){if(e.published<=0)return null;const t=e.fundsErr?" — some failed: no operational wallet has enough funds (native gas + TRAC). Fund a wallet and retry.":e.lastErr?" (some could not be published)":"";return`Published ${e.published} knowledge asset${e.published!==1?"s":""} to Verifiable Memory${t}`}const C2=(e,t,n)=>{const r=new URLSearchParams({contextGraphId:t});return n&&r.set("subGraphName",n),bt(`/api/knowledge-assets/${encodeURIComponent(e)}/wm/extraction-status?${r}`)};function Au(e,t){const n=e.startsWith("sha256:")||e.startsWith("keccak256:")?e:`sha256:${e}`,r=t?`?contentType=${encodeURIComponent(t)}`:"";return`${rr}/api/file/${encodeURIComponent(n)}${r}`}const N2="/.well-known/genid/";function E2(e){const t=e.trim(),n=t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t,r=n.indexOf(N2);return r===-1?n:n.slice(0,r)}function T2(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}async function A2(e){var u,d,f;const t=`did:dkg:context-graph:${e}/_shared_memory`,n=`SELECT ?s (COUNT(?p) AS ?cnt) WHERE {
|
|
83
|
-
GRAPH ?g {
|
|
84
|
-
?s ?p ?o .
|
|
85
|
-
FILTER(
|
|
86
|
-
(STR(?g) = "${t}" || STRSTARTS(STR(?g), "${t}/")) &&
|
|
87
|
-
!STRSTARTS(STR(?g), "${t}/staging/")
|
|
88
|
-
)
|
|
89
|
-
FILTER(?p != <http://dkg.io/ontology/workspaceOwner>)
|
|
90
|
-
}
|
|
91
|
-
} GROUP BY ?s ORDER BY DESC(?cnt)`,r=await jn("/api/query",{sparql:n,contextGraphId:e,view:"shared-working-memory"}),s=((u=r==null?void 0:r.result)==null?void 0:u.bindings)??[],c=new Map;for(const h of s){const g=typeof h.s=="string"?h.s:((d=h.s)==null?void 0:d.value)??"",y=(typeof h.cnt=="string"?h.cnt:((f=h.cnt)==null?void 0:f.value)??"0").match(/^"?(\d+)/),b=y?parseInt(y[1],10):0,k=E2(g);k&&c.set(k,(c.get(k)??0)+b)}return[...c.entries()].map(([h,g])=>({uri:h,label:T2(h),tripleCount:g})).sort((h,g)=>g.tripleCount-h.tripleCount||h.label.localeCompare(g.label))}const Jh=(e,t)=>{if(t.length!==1)throw new Error("Shared-memory publish currently requires exactly one root entity.");return jn("/api/shared-memory/publish",{contextGraphId:e,selection:t,clearAfter:!1})},R2=(e=20)=>bt(`/api/memory/sessions?limit=${e}`),_2=(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 bt(`/api/memory/sessions/${encodeURIComponent(e)}${r?`?${r}`:""}`)};function Yk(e,t){var n,r,s;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}:{},...(s=t==null?void 0:t.contextEntries)!=null&&s.length?{contextEntries:t.contextEntries}:{},...t!=null&&t.contextGraphId?{contextGraphId:t.contextGraphId}:{}}}async function O2(e,t={}){var m;const n=await fetch("/api/openclaw-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Zt()},body:JSON.stringify(Yk(e,t)),signal:t.signal});if(!n.ok){const y=await n.json().catch(()=>({}));throw Wu(y,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const y=await n.json();return(m=t.onEvent)==null||m.call(t,{type:"final",...y}),y}const s=n.body.getReader(),c=new TextDecoder;let u="",d,f;const h=y=>{var b;(b=t.onEvent)==null||b.call(t,y),y.type==="error"?f=Wu(y,y.error||"Stream failed"):y.type==="final"&&(d={text:y.text,correlationId:y.correlationId,...y.sessionId?{sessionId:y.sessionId}:{},...y.turnId?{turnId:y.turnId}:{}})},g=y=>{let b=u.indexOf(`
|
|
92
|
-
`);for(;b!==-1;){const k=u.slice(0,b).trim();if(u=u.slice(b+1),b=u.indexOf(`
|
|
93
|
-
`),!k.startsWith("data:"))continue;const j=k.slice(5).trim();if(j){try{h(JSON.parse(j))}catch{}if(f)return}}if(y&&u.trim().startsWith("data:")){const k=u.trim().slice(5).trim();if(!k)return;try{h(JSON.parse(k))}catch{}u=""}};for(;;){const{done:y,value:b}=await s.read();if(y||(u+=c.decode(b,{stream:!0}),g(!1),f))break}if(u+=c.decode(),g(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const L2=()=>bt("/api/openclaw-channel/health");async function z2(e,t={}){var y;const n=await fetch("/api/hermes-channel/stream",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/event-stream",...Zt()},body:JSON.stringify(Yk(e,t)),signal:t.signal});if(!n.ok){const b=await n.json().catch(()=>({}));throw Wu(b,`Request failed (${n.status})`,n.status)}const r=(n.headers.get("content-type")??"").toLowerCase();if(!n.body||!r.includes("text/event-stream")){const b=await n.json();return(y=t.onEvent)==null||y.call(t,{type:"final",...b}),b}const s=n.body.getReader(),c=new TextDecoder;let u="",d,f;const h=b=>b.type==="delta"?{type:"text_delta",delta:b.text??""}:b,g=b=>{var k;(k=t.onEvent)==null||k.call(t,b),b.type==="error"?f=Wu(b,b.error||"Stream failed"):b.type==="final"&&(d={text:b.text,correlationId:b.correlationId,...b.sessionId?{sessionId:b.sessionId}:{},...b.turnId?{turnId:b.turnId}:{}})},m=b=>{let k=u.indexOf(`
|
|
94
|
-
`);for(;k!==-1;){const j=u.slice(0,k).trim();if(u=u.slice(k+1),k=u.indexOf(`
|
|
95
|
-
`),!j.startsWith("data:"))continue;const E=j.slice(5).trim();if(E){try{g(h(JSON.parse(E)))}catch{}if(f)return}}if(b&&u.trim().startsWith("data:")){const j=u.trim().slice(5).trim();if(!j)return;try{g(h(JSON.parse(j)))}catch{}u=""}};for(;;){const{done:b,value:k}=await s.read();if(b||(u+=c.decode(k,{stream:!0}),m(!1),f))break}if(u+=c.decode(),m(!0),f)throw f;if(!d)throw new Error("Stream ended without final payload");return d}const M2=()=>bt("/api/hermes-channel/health");function D2(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 s=typeof n.details=="string"?n.details.trim():JSON.stringify(n.details);return!s||s===r?r:`${r}: ${s}`}function Wu(e,t,n){if(!e||typeof e!="object"||Array.isArray(e))return new Kh(t,{status:n});const r=e,s=D2(r,t),c=f=>{const h=r[f];return typeof h=="string"&&h.trim()?h.trim():void 0},u=f=>{const h=r[f];return typeof h=="number"&&Number.isFinite(h)?h:void 0},d=f=>{const h=r[f];return typeof h=="boolean"?h:void 0};return new Kh(s,{status:n,code:c("code"),source:c("source"),details:c("details"),correlationId:c("correlationId"),timeoutMs:u("timeoutMs"),target:c("target"),route:c("route"),integrationId:c("integrationId"),retryable:d("retryable")})}const yd={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:L2,streamChat:O2},hermes:{connectSupported:!0,chatSupported:!0,defaultSessionId:({integrationId:e,record:t,health:n})=>B2(e,t,n),resolveChatContext:({sessionId:e,profile:t})=>({...e?{sessionId:e}:{},...t?{profile:t}:{}}),fetchHealth:M2,streamChat:z2}};function Zs(e){var n,r;const t=e.trim().toLowerCase();return((r=(n=yd[t])==null?void 0:n.defaultSessionId)==null?void 0:r.call(n,{integrationId:t}))??null}function $2(e,t){return t!=null&&t.trim()?t.trim():Zs(e)}async function I2(e,t=50){const n=r=>{if(r.turnId)return`urn:dkg:chat:turn:${encodeURIComponent(r.turnId)}:${encodeURIComponent(r.author)}`;const s=`${e}
|
|
96
|
-
${r.author}
|
|
97
|
-
${r.ts}
|
|
98
|
-
${r.text}`;let c=2166136261;for(let u=0;u<s.length;u+=1)c^=s.charCodeAt(u),c=Math.imul(c,16777619);return`urn:dkg:chat:session:${encodeURIComponent(e)}:message:${(c>>>0).toString(16)}`};try{return[...(await _2(e,{limit:t,order:"desc"})).messages].reverse().map(s=>({uri:s.uri||n(s),text:s.text,author:s.author,ts:s.ts,turnId:s.turnId,persistStatus:s.persistStatus,failureReason:s.failureReason,attachmentRefs:s.attachmentRefs,toolCalls:s.toolCalls}))}catch(r){if(r instanceof Mr&&r.status===404)return[];throw r}}function P2(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 em(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return null}function U2(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||ag(e)}function ag(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 B2(e,t,n){const r=(t==null?void 0:t.metadata)??{},s=em(n==null?void 0:n.profile,r.profileName,r.profile),c=em(r.hermesHome),u=c?null:F2(t),d=[s?`profile-${U2(s)}`:null,c?`home-${ag(c)}`:null,u].filter(f=>f!=null);return d.length?`${e}:dkg-ui:${d.join(":")}`:`${e}:dkg-ui`}function F2(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-${ag(n.join("|"))}`:null}function H2(e){return e?typeof e=="string"?e:[e.provider,e.mode,e.status].filter(Boolean).join(" / ")||null:null}function q2(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 Qk(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function cx(e){if(!Qk(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 G2(e){if(e.target==="bridge")return{target:"bridge",details:e.bridge};if(e.target==="gateway")return{target:"gateway",details:e.gateway};const t=cx(e.bridge),n=cx(e.gateway);return t<0&&n<0?{}:t>=n?{target:"bridge",details:e.bridge}:{target:"gateway",details:e.gateway}}function V2(e){if(!e)return null;const{target:t,details:n}=G2(e);if(!Qk(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 W2(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",s=H2(t==null?void 0:t.memory),c=typeof(t==null?void 0:t.memory)=="object"&&t.memory!=null?t.memory:null;return(c==null?void 0:c.conflict)===!0||String((t==null?void 0:t.status)??"").toLowerCase().includes("conflict")?`${e.name} ${r} has a memory provider conflict${s?` (${s})`:""}.`:t!=null&&t.ok?`${e.name} ${r} is connected${s?` with ${s} memory`:""}.`:t!=null&&t.status?`${e.name} ${r} reports ${t.status}${s?` (${s})`:""}.`:null}async function rg(e){var R,H,A,U,G,M,_,I,B,Z,$,D,F,V;const t=String(e.id??"").toLowerCase(),n=yd[t],r=((R=e.capabilities)==null?void 0:R.localChat)===!0&&(n==null?void 0:n.chatSupported)===!0,s=r&&((H=e.capabilities)==null?void 0:H.chatAttachments)===!0,c=((A=e.capabilities)==null?void 0:A.connectFromUi)===!0&&(n==null?void 0:n.connectSupported)===!0,u=e.enabled===!0,d=(U=e.runtime)==null?void 0:U.status,f=u&&r&&(n!=null&&n.fetchHealth)?V2(await n.fetchHealth().catch(()=>null)):null,h=q2(d,f),g=(f==null?void 0:f.ok)===!0&&!h,m=g,y=u&&r&&(g||d==="connecting"||d==="degraded"||((G=e.runtime)==null?void 0:G.ready)===!0||P2(e)),b=W2(e,f),k=(M=n==null?void 0:n.defaultSessionId)==null?void 0:M.call(n,{integrationId:t,record:e,health:f}),j=t==="hermes"?em(f==null?void 0:f.profile,(_=e.metadata)==null?void 0:_.profileName,(I=e.metadata)==null?void 0:I.profile):void 0;let E,S,T;y&&h?(E="degraded",S="Degraded",T=b??(f==null?void 0:f.error)??((B=e.runtime)==null?void 0:B.lastError)??`${e.name} is attached to this node, but one capability is degraded.`):y&&((Z=e.runtime)==null?void 0:Z.status)==="connecting"?(E="connecting",S="Connecting",T=(($=e.runtime)==null?void 0:$.lastError)??`${e.name} is registered and still starting up.`):m?(E="chat_ready",S="Chat ready",T=`${e.name} is connected to this node and ready for chat.`):y?(E="bridge_offline",S="Bridge offline",T=b??(f==null?void 0:f.error)??((D=e.runtime)==null?void 0:D.lastError)??`${e.name} is attached to this node, but it is not responding right now.`):n?(E="available",S=c?"Ready to connect":"Awaiting chat bridge",T=u?`${e.name} is registered, but this panel is waiting for the framework chat bridge.`:((F=e.runtime)==null?void 0:F.lastError)??`Use the node-served skill plus ${e.name} onboarding to attach an existing local agent.`):(E="coming_soon",S=u?"Registered, panel pending":"Next integration",T=u?`${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 N=m?"Connected":E==="connecting"?"Connecting":E==="degraded"?"Degraded":y?"Unavailable":c?"Ready to connect":"Coming next";return{id:t,name:e.name,framework:e.name,description:e.description,defaultSessionId:k,profile:j,chatSupported:r,chatAttachments:s,connectSupported:c,configured:u,detected:u||g,persistentChat:y,chatReady:g,bridgeOnline:m,bridgeStatusLabel:N,status:E,statusLabel:S,detail:T,error:g?void 0:(f==null?void 0:f.error)??((V=e.runtime)==null?void 0:V.lastError)??void 0,target:f==null?void 0:f.target,source:u||n?"live":"planned"}}async function bd(){const e=await bt("/api/local-agent-integrations"),t=await Promise.all((e.integrations??[]).map(rg));return t.sort((n,r)=>{const s=n.id==="openclaw"?0:1,c=r.id==="openclaw"?0:1;return s!==c?s-c:n.persistentChat!==r.persistentChat?n.persistentChat?-1:1:n.name.localeCompare(r.name)}),{integrations:t}}async function Z2(e){const t=e.trim().toLowerCase(),n=yd[t];if(!(n!=null&&n.connectSupported))throw new Error(`${e} local connect is not available yet.`);const r=await jn("/api/local-agent-integrations/connect",{id:t,metadata:{source:"node-ui"}}),s=r.integration?await rg(r.integration):(await bd()).integrations.find(c=>c.id===t);if(!s)throw new Error(`Missing local agent integration: ${t}`);return{integration:s,notice:r.notice}}async function Y2(e){const t=e.trim().toLowerCase();await Km(`/api/local-agent-integrations/${encodeURIComponent(t)}`,{enabled:!1,runtime:{status:"disconnected",ready:!1,lastError:null}})}async function Q2(e){const t=e.trim().toLowerCase(),n=await jn(`/api/local-agent-integrations/${encodeURIComponent(t)}/refresh`,{}),r=n.integration?await rg(n.integration):(await bd()).integrations.find(s=>s.id===t);if(!r)throw new Error(`Missing local agent integration: ${t}`);return{integration:r,notice:n.notice}}async function ux(e,t=50,n={}){const r=$2(e,n.sessionId);return r?I2(r,t):[]}async function K2(e){var n;const t=(n=e.sessionId)==null?void 0:n.trim();if(!t)throw new Error("Missing Hermes session id");return jn("/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 X2(e,t){if(e.trim().toLowerCase()==="hermes")return K2(t);throw new Error(`${e} local chat persistence is not available yet.`)}async function J2(e,t,n={}){var c;const r=e.trim().toLowerCase(),s=yd[r];if(s!=null&&s.streamChat){const{sessionId:u,profile:d,...f}=n;return s.streamChat(t,{...f,...(c=s.resolveChatContext)==null?void 0:c.call(s,{integrationId:r,sessionId:u,profile:d})})}throw new Error(`${e} local chat is not available yet.`)}const eR=()=>bt("/api/economics"),tR=()=>bt("/api/wallets/balances"),W7=()=>jn("/api/shutdown",{}),nR=()=>bt("/api/notifications"),Kk=e=>jn("/api/notifications/read",e?{ids:e}:{}),ig=e=>Fk(`/api/sub-graph/list?contextGraphId=${encodeURIComponent(e)}`,Uk),aR={name:"my-dkg-node",networkName:"DKG Mainnet",connectedPeers:12,synced:!0,version:"10.0.0-rc"},rR={total_kcs:1842,confirmed_kcs:1623,tentative_kcs:219},iR={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}]},sR={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"}]},oR={"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:[]}},lR={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},cR={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}]},uR={agentAddress:"0x1111111111111111111111111111111111111111",agentDid:"did:dkg:agent:0x1111111111111111111111111111111111111111",name:"mock-node-agent",framework:"mock",peerId:"QmMockNodeAgentPeer000000000000000000000000",nodeIdentityId:"mock-node-identity"},dR={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"},pR={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},fR={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},hR={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"}]}]};function ta(e,t=50){return new Promise(n=>setTimeout(()=>n(e),t))}const na={fetchStatus:()=>ta(aR),fetchMetrics:()=>ta(rR),fetchAgents:()=>ta(iR),fetchContextGraphs:()=>ta(sR),fetchOperationsWithPhases:()=>ta(lR),fetchEconomics:()=>ta(cR),fetchWalletsBalances:()=>ta(dR),fetchCurrentAgent:()=>ta(uR),listParticipants:e=>ta(oR[e]??{contextGraphId:e,allowedAgents:[]}),fetchSubGraphs:e=>ta({contextGraphId:e,subGraphs:[]}),fetchNotificationsFeed:()=>ta(pR),fetchNodeLog:()=>ta(fR),fetchMemorySessions:()=>ta(hR)};let ja=null,ol=null;const tm=new Set;function mR(){return ja===!0}function gR(e){return tm.add(e),e(ja===!0),()=>{tm.delete(e)}}function vR(){if(typeof window>"u")return{};const e=window.__DKG_TOKEN__;return e?{Authorization:`Bearer ${e}`}:{}}async function yR(){if(ja!==null)return ja;if(ol)return ol;ol=(async()=>{try{const e=await fetch("/api/status",{headers:vR(),signal:AbortSignal.timeout(2e3)});e.ok||e.status===401?ja=!1:ja=!0}catch{ja=!0}return typeof window<"u"&&(window.__DKG_USING_MOCKS__=ja,ja&&console.warn("[dkg-ui] /api/status unreachable (timeout/5xx/network) — falling back to demo (mock) data. The UI is NOT showing live node state.")),tm.forEach(e=>e(ja)),ja})();try{return await ol}finally{ol=null}}async function aa(e,t){return await yR()?t():e()}const Tn={fetchStatus:()=>aa(Xm,na.fetchStatus),fetchMetrics:()=>aa(u2,na.fetchMetrics),fetchAgents:()=>aa(Jm,na.fetchAgents),fetchContextGraphs:()=>aa(gd,na.fetchContextGraphs),fetchOperationsWithPhases:e=>aa(()=>d2(e),na.fetchOperationsWithPhases),fetchEconomics:()=>aa(eR,na.fetchEconomics),fetchWalletsBalances:()=>aa(tR,na.fetchWalletsBalances),fetchCurrentAgent:()=>aa(vd,na.fetchCurrentAgent),listParticipants:e=>aa(()=>Hk(e),()=>na.listParticipants(e)),fetchSubGraphs:e=>aa(()=>ig(e),()=>na.fetchSubGraphs(e)),fetchNotificationsFeed:()=>aa(nR,na.fetchNotificationsFeed),fetchNodeLog:e=>aa(()=>p2(e),na.fetchNodeLog),fetchMemorySessions:e=>aa(()=>R2(e),na.fetchMemorySessions),markNotificationsRead:Kk,executeQuery:ia},bR=6e4;let vi={data:null,loading:!0,error:null},Xa=null,kl=null,xl=0,gi="";const Zu=new Set;function qi(){if(typeof window>"u")return"";const e=window.__DKG_TOKEN__;return e?`Bearer ${e}`:""}function Ru(e){gi=e,vi={data:null,loading:!0,error:null}}function nh(){const e=qi();return e!==gi&&Ru(e),vi}function _u(){for(const e of Zu)e()}function ah(e){vi=e,_u()}function Yu(){const e=xl,t=qi();if((Xa==null?void 0:Xa.authKey)===t)return Xa.promise;t!==gi?(Ru(t),_u()):ah({...vi,loading:!0,error:null});const n=Tn.fetchCurrentAgent().then(r=>{if(e===xl){if(t!==qi()){const s=qi(),c=gi!==s||vi.loading;gi!==s&&(Ru(s),_u()),c&&Yu();return}ah({data:r,loading:!1,error:null})}}).catch(r=>{if(e===xl){if(t!==qi()){const s=qi(),c=gi!==s||vi.loading;gi!==s&&(Ru(s),_u()),c&&Yu();return}ah({data:vi.data,loading:!1,error:r instanceof Error?r.message:"Failed to load current agent"})}}).finally(()=>{e===xl&&(Xa==null?void 0:Xa.promise)===n&&(Xa=null)});return Xa={authKey:t,promise:n},n}function xR(){Yu(),!kl&&(kl=setInterval(()=>{Yu()},bR))}function wR(){Zu.size>0||!kl||(clearInterval(kl),kl=null,xl+=1,Xa=null,vi={data:null,loading:!0,error:null},gi=qi())}function xd(){const[e,t]=w.useState(nh);return w.useEffect(()=>{const n=()=>t(nh());return Zu.add(n),t(nh()),xR(),()=>{Zu.delete(n),wR()}},[]),e}const Na=Pl(e=>({contextGraphs:[],loading:!1,activeProjectId:null,setContextGraphs:t=>e({contextGraphs:t}),setLoading:t=>e({loading:t}),setActiveProject:t=>e({activeProjectId:t})})),Ys=new Set;let gn=null,Ou=null;const kR=350;function dx(e){return e==="wm"||e==="swm"||e==="vm"}function SR(e){const t=e.layers;return Array.isArray(t)?t.filter(dx):dx(e.layer)?[e.layer]:[]}function jR(e,t,n){if(!t||e.contextGraphId!==t)return!1;if(!n||n.length===0)return!0;const r=SR(e);return r.length===0?!0:n.some(s=>r.includes(s))}function Xk(){if(gn)return;const e=typeof window<"u"?window.__DKG_TOKEN__:void 0,t=e?`/api/events?token=${encodeURIComponent(e)}`:"/api/events";gn=new EventSource(t);const n=r=>s=>{let c={};try{c=JSON.parse(s.data)}catch{}const u={type:r,data:c};for(const d of Ys)try{d(u)}catch{}};gn.addEventListener("join_request",n("join_request")),gn.addEventListener("join_approved",n("join_approved")),gn.addEventListener("join_rejected",n("join_rejected")),gn.addEventListener("project_synced",n("project_synced")),gn.addEventListener("memory_graph_changed",n("memory_graph_changed")),gn.addEventListener("notification",n("notification")),gn.addEventListener("connected",n("connected")),gn.onerror=()=>{gn==null||gn.close(),gn=null,Ys.size>0&&(Ou=setTimeout(Xk,3e3))}}function CR(){Ou&&(clearTimeout(Ou),Ou=null),gn==null||gn.close(),gn=null}function NR(e){return Ys.add(e),Ys.size===1&&Xk(),()=>{Ys.delete(e),Ys.size===0&&CR()}}function Ji(e){const t=w.useRef(e);t.current=e,w.useEffect(()=>NR(n=>t.current(n)),[])}function po(e,t,n={}){var f;const r=w.useRef(t),s=w.useRef(null);r.current=t;const c=n.debounceMs??kR,u=w.useMemo(()=>n.layers??[],[(f=n.layers)==null?void 0:f.join("|")]),d=w.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]);Ji(w.useCallback(h=>{h.type==="memory_graph_changed"&&jR(h.data,e,u)&&(d(),s.current=setTimeout(()=>{s.current=null,r.current(h.data)},c))},[d,e,c,u])),w.useEffect(()=>d,[d])}function Ul(e,t,n={}){const r=w.useRef(e);r.current=e;const s=w.useRef(n);s.current=n,w.useEffect(()=>{if(t<=0)return;let c=null,u=!1;const d=()=>{c||u||(c=setInterval(()=>r.current(),t))},f=()=>{c&&(clearInterval(c),c=null)},h=()=>{if(document.hidden){f();return}r.current(),d()};return s.current.runImmediately!==!1&&!document.hidden&&r.current(),document.hidden||d(),document.addEventListener("visibilitychange",h),()=>{u=!0,document.removeEventListener("visibilitychange",h),f()}},[t])}const ER="No pending join request found";function TR(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 AR(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});return t.sort((n,r)=>r.ts-n.ts),t}function px(e){return e.filter(t=>t.type!=="join_request"&&t.read===0).map(t=>t.id)}function fx(e){const t=e instanceof Error?e.message:String(e);if(t.includes(ER))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 RR(){const[e,t]=w.useState(null),[n,r]=w.useState("loading"),[s,c]=w.useState(!1),u=w.useRef(!1),d=w.useCallback(()=>{Tn.fetchNotificationsFeed().then(N=>{u.current=!0,t(N),c(!1),r(N.scopeUnknown?"identity-pending":"ready")}).catch(()=>{u.current?c(!0):r("error")})},[]);Ul(d,6e4);const f=w.useRef(null),h=w.useCallback(()=>{f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{f.current=null,d()},400)},[d]);w.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),Ji(w.useCallback(N=>{N.type==="notification"&&h()},[h]));const g=w.useMemo(()=>TR((e==null?void 0:e.notifications)??[]),[e]),m=w.useMemo(()=>AR((e==null?void 0:e.notifications)??[]),[e]),y=(e==null?void 0:e.badgeCount)??0,b=w.useMemo(()=>px((e==null?void 0:e.notifications)??[]).length>0,[e]),k=w.useCallback(N=>{N.length!==0&&(t(R=>{if(!R)return R;const H=new Set(N.map(String));return{...R,notifications:R.notifications.map(A=>H.has(String(A.id))?{...A,read:1}:A)}}),Kk(N).then(d).catch(()=>{}))},[d]),j=w.useCallback(()=>{k(px((e==null?void 0:e.notifications)??[]))},[e,k]),E=w.useCallback(async(N,R)=>{try{return await eg(N,R),d(),{ok:!0}}catch(H){const A=fx(H);return A.ok&&A.alreadyHandled&&d(),A}},[d]),S=w.useCallback(async(N,R)=>{try{return await tg(N,R),d(),{ok:!0}}catch(H){const A=fx(H);return A.ok&&A.alreadyHandled&&d(),A}},[d]),T=w.useCallback(()=>{c(!1),r(u.current?"ready":"loading"),d()},[d]);return{joinRequests:g,activity:m,unread:y,hasInformationalUnread:b,status:n,refreshError:s,partialActivityError:!1,approve:E,deny:S,markSeen:k,markAllInformationalSeen:j,retry:T}}function Qu(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 s=new Date(t);if(s.setDate(t.getDate()-1),n.toDateString()===s.toDateString())return`Yesterday ${n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}`;const c=t.getTime()-n.getTime();return c>=0&&c<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"})}function sg(e,t){return e&&e.trim()?e:t.length>20?`${t.slice(0,16)}…`:t}function hx(e){return e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e}function _R({item:e,onApprove:t,onDeny:n,onOpen:r}){var g;const[s,c]=w.useState({kind:"idle"}),u=sg(e.contextGraphName,e.cgId),d=((g=e.agentName)==null?void 0:g.trim())||hx(e.agentAddress),f=async m=>{c({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 ${u}`:`Request from ${d} declined`;c({kind:"done",label:k})}else{const k=b.roleError?`You're no longer the curator of ${u}`:m==="approve"?"Couldn’t approve":"Couldn’t deny";c({kind:"error",action:m,message:k})}};if(s.kind==="done")return o.jsxs("div",{className:"v10-notif-row v10-notif-row-terminal",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"v10-notif-glyph","aria-hidden":"true",children:"✓"}),o.jsx("span",{className:"v10-notif-terminal-text",children:s.label})]});const h=s.kind==="working";return o.jsxs("div",{className:"v10-notif-row v10-notif-row-join",children:[o.jsx("span",{className:"v10-notif-glyph v10-notif-glyph-join","aria-hidden":"true",children:"🔑"}),o.jsxs("div",{className:"v10-notif-row-body",children:[o.jsx("div",{className:"v10-notif-row-title",children:"Join request"}),o.jsxs("div",{className:"v10-notif-row-detail",children:[o.jsx("span",{className:"v10-notif-actor",children:d})," wants to join"," ",o.jsx("button",{type:"button",className:"v10-notif-cg-link",onClick:()=>r(e.cgId),title:`Open ${u}`,children:u})]}),o.jsxs("div",{className:"v10-notif-row-sub",children:[o.jsx("span",{className:"v10-notif-addr",title:e.agentAddress,children:hx(e.agentAddress)}),o.jsx("span",{className:"v10-notif-dot",children:"·"}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Qu(e.ts)})]}),s.kind==="error"&&o.jsxs("div",{className:"v10-notif-row-error",role:"status","aria-live":"polite",children:[s.message," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:()=>f(s.action),children:"Retry"})]}),o.jsx("span",{className:"v10-sr-only",role:"status","aria-live":"polite",children:h?s.action==="approve"?"Approving…":"Denying…":""})]}),o.jsx("div",{className:"v10-notif-row-actions",children:s.kind==="confirming-deny"?o.jsxs("span",{className:"v10-notif-deny-confirm",role:"group","aria-label":"Confirm deny",onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),c({kind:"idle"}))},onBlur:m=>{m.currentTarget.contains(m.relatedTarget)||c({kind:"idle"})},children:[o.jsx("span",{className:"v10-notif-deny-confirm-label",children:"Deny?"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-deny",onClick:()=>f("deny"),"aria-label":`Confirm deny join request from ${d} for ${u}`,children:"Yes"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>c({kind:"idle"}),autoFocus:!0,children:"Cancel"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-approve",onClick:()=>f("approve"),disabled:h,"aria-label":`Approve join request from ${d} for ${u}`,children:h&&s.action==="approve"?"…":"Approve"}),o.jsx("button",{type:"button",className:"v10-notif-btn v10-notif-btn-ghost",onClick:()=>c({kind:"confirming-deny"}),disabled:h,"aria-label":`Deny join request from ${d} for ${u}`,children:h&&s.action==="deny"?"…":"Deny"})]})})]})}const OR={created:"+",promoted:"⇡",published:"◉"};function LR(e,t,n){const r=t,s=r===1?"assertion":"assertions";return e==="created"?n?`${n} added ${r} ${s}`:`${r} new ${s} added`:e==="promoted"?n?`${n} promoted ${r} ${s}`:`${r} ${s} promoted`:n?`${n} published ${r} ${s} to Verifiable Memory`:`${r} ${s} published to Verifiable Memory`}function zR({item:e,onOpen:t}){var d;const n=sg(e.contextGraphName,e.cgId),r=e.bySelf?"You":((d=e.actorAgentName)==null?void 0:d.trim())||void 0,s=LR(e.event,e.count,r),c=Qu(e.ts),u=`${s} in ${n}${c?`, ${c}`:""}. Open ${n} recent activity.`;return o.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":u,children:[o.jsx("span",{className:`v10-notif-glyph v10-notif-glyph-${e.event}`,"aria-hidden":"true",children:OR[e.event]}),o.jsx("span",{className:"v10-notif-row-body","aria-hidden":"true",children:o.jsxs("span",{className:"v10-notif-row-detail",children:[s," in ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]})}),o.jsx("span",{className:"v10-notif-time","aria-hidden":"true",title:new Date(e.ts).toLocaleString(),children:c})]})}function MR({item:e,onOpen:t}){const n=sg(e.contextGraphName,e.cgId),r=e.kind==="join_approved",s=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`v10-notif-glyph ${r?"v10-notif-glyph-approved":"v10-notif-glyph-rejected"}`,"aria-hidden":"true",children:r?"✓":"✕"}),o.jsxs("span",{className:"v10-notif-row-body",children:[o.jsx("span",{className:"v10-notif-row-title",children:r?"Request approved":"Request declined"}),o.jsx("span",{className:"v10-notif-row-detail",children:r?o.jsxs(o.Fragment,{children:["You can now access ",o.jsx("span",{className:"v10-notif-cg-name",children:n})]}):o.jsxs(o.Fragment,{children:["Your request to join ",o.jsx("span",{className:"v10-notif-cg-name",children:n})," wasn’t approved"]})})]}),o.jsx("span",{className:"v10-notif-time",title:new Date(e.ts).toLocaleString(),children:Qu(e.ts)})]});if(r){const c=Qu(e.ts);return o.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}${c?`, ${c}`:""}. Open ${n}.`,children:s})}return o.jsx("div",{className:`v10-notif-row v10-notif-row-confirm v10-notif-confirm-rejected${e.read?"":" v10-notif-unread"}`,"aria-disabled":"true",children:s})}function DR({feed:e,onOpenContextGraph:t,id:n,paneRef:r}){const{joinRequests:s,activity:c,status:u,refreshError:d,partialActivityError:f,hasInformationalUnread:h,approve:g,deny:m,markSeen:y,markAllInformationalSeen:b}=e,k=(T,N)=>{y([N]),t(T)},j=s.length>0,E=c.length>0,S=!j&&!E;return o.jsxs("div",{className:"v10-notif-pane",role:"region","aria-label":"Notifications",id:n,ref:r,tabIndex:-1,children:[o.jsxs("div",{className:"v10-notif-pane-titlebar",children:[o.jsx("div",{className:"v10-notif-pane-title",children:"Notifications"}),h&&o.jsx("button",{type:"button",className:"v10-notif-pane-markread",onClick:b,title:"Mark informational notifications as read",children:"Mark all read"})]}),o.jsx("div",{className:"v10-notif-pane-body",children:u==="identity-pending"?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Verifying access…"}):u==="loading"&&S?o.jsx("div",{className:"v10-notif-pane-state",role:"status",children:"Loading notifications…"}):u==="error"&&S?o.jsxs("div",{className:"v10-notif-pane-error",role:"status","aria-live":"polite",children:["Couldn’t load notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}):S?o.jsxs("div",{className:"v10-notif-pane-empty",role:"status",children:[o.jsx("div",{className:"v10-notif-pane-empty-lead",children:"You’re all caught up."}),o.jsx("div",{className:"v10-notif-pane-empty-sub",children:"Join requests, approvals, and new activity in your context graphs will show up here."})]}):o.jsxs(o.Fragment,{children:[d&&o.jsxs("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:["Couldn’t refresh notifications."," ",o.jsx("button",{type:"button",className:"v10-notif-retry",onClick:e.retry,children:"Retry"})]}),j&&o.jsxs("section",{className:"v10-notif-section v10-notif-section-action","aria-label":"Needs your action",children:[o.jsxs("div",{className:"v10-notif-section-head",children:[o.jsx("span",{className:"v10-notif-section-label",children:"Needs your action"}),o.jsx("span",{className:"v10-notif-section-count",children:s.length})]}),o.jsx("div",{className:"v10-notif-section-rows",children:s.map(T=>o.jsx(_R,{item:T,onApprove:g,onDeny:m,onOpen:t},T.id))})]}),o.jsxs("section",{className:"v10-notif-section v10-notif-section-activity","aria-label":"Activity",children:[o.jsx("div",{className:"v10-notif-section-head",children:o.jsx("span",{className:"v10-notif-section-label",children:"Activity"})}),f&&o.jsx("div",{className:"v10-notif-pane-error v10-notif-pane-error-inline",role:"status","aria-live":"polite",children:"Recent activity couldn’t load."}),E?o.jsx("div",{className:"v10-notif-section-rows",children:c.map(T=>T.kind==="digest"?o.jsx(zR,{item:T,onOpen:N=>k(N,T.id)},T.id):o.jsx(MR,{item:T,onOpen:N=>k(N,T.id)},T.id))}):!f&&o.jsx("div",{className:"v10-notif-section-empty",children:"No recent activity."})]})]})})]})}const $R=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),o.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),mx="v10-notifications-pane";function IR(){const e=RR(),[t,n]=w.useState(!1),r=w.useRef(null),s=w.useRef(null),c=Na(m=>m.setActiveProject),{openTab:u}=vn(),d=w.useRef(null),f=w.useCallback((m=!1)=>{var y;n(!1),m&&((y=s.current)==null||y.focus())},[]);w.useEffect(()=>{if(!t)return;const m=y=>{r.current&&!r.current.contains(y.target)&&f()};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[t,f]),w.useEffect(()=>{if(!t)return;const m=d.current;if(!m)return;const y=m.querySelector(".v10-notif-section-action .v10-notif-btn-approve"),b=m.querySelector(".v10-notif-section-rows button, .v10-notif-section-rows a[href]"),k=m.querySelector('button:not(.v10-notif-pane-markread), [href], [tabindex]:not([tabindex="-1"])');(y??b??k??m).focus()},[t]);const h=w.useCallback(m=>{c(m),u({id:`project:${m}`,label:m.slice(0,16),closable:!0}),f()},[c,u,f]),g=e.unread;return o.jsxs("div",{className:"v10-header-notif-wrap",ref:r,onKeyDown:t?m=>{m.key==="Escape"&&(m.stopPropagation(),f(!0))}:void 0,children:[o.jsxs("button",{ref:s,className:"v10-header-icon-btn",onClick:()=>n(m=>!m),title:g>0?`Notifications (${g} unread)`:"Notifications","aria-label":g>0?`Notifications, ${g} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":t,"aria-controls":t?mx:void 0,children:[$R,g>0&&o.jsx("span",{className:"v10-header-notif-badge",children:g})]}),t&&o.jsx(DR,{id:mx,paneRef:d,feed:e,onOpenContextGraph:h})]})}function PR(e,t,n,r,s){const c=[e?"Synced with the network":"Syncing with the network",`${t} peer${t===1?"":"s"} (${n} direct, ${r} relayed)`];return s>0&&c.push(`Uptime ${UR(s)}`),c.join(`
|
|
99
|
-
`)}function UR(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),s=Math.floor(t%3600/60),c=[];return n>0&&c.push(`${n}d`),(r>0||n>0)&&c.push(`${r}h`),c.push(`${s}m`),c.join(" ")}const BR=o.jsx("span",{className:"v10-header-ot-wordmark",children:o.jsxs("svg",{width:"60",height:"13",viewBox:"0 0 180 40",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"}),o.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"})]})}),FR=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("circle",{cx:"12",cy:"12",r:"5"}),o.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),o.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),o.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),o.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),o.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),o.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),o.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),o.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),HR=o.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),qR=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),GR=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21"})]}),VR=o.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"12",cy:"12",r:"3"}),o.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"})]}),WR=o.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})});function ZR(){var E,S;const{theme:e,setTheme:t,leftCollapsed:n,toggleLeft:r,rightCollapsed:s,toggleRight:c}=qn(),u=Pk(T=>T.nodeStatus),d=xd().data,{openTab:f}=vn(),h=(u==null?void 0:u.connectedPeers)??(u==null?void 0:u.peerCount)??0,g=((E=u==null?void 0:u.connections)==null?void 0:E.direct)??0,m=((S=u==null?void 0:u.connections)==null?void 0:S.relayed)??0,y=(u==null?void 0:u.uptimeMs)??0,k=u!=null&&(u==null?void 0:u.synced)!==!1,j=PR(k,h,g,m,y);return o.jsxs("header",{className:"v10-header",children:[o.jsxs("div",{className:"v10-header-logo",children:[o.jsxs("span",{className:"v10-header-logo-text",children:["DKG ",o.jsx("span",{className:"v10-header-logo-version",children:"v10"})]}),o.jsxs("div",{className:"v10-header-logo-ot","aria-label":"Powered by OriginTrail",children:[o.jsx("span",{className:"v10-header-logo-ot-by",children:"powered by"}),BR]})]}),o.jsx("button",{className:`v10-header-icon-btn ${n?"":"active-toggle"}`,onClick:r,title:"Toggle sidebar",children:qR}),o.jsx("div",{className:"v10-header-sep"}),o.jsxs("div",{className:"v10-header-agent-switcher",title:d?`${d.agentDid}
|
|
100
|
-
${d.agentAddress}`:void 0,children:[o.jsx("span",{className:"v10-header-agent-dot"}),o.jsx("span",{className:"v10-header-agent-name",children:(d!=null&&d.name&&d.name!=="**"?d.name:null)||(u==null?void 0:u.name)||"Agent"}),(d==null?void 0:d.agentAddress)&&o.jsxs("span",{className:"v10-header-agent-addr",children:[d.agentAddress.slice(0,6),"…",d.agentAddress.slice(-4)]})]}),o.jsx("div",{className:"v10-header-spacer"}),o.jsxs("div",{className:"v10-header-meta",title:j,children:[o.jsx("span",{className:`v10-header-status-dot ${k?"online":"offline"}`}),o.jsx("span",{children:k?"synced":"syncing"}),o.jsx("span",{className:"v10-header-meta-sep",children:"·"}),o.jsxs("span",{children:[h," peer",h!==1?"s":""]})]}),o.jsxs("div",{className:"v10-header-actions",children:[o.jsx(IR,{}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"operations",label:"Observability",closable:!0}),title:"Observability",children:WR}),o.jsx("button",{className:"v10-header-icon-btn",onClick:()=>f({id:"settings",label:"Settings",closable:!0}),title:"Settings",children:VR}),o.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"?FR:HR}),o.jsx("button",{className:`v10-header-icon-btn ${s?"":"active-toggle"}`,onClick:c,title:"Toggle agent panel",children:GR})]})]})}/**
|
|
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 Jk=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/**
|
|
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 YR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
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
|
-
*/const QR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
|
|
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 gx=e=>{const t=QR(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
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
|
-
*/var rh={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"};/**
|
|
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 KR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},XR=w.createContext({}),JR=()=>w.useContext(XR),e_=w.forwardRef(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:s="",children:c,iconNode:u,...d},f)=>{const{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:m=!1,color:y="currentColor",className:b=""}=JR()??{},k=r??m?Number(n??g)*24/Number(t??h):n??g;return w.createElement("svg",{ref:f,...rh,width:t??h??rh.width,height:t??h??rh.height,stroke:e??y,strokeWidth:k,className:Jk("lucide",b,s),...!c&&!KR(d)&&{"aria-hidden":"true"},...d},[...u.map(([j,E])=>w.createElement(j,E)),...Array.isArray(c)?c:[c]])});/**
|
|
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 on=(e,t)=>{const n=w.forwardRef(({className:r,...s},c)=>w.createElement(e_,{ref:c,iconNode:t,className:Jk(`lucide-${YR(gx(e))}`,`lucide-${e}`,r),...s}));return n.displayName=gx(e),n};/**
|
|
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 t_=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],n_=on("arrow-down",t_);/**
|
|
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 a_=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],r_=on("arrow-up",a_);/**
|
|
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 i_=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],s_=on("ban",i_);/**
|
|
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 o_=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],l_=on("check",o_);/**
|
|
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 c_=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],u_=on("chevron-down",c_);/**
|
|
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 d_=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],nm=on("chevron-right",d_);/**
|
|
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 p_=[["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"}]],f_=on("copy",p_);/**
|
|
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 h_=[["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"}]],m_=on("ellipsis",h_);/**
|
|
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 g_=[["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"}]],v_=on("folder",g_);/**
|
|
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 y_=[["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"}]],b_=on("globe",y_);/**
|
|
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 x_=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],w_=on("loader-circle",x_);/**
|
|
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 k_=[["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"}]],S_=on("lock",k_);/**
|
|
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 j_=[["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"}]],C_=on("paperclip",j_);/**
|
|
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 N_=[["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"}]],vx=on("share-2",N_);/**
|
|
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 E_=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],T_=on("square",E_);/**
|
|
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 A_=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],R_=on("trending-up",A_);/**
|
|
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 __=[["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"}]],O_=on("upload",__);/**
|
|
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 L_=[["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"}]],z_=on("users-round",L_);/**
|
|
226
|
-
* @license lucide-react v1.14.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const M_=[["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"}]],D_=on("wallet",M_);/**
|
|
231
|
-
* @license lucide-react v1.14.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const $_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],I_=on("x",$_);function P_(){const e=localStorage.getItem("dkg-journey-stage");return e==="1"?1:e==="2"?2:0}const og=Pl((e,t)=>({stage:P_(),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})}})),U_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
236
|
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
237
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
238
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
239
|
-
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
240
|
-
@prefix schema: <http://schema.org/> .
|
|
241
|
-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
242
|
-
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
243
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
244
|
-
@prefix bibo: <http://purl.org/ontology/bibo/> .
|
|
245
|
-
@prefix fabio: <http://purl.org/spar/fabio/> .
|
|
246
|
-
@prefix cito: <http://purl.org/spar/cito/> .
|
|
247
|
-
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
|
|
248
|
-
|
|
249
|
-
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
250
|
-
@prefix dkg: <http://dkg.io/ontology/> .
|
|
251
|
-
@prefix : <http://dkg.io/ontology/book-research/> .
|
|
252
|
-
|
|
253
|
-
<http://dkg.io/ontology/book-research/>
|
|
254
|
-
a owl:Ontology ;
|
|
255
|
-
dcterms:title "DKG Book Research Project Ontology (v1)" ;
|
|
256
|
-
dcterms:description """Starter ontology for projects that research and
|
|
257
|
-
write books, papers, or long-form non-fiction. Built on schema.org +
|
|
258
|
-
BIBO + the SPAR family (FaBiO, CiTO) + FRBR + SKOS so it composes with
|
|
259
|
-
existing scholarly publishing infrastructure.""" ;
|
|
260
|
-
owl:versionInfo "1.0.0" ;
|
|
261
|
-
dcterms:created "2026-04-18"^^xsd:date ;
|
|
262
|
-
owl:imports
|
|
263
|
-
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
264
|
-
<http://www.w3.org/ns/prov#> , <http://xmlns.com/foaf/0.1/> ,
|
|
265
|
-
<http://www.w3.org/2004/02/skos/core#> ,
|
|
266
|
-
<http://purl.org/ontology/bibo/> ,
|
|
267
|
-
<http://purl.org/spar/fabio/> ,
|
|
268
|
-
<http://purl.org/spar/cito/> ,
|
|
269
|
-
<http://purl.org/vocab/frbr/core#> .
|
|
270
|
-
|
|
271
|
-
# ─── Universal annotation predicates (shared across all starters) ───
|
|
272
|
-
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
273
|
-
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
274
|
-
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
|
|
275
|
-
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range owl:Thing .
|
|
276
|
-
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
|
|
277
|
-
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
278
|
-
|
|
279
|
-
# ─── Universal annotation entities ──────────────────────────────────
|
|
280
|
-
:Concept rdfs:subClassOf skos:Concept .
|
|
281
|
-
:Topic rdfs:subClassOf skos:Concept .
|
|
282
|
-
:Question rdfs:subClassOf schema:Question .
|
|
283
|
-
:Finding rdfs:subClassOf prov:Entity .
|
|
284
|
-
|
|
285
|
-
# ─── Book-research specific ─────────────────────────────────────────
|
|
286
|
-
|
|
287
|
-
:Hypothesis a owl:Class ;
|
|
288
|
-
rdfs:label "Hypothesis" ;
|
|
289
|
-
rdfs:comment "A claim under investigation. Supersedes when refuted; promotes to a Finding when supported." ;
|
|
290
|
-
rdfs:subClassOf prov:Entity .
|
|
291
|
-
|
|
292
|
-
:Argument a owl:Class ;
|
|
293
|
-
rdfs:label "Argument" ;
|
|
294
|
-
rdfs:comment "A reasoned position taken on a Hypothesis or other entity." ;
|
|
295
|
-
rdfs:subClassOf prov:Entity .
|
|
296
|
-
|
|
297
|
-
:Counterexample a owl:Class ;
|
|
298
|
-
rdfs:label "Counterexample" ;
|
|
299
|
-
rdfs:comment "Evidence that refutes a Hypothesis or Argument." ;
|
|
300
|
-
rdfs:subClassOf prov:Entity .
|
|
301
|
-
|
|
302
|
-
:Quote a owl:Class ;
|
|
303
|
-
rdfs:label "Quote" ;
|
|
304
|
-
rdfs:comment "Verbatim passage extracted from a source. Subclass of bibo:Quote so it composes with bibliographic tools." ;
|
|
305
|
-
rdfs:subClassOf bibo:Quote .
|
|
306
|
-
|
|
307
|
-
:supports a owl:ObjectProperty ;
|
|
308
|
-
rdfs:label "supports" ;
|
|
309
|
-
rdfs:comment "An Argument or Quote supports a Hypothesis." ;
|
|
310
|
-
rdfs:subPropertyOf cito:agreesWith .
|
|
311
|
-
|
|
312
|
-
:refutes a owl:ObjectProperty ;
|
|
313
|
-
rdfs:label "refutes" ;
|
|
314
|
-
rdfs:comment "An Argument, Counterexample, or Quote refutes a Hypothesis." ;
|
|
315
|
-
rdfs:subPropertyOf cito:disagreesWith .
|
|
316
|
-
|
|
317
|
-
:cites a owl:ObjectProperty ;
|
|
318
|
-
rdfs:label "cites" ;
|
|
319
|
-
rdfs:subPropertyOf cito:cites ;
|
|
320
|
-
rdfs:range bibo:Document .
|
|
321
|
-
|
|
322
|
-
# ─── URI patterns ───────────────────────────────────────────────────
|
|
323
|
-
:UriPattern rdfs:label "URI minting pattern" .
|
|
324
|
-
|
|
325
|
-
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
326
|
-
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
327
|
-
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
328
|
-
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
329
|
-
:hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
|
|
330
|
-
:argument-pattern a :UriPattern ; skos:notation "urn:dkg:argument:<slug>" .
|
|
331
|
-
:quote-pattern a :UriPattern ; skos:notation "urn:dkg:quote:<slug>" .
|
|
332
|
-
:citation-pattern a :UriPattern ; skos:notation "urn:dkg:citation:<slug>" ;
|
|
333
|
-
skos:definition "Bibliographic citation; aligned with bibo:Document via cito:cites." .
|
|
334
|
-
|
|
335
|
-
:slug-normalisation a skos:Note ;
|
|
336
|
-
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." .
|
|
337
|
-
`,B_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
338
|
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
339
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
340
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
341
|
-
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
342
|
-
@prefix schema: <http://schema.org/> .
|
|
343
|
-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
344
|
-
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
345
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
346
|
-
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
|
347
|
-
|
|
348
|
-
# DKG project namespaces — v1 ontology for any "coding project"
|
|
349
|
-
# context graph. Imports widely-adopted Linked Data vocabs first;
|
|
350
|
-
# only declares extensions for genuinely net-new concepts.
|
|
351
|
-
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
352
|
-
@prefix code: <http://dkg.io/ontology/code/> .
|
|
353
|
-
@prefix github: <http://dkg.io/ontology/github/> .
|
|
354
|
-
@prefix decisions: <http://dkg.io/ontology/decisions/> .
|
|
355
|
-
@prefix tasks: <http://dkg.io/ontology/tasks/> .
|
|
356
|
-
@prefix agent: <http://dkg.io/ontology/agent/> .
|
|
357
|
-
@prefix dkg: <http://dkg.io/ontology/> .
|
|
358
|
-
|
|
359
|
-
@prefix : <http://dkg.io/ontology/coding-project/> .
|
|
360
|
-
|
|
361
|
-
# ─── Ontology header ────────────────────────────────────────────────
|
|
362
|
-
<http://dkg.io/ontology/coding-project/>
|
|
363
|
-
a owl:Ontology ;
|
|
364
|
-
dcterms:title "DKG Coding Project Ontology (v1)" ;
|
|
365
|
-
dcterms:description """The starter ontology for any DKG context graph that
|
|
366
|
-
represents a software project — its decisions, tasks, code structure, GitHub
|
|
367
|
-
activity, agents, and chat. Designed to be \`owl:imports\`-ed by per-project
|
|
368
|
-
ontologies, which add their own extensions on top.
|
|
369
|
-
|
|
370
|
-
Every predicate is either reused from a globally-adopted vocabulary
|
|
371
|
-
(schema.org, DCTerms, PROV-O, FOAF, SKOS, DOAP) or declared here as a
|
|
372
|
-
project-specific extension. Companion document \`agent-guide.md\` translates
|
|
373
|
-
this formal model into operational instructions for AI coding agents.""" ;
|
|
374
|
-
dcterms:creator "branarakic" ;
|
|
375
|
-
owl:versionInfo "1.0.0" ;
|
|
376
|
-
dcterms:created "2026-04-18"^^xsd:date ;
|
|
377
|
-
owl:imports
|
|
378
|
-
<http://schema.org/> ,
|
|
379
|
-
<http://purl.org/dc/terms/> ,
|
|
380
|
-
<http://www.w3.org/ns/prov#> ,
|
|
381
|
-
<http://xmlns.com/foaf/0.1/> ,
|
|
382
|
-
<http://www.w3.org/2004/02/skos/core#> ,
|
|
383
|
-
<http://usefulinc.com/ns/doap#> .
|
|
384
|
-
|
|
385
|
-
# ─── Section 1 — Universal annotation primitives ────────────────────
|
|
386
|
-
# Predicates expressing what each chat turn was ABOUT — written into
|
|
387
|
-
# the project's \`chat\` sub-graph by the capture-chat hook (and later
|
|
388
|
-
# read by \`dkg_query\` / \`dkg_memory_search\`). These predicates apply
|
|
389
|
-
# to ANY project type, not just coding.
|
|
390
|
-
|
|
391
|
-
chat:topic
|
|
392
|
-
a owl:DatatypeProperty ;
|
|
393
|
-
rdfs:label "topic" ;
|
|
394
|
-
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." ;
|
|
395
|
-
rdfs:domain chat:Turn ;
|
|
396
|
-
rdfs:range xsd:string .
|
|
397
|
-
|
|
398
|
-
chat:mentions
|
|
399
|
-
a owl:ObjectProperty ;
|
|
400
|
-
rdfs:label "mentions" ;
|
|
401
|
-
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)." ;
|
|
402
|
-
rdfs:domain chat:Turn ;
|
|
403
|
-
rdfs:range owl:Thing ;
|
|
404
|
-
rdfs:subPropertyOf schema:mentions .
|
|
405
|
-
|
|
406
|
-
chat:examines
|
|
407
|
-
a owl:ObjectProperty ;
|
|
408
|
-
rdfs:label "examines" ;
|
|
409
|
-
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." ;
|
|
410
|
-
rdfs:domain chat:Turn ;
|
|
411
|
-
rdfs:range owl:Thing .
|
|
412
|
-
|
|
413
|
-
chat:proposes
|
|
414
|
-
a owl:ObjectProperty ;
|
|
415
|
-
rdfs:label "proposes" ;
|
|
416
|
-
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." ;
|
|
417
|
-
rdfs:domain chat:Turn ;
|
|
418
|
-
rdfs:range owl:Thing .
|
|
419
|
-
|
|
420
|
-
chat:concludes
|
|
421
|
-
a owl:ObjectProperty ;
|
|
422
|
-
rdfs:label "concludes" ;
|
|
423
|
-
rdfs:comment "A Finding entity the chat turn produced — a claim worth preserving as a first-class node, separate from the turn body." ;
|
|
424
|
-
rdfs:domain chat:Turn ;
|
|
425
|
-
rdfs:range :Finding .
|
|
426
|
-
|
|
427
|
-
chat:asks
|
|
428
|
-
a owl:ObjectProperty ;
|
|
429
|
-
rdfs:label "asks" ;
|
|
430
|
-
rdfs:comment "A Question entity the chat turn left open. Tracking these lets a future query surface 'what did we never resolve?'." ;
|
|
431
|
-
rdfs:domain chat:Turn ;
|
|
432
|
-
rdfs:range :Question .
|
|
433
|
-
|
|
434
|
-
# ─── Section 2 — Universal annotation entity classes ────────────────
|
|
435
|
-
|
|
436
|
-
:Concept
|
|
437
|
-
a owl:Class ;
|
|
438
|
-
rdfs:label "Concept" ;
|
|
439
|
-
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." ;
|
|
440
|
-
rdfs:subClassOf skos:Concept .
|
|
441
|
-
|
|
442
|
-
:Topic
|
|
443
|
-
a owl:Class ;
|
|
444
|
-
rdfs:label "Topic" ;
|
|
445
|
-
rdfs:comment "A broad topical bucket grouping related concepts/turns/entities. URI pattern: urn:dkg:topic:<slug>." ;
|
|
446
|
-
rdfs:subClassOf skos:Concept .
|
|
447
|
-
|
|
448
|
-
:Question
|
|
449
|
-
a owl:Class ;
|
|
450
|
-
rdfs:label "Question" ;
|
|
451
|
-
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." ;
|
|
452
|
-
rdfs:subClassOf schema:Question .
|
|
453
|
-
|
|
454
|
-
:Finding
|
|
455
|
-
a owl:Class ;
|
|
456
|
-
rdfs:label "Finding" ;
|
|
457
|
-
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." ;
|
|
458
|
-
rdfs:subClassOf prov:Entity .
|
|
459
|
-
|
|
460
|
-
:answers
|
|
461
|
-
a owl:ObjectProperty ;
|
|
462
|
-
rdfs:label "answers" ;
|
|
463
|
-
rdfs:comment "Links a Finding (or chat turn) to the Question it resolves." ;
|
|
464
|
-
rdfs:domain owl:Thing ;
|
|
465
|
-
rdfs:range :Question .
|
|
466
|
-
|
|
467
|
-
:supersedes
|
|
468
|
-
a owl:ObjectProperty ;
|
|
469
|
-
rdfs:label "supersedes" ;
|
|
470
|
-
rdfs:comment "This entity replaces an older one (e.g. a revised Finding supersedes an earlier one)." ;
|
|
471
|
-
rdfs:range owl:Thing ;
|
|
472
|
-
owl:inverseOf prov:wasRevisionOf .
|
|
473
|
-
|
|
474
|
-
# ─── Section 3 — Coding-project-specific classes ────────────────────
|
|
475
|
-
# Formalises the predicates already used informally in
|
|
476
|
-
# scripts/lib/ontology.mjs, anchoring them in PROV-O and schema.org.
|
|
477
|
-
|
|
478
|
-
decisions:Decision
|
|
479
|
-
a owl:Class ;
|
|
480
|
-
rdfs:label "Decision" ;
|
|
481
|
-
rdfs:comment "An architectural decision the project made — context, outcome, consequences. Modelled as a prov:Activity because it represents a deliberate act of choosing." ;
|
|
482
|
-
rdfs:subClassOf prov:Activity, schema:Action .
|
|
483
|
-
|
|
484
|
-
decisions:context
|
|
485
|
-
a owl:DatatypeProperty ;
|
|
486
|
-
rdfs:label "context" ;
|
|
487
|
-
rdfs:domain decisions:Decision ;
|
|
488
|
-
rdfs:range xsd:string ;
|
|
489
|
-
rdfs:comment "Why this decision was being made — problem, constraints, alternatives considered." .
|
|
490
|
-
|
|
491
|
-
decisions:outcome
|
|
492
|
-
a owl:DatatypeProperty ;
|
|
493
|
-
rdfs:label "outcome" ;
|
|
494
|
-
rdfs:domain decisions:Decision ;
|
|
495
|
-
rdfs:range xsd:string ;
|
|
496
|
-
rdfs:comment "The chosen direction — the decision itself, in one paragraph." .
|
|
497
|
-
|
|
498
|
-
decisions:consequences
|
|
499
|
-
a owl:DatatypeProperty ;
|
|
500
|
-
rdfs:label "consequences" ;
|
|
501
|
-
rdfs:domain decisions:Decision ;
|
|
502
|
-
rdfs:range xsd:string ;
|
|
503
|
-
rdfs:comment "What this implies going forward — trade-offs, follow-ups." .
|
|
504
|
-
|
|
505
|
-
decisions:status
|
|
506
|
-
a owl:DatatypeProperty ;
|
|
507
|
-
rdfs:label "status" ;
|
|
508
|
-
rdfs:domain decisions:Decision ;
|
|
509
|
-
rdfs:range xsd:string ;
|
|
510
|
-
rdfs:comment "One of: proposed | accepted | rejected | superseded." .
|
|
511
|
-
|
|
512
|
-
tasks:Task
|
|
513
|
-
a owl:Class ;
|
|
514
|
-
rdfs:label "Task" ;
|
|
515
|
-
rdfs:comment "A piece of planned or in-flight work on the project." ;
|
|
516
|
-
rdfs:subClassOf schema:Action .
|
|
517
|
-
|
|
518
|
-
tasks:status
|
|
519
|
-
a owl:DatatypeProperty ;
|
|
520
|
-
rdfs:label "status" ;
|
|
521
|
-
rdfs:domain tasks:Task ;
|
|
522
|
-
rdfs:range xsd:string ;
|
|
523
|
-
rdfs:comment "One of: todo | in_progress | blocked | done | cancelled." .
|
|
524
|
-
|
|
525
|
-
tasks:priority
|
|
526
|
-
a owl:DatatypeProperty ;
|
|
527
|
-
rdfs:label "priority" ;
|
|
528
|
-
rdfs:domain tasks:Task ;
|
|
529
|
-
rdfs:range xsd:string ;
|
|
530
|
-
rdfs:comment "One of: p0 | p1 | p2 | p3." .
|
|
531
|
-
|
|
532
|
-
tasks:relatedDecision
|
|
533
|
-
a owl:ObjectProperty ;
|
|
534
|
-
rdfs:label "related decision" ;
|
|
535
|
-
rdfs:domain tasks:Task ;
|
|
536
|
-
rdfs:range decisions:Decision ;
|
|
537
|
-
rdfs:comment "The Decision this task implements or follows from." .
|
|
538
|
-
|
|
539
|
-
tasks:dependsOn
|
|
540
|
-
a owl:ObjectProperty ;
|
|
541
|
-
rdfs:label "depends on" ;
|
|
542
|
-
rdfs:domain tasks:Task ;
|
|
543
|
-
rdfs:range tasks:Task .
|
|
544
|
-
|
|
545
|
-
tasks:touches
|
|
546
|
-
a owl:ObjectProperty ;
|
|
547
|
-
rdfs:label "touches" ;
|
|
548
|
-
rdfs:domain tasks:Task ;
|
|
549
|
-
rdfs:range owl:Thing ;
|
|
550
|
-
rdfs:comment "A code:File or code:Package this task edits." .
|
|
551
|
-
|
|
552
|
-
# Code structure — aligned with schema:SoftwareSourceCode + DOAP.
|
|
553
|
-
|
|
554
|
-
code:Package
|
|
555
|
-
a owl:Class ;
|
|
556
|
-
rdfs:label "Package" ;
|
|
557
|
-
rdfs:subClassOf doap:Project, schema:SoftwareApplication .
|
|
558
|
-
|
|
559
|
-
code:File
|
|
560
|
-
a owl:Class ;
|
|
561
|
-
rdfs:label "Source file" ;
|
|
562
|
-
rdfs:subClassOf schema:SoftwareSourceCode .
|
|
563
|
-
|
|
564
|
-
code:Function a owl:Class ; rdfs:label "Function" .
|
|
565
|
-
code:Class a owl:Class ; rdfs:label "Class" .
|
|
566
|
-
code:Interface a owl:Class ; rdfs:label "Interface" .
|
|
567
|
-
|
|
568
|
-
# GitHub — minimal aliasing onto schema.org where sensible.
|
|
569
|
-
|
|
570
|
-
github:Repository
|
|
571
|
-
a owl:Class ;
|
|
572
|
-
rdfs:label "GitHub repository" ;
|
|
573
|
-
rdfs:subClassOf schema:SoftwareSourceCode, doap:Project .
|
|
574
|
-
|
|
575
|
-
github:PullRequest
|
|
576
|
-
a owl:Class ;
|
|
577
|
-
rdfs:label "Pull request" ;
|
|
578
|
-
rdfs:subClassOf schema:CreativeWork .
|
|
579
|
-
|
|
580
|
-
github:Issue
|
|
581
|
-
a owl:Class ;
|
|
582
|
-
rdfs:label "GitHub issue" ;
|
|
583
|
-
rdfs:subClassOf schema:Question, schema:CreativeWork .
|
|
584
|
-
|
|
585
|
-
# ─── Section 4 — Chat sub-graph classes ─────────────────────────────
|
|
586
|
-
|
|
587
|
-
chat:Session
|
|
588
|
-
a owl:Class ;
|
|
589
|
-
rdfs:label "Chat session" ;
|
|
590
|
-
rdfs:comment "One conversation between an operator and their coding assistant (Cursor window, Claude Code thread, etc.)." ;
|
|
591
|
-
rdfs:subClassOf schema:Conversation .
|
|
592
|
-
|
|
593
|
-
chat:Turn
|
|
594
|
-
a owl:Class ;
|
|
595
|
-
rdfs:label "Chat turn" ;
|
|
596
|
-
rdfs:comment "One user-prompt + assistant-response pair within a Session. Carries provenance via prov:wasAttributedTo." ;
|
|
597
|
-
rdfs:subClassOf schema:Message, prov:Entity .
|
|
598
|
-
|
|
599
|
-
chat:userPrompt a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
600
|
-
chat:assistantResponse a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
601
|
-
chat:turnIndex a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:integer .
|
|
602
|
-
chat:inSession a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range chat:Session .
|
|
603
|
-
chat:speakerTool a owl:DatatypeProperty ; rdfs:range xsd:string ;
|
|
604
|
-
rdfs:comment "Identifier of the coding assistant that produced the turn (e.g. 'cursor', 'claude-code')." .
|
|
605
|
-
chat:privacy a owl:DatatypeProperty ; rdfs:domain chat:Session ; rdfs:range xsd:string ;
|
|
606
|
-
rdfs:comment "One of: private | team | public. Controls auto-promote behaviour of the capture hook." .
|
|
607
|
-
|
|
608
|
-
# ─── Section 5 — Agent identity ─────────────────────────────────────
|
|
609
|
-
|
|
610
|
-
agent:Agent
|
|
611
|
-
a owl:Class ;
|
|
612
|
-
rdfs:label "Agent" ;
|
|
613
|
-
rdfs:subClassOf prov:Agent, foaf:Agent .
|
|
614
|
-
|
|
615
|
-
agent:HumanAgent rdfs:subClassOf agent:Agent, foaf:Person .
|
|
616
|
-
agent:AIAgent rdfs:subClassOf agent:Agent, schema:SoftwareApplication .
|
|
617
|
-
|
|
618
|
-
agent:framework
|
|
619
|
-
a owl:DatatypeProperty ;
|
|
620
|
-
rdfs:label "framework" ;
|
|
621
|
-
rdfs:domain agent:AIAgent ;
|
|
622
|
-
rdfs:range xsd:string ;
|
|
623
|
-
rdfs:comment "Name of the agent runtime — 'cursor', 'claude-code', 'openclaw', 'hermes', etc." .
|
|
624
|
-
|
|
625
|
-
agent:operator
|
|
626
|
-
a owl:ObjectProperty ;
|
|
627
|
-
rdfs:label "operator" ;
|
|
628
|
-
rdfs:domain agent:AIAgent ;
|
|
629
|
-
rdfs:range agent:HumanAgent ;
|
|
630
|
-
rdfs:comment "The human operator who runs and is responsible for this AI agent." .
|
|
631
|
-
|
|
632
|
-
# ─── Section 6 — URI minting conventions (machine-readable) ─────────
|
|
633
|
-
# These are encoded as SKOS notes so an agent reading the ontology can
|
|
634
|
-
# pull them out programmatically. The agent guide repeats them in
|
|
635
|
-
# prose for human readability.
|
|
636
|
-
|
|
637
|
-
:UriPattern
|
|
638
|
-
a owl:Class ;
|
|
639
|
-
rdfs:label "URI minting pattern" ;
|
|
640
|
-
rdfs:comment "Documents the URI shape the agent should produce when minting a new entity of a given type." .
|
|
641
|
-
|
|
642
|
-
:concept-pattern a :UriPattern ;
|
|
643
|
-
skos:notation "urn:dkg:concept:<slug>" ;
|
|
644
|
-
skos:definition "Free-text concept; aligned with skos:Concept." .
|
|
645
|
-
:topic-pattern a :UriPattern ;
|
|
646
|
-
skos:notation "urn:dkg:topic:<slug>" ;
|
|
647
|
-
skos:definition "Broad topical bucket grouping related entities." .
|
|
648
|
-
:question-pattern a :UriPattern ;
|
|
649
|
-
skos:notation "urn:dkg:question:<slug>" ;
|
|
650
|
-
skos:definition "An open question awaiting an answer." .
|
|
651
|
-
:finding-pattern a :UriPattern ;
|
|
652
|
-
skos:notation "urn:dkg:finding:<slug>" ;
|
|
653
|
-
skos:definition "A claim or observation worth preserving as a first-class node." .
|
|
654
|
-
:decision-pattern a :UriPattern ;
|
|
655
|
-
skos:notation "urn:dkg:decision:<slug>" ;
|
|
656
|
-
skos:definition "An architectural decision (coding-project specific)." .
|
|
657
|
-
:task-pattern a :UriPattern ;
|
|
658
|
-
skos:notation "urn:dkg:task:<slug>" ;
|
|
659
|
-
skos:definition "A piece of planned or in-flight work (coding-project specific)." .
|
|
660
|
-
|
|
661
|
-
# ─── Section 7 — Slug normalisation rule (deterministic) ────────────
|
|
662
|
-
|
|
663
|
-
:slug-normalisation a skos:Note ;
|
|
664
|
-
skos:prefLabel "slug normalisation" ;
|
|
665
|
-
skos:definition """To compute the canonical slug from a free-text label:
|
|
666
|
-
1. Lowercase.
|
|
667
|
-
2. Apply Unicode NFKD then strip combining marks (ASCII fold).
|
|
668
|
-
3. Strip common stopwords (the / a / an / of / for / and / or / to / in / on / with).
|
|
669
|
-
4. Replace any run of non-[a-z0-9] with a single hyphen.
|
|
670
|
-
5. Trim leading/trailing hyphens.
|
|
671
|
-
6. Truncate to 60 characters max.
|
|
672
|
-
|
|
673
|
-
Example: "the Tree-Sitter library", "Tree sitter", "TREE_SITTER" all
|
|
674
|
-
normalise to "tree-sitter". Always apply this BEFORE comparing free-text
|
|
675
|
-
recall results (\`dkg_memory_search\`) in the look-before-mint protocol.""" .
|
|
676
|
-
`,F_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
677
|
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
678
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
679
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
680
|
-
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
681
|
-
@prefix schema: <http://schema.org/> .
|
|
682
|
-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
683
|
-
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
684
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
685
|
-
@prefix bibo: <http://purl.org/ontology/bibo/> .
|
|
686
|
-
|
|
687
|
-
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
688
|
-
@prefix : <http://dkg.io/ontology/narrative-writing/> .
|
|
689
|
-
|
|
690
|
-
<http://dkg.io/ontology/narrative-writing/>
|
|
691
|
-
a owl:Ontology ;
|
|
692
|
-
dcterms:title "DKG Narrative Writing Project Ontology (v1)" ;
|
|
693
|
-
dcterms:description """Starter for fiction or narrative non-fiction
|
|
694
|
-
projects: novels, screenplays, biographies. Tracks Characters, Scenes,
|
|
695
|
-
Plot Points, Themes, and the relationships between them.""" ;
|
|
696
|
-
owl:versionInfo "1.0.0" ;
|
|
697
|
-
dcterms:created "2026-04-18"^^xsd:date ;
|
|
698
|
-
owl:imports
|
|
699
|
-
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
700
|
-
<http://xmlns.com/foaf/0.1/> ,
|
|
701
|
-
<http://www.w3.org/2004/02/skos/core#> ,
|
|
702
|
-
<http://purl.org/ontology/bibo/> .
|
|
703
|
-
|
|
704
|
-
# ─── Universal annotation predicates ────────────────────────────────
|
|
705
|
-
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
706
|
-
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
707
|
-
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
708
|
-
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
709
|
-
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Finding .
|
|
710
|
-
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
711
|
-
|
|
712
|
-
# ─── Universal annotation entities ──────────────────────────────────
|
|
713
|
-
:Concept rdfs:subClassOf skos:Concept .
|
|
714
|
-
:Topic rdfs:subClassOf skos:Concept .
|
|
715
|
-
:Question rdfs:subClassOf schema:Question .
|
|
716
|
-
:Finding rdfs:subClassOf prov:Entity .
|
|
717
|
-
|
|
718
|
-
# ─── Narrative-writing-specific ─────────────────────────────────────
|
|
719
|
-
|
|
720
|
-
:Character a owl:Class ;
|
|
721
|
-
rdfs:label "Character" ;
|
|
722
|
-
rdfs:comment "A character in the narrative — fictional or historical." ;
|
|
723
|
-
rdfs:subClassOf foaf:Person, schema:Person .
|
|
724
|
-
|
|
725
|
-
:Scene a owl:Class ;
|
|
726
|
-
rdfs:label "Scene" ;
|
|
727
|
-
rdfs:comment "A discrete unit of narrative action — a single place/time/event in the story." ;
|
|
728
|
-
rdfs:subClassOf schema:Event .
|
|
729
|
-
|
|
730
|
-
:PlotPoint a owl:Class ;
|
|
731
|
-
rdfs:label "Plot point" ;
|
|
732
|
-
rdfs:comment "A structural moment in the narrative arc (inciting incident, climax, resolution, etc.)." .
|
|
733
|
-
|
|
734
|
-
:Theme a owl:Class ;
|
|
735
|
-
rdfs:label "Theme" ;
|
|
736
|
-
rdfs:comment "A unifying idea explored across the narrative." ;
|
|
737
|
-
rdfs:subClassOf skos:Concept .
|
|
738
|
-
|
|
739
|
-
:Setting a owl:Class ;
|
|
740
|
-
rdfs:label "Setting" ;
|
|
741
|
-
rdfs:comment "A place + time context within which Scenes occur." .
|
|
742
|
-
|
|
743
|
-
:appearsIn a owl:ObjectProperty ;
|
|
744
|
-
rdfs:label "appears in" ;
|
|
745
|
-
rdfs:domain :Character ;
|
|
746
|
-
rdfs:range :Scene .
|
|
747
|
-
|
|
748
|
-
:setIn a owl:ObjectProperty ;
|
|
749
|
-
rdfs:label "set in" ;
|
|
750
|
-
rdfs:domain :Scene ;
|
|
751
|
-
rdfs:range :Setting .
|
|
752
|
-
|
|
753
|
-
:develops a owl:ObjectProperty ;
|
|
754
|
-
rdfs:label "develops" ;
|
|
755
|
-
rdfs:comment "A Scene or PlotPoint develops a Theme or a Character arc." ;
|
|
756
|
-
rdfs:range owl:Thing .
|
|
757
|
-
|
|
758
|
-
:precedes a owl:ObjectProperty ;
|
|
759
|
-
rdfs:label "precedes" ;
|
|
760
|
-
rdfs:domain :Scene ;
|
|
761
|
-
rdfs:range :Scene .
|
|
762
|
-
|
|
763
|
-
# ─── URI patterns ───────────────────────────────────────────────────
|
|
764
|
-
:UriPattern rdfs:label "URI minting pattern" .
|
|
765
|
-
|
|
766
|
-
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
767
|
-
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
768
|
-
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
769
|
-
:character-pattern a :UriPattern ; skos:notation "urn:dkg:character:<slug>" .
|
|
770
|
-
:scene-pattern a :UriPattern ; skos:notation "urn:dkg:scene:<slug>" .
|
|
771
|
-
:plotpoint-pattern a :UriPattern ; skos:notation "urn:dkg:plotpoint:<slug>" .
|
|
772
|
-
:theme-pattern a :UriPattern ; skos:notation "urn:dkg:theme:<slug>" .
|
|
773
|
-
:setting-pattern a :UriPattern ; skos:notation "urn:dkg:setting:<slug>" .
|
|
774
|
-
|
|
775
|
-
:slug-normalisation a skos:Note ;
|
|
776
|
-
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
777
|
-
`,H_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
778
|
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
779
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
780
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
781
|
-
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
782
|
-
@prefix schema: <http://schema.org/> .
|
|
783
|
-
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
784
|
-
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
785
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
786
|
-
@prefix time: <http://www.w3.org/2006/time#> .
|
|
787
|
-
|
|
788
|
-
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
789
|
-
@prefix : <http://dkg.io/ontology/pkm/> .
|
|
790
|
-
|
|
791
|
-
<http://dkg.io/ontology/pkm/>
|
|
792
|
-
a owl:Ontology ;
|
|
793
|
-
dcterms:title "DKG Personal Knowledge Management Ontology (v1)" ;
|
|
794
|
-
dcterms:description """Starter for personal/team knowledge gardens.
|
|
795
|
-
Notes, highlights, questions, insights — the daily-driver vocabulary
|
|
796
|
-
of an Obsidian/Roam-style PKM workflow, but graph-native and shareable
|
|
797
|
-
with teammates' agents.""" ;
|
|
798
|
-
owl:versionInfo "1.0.0" ;
|
|
799
|
-
dcterms:created "2026-04-18"^^xsd:date ;
|
|
800
|
-
owl:imports
|
|
801
|
-
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
802
|
-
<http://xmlns.com/foaf/0.1/> ,
|
|
803
|
-
<http://www.w3.org/2004/02/skos/core#> ,
|
|
804
|
-
<http://www.w3.org/2006/time#> .
|
|
805
|
-
|
|
806
|
-
# ─── Universal annotation predicates ────────────────────────────────
|
|
807
|
-
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
808
|
-
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
809
|
-
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
810
|
-
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
811
|
-
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Insight .
|
|
812
|
-
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
813
|
-
|
|
814
|
-
# ─── Universal annotation entities ──────────────────────────────────
|
|
815
|
-
:Concept rdfs:subClassOf skos:Concept .
|
|
816
|
-
:Topic rdfs:subClassOf skos:Concept .
|
|
817
|
-
:Question rdfs:subClassOf schema:Question .
|
|
818
|
-
:Finding rdfs:subClassOf prov:Entity .
|
|
819
|
-
|
|
820
|
-
# ─── PKM-specific ────────────────────────────────────────────────────
|
|
821
|
-
|
|
822
|
-
:Note a owl:Class ;
|
|
823
|
-
rdfs:label "Note" ;
|
|
824
|
-
rdfs:comment "An atomic note — a single self-contained thought worth capturing. The fundamental unit of a PKM graph." ;
|
|
825
|
-
rdfs:subClassOf schema:CreativeWork .
|
|
826
|
-
|
|
827
|
-
:Highlight a owl:Class ;
|
|
828
|
-
rdfs:label "Highlight" ;
|
|
829
|
-
rdfs:comment "A passage of text marked as significant from a source (article, book, transcript). Carries provenance back to the source." ;
|
|
830
|
-
rdfs:subClassOf schema:Quotation .
|
|
831
|
-
|
|
832
|
-
:Insight a owl:Class ;
|
|
833
|
-
rdfs:label "Insight" ;
|
|
834
|
-
rdfs:comment "A connection or realisation that synthesises across multiple Notes/Highlights. Promotes from a chat turn via chat:concludes." ;
|
|
835
|
-
rdfs:subClassOf prov:Entity .
|
|
836
|
-
|
|
837
|
-
:relatedTo a owl:ObjectProperty ;
|
|
838
|
-
rdfs:label "related to" ;
|
|
839
|
-
rdfs:subPropertyOf skos:related .
|
|
840
|
-
|
|
841
|
-
:references a owl:ObjectProperty ;
|
|
842
|
-
rdfs:label "references" ;
|
|
843
|
-
rdfs:subPropertyOf dcterms:references .
|
|
844
|
-
|
|
845
|
-
:source a owl:ObjectProperty ;
|
|
846
|
-
rdfs:label "source" ;
|
|
847
|
-
rdfs:domain :Highlight ;
|
|
848
|
-
rdfs:range schema:CreativeWork ;
|
|
849
|
-
rdfs:comment "Where a Highlight was extracted from." ;
|
|
850
|
-
rdfs:subPropertyOf dcterms:source .
|
|
851
|
-
|
|
852
|
-
# ─── URI patterns ───────────────────────────────────────────────────
|
|
853
|
-
:UriPattern rdfs:label "URI minting pattern" .
|
|
854
|
-
|
|
855
|
-
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
856
|
-
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
857
|
-
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
858
|
-
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
859
|
-
:note-pattern a :UriPattern ; skos:notation "urn:dkg:note:<slug>" .
|
|
860
|
-
:highlight-pattern a :UriPattern ; skos:notation "urn:dkg:highlight:<slug>" .
|
|
861
|
-
:insight-pattern a :UriPattern ; skos:notation "urn:dkg:insight:<slug>" .
|
|
862
|
-
|
|
863
|
-
:slug-normalisation a skos:Note ;
|
|
864
|
-
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
865
|
-
`,q_=`@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
866
|
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
867
|
-
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
868
|
-
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
869
|
-
@prefix dcterms: <http://purl.org/dc/terms/> .
|
|
870
|
-
@prefix schema: <http://schema.org/> .
|
|
871
|
-
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
872
|
-
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
873
|
-
@prefix dcat: <http://www.w3.org/ns/dcat#> .
|
|
874
|
-
@prefix fabio: <http://purl.org/spar/fabio/> .
|
|
875
|
-
@prefix time: <http://www.w3.org/2006/time#> .
|
|
876
|
-
|
|
877
|
-
@prefix chat: <http://dkg.io/ontology/chat/> .
|
|
878
|
-
@prefix : <http://dkg.io/ontology/scientific-research/> .
|
|
879
|
-
|
|
880
|
-
<http://dkg.io/ontology/scientific-research/>
|
|
881
|
-
a owl:Ontology ;
|
|
882
|
-
dcterms:title "DKG Scientific Research Project Ontology (v1)" ;
|
|
883
|
-
dcterms:description """Starter for empirical scientific research:
|
|
884
|
-
hypotheses → experiments → results → reproducibility chains. Composes
|
|
885
|
-
with FaBiO for scholarly works, DCAT for datasets, PROV-O for
|
|
886
|
-
provenance, OWL Time for sequencing.""" ;
|
|
887
|
-
owl:versionInfo "1.0.0" ;
|
|
888
|
-
dcterms:created "2026-04-18"^^xsd:date ;
|
|
889
|
-
owl:imports
|
|
890
|
-
<http://schema.org/> , <http://purl.org/dc/terms/> ,
|
|
891
|
-
<http://www.w3.org/ns/prov#> ,
|
|
892
|
-
<http://www.w3.org/2004/02/skos/core#> ,
|
|
893
|
-
<http://www.w3.org/ns/dcat#> ,
|
|
894
|
-
<http://purl.org/spar/fabio/> ,
|
|
895
|
-
<http://www.w3.org/2006/time#> .
|
|
896
|
-
|
|
897
|
-
# ─── Universal annotation predicates ────────────────────────────────
|
|
898
|
-
chat:topic a owl:DatatypeProperty ; rdfs:domain chat:Turn ; rdfs:range xsd:string .
|
|
899
|
-
chat:mentions a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:subPropertyOf schema:mentions .
|
|
900
|
-
chat:examines a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
901
|
-
chat:proposes a owl:ObjectProperty ; rdfs:domain chat:Turn .
|
|
902
|
-
chat:concludes a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Result .
|
|
903
|
-
chat:asks a owl:ObjectProperty ; rdfs:domain chat:Turn ; rdfs:range :Question .
|
|
904
|
-
|
|
905
|
-
# ─── Universal annotation entities ──────────────────────────────────
|
|
906
|
-
:Concept rdfs:subClassOf skos:Concept .
|
|
907
|
-
:Topic rdfs:subClassOf skos:Concept .
|
|
908
|
-
:Question rdfs:subClassOf schema:Question .
|
|
909
|
-
:Finding rdfs:subClassOf prov:Entity .
|
|
910
|
-
|
|
911
|
-
# ─── Scientific-research-specific ───────────────────────────────────
|
|
912
|
-
|
|
913
|
-
:Hypothesis a owl:Class ;
|
|
914
|
-
rdfs:label "Hypothesis" ;
|
|
915
|
-
rdfs:comment "A testable claim. Linked to Experiments via :testedBy and to Results via :supportedBy / :refutedBy." ;
|
|
916
|
-
rdfs:subClassOf prov:Entity .
|
|
917
|
-
|
|
918
|
-
:Experiment a owl:Class ;
|
|
919
|
-
rdfs:label "Experiment" ;
|
|
920
|
-
rdfs:comment "A defined procedure executed to test a Hypothesis. Subclass of prov:Activity for full provenance." ;
|
|
921
|
-
rdfs:subClassOf prov:Activity .
|
|
922
|
-
|
|
923
|
-
:Method a owl:Class ;
|
|
924
|
-
rdfs:label "Method" ;
|
|
925
|
-
rdfs:comment "A reusable methodology applied within Experiments." ;
|
|
926
|
-
rdfs:subClassOf prov:Plan .
|
|
927
|
-
|
|
928
|
-
:Result a owl:Class ;
|
|
929
|
-
rdfs:label "Result" ;
|
|
930
|
-
rdfs:comment "An outcome produced by an Experiment — quantitative or qualitative." ;
|
|
931
|
-
rdfs:subClassOf prov:Entity .
|
|
932
|
-
|
|
933
|
-
:Dataset a owl:Class ;
|
|
934
|
-
rdfs:label "Dataset" ;
|
|
935
|
-
rdfs:comment "An input or output dataset for an Experiment. Aligned with DCAT." ;
|
|
936
|
-
rdfs:subClassOf dcat:Dataset .
|
|
937
|
-
|
|
938
|
-
:testedBy a owl:ObjectProperty ;
|
|
939
|
-
rdfs:label "tested by" ;
|
|
940
|
-
rdfs:domain :Hypothesis ;
|
|
941
|
-
rdfs:range :Experiment .
|
|
942
|
-
|
|
943
|
-
:supportedBy a owl:ObjectProperty ;
|
|
944
|
-
rdfs:label "supported by" ;
|
|
945
|
-
rdfs:domain :Hypothesis ;
|
|
946
|
-
rdfs:range :Result .
|
|
947
|
-
|
|
948
|
-
:refutedBy a owl:ObjectProperty ;
|
|
949
|
-
rdfs:label "refuted by" ;
|
|
950
|
-
rdfs:domain :Hypothesis ;
|
|
951
|
-
rdfs:range :Result .
|
|
952
|
-
|
|
953
|
-
:usesDataset a owl:ObjectProperty ;
|
|
954
|
-
rdfs:label "uses dataset" ;
|
|
955
|
-
rdfs:domain :Experiment ;
|
|
956
|
-
rdfs:range :Dataset .
|
|
957
|
-
|
|
958
|
-
:reproducedBy a owl:ObjectProperty ;
|
|
959
|
-
rdfs:label "reproduced by" ;
|
|
960
|
-
rdfs:domain :Experiment ;
|
|
961
|
-
rdfs:range :Experiment ;
|
|
962
|
-
rdfs:comment "An Experiment that successfully reproduced this one's Results." .
|
|
963
|
-
|
|
964
|
-
# ─── URI patterns ───────────────────────────────────────────────────
|
|
965
|
-
:UriPattern rdfs:label "URI minting pattern" .
|
|
966
|
-
|
|
967
|
-
:concept-pattern a :UriPattern ; skos:notation "urn:dkg:concept:<slug>" .
|
|
968
|
-
:topic-pattern a :UriPattern ; skos:notation "urn:dkg:topic:<slug>" .
|
|
969
|
-
:question-pattern a :UriPattern ; skos:notation "urn:dkg:question:<slug>" .
|
|
970
|
-
:finding-pattern a :UriPattern ; skos:notation "urn:dkg:finding:<slug>" .
|
|
971
|
-
:hypothesis-pattern a :UriPattern ; skos:notation "urn:dkg:hypothesis:<slug>" .
|
|
972
|
-
:experiment-pattern a :UriPattern ; skos:notation "urn:dkg:experiment:<slug>" .
|
|
973
|
-
:method-pattern a :UriPattern ; skos:notation "urn:dkg:method:<slug>" .
|
|
974
|
-
:result-pattern a :UriPattern ; skos:notation "urn:dkg:result:<slug>" .
|
|
975
|
-
:dataset-pattern a :UriPattern ; skos:notation "urn:dkg:dataset:<slug>" .
|
|
976
|
-
|
|
977
|
-
:slug-normalisation a skos:Note ;
|
|
978
|
-
skos:definition "Lowercase → ASCII-fold → strip stopwords → hyphenate → ≤60 chars." .
|
|
979
|
-
`,G_=`# Book-research agent guide
|
|
980
|
-
|
|
981
|
-
This starter ships an RDF ontology for **book-research projects** —
|
|
982
|
-
research notebooks anchored in scholarly sources (citations, quotes,
|
|
983
|
-
arguments, hypotheses). The formal schema lives in \`ontology.ttl\`
|
|
984
|
-
alongside this guide.
|
|
985
|
-
|
|
986
|
-
For V10 MCP tool usage, see
|
|
987
|
-
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
988
|
-
The tool surface to use against this ontology:
|
|
989
|
-
|
|
990
|
-
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
991
|
-
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
992
|
-
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
993
|
-
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
994
|
-
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
995
|
-
|
|
996
|
-
The longer per-domain agent-guide walkthrough format will return when
|
|
997
|
-
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
998
|
-
`,V_=`# Coding-project agent guide
|
|
999
|
-
|
|
1000
|
-
This starter ships an RDF ontology for **coding projects** —
|
|
1001
|
-
shared project memory for AI coding agents (decisions, tasks, code
|
|
1002
|
-
references, GitHub activity, chat turns). The formal schema lives in
|
|
1003
|
-
\`ontology.ttl\` alongside this guide.
|
|
1004
|
-
|
|
1005
|
-
For V10 MCP tool usage, see
|
|
1006
|
-
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1007
|
-
The tool surface to use against this ontology:
|
|
1008
|
-
|
|
1009
|
-
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1010
|
-
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1011
|
-
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1012
|
-
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1013
|
-
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1014
|
-
|
|
1015
|
-
The longer per-domain agent-guide walkthrough format will return when
|
|
1016
|
-
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1017
|
-
`,W_=`# Narrative-writing agent guide
|
|
1018
|
-
|
|
1019
|
-
This starter ships an RDF ontology for **narrative-writing projects** —
|
|
1020
|
-
the structural elements of long-form narrative (Characters, Scenes,
|
|
1021
|
-
PlotPoints, Themes, Settings) and their relationships. The formal
|
|
1022
|
-
schema lives in \`ontology.ttl\` alongside this guide.
|
|
1023
|
-
|
|
1024
|
-
For V10 MCP tool usage, see
|
|
1025
|
-
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1026
|
-
The tool surface to use against this ontology:
|
|
1027
|
-
|
|
1028
|
-
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1029
|
-
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1030
|
-
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1031
|
-
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1032
|
-
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1033
|
-
|
|
1034
|
-
The longer per-domain agent-guide walkthrough format will return when
|
|
1035
|
-
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1036
|
-
`,Z_=`# PKM agent guide
|
|
1037
|
-
|
|
1038
|
-
This starter ships an RDF ontology for **PKM (Personal Knowledge
|
|
1039
|
-
Management) projects** — Notes, Highlights, Insights, and the links
|
|
1040
|
-
that grow a knowledge garden organically. The formal schema lives in
|
|
1041
|
-
\`ontology.ttl\` alongside this guide.
|
|
1042
|
-
|
|
1043
|
-
For V10 MCP tool usage, see
|
|
1044
|
-
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1045
|
-
The tool surface to use against this ontology:
|
|
1046
|
-
|
|
1047
|
-
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1048
|
-
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1049
|
-
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1050
|
-
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1051
|
-
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1052
|
-
|
|
1053
|
-
The longer per-domain agent-guide walkthrough format will return when
|
|
1054
|
-
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1055
|
-
`,Y_=`# Scientific-research agent guide
|
|
1056
|
-
|
|
1057
|
-
This starter ships an RDF ontology for **scientific-research projects** —
|
|
1058
|
-
the empirical research arc (Hypotheses → Experiments → Results →
|
|
1059
|
-
Reproducibility chains), anchored in PROV-O and FaBiO so the graph
|
|
1060
|
-
composes with existing scholarly publishing infrastructure. The formal
|
|
1061
|
-
schema lives in \`ontology.ttl\` alongside this guide.
|
|
1062
|
-
|
|
1063
|
-
For V10 MCP tool usage, see
|
|
1064
|
-
[\`packages/cli/skills/dkg-node/SKILL.md\`](../../../../cli/skills/dkg-node/SKILL.md).
|
|
1065
|
-
The tool surface to use against this ontology:
|
|
1066
|
-
|
|
1067
|
-
- \`dkg_knowledge_asset_create\` + \`dkg_knowledge_asset_write\` — populate (WM)
|
|
1068
|
-
- \`dkg_knowledge_asset_finalize\` — seal the draft (the "git commit")
|
|
1069
|
-
- \`dkg_knowledge_asset_share\` — share with peers (SWM)
|
|
1070
|
-
- \`dkg_knowledge_asset_publish\` — mint on chain (VM); returns the asset's UAL
|
|
1071
|
-
- \`dkg_query\` — SPARQL read; \`dkg_memory_search\` — free-text recall
|
|
1072
|
-
|
|
1073
|
-
The longer per-domain agent-guide walkthrough format will return when
|
|
1074
|
-
the V10 ontology endpoint and per-project annotation workflow stabilise.
|
|
1075
|
-
`;async function cu(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({})),s=(r==null?void 0:r.error)??`HTTP ${n.status}`;throw new Error(s)}return n.json()}const Q_=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/ontology.ttl":U_,"../../../../mcp-dkg/templates/ontologies/coding-project/ontology.ttl":B_,"../../../../mcp-dkg/templates/ontologies/narrative-writing/ontology.ttl":F_,"../../../../mcp-dkg/templates/ontologies/pkm/ontology.ttl":H_,"../../../../mcp-dkg/templates/ontologies/scientific-research/ontology.ttl":q_}),K_=Object.assign({"../../../../mcp-dkg/templates/ontologies/book-research/agent-guide.md":G_,"../../../../mcp-dkg/templates/ontologies/coding-project/agent-guide.md":V_,"../../../../mcp-dkg/templates/ontologies/narrative-writing/agent-guide.md":W_,"../../../../mcp-dkg/templates/ontologies/pkm/agent-guide.md":Z_,"../../../../mcp-dkg/templates/ontologies/scientific-research/agent-guide.md":Y_});function X_(){const e={};for(const[t,n]of Object.entries(Q_)){const r=t.match(/ontologies\/([^/]+)\/ontology\.ttl$/);if(!r)continue;const s=r[1];e[s]={ttl:n,guide:""}}for(const[t,n]of Object.entries(K_)){const r=t.match(/ontologies\/([^/]+)\/agent-guide\.md$/);if(!r)continue;const s=r[1];e[s]&&(e[s].guide=n)}return e}const lg=X_(),J_=[{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 eO(){return J_.filter(e=>lg[e.slug])}function tO(e){return lg[e]??null}const Ct={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 nO(e,t,n,r){const s=`urn:dkg:project:${e}:ontology`,c=`${s}:agent-guide`,u=new Date().toISOString(),d=g=>g.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"),f=(g,m)=>m?`"${d(g)}"^^<${m}>`:`"${d(g)}"`,h=[{subject:s,predicate:Ct.rdf+"type",object:`<${Ct.owl}Ontology>`},{subject:s,predicate:Ct.rdf+"type",object:`<${Ct.prov}Entity>`},{subject:s,predicate:Ct.rdfs+"label",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.schema+"name",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.dcterms+"title",object:f(`Project ontology — ${e}`)},{subject:s,predicate:Ct.dcterms+"description",object:f(`The active ontology for context graph ${e}, derived from the '${t}' starter.`)},{subject:s,predicate:Ct.dcterms+"created",object:f(u,Ct.xsd+"dateTime")},{subject:s,predicate:Ct.dcterms+"modified",object:f(u,Ct.xsd+"dateTime")},{subject:s,predicate:Ct.dcterms+"source",object:f(t)},{subject:s,predicate:Ct.schema+"encodingFormat",object:f("text/turtle")},{subject:s,predicate:Ct.schema+"text",object:f(n)},{subject:s,predicate:Ct.dcterms+"references",object:`<${c}>`},{subject:c,predicate:Ct.rdf+"type",object:`<${Ct.schema}DigitalDocument>`},{subject:c,predicate:Ct.rdfs+"label",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.schema+"name",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.dcterms+"title",object:f(`Agent guide — ${e} ontology`)},{subject:c,predicate:Ct.dcterms+"created",object:f(u,Ct.xsd+"dateTime")},{subject:c,predicate:Ct.dcterms+"modified",object:f(u,Ct.xsd+"dateTime")},{subject:c,predicate:Ct.schema+"encodingFormat",object:f("text/markdown")},{subject:c,predicate:Ct.schema+"text",object:f(r)},{subject:c,predicate:Ct.schema+"about",object:`<${s}>`}];return{ontologyUri:s,guideUri:c,quads:h}}async function aO(e,t){const n=tO(t);if(!n)throw new Error(`Unknown ontology starter '${t}'. Available: ${Object.keys(lg).join(", ")}`);if(!n.ttl||!n.guide)throw new Error(`Starter '${t}' is missing ontology.ttl or agent-guide.md.`);await cu("/api/sub-graph/create",{contextGraphId:e,subGraphName:"meta"}).catch(u=>{if(!String((u==null?void 0:u.message)??u).includes("already exists"))throw u});const{ontologyUri:r,guideUri:s,quads:c}=nO(e,t,n.ttl,n.guide);await cu("/api/knowledge-assets/project-ontology/wm/discard",{contextGraphId:e,subGraphName:"meta"}).catch(u=>{const d=String((u==null?void 0:u.message)??u);if(!/404|not found/i.test(d))throw u}),await cu("/api/knowledge-assets/project-ontology/wm/write",{contextGraphId:e,subGraphName:"meta",quads:c});try{await cu("/api/knowledge-assets/project-ontology/swm/share",{contextGraphId:e,subGraphName:"meta",entities:[r,s]})}catch{}return{ontologyUri:r,guideUri:s,tripleCount:c.length}}async function cg(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify(t)}),r=await n.text();let s;if(r)try{s=JSON.parse(r)}catch{s={raw:r}}if(!n.ok){const c=(s==null?void 0:s.error)??`HTTP ${n.status}`;throw new Error(typeof c=="string"?c:JSON.stringify(c))}return s}function rO(e,t={}){return cg(`/api/context-graph/${encodeURIComponent(e)}/manifest/publish`,t)}function iO(e,t){return cg(`/api/context-graph/${encodeURIComponent(e)}/manifest/plan-install`,t)}function sO(e,t){return cg(`/api/context-graph/${encodeURIComponent(e)}/manifest/install`,t)}const yx="dkg.wireWorkspace.parentDir",bx="dkg.wireWorkspace.nickname",xx="dkg.wireWorkspace.tools",ih=[{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 oO(e,t){const n=t.split("/"),r=n[n.length-1]??"";return r||(e??"project").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function lO(e){if(!e)return"";const t=e.hostname.replace(/\.local$/,"").replace(/-/g," ");return`${e.username} @ ${t}`}function wx(e){return e==="both"?["cursor","claude-code"]:[e]}function eS({contextGraphId:e,projectName:t,defaultAgentNickname:n,onDone:r,onCancel:s,variant:c}){var Z;const u=w.useMemo(()=>oO(t,e),[t,e]),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(""),[b,k]=w.useState(""),[j,E]=w.useState("cursor"),[S,T]=w.useState(!1),[N,R]=w.useState(null),[H,A]=w.useState(null),[U,G]=w.useState(null);w.useEffect(()=>{let $=!1;return(async()=>{try{const[D,F]=await Promise.all([fetch("/api/host/info",{headers:Zt()}).then(Q=>Q.ok?Q.json():null),vd().catch(()=>null)]);if($)return;if(D){f(D);const Q=typeof window<"u"&&window.localStorage.getItem(yx)||D.defaultWorkspaceParent;y(`${Q}/${u}`)}F&&g(F);const V=typeof window<"u"&&window.localStorage.getItem(bx);n?k(n):V?k(V):D&&k(lO(D));const X=typeof window<"u"&&window.localStorage.getItem(xx);X&&(X==="cursor"||X==="claude-code"||X==="both")&&E(X)}catch(D){$||console.warn("[WireWorkspacePanel] host info / identity fetch failed:",D)}})(),()=>{$=!0}},[u,n]);function M($){typeof window>"u"||(window.localStorage.setItem(yx,$),b&&window.localStorage.setItem(bx,b),window.localStorage.setItem(xx,j))}async function _(){T(!0),R(null);try{const $=m.trim();if(!$||$.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 D=await iO(e,{workspaceRoot:$,agentNickname:b.trim(),tools:wx(j)});A(D);const F=$.lastIndexOf("/");F>0&&M($.slice(0,F))}catch($){R(($==null?void 0:$.message)||"Preview failed")}finally{T(!1)}}async function I(){T(!0),R(null);try{const $=m.trim(),D=await sO(e,{workspaceRoot:$,agentNickname:b.trim(),tools:wx(j)});G(D)}catch($){R(($==null?void 0:$.message)||"Install failed")}finally{T(!1)}}if(U)return o.jsxs("div",{children:[o.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:[o.jsx("div",{style:{fontWeight:600,marginBottom:6},children:"Workspace wired."}),"Open ",o.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",c==="join"?", tasks, and decisions":" you publish via the canonical assertion-write flow","."]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-secondary)",marginBottom:8},children:"Files written:"}),o.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:[U.written.map($=>`${$.action.padEnd(9)} ${$.absPath} (${$.bytesWritten.toLocaleString()} bytes)`).join(`
|
|
1076
|
-
`),U.skipped.length?`
|
|
1077
|
-
|
|
1078
|
-
Skipped:
|
|
1079
|
-
`+U.skipped.map($=>` - ${$}`).join(`
|
|
1080
|
-
`):"",U.warnings.length?`
|
|
1081
|
-
|
|
1082
|
-
Warnings:
|
|
1083
|
-
`+U.warnings.map($=>` - ${$}`).join(`
|
|
1084
|
-
`):""]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:14},children:o.jsx("button",{className:"v10-modal-btn primary",onClick:r,children:"Done"})})]});if(H)return o.jsxs("div",{children:[N&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:N}),o.jsx("div",{style:{marginBottom:10,fontSize:11,color:"var(--text-secondary)"},children:"Review the install plan. Files are only written when you click Install."}),o.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:H.markdown}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[o.jsx("button",{className:"v10-modal-btn",onClick:()=>{A(null),R(null)},disabled:S,children:"← Back"}),o.jsxs("div",{style:{display:"flex",gap:8},children:[o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:I,disabled:S,children:S?"Installing…":"Install"})]})]})]});const B=((Z=ih.find($=>$.value===j&&!$.disabled))==null?void 0:Z.description)??ih[0].description;return o.jsxs("div",{children:[o.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:[o.jsx("div",{style:{fontWeight:600,marginBottom:4},children:c==="create"?"Wire your local workspace":"Wire this project locally"}),c==="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."]}),N&&o.jsx("div",{className:"v10-modal-error",style:{marginBottom:12},children:N}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Workspace path"}),o.jsx("input",{className:"v10-form-input",type:"text",value:m,onChange:$=>y($.target.value),placeholder:d?`${d.defaultWorkspaceParent}/${u}`:"/Users/you/code/project",spellCheck:!1,style:{fontFamily:"var(--font-mono)",fontSize:12}}),o.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 ",o.jsx("code",{children:"~/.claude/settings.json"})," if Claude Code is selected).",d&&o.jsxs(o.Fragment,{children:[" Defaulted from your ",o.jsx("code",{children:"$HOME"})," = ",o.jsx("code",{children:d.homedir}),"."]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Coding tool to wire"}),o.jsx("select",{className:"v10-form-select",value:j,onChange:$=>E($.target.value),children:ih.map(($,D)=>o.jsx("option",{value:$.disabled?"__disabled__":$.value,disabled:$.disabled,children:$.label},`${$.label}-${D}`))}),o.jsx("div",{style:{fontSize:10,color:"var(--text-tertiary)",marginTop:4},children:B})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Your agent identity"}),o.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}}),o.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 (",o.jsx("code",{children:"prov:wasAttributedTo"}),") on every chat turn uses this URI."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Nickname for this agent"}),o.jsx("input",{className:"v10-form-input",type:"text",value:b,onChange:$=>k($.target.value),placeholder:"e.g. Alice on laptop 1",spellCheck:!1,maxLength:80}),o.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."})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:14,gap:10},children:[s?o.jsx("button",{className:"v10-modal-btn",onClick:s,disabled:S,children:"Cancel"}):o.jsx("button",{className:"v10-modal-btn",onClick:r,disabled:S,children:"Skip for now"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:_,disabled:S||!m.trim()||!b.trim(),children:S?"Loading preview…":"Preview install"})]})]})}const kx='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"])';function Zi(e,t){const n=w.useRef(null),r=w.useRef(null);w.useEffect(()=>{if(e)return r.current=document.activeElement??null,queueMicrotask(()=>{const c=n.current;if(!c)return;const u=c.querySelector(kx),f=c.querySelector("[autofocus]")??u;f?f.focus():(c.hasAttribute("tabindex")||c.setAttribute("tabindex","-1"),c.focus())}),()=>{var c,u;(u=(c=r.current)==null?void 0:c.focus)==null||u.call(c)}},[e]),w.useEffect(()=>{if(!e)return;const c=u=>{if(u.key==="Escape"){u.stopPropagation(),t();return}if(u.key!=="Tab")return;const d=n.current;if(!d)return;const f=Array.from(d.querySelectorAll(kx)).filter(y=>y.offsetParent!==null||y===document.activeElement);if(f.length===0){u.preventDefault(),d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus();return}const h=f[0],g=f[f.length-1],m=document.activeElement;if(m===d){u.preventDefault(),(u.shiftKey?g:h).focus();return}u.shiftKey&&m===h?(u.preventDefault(),g.focus()):!u.shiftKey&&m===g&&(u.preventDefault(),h.focus())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[e,t]);const s=w.useCallback(c=>{c.target===c.currentTarget&&t()},[t]);return{dialogRef:n,onBackdropClick:s}}const no=80,cO=/<\/?[a-z][^>]*>/i,uO=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g,dO=/[a-z0-9]/i;function pO(e){let t="",n=0;for(;n<e.length;){if(e.charCodeAt(n)===60){const s=e.charCodeAt(n+1);if(s>=65&&s<=90||s>=97&&s<=122||s===47){const u=e.indexOf(">",n+1);if(u===-1)break;n=u+1;continue}}t+=e[n],n+=1}return t}function tS(e){if(typeof e!="string")return"";let t=pO(e);return t=t.replace(/[<>]/g,""),t=t.replace(uO,""),t=t.replace(/\s+/g," "),t=t.trim(),t.length>no&&(t=t.slice(0,no)),t}function Sx(e){const t=tS(e);return t?dO.test(t)?cO.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>no?`Name was trimmed to ${no} 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 jx(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function fO({open:e,onClose:t}){var ut,ye;const[n,r]=w.useState(""),[s,c]=w.useState(""),[u,d]=w.useState("curated"),[f,h]=w.useState("curator-only"),[g,m]=w.useState(!1),[y,b]=w.useState("community"),k=eO(),[j,E]=w.useState(((ut=k[0])==null?void 0:ut.slug)??"coding-project"),[S,T]=w.useState(!1),[N,R]=w.useState("off"),[H,A]=w.useState("7d"),[U,G]=w.useState("100k"),[M,_]=w.useState(!1),[I,B]=w.useState(""),[Z,$]=w.useState(null),[D,F]=w.useState(null),[V,X]=w.useState(null),[Q,L]=w.useState(null),[P,q]=w.useState(""),[O,ne]=w.useState(!0),[ue,le]=w.useState(!1),{setContextGraphs:be,contextGraphs:Re,setActiveProject:Ee}=Na(),{openTab:Ie}=vn(),{setStage:Ve,stage:Se}=og(),ft=()=>{ne(!0),le(!1),vd().then(K=>{X(K.agentAddress),le(!1)}).catch(()=>{X(null),le(!0)}).finally(()=>ne(!1))};w.useEffect(()=>{e&&(F(null),ft())},[e]);const Me=Zi(e&&!Q,t),qe=Zi(e&&!!Q,()=>{L(null),q(""),F(null),r(""),c(""),t()});if(!e)return null;const ke=tS(n),lt=jx(ke),xe=V&<?`${V}/${lt}`:lt?`<agent-address>/${lt}`:"",Oe=n?Sx(n):null,_t=K=>{r(K)},Dt=async()=>{const K=ke;if(!K||Oe)return;_(!0),$(null),F(null),B(g?"Registering context graph on the network…":"Creating context graph locally…");const W=jx(K);if(!V){$("Agent identity is still loading. Please wait a moment and try again."),_(!1);return}const ee=`${V}/${W}`;try{const ce=setTimeout(()=>B(g?"On-chain registration in progress — this can take up to 30s…":"Setting up local context graph…"),5e3),he=u==="curated"?1:0,Le=f==="curator-only"?0:1,He=u==="curated"?{accessPolicy:he,publishPolicy:Le,allowedAgents:V?[V]:[],register:g}:{accessPolicy:he,publishPolicy:Le,register:g},Ce=await f2(ee,K,s.trim()||void 0,He);if(clearTimeout(ce),g&&Ce.registered===!1){const Ne=`On-chain registration failed: ${Ce.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]",Ne),F(Ne)}if(y==="community"||y==="agent")try{B(`Installing '${j}' ontology…`),await aO(Ce.created,j)}catch(Ne){console.warn("[CreateProjectModal] ontology install failed:",Ne),B(`Context graph created, but ontology install failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}let Fe=!0;try{B("Publishing context graph manifest…"),await rO(Ce.created,{})}catch(Ne){Fe=!1,console.warn("[CreateProjectModal] manifest publish failed:",Ne),B(`Context graph created, but manifest publish failed: ${(Ne==null?void 0:Ne.message)??Ne}`)}B("Refreshing context graph list…");const{contextGraphs:et}=await gd();be(et??[]),Ee(Ce.created),Ie({id:`project:${Ce.created}`,label:K,closable:!0}),Se<2&&Ve(2),Fe?(q(K),L(Ce.created),B("")):setTimeout(()=>{r(""),c(""),B(""),t()},2500)}catch(ce){const he=(ce==null?void 0:ce.message)||"Failed to create context graph";he.includes("already exists")||he.includes("409")?$("A context graph with this ID already exists. Try a different name."):(he.includes("taking longer"),$(he)),B("")}finally{_(!1)}},Yt=Re.length===0;function Ft(){L(null),q(""),F(null),r(""),c(""),t()}return Q?o.jsx("div",{className:"v10-modal-overlay",onClick:qe.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:qe.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-wire-modal-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:Ft,"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:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-wire-modal-title",className:"v10-modal-title",children:["Wire workspace for ",P]}),o.jsx("div",{className:"v10-modal-subtitle",children:"Context graph created. Now wire a local workspace so you can plan it from your own Cursor."})]}),o.jsxs("div",{className:"v10-modal-body",children:[D&&o.jsx("div",{className:"v10-modal-warning",children:D}),o.jsx(eS,{contextGraphId:Q,projectName:P,variant:"create",onDone:Ft})]})]})}):o.jsx("div",{className:"v10-modal-overlay",onClick:Me.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:Me.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-create-cg-title","aria-describedby":"dkg-create-cg-subtitle",children:[o.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:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-create-cg-title",className:"v10-modal-title",children:"Create New Context Graph"}),o.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."})]}),o.jsxs("div",{className:"v10-modal-body",children:[Z&&o.jsx("div",{className:"v10-modal-error",children:Z}),D&&o.jsx("div",{className:"v10-modal-warning",children:D}),Yt&&o.jsxs("div",{className:"v10-modal-tip",children:[o.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."]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-name",children:"Context Graph Name"}),o.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:K=>_t(K.target.value),autoFocus:!0,maxLength:no,"aria-invalid":Oe?"true":"false","aria-describedby":"dkg-cg-name-help",autoComplete:"off",spellCheck:!0}),o.jsx("div",{id:"dkg-cg-name-help",style:{marginTop:4,fontSize:11,color:Oe?"var(--red, #f87171)":"var(--text-tertiary)",fontFamily:"var(--font-mono)"},children:Oe||(xe?`ID: did:dkg:context-graph:${xe}`:`${n.length}/${no} characters`)})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-description",children:"Description"}),o.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:s,onChange:K=>c(K.target.value),"aria-label":"Context graph description"})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Sharing"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:u==="curated",onChange:()=>d("curated")}),"Invite-only — only invited agents can read and subscribe"]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:u==="public",onChange:()=>d("public")}),"Open — publicly discoverable; anyone can subscribe"]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Contribution"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:f==="curator-only",onChange:()=>h("curator-only")}),"Curators-only — only the curator may publish to Verifiable Memory"]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:f==="open",onChange:()=>h("open")}),"Open — any wallet may publish to Verifiable Memory (not just members)"]})]}),u==="curated"&&f==="open"&&o.jsxs("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:["Note: an invite-only sharing graph with open contribution still lets ",o.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."]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"On-chain registration"}),o.jsxs("label",{className:"v10-form-radio",style:{display:"flex",alignItems:"flex-start",gap:8},children:[o.jsx("input",{type:"checkbox",checked:g,onChange:K=>m(K.target.checked),style:{marginTop:3}}),o.jsxs("span",{children:["Register on chain now (required for Verifiable Memory publishing)",o.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."})]})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Ontology"}),o.jsxs("div",{className:"v10-form-radio-group",children:[o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:y==="community",onChange:()=>b("community")}),"Choose a starter — install one of the bundled context-graph-type ontologies"]}),y==="community"&&o.jsxs("div",{style:{marginLeft:24,marginTop:4,marginBottom:8},children:[o.jsx("select",{className:"v10-form-select",value:j,onChange:K=>E(K.target.value),children:k.map(K=>o.jsx("option",{value:K.slug,children:K.displayName},K.slug))}),o.jsx("div",{style:{marginTop:6,fontSize:11,color:"var(--text-tertiary)"},children:(ye=k.find(K=>K.slug===j))==null?void 0:ye.description})]}),o.jsxs("label",{className:"v10-form-radio",children:[o.jsx("input",{type:"radio",checked:y==="agent",onChange:()=>b("agent")}),"Let agent decide — defaults to the closest starter (v1)"]}),y==="agent"&&o.jsxs("div",{className:"v10-form-radio-desc",style:{marginLeft:24,marginTop:4,marginBottom:8},children:["v1 installs the ",o.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."]}),o.jsxs("label",{className:"v10-form-radio",style:{opacity:.5},children:[o.jsx("input",{type:"radio",checked:y==="upload",onChange:()=>b("upload"),disabled:!0}),"Upload an ontology file (.ttl, .owl, .rdf) ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]})]})]}),o.jsxs("div",{className:"v10-form-advanced-toggle",onClick:()=>T(!S),children:[o.jsx("span",{className:`v10-form-adv-chevron ${S?"open":""}`,children:"▸"}),o.jsx("span",{children:"Advanced settings"})]}),S&&o.jsxs("div",{className:"v10-form-advanced-body",style:{opacity:.5,pointerEvents:"none"},children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["Consensus Quorum ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:N,disabled:!0,children:[o.jsx("option",{value:"off",children:"Off — no consensus verification required"}),o.jsx("option",{value:"2of3",children:"2 of 3 — lightweight consensus"}),o.jsx("option",{value:"3of5",children:"3 of 5 — standard consensus (recommended for teams)"}),o.jsx("option",{value:"custom",children:"Custom — set your own M of N"})]})]}),o.jsxs("div",{className:"v10-form-group",children:[o.jsxs("label",{className:"v10-form-label",children:["SWM TTL ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:H,disabled:!0,children:[o.jsx("option",{value:"7d",children:"7 days (default)"}),o.jsx("option",{value:"1h",children:"1 hour"}),o.jsx("option",{value:"1d",children:"1 day"}),o.jsx("option",{value:"30d",children:"30 days"})]})]}),o.jsxs("div",{className:"v10-form-group",style:{marginBottom:0},children:[o.jsxs("label",{className:"v10-form-label",children:["SWM Size Cap ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("select",{className:"v10-form-select",value:U,disabled:!0,children:[o.jsx("option",{value:"100k",children:"100K triples (default)"}),o.jsx("option",{value:"10k",children:"10K triples"}),o.jsx("option",{value:"1m",children:"1M triples"})]})]})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Cancel"}),ue&&o.jsx("button",{className:"v10-modal-btn",onClick:ft,disabled:O,children:O?"Retrying…":"Retry Loading Agent"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:Dt,disabled:!n.trim()||!!Sx(n)||M||!V||O,children:M?I||"Creating…":V?"Create Context Graph":ue?"Agent unavailable":"Loading agent…"})]})]})})}const Cx=/^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|12D3Koo[1-9A-HJ-NP-Za-km-z]{45,53})$/;function hO(e){var b;const t=e.trim().replace(/\\n/g,`
|
|
1085
|
-
`),n=t.split(`
|
|
1086
|
-
`).map(k=>k.trim()).filter(Boolean),r=n[0]??"",s=n.slice(1).join(" ").trim(),c=t.match(/(?:^|\s)(\/(?:ip4|ip6|dns|dns4|dns6|dnsaddr)\/\S+)/),u=((b=c==null?void 0:c[1])==null?void 0:b.replace(/\s+/g,""))??null,d=s.replace(/\s+/g,""),f=d.startsWith("/")?d:u;let h=null;if(f){const k=f.match(/\/p2p\/([^/]+)$/);k&&Cx.test(k[1])&&(h=k[1])}else for(const k of[s,...n.slice(1)]){const j=k.trim();if(Cx.test(j)){h=j;break}}let g=r;u&&g.includes(u)&&(g=g.replace(u,"")),g=g.replace(/\s*@\s*$/,"").trim();const y=(n.length>1||s.length>0)&&h===null&&f===null;return{cgId:g,curatorPeerId:h,legacyMultiaddr:f,hasUnparsedExtra:y}}function mO(e){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)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 gO(e){if(e instanceof Mr&&e.status===502){const t=vO(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(yO),s=r?"Curator rejected this join request.":"Couldn't deliver this join request to the curator.",c=bO(n,r);return c?`${s} Reason: ${n}. ${c}`:`${s} Reason: ${n}.`}return e instanceof Error&&e.message?e.message:"Failed to send join request"}function vO(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 yO(e){const t=e.replace(/^[^:]+:\s*/,"").trim();return!(!t||/^dial failed\b/i.test(t)||/^not curator$/i.test(t))}function bO(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 xO({open:e,onClose:t,initialContextGraphId:n}){const[r,s]=w.useState(n??""),[c,u]=w.useState("idle"),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),[b,k]=w.useState(""),{contextGraphs:j,setContextGraphs:E,setActiveProject:S}=Na(),{openTab:T}=vn();w.useEffect(()=>{n&&s(n)},[n]),w.useEffect(()=>{e||(s(n??""),f(null),u("idle"),g(null))},[e,n]);const N=w.useCallback(async Z=>{u("approved");try{const{contextGraphs:$}=await gd();E($??[]);const D=$==null?void 0:$.find(F=>F.id===Z);D&&(S(D.id),T({id:`project:${D.id}`,label:D.name||D.id,closable:!0}),k(D.name??Z),y(Z))}catch{}},[E,S,T]),R=w.useCallback(Z=>{var D;if(!(!h||Z.type!=="join_approved"&&Z.type!=="join_rejected"||((D=Z.data)==null?void 0:D.contextGraphId)!==h)){if(Z.type==="join_rejected"){u("rejected");return}N(h)}},[h,N]);Ji(R);const H=Zi(e&&!m,t),A=Zi(e&&!!m,()=>{y(null),k(""),t()});if(!e)return null;const U=async()=>{const Z=hO(r),$=mO(Z);if($){f($);return}const{cgId:D,curatorPeerId:F,legacyMultiaddr:V}=Z;f(null);const X=j.find(Q=>Q.id===D);if(X){S(X.id),T({id:`project:${X.id}`,label:X.name||X.id,closable:!0}),t();return}u("sending");try{F?await c2(F).catch(()=>{}):V&&(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 l2(V).catch(()=>{}));const Q=await g2(D),L=await vd().then(q=>q.name).catch(()=>{}),P=await v2(D,{delegation:Q.delegation,agentName:L,curatorPeerId:F??void 0});if(g(D),P.alreadyMember){await N(D);return}u("pending")}catch(Q){f(gO(Q)),u("idle")}};function G(){y(null),k(""),t()}if(m)return o.jsx("div",{className:"v10-modal-overlay",onClick:A.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:A.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-wire-title",children:[o.jsx("button",{type:"button",className:"v10-modal-close",onClick:G,"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:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsxs("div",{id:"dkg-join-wire-title",className:"v10-modal-title",children:["Wire workspace for ",b]}),o.jsx("div",{className:"v10-modal-subtitle",children:"Curator approved. Now wire a local workspace so this Cursor can collaborate on the context graph."})]}),o.jsx("div",{className:"v10-modal-body",children:o.jsx(eS,{contextGraphId:m,projectName:b,variant:"join",onDone:G})})]})});const M=c==="sending",_=c==="pending",I=c==="approved",B=c==="rejected";return o.jsx("div",{className:"v10-modal-overlay",onClick:H.onBackdropClick,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",ref:H.dialogRef,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-join-cg-title","aria-describedby":"dkg-join-cg-subtitle",children:[o.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:"×"}),o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-join-cg-title",className:"v10-modal-title",children:"Join a Context Graph"}),o.jsx("div",{id:"dkg-join-cg-subtitle",className:"v10-modal-subtitle",children:"Paste the invite from the curator. Your node will send a signed join request and wait for approval."})]}),o.jsxs("div",{className:"v10-modal-body",children:[d&&o.jsx("div",{className:"v10-modal-error",children:d}),_&&o.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."}),I&&o.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…"}),B&&o.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."}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",htmlFor:"dkg-cg-invite",children:"Invite Code"}),o.jsx("textarea",{id:"dkg-cg-invite",name:"dkg-cg-invite",className:"v10-form-textarea",placeholder:`Paste the invite code from the context graph curator.
|
|
1087
|
-
|
|
1088
|
-
e.g.
|
|
1089
|
-
my-context-graph-abc123
|
|
1090
|
-
12D3KooW...`,value:r,onChange:Z=>s(Z.target.value),autoFocus:!0,rows:3,disabled:M||_||I,style:{fontFamily:"var(--font-mono)",fontSize:11},"aria-label":"Context graph invite code",autoComplete:"off",spellCheck:!1})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[o.jsx("button",{className:"v10-modal-btn",onClick:t,children:_||I?"Close":"Cancel"}),o.jsx("button",{className:"v10-modal-btn primary",onClick:U,disabled:!r.trim()||M||_||I,children:M?"Sending request…":_?"Awaiting approval…":I?"Approved":"Request to Join"})]})]})})}const nS="v10:hiddenProjectIds",am="v10:hidden-projects-change";function sh(){try{const e=localStorage.getItem(nS);if(!e)return new Set;const t=JSON.parse(e);return new Set(Array.isArray(t)?t:[])}catch{return new Set}}function Nx(e){try{localStorage.setItem(nS,JSON.stringify([...e])),window.dispatchEvent(new Event(am))}catch{}}function ug(){const[e,t]=w.useState(()=>sh());w.useEffect(()=>{const s=()=>t(sh());return window.addEventListener(am,s),window.addEventListener("storage",s),()=>{window.removeEventListener(am,s),window.removeEventListener("storage",s)}},[]);const n=w.useCallback(s=>{const c=new Set(sh());c.add(s),Nx(c)},[]),r=w.useCallback(()=>{Nx(new Set)},[]);return{hidden:e,hide:n,unhideAll:r}}function dg(e){return{agentDid:e.agentDid,peerId:e.peerId}}function ao(e){if(!(e!=null&&e.trim()))return"unknown";const t=e.trim().replace(/^["']|["']$/g,"").toLowerCase();return t==="private"?"private":t==="public"?"public":"unknown"}function dn(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 s=t.slice(n.length),c=/^(0x[a-fA-F0-9]{40})$/i.exec(s);return c?`${n}${c[1].toLowerCase()}`:`${n}${s}`}return/^0x[a-fA-F0-9]{40}$/.exec(t)?`${n}${t.toLowerCase()}`:t.toLowerCase()}function wd(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()&&dn(e.curator)===dn(t.agentDid))}function wO(e,t,n){const r=e.filter(s=>wd(s,t));if(n&&!r.some(s=>s.id===n)){const s=e.find(c=>c.id===n);if(s)return[s,...r]}return r}function kO(e,t){return wd(e,t)||ao(e.accessPolicy)!=="public"?!1:e.subscribed===!0||e.synced===!0}function Ex({cg:e,isActive:t,onSelect:n,onHide:r}){return o.jsx("div",{className:"v10-tree-section",children:o.jsxs("div",{className:`v10-tree-section-header ${t?"active":""}`,onClick:n,children:[o.jsx("span",{className:"v10-tree-project-dot"}),o.jsx("span",{className:"v10-tree-section-label",children:e.name||e.id.slice(0,16)}),o.jsx("button",{type:"button",className:"v10-tree-hide-btn",title:"Hide this context graph from the sidebar (reversible)",onClick:s=>{s.stopPropagation(),r()},children:"×"})]})})}function SO(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 jO(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{bd().then(c=>{t(c.integrations),r(null)}).catch(c=>r(c.message))},[]);return Ul(s,3e4),o.jsxs("div",{className:"v10-tree-items",style:{display:"block"},children:[o.jsx("div",{style:{fontSize:11,fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 12px 2px 24px"},children:"Agents"}),n&&o.jsx("div",{style:{fontSize:11,color:"var(--accent-orange, #f97316)",padding:"4px 12px 4px 24px"},children:n}),!n&&e.length===0&&o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",padding:"4px 12px 4px 24px",fontStyle:"italic"},children:"No agents detected."}),e.map(c=>o.jsxs("div",{className:"v10-tree-item",title:c.detail,style:{cursor:"default"},children:[o.jsx("span",{"aria-label":c.statusLabel,style:{width:7,height:7,borderRadius:"50%",background:SO(c.status),flexShrink:0}}),o.jsx("span",{className:"v10-tree-item-label",children:c.name}),o.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary)",marginLeft:4},children:c.statusLabel})]},c.id))]})}function CO(){const e=qn(D=>D.leftSectionMyProjectsOpen),t=qn(D=>D.leftSectionIntegrationsOpen),n=qn(D=>D.toggleLeftSectionMyProjects),r=qn(D=>D.toggleLeftSectionIntegrations),s=w.useId(),c=w.useId(),{openTab:u,activeTabId:d,setActiveTab:f}=vn(),{contextGraphs:h,setContextGraphs:g,setLoading:m,activeProjectId:y,setActiveProject:b}=Na(),k=og(D=>D.stage),[j,E]=w.useState("explorer"),{hidden:S,hide:T,unhideAll:N}=ug(),R=xd().data,H=R?dg(R):null,A=h.filter(D=>!S.has(D.id)),U=A.filter(D=>wd(D,H)),G=A.filter(D=>kO(D,H)),M=h.length-A.length,[_,I]=w.useState(!1),[B,Z]=w.useState(!1),$=w.useCallback(()=>{m(!0),Tn.fetchContextGraphs().then(({contextGraphs:D})=>g(D??[])).catch(()=>{}).finally(()=>m(!1))},[g,m]);return Ul($,6e4),Ji(w.useCallback(D=>{(D.type==="join_approved"||D.type==="project_synced")&&$()},[$])),o.jsxs("div",{className:"v10-panel-left",children:[o.jsxs("div",{style:{display:"flex",gap:4,padding:"8px 8px 4px"},children:[o.jsx("button",{className:"v10-new-project-btn",onClick:()=>I(!0),children:"+ New Context Graph"}),o.jsx("button",{className:"v10-new-project-btn",onClick:()=>Z(!0),children:"↗ Join Context Graph"})]}),o.jsxs("div",{className:"v10-tree-header",children:[o.jsx("button",{className:`v10-tree-mode-btn ${j==="explorer"?"active":""}`,onClick:()=>E("explorer"),children:"Context Graphs"}),o.jsx("button",{className:`v10-tree-mode-btn ${j==="oracle"?"active":""}`,onClick:()=>E("oracle"),children:"Context Oracle"})]}),j==="explorer"&&o.jsxs("div",{className:"v10-tree-content",children:[o.jsxs("div",{className:`v10-tree-dashboard ${d==="dashboard"?"active":""}`,onClick:()=>{f("dashboard"),b(null)},children:[o.jsx("span",{children:"▦"})," Dashboard"]}),h.length===0&&k<=1&&o.jsxs("div",{className:"v10-journey-empty-card",children:[o.jsx("div",{className:"v10-jec-title",children:"No context graphs yet"}),o.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&&o.jsx("button",{className:"v10-new-project-btn",style:{margin:0},onClick:()=>I(!0),children:"+ Create First Context Graph"})]}),(h.length>0||k>=2)&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":e,"aria-controls":s,onClick:n,children:[o.jsx(nm,{size:14,className:`v10-peer-group-chevron ${e?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"My Context Graphs"})]}),e&&o.jsx("div",{id:s,className:"v10-peer-group-body",children:U.length===0?o.jsx("div",{className:"v10-tree-item",style:{cursor:"default",color:"var(--text-tertiary)",fontStyle:"italic"},children:o.jsx("span",{className:"v10-tree-item-label",children:"No context graphs in this view yet."})}):U.map(D=>o.jsx(Ex,{cg:D,isActive:y===D.id,onSelect:()=>{b(D.id),u({id:`project:${D.id}`,label:D.name||D.id.slice(0,16),closable:!0})},onHide:()=>{T(D.id),y===D.id&&b(null)}},D.id))})]}),M>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:N,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",M," hidden context graph",M!==1?"s":""]}),k>=1&&o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header","aria-expanded":t,"aria-controls":c,onClick:r,children:[o.jsx(nm,{size:14,className:`v10-peer-group-chevron ${t?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:"Integrations"})]}),t&&o.jsx("div",{id:c,className:"v10-peer-group-body",children:o.jsx(jO,{})})]})]}),j==="oracle"&&o.jsxs("div",{className:"v10-tree-content",children:[G.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-tree-group-label",children:"Context Oracle"}),G.map(D=>o.jsx(Ex,{cg:D,isActive:y===D.id,onSelect:()=>{b(D.id),u({id:`project:${D.id}`,label:D.name||D.id.slice(0,16),closable:!0})},onHide:()=>{T(D.id),y===D.id&&b(null)}},D.id))]}),G.length===0&&o.jsxs("p",{style:{fontSize:12,color:"var(--text-tertiary)",padding:"20px 12px",textAlign:"center",lineHeight:1.5},children:["No public catalogue entries yet. Context graphs you sync or curate appear under ",o.jsx("strong",{children:"Context Graphs"}),"; non-private graphs you discover but haven't joined list here — use ",o.jsx("strong",{children:"Join Context Graph"})," to subscribe."]}),M>0&&o.jsxs("button",{type:"button",className:"v10-tree-show-hidden",onClick:N,title:"Restore all context graphs dismissed from the sidebar",children:["↺ Show ",M," hidden context graph",M!==1?"s":""]})]}),o.jsx(fO,{open:_,onClose:()=>I(!1)}),o.jsx(xO,{open:B,onClose:()=>Z(!1)})]})}function Ea(e,t=[],n=0){const[r,s]=w.useState(null),[c,u]=w.useState(!0),[d,f]=w.useState(null),h=w.useRef(!0),g=w.useCallback(async()=>{try{const m=await e();h.current&&(s(m),f(null))}catch(m){if(h.current){if((m==null?void 0:m.status)===401){const y=!!window.__DKG_TOKEN__,b=sessionStorage.getItem("__dkg_401_reloaded")==="1";if(y&&!b){sessionStorage.setItem("__dkg_401_reloaded","1"),window.location.reload();return}f("Authentication expired — please refresh the page.");return}f(m.message)}}finally{h.current&&u(!1)}},t);return w.useEffect(()=>{h.current=!0,u(!0),g();let m=null;const y=()=>{n<=0||m||(m=setInterval(g,n))},b=()=>{m&&(clearInterval(m),m=null)},k=()=>{typeof document>"u"||(document.hidden?b():(g(),y()))};return(typeof document>"u"||!document.hidden)&&y(),typeof document<"u"&&document.addEventListener("visibilitychange",k),()=>{h.current=!1,b(),typeof document<"u"&&document.removeEventListener("visibilitychange",k)}},[g,n]),{data:r,loading:c,error:d,refresh:g}}function Z7(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 Tx(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 NO(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 s=t.getTime()-n.getTime();return s>=0&&s<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 Ax(e,t=8){return e?e.length<=t*2?e:e.slice(0,t)+"..."+e.slice(-4):"—"}function EO(){const e=Na(m=>m.contextGraphs),t=Na(m=>m.setContextGraphs),{hidden:n}=ug(),[r,s]=w.useState(null),[c,u]=w.useState(!0),[d,f]=w.useState(()=>e.length===0),h=w.useCallback(()=>{Tn.fetchContextGraphs().then(({contextGraphs:m})=>t(m??[])).catch(()=>{}).finally(()=>f(!1))},[t]);return w.useEffect(()=>{h();const m=setInterval(h,6e4);return()=>clearInterval(m)},[h]),Ji(w.useCallback(m=>{m.type!=="join_approved"&&m.type!=="join_rejected"&&m.type!=="project_synced"||h()},[h])),w.useEffect(()=>{let m=!0;return u(!0),Tn.fetchCurrentAgent().then(y=>{m&&s(dg(y))}).catch(()=>{}).finally(()=>{m&&u(!1)}),()=>{m=!1}},[e]),{myCgs:w.useMemo(()=>e.filter(m=>!n.has(m.id)).filter(m=>wd(m,r)),[e,n,r]),identity:r,identityLoading:c,cgsLoading:d}}const pg=["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 kd(e={}){const t={predicates:[...e.extraPredicates??[],...pg]};return e.minZoomForLabels!==void 0&&(t.minZoomForLabels=e.minZoomForLabels),t}function Sd(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 Rx="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function uu(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Lu(e){const t=yt(e);return!t||t.startsWith('"')||/\s/.test(t)?!1:t.startsWith("_:")?!0:/^[A-Za-z][A-Za-z0-9+.-]*:/.test(t)}function yt(e){const t=e.trim();return t.startsWith('"')?t:t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function Qs(e){if(!e)return"—";if(e.startsWith('"'))return Sd(e);const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function fg(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=e.lastIndexOf(":"),s=Math.max(t,n,r),c=s>=0?e.slice(s+1):e;try{return decodeURIComponent(c)}catch{return c}}function TO(e){const t=fg(e).trim();return t?(/^[0-9a-f-]{16,}$/i.test(t)?t.replace(/-/g,"").slice(0,12):t).replace(/[_-]+/g," ").trim():""}function AO(e,t){return e===t&&/^urn:dkg:extraction:[^\s]+$/i.test(t)}function RO(e,t){return e===t&&Lu(t)}function _O(e){const t=TO(e.uri),n=e.types.map(Qs).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||Qs(e.uri)}function OO(e){for(const n of pg){const r=e.properties.get(n),s=r==null?void 0:r.find(c=>c.trim().length>0);if(s)return s}const t=Qs(e.uri);return e.label&&(e.label!==t||!RO(e.label,e.uri))&&!AO(e.label,e.uri)?e.label:_O(e)}const aS=5e4,rS=2e4,iS=2e4;function LO(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1091
|
-
GRAPH ?g { ?s ?p ?o }
|
|
1092
|
-
FILTER(
|
|
1093
|
-
STRSTARTS(STR(?g), "${t}/") &&
|
|
1094
|
-
(CONTAINS(STR(?g), "/assertion/") || CONTAINS(STR(?g), "/_working_memory/")) &&
|
|
1095
|
-
STR(?g) != "${t}/meta" &&
|
|
1096
|
-
!CONTAINS(STR(?g), "/meta/") &&
|
|
1097
|
-
!STRENDS(STR(?g), "/_meta")
|
|
1098
|
-
)
|
|
1099
|
-
} LIMIT ${aS}`}function zO(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1100
|
-
GRAPH ?g { ?s ?p ?o }
|
|
1101
|
-
FILTER(
|
|
1102
|
-
STRSTARTS(STR(?g), "${t}") &&
|
|
1103
|
-
(STRENDS(STR(?g), "/_shared_memory") || CONTAINS(STR(?g), "/_shared_memory/")) &&
|
|
1104
|
-
STR(?g) != "${t}/meta/_shared_memory" &&
|
|
1105
|
-
!CONTAINS(STR(?g), "/meta/") &&
|
|
1106
|
-
!CONTAINS(STR(?g), "/_shared_memory/staging/") &&
|
|
1107
|
-
?p != <http://dkg.io/ontology/workspaceOwner>
|
|
1108
|
-
)
|
|
1109
|
-
} LIMIT ${rS}`}function MO(e){const t=`did:dkg:context-graph:${e}`;return`SELECT ?s ?p ?o ?g WHERE {
|
|
1110
|
-
GRAPH ?g { ?s ?p ?o }
|
|
1111
|
-
FILTER(
|
|
1112
|
-
STRSTARTS(STR(?g), "${t}") &&
|
|
1113
|
-
!CONTAINS(STR(?g), "/assertion/") &&
|
|
1114
|
-
!CONTAINS(STR(?g), "/_working_memory") &&
|
|
1115
|
-
!CONTAINS(STR(?g), "/_shared_memory") &&
|
|
1116
|
-
!CONTAINS(STR(?g), "_verifiable_memory_meta") &&
|
|
1117
|
-
!STRENDS(STR(?g), "/_meta") &&
|
|
1118
|
-
STR(?g) != "${t}/meta" &&
|
|
1119
|
-
!CONTAINS(STR(?g), "/meta/") &&
|
|
1120
|
-
!CONTAINS(STR(?g), "/_private") &&
|
|
1121
|
-
!CONTAINS(STR(?g), "/_rules")
|
|
1122
|
-
)
|
|
1123
|
-
} LIMIT ${iS}`}function DO(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/"),c=s>=0?r.slice(0,s):r;if(!(!c||c.startsWith("_")||c==="assertion"||c==="meta"))return c}const _x={wm:"loading",swm:"loading",vm:"loading"},$O={wm:"error",swm:"error",vm:"error"};async function oh(e,t,n){var r,s;try{const{layerLimit:c,...u}=n??{},d={sparql:e,contextGraphId:t,...u},f=await Gu(d),h=((r=f==null?void 0:f.result)==null?void 0:r.bindings)??((s=f==null?void 0:f.results)==null?void 0:s.bindings)??[],g=typeof c=="number"&&h.length>=c;return{triples:h.map(y=>{const b=uu(y.g);return{subject:uu(y.s)??"",predicate:uu(y.p)??"",object:uu(y.o)??"",subGraph:b?DO(b,t):void 0}}).filter(y=>y.subject&&y.predicate&&y.object),ok:!0,truncated:g}}catch{return{triples:[],ok:!1,truncated:!1}}}function IO(e){var f;const t=new Map,n=new Map,r=new Map,s=new Map,c=new Map;function u(h,g,m){let y=s.get(h);y||(y=new Map,s.set(h,y));let b=y.get(g);if(b||(b=new Set,y.set(g,b)),b.has(m))return!1;b.add(m);let k=c.get(h);return k||(k={working:0,shared:0,verified:0},c.set(h,k)),k[g]++,!0}function d(h){const g=yt(h);let m=t.get(g);return m||(m={uri:g,label:Qs(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===Rx){const m=yt(h.object);g.types.includes(m)||g.types.push(m)}else if(Lu(h.object)){const m=yt(h.object),y=d(m);y.layers.add(h.layer),h.subGraph&&y.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:Qs(m)}))}else{const m=r.get(g.uri)??new Set,y=`${h.predicate}\0${h.object}`;if(!m.has(y)){m.add(y),r.set(g.uri,m);const b=g.properties.get(h.predicate)??[];b.push(Sd(h.object)),g.properties.set(h.predicate,b)}}}for(const h of t.values())h.label=OO(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=yt(h.subject),m=t.get(g);if(m&&m.trustLevel!==h.layer)continue;const y=Lu(h.object)?yt(h.object):h.object,b=Lu(h.object);if(b){const j=t.get(y);if(j&&j.trustLevel!==h.layer)continue}const k=`${g}\0${h.predicate}\0${y}`;if(m&&u(m.uri,h.layer,k),h.predicate===Rx){if(y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}else if(b&&y!==g){const j=t.get(y);j&&u(j.uri,h.layer,k)}}for(const h of t.values()){const g=c.get(h.uri);h.tripleCount=g?g[h.trustLevel]:0}for(const h of t.values())for(const g of h.connections)g.targetLabel=((f=t.get(g.targetUri))==null?void 0:f.label)??Qs(g.targetUri);return t}const sS=IO;function oS(e){return e.types.length>0||e.properties.size>0||e.connections.length>0}function hg(e,t){const n=(t==null?void 0:t.signalErrors)??!1,[r,s]=w.useState([]),[c,u]=w.useState(!0),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(_x),b=w.useRef(0),k=w.useCallback(async()=>{if(!e)return;const R=++b.current;u(!0),f(null),g(!1),y(_x);try{const H={includeContextGraphPartitions:!0},[A,U,G]=await Promise.all([oh(LO(e),e,{...H,layerLimit:aS}),oh(zO(e),e,{...H,layerLimit:rS}),oh(MO(e),e,{...H,layerLimit:iS})]);if(R!==b.current)return;const M=[...A.triples.map(Z=>({...Z,layer:"working"})),...U.triples.map(Z=>({...Z,layer:"shared"})),...G.triples.map(Z=>({...Z,layer:"verified"}))];s(M),y({wm:A.ok?"ok":"error",swm:U.ok?"ok":"error",vm:G.ok?"ok":"error"});const _=[A,U,G],I=_.filter(Z=>!Z.ok).length,B=_.some(Z=>Z.truncated);g(I>0&&I<3||B),f(n&&I===3?"Failed to load memory data":null)}catch(H){R===b.current&&(f(H.message??"Failed to load memory data"),y($O))}finally{R===b.current&&u(!1)}},[e,n]);po(e,k),w.useEffect(()=>{k()},[k]);const j=w.useMemo(()=>sS(r),[r]),E=w.useMemo(()=>[...j.values()].filter(oS).sort((R,H)=>{const A={verified:0,shared:1,working:2},U=A[R.trustLevel]-A[H.trustLevel];if(U!==0)return U;const G=R.tripleCount??0,M=H.tripleCount??0;return M!==G?M-G:R.label.localeCompare(H.label)}),[j]),S=w.useMemo(()=>{const R=new Set;return r.filter(H=>{const A=`${H.subject}|${H.predicate}|${H.object}`;return R.has(A)?!1:(R.add(A),!0)}).map(({subject:H,predicate:A,object:U,subGraph:G})=>({subject:H,predicate:A,object:U,subGraph:G}))},[r]),T=w.useMemo(()=>{const R=new Map;for(const[H,A]of j)R.set(H,A.trustLevel);return R},[j]),N=w.useMemo(()=>{let R=0,H=0,A=0;for(const U of E)U.trustLevel==="verified"?A++:U.trustLevel==="shared"?H++:R++;return{wm:R,swm:H,vm:A,total:E.length}},[E]);return{entities:j,entityList:E,allTriples:r,graphTriples:S,trustMap:T,counts:N,loading:c,error:d,partial:h,layerStatus:m,refresh:k}}const Bl="http://dkg.io/viz/",lS=`${Bl}OnChainAnchor`,cS=`${Bl}AgentIdentity`,uS=`${Bl}anchoredIn`,dS=`${Bl}signedBy`,pS=`${Bl}consensus`,Ox="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Lx="http://schema.org/name",zx="http://schema.org/description";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 PO(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 UO(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 BO(e){return`PREFIX dkg: <http://dkg.io/ontology/>
|
|
1124
|
-
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1125
|
-
SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
|
|
1126
|
-
GRAPH ?g {
|
|
1127
|
-
?op a dkg:WorkspaceOperation ;
|
|
1128
|
-
dkg:rootEntity ?root ;
|
|
1129
|
-
dkg:publishedAt ?publishedAt ;
|
|
1130
|
-
prov:wasAttributedTo ?agent .
|
|
1131
|
-
}
|
|
1132
|
-
FILTER(
|
|
1133
|
-
STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
|
|
1134
|
-
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1135
|
-
)
|
|
1136
|
-
} ORDER BY ?publishedAt LIMIT 2000`}function FO(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const c=r.slice(0,s);if(!(!c||c.startsWith("_")))return c}function HO(e){const t=e.lastIndexOf(":");return t>=0?e.slice(t+1):e}function qO(e,t){const n=[],r=new Set;for(const s of e){const c=t?s.roots.filter(d=>t.has(d)):s.roots;if(c.length===0)continue;const u=`urn:dkg:viz:anchor:${s.opId}`;n.push({subject:u,predicate:Ox,object:lS,subGraph:s.subGraph}),n.push({subject:u,predicate:Lx,object:`"${PO(s)}"`,subGraph:s.subGraph}),n.push({subject:u,predicate:zx,object:`"Published ${s.roots.length} KA${s.roots.length===1?"":"s"} · ${new Date(s.publishedAt).toISOString()}"`,subGraph:s.subGraph});for(const d of c)n.push({subject:d,predicate:uS,object:u,subGraph:s.subGraph}),n.push({subject:d,predicate:pS,object:`"${s.agents.length}-of-${s.agents.length}"`,subGraph:s.subGraph});for(const d of s.agents){const f=d.startsWith("did:")||d.startsWith("12D3")?d:`did:dkg:agent:${d}`,h=`urn:dkg:viz:agent:${encodeURIComponent(f)}`;n.push({subject:u,predicate:dS,object:h,subGraph:s.subGraph}),r.has(h)||(r.add(h),n.push({subject:h,predicate:Ox,object:cS,subGraph:s.subGraph}),n.push({subject:h,predicate:Lx,object:`"${UO(f)}"`,subGraph:s.subGraph}),n.push({subject:h,predicate:zx,object:`"${f}"`,subGraph:s.subGraph}))}}return n}function GO(e,t){const[n,r]=w.useState([]),[s,c]=w.useState(!1),[u,d]=w.useState(null),f=w.useRef(0);w.useEffect(()=>{if(!e){r([]),c(!1);return}const y=++f.current;c(!0),d(null),(async()=>{var b;try{const k=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify({sparql:BO(e)})});if(!k.ok)throw new Error(`SPARQL query failed: ${k.status}`);const j=await k.json(),E=((b=j==null?void 0:j.result)==null?void 0:b.bindings)??[],S=new Map;for(const T of E){const N=ll(T.op),R=ll(T.root),H=ll(T.agent),A=ll(T.publishedAt),U=ll(T.g);if(!N||!R||!H||!A)continue;let G=S.get(N);G||(G={opId:HO(N),opUri:N,agents:[],roots:[],publishedAt:A,subGraph:U?FO(U,e):void 0},S.set(N,G)),G.roots.includes(R)||G.roots.push(R),G.agents.includes(H)||G.agents.push(H)}if(y!==f.current)return;r([...S.values()].sort((T,N)=>N.publishedAt.localeCompare(T.publishedAt)))}catch(k){if(y!==f.current)return;d((k==null?void 0:k.message)??"Failed to load anchors"),r([])}finally{y===f.current&&c(!1)}})()},[e]);const h=w.useMemo(()=>{if(!t)return null;const y=[];if(t instanceof Set)for(const b of t)y.push(b);else for(const b of t)y.push(b);return y.sort(),y.join("|")},[t]),g=w.useMemo(()=>h==null?null:new Set(h.length===0?[]:h.split("|")),[h]),m=w.useMemo(()=>qO(n,g),[n,g]);return{anchors:n,decorationTriples:m,loading:s,error:u}}function VO(e){return e.activeSubGraph?!1:e.activeLayer==="swm"}const Gi={verified:"#22c55e",shared:"#f59e0b",working:"#64748b"},Us={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"}},WO="http://www.w3.org/ns/prov#wasAttributedTo",fo="http://dkg.io/ontology/agent/",ZO=fo+"createdBy",YO=fo+"promotedBy",QO=fo+"publishedBy",KO=fo+"createdAt",XO=fo+"promotedAt",JO=fo+"publishedAt";function jd(e){for(const t of e.connections)if(t.predicate===WO)return t.targetUri;return null}function eL(e,t){const n=t==="created"?ZO:t==="promoted"?YO:QO;for(const r of e.connections)if(r.predicate===n)return r.targetUri;return jd(e)}function tL(e,t){const n=t==="created"?KO:t==="promoted"?XO:JO,r=e.properties.get(n);return(r==null?void 0:r[0])??null}function Mx(e){const t=e.lastIndexOf("#"),n=e.lastIndexOf("/"),r=Math.max(t,n);return r>=0?e.slice(r+1):e}function Bs(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 Cd(e,t){var s,c;if(t)for(const u of e.types){const d=t.forType(u),f=Mx(u),h=d.label??f;if(d.icon||d.color||d.label)return{icon:d.icon??((s=Us[f])==null?void 0:s.icon)??Us.Thing.icon,group:d.label??((c=Us[f])==null?void 0:c.group)??Us.Thing.group,color:d.color,type:h}}const n=e.types[0]?Mx(e.types[0]):"Entity";return{...Us[n]??Us.Thing,type:n}}const Mn={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 Or(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 Hn="http://dkg.io/ontology/code/",fS={[Hn+"Package"]:"#a855f7",[Hn+"File"]:"#3b82f6",[Hn+"Class"]:"#22c55e",[Hn+"Interface"]:"#06b6d4",[Hn+"Function"]:"#f59e0b",[Hn+"TypeAlias"]:"#ec4899",[Hn+"Enum"]:"#ef4444",[Hn+"ExternalModule"]:"#64748b",[lS]:"#f5a524",[cS]:"#c084fc"},hS={[Hn+"imports"]:"#60a5fa",[Hn+"contains"]:"#a855f7",[Hn+"definedIn"]:"#3b82f6",[Hn+"exports"]:"#f59e0b",[Hn+"extends"]:"#22c55e",[Hn+"implements"]:"#06b6d4",[uS]:"#f5a524",[dS]:"#c084fc",[pS]:"#22c55e"};function mg(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 nL(e,t){const{color:n}=Mn[e],r=e==="vm";return{labelMode:"humanized",renderer:"2d",labels:kd({minZoomForLabels:r?.2:.3}),style:{classColors:fS,predicateColors:hS,namespaceColors:mg(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 aL(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 rL(e,t,n=2){const r=d=>yt(d.subject),s=d=>yt(d.object),c=new Set([e]);let u=new Set([e]);for(let d=0;d<n;d++){const f=new Set;for(const h of t){const g=r(h),m=s(h);u.has(g)&&!c.has(m)&&f.add(m),u.has(m)&&!c.has(g)&&f.add(g)}for(const h of f)c.add(h);if(u=f,u.size===0)break}return t.filter(d=>c.has(r(d))&&c.has(s(d)))}function mS(e,t){const n=t.lastIndexOf("/"),r=t.lastIndexOf("#"),s=t.lastIndexOf(":"),c=Math.max(n,r,s),u=c>=0?t.slice(c+1):t,d=(()=>{try{return decodeURIComponent(u)}catch{return u}})();if(/^urn:dkg:extraction:[^\s]+$/i.test(t)){const f=d.replace(/-/g,"").replace(/_+/g," ").slice(0,12).trim();return f?`Extraction ${f}`:"Extraction"}return d||t}function gg(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 rm(e,t){return!t.isRoot&&e.subGraph===t.slug?!0:e.subGraph?!1:t.scopedUris.has(e.subject)?!0:t.requireResourceObject?gg(e.object)&&t.scopedUris.has(e.object):t.scopedUris.has(e.object)}function gS(e,t){const n=t.get(yt(e.subject));return n!==void 0&&n.trustLevel!==e.layer}function vS(e,t){if(!gg(e.object))return!1;const n=t.get(yt(e.object));return n!==void 0&&n.trustLevel!==e.layer}function yS(e,t){return gS(e,t)||vS(e,t)}function bS(e,t){return gS(e,t)&&vS(e,t)}function im(e,t){const n=new Set,r=[];for(const s of e){if(bS(s,t))continue;const c=`${yt(s.subject)}|${s.predicate}|${yt(s.object)}`;n.has(c)||(n.add(c),r.push(s))}return r}function vg(e){return w.useMemo(()=>{const t=im(e.allTriples,e.entities);return{triples:t,total:t.length}},[e.allTriples,e.entities])}function xS(e){return w.useMemo(()=>{const t=new Set,n=new Set,r=new Set,s=new Set;let c=0,u=0,d=0,f=0;for(const h of e.allTriples){const g=`${yt(h.subject)}|${h.predicate}|${yt(h.object)}`;!bS(h,e.entities)&&!s.has(g)&&(s.add(g),f++),yS(h,e.entities)||(h.layer==="working"&&!t.has(g)?(t.add(g),c++):h.layer==="shared"&&!n.has(g)?(n.add(g),u++):h.layer==="verified"&&!r.has(g)&&(r.add(g),d++))}return{wm:c,swm:u,vm:d,canonical:f}},[e.allTriples,e.entities])}function iL(e,t){const n=Mn[t].trustLevel;return w.useMemo(()=>{const r=new Set,s=[];for(const c of e.allTriples){if(c.layer!==n||yS(c,e.entities))continue;const u=`${yt(c.subject)}|${c.predicate}|${yt(c.object)}`;r.has(u)||(r.add(u),s.push(c))}return s},[e.allTriples,e.entities,n])}const sL="http://www.w3.org/1999/02/22-rdf-syntax-ns#type";function oL(e){const t=e.trim();return(t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t)===sL}function Ku(e,t,n){const r=[],s=n==null?void 0:n.focalSubjects;for(const c of e){const u=yt(c.subject);!t.has(u)&&!(s!=null&&s.has(u))||gg(c.object)&&!oL(c.predicate)&&!t.has(yt(c.object))||r.push(c)}return r}const lh="http://dkg.io/ontology/sourceContentType",Dx="http://dkg.io/ontology/markdownForm",$x="http://dkg.io/ontology/sourceFile",Ix="http://dkg.io/ontology/size";function lL(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 cL(e){const[t,n]=e.split("-"),r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=Math.max(0,Math.min(11,parseInt(n,10)-1));return`${r[s]} ${t}`}function zu(e,t){const n=e.properties.get(t),r=n==null?void 0:n[0];if(!r)return null;const s=r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),c=Date.parse(s);return Number.isNaN(c)?null:c}function uL(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 s=Math.floor(r/60);if(s<24)return`${s}h ago`;const c=Math.floor(s/24);return c<30?`${c}d ago`:new Date(e).toISOString().slice(0,10)}function dL(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 s=n.toFixed(t).replace(/\.?0+$/,"");return n>0&&Number(s)===0?`< ${1/Math.pow(10,t)}`:s}function pL(e){if(!(e==null||e===""))return`Exact balance: ${e} (full precision from chain)`}const fL="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.",sm=[{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."}],du={1:{name:"Ethereum",gas:"ETH"},8453:{name:"Base",gas:"ETH"},84532:{name:"Base Sepolia",gas:"ETH"},100:{name:"Gnosis",gas:"xDAI"},10200:{name:"Chiado",gas:"xDAI"},2043:{name:"NeuroWeb",gas:"NEURO"},20430:{name:"NeuroWeb Testnet",gas:"NEURO"}};function ch(e){var r;if(e==null)return{name:"Unknown chain",gas:"ETH"};const t=String(e);if(du[t])return du[t];const n=(r=t.match(/(\d+)\s*$/))==null?void 0:r[1];return n&&du[n]?du[n]:{name:n?`Chain ${n}`:`Chain ${t}`,gas:"ETH"}}function cl(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 uh({label:e,value:t,sub:n,accentColor:r,children:s,icon:c,className:u}){return o.jsxs("div",{className:`stat-card v10-anim-mount${u?` ${u}`:""}`,children:[r&&o.jsx("div",{className:"accent",style:{background:r}}),o.jsxs("div",{className:"stat-label",children:[c,e]}),t!=null&&t!==""&&o.jsx("div",{className:"stat-value",children:t}),s,n!=null&&n!==""&&o.jsx("div",{className:"stat-sub",children:n})]})}function Px({counts:e}){const t=e.wm+e.swm+e.vm,n=sm.map(r=>`${r.short} ${e[r.key]}`).join(" · ");return o.jsx("div",{className:"v10-layerbar","aria-label":n,children:t===0?o.jsx("span",{className:"v10-layerbar-empty"}):sm.map(r=>{const s=e[r.key]/t*100;return s<=0?null:o.jsx("span",{className:"v10-layerbar-seg",title:`${r.label} (${e[r.key]}) — ${r.desc}`,style:{width:`${s}%`,background:r.color}},r.key)})})}function hL(){return o.jsx("div",{className:"v10-layer-legend",children:sm.map(e=>o.jsxs("span",{className:"v10-layer-legend-item",title:`${e.label} — ${e.desc}`,children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:e.color}}),e.short]},e.key))})}function mL({curator:e,joined:t,refreshing:n}){const r=e+t,s=`Curator ${e} · Joined ${t}`,c="var(--accent-green)",u="var(--text-secondary)";return o.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:[o.jsx("div",{className:"v10-layerbar","aria-label":s,children:r===0?o.jsx("span",{className:"v10-layerbar-empty"}):o.jsxs(o.Fragment,{children:[e>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Curator (${e}) — context graphs you created and curate`,style:{width:`${e/r*100}%`,background:c}}),t>0&&o.jsx("span",{className:"v10-layerbar-seg",title:`Joined (${t}) — context graphs you joined as a member`,style:{width:`${t/r*100}%`,background:u}})]})}),o.jsxs("div",{className:"v10-layer-legend",children:[o.jsxs("span",{className:"v10-layer-legend-item",title:"Curator — context graphs you created and curate",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:c}}),"Curator ",e]}),o.jsxs("span",{className:"v10-layer-legend-item",title:"Joined — context graphs you joined as a member",children:[o.jsx("span",{className:"v10-layer-legend-dot",style:{background:u}}),"Joined ",t]})]})]})}function gL({cg:e,identity:t,onReport:n,onOpen:r}){var U,G;const s=hg(e.id,{signalErrors:!0}),[c,u]=w.useState(null),[d,f]=w.useState(!1),h=c===null&&!d,g=w.useRef(!0),m=w.useRef(0),y=w.useCallback(()=>{const M=++m.current;Tn.listParticipants(e.id).then(_=>{g.current&&M===m.current&&(u((_.allowedAgents??[]).map(dn)),f(!1))}).catch(()=>{g.current&&M===m.current&&(u(null),f(!0))})},[e.id]);w.useEffect(()=>{g.current=!0,u(null),f(!1),y();const M=setInterval(y,3e4);return()=>{g.current=!1,clearInterval(M)}},[y]),Ji(w.useCallback(M=>{var I,B;if(M.type!=="join_approved"&&M.type!=="join_rejected"&&M.type!=="project_synced")return;const _=((I=M.data)==null?void 0:I.contextGraphId)??((B=M.data)==null?void 0:B.projectId);_&&_!==e.id||y()},[e.id,y]));const b=ao(e.accessPolicy)==="public",k=w.useMemo(()=>{var B;if(b)return null;const M=(B=e.curator)==null?void 0:B.trim(),_=M?dn(M):null;if(c===null)return d&&_?[_]:null;const I=new Set(c);return _&&I.add(_),[...I]},[c,d,e.curator,b]),j=Number.isFinite(e.assetCount??e.assets)?e.assetCount??e.assets:0,E=w.useMemo(()=>{if(s.error)return{wm:0,swm:0,vm:0,total:j};const M=new Set(s.allTriples.map(_=>_.subject)).size;return{wm:s.counts.wm,swm:s.counts.swm,vm:s.counts.vm,total:M}},[s.error,s.allTriples,s.counts.wm,s.counts.swm,s.counts.vm,j]),S=xS(s),T=w.useMemo(()=>({wm:S.wm,swm:S.swm,vm:S.vm,total:S.canonical}),[S]),N=[s.loading?1:0,s.error?1:0,s.partial?1:0,h?1:0,d?1:0,b?1:0,E.wm,E.swm,E.vm,E.total,T.wm,T.swm,T.vm,T.total,k?k.slice().sort().join(","):"∅"].join("|");w.useEffect(()=>{n(e.id,{entities:E,triples:T,agents:k??[],sizeLoading:s.loading,sizeError:!!s.error||s.partial,sizeFallback:!!s.error,agentsLoading:h,agentsError:d,agentsUnknown:b,sig:N})},[e.id,N]);const R=ao(e.accessPolicy),H=R==="private"?"Curated":R==="public"?"Public":"Unknown",A=!!((U=e.curator)!=null&&U.trim()&&((G=t==null?void 0:t.agentDid)!=null&&G.trim())&&dn(e.curator)===dn(t.agentDid));return o.jsxs("button",{className:"v10-cg-row",onClick:()=>r(e),children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:e.name||e.id.slice(0,16)}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",title:`${H} context graph`,"aria-label":`${H} context graph`,children:R==="private"?o.jsx(S_,{size:13,"aria-hidden":"true"}):R==="public"?o.jsx(b_,{size:13,"aria-hidden":"true"}):o.jsx("span",{className:"v10-cg-dim",children:"—"})}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:s.loading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):s.error?o.jsxs("span",{title:"Live entity count unavailable — showing the published Knowledge-Asset summary, not the full WM/SWM/VM entity total",children:[cl(E.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"KA (summary)"})," · ",o.jsx("span",{className:"v10-cg-dim",children:"— triples"})]}):s.partial?o.jsxs("span",{title:"Partial — one or more memory layers were unavailable; counts are a lower bound",children:["~",cl(E.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ~",cl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}):o.jsxs(o.Fragment,{children:[cl(E.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"entities"})," · ",cl(T.total)," ",o.jsx("span",{className:"v10-cg-dim",children:"triples"})]})}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",children:k===null?o.jsx("span",{className:"v10-cg-dim",children:"—"}):d?o.jsxs("span",{title:"Participant list unavailable — curator-only lower bound",children:["~",k.length]}):k.length}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:o.jsx("span",{className:`v10-cg-badge v10-cg-badge-${A?"curator":"joined"}`,children:A?"CURATOR":"JOINED"})})]})}const Ux={wm:0,swm:0,vm:0,total:0};function vL(){var A,U;const{data:e}=Ea(Tn.fetchStatus,[],1e4),{data:t}=Ea(Tn.fetchEconomics,[],6e4),{data:n,loading:r,error:s}=Ea(Tn.fetchWalletsBalances,[],3e4),{openTab:c}=vn(),{setActiveProject:u}=Na(),{myCgs:d,identity:f,identityLoading:h,cgsLoading:g}=EO(),m=(h||g)&&d.length===0,[y,b]=w.useState({}),k=w.useCallback((G,M)=>{b(_=>{var I;return((I=_[G])==null?void 0:I.sig)===M.sig?_:{..._,[G]:M}})},[]);w.useEffect(()=>{const G=new Set(d.map(M=>M.id));b(M=>{const _=Object.keys(M);if(_.every(B=>G.has(B)))return M;const I={};for(const B of _)G.has(B)&&(I[B]=M[B]);return I})},[d]);const j=w.useMemo(()=>{const G={...Ux},M={...Ux},_=new Set;let I=!1,B=!1,Z=!1,$=!1,D=!1;for(const V of d){const X=y[V.id];if(!X){I=!0,B=!0;continue}X.sizeLoading&&(I=!0),X.agentsLoading&&(B=!0),X.sizeError&&(Z=!0),X.sizeFallback&&(D=!0),(X.agentsError||X.agentsUnknown)&&($=!0);for(const Q of["wm","swm","vm","total"])G[Q]+=X.entities[Q],M[Q]+=X.triples[Q];for(const Q of X.agents)_.add(Q)}const F=d.length>0;return{entities:G,triples:M,agentCount:_.size,sizeLoading:F&&I,agentsLoading:F&&B,sizePartial:Z,agentsPartial:$,triplesUnknown:F&&Z&&M.total===0,sizeApprox:F&&D,hasCgs:F}},[d,y]),E=w.useMemo(()=>{var I,B;const G=(I=f==null?void 0:f.agentDid)!=null&&I.trim()?dn(f.agentDid):null;let M=0,_=0;for(const Z of d)!!(G&&((B=Z.curator)!=null&&B.trim())&&dn(Z.curator)===G)?M++:_++;return{curator:M,joined:_}},[d,f]),S=[{label:"24h",display:"Last 24h"},{label:"7d",display:"Last 7d"},{label:"30d",display:"Last 30d"}],T=G=>{if(G==null||typeof G=="string"&&G.trim()==="")return"—";const M=Number(G);return isFinite(M)?M.toLocaleString(void 0,{maximumFractionDigits:M>=1e3?0:2}):String(G)},N=S.map(G=>{var _;const M=(_=t==null?void 0:t.periods)==null?void 0:_.find(I=>I.label===G.label);return{display:G.display,publishes:M?String(M.publishCount):"—",trac:M?T(M.totalTrac):"—"}});n!=null&&n.symbol;const R=(n==null?void 0:n.balances)??[],H=G=>G.length>12?`${G.slice(0,6)}…${G.slice(-4)}`:G;return o.jsxs("div",{className:"v10-dashboard",children:[o.jsxs("div",{className:"v10-dash-header",children:[o.jsx("h1",{className:"v10-dash-title",children:"Dashboard"}),o.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?` · ${ch(n.chainId).name}`:""]})]}),o.jsxs("div",{className:"v10-dash-stats v10-dash-stats-3",children:[o.jsx(uh,{label:"My Context Graphs",className:"v10-stat-tight",icon:o.jsx(vx,{size:13,"aria-hidden":!0}),value:m?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):d.length,accentColor:"var(--accent-blue)",sub:fL,children:j.hasCgs&&!m?o.jsx(mL,{curator:E.curator,joined:E.joined,refreshing:h}):null}),o.jsxs(uh,{label:"Context Graph Size",icon:o.jsx(R_,{size:13,"aria-hidden":!0}),className:"v10-stat-tight",accentColor:"var(--accent-green)",children:[j.hasCgs?j.sizeLoading?o.jsx("div",{className:"v10-stat-loading",children:"loading…"}):o.jsxs("div",{className:"v10-cg-size-detail",children:[o.jsxs("div",{className:"v10-cg-size-metric",children:[o.jsxs("div",{className:"v10-cg-size-num",children:[o.jsxs("span",{className:"v10-cg-size-big",children:[j.sizeApprox&&!j.triplesUnknown?"~":"",j.entities.total.toLocaleString()]}),j.triplesUnknown?o.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?o.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."}):o.jsx("span",{className:"v10-cg-dim",children:"entities / Knowledge Assets"})]}),j.triplesUnknown||j.sizeApprox?null:o.jsx(Px,{counts:j.entities})]}),o.jsxs("div",{className:"v10-cg-size-metric",children:[o.jsxs("div",{className:"v10-cg-size-num",children:[o.jsx("span",{className:"v10-cg-size-big",children:j.triplesUnknown?"—":`${j.sizeApprox?"~":""}${j.triples.total.toLocaleString()}`}),o.jsx("span",{className:"v10-cg-dim",children:"triples"})]}),j.triplesUnknown||j.sizeApprox?null:o.jsx(Px,{counts:j.triples})]}),o.jsx(hL,{})]}):o.jsx("div",{className:"v10-stat-empty",children:"—"}),o.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."})]}),o.jsx(uh,{label:"Collaborating Agents",icon:o.jsx(z_,{size:13,"aria-hidden":!0}),value:j.hasCgs?j.agentsLoading?o.jsx("span",{className:"v10-stat-loading",children:"loading…"}):j.agentsPartial?`~${j.agentCount}`:j.agentCount:o.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)"})]}),o.jsxs("div",{className:"v10-dash-grid v10-dash-grid-2",children:[o.jsxs("div",{className:"v10-dash-section v10-dash-section-wide v10-anim-mount",children:[o.jsxs("div",{className:"v10-dash-section-header",children:[o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(vx,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"My Context Graphs"})]}),o.jsx("span",{className:"v10-dash-section-badge",children:d.length})]}),m?o.jsx("p",{className:"v10-cg-empty",children:"Loading context graphs…"}):d.length===0?o.jsx("p",{className:"v10-cg-empty",children:"No context graphs yet — create or join one from the sidebar."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-cg-colhead",children:[o.jsx("span",{className:"v10-cg-cell v10-cg-name",children:"Name"}),o.jsx("span",{className:"v10-cg-cell v10-cg-type",children:"Type"}),o.jsx("span",{className:"v10-cg-cell v10-cg-size",children:"Size"}),o.jsx("span",{className:"v10-cg-cell v10-cg-agents",title:"Agents allow-listed with access to this context graph",children:"Agents"}),o.jsx("span",{className:"v10-cg-cell v10-cg-role",children:"Role"})]}),o.jsx("div",{className:"v10-cg-list",children:d.map(G=>o.jsx(gL,{cg:G,identity:f,onReport:k,onOpen:M=>{u(M.id),c({id:`project:${M.id}`,label:M.name||M.id.slice(0,12),closable:!0})}},G.id))})]})]}),o.jsxs("div",{className:"v10-dash-section v10-anim-mount",children:[o.jsx("div",{className:"v10-dash-section-header",children:o.jsxs("div",{className:"v10-dash-section-title",children:[o.jsx(D_,{size:13,"aria-hidden":!0}),o.jsx("h3",{children:"Wallets and Spending"})]})}),(n==null?void 0:n.chainId)!=null?o.jsxs("div",{className:"v10-ws-chain-row",children:[o.jsx("span",{className:"v10-ws-chain-label",children:"Chain"}),o.jsx("span",{className:"v10-ws-chain-value",children:ch(n.chainId).name})]}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Node wallets"}),r&&!n?o.jsx("p",{className:"v10-cg-empty",children:"Loading wallets…"}):R.length>0?o.jsxs("div",{className:"v10-ws-wtable",children:[o.jsxs("div",{className:"v10-ws-wrow v10-ws-whead",children:[o.jsx("span",{children:"Wallet"}),o.jsx("span",{children:"TRAC"}),o.jsxs("span",{children:["Gas (",ch(n==null?void 0:n.chainId).gas,")"]})]}),R.map(G=>o.jsxs("div",{className:"v10-ws-wrow",children:[o.jsx("span",{className:"v10-ws-addr",title:G.address,children:H(G.address)}),o.jsx("span",{className:"v10-ws-bal",children:T(G.trac)}),o.jsx("span",{className:"v10-ws-bal-sec",title:pL(G.eth),children:dL(G.eth)})]},G.address))]}):(((A=n==null?void 0:n.wallets)==null?void 0:A.length)??0)>0?o.jsx("ul",{className:"v10-ws-wallets",children:((n==null?void 0:n.wallets)??[]).map(G=>o.jsxs("li",{className:"v10-ws-wallet",children:[o.jsx("span",{className:"v10-ws-addr",title:G,children:H(G)}),o.jsx("span",{className:"v10-cg-dim",children:"—"})]},G))}):n!=null&&n.error||s?o.jsx("p",{className:"v10-cg-empty",children:"Wallet balances unavailable."}):o.jsx("p",{className:"v10-cg-empty",children:"No node wallets found."}),(n!=null&&n.error||s)&&(R.length>0||(((U=n==null?void 0:n.wallets)==null?void 0:U.length)??0)>0)?o.jsx("p",{className:"v10-ws-note",children:"Balances may be stale — the chain/RPC reported an error."}):null,o.jsx("div",{className:"v10-ws-subhead",children:"Spending"}),o.jsxs("div",{className:"v10-ws-spend",children:[o.jsxs("div",{className:"v10-ws-spend-head",children:[o.jsx("span",{children:"Period"}),o.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"}),o.jsx("span",{children:"TRAC"})]}),N.map(G=>o.jsxs("div",{className:"v10-ws-spend-row",children:[o.jsx("span",{className:"v10-cg-dim",children:G.display}),o.jsx("span",{className:"v10-ws-spend-val",children:G.publishes}),o.jsx("span",{className:"v10-ws-spend-val",children:G.trac})]},G.display))]})]})]})]})}const yL=new Set(["meta"]),za="__root__";function yg(e){return!yL.has(e.name)}const bL=".md, .docx, .pdf, .txt, .csv, .json, .ttl, .rdf, .owl, .py, .ts, .js, .tsx, .jsx, .java, .go, .rs, .c, .cpp, .html, .xml, .yaml, .yml";function Bx(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function xL(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 wL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){var X;const[s,c]=w.useState([]),[u,d]=w.useState(!0),[f,h]=w.useState(!0),[g,m]=w.useState("idle"),[y,b]=w.useState(0),[k,j]=w.useState([]),[E,S]=w.useState(null),[T,N]=w.useState(!1),R=w.useRef(null),H=w.useCallback(Q=>{const L=Array.from(Q);c(P=>{const q=new Set(P.map(ne=>`${ne.file.name}:${ne.file.size}`)),O=L.filter(ne=>!q.has(`${ne.name}:${ne.size}`));return[...P,...O.map(ne=>({file:ne,id:`${ne.name}-${ne.size}-${Date.now()}`}))]})},[]),A=Q=>{c(L=>L.filter(P=>P.id!==Q))},U=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!0)},G=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!1)},M=Q=>{Q.preventDefault(),Q.stopPropagation(),N(!1),Q.dataTransfer.files.length>0&&H(Q.dataTransfer.files)},_=async()=>{if(s.length===0)return;m("uploading"),b(0),j([]),S(null);const Q=[];for(let P=0;P<s.length;P++){b(P);const{file:q}=s[P],O=q.name.replace(/[^a-zA-Z0-9._-]/g,"_"),ne=`${Date.now().toString(36)}-${P}-${O}`;try{const ue=await Gk(ne,n,q),le=ue.extraction.tripleCount??ue.extraction.triplesWritten;Q.push({fileName:q.name,status:ue.extraction.status==="completed"?"success":ue.extraction.status==="skipped"?"skipped":"error",triplesWritten:le,error:ue.extraction.error})}catch(ue){Q.push({fileName:q.name,status:"error",error:(ue==null?void 0:ue.message)??"Upload failed"})}}j(Q),b(s.length);const L=Q.some(P=>P.status==="error");m(L?"error":"done")},I=()=>{g!=="uploading"&&(c([]),j([]),m("idle"),S(null),b(0),t())},{dialogRef:B,onBackdropClick:Z}=Zi(e,I);if(!e)return null;const $=k.reduce((Q,L)=>Q+(L.triplesWritten??0),0),D=k.filter(Q=>Q.status==="success").length,F=k.filter(Q=>Q.status==="skipped").length,V=k.filter(Q=>Q.status==="error").length;return o.jsx("div",{className:"v10-modal-overlay",onClick:Z,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:B,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-import-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-import-modal-title",className:"v10-modal-title",children:"Import to Working Memory"}),o.jsx("div",{className:"v10-modal-subtitle",children:r?o.jsxs(o.Fragment,{children:["Upload files to ",o.jsx("strong",{children:r})," — your agent will extract structured knowledge."]}):o.jsx(o.Fragment,{children:"Upload files — your agent will extract structured knowledge and add it to working memory."})})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:I,disabled:g==="uploading","aria-label":"Close import dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:g==="uploading"?"not-allowed":"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[E&&o.jsx("div",{className:"v10-modal-error",children:E}),g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`v10-import-dropzone ${T?"drag-over":""}`,onClick:()=>{var Q;return(Q=R.current)==null?void 0:Q.click()},onDragOver:U,onDragLeave:G,onDrop:M,children:[o.jsx("div",{className:"v10-import-dropzone-label",children:"Drag files here, or click to browse"}),o.jsx("div",{className:"v10-import-dropzone-hint",style:{marginTop:4},children:"Your agent will extract structured knowledge and add it to working memory."}),o.jsxs("div",{className:"v10-import-dropzone-hint",style:{marginTop:8},children:["Supported: ",bL]}),o.jsx("input",{ref:R,type:"file",multiple:!0,style:{display:"none"},onChange:Q=>{Q.target.files&&H(Q.target.files),Q.target.value=""}})]}),s.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-import-file-list",children:s.map(Q=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:xL(Q.file.name)}),o.jsx("span",{className:"v10-import-file-name",children:Q.file.name}),o.jsx("span",{className:"v10-import-file-size",children:Bx(Q.file.size)}),o.jsx("button",{className:"v10-import-file-remove",onClick:()=>A(Q.id),title:"Remove",children:"×"})]},Q.id))}),o.jsxs("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginBottom:12},children:[s.length," file",s.length!==1?"s":""," selected · ",Bx(s.reduce((Q,L)=>Q+L.file.size,0))," total"]})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-label",style:{marginBottom:8},children:["Ingestion Options ",o.jsx("span",{style:{fontSize:10,fontWeight:400,color:"var(--text-tertiary)"},children:"(coming soon)"})]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:f,disabled:!0,readOnly:!0}),"Store original files as Knowledge Assets"]}),o.jsxs("label",{className:"v10-import-option",style:{opacity:.5,pointerEvents:"none"},children:[o.jsx("input",{type:"checkbox",checked:u,disabled:!0,readOnly:!0}),"Let agent extract structured knowledge from content"]})]}),g==="uploading"&&o.jsxs("div",{className:"v10-import-progress",children:[o.jsxs("div",{style:{fontSize:12,color:"var(--text-secondary)",fontWeight:500},children:["Importing files… (",y+1," of ",s.length,")"]}),o.jsx("div",{style:{fontSize:11,color:"var(--text-tertiary)",marginTop:4},children:((X=s[y])==null?void 0:X.file.name)??"…"}),o.jsx("div",{className:"v10-import-progress-bar",children:o.jsx("div",{className:"v10-import-progress-fill",style:{width:`${(y+.5)/s.length*100}%`}})}),o.jsxs("div",{className:"v10-import-progress-text",children:[y," of ",s.length," files processed"]})]}),(g==="done"||g==="error")&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-import-result ${V>0?"error":"success"}`,"data-testid":"import-result","data-import-status":V>0?"error":"success","data-import-triples":$,children:V===0?o.jsxs(o.Fragment,{children:[D>0&&o.jsxs(o.Fragment,{children:["Successfully imported ",D," file",D!==1?"s":"",".",$>0&&o.jsxs(o.Fragment,{children:[" Extracted ",o.jsx("strong",{children:$.toLocaleString()})," triples into working memory."]})]}),F>0&&o.jsxs(o.Fragment,{children:[D>0?" ":"","Stored ",F," file",F!==1?"s":""," as source — no structured knowledge was extracted yet (extraction for these file types is coming soon)."]})]}):o.jsxs(o.Fragment,{children:[D," file",D!==1?"s":""," imported",F>0&&o.jsxs(o.Fragment,{children:[", ",F," stored without extraction"]}),", ",V," failed.",$>0&&o.jsxs(o.Fragment,{children:[" ",$.toLocaleString()," triples extracted."]})]})}),k.length>0&&o.jsx("div",{className:"v10-import-file-list",style:{marginTop:12},children:k.map((Q,L)=>o.jsxs("div",{className:"v10-import-file-item",children:[o.jsx("span",{className:"v10-import-file-icon",children:Q.status==="success"?"✓":Q.status==="skipped"?"–":"✗"}),o.jsx("span",{className:"v10-import-file-name",children:Q.fileName}),o.jsx("span",{className:"v10-import-file-size",style:Q.status==="error"?{color:"var(--text-danger)"}:void 0,children:Q.status==="success"&&Q.triplesWritten!=null?`${Q.triplesWritten} triples`:Q.status==="skipped"?"stored (no extraction)":Q.error??"failed"})]},L))})]})]}),o.jsxs("div",{className:"v10-modal-footer",children:[g==="idle"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"v10-modal-btn",onClick:I,children:"Cancel"}),o.jsxs("button",{className:"v10-modal-btn primary",onClick:_,disabled:s.length===0,children:["Start Import (",s.length," file",s.length!==1?"s":"",")"]})]}),g==="uploading"&&o.jsx("button",{className:"v10-modal-btn",disabled:!0,children:"Importing…"}),(g==="done"||g==="error")&&o.jsx("button",{className:"v10-modal-btn primary",onClick:I,children:"Done"})]})]})})}function kL(e){return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-4)}`}function SL({open:e,onClose:t,contextGraphId:n,contextGraphName:r}){const[s,c]=w.useState(null),[u,d]=w.useState(null),[f,h]=w.useState([]),[g,m]=w.useState(null),[y,b]=w.useState([]),[k,j]=w.useState([]),[E,S]=w.useState(null),[T,N]=w.useState("allowlist");w.useEffect(()=>{e&&(fetch("/api/status",{headers:Zt()}).then(I=>I.json()).then(I=>{typeof(I==null?void 0:I.peerId)=="string"&&I.peerId.length>0&&d(I.peerId)}).catch(()=>{}),Hk(n).then(I=>h(I.allowedAgents)).catch(()=>h([])),Jm().then(I=>{const B=(I.agents??[]).filter(Z=>Z.connectionStatus!=="self");b(B)}).catch(()=>b([])),qk(n).then(I=>j(I.requests)).catch(()=>j([])))},[e,n]);const{dialogRef:R,onBackdropClick:H}=Zi(e,t);if(!e)return null;const A=u?`${n}
|
|
1137
|
-
${u}`:null,U=(I,B)=>{navigator.clipboard.writeText(I).then(()=>{c(B),setTimeout(()=>c(null),2e3)}).catch(()=>{})},G=async I=>{try{await m2(n,I),h(B=>B.filter(Z=>Z!==I))}catch{}},M=async I=>{S(I);try{await eg(n,I),j(B=>B.filter(Z=>Z.agentAddress!==I)),h(B=>[...new Set([...B,I])])}catch(B){m((B==null?void 0:B.message)||"Failed to approve")}finally{S(null)}},_=async I=>{S(I);try{await tg(n,I),j(B=>B.filter(Z=>Z.agentAddress!==I))}catch(B){m((B==null?void 0:B.message)||"Failed to reject")}finally{S(null)}};return o.jsx("div",{className:"v10-modal-overlay",onClick:H,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box",style:{maxWidth:560},ref:R,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-share-modal-title",children:[o.jsxs("div",{className:"v10-modal-header",style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{id:"dkg-share-modal-title",className:"v10-modal-title",children:"Share Context Graph"}),o.jsxs("div",{className:"v10-modal-subtitle",children:["Invite agents to collaborate on ",o.jsx("strong",{children:r}),"."]})]}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close share dialog",title:"Close (Esc)",style:{flexShrink:0,cursor:"pointer"},children:"×"})]}),o.jsxs("div",{className:"v10-modal-body",children:[o.jsxs("div",{style:{display:"flex",gap:0,marginBottom:16,borderBottom:"1px solid var(--border-default)"},children:[o.jsx("button",{onClick:()=>N("allowlist"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="allowlist"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="allowlist"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="allowlist"?"2px solid var(--accent-primary)":"2px solid transparent"},children:"Allowlist"}),o.jsxs("button",{onClick:()=>N("requests"),style:{padding:"8px 16px",fontSize:12,fontWeight:T==="requests"?600:400,background:"none",border:"none",cursor:"pointer",color:T==="requests"?"var(--text-primary)":"var(--text-tertiary)",borderBottom:T==="requests"?"2px solid var(--accent-primary)":"2px solid transparent",position:"relative"},children:["Join Requests",k.length>0&&o.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})]})]}),T==="allowlist"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Allowed Agents"}),o.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 ",o.jsx("strong",{children:"Join Requests"})," tab."]}),f.length>0&&o.jsx("div",{style:{marginBottom:8,display:"flex",flexDirection:"column",gap:4},children:f.map(I=>{const B=y.find(Z=>{var $;return(($=Z.agentAddress)==null?void 0:$.toLowerCase())===I.toLowerCase()});return o.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:[o.jsx("span",{style:{color:"var(--text-primary)"},children:B?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{fontFamily:"var(--font-body)",fontWeight:500},children:B.name})," ",o.jsx("span",{style:{color:"var(--text-tertiary)",fontSize:10},children:kL(I)})]}):I}),o.jsx("button",{onClick:()=>G(I),style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-tertiary)",fontSize:12,padding:"0 4px"},title:"Remove agent",children:"×"})]},I)})}),f.length===0&&o.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."})]}),o.jsx("div",{className:"v10-form-divider"}),o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Invite Code"}),A===null?o.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…"}):o.jsxs("div",{style:{position:"relative"},children:[o.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:A}),o.jsx("button",{className:"v10-modal-btn primary",onClick:()=>U(A,"invite"),style:{position:"absolute",top:6,right:6,fontSize:10,padding:"4px 10px",height:26,cursor:"pointer"},children:s==="invite"?"Copied":"Copy Invite"})]})]})]}),T==="requests"&&o.jsxs("div",{className:"v10-form-group",children:[o.jsx("label",{className:"v10-form-label",children:"Pending Join Requests"}),o.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&&o.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(I=>o.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:[o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[I.name&&o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:500},children:I.name}),o.jsx("span",{style:{color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",fontSize:10},children:I.agentAddress}),o.jsxs("span",{style:{fontSize:9,color:"var(--text-tertiary)"},children:["Requested ",new Date(I.timestamp).toLocaleString()]})]}),o.jsxs("div",{style:{display:"flex",gap:6},children:[o.jsx("button",{onClick:()=>M(I.agentAddress),disabled:E===I.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:E===I.agentAddress?"…":"Approve"}),o.jsx("button",{onClick:()=>_(I.agentAddress),disabled:E===I.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"})]})]},I.agentAddress)),g&&o.jsx("div",{style:{fontSize:10,color:"var(--text-danger)",marginTop:4},children:g})]})]}),o.jsx("div",{className:"v10-modal-footer",children:o.jsx("button",{className:"v10-modal-btn",onClick:t,children:"Done"})})]})})}async function Ii(e,t){var r;const n=await ia(e,t);return((r=n==null?void 0:n.result)==null?void 0:r.bindings)??[]}const Pi={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},jL=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),CL={slug:za,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},NL=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),es="http://dkg.io/ontology/profile/";function wS(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 rt(e){const t=wS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1138
|
-
`).replace(/\\\\/g,"\\"):t}function om(e){const t=rt(e),n=parseInt(t,10);return Number.isFinite(n)?n:0}function ts(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function EL(e){return`PREFIX prof: <${es}>
|
|
1139
|
-
PREFIX schema: <http://schema.org/>
|
|
1140
|
-
SELECT ?profile ?name ?description ?primary ?accent
|
|
1141
|
-
WHERE {
|
|
1142
|
-
GRAPH ?g {
|
|
1143
|
-
?profile a prof:Profile .
|
|
1144
|
-
OPTIONAL { ?profile prof:displayName ?name }
|
|
1145
|
-
OPTIONAL { ?profile schema:description ?description }
|
|
1146
|
-
OPTIONAL { ?profile prof:primaryColor ?primary }
|
|
1147
|
-
OPTIONAL { ?profile prof:accentColor ?accent }
|
|
1148
|
-
}
|
|
1149
|
-
${ts(e)}
|
|
1150
|
-
} LIMIT 1`}function TL(e){return`PREFIX prof: <${es}>
|
|
1151
|
-
PREFIX schema: <http://schema.org/>
|
|
1152
|
-
SELECT ?slug ?displayName ?description ?icon ?color ?rank ?timelinePredicate ?sourceAssertion
|
|
1153
|
-
WHERE {
|
|
1154
|
-
GRAPH ?g {
|
|
1155
|
-
?b a prof:SubGraphBinding ;
|
|
1156
|
-
prof:forSubGraph ?slug .
|
|
1157
|
-
OPTIONAL { ?b prof:displayName ?displayName }
|
|
1158
|
-
OPTIONAL { ?b schema:description ?description }
|
|
1159
|
-
OPTIONAL { ?b prof:icon ?icon }
|
|
1160
|
-
OPTIONAL { ?b prof:color ?color }
|
|
1161
|
-
OPTIONAL { ?b prof:rank ?rank }
|
|
1162
|
-
OPTIONAL { ?b prof:timelinePredicate ?timelinePredicate }
|
|
1163
|
-
OPTIONAL { ?b prof:sourceAssertion ?sourceAssertion }
|
|
1164
|
-
}
|
|
1165
|
-
${ts(e)}
|
|
1166
|
-
}`}function AL(e){return`PREFIX prof: <${es}>
|
|
1167
|
-
SELECT ?chip ?subGraph ?type ?predicate ?label
|
|
1168
|
-
(GROUP_CONCAT(DISTINCT ?v; separator="|") AS ?values)
|
|
1169
|
-
WHERE {
|
|
1170
|
-
GRAPH ?g {
|
|
1171
|
-
?chip a prof:FilterChip ;
|
|
1172
|
-
prof:forSubGraph ?subGraph ;
|
|
1173
|
-
prof:forType ?type ;
|
|
1174
|
-
prof:onPredicate ?predicate ;
|
|
1175
|
-
prof:chipValue ?v .
|
|
1176
|
-
OPTIONAL { ?chip prof:label ?label }
|
|
1177
|
-
}
|
|
1178
|
-
${ts(e)}
|
|
1179
|
-
}
|
|
1180
|
-
GROUP BY ?chip ?subGraph ?type ?predicate ?label`}function RL(e){return`PREFIX prof: <${es}>
|
|
1181
|
-
PREFIX schema: <http://schema.org/>
|
|
1182
|
-
SELECT ?catalog ?subGraph ?name ?description ?rank
|
|
1183
|
-
WHERE {
|
|
1184
|
-
GRAPH ?g {
|
|
1185
|
-
?catalog a prof:QueryCatalog ;
|
|
1186
|
-
prof:forSubGraph ?subGraph .
|
|
1187
|
-
OPTIONAL { ?catalog prof:displayName ?name }
|
|
1188
|
-
OPTIONAL { ?catalog schema:description ?description }
|
|
1189
|
-
OPTIONAL { ?catalog prof:rank ?rank }
|
|
1190
|
-
}
|
|
1191
|
-
${ts(e)}
|
|
1192
|
-
}`}function _L(e){return`PREFIX prof: <${es}>
|
|
1193
|
-
PREFIX schema: <http://schema.org/>
|
|
1194
|
-
SELECT ?q ?subGraph ?catalog ?name ?description ?sparql ?column ?rank
|
|
1195
|
-
WHERE {
|
|
1196
|
-
GRAPH ?g {
|
|
1197
|
-
?q a prof:SavedQuery ;
|
|
1198
|
-
prof:forSubGraph ?subGraph ;
|
|
1199
|
-
prof:sparqlQuery ?sparql .
|
|
1200
|
-
OPTIONAL { ?q prof:inCatalog ?catalog }
|
|
1201
|
-
OPTIONAL { ?q prof:displayName ?name }
|
|
1202
|
-
OPTIONAL { ?q schema:description ?description }
|
|
1203
|
-
OPTIONAL { ?q prof:resultColumn ?column }
|
|
1204
|
-
OPTIONAL { ?q prof:rank ?rank }
|
|
1205
|
-
}
|
|
1206
|
-
${ts(e)}
|
|
1207
|
-
}`}function OL(e,t){const n=new Map;for(const f of e){const h=La(f.catalog);if(!h)continue;const g=h.split(":catalog:").pop()??h;n.set(h,{slug:g,subGraph:rt(f.subGraph),name:rt(f.name)||g,description:rt(f.description)||void 0,rank:om(f.rank)||99,queries:[]})}const r=t.map(f=>{const h=La(f.q),g=h.split(":query:").pop()??h,m=rt(f.subGraph),y=La(f.catalog),b=y?n.get(y):void 0,k=`default:${m}`;return{slug:g,subGraph:m,catalogSlug:(b==null?void 0:b.slug)??k,catalogName:(b==null?void 0:b.name)??"Queries",catalogDescription:b==null?void 0:b.description,catalogRank:(b==null?void 0:b.rank)??999,name:rt(f.name)||g,description:rt(f.description)||void 0,sparql:rt(f.sparql),resultColumn:rt(f.column)||"",rank:om(f.rank)||99}}).filter(f=>f.subGraph&&f.sparql).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.catalogRank-h.catalogRank||f.catalogName.localeCompare(h.catalogName)||f.rank-h.rank||f.name.localeCompare(h.name)),s=new Map;for(const f of n.values())s.set(`${f.subGraph}|${f.slug}`,{...f,queries:[]});for(const f of r){const h=`${f.subGraph}|${f.catalogSlug}`,g=s.get(h);if(g){g.queries.push(f);continue}s.set(h,{slug:f.catalogSlug,subGraph:f.subGraph,name:f.catalogName,description:f.catalogDescription,rank:f.catalogRank,queries:[f]})}const c=Array.from(s.values()).filter(f=>f.queries.length>0).map(f=>({...f,queries:[...f.queries].sort((h,g)=>h.rank-g.rank||h.name.localeCompare(g.name))})).sort((f,h)=>f.subGraph.localeCompare(h.subGraph)||f.rank-h.rank||f.name.localeCompare(h.name)),u=new Map,d=new Map;for(const f of c){const h=u.get(f.subGraph)??[];h.push(f),u.set(f.subGraph,h);const g=d.get(f.subGraph)??[];g.push(...f.queries),d.set(f.subGraph,g)}return{queryCatalogs:c,savedQueries:r,catalogsBySubGraph:u,queriesBySubGraph:d}}function LL(e){return`PREFIX prof: <${es}>
|
|
1208
|
-
SELECT ?type ?label ?icon ?color ?detailHint
|
|
1209
|
-
?promoteLabel ?promoteHint ?publishLabel ?publishHint
|
|
1210
|
-
WHERE {
|
|
1211
|
-
GRAPH ?g {
|
|
1212
|
-
?b a prof:EntityTypeBinding ;
|
|
1213
|
-
prof:forType ?type .
|
|
1214
|
-
OPTIONAL { ?b prof:label ?label }
|
|
1215
|
-
OPTIONAL { ?b prof:icon ?icon }
|
|
1216
|
-
OPTIONAL { ?b prof:color ?color }
|
|
1217
|
-
OPTIONAL { ?b prof:detailHint ?detailHint }
|
|
1218
|
-
OPTIONAL { ?b prof:promoteLabel ?promoteLabel }
|
|
1219
|
-
OPTIONAL { ?b prof:promoteHint ?promoteHint }
|
|
1220
|
-
OPTIONAL { ?b prof:publishLabel ?publishLabel }
|
|
1221
|
-
OPTIONAL { ?b prof:publishHint ?publishHint }
|
|
1222
|
-
}
|
|
1223
|
-
${ts(e)}
|
|
1224
|
-
}`}function zL(e){return`PREFIX prof: <${es}>
|
|
1225
|
-
PREFIX schema: <http://schema.org/>
|
|
1226
|
-
SELECT ?view ?name ?description ?nodeSize
|
|
1227
|
-
(GROUP_CONCAT(DISTINCT ?incType; separator="|") AS ?includeTypes)
|
|
1228
|
-
(GROUP_CONCAT(DISTINCT ?empPred; separator="|") AS ?emphasizePredicates)
|
|
1229
|
-
WHERE {
|
|
1230
|
-
GRAPH ?g {
|
|
1231
|
-
?view a prof:ViewConfig .
|
|
1232
|
-
OPTIONAL { ?view prof:displayName ?name }
|
|
1233
|
-
OPTIONAL { ?view schema:description ?description }
|
|
1234
|
-
OPTIONAL { ?view prof:nodeSize ?nodeSize }
|
|
1235
|
-
OPTIONAL { ?view prof:includeType ?incType }
|
|
1236
|
-
OPTIONAL { ?view prof:emphasizePredicate ?empPred }
|
|
1237
|
-
}
|
|
1238
|
-
${ts(e)}
|
|
1239
|
-
}
|
|
1240
|
-
GROUP BY ?view ?name ?description ?nodeSize`}function La(e){const t=wS(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function ML(e){const[t,n]=w.useState(!0),[r,s]=w.useState(),[c,u]=w.useState(Pi.displayName),[d,f]=w.useState(),[h,g]=w.useState(Pi.primaryColor),[m,y]=w.useState(Pi.accentColor),[b,k]=w.useState([]),[j,E]=w.useState([]),[S,T]=w.useState([]),[N,R]=w.useState([]),[H,A]=w.useState([]),[U,G]=w.useState([]),M=w.useRef(new Map),_=w.useRef(new Map),I=w.useRef(new Map),B=w.useRef(new Map),Z=w.useRef(new Map),$=w.useRef(new Map);w.useEffect(()=>{if(!e){n(!1);return}let P=!1;return(async()=>{n(!0),s(void 0);try{const[q,O,ne,ue,le,be,Re]=await Promise.all([Ii(EL(e),e).catch(()=>[]),Ii(TL(e),e).catch(()=>[]),Ii(LL(e),e).catch(()=>[]),Ii(zL(e),e).catch(()=>[]),Ii(AL(e),e).catch(()=>[]),Ii(RL(e),e).catch(()=>[]),Ii(_L(e),e).catch(()=>[])]);if(P)return;const Ee=e;if(q[0]){const ke=q[0];u(rt(ke.name)||Ee),f(rt(ke.description)||void 0),g(rt(ke.primary)||Pi.primaryColor),y(rt(ke.accent)||Pi.accentColor)}else u(Ee),f(void 0),g(Pi.primaryColor),y(Pi.accentColor);const Ie=O.map(ke=>({slug:rt(ke.slug),displayName:rt(ke.displayName)||rt(ke.slug),description:rt(ke.description)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,rank:om(ke.rank)||99,timelinePredicate:La(ke.timelinePredicate)||void 0,sourceAssertion:rt(ke.sourceAssertion)||void 0})).filter(ke=>ke.slug).sort((ke,lt)=>ke.rank-lt.rank);k(Ie),_.current=new Map(Ie.map(ke=>[ke.slug,ke]));const Ve=ne.map(ke=>({typeIri:La(ke.type),label:rt(ke.label)||void 0,icon:rt(ke.icon)||void 0,color:rt(ke.color)||void 0,detailHint:rt(ke.detailHint)||void 0,promoteLabel:rt(ke.promoteLabel)||void 0,promoteHint:rt(ke.promoteHint)||void 0,publishLabel:rt(ke.publishLabel)||void 0,publishHint:rt(ke.publishHint)||void 0})).filter(ke=>ke.typeIri);E(Ve),M.current=new Map(Ve.map(ke=>[ke.typeIri,ke]));const Se=ue.map(ke=>{const lt=La(ke.view),xe=lt.split(":view:").pop()??lt;return{slug:xe,name:rt(ke.name)||xe,description:rt(ke.description)||void 0,nodeSize:rt(ke.nodeSize)||void 0,includeTypes:rt(ke.includeTypes).split("|").map(Oe=>La(Oe.trim())).filter(Boolean),emphasizePredicates:rt(ke.emphasizePredicates).split("|").map(Oe=>La(Oe.trim())).filter(Boolean)}});T(Se),I.current=new Map(Se.map(ke=>[ke.slug,ke]));const ft=le.map(ke=>{const lt=La(ke.chip),xe=lt.split(":chip:").pop()??lt,Oe=rt(ke.values).split("|").map(_t=>rt(_t.trim())).filter(Boolean);return{slug:xe,subGraph:rt(ke.subGraph),typeIri:La(ke.type),predicate:La(ke.predicate),label:rt(ke.label)||"Filter",values:Oe}}).filter(ke=>ke.subGraph&&ke.predicate&&ke.values.length>0);R(ft);const Me=new Map;for(const ke of ft){const lt=Me.get(ke.subGraph)??[];lt.push(ke),Me.set(ke.subGraph,lt)}B.current=Me;const qe=OL(be,Re);A(qe.queryCatalogs),G(qe.savedQueries),Z.current=qe.catalogsBySubGraph,$.current=qe.queriesBySubGraph}catch(q){P||s((q==null?void 0:q.message)??String(q))}finally{P||n(!1)}})(),()=>{P=!0}},[e]);const D=w.useCallback(P=>P===za?CL:_.current.get(P)??jL(P),[]),F=w.useCallback(P=>M.current.get(P)??NL(P),[]),V=w.useCallback(P=>I.current.get(P),[]),X=w.useCallback(P=>B.current.get(P)??[],[]),Q=w.useCallback(P=>Z.current.get(P)??[],[]),L=w.useCallback(P=>$.current.get(P)??[],[]);return{contextGraphId:e??"",displayName:c,description:d,primaryColor:h,accentColor:m,subGraphs:b,typeBindings:j,views:S,filterChips:N,queryCatalogs:H,savedQueries:U,loading:t,error:r,forSubGraph:D,forType:F,view:V,chipsFor:X,savedQueryCatalogsFor:Q,savedQueriesFor:L}}const kS=Qe.createContext(null);function Ir(){return w.useContext(kS)}const DL="http://dkg.io/ontology/agent/";function $L(e){return`FILTER(strstarts(str(?g), "${`did:dkg:context-graph:${e}/meta`.replace(/"/g,'\\"')}"))`}function IL(e){return`PREFIX ag: <${DL}>
|
|
1241
|
-
PREFIX schema: <http://schema.org/>
|
|
1242
|
-
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
1243
|
-
SELECT ?a ?kind ?name ?label ?fw ?op ?wallet ?peerId ?avatar ?reputation
|
|
1244
|
-
WHERE {
|
|
1245
|
-
GRAPH ?g {
|
|
1246
|
-
?a a ag:Agent .
|
|
1247
|
-
OPTIONAL { ?a a ag:HumanAgent . BIND("human" AS ?kind) }
|
|
1248
|
-
OPTIONAL { ?a a ag:AIAgent . BIND("ai" AS ?kindAi) }
|
|
1249
|
-
OPTIONAL { ?a schema:name ?name }
|
|
1250
|
-
OPTIONAL { ?a rdfs:label ?label }
|
|
1251
|
-
OPTIONAL { ?a ag:framework ?fw }
|
|
1252
|
-
OPTIONAL { ?a ag:operator ?op }
|
|
1253
|
-
OPTIONAL { ?a ag:walletAddress ?wallet }
|
|
1254
|
-
OPTIONAL { ?a ag:peerId ?peerId }
|
|
1255
|
-
OPTIONAL { ?a ag:avatar ?avatar }
|
|
1256
|
-
OPTIONAL { ?a ag:reputation ?reputation }
|
|
1257
|
-
}
|
|
1258
|
-
${$L(e)}
|
|
1259
|
-
}`}function SS(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 Za(e){const t=SS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1260
|
-
`).replace(/\\\\/g,"\\"):t}function Fx(e){const t=SS(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function PL(e){let t=0;for(let s=0;s<e.length;s++)t=t*31+e.charCodeAt(s)|0;return`hsl(${((t%360+360)%360+25)%360}, 55%, 58%)`}function UL(e){const t=new Map;for(const n of e){const r=Fx(n.a);if(!r)continue;const s=t.get(r),c=Za(n.kindAi)==="ai"||Za(n.kind)==="ai"?"ai":Za(n.kind)==="human"?"human":(s==null?void 0:s.kind)??"ai",u={uri:r,name:Za(n.name)||Za(n.label)||r.split(":").pop()||r,kind:c,framework:Za(n.fw)||(s==null?void 0:s.framework),operatorUri:Fx(n.op)||(s==null?void 0:s.operatorUri),walletAddress:Za(n.wallet)||(s==null?void 0:s.walletAddress),peerId:Za(n.peerId)||(s==null?void 0:s.peerId),avatar:Za(n.avatar)||(s==null?void 0:s.avatar),reputation:Za(n.reputation)||(s==null?void 0:s.reputation),color:PL(r)};u.kind==="human"&&!u.framework&&(u.framework="human"),t.set(r,u)}for(const n of t.values())if(n.operatorUri){const r=t.get(n.operatorUri);r&&(n.operatorName=r.name)}return t}function BL(e){const[t,n]=w.useState(()=>new Map),[r,s]=w.useState(!0),[c,u]=w.useState(),d=w.useRef(new Map);w.useEffect(()=>{if(!e){s(!1);return}let m=!1;return(async()=>{var y;s(!0),u(void 0);try{const b=await ia(IL(e),e);if(m)return;const k=((y=b==null?void 0:b.result)==null?void 0:y.bindings)??[],j=UL(k);n(j),d.current=j}catch(b){m||u((b==null?void 0:b.message)??String(b))}finally{m||s(!1)}})(),()=>{m=!0}},[e]);const f=w.useCallback(m=>d.current.get(m),[]),h=Qe.useMemo(()=>[...t.values()].sort((m,y)=>m.name.localeCompare(y.name)),[t]),g=w.useCallback(m=>{},[]);return{agents:t,list:h,loading:r,error:c,get:f,openAgent:g}}const jS=Qe.createContext(null);function ns(){return w.useContext(jS)}const lm=["#6366f1","#14b8a6","#f43f5e","#facc15","#8b5cf6","#10b981","#0ea5e9","#d946ef"],Hx=1e4;function ul(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 FL(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 HL(e){return e.startsWith("did:")||e.startsWith("12D3")?e:/^0x[0-9a-fA-F]{40}$/.test(e)?`did:dkg:agent:${e}`:e}function qL(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const r=e.slice(n.length),s=r.indexOf("/");if(s<0)return;const c=r.slice(0,s);if(!(!c||c.startsWith("_")))return c}function GL(e){return`PREFIX dkg: <http://dkg.io/ontology/>
|
|
1261
|
-
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1262
|
-
SELECT ?op ?root ?agent ?publishedAt ?g WHERE {
|
|
1263
|
-
GRAPH ?g {
|
|
1264
|
-
?op a dkg:WorkspaceOperation ;
|
|
1265
|
-
dkg:rootEntity ?root ;
|
|
1266
|
-
dkg:publishedAt ?publishedAt ;
|
|
1267
|
-
prov:wasAttributedTo ?agent .
|
|
1268
|
-
}
|
|
1269
|
-
FILTER(
|
|
1270
|
-
STRSTARTS(STR(?g), "${`did:dkg:context-graph:${e}/`}") &&
|
|
1271
|
-
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1272
|
-
)
|
|
1273
|
-
} ORDER BY DESC(?publishedAt) LIMIT 5000`}function qx(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)%lm.length}function CS(e){const[t,n]=w.useState(new Map),[r,s]=w.useState([]),[c,u]=w.useState([]),[d,f]=w.useState(null),[h,g]=w.useState(!1),[m,y]=w.useState(void 0),b=w.useRef(0);w.useEffect(()=>{if(!e){b.current+=1,n(new Map),s([]),u([]),g(!1),y(void 0);return}const S=++b.current,T=new AbortController;let N=!1,R;const H=()=>!N&&S===b.current;return g(!0),f(null),(async()=>{var A;try{const U=new Promise((F,V)=>{R=setTimeout(()=>{T.abort(),V(new Error(`SWM attribution query timed out after ${Math.round(Hx/1e3)}s`))},Hx)}),G=(async()=>{const F=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Zt()},signal:T.signal,body:JSON.stringify({sparql:GL(e)})});if(!F.ok)throw new Error(`SPARQL query failed: ${F.status}`);return F.json()})(),M=await Promise.race([G,U]),I=(((A=M==null?void 0:M.result)==null?void 0:A.bindings)??[]).slice().reverse(),B=new Map,Z=new Map,$=[];for(const F of I){const V=ul(F.op),X=ul(F.root),Q=ul(F.agent),L=ul(F.publishedAt),P=ul(F.g);if(!V||!X||!Q||!L)continue;const q=HL(Q),O=P?qL(P,e):void 0;$.push({opUri:V,rootUri:X,agent:q,publishedAt:L,subGraph:O});const ne={agent:q,opUri:V,publishedAt:L,subGraph:O},ue=B.get(X);ue?ue.some(be=>be.agent===q)||ue.push(ne):B.set(X,[ne]);let le=Z.get(q);le||(le=new Set,Z.set(q,le)),le.add(X)}const D=[...Z.entries()].map(([F,V])=>({agent:F,color:lm[qx(F)],label:FL(F),entityCount:V.size})).sort((F,V)=>V.entityCount-F.entityCount);if(!H())return;n(B),s($),u(D),y(e)}catch(U){if(!H())return;f((U==null?void 0:U.message)??"Failed to load SWM attributions"),n(new Map),s([]),u([]),y(e)}finally{R&&clearTimeout(R),H()&&g(!1)}})(),()=>{N=!0,R&&clearTimeout(R),T.abort()}},[e]);const{nodeColors:k,conflicts:j}=w.useMemo(()=>{const S={},T=[];for(const[N,R]of t)R.length!==0&&(R.length===1?S[N]=lm[qx(R[0].agent)]:(T.push(N),S[N]="#f59e0b"));return{nodeColors:S,conflicts:T}},[t]);return{resultContextGraphId:m,attributions:t,events:r,palette:c,nodeColors:k,conflicts:j,loading:!!(e&&(h||m!==e)),error:d}}function VL(e,t){const n=`did:dkg:context-graph:${t}/`;if(!e.startsWith(n))return;const s=e.slice(n.length).split("/");if(s[0]!=="assertion"&&s.length>=2&&s[1]==="assertion")return s[0]}const Gx=1e4,cm="http://dkg.io/ontology/";function WL(e){const t=`did:dkg:context-graph:${e}/_meta`;return`PREFIX dkg: <${cm}>
|
|
1274
|
-
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1275
|
-
SELECT ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph (COUNT(DISTINCT ?root) AS ?entityCount) (COUNT(DISTINCT ?subjRoot) AS ?subjectEntityCount) WHERE {
|
|
1276
|
-
GRAPH <${t}> {
|
|
1277
|
-
?event a ?type ;
|
|
1278
|
-
prov:startedAtTime ?ts .
|
|
1279
|
-
FILTER(?type IN (dkg:AssertionCreated, dkg:AssertionPromoted))
|
|
1280
|
-
OPTIONAL { ?event prov:wasAssociatedWith ?agentAssoc }
|
|
1281
|
-
OPTIONAL { ?event prov:generated ?gen }
|
|
1282
|
-
OPTIONAL { ?event prov:used ?used }
|
|
1283
|
-
BIND(COALESCE(?gen, ?used) AS ?assertion)
|
|
1284
|
-
?assertion dkg:assertionName ?name .
|
|
1285
|
-
OPTIONAL { ?assertion prov:wasAttributedTo ?agentAttr }
|
|
1286
|
-
BIND(COALESCE(?agentAssoc, ?agentAttr) AS ?agent)
|
|
1287
|
-
OPTIONAL { ?assertion dkg:subGraphName ?subGraphName }
|
|
1288
|
-
OPTIONAL { ?assertion dkg:assertionGraph ?assertionGraph }
|
|
1289
|
-
OPTIONAL { ?event dkg:rootEntity ?root }
|
|
1290
|
-
OPTIONAL { ?assertion dkg:rootEntity ?subjRoot }
|
|
1291
|
-
}
|
|
1292
|
-
} GROUP BY ?event ?type ?assertion ?name ?agent ?ts ?subGraphName ?assertionGraph
|
|
1293
|
-
ORDER BY DESC(?ts) LIMIT 5000`}function Ya(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 ZL(e){return e===`${cm}AssertionCreated`?"created":e===`${cm}AssertionPromoted`?"promoted":null}function YL(e){const[t,n]=w.useState([]),[r,s]=w.useState(!!e),[c,u]=w.useState(null),[d,f]=w.useState(void 0),h=w.useRef(void 0),g=w.useRef(void 0);return w.useEffect(()=>{if(!e){s(!1);return}h.current!=null&&h.current!==e&&(n([]),u(null),f(void 0),g.current=void 0);let m=!1;const y=new AbortController;let b;return h.current=e,s(!0),u(null),(async()=>{var k;try{const j=new Promise((R,H)=>{b=setTimeout(()=>{y.abort(),H(new Error(`Assertion-lifecycle query timed out after ${Math.round(Gx/1e3)}s`))},Gx)}),E=(async()=>{const R=await fetch("/api/query",{method:"POST",headers:{"Content-Type":"application/json",...Zt()},signal:y.signal,body:JSON.stringify({sparql:WL(e),contextGraphId:e})});if(!R.ok)throw new Error(`SPARQL query failed: ${R.status}`);return R.json()})(),S=await Promise.race([E,j]);if(m||h.current!==e)return;const T=((k=S==null?void 0:S.result)==null?void 0:k.bindings)??[],N=[];for(const R of T){const H=Ya(R.event),A=Ya(R.type),U=Ya(R.assertion),G=Ya(R.name),M=Ya(R.agent),_=Ya(R.ts);if(!H||!U||!M||!_)continue;const I=ZL(A);if(!I)continue;let B;if(I==="promoted"){const D=Ya(R.entityCount),F=D!=null?Number(D):NaN;if(Number.isFinite(F)&&F>0)B=F;else{const V=Ya(R.subjectEntityCount),X=V!=null?Number(V):NaN;Number.isFinite(X)&&X>=0&&(B=X)}}let $=Ya(R.subGraphName);if($===void 0){const D=Ya(R.assertionGraph);D&&($=VL(D,e))}N.push({eventUri:H,kind:I,assertionUri:U,assertionName:G??"",agentUri:M,publishedAt:_,subGraph:$,entityCount:B})}n(N),f(e),g.current=e,u(null)}catch(j){if(m||(j==null?void 0:j.name)==="AbortError")return;u(j.message??String(j)),g.current!==e&&n([]),f(e),g.current=e}finally{b&&clearTimeout(b),m||s(!1)}})(),()=>{m=!0,y.abort(),b&&clearTimeout(b)}},[e]),w.useMemo(()=>({resultContextGraphId:d,events:t,loading:r,error:c}),[d,t,r,c])}const QL=["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"],KL="http://www.w3.org/ns/prov#wasAttributedTo",XL=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 bg(e){const t=e.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"),n=new Date(t);return Number.isFinite(n.getTime())?n:null}function xg(e,t,n,r){const s=n?n.toISOString():"no-ts";return r&&r!==t?`${e}|${t}|${r}|${s}`:`${e}|${t}|${s}`}function JL(e){for(const t of QL){const n=e.properties.get(t);if(n!=null&&n.length)for(const r of n){const s=bg(r);if(s)return s}}return null}function e4(e){for(const t of e.connections)if(t.predicate===KL)return t.targetUri;return null}function t4(e){for(const t of e.types)if(XL.has(t))return t;return null}function n4(e){for(const t of e.subGraphs)if(t!=="meta")return t;return null}function a4(e,t={}){const{limit:n=200,agentUri:r,typeIri:s,subGraph:c,includeUndated:u=!0,excludeEvents:d}=t,f=d?[...d].sort().join(","):"";return w.useMemo(()=>{const h=d&&d.length>0?new Set(d):null,g=[];for(const m of e){const y=t4(m);if(s&&y!==s)continue;const b=JL(m);if(!b&&(!u||!y))continue;const k=e4(m);if(r&&k!==r)continue;const j=n4(m);if(c&&j!==c)continue;const E=y?"typed":"added";if(h&&h.has(E))continue;const S=xg(E,m.uri,b);g.push({id:S,entity:m,at:b,authorUri:k,kindUri:y,subGraph:j,layer:m.trustLevel,event:E,clickable:!0})}return g.sort((m,y)=>m.at&&y.at?y.at.getTime()-m.at.getTime():m.at&&!y.at?-1:!m.at&&y.at?1:m.entity.label.localeCompare(y.entity.label)),{items:g.slice(0,n),hasMore:g.length>n}},[e,n,r,s,c,u,f])}function r4(e,t=new Date){const n=g=>{const m=new Date(g);return m.setHours(0,0,0,0),m},r=n(t),s=new Date(r.getTime()-1440*60*1e3),c=new Date(r.getTime()-10080*60*1e3),u={},d=[],f=(g,m,y)=>{u[g]||(u[g]={key:g,label:m,items:[]},d.push(g)),u[g].items.push(y)};for(const g of e){if(!g.at){f("undated","Undated",g);continue}const m=n(g.at);if(m.getTime()===r.getTime())f("today","Today",g);else if(m.getTime()===s.getTime())f("yesterday","Yesterday",g);else if(g.at.getTime()>=c.getTime())f("this-week","Earlier this week",g);else{const y=g.at.toLocaleString(void 0,{month:"long",year:"numeric"});f(`m-${y}`,y,g)}}const h=d.indexOf("undated");return h!==-1&&h<d.length-1&&(d.splice(h,1),d.push("undated")),d.map(g=>u[g])}function i4(e,t){const{entitiesByUri:n,agentUri:r,subGraph:s,limit:c=200}=t,u=[];for(const d of e){if(r&&d.agent!==r||s&&d.subGraph!==s)continue;const f=bg(d.publishedAt);if(!f)continue;const h=yt(d.rootUri),g=n.get(h),m=g!=null;u.push({id:xg("promoted",d.opUri,f,h),entity:g??s4(h),at:f,authorUri:d.agent,kindUri:null,subGraph:d.subGraph??null,layer:"shared",event:"promoted",clickable:m})}return u.sort((d,f)=>d.at&&f.at?f.at.getTime()-d.at.getTime():d.at&&!f.at?-1:!d.at&&f.at?1:d.entity.label.localeCompare(f.entity.label)),u.slice(0,c)}function s4(e){return{uri:e,label:fg(e),types:[],trustLevel:"shared",layers:new Set(["shared"]),subGraphs:new Set,properties:new Map,connections:[]}}function o4(e,t={}){const{agentUri:n,subGraph:r,limit:s=200}=t,c=[];for(const u of e){if(n&&u.agentUri!==n||r&&u.subGraph!==r)continue;const d=bg(u.publishedAt);if(!d)continue;const f=u.kind==="promoted"?"promoted":"added",h=u.kind==="promoted"?"shared":"working",g=yt(u.assertionUri);c.push({id:xg(f,u.eventUri,d,g),entity:{uri:g,label:u.assertionName||fg(g),types:[],trustLevel:h,layers:new Set([h]),subGraphs:u.subGraph?new Set([u.subGraph]):new Set,properties:new Map,connections:[]},at:d,authorUri:u.agentUri,kindUri:null,subGraph:u.subGraph??null,layer:h,event:f,entityCount:u.entityCount,clickable:!1})}return c.sort((u,d)=>u.at&&d.at?d.at.getTime()-u.at.getTime():u.at&&!d.at?-1:!u.at&&d.at?1:u.entity.label.localeCompare(d.entity.label)),c.slice(0,s)}function l4(e,t={}){const{swmEvents:n,lifecycleEvents:r,...s}=t,c=r!=null,d=a4(e,{...s,excludeEvents:c?["added"]:void 0});return w.useMemo(()=>{const f=s.limit??200;if(t.typeIri)return{items:d.items,hasMore:d.hasMore};if(!c&&(!n||n.length===0))return{items:d.items,hasMore:d.hasMore};let h;if(c)h=o4(r,{agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY});else{const y=new Map;for(const b of e)y.set(b.uri,b);h=i4(n,{entitiesByUri:y,agentUri:s.agentUri,subGraph:s.subGraph,limit:Number.POSITIVE_INFINITY})}const g=[...d.items,...h];g.sort((y,b)=>y.at&&b.at?b.at.getTime()-y.at.getTime():y.at&&!b.at?-1:!y.at&&b.at?1:y.entity.label.localeCompare(b.entity.label));const m=d.hasMore||g.length>f;return{items:g.slice(0,f),hasMore:m}},[d,n,r,c,e,s.agentUri,s.subGraph,s.limit,t.typeIri])}function NS(e,t=new Date){if(!e)return"—";const n=t.getTime()-e.getTime(),r=Math.abs(n),s=n<0,c=6e4,u=c*60,d=u*24;return r<c?s?"in a moment":"just now":r<u?s?`in ${Math.floor(r/c)}m`:`${Math.floor(r/c)}m ago`:r<d?s?`in ${Math.floor(r/u)}h`:`${Math.floor(r/u)}h ago`:r<7*d?s?`in ${Math.floor(r/d)}d`:`${Math.floor(r/d)}d ago`:e.toLocaleDateString(void 0,{month:"short",day:"numeric"})}const Vx={"claude-code":"⦿",openclaw:"◈",hermes:"⬡",gemini:"✧",human:"👤"};function c4(e,t){return e&&Vx[e]?Vx[e]:t==="human"?"👤":"◉"}function u4(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 d4(e){const t=e.trim();return t.length<=11?t:`${t.slice(0,6)}…${t.slice(-4)}`}const Yi=({agent:e,fallbackUri:t,size:n="sm",showOperator:r=!1,onOpenAgent:s,className:c=""})=>{const u=ns();if(!e&&!t)return null;const d=s??(u==null?void 0:u.openAgent),f=(e==null?void 0:e.uri)??t,h=(e==null?void 0:e.name)??(t?d4(t.split(":").pop()??t):"unknown"),g=(e==null?void 0:e.kind)??"ai",m=e==null?void 0:e.framework,y=c4(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,f].filter(Boolean).join(`
|
|
1294
|
-
`),j=d?()=>d(f):void 0,E=!!j;return o.jsxs("span",{className:`v10-agent-chip v10-agent-chip-${n}${E?" interactive":""} ${c}`,style:{"--agent-color":b},onClick:j?S=>{S.stopPropagation(),j()}:void 0,title:k,role:E?"button":void 0,tabIndex:E?0:void 0,children:[o.jsxs("span",{className:"v10-agent-chip-avatar",style:{background:b},children:[o.jsx("span",{className:"v10-agent-chip-initials",children:u4(h)}),o.jsx("span",{className:"v10-agent-chip-glyph",title:m??g,children:y})]}),o.jsxs("span",{className:"v10-agent-chip-body",children:[o.jsx("span",{className:"v10-agent-chip-name",children:h}),n==="lg"&&((e==null?void 0:e.operatorName)||m)&&o.jsxs("span",{className:"v10-agent-chip-sub",children:[m&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-fw",children:m}),(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsxs(o.Fragment,{children:[m&&o.jsx("span",{className:"v10-agent-chip-sep",children:"·"}),o.jsxs("span",{className:"v10-agent-chip-op",children:["driven by ",e.operatorName]})]}),g==="human"&&o.jsx("span",{className:"v10-agent-chip-fw",children:"human"})]}),n==="md"&&r&&(e==null?void 0:e.operatorName)&&g==="ai"&&o.jsx("span",{className:"v10-agent-chip-sub",children:o.jsxs("span",{className:"v10-agent-chip-op",children:["· ",e.operatorName]})})]})]})},dh={working:"#64748b",shared:"#f59e0b",verified:"#22c55e"},p4={working:"◇",shared:"◈",verified:"◉"},f4=200,h4=({entities:e,agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:c=!0,swmEvents:u,lifecycleEvents:d,lifecycleError:f,title:h,onSelectEntity:g,onOpenAgent:m,emptyHint:y,className:b=""})=>{const{items:k,hasMore:j}=l4(e,{agentUri:t,typeIri:n,subGraph:r,limit:s,includeUndated:c,swmEvents:u,lifecycleEvents:d}),E=Qe.useMemo(()=>r4(k),[k]),S=ns(),T=Ir(),R=j?`${s??f4}+`:String(k.length),H=f!=null&&k.length===0,A=h?o.jsxs("div",{className:"v10-activity-feed-title",children:[o.jsx("span",{className:"v10-activity-feed-title-label",children:h}),o.jsx("span",{className:"v10-activity-feed-title-count","data-state":H?"error":void 0,children:H?"—":R})]}):null,U=f?o.jsx("div",{className:"v10-activity-feed-error",role:"status","aria-live":"polite",title:f,children:"Couldn't load recent activity."}):null;return k.length===0?o.jsxs("div",{className:`v10-activity-feed v10-activity-feed-empty ${b}`,children:[A,U??o.jsx("div",{className:"v10-activity-feed-empty-hint",children:y??"No activity with a timestamp yet."})]}):o.jsxs("div",{className:`v10-activity-feed ${b}`,children:[A,U,E.map(G=>o.jsxs("div",{className:"v10-activity-feed-bucket",children:[o.jsxs("div",{className:"v10-activity-feed-bucket-head",children:[o.jsx("span",{className:"v10-activity-feed-bucket-label",children:G.label}),o.jsx("span",{className:"v10-activity-feed-bucket-count",children:G.items.length})]}),o.jsx("div",{className:"v10-activity-feed-items",children:G.items.map(M=>o.jsx(m4,{item:M,agents:S,profile:T,onSelectEntity:g,onOpenAgent:m},M.id))})]},G.key))]})};function m4({item:e,agents:t,profile:n,onSelectEntity:r,onOpenAgent:s}){const c=e.authorUri?t==null?void 0:t.get(e.authorUri):null,u=e.event==="typed",d=u&&e.kindUri?n==null?void 0:n.forType(e.kindUri):null,f=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"?dh.shared:e.event==="published"?dh.verified:e.event==="added"?"#64748b":(d==null?void 0:d.color)??"#a855f7",m=dh[e.layer],y=u?g4(e.entity):null,b=(()=>{const j=[];return e.event!=="typed"&&j.push(f),j.push(e.entity.label),e.at&&j.push(e.at.toISOString()),j.join(`
|
|
1295
|
-
`)})(),k=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-activity-feed-layer",style:{color:m},title:`${e.layer} memory`,children:p4[e.layer]}),o.jsxs("span",{className:"v10-activity-feed-type",style:{"--type-color":g},children:[o.jsx("span",{className:"v10-activity-feed-type-icon",children:h}),o.jsx("span",{className:"v10-activity-feed-type-label",children:f})]}),o.jsx("span",{className:"v10-activity-feed-title-text",children:e.entity.label}),y&&o.jsx("span",{className:`v10-activity-feed-status status-${v4(y)}`,children:y}),(c||e.authorUri)&&o.jsx("span",{className:"v10-activity-feed-author",children:o.jsx(Yi,{agent:c??void 0,fallbackUri:e.authorUri??void 0,size:"sm",onOpenAgent:s})}),o.jsx("span",{className:"v10-activity-feed-time",title:e.at?e.at.toLocaleString():"no timestamp",children:NS(e.at)})]});return e.clickable?o.jsx("button",{type:"button",className:"v10-activity-feed-row",onClick:()=>r(e.entity.uri),title:b,children:k}):o.jsx("div",{className:"v10-activity-feed-row v10-activity-feed-row-static",title:b,"aria-disabled":"true",children:k})}function g4(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 s=(n=e.properties.get(r))==null?void 0:n[0];if(s)return s}return null}function v4(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 y4={wm:"working",swm:"shared",vm:"verified"};function b4(e){var y,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",s="http://dkg.io/ontology/tasks/priority",c="http://dkg.io/ontology/github/state",u="http://dkg.io/ontology/decisions/Decision",d="http://dkg.io/ontology/tasks/Task",f="http://dkg.io/ontology/github/PullRequest";let h=0,g=0,m=0;for(const E of e)if(E.types.includes(u))((y=E.properties.get(n))==null?void 0:y[0])==="proposed"&&h++;else if(E.types.includes(d)){const S=(b=E.properties.get(s))==null?void 0:b[0],T=(k=E.properties.get(r))==null?void 0:k[0];S==="p0"&&T!=="done"&&T!=="cancelled"&&g++}else E.types.includes(f)&&((j=E.properties.get(c))==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 ph=({contextGraphId:e,profile:t,selected:n,onSelect:r,entities:s,layer:c,enabledScope:u,allTriplesTotal:d})=>{const[f,h]=Qe.useState([]),[g,m]=Qe.useState(!0),y=Qe.useMemo(()=>b4(s),[s]),b=Qe.useRef(0),k=Qe.useMemo(()=>u&&u.size>0&&u.size<3?new Set(u):u&&u.size>=3?null:c?new Set([y4[c]]):null,[u,c]),j=Qe.useMemo(()=>{if(!s)return null;const $=new Map;for(const D of s)if(!(k&&!k.has(D.trustLevel)))for(const F of D.subGraphs)$.set(F,($.get(F)??0)+1);return $},[k,s]),E=Qe.useMemo(()=>{if(!s)return null;let $=0;for(const D of s)k&&!k.has(D.trustLevel)||$++;return $},[k,s]),S=Qe.useMemo(()=>{if(!s)return null;let $=0;for(const D of s)k&&!k.has(D.trustLevel)||D.subGraphs.size>0||$++;return $},[k,s]),T=Qe.useCallback(()=>{const $=++b.current;m(!0),ig(e).then(D=>{$===b.current&&h(D.subGraphs??[])}).catch(()=>{}).finally(()=>{$===b.current&&m(!1)})},[e]);Qe.useEffect(()=>(T(),()=>{b.current++}),[T]),po(e,T);const N=Qe.useMemo(()=>f.filter(yg).map($=>{const D=t.forSubGraph($.name),F=j!==null?j.get($.name)??0:$.entityCount;return{slug:$.name,icon:D.icon??"•",color:D.color??"#64748b",displayName:D.displayName??$.name,description:D.description??$.description,rank:D.rank??99,entityCount:F,tripleCount:$.tripleCount,layerScoped:j!==null}}).sort(($,D)=>$.rank-D.rank),[f,t,j]),H=S!==null&&S>0||n===za;if(g&&N.length===0&&!H||N.length===0&&!H)return null;const A=E??N.reduce(($,D)=>$+D.entityCount,0),U=N.reduce(($,D)=>$+D.tripleCount,0),G={working:"Working Memory",shared:"Shared Working Memory",verified:"Verifiable Memory"},M=k?[...k].map($=>G[$]).join(" + "):null,_=M?` in ${M}`:"",B=`Total distinct entities — includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph · ${A} entities${_}${M?"":` · ${d??U} triples`}`,Z=`All — total distinct entities. Includes those in named subgraphs (some may belong to more than one), plus Root entities not in any subgraph. ${A} entities${_}.`;return o.jsxs("div",{className:"v10-subgraph-bar",children:[o.jsx("div",{className:"v10-subgraph-bar-label",children:"Subgraphs"}),o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===null?" active":""}`,onClick:()=>r(null),title:B,"aria-label":Z,children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊚"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"All"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:A})]}),N.map($=>{const D=y.get($.slug);return o.jsxs("button",{type:"button",className:`v10-subgraph-chip${n===$.slug?" active":""}${D?" has-badge":""}`,onClick:()=>r($.slug,c),title:`${$.displayName}${$.description?" · "+$.description:""} · ${$.entityCount} entities${_}${M?"":` · ${$.tripleCount} triples`}${D?" · "+D.label:""}`,style:{"--sg-color":$.color},children:[o.jsx("span",{className:"v10-subgraph-chip-icon",style:{color:$.color},children:$.icon}),o.jsx("span",{className:"v10-subgraph-chip-label",children:$.displayName}),o.jsx("span",{className:"v10-subgraph-chip-count",children:$.entityCount}),D&&o.jsxs("span",{className:`v10-subgraph-chip-badge tone-${D.tone}`,children:[o.jsx("span",{className:"v10-subgraph-chip-badge-dot"}),D.label]})]},$.slug)}),H&&(()=>{const $=S??0,D=n===za;return o.jsxs("button",{type:"button",className:`v10-subgraph-chip v10-subgraph-chip-root${D?" active":""}`,"data-active":D,"data-count":$,onClick:()=>r(za,c),title:`Entities not in any subgraph (Context Graph root) · ${$} entities${_}`,"aria-label":"Entities not in any subgraph (Context Graph root)",children:[o.jsx("span",{className:"v10-subgraph-chip-icon",children:"⊘"}),o.jsx("span",{className:"v10-subgraph-chip-label",children:"Root"}),o.jsx("span",{className:"v10-subgraph-chip-count",children:$})]})})()]})},wg="context-graph-primer",ES={id:wg,label:"What is a Context Graph?",closable:!0},TS={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"};function sn({icon:e,title:t,description:n,actions:r=[],tone:s="neutral",compact:c=!1,inline:u=!1,className:d=""}){const f={"--v10-empty-accent":TS[s]};return o.jsxs("div",{className:["v10-empty-state",c?"compact":"",u?"inline":"",d].filter(Boolean).join(" "),"data-tone":s,style:f,children:[e&&o.jsx("div",{className:"v10-empty-state-icon","aria-hidden":"true",children:e}),o.jsxs("div",{className:"v10-empty-state-copy",children:[o.jsx("div",{className:"v10-empty-state-title",children:t}),n&&o.jsx("div",{className:"v10-empty-state-desc",children:n}),r.length>0&&o.jsx("div",{className:"v10-empty-state-actions",children:r.map(h=>o.jsx("button",{type:"button",className:`v10-empty-state-action ${h.variant??"secondary"}`,onClick:h.onClick,children:h.label},h.label))})]})]})}function Nd({items:e,layer:t,compact:n=!1,className:r=""}){const s=t?{"--v10-stat-accent":TS[t]}:void 0;return o.jsx("div",{className:["v10-stat-strip",n?"compact":"",r].filter(Boolean).join(" "),"data-layer":t,style:s,children:e.map((c,u)=>o.jsxs("div",{className:"v10-stat-strip-cell","data-stat-id":c.id,title:c.tooltip,children:[o.jsx("span",{className:"v10-stat-strip-label",children:c.label}),o.jsx("span",{className:"v10-stat-strip-value",children:c.value}),c.hint&&o.jsx("span",{className:"v10-stat-strip-hint",children:c.hint})]},c.id??u))})}const kg=w.lazy(()=>ar(()=>import("./index-D0Mz0SVt.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),x4="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",w4=new Map(pg.map((e,t)=>[e,t]));function um(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 _r(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function k4(e){const t=new Set,n=new Map,r=new Map,s=new Map;for(const d of e){const f=_r(d.subject);t.add(f);const h=w4.get(d.predicate);if(h!==void 0){const m=Sd(d.object).trim();if(m){const y=s.get(f);(y===void 0||h<y)&&(r.set(f,m),s.set(f,h))}}if(_r(d.predicate)===x4||!um(d.object))continue;const g=_r(d.object);n.set(f,(n.get(f)??0)+1),n.set(g,(n.get(g)??0)+1)}const c=[...t].filter(d=>(n.get(d)??0)===0).map(d=>({uri:d,label:r.get(d)??mS(void 0,d)})).sort((d,f)=>d.label.localeCompare(f.label));if(c.length===0)return{canvasTriples:e,singletonItems:c};const u=new Set(c.map(d=>d.uri));return{canvasTriples:e.filter(d=>!u.has(_r(d.subject))&&!u.has(_r(d.object))),singletonItems:c}}function S4(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 j4({items:e,onSelect:t}){return e.length===0?null:o.jsxs("div",{className:"v10-graph-singleton-shelf","aria-label":"Standalone entities without visible links",children:[o.jsxs("div",{className:"v10-graph-singleton-head",title:"Entities with no visible links are grouped here to keep the graph readable.",children:[o.jsx("span",{children:"Standalone entities"}),o.jsx("span",{children:e.length})]}),o.jsx("div",{className:"v10-graph-singleton-list",children:e.map(({uri:n,label:r})=>o.jsx("button",{type:"button",className:"v10-graph-singleton-item",title:n,onClick:()=>t==null?void 0:t(n),children:r},n))})]})}const C4=2500;function Wx(e,t=C4){if(e.length<=t)return e;const n=new Map;for(const u of e)n.set(u.subject,(n.get(u.subject)??0)+1);const r=[...n.entries()].sort((u,d)=>d[1]-u[1]).map(([u])=>u),s=new Set;let c=0;for(const u of r){const d=n.get(u)??0;c+d>t||(s.add(u),c+=d)}return s.size===0&&r.length>0&&s.add(r[0]),e.filter(u=>s.has(u.subject)).slice(0,t)}function Mu({title:e,scopeLabel:t,tone:n,className:r,rail:s,overlay:c,showScopeLabel:u=!0,singletonItems:d=[],onSingletonClick:f,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 y=o.jsx("button",{type:"button",className:`v10-graph-expand-btn${u?"":" in-canvas"}`,onClick:()=>m(!0),title:`Expand ${e}`,"aria-label":`Expand ${e}`,children:"⤢"}),b=k=>o.jsxs(o.Fragment,{children:[u&&!k&&o.jsxs("div",{className:"v10-graph-shell-bar",children:[o.jsx("div",{className:"v10-graph-scope",title:t,children:t}),y]}),o.jsxs("div",{className:"v10-graph-body",children:[o.jsxs("div",{className:"v10-graph-canvas",children:[!u&&!k&&y,o.jsx("div",{className:"v10-graph-view",children:h(k)}),c&&o.jsx("div",{className:"v10-graph-overlay",children:c}),o.jsx(j4,{items:d,onSelect:f})]}),s&&o.jsx("aside",{className:"v10-graph-rail",children:s})]})]});return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`v10-graph-shell v10-graph-shell-${n}${r?` ${r}`:""}`,children:!g&&b(!1)}),g&&o.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:o.jsxs("div",{className:`v10-graph-expanded-panel v10-graph-shell-${n}`,children:[o.jsxs("div",{className:"v10-graph-expanded-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-graph-expanded-title",children:e}),o.jsx("div",{className:"v10-graph-expanded-subtitle",children:t})]}),o.jsx("button",{type:"button",className:"v10-graph-expanded-close",onClick:()=>m(!1),"aria-label":`Close expanded ${e}`,children:"×"})]}),o.jsx("div",{className:"v10-graph-expanded-body",children:b(!0)})]})})]})}function AS({layer:e,triples:t,onNodeClick:n,contextGraphId:r,scopeLabel:s,trustLegendActiveLayer:c,title:u,scopeEntities:d,swmAttribution:f,layerEntities:h,nodeColorsOverride:g}){const{title:m}=Mn[e],y=u??m,b=qn(L=>L.theme),k=w.useMemo(()=>{if(e!=="vm")return;const L=new Set;for(const P of t)L.add(P.subject),um(P.object)&&L.add(P.object);return L},[t,e]),{anchors:j,decorationTriples:E}=GO(e==="vm"&&r?r:void 0,k),S=CS(e==="swm"&&r&&!f?r:void 0),T=f??S,N=w.useMemo(()=>{if(!h||h.length===0)return t;const L=new Set;for(const P of h)L.add(yt(P.uri));return Ku(t,L)},[t,h]),R=w.useMemo(()=>{const L=new Set,P=[],q=O=>{const ne=`${O.subject}|${O.predicate}|${O.object}`;L.has(ne)||(L.add(ne),P.push({subject:O.subject,predicate:O.predicate,object:O.object}))};for(const O of N)q(O);for(const O of E)q(O);return P},[N,E]),H=R,A=w.useMemo(()=>{const L=e==="swm"?T.nodeColors:void 0;if(!(!L&&!g))return L?g?{...L,...g}:L:g},[e,T.nodeColors,g]),U=w.useMemo(()=>nL(e,A),[e,A]),{canvasTriples:G,singletonItems:M}=w.useMemo(()=>k4(H),[H]),_=w.useMemo(()=>{if(!d||d.length===0)return M;const L=new Set(M.map(q=>_r(q.uri)));for(const q of G)L.add(_r(q.subject)),um(q.object)&&L.add(_r(q.object));const P=[];for(const q of d){const O=_r(q.uri);L.has(O)||(L.add(O),P.push({uri:O,label:q.label||mS(void 0,O)}))}return P.length===0?M:[...M,...P].sort((q,O)=>q.label.localeCompare(O.label))},[M,G,d]),I=`${r??"context"}:${e}`,B=e==="swm"&&!!r&&T.loading,Z=`${y} graph`,$=s??S4(e),D=c===null&&!!s,F=c===null?void 0:c??e,X=e==="vm"&&j.length>0||e==="swm"&&T.palette.length>0?o.jsxs(o.Fragment,{children:[e==="vm"&&j.length>0&&o.jsx(E4,{anchors:j}),e==="swm"&&T.palette.length>0&&o.jsx(N4,{palette:T.palette,conflicts:T.conflicts.length})]}):null,Q=w.useMemo(()=>({name:`${I}:${b}`,palette:b}),[I,b]);return R.length===0&&_.length===0?o.jsx(Mu,{title:Z,scopeLabel:$,tone:e,className:"v10-graph-view-fill",showScopeLabel:D,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(sn,{compact:!0,tone:e,icon:Mn[e].icon,title:`No triples in ${y}`,description:"The graph will appear when this layer has connected triples."})})}):B?o.jsx(Mu,{title:Z,scopeLabel:$,tone:"swm",className:"v10-graph-view-fill",showScopeLabel:D,renderGraph:()=>o.jsx("div",{className:"v10-layer-empty-shell",children:o.jsx(sn,{compact:!0,tone:"swm",icon:Mn.swm.icon,title:"Loading Shared Working Memory attribution...",description:"Agent colors are being prepared before the graph renders."})})}):o.jsx(Mu,{title:Z,scopeLabel:$,tone:e,className:"v10-graph-view-fill",overlay:X,showScopeLabel:D,singletonItems:_,onSingletonClick:L=>n==null?void 0:n(F?{id:L,trustLayer:F}:{id:L}),renderGraph:L=>G.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(kg,{data:G,format:"triples",options:U,viewConfig:Q,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:F?P=>n==null?void 0:n({...P,trustLayer:F}):n,initialFit:!0},`${I}:${L?"expanded":"inline"}:${G.length}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"Connected graph appears when this layer has linked entities."})})}function N4({palette:e,conflicts:t}){return o.jsxs("div",{className:"v10-swm-legend","aria-label":"SWM attribution legend",children:[o.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-head",children:[o.jsx("span",{children:"SWM attribution"}),o.jsxs("span",{className:"v10-swm-legend-count",children:[e.length," agent",e.length===1?"":"s"]})]}),e.slice(0,8).map(n=>o.jsxs("div",{className:"v10-swm-legend-row",title:n.agent,children:[o.jsx("span",{className:"v10-swm-legend-swatch",style:{background:n.color}}),o.jsx("span",{className:"v10-swm-legend-label",children:n.label}),o.jsx("span",{className:"v10-swm-legend-metric",children:n.entityCount})]},n.agent)),t>0&&o.jsxs("div",{className:"v10-swm-legend-row v10-swm-legend-conflict",children:[o.jsx("span",{className:"v10-swm-legend-swatch",style:{background:"#f59e0b"},children:"!"}),o.jsx("span",{className:"v10-swm-legend-label",children:"In review"}),o.jsx("span",{className:"v10-swm-legend-metric",children:t})]})]})}function E4({anchors:e}){var s;const t=w.useMemo(()=>{const c=new Set;for(const u of e)for(const d of u.agents)c.add(d);return c.size},[e]),n=(s=e[0])==null?void 0:s.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 o.jsxs("div",{className:"v10-vm-legend","aria-label":"Verifiable Memory legend",children:[o.jsxs("div",{className:"v10-vm-legend-row v10-vm-legend-head",children:[o.jsx("span",{children:"VM provenance layer"}),o.jsxs("span",{className:"v10-vm-legend-count",children:[e.length," anchor",e.length===1?"":"s"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#f5a524"},children:"◉"}),o.jsx("span",{className:"v10-vm-legend-label",children:"On-chain anchor"})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#c084fc"},children:"◈"}),o.jsxs("span",{className:"v10-vm-legend-label",children:["Agent identity (",t,")"]})]}),o.jsxs("div",{className:"v10-vm-legend-row",children:[o.jsx("span",{className:"v10-vm-legend-swatch",style:{background:"#4ade80"},children:"—"}),o.jsx("span",{className:"v10-vm-legend-label",children:"Signed / anchored edge"})]}),r&&o.jsxs("div",{className:"v10-vm-legend-foot",children:["Latest: ",r]})]})}function T4({active:e,counts:t,onSwitch:n,onShare:r,onImport:s,onRefresh:c}){const[u,d]=w.useState(!1),f=w.useRef(null),h=g=>{d(!1),n(g)};return w.useEffect(()=>{if(!u)return;const g=m=>{var b;const y=m.target;y&&((b=f.current)!=null&&b.contains(y))||d(!1)};return document.addEventListener("pointerdown",g),()=>document.removeEventListener("pointerdown",g)},[u]),o.jsxs("div",{className:"v10-layer-switcher",children:[o.jsxs("button",{className:`v10-layer-switch-btn ${e==="overview"?"active":""}`,"data-layer":"overview","aria-label":"Overview",title:"Overview",onClick:()=>h("overview"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"◎"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Overview"})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="wm"?"active":""}`,"data-layer":"wm","aria-label":"Working Memory",title:"Working Memory",onClick:()=>h("wm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#64748b"},children:"◇"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"WM"}),t.wm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.wm})]}),o.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:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#f59e0b"},children:"◈"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Shared Working Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"SWM"}),t.swm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.swm})]}),o.jsxs("button",{className:`v10-layer-switch-btn ${e==="vm"?"active":""}`,"data-layer":"vm","aria-label":"Verifiable Memory",title:"Verifiable Memory",onClick:()=>h("vm"),children:[o.jsx("span",{className:"v10-layer-switch-icon",style:{color:"#22c55e"},children:"◉"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-full",children:"Verifiable Memory"}),o.jsx("span",{className:"v10-layer-switch-label v10-layer-switch-label-compact",children:"VM"}),t.vm>0&&o.jsx("span",{className:"v10-layer-switch-count",children:t.vm})]}),o.jsx("span",{className:"v10-layer-switch-separator","aria-hidden":"true"}),o.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:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⌬"}),o.jsx("span",{className:"v10-layer-switch-label",children:"Subgraphs"})]}),o.jsxs("div",{ref:f,className:"v10-layer-more",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||d(!1)},children:[o.jsxs("button",{type:"button",className:`v10-layer-switch-btn v10-layer-more-btn ${e==="query"?"active":""}`,"data-layer":"query","aria-haspopup":"menu","aria-expanded":u,"aria-label":"More Context Graph views",title:"More Context Graph views",onClick:()=>d(g=>!g),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⋯"}),o.jsx("span",{className:"v10-layer-switch-label",children:"More"})]}),u&&o.jsx("div",{className:"v10-layer-more-menu",role:"menu",children:o.jsxs("button",{type:"button",role:"menuitem",className:`v10-layer-more-item ${e==="query"?"active":""}`,onClick:()=>h("query"),children:[o.jsx("span",{className:"v10-layer-switch-icon",children:"⟐"}),"Query Catalogue"]})})]}),o.jsx("div",{className:"v10-layer-switcher-spacer"}),o.jsxs("div",{className:"v10-layer-switcher-actions",children:[o.jsxs("button",{className:"v10-layer-action-btn",onClick:r,"aria-label":"Share Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"⤴"}),o.jsx("span",{className:"v10-layer-action-label",children:"Share"})]}),o.jsxs("button",{className:"v10-layer-action-btn",onClick:s,"aria-label":"Import into Context Graph",children:[o.jsx("span",{className:"v10-layer-action-icon",children:"↑"}),o.jsx("span",{className:"v10-layer-action-label",children:"Import"})]}),o.jsx("button",{className:"v10-layer-action-btn",onClick:c,"aria-label":"Refresh Context Graph data",children:o.jsx("span",{className:"v10-layer-action-icon",children:"↻"})})]})]})}function A4({cg:e,profile:t,activeSubGraph:n,onClearSubGraph:r}){const s=e.name||t.displayName||e.id;return o.jsxs("div",{className:"v10-project-strip",style:{"--sg-color":(n==null?void 0:n.color)??t.primaryColor},children:[o.jsx("span",{className:"v10-project-strip-dot",style:{background:t.primaryColor}}),o.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:s}),n?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-project-strip-sep",children:"›"}),o.jsxs("span",{className:"v10-project-strip-sg",children:[o.jsx("span",{className:"v10-project-strip-sg-icon",style:{color:n.color},children:n.icon??"•"}),n.displayName??n.slug]}),n.description&&o.jsx("span",{className:"v10-project-strip-desc",title:n.description,children:n.description})]}):e.description&&o.jsx("span",{className:"v10-project-strip-desc",title:e.description,children:e.description})]})}function R4(e,t,n,r,s){const c=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",u=new Set([t==null?void 0:t.agentDid,t==null?void 0:t.agentAddress].filter(h=>typeof h=="string"&&h.trim().length>0).map(dn)),d=u.size>0;return c&&d&&u.has(dn(c))?{label:"Curator",title:"This agent is the curator for this Context Graph.",tone:"curator"}:(e==null?void 0:e.callerInvolved)===!0?c&&!d&&n==="loading"?{label:"Role checking",title:"This agent is involved in this Context Graph; curator status is still loading.",tone:"unknown"}:c&&!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"}:s==="ok"&&r.map(h=>h.trim()).filter(Boolean).some(h=>u.has(dn(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 _4(e,t,n){if(ao(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 s=new Set(t.map(u=>u.trim()).filter(Boolean).map(dn)),c=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";return c&&s.add(dn(c)),{id:"participants",value:s.size.toLocaleString(),label:"Agents with access",tooltip:"Includes the curator plus allowlisted participants reported by the node."}}function O4(e){const t=ao(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 L4({cg:e,currentAgent:t,currentAgentStatus:n="ok"}){var d,f;const r=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"";if(!r)return"unknown";const s=((d=t==null?void 0:t.agentDid)==null?void 0:d.trim())??"",c=((f=t==null?void 0:t.agentAddress)==null?void 0:f.trim())??"",u=s||c;return u?dn(r)===dn(u)?"curator":"not-curator":"unknown"}function z4(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(dn))}function M4({cg:e,memory:t,subGraphCount:n,subGraphFetchFailed:r=!1,participants:s,participantsStatus:c="ok",currentAgent:u,currentAgentStatus:d="ok",onSwitchLayer:f,onOpenPrimer:h}){var Q,L,P;const{wm:g,swm:m,vm:y}=t.counts,b=g+m+y,k=R4(e,u??null,d,s,c),j=O4(e==null?void 0:e.accessPolicy),E=_4(e,s,c),S=typeof(e==null?void 0:e.curator)=="string"?e.curator.trim():"",T=S?dn(S):"",N=ao(e==null?void 0:e.accessPolicy)==="public",R=z4(u??null),H=Object.values(t.layerStatus??{}),A=H.filter(q=>q==="error").length,U=!t.loading&&H.length===3&&A===3,G=!t.loading&&A>0,M=t.loading?"Loading memory layers...":U||t.error?"Live memory counts are unavailable.":t.partial||G?"One or more layer counts are currently a lower bound.":"Canonical current-layer entity counts.",_=U?"Unavailable":b.toLocaleString(),{total:I}=vg(t),B=!t.loading&&(t.partial||G),Z=U?"Unavailable":t.loading&&I===0?"...":B?`${I.toLocaleString()}+`:I.toLocaleString(),$=U?"Live triple counts are unavailable.":B?"One or more layer triple counts are currently a lower bound.":"Canonical triple total across all layers.",D=n==null?r?"Unavailable":"...":n.toLocaleString(),F=n==null?r?"Sub-graph list is currently unavailable.":"Sub-graph count is loading.":"Topical partitions inside this Context Graph.",V=[{key:"wm",label:"Working Memory",desc:"Private staging area",count:g,status:((Q=t.layerStatus)==null?void 0:Q.wm)??"ok",color:"#64748b"},{key:"swm",label:"Shared Working Memory",desc:"Collaborative review",count:m,status:((L=t.layerStatus)==null?void 0:L.swm)??"ok",color:"#f59e0b"},{key:"vm",label:"Verifiable Memory",desc:"Published on-chain",count:y,status:((P=t.layerStatus)==null?void 0:P.vm)??"ok",color:"#22c55e"}],X=V.some(q=>q.status==="error");return o.jsxs("div",{className:"v10-po",children:[o.jsxs("div",{className:"v10-po-identity","data-section":"identity",children:[o.jsxs("div",{className:"v10-po-identity-pairs",children:[o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Your role:"}),o.jsx("span",{className:"v10-po-badge","data-role":k.tone,title:k.title,children:k.label})]}),o.jsxs("div",{className:"v10-po-identity-pair",children:[o.jsx("span",{className:"v10-po-identity-label",children:"Context Graph:"}),o.jsx("span",{className:"v10-po-badge","data-cg-type":j.tone,title:j.title,children:j.label})]})]}),h&&o.jsx("button",{type:"button",className:"v10-po-identity-primer",onClick:h,title:"Open the Context Graph primer",children:"What is a Context Graph?"})]}),o.jsxs("div",{"data-section":"at-a-glance",className:"v10-po-stat-block",children:[o.jsx("div",{className:"v10-po-section-title",children:"At a glance"}),o.jsx(Nd,{className:"v10-po-stat-strip",items:[{id:"entities",value:_,label:"Entities",tooltip:M},{id:"triples",value:Z,label:"Triples",tooltip:$},{id:"subgraphs",value:D,label:"Subgraphs",tooltip:F},E]})]}),o.jsxs("div",{className:"v10-po-pipeline","data-section":"pipeline","aria-label":"Knowledge Pipeline",children:[o.jsx("div",{className:"v10-po-pipeline-head",children:o.jsxs("div",{children:[o.jsx("div",{className:"v10-po-section-title",children:"Knowledge Pipeline"}),o.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."})]})}),o.jsx("div",{className:"v10-po-pipeline-track","aria-hidden":"true",children:!X&&b>0?V.map(q=>{const O=q.count>0?q.count/b*100:0;return o.jsx("span",{className:`v10-po-pipeline-seg ${q.key}`,style:{width:`${O}%`,background:q.color}},q.key)}):o.jsx("span",{className:"v10-po-pipeline-empty"})}),o.jsx("div",{className:"v10-po-pipeline-steps",children:V.map((q,O)=>o.jsxs("button",{type:"button",className:`v10-po-pipeline-step ${q.key}`,onClick:()=>f==null?void 0:f(q.key),style:{"--po-layer-color":q.color},children:[o.jsx("span",{className:"v10-po-pipeline-step-index",children:O+1}),o.jsxs("span",{className:"v10-po-pipeline-step-copy",children:[o.jsx("span",{className:"v10-po-pipeline-step-label",children:q.label}),o.jsx("span",{className:"v10-po-pipeline-step-desc",children:q.desc})]}),o.jsx("span",{className:"v10-po-pipeline-step-count",children:q.status==="error"?"Unavailable":`${q.count.toLocaleString()} ${Or(q.key,q.count)}`})]},q.key))})]}),o.jsxs("div",{className:"v10-po-people","data-section":"participants",children:[o.jsx("div",{className:"v10-po-section-title",children:"Participant agents"}),(()=>{const q="did:dkg:agent:",O=le=>le.toLowerCase().startsWith(q)?le.slice(q.length):le,ne=new Set,ue=[];if(S&&c==="ok"){const le=dn(S);ne.add(le),ue.push({display:O(S),full:S,canonical:le})}if(c==="ok")for(const le of s){const be=dn(le);ne.has(be)||(ne.add(be),ue.push({display:O(le),full:le,canonical:be}))}if(ue.length===0){const le=N?"This Context Graph is public — anyone can subscribe.":c==="loading"?"Loading participant agents...":c==="error"?"Participant list unavailable.":"No participant agents recorded yet.";return o.jsx("div",{className:"v10-po-people-empty",children:le})}return o.jsx("div",{className:"v10-po-participants-list",children:ue.map(({display:le,full:be,canonical:Re})=>{const Ee=R.has(Re),Ie=!!T&&Re===T,Ve=`${le.slice(0,6)}…${le.slice(-4)}`,Se=[Ve];return Ee&&Se.push("you"),Ie&&Se.push("curator"),o.jsxs("span",{className:`v10-po-participant${Ee?" is-self":""}${Ie?" is-curator":""}`,title:be,"aria-label":Se.join(" "),children:[o.jsx("span",{className:"v10-po-participant-name",children:Ve}),Ee&&o.jsx("span",{className:"v10-po-participant-tag",children:"you"}),Ie&&o.jsx("span",{className:"v10-po-participant-tag",children:"curator"})]},Re)})})})()]})]})}function D4({contextGraphId:e,curatorStatus:t,onParticipantsChanged:n}){const[r,s]=w.useState([]),[c,u]=w.useState(null),[d,f]=w.useState("loading"),h=w.useRef(0),g=w.useCallback(()=>{if(t!=="curator"){s([]),f("idle");return}const b=++h.current;f("loading"),qk(e).then(k=>{h.current===b&&(s(k.requests.filter(j=>j.status==="pending")),f("idle"))}).catch(()=>{h.current===b&&(s([]),f("error"))})},[e,t]);if(w.useEffect(()=>(g(),()=>{h.current++}),[g]),Ji(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 o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsx("header",{className:"v10-po-join-head",children:o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"})}),o.jsx("div",{className:"v10-po-join-empty",children:"Verifying access…"})]});const m=async b=>{u(b);try{await eg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}},y=async b=>{u(b);try{await tg(e,b),s(k=>k.filter(j=>j.agentAddress!==b)),n==null||n()}catch{}finally{u(null)}};return o.jsxs("section",{className:"v10-po-join","data-section":"join-requests",children:[o.jsxs("header",{className:"v10-po-join-head",children:[o.jsx("span",{className:"v10-po-section-title",children:"Pending join requests"}),o.jsx("span",{className:"v10-po-join-count","data-empty":r.length===0?"true":"false",children:r.length})]}),d==="loading"?o.jsx("div",{className:"v10-po-join-empty",children:"Loading join requests..."}):d==="error"?o.jsx("div",{className:"v10-po-join-empty",children:"Join requests are currently unavailable."}):r.length===0?o.jsx("div",{className:"v10-po-join-empty",children:"No pending join requests."}):o.jsx("div",{className:"v10-po-join-list",children:r.map(b=>o.jsxs("div",{className:"v10-po-join-item",children:[o.jsxs("div",{className:"v10-po-join-info",children:[o.jsx("span",{className:"v10-po-join-name",children:b.name||`${b.agentAddress.slice(0,6)}…${b.agentAddress.slice(-4)}`}),o.jsxs("span",{className:"v10-po-join-addr",title:b.agentAddress,children:[b.agentAddress.slice(0,10),"…"]})]}),o.jsxs("div",{className:"v10-po-join-actions",children:[o.jsx("button",{className:"v10-po-join-btn approve",onClick:()=>m(b.agentAddress),disabled:c===b.agentAddress,children:c===b.agentAddress?"…":"✓ Approve"}),o.jsx("button",{className:"v10-po-join-btn reject",onClick:()=>y(b.agentAddress),disabled:c===b.agentAddress,"aria-label":"Reject join request",children:"✕"})]})]},b.agentAddress))})]})}function $4({onOpenPrimer:e}){return o.jsxs("div",{className:"v10-po-primer-footer","data-section":"primer",children:[o.jsx("span",{className:"v10-po-primer-footer-lede",children:"New here?"}),o.jsx("span",{className:"v10-po-primer-footer-arrow","aria-hidden":"true",children:"→"}),o.jsx("button",{type:"button",className:"v10-po-primer-footer-link",onClick:e,children:"What is a Context Graph?"}),o.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."})]})}function Sg({title:e,agent:t,footnote:n,dismissed:r,onDismiss:s,children:c}){return o.jsxs("div",{className:`v10-gen-widget ${r?"dissolved":""}`,children:[o.jsxs("div",{className:"v10-gen-widget-header",children:[o.jsx("span",{className:"v10-gen-widget-title",children:e}),o.jsxs("div",{className:"v10-gen-widget-right",children:[t&&o.jsxs("span",{className:"v10-gen-widget-agent",children:[o.jsx("span",{className:"v10-gen-widget-agent-dot"}),t]}),s&&o.jsx("button",{className:"v10-gen-widget-dismiss",onClick:s,children:"✕"})]})]}),o.jsx("div",{className:"v10-gen-widget-body",children:c}),n&&o.jsx("div",{className:"v10-gen-widget-footnote",children:n})]})}function I4({entities:e}){const t=Ir(),n=w.useMemo(()=>{const r=new Map;for(const s of e){const{icon:c,type:u}=Cd(s,t),d=r.get(u);d?d.count++:r.set(u,{icon:c,count:1})}return[...r.entries()].sort((s,c)=>c[1].count-s[1].count)},[e,t]);return n.length===0?null:o.jsx(Sg,{title:"Entity Types",children:o.jsx(Nd,{compact:!0,items:n.map(([r,{icon:s,count:c}])=>({id:r,label:`${s} ${r}`,value:c}))})})}function P4({entities:e,entityCount:t,triples:n,layer:r}){const s=w.useMemo(()=>e.filter(d=>d.properties.has("http://dkg.io/ontology/sourceContentType")).length,[e]),c=w.useMemo(()=>e.reduce((d,f)=>d+f.connections.length,0),[e]),u=e.length>0?(c/e.length).toFixed(1):"0";return o.jsx(Sg,{title:"Layer Stats",children:o.jsx(Nd,{compact:!0,layer:r,items:[{id:"entities",label:Or(r,t),value:t},{id:"triples",label:"Triples",value:n},{id:"connections",label:"Connections",value:c},{id:"avg",label:"Avg. connections / entity",value:u},...s>0?[{id:"documents",label:"Documents",value:s}]:[]]})})}function U4({layer:e,count:t,contextGraphId:n,onComplete:r,onResult:s}){const[c,u]=w.useState(!1),[d,f]=w.useState(null),[h,g]=w.useState(null),m=e==="wm";w.useEffect(()=>{d?s==null||s({ok:!0,text:d}):h&&(s==null||s({ok:!1,text:h}))},[d,h]);const y=w.useCallback(async()=>{u(!0),g(null),f(null);let E=null;try{if(m){await qu(n);const S=await Vu(n,"wm");let T=0,N=0;for(const R of S){E=R.name;try{await Xh(n,R.name,R.subGraph?{subGraphName:R.subGraph}:{})}catch(A){const U=String((A==null?void 0:A.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(U))throw A}const H=await eo(n,R.name,"all",R.subGraph);T+=H.promotedCount,H.promotedCount===0&&(N+=1)}if(T>0){const R=N>0?` (${N} had nothing to promote)`:"";f(`Promoted ${T} triple${T!==1?"s":""} to Shared Memory${R}`)}else f("No triples were promoted — every assertion was already in Shared Memory or its content is still being committed.")}else{await qu(n);const S=await Vu(n,"swm"),T=await Wk(n,S,R=>{E=R}),N=Zk(T);if(N)f(N);else if(S.length===0)f("Nothing to publish — promote assertions to Shared Memory first.");else throw new Error(T.fundsErr??T.lastErr??"Publish failed")}r==null||r()}catch(S){const T=to(E??"an assertion",S);g((T==null?void 0:T.message)??Al(S)??(S==null?void 0:S.message)??"Action failed")}finally{u(!1)}},[m,n,r]);if(t===0)return null;const b=m?"#f59e0b":"#22c55e",k=m?"Shared Working Memory":"Verifiable Memory",j=Or(e,t).toLowerCase();return o.jsxs(Sg,{title:m?"Promote":"Publish",footnote:`Moves ${j} from this layer to ${k}.`,children:[o.jsxs("div",{className:"v10-decision-context",style:{marginBottom:10},children:[t," ",j," in this layer can be ",m?"promoted to Shared Working Memory for collaborative review":"published to Verifiable Memory on-chain","."]}),d&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-success)",marginBottom:8},children:["✓ ",d]}),h&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:"var(--text-danger)",marginBottom:8},children:["✕ ",h]}),o.jsx("div",{className:"v10-decision-actions",children:o.jsx("button",{"data-testid":m?"widget-promote-all-btn":"widget-publish-vm-btn",className:m?"v10-decision-btn approve":"v10-decision-btn primary-cta publish-vm",style:m?{borderColor:`${b}50`,color:"var(--text-warning)",background:`${b}15`,opacity:c?.5:1}:{opacity:c?.5:1},disabled:c,onClick:y,children:c?"...":m?"✓ Promote All → Shared":"◉ Publish to Verifiable Memory"})})]})}function B4({layer:e,entities:t,entityCount:n,tripleCount:r,contextGraphId:s,onComplete:c}){const[u,d]=w.useState(null),f=u&&o.jsxs("div",{"data-testid":"layer-action-result",style:{fontSize:11,color:u.ok?"var(--text-success)":"var(--text-danger)",marginBottom:8},children:[u.ok?"✓":"✕"," ",u.text]});return n===0?o.jsxs("div",{className:"v10-layer-widgets-strip empty",children:[f,o.jsx(sn,{compact:!0,tone:e,icon:Mn[e].icon,title:`No ${Or(e,2).toLowerCase()} yet`,description:e==="wm"?"Import data or chat with agents to populate Working Memory.":e==="swm"?"Promote entities from Working Memory to share them with the team.":"Publish entities from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-layer-widgets-strip",children:[o.jsxs("div",{className:"v10-layer-widgets-strip-stats",children:[o.jsx(P4,{entities:t,entityCount:n,triples:r,layer:e}),o.jsx(I4,{entities:t})]}),(e==="wm"||e==="swm")&&o.jsx("div",{className:"v10-layer-widgets-strip-action",children:o.jsx(U4,{layer:e,count:n,entities:t,contextGraphId:s,onComplete:c,onResult:d})})]})}const jg="doc:";function F4(e,t,n){return`${jg}${e}|${t}|${n}`}function H4(e,t,n){return e?{ref:e,contentType:"text/markdown"}:t?{ref:t,contentType:n}:{ref:void 0,contentType:n}}function q4(e){const t=e.slice(jg.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 RS(e,t){if(e.length<=t)return e;const n=t-1,r=Math.ceil(n/2),s=n-r;return`${e.slice(0,r)}…${e.slice(-s)}`}const G4={working:{layerKey:"wm",icon:"◇",label:"Working"},shared:{layerKey:"swm",icon:"◈",label:"Shared"},verified:{layerKey:"vm",icon:"◉",label:"Verifiable"}};function _S({entities:e,layerKey:t,layerIcon:n,onSelectEntity:r,onOpenAgent:s,externallySorted:c=!1,sortLabel:u,headerExtra:d,timestampPredicate:f,perEntityTrustBadge:h=!1}){const g=Ir(),m=ns(),y=Or(t,e.length).toLowerCase(),b=w.useMemo(()=>{if(c)return e;const E=[...e];return E.sort((S,T)=>{const N=S.tripleCount??0;return(T.tripleCount??0)-N}),E},[e,c]),k=t==="vm"?"Verifiable":t==="swm"?"Shared":"Working";if(e.length===0)return o.jsx("div",{className:"v10-entity-list empty",children:o.jsx(sn,{compact:!0,tone:t,icon:n,title:`No ${Or(t,2).toLowerCase()} yet`,description:`This view will fill when matching ${Or(t,2).toLowerCase()} are available.`})});const j=u??(c?"click to open":"sorted by triples · click to open");return o.jsxs("div",{className:"v10-entity-list",children:[o.jsxs("div",{className:"v10-entity-list-header",children:[o.jsxs("span",{className:"v10-entity-list-count",children:[b.length," ",y]}),o.jsx("span",{className:"v10-entity-list-hint",children:j}),d&&o.jsx("span",{className:"v10-entity-list-extra",children:d})]}),b.map(E=>{const{icon:S,type:T}=Cd(E,g),N=E.tripleCount??0,R=jd(E),H=R?m==null?void 0:m.get(R):null,A=f?zu(E,f):null;return o.jsxs("div",{className:"v10-entity-card",onClick:U=>{U.stopPropagation(),r(E.uri)},children:[o.jsx("span",{className:"v10-entity-card-icon",children:S}),o.jsxs("div",{className:"v10-entity-card-main",children:[o.jsx("div",{className:"v10-entity-card-title",children:E.label}),o.jsxs("div",{className:"v10-entity-card-meta",children:[(H||R)&&o.jsx(Yi,{agent:H??void 0,fallbackUri:R??void 0,size:"sm",onOpenAgent:s}),T&&T!=="Entity"&&o.jsxs("span",{className:"v10-entity-type-pill",children:[S," ",T]}),A!=null&&o.jsx("span",{className:"v10-entity-card-timestamp",title:new Date(A).toLocaleString(),children:uL(A)}),o.jsxs("span",{className:"v10-entity-card-triples",children:[N," triples"]})]})]}),h?(()=>{const U=G4[E.trustLevel];return o.jsxs("span",{className:`v10-trust-badge ${U.layerKey}`,title:`${U.label} Memory`,children:[U.icon," ",U.label]})})():o.jsxs("span",{className:`v10-trust-badge ${t}`,children:[n," ",k]})]},E.uri)})]})}function V4({layer:e,entities:t,tripleCount:n,layerTriples:r,contextGraphId:s,memory:c,activeTab:u,onTabChange:d,onSelectEntity:f,onNodeClick:h,footer:g,swmAttribution:m}){var R;const y=Mn[e],b=Or(e,2),k=((R=c.layerStatus)==null?void 0:R.vm)??(c.loading?"loading":c.error?"error":"ok"),j=e==="vm"&&k==="loading"&&t.length===0,E=e==="vm"&&k==="error"&&t.length===0,S=e==="vm"&&k==="ok"&&t.length===0,T=c.counts[e],N=H=>A=>{A.stopPropagation(),d(H)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsx("button",{className:`v10-layer-expand-tab ${u==="items"?"active":""}`,onClick:N("items"),children:b}),e!=="vm"&&o.jsx("button",{className:`v10-layer-expand-tab ${u==="assertions"?"active":""}`,onClick:N("assertions"),children:"Assertions"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="graph"?"active":""}`,onClick:N("graph"),children:"Graph"}),o.jsx("button",{className:`v10-layer-expand-tab ${u==="docs"?"active":""}`,onClick:N("docs"),children:"Documents"})]}),u==="items"&&o.jsxs("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`layer:${e}:items`,children:[e==="vm"&&!j&&!E&&o.jsx(W4,{entities:t,tripleCount:n,contextGraphId:s}),j?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(sn,{compact:!0,tone:"vm",icon:Mn.vm.icon,title:"Loading Verifiable Memory...",description:"Knowledge Assets are being read from the verified layer."})}):E?o.jsx("div",{className:"v10-layer-widgets-strip empty",children:o.jsx(sn,{compact:!0,tone:"vm",icon:Mn.vm.icon,title:"Verifiable Memory status unavailable.",description:"This node could not read the verified layer right now."})}):!S&&o.jsxs(o.Fragment,{children:[o.jsx(B4,{layer:e,entities:t,entityCount:T,tripleCount:n,contextGraphId:s,onComplete:c.refresh}),o.jsx(_S,{entities:t,layerKey:e,layerIcon:y.icon,onSelectEntity:f})]}),g]}),u==="assertions"&&e!=="vm"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Z4,{contextGraphId:s,layer:e,onComplete:c.refresh,scrollKey:`layer:${e}:assertions`})}),u==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`layer:${e}:graph`,children:o.jsx(AS,{layer:e,triples:r,onNodeClick:h,contextGraphId:s,swmAttribution:e==="swm"?m:void 0,layerEntities:t})}),u==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(OS,{entities:t,contextGraphId:s,scrollKey:`layer:${e}:docs`})})]})}function W4({entities:e,tripleCount:t,contextGraphId:n}){const r=e.length,s=new Set;for(const u of e)for(const d of u.types)s.add(d);const c=s.size;return r===0?o.jsxs("div",{className:"v10-vm-hero v10-vm-hero-empty",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"Nothing published yet"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(sn,{compact:!0,className:"v10-vm-empty-state",tone:"vm",icon:Mn.vm.icon,title:"No Knowledge Assets yet.",description:"Publish entities from Shared Working Memory to verify them on-chain."})]}):o.jsxs("div",{className:"v10-vm-hero",children:[o.jsxs("div",{className:"v10-vm-hero-title",children:[o.jsx("span",{className:"v10-vm-hero-badge",children:"◉ Verifiable Memory"}),o.jsxs("div",{className:"v10-vm-hero-heading",children:[o.jsx("span",{className:"v10-vm-hero-headline",children:"On-chain anchored · cryptographically signed"}),o.jsxs("span",{className:"v10-vm-hero-context",title:n,children:["Context Graph: ",n]})]})]}),o.jsx(Nd,{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:c,label:"Entity Types"}]}),o.jsxs("div",{className:"v10-vm-hero-strip",children:[o.jsxs("div",{className:"v10-vm-hero-chip",title:"Multi-agent endorsement",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#22c55e"}}),"Consensus"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Published to the DKG blockchain anchor",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#3b82f6"}}),"On-chain"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Each contribution bound to a DID",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#a855f7"}}),"Agent Identity"]}),o.jsxs("div",{className:"v10-vm-hero-chip",title:"Tamper-evident via content hashing",children:[o.jsx("span",{className:"v10-vm-hero-chip-dot",style:{background:"#f59e0b"}}),"Content Hash"]})]})]})}function Z4({contextGraphId:e,layer:t,onComplete:n,scrollKey:r}){const{data:s,loading:c,refresh:u}=Ea(()=>Vu(e,t),[e,t],0),{data:d}=Ea(()=>x2(e),[e,t],0),[f,h]=w.useState(null),[g,m]=w.useState(null),[y,b]=w.useState(null),k=w.useCallback(async N=>{h(N.graphUri),m(null),b(null);try{if(await qu(e),t==="wm"){try{await Xh(e,N.name,N.subGraph?{subGraphName:N.subGraph}:{})}catch(A){const U=String((A==null?void 0:A.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(U))throw A}const R=await eo(e,N.name,"all",N.subGraph),H=ng(N.name,R);m(H.message)}else await Vk(e,N.name,N.subGraph?{subGraphName:N.subGraph}:{}),m(`Published ${N.name} to Verifiable Memory`);u(),n()}catch(R){const H=to(N.name,R);b((H==null?void 0:H.message)??Al(R)??(R==null?void 0:R.message)??"Action failed")}finally{h(null)}},[e,t,u,n]),j=w.useCallback(async()=>{if(!(s!=null&&s.length))return;h("__all__"),m(null),b(null);let N=null;try{if(await qu(e),t==="wm"){let R=0,H=0;for(const A of s){N=A.name;try{await Xh(e,A.name,A.subGraph?{subGraphName:A.subGraph}:{})}catch(G){const M=String((G==null?void 0:G.message)??"");if(!/already|finaliz|sealed|promoted|no quads|reserved/i.test(M))throw G}const U=await eo(e,A.name,"all",A.subGraph);R+=U.promotedCount,U.promotedCount===0&&(H+=1)}if(R>0){const A=H>0?` (${H} had nothing to promote)`:"";m(`Promoted ${R} triples across ${s.length} assertion${s.length!==1?"s":""}${A}`)}else m("No triples were promoted — every assertion was already in Shared Memory or its content is still being committed.")}else{const R=await Wk(e,s,A=>{N=A}),H=Zk(R);if(H)m(H);else throw new Error(R.fundsErr??R.lastErr??"Publish failed")}u(),n()}catch(R){const H=to(N??"selected assertion",R);b((H==null?void 0:H.message)??Al(R)??(R==null?void 0:R.message)??"Action failed")}finally{h(null)}},[s,e,t,u,n]),E={flex:1,overflow:"auto"};if(c)return o.jsx("div",{className:"v10-layer-empty-shell",style:E,"data-cg-scroll-key":r,children:o.jsx(sn,{compact:!0,tone:t,icon:Mn[t].icon,title:"Loading assertions..."})});if(!(s!=null&&s.length))return o.jsx("div",{className:"v10-layer-empty-shell",style:E,"data-cg-scroll-key":r,children:o.jsx(sn,{tone:t,icon:Mn[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 S=t==="wm"?"Promote → Shared":"Publish to VM",T=t==="wm"?"Promote All → Shared":"Publish all to Verifiable Memory";return o.jsxs("div",{style:E,"data-cg-scroll-key":r,children:[o.jsxs("div",{style:{padding:"8px 16px",display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid var(--border-subtle)"},children:[o.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary)"},children:[s.length," assertion",s.length!==1?"s":""]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:j,style:{opacity:f==="__all__"?.5:1},children:f==="__all__"?"...":T})]}),g&&o.jsxs("div",{style:{padding:"6px 16px",fontSize:11,color:"var(--text-success)"},children:["✓ ",g]}),y&&o.jsxs("div",{style:{padding:"6px 16px",fontSize:11,color:"var(--text-danger)"},children:["✕ ",y]}),s.map(N=>o.jsxs("div",{className:"v10-item-row",children:[o.jsx("span",{className:"v10-item-icon",children:"▤"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",style:{fontFamily:"var(--font-mono)",fontSize:11},children:N.name}),(d==null?void 0:d[N.name])&&o.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:d[N.name],children:d[N.name]}),o.jsxs("div",{className:"v10-item-meta-row",children:[N.tripleCount!=null&&o.jsxs("span",{className:"v10-item-count",children:[N.tripleCount," triples"]}),N.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${N.subGraph}`,children:["› ",RS(N.subGraph,18)]})]})]}),o.jsx("button",{className:`v10-layer-expand-footer-btn ${t==="wm"?"promote":"publish"}`,disabled:f!==null,onClick:R=>{R.stopPropagation(),k(N)},style:{opacity:f===N.graphUri?.5:1,flexShrink:0},children:f===N.graphUri?"...":S})]},N.graphUri))]})}function Y4({layer:e,memory:t,onNodeClick:n,onSelectEntity:r,contextGraphId:s,activeTab:c,onTabChange:u,swmAttribution:d}){const f=Mn[e],h=w.useMemo(()=>t.entityList.filter(m=>m.trustLevel===f.trustLevel),[t.entityList,f.trustLevel]),g=iL(t,e);return o.jsxs("div",{className:"v10-layer-detail",children:[o.jsxs("div",{className:"v10-layer-detail-header",children:[o.jsx("span",{className:"v10-layer-detail-icon",style:{color:f.color},children:f.icon}),o.jsxs("div",{children:[o.jsx("div",{className:"v10-layer-detail-title",children:f.title}),o.jsx("div",{className:"v10-layer-detail-desc",children:f.desc})]}),o.jsx("div",{className:"v10-layer-detail-actions"})]}),o.jsx("div",{className:"v10-layer-detail-body",children:o.jsx(V4,{layer:e,entities:h,tripleCount:g.length,layerTriples:g,contextGraphId:s,memory:t,activeTab:c,onTabChange:u,onSelectEntity:r,onNodeClick:n,swmAttribution:d})})]})}function OS({entities:e,contextGraphId:t,scrollKey:n}){const r=vn(u=>u.openTab),s=w.useMemo(()=>e.filter(u=>u.properties.has(lh)),[e]),c=u=>{var y,b,k;const d=(y=u.connections.find(j=>j.predicate===Dx))==null?void 0:y.targetUri,f=(b=u.connections.find(j=>j.predicate===$x))==null?void 0:b.targetUri,h=((k=u.properties.get(lh))==null?void 0:k[0])??"",{ref:g,contentType:m}=H4(d,f,h);r({id:F4(t??"",g??u.uri,m),label:u.label,closable:!0,icon:"📄"})};return s.length===0?o.jsx("div",{className:"v10-docs-placeholder v10-layer-empty-shell",style:{flex:1},"data-cg-scroll-key":n,children:o.jsx(sn,{compact:!0,title:"No documents in this layer yet.",description:"Import a file to add document-backed entities."})}):o.jsx("div",{className:"v10-layer-detail-content","data-cg-scroll-key":n,children:o.jsx("div",{className:"v10-items-list",children:s.map(u=>{var m,y,b,k;const d=((m=u.properties.get(lh))==null?void 0:m[0])??"",f=(y=u.connections.find(j=>j.predicate===Dx||j.predicate===$x))==null?void 0:y.targetUri,h=f?e.find(j=>j.uri===f):void 0,g=((b=h==null?void 0:h.properties.get(Ix))==null?void 0:b[0])??((k=u.properties.get(Ix))==null?void 0:k[0]);return o.jsxs("div",{className:"v10-item-row",onClick:()=>c(u),children:[o.jsx("span",{className:"v10-item-icon",children:"📄"}),o.jsxs("div",{className:"v10-item-info",children:[o.jsx("div",{className:"v10-item-name",children:u.label}),o.jsxs("div",{className:"v10-item-meta-row",children:[d&&o.jsx("span",{className:"v10-item-type",children:d}),g&&o.jsxs("span",{className:"v10-item-count",children:["· ",Math.round(parseInt(g)/1024),"KB"]})]})]}),o.jsx("button",{className:"v10-item-promote-btn",onClick:j=>{j.stopPropagation(),c(u)},children:"Open →"})]},u.uri)})})})}function LS(e){return`SELECT ?g ?s ?p ?o WHERE {
|
|
1296
|
-
GRAPH ?g { ?s ?p ?o }
|
|
1297
|
-
${dm(e)}
|
|
1298
|
-
}
|
|
1299
|
-
LIMIT 1000`}const tr="__context_graph",ro="ui-saved-queries",Xu="Saved queries",Ju="User-created SPARQL saved in this node profile for this Context Graph.",Qa="http://dkg.io/ontology/profile/",Zx="http://schema.org/",Yx="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Q4="http://www.w3.org/2001/XMLSchema#integer";function Qx(e){return JSON.stringify(e)}function dm(e){const t=`did:dkg:context-graph:${e}`,n=`${t}/`;return`FILTER(
|
|
1300
|
-
(
|
|
1301
|
-
STR(?g) = ${Qx(t)} ||
|
|
1302
|
-
STRSTARTS(STR(?g), ${Qx(n)})
|
|
1303
|
-
) &&
|
|
1304
|
-
!CONTAINS(STR(?g), "/_private")
|
|
1305
|
-
)`}function K4(e){const t="whole-context-graph",n="Context graph",s=tr,c=u=>({subGraph:s,catalogSlug:t,catalogName:n,catalogDescription:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",catalogRank:-100,resultColumn:"",...u});return{slug:t,subGraph:s,name:n,description:"Ready-made SPARQL included with the Node UI for common Context Graph checks.",rank:-100,queries:[c({slug:"all-triples",name:"All triples",description:"Show triples across available non-private graphs in this context graph.",sparql:LS(e),resultColumn:"o",rank:1}),c({slug:"graphs",name:"Graphs",description:"List available non-private named graphs and triple counts.",sparql:`SELECT ?g (COUNT(*) AS ?triples) WHERE {
|
|
1306
|
-
GRAPH ?g { ?s ?p ?o }
|
|
1307
|
-
${dm(e)}
|
|
1308
|
-
}
|
|
1309
|
-
GROUP BY ?g
|
|
1310
|
-
ORDER BY DESC(?triples)
|
|
1311
|
-
LIMIT 100`,resultColumn:"g",rank:2}),c({slug:"types",name:"Types",description:"Count entities by RDF type across the context graph.",sparql:`SELECT ?type (COUNT(DISTINCT ?s) AS ?entities) WHERE {
|
|
1312
|
-
GRAPH ?g { ?s a ?type }
|
|
1313
|
-
${dm(e)}
|
|
1314
|
-
}
|
|
1315
|
-
GROUP BY ?type
|
|
1316
|
-
ORDER BY DESC(?entities)
|
|
1317
|
-
LIMIT 100`,resultColumn:"type",rank:3})]}}function X4(e){return e.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Kx(e,t,n){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(n)}`}function Ui(e){return JSON.stringify(e)}function Xx(e){return`"${e}"^^<${Q4}>`}function J4(e,t,n,r){const s=Date.now(),c=`${X4(t)}-${s.toString(36)}`,u=Kx(e,"catalog",ro),d=Kx(e,"query",c),f={slug:c,subGraph:tr,catalogSlug:ro,catalogName:Xu,catalogDescription:Ju,catalogRank:50,name:t,description:n||void 0,sparql:r,resultColumn:"",rank:s},h=[{subject:u,predicate:Yx,object:`${Qa}QueryCatalog`,graph:""},{subject:u,predicate:`${Qa}forSubGraph`,object:Ui(tr),graph:""},{subject:u,predicate:`${Qa}displayName`,object:Ui(Xu),graph:""},{subject:u,predicate:`${Zx}description`,object:Ui(Ju),graph:""},{subject:u,predicate:`${Qa}rank`,object:Xx(50),graph:""},{subject:d,predicate:Yx,object:`${Qa}SavedQuery`,graph:""},{subject:d,predicate:`${Qa}forSubGraph`,object:Ui(tr),graph:""},{subject:d,predicate:`${Qa}inCatalog`,object:u,graph:""},{subject:d,predicate:`${Qa}displayName`,object:Ui(t),graph:""},{subject:d,predicate:`${Qa}sparqlQuery`,object:Ui(r),graph:""},{subject:d,predicate:`${Qa}rank`,object:Xx(s),graph:""}];return n&&h.push({subject:d,predicate:`${Zx}description`,object:Ui(n),graph:""}),{query:f,quads:h}}function ez(e,t){const n=`${tr}|${ro}`,r=e.map(c=>({...c,queries:[...c.queries]})),s=r.find(c=>`${c.subGraph}|${c.slug}`===n);return s?(s.queries=[...s.queries,t].sort((c,u)=>c.rank-u.rank||c.name.localeCompare(u.name)),r):[...r,{slug:ro,subGraph:tr,name:Xu,description:Ju,rank:50,queries:[t]}]}function Jx(e){const t=new Map;for(const n of e){const r=`${n.subGraph}|${n.slug}`,s=t.get(r);if(!s){t.set(r,{...n,queries:[...n.queries]});continue}const c=new Map(s.queries.map(u=>[`${u.subGraph}|${u.catalogSlug}|${u.slug}`,u]));for(const u of n.queries){const d=`${u.subGraph}|${u.catalogSlug}|${u.slug}`;c.has(d)||c.set(d,u)}s.queries=Array.from(c.values()).sort((u,d)=>u.rank-d.rank||u.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 tz(e){return e==null?"":typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function nz(e){return e?e.length<=140?e:`${e.slice(0,110)}...${e.slice(-24)}`:"—"}function Ed(e){return e.subGraph===tr&&e.slug==="whole-context-graph"}function az(e){return e.subGraph===tr?"context":"subgraph"}function rz(e,t,n){return Ed(e)?"Built-in presets":e.subGraph===tr&&e.slug===ro?Xu:t==="context"?e.name:`${n??e.subGraph}: ${e.name}`}function iz(e){return Ed(e)?"UI-provided SPARQL for common Context Graph checks.":e.subGraph===tr&&e.slug===ro?Ju:e.description??""}function sz(e,t){return Ed(e)?"Preset":t==="context"?"Saved":"Subgraph"}function oz(e){return o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Review the query or node response details, then try again."}),e&&o.jsx("span",{className:"v10-cg-query-error-detail",children:e})]})}function lz({contextGraphId:e}){const t=Ir(),n=w.useMemo(()=>LS(e),[e]),[r,s]=w.useState(n),[c,u]=w.useState(n),[d,f]=w.useState(null),[h,g]=w.useState([]),[m,y]=w.useState(!1),[b,k]=w.useState(""),[j,E]=w.useState(""),[S,T]=w.useState(!1),[N,R]=w.useState(null),[H,A]=w.useState(null),U=w.useMemo(()=>K4(e),[e]),G=w.useMemo(()=>Jx([U,...h,...(t==null?void 0:t.queryCatalogs)??[]]),[U,h,t==null?void 0:t.queryCatalogs]),M=w.useMemo(()=>t!=null&&t.loading||t!=null&&t.error?Jx([U,...h]):G,[U,h,t==null?void 0:t.error,t==null?void 0:t.loading,G]);w.useEffect(()=>{s(n),u(n),f(null),g([]),y(!1),k(""),E(""),R(null),A(null)},[n]);const{data:_,loading:I,error:B,refresh:Z}=Ea(()=>ia(c,e),[c,e],0),$=w.useMemo(()=>{var q,O;return((q=_==null?void 0:_.result)==null?void 0:q.bindings)??((O=_==null?void 0:_.results)==null?void 0:O.bindings)??[]},[_]),D=w.useMemo(()=>G.some(q=>!Ed(q)&&q.queries.length>0),[G]),F=w.useMemo(()=>{const q=[];for(const O of $)for(const ne of Object.keys(O))q.includes(ne)||q.push(ne);return q},[$]),V=w.useCallback(()=>{const q=r.trim();if(q){if(f(null),A(null),R(null),q===c){Z();return}u(q)}},[c,r,Z]),X=w.useCallback(()=>{s(n),f(null),A(null),R(null),c===n?Z():u(n)},[c,n,Z]),Q=w.useCallback((q,O)=>{const ne=O.trim();if(ne){if(f(q),s(ne),A(null),R(null),c===ne){Z();return}u(ne)}},[c,Z]),L=w.useCallback(()=>{const q=r.trim().split(`
|
|
1318
|
-
`).find(O=>O.trim());k(q?q.replace(/\s+/g," ").slice(0,60):""),E(""),R(null),A(null),y(!0)},[r]),P=w.useCallback(async q=>{q.preventDefault();const O=b.trim(),ne=j.trim(),ue=r.trim();if(!O){R("Name is required.");return}if(!ue){R("Query is empty.");return}T(!0),R(null),A(null);try{const{query:le,quads:be}=J4(e,O,ne,ue);await w2(e,be),g(Ee=>ez(Ee,le));const Re=`${le.subGraph}|${le.catalogSlug}|${le.slug}`;f(Re),s(le.sparql),c===le.sparql?Z():u(le.sparql),k(""),E(""),y(!1),A("Saved to catalogue.")}catch(le){R((le==null?void 0:le.message)??"Failed to save query.")}finally{T(!1)}},[c,e,r,Z,j,b]);return o.jsxs("div",{className:"v10-memory-layer-view v10-cg-query-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",children:"⟐"}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:"Query Catalogue"}),o.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."})]})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-catalog","aria-labelledby":"query-catalogue-saved-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Query Library"}),o.jsx("h3",{id:"query-catalogue-saved-title",children:"Choose a query"}),o.jsx("p",{children:"Load a preset or saved query into the editor below."})]})}),(t==null?void 0:t.loading)&&o.jsx(sn,{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)&&o.jsx(sn,{compact:!0,inline:!0,tone:"danger",icon:"!",title:"Saved query catalogue unavailable",description:t.error}),M.length>0&&o.jsx("div",{className:"v10-cg-query-catalog-groups",children:M.map(q=>{const O=az(q),ne=O==="context"||t==null?void 0:t.forSubGraph(q.subGraph),ue=(ne==null?void 0:ne.color)??"#38bdf8",le=rz(q,O,ne==null?void 0:ne.displayName),be=iz(q),Re=sz(q,O);return o.jsxs("div",{className:"v10-cg-query-catalog-group",style:{"--sg-color":ue},children:[o.jsx("div",{className:"v10-cg-query-catalog-group-header",children:o.jsxs("div",{children:[o.jsxs("div",{className:"v10-cg-query-catalog-title-row",children:[o.jsx("span",{className:"v10-cg-query-catalog-kind",children:Re}),o.jsx("h4",{children:le})]}),be&&o.jsx("p",{children:be})]})}),o.jsx("div",{className:"v10-cg-query-list",children:q.queries.map(Ee=>{const Ie=`${Ee.subGraph}|${Ee.catalogSlug}|${Ee.slug}`,Ve=d===Ie&&c===Ee.sparql,Se=Ee.description?`${Ee.name}. ${Ee.description}`:Ee.name;return o.jsxs("button",{type:"button",className:`v10-cg-query-chip${Ve?" active":""}`,title:Se,"aria-label":`Load query: ${Se}`,onClick:()=>Q(Ie,Ee.sparql),children:[o.jsx("span",{className:"v10-cg-query-chip-title",children:Ee.name}),Ee.description&&o.jsx("span",{className:"v10-cg-query-chip-desc",children:Ee.description})]},Ie)})})]},`${q.subGraph}|${q.slug}`)})}),!(t!=null&&t.loading)&&!(t!=null&&t.error)&&G.length>0&&!D&&o.jsx(sn,{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."})]}),o.jsxs("section",{className:"v10-cg-query-zone v10-cg-query-zone-editor","aria-labelledby":"query-catalogue-editor-title",children:[o.jsx("div",{className:"v10-cg-query-zone-header",children:o.jsxs("div",{children:[o.jsx("span",{className:"v10-cg-query-eyebrow",children:"Ad-hoc SPARQL"}),o.jsx("h3",{id:"query-catalogue-editor-title",children:"Editor and results"}),o.jsx("p",{children:"Run a one-off query against this Context Graph, or save it when it should become reusable."})]})}),o.jsxs("div",{className:"v10-cg-query-editor",children:[o.jsx("textarea",{className:"v10-cg-query-textarea","aria-label":"SPARQL editor",value:r,onChange:q=>{s(q.target.value),f(null)},spellCheck:!1}),o.jsxs("div",{className:"v10-cg-query-actions",children:[o.jsx("button",{className:"v10-mlv-run-btn",type:"button",onClick:V,children:"Run"}),o.jsx("button",{className:"v10-mlv-save-btn",type:"button",onClick:L,children:"Save"}),o.jsx("button",{className:"v10-mlv-clear-btn",type:"button",onClick:X,children:"Reset"})]})]}),m&&o.jsxs("form",{className:"v10-cg-query-save-panel",onSubmit:P,children:[o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Name"}),o.jsx("input",{type:"text",value:b,onChange:q=>k(q.target.value),placeholder:"Query name",maxLength:80})]}),o.jsxs("label",{className:"v10-cg-query-save-field",children:[o.jsx("span",{children:"Description"}),o.jsx("input",{type:"text",value:j,onChange:q=>E(q.target.value),placeholder:"Optional",maxLength:180})]}),o.jsxs("div",{className:"v10-cg-query-save-actions",children:[o.jsx("button",{type:"button",className:"v10-mlv-clear-btn",onClick:()=>y(!1),disabled:S,children:"Cancel"}),o.jsx("button",{type:"submit",className:"v10-mlv-run-btn",disabled:S,children:S?"Saving...":"Save query"})]})]}),H&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-success)"},children:H}),N&&o.jsx("p",{className:"v10-mlv-status",style:{color:"var(--text-danger)"},children:N}),o.jsxs("div",{className:"v10-cg-query-results",children:[I&&o.jsx(sn,{compact:!0,tone:"query",icon:"?",title:"Loading query results..."}),B&&o.jsx(sn,{compact:!0,tone:"danger",icon:"!",title:"Query could not run.",description:oz(B)}),!I&&!B&&$.length===0&&o.jsx(sn,{compact:!0,tone:"query",icon:"?",title:"No results for this query.",description:"Adjust the query or run a saved query against this Context Graph."}),!I&&!B&&$.length>0&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[$.length," result",$.length===1?"":"s"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:F.map(q=>o.jsx("th",{children:q},q))})}),o.jsx("tbody",{children:$.map((q,O)=>o.jsx("tr",{children:F.map(ne=>{const ue=tz(q[ne]);return o.jsx("td",{className:"v10-mlv-cell",title:ue,children:nz(ue)},ne)})},O))})]})]})]})]})]})}const zS="http://dkg.io/ontology/",cz="http://www.w3.org/ns/prov#";function MS(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 fh(e){const t=MS(e);if(!t)return"";const n=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return n?n[1]:t}function uz(e){const t=MS(e);if(!t)return"";const n=t.trim();return n.startsWith("<")&&n.endsWith(">")?n.slice(1,-1):n}function dz(e,t){return`PREFIX dkg: <${zS}>
|
|
1319
|
-
SELECT ?owner WHERE {
|
|
1320
|
-
GRAPH ?g { <${t}> dkg:workspaceOwner ?owner . }
|
|
1321
|
-
FILTER(
|
|
1322
|
-
STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
|
|
1323
|
-
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1324
|
-
)
|
|
1325
|
-
} LIMIT 1`}function pz(e,t){return`PREFIX dkg: <${zS}>
|
|
1326
|
-
PREFIX prov: <${cz}>
|
|
1327
|
-
SELECT ?op ?publishedAt ?agent WHERE {
|
|
1328
|
-
GRAPH ?g {
|
|
1329
|
-
?op a dkg:WorkspaceOperation ;
|
|
1330
|
-
dkg:rootEntity <${t}> ;
|
|
1331
|
-
dkg:publishedAt ?publishedAt .
|
|
1332
|
-
OPTIONAL { ?op prov:wasAttributedTo ?agent }
|
|
1333
|
-
}
|
|
1334
|
-
FILTER(
|
|
1335
|
-
STRSTARTS(STR(?g), "did:dkg:context-graph:${e}") &&
|
|
1336
|
-
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1337
|
-
)
|
|
1338
|
-
} ORDER BY DESC(?publishedAt) LIMIT 1`}const hh={ual:null,opId:null,owner:null,publishedAt:null,publisherPeerId:null,loading:!1};function fz(e,t,n=!0){const[r,s]=w.useState(()=>({...hh})),c=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...hh});return}const u=++c.current;s(d=>({...d,loading:!0,error:void 0})),(async()=>{var d,f;try{const[h,g]=await Promise.all([ia(dz(e,t),e).catch(()=>null),ia(pz(e,t),e).catch(()=>null)]);if(u!==c.current)return;const m=(((d=h==null?void 0:h.result)==null?void 0:d.bindings)??[])[0],y=(((f=g==null?void 0:g.result)==null?void 0:f.bindings)??[])[0],b=y?uz(y.op):null,k=y?fh(y.publishedAt):null,j=y!=null&&y.agent?fh(y.agent):null,E=m?fh(m.owner):null;s({ual:b,opId:b?b.slice(b.lastIndexOf(":")+1):null,owner:E,publishedAt:k||null,publisherPeerId:j,loading:!1})}catch(h){if(u!==c.current)return;s({...hh,loading:!1,error:(h==null?void 0:h.message)??String(h)})}})()},[e,t,n]),r}function e1(e,t){if(!e)return null;for(const n of t.values())if(n.peerId&&n.peerId===e)return n.uri;return null}function Fs(e,t=6,n=4){return e?e.length<=t+n+2?e:`${e.slice(0,t)}…${e.slice(-n)}`:""}const Cg="http://dkg.io/ontology/",Bi={status:"idle",ual:null,txHash:null,blockNumber:null,kaId:null,author:null,finalizedAt:null,agent:null};function Sn(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 pu(e){const t=e.trim();return t.startsWith("<")&&t.endsWith(">")?t.slice(1,-1):t}function bi(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function t1(e){return/[<>"{}|\\^`\s]/.test(e)?"":e}function hz(e,t){const n=`did:dkg:context-graph:${e}/_meta`,r=bi(t);return`PREFIX dkg: <${Cg}>
|
|
1339
|
-
PREFIX prov: <http://www.w3.org/ns/prov#>
|
|
1340
|
-
SELECT ?asrt ?tx ?block ?kaId ?batchId ?finalizedAt ?ual ?agentLc ?ualSelf ?agentSelf WHERE {
|
|
1341
|
-
GRAPH <${n}> {
|
|
1342
|
-
?asrt dkg:publishedAtTx ?tx ;
|
|
1343
|
-
dkg:publishedAtBlock ?block .
|
|
1344
|
-
FILTER(
|
|
1345
|
-
STRSTARTS("${r}", STR(?asrt)) ||
|
|
1346
|
-
EXISTS { ?asrt dkg:assertionRootEntity <${t}> } ||
|
|
1347
|
-
EXISTS { ?asrt dkg:assertionEntity <${t}> }
|
|
1348
|
-
)
|
|
1349
|
-
OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
|
|
1350
|
-
OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
|
|
1351
|
-
OPTIONAL {
|
|
1352
|
-
?lc dkg:rootEntity <${t}> ;
|
|
1353
|
-
dkg:reservedUal ?ual .
|
|
1354
|
-
# Pin the lifecycle URN to the FULL assertion scope (cg + optional
|
|
1355
|
-
# subGraphName), not just {addr}:{name} — otherwise a same-named
|
|
1356
|
-
# assertion in a sibling sub-graph (urn:dkg:assertion:{cg}:{other}:{addr}:{name})
|
|
1357
|
-
# also STRENDS-matches and leaks the wrong reservedUal/agent/batchId.
|
|
1358
|
-
# cgId is a build-time constant, so anchor on it as a literal and keep its
|
|
1359
|
-
# slashes intact (wallet-scoped cgIds like "<addr>/<name>" embed RAW in the
|
|
1360
|
-
# URN via assertionLifecycleUri); only the [/sub]/{addr}/{name} tail derived
|
|
1361
|
-
# from ?asrt is "/"->":" converted (sub/addr/name cannot contain "/").
|
|
1362
|
-
FILTER(STRENDS(STR(?lc), CONCAT(
|
|
1363
|
-
":${bi(e)}",
|
|
1364
|
-
REPLACE(STRBEFORE(STRAFTER(STR(?asrt), "did:dkg:context-graph:${bi(e)}"), "/assertion/"), "/", ":"),
|
|
1365
|
-
":",
|
|
1366
|
-
REPLACE(STRAFTER(STR(?asrt), "/assertion/"), "/", ":")
|
|
1367
|
-
)))
|
|
1368
|
-
OPTIONAL { ?lc prov:wasAttributedTo ?agentLc . }
|
|
1369
|
-
}
|
|
1370
|
-
OPTIONAL { ?asrt dkg:reservedUal ?ualSelf . }
|
|
1371
|
-
OPTIONAL { ?asrt prov:wasAttributedTo ?agentSelf . }
|
|
1372
|
-
BIND(IRI(COALESCE(?ualSelf, ?ual)) AS ?ualNode)
|
|
1373
|
-
OPTIONAL { ?ualNode dkg:batchId ?batchId . }
|
|
1374
|
-
}
|
|
1375
|
-
} ORDER BY DESC(STRSTARTS("${r}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function mz(e){const t=e.match(/\/assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function gz(e,t){return`PREFIX dkg: <${Cg}>
|
|
1376
|
-
SELECT ?source ?agent ?ts WHERE {
|
|
1377
|
-
GRAPH ?g {
|
|
1378
|
-
?op a dkg:ShareTransition ;
|
|
1379
|
-
dkg:entities <${t}> ;
|
|
1380
|
-
dkg:source ?source ;
|
|
1381
|
-
dkg:agent ?agent ;
|
|
1382
|
-
dkg:timestamp ?ts .
|
|
1383
|
-
}
|
|
1384
|
-
FILTER(
|
|
1385
|
-
STRSTARTS(STR(?g), "did:dkg:context-graph:${bi(e)}/") &&
|
|
1386
|
-
CONTAINS(STR(?g), "_shared_memory_meta")
|
|
1387
|
-
)
|
|
1388
|
-
} ORDER BY DESC(?ts) LIMIT 1`}function vz(e,t,n,r){const s=`did:dkg:context-graph:${e}/_meta`,c=`/assertion/${n}/${r}`,u=bi(t);return`PREFIX dkg: <${Cg}>
|
|
1389
|
-
SELECT ?ual ?tx ?block ?kaId ?finalizedAt WHERE {
|
|
1390
|
-
GRAPH <${s}> {
|
|
1391
|
-
?asrt dkg:publishedAtTx ?tx ;
|
|
1392
|
-
dkg:publishedAtBlock ?block .
|
|
1393
|
-
OPTIONAL { ?asrt dkg:publishedAtKaId ?kaId . }
|
|
1394
|
-
FILTER(STRENDS(STR(?asrt), "${bi(c)}"))
|
|
1395
|
-
OPTIONAL { ?asrt dkg:assertionFinalizedAt ?finalizedAt . }
|
|
1396
|
-
OPTIONAL {
|
|
1397
|
-
?lc dkg:rootEntity <${t}> ;
|
|
1398
|
-
dkg:reservedUal ?ual .
|
|
1399
|
-
FILTER(STRENDS(STR(?lc), "${bi(`:${n}:${r}`)}"))
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
} ORDER BY DESC(STRSTARTS("${u}", STR(?asrt))) DESC(STRLEN(STR(?asrt))) LIMIT 1`}function yz(e){const t=e.match(/^assertion\/([^/]+)\/(.+)$/);return t?{addr:t[1],name:t[2]}:null}function bz(e,t,n=!0){const[r,s]=w.useState(()=>({...Bi})),c=w.useRef(0);return w.useEffect(()=>{if(!n||!e||!t){s({...Bi});return}const u=++c.current;s({...Bi,status:"loading"}),(async()=>{var d,f,h;try{const g=t1(t);if(!g){s({...Bi,status:"offchain"});return}const m=await ia(hz(e,g),e);if(u!==c.current)return;const y=(((d=m==null?void 0:m.result)==null?void 0:d.bindings)??[])[0];if(y!=null&&y.tx){const _=y.asrt?pu(Sn(y.asrt)):"",I=mz(_),B=(I==null?void 0:I.addr)??null,$=(y.agentSelf?pu(Sn(y.agentSelf)):"")||(y.agentLc?pu(Sn(y.agentLc)):"")||(B?`did:dkg:agent:${B.toLowerCase()}`:null),D=(y.ualSelf?Sn(y.ualSelf):"")||(y.ual?Sn(y.ual):""),F=(y.kaId?Sn(y.kaId):"")||(y.batchId?Sn(y.batchId):"");s({status:"verified",ual:D||null,txHash:Sn(y.tx)||null,blockNumber:y.block?Sn(y.block):null,kaId:F||null,author:B,finalizedAt:y.finalizedAt?Sn(y.finalizedAt):null,agent:$});return}const b=await ia(gz(e,g));if(u!==c.current)return;const k=(((f=b==null?void 0:b.result)==null?void 0:f.bindings)??[])[0];if(!k){s({...Bi,status:"offchain"});return}const j=Sn(k.source),E=yz(j),S=k.agent?pu(Sn(k.agent)):null,T=(E==null?void 0:E.addr)??null;if(!E||!t1(E.addr)||!bi(E.name)){s({...Bi,status:"offchain",author:T,agent:S});return}const N=await ia(vz(e,g,E.addr,E.name),e);if(u!==c.current)return;const R=(((h=N==null?void 0:N.result)==null?void 0:h.bindings)??[])[0],H=R!=null&&R.ual?Sn(R.ual):null,A=R!=null&&R.tx?Sn(R.tx):null,U=R!=null&&R.block?Sn(R.block):null,G=R!=null&&R.kaId?Sn(R.kaId):null,M=R!=null&&R.finalizedAt?Sn(R.finalizedAt):null;s({status:A?"verified":"offchain",ual:H||null,txHash:A||null,blockNumber:U||null,kaId:G||null,author:T,finalizedAt:M||null,agent:S})}catch(g){if(u!==c.current)return;s({...Bi,status:"error",error:(g==null?void 0:g.message)??String(g)})}})()},[e,t,n]),r}const xz=({contextGraphId:e,entityUri:t,enabled:n})=>{const r=ns(),s=fz(e,t,n),c=bz(e,t,n),{data:u}=Ea(Xm,[],6e4),d=u==null?void 0:u.blockExplorerUrl,f=c.ual??s.ual,h=c.status==="verified";if(!n||s.loading||!s.ual&&!s.owner&&!s.publishedAt&&!h)return null;const g=s.publishedAt?wz(s.publishedAt):null,m=s.publisherPeerId&&r?e1(s.publisherPeerId,r.agents):null,y=m?(r==null?void 0:r.get(m))??null:null,b=s.owner&&r?e1(s.owner,r.agents):null,k=b?(r==null?void 0:r.get(b))??null:null,j=E=>{var S;(S=navigator.clipboard)==null||S.writeText(E).catch(()=>{})};return o.jsxs("div",{className:"v10-vm-identity",children:[o.jsxs("div",{className:"v10-vm-identity-head",children:[o.jsx("span",{className:"v10-vm-identity-glyph",children:"◉"}),o.jsx("span",{className:"v10-vm-identity-title",children:"On-chain identity"}),o.jsx("span",{className:"v10-vm-identity-badge",children:"VERIFIED"})]}),f&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"UAL"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:f,children:f}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(f),title:"Copy UAL",children:"⎘"})]}),h&&c.txHash&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Tx"}),d?o.jsxs("a",{className:"v10-vm-identity-val mono",href:`${d}/tx/${c.txHash}`,target:"_blank",rel:"noopener noreferrer",title:c.txHash,children:[Fs(c.txHash,10,8)," ↗"]}):o.jsx("span",{className:"v10-vm-identity-val mono",title:c.txHash,children:Fs(c.txHash,10,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(c.txHash),title:"Copy transaction hash",children:"⎘"}),c.blockNumber&&o.jsxs("span",{className:"v10-vm-identity-opid mono",children:["· block ",c.blockNumber]})]}),h&&c.kaId&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"KA id"}),o.jsx("span",{className:"v10-vm-identity-val mono",title:c.kaId,children:Fs(c.kaId,8,8)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(c.kaId),title:"Copy KA id",children:"⎘"})]}),(k||s.owner)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Owner"}),k?o.jsxs("span",{className:"v10-vm-identity-val",children:[o.jsx(Yi,{agent:k,size:"sm"}),k.walletAddress&&o.jsx("span",{className:"v10-vm-identity-wallet mono",title:k.walletAddress,children:Fs(k.walletAddress,6,4)})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"v10-vm-identity-val mono",title:s.owner??"",children:Fs(s.owner,8,6)}),o.jsx("button",{type:"button",className:"v10-vm-identity-copy",onClick:()=>j(s.owner),title:"Copy owner id",children:"⎘"})]})]}),g&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"Published"}),o.jsx("span",{className:"v10-vm-identity-val",title:s.publishedAt??"",children:g}),s.opId&&o.jsxs("span",{className:"v10-vm-identity-opid mono",title:`Anchor op: ${s.opId}`,children:["· anchor ",s.opId.slice(0,10)]})]}),(y||s.publisherPeerId)&&o.jsxs("div",{className:"v10-vm-identity-row",children:[o.jsx("span",{className:"v10-vm-identity-lbl",children:"By"}),y?o.jsx(Yi,{agent:y,size:"sm"}):o.jsx("span",{className:"v10-vm-identity-val mono",title:s.publisherPeerId??"",children:Fs(s.publisherPeerId,8,6)})]})]})};function wz(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 ve(e,t,n){function r(d,f){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,f);for(const g in u.prototype)g in d||Object.defineProperty(d,g,{value:u.prototype[g].bind(d)});d._zod.constr=u,d._zod.def=f}const s=(n==null?void 0:n.Parent)??Object;class c extends s{}Object.defineProperty(c,"name",{value:e});function u(d){var f;const h=n!=null&&n.Parent?new c:this;r(h,d),(f=h._zod).deferred??(f.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:d=>{var f,h;return n!=null&&n.Parent&&d instanceof n.Parent?!0:(h=(f=d==null?void 0:d._zod)==null?void 0:f.traits)==null?void 0:h.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class Rl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const DS={};function Qi(e){return DS}function $S(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,s])=>t.indexOf(+r)===-1).map(([r,s])=>s)}function kz(e,t){return typeof t=="bigint"?t.toString():t}function IS(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ng(e){return e==null}function Eg(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Sz(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,c=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return c%u/10**s}function Pt(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 Tg(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dl(e){return JSON.stringify(e)}const PS=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function pm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const jz=IS(()=>{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 fm(e){if(pm(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(pm(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const Cz=new Set(["string","number","symbol"]);function Td(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function as(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 Ue(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 Nz(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ez={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 Tz(e,t){const n={},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(n[s]=r.shape[s])}return as(e,{...e._zod.def,shape:n,checks:[]})}function Az(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete n[s]}return as(e,{...e._zod.def,shape:n,checks:[]})}function Rz(e,t){if(!fm(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 Tg(this,"shape",r),r},checks:[]};return as(e,n)}function _z(e,t){return as(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Tg(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Oz(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const c in n){if(!(c in r))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=e?new e({type:"optional",innerType:r[c]}):r[c])}else for(const c in r)s[c]=e?new e({type:"optional",innerType:r[c]}):r[c];return as(t,{...t._zod.def,shape:s,checks:[]})}function Lz(e,t,n){const r=t._zod.def.shape,s={...r};if(n)for(const c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=new e({type:"nonoptional",innerType:r[c]}))}else for(const c in r)s[c]=new e({type:"nonoptional",innerType:r[c]});return as(t,{...t._zod.def,shape:s,checks:[]})}function Sl(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 Ag(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function fu(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ki(e,t,n){var s,c,u,d,f,h;const r={...e,path:e.path??[]};if(!e.message){const g=fu((u=(c=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:c.error)==null?void 0:u.call(c,e))??fu((d=t==null?void 0:t.error)==null?void 0:d.call(t,e))??fu((f=n.customError)==null?void 0:f.call(n,e))??fu((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 Rg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _l(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const US=(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,kz,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},BS=ve("$ZodError",US),FS=ve("$ZodError",US,{Parent:Error});function zz(e,t=n=>n.message){const n={},r=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}function Mz(e,t){const n=t||function(c){return c.message},r={_errors:[]},s=c=>{for(const u of c.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>s({issues:d}));else if(u.code==="invalid_key")s({issues:u.issues});else if(u.code==="invalid_element")s({issues:u.issues});else if(u.path.length===0)r._errors.push(n(u));else{let d=r,f=0;for(;f<u.path.length;){const h=u.path[f];f===u.path.length-1?(d[h]=d[h]||{_errors:[]},d[h]._errors.push(n(u))):d[h]=d[h]||{_errors:[]},d=d[h],f++}}};return s(e),r}const Dz=e=>(t,n,r,s)=>{const c=r?Object.assign(r,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new Rl;if(u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>Ki(f,c,Qi())));throw PS(d,s==null?void 0:s.callee),d}return u.value},$z=e=>async(t,n,r,s)=>{const c=r?Object.assign(r,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new((s==null?void 0:s.Err)??e)(u.issues.map(f=>Ki(f,c,Qi())));throw PS(d,s==null?void 0:s.callee),d}return u.value},HS=e=>(t,n,r)=>{const s=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new Rl;return c.issues.length?{success:!1,error:new(e??BS)(c.issues.map(u=>Ki(u,s,Qi())))}:{success:!0,data:c.value}},Iz=HS(FS),qS=e=>async(t,n,r)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Ki(u,s,Qi())))}:{success:!0,data:c.value}},Pz=qS(FS),Uz=/^[cC][^\s-]{8,}$/,Bz=/^[0-9a-z]+$/,Fz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hz=/^[0-9a-vA-V]{20}$/,qz=/^[A-Za-z0-9]{27}$/,Gz=/^[a-zA-Z0-9_-]{21}$/,Vz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wz=/^([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})$/,n1=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)$/,Zz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qz(){return new RegExp(Yz,"u")}const Kz=/^(?:(?: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])$/,Xz=/^(([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})$/,Jz=/^((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])$/,eM=/^(([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])$/,tM=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,GS=/^[A-Za-z0-9_-]*$/,nM=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,aM=/^\+(?:[0-9]){6,14}[0-9]$/,VS="(?:(?:\\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])))",rM=new RegExp(`^${VS}$`);function WS(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 iM(e){return new RegExp(`^${WS(e)}$`)}function sM(e){const t=WS({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(`^${VS}T(?:${r})$`)}const oM=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}$`)},lM=/^\d+$/,cM=/^-?\d+(?:\.\d+)?/i,uM=/^[^A-Z]*$/,dM=/^[^a-z]*$/,Gn=ve("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ZS={number:"number",bigint:"bigint",object:"date"},YS=ve("$ZodCheckLessThan",(e,t)=>{Gn.init(e,t);const n=ZS[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,c=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?s.maximum=t.value:s.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})}}),QS=ve("$ZodCheckGreaterThan",(e,t)=>{Gn.init(e,t);const n=ZS[typeof t.value];e._zod.onattach.push(r=>{const s=r._zod.bag,c=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?s.minimum=t.value:s.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})}}),pM=ve("$ZodCheckMultipleOf",(e,t)=>{Gn.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):Sz(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})}}),fM=ve("$ZodCheckNumberFormat",(e,t)=>{var u;Gn.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),r=n?"int":"number",[s,c]=Ez[t.format];e._zod.onattach.push(d=>{const f=d._zod.bag;f.format=t.format,f.minimum=s,f.maximum=c,n&&(f.pattern=lM)}),e._zod.check=d=>{const f=d.value;if(n){if(!Number.isInteger(f)){d.issues.push({expected:r,format:t.format,code:"invalid_type",input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?d.issues.push({input:f,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:f,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}}f<s&&d.issues.push({origin:"number",input:f,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),f>c&&d.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inst:e})}}),hM=ve("$ZodCheckMaxLength",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Ng(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const s=r.value;if(s.length<=t.maximum)return;const u=Rg(s);r.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),mM=ve("$ZodCheckMinLength",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Ng(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const s=r.value;if(s.length>=t.minimum)return;const u=Rg(s);r.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),gM=ve("$ZodCheckLengthEquals",(e,t)=>{var n;Gn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const s=r.value;return!Ng(s)&&s.length!==void 0}),e._zod.onattach.push(r=>{const s=r._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=r=>{const s=r.value,c=s.length;if(c===t.length)return;const u=Rg(s),d=c>t.length;r.issues.push({origin:u,...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})}}),Ad=ve("$ZodCheckStringFormat",(e,t)=>{var n,r;Gn.init(e,t),e._zod.onattach.push(s=>{const c=s._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),vM=ve("$ZodCheckRegex",(e,t)=>{Ad.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})}}),yM=ve("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uM),Ad.init(e,t)}),bM=ve("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dM),Ad.init(e,t)}),xM=ve("$ZodCheckIncludes",(e,t)=>{Gn.init(e,t);const n=Td(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(s=>{const c=s._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(r)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),wM=ve("$ZodCheckStartsWith",(e,t)=>{Gn.init(e,t);const n=new RegExp(`^${Td(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),kM=ve("$ZodCheckEndsWith",(e,t)=>{Gn.init(e,t);const n=new RegExp(`.*${Td(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const s=r._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),SM=ve("$ZodCheckOverwrite",(e,t)=>{Gn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class jM{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(`
|
|
1403
|
-
`).filter(u=>u),s=Math.min(...r.map(u=>u.length-u.trimStart().length)),c=r.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(c=>` ${c}`)];return new t(...n,s.join(`
|
|
1404
|
-
`))}}const CM={major:4,minor:0,patch:0},Xt=ve("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=CM;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const c of r)for(const u of c._zod.onattach)u(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const c=(u,d,f)=>{let h=Sl(u),g;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const y=u.issues.length,b=m._zod.check(u);if(b instanceof Promise&&(f==null?void 0:f.async)===!1)throw new Rl;if(g||b instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await b,u.issues.length!==y&&(h||(h=Sl(u,y)))});else{if(u.issues.length===y)continue;h||(h=Sl(u,y))}}return g?g.then(()=>u):u};e._zod.run=(u,d)=>{const f=e._zod.parse(u,d);if(f instanceof Promise){if(d.async===!1)throw new Rl;return f.then(h=>c(h,r,d))}return c(f,r,d)}}e["~standard"]={validate:c=>{var u;try{const d=Iz(e,c);return d.success?{value:d.data}:{issues:(u=d.error)==null?void 0:u.issues}}catch{return Pz(e,c).then(f=>{var h;return f.success?{value:f.data}:{issues:(h=f.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}}),_g=ve("$ZodString",(e,t)=>{var n;Xt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??oM(e._zod.bag),e._zod.parse=(r,s)=>{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}}),Bt=ve("$ZodStringFormat",(e,t)=>{Ad.init(e,t),_g.init(e,t)}),NM=ve("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wz),Bt.init(e,t)}),EM=ve("$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=n1(r))}else t.pattern??(t.pattern=n1());Bt.init(e,t)}),TM=ve("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zz),Bt.init(e,t)}),AM=ve("$ZodURL",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{try{const r=n.value,s=new URL(r),c=s.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:nM.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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("/")&&c.endsWith("/")?n.value=c.slice(0,-1):n.value=c;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),RM=ve("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qz()),Bt.init(e,t)}),_M=ve("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Gz),Bt.init(e,t)}),OM=ve("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Uz),Bt.init(e,t)}),LM=ve("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Bz),Bt.init(e,t)}),zM=ve("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Fz),Bt.init(e,t)}),MM=ve("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Hz),Bt.init(e,t)}),DM=ve("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=qz),Bt.init(e,t)}),$M=ve("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=sM(t)),Bt.init(e,t)}),IM=ve("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rM),Bt.init(e,t)}),PM=ve("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=iM(t)),Bt.init(e,t)}),UM=ve("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vz),Bt.init(e,t)}),BM=ve("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Kz),Bt.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),FM=ve("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xz),Bt.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})}}}),HM=ve("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Jz),Bt.init(e,t)}),qM=ve("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=eM),Bt.init(e,t),e._zod.check=n=>{const[r,s]=n.value.split("/");try{if(!s)throw new Error;const c=Number(s);if(`${c}`!==s)throw new Error;if(c<0||c>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 KS(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const GM=ve("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tM),Bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{KS(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function VM(e){if(!GS.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return KS(n)}const WM=ve("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=GS),Bt.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{VM(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ZM=ve("$ZodE164",(e,t)=>{t.pattern??(t.pattern=aM),Bt.init(e,t)});function YM(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const s=JSON.parse(atob(r));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const QM=ve("$ZodJWT",(e,t)=>{Bt.init(e,t),e._zod.check=n=>{YM(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),XS=ve("$ZodNumber",(e,t)=>{Xt.init(e,t),e._zod.pattern=e._zod.bag.pattern??cM,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const c=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...c?{received:c}:{}}),n}}),KM=ve("$ZodNumber",(e,t)=>{fM.init(e,t),XS.init(e,t)}),XM=ve("$ZodUnknown",(e,t)=>{Xt.init(e,t),e._zod.parse=n=>n}),JM=ve("$ZodNever",(e,t)=>{Xt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function a1(e,t,n){e.issues.length&&t.issues.push(...Ag(n,e.issues)),t.value[n]=e.value}const eD=ve("$ZodArray",(e,t)=>{Xt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const c=[];for(let u=0;u<s.length;u++){const d=s[u],f=t.element._zod.run({value:d,issues:[]},r);f instanceof Promise?c.push(f.then(h=>a1(h,n,u))):a1(f,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function hu(e,t,n){e.issues.length&&t.issues.push(...Ag(n,e.issues)),t.value[n]=e.value}function r1(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(...Ag(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const tD=ve("$ZodObject",(e,t)=>{Xt.init(e,t);const n=IS(()=>{const m=Object.keys(t.shape);for(const b of m)if(!(t.shape[b]instanceof Xt))throw new Error(`Invalid element at key "${b}": expected a Zod schema`);const y=Nz(t.shape);return{shape:t.shape,keys:m,keySet:new Set(m),numKeys:m.length,optionalKeys:new Set(y)}});Pt(e._zod,"propValues",()=>{const m=t.shape,y={};for(const b in m){const k=m[b]._zod;if(k.values){y[b]??(y[b]=new Set);for(const j of k.values)y[b].add(j)}}return y});const r=m=>{const y=new jM(["shape","payload","ctx"]),b=n.value,k=T=>{const N=dl(T);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};y.write("const input = payload.value;");const j=Object.create(null);let E=0;for(const T of b.keys)j[T]=`key_${E++}`;y.write("const newResult = {}");for(const T of b.keys)if(b.optionalKeys.has(T)){const N=j[T];y.write(`const ${N} = ${k(T)};`);const R=dl(T);y.write(`
|
|
1405
|
-
if (${N}.issues.length) {
|
|
1406
|
-
if (input[${R}] === undefined) {
|
|
1407
|
-
if (${R} in input) {
|
|
1408
|
-
newResult[${R}] = undefined;
|
|
1409
|
-
}
|
|
1410
|
-
} else {
|
|
1411
|
-
payload.issues = payload.issues.concat(
|
|
1412
|
-
${N}.issues.map((iss) => ({
|
|
1413
|
-
...iss,
|
|
1414
|
-
path: iss.path ? [${R}, ...iss.path] : [${R}],
|
|
1415
|
-
}))
|
|
1416
|
-
);
|
|
1417
|
-
}
|
|
1418
|
-
} else if (${N}.value === undefined) {
|
|
1419
|
-
if (${R} in input) newResult[${R}] = undefined;
|
|
1420
|
-
} else {
|
|
1421
|
-
newResult[${R}] = ${N}.value;
|
|
1422
|
-
}
|
|
1423
|
-
`)}else{const N=j[T];y.write(`const ${N} = ${k(T)};`),y.write(`
|
|
1424
|
-
if (${N}.issues.length) payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
|
|
1425
|
-
...iss,
|
|
1426
|
-
path: iss.path ? [${dl(T)}, ...iss.path] : [${dl(T)}]
|
|
1427
|
-
})));`),y.write(`newResult[${dl(T)}] = ${N}.value`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(T,N)=>S(m,T,N)};let s;const c=pm,u=!DS.jitless,f=u&&jz.value,h=t.catchall;let g;e._zod.parse=(m,y)=>{g??(g=n.value);const b=m.value;if(!c(b))return m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m;const k=[];if(u&&f&&(y==null?void 0:y.async)===!1&&y.jitless!==!0)s||(s=r(t.shape)),m=s(m,y);else{m.value={};const N=g.shape;for(const R of g.keys){const H=N[R],A=H._zod.run({value:b[R],issues:[]},y),U=H._zod.optin==="optional"&&H._zod.optout==="optional";A instanceof Promise?k.push(A.then(G=>U?r1(G,m,R,b):hu(G,m,R))):U?r1(A,m,R,b):hu(A,m,R)}}if(!h)return k.length?Promise.all(k).then(()=>m):m;const j=[],E=g.keySet,S=h._zod,T=S.def.type;for(const N of Object.keys(b)){if(E.has(N))continue;if(T==="never"){j.push(N);continue}const R=S.run({value:b[N],issues:[]},y);R instanceof Promise?k.push(R.then(H=>hu(H,m,N))):hu(R,m,N)}return j.length&&m.issues.push({code:"unrecognized_keys",keys:j,input:b,inst:e}),k.length?Promise.all(k).then(()=>m):m}});function i1(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(c=>Ki(c,r,Qi())))}),t}const nD=ve("$ZodUnion",(e,t)=>{Xt.init(e,t),Pt(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Pt(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Pt(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Pt(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=>Eg(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let s=!1;const c=[];for(const u of t.options){const d=u._zod.run({value:n.value,issues:[]},r);if(d instanceof Promise)c.push(d),s=!0;else{if(d.issues.length===0)return d;c.push(d)}}return s?Promise.all(c).then(u=>i1(u,n,e,r)):i1(c,n,e,r)}}),aD=ve("$ZodIntersection",(e,t)=>{Xt.init(e,t),e._zod.parse=(n,r)=>{const s=n.value,c=t.left._zod.run({value:s,issues:[]},r),u=t.right._zod.run({value:s,issues:[]},r);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([f,h])=>s1(n,f,h)):s1(n,c,u)}});function hm(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(fm(e)&&fm(t)){const n=Object.keys(t),r=Object.keys(e).filter(c=>n.indexOf(c)!==-1),s={...e,...t};for(const c of r){const u=hm(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};s[c]=u.data}return{valid:!0,data:s}}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 s=e[r],c=t[r],u=hm(s,c);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function s1(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Sl(e))return e;const r=hm(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 rD=ve("$ZodEnum",(e,t)=>{Xt.init(e,t);const n=$S(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>Cz.has(typeof r)).map(r=>typeof r=="string"?Td(r):r.toString()).join("|")})$`),e._zod.parse=(r,s)=>{const c=r.value;return e._zod.values.has(c)||r.issues.push({code:"invalid_value",values:n,input:c,inst:e}),r}}),iD=ve("$ZodTransform",(e,t)=>{Xt.init(e,t),e._zod.parse=(n,r)=>{const s=t.transform(n.value,n);if(r.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new Rl;return n.value=s,n}}),sD=ve("$ZodOptional",(e,t)=>{Xt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Eg(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)}),oD=ve("$ZodNullable",(e,t)=>{Xt.init(e,t),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Eg(n.source)}|null)$`):void 0}),Pt(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)}),lD=ve("$ZodDefault",(e,t)=>{Xt.init(e,t),e._zod.optin="optional",Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>o1(c,t)):o1(s,t)}});function o1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const cD=ve("$ZodPrefault",(e,t)=>{Xt.init(e,t),e._zod.optin="optional",Pt(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))}),uD=ve("$ZodNonOptional",(e,t)=>{Xt.init(e,t),Pt(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 s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>l1(c,e)):l1(s,e)}});function l1(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 dD=ve("$ZodCatch",(e,t)=>{Xt.init(e,t),e._zod.optin="optional",Pt(e._zod,"optout",()=>t.innerType._zod.optout),Pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(c=>(n.value=c.value,c.issues.length&&(n.value=t.catchValue({...n,error:{issues:c.issues.map(u=>Ki(u,r,Qi()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Ki(c,r,Qi()))},input:n.value}),n.issues=[]),n)}}),pD=ve("$ZodPipe",(e,t)=>{Xt.init(e,t),Pt(e._zod,"values",()=>t.in._zod.values),Pt(e._zod,"optin",()=>t.in._zod.optin),Pt(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const s=t.in._zod.run(n,r);return s instanceof Promise?s.then(c=>c1(c,t,r)):c1(s,t,r)}});function c1(e,t,n){return Sl(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const fD=ve("$ZodReadonly",(e,t)=>{Xt.init(e,t),Pt(e._zod,"propValues",()=>t.innerType._zod.propValues),Pt(e._zod,"values",()=>t.innerType._zod.values),Pt(e._zod,"optin",()=>t.innerType._zod.optin),Pt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(u1):u1(s)}});function u1(e){return e.value=Object.freeze(e.value),e}const hD=ve("$ZodCustom",(e,t)=>{Gn.init(e,t),Xt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,s=t.fn(r);if(s instanceof Promise)return s.then(c=>d1(c,n,r,e));d1(s,n,r,e)}});function d1(e,t,n,r){if(!e){const s={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(s.params=r._zod.def.params),t.issues.push(_l(s))}}class JS{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 ej(){return new JS}const wl=ej();function mD(e,t){return new e({type:"string",...Ue(t)})}function gD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function p1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function vD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function yD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function bD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function xD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function wD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function kD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function SD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function jD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function CD(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function ND(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function ED(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function TD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function AD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function RD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function _D(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function OD(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function LD(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function zD(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function MD(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function DD(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function $D(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function ID(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function PD(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function UD(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function BD(e,t){return new e({type:"number",checks:[],...Ue(t)})}function FD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function HD(e){return new e({type:"unknown"})}function qD(e,t){return new e({type:"never",...Ue(t)})}function f1(e,t){return new YS({check:"less_than",...Ue(t),value:e,inclusive:!1})}function mh(e,t){return new YS({check:"less_than",...Ue(t),value:e,inclusive:!0})}function h1(e,t){return new QS({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function gh(e,t){return new QS({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function m1(e,t){return new pM({check:"multiple_of",...Ue(t),value:e})}function tj(e,t){return new hM({check:"max_length",...Ue(t),maximum:e})}function ed(e,t){return new mM({check:"min_length",...Ue(t),minimum:e})}function nj(e,t){return new gM({check:"length_equals",...Ue(t),length:e})}function GD(e,t){return new vM({check:"string_format",format:"regex",...Ue(t),pattern:e})}function VD(e){return new yM({check:"string_format",format:"lowercase",...Ue(e)})}function WD(e){return new bM({check:"string_format",format:"uppercase",...Ue(e)})}function ZD(e,t){return new xM({check:"string_format",format:"includes",...Ue(t),includes:e})}function YD(e,t){return new wM({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function QD(e,t){return new kM({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function Fl(e){return new SM({check:"overwrite",tx:e})}function KD(e){return Fl(t=>t.normalize(e))}function XD(){return Fl(e=>e.trim())}function JD(){return Fl(e=>e.toLowerCase())}function e3(){return Fl(e=>e.toUpperCase())}function t3(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function n3(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}class g1{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,y,b;var r;const s=t._zod.def,c={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},u=this.seen.get(t);if(u)return u.count++,n.schemaPath.includes(t)&&(u.cycle=n.path),u.schema;const d={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,d);const f=(y=(m=t._zod).toJSONSchema)==null?void 0:y.call(m);if(f)d.schema=f;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 E=d.schema;switch(s.type){case"string":{const S=E;S.type="string";const{minimum:T,maximum:N,format:R,patterns:H,contentEncoding:A}=t._zod.bag;if(typeof T=="number"&&(S.minLength=T),typeof N=="number"&&(S.maxLength=N),R&&(S.format=c[R]??R,S.format===""&&delete S.format),A&&(S.contentEncoding=A),H&&H.size>0){const U=[...H];U.length===1?S.pattern=U[0].source:U.length>1&&(d.schema.allOf=[...U.map(G=>({...this.target==="draft-7"?{type:"string"}:{},pattern:G.source}))])}break}case"number":{const S=E,{minimum:T,maximum:N,format:R,multipleOf:H,exclusiveMaximum:A,exclusiveMinimum:U}=t._zod.bag;typeof R=="string"&&R.includes("int")?S.type="integer":S.type="number",typeof U=="number"&&(S.exclusiveMinimum=U),typeof T=="number"&&(S.minimum=T,typeof U=="number"&&(U>=T?delete S.minimum:delete S.exclusiveMinimum)),typeof A=="number"&&(S.exclusiveMaximum=A),typeof N=="number"&&(S.maximum=N,typeof A=="number"&&(A<=N?delete S.maximum:delete S.exclusiveMaximum)),typeof H=="number"&&(S.multipleOf=H);break}case"boolean":{const S=E;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":{E.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":{E.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const S=E,{minimum:T,maximum:N}=t._zod.bag;typeof T=="number"&&(S.minItems=T),typeof N=="number"&&(S.maxItems=N),S.type="array",S.items=this.process(s.element,{...k,path:[...k.path,"items"]});break}case"object":{const S=E;S.type="object",S.properties={};const T=s.shape;for(const H in T)S.properties[H]=this.process(T[H],{...k,path:[...k.path,"properties",H]});const N=new Set(Object.keys(T)),R=new Set([...N].filter(H=>{const A=s.shape[H]._zod;return this.io==="input"?A.optin===void 0:A.optout===void 0}));R.size>0&&(S.required=Array.from(R)),((b=s.catchall)==null?void 0:b._zod.def.type)==="never"?S.additionalProperties=!1:s.catchall?s.catchall&&(S.additionalProperties=this.process(s.catchall,{...k,path:[...k.path,"additionalProperties"]})):this.io==="output"&&(S.additionalProperties=!1);break}case"union":{const S=E;S.anyOf=s.options.map((T,N)=>this.process(T,{...k,path:[...k.path,"anyOf",N]}));break}case"intersection":{const S=E,T=this.process(s.left,{...k,path:[...k.path,"allOf",0]}),N=this.process(s.right,{...k,path:[...k.path,"allOf",1]}),R=A=>"allOf"in A&&Object.keys(A).length===1,H=[...R(T)?T.allOf:[T],...R(N)?N.allOf:[N]];S.allOf=H;break}case"tuple":{const S=E;S.type="array";const T=s.items.map((H,A)=>this.process(H,{...k,path:[...k.path,"prefixItems",A]}));if(this.target==="draft-2020-12"?S.prefixItems=T:S.items=T,s.rest){const H=this.process(s.rest,{...k,path:[...k.path,"items"]});this.target==="draft-2020-12"?S.items=H:S.additionalItems=H}s.rest&&(S.items=this.process(s.rest,{...k,path:[...k.path,"items"]}));const{minimum:N,maximum:R}=t._zod.bag;typeof N=="number"&&(S.minItems=N),typeof R=="number"&&(S.maxItems=R);break}case"record":{const S=E;S.type="object",S.propertyNames=this.process(s.keyType,{...k,path:[...k.path,"propertyNames"]}),S.additionalProperties=this.process(s.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=E,T=$S(s.entries);T.every(N=>typeof N=="number")&&(S.type="number"),T.every(N=>typeof N=="string")&&(S.type="string"),S.enum=T;break}case"literal":{const S=E,T=[];for(const N of s.values)if(N===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof N=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");T.push(Number(N))}else T.push(N);if(T.length!==0)if(T.length===1){const N=T[0];S.type=N===null?"null":typeof N,S.const=N}else T.every(N=>typeof N=="number")&&(S.type="number"),T.every(N=>typeof N=="string")&&(S.type="string"),T.every(N=>typeof N=="boolean")&&(S.type="string"),T.every(N=>N===null)&&(S.type="null"),S.enum=T;break}case"file":{const S=E,T={type:"string",format:"binary",contentEncoding:"binary"},{minimum:N,maximum:R,mime:H}=t._zod.bag;N!==void 0&&(T.minLength=N),R!==void 0&&(T.maxLength=R),H?H.length===1?(T.contentMediaType=H[0],Object.assign(S,T)):S.anyOf=H.map(A=>({...T,contentMediaType:A})):Object.assign(S,T);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const S=this.process(s.innerType,k);E.anyOf=[S,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,k),d.ref=s.innerType;break}case"success":{const S=E;S.type="boolean";break}case"default":{this.process(s.innerType,k),d.ref=s.innerType,E.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,k),d.ref=s.innerType,this.io==="input"&&(E._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,k),d.ref=s.innerType;let S;try{S=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}E.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=E,T=t._zod.pattern;if(!T)throw new Error("Pattern not found in template literal");S.type="string",S.pattern=T.source;break}case"pipe":{const S=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(S,k),d.ref=S;break}case"readonly":{this.process(s.innerType,k),d.ref=s.innerType,E.readOnly=!0;break}case"promise":{this.process(s.innerType,k),d.ref=s.innerType;break}case"optional":{this.process(s.innerType,k),d.ref=s.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"&&un(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,y,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},s=this.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const c=E=>{var H;const S=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const A=(H=r.external.registry.get(E[0]))==null?void 0:H.id,U=r.external.uri??(M=>M);if(A)return{ref:U(A)};const G=E[1].defId??E[1].schema.id??`schema${this.counter++}`;return E[1].defId=G,{defId:G,ref:`${U("__shared")}#/${S}/${G}`}}if(E[1]===s)return{ref:"#"};const N=`#/${S}/`,R=E[1].schema.id??`__schema${this.counter++}`;return{defId:R,ref:N+R}},u=E=>{if(E[1].schema.$ref)return;const S=E[1],{ref:T,defId:N}=c(E);S.def={...S.schema},N&&(S.defId=N);const R=S.schema;for(const H in R)delete R[H];R.$ref=T};if(r.cycles==="throw")for(const E of this.seen.entries()){const S=E[1];if(S.cycle)throw new Error(`Cycle detected: #/${(g=S.cycle)==null?void 0:g.join("/")}/<root>
|
|
1428
|
-
|
|
1429
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const E of this.seen.entries()){const S=E[1];if(t===E[0]){u(E);continue}if(r.external){const N=(m=r.external.registry.get(E[0]))==null?void 0:m.id;if(t!==E[0]&&N){u(E);continue}}if((y=this.metadataRegistry.get(E[0]))==null?void 0:y.id){u(E);continue}if(S.cycle){u(E);continue}if(S.count>1&&r.reused==="ref"){u(E);continue}}const d=(E,S)=>{const T=this.seen.get(E),N=T.def??T.schema,R={...N};if(T.ref===null)return;const H=T.ref;if(T.ref=null,H){d(H,S);const A=this.seen.get(H).schema;A.$ref&&S.target==="draft-7"?(N.allOf=N.allOf??[],N.allOf.push(A)):(Object.assign(N,A),Object.assign(N,R))}T.isParent||this.override({zodSchema:E,jsonSchema:N,path:T.path??[]})};for(const E of[...this.seen.entries()].reverse())d(E[0],{target:this.target});const f={};if(this.target==="draft-2020-12"?f.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?f.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(b=r.external)!=null&&b.uri){const E=(k=r.external.registry.get(t))==null?void 0:k.id;if(!E)throw new Error("Schema is missing an `id` property");f.$id=r.external.uri(E)}Object.assign(f,s.def);const h=((j=r.external)==null?void 0:j.defs)??{};for(const E of this.seen.entries()){const S=E[1];S.def&&S.defId&&(h[S.defId]=S.def)}r.external||Object.keys(h).length>0&&(this.target==="draft-2020-12"?f.$defs=h:f.definitions=h);try{return JSON.parse(JSON.stringify(f))}catch{throw new Error("Error converting schema to JSON.")}}}function a3(e,t){if(e instanceof JS){const r=new g1(t),s={};for(const d of e._idmap.entries()){const[f,h]=d;r.process(h)}const c={},u={registry:e,uri:t==null?void 0:t.uri,defs:s};for(const d of e._idmap.entries()){const[f,h]=d;c[f]=r.emit(h,{...t,external:u})}if(Object.keys(s).length>0){const d=r.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[d]:s}}return{schemas:c}}const n=new g1(t);return n.process(e),n.emit(e,t)}function un(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;switch(s.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 un(s.element,n);case"object":{for(const c in s.shape)if(un(s.shape[c],n))return!0;return!1}case"union":{for(const c of s.options)if(un(c,n))return!0;return!1}case"intersection":return un(s.left,n)||un(s.right,n);case"tuple":{for(const c of s.items)if(un(c,n))return!0;return!!(s.rest&&un(s.rest,n))}case"record":return un(s.keyType,n)||un(s.valueType,n);case"map":return un(s.keyType,n)||un(s.valueType,n);case"set":return un(s.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return un(s.innerType,n);case"lazy":return un(s.getter(),n);case"default":return un(s.innerType,n);case"prefault":return un(s.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return un(s.in,n)||un(s.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${s.type}`)}const r3=ve("ZodISODateTime",(e,t)=>{$M.init(e,t),qt.init(e,t)});function i3(e){return $D(r3,e)}const s3=ve("ZodISODate",(e,t)=>{IM.init(e,t),qt.init(e,t)});function o3(e){return ID(s3,e)}const l3=ve("ZodISOTime",(e,t)=>{PM.init(e,t),qt.init(e,t)});function c3(e){return PD(l3,e)}const u3=ve("ZodISODuration",(e,t)=>{UM.init(e,t),qt.init(e,t)});function d3(e){return UD(u3,e)}const p3=(e,t)=>{BS.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Mz(e,n)},flatten:{value:n=>zz(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Rd=ve("ZodError",p3,{Parent:Error}),f3=Dz(Rd),h3=$z(Rd),m3=HS(Rd),g3=qS(Rd),pn=ve("ZodType",(e,t)=>(Xt.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)=>as(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>f3(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>m3(e,n,r),e.parseAsync=async(n,r)=>h3(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>g3(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(i$(n,r)),e.superRefine=n=>e.check(s$(n)),e.overwrite=n=>e.check(Fl(n)),e.optional=()=>x1(e),e.nullable=()=>w1(e),e.nullish=()=>x1(w1(e)),e.nonoptional=n=>K3(e,n),e.array=()=>Dr(e),e.or=n=>Og([e,n]),e.and=n=>H3(e,n),e.transform=n=>k1(e,G3(n)),e.default=n=>Z3(e,n),e.prefault=n=>Q3(e,n),e.catch=n=>J3(e,n),e.pipe=n=>k1(e,n),e.readonly=()=>n$(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)),aj=ve("_ZodString",(e,t)=>{_g.init(e,t),pn.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(GD(...r)),e.includes=(...r)=>e.check(ZD(...r)),e.startsWith=(...r)=>e.check(YD(...r)),e.endsWith=(...r)=>e.check(QD(...r)),e.min=(...r)=>e.check(ed(...r)),e.max=(...r)=>e.check(tj(...r)),e.length=(...r)=>e.check(nj(...r)),e.nonempty=(...r)=>e.check(ed(1,...r)),e.lowercase=r=>e.check(VD(r)),e.uppercase=r=>e.check(WD(r)),e.trim=()=>e.check(XD()),e.normalize=(...r)=>e.check(KD(...r)),e.toLowerCase=()=>e.check(JD()),e.toUpperCase=()=>e.check(e3())}),v3=ve("ZodString",(e,t)=>{_g.init(e,t),aj.init(e,t),e.email=n=>e.check(gD(y3,n)),e.url=n=>e.check(wD(b3,n)),e.jwt=n=>e.check(DD(z3,n)),e.emoji=n=>e.check(kD(x3,n)),e.guid=n=>e.check(p1(v1,n)),e.uuid=n=>e.check(vD(mu,n)),e.uuidv4=n=>e.check(yD(mu,n)),e.uuidv6=n=>e.check(bD(mu,n)),e.uuidv7=n=>e.check(xD(mu,n)),e.nanoid=n=>e.check(SD(w3,n)),e.guid=n=>e.check(p1(v1,n)),e.cuid=n=>e.check(jD(k3,n)),e.cuid2=n=>e.check(CD(S3,n)),e.ulid=n=>e.check(ND(j3,n)),e.base64=n=>e.check(LD(_3,n)),e.base64url=n=>e.check(zD(O3,n)),e.xid=n=>e.check(ED(C3,n)),e.ksuid=n=>e.check(TD(N3,n)),e.ipv4=n=>e.check(AD(E3,n)),e.ipv6=n=>e.check(RD(T3,n)),e.cidrv4=n=>e.check(_D(A3,n)),e.cidrv6=n=>e.check(OD(R3,n)),e.e164=n=>e.check(MD(L3,n)),e.datetime=n=>e.check(i3(n)),e.date=n=>e.check(o3(n)),e.time=n=>e.check(c3(n)),e.duration=n=>e.check(d3(n))});function $e(e){return mD(v3,e)}const qt=ve("ZodStringFormat",(e,t)=>{Bt.init(e,t),aj.init(e,t)}),y3=ve("ZodEmail",(e,t)=>{TM.init(e,t),qt.init(e,t)}),v1=ve("ZodGUID",(e,t)=>{NM.init(e,t),qt.init(e,t)}),mu=ve("ZodUUID",(e,t)=>{EM.init(e,t),qt.init(e,t)}),b3=ve("ZodURL",(e,t)=>{AM.init(e,t),qt.init(e,t)}),x3=ve("ZodEmoji",(e,t)=>{RM.init(e,t),qt.init(e,t)}),w3=ve("ZodNanoID",(e,t)=>{_M.init(e,t),qt.init(e,t)}),k3=ve("ZodCUID",(e,t)=>{OM.init(e,t),qt.init(e,t)}),S3=ve("ZodCUID2",(e,t)=>{LM.init(e,t),qt.init(e,t)}),j3=ve("ZodULID",(e,t)=>{zM.init(e,t),qt.init(e,t)}),C3=ve("ZodXID",(e,t)=>{MM.init(e,t),qt.init(e,t)}),N3=ve("ZodKSUID",(e,t)=>{DM.init(e,t),qt.init(e,t)}),E3=ve("ZodIPv4",(e,t)=>{BM.init(e,t),qt.init(e,t)}),T3=ve("ZodIPv6",(e,t)=>{FM.init(e,t),qt.init(e,t)}),A3=ve("ZodCIDRv4",(e,t)=>{HM.init(e,t),qt.init(e,t)}),R3=ve("ZodCIDRv6",(e,t)=>{qM.init(e,t),qt.init(e,t)}),_3=ve("ZodBase64",(e,t)=>{GM.init(e,t),qt.init(e,t)}),O3=ve("ZodBase64URL",(e,t)=>{WM.init(e,t),qt.init(e,t)}),L3=ve("ZodE164",(e,t)=>{ZM.init(e,t),qt.init(e,t)}),z3=ve("ZodJWT",(e,t)=>{QM.init(e,t),qt.init(e,t)}),rj=ve("ZodNumber",(e,t)=>{XS.init(e,t),pn.init(e,t),e.gt=(r,s)=>e.check(h1(r,s)),e.gte=(r,s)=>e.check(gh(r,s)),e.min=(r,s)=>e.check(gh(r,s)),e.lt=(r,s)=>e.check(f1(r,s)),e.lte=(r,s)=>e.check(mh(r,s)),e.max=(r,s)=>e.check(mh(r,s)),e.int=r=>e.check(y1(r)),e.safe=r=>e.check(y1(r)),e.positive=r=>e.check(h1(0,r)),e.nonnegative=r=>e.check(gh(0,r)),e.negative=r=>e.check(f1(0,r)),e.nonpositive=r=>e.check(mh(0,r)),e.multipleOf=(r,s)=>e.check(m1(r,s)),e.step=(r,s)=>e.check(m1(r,s)),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 er(e){return BD(rj,e)}const M3=ve("ZodNumberFormat",(e,t)=>{KM.init(e,t),rj.init(e,t)});function y1(e){return FD(M3,e)}const D3=ve("ZodUnknown",(e,t)=>{XM.init(e,t),pn.init(e,t)});function b1(){return HD(D3)}const $3=ve("ZodNever",(e,t)=>{JM.init(e,t),pn.init(e,t)});function I3(e){return qD($3,e)}const P3=ve("ZodArray",(e,t)=>{eD.init(e,t),pn.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(ed(n,r)),e.nonempty=n=>e.check(ed(1,n)),e.max=(n,r)=>e.check(tj(n,r)),e.length=(n,r)=>e.check(nj(n,r)),e.unwrap=()=>e.element});function Dr(e,t){return t3(P3,e,t)}const U3=ve("ZodObject",(e,t)=>{tD.init(e,t),pn.init(e,t),Pt(e,"shape",()=>t.shape),e.keyof=()=>io(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:b1()}),e.loose=()=>e.clone({...e._zod.def,catchall:b1()}),e.strict=()=>e.clone({...e._zod.def,catchall:I3()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Rz(e,n),e.merge=n=>_z(e,n),e.pick=n=>Tz(e,n),e.omit=n=>Az(e,n),e.partial=(...n)=>Oz(ij,e,n[0]),e.required=(...n)=>Lz(sj,e,n[0])});function It(e,t){const n={type:"object",get shape(){return Tg(this,"shape",{...e}),this.shape},...Ue(t)};return new U3(n)}const B3=ve("ZodUnion",(e,t)=>{nD.init(e,t),pn.init(e,t),e.options=t.options});function Og(e,t){return new B3({type:"union",options:e,...Ue(t)})}const F3=ve("ZodIntersection",(e,t)=>{aD.init(e,t),pn.init(e,t)});function H3(e,t){return new F3({type:"intersection",left:e,right:t})}const mm=ve("ZodEnum",(e,t)=>{rD.init(e,t),pn.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,s)=>{const c={};for(const u of r)if(n.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new mm({...t,checks:[],...Ue(s),entries:c})},e.exclude=(r,s)=>{const c={...t.entries};for(const u of r)if(n.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new mm({...t,checks:[],...Ue(s),entries:c})}});function io(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new mm({type:"enum",entries:n,...Ue(t)})}const q3=ve("ZodTransform",(e,t)=>{iD.init(e,t),pn.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=c=>{if(typeof c=="string")n.issues.push(_l(c,n.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),u.continue??(u.continue=!0),n.issues.push(_l(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(c=>(n.value=c,n)):(n.value=s,n)}});function G3(e){return new q3({type:"transform",transform:e})}const ij=ve("ZodOptional",(e,t)=>{sD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function x1(e){return new ij({type:"optional",innerType:e})}const V3=ve("ZodNullable",(e,t)=>{oD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function w1(e){return new V3({type:"nullable",innerType:e})}const W3=ve("ZodDefault",(e,t)=>{lD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Z3(e,t){return new W3({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Y3=ve("ZodPrefault",(e,t)=>{cD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Q3(e,t){return new Y3({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const sj=ve("ZodNonOptional",(e,t)=>{uD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType});function K3(e,t){return new sj({type:"nonoptional",innerType:e,...Ue(t)})}const X3=ve("ZodCatch",(e,t)=>{dD.init(e,t),pn.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function J3(e,t){return new X3({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const e$=ve("ZodPipe",(e,t)=>{pD.init(e,t),pn.init(e,t),e.in=t.in,e.out=t.out});function k1(e,t){return new e$({type:"pipe",in:e,out:t})}const t$=ve("ZodReadonly",(e,t)=>{fD.init(e,t),pn.init(e,t)});function n$(e){return new t$({type:"readonly",innerType:e})}const a$=ve("ZodCustom",(e,t)=>{hD.init(e,t),pn.init(e,t)});function r$(e){const t=new Gn({check:"custom"});return t._zod.check=e,t}function i$(e,t={}){return n3(a$,e,t)}function s$(e){const t=r$(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(_l(r,n.value,t._zod.def));else{const s=r;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(_l(s))}},e(n.value,n)));return t}function vh(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 We(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 Lg={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+We(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+We(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,We(n)),We(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,We(n)),We(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??""),s=String(n??"asc")==="desc";return[...e].sort((c,u)=>{const d=r?vh(c,r):c,f=r?vh(u,r):u,h=typeof d=="number"||typeof d=="string"&&!isNaN(Number(d))&&d!=="",g=typeof f=="number"||typeof f=="string"&&!isNaN(Number(f))&&f!=="";if(h&&g){const y=We(d)-We(f);return s?-y:y}const m=String(d??"").localeCompare(String(f??""));return s?-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 s=String(t??""),c=String(n??"==");return e.filter(u=>{const d=s?vh(u,s):u;switch(c){case"==":return d==r;case"!=":return d!=r;case">":return We(d)>We(r);case"<":return We(d)<We(r);case">=":return We(d)>=We(r);case"<=":return We(d)<=We(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=We(e),r=t!=null?We(t):0,s=Math.pow(10,r);return Math.round(n*s)/s}},Abs:{name:"Abs",signature:"Abs(number) → number",description:"Absolute value",fn:e=>Math.abs(We(e))},Floor:{name:"Floor",signature:"Floor(number) → number",description:"Round down to nearest integer",fn:e=>Math.floor(We(e))},Ceil:{name:"Ceil",signature:"Ceil(number) → number",description:"Round up to nearest integer",fn:e=>Math.ceil(We(e))}},zg=new Set(["Each"]),o$={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."}},Ma={Run:"run",ToAssistant:"continue_conversation",OpenUrl:"open_url",Set:"set",Reset:"reset"},oj=new Set(["Action",...Object.keys(Ma)]),l$=new Set([...Object.keys(Lg),...zg,...oj]);function Ol(e){return l$.has(e)}const yi={Query:"Query",Mutation:"Mutation"};function td(e){return e in yi}function nd(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?`${nd(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(([s,c])=>`${s}${r.includes(s)?"":"?"}: ${nd(c)}`).join(", ")}}`}return"object"}return"any"}function lj(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[s,c]of Object.entries(n))r[s]=lj(c);return r}return{}}return null}const c$="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 u$(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(`
|
|
1430
|
-
`)}function d$(){const e=Object.values(Lg).map(n=>`@${n.signature} — ${n.description}`),t=Object.values(o$).map(n=>`@${n.signature} — ${n.description}`);return`## Built-in Functions
|
|
1431
|
-
|
|
1432
|
-
Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.
|
|
1433
|
-
Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.
|
|
1434
|
-
|
|
1435
|
-
${[...e,...t].join(`
|
|
1436
|
-
`)}
|
|
1437
|
-
|
|
1438
|
-
Builtins compose — output of one is input to the next:
|
|
1439
|
-
\`@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.
|
|
1440
|
-
Array pluck: \`data.rows.field\` extracts a field from every row → use with @Sum, @Avg, charts, tables.
|
|
1441
|
-
|
|
1442
|
-
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.
|
|
1443
|
-
CORRECT: \`Col("Actions", @Each(rows, "t", Button("Edit", Action([@Set($id, t.id)]))))\`
|
|
1444
|
-
WRONG: \`myBtn = Button("Edit", Action([@Set($id, t.id)]))\` then \`Col("Actions", @Each(rows, "t", myBtn))\` — t is undefined in myBtn.`}function p$(){return`## Query — Live Data Fetching
|
|
1445
|
-
|
|
1446
|
-
Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
|
|
1447
|
-
|
|
1448
|
-
\`\`\`
|
|
1449
|
-
metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
|
|
1450
|
-
\`\`\`
|
|
1451
|
-
|
|
1452
|
-
- First arg: tool name (string)
|
|
1453
|
-
- Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
|
|
1454
|
-
- Third arg: default data (rendered immediately before fetch resolves)
|
|
1455
|
-
- Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
|
|
1456
|
-
- Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
|
|
1457
|
-
- Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
|
|
1458
|
-
- Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
|
|
1459
|
-
- Refresh all queries: create Action with @Run for each query`}function f$(){return`## Mutation — Write Operations
|
|
1460
|
-
|
|
1461
|
-
Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
|
|
1462
|
-
|
|
1463
|
-
\`\`\`
|
|
1464
|
-
result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
|
|
1465
|
-
\`\`\`
|
|
1466
|
-
|
|
1467
|
-
- First arg: tool name (string)
|
|
1468
|
-
- Second arg: arguments object (evaluated with current $binding values at click time)
|
|
1469
|
-
- result.status: "idle" | "loading" | "success" | "error"
|
|
1470
|
-
- result.data: tool response on success
|
|
1471
|
-
- result.error: error message on failure
|
|
1472
|
-
- Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
|
|
1473
|
-
- Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}function h$(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
|
|
1474
|
-
|
|
1475
|
-
Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
|
|
1476
|
-
Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
|
|
1477
|
-
|
|
1478
|
-
Available steps:
|
|
1479
|
-
${t.join(`
|
|
1480
|
-
`)}
|
|
1481
|
-
|
|
1482
|
-
${n.join(`
|
|
1483
|
-
|
|
1484
|
-
`)}
|
|
1485
|
-
|
|
1486
|
-
${r.join(`
|
|
1487
|
-
`)}`}function m$(){return`## Interactive Filters
|
|
1488
|
-
|
|
1489
|
-
To let the user filter data with a dropdown:
|
|
1490
|
-
1. Declare a $variable with a default: \`$dateRange = "14"\`
|
|
1491
|
-
2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
|
|
1492
|
-
3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
|
|
1493
|
-
4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
|
|
1494
|
-
5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
|
|
1495
|
-
|
|
1496
|
-
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.
|
|
1497
|
-
|
|
1498
|
-
Rules for $variables:
|
|
1499
|
-
- $variables hold simple values (strings or numbers), NOT arrays or objects
|
|
1500
|
-
- $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
|
|
1501
|
-
- Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
|
|
1502
|
-
- **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"\`
|
|
1503
|
-
|
|
1504
|
-
## Forms
|
|
1505
|
-
|
|
1506
|
-
Simple form — no $bindings needed. Field values are managed internally by the Form via the name prop:
|
|
1507
|
-
\`\`\`
|
|
1508
|
-
contactForm = Form("contact", submitBtn, [nameField, emailField])
|
|
1509
|
-
nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
|
|
1510
|
-
emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
|
|
1511
|
-
submitBtn = Button("Submit")
|
|
1512
|
-
\`\`\`
|
|
1513
|
-
|
|
1514
|
-
Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
|
|
1515
|
-
\`\`\`
|
|
1516
|
-
$role = "engineer"
|
|
1517
|
-
contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
|
|
1518
|
-
nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
|
|
1519
|
-
emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
|
|
1520
|
-
roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
|
|
1521
|
-
submitBtn = Button("Submit")
|
|
1522
|
-
\`\`\`
|
|
1523
|
-
|
|
1524
|
-
For form + mutation patterns (create, refresh, reset), see the Action section example above.
|
|
1525
|
-
|
|
1526
|
-
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 g$(){return`## Edit Mode
|
|
1527
|
-
|
|
1528
|
-
The runtime merges by statement name: same name = replace, new name = append.
|
|
1529
|
-
Output ONLY statements that changed or are new. Everything else is kept automatically.
|
|
1530
|
-
|
|
1531
|
-
### Delete
|
|
1532
|
-
To remove a component, update the parent to exclude it from its children array. Orphaned statements are automatically garbage-collected.
|
|
1533
|
-
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.
|
|
1534
|
-
|
|
1535
|
-
### Patch size guide
|
|
1536
|
-
- Changing a title or label: 1 statement
|
|
1537
|
-
- Adding a component: 2-3 statements (the new component + parent update)
|
|
1538
|
-
- Removing a component: 1 statement (re-declare parent without the removed child)
|
|
1539
|
-
- Adding a filter + wiring to query: 3-5 statements
|
|
1540
|
-
- Restructuring into tabs: 5-10 statements
|
|
1541
|
-
|
|
1542
|
-
### Rules
|
|
1543
|
-
- Reuse existing statement names exactly — do not rename
|
|
1544
|
-
- Do NOT re-emit unchanged statements — the runtime keeps them
|
|
1545
|
-
- A typical edit patch is 1-10 statements, not 20+
|
|
1546
|
-
- If the existing code already satisfies the request, output only the root statement
|
|
1547
|
-
- NEVER output the entire program as a patch. Only output what actually changes
|
|
1548
|
-
- If you are about to output more than 10 statements, reconsider — most edits need fewer`}function v$(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)
|
|
1549
|
-
|
|
1550
|
-
openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
|
|
1551
|
-
|
|
1552
|
-
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.
|
|
1553
|
-
|
|
1554
|
-
**Recommended statement order for optimal streaming:**
|
|
1555
|
-
${n.join(`
|
|
1556
|
-
`)}
|
|
1557
|
-
|
|
1558
|
-
Always write the root = ${e}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`}function y$(){return`## Inline Mode
|
|
1559
|
-
|
|
1560
|
-
You are in inline mode. You can respond in two ways:
|
|
1561
|
-
|
|
1562
|
-
### 1. Code response (when the user wants to CREATE or CHANGE the UI)
|
|
1563
|
-
Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
|
|
1564
|
-
|
|
1565
|
-
Here's your dashboard:
|
|
1566
|
-
|
|
1567
|
-
\`\`\`openui-lang
|
|
1568
|
-
root = RootComp([header, content])
|
|
1569
|
-
header = SomeHeader("Title")
|
|
1570
|
-
content = SomeContent("Hello world")
|
|
1571
|
-
\`\`\`
|
|
1572
|
-
|
|
1573
|
-
I created a simple layout with a header.
|
|
1574
|
-
|
|
1575
|
-
### 2. Text-only response (when the user asks a QUESTION)
|
|
1576
|
-
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.
|
|
1577
|
-
|
|
1578
|
-
### Rules
|
|
1579
|
-
- When the user asks for changes, output ONLY the changed/new statements in a fenced block
|
|
1580
|
-
- When the user asks a question, respond with text only — NO code. The dashboard stays unchanged.
|
|
1581
|
-
- The parser extracts code from fences automatically. Text outside fences is shown as chat.`}function b$(){return`## Data Workflow
|
|
1582
|
-
|
|
1583
|
-
When tools are available, follow this workflow:
|
|
1584
|
-
1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
|
|
1585
|
-
2. Use Query() for READ operations (data that should stay live) — NEVER hardcode tool results as literal arrays or objects
|
|
1586
|
-
3. Use Mutation() for WRITE operations (create, update, delete) — triggered by button clicks via Action([@Run(mutationRef)])
|
|
1587
|
-
4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
|
|
1588
|
-
5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations — the runtime evaluates these live on every refresh
|
|
1589
|
-
6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
|
|
1590
|
-
|
|
1591
|
-
WRONG — you called a tool and got data back, but you inlined the results:
|
|
1592
|
-
\`\`\`
|
|
1593
|
-
openCount = 2
|
|
1594
|
-
item1 = SomeComp("first item title")
|
|
1595
|
-
item2 = SomeComp("second item title")
|
|
1596
|
-
list = Stack([item1, item2])
|
|
1597
|
-
chart = SomeChart(["A", "B"], [12, 8])
|
|
1598
|
-
\`\`\`
|
|
1599
|
-
This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
|
|
1600
|
-
|
|
1601
|
-
RIGHT — use Query() for live data, Mutation() for writes, @builtins to derive values:
|
|
1602
|
-
\`\`\`
|
|
1603
|
-
data = Query("tool_name", {}, {rows: []})
|
|
1604
|
-
openCount = @Count(@Filter(data.rows, "field", "==", "value"))
|
|
1605
|
-
list = @Each(data.rows, "item", SomeComp(item.title, item.field))
|
|
1606
|
-
createResult = Mutation("create_tool", {title: $title})
|
|
1607
|
-
submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
|
|
1608
|
-
\`\`\`
|
|
1609
|
-
Everything derives from the Query — when data refreshes, the entire dashboard updates automatically.`}function x$(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
|
|
1610
|
-
- When asked about data, generate realistic/plausible data
|
|
1611
|
-
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
|
|
1612
|
-
|
|
1613
|
-
## Final Verification
|
|
1614
|
-
Before finishing, walk your output and verify:
|
|
1615
|
-
${n.join(`
|
|
1616
|
-
`)}`}function w$(e){let t="";if(e.inputSchema){const s=e.inputSchema.properties,c=e.inputSchema.required??[];s&&Object.keys(s).length>0&&(t=Object.entries(s).map(([u,d])=>`${u}${c.includes(u)?"":"?"}: ${nd(d)}`).join(", "))}let n="";e.outputSchema&&(n=` → ${nd(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`
|
|
1617
|
-
${e.description}`),r}function k$(e){const t=[],n=[],r=[];for(const c of e)typeof c=="string"?n.push(c):r.push(c);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 c of n)t.push(`- ${c}`);for(const c of r)t.push(w$(c));const s=r.filter(c=>c.outputSchema);if(s.length>0){t.push(""),t.push("### Default values for Query results"),t.push(""),t.push("Use these shapes as minimal Query defaults:");for(const c of s){const u=lj(c.outputSchema);t.push(`- ${c.name}: \`${JSON.stringify(u)}\``)}}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(`
|
|
1618
|
-
`)}function S$(e,t){var s,c;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 u=[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 (${u.join(", ")}).`)}(t.bindings||Object.values(e.components).some(u=>{var d;return(d=u.signature)==null?void 0:d.includes("$binding")}))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");const r=u=>u.description?`${u.signature} — ${u.description}`:u.signature;if((s=e.componentGroups)!=null&&s.length){const u=new Set;for(const f of e.componentGroups){n.push("",`### ${f.name}`);for(const h of f.components){if(u.has(h))continue;const g=e.components[h];g&&(u.add(h),n.push(r(g)))}if((c=f.notes)!=null&&c.length)for(const h of f.notes)n.push(h)}const d=Object.keys(e.components).filter(f=>!u.has(f));if(d.length){n.push("","### Other");for(const f of d){const h=e.components[f];n.push(r(h))}}}else{n.push("");for(const[,u]of Object.entries(e.components))n.push(r(u))}return n.join(`
|
|
1619
|
-
`)}function j$(e){var h,g,m;const t=e.root??"Root",n=!!((h=e.tools)!=null&&h.length),r=e.toolCalls??n,s=e.bindings??r,c=r||s,u=Object.values(e.components).some(y=>{var b;return(b=y.signature)==null?void 0:b.includes("ActionExpression")}),d=[];d.push(e.preamble??c$),d.push(""),d.push(u$(t,{supportsExpressions:c,bindings:s})),d.push(""),d.push(S$(e,{toolCalls:r,bindings:s,usesActionExpression:u})),c&&(d.push(""),d.push(d$())),r&&(d.push(""),d.push(p$()),d.push(""),d.push(f$())),u&&(d.push(""),d.push(h$({toolCalls:r,bindings:s}))),r&&s&&(d.push(""),d.push(m$())),r&&(d.push(""),d.push(b$())),(g=e.tools)!=null&&g.length&&(d.push(""),d.push(k$(e.tools))),d.push(""),d.push(v$(t,{supportsExpressions:c}));const f=[...e.examples??[],...e.toolExamples??[]];if(f.length){d.push(""),d.push("## Examples"),d.push("");for(const y of f)d.push(y),d.push("")}if(e.editMode&&(d.push(""),d.push(g$())),e.inlineMode&&(d.push(""),d.push(y$())),d.push(x$(t,{toolCalls:r,bindings:s})),(m=e.additionalRules)!=null&&m.length){d.push("");for(const y of e.additionalRules)d.push(`- ${y}`)}return d.join(`
|
|
1620
|
-
`)}const C$=new WeakSet;function jl(e){return typeof e=="object"&&e!==null&&C$.has(e)}const cj=new WeakMap;function N$(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 E$(e){return N$(e.props,e.name),cj.set(e.props,e.name),{...e,ref:e.props}}function $r(e){var t;return(t=e==null?void 0:e._zod)==null?void 0:t.def}function Mg(e){var t;return(t=$r(e))==null?void 0:t.type}function uj(e){const t=Mg(e);return t==="optional"||t==="default"||t==="nullable"}function Hl(e){let t=e,n=$r(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=$r(t);return t}function dj(e){return Mg(Hl(e))==="array"}function T$(e){const t=$r(Hl(e));if((t==null?void 0:t.type)==="array")return t.element??t.innerType}function A$(e){const t=$r(Hl(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 R$(e,t){try{const n=t.get(e);if(n!=null&&n.id)return n.id}catch{}if(typeof e=="object"&&e!==null)return cj.get(e)}function S1(e){const t=$r(e);if((t==null?void 0:t.type)==="union"&&Array.isArray(t.options))return t.options}function _$(e){const t=$r(e);if((t==null?void 0:t.type)==="object"&&t.shape&&typeof t.shape=="object")return t.shape}function Vs(e,t){const n=jl(e),r=O$(Hl(e),t);if(r)return n?`$binding<${r}>`:r}function O$(e,t){var d;const n=R$(e,t);if(n)return n;const r=S1(e);if(r){const f=r.map(h=>Vs(h,t)).filter(Boolean);if(f.length>0)return f.join(" | ")}if(dj(e)){const f=T$(e);if(!f)return;const h=Vs(f,t);return h?S1(Hl(f))!==void 0?`(${h})[]`:`${h}[]`:void 0}const s=Mg(e);if(s==="string")return"string";if(s==="number")return"number";if(s==="boolean")return"boolean";if(s==="any")return"any";if(s==="record"){const f=$r(e);return`Record<${Vs(f==null?void 0:f.keyType,t)??"string"}, ${Vs(f==null?void 0:f.valueType,t)??"any"}>`}const c=A$(e);if(c)return c.map(f=>`"${f}"`).join(" | ");if(s==="literal"){const f=(d=$r(e))==null?void 0:d.values;if(Array.isArray(f)&&f.length===1){const h=f[0];return typeof h=="string"?`"${h}"`:String(h)}}const u=_$(e);return u?`{${Object.entries(u).map(([f,h])=>{const g=uj(h)?"?":"",m=Vs(h,t);return m?`${f}${g}: ${m}`:`${f}${g}`}).join(", ")}}`:"any"}function L$(e,t){return Object.entries(e).map(([n,r])=>({name:n,isOptional:uj(r),isArray:dj(r),typeAnnotation:Vs(r,t)}))}function z$(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 j1(e,t){const n={};for(const[r,s]of Object.entries(e))n[r]={signature:z$(r,L$(s.props.shape,t)),description:s.description};return n}function M$(e){const t={},n=ej();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 j$({root:e.root,components:j1(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:j1(t,n),componentGroups:e.componentGroups}},toJSONSchema(){const r=It(Object.fromEntries(Object.entries(t).map(([s,c])=>[s,c.props])));return a3(r,{metadata:n})}}}function Lr(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 gu=(function(e){return e.ContinueConversation="continue_conversation",e.OpenUrl="open_url",e})({});function D$(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 $$=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Ks(e){return!e||typeof e!="object"||Array.isArray(e)?!1:$$.has(e.k)}function I$(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(([,s])=>n(s));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 ie=(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 P$=1,C1=2,N1=3,yh=4,pl=5,bh=6,vu=7,E1=8,U$=9;function T1(e){let t=0;const n=()=>e[t]??{t:ie.EOF},r=()=>{const y=n();return t++,y},s=y=>{n().t===y&&t++};function c(y){switch(y.t){case ie.Question:return P$;case ie.Or:return C1;case ie.And:return N1;case ie.EqEq:case ie.NotEq:return yh;case ie.Greater:case ie.Less:case ie.GreaterEq:case ie.LessEq:return pl;case ie.Plus:case ie.Minus:return bh;case ie.Star:case ie.Slash:case ie.Percent:return vu;case ie.Dot:case ie.LBrack:return U$;default:return 0}}function u(y=0){let b=d();for(;c(n())>y;)b=f(b);return b}function d(){var b,k;const y=n();if(y.t===ie.Str)return r(),{k:"Str",v:y.v};if(y.t===ie.Num)return r(),{k:"Num",v:y.v};if(y.t===ie.True)return r(),{k:"Bool",v:!0};if(y.t===ie.False)return r(),{k:"Bool",v:!1};if(y.t===ie.Null)return r(),{k:"Null"};if(y.t===ie.LBrack)return g();if(y.t===ie.LBrace)return m();if(y.t===ie.StateVar){const j=y.v;return r(),n().t===ie.Equals?(r(),{k:"Assign",target:j,value:u(0)}):{k:"StateRef",n:j}}if(y.t===ie.Type){const j=y.v;return((b=e[t+1])==null?void 0:b.t)===ie.LParen&&(!Ol(j)||j==="Action")?h():(r(),{k:"Ref",n:j})}if(y.t===ie.BuiltinCall)return((k=e[t+1])==null?void 0:k.t)===ie.LParen?h():(r(),{k:"Ref",n:y.v});if(y.t===ie.Ident)return r(),{k:"Ref",n:y.v};if(y.t===ie.Not)return r(),{k:"UnaryOp",op:"!",operand:u(E1)};if(y.t===ie.Minus)return r(),{k:"UnaryOp",op:"-",operand:u(E1)};if(y.t===ie.LParen){r();const j=u(0);return s(ie.RParen),j}return r(),{k:"Null"}}function f(y){const b=n();if(b.t===ie.Plus)return r(),{k:"BinOp",op:"+",left:y,right:u(bh)};if(b.t===ie.Minus)return r(),{k:"BinOp",op:"-",left:y,right:u(bh)};if(b.t===ie.Star)return r(),{k:"BinOp",op:"*",left:y,right:u(vu)};if(b.t===ie.Slash)return r(),{k:"BinOp",op:"/",left:y,right:u(vu)};if(b.t===ie.Percent)return r(),{k:"BinOp",op:"%",left:y,right:u(vu)};if(b.t===ie.EqEq)return r(),{k:"BinOp",op:"==",left:y,right:u(yh)};if(b.t===ie.NotEq)return r(),{k:"BinOp",op:"!=",left:y,right:u(yh)};if(b.t===ie.Greater)return r(),{k:"BinOp",op:">",left:y,right:u(pl)};if(b.t===ie.Less)return r(),{k:"BinOp",op:"<",left:y,right:u(pl)};if(b.t===ie.GreaterEq)return r(),{k:"BinOp",op:">=",left:y,right:u(pl)};if(b.t===ie.LessEq)return r(),{k:"BinOp",op:"<=",left:y,right:u(pl)};if(b.t===ie.And)return r(),{k:"BinOp",op:"&&",left:y,right:u(N1)};if(b.t===ie.Or)return r(),{k:"BinOp",op:"||",left:y,right:u(C1)};if(b.t===ie.Question){r();const k=u(0);return s(ie.Colon),{k:"Ternary",cond:y,then:k,else:u(0)}}if(b.t===ie.Dot){r();const k=n();return{k:"Member",obj:y,field:k.t===ie.Ident||k.t===ie.Type||k.t===ie.Str||k.t===ie.Num?(r(),String(k.v)):k.t===ie.StateVar?(r(),k.v.replace(/^\$/,"")):(r(),"?")}}if(b.t===ie.LBrack){r();const k=u(0);return s(ie.RBrack),{k:"Index",obj:y,index:k}}return y}function h(){const y=n().v;r(),s(ie.LParen);const b=[];for(;n().t!==ie.RParen&&n().t!==ie.EOF;)b.push(u(0)),n().t===ie.Comma&&r();return s(ie.RParen),{k:"Comp",name:y,args:b}}function g(){r();const y=[];for(;n().t!==ie.RBrack&&n().t!==ie.EOF;)y.push(u(0)),n().t===ie.Comma&&r();return s(ie.RBrack),{k:"Arr",els:y}}function m(){r();const y=[];for(;n().t!==ie.RBrace&&n().t!==ie.EOF;){const b=n(),k=b.t===ie.Ident||b.t===ie.Str||b.t===ie.Type||b.t===ie.Num?(r(),String(b.v)):b.t===ie.StateVar?(r(),b.v.replace(/^\$/,"")):(r(),"?");s(ie.Colon),y.push([k,u(0)]),n().t===ie.Comma&&r()}return s(ie.RBrace),{k:"Obj",entries:y}}return u(0)}function A1(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 s=e[n];if(s===`
|
|
1621
|
-
`){t.push({t:ie.Newline}),n++;continue}if(s==="("){t.push({t:ie.LParen}),n++;continue}if(s===")"){t.push({t:ie.RParen}),n++;continue}if(s==="["){t.push({t:ie.LBrack}),n++;continue}if(s==="]"){t.push({t:ie.RBrack}),n++;continue}if(s==="{"){t.push({t:ie.LBrace}),n++;continue}if(s==="}"){t.push({t:ie.RBrace}),n++;continue}if(s===","){t.push({t:ie.Comma}),n++;continue}if(s===":"){t.push({t:ie.Colon}),n++;continue}if(s==="="){n+1<r&&e[n+1]==="="?(t.push({t:ie.EqEq}),n+=2):(t.push({t:ie.Equals}),n++);continue}if(s==="!"){n+1<r&&e[n+1]==="="?(t.push({t:ie.NotEq}),n+=2):(t.push({t:ie.Not}),n++);continue}if(s===">"){n+1<r&&e[n+1]==="="?(t.push({t:ie.GreaterEq}),n+=2):(t.push({t:ie.Greater}),n++);continue}if(s==="<"){n+1<r&&e[n+1]==="="?(t.push({t:ie.LessEq}),n+=2):(t.push({t:ie.Less}),n++);continue}if(s==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:ie.And}),n+=2):(t.push({t:ie.And}),n++);continue}if(s==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:ie.Or}),n+=2):(t.push({t:ie.Or}),n++);continue}if(s==="."){t.push({t:ie.Dot}),n++;continue}if(s==="?"){t.push({t:ie.Question}),n++;continue}if(s==="+"){t.push({t:ie.Plus}),n++;continue}if(s==="*"){t.push({t:ie.Star}),n++;continue}if(s==="/"){t.push({t:ie.Slash}),n++;continue}if(s==="%"){t.push({t:ie.Percent}),n++;continue}if(s==='"'){const d=n;n++;let f=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,f=!0;break}else n++;const h=e.slice(d,n);try{const g=f?h:h+'"';t.push({t:ie.Str,v:JSON.parse(g)})}catch{const g=h.replace(/^"|"$/g,"");t.push({t:ie.Str,v:g})}continue}if(s==="'"){n++;let d="";for(;n<r;)if(e[n]==="\\"){if(n++,n<r){const f=e[n];f==="'"?d+="'":f==="\\"?d+="\\":f==="n"?d+=`
|
|
1622
|
-
`:f==="t"?d+=" ":d+=f,n++}}else if(e[n]==="'"){n++;break}else d+=e[n],n++;t.push({t:ie.Str,v:d});continue}if(s==="-"){const d=t.length>0?t[t.length-1]:null;if(!(!(d!=null&&(d.t===ie.Num||d.t===ie.Str||d.t===ie.Ident||d.t===ie.Type||d.t===ie.RParen||d.t===ie.RBrack||d.t===ie.True||d.t===ie.False||d.t===ie.Null||d.t===ie.StateVar||d.t===ie.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:ie.Minus}),n++;continue}}const c=s>="0"&&s<="9",u=s==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(c||u){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:ie.Num,v:+e.slice(d,n)});continue}if(s==="$"&&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:ie.StateVar,v:e.slice(d,n)});continue}if(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="_"){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 f=e.slice(d,n);if(f==="true"){t.push({t:ie.True});continue}if(f==="false"){t.push({t:ie.False});continue}if(f==="null"){t.push({t:ie.Null});continue}const h=s>="A"&&s<="Z"?ie.Type:ie.Ident;t.push({t:h,v:f});continue}if(s==="@"&&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:ie.BuiltinCall,v:e.slice(d,n)});continue}n++}return t.push({t:ie.EOF}),t}function Du(e){return e==null||typeof e!="object"?!1:Ks(e)?!0:Array.isArray(e)?e.some(Du):Lr(e)?Object.values(e.props).some(Du):Object.values(e).some(Du)}function pj(e,t,n){var c;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((c=t.unreached)==null||c.delete(e),r.k==="Comp"&&td(r.name))return{k:"RuntimeRef",n:e,refType:r.name===yi.Mutation?"mutation":"query"};t.visited.add(e);const s=t.currentStatementId;t.currentStatementId=e;try{const u=n==="value"?Xs(r,t):gm(r,t);return n==="value"&&Lr(u)&&(u.statementId=e),u}finally{t.currentStatementId=s,t.visited.delete(e)}}function fj(e,t,n){if(!zg.has(e.name)||e.args.length<3)return null;const r=e.args[1],s=r.k==="Ref"?r.n:r.k==="Str"?r.v:null;if(!s)return null;const c=new Set(n);c.add(s);const u=e.args.map((d,f)=>f===1?d:Ln(d,t,c));return{...e,args:u}}function Ln(e,t,n){var r;switch(e.k){case"Ref":return n.has(e.n)?e:pj(e.n,t,"expr");case"Ph":return e;case"Comp":{const s=fj(e,t,n);if(s)return s;const c=e.args.map(d=>Ln(d,t,n));if(Ol(e.name)||td(e.name))return{...e,args:c};const u=(r=t.cat)==null?void 0:r.get(e.name);if(u){const d={};for(let f=0;f<u.params.length&&f<c.length;f++)d[u.params[f].name]=c[f];return{...e,args:c,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:c}}case"Arr":return{...e,els:e.els.map(s=>Ln(s,t,n))};case"Obj":return{...e,entries:e.entries.map(([s,c])=>[s,Ln(c,t,n)])};case"BinOp":return{...e,left:Ln(e.left,t,n),right:Ln(e.right,t,n)};case"UnaryOp":return{...e,operand:Ln(e.operand,t,n)};case"Ternary":return{...e,cond:Ln(e.cond,t,n),then:Ln(e.then,t,n),else:Ln(e.else,t,n)};case"Member":return{...e,obj:Ln(e.obj,t,n)};case"Index":return{...e,obj:Ln(e.obj,t,n),index:Ln(e.index,t,n)};case"Assign":return{...e,value:Ln(e.value,t,n)};default:return e}}function gm(e,t){return Ln(e,t,new Set)}function Xs(e,t){var n;switch(e.k){case"Ref":return pj(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 s of e.els){if(s.k==="Ph")continue;const c=Xs(s,t);c===null&&(s.k==="Comp"||s.k==="Ref")||r.push(c)}return r}case"Obj":{const r={};for(const[s,c]of e.entries)r[s]=Xs(c,t);return r}case"Comp":{const{name:r,args:s}=e;if(Ol(r)){const f=fj(e,t,new Set);return f||{...e,args:s.map(h=>gm(h,t))}}if(td(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 c=(n=t.cat)==null?void 0:n.get(r),u={};if(c){for(let h=0;h<c.params.length&&h<s.length;h++)u[c.params[h].name]=Xs(s[h],t);if(s.length>c.params.length){const h=s.length-c.params.length;t.errors.push({code:"excess-args",component:r,path:"",message:`${r} takes ${c.params.length} arg(s), got ${s.length} (${h} excess dropped)`,statementId:t.currentStatementId})}const f=c.params.filter(h=>h.required&&(!(h.name in u)||u[h.name]===null));if(f.length){const h=f.filter(g=>g.defaultValue!==void 0?(u[g.name]=g.defaultValue,!1):!0);if(h.length){for(const g of h){const m=g.name in u;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(!Ol(r)&&!td(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(u).some(f=>Du(f));return{type:"element",typeName:r,props:u,partial:t.partial,hasDynamicProps:d}}default:return D$(e)?gm(e,t):e}}function B$(e){const t=[];let n=!1,r=!1;for(let c=0;c<e.length;c++){const u=e[c];if(r){r=!1;continue}if(u==="\\"&&n){r=!0;continue}if(n){u===n&&(n=!1);continue}if(u==='"'||u==="'"){n=u;continue}u==="("||u==="["||u==="{"?t.push(u):(u===")"&&t[t.length-1]==="("||u==="]"&&t[t.length-1]==="["||u==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(n||t.length>0))return{text:e,wasIncomplete:!1};let s=e;n&&(r&&(s+="\\"),s+=n);for(let c=t.length-1;c>=0;c--)s+=t[c]==="("?")":t[c]==="["?"]":"}";return{text:s,wasIncomplete:!0}}function R1(e){const t=[];let n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===ie.Newline;)n++;if(n>=e.length||e[n].t===ie.EOF)break;const r=e[n];if(r.t!==ie.Ident&&r.t!==ie.Type&&r.t!==ie.StateVar){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}const s=r.v,c=r.t;if(n++,n>=e.length||e[n].t!==ie.Equals){for(;n<e.length&&e[n].t!==ie.Newline&&e[n].t!==ie.EOF;)n++;continue}n++;const u=[];let d=0,f=0;for(;n<e.length&&e[n].t!==ie.EOF;){const h=e[n].t;if(h===ie.Newline&&d<=0&&f<=0){let g=n+1;for(;g<e.length&&e[g].t===ie.Newline;)g++;const m=g<e.length?e[g].t:ie.EOF;if(m===ie.Question||m===ie.Colon&&f>0){n++;continue}break}if(h===ie.Newline){n++;continue}h===ie.LParen||h===ie.LBrack||h===ie.LBrace?d++:(h===ie.RParen||h===ie.RBrack||h===ie.RBrace)&&d>0?d--:h===ie.Question&&d===0?f++:h===ie.Colon&&d===0&&f>0&&f--,u.push(e[n++])}u.length&&t.push({id:s,idTokenType:c,tokens:u})}return t}function $u(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function hj(e){if(!Ks(e))return[];const t=new Set;return I$(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function _1(e,t){if(t.k==="Comp"&&t.name===yi.Query){const n=hj(t.args[1]);return{kind:"query",id:e.id,call:{callee:yi.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===yi.Mutation?{kind:"mutation",id:e.id,call:{callee:yi.Mutation,args:t.args},expr:t}:e.idTokenType===ie.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function F$(e,t){const n={},r=[],s=[];for(const c of e)switch(c.kind){case"state":n[c.id]=Xs(c.init,t);break;case"query":r.push({statementId:c.id,toolAST:c.call.args[0]??null,argsAST:c.call.args[1]??null,defaultsAST:c.call.args[2]??null,refreshAST:c.call.args[3]??null,deps:c.deps,complete:!0});break;case"mutation":s.push({statementId:c.id,toolAST:c.call.args[0]??null,argsAST:c.call.args[1]??null});break}for(const c of e){const u=c.kind==="state"?[c.init]:c.kind==="value"?[c.expr]:c.kind==="query"||c.kind==="mutation"?c.call.args:[];for(const d of u)for(const f of hj(d))f in n||(n[f]=null)}return{stateDeclarations:n,queryStatements:r,mutationStatements:s}}const O1="root";function L1(e){return e.kind==="value"&&e.expr.k==="Comp"&&!Ol(e.expr.name)&&e.expr.name!==yi.Query&&e.expr.name!==yi.Mutation}function H$(e,t,n,r){var c;if(e.has(O1))return O1;if(r&&e.has(r))return r;const s=r?t.find(u=>L1(u)&&u.expr.name===r):void 0;return s?s.id:((c=t.find(L1))==null?void 0:c.id)??n}function yu(e,t,n,r,s,c,u){const d=H$(e,t,n,u);if(!e.has(d))return $u(r);const f=new Map;for(const[T,N]of e)f.set(T,N.kind==="state"?N.init:N.expr);const h=[],g=[],m=new Set;for(const[T,N]of e)T!==d&&(N.kind==="state"||N.kind==="query"||N.kind==="mutation"||m.add(T));const y={syms:f,cat:c,errors:g,unres:h,visited:new Set,partial:r,currentStatementId:d,unreached:m},b=Xs(f.get(d),y),k=Lr(b)?b:null;k&&(k.statementId=d);const{stateDeclarations:j,queryStatements:E,mutationStatements:S}=F$(t,y);return{root:k,meta:{incomplete:r,unresolved:h,orphaned:[...m],statementCount:s,errors:g},stateDeclarations:j,queryStatements:E,mutationStatements:S}}function q$(e){const t=[];let n=0;for(;n<e.length;){const r=e.indexOf("```",n);if(r===-1)break;let s=r+3;for(;s<e.length&&e[s]!==`
|
|
1623
|
-
`;)s++;if(s>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}s++;let c=!1,u=-1,d=s;for(;d<e.length;){const f=e[d];if(c){if(f==="\\"&&d+1<e.length){d+=2;continue}f==='"'&&(c=!1),d++;continue}if(f==='"'){c=!0,d++;continue}if(f==="`"&&d+1<e.length&&e[d+1]==="`"&&d+2<e.length&&e[d+2]==="`"){u=d;break}d++}u!==-1?(t.push(e.slice(s,u)),n=u+3):(t.push(e.slice(s)),n=e.length)}if(t.length>0)return t.join(`
|
|
1624
|
-
`);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
|
|
1625
|
-
`;)r++;const s=r<e.length?r+1:3,c=e.slice(s),u=c.lastIndexOf("```");return u!==-1?c.slice(0,u):c}return e}function z1(e){return e.split(`
|
|
1626
|
-
`).map(t=>{let n=!1;for(let r=0;r<t.length;r++){const s=t[r];if(n){if(s==="\\"&&r+1<t.length){r++;continue}s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}if(s==="/"&&t[r+1]==="/"||s==="#")return t.substring(0,r).trimEnd()}return t}).join(`
|
|
1627
|
-
`)}function G$(e,t){let n="",r=0;const s=new Map;let c=0,u="";function d(m){const y=z1(m).trim();if(!(!y||/^```/.test(y)))for(const b of R1(A1(y))){const k=_1(b,T1(b.tokens));s.set(b.id,k),c++,u||(u=b.id)}}function f(){let m=0,y=0,b=!1,k=!1,j=r;for(let E=r;E<n.length;E++){const S=n[E];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)y++;else if(S===":"&&m===0&&y>0)y--;else if(S===`
|
|
1628
|
-
`&&m<=0&&y<=0){let T=E+1;for(;T<n.length&&(n[T]===" "||n[T]===" "||n[T]==="\r"||n[T]===`
|
|
1629
|
-
`);)T++;if(T<n.length&&(n[T]==="?"||n[T]===":"&&y>0))continue;const N=n.slice(j,E).trim();N&&d(N),j=E+1,r=E+1}}return j}function h(){const m=f(),y=n.slice(m).trim();if(!y)return c===0?$u():yu(s,[...s.values()],u,!1,c,e,t);const b=z1(q$(y)).trim();if(!b)return c===0?$u():yu(s,[...s.values()],u,!1,c,e,t);const{text:k,wasIncomplete:j}=B$(b),E=R1(A1(k));if(!E.length)return c===0?$u(j):yu(s,[...s.values()],u,j,c,e,t);const S=new Map(s);for(const T of E){if(s.has(T.id))continue;const N=_1(T,T1(T.tokens));S.set(T.id,N)}return yu(S,[...S.values()],u||E[0].id,j,c+E.length,e,t)}function g(){n="",r=0,s.clear(),c=0,u=""}return{push(m){return n+=m,h()},set(m){(m.length<n.length||!m.startsWith(n))&&g();const y=m.slice(n.length);return y&&(n+=y),h()},getResult:h}}function V$(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function W$(e){const t=new Map,n=e.$defs??{};for(const[r,s]of Object.entries(n)){const c=s.properties??{},u=s.required??[],d=Object.keys(c).map(f=>({name:f,required:u.includes(f),defaultValue:V$(c[f])}));t.set(r,{params:d})}return t}function Z$(e,t){return G$(W$(e),t)}function Y$(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 Q$(e,t,n){return e.map(r=>{var c;const s={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?s.hint=`Available components: ${n.join(", ")}`:r.code==="missing-required"||r.code==="null-required"?s.hint=Y$(r.component,(c=t.$defs)==null?void 0:c[r.component]):r.code==="inline-reserved"&&(s.hint=`Declare as a top-level statement: myVar = ${r.component}(...)`),s})}function K$(e){return typeof e=="object"&&e!==null&&e.__reactive==="assign"}function gt(e,t,n){var r,s,c;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(u=>gt(u,t));case"Obj":return Object.fromEntries(e.entries.map(([u,d])=>[u,gt(d,t)]));case"Comp":{if(zg.has(e.name))return J$(e.name,e.args,t,n);const u=Lg[e.name];if(u){const d=e.args.map(f=>gt(f,t));return u.fn(...d)}if(oj.has(e.name))return X$(e.name,e.args,t);if(e.mappedProps){const d=n==null?void 0:n.library.components[e.name],f={};for(const[g,m]of Object.entries(e.mappedProps)){const y=(c=(s=d==null?void 0:d.props)==null?void 0:s.shape)==null?void 0:c[g];m.k==="StateRef"&&y&&jl(y)?f[g]={__reactive:"assign",target:m.n,expr:{k:"StateRef",n:"$value"}}:m.k==="StateRef"?f[g]=n?t.getState(m.n):m:f[g]=gt(m,t,n)}const h={type:"element",typeName:e.name,props:f,partial:!1,hasDynamicProps:!0};if(n)for(const[g,m]of Object.entries(f))Lr(m)?f[g]=ad(m,t,n):Array.isArray(m)&&(f[g]=m.map(y=>Lr(y)?ad(y,t,n):y));return h}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case"BinOp":{if(e.op==="&&"){const f=gt(e.left,t);return f&>(e.right,t)}if(e.op==="||"){const f=gt(e.left,t);return f||gt(e.right,t)}const u=gt(e.left,t),d=gt(e.right,t);switch(e.op){case"+":return typeof u=="string"||typeof d=="string"?String(u??"")+String(d??""):We(u)+We(d);case"-":return We(u)-We(d);case"*":return We(u)*We(d);case"/":return We(d)===0?0:We(u)/We(d);case"%":return We(d)===0?0:We(u)%We(d);case"==":return u==d;case"!=":return u!=d;case">":return We(u)>We(d);case"<":return We(u)<We(d);case">=":return We(u)>=We(d);case"<=":return We(u)<=We(d);default:return null}}case"UnaryOp":return e.op==="!"?!gt(e.operand,t):e.op==="-"?-We(gt(e.operand,t)):null;case"Ternary":return gt(e.cond,t)?gt(e.then,t):gt(e.else,t);case"Member":{const u=gt(e.obj,t);return u==null?null:Array.isArray(u)?e.field==="length"?u.length:u.map(d=>(d==null?void 0:d[e.field])??null):u[e.field]}case"Index":{const u=gt(e.obj,t),d=gt(e.index,t);return u==null||d==null?null:Array.isArray(u)?u[We(d)]:u[String(d)]}case"Assign":return{__reactive:"assign",target:e.target,expr:e.value}}}function ad(e,t,n){var c,u;if(e.hasDynamicProps===!1)return e;const r=n.library.components[e.typeName],s={};for(const[d,f]of Object.entries(e.props)){const h=(u=(c=r==null?void 0:r.props)==null?void 0:c.shape)==null?void 0:u[d];s[d]=mj(f,t,n,h)}return{...e,props:s}}function mj(e,t,n,r){return gj(e,t,n,r,{recurseElement:s=>ad(s,t,n),recurse:(s,c)=>mj(s,t,n,c)})}function vm(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(vm)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,vm(n)])}:{k:"Null"}}function X$(e,t,n){switch(e){case"Action":{const r=t.length>0?gt(t[0],n):[];return{steps:(Array.isArray(r)?r:[]).filter(s=>s!=null&&typeof s=="object"&&"type"in s)}}case"Run":{if(t.length===0)return null;const r=t[0];return r.k==="RuntimeRef"?{type:Ma.Run,statementId:r.n,refType:r.refType}:null}case"ToAssistant":{const r=t.length>0?String(gt(t[0],n)??""):"",s=t.length>1?String(gt(t[1],n)??""):void 0;return{type:Ma.ToAssistant,message:r,context:s}}case"OpenUrl":{const r=t.length>0?String(gt(t[0],n)??""):"";return{type:Ma.OpenUrl,url:r}}case"Set":{if(t.length<2)return null;const r=t[0];return r.k!=="StateRef"?null:{type:Ma.Set,target:r.n,valueAST:t[1]}}case"Reset":{const r=t.filter(s=>s.k==="StateRef").map(s=>s.n);return r.length===0?null:{type:Ma.Reset,targets:r}}default:return null}}function On(e,t,n){switch(e.k){case"Ref":return e.n===t?vm(n):e;case"Member":if(Ks(e.obj)){const r=On(e.obj,t,n);if(r.k==="Obj"){const s=r.entries.find(([c])=>c===e.field);if(s)return s[1]}return{...e,obj:r}}return e;case"Index":return{...e,obj:Ks(e.obj)?On(e.obj,t,n):e.obj,index:Ks(e.index)?On(e.index,t,n):e.index};case"BinOp":return{...e,left:On(e.left,t,n),right:On(e.right,t,n)};case"UnaryOp":return{...e,operand:On(e.operand,t,n)};case"Ternary":return{...e,cond:On(e.cond,t,n),then:On(e.then,t,n),else:On(e.else,t,n)};case"Arr":return{...e,els:e.els.map(r=>On(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,s])=>[r,On(s,t,n)])};case"Comp":{const r={...e,args:e.args.map(s=>On(s,t,n))};if(e.mappedProps){const s={};for(const[c,u]of Object.entries(e.mappedProps))s[c]=On(u,t,n);r.mappedProps=s}return r}case"Assign":return{...e,value:On(e.value,t,n)};default:return e}}function J$(e,t,n,r){if(e==="Each"){if(t.length<3)return[];const s=gt(t[0],n);if(!Array.isArray(s))return[];const c=t[1].k==="Ref"?t[1].n:t[1].k==="Str"?t[1].v:null;if(!c)return[];const u=t[2];return s.map((d,f)=>{const h=On(u,c,d),g={...n,resolveRef:y=>y===c?d:n.resolveRef(y)},m=gt(h,g,r);return r&&Lr(m)?ad(m,g,r):m})}return null}function gj(e,t,n,r,s){if(e==null||typeof e!="object")return e;if(Ks(e)){if(e.k==="StateRef"&&r&&jl(r))return{__reactive:"assign",target:e.n,expr:{k:"StateRef",n:"$value"}};const d=gt(e,t,n);return Lr(d)?s.recurseElement(d):Array.isArray(d)?d.map(f=>Lr(f)?s.recurseElement(f):f):K$(d)&&!(r&&jl(r))?t.getState(d.target)??null:d}if(typeof e=="string"&&r&&jl(r))return e;if(Array.isArray(e))return e.map(d=>s.recurse(d,r));if(Lr(e))return s.recurseElement(e);const c=e;if("steps"in c&&Array.isArray(c.steps)||"type"in c&&"valueAST"in c)return e;let u=!1;for(const d of Object.values(c))if(typeof d=="object"&&d!==null){u=!0;break}if(u){const d={};for(const[f,h]of Object.entries(c))d[f]=s.recurse(h,r);return d}return e}function vj(e,t){var c,u,d;if(e.hasDynamicProps===!1)return e;const n={library:t.library},r=t.library.components[e.typeName],s={};for(const[f,h]of Object.entries(e.props)){const g=(u=(c=r==null?void 0:r.props)==null?void 0:c.shape)==null?void 0:u[f];try{s[f]=yj(h,t,n,g)}catch(m){s[f]=h;const y=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 "${f}" on ${e.typeName} failed: ${y}`,hint:`Check the expression used for prop "${f}"`})}}return{...e,props:s}}function yj(e,t,n,r){return gj(e,t.ctx,n,r,{recurseElement:s=>vj(s,t),recurse:(s,c)=>yj(s,t,n,c)})}var ym=class extends Error{constructor(t){super(`MCP tool error: ${t||"Unknown error"}`);kn(this,"toolErrorText");this.name="McpToolError",this.toolErrorText=t}};function e6(e){var n,r;if(e.isError){const s=(n=e.content)==null?void 0:n.filter(c=>c.type==="text").map(c=>c.text).join(`
|
|
1630
|
-
`);throw new ym(s||"Unknown error")}if(e.structuredContent!=null)return e.structuredContent;const t=(r=e.content)==null?void 0:r.filter(s=>s.type==="text").map(s=>s.text??"");if(t!=null&&t.length){const s=t.join("");try{return JSON.parse(s)}catch{return s}}return null}var bm=class extends Error{constructor(t,n=[]){super(`[openui] No handler for tool "${t}". Available: ${n.join(", ")||"(none)"}`);kn(this,"toolName");kn(this,"availableTools");this.name="ToolNotFoundError",this.toolName=t,this.availableTools=n}};function M1(e){return JSON.stringify(e,(t,n)=>{if(n&&typeof n=="object"&&!Array.isArray(n)){const r={};for(const s of Object.keys(n).sort())r[s]=n[s];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 t6(e,t,n){const r=n!=null?"::"+M1(n):"";return e+"::"+M1(t)+r}function n6(e){const t=new Map,n=new Map,r=new Map,s=new Set;let c={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},u=JSON.stringify(c),d=!1,f=0;function h(){const M={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(const[_,I]of t){const B=r.get(I.cacheKey);if(B&&B.data!==void 0)M[_]=B.data;else if(I.prevCacheKey){const Z=r.get(I.prevCacheKey);Z&&Z.data!==void 0?M[_]=Z.data:M[_]=I.defaults}else M[_]=I.defaults;I.loading&&(M.__openui_loading.push(_),I.everFetched&&M.__openui_refetching.push(_)),I.error&&M.__openui_errors.push(I.error)}for(const[_,I]of n)M[_]=I.result,I.error&&M.__openui_errors.push(I.error);try{const _=JSON.stringify(M);if(_===u)return!1;c=M,u=_}catch{c=M,u=""}return!0}function g(){for(const M of[...s])M()}async function m(M,_){if(!e)return;const I=t.get(_);if(!I)return;const B=M,Z=I.toolName,$=I.args;let D=r.get(B);D?D.inFlight=!0:(D={data:void 0,inFlight:!0},r.set(B,D)),I.loading=!0,h(),g();try{const F=await e.callTool(Z,$??{});if(d)return;const V=t.get(_);if(!V||V.cacheKey!==B){D.inFlight=!1;return}if(D.data=F??null,V.everFetched=!0,V.error=void 0,V.prevCacheKey&&V.prevCacheKey!==B){const X=V.prevCacheKey;V.prevCacheKey=void 0,y(X)}}catch(F){const V=t.get(_);V&&V.cacheKey===B&&(F instanceof bm?V.error={source:"query",code:"tool-not-found",message:`Query tool "${Z}" not found`,statementId:_,component:"Query",toolName:Z,hint:F.availableTools.length?`Available tools: ${F.availableTools.join(", ")}`:void 0}:F instanceof ym?V.error={source:"query",code:"mcp-error",message:`Query "${Z}" returned an error: ${F.toolErrorText}`,statementId:_,component:"Query",toolName:Z}:V.error={source:"query",code:"tool-error",message:`Query "${Z}" failed: ${F instanceof Error?F.message:String(F)}`,statementId:_,component:"Query",toolName:Z}),console.error(`Query "${Z}" failed:`,F)}finally{D.inFlight=!1;const F=t.get(_);F&&F.cacheKey===B?(F.loading=!1,h()&&g(),F.needsRefetch&&(F.needsRefetch=!1,m(F.cacheKey,_))):h()&&g()}}function y(M){for(const _ of t.values())if(_.cacheKey===M||_.prevCacheKey===M)return;r.delete(M)}function b(M){if(d)return;const _=new Set(M.map(I=>I.statementId));for(const[I,B]of t)_.has(I)||(B.timer&&clearInterval(B.timer),t.delete(I),y(B.cacheKey),B.prevCacheKey&&y(B.prevCacheKey));for(const I of M){if(!I.complete)continue;const B=t6(I.toolName,I.args,I.deps),Z=t.get(I.statementId);Z?(Z.cacheKey!==B&&(Z.prevCacheKey=Z.cacheKey),Z.toolName=I.toolName,Z.args=I.args,Z.defaults=I.defaults,Z.cacheKey=B):t.set(I.statementId,{toolName:I.toolName,args:I.args,defaults:I.defaults,cacheKey:B,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});const $=t.get(I.statementId),D=r.get(B),F=D&&D.data!==void 0&&!D.inFlight;e&&!F&&!(D!=null&&D.inFlight)&&m(B,I.statementId);const V=I.refreshInterval??0;V!==$.refreshInterval&&($.timer&&(clearInterval($.timer),$.timer=void 0),V>0&&($.timer=setInterval(()=>{var X;d||!e||(X=r.get($.cacheKey))!=null&&X.inFlight||m($.cacheKey,I.statementId)},V*1e3)),$.refreshInterval=V)}h()&&g()}function k(M){const _=t.get(M);if(!_)return null;const I=r.get(_.cacheKey);if(I&&I.data!==void 0)return I.data;if(_.prevCacheKey){const B=r.get(_.prevCacheKey);if(B&&B.data!==void 0)return B.data}return _.defaults}function j(M){var _;return((_=t.get(M))==null?void 0:_.loading)??!1}function E(){for(const M of t.values())if(M.loading)return!0;return!1}function S(M){var I;if(d||!e)return;const _=M!=null&&M.length?M.filter(B=>t.has(B)):[...t.keys()];for(const B of _){const Z=t.get(B);Z&&((I=r.get(Z.cacheKey))!=null&&I.inFlight?Z.needsRefetch=!0:m(Z.cacheKey,B))}}function T(M){const _=new Set(M.map(I=>I.statementId));for(const I of n.keys())_.has(I)||n.delete(I);for(const I of M){const B=n.get(I.statementId);B?B.toolName!==I.toolName&&(B.toolName=I.toolName,B.result={status:"idle",data:null,error:null},B.error=void 0):n.set(I.statementId,{toolName:I.toolName,result:{status:"idle"}})}h()&&g()}async function N(M,_,I){if(d||!e)return!1;const B=n.get(M);if(!B||B.result.status==="loading")return!1;const Z=f;B.result={status:"loading"},h(),g();let $=!1;try{const D=await e.callTool(B.toolName,_);if(d||Z!==f)return!1;B.result={status:"success",data:D},B.error=void 0,$=!0}catch(D){if(d||Z!==f)return!1;const F=D instanceof Error?D.message:String(D);B.result={status:"error",error:F},D instanceof bm?B.error={source:"mutation",code:"tool-not-found",message:`Mutation tool "${B.toolName}" not found`,statementId:M,component:"Mutation",toolName:B.toolName,hint:D.availableTools.length?`Available tools: ${D.availableTools.join(", ")}`:void 0}:D instanceof ym?B.error={source:"mutation",code:"mcp-error",message:`Mutation "${B.toolName}" returned an error: ${D.toolErrorText}`,statementId:M,component:"Mutation",toolName:B.toolName}:B.error={source:"mutation",code:"tool-error",message:`Mutation "${B.toolName}" failed: ${F}`,statementId:M,component:"Mutation",toolName:B.toolName}}return h(),g(),$&&(I!=null&&I.length)&&S(I),$}function R(M){var _;return((_=n.get(M))==null?void 0:_.result)??null}function H(M){return s.add(M),()=>s.delete(M)}function A(){return c}function U(){d=!1}function G(){d=!0,f++,s.clear();for(const M of t.values())M.timer&&(clearInterval(M.timer),M.timer=void 0),M.loading=!1,M.needsRefetch=!1;n.clear()}return{evaluateQueries:b,getResult:k,isLoading:j,isAnyLoading:E,invalidate:S,registerMutations:T,fireMutation:N,getMutationResult:R,subscribe:H,getSnapshot:A,activate:U,dispose:G}}function a6(){const e=new Map,t=new Set;let n={};function r(){const m=[...t];for(const y of m)y()}function s(){n=Object.fromEntries(e)}function c(m){return e.get(m)}function u(m,y){const b=e.get(m);if(!Object.is(b,y)){if(y&&b&&typeof y=="object"&&typeof b=="object"&&!Array.isArray(y)&&!Array.isArray(b)){const k=Object.keys(y),j=Object.keys(b);if(k.length===j.length&&k.every(E=>Object.is(y[E],b[E])))return}e.set(m,y),s(),r()}}function d(m){return t.add(m),()=>{t.delete(m)}}function f(){return n}function h(m,y){for(const b of Object.keys(y))e.set(b,y[b]);for(const b of Object.keys(m))e.has(b)||e.set(b,m[b]);s(),r()}function g(){e.clear(),t.clear(),n={}}return{get:c,set:u,subscribe:d,getSnapshot:f,initialize:h,dispose:g}}function Ta(e){return E$(e)}function r6(e){return M$(e)}const bj=w.createContext(null);function xj(){const e=w.useContext(bj);if(!e)throw new Error("useOpenUI must be used within a <Renderer /> component.");return e}function i6(){return xj().renderNode}w.createContext(void 0);function xh(e){return e&&typeof e=="object"&&!Array.isArray(e)&&"value"in e?e.value:e}function s6({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:c,toolProvider:u,onError:d},f){const h=w.useMemo(()=>Z$(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(V){return g.current={source:"parser",code:"parse-exception",message:`Parser crashed: ${V instanceof Error?V.message:String(V)}`,hint:"The response may contain syntax the parser cannot handle"},null}},[h,e]),y=w.useMemo(()=>a6(),[]),b=w.useMemo(()=>n6(u??null),[u]);w.useEffect(()=>(b.activate(),()=>b.dispose()),[b]);const k=w.useRef(Symbol());w.useEffect(()=>{if(!(m!=null&&m.stateDeclarations)&&!c)return;const V=`${JSON.stringify(m==null?void 0:m.stateDeclarations)}::${JSON.stringify(c)}`;if(k.current===V)return;k.current=V;const X={};if(c)for(const[Q,L]of Object.entries(c))Q.startsWith("$")?X[Q]=L:y.set(Q,L);y.initialize((m==null?void 0:m.stateDeclarations)??{},X)},[m==null?void 0:m.stateDeclarations,y,c]);const j=w.useSyncExternalStore(y.subscribe,y.getSnapshot,y.getSnapshot),E=w.useSyncExternalStore(b.subscribe,b.getSnapshot,b.getSnapshot),S=w.useMemo(()=>({getState:V=>xh(y.get(V)),resolveRef:V=>{const X=b.getMutationResult(V);return X||b.getResult(V)}}),[y,b]);w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.queryStatements)??[]).map(X=>{const Q={};if(X.deps)for(const L of X.deps)Q[L]=j[L];return{statementId:X.statementId,toolName:X.toolAST?gt(X.toolAST,S):"",args:X.argsAST?gt(X.argsAST,S):null,defaults:X.defaultsAST?gt(X.defaultsAST,S):null,refreshInterval:X.refreshAST?gt(X.refreshAST,S):void 0,deps:Object.keys(Q).length>0?Q:void 0,complete:X.complete}});b.evaluateQueries(V)},[n,m==null?void 0:m.queryStatements,S,b,j]),w.useEffect(()=>{if(n)return;const V=((m==null?void 0:m.mutationStatements)??[]).map(X=>({statementId:X.statementId,toolName:X.toolAST?gt(X.toolAST,S):""}));b.registerMutations(V)},[n,m==null?void 0:m.mutationStatements,S,b]);const T=w.useRef({onAction:r,onStateUpdate:s,onError:d});T.current={onAction:r,onStateUpdate:s,onError:d};const N=w.useRef(m);N.current=m;const R=w.useRef(null);w.useEffect(()=>(R.current=y.getSnapshot(),y.subscribe(()=>{var X,Q;const V=y.getSnapshot();V!==R.current&&(R.current=null,(Q=(X=T.current).onStateUpdate)==null||Q.call(X,V))})),[y]);const H=w.useCallback((V,X)=>{if(!V)return xh(y.get(X));const Q=y.get(V);if(!(!Q||typeof Q!="object"||Array.isArray(Q)))return xh(Q[X])},[y]),A=w.useCallback((V,X,Q,L,P=!0)=>{var O,ne;const q={value:L,componentType:X};if(!V)y.set(Q,q);else{const ue=y.get(V),le=ue&&typeof ue=="object"&&!Array.isArray(ue)?ue:{};y.set(V,{...le,[Q]:q})}P&&((ne=(O=T.current).onStateUpdate)==null||ne.call(O,y.getSnapshot()))},[y]),U=w.useCallback(V=>{if(V){const X=y.get(V);if(X&&typeof X=="object"&&!Array.isArray(X))return{[V]:X}}return y.getSnapshot()},[y]),G=w.useCallback(async(V,X,Q)=>{var O,ne,ue;const L=U(X),{onAction:P}=T.current;if(Q&&!("steps"in Q)){const le=Q.type||gu.ContinueConversation,be={...Q.params||{}};Q.url&&(be.url=Q.url),Q.context&&(be.context=Q.context),P==null||P({type:le,params:be,humanFriendlyMessage:V,formState:L,formName:X});return}const q=Q;if(q!=null&&q.steps){for(const le of q.steps)switch(le.type){case Ma.Run:if(le.refType==="mutation"){const be=(ne=(O=N.current)==null?void 0:O.mutationStatements)==null?void 0:ne.find(Ee=>Ee.statementId===le.statementId),Re=be!=null&&be.argsAST?gt(be.argsAST,S):{};if(!await b.fireMutation(le.statementId,Re))return}else b.invalidate([le.statementId]);break;case Ma.ToAssistant:P==null||P({type:gu.ContinueConversation,params:le.context?{context:le.context}:{},humanFriendlyMessage:le.message,formState:L,formName:X});break;case Ma.OpenUrl:P==null||P({type:gu.OpenUrl,params:{url:le.url},humanFriendlyMessage:"",formState:L,formName:X});break;case Ma.Set:{if(!le.valueAST){console.warn(`[openui] Set action for ${le.target} has no valueAST — skipping`);break}const be=gt(le.valueAST,S);y.set(le.target,be);break}case Ma.Reset:{const be=((ue=N.current)==null?void 0:ue.stateDeclarations)??{};for(const Re of le.targets)y.set(Re,be[Re]??null);break}}return}P==null||P({type:gu.ContinueConversation,params:{},humanFriendlyMessage:V,formState:L,formName:X})},[b,S,U,y]),M=w.useRef([]),_=w.useRef(n);_.current=n;const I=w.useCallback(V=>{_.current||M.current.push(V)},[]),B=w.useMemo(()=>({library:t,renderNode:f,triggerAction:G,isStreaming:n,getFieldValue:H,setFieldValue:A,store:y,evaluationContext:S,reportError:I}),[t,f,n,G,H,A,y,S,I]),Z=w.useRef([]),$=w.useMemo(()=>{if(!(m!=null&&m.root))return m;const V=[],X={ctx:S,library:t,store:y,errors:V};try{const Q=vj(m.root,X);return Z.current=V,{...m,root:Q}}catch(Q){const L=Q instanceof Error?Q.message:String(Q);return V.push({source:"runtime",code:"runtime-error",message:`Prop evaluation failed: ${L}`}),Z.current=V,m}},[m,S,t,y,j,E]),D=E.__openui_loading.length>0,F=w.useRef("");return w.useEffect(()=>{var Q,L,P,q;if(n){F.current!==""&&(F.current="",(L=(Q=T.current).onError)==null||L.call(Q,[]));return}const V=[];g.current&&V.push(g.current),e&&!(m!=null&&m.root)&&!g.current&&V.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"}(...)`}),(q=(P=m==null?void 0:m.meta)==null?void 0:P.errors)!=null&&q.length&&V.push(...Q$(m.meta.errors,t.toJSONSchema(),Object.keys(t.components))),V.push(...Z.current),V.push(...M.current),M.current=[],V.push(...E.__openui_errors??[]);const X=JSON.stringify(V);if(X!==F.current){if(F.current=X,T.current.onError)T.current.onError(V);else if(V.length>0)for(const O of V)console.warn(`[openui] ${O.source}/${O.code}: ${O.message}`)}},[n,e,m,$,E,t]),{result:$,parseResult:m,contextValue:B,isQueryLoading:D}}var o6=class extends w.Component{constructor(t){super(t);kn(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,s;const n=this.props.componentName??"Unknown";(s=(r=this.props).onError)==null||s.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 wj(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)=>o.jsx(w.Fragment,{children:wj(t)},n));if(typeof e=="object"&&e!==null){const t=e;if(t.type==="element")return o.jsx(kj,{node:t})}return null}function kj({node:e}){var s;const{library:t,reportError:n}=xj(),r=(s=t.components[e.typeName])==null?void 0:s.component;return r?o.jsx(o6,{componentName:e.typeName,onError:n,children:o.jsx(l6,{el:e,Comp:r})}):null}function l6({el:e,Comp:t}){const n=i6();return o.jsx(t,{props:e.props,renderNode:n})}let D1=!1;function c6(){if(D1||typeof document>"u")return;D1=!0;const e=document.createElement("style");e.textContent="@keyframes openui-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }",document.head.appendChild(e)}const u6=()=>o.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 d6({response:e,library:t,isStreaming:n=!1,onAction:r,onStateUpdate:s,initialState:c,onParseResult:u,toolProvider:d,queryLoader:f,onError:h}){w.useInsertionEffect(()=>{c6()},[]);const g=w.useRef(u);g.current=u;const m=w.useRef(d);m.current=d;const y=w.useRef({async callTool(S,T){const N=m.current??null;if(N==null)throw new Error("[openui] toolProvider is null");if(typeof N.callTool=="function")return e6(await N.callTool({name:S,arguments:T}));const R=N,H=R[S];if(!H)throw new bm(S,Object.keys(R));return H(T)}}),{result:b,parseResult:k,contextValue:j,isQueryLoading:E}=s6({response:e,library:t,isStreaming:n,onAction:r,onStateUpdate:s,initialState:c,toolProvider:d!=null?y.current:null,onError:h},wj);return w.useEffect(()=>{var S;(S=g.current)==null||S.call(g,k)},[k]),b!=null&&b.root?o.jsx(bj.Provider,{value:j,children:o.jsxs("div",{style:{position:"relative"},children:[E&&(f??o.jsx(u6,{})),o.jsx("div",{style:{opacity:E?.7:1,transition:"opacity 0.2s ease"},children:o.jsx(kj,{node:b.root})})]})}):null}w.createContext(null);function p6(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 f6=({props:e,renderNode:t})=>{const n=e.children;return o.jsxs("div",{className:"v10-genui-root",children:[e.title?o.jsx("div",{className:"v10-genui-root-title",children:e.title}):null,Array.isArray(n)?n.map((r,s)=>o.jsx(Qe.Fragment,{children:t(r)},s)):t(n)]})},h6=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-card v10-genui-entity-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.typeLabel?o.jsx("div",{className:"v10-genui-card-type",children:e.typeLabel}):null]}),e.subtitle?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.subtitle}):null,(t=e.chips)!=null&&t.length?o.jsx("div",{className:"v10-genui-chips",children:e.chips.map((n,r)=>o.jsxs("span",{className:`v10-genui-chip tone-${n.tone??"default"}`,children:[o.jsx("span",{className:"v10-genui-chip-label",children:n.label}),o.jsx("span",{className:"v10-genui-chip-value",children:n.value})]},r))}):null]})},m6=({props:e})=>o.jsx("div",{className:"v10-genui-stats-grid",children:e.stats.map((t,n)=>o.jsxs("div",{className:"v10-genui-stat",title:t.hint,children:[o.jsx("div",{className:"v10-genui-stat-value",children:t.value}),o.jsx("div",{className:"v10-genui-stat-label",children:t.label})]},n))}),g6=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-triple-table",children:e.rows.map((t,n)=>o.jsxs("div",{className:"v10-genui-triple-row",children:[o.jsx("div",{className:"v10-genui-triple-predicate",children:Dg(t.predicate)}),o.jsx("div",{className:"v10-genui-triple-object",children:C6(t.object)})]},n))})]}),v6=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[e.heading?o.jsx("div",{className:"v10-genui-section-heading",children:e.heading}):null,o.jsx("div",{className:"v10-genui-type-groups",children:e.groups.map((t,n)=>o.jsxs("div",{className:"v10-genui-type-group",children:[o.jsxs("div",{className:"v10-genui-type-group-head",children:[t.icon?o.jsx("span",{className:"v10-genui-type-icon",children:t.icon}):null,o.jsx("span",{className:"v10-genui-type-label",children:t.typeLabel}),o.jsx("span",{className:"v10-genui-type-count",children:t.items.length})]}),o.jsx("div",{className:"v10-genui-type-items",children:t.items.map((r,s)=>o.jsxs("div",{className:"v10-genui-type-item",title:r.uri,children:[o.jsx("div",{className:"v10-genui-type-item-label",children:r.label}),r.sub?o.jsx("div",{className:"v10-genui-type-item-sub",children:r.sub}):null]},s))})]},n))})]}),y6=({props:e})=>o.jsxs("div",{className:"v10-genui-section",children:[o.jsxs("div",{className:"v10-genui-section-heading",children:[o.jsx("span",{children:e.heading}),e.predicate?o.jsxs("span",{className:"v10-genui-section-sub",children:["· ",Dg(e.predicate)]}):null]}),o.jsx("div",{className:"v10-genui-crossref",children:e.items.map((t,n)=>o.jsxs("div",{className:"v10-genui-crossref-item",title:t.uri,children:[o.jsx("span",{className:"v10-genui-crossref-label",children:t.label}),t.sub?o.jsx("span",{className:"v10-genui-crossref-sub",children:t.sub}):null]},n))})]}),b6=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-package-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#a855f7"},children:"📦"}),o.jsx("div",{className:"v10-genui-card-title",children:e.name}),e.folder?o.jsxs("div",{className:"v10-genui-card-type",children:["packages/",e.folder]}):null]}),e.description?o.jsx("div",{className:"v10-genui-card-subtitle",children:e.description}):null,o.jsxs("div",{className:"v10-genui-stats-grid",children:[typeof e.fileCount=="number"&&o.jsx(bu,{label:"Files",value:e.fileCount}),typeof e.classCount=="number"&&o.jsx(bu,{label:"Classes",value:e.classCount}),typeof e.functionCount=="number"&&o.jsx(bu,{label:"Functions",value:e.functionCount}),typeof e.interfaceCount=="number"&&o.jsx(bu,{label:"Interfaces",value:e.interfaceCount})]})]}),x6=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-file-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#3b82f6"},children:"📄"}),o.jsx("div",{className:"v10-genui-card-title",children:E6(e.path)}),e.language?o.jsxs("div",{className:"v10-genui-card-type",children:[".",e.language]}):null]}),o.jsx("div",{className:"v10-genui-card-subtitle",children:e.path}),o.jsxs("div",{className:"v10-genui-chips",children:[e.packageName?o.jsxs("span",{className:"v10-genui-chip tone-info",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"pkg"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.packageName})]}):null,typeof e.lineCount=="number"?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"lines"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.lineCount})]}):null]})]}),w6=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-decision-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#ef4444"},children:"◆"}),o.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?o.jsx("div",{className:`v10-genui-status-chip status-${e.status}`,children:e.status}):null]}),e.date?o.jsxs("div",{className:"v10-genui-card-subtitle",children:["Decided ",e.date]}):null,e.context?o.jsx(xu,{heading:"Context",body:e.context}):null,e.outcome?o.jsx(xu,{heading:"Outcome",body:e.outcome}):null,e.consequences?o.jsx(xu,{heading:"Consequences",body:e.consequences}):null,e.alternatives?o.jsx(xu,{heading:"Alternatives considered",body:e.alternatives}):null]}),k6=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-pr-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#f59e0b"},children:"⇄"}),o.jsxs("div",{className:"v10-genui-card-title",children:[typeof e.number=="number"?o.jsxs("span",{className:"v10-genui-pr-num",children:["#",e.number]}):null,e.title]}),e.state?o.jsx("div",{className:`v10-genui-status-chip pr-state-${e.state}`,children:e.state}):null]}),o.jsxs("div",{className:"v10-genui-chips",children:[e.author?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"by"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.author})]}):null,e.mergedAt?o.jsxs("span",{className:"v10-genui-chip tone-success",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"merged"}),o.jsx("span",{className:"v10-genui-chip-value",children:e.mergedAt.split("T")[0]})]}):null,(()=>{const t=p6(e.url);return t?o.jsxs("a",{className:"v10-genui-chip tone-info",href:t,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"view"}),o.jsx("span",{className:"v10-genui-chip-value",children:"github"})]}):null})()]}),e.body?o.jsx("div",{className:"v10-genui-pr-body",children:e.body}):null]}),S6=({props:e})=>o.jsxs("div",{className:"v10-genui-card v10-genui-task-card",children:[o.jsxs("div",{className:"v10-genui-card-head",children:[o.jsx("span",{className:"v10-genui-card-icon",style:{color:"#06b6d4"},children:"✓"}),o.jsx("div",{className:"v10-genui-card-title",children:e.title}),e.status?o.jsx("div",{className:`v10-genui-status-chip task-status-${e.status}`,children:e.status.replace("_"," ")}):null,e.priority?o.jsx("div",{className:`v10-genui-priority-chip priority-${e.priority}`,children:e.priority.toUpperCase()}):null]}),o.jsxs("div",{className:"v10-genui-chips",children:[e.assignee?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"assignee"}),o.jsxs("span",{className:"v10-genui-chip-value",children:["@",e.assignee]})]}):null,typeof e.estimate=="number"?o.jsxs("span",{className:"v10-genui-chip",children:[o.jsx("span",{className:"v10-genui-chip-label",children:"est"}),o.jsxs("span",{className:"v10-genui-chip-value",children:[e.estimate,"h"]})]}):null]})]}),j6=({props:e})=>{var t;return o.jsxs("div",{className:"v10-genui-vm-panel",children:[o.jsxs("div",{className:"v10-genui-vm-panel-head",children:[o.jsxs("div",{className:"v10-genui-vm-badge",children:[o.jsx("span",{className:"v10-genui-vm-badge-dot"}),"Verifiable Memory"]}),o.jsx("div",{className:"v10-genui-vm-title",children:"On-chain provenance"})]}),o.jsxs("div",{className:"v10-genui-vm-grid",children:[e.onChain?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Anchoring"}),e.onChain.txHash?o.jsx(Fi,{label:"tx",value:$1(e.onChain.txHash),mono:!0}):null,e.onChain.blockNumber?o.jsx(Fi,{label:"block",value:String(e.onChain.blockNumber),mono:!0}):null,e.onChain.chain?o.jsx(Fi,{label:"chain",value:e.onChain.chain}):null]}):null,e.consensus?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsxs("div",{className:"v10-genui-vm-block-heading",children:["Consensus ",e.consensus.quorum?o.jsx("span",{className:"v10-genui-vm-quorum",children:e.consensus.quorum}):null]}),(e.consensus.signers??[]).map((n,r)=>o.jsxs("div",{className:"v10-genui-vm-signer",children:[o.jsx("div",{className:"v10-genui-vm-signer-dot"}),o.jsxs("div",{className:"v10-genui-vm-signer-body",children:[o.jsx("div",{className:"v10-genui-vm-signer-label",children:n.label??N6(n.did)}),o.jsx("div",{className:"v10-genui-vm-signer-did",children:n.did})]}),typeof n.reputation=="number"?o.jsxs("div",{className:"v10-genui-vm-rep",children:["rep ",n.reputation]}):null]},r))]}):null,e.knowledgeAsset?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Knowledge asset"}),e.knowledgeAsset.ual?o.jsx(Fi,{label:"ual",value:e.knowledgeAsset.ual,mono:!0}):null,e.knowledgeAsset.contentHash?o.jsx(Fi,{label:"hash",value:$1(e.knowledgeAsset.contentHash),mono:!0}):null,e.knowledgeAsset.tracLocked?o.jsx(Fi,{label:"trac",value:e.knowledgeAsset.tracLocked}):null,e.knowledgeAsset.tokenId?o.jsx(Fi,{label:"nft",value:`#${e.knowledgeAsset.tokenId}`}):null]}):null,(t=e.timeline)!=null&&t.length?o.jsxs("div",{className:"v10-genui-vm-block",children:[o.jsx("div",{className:"v10-genui-vm-block-heading",children:"Timeline"}),e.timeline.map((n,r)=>o.jsxs("div",{className:"v10-genui-vm-timeline-row",children:[o.jsx("div",{className:"v10-genui-vm-timeline-dot"}),o.jsx("div",{className:"v10-genui-vm-timeline-label",children:n.label}),o.jsx("div",{className:"v10-genui-vm-timeline-at",children:n.at})]},r))]}):null]})]})},bu=({label:e,value:t})=>o.jsxs("div",{className:"v10-genui-stat",children:[o.jsx("div",{className:"v10-genui-stat-value",children:t}),o.jsx("div",{className:"v10-genui-stat-label",children:e})]}),xu=({heading:e,body:t})=>o.jsxs("div",{className:"v10-genui-decision-section",children:[o.jsx("div",{className:"v10-genui-decision-section-heading",children:e}),o.jsx("div",{className:"v10-genui-decision-section-body",children:t})]}),Fi=({label:e,value:t,mono:n})=>o.jsxs("div",{className:"v10-genui-prov-row",children:[o.jsx("span",{className:"v10-genui-prov-label",children:e}),o.jsx("span",{className:`v10-genui-prov-value${n?" mono":""}`,children:t})]});function Dg(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 C6(e){return Dg(e).replace(/\^\^<?.*$/,"").replace(/^"(.+)"$/,"$1")}function $1(e){return e?e.length<=16?e:`${e.slice(0,8)}…${e.slice(-6)}`:""}function N6(e){return e?e.length>22?`${e.slice(0,12)}…${e.slice(-6)}`:e:""}function E6(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}const T6=Ta({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:It({title:$e().optional().describe("Optional top-of-panel title override (defaults to the entity rdfs:label)")}),component:f6}),A6=Ta({name:"EntityCard",description:"Compact header card for any entity: name, rdf:type label, optional subtitle, and up to 6 small stat chips.",props:It({name:$e().describe("Display name / label of the entity"),typeLabel:$e().optional().describe('Human-readable rdf:type label (e.g. "Package", "Pull Request")'),subtitle:$e().optional().describe("Short supporting text (e.g. path, author, date)"),chips:Dr(It({label:$e(),value:$e(),tone:io(["default","success","warn","danger","info"]).optional()})).max(6).optional()}),component:h6}),R6=Ta({name:"EntityStatsGrid",description:"Grid of numeric stats with labels. Use for summarising counts (files, classes, additions, deletions).",props:It({stats:Dr(It({label:$e(),value:Og([$e(),er()]),hint:$e().optional()})).min(1).max(8)}),component:m6}),_6=Ta({name:"TripleTable",description:"Fallback raw-triples table. Use sparingly — only when the entity has no better structured components in this library.",props:It({heading:$e().optional(),rows:Dr(It({predicate:$e(),object:$e()})).max(60)}),component:g6}),O6=Ta({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:It({heading:$e().optional(),groups:Dr(It({typeLabel:$e(),icon:$e().optional(),items:Dr(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(30)})).max(8)}),component:v6}),L6=Ta({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:It({heading:$e().describe('Human-readable heading (e.g. "Imports", "Affected files")'),predicate:$e().optional(),items:Dr(It({label:$e(),uri:$e().optional(),sub:$e().optional()})).max(40)}),component:y6}),z6=Ta({name:"PackageCard",description:"Specialised card for a code:Package entity: name, folder, description, and a mini-stats strip.",props:It({name:$e(),folder:$e().optional(),description:$e().optional(),fileCount:er().optional(),classCount:er().optional(),functionCount:er().optional(),interfaceCount:er().optional()}),component:b6}),M6=Ta({name:"FileCard",description:"Specialised card for a code:File entity: path, language, line count, owning package.",props:It({path:$e(),language:$e().optional(),lineCount:er().optional(),packageName:$e().optional()}),component:x6}),D6=Ta({name:"DecisionCard",description:"Specialised card for a decisions:Decision entity: title, status badge, date, context/outcome quoted sections.",props:It({title:$e(),status:io(["proposed","accepted","rejected","superseded"]).optional(),date:$e().optional(),context:$e().optional(),outcome:$e().optional(),consequences:$e().optional(),alternatives:$e().optional()}),component:w6}),$6=Ta({name:"PRCard",description:"Specialised card for a github:PullRequest entity: title + #number, state, author, merged badge, body preview.",props:It({title:$e(),number:er().optional(),state:io(["open","closed","merged"]).optional(),author:$e().optional(),mergedAt:$e().optional(),body:$e().optional(),url:$e().optional()}),component:k6}),I6=Ta({name:"TaskCard",description:"Specialised card for a tasks:Task entity: title, status chip, priority, assignee, estimate.",props:It({title:$e(),status:io(["todo","in_progress","blocked","done","cancelled"]).optional(),priority:io(["p0","p1","p2","p3"]).optional(),assignee:$e().optional(),estimate:er().optional()}),component:S6}),P6=Ta({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:It({onChain:It({txHash:$e().optional(),blockNumber:Og([$e(),er()]).optional(),chain:$e().optional()}).optional(),consensus:It({signers:Dr(It({did:$e(),label:$e().optional(),reputation:er().optional(),signature:$e().optional()})).max(10).optional(),quorum:$e().optional().describe('e.g. "3 of 5"')}).optional(),knowledgeAsset:It({ual:$e().optional(),contentHash:$e().optional(),tracLocked:$e().optional(),tokenId:$e().optional()}).optional(),timeline:Dr(It({label:$e(),at:$e()})).max(6).optional()}),component:j6}),Sj=r6({components:[T6,A6,R6,_6,O6,L6,z6,M6,D6,$6,I6,P6],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 wh=null;function U6(){return wh===null&&(wh=Sj.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."]})),wh}async function*B6(e){const t=await fetch("/api/genui/render",{method:"POST",headers:{"Content-Type":"application/json",...Zt()},body:JSON.stringify({contextGraphId:e.contextGraphId,entityUri:e.entityUri,libraryPrompt:e.libraryPrompt}),signal:e.signal});if(!t.ok||!t.body){let c=`HTTP ${t.status}`;try{const u=await t.json();u!=null&&u.error&&(c=u.error)}catch{}yield{type:"error",error:c};return}const n=t.body.getReader(),r=new TextDecoder;let s="";try{for(;;){const{value:c,done:u}=await n.read();if(u)break;s+=r.decode(c,{stream:!0});let d;for(;(d=s.indexOf(`
|
|
1631
|
-
|
|
1632
|
-
`))!==-1;){const f=s.slice(0,d);s=s.slice(d+2);const h=I1(f);h&&(yield h)}}if(s.trim()){const c=I1(s);c&&(yield c)}}finally{n.releaseLock()}}function I1(e){let t="message",n="";for(const r of e.split(`
|
|
1633
|
-
`))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 F6=({contextGraphId:e,entityUri:t,placeholder:n,fallback:r})=>{const[s,c]=Qe.useState(""),[u,d]=Qe.useState(!0),[f,h]=Qe.useState(null);return Qe.useEffect(()=>{const g=new AbortController;let m="";return c(""),h(null),d(!0),(async()=>{try{const y=U6();for await(const b of B6({contextGraphId:e,entityUri:t,libraryPrompt:y,signal:g.signal}))if(b.type==="delta")m+=b.text,c(m);else if(b.type==="final")b.content&&(m=b.content,c(b.content));else if(b.type==="error"){h(b.error);break}else if(b.type==="done")break}catch(y){y.name!=="AbortError"&&h(y.message)}finally{d(!1)}})(),()=>g.abort()},[e,t]),f?r?o.jsx(o.Fragment,{children:r(f)}):o.jsx(q6,{error:f}):!s&&u?o.jsx(o.Fragment,{children:n??o.jsx("div",{className:"v10-genui-loading",children:"Composing detail view…"})}):o.jsx("div",{className:"v10-genui-panel",children:o.jsx(d6,{response:s,library:Sj,isStreaming:u})})},H6="LLM not configured",q6=({error:e})=>{const t=vn(r=>r.openTab);return e.includes(H6)?o.jsxs("div",{className:"v10-genui-error v10-genui-error-cta",children:[o.jsxs("div",{className:"v10-genui-error-head",children:[o.jsx("span",{className:"v10-genui-error-icon",children:"⚙"}),o.jsxs("div",{children:[o.jsx("div",{className:"v10-genui-error-title",children:"Set up your LLM to enable GenUI"}),o.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."})]})]}),o.jsx("button",{className:"v10-genui-error-cta-btn",onClick:()=>t({id:"settings",label:"Settings",closable:!0}),children:"Open Settings →"})]}):o.jsxs("div",{className:"v10-genui-error",children:["GenUI unavailable: ",e]})};function P1({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),s=(r==null?void 0:r.color)??"#64748b",c=(r==null?void 0:r.icon)??"•",u=(r==null?void 0:r.displayName)??n;return o.jsxs("span",{className:"v10-subgraph-badge",style:{"--sg-color":s},title:`In sub-graph: ${u}`,children:[o.jsx("span",{className:"v10-subgraph-badge-icon",style:{color:s},children:c}),o.jsx("span",{className:"v10-subgraph-badge-label",children:u})]})}function G6({entity:e,contextGraphId:t,onVerified:n}){const r=Ir(),[s,c]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(null),y=e.trustLevel,b=w.useMemo(()=>{if(!r)return null;for(const N of e.types){const R=r.forType(N);if(R&&(y==="working"&&(R.promoteLabel||R.promoteHint)||y==="shared"&&(R.publishLabel||R.publishHint)))return R}return null},[e.types,r,y]),k=w.useMemo(()=>{if(!r)return null;for(const N of e.subGraphs){if(N==="meta")continue;const R=r.forSubGraph(N);if(R!=null&&R.sourceAssertion)return{binding:R,subGraph:N}}return null},[e.subGraphs,r]);if(y==="verified"||!b)return null;const j=y==="working"?{kind:"promote",label:b.promoteLabel??"Promote to Shared Memory",hint:b.promoteHint??"Shares this entity 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(N=>N!=="meta")[0]??"?"}".`}:{kind:"publish",label:b.publishLabel??"Verify on DKG",hint:b.publishHint??"Anchors this entity on-chain.",busyCopy:"Anchoring…",disabled:!1,disabledReason:null},E=async()=>{if(j.disabled)return;c(!0),m(null),d(null),h(j.kind);const N=(k==null?void 0:k.binding.sourceAssertion)??"assertion";try{if(j.kind==="promote"){const R=await eo(t,k.binding.sourceAssertion,[e.uri],k.subGraph);d(ng(N,R))}else{const R=await Jh(t,[e.uri]);d(R)}n()}catch(R){const H=j.kind==="promote"?to(N,R):null,A=j.kind==="promote"?null:Al(R);m((H==null?void 0:H.message)??A??(R==null?void 0:R.message)??"Action failed")}finally{c(!1)}},S=N=>!!N&&"status"in N,T=N=>!!N&&"kind"in N;return o.jsxs("div",{className:`v10-ka-verify v10-ka-verify-${j.kind}`,children:[o.jsxs("div",{className:"v10-ka-verify-head",children:[o.jsx("span",{className:"v10-ka-verify-arrow",children:j.kind==="promote"?"◈":"◉"}),o.jsx("span",{className:"v10-ka-verify-title",children:j.label})]}),o.jsx("div",{className:"v10-ka-verify-hint",children:j.hint}),j.disabledReason&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",j.disabledReason]}),!u&&o.jsx("button",{className:`v10-ka-verify-btn ${j.kind}`,onClick:E,disabled:s||j.disabled,children:s?j.busyCopy:j.label}),g&&o.jsxs("div",{className:"v10-ka-verify-err",children:["✕ ",g]}),u&&f==="promote"&&T(u)&&u.kind==="success"&&o.jsxs("div",{className:"v10-ka-verify-ok",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Promoted"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:["✓ ",u.promotedCount," triple",u.promotedCount===1?"":"s"," now in Shared Memory"]})]}),o.jsx("div",{className:"v10-ka-verify-hint",style:{marginTop:6},children:"Refresh the entity to see the next step appear."})]}),u&&f==="promote"&&T(u)&&u.kind!=="success"&&o.jsxs("div",{className:"v10-ka-verify-err",children:["! ",u.message]}),u&&f==="publish"&&S(u)&&(()=>{var R,H;const N=u.status==="confirmed"&&!!u.txHash;return o.jsxs("div",{className:N?"v10-ka-verify-ok":"v10-ka-verify-err",children:[o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Status"}),o.jsxs("span",{className:"v10-ka-verify-ok-val",children:[N?"✓":"✕"," ",u.status,N?"":" (NOT on-chain)"]})]}),u.txHash?o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val mono",title:u.txHash,children:u.txHash})]}):o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"TX hash"}),o.jsx("span",{className:"v10-ka-verify-ok-val",children:"none — on-chain submission skipped"})]}),u.blockNumber!=null&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Block"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.blockNumber]})]}),((H=(R=u.kas)==null?void 0:R[0])==null?void 0:H.tokenId)&&o.jsxs("div",{className:"v10-ka-verify-ok-row",children:[o.jsx("span",{className:"v10-ka-verify-ok-lbl",children:"Token"}),o.jsxs("span",{className:"v10-ka-verify-ok-val mono",children:["#",u.kas[0].tokenId]})]})]})})()]})}function V6({entity:e,allEntities:t,allTriples:n,onNavigate:r,onClose:s,contextGraphId:c,onRefresh:u,onOpenAgent:d}){const[f,h]=w.useState("content"),g=qn($=>$.theme),m=Ir(),y=ns(),{icon:b,type:k}=Cd(e,m),j=aL(e),E=jd(e),S=E?(y==null?void 0:y.get(E))??null:null,T=e.trustLevel==="verified"?"vm":e.trustLevel==="shared"?"swm":"wm",N=e.trustLevel==="verified"?"Verifiable Memory":e.trustLevel==="shared"?"Shared Working Memory":"Working Memory",R=Or(e.trustLevel,1),H=w.useMemo(()=>{const $=[];for(const[,D]of t)for(const F of D.connections)F.targetUri===e.uri&&$.push({pred:Bs(F.predicate),entity:D});return $},[e.uri,t]),A=w.useMemo(()=>n.filter($=>yt($.subject)===e.uri||yt($.object)===e.uri),[e.uri,n]),U=w.useMemo(()=>rL(e.uri,n,1),[e.uri,n]),G=w.useMemo(()=>{const $=new Set;for(const D of t.values())oS(D)&&$.add(yt(D.uri));return $},[t]),M=w.useMemo(()=>new Set([yt(e.uri)]),[e.uri]),_=w.useMemo(()=>Ku(U,G,{focalSubjects:M}),[U,G,M]),I=w.useMemo(()=>{const $=Gi[e.trustLevel];return{labelMode:"humanized",renderer:"2d",labels:kd({minZoomForLabels:.2}),style:{namespaceColors:mg($),defaultNodeColor:$,defaultEdgeColor:"#475569",edgeWidth:1,fontSize:11},hexagon:{baseSize:7,minSize:4,maxSize:10,scaleWithDegree:!0},focus:{maxNodes:500,hops:999}}},[e.trustLevel]),B=w.useMemo(()=>({name:`entity-${e.uri}-${g}`,palette:g,focal:{uri:e.uri,sizeMultiplier:2.4}}),[e.uri,g]),Z=A.length;return o.jsxs("div",{className:"v10-ka-detail",children:[o.jsxs("div",{className:"v10-ka-header",children:[o.jsx("button",{className:"v10-ka-back",onClick:s,children:"← Back to Context Graph"}),o.jsxs("div",{className:"v10-ka-header-left",children:[o.jsx("div",{className:"v10-ka-label",children:R}),o.jsxs("div",{className:"v10-ka-name",children:[b," ",e.label,o.jsx("span",{className:`v10-trust-badge ${T}`,children:N})]}),o.jsxs("div",{className:"v10-ka-ual",children:[e.uri," · ",k," · ",Z," triples"]})]}),(S||E)&&o.jsxs("div",{className:"v10-ka-header-author",children:[o.jsx("div",{className:"v10-ka-header-author-label",children:"Proposed by"}),o.jsx(Yi,{agent:S??void 0,fallbackUri:E??void 0,size:"lg",showOperator:!0,onOpenAgent:d})]})]}),o.jsxs("div",{className:"v10-ka-split",children:[o.jsxs("div",{className:"v10-ka-left",children:[o.jsxs("div",{className:"v10-content-tabs",style:{margin:"0 -20px",padding:"0 20px",background:"transparent"},children:[o.jsx("button",{className:`v10-content-tab ${f==="content"?"active":""}`,onClick:()=>h("content"),children:"Content"}),o.jsx("button",{className:`v10-content-tab ${f==="triples"?"active":""}`,onClick:()=>h("triples"),children:"Triples"}),o.jsx("button",{className:`v10-content-tab ${f==="graph"?"active":""}`,onClick:()=>h("graph"),children:"Graph"})]}),f==="content"&&o.jsxs(o.Fragment,{children:[!e.types.map(D=>m==null?void 0:m.forType(D)).find(D=>D==null?void 0:D.detailHint)||!(m!=null&&m.contextGraphId)?null:o.jsx("div",{className:"v10-ka-section",children:o.jsx(F6,{contextGraphId:m.contextGraphId,entityUri:e.uri})}),j&&o.jsx("div",{className:"v10-ka-section",children:o.jsx("div",{className:"v10-ka-desc",children:o.jsx("p",{children:j})})}),e.properties.size>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsx("div",{className:"v10-ka-section-title",children:"Properties"}),[...e.properties].map(([$,D])=>o.jsxs("div",{className:"v10-ka-prop",children:[o.jsx("span",{className:"v10-ka-prop-key",children:Bs($)}),o.jsx("span",{className:"v10-ka-prop-val",children:D.join(", ")})]},$))]}),e.connections.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["References (",e.connections.length,")"]}),e.connections.map(($,D)=>{const F=t.get($.targetUri);return o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r($.targetUri),children:[o.jsx("span",{className:"v10-ka-conn-pred",children:Bs($.predicate)}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-target",children:$.targetLabel}),F&&o.jsx(P1,{entity:F,profile:m})]},D)})]}),H.length>0&&o.jsxs("div",{className:"v10-ka-section",children:[o.jsxs("div",{className:"v10-ka-section-title",children:["Referenced by (",H.length,")"]}),H.map(($,D)=>o.jsxs("button",{className:"v10-ka-conn",onClick:()=>r($.entity.uri),children:[o.jsx("span",{className:"v10-ka-conn-target",children:$.entity.label}),o.jsx(P1,{entity:$.entity,profile:m}),o.jsx("span",{className:"v10-ka-conn-arrow",children:"→"}),o.jsx("span",{className:"v10-ka-conn-pred",children:$.pred})]},D))]}),o.jsxs("div",{className:"v10-ka-meta",children:[o.jsxs("span",{className:"v10-ka-meta-item",children:[b," ",k]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[Z," triples"]}),o.jsxs("span",{className:"v10-ka-meta-item",children:[e.connections.length," links"]})]})]}),f==="triples"&&o.jsxs("div",{style:{marginTop:8,overflowX:"auto",border:"1px solid var(--border-default)",borderRadius:6},children:[o.jsxs("table",{className:"v10-ka-triples-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:A.slice(0,50).map(($,D)=>o.jsxs("tr",{children:[o.jsx("td",{title:$.subject,children:Bs($.subject)}),o.jsx("td",{title:$.predicate,children:Bs($.predicate)}),o.jsx("td",{title:$.object,children:$.object.startsWith('"')?Sd($.object).slice(0,60):Bs($.object)})]},D))})]}),o.jsxs("div",{style:{fontSize:10,color:"var(--text-tertiary)",fontFamily:"var(--font-mono)",padding:"6px 8px"},children:[Math.min(A.length,50)," of ",A.length," triples shown"]})]}),f==="graph"&&o.jsx(Mu,{title:`${e.label} graph`,scopeLabel:`Entity detail graph: 1-hop neighborhood around ${e.label}.`,tone:T,className:"v10-ka-graph-shell",renderGraph:$=>_.length>0?o.jsx(w.Suspense,{fallback:o.jsx("span",{className:"v10-graph-placeholder",children:"Loading graph..."}),children:o.jsx(kg,{data:_,format:"triples",options:I,viewConfig:B,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:D=>(D==null?void 0:D.id)&&D.id!==e.uri&&r(D.id),initialFit:!0,initialFocus:e.uri},`${e.uri}:${$?"expanded":"inline"}`)}):o.jsx("div",{className:"v10-graph-placeholder v10-graph-placeholder-centered",children:"No neighborhood data"})})]}),o.jsxs("div",{className:"v10-ka-right",children:[o.jsx(xz,{contextGraphId:c,entityUri:e.uri,enabled:e.trustLevel==="verified"}),o.jsx("div",{className:"v10-ka-section-title",children:"Provenance Trail"}),o.jsx(W6,{entity:e}),o.jsx(G6,{entity:e,contextGraphId:c,onVerified:u}),o.jsxs("div",{style:{marginTop:16,padding:"10px 12px",borderRadius:6,background:"var(--bg-surface)",border:"1px solid var(--border-subtle)"},children:[o.jsx("div",{className:"v10-ka-section-title",style:{marginBottom:6},children:"Entity Summary"}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,fontSize:10},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Type"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:k})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Triples"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:Z})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Links"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:e.connections.length})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Layer"}),o.jsx("span",{style:{color:"var(--text-primary)",fontWeight:600,fontFamily:"var(--font-mono)"},children:N.split(" ")[0]})]})]})]})]})]})]})}function W6({entity:e}){const t=ns(),n=u=>{const d=eL(e,u),f=tL(e,u),h=d?t==null?void 0:t.get(d):null;return{uri:d,at:f,agent:h}},r=n("created"),s=n("promoted"),c=n("published");return o.jsxs("div",{className:"v10-ka-timeline",children:[e.trustLevel==="verified"&&o.jsx(kh,{toneClass:"verified",title:"Published to Verifiable Memory",actionWord:"Published",agent:c.agent,agentUri:c.uri,at:c.at}),(e.trustLevel==="shared"||e.trustLevel==="verified")&&o.jsx(kh,{toneClass:"shared",title:"Promoted to Shared Working Memory",actionWord:"Promoted",agent:s.agent,agentUri:s.uri,at:s.at}),o.jsx(kh,{toneClass:"created",title:"Created in Working Memory",actionWord:"Created",agent:r.agent,agentUri:r.uri,at:r.at})]})}function kh({toneClass:e,title:t,actionWord:n,agent:r,agentUri:s,at:c}){const u=c?lL(c):null;return o.jsxs("div",{className:"v10-ka-event",children:[o.jsx("div",{className:`v10-ka-event-dot ${e}`}),o.jsxs("div",{className:"v10-ka-event-header",children:[o.jsx("span",{className:"v10-ka-event-title",children:t}),u&&o.jsx("time",{className:"v10-ka-event-time",dateTime:c??void 0,children:u})]}),(r||s)&&o.jsxs("div",{className:"v10-ka-event-attribution",children:[o.jsxs("span",{className:"v10-ka-event-attribution-prefix",children:[n," by"]}),o.jsx(Yi,{agent:r??void 0,fallbackUri:s??void 0,size:"sm"})]})]})}function U1(){return o.jsxs("div",{className:"v10-subgraph-explorer-header",children:[o.jsx("div",{className:"v10-subgraph-explorer-title",children:"Subgraph Explorer"}),o.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 Z6({contextGraphId:e,memory:t,onNodeClick:n,onSelectSubGraph:r}){const s=Ir(),[c,u]=w.useState([]),[d,f]=w.useState(!0),[h,g]=w.useState(null);w.useEffect(()=>{let A=!1;return f(!0),g(null),ig(e).then(U=>{A||u(U.subGraphs??[])}).catch(U=>{A||g(U instanceof Error?U.message:"Failed to load subgraphs")}).finally(()=>{A||f(!1)}),()=>{A=!0}},[e]);const{total:m}=vg(t),y=Object.values(t.layerStatus??{}),b=t.loading||y.some(A=>A==="loading"),k=t.error!==null||t.partial||y.some(A=>A==="error"),j=w.useMemo(()=>{const A=new Map;for(const U of t.entityList){const G=yt(U.uri);for(const M of U.subGraphs){let _=A.get(M);_||(_=new Set,A.set(M,_)),_.add(G)}}return A},[t.entityList]),{triplesBySubGraph:E,tripleCountBySubGraph:S}=w.useMemo(()=>{const A=new Map;for(const M of t.allTriples){if(!M.subGraph)continue;let _=A.get(M.subGraph);_||(_=[],A.set(M.subGraph,_)),_.push(M)}for(const M of t.allTriples)if(!M.subGraph){for(const[_,I]of j)if(rm(M,{slug:_,isRoot:!1,scopedUris:I})){let B=A.get(_);B||(B=[],A.set(_,B)),B.push(M)}}const U=new Map,G=new Map;for(const[M,_]of A){const B=im(_,t.entities).map(Z=>({subject:Z.subject,predicate:Z.predicate,object:Z.object}));G.set(M,B.length),U.set(M,Wx(B))}return{triplesBySubGraph:U,tripleCountBySubGraph:G}},[t.allTriples,t.entities,j]),T=w.useMemo(()=>{const A=new Map;for(const U of t.entityList)for(const G of U.subGraphs){let M=A.get(G);M||(M={wm:0,swm:0,vm:0},A.set(G,M)),U.trustLevel==="verified"?M.vm++:U.trustLevel==="shared"?M.swm++:M.wm++}return A},[t.entityList]),N=w.useMemo(()=>{const A=new Map;for(const U of t.entityList){const G=yt(U.uri);for(const M of U.subGraphs){let _=A.get(M);_||(_=new Map,A.set(M,_)),_.set(G,U.trustLevel),G!==U.uri&&_.set(U.uri,U.trustLevel)}}return A},[t.entityList]),R=w.useMemo(()=>c.filter(yg).map(A=>{const U=(s==null?void 0:s.forSubGraph(A.name))??{},G=E.get(A.name)??[],M=j.get(A.name)??new Set,_=N.get(A.name)??new Map;return{slug:A.name,icon:U.icon??"•",color:U.color??"#64748b",displayName:U.displayName??A.name,description:U.description,rank:U.rank??99,entityCount:M.size>0?M.size:A.entityCount,tripleCount:S.get(A.name)??0,triples:Ku(G,M),layerCounts:T.get(A.name)??{wm:0,swm:0,vm:0},entityTrustByUri:_}}).sort((A,U)=>A.rank-U.rank),[c,s,E,S,T,j,N]),H=w.useMemo(()=>{const A=[],U=new Set,G=new Map;let M=0,_=0,I=0;for(const X of t.entityList){if(X.subGraphs.size>0)continue;A.push(X);const Q=yt(X.uri);U.add(Q),G.set(Q,X.trustLevel),Q!==X.uri&&G.set(X.uri,X.trustLevel),X.trustLevel==="verified"?I++:X.trustLevel==="shared"?_++:M++}const B=t.allTriples.filter(X=>!X.subGraph),Z=im(B,t.entities).map(X=>({subject:X.subject,predicate:X.predicate,object:X.object})),$=Z.length,D=Ku(Z,U),F=Wx(D),V=(s==null?void 0:s.forSubGraph(za))??{};return{slug:za,icon:V.icon??"⊘",color:V.color??"#64748b",displayName:V.displayName??"Root",description:V.description,rank:999,entityCount:A.length,tripleCount:$,triples:F,layerCounts:{wm:M,swm:_,vm:I},entityTrustByUri:G}},[t.entityList,t.allTriples,t.entities,s]);return d&&R.length===0?o.jsx(sn,{compact:!0,icon:"#",title:"Loading subgraphs...",className:"v10-sgov-state"}):h&&R.length===0?o.jsx(sn,{icon:"!",title:"Couldn't load subgraphs.",description:"Refresh the page to try again.",tone:"danger",className:"v10-sgov-state"}):R.length===0&&H.entityCount===0?o.jsx(sn,{icon:"#",title:"No subgraphs in this Context Graph yet.",description:o.jsxs(o.Fragment,{children:["A subgraph is a named topical slice of this Context Graph (e.g. ",o.jsx("code",{children:"recipes"}),", ",o.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(za),variant:"primary"}],className:"v10-sgov-state"}):o.jsxs("div",{className:"v10-sgov",children:[o.jsxs("div",{className:"v10-sgov-header",children:[o.jsx("div",{className:"v10-sgov-title",children:"Subgraphs"}),o.jsxs("div",{className:"v10-sgov-sub",children:[R.length," named subgraphs · ",t.counts.total," entities · ",m," triples"]})]}),o.jsxs("div",{className:"v10-sgov-grid",children:[R.map(A=>o.jsx(B1,{card:A,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(A.slug)},A.slug)),o.jsx(B1,{card:H,isHydrating:b,isFailedOrPartial:k,onNodeClick:n,onOpen:()=>r(za),variant:"root"},za)]})]})}function B1({card:e,isHydrating:t=!1,isFailedOrPartial:n=!1,onNodeClick:r,onOpen:s,variant:c}){const u=w.useMemo(()=>{const h={};for(const[g,m]of e.entityTrustByUri)h[g]=Gi[m];return h},[e.entityTrustByUri]),d=w.useMemo(()=>({labelMode:"humanized",renderer:"2d",labels:kd({minZoomForLabels:.8}),style:{classColors:fS,predicateColors:hS,namespaceColors:mg(e.color),...Object.keys(u).length>0?{nodeColors:u}:{},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,u]),f=c==="root";return o.jsxs("div",{className:`v10-sgov-card${f?" root":""}`,style:f?void 0:{"--sg-color":e.color,borderColor:e.color+"55"},children:[o.jsxs("div",{className:"v10-sgov-card-head",children:[o.jsx("span",{className:"v10-sgov-card-icon",style:f?void 0:{color:e.color},children:e.icon}),o.jsxs("div",{className:"v10-sgov-card-title-wrap",children:[o.jsx("div",{className:"v10-sgov-card-title",children:e.displayName}),e.description&&o.jsx("div",{className:"v10-sgov-card-desc",title:e.description,children:e.description})]}),o.jsx("button",{type:"button",className:"v10-sgov-card-open",onClick:s,title:`Focus on ${e.displayName}`,children:"↗"})]}),o.jsxs("div",{className:"v10-sgov-card-stats",children:[o.jsxs("span",{className:"v10-sgov-card-stat",children:[o.jsx("b",{children:e.entityCount})," entities"]}),o.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:[o.jsx("b",{children:t&&e.tripleCount===0?"…":e.tripleCount})," triples"]})]}),o.jsx("div",{className:"v10-sgov-card-pyramid",children:o.jsx(jj,{counts:e.layerCounts,compact:!0})}),o.jsx("div",{className:"v10-sgov-card-graph",children:e.triples.length===0?o.jsx("div",{className:"v10-sgov-card-empty",children:e.entityCount>0?"Promoted — open to view":"No data yet"}):o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-sgov-card-empty",children:"Loading…"}),children:o.jsx(kg,{data:e.triples,format:"triples",options:d,style:{position:"absolute",inset:0,width:"100%",height:"100%"},onNodeClick:r,initialFit:!0})})})]})}function jj({counts:e,activeLayers:t,onClickLayer:n,compact:r=!1}){const s=e.wm+e.swm+e.vm;if(s===0)return r?null:o.jsx("div",{className:"v10-minibar v10-minibar-empty",children:"No data"});const c=[{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"}],u=!!n;return o.jsxs("div",{className:`v10-minibar${r?" compact":""}`,children:[!r&&o.jsx("div",{className:"v10-minibar-bar",children:c.filter(d=>d.count>0).map(d=>{const f=d.count/s*100,h=t?t.has(d.key):!0;return o.jsx("div",{className:`v10-minibar-seg${h?"":" dim"}`,style:{width:`${f}%`,background:d.color},title:`${d.label}: ${d.count}`},d.key)})}),o.jsx("div",{className:"v10-minibar-legend",children:c.map(d=>{const f=t?t.has(d.key):!0;return o.jsxs("button",{type:"button",className:`v10-minibar-chip${f?"":" dim"}${u?" interactive":""}`,onClick:u?()=>n(d.key):void 0,disabled:!u,title:`${d.label} Memory — ${d.count} entities${u?" (click to toggle)":""}`,children:[o.jsx("span",{className:"v10-minibar-dot",style:{background:d.color}}),o.jsx("span",{className:"v10-minibar-short",children:d.short}),o.jsx("span",{className:"v10-minibar-count",children:d.count})]},d.key)})})]})}function Y6({items:e,color:t,onSelectEntity:n,scrollKey:r}){const s=Ir(),c=ns(),u=w.useMemo(()=>{const d=new Map;for(const f of e){const h=`${f.date.getFullYear()}-${String(f.date.getMonth()+1).padStart(2,"0")}`,g=d.get(h)??[];g.push(f),d.set(h,g)}return[...d.entries()].sort((f,h)=>f[0].localeCompare(h[0]))},[e]);return e.length===0?o.jsx("div",{className:"v10-subgraph-timeline-empty","data-cg-scroll-key":r,children:o.jsx(sn,{compact:!0,title:"No timeline values yet.",description:"Entities in this sub-graph do not currently expose the configured timeline field."})}):o.jsx("div",{className:"v10-subgraph-timeline","data-cg-scroll-key":r,children:u.map(([d,f])=>o.jsxs("div",{className:"v10-subgraph-timeline-bucket",children:[o.jsxs("div",{className:"v10-subgraph-timeline-bucket-head",children:[o.jsx("span",{className:"v10-subgraph-timeline-bucket-dot",style:{background:t}}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-label",children:cL(d)}),o.jsx("span",{className:"v10-subgraph-timeline-bucket-count",children:f.length})]}),o.jsx("div",{className:"v10-subgraph-timeline-items",children:f.map(({entity:h,date:g})=>{const{icon:m}=Cd(h,s),y=jd(h),b=y?c==null?void 0:c.get(y):null;return o.jsxs("button",{className:"v10-subgraph-timeline-item",onClick:()=>n(h.uri),title:`${h.label} · ${g.toISOString().slice(0,10)}`,children:[o.jsx("span",{className:"v10-subgraph-timeline-item-icon",children:m}),o.jsx("span",{className:"v10-subgraph-timeline-item-label",children:h.label}),(b||y)&&o.jsx(Yi,{agent:b??void 0,fallbackUri:y??void 0,size:"sm"}),o.jsx("span",{className:"v10-subgraph-timeline-item-date",children:g.toISOString().slice(0,10)})]},h.uri)})})]},d))})}function Q6({slug:e,rawMemory:t,contextGraphId:n,onNodeClick:r,onSelectEntity:s,activeTab:c,onTabChange:u,initialLayer:d,initialEnabledLayers:f,onEnabledLayersChange:h}){const g=Ir(),m=g==null?void 0:g.forSubGraph(e),y=(g==null?void 0:g.chipsFor(e))??[],b=(g==null?void 0:g.savedQueryCatalogsFor(e))??[],k=m==null?void 0:m.timelinePredicate,[j,E]=w.useState("items"),S=c??j,T=S==="timeline"&&!k?"items":S,N=u??E,[R,H]=w.useState(m!=null&&m.timelinePredicate?"created-desc":"triples");w.useEffect(()=>{H(m!=null&&m.timelinePredicate?"created-desc":"triples")},[e,m==null?void 0:m.timelinePredicate]);const A=w.useMemo(()=>f&&f.size>0?new Set(f):d==="wm"?new Set(["working"]):d==="swm"?new Set(["shared"]):d==="vm"?new Set(["verified"]):new Set(["working","shared","verified"]),[d,f]),[U,G]=w.useState(A);w.useEffect(()=>{h==null||h(U)},[U,h]);const[M,_]=w.useState(new Map),[I,B]=w.useState(null),[Z,$]=w.useState(null),[D,F]=w.useState(!1),[V,X]=w.useState(null),Q=e===za,L=w.useMemo(()=>{const ee=[];for(const ce of t.entityList)(Q?ce.subGraphs.size===0:ce.subGraphs.has(e))&&ee.push(ce);return ee},[t.entityList,e,Q]),P=w.useMemo(()=>new Set(L.map(ee=>ee.uri)),[L]),q=w.useMemo(()=>t.graphTriples.filter(ee=>rm(ee,{slug:e,isRoot:Q,scopedUris:P})),[t.graphTriples,P,e,Q]),O=w.useMemo(()=>{let ee=0,ce=0,he=0;for(const Le of L)Le.trustLevel==="verified"?he++:Le.trustLevel==="shared"?ce++:ee++;return{wm:ee,swm:ce,vm:he,total:L.length}},[L]),ne=w.useMemo(()=>{if(U.size!==1)return null;const ee=U.values().next().value;return ee==="verified"?"vm":ee==="shared"?"swm":ee==="working"?"wm":null},[U]),ue=w.useMemo(()=>{let ee=L;if(U.size<3&&(ee=ee.filter(ce=>U.has(ce.trustLevel))),M.size>0)for(const ce of y){const he=M.get(ce.slug);!he||he.size===0||(ee=ee.filter(Le=>{const He=Le.properties.get(ce.predicate);return!He||He.length===0?!1:He.some(Ce=>he.has(Ce))}))}return Z&&(ee=ee.filter(ce=>Z.has(ce.uri))),ee},[L,U,M,y,Z]),le=w.useMemo(()=>new Set(ue.map(ee=>ee.uri)),[ue]),be=w.useMemo(()=>ue.length===L.length?q:q.filter(ee=>le.has(ee.subject)||le.has(ee.object)),[q,L,ue,le]),Ee=w.useMemo(()=>{if(!ne)return null;const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working",ce=L.filter(Ce=>{if(!Ce.layers.has(ee))return!1;if(M.size>0)for(const Fe of y){const et=M.get(Fe.slug);if(!et||et.size===0)continue;const Ne=Ce.properties.get(Fe.predicate);if(!Ne||Ne.length===0||!Ne.some(Gt=>et.has(Gt)))return!1}return!(Z&&!Z.has(Ce.uri))}),he=new Set(ce.map(Ce=>Ce.uri)),Le=new Set,He=[];for(const Ce of t.allTriples){if(Ce.layer!==ee||!rm(Ce,{slug:e,isRoot:Q,scopedUris:P,requireResourceObject:!0})||!(he.has(Ce.subject)||he.has(Ce.object)))continue;const Fe=`${Ce.subject}|${Ce.predicate}|${Ce.object}`;Le.has(Fe)||(Le.add(Fe),He.push({subject:Ce.subject,predicate:Ce.predicate,object:Ce.object,subGraph:Ce.subGraph}))}return He},[ne,t.allTriples,P,e,Q,L,y,M,Z])??be,Ie=w.useMemo(()=>{if(ne){const ee=ne==="vm"?"verified":ne==="swm"?"shared":"working";return L.filter(ce=>{if(!ce.layers.has(ee))return!1;if(M.size>0)for(const he of y){const Le=M.get(he.slug);if(!Le||Le.size===0)continue;const He=ce.properties.get(he.predicate);if(!He||He.length===0||!He.some(Ce=>Le.has(Ce)))return!1}return!(Z&&!Z.has(ce.uri))})}return ue},[ne,L,ue,y,M,Z]),Ve=w.useMemo(()=>Ie.map(ee=>({uri:ee.uri,label:ee.label})),[Ie]),Se=w.useMemo(()=>{if(ne)return;const ee={};for(const ce of Ie){ee[ce.uri]=Gi[ce.trustLevel];const he=yt(ce.uri);he!==ce.uri&&(ee[he]=Gi[ce.trustLevel])}return ee},[ne,Ie]),ft=U.size===3?"All layers":ne?Mn[ne].title:Array.from(U).map(ee=>Mn[ee==="verified"?"vm":ee==="shared"?"swm":"wm"].trustLabel).join(" + "),Me=w.useMemo(()=>{if(!k)return[];const ee=[];for(const ce of ue){const he=zu(ce,k);he!=null&&ee.push({entity:ce,date:new Date(he)})}return ee.sort((ce,he)=>ce.date.getTime()-he.date.getTime()),ee},[ue,k]),qe=w.useMemo(()=>{const ee=[...ue];if((R==="created-desc"||R==="created-asc")&&k){const ce=R==="created-desc"?-1:1;return ee.sort((he,Le)=>{const He=zu(he,k),Ce=zu(Le,k);return He==null&&Ce==null?0:He==null?1:Ce==null?-1:(He-Ce)*ce}),ee}return R==="label"?(ee.sort((ce,he)=>(ce.label??"").localeCompare(he.label??"")),ee):(ee.sort((ce,he)=>{const Le=ce.tripleCount??0;return(he.tripleCount??0)-Le}),ee)},[ue,R,k]),ke=R==="created-desc"?"newest first · click to open":R==="created-asc"?"oldest first · click to open":R==="label"?"A → Z · click to open":"sorted by triples · click to open",lt=w.useCallback(ee=>{G(ce=>{const he=new Set(ce);return he.has(ee)?he.size>1&&he.delete(ee):he.add(ee),he})},[]),xe=w.useCallback((ee,ce)=>{_(he=>{const Le=new Map(he),He=new Set(Le.get(ee)??[]);return He.has(ce)?He.delete(ce):He.add(ce),He.size===0?Le.delete(ee):Le.set(ee,He),Le})},[]),Oe=w.useCallback(()=>{B(null),$(null),X(null)},[]),_t=w.useCallback(async ee=>{var ce;F(!0),X(null),B(ee.slug);try{const he=await ia(ee.sparql,n),Le=((ce=he==null?void 0:he.result)==null?void 0:ce.bindings)??[],He=ee.resultColumn||"uri",Ce=new Set;for(const Fe of Le){const et=Fe[He];if(!et)continue;const Ne=typeof et=="string"?et:String(et),Gt=Ne.startsWith("<")&&Ne.endsWith(">")?Ne.slice(1,-1):Ne;Ce.add(Gt)}$(Ce)}catch(he){X((he==null?void 0:he.message)??String(he)),$(null),B(null)}finally{F(!1)}},[n]),Dt=(m==null?void 0:m.color)??(Q?"var(--text-tertiary)":"#64748b"),Yt=(m==null?void 0:m.icon)??"•",Ft=(m==null?void 0:m.displayName)??e,ut=m==null?void 0:m.description;w.useEffect(()=>{G(A),_(new Map),Oe()},[e,Oe,A]),w.useEffect(()=>{c||E("items")},[e,c]),w.useEffect(()=>{S!==T&&N(T)},[S,T,N]);const K=!(U.size===A.size&&[...U].every(ee=>A.has(ee)))||M.size>0||!!Z,W=()=>{G(new Set(A)),_(new Map),Oe()};return o.jsxs("div",{className:"v10-layer-detail v10-subgraph-detail",style:{"--sg-color":Dt},children:[o.jsxs("div",{className:"v10-subgraph-detail-header",children:[o.jsx("span",{className:"v10-subgraph-detail-icon",style:{color:Dt},children:Yt}),o.jsxs("div",{className:"v10-subgraph-detail-title-wrap",children:[o.jsx("div",{className:"v10-subgraph-detail-title",children:Ft}),ut&&o.jsx("div",{className:"v10-subgraph-detail-desc",children:ut})]}),o.jsx(jj,{counts:{wm:O.wm,swm:O.swm,vm:O.vm},activeLayers:U,onClickLayer:lt,compact:!0})]}),o.jsxs("div",{className:"v10-subgraph-cross-layer",children:[o.jsx("div",{className:"v10-subgraph-cross-layer-lede",children:Q?"Root entities, across the three memory layers:":"This subgraph, across the three memory layers:"}),o.jsxs("div",{className:"v10-subgraph-cross-layer-strip","data-testid":"cross-layer-strip",children:[o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"wm","aria-pressed":U.has("working"),onClick:()=>lt("working"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Gi.working},children:"◇"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Working"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.wm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"swm","aria-pressed":U.has("shared"),onClick:()=>lt("shared"),title:ne==="swm"?"Showing Shared Working Memory only — graph is colored by contributing agent (see legend).":void 0,children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Gi.shared},children:"◈"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Shared"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.swm})]}),o.jsx("span",{className:"v10-subgraph-cross-layer-arrow","aria-hidden":"true",children:"→"}),o.jsxs("button",{type:"button",className:"v10-subgraph-cross-layer-cell","data-layer":"vm","aria-pressed":U.has("verified"),onClick:()=>lt("verified"),children:[o.jsx("span",{className:"v10-subgraph-cross-layer-cell-icon",style:{color:Gi.verified},children:"◉"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-label",children:"Verifiable"}),o.jsx("span",{className:"v10-subgraph-cross-layer-cell-count",children:O.vm})]})]}),o.jsxs("span",{className:`v10-subgraph-active-layer-pill${U.size===3?" all-layers":""}`,"data-testid":"active-layer-pill",children:[o.jsx("span",{className:"v10-subgraph-active-layer-pill-label",children:"Active layer:"}),o.jsx("span",{className:"v10-subgraph-active-layer-pill-value",children:ft})]})]}),b.length>0&&o.jsxs("div",{className:"v10-subgraph-savedqueries",children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",children:"Query catalog"}),b.map(ee=>o.jsxs(Qe.Fragment,{children:[o.jsx("span",{className:"v10-subgraph-savedqueries-label",title:ee.description||ee.name,style:{marginLeft:8,opacity:.8},children:ee.name}),ee.queries.map(ce=>{const he=I===ce.slug;return o.jsxs("button",{type:"button",className:`v10-subgraph-savedquery${he?" active":""}`,onClick:()=>he?Oe():_t(ce),title:ce.description||ce.name,disabled:D&&!he,children:[o.jsx("span",{className:"v10-subgraph-savedquery-glyph",children:D&&he?"…":he?"✓":"◎"}),ce.name]},ce.slug)})]},ee.slug)),V&&o.jsx("span",{className:"v10-subgraph-savedquery-error",title:V,children:"✕ query failed"}),Z&&I&&o.jsxs("span",{className:"v10-subgraph-savedquery-count",children:[Z.size," match",Z.size===1?"":"es"]})]}),y.length>0&&o.jsxs("div",{className:"v10-subgraph-filters",children:[y.map(ee=>{const ce=M.get(ee.slug)??new Set;return o.jsxs("div",{className:"v10-subgraph-filter-row",children:[o.jsx("span",{className:"v10-subgraph-filter-label",children:ee.label}),o.jsx("div",{className:"v10-subgraph-filter-chips",children:ee.values.map(he=>{const Le=ce.has(he);return o.jsx("button",{type:"button",className:`v10-subgraph-filter-chip${Le?" active":""}`,onClick:()=>xe(ee.slug,he),children:he},he)})})]},ee.slug)}),K&&o.jsx("button",{type:"button",className:"v10-subgraph-filter-reset",onClick:W,children:"Reset filters"})]}),o.jsxs("div",{className:"v10-layer-detail-body",children:[o.jsxs("div",{className:"v10-layer-expand-tabs",children:[o.jsxs("button",{className:`v10-layer-expand-tab ${T==="items"?"active":""}`,onClick:()=>N("items"),children:["Entities (",ue.length,ue.length!==L.length?` / ${L.length}`:"",")"]}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="graph"?"active":""}`,onClick:()=>N("graph"),children:"Graph"}),k&&o.jsx("button",{className:`v10-layer-expand-tab ${T==="timeline"?"active":""}`,onClick:()=>N("timeline"),children:"Timeline"}),o.jsx("button",{className:`v10-layer-expand-tab ${T==="docs"?"active":""}`,onClick:()=>N("docs"),children:"Documents"})]}),T==="items"&&o.jsx("div",{className:"v10-layer-expand-body entities-tab","data-cg-scroll-key":`subgraph:${e}:items`,children:o.jsx(_S,{entities:qe,layerKey:"wm",layerIcon:Yt,onSelectEntity:s,externallySorted:!0,sortLabel:ke,timestampPredicate:k,perEntityTrustBadge:!0,headerExtra:o.jsxs("label",{className:"v10-entity-list-sort",children:[o.jsx("span",{className:"v10-entity-list-sort-label",children:"Sort"}),o.jsxs("select",{className:"v10-entity-list-sort-select",value:R,onChange:ee=>H(ee.target.value),"aria-label":"Sort entities",children:[k&&o.jsxs(o.Fragment,{children:[o.jsx("option",{value:"created-desc",children:"Newest first"}),o.jsx("option",{value:"created-asc",children:"Oldest first"})]}),o.jsx("option",{value:"triples",children:"Most triples"}),o.jsx("option",{value:"label",children:"Label (A→Z)"})]})]})})}),T==="graph"&&o.jsx("div",{className:"v10-layer-expand-body full-width","data-cg-scroll-key":`subgraph:${e}:graph`,children:o.jsx(AS,{layer:ne??"wm",triples:Ee,onNodeClick:r,contextGraphId:n,title:Ft,scopeLabel:`Subgraph graph: ${Ft} entities and entity-to-entity triples from loaded subgraph data.`,trustLegendActiveLayer:ne,scopeEntities:Ve,layerEntities:Ie,nodeColorsOverride:Se})}),T==="timeline"&&k&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(Y6,{items:Me,color:Dt,onSelectEntity:s,scrollKey:`subgraph:${e}:timeline`})}),T==="docs"&&o.jsx("div",{className:"v10-layer-expand-body full-width",children:o.jsx(OS,{entities:ue,contextGraphId:n,scrollKey:`subgraph:${e}:docs`})})]})]})}const K6={wm:"items",swm:"items",vm:"items"},F1={wm:"working",swm:"shared",vm:"verified"};function Sh(e){return e==="wm"||e==="swm"||e==="vm"}function X6(e){const t=new Set;return e.filter(n=>{const r=`${yt(n.subject)}|${n.predicate}|${yt(n.object)}`;return t.has(r)?!1:(t.add(r),!0)})}function H1(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 J6({contextGraphId:e}){const{data:t,error:n,loading:r,refresh:s}=Ea(Tn.fetchContextGraphs,[],3e4),[c,u]=w.useState(!1),[d,f]=w.useState(!1),[h,g]=w.useState("overview"),[m,y]=w.useState(null),[b,k]=w.useState({contextGraphId:null,list:[],status:"loading"}),[j,E]=w.useState(null),[S,T]=w.useState(!1),N=w.useRef(0),[R,H]=w.useState(null),[A,U]=w.useState(null),G=w.useRef(null),[M,_]=w.useState(null),I=w.useCallback(de=>{G.current=de,_(de)},[]),B=w.useRef(null),Z=w.useCallback(de=>{B.current=de,de===null&&(G.current=null,_(null)),H(de)},[]),[$,D]=w.useState(null),F=w.useRef(null);w.useEffect(()=>{F.current=m},[m]);const[V,X]=w.useState(K6),[Q,L]=w.useState({}),P=w.useRef(null),q=w.useRef(null),O=w.useRef(null),ne=w.useRef(0),ue=ML(e),le=BL(e),be=vn(de=>de.openTab),{data:Re,loading:Ee,error:Ie}=xd(),Ve=w.useCallback(()=>R?`subgraph:${R}:${Q[R]??"items"}`:Sh(h)?`layer:${h}:${V[h]}`:"page",[h,R,V,Q]),Se=w.useCallback(de=>{const je=de??Ve(),Te=H1(je,P.current);return{activeLayer:h,activeSubGraph:R,layerTabs:{...V},subGraphTabs:{...Q},scroll:{key:je,top:(Te==null?void 0:Te.scrollTop)??0},subGraphEnabledLayers:R!==null&&G.current?new Set(G.current):null}},[h,R,Ve,V,Q]),ft=w.useCallback(de=>{const je=()=>{const Te=H1(de.key,P.current);Te&&(Te.scrollTop=de.top)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(je):setTimeout(je,0)},[]),Me=w.useCallback((de,je)=>{(!F.current||!q.current)&&(q.current=Se(je)),y(de)},[Se]),qe=w.useCallback(()=>{q.current=null},[]);w.useEffect(()=>{if(m)return;const de=O.current;de&&(O.current=null,ft(de))},[m,h,R,V,Q,ft]),w.useEffect(()=>{const de=je=>{const Te=je.detail;Te&&Te.contextGraphId===e&&typeof Te.entityUri=="string"&&(D(null),Me(Te.entityUri))};return window.addEventListener("v10:open-entity",de),()=>window.removeEventListener("v10:open-entity",de)},[e,Me]);const ke=w.useCallback(de=>{var tt;const je=de.startsWith("urn:dkg:agent:")?de.slice(14):de,Te=((tt=le.get(de))==null?void 0:tt.name)??je;be({id:`agent:${e}|${je}`,label:`@ ${Te}`,closable:!0})},[le,e,be]),lt=w.useMemo(()=>({...le,openAgent:ke}),[le,ke]),xe=w.useMemo(()=>{var de;return(de=t==null?void 0:t.contextGraphs)==null?void 0:de.find(je=>je.id===e)},[t,e]),Oe=hg(e,{signalErrors:!0}),_t=vg(Oe).total,Dt=VO({activeLayer:h,activeSubGraph:R}),Yt=CS(Dt?e:void 0),Ft=!R&&h==="overview",ut=YL(Ft?e:void 0),ye=Ft?ut.resultContextGraphId===e?ut.events:[]:void 0,K=Ft&&ut.resultContextGraphId===e?ut.error:null,W=w.useCallback(()=>{const de=xe==null?void 0:xe.id;if(!de)return;const je=ne.current+1;ne.current=je,k({contextGraphId:de,list:[],status:"loading"}),Tn.listParticipants(de).then(Te=>{ne.current===je&&k({contextGraphId:de,list:Te.allowedAgents,status:"ok"})}).catch(()=>{ne.current===je&&k({contextGraphId:de,list:[],status:"error"})})},[xe==null?void 0:xe.id]);w.useEffect(()=>{W()},[W]);const ee=w.useCallback(()=>{const de=++N.current;Tn.fetchSubGraphs(e).then(je=>{if(N.current!==de)return;const Te=(je.subGraphs??[]).filter(yg).length;E(Te),T(!1)}).catch(()=>{N.current===de&&(E(null),T(!0))})},[e]);w.useEffect(()=>{E(null),T(!1),ee()},[ee]),po(e,ee);const ce=$?F1[$]:null,he=w.useMemo(()=>ce?Oe.allTriples.filter(de=>de.layer===ce):Oe.graphTriples,[Oe.allTriples,Oe.graphTriples,ce]),Le=w.useMemo(()=>ce?X6(he):he,[he,ce]),He=w.useMemo(()=>ce?sS(he):Oe.entities,[he,Oe.entities,ce]),Ce=w.useMemo(()=>m?He.get(m)??null:null,[m,He]);w.useEffect(()=>{!m||Ce||Oe.loading||(y(null),D(null),qe())},[m,Ce,Oe.loading,qe]);const Fe=w.useCallback((de,je)=>{const Te=B.current;if(qe(),Z(de),de===null)U(null);else if(je!==void 0){const tt=new Set([F1[je]]);U(tt),G.current=tt,_(tt)}else{if(Te!==null&&de===Te)return;if(Te!==null&&G.current){const tt=new Set(G.current);U(tt),G.current=tt,_(tt)}else U(null),G.current=null,_(null)}y(null),D(null)},[qe,Z]),et=w.useCallback(de=>{qe(),g(de),y(null),D(null),Z(null),U(null)},[qe,Z]),Ne=w.useCallback((de,je)=>{X(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),Gt=w.useCallback((de,je)=>{L(Te=>Te[de]===je?Te:{...Te,[de]:je})},[]),At=w.useCallback((de,je,Te)=>{const tt=F.current!=null;Me(de,je),D(Je=>Te??(tt?Je:null))},[Me]),Ua=w.useCallback(()=>{const de=q.current;if(q.current=null,y(null),D(null),!!de){if(g(de.activeLayer),Z(de.activeSubGraph),de.activeSubGraph!==null&&de.subGraphEnabledLayers){const je=new Set(de.subGraphEnabledLayers);U(je),G.current=je,_(je)}X(de.layerTabs),L(de.subGraphTabs),O.current=de.scroll}},[Z]),la=w.useCallback(de=>{if(!(de!=null&&de.id))return;const je=Sh(de.trustLayer)?de.trustLayer:void 0;At(de.id,void 0,je)},[At]),Ur=w.useCallback(de=>{const je=Sh(h)?h:void 0;At(de,void 0,je)},[h,At]),Br=w.useCallback(de=>{At(de,"page")},[At]),ca=w.useCallback(()=>{be(ES)},[be]),Ba=!!n&&/authentication|unauthor|expired|sign in|log in/i.test(n);if(!xe)return n||t&&!r?o.jsxs("div",{className:"v10-view-placeholder",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12,marginBottom:10},children:n?Ba?n:"Failed to load context graph.":"Context graph not found."}),Ba?o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"}):o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading context graph..."})});const sr=R?ue.forSubGraph(R):null,Fr=!Oe.loading&&!Oe.error&&!Oe.partial?Oe.entityList:void 0,wi=Ce?"entity":R?"subgraph":h,ge=b.contextGraphId===xe.id?b.list:[],ze=b.contextGraphId===xe.id?b.status:"loading";return o.jsx(kS.Provider,{value:ue,children:o.jsx(jS.Provider,{value:lt,children:o.jsxs("div",{className:"v10-memory-explorer",children:[n&&o.jsx("div",{className:"v10-stale-banner",role:"status",children:Ba?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:n}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:()=>window.location.reload(),children:"Refresh page"})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{children:"Couldn’t refresh context-graph data — showing last known values."}),o.jsx("button",{type:"button",className:"v10-retry-btn",onClick:s,children:"Retry"})]})}),o.jsx(A4,{cg:xe,profile:ue,activeSubGraph:sr,onClearSubGraph:()=>Fe(null)}),o.jsx(T4,{active:h,counts:Oe.counts,onSwitch:et,onShare:()=>f(!0),onImport:()=>u(!0),onRefresh:Oe.refresh}),o.jsxs("main",{className:"v10-memory-explorer-page","data-view":wi,"data-cg-scroll-key":"page",ref:P,children:[Ce&&o.jsx(V6,{entity:Ce,allEntities:He,allTriples:Le,onNavigate:At,onClose:Ua,contextGraphId:e,onRefresh:Oe.refresh}),R&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(U1,{}),o.jsx(ph,{contextGraphId:e,profile:ue,selected:R,entities:Fr,onSelect:Fe,enabledScope:M??void 0,allTriplesTotal:_t}),o.jsx(Q6,{slug:R,rawMemory:Oe,contextGraphId:e,onNodeClick:la,onSelectEntity:At,activeTab:Q[R]??"items",onTabChange:de=>Gt(R,de),initialEnabledLayers:A??void 0,onEnabledLayersChange:I})]}),!R&&h==="overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(M4,{cg:xe,memory:Oe,subGraphCount:j,subGraphFetchFailed:S,participants:ge,participantsStatus:ze,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok",onSwitchLayer:et,onOpenPrimer:ca}),o.jsx(D4,{contextGraphId:e,curatorStatus:L4({cg:xe,currentAgent:Re??null,currentAgentStatus:Ee?"loading":Ie?"error":"ok"}),onParticipantsChanged:W}),Oe.loading&&o.jsx("div",{className:"v10-me-loading",children:o.jsx("div",{className:"v10-me-loading-text",children:"Loading memory..."})}),Oe.error&&o.jsxs("div",{className:"v10-me-error",children:["Error: ",Oe.error]}),o.jsx("div",{"data-section":"activity",children:o.jsx(h4,{entities:Oe.entityList,lifecycleEvents:ye,lifecycleError:K,onSelectEntity:Br,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"})}),o.jsx($4,{onOpenPrimer:ca})]}),!R&&h==="graph-overview"&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(U1,{}),o.jsx(ph,{contextGraphId:e,profile:ue,selected:null,entities:Fr,onSelect:Fe,allTriplesTotal:_t}),o.jsx(Z6,{contextGraphId:e,memory:Oe,onNodeClick:la,onSelectSubGraph:Fe})]}),!R&&h==="query"&&!Ce&&o.jsx(lz,{contextGraphId:e}),!R&&(h==="wm"||h==="swm"||h==="vm")&&!Ce&&o.jsxs(o.Fragment,{children:[o.jsx(ph,{contextGraphId:e,profile:ue,selected:R,entities:Fr,onSelect:Fe,layer:h}),o.jsx(Y4,{layer:h,memory:Oe,onNodeClick:la,onSelectEntity:Ur,contextGraphId:e,activeTab:V[h],onTabChange:de=>Ne(h,de),swmAttribution:Yt})]})]}),o.jsx(wL,{open:c,onClose:()=>u(!1),contextGraphId:xe.id,contextGraphName:xe.name}),o.jsx(SL,{open:d,onClose:()=>f(!1),contextGraphId:xe.id,contextGraphName:xe.name})]})})})}const eI=[{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 tI(){const e=vn(n=>n.closeTab),t=Qe.useCallback(()=>e(wg),[e]);return Qe.useEffect(()=>{const n=r=>{r.key==="Escape"&&(r.preventDefault(),t())};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),o.jsxs("div",{className:"v10-primer-view",children:[o.jsxs("header",{className:"v10-primer-header",children:[o.jsx("button",{type:"button",className:"v10-primer-back",onClick:t,"aria-label":"Close primer and return to the previous tab",children:"← Back"}),o.jsx("p",{className:"v10-primer-kicker",children:"Context Graph Primer"}),o.jsx("h1",{children:"What is a Context Graph?"}),o.jsx("p",{children:"A Context Graph is a shared knowledge workspace where agents stage, review, organize, and publish structured memory."})]}),o.jsxs("section",{className:"v10-primer-pipeline","aria-label":"Context Graph pipeline",children:[o.jsx("span",{className:"wm",children:"Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"swm",children:"Shared Working Memory"}),o.jsx("span",{className:"connector","aria-hidden":"true"}),o.jsx("span",{className:"vm",children:"Verifiable Memory"})]}),o.jsx("div",{className:"v10-primer-sections",children:eI.map(n=>o.jsxs("section",{className:"v10-primer-section",children:[o.jsx("h2",{children:n.title}),o.jsx("p",{children:n.body})]},n.title))})]})}const nI={"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 q1(e){const t=nI[e];return t?t==="markdown"?"text":t:"binary"}async function G1(e){const t=await fetch(e,{headers:Zt()});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=await t.blob();return URL.createObjectURL(n)}function aI({open:e,onClose:t,assertionName:n,contextGraphId:r,subGraphName:s}){const[c,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(!0),[b,k]=w.useState(null);w.useEffect(()=>{if(e)return y(!0),k(null),u(null),f(null),g(null),C2(n,r,s).then(async R=>{u(R);const H=q1(R.detectedContentType),A=Au(R.fileHash,R.detectedContentType);if(H==="text"){const U=await fetch(A,{headers:Zt()});U.ok&&f(await U.text())}else if(H==="pdf"||H==="image"){const U=await G1(A);g(U)}}).catch(R=>k(R.message??"Failed to load file info")).finally(()=>y(!1)),()=>{h&&URL.revokeObjectURL(h)}},[e,n,r,s]),w.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const{dialogRef:j,onBackdropClick:E}=Zi(e,t);if(!e)return null;const S=c?q1(c.detectedContentType):null,T=c?Au(c.fileHash,c.detectedContentType):null,N=async(R,H)=>{try{const A=await G1(R),U=document.createElement("a");U.href=A,U.download=H,U.click(),URL.revokeObjectURL(A)}catch{window.open(R,"_blank")}};return o.jsx("div",{className:"v10-modal-overlay",onClick:E,role:"presentation",children:o.jsxs("div",{className:"v10-modal-box v10-file-preview-modal",ref:j,role:"dialog","aria-modal":"true","aria-labelledby":"dkg-file-preview-title",children:[o.jsxs("div",{className:"v10-modal-header",children:[o.jsx("div",{id:"dkg-file-preview-title",className:"v10-modal-title",children:n}),o.jsx("button",{type:"button",className:"v10-modal-close",onClick:t,"aria-label":"Close file preview",title:"Close (Esc)",children:"×"})]}),m&&o.jsx("div",{className:"v10-file-preview-loading",children:"Loading file preview..."}),b&&o.jsxs("div",{className:"v10-file-preview-error",children:[o.jsx("p",{children:b}),o.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."})]}),c&&!m&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"v10-file-preview-meta",children:[o.jsx("span",{className:"v10-file-preview-meta-item",children:c.detectedContentType}),o.jsxs("span",{className:"v10-file-preview-meta-item",children:[c.tripleCount," triples extracted"]}),o.jsx("span",{className:"v10-file-preview-meta-item",children:c.pipelineUsed}),c.completedAt&&o.jsx("span",{className:"v10-file-preview-meta-item",children:new Date(c.completedAt).toLocaleString()})]}),o.jsxs("div",{className:"v10-file-preview-content",children:[S==="pdf"&&h&&o.jsx("iframe",{src:h,className:"v10-file-preview-iframe",title:`Preview: ${n}`}),S==="image"&&h&&o.jsx("img",{src:h,alt:n,className:"v10-file-preview-image"}),S==="text"&&d!=null&&o.jsx("pre",{className:"v10-file-preview-text",children:d}),S==="binary"&&o.jsxs("div",{className:"v10-file-preview-binary",children:[o.jsx("p",{children:"This file type cannot be previewed directly."}),T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(T,n),children:"Download file"})]})]}),o.jsxs("div",{className:"v10-file-preview-footer",children:[T&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(T,n),children:"Download original"}),c.mdIntermediateHash&&o.jsx("button",{className:"v10-file-preview-download",onClick:()=>N(Au(c.mdIntermediateHash,"text/markdown"),`${n}.md`),children:"Download markdown intermediate"})]})]})]})})}const rI=w.lazy(()=>ar(()=>import("./index-D0Mz0SVt.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.RdfGraph}))),iI=w.lazy(()=>ar(()=>import("./index-D0Mz0SVt.js").then(e=>e.h),__vite__mapDeps([0,1])).then(e=>({default:e.NodePanel}))),sI=w.lazy(()=>ar(()=>import("./OnChainProvenanceCard-BL6ou6s9.js"),__vite__mapDeps([2,0,1])).then(e=>({default:e.OnChainProvenanceCard}))),oI={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."}},lI={labelMode:"humanized",renderer:"2d",labels:kd({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}},cI=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),o.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),o.jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15"}),o.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21"})]}),uI=o.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[o.jsx("circle",{cx:"6",cy:"6",r:"3"}),o.jsx("circle",{cx:"18",cy:"6",r:"3"}),o.jsx("circle",{cx:"6",cy:"18",r:"3"}),o.jsx("circle",{cx:"18",cy:"18",r:"3"}),o.jsx("line",{x1:"8.5",y1:"7.5",x2:"15.5",y2:"16.5"}),o.jsx("line",{x1:"15.5",y1:"7.5",x2:"8.5",y2:"16.5"})]});function jh({layer:e,contextGraphId:t,externalQuery:n,externalQueryKey:r,queryPresetOptions:s}){var Ie,Ve;const c=oI[e],[u,d]=w.useState("graph"),[f,h]=w.useState(""),[g,m]=w.useState(""),[y,b]=w.useState(""),[k,j]=w.useState(""),[E,S]=w.useState("any"),[T,N]=w.useState(50),[R,H]=w.useState(""),[A,U]=w.useState("any"),[G,M]=w.useState(50),[_,I]=w.useState(e!=="vm"),B=Qe.useRef(e);Qe.useEffect(()=>{B.current!==e&&(B.current=e,h(""),I(e!=="vm"),m(""),b(""),j(""),S("any"),N(50),H(""),U("any"),M(50))},[e]),Qe.useEffect(()=>{n!==void 0&&(h(""),m(n),b(n))},[n,r]);const Z=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"?fI({query:R,field:A,limit:G}):"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 500",[t,e,A,G,R]),$=y||Z,D=e==="swm"?"_shared_memory":void 0,F=e==="swm",V=e==="vm"?"verifiable-memory":void 0,X=e==="wm"&&$===Z,{data:Q,loading:L,error:P,refresh:q}=Ea(()=>ia($,t,F,D,V,X),[$,t,F,D,V,X],0);po(t,q,{layers:[e]});const{data:O}=Ea(Xm,[],3e4),ne=O==null?void 0:O.blockExplorerUrl,ue=w.useCallback(()=>{const Se=g.trim();if(Se===y){q();return}b(Se)},[y,g,q]),le=w.useCallback(()=>{const Se=k!==R||E!==A||T!==G;if(Se&&(H(k),U(E),M(T)),y){b("");return}Se||q()},[y,A,G,R,E,T,k,q]),be=((Ie=Q==null?void 0:Q.result)==null?void 0:Ie.bindings)??((Ve=Q==null?void 0:Q.results)==null?void 0:Ve.bindings)??[],Re=w.useMemo(()=>be.map(Se=>({subject:Hs(Se.s)??"",predicate:Hs(Se.p)??"",object:Hs(Se.o)??""})).filter(Se=>Se.subject&&Se.predicate&&Se.object),[be]),Ee=w.useCallback(Se=>{Se!=null&&Se.id&&b(`SELECT (<${Se.id}> AS ?s) ?p ?o WHERE { <${Se.id}> ?p ?o } LIMIT 100`)},[]);return o.jsxs("div",{className:"v10-memory-layer-view",children:[o.jsxs("div",{className:"v10-mlv-header",children:[o.jsx("span",{className:"v10-mlv-icon",style:{color:c.color},children:c.icon}),o.jsxs("div",{children:[o.jsx("h2",{className:"v10-mlv-title",children:c.label}),o.jsx("p",{className:"v10-mlv-desc",children:c.description})]})]}),e==="wm"&&o.jsx(dI,{contextGraphId:t,onPromoted:q}),e==="swm"&&o.jsx(pI,{contextGraphId:t,onPublished:q}),e==="vm"&&o.jsxs("div",{className:"v10-vm-search-panel",children:[o.jsxs("div",{className:"v10-vm-search-header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-vm-search-title",children:"Search Verifiable Memory"}),o.jsx("div",{className:"v10-vm-search-desc",children:"Search published triples by subject, predicate, object, or across all fields."})]}),o.jsx("button",{className:"v10-vm-search-toggle",type:"button",onClick:()=>I(Se=>!Se),children:_?"Hide SPARQL":"Advanced SPARQL"})]}),o.jsxs("div",{className:"v10-vm-search-controls",children:[o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Search verifiable memory...",value:k,onChange:Se=>j(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&le()}}),o.jsxs("select",{className:"v10-vm-search-select",value:E,onChange:Se=>S(Se.target.value),children:[o.jsx("option",{value:"any",children:"Any field"}),o.jsx("option",{value:"subject",children:"Subject"}),o.jsx("option",{value:"predicate",children:"Predicate"}),o.jsx("option",{value:"object",children:"Object"})]}),o.jsxs("select",{className:"v10-vm-search-select",value:String(T),onChange:Se=>N(Number.parseInt(Se.target.value,10)||50),children:[o.jsx("option",{value:"25",children:"25 rows"}),o.jsx("option",{value:"50",children:"50 rows"}),o.jsx("option",{value:"100",children:"100 rows"}),o.jsx("option",{value:"200",children:"200 rows"})]}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:le,children:"Search"})]})]}),(e!=="vm"||_)&&o.jsxs("div",{className:"v10-mlv-query-bar",children:[s!=null&&s.length?o.jsxs("select",{className:"v10-vm-search-select",value:f,onChange:Se=>{const ft=Se.target.value;h(ft);const Me=s.find(ke=>ke.label===ft),qe=(Me==null?void 0:Me.query)??"";m(qe),b(qe)},children:[o.jsx("option",{value:"",children:"Select common query..."}),s.map(Se=>o.jsx("option",{value:Se.label,children:Se.label},Se.label))]}):o.jsx("input",{type:"text",className:"v10-mlv-query-input",placeholder:"Custom SPARQL query...",value:g,onChange:Se=>m(Se.target.value),onKeyDown:Se=>{Se.key==="Enter"&&ue()}}),o.jsx("button",{className:"v10-mlv-run-btn",onClick:ue,children:"Run"}),y&&o.jsx("button",{className:"v10-mlv-clear-btn",onClick:()=>b(""),title:"Reset to full layer overview",children:"Reset"}),o.jsxs("div",{className:"v10-mlv-view-toggle",children:[o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="table"?"active":""}`,onClick:()=>d("table"),title:"Table view",children:cI}),o.jsx("button",{className:`v10-mlv-toggle-btn ${u==="graph"?"active":""}`,onClick:()=>d("graph"),title:"Graph view",children:uI})]})]}),L&&o.jsx("p",{className:"v10-mlv-status",children:"Loading..."}),P&&o.jsxs("p",{className:"v10-mlv-status",style:{color:"var(--accent-red)"},children:["Error: ",P]}),!L&&be.length===0&&o.jsxs("div",{className:"v10-mlv-empty",children:[o.jsxs("p",{children:["No triples found in ",c.label.toLowerCase(),"."]}),o.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."]})]}),!L&&be.length>0&&u==="table"&&o.jsxs("div",{className:"v10-mlv-table-wrap",children:[o.jsxs("div",{className:"v10-mlv-result-count",children:[be.length," triples"]}),o.jsxs("table",{className:"v10-mlv-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Subject"}),o.jsx("th",{children:"Predicate"}),o.jsx("th",{children:"Object"})]})}),o.jsx("tbody",{children:be.map((Se,ft)=>o.jsxs("tr",{children:[o.jsx("td",{className:"v10-mlv-cell",children:Ch(Hs(Se.s))}),o.jsx("td",{className:"v10-mlv-cell",children:Ch(Hs(Se.p))}),o.jsx("td",{className:"v10-mlv-cell",children:Ch(Hs(Se.o))})]},ft))})]})]}),!L&&Re.length>0&&u==="graph"&&o.jsxs("div",{className:"v10-mlv-graph-container",children:[o.jsxs("div",{className:"v10-mlv-graph-info",children:[o.jsxs("span",{children:[Re.length," triples"]}),y&&o.jsx("span",{className:"v10-mlv-graph-info-custom",children:"filtered"})]}),o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"v10-mlv-graph-loading",children:"Loading graph renderer..."}),children:o.jsxs(rI,{data:Re,format:"triples",options:lI,style:{width:"100%",height:"100%"},onNodeClick:Ee,initialFit:!0,children:[o.jsx(iI,{className:"v10-mlv-node-panel",showUri:!0,showTypes:!0,showProperties:!0,showMetadata:!1,maxValueLength:150}),o.jsx(sI,{contextGraphId:t,layer:e,explorerUrl:ne})]})})]})]})}function dI({contextGraphId:e,onPromoted:t}){const{data:n,loading:r,refresh:s}=Ea(()=>Vu(e,"wm"),[e],0);po(e,s,{layers:["wm"]});const[c,u]=w.useState(null),[d,f]=w.useState(null),[h,g]=w.useState(null),[m,y]=w.useState(null),b=w.useCallback(async j=>{u(j.graphUri),f(null),g(null);try{const E=await eo(e,j.name,"all",j.subGraph),S=ng(j.name,E);f({message:S.message+(j.subGraph?` (in ${j.subGraph})`:""),kind:S.kind==="success"?"success":"noop",subGraph:j.subGraph}),s(),t()}catch(E){const S=to(j.name,E);g(S?{message:S.message,kind:"not-persisted"}:{message:(E==null?void 0:E.message)??"Promote failed",kind:"other"})}finally{u(null)}},[e,s,t]),k=w.useCallback(async()=>{if(!(n!=null&&n.length))return;u("__all__"),f(null),g(null);let j=0,E=0,S=null;try{for(const N of n){S=N.name;const R=await eo(e,N.name,"all",N.subGraph);j+=R.promotedCount,R.promotedCount===0&&(E+=1)}const T=E>0?` (${E} assertion${E===1?"":"s"} had nothing to promote)`:"";f({message:j>0?`Promoted ${j} triple${j===1?"":"s"} across ${n.length} assertion${n.length===1?"":"s"}.${T}`:"No triples were promoted — every assertion was already in Shared Working Memory or its content has not been committed yet.",kind:j>0?"success":"noop"}),s(),t()}catch(T){const N=to(S??"selected assertion",T);g(N?{message:N.message,kind:"not-persisted"}:{message:(T==null?void 0:T.message)??"Promote failed",kind:"other"})}finally{u(null)}},[n,e,s,t]);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading assertions..."}):n!=null&&n.length?o.jsxs("div",{className:"v10-assertion-list",children:[o.jsxs("div",{className:"v10-assertion-list-header",children:[o.jsxs("span",{className:"v10-assertion-list-title",children:["Assertions in Working Memory (",n.length,")"]}),o.jsx("button",{className:"v10-btn-promote-all",disabled:c!==null,onClick:k,children:c==="__all__"?"Promoting...":"Promote All → SWM"})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(j=>o.jsxs("div",{className:"v10-assertion-item",children:[o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("button",{className:"v10-assertion-item-name clickable",title:j.graphUri,onClick:()=>y({name:j.name,subGraph:j.subGraph}),children:j.name}),j.tripleCount!=null&&o.jsxs("span",{className:"v10-assertion-item-count",children:[j.tripleCount," triples"]}),j.subGraph&&o.jsxs("span",{className:"v10-item-count v10-item-subgraph",title:`In sub-graph: ${j.subGraph}`,children:["› ",RS(j.subGraph,18)]})]}),o.jsx("button",{className:"v10-btn-promote",disabled:c!==null,onClick:()=>b(j),title:"Copy these triples to Shared Working Memory",children:c===j.graphUri?"Promoting...":"→ SWM"})]},j.graphUri))}),d&&o.jsx("div",{className:d.kind==="success"?"v10-promote-result success":"v10-promote-result info",children:d.message}),h&&o.jsx("div",{className:"v10-promote-result error",children:h.message}),m&&o.jsx(aI,{open:!0,onClose:()=>y(null),assertionName:m.name,subGraphName:m.subGraph,contextGraphId:e})]}):null}function pI({contextGraphId:e,onPublished:t}){const{data:n,loading:r,refresh:s}=Ea(()=>A2(e),[e],0);po(e,s,{layers:["swm"]});const[c,u]=w.useState(new Set),[d,f]=w.useState(!1),[h,g]=w.useState(null),[m,y]=w.useState(null),b=(n==null?void 0:n.map(A=>A.uri))??[],k=b.length>0&&b.every(A=>c.has(A)),j=w.useCallback(A=>{u(U=>{const G=new Set(U);return G.has(A)?G.delete(A):G.add(A),G})},[]),E=w.useCallback(()=>{u(k?new Set:new Set(b))},[k,b]),S=w.useCallback(async()=>{if(c.size!==0){f(!0),g(null),y(null);try{const A=[...c],U=await Jh(e,A);g(U),u(new Set),s(),t()}catch(A){y(A.message??"Publish failed")}finally{f(!1)}}},[c,e,s,t]),T=w.useCallback(async()=>{if(!(b.length<1)){f(!0),g(null),y(null);try{const A=await Jh(e,b);g(A),u(new Set),s(),t()}catch(A){y(A.message??"Publish failed")}finally{f(!1)}}},[b,e,s,t]),N=(n==null?void 0:n.reduce((A,U)=>A+U.tripleCount,0))??0,R=(n==null?void 0:n.filter(A=>c.has(A.uri)).reduce((A,U)=>A+U.tripleCount,0))??0,H=!r&&(!n||n.length===0);return r?o.jsx("div",{className:"v10-assertion-list-loading",children:"Loading SWM contents..."}):H?o.jsxs("div",{className:"v10-publish-panel",children:[o.jsx("div",{className:"v10-publish-panel-header",children:o.jsx("span",{className:"v10-publish-panel-title",children:"Publish to Verifiable Memory"})}),o.jsx("div",{className:"v10-publish-panel-empty",children:"No data in Shared Working Memory yet. Promote assertions from Working Memory first."})]}):o.jsxs("div",{className:"v10-publish-panel",children:[o.jsxs("div",{className:"v10-publish-panel-header",children:[o.jsxs("span",{className:"v10-publish-panel-title",children:["Entities in Shared Working Memory (",n.length," entities · ",N," triples)"]}),o.jsxs("div",{className:"v10-publish-panel-header-actions",children:[o.jsx("button",{className:"v10-publish-panel-refresh",onClick:s,title:"Refresh",children:"↻"}),o.jsx("button",{className:"v10-btn-promote-all",disabled:d,onClick:T,children:d&&c.size===0?"Publishing...":"Publish All → VM"})]})]}),o.jsxs("div",{className:"v10-publish-select-bar",children:[o.jsxs("label",{className:"v10-publish-select-all",children:[o.jsx("input",{type:"checkbox",checked:k,onChange:E}),o.jsx("span",{children:"Select all"})]}),c.size>0&&o.jsx("button",{className:"v10-btn-publish",disabled:d,onClick:S,children:d?"Publishing...":`Publish ${c.size} selected (${R} triples) → VM`})]}),o.jsx("div",{className:"v10-assertion-items",children:n.map(A=>o.jsxs("div",{className:`v10-assertion-item ${c.has(A.uri)?"selected":""}`,children:[o.jsx("label",{className:"v10-publish-entity-check",children:o.jsx("input",{type:"checkbox",checked:c.has(A.uri),onChange:()=>j(A.uri)})}),o.jsxs("div",{className:"v10-assertion-item-info",children:[o.jsx("span",{className:"v10-assertion-item-name",title:A.uri,children:A.label}),o.jsxs("span",{className:"v10-assertion-item-count",children:[A.tripleCount," triples"]})]})]},A.uri))}),h&&(()=>{const A=h.status==="confirmed"&&!!h.txHash;return o.jsxs("div",{className:`v10-publish-result-card ${A?"success":"error"}`,children:[o.jsx("div",{className:"v10-publish-result-title",children:A?"Published to Verifiable Memory":"NOT published to Verifiable Memory"}),!A&&o.jsxs("div",{className:"v10-publish-result-details",style:{marginBottom:6},children:["The data was prepared and stored locally as ",o.jsx("code",{children:h.status}),", but the on-chain transaction did not land. Verifiable Memory requires a confirmed",o.jsx("code",{children:" KCCreated "})," event. Check the node logs for the cause (typically a missing publisher wallet, an unfunded signer, or a chain adapter that isn't V10-ready)."]}),o.jsxs("div",{className:"v10-publish-result-details",children:[o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Knowledge Asset:"})," ",h.kaId]}),o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Status:"})," ",h.status]}),h.kas&&h.kas.length>1&&o.jsxs("div",{children:[o.jsx("span",{className:"v10-publish-result-label",children:"Additional KAs in batch:"})," ",h.kas.length-1]}),h.txHash?o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",title:h.txHash,children:h.txHash}),h.blockNumber!=null&&o.jsxs("span",{className:"v10-publish-result-block",children:[" (block ",h.blockNumber,")"]})]}):o.jsxs("div",{className:"v10-publish-result-tx",children:[o.jsx("span",{className:"v10-publish-result-label",children:"Tx hash:"})," ",o.jsx("span",{className:"mono",children:"(none — no on-chain transaction)"})]})]})]})})(),m&&o.jsx("div",{className:"v10-publish-result-card error",children:m})]})}function Hs(e){if(e!=null)return typeof e=="string"?e:typeof e=="object"&&"value"in e?String(e.value):String(e)}function Ch(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 fI(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=hI(n.toLowerCase()),s={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"?`(${s.subject} || ${s.predicate} || ${s.object})`:s[e.field]}) } LIMIT ${t}`}function hI(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")}const Cj=[{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"}],mI=["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 gI(){const{contextGraphs:e}=Na(),{hidden:t}=ug(),n=w.useMemo(()=>e.filter(r=>!t.has(r.id)),[e,t]);return o.jsxs("div",{className:"v10-memstack",children:[o.jsxs("div",{className:"v10-memstack-head",children:[o.jsx("h1",{className:"v10-memstack-title",children:"Memory Stack"}),o.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?o.jsx("div",{className:"v10-memstack-empty",children:"No visible context graphs. Create one from the sidebar or un-hide dismissed ones."}):o.jsxs("div",{className:"v10-memstack-table",children:[o.jsxs("div",{className:"v10-memstack-colheads",children:[o.jsx("div",{className:"v10-memstack-colhead project"}),Cj.map(r=>o.jsxs("div",{className:"v10-memstack-colhead",style:{color:r.color},children:[o.jsx("span",{className:"v10-memstack-colhead-icon",children:r.icon}),o.jsx("span",{className:"v10-memstack-colhead-title",children:r.title}),o.jsx("span",{className:"v10-memstack-colhead-desc",children:r.desc})]},r.key))]}),n.map(r=>o.jsx(vI,{cg:r},r.id))]})]})}function vI({cg:e}){const t=hg(e.id),{openTab:n}=vn(),r=xS(t),s=w.useMemo(()=>{const u={working:{entities:[],tripleCount:r.wm},shared:{entities:[],tripleCount:r.swm},verified:{entities:[],tripleCount:r.vm}};for(const d of t.entityList)u[d.trustLevel].entities.push(d);for(const d of Object.keys(u))u[d].entities.sort((f,h)=>{const g=xm(f),m=xm(h);return g&&m?m-g:g?-1:m?1:f.label.localeCompare(h.label)});return u},[t.entityList,r]),c=()=>n({id:`project:${e.id}`,label:e.name||e.id.slice(0,16),closable:!0});return o.jsxs("div",{className:"v10-memstack-row",children:[o.jsxs("div",{className:"v10-memstack-project",children:[o.jsxs("button",{type:"button",className:"v10-memstack-project-btn",onClick:c,children:[o.jsx("span",{className:"v10-memstack-project-dot"}),o.jsx("span",{className:"v10-memstack-project-name",children:e.name||e.id})]}),e.description&&o.jsx("div",{className:"v10-memstack-project-desc",title:e.description,children:e.description}),t.loading&&!t.entityList.length&&o.jsx("div",{className:"v10-memstack-project-status",children:"loading…"}),t.error&&o.jsx("div",{className:"v10-memstack-project-status error",children:t.error})]}),Cj.map(u=>{const d=s[u.key];return o.jsx(yI,{cgId:e.id,color:u.color,layerTitle:u.title,tabPrefix:u.tabPrefix,entityCount:d.entities.length,tripleCount:d.tripleCount,recent:d.entities.slice(0,4),onOpenLayer:()=>n({id:`${u.tabPrefix}:${e.id}`,label:`${u.short} · ${e.name||e.id.slice(0,12)}`,closable:!0})},u.key)})]})}function yI({cgId:e,color:t,layerTitle:n,tabPrefix:r,entityCount:s,tripleCount:c,recent:u,onOpenLayer:d}){const f=s===0;return o.jsxs("div",{className:`v10-memstack-cell${f?" empty":""}`,style:{"--cell-color":t},children:[o.jsxs("div",{className:"v10-memstack-cell-stats",children:[o.jsx("span",{className:"v10-memstack-cell-n",children:s}),o.jsxs("span",{className:"v10-memstack-cell-n-lbl",children:["entit",s===1?"y":"ies"]}),o.jsx("span",{className:"v10-memstack-cell-sep",children:"·"}),o.jsx("span",{className:"v10-memstack-cell-t",children:c.toLocaleString()}),o.jsx("span",{className:"v10-memstack-cell-t-lbl",children:"triples"})]}),u.length>0?o.jsx("ul",{className:"v10-memstack-cell-recent",children:u.map(h=>o.jsxs("li",{className:"v10-memstack-cell-recent-item",title:h.label,children:[o.jsx("span",{className:"v10-memstack-cell-recent-bullet"}),o.jsx("span",{className:"v10-memstack-cell-recent-label",children:h.label}),o.jsx("span",{className:"v10-memstack-cell-recent-time",children:NS(bI(h))})]},h.uri))}):o.jsxs("div",{className:"v10-memstack-cell-empty-hint",children:["Nothing in ",r.toUpperCase()," yet"]}),!f&&o.jsxs("button",{type:"button",className:"v10-memstack-cell-open",onClick:d,title:`Open ${n}`,children:["Open ",r.toUpperCase()," →"]})]})}function xm(e){var t;for(const n of mI){const r=(t=e.properties.get(n))==null?void 0:t[0];if(!r)continue;const s=new Date(r.replace(/^"|"$/g,"").replace(/^"(.+)"(?:@\w+|\^\^.+)?$/,"$1"));if(Number.isFinite(s.getTime()))return s.getTime()}return null}function bI(e){const t=xm(e);return t?new Date(t):null}function xI(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wI=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kI=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SI={};function V1(e,t){return(SI.jsx?kI:wI).test(e)}const jI=/[ \t\n\f\r]/g;function CI(e){return typeof e=="object"?e.type==="text"?W1(e.value):!1:W1(e)}function W1(e){return e.replace(jI,"")===""}class ql{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ql.prototype.normal={};ql.prototype.property={};ql.prototype.space=void 0;function Nj(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ql(n,r,t)}function wm(e){return e.toLowerCase()}class Vn{constructor(t,n){this.attribute=n,this.property=t}}Vn.prototype.attribute="";Vn.prototype.booleanish=!1;Vn.prototype.boolean=!1;Vn.prototype.commaOrSpaceSeparated=!1;Vn.prototype.commaSeparated=!1;Vn.prototype.defined=!1;Vn.prototype.mustUseProperty=!1;Vn.prototype.number=!1;Vn.prototype.overloadedBoolean=!1;Vn.prototype.property="";Vn.prototype.spaceSeparated=!1;Vn.prototype.space=void 0;let NI=0;const Xe=rs(),rn=rs(),km=rs(),we=rs(),Rt=rs(),Js=rs(),ra=rs();function rs(){return 2**++NI}const Sm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Xe,booleanish:rn,commaOrSpaceSeparated:ra,commaSeparated:Js,number:we,overloadedBoolean:km,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Nh=Object.keys(Sm);class $g extends Vn{constructor(t,n,r,s){let c=-1;if(super(t,n),Z1(this,"space",s),typeof r=="number")for(;++c<Nh.length;){const u=Nh[c];Z1(this,Nh[c],(r&Sm[u])===Sm[u])}}}$g.prototype.defined=!0;function Z1(e,t,n){n&&(e[t]=n)}function ho(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const c=new $g(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),t[r]=c,n[wm(r)]=r,n[wm(c.attribute)]=r}return new ql(t,n,e.space)}const Ej=ho({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:Rt,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:rn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Tj(e,t){return t in e?e[t]:t}function Aj(e,t){return Tj(e,t.toLowerCase())}const EI=ho({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Js,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Xe,allowPaymentRequest:Xe,allowUserMedia:Xe,alt:null,as:null,async:Xe,autoCapitalize:null,autoComplete:Rt,autoFocus:Xe,autoPlay:Xe,blocking:Rt,capture:null,charSet:null,checked:Xe,cite:null,className:Rt,cols:we,colSpan:null,content:null,contentEditable:rn,controls:Xe,controlsList:Rt,coords:we|Js,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Xe,defer:Xe,dir:null,dirName:null,disabled:Xe,download:km,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Xe,formTarget:null,headers:Rt,height:we,hidden:km,high:we,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Xe,inputMode:null,integrity:null,is:null,isMap:Xe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Xe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Xe,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Xe,muted:Xe,name:null,nonce:null,noModule:Xe,noValidate:Xe,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:Xe,optimum:we,pattern:null,ping:Rt,placeholder:null,playsInline:Xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Xe,referrerPolicy:null,rel:Rt,required:Xe,reversed:Xe,rows:we,rowSpan:we,sandbox:Rt,scope:null,scoped:Xe,seamless:Xe,selected:Xe,shadowRootClonable:Xe,shadowRootDelegatesFocus:Xe,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Xe,useMap:null,value:rn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Xe,declare:Xe,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Xe,noHref:Xe,noShade:Xe,noWrap:Xe,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Xe,disableRemotePlayback:Xe,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Aj}),TI=ho({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:ra,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Rt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:Js,g2:Js,glyphName:Js,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:ra,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ra,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ra,rev:ra,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ra,requiredFeatures:ra,requiredFonts:ra,requiredFormats:ra,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:ra,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ra,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ra,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Tj}),Rj=ho({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()}}),_j=ho({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Aj}),Oj=ho({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),AI={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"},RI=/[A-Z]/g,Y1=/-[a-z]/g,_I=/^data[-\w.:]+$/i;function OI(e,t){const n=wm(t);let r=t,s=Vn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&_I.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(Y1,zI);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!Y1.test(c)){let u=c.replace(RI,LI);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=$g}return new s(r,t)}function LI(e){return"-"+e.toLowerCase()}function zI(e){return e.charAt(1).toUpperCase()}const MI=Nj([Ej,EI,Rj,_j,Oj],"html"),Ig=Nj([Ej,TI,Rj,_j,Oj],"svg");function DI(e){return e.join(" ").trim()}var qs={},Eh,Q1;function $I(){if(Q1)return Eh;Q1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,f=`
|
|
1634
|
-
`,h="/",g="*",m="",y="comment",b="declaration";function k(E,S){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];S=S||{};var T=1,N=1;function R($){var D=$.match(t);D&&(T+=D.length);var F=$.lastIndexOf(f);N=~F?$.length-F:N+$.length}function H(){var $={line:T,column:N};return function(D){return D.position=new A($),M(),D}}function A($){this.start=$,this.end={line:T,column:N},this.source=S.source}A.prototype.content=E;function U($){var D=new Error(S.source+":"+T+":"+N+": "+$);if(D.reason=$,D.filename=S.source,D.line=T,D.column=N,D.source=E,!S.silent)throw D}function G($){var D=$.exec(E);if(D){var F=D[0];return R(F),E=E.slice(F.length),D}}function M(){G(n)}function _($){var D;for($=$||[];D=I();)D!==!1&&$.push(D);return $}function I(){var $=H();if(!(h!=E.charAt(0)||g!=E.charAt(1))){for(var D=2;m!=E.charAt(D)&&(g!=E.charAt(D)||h!=E.charAt(D+1));)++D;if(D+=2,m===E.charAt(D-1))return U("End of comment missing");var F=E.slice(2,D-2);return N+=2,R(F),E=E.slice(D),N+=2,$({type:y,comment:F})}}function B(){var $=H(),D=G(r);if(D){if(I(),!G(s))return U("property missing ':'");var F=G(c),V=$({type:b,property:j(D[0].replace(e,m)),value:F?j(F[0].replace(e,m)):m});return G(u),V}}function Z(){var $=[];_($);for(var D;D=B();)D!==!1&&($.push(D),_($));return $}return M(),Z()}function j(E){return E?E.replace(d,m):m}return Eh=k,Eh}var K1;function II(){if(K1)return qs;K1=1;var e=qs&&qs.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(qs,"__esModule",{value:!0}),qs.default=n;const t=e($I());function n(r,s){let c=null;if(!r||typeof r!="string")return c;const u=(0,t.default)(r),d=typeof s=="function";return u.forEach(f=>{if(f.type!=="declaration")return;const{property:h,value:g}=f;d?s(h,g,f):g&&(c=c||{},c[h]=g)}),c}return qs}var fl={},X1;function PI(){if(X1)return fl;X1=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,c=function(h){return!h||n.test(h)||e.test(h)},u=function(h,g){return g.toUpperCase()},d=function(h,g){return"".concat(g,"-")},f=function(h,g){return g===void 0&&(g={}),c(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(s,d):h=h.replace(r,d),h.replace(t,u))};return fl.camelCase=f,fl}var hl,J1;function UI(){if(J1)return hl;J1=1;var e=hl&&hl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(II()),n=PI();function r(s,c){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(d,f){d&&f&&(u[(0,n.camelCase)(d,c)]=f)}),u}return r.default=r,hl=r,hl}var BI=UI();const FI=Dl(BI),Lj=zj("end"),Pg=zj("start");function zj(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 HI(e){const t=Pg(e),n=Lj(e);if(t&&n)return{start:t,end:n}}function Cl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?ew(e.position):"start"in e||"end"in e?ew(e):"line"in e||"column"in e?jm(e):""}function jm(e){return tw(e&&e.line)+":"+tw(e&&e.column)}function ew(e){return jm(e&&e.start)+"-"+jm(e&&e.end)}function tw(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",c={},u=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?s=t:!c.cause&&t&&(u=!0,s=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?c.ruleId=r:(c.source=r.slice(0,f),c.ruleId=r.slice(f+1))}if(!c.place&&c.ancestors&&c.ancestors){const f=c.ancestors[c.ancestors.length-1];f&&(c.place=f.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=d?d.line:void 0,this.name=Cl(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Ug={}.hasOwnProperty,qI=new Map,GI=/[A-Z]/g,VI=new Set(["table","tbody","thead","tfoot","tr"]),WI=new Set(["td","th"]),Mj="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ZI(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=n5(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=t5(n,t.jsx,t.jsxs)}const s={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"?Ig:MI,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Dj(s,e,void 0);return c&&typeof c!="string"?c:s.create(e,s.Fragment,{children:c||void 0},void 0)}function Dj(e,t,n){if(t.type==="element")return YI(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return QI(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return XI(e,t,n);if(t.type==="mdxjsEsm")return KI(e,t);if(t.type==="root")return JI(e,t,n);if(t.type==="text")return e5(e,t)}function YI(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ig,e.schema=s),e.ancestors.push(t);const c=Ij(e,t.tagName,!1),u=a5(e,t);let d=Fg(e,t);return VI.has(t.tagName)&&(d=d.filter(function(f){return typeof f=="string"?!CI(f):!0})),$j(e,u,c,t),Bg(u,d),e.ancestors.pop(),e.schema=r,e.create(t,c,u,n)}function QI(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)}Ll(e,t.position)}function KI(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ll(e,t.position)}function XI(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ig,e.schema=s),e.ancestors.push(t);const c=t.name===null?e.Fragment:Ij(e,t.name,!0),u=r5(e,t),d=Fg(e,t);return $j(e,u,c,t),Bg(u,d),e.ancestors.pop(),e.schema=r,e.create(t,c,u,n)}function JI(e,t,n){const r={};return Bg(r,Fg(e,t)),e.create(t,e.Fragment,r,n)}function e5(e,t){return t.value}function $j(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function t5(e,t,n){return r;function r(s,c,u,d){const h=Array.isArray(u.children)?n:t;return d?h(c,u,d):h(c,u)}}function n5(e,t){return n;function n(r,s,c,u){const d=Array.isArray(c.children),f=Pg(r);return t(s,c,u,d,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function a5(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Ug.call(t.properties,s)){const c=i5(e,s,t.properties[s]);if(c){const[u,d]=c;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&WI.has(t.tagName)?r=d:n[u]=d}}if(r){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function r5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const c=r.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Ll(e,t.position);else{const s=r.name;let c;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,c=e.evaluater.evaluateExpression(d.expression)}else Ll(e,t.position);else c=r.value===null?!0:r.value;n[s]=c}return n}function Fg(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:qI;for(;++r<t.children.length;){const c=t.children[r];let u;if(e.passKeys){const f=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(f){const h=s.get(f)||0;u=f+"-"+h,s.set(f,h+1)}}const d=Dj(e,c,u);d!==void 0&&n.push(d)}return n}function i5(e,t,n){const r=OI(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?xI(n):DI(n)),r.property==="style"){let s=typeof n=="object"?n:s5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=o5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?AI[r.property]||r.property:r.attribute,n]}}function s5(e,t){try{return FI(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=Mj+"#cannot-parse-style-attribute",s}}function Ij(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let c=-1,u;for(;++c<s.length;){const d=V1(s[c])?{type:"Identifier",name:s[c]}:{type:"Literal",value:s[c]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}r=u}else r=V1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Ug.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ll(e)}function Ll(e,t){const n=new An("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=Mj+"#cannot-handle-mdx-estrees-without-createevaluater",n}function o5(e){const t={};let n;for(n in e)Ug.call(e,n)&&(t[l5(n)]=e[n]);return t}function l5(e){let t=e.replace(GI,c5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function c5(e){return"-"+e.toLowerCase()}const Th={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"]},u5={};function Hg(e,t){const n=u5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Pj(e,r,s)}function Pj(e,t,n){if(d5(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 nw(e.children,t,n)}return Array.isArray(e)?nw(e,t,n):""}function nw(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=Pj(e[s],t,n);return r.join("")}function d5(e){return!!(e&&typeof e=="object")}const aw=document.createElement("i");function qg(e){const t="&"+e+";";aw.innerHTML=t;const n=aw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function sa(e,t,n,r){const s=e.length;let c=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);c<r.length;)u=r.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function Ca(e,t){return e.length>0?(sa(e,e.length,0,t),e):t}const rw={}.hasOwnProperty;function Uj(e){const t={};let n=-1;for(;++n<e.length;)p5(t,e[n]);return t}function p5(e,t){let n;for(n in t){const s=(rw.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let u;if(c)for(u in c){rw.call(s,u)||(s[u]=[]);const d=c[u];f5(s[u],Array.isArray(d)?d:d?[d]:[])}}}function f5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);sa(e,0,0,r)}function Bj(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 $a(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=xi(/[A-Za-z]/),En=xi(/[\dA-Za-z]/),h5=xi(/[#-'*+\--9=?A-Z^-~]/);function rd(e){return e!==null&&(e<32||e===127)}const Cm=xi(/\d/),m5=xi(/[\dA-Fa-f]/),g5=xi(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function it(e){return e===-2||e===-1||e===32}const _d=xi(new RegExp("\\p{P}|\\p{S}","u")),Xi=xi(/\s/);function xi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mo(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const c=e.charCodeAt(n);let u="";if(c===37&&En(e.charCodeAt(n+1))&&En(e.charCodeAt(n+2)))s=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(n+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),s=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function dt(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(f){return it(f)?(e.enter(n),d(f)):t(f)}function d(f){return it(f)&&c++<s?(e.consume(f),d):(e.exit(n),t(f))}}const v5={tokenize:y5};function y5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),dt(e,t,"linePrefix")}function s(d){return e.enter("paragraph"),c(d)}function c(d){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Pe(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),u)}}const b5={tokenize:x5},iw={tokenize:w5};function x5(e){const t=this,n=[];let r=0,s,c,u;return d;function d(N){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,f,h)(N)}return h(N)}function f(N){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&T();const R=t.events.length;let H=R,A;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){A=t.events[H][1].end;break}S(r);let U=R;for(;U<t.events.length;)t.events[U][1].end={...A},U++;return sa(t.events,H+1,0,t.events.slice(R)),t.events.length=U,h(N)}return d(N)}function h(N){if(r===n.length){if(!s)return y(N);if(s.currentConstruct&&s.currentConstruct.concrete)return k(N);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(iw,g,m)(N)}function g(N){return s&&T(),S(r),y(N)}function m(N){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,k(N)}function y(N){return t.containerState={},e.attempt(iw,b,k)(N)}function b(N){return r++,n.push([t.currentConstruct,t.containerState]),y(N)}function k(N){if(N===null){s&&T(),S(0),e.consume(N);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:c}),j(N)}function j(N){if(N===null){E(e.exit("chunkFlow"),!0),S(0),e.consume(N);return}return Pe(N)?(e.consume(N),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(N),j)}function E(N,R){const H=t.sliceStream(N);if(R&&H.push(null),N.previous=c,c&&(c.next=N),c=N,s.defineSkip(N.start),s.write(H),t.parser.lazy[N.start.line]){let A=s.events.length;for(;A--;)if(s.events[A][1].start.offset<u&&(!s.events[A][1].end||s.events[A][1].end.offset>u))return;const U=t.events.length;let G=U,M,_;for(;G--;)if(t.events[G][0]==="exit"&&t.events[G][1].type==="chunkFlow"){if(M){_=t.events[G][1].end;break}M=!0}for(S(r),A=U;A<t.events.length;)t.events[A][1].end={..._},A++;sa(t.events,G+1,0,t.events.slice(U)),t.events.length=A}}function S(N){let R=n.length;for(;R-- >N;){const H=n[R];t.containerState=H[1],H[0].exit.call(t,e)}n.length=N}function T(){s.write([null]),c=void 0,s=void 0,t.containerState._closeFlow=void 0}}function w5(e,t,n){return dt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function so(e){if(e===null||Tt(e)||Xi(e))return 1;if(_d(e))return 2}function Od(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const c=e[s].resolveAll;c&&!r.includes(c)&&(t=c(t,n),r.push(c))}return t}const Nm={name:"attention",resolveAll:k5,tokenize:S5};function k5(e,t){let n=-1,r,s,c,u,d,f,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;f=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},y={...e[n][1].start};sw(m,-f),sw(y,f),u={type:f>1?"strongSequence":"emphasisSequence",start:m,end:{...e[r][1].end}},d={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},c={type:f>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:f>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},h=[],e[r][1].end.offset-e[r][1].start.offset&&(h=Ca(h,[["enter",e[r][1],t],["exit",e[r][1],t]])),h=Ca(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",c,t]]),h=Ca(h,Od(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),h=Ca(h,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,h=Ca(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,sa(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 S5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=so(r);let c;return u;function u(f){return c=f,e.enter("attentionSequence"),d(f)}function d(f){if(f===c)return e.consume(f),d;const h=e.exit("attentionSequence"),g=so(f),m=!g||g===2&&s||n.includes(f),y=!s||s===2&&g||n.includes(r);return h._open=!!(c===42?m:m&&(s||!y)),h._close=!!(c===42?y:y&&(g||!m)),t(f)}}function sw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const j5={name:"autolink",tokenize:C5};function C5(e,t,n){let r=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(b){return zn(b)?(e.consume(b),u):b===64?n(b):h(b)}function u(b){return b===43||b===45||b===46||En(b)?(r=1,d(b)):h(b)}function d(b){return b===58?(e.consume(b),r=0,f):(b===43||b===45||b===46||En(b))&&r++<32?(e.consume(b),d):(r=0,h(b))}function f(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||rd(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):h5(b)?(e.consume(b),h):n(b)}function g(b){return En(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):y(b)}function y(b){if((b===45||En(b))&&r++<63){const k=b===45?y:m;return e.consume(b),k}return n(b)}}const Gl={partial:!0,tokenize:N5};function N5(e,t,n){return r;function r(c){return it(c)?dt(e,s,"linePrefix")(c):s(c)}function s(c){return c===null||Pe(c)?t(c):n(c)}}const Fj={continuation:{tokenize:T5},exit:A5,name:"blockQuote",tokenize:E5};function E5(e,t,n){const r=this;return s;function s(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return n(u)}function c(u){return it(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function T5(e,t,n){const r=this;return s;function s(u){return it(u)?dt(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(Fj,t,n)(u)}}function A5(e){e.exit("blockQuote")}const Hj={name:"characterEscape",tokenize:R5};function R5(e,t,n){return r;function r(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),s}function s(c){return g5(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const qj={name:"characterReference",tokenize:_5};function _5(e,t,n){const r=this;let s=0,c,u;return d;function d(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),c=31,u=En,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=m5,g):(e.enter("characterReferenceValue"),c=7,u=Cm,g(m))}function g(m){if(m===59&&s){const y=e.exit("characterReferenceValue");return u===En&&!qg(r.sliceSerialize(y))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(m)&&s++<c?(e.consume(m),g):n(m)}}const ow={partial:!0,tokenize:L5},lw={concrete:!0,name:"codeFenced",tokenize:O5};function O5(e,t,n){const r=this,s={partial:!0,tokenize:H};let c=0,u=0,d;return f;function f(A){return h(A)}function h(A){const U=r.events[r.events.length-1];return c=U&&U[1].type==="linePrefix"?U[2].sliceSerialize(U[1],!0).length:0,d=A,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(A)}function g(A){return A===d?(u++,e.consume(A),g):u<3?n(A):(e.exit("codeFencedFenceSequence"),it(A)?dt(e,m,"whitespace")(A):m(A))}function m(A){return A===null||Pe(A)?(e.exit("codeFencedFence"),r.interrupt?t(A):e.check(ow,j,R)(A)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(A))}function y(A){return A===null||Pe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(A)):it(A)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,b,"whitespace")(A)):A===96&&A===d?n(A):(e.consume(A),y)}function b(A){return A===null||Pe(A)?m(A):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(A))}function k(A){return A===null||Pe(A)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(A)):A===96&&A===d?n(A):(e.consume(A),k)}function j(A){return e.attempt(s,R,E)(A)}function E(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),S}function S(A){return c>0&&it(A)?dt(e,T,"linePrefix",c+1)(A):T(A)}function T(A){return A===null||Pe(A)?e.check(ow,j,R)(A):(e.enter("codeFlowValue"),N(A))}function N(A){return A===null||Pe(A)?(e.exit("codeFlowValue"),T(A)):(e.consume(A),N)}function R(A){return e.exit("codeFenced"),t(A)}function H(A,U,G){let M=0;return _;function _(D){return A.enter("lineEnding"),A.consume(D),A.exit("lineEnding"),I}function I(D){return A.enter("codeFencedFence"),it(D)?dt(A,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):B(D)}function B(D){return D===d?(A.enter("codeFencedFenceSequence"),Z(D)):G(D)}function Z(D){return D===d?(M++,A.consume(D),Z):M>=u?(A.exit("codeFencedFenceSequence"),it(D)?dt(A,$,"whitespace")(D):$(D)):G(D)}function $(D){return D===null||Pe(D)?(A.exit("codeFencedFence"),U(D)):G(D)}}}function L5(e,t,n){const r=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const Ah={name:"codeIndented",tokenize:M5},z5={partial:!0,tokenize:D5};function M5(e,t,n){const r=this;return s;function s(h){return e.enter("codeIndented"),dt(e,c,"linePrefix",5)(h)}function c(h){const g=r.events[r.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?f(h):Pe(h)?e.attempt(z5,u,f)(h):(e.enter("codeFlowValue"),d(h))}function d(h){return h===null||Pe(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),d)}function f(h){return e.exit("codeIndented"),t(h)}}function D5(e,t,n){const r=this;return s;function s(u){return r.parser.lazy[r.now().line]?n(u):Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):dt(e,c,"linePrefix",5)(u)}function c(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Pe(u)?s(u):n(u)}}const $5={name:"codeText",previous:P5,resolve:I5,tokenize:U5};function I5(e){let t=e.length-4,n=3,r,s;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;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function P5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function U5(e,t,n){let r=0,s,c;return u;function u(m){return e.enter("codeText"),e.enter("codeTextSequence"),d(m)}function d(m){return m===96?(e.consume(m),r++,d):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(c=e.enter("codeTextSequence"),s=0,g(m)):Pe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Pe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(c.type="codeTextData",h(m))}}class B5{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 s=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ml(this.left,r),c.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),ml(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ml(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);ml(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ml(this.left,n.reverse())}}}function ml(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 Gj(e){const t={};let n=-1,r,s,c,u,d,f,h;const g=new B5(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"&&(f=r[1]._tokenizer.events,c=0,c<f.length&&f[c][1].type==="lineEndingBlank"&&(c+=2),c<f.length&&f[c][1].type==="content"))for(;++c<f.length&&f[c][1].type!=="content";)f[c][1].type==="chunkText"&&(f[c][1]._isInFirstContentOfListItem=!0,c++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,F5(g,n)),n=t[n],h=!0);else if(r[1]._container){for(c=n,s=void 0;c--;)if(u=g.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(r[1].end={...g.get(s)[1].start},d=g.slice(s,n),d.unshift(r),g.splice(s,n-s+1,d))}}return sa(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function F5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const c=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,f=[],h={};let g,m,y=-1,b=n,k=0,j=0;const E=[j];for(;b;){for(;e.get(++s)[1]!==b;);c.push(s),b._tokenizer||(g=r.sliceStream(b),b.next||g.push(null),m&&u.defineSkip(b.start),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),b._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++y<d.length;)d[y][0]==="exit"&&d[y-1][0]==="enter"&&d[y][1].type===d[y-1][1].type&&d[y][1].start.line!==d[y][1].end.line&&(j=y+1,E.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(u.events=[],b?(b._tokenizer=void 0,b.previous=void 0):E.pop(),y=E.length;y--;){const S=d.slice(E[y],E[y+1]),T=c.pop();f.push([T,T+S.length-1]),e.splice(T,2,S)}for(f.reverse(),y=-1;++y<f.length;)h[k+f[y][0]]=k+f[y][1],k+=f[y][1]-f[y][0]-1;return h}const H5={resolve:G5,tokenize:V5},q5={partial:!0,tokenize:W5};function G5(e){return Gj(e),e}function V5(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(d)}function s(d){return d===null?c(d):Pe(d)?e.check(q5,u,c)(d):(e.consume(d),s)}function c(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function W5(e,t,n){const r=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),dt(e,c,"linePrefix")}function c(u){if(u===null||Pe(u))return n(u);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(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function Vj(e,t,n,r,s,c,u,d,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(S){return S===60?(e.enter(r),e.enter(s),e.enter(c),e.consume(S),e.exit(c),y):S===null||S===32||S===41||rd(S)?n(S):(e.enter(r),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),j(S))}function y(S){return S===62?(e.enter(c),e.consume(S),e.exit(c),e.exit(s),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),y(S)):S===null||S===60||Pe(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||Tt(S))?(e.exit("chunkString"),e.exit(d),e.exit(u),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||rd(S)?n(S):(e.consume(S),S===92?E:j)}function E(S){return S===40||S===41||S===92?(e.consume(S),j):j(S)}}function Wj(e,t,n,r,s,c){const u=this;let d=0,f;return h;function h(b){return e.enter(r),e.enter(s),e.consume(b),e.exit(s),e.enter(c),g}function g(b){return d>999||b===null||b===91||b===93&&!f||b===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(b):b===93?(e.exit(c),e.enter(s),e.consume(b),e.exit(s),e.exit(r),t):Pe(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||Pe(b)||d++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!it(b)),b===92?y:m)}function y(b){return b===91||b===92||b===93?(e.consume(b),d++,m):m(b)}}function Zj(e,t,n,r,s,c){let u;return d;function d(y){return y===34||y===39||y===40?(e.enter(r),e.enter(s),e.consume(y),e.exit(s),u=y===40?41:y,f):n(y)}function f(y){return y===u?(e.enter(s),e.consume(y),e.exit(s),e.exit(r),t):(e.enter(c),h(y))}function h(y){return y===u?(e.exit(c),f(u)):y===null?n(y):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),dt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===u||y===null||Pe(y)?(e.exit("chunkString"),h(y)):(e.consume(y),y===92?m:g)}function m(y){return y===u||y===92?(e.consume(y),g):g(y)}}function Nl(e,t){let n;return r;function r(s){return Pe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):it(s)?dt(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const Z5={name:"definition",tokenize:Q5},Y5={partial:!0,tokenize:K5};function Q5(e,t,n){const r=this;let s;return c;function c(b){return e.enter("definition"),u(b)}function u(b){return Wj.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function d(b){return s=$a(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return Tt(b)?Nl(e,h)(b):h(b)}function h(b){return Vj(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(Y5,m,m)(b)}function m(b){return it(b)?dt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||Pe(b)?(e.exit("definition"),r.parser.defined.push(s),t(b)):n(b)}}function K5(e,t,n){return r;function r(d){return Tt(d)?Nl(e,s)(d):n(d)}function s(d){return Zj(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return it(d)?dt(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Pe(d)?t(d):n(d)}}const X5={name:"hardBreakEscape",tokenize:J5};function J5(e,t,n){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),s}function s(c){return Pe(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const eP={name:"headingAtx",resolve:tP,tokenize:nP};function tP(e,t){let n=e.length-2,r=3,s,c;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},c={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},sa(e,r,n-r+1,[["enter",s,t],["enter",c,t],["exit",c,t],["exit",s,t]])),e}function nP(e,t,n){let r=0;return s;function s(g){return e.enter("atxHeading"),c(g)}function c(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&r++<6?(e.consume(g),u):g===null||Tt(g)?(e.exit("atxHeadingSequence"),d(g)):n(g)}function d(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Pe(g)?(e.exit("atxHeading"),t(g)):it(g)?dt(e,d,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),d(g))}function h(g){return g===null||g===35||Tt(g)?(e.exit("atxHeadingText"),d(g)):(e.consume(g),h)}}const aP=["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"],cw=["pre","script","style","textarea"],rP={concrete:!0,name:"htmlFlow",resolveTo:oP,tokenize:lP},iP={partial:!0,tokenize:uP},sP={partial:!0,tokenize:cP};function oP(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 lP(e,t,n){const r=this;let s,c,u,d,f;return h;function h(O){return g(O)}function g(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),m}function m(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),c=!0,j):O===63?(e.consume(O),s=3,r.interrupt?t:L):zn(O)?(e.consume(O),u=String.fromCharCode(O),E):n(O)}function y(O){return O===45?(e.consume(O),s=2,b):O===91?(e.consume(O),s=5,d=0,k):zn(O)?(e.consume(O),s=4,r.interrupt?t:L):n(O)}function b(O){return O===45?(e.consume(O),r.interrupt?t:L):n(O)}function k(O){const ne="CDATA[";return O===ne.charCodeAt(d++)?(e.consume(O),d===ne.length?r.interrupt?t:B:k):n(O)}function j(O){return zn(O)?(e.consume(O),u=String.fromCharCode(O),E):n(O)}function E(O){if(O===null||O===47||O===62||Tt(O)){const ne=O===47,ue=u.toLowerCase();return!ne&&!c&&cw.includes(ue)?(s=1,r.interrupt?t(O):B(O)):aP.includes(u.toLowerCase())?(s=6,ne?(e.consume(O),S):r.interrupt?t(O):B(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):c?T(O):N(O))}return O===45||En(O)?(e.consume(O),u+=String.fromCharCode(O),E):n(O)}function S(O){return O===62?(e.consume(O),r.interrupt?t:B):n(O)}function T(O){return it(O)?(e.consume(O),T):_(O)}function N(O){return O===47?(e.consume(O),_):O===58||O===95||zn(O)?(e.consume(O),R):it(O)?(e.consume(O),N):_(O)}function R(O){return O===45||O===46||O===58||O===95||En(O)?(e.consume(O),R):H(O)}function H(O){return O===61?(e.consume(O),A):it(O)?(e.consume(O),H):N(O)}function A(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),f=O,U):it(O)?(e.consume(O),A):G(O)}function U(O){return O===f?(e.consume(O),f=null,M):O===null||Pe(O)?n(O):(e.consume(O),U)}function G(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||Tt(O)?H(O):(e.consume(O),G)}function M(O){return O===47||O===62||it(O)?N(O):n(O)}function _(O){return O===62?(e.consume(O),I):n(O)}function I(O){return O===null||Pe(O)?B(O):it(O)?(e.consume(O),I):n(O)}function B(O){return O===45&&s===2?(e.consume(O),F):O===60&&s===1?(e.consume(O),V):O===62&&s===4?(e.consume(O),P):O===63&&s===3?(e.consume(O),L):O===93&&s===5?(e.consume(O),Q):Pe(O)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(iP,q,Z)(O)):O===null||Pe(O)?(e.exit("htmlFlowData"),Z(O)):(e.consume(O),B)}function Z(O){return e.check(sP,$,q)(O)}function $(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),D}function D(O){return O===null||Pe(O)?Z(O):(e.enter("htmlFlowData"),B(O))}function F(O){return O===45?(e.consume(O),L):B(O)}function V(O){return O===47?(e.consume(O),u="",X):B(O)}function X(O){if(O===62){const ne=u.toLowerCase();return cw.includes(ne)?(e.consume(O),P):B(O)}return zn(O)&&u.length<8?(e.consume(O),u+=String.fromCharCode(O),X):B(O)}function Q(O){return O===93?(e.consume(O),L):B(O)}function L(O){return O===62?(e.consume(O),P):O===45&&s===2?(e.consume(O),L):B(O)}function P(O){return O===null||Pe(O)?(e.exit("htmlFlowData"),q(O)):(e.consume(O),P)}function q(O){return e.exit("htmlFlow"),t(O)}}function cP(e,t,n){const r=this;return s;function s(u){return Pe(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):n(u)}function c(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function uP(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Gl,t,n)}}const dP={name:"htmlText",tokenize:pP};function pP(e,t,n){const r=this;let s,c,u;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),h):L===47?(e.consume(L),H):L===63?(e.consume(L),N):zn(L)?(e.consume(L),G):n(L)}function h(L){return L===45?(e.consume(L),g):L===91?(e.consume(L),c=0,k):zn(L)?(e.consume(L),T):n(L)}function g(L){return L===45?(e.consume(L),b):n(L)}function m(L){return L===null?n(L):L===45?(e.consume(L),y):Pe(L)?(u=m,V(L)):(e.consume(L),m)}function y(L){return L===45?(e.consume(L),b):m(L)}function b(L){return L===62?F(L):L===45?y(L):m(L)}function k(L){const P="CDATA[";return L===P.charCodeAt(c++)?(e.consume(L),c===P.length?j:k):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),E):Pe(L)?(u=j,V(L)):(e.consume(L),j)}function E(L){return L===93?(e.consume(L),S):j(L)}function S(L){return L===62?F(L):L===93?(e.consume(L),S):j(L)}function T(L){return L===null||L===62?F(L):Pe(L)?(u=T,V(L)):(e.consume(L),T)}function N(L){return L===null?n(L):L===63?(e.consume(L),R):Pe(L)?(u=N,V(L)):(e.consume(L),N)}function R(L){return L===62?F(L):N(L)}function H(L){return zn(L)?(e.consume(L),A):n(L)}function A(L){return L===45||En(L)?(e.consume(L),A):U(L)}function U(L){return Pe(L)?(u=U,V(L)):it(L)?(e.consume(L),U):F(L)}function G(L){return L===45||En(L)?(e.consume(L),G):L===47||L===62||Tt(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),F):L===58||L===95||zn(L)?(e.consume(L),_):Pe(L)?(u=M,V(L)):it(L)?(e.consume(L),M):F(L)}function _(L){return L===45||L===46||L===58||L===95||En(L)?(e.consume(L),_):I(L)}function I(L){return L===61?(e.consume(L),B):Pe(L)?(u=I,V(L)):it(L)?(e.consume(L),I):M(L)}function B(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),s=L,Z):Pe(L)?(u=B,V(L)):it(L)?(e.consume(L),B):(e.consume(L),$)}function Z(L){return L===s?(e.consume(L),s=void 0,D):L===null?n(L):Pe(L)?(u=Z,V(L)):(e.consume(L),Z)}function $(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Tt(L)?M(L):(e.consume(L),$)}function D(L){return L===47||L===62||Tt(L)?M(L):n(L)}function F(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function V(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),X}function X(L){return it(L)?dt(e,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):Q(L)}function Q(L){return e.enter("htmlTextData"),u(L)}}const Gg={name:"labelEnd",resolveAll:gP,resolveTo:vP,tokenize:yP},fP={tokenize:bP},hP={tokenize:xP},mP={tokenize:wP};function gP(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 s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&sa(e,0,e.length,n),e}function vP(e,t){let n=e.length,r=0,s,c,u,d;for(;n--;)if(s=e[n][1],c){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(c=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(u=n);const f={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[c+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",f,t],["enter",h,t]],d=Ca(d,e.slice(c+1,c+r+3)),d=Ca(d,[["enter",g,t]]),d=Ca(d,Od(t.parser.constructs.insideSpan.null,e.slice(c+r+4,u-3),t)),d=Ca(d,[["exit",g,t],e[u-2],e[u-1],["exit",h,t]]),d=Ca(d,e.slice(u+1)),d=Ca(d,[["exit",f,t]]),sa(e,c,e.length,d),e}function yP(e,t,n){const r=this;let s=r.events.length,c,u;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){c=r.events[s][1];break}return d;function d(y){return c?c._inactive?m(y):(u=r.parser.defined.includes($a(r.sliceSerialize({start:c.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(fP,g,u?g:m)(y):y===91?e.attempt(hP,g,u?h:m)(y):u?g(y):m(y)}function h(y){return e.attempt(mP,g,m)(y)}function g(y){return t(y)}function m(y){return c._balanced=!0,n(y)}}function bP(e,t,n){return r;function r(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return Tt(m)?Nl(e,c)(m):c(m)}function c(m){return m===41?g(m):Vj(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function u(m){return Tt(m)?Nl(e,f)(m):g(m)}function d(m){return n(m)}function f(m){return m===34||m===39||m===40?Zj(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return Tt(m)?Nl(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 xP(e,t,n){const r=this;return s;function s(d){return Wj.call(r,e,c,u,"reference","referenceMarker","referenceString")(d)}function c(d){return r.parser.defined.includes($a(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function wP(e,t,n){return r;function r(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),s}function s(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const kP={name:"labelStartImage",resolveAll:Gg.resolveAll,tokenize:SP};function SP(e,t,n){const r=this;return s;function s(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const jP={name:"labelStartLink",resolveAll:Gg.resolveAll,tokenize:CP};function CP(e,t,n){const r=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const Rh={name:"lineEnding",tokenize:NP};function NP(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const Iu={name:"thematicBreak",tokenize:EP};function EP(e,t,n){let r=0,s;return c;function c(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,d(h)}function d(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):r>=3&&(h===null||Pe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),r++,f):(e.exit("thematicBreakSequence"),it(h)?dt(e,d,"whitespace")(h):d(h))}}const Fn={continuation:{tokenize:_P},exit:LP,name:"list",tokenize:RP},TP={partial:!0,tokenize:zP},AP={partial:!0,tokenize:OP};function RP(e,t,n){const r=this,s=r.events[r.events.length-1];let c=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=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:Cm(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(Iu,n,h)(b):h(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Cm(b)&&++u<10?(e.consume(b),f):(!r.interrupt||u<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(Gl,r.interrupt?n:g,e.attempt(TP,y,m))}function g(b){return r.containerState.initialBlankLine=!0,c++,y(b)}function m(b){return it(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return r.containerState.size=c+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function _P(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Gl,s,c);function s(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dt(e,t,"listItemIndent",r.containerState.size+1)(d)}function c(d){return r.containerState.furtherBlankLines||!it(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(AP,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(e,e.attempt(Fn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function OP(e,t,n){const r=this;return dt(e,s,"listItemIndent",r.containerState.size+1);function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(c):n(c)}}function LP(e){e.exit(this.containerState.type)}function zP(e,t,n){const r=this;return dt(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(c){const u=r.events[r.events.length-1];return!it(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const uw={name:"setextUnderline",resolveTo:MP,tokenize:DP};function MP(e,t){let n=e.length,r,s,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",c?(e.splice(s,0,["enter",u,t]),e.splice(c+1,0,["exit",e[r][1],t]),e[r][1].end={...e[c][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function DP(e,t,n){const r=this;let s;return c;function c(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"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),d(h)}function d(h){return h===s?(e.consume(h),d):(e.exit("setextHeadingLineSequence"),it(h)?dt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Pe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const $P={tokenize:IP};function IP(e){const t=this,n=e.attempt(Gl,r,e.attempt(this.parser.constructs.flowInitial,s,dt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(H5,s)),"linePrefix")));return n;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const PP={resolveAll:Qj()},UP=Yj("string"),BP=Yj("text");function Yj(e){return{resolveAll:Qj(e==="text"?FP:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],c=n.attempt(s,u,d);return u;function u(g){return h(g)?c(g):d(g)}function d(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),c(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const m=s[g];let y=-1;if(m)for(;++y<m.length;){const b=m[y];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function Qj(e){return t;function t(n,r){let s=-1,c;for(;++s<=n.length;)c===void 0?n[s]&&n[s][1].type==="data"&&(c=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==c+2&&(n[c][1].end=n[s-1][1].end,n.splice(c+2,s-c-2),s=c+2),c=void 0);return e?e(n,r):n}}function FP(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],s=t.sliceStream(r);let c=s.length,u=-1,d=0,f;for(;c--;){const h=s[c];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(h===-2)f=!0,d++;else if(h!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const h={type:n===e.length||f||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:r.start._bufferIndex+u,_index:r.start._index+c,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 HP={42:Fn,43:Fn,45:Fn,48:Fn,49:Fn,50:Fn,51:Fn,52:Fn,53:Fn,54:Fn,55:Fn,56:Fn,57:Fn,62:Fj},qP={91:Z5},GP={[-2]:Ah,[-1]:Ah,32:Ah},VP={35:eP,42:Iu,45:[uw,Iu],60:rP,61:uw,95:Iu,96:lw,126:lw},WP={38:qj,92:Hj},ZP={[-5]:Rh,[-4]:Rh,[-3]:Rh,33:kP,38:qj,42:Nm,60:[j5,dP],91:jP,92:[X5,Hj],93:Gg,95:Nm,96:$5},YP={null:[Nm,PP]},QP={null:[42,95]},KP={null:[]},XP=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:QP,contentInitial:qP,disable:KP,document:HP,flow:VP,flowInitial:GP,insideSpan:YP,string:WP,text:ZP},Symbol.toStringTag,{value:"Module"}));function JP(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 s={},c=[];let u=[],d=[];const f={attempt:U(H),check:U(A),consume:T,enter:N,exit:R,interrupt:U(A,{interrupt:!0})},h={code:null,containerState:{},defineSkip:j,events:[],now:k,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&c.push(t),h;function m(I){return u=Ca(u,I),E(),u[u.length-1]!==null?[]:(G(t,0),h.events=Od(c,h.events,h),h.events)}function y(I,B){return tU(b(I),B)}function b(I){return eU(u,I)}function k(){const{_bufferIndex:I,_index:B,line:Z,column:$,offset:D}=r;return{_bufferIndex:I,_index:B,line:Z,column:$,offset:D}}function j(I){s[I.line]=I.column,_()}function E(){let I;for(;r._index<u.length;){const B=u[r._index];if(typeof B=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<B.length;)S(B.charCodeAt(r._bufferIndex));else S(B)}}function S(I){g=g(I)}function T(I){Pe(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,_()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),h.previous=I}function N(I,B){const Z=B||{};return Z.type=I,Z.start=k(),h.events.push(["enter",Z,h]),d.push(Z),Z}function R(I){const B=d.pop();return B.end=k(),h.events.push(["exit",B,h]),B}function H(I,B){G(I,B.from)}function A(I,B){B.restore()}function U(I,B){return Z;function Z($,D,F){let V,X,Q,L;return Array.isArray($)?q($):"tokenize"in $?q([$]):P($);function P(le){return be;function be(Re){const Ee=Re!==null&&le[Re],Ie=Re!==null&&le.null,Ve=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ie)?Ie:Ie?[Ie]:[]];return q(Ve)(Re)}}function q(le){return V=le,X=0,le.length===0?F:O(le[X])}function O(le){return be;function be(Re){return L=M(),Q=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?ue():le.tokenize.call(B?Object.assign(Object.create(h),B):h,f,ne,ue)(Re)}}function ne(le){return I(Q,L),D}function ue(le){return L.restore(),++X<V.length?O(V[X]):F}}}function G(I,B){I.resolveAll&&!c.includes(I)&&c.push(I),I.resolve&&sa(h.events,B,h.events.length-B,I.resolve(h.events.slice(B),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function M(){const I=k(),B=h.previous,Z=h.currentConstruct,$=h.events.length,D=Array.from(d);return{from:$,restore:F};function F(){r=I,h.previous=B,h.currentConstruct=Z,h.events.length=$,d=D,_()}}function _(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function eU(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,c=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(r,c)];else{if(u=e.slice(n,s),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}c>0&&u.push(e[s].slice(0,c))}return u}function tU(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const c=e[n];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
1635
|
-
`;break}case-3:{u=`\r
|
|
1636
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(c)}s=c===-2,r.push(u)}return r.join("")}function nU(e){const r={constructs:Uj([XP,...(e||{}).extensions||[]]),content:s(v5),defined:[],document:s(b5),flow:s($P),lazy:{},string:s(UP),text:s(BP)};return r;function s(c){return u;function u(d){return JP(r,c,d)}}}function aU(e){for(;!Gj(e););return e}const dw=/[\0\t\n\r]/g;function rU(){let e=1,t="",n=!0,r;return s;function s(c,u,d){const f=[];let h,g,m,y,b;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),m=0,t="",n&&(c.charCodeAt(0)===65279&&m++,n=void 0);m<c.length;){if(dw.lastIndex=m,h=dw.exec(c),y=h&&h.index!==void 0?h.index:c.length,b=c.charCodeAt(y),!h){t=c.slice(m);break}if(b===10&&m===y&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),m<y&&(f.push(c.slice(m,y)),e+=y-m),b){case 0:{f.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,f.push(-2);e++<g;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}m=y+1}return d&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const iU=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function sU(e){return e.replace(iU,oU)}function oU(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),c=s===120||s===88;return Bj(n.slice(c?2:1),c?16:10)}return qg(n)||e}const Kj={}.hasOwnProperty;function lU(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),cU(n)(aU(nU(n).document().write(rU()(e,t,!0))))}function cU(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Oe),autolinkProtocol:M,autolinkEmail:M,atxHeading:c(qe),blockQuote:c(Ie),characterEscape:M,characterReference:M,codeFenced:c(Ve),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Ve,u),codeText:c(Se,u),codeTextData:M,data:M,codeFlowValue:M,definition:c(ft),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(Me),hardBreakEscape:c(ke),hardBreakTrailing:c(ke),htmlFlow:c(lt,u),htmlFlowData:M,htmlText:c(lt,u),htmlTextData:M,image:c(xe),label:u,link:c(Oe),listItem:c(Dt),listItemValue:y,listOrdered:c(_t,m),listUnordered:c(_t),paragraph:c(Yt),reference:O,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(qe),strong:c(Ft),thematicBreak:c(ye)},exit:{atxHeading:f(),atxHeadingSequence:H,autolink:f(),autolinkEmail:Ee,autolinkProtocol:Re,blockQuote:f(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:le,characterReference:be,codeFenced:f(E),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:k,codeFlowValue:_,codeIndented:f(S),codeText:f(D),codeTextData:_,data:_,definition:f(),definitionDestinationString:R,definitionLabelString:T,definitionTitleString:N,emphasis:f(),hardBreakEscape:f(B),hardBreakTrailing:f(B),htmlFlow:f(Z),htmlFlowData:_,htmlText:f($),htmlTextData:_,image:f(V),label:Q,labelText:X,lineEnding:I,link:f(F),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ne,resourceDestinationString:L,resourceTitleString:P,resource:q,setextHeading:f(G),setextHeadingLineSequence:U,setextHeadingText:A,strong:f(),thematicBreak:f()}};Xj(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(K){let W={type:"root",children:[]};const ee={stack:[W],tokenStack:[],config:t,enter:d,exit:h,buffer:u,resume:g,data:n},ce=[];let he=-1;for(;++he<K.length;)if(K[he][1].type==="listOrdered"||K[he][1].type==="listUnordered")if(K[he][0]==="enter")ce.push(he);else{const Le=ce.pop();he=s(K,Le,he)}for(he=-1;++he<K.length;){const Le=t[K[he][0]];Kj.call(Le,K[he][1].type)&&Le[K[he][1].type].call(Object.assign({sliceSerialize:K[he][2].sliceSerialize},ee),K[he][1])}if(ee.tokenStack.length>0){const Le=ee.tokenStack[ee.tokenStack.length-1];(Le[1]||pw).call(ee,void 0,Le[0])}for(W.position={start:hi(K.length>0?K[0][1].start:{line:1,column:1,offset:0}),end:hi(K.length>0?K[K.length-2][1].end:{line:1,column:1,offset:0})},he=-1;++he<t.transforms.length;)W=t.transforms[he](W)||W;return W}function s(K,W,ee){let ce=W-1,he=-1,Le=!1,He,Ce,Fe,et;for(;++ce<=ee;){const Ne=K[ce];switch(Ne[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ne[0]==="enter"?he++:he--,et=void 0;break}case"lineEndingBlank":{Ne[0]==="enter"&&(He&&!et&&!he&&!Fe&&(Fe=ce),et=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:et=void 0}if(!he&&Ne[0]==="enter"&&Ne[1].type==="listItemPrefix"||he===-1&&Ne[0]==="exit"&&(Ne[1].type==="listUnordered"||Ne[1].type==="listOrdered")){if(He){let Gt=ce;for(Ce=void 0;Gt--;){const At=K[Gt];if(At[1].type==="lineEnding"||At[1].type==="lineEndingBlank"){if(At[0]==="exit")continue;Ce&&(K[Ce][1].type="lineEndingBlank",Le=!0),At[1].type="lineEnding",Ce=Gt}else if(!(At[1].type==="linePrefix"||At[1].type==="blockQuotePrefix"||At[1].type==="blockQuotePrefixWhitespace"||At[1].type==="blockQuoteMarker"||At[1].type==="listItemIndent"))break}Fe&&(!Ce||Fe<Ce)&&(He._spread=!0),He.end=Object.assign({},Ce?K[Ce][1].start:Ne[1].end),K.splice(Ce||ce,0,["exit",He,Ne[2]]),ce++,ee++}if(Ne[1].type==="listItemPrefix"){const Gt={type:"listItem",_spread:!1,start:Object.assign({},Ne[1].start),end:void 0};He=Gt,K.splice(ce,0,["enter",Gt,Ne[2]]),ce++,ee++,Fe=void 0,et=!0}}}return K[W][1]._spread=Le,ee}function c(K,W){return ee;function ee(ce){d.call(this,K(ce),ce),W&&W.call(this,ce)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(K,W,ee){this.stack[this.stack.length-1].children.push(K),this.stack.push(K),this.tokenStack.push([W,ee||void 0]),K.position={start:hi(W.start),end:void 0}}function f(K){return W;function W(ee){K&&K.call(this,ee),h.call(this,ee)}}function h(K,W){const ee=this.stack.pop(),ce=this.tokenStack.pop();if(ce)ce[0].type!==K.type&&(W?W.call(this,K,ce[0]):(ce[1]||pw).call(this,K,ce[0]));else throw new Error("Cannot close `"+K.type+"` ("+Cl({start:K.start,end:K.end})+"): it’s not open");ee.position.end=hi(K.end)}function g(){return Hg(this.stack.pop())}function m(){this.data.expectingFirstListItemValue=!0}function y(K){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(K),10),this.data.expectingFirstListItemValue=void 0}}function b(){const K=this.resume(),W=this.stack[this.stack.length-1];W.lang=K}function k(){const K=this.resume(),W=this.stack[this.stack.length-1];W.meta=K}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){const K=this.resume(),W=this.stack[this.stack.length-1];W.value=K.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const K=this.resume(),W=this.stack[this.stack.length-1];W.value=K.replace(/(\r?\n|\r)$/g,"")}function T(K){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.label=W,ee.identifier=$a(this.sliceSerialize(K)).toLowerCase()}function N(){const K=this.resume(),W=this.stack[this.stack.length-1];W.title=K}function R(){const K=this.resume(),W=this.stack[this.stack.length-1];W.url=K}function H(K){const W=this.stack[this.stack.length-1];if(!W.depth){const ee=this.sliceSerialize(K).length;W.depth=ee}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function U(K){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(K).codePointAt(0)===61?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function M(K){const ee=this.stack[this.stack.length-1].children;let ce=ee[ee.length-1];(!ce||ce.type!=="text")&&(ce=ut(),ce.position={start:hi(K.start),end:void 0},ee.push(ce)),this.stack.push(ce)}function _(K){const W=this.stack.pop();W.value+=this.sliceSerialize(K),W.position.end=hi(K.end)}function I(K){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ee=W.children[W.children.length-1];ee.position.end=hi(K.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(W.type)&&(M.call(this,K),_.call(this,K))}function B(){this.data.atHardBreak=!0}function Z(){const K=this.resume(),W=this.stack[this.stack.length-1];W.value=K}function $(){const K=this.resume(),W=this.stack[this.stack.length-1];W.value=K}function D(){const K=this.resume(),W=this.stack[this.stack.length-1];W.value=K}function F(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=W,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function V(){const K=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";K.type+="Reference",K.referenceType=W,delete K.url,delete K.title}else delete K.identifier,delete K.label;this.data.referenceType=void 0}function X(K){const W=this.sliceSerialize(K),ee=this.stack[this.stack.length-2];ee.label=sU(W),ee.identifier=$a(W).toLowerCase()}function Q(){const K=this.stack[this.stack.length-1],W=this.resume(),ee=this.stack[this.stack.length-1];if(this.data.inReference=!0,ee.type==="link"){const ce=K.children;ee.children=ce}else ee.alt=W}function L(){const K=this.resume(),W=this.stack[this.stack.length-1];W.url=K}function P(){const K=this.resume(),W=this.stack[this.stack.length-1];W.title=K}function q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ne(K){const W=this.resume(),ee=this.stack[this.stack.length-1];ee.label=W,ee.identifier=$a(this.sliceSerialize(K)).toLowerCase(),this.data.referenceType="full"}function ue(K){this.data.characterReferenceType=K.type}function le(K){const W=this.sliceSerialize(K),ee=this.data.characterReferenceType;let ce;ee?(ce=Bj(W,ee==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ce=qg(W);const he=this.stack[this.stack.length-1];he.value+=ce}function be(K){const W=this.stack.pop();W.position.end=hi(K.end)}function Re(K){_.call(this,K);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(K)}function Ee(K){_.call(this,K);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(K)}function Ie(){return{type:"blockquote",children:[]}}function Ve(){return{type:"code",lang:null,meta:null,value:""}}function Se(){return{type:"inlineCode",value:""}}function ft(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Me(){return{type:"emphasis",children:[]}}function qe(){return{type:"heading",depth:0,children:[]}}function ke(){return{type:"break"}}function lt(){return{type:"html",value:""}}function xe(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function _t(K){return{type:"list",ordered:K.type==="listOrdered",start:null,spread:K._spread,children:[]}}function Dt(K){return{type:"listItem",spread:K._spread,checked:null,children:[]}}function Yt(){return{type:"paragraph",children:[]}}function Ft(){return{type:"strong",children:[]}}function ut(){return{type:"text",value:""}}function ye(){return{type:"thematicBreak"}}}function hi(e){return{line:e.line,column:e.column,offset:e.offset}}function Xj(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Xj(e,r):uU(e,r)}}function uU(e,t){let n;for(n in t)if(Kj.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 pw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Cl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Cl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Cl({start:t.start,end:t.end})+") is still open")}function dU(e){const t=this;t.parser=n;function n(r){return lU(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function pU(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 fU(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
1637
|
-
`}]}function hU(e,t){const n=t.value?t.value+`
|
|
1638
|
-
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let c={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function mU(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gU(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vU(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=mo(r.toLowerCase()),c=e.footnoteOrder.indexOf(r);let u,d=e.footnoteCounts.get(r);d===void 0?(d=0,e.footnoteOrder.push(r),u=e.footnoteOrder.length):u=c+1,d+=1,e.footnoteCounts.set(r,d);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function yU(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 bU(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Jj(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 s=e.all(t),c=s[0];c&&c.type==="text"?c.value="["+c.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=r:s.push({type:"text",value:r}),s}function xU(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Jj(e,t);const s={src:mo(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const c={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,c),e.applyData(t,c)}function wU(e,t){const n={src:mo(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 kU(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 SU(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Jj(e,t);const s={href:mo(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const c={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function jU(e,t){const n={href:mo(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 CU(e,t,n){const r=e.all(t),s=n?NU(n):eC(t),c={},u=[];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:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<r.length;){const g=r[d];(s||d!==0||g.type!=="element"||g.tagName!=="p")&&u.push({type:"text",value:`
|
|
1639
|
-
`}),g.type==="element"&&g.tagName==="p"&&!s?u.push(...g.children):u.push(g)}const f=r[r.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&u.push({type:"text",value:`
|
|
1640
|
-
`});const h={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,h),e.applyData(t,h)}function NU(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=eC(n[r])}return t}function eC(e){const t=e.spread;return t??e.children.length>1}function EU(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const u=r[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,c),e.applyData(t,c)}function TU(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AU(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function RU(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _U(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],u),s.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Pg(t.children[1]),f=Lj(t.children[t.children.length-1]);d&&f&&(u.position={start:d,end:f}),s.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function OU(e,t,n){const r=n?n.children:void 0,c=(r?r.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,d=u?u.length:t.children.length;let f=-1;const h=[];for(;++f<d;){const m=t.children[f],y={},b=u?u[f]:void 0;b&&(y.align=b);let k={type:"element",tagName:c,properties:y,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 LU(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const fw=9,hw=32;function zU(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const c=[];for(;r;)c.push(mw(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return c.push(mw(t.slice(s),s>0,!1)),c.join("")}function mw(e,t,n){let r=0,s=e.length;if(t){let c=e.codePointAt(r);for(;c===fw||c===hw;)r++,c=e.codePointAt(r)}if(n){let c=e.codePointAt(s-1);for(;c===fw||c===hw;)s--,c=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function MU(e,t){const n={type:"text",value:zU(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function DU(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const $U={blockquote:pU,break:fU,code:hU,delete:mU,emphasis:gU,footnoteReference:vU,heading:yU,html:bU,imageReference:xU,image:wU,inlineCode:kU,linkReference:SU,link:jU,listItem:CU,list:EU,paragraph:TU,root:AU,strong:RU,table:_U,tableCell:LU,tableRow:OU,text:MU,thematicBreak:DU,toml:wu,yaml:wu,definition:wu,footnoteDefinition:wu};function wu(){}const tC=-1,Ld=0,El=1,id=2,Vg=3,Wg=4,Zg=5,Yg=6,nC=7,aC=8,IU=typeof self=="object"?self:globalThis,gw=(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 IU[e](t)},PU=(e,t)=>{const n=(s,c)=>(e.set(c,s),s),r=s=>{if(e.has(s))return e.get(s);const[c,u]=t[s];switch(c){case Ld:case tC:return n(u,s);case El:{const d=n([],s);for(const f of u)d.push(r(f));return d}case id:{const d=n({},s);for(const[f,h]of u)d[r(f)]=r(h);return d}case Vg:return n(new Date(u),s);case Wg:{const{source:d,flags:f}=u;return n(new RegExp(d,f),s)}case Zg:{const d=n(new Map,s);for(const[f,h]of u)d.set(r(f),r(h));return d}case Yg:{const d=n(new Set,s);for(const f of u)d.add(r(f));return d}case nC:{const{name:d,message:f}=u;return n(gw(d,f),s)}case aC:return n(BigInt(u),s);case"BigInt":return n(Object(BigInt(u)),s);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return n(new DataView(d),u)}}return n(gw(c,u),s)};return r},vw=e=>PU(new Map,e)(0),Gs="",{toString:UU}={},{keys:BU}=Object,gl=e=>{const t=typeof e;if(t!=="object"||!e)return[Ld,t];const n=UU.call(e).slice(8,-1);switch(n){case"Array":return[El,Gs];case"Object":return[id,Gs];case"Date":return[Vg,Gs];case"RegExp":return[Wg,Gs];case"Map":return[Zg,Gs];case"Set":return[Yg,Gs];case"DataView":return[El,n]}return n.includes("Array")?[El,n]:n.includes("Error")?[nC,n]:[id,n]},ku=([e,t])=>e===Ld&&(t==="function"||t==="symbol"),FU=(e,t,n,r)=>{const s=(u,d)=>{const f=r.push(u)-1;return n.set(d,f),f},c=u=>{if(n.has(u))return n.get(u);let[d,f]=gl(u);switch(d){case Ld:{let g=u;switch(f){case"bigint":d=aC,g=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([tC],u)}return s([d,g],u)}case El:{if(f){let y=u;return f==="DataView"?y=new Uint8Array(u.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(u)),s([f,[...y]],u)}const g=[],m=s([d,g],u);for(const y of u)g.push(c(y));return m}case id:{if(f)switch(f){case"BigInt":return s([f,u.toString()],u);case"Boolean":case"Number":case"String":return s([f,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const g=[],m=s([d,g],u);for(const y of BU(u))(e||!ku(gl(u[y])))&&g.push([c(y),c(u[y])]);return m}case Vg:return s([d,u.toISOString()],u);case Wg:{const{source:g,flags:m}=u;return s([d,{source:g,flags:m}],u)}case Zg:{const g=[],m=s([d,g],u);for(const[y,b]of u)(e||!(ku(gl(y))||ku(gl(b))))&&g.push([c(y),c(b)]);return m}case Yg:{const g=[],m=s([d,g],u);for(const y of u)(e||!ku(gl(y)))&&g.push(c(y));return m}}const{message:h}=u;return s([d,{name:f,message:h}],u)};return c},yw=(e,{json:t,lossy:n}={})=>{const r=[];return FU(!(t||n),!!t,new Map,r)(e),r},sd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vw(yw(e,t)):structuredClone(e):(e,t)=>vw(yw(e,t));function HU(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 qU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function GU(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||HU,r=e.options.footnoteBackLabel||qU,s=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let f=-1;for(;++f<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[f]);if(!h)continue;const g=e.all(h),m=String(h.identifier).toUpperCase(),y=mo(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 T=typeof n=="string"?n:n(f,b);typeof T=="string"&&(T={type:"text",value:T}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,b),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const E=g[g.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...k)}else g.push(...k);const S={type:"element",tagName:"li",properties:{id:t+"fn-"+y},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:c,properties:{...sd(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
1641
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
1642
|
-
`}]}}const zd=(function(e){if(e==null)return YU;if(typeof e=="function")return Md(e);if(typeof e=="object")return Array.isArray(e)?VU(e):WU(e);if(typeof e=="string")return ZU(e);throw new Error("Expected function, string, or object as test")});function VU(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=zd(e[n]);return Md(r);function r(...s){let c=-1;for(;++c<t.length;)if(t[c].apply(this,s))return!0;return!1}}function WU(e){const t=e;return Md(n);function n(r){const s=r;let c;for(c in e)if(s[c]!==t[c])return!1;return!0}}function ZU(e){return Md(t);function t(n){return n&&n.type===e}}function Md(e){return t;function t(n,r,s){return!!(QU(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function YU(){return!0}function QU(e){return e!==null&&typeof e=="object"&&"type"in e}const rC=[],KU=!0,Em=!1,XU="skip";function iC(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const c=zd(s),u=r?-1:1;d(e,void 0,[])();function d(f,h,g){const m=f&&typeof f=="object"?f:{};if(typeof m.type=="string"){const b=typeof m.tagName=="string"?m.tagName:typeof m.name=="string"?m.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=rC,k,j,E;if((!t||c(f,h,g[g.length-1]||void 0))&&(b=JU(n(f,g)),b[0]===Em))return b;if("children"in f&&f.children){const S=f;if(S.children&&b[0]!==XU)for(j=(r?S.children.length:-1)+u,E=g.concat(S);j>-1&&j<S.children.length;){const T=S.children[j];if(k=d(T,j,E)(),k[0]===Em)return k;j=typeof k[1]=="number"?k[1]:j+u}}return b}}}function JU(e){return Array.isArray(e)?e:typeof e=="number"?[KU,e]:e==null?rC:[e]}function Qg(e,t,n,r){let s,c,u;typeof t=="function"&&typeof n!="function"?(c=void 0,u=t,s=n):(c=t,u=n,s=r),iC(e,c,d,s);function d(f,h){const g=h[h.length-1],m=g?g.children.indexOf(f):void 0;return u(f,m,g)}}const Tm={}.hasOwnProperty,e8={};function t8(e,t){const n=t||e8,r=new Map,s=new Map,c=new Map,u={...$U,...n.handlers},d={all:h,applyData:a8,definitionById:r,footnoteById:s,footnoteCounts:c,footnoteOrder:[],handlers:u,one:f,options:n,patch:n8,wrap:i8};return Qg(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?r:s,y=String(g.identifier).toUpperCase();m.has(y)||m.set(y,g)}}),d;function f(g,m){const y=g.type,b=d.handlers[y];if(Tm.call(d.handlers,y)&&b)return b(d,g,m);if(d.options.passThrough&&d.options.passThrough.includes(y)){if("children"in g){const{children:j,...E}=g,S=sd(E);return S.children=d.all(g),S}return sd(g)}return(d.options.unknownHandler||r8)(d,g,m)}function h(g){const m=[];if("children"in g){const y=g.children;let b=-1;for(;++b<y.length;){const k=d.one(y[b],g);if(k){if(b&&y[b-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=bw(k.value)),!Array.isArray(k)&&k.type==="element")){const j=k.children[0];j&&j.type==="text"&&(j.value=bw(j.value))}Array.isArray(k)?m.push(...k):m.push(k)}}}return m}}function n8(e,t){e.position&&(t.position=HI(e))}function a8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,c=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const u="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:u}}n.type==="element"&&c&&Object.assign(n.properties,sd(c)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function r8(e,t){const n=t.data||{},r="value"in t&&!(Tm.call(n,"hProperties")||Tm.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 i8(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
1643
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
1644
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
1645
|
-
`}),n}function bw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function xw(e,t){const n=t8(e,t),r=n.one(e,void 0),s=GU(n),c=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&c.children.push({type:"text",value:`
|
|
1646
|
-
`},s),c}function s8(e,t){return e&&"run"in e?async function(n,r){const s=xw(n,{file:r,...t});await e.run(s,r)}:function(n,r){return xw(n,{file:r,...e||t})}}function ww(e){if(e)throw e}var _h,kw;function o8(){if(kw)return _h;kw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},c=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 y;for(y in h);return typeof y>"u"||e.call(h,y)},u=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 _h=function f(){var h,g,m,y,b,k,j=arguments[0],E=1,S=arguments.length,T=!1;for(typeof j=="boolean"&&(T=j,j=arguments[1]||{},E=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});E<S;++E)if(h=arguments[E],h!=null)for(g in h)m=d(j,g),y=d(h,g),j!==y&&(T&&y&&(c(y)||(b=s(y)))?(b?(b=!1,k=m&&s(m)?m:[]):k=m&&c(m)?m:{},u(j,{name:g,newValue:f(T,k,y)})):typeof y<"u"&&u(j,{name:g,newValue:y}));return j},_h}var l8=o8();const Oh=Dl(l8);function Am(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 c8(){const e=[],t={run:n,use:r};return t;function n(...s){let c=-1;const u=s.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...s);function d(f,...h){const g=e[++c];let m=-1;if(f){u(f);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,g?u8(g,d)(...h):u(null,...h)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function u8(e,t){let n;return r;function r(...u){const d=e.length>u.length;let f;d&&u.push(s);try{f=e.apply(this,u)}catch(h){const g=h;if(d&&n)throw g;return s(g)}d||(f&&f.then&&typeof f.then=="function"?f.then(c,s):f instanceof Error?s(f):c(f))}function s(u,...d){n||(n=!0,t(u,...d))}function c(u){s(null,u)}}const Ja={basename:d8,dirname:p8,extname:f8,join:h8,sep:"/"};function d8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Vl(e);let n=0,r=-1,s=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(c){n=s+1;break}}else r<0&&(c=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let u=-1,d=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(c){n=s+1;break}}else u<0&&(c=!0,u=s+1),d>-1&&(e.codePointAt(s)===t.codePointAt(d--)?d<0&&(r=s):(d=-1,r=u));return n===r?r=u:r<0&&(r=e.length),e.slice(n,r)}function p8(e){if(Vl(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 f8(e){Vl(e);let t=e.length,n=-1,r=0,s=-1,c=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){r=t+1;break}continue}n<0&&(u=!0,n=t+1),d===46?s<0?s=t:c!==1&&(c=1):s>-1&&(c=-1)}return s<0||n<0||c===0||c===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function h8(...e){let t=-1,n;for(;++t<e.length;)Vl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":m8(n)}function m8(e){Vl(e);const t=e.codePointAt(0)===47;let n=g8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function g8(e,t){let n="",r=0,s=-1,c=0,u=-1,d,f;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(s===u-1||c===1))if(s!==u-1&&c===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),s=u,c=0;continue}}else if(n.length>0){n="",r=0,s=u,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),r=u-s-1;s=u,c=0}else d===46&&c>-1?c++:c=-1}return n}function Vl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const v8={cwd:y8};function y8(){return"/"}function Rm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function b8(e){if(typeof e=="string")e=new URL(e);else if(!Rm(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 x8(e)}function x8(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 s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Lh=["history","path","basename","stem","extname","dirname"];class sC{constructor(t){let n;t?Rm(t)?n={path:t}:typeof t=="string"||w8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":v8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Lh.length;){const c=Lh[r];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let s;for(s in n)Lh.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ja.basename(this.path):void 0}set basename(t){Mh(t,"basename"),zh(t,"basename"),this.path=Ja.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ja.dirname(this.path):void 0}set dirname(t){Sw(this.basename,"dirname"),this.path=Ja.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ja.extname(this.path):void 0}set extname(t){if(zh(t,"extname"),Sw(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=Ja.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Rm(t)&&(t=b8(t)),Mh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ja.basename(this.path,this.extname):void 0}set stem(t){Mh(t,"stem"),zh(t,"stem"),this.path=Ja.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new An(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zh(e,t){if(e&&e.includes(Ja.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ja.sep+"`")}function Mh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Sw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function w8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const k8=(function(e){const r=this.constructor.prototype,s=r[e],c=function(){return s.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),S8={}.hasOwnProperty;class Kg extends k8{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=c8()}copy(){const t=new Kg;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Oh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ih("data",this.frozen),this.namespace[t]=n,this):S8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ih("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 s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Su(t),r=this.parser||this.Parser;return Dh("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dh("process",this.parser||this.Parser),$h("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(c,u){const d=Su(t),f=r.parse(d);r.run(f,d,function(g,m,y){if(g||!m||!y)return h(g);const b=m,k=r.stringify(b,y);N8(k)?y.value=k:y.result=k,h(g,y)});function h(g,m){g||!m?u(g):c?c(m):n(void 0,m)}}}processSync(t){let n=!1,r;return this.freeze(),Dh("processSync",this.parser||this.Parser),$h("processSync",this.compiler||this.Compiler),this.process(t,s),Cw("processSync","process",n),r;function s(c,u){n=!0,ww(c),r=u}}run(t,n,r){jw(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?c(void 0,r):new Promise(c);function c(u,d){const f=Su(n);s.run(t,f,h);function h(g,m,y){const b=m||t;g?d(g):u?u(b):r(void 0,b,y)}}}runSync(t,n){let r=!1,s;return this.run(t,n,c),Cw("runSync","run",r),s;function c(u,d){ww(u),s=d,r=!0}}stringify(t,n){this.freeze();const r=Su(n),s=this.compiler||this.Compiler;return $h("stringify",s),jw(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Ih("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;f(g,m)}else u(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function u(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&&(s.settings=Oh(!0,s.settings,h.settings))}function d(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];c(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,y=-1;for(;++m<r.length;)if(r[m][0]===h){y=m;break}if(y===-1)r.push([h,...g]);else if(g.length>0){let[b,...k]=g;const j=r[y][1];Am(j)&&Am(b)&&(b=Oh(!0,j,b)),r[y]=[h,b,...k]}}}}const j8=new Kg().freeze();function Dh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $h(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ih(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 jw(e){if(!Am(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cw(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Su(e){return C8(e)?e:new sC(e)}function C8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function N8(e){return typeof e=="string"||E8(e)}function E8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const T8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nw=[],Ew={allowDangerousHtml:!0},A8=/^(https?|ircs?|mailto|xmpp)$/i,R8=[{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 _8(e){const t=O8(e),n=L8(e);return z8(t.runSync(t.parse(n),n),e)}function O8(e){const t=e.rehypePlugins||Nw,n=e.remarkPlugins||Nw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ew}:Ew;return j8().use(dU).use(n).use(s8,r).use(t)}function L8(e){const t=e.children||"",n=new sC;return typeof t=="string"&&(n.value=t),n}function z8(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,c=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,f=t.urlTransform||M8;for(const g of R8)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+T8+g.id,void 0);return Qg(e,h),ZI(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(g,m,y){if(g.type==="raw"&&y&&typeof m=="number")return u?y.children.splice(m,1):y.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in Th)if(Object.hasOwn(Th,b)&&Object.hasOwn(g.properties,b)){const k=g.properties[b],j=Th[b];(j===null||j.includes(g.tagName))&&(g.properties[b]=f(String(k||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):c?c.includes(g.tagName):!1;if(!b&&r&&typeof m=="number"&&(b=!r(g,m,y)),b&&y&&typeof m=="number")return d&&g.children?y.children.splice(m,1,...g.children):y.children.splice(m,1),m}}}function M8(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||A8.test(e.slice(0,t))?e:""}function Tw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function D8(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function oC(e,t,n){const s=zd((n||{}).ignore||[]),c=$8(t);let u=-1;for(;++u<c.length;)iC(e,"text",d);function d(h,g){let m=-1,y;for(;++m<g.length;){const b=g[m],k=y?y.children:void 0;if(s(b,k?k.indexOf(b):void 0,y))return;y=b}if(y)return f(h,g)}function f(h,g){const m=g[g.length-1],y=c[u][0],b=c[u][1];let k=0;const E=m.children.indexOf(h);let S=!1,T=[];y.lastIndex=0;let N=y.exec(h.value);for(;N;){const R=N.index,H={index:N.index,input:N.input,stack:[...g,h]};let A=b(...N,H);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?y.lastIndex=R+1:(k!==R&&T.push({type:"text",value:h.value.slice(k,R)}),Array.isArray(A)?T.push(...A):A&&T.push(A),k=R+N[0].length,S=!0),!y.global)break;N=y.exec(h.value)}return S?(k<h.value.length&&T.push({type:"text",value:h.value.slice(k)}),m.children.splice(E,1,...T)):T=[h],E+T.length}}function $8(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 s=n[r];t.push([I8(s[0]),P8(s[1])])}return t}function I8(e){return typeof e=="string"?new RegExp(D8(e),"g"):e}function P8(e){return typeof e=="function"?e:function(){return e}}const Ph="phrasing",Uh=["autolink","link","image","label"];function U8(){return{transforms:[W8],enter:{literalAutolink:F8,literalAutolinkEmail:Bh,literalAutolinkHttp:Bh,literalAutolinkWww:Bh},exit:{literalAutolink:V8,literalAutolinkEmail:G8,literalAutolinkHttp:H8,literalAutolinkWww:q8}}}function B8(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Uh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ph,notInConstruct:Uh},{character:":",before:"[ps]",after:"\\/",inConstruct:Ph,notInConstruct:Uh}]}}function F8(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Bh(e){this.config.enter.autolinkProtocol.call(this,e)}function H8(e){this.config.exit.autolinkProtocol.call(this,e)}function q8(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 G8(e){this.config.exit.autolinkEmail.call(this,e)}function V8(e){this.exit(e)}function W8(e){oC(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Z8],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Y8]],{ignore:["link","linkReference"]})}function Z8(e,t,n,r,s){let c="";if(!lC(s)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!Q8(n)))return!1;const u=K8(n+r);if(!u[0])return!1;const d={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function Y8(e,t,n,r){return!lC(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Q8(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 K8(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 s=Tw(e,"(");let c=Tw(e,")");for(;r!==-1&&s>c;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),c++;return[e,n]}function lC(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Xi(n)||_d(n))&&(!t||n!==47)}cC.peek=s9;function X8(){this.buffer()}function J8(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function e9(){this.buffer()}function t9(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function n9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function a9(e){this.exit(e)}function r9(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=$a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function i9(e){this.exit(e)}function s9(){return"["}function cC(e,t,n,r){const s=n.createTracker(r);let c=s.move("[^");const u=n.enter("footnoteReference"),d=n.enter("reference");return c+=s.move(n.safe(n.associationId(e),{after:"]",before:c})),d(),u(),c+=s.move("]"),c}function o9(){return{enter:{gfmFootnoteCallString:X8,gfmFootnoteCall:J8,gfmFootnoteDefinitionLabelString:e9,gfmFootnoteDefinition:t9},exit:{gfmFootnoteCallString:n9,gfmFootnoteCall:a9,gfmFootnoteDefinitionLabelString:r9,gfmFootnoteDefinition:i9}}}function l9(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:cC},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,c,u){const d=c.createTracker(u);let f=d.move("[^");const h=c.enter("footnoteDefinition"),g=c.enter("label");return f+=d.move(c.safe(c.associationId(r),{before:f,after:"]"})),g(),f+=d.move("]:"),r.children&&r.children.length>0&&(d.shift(4),f+=d.move((t?`
|
|
1647
|
-
`:" ")+c.indentLines(c.containerFlow(r,d.current()),t?uC:c9))),h(),f}}function c9(e,t,n){return t===0?e:uC(e,t,n)}function uC(e,t,n){return(n?"":" ")+e}const u9=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];dC.peek=m9;function d9(){return{canContainEols:["delete"],enter:{strikethrough:f9},exit:{strikethrough:h9}}}function p9(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:u9}],handlers:{delete:dC}}}function f9(e){this.enter({type:"delete",children:[]},e)}function h9(e){this.exit(e)}function dC(e,t,n,r){const s=n.createTracker(r),c=n.enter("strikethrough");let u=s.move("~~");return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),c(),u}function m9(){return"~"}function g9(e){return e.length}function v9(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||g9,c=[],u=[],d=[],f=[];let h=0,g=-1;for(;++g<e.length;){const j=[],E=[];let S=-1;for(e[g].length>h&&(h=e[g].length);++S<e[g].length;){const T=y9(e[g][S]);if(n.alignDelimiters!==!1){const N=s(T);E[S]=N,(f[S]===void 0||N>f[S])&&(f[S]=N)}j.push(T)}u[g]=j,d[g]=E}let m=-1;if(typeof r=="object"&&"length"in r)for(;++m<h;)c[m]=Aw(r[m]);else{const j=Aw(r);for(;++m<h;)c[m]=j}m=-1;const y=[],b=[];for(;++m<h;){const j=c[m];let E="",S="";j===99?(E=":",S=":"):j===108?E=":":j===114&&(S=":");let T=n.alignDelimiters===!1?1:Math.max(1,f[m]-E.length-S.length);const N=E+"-".repeat(T)+S;n.alignDelimiters!==!1&&(T=E.length+T+S.length,T>f[m]&&(f[m]=T),b[m]=T),y[m]=N}u.splice(1,0,y),d.splice(1,0,b),g=-1;const k=[];for(;++g<u.length;){const j=u[g],E=d[g];m=-1;const S=[];for(;++m<h;){const T=j[m]||"";let N="",R="";if(n.alignDelimiters!==!1){const H=f[m]-(E[m]||0),A=c[m];A===114?N=" ".repeat(H):A===99?H%2?(N=" ".repeat(H/2+.5),R=" ".repeat(H/2-.5)):(N=" ".repeat(H/2),R=N):R=" ".repeat(H)}n.delimiterStart!==!1&&!m&&S.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&T==="")&&(n.delimiterStart!==!1||m)&&S.push(" "),n.alignDelimiters!==!1&&S.push(N),S.push(T),n.alignDelimiters!==!1&&S.push(R),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(`
|
|
1648
|
-
`)}function y9(e){return e==null?"":String(e)}function Aw(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 b9(e,t,n,r){const s=n.enter("blockquote"),c=n.createTracker(r);c.move("> "),c.shift(2);const u=n.indentLines(n.containerFlow(e,c.current()),x9);return s(),u}function x9(e,t,n){return">"+(n?"":" ")+e}function w9(e,t){return Rw(e,t.inConstruct,!0)&&!Rw(e,t.notInConstruct,!1)}function Rw(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 _w(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
1649
|
-
`&&w9(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
|
|
1650
|
-
`}function k9(e,t){const n=String(e);let r=n.indexOf(t),s=r,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++c>u&&(u=c):c=1,s=r+t.length,r=n.indexOf(t,s);return u}function S9(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 j9(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 C9(e,t,n,r){const s=j9(n),c=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(S9(e,n)){const m=n.enter("codeIndented"),y=n.indentLines(c,N9);return m(),y}const d=n.createTracker(r),f=s.repeat(Math.max(k9(c,s)+1,3)),h=n.enter("codeFenced");let g=d.move(f);if(e.lang){const m=n.enter(`codeFencedLang${u}`);g+=d.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...d.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${u}`);g+=d.move(" "),g+=d.move(n.safe(e.meta,{before:g,after:`
|
|
1651
|
-
`,encode:["`"],...d.current()})),m()}return g+=d.move(`
|
|
1652
|
-
`),c&&(g+=d.move(c+`
|
|
1653
|
-
`)),g+=d.move(f),h(),g}function N9(e,t,n){return(n?"":" ")+e}function Xg(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 E9(e,t,n,r){const s=Xg(n),c=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
1654
|
-
`,...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),u(),h}function T9(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 zl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function od(e,t,n){const r=so(e),s=so(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}pC.peek=A9;function pC(e,t,n,r){const s=T9(n),c=n.enter("emphasis"),u=n.createTracker(r),d=u.move(s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=od(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=zl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=od(r.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+zl(m));const b=u.move(s);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function A9(e,t,n){return n.options.emphasis||"*"}function R9(e,t){let n=!1;return Qg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Em}),!!((!e.depth||e.depth<3)&&Hg(e)&&(t.options.setext||n))}function _9(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(r);if(R9(e,n)){const g=n.enter("headingSetext"),m=n.enter("phrasing"),y=n.containerPhrasing(e,{...c.current(),before:`
|
|
1655
|
-
`,after:`
|
|
1656
|
-
`});return m(),g(),y+`
|
|
1657
|
-
`+(s===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
|
|
1658
|
-
`))+1))}const u="#".repeat(s),d=n.enter("headingAtx"),f=n.enter("phrasing");c.move(u+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
1659
|
-
`,...c.current()});return/^[\t ]/.test(h)&&(h=zl(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,n.options.closeAtx&&(h+=" "+u),f(),d(),h}fC.peek=O9;function fC(e){return e.value||""}function O9(){return"<"}hC.peek=L9;function hC(e,t,n,r){const s=Xg(n),c=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let d=n.enter("label");const f=n.createTracker(r);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(d=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),d(),e.title&&(d=n.enter(`title${c}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),d()),h+=f.move(")"),u(),h}function L9(){return"!"}mC.peek=z9;function mC(e,t,n,r){const s=e.referenceType,c=n.enter("imageReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("![");const h=n.safe(e.alt,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,c(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function z9(){return"!"}gC.peek=M9;function gC(e,t,n){let r=e.value||"",s="`",c=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<n.unsafe.length;){const u=n.unsafe[c],d=n.compilePattern(u);let f;if(u.atBreak)for(;f=d.exec(r);){let h=f.index;r.charCodeAt(h)===10&&r.charCodeAt(h-1)===13&&h--,r=r.slice(0,h)+" "+r.slice(f.index+1)}}return s+r+s}function M9(){return"`"}function vC(e,t){const n=Hg(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))}yC.peek=D9;function yC(e,t,n,r){const s=Xg(n),c=s==='"'?"Quote":"Apostrophe",u=n.createTracker(r);let d,f;if(vC(e,n)){const g=n.stack;n.stack=[],d=n.enter("autolink");let m=u.move("<");return m+=u.move(n.containerPhrasing(e,{before:m,after:">",...u.current()})),m+=u.move(">"),d(),n.stack=g,m}d=n.enter("link"),f=n.enter("label");let h=u.move("[");return h+=u.move(n.containerPhrasing(e,{before:h,after:"](",...u.current()})),h+=u.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(e.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(f=n.enter("destinationRaw"),h+=u.move(n.safe(e.url,{before:h,after:e.title?" ":")",...u.current()}))),f(),e.title&&(f=n.enter(`title${c}`),h+=u.move(" "+s),h+=u.move(n.safe(e.title,{before:h,after:s,...u.current()})),h+=u.move(s),f()),h+=u.move(")"),d(),h}function D9(e,t,n){return vC(e,n)?"<":"["}bC.peek=$9;function bC(e,t,n,r){const s=e.referenceType,c=n.enter("linkReference");let u=n.enter("label");const d=n.createTracker(r);let f=d.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...d.current()});f+=d.move(h+"]["),u();const g=n.stack;n.stack=[],u=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...d.current()});return u(),n.stack=g,c(),s==="full"||!h||h!==m?f+=d.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=d.move("]"),f}function $9(){return"["}function Jg(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 I9(e){const t=Jg(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 P9(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 xC(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 U9(e,t,n,r){const s=n.enter("list"),c=n.bulletCurrent;let u=e.ordered?P9(n):Jg(n);const d=e.ordered?u==="."?")":".":I9(n);let f=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&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&&(f=!0),xC(n)===u&&g){let m=-1;for(;++m<e.children.length;){const y=e.children[m];if(y&&y.type==="listItem"&&y.children&&y.children[0]&&y.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(u=d),n.bulletCurrent=u;const h=n.containerFlow(e,r);return n.bulletLastUsed=u,n.bulletCurrent=c,s(),h}function B9(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 F9(e,t,n,r){const s=B9(n);let c=n.bulletCurrent||Jg(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=n.createTracker(r);d.move(c+" ".repeat(u-c.length)),d.shift(u);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,d.current()),g);return f(),h;function g(m,y,b){return y?(b?"":" ".repeat(u))+m:(b?c:c+" ".repeat(u-c.length))+m}}function H9(e,t,n,r){const s=n.enter("paragraph"),c=n.enter("phrasing"),u=n.containerPhrasing(e,r);return c(),s(),u}const q9=zd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function G9(e,t,n,r){return(e.children.some(function(u){return q9(u)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function V9(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}wC.peek=W9;function wC(e,t,n,r){const s=V9(n),c=n.enter("strong"),u=n.createTracker(r),d=u.move(s+s);let f=u.move(n.containerPhrasing(e,{after:s,before:d,...u.current()}));const h=f.charCodeAt(0),g=od(r.before.charCodeAt(r.before.length-1),h,s);g.inside&&(f=zl(h)+f.slice(1));const m=f.charCodeAt(f.length-1),y=od(r.after.charCodeAt(0),m,s);y.inside&&(f=f.slice(0,-1)+zl(m));const b=u.move(s+s);return c(),n.attentionEncodeSurroundingInfo={after:y.outside,before:g.outside},d+f+b}function W9(e,t,n){return n.options.strong||"*"}function Z9(e,t,n,r){return n.safe(e.value,r)}function Y9(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 Q9(e,t,n){const r=(xC(n)+(n.options.ruleSpaces?" ":"")).repeat(Y9(n));return n.options.ruleSpaces?r.slice(0,-1):r}const kC={blockquote:b9,break:_w,code:C9,definition:E9,emphasis:pC,hardBreak:_w,heading:_9,html:fC,image:hC,imageReference:mC,inlineCode:gC,link:yC,linkReference:bC,list:U9,listItem:F9,paragraph:H9,root:G9,strong:wC,text:Z9,thematicBreak:Q9};function K9(){return{enter:{table:X9,tableData:Ow,tableHeader:Ow,tableRow:eB},exit:{codeText:tB,table:J9,tableData:Fh,tableHeader:Fh,tableRow:Fh}}}function X9(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 J9(e){this.exit(e),this.data.inTable=void 0}function eB(e){this.enter({type:"tableRow",children:[]},e)}function Fh(e){this.exit(e)}function Ow(e){this.enter({type:"tableCell",children:[]},e)}function tB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,nB));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function nB(e,t){return t==="|"?t:e}function aB(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
1660
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:y,table:u,tableCell:f,tableRow:d}};function u(b,k,j,E){return h(g(b,j,E),b.align)}function d(b,k,j,E){const S=m(b,j,E),T=h([S]);return T.slice(0,T.indexOf(`
|
|
1661
|
-
`))}function f(b,k,j,E){const S=j.enter("tableCell"),T=j.enter("phrasing"),N=j.containerPhrasing(b,{...E,before:c,after:c});return T(),S(),N}function h(b,k){return v9(b,{align:k,alignDelimiters:r,padding:n,stringLength:s})}function g(b,k,j){const E=b.children;let S=-1;const T=[],N=k.enter("table");for(;++S<E.length;)T[S]=m(E[S],k,j);return N(),T}function m(b,k,j){const E=b.children;let S=-1;const T=[],N=k.enter("tableRow");for(;++S<E.length;)T[S]=f(E[S],b,k,j);return N(),T}function y(b,k,j){let E=kC.inlineCode(b,k,j);return j.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function rB(){return{exit:{taskListCheckValueChecked:Lw,taskListCheckValueUnchecked:Lw,paragraph:sB}}}function iB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:oB}}}function Lw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function sB(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 s=t.children;let c=-1,u;for(;++c<s.length;){const d=s[c];if(d.type==="paragraph"){u=d;break}}u===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 oB(e,t,n,r){const s=e.children[0],c=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);c&&d.move(u);let f=kC.listItem(e,t,n,{...r,...d.current()});return c&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+u}}function lB(){return[U8(),o9(),d9(),K9(),rB()]}function cB(e){return{extensions:[B8(),l9(e),p9(),aB(e),iB()]}}const uB={tokenize:gB,partial:!0},SC={tokenize:vB,partial:!0},jC={tokenize:yB,partial:!0},CC={tokenize:bB,partial:!0},dB={tokenize:xB,partial:!0},NC={name:"wwwAutolink",tokenize:hB,previous:TC},EC={name:"protocolAutolink",tokenize:mB,previous:AC},Pr={name:"emailAutolink",tokenize:fB,previous:RC},ir={};function pB(){return{text:ir}}let Hi=48;for(;Hi<123;)ir[Hi]=Pr,Hi++,Hi===58?Hi=65:Hi===91&&(Hi=97);ir[43]=Pr;ir[45]=Pr;ir[46]=Pr;ir[95]=Pr;ir[72]=[Pr,EC];ir[104]=[Pr,EC];ir[87]=[Pr,NC];ir[119]=[Pr,NC];function fB(e,t,n){const r=this;let s,c;return u;function u(m){return!_m(m)||!RC.call(r,r.previous)||ev(r.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(m))}function d(m){return _m(m)?(e.consume(m),d):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(dB,g,h)(m):m===45||m===95||En(m)?(c=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return c&&s&&zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function hB(e,t,n){const r=this;return s;function s(u){return u!==87&&u!==119||!TC.call(r,r.previous)||ev(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(uB,e.attempt(SC,e.attempt(jC,c),n),n)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function mB(e,t,n){const r=this;let s="",c=!1;return u;function u(m){return(m===72||m===104)&&AC.call(r,r.previous)&&!ev(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),d):n(m)}function d(m){if(zn(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),d;if(m===58){const y=s.toLowerCase();if(y==="http"||y==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),c?h:(c=!0,f)):n(m)}function h(m){return m===null||rd(m)||Tt(m)||Xi(m)||_d(m)?n(m):e.attempt(SC,e.attempt(jC,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function gB(e,t,n){let r=0;return s;function s(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),s):u===46&&r===3?(e.consume(u),c):n(u)}function c(u){return u===null?n(u):t(u)}}function vB(e,t,n){let r,s,c;return u;function u(h){return h===46||h===95?e.check(CC,f,d)(h):h===null||Tt(h)||Xi(h)||h!==45&&_d(h)?f(h):(c=!0,e.consume(h),u)}function d(h){return h===95?r=!0:(s=r,r=void 0),e.consume(h),u}function f(h){return s||r||!c?n(h):t(h)}}function yB(e,t){let n=0,r=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&r<n?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(CC,t,c)(u):u===null||Tt(u)||Xi(u)?t(u):(e.consume(u),s)}function c(u){return u===41&&r++,e.consume(u),s}}function bB(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),c):d===93?(e.consume(d),s):d===60||d===null||Tt(d)||Xi(d)?t(d):n(d)}function s(d){return d===null||d===40||d===91||Tt(d)||Xi(d)?t(d):r(d)}function c(d){return zn(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):zn(d)?(e.consume(d),u):n(d)}}function xB(e,t,n){return r;function r(c){return e.consume(c),s}function s(c){return En(c)?n(c):t(c)}}function TC(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function AC(e){return!zn(e)}function RC(e){return!(e===47||_m(e))}function _m(e){return e===43||e===45||e===46||e===95||En(e)}function ev(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 wB={tokenize:AB,partial:!0};function kB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:NB,continuation:{tokenize:EB},exit:TB}},text:{91:{name:"gfmFootnoteCall",tokenize:CB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:SB,resolveTo:jB}}}}function SB(e,t,n){const r=this;let s=r.events.length;const c=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;s--;){const f=r.events[s][1];if(f.type==="labelImage"){u=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return d;function d(f){if(!u||!u._balanced)return n(f);const h=$a(r.sliceSerialize({start:u.end,end:r.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function jB(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)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function CB(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c=0,u;return d;function d(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(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(c>999||m===93&&!u||m===null||m===91||Tt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteCallString");return s.includes($a(r.sliceSerialize(y)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return Tt(m)||(u=!0),c++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),c++,h):h(m)}}function NB(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,u=0,d;return f;function f(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(u>999||k===93&&!d||k===null||k===91||Tt(k))return n(k);if(k===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return c=$a(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),y}return Tt(k)||(d=!0),u++,e.consume(k),k===92?m:g}function m(k){return k===91||k===92||k===93?(e.consume(k),u++,g):g(k)}function y(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(c)||s.push(c),dt(e,b,"gfmFootnoteDefinitionWhitespace")):n(k)}function b(k){return t(k)}}function EB(e,t,n){return e.check(Gl,t,e.attempt(wB,t,n))}function TB(e){e.exit("gfmFootnoteDefinition")}function AB(e,t,n){const r=this;return dt(e,s,"gfmFootnoteDefinitionIndent",5);function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):n(c)}}function RB(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:c,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(u,d){let f=-1;for(;++f<u.length;)if(u[f][0]==="enter"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._close){let h=f;for(;h--;)if(u[h][0]==="exit"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._open&&u[f][1].end.offset-u[f][1].start.offset===u[h][1].end.offset-u[h][1].start.offset){u[f][1].type="strikethroughSequence",u[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},u[h][1].start),end:Object.assign({},u[f][1].end)},m={type:"strikethroughText",start:Object.assign({},u[h][1].end),end:Object.assign({},u[f][1].start)},y=[["enter",g,d],["enter",u[h][1],d],["exit",u[h][1],d],["enter",m,d]],b=d.parser.constructs.insideSpan.null;b&&sa(y,y.length,0,Od(b,u.slice(h+1,f),d)),sa(y,y.length,0,[["exit",m,d],["enter",u[f][1],d],["exit",u[f][1],d],["exit",g,d]]),sa(u,h-1,f-h+3,y),f=h+y.length-2;break}}for(f=-1;++f<u.length;)u[f][1].type==="strikethroughSequenceTemporary"&&(u[f][1].type="data");return u}function c(u,d,f){const h=this.previous,g=this.events;let m=0;return y;function y(k){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(k):(u.enter("strikethroughSequenceTemporary"),b(k))}function b(k){const j=so(h);if(k===126)return m>1?f(k):(u.consume(k),m++,b);if(m<2&&!n)return f(k);const E=u.exit("strikethroughSequenceTemporary"),S=so(k);return E._open=!S||S===2&&!!j,E._close=!j||j===2&&!!S,d(k)}}}class _B{constructor(){this.map=[]}add(t,n,r){OB(this,t,n,r)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[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 s=r.pop();for(;s;){for(const c of s)t.push(c);s=r.pop()}this.map.length=0}}function OB(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function LB(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=r.length-1;r[c]=r[c]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function zB(){return{flow:{null:{name:"table",tokenize:MB,resolveAll:DB}}}}function MB(e,t,n){const r=this;let s=0,c=0,u;return d;function d(_){let I=r.events.length-1;for(;I>-1;){const $=r.events[I][1].type;if($==="lineEnding"||$==="linePrefix")I--;else break}const B=I>-1?r.events[I][1].type:null,Z=B==="tableHead"||B==="tableRow"?A:f;return Z===A&&r.parser.lazy[r.now().line]?n(_):Z(_)}function f(_){return e.enter("tableHead"),e.enter("tableRow"),h(_)}function h(_){return _===124||(u=!0,c+=1),g(_)}function g(_){return _===null?n(_):Pe(_)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),b):n(_):it(_)?dt(e,g,"whitespace")(_):(c+=1,u&&(u=!1,s+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),u=!0,g):(e.enter("data"),m(_)))}function m(_){return _===null||_===124||Tt(_)?(e.exit("data"),g(_)):(e.consume(_),_===92?y:m)}function y(_){return _===92||_===124?(e.consume(_),m):m(_)}function b(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(e.enter("tableDelimiterRow"),u=!1,it(_)?dt(e,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):k(_))}function k(_){return _===45||_===58?E(_):_===124?(u=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),j):H(_)}function j(_){return it(_)?dt(e,E,"whitespace")(_):E(_)}function E(_){return _===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),S):_===45?(c+=1,S(_)):_===null||Pe(_)?R(_):H(_)}function S(_){return _===45?(e.enter("tableDelimiterFiller"),T(_)):H(_)}function T(_){return _===45?(e.consume(_),T):_===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(_))}function N(_){return it(_)?dt(e,R,"whitespace")(_):R(_)}function R(_){return _===124?k(_):_===null||Pe(_)?!u||s!==c?H(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):H(_)}function H(_){return n(_)}function A(_){return e.enter("tableRow"),U(_)}function U(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),U):_===null||Pe(_)?(e.exit("tableRow"),t(_)):it(_)?dt(e,U,"whitespace")(_):(e.enter("data"),G(_))}function G(_){return _===null||_===124||Tt(_)?(e.exit("data"),U(_)):(e.consume(_),_===92?M:G)}function M(_){return _===92||_===124?(e.consume(_),G):G(_)}}function DB(e,t){let n=-1,r=!0,s=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,f=0,h,g,m;const y=new _B;for(;++n<e.length;){const b=e[n],k=b[1];b[0]==="enter"?k.type==="tableHead"?(d=!1,f!==0&&(zw(y,t,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(r=!0,m=void 0,c=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,g={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},y.add(n,0,[["enter",g,t]])),s=k.type==="tableDelimiterRow"?2:g?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],m=ju(y,t,c,s,void 0,m),c=[0,0,0,0]),u[2]=n)):k.type==="tableCellDivider"&&(r?r=!1:(c[1]!==0&&(u[0]=u[1],m=ju(y,t,c,s,void 0,m)),c=u,u=[c[1],n,0,0])):k.type==="tableHead"?(d=!0,f=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(f=n,c[1]!==0?(u[0]=u[1],m=ju(y,t,c,s,n,m)):u[1]!==0&&(m=ju(y,t,u,s,n,m)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(u[3]=n)}for(f!==0&&zw(y,t,f,h,g),y.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=LB(t.events,n))}return e}function ju(e,t,n,r,s,c){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},Ws(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=Ws(t.events,n[1]);if(c={type:u,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const h=Ws(t.events,n[2]),g=Ws(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 y=t.events[n[2]],b=t.events[n[3]];if(y[1].end=Object.assign({},b[1].end),y[1].type="chunkText",y[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 s!==void 0&&(c.end=Object.assign({},Ws(t.events,s)),e.add(s,0,[["exit",c,t]]),c=void 0),c}function zw(e,t,n,r,s){const c=[],u=Ws(t.events,n);s&&(s.end=Object.assign({},u),c.push(["exit",s,t])),r.end=Object.assign({},u),c.push(["exit",r,t]),e.add(n+1,0,c)}function Ws(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const $B={name:"tasklistCheck",tokenize:PB};function IB(){return{text:{91:$B}}}function PB(e,t,n){const r=this;return s;function s(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),c)}function c(f){return Tt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),u):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),u):n(f)}function u(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(f)}function d(f){return Pe(f)?t(f):it(f)?e.check({tokenize:UB},t,n)(f):n(f)}}function UB(e,t,n){return dt(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function BB(e){return Uj([pB(),kB(),RB(e),zB(),IB()])}const FB={};function HB(e){const t=this,n=e||FB,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(BB(n)),c.push(lB()),u.push(cB(n))}function qB(e){oC(e,[/\r?\n|\r/g,GB])}function GB(){return{type:"break"}}function VB(){return function(e){qB(e)}}const _C=["ts","tsx","js","jsx","py","sh","bash","json","yaml","sql","sparql","md","html","css","solidity","rust","go","toml","diff","dockerfile","xml"];let vl=null;function WB(){return vl||(vl=ar(()=>import("./index-ByLJSVQ3.js"),[]).then(e=>e.createHighlighter({themes:["github-dark","github-light"],langs:[..._C]})).catch(e=>{throw vl=null,e}),vl)}function ZB(e){if(!e)return null;const t=e.toLowerCase().trim();return _C.includes(t)?t:t==="typescript"?"ts":t==="javascript"?"js":t==="python"?"py":t==="shell"||t==="zsh"?"sh":t==="yml"?"yaml":t==="markdown"?"md":t==="sol"?"solidity":t==="rs"?"rust":t==="golang"?"go":t==="patch"?"diff":t==="docker"?"dockerfile":null}function YB({code:e,lang:t}){const n=ZB(t),[r,s]=w.useState(null),[c,u]=w.useState(!1),f=qn(m=>m.theme)==="light"?"github-light":"github-dark",h=w.useRef(null);w.useEffect(()=>{if(!n){s(null);return}let m=!1;return WB().then(y=>{if(!m)try{s(y.codeToHtml(e,{lang:n,theme:f}))}catch{s(null)}}).catch(()=>{m||s(null)}),()=>{m=!0}},[e,n,f]),w.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const g=async()=>{try{await navigator.clipboard.writeText(e),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>u(!1),1200)}catch{}};return o.jsxs("div",{className:"v10-md-pre",children:[o.jsx("button",{type:"button",className:"v10-md-copy",onClick:g,"aria-label":c?"Copied":"Copy code",title:c?"Copied":"Copy code",children:c?o.jsx(l_,{size:14,"aria-hidden":"true"}):o.jsx(f_,{size:14,"aria-hidden":"true"})}),o.jsx("span",{className:"v10-md-copy-announce","aria-live":"polite",children:c?"Copied":""}),n&&o.jsx("span",{className:"v10-md-pre-lang","aria-hidden":"true",children:n}),r?o.jsx("div",{className:"v10-md-pre-rendered",dangerouslySetInnerHTML:{__html:r}}):o.jsx("pre",{className:"v10-md-pre-fallback",children:o.jsx("code",{children:e})})]})}function QB(){return e=>{let t="none",n=null;const r=new Set(["img","hr","br"]),s=(d,f)=>{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)f?t="code":(n={siblings:h,index:g},t="text");else if(m.type==="element"){const y=m.tagName;y==="pre"?(t="code",s(m,!0)):y&&r.has(y)?t="leaf":s(m,f)}}},c=e;s(c,!1);const u={type:"element",tagName:"span",properties:{className:["v10-chat-cursor"]},children:[]};if(t==="text"&&n){const{siblings:d,index:f}=n;d.splice(f+1,0,u)}else t==="leaf"&&Array.isArray(c.children)&&c.children.push(u)}}function KB(e){return e?/^https?:\/\//i.test(e)?"http":/^mailto:/i.test(e)?"mailto":"inert":"inert"}function OC({content:e,streaming:t}){return o.jsx("div",{className:"v10-md",children:o.jsx(_8,{remarkPlugins:[HB,VB],rehypePlugins:t?[QB]:[],components:{img:({src:n,alt:r,title:s})=>o.jsxs("span",{className:"v10-md-image-placeholder",title:s||(typeof n=="string"?n:void 0),children:["[image",r?`: ${r}`:"","]"]}),h1:({children:n})=>o.jsx("h1",{className:"v10-md-h1",children:n}),h2:({children:n})=>o.jsx("h2",{className:"v10-md-h2",children:n}),h3:({children:n})=>o.jsx("h3",{className:"v10-md-h3",children:n}),h4:({children:n})=>o.jsx("h4",{className:"v10-md-h4",children:n}),h5:({children:n})=>o.jsx("h5",{className:"v10-md-h5",children:n}),h6:({children:n})=>o.jsx("h6",{className:"v10-md-h6",children:n}),p:({children:n})=>o.jsx("p",{className:"v10-md-p",children:n}),ul:({children:n})=>o.jsx("ul",{className:"v10-md-ul",children:n}),ol:({children:n})=>o.jsx("ol",{className:"v10-md-ol",children:n}),li:({children:n})=>o.jsx("li",{className:"v10-md-li",children:n}),a:({href:n,children:r})=>{const s=KB(n);return s==="http"?o.jsx("a",{className:"v10-md-link",href:n,target:"_blank",rel:"noopener noreferrer",children:r}):s==="mailto"?o.jsx("a",{className:"v10-md-link",href:n,children:r}):o.jsx("span",{className:"v10-md-link v10-md-link-inert",title:n,children:r})},blockquote:({children:n})=>o.jsx("blockquote",{className:"v10-md-blockquote",children:n}),hr:()=>o.jsx("hr",{className:"v10-md-hr"}),table:({children:n})=>o.jsx("div",{className:"v10-md-table-scroll",children:o.jsx("table",{className:"v10-md-table",children:n})}),thead:({children:n,node:r,...s})=>o.jsx("thead",{className:"v10-md-thead",...s,children:n}),tbody:({children:n,node:r,...s})=>o.jsx("tbody",{className:"v10-md-tbody",...s,children:n}),tr:({children:n,node:r,...s})=>o.jsx("tr",{className:"v10-md-tr",...s,children:n}),th:({children:n,node:r,...s})=>o.jsx("th",{className:"v10-md-th",...s,children:n}),td:({children:n,node:r,...s})=>o.jsx("td",{className:"v10-md-td",...s,children:n}),pre:({children:n,node:r})=>{var c,u,d;const s=(c=r==null?void 0:r.children)==null?void 0:c[0];if((s==null?void 0:s.tagName)==="code"){const f=((d=(u=s.properties)==null?void 0:u.className)==null?void 0:d[0])??"",h=/language-([\w-]+)/.exec(f),g=(s.children??[]).map(m=>(m==null?void 0:m.value)??"").join("").replace(/\n$/,"");return o.jsx(YB,{code:g,lang:h==null?void 0:h[1]})}return o.jsx("pre",{children:n})},code:({children:n})=>o.jsx("code",{className:"v10-md-code",children:n})},children:e})})}const XB=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),JB=Qe.lazy(()=>ar(()=>import("./Operations-BC6Cv6cR.js"),__vite__mapDeps([3,1])).then(e=>({default:e.OperationsPage}))),eF=Qe.lazy(()=>ar(()=>import("./AgentHub-D3eOrb3Z.js"),[]).then(e=>({default:e.AgentHubPage}))),tF=Qe.lazy(()=>ar(()=>import("./Settings-DXSjvx2a.js"),[]).then(e=>({default:e.SettingsPage}))),nF=Qe.lazy(()=>ar(()=>import("./AgentProfilePage-jB-v9soG.js"),[]).then(e=>({default:e.AgentProfilePage})));function aF(){const{tabs:e,activeTabId:t,setActiveTab:n,closeTab:r}=vn();return o.jsx("div",{className:"v10-center-tabs",children:e.map(s=>o.jsxs("button",{className:`v10-center-tab ${s.id===t?"active":""}`,onClick:()=>n(s.id),children:[o.jsx("span",{className:"v10-center-tab-label",children:s.label}),s.closable&&o.jsx("span",{className:"v10-center-tab-close",onClick:c=>{c.stopPropagation(),r(s.id)},children:XB})]},s.id))})}const rF=["text/","application/json","application/xml","application/javascript","application/x-yaml"];function iF(e){return rF.some(t=>e.startsWith(t))}function sF({docRef:e,contentType:t}){const{tabs:n,activeTabId:r,closeTab:s}=vn(),c=vn(_=>_.setActiveTab),[u,d]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState(""),[y,b]=w.useState(!0),[k,j]=w.useState(null),[E,S]=w.useState("formatted"),T=e.startsWith("urn:dkg:file:"),N=n.find(_=>_.id===r),R=(N==null?void 0:N.label)??"Document",H=()=>{const _=n.find(I=>I.id.startsWith("project:"));_&&c(_.id),s(r)};w.useEffect(()=>{let _=!1;if(b(!0),j(null),d(null),h(null),m(""),!T){b(!1);return}const I=e.replace("urn:dkg:file:",""),B=new AbortController;return fetch(Au(I,t||void 0),{headers:Zt(),signal:B.signal}).then(async Z=>{if(!Z.ok)throw new Error(`HTTP ${Z.status}`);const $=Z.headers.get("content-type")??"application/octet-stream";if(!_)if(m($),iF($)){const D=await Z.text();_||(d(D),b(!1))}else if($.startsWith("image/")){const D=await Z.blob();_||(h(URL.createObjectURL(D)),b(!1))}else if($==="application/pdf"){const D=await Z.blob();_||(h(URL.createObjectURL(D)),b(!1))}else{const D=await Z.text();_||(d(D),b(!1))}}).catch(Z=>{_||(j(Z.message),b(!1))}),()=>{_=!0,B.abort()}},[e,T,t]),w.useEffect(()=>{S("formatted")},[e]),w.useEffect(()=>{const _=f;return()=>{_&&URL.revokeObjectURL(_)}},[f]);const A=g.startsWith("image/"),U=g==="application/pdf",G=g.startsWith("text/markdown")||t.startsWith("text/markdown"),M=!y&&!k&&T&&G&&u!==null;return o.jsxs("div",{style:{height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.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:[o.jsx("button",{onClick:H,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"}),o.jsxs("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)"},children:["📄 ",R]}),M&&o.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(_=>{const I=E===_;return o.jsx("button",{type:"button","aria-pressed":I,onClick:()=>S(_),style:{border:"none",borderRadius:4,cursor:"pointer",padding:"3px 12px",fontSize:11,fontWeight:600,fontFamily:"var(--font-sans)",color:I?"var(--text-primary)":"var(--text-secondary)",background:I?"var(--bg-elevated)":"transparent"},children:_==="formatted"?"Formatted":"Raw"},_)})})]}),o.jsx("div",{style:{flex:1,overflow:"auto",padding:"20px 24px"},children:T?o.jsxs(o.Fragment,{children:[y&&o.jsx("div",{style:{color:"var(--text-tertiary)",fontSize:12},children:"Loading document..."}),k&&o.jsxs("div",{style:{color:"var(--accent-red)",fontSize:12},children:["Failed to load: ",k]}),!y&&A&&f&&o.jsx("img",{src:f,alt:R,style:{maxWidth:"100%",borderRadius:8}}),!y&&U&&f&&o.jsx("iframe",{src:f,title:R,style:{width:"100%",height:"100%",border:"none",borderRadius:8}}),u!==null&&!A&&!U&&G&&E==="formatted"&&o.jsx("div",{style:{background:"var(--bg-surface)",borderRadius:8,padding:"16px 20px",border:"1px solid var(--border-default)",color:"var(--text-primary)"},children:o.jsx(OC,{content:u})}),u!==null&&!A&&!U&&!(G&&E==="formatted")&&o.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:u})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10,height:"100%",color:"var(--text-tertiary)",textAlign:"center"},children:[o.jsx("span",{style:{fontSize:28,opacity:.6},children:"📄"}),o.jsx("span",{style:{fontSize:13,fontWeight:600,color:"var(--text-secondary)"},children:"Source file not available for this document"}),o.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 oF(){const e=vn(t=>t.activeTabId);if(e==="dashboard")return o.jsx(vL,{});if(e==="operations")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading operations..."}),children:o.jsx(JB,{})});if(e==="agent-hub")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent hub..."}),children:o.jsx(eF,{})});if(e==="settings")return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading settings..."}),children:o.jsx(tF,{})});if(e==="memory-stack")return o.jsx(gI,{});if(e===wg)return o.jsx(tI,{});if(e.startsWith("project:")){const t=e.slice(8);return o.jsx(J6,{contextGraphId:t})}if(e.startsWith("agent:")){const t=e.slice(6),n=t.indexOf("|");if(n>0){const r=t.slice(0,n),s=t.slice(n+1),c=s.includes(":")?s:`urn:dkg:agent:${s}`;return o.jsx(w.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading agent…"}),children:o.jsx(nF,{contextGraphId:r,agentUri:c})})}}if(e.startsWith(jg)){const{docRef:t,contentType:n}=q4(e);return o.jsx(sF,{docRef:t,contentType:n})}return e.startsWith("wm:")?o.jsx(jh,{layer:"wm",contextGraphId:e.slice(3)}):e.startsWith("swm:")?o.jsx(jh,{layer:"swm",contextGraphId:e.slice(4)}):e.startsWith("vm:")?o.jsx(jh,{layer:"vm",contextGraphId:e.slice(3)}):o.jsx("div",{className:"v10-view-placeholder",children:o.jsxs("p",{style:{color:"var(--text-tertiary)",fontSize:12},children:['View "',e,'" coming soon.']})})}function lF(){return o.jsxs("div",{className:"v10-panel-center",children:[o.jsx(aF,{}),o.jsx("div",{className:"v10-center-content",children:o.jsx(oF,{})})]})}const cF=["Node Log","Transactions"],uF=o.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:o.jsx("polyline",{points:"6 9 12 15 18 9"})}),dF=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"15 3 21 3 21 9"}),o.jsx("polyline",{points:"9 21 3 21 3 15"}),o.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),o.jsx("line",{x1:"3",y1:"21",x2:"10",y2:"14"})]}),pF=o.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o.jsx("polyline",{points:"4 14 10 14 10 20"}),o.jsx("polyline",{points:"20 10 14 10 14 4"}),o.jsx("line",{x1:"10",y1:"14",x2:"3",y2:"21"}),o.jsx("line",{x1:"21",y1:"3",x2:"14",y2:"10"})]}),fF=/(\x1B\[[0-9;]*[mGKHFJA-Z]|\[[0-9;]*m)/g;function hF(e){return e.replace(fF,"")}function Mw(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 mF={error:"var(--accent-red, #ef4444)",warn:"var(--accent-yellow, #f59e0b)",info:"var(--text-primary)",debug:"var(--text-tertiary)"};function gF(e){const t=w.useRef(null),n=w.useRef(!0);return w.useEffect(()=>{const r=t.current;if(!r)return;const s=()=>{n.current=r.scrollHeight-r.scrollTop-r.clientHeight<40};return r.addEventListener("scroll",s),()=>r.removeEventListener("scroll",s)},[]),w.useEffect(()=>{n.current&&t.current&&(t.current.scrollTop=t.current.scrollHeight)},[e]),t}function vF(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,c]=w.useState("all"),u=w.useCallback(()=>{Tn.fetchNodeLog({lines:300,q:n||void 0}).then(({lines:g})=>t((g??[]).map(hF))).catch(()=>{})},[n]);w.useEffect(()=>{u();const g=setInterval(u,3e3);return()=>clearInterval(g)},[u]);const d=e.filter(g=>s==="all"||Mw(g)===s),f=d.length>0?d[d.length-1]:"",h=gF(f);return o.jsxs("div",{className:"v10-log-container",children:[o.jsxs("div",{className:"v10-log-toolbar",children:[o.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"}),o.jsxs("select",{id:"dkg-node-log-level",name:"dkg-node-log-level",className:"v10-log-level-select",value:s,onChange:g=>c(g.target.value),"aria-label":"Filter node log level",children:[o.jsx("option",{value:"all",children:"All"}),o.jsx("option",{value:"error",children:"Error"}),o.jsx("option",{value:"warn",children:"Warn"}),o.jsx("option",{value:"info",children:"Info"}),o.jsx("option",{value:"debug",children:"Debug"})]})]}),o.jsxs("div",{className:"v10-log-output",ref:h,children:[d.map((g,m)=>o.jsx("div",{className:"v10-log-line",style:{color:mF[Mw(g)]},children:g},m)),d.length===0&&o.jsx("div",{className:"v10-log-line",style:{color:"var(--text-tertiary)"},children:"No log output"})]})]})}const yF=new Set(["publish","publishFromSWM","update","ka-update","verify","reconstruct"]),bF={publish:"#22c55e",publishFromSWM:"#16a34a",update:"#14b8a6","ka-update":"#0d9488",verify:"#8b5cf6",reconstruct:"#fb923c"};function xF(){const[e,t]=w.useState([]),[n,r]=w.useState(null),s=w.useCallback(()=>{const c=String(Date.now()-216e5),u=[...yF].join(",");Tn.fetchOperationsWithPhases({limit:"100",from:c,names:u}).then(d=>{t((d==null?void 0:d.operations)??[])}).catch(()=>{})},[]);return w.useEffect(()=>{s();const c=setInterval(s,1e4);return()=>clearInterval(c)},[s]),e.length===0?o.jsx("div",{style:{padding:"20px 16px",color:"var(--text-tertiary)",fontSize:12},children:"No publish, update, or verify activity in the last 6 hours."}):o.jsx("div",{className:"v10-log-output",style:{overflowY:"auto",flex:1},children:o.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:11},children:[o.jsx("thead",{children:o.jsxs("tr",{style:{borderBottom:"1px solid var(--border-subtle)",color:"var(--text-secondary)",textAlign:"left"},children:[o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Type"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"ID"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Status"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Duration"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Time"}),o.jsx("th",{style:{padding:"6px 12px",fontWeight:600},children:"Tx Hash"})]})}),o.jsx("tbody",{children:e.map(c=>{const u=(c.phases??[]).find(h=>h.phase==="chain"),d=c.tx_hash??(u==null?void 0:u.tx_hash),f=n===c.operation_id;return o.jsxs(Qe.Fragment,{children:[o.jsxs("tr",{onClick:()=>r(h=>h===c.operation_id?null:c.operation_id),style:{borderBottom:"1px solid var(--border-subtle)",cursor:"pointer",background:f?"rgba(255,255,255,.03)":void 0},children:[o.jsx("td",{style:{padding:"7px 12px",color:bF[c.operation_name]??"var(--text-secondary)",fontWeight:600},children:c.operation_name}),o.jsx("td",{style:{padding:"7px 12px",fontFamily:"var(--font-mono)",color:"var(--text-secondary)"},children:Ax(c.operation_id)}),o.jsx("td",{style:{padding:"7px 12px"},children:o.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,fontWeight:600,background:c.status==="success"?"rgba(34,197,94,.15)":c.status==="error"?"rgba(239,68,68,.15)":"rgba(245,158,11,.15)",color:c.status==="success"?"#22c55e":c.status==="error"?"#ef4444":"#f59e0b"},children:c.status})}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:c.duration_ms!=null?Tx(c.duration_ms):"—"}),o.jsx("td",{style:{padding:"7px 12px",color:"var(--text-secondary)"},children:c.started_at?NO(c.started_at):"—"}),o.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)}…`:c.status==="success"?o.jsx("span",{style:{fontFamily:"var(--font-sans)",fontStyle:"italic",color:"var(--text-tertiary)"},children:"local"}):"—"})]}),f&&o.jsx("tr",{style:{background:"rgba(0,0,0,.2)"},children:o.jsxs("td",{colSpan:6,style:{padding:"8px 16px"},children:[o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:16,fontSize:11,color:"var(--text-secondary)"},children:[o.jsxs("span",{children:[o.jsx("b",{children:"ID:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:c.operation_id})]}),d&&o.jsxs("span",{children:[o.jsx("b",{children:"Tx:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:d})]}),c.peer_id&&o.jsxs("span",{children:[o.jsx("b",{children:"Peer:"})," ",o.jsx("span",{style:{fontFamily:"var(--font-mono)"},children:Ax(c.peer_id)})]}),c.error_message&&o.jsxs("span",{style:{color:"#ef4444"},children:[o.jsx("b",{children:"Error:"})," ",c.error_message]})]}),(c.phases??[]).length>0&&o.jsx("div",{style:{marginTop:8,display:"flex",gap:6,flexWrap:"wrap"},children:c.phases.map(h=>o.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?Tx(h.duration_ms):""]},h.phase))})]})})]},c.operation_id)})})]})})}function wF(){const{bottomCollapsed:e,toggleBottom:t,bottomMaximised:n,toggleBottomMaximised:r,bottomHeight:s,setBottomHeight:c}=qn(),[u,d]=w.useState("Node Log"),f=w.useRef(null),h=w.useRef(s);h.current=s,w.useEffect(()=>{const m=f.current;if(!m)return;let y=0;const b=E=>{const S=y-E.clientY;y=E.clientY,c(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=E=>{E.preventDefault(),y=E.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)},[c]);const g=e?void 0:n?"80vh":Math.min(s,Hu());return o.jsxs("div",{className:`v10-panel-bottom ${e?"collapsed":""} ${n?"maximised":""}`,style:e?void 0:{height:g},children:[!e&&!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:f,title:"Drag to resize"}),o.jsxs("div",{className:"v10-bottom-tabs",children:[cF.map(m=>o.jsx("button",{className:`v10-bottom-tab ${m===u?"active":""}`,onClick:()=>{d(m),e&&t()},children:m},m)),o.jsx("div",{style:{flex:1}}),o.jsx("button",{className:"v10-bottom-toggle",onClick:r,title:n?"Restore":"Maximise",style:{display:e?"none":void 0},children:n?pF:dF}),o.jsx("button",{className:"v10-bottom-toggle",onClick:t,title:e?"Expand":"Collapse",children:o.jsx("span",{style:{transform:e?"rotate(180deg)":"none",display:"flex",transition:"transform 0.15s"},children:uF})})]}),!e&&o.jsxs("div",{className:"v10-bottom-content",children:[u==="Node Log"&&o.jsx(vF,{}),u==="Transactions"&&o.jsx(xF,{})]})]})}function Dw(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 ld(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 Om(e){if(e==null||e==="")return;const t=e instanceof Date?e:new Date(e);if(!Number.isNaN(t.valueOf()))return t.toISOString()}function kF(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function SF(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 Lm(e,t){var n;return((n=e.find(r=>r.id===t))==null?void 0:n.name)??t}function jF(e){return e.startsWith("did:dkg:context-graph:")?e:`did:dkg:context-graph:${e}`}function CF(e){return String(e??"").replace(/[\u0000-\u001F\u007F]/g," ").replace(/\s+/g," ").trim()}function LC(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 zC(e){return e.status==="queued"||e.status==="completed"||e.status==="skipped"}function MC(e){return e.name.trim()}function NF(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:MC(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 EF(e){const t=[];return{results:e.flatMap(r=>{if(r.status!=="skipped"||!r.result)return[];t.push(r.id);const s=r.result,c=s.extraction;return[{id:r.id,fileName:MC(r.file),contextGraphId:r.contextGraphId,assertionName:r.assertionName,assertionUri:s.assertionUri,fileHash:s.fileHash,detectedContentType:s.detectedContentType,extractionStatus:"skipped",pipelineUsed:c.pipelineUsed??null,tripleCount:c.tripleCount??c.triplesWritten??0,...s.rootEntity?{rootEntity:s.rootEntity}:{},...c.mdIntermediateHash?{mdIntermediateHash:c.mdIntermediateHash}:{},...c.error?{error:c.error}:{}}]}),deliveredDraftIds:t}}function DC(e){return e.length===0?"":e.length===1?`Attachment import result: ${CF(e[0].fileName)}.`:`Attached ${e.length} document import results.`}function TF(e,t){const n=[LC(e),DC(t)].filter(r=>r.length>0).map(r=>r.replace(/\.$/,""));return n.length?`${n.join("; ")}.`:""}function AF(e,t,n){const r=[];if(t){const s=Lm(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:jF(t)}),r.push({key:"target_context_graph_name",label:"Target context graph name",value:s})}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 RF="https://docs.openclaw.ai/",_F="https://github.com/openclaw/openclaw/releases",Wi="__add_agent__",OF=["openclaw"];function LF(e,t){const n=t instanceof Error?t.message:String(t??"Unknown error");if(t instanceof Kh){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==="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}let zF=0;function MF(e,t,n){const r=e.trim();return r?r===t?!0:n==="Request cancelled."&&r===n:!1}function DF(e,t,n,r){return e&&MF(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 $w(e,t=""){const n=e.author.toLowerCase(),r=n.includes("assistant")||n.includes("agent")?"assistant":"user",s=typeof e.failureReason=="string"&&e.failureReason.trim()?e.failureReason.trim():void 0,c=r==="assistant"&&(e.persistStatus==="failed"||!!s),u=`Error: ${s??"The local agent turn failed."}`,d=c?DF(e.text,u,s,t):null,f=(d==null?void 0:d.content)??(e.text||LC(e.attachmentRefs??[])),h=!!e.text;return{id:e.uri||`local-history:${++zF}`,uri:e.uri,turnId:e.turnId,role:r,content:f,ts:ld(e.ts),tsRaw:Om(e.ts),attachments:e.attachmentRefs,failureNotice:d==null?void 0:d.failureNotice,synthesized:(d==null?void 0:d.synthesized)??!h}}function $F(e){return e.turnId?`turn:${e.turnId}:${e.role}`:e.uri??`${e.role}:${e.ts??""}:${e.content}`}function Iw(e,t){const n=new Set,r=[];for(const s of[...t,...e]){const c=$F(s);n.has(c)||(n.add(c),r.push(s))}return r}function Pw(e,t,n){const r=typeof n=="string"&&n.trim()?n.trim():t;return!r||r===t?e:e.map(s=>s.turnId===t?{...s,turnId:r}:s)}function Uw(e){return e.replace(/\r\n/g,`
|
|
1662
|
-
`).replace(/^(?:[ \t]*\n)+/,"").replace(/(?:\n[ \t]*)+$/,"")}function IF(e,t,n,r,s){const c=Uw(e),u=s?Uw(s):"";if(t==="assistant"&&r&&c.trim()===""&&!u)return o.jsx("span",{className:"v10-chat-thinking",role:"status","aria-live":"polite",children:"Thinking…"});if(t==="assistant"&&!n&&c.trim()!=="")return o.jsxs(o.Fragment,{children:[o.jsx(OC,{content:c,streaming:r&&!u}),u&&o.jsxs("span",{className:"v10-chat-plaintext v10-chat-failure-notice",children:[u,r&&o.jsx("span",{className:"v10-chat-cursor"})]})]});const d=[c,u].filter(Boolean).join(`
|
|
1663
|
-
|
|
1664
|
-
`);return o.jsxs("span",{className:"v10-chat-plaintext",children:[d,r&&o.jsx("span",{className:"v10-chat-cursor"})]})}function zm(){return zm=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},zm.apply(null,arguments)}function PF(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 UF=w.useLayoutEffect,BF=function(t){var n=Qe.useRef(t);return UF(function(){n.current=t}),n},Bw=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},FF=function(t,n){var r=Qe.useRef();return Qe.useCallback(function(s){t.current=s,r.current&&Bw(r.current,null),r.current=n,n&&Bw(n,s)},[n])},Fw={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},HF=function(t){Object.keys(Fw).forEach(function(n){t.style.setProperty(n,Fw[n],"important")})},Hw=HF,_n=null,qw=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function qF(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),_n||(_n=document.createElement("textarea"),_n.setAttribute("tabindex","-1"),_n.setAttribute("aria-hidden","true"),Hw(_n)),_n.parentNode===null&&document.body.appendChild(_n);var s=e.paddingSize,c=e.borderSize,u=e.sizingStyle,d=u.boxSizing;Object.keys(u).forEach(function(y){var b=y;_n.style[b]=u[b]}),Hw(_n),_n.value=t;var f=qw(_n,e);_n.value=t,f=qw(_n,e),_n.value="x";var h=_n.scrollHeight-s,g=h*n;d==="border-box"&&(g=g+s+c),f=Math.max(g,f);var m=h*r;return d==="border-box"&&(m=m+s+c),f=Math.min(m,f),[f,h]}var Gw=function(){},GF=function(t,n){return t.reduce(function(r,s){return r[s]=n[s],r},{})},VF=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],WF=!!document.documentElement.currentStyle,ZF=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=GF(VF,n),s=r.boxSizing;if(s==="")return null;WF&&s==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var c=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),u=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:c,borderSize:u}},YF=ZF;function tv(e,t,n){var r=BF(n);w.useLayoutEffect(function(){var s=function(u){return r.current(u)};if(e)return e.addEventListener(t,s),function(){return e.removeEventListener(t,s)}},[])}var QF=function(t,n){tv(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},KF=function(t){tv(window,"resize",t)},XF=function(t){tv(document.fonts,"loadingdone",t)},JF=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],eH=function(t,n){var r=t.cacheMeasurements,s=t.maxRows,c=t.minRows,u=t.onChange,d=u===void 0?Gw:u,f=t.onHeightChange,h=f===void 0?Gw:f,g=PF(t,JF),m=g.value!==void 0,y=w.useRef(null),b=FF(y,n),k=w.useRef(0),j=w.useRef(),E=function(){var N=y.current,R=r&&j.current?j.current:YF(N);if(R){j.current=R;var H=qF(R,N.value||N.placeholder||"x",c,s),A=H[0],U=H[1];k.current!==A&&(k.current=A,N.style.setProperty("height",A+"px","important"),h(A,{rowHeight:U}))}},S=function(N){m||E(),d(N)};return w.useLayoutEffect(E),QF(y,function(){if(!m){var T=y.current.value;requestAnimationFrame(function(){var N=y.current;N&&T!==N.value&&E()})}}),KF(E),XF(E),w.createElement("textarea",zm({},g,{onChange:S,ref:b}))},tH=w.forwardRef(eH),Hh={exports:{}},qh,Vw;function nH(){if(Vw)return qh;Vw=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return qh=e,qh}var Gh,Ww;function aH(){if(Ww)return Gh;Ww=1;var e=nH();function t(){}function n(){}return n.resetWarningCache=t,Gh=function(){function r(u,d,f,h,g,m){if(m!==e){var y=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 y.name="Invariant Violation",y}}r.isRequired=r;function s(){return r}var c={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},Gh}var Zw;function rH(){return Zw||(Zw=1,Hh.exports=aH()()),Hh.exports}var iH=rH();const Et=Dl(iH);function is(e,t,n,r){function s(c){return c instanceof n?c:new n(function(u){u(c)})}return new(n||(n=Promise))(function(c,u){function d(g){try{h(r.next(g))}catch(m){u(m)}}function f(g){try{h(r.throw(g))}catch(m){u(m)}}function h(g){g.done?c(g.value):s(g.value).then(d,f)}h((r=r.apply(e,t||[])).next())})}const sH=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 oo(e,t,n){const r=oH(e),{webkitRelativePath:s}=e,c=typeof t=="string"?t:typeof s=="string"&&s.length>0?s:`./${e.name}`;return typeof r.path!="string"&&Yw(r,"path",c),Yw(r,"relativePath",c),r}function oH(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),s=sH.get(r);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}function Yw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const lH=[".DS_Store","Thumbs.db"];function cH(e){return is(this,void 0,void 0,function*(){return cd(e)&&uH(e.dataTransfer)?hH(e.dataTransfer,e.type):dH(e)?pH(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?fH(e):[]})}function uH(e){return cd(e)}function dH(e){return cd(e)&&cd(e.target)}function cd(e){return typeof e=="object"&&e!==null}function pH(e){return Mm(e.target.files).map(t=>oo(t))}function fH(e){return is(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>oo(n))})}function hH(e,t){return is(this,void 0,void 0,function*(){if(e.items){const n=Mm(e.items).filter(s=>s.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(mH));return Qw($C(r))}return Qw(Mm(e.files).map(n=>oo(n)))})}function Qw(e){return e.filter(t=>lH.indexOf(t.name)===-1)}function Mm(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 mH(e){if(typeof e.webkitGetAsEntry!="function")return Kw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?IC(t):Kw(e,t)}function $C(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?$C(n):[n]],[])}function Kw(e,t){return is(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const c=yield e.getAsFileSystemHandle();if(c===null)throw new Error(`${e} is not a File`);if(c!==void 0){const u=yield c.getFile();return u.handle=c,oo(u)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return oo(r,(n=t==null?void 0:t.fullPath)!==null&&n!==void 0?n:void 0)})}function gH(e){return is(this,void 0,void 0,function*(){return e.isDirectory?IC(e):vH(e)})}function IC(e){const t=e.createReader();return new Promise((n,r)=>{const s=[];function c(){t.readEntries(u=>is(this,void 0,void 0,function*(){if(u.length){const d=Promise.all(u.map(gH));s.push(d),c()}else try{const d=yield Promise.all(s);n(d)}catch(d){r(d)}}),u=>{r(u)})}c()})}function vH(e){return is(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const s=oo(r,e.fullPath);t(s)},r=>{n(r)})})})}var Cu={},Xw;function yH(){return Xw||(Xw=1,Cu.__esModule=!0,Cu.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||"",s=(e.type||"").toLowerCase(),c=s.replace(/\/.*$/,"");return n.some(function(u){var d=u.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?c===d.replace(/\/.*$/,""):s===d})}return!0}),Cu}var bH=yH();const Vh=Dl(bH);function Jw(e){return kH(e)||wH(e)||UC(e)||xH()}function xH(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1665
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function kH(e){if(Array.isArray(e))return Dm(e)}function ek(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function tk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ek(Object(n),!0).forEach(function(r){PC(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ek(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function PC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ml(e,t){return CH(e)||jH(e,t)||UC(e,t)||SH()}function SH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1666
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UC(e,t){if(e){if(typeof e=="string")return Dm(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 Dm(e,t)}}function Dm(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 jH(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,c=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){c=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(c)throw d}}return r}}function CH(e){if(Array.isArray(e))return e}var NH=typeof Vh=="function"?Vh:Vh.default,EH="file-invalid-type",TH="file-too-large",AH="file-too-small",RH="too-many-files",_H=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:EH,message:"File type must be ".concat(r)}},nk=function(t){return{code:TH,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},ak=function(t){return{code:AH,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},OH={code:RH,message:"Too many files"};function LH(e){return e.type===""&&typeof e.getAsFile=="function"}function BC(e,t){var n=e.type==="application/x-moz-file"||NH(e,t)||LH(e);return[n,n?null:_H(t)]}function FC(e,t,n){if(Vi(e.size))if(Vi(t)&&Vi(n)){if(e.size>n)return[!1,nk(n)];if(e.size<t)return[!1,ak(t)]}else{if(Vi(t)&&e.size<t)return[!1,ak(t)];if(Vi(n)&&e.size>n)return[!1,nk(n)]}return[!0,null]}function Vi(e){return e!=null}function zH(e){var t=e.files,n=e.accept,r=e.minSize,s=e.maxSize,c=e.multiple,u=e.maxFiles,d=e.validator;return!c&&t.length>1||c&&u>=1&&t.length>u?!1:t.every(function(f){var h=BC(f,n),g=Ml(h,1),m=g[0],y=FC(f,r,s),b=Ml(y,1),k=b[0],j=d?d(f):null;return m&&k&&!j})}function ud(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function yl(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 rk(e){e.preventDefault()}function MH(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function DH(e){return e.indexOf("Edge/")!==-1}function $H(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return MH(e)||DH(e)}function Ka(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u<s;u++)c[u-1]=arguments[u];return t.some(function(d){return!ud(r)&&d&&d.apply(void 0,[r].concat(c)),ud(r)})}}function IH(){return"showOpenFilePicker"in window}function PH(e){if(Vi(e)){var t=Object.entries(e).filter(function(n){var r=Ml(n,2),s=r[0],c=r[1],u=!0;return HC(s)||(console.warn('Skipped "'.concat(s,'" 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.')),u=!1),(!Array.isArray(c)||!c.every(qC))&&(console.warn('Skipped "'.concat(s,'" because an invalid file extension was provided.')),u=!1),u}).reduce(function(n,r){var s=Ml(r,2),c=s[0],u=s[1];return tk(tk({},n),{},PC({},c,u))},{});return[{description:"Files",accept:t}]}return e}function UH(e){if(Vi(e))return Object.entries(e).reduce(function(t,n){var r=Ml(n,2),s=r[0],c=r[1];return[].concat(Jw(t),[s],Jw(c))},[]).filter(function(t){return HC(t)||qC(t)}).join(",")}function BH(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function FH(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function HC(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function qC(e){return/^.*\.[\w]+$/.test(e)}var HH=["children"],qH=["open"],GH=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],VH=["refKey","onChange","onClick"];function ik(e){return YH(e)||ZH(e)||GC(e)||WH()}function WH(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1667
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZH(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function YH(e){if(Array.isArray(e))return $m(e)}function Wh(e,t){return XH(e)||KH(e,t)||GC(e,t)||QH()}function QH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1668
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GC(e,t){if(e){if(typeof e=="string")return $m(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 $m(e,t)}}function $m(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 KH(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],s=!0,c=!1,u,d;try{for(n=n.call(e);!(s=(u=n.next()).done)&&(r.push(u.value),!(t&&r.length===t));s=!0);}catch(f){c=!0,d=f}finally{try{!s&&n.return!=null&&n.return()}finally{if(c)throw d}}return r}}function XH(e){if(Array.isArray(e))return e}function sk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Mt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sk(Object(n),!0).forEach(function(r){Im(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sk(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Im(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dd(e,t){if(e==null)return{};var n=JH(e,t),r,s;if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(s=0;s<c.length;s++)r=c[s],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function JH(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,c;for(c=0;c<r.length;c++)s=r[c],!(t.indexOf(s)>=0)&&(n[s]=e[s]);return n}var nv=w.forwardRef(function(e,t){var n=e.children,r=dd(e,HH),s=WC(r),c=s.open,u=dd(s,qH);return w.useImperativeHandle(t,function(){return{open:c}},[c]),Qe.createElement(w.Fragment,null,n(Mt(Mt({},u),{},{open:c})))});nv.displayName="Dropzone";var VC={disabled:!1,getFilesFromEvent:cH,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};nv.defaultProps=VC;nv.propTypes={children:Et.func,accept:Et.objectOf(Et.arrayOf(Et.string)),multiple:Et.bool,preventDropOnDocument:Et.bool,noClick:Et.bool,noKeyboard:Et.bool,noDrag:Et.bool,noDragEventsBubbling:Et.bool,minSize:Et.number,maxSize:Et.number,maxFiles:Et.number,disabled:Et.bool,getFilesFromEvent:Et.func,onFileDialogCancel:Et.func,onFileDialogOpen:Et.func,useFsAccessApi:Et.bool,autoFocus:Et.bool,onDragEnter:Et.func,onDragLeave:Et.func,onDragOver:Et.func,onDrop:Et.func,onDropAccepted:Et.func,onDropRejected:Et.func,onError:Et.func,validator:Et.func};var Pm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function WC(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Mt(Mt({},VC),e),n=t.accept,r=t.disabled,s=t.getFilesFromEvent,c=t.maxSize,u=t.minSize,d=t.multiple,f=t.maxFiles,h=t.onDragEnter,g=t.onDragLeave,m=t.onDragOver,y=t.onDrop,b=t.onDropAccepted,k=t.onDropRejected,j=t.onFileDialogCancel,E=t.onFileDialogOpen,S=t.useFsAccessApi,T=t.autoFocus,N=t.preventDropOnDocument,R=t.noClick,H=t.noKeyboard,A=t.noDrag,U=t.noDragEventsBubbling,G=t.onError,M=t.validator,_=w.useMemo(function(){return UH(n)},[n]),I=w.useMemo(function(){return PH(n)},[n]),B=w.useMemo(function(){return typeof E=="function"?E:ok},[E]),Z=w.useMemo(function(){return typeof j=="function"?j:ok},[j]),$=w.useRef(null),D=w.useRef(null),F=w.useReducer(e7,Pm),V=Wh(F,2),X=V[0],Q=V[1],L=X.isFocused,P=X.isFileDialogActive,q=w.useRef(typeof window<"u"&&window.isSecureContext&&S&&IH()),O=function(){!q.current&&P&&setTimeout(function(){if(D.current){var K=D.current.files;K.length||(Q({type:"closeDialog"}),Z())}},300)};w.useEffect(function(){return window.addEventListener("focus",O,!1),function(){window.removeEventListener("focus",O,!1)}},[D,P,Z,q]);var ne=w.useRef([]),ue=w.useRef([]),le=function(K){$.current&&$.current.contains(K.target)||(K.preventDefault(),ne.current=[])};w.useEffect(function(){return N&&(document.addEventListener("dragover",rk,!1),document.addEventListener("drop",le,!1)),function(){N&&(document.removeEventListener("dragover",rk),document.removeEventListener("drop",le))}},[$,N]),w.useEffect(function(){var ye=function(he){ue.current=[].concat(ik(ue.current),[he.target]),yl(he)&&Q({isDragGlobal:!0,type:"setDragGlobal"})},K=function(he){ue.current=ue.current.filter(function(Le){return Le!==he.target&&Le!==null}),!(ue.current.length>0)&&Q({isDragGlobal:!1,type:"setDragGlobal"})},W=function(){ue.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})},ee=function(){ue.current=[],Q({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",ye,!1),document.addEventListener("dragleave",K,!1),document.addEventListener("dragend",W,!1),document.addEventListener("drop",ee,!1),function(){document.removeEventListener("dragenter",ye),document.removeEventListener("dragleave",K),document.removeEventListener("dragend",W),document.removeEventListener("drop",ee)}},[$]),w.useEffect(function(){return!r&&T&&$.current&&$.current.focus(),function(){}},[$,T,r]);var be=w.useCallback(function(ye){G?G(ye):console.error(ye)},[G]),Re=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[].concat(ik(ne.current),[ye.target]),yl(ye)&&Promise.resolve(s(ye)).then(function(K){if(!(ud(ye)&&!U)){var W=K.length,ee=W>0&&zH({files:K,accept:_,minSize:u,maxSize:c,multiple:d,maxFiles:f,validator:M}),ce=W>0&&!ee;Q({isDragAccept:ee,isDragReject:ce,isDragActive:!0,type:"setDraggedFiles"}),h&&h(ye)}}).catch(function(K){return be(K)})},[s,h,be,U,_,u,c,d,f,M]),Ee=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var K=yl(ye);if(K&&ye.dataTransfer)try{ye.dataTransfer.dropEffect="copy"}catch{}return K&&m&&m(ye),!1},[m,U]),Ie=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye);var K=ne.current.filter(function(ee){return $.current&&$.current.contains(ee)}),W=K.indexOf(ye.target);W!==-1&&K.splice(W,1),ne.current=K,!(K.length>0)&&(Q({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),yl(ye)&&g&&g(ye))},[$,g,U]),Ve=w.useCallback(function(ye,K){var W=[],ee=[];ye.forEach(function(ce){var he=BC(ce,_),Le=Wh(he,2),He=Le[0],Ce=Le[1],Fe=FC(ce,u,c),et=Wh(Fe,2),Ne=et[0],Gt=et[1],At=M?M(ce):null;if(He&&Ne&&!At)W.push(ce);else{var Ua=[Ce,Gt];At&&(Ua=Ua.concat(At)),ee.push({file:ce,errors:Ua.filter(function(la){return la})})}}),(!d&&W.length>1||d&&f>=1&&W.length>f)&&(W.forEach(function(ce){ee.push({file:ce,errors:[OH]})}),W.splice(0)),Q({acceptedFiles:W,fileRejections:ee,type:"setFiles"}),y&&y(W,ee,K),ee.length>0&&k&&k(ee,K),W.length>0&&b&&b(W,K)},[Q,d,_,u,c,f,y,b,k,M]),Se=w.useCallback(function(ye){ye.preventDefault(),ye.persist(),Dt(ye),ne.current=[],yl(ye)&&Promise.resolve(s(ye)).then(function(K){ud(ye)&&!U||Ve(K,ye)}).catch(function(K){return be(K)}),Q({type:"reset"})},[s,Ve,be,U]),ft=w.useCallback(function(){if(q.current){Q({type:"openDialog"}),B();var ye={multiple:d,types:I};window.showOpenFilePicker(ye).then(function(K){return s(K)}).then(function(K){Ve(K,null),Q({type:"closeDialog"})}).catch(function(K){BH(K)?(Z(K),Q({type:"closeDialog"})):FH(K)?(q.current=!1,D.current?(D.current.value=null,D.current.click()):be(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."))):be(K)});return}D.current&&(Q({type:"openDialog"}),B(),D.current.value=null,D.current.click())},[Q,B,Z,S,Ve,be,I,d]),Me=w.useCallback(function(ye){!$.current||!$.current.isEqualNode(ye.target)||(ye.key===" "||ye.key==="Enter"||ye.keyCode===32||ye.keyCode===13)&&(ye.preventDefault(),ft())},[$,ft]),qe=w.useCallback(function(){Q({type:"focus"})},[]),ke=w.useCallback(function(){Q({type:"blur"})},[]),lt=w.useCallback(function(){R||($H()?setTimeout(ft,0):ft())},[R,ft]),xe=function(K){return r?null:K},Oe=function(K){return H?null:xe(K)},_t=function(K){return A?null:xe(K)},Dt=function(K){U&&K.stopPropagation()},Yt=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},K=ye.refKey,W=K===void 0?"ref":K,ee=ye.role,ce=ye.onKeyDown,he=ye.onFocus,Le=ye.onBlur,He=ye.onClick,Ce=ye.onDragEnter,Fe=ye.onDragOver,et=ye.onDragLeave,Ne=ye.onDrop,Gt=dd(ye,GH);return Mt(Mt(Im({onKeyDown:Oe(Ka(ce,Me)),onFocus:Oe(Ka(he,qe)),onBlur:Oe(Ka(Le,ke)),onClick:xe(Ka(He,lt)),onDragEnter:_t(Ka(Ce,Re)),onDragOver:_t(Ka(Fe,Ee)),onDragLeave:_t(Ka(et,Ie)),onDrop:_t(Ka(Ne,Se)),role:typeof ee=="string"&&ee!==""?ee:"presentation"},W,$),!r&&!H?{tabIndex:0}:{}),Gt)}},[$,Me,qe,ke,lt,Re,Ee,Ie,Se,H,A,r]),Ft=w.useCallback(function(ye){ye.stopPropagation()},[]),ut=w.useMemo(function(){return function(){var ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},K=ye.refKey,W=K===void 0?"ref":K,ee=ye.onChange,ce=ye.onClick,he=dd(ye,VH),Le=Im({accept:_,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:xe(Ka(ee,Se)),onClick:xe(Ka(ce,Ft)),tabIndex:-1},W,D);return Mt(Mt({},Le),he)}},[D,n,d,Se,r]);return Mt(Mt({},X),{},{isFocused:L&&!r,getRootProps:Yt,getInputProps:ut,rootRef:$,inputRef:D,open:xe(ft)})}function e7(e,t){switch(t.type){case"focus":return Mt(Mt({},e),{},{isFocused:!0});case"blur":return Mt(Mt({},e),{},{isFocused:!1});case"openDialog":return Mt(Mt({},Pm),{},{isFileDialogActive:!0});case"closeDialog":return Mt(Mt({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Mt(Mt({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Mt(Mt({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return Mt(Mt({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return Mt({},Pm);default:return e}}function ok(){}function t7({value:e,onChange:t,options:n,placeholder:r="Select…",disabled:s=!1,className:c,ariaLabel:u,prefixIcon:d}){const[f,h]=w.useState(!1),[g,m]=w.useState(null),[y,b]=w.useState(()=>{const M=n.findIndex(_=>_.value===e);return M>=0?M:0}),k=w.useRef(null),j=w.useRef(null),E=w.useRef(null),S=n.find(M=>M.value===e),T=(S==null?void 0:S.label)??r,N=w.useCallback(()=>{var M;h(!1),(M=j.current)==null||M.focus()},[]),R=w.useCallback(()=>{const M=j.current;if(!M)return;const _=M.getBoundingClientRect(),I=Math.min(240,n.length*36+16),B=window.innerHeight-_.bottom,Z=_.top,$=B<I+16&&Z>B?"above":"below";m({left:_.left,top:$==="below"?_.bottom+4:_.top-4,width:_.width,placement:$})},[n.length]);w.useLayoutEffect(()=>{f&&R()},[f,R]),w.useEffect(()=>{if(!f)return;const M=()=>R(),_=()=>R(),I=Z=>{var D,F;const $=Z.target;(D=k.current)!=null&&D.contains($)||(F=E.current)!=null&&F.contains($)||h(!1)},B=Z=>{Z.key==="Escape"&&(Z.preventDefault(),N())};return window.addEventListener("scroll",M,!0),window.addEventListener("resize",_),document.addEventListener("mousedown",I),document.addEventListener("keydown",B),()=>{window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",_),document.removeEventListener("mousedown",I),document.removeEventListener("keydown",B)}},[f,N,R]),w.useEffect(()=>{if(f){const M=n.findIndex(_=>_.value===e);b(M>=0?M:0),requestAnimationFrame(()=>{var _;return(_=E.current)==null?void 0:_.focus()})}},[f,e,n]),w.useEffect(()=>{s&&f&&h(!1)},[s,f]);const H=M=>{s||(M.key==="ArrowDown"||M.key==="Enter"||M.key===" ")&&(M.preventDefault(),h(!0))},A=M=>{var _;if(M.key==="ArrowDown")M.preventDefault(),b(I=>{var B;for(let Z=1;Z<=n.length;Z++){const $=(I+Z)%n.length;if(!((B=n[$])!=null&&B.disabled))return $}return I});else if(M.key==="ArrowUp")M.preventDefault(),b(I=>{var B;for(let Z=1;Z<=n.length;Z++){const $=(I-Z+n.length)%n.length;if(!((B=n[$])!=null&&B.disabled))return $}return I});else if(M.key==="Enter"){M.preventDefault();const I=n[y];I&&!I.disabled&&(t(I.value),N())}else if(M.key==="Home"){M.preventDefault();const I=n.findIndex(B=>!B.disabled);I>=0&&b(I)}else if(M.key==="End"){M.preventDefault();let I=-1;for(let B=n.length-1;B>=0;B--)if(!((_=n[B])!=null&&_.disabled)){I=B;break}I>=0&&b(I)}},U=["v10-select",c,s?"disabled":"",f?"open":""].filter(Boolean).join(" "),G=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 o.jsxs("div",{ref:k,className:U,children:[o.jsxs("button",{ref:j,type:"button",className:"v10-select-trigger",onClick:()=>!s&&h(M=>!M),onKeyDown:H,disabled:s,"aria-haspopup":"listbox","aria-expanded":f,"aria-label":u,children:[d&&o.jsx("span",{className:"v10-select-prefix","aria-hidden":"true",children:d}),o.jsx("span",{className:`v10-select-value ${S?"":"placeholder"}`,children:T}),o.jsx(u_,{className:"v10-select-caret",size:12,"aria-hidden":"true"})]}),f&&g&&YA.createPortal(o.jsxs("ul",{ref:E,className:`v10-select-menu v10-select-menu-${g.placement}`,role:"listbox",tabIndex:-1,onKeyDown:A,style:G,children:[n.length===0&&o.jsx("li",{className:"v10-select-option empty","aria-disabled":"true",children:"No options"}),n.map((M,_)=>o.jsx("li",{role:"option","aria-selected":M.value===e,title:M.label,className:["v10-select-option",M.value===e?"selected":"",_===y?"highlighted":"",M.disabled?"disabled":""].filter(Boolean).join(" "),onMouseEnter:()=>b(_),onMouseDown:I=>I.preventDefault(),onClick:()=>{s||M.disabled||(t(M.value),N())},children:M.label},M.value))]}),document.body)]})}function lk(e){return e.bridgeOnline?"connected":e.status==="connecting"?"known":e.status==="degraded"?"degraded":"offline"}function n7(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 a7(e){const[t,n]=w.useState(!1),[r,s]=w.useState(!1),c=w.useRef(null),u=w.useRef(null),d=w.useRef(null);w.useLayoutEffect(()=>{if(!t)return;const m=d.current,y=u.current;if(!m||!y)return;const k=(y.closest(".v10-panel-right")||document.body).getBoundingClientRect();y.getBoundingClientRect().left+m.offsetWidth>k.right-4?s(!0):s(!1)},[t]);const f=w.useCallback(()=>{var m;n(!1),(m=u.current)==null||m.focus()},[]);w.useEffect(()=>{if(!t)return;const m=b=>{var k;(k=c.current)!=null&&k.contains(b.target)||n(!1)},y=b=>{b.key==="Escape"&&(b.preventDefault(),f())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",y)}},[t,f]),w.useEffect(()=>{var y;if(!t)return;const m=(y=d.current)==null?void 0:y.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 E,S;if(m.key==="Tab"){n(!1);return}if(m.key!=="ArrowDown"&&m.key!=="ArrowUp")return;m.preventDefault();const y=Array.from(((E=d.current)==null?void 0:E.querySelectorAll(".v10-agent-tab-menu-item:not(:disabled)"))??[]);if(y.length===0)return;const b=y.findIndex(T=>T===document.activeElement),k=m.key==="ArrowDown"?1:-1,j=b===-1?k===1?0:y.length-1:(b+k+y.length)%y.length;(S=y[j])==null||S.focus()};return o.jsxs("div",{className:"v10-agent-tab-menu",ref:c,children:[o.jsx("button",{ref:u,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(y=>!y)},onKeyDown:h,children:o.jsx(m_,{"aria-hidden":"true",size:14})}),t&&o.jsxs("div",{ref:d,className:`v10-agent-tab-menu-popover${r?" align-right":""}`,role:"menu",onKeyDown:g,children:[o.jsxs("div",{className:"v10-agent-tab-menu-status","aria-hidden":"true",children:[o.jsx("span",{className:`v10-agents-stat-dot ${e.statusDotClass}`}),o.jsx("span",{children:e.statusLabel})]}),o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item",disabled:e.refreshBusy,onClick:()=>{f(),e.onRefresh()},children:e.refreshBusy?"Refreshing…":"Refresh"}),e.canDisconnect&&o.jsx("button",{type:"button",role:"menuitem",className:"v10-agent-tab-menu-item danger",onClick:()=>{f(),e.onDisconnect()},children:"Disconnect"})]})]})}function ZC(e,t){return(t==null?void 0:t.trim())||`integration:${e}`}function pd(e){const t=e.sessionId??e.defaultSessionId??Zs(e.integrationId);return{integrationId:e.integrationId,sessionId:t,stateKey:ZC(e.integrationId,t)}}function YC(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 QC(e){var n;if(e.selectedSessionId==null)return!1;const t=e.integrations.find(r=>r.id===e.integrationId);return!(((n=YC(e.selectedSessionId,e.integrations))==null?void 0:n.id)!==e.integrationId||t!=null&&t.defaultSessionId&&e.selectedSessionId!==t.defaultSessionId&&i7(e.integrationId,e.selectedSessionId))}function r7(e){return QC(e)}function i7(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 ck(e,t){const n=e.flatMap(r=>{var d;const s=YC(r.session,t);if(!s)return[];const c=r.messages.find(f=>f.author==="user"),u=r.messages[r.messages.length-1];return[{sessionId:r.session,integrationId:s.id,integrationName:s.name,preview:((d=c==null?void 0:c.text)==null?void 0:d.slice(0,60))||r.session,messageCount:r.messages.length,lastTs:u==null?void 0:u.ts}]});return n.sort((r,s)=>{const c=Date.parse(r.lastTs??""),u=Date.parse(s.lastTs??"");return Number.isFinite(c)&&Number.isFinite(u)?u-c:String(s.lastTs??"").localeCompare(String(r.lastTs??""))}),n}function KC(e,t,n,r,s){var u;const c=pd({integrationId:e,sessionId:t,defaultSessionId:s});return(((u=n[c.stateKey])==null?void 0:u.length)??0)>0||(c.sessionId?r.some(d=>d.sessionId===c.sessionId):!1)}function XC(e,t,n){const r=ZC(e,null);return Object.entries(t).some(([s,c])=>c.length>0&&(s===r||s.startsWith(`${e}:`)))||n.some(s=>s.integrationId===e)}function s7(e){const t=[...e.integrations].sort(Dd),n=t.filter(d=>d.persistentChat),r=t.find(d=>d.id===e.selectedIntegrationId)??n[0]??null,s=r?pd({integrationId:r.id,sessionId:e.selectedSessionId,defaultSessionId:r.defaultSessionId}):null,c=r?KC(r.id,e.selectedSessionId,e.localMessagesByConversation,e.sessions,r.defaultSessionId):!1,u=r?XC(r.id,e.localMessagesByConversation,e.sessions):!1;return{sortedIntegrations:t,connectedIntegrations:n,selectedIntegration:r,selectedConversation:s,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u}}function o7(e){const t=e.selectedIntegration,n=!!(t&&!t.persistentChat&&e.selectedHasConversation),r=!!(t&&!t.persistentChat&&e.selectedIntegrationHasAnyConversation),s=r?[t,...e.connectedAgents.filter(d=>d.id!==t.id)]:e.connectedAgents,c=e.selectedIntegrationId===Wi||!t&&e.connectedAgents.length===0||!!(t&&!t.persistentChat&&!e.selectedIntegrationHasAnyConversation),u=!e.localHistoryLoaded&&e.localMessagesCount===0&&!!(t!=null&&t.persistentChat||e.selectedHasConversation);return{showingSessionHistory:n,showingStoredSessions:r,visibleAgentTabs:s,showAddFlow:c,shouldShowConversationLoader:u}}function Dd(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 Pu(e,t){return[...e.filter(n=>n.id!==t.id),t].sort(Dd)}function l7(e,t){const n=e.find(u=>u.id===t);if(!n)return e;const r=n.connectSupported,s=r?"available":"coming_soon",c=r?"Ready to connect":"Coming next";return Pu(e,{...n,configured:!1,detected:!1,persistentChat:!1,chatReady:!1,bridgeOnline:!1,bridgeStatusLabel:c,status:s,statusLabel:c,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 c7(e){const t=e.selectedItem;return e.selectedIntegrationId===Wi||t!=null&&(t.persistentChat||KC(e.selectedIntegrationId,e.selectedSessionId,e.localMessagesByConversation,e.sessionSummaries,t.defaultSessionId)||XC(e.selectedIntegrationId,e.localMessagesByConversation,e.sessionSummaries))}function u7(e){var K;const{integrations:t,selectedIntegrationId:n,selectedIntegration:r,selectedSessionId:s,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u,onSelectIntegration:d,onConnectIntegration:f,onDisconnectIntegration:h,onRefreshIntegration:g,connectBusyId:m,refreshBusyId:y,connectNotice:b,connectError:k,localMessages:j,localHistoryLoaded:E,localChatEndRef:S,localInput:T,onLocalInputChange:N,onSendLocalMessage:R,onStopLocalStream:H,localSending:A,activeProjectId:U,availableProjects:G,projectsLoading:M,onSelectProject:_,attachments:I,onAddAttachments:B,onRemoveAttachment:Z}=e,$=e.selectableProjects??G,D=I,F=D.some(zC),V=[...new Set(D.map(W=>W.contextGraphId))],X=D.some(W=>W.status==="uploading"),L=j.some(W=>W.streaming)?"streaming":X?"uploading":"idle",P=D.length>0&&D.some(W=>W.contextGraphId!==U),q=w.useRef(null),O=w.useRef(null),[ne,ue]=w.useState(null),le=w.useCallback(W=>{O.current=W,ue(W)},[]),[be,Re]=w.useState(!1),Ee=w.useCallback(()=>{const W=O.current;if(!W)return;const ee=W.scrollHeight-W.scrollTop-W.clientHeight;Re(ee>40)},[]),Ie=w.useCallback(()=>{const W=O.current;W&&W.scrollTo({top:W.scrollHeight,behavior:"smooth"})},[]);w.useEffect(()=>{const W=O.current;if(!W)return;const ee=requestAnimationFrame(()=>{const ce=W.scrollHeight-W.scrollTop-W.clientHeight;Re(ce>40)});return()=>cancelAnimationFrame(ee)},[n,s,j.length]),w.useEffect(()=>{if(!ne||typeof MutationObserver>"u")return;const W=()=>{const ce=ne.scrollHeight-ne.scrollTop-ne.clientHeight;Re(ce>40)};W();const ee=new MutationObserver(W);return ee.observe(ne,{childList:!0,subtree:!0,characterData:!0}),()=>ee.disconnect()},[ne]);const Ve=(K=e.selectedIntegration)!=null&&K.chatAttachments?e.activeProjectId?e.localSending?"sending":null:"noProject":"unsupported",Se=Ve===null,ft=w.useCallback(W=>{Se&&B(W)},[Se,B]),Me=WC({onDrop:ft,noClick:!0,noKeyboard:!0}),qe=[...t].sort(Dd),ke=qe.filter(W=>W.persistentChat),lt=qe.filter(W=>!W.persistentChat),xe=r,{showingSessionHistory:Oe,showingStoredSessions:_t,visibleAgentTabs:Dt,showAddFlow:Yt,shouldShowConversationLoader:Ft}=o7({connectedAgents:ke,selectedIntegration:r,selectedIntegrationId:n,selectedHasConversation:c,selectedIntegrationHasAnyConversation:u,localHistoryLoaded:E,localMessagesCount:j.length}),ut=A||!(xe!=null&&xe.chatReady),ye=!ut&&!X&&(T.trim()!==""||F);return o.jsxs("div",{className:"v10-agents-tab",children:[o.jsxs("div",{className:"v10-agent-subtabs",role:"tablist","aria-label":"Integrated agents",children:[Dt.map(W=>{const ee=(xe==null?void 0:xe.id)===W.id&&!Yt;return o.jsxs("div",{className:`v10-agent-subtab-group ${ee?"active":""}`,children:[o.jsxs("button",{className:`v10-agent-subtab ${ee?"active":""}`,onClick:()=>d(W.id,{preserveSession:QC({integrationId:W.id,selectedSessionId:s,integrations:t}),sessionId:W.defaultSessionId}),role:"tab","aria-selected":ee,children:[o.jsx("span",{className:`v10-agents-stat-dot ${lk(W)}`}),o.jsx("span",{children:W.name})]}),ee&&o.jsx(a7,{integration:W,statusLabel:n7(W,Oe),statusDotClass:lk(W),refreshBusy:y===W.id,canDisconnect:W.persistentChat,onRefresh:()=>g(W.id),onDisconnect:()=>h(W.id)})]},W.id)}),o.jsx("button",{className:`v10-agent-subtab add ${Yt?"active":""}`,onClick:()=>d(Wi),role:"tab","aria-selected":Yt,"aria-label":"Add another integrated agent",title:"Add another integrated agent",children:"+"})]}),Yt?o.jsxs("div",{className:"v10-agent-add-surface",children:[o.jsx("div",{className:"v10-agents-section-label",children:"Connect Another Agent"}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),o.jsxs("div",{className:"v10-local-agent-list","aria-label":"Available agent integrations",children:[lt.length===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No additional local agent integrations are available yet."}),lt.map(W=>o.jsxs("div",{className:"v10-local-agent-detail v10-local-agent-choice",children:[o.jsxs("div",{className:"v10-local-agent-detail-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"v10-local-agent-title",children:W.name}),o.jsx("div",{className:"v10-local-agent-subtitle",children:W.description})]}),o.jsx("span",{className:`v10-local-agent-status-pill ${W.status}`,children:W.statusLabel})]}),o.jsx("p",{className:"v10-local-agent-copy",children:W.detail}),W.error&&o.jsx("div",{className:"v10-local-agent-warning offline",role:"status","data-testid":`local-agent-warning-${W.id}`,children:W.error}),W.id==="openclaw"&&o.jsxs(o.Fragment,{children:[o.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."}),o.jsxs("div",{className:"v10-local-agent-actions",children:[o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(W.id),disabled:m===W.id,children:m===W.id?"Connecting...":"Connect OpenClaw"}),o.jsx("a",{className:"v10-agent-link-btn",href:RF,target:"_blank",rel:"noreferrer",children:"Docs"}),o.jsx("a",{className:"v10-agent-link-btn",href:_F,target:"_blank",rel:"noreferrer",children:"Release Notes"})]})]}),W.id==="hermes"&&o.jsxs(o.Fragment,{children:[o.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."}),W.connectSupported&&o.jsx("div",{className:"v10-local-agent-actions",children:o.jsx("button",{className:"v10-agent-send-btn secondary",onClick:()=>f(W.id),disabled:m===W.id,children:m===W.id?"Connecting...":"Connect Hermes"})})]})]},W.id))]})]}):xe&&o.jsxs("div",{...Me.getRootProps({className:"v10-local-agent-chat-shell"}),children:[o.jsx("input",{...Me.getInputProps()}),b&&o.jsx("div",{className:"v10-local-agent-notice",children:b}),k&&o.jsx("div",{className:"v10-local-agent-error",children:k}),!xe.chatReady&&o.jsx("div",{className:`v10-local-agent-warning ${xe.status==="connecting"?"connecting":"offline"}`,children:Oe?`${xe.name} is not currently attached to this node. Session history remains available here; reconnect from the + tab when you want live chat again.`:xe.status==="connecting"?`${xe.name} is still finishing setup. This chat tab stays in place and will go live automatically when the connection is ready.`:xe.status==="degraded"?xe.detail:_t?`${xe.name} has saved sessions on this node. Open one from Sessions or reconnect from the + tab to resume live chat here.`:`${xe.name} is temporarily unavailable. Refresh after it recovers to resume chatting here.`}),Me.isDragActive&&o.jsx("div",{className:`v10-drop-overlay active ${Se?"accept":"refuse"}`,role:"status","aria-live":"polite",children:o.jsxs("div",{className:"v10-drop-overlay-card",children:[Se?o.jsx(O_,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}):o.jsx(s_,{className:"v10-drop-overlay-icon",size:32,"aria-hidden":"true"}),o.jsx("div",{className:"v10-drop-overlay-title",children:Se?`Drop files to attach to ${Lm(G,U)}`:Ve==="sending"?"Wait for the current send to finish.":Ve==="unsupported"?`${xe.name} doesn't accept file attachments.`:"Choose a context graph before attaching files."}),o.jsx("div",{className:"v10-drop-overlay-hint",children:Se?"Release to upload to this conversation.":Ve==="sending"?"Drop will be accepted once the agent reply lands.":Ve==="unsupported"?"Try a different agent that supports attachments.":"Use the picker below the composer."})]})}),o.jsxs("div",{className:"v10-chat-messages v10-local-agent-messages",ref:le,onScroll:Ee,children:[Ft&&o.jsx("div",{className:"v10-agent-empty-state",children:"Loading the latest conversation from DKG memory..."}),!Ft&&j.length===0&&(()=>{const W=Oe?{title:"No turns in this session yet.",hint:`Reconnect ${xe.name} from the + tab to start a new live thread.`}:_t?{title:`${xe.name} has saved sessions.`,hint:"Open one from Sessions, or reconnect from + to start fresh."}:xe.chatReady?{title:`Start a conversation with ${xe.name}.`,hint:'Try: "What can you help me with?"'}:{title:`${xe.name} is offline.`,hint:"Conversation history stays here while the bridge reconnects."};return o.jsxs("div",{className:"v10-agent-empty-state",children:[o.jsx("div",{className:"v10-agent-empty-state-title",children:W.title}),o.jsx("div",{className:"v10-agent-empty-state-hint",children:W.hint})]})})(),j.map(W=>o.jsxs("div",{className:`v10-chat-msg ${W.role}`,children:[o.jsx("div",{className:`v10-chat-bubble ${W.role}`,children:IF(W.content,W.role,!!W.synthesized,!!W.streaming,W.failureNotice)}),W.attachments&&W.attachments.length>0&&o.jsx("div",{className:"v10-local-agent-attachment-row",style:{display:"flex",flexWrap:"wrap",gap:6,marginTop:6},children:W.attachments.map(ee=>o.jsx("span",{className:"v10-local-agent-attachment-chip",style:{padding:"2px 8px",borderRadius:999,background:"var(--bg-elevated)",fontSize:11},children:ee.fileName},ee.id??ee.assertionUri??ee.fileHash))}),W.ts&&o.jsx("time",{className:`v10-local-agent-msg-time ${W.role}`,dateTime:W.tsRaw,children:W.ts})]},W.id)),o.jsx("div",{ref:S}),o.jsx("button",{type:"button",className:`v10-scroll-to-bottom ${be?"visible":""}`,onClick:Ie,"aria-label":"Scroll to latest message",title:"Scroll to latest message",tabIndex:be?0:-1,"aria-hidden":!be,children:o.jsx(n_,{size:14,"aria-hidden":"true"})})]}),o.jsx("div",{className:"v10-agent-input-area",children:o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,width:"100%"},children:[D.length>0&&o.jsx("div",{className:"v10-attachment-chips",role:"list","aria-label":"Attached files",children:D.map(W=>{var he,Le;const ee=((he=W.result)==null?void 0:he.extraction.tripleCount)??((Le=W.result)==null?void 0:Le.extraction.triplesWritten),ce=W.status==="queued"?"Queued":W.status==="uploading"?"Importing…":W.status==="completed"?ee!=null?`Ready · ${ee} triples`:"Ready":W.status==="skipped"?"Stored only":W.error??"Failed";return o.jsxs("div",{className:"v10-attachment-chip","data-status":W.status,role:"listitem",children:[o.jsx("div",{className:"v10-attachment-chip-badge","aria-hidden":"true",children:SF(W.file.name)}),o.jsxs("div",{className:"v10-attachment-chip-body",children:[o.jsx("div",{className:"v10-attachment-chip-name",title:W.file.name,children:W.file.name}),o.jsxs("div",{className:"v10-attachment-chip-meta",children:[o.jsx("span",{children:kF(W.file.size)}),o.jsx("span",{"aria-hidden":"true",children:"·"}),o.jsx("span",{className:"v10-attachment-chip-status",children:ce})]})]}),o.jsx("button",{type:"button",className:"v10-attachment-chip-remove",onClick:()=>Z(W.id),disabled:A,"aria-label":`Remove ${W.file.name}`,title:"Remove attachment",children:o.jsx(I_,{size:12,"aria-hidden":"true"})})]},W.id)})}),P&&o.jsx("div",{className:"v10-local-agent-copy",style:{margin:0,color:"var(--text-tertiary)"},children:V.length>1?"Queued files keep their stored targets and may span multiple projects.":`Queued files keep their stored target (${Lm(G,V[0])}), not the active project.`}),o.jsx("input",{ref:q,type:"file",multiple:!0,style:{display:"none"},onChange:W=>{W.target.files&&(B(W.target.files),W.target.value="")}}),o.jsx("div",{className:"v10-local-agent-composer-row",children:o.jsxs("div",{className:"v10-local-agent-composer-shell",children:[o.jsx(tH,{placeholder:Oe?`Reconnect ${xe.name} to resume live chat...`:xe.chatReady?`Message ${xe.name}...`:xe.status==="connecting"?`${xe.name} is still connecting...`:`${xe.name} bridge offline...`,className:"v10-agent-input",value:T,onChange:W=>N(W.target.value),onKeyDown:W=>{if(!W.nativeEvent.isComposing){if(W.key==="Enter"&&!W.shiftKey&&!W.ctrlKey&&!W.metaKey){W.preventDefault(),ye&&R();return}if((W.ctrlKey||W.metaKey)&&W.key==="Enter"){W.preventDefault(),ye&&R();return}W.key==="Escape"&&T.length>0&&(W.preventDefault(),N(""))}},disabled:ut,minRows:1,maxRows:8}),o.jsxs("div",{className:"v10-composer-controls",children:[o.jsxs("div",{className:"v10-composer-controls-left",children:[o.jsx("button",{type:"button",className:"v10-composer-attach",onClick:()=>{var W;return(W=q.current)==null?void 0:W.click()},disabled:!Se,title:Se?"Attach files":Ve==="noProject"?"Choose a context graph to attach files":Ve==="sending"?"Wait for the current message to send":"This agent does not support attachments","aria-label":"Attach files",children:o.jsx(C_,{size:14,"aria-hidden":"true"})}),o.jsx("div",{className:"v10-composer-target",children:o.jsx(t7,{className:"v10-local-agent-target-select",value:U??"",onChange:_,options:[...U?[{value:"",label:"No context graph (clear selection)"}]:[],...$.map(W=>({value:W.id,label:W.name}))],placeholder:M?"Loading context graphs…":"Choose a context graph",disabled:M||!U&&$.length===0,ariaLabel:"Active project",prefixIcon:o.jsx(v_,{size:12,"aria-hidden":"true"})})})]}),o.jsx("button",{type:"button",className:`v10-local-agent-inline-send v10-local-agent-inline-send-${L}`,onClick:L==="streaming"?H:R,disabled:L==="streaming"?!1:L==="uploading"?!0:!ye,"aria-label":L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)":"Send message",title:L==="streaming"?"Stop reply":L==="uploading"?"Send message (attachments uploading)…":"Send message",children:L==="streaming"?o.jsx(T_,{size:12,"aria-hidden":"true"}):L==="uploading"?o.jsx(w_,{className:"v10-local-agent-inline-send-spinner",size:14,"aria-hidden":"true"}):o.jsx(r_,{size:14,"aria-hidden":"true"})})]})]})})]})})]})]})}function Zh(e){return e.length>12?e.slice(-8):e}function d7(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 p7(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},y=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:y,hasRelay:b,openedAt:k})}const s=g=>{var m;return(m=g.find(y=>y.name))==null?void 0:m.name},c=g=>g.reduce((m,y)=>y.lastSeen!=null&&(m==null||y.lastSeen>m)?y.lastSeen:m,void 0),u=[],d=new Set;for(const[g,m]of r){const y=n.get(g)??[];u.push({peerId:g,name:s(y),transport:m.hasDirect?"direct":"relayed",hasDirect:m.hasDirect,hasRelay:m.hasRelay,openedAt:m.openedAt,connected:!0,lastSeen:c(y),agents:y}),d.add(g)}for(const[g,m]of n){if(d.has(g))continue;const y=m.filter(E=>E.connectionStatus==="connected");if(y.length===0)continue;const b=y.some(E=>E.connectionTransport==="direct"),k=y.some(E=>E.connectionTransport==="relayed"),j=k&&!b?"relayed":"direct";u.push({peerId:g,name:s(m),transport:j,hasDirect:b,hasRelay:k,openedAt:null,connected:!0,lastSeen:c(m),agents:m}),d.add(g)}const f=[];for(const[g,m]of n){if(d.has(g))continue;const y=c(m);y!=null&&f.push({peerId:g,name:s(m),transport:"direct",hasDirect:!1,hasRelay:!1,openedAt:null,connected:!1,lastSeen:y,agents:m})}f.sort((g,m)=>(m.lastSeen??0)-(g.lastSeen??0));const h=u.filter(g=>g.transport==="direct").length;return{connected:u,recentlySeen:f,directCount:h,relayedCount:u.length-h}}function f7({peer:e}){var g;const[t,n]=w.useState(!1),r=w.useId(),s=3,c=e.connected?"connected":"offline",u=((g=e.name)==null?void 0:g.trim())||Zh(e.peerId),d=t?e.agents:e.agents.slice(0,s),f=e.connected?e.transport:"Disconnected",h=e.connected&&e.hasDirect&&e.hasRelay?"Direct + relay paths active — direct shown":void 0;return o.jsxs("div",{className:`v10-agent-card v10-peer-card ${c}`,children:[o.jsxs("div",{className:"v10-agent-card-header",children:[o.jsx("span",{className:`v10-agent-card-dot ${c}`}),o.jsx("span",{className:"v10-peer-card-name",children:u}),o.jsx("span",{className:"v10-agent-card-badge",title:h,children:f})]}),o.jsxs("div",{className:"v10-peer-card-meta",children:[o.jsx("span",{title:e.peerId,children:Zh(e.peerId)}),e.connected&&e.openedAt!=null&&o.jsxs("span",{children:["up ",Dw(Date.now()-e.openedAt)]}),!e.connected&&e.lastSeen!=null&&o.jsxs("span",{children:[Dw(Date.now()-e.lastSeen)," ago"]}),e.agents.length>0&&o.jsxs("span",{children:[e.agents.length," agent",e.agents.length===1?"":"s"]})]}),e.agents.length>0&&o.jsxs("ul",{id:r,className:"v10-peer-card-chips","aria-label":`Agents on ${u}`,children:[d.map((m,y)=>o.jsx("li",{className:"v10-peer-chip",title:m.agentUri||"",children:o.jsx("span",{className:"v10-peer-chip-label",children:d7(m.agentUri)||Zh(m.peerId)})},m.agentUri||`${e.peerId}:${y}`)),e.agents.length>s&&o.jsx("li",{children:o.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-s} more`})})]})]})}function uk(e){const{label:t,peers:n,expanded:r,onToggle:s,emptyMessage:c}=e;return o.jsxs("div",{className:"v10-peer-group",children:[o.jsxs("button",{type:"button",className:"v10-peer-group-header",onClick:s,"aria-expanded":r,children:[o.jsx(nm,{size:14,className:`v10-peer-group-chevron ${r?"expanded":""}`,"aria-hidden":"true"}),o.jsx("span",{className:"v10-peer-group-label",children:t}),o.jsx("span",{className:"v10-peer-group-count",children:n.length})]}),r&&o.jsx("div",{className:"v10-peer-group-body",children:n.length===0?o.jsx("div",{className:"v10-agent-empty-state",children:c}):n.map(u=>o.jsx(f7,{peer:u},u.peerId))})]})}function h7(e){const{peerAgents:t,connections:n,loading:r,onRefresh:s}=e,[c,u]=w.useState(!0),[d,f]=w.useState(!1),{connected:h,recentlySeen:g,directCount:m,relayedCount:y}=p7(n.rows,t);return o.jsxs("div",{className:"v10-agent-scroll-tab",children:[o.jsxs("div",{className:"v10-agents-summary",children:[o.jsxs("span",{className:"v10-agents-stat",children:[o.jsx("span",{className:`v10-agents-stat-dot ${h.length>0||n.total>0?"connected":"known"}`}),o.jsxs("span",{title:"Unique libp2p peers connected to this node — matches the count in the header.",children:[h.length," peer",h.length===1?"":"s"]})]}),o.jsxs("span",{className:"v10-agents-stat",title:"Preferred transport per peer (peers reachable via direct + relay are bucketed under direct)",children:[m," direct / ",y," relayed"]}),o.jsx("button",{className:"v10-agents-refresh",onClick:s,title:"Refresh network peers",children:"Refresh"})]}),r&&o.jsx("p",{className:"v10-agents-loading",children:"Loading peers..."}),!r&&h.length===0&&g.length===0&&n.total===0&&o.jsx("div",{className:"v10-agent-empty-state",children:"No network peers detected yet."}),!r&&h.length===0&&n.total>0&&o.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)&&o.jsxs(o.Fragment,{children:[o.jsx(uk,{label:"Connected",peers:h,expanded:c,onToggle:()=>u(b=>!b),emptyMessage:"No peers currently connected."}),o.jsx(uk,{label:"Recently seen",peers:g,expanded:d,onToggle:()=>f(b=>!b),emptyMessage:"No previously-seen peers."})]})]})}function m7(e){const{sessions:t,onOpenSession:n}=e;return o.jsx("div",{className:"v10-agent-scroll-tab",children:o.jsxs("div",{className:"v10-sessions-list",children:[o.jsx("div",{className:"v10-local-agent-copy",style:{marginBottom:12},children:"Sessions track DKG-persisted conversations for your integrated agents."}),t.length===0?o.jsx("p",{className:"v10-agent-empty-state",children:"No integrated-agent sessions yet."}):t.map(r=>o.jsxs("button",{className:"v10-session-item",onClick:()=>n(r),children:[o.jsxs("span",{className:"v10-session-preview",children:[r.integrationName,": ",r.preview]}),o.jsxs("span",{className:"v10-session-count",children:[r.messageCount," msg",r.messageCount!==1?"s":"",r.lastTs?` - ${ld(r.lastTs)}`:""]})]},r.sessionId))]})})}function g7(){return xd().data}function v7(){const{stage:e,advance:t}=og(),[n,r]=w.useState("agents"),[s,c]=w.useState([]),[u,d]=w.useState([]),[f,h]=w.useState({total:0,direct:0,relayed:0,rows:[]}),[g,m]=w.useState(!0),y=g7(),[b,k]=w.useState([]),[j,E]=w.useState("openclaw"),[S,T]=w.useState(()=>Zs("openclaw")),[N,R]=w.useState(null),[H,A]=w.useState(null),[U,G]=w.useState(null),[M,_]=w.useState(null),[I,B]=w.useState({}),[Z,$]=w.useState({}),[D,F]=w.useState({}),[V,X]=w.useState({}),[Q,L]=w.useState({}),P=w.useRef(new Map),q=w.useRef(!1),O=w.useRef(null),ne=w.useRef([]),ue=w.useRef({}),le=w.useRef("openclaw"),be=w.useRef(Zs("openclaw")),Re=Na(ge=>ge.contextGraphs),Ee=Na(ge=>ge.loading),Ie=Na(ge=>ge.activeProjectId),Ve=Na(ge=>ge.setActiveProject),Se=w.useMemo(()=>wO(Re,y?dg(y):null,Ie),[Re,y,Ie]),ft=ck(s,b),{selectedIntegration:Me,selectedConversation:qe,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt}=s7({integrations:b,selectedIntegrationId:j,selectedSessionId:S,localMessagesByConversation:I,sessions:ft}),xe=(qe==null?void 0:qe.stateKey)??null,Oe=xe?I[xe]??[]:[],_t=xe?V[xe]??!1:!1,Dt=xe?Z[xe]??"":"",Yt=xe?D[xe]??!1:!1,Ft=xe?Q[xe]??[]:[],ut=w.useCallback(()=>{var ge;(ge=O.current)==null||ge.scrollIntoView({behavior:"smooth"})},[]);w.useEffect(ut,[xe,Oe,ut]),w.useEffect(()=>{ne.current=s},[s]),w.useEffect(()=>{ue.current=I},[I]),w.useEffect(()=>{le.current=j},[j]),w.useEffect(()=>{be.current=S},[S]);const ye=w.useCallback((ge,ze)=>{B(de=>({...de,[ge]:ze(de[ge]??[])}))},[]),K=w.useCallback((ge,ze)=>{ge&&$(de=>({...de,[ge]:ze}))},[]),W=w.useCallback((ge,ze)=>{F(de=>({...de,[ge]:ze}))},[]),ee=w.useCallback((ge,ze)=>{L(de=>({...de,[ge]:ze(de[ge]??[])}))},[]),ce=w.useCallback((ge,ze,de)=>{const je=Array.from(ze);if(je.length===0)return;const Te=new Set((Q[ge]??[]).map(Ze=>`${Ze.contextGraphId}:${Ze.file.name}:${Ze.file.size}:${Ze.file.lastModified}`)),tt=je.filter(Ze=>{const pt=`${de}:${Ze.name}:${Ze.size}:${Ze.lastModified}`;return Te.has(pt)?!1:(Te.add(pt),!0)});if(tt.length===0)return;const Je=tt.map(Ze=>({id:`${ge}:${Ze.name}:${Ze.size}:${Ze.lastModified}:${crypto.randomUUID()}`,file:Ze,contextGraphId:de,assertionName:`${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}-${Ze.name.replace(/[^a-zA-Z0-9._-]/g,"_")}`,status:"queued"}));ee(ge,Ze=>[...Ze,...Je])},[Q,ee]),he=w.useCallback(async(ge,ze)=>{const de=[];for(const je of ze){if(je.status==="completed"||je.status==="skipped"){de.push(je);continue}ee(ge,Te=>Te.map(tt=>tt.id===je.id?{...tt,status:"uploading",error:void 0}:tt));try{const Te=await Gk(je.assertionName,je.contextGraphId,je.file),tt=Te.extraction.status==="completed"?"completed":Te.extraction.status==="skipped"?"skipped":"error",Je={...je,status:tt,result:Te,error:Te.extraction.error};de.push(Je),ee(ge,Ze=>Ze.map(pt=>pt.id===je.id?Je:pt))}catch(Te){const tt={...je,status:"error",error:(Te==null?void 0:Te.message)??"Upload failed"};de.push(tt),ee(ge,Je=>Je.map(Ze=>Ze.id===je.id?tt:Ze))}}return de},[ee]),Le=w.useCallback((ge,ze)=>{ee(ge,de=>de.filter(je=>je.id!==ze))},[ee]),He=w.useCallback((ge,ze)=>{const de=new Set(ze);ee(ge,je=>je.filter(Te=>!de.has(Te.id)))},[ee]),Ce=w.useCallback((ge,ze={})=>{E(ge),ge!==Wi&&(ze.preserveSession||T(ze.sessionId??Zs(ge)))},[]),Fe=w.useCallback(()=>{Tn.fetchMemorySessions(50).then(({sessions:ge})=>c(ge??[])).catch(()=>{})},[]),et=w.useCallback(async()=>{try{const[ge,ze]=await Promise.all([Jm().catch(()=>({agents:[]})),o2().catch(()=>({total:0,direct:0,relayed:0,connections:[]}))]),de=(ge.agents??[]).filter(je=>je.connectionStatus!=="self");d(de),h({total:ze.total??0,direct:ze.direct??0,relayed:ze.relayed??0,rows:Array.isArray(ze.connections)?ze.connections:[]})}catch{}m(!1)},[]),Ne=w.useCallback(async()=>{try{const{integrations:ge}=await bd();k(ge);const ze=ck(ne.current,ge),de=[...ge].sort(Dd).filter(pt=>pt.persistentChat),je=le.current,Te=be.current,tt=ge.find(pt=>pt.id===je)??null,Je=c7({selectedIntegrationId:je,selectedItem:tt,selectedSessionId:Te,localMessagesByConversation:ue.current,sessionSummaries:ze});if(!Je){const pt=de[0];Ce((pt==null?void 0:pt.id)??Wi,{sessionId:(pt==null?void 0:pt.defaultSessionId)??null})}const Ze=de[0];Ze&&!q.current&&je!==Wi?(q.current=!0,Ce(Ze.id,{sessionId:Ze.defaultSessionId}),r("agents")):!Ze&&!Je&&(q.current=!1,Ce(Wi))}catch{}},[Ce]),Gt=w.useCallback(async(ge,ze=null,de=null)=>{const je=pd({integrationId:ge,sessionId:ze,defaultSessionId:de});X(Te=>({...Te,[je.stateKey]:!1}));try{const tt=(await ux(ge,100,{sessionId:je.sessionId??void 0})).map(Je=>$w(Je,ge));ye(je.stateKey,Je=>Iw(Je,tt))}catch{ye(je.stateKey,Te=>Te)}finally{X(Te=>({...Te,[je.stateKey]:!0})),Fe()}},[Fe,ye]);w.useEffect(()=>{Fe(),et(),Ne()},[Fe,et,Ne]),w.useEffect(()=>{for(const ge of OF)Gt(ge,Zs(ge))},[]);const At=w.useCallback(()=>{Fe(),et()},[Fe,et]);Ul(At,15e3,{runImmediately:!1});const Ua=b.some(ge=>ge.persistentChat&&(!ge.chatReady||ge.status==="connecting"))?3e3:15e3;w.useEffect(()=>{const ge=setInterval(()=>{Ne()},Ua);return()=>clearInterval(ge)},[Ua,Ne]),w.useEffect(()=>{if(!(Me!=null&&Me.chatSupported)||!Me.persistentChat&&!ke){xe&&X(ze=>({...ze,[xe]:!1}));return}let ge=!1;return(async()=>await Gt(Me.id,(qe==null?void 0:qe.sessionId)??null,Me.defaultSessionId??null))(),()=>{ge=!0}},[Gt,qe==null?void 0:qe.sessionId,xe,ke,Me==null?void 0:Me.defaultSessionId,Me==null?void 0:Me.chatSupported,Me==null?void 0:Me.id,Me==null?void 0:Me.persistentChat]);const la=w.useCallback(async()=>{const ge=Me,ze=qe,de=Dt.trim(),je=Ft,Te=je.some(zC);if(!(ge!=null&&ge.chatSupported)||!ge.chatReady||Yt||!ze||!de&&!Te)return;const tt=ge.id,Je=ze.stateKey;W(Je,!0),G(null);let Ze=null,pt="",fn="",Ht="",ln="",or=[],lr=[],ss=[];try{lr=await he(Je,je);const Wn=lr.map(Jt=>NF(Jt)).filter(Jt=>Jt!=null),ua=EF(lr);if(!de&&Wn.length===0&&ua.results.length===0)return;fn=crypto.randomUUID();const Aa=DC(ua.results),Hr=[de,Aa].filter(Jt=>Jt.length>0).join(`
|
|
1669
|
-
|
|
1670
|
-
`);Ht=de?Hr:TF(Wn,ua.results);const hn=de?Hr:"";or=Wn,ss=[...Wn.map(Jt=>Jt.id).filter(Jt=>typeof Jt=="string"&&Jt.length>0),...ua.deliveredDraftIds];const cr=`local:${Je}:${fn}:user`;pt=`local:${Je}:${fn}:assistant`;const da=new Date,Ot=ld(da),go=Om(da);ye(Je,Jt=>[...Jt,{id:cr,turnId:fn,role:"user",content:Ht,ts:Ot,tsRaw:go,attachments:Wn},{id:pt,turnId:fn,role:"assistant",content:"",ts:Ot,tsRaw:go,streaming:!0}]),K(Je,""),ss.length>0&&He(Je,ss),Ze=new AbortController,P.current.set(Je,Ze);const Zl=[...AF(Re,Ie,y)],pa=await J2(tt,hn,{correlationId:fn,signal:Ze==null?void 0:Ze.signal,sessionId:ze.sessionId??void 0,profile:ge.profile,persistUserMessage:hn?void 0:Ht,attachments:Wn,attachmentImportResults:ua.results,contextEntries:Zl,contextGraphId:Ie??void 0,onEvent:Jt=>{Jt.type==="text_delta"&&(ln+=Jt.delta,ye(Je,fa=>fa.map(Fa=>Fa.id===pt?{...Fa,content:Fa.content+Jt.delta}:Fa)))}}),ur=new Date;ye(Je,Jt=>Pw(Jt,fn,pa.turnId).map(fa=>{var Fa;return fa.id===pt?{...fa,content:pa.text||fa.content,turnId:((Fa=pa.turnId)==null?void 0:Fa.trim())||fa.turnId,streaming:!1,synthesized:!pa.text&&!fa.content?!0:fa.synthesized,ts:ld(ur),tsRaw:Om(ur)}:fa})),Fe(),e===0&&t()}catch(Wn){const ua=(Wn==null?void 0:Wn.name)==="AbortError",Aa=ua?"Request cancelled.":LF(ge,Wn),Hr=ua?Aa:`Error: ${Aa}`;pt&&ye(Je,hn=>hn.map(Cn=>Cn.id===pt?{...Cn,content:ln,failureNotice:Hr,streaming:!1,synthesized:!ln}:Cn)),!ua&&tt==="hermes"&&pt&&Ht&&(async()=>{try{const hn=await X2(tt,{sessionId:ze.sessionId??void 0,correlationId:fn||void 0,userMessage:Ht,assistantReply:ln,failureReason:Aa,profile:ge.profile,attachments:or,contextGraphId:Ie??void 0});hn.turnId&&ye(Je,Cn=>Pw(Cn,fn,hn.turnId)),Fe()}catch{}})(),ss.length>0&&lr.length>0&&L(hn=>{const Cn=hn[Je]??[],cr=new Set(Cn.map(Ot=>Ot.id)),da=lr.filter(Ot=>!cr.has(Ot.id));return da.length===0?hn:{...hn,[Je]:[...da,...Cn]}}),Ne()}finally{W(Je,!1),P.current.get(Je)===Ze&&P.current.delete(Je)}},[Ie,t,Re,y,Fe,Dt,Yt,he,Ft,Ne,qe,Me,He,K,W,e,ye]),Ur=w.useCallback(()=>{if(!xe)return;const ge=P.current.get(xe);ge==null||ge.abort()},[xe]),Br=w.useCallback(async ge=>{R(ge),G(null),A(null);try{const ze=await Z2(ge);k(Te=>Pu(Te,ze.integration)),await Ne();const de=Pu(b,ze.integration),je=r7({integrationId:ge,selectedSessionId:S,integrations:de});Ce(ge,{preserveSession:je,sessionId:ze.integration.defaultSessionId}),q.current=!0,A(ze.notice??(ze.integration.chatReady?`${ze.integration.name} is connected and chat-ready.`:`${ze.integration.name} attach is in progress. The node will keep checking for a live bridge.`)),r("agents")}catch(ze){await Ne(),G(ze.message)}finally{R(null)}},[b,Ne,S,Ce]),ca=w.useCallback(async ge=>{G(null),A(null);try{await Y2(ge),k(ze=>l7(ze,ge)),q.current=!1,Ce(ge,{preserveSession:j===ge}),A("The local agent was disconnected from this node. Session history remains available here."),r("agents"),await Ne()}catch(ze){G(ze.message)}},[Ne,j,Ce]),Ba=w.useCallback(async ge=>{var Te,tt,Je;if(M===ge)return;_(ge),G(null),A(null);const ze=pd({integrationId:ge,sessionId:j===ge?be.current:null,defaultSessionId:(Te=b.find(Ze=>Ze.id===ge))==null?void 0:Te.defaultSessionId}),[de,je]=await Promise.allSettled([Q2(ge),ux(ge,100,{sessionId:ze.sessionId??void 0})]);try{if(de.status==="fulfilled"?(k(Ze=>Pu(Ze,de.value.integration)),de.value.notice&&A(de.value.notice)):G(((tt=de.reason)==null?void 0:tt.message)??"Failed to refresh integration."),je.status==="fulfilled"){const Ze=je.value.map(pt=>$w(pt,ge));ye(ze.stateKey,pt=>Iw(pt,Ze)),X(pt=>({...pt,[ze.stateKey]:!0}))}else de.status==="fulfilled"&&G(((Je=je.reason)==null?void 0:Je.message)??"Failed to refresh conversation.")}finally{_(null)}},[b,M,j,ye]),sr=w.useCallback(ge=>{Ce(ge.integrationId,{sessionId:ge.sessionId}),r("agents")},[Ce]),Wl=w.useCallback(ge=>{Ve(ge||null)},[Ve]),Fr=w.useCallback(ge=>{!xe||!Ie||ce(xe,ge,Ie)},[Ie,ce,xe]),wi=w.useCallback(ge=>{xe&&Le(xe,ge)},[Le,xe]);return o.jsxs("div",{className:"v10-panel-right",children:[o.jsxs("div",{className:"v10-agent-mode-tabs",children:[o.jsx("button",{className:`v10-agent-mode-tab ${n==="agents"?"active":""}`,onClick:()=>r("agents"),children:"Agents"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="network"?"active":""}`,onClick:()=>r("network"),children:"Network"}),o.jsx("button",{className:`v10-agent-mode-tab ${n==="sessions"?"active":""}`,onClick:()=>r("sessions"),children:"Sessions"})]}),n==="agents"&&o.jsx(u7,{integrations:b,selectedIntegrationId:j,selectedIntegration:Me,selectedSessionId:S,selectedHasConversation:ke,selectedIntegrationHasAnyConversation:lt,onSelectIntegration:Ce,onConnectIntegration:Br,onDisconnectIntegration:ca,onRefreshIntegration:Ba,connectBusyId:N,refreshBusyId:M,connectNotice:H,connectError:U,localMessages:Oe,localHistoryLoaded:_t,localChatEndRef:O,localInput:Dt,onLocalInputChange:ge=>K(xe,ge),onSendLocalMessage:la,onStopLocalStream:Ur,localSending:Yt,activeProjectId:Ie,availableProjects:Re,selectableProjects:Se,projectsLoading:Ee,onSelectProject:Wl,attachments:Ft,onAddAttachments:Fr,onRemoveAttachment:wi}),n==="network"&&o.jsx(h7,{peerAgents:u,connections:f,loading:g,onRefresh:et}),n==="sessions"&&o.jsx(m7,{sessions:ft,onOpenSession:sr})]})}function y7(e,t=document){const n=e==="light";t.documentElement.classList.toggle("light",n),t.body.classList.toggle("light",n)}function b7(){const{toggleLeft:e,toggleRight:t,toggleBottom:n}=qn();w.useEffect(()=>{const r=s=>{if(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||!(s.metaKey||s.ctrlKey))return;const u=s.key.toLowerCase();if(s.shiftKey&&u==="b"){s.preventDefault(),t();return}if(!s.shiftKey){if(u==="b"){s.preventDefault(),e();return}if(u==="j"){s.preventDefault(),n();return}}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e,t,n])}const dk={"/observability":{id:"operations",label:"Observability"},"/operations":{id:"operations",label:"Observability"},"/settings":{id:"settings",label:"Settings"}},x7={operations:"/observability",settings:"/settings",dashboard:"/"};function w7(){const{pathname:e}=Pa(),t=Hm(),n=vn(s=>s.openTab),r=vn(s=>s.activeTabId);w.useEffect(()=>{const s=dk[e];s&&n({id:s.id,label:s.label,closable:!0})},[e,n]),w.useEffect(()=>{const s=x7[r];if(s){s!==e&&t(s,{replace:!0});return}dk[e]&&t("/",{replace:!0})},[r,e,t])}function k7(){const[e,t]=w.useState(mR());return w.useEffect(()=>gR(t),[]),e?o.jsxs("div",{className:"v10-mock-banner",role:"alert","aria-live":"polite",children:[o.jsx("span",{className:"v10-mock-banner-dot","aria-hidden":"true"}),o.jsxs("span",{children:[o.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."]}),o.jsx("button",{type:"button",className:"v10-mock-banner-reload",onClick:()=>window.location.reload(),children:"Reload"})]}):null}function S7(){const e=Pk(t=>t.setNodeStatus);Ul(()=>{Tn.fetchStatus().then(e).catch(()=>{})},1e4)}function pk(e){const t=w.useRef(null),n=w.useRef(e);return n.current=e,w.useEffect(()=>{const r=t.current;if(!r)return;let s=0;const c=f=>{const h=f.clientX-s;s=f.clientX,n.current(h)},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",r.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientX,document.addEventListener("mousemove",c),document.addEventListener("mouseup",u),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 j7(e){const t=w.useRef(e);t.current=e;const[n,r]=w.useState(null);return w.useEffect(()=>{if(!n)return;let s=0;const c=f=>{const h=f.clientY-s;s=f.clientY,t.current(h)},u=()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",u),document.body.style.cursor="",document.body.style.userSelect="",n.classList.remove("active")},d=f=>{f.preventDefault(),s=f.clientY,document.addEventListener("mousemove",c),document.addEventListener("mouseup",u),document.body.style.cursor="row-resize",document.body.style.userSelect="none",n.classList.add("active")};return n.addEventListener("mousedown",d),()=>{n.removeEventListener("mousedown",d),u()}},[n]),w.useCallback(s=>r(s),[])}function C7(){S7(),b7(),w7();const{leftCollapsed:e,rightCollapsed:t,bottomCollapsed:n,theme:r,leftWidth:s,rightWidth:c,setLeftWidth:u,setRightWidth:d,setBottomHeight:f}=qn(),[,h]=w.useState(0);w.useEffect(()=>{y7(r)},[r]),w.useEffect(()=>{const E=()=>h(S=>S+1);return window.addEventListener("resize",E),()=>window.removeEventListener("resize",E)},[]);const g=w.useCallback(E=>{const S=qn.getState().leftWidth;u(Math.max(140,Math.min(400,S+E)))},[u]),m=w.useCallback(E=>{const S=qn.getState().rightWidth;d(Math.max(200,Math.min(500,S-E)))},[d]),y=w.useCallback(E=>{const S=Math.min(qn.getState().bottomHeight,Hu());f(Math.min(S-E,Hu()))},[f]),b=pk(g),k=pk(m),j=j7(y);return o.jsxs("div",{className:"v10-app",children:[o.jsx(k7,{}),o.jsx(ZR,{}),o.jsxs("div",{className:"v10-app-body",children:[!e&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-panel-left",style:{width:s},children:o.jsx(CO,{})}),o.jsx("div",{className:"v10-resize-handle-h",ref:b})]}),o.jsxs("div",{className:"v10-center-region",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[o.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden"},children:o.jsx(lF,{})}),!n&&o.jsx("div",{className:"v10-resize-handle-v",ref:j}),o.jsx(wF,{})]}),!t&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"v10-resize-handle-h",ref:k}),o.jsx("div",{className:"v10-panel-right",style:{width:c},children:o.jsx(v7,{})})]})]})]})}const N7=Qe.lazy(()=>ar(()=>import("./Network-d4igcZQ0.js"),[]).then(e=>({default:e.NetworkPage})));function E7(){const e=vn(t=>t.openTab);return w.useLayoutEffect(()=>{e(ES)},[e]),o.jsx(bl,{to:"/",replace:!0})}function T7(){return o.jsxs(mA,{children:[o.jsx(mi,{path:"/network",element:o.jsx(Qe.Suspense,{fallback:o.jsx("div",{className:"lazy-spinner",children:"Loading..."}),children:o.jsx(N7,{})})}),o.jsx(mi,{path:"/context-graph-primer",element:o.jsx(E7,{})}),o.jsx(mi,{path:"/agent",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/explorer",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/messages",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"/apps/*",element:o.jsx(bl,{to:"/",replace:!0})}),o.jsx(mi,{path:"*",element:o.jsx(C7,{})})]})}vT.createRoot(document.getElementById("root")).render(o.jsx(Qe.StrictMode,{children:o.jsx(PA,{basename:"/ui",children:o.jsx(T7,{})})}));export{Ea as $,h4 as A,OI as B,Z7 as C,Tx as D,dL as E,pL as F,NO as G,_7 as H,Dl as I,MI as J,o as K,_k as L,w as M,Ax as N,W7 as O,v7 as P,xI as Q,Qe as R,DI as S,Ig as T,Fs as U,L7 as V,M7 as W,BL as X,ns as Y,bz as Z,ar as _,Yi as a,hg as a0,ML as a1,Ir as a2,Na as a3,vn as a4,CI as a5,jS as b,kS as c,Et as d,Tw as e,R7 as f,Jm as g,o2 as h,I7 as i,P7 as j,u2 as k,D7 as l,p2 as m,$7 as n,d2 as o,V7 as p,H7 as q,q7 as r,B7 as s,U7 as t,F7 as u,O7 as v,Xm as w,G7 as x,z7 as y,tR as z};
|