@netnodeag/kraftwerk 0.76.0 → 0.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +33 -27
  2. package/dist/cli/cloud.d.ts +2 -0
  3. package/dist/cli/cloud.js +262 -0
  4. package/dist/cli/daemon.js +9 -0
  5. package/dist/cli/doctor.js +16 -8
  6. package/dist/cli/init.js +2 -2
  7. package/dist/cli/invite.d.ts +2 -0
  8. package/dist/cli/invite.js +48 -0
  9. package/dist/cli/kraftwerk.js +7 -0
  10. package/dist/client/relay.d.ts +40 -0
  11. package/dist/client/relay.js +35 -0
  12. package/dist/client/routes.d.ts +5 -0
  13. package/dist/client/routes.js +5 -0
  14. package/dist/config.d.ts +15 -28
  15. package/dist/config.js +5 -19
  16. package/dist/core/chat/channel-turns.d.ts +2 -2
  17. package/dist/core/chat/channel-turns.js +2 -2
  18. package/dist/core/chat/sessions.d.ts +20 -3
  19. package/dist/core/chat/sessions.js +22 -7
  20. package/dist/core/chat/types.d.ts +21 -0
  21. package/dist/core/cloud.d.ts +152 -0
  22. package/dist/core/cloud.js +98 -0
  23. package/dist/core/routines.d.ts +22 -2
  24. package/dist/core/routines.js +26 -0
  25. package/dist/server/api/chats.js +45 -8
  26. package/dist/server/api/cloud.d.ts +86 -0
  27. package/dist/server/api/cloud.js +51 -0
  28. package/dist/server/api/devices.d.ts +15 -9
  29. package/dist/server/api/devices.js +3 -2
  30. package/dist/server/api/index.d.ts +108 -11
  31. package/dist/server/api/index.js +2 -0
  32. package/dist/server/api/router.d.ts +3 -2
  33. package/dist/server/api/router.js +12 -0
  34. package/dist/server/api/workspace.d.ts +16 -1
  35. package/dist/server/api/workspace.js +2 -1
  36. package/dist/server/cloud.d.ts +104 -33
  37. package/dist/server/cloud.js +279 -185
  38. package/dist/server/hub-context.d.ts +1 -1
  39. package/dist/server/hub-context.js +3 -3
  40. package/dist/server/members.d.ts +87 -0
  41. package/dist/server/members.js +117 -0
  42. package/dist/server/relay.d.ts +21 -1
  43. package/dist/server/relay.js +74 -3
  44. package/dist/server/server.d.ts +3 -2
  45. package/dist/server/server.js +13 -6
  46. package/dist/server/trust.d.ts +16 -0
  47. package/dist/server/trust.js +12 -1
  48. package/package.json +1 -1
  49. package/schema/kraftwerk.schema.json +4 -4
  50. package/web/dist/assets/{dist-T1sNLC62.js → dist-B-yVL5lk.js} +1 -1
  51. package/web/dist/assets/{dist-DFXmaDc5.js → dist-B9EMB1Ie.js} +1 -1
  52. package/web/dist/assets/{dist-BQpWYkxm.js → dist-BTc878j7.js} +1 -1
  53. package/web/dist/assets/{dist-fgB7OEJy.js → dist-C90kUzps.js} +1 -1
  54. package/web/dist/assets/{dist-l7foWlFx.js → dist-CpLdAqFQ.js} +1 -1
  55. package/web/dist/assets/{dist-flnLXEzU.js → dist-Crnb8VVO.js} +1 -1
  56. package/web/dist/assets/{dist-vuciRCSz.js → dist-D0rjnN8S.js} +1 -1
  57. package/web/dist/assets/{dist-BTVP-6On.js → dist-D4SDXoGw.js} +1 -1
  58. package/web/dist/assets/{dist-BwIca_Uj.js → dist-DHRhdODt.js} +1 -1
  59. package/web/dist/assets/{dist-BYkcY-Vl.js → dist-DQbifCX0.js} +1 -1
  60. package/web/dist/assets/dist-lSJ-O7kT.js +1 -0
  61. package/web/dist/assets/{editor-C6Ok8NPo.js → editor-DHAdW1g_.js} +3 -3
  62. package/web/dist/assets/{index-z4tpCCzk.js → index-D7JVAjll.js} +5 -5
  63. package/web/dist/index.html +1 -1
  64. package/web/dist-remote/sw.js +1 -1
  65. package/web/dist/assets/dist-BURf1l-A.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor-C6Ok8NPo.js","assets/dist-CYzOYk_e.js","assets/dist-flnLXEzU.js","assets/dist-l7foWlFx.js","assets/dist-BQpWYkxm.js","assets/dist-BdZ5cNRp.js","assets/editor-CZMrhTTL.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/editor-DHAdW1g_.js","assets/dist-CYzOYk_e.js","assets/dist-Crnb8VVO.js","assets/dist-CpLdAqFQ.js","assets/dist-BTc878j7.js","assets/dist-BdZ5cNRp.js","assets/editor-CZMrhTTL.css"])))=>i.map(i=>d[i]);
2
2
  var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function w(){}var T={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function D(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function O(e,t){return D(e.type,t,e.props)}function k(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function A(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?A(``+e.key):t.toString(36)}function j(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(w,w):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function M(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(k(o)&&(o=O(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=M(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function N(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var re=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function P(e){var t=T.T,n={};n.types=t===null?null:t.types,T.T=n;try{var r=e(),i=T.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(w,re)}catch(e){re(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),T.T=t}}function F(e){var t=T.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else P(F.bind(null,e))}var I={map:N,forEach:function(e,t,n){N(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return N(e,function(){t++}),t},toArray:function(e){return N(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=I,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=T,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return T.H.useMemoCache(e)}},e.addTransitionType=F,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!E.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return D(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)E.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return D(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=k,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ne}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=P,e.unstable_useCacheRefresh=function(){return T.H.useCacheRefresh()},e.use=function(e){return T.H.use(e)},e.useActionState=function(e,t,n){return T.H.useActionState(e,t,n)},e.useCallback=function(e,t){return T.H.useCallback(e,t)},e.useContext=function(e){return T.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return T.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return T.H.useEffect(e,t)},e.useEffectEvent=function(e){return T.H.useEffectEvent(e)},e.useId=function(){return T.H.useId()},e.useImperativeHandle=function(e,t,n){return T.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return T.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return T.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return T.H.useMemo(e,t)},e.useOptimistic=function(e,t){return T.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return T.H.useReducer(e,t,n)},e.useRef=function(e){return T.H.useRef(e)},e.useState=function(e){return T.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return T.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return T.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),h=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}function m(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&m(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),ee=Symbol.for(`react.fragment`),te=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),P=Symbol.for(`react.suspense_list`),F=Symbol.for(`react.memo`),I=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ee:return`Fragment`;case j:return`Profiler`;case te:return`StrictMode`;case re:return`Suspense`;case P:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case F:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case I:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var L=Array.isArray,R=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},me=[],he=-1;function ge(e){return{current:e}}function _e(e){0>he||(e.current=me[he],me[he]=null,he--)}function ve(e,t){he++,me[he]=e.current,e.current=t}var ye=ge(null),be=ge(null),xe=ge(null),Se=ge(null);function Ce(e,t){switch(ve(xe,t),ve(be,e),ve(ye,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}_e(ye),ve(ye,e)}function we(){_e(ye),_e(be),_e(xe)}function Te(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,ve(Se,e)),t=ye.current;var n=dp(t,e.type);t!==n&&(ve(be,e),ve(ye,n))}function Ee(e){be.current===e&&(_e(ye),_e(be)),Se.current===e&&(_e(Se),sh._currentValue=pe)}var De,Oe;function ke(e){if(De===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);De=t&&t[1]||``,Oe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+De+e+Oe}var Ae=!1;function je(e,t){if(!e||Ae)return``;Ae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -7,7 +7,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ae=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ke(n):``}function Me(e,t){switch(e.tag){case 26:case 27:case 5:return ke(e.type);case 16:return ke(`Lazy`);case 13:return e.child!==t&&t!==null?ke(`Suspense Fallback`):ke(`Suspense`);case 19:return ke(`SuspenseList`);case 0:case 15:return je(e.type,!1);case 11:return je(e.type.render,!1);case 1:return je(e.type,!0);case 31:return ke(`Activity`);case 30:return ke(`ViewTransition`);default:return``}}function Ne(e){try{var t=``,n=null;do t+=Me(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var Pe=Object.prototype.hasOwnProperty,Fe=t.unstable_scheduleCallback,Ie=t.unstable_cancelCallback,Le=t.unstable_shouldYield,Re=t.unstable_requestPaint,ze=t.unstable_now,Be=t.unstable_getCurrentPriorityLevel,Ve=t.unstable_ImmediatePriority,He=t.unstable_UserBlockingPriority,Ue=t.unstable_NormalPriority,We=t.unstable_LowPriority,Ge=t.unstable_IdlePriority,Ke=t.log,qe=t.unstable_setDisableYieldValue,Je=null,Ye=null;function Xe(e){if(typeof Ke==`function`&&qe(e),Ye&&typeof Ye.setStrictMode==`function`)try{Ye.setStrictMode(Je,e)}catch{}}var Ze=Math.clz32?Math.clz32:V,Qe=Math.log,B=Math.LN2;function V(e){return e>>>=0,e===0?32:31-(Qe(e)/B|0)|0}var $e=256,H=262144,U=4194304;function et(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function W(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=et(n))):i=et(o):i=et(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=et(n))):i=et(o)):i=et(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function G(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function K(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-Ze(n),i=1<<r;t|=e[r],n&=~i}return t}function tt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 nt(){var e=U;return U<<=1,!(U&62914560)&&(U=4194304),e}function q(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ze(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&at(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function at(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function ot(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function st(e,t){var n=t&-t;return n=n&42?1:ct(n),(n&(e.suspendedLanes|t))===0?n:0}function ct(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function lt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ut(){var e=z.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function dt(e,t){var n=z.p;try{return z.p=e,t()}finally{z.p=n}}var ft=Math.random().toString(36).slice(2),J=`__reactFiber$`+ft,pt=`__reactProps$`+ft,mt=`__reactContainer$`+ft,ht=`__reactEvents$`+ft,gt=`__reactListeners$`+ft,Y=`__reactHandles$`+ft,_t=`__reactResources$`+ft,vt=`__reactMarker$`+ft,X=`__reactLoad$`+ft;function yt(e){delete e[J],delete e[pt],delete e[gt],delete e[Y]}function bt(e){var t;if(t=e[J])return t;for(var n=e.parentNode;n;){if(t=n[mt]||n[J]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[J])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function xt(e){if(e=e[J]||e[mt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function St(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Ct(e){var t=e[_t];return t||=e[_t]={hoistableStyles:new Map,hoistableScripts:new Map},t}function wt(e){e[vt]=!0}function Tt(e){e[X]=void 0}var Et=new Set,Dt={};function Ot(e,t){kt(e,t),kt(e+`Capture`,t)}function kt(e,t){for(Dt[e]=t,e=0;e<t.length;e++)Et.add(t[e])}var At=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]*$`),jt={},Mt={};function Nt(e){return Pe.call(Mt,e)?!0:Pe.call(jt,e)?!1:At.test(e)?Mt[e]=!0:(jt[e]=!0,!1)}var Pt=!1;function Ft(){var e=Pt;return Pt=!1,e}function It(e,t,n){if(Nt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Lt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Rt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Bt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Vt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ht(e){if(!e._valueTracker){var t=Bt(e)?`checked`:`value`;e._valueTracker=Vt(e,t,``+e[t])}}function Ut(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Bt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var Wt=/[\n"\\]/g;function Gt(e){return e.replace(Wt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Kt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+zt(t)):e.value!==``+zt(t)&&(e.value=``+zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Jt(e,zt(n)):o===`number`&&e.value==t?Jt(e,zt(e.value)):Jt(e,zt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+zt(s):e.removeAttribute(`name`)}function qt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ht(e);return}n=n==null?``:``+zt(n),t=t==null?n:``+zt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ht(e)}function Jt(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function Yt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+zt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Xt(e,t,n){if(t!=null&&(t=``+zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+zt(n)}function Zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(L(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ht(e)}function Qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Z=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 $t(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Z.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function en(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Pt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&($t(e,a,r),Pt=!0)}else for(var o in t)t.hasOwnProperty(o)&&$t(e,o,t[o])}function tn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 nn=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`],[`maskType`,`mask-type`],[`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 an(e){return rn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function on(){}var sn=null;function cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ln=null,un=null;function dn(e){var t=xt(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Kt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Gt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[pt]||null;if(!a)throw Error(i(90));Kt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Ut(r)}break a;case`textarea`:Xt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Yt(e,!!n.multiple,t,!1)}}}var fn=!1;function pn(e,t,n){if(fn)return e(t,n);fn=!0;try{return e(t)}finally{if(fn=!1,(ln!==null||un!==null)&&(Id(),ln&&(t=ln,e=un,un=ln=null,dn(t),e)))for(t=0;t<e.length;t++)dn(e[t])}}function mn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[pt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var hn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,gn=!1;if(hn)try{var _n={};Object.defineProperty(_n,"passive",{get:function(){gn=!0}}),window.addEventListener(`test`,_n,_n),window.removeEventListener(`test`,_n,_n)}catch{gn=!1}var vn=null,yn=null,bn=null;function xn(){if(bn)return bn;var e,t=yn,n=t.length,r,i=`value`in vn?vn.value:vn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return bn=i.slice(e,1<r?1-r:void 0)}function Sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Cn(){return!0}function wn(){return!1}function Tn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Cn:wn,this.isPropagationStopped=wn,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Cn)},persist:function(){},isPersistent:Cn}),t}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dn=Tn(En),On=D({},En,{view:0,detail:0}),kn=Tn(On),An,jn,Mn,Nn=D({},On,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Mn&&(Mn&&e.type===`mousemove`?(An=e.screenX-Mn.screenX,jn=e.screenY-Mn.screenY):jn=An=0,Mn=e),An)},movementY:function(e){return`movementY`in e?e.movementY:jn}}),Pn=Tn(Nn),Fn=Tn(D({},Nn,{dataTransfer:0})),In=Tn(D({},On,{relatedTarget:0})),Ln=Tn(D({},En,{animationName:0,elapsedTime:0,pseudoElement:0})),Rn=Tn(D({},En,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),zn=Tn(D({},En,{data:0})),Bn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Vn={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`},Hn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Un(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hn[e])?!!t[e]:!1}function Wn(){return Un}var Gn=Tn(D({},On,{key:function(e){if(e.key){var t=Bn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Vn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wn,charCode:function(e){return e.type===`keypress`?Sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Kn=Tn(D({},Nn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qn=Tn(D({},En,{submitter:0})),Jn=Tn(D({},On,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wn})),Yn=Tn(D({},En,{propertyName:0,elapsedTime:0,pseudoElement:0})),Xn=Tn(D({},Nn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Zn=Tn(D({},En,{newState:0,oldState:0,source:0})),Qn=[9,13,27,32],$n=hn&&`CompositionEvent`in window,er=null;hn&&`documentMode`in document&&(er=document.documentMode);var tr=hn&&`TextEvent`in window&&!er,nr=hn&&(!$n||er&&8<er&&11>=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=xn(),bn=yn=vn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return nr&&t.locale!==`ko`?null:t.data;default:return null}}var ur={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 dr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ur[e.type]:t===`textarea`}function fr(e,t,n,r){ln?un?un.push(r):un=[r]:ln=r,t=qf(t,`onChange`),0<t.length&&(n=new Dn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var pr=null,mr=null;function hr(e){zf(e,0)}function gr(e){if(Ut(St(e)))return e}function _r(e,t){if(e===`change`)return t}var vr=!1;if(hn){var yr;if(hn){var br=`oninput`in document;if(!br){var xr=document.createElement(`div`);xr.setAttribute(`oninput`,`return;`),br=typeof xr.oninput==`function`}yr=br}else yr=!1;vr=yr&&(!document.documentMode||9<document.documentMode)}function Sr(){pr&&(pr.detachEvent(`onpropertychange`,Cr),mr=pr=null)}function Cr(e){if(e.propertyName===`value`&&gr(mr)){var t=[];fr(t,mr,e,cn(e)),pn(hr,t)}}function wr(e,t,n){e===`focusin`?(Sr(),pr=t,mr=n,pr.attachEvent(`onpropertychange`,Cr)):e===`focusout`&&Sr()}function Tr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return gr(mr)}function Er(e,t){if(e===`click`)return gr(t)}function Dr(e,t){if(e===`input`||e===`change`)return gr(t)}function Or(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var kr=typeof Object.is==`function`?Object.is:Or;function Ar(e,t){if(kr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Pe.call(t,i)||!kr(e[i],t[i]))return!1}return!0}function jr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Mr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Nr(e,t){var n=Mr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Mr(n)}}function Pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Fr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=jr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=jr(e.document)}return t}function Ir(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Lr=hn&&`documentMode`in document&&11>=document.documentMode,Q=null,Rr=null,zr=null,Br=!1;function Vr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Br||Q==null||Q!==jr(r)||(r=Q,`selectionStart`in r&&Ir(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),zr&&Ar(zr,r)||(zr=r,r=qf(Rr,`onSelect`),0<r.length&&(t=new Dn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Q)))}function Hr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Ur={animationend:Hr(`Animation`,`AnimationEnd`),animationiteration:Hr(`Animation`,`AnimationIteration`),animationstart:Hr(`Animation`,`AnimationStart`),transitionrun:Hr(`Transition`,`TransitionRun`),transitionstart:Hr(`Transition`,`TransitionStart`),transitioncancel:Hr(`Transition`,`TransitionCancel`),transitionend:Hr(`Transition`,`TransitionEnd`)},Wr={},Gr={};hn&&(Gr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Ur.animationend.animation,delete Ur.animationiteration.animation,delete Ur.animationstart.animation),`TransitionEvent`in window||delete Ur.transitionend.transition);function Kr(e){if(Wr[e])return Wr[e];if(!Ur[e])return e;var t=Ur[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gr)return Wr[e]=t[n];return e}var qr=Kr(`animationend`),Jr=Kr(`animationiteration`),Yr=Kr(`animationstart`),Xr=Kr(`transitionrun`),Zr=Kr(`transitionstart`),Qr=Kr(`transitioncancel`),$r=Kr(`transitionend`),ei=new Map,ti=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);ti.push(`scrollEnd`);function ni(e,t){ei.set(e,t),Ot(t,[e])}var ri=0;function ii(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=_d.identifierPrefix;var n=ri++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function ai(e){if(e==null||typeof e==`string`)return e;var t=null,n=Td;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function oi(e,t){return e=ai(e),t=ai(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var si=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},ci=[],li=0,ui=0;function di(){for(var e=li,t=ui=li=0;t<e;){var n=ci[t];ci[t++]=null;var r=ci[t];ci[t++]=null;var i=ci[t];ci[t++]=null;var a=ci[t];if(ci[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&hi(n,i,a)}}function fi(e,t,n,r){ci[li++]=e,ci[li++]=t,ci[li++]=n,ci[li++]=r,ui|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function pi(e,t,n,r){return fi(e,t,n,r),gi(e)}function mi(e,t){return fi(e,null,null,t),gi(e)}function hi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ze(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function gi(e){if(50<Ed)throw Ed=0,Dd=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var _i={};function vi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(e,t,n,r){return new vi(e,t,n,r)}function bi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xi(e,t){var n=e.alternate;return n===null?(n=yi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Si(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ci(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)bi(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,ye.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=yi(31,n,t,a),e.elementType=ie,e.lanes=o,e;case ee:return wi(n.children,a,o,t);case te:s=8,a|=24;break;case j:return e=yi(12,n,t,a|2),e.elementType=j,e.lanes=o,e;case re:return e=yi(13,n,t,a),e.elementType=re,e.lanes=o,e;case P:return e=yi(19,n,t,a),e.elementType=P,e.lanes=o,e;case ae:case se:return e=a|32,e=yi(30,n,t,e),e.elementType=se,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case ne:s=11;break a;case F:s=14;break a;case I:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=yi(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function wi(e,t,n,r){return e=yi(7,e,r,t),e.lanes=n,e}function Ti(e,t,n){return e=yi(6,e,null,t),e.lanes=n,e}function Ei(e){var t=yi(18,null,null,0);return t.stateNode=e,t}function Di(e,t,n){return t=yi(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Oi=new WeakMap;function ki(e,t){if(typeof e==`object`&&e){var n=Oi.get(e);return n===void 0?(t={value:e,source:t,stack:Ne(t)},Oi.set(e,t),t):n}return{value:e,source:t,stack:Ne(t)}}var Ai=[],ji=0,Mi=null,Ni=0,Pi=[],Fi=0,Ii=null,Li=1,Ri=``;function zi(e,t){Ai[ji++]=Ni,Ai[ji++]=Mi,Mi=e,Ni=t}function Bi(e,t,n){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Ii=e;var r=Li;e=Ri;var i=32-Ze(r)-1;r&=~(1<<i),n+=1;var a=32-Ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Li=1<<32-Ze(t)+i|n<<i|r,Ri=a+e}else Li=1<<a|n<<i|r,Ri=e}function Vi(e){e.return!==null&&(zi(e,1),Bi(e,1,0))}function Hi(e){for(;e===Mi;)Mi=Ai[--ji],Ai[ji]=null,Ni=Ai[--ji],Ai[ji]=null;for(;e===Ii;)Ii=Pi[--Fi],Pi[Fi]=null,Ri=Pi[--Fi],Pi[Fi]=null,Li=Pi[--Fi],Pi[Fi]=null}function Ui(e,t){Pi[Fi++]=Li,Pi[Fi++]=Ri,Pi[Fi++]=Ii,Li=t.id,Ri=t.overflow,Ii=e}var Wi=null,Gi=null,Ki=!1,qi=null,Ji=!1,Yi=Error(i(519));function Xi(e){throw na(ki(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Yi}function Zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[J]=e,t[pt]=r,n){case`dialog`:Bf(`cancel`,t),Bf(`close`,t);break;case`iframe`:case`object`:case`embed`:Bf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Lf.length;n++)Bf(Lf[n],t);break;case`source`:Bf(`error`,t);break;case`img`:case`image`:case`link`:Bf(`error`,t),Bf(`load`,t);break;case`details`:Bf(`toggle`,t);break;case`input`:Bf(`invalid`,t),qt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Bf(`invalid`,t);break;case`textarea`:Bf(`invalid`,t),Zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&(Bf(`beforetoggle`,t),Bf(`toggle`,t)),r.onScroll!=null&&Bf(`scroll`,t),r.onScrollEnd!=null&&Bf(`scrollend`,t),r.onClick!=null&&(t.onclick=on),t=!0):t=!1,t||Xi(e,!0)}function Qi(e){for(Wi=e.return;Wi;)switch(Wi.tag){case 5:case 31:case 13:Ji=!1;return;case 27:case 3:Ji=!0;return;default:Wi=Wi.return}}function $i(e){if(e!==Wi)return!1;if(!Ki)return Qi(e),Ki=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&Gi&&Xi(e),Qi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Gi=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Gi=dm(e)}else t===27?(t=Gi,Sp(e.type)?(e=um,um=null,Gi=e):Gi=t):Gi=Wi?lm(e.stateNode.nextSibling):null;return!0}function ea(){Gi=Wi=null,Ki=!1}function ta(){var e=qi;return e!==null&&(ld===null?ld=e:ld.push.apply(ld,e),qi=null),e}function na(e){qi===null?qi=[e]:qi.push(e)}var ra=ge(null),ia=null,aa=null;function oa(e,t,n){ve(ra,t._currentValue),t._currentValue=n}function sa(e){e._currentValue=ra.current,_e(ra)}function ca(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function la(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ca(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ca(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ca(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ua(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;kr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&la(t,e,n,r),t.flags|=262144,e!==null}function da(e){for(e=e.firstContext;e!==null;){if(!kr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function fa(e){ia=e,aa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function pa(e){return ha(ia,e)}function ma(e,t){return ia===null&&fa(e),ha(e,t)}function ha(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},aa===null){if(e===null)throw Error(i(308));aa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else aa=aa.next=t;return n}var ga=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},_a=t.unstable_scheduleCallback,va=t.unstable_NormalPriority,ya={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ba(){return{controller:new ga,data:new Map,refCount:0}}function xa(e){e.refCount--,e.refCount===0&&_a(va,function(){e.controller.abort()})}function Sa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ca=null;function wa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ta=null,Ea=0,Da=0,Oa=null;function ka(e,t){if(Ta===null){var n=Ta=[];Ea=0,Da=Mf(),Oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ea++,t.then(Aa,Aa),t}function Aa(){if(--Ea===0&&(Ca=null,Ta!==null)){Oa!==null&&(Oa.status=`fulfilled`);var e=Ta;Ta=null,Da=0,Oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ja(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ma=R.S;R.S=function(e,t){if(fd=ze(),typeof t==`object`&&t&&typeof t.then==`function`&&ka(e,t),Ca!==null)for(var n=vf;n!==null;)Sa(n,Ca),n=n.next;if(n=e.types,n!==null){for(var r=vf;r!==null;)Sa(r,n),r=r.next;if(Da!==0){r=Ca,r===null&&(r=Ca=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ma!==null&&Ma(e,t)};var Na=ge(null);function Pa(){var e=Na.current;return e===null?qu.pooledCache:e}function Fa(e,t){t===null?ve(Na,Na.current):ve(Na,t.pool)}function Ia(){var e=Pa();return e===null?null:{parent:ya._currentValue,pool:e}}var La=Error(i(460)),Ra=Error(i(474)),za=Error(i(542)),Ba={then:function(){}};function Va(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ha(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(on,on),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ka(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(on,on);else{if(e=qu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ka(e),e}throw Wa=t,La}}function Ua(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Wa=e,La):e}}var Wa=null;function Ga(){if(Wa===null)throw Error(i(459));var e=Wa;return Wa=null,e}function Ka(e){if(e===La||e===za)throw Error(i(483))}var qa=null,Ja=0;function Ya(e){var t=Ja;return Ja+=1,qa===null&&(qa=[]),Ha(qa,e,t)}function Xa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Za(e,t){throw t.$$typeof===O?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Qa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=xi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ti(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ee?(e=d(e,t,n.props.children,r,n.key),Xa(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===I&&Ua(i)===t.type)?(t=a(t,n.props),Xa(t,n),t.return=e,t):(t=Ci(n.type,n.key,n.props,null,e.mode,r),Xa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Di(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=wi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ti(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case k:return n=Ci(t.type,t.key,t.props,null,e.mode,n),Xa(n,t),n.return=e,n;case A:return t=Di(t,e.mode,n),t.return=e,t;case I:return t=Ua(t),f(e,t,n)}if(L(t)||ue(t))return t=wi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ya(t),n);if(t.$$typeof===N)return f(e,ma(e,t),n);Za(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case k:return n.key===i?l(e,t,n,r):null;case A:return n.key===i?u(e,t,n,r):null;case I:return n=Ua(n),p(e,t,n,r)}if(L(n)||ue(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ya(n),r);if(n.$$typeof===N)return p(e,t,ma(e,n),r);Za(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case k:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case A:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case I:return r=Ua(r),m(e,t,n,r,i)}if(L(r)||ue(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ya(r),i);if(r.$$typeof===N)return m(e,t,n,ma(t,r),i);Za(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ki&&zi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ki&&zi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ki&&zi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ki&&zi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ki&&zi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ki&&zi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===ee&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case k:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===ee){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),Xa(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===I&&Ua(l)===r.type){n(e,r.sibling),c=a(r,o.props),Xa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===ee?(c=wi(o.props.children,e.mode,c,o.key),Xa(c,o),c.return=e,e=c):(c=Ci(o.type,o.key,o.props,null,e.mode,c),Xa(c,o),c.return=e,e=c)}return s(e);case A:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Di(o,e.mode,c),c.return=e,e=c}return s(e);case I:return o=Ua(o),_(e,r,o,c)}if(L(o))return h(e,r,o,c);if(ue(o)){if(l=ue(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,Ya(o),c);if(o.$$typeof===N)return _(e,r,ma(e,o),c);Za(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ti(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ja=0;var i=_(e,t,n,r);return qa=null,i}catch(t){if(t===La||t===za)throw t;var a=yi(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var $a=Qa(!0),eo=Qa(!1),to=!1;function no(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ro(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function io(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ao(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ku&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=gi(e),hi(e,null,n),t}return fi(e,r,t,n),gi(e)}function oo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}function so(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var co=!1;function lo(){if(co){var e=Oa;if(e!==null)throw e}}function uo(e,t,n,r){co=!1;var i=e.updateQueue;to=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Yu&f)===f:(r&f)===f){f!==0&&f===Da&&(co=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:to=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),rd|=o,e.lanes=o,e.memoizedState=d}}function fo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function po(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)fo(n[e],t)}var mo=ge(null),ho=ge(0);function go(e,t){e=td,ve(ho,e),ve(mo,t),td=e|t.baseLanes}function _o(){ve(ho,td),ve(mo,mo.current)}function vo(){td=ho.current,_e(mo),_e(ho)}var yo=ge(null),bo=null;function xo(e){var t=e.alternate;ve(Eo,Eo.current&1),ve(yo,e),bo===null&&(t===null||mo.current!==null||t.memoizedState!==null)&&(bo=e)}function So(e){ve(Eo,Eo.current),ve(yo,e),bo===null&&(bo=e)}function Co(e){e.tag===22?(ve(Eo,Eo.current),ve(yo,e),bo===null&&(bo=e)):wo()}function wo(){ve(Eo,Eo.current),ve(yo,yo.current)}function To(e){_e(yo),bo===e&&(bo=null),_e(Eo)}var Eo=ge(0);function Do(e,t){ve(yo,yo.current),ve(Eo,t)}function Oo(e){_e(Eo),_e(yo),bo===e&&(bo=null)}function ko(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ao=0,$=null,jo=null,Mo=null,No=!1,Po=!1,Fo=!1,Io=0,Lo=0,Ro=null,zo=0;function Bo(){throw Error(i(321))}function Vo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!kr(e[n],t[n]))return!1;return!0}function Ho(e,t,n,r,i,a){return Ao=a,$=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?ac:oc,Fo=!1,a=n(r,i),Fo=!1,Po&&(a=Wo(t,n,r,i)),Uo(e),a}function Uo(e){R.H=ic;var t=jo!==null&&jo.next!==null;if(Ao=0,Mo=jo=$=null,No=!1,Lo=0,Ro=null,t)throw Error(i(300));e===null||Cc||(e=e.dependencies,e!==null&&da(e)&&(Cc=!0))}function Wo(e,t,n,r){$=e;var a=0;do{if(Po&&(Ro=null),Lo=0,Po=!1,25<=a)throw Error(i(301));if(a+=1,Mo=jo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}R.H=sc,o=t(n,r)}while(Po);return o}function Go(){var e=R.H,t=e.useState()[0];return t=typeof t.then==`function`?Qo(t):t,e=e.useState()[0],(jo===null?null:jo.memoizedState)!==e&&($.flags|=1024),t}function Ko(){var e=Io!==0;return Io=0,e}function qo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Jo(e){if(No){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}No=!1}Ao=0,Mo=jo=$=null,Po=!1,Lo=Io=0,Ro=null}function Yo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mo===null?$.memoizedState=Mo=e:Mo=Mo.next=e,Mo}function Xo(){if(jo===null){var e=$.alternate;e=e===null?null:e.memoizedState}else e=jo.next;var t=Mo===null?$.memoizedState:Mo.next;if(t!==null)Mo=t,jo=e;else{if(e===null)throw $.alternate===null?Error(i(467)):Error(i(310));jo=e,e={memoizedState:jo.memoizedState,baseState:jo.baseState,baseQueue:jo.baseQueue,queue:jo.queue,next:null},Mo===null?$.memoizedState=Mo=e:Mo=Mo.next=e}return Mo}function Zo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qo(e){var t=Lo;return Lo+=1,Ro===null&&(Ro=[]),e=Ha(Ro,e,t),t=$,(Mo===null?t.memoizedState:Mo.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?ac:oc),e}function $o(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Qo(e);if(e.$$typeof===ce)return;if(e.$$typeof===N)return pa(e)}throw Error(i(438,String(e)))}function es(e){var t=null,n=$.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=$.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Zo(),$.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=oe;return t.index++,n}function ts(e,t){return typeof t==`function`?t(e):t}function ns(e){return rs(Xo(),jo,e)}function rs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Ao&f)===f:(Yu&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Da&&(d=!0);else if((Ao&p)===p){u=u.next,p===Da&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,$.lanes|=p,rd|=p;f=u.action,Fo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,$.lanes|=f,rd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!kr(o,e.memoizedState)&&(Cc=!0,d&&(n=Oa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function is(e){var t=Xo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);kr(o,t.memoizedState)||(Cc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function as(e,t,n){var r=$,a=Xo(),o=Ki;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!kr((jo||a).memoizedState,n);if(s&&(a.memoizedState=n,Cc=!0),a=a.queue,As(cs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Mo!==null&&!!(Mo.memoizedState.tag&1),Ts(e?9:8,{destroy:void 0},ss.bind(null,r,a,n,t),null),e){if(r.flags|=2048,qu===null)throw Error(i(349));o||Ao&127||os(r,t,n)}return n}function os(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$.updateQueue,t===null?(t=Zo(),$.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ss(e,t,n,r){t.value=n,t.getSnapshot=r,ls(t)&&us(e)}function cs(e,t,n){return n(function(){ls(t)&&us(e)})}function ls(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!kr(e,n)}catch{return!0}}function us(e){var t=mi(e,2);t!==null&&jd(t,e,2)}function ds(e){var t=Yo();if(typeof e==`function`){var n=e;if(e=n(),Fo){Xe(!0);try{n()}finally{Xe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:e},t}function fs(e,t,n,r){return e.baseState=n,rs(e,jo,typeof r==`function`?r:ts)}function ps(e,t,n,r,a){if(tc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};R.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ms(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ms(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=R.T,o={};o.types=a===null?null:a.types,R.T=o;try{var s=n(i,r),c=R.S;c!==null&&c(o,s),hs(e,t,s)}catch(n){_s(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),R.T=a}}else try{a=n(i,r),hs(e,t,a)}catch(n){_s(e,t,n)}}function hs(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){gs(e,t,n)},function(n){return _s(e,t,n)}):gs(e,t,n)}function gs(e,t,n){t.status=`fulfilled`,t.value=n,vs(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ms(e,n)))}function _s(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,vs(t),t=t.next;while(t!==r)}e.action=null}function vs(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ys(e,t){return t}function bs(e,t){if(Ki){var n=qu.formState;if(n!==null){a:{var r=$;if(Ki){if(Gi){b:{for(var i=Gi,a=Ji;i.nodeType!==8;){if(!a){i=null;break b}if(i=lm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Gi=lm(i.nextSibling),r=i.data===`F!`;break a}}Xi(r)}r=!1}r&&(t=n[0])}}return n=Yo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ys,lastRenderedState:t},n.queue=r,n=Qs.bind(null,$,r),r.dispatch=n,r=ds(!1),a=ec.bind(null,$,!1,r.queue),r=Yo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=ps.bind(null,$,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function xs(e){return Ss(Xo(),jo,e)}function Ss(e,t,n){if(t=rs(e,t,ys)[0],e=ns(ts)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Qo(t)}catch(e){throw e===La?za:e}else r=t;t=Xo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&($.flags|=2048,Ts(9,{destroy:void 0},Cs.bind(null,i,n),null)),[r,a,e]}function Cs(e,t){e.action=t}function ws(e){var t=Xo(),n=jo;if(n!==null)return Ss(t,n,e);Xo(),t=t.memoizedState,n=Xo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=$.updateQueue,t===null&&(t=Zo(),$.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Es(){return Xo().memoizedState}function Ds(e,t,n,r){var i=Yo();$.flags|=e,i.memoizedState=Ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function Os(e,t,n,r){var i=Xo();r=r===void 0?null:r;var a=i.memoizedState.inst;jo!==null&&r!==null&&Vo(r,jo.memoizedState.deps)?i.memoizedState=Ts(t,a,n,r):($.flags|=e,i.memoizedState=Ts(1|t,a,n,r))}function ks(e,t){Ds(8390656,8,e,t)}function As(e,t){Os(2048,8,e,t)}function js(e){$.flags|=4;var t=$.updateQueue;if(t===null)t=Zo(),$.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ms(e){var t=Xo().memoizedState;return js({ref:t,nextImpl:e}),function(){if(Ku&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Ns(e,t){return Os(4,2,e,t)}function Ps(e,t){return Os(4,4,e,t)}function Fs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Is(e,t,n){n=n==null?null:n.concat([e]),Os(4,4,Fs.bind(null,t,e),n)}function Ls(){}function Rs(e,t){var n=Xo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Vo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function zs(e,t){var n=Xo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Vo(t,r[1]))return r[0];if(r=e(),Fo){Xe(!0);try{e()}finally{Xe(!1)}}return n.memoizedState=[r,t],r}function Bs(e,t,n){return n===void 0||Ao&1073741824&&!(Yu&261930)?e.memoizedState=t:(e.memoizedState=n,e=kd(),$.lanes|=e,rd|=e,n)}function Vs(e,t,n,r){return kr(n,t)?n:mo.current===null?!(Ao&106)||Ao&1073741824&&!(Yu&261930)?(Cc=!0,e.memoizedState=n):(e=kd(),$.lanes|=e,rd|=e,t):(e=Bs(e,n,r),kr(e,t)||(Cc=!0),e)}function Hs(e,t,n,r,i){var a=z.p;z.p=a!==0&&8>a?a:8;var o=R.T,s={};s.types=o===null?null:o.types,R.T=s,ec(e,!1,t,n);try{var c=i(),l=R.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?$s(e,t,ja(c,r),Od(e)):$s(e,t,r,Od(e))}catch(n){$s(e,t,{then:function(){},status:`rejected`,reason:n},Od())}finally{z.p=a,o!==null&&s.types!==null&&(o.types=s.types),R.T=o}}function Us(){}function Ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Gs(e).queue;Hs(e,a,t,pe,n===null?Us:function(){return Ks(e),n(r)})}function Gs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:pe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ks(e){var t=Gs(e);t.next===null&&(t=e.alternate.memoizedState),$s(e,t.next.queue,{},Od())}function qs(){return pa(sh)}function Js(){return Xo().memoizedState}function Ys(){return Xo().memoizedState}function Xs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Od();e=io(n);var r=ao(t,e,n);r!==null&&(jd(r,t,n),oo(r,t,n)),t={cache:ba()},e.payload=t;return}t=t.return}}function Zs(e,t,n){var r=Od();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},tc(e)?nc(t,n):(n=pi(e,t,n,r),n!==null&&(jd(n,e,r),rc(n,t,r)))}function Qs(e,t,n){$s(e,t,n,Od())}function $s(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(tc(e))nc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,kr(s,o))return fi(e,t,i,0),qu===null&&di(),!1}catch{}if(n=pi(e,t,i,r),n!==null)return jd(n,e,r),rc(n,t,r),!0}return!1}function ec(e,t,n,r){if(r={lane:2,revertLane:Mf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},tc(e)){if(t)throw Error(i(479))}else t=pi(e,n,r,2),t!==null&&jd(t,e,2)}function tc(e){var t=e.alternate;return e===$||t!==null&&t===$}function nc(e,t){Po=No=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function rc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}var ic={readContext:pa,use:$o,useCallback:Bo,useContext:Bo,useEffect:Bo,useImperativeHandle:Bo,useLayoutEffect:Bo,useInsertionEffect:Bo,useMemo:Bo,useReducer:Bo,useRef:Bo,useState:Bo,useDebugValue:Bo,useDeferredValue:Bo,useTransition:Bo,useSyncExternalStore:Bo,useId:Bo,useHostTransitionStatus:Bo,useFormState:Bo,useActionState:Bo,useOptimistic:Bo,useMemoCache:Bo,useCacheRefresh:Bo,useEffectEvent:Bo},ac={readContext:pa,use:$o,useCallback:function(e,t){return Yo().memoizedState=[e,t===void 0?null:t],e},useContext:pa,useEffect:ks,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ds(4194308,4,Fs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ds(4194308,4,e,t)},useInsertionEffect:function(e,t){Ds(4,2,e,t)},useMemo:function(e,t){var n=Yo();t=t===void 0?null:t;var r=e();if(Fo){Xe(!0);try{e()}finally{Xe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Yo();if(n!==void 0){var i=n(t);if(Fo){Xe(!0);try{n(t)}finally{Xe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Zs.bind(null,$,e),[r.memoizedState,e]},useRef:function(e){var t=Yo();return e={current:e},t.memoizedState=e},useState:function(e){e=ds(e);var t=e.queue,n=Qs.bind(null,$,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ls,useDeferredValue:function(e,t){return Bs(Yo(),e,t)},useTransition:function(){var e=ds(!1);return e=Hs.bind(null,$,e.queue,!0,!1),Yo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=$,a=Yo();if(Ki){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),qu===null)throw Error(i(349));Yu&127||os(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ks(cs.bind(null,r,o,e),[e]),r.flags|=2048,Ts(9,{destroy:void 0},ss.bind(null,r,o,n,t),null),n},useId:function(){var e=Yo(),t=qu.identifierPrefix;if(Ki){var n=Ri,r=Li;n=(r&~(1<<32-Ze(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Io++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=zo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:qs,useFormState:bs,useActionState:bs,useOptimistic:function(e){var t=Yo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ec.bind(null,$,!0,n),n.dispatch=t,[e,t]},useMemoCache:es,useCacheRefresh:function(){return Yo().memoizedState=Xs.bind(null,$)},useEffectEvent:function(e){var t=Yo(),n={impl:e};return t.memoizedState=n,function(){if(Ku&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},oc={readContext:pa,use:$o,useCallback:Rs,useContext:pa,useEffect:As,useImperativeHandle:Is,useInsertionEffect:Ns,useLayoutEffect:Ps,useMemo:zs,useReducer:ns,useRef:Es,useState:function(){return ns(ts)},useDebugValue:Ls,useDeferredValue:function(e,t){return Vs(Xo(),jo.memoizedState,e,t)},useTransition:function(){var e=ns(ts)[0],t=Xo().memoizedState;return[typeof e==`boolean`?e:Qo(e),t]},useSyncExternalStore:as,useId:Js,useHostTransitionStatus:qs,useFormState:xs,useActionState:xs,useOptimistic:function(e,t){return fs(Xo(),jo,e,t)},useMemoCache:es,useCacheRefresh:Ys,useEffectEvent:Ms},sc={readContext:pa,use:$o,useCallback:Rs,useContext:pa,useEffect:As,useImperativeHandle:Is,useInsertionEffect:Ns,useLayoutEffect:Ps,useMemo:zs,useReducer:is,useRef:Es,useState:function(){return is(ts)},useDebugValue:Ls,useDeferredValue:function(e,t){var n=Xo();return jo===null?Bs(n,e,t):Vs(n,jo.memoizedState,e,t)},useTransition:function(){var e=is(ts)[0],t=Xo().memoizedState;return[typeof e==`boolean`?e:Qo(e),t]},useSyncExternalStore:as,useId:Js,useHostTransitionStatus:qs,useFormState:ws,useActionState:ws,useOptimistic:function(e,t){var n=Xo();return jo===null?(n.baseState=e,[e,n.queue.dispatch]):fs(n,jo,e,t)},useMemoCache:es,useCacheRefresh:Ys,useEffectEvent:Ms};function cc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var lc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Od(),i=io(r);i.payload=t,n!=null&&(i.callback=n),t=ao(e,i,r),t!==null&&(jd(t,e,r),oo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Od(),i=io(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ao(e,i,r),t!==null&&(jd(t,e,r),oo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Od(),r=io(n);r.tag=2,t!=null&&(r.callback=t),t=ao(e,r,n),t!==null&&(jd(t,e,n),oo(t,e,n))}};function uc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Ar(n,r)||!Ar(i,a):!0}function dc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&lc.enqueueReplaceState(t,t.state,null)}function fc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function pc(e){si(e)}function mc(e){console.error(e)}function hc(e){si(e)}function gc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function _c(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function vc(e,t,n){return n=io(n),n.tag=3,n.payload={element:null},n.callback=function(){gc(e,t)},n}function yc(e){return e=io(e),e.tag=3,e}function bc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){_c(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){_c(t,n,r),typeof i!=`function`&&(hd===null?hd=new Set([this]):hd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function xc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ua(t,n,a,!0),n=yo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return bo===null?Ud():n.alternate===null&&nd===0&&(nd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ba?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ff(e,r,a)),!1;case 22:return n.flags|=65536,r===Ba?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),ff(e,r,a)),!1}throw Error(i(435,n.tag))}return ff(e,r,a),Ud(),!1}if(Ki)return t=yo.current,t===null?(r!==Yi&&(t=Error(i(423),{cause:r}),na(ki(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ki(r,n),a=vc(e.stateNode,r,a),so(e,a),nd!==4&&(nd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Yi&&(e=Error(i(422),{cause:r}),na(ki(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ki(o,n),cd===null?cd=[o]:cd.push(o),nd!==4&&(nd=2),t===null)return!0;r=ki(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=vc(n.stateNode,r,e),so(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(hd===null||!hd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=yc(a),bc(a,e,n,r),so(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Sc=Error(i(461)),Cc=!1;function wc(e,t,n,r){t.child=e===null?eo(t,null,n,r):$a(t,e.child,n,r)}function Tc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return fa(t),r=Ho(e,t,n,o,a,i),s=Ko(),e!==null&&!Cc?(qo(e,t,i),$c(e,t,i)):(Ki&&s&&Vi(t),t.flags|=1,wc(e,t,r,i),t.child)}function Ec(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!bi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Dc(e,t,a,r,i)):(e=Ci(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!el(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Ar:n,n(o,r)&&e.ref===t.ref)return $c(e,t,i)}return t.flags|=1,e=xi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Dc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Ar(a,r)&&e.ref===t.ref){if(Cc=!1,t.pendingProps=r=a,el(e,i))e.flags&131072&&(Cc=!0);else return t.lanes=e.lanes,$c(e,t,i)}}return Fc(e,t,n,r,i)}function Oc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fa(t,a===null?null:a.cachePool),a===null?_o():go(t,a),Co(t);else return r=t.lanes=536870912,Ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Fa(t,null),_o(),wo()):(Fa(t,a.cachePool),go(t,a),wo(),t.memoizedState=null);return wc(e,t,i,n),t.child}function kc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ac(e,t,n,r,i){var a=Pa();return a=a===null?null:{parent:ya._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Fa(t,null),_o(),Co(t),e!==null&&ua(e,t,r,!0),t.childLanes=i,null}function jc(e,t){return t=Wc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Mc(e,t,n){return $a(t,e.child,null,n),e=jc(t,t.pendingProps),e.flags|=2,To(t),t.memoizedState=null,e}function Nc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Ki){if(r.mode===`hidden`)return e=jc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},kc(null,e);if(So(t),(e=Gi)?(e=am(e,Ji),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Xi(t);return t.lanes=536870912,null}return jc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(So(t),a){if(t.flags&256)t.flags&=-257,t=Mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Cc||ua(e,t,n,!1),a=(n&e.childLanes)!==0,Cc||a){if(mo.current===null){if(r=qu,r!==null&&(s=st(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,mi(e,s),jd(r,e,s),Sc;Ud()}t=Mc(e,t,n)}else e=o.treeContext,Gi=lm(s.nextSibling),Wi=t,Ki=!0,qi=null,Ji=!1,e!==null&&Ui(t,e),t=jc(t,r),t.flags|=134221824;return t}return e=xi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Pc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Fc(e,t,n,r,i){return fa(t),n=Ho(e,t,n,r,void 0,i),r=Ko(),e!==null&&!Cc?(qo(e,t,i),$c(e,t,i)):(Ki&&r&&Vi(t),t.flags|=1,wc(e,t,n,i),t.child)}function Ic(e,t,n,r,i,a){return fa(t),t.updateQueue=null,n=Wo(t,r,n,i),Uo(e),r=Ko(),e!==null&&!Cc?(qo(e,t,a),$c(e,t,a)):(Ki&&r&&Vi(t),t.flags|=1,wc(e,t,n,a),t.child)}function Lc(e,t,n,r,i){if(fa(t),t.stateNode===null){var a=_i,o=n.contextType;typeof o==`object`&&o&&(a=pa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=lc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},no(t),o=n.contextType,a.context=typeof o==`object`&&o?pa(o):_i,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(cc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&lc.enqueueReplaceState(a,a.state,null),uo(t,r,a,i),lo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=fc(n,s);a.props=c;var l=a.context,u=n.contextType;o=_i,typeof u==`object`&&u&&(o=pa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&dc(t,a,r,o),to=!1;var f=t.memoizedState;a.state=f,uo(t,r,a,i),lo(),l=t.memoizedState,s||f!==l||to?(typeof d==`function`&&(cc(t,n,d,r),l=t.memoizedState),(c=to||uc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ro(e,t),o=t.memoizedProps,u=fc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=_i,typeof l==`object`&&l&&(c=pa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&dc(t,a,r,c),to=!1,f=t.memoizedState,a.state=f,uo(t,r,a,i),lo();var p=t.memoizedState;o!==d||f!==p||to||e!==null&&e.dependencies!==null&&da(e.dependencies)?(typeof s==`function`&&(cc(t,n,s,r),p=t.memoizedState),(u=to||uc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&da(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Pc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=$a(t,e.child,null,i),t.child=$a(t,null,n,i)):wc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=$c(e,t,i),e}function Rc(e,t,n,r){return ea(),t.flags|=256,wc(e,t,n,r),t.child}var zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Bc(e){return{baseLanes:e,cachePool:Ia()}}function Vc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=od),e}function Hc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Eo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(Ki){if(i?xo(t):wo(),(e=Gi)?(e=am(e,Ji),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ii===null?null:{id:Li,overflow:Ri},retryLane:536870912,hydrationErrors:null},n=Ei(e),n.return=t,t.child=n,Wi=t,Gi=null)):e=null,e===null)throw Xi(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(wo(),i=t.mode,a=Wc({mode:`hidden`,children:a},i),r=wi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Bc(n),r.childLanes=Vc(e,o,n),t.memoizedState=zc,kc(null,r)):(xo(t),Uc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return Kc(e,t,a,o,r,c,s,n)}return i?(wo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=xi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=wi(i,a,n,null),i.flags|=2):i=xi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,kc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Bc(n):(a=i.cachePool,a===null?a=Ia():(s=ya._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Vc(e,o,n),t.memoizedState=zc,kc(e.child,r)):(xo(t),n=e.child,e=n.sibling,n=xi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Uc(e,t){return t=Wc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Wc(e,t){return e=yi(22,e,null,t),e.lanes=0,e}function Gc(e,t,n){return $a(t,e.child,null,n),e=Uc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Kc(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(xo(t),t.flags&=-257,Gc(e,t,c)):t.memoizedState===null?(wo(),o=a.fallback,s=t.mode,a=Wc({mode:`visible`,children:a.children},s),o=wi(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,$a(t,e.child,null,c),a=t.child,a.memoizedState=Bc(c),a.childLanes=Vc(e,r,c),t.memoizedState=zc,kc(null,a)):(wo(),t.child=e.child,t.flags|=128,null);if(xo(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,na({value:a,source:null,stack:null})),Gc(e,t,c)}if(Cc||ua(e,t,c,!1),r=(c&e.childLanes)!==0,Cc||r){if(mo.current!==null)return Gc(e,t,c);if(r=qu,r!==null&&(a=st(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,mi(e,a),jd(r,e,a),Sc;return om(o)||Ud(),Gc(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,Gi=lm(o.nextSibling),Wi=t,Ki=!0,qi=null,Ji=!1,e!==null&&Ui(t,e),t=Uc(t,a.children),t.flags|=134221824,t)}function qc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ca(e.return,t,n)}function Jc(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&ko(n)===null&&(t=e),e=e.sibling}return t}function Yc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Xc(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function Zc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Eo.current;if(t.flags&128)return Do(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Do(t,o),i===`backwards`&&e!==null?(Xc(e),wc(e,t,r,n),Xc(e)):wc(e,t,r,n),r=Ki?Ni:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qc(e,n,t);else if(e.tag===19)qc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=Jc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,Xc(t)),Yc(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ko(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Yc(t,!0,n,null,a,r);break;case`together`:Yc(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=Jc(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Yc(t,!1,i,n,a,r)}return t.child}function Qc(e,t,n){var r=t.pendingProps;return oa(t,t.type,r.value),wc(e,t,r.children,n),t.child}function $c(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),rd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ua(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=xi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=xi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function el(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&da(e)))}function tl(e,t,n){switch(t.tag){case 3:Ce(t,t.stateNode.containerInfo),oa(t,ya,e.memoizedState.cache),ea();break;case 27:case 5:Te(t);break;case 4:Ce(t,t.stateNode.containerInfo);break;case 10:oa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,So(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return xo(t),t.flags|=128,null;r=ua(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Hc(e,t,n):(xo(t),e=$c(e,t,n),e===null?null:e.sibling)}xo(t);break;case 19:if(t.flags&128)return Zc(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ua(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Zc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Do(t,Eo.current),r)break;return null;case 22:return t.lanes=0,Oc(e,t,n,t.pendingProps);case 24:oa(t,ya,e.memoizedState.cache)}return $c(e,t,n)}function nl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Cc=!0;else{if(!el(e,n)&&!(t.flags&128))return Cc=!1,tl(e,t,n);Cc=!!(e.flags&131072)}}else Cc=!1,Ki&&t.flags&1048576&&Bi(t,Ni,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ua(t.elementType),t.type=e,typeof e==`function`)bi(e)?(r=fc(e,r),t.tag=1,t=Lc(null,t,e,r,n)):(t.tag=0,t=Fc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ne){t.tag=11,t=Tc(null,t,e,r,n);break a}if(a===F){t.tag=14,t=Ec(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=Qc(null,t,n);break a}}throw t=fe(e)||e,Error(i(306,t,``))}}return t;case 0:return Fc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=fc(r,t.pendingProps),Lc(e,t,r,a,n);case 3:a:{if(Ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ro(e,t),uo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,oa(t,ya,r),r!==o.cache&&la(t,[ya],n,!0),lo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Rc(e,t,r,n);break a}if(r!==a){a=ki(Error(i(424)),t),na(a),t=Rc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Gi=lm(e.firstChild),Wi=t,Ki=!0,qi=null,Ji=!0,n=eo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ea(),r===a){t=$c(e,t,n);break a}wc(e,t,r,n)}t=t.child}return t;case 26:return Pc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ki||(t.stateNode=fp(t.type,t.pendingProps,xe.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Te(t),e===null&&Ki&&(r=t.stateNode=hm(t.type,t.pendingProps,xe.current),Wi=t,Ji=!0,a=Gi,Sp(t.type)?(um=a,Gi=lm(r.firstChild)):Gi=a),wc(e,t,t.pendingProps.children,n),Pc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ki&&((a=r=Gi)&&(r=rm(r,t.type,t.pendingProps,Ji),r===null?a=!1:(t.stateNode=r,Wi=t,Gi=lm(r.firstChild),Ji=!1,a=!0)),a||Xi(t)),Te(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Ho(e,t,Go,null,null,n),sh._currentValue=a),Pc(e,t),wc(e,t,r,n),t.child;case 6:return e===null&&Ki&&((e=n=Gi)&&(n=im(n,t.pendingProps,Ji),n===null?e=!1:(t.stateNode=n,Wi=t,Gi=null,e=!0)),e||Xi(t)),null;case 13:return Hc(e,t,n);case 4:return Ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=$a(t,null,r,n):wc(e,t,r,n),t.child;case 11:return Tc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Pc(e,t),wc(e,t,r,n),t.child;case 8:return wc(e,t,t.pendingProps.children,n),t.child;case 12:return wc(e,t,t.pendingProps.children,n),t.child;case 10:return Qc(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,fa(t),a=pa(a),r=r(a),t.flags|=1,wc(e,t,r,n),t.child;case 14:return Ec(e,t,t.type,t.pendingProps,n);case 15:return Dc(e,t,t.type,t.pendingProps,n);case 19:return Zc(e,t,n);case 31:return Nc(e,t,n);case 22:return Oc(e,t,n,t.pendingProps);case 24:return fa(t),r=pa(ya),e===null?(a=Pa(),a===null&&(a=qu,o=ba(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},no(t),oa(t,ya,a)):((e.lanes&n)!==0&&(ro(e,t),uo(t,null,null,n),lo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,oa(t,ya,r),r!==a.cache&&la(t,[ya],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),oa(t,ya,r))),wc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:Ki&&Vi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Pc(e,t),wc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function rl(e){e.flags|=4}function il(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Bd())e.flags|=8192;else throw Wa=Ba,Ra}}else e.flags&=-16777217}function al(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Bd())e.flags|=8192;else throw Wa=Ba,Ra}}function ol(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:nt(),e.lanes|=t,sd|=t)}function sl(e,t){if(!Ki)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function cl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ll(e,t,n){var r=t.pendingProps;switch(Hi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cl(t),null;case 1:return cl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),sa(ya),we(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&($i(t)?rl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ta())),cl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(rl(t),o===null?(cl(t),il(t,a,null,r,n)):(cl(t),al(t,o))):o?o===e.memoizedState?(cl(t),t.flags&=-16777217):(rl(t),cl(t),al(t,o)):(e=e.memoizedProps,e!==r&&rl(t),cl(t),il(t,a,e,r,n)),null;case 27:if(Ee(t),n=xe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&rl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return cl(t),t.subtreeFlags&=-33554433,null}e=ye.current,$i(t)?Zi(t,e):(e=hm(a,r,n),t.stateNode=e,rl(t))}return cl(t),t.subtreeFlags&=-33554433,null;case 5:if(Ee(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&rl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return cl(t),t.subtreeFlags&=-33554433,null}if(o=ye.current,$i(t))Zi(t,o);else{var s=lp(xe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[J]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&rl(t)}}return cl(t),t.subtreeFlags&=-33554433,il(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&rl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=xe.current,$i(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Wi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[J]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||Xi(t,!0)}else e=lp(e).createTextNode(r),e[J]=t,t.stateNode=e}return cl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=$i(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[J]=t}else ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;cl(t),e=!1}else n=ta(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(To(t),t):(To(t),null);if(t.flags&128)throw Error(i(558))}return cl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=$i(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[J]=t}else ea(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;cl(t),a=!1}else a=ta(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(To(t),t):(To(t),null)}return To(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ol(t,t.updateQueue),cl(t),null);case 4:return we(),e===null&&Uf(t.stateNode.containerInfo),t.flags|=67108864,cl(t),null;case 10:return sa(t.type),cl(t),null;case 19:if(Oo(t),r=t.memoizedState,r===null)return cl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)sl(r,!1);else{if(nd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=ko(e),o!==null){for(t.flags|=128,sl(r,!1),e=o.updateQueue,t.updateQueue=e,ol(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Si(n,e),n=n.sibling;return Do(t,Eo.current&1|2),Ki&&zi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ze()>pd&&(t.flags|=128,a=!0,sl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=ko(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,ol(t,e),sl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!Ki)return cl(t),null}else 2*ze()-r.renderingStartTime>pd&&n!==536870912&&(t.flags|=128,a=!0,sl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ze(),e.sibling=null,o=Eo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||Ki?Do(t,o):(n=o,ve(yo,t),ve(Eo,n),bo===null&&(bo=t)),Ki&&zi(t,r.treeForkCount),e}return cl(t),null;case 22:case 23:return To(t),vo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(cl(t),t.subtreeFlags&6&&(t.flags|=8192)):cl(t),n=t.updateQueue,n!==null&&ol(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&_e(Na),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),sa(ya),cl(t),null;case 25:return null;case 30:return t.flags|=33554432,cl(t),null}throw Error(i(156,t.tag))}function ul(e,t){switch(Hi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return sa(ya),we(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Ee(t),null;case 31:if(t.memoizedState!==null){if(To(t),t.alternate===null)throw Error(i(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(To(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ea()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return we(),null;case 10:return sa(t.type),null;case 22:case 23:return To(t),vo(),e!==null&&_e(Na),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return sa(ya),null;case 25:return null;default:return null}}function dl(e,t){switch(Hi(t),t.tag){case 3:sa(ya),we();break;case 26:case 27:case 5:Ee(t);break;case 4:we();break;case 31:t.memoizedState!==null&&To(t);break;case 13:To(t);break;case 19:Oo(t);break;case 10:sa(t.type);break;case 22:case 23:To(t),vo(),e!==null&&_e(Na);break;case 24:sa(ya)}}function fl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){df(t,t.return,e)}}function pl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){df(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){df(t,t.return,e)}}function ml(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{po(t,n)}catch(t){df(e,e.return,t)}}}function hl(e,t,n){n.props=fc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){df(e,t,n)}}function gl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=ii(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);m(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){df(e,t,n)}}function _l(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){df(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){df(e,t,n)}else n.current=null}}function vl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function yl(e){for(var t=e.return;t!==null&&(Sl(t)&&em(e.stateNode,t.stateNode),!xl(t));)t=t.return}function bl(e){for(var t=e.return;t!==null&&(Sl(t)&&tm(e.stateNode,t.stateNode),!xl(t));)t=t.return}function xl(e){return e.tag===5||e.tag===3||e.tag===27}function Sl(e){return e&&e.tag===7&&e.stateNode!==null}function Cl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){df(e,e.return,t)}}function wl(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[pt]=t}catch(t){df(e,e.return,t)}}function Tl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function El(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=on)),vl(e,r),Pt=!0;else if(i!==4&&(i===27&&(vl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Dl(e,t,n,r),e=e.sibling;e!==null;)Dl(e,t,n,r),e=e.sibling}function Ol(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),vl(e,r),Pt=!0;else if(i!==4&&(i===27&&(vl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Ol(e,t,n,r),e=e.sibling;e!==null;)Ol(e,t,n,r),e=e.sibling}function kl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[J]=e,t[pt]=n}catch(t){df(e,e.return,t)}}var Al=!1,jl=null;function Ml(e){(e.tag===30||e.subtreeFlags&33554432)&&(Al=!0)}var Nl=null;function Pl(){var e=Nl;return Nl=null,e}var Fl=0;function Il(e,t,n,r,i){return Fl=0,Ll(e.child,t,n,r,i)}function Ll(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Al=!0,Tp(o,Fl===0?t:t+`_`+Fl,n),Fl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Ll(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Rl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Rl(e.child,t)),e=e.sibling}function zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=oi(t.default,t.share),t!==`none`&&(Il(e,n,t,null,!1)||Rl(e.child,!1))}e=e.sibling}}function Bl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=ii(r,n),a=oi(r.default,n.paired?r.share:r.enter);a===`none`?zl(e):Il(e,i,a,null,!1)?(zl(e),n.paired||t||Ad(e,r.onEnter)):Rl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Bl(e,t),e=e.sibling;else zl(e)}function Vl(e){if(jl!==null&&jl.size!==0){var t=jl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=oi(n.default,n.share);if(a!==`none`&&(Il(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Ad(e,n.onShare)):Rl(e.child,!1)),t.delete(r),t.size===0)break}}}Vl(e)}e=e.sibling}}}function Hl(e){if(e.tag===30){var t=e.memoizedProps,n=ii(t,e.stateNode),r=jl===null?void 0:jl.get(n),i=oi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Il(e,n,i,null,!1)?r===void 0?Ad(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,jl.delete(n),Ad(e,t.onShare)):Rl(e.child,!1)),jl!==null&&Vl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Hl(e),e=e.sibling;else jl!==null&&Vl(e)}function Ul(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=ii(t,e.stateNode);t=oi(t.default,t.update),e.flags&=-5,t!==`none`&&Il(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Ul(e);e=e.sibling}}function Wl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Rl(e.child,!1))}Wl(e)}e=e.sibling}}function Gl(e){if(e.tag===30)e.stateNode.paired=null,Rl(e.child,!1),Wl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Gl(e),e=e.sibling;else Wl(e)}function Kl(e){for(e=e.child;e!==null;)e.tag===30?Rl(e.child,!1):e.subtreeFlags&33554432&&Kl(e),e=e.sibling}function ql(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Fl<a.length){var l=a[Fl],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Fl===0?n:n+`_`+Fl,i),s&&e.flags&4||(Nl===null&&(Nl=[]),Nl.push(c,Fl===0?r:r+`_`+Fl,t.memoizedProps)),Fl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:ql(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function Jl(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=ii(n,r),a=oi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Fl=0,i=ql(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Ad(e,n.onUpdate))}else e.subtreeFlags&33554432&&Jl(e,t);e=e.sibling}}var Yl=!1,Xl=!1,Zl=!1,Ql=!1,$l=typeof WeakSet==`function`?WeakSet:Set,eu=null,tu=!1,nu=!1,ru=!1,iu=!1;function au(e,t,n){if(e=e.containerInfo,sp=gh,e=Fr(e),Ir(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,eu=t,t=n?9270:1024;eu!==null;){if(e=eu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Hl(r[a]);if(e.alternate===null&&e.flags&2)n&&Ml(e),ou(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Hl(r),ou(n);continue}if(r!==null&&r.memoizedState!==null){n&&Ml(e),ou(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,eu=r):(n&&Ul(e),ou(n))}}jl=null}function ou(e){for(;eu!==null;){var t=eu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=fc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){df(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=ii(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=oi(a.default,a.update),a!==`none`&&Il(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,eu=r;break}eu=t.return}}function su(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Du(e,n),r&4&&fl(5,n);break;case 1:if(Du(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){df(n,n.return,e)}else{var i=fc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){df(n,n.return,e)}}}r&64&&ml(n),r&512&&gl(n,n.return);break;case 3:if(Du(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{po(e,t)}catch(e){df(n,n.return,e)}}break;case 27:t===null&&r&4&&kl(n);case 26:case 5:Du(e,n),t===null&&r&4&&Cl(n),r&512&&gl(n,n.return);break;case 12:Du(e,n);break;case 31:Du(e,n),r&4&&gu(e,n);break;case 13:Du(e,n),r&4&&_u(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||Yl,!r){var a=t!==null&&t.memoizedState!==null||Xl;t=Yl,i=Xl,Yl=r,(Xl=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),ku(e,n,r)):Du(e,n),Yl=t,Xl=i}break;case 30:Du(e,n),r&512&&gl(n,n.return);break;case 7:r&512&&gl(n,n.return);default:Du(e,n)}}function cu(e,t){for(e=e.child;e!==null;)lu(e,t),e=e.sibling}function lu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){df(e,e.return,t)}uu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Pt=!0}catch(t){df(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){df(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&cu(e,t);break;default:cu(e,t)}}function uu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:lu(n,r);break a;case 22:n.memoizedState===null&&uu(n,r);break a;default:uu(n,r)}}e=e.sibling}}function du(e){var t=e.alternate;t!==null&&(e.alternate=null,du(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&yt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var fu=null,pu=!1;function mu(e,t,n){for(n=n.child;n!==null;)hu(e,t,n),n=n.sibling}function hu(e,t,n){if(Ye&&typeof Ye.onCommitFiberUnmount==`function`)try{Ye.onCommitFiberUnmount(Je,n)}catch{}switch(n.tag){case 26:Xl||_l(n,t),mu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Xl&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Xl||_l(n,t),bl(n);var r=fu,i=pu;Sp(n.type)&&(fu=n.stateNode,pu=!1),mu(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),fu=r,pu=i;break;case 5:Xl||_l(n,t),bl(n);case 6:if(n.tag===6&&bl(n),r=fu,i=pu,fu=null,mu(e,t,n),fu=r,pu=i,fu!==null){if(pu)try{(fu.nodeType===9?fu.body:fu.nodeName===`HTML`?fu.ownerDocument.body:fu).removeChild(n.stateNode),Pt=!0}catch(e){df(n,t,e)}else try{fu.removeChild(n.stateNode),Pt=!0}catch(e){df(n,t,e)}}break;case 18:fu!==null&&(pu?(e=fu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(fu,n.stateNode));break;case 4:r=fu,i=pu,fu=n.stateNode.containerInfo,pu=!0,mu(e,t,n),fu=r,pu=i;break;case 0:case 11:case 14:case 15:pl(2,n,t),Xl||pl(4,n,t),mu(e,t,n);break;case 1:Xl||(_l(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&hl(n,t,r)),mu(e,t,n);break;case 21:mu(e,t,n);break;case 22:Xl=(r=Xl)||n.memoizedState!==null,mu(e,t,n),Xl=r;break;case 30:_l(n,t),mu(e,t,n);break;case 7:Xl||_l(n,t),mu(e,t,n);break;default:mu(e,t,n)}}function gu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){df(t,t.return,e)}}}function _u(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){df(t,t.return,e)}}function vu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $l),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $l),t;default:throw Error(i(435,e.tag))}}function yu(e,t){var n=vu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=gf.bind(null,e,t);t.then(r,r)}})}function bu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){fu=l.stateNode,pu=!1;break a}break;case 5:fu=l.stateNode,pu=!1;break a;case 3:case 4:fu=l.stateNode.containerInfo,pu=!0;break a}l=l.return}if(fu===null)throw Error(i(160));hu(s,c,o),fu=null,pu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Su(t,e,n),t=t.sibling}var xu=null;function Su(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}bu(t,e,n),Cu(e),a&4&&(pl(3,e,e.return),fl(3,e),pl(5,e,e.return));break;case 1:bu(t,e,n),Cu(e),a&512&&(Xl||r===null||_l(r,r.return)),a&64&&Yl&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=xu,bu(t,e,n),Cu(e),a&512&&(Xl||r===null||_l(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(Yl)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[vt]||r[J]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[J]=e,wt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[J]=e,wt(r),t=r}e.stateNode=t}}else Yl||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&wl(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||Xl||t.parentNode.removeChild(t)):a.count--,n===null?Yl||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:bu(t,e,n),Cu(e),a&512&&(Xl||r===null||_l(r,r.return)),r!==null&&a&4&&wl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=Zl,Zl=!1,bu(t,e,n),Zl=o,Cu(e),a&512&&(Xl||r===null||_l(r,r.return)),e.flags&32){t=e.stateNode;try{Qt(t,``),Pt=!0}catch(t){df(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,wl(e,t,r===null?t:r.memoizedProps)),a&1024&&(Ql=!0);break;case 6:if(bu(t,e,n),Cu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Pt=!0}catch(t){df(e,e.return,t)}}break;case 3:if(Pt=!1,Wm=null,o=xu,xu=bm(t.containerInfo),bu(t,e,n),xu=o,Cu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){df(e,e.return,t)}Ql&&(Ql=!1,wu(e)),Pt=!1;break;case 4:a=Zl,Zl=Yl,r=Ft(),o=xu,xu=bm(e.stateNode.containerInfo),bu(t,e,n),Cu(e),xu=o,Pt&&nu&&(ru=!0),Pt=r,Zl=a;break;case 12:bu(t,e,n),Cu(e);break;case 31:bu(t,e,n),Cu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 13:bu(t,e,n),Cu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(dd=ze()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=Yl,l=Xl,u=Zl;Yl=c||o,Zl=u||o,Xl=l||s,bu(t,e,n),Xl=l,Zl=u,Yl=c,Cu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||Yl||Xl||(t=s||Xl,n=Yl,r=Xl,Yl=o||Yl,Xl=t,Ou(e,2),Yl=n,Xl=r),!o&&Zl||cu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,yu(e,n))));break;case 19:bu(t,e,n),Cu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,yu(e,t)));break;case 30:a&512&&(Xl||r===null||_l(r,r.return)),a=Ft(),o=nu,s=(n&335544064)===n,c=e.memoizedProps,nu=s&&oi(c.default,c.update)!==`none`,bu(t,e,n),Cu(e),s&&r!==null&&Pt&&(e.flags|=4),nu=o,Pt=a;break;case 21:break;case 7:a&512&&(Xl||r===null||_l(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:bu(t,e,n),Cu(e)}}function Cu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Tl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Sl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(xl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Ol(e,El(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(Qt(l,``),n.flags&=-33),Ol(e,El(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Dl(e,El(e),u,s);break;default:throw Error(i(161))}}catch(t){df(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function wu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;wu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Tu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Eu(t,e),t=t.sibling;else Jl(t,!1)}function Eu(e,t){var n=e.alternate;if(n===null)Bl(e,!1);else switch(e.tag){case 3:if(iu=tu=!1,Pl(),Tu(t,e),!tu&&!ru){if(e=Nl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),iu=!0}Nl=null;break;case 5:Tu(t,e);break;case 4:r=tu,tu=!1,Tu(t,e),tu&&(ru=!0),tu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Tu(t,e):Bl(e,!1));break;case 30:r=tu,i=Pl(),tu=!1,Tu(t,e),tu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=ii(a,o),o=ii(n.memoizedProps,o);var s=oi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Fl=0,t=ql(e,n,t,o,s,a,!0),Fl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Ad(e,e.memoizedProps.onUpdate),Nl=i):i!==null&&(i.push.apply(i,Nl),Nl=i),tu=e.flags&32?!0:r;break;default:Tu(t,e)}}function Du(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)su(e,t.alternate,t),t=t.sibling}function Ou(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:pl(4,n,n.return),Ou(n,r);break;case 1:_l(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&hl(n,n.return,i),Ou(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:_l(n,n.return),n.tag!==5&&n.tag!==27||bl(n),Ou(n,r);break;case 6:bl(n);break;case 26:_l(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||Xl||i.parentNode.removeChild(i),Ou(n,r);break;case 22:n.memoizedState===null&&Ou(n,r);break;case 30:_l(n,n.return),Ou(n,r);break;case 7:_l(n,n.return);default:Ou(n,r)}e=e.sibling}}function ku(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:ku(i,a,n),fl(4,a);break;case 1:if(ku(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){df(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)fo(l[i],c)}catch(e){df(r,r.return,e)}}s&&o&64&&ml(a),gl(a,a.return);break;case 27:n&2&&kl(a);case 5:a.tag!==5&&a.tag!==27||yl(a),ku(i,a,n),s&&r===null&&o&4&&Cl(a),gl(a,a.return);break;case 6:yl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||Yl||Km(bm(c.ownerDocument),a.type,c),ku(i,a,n),s&&r===null&&o&4&&Cl(a),gl(a,a.return);break;case 12:ku(i,a,n);break;case 31:ku(i,a,n),s&&o&4&&gu(i,a);break;case 13:ku(i,a,n),s&&o&4&&_u(i,a);break;case 22:a.memoizedState===null&&ku(i,a,n),gl(a,a.return);break;case 30:ku(i,a,n),gl(a,a.return);break;case 7:gl(a,a.return);default:ku(i,a,n)}t=t.sibling}}function Au(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&xa(n))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&xa(e))}function Mu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Nu(e,t,n,r),t=t.sibling;else i&&Kl(t)}function Nu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Gl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Mu(e,t,n,r),a&2048&&fl(9,t);break;case 1:Mu(e,t,n,r);break;case 3:Mu(e,t,n,r),i&&iu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&xa(a)));break;case 12:if(a&2048){Mu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){df(t,t.return,e)}}else Mu(e,t,n,r);break;case 31:Mu(e,t,n,r);break;case 13:Mu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Gl(t),o._visibility&2?Mu(e,t,n,r):(o._visibility|=2,Pu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Gl(s),o._visibility&2?Mu(e,t,n,r):Fu(e,t)),a&2048&&Au(s,t);break;case 24:Mu(e,t,n,r),a&2048&&ju(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Rl(a.child,!0),Rl(t.child,!0))),Mu(e,t,n,r);break;default:Mu(e,t,n,r)}}function Pu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Pu(a,o,s,c,i),fl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Pu(a,o,s,c,i)):u._visibility&2?Pu(a,o,s,c,i):Fu(a,o),i&&l&2048&&Au(o.alternate,o);break;case 24:Pu(a,o,s,c,i),i&&l&2048&&ju(o.alternate,o);break;default:Pu(a,o,s,c,i)}t=t.sibling}}function Fu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Fu(n,r),i&2048&&Au(r.alternate,r);break;case 24:Fu(n,r),i&2048&&ju(r.alternate,r);break;default:Fu(n,r)}t=t.sibling}}var Iu=8192;function Lu(e,t,n){if(e.subtreeFlags&Iu)for(e=e.child;e!==null;)Ru(e,t,n),e=e.sibling}function Ru(e,t,n){switch(e.tag){case 26:Lu(e,t,n),e.flags&Iu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,xu,e.memoizedState,e.memoizedProps));break;case 5:Lu(e,t,n),e.flags&Iu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=xu;xu=bm(e.stateNode.containerInfo),Lu(e,t,n),xu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Iu,Iu=16777216,Lu(e,t,n),Iu=r):Lu(e,t,n));break;case 30:if((e.flags&Iu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,jl===null&&(jl=new Map),jl.set(r,i)}Lu(e,t,n);break;default:Lu(e,t,n)}}function zu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Bu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];eu=r,Uu(r,e)}zu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Vu(e),e=e.sibling}function Vu(e){switch(e.tag){case 0:case 11:case 15:Bu(e),e.flags&2048&&pl(9,e,e.return);break;case 3:Bu(e);break;case 12:Bu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Hu(e)):Bu(e);break;default:Bu(e)}}function Hu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];eu=r,Uu(r,e)}zu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:pl(8,t,t.return),Hu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Hu(t));break;default:Hu(t)}e=e.sibling}}function Uu(e,t){for(;eu!==null;){var n=eu;switch(n.tag){case 0:case 11:case 15:pl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:xa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,eu=r;else a:for(n=e;eu!==null;){r=eu;var i=r.sibling,a=r.return;if(du(r),r===n){eu=null;break a}if(i!==null){i.return=a,eu=i;break a}eu=a}}}var Wu={getCacheForType:function(e){var t=pa(ya),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return pa(ya).controller.signal}},Gu=typeof WeakMap==`function`?WeakMap:Map,Ku=0,qu=null,Ju=null,Yu=0,Xu=0,Zu=null,Qu=!1,$u=!1,ed=!1,td=0,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=null,ld=null,ud=!1,dd=0,fd=0,pd=1/0,md=null,hd=null,gd=0,_d=null,vd=null,yd=0,bd=0,xd=null,Sd=null,Cd=null,wd=null,Td=null,Ed=0,Dd=null;function Od(){return Ku&2&&Yu!==0?Yu&-Yu:R.T===null?ut():Mf()}function kd(){if(od===0){if(!(Yu&536870912)||Ki){var e=H;H<<=1,!(H&3932160)&&(H=262144),od=e}else od=536870912}return e=yo.current,e!==null&&(e.flags|=32),od}function Ad(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(ii(e.memoizedProps,n))),wd===null&&(wd=[]),wd.push(t.bind(null,r))}}function jd(e,t,n){(e===qu&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)&&(Rd(e,0),Fd(e,Yu,od,!1)),rt(e,n),(!(Ku&2)||e!==qu)&&(e===qu&&(!(Ku&2)&&(id|=n),nd===4&&Fd(e,Yu,od,!1)),wf(e))}function Md(e,t,n){if(Ku&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||G(e,t),a=r?Kd(e,t):Wd(e,t,!0),o=r;do{if(a===0){$u&&!r&&Fd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Pd(n)){a=Wd(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=cd;var l=c.current.memoizedState.isDehydrated;if(l&&(Rd(c,s).flags|=256),s=Wd(c,s,!1),s!==2&&s!==6){if(ed&&!l){c.errorRecoveryDisabledLanes|=o,id|=o,a=4;break a}o=ld,ld=a,o!==null&&(ld===null?ld=o:ld.push.apply(ld,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Rd(e,0),Fd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Fd(r,t,od,!Qu);break a;case 2:ld=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=dd+300-ze(),10<a)){if(Fd(r,t,od,!Qu),W(r,0,!0)!==0)break a;yd=t,r.timeoutHandle=gp(Nd.bind(null,r,n,ld,md,ud,t,od,id,sd,Qu,o,`Throttled`,-0,0),a);break a}Nd(r,n,ld,md,ud,t,od,id,sd,Qu,o,null,-0,0)}break}while(1);wf(e)}function Nd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:on},jl=null,Ru(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?dd-ze():(a&4194048)===a?fd-ze():0,m=eh(d,m),m!==null)){yd=a,e.cancelPendingCommit=m($d.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Fd(e,a,o,!l);return}$d(e,t,a,n,r,i,o,s,c,l,u,d)}function Pd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!kr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Fd(e,t,n,r){t=K(e,t),t&=~ad,t&=~id,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&at(e,n,t)}function Id(){return Ku&6?!0:(Tf(0,!1),!1)}function Ld(){if(Ju!==null){if(Xu===0)var e=Ju.return;else e=Ju,aa=ia=null,Jo(e),qa=null,Ja=0,e=Ju;for(;e!==null;)dl(e.alternate,e),e=e.return;Ju=null}}function Rd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),yd=0,Ld(),qu=e,Ju=n=xi(e.current,null),Yu=t,Xu=0,Zu=null,Qu=!1,$u=G(e,t),ed=!1,sd=od=ad=id=rd=nd=0,ld=cd=null,ud=!1,td=K(e,t),di(),n}function zd(e,t){$=null,R.H=ic,t===La||t===za?(t=Ga(),Xu=3):t===Ra?(t=Ga(),Xu=4):Xu=t===Sc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Zu=t,Ju===null&&(nd=1,gc(e,ki(t,e.current)))}function Bd(){var e=yo.current;return e===null?!0:(Yu&4194048)===Yu?bo===null:(Yu&62914560)===Yu||Yu&536870912?e===bo:!1}function Vd(){var e=R.H;return R.H=ic,e===null?ic:e}function Hd(){var e=R.A;return R.A=Wu,e}function Ud(){nd=4,Qu||(Yu&4194048)!==Yu&&yo.current!==null||($u=!0),!(rd&134217727)&&!(id&134217727)||qu===null||Fd(qu,Yu,od,!1)}function Wd(e,t,n){var r=Ku;Ku|=2;var i=Vd(),a=Hd();(qu!==e||Yu!==t)&&(md=null,Rd(e,t)),t=!1;var o=nd;a:do try{if(Xu!==0&&Ju!==null){var s=Ju,c=Zu;switch(Xu){case 8:Ld(),o=6;break a;case 3:case 2:case 9:case 6:yo.current===null&&(t=!0);var l=Xu;if(Xu=0,Zu=null,Xd(e,s,c,l),n&&$u){o=0;break a}break;default:l=Xu,Xu=0,Zu=null,Xd(e,s,c,l)}}Gd(),o=nd;break}catch(t){zd(e,t)}while(1);return t&&e.shellSuspendCounter++,aa=ia=null,Ku=r,R.H=i,R.A=a,Ju===null&&(qu=null,Yu=0,di()),o}function Gd(){for(;Ju!==null;)Jd(Ju)}function Kd(e,t){var n=Ku;Ku|=2;var r=Vd(),a=Hd();qu!==e||Yu!==t?(md=null,pd=ze()+500,Rd(e,t)):$u=G(e,t);a:do try{if(Xu!==0&&Ju!==null){t=Ju;var o=Zu;b:switch(Xu){case 1:Xu=0,Zu=null,Xd(e,t,o,1);break;case 2:case 9:if(Va(o)){Xu=0,Zu=null,Yd(t);break}t=function(){Xu!==2&&Xu!==9||qu!==e||(Xu=7),wf(e)},o.then(t,t);break a;case 3:Xu=7;break a;case 4:Xu=5;break a;case 7:Va(o)?(Xu=0,Zu=null,Yd(t)):(Xu=0,Zu=null,Xd(e,t,o,7));break;case 5:var s=null;switch(Ju.tag){case 26:s=Ju.memoizedState;case 5:case 27:var c=Ju;if(s?Ym(s):c.stateNode.complete){Xu=0,Zu=null;var l=c.sibling;if(l!==null)Ju=l;else{var u=c.return;u===null?Ju=null:(Ju=u,Zd(u))}break b}}Xu=0,Zu=null,Xd(e,t,o,5);break;case 6:Xu=0,Zu=null,Xd(e,t,o,6);break;case 8:Ld(),nd=6;break a;default:throw Error(i(462))}}qd();break}catch(t){zd(e,t)}while(1);return aa=ia=null,R.H=r,R.A=a,Ku=n,Ju===null?(qu=null,Yu=0,di(),nd):0}function qd(){for(;Ju!==null&&!Le();)Jd(Ju)}function Jd(e){var t=nl(e.alternate,e,td);e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Yd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ic(n,t,t.pendingProps,t.type,void 0,Yu);break;case 11:t=Ic(n,t,t.pendingProps,t.type.render,t.ref,Yu);break;case 5:Jo(t);var r=t;r===Wi&&(Ki?(Qi(r),r.tag===5&&r.stateNode!=null&&(Gi=r.stateNode)):(Qi(r),Ki=!0));default:dl(n,t),t=Ju=Si(t,td),t=nl(n,t,td)}e.memoizedProps=e.pendingProps,t===null?Zd(e):Ju=t}function Xd(e,t,n,r){aa=ia=null,Jo(t),qa=null,Ja=0;var i=t.return;try{if(xc(e,i,t,n,Yu)){nd=1,gc(e,ki(n,e.current)),Ju=null;return}}catch(t){if(i!==null)throw Ju=i,t;nd=1,gc(e,ki(n,e.current)),Ju=null;return}t.flags&32768?(Ki||r===1?e=!0:$u||Yu&536870912?e=!1:(Qu=e=!0,(r===2||r===9||r===3||r===6)&&(r=yo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Qd(t,e)):Zd(t)}function Zd(e){var t=e;do{if(t.flags&32768){Qd(t,Qu);return}e=t.return;var n=ll(t.alternate,t,td);if(n!==null){Ju=n;return}if(t=t.sibling,t!==null){Ju=t;return}Ju=t=e}while(t!==null);nd===0&&(nd=5)}function Qd(e,t){do{var n=ul(e.alternate,e);if(n!==null){n.flags&=32767,Ju=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ju=e;return}Ju=e=n}while(e!==null);nd=6,Ju=null}function $d(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do cf();while(gd!==0);if(Ku&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===qu&&(Ju=qu=null,Yu=0),vd=t,_d=e,yd=n,xd=a,Sd=r,ef(e,t,n,s,c,l,f)}}function ef(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(bd=s,s|=ui,it(e,n,s,r,i,a),wd=null,(n&335544064)===n?(Td=wa(e),r=10262):(Td=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,_f(Ue,function(){return lf(),null})):(e.callbackNode=null,e.callbackPriority=0),Al=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=R.T,R.T=null,i=z.p,z.p=2,a=Ku,Ku|=4;try{au(e,t,n)}finally{Ku=a,z.p=i,R.T=r}}gd=1,Al?Cd=Mp(o,e.containerInfo,Td,rf,af,nf,of,lf,tf,null,null):(rf(),af(),of())}function tf(e){if(gd!==0){var t=_d.onRecoverableError;t(e,{componentStack:null})}}function nf(){gd===3&&(gd=0,Eu(vd,_d),gd=4)}function rf(){if(gd===1){gd=0;var e=_d,t=vd,n=yd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=R.T,R.T=null;var i=z.p;z.p=2;var a=Ku;Ku|=4;try{nu=ru=!1,Su(t,e,n),n=cp;var o=Fr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Pr(s.ownerDocument.documentElement,s)){if(c!==null&&Ir(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Nr(s,h),v=Nr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{Ku=a,z.p=i,R.T=r}}e.current=t,gd=2}}function af(){if(gd===2){gd=0;var e=_d,t=vd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=R.T,R.T=null;var r=z.p;z.p=2;var i=Ku;Ku|=4;try{su(e,t.alternate,t)}finally{Ku=i,z.p=r,R.T=n}}gd=3}}function of(){if(gd===4||gd===3){gd=0;var e=Cd;Cd=null,Re();var t=_d,n=vd,r=yd,i=Sd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?gd=5:(gd=0,vd=_d=null,sf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(hd=null),lt(r),n=n.stateNode,Ye&&typeof Ye.onCommitFiberRoot==`function`)try{Ye.onCommitFiberRoot(Je,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=R.T,a=z.p,z.p=2,R.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{R.T=n,z.p=a}}if(i=wd,o=Td,Td=null,i!==null&&(wd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);yd&3&&cf(),wf(t),a=t.pendingLanes,r&261930&&a&42?t===Dd?Ed++:(Ed=0,Dd=t):(Ed=0,Dd=null),Tf(0,!1)}}function sf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,xa(t)))}function cf(){return Cd!==null&&(Cd.skipTransition(),Cd=null),rf(),af(),of(),lf()}function lf(){if(gd!==5)return!1;var e=_d,t=bd;bd=0;var n=lt(yd),r=R.T,a=z.p;try{z.p=32>n?32:n,R.T=null,n=xd,xd=null;var o=_d,s=yd;if(gd=0,vd=_d=null,yd=0,Ku&6)throw Error(i(331));var c=Ku;if(Ku|=4,Vu(o.current),Nu(o,o.current,s,n),Ku=c,Tf(0,!1),Ye&&typeof Ye.onPostCommitFiberRoot==`function`)try{Ye.onPostCommitFiberRoot(Je,o)}catch{}return!0}finally{z.p=a,R.T=r,sf(e,t)}}function uf(e,t,n){t=ki(n,t),t=vc(e.stateNode,t,2),e=ao(e,t,2),e!==null&&(rt(e,2),wf(e))}function df(e,t,n){if(e.tag===3)uf(e,e,n);else for(;t!==null;){if(t.tag===3){uf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(hd===null||!hd.has(r))){e=ki(n,e),n=yc(2),r=ao(t,n,2),r!==null&&(bc(n,r,t,e),rt(r,2),wf(r));break}}t=t.return}}function ff(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Gu;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ed=!0,i.add(n),e=pf.bind(null,e,t,n),t.then(e,e))}function pf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,qu===e&&(Yu&n)===n&&(nd===4||nd===3&&(Yu&62914560)===Yu&&300>ze()-dd?Ku&2?ad|=n:Rd(e,0):ad|=n,sd===Yu&&(sd=0)),wf(e)}function mf(e,t){t===0&&(t=nt()),e=mi(e,t),e!==null&&(rt(e,t),wf(e))}function hf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mf(e,n)}function gf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),mf(e,n)}function _f(e,t){return Fe(e,t)}var vf=null,yf=null,bf=!1,xf=!1,Sf=!1,Cf=0;function wf(e){e!==yf&&e.next===null&&(yf===null?vf=yf=e:yf=yf.next=e),xf=!0,bf||(bf=!0,jf())}function Tf(e,t){if(!Sf&&xf){Sf=!0;do for(var n=!1,r=vf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ze(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Af(r,a))}else a=Yu,a=W(r,r===qu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||G(r,a)||(n=!0,Af(r,a))}r=r.next}while(n);Sf=!1}}function Ef(){Df()}function Df(){xf=bf=!1;var e=0;Cf!==0&&hp()&&(e=Cf);for(var t=ze(),n=null,r=vf;r!==null;){var i=r.next,a=Of(r,t);a===0?(r.next=null,n===null?vf=i:n.next=i,i===null&&(yf=n)):(n=r,(e!==0||a&3)&&(xf=!0)),r=i}gd!==0&&gd!==5||Tf(e,!1),Cf!==0&&(Cf=0)}function Of(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=tt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=qu,n=Yu,n=W(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Xu===2||Xu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ie(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||G(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ie(r),lt(n)){case 2:case 8:n=He;break;case 32:n=Ue;break;case 268435456:n=Ge;break;default:n=Ue}return r=kf.bind(null,e),n=Fe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ie(r),e.callbackPriority=2,e.callbackNode=null,2}function kf(e,t){if(gd!==0&&gd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(cf()&&e.callbackNode!==n)return null;var r=Yu;return r=W(e,e===qu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Md(e,r,t),Of(e,ze()),e.callbackNode!=null&&e.callbackNode===n?kf.bind(null,e):null)}function Af(e,t){if(cf())return null;Md(e,t,!0)}function jf(){bp(function(){Ku&6?Fe(Ve,Ef):Df()})}function Mf(){if(Cf===0){var e=Da;e===0&&(e=$e,$e<<=1,!($e&261888)&&($e=256)),Cf=e}return Cf}function Nf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:an(e)}function Pf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Nf((i[pt]||null).action),o=r.submitter;o&&(t=(t=o[pt]||null)?Nf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Dn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Cf!==0){var e=new FormData(i,o);Ws(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),Ws(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Ff=0;Ff<ti.length;Ff++){var If=ti[Ff];ni(If.toLowerCase(),`on`+(If[0].toUpperCase()+If.slice(1)))}ni(qr,`onAnimationEnd`),ni(Jr,`onAnimationIteration`),ni(Yr,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(Xr,`onTransitionRun`),ni(Zr,`onTransitionStart`),ni(Qr,`onTransitionCancel`),ni($r,`onTransitionEnd`),kt(`onMouseEnter`,[`mouseout`,`mouseover`]),kt(`onMouseLeave`,[`mouseout`,`mouseover`]),kt(`onPointerEnter`,[`pointerout`,`pointerover`]),kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ot(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ot(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ot(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ot(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ot(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Lf=`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(` `),Rf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Lf));function zf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){si(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){si(e)}i.currentTarget=null,a=c}}}}function Bf(e,t){var n=t[ht];n===void 0&&(n=t[ht]=new Set);var r=e+`__bubble`;n.has(r)||(Wf(t,e,2,!1),n.add(r))}function Vf(e,t,n){var r=0;t&&(r|=4),Wf(n,e,r,t)}var Hf=`_reactListening`+Math.random().toString(36).slice(2);function Uf(e){if(!e[Hf]){e[Hf]=!0,Et.forEach(function(t){t!==`selectionchange`&&(Rf.has(t)||Vf(t,!1,e),Vf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hf]||(t[Hf]=!0,Vf(`selectionchange`,!1,t))}}function Wf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!gn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Gf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=bt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}pn(function(){var r=a,i=cn(n),s=[];a:{var c=ei.get(e);if(c!==void 0){var l=Dn,u=e;switch(e){case`keypress`:if(Sn(n)===0)break a;case`keydown`:case`keyup`:l=Gn;break;case`focusin`:u=`focus`,l=In;break;case`focusout`:u=`blur`,l=In;break;case`beforeblur`:case`afterblur`:l=In;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Pn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Fn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Jn;break;case qr:case Jr:case Yr:l=Ln;break;case $r:l=Yn;break;case`scroll`:case`scrollend`:l=kn;break;case`wheel`:l=Xn;break;case`copy`:case`cut`:case`paste`:l=Rn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Kn;break;case`submit`:l=qn;break;case`toggle`:case`beforetoggle`:l=Zn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=mn(m,p),g!=null&&d.push(Kf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==sn&&(u=n.relatedTarget||n.fromElement)&&(bt(u)||u[mt]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?bt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Pn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Kn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:St(c),h=l==null?u:St(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,bt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?E(c,l,Jf):null,c!==null&&Yf(s,u,c,d,!1),l!==null&&f!==null&&Yf(s,f,l,d,!0)))}a:{if(c=r?St(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=_r;else if(dr(c)){if(vr)_=Dr;else{_=Tr;var v=wr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&tn(r.elementType)&&(_=_r):_=Er;if(_&&=_(e,r)){fr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?St(r):window,e){case`focusin`:(dr(v)||v.contentEditable===`true`)&&(Q=v,Rr=r,zr=null);break;case`focusout`:zr=Rr=Q=null;break;case`mousedown`:Br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Br=!1,Vr(s,n,i);break;case`selectionchange`:if(Lr)break;case`keydown`:case`keyup`:Vr(s,n,i)}var y;if($n)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else sr?ar(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(nr&&n.locale!==`ko`&&(sr||b!==`onCompositionStart`?b===`onCompositionEnd`&&sr&&(y=xn()):(vn=i,yn=`value`in vn?vn.value:vn.textContent,sr=!0)),v=qf(r,b),0<v.length&&(b=new zn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=or(n),y!==null&&(b.data=y)))),(y=tr?cr(e,n):lr(e,n))&&(b=qf(r,`onBeforeInput`),0<b.length&&(v=new zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Pf(s,e,r,n,i)}zf(s,t)})}function Kf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=mn(e,n),i!=null&&r.unshift(Kf(e,i,a)),i=mn(e,t),i!=null&&r.push(Kf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=mn(n,a),l!=null&&o.unshift(Kf(n,l,c))):i||(l=mn(n,a),l!=null&&o.push(Kf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
10
- `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Qt(e,``+r);else return;break;case`className`:Lt(e,`class`,r);break;case`tabIndex`:Lt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Lt(e,n,r);break;case`style`:en(e,r,o);return;case`data`:if(t!==`object`){Lt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);return;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=an(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Bf(`beforetoggle`,e),Bf(`toggle`,e),It(e,`popover`,r);break;case`xlinkActuate`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:It(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=nn.get(n)||n,It(e,n,r);else return}Pt=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:en(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)Qt(e,``+r);else return;break;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=on);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[pt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Pt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):It(e,n,r)}return}Pt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Bf(`error`,e),Bf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Bf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Bf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in Bf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Bf(`cancel`,e),Bf(`close`,e);break;case`iframe`:case`object`:Bf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Lf.length;r++)Bf(Lf[r],e);break;case`image`:Bf(`error`,e),Bf(`load`,e);break;case`details`:Bf(`toggle`,e);break;case`embed`:case`source`:case`link`:Bf(`error`,e),Bf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(tn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Pt=!0),o=m;break;case`name`:m!==f&&(Pt=!0),a=m;break;case`checked`:m!==f&&(Pt=!0),u=m;break;case`defaultChecked`:m!==f&&(Pt=!0),d=m;break;case`value`:m!==f&&(Pt=!0),s=m;break;case`defaultValue`:m!==f&&(Pt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Pt=!0),p=o;break;case`defaultValue`:o!==l&&(Pt=!0),c=o;break;case`multiple`:o!==l&&(Pt=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Pt=!0),p=a;break;case`defaultValue`:a!==o&&(Pt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Pt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(tn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[J]=r,n[pt]=t,np(n,e,t),wt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[vt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){m(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=bt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(m(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(m(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];m(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),yt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[vt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===on&&(e.onclick=null),yt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=z.d;z.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Id();return e||t}function Cm(e){var t=xt(e);t!==null&&t.tag===5&&t.type===`form`?Ks(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),wt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[X]=!0,o.onload=o.onerror=function(){Tt(o)}),wt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),wt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Ct(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);wt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Ct(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Ct(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=xe.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Ct(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Ct(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Ct(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+Gt(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[X]){r.loading=1;return}}else t=e.createElement(`link`),t[X]=!0,t.onload=t.onerror=Tt.bind(null,t),np(t,`link`,n),wt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Gt(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,wt(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),wt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,wt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),wt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,wt(a),a):(r=n,(a=vm.get(o))&&(r=D({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),wt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[vt]||a[J]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,wt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),wt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:N,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=q(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=q(0),this.hiddenUpdates=q(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=yi(3,null,null,t),e.current=a,a.stateNode=e,t=ba(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},no(a),e}function uh(e){return e?(e=_i,e):_i}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=io(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ao(e,r,t),n!==null&&(jd(n,e,t),oo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&jd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=Od();t=ct(t);var n=mi(e,t);n!==null&&jd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=2,yh(e,t,n,r)}finally{z.p=a,R.T=i}}function vh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=8,yh(e,t,n,r)}finally{z.p=a,R.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=xt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=et(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ze(o);s.entanglements[1]|=c,o&=~c}wf(a),!(Ku&6)&&(pd=ze()+500,Tf(0,!1))}}break;case 31:case 13:s=mi(a,2),s!==null&&jd(s,a,2),Id(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=cn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=bt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Be()){case Ve:return 2;case He:return 8;case Ue:case We:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=xt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=bt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,dt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,dt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sn=r,n.target.dispatchEvent(r),sn=null}else return t=xt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=xt(n);a!==null&&(e.splice(t,3),t-=3,Ws(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,Od(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Id(),t[mt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.0`)throw Error(i(527,Kh,`19.3.0`));z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:R,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Je=Jh.inject(qh),Ye=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=pc,s=mc,c=hc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[mt]=t.current,Uf(e),new Wh(t)}})),_=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b={"agents.addJournal":[`POST`,`/api/agents/:slug/journal`],"agents.adoptRoutine":[`POST`,`/api/agents/:slug/routines/:id/adopt`],"agents.archive":[`POST`,`/api/agents/:slug/archive`],"agents.create":[`POST`,`/api/agents`],"agents.delete":[`DELETE`,`/api/agents/:slug`],"agents.deleteRoutine":[`DELETE`,`/api/agents/:slug/routines/:id`],"agents.deleteSkill":[`DELETE`,`/api/agents/:slug/skills/:name`],"agents.get":[`GET`,`/api/agents/:slug`],"agents.journal":[`GET`,`/api/agents/:slug/journal`],"agents.list":[`GET`,`/api/agents`],"agents.routines":[`GET`,`/api/agents/:slug/routines`],"agents.runRoutine":[`POST`,`/api/agents/:slug/routines/:id/run`],"agents.save":[`PUT`,`/api/agents/:slug`],"agents.saveRoutine":[`POST`,`/api/agents/:slug/routines`],"agents.saveSkill":[`POST`,`/api/agents/:slug/skills`],"agents.sessions":[`GET`,`/api/agent-sessions`],"agents.skill":[`GET`,`/api/agents/:slug/skills/:name`],"agents.skills":[`GET`,`/api/agents/:slug/skills`],"agents.status":[`GET`,`/api/agent-status`],"attention.list":[`GET`,`/api/attention`],"channels.create":[`POST`,`/api/channels`],"channels.delete":[`DELETE`,`/api/channels/:slug`],"channels.fromChat":[`POST`,`/api/channels/from-chat`],"channels.get":[`GET`,`/api/channels/:slug`],"channels.list":[`GET`,`/api/channels`],"channels.save":[`PUT`,`/api/channels/:slug`],"chats.attach":[`POST`,`/api/chats/:id/attachments`,`upload`],"chats.attachment":[`GET`,`/api/chats/:id/attachments/:name`,`raw`],"chats.cancel":[`POST`,`/api/chats/:id/cancel`],"chats.config":[`POST`,`/api/chats/:id/config`],"chats.create":[`POST`,`/api/chats`],"chats.delete":[`DELETE`,`/api/chats/:id`],"chats.elicitation":[`POST`,`/api/chats/:id/elicitation`],"chats.events":[`GET`,`/api/chats/:id/events`,`raw`],"chats.fork":[`POST`,`/api/chats/:id/fork`],"chats.get":[`GET`,`/api/chats/:id`],"chats.list":[`GET`,`/api/chats`],"chats.message":[`POST`,`/api/chats/:id/message`],"chats.permission":[`POST`,`/api/chats/:id/permission`],"chats.rename":[`PATCH`,`/api/chats/:id`],"chats.resetSession":[`POST`,`/api/chats/:id/reset-session`],"chats.setProject":[`POST`,`/api/chats/:id/project`],"chats.setVibeable":[`POST`,`/api/chats/:id/vibeable`],"chats.steer":[`POST`,`/api/chats/:id/steer`],"chats.stopTask":[`POST`,`/api/chats/:id/task-stop`],"devices.code":[`POST`,`/api/devices/code`],"devices.dropPush":[`DELETE`,`/api/devices/push`],"devices.list":[`GET`,`/api/devices`],"devices.pair":[`POST`,`/api/pair`],"devices.relay":[`GET`,`/api/devices/relay`],"devices.revoke":[`DELETE`,`/api/devices/:id`],"devices.self":[`GET`,`/api/devices/self`],"devices.setPush":[`POST`,`/api/devices/push`],"devices.setRelay":[`POST`,`/api/devices/relay`],"files.delete":[`DELETE`,`/api/files`],"files.list":[`GET`,`/api/files/list`],"files.mkdir":[`POST`,`/api/files/folder`],"files.move":[`POST`,`/api/files/move`],"files.raw":[`GET`,`/api/files/raw`,`raw`],"files.recent":[`GET`,`/api/files/recent`],"files.scopes":[`GET`,`/api/files`],"files.upload":[`POST`,`/api/files/upload`,`upload`],"git.commit":[`POST`,`/api/git/commit`],"git.diff":[`GET`,`/api/git/diff`],"git.fetch":[`POST`,`/api/git/fetch`],"git.pull":[`POST`,`/api/git/pull`],"git.push":[`POST`,`/api/git/push`],"git.status":[`GET`,`/api/git`],"hub.close":[`POST`,`/api/hub/close`],"hub.list":[`GET`,`/api/hub`],"hub.open":[`POST`,`/api/hub/open`],"identity.get":[`GET`,`/api/identity`],"knowledge.concept":[`GET`,`/api/knowledge/:bundle/concept`],"knowledge.create":[`POST`,`/api/knowledge`],"knowledge.delete":[`DELETE`,`/api/knowledge/:bundle`],"knowledge.get":[`GET`,`/api/knowledge/:bundle`],"knowledge.list":[`GET`,`/api/knowledge`],"knowledge.putConcept":[`POST`,`/api/knowledge/:bundle/concept`],"knowledge.verify":[`POST`,`/api/knowledge/:bundle/verify`],"meta.get":[`GET`,`/api/meta`],"notifications.clear":[`DELETE`,`/api/notifications`],"notifications.diagnose":[`POST`,`/api/notifications/:id/diagnose`],"notifications.list":[`GET`,`/api/notifications`],"notifications.read":[`POST`,`/api/notifications/read`],"projects.create":[`POST`,`/api/projects`],"projects.delete":[`DELETE`,`/api/projects/:slug`],"projects.get":[`GET`,`/api/projects/:slug`],"projects.link":[`POST`,`/api/projects/:slug/links`],"projects.list":[`GET`,`/api/projects`],"projects.log":[`POST`,`/api/projects/:slug/log`],"projects.save":[`PUT`,`/api/projects/:slug`],"projects.saveLayout":[`PUT`,`/api/projects`],"protocol.get":[`GET`,`/api/protocol`],"repos.add":[`POST`,`/api/repos`],"repos.commit":[`GET`,`/api/repos/:slug/commits/:hash`],"repos.diff":[`GET`,`/api/repos/:slug/diff`],"repos.get":[`GET`,`/api/repos/:slug`],"repos.list":[`GET`,`/api/repos`],"repos.remove":[`DELETE`,`/api/repos/:slug`],"repos.update":[`POST`,`/api/repos/:slug/update`],"routines.adopt":[`POST`,`/api/routines/adopt`],"routines.list":[`GET`,`/api/routines`],"runs.decide":[`POST`,`/api/runs/:id/decision`],"runs.delete":[`DELETE`,`/api/runs/:id`],"runs.file":[`GET`,`/api/runs/:id/file`,`raw`],"runs.fileText":[`GET`,`/api/runs/:id/text`],"runs.get":[`GET`,`/api/runs/:id`],"runs.list":[`GET`,`/api/runs`],"runs.stop":[`POST`,`/api/runs/:id/stop`],"search.agents":[`GET`,`/api/search/agents`],"server.restart":[`POST`,`/api/restart`],"settings.get":[`GET`,`/api/settings`],"settings.save":[`PUT`,`/api/settings`],"skills.get":[`GET`,`/api/skills/:name`],"skills.list":[`GET`,`/api/skills`],"trash.empty":[`DELETE`,`/api/trash`],"trash.list":[`GET`,`/api/trash`],"trash.purge":[`POST`,`/api/trash/purge`],"trash.restore":[`POST`,`/api/trash/restore`],"update.check":[`GET`,`/api/update-check`],"update.start":[`POST`,`/api/update`],"update.status":[`GET`,`/api/update`],"vibeables.create":[`POST`,`/api/vibeables`],"vibeables.delete":[`DELETE`,`/api/vibeables/:slug`],"vibeables.devStart":[`POST`,`/api/vibeables/:slug/dev/start`],"vibeables.devStop":[`POST`,`/api/vibeables/:slug/dev/stop`],"vibeables.events":[`GET`,`/api/vibeables/:slug/events`,`raw`],"vibeables.get":[`GET`,`/api/vibeables/:slug`],"vibeables.list":[`GET`,`/api/vibeables`],"workflows.delete":[`DELETE`,`/api/workflows/:slug`],"workflows.get":[`GET`,`/api/workflows/:slug`],"workflows.list":[`GET`,`/api/workflows`],"workflows.run":[`POST`,`/api/workflows/:slug/run`],"workflows.runner":[`GET`,`/api/workflows/:slug/run`],"workspaces.forget":[`POST`,`/api/workspaces/forget`],"workspaces.list":[`GET`,`/api/workspaces`],"workspaces.start":[`POST`,`/api/workspaces/start`],"workspaces.stop":[`POST`,`/api/workspaces/stop`]},x=1e4;function S(e){let t=e.WebSocket??(typeof WebSocket>`u`?void 0:WebSocket),n=e.EventSource??(typeof EventSource>`u`?void 0:EventSource),{client:r}=e,i=new Map,a=new Map,o=null,s=!1,c=!1,l=500,u,d=0,f=()=>`${(/^https?:/.test(r.baseUrl)?r.baseUrl:(typeof location>`u`?``:location.origin)+r.baseUrl).replace(/^http/,`ws`).replace(/\/+$/,``)}/api/ws${r.token?`?token=${encodeURIComponent(r.token)}`:``}`,p=e=>{s&&o?.send(JSON.stringify(e))},m=e=>{let t=i.get(e);t&&!s&&(clearTimeout(t.timer),r.request(t.name,t.input).then(n=>n.ok&&i.get(e)===t&&!s&&t.onData(n.data)).catch(()=>{}).finally(()=>{i.get(e)===t&&!s&&(t.timer=setTimeout(()=>m(e),t.interval))}))},h=e=>{let t=a.get(e);if(!t||s||t.source||!n)return;let[i,...o]=t.topic.split(`.`),c=o.join(`.`),l=i===`chat`?r.url(`chats.events`,{id:c,query:{after:t.after}}):i===`vibeable`?r.url(`vibeables.events`,{slug:c}):``;l&&(t.source=new n(l),t.source.onmessage=t=>g(e,JSON.parse(t.data)))},g=(e,t)=>{let n=a.get(e);if(!n)return;let r=t?.seq;if(typeof r==`number`){if(r<=n.after)return;n.after=r}n.onEvent(t)},_=r.onChange(()=>{if(!s)for(let e of i.keys())m(e)}),v=()=>{for(let[e,t]of i)clearTimeout(t.timer),p({watch:e,name:t.name,input:t.input,interval:t.interval});for(let[e,t]of a)t.source?.close(),t.source=void 0,p({sub:e,topic:t.topic,after:t.after})},y=()=>{for(let e of i.keys())m(e);for(let e of a.keys())h(e)},b=()=>{if(c||o||!t)return;let e;try{e=new t(f())}catch{return y()}o=e,e.onopen=()=>{s=!0,l=500,v()},e.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}t.watch&&`data`in t?i.get(t.watch)?.onData(t.data):t.event&&g(t.event,t.data)},e.onclose=()=>{o=null,s=!1,!c&&(y(),u=setTimeout(b,l),l=Math.min(x,l*2))}};return{get connected(){return s},watch(e,t,n,r){let a=`w${++d}`;return i.set(a,{name:e,input:t??{},interval:n.interval??6e3,onData:r}),s?p({watch:a,name:e,input:t??{},interval:n.interval??6e3}):(m(a),b()),()=>{clearTimeout(i.get(a)?.timer),i.delete(a),p({unwatch:a})}},subscribe(e,t,n){let r=`s${++d}`;return a.set(r,{topic:e,after:t.after??0,onEvent:n}),s?p({sub:r,topic:e,after:t.after??0}):(h(r),b()),()=>{a.get(r)?.source?.close(),a.delete(r),p({unsub:r})}},close(){c=!0,_(),clearTimeout(u),o?.close();for(let e of i.values())clearTimeout(e.timer);for(let e of a.values())e.source?.close();i.clear(),a.clear()}}}var C=class extends Error{status;body;route;constructor(e,t,n){super(w(t)??`${n}: HTTP ${e}`),this.status=e,this.body=t,this.route=n}};function w(e){let t=e&&typeof e==`object`&&`error`in e?e.error:void 0;return typeof t==`string`&&t?t:void 0}function T(e={}){let t=(e.baseUrl??``).replace(/\/+$/,``)+(e.workspace?`/w/${encodeURIComponent(e.workspace)}`:``),n=e.fetch??((...e)=>fetch(...e)),r=new Set,i=(e,n={})=>{let[,r]=b[e],i=r.replace(/:([A-Za-z]+)/g,(t,r)=>{let i=n[r];if(i==null||i===``)throw Error(`${e}: missing path parameter ${r}`);return encodeURIComponent(String(i))}),a=new URLSearchParams;for(let[e,t]of Object.entries(n.query??{}))t!=null&&t!==!1&&a.set(e,t===!0?`1`:String(t));let o=a.toString();return`${t}${i}${o?`?${o}`:``}`},a=async(t,a={})=>{let[o]=b[t],{body:s,headers:c={},signal:l,keepalive:u}=a,d=s instanceof Blob||s instanceof ArrayBuffer||ArrayBuffer.isView(s),f=await n(i(t,a),{method:o,cache:`no-store`,signal:l,keepalive:u,headers:{...s!==void 0&&!d?{"content-type":`application/json`}:{},...e.token?{authorization:`Bearer ${e.token}`}:{},...c},body:s===void 0?void 0:d?s:JSON.stringify(s)}),p=await f.text(),m=p;try{m=p?JSON.parse(p):void 0}catch{}if(f.ok&&o!==`GET`)for(let e of r)e();return f.status===401&&m?.pair===!0&&e.onUnauthorized?.(),f.ok?{ok:!0,status:f.status,data:m}:{ok:!1,status:f.status,data:m,error:w(m)}};return{token:e.token,baseUrl:t,onChange(e){return r.add(e),()=>r.delete(e)},url:((e,t)=>i(e,t)),request:((e,t)=>a(e,t)),call:(async(e,t)=>{let n=await a(e,t);if(!n.ok)throw new C(n.status,n.data,e);return n.data})}}var E=!1,D=new Set;function O(){return(0,v.useSyncExternalStore)(e=>(D.add(e),()=>D.delete(e)),()=>E)}var k=/^\/w\/([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)\//.exec(location.pathname)?.[1],A=T({workspace:k,onUnauthorized:()=>{if(!E){E=!0;for(let e of D)e()}}}),ee=e=>e.startsWith(`/`)?A.baseUrl+e:e,te=S({client:A});function j(e){return e.ok?``:e.error??`HTTP ${e.status}`}function M(e,t,n={}){let[r,i]=(0,v.useState)(null),a=t===null?``:`${e} ${JSON.stringify(t)}`,o=(0,v.useRef)(t);o.current=t;let{fast:s=!1,interval:c=6e3,refresh:l}=n;return(0,v.useEffect)(()=>{if(a)return te.watch(e,o.current??void 0,{interval:s?1500:c},i)},[a,s,c,l]),r}function N(...e){return e.filter(Boolean).join(` `)}var ne=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),re=o(((e,t)=>{t.exports=ne()})),P=re();function F({name:e,fill:t,className:n}){return(0,P.jsx)(`span`,{className:`ms material-symbols-rounded${t?` ms-fill`:``}${e===`progress_activity`?` ms-spin`:``}${n?` ${n}`:``}`,"aria-hidden":!0,children:e})}function I(){let[e,t]=(0,v.useState)(()=>window.location.hash.slice(1)||`/`);return(0,v.useEffect)(()=>{let e=()=>t(window.location.hash.slice(1)||`/`);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}var ie=`kraftwerk inspector`,ae=``,oe=0;function se(){let e=ae?`${ae} — ${ie}`:ie;document.title=oe>0?`(${oe}) ${e}`:e}function ce(e){e!==oe&&(oe=e,se())}function le(e){ie=e,se()}function ue(e){ae=e,se()}var de=new Set([`agents`,`team`,`chats`,`projects`,`channels`]),fe=e=>de.has(e.split(`?`)[0].split(`/`).filter(Boolean)[0]??``)?`chat`:`side`,L=`kw-column-path`;function R(e){let t=e.split(`/`).filter(Boolean),n=t[1]?decodeURIComponent(t[1]):``;return!n||n===`chats`?!1:n===`new`?[`projects`,`agents`,`team`,`channels`].includes(t[0])&&!t[2]:t[0]===`projects`?t[2]===`info`:t[0]===`agents`||t[0]===`team`?t[2]===`info`||t[2]===`edit`:t[0]===`channels`&&t[2]===`edit`}function z(e,t){let n=window.location.hash.slice(1)||`/`;if(t?.replace&&(fe(e)!==fe(n)||R(n)&&!R(e)&&fe(e)===`chat`)){window.dispatchEvent(new CustomEvent(L,{detail:e}));return}t?.replace?window.location.replace(`#${e}`):window.location.hash=e}function pe(e){if(!e.here||!e.slug)return e.url;let{protocol:t,hostname:n,port:r}=window.location;return k?`/w/${e.slug}/`:n.endsWith(`.localhost`)?`${t}//${e.slug}.localhost${r?`:${r}`:``}/`:n===`localhost`||n===`127.0.0.1`||n===`[::1]`?e.url:`/w/${e.slug}/`}async function me(e){let t=await A.request(`workspaces.start`,{body:{root:e}});if(!t.ok)throw Error(j(t));let n=t.data;if(n.live&&n.url)return pe({url:n.url,slug:n.slug,here:n.here});for(let t=0;t<12;t++){await new Promise(e=>setTimeout(e,1e3));try{let t=(await A.call(`meta.get`)).switcher.find(t=>t.root===e&&t.live);if(t)return pe(t)}catch{}}throw Error(`started, but the UI did not answer yet — see ~/.kraftwerk/logs`)}var he=(0,v.createContext)(null);function ge({href:e,onClick:t,...n}){let r=(0,v.useContext)(he);return(0,P.jsx)(`a`,{href:`#${e}`,onClick:n=>{t?.(n),!n.defaultPrevented&&r&&(n.metaKey||n.ctrlKey||n.shiftKey||n.button!==0||r(e)&&n.preventDefault())},...n})}var _e=`kw-expert`,ve=(()=>{try{return localStorage.getItem(_e)!==`off`}catch{return!0}})(),ye=new Set;document.documentElement.dataset.expert=ve?`on`:`off`;function be(e){ve=e,document.documentElement.dataset.expert=e?`on`:`off`;try{localStorage.setItem(_e,e?`on`:`off`)}catch{}ye.forEach(e=>e())}function xe(){return(0,v.useSyncExternalStore)(e=>(ye.add(e),()=>ye.delete(e)),()=>ve)}var Se={git:!1,repos:!1,vibeables:!1,projects:!1},Ce=new Set;function we(e){(e.git!==Se.git||e.repos!==Se.repos||e.vibeables!==Se.vibeables||e.projects!==Se.projects)&&(Se=e,Ce.forEach(e=>e()))}function Te(){return(0,v.useSyncExternalStore)(e=>(Ce.add(e),()=>Ce.delete(e)),()=>Se)}function Ee(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0)%360}function De(e,t){return e||`hsl(${Ee(t)} 58% 46%)`}function Oe(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(t){let e=t[1].length===3?t[1].split(``).map(e=>e+e).join(``):t[1];return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}let n=/^hsl\(\s*([\d.]+)[ ,]+([\d.]+)%[ ,]+([\d.]+)%/i.exec(e.trim());if(!n)return null;let r=n[1]/360,i=n[2]/100,a=n[3]/100,o=a<.5?a*(1+i):a+i-a*i,s=2*a-o,c=e=>(e=(e+1)%1,e<1/6?s+(o-s)*6*e:e<1/2?o:e<2/3?s+(o-s)*(2/3-e)*6:s);return[c(r+1/3),c(r),c(r-1/3)].map(e=>Math.round(e*255))}var ke=(e,t,n)=>e.map((e,r)=>Math.round(e+(t[r]-e)*n)),Ae=e=>`#`+e.map(e=>e.toString(16).padStart(2,`0`)).join(``);function je([e,t,n]){let r=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*r(e)+.7152*r(t)+.0722*r(n)}function Me(e,t){let n=je(e),r=je(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ne(e,t,n,r){let i=e;for(let a=0;a<=1&&Me(i,t)<n;a+=.04)i=ke(e,r,a);return i}var Pe=[255,255,255],Fe=[0,0,0],Ie=[38,37,35];function Le(e){let t=Oe(e);if(!t)return null;let n=Ne(t,Pe,4.5,Fe),r=ke(t,Pe,.84),i=ke(t,Pe,.88),a=Ne(ke(t,Pe,.4),Ie,4.5,Pe),o=ke(t,Fe,.42),s=ke(t,Fe,.6);return{"--wsp-l-primary":Ae(n),"--wsp-l-on-primary":Ae(Pe),"--wsp-l-primary-container":Ae(r),"--wsp-l-on-primary-container":Ae(Ne(ke(t,Fe,.6),r,4.5,Fe)),"--wsp-l-secondary-container":Ae(i),"--wsp-l-on-secondary-container":Ae(Ne(ke(t,Fe,.65),i,4.5,Fe)),"--wsp-d-primary":Ae(a),"--wsp-d-on-primary":Ae(Ne(ke(t,Fe,.7),a,4.5,Fe)),"--wsp-d-primary-container":Ae(o),"--wsp-d-on-primary-container":Ae(Ne(ke(t,Pe,.8),o,4.5,Pe)),"--wsp-d-secondary-container":Ae(s),"--wsp-d-on-secondary-container":Ae(Ne(ke(t,Pe,.85),s,4.5,Pe))}}function Re(e){let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);return t.length===0?`?`:(t.length>=2?t[0][0]+t[1][0]:t[0].slice(0,2)).toUpperCase()}function ze({icon:e,name:t,color:n,seed:r,ambiguous:i,size:a=`md`,className:o}){let s={"--ws-c":De(n,r)};return(0,P.jsxs)(`span`,{className:N(`relative grid flex-none place-items-center rounded-full leading-none`,`bg-[color-mix(in_srgb,var(--ws-c,var(--text))_22%,var(--surface-2))]`,a===`sm`?`size-8`:`size-10`,e?a===`sm`?`text-[18px]`:`text-[22px]`:N(`font-sans font-medium tracking-[0.15px] text-[var(--ws-c,var(--text))]`,a===`sm`?`text-[13px]`:`text-base`),o),style:s,"aria-hidden":!0,children:[e||Re(t),e&&i&&(0,P.jsx)(`span`,{className:`absolute -right-[3px] -bottom-[3px] grid h-[18px] min-w-[18px] place-items-center rounded-full bg-[var(--ws-c,var(--text))] px-1 font-sans text-[10px] font-medium leading-none tracking-[0.4px] text-white shadow-[0_0_0_2px_var(--surface-1)]`,children:Re(t)})]})}var Be={emoji:`🧭`,name:`Assistant`};function Ve(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}function He(e){return e==null?`—`:`$${e.toFixed(2)}`}function Ue(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function We(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} K`:`${(e/1024/1024).toFixed(1)} M`}function Ge(e){if(!e)return`—`;let t=new Date(e),n=new Date,r=t.toDateString()===n.toDateString(),i=t.toTimeString().slice(0,5);return r?i:`${t.toISOString().slice(5,10)} ${i}`}function Ke(e){if(!e)return`—`;let t=Date.now()-Date.parse(e);if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<7?`${i}d ago`:new Date(e).toISOString().slice(5,10)}function qe({since:e}){let[,t]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),e?(0,P.jsx)(`span`,{className:`tabular-nums`,children:Ve(Date.now()-Date.parse(e))}):null}var Je=[``,`low`,`medium`,`high`,`xhigh`,`max`],Ye=`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-control font-medium transition-colors disabled:cursor-default disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-live cursor-pointer no-underline`,Xe={primary:`bg-accent text-on-accent hover:bg-accent-hover`,secondary:`border border-line bg-transparent text-fg hover:bg-surface-2`,quiet:`bg-transparent text-fg-2 hover:bg-surface-2 hover:text-fg`,danger:`bg-transparent text-bad hover:bg-bad-soft`},Ze={sm:`h-7 px-2.5 text-sm`,md:`h-9 px-3.5 text-base`};function Qe(e=`secondary`,t=`md`,n){return N(Ye,Xe[e],Ze[t],n)}function B({variant:e=`secondary`,size:t=`md`,icon:n,busy:r,children:i,className:a,href:o,...s}){let c=(0,P.jsxs)(P.Fragment,{children:[(n||r)&&(0,P.jsx)(F,{name:r?`progress_activity`:n,className:`ms-sm`}),i]}),l=Qe(e,t,a);return o?(0,P.jsx)(ge,{href:o,className:l,title:s.title,"aria-label":s[`aria-label`],onClick:s.onClick,children:c}):(0,P.jsx)(`button`,{type:`button`,className:l,...s,disabled:r||s.disabled,children:c})}function V({icon:e,label:t,variant:n=`quiet`,size:r=`md`,className:i,href:a,...o}){let s=N(`inline-grid shrink-0 place-items-center rounded-control transition-colors cursor-pointer disabled:opacity-45 disabled:cursor-default no-underline`,n===`danger`?`text-bad hover:bg-bad-soft`:`text-fg-2 hover:bg-surface-2 hover:text-fg`,r===`sm`?`size-7`:`size-8`,i);return a?(0,P.jsx)(ge,{href:a,className:s,title:t,"aria-label":t,children:(0,P.jsx)(F,{name:e,className:`ms-sm`})}):(0,P.jsx)(`button`,{type:`button`,className:s,title:t,"aria-label":t,...o,children:(0,P.jsx)(F,{name:e,className:`ms-sm`})})}function $e({n:e,tone:t=`bad`,title:n}){return e?(0,P.jsx)(`span`,{"data-ui":`badge`,className:N(`inline-grid h-[18px] min-w-[18px] shrink-0 place-items-center rounded-full px-1.5 text-2xs font-bold tabular-nums`,t===`bad`?`bg-bad text-on-bad`:`bg-surface-2 text-fg-2`),title:n,"aria-label":n??`${e}`,children:e}):null}function H({tone:e,title:t}){return(0,P.jsx)(`span`,{"data-ui":`dot`,"data-tone":e,title:t,className:N(`inline-block size-2 shrink-0 rounded-full`,e===`ok`&&`bg-ok`,e===`bad`&&`bg-bad`,e===`ask`&&`bg-ask`,e===`live`&&`bg-live`,e===`working`&&`animate-pulse bg-accent`,e===`idle`&&`border-[1.5px] border-line`)})}function U({children:e,tone:t=`neutral`,title:n,href:r,className:i}){let a=N(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-2xs font-semibold no-underline`,t===`neutral`&&`bg-surface-2 text-fg-2`,t===`ok`&&`bg-ok-soft text-ok`,t===`bad`&&`bg-bad-soft text-on-bad-soft`,t===`ask`&&`bg-ask-soft text-on-ask-soft`,t===`accent`&&`bg-accent-soft text-on-accent-soft`,r&&`transition-opacity hover:opacity-80`,i);return r?(0,P.jsx)(ge,{href:r,title:n,className:a,children:e}):(0,P.jsx)(`span`,{title:n,className:a,children:e})}function et({children:e,className:t,...n}){return(0,P.jsx)(`kbd`,{className:N(`rounded-[5px] border border-line px-[5px] py-[3px] font-mono text-[10.5px] leading-none text-fg-2`,t),...n,children:e})}function W({children:e,className:t}){return(0,P.jsx)(`p`,{className:N(`m-0 text-xs text-fg-2 [&_code]:text-2xs`,t),children:e})}function G({icon:e,children:t,action:n,className:r}){return(0,P.jsxs)(`div`,{className:N(`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-fg-2`,r),children:[e&&(0,P.jsx)(F,{name:e,className:`text-[32px] opacity-70`}),(0,P.jsx)(`div`,{children:t}),n]})}function K({tone:e=`neutral`,children:t}){return(0,P.jsxs)(`div`,{className:N(`flex items-center gap-1.5 px-1.5 py-1 text-sm`,e===`bad`?`text-bad`:`text-fg-2`),children:[e===`bad`&&(0,P.jsx)(F,{name:`error`,className:`ms-sm`}),t]})}function tt({children:e,className:t}){return(0,P.jsx)(`span`,{className:N(`text-2xs font-semibold uppercase tracking-[0.08em] text-fg-2`,t),children:e})}function nt({title:e,count:t,action:n,size:r=`sm`,children:i,className:a}){return r===`lg`?(0,P.jsxs)(`section`,{className:N(`mt-4 border-t border-line pt-4 first:mt-0 first:border-t-0 first:pt-0`,a),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pb-1.5`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-[17px] leading-tight font-[750] tracking-[-0.01em] text-fg first-letter:uppercase`,children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2 py-px text-xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),i]}):(0,P.jsxs)(`section`,{className:N(`mt-3 first:mt-0`,a),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pb-1 pt-1`,children:[(0,P.jsx)(tt,{children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),i]})}function q({title:e,count:t,actions:n,children:r,className:i}){return(0,P.jsxs)(`section`,{className:N(`overflow-hidden rounded-card border border-line bg-surface`,i),children:[(e||n)&&(0,P.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-line px-[18px] py-2`,children:[e&&(0,P.jsx)(tt,{className:`whitespace-nowrap text-fg`,children:e}),t!==void 0&&t>0&&(0,P.jsx)(`span`,{className:`text-xs font-bold tabular-nums text-bad`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),r]})}function rt({children:e,size:t=`md`,className:n}){return(0,P.jsx)(`h1`,{className:N(`m-0 font-semibold tracking-[-0.01em] text-fg`,t===`lg`?`text-2xl`:`text-xl`,n),children:e})}function it({title:e,sub:t,actions:n,icon:r}){return(0,P.jsxs)(`header`,{className:`flex flex-wrap items-center gap-3`,children:[typeof r==`string`?(0,P.jsx)(F,{name:r,className:`text-[26px] text-fg-2`}):r,(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(rt,{children:e}),t&&(0,P.jsx)(`div`,{className:`text-sm text-fg-2`,children:t})]}),(0,P.jsx)(`span`,{className:`flex-1`}),n]})}function at({children:e,width:t=`wide`,className:n}){return(0,P.jsx)(`div`,{className:N(`mx-auto flex w-full animate-rise flex-col gap-4`,t===`narrow`?`new-chat max-w-[640px]`:`max-w-[960px]`,n),children:e})}function ot({children:e}){return(0,P.jsx)(`span`,{className:`grid size-14 flex-none place-items-center rounded-full bg-accent-soft text-[28px] leading-none`,children:e})}function st({name:e}){return(0,P.jsx)(`span`,{className:`grid size-8 flex-none place-items-center rounded-full bg-accent-soft text-on-accent-soft`,children:(0,P.jsx)(F,{name:e,className:`text-[17px]`})})}function ct({icon:e,title:t,children:n,action:r,className:i,...a}){return(0,P.jsxs)(`div`,{className:N(`flex items-center gap-3.5 px-[18px] py-3`,i),...a,children:[(0,P.jsx)(st,{name:e}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[(0,P.jsx)(`span`,{className:`flex items-center gap-2 text-[13.5px] font-medium text-fg`,children:t}),n]}),r]})}function lt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-col divide-y divide-line py-1`,t),children:e})}var ut=(0,v.createContext)(!1);function dt({compact:e=!1,children:t}){return(0,P.jsx)(ut.Provider,{value:e,children:(0,P.jsx)(`div`,{className:`py-1 [&>*+*]:border-t [&>*+*]:border-line`,children:t})})}function ft({label:e,dim:t,mono:n,children:r}){let i=(0,v.useContext)(ut);return(0,P.jsxs)(`div`,{className:N(`flex`,i?`items-baseline gap-3 px-3.5 py-1.5`:`flex-col gap-[3px] px-[18px] py-2.5`),children:[(0,P.jsx)(tt,{className:N(i&&`w-[84px] flex-none`),children:e}),(0,P.jsx)(`span`,{className:N(`flex min-w-0 flex-wrap items-center gap-2 break-words`,i?`text-xs`:`text-[12.5px]`,t?`text-fg-2`:`text-fg`,n&&`font-mono break-all`),children:r})]})}function J({leading:e,title:t,sub:n,subTone:r=`plain`,meta:i,actions:a,href:o,onClick:s,active:c,dim:l,size:u=`md`,className:d,titleExtra:f,label:p,over:m,actionsAlways:h,innerProps:g,titleLines:_=1}){let v=(0,P.jsxs)(P.Fragment,{children:[e!==void 0&&(0,P.jsx)(`span`,{className:`grid w-6 shrink-0 place-items-center text-[15px] text-fg-2`,children:e}),(0,P.jsxs)(`span`,{className:`grid min-w-0 flex-1`,children:[m&&(0,P.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg-2`,children:m}),(0,P.jsxs)(`span`,{className:N(`flex min-w-0 items-center gap-1.5 text-fg`,m?`font-normal`:`font-semibold`,u===`sm`?`text-sm`:`text-base`),children:[(0,P.jsx)(`span`,{className:N(`min-w-0`,_===2?`line-clamp-2 leading-snug [overflow-wrap:anywhere]`:`truncate`),children:t}),f]}),n&&(0,P.jsx)(`span`,{className:N(`truncate text-xs`,r===`bad`?`text-bad`:r===`accent`?`text-accent`:`text-fg-2`),children:n})]}),i!==void 0&&(0,P.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-2`,children:i})]}),y=N(`flex min-w-0 flex-1 items-center gap-2.5 rounded-control text-left no-underline text-inherit`,u===`sm`?`px-2.5 py-1.5`:`px-2.5 py-2`,(o||s)&&`cursor-pointer`,l&&`opacity-55`),b=o?(0,P.jsx)(ge,{href:o,onClick:s,className:y,"aria-label":p,"aria-current":c?`page`:void 0,...g,children:v}):s?(0,P.jsx)(`button`,{type:`button`,onClick:s,className:N(y,`border-0 bg-transparent font-[inherit]`),"aria-label":p,...g,children:v}):(0,P.jsx)(`div`,{className:y,children:v});return(0,P.jsxs)(`div`,{className:N(`group/row relative flex items-center rounded-control transition-colors`,c?`bg-surface shadow-[inset_0_0_0_1px_var(--line)]`:(o||s)&&`hover:bg-surface-2`,d),children:[b,a&&(0,P.jsx)(`span`,{className:N(`flex shrink-0 items-center gap-0.5 pr-1.5`,!h&&`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 pointer-coarse:opacity-100`),children:a})]})}function pt({items:e,value:t,onChange:n,className:r,label:i,bare:a}){return(0,P.jsx)(`div`,{role:`tablist`,"aria-label":i,className:N(`flex flex-wrap gap-x-4 max-[800px]:flex-nowrap max-[800px]:overflow-x-auto max-[800px]:overflow-y-hidden max-[800px]:[scrollbar-width:none] max-[800px]:[&>*]:flex-none`,!a&&`border-b border-line px-4`,r),children:e.map(e=>{let r=e.id===t,i=N(`-mb-px inline-flex cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-0 pt-2 pb-[7px] text-sm font-semibold no-underline transition-colors`,r?`border-accent text-accent`:`border-transparent text-fg-2 hover:text-fg`),a=(0,P.jsxs)(P.Fragment,{children:[e.label,e.count!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums opacity-70`,children:e.count})]});return e.href?(0,P.jsx)(ge,{href:e.href,role:`tab`,"aria-selected":r,className:i,children:a},e.id):(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n?.(e.id),className:i,children:a},e.id)})})}var mt=`rounded-control border border-line bg-surface text-fg placeholder:text-fg-2 focus:border-accent focus:outline-none disabled:opacity-60`,ht=[[/^font-(sans|mono|reading|serif)$/,/^font-(sans|mono|reading|serif)$/],[/^text-(2xs|xs|sm|base|md|lg|xl)$/,/^text-(2xs|xs|sm|base|md|lg|xl|2xl|\[\d)/],[/^w-/,/^w-/],[/^h-/,/^h-/],[/^px-/,/^px-/],[/^pr-/,/^(pr|px)-/],[/^py-/,/^py-/],[/^leading-/,/^leading-/]];function gt(e,t){let n=(t??``).split(/\s+/).filter(Boolean);return N(mt,...e.split(` `).filter(e=>{let t=ht.find(([t])=>t.test(e));return!t||!n.some(e=>t[1].test(e))}),t)}var Y=(0,v.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`input`,{ref:n,className:gt(`w-full h-9 px-3 font-sans text-base`,e),...t})}),_t=(0,v.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`textarea`,{ref:n,className:gt(`w-full px-3 py-2 font-sans text-base leading-normal`,e),...t})});function vt({className:e,children:t,...n}){return(0,P.jsx)(`select`,{className:gt(`w-full h-9 cursor-pointer px-3 pr-8 font-sans text-base`,e),...n,children:t})}function X({label:e,hint:t,children:n,className:r}){return(0,P.jsxs)(`label`,{className:N(`flex flex-col gap-1.5`,r),children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e}),n,t&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:t})]})}function yt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-col gap-3.5 p-[18px]`,t),children:e})}function bt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-wrap items-end gap-2.5 max-[900px]:flex-col max-[900px]:items-stretch`,t),children:e})}function xt({checked:e,onChange:t,children:n,hint:r,mono:i,disabled:a,className:o}){return(0,P.jsxs)(`label`,{className:N(`flex cursor-pointer items-center gap-2 text-sm text-fg`,a&&`cursor-default opacity-60`,o),children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`size-[15px] flex-none accent-accent`,checked:e,disabled:a,onChange:e=>t(e.target.checked)}),(0,P.jsxs)(`span`,{className:`min-w-0`,children:[i?(0,P.jsx)(`b`,{className:`font-mono text-xs font-semibold`,children:n}):n,r&&(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[` — `,r]})]})]})}function St({checked:e}){return(0,P.jsx)(`span`,{"aria-hidden":!0,className:N(`relative inline-block h-6 w-11 flex-none rounded-full border-2 transition-colors`,e?`border-accent bg-accent`:`border-line bg-surface-2`),children:(0,P.jsx)(`span`,{className:N(`absolute top-1/2 size-4 -translate-y-1/2 rounded-full transition-[left,background-color]`,e?`left-[22px] bg-on-accent`:`left-1 bg-fg-2`)})})}function Ct({checked:e,onChange:t,label:n,disabled:r}){return(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,title:n,disabled:r,onClick:()=>t(!e),className:`inline-flex flex-none cursor-pointer border-0 bg-transparent p-0 disabled:cursor-default disabled:opacity-50`,children:(0,P.jsx)(St,{checked:e})})}function wt({label:e,hint:t,checked:n,onChange:r}){return(0,P.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-4 rounded-control border-0 bg-transparent py-2 pr-3 pl-2 text-left transition-colors hover:bg-surface-2`,role:`switch`,"aria-checked":n,onClick:()=>r(!n),children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`text-base text-fg`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:t})]}),(0,P.jsx)(St,{checked:n})]})}function Tt({title:e,count:t,back:n,action:r,divided:i}){return(0,P.jsxs)(`div`,{className:N(`flex min-h-11 items-center gap-2 pt-3 pb-1`,i?`mt-2.5 border-t border-line px-2`:`px-3.5`),children:[n&&(0,P.jsx)(V,{icon:`arrow_back`,label:n.label,size:`sm`,href:n.href,className:`-ml-1.5`}),(0,P.jsx)(tt,{children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),r]})}function Et({icon:e=`search`,...t}){return(0,P.jsxs)(`label`,{className:`relative mx-2 mt-1 mb-1 block`,children:[(0,P.jsx)(F,{name:e,className:`ms-sm pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-fg-2`}),(0,P.jsx)(Y,{type:`search`,className:`h-8 rounded-full pl-8 text-sm`,...t})]})}function Dt({children:e,label:t,className:n}){let r=N(`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,n);return t?(0,P.jsx)(`nav`,{className:r,"aria-label":t,children:e}):(0,P.jsx)(`div`,{className:r,children:e})}function Ot({children:e,className:t}){return(0,P.jsx)(`p`,{className:N(`m-0 px-3 py-2.5 text-xs text-fg-2`,t),children:e})}function kt({trigger:e,children:t,align:n=`start`,className:r}){let[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>e.key===`Escape`&&a(!1);return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[i]),(0,P.jsxs)(`span`,{ref:o,className:`relative inline-flex`,children:[e({open:i,toggle:()=>a(e=>!e)}),i&&(0,P.jsx)(`div`,{role:`menu`,className:N(`absolute top-[calc(100%+6px)] z-50 min-w-[260px] overflow-hidden rounded-card border border-line bg-surface p-1.5 shadow-pop`,n===`end`?`right-0`:`left-0`,r),children:t(()=>a(!1))})]})}var At=null,jt=new Set,Mt;async function Nt(){try{let e=await A.request(`attention.list`);if(e.ok){At=e.data.items;for(let e of jt)e()}}catch{}Mt=setTimeout(()=>void Nt(),3e3)}function Pt(e){return jt.add(e),jt.size===1&&Nt(),()=>{jt.delete(e),jt.size===0&&Mt&&clearTimeout(Mt)}}function Ft(){Mt&&clearTimeout(Mt),Nt()}function It(){return(0,v.useSyncExternalStore)(Pt,()=>At)}var Lt={agent:(e,t)=>e.filter(e=>e.owner.agent?.slug===t),project:(e,t,n=[])=>e.filter(e=>e.owner.project?.slug===t||!!e.owner.agent&&n.includes(e.owner.agent.slug)),channel:(e,t)=>e.filter(e=>e.owner.channel===t),general:e=>e.filter(e=>e.owner.general)},Rt=e=>e===`approval`?`front_hand`:e===`question`?`help`:e===`runner`?`event_busy`:`error`,zt=e=>e===`approval`?`needs approval`:e===`question`?`asks you`:e===`runner`?`no runner`:`failed`;function Bt(e){let t=e.agent?`${e.agent.emoji?`${e.agent.emoji} `:``}${e.agent.name}`:``;return[e.project?`📁 ${e.project.title}`:e.channel?`#${e.channel}`:e.general?`Ralv`:e.workflow?`${e.workflow} run`:``,t].filter(Boolean).join(` · `)||`workspace`}var Vt=e=>new URLSearchParams(e.split(`?`)[1]??``).get(`focus`),Ht=e=>e.split(`?`)[0];function Ut(e,t){if(e.length!==0)return e[(e.findIndex(e=>e.href===t||Vt(t)===null&&Ht(e.href)===t)+1)%e.length]}function Wt(e){e.notificationId&&A.request(`notifications.read`,{body:{ids:[e.notificationId]}}).then(()=>Ft()).catch(()=>{}),(window.location.hash.slice(1)||`/`)===e.href?window.dispatchEvent(new Event(Gt)):z(e.href)}var Gt=`kw-refocus`;function Kt(){let e=It()??[],t=Ut(e,I());return(0,v.useEffect)(()=>{let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.code!==`KeyN`)return;let t=Ut(At??[],window.location.hash.slice(1)||`/`);t&&(e.preventDefault(),Wt(t))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),t?(0,P.jsxs)(`button`,{type:`button`,className:`next-btn inline-flex h-8 cursor-pointer items-center gap-2 rounded-control border-0 bg-bad/12 px-1.5 font-[inherit] text-sm text-fg hover:bg-bad/18`,onClick:()=>Wt(t),title:`next: ${Bt(t.owner)} — ${t.title} (⌥N)`,children:[(0,P.jsx)(`span`,{className:`next-n inline-grid h-5 min-w-5 place-items-center rounded-full bg-bad px-1.5 text-2xs font-bold tabular-nums text-on-bad`,children:e.length}),(0,P.jsx)(`span`,{className:`text-fg-2 max-[640px]:hidden`,children:`waiting`}),(0,P.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-0.5 rounded-md bg-bad pl-2.5 pr-2 font-semibold text-on-bad`,children:[`next `,(0,P.jsx)(F,{name:`arrow_forward`,className:`ms-sm`})]}),(0,P.jsx)(et,{className:`mr-1 max-[800px]:hidden`,"aria-hidden":!0,children:`⌥N`})]}):null}function qt(){let e=I(),t=Vt(e),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{let e=()=>r(e=>e+1);return window.addEventListener(Gt,e),()=>window.removeEventListener(Gt,e)},[]),(0,v.useEffect)(()=>{if(!t)return;let e=0,n=setInterval(()=>{let r=document.querySelector(`[data-request="${CSS.escape(t)}"]`);r?(clearInterval(n),r.scrollIntoView({block:`center`,behavior:`smooth`}),r.classList.remove(`focus-flash`),r.offsetWidth,r.classList.add(`focus-flash`)):++e>40&&clearInterval(n)},150);return()=>clearInterval(n)},[t,e,n])}function Jt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yt=Jt();function Xt(e){Yt=e}var Zt={exec:()=>null};function Qt(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(en.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var $t=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),en={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Qt(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Qt(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Qt(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Qt(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Qt(e=>RegExp(`^ {0,${e}}(?:</?(?:${gn})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Qt(e=>RegExp(`^ {0,${e}}>`))},tn=/^(?:[ \t]*(?:\n|$))+/,nn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,an=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,on=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,sn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,cn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ln=Z(cn).replace(/bull/g,sn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),un=Z(cn).replace(/bull/g,sn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),dn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,fn=/^[^\n]+/,pn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mn=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,pn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hn=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,sn).getRegex(),gn=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,_n=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vn=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,_n).replace(`tag`,gn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yn=e=>Z(dn).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex(),bn=yn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),xn=yn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Sn={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,xn).getRegex(),code:nn,def:mn,fences:rn,heading:on,hr:an,html:vn,lheading:ln,list:hn,newline:tn,paragraph:bn,table:Zt,text:fn},Cn=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex(),wn={...Sn,lheading:un,table:Cn,paragraph:Z(dn).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Cn).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex()},Tn={...Sn,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,_n).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(dn).replace(`hr`,an).replace(`heading`,` *#{1,6} *[^
10
+ `).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&Qt(e,``+r);else return;break;case`className`:Lt(e,`class`,r);break;case`tabIndex`:Lt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Lt(e,n,r);break;case`style`:en(e,r,o);return;case`data`:if(t!==`object`){Lt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=an(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=on);return;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=an(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Bf(`beforetoggle`,e),Bf(`toggle`,e),It(e,`popover`,r);break;case`xlinkActuate`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Rt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Rt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:It(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=nn.get(n)||n,It(e,n,r);else return}Pt=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:en(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)Qt(e,r);else if(typeof r==`number`||typeof r==`bigint`)Qt(e,``+r);else return;break;case`onScroll`:r!=null&&Bf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Bf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=on);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Dt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[pt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Pt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):It(e,n,r)}return}Pt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Bf(`error`,e),Bf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:Bf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}qt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Bf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Yt(e,!!r,n,!0):Yt(e,!!r,t,!1);return;case`textarea`:for(s in Bf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}Zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:Bf(`beforetoggle`,e),Bf(`toggle`,e),Bf(`cancel`,e),Bf(`close`,e);break;case`iframe`:case`object`:Bf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Lf.length;r++)Bf(Lf[r],e);break;case`image`:Bf(`error`,e),Bf(`load`,e);break;case`details`:Bf(`toggle`,e);break;case`embed`:case`source`:case`link`:Bf(`error`,e),Bf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(tn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Pt=!0),o=m;break;case`name`:m!==f&&(Pt=!0),a=m;break;case`checked`:m!==f&&(Pt=!0),u=m;break;case`defaultChecked`:m!==f&&(Pt=!0),d=m;break;case`value`:m!==f&&(Pt=!0),s=m;break;case`defaultValue`:m!==f&&(Pt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}Kt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Pt=!0),p=o;break;case`defaultValue`:o!==l&&(Pt=!0),c=o;break;case`multiple`:o!==l&&(Pt=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Yt(e,!!n,n?[]:``,!1):Yt(e,!!n,t,!0)):Yt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Pt=!0),p=a;break;case`defaultValue`:a!==o&&(Pt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}Xt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Pt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(tn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[J]=r,n[pt]=t,np(n,e,t),wt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[vt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),m(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),m(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){m(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];m(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&m(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),m(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag!==6&&(e=b(e),t.observe(e),!1)}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),m(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag!==6&&(e=b(e),t.unobserve(e),!1)}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return m(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];m(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=bt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(m(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(m(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];m(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),yt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[vt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===on&&(e.onclick=null),yt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);yt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=z.d;z.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Id();return e||t}function Cm(e){var t=xt(e);t!==null&&t.tag===5&&t.type===`form`?Ks(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=Gt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),wt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+Gt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Gt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Gt(n.imageSizes)+`"]`)):i+=`[href="`+Gt(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[X]=!0,o.onload=o.onerror=function(){Tt(o)}),wt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Gt(r)+`"][href="`+Gt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),wt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Ct(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);wt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Ct(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Ct(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),wt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=xe.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Ct(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=Ct(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Ct(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+Gt(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[X]){r.loading=1;return}}else t=e.createElement(`link`),t[X]=!0,t.onload=t.onerror=Tt.bind(null,t),np(t,`link`,n),wt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+Gt(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Gt(n.href)+`"]`);if(r)return t.instance=r,wt(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),wt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,wt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),wt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,wt(a),a):(r=n,(a=vm.get(o))&&(r=D({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),wt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[vt]||a[J]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,wt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),wt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:N,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=q(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=q(0),this.hiddenUpdates=q(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=yi(3,null,null,t),e.current=a,a.stateNode=e,t=ba(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},no(a),e}function uh(e){return e?(e=_i,e):_i}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=io(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ao(e,r,t),n!==null&&(jd(n,e,t),oo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=mi(e,67108864);t!==null&&jd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=Od();t=ct(t);var n=mi(e,t);n!==null&&jd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=2,yh(e,t,n,r)}finally{z.p=a,R.T=i}}function vh(e,t,n,r){var i=R.T;R.T=null;var a=z.p;try{z.p=8,yh(e,t,n,r)}finally{z.p=a,R.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=xt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=et(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ze(o);s.entanglements[1]|=c,o&=~c}wf(a),!(Ku&6)&&(pd=ze()+500,Tf(0,!1))}}break;case 31:case 13:s=mi(a,2),s!==null&&jd(s,a,2),Id(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=cn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=bt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Be()){case Ve:return 2;case He:return 8;case Ue:case We:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=xt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=bt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,dt(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,dt(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);sn=r,n.target.dispatchEvent(r),sn=null}else return t=xt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=xt(n);a!==null&&(e.splice(t,3),t-=3,Ws(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[pt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[pt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,Od(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Id(),t[mt]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=ut();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.0`)throw Error(i(527,Kh,`19.3.0`));z.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:R,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Je=Jh.inject(qh),Ye=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=pc,s=mc,c=hc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[mt]=t.current,Uf(e),new Wh(t)}})),_=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=l(d(),1),y=_(),b={"agents.addJournal":[`POST`,`/api/agents/:slug/journal`],"agents.adoptRoutine":[`POST`,`/api/agents/:slug/routines/:id/adopt`],"agents.archive":[`POST`,`/api/agents/:slug/archive`],"agents.create":[`POST`,`/api/agents`],"agents.delete":[`DELETE`,`/api/agents/:slug`],"agents.deleteRoutine":[`DELETE`,`/api/agents/:slug/routines/:id`],"agents.deleteSkill":[`DELETE`,`/api/agents/:slug/skills/:name`],"agents.get":[`GET`,`/api/agents/:slug`],"agents.journal":[`GET`,`/api/agents/:slug/journal`],"agents.list":[`GET`,`/api/agents`],"agents.routines":[`GET`,`/api/agents/:slug/routines`],"agents.runRoutine":[`POST`,`/api/agents/:slug/routines/:id/run`],"agents.save":[`PUT`,`/api/agents/:slug`],"agents.saveRoutine":[`POST`,`/api/agents/:slug/routines`],"agents.saveSkill":[`POST`,`/api/agents/:slug/skills`],"agents.sessions":[`GET`,`/api/agent-sessions`],"agents.skill":[`GET`,`/api/agents/:slug/skills/:name`],"agents.skills":[`GET`,`/api/agents/:slug/skills`],"agents.status":[`GET`,`/api/agent-status`],"attention.list":[`GET`,`/api/attention`],"channels.create":[`POST`,`/api/channels`],"channels.delete":[`DELETE`,`/api/channels/:slug`],"channels.fromChat":[`POST`,`/api/channels/from-chat`],"channels.get":[`GET`,`/api/channels/:slug`],"channels.list":[`GET`,`/api/channels`],"channels.save":[`PUT`,`/api/channels/:slug`],"chats.attach":[`POST`,`/api/chats/:id/attachments`,`upload`],"chats.attachment":[`GET`,`/api/chats/:id/attachments/:name`,`raw`],"chats.cancel":[`POST`,`/api/chats/:id/cancel`],"chats.config":[`POST`,`/api/chats/:id/config`],"chats.create":[`POST`,`/api/chats`],"chats.delete":[`DELETE`,`/api/chats/:id`],"chats.elicitation":[`POST`,`/api/chats/:id/elicitation`],"chats.events":[`GET`,`/api/chats/:id/events`,`raw`],"chats.fork":[`POST`,`/api/chats/:id/fork`],"chats.get":[`GET`,`/api/chats/:id`],"chats.list":[`GET`,`/api/chats`],"chats.message":[`POST`,`/api/chats/:id/message`],"chats.permission":[`POST`,`/api/chats/:id/permission`],"chats.rename":[`PATCH`,`/api/chats/:id`],"chats.resetSession":[`POST`,`/api/chats/:id/reset-session`],"chats.setProject":[`POST`,`/api/chats/:id/project`],"chats.setVibeable":[`POST`,`/api/chats/:id/vibeable`],"chats.steer":[`POST`,`/api/chats/:id/steer`],"chats.stopTask":[`POST`,`/api/chats/:id/task-stop`],"cloud.invite":[`POST`,`/api/cloud/invite`],"cloud.set":[`POST`,`/api/cloud`],"cloud.status":[`GET`,`/api/cloud`],"cloud.sync":[`POST`,`/api/cloud/sync`],"cloud.unlink":[`POST`,`/api/cloud/unlink`],"devices.code":[`POST`,`/api/devices/code`],"devices.dropPush":[`DELETE`,`/api/devices/push`],"devices.list":[`GET`,`/api/devices`],"devices.pair":[`POST`,`/api/pair`],"devices.relay":[`GET`,`/api/devices/relay`],"devices.revoke":[`DELETE`,`/api/devices/:id`],"devices.self":[`GET`,`/api/devices/self`],"devices.setPush":[`POST`,`/api/devices/push`],"devices.setRelay":[`POST`,`/api/devices/relay`],"files.delete":[`DELETE`,`/api/files`],"files.list":[`GET`,`/api/files/list`],"files.mkdir":[`POST`,`/api/files/folder`],"files.move":[`POST`,`/api/files/move`],"files.raw":[`GET`,`/api/files/raw`,`raw`],"files.recent":[`GET`,`/api/files/recent`],"files.scopes":[`GET`,`/api/files`],"files.upload":[`POST`,`/api/files/upload`,`upload`],"git.commit":[`POST`,`/api/git/commit`],"git.diff":[`GET`,`/api/git/diff`],"git.fetch":[`POST`,`/api/git/fetch`],"git.pull":[`POST`,`/api/git/pull`],"git.push":[`POST`,`/api/git/push`],"git.status":[`GET`,`/api/git`],"hub.close":[`POST`,`/api/hub/close`],"hub.list":[`GET`,`/api/hub`],"hub.open":[`POST`,`/api/hub/open`],"identity.get":[`GET`,`/api/identity`],"knowledge.concept":[`GET`,`/api/knowledge/:bundle/concept`],"knowledge.create":[`POST`,`/api/knowledge`],"knowledge.delete":[`DELETE`,`/api/knowledge/:bundle`],"knowledge.get":[`GET`,`/api/knowledge/:bundle`],"knowledge.list":[`GET`,`/api/knowledge`],"knowledge.putConcept":[`POST`,`/api/knowledge/:bundle/concept`],"knowledge.verify":[`POST`,`/api/knowledge/:bundle/verify`],"meta.get":[`GET`,`/api/meta`],"notifications.clear":[`DELETE`,`/api/notifications`],"notifications.diagnose":[`POST`,`/api/notifications/:id/diagnose`],"notifications.list":[`GET`,`/api/notifications`],"notifications.read":[`POST`,`/api/notifications/read`],"projects.create":[`POST`,`/api/projects`],"projects.delete":[`DELETE`,`/api/projects/:slug`],"projects.get":[`GET`,`/api/projects/:slug`],"projects.link":[`POST`,`/api/projects/:slug/links`],"projects.list":[`GET`,`/api/projects`],"projects.log":[`POST`,`/api/projects/:slug/log`],"projects.save":[`PUT`,`/api/projects/:slug`],"projects.saveLayout":[`PUT`,`/api/projects`],"protocol.get":[`GET`,`/api/protocol`],"repos.add":[`POST`,`/api/repos`],"repos.commit":[`GET`,`/api/repos/:slug/commits/:hash`],"repos.diff":[`GET`,`/api/repos/:slug/diff`],"repos.get":[`GET`,`/api/repos/:slug`],"repos.list":[`GET`,`/api/repos`],"repos.remove":[`DELETE`,`/api/repos/:slug`],"repos.update":[`POST`,`/api/repos/:slug/update`],"routines.adopt":[`POST`,`/api/routines/adopt`],"routines.list":[`GET`,`/api/routines`],"runs.decide":[`POST`,`/api/runs/:id/decision`],"runs.delete":[`DELETE`,`/api/runs/:id`],"runs.file":[`GET`,`/api/runs/:id/file`,`raw`],"runs.fileText":[`GET`,`/api/runs/:id/text`],"runs.get":[`GET`,`/api/runs/:id`],"runs.list":[`GET`,`/api/runs`],"runs.stop":[`POST`,`/api/runs/:id/stop`],"search.agents":[`GET`,`/api/search/agents`],"server.restart":[`POST`,`/api/restart`],"settings.get":[`GET`,`/api/settings`],"settings.save":[`PUT`,`/api/settings`],"skills.get":[`GET`,`/api/skills/:name`],"skills.list":[`GET`,`/api/skills`],"trash.empty":[`DELETE`,`/api/trash`],"trash.list":[`GET`,`/api/trash`],"trash.purge":[`POST`,`/api/trash/purge`],"trash.restore":[`POST`,`/api/trash/restore`],"update.check":[`GET`,`/api/update-check`],"update.start":[`POST`,`/api/update`],"update.status":[`GET`,`/api/update`],"vibeables.create":[`POST`,`/api/vibeables`],"vibeables.delete":[`DELETE`,`/api/vibeables/:slug`],"vibeables.devStart":[`POST`,`/api/vibeables/:slug/dev/start`],"vibeables.devStop":[`POST`,`/api/vibeables/:slug/dev/stop`],"vibeables.events":[`GET`,`/api/vibeables/:slug/events`,`raw`],"vibeables.get":[`GET`,`/api/vibeables/:slug`],"vibeables.list":[`GET`,`/api/vibeables`],"workflows.delete":[`DELETE`,`/api/workflows/:slug`],"workflows.get":[`GET`,`/api/workflows/:slug`],"workflows.list":[`GET`,`/api/workflows`],"workflows.run":[`POST`,`/api/workflows/:slug/run`],"workflows.runner":[`GET`,`/api/workflows/:slug/run`],"workspaces.forget":[`POST`,`/api/workspaces/forget`],"workspaces.list":[`GET`,`/api/workspaces`],"workspaces.start":[`POST`,`/api/workspaces/start`],"workspaces.stop":[`POST`,`/api/workspaces/stop`]},x=1e4;function S(e){let t=e.WebSocket??(typeof WebSocket>`u`?void 0:WebSocket),n=e.EventSource??(typeof EventSource>`u`?void 0:EventSource),{client:r}=e,i=new Map,a=new Map,o=null,s=!1,c=!1,l=500,u,d=0,f=()=>`${(/^https?:/.test(r.baseUrl)?r.baseUrl:(typeof location>`u`?``:location.origin)+r.baseUrl).replace(/^http/,`ws`).replace(/\/+$/,``)}/api/ws${r.token?`?token=${encodeURIComponent(r.token)}`:``}`,p=e=>{s&&o?.send(JSON.stringify(e))},m=e=>{let t=i.get(e);t&&!s&&(clearTimeout(t.timer),r.request(t.name,t.input).then(n=>n.ok&&i.get(e)===t&&!s&&t.onData(n.data)).catch(()=>{}).finally(()=>{i.get(e)===t&&!s&&(t.timer=setTimeout(()=>m(e),t.interval))}))},h=e=>{let t=a.get(e);if(!t||s||t.source||!n)return;let[i,...o]=t.topic.split(`.`),c=o.join(`.`),l=i===`chat`?r.url(`chats.events`,{id:c,query:{after:t.after}}):i===`vibeable`?r.url(`vibeables.events`,{slug:c}):``;l&&(t.source=new n(l),t.source.onmessage=t=>g(e,JSON.parse(t.data)))},g=(e,t)=>{let n=a.get(e);if(!n)return;let r=t?.seq;if(typeof r==`number`){if(r<=n.after)return;n.after=r}n.onEvent(t)},_=r.onChange(()=>{if(!s)for(let e of i.keys())m(e)}),v=()=>{for(let[e,t]of i)clearTimeout(t.timer),p({watch:e,name:t.name,input:t.input,interval:t.interval});for(let[e,t]of a)t.source?.close(),t.source=void 0,p({sub:e,topic:t.topic,after:t.after})},y=()=>{for(let e of i.keys())m(e);for(let e of a.keys())h(e)},b=()=>{if(c||o||!t)return;let e;try{e=new t(f())}catch{return y()}o=e,e.onopen=()=>{s=!0,l=500,v()},e.onmessage=e=>{let t;try{t=JSON.parse(String(e.data))}catch{return}t.watch&&`data`in t?i.get(t.watch)?.onData(t.data):t.event&&g(t.event,t.data)},e.onclose=()=>{o=null,s=!1,!c&&(y(),u=setTimeout(b,l),l=Math.min(x,l*2))}};return{get connected(){return s},watch(e,t,n,r){let a=`w${++d}`;return i.set(a,{name:e,input:t??{},interval:n.interval??6e3,onData:r}),s?p({watch:a,name:e,input:t??{},interval:n.interval??6e3}):(m(a),b()),()=>{clearTimeout(i.get(a)?.timer),i.delete(a),p({unwatch:a})}},subscribe(e,t,n){let r=`s${++d}`;return a.set(r,{topic:e,after:t.after??0,onEvent:n}),s?p({sub:r,topic:e,after:t.after??0}):(h(r),b()),()=>{a.get(r)?.source?.close(),a.delete(r),p({unsub:r})}},close(){c=!0,_(),clearTimeout(u),o?.close();for(let e of i.values())clearTimeout(e.timer);for(let e of a.values())e.source?.close();i.clear(),a.clear()}}}var C=class extends Error{status;body;route;constructor(e,t,n){super(w(t)??`${n}: HTTP ${e}`),this.status=e,this.body=t,this.route=n}};function w(e){let t=e&&typeof e==`object`&&`error`in e?e.error:void 0;return typeof t==`string`&&t?t:void 0}function T(e={}){let t=(e.baseUrl??``).replace(/\/+$/,``)+(e.workspace?`/w/${encodeURIComponent(e.workspace)}`:``),n=e.fetch??((...e)=>fetch(...e)),r=new Set,i=(e,n={})=>{let[,r]=b[e],i=r.replace(/:([A-Za-z]+)/g,(t,r)=>{let i=n[r];if(i==null||i===``)throw Error(`${e}: missing path parameter ${r}`);return encodeURIComponent(String(i))}),a=new URLSearchParams;for(let[e,t]of Object.entries(n.query??{}))t!=null&&t!==!1&&a.set(e,t===!0?`1`:String(t));let o=a.toString();return`${t}${i}${o?`?${o}`:``}`},a=async(t,a={})=>{let[o]=b[t],{body:s,headers:c={},signal:l,keepalive:u}=a,d=s instanceof Blob||s instanceof ArrayBuffer||ArrayBuffer.isView(s),f=await n(i(t,a),{method:o,cache:`no-store`,signal:l,keepalive:u,headers:{...s!==void 0&&!d?{"content-type":`application/json`}:{},...e.token?{authorization:`Bearer ${e.token}`}:{},...c},body:s===void 0?void 0:d?s:JSON.stringify(s)}),p=await f.text(),m=p;try{m=p?JSON.parse(p):void 0}catch{}if(f.ok&&o!==`GET`)for(let e of r)e();return f.status===401&&m?.pair===!0&&e.onUnauthorized?.(),f.ok?{ok:!0,status:f.status,data:m}:{ok:!1,status:f.status,data:m,error:w(m)}};return{token:e.token,baseUrl:t,onChange(e){return r.add(e),()=>r.delete(e)},url:((e,t)=>i(e,t)),request:((e,t)=>a(e,t)),call:(async(e,t)=>{let n=await a(e,t);if(!n.ok)throw new C(n.status,n.data,e);return n.data})}}var E=!1,D=new Set;function O(){return(0,v.useSyncExternalStore)(e=>(D.add(e),()=>D.delete(e)),()=>E)}var k=/^\/w\/([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)\//.exec(location.pathname)?.[1],A=T({workspace:k,onUnauthorized:()=>{if(!E){E=!0;for(let e of D)e()}}}),ee=e=>e.startsWith(`/`)?A.baseUrl+e:e,te=S({client:A});function j(e){return e.ok?``:e.error??`HTTP ${e.status}`}function M(e,t,n={}){let[r,i]=(0,v.useState)(null),a=t===null?``:`${e} ${JSON.stringify(t)}`,o=(0,v.useRef)(t);o.current=t;let{fast:s=!1,interval:c=6e3,refresh:l}=n;return(0,v.useEffect)(()=>{if(a)return te.watch(e,o.current??void 0,{interval:s?1500:c},i)},[a,s,c,l]),r}function N(...e){return e.filter(Boolean).join(` `)}var ne=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),re=o(((e,t)=>{t.exports=ne()})),P=re();function F({name:e,fill:t,className:n}){return(0,P.jsx)(`span`,{className:`ms material-symbols-rounded${t?` ms-fill`:``}${e===`progress_activity`?` ms-spin`:``}${n?` ${n}`:``}`,"aria-hidden":!0,children:e})}function I(){let[e,t]=(0,v.useState)(()=>window.location.hash.slice(1)||`/`);return(0,v.useEffect)(()=>{let e=()=>t(window.location.hash.slice(1)||`/`);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]),e}var ie=`kraftwerk inspector`,ae=``,oe=0;function se(){let e=ae?`${ae} — ${ie}`:ie;document.title=oe>0?`(${oe}) ${e}`:e}function ce(e){e!==oe&&(oe=e,se())}function le(e){ie=e,se()}function ue(e){ae=e,se()}var de=new Set([`agents`,`team`,`chats`,`projects`,`channels`]),fe=e=>de.has(e.split(`?`)[0].split(`/`).filter(Boolean)[0]??``)?`chat`:`side`,L=`kw-column-path`;function R(e){let t=e.split(`/`).filter(Boolean),n=t[1]?decodeURIComponent(t[1]):``;return!n||n===`chats`?!1:n===`new`?[`projects`,`agents`,`team`,`channels`].includes(t[0])&&!t[2]:t[0]===`projects`?t[2]===`info`:t[0]===`agents`||t[0]===`team`?t[2]===`info`||t[2]===`edit`:t[0]===`channels`&&t[2]===`edit`}function z(e,t){let n=window.location.hash.slice(1)||`/`;if(t?.replace&&(fe(e)!==fe(n)||R(n)&&!R(e)&&fe(e)===`chat`)){window.dispatchEvent(new CustomEvent(L,{detail:e}));return}t?.replace?window.location.replace(`#${e}`):window.location.hash=e}function pe(e){if(!e.here||!e.slug)return e.url;let{protocol:t,hostname:n,port:r}=window.location;return k?`/w/${e.slug}/`:n.endsWith(`.localhost`)?`${t}//${e.slug}.localhost${r?`:${r}`:``}/`:n===`localhost`||n===`127.0.0.1`||n===`[::1]`?e.url:`/w/${e.slug}/`}async function me(e){let t=await A.request(`workspaces.start`,{body:{root:e}});if(!t.ok)throw Error(j(t));let n=t.data;if(n.live&&n.url)return pe({url:n.url,slug:n.slug,here:n.here});for(let t=0;t<12;t++){await new Promise(e=>setTimeout(e,1e3));try{let t=(await A.call(`meta.get`)).switcher.find(t=>t.root===e&&t.live);if(t)return pe(t)}catch{}}throw Error(`started, but the UI did not answer yet — see ~/.kraftwerk/logs`)}var he=(0,v.createContext)(null);function ge({href:e,onClick:t,...n}){let r=(0,v.useContext)(he);return(0,P.jsx)(`a`,{href:`#${e}`,onClick:n=>{t?.(n),!n.defaultPrevented&&r&&(n.metaKey||n.ctrlKey||n.shiftKey||n.button!==0||r(e)&&n.preventDefault())},...n})}var _e=`kw-expert`,ve=(()=>{try{return localStorage.getItem(_e)!==`off`}catch{return!0}})(),ye=new Set;document.documentElement.dataset.expert=ve?`on`:`off`;function be(e){ve=e,document.documentElement.dataset.expert=e?`on`:`off`;try{localStorage.setItem(_e,e?`on`:`off`)}catch{}ye.forEach(e=>e())}function xe(){return(0,v.useSyncExternalStore)(e=>(ye.add(e),()=>ye.delete(e)),()=>ve)}var Se={git:!1,repos:!1,vibeables:!1,projects:!1},Ce=new Set;function we(e){(e.git!==Se.git||e.repos!==Se.repos||e.vibeables!==Se.vibeables||e.projects!==Se.projects)&&(Se=e,Ce.forEach(e=>e()))}function Te(){return(0,v.useSyncExternalStore)(e=>(Ce.add(e),()=>Ce.delete(e)),()=>Se)}function Ee(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0)%360}function De(e,t){return e||`hsl(${Ee(t)} 58% 46%)`}function Oe(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(t){let e=t[1].length===3?t[1].split(``).map(e=>e+e).join(``):t[1];return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}let n=/^hsl\(\s*([\d.]+)[ ,]+([\d.]+)%[ ,]+([\d.]+)%/i.exec(e.trim());if(!n)return null;let r=n[1]/360,i=n[2]/100,a=n[3]/100,o=a<.5?a*(1+i):a+i-a*i,s=2*a-o,c=e=>(e=(e+1)%1,e<1/6?s+(o-s)*6*e:e<1/2?o:e<2/3?s+(o-s)*(2/3-e)*6:s);return[c(r+1/3),c(r),c(r-1/3)].map(e=>Math.round(e*255))}var ke=(e,t,n)=>e.map((e,r)=>Math.round(e+(t[r]-e)*n)),Ae=e=>`#`+e.map(e=>e.toString(16).padStart(2,`0`)).join(``);function je([e,t,n]){let r=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*r(e)+.7152*r(t)+.0722*r(n)}function Me(e,t){let n=je(e),r=je(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Ne(e,t,n,r){let i=e;for(let a=0;a<=1&&Me(i,t)<n;a+=.04)i=ke(e,r,a);return i}var Pe=[255,255,255],Fe=[0,0,0],Ie=[38,37,35];function Le(e){let t=Oe(e);if(!t)return null;let n=Ne(t,Pe,4.5,Fe),r=ke(t,Pe,.84),i=ke(t,Pe,.88),a=Ne(ke(t,Pe,.4),Ie,4.5,Pe),o=ke(t,Fe,.42),s=ke(t,Fe,.6);return{"--wsp-l-primary":Ae(n),"--wsp-l-on-primary":Ae(Pe),"--wsp-l-primary-container":Ae(r),"--wsp-l-on-primary-container":Ae(Ne(ke(t,Fe,.6),r,4.5,Fe)),"--wsp-l-secondary-container":Ae(i),"--wsp-l-on-secondary-container":Ae(Ne(ke(t,Fe,.65),i,4.5,Fe)),"--wsp-d-primary":Ae(a),"--wsp-d-on-primary":Ae(Ne(ke(t,Fe,.7),a,4.5,Fe)),"--wsp-d-primary-container":Ae(o),"--wsp-d-on-primary-container":Ae(Ne(ke(t,Pe,.8),o,4.5,Pe)),"--wsp-d-secondary-container":Ae(s),"--wsp-d-on-secondary-container":Ae(Ne(ke(t,Pe,.85),s,4.5,Pe))}}function Re(e){let t=e.split(/[^\p{L}\p{N}]+/u).filter(Boolean);return t.length===0?`?`:(t.length>=2?t[0][0]+t[1][0]:t[0].slice(0,2)).toUpperCase()}function ze({icon:e,name:t,color:n,seed:r,ambiguous:i,size:a=`md`,className:o}){let s={"--ws-c":De(n,r)};return(0,P.jsxs)(`span`,{className:N(`relative grid flex-none place-items-center rounded-full leading-none`,`bg-[color-mix(in_srgb,var(--ws-c,var(--text))_22%,var(--surface-2))]`,a===`sm`?`size-8`:`size-10`,e?a===`sm`?`text-[18px]`:`text-[22px]`:N(`font-sans font-medium tracking-[0.15px] text-[var(--ws-c,var(--text))]`,a===`sm`?`text-[13px]`:`text-base`),o),style:s,"aria-hidden":!0,children:[e||Re(t),e&&i&&(0,P.jsx)(`span`,{className:`absolute -right-[3px] -bottom-[3px] grid h-[18px] min-w-[18px] place-items-center rounded-full bg-[var(--ws-c,var(--text))] px-1 font-sans text-[10px] font-medium leading-none tracking-[0.4px] text-white shadow-[0_0_0_2px_var(--surface-1)]`,children:Re(t)})]})}var Be={emoji:`🧭`,name:`Assistant`};function Ve(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m${String(t%60).padStart(2,`0`)}s`}function He(e){return e==null?`—`:`$${e.toFixed(2)}`}function Ue(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function We(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} K`:`${(e/1024/1024).toFixed(1)} M`}function Ge(e){if(!e)return`—`;let t=new Date(e),n=new Date,r=t.toDateString()===n.toDateString(),i=t.toTimeString().slice(0,5);return r?i:`${t.toISOString().slice(5,10)} ${i}`}function Ke(e){if(!e)return`—`;let t=Date.now()-Date.parse(e);if(t<6e4)return`just now`;let n=Math.floor(t/6e4);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<7?`${i}d ago`:new Date(e).toISOString().slice(5,10)}function qe({since:e}){let[,t]=(0,v.useState)(0);return(0,v.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),e?(0,P.jsx)(`span`,{className:`tabular-nums`,children:Ve(Date.now()-Date.parse(e))}):null}var Je=[``,`low`,`medium`,`high`,`xhigh`,`max`],Ye=`inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-control font-medium transition-colors disabled:cursor-default disabled:opacity-45 focus-visible:outline-2 focus-visible:outline-live cursor-pointer no-underline`,Xe={primary:`bg-accent text-on-accent hover:bg-accent-hover`,secondary:`border border-line bg-transparent text-fg hover:bg-surface-2`,quiet:`bg-transparent text-fg-2 hover:bg-surface-2 hover:text-fg`,danger:`bg-transparent text-bad hover:bg-bad-soft`},Ze={sm:`h-7 px-2.5 text-sm`,md:`h-9 px-3.5 text-base`};function Qe(e=`secondary`,t=`md`,n){return N(Ye,Xe[e],Ze[t],n)}function B({variant:e=`secondary`,size:t=`md`,icon:n,busy:r,children:i,className:a,href:o,...s}){let c=(0,P.jsxs)(P.Fragment,{children:[(n||r)&&(0,P.jsx)(F,{name:r?`progress_activity`:n,className:`ms-sm`}),i]}),l=Qe(e,t,a);return o?(0,P.jsx)(ge,{href:o,className:l,title:s.title,"aria-label":s[`aria-label`],onClick:s.onClick,children:c}):(0,P.jsx)(`button`,{type:`button`,className:l,...s,disabled:r||s.disabled,children:c})}function V({icon:e,label:t,variant:n=`quiet`,size:r=`md`,className:i,href:a,...o}){let s=N(`inline-grid shrink-0 place-items-center rounded-control transition-colors cursor-pointer disabled:opacity-45 disabled:cursor-default no-underline`,n===`danger`?`text-bad hover:bg-bad-soft`:`text-fg-2 hover:bg-surface-2 hover:text-fg`,r===`sm`?`size-7`:`size-8`,i);return a?(0,P.jsx)(ge,{href:a,className:s,title:t,"aria-label":t,children:(0,P.jsx)(F,{name:e,className:`ms-sm`})}):(0,P.jsx)(`button`,{type:`button`,className:s,title:t,"aria-label":t,...o,children:(0,P.jsx)(F,{name:e,className:`ms-sm`})})}function $e({n:e,tone:t=`bad`,title:n}){return e?(0,P.jsx)(`span`,{"data-ui":`badge`,className:N(`inline-grid h-[18px] min-w-[18px] shrink-0 place-items-center rounded-full px-1.5 text-2xs font-bold tabular-nums`,t===`bad`?`bg-bad text-on-bad`:`bg-surface-2 text-fg-2`),title:n,"aria-label":n??`${e}`,children:e}):null}function H({tone:e,title:t}){return(0,P.jsx)(`span`,{"data-ui":`dot`,"data-tone":e,title:t,className:N(`inline-block size-2 shrink-0 rounded-full`,e===`ok`&&`bg-ok`,e===`bad`&&`bg-bad`,e===`ask`&&`bg-ask`,e===`live`&&`bg-live`,e===`working`&&`animate-pulse bg-accent`,e===`idle`&&`border-[1.5px] border-line`)})}function U({children:e,tone:t=`neutral`,title:n,href:r,className:i}){let a=N(`inline-flex h-5 shrink-0 items-center rounded-full px-2 text-2xs font-semibold no-underline`,t===`neutral`&&`bg-surface-2 text-fg-2`,t===`ok`&&`bg-ok-soft text-ok`,t===`bad`&&`bg-bad-soft text-on-bad-soft`,t===`ask`&&`bg-ask-soft text-on-ask-soft`,t===`accent`&&`bg-accent-soft text-on-accent-soft`,r&&`transition-opacity hover:opacity-80`,i);return r?(0,P.jsx)(ge,{href:r,title:n,className:a,children:e}):(0,P.jsx)(`span`,{title:n,className:a,children:e})}function et({children:e,className:t,...n}){return(0,P.jsx)(`kbd`,{className:N(`rounded-[5px] border border-line px-[5px] py-[3px] font-mono text-[10.5px] leading-none text-fg-2`,t),...n,children:e})}function W({children:e,className:t}){return(0,P.jsx)(`p`,{className:N(`m-0 text-xs text-fg-2 [&_code]:text-2xs`,t),children:e})}function G({icon:e,children:t,action:n,className:r}){return(0,P.jsxs)(`div`,{className:N(`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-fg-2`,r),children:[e&&(0,P.jsx)(F,{name:e,className:`text-[32px] opacity-70`}),(0,P.jsx)(`div`,{children:t}),n]})}function K({tone:e=`neutral`,children:t}){return(0,P.jsxs)(`div`,{className:N(`flex items-center gap-1.5 px-1.5 py-1 text-sm`,e===`bad`?`text-bad`:`text-fg-2`),children:[e===`bad`&&(0,P.jsx)(F,{name:`error`,className:`ms-sm`}),t]})}function tt({children:e,className:t}){return(0,P.jsx)(`span`,{className:N(`text-2xs font-semibold uppercase tracking-[0.08em] text-fg-2`,t),children:e})}function nt({title:e,count:t,action:n,size:r=`sm`,children:i,className:a}){return r===`lg`?(0,P.jsxs)(`section`,{className:N(`mt-4 border-t border-line pt-4 first:mt-0 first:border-t-0 first:pt-0`,a),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pb-1.5`,children:[(0,P.jsx)(`h3`,{className:`m-0 text-[17px] leading-tight font-[750] tracking-[-0.01em] text-fg first-letter:uppercase`,children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`rounded-full bg-surface-2 px-2 py-px text-xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),i]}):(0,P.jsxs)(`section`,{className:N(`mt-3 first:mt-0`,a),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-2.5 pb-1 pt-1`,children:[(0,P.jsx)(tt,{children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),i]})}function q({title:e,count:t,actions:n,children:r,className:i}){return(0,P.jsxs)(`section`,{className:N(`overflow-hidden rounded-card border border-line bg-surface`,i),children:[(e||n)&&(0,P.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-line px-[18px] py-2`,children:[e&&(0,P.jsx)(tt,{className:`whitespace-nowrap text-fg`,children:e}),t!==void 0&&t>0&&(0,P.jsx)(`span`,{className:`text-xs font-bold tabular-nums text-bad`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),n]}),r]})}function rt({children:e,size:t=`md`,className:n}){return(0,P.jsx)(`h1`,{className:N(`m-0 font-semibold tracking-[-0.01em] text-fg`,t===`lg`?`text-2xl`:`text-xl`,n),children:e})}function it({title:e,sub:t,actions:n,icon:r}){return(0,P.jsxs)(`header`,{className:`flex flex-wrap items-center gap-3`,children:[typeof r==`string`?(0,P.jsx)(F,{name:r,className:`text-[26px] text-fg-2`}):r,(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(rt,{children:e}),t&&(0,P.jsx)(`div`,{className:`text-sm text-fg-2`,children:t})]}),(0,P.jsx)(`span`,{className:`flex-1`}),n]})}function at({children:e,width:t=`wide`,className:n}){return(0,P.jsx)(`div`,{className:N(`mx-auto flex w-full animate-rise flex-col gap-4`,t===`narrow`?`new-chat max-w-[640px]`:`max-w-[960px]`,n),children:e})}function ot({children:e}){return(0,P.jsx)(`span`,{className:`grid size-14 flex-none place-items-center rounded-full bg-accent-soft text-[28px] leading-none`,children:e})}function st({name:e}){return(0,P.jsx)(`span`,{className:`grid size-8 flex-none place-items-center rounded-full bg-accent-soft text-on-accent-soft`,children:(0,P.jsx)(F,{name:e,className:`text-[17px]`})})}function ct({icon:e,title:t,children:n,action:r,className:i,...a}){return(0,P.jsxs)(`div`,{className:N(`flex items-center gap-3.5 px-[18px] py-3`,i),...a,children:[(0,P.jsx)(st,{name:e}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[(0,P.jsx)(`span`,{className:`flex items-center gap-2 text-[13.5px] font-medium text-fg`,children:t}),n]}),r]})}function lt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-col divide-y divide-line py-1`,t),children:e})}var ut=(0,v.createContext)(!1);function dt({compact:e=!1,children:t}){return(0,P.jsx)(ut.Provider,{value:e,children:(0,P.jsx)(`div`,{className:`py-1 [&>*+*]:border-t [&>*+*]:border-line`,children:t})})}function ft({label:e,dim:t,mono:n,children:r}){let i=(0,v.useContext)(ut);return(0,P.jsxs)(`div`,{className:N(`flex`,i?`items-baseline gap-3 px-3.5 py-1.5`:`flex-col gap-[3px] px-[18px] py-2.5`),children:[(0,P.jsx)(tt,{className:N(i&&`w-[84px] flex-none`),children:e}),(0,P.jsx)(`span`,{className:N(`flex min-w-0 flex-wrap items-center gap-2 break-words`,i?`text-xs`:`text-[12.5px]`,t?`text-fg-2`:`text-fg`,n&&`font-mono break-all`),children:r})]})}function J({leading:e,title:t,sub:n,subTone:r=`plain`,meta:i,actions:a,href:o,onClick:s,active:c,dim:l,size:u=`md`,className:d,titleExtra:f,label:p,over:m,actionsAlways:h,innerProps:g,titleLines:_=1}){let v=(0,P.jsxs)(P.Fragment,{children:[e!==void 0&&(0,P.jsx)(`span`,{className:`grid w-6 shrink-0 place-items-center text-[15px] text-fg-2`,children:e}),(0,P.jsxs)(`span`,{className:`grid min-w-0 flex-1`,children:[m&&(0,P.jsx)(`span`,{className:`truncate text-xs font-semibold text-fg-2`,children:m}),(0,P.jsxs)(`span`,{className:N(`flex min-w-0 items-center gap-1.5 text-fg`,m?`font-normal`:`font-semibold`,u===`sm`?`text-sm`:`text-base`),children:[(0,P.jsx)(`span`,{className:N(`min-w-0`,_===2?`line-clamp-2 leading-snug [overflow-wrap:anywhere]`:`truncate`),children:t}),f]}),n&&(0,P.jsx)(`span`,{className:N(`truncate text-xs`,r===`bad`?`text-bad`:r===`accent`?`text-accent`:`text-fg-2`),children:n})]}),i!==void 0&&(0,P.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-2`,children:i})]}),y=N(`flex min-w-0 flex-1 items-center gap-2.5 rounded-control text-left no-underline text-inherit`,u===`sm`?`px-2.5 py-1.5`:`px-2.5 py-2`,(o||s)&&`cursor-pointer`,l&&`opacity-55`),b=o?(0,P.jsx)(ge,{href:o,onClick:s,className:y,"aria-label":p,"aria-current":c?`page`:void 0,...g,children:v}):s?(0,P.jsx)(`button`,{type:`button`,onClick:s,className:N(y,`border-0 bg-transparent font-[inherit]`),"aria-label":p,...g,children:v}):(0,P.jsx)(`div`,{className:y,children:v});return(0,P.jsxs)(`div`,{className:N(`group/row relative flex items-center rounded-control transition-colors`,c?`bg-surface shadow-[inset_0_0_0_1px_var(--line)]`:(o||s)&&`hover:bg-surface-2`,d),children:[b,a&&(0,P.jsx)(`span`,{className:N(`flex shrink-0 items-center gap-0.5 pr-1.5`,!h&&`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 pointer-coarse:opacity-100`),children:a})]})}function pt({items:e,value:t,onChange:n,className:r,label:i,bare:a}){return(0,P.jsx)(`div`,{role:`tablist`,"aria-label":i,className:N(`flex flex-wrap gap-x-4 max-[800px]:flex-nowrap max-[800px]:overflow-x-auto max-[800px]:overflow-y-hidden max-[800px]:[scrollbar-width:none] max-[800px]:[&>*]:flex-none`,!a&&`border-b border-line px-4`,r),children:e.map(e=>{let r=e.id===t,i=N(`-mb-px inline-flex cursor-pointer items-center gap-1.5 border-0 border-b-2 bg-transparent px-0 pt-2 pb-[7px] text-sm font-semibold no-underline transition-colors`,r?`border-accent text-accent`:`border-transparent text-fg-2 hover:text-fg`),a=(0,P.jsxs)(P.Fragment,{children:[e.label,e.count!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums opacity-70`,children:e.count})]});return e.href?(0,P.jsx)(ge,{href:e.href,role:`tab`,"aria-selected":r,className:i,children:a},e.id):(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r,onClick:()=>n?.(e.id),className:i,children:a},e.id)})})}var mt=`rounded-control border border-line bg-surface text-fg placeholder:text-fg-2 focus:border-accent focus:outline-none disabled:opacity-60`,ht=[[/^font-(sans|mono|reading|serif)$/,/^font-(sans|mono|reading|serif)$/],[/^text-(2xs|xs|sm|base|md|lg|xl)$/,/^text-(2xs|xs|sm|base|md|lg|xl|2xl|\[\d)/],[/^w-/,/^w-/],[/^h-/,/^h-/],[/^px-/,/^px-/],[/^pr-/,/^(pr|px)-/],[/^py-/,/^py-/],[/^leading-/,/^leading-/]];function gt(e,t){let n=(t??``).split(/\s+/).filter(Boolean);return N(mt,...e.split(` `).filter(e=>{let t=ht.find(([t])=>t.test(e));return!t||!n.some(e=>t[1].test(e))}),t)}var Y=(0,v.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`input`,{ref:n,className:gt(`w-full h-9 px-3 font-sans text-base`,e),...t})}),_t=(0,v.forwardRef)(function({className:e,...t},n){return(0,P.jsx)(`textarea`,{ref:n,className:gt(`w-full px-3 py-2 font-sans text-base leading-normal`,e),...t})});function vt({className:e,children:t,...n}){return(0,P.jsx)(`select`,{className:gt(`w-full h-9 cursor-pointer px-3 pr-8 font-sans text-base`,e),...n,children:t})}function X({label:e,hint:t,children:n,className:r}){return(0,P.jsxs)(`label`,{className:N(`flex flex-col gap-1.5`,r),children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e}),n,t&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:t})]})}function yt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-col gap-3.5 p-[18px]`,t),children:e})}function bt({children:e,className:t}){return(0,P.jsx)(`div`,{className:N(`flex flex-wrap items-end gap-2.5 max-[900px]:flex-col max-[900px]:items-stretch`,t),children:e})}function xt({checked:e,onChange:t,children:n,hint:r,mono:i,disabled:a,className:o}){return(0,P.jsxs)(`label`,{className:N(`flex cursor-pointer items-center gap-2 text-sm text-fg`,a&&`cursor-default opacity-60`,o),children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`size-[15px] flex-none accent-accent`,checked:e,disabled:a,onChange:e=>t(e.target.checked)}),(0,P.jsxs)(`span`,{className:`min-w-0`,children:[i?(0,P.jsx)(`b`,{className:`font-mono text-xs font-semibold`,children:n}):n,r&&(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[` — `,r]})]})]})}function St({checked:e}){return(0,P.jsx)(`span`,{"aria-hidden":!0,className:N(`relative inline-block h-6 w-11 flex-none rounded-full border-2 transition-colors`,e?`border-accent bg-accent`:`border-line bg-surface-2`),children:(0,P.jsx)(`span`,{className:N(`absolute top-1/2 size-4 -translate-y-1/2 rounded-full transition-[left,background-color]`,e?`left-[22px] bg-on-accent`:`left-1 bg-fg-2`)})})}function Ct({checked:e,onChange:t,label:n,disabled:r}){return(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,title:n,disabled:r,onClick:()=>t(!e),className:`inline-flex flex-none cursor-pointer border-0 bg-transparent p-0 disabled:cursor-default disabled:opacity-50`,children:(0,P.jsx)(St,{checked:e})})}function wt({label:e,hint:t,checked:n,onChange:r}){return(0,P.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-4 rounded-control border-0 bg-transparent py-2 pr-3 pl-2 text-left transition-colors hover:bg-surface-2`,role:`switch`,"aria-checked":n,onClick:()=>r(!n),children:[(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,P.jsx)(`span`,{className:`text-base text-fg`,children:e}),t&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:t})]}),(0,P.jsx)(St,{checked:n})]})}function Tt({title:e,count:t,back:n,action:r,divided:i}){return(0,P.jsxs)(`div`,{className:N(`flex min-h-11 items-center gap-2 pt-3 pb-1`,i?`mt-2.5 border-t border-line px-2`:`px-3.5`),children:[n&&(0,P.jsx)(V,{icon:`arrow_back`,label:n.label,size:`sm`,href:n.href,className:`-ml-1.5`}),(0,P.jsx)(tt,{children:e}),t!==void 0&&(0,P.jsx)(`span`,{className:`text-2xs font-semibold tabular-nums text-fg-2`,children:t}),(0,P.jsx)(`span`,{className:`flex-1`}),r]})}function Et({icon:e=`search`,...t}){return(0,P.jsxs)(`label`,{className:`relative mx-2 mt-1 mb-1 block`,children:[(0,P.jsx)(F,{name:e,className:`ms-sm pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-fg-2`}),(0,P.jsx)(Y,{type:`search`,className:`h-8 rounded-full pl-8 text-sm`,...t})]})}function Dt({children:e,label:t,className:n}){let r=N(`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto p-1.5`,n);return t?(0,P.jsx)(`nav`,{className:r,"aria-label":t,children:e}):(0,P.jsx)(`div`,{className:r,children:e})}function Ot({children:e,className:t}){return(0,P.jsx)(`p`,{className:N(`m-0 px-3 py-2.5 text-xs text-fg-2`,t),children:e})}function kt({trigger:e,children:t,align:n=`start`,className:r}){let[i,a]=(0,v.useState)(!1),o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>e.key===`Escape`&&a(!1);return window.addEventListener(`mousedown`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`mousedown`,e),window.removeEventListener(`keydown`,t)}},[i]),(0,P.jsxs)(`span`,{ref:o,className:`relative inline-flex`,children:[e({open:i,toggle:()=>a(e=>!e)}),i&&(0,P.jsx)(`div`,{role:`menu`,className:N(`absolute top-[calc(100%+6px)] z-50 min-w-[260px] overflow-hidden rounded-card border border-line bg-surface p-1.5 shadow-pop`,n===`end`?`right-0`:`left-0`,r),children:t(()=>a(!1))})]})}var At=null,jt=new Set,Mt;async function Nt(){try{let e=await A.request(`attention.list`);if(e.ok){At=e.data.items;for(let e of jt)e()}}catch{}Mt=setTimeout(()=>void Nt(),3e3)}function Pt(e){return jt.add(e),jt.size===1&&Nt(),()=>{jt.delete(e),jt.size===0&&Mt&&clearTimeout(Mt)}}function Ft(){Mt&&clearTimeout(Mt),Nt()}function It(){return(0,v.useSyncExternalStore)(Pt,()=>At)}var Lt={agent:(e,t)=>e.filter(e=>e.owner.agent?.slug===t),project:(e,t,n=[])=>e.filter(e=>e.owner.project?.slug===t||!!e.owner.agent&&n.includes(e.owner.agent.slug)),channel:(e,t)=>e.filter(e=>e.owner.channel===t),general:e=>e.filter(e=>e.owner.general)},Rt=e=>e===`approval`?`front_hand`:e===`question`?`help`:e===`runner`?`event_busy`:`error`,zt=e=>e===`approval`?`needs approval`:e===`question`?`asks you`:e===`runner`?`no runner`:`failed`;function Bt(e){let t=e.agent?`${e.agent.emoji?`${e.agent.emoji} `:``}${e.agent.name}`:``;return[e.project?`📁 ${e.project.title}`:e.channel?`#${e.channel}`:e.general?`Ralv`:e.workflow?`${e.workflow} run`:``,t].filter(Boolean).join(` · `)||`workspace`}var Vt=e=>new URLSearchParams(e.split(`?`)[1]??``).get(`focus`),Ht=e=>e.split(`?`)[0];function Ut(e,t){if(e.length!==0)return e[(e.findIndex(e=>e.href===t||Vt(t)===null&&Ht(e.href)===t)+1)%e.length]}function Wt(e){e.notificationId&&A.request(`notifications.read`,{body:{ids:[e.notificationId]}}).then(()=>Ft()).catch(()=>{}),(window.location.hash.slice(1)||`/`)===e.href?window.dispatchEvent(new Event(Gt)):z(e.href)}var Gt=`kw-refocus`;function Kt(){let e=It()??[],t=Ut(e,I());return(0,v.useEffect)(()=>{let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.code!==`KeyN`)return;let t=Ut(At??[],window.location.hash.slice(1)||`/`);t&&(e.preventDefault(),Wt(t))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),t?(0,P.jsxs)(`button`,{type:`button`,className:`next-btn inline-flex h-8 cursor-pointer items-center gap-2 rounded-control border-0 bg-bad/12 px-1.5 font-[inherit] text-sm text-fg hover:bg-bad/18`,onClick:()=>Wt(t),title:`next: ${Bt(t.owner)} — ${t.title} (⌥N)`,children:[(0,P.jsx)(`span`,{className:`next-n inline-grid h-5 min-w-5 place-items-center rounded-full bg-bad px-1.5 text-2xs font-bold tabular-nums text-on-bad`,children:e.length}),(0,P.jsx)(`span`,{className:`text-fg-2 max-[640px]:hidden`,children:`waiting`}),(0,P.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-0.5 rounded-md bg-bad pl-2.5 pr-2 font-semibold text-on-bad`,children:[`next `,(0,P.jsx)(F,{name:`arrow_forward`,className:`ms-sm`})]}),(0,P.jsx)(et,{className:`mr-1 max-[800px]:hidden`,"aria-hidden":!0,children:`⌥N`})]}):null}function qt(){let e=I(),t=Vt(e),[n,r]=(0,v.useState)(0);(0,v.useEffect)(()=>{let e=()=>r(e=>e+1);return window.addEventListener(Gt,e),()=>window.removeEventListener(Gt,e)},[]),(0,v.useEffect)(()=>{if(!t)return;let e=0,n=setInterval(()=>{let r=document.querySelector(`[data-request="${CSS.escape(t)}"]`);r?(clearInterval(n),r.scrollIntoView({block:`center`,behavior:`smooth`}),r.classList.remove(`focus-flash`),r.offsetWidth,r.classList.add(`focus-flash`)):++e>40&&clearInterval(n)},150);return()=>clearInterval(n)},[t,e,n])}function Jt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Yt=Jt();function Xt(e){Yt=e}var Zt={exec:()=>null};function Qt(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(en.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var $t=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),en={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Qt(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Qt(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Qt(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Qt(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Qt(e=>RegExp(`^ {0,${e}}(?:</?(?:${gn})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Qt(e=>RegExp(`^ {0,${e}}>`))},tn=/^(?:[ \t]*(?:\n|$))+/,nn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,an=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,on=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,sn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,cn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ln=Z(cn).replace(/bull/g,sn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),un=Z(cn).replace(/bull/g,sn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),dn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,fn=/^[^\n]+/,pn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mn=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,pn).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hn=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,sn).getRegex(),gn=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,_n=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,vn=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,_n).replace(`tag`,gn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yn=e=>Z(dn).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex(),bn=yn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),xn=yn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Sn={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,xn).getRegex(),code:nn,def:mn,fences:rn,heading:on,hr:an,html:vn,lheading:ln,list:hn,newline:tn,paragraph:bn,table:Zt,text:fn},Cn=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex(),wn={...Sn,lheading:un,table:Cn,paragraph:Z(dn).replace(`hr`,an).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Cn).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,gn).getRegex()},Tn={...Sn,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,_n).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(dn).replace(`hr`,an).replace(`heading`,` *#{1,6} *[^
11
11
  ]`).replace(`lheading`,ln).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},En=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Dn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,On=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,kn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,An=/[\p{P}\p{S}]/u,jn=/[\s\p{P}\p{S}]/u,Mn=/[^\s\p{P}\p{S}]/u,Nn=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,jn).getRegex(),Pn=/[\p{Pi}\p{Ps}"']/u,Fn=/(?!~)[\p{P}\p{S}]/u,In=/(?!~)[\s\p{P}\p{S}]/u,Ln=/(?:[^\s\p{P}\p{S}]|~)/u,Rn=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,$t?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),zn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Bn=Z(zn,`u`).replace(/punct/g,An).getRegex(),Vn=Z(zn,`u`).replace(/punct/g,Fn).getRegex(),Hn=Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Pn).replace(/punct/g,An).getRegex(),Un=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Wn=Z(Un,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,An).getRegex(),Gn=Z(Un,`gu`).replace(/notPunctSpace/g,Ln).replace(/punctSpace/g,In).replace(/punct/g,Fn).getRegex(),Kn=Z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,An).getRegex(),qn=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,An).getRegex(),Jn=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,An).getRegex(),Yn=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,An).getRegex(),Xn=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,An).getRegex(),Zn=Z(/\\(punct)/,`gu`).replace(/punct/g,An).getRegex(),Qn=Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$n=Z(_n).replace(`(?:-->|$)`,`-->`).getRegex(),er=Z(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,$n).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tr=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,nr=Z(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,tr).getRegex(),rr=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,nr).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ir=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,nr).replace(`ref`,pn).getRegex(),ar=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,pn).getRegex(),or=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,sr=Z(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,tr).getRegex(),cr=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,sr).replace(`ref`,or).getRegex()).replace(`nolink`,Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,or).getRegex()).getRegex(),lr=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ur=Z(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),dr={_backpedal:Zt,anyPunctuation:Zn,autolink:Qn,blockSkip:Rn,br:On,code:Dn,del:Zt,delLDelim:Zt,delRDelim:Zt,emStrongLDelim:Bn,emStrongRDelimAst:Wn,emStrongRDelimUnd:qn,escape:En,link:rr,nolink:ar,punctuation:Nn,reflink:ir,reflinkSearch:cr,tag:er,text:kn,url:Zt},fr={...dr,emStrongLDelim:Hn,emStrongRDelimAst:Kn,emStrongRDelimUnd:Jn,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,nr).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,nr).getRegex()},pr={...dr,emStrongRDelimAst:Gn,emStrongLDelim:Vn,delLDelim:Yn,delRDelim:Xn,url:Z(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,ur).replace(`protocol`,lr).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Z(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,lr).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},mr={...pr,br:Z(On).replace(`{2,}`,`*`).getRegex(),text:Z(pr.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},hr={normal:Sn,gfm:wn,pedantic:Tn},gr={normal:dr,gfm:pr,breaks:mr,pedantic:fr},_r={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},vr=e=>_r[e];function yr(e,t){if(t){if(en.escapeTest.test(e))return e.replace(en.escapeReplace,vr)}else if(en.escapeTestNoEncode.test(e))return e.replace(en.escapeReplaceNoEncode,vr);return e}function br(e){return e.replace(en.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function xr(e){try{e=encodeURI(e).replace(en.percentDecode,`%`)}catch{return null}return e}function Sr(e,t){let n=e.replace(en.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(en.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(en.slashPipe,`|`);return n}function Cr(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function wr(e){let t=e.split(`
12
12
  `),n=t.length-1;for(;n>=0&&en.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
13
13
  `)}function Tr(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Er(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Dr(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Or(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function kr(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
@@ -76,7 +76,7 @@ ${e}</tr>
76
76
  Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+yr(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return Lr.parse(e,t)}Q.options=Q.setOptions=function(e){return Lr.setOptions(e),Q.defaults=Lr.defaults,Xt(Q.defaults),Q},Q.getDefaults=Jt,Q.defaults=Yt;function Rr(...e){return Lr.use(...e),Q.defaults=Lr.defaults,Xt(Q.defaults),Q}Q.use=Rr,Q.walkTokens=function(e,t){return Lr.walkTokens(e,t)},Q.parseInline=Lr.parseInline,Q.Parser=Fr,Q.parser=Fr.parse,Q.Renderer=Nr,Q.TextRenderer=Pr,Q.Lexer=Mr,Q.lexer=Mr.lex,Q.Tokenizer=jr,Q.Hooks=Ir,Q.parse=Q,Q.options,Q.setOptions,Q.walkTokens,Q.parseInline,Fr.parse,Mr.lex;function zr(e,t){this.v=e,this.k=t}function Br(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Vr(e){if(Array.isArray(e))return e}function Hr(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Ur(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
77
77
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wr(e,t){return Vr(e)||Hr(e,t)||Gr(e,t)||Ur()}function Gr(e,t){if(e){if(typeof e==`string`)return Br(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Br(e,t):void 0}}function Kr(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof zr;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}Kr.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Kr.prototype.next=function(e){return this._invoke(`next`,e)},Kr.prototype.throw=function(e){return this._invoke(`throw`,e)},Kr.prototype.return=function(e){return this._invoke(`return`,e)};var qr=Object.entries,Jr=Object.setPrototypeOf,Yr=Object.isFrozen,Xr=Object.getPrototypeOf,Zr=Object.getOwnPropertyDescriptor,Qr=Object.freeze,$r=Object.seal,ei=Object.create,ti=typeof Reflect<`u`&&Reflect,ni=ti.apply,ri=ti.construct;Qr||=function(e){return e},$r||=function(e){return e},ni||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ri||=function(e){return new e(...[...arguments].slice(1))};var ii=wi(Array.prototype.forEach);Array.prototype.indexOf;var ai=wi(Array.prototype.lastIndexOf),oi=wi(Array.prototype.pop),si=wi(Array.prototype.push);Array.prototype.slice;var ci=wi(Array.prototype.splice),li=Array.isArray,ui=wi(String.prototype.toLowerCase),di=wi(String.prototype.toString),fi=wi(String.prototype.match),pi=wi(String.prototype.replace),mi=wi(String.prototype.indexOf),hi=wi(String.prototype.trim),gi=wi(Number.prototype.toString),_i=wi(Boolean.prototype.toString),vi=typeof BigInt>`u`?null:wi(BigInt.prototype.toString),yi=typeof Symbol>`u`?null:wi(Symbol.prototype.toString),bi=wi(Object.prototype.hasOwnProperty),xi=wi(Object.prototype.toString),Si=wi(RegExp.prototype.test),Ci=Ti(TypeError);function wi(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ni(e,t,n)}}function Ti(e){return function(){return ri(e,[...arguments])}}function Ei(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ui;if(Jr&&Jr(e,null),!li(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Yr(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Di(e){for(let t=0;t<e.length;t++)bi(e,t)||(e[t]=null);return e}function Oi(e){let t=ei(null);for(let r of qr(e)){var n=Wr(r,2);let i=n[0],a=n[1];bi(e,i)&&(t[i]=li(a)?Di(a):a&&typeof a==`object`&&a.constructor===Object?Oi(a):a)}return t}function ki(e){switch(typeof e){case`string`:return e;case`number`:return gi(e);case`boolean`:return _i(e);case`bigint`:return vi?vi(e):`0`;case`symbol`:return yi?yi(e):`Symbol()`;case`undefined`:return xi(e);case`function`:case`object`:{if(e===null)return xi(e);let t=e,n=Ai(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:xi(e)}return xi(e)}default:return xi(e)}}function Ai(e,t){for(;e!==null;){let n=Zr(e,t);if(n){if(n.get)return wi(n.get);if(typeof n.value==`function`)return wi(n.value)}e=Xr(e)}function n(){return null}return n}function ji(e){try{return Si(e,``),!0}catch{return!1}}var Mi=Qr(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ni=Qr(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Pi=Qr([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Fi=Qr([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ii=Qr(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Li=Qr([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ri=Qr([`#text`]),zi=Qr(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Bi=Qr(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Vi=Qr(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Hi=Qr([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ui=$r(/{{[\w\W]*|^[\w\W]*}}/g),Wi=$r(/<%[\w\W]*|^[\w\W]*%>/g),Gi=$r(/\${[\w\W]*/g),Ki=$r(/^data-[\-\w.\u00B7-\uFFFF]+$/),qi=$r(/^aria-[\-\w]+$/),Ji=$r(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yi=$r(/^(?:\w+script|data):/i),Xi=$r(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zi=$r(/^html$/i),Qi=$r(/^[a-z][.\w]*(-[.\w]+)+$/i),$i=$r(/<[/\w!]/g),ea=$r(/<[/\w]/g),ta=$r(/<\/no(script|embed|frames)/i),na=$r(/\/>/i),ra={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ia=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],aa=Qr(Ei({},ia)),oa=function(){let e={};return ii(ia,t=>{e[t]=$r(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Qr(e)}(),sa=function(){return typeof window>`u`?null:window},ca=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},la=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ua=function(e,t,n,r){return bi(e,t)&&li(e[t])?Ei(r.base?Oi(r.base):{},e[t],r.transform):n},da=function(e,t,n){let r=bi(e,t)?e[t]:void 0;return r&&typeof r==`object`?Oi(r):n()};function fa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sa(),t=e=>fa(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==ra.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Ai(d,`cloneNode`),p=Ai(d,`remove`),m=Ai(d,`removeAttributeNode`),h=Ai(d,`nextSibling`),g=Ai(d,`childNodes`),_=Ai(d,`parentNode`),v=Ai(d,`shadowRoot`),y=Ai(d,`attributes`),b=o&&o.prototype?Ai(o.prototype,`nodeType`):null,x=o&&o.prototype?Ai(o.prototype,`nodeName`):null,S=o&&o.prototype?Ai(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw Ci(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},ee=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},te=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},j=function(){return O||=(D=ca(u,i),!0),D},M=n,N=M.implementation,ne=M.createNodeIterator,re=M.createDocumentFragment,P=M.getElementsByTagName,F=r.importNode,I=la();t.isSupported=typeof qr==`function`&&typeof _==`function`&&N&&N.createHTMLDocument!==void 0;let ie=Ui,ae=Wi,oe=Gi,se=Ki,ce=qi,le=Yi,ue=Xi,de=Qi,fe=Ji,L=null,R=Ei({},[...Mi,...Ni,...Pi,...Ii,...Ri]),z=null,pe=Ei({},[...zi,...Bi,...Vi,...Hi]),me=Object.seal(ei(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),he=null,ge=null,_e=Object.seal(ei(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ve=!0,ye=!0,be=!1,xe=!0,Se=!1,Ce=!0,we=!1,Te=!1,Ee=null,De=null,Oe=!1,ke=!1,Ae=!1,je=!1,Me=!0,Ne=!1,Pe=`user-content-`,Fe=!0,Ie=!1,Le={},Re=null,ze=Ei({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Be=null,Ve=Ei({},[`audio`,`video`,`img`,`source`,`image`,`track`]),He=null,Ue=Ei({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),We=`http://www.w3.org/1998/Math/MathML`,Ge=`http://www.w3.org/2000/svg`,Ke=`http://www.w3.org/1999/xhtml`,qe=Ke,Je=!1,Ye=null,Xe=Ei({},[We,Ge,Ke],di),Ze=Qr([`mi`,`mo`,`mn`,`ms`,`mtext`]),Qe=Ei({},Ze),B=Qr([`annotation-xml`]),V=Ei({},B),$e=Ei({},[`title`,`style`,`font`,`a`,`script`]),H=null,U=[`application/xhtml+xml`,`text/html`],et=null,W=null,G=n.createElement(`form`),K=function(e){return e instanceof RegExp||e instanceof Function},tt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(W&&W===e)return;(!e||typeof e!=`object`)&&(e={}),e=Oi(e),H=U.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,et=H===`application/xhtml+xml`?di:ui,L=ua(e,`ALLOWED_TAGS`,R,{transform:et}),z=ua(e,`ALLOWED_ATTR`,pe,{transform:et}),Ye=ua(e,`ALLOWED_NAMESPACES`,Xe,{transform:di}),He=ua(e,`ADD_URI_SAFE_ATTR`,Ue,{transform:et,base:Ue}),Be=ua(e,`ADD_DATA_URI_TAGS`,Ve,{transform:et,base:Ve}),Re=ua(e,`FORBID_CONTENTS`,ze,{transform:et}),he=ua(e,`FORBID_TAGS`,Oi({}),{transform:et}),ge=ua(e,`FORBID_ATTR`,Oi({}),{transform:et}),Le=bi(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Oi(e.USE_PROFILES):e.USE_PROFILES:!1,ve=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Se=e.SAFE_FOR_TEMPLATES||!1,Ce=e.SAFE_FOR_XML!==!1,we=e.WHOLE_DOCUMENT||!1,ke=e.RETURN_DOM||!1,Ae=e.RETURN_DOM_FRAGMENT||!1,je=e.RETURN_TRUSTED_TYPE||!1,Oe=e.FORCE_BODY||!1,Me=e.SANITIZE_DOM!==!1,Ne=e.SANITIZE_NAMED_PROPS||!1,Fe=e.KEEP_CONTENT!==!1,Ie=e.IN_PLACE||!1,fe=ji(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ji,qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ke,Qe=da(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Ei({},Ze)),V=da(e,`HTML_INTEGRATION_POINTS`,()=>Ei({},B));let t=da(e,`CUSTOM_ELEMENT_HANDLING`,()=>ei(null));if(me=ei(null),bi(t,`tagNameCheck`)&&K(t.tagNameCheck)&&(me.tagNameCheck=t.tagNameCheck),bi(t,`attributeNameCheck`)&&K(t.attributeNameCheck)&&(me.attributeNameCheck=t.attributeNameCheck),bi(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(me.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),$r(me),Se&&(ye=!1),Ae&&(ke=!0),Le&&(L=Ei({},Ri),z=ei(null),Le.html===!0&&(Ei(L,Mi),Ei(z,zi)),Le.svg===!0&&(Ei(L,Ni),Ei(z,Bi),Ei(z,Hi)),Le.svgFilters===!0&&(Ei(L,Pi),Ei(z,Bi),Ei(z,Hi)),Le.mathMl===!0&&(Ei(L,Ii),Ei(z,Vi),Ei(z,Hi))),_e.tagCheck=null,_e.attributeCheck=null,bi(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?_e.tagCheck=e.ADD_TAGS:li(e.ADD_TAGS)&&(L===R&&(L=Oi(L)),Ei(L,e.ADD_TAGS,et))),bi(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?_e.attributeCheck=e.ADD_ATTR:li(e.ADD_ATTR)&&(z===pe&&(z=Oi(z)),Ei(z,e.ADD_ATTR,et))),bi(e,`ADD_FORBID_CONTENTS`)&&li(e.ADD_FORBID_CONTENTS)&&(Re===ze&&(Re=Oi(Re)),Ei(Re,e.ADD_FORBID_CONTENTS,et)),Fe&&(L[`#text`]=!0),we&&Ei(L,[`html`,`head`,`body`]),L.table&&(Ei(L,[`tbody`]),delete he.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ci(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ci(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=ee(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=j()),T&&typeof E==`string`&&(E=ee(``)));Qr&&Qr(e),W=e},nt=Ei({},[...Ni,...Pi,...Fi]),q=Ei({},[...Ii,...Li]),rt=function(e,t,n){return t.namespaceURI===Ke?e===`svg`:t.namespaceURI===We?e===`svg`&&(n===`annotation-xml`||Qe[n]):!!nt[e]},it=function(e,t,n){return t.namespaceURI===Ke?e===`math`:t.namespaceURI===Ge?e===`math`&&V[n]:!!q[e]},at=function(e,t,n){return t.namespaceURI===Ge&&!V[n]||t.namespaceURI===We&&!Qe[n]?!1:!q[e]&&($e[e]||!nt[e])},ot=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:qe,tagName:`template`});let n=ui(e.tagName),r=ui(t.tagName);return Ye[e.namespaceURI]?e.namespaceURI===Ge?rt(n,t,r):e.namespaceURI===We?it(n,t,r):e.namespaceURI===Ke?at(n,t,r):!!(H===`application/xhtml+xml`&&Ye[e.namespaceURI]):!1},st=function(e){si(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Ci(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},lt=function(e){ft(e);let t=g(e);if(t){let e=[];ii(t,t=>{si(e,t)}),ii(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ct(e,r,i)}},ut=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}si(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(ke||Ae)try{st(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},dt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||z[et(i)]||ct(e,r,i)}},ft=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===ra.element&&dt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},J=function(e,t){return Ce?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},pt=function(e){if(!Ce)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===ra.processingInstruction||n===ra.comment&&Si(ea,e.data)){try{p(e)}catch{}continue}if(n===ra.element){let t=e,n=et(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&J(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},mt=function(e){let t=null,r=null;if(Oe)e=`<remove></remove>`+e;else{let t=fi(e,/^[\r\n\t ]+/);r=t&&t[0]}H===`application/xhtml+xml`&&qe===Ke&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?ee(e):e;if(qe===Ke)try{t=new l().parseFromString(i,H)}catch{}if(!t||!t.documentElement){t=N.createDocument(qe,`template`,null);try{t.documentElement.innerHTML=Je?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),qe===Ke?P.call(t,we?`html`:`body`)[0]:we?t.documentElement:a},ht=function(e){let t=S?S(e):e.ownerDocument;return ne.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},gt=function(e){return e=pi(e,ie,` `),e=pi(e,ae,` `),e=pi(e,oe,` `),e},Y=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ne.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=gt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&ii(i,e=>{vt(e.content)&&Y(e.content)})},_t=function(e){let t=x?x(e):null;return typeof t!=`string`||et(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===ra.documentFragment}catch{return!1}},X=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function yt(e,n,r){e.length!==0&&ii(e,e=>{e.call(t,n,r,W)})}let bt=function(e,t){return!!(Ce&&e.hasChildNodes()&&!X(e.firstElementChild)&&Si($i,e.textContent)&&Si($i,e.innerHTML)||Ce&&e.namespaceURI===Ke&&aa[t]&&(X(e.firstElementChild)||typeof e.textContent==`string`&&Si(oa[t],e.textContent))||e.nodeType===ra.processingInstruction||Ce&&e.nodeType===ra.comment&&Si(ea,e.data))},xt=function(e,t){return e instanceof RegExp?Si(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},St=function(e,t,n){if(!he[t]&&Ot(t)&&xt(me.tagNameCheck,t))return!1;if(Fe&&!Re[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return st(e),!0},Ct=function(e,t,n,r){return e.length===0?t:t===n||t===r?Oi(t):t},wt=function(e,t){return e===t||_(e)!==null?!1:(Ie&&ft(e),!0)},Tt=function(e,n){if(yt(I.beforeSanitizeElements,e,null),wt(e,n))return!0;if(_t(e))return st(e),!0;let r=et(w(e));if(L=Ct(I.uponSanitizeElement,L,R,Ee),yt(I.uponSanitizeElement,e,{tagName:r,allowedTags:L}),wt(e,n))return!0;if(bt(e,r))return st(e),!0;if(he[r]||!(_e.tagCheck instanceof Function&&_e.tagCheck(r))&&!L[r]){let t=St(e,r,n);return t===!1&&(yt(I.afterSanitizeElements,e,null),wt(e,n))?!0:t}if(C(e)===ra.element&&!ot(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Si(ta,e.innerHTML))return st(e),!0;if(Se&&e.nodeType===ra.text){let n=gt(e.textContent);e.textContent!==n&&(si(t.removed,{element:e.cloneNode()}),e.textContent=n)}return yt(I.afterSanitizeElements,e,null),wt(e,n)},Et=function(e,t,r){if(ge[t]||J(t,e)||Me&&(t===`id`||t===`name`)&&(r in n||r in G))return!1;let i=z[t]||_e.attributeCheck instanceof Function&&_e.attributeCheck(t,e);return ye&&Si(se,t)||ve&&Si(ce,t)?!0:i?He[t]||Si(fe,pi(r,ue,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&mi(r,`data:`)===0&&Be[e]||be&&!Si(le,pi(r,ue,``))?!0:!r:Ot(e)&&xt(me.tagNameCheck,e)&&xt(me.attributeNameCheck,t,e)||t===`is`&&me.allowCustomizedBuiltInElements&&xt(me.tagNameCheck,r)},Dt=Ei({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ot=function(e){return!Dt[ui(e)]&&Si(de,e)},kt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ee(r);case`TrustedScriptURL`:return te(r)}return r},At=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!_t(e)||(st(e),!1)}catch{return ut(t,e),!1}},jt=function(e,n){if(yt(I.beforeSanitizeAttributes,e,null),wt(e,n))return;let r=e.attributes;if(!r||_t(e))return;z=Ct(I.uponSanitizeAttribute,z,pe,De);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},a=r.length,o=et(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=et(s),d=l,f=s===`value`?d:hi(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,yt(I.uponSanitizeAttribute,e,i),f=i.attrValue,Ne&&(u===`id`||u===`name`)&&mi(f,Pe)!==0&&(ut(s,e,n),f=Pe+f,p=!0),Ce&&Si(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){ut(s,e,n);continue}if(u===`attributename`&&fi(f,`href`)){ut(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){ut(s,e,n);continue}if(!xe&&Si(na,f)){ut(s,e,n);continue}if(Se&&(f=gt(f)),!Et(o,u,f)){ut(s,e,n);continue}f=kt(o,u,c,f),f!==d&&At(e,s,c,f)&&p&&oi(t.removed)}}yt(I.afterSanitizeAttributes,e,null),wt(e,n)},Mt=function(e){let t=null,n=ht(e);for(yt(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(yt(I.uponSanitizeShadowNode,t,null),Tt(t,e),jt(t,e),vt(t.content)&&Mt(t.content),C(t)===ra.element){let e=v(t);vt(e)&&(Nt(e),Mt(e))}yt(I.afterSanitizeShadowDOM,e,null)},Nt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Mt(e.shadow);continue}let n=e.node,r=C(n)===ra.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&et(e)===`template`){let e=n.content;vt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);vt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Je=!e,Je&&(e=`<!-->`),typeof e!=`string`&&!X(e)&&(e=ki(e),typeof e!=`string`))throw Ci(`dirty is not a string, aborting`);if(!t.isSupported)return e;Te?(L=Ee,z=De):tt(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(L=Oi(L)),I.uponSanitizeAttribute.length>0&&(z=Oi(z)),t.removed=[];let c=Ie&&typeof e!=`string`&&X(e);if(c){pt(e);let t=w(e);if(typeof t==`string`){let n=et(t);if(!L[n]||he[n])throw lt(e),Ci(`root node is forbidden and cannot be sanitized in-place`)}if(_t(e))throw lt(e),Ci(`root node is clobbered and cannot be sanitized in-place`);try{Nt(e)}catch(t){throw lt(e),t}}else if(X(e))i=mt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===ra.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Nt(i);else{if(!ke&&!Se&&!we&&e.indexOf(`<`)===-1)return T&&je?ee(e):e;if(i=mt(e),!i)return ke?null:je?E:``}i&&Oe&&st(i.firstChild);let l=c?e:i;try{let e=ht(l);for(;o=e.nextNode();)Tt(o,l),jt(o,l),vt(o.content)&&Mt(o.content)}catch(n){throw c&&(lt(e),ii(t.removed,e=>{e.element&&ft(e.element)})),n}if(c){let n=!1;if(ii(t.removed,t=>{t.element&&(t.element===e&&(n=!0),ft(t.element))}),n)throw Ci(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Se&&Y(e),e}if(ke){if(Se&&Y(i),Ae)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=F.call(r,s,!0)),s}let u=we?i.outerHTML:i.innerHTML;return we&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Si(Zi,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
78
78
  `+u),Se&&(u=gt(u)),T&&je?ee(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tt(e),Te=!0,Ee=L,De=z},t.clearConfig=function(){W=null,Te=!1,Ee=null,De=null,T=D,E=``},t.isValidAttribute=function(e,t,n){W||tt({});let r=et(e),i=et(t);return Et(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&bi(I,e)&&si(I[e],t)},t.removeHook=function(e,t){if(bi(I,e)){if(t!==void 0){let n=ai(I[e],t);return n===-1?void 0:ci(I[e],n,1)[0]}return oi(I[e])}},t.removeHooks=function(e){bi(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=la()},t}var pa=fa(),ma=l(h(),1),ha=`kw-vibeable`,ga=`kw-vibe-slot`;function _a(e){window.dispatchEvent(new CustomEvent(ha,{detail:e}))}async function va(e,t){let n=await A.request(`chats.setVibeable`,{id:e,body:{slug:t}});if(!n.ok)throw Error(j(n));return n.data}function ya({chatId:e,slug:t,agentBusy:n,onClosed:r}){let[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(0),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(!1),g=(0,v.useRef)(null),_=(0,v.useCallback)(async()=>{try{let e=await A.request(`vibeables.get`,{slug:t});if(!e.ok)throw Error(j(e));a(e.data),d(``)}catch(e){d(e.message)}},[t]);(0,v.useEffect)(()=>{_();let e,n=te.subscribe(`vibeable.${t}`,{},t=>{let n=t;if(n.type===`change`)s(e=>e+1),l(n.files.slice(0,3).join(`, `)+(n.files.length>3?` +${n.files.length-3}`:``)),clearTimeout(e),e=setTimeout(()=>l(``),2500);else if(n.type===`dev`&&n.dev){let e=n.dev;a(t=>t&&{...t,dev:e,mode:e.running?`dev`:`static`})}else n.type===`error`&&d(n.message)});return()=>{n(),clearTimeout(e)}},[t,_]);let y=!!i?.dev?.running;(0,v.useEffect)(()=>{if(!y||!m)return;let e=setInterval(()=>void _(),2e3);return()=>clearInterval(e)},[y,m,_]);let b=i?`${ee(i.url)}?v=${o}`:``,x=()=>s(e=>e+1),S=async e=>{p(e),d(``);try{let n=await A.request(e===`start`?`vibeables.devStart`:`vibeables.devStop`,{slug:t});if(!n.ok)throw Error(j(n));a(n.data),e===`start`&&h(!0)}catch(e){d(e.message)}finally{p(``)}},C=async()=>{if(e&&r){p(`close`),d(``);try{r(await va(e,null))}catch(e){d(e.message),p(``)}}},w=i?.dev,T=w?.running?w.ready?{tone:`ok`,text:`dev :${w.port}`}:{tone:`working`,text:`starting…`}:w&&w.exitCode!==void 0?{tone:`bad`,text:`dev exited${w.exitCode==null?``:` (${w.exitCode})`}`}:{tone:`ok`,text:`static`};return(0,P.jsxs)(`aside`,{className:xa,"data-vibe":t,children:[(0,P.jsxs)(`div`,{className:Sa,children:[(0,P.jsx)(F,{name:`web`,className:`text-fg-2`}),(0,P.jsx)(`span`,{className:`truncate text-base font-medium`,title:i?.path,children:t}),(0,P.jsx)(wa,{tone:T.tone,title:w?.command?`dev: ${w.command}`:i?.dir,children:T.text}),c&&(0,P.jsxs)(`span`,{className:`inline-flex animate-vibe-flash items-center gap-1 text-2xs whitespace-nowrap text-accent`,title:c,children:[(0,P.jsx)(F,{name:`bolt`,className:`ms-sm`}),` reloaded`]}),(0,P.jsx)(`span`,{className:`flex-1`}),i?.config.dev&&(w?.running?(0,P.jsx)(V,{icon:f===`stop`?`progress_activity`:`stop`,label:`stop dev server`,title:`Stop the dev server (${i.config.dev})`,onClick:()=>void S(`stop`),disabled:!!f}):(0,P.jsx)(V,{icon:f===`start`?`progress_activity`:`play_arrow`,label:`start dev server`,title:`Start the dev server: ${i.config.dev}`,className:`text-accent`,onClick:()=>void S(`start`),disabled:!!f})),w&&(0,P.jsx)(V,{icon:`terminal`,label:`dev server output`,title:`Dev server output`,className:m?`bg-accent-soft text-on-accent-soft`:void 0,"aria-pressed":m,onClick:()=>h(e=>!e)}),(0,P.jsx)(V,{icon:`refresh`,label:`reload preview`,title:`Reload the preview`,onClick:x}),(0,P.jsx)(V,{icon:`open_in_new`,label:`open in new tab`,title:`Open in a new tab`,onClick:()=>window.open(i?ee(i.url):``,`_blank`,`noopener`),disabled:!i}),e&&r&&(0,P.jsx)(V,{icon:f===`close`?`progress_activity`:`close`,label:`close preview`,title:n?`The agent is working — close the preview when the turn is done`:`Close the preview (the agent returns to the project root)`,onClick:()=>void C(),disabled:!!f||n})]}),(u||i?.configError)&&(0,P.jsxs)(`div`,{className:Ca,children:[(0,P.jsx)(`span`,{className:`flex-1`,children:u||i?.configError}),u&&(0,P.jsx)(V,{icon:`close`,label:`dismiss`,size:`sm`,className:`rounded-full text-inherit hover:bg-transparent hover:text-inherit`,onClick:()=>d(``)})]}),i?.config.dev&&!w?.running&&!u&&(0,P.jsxs)(W,{className:`flex-none border-b border-line px-3.5 py-1.5`,children:[`This app has a dev command (`,(0,P.jsx)(`code`,{children:i.config.dev}),`). Showing the static folder until you start it.`]}),b&&(0,P.jsx)(`iframe`,{ref:g,className:`vibeable-frame block min-h-0 w-full flex-1 border-0 bg-white`,src:b,title:`vibeable ${t}`,sandbox:`allow-scripts allow-forms allow-popups allow-modals allow-downloads`,allow:`clipboard-write`}),!b&&!u&&(0,P.jsx)(G,{className:`m-auto`,children:`loading…`}),m&&w&&(0,P.jsx)(`pre`,{className:`m-0 max-h-[180px] flex-none overflow-auto border-t border-line bg-surface-2 px-3.5 py-2 font-mono text-[11.5px] leading-[1.5] break-words whitespace-pre-wrap text-fg-2`,"aria-label":`dev server log`,children:w.log.length?w.log.join(`
79
- `):`(no output yet)`})]})}var ba=`vibeable-pane flex flex-col overflow-hidden rounded-2xl bg-surface-2`,xa=`${ba} min-h-0 min-w-0 flex-1`,Sa=`flex min-h-11 flex-none items-center gap-2 border-b border-line py-1.5 pr-2 pl-3.5`,Ca=`flex flex-none items-center gap-2.5 bg-bad-soft py-1.5 pr-2 pl-3.5 text-[12.5px] text-on-bad-soft`;function wa({tone:e,title:t,children:n}){return(0,P.jsxs)(`span`,{className:N(`vibeable-mode inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-2xs font-medium tracking-[0.02em] whitespace-nowrap`,e===`bad`?`bg-bad-soft text-on-bad-soft`:`bg-surface text-fg-2`),title:t,children:[(0,P.jsx)(H,{tone:e}),n]})}function Ta({chatId:e,slug:t,onClosed:n}){let[r,i]=(0,v.useState)(``);return(0,P.jsxs)(`aside`,{className:N(ba,`max-w-[420px] min-w-[320px] flex-none self-start`),"data-vibe":t,children:[(0,P.jsxs)(`div`,{className:Sa,children:[(0,P.jsx)(F,{name:`web`,className:`text-fg-2`}),(0,P.jsx)(`span`,{className:`truncate text-base font-medium`,children:t}),(0,P.jsx)(wa,{tone:`bad`,children:`vibeables are off`}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(V,{icon:`close`,label:`close preview`,title:`Detach the app from this chat`,onClick:()=>va(e,null).then(n).catch(e=>i(e.message))})]}),(0,P.jsxs)(W,{className:`flex-none border-b border-line px-3.5 py-1.5`,children:[`This chat has `,(0,P.jsx)(`b`,{children:t}),` open, but vibeables were switched off in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),`. Turn them back on to see the preview, or detach the app.`]}),r&&(0,P.jsx)(`div`,{className:Ca,children:(0,P.jsx)(`span`,{className:`flex-1`,children:r})})]})}var Ea=`kw-vibeable-agent`;async function Da(e,t){let n=await A.request(`chats.create`,{body:{agent:t,scope:{kind:`general`}}});if(!n.ok)throw Error(j(n));let r=n.data;if(!r.id)throw Error(`HTTP ${n.status}`);await va(r.id,e),z(`/agents/chats/${r.id}`)}function Oa({slug:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)({}),[d,f]=(0,v.useState)({}),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(()=>{try{let e=localStorage.getItem(Ea);return e===`codex`||e===`pi`?e:`claude`}catch{return`claude`}}),_=xe(),y=(0,v.useCallback)(async()=>{try{let e=await A.request(`vibeables.list`);if(!e.ok)throw Error(`HTTP ${e.status}`);n(e.data),i(``)}catch(e){i(e.message||`could not load the apps`)}},[]);(0,v.useEffect)(()=>{let e=!0,t,n=async()=>{await y(),e&&(t=setTimeout(n,15e3))};return n(),()=>{e=!1,clearTimeout(t)}},[y]);let b=[...t?.vibeables??[]].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``)),x=s.trim().toLowerCase(),S=x?b.filter(e=>e.slug.toLowerCase().includes(x)):b,C=e===`new`,w=e&&!C?b.find(t=>t.slug===e):void 0;(0,v.useEffect)(()=>{y()},[e,y]);let T=b[0]?.slug;(0,v.useEffect)(()=>{!e&&T&&z(`/vibeables/${encodeURIComponent(T)}`,{replace:!0})},[e,T]);let E=(e,t)=>u(n=>({...n,[e]:t})),D=e=>u(t=>{let n={...t};return delete n[e],n}),O=(e,t)=>f(n=>({...n,[e]:t.message})),k=async e=>{e.preventDefault();let t=a.trim();if(t&&!l.__new){E(`__new`,`create`),f(e=>({...e,__new:``}));try{let e=await A.request(`vibeables.create`,{body:{name:t}});if(!e.ok)throw Error(j(e));let n=e.data;o(``),await y(),z(`/vibeables/${encodeURIComponent(n.slug??t)}`)}catch(e){O(`__new`,e)}finally{D(`__new`)}}},ee=async e=>{E(e,`open`);try{await Da(e,h)}catch(t){O(e,t),D(e)}},te=async e=>{E(e,`remove`),m(!1);try{let t=await A.request(`vibeables.delete`,{slug:e});if(!t.ok)throw Error(t.error||`failed`);await y(),z(`/vibeables`,{replace:!0})}catch(t){O(e,t),y()}finally{D(e)}},M=e=>{g(e);try{localStorage.setItem(Ea,e)}catch{}},N=e=>e.configError?{label:`config error`,tone:`bad`}:e.hasIndex?{label:e.dev?`dev`:`static`,tone:`ok`}:{label:`no index.html yet`,tone:`idle`},ne;if(t&&!t.enabled)ne=(0,P.jsx)(G,{children:t.error&&!/are off/.test(t.error)?(0,P.jsx)(K,{tone:`bad`,children:t.error}):(0,P.jsxs)(P.Fragment,{children:[`Apps are off. Turn them on in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),` or add a `,(0,P.jsx)(`code`,{children:`vibeables:`}),` block to kraftwerk.yml.`]})});else if(!t)ne=(0,P.jsx)(G,{children:`loading…`});else if(C||b.length===0)ne=(0,P.jsxs)(`form`,{className:`mx-auto flex w-full max-w-[560px] flex-col gap-2.5 px-4 py-10`,onSubmit:e=>void k(e),children:[(0,P.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,P.jsx)(Y,{className:`flex-1 font-mono text-sm`,value:a,placeholder:`e.g. team-dashboard`,"aria-label":`new app name`,onChange:e=>o(e.target.value),autoFocus:!0}),(0,P.jsx)(B,{type:`submit`,variant:`primary`,icon:`add`,busy:!!l.__new,disabled:!a.trim(),children:l.__new?`creating…`:`new app`})]}),d.__new&&(0,P.jsx)(K,{tone:`bad`,children:d.__new}),(0,P.jsxs)(`p`,{className:`m-0 text-xs text-fg-2`,children:[`A small app built live with an agent. One folder each under `,(0,P.jsx)(`code`,{title:t.root,children:t.root}),`; part of the workspace, commit it from the git screen.`]})]});else if(e&&!w)ne=(0,P.jsxs)(G,{children:[`no vibeable named `,e]});else if(w){let e=w,t=N(e),n=l[e.slug];ne=(0,P.jsxs)(`div`,{className:`chat-main gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-4 gap-y-2.5`,children:[(0,P.jsx)(H,{tone:t.tone}),(0,P.jsx)(rt,{children:e.slug}),(0,P.jsx)(U,{tone:t.tone===`bad`?`bad`:t.tone===`ok`?`ok`:`neutral`,children:t.label}),e.updatedAt&&(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,title:e.updatedAt,children:[`changed `,Ke(e.updatedAt)]}),_&&(0,P.jsx)(`span`,{className:`max-w-[40ch] truncate font-mono text-xs text-fg-2`,title:e.path,children:e.path}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsxs)(vt,{className:`h-8 w-auto text-sm`,value:h,onChange:e=>M(e.target.value),"aria-label":`agent for new chats`,children:[(0,P.jsx)(`option`,{value:`claude`,children:`claude`}),(0,P.jsx)(`option`,{value:`codex`,children:`codex`}),(0,P.jsx)(`option`,{value:`pi`,children:`pi`})]}),(0,P.jsx)(B,{variant:`primary`,icon:`chat`,busy:n===`open`,disabled:!!n,onClick:()=>void ee(e.slug),title:`Start a ${h} chat with this app in the preview pane`,children:`open in chat`}),p?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:()=>void te(e.slug),children:`confirm remove`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>m(!1),children:`cancel`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete`,disabled:!!n,onClick:()=>m(!0),title:`Move the folder to the trash`,children:`remove`})]}),(e.configError||d[e.slug])&&(0,P.jsx)(K,{tone:`bad`,children:e.configError||d[e.slug]}),(0,P.jsx)(ya,{slug:e.slug},e.slug)]})}else ne=(0,P.jsx)(G,{children:`loading…`});return(0,P.jsxs)(`div`,{className:`runs-screen vibeables-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`apps`,count:t?.enabled?b.length:void 0,action:t?.enabled&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/vibeables/new`,children:`new`})}),(0,P.jsx)(Et,{icon:`filter_list`,value:s,placeholder:`search apps`,"aria-label":`search apps`,onChange:e=>c(e.target.value)}),(0,P.jsxs)(Dt,{children:[S.map(t=>{let n=N(t);return(0,P.jsx)(`div`,{className:`vibeable-row`,"data-vibeable":t.slug,children:(0,P.jsx)(J,{href:`/vibeables/${encodeURIComponent(t.slug)}`,active:t.slug===e,size:`sm`,leading:(0,P.jsx)(H,{tone:n.tone}),title:t.slug,sub:`${n.label}${t.dev?` · ${t.dev}`:``}`,meta:t.updatedAt&&(0,P.jsx)(`span`,{title:t.updatedAt,children:Ke(t.updatedAt)})})},t.slug)}),t&&b.length===0&&(0,P.jsx)(Ot,{children:`nothing built yet`}),t&&b.length>0&&S.length===0&&(0,P.jsx)(Ot,{children:`no vibeable matches`}),r&&(0,P.jsx)(K,{tone:`bad`,children:r})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:ne})]})}function ka({slug:e}){let t=M(`channels.list`,{},{interval:4e3}),n=M(`agents.list`,{},{interval:15e3}),r=e?t?.channels.find(t=>t.slug===e):void 0;return e?t?r?(0,P.jsx)(Na,{channel:r,agents:n?.agents??[]},r.slug):(0,P.jsx)(G,{icon:`forum`,children:`channel not found`}):(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(Na,{agents:n?.agents??[]})}function Aa({seg:e}){let t=e[0]&&e[0]!==`new`?decodeURIComponent(e[0]):void 0,n=e[0]===`new`?`new`:t&&e[1]===`edit`?`edit`:t?`channel`:`home`,r=M(`channels.list`,{},{interval:4e3}),i=M(`agents.list`,{},{interval:15e3}),a=r?.channels??[],o=t?a.find(e=>e.slug===t):void 0,s=a.reduce((e,t)=>!e||t.updatedAt>e.updatedAt?t:e,void 0);(0,v.useEffect)(()=>{n===`home`&&s&&z(`/channels/${encodeURIComponent(s.slug)}`,{replace:!0})},[n,s?.slug]);let c;return c=n===`new`?(0,P.jsx)(Na,{agents:i?.agents??[]}):n===`edit`&&o?(0,P.jsx)(Na,{channel:o,agents:i?.agents??[]},o.slug):n===`channel`&&o?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:o.chatId,channel:o,agents:i?.agents??[]},o.chatId)}):n===`channel`&&r?(0,P.jsx)(G,{icon:`forum`,children:`channel not found`}):n===`channel`||!r||s?(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(ja,{}),(0,P.jsxs)(`div`,{className:`runs-screen channels-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`channels`,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/channels/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[a.map(e=>(0,P.jsx)(J,{href:`/channels/${encodeURIComponent(e.slug)}`,active:e.slug===t,size:`sm`,leading:(0,P.jsx)(H,{tone:e.awaitingApproval?`bad`:e.busy?`working`:`idle`,title:e.awaitingApproval?`waiting for your approval`:e.busy?`an agent is working`:void 0}),title:`#${e.slug}`,sub:`${e.name}${e.project?` · 📁 ${e.project}`:``}${e.members.length?` · ${e.members.map(e=>`@${e}`).join(` `)}`:``}`,meta:Ge(e.updatedAt)},e.slug)),r&&a.length===0&&(0,P.jsx)(Ot,{children:`no channels yet — create one, or add a coworker to an agent session or a project chat`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:c})]})}function ja(){return(0,P.jsx)(G,{className:`m-auto`,action:(0,P.jsx)(B,{variant:`primary`,icon:`add`,href:`/channels/new`,children:`new channel`}),children:null})}function Ma({agents:e,checked:t,onToggle:n,none:r}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-control border border-line p-1`,children:[e.map(e=>(0,P.jsx)(xt,{checked:t.includes(e.slug),onChange:t=>n(e.slug,t),hint:`@${e.slug}${e.description?` · ${e.description}`:``}`,className:N(`rounded-control px-2.5 py-1.5 transition-colors hover:bg-surface-2`,t.includes(e.slug)&&`bg-surface-2`),children:(0,P.jsxs)(`b`,{className:`font-semibold`,children:[e.emoji,` `,e.name]})},e.slug)),e.length===0&&(0,P.jsx)(G,{className:`py-4`,children:r})]})}function Na({channel:e,agents:t}){let[n,r]=(0,v.useState)(e?.name??``),[i,a]=(0,v.useState)(e?.purpose??``),[o,s]=(0,v.useState)(e?.members??[]),[c,l]=(0,v.useState)(e?.responder??``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),m=t.filter(e=>!e.archived);function h(e,t){s(n=>t?[...n.filter(t=>t!==e),e]:n.filter(t=>t!==e)),!t&&c===e&&l(``)}async function g(){d(!0),p(``);try{let t={name:n,purpose:i,members:o,responder:c||null},r=e?await A.request(`channels.save`,{slug:e.slug,body:t}):await A.request(`channels.create`,{body:t});if(!r.ok)throw Error(j(r));z(`/channels/${encodeURIComponent(r.data.slug)}`)}catch(e){p(e.message)}d(!1)}async function _(){e&&window.confirm(`Move #${e.slug} and its transcript to the trash?`)&&(await A.request(`channels.delete`,{slug:e.slug}).catch(()=>{}),z(`/channels`))}return(0,P.jsx)(at,{width:`narrow`,children:(0,P.jsx)(q,{title:e?`edit #${e.slug}`:`new channel`,actions:e&&(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:()=>void _(),children:`delete`}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 p-[18px]`,children:[(0,P.jsx)(X,{label:`name`,children:(0,P.jsx)(Y,{value:n,placeholder:`e.g. Website relaunch`,onChange:e=>r(e.target.value),autoFocus:!0})}),(0,P.jsx)(X,{label:`purpose — one line the agents read`,children:(0,P.jsx)(Y,{value:i,placeholder:`what this channel is for`,onChange:e=>a(e.target.value)})}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`members — agents in this channel`}),(0,P.jsx)(Ma,{agents:m,checked:o,onToggle:h,none:`no agents yet — create one on the agents screen first`})]}),(0,P.jsx)(X,{label:`responder — answers when a message mentions nobody`,children:(0,P.jsxs)(vt,{value:c,onChange:e=>l(e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:`nobody (agents only answer when @mentioned)`}),o.map(e=>(0,P.jsxs)(`option`,{value:e,children:[`@`,e]},e))]})}),f&&(0,P.jsx)(K,{tone:`bad`,children:f}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,busy:u,disabled:!n.trim()||o.length===0,onClick:()=>void g(),children:u?`saving…`:e?`save`:`create channel`}),(0,P.jsx)(B,{variant:`quiet`,href:e?`/channels/${encodeURIComponent(e.slug)}`:`/channels`,children:`cancel`})]})]})})})}function Pa({chatId:e,agentSlug:t,project:n,title:r,onClose:i,onCreated:a}){let[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(r||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``);(0,v.useEffect)(()=>{A.call(`agents.list`).then(e=>s(e.agents.filter(e=>!e.archived&&e.slug!==t))).catch(()=>{})},[t]);async function g(){p(!0),h(``);try{let n=await A.request(`channels.fromChat`,{body:{chatId:e,name:c,members:t?[t,...u]:u,responder:t??u[0]}});if(!n.ok)throw Error(j(n));let r=n.data;if(!r.slug)throw Error(`HTTP ${n.status}`);i(),a?a(r.slug):z(`/channels/${encodeURIComponent(r.slug)}`)}catch(e){h(e.message)}p(!1)}return(0,P.jsx)(`div`,{className:`fixed inset-0 z-40 grid animate-fade place-items-center bg-[color-mix(in_srgb,var(--text)_32%,transparent)] p-6`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`div`,{className:`max-h-[calc(100dvh-48px)] w-[min(560px,100%)] animate-rise overflow-y-auto rounded-card border border-line bg-surface shadow-modal`,role:`dialog`,"aria-label":`Add a coworker`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-line px-[18px] py-2`,children:[(0,P.jsx)(tt,{className:`text-fg`,children:`add a coworker`}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(V,{icon:`close`,label:`close`,size:`sm`,onClick:i})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 p-[18px]`,children:[(0,P.jsx)(`p`,{className:`m-0 text-sm text-fg-2`,children:t?(0,P.jsxs)(P.Fragment,{children:[`This session becomes a channel: @`,t,` stays and keeps its memory, the agents you pick join, and everyone reads the same transcript. @`,t,` answers when nobody is mentioned.`]}):(0,P.jsxs)(P.Fragment,{children:[`This chat becomes a channel session of the project `,(0,P.jsx)(`b`,{className:`text-fg`,children:n}),` and stays here: the agents you pick join with everything said so far and the project's brief, state, records and links. The first one you pick answers when nobody is mentioned.`]})}),(0,P.jsx)(X,{label:`channel name`,children:(0,P.jsx)(Y,{value:c,placeholder:`e.g. Website relaunch`,onChange:e=>l(e.target.value),autoFocus:!0})}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`invite`}),(0,P.jsx)(Ma,{agents:o,checked:u,onToggle:(e,t)=>d(n=>t?[...n,e]:n.filter(t=>t!==e)),none:`no other agents to invite yet`})]}),m&&(0,P.jsx)(K,{tone:`bad`,children:m}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,busy:f,disabled:!c.trim()||u.length===0,onClick:()=>void g(),children:f?`creating…`:`create channel`}),(0,P.jsx)(B,{variant:`quiet`,onClick:i,children:`cancel`})]})]})]})})}var Fa=`kw-sessions-list`,Ia=(()=>{try{return localStorage.getItem(Fa)===`open`}catch{return!1}})(),La=new Set;function Ra(e){Ia=e;try{localStorage.setItem(Fa,e?`open`:`hidden`)}catch{}La.forEach(e=>e())}function za({busy:e,onClick:t,href:n}){return(0,P.jsx)(V,{icon:e?`progress_activity`:`add`,label:`new chat`,size:`sm`,className:`mb-1 ml-1 rounded-full`,disabled:e,onClick:t,href:n})}function Ba(){return(0,v.useSyncExternalStore)(e=>(La.add(e),()=>La.delete(e)),()=>Ia)}var Va=e=>`kw-tabs:${e}`,Ha=e=>{try{let t=JSON.parse(localStorage.getItem(Va(e))??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},Ua=(e,t)=>{try{localStorage.setItem(Va(e),JSON.stringify(t))}catch{}};function Wa({name:e,onDone:t}){let[n,r]=(0,v.useState)(e),i=n.replace(/\s+/g,` `).trim().slice(0,80);return(0,P.jsx)(`input`,{autoFocus:!0,value:n,"aria-label":`chat name`,maxLength:80,className:`-mb-px w-[220px] flex-none self-end rounded-t-[10px] border border-b-0 border-accent bg-surface px-3 py-[7px] font-[inherit] text-sm font-medium text-fg outline-none`,onFocus:e=>e.currentTarget.select(),onChange:e=>r(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t(i&&i!==e?i:void 0),n.key===`Escape`&&t()},onBlur:()=>t(i&&i!==e?i:void 0)})}var Ga=`kw-strip-end`;function Ka({children:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let e=document.getElementById(Ga);e!==t&&n(e)}),t?(0,ma.createPortal)(e,t):null}function qa({storeKey:e,label:t,fallbackTitle:n,chatId:r,filter:i,hrefOf:a,closeHref:o,subOf:s,actions:c}){let l=M(`chats.list`,{},{refresh:r}),u=(0,v.useMemo)(()=>i(l?.chats??[]),[l,i]),d=(0,v.useMemo)(()=>new Map(u.map(e=>[e.id,e])),[u]),f=Ba(),[p,m]=(0,v.useState)(()=>Ha(e)),[h,g]=(0,v.useState)(!1),_=t=>{m(t),Ua(e,t)};(0,v.useEffect)(()=>{r&&!p.includes(r)&&_([...p,r])},[r]),(0,v.useEffect)(()=>{if(!l)return;let e=p.filter(e=>d.has(e));e.length!==p.length&&_(e)},[l]);let y=e=>{let t=p.indexOf(e),n=p.filter(t=>t!==e);if(_(n),e!==r)return;let i=d.get(n[Math.min(Math.max(t,0),n.length-1)]??``);z(i?a(i):o)},b=async e=>{window.confirm(`Delete ${t===`chats`?`chat`:`session`} "${e.title||e.id}"?`)&&(await A.request(`chats.delete`,{id:e.id}).catch(()=>{}),p.includes(e.id)&&y(e.id))},[x,S]=(0,v.useState)(null),C=async(e,t)=>{S(null),await A.request(`chats.rename`,{id:e,body:{title:t}}).catch(()=>null)},w=l?p.filter(e=>d.has(e)):[],T=e=>e.scope.kind===`channel`?e.title||`#${e.scope.slug}`:e.title||n;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`nav`,{className:`order-first col-span-full flex min-w-0 items-end gap-1 border-b border-line bg-surface-2 pt-1.5 pr-2 pl-1.5`,"aria-label":`open chats`,children:[(0,P.jsxs)(`button`,{type:`button`,className:N(`mb-1 inline-flex flex-none cursor-pointer items-center gap-1 self-center rounded-control px-2 py-1 text-2xs transition-colors`,f?`bg-accent-soft text-on-accent-soft`:`text-fg-2 hover:bg-surface hover:text-fg`),onClick:()=>Ra(!f),title:f?`hide the ${t} list`:`show all ${t}`,"aria-label":`${t} list`,"aria-pressed":f,children:[(0,P.jsx)(F,{name:`view_list`,className:`ms-sm`}),l&&(0,P.jsx)(`span`,{className:`tabular-nums`,children:u.length})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,role:`tablist`,children:[w.map(e=>{let t=d.get(e),n=e===r;return x===e?(0,P.jsx)(Wa,{name:T(t),onDone:t=>t?void C(e,t):S(null)},e):(0,P.jsxs)(ge,{href:a(t),className:N(`session-tab group/tab -mb-px inline-flex max-w-[220px] min-w-0 flex-none animate-tab-in items-center gap-1.5 self-end`,`rounded-t-[10px] border border-b-0 py-[7px] pr-1.5 pl-3 text-sm font-medium no-underline transition-colors`,n?`border-line bg-surface text-fg`:`border-transparent text-fg-2 hover:bg-surface`),role:`tab`,"aria-selected":n,title:`${T(t)} · double-click to rename`,onDoubleClick:t=>{t.preventDefault(),S(e)},children:[(t.busy||t.awaitingApproval)&&(0,P.jsx)(H,{tone:t.awaitingApproval?`bad`:`working`,title:t.awaitingApproval?`waiting for your approval`:`working`}),t.scope.kind===`channel`&&(0,P.jsx)(F,{name:`forum`,className:`ms-sm text-fg-2`}),(0,P.jsx)(`span`,{className:`truncate`,children:T(t)}),n&&(0,P.jsx)(`button`,{type:`button`,className:`inline-flex flex-none cursor-pointer rounded-md p-0.5 text-fg-2 opacity-0 transition-opacity group-hover/tab:opacity-100 hover:bg-surface-2 hover:text-fg focus-visible:opacity-100 pointer-coarse:opacity-100`,"aria-label":`rename ${T(t)}`,title:`rename`,onClick:t=>{t.preventDefault(),t.stopPropagation(),S(e)},children:(0,P.jsx)(F,{name:`edit`,className:`ms-sm`})}),(0,P.jsx)(`button`,{type:`button`,className:N(`inline-flex flex-none cursor-pointer rounded-md p-0.5 text-fg-2 transition-opacity hover:bg-surface-2 hover:text-fg focus-visible:opacity-100`,n?`opacity-100`:`opacity-0 group-hover/tab:opacity-100`),"aria-label":`close ${T(t)}`,title:`close tab`,onClick:t=>{t.preventDefault(),t.stopPropagation(),y(e)},children:(0,P.jsx)(F,{name:`close`,className:`ms-sm`})})]},e)}),c]}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(`span`,{id:Ga,className:`mb-1 flex flex-none items-center gap-0.5 self-center`})]}),f&&(0,P.jsxs)(`aside`,{className:`runs-side sessions-side animate-slide-left`,children:[(0,P.jsx)(Tt,{title:t,action:(0,P.jsx)(V,{icon:`close`,label:`hide the list`,size:`sm`,onClick:()=>Ra(!1)})}),(0,P.jsxs)(Dt,{children:[u.map(e=>(0,P.jsx)(J,{href:a(e),active:e.id===r,size:`sm`,leading:(0,P.jsx)(H,{tone:e.awaitingApproval?`bad`:e.busy?`working`:`idle`,title:e.awaitingApproval?`waiting for your approval`:void 0}),title:(0,P.jsxs)(P.Fragment,{children:[e.scope.kind===`channel`&&(0,P.jsx)(F,{name:`forum`,className:`ms-sm mr-1 align-[-3px]`}),T(e)]}),sub:(0,P.jsxs)(P.Fragment,{children:[s&&(0,P.jsxs)(P.Fragment,{children:[s(e),` · `]}),(0,P.jsx)(`span`,{className:`tabular-nums`,children:Ge(e.updatedAt)})]}),actions:(0,P.jsx)(V,{icon:`close`,size:`sm`,label:t===`chats`?`delete chat`:`delete session`,disabled:h,onClick:()=>{g(!0),b(e).finally(()=>g(!1))}})},e.id)),l&&u.length===0&&(0,P.jsxs)(Ot,{children:[`no `,t,` yet`]})]})]})]})}var Ja=`kw-me`;function Ya(){try{return localStorage.getItem(Ja)||``}catch{return``}}function Xa(e){try{localStorage.setItem(Ja,e)}catch{}}function Za(e,t){A.request(`chats.cancel`,{id:e,body:t?{agent:t}:{}}).catch(()=>{})}var Qa=(e,t=90)=>{let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t)}…`:n};function $a(e,t){let n=RegExp(`(^|[^a-z0-9-])@${t.replace(/[.*+?^${}()|[\\]\\]/g,`\\$&`)}(?![a-z0-9-])`,`i`),r,i,a=!1,o=``;for(let s of e){if(s.from?.kind!==`agent`||s.from.slug!==t){(s.type===`user_message`||s.type===`text`)&&n.test(s.text)&&(r=Qa(s.text));continue}switch(s.type){case`turn_start`:a=!0,i=void 0,o=``;break;case`turn_end`:case`error`:a=!1;break;case`tool_call`:a&&(i=Qa(`${s.kind&&s.kind!==`other`?`${s.kind}: `:``}${s.title}`));break;case`text`:a&&(o+=s.text,(!i||i.startsWith(`says: `))&&(i=Qa(`says: ${o}`)))}}return{task:r,now:i}}function eo(e,t){let n=e=>!t&&!e||t?.kind===`agent`&&e?.kind===`agent`&&e.slug===t.slug,r=null,i,a=[],o=[],s;for(let t of e)n(t.from)&&(t.type===`plan`?r=t.entries:t.type===`usage`?i={used:t.used,size:t.size,costUsd:t.costUsd}:t.type===`commands`?a=t.commands:t.type===`config`?o=t.options:t.type===`auth`&&(s=t));return{plan:r,usage:i,commands:a,config:o,auth:s}}var to=(0,v.createContext)(()=>`The agent`),no=()=>(0,v.useContext)(to);function ro(e){let t=new Map;for(let n of e)(n.type===`permission_request`||n.type===`elicitation_request`)&&t.set(n.requestId,n.from??null),(n.type===`permission_resolved`||n.type===`elicitation_resolved`)&&t.delete(n.requestId);return t.size?[...t.values()][0]:void 0}function io(e,t,n){if(e.kind===`agent`){let r=t.find(t=>t.slug===e.slug);return r?`${r.emoji?`${r.emoji} `:``}${r.name}`:n??e.slug}return e.kind===`general`||e.kind===`kraftwerk`?`🎩 Ralv`:e.kind===`project`?`${Be.emoji} ${Be.name}`:`The assistant`}var ao=`kw-browse`;function oo(e){window.dispatchEvent(new CustomEvent(ao,{detail:e}))}function so(e){if(!/<a\s/i.test(e))return e;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`a[href^="http://"], a[href^="https://"]`)){if(e.classList.contains(`md-browse`))continue;let t=document.createElement(`a`);t.className=`md-browse ml-0.5 inline-grid size-[18px] place-items-center rounded-[5px] align-[-3px] text-fg-2 no-underline opacity-55 transition hover:bg-surface-2 hover:text-accent hover:opacity-100 [&_.ms]:align-[0] [&_.ms]:text-[14px]`,t.href=e.getAttribute(`href`)??``,t.title=`Open beside the conversation`,t.setAttribute(`aria-label`,`Open beside the conversation`),t.innerHTML=`<span class="ms material-symbols-rounded ms-sm" aria-hidden="true">open_in_new</span>`,e.after(t)}return t.innerHTML}function co(e){let t=e.target.closest?.(`a.md-browse`);t&&(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||(e.preventDefault(),oo(t.href)))}var lo=`kw-browser-tabs`;function uo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function fo(e){let t=e.trim();return t?/^[a-z]+:\/\//i.test(t)?t:`https://${t}`:``}function po({storeKey:e,onTabs:t}){let n=`${lo}:${e}`,[r,i]=(0,v.useState)(()=>{try{let e=JSON.parse(sessionStorage.getItem(n)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e.url==`string`&&typeof e.id==`number`):[]}catch{return[]}}),[a,o]=(0,v.useState)(()=>r[0]?.id??null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)({}),d=(0,v.useRef)(Math.max(0,...r.map(e=>e.id))+1);(0,v.useEffect)(()=>{try{sessionStorage.setItem(n,JSON.stringify(r))}catch{}t?.(r.length)},[r,t,n]);let f=e=>{i(t=>{let n=t.find(t=>t.url===e);if(n)return o(n.id),t;let r={id:d.current++,url:e};return o(r.id),[...t,r]})};(0,v.useEffect)(()=>{let e=e=>f(e.detail);return window.addEventListener(ao,e),()=>window.removeEventListener(ao,e)},[]);let p=r.find(e=>e.id===a)??null;(0,v.useEffect)(()=>c(p?.url??``),[p?.url]);let m=e=>{i(t=>{let n=t.findIndex(t=>t.id===e),r=t.filter(t=>t.id!==e);return a===e&&o(r[Math.min(n,r.length-1)]?.id??null),r})},h=()=>{let e=fo(s);e&&(p?i(t=>t.map(t=>t.id===p.id?{...t,url:e}:t)):f(e))},g=`grid size-[30px] flex-none place-items-center rounded-full text-fg-2 no-underline transition-colors hover:bg-surface hover:text-fg`;return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-card border border-line bg-surface`,children:[(0,P.jsxs)(`div`,{className:`flex flex-none items-center gap-0.5 overflow-x-auto px-1.5 pt-1.5 [scrollbar-width:none]`,role:`tablist`,"aria-label":`Browser tabs`,children:[r.map(e=>(0,P.jsxs)(`div`,{className:N(`flex max-w-[180px] items-center rounded-t-lg`,e.id===a?`bg-surface-2 text-fg`:`text-fg-2`),children:[(0,P.jsx)(`button`,{role:`tab`,"aria-selected":e.id===a,className:`min-w-0 cursor-pointer truncate border-0 bg-transparent py-1.5 pr-1 pl-2.5 text-[12.5px] font-semibold text-inherit`,title:e.url,onClick:()=>o(e.id),children:uo(e.url)}),(0,P.jsx)(V,{icon:`close`,label:`Close ${uo(e.url)}`,className:`size-6 text-inherit`,onClick:()=>m(e.id)})]},e.id)),(0,P.jsx)(V,{icon:`add`,label:`New tab`,className:`ml-1 size-6`,onClick:()=>{o(null),c(``)}})]}),(0,P.jsxs)(`form`,{className:`flex flex-none items-center gap-1 border-y border-line bg-surface-2 px-2 py-1.5`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,P.jsx)(`button`,{type:`button`,className:N(g,`cursor-pointer border-0 bg-transparent disabled:pointer-events-none disabled:opacity-40`),title:`Reload`,"aria-label":`Reload`,disabled:!p,onClick:()=>p&&u(e=>({...e,[p.id]:(e[p.id]??0)+1})),children:(0,P.jsx)(F,{name:`refresh`})}),(0,P.jsx)(`input`,{className:`h-[30px] min-w-0 flex-1 rounded-full border border-line bg-surface px-3 font-sans text-[13px] text-fg focus:border-fg focus:outline-none`,value:s,placeholder:`https://…`,"aria-label":`Address`,spellCheck:!1,onChange:e=>c(e.target.value)}),(0,P.jsx)(`button`,{type:`submit`,className:N(g,`cursor-pointer border-0 bg-transparent`),title:`Go`,"aria-label":`Go`,children:(0,P.jsx)(F,{name:`arrow_forward`})}),(0,P.jsx)(`a`,{className:N(g,!p&&`pointer-events-none opacity-40`),href:p?.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a window`,"aria-label":`Open in a window`,children:(0,P.jsx)(F,{name:`open_in_new`})})]}),(0,P.jsxs)(`div`,{className:`relative min-h-0 flex-1 bg-white`,children:[r.map(e=>(0,P.jsx)(`iframe`,{className:`block size-full border-0 bg-white [&[hidden]]:hidden`,src:e.url,title:uo(e.url),hidden:e.id!==a,sandbox:`allow-scripts allow-forms allow-popups allow-same-origin allow-downloads`,referrerPolicy:`no-referrer-when-downgrade`},`${e.id}:${l[e.id]??0}`)),!p&&(0,P.jsxs)(`div`,{className:`absolute inset-0 grid place-content-center justify-items-center gap-2 bg-surface p-6 text-center text-fg-2`,children:[(0,P.jsx)(F,{name:`public`,className:`text-[32px]`}),(0,P.jsxs)(`p`,{className:`m-0 max-w-[36ch] text-[13.5px]`,children:[`Read a page beside the conversation: type an address, or click the `,(0,P.jsx)(F,{name:`open_in_new`,className:`ms-sm align-[-3px]`}),` next to a link in the chat.`]})]})]})]})}var mo=(e,t)=>!e&&!t||!!e&&!!t&&e.kind===t.kind&&(e.kind===`human`?e.name===t.name:e.slug===t.slug);function ho(e){let t=[],n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Map,c,l;for(let u of e){let e=`subagent`in u&&u.subagent?r.get(u.subagent):void 0,d=e?e.children:t,f=d[d.length-1];switch(u.type){case`user_message`:c=u.text,d.push({kind:`user`,text:u.text,steered:u.steered,attachments:u.attachments,key:`e${u.seq}`,from:u.from});break;case`text`:f?.kind===`agent`&&mo(f.from,u.from)?f.text+=u.text:d.push({kind:`agent`,text:u.text,key:`e${u.seq}`,from:u.from});break;case`thought`:f?.kind===`thought`&&mo(f.from,u.from)?f.text+=u.text:d.push({kind:`thought`,text:u.text,key:`e${u.seq}`,from:u.from});break;case`tool_call`:{let e={kind:`tool`,callId:u.callId,title:u.title,toolKind:u.kind,status:u.status,compaction:u.compaction,key:`e${u.seq}`,from:u.from};n.set(u.callId,e),d.push(e);break}case`tool_update`:{let e=n.get(u.callId);e&&(u.title&&(e.title=u.title),u.status&&(e.status=u.status),u.compaction&&(e.compaction={...e.compaction,...u.compaction}));break}case`subagent`:{let e={kind:`subagent`,sessionId:u.sessionId,name:u.name,task:u.task,children:[],key:`e${u.seq}`,from:u.from};r.set(u.sessionId,e),t.push(e);break}case`subagent_state`:{let e=r.get(u.sessionId);e&&(e.state=u.state);break}case`task`:{let e={kind:`task`,taskId:u.taskId,name:u.name,taskType:u.taskType,description:u.description,canStop:u.canStop,state:`running`,key:`e${u.seq}`,from:u.from};i.set(u.taskId,e),d.push(e);break}case`task_update`:{let e=i.get(u.taskId);e&&(u.description&&(e.description=u.description),u.summary&&(e.summary=u.summary),u.state&&(e.state=u.state));break}case`permission_request`:s.set(u.requestId,d.length),d.push({kind:`permission`,requestId:u.requestId,title:u.title,options:u.options,resolved:void 0,key:`e${u.seq}`,from:u.from});break;case`permission_resolved`:{let e=s.get(u.requestId);e!=null&&(d[e].resolved=u.optionId);break}case`error`:d.push({kind:`error`,text:u.message,key:`e${u.seq}`,from:u.from});break;case`failure`:{let{type:e,seq:n,ts:r,from:i,...o}=u,s=a.get(o.id);if(s&&o.revision>=s.failure.revision)s.failure=o,s.resolved=!1,s.retryText=c;else if(!s){let e={kind:`failure`,failure:o,resolved:!1,retryText:c,key:`e${u.seq}`,from:i};a.set(o.id,e),t.push(e)}break}case`turn_end`:for(let e of a.values())e.resolved=!0;break;case`plan`:u.entries===null?l&&(l.removed=!0):l&&!l.removed?l.entries=u.entries:(l={kind:`plan`,entries:u.entries,removed:!1,key:`e${u.seq}`,from:u.from},t.push(l));break;case`files_changed`:(u.paths.length>0||u.uncertainty)&&t.push({kind:`files`,paths:u.paths,complete:u.complete,...u.uncertainty?{note:u.uncertainty}:{},key:`e${u.seq}`,from:u.from});break;case`elicitation_request`:{let e={kind:`question`,requestId:u.requestId,message:u.message,fields:u.fields,key:`e${u.seq}`,from:u.from};o.set(u.requestId,e),t.push(e);break}case`elicitation_resolved`:{let e=o.get(u.requestId);e&&(e.resolved={action:u.action,...u.action===`accept`?{content:u.content}:{}});break}}}return t}function go({b:e,chatId:t}){let[n,r]=(0,v.useState)({}),[i,a]=(0,v.useState)(!1),o=no(),[s,c]=(0,v.useState)(null),l=e.resolved===void 0&&!s;async function u(r){a(!0);try{let i=await A.request(`chats.elicitation`,{id:t,body:{requestId:e.requestId,action:r,...r===`accept`?{content:n}:{}}});i.ok||c(i.error??`request failed (${i.status})`)}catch{}a(!1)}let d=(e,t)=>r(n=>({...n,[e]:t})),f=e.fields.some(e=>e.required&&(n[e.key]===void 0||n[e.key]===``));return(0,P.jsx)(_o,{className:N(`question-card`,l&&`pending`),requestId:e.requestId,who:`${o(e.from)} asks`,what:e.message,children:l?(0,P.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2.5`,children:[e.fields.map(e=>(0,P.jsxs)(`label`,{className:N(`flex flex-col gap-1.5 text-sm`,e.custom&&`-mt-1`),children:[(e.title||e.description)&&!e.custom&&(0,P.jsxs)(`span`,{children:[e.title&&(0,P.jsx)(`b`,{children:e.title}),e.description&&(0,P.jsxs)(`span`,{className:`opacity-85`,children:[` `,e.description]})]}),e.kind===`select`&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.options?.map(t=>(0,P.jsx)(B,{size:`sm`,variant:n[e.key]===t.value?`primary`:`secondary`,title:t.description,onClick:()=>d(e.key,t.value),children:t.label},t.value))}),e.kind===`multiselect`&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.options?.map(t=>{let r=n[e.key]??[],i=r.includes(t.value);return(0,P.jsx)(B,{size:`sm`,variant:i?`primary`:`secondary`,title:t.description,onClick:()=>d(e.key,i?r.filter(e=>e!==t.value):[...r,t.value]),children:t.label},t.value)})}),e.kind===`text`&&(0,P.jsx)(Y,{className:`max-w-[60ch]`,placeholder:e.custom?`or type your own answer`:e.title??e.key,value:n[e.key]??``,onChange:t=>d(e.key,t.target.value)}),e.kind===`number`&&(0,P.jsx)(Y,{type:`number`,className:`max-w-[60ch]`,value:n[e.key]??``,onChange:t=>d(e.key,t.target.value===``?``:Number(t.target.value))}),e.kind===`boolean`&&(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:n[e.key]===!0,onChange:t=>d(e.key,t.target.checked)}),` `,e.title??e.key]})]},e.key)),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,disabled:i||f,onClick:()=>u(`accept`),children:`answer`}),(0,P.jsx)(B,{disabled:i,onClick:()=>u(`decline`),children:`skip`})]})]}):(0,P.jsx)(vo,{children:s?`→ ${s}`:e.resolved?.action===`accept`?`→ ${Object.values(e.resolved.content??{}).filter(e=>e!==``&&e!==void 0&&!(Array.isArray(e)&&e.length===0)).map(e=>Array.isArray(e)?e.join(`, `):String(e)).join(` · `)||`answered`}`:e.resolved?.action===`decline`?`→ skipped`:`→ dismissed`})})}function _o({className:e,requestId:t,who:n,what:r,children:i}){return(0,P.jsxs)(`div`,{className:N(`perm-card max-w-[76ch] self-start rounded-2xl bg-ask-soft px-4 py-3 text-on-ask-soft`,e),"data-request":t,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-[3px]`,children:[(0,P.jsx)(`span`,{className:`perm-who text-[12.5px] font-semibold text-fg-2`,children:n}),(0,P.jsx)(`span`,{className:`text-base font-semibold [overflow-wrap:anywhere] text-fg`,children:r})]}),i]})}function vo({children:e}){return(0,P.jsx)(`div`,{className:`mt-1.5 font-mono text-xs text-fg-2`,children:e})}function yo({b:e,chatId:t}){let[n,r]=(0,v.useState)(!1),i=no(),[a,o]=(0,v.useState)(null),s=e.resolved===void 0&&!a;async function c(n){r(!0);try{let r=await A.request(`chats.permission`,{id:t,body:{requestId:e.requestId,optionId:n}});r.ok||o(r.error??`request failed (${r.status})`)}catch{}r(!1)}return(0,P.jsx)(_o,{className:N(s&&`pending`),requestId:e.requestId,who:`${i(e.from)} asks for your OK`,what:e.title,children:s?(0,P.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.options.map(e=>(0,P.jsx)(B,{variant:e.kind?.startsWith(`allow`)?`primary`:`secondary`,disabled:n,title:e.name,onClick:()=>c(e.optionId),children:bo(e)},e.optionId))}):(0,P.jsx)(vo,{children:e.resolved?`→ ${(()=>{let t=e.options.find(t=>t.optionId===e.resolved);return t?bo(t):e.resolved})()}`:a?`→ ${a}`:`→ dismissed`})})}function bo(e){return e.kind===`allow_once`?`Allow`:e.kind===`allow_always`?`Always allow`:e.kind===`reject_once`?`Don't allow`:e.kind===`reject_always`?`Never allow`:e.name}var xo=new Set([`tool`,`thought`,`subagent`,`task`,`files`]);function So({id:e,events:t,busy:n,channel:r,agentMap:i,working:a,focus:o}){let s=xe(),c=(0,v.useMemo)(()=>{let e=ho(o?t.filter(e=>e.from?.kind===`human`||e.from?.kind===`agent`&&e.from.slug===o):t);return s||o?e:e.filter(e=>!xo.has(e.kind))},[t,s,o]),l=no(),u=(0,v.useMemo)(()=>ro(t),[t]),d=(0,v.useRef)(null),f=(0,v.useRef)(!0);return(0,v.useEffect)(()=>{let e=d.current;e&&f.current&&(e.scrollTop=e.scrollHeight)},[c,n]),(0,P.jsxs)(`div`,{className:`-mx-5 flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto px-[22px] pt-3.5 pb-5 [&>:nth-last-child(-n+3)]:animate-rise`,ref:d,onClick:co,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<60},children:[c.length===0&&(0,P.jsx)(G,{className:`m-auto`,children:r?`say something — @mention an agent to wake it${r.responder?`, or just write: @${r.responder} answers`:``}`:`say something — the agent starts on your first message`}),c.map((t,n)=>{let a=c[n-1],o=r&&t.kind!==`error`&&(!a||!mo(a.from,t.from)||a.kind===`error`)?t.from:void 0;return(0,P.jsxs)(`div`,{className:`contents`,children:[o&&(0,P.jsx)(Co,{from:o,agentMap:i}),(0,P.jsx)(Do,{b:t,chatId:e})]},t.key)}),n&&u!==void 0&&(0,P.jsxs)(`div`,{className:`chat-working waiting flex animate-breathe items-center gap-2 text-xs font-semibold text-bad`,children:[(0,P.jsx)(H,{tone:`bad`}),` `,l(u??void 0),` is waiting for you`]}),n&&u===void 0&&(0,P.jsxs)(`div`,{className:`chat-working flex animate-breathe items-center gap-2 text-xs text-fg-2`,children:[(0,P.jsx)(H,{tone:`working`}),` `,r&&a?.length?a.map(e=>`${i?.get(e)?.emoji??``} @${e}`).join(`, `)+(a.length===1?` is working…`:` are working…`):`${l()} is working…`]})]})}function Co({from:e,agentMap:t}){let n=`mt-2.5 -mb-0.5 inline-flex items-center gap-2 text-sm text-fg-2 no-underline`,r=`grid size-[22px] place-items-center rounded-full text-xs font-semibold`;if(e.kind===`human`)return(0,P.jsxs)(`div`,{className:N(`byline human self-end`,n),children:[(0,P.jsx)(`span`,{className:N(r,`bg-accent text-on-accent`),children:e.name.slice(0,1).toUpperCase()}),(0,P.jsx)(`span`,{className:`byline-name font-semibold text-fg`,children:e.name})]});let i=t?.get(e.slug);return(0,P.jsxs)(ge,{href:`/agents/${encodeURIComponent(e.slug)}/info`,className:N(`byline agent self-start`,n),children:[(0,P.jsx)(`span`,{className:N(r,`bg-accent-soft text-on-accent-soft`),children:i?.emoji??`🤖`}),(0,P.jsx)(`span`,{className:`byline-name font-semibold text-fg`,children:i?.name??e.slug}),(0,P.jsxs)(`span`,{className:`font-mono text-2xs`,children:[`@`,e.slug]})]})}function wo({text:e,small:t}){let n=(0,v.useMemo)(()=>so(pa.sanitize(Q.parse(e,{async:!1}))),[e]);return(0,P.jsx)(`div`,{className:N(`md-body h-auto self-stretch overflow-visible p-0 break-words text-fg`,t?`font-sans text-[12.5px] leading-[1.6]`:`font-reading text-[17px] leading-[1.62]`,`[&_img]:my-1 [&_img]:block [&_img]:rounded-xl [&_pre]:max-w-full`),dangerouslySetInnerHTML:{__html:n}})}function To({tone:e,kind:t,kindTone:n,children:r,extra:i}){return(0,P.jsxs)(`div`,{className:`flex max-w-[min(90ch,100%)] items-start gap-2 self-start px-0.5 font-mono text-2xs text-fg-2 max-[800px]:flex-wrap max-[800px]:gap-y-0.5`,children:[(0,P.jsx)(`span`,{className:`mt-[3px] grid`,children:(0,P.jsx)(H,{tone:e})}),(0,P.jsx)(`span`,{className:N(`min-w-16 shrink-0 text-[10px] tracking-[0.5px] uppercase`,n===`ask`&&`text-ask`),children:t}),(0,P.jsx)(`span`,{className:`min-w-0 leading-[1.5] [overflow-wrap:anywhere] whitespace-pre-wrap max-[800px]:basis-full max-[800px]:ps-4`,children:r}),i]})}var Eo=(e,t=`working`)=>e===`completed`?`ok`:e===`failed`?`bad`:e===`running`||e===void 0?t:`idle`;function Do({b:e,chatId:t,nested:n}){switch(e.kind){case`user`:return(0,P.jsxs)(`div`,{className:N(`msg user -mx-[22px] my-1.5 self-stretch bg-[color-mix(in_srgb,var(--accent)_14%,var(--surface-1))] px-[22px] py-4 text-md leading-[1.55] break-words whitespace-pre-wrap text-fg`,e.steered&&`border-l-[3px] border-ask`),children:[e.steered&&(0,P.jsx)(tt,{className:`mb-0.5 block text-[10px] opacity-70`,children:`steered in`}),e.text,e.attachments&&e.attachments.length>0&&(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.attachments.map(e=>{let n=A.url(`chats.attachment`,{id:t,name:e.name});return e.mimeType.startsWith(`image/`)?(0,P.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,title:e.name,children:(0,P.jsx)(`img`,{src:n,alt:e.name,className:`block max-h-60 max-w-full rounded-lg`})},e.name):(0,P.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-inherit underline`,href:n,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`attach_file`,className:`ms-sm`}),` `,e.name]},e.name)})})]});case`agent`:return(0,P.jsx)(wo,{text:e.text,small:n});case`thought`:return(0,P.jsxs)(`details`,{className:`self-stretch`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-2 select-none`,children:`thinking`}),(0,P.jsx)(`div`,{className:`mt-1 border-l-2 border-line px-3 py-2 text-xs break-words whitespace-pre-wrap text-fg-2`,children:e.text})]});case`tool`:return(0,P.jsx)(To,{tone:e.status===`completed`?`ok`:e.status===`failed`?`bad`:`working`,kind:e.compaction?`compact`:e.toolKind,kindTone:e.compaction?`ask`:void 0,children:e.compaction?Ao(e.compaction,e.status):e.title});case`subagent`:return(0,P.jsxs)(`details`,{className:`max-w-[90ch] self-stretch`,open:!e.state,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer list-none select-none [&::-webkit-details-marker]:hidden`,children:(0,P.jsxs)(To,{tone:Eo(e.state),kind:`subagent`,children:[(0,P.jsx)(`b`,{children:e.name}),` — `,e.task,e.state&&e.state!==`completed`&&(0,P.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.state]})]})}),(0,P.jsxs)(`div`,{className:`mt-1.5 mb-1 ml-[3px] flex flex-col gap-2.5 border-l-2 border-line py-1.5 pl-3.5`,children:[e.children.length===0&&(0,P.jsx)(`div`,{className:`font-mono text-2xs text-fg-2 opacity-70`,children:`working…`}),e.children.map(e=>(0,P.jsx)(Do,{b:e,chatId:t,nested:!0},e.key))]})]});case`task`:return(0,P.jsxs)(To,{tone:Eo(e.state,`working`),kind:e.taskType,kindTone:`ask`,extra:e.canStop&&(e.state===`running`||e.state===`paused`)&&(0,P.jsx)(`button`,{type:`button`,className:`ml-2 cursor-pointer rounded-lg border border-line bg-transparent px-1.5 py-px font-[inherit] text-[10px] tracking-[0.5px] text-inherit uppercase hover:border-bad hover:text-bad`,title:`stop this background task (the turn goes on)`,onClick:()=>A.request(`chats.stopTask`,{id:t,body:{taskId:e.taskId}}).catch(()=>{}),children:`stop`}),children:[(0,P.jsx)(`b`,{children:e.name}),` — `,e.summary??e.description,e.state&&e.state!==`running`&&e.state!==`completed`&&(0,P.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.state]})]});case`plan`:return(0,P.jsxs)(`div`,{className:N(`max-w-[76ch] self-start rounded-xl bg-surface-2 px-3.5 py-2.5 text-[12.5px] text-fg-2`,e.removed&&`opacity-55`),children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,P.jsx)(tt,{children:`plan`}),(0,P.jsxs)(`span`,{className:`font-mono text-2xs`,children:[e.entries.filter(e=>e.status===`completed`).length,`/`,e.entries.length]})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-[3px] p-0`,children:e.entries.map((e,t)=>(0,P.jsxs)(`li`,{className:N(`flex items-start gap-1.5 leading-[1.45]`,e.status===`completed`&&`line-through opacity-60`,e.status===`in_progress`&&`font-semibold text-fg`),children:[(0,P.jsx)(F,{name:e.status===`completed`?`check_circle`:e.status===`in_progress`?`play_circle`:`radio_button_unchecked`,className:N(`ms-sm mt-0.5 shrink-0`,e.status===`in_progress`&&`text-accent`)}),(0,P.jsx)(`span`,{children:e.content})]},t))})]});case`files`:return(0,P.jsxs)(To,{tone:`ok`,kind:`changed`,children:[e.paths.join(`
79
+ `):`(no output yet)`})]})}var ba=`vibeable-pane flex flex-col overflow-hidden rounded-2xl bg-surface-2`,xa=`${ba} min-h-0 min-w-0 flex-1`,Sa=`flex min-h-11 flex-none items-center gap-2 border-b border-line py-1.5 pr-2 pl-3.5`,Ca=`flex flex-none items-center gap-2.5 bg-bad-soft py-1.5 pr-2 pl-3.5 text-[12.5px] text-on-bad-soft`;function wa({tone:e,title:t,children:n}){return(0,P.jsxs)(`span`,{className:N(`vibeable-mode inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-2xs font-medium tracking-[0.02em] whitespace-nowrap`,e===`bad`?`bg-bad-soft text-on-bad-soft`:`bg-surface text-fg-2`),title:t,children:[(0,P.jsx)(H,{tone:e}),n]})}function Ta({chatId:e,slug:t,onClosed:n}){let[r,i]=(0,v.useState)(``);return(0,P.jsxs)(`aside`,{className:N(ba,`max-w-[420px] min-w-[320px] flex-none self-start`),"data-vibe":t,children:[(0,P.jsxs)(`div`,{className:Sa,children:[(0,P.jsx)(F,{name:`web`,className:`text-fg-2`}),(0,P.jsx)(`span`,{className:`truncate text-base font-medium`,children:t}),(0,P.jsx)(wa,{tone:`bad`,children:`vibeables are off`}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(V,{icon:`close`,label:`close preview`,title:`Detach the app from this chat`,onClick:()=>va(e,null).then(n).catch(e=>i(e.message))})]}),(0,P.jsxs)(W,{className:`flex-none border-b border-line px-3.5 py-1.5`,children:[`This chat has `,(0,P.jsx)(`b`,{children:t}),` open, but vibeables were switched off in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),`. Turn them back on to see the preview, or detach the app.`]}),r&&(0,P.jsx)(`div`,{className:Ca,children:(0,P.jsx)(`span`,{className:`flex-1`,children:r})})]})}var Ea=`kw-vibeable-agent`;async function Da(e,t){let n=await A.request(`chats.create`,{body:{agent:t,scope:{kind:`general`}}});if(!n.ok)throw Error(j(n));let r=n.data;if(!r.id)throw Error(`HTTP ${n.status}`);await va(r.id,e),z(`/agents/chats/${r.id}`)}function Oa({slug:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(``),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)({}),[d,f]=(0,v.useState)({}),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(()=>{try{let e=localStorage.getItem(Ea);return e===`codex`||e===`pi`?e:`claude`}catch{return`claude`}}),_=xe(),y=(0,v.useCallback)(async()=>{try{let e=await A.request(`vibeables.list`);if(!e.ok)throw Error(`HTTP ${e.status}`);n(e.data),i(``)}catch(e){i(e.message||`could not load the apps`)}},[]);(0,v.useEffect)(()=>{let e=!0,t,n=async()=>{await y(),e&&(t=setTimeout(n,15e3))};return n(),()=>{e=!1,clearTimeout(t)}},[y]);let b=[...t?.vibeables??[]].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``)),x=s.trim().toLowerCase(),S=x?b.filter(e=>e.slug.toLowerCase().includes(x)):b,C=e===`new`,w=e&&!C?b.find(t=>t.slug===e):void 0;(0,v.useEffect)(()=>{y()},[e,y]);let T=b[0]?.slug;(0,v.useEffect)(()=>{!e&&T&&z(`/vibeables/${encodeURIComponent(T)}`,{replace:!0})},[e,T]);let E=(e,t)=>u(n=>({...n,[e]:t})),D=e=>u(t=>{let n={...t};return delete n[e],n}),O=(e,t)=>f(n=>({...n,[e]:t.message})),k=async e=>{e.preventDefault();let t=a.trim();if(t&&!l.__new){E(`__new`,`create`),f(e=>({...e,__new:``}));try{let e=await A.request(`vibeables.create`,{body:{name:t}});if(!e.ok)throw Error(j(e));let n=e.data;o(``),await y(),z(`/vibeables/${encodeURIComponent(n.slug??t)}`)}catch(e){O(`__new`,e)}finally{D(`__new`)}}},ee=async e=>{E(e,`open`);try{await Da(e,h)}catch(t){O(e,t),D(e)}},te=async e=>{E(e,`remove`),m(!1);try{let t=await A.request(`vibeables.delete`,{slug:e});if(!t.ok)throw Error(t.error||`failed`);await y(),z(`/vibeables`,{replace:!0})}catch(t){O(e,t),y()}finally{D(e)}},M=e=>{g(e);try{localStorage.setItem(Ea,e)}catch{}},N=e=>e.configError?{label:`config error`,tone:`bad`}:e.hasIndex?{label:e.dev?`dev`:`static`,tone:`ok`}:{label:`no index.html yet`,tone:`idle`},ne;if(t&&!t.enabled)ne=(0,P.jsx)(G,{children:t.error&&!/are off/.test(t.error)?(0,P.jsx)(K,{tone:`bad`,children:t.error}):(0,P.jsxs)(P.Fragment,{children:[`Apps are off. Turn them on in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),` or add a `,(0,P.jsx)(`code`,{children:`vibeables:`}),` block to kraftwerk.yml.`]})});else if(!t)ne=(0,P.jsx)(G,{children:`loading…`});else if(C||b.length===0)ne=(0,P.jsxs)(`form`,{className:`mx-auto flex w-full max-w-[560px] flex-col gap-2.5 px-4 py-10`,onSubmit:e=>void k(e),children:[(0,P.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,P.jsx)(Y,{className:`flex-1 font-mono text-sm`,value:a,placeholder:`e.g. team-dashboard`,"aria-label":`new app name`,onChange:e=>o(e.target.value),autoFocus:!0}),(0,P.jsx)(B,{type:`submit`,variant:`primary`,icon:`add`,busy:!!l.__new,disabled:!a.trim(),children:l.__new?`creating…`:`new app`})]}),d.__new&&(0,P.jsx)(K,{tone:`bad`,children:d.__new}),(0,P.jsxs)(`p`,{className:`m-0 text-xs text-fg-2`,children:[`A small app built live with an agent. One folder each under `,(0,P.jsx)(`code`,{title:t.root,children:t.root}),`; part of the workspace, commit it from the git screen.`]})]});else if(e&&!w)ne=(0,P.jsxs)(G,{children:[`no vibeable named `,e]});else if(w){let e=w,t=N(e),n=l[e.slug];ne=(0,P.jsxs)(`div`,{className:`chat-main gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-4 gap-y-2.5`,children:[(0,P.jsx)(H,{tone:t.tone}),(0,P.jsx)(rt,{children:e.slug}),(0,P.jsx)(U,{tone:t.tone===`bad`?`bad`:t.tone===`ok`?`ok`:`neutral`,children:t.label}),e.updatedAt&&(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,title:e.updatedAt,children:[`changed `,Ke(e.updatedAt)]}),_&&(0,P.jsx)(`span`,{className:`max-w-[40ch] truncate font-mono text-xs text-fg-2`,title:e.path,children:e.path}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsxs)(vt,{className:`h-8 w-auto text-sm`,value:h,onChange:e=>M(e.target.value),"aria-label":`agent for new chats`,children:[(0,P.jsx)(`option`,{value:`claude`,children:`claude`}),(0,P.jsx)(`option`,{value:`codex`,children:`codex`}),(0,P.jsx)(`option`,{value:`pi`,children:`pi`})]}),(0,P.jsx)(B,{variant:`primary`,icon:`chat`,busy:n===`open`,disabled:!!n,onClick:()=>void ee(e.slug),title:`Start a ${h} chat with this app in the preview pane`,children:`open in chat`}),p?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:()=>void te(e.slug),children:`confirm remove`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>m(!1),children:`cancel`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete`,disabled:!!n,onClick:()=>m(!0),title:`Move the folder to the trash`,children:`remove`})]}),(e.configError||d[e.slug])&&(0,P.jsx)(K,{tone:`bad`,children:e.configError||d[e.slug]}),(0,P.jsx)(ya,{slug:e.slug},e.slug)]})}else ne=(0,P.jsx)(G,{children:`loading…`});return(0,P.jsxs)(`div`,{className:`runs-screen vibeables-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`apps`,count:t?.enabled?b.length:void 0,action:t?.enabled&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/vibeables/new`,children:`new`})}),(0,P.jsx)(Et,{icon:`filter_list`,value:s,placeholder:`search apps`,"aria-label":`search apps`,onChange:e=>c(e.target.value)}),(0,P.jsxs)(Dt,{children:[S.map(t=>{let n=N(t);return(0,P.jsx)(`div`,{className:`vibeable-row`,"data-vibeable":t.slug,children:(0,P.jsx)(J,{href:`/vibeables/${encodeURIComponent(t.slug)}`,active:t.slug===e,size:`sm`,leading:(0,P.jsx)(H,{tone:n.tone}),title:t.slug,sub:`${n.label}${t.dev?` · ${t.dev}`:``}`,meta:t.updatedAt&&(0,P.jsx)(`span`,{title:t.updatedAt,children:Ke(t.updatedAt)})})},t.slug)}),t&&b.length===0&&(0,P.jsx)(Ot,{children:`nothing built yet`}),t&&b.length>0&&S.length===0&&(0,P.jsx)(Ot,{children:`no vibeable matches`}),r&&(0,P.jsx)(K,{tone:`bad`,children:r})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:ne})]})}function ka({slug:e}){let t=M(`channels.list`,{},{interval:4e3}),n=M(`agents.list`,{},{interval:15e3}),r=e?t?.channels.find(t=>t.slug===e):void 0;return e?t?r?(0,P.jsx)(Na,{channel:r,agents:n?.agents??[]},r.slug):(0,P.jsx)(G,{icon:`forum`,children:`channel not found`}):(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(Na,{agents:n?.agents??[]})}function Aa({seg:e}){let t=e[0]&&e[0]!==`new`?decodeURIComponent(e[0]):void 0,n=e[0]===`new`?`new`:t&&e[1]===`edit`?`edit`:t?`channel`:`home`,r=M(`channels.list`,{},{interval:4e3}),i=M(`agents.list`,{},{interval:15e3}),a=r?.channels??[],o=t?a.find(e=>e.slug===t):void 0,s=a.reduce((e,t)=>!e||t.updatedAt>e.updatedAt?t:e,void 0);(0,v.useEffect)(()=>{n===`home`&&s&&z(`/channels/${encodeURIComponent(s.slug)}`,{replace:!0})},[n,s?.slug]);let c;return c=n===`new`?(0,P.jsx)(Na,{agents:i?.agents??[]}):n===`edit`&&o?(0,P.jsx)(Na,{channel:o,agents:i?.agents??[]},o.slug):n===`channel`&&o?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:o.chatId,channel:o,agents:i?.agents??[]},o.chatId)}):n===`channel`&&r?(0,P.jsx)(G,{icon:`forum`,children:`channel not found`}):n===`channel`||!r||s?(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(ja,{}),(0,P.jsxs)(`div`,{className:`runs-screen channels-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`channels`,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/channels/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[a.map(e=>(0,P.jsx)(J,{href:`/channels/${encodeURIComponent(e.slug)}`,active:e.slug===t,size:`sm`,leading:(0,P.jsx)(H,{tone:e.awaitingApproval?`bad`:e.busy?`working`:`idle`,title:e.awaitingApproval?`waiting for your approval`:e.busy?`an agent is working`:void 0}),title:`#${e.slug}`,sub:`${e.name}${e.project?` · 📁 ${e.project}`:``}${e.members.length?` · ${e.members.map(e=>`@${e}`).join(` `)}`:``}`,meta:Ge(e.updatedAt)},e.slug)),r&&a.length===0&&(0,P.jsx)(Ot,{children:`no channels yet — create one, or add a coworker to an agent session or a project chat`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:c})]})}function ja(){return(0,P.jsx)(G,{className:`m-auto`,action:(0,P.jsx)(B,{variant:`primary`,icon:`add`,href:`/channels/new`,children:`new channel`}),children:null})}function Ma({agents:e,checked:t,onToggle:n,none:r}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-control border border-line p-1`,children:[e.map(e=>(0,P.jsx)(xt,{checked:t.includes(e.slug),onChange:t=>n(e.slug,t),hint:`@${e.slug}${e.description?` · ${e.description}`:``}`,className:N(`rounded-control px-2.5 py-1.5 transition-colors hover:bg-surface-2`,t.includes(e.slug)&&`bg-surface-2`),children:(0,P.jsxs)(`b`,{className:`font-semibold`,children:[e.emoji,` `,e.name]})},e.slug)),e.length===0&&(0,P.jsx)(G,{className:`py-4`,children:r})]})}function Na({channel:e,agents:t}){let[n,r]=(0,v.useState)(e?.name??``),[i,a]=(0,v.useState)(e?.purpose??``),[o,s]=(0,v.useState)(e?.members??[]),[c,l]=(0,v.useState)(e?.responder??``),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),m=t.filter(e=>!e.archived);function h(e,t){s(n=>t?[...n.filter(t=>t!==e),e]:n.filter(t=>t!==e)),!t&&c===e&&l(``)}async function g(){d(!0),p(``);try{let t={name:n,purpose:i,members:o,responder:c||null},r=e?await A.request(`channels.save`,{slug:e.slug,body:t}):await A.request(`channels.create`,{body:t});if(!r.ok)throw Error(j(r));z(`/channels/${encodeURIComponent(r.data.slug)}`)}catch(e){p(e.message)}d(!1)}async function _(){e&&window.confirm(`Move #${e.slug} and its transcript to the trash?`)&&(await A.request(`channels.delete`,{slug:e.slug}).catch(()=>{}),z(`/channels`))}return(0,P.jsx)(at,{width:`narrow`,children:(0,P.jsx)(q,{title:e?`edit #${e.slug}`:`new channel`,actions:e&&(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:()=>void _(),children:`delete`}),children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 p-[18px]`,children:[(0,P.jsx)(X,{label:`name`,children:(0,P.jsx)(Y,{value:n,placeholder:`e.g. Website relaunch`,onChange:e=>r(e.target.value),autoFocus:!0})}),(0,P.jsx)(X,{label:`purpose — one line the agents read`,children:(0,P.jsx)(Y,{value:i,placeholder:`what this channel is for`,onChange:e=>a(e.target.value)})}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`members — agents in this channel`}),(0,P.jsx)(Ma,{agents:m,checked:o,onToggle:h,none:`no agents yet — create one on the agents screen first`})]}),(0,P.jsx)(X,{label:`responder — answers when a message mentions nobody`,children:(0,P.jsxs)(vt,{value:c,onChange:e=>l(e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:`nobody (agents only answer when @mentioned)`}),o.map(e=>(0,P.jsxs)(`option`,{value:e,children:[`@`,e]},e))]})}),f&&(0,P.jsx)(K,{tone:`bad`,children:f}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,busy:u,disabled:!n.trim()||o.length===0,onClick:()=>void g(),children:u?`saving…`:e?`save`:`create channel`}),(0,P.jsx)(B,{variant:`quiet`,href:e?`/channels/${encodeURIComponent(e.slug)}`:`/channels`,children:`cancel`})]})]})})})}function Pa({chatId:e,agentSlug:t,project:n,title:r,onClose:i,onCreated:a}){let[o,s]=(0,v.useState)([]),[c,l]=(0,v.useState)(r||``),[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``);(0,v.useEffect)(()=>{A.call(`agents.list`).then(e=>s(e.agents.filter(e=>!e.archived&&e.slug!==t))).catch(()=>{})},[t]);async function g(){p(!0),h(``);try{let n=await A.request(`channels.fromChat`,{body:{chatId:e,name:c,members:t?[t,...u]:u,responder:t??u[0]}});if(!n.ok)throw Error(j(n));let r=n.data;if(!r.slug)throw Error(`HTTP ${n.status}`);i(),a?a(r.slug):z(`/channels/${encodeURIComponent(r.slug)}`)}catch(e){h(e.message)}p(!1)}return(0,P.jsx)(`div`,{className:`fixed inset-0 z-40 grid animate-fade place-items-center bg-[color-mix(in_srgb,var(--text)_32%,transparent)] p-6`,onMouseDown:e=>e.target===e.currentTarget&&i(),children:(0,P.jsxs)(`div`,{className:`max-h-[calc(100dvh-48px)] w-[min(560px,100%)] animate-rise overflow-y-auto rounded-card border border-line bg-surface shadow-modal`,role:`dialog`,"aria-label":`Add a coworker`,children:[(0,P.jsxs)(`div`,{className:`flex min-h-12 items-center gap-2 border-b border-line px-[18px] py-2`,children:[(0,P.jsx)(tt,{className:`text-fg`,children:`add a coworker`}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(V,{icon:`close`,label:`close`,size:`sm`,onClick:i})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 p-[18px]`,children:[(0,P.jsx)(`p`,{className:`m-0 text-sm text-fg-2`,children:t?(0,P.jsxs)(P.Fragment,{children:[`This session becomes a channel: @`,t,` stays and keeps its memory, the agents you pick join, and everyone reads the same transcript. @`,t,` answers when nobody is mentioned.`]}):(0,P.jsxs)(P.Fragment,{children:[`This chat becomes a channel session of the project `,(0,P.jsx)(`b`,{className:`text-fg`,children:n}),` and stays here: the agents you pick join with everything said so far and the project's brief, state, records and links. The first one you pick answers when nobody is mentioned.`]})}),(0,P.jsx)(X,{label:`channel name`,children:(0,P.jsx)(Y,{value:c,placeholder:`e.g. Website relaunch`,onChange:e=>l(e.target.value),autoFocus:!0})}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`invite`}),(0,P.jsx)(Ma,{agents:o,checked:u,onToggle:(e,t)=>d(n=>t?[...n,e]:n.filter(t=>t!==e)),none:`no other agents to invite yet`})]}),m&&(0,P.jsx)(K,{tone:`bad`,children:m}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,busy:f,disabled:!c.trim()||u.length===0,onClick:()=>void g(),children:f?`creating…`:`create channel`}),(0,P.jsx)(B,{variant:`quiet`,onClick:i,children:`cancel`})]})]})]})})}var Fa=`kw-sessions-list`,Ia=(()=>{try{return localStorage.getItem(Fa)===`open`}catch{return!1}})(),La=new Set;function Ra(e){Ia=e;try{localStorage.setItem(Fa,e?`open`:`hidden`)}catch{}La.forEach(e=>e())}function za({busy:e,onClick:t,href:n}){return(0,P.jsx)(V,{icon:e?`progress_activity`:`add`,label:`new chat`,size:`sm`,className:`mb-1 ml-1 rounded-full`,disabled:e,onClick:t,href:n})}function Ba(){return(0,v.useSyncExternalStore)(e=>(La.add(e),()=>La.delete(e)),()=>Ia)}var Va=e=>`kw-tabs:${e}`,Ha=e=>{try{let t=JSON.parse(localStorage.getItem(Va(e))??`[]`);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}},Ua=(e,t)=>{try{localStorage.setItem(Va(e),JSON.stringify(t))}catch{}};function Wa({name:e,onDone:t}){let[n,r]=(0,v.useState)(e),i=n.replace(/\s+/g,` `).trim().slice(0,80);return(0,P.jsx)(`input`,{autoFocus:!0,value:n,"aria-label":`chat name`,maxLength:80,className:`-mb-px w-[220px] flex-none self-end rounded-t-[10px] border border-b-0 border-accent bg-surface px-3 py-[7px] font-[inherit] text-sm font-medium text-fg outline-none`,onFocus:e=>e.currentTarget.select(),onChange:e=>r(e.target.value),onKeyDown:n=>{n.key===`Enter`&&t(i&&i!==e?i:void 0),n.key===`Escape`&&t()},onBlur:()=>t(i&&i!==e?i:void 0)})}var Ga=`kw-strip-end`;function Ka({children:e}){let[t,n]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let e=document.getElementById(Ga);e!==t&&n(e)}),t?(0,ma.createPortal)(e,t):null}function qa({storeKey:e,label:t,fallbackTitle:n,chatId:r,filter:i,hrefOf:a,closeHref:o,subOf:s,actions:c}){let l=M(`chats.list`,{},{refresh:r}),u=(0,v.useMemo)(()=>i(l?.chats??[]),[l,i]),d=(0,v.useMemo)(()=>new Map(u.map(e=>[e.id,e])),[u]),f=Ba(),[p,m]=(0,v.useState)(()=>Ha(e)),[h,g]=(0,v.useState)(!1),_=t=>{m(t),Ua(e,t)};(0,v.useEffect)(()=>{r&&!p.includes(r)&&_([...p,r])},[r]),(0,v.useEffect)(()=>{if(!l)return;let e=p.filter(e=>d.has(e));e.length!==p.length&&_(e)},[l]);let y=e=>{let t=p.indexOf(e),n=p.filter(t=>t!==e);if(_(n),e!==r)return;let i=d.get(n[Math.min(Math.max(t,0),n.length-1)]??``);z(i?a(i):o)},b=async e=>{window.confirm(`Delete ${t===`chats`?`chat`:`session`} "${e.title||e.id}"?`)&&(await A.request(`chats.delete`,{id:e.id}).catch(()=>{}),p.includes(e.id)&&y(e.id))},[x,S]=(0,v.useState)(null),C=async(e,t)=>{S(null),await A.request(`chats.rename`,{id:e,body:{title:t}}).catch(()=>null)},w=l?p.filter(e=>d.has(e)):[],T=e=>e.scope.kind===`channel`?e.title||`#${e.scope.slug}`:e.title||n;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`nav`,{className:`order-first col-span-full flex min-w-0 items-end gap-1 border-b border-line bg-surface-2 pt-1.5 pr-2 pl-1.5`,"aria-label":`open chats`,children:[(0,P.jsxs)(`button`,{type:`button`,className:N(`mb-1 inline-flex flex-none cursor-pointer items-center gap-1 self-center rounded-control px-2 py-1 text-2xs transition-colors`,f?`bg-accent-soft text-on-accent-soft`:`text-fg-2 hover:bg-surface hover:text-fg`),onClick:()=>Ra(!f),title:f?`hide the ${t} list`:`show all ${t}`,"aria-label":`${t} list`,"aria-pressed":f,children:[(0,P.jsx)(F,{name:`view_list`,className:`ms-sm`}),l&&(0,P.jsx)(`span`,{className:`tabular-nums`,children:u.length})]}),(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]`,role:`tablist`,children:[w.map(e=>{let t=d.get(e),n=e===r;return x===e?(0,P.jsx)(Wa,{name:T(t),onDone:t=>t?void C(e,t):S(null)},e):(0,P.jsxs)(ge,{href:a(t),className:N(`session-tab group/tab -mb-px inline-flex max-w-[220px] min-w-0 flex-none animate-tab-in items-center gap-1.5 self-end`,`rounded-t-[10px] border border-b-0 py-[7px] pr-1.5 pl-3 text-sm font-medium no-underline transition-colors`,n?`border-line bg-surface text-fg`:`border-transparent text-fg-2 hover:bg-surface`),role:`tab`,"aria-selected":n,title:`${T(t)} · double-click to rename`,onDoubleClick:t=>{t.preventDefault(),S(e)},children:[(t.busy||t.awaitingApproval)&&(0,P.jsx)(H,{tone:t.awaitingApproval?`bad`:`working`,title:t.awaitingApproval?`waiting for your approval`:`working`}),t.scope.kind===`channel`&&(0,P.jsx)(F,{name:`forum`,className:`ms-sm text-fg-2`}),(0,P.jsx)(`span`,{className:`truncate`,children:T(t)}),n&&(0,P.jsx)(`button`,{type:`button`,className:`inline-flex flex-none cursor-pointer rounded-md p-0.5 text-fg-2 opacity-0 transition-opacity group-hover/tab:opacity-100 hover:bg-surface-2 hover:text-fg focus-visible:opacity-100 pointer-coarse:opacity-100`,"aria-label":`rename ${T(t)}`,title:`rename`,onClick:t=>{t.preventDefault(),t.stopPropagation(),S(e)},children:(0,P.jsx)(F,{name:`edit`,className:`ms-sm`})}),(0,P.jsx)(`button`,{type:`button`,className:N(`inline-flex flex-none cursor-pointer rounded-md p-0.5 text-fg-2 transition-opacity hover:bg-surface-2 hover:text-fg focus-visible:opacity-100`,n?`opacity-100`:`opacity-0 group-hover/tab:opacity-100`),"aria-label":`close ${T(t)}`,title:`close tab`,onClick:t=>{t.preventDefault(),t.stopPropagation(),y(e)},children:(0,P.jsx)(F,{name:`close`,className:`ms-sm`})})]},e)}),c]}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(`span`,{id:Ga,className:`mb-1 flex flex-none items-center gap-0.5 self-center`})]}),f&&(0,P.jsxs)(`aside`,{className:`runs-side sessions-side animate-slide-left`,children:[(0,P.jsx)(Tt,{title:t,action:(0,P.jsx)(V,{icon:`close`,label:`hide the list`,size:`sm`,onClick:()=>Ra(!1)})}),(0,P.jsxs)(Dt,{children:[u.map(e=>(0,P.jsx)(J,{href:a(e),active:e.id===r,size:`sm`,leading:(0,P.jsx)(H,{tone:e.awaitingApproval?`bad`:e.busy?`working`:`idle`,title:e.awaitingApproval?`waiting for your approval`:void 0}),title:(0,P.jsxs)(P.Fragment,{children:[e.scope.kind===`channel`&&(0,P.jsx)(F,{name:`forum`,className:`ms-sm mr-1 align-[-3px]`}),T(e)]}),sub:(0,P.jsxs)(P.Fragment,{children:[s&&(0,P.jsxs)(P.Fragment,{children:[s(e),` · `]}),(0,P.jsx)(`span`,{className:`tabular-nums`,children:Ge(e.updatedAt)})]}),actions:(0,P.jsx)(V,{icon:`close`,size:`sm`,label:t===`chats`?`delete chat`:`delete session`,disabled:h,onClick:()=>{g(!0),b(e).finally(()=>g(!1))}})},e.id)),l&&u.length===0&&(0,P.jsxs)(Ot,{children:[`no `,t,` yet`]})]})]})]})}var Ja=`kw-me`;function Ya(){try{return localStorage.getItem(Ja)||``}catch{return``}}function Xa(e){try{localStorage.setItem(Ja,e)}catch{}}function Za(e,t){A.request(`chats.cancel`,{id:e,body:t?{agent:t}:{}}).catch(()=>{})}var Qa=(e,t=90)=>{let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t)}…`:n};function $a(e,t){let n=RegExp(`(^|[^a-z0-9-])@${t.replace(/[.*+?^${}()|[\\]\\]/g,`\\$&`)}(?![a-z0-9-])`,`i`),r,i,a=!1,o=``;for(let s of e){if(s.from?.kind!==`agent`||s.from.slug!==t){(s.type===`user_message`||s.type===`text`)&&n.test(s.text)&&(r=Qa(s.text));continue}switch(s.type){case`turn_start`:a=!0,i=void 0,o=``;break;case`turn_end`:case`error`:a=!1;break;case`tool_call`:a&&(i=Qa(`${s.kind&&s.kind!==`other`?`${s.kind}: `:``}${s.title}`));break;case`text`:a&&(o+=s.text,(!i||i.startsWith(`says: `))&&(i=Qa(`says: ${o}`)))}}return{task:r,now:i}}function eo(e,t){let n=e=>!t&&!e||t?.kind===`agent`&&e?.kind===`agent`&&e.slug===t.slug,r=null,i,a=[],o=[],s;for(let t of e)n(t.from)&&(t.type===`plan`?r=t.entries:t.type===`usage`?i={used:t.used,size:t.size,costUsd:t.costUsd}:t.type===`commands`?a=t.commands:t.type===`config`?o=t.options:t.type===`auth`&&(s=t));return{plan:r,usage:i,commands:a,config:o,auth:s}}var to=(0,v.createContext)(()=>`The agent`),no=()=>(0,v.useContext)(to);function ro(e){let t=new Map;for(let n of e)(n.type===`permission_request`||n.type===`elicitation_request`)&&t.set(n.requestId,n.from??null),(n.type===`permission_resolved`||n.type===`elicitation_resolved`)&&t.delete(n.requestId);return t.size?[...t.values()][0]:void 0}function io(e,t,n){if(e.kind===`agent`){let r=t.find(t=>t.slug===e.slug);return r?`${r.emoji?`${r.emoji} `:``}${r.name}`:n??e.slug}return e.kind===`general`||e.kind===`kraftwerk`?`🎩 Ralv`:e.kind===`project`?`${Be.emoji} ${Be.name}`:`The assistant`}var ao=`kw-browse`;function oo(e){window.dispatchEvent(new CustomEvent(ao,{detail:e}))}function so(e){if(!/<a\s/i.test(e))return e;let t=document.createElement(`template`);t.innerHTML=e;for(let e of t.content.querySelectorAll(`a[href^="http://"], a[href^="https://"]`)){if(e.classList.contains(`md-browse`))continue;let t=document.createElement(`a`);t.className=`md-browse ml-0.5 inline-grid size-[18px] place-items-center rounded-[5px] align-[-3px] text-fg-2 no-underline opacity-55 transition hover:bg-surface-2 hover:text-accent hover:opacity-100 [&_.ms]:align-[0] [&_.ms]:text-[14px]`,t.href=e.getAttribute(`href`)??``,t.title=`Open beside the conversation`,t.setAttribute(`aria-label`,`Open beside the conversation`),t.innerHTML=`<span class="ms material-symbols-rounded ms-sm" aria-hidden="true">open_in_new</span>`,e.after(t)}return t.innerHTML}function co(e){let t=e.target.closest?.(`a.md-browse`);t&&(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||(e.preventDefault(),oo(t.href)))}var lo=`kw-browser-tabs`;function uo(e){try{return new URL(e).host.replace(/^www\./,``)}catch{return e}}function fo(e){let t=e.trim();return t?/^[a-z]+:\/\//i.test(t)?t:`https://${t}`:``}function po({storeKey:e,onTabs:t}){let n=`${lo}:${e}`,[r,i]=(0,v.useState)(()=>{try{let e=JSON.parse(sessionStorage.getItem(n)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e.url==`string`&&typeof e.id==`number`):[]}catch{return[]}}),[a,o]=(0,v.useState)(()=>r[0]?.id??null),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)({}),d=(0,v.useRef)(Math.max(0,...r.map(e=>e.id))+1);(0,v.useEffect)(()=>{try{sessionStorage.setItem(n,JSON.stringify(r))}catch{}t?.(r.length)},[r,t,n]);let f=e=>{i(t=>{let n=t.find(t=>t.url===e);if(n)return o(n.id),t;let r={id:d.current++,url:e};return o(r.id),[...t,r]})};(0,v.useEffect)(()=>{let e=e=>f(e.detail);return window.addEventListener(ao,e),()=>window.removeEventListener(ao,e)},[]);let p=r.find(e=>e.id===a)??null;(0,v.useEffect)(()=>c(p?.url??``),[p?.url]);let m=e=>{i(t=>{let n=t.findIndex(t=>t.id===e),r=t.filter(t=>t.id!==e);return a===e&&o(r[Math.min(n,r.length-1)]?.id??null),r})},h=()=>{let e=fo(s);e&&(p?i(t=>t.map(t=>t.id===p.id?{...t,url:e}:t)):f(e))},g=`grid size-[30px] flex-none place-items-center rounded-full text-fg-2 no-underline transition-colors hover:bg-surface hover:text-fg`;return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-card border border-line bg-surface`,children:[(0,P.jsxs)(`div`,{className:`flex flex-none items-center gap-0.5 overflow-x-auto px-1.5 pt-1.5 [scrollbar-width:none]`,role:`tablist`,"aria-label":`Browser tabs`,children:[r.map(e=>(0,P.jsxs)(`div`,{className:N(`flex max-w-[180px] items-center rounded-t-lg`,e.id===a?`bg-surface-2 text-fg`:`text-fg-2`),children:[(0,P.jsx)(`button`,{role:`tab`,"aria-selected":e.id===a,className:`min-w-0 cursor-pointer truncate border-0 bg-transparent py-1.5 pr-1 pl-2.5 text-[12.5px] font-semibold text-inherit`,title:e.url,onClick:()=>o(e.id),children:uo(e.url)}),(0,P.jsx)(V,{icon:`close`,label:`Close ${uo(e.url)}`,className:`size-6 text-inherit`,onClick:()=>m(e.id)})]},e.id)),(0,P.jsx)(V,{icon:`add`,label:`New tab`,className:`ml-1 size-6`,onClick:()=>{o(null),c(``)}})]}),(0,P.jsxs)(`form`,{className:`flex flex-none items-center gap-1 border-y border-line bg-surface-2 px-2 py-1.5`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,P.jsx)(`button`,{type:`button`,className:N(g,`cursor-pointer border-0 bg-transparent disabled:pointer-events-none disabled:opacity-40`),title:`Reload`,"aria-label":`Reload`,disabled:!p,onClick:()=>p&&u(e=>({...e,[p.id]:(e[p.id]??0)+1})),children:(0,P.jsx)(F,{name:`refresh`})}),(0,P.jsx)(`input`,{className:`h-[30px] min-w-0 flex-1 rounded-full border border-line bg-surface px-3 font-sans text-[13px] text-fg focus:border-fg focus:outline-none`,value:s,placeholder:`https://…`,"aria-label":`Address`,spellCheck:!1,onChange:e=>c(e.target.value)}),(0,P.jsx)(`button`,{type:`submit`,className:N(g,`cursor-pointer border-0 bg-transparent`),title:`Go`,"aria-label":`Go`,children:(0,P.jsx)(F,{name:`arrow_forward`})}),(0,P.jsx)(`a`,{className:N(g,!p&&`pointer-events-none opacity-40`),href:p?.url,target:`_blank`,rel:`noopener noreferrer`,title:`Open in a window`,"aria-label":`Open in a window`,children:(0,P.jsx)(F,{name:`open_in_new`})})]}),(0,P.jsxs)(`div`,{className:`relative min-h-0 flex-1 bg-white`,children:[r.map(e=>(0,P.jsx)(`iframe`,{className:`block size-full border-0 bg-white [&[hidden]]:hidden`,src:e.url,title:uo(e.url),hidden:e.id!==a,sandbox:`allow-scripts allow-forms allow-popups allow-same-origin allow-downloads`,referrerPolicy:`no-referrer-when-downgrade`},`${e.id}:${l[e.id]??0}`)),!p&&(0,P.jsxs)(`div`,{className:`absolute inset-0 grid place-content-center justify-items-center gap-2 bg-surface p-6 text-center text-fg-2`,children:[(0,P.jsx)(F,{name:`public`,className:`text-[32px]`}),(0,P.jsxs)(`p`,{className:`m-0 max-w-[36ch] text-[13.5px]`,children:[`Read a page beside the conversation: type an address, or click the `,(0,P.jsx)(F,{name:`open_in_new`,className:`ms-sm align-[-3px]`}),` next to a link in the chat.`]})]})]})]})}var mo=(e,t)=>!e&&!t||!!e&&!!t&&e.kind===t.kind&&(e.kind===`human`?e.name===t.name:e.slug===t.slug);function ho(e){let t=[],n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Map,c,l;for(let u of e){let e=`subagent`in u&&u.subagent?r.get(u.subagent):void 0,d=e?e.children:t,f=d[d.length-1];switch(u.type){case`user_message`:c=u.text,d.push({kind:`user`,text:u.text,steered:u.steered,attachments:u.attachments,key:`e${u.seq}`,from:u.from,by:u.by});break;case`text`:f?.kind===`agent`&&mo(f.from,u.from)?f.text+=u.text:d.push({kind:`agent`,text:u.text,key:`e${u.seq}`,from:u.from});break;case`thought`:f?.kind===`thought`&&mo(f.from,u.from)?f.text+=u.text:d.push({kind:`thought`,text:u.text,key:`e${u.seq}`,from:u.from});break;case`tool_call`:{let e={kind:`tool`,callId:u.callId,title:u.title,toolKind:u.kind,status:u.status,compaction:u.compaction,key:`e${u.seq}`,from:u.from};n.set(u.callId,e),d.push(e);break}case`tool_update`:{let e=n.get(u.callId);e&&(u.title&&(e.title=u.title),u.status&&(e.status=u.status),u.compaction&&(e.compaction={...e.compaction,...u.compaction}));break}case`subagent`:{let e={kind:`subagent`,sessionId:u.sessionId,name:u.name,task:u.task,children:[],key:`e${u.seq}`,from:u.from};r.set(u.sessionId,e),t.push(e);break}case`subagent_state`:{let e=r.get(u.sessionId);e&&(e.state=u.state);break}case`task`:{let e={kind:`task`,taskId:u.taskId,name:u.name,taskType:u.taskType,description:u.description,canStop:u.canStop,state:`running`,key:`e${u.seq}`,from:u.from};i.set(u.taskId,e),d.push(e);break}case`task_update`:{let e=i.get(u.taskId);e&&(u.description&&(e.description=u.description),u.summary&&(e.summary=u.summary),u.state&&(e.state=u.state));break}case`permission_request`:s.set(u.requestId,d.length),d.push({kind:`permission`,requestId:u.requestId,title:u.title,options:u.options,resolved:void 0,key:`e${u.seq}`,from:u.from});break;case`permission_resolved`:{let e=s.get(u.requestId);e!=null&&(d[e].resolved=u.optionId);break}case`error`:d.push({kind:`error`,text:u.message,key:`e${u.seq}`,from:u.from});break;case`failure`:{let{type:e,seq:n,ts:r,from:i,...o}=u,s=a.get(o.id);if(s&&o.revision>=s.failure.revision)s.failure=o,s.resolved=!1,s.retryText=c;else if(!s){let e={kind:`failure`,failure:o,resolved:!1,retryText:c,key:`e${u.seq}`,from:i};a.set(o.id,e),t.push(e)}break}case`turn_end`:for(let e of a.values())e.resolved=!0;break;case`plan`:u.entries===null?l&&(l.removed=!0):l&&!l.removed?l.entries=u.entries:(l={kind:`plan`,entries:u.entries,removed:!1,key:`e${u.seq}`,from:u.from},t.push(l));break;case`files_changed`:(u.paths.length>0||u.uncertainty)&&t.push({kind:`files`,paths:u.paths,complete:u.complete,...u.uncertainty?{note:u.uncertainty}:{},key:`e${u.seq}`,from:u.from});break;case`elicitation_request`:{let e={kind:`question`,requestId:u.requestId,message:u.message,fields:u.fields,key:`e${u.seq}`,from:u.from};o.set(u.requestId,e),t.push(e);break}case`elicitation_resolved`:{let e=o.get(u.requestId);e&&(e.resolved={action:u.action,...u.action===`accept`?{content:u.content}:{}});break}}}return t}function go({b:e,chatId:t}){let[n,r]=(0,v.useState)({}),[i,a]=(0,v.useState)(!1),o=no(),[s,c]=(0,v.useState)(null),l=e.resolved===void 0&&!s;async function u(r){a(!0);try{let i=await A.request(`chats.elicitation`,{id:t,body:{requestId:e.requestId,action:r,...r===`accept`?{content:n}:{}}});i.ok||c(i.error??`request failed (${i.status})`)}catch{}a(!1)}let d=(e,t)=>r(n=>({...n,[e]:t})),f=e.fields.some(e=>e.required&&(n[e.key]===void 0||n[e.key]===``));return(0,P.jsx)(_o,{className:N(`question-card`,l&&`pending`),requestId:e.requestId,who:`${o(e.from)} asks`,what:e.message,children:l?(0,P.jsxs)(`div`,{className:`mt-2.5 flex flex-col gap-2.5`,children:[e.fields.map(e=>(0,P.jsxs)(`label`,{className:N(`flex flex-col gap-1.5 text-sm`,e.custom&&`-mt-1`),children:[(e.title||e.description)&&!e.custom&&(0,P.jsxs)(`span`,{children:[e.title&&(0,P.jsx)(`b`,{children:e.title}),e.description&&(0,P.jsxs)(`span`,{className:`opacity-85`,children:[` `,e.description]})]}),e.kind===`select`&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.options?.map(t=>(0,P.jsx)(B,{size:`sm`,variant:n[e.key]===t.value?`primary`:`secondary`,title:t.description,onClick:()=>d(e.key,t.value),children:t.label},t.value))}),e.kind===`multiselect`&&(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.options?.map(t=>{let r=n[e.key]??[],i=r.includes(t.value);return(0,P.jsx)(B,{size:`sm`,variant:i?`primary`:`secondary`,title:t.description,onClick:()=>d(e.key,i?r.filter(e=>e!==t.value):[...r,t.value]),children:t.label},t.value)})}),e.kind===`text`&&(0,P.jsx)(Y,{className:`max-w-[60ch]`,placeholder:e.custom?`or type your own answer`:e.title??e.key,value:n[e.key]??``,onChange:t=>d(e.key,t.target.value)}),e.kind===`number`&&(0,P.jsx)(Y,{type:`number`,className:`max-w-[60ch]`,value:n[e.key]??``,onChange:t=>d(e.key,t.target.value===``?``:Number(t.target.value))}),e.kind===`boolean`&&(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:n[e.key]===!0,onChange:t=>d(e.key,t.target.checked)}),` `,e.title??e.key]})]},e.key)),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(B,{variant:`primary`,disabled:i||f,onClick:()=>u(`accept`),children:`answer`}),(0,P.jsx)(B,{disabled:i,onClick:()=>u(`decline`),children:`skip`})]})]}):(0,P.jsx)(vo,{children:s?`→ ${s}`:e.resolved?.action===`accept`?`→ ${Object.values(e.resolved.content??{}).filter(e=>e!==``&&e!==void 0&&!(Array.isArray(e)&&e.length===0)).map(e=>Array.isArray(e)?e.join(`, `):String(e)).join(` · `)||`answered`}`:e.resolved?.action===`decline`?`→ skipped`:`→ dismissed`})})}function _o({className:e,requestId:t,who:n,what:r,children:i}){return(0,P.jsxs)(`div`,{className:N(`perm-card max-w-[76ch] self-start rounded-2xl bg-ask-soft px-4 py-3 text-on-ask-soft`,e),"data-request":t,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-[3px]`,children:[(0,P.jsx)(`span`,{className:`perm-who text-[12.5px] font-semibold text-fg-2`,children:n}),(0,P.jsx)(`span`,{className:`text-base font-semibold [overflow-wrap:anywhere] text-fg`,children:r})]}),i]})}function vo({children:e}){return(0,P.jsx)(`div`,{className:`mt-1.5 font-mono text-xs text-fg-2`,children:e})}function yo({b:e,chatId:t}){let[n,r]=(0,v.useState)(!1),i=no(),[a,o]=(0,v.useState)(null),s=e.resolved===void 0&&!a;async function c(n){r(!0);try{let r=await A.request(`chats.permission`,{id:t,body:{requestId:e.requestId,optionId:n}});r.ok||o(r.error??`request failed (${r.status})`)}catch{}r(!1)}return(0,P.jsx)(_o,{className:N(s&&`pending`),requestId:e.requestId,who:`${i(e.from)} asks for your OK`,what:e.title,children:s?(0,P.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:e.options.map(e=>(0,P.jsx)(B,{variant:e.kind?.startsWith(`allow`)?`primary`:`secondary`,disabled:n,title:e.name,onClick:()=>c(e.optionId),children:bo(e)},e.optionId))}):(0,P.jsx)(vo,{children:e.resolved?`→ ${(()=>{let t=e.options.find(t=>t.optionId===e.resolved);return t?bo(t):e.resolved})()}`:a?`→ ${a}`:`→ dismissed`})})}function bo(e){return e.kind===`allow_once`?`Allow`:e.kind===`allow_always`?`Always allow`:e.kind===`reject_once`?`Don't allow`:e.kind===`reject_always`?`Never allow`:e.name}var xo=new Set([`tool`,`thought`,`subagent`,`task`,`files`]);function So({id:e,events:t,busy:n,channel:r,agentMap:i,working:a,focus:o}){let s=xe(),c=(0,v.useMemo)(()=>{let e=ho(o?t.filter(e=>e.from?.kind===`human`||e.from?.kind===`agent`&&e.from.slug===o):t);return s||o?e:e.filter(e=>!xo.has(e.kind))},[t,s,o]),l=no(),u=(0,v.useMemo)(()=>ro(t),[t]),d=(0,v.useRef)(null),f=(0,v.useRef)(!0);return(0,v.useEffect)(()=>{let e=d.current;e&&f.current&&(e.scrollTop=e.scrollHeight)},[c,n]),(0,P.jsxs)(`div`,{className:`-mx-5 flex min-h-0 flex-1 flex-col gap-2.5 overflow-y-auto px-[22px] pt-3.5 pb-5 [&>:nth-last-child(-n+3)]:animate-rise`,ref:d,onClick:co,onScroll:e=>{let t=e.currentTarget;f.current=t.scrollHeight-t.scrollTop-t.clientHeight<60},children:[c.length===0&&(0,P.jsx)(G,{className:`m-auto`,children:r?`say something — @mention an agent to wake it${r.responder?`, or just write: @${r.responder} answers`:``}`:`say something — the agent starts on your first message`}),c.map((t,n)=>{let a=c[n-1],o=r&&t.kind!==`error`&&(!a||!mo(a.from,t.from)||a.kind===`error`)?t.from:void 0;return(0,P.jsxs)(`div`,{className:`contents`,children:[o&&(0,P.jsx)(Co,{from:o,agentMap:i}),(0,P.jsx)(Do,{b:t,chatId:e})]},t.key)}),n&&u!==void 0&&(0,P.jsxs)(`div`,{className:`chat-working waiting flex animate-breathe items-center gap-2 text-xs font-semibold text-bad`,children:[(0,P.jsx)(H,{tone:`bad`}),` `,l(u??void 0),` is waiting for you`]}),n&&u===void 0&&(0,P.jsxs)(`div`,{className:`chat-working flex animate-breathe items-center gap-2 text-xs text-fg-2`,children:[(0,P.jsx)(H,{tone:`working`}),` `,r&&a?.length?a.map(e=>`${i?.get(e)?.emoji??``} @${e}`).join(`, `)+(a.length===1?` is working…`:` are working…`):`${l()} is working…`]})]})}function Co({from:e,agentMap:t}){let n=`mt-2.5 -mb-0.5 inline-flex items-center gap-2 text-sm text-fg-2 no-underline`,r=`grid size-[22px] place-items-center rounded-full text-xs font-semibold`;if(e.kind===`human`)return(0,P.jsxs)(`div`,{className:N(`byline human self-end`,n),children:[(0,P.jsx)(`span`,{className:N(r,`bg-accent text-on-accent`),children:e.name.slice(0,1).toUpperCase()}),(0,P.jsx)(`span`,{className:`byline-name font-semibold text-fg`,children:e.name})]});let i=t?.get(e.slug);return(0,P.jsxs)(ge,{href:`/agents/${encodeURIComponent(e.slug)}/info`,className:N(`byline agent self-start`,n),children:[(0,P.jsx)(`span`,{className:N(r,`bg-accent-soft text-on-accent-soft`),children:i?.emoji??`🤖`}),(0,P.jsx)(`span`,{className:`byline-name font-semibold text-fg`,children:i?.name??e.slug}),(0,P.jsxs)(`span`,{className:`font-mono text-2xs`,children:[`@`,e.slug]})]})}function wo({text:e,small:t}){let n=(0,v.useMemo)(()=>so(pa.sanitize(Q.parse(e,{async:!1}))),[e]);return(0,P.jsx)(`div`,{className:N(`md-body h-auto self-stretch overflow-visible p-0 break-words text-fg`,t?`font-sans text-[12.5px] leading-[1.6]`:`font-reading text-[17px] leading-[1.62]`,`[&_img]:my-1 [&_img]:block [&_img]:rounded-xl [&_pre]:max-w-full`),dangerouslySetInnerHTML:{__html:n}})}function To({tone:e,kind:t,kindTone:n,children:r,extra:i}){return(0,P.jsxs)(`div`,{className:`flex max-w-[min(90ch,100%)] items-start gap-2 self-start px-0.5 font-mono text-2xs text-fg-2 max-[800px]:flex-wrap max-[800px]:gap-y-0.5`,children:[(0,P.jsx)(`span`,{className:`mt-[3px] grid`,children:(0,P.jsx)(H,{tone:e})}),(0,P.jsx)(`span`,{className:N(`min-w-16 shrink-0 text-[10px] tracking-[0.5px] uppercase`,n===`ask`&&`text-ask`),children:t}),(0,P.jsx)(`span`,{className:`min-w-0 leading-[1.5] [overflow-wrap:anywhere] whitespace-pre-wrap max-[800px]:basis-full max-[800px]:ps-4`,children:r}),i]})}var Eo=(e,t=`working`)=>e===`completed`?`ok`:e===`failed`?`bad`:e===`running`||e===void 0?t:`idle`;function Do({b:e,chatId:t,nested:n}){switch(e.kind){case`user`:return(0,P.jsxs)(`div`,{className:N(`msg user -mx-[22px] my-1.5 self-stretch bg-[color-mix(in_srgb,var(--accent)_14%,var(--surface-1))] px-[22px] py-4 text-md leading-[1.55] break-words whitespace-pre-wrap text-fg`,e.steered&&`border-l-[3px] border-ask`),children:[e.steered&&(0,P.jsx)(tt,{className:`mb-0.5 block text-[10px] opacity-70`,children:`steered in`}),e.by?.email&&(0,P.jsx)(tt,{className:`mb-0.5 block text-[10px] normal-case opacity-70`,children:(0,P.jsxs)(`span`,{title:e.by.email,children:[`@`,e.by.handle]})}),e.text,e.attachments&&e.attachments.length>0&&(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:e.attachments.map(e=>{let n=A.url(`chats.attachment`,{id:t,name:e.name});return e.mimeType.startsWith(`image/`)?(0,P.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,title:e.name,children:(0,P.jsx)(`img`,{src:n,alt:e.name,className:`block max-h-60 max-w-full rounded-lg`})},e.name):(0,P.jsxs)(`a`,{className:`inline-flex items-center gap-1 text-xs text-inherit underline`,href:n,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`attach_file`,className:`ms-sm`}),` `,e.name]},e.name)})})]});case`agent`:return(0,P.jsx)(wo,{text:e.text,small:n});case`thought`:return(0,P.jsxs)(`details`,{className:`self-stretch`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-2 select-none`,children:`thinking`}),(0,P.jsx)(`div`,{className:`mt-1 border-l-2 border-line px-3 py-2 text-xs break-words whitespace-pre-wrap text-fg-2`,children:e.text})]});case`tool`:return(0,P.jsx)(To,{tone:e.status===`completed`?`ok`:e.status===`failed`?`bad`:`working`,kind:e.compaction?`compact`:e.toolKind,kindTone:e.compaction?`ask`:void 0,children:e.compaction?Ao(e.compaction,e.status):e.title});case`subagent`:return(0,P.jsxs)(`details`,{className:`max-w-[90ch] self-stretch`,open:!e.state,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer list-none select-none [&::-webkit-details-marker]:hidden`,children:(0,P.jsxs)(To,{tone:Eo(e.state),kind:`subagent`,children:[(0,P.jsx)(`b`,{children:e.name}),` — `,e.task,e.state&&e.state!==`completed`&&(0,P.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.state]})]})}),(0,P.jsxs)(`div`,{className:`mt-1.5 mb-1 ml-[3px] flex flex-col gap-2.5 border-l-2 border-line py-1.5 pl-3.5`,children:[e.children.length===0&&(0,P.jsx)(`div`,{className:`font-mono text-2xs text-fg-2 opacity-70`,children:`working…`}),e.children.map(e=>(0,P.jsx)(Do,{b:e,chatId:t,nested:!0},e.key))]})]});case`task`:return(0,P.jsxs)(To,{tone:Eo(e.state,`working`),kind:e.taskType,kindTone:`ask`,extra:e.canStop&&(e.state===`running`||e.state===`paused`)&&(0,P.jsx)(`button`,{type:`button`,className:`ml-2 cursor-pointer rounded-lg border border-line bg-transparent px-1.5 py-px font-[inherit] text-[10px] tracking-[0.5px] text-inherit uppercase hover:border-bad hover:text-bad`,title:`stop this background task (the turn goes on)`,onClick:()=>A.request(`chats.stopTask`,{id:t,body:{taskId:e.taskId}}).catch(()=>{}),children:`stop`}),children:[(0,P.jsx)(`b`,{children:e.name}),` — `,e.summary??e.description,e.state&&e.state!==`running`&&e.state!==`completed`&&(0,P.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.state]})]});case`plan`:return(0,P.jsxs)(`div`,{className:N(`max-w-[76ch] self-start rounded-xl bg-surface-2 px-3.5 py-2.5 text-[12.5px] text-fg-2`,e.removed&&`opacity-55`),children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,P.jsx)(tt,{children:`plan`}),(0,P.jsxs)(`span`,{className:`font-mono text-2xs`,children:[e.entries.filter(e=>e.status===`completed`).length,`/`,e.entries.length]})]}),(0,P.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-[3px] p-0`,children:e.entries.map((e,t)=>(0,P.jsxs)(`li`,{className:N(`flex items-start gap-1.5 leading-[1.45]`,e.status===`completed`&&`line-through opacity-60`,e.status===`in_progress`&&`font-semibold text-fg`),children:[(0,P.jsx)(F,{name:e.status===`completed`?`check_circle`:e.status===`in_progress`?`play_circle`:`radio_button_unchecked`,className:N(`ms-sm mt-0.5 shrink-0`,e.status===`in_progress`&&`text-accent`)}),(0,P.jsx)(`span`,{children:e.content})]},t))})]});case`files`:return(0,P.jsxs)(To,{tone:`ok`,kind:`changed`,children:[e.paths.join(`
80
80
  `),(!e.complete||e.note)&&(0,P.jsxs)(`span`,{className:`opacity-70`,children:[` · `,e.note??`list may be incomplete`]})]});case`question`:return(0,P.jsx)(go,{b:e,chatId:t});case`permission`:return(0,P.jsx)(yo,{b:e,chatId:t});case`error`:return(0,P.jsxs)(`div`,{className:`flex items-center gap-1 self-start text-[12.5px] text-bad`,children:[(0,P.jsx)(F,{name:`error`,className:`ms-sm`}),` `,e.text]});case`failure`:return(0,P.jsx)(ko,{b:e,chatId:t})}}var Oo={retry:`try again`,login:`sign in again`,new_session:`start a fresh session`};function ko({b:e,chatId:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null),o=e.failure,s=!e.resolved&&!i;async function c(n){if(n===`login`){a(`Sign in again in a terminal (claude login, or codex login), then send your message again.`);return}r(!0);try{if(n===`retry`){if(!e.retryText)return a(`nothing to retry — send a message`);await A.request(`chats.message`,{id:t,body:{text:e.retryText}})}else{let e=await A.request(`chats.resetSession`,{id:t});e.ok||a(e.error??`reset failed (${e.status})`)}}catch{}finally{r(!1)}}return(0,P.jsxs)(`div`,{className:N(`max-w-[76ch] self-start rounded-2xl px-4 py-3`,o.severity===`warning`?`bg-ask-soft text-on-ask-soft`:`bg-bad-soft text-on-bad-soft`,!s&&`opacity-70`),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[13.5px]`,children:[(0,P.jsx)(F,{name:o.severity===`warning`?`warning`:`error`,className:`ms-sm`}),(0,P.jsx)(tt,{className:`mr-1 font-bold text-inherit`,children:o.category}),` `,o.title]}),o.details&&(0,P.jsx)(`div`,{className:`mt-1.5 text-xs break-words whitespace-pre-wrap`,children:o.details}),i&&(0,P.jsx)(`div`,{className:`mt-1.5 text-xs break-words whitespace-pre-wrap`,children:i}),s&&o.actions.length>0&&(0,P.jsx)(`div`,{className:`mt-2.5 flex flex-wrap gap-2`,children:o.actions.map(e=>(0,P.jsx)(B,{size:`sm`,disabled:n,className:`border-current text-inherit`,onClick:()=>c(e),children:Oo[e]},e))})]})}function Ao(e,t){let n=e=>e>=1e4?`${Math.round(e/1e3)}k`:String(e),r=[t===`completed`?`context compacted`:t===`failed`?`compaction failed`:`compacting context`];return e.preTokens!=null&&e.postTokens!=null?r.push(`${n(e.preTokens)} → ${n(e.postTokens)} tokens`):e.preTokens!=null&&r.push(`${n(e.preTokens)} tokens`),e.trigger&&r.push(e.trigger),e.error&&r.push(e.error),r.join(` · `)}function $({id:e,busy:t,scope:n,channel:r,agentMap:i,commands:a=[],canSteer:o,account:s}){let[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(null),f=no()().replace(/^\S+\s(?=\S)/u,e=>/\p{Extended_Pictographic}/u.test(e)?``:e).replace(/^The /,`the `),[p,m]=(0,v.useState)([]),[h,g]=(0,v.useState)(0),[_,y]=(0,v.useState)(!1);async function b(t){for(let n of Array.from(t)){g(e=>e+1);try{let t=await A.request(`chats.attach`,{id:e,headers:{"content-type":n.type||`application/octet-stream`,"x-file-name":encodeURIComponent(n.name||`pasted.png`)},body:n});if(typeof t.data!=`object`||!t.data)throw Error(`not json`);t.ok?m(e=>[...e,{...t.data,...n.type.startsWith(`image/`)?{preview:URL.createObjectURL(n)}:{}}]):d(t.error??`upload failed (${t.status})`)}catch{d(`upload failed`)}finally{g(e=>e-1)}}}let[x,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(0),[T,E]=(0,v.useState)(!1),[D,O]=(0,v.useState)(Ya),[k,ee]=(0,v.useState)(!1),te=(0,v.useRef)(null),j=(0,v.useRef)(null),M=t&&!r&&!!o,ne=t&&!r&&!o;(0,v.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await A.request(`skills.list`),r=(t.ok?t.data.skills:void 0)??[];if(n?.kind===`agent`){let[e,t]=await Promise.all([A.call(`agents.get`,{slug:n.slug}).catch(()=>null),A.call(`agents.skills`,{slug:n.slug}).catch(()=>null)]);if(e&&Array.isArray(e.skills)){let t=new Set(e.skills.map(e=>e.toLowerCase()));r=r.filter(e=>t.has(e.name.toLowerCase()))}let i=t?.skills??[],a=new Set(i.map(e=>e.name.toLowerCase()));r=[...i,...r.filter(e=>!a.has(e.name.toLowerCase()))]}e&&S(r)}catch{}})(),()=>{e=!1}},[e]);let re=/^\/([\w-]*)$/.exec(c)?.[1],I=re!==void 0&&!T?x.filter(e=>e.name.toLowerCase().startsWith(re.toLowerCase())):[],ie=new Set(x.map(e=>e.name.toLowerCase())),ae=re!==void 0&&!T?a.filter(e=>e.name.toLowerCase().startsWith(re.toLowerCase())&&!ie.has(e.name.toLowerCase())):[],oe=te.current?.selectionStart??c.length,se=r&&!T?/(^|\s)@([a-z0-9-]*)$/i.exec(c.slice(0,oe)):null,ce=se&&r?r.members.filter(e=>e.startsWith(se[2].toLowerCase())||(i?.get(e)?.name??``).toLowerCase().startsWith(se[2].toLowerCase())):[],le=[...I.map(e=>({id:`/${e.name}`,label:`/${e.name}`,hint:e.description,src:e.source,pick:()=>{l(`/${e.name} `),w(0)}})),...ae.map(e=>({id:`/${e.name}`,label:`/${e.name}${e.hint?` ${e.hint}`:``}`,hint:e.description,src:`agent`,pick:()=>{l(`/${e.name} `),w(0)}})),...ce.map(e=>({id:`@${e}`,label:`${i?.get(e)?.emoji??`🤖`} @${e}`,hint:i?.get(e)?.name,pick:()=>{let t=c.slice(0,oe).replace(/@[a-z0-9-]*$/i,`@${e} `);l(t+c.slice(oe)),w(0),requestAnimationFrame(()=>{let e=te.current;e&&(e.selectionStart=e.selectionEnd=t.length)})}}))].slice(0,15),ue=le.length>0,de=Math.min(C,le.length-1);async function fe(){let t=c.trim();if(!t&&p.length===0||ne||h>0)return;let n=p.map(({preview:e,...t})=>t);l(``),m([]),d(null);let i={text:t,...n.length?{attachments:n}:{},...r?{from:D||`you`}:{}},a=await(M?A.request(`chats.steer`,{id:e,body:i}):A.request(`chats.message`,{id:e,body:i})).catch(()=>null);a&&!a.ok&&(d(a.error??`not sent (${a.status})`),l(t),m(p))}return(0,P.jsxs)(`div`,{className:`composer relative flex flex-none flex-wrap items-end border-t border-line pt-2.5 pb-1`,onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),y(!0))},onDragLeave:()=>y(!1),onDrop:e=>{e.dataTransfer.files.length&&(e.preventDefault(),y(!1),b(e.dataTransfer.files))},children:[p.length>0&&(0,P.jsxs)(`div`,{className:`flex basis-full flex-wrap gap-1.5 px-1 pb-1.5`,children:[p.map(e=>(0,P.jsxs)(`span`,{className:jo,title:`${e.name} · ${Math.round(e.size/1024)} KB`,children:[e.preview?(0,P.jsx)(`img`,{src:e.preview,alt:e.name,className:`h-7 rounded`}):(0,P.jsx)(F,{name:`attach_file`,className:`ms-sm`}),e.name.replace(/^\d{8}-\d{6}-/,``),(0,P.jsx)(`button`,{type:`button`,className:`inline-flex cursor-pointer border-0 bg-transparent p-0 text-inherit hover:text-fg`,title:`remove`,"aria-label":`remove ${e.name}`,onClick:()=>m(t=>t.filter(t=>t.name!==e.name)),children:(0,P.jsx)(F,{name:`close`,className:`ms-sm`})})]},e.name)),h>0&&(0,P.jsx)(`span`,{className:jo,children:`uploading…`})]}),r&&(0,P.jsxs)(`div`,{className:`composer-me flex basis-full items-center gap-1.5 px-1 pb-1 text-xs text-fg-2`,children:[`posting as`,` `,k?(0,P.jsx)(Y,{autoFocus:!0,className:`h-7 w-48 text-xs`,value:D,placeholder:`your name`,"aria-label":`your name`,onChange:e=>O(e.target.value),onBlur:()=>{Xa(D.trim()),ee(!1)},onKeyDown:e=>{(e.key===`Enter`||e.key===`Escape`)&&e.target.blur()}}):(0,P.jsxs)(`button`,{type:`button`,className:`me-name inline-flex cursor-pointer items-center gap-1 border-0 bg-transparent p-0 font-[inherit] font-semibold text-fg`,onClick:()=>ee(!0),title:`change your name`,children:[D||`you`,` `,(0,P.jsx)(F,{name:`edit`,className:`ms-sm`})]})]}),ue&&(0,P.jsx)(`div`,{className:`skill-menu absolute inset-x-0 bottom-full z-5 mb-1.5 flex max-h-[46vh] flex-col overflow-y-auto rounded-card border border-line bg-surface py-1 shadow-pop`,children:le.map((e,t)=>(0,P.jsxs)(`button`,{type:`button`,className:N(`flex cursor-pointer items-center gap-1.5 border-0 px-3.5 py-2 text-left text-sm whitespace-nowrap text-fg`,t===de?`bg-surface-2`:`bg-transparent hover:bg-surface-2`),onMouseDown:t=>{t.preventDefault(),e.pick()},children:[(0,P.jsx)(`b`,{className:`max-w-[42%] flex-none truncate font-mono text-[12.5px] font-medium`,children:e.label}),e.hint&&(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-2`,children:[`— `,e.hint]}),e.src&&(0,P.jsx)(`span`,{className:`ml-auto flex-none text-[10.5px] tracking-[0.04em] text-fg-2 uppercase`,children:e.src})]},e.id))}),u&&(0,P.jsx)(`div`,{className:`basis-full`,children:(0,P.jsx)(K,{tone:`bad`,children:u})}),(0,P.jsxs)(`div`,{className:N(`flex min-w-0 flex-1 items-end gap-0.5 rounded-[24px] border bg-surface py-[5px] pr-[5px] pl-3.5 transition-[border-color,box-shadow]`,`focus-within:border-accent focus-within:shadow-[0_0_0_3px_color-mix(in_srgb,var(--accent)_16%,transparent)]`,_?`border-dashed border-accent`:`border-line`),children:[(0,P.jsx)(`textarea`,{ref:te,value:c,className:`max-h-[40vh] min-w-0 flex-1 resize-none overflow-y-auto rounded-none border-0 bg-transparent px-1.5 py-2 font-sans text-md leading-[1.5] text-fg shadow-none outline-none [field-sizing:content] placeholder:text-fg-2`,placeholder:r?ne?`the agents are working…`:`Message the channel…`:ne?`${f} is working…`:M?`Add to what ${f} is doing…`:`Message ${f}…`,title:`${r?`Enter to send · Shift+Enter for a newline · @ mentions an agent · / for skills · drop or paste files`:`Enter to send · Shift+Enter for a newline · / for skills · drop or paste files`}${s?`\nruns as ${s}`:``}`,rows:Math.min(6,Math.max(1,c.split(`
81
81
  `).length)),onChange:e=>{l(e.target.value),w(0),E(!1)},onPaste:e=>{let t=Array.from(e.clipboardData.items).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e);t.length&&(e.preventDefault(),b(t))},onKeyDown:e=>{if(ue){if(e.key===`ArrowDown`)return e.preventDefault(),w((de+1)%le.length);if(e.key===`ArrowUp`)return e.preventDefault(),w((de-1+le.length)%le.length);if(e.key===`Tab`||e.key===`Enter`)return e.preventDefault(),le[de].pick();if(e.key===`Escape`)return e.preventDefault(),E(!0)}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),fe())}}),t&&(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`stop`,className:`mr-1 self-center`,onClick:()=>A.request(`chats.cancel`,{id:e}).catch(()=>{}),children:`stop`}),!ne&&(0,P.jsx)(V,{icon:`attach_file`,label:`attach files (or drop / paste them)`,className:`size-9 rounded-full [&_.ms]:text-[20px]`,onClick:()=>j.current?.click()}),(0,P.jsx)(`input`,{ref:j,type:`file`,multiple:!0,hidden:!0,onChange:e=>{e.target.files?.length&&b(e.target.files),e.target.value=``}}),!ne&&(0,P.jsx)(`button`,{type:`button`,className:`inline-grid size-9 flex-none cursor-pointer place-items-center rounded-full border-0 bg-accent p-0 text-on-accent transition-[filter,opacity] hover:enabled:brightness-110 active:enabled:scale-95 disabled:cursor-default disabled:opacity-30`,disabled:!c.trim()&&p.length===0||h>0,onClick:fe,"aria-label":M?`steer`:`send`,title:M?`steer: hand this into the running turn (Enter)`:`send (Enter)`,children:(0,P.jsx)(F,{name:M?`alt_route`:`send`,className:`text-[19px]`})})]})]})}var jo=`inline-flex items-center gap-1.5 rounded-full border border-line bg-surface-2 px-2 py-0.5 text-2xs text-fg-2`;function Mo({id:e,live:t}){let n=xe(),[r,i]=(0,v.useState)(null),a=t.config.filter(e=>e.category===`model`||e.category===`thought_level`);async function o(t,n){i(t.id);let r=await A.request(`chats.config`,{id:e,body:{configId:t.id,value:n}}).catch(()=>null);i(null),r&&!r.ok&&alert(r.error??`setting refused (${r.status})`)}return(0,P.jsxs)(P.Fragment,{children:[t.auth?.kind===`none`&&(0,P.jsx)(`span`,{title:[t.auth.detail,t.auth.email,t.auth.organization,t.auth.plan].filter(Boolean).join(` · `),children:(0,P.jsxs)(U,{tone:t.auth.kind===`none`?`bad`:`neutral`,children:[(0,P.jsx)(F,{name:t.auth.kind===`none`?`person_off`:`person`,className:`ms-sm mr-1`}),` `,t.auth.email??t.auth.label]})}),n&&t.usage&&t.usage.size>0&&(0,P.jsx)(`span`,{className:`font-mono`,title:`${t.usage.used.toLocaleString()} of ${t.usage.size.toLocaleString()} context tokens${t.usage.costUsd==null?``:` · $${t.usage.costUsd.toFixed(2)} so far`}`,children:(0,P.jsxs)(U,{children:[Math.round(100*t.usage.used/t.usage.size),`% ctx`,t.usage.costUsd!=null&&` · $${t.usage.costUsd.toFixed(2)}`]})}),n&&a.map(e=>e.type===`select`?(0,P.jsx)(vt,{className:`h-7 w-auto max-w-[22ch] px-2 pr-6 text-xs text-fg-2`,value:e.value,disabled:r===e.id,title:e.description??e.name,"aria-label":e.name,onChange:t=>o(e,t.target.value),children:e.choices.map(e=>(0,P.jsxs)(`option`,{value:e.value,title:e.description,children:[e.group?`${e.group} · `:``,e.name]},e.value))},e.id):(0,P.jsxs)(`label`,{className:`inline-flex cursor-pointer items-center gap-1 text-xs text-fg-2`,title:e.description??e.name,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:e.value,disabled:r===e.id,onChange:t=>o(e,t.target.checked)}),` `,e.name]},e.id))]})}function No({id:e,agentName:t,agentDescription:n,channel:r,agents:i,onConverted:a}){let[o,s]=(0,v.useState)(null),c=M(`chats.list`,{})?.chats.find(t=>t.id===e)?.title;(0,v.useEffect)(()=>{c!==void 0&&s(e=>e&&e.title!==c?{...e,title:c}:e)},[c]);let[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(null),S=Te(),C=xe(),w=M(`agents.list`,r?null:{},{interval:3e4})?.agents??[],T=o?.vibeable&&S.vibeables?o.vibeable:null,[E,D]=(0,v.useState)(null);(0,v.useEffect)(()=>T?(_a({chatId:e,slug:T}),D(document.getElementById(ga)),()=>_a(null)):D(null),[e,T]);let O=(0,v.useMemo)(()=>eo(l),[l]);(0,v.useEffect)(()=>{let t=!0,n;return A.call(`chats.get`,{id:e}).then(r=>{if(!t)return;s(r.meta),u(r.events);let i=r.events[r.events.length-1]?.seq??0;n=te.subscribe(`chat.${e}`,{after:i},e=>{let t=e;u(e=>e.some(e=>e.seq===t.seq)?e:[...e,t])})}).catch(()=>t&&f(!0)),()=>{t=!1,n?.()}},[e]);let k=(0,v.useMemo)(()=>{if(!r)return[];let e=new Set;for(let t of l)t.from?.kind===`agent`&&(t.type===`turn_start`&&e.add(t.from.slug),(t.type===`turn_end`||t.type===`error`)&&e.delete(t.from.slug));return[...e]},[l,r]),ee=(0,v.useMemo)(()=>{if(r)return k.length>0;for(let e=l.length-1;e>=0;e--){let t=l[e].type;if(t===`user_message`)return!0;if(t===`turn_end`||t===`error`)return!1}return!1},[l,r,k]),j=(0,v.useMemo)(()=>{if(o?.title)return o.title;let e=l.find(e=>e.type===`user_message`);return e&&e.type===`user_message`?e.text.replace(/\s+/g,` `).trim().slice(0,80):``},[o,l]);if((0,v.useEffect)(()=>o?r?(ue(`#${r.slug} · ${r.name}`),()=>ue(``)):(ue([t??(o.scope.kind===`agent`?o.scope.slug:o.agent),n,j||`new chat`].filter(Boolean).join(` · `)),()=>ue(``)):void 0,[o,j,t,n,r]),d)return(0,P.jsx)(G,{icon:`chat_error`,children:`chat not found`});if(!o)return(0,P.jsx)(G,{children:`loading…`});let ne=new Map((i??[]).map(e=>[e.slug,e]));if(r)return(0,P.jsxs)(`div`,{className:`chat-thread flex min-h-0 w-full flex-1 animate-rise flex-col`,children:[(0,P.jsxs)(`div`,{className:`channel-head flex flex-none flex-wrap items-center gap-x-3 gap-y-2 pb-1.5`,children:[(0,P.jsx)(H,{tone:ee?`working`:`ok`}),(0,P.jsxs)(rt,{children:[`#`,r.slug]}),(0,P.jsx)(`span`,{className:`text-md text-fg-2`,children:r.name}),(0,P.jsx)(`span`,{className:`flex-1`}),k.length>0&&(0,P.jsxs)(B,{size:`sm`,variant:`danger`,icon:`stop`,title:`interrupt every agent working in this channel`,onClick:()=>Za(e),children:[`stop all (`,k.length,`)`]}),(0,P.jsx)(B,{size:`sm`,icon:`tune`,href:`/channels/${encodeURIComponent(r.slug)}/edit`,title:`members, purpose, responder`,children:`members`})]}),(0,P.jsxs)(`div`,{className:`channel-members flex flex-none flex-wrap items-center gap-x-2.5 gap-y-2 pb-3`,children:[r.purpose&&(0,P.jsx)(`span`,{className:`channel-purpose w-full text-sm text-fg-2`,children:r.purpose}),r.members.map(t=>{let n=ne.get(t),i=k.includes(t),a=$a(l,t);return(0,P.jsxs)(`div`,{className:N(`member-chip inline-flex items-center gap-1 rounded-full py-[3px] pr-1.5 pl-[3px] text-sm transition-colors`,i?`bg-accent-soft`:`bg-surface-2`,b===t&&`outline-2 outline-accent`),title:n?.description,children:[(0,P.jsxs)(`button`,{type:`button`,className:`flex min-w-0 cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-left font-[inherit] text-inherit`,onClick:()=>x(b===t?null:t),title:b===t?`back to the channel`:`look at @${t}'s session`,children:[(0,P.jsxs)(`span`,{className:`relative grid size-7 flex-none place-items-center rounded-full bg-surface text-[15px]`,children:[(0,P.jsx)(`span`,{"aria-hidden":!0,children:n?.emoji??`🤖`}),(0,P.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 grid rounded-full bg-surface p-px`,children:(0,P.jsx)(H,{tone:i?`working`:`idle`})})]}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-px`,children:[(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:`font-medium text-fg`,children:n?.name??t}),(0,P.jsxs)(`span`,{className:`member-handle font-mono text-2xs text-fg-2`,children:[`@`,t]}),r.responder===t&&(0,P.jsx)(U,{children:`responder`})]}),(a.task||a.now)&&(0,P.jsx)(`span`,{className:`max-w-[44ch] truncate text-2xs text-fg-2`,children:i?a.now?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(tt,{className:`mr-1`,children:`now`}),` `,a.now]}):(0,P.jsxs)(P.Fragment,{children:[`working on: `,a.task]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(tt,{className:`mr-1`,children:`last`}),` `,a.task]})})]})]}),i&&(0,P.jsx)(V,{icon:`stop`,label:`interrupt @${t}`,variant:`danger`,size:`sm`,className:`size-6`,onClick:()=>Za(e,t)}),(0,P.jsx)(V,{icon:`info`,label:`agent definition`,size:`sm`,className:`size-6`,href:`/agents/${encodeURIComponent(t)}/info`})]},t)})]}),b&&(0,P.jsxs)(`div`,{className:`flex flex-none items-center gap-2.5 border-b border-line py-1.5 text-sm`,children:[(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`arrow_back`,onClick:()=>x(null),children:`channel`}),(0,P.jsxs)(`span`,{className:`min-w-0 truncate text-fg-2`,children:[ne.get(b)?.emoji??`🤖`,` @`,b,`'s session — everything this agent did, tools included`]}),(0,P.jsx)(`span`,{className:`flex-1`}),k.includes(b)&&(0,P.jsxs)(B,{size:`sm`,variant:`danger`,icon:`stop`,onClick:()=>Za(e,b),children:[`stop @`,b]})]}),(0,P.jsxs)(to.Provider,{value:e=>{let t=e?.kind===`agent`?ne.get(e.slug):void 0;return e?.kind===`agent`?`${t?.emoji??`🤖`} ${t?.name??e.slug}`:`The agent`},children:[(0,P.jsx)(So,{id:e,events:l,busy:ee,channel:r,agentMap:ne,working:k,focus:b??void 0}),(0,P.jsx)($,{id:e,busy:ee,scope:o.scope,channel:r,agentMap:ne})]})]});let re=o.scope.kind===`agent`&&!o.scope.routine||o.scope.kind===`project`,F=O.auth?.kind===`none`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`chat-thread flex min-h-0 w-full flex-1 animate-rise flex-col`,children:[o.scope.kind===`agent`&&!o.scope.routine&&(0,P.jsx)(Ka,{children:(0,P.jsx)(Fo,{id:e,project:o.project,onFiled:e=>s(t=>t&&{...t,project:e})})}),re&&(0,P.jsx)(Ka,{children:(0,P.jsx)(V,{size:`sm`,icon:`group_add`,label:`add coworker`,title:o.scope.kind===`project`?`add coworker: turn this chat into a channel of the project and invite agents`:`add coworker: turn this chat into a channel and invite more agents`,onClick:()=>m(!0),disabled:ee})}),(C||F)&&(0,P.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-2.5 gap-y-1.5 pb-1.5`,children:[C&&o.agent!==`pi`&&o.sessions?.main&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`call_split`,busy:h,className:o.agent===`codex`?`opacity-50`:void 0,disabled:ee,"aria-disabled":o.agent===`codex`,title:o.agent===`codex`?`not supported: codex has no session fork`:`Branch this conversation: a new chat with the same history, the original stays as it is`,onClick:async()=>{if(o.agent===`codex`)return y(`fork is not supported by codex`);g(!0);let t=await A.request(`chats.fork`,{id:e});if(g(!1),!t.ok||!t.data?.id)return alert(t.error??`fork failed (${t.status})`);let n=t.data;z(n.scope?.kind===`agent`?`/agents/${encodeURIComponent(n.scope.slug)}/chat/${n.id}`:`/agents/chats/${n.id}`)},children:h?`forking…`:`fork`}),C&&_&&(0,P.jsx)(`span`,{className:`text-2xs text-fg-2`,children:_}),C&&(0,P.jsx)(`span`,{className:`max-[800px]:hidden`,children:(0,P.jsx)(U,{children:o.agent})}),(0,P.jsx)(Mo,{id:e,live:O}),C&&o.scope.kind===`run`&&(0,P.jsx)(Po,{href:`/runs/${o.scope.runId}`,children:o.scope.runId}),C&&o.scope.kind===`kraftwerk`&&(0,P.jsx)(U,{children:`kraftwerk-aware`}),C&&o.scope.kind===`knowledge`&&(0,P.jsxs)(Po,{href:o.scope.bundle?`/knowledge/${encodeURIComponent(o.scope.bundle)}`:`/knowledge`,children:[`knowledge`,o.scope.bundle?`:${o.scope.bundle}`:``]}),C&&o.scope.kind===`agent`&&(0,P.jsx)(`span`,{className:`max-[800px]:hidden`,children:(0,P.jsxs)(Po,{href:`/agents/${encodeURIComponent(o.scope.slug)}/info`,children:[`agent:`,o.scope.slug]})}),C&&(0,P.jsx)(`span`,{className:`rid max-w-[34ch] min-w-0 truncate font-mono text-xs text-fg-2 max-[800px]:hidden`,title:o.cwd,children:o.cwd})]}),o.vibeable&&!S.vibeables&&(0,P.jsx)(Ta,{chatId:e,slug:o.vibeable,onClosed:s}),(0,P.jsxs)(to.Provider,{value:()=>io(o.scope,w,t),children:[(0,P.jsx)(So,{id:e,events:l,busy:ee}),(0,P.jsx)($,{id:e,busy:ee,scope:o.scope,commands:O.commands,canSteer:o.agent!==`pi`,account:O.auth&&O.auth.kind!==`none`?O.auth.email??O.auth.label:void 0})]})]}),T&&E&&(0,ma.createPortal)((0,P.jsx)(ya,{chatId:e,slug:T,agentBusy:ee,onClosed:s},T),E),p&&o.scope.kind===`agent`&&(0,P.jsx)(Pa,{chatId:e,agentSlug:o.scope.slug,title:j,onClose:()=>m(!1)}),p&&o.scope.kind===`project`&&(0,P.jsx)(Pa,{chatId:e,project:o.scope.slug,title:j||t||``,onClose:()=>m(!1),onCreated:a})]})}function Po({href:e,children:t}){return(0,P.jsx)(ge,{href:e,className:`no-underline hover:opacity-80`,children:(0,P.jsx)(U,{children:t})})}function Fo({id:e,project:t,onFiled:n}){let r=M(`projects.list`,{},{interval:6e4}),[i,a]=(0,v.useState)(!1),o=r?.enabled===!1?[]:r?.projects??[];return!o.length&&!t?null:(0,P.jsxs)(`label`,{className:`inline-flex items-center gap-1 text-fg-2`,title:`file this chat under a project: the agent works in its context`,children:[(0,P.jsx)(F,{name:`folder`,className:`ms-sm`}),(0,P.jsxs)(vt,{"aria-label":`project`,className:`h-7 w-auto max-w-[180px] py-0 pl-2 text-sm`,value:t??``,disabled:i,onChange:async t=>{let r=t.target.value||null;a(!0);let i=await A.request(`chats.setProject`,{id:e,body:{project:r}}).catch(()=>null);a(!1),i?.ok&&n(r??void 0)},children:[(0,P.jsx)(`option`,{value:``,children:`no project`}),o.map(e=>(0,P.jsx)(`option`,{value:e.slug,children:e.title},e.slug))]})]})}var Io=[{id:`claude`,label:`claude`,hint:`Claude Code via ACP`},{id:`codex`,label:`codex`,hint:`Codex (ChatGPT) via ACP`},{id:`pi`,label:`pi`,hint:`pi coding agent`}];async function Lo(e,t,n,r){let i=await A.request(`chats.create`,{body:{agent:e,scope:t,...n?{resume:n}:{},...r?{project:r}:{}}}),a=i.ok?i.data:null;a?.id&&z(a.project?`/projects/${encodeURIComponent(a.project)}/chat/${a.id}`:a.scope?.kind===`agent`?`/agents/${encodeURIComponent(a.scope.slug)}/chat/${a.id}`:a.scope?.kind===`project`?`/projects/${encodeURIComponent(a.scope.slug)}/chat/${a.id}`:`/agents/chats/${a.id}`)}function Ro(){let[e,t]=(0,v.useState)(`claude`),[n,r]=(0,v.useState)(!0),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null);return(0,v.useEffect)(()=>s(null),[e]),(0,P.jsxs)(at,{width:`narrow`,children:[(0,P.jsx)(rt,{children:`new chat`}),(0,P.jsxs)(q,{title:`agent`,children:[(0,P.jsx)(`div`,{className:`grid grid-cols-3 gap-2.5 p-4 max-[940px]:grid-cols-1`,children:Io.map(n=>{let r=e===n.id;return(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:N(`flex cursor-pointer flex-col gap-0.5 rounded-card border px-3.5 py-3 text-left transition-colors`,r?`border-transparent bg-accent-soft text-on-accent-soft`:`border-line bg-transparent text-fg hover:bg-surface-2`),onClick:()=>t(n.id),children:[(0,P.jsx)(`b`,{className:`text-base font-medium`,children:n.label}),(0,P.jsx)(`span`,{className:N(`text-xs`,r?`text-on-accent-soft`:`text-fg-2`),children:n.hint})]},n.id)})}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 px-4 pb-3.5 text-sm text-fg-2`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`size-[15px] accent-accent`,checked:n,onChange:e=>r(e.target.checked)}),(0,P.jsx)(`span`,{className:`text-fg`,children:`kraftwerk-aware`}),` — agent gets workflows + recent runs as context`]}),(0,P.jsx)(`div`,{className:`px-4 pb-4`,children:(0,P.jsx)(B,{variant:`primary`,busy:i,onClick:async()=>{a(!0),await Lo(e,{kind:n?`kraftwerk`:`general`}),a(!1)},children:i?`starting…`:`start chat`})})]}),e!==`pi`&&(0,P.jsxs)(q,{title:`continue a session`,actions:o===null&&(0,P.jsxs)(B,{size:`sm`,variant:`quiet`,icon:`history`,onClick:async()=>{s(`loading`);let t=await A.call(`agents.sessions`,{query:{agent:e}}).catch(()=>({sessions:[]}));s((t.sessions??[]).slice(0,20))},children:[`list `,e,` sessions`]}),children:[o===null&&(0,P.jsxs)(G,{className:`py-6`,children:[`Pick up a `,e,` session started outside kraftwerk.`]}),o===`loading`&&(0,P.jsxs)(G,{className:`py-6`,children:[`asking `,e,`…`]}),Array.isArray(o)&&o.length===0&&(0,P.jsxs)(G,{className:`py-6`,children:[`no `,e,` sessions in this project`]}),Array.isArray(o)&&o.length>0&&(0,P.jsx)(`div`,{className:`flex flex-col p-1.5`,children:o.map(t=>(0,P.jsx)(J,{size:`sm`,title:t.title||t.sessionId.slice(0,8),meta:t.updatedAt&&new Date(t.updatedAt).toLocaleString(),innerProps:{title:t.sessionId},onClick:async()=>{i||(a(!0),await Lo(e,{kind:n?`kraftwerk`:`general`},t.sessionId),a(!1))}},t.sessionId))})]})]})}var zo=[`active`,`paused`,`done`,`archived`],Bo={active:`working`,paused:`idle`,done:`ok`,archived:`idle`},Vo={active:`accent`,paused:`neutral`,done:`ok`,archived:`neutral`},Ho={"my-netnode":`my.netnode.ch`,"google-drive":`Google Drive`,github:`GitHub`,bitbucket:`Bitbucket`,notion:`Notion`,slack:`Slack`,url:`Link`},Uo=e=>Ho[e]??e,Wo=[{id:`claude`,label:`claude`,hint:`Claude Code via ACP`},{id:`codex`,label:`codex`,hint:`Codex (ChatGPT) via ACP`},{id:`pi`,label:`pi`,hint:`pi coding agent`}],Go=e=>[e.harness,e.model,e.effort?`effort ${e.effort}`:``].filter(Boolean).join(` · `),Ko=(e,t)=>(e??[]).filter(e=>e.scope.kind===`project`&&e.scope.slug===t||e.project===t),qo=(e,t)=>`/projects/${encodeURIComponent(t)}/chat/${e.id}`;async function Jo(e,t){let n=await A.request(`projects.save`,{slug:e,body:t});if(!n.ok)throw Error(j(n));return n.data}function Yo({seg:e}){let t=e[0]&&e[0]!==`new`?decodeURIComponent(e[0]):void 0,n=e[0]===`new`?`new`:e[1]===`info`?`info`:e[1]===`chat`?`chat`:t?`project`:`home`,r=n===`chat`?e[2]:void 0,[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(``),c=xe(),l=Ba(),u=(0,v.useCallback)(async()=>{try{let e=await A.request(`projects.list`);if(!e.ok)throw Error(`HTTP ${e.status}`);a(e.data),s(``)}catch(e){s(e.message||`could not load projects`)}},[]);(0,v.useEffect)(()=>{let e=!0,t,n=async()=>{await u(),e&&(t=setTimeout(n,15e3))};return n(),()=>{e=!1,clearTimeout(t)}},[u]),(0,v.useEffect)(()=>{u()},[t,n,u]);let d=i?.projects??[],f=t?d.find(e=>e.slug===t):void 0,p=[...d].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``))[0]?.slug;(0,v.useEffect)(()=>{n===`home`&&p&&z(`/projects/${encodeURIComponent(p)}`,{replace:!0})},[n,p]);let m;return m=i&&!i.enabled?(0,P.jsx)(G,{icon:`folder_off`,children:i.error&&!/are off/.test(i.error)?(0,P.jsx)(`span`,{className:`text-bad`,children:i.error}):(0,P.jsxs)(P.Fragment,{children:[`Projects are off. Turn them on in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),` or add a `,(0,P.jsx)(`code`,{children:`projects:`}),` block to kraftwerk.yml.`]})}):i?n===`new`||n===`home`&&d.length===0?(0,P.jsx)(Zo,{root:i.root,onCreated:u}):n===`home`?(0,P.jsx)(G,{children:`loading…`}):t&&!f?(0,P.jsxs)(G,{icon:`folder_off`,children:[`no project named `,t]}):n===`chat`&&t&&r===`new`?(0,P.jsx)($o,{slug:t,title:f?.title??t},t):n===`chat`&&t&&r?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(es,{chatId:r,title:f?.title??t,goal:f?.goal},r)}):n===`info`&&t?(0,P.jsx)(rs,{slug:t,onChanged:u},t):t?(0,P.jsx)(Qo,{slug:t,title:f?.title??t},t):(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(G,{children:`loading…`}),(0,P.jsxs)(`div`,{className:`runs-screen agents-screen projects-screen ${t&&f?`has-tabs`:``} ${t&&f&&l?`has-sessions`:``}`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`projects`,count:i?.enabled?d.length:void 0,action:i?.enabled&&(c||d.length===0)&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/projects/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[d.map(e=>(0,P.jsx)(J,{href:`/projects/${encodeURIComponent(e.slug)}`,active:e.slug===t,size:`sm`,innerProps:{"data-project":e.slug},leading:(0,P.jsx)(H,{tone:e.configError?`bad`:Bo[e.status],title:e.status}),title:e.title,sub:e.configError?e.configError:e.goal||e.status,subTone:e.configError?`bad`:`plain`,meta:e.updatedAt&&(0,P.jsx)(`span`,{title:e.updatedAt,children:Ke(e.updatedAt)})},e.slug)),i&&i.enabled&&d.length===0&&(0,P.jsx)(Ot,{children:`no projects yet`}),o&&(0,P.jsx)(K,{tone:`bad`,children:o})]})]}),t&&f&&(0,P.jsx)(ts,{slug:t,chatId:r===`new`?void 0:r}),(0,P.jsx)(`div`,{className:`runs-main`,children:m})]})}function Xo(){let e=M(`projects.list`,{},{interval:6e4});return e&&!e.enabled?(0,P.jsxs)(G,{icon:`folder_off`,children:[`Projects are off. Turn them on in `,(0,P.jsx)(`a`,{href:`#/settings`,children:`settings`}),`.`]}):(0,P.jsx)(Zo,{root:e?.root,onCreated:async()=>{}})}function Zo({root:e,onCreated:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),u=async e=>{e.preventDefault();let r=n.trim();if(r&&!o){s(!0),l(``);try{let e=await A.request(`projects.create`,{body:{title:r,goal:i.trim()}});if(!e.ok)throw Error(j(e));let n=e.data;z(`/projects/${encodeURIComponent(n.slug)}/info`),t()}catch(e){l(e.message)}finally{s(!1)}}};return(0,P.jsxs)(`form`,{className:`new-chat mx-auto flex w-full max-w-[640px] animate-rise flex-col gap-4`,onSubmit:e=>void u(e),children:[(0,P.jsx)(rt,{size:`lg`,children:`new project`}),(0,P.jsx)(q,{children:(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsx)(X,{label:`title`,children:(0,P.jsx)(Y,{value:n,placeholder:`e.g. Relaunch netnode.ch`,"aria-label":`project title`,autoFocus:!0,onChange:e=>r(e.target.value)})}),(0,P.jsx)(X,{label:`goal (one line)`,children:(0,P.jsx)(Y,{value:i,placeholder:`e.g. Ship the new site on NodeHive by November`,"aria-label":`project goal`,onChange:e=>a(e.target.value)})}),(0,P.jsx)(`div`,{children:(0,P.jsx)(B,{variant:`primary`,type:`submit`,icon:`add`,busy:o,disabled:!n.trim(),children:o?`creating…`:`create project`})}),c&&(0,P.jsx)(K,{tone:`bad`,children:c}),(0,P.jsxs)(W,{children:[`One folder each under `,(0,P.jsx)(`code`,{title:e,children:e}),` with project.yml, brief.md, state.md and log.md; part of the workspace, commit it from the git screen. Chats opened in the project carry all of it as context.`]})]})})]})}function Qo({slug:e,title:t}){let[n,r]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let t=!0;return r(!1),A.call(`chats.list`).then(n=>{if(!t)return;let i=n.chats.find(t=>t.scope.kind===`project`&&t.scope.slug===e);i?z(`/projects/${encodeURIComponent(e)}/chat/${i.id}`,{replace:!0}):r(!0)}).catch(()=>t&&r(!0)),()=>{t=!1}},[e]),n?(0,P.jsx)($o,{slug:e,title:t}):(0,P.jsx)(G,{children:`loading…`})}function $o({slug:e,title:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1);(0,v.useEffect)(()=>{let t=!0;return A.call(`projects.get`,{slug:e}).then(e=>t&&r(e)).catch(()=>{}),()=>{t=!1}},[e]);let o=Wo.find(e=>e.id===n?.harness)??Wo[0],s=M(`agents.list`,{}),c=(n?.links.agents??[]).flatMap(e=>s?.agents.filter(t=>t.slug===e.slug)??[]),[l,u]=(0,v.useState)(null);return(0,P.jsxs)(at,{width:`narrow`,children:[(0,P.jsxs)(rt,{size:`lg`,children:[Be.emoji,` `,Be.name,` · `,t]}),(0,P.jsxs)(q,{title:`runs on`,children:[(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer flex-col gap-0.5 rounded-card border border-transparent bg-accent-soft px-3.5 py-3 text-left text-on-accent-soft transition-[filter] hover:enabled:brightness-[0.97] disabled:cursor-default disabled:opacity-60`,disabled:i||!n,onClick:async()=>{a(!0),await Lo(o.id,{kind:`project`,slug:e}),a(!1)},children:[(0,P.jsx)(`b`,{className:`text-base font-medium`,children:i?`starting…`:`start chat`}),(0,P.jsx)(`span`,{className:`text-xs`,children:n?`${Go(n)} — ${o.hint}`:`…`})]})}),(0,P.jsxs)(W,{className:`px-[18px] pb-3.5`,children:[`The chat starts with the project's brief, state, systems of record and links as context. Harness, model and effort are set on the `,(0,P.jsx)(ge,{href:`/projects/${encodeURIComponent(e)}/info`,children:`project page`}),`, like an agent's.`]})]}),c.length>0&&(0,P.jsxs)(q,{title:`or with an agent of the project`,children:[(0,P.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:c.map(t=>(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-2.5 rounded-card border border-line bg-transparent px-3.5 py-2.5 text-left text-fg transition-colors hover:enabled:bg-surface-2 disabled:cursor-default disabled:opacity-60`,disabled:l!==null,onClick:async()=>{u(t.slug),await Lo(`claude`,{kind:`agent`,slug:t.slug},void 0,e),u(null)},children:[(0,P.jsx)(`span`,{className:`text-lg`,children:t.emoji||`🤖`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,P.jsx)(`b`,{className:`text-base font-medium`,children:l===t.slug?`starting…`:t.name}),t.description&&(0,P.jsx)(`span`,{className:`truncate text-xs text-fg-2`,children:t.description})]})]},t.slug))}),(0,P.jsx)(W,{className:`px-[18px] pb-3.5`,children:`The agent works with its own instructions and the project's context; the chat is listed here and with the agent.`})]})]})}function es({chatId:e,title:t,goal:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(0);(0,v.useEffect)(()=>{let t=!0;return A.call(`chats.get`,{id:e}).then(e=>t&&i(e.meta.scope)).catch(()=>t&&o(!0)),()=>{t=!1}},[e,s]);let l=r?.kind===`channel`?r.slug:void 0,u=r?.kind===`agent`?r.slug:void 0,d=M(`channels.list`,l?{}:null,{interval:4e3}),f=M(`agents.list`,l||u?{}:null,{interval:8e3});if(a)return(0,P.jsx)(G,{icon:`chat_error`,children:`chat not found`});if(!r)return(0,P.jsx)(G,{children:`loading…`});if(l){let t=d?.channels.find(e=>e.slug===l);return d?t?(0,P.jsx)(No,{id:e,channel:t,agents:f?.agents??[]},`${e}:channel`):(0,P.jsxs)(G,{icon:`forum`,children:[`channel #`,l,` is gone — its definition under channels/ was removed`]}):(0,P.jsx)(G,{children:`loading…`})}if(u){let t=f?.agents.find(e=>e.slug===u);return f?(0,P.jsx)(No,{id:e,agentName:t?`${t.emoji||`🤖`} ${t.name}`:u,agentDescription:t?.description,onConverted:()=>c(e=>e+1)},`${e}:${s}`):(0,P.jsx)(G,{children:`loading…`})}return(0,P.jsx)(No,{id:e,agentName:t,agentDescription:n,onConverted:()=>c(e=>e+1)},`${e}:${s}`)}function ts({slug:e,chatId:t}){let[n,r]=(0,v.useState)(!1),i=(0,v.useCallback)(t=>Ko(t,e),[e]),a=(0,v.useCallback)(t=>qo(t,e),[e]),o=M(`agents.list`,{},{interval:3e4}),s=e=>{let t=o?.agents.find(t=>t.slug===e);return t?`${t.emoji||`🤖`} ${t.name}`:e};return(0,P.jsx)(qa,{storeKey:`project:${e}`,label:`chats`,fallbackTitle:`new chat`,chatId:t,filter:i,hrefOf:a,closeHref:`/projects/${encodeURIComponent(e)}/chat/new`,subOf:e=>e.scope.kind===`channel`?`with coworkers · #${e.scope.slug}`:e.scope.kind===`agent`?`with ${s(e.scope.slug)}`:e.agent,actions:(0,P.jsx)(za,{busy:n,onClick:async()=>{r(!0),await Lo(`claude`,{kind:`project`,slug:e}),r(!1)}})})}var ns=[{kind:`knowledge`,label:`knowledge`,icon:`menu_book`,href:e=>`/knowledge/${encodeURIComponent(e)}`},{kind:`vibeables`,label:`apps`,icon:`web`,href:e=>`/vibeables/${encodeURIComponent(e)}`},{kind:`repos`,label:`repositories`,icon:`source`},{kind:`workflows`,label:`workflows`,icon:`account_tree`,href:e=>`/workflows/${encodeURIComponent(e)}`},{kind:`agents`,label:`agents`,icon:`groups`,href:e=>`/agents/${encodeURIComponent(e)}`}];function rs({slug:e,onChanged:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(`active`),[x,S]=(0,v.useState)(`claude`),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,ee]=(0,v.useState)(``),[te,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(``),ne=xe(),re=e=>{r(e),h(e.title),_(e.goal),b(e.status),S(e.harness),w(e.model??``),E(e.effort??``),O(e.brief),ee(e.state),j(!1)};(0,v.useEffect)(()=>{let t=!0;return A.call(`projects.get`,{slug:e}).then(e=>t&&re(e)).catch(()=>t&&a(!0)),()=>{t=!1}},[e]);let F=()=>{j(!0),d(!1),s(``)},I=async(n,i={})=>{l(!0),s(``);try{let a=await Jo(e,n);i.keepEdits?r(a):re(a),d(!i.keepEdits),await t()}catch(e){s(e.message)}finally{l(!1)}},ie=async()=>{l(!0);try{let n=await A.request(`projects.delete`,{slug:e});if(!n.ok)throw Error(n.error||`failed`);await t(),z(`/`,{replace:!0})}catch(e){s(e.message),l(!1)}},ae=async()=>{let t=M.trim();if(t){l(!0),s(``);try{let n=await A.request(`projects.log`,{slug:e,body:{entry:t}});if(!n.ok)throw Error(n.error||`failed`);let i=n.data;N(``),r(e=>e&&{...e,log:i.log??e.log})}catch(e){s(e.message)}finally{l(!1)}}};return i?(0,P.jsx)(G,{icon:`folder_off`,children:`project not found`}):n?(0,P.jsxs)(`div`,{className:`chat-main project-page flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-none flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,P.jsx)(ot,{children:(0,P.jsx)(`span`,{"aria-hidden":!0,children:`📁`})}),(0,P.jsx)(rt,{size:`lg`,children:n.title}),(0,P.jsx)(U,{tone:Vo[n.status],children:n.status}),(0,P.jsx)(U,{title:`harness · model · effort every chat in this project runs on`,children:Go(n)}),ne&&(0,P.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-fg-2`,title:n.path,children:n.path})]}),n.configError&&(0,P.jsxs)(K,{tone:`bad`,children:[`project.yml: `,n.configError]}),(0,P.jsx)(q,{title:`project`,className:`flex-none`,actions:(0,P.jsxs)(P.Fragment,{children:[u&&!te&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`saved`}),(0,P.jsx)(B,{variant:`primary`,size:`sm`,busy:c,disabled:!te,onClick:()=>void I({title:m,goal:g,status:y,harness:x,model:C,effort:T,brief:D,state:k}),children:c?`saving…`:`save changes`})]}),children:(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`title`,className:`flex-1`,children:(0,P.jsx)(Y,{value:m,"aria-label":`title`,onChange:e=>{h(e.target.value),F()}})}),(0,P.jsx)(X,{label:`status`,children:(0,P.jsx)(vt,{value:y,"aria-label":`status`,onChange:e=>{b(e.target.value),F()},children:zo.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))})})]}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`harness`,className:`w-[140px] max-[940px]:w-auto`,children:(0,P.jsx)(vt,{value:x,"aria-label":`harness`,onChange:e=>{S(e.target.value),F()},children:Wo.map(e=>(0,P.jsx)(`option`,{value:e.id,children:e.label},e.id))})}),(0,P.jsx)(X,{label:`model`,className:`flex-1`,children:(0,P.jsx)(Y,{value:C,"aria-label":`model`,placeholder:`harness default — e.g. sonnet, gpt-5.6-sol`,onChange:e=>{w(e.target.value),F()}})}),(0,P.jsx)(X,{label:`effort`,className:`w-[140px] max-[940px]:w-auto`,children:(0,P.jsx)(vt,{value:T,"aria-label":`effort`,onChange:e=>{E(e.target.value),F()},children:Je.map(e=>(0,P.jsx)(`option`,{value:e,children:e||`default`},e))})})]}),(0,P.jsx)(X,{label:`goal (one line)`,children:(0,P.jsx)(Y,{value:g,"aria-label":`goal`,placeholder:`what the project is for`,onChange:e=>{_(e.target.value),F()}})}),(0,P.jsx)(X,{label:`brief.md — what done looks like, constraints, stakeholders`,children:(0,P.jsx)(_t,{rows:10,className:`resize-y font-mono text-sm`,value:D,"aria-label":`brief`,onChange:e=>{O(e.target.value),F()}})}),(0,P.jsx)(X,{label:`state.md — current state, rewritten at the end of a session`,children:(0,P.jsx)(_t,{rows:6,className:`resize-y font-mono text-sm`,value:k,"aria-label":`state`,onChange:e=>{ee(e.target.value),F()}})}),o&&(0,P.jsx)(K,{tone:`bad`,children:o})]})}),(0,P.jsx)(cs,{records:n.records,saving:c,onSave:e=>I({records:e},{keepEdits:!0})}),(0,P.jsx)(q,{title:`links`,className:`flex-none`,actions:(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`by name; a target that is missing in this workspace is marked`}),children:(0,P.jsx)(lt,{children:ns.map(i=>(0,P.jsx)(os,{kind:i.kind,label:i.label,icon:i.icon,href:i.href,links:n.links[i.kind],saving:c,onChange:(n,a)=>void is(e,i.kind,n,a,e=>{r(e),t()},s)},i.kind))})}),(0,P.jsxs)(q,{title:`log`,className:`flex-none`,children:[(0,P.jsx)(yt,{className:`max-w-[680px]`,children:(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`new entry — a decision, a milestone`,className:`flex-1`,children:(0,P.jsx)(Y,{value:M,"aria-label":`log entry`,placeholder:`e.g. Decided on NodeHive as the CMS`,onChange:e=>N(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ae())}})}),(0,P.jsx)(B,{icon:`add`,disabled:c||!M.trim(),onClick:()=>void ae(),children:`log`})]})}),(0,P.jsx)(`div`,{className:`md-body h-auto overflow-visible px-[18px] pt-1 pb-4 text-sm [&_h1]:hidden [&_h2]:mt-3 [&_h2]:mb-1 [&_h2]:text-xs [&_ul]:m-0 [&_ul]:pl-[18px]`,dangerouslySetInnerHTML:{__html:pa.sanitize(Q.parse(n.log||`_no entries yet_`,{async:!1}))}})]}),(0,P.jsx)(q,{title:`danger zone`,className:`flex-none [&>div]:border-b-0`,actions:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,disabled:c,onClick:()=>void ie(),children:`confirm delete`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>p(!1),children:`cancel`})]}):(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,disabled:c,onClick:()=>p(!0),title:`Move the project, its files and log to the trash; #/trash puts it back`,children:`delete project`}),children:null})]}):(0,P.jsx)(G,{children:`loading…`})}async function is(e,t,n,r,i,a){try{let a=await A.request(`projects.link`,{slug:e,body:{kind:t,target:n,remove:r}});if(!a.ok)throw Error(j(a));i(a.data)}catch(e){a(e.message)}}async function as(e){switch(e){case`knowledge`:return(await A.call(`knowledge.list`)).bundles.map(e=>({slug:e.name,hint:`${e.concepts} concepts`}));case`vibeables`:return(await A.call(`vibeables.list`)).vibeables.map(e=>({slug:e.slug,hint:e.dev?`dev`:`static`}));case`repos`:return(await A.call(`repos.list`)).repos.map(e=>({slug:e.slug,hint:e.branch}));case`workflows`:return(await A.call(`workflows.list`)).workflows.map(e=>({slug:e.slug,hint:e.description??e.name}));case`agents`:return(await A.call(`agents.list`)).agents.filter(e=>!e.archived).map(e=>({slug:e.slug,hint:`${e.emoji} ${e.name}`}))}}function os({kind:e,label:t,icon:n,href:r,links:i,saving:a,onChange:o}){let[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(``);(0,v.useEffect)(()=>{if(!s||l)return;let t=!0;return as(e).then(e=>t&&u(e)).catch(()=>t&&u([])),()=>{t=!1}},[s,l,e]);let p=new Set(i.map(e=>e.slug)),m=(l??[]).filter(e=>!p.has(e.slug));return(0,P.jsxs)(ct,{icon:n,title:t,"data-link-kind":e,action:!s&&(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>c(!0),children:`link`}),children:[i.length===0&&!s&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`none linked`}),i.length>0&&(0,P.jsx)(`span`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,P.jsxs)(U,{tone:e.found?`neutral`:`bad`,title:e.found?e.label:`configured but not found in this workspace`,children:[r&&e.found?(0,P.jsx)(ge,{href:r(e.slug),className:`text-inherit no-underline hover:underline`,children:e.slug}):e.slug,!e.found&&` · not found`,(0,P.jsx)(`button`,{type:`button`,className:`-mr-1 ml-1 inline-grid size-4 cursor-pointer place-items-center rounded-full border-0 bg-transparent p-0 text-inherit opacity-70 hover:bg-surface hover:opacity-100 disabled:cursor-default [&_.ms]:text-[13px]`,"aria-label":`unlink ${e.slug}`,disabled:a,onClick:()=>o(e.slug,!0),children:(0,P.jsx)(F,{name:`close`})})]},e.slug))}),s&&(0,P.jsx)(`span`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:l===null?(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`loading…`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(vt,{className:`w-auto max-w-full min-w-48 flex-1`,"aria-label":`link ${t}`,value:d,onChange:e=>f(e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:m.length?`pick ${t}…`:`nothing to link`}),m.map(e=>(0,P.jsxs)(`option`,{value:e.slug,children:[e.slug,e.hint?` — ${e.hint}`:``]},e.slug))]}),(0,P.jsx)(B,{disabled:a||!d,onClick:()=>{o(d,!1),f(``),c(!1)},children:`link`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>c(!1),children:`cancel`})]})})]})}var ss={kind:`url`};function cs({records:e,saving:t,onSave:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),s=e=>i(t=>({...t??ss,...e})),c=e=>{let t={kind:e.kind.trim().toLowerCase()||`url`};for(let n of[`title`,`url`,`workspace`,`note`]){let r=(e[n]??``).trim();r&&(t[n]=r)}return t};return(0,P.jsx)(q,{title:`systems of record`,className:`flex-none`,actions:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`where the truth is managed outside kraftwerk — context for the agent, not a credential`}),!r&&(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>i({...ss}),children:`add`})]}),children:(0,P.jsxs)(lt,{children:[e.map((r,i)=>(0,P.jsx)(ct,{"data-record-kind":r.kind,icon:`database`,title:(0,P.jsxs)(P.Fragment,{children:[Uo(r.kind),r.title&&(0,P.jsx)(`span`,{className:`text-xs font-normal text-fg-2`,children:r.title}),r.workspace&&(0,P.jsxs)(U,{children:[`workspace `,r.workspace]})]}),action:(0,P.jsx)(V,{icon:`close`,size:`sm`,label:`remove record ${r.title??r.kind}`,disabled:t,onClick:()=>void n(e.filter((e,t)=>t!==i))}),children:(r.url||r.note)&&(0,P.jsxs)(`span`,{className:`text-xs leading-normal text-fg-2`,children:[r.url&&(0,P.jsx)(`a`,{href:r.url,target:`_blank`,rel:`noreferrer`,children:r.url}),r.url&&r.note&&` — `,r.note]})},i)),e.length===0&&!r&&(0,P.jsx)(W,{className:`px-[18px] py-3`,children:`none yet — e.g. a my.netnode.ch workspace, a Google Drive folder, a board`}),r&&(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`kind`,children:a?(0,P.jsx)(Y,{value:r.kind,"aria-label":`record kind`,placeholder:`e.g. jira`,onChange:e=>s({kind:e.target.value})}):(0,P.jsxs)(vt,{value:r.kind,"aria-label":`record kind`,onChange:e=>{e.target.value===`__other`?(o(!0),s({kind:``})):s({kind:e.target.value})},children:[Object.entries(Ho).map(([e,t])=>(0,P.jsx)(`option`,{value:e,children:t},e)),(0,P.jsx)(`option`,{value:`__other`,children:`other…`})]})}),(0,P.jsx)(X,{label:`title`,className:`flex-1`,children:(0,P.jsx)(Y,{value:r.title??``,"aria-label":`record title`,placeholder:`e.g. Contracts folder`,onChange:e=>s({title:e.target.value})})}),(0,P.jsx)(X,{label:`workspace / id`,children:(0,P.jsx)(Y,{value:r.workspace??``,"aria-label":`record workspace`,placeholder:`e.g. 22`,onChange:e=>s({workspace:e.target.value})})})]}),(0,P.jsx)(X,{label:`url`,children:(0,P.jsx)(Y,{value:r.url??``,"aria-label":`record url`,placeholder:`https://…`,onChange:e=>s({url:e.target.value})})}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`note — what lives there and how it is usually reached`,className:`flex-1`,children:(0,P.jsx)(Y,{value:r.note??``,"aria-label":`record note`,placeholder:`e.g. tickets and roadmap; the my CLI`,onChange:e=>s({note:e.target.value})})}),(0,P.jsx)(B,{disabled:t||!r.kind.trim(),onClick:async()=>{await n([...e,c(r)]),i(null),o(!1)},children:`add record`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>{i(null),o(!1)},children:`cancel`})]})]})]})})}async function ls(e,t){let n=window.open(``,`_blank`);if(!n)return;let r=t?`${e}/${t}`:e;n.document.write(`<title>${ps(r)}</title><body style="font-family:system-ui;padding:40px;color:#555">preparing ${ps(r)}…</body>`);let i,a=``;try{let[n,r]=await Promise.all([t?Promise.resolve([t]):A.call(`knowledge.get`,{bundle:e}).then(e=>e.concepts.map(e=>e.id)),A.call(`meta.get`).catch(()=>({}))]);if(a=r.workspaceName??``,i=await Promise.all(n.map(t=>A.call(`knowledge.concept`,{bundle:e,query:{id:t}}))),i.some(e=>typeof e?.id!=`string`))throw Error(`missing concept`)}catch{n.document.body.textContent=`could not load "${r}"`;return}let o=[],s=i.map(e=>{let t=[e.type,e.generated?.at?`updated ${e.generated.at.slice(0,10)}`:``,e.trustTier===`human-reviewed`?`human-reviewed`:``,(e.tags??[]).map(e=>`#${e}`).join(` `)].filter(Boolean).join(` · `),{md:n,notes:r}=ds(us(e.body??``,null)),i=!e.title||e.title===e.id||e.title===e.id.split(`/`).pop(),{html:a,title:s}=fs(pa.sanitize(Q.parse(n,{async:!1})),{title:e.title||e.id,meta:t,titleIsFallback:i});return o.push(s),`<article>
82
82
  ${a}
@@ -212,14 +212,14 @@ Instructions this agent follows when the skill applies or is invoked with /<name
212
212
  `;function js({slug:e}){let t=M(`agents.skills`,{slug:e})?.skills??[],[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``);async function c(t){s(``);let n=await A.request(`agents.skill`,{slug:e,name:t}).catch(()=>null);if(!n)return void s(`could not load skill`);if(!n.ok||!n.data||typeof n.data!=`object`)return void s(n.error??`could not load skill`);r({name:t,content:n.data.content??``,isNew:!1})}async function l(){if(!n)return;a(!0),s(``);let t=await A.request(`agents.saveSkill`,{slug:e,body:{name:n.name,content:n.content}});a(!1),!t.ok||!t.data||typeof t.data!=`object`?s(t.error??`save failed`):r(null)}async function u(t){window.confirm(`Move skill "/${t}" of this agent to the trash?`)&&(await A.request(`agents.deleteSkill`,{slug:e,name:t}).catch(()=>{}),n?.name===t&&r(null))}return(0,P.jsxs)(q,{title:`own skills — only this agent`,actions:!n&&(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>{r({name:``,content:As,isNew:!0}),s(``)},children:`new skill`}),children:[t.length===0&&!n&&(0,P.jsxs)(W,{className:`px-[18px] py-3 text-xs`,children:[`none — skills in `,(0,P.jsxs)(`code`,{children:[`agents/`,e,`/skills/`]}),` are private to this agent; skills for every agent live in the workspace skills folder.`]}),t.length>0&&!n&&(0,P.jsx)(lt,{children:t.map(e=>(0,P.jsx)(ct,{icon:`extension`,title:`/${e.name}`,action:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,icon:`edit`,onClick:()=>void c(e.name),children:`edit`}),(0,P.jsx)(V,{icon:`delete`,label:`delete /${e.name}`,variant:`danger`,size:`sm`,onClick:()=>void u(e.name)})]}),children:(0,P.jsx)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:e.description||(0,P.jsx)(`code`,{children:`SKILL.md`})})},e.name))}),n&&(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsx)(X,{label:`name — invoked as /<name>`,children:(0,P.jsx)(Y,{className:`font-mono`,value:n.name,placeholder:`e.g. report-html`,disabled:!n.isNew,onChange:e=>r({...n,name:e.target.value})})}),(0,P.jsx)(X,{label:`SKILL.md — frontmatter (description) + the instructions`,children:(0,P.jsx)(_t,{className:`resize-y font-mono text-[12.5px] leading-[1.65]`,rows:Math.min(28,Math.max(12,n.content.split(`
213
213
  `).length+2)),value:n.content,spellCheck:!1,onChange:e=>r({...n,content:e.target.value})})}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(B,{variant:`primary`,busy:i,disabled:!n.name.trim(),onClick:()=>void l(),children:i?`saving…`:`save`}),(0,P.jsx)(B,{variant:`quiet`,disabled:i,onClick:()=>r(null),children:`cancel`})]})]}),o&&(0,P.jsx)(`div`,{className:`px-[18px] pb-3`,children:(0,P.jsx)(K,{tone:`bad`,children:o})})]})}function Ms(e){let t=e.adopted.length;if(t===0)return{note:`nothing to adopt — already running here`,error:``};let n=t===1?`"${e.adopted[0].name}" runs`:`${t} routines run`;return e.commit&&!e.commit.ok?{note:``,error:`${n} on ${e.runsOn} — routines.yml written, but not committed: ${e.commit.error??`git failed`}`}:{note:`${n} on ${e.runsOn} now${e.commit?` — committed`:``}`,error:``}}function Ns({r:e}){return e.runner===`here`?(0,P.jsx)(U,{title:`runs_on: ${e.runsOn} — this machine fires it`,children:`runs here`}):e.runner===`unassigned`?(0,P.jsx)(U,{tone:e.enabled?`ask`:`neutral`,title:`no runs_on — it fires on no machine until one adopts it`,children:`no runner`}):e.retired?(0,P.jsxs)(U,{tone:`ask`,title:`${e.runsOn} is a retired identity of this machine — it fires nowhere until reassigned`,children:[`runs on `,e.runsOn,` · retired`]}):(0,P.jsxs)(U,{title:`another machine fires it, not this one`,children:[`runs on `,e.runsOn]})}function Ps({slug:e}){let[t,n]=(0,v.useState)(0),r=M(`agents.routines`,{slug:e},{refresh:t}),i=M(`identity.get`,{},{interval:6e4}),a=r?.routines??[],[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),g=(It()??[]).filter(e=>e.kind===`runner`),_=g.flatMap(e=>e.routines??[]),y=g.some(e=>e.id.startsWith(`runner:retired:`))||a.some(e=>e.retired),b=a.filter(e=>e.runner===`unassigned`&&e.enabled||e.retired).length,x=_.filter(t=>t.agent!==e).length;async function S(t){l(``);let n=await A.request(`agents.saveRoutine`,{slug:e,body:t});return n.ok?!0:(l(j(n)),!1)}async function C(t){p(t),l(``);let n=await A.request(`agents.runRoutine`,{slug:e,id:t});p(``),n.ok?n.data.chatId&&z(`/agents/${encodeURIComponent(e)}/chat/${n.data.chatId}`):l(j(n))}function w(e){let t=Ms(e);d(t.note),l(t.error),n(e=>e+1),Ft()}async function T(t){h(t),l(``),d(``);let n=await A.request(`agents.adoptRoutine`,{slug:e,id:t});h(``),n.ok?w(n.data):l(j(n))}async function E(){h(`*`),l(``),d(``);let e=await A.request(`routines.adopt`,{body:{retired:y}});h(``),e.ok?w(e.data):l(j(e))}async function D(t){window.confirm(`Delete the scheduled prompt "${t}"?`)&&await A.request(`agents.deleteRoutine`,{slug:e,id:t}).catch(()=>{})}return(0,P.jsxs)(q,{title:`schedule — prompts that run on their own`,actions:!o&&(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>s({name:``,schedule:`0 9 * * 1-5`,prompt:``,enabled:!0}),children:`schedule a prompt`}),children:[a.length===0&&!o&&(0,P.jsx)(W,{className:`px-[18px] py-3 text-xs`,children:`none — a routine messages this agent on a schedule (cron, server local time) and each run opens a new session with the result.`}),b>0&&(0,P.jsx)(ct,{icon:`event_busy`,title:`${b} routine${b===1?` fires`:`s fire`} nowhere`,action:(0,P.jsx)(B,{size:`sm`,icon:`download_done`,busy:m===`*`,onClick:()=>void E(),children:m===`*`?`adopting…`:`run these here`}),children:(0,P.jsxs)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:[y?`no runner, or a retired identity`:`no runner`,` — makes `,(0,P.jsx)(`code`,{children:i?.identity??`this machine`}),` the runner`,x>0?` of these and ${x} on other agents`:``,` and commits routines.yml`]})}),a.length>0&&(0,P.jsx)(lt,{children:a.map(t=>(0,P.jsx)(ct,{icon:`schedule`,title:(0,P.jsxs)(P.Fragment,{children:[t.name,(0,P.jsx)(Ns,{r:t}),t.lastError&&(0,P.jsx)(`span`,{title:t.lastError,children:(0,P.jsx)(U,{tone:`bad`,children:`error`})}),t.awaitingApproval&&t.lastChatId&&(0,P.jsx)(U,{href:`/agents/${encodeURIComponent(e)}/chat/${t.lastChatId}`,tone:`bad`,title:`the last run asked for a permission nobody has answered yet`,children:`needs approval`})]}),action:(0,P.jsxs)(P.Fragment,{children:[t.runner!==`here`&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,busy:m===t.id,title:`make ${i?.identity??`this machine`} its runner and commit routines.yml`,onClick:()=>void T(t.id),children:m===t.id?`adopting…`:`run here`}),(0,P.jsx)(B,{size:`sm`,icon:`play_arrow`,busy:f===t.id,onClick:()=>C(t.id),children:f===t.id?`starting…`:`run`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>s({id:t.id,name:t.name,schedule:t.schedule,prompt:t.prompt,enabled:t.enabled,runsOn:t.runsOn??``,private:t.private??!1}),children:`edit`}),(0,P.jsx)(B,{size:`sm`,variant:`danger`,onClick:()=>void D(t.id),children:`delete`}),(0,P.jsx)(Ct,{checked:t.enabled,label:t.enabled?`enabled — click to pause`:`paused — click to enable`,onChange:()=>void S({id:t.id,name:t.name,schedule:t.schedule,prompt:t.prompt,enabled:!t.enabled})})]}),children:(0,P.jsxs)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:[(0,P.jsx)(`code`,{children:t.schedule}),t.enabled?t.nextRunAt?` · next ${Ge(t.nextRunAt)}`:``:` · paused`,` · `,t.lastChatId?(0,P.jsxs)(ge,{href:`/agents/${encodeURIComponent(e)}/chat/${t.lastChatId}`,children:[`last run `,Ge(t.lastRunAt)]}):`never ran`]})},t.id))}),o&&(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`name`,className:`flex-1`,children:(0,P.jsx)(Y,{value:o.name,placeholder:`e.g. Morning report`,onChange:e=>s({...o,name:e.target.value})})}),(0,P.jsx)(X,{label:`schedule (cron)`,className:`w-[200px] max-[900px]:w-auto`,children:(0,P.jsx)(Y,{className:`font-mono`,value:o.schedule,placeholder:`0 9 * * 1-5`,onChange:e=>s({...o,schedule:e.target.value})})}),(0,P.jsxs)(`label`,{className:`flex h-9 cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:o.enabled,onChange:e=>s({...o,enabled:e.target.checked})}),`enabled`]})]}),(0,P.jsx)(X,{label:`prompt — what to ask this agent on each run`,children:(0,P.jsx)(_t,{rows:5,value:o.prompt,placeholder:`Check ... and summarize what changed.`,onChange:e=>s({...o,prompt:e.target.value})})}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`runs on — the one machine that fires it`,className:`flex-1`,children:(0,P.jsx)(Y,{className:`font-mono`,value:o.runsOn??i?.identity??``,placeholder:`<handle>@<machine> — empty: no runner`,onChange:e=>s({...o,runsOn:e.target.value})})}),(0,P.jsxs)(`label`,{className:`flex h-9 cursor-pointer items-center gap-2 text-sm text-fg`,title:`stored in routines.yml; nothing reads it yet`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`accent-accent`,checked:o.private??!1,onChange:e=>s({...o,private:e.target.checked})}),`private`]})]}),i&&(0,P.jsxs)(W,{children:[`This machine is `,(0,P.jsx)(`code`,{children:i.identity}),`. Empty: no runner — it fires nowhere.`]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(B,{variant:`primary`,disabled:!o.name.trim()||!o.prompt.trim(),onClick:async()=>{let{runsOn:e,...t}=o;await S(e===void 0?t:{...t,runsOn:e.trim()||null})&&s(null)},children:o.id?`save`:`add to the schedule`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>(s(null),l(``)),children:`cancel`})]})]}),(c||u)&&(0,P.jsx)(`div`,{className:`px-[18px] pb-3`,children:c?(0,P.jsx)(K,{tone:`bad`,children:c}):(0,P.jsx)(K,{children:u})})]})}function Fs({slug:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)([]),[p,m]=(0,v.useState)(!0),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(``),b=Te(),x=M(`workflows.list`,{}),S=M(`knowledge.list`,{}),C=M(`vibeables.list`,b.vibeables?{}:null),w=M(`skills.list`,{});(0,v.useEffect)(()=>{let t=!0;return A.call(`agents.get`,{slug:e}).then(e=>t&&n(e)).catch(()=>t&&i(!0)),()=>{t=!1}},[e]);async function T(r){if(t){g(!0),y(``);try{let i=await A.request(`agents.save`,{slug:e,body:{name:t.name,emoji:t.emoji,description:t.description,harness:t.harness,model:t.model,effort:t.effort,group:t.group,system:t.system,workflows:t.workflows,knowledge:t.knowledge,vibeables:t.vibeables,skills:t.skills,...r}});i.ok?(n(i.data),c(``)):y(j(i))}catch(e){y(e.message)}g(!1)}}function E(e,t){f(t?[...d,e]:d.filter(t=>t!==e))}async function D(t){g(!0),y(``);try{let r=await A.request(`agents.archive`,{slug:e,body:{archived:t}});r.ok?n(r.data):y(j(r))}catch(e){y(e.message)}g(!1)}if(r)return(0,P.jsx)(G,{icon:`person_off`,children:`agent not found`});if(!t)return(0,P.jsx)(G,{children:`loading…`});let O=e=>(0,P.jsxs)(`div`,{className:`mt-2 flex items-center gap-2.5`,children:[(0,P.jsx)(B,{variant:`primary`,busy:h,onClick:()=>void T(e),children:h?`saving…`:`save`}),(0,P.jsx)(B,{variant:`quiet`,disabled:h,onClick:()=>(c(``),y(``)),children:`cancel`})]}),k=e=>(0,P.jsx)(B,{size:`sm`,onClick:()=>{e(),y(``)},children:`edit`});return(0,P.jsxs)(`div`,{className:`agent-view flex animate-rise flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2.5`,children:[(0,P.jsx)(ot,{children:(0,P.jsx)(`span`,{"aria-hidden":!0,children:t.emoji})}),(0,P.jsx)(rt,{size:`lg`,children:t.name}),(0,P.jsx)(U,{children:t.harness}),t.model&&(0,P.jsx)(U,{children:t.model}),t.effort&&(0,P.jsxs)(U,{children:[`effort: `,t.effort]}),t.archived&&(0,P.jsxs)(U,{children:[(0,P.jsx)(F,{name:`inventory_2`,className:`ms-sm mr-1`}),` archived`]}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(B,{href:`/agents/${encodeURIComponent(e)}/edit`,children:`edit`}),t.archived?(0,P.jsx)(B,{variant:`primary`,icon:`unarchive`,busy:h,onClick:()=>void D(!1),children:h?`…`:`unarchive`}):(0,P.jsx)(B,{variant:`quiet`,icon:`archive`,disabled:h,title:`Hide this agent from the roster — restorable any time`,onClick:()=>void D(!0),children:`archive`})]}),(0,P.jsxs)(q,{children:[(0,P.jsxs)(lt,{children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-3.5 border-0 bg-transparent px-[18px] py-3 text-left font-[inherit] text-inherit hover:bg-surface-2`,"aria-expanded":a,onClick:()=>o(!a),children:[(0,P.jsx)(st,{name:`badge`}),(0,P.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[(0,P.jsx)(`span`,{className:`text-[13.5px] font-medium text-fg`,children:`role`}),!a&&(0,P.jsx)(`span`,{className:N(`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,`truncate`),children:(t.system||``).trim().split(`
214
214
  `)[0]||`empty — expand to give this agent a role`})]}),(0,P.jsx)(F,{name:`expand_more`,className:N(`ms-sm flex-none text-fg-2 transition-transform`,a&&`rotate-180`)})]}),a&&s!==`role`&&(0,P.jsxs)(`div`,{className:`pr-[18px] pb-4 pl-16`,children:[(0,P.jsx)(`pre`,{className:`m-0 font-mono text-[12.5px] leading-[1.65] whitespace-pre-wrap`,children:t.system||`(empty — click edit to give this agent a role)`}),(0,P.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2.5`,children:[(0,P.jsx)(B,{size:`sm`,icon:`edit`,onClick:()=>{u(t.system),c(`role`),y(``)},children:`edit role`}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsxs)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:[`agents/`,t.slug,`/system.md`]})]})]}),a&&s===`role`&&(0,P.jsxs)(`div`,{className:`pr-[18px] pb-4 pl-16`,children:[(0,P.jsx)(_t,{className:`resize-y font-mono text-[12.5px] leading-[1.65]`,"aria-label":`role`,rows:Math.min(24,Math.max(8,l.split(`
215
- `).length+2)),value:l,placeholder:`You are the ... for this project. Your job is ...`,onChange:e=>u(e.target.value),spellCheck:!1}),O({system:l})]})]}),(0,P.jsx)(ct,{icon:`account_tree`,title:`workflows`,action:s!==`workflows`&&k(()=>(f(t.workflows),c(`workflows`))),children:s===`workflows`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(x?.workflows??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.slug),onChange:t=>E(e.slug,t),hint:e.description,mono:!0,children:e.slug},e.slug)),(x?.workflows??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no workflows in this project`})]}),O({workflows:d})]}):t.workflows.length===0?(0,P.jsx)(`span`,{className:ms,children:`none connected — the agent can run any workflow you connect`}):(0,P.jsx)(hs,{children:t.workflows.map(e=>(0,P.jsx)(U,{href:`/workflows/${encodeURIComponent(e)}`,children:e},e))})}),(0,P.jsx)(ct,{icon:`menu_book`,title:`knowledge`,action:s!==`knowledge`&&k(()=>(f(t.knowledge),c(`knowledge`))),children:s===`knowledge`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(S?.bundles??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.name),onChange:t=>E(e.name,t),hint:`${e.concepts} concepts`,mono:!0,children:e.name},e.name)),(S?.bundles??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no knowledge bundles in this project`})]}),O({knowledge:d})]}):t.knowledge.length===0?(0,P.jsx)(`span`,{className:ms,children:`none connected — connected bundles are read and kept current by the agent`}):(0,P.jsx)(hs,{children:t.knowledge.map(e=>(0,P.jsx)(U,{href:`/knowledge/${encodeURIComponent(e)}`,children:e},e))})}),(b.vibeables||(t.vibeables??[]).length>0)&&(0,P.jsx)(ct,{icon:`web`,title:`apps`,"data-link-kind":`vibeables`,action:s!==`vibeables`&&k(()=>(f(t.vibeables??[]),c(`vibeables`))),children:s===`vibeables`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(C?.vibeables??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.slug),onChange:t=>E(e.slug,t),hint:e.dev?`dev`:`static`,mono:!0,children:e.slug},e.slug)),d.filter(e=>!(C?.vibeables??[]).some(t=>t.slug===e)).map(e=>(0,P.jsx)(xt,{checked:!0,onChange:t=>E(e,t),hint:`not found in this workspace`,mono:!0,children:e},e)),!b.vibeables&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`vibeables are off in this workspace's settings`}),b.vibeables&&(C?.vibeables??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no apps in this workspace yet — create one on the apps page`})]}),O({vibeables:d})]}):(t.vibeables??[]).length===0?(0,P.jsx)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:`none linked — linked apps are the agent's to build and maintain; it knows them from the first message`}):(0,P.jsx)(hs,{children:(t.vibeables??[]).map(e=>{let t=!b.vibeables||!C||C.vibeables.some(t=>t.slug===e);return(0,P.jsxs)(U,{href:`/vibeables/${encodeURIComponent(e)}`,tone:t?`neutral`:`bad`,title:t?void 0:`configured but not found in this workspace`,children:[e,!t&&` · not found`]},e)})})}),(0,P.jsx)(ct,{icon:`extension`,title:`shared skills`,action:s!==`skills`&&k(()=>{m(t.skills===void 0),f(t.skills??[]),c(`skills`)}),children:s===`skills`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(0,P.jsx)(xt,{checked:p,onChange:m,hint:`every discovered skill, including future ones`,mono:!0,children:`all skills`}),!p&&(w?.skills??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.name),onChange:t=>E(e.name,t),hint:e.description,mono:!0,children:`/${e.name}`},e.name)),!p&&(w?.skills??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no skills found (.claude/skills, project or user)`})]}),O({skills:p?void 0:d})]}):t.skills===void 0?(0,P.jsx)(`span`,{className:ms,children:`all discovered skills (default) — invoke with /name in a session`}):t.skills.length===0?(0,P.jsx)(`span`,{className:ms,children:`none — this agent runs without skills`}):(0,P.jsx)(hs,{children:t.skills.map(e=>(0,P.jsxs)(U,{children:[`/`,e]},e))})})]}),_&&(0,P.jsx)(`div`,{className:`px-[18px] pb-3`,children:(0,P.jsx)(K,{tone:`bad`,children:_})})]}),(0,P.jsx)(js,{slug:e}),(0,P.jsx)(Ps,{slug:e})]})}var Is=[`🤖`,`🧑‍💻`,`🎧`,`🛠️`,`📊`,`✍️`,`🔍`,`🧹`,`📦`,`🚀`];function Ls({slug:e}){let[t,n]=(0,v.useState)(e?null:f()),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),s=M(`workflows.list`,{})?.workflows??[],c=M(`knowledge.list`,{})?.bundles??[],l=Te(),u=M(`vibeables.list`,l.vibeables?{}:null)?.vibeables??[],d=M(`skills.list`,{})?.skills??[];(0,v.useEffect)(()=>{e&&A.call(`agents.get`,{slug:e}).then(e=>n({name:e.name,emoji:e.emoji,description:e.description??``,harness:e.harness,model:e.model??``,effort:e.effort??``,group:e.group??``,system:e.system,workflows:e.workflows,knowledge:e.knowledge??[],vibeables:e.vibeables??[],skillsAll:e.skills===void 0,skills:e.skills??[]})).catch(()=>i(`agent not found`))},[e]);function f(){return{name:``,emoji:`🤖`,description:``,harness:`claude`,model:``,effort:``,group:``,system:``,workflows:[],knowledge:[],vibeables:[],skillsAll:!0,skills:[]}}async function p(){if(!t)return;o(!0),i(``);let n={...t,skills:t.skillsAll?void 0:t.skills},r=e?await A.request(`agents.save`,{slug:e,body:n}):await A.request(`agents.create`,{body:n});o(!1),r.ok?z(`/agents/${encodeURIComponent(r.data.slug)}/info`):i(j(r))}async function m(){e&&window.confirm(`Move agent "${e}" to the trash?`)&&(await A.request(`agents.delete`,{slug:e}).catch(()=>{}),z(`/agents`))}if(!t)return(0,P.jsx)(G,{children:r||`loading…`});let h=e=>n({...t,...e}),g=(e,n,r)=>h({[e]:r?[...t[e],n]:t[e].filter(e=>e!==n)});return(0,P.jsxs)(at,{width:`narrow`,children:[(0,P.jsx)(rt,{children:e?`edit ${e}`:`new agent`}),(0,P.jsx)(q,{children:(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`name`,className:`flex-1`,children:(0,P.jsx)(Y,{value:t.name,placeholder:`e.g. Max`,onChange:e=>h({name:e.target.value})})}),(0,P.jsx)(X,{label:`emoji`,className:`w-[90px] max-[900px]:w-auto`,children:(0,P.jsx)(Y,{value:t.emoji,onChange:e=>h({emoji:e.target.value})})})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Is.map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":t.emoji===e,className:N(`cursor-pointer rounded-xl border px-2.5 py-1.5 text-base transition-colors`,t.emoji===e?`border-transparent bg-accent-soft`:`border-line bg-transparent hover:bg-surface-2`),onClick:()=>h({emoji:e}),children:e},e))}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`description`,className:`flex-1`,children:(0,P.jsx)(Y,{value:t.description,placeholder:`one line: what this agent is for`,onChange:e=>h({description:e.target.value})})}),(0,P.jsx)(X,{label:`group`,className:`w-[180px] max-[900px]:w-auto`,children:(0,P.jsx)(Y,{value:t.group,placeholder:`none`,onChange:e=>h({group:e.target.value})})})]}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`harness`,className:`w-[140px] max-[900px]:w-auto`,children:(0,P.jsxs)(vt,{value:t.harness,onChange:e=>h({harness:e.target.value}),children:[(0,P.jsx)(`option`,{value:`claude`,children:`claude`}),(0,P.jsx)(`option`,{value:`codex`,children:`codex`}),(0,P.jsx)(`option`,{value:`pi`,children:`pi`})]})}),(0,P.jsx)(X,{label:`model`,className:`flex-1`,children:(0,P.jsx)(Y,{className:`font-mono`,value:t.model,placeholder:`harness default — e.g. sonnet, gpt-5.6-sol`,onChange:e=>h({model:e.target.value})})}),(0,P.jsx)(X,{label:`effort`,className:`w-[140px] max-[900px]:w-auto`,children:(0,P.jsx)(vt,{value:t.effort,onChange:e=>h({effort:e.target.value}),children:Je.map(e=>(0,P.jsx)(`option`,{value:e,children:e||`default`},e))})})]}),(0,P.jsx)(X,{label:`system prompt — the agent's role`,children:(0,P.jsx)(_t,{className:_s,rows:10,value:t.system,placeholder:`You are the ... for this project. Your job is ...`,onChange:e=>h({system:e.target.value})})}),(0,P.jsxs)(Rs,{label:`connected workflows — autoloaded into the agent's context; it can run them`,children:[s.map(e=>(0,P.jsx)(xt,{checked:t.workflows.includes(e.slug),onChange:t=>g(`workflows`,e.slug,t),hint:e.description,mono:!0,children:e.slug},e.slug)),s.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no workflows in this project`})]}),(0,P.jsxs)(Rs,{label:`connected knowledge — OKF bundles the agent consults and maintains`,children:[c.map(e=>(0,P.jsx)(xt,{checked:t.knowledge.includes(e.name),onChange:t=>g(`knowledge`,e.name,t),hint:`${e.concepts} concepts`,mono:!0,children:e.name},e.name)),c.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no knowledge bundles in this project`})]}),(l.vibeables||t.vibeables.length>0)&&(0,P.jsxs)(Rs,{label:`apps — small apps the agent builds and maintains`,linkKind:`vibeables`,children:[u.map(e=>(0,P.jsx)(xt,{checked:t.vibeables.includes(e.slug),onChange:t=>g(`vibeables`,e.slug,t),hint:e.dev?`dev`:`static`,mono:!0,children:e.slug},e.slug)),t.vibeables.filter(e=>!u.some(t=>t.slug===e)).map(e=>(0,P.jsx)(xt,{checked:!0,onChange:()=>g(`vibeables`,e,!1),hint:`not found in this workspace`,mono:!0,children:e},e)),!l.vibeables&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`vibeables are off in this workspace's settings`}),l.vibeables&&u.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no vibeables in this workspace yet`})]}),(0,P.jsxs)(Rs,{label:`connected skills — workspace skill packages (see the skills tab); invoked with /name in sessions`,children:[(0,P.jsx)(xt,{checked:t.skillsAll,onChange:e=>h({skillsAll:e}),hint:`every discovered skill, including future ones`,mono:!0,children:`all skills`}),!t.skillsAll&&d.map(e=>(0,P.jsx)(xt,{checked:t.skills.includes(e.name),onChange:t=>g(`skills`,e.name,t),hint:e.description,mono:!0,children:`/${e.name}`},e.name)),!t.skillsAll&&d.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no skills found (.claude/skills, project or user)`})]}),r&&(0,P.jsx)(K,{tone:`bad`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(B,{variant:`primary`,busy:a,disabled:!t.name.trim(),onClick:p,children:a?`saving…`:e?`save`:`create`}),(0,P.jsx)(`span`,{className:`flex-1`}),e&&(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:m,children:`delete agent`})]})]})})]})}function Rs({label:e,linkKind:t,children:n}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-link-kind":t,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e}),(0,P.jsx)(gs,{children:n})]})}var zs=`bg-accent/7 outline-[1.5px] -outline-offset-[1.5px] outline-accent outline-dashed`,Bs=`px-2.5 pt-1.5 pb-2 text-2xs text-fg-2`;function Vs({seg:e}){let t=e[0]&&e[0]!==`new`&&e[0]!==`chats`?decodeURIComponent(e[0]):void 0,n=e[0]===`new`?`new`:e[0]===`chats`?`chats`:e[1]===`edit`?`edit`:e[1]===`info`?`info`:e[1]===`chat`?`chat`:t?`agent`:`home`,r=n===`chats`&&e[1]===`new`,i=n===`chat`?e[2]:n===`chats`&&!r?e[1]:void 0,a=M(`agents.list`,{}),o=xe(),s=Ba(),[c,l]=(0,v.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(`kw-agent-groups`)??`[]`);return Array.isArray(e)?e.map(String):[]}catch{return[]}}),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)({}),T=(a?.agents??[]).map(e=>C[e.slug]===void 0?e:{...e,group:C[e.slug]||void 0});(0,v.useEffect)(()=>{w(e=>{let t={...e},n=!1;for(let e of a?.agents??[])t[e.slug]!==void 0&&(e.group??``)===t[e.slug]&&(delete t[e.slug],n=!0);return n?t:e})},[a]);let E=T.filter(e=>!e.archived),D=T.filter(e=>e.archived),[O,k]=(0,v.useState)(!1),ee=[...new Set([...E.map(e=>e.group??``).filter(Boolean),...c])].sort((e,t)=>e.localeCompare(t)),te=E.filter(e=>!e.group);function j(e){l(e);try{localStorage.setItem(`kw-agent-groups`,JSON.stringify(e))}catch{}}function ne(){let e=f.trim();d(!1),p(``),e&&!ee.includes(e)&&j([...c,e])}function re(e,t){h(null);let n=t.trim();if(n&&n!==e){for(let t of T.filter(t=>t.group===e))I(t.slug,n);c.includes(e)&&j([...new Set(c.map(t=>t===e?n:t))])}}async function I(e,t){if((T.find(t=>t.slug===e)?.group??``)!==t){w(n=>({...n,[e]:t}));try{let n=await A.call(`agents.get`,{slug:e});await A.call(`agents.save`,{slug:e,body:{...n,group:t||void 0}})}catch{w(t=>{let n={...t};return delete n[e],n})}}}let ie=e=>o?{onDragOver:t=>{y!=null&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,x!==e&&S(e))},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`text/plain`)||y;n&&I(n,e),b(null),S(null)}}:{},ae=e=>(0,P.jsx)(`div`,{className:y===e.slug?`opacity-40`:void 0,onDragStart:t=>{if(!o)return t.preventDefault();t.dataTransfer.setData(`text/plain`,e.slug),t.dataTransfer.effectAllowed=`move`,b(e.slug)},onDragEnd:()=>{b(null),S(null)},children:(0,P.jsx)(J,{href:`/agents/${encodeURIComponent(e.slug)}`,active:e.slug===t,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),title:e.name,sub:e.description||e.harness})},e.slug),oe=e=>(0,P.jsx)(J,{href:`/agents/${encodeURIComponent(e.slug)}/info`,active:e.slug===t,dim:e.slug!==t,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),title:e.name,sub:e.description||e.harness},e.slug),se;se=n===`new`?(0,P.jsx)(Ls,{},`new`):n===`edit`&&t?(0,P.jsx)(Ls,{slug:t},t):n===`chat`&&t&&i===`new`?(0,P.jsx)(Ss,{slug:t,name:T.find(e=>e.slug===t)?.name},t):n===`chat`&&t&&i?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:i,agentName:T.find(e=>e.slug===t)?.name??t,agentDescription:T.find(e=>e.slug===t)?.description},i)}):n===`chats`?i?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:i},i)}):r?(0,P.jsx)(Ro,{}):(0,P.jsx)(Cs,{}):n===`info`&&t?(0,P.jsx)(Fs,{slug:t},t):t?(0,P.jsx)(xs,{slug:t,name:T.find(e=>e.slug===t)?.name},t):a?E.length?(0,P.jsx)(Os,{agents:E}):(0,P.jsx)(ks,{}):(0,P.jsx)(G,{children:`loading…`});let ce=(n===`agent`||n===`info`||n===`chat`)&&t?T.find(e=>e.slug===t)?.knowledge??[]:[],[le,ue]=(0,v.useState)(()=>localStorage.getItem(`kw-kside`)!==`hidden`),[de,fe]=(0,v.useState)(()=>Number(localStorage.getItem(`kw-kside-w`))||460),L=ce.length>0&&le;function R(e){ue(e),localStorage.setItem(`kw-kside`,e?`open`:`hidden`)}function z(e){fe(e),localStorage.setItem(`kw-kside-w`,String(e))}return(0,P.jsxs)(`div`,{className:`runs-screen agents-screen ${t||n===`chats`?`has-tabs`:``} ${(t||n===`chats`)&&s?`has-sessions`:``} ${L?`has-knowledge`:``}`,style:L?{"--kside-w":`${de}px`}:void 0,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`agents`,action:o&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/agents/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[(0,P.jsx)(`div`,{className:`mb-1.5 border-b border-line pb-1.5`,children:(0,P.jsx)(J,{href:`/agents/chats`,active:n===`chats`,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:`🎩`}),title:`Ralv`,sub:`chief of staff of the workspace`})}),(0,P.jsxs)(`div`,{className:N(`rounded-xl`,y&&x===``&&zs),...ie(``),children:[te.map(ae),y!=null&&te.length===0&&(0,P.jsx)(`div`,{className:Bs,children:`no group — drop here`})]}),ee.map(e=>{let t=E.filter(t=>t.group===e);return(0,P.jsxs)(`div`,{className:N(`group/grp mt-3 rounded-xl`,y&&x===e&&zs),...ie(e),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pt-1.5 pb-0.5`,children:[m===e?(0,P.jsx)(Y,{className:`h-7 min-w-0 flex-1 text-2xs`,autoFocus:!0,"aria-label":`group name`,value:g,onChange:e=>_(e.target.value),onKeyDown:t=>{t.key===`Enter`&&re(e,g),t.key===`Escape`&&h(null)},onBlur:()=>re(e,g)}):(0,P.jsx)(tt,{children:e}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-2`,children:t.length}),(0,P.jsx)(`span`,{className:`flex-1`}),o&&m!==e&&(0,P.jsx)(V,{icon:`edit`,label:`Rename group`,size:`sm`,className:`size-6 opacity-0 group-hover/grp:opacity-100 focus-visible:opacity-100`,onClick:()=>{h(e),_(e)}}),o&&t.length===0&&c.includes(e)&&(0,P.jsx)(V,{icon:`close`,label:`Remove empty group`,size:`sm`,className:`size-6 opacity-0 group-hover/grp:opacity-100 focus-visible:opacity-100`,onClick:()=>j(c.filter(t=>t!==e))})]}),t.map(ae),t.length===0&&(0,P.jsx)(`div`,{className:Bs,children:o?`drag agents here`:`no agents`})]},e)}),D.length>0&&(0,P.jsxs)(`div`,{className:`mt-2.5 border-t border-line pt-1`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`group/arch flex w-full cursor-pointer items-center gap-1.5 border-0 bg-transparent px-2.5 pt-1.5 pb-0.5 text-left text-fg-2`,"aria-expanded":O,onClick:()=>k(e=>!e),children:[(0,P.jsx)(tt,{className:`group-hover/arch:text-fg`,children:`archived`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums`,children:D.length}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(F,{name:O?`expand_less`:`expand_more`,className:`ms-sm`})]}),O&&D.map(oe)]}),a&&T.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-2.5`,children:`no agents yet`}),o&&(u?(0,P.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1`,children:(0,P.jsx)(Y,{className:`h-8 text-sm`,autoFocus:!0,"aria-label":`new group`,value:f,placeholder:`group name, e.g. Team Content`,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ne(),e.key===`Escape`&&(d(!1),p(``))},onBlur:ne})}):(0,P.jsxs)(`button`,{type:`button`,className:`mx-2.5 mt-3 mb-1 flex cursor-pointer items-center gap-1 rounded-lg border border-dashed border-line bg-transparent px-2.5 py-1 text-2xs text-fg-2 hover:text-accent`,onClick:()=>d(!0),children:[(0,P.jsx)(F,{name:`add`,className:`ms-sm`}),` group`]}))]})]}),t&&(0,P.jsx)(ws,{slug:t,chatId:i===`new`?void 0:i}),n===`chats`&&(0,P.jsx)(Ds,{chatId:i}),(0,P.jsx)(`div`,{className:`runs-main`,children:se}),L&&(0,P.jsx)(vs,{bundles:ce,onHide:()=>R(!1),onResize:z}),ce.length>0&&!le&&(0,P.jsxs)(`button`,{type:`button`,className:`kside-reopen fixed top-[60px] right-3.5 z-5 inline-flex cursor-pointer items-center gap-1 rounded-full border border-line bg-surface-2 px-3 py-1 text-2xs text-fg-2 hover:text-fg`,onClick:()=>R(!0),title:`Show knowledge sidebar`,children:[(0,P.jsx)(F,{name:`menu_book`,className:`ms-sm`}),` knowledge`]})]})}function Hs(e){if(!R(e))return null;let t=e.split(`/`).filter(Boolean),n=decodeURIComponent(t[1]),r=t[0]===`agents`||t[0]===`team`;return n===`new`?t[0]===`projects`?(0,P.jsx)(Xo,{},`new-project`):r?(0,P.jsx)(Ls,{},`new-agent`):(0,P.jsx)(ka,{},`new-channel`):t[0]===`projects`&&t[2]===`info`?(0,P.jsx)(rs,{slug:n,onChanged:async()=>{}},n):r&&t[2]===`info`?(0,P.jsx)(Fs,{slug:n},n):r&&t[2]===`edit`?(0,P.jsx)(Ls,{slug:n},n):t[0]===`channels`&&t[2]===`edit`?(0,P.jsx)(ka,{slug:n},n):null}function Us({back:e,children:t}){let n=()=>z(e);return(0,v.useEffect)(()=>{let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`.palette-backdrop`)||(e.preventDefault(),n())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-40 flex animate-fade items-start justify-center bg-black/38 px-4 pt-[6vh] pb-4 max-[800px]:p-0`,onMouseDown:n,children:(0,P.jsxs)(`div`,{className:`edit-modal relative max-h-[88dvh] w-[min(960px,100%)] animate-modal overflow-y-auto rounded-card border border-line bg-surface shadow-modal max-[800px]:max-h-dvh max-[800px]:rounded-none`,role:`dialog`,"aria-label":`edit`,onMouseDown:e=>e.stopPropagation(),children:[(0,P.jsx)(V,{icon:`close`,label:`close (esc)`,className:`absolute top-3 right-3 z-1 rounded-full`,onClick:n}),(0,P.jsx)(`div`,{className:`runs-main min-w-0 pt-[18px] pr-12 pb-10 pl-6`,children:t})]})})}function Ws({runId:e,decision:t}){let{request:n,answer:r}=t,[i,a]=(0,v.useState)(n.options.length===1?n.options[0].value:null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),f=e=>n.options.find(t=>t.value===e)?.label??e;if(r)return(0,P.jsx)(`section`,{className:N(Gs,`decision-panel is-decided`),"aria-label":`decision`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4`,children:[(0,P.jsx)(`div`,{className:Ks,children:n.title??`Decision`}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-base`,children:[(0,P.jsx)(U,{tone:`ok`,children:f(r.decision)}),r.note&&(0,P.jsxs)(`span`,{className:`text-fg-2`,children:[`“`,r.note,`”`]}),r.decidedAt&&(0,P.jsx)(`span`,{className:`text-xs tabular-nums text-fg-2`,children:Ge(r.decidedAt)})]})]})});let p=!!i&&!c&&(n.note!==`required`||!!o.trim());async function m(){if(!p)return;l(!0),d(null);let t=await A.request(`runs.decide`,{id:e,body:{decision:i,note:o.trim()}}).catch(()=>null);t?.ok||(d(t?.error??`could not save the decision`),l(!1))}return(0,P.jsx)(`section`,{className:N(Gs,`decision-panel`),"aria-label":`decision needed`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(H,{tone:`working`}),(0,P.jsx)(`div`,{className:Ks,children:n.title??`This run needs your decision`})]}),n.prompt&&(0,P.jsx)(`p`,{className:`m-0 max-w-[80ch] text-base text-fg-2`,children:n.prompt}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 self-start`,role:`radiogroup`,"aria-label":`options`,children:n.options.map(e=>(0,P.jsx)(B,{role:`radio`,"aria-checked":i===e.value,variant:i===e.value?`primary`:`secondary`,onClick:()=>a(e.value),children:e.label??e.value},e.value))}),n.note!==!1&&(0,P.jsx)(Y,{value:o,placeholder:n.note===`required`?`Note (required)`:`Note`,"aria-label":`note`,className:`max-w-[60ch]`,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&m()}),u&&(0,P.jsx)(K,{tone:`bad`,children:u}),(0,P.jsx)(`div`,{className:`flex gap-2`,children:(0,P.jsx)(B,{variant:`primary`,onClick:m,disabled:!p,busy:c,children:c?`Saving…`:`Submit decision`})})]})})}var Gs=`mb-[18px] overflow-hidden rounded-card border border-line bg-surface`,Ks=`text-[16px] font-medium text-fg`;function qs(e){return e===`ok`?`ok`:e===`running`?`working`:e===`failed`||e===`blocked`?`bad`:`idle`}function Js({status:e}){return(0,P.jsx)(`span`,{"data-ui":`status`,"data-status":e,className:`inline-flex`,children:(0,P.jsx)(U,{tone:e===`ok`?`ok`:e===`failed`||e===`blocked`?`bad`:e===`running`?`accent`:`neutral`,children:e})})}function Ys(){return(0,P.jsx)(`span`,{"data-ui":`decision`,className:`inline-flex`,children:(0,P.jsx)(U,{tone:`accent`,children:`decision needed`})})}function Xs({label:e,children:t,className:n}){return(0,P.jsxs)(`div`,{className:n,children:[(0,P.jsx)(tt,{className:`mb-px block`,children:e}),(0,P.jsx)(`div`,{className:`font-mono text-md font-medium tabular-nums text-fg`,children:t})]})}var Zs=`mb-[22px] flex flex-wrap gap-[26px]`;function Qs({id:e,workflow:t}){let n=M(`runs.list`,{},{fast:!0}),r=n?.runs??[],[i,a]=(0,v.useState)(t??``),o=(0,v.useMemo)(()=>{let e=i.trim().toLowerCase();return e?r.filter(t=>[t.workflow,t.request,t.id].some(t=>t?.toLowerCase().includes(e))):r},[r,i]);return(0,P.jsxs)(`div`,{className:`runs-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`runs`,back:{href:`/workflows`,label:`back to workflows`},count:i?`${o.length} / ${r.length}`:r.length}),(0,P.jsx)(Et,{icon:`filter_list`,value:i,placeholder:`filter by workflow or request`,"aria-label":`filter runs`,onChange:e=>a(e.target.value)}),(0,P.jsxs)(Dt,{label:`runs list`,children:[o.map(t=>(0,P.jsx)($s,{r:t,active:t.id===e},t.id)),n&&r.length===0&&(0,P.jsx)(Ot,{children:`no runs yet`}),r.length>0&&o.length===0&&(0,P.jsxs)(Ot,{children:[`no run matches “`,i,`”`]})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:(0,P.jsx)(ec,{id:e},e)})]})}function $s({r:e,active:t}){return(0,P.jsx)(J,{href:`/runs/${e.id}`,active:t,size:`sm`,leading:(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),title:e.workflow??`unknown`,meta:Ge(e.startedAt),sub:(0,P.jsxs)(`span`,{className:`flex gap-2`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.request,children:e.status===`running`&&e.currentPhase?`${e.currentPhase}`:e.request??``}),(0,P.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)})]})})}function ec({id:e}){let t=M(`runs.get`,{id:e},{fast:!0}),n=t?.status===`running`,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),l=xe();if(!t)return(0,P.jsx)(G,{children:`loading…`});let u=t.files.some(e=>e.name===`runner.json`),d=r??(n?`run`:`artifacts`),f=l?t.files.length:t.files.filter(e=>!sc(e.name)).length;async function p(){o(!0),c(null);let t=await A.request(`runs.stop`,{id:e}).catch(()=>null);t?.ok||(o(!1),c(t?.error??`stop failed`))}async function m(){if(!window.confirm(`Move run ${e} to the trash?`))return;c(null);let n=await A.request(`runs.delete`,{id:e}).catch(()=>null);if(n?.ok){z(t?.workflow?`/workflows/${encodeURIComponent(t.workflow)}`:`/workflows`);return}c(n?.error??`remove failed`)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`mb-1.5 flex flex-wrap items-center gap-x-4 gap-y-2.5`,children:[(0,P.jsx)(H,{tone:qs(t.status),title:t.status}),(0,P.jsx)(rt,{size:`lg`,children:t.workflow?(0,P.jsx)(ge,{href:`/workflows/${encodeURIComponent(t.workflow)}`,title:`open workflow`,className:`text-inherit no-underline hover:text-accent`,children:t.workflow}):`unknown workflow`}),(0,P.jsx)(Js,{status:t.status}),u&&(0,P.jsxs)(U,{children:[(0,P.jsx)(F,{name:`science`,className:`ms-sm mr-1`}),` sandbox`]}),(0,P.jsx)(`span`,{className:`font-mono text-xs text-fg-2`,children:e.replace(/^run-/,``)}),n?(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`stop`,busy:a,onClick:p,children:a?`stopping…`:`stop`}):(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:m,title:`delete this run's folder`,children:`remove`}),s&&(0,P.jsx)(`span`,{className:`text-xs text-bad`,children:s}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,title:`chat with an agent about this run`,onClick:()=>void Lo(`claude`,{kind:`run`,runId:e}),children:`⌬ discuss`}),(0,P.jsx)(pt,{className:`border-b-0 px-0`,label:`run sections`,value:d,onChange:i,items:[{id:`run`,label:`run`},{id:`artifacts`,label:`artifacts`,count:f}]})]}),t.request&&(0,P.jsx)(`p`,{className:`mb-5 max-w-[90ch] text-base text-fg-2`,children:t.request}),d===`run`?(0,P.jsx)(tc,{run:t,live:n}):(0,P.jsx)(lc,{id:e,files:t.files,live:n})]})}function tc({run:e,live:t}){return(0,P.jsxs)(`div`,{className:`max-w-[1080px]`,children:[e.decision&&(0,P.jsx)(Ws,{runId:e.id,decision:e.decision}),(0,P.jsxs)(`div`,{className:Zs,children:[(0,P.jsxs)(Xs,{label:`phases`,children:[e.phasesDone,e.phasesTotal==null?``:` / ${e.phasesTotal}`]}),(0,P.jsx)(Xs,{label:`duration`,children:t?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),(0,P.jsx)(Xs,{label:`cost`,children:He(e.costUsd??rc(e.phases))}),(0,P.jsxs)(Xs,{label:`tokens in / out`,children:[Ue(nc(e.phases,`tokensIn`)),` / `,Ue(nc(e.phases,`tokensOut`))]})]}),(0,P.jsx)(q,{title:`phase timeline`,actions:t&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-[7px] text-2xs text-fg-2`,children:[(0,P.jsx)(H,{tone:`working`}),` live · polling`]}),children:(0,P.jsx)(`div`,{className:`py-1.5`,children:e.phases.map(e=>(0,P.jsx)(ac,{p:e},e.phase))})})]})}function nc(e,t){return e.reduce((e,n)=>e+(n[t]??0),0)}function rc(e){return e.reduce((e,t)=>e+(t.costUsd??0),0)}var ic=`relative border-line/55 [&+&]:border-t before:absolute before:top-0 before:bottom-0 before:w-px before:bg-line last:before:bottom-auto`;function ac({p:e}){let t=e.gates.filter(e=>!e.passed);return(0,P.jsxs)(`div`,{className:N(ic,`py-2.5 pr-[18px] pl-[42px] before:left-[23px] first:before:top-4 last:before:h-4`),children:[(0,P.jsx)(`span`,{className:`absolute top-4 left-[19px] z-1 grid`,children:(0,P.jsx)(H,{tone:qs(e.status),title:e.status})}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-base font-medium text-fg`,children:e.phase}),e.kind===`agent`?(0,P.jsxs)(U,{tone:`accent`,children:[e.agent,e.model?` · ${e.model}`:``,e.protocol?` · ${e.protocol}`:``]}):(0,P.jsx)(U,{children:`script`}),e.status===`skipped`&&(0,P.jsx)(Js,{status:`skipped`}),(0,P.jsxs)(`span`,{className:`ml-auto flex gap-3.5 font-mono text-[11.5px] tabular-nums text-fg-2`,children:[e.attempts>1&&(0,P.jsxs)(`span`,{children:[`att `,e.attempts]}),e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):e.durationMs!=null&&(0,P.jsx)(`span`,{children:Ve(e.durationMs)}),e.kind===`agent`&&e.tokensIn!=null&&(0,P.jsxs)(`span`,{children:[Ue(e.tokensIn),` / `,Ue(e.tokensOut)]}),e.costUsd!=null&&e.costUsd>0&&(0,P.jsx)(`span`,{children:He(e.costUsd)})]})]}),e.status===`running`&&e.lastActivity&&(0,P.jsxs)(`div`,{className:`mt-[3px] font-mono text-[11.5px] text-accent`,children:[`▸ `,e.lastActivity]}),e.summary&&e.status!==`running`&&(0,P.jsx)(`div`,{className:`mt-[3px] max-w-[72ch] text-[12.5px] text-fg-2`,children:e.summary}),e.gates.length>0&&(0,P.jsx)(`div`,{className:`mt-[5px] flex flex-wrap gap-1.5`,children:e.gates.map(e=>(0,P.jsxs)(`span`,{className:N(`inline-flex items-center gap-[5px] rounded-lg px-2.5 py-0.5 font-mono text-2xs`,e.passed?`bg-ok-soft text-ok`:`bg-bad-soft text-on-bad-soft`),title:e.failure??``,children:[(0,P.jsx)(F,{name:e.passed?`check`:`close`,className:`ms-sm`}),` `,e.gate]},e.gate))}),t.map(e=>(0,P.jsx)(`div`,{className:`mt-1 text-xs text-bad`,children:e.failure},e.gate))]})}var oc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function sc(e){return e===`runner.json`||e.endsWith(`.jsonl`)||e.endsWith(`.log`)}function cc(e){let t=[`report.html`,`recommendation.md`].find(t=>e.some(e=>e.name===t));if(t)return t;let n=e=>{let t=e.split(`.`).pop()?.toLowerCase()??``;return[`html`,`md`,`markdown`,`pdf`].includes(t)||oc.has(t)?0:sc(e)?2:1},r=null;for(let t of e)(!r||n(t.name)<n(r.name))&&(r=t);return r?.name??null}function lc({id:e,files:t,live:n}){let[r,i]=(0,v.useState)(null),a=xe(),o=(0,v.useMemo)(()=>a?t:t.filter(e=>!sc(e.name)),[t,a]);return(0,v.useEffect)(()=>{!a&&r&&sc(r)&&i(null)},[a,r]),(0,v.useEffect)(()=>{r||o.length===0||i(cc(o))},[o,r]),(0,P.jsxs)(`div`,{className:`grid h-[calc(100vh-172px)] min-h-[420px] grid-cols-[280px_minmax(0,1fr)] gap-3.5 max-[940px]:h-auto max-[940px]:grid-cols-1`,children:[(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`files `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,o.length,`)`]})]}),className:`flex min-h-0 flex-col`,children:(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto max-[940px]:max-h-60`,children:[o.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:N(`flex w-full cursor-pointer items-center gap-2.5 border-0 border-b border-line/55 px-[18px] py-2 text-left font-mono text-[12.5px] transition-colors last:border-b-0`,r===e.name?`bg-accent-soft text-on-accent-soft`:`bg-transparent text-fg-2 hover:bg-surface-2 hover:text-fg`),onClick:()=>i(e.name),children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-2xs tabular-nums text-fg-2`,children:We(e.size)})]},e.name)),o.length===0&&(0,P.jsx)(W,{className:`px-[18px] py-3`,children:t.length>0?`no result files — raw run files live in expert mode`:`no files yet`})]})}),(0,P.jsx)(q,{title:r??`viewer`,className:`flex min-h-0 flex-col`,actions:r&&(0,P.jsx)(`a`,{className:uc,href:A.url(`runs.file`,{id:e,query:{name:r,raw:!0}}),target:`_blank`,children:`open raw ↗`}),children:r?(0,P.jsx)(hc,{id:e,name:r,live:n}):(0,P.jsx)(G,{className:`flex-1 justify-center`,children:`select a file`})})]})}var uc=`inline-flex h-7 items-center rounded-control px-2.5 text-sm font-medium text-fg-2 no-underline transition-colors hover:bg-surface-2 hover:text-fg`,dc=`flex min-h-0 flex-1 flex-col`,fc=`min-h-0 flex-1`,pc=`m-0 h-full overflow-auto px-[18px] py-3.5 text-xs leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,mc=`block h-full min-h-[560px] w-full border-0 bg-white`;function hc({id:e,name:t,live:n}){let r=t.split(`.`).pop()?.toLowerCase()??``,i=A.url(`runs.file`,{id:e,query:{name:t,raw:!0}});return r===`html`?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`iframe`,{className:mc,src:i,sandbox:`allow-scripts`,allow:`clipboard-write`,title:t})})}):r===`pdf`?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`iframe`,{className:mc,src:i,title:t})})}):oc.has(r)?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`img`,{className:`block max-h-full max-w-full object-contain px-[18px] py-3.5`,src:i,alt:t})})}):r===`md`||r===`markdown`?(0,P.jsx)(_c,{id:e,name:t,live:n}):(0,P.jsx)(vc,{id:e,name:t,live:n})}var gc=`flex items-center gap-3 border-b border-line/55 px-[18px] py-1.5 text-2xs text-fg-2`;function _c({id:e,name:t,live:n}){let[r,i]=(0,v.useState)(`rendered`),a=M(`runs.fileText`,{id:e,query:{name:t}},{fast:n}),o=(0,v.useMemo)(()=>a?pa.sanitize(Q.parse(a.content,{async:!1})):``,[a?.content]);return(0,P.jsxs)(`div`,{className:dc,children:[(0,P.jsxs)(`div`,{className:gc,children:[(0,P.jsx)(pt,{className:`border-b-0 px-0`,label:`markdown view`,value:r,onChange:i,items:[{id:`rendered`,label:`rendered`},{id:`source`,label:`source`}]}),a?.truncated&&(0,P.jsxs)(`span`,{children:[`large file — showing the last `,We(4e5)]})]}),(0,P.jsx)(`div`,{className:N(fc,`overflow-auto`),children:a?r===`rendered`?(0,P.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:{__html:o}}):(0,P.jsx)(`pre`,{className:pc,children:a.content||`(empty)`}):(0,P.jsx)(`pre`,{className:pc,children:`loading…`})})]})}function vc({id:e,name:t,live:n}){let r=M(`runs.fileText`,{id:e,query:{name:t}},{fast:n});return(0,P.jsxs)(`div`,{className:dc,children:[r?.truncated&&(0,P.jsxs)(`div`,{className:gc,children:[`large file — showing the last `,We(4e5)]}),(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`pre`,{className:pc,children:r?r.content||`(empty)`:`loading…`})})]})}function yc(){return M(`workflows.runner`,{slug:`any`},{interval:15e3})}var bc=e=>!!e?.available&&!!e?.image;function xc(e){return e?e.available?e.image?`isolated container per run`:"image missing — run `kraftwerk runner build`":`Docker is not running`:``}async function Sc(e,t){return(await A.call(`workflows.run`,{slug:e,body:t})).runId}function Cc(e,t,n,r){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!0),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),m=yc();(0,v.useEffect)(()=>{!i&&n&&a(n)},[n]),(0,v.useEffect)(()=>{m&&!bc(m)&&s(!1)},[m]);let h=!u&&(!t||!!i.trim())&&(!o||bc(m));async function g(){if(h){d(!0),p(null);try{let t=await Sc(e,{request:i.trim(),sandbox:o,ssh:c});r?(r(t),d(!1)):z(`/runs/${t}`)}catch(e){p(e.message),d(!1)}}}return{request:i,setRequest:a,sandbox:o,setSandbox:s,ssh:c,setSsh:l,busy:u,error:f,docker:m,canRun:h,launch:g}}function wc({slug:e,usesRequest:t,initialRequest:n,onLaunched:r}){let i=Cc(e,t,n,r);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 px-5 pt-4 pb-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-4 max-[700px]:flex-wrap`,children:[t?(0,P.jsx)(Y,{className:`h-11 min-w-0 flex-1 text-md`,value:i.request,placeholder:`Request`,"aria-label":`request`,onChange:e=>i.setRequest(e.target.value),onKeyDown:e=>e.key===`Enter`&&i.launch()}):(0,P.jsx)(`span`,{className:`flex-1 text-base text-fg-2`,children:`This workflow takes no request.`}),(0,P.jsx)(B,{variant:`primary`,icon:`play_arrow`,className:`h-11 px-5 max-[700px]:w-full`,busy:i.busy,onClick:i.launch,disabled:!i.canRun,children:i.busy?`Starting…`:`Run`})]}),(0,P.jsxs)(`div`,{className:`-mx-2 mt-1 flex flex-wrap gap-x-2`,children:[(0,P.jsx)(wt,{label:`Docker sandbox`,hint:xc(i.docker),checked:i.sandbox,onChange:i.setSandbox}),i.sandbox&&(0,P.jsx)(wt,{label:`Forward SSH agent`,hint:`keys and known hosts from this machine`,checked:i.ssh,onChange:i.setSsh})]}),i.error&&(0,P.jsx)(K,{tone:`bad`,children:i.error})]})}var Tc=`\0done`,Ec=5;function Dc(e,t){return e.status===`ok`?Tc:e.currentPhase&&t.includes(e.currentPhase)?e.currentPhase:t[0]??Tc}var Oc=[`var(--accent)`,`#4fb8a8`,`#a78bfa`,`#e5793b`];function kc(e){return e==null?`var(--text-2)`:Oc[e%Oc.length]}function Ac({colour:e,children:t,small:n}){return(0,P.jsx)(`span`,{style:{"--aid":e},className:N(`relative z-1 grid flex-none place-items-center rounded-full border font-mono font-bold tabular-nums`,`border-[color-mix(in_srgb,var(--aid)_55%,var(--line))] bg-[color-mix(in_srgb,var(--aid)_18%,var(--surface-1))] text-[var(--aid)]`,n?`size-[22px] text-2xs`:`mt-px size-[26px] text-[11.5px]`),children:t})}function jc({wf:e,runs:t,agentIdx:n,runsHref:r}){let i=e.steps.map(e=>e.name),a=new Map([...i,Tc].map(e=>[e,[]]));for(let e of t)a.get(Dc(e,i)).push(e);let o=a.get(Tc)??[];return(0,P.jsxs)(`div`,{className:`board flex items-start gap-3 overflow-x-auto px-[18px] pt-3.5 pb-[18px]`,children:[e.steps.map((e,t)=>{let i=a.get(e.name)??[];return(0,P.jsx)(Mc,{step:e.name,index:(0,P.jsx)(Ac,{small:!0,colour:kc(e.agent?n.get(e.agent)??0:null),children:t+1}),count:i.length,children:(0,P.jsx)(Nc,{cards:i,moreHref:r})},e.name)}),(0,P.jsx)(Mc,{step:`done`,name:`done`,done:!0,index:(0,P.jsx)(Ac,{small:!0,colour:`var(--ok)`,children:`✓`}),count:o.length,children:(0,P.jsx)(Nc,{cards:o,moreHref:r})})]})}function Mc({step:e,name:t,done:n,index:r,count:i,children:a}){return(0,P.jsxs)(`div`,{className:N(`board-col flex min-w-60 flex-[0_0_240px] flex-col gap-1.5`,n&&`is-done`),"data-step":e,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-0.5 pt-0.5 pb-1`,children:[r,(0,P.jsx)(`span`,{className:`board-col-name min-w-0 truncate text-[13.5px] font-medium text-fg`,title:t??e,children:t??e}),(0,P.jsx)(`span`,{className:`board-col-count ml-auto font-mono text-[11.5px] tabular-nums text-fg-2`,children:i})]}),a]})}function Nc({cards:e,moreHref:t}){return(0,P.jsxs)(`div`,{className:`flex min-h-14 flex-col gap-2 rounded-xl bg-surface-2/60 p-2`,children:[e.slice(0,Ec).map(e=>(0,P.jsx)(Pc,{r:e},e.id)),e.length===0&&(0,P.jsx)(`div`,{className:`board-col-empty py-3.5 text-center text-xs text-fg-2`,children:`—`}),e.length>Ec&&(0,P.jsxs)(ge,{href:t,className:`board-more block p-1.5 text-center text-xs text-fg-2 no-underline hover:text-accent`,children:[`+ `,e.length-Ec,` more ↗`]})]})}function Pc({r:e}){let t=e.request??e.id.replace(/^run-/,``);return(0,P.jsxs)(ge,{href:`/runs/${e.id}`,className:`board-card block rounded-xl border border-line bg-surface px-3 py-2.5 text-inherit no-underline transition-colors hover:bg-surface-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-[13.5px] font-medium text-fg`,title:t,children:t})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-2.5 font-mono text-[11.5px] tabular-nums text-fg-2`,children:[(0,P.jsx)(`span`,{children:Ge(e.startedAt)}),(0,P.jsx)(`span`,{children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),e.costUsd!=null&&e.costUsd>0&&(0,P.jsx)(`span`,{children:He(e.costUsd)})]}),(e.awaitingDecision||e.status===`failed`||e.status===`aborted`)&&(0,P.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.awaitingDecision&&(0,P.jsx)(Ys,{}),(e.status===`failed`||e.status===`aborted`)&&(0,P.jsx)(Js,{status:e.status})]})]})}function Fc({slug:e,tab:t}){let n=M(`workflows.get`,{slug:e}),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(0),s=M(`runs.list`,{},{fast:a>0||Date.now()-r<2e4});if(!n)return(0,P.jsx)(G,{children:`loading…`});if(n.error)return(0,P.jsxs)(G,{children:[(0,P.jsx)(U,{tone:`bad`,children:`broken workflow`}),(0,P.jsx)(`pre`,{className:`mt-3 text-left`,children:n.error}),(0,P.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,P.jsx)(Lc,{slug:n.slug})})]});let c=new Map(n.agents.map((e,t)=>[e.id,t%4])),l=(s?.runs??[]).filter(e=>e.workflow===n.name||e.workflow===n.slug),u=`/workflows/${encodeURIComponent(n.slug)}`,d=l.filter(e=>e.status===`running`).length;return d!==a&&o(d),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`mb-1.5 flex flex-wrap items-center gap-x-4 gap-y-2.5 in-[.ctx-embed]:mb-3 in-[.ctx-embed]:gap-y-2`,children:[(0,P.jsx)(rt,{size:`lg`,className:`in-[.ctx-embed]:text-xl`,children:n.name??n.slug}),(0,P.jsx)(`span`,{className:`min-w-0 font-mono text-xs [overflow-wrap:anywhere] text-fg-2 in-[.ctx-embed]:hidden`,children:n.dir}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(pt,{bare:!0,label:`workflow sections`,value:t,items:[{id:`overview`,href:u,label:`overview`},{id:`details`,href:`${u}/details`,label:`details`},{id:`runs`,href:`${u}/runs`,label:(0,P.jsxs)(P.Fragment,{children:[`runs `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,l.length,`)`]})]})}]})]}),n.description&&(0,P.jsx)(`p`,{className:`mb-5 max-w-[90ch] text-base text-fg-2`,children:n.description}),t===`overview`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(q,{className:`run-panel mb-[18px]`,children:(0,P.jsx)(wc,{slug:n.slug,usesRequest:n.usesRequest,initialRequest:l[0]?.request,onLaunched:()=>i(Date.now())})}),(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`board`,` `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,l.length,` runs`,d>0?`, ${d} live`:``,`)`]})]}),actions:l[0]&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,href:`${u}/runs`,className:`in-[.ctx-embed]:hidden`,children:`all runs ↗`}),children:(0,P.jsx)(jc,{wf:n,runs:l,agentIdx:c,runsHref:`${u}/runs`})})]}),t===`details`&&(0,P.jsx)(Ic,{wf:n,agentIdx:c}),t===`runs`&&(0,P.jsx)(Rc,{runs:l})]})}function Ic({wf:e,agentIdx:t}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:Zs,children:[(0,P.jsx)(Xs,{label:`agents`,children:e.agents.length}),(0,P.jsxs)(Xs,{label:`steps`,children:[e.steps.length,` `,(0,P.jsxs)(`span`,{className:`font-normal text-fg-2`,children:[`(`,e.steps.filter(e=>e.kind===`agent`).length,` agent · `,e.steps.filter(e=>e.kind===`script`).length,` script)`]})]}),e.workspace&&(0,P.jsx)(Xs,{label:`workspace`,className:`max-w-[420px]`,children:(0,P.jsx)(`span`,{className:`text-[11.5px] font-normal whitespace-pre-wrap text-fg-2`,children:e.workspace})})]}),(0,P.jsx)(q,{title:`agents`,className:`mb-[18px]`,children:(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))]`,children:[e.agents.map(e=>(0,P.jsx)(Bc,{a:e,idx:t.get(e.id)??0},e.id)),e.agents.length===0&&(0,P.jsx)(W,{className:`px-[18px] py-3`,children:`no agents — script-only workflow`})]})}),(0,P.jsxs)(`div`,{className:`grid items-start gap-[18px] grid-cols-[minmax(430px,5fr)_minmax(360px,4fr)] max-[1100px]:grid-cols-1 in-[.ctx-embed]:grid-cols-1`,children:[(0,P.jsx)(q,{title:`pipeline`,children:(0,P.jsx)(`div`,{className:`pipeline py-2`,children:e.steps.map((e,n)=>(0,P.jsx)(Vc,{s:e,i:n,idx:e.agent?t.get(e.agent)??0:null},e.name))})}),(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`folder `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,e.files.length,` files)`]})]}),children:(0,P.jsx)(`div`,{className:`max-h-[300px] overflow-auto`,children:e.files.map(e=>(0,P.jsx)(`div`,{className:`truncate border-b border-line/55 px-[18px] py-2 font-mono text-[12.5px] text-fg-2 last:border-b-0`,children:e},e))})})]}),(0,P.jsx)(`div`,{className:`mt-[18px] in-[.ctx-embed]:hidden`,children:(0,P.jsx)(Lc,{slug:e.slug})})]})}function Lc({slug:e}){let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=async()=>{i(!0),o(``);try{let t=await A.request(`workflows.delete`,{slug:e});if(!t.ok)throw Error(t.error||`failed`);z(`/workflows`,{replace:!0})}catch(e){o(e.message),n(!1)}finally{i(!1)}};return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:t?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`danger`,icon:`delete`,busy:r,onClick:()=>void s(),children:`confirm delete`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>n(!1),children:`cancel`}),(0,P.jsx)(W,{children:`its runs stay; the trash can put it back`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:()=>n(!0),title:`Move the workflow's folder to the trash`,children:`delete workflow`})}),a&&(0,P.jsx)(K,{tone:`bad`,children:a})]})}function Rc({runs:e}){return e.length===0?(0,P.jsx)(G,{children:`no runs of this workflow yet`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>{let t=e.phasesTotal??0,n=t>0?Math.round(e.phasesDone/t*100):e.status===`ok`?100:0;return(0,P.jsxs)(ge,{href:`/runs/${e.id}`,className:`run-card grid grid-cols-[12px_200px_1fr_auto] items-center gap-x-4 gap-y-2 rounded-card border border-line bg-surface px-5 py-3.5 text-inherit no-underline transition-colors hover:bg-surface-2 max-[900px]:grid-cols-[12px_1fr]`,children:[(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),(0,P.jsx)(`span`,{className:`font-mono text-[12.5px] text-fg-2`,children:e.id.replace(/^run-/,``)}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-fg`,title:e.request,children:e.status===`running`&&e.currentPhase?e.currentPhase:e.request??``}),(0,P.jsxs)(`span`,{className:`flex items-center gap-3.5 font-mono text-xs tabular-nums text-fg-2 max-[900px]:col-span-2`,children:[e.awaitingDecision&&(0,P.jsx)(Ys,{}),(0,P.jsx)(Js,{status:e.status}),(0,P.jsx)(`span`,{className:`h-1 w-[90px] overflow-hidden rounded-full bg-surface-2`,title:`${e.phasesDone}${t?` / ${t}`:``} steps`,children:(0,P.jsx)(`i`,{className:N(`block h-full rounded-full`,e.status===`ok`?`bg-ok`:e.status===`failed`?`bg-bad`:`bg-accent`),style:{width:`${n}%`}})}),(0,P.jsx)(`span`,{children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),(0,P.jsx)(`span`,{children:He(e.costUsd)}),(0,P.jsx)(`span`,{children:Ge(e.startedAt)})]})]},e.id)})})}var zc=`border-line/55`;function Bc({a:e,idx:t}){return(0,P.jsxs)(`div`,{className:N(`agent-card border-r border-b px-[18px] py-3.5`,zc),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:kc(t)}}),(0,P.jsx)(`b`,{className:`text-base font-medium text-fg`,children:e.name??e.id}),(0,P.jsxs)(`code`,{className:`text-2xs text-fg-2`,children:[`[`,e.id,`]`]}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsxs)(U,{children:[e.model??`default`,e.effort?` · ${e.effort}`:``,e.protocol===`acp`?` · acp`:``]})]}),e.tools.length>0&&(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-[5px]`,children:e.tools.map(e=>(0,P.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-px font-mono text-2xs text-fg-2`,children:e},e))}),e.persona&&(0,P.jsx)(`p`,{className:`mt-2 mb-0 text-xs leading-[1.55] whitespace-pre-wrap text-fg-2`,children:e.persona})]})}function Vc({s:e,i:t,idx:n}){let r=e.kind===`script`?e.script:e.prompt;return(0,P.jsxs)(`div`,{className:N(`step-node flex gap-3.5 px-[18px] py-3 first:before:top-[18px] last:before:h-[18px] before:left-[31px]`,ic),children:[(0,P.jsx)(Ac,{colour:kc(n),children:t+1}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-base font-medium text-fg`,children:e.name}),e.kind===`agent`?(0,P.jsxs)(`span`,{className:`inline-flex h-5 items-center rounded-full border px-2 text-2xs font-semibold`,style:{color:kc(n??0),borderColor:`color-mix(in srgb, ${kc(n??0)} 50%, var(--line))`},children:[`agent · `,e.agent]}):(0,P.jsxs)(U,{children:[`script`,e.sourceRef?` · ${e.sourceRef}`:``]})]}),r&&(0,P.jsxs)(`details`,{className:`mt-1.5`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-2 select-none hover:text-accent`,children:e.kind===`agent`?`prompt`:`script`}),(0,P.jsx)(`pre`,{className:`mt-1.5 max-h-[360px] overflow-auto rounded-xl bg-surface-2 px-3 py-2.5 text-[11.5px] leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,children:r})]}),e.gates.length>0&&(0,P.jsx)(`div`,{className:`mt-[5px] flex flex-wrap gap-1.5`,children:e.gates.map(e=>(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-[5px] rounded-lg bg-surface-2 px-2.5 py-0.5 font-mono text-2xs text-fg-2`,children:[`⛨ `,e]},e))})]})]})}function Hc(e,t){let n=e.filter(e=>e.workflow===(t.name??t.slug));return{count:n.length,last:n[0]}}function Uc(e,t){return`/runs/${e.id}?workflow=${encodeURIComponent(t.name??t.slug)}`}function Wc({slug:e,tab:t}){let n=M(`workflows.list`,{}),r=M(`runs.list`,{}),[i,a]=(0,v.useState)(``),o=(0,v.useMemo)(()=>n?.workflows??[],[n]),s=r?.runs??[],c=(0,v.useMemo)(()=>{let e=i.trim().toLowerCase();return e?o.filter(t=>[t.name,t.slug,t.description].some(t=>t?.toLowerCase().includes(e))):o},[o,i]),l=(0,v.useMemo)(()=>{if(o.length!==0)return(o.map(e=>({w:e,last:Hc(s,e).last})).filter(e=>!!e.last).sort((e,t)=>(t.last.updatedAt??``).localeCompare(e.last.updatedAt??``))[0]?.w??o[0]).slug},[o,s]),u=!!r;return(0,v.useEffect)(()=>{!e&&l&&u&&z(`/workflows/${encodeURIComponent(l)}`,{replace:!0})},[e,l,u]),(0,P.jsxs)(`div`,{className:`runs-screen workflows-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`workflows`,count:n?o.length:void 0,action:(0,P.jsxs)(B,{size:`sm`,variant:`quiet`,icon:`history`,href:`/runs`,title:`every run of every workflow, newest first`,children:[`runs `,(0,P.jsx)(`span`,{className:`tabular-nums`,children:s.length})]})}),o.length>0&&(0,P.jsx)(Et,{icon:`search`,value:i,placeholder:`search workflows`,"aria-label":`search workflows`,onChange:e=>a(e.target.value)}),(0,P.jsxs)(Dt,{children:[c.map(t=>{let n=Hc(s,t);return(0,P.jsx)(J,{className:`wf-row`,href:`/workflows/${encodeURIComponent(t.slug)}`,active:t.slug===e,leading:(0,P.jsx)(H,{tone:qs(n.last?.status),title:n.last?.status??`no runs yet`}),title:t.name??t.slug,titleExtra:t.error&&(0,P.jsx)(U,{tone:`bad`,children:`broken`}),meta:n.last&&Ke(n.last.updatedAt),sub:(0,P.jsx)(`span`,{title:t.error??t.description??``,children:t.error??t.description??`${t.agents} agents · ${t.steps} steps`}),subTone:t.error?`bad`:`plain`,actionsAlways:!0,actions:n.last?(0,P.jsxs)(`button`,{type:`button`,className:`wf-runs inline-flex cursor-pointer items-center gap-1 rounded-control border-0 bg-transparent px-1.5 py-0.5 text-2xs tabular-nums text-fg-2 transition-colors hover:bg-surface-2 hover:text-fg`,title:`show the runs of this workflow`,onClick:()=>z(Uc(n.last,t)),children:[n.count,` `,n.count===1?`run`:`runs`,` · `,(0,P.jsx)(Js,{status:n.last.status})]}):(0,P.jsx)(`span`,{className:`wf-runs px-1.5 text-2xs text-fg-2 opacity-80`,children:`no runs yet`})},t.slug)}),n&&o.length>0&&c.length===0&&(0,P.jsxs)(Ot,{className:`wf-nomatch`,children:[`no workflow matches “`,i,`”`]}),n&&o.length===0&&(0,P.jsx)(Ot,{children:`no workflows yet`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:e?(0,P.jsx)(Fc,{slug:e,tab:t},e):n&&o.length===0?(0,P.jsxs)(G,{icon:`account_tree`,children:[`No workflows found — expected `,(0,P.jsx)(`code`,{children:`src/workflows/`}),` or `,(0,P.jsx)(`code`,{children:`workflows/`}),` next to the output folder.`]}):(0,P.jsx)(G,{children:`loading…`})})]})}var Gc=e=>e===`ok`?`ok`:e===`running`?`running`:e===`aborted`?`aborted`:`failed`,Kc=e=>e===`ok`?`done`:e===`running`?`working`:e===`aborted`?`stopped`:`failed`;function qc(e){return e.scope.kind===`channel`?`/channels/${e.scope.slug}`:e.scope.kind===`project`?`/projects/${e.scope.slug}/chat/${e.id}`:e.scope.kind===`agent`?`/agents/${e.scope.slug}/chat/${e.id}`:`/agents/chats/${e.id}`}function Jc(e,t,n){switch(e.scope.kind){case`agent`:{let r=e.scope.slug,i=t.find(e=>e.slug===r),a=i?`${i.emoji||`🤖`} ${i.name}`:r;return e.project?`📁 ${n(e.project)} · ${a}`:a}case`project`:return`📁 ${n(e.scope.slug)}`;case`channel`:return e.project?`📁 ${n(e.project)} · #${e.scope.slug}`:`#${e.scope.slug}`;case`run`:return`⚙️ run ${e.scope.runId}`;case`knowledge`:return e.scope.bundle?`📚 ${e.scope.bundle}`:`📚 knowledge`;default:return`🎩 Ralv`}}function Yc(e){return e.length>64?`${e.slice(0,46)}…${e.slice(-14)}`:e}function Xc(){let e=M(`runs.list`,{}),t=M(`chats.list`,{}),n=M(`knowledge.list`,{}),r=M(`agents.list`,{}),i=M(`workflows.list`,{}),a=M(`skills.list`,{}),[o,s]=(0,v.useState)(`all`),c=xe(),l=M(`projects.list`,{},{interval:3e4}),u=e=>l?.projects.find(t=>t.slug===e)?.title??e,d=e?.runs??[],f=t?.chats??[],p=n?.bundles??[],m=(a?.skills??[]).filter(e=>e.source===`workspace`),h=[[i?.workflows.length,`workflows`,`/workflows`],[e?d.length:void 0,`runs`,`/runs`],[n?p.length:void 0,`bundles`,`/knowledge`],[a?m.length:void 0,`skills`,`/skills`],[t?f.length:void 0,`chats`,`/agents/chats`]],g=d.filter(e=>e.status===`failed`&&Date.now()-Date.parse(e.updatedAt)<864e5);return(0,P.jsxs)(`div`,{className:`w-full px-7 pt-6 pb-10 max-[800px]:px-3 max-[800px]:pt-3`,children:[(0,P.jsx)(il,{runs:d,chats:f,bundles:p,agents:r?.agents??[],workflows:i?.workflows??[],projectTitle:u,loaded:!!e&&!!t}),c&&(0,P.jsx)(`div`,{className:`mx-0.5 mt-3.5 mb-3 flex flex-wrap justify-end gap-x-[18px] gap-y-1 text-xs text-fg-2 max-[800px]:justify-start max-[800px]:gap-x-3.5`,children:h.map(([e,t,n])=>(0,P.jsxs)(ge,{href:n,className:`group/mini text-inherit no-underline hover:text-accent hover:underline`,children:[(0,P.jsx)(`b`,{className:`font-semibold tabular-nums text-fg group-hover/mini:text-accent`,children:e??`…`}),` `,t]},t))}),c&&g.length>0&&o!==`failed`&&(0,P.jsxs)(`button`,{type:`button`,className:`mb-3.5 flex w-full cursor-pointer items-center gap-2 rounded-xl border border-bad/40 bg-bad-soft px-3.5 py-[9px] text-left text-[12.5px] text-on-bad-soft hover:brightness-104`,onClick:()=>s(`failed`),children:[`⚠ `,g.length,` run`,g.length===1?``:`s`,` failed in the last 24 h — review`]}),c&&(0,P.jsx)($c,{projectTitle:u,runs:d,chats:f,bundles:p,agents:r?.agents??[],workflows:i?.workflows??[],filter:o,setFilter:s})]})}function Zc(e){if(e.lamp===`running`)return`now`;let t=new Date(e.at),n=new Date;if(t.toDateString()===n.toDateString())return`today`;let r=new Date(n);return r.setDate(r.getDate()-1),t.toDateString()===r.toDateString()?`yesterday`:`earlier`}var Qc=[[`all`,`all`],[`run`,`runs`],[`session`,`chats`],[`knowledge`,`knowledge`]];function $c({projectTitle:e,runs:t,chats:n,bundles:r,agents:i,workflows:a,filter:o,setFilter:s}){let c=xe(),l=(0,v.useMemo)(()=>{let s=[],l=e=>e?a.find(t=>t.slug===e)?.name??e:void 0;for(let e of t)s.push({at:e.updatedAt,kind:`run`,emoji:`⚙️`,title:l(e.workflow)??e.id,sub:e.request??``,href:`/runs/${e.id}`,lamp:Gc(e.status),status:Kc(e.status)});for(let t of n){let n=t.scope.kind===`agent`?i.find(e=>t.scope.kind===`agent`&&e.slug===t.scope.slug):void 0;s.push({at:t.updatedAt,kind:`session`,emoji:n?n.emoji||`🤖`:`💬`,title:n?n.name:t.title||`new chat`,sub:n?`${t.title||`new chat`}${c?` · ${t.agent}`:``}`:c?`${t.agent} · ${Jc(t,i,e)}`:Jc(t,i,e),href:qc(t),lamp:t.awaitingApproval?`blocked`:t.busy?`running`:`ok`,status:t.awaitingApproval?`needs approval`:t.busy?`working`:void 0})}for(let e of r)e.updatedAt&&s.push({at:e.updatedAt,kind:`knowledge`,emoji:`📚`,title:e.name,sub:`${e.concepts} concepts`,href:`/knowledge/${encodeURIComponent(e.name)}`,lamp:`ok`});return(o===`all`?s:o===`failed`?s.filter(e=>e.kind===`run`&&e.lamp===`failed`):s.filter(e=>e.kind===o)).sort((e,t)=>{let n=Number(t.lamp===`running`)-Number(e.lamp===`running`);return n===0?t.at.localeCompare(e.at):n}).slice(0,15)},[t,n,r,i,c,o]),u=``,d=(e,t)=>N(`inline-flex cursor-pointer items-center gap-0.5 rounded-lg border px-2.5 py-0.5 text-2xs transition-colors`,e?N(`border-transparent`,t?`bg-bad-soft text-on-bad-soft`:`bg-accent-soft text-on-accent-soft`):`border-line bg-transparent text-fg-2 hover:text-fg`);return(0,P.jsx)(q,{className:`animate-rise`,title:`all activity`,actions:(0,P.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,children:[Qc.map(([e,t])=>(0,P.jsx)(`button`,{type:`button`,className:d(o===e),"aria-pressed":o===e,onClick:()=>s(e),children:t},e)),o===`failed`&&(0,P.jsxs)(`button`,{type:`button`,className:d(!0,!0),onClick:()=>s(`all`),children:[`failed `,(0,P.jsx)(F,{name:`close`,className:`ms-sm`})]})]}),children:l.length===0?(0,P.jsx)(`div`,{className:`px-[18px] py-4 text-sm text-fg-2`,children:o===`all`?`nothing yet — run a workflow or start a chat`:`nothing here for this filter`}):(0,P.jsx)(`div`,{className:`flex flex-col p-1.5`,children:l.map(e=>{let t=Zc(e),n=t===u?null:t;return u=t,(0,P.jsxs)(`div`,{children:[n&&(0,P.jsx)(tt,{className:`block px-2.5 pt-3 pb-1`,children:n}),(0,P.jsx)(J,{href:e.href,leading:(0,P.jsxs)(`span`,{className:`relative text-[18px] leading-none`,children:[(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),e.lamp===`running`&&(0,P.jsx)(`span`,{className:`absolute -right-1 -bottom-1 grid rounded-full bg-surface p-px`,children:(0,P.jsx)(H,{tone:`working`})})]}),title:Yc(e.title),titleExtra:(0,P.jsx)(`span`,{className:`max-[800px]:hidden`,children:(0,P.jsx)(U,{tone:el[e.kind],children:e.kind===`session`?`chat`:e.kind})}),sub:e.sub&&Yc(e.sub),meta:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.status&&(0,P.jsx)(U,{tone:tl[e.lamp]??`neutral`,children:e.status}),(0,P.jsx)(`span`,{title:new Date(e.at).toLocaleString(),children:Ke(e.at)}),(0,P.jsx)(F,{name:`chevron_right`,className:`ms-sm max-[800px]:hidden`})]})})]},`${e.kind}:${e.href}:${e.at}`)})})})}var el={run:`accent`,session:`ask`,knowledge:`ok`},tl={ok:`ok`,failed:`bad`,blocked:`bad`,running:`accent`,aborted:`neutral`};function nl(e){if(!e)return``;let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/6e4));return t<1?`just started`:t<60?`${t} min`:`${Math.floor(t/60)} h ${t%60} min`}var rl=e=>new Date(e).toDateString()===new Date().toDateString();function il({runs:e,chats:t,bundles:n,agents:r,workflows:i,projectTitle:a,loaded:o}){let s=It()??[],c=I(),l=M(`agents.status`,{},{interval:5e3}),u=e=>e?i.find(t=>t.slug===e)?.name??e:`workflow`,d=new Map;for(let e of Object.values(l??{}))for(let t of e.working)t.since&&d.set(t.chatId,t.since);let f=[...t.filter(e=>e.busy&&!e.awaitingApproval).map(e=>({key:`c:${e.id}`,owner:Jc(e,r,a),title:Yc(e.title||`new chat`),meta:`working${d.get(e.id)?` · ${nl(d.get(e.id))}`:``}`,href:qc(e),tone:`working`})),...e.filter(e=>e.status===`running`).map(e=>({key:`r:${e.id}`,owner:`⚙️ ${u(e.workflow)}`,title:Yc(e.request??``),meta:`running`,href:`/runs/${e.id}`,tone:`working`}))],p=[...t.filter(e=>!e.busy&&!e.awaitingApproval&&rl(e.updatedAt)&&e.title).map(e=>({key:`c:${e.id}`,at:e.updatedAt,owner:Jc(e,r,a),title:Yc(e.title),meta:Ke(e.updatedAt),href:qc(e)})),...e.filter(e=>e.status!==`running`&&rl(e.updatedAt)).map(e=>({key:`r:${e.id}`,at:e.updatedAt,owner:`⚙️ ${u(e.workflow)}`,title:Yc(e.request??``),meta:`${e.status===`ok`?`done`:e.status===`aborted`?`stopped`:`failed`} · ${Ke(e.updatedAt)}`,href:`/runs/${e.id}`})),...n.filter(e=>e.updatedAt&&rl(e.updatedAt)).map(e=>({key:`k:${e.name}`,at:e.updatedAt,owner:`📚 ${e.name}`,title:`knowledge updated`,meta:Ke(e.updatedAt),href:`/knowledge/${encodeURIComponent(e.name)}`}))].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,12),m=Ut(s,c),h=o&&s.length===0&&f.length===0;return(0,P.jsxs)(`div`,{className:`today flex flex-col gap-3.5`,children:[(0,P.jsxs)(q,{className:`today-section`,title:`needs you`,count:s.length,actions:m&&(0,P.jsxs)(B,{variant:`primary`,size:`sm`,onClick:()=>Wt(m),className:`bg-bad text-on-bad hover:bg-bad`,children:[`start `,(0,P.jsx)(F,{name:`arrow_forward`,className:`ms-sm`})]}),children:[s.length===0?(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-4 text-sm text-fg-2`,children:h?`Nothing waiting, nothing running.`:`Nothing is waiting for you.`}):(0,P.jsx)(`div`,{className:`p-1.5`,children:s.map(e=>(0,P.jsx)(J,{className:`today-row waiting`,onClick:()=>Wt(e),over:Bt(e.owner),title:e.title,meta:(0,P.jsxs)(`span`,{className:`font-semibold text-bad`,children:[zt(e.kind),` · `,Ke(e.since)]})},e.id))}),h&&(0,P.jsx)(`div`,{className:`px-[18px] pb-4`,children:(0,P.jsx)(B,{variant:`primary`,icon:`chat`,href:`/agents/chats`,children:`chat with Ralv`})})]}),f.length>0&&(0,P.jsx)(q,{className:`today-section`,title:`in progress`,children:(0,P.jsx)(`div`,{className:`p-1.5`,children:f.map(e=>(0,P.jsx)(al,{r:e},e.key))})}),(0,P.jsx)(q,{className:`today-section`,title:`done today`,children:p.length===0?(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-4 text-sm text-fg-2`,children:`Nothing finished yet today.`}):(0,P.jsx)(`div`,{className:`p-1.5`,children:p.map(e=>(0,P.jsx)(al,{r:e},e.key))})})]})}function al({r:e}){return(0,P.jsx)(J,{className:`today-row`,href:e.href,over:e.owner,title:e.title,meta:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e.tone===`working`&&(0,P.jsx)(H,{tone:`working`}),e.meta]})})}var ol=`modulepreload`,sl=function(e){return`/`+e},cl={},ll=function(e){return e.pathname.endsWith(`.css`)},ul=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=sl(t,n);let r=s(t);if(r.href in cl)return;cl[r.href]=!0;let i=ll(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:ol,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},dl=(0,v.lazy)(()=>ul(()=>import(`./editor-C6Ok8NPo.js`).then(e=>({default:e.DocEditor})),__vite__mapDeps([0,1,2,3,4,5,6]))),fl=()=>ul(()=>import(`./editor-C6Ok8NPo.js`),__vite__mapDeps([0,1,2,3,4,5,6]));function pl({bundle:e,conceptId:t}){let n=M(`knowledge.list`,{}),[r,i]=(0,v.useState)([]);(0,v.useEffect)(()=>{n&&i(e=>e.filter(e=>n.bundles.some(t=>t.name===e)))},[n]);let a=(n?.bundles??[]).filter(e=>!r.includes(e.name)),o=e===`new`,s=a.reduce((e,t)=>!e||(t.updatedAt??``)>(e.updatedAt??``)?t:e,void 0);return(0,v.useEffect)(()=>{!e&&s&&z(`/knowledge/${encodeURIComponent(s.name)}`,{replace:!0})},[e,s?.name]),(0,P.jsxs)(`div`,{className:`runs-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`bundles`,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/knowledge/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[a.map(t=>(0,P.jsx)(J,{href:`/knowledge/${encodeURIComponent(t.name)}`,active:t.name===e,size:`sm`,leading:(0,P.jsx)(H,{tone:`ok`}),title:t.name,meta:t.concepts,sub:`${t.okfVersion?`okf ${t.okfVersion}`:`okf`}${t.updatedAt?` · ${t.updatedAt.slice(0,10)}`:``}`},t.name)),n&&a.length===0&&(0,P.jsx)(Ot,{children:`no bundles yet`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:e&&!o?(0,P.jsx)(bl,{name:e,conceptId:t,onRemoved:()=>{i(t=>[...t,e]),z(`/knowledge`,{replace:!0})}},e):o||n&&!s?(0,P.jsx)(ml,{}):(0,P.jsx)(G,{children:`loading…`})})]})}function ml(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1);async function o(){let t=e.trim();if(!t)return;a(!0),r(``);let n=await A.request(`knowledge.create`,{body:{name:t}});a(!1),n.ok?z(`/knowledge/${encodeURIComponent(t)}`):r(j(n))}return(0,P.jsxs)(`div`,{className:`empty-action flex flex-col items-center gap-3 px-4 py-16`,children:[(0,P.jsxs)(`div`,{className:`flex w-full max-w-[520px] gap-2.5`,children:[(0,P.jsx)(Y,{className:`flex-1 font-mono text-sm`,value:e,placeholder:`bundle name, e.g. customer-support`,"aria-label":`bundle name`,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&void o(),autoFocus:!0}),(0,P.jsx)(B,{variant:`primary`,icon:`add`,busy:i,disabled:!e.trim(),onClick:o,children:i?`creating…`:`new bundle`})]}),n&&(0,P.jsx)(K,{tone:`bad`,children:n})]})}function hl({tier:e}){return(0,P.jsx)(U,{tone:e===`human-reviewed`?`ok`:e===`machine-confirmed`?`accent`:`neutral`,children:e})}var gl=e=>e===`deprecated`||e===`stale`?`bad`:e===`draft`?`accent`:`neutral`,_l=()=>(0,v.useContext)(he)!==null,vl=`m-0 max-h-[560px] overflow-auto px-[18px] py-3.5 font-mono text-xs leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,yl=`@activity`;function bl({name:e,conceptId:t,onRemoved:n}){let r=M(`knowledge.get`,{bundle:e}),i=_l(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``);async function l(){let t=await A.request(`knowledge.delete`,{bundle:e}).catch(()=>null);if(!t?.ok){c(t?.error??`delete failed`),o(!1);return}n?n():z(`/knowledge`,{replace:!0})}if(!r)return(0,P.jsx)(G,{children:`loading…`});if(`error`in r)return(0,P.jsx)(G,{icon:`menu_book`,children:`bundle not found`});let u=t===yl?`activity`:`pages`,d=r.concepts,f=u===`pages`?t&&d.some(e=>e.id===t)?t:d[0]?.id:void 0,p=`/knowledge/${encodeURIComponent(e)}`;return(0,P.jsxs)(`div`,{className:N(`agent-view @container flex flex-col`,i?`gap-2.5`:`gap-4`),children:[(0,P.jsxs)(`div`,{className:N(`flex flex-wrap items-center gap-x-4 gap-y-2`,i?`mb-0.5`:`mx-0.5 mt-1 mb-2`),children:[(0,P.jsx)(rt,{size:i?`md`:`lg`,children:e}),(0,P.jsxs)(`span`,{className:N(`text-fg-2`,i?`text-[12.5px]`:`text-base`),children:[d.length,` pages`]}),(0,P.jsx)(pt,{bare:!0,className:`self-end`,label:`bundle views`,value:u,items:[{id:`pages`,href:p,label:`pages`},{id:`activity`,href:`${p}/${yl}`,label:`activity`}]}),(0,P.jsx)(`span`,{className:`flex-1`}),!i&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`picture_as_pdf`,onClick:()=>void ls(e),children:`export PDF`}),a?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:()=>void l(),children:`move to trash`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>o(!1),children:`cancel`})]}):(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`delete`,onClick:()=>o(!0),title:`Move the bundle to the trash`,children:`delete`}),(0,P.jsx)(B,{variant:`primary`,onClick:()=>void Lo(`claude`,{kind:`knowledge`,bundle:e}),children:`curate in chat`})]})]}),s&&(0,P.jsx)(K,{tone:`bad`,children:s}),u===`activity`?r.log?(0,P.jsx)(Cl,{name:e,log:r.log}):(0,P.jsx)(q,{children:(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-3 text-sm text-fg-2`,children:`no activity yet`})}):d.length===0?(0,P.jsx)(q,{children:(0,P.jsxs)(`p`,{className:`m-0 px-[18px] py-3 text-sm text-fg-2`,children:[`No pages yet — start a chat to author some, or write one with`,` `,(0,P.jsxs)(`code`,{children:[`kraftwerk knowledge put `,e,`/<path>`]}),`.`]})}):(0,P.jsxs)(`div`,{className:N(`grid items-start`,i?`grid-cols-[170px_minmax(0,1fr)] gap-3.5 @max-[560px]:grid-cols-1`:`grid-cols-[260px_minmax(0,1fr)] gap-6 max-[1100px]:grid-cols-1`),children:[(0,P.jsx)(`aside`,{className:N(`flex flex-col gap-0.5 overflow-y-auto border-r border-line`,i?`sticky top-0 max-h-[calc(100vh-var(--topbar-h)-160px)] pr-2 pb-1.5 @max-[560px]:static @max-[560px]:max-h-[200px] @max-[560px]:border-r-0 @max-[560px]:pr-0`:`sticky top-[calc(var(--topbar-h)+18px)] max-h-[calc(100vh-var(--topbar-h)-36px)] py-1.5 pr-3 max-[1100px]:static max-[1100px]:max-h-none max-[1100px]:border-r-0 max-[1100px]:pr-0`),children:(0,P.jsx)(Tl,{concepts:d,base:p,selected:f})}),(0,P.jsx)(`div`,{className:`min-w-0`,children:f&&(0,P.jsx)(Dl,{bundle:e,conceptId:f},f)})]})]})}function xl(e){let t=[];for(let n of e.split(`
215
+ `).length+2)),value:l,placeholder:`You are the ... for this project. Your job is ...`,onChange:e=>u(e.target.value),spellCheck:!1}),O({system:l})]})]}),(0,P.jsx)(ct,{icon:`account_tree`,title:`workflows`,action:s!==`workflows`&&k(()=>(f(t.workflows),c(`workflows`))),children:s===`workflows`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(x?.workflows??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.slug),onChange:t=>E(e.slug,t),hint:e.description,mono:!0,children:e.slug},e.slug)),(x?.workflows??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no workflows in this project`})]}),O({workflows:d})]}):t.workflows.length===0?(0,P.jsx)(`span`,{className:ms,children:`none connected — the agent can run any workflow you connect`}):(0,P.jsx)(hs,{children:t.workflows.map(e=>(0,P.jsx)(U,{href:`/workflows/${encodeURIComponent(e)}`,children:e},e))})}),(0,P.jsx)(ct,{icon:`menu_book`,title:`knowledge`,action:s!==`knowledge`&&k(()=>(f(t.knowledge),c(`knowledge`))),children:s===`knowledge`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(S?.bundles??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.name),onChange:t=>E(e.name,t),hint:`${e.concepts} concepts`,mono:!0,children:e.name},e.name)),(S?.bundles??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no knowledge bundles in this project`})]}),O({knowledge:d})]}):t.knowledge.length===0?(0,P.jsx)(`span`,{className:ms,children:`none connected — connected bundles are read and kept current by the agent`}):(0,P.jsx)(hs,{children:t.knowledge.map(e=>(0,P.jsx)(U,{href:`/knowledge/${encodeURIComponent(e)}`,children:e},e))})}),(b.vibeables||(t.vibeables??[]).length>0)&&(0,P.jsx)(ct,{icon:`web`,title:`apps`,"data-link-kind":`vibeables`,action:s!==`vibeables`&&k(()=>(f(t.vibeables??[]),c(`vibeables`))),children:s===`vibeables`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(C?.vibeables??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.slug),onChange:t=>E(e.slug,t),hint:e.dev?`dev`:`static`,mono:!0,children:e.slug},e.slug)),d.filter(e=>!(C?.vibeables??[]).some(t=>t.slug===e)).map(e=>(0,P.jsx)(xt,{checked:!0,onChange:t=>E(e,t),hint:`not found in this workspace`,mono:!0,children:e},e)),!b.vibeables&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`vibeables are off in this workspace's settings`}),b.vibeables&&(C?.vibeables??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no apps in this workspace yet — create one on the apps page`})]}),O({vibeables:d})]}):(t.vibeables??[]).length===0?(0,P.jsx)(`span`,{className:`text-xs leading-[1.5] text-fg-2 [&_a]:text-inherit [&_code]:text-2xs`,children:`none linked — linked apps are the agent's to build and maintain; it knows them from the first message`}):(0,P.jsx)(hs,{children:(t.vibeables??[]).map(e=>{let t=!b.vibeables||!C||C.vibeables.some(t=>t.slug===e);return(0,P.jsxs)(U,{href:`/vibeables/${encodeURIComponent(e)}`,tone:t?`neutral`:`bad`,title:t?void 0:`configured but not found in this workspace`,children:[e,!t&&` · not found`]},e)})})}),(0,P.jsx)(ct,{icon:`extension`,title:`shared skills`,action:s!==`skills`&&k(()=>{m(t.skills===void 0),f(t.skills??[]),c(`skills`)}),children:s===`skills`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(gs,{children:[(0,P.jsx)(xt,{checked:p,onChange:m,hint:`every discovered skill, including future ones`,mono:!0,children:`all skills`}),!p&&(w?.skills??[]).map(e=>(0,P.jsx)(xt,{checked:d.includes(e.name),onChange:t=>E(e.name,t),hint:e.description,mono:!0,children:`/${e.name}`},e.name)),!p&&(w?.skills??[]).length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no skills found (.claude/skills, project or user)`})]}),O({skills:p?void 0:d})]}):t.skills===void 0?(0,P.jsx)(`span`,{className:ms,children:`all discovered skills (default) — invoke with /name in a session`}):t.skills.length===0?(0,P.jsx)(`span`,{className:ms,children:`none — this agent runs without skills`}):(0,P.jsx)(hs,{children:t.skills.map(e=>(0,P.jsxs)(U,{children:[`/`,e]},e))})})]}),_&&(0,P.jsx)(`div`,{className:`px-[18px] pb-3`,children:(0,P.jsx)(K,{tone:`bad`,children:_})})]}),(0,P.jsx)(js,{slug:e}),(0,P.jsx)(Ps,{slug:e})]})}var Is=[`🤖`,`🧑‍💻`,`🎧`,`🛠️`,`📊`,`✍️`,`🔍`,`🧹`,`📦`,`🚀`];function Ls({slug:e}){let[t,n]=(0,v.useState)(e?null:f()),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),s=M(`workflows.list`,{})?.workflows??[],c=M(`knowledge.list`,{})?.bundles??[],l=Te(),u=M(`vibeables.list`,l.vibeables?{}:null)?.vibeables??[],d=M(`skills.list`,{})?.skills??[];(0,v.useEffect)(()=>{e&&A.call(`agents.get`,{slug:e}).then(e=>n({name:e.name,emoji:e.emoji,description:e.description??``,harness:e.harness,model:e.model??``,effort:e.effort??``,group:e.group??``,system:e.system,workflows:e.workflows,knowledge:e.knowledge??[],vibeables:e.vibeables??[],skillsAll:e.skills===void 0,skills:e.skills??[]})).catch(()=>i(`agent not found`))},[e]);function f(){return{name:``,emoji:`🤖`,description:``,harness:`claude`,model:``,effort:``,group:``,system:``,workflows:[],knowledge:[],vibeables:[],skillsAll:!0,skills:[]}}async function p(){if(!t)return;o(!0),i(``);let n={...t,skills:t.skillsAll?void 0:t.skills},r=e?await A.request(`agents.save`,{slug:e,body:n}):await A.request(`agents.create`,{body:n});o(!1),r.ok?z(`/agents/${encodeURIComponent(r.data.slug)}/info`):i(j(r))}async function m(){e&&window.confirm(`Move agent "${e}" to the trash?`)&&(await A.request(`agents.delete`,{slug:e}).catch(()=>{}),z(`/agents`))}if(!t)return(0,P.jsx)(G,{children:r||`loading…`});let h=e=>n({...t,...e}),g=(e,n,r)=>h({[e]:r?[...t[e],n]:t[e].filter(e=>e!==n)});return(0,P.jsxs)(at,{width:`narrow`,children:[(0,P.jsx)(rt,{children:e?`edit ${e}`:`new agent`}),(0,P.jsx)(q,{children:(0,P.jsxs)(yt,{className:`max-w-[680px]`,children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`name`,className:`flex-1`,children:(0,P.jsx)(Y,{value:t.name,placeholder:`e.g. Max`,onChange:e=>h({name:e.target.value})})}),(0,P.jsx)(X,{label:`emoji`,className:`w-[90px] max-[900px]:w-auto`,children:(0,P.jsx)(Y,{value:t.emoji,onChange:e=>h({emoji:e.target.value})})})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Is.map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":t.emoji===e,className:N(`cursor-pointer rounded-xl border px-2.5 py-1.5 text-base transition-colors`,t.emoji===e?`border-transparent bg-accent-soft`:`border-line bg-transparent hover:bg-surface-2`),onClick:()=>h({emoji:e}),children:e},e))}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`description`,className:`flex-1`,children:(0,P.jsx)(Y,{value:t.description,placeholder:`one line: what this agent is for`,onChange:e=>h({description:e.target.value})})}),(0,P.jsx)(X,{label:`group`,className:`w-[180px] max-[900px]:w-auto`,children:(0,P.jsx)(Y,{value:t.group,placeholder:`none`,onChange:e=>h({group:e.target.value})})})]}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`harness`,className:`w-[140px] max-[900px]:w-auto`,children:(0,P.jsxs)(vt,{value:t.harness,onChange:e=>h({harness:e.target.value}),children:[(0,P.jsx)(`option`,{value:`claude`,children:`claude`}),(0,P.jsx)(`option`,{value:`codex`,children:`codex`}),(0,P.jsx)(`option`,{value:`pi`,children:`pi`})]})}),(0,P.jsx)(X,{label:`model`,className:`flex-1`,children:(0,P.jsx)(Y,{className:`font-mono`,value:t.model,placeholder:`harness default — e.g. sonnet, gpt-5.6-sol`,onChange:e=>h({model:e.target.value})})}),(0,P.jsx)(X,{label:`effort`,className:`w-[140px] max-[900px]:w-auto`,children:(0,P.jsx)(vt,{value:t.effort,onChange:e=>h({effort:e.target.value}),children:Je.map(e=>(0,P.jsx)(`option`,{value:e,children:e||`default`},e))})})]}),(0,P.jsx)(X,{label:`system prompt — the agent's role`,children:(0,P.jsx)(_t,{className:_s,rows:10,value:t.system,placeholder:`You are the ... for this project. Your job is ...`,onChange:e=>h({system:e.target.value})})}),(0,P.jsxs)(Rs,{label:`connected workflows — autoloaded into the agent's context; it can run them`,children:[s.map(e=>(0,P.jsx)(xt,{checked:t.workflows.includes(e.slug),onChange:t=>g(`workflows`,e.slug,t),hint:e.description,mono:!0,children:e.slug},e.slug)),s.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no workflows in this project`})]}),(0,P.jsxs)(Rs,{label:`connected knowledge — OKF bundles the agent consults and maintains`,children:[c.map(e=>(0,P.jsx)(xt,{checked:t.knowledge.includes(e.name),onChange:t=>g(`knowledge`,e.name,t),hint:`${e.concepts} concepts`,mono:!0,children:e.name},e.name)),c.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no knowledge bundles in this project`})]}),(l.vibeables||t.vibeables.length>0)&&(0,P.jsxs)(Rs,{label:`apps — small apps the agent builds and maintains`,linkKind:`vibeables`,children:[u.map(e=>(0,P.jsx)(xt,{checked:t.vibeables.includes(e.slug),onChange:t=>g(`vibeables`,e.slug,t),hint:e.dev?`dev`:`static`,mono:!0,children:e.slug},e.slug)),t.vibeables.filter(e=>!u.some(t=>t.slug===e)).map(e=>(0,P.jsx)(xt,{checked:!0,onChange:()=>g(`vibeables`,e,!1),hint:`not found in this workspace`,mono:!0,children:e},e)),!l.vibeables&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`vibeables are off in this workspace's settings`}),l.vibeables&&u.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no vibeables in this workspace yet`})]}),(0,P.jsxs)(Rs,{label:`connected skills — workspace skill packages (see the skills tab); invoked with /name in sessions`,children:[(0,P.jsx)(xt,{checked:t.skillsAll,onChange:e=>h({skillsAll:e}),hint:`every discovered skill, including future ones`,mono:!0,children:`all skills`}),!t.skillsAll&&d.map(e=>(0,P.jsx)(xt,{checked:t.skills.includes(e.name),onChange:t=>g(`skills`,e.name,t),hint:e.description,mono:!0,children:`/${e.name}`},e.name)),!t.skillsAll&&d.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-0`,children:`no skills found (.claude/skills, project or user)`})]}),r&&(0,P.jsx)(K,{tone:`bad`,children:r}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(B,{variant:`primary`,busy:a,disabled:!t.name.trim(),onClick:p,children:a?`saving…`:e?`save`:`create`}),(0,P.jsx)(`span`,{className:`flex-1`}),e&&(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:m,children:`delete agent`})]})]})})]})}function Rs({label:e,linkKind:t,children:n}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,"data-link-kind":t,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:e}),(0,P.jsx)(gs,{children:n})]})}var zs=`bg-accent/7 outline-[1.5px] -outline-offset-[1.5px] outline-accent outline-dashed`,Bs=`px-2.5 pt-1.5 pb-2 text-2xs text-fg-2`;function Vs({seg:e}){let t=e[0]&&e[0]!==`new`&&e[0]!==`chats`?decodeURIComponent(e[0]):void 0,n=e[0]===`new`?`new`:e[0]===`chats`?`chats`:e[1]===`edit`?`edit`:e[1]===`info`?`info`:e[1]===`chat`?`chat`:t?`agent`:`home`,r=n===`chats`&&e[1]===`new`,i=n===`chat`?e[2]:n===`chats`&&!r?e[1]:void 0,a=M(`agents.list`,{}),o=xe(),s=Ba(),[c,l]=(0,v.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(`kw-agent-groups`)??`[]`);return Array.isArray(e)?e.map(String):[]}catch{return[]}}),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(null),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)({}),T=(a?.agents??[]).map(e=>C[e.slug]===void 0?e:{...e,group:C[e.slug]||void 0});(0,v.useEffect)(()=>{w(e=>{let t={...e},n=!1;for(let e of a?.agents??[])t[e.slug]!==void 0&&(e.group??``)===t[e.slug]&&(delete t[e.slug],n=!0);return n?t:e})},[a]);let E=T.filter(e=>!e.archived),D=T.filter(e=>e.archived),[O,k]=(0,v.useState)(!1),ee=[...new Set([...E.map(e=>e.group??``).filter(Boolean),...c])].sort((e,t)=>e.localeCompare(t)),te=E.filter(e=>!e.group);function j(e){l(e);try{localStorage.setItem(`kw-agent-groups`,JSON.stringify(e))}catch{}}function ne(){let e=f.trim();d(!1),p(``),e&&!ee.includes(e)&&j([...c,e])}function re(e,t){h(null);let n=t.trim();if(n&&n!==e){for(let t of T.filter(t=>t.group===e))I(t.slug,n);c.includes(e)&&j([...new Set(c.map(t=>t===e?n:t))])}}async function I(e,t){if((T.find(t=>t.slug===e)?.group??``)!==t){w(n=>({...n,[e]:t}));try{let n=await A.call(`agents.get`,{slug:e});await A.call(`agents.save`,{slug:e,body:{...n,group:t||void 0}})}catch{w(t=>{let n={...t};return delete n[e],n})}}}let ie=e=>o?{onDragOver:t=>{y!=null&&(t.preventDefault(),t.dataTransfer.dropEffect=`move`,x!==e&&S(e))},onDrop:t=>{t.preventDefault();let n=t.dataTransfer.getData(`text/plain`)||y;n&&I(n,e),b(null),S(null)}}:{},ae=e=>(0,P.jsx)(`div`,{className:y===e.slug?`opacity-40`:void 0,onDragStart:t=>{if(!o)return t.preventDefault();t.dataTransfer.setData(`text/plain`,e.slug),t.dataTransfer.effectAllowed=`move`,b(e.slug)},onDragEnd:()=>{b(null),S(null)},children:(0,P.jsx)(J,{href:`/agents/${encodeURIComponent(e.slug)}`,active:e.slug===t,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),title:e.name,sub:e.description||e.harness})},e.slug),oe=e=>(0,P.jsx)(J,{href:`/agents/${encodeURIComponent(e.slug)}/info`,active:e.slug===t,dim:e.slug!==t,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),title:e.name,sub:e.description||e.harness},e.slug),se;se=n===`new`?(0,P.jsx)(Ls,{},`new`):n===`edit`&&t?(0,P.jsx)(Ls,{slug:t},t):n===`chat`&&t&&i===`new`?(0,P.jsx)(Ss,{slug:t,name:T.find(e=>e.slug===t)?.name},t):n===`chat`&&t&&i?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:i,agentName:T.find(e=>e.slug===t)?.name??t,agentDescription:T.find(e=>e.slug===t)?.description},i)}):n===`chats`?i?(0,P.jsx)(`div`,{className:`chat-main`,children:(0,P.jsx)(No,{id:i},i)}):r?(0,P.jsx)(Ro,{}):(0,P.jsx)(Cs,{}):n===`info`&&t?(0,P.jsx)(Fs,{slug:t},t):t?(0,P.jsx)(xs,{slug:t,name:T.find(e=>e.slug===t)?.name},t):a?E.length?(0,P.jsx)(Os,{agents:E}):(0,P.jsx)(ks,{}):(0,P.jsx)(G,{children:`loading…`});let ce=(n===`agent`||n===`info`||n===`chat`)&&t?T.find(e=>e.slug===t)?.knowledge??[]:[],[le,ue]=(0,v.useState)(()=>localStorage.getItem(`kw-kside`)!==`hidden`),[de,fe]=(0,v.useState)(()=>Number(localStorage.getItem(`kw-kside-w`))||460),L=ce.length>0&&le;function R(e){ue(e),localStorage.setItem(`kw-kside`,e?`open`:`hidden`)}function z(e){fe(e),localStorage.setItem(`kw-kside-w`,String(e))}return(0,P.jsxs)(`div`,{className:`runs-screen agents-screen ${t||n===`chats`?`has-tabs`:``} ${(t||n===`chats`)&&s?`has-sessions`:``} ${L?`has-knowledge`:``}`,style:L?{"--kside-w":`${de}px`}:void 0,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`agents`,action:o&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/agents/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[(0,P.jsx)(`div`,{className:`mb-1.5 border-b border-line pb-1.5`,children:(0,P.jsx)(J,{href:`/agents/chats`,active:n===`chats`,leading:(0,P.jsx)(`span`,{"aria-hidden":!0,children:`🎩`}),title:`Ralv`,sub:`chief of staff of the workspace`})}),(0,P.jsxs)(`div`,{className:N(`rounded-xl`,y&&x===``&&zs),...ie(``),children:[te.map(ae),y!=null&&te.length===0&&(0,P.jsx)(`div`,{className:Bs,children:`no group — drop here`})]}),ee.map(e=>{let t=E.filter(t=>t.group===e);return(0,P.jsxs)(`div`,{className:N(`group/grp mt-3 rounded-xl`,y&&x===e&&zs),...ie(e),children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2.5 pt-1.5 pb-0.5`,children:[m===e?(0,P.jsx)(Y,{className:`h-7 min-w-0 flex-1 text-2xs`,autoFocus:!0,"aria-label":`group name`,value:g,onChange:e=>_(e.target.value),onKeyDown:t=>{t.key===`Enter`&&re(e,g),t.key===`Escape`&&h(null)},onBlur:()=>re(e,g)}):(0,P.jsx)(tt,{children:e}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums text-fg-2`,children:t.length}),(0,P.jsx)(`span`,{className:`flex-1`}),o&&m!==e&&(0,P.jsx)(V,{icon:`edit`,label:`Rename group`,size:`sm`,className:`size-6 opacity-0 group-hover/grp:opacity-100 focus-visible:opacity-100`,onClick:()=>{h(e),_(e)}}),o&&t.length===0&&c.includes(e)&&(0,P.jsx)(V,{icon:`close`,label:`Remove empty group`,size:`sm`,className:`size-6 opacity-0 group-hover/grp:opacity-100 focus-visible:opacity-100`,onClick:()=>j(c.filter(t=>t!==e))})]}),t.map(ae),t.length===0&&(0,P.jsx)(`div`,{className:Bs,children:o?`drag agents here`:`no agents`})]},e)}),D.length>0&&(0,P.jsxs)(`div`,{className:`mt-2.5 border-t border-line pt-1`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`group/arch flex w-full cursor-pointer items-center gap-1.5 border-0 bg-transparent px-2.5 pt-1.5 pb-0.5 text-left text-fg-2`,"aria-expanded":O,onClick:()=>k(e=>!e),children:[(0,P.jsx)(tt,{className:`group-hover/arch:text-fg`,children:`archived`}),(0,P.jsx)(`span`,{className:`text-[10px] tabular-nums`,children:D.length}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(F,{name:O?`expand_less`:`expand_more`,className:`ms-sm`})]}),O&&D.map(oe)]}),a&&T.length===0&&(0,P.jsx)(W,{className:`py-1.5 px-2.5`,children:`no agents yet`}),o&&(u?(0,P.jsx)(`div`,{className:`px-2.5 pt-2.5 pb-1`,children:(0,P.jsx)(Y,{className:`h-8 text-sm`,autoFocus:!0,"aria-label":`new group`,value:f,placeholder:`group name, e.g. Team Content`,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&ne(),e.key===`Escape`&&(d(!1),p(``))},onBlur:ne})}):(0,P.jsxs)(`button`,{type:`button`,className:`mx-2.5 mt-3 mb-1 flex cursor-pointer items-center gap-1 rounded-lg border border-dashed border-line bg-transparent px-2.5 py-1 text-2xs text-fg-2 hover:text-accent`,onClick:()=>d(!0),children:[(0,P.jsx)(F,{name:`add`,className:`ms-sm`}),` group`]}))]})]}),t&&(0,P.jsx)(ws,{slug:t,chatId:i===`new`?void 0:i}),n===`chats`&&(0,P.jsx)(Ds,{chatId:i}),(0,P.jsx)(`div`,{className:`runs-main`,children:se}),L&&(0,P.jsx)(vs,{bundles:ce,onHide:()=>R(!1),onResize:z}),ce.length>0&&!le&&(0,P.jsxs)(`button`,{type:`button`,className:`kside-reopen fixed top-[60px] right-3.5 z-5 inline-flex cursor-pointer items-center gap-1 rounded-full border border-line bg-surface-2 px-3 py-1 text-2xs text-fg-2 hover:text-fg`,onClick:()=>R(!0),title:`Show knowledge sidebar`,children:[(0,P.jsx)(F,{name:`menu_book`,className:`ms-sm`}),` knowledge`]})]})}function Hs(e){if(!R(e))return null;let t=e.split(`/`).filter(Boolean),n=decodeURIComponent(t[1]),r=t[0]===`agents`||t[0]===`team`;return n===`new`?t[0]===`projects`?(0,P.jsx)(Xo,{},`new-project`):r?(0,P.jsx)(Ls,{},`new-agent`):(0,P.jsx)(ka,{},`new-channel`):t[0]===`projects`&&t[2]===`info`?(0,P.jsx)(rs,{slug:n,onChanged:async()=>{}},n):r&&t[2]===`info`?(0,P.jsx)(Fs,{slug:n},n):r&&t[2]===`edit`?(0,P.jsx)(Ls,{slug:n},n):t[0]===`channels`&&t[2]===`edit`?(0,P.jsx)(ka,{slug:n},n):null}function Us({back:e,children:t}){let n=()=>z(e);return(0,v.useEffect)(()=>{let e=e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`.palette-backdrop`)||(e.preventDefault(),n())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-40 flex animate-fade items-start justify-center bg-black/38 px-4 pt-[6vh] pb-4 max-[800px]:p-0`,onMouseDown:n,children:(0,P.jsxs)(`div`,{className:`edit-modal relative max-h-[88dvh] w-[min(960px,100%)] animate-modal overflow-y-auto rounded-card border border-line bg-surface shadow-modal max-[800px]:max-h-dvh max-[800px]:rounded-none`,role:`dialog`,"aria-label":`edit`,onMouseDown:e=>e.stopPropagation(),children:[(0,P.jsx)(V,{icon:`close`,label:`close (esc)`,className:`absolute top-3 right-3 z-1 rounded-full`,onClick:n}),(0,P.jsx)(`div`,{className:`runs-main min-w-0 pt-[18px] pr-12 pb-10 pl-6`,children:t})]})})}function Ws({runId:e,decision:t}){let{request:n,answer:r}=t,[i,a]=(0,v.useState)(n.options.length===1?n.options[0].value:null),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(null),f=e=>n.options.find(t=>t.value===e)?.label??e;if(r)return(0,P.jsx)(`section`,{className:N(Gs,`decision-panel is-decided`),"aria-label":`decision`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4`,children:[(0,P.jsx)(`div`,{className:Ks,children:n.title??`Decision`}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-base`,children:[(0,P.jsx)(U,{tone:`ok`,children:f(r.decision)}),r.note&&(0,P.jsxs)(`span`,{className:`text-fg-2`,children:[`“`,r.note,`”`]}),r.decidedAt&&(0,P.jsx)(`span`,{className:`text-xs tabular-nums text-fg-2`,children:Ge(r.decidedAt)})]})]})});let p=!!i&&!c&&(n.note!==`required`||!!o.trim());async function m(){if(!p)return;l(!0),d(null);let t=await A.request(`runs.decide`,{id:e,body:{decision:i,note:o.trim()}}).catch(()=>null);t?.ok||(d(t?.error??`could not save the decision`),l(!1))}return(0,P.jsx)(`section`,{className:N(Gs,`decision-panel`),"aria-label":`decision needed`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(H,{tone:`working`}),(0,P.jsx)(`div`,{className:Ks,children:n.title??`This run needs your decision`})]}),n.prompt&&(0,P.jsx)(`p`,{className:`m-0 max-w-[80ch] text-base text-fg-2`,children:n.prompt}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 self-start`,role:`radiogroup`,"aria-label":`options`,children:n.options.map(e=>(0,P.jsx)(B,{role:`radio`,"aria-checked":i===e.value,variant:i===e.value?`primary`:`secondary`,onClick:()=>a(e.value),children:e.label??e.value},e.value))}),n.note!==!1&&(0,P.jsx)(Y,{value:o,placeholder:n.note===`required`?`Note (required)`:`Note`,"aria-label":`note`,className:`max-w-[60ch]`,onChange:e=>s(e.target.value),onKeyDown:e=>e.key===`Enter`&&m()}),u&&(0,P.jsx)(K,{tone:`bad`,children:u}),(0,P.jsx)(`div`,{className:`flex gap-2`,children:(0,P.jsx)(B,{variant:`primary`,onClick:m,disabled:!p,busy:c,children:c?`Saving…`:`Submit decision`})})]})})}var Gs=`mb-[18px] overflow-hidden rounded-card border border-line bg-surface`,Ks=`text-[16px] font-medium text-fg`;function qs(e){return e===`ok`?`ok`:e===`running`?`working`:e===`failed`||e===`blocked`?`bad`:`idle`}function Js({status:e}){return(0,P.jsx)(`span`,{"data-ui":`status`,"data-status":e,className:`inline-flex`,children:(0,P.jsx)(U,{tone:e===`ok`?`ok`:e===`failed`||e===`blocked`?`bad`:e===`running`?`accent`:`neutral`,children:e})})}function Ys(){return(0,P.jsx)(`span`,{"data-ui":`decision`,className:`inline-flex`,children:(0,P.jsx)(U,{tone:`accent`,children:`decision needed`})})}function Xs({label:e,children:t,className:n}){return(0,P.jsxs)(`div`,{className:n,children:[(0,P.jsx)(tt,{className:`mb-px block`,children:e}),(0,P.jsx)(`div`,{className:`font-mono text-md font-medium tabular-nums text-fg`,children:t})]})}var Zs=`mb-[22px] flex flex-wrap gap-[26px]`;function Qs({id:e,workflow:t}){let n=M(`runs.list`,{},{fast:!0}),r=n?.runs??[],[i,a]=(0,v.useState)(t??``),o=(0,v.useMemo)(()=>{let e=i.trim().toLowerCase();return e?r.filter(t=>[t.workflow,t.request,t.id].some(t=>t?.toLowerCase().includes(e))):r},[r,i]);return(0,P.jsxs)(`div`,{className:`runs-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`runs`,back:{href:`/workflows`,label:`back to workflows`},count:i?`${o.length} / ${r.length}`:r.length}),(0,P.jsx)(Et,{icon:`filter_list`,value:i,placeholder:`filter by workflow or request`,"aria-label":`filter runs`,onChange:e=>a(e.target.value)}),(0,P.jsxs)(Dt,{label:`runs list`,children:[o.map(t=>(0,P.jsx)($s,{r:t,active:t.id===e},t.id)),n&&r.length===0&&(0,P.jsx)(Ot,{children:`no runs yet`}),r.length>0&&o.length===0&&(0,P.jsxs)(Ot,{children:[`no run matches “`,i,`”`]})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:(0,P.jsx)(ec,{id:e},e)})]})}function $s({r:e,active:t}){return(0,P.jsx)(J,{href:`/runs/${e.id}`,active:t,size:`sm`,leading:(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),title:e.workflow??`unknown`,meta:Ge(e.startedAt),sub:(0,P.jsxs)(`span`,{className:`flex gap-2`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:e.request,children:e.status===`running`&&e.currentPhase?`${e.currentPhase}`:e.request??``}),(0,P.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)})]})})}function ec({id:e}){let t=M(`runs.get`,{id:e},{fast:!0}),n=t?.status===`running`,[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),l=xe();if(!t)return(0,P.jsx)(G,{children:`loading…`});let u=t.files.some(e=>e.name===`runner.json`),d=r??(n?`run`:`artifacts`),f=l?t.files.length:t.files.filter(e=>!sc(e.name)).length;async function p(){o(!0),c(null);let t=await A.request(`runs.stop`,{id:e}).catch(()=>null);t?.ok||(o(!1),c(t?.error??`stop failed`))}async function m(){if(!window.confirm(`Move run ${e} to the trash?`))return;c(null);let n=await A.request(`runs.delete`,{id:e}).catch(()=>null);if(n?.ok){z(t?.workflow?`/workflows/${encodeURIComponent(t.workflow)}`:`/workflows`);return}c(n?.error??`remove failed`)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`mb-1.5 flex flex-wrap items-center gap-x-4 gap-y-2.5`,children:[(0,P.jsx)(H,{tone:qs(t.status),title:t.status}),(0,P.jsx)(rt,{size:`lg`,children:t.workflow?(0,P.jsx)(ge,{href:`/workflows/${encodeURIComponent(t.workflow)}`,title:`open workflow`,className:`text-inherit no-underline hover:text-accent`,children:t.workflow}):`unknown workflow`}),(0,P.jsx)(Js,{status:t.status}),u&&(0,P.jsxs)(U,{children:[(0,P.jsx)(F,{name:`science`,className:`ms-sm mr-1`}),` sandbox`]}),(0,P.jsx)(`span`,{className:`font-mono text-xs text-fg-2`,children:e.replace(/^run-/,``)}),n?(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`stop`,busy:a,onClick:p,children:a?`stopping…`:`stop`}):(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:m,title:`delete this run's folder`,children:`remove`}),s&&(0,P.jsx)(`span`,{className:`text-xs text-bad`,children:s}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,title:`chat with an agent about this run`,onClick:()=>void Lo(`claude`,{kind:`run`,runId:e}),children:`⌬ discuss`}),(0,P.jsx)(pt,{className:`border-b-0 px-0`,label:`run sections`,value:d,onChange:i,items:[{id:`run`,label:`run`},{id:`artifacts`,label:`artifacts`,count:f}]})]}),t.request&&(0,P.jsx)(`p`,{className:`mb-5 max-w-[90ch] text-base text-fg-2`,children:t.request}),d===`run`?(0,P.jsx)(tc,{run:t,live:n}):(0,P.jsx)(lc,{id:e,files:t.files,live:n})]})}function tc({run:e,live:t}){return(0,P.jsxs)(`div`,{className:`max-w-[1080px]`,children:[e.decision&&(0,P.jsx)(Ws,{runId:e.id,decision:e.decision}),(0,P.jsxs)(`div`,{className:Zs,children:[(0,P.jsxs)(Xs,{label:`phases`,children:[e.phasesDone,e.phasesTotal==null?``:` / ${e.phasesTotal}`]}),(0,P.jsx)(Xs,{label:`duration`,children:t?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),(0,P.jsx)(Xs,{label:`cost`,children:He(e.costUsd??rc(e.phases))}),(0,P.jsxs)(Xs,{label:`tokens in / out`,children:[Ue(nc(e.phases,`tokensIn`)),` / `,Ue(nc(e.phases,`tokensOut`))]})]}),(0,P.jsx)(q,{title:`phase timeline`,actions:t&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-[7px] text-2xs text-fg-2`,children:[(0,P.jsx)(H,{tone:`working`}),` live · polling`]}),children:(0,P.jsx)(`div`,{className:`py-1.5`,children:e.phases.map(e=>(0,P.jsx)(ac,{p:e},e.phase))})})]})}function nc(e,t){return e.reduce((e,n)=>e+(n[t]??0),0)}function rc(e){return e.reduce((e,t)=>e+(t.costUsd??0),0)}var ic=`relative border-line/55 [&+&]:border-t before:absolute before:top-0 before:bottom-0 before:w-px before:bg-line last:before:bottom-auto`;function ac({p:e}){let t=e.gates.filter(e=>!e.passed);return(0,P.jsxs)(`div`,{className:N(ic,`py-2.5 pr-[18px] pl-[42px] before:left-[23px] first:before:top-4 last:before:h-4`),children:[(0,P.jsx)(`span`,{className:`absolute top-4 left-[19px] z-1 grid`,children:(0,P.jsx)(H,{tone:qs(e.status),title:e.status})}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-base font-medium text-fg`,children:e.phase}),e.kind===`agent`?(0,P.jsxs)(U,{tone:`accent`,children:[e.agent,e.model?` · ${e.model}`:``,e.protocol?` · ${e.protocol}`:``]}):(0,P.jsx)(U,{children:`script`}),e.status===`skipped`&&(0,P.jsx)(Js,{status:`skipped`}),(0,P.jsxs)(`span`,{className:`ml-auto flex gap-3.5 font-mono text-[11.5px] tabular-nums text-fg-2`,children:[e.attempts>1&&(0,P.jsxs)(`span`,{children:[`att `,e.attempts]}),e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):e.durationMs!=null&&(0,P.jsx)(`span`,{children:Ve(e.durationMs)}),e.kind===`agent`&&e.tokensIn!=null&&(0,P.jsxs)(`span`,{children:[Ue(e.tokensIn),` / `,Ue(e.tokensOut)]}),e.costUsd!=null&&e.costUsd>0&&(0,P.jsx)(`span`,{children:He(e.costUsd)})]})]}),e.status===`running`&&e.lastActivity&&(0,P.jsxs)(`div`,{className:`mt-[3px] font-mono text-[11.5px] text-accent`,children:[`▸ `,e.lastActivity]}),e.summary&&e.status!==`running`&&(0,P.jsx)(`div`,{className:`mt-[3px] max-w-[72ch] text-[12.5px] text-fg-2`,children:e.summary}),e.gates.length>0&&(0,P.jsx)(`div`,{className:`mt-[5px] flex flex-wrap gap-1.5`,children:e.gates.map(e=>(0,P.jsxs)(`span`,{className:N(`inline-flex items-center gap-[5px] rounded-lg px-2.5 py-0.5 font-mono text-2xs`,e.passed?`bg-ok-soft text-ok`:`bg-bad-soft text-on-bad-soft`),title:e.failure??``,children:[(0,P.jsx)(F,{name:e.passed?`check`:`close`,className:`ms-sm`}),` `,e.gate]},e.gate))}),t.map(e=>(0,P.jsx)(`div`,{className:`mt-1 text-xs text-bad`,children:e.failure},e.gate))]})}var oc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`]);function sc(e){return e===`runner.json`||e.endsWith(`.jsonl`)||e.endsWith(`.log`)}function cc(e){let t=[`report.html`,`recommendation.md`].find(t=>e.some(e=>e.name===t));if(t)return t;let n=e=>{let t=e.split(`.`).pop()?.toLowerCase()??``;return[`html`,`md`,`markdown`,`pdf`].includes(t)||oc.has(t)?0:sc(e)?2:1},r=null;for(let t of e)(!r||n(t.name)<n(r.name))&&(r=t);return r?.name??null}function lc({id:e,files:t,live:n}){let[r,i]=(0,v.useState)(null),a=xe(),o=(0,v.useMemo)(()=>a?t:t.filter(e=>!sc(e.name)),[t,a]);return(0,v.useEffect)(()=>{!a&&r&&sc(r)&&i(null)},[a,r]),(0,v.useEffect)(()=>{r||o.length===0||i(cc(o))},[o,r]),(0,P.jsxs)(`div`,{className:`grid h-[calc(100vh-172px)] min-h-[420px] grid-cols-[280px_minmax(0,1fr)] gap-3.5 max-[940px]:h-auto max-[940px]:grid-cols-1`,children:[(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`files `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,o.length,`)`]})]}),className:`flex min-h-0 flex-col`,children:(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto max-[940px]:max-h-60`,children:[o.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:N(`flex w-full cursor-pointer items-center gap-2.5 border-0 border-b border-line/55 px-[18px] py-2 text-left font-mono text-[12.5px] transition-colors last:border-b-0`,r===e.name?`bg-accent-soft text-on-accent-soft`:`bg-transparent text-fg-2 hover:bg-surface-2 hover:text-fg`),onClick:()=>i(e.name),children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-2xs tabular-nums text-fg-2`,children:We(e.size)})]},e.name)),o.length===0&&(0,P.jsx)(W,{className:`px-[18px] py-3`,children:t.length>0?`no result files — raw run files live in expert mode`:`no files yet`})]})}),(0,P.jsx)(q,{title:r??`viewer`,className:`flex min-h-0 flex-col`,actions:r&&(0,P.jsx)(`a`,{className:uc,href:A.url(`runs.file`,{id:e,query:{name:r,raw:!0}}),target:`_blank`,children:`open raw ↗`}),children:r?(0,P.jsx)(hc,{id:e,name:r,live:n}):(0,P.jsx)(G,{className:`flex-1 justify-center`,children:`select a file`})})]})}var uc=`inline-flex h-7 items-center rounded-control px-2.5 text-sm font-medium text-fg-2 no-underline transition-colors hover:bg-surface-2 hover:text-fg`,dc=`flex min-h-0 flex-1 flex-col`,fc=`min-h-0 flex-1`,pc=`m-0 h-full overflow-auto px-[18px] py-3.5 text-xs leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,mc=`block h-full min-h-[560px] w-full border-0 bg-white`;function hc({id:e,name:t,live:n}){let r=t.split(`.`).pop()?.toLowerCase()??``,i=A.url(`runs.file`,{id:e,query:{name:t,raw:!0}});return r===`html`?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`iframe`,{className:mc,src:i,sandbox:`allow-scripts`,allow:`clipboard-write`,title:t})})}):r===`pdf`?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`iframe`,{className:mc,src:i,title:t})})}):oc.has(r)?(0,P.jsx)(`div`,{className:dc,children:(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`img`,{className:`block max-h-full max-w-full object-contain px-[18px] py-3.5`,src:i,alt:t})})}):r===`md`||r===`markdown`?(0,P.jsx)(_c,{id:e,name:t,live:n}):(0,P.jsx)(vc,{id:e,name:t,live:n})}var gc=`flex items-center gap-3 border-b border-line/55 px-[18px] py-1.5 text-2xs text-fg-2`;function _c({id:e,name:t,live:n}){let[r,i]=(0,v.useState)(`rendered`),a=M(`runs.fileText`,{id:e,query:{name:t}},{fast:n}),o=(0,v.useMemo)(()=>a?pa.sanitize(Q.parse(a.content,{async:!1})):``,[a?.content]);return(0,P.jsxs)(`div`,{className:dc,children:[(0,P.jsxs)(`div`,{className:gc,children:[(0,P.jsx)(pt,{className:`border-b-0 px-0`,label:`markdown view`,value:r,onChange:i,items:[{id:`rendered`,label:`rendered`},{id:`source`,label:`source`}]}),a?.truncated&&(0,P.jsxs)(`span`,{children:[`large file — showing the last `,We(4e5)]})]}),(0,P.jsx)(`div`,{className:N(fc,`overflow-auto`),children:a?r===`rendered`?(0,P.jsx)(`div`,{className:`md-body`,dangerouslySetInnerHTML:{__html:o}}):(0,P.jsx)(`pre`,{className:pc,children:a.content||`(empty)`}):(0,P.jsx)(`pre`,{className:pc,children:`loading…`})})]})}function vc({id:e,name:t,live:n}){let r=M(`runs.fileText`,{id:e,query:{name:t}},{fast:n});return(0,P.jsxs)(`div`,{className:dc,children:[r?.truncated&&(0,P.jsxs)(`div`,{className:gc,children:[`large file — showing the last `,We(4e5)]}),(0,P.jsx)(`div`,{className:fc,children:(0,P.jsx)(`pre`,{className:pc,children:r?r.content||`(empty)`:`loading…`})})]})}function yc(){return M(`workflows.runner`,{slug:`any`},{interval:15e3})}var bc=e=>!!e?.available&&!!e?.image;function xc(e){return e?e.available?e.image?`isolated container per run`:"image missing — run `kraftwerk runner build`":`Docker is not running`:``}async function Sc(e,t){return(await A.call(`workflows.run`,{slug:e,body:t})).runId}function Cc(e,t,n,r){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!0),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),m=yc();(0,v.useEffect)(()=>{!i&&n&&a(n)},[n]),(0,v.useEffect)(()=>{m&&!bc(m)&&s(!1)},[m]);let h=!u&&(!t||!!i.trim())&&(!o||bc(m));async function g(){if(h){d(!0),p(null);try{let t=await Sc(e,{request:i.trim(),sandbox:o,ssh:c});r?(r(t),d(!1)):z(`/runs/${t}`)}catch(e){p(e.message),d(!1)}}}return{request:i,setRequest:a,sandbox:o,setSandbox:s,ssh:c,setSsh:l,busy:u,error:f,docker:m,canRun:h,launch:g}}function wc({slug:e,usesRequest:t,initialRequest:n,onLaunched:r}){let i=Cc(e,t,n,r);return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 px-5 pt-4 pb-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-4 max-[700px]:flex-wrap`,children:[t?(0,P.jsx)(Y,{className:`h-11 min-w-0 flex-1 text-md`,value:i.request,placeholder:`Request`,"aria-label":`request`,onChange:e=>i.setRequest(e.target.value),onKeyDown:e=>e.key===`Enter`&&i.launch()}):(0,P.jsx)(`span`,{className:`flex-1 text-base text-fg-2`,children:`This workflow takes no request.`}),(0,P.jsx)(B,{variant:`primary`,icon:`play_arrow`,className:`h-11 px-5 max-[700px]:w-full`,busy:i.busy,onClick:i.launch,disabled:!i.canRun,children:i.busy?`Starting…`:`Run`})]}),(0,P.jsxs)(`div`,{className:`-mx-2 mt-1 flex flex-wrap gap-x-2`,children:[(0,P.jsx)(wt,{label:`Docker sandbox`,hint:xc(i.docker),checked:i.sandbox,onChange:i.setSandbox}),i.sandbox&&(0,P.jsx)(wt,{label:`Forward SSH agent`,hint:`keys and known hosts from this machine`,checked:i.ssh,onChange:i.setSsh})]}),i.error&&(0,P.jsx)(K,{tone:`bad`,children:i.error})]})}var Tc=`\0done`,Ec=5;function Dc(e,t){return e.status===`ok`?Tc:e.currentPhase&&t.includes(e.currentPhase)?e.currentPhase:t[0]??Tc}var Oc=[`var(--accent)`,`#4fb8a8`,`#a78bfa`,`#e5793b`];function kc(e){return e==null?`var(--text-2)`:Oc[e%Oc.length]}function Ac({colour:e,children:t,small:n}){return(0,P.jsx)(`span`,{style:{"--aid":e},className:N(`relative z-1 grid flex-none place-items-center rounded-full border font-mono font-bold tabular-nums`,`border-[color-mix(in_srgb,var(--aid)_55%,var(--line))] bg-[color-mix(in_srgb,var(--aid)_18%,var(--surface-1))] text-[var(--aid)]`,n?`size-[22px] text-2xs`:`mt-px size-[26px] text-[11.5px]`),children:t})}function jc({wf:e,runs:t,agentIdx:n,runsHref:r}){let i=e.steps.map(e=>e.name),a=new Map([...i,Tc].map(e=>[e,[]]));for(let e of t)a.get(Dc(e,i)).push(e);let o=a.get(Tc)??[];return(0,P.jsxs)(`div`,{className:`board flex items-start gap-3 overflow-x-auto px-[18px] pt-3.5 pb-[18px]`,children:[e.steps.map((e,t)=>{let i=a.get(e.name)??[];return(0,P.jsx)(Mc,{step:e.name,index:(0,P.jsx)(Ac,{small:!0,colour:kc(e.agent?n.get(e.agent)??0:null),children:t+1}),count:i.length,children:(0,P.jsx)(Nc,{cards:i,moreHref:r})},e.name)}),(0,P.jsx)(Mc,{step:`done`,name:`done`,done:!0,index:(0,P.jsx)(Ac,{small:!0,colour:`var(--ok)`,children:`✓`}),count:o.length,children:(0,P.jsx)(Nc,{cards:o,moreHref:r})})]})}function Mc({step:e,name:t,done:n,index:r,count:i,children:a}){return(0,P.jsxs)(`div`,{className:N(`board-col flex min-w-60 flex-[0_0_240px] flex-col gap-1.5`,n&&`is-done`),"data-step":e,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-0.5 pt-0.5 pb-1`,children:[r,(0,P.jsx)(`span`,{className:`board-col-name min-w-0 truncate text-[13.5px] font-medium text-fg`,title:t??e,children:t??e}),(0,P.jsx)(`span`,{className:`board-col-count ml-auto font-mono text-[11.5px] tabular-nums text-fg-2`,children:i})]}),a]})}function Nc({cards:e,moreHref:t}){return(0,P.jsxs)(`div`,{className:`flex min-h-14 flex-col gap-2 rounded-xl bg-surface-2/60 p-2`,children:[e.slice(0,Ec).map(e=>(0,P.jsx)(Pc,{r:e},e.id)),e.length===0&&(0,P.jsx)(`div`,{className:`board-col-empty py-3.5 text-center text-xs text-fg-2`,children:`—`}),e.length>Ec&&(0,P.jsxs)(ge,{href:t,className:`board-more block p-1.5 text-center text-xs text-fg-2 no-underline hover:text-accent`,children:[`+ `,e.length-Ec,` more ↗`]})]})}function Pc({r:e}){let t=e.request??e.id.replace(/^run-/,``);return(0,P.jsxs)(ge,{href:`/runs/${e.id}`,className:`board-card block rounded-xl border border-line bg-surface px-3 py-2.5 text-inherit no-underline transition-colors hover:bg-surface-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-[13.5px] font-medium text-fg`,title:t,children:t})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap gap-2.5 font-mono text-[11.5px] tabular-nums text-fg-2`,children:[(0,P.jsx)(`span`,{children:Ge(e.startedAt)}),(0,P.jsx)(`span`,{children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),e.costUsd!=null&&e.costUsd>0&&(0,P.jsx)(`span`,{children:He(e.costUsd)})]}),(e.awaitingDecision||e.status===`failed`||e.status===`aborted`)&&(0,P.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.awaitingDecision&&(0,P.jsx)(Ys,{}),(e.status===`failed`||e.status===`aborted`)&&(0,P.jsx)(Js,{status:e.status})]})]})}function Fc({slug:e,tab:t}){let n=M(`workflows.get`,{slug:e}),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(0),s=M(`runs.list`,{},{fast:a>0||Date.now()-r<2e4});if(!n)return(0,P.jsx)(G,{children:`loading…`});if(n.error)return(0,P.jsxs)(G,{children:[(0,P.jsx)(U,{tone:`bad`,children:`broken workflow`}),(0,P.jsx)(`pre`,{className:`mt-3 text-left`,children:n.error}),(0,P.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,P.jsx)(Lc,{slug:n.slug})})]});let c=new Map(n.agents.map((e,t)=>[e.id,t%4])),l=(s?.runs??[]).filter(e=>e.workflow===n.name||e.workflow===n.slug),u=`/workflows/${encodeURIComponent(n.slug)}`,d=l.filter(e=>e.status===`running`).length;return d!==a&&o(d),(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`mb-1.5 flex flex-wrap items-center gap-x-4 gap-y-2.5 in-[.ctx-embed]:mb-3 in-[.ctx-embed]:gap-y-2`,children:[(0,P.jsx)(rt,{size:`lg`,className:`in-[.ctx-embed]:text-xl`,children:n.name??n.slug}),(0,P.jsx)(`span`,{className:`min-w-0 font-mono text-xs [overflow-wrap:anywhere] text-fg-2 in-[.ctx-embed]:hidden`,children:n.dir}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(pt,{bare:!0,label:`workflow sections`,value:t,items:[{id:`overview`,href:u,label:`overview`},{id:`details`,href:`${u}/details`,label:`details`},{id:`runs`,href:`${u}/runs`,label:(0,P.jsxs)(P.Fragment,{children:[`runs `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,l.length,`)`]})]})}]})]}),n.description&&(0,P.jsx)(`p`,{className:`mb-5 max-w-[90ch] text-base text-fg-2`,children:n.description}),t===`overview`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(q,{className:`run-panel mb-[18px]`,children:(0,P.jsx)(wc,{slug:n.slug,usesRequest:n.usesRequest,initialRequest:l[0]?.request,onLaunched:()=>i(Date.now())})}),(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`board`,` `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,l.length,` runs`,d>0?`, ${d} live`:``,`)`]})]}),actions:l[0]&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,href:`${u}/runs`,className:`in-[.ctx-embed]:hidden`,children:`all runs ↗`}),children:(0,P.jsx)(jc,{wf:n,runs:l,agentIdx:c,runsHref:`${u}/runs`})})]}),t===`details`&&(0,P.jsx)(Ic,{wf:n,agentIdx:c}),t===`runs`&&(0,P.jsx)(Rc,{runs:l})]})}function Ic({wf:e,agentIdx:t}){return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:Zs,children:[(0,P.jsx)(Xs,{label:`agents`,children:e.agents.length}),(0,P.jsxs)(Xs,{label:`steps`,children:[e.steps.length,` `,(0,P.jsxs)(`span`,{className:`font-normal text-fg-2`,children:[`(`,e.steps.filter(e=>e.kind===`agent`).length,` agent · `,e.steps.filter(e=>e.kind===`script`).length,` script)`]})]}),e.workspace&&(0,P.jsx)(Xs,{label:`workspace`,className:`max-w-[420px]`,children:(0,P.jsx)(`span`,{className:`text-[11.5px] font-normal whitespace-pre-wrap text-fg-2`,children:e.workspace})})]}),(0,P.jsx)(q,{title:`agents`,className:`mb-[18px]`,children:(0,P.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))]`,children:[e.agents.map(e=>(0,P.jsx)(Bc,{a:e,idx:t.get(e.id)??0},e.id)),e.agents.length===0&&(0,P.jsx)(W,{className:`px-[18px] py-3`,children:`no agents — script-only workflow`})]})}),(0,P.jsxs)(`div`,{className:`grid items-start gap-[18px] grid-cols-[minmax(430px,5fr)_minmax(360px,4fr)] max-[1100px]:grid-cols-1 in-[.ctx-embed]:grid-cols-1`,children:[(0,P.jsx)(q,{title:`pipeline`,children:(0,P.jsx)(`div`,{className:`pipeline py-2`,children:e.steps.map((e,n)=>(0,P.jsx)(Vc,{s:e,i:n,idx:e.agent?t.get(e.agent)??0:null},e.name))})}),(0,P.jsx)(q,{title:(0,P.jsxs)(P.Fragment,{children:[`folder `,(0,P.jsxs)(`span`,{className:`tabular-nums`,children:[`(`,e.files.length,` files)`]})]}),children:(0,P.jsx)(`div`,{className:`max-h-[300px] overflow-auto`,children:e.files.map(e=>(0,P.jsx)(`div`,{className:`truncate border-b border-line/55 px-[18px] py-2 font-mono text-[12.5px] text-fg-2 last:border-b-0`,children:e},e))})})]}),(0,P.jsx)(`div`,{className:`mt-[18px] in-[.ctx-embed]:hidden`,children:(0,P.jsx)(Lc,{slug:e.slug})})]})}function Lc({slug:e}){let[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(``),s=async()=>{i(!0),o(``);try{let t=await A.request(`workflows.delete`,{slug:e});if(!t.ok)throw Error(t.error||`failed`);z(`/workflows`,{replace:!0})}catch(e){o(e.message),n(!1)}finally{i(!1)}};return(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:t?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`danger`,icon:`delete`,busy:r,onClick:()=>void s(),children:`confirm delete`}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>n(!1),children:`cancel`}),(0,P.jsx)(W,{children:`its runs stay; the trash can put it back`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete`,onClick:()=>n(!0),title:`Move the workflow's folder to the trash`,children:`delete workflow`})}),a&&(0,P.jsx)(K,{tone:`bad`,children:a})]})}function Rc({runs:e}){return e.length===0?(0,P.jsx)(G,{children:`no runs of this workflow yet`}):(0,P.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>{let t=e.phasesTotal??0,n=t>0?Math.round(e.phasesDone/t*100):e.status===`ok`?100:0;return(0,P.jsxs)(ge,{href:`/runs/${e.id}`,className:`run-card grid grid-cols-[12px_200px_1fr_auto] items-center gap-x-4 gap-y-2 rounded-card border border-line bg-surface px-5 py-3.5 text-inherit no-underline transition-colors hover:bg-surface-2 max-[900px]:grid-cols-[12px_1fr]`,children:[(0,P.jsx)(H,{tone:qs(e.status),title:e.status}),(0,P.jsx)(`span`,{className:`font-mono text-[12.5px] text-fg-2`,children:e.id.replace(/^run-/,``)}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-fg`,title:e.request,children:e.status===`running`&&e.currentPhase?e.currentPhase:e.request??``}),(0,P.jsxs)(`span`,{className:`flex items-center gap-3.5 font-mono text-xs tabular-nums text-fg-2 max-[900px]:col-span-2`,children:[e.awaitingDecision&&(0,P.jsx)(Ys,{}),(0,P.jsx)(Js,{status:e.status}),(0,P.jsx)(`span`,{className:`h-1 w-[90px] overflow-hidden rounded-full bg-surface-2`,title:`${e.phasesDone}${t?` / ${t}`:``} steps`,children:(0,P.jsx)(`i`,{className:N(`block h-full rounded-full`,e.status===`ok`?`bg-ok`:e.status===`failed`?`bg-bad`:`bg-accent`),style:{width:`${n}%`}})}),(0,P.jsx)(`span`,{children:e.status===`running`?(0,P.jsx)(qe,{since:e.startedAt}):Ve(e.durationMs)}),(0,P.jsx)(`span`,{children:He(e.costUsd)}),(0,P.jsx)(`span`,{children:Ge(e.startedAt)})]})]},e.id)})})}var zc=`border-line/55`;function Bc({a:e,idx:t}){return(0,P.jsxs)(`div`,{className:N(`agent-card border-r border-b px-[18px] py-3.5`,zc),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`size-2.5 rounded-full`,style:{background:kc(t)}}),(0,P.jsx)(`b`,{className:`text-base font-medium text-fg`,children:e.name??e.id}),(0,P.jsxs)(`code`,{className:`text-2xs text-fg-2`,children:[`[`,e.id,`]`]}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsxs)(U,{children:[e.model??`default`,e.effort?` · ${e.effort}`:``,e.protocol===`acp`?` · acp`:``]})]}),e.tools.length>0&&(0,P.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-[5px]`,children:e.tools.map(e=>(0,P.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-px font-mono text-2xs text-fg-2`,children:e},e))}),e.persona&&(0,P.jsx)(`p`,{className:`mt-2 mb-0 text-xs leading-[1.55] whitespace-pre-wrap text-fg-2`,children:e.persona})]})}function Vc({s:e,i:t,idx:n}){let r=e.kind===`script`?e.script:e.prompt;return(0,P.jsxs)(`div`,{className:N(`step-node flex gap-3.5 px-[18px] py-3 first:before:top-[18px] last:before:h-[18px] before:left-[31px]`,ic),children:[(0,P.jsx)(Ac,{colour:kc(n),children:t+1}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-base font-medium text-fg`,children:e.name}),e.kind===`agent`?(0,P.jsxs)(`span`,{className:`inline-flex h-5 items-center rounded-full border px-2 text-2xs font-semibold`,style:{color:kc(n??0),borderColor:`color-mix(in srgb, ${kc(n??0)} 50%, var(--line))`},children:[`agent · `,e.agent]}):(0,P.jsxs)(U,{children:[`script`,e.sourceRef?` · ${e.sourceRef}`:``]})]}),r&&(0,P.jsxs)(`details`,{className:`mt-1.5`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-2 select-none hover:text-accent`,children:e.kind===`agent`?`prompt`:`script`}),(0,P.jsx)(`pre`,{className:`mt-1.5 max-h-[360px] overflow-auto rounded-xl bg-surface-2 px-3 py-2.5 text-[11.5px] leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,children:r})]}),e.gates.length>0&&(0,P.jsx)(`div`,{className:`mt-[5px] flex flex-wrap gap-1.5`,children:e.gates.map(e=>(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-[5px] rounded-lg bg-surface-2 px-2.5 py-0.5 font-mono text-2xs text-fg-2`,children:[`⛨ `,e]},e))})]})]})}function Hc(e,t){let n=e.filter(e=>e.workflow===(t.name??t.slug));return{count:n.length,last:n[0]}}function Uc(e,t){return`/runs/${e.id}?workflow=${encodeURIComponent(t.name??t.slug)}`}function Wc({slug:e,tab:t}){let n=M(`workflows.list`,{}),r=M(`runs.list`,{}),[i,a]=(0,v.useState)(``),o=(0,v.useMemo)(()=>n?.workflows??[],[n]),s=r?.runs??[],c=(0,v.useMemo)(()=>{let e=i.trim().toLowerCase();return e?o.filter(t=>[t.name,t.slug,t.description].some(t=>t?.toLowerCase().includes(e))):o},[o,i]),l=(0,v.useMemo)(()=>{if(o.length!==0)return(o.map(e=>({w:e,last:Hc(s,e).last})).filter(e=>!!e.last).sort((e,t)=>(t.last.updatedAt??``).localeCompare(e.last.updatedAt??``))[0]?.w??o[0]).slug},[o,s]),u=!!r;return(0,v.useEffect)(()=>{!e&&l&&u&&z(`/workflows/${encodeURIComponent(l)}`,{replace:!0})},[e,l,u]),(0,P.jsxs)(`div`,{className:`runs-screen workflows-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`workflows`,count:n?o.length:void 0,action:(0,P.jsxs)(B,{size:`sm`,variant:`quiet`,icon:`history`,href:`/runs`,title:`every run of every workflow, newest first`,children:[`runs `,(0,P.jsx)(`span`,{className:`tabular-nums`,children:s.length})]})}),o.length>0&&(0,P.jsx)(Et,{icon:`search`,value:i,placeholder:`search workflows`,"aria-label":`search workflows`,onChange:e=>a(e.target.value)}),(0,P.jsxs)(Dt,{children:[c.map(t=>{let n=Hc(s,t);return(0,P.jsx)(J,{className:`wf-row`,href:`/workflows/${encodeURIComponent(t.slug)}`,active:t.slug===e,leading:(0,P.jsx)(H,{tone:qs(n.last?.status),title:n.last?.status??`no runs yet`}),title:t.name??t.slug,titleExtra:t.error&&(0,P.jsx)(U,{tone:`bad`,children:`broken`}),meta:n.last&&Ke(n.last.updatedAt),sub:(0,P.jsx)(`span`,{title:t.error??t.description??``,children:t.error??t.description??`${t.agents} agents · ${t.steps} steps`}),subTone:t.error?`bad`:`plain`,actionsAlways:!0,actions:n.last?(0,P.jsxs)(`button`,{type:`button`,className:`wf-runs inline-flex cursor-pointer items-center gap-1 rounded-control border-0 bg-transparent px-1.5 py-0.5 text-2xs tabular-nums text-fg-2 transition-colors hover:bg-surface-2 hover:text-fg`,title:`show the runs of this workflow`,onClick:()=>z(Uc(n.last,t)),children:[n.count,` `,n.count===1?`run`:`runs`,` · `,(0,P.jsx)(Js,{status:n.last.status})]}):(0,P.jsx)(`span`,{className:`wf-runs px-1.5 text-2xs text-fg-2 opacity-80`,children:`no runs yet`})},t.slug)}),n&&o.length>0&&c.length===0&&(0,P.jsxs)(Ot,{className:`wf-nomatch`,children:[`no workflow matches “`,i,`”`]}),n&&o.length===0&&(0,P.jsx)(Ot,{children:`no workflows yet`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:e?(0,P.jsx)(Fc,{slug:e,tab:t},e):n&&o.length===0?(0,P.jsxs)(G,{icon:`account_tree`,children:[`No workflows found — expected `,(0,P.jsx)(`code`,{children:`src/workflows/`}),` or `,(0,P.jsx)(`code`,{children:`workflows/`}),` next to the output folder.`]}):(0,P.jsx)(G,{children:`loading…`})})]})}var Gc=e=>e===`ok`?`ok`:e===`running`?`running`:e===`aborted`?`aborted`:`failed`,Kc=e=>e===`ok`?`done`:e===`running`?`working`:e===`aborted`?`stopped`:`failed`;function qc(e){return e.scope.kind===`channel`?`/channels/${e.scope.slug}`:e.scope.kind===`project`?`/projects/${e.scope.slug}/chat/${e.id}`:e.scope.kind===`agent`?`/agents/${e.scope.slug}/chat/${e.id}`:`/agents/chats/${e.id}`}function Jc(e,t,n){switch(e.scope.kind){case`agent`:{let r=e.scope.slug,i=t.find(e=>e.slug===r),a=i?`${i.emoji||`🤖`} ${i.name}`:r;return e.project?`📁 ${n(e.project)} · ${a}`:a}case`project`:return`📁 ${n(e.scope.slug)}`;case`channel`:return e.project?`📁 ${n(e.project)} · #${e.scope.slug}`:`#${e.scope.slug}`;case`run`:return`⚙️ run ${e.scope.runId}`;case`knowledge`:return e.scope.bundle?`📚 ${e.scope.bundle}`:`📚 knowledge`;default:return`🎩 Ralv`}}function Yc(e){return e.length>64?`${e.slice(0,46)}…${e.slice(-14)}`:e}function Xc(){let e=M(`runs.list`,{}),t=M(`chats.list`,{}),n=M(`knowledge.list`,{}),r=M(`agents.list`,{}),i=M(`workflows.list`,{}),a=M(`skills.list`,{}),[o,s]=(0,v.useState)(`all`),c=xe(),l=M(`projects.list`,{},{interval:3e4}),u=e=>l?.projects.find(t=>t.slug===e)?.title??e,d=e?.runs??[],f=t?.chats??[],p=n?.bundles??[],m=(a?.skills??[]).filter(e=>e.source===`workspace`),h=[[i?.workflows.length,`workflows`,`/workflows`],[e?d.length:void 0,`runs`,`/runs`],[n?p.length:void 0,`bundles`,`/knowledge`],[a?m.length:void 0,`skills`,`/skills`],[t?f.length:void 0,`chats`,`/agents/chats`]],g=d.filter(e=>e.status===`failed`&&Date.now()-Date.parse(e.updatedAt)<864e5);return(0,P.jsxs)(`div`,{className:`w-full px-7 pt-6 pb-10 max-[800px]:px-3 max-[800px]:pt-3`,children:[(0,P.jsx)(il,{runs:d,chats:f,bundles:p,agents:r?.agents??[],workflows:i?.workflows??[],projectTitle:u,loaded:!!e&&!!t}),c&&(0,P.jsx)(`div`,{className:`mx-0.5 mt-3.5 mb-3 flex flex-wrap justify-end gap-x-[18px] gap-y-1 text-xs text-fg-2 max-[800px]:justify-start max-[800px]:gap-x-3.5`,children:h.map(([e,t,n])=>(0,P.jsxs)(ge,{href:n,className:`group/mini text-inherit no-underline hover:text-accent hover:underline`,children:[(0,P.jsx)(`b`,{className:`font-semibold tabular-nums text-fg group-hover/mini:text-accent`,children:e??`…`}),` `,t]},t))}),c&&g.length>0&&o!==`failed`&&(0,P.jsxs)(`button`,{type:`button`,className:`mb-3.5 flex w-full cursor-pointer items-center gap-2 rounded-xl border border-bad/40 bg-bad-soft px-3.5 py-[9px] text-left text-[12.5px] text-on-bad-soft hover:brightness-104`,onClick:()=>s(`failed`),children:[`⚠ `,g.length,` run`,g.length===1?``:`s`,` failed in the last 24 h — review`]}),c&&(0,P.jsx)($c,{projectTitle:u,runs:d,chats:f,bundles:p,agents:r?.agents??[],workflows:i?.workflows??[],filter:o,setFilter:s})]})}function Zc(e){if(e.lamp===`running`)return`now`;let t=new Date(e.at),n=new Date;if(t.toDateString()===n.toDateString())return`today`;let r=new Date(n);return r.setDate(r.getDate()-1),t.toDateString()===r.toDateString()?`yesterday`:`earlier`}var Qc=[[`all`,`all`],[`run`,`runs`],[`session`,`chats`],[`knowledge`,`knowledge`]];function $c({projectTitle:e,runs:t,chats:n,bundles:r,agents:i,workflows:a,filter:o,setFilter:s}){let c=xe(),l=(0,v.useMemo)(()=>{let s=[],l=e=>e?a.find(t=>t.slug===e)?.name??e:void 0;for(let e of t)s.push({at:e.updatedAt,kind:`run`,emoji:`⚙️`,title:l(e.workflow)??e.id,sub:e.request??``,href:`/runs/${e.id}`,lamp:Gc(e.status),status:Kc(e.status)});for(let t of n){let n=t.scope.kind===`agent`?i.find(e=>t.scope.kind===`agent`&&e.slug===t.scope.slug):void 0;s.push({at:t.updatedAt,kind:`session`,emoji:n?n.emoji||`🤖`:`💬`,title:n?n.name:t.title||`new chat`,sub:n?`${t.title||`new chat`}${c?` · ${t.agent}`:``}`:c?`${t.agent} · ${Jc(t,i,e)}`:Jc(t,i,e),href:qc(t),lamp:t.awaitingApproval?`blocked`:t.busy?`running`:`ok`,status:t.awaitingApproval?`needs approval`:t.busy?`working`:void 0})}for(let e of r)e.updatedAt&&s.push({at:e.updatedAt,kind:`knowledge`,emoji:`📚`,title:e.name,sub:`${e.concepts} concepts`,href:`/knowledge/${encodeURIComponent(e.name)}`,lamp:`ok`});return(o===`all`?s:o===`failed`?s.filter(e=>e.kind===`run`&&e.lamp===`failed`):s.filter(e=>e.kind===o)).sort((e,t)=>{let n=Number(t.lamp===`running`)-Number(e.lamp===`running`);return n===0?t.at.localeCompare(e.at):n}).slice(0,15)},[t,n,r,i,c,o]),u=``,d=(e,t)=>N(`inline-flex cursor-pointer items-center gap-0.5 rounded-lg border px-2.5 py-0.5 text-2xs transition-colors`,e?N(`border-transparent`,t?`bg-bad-soft text-on-bad-soft`:`bg-accent-soft text-on-accent-soft`):`border-line bg-transparent text-fg-2 hover:text-fg`);return(0,P.jsx)(q,{className:`animate-rise`,title:`all activity`,actions:(0,P.jsxs)(`span`,{className:`flex flex-wrap gap-1.5`,children:[Qc.map(([e,t])=>(0,P.jsx)(`button`,{type:`button`,className:d(o===e),"aria-pressed":o===e,onClick:()=>s(e),children:t},e)),o===`failed`&&(0,P.jsxs)(`button`,{type:`button`,className:d(!0,!0),onClick:()=>s(`all`),children:[`failed `,(0,P.jsx)(F,{name:`close`,className:`ms-sm`})]})]}),children:l.length===0?(0,P.jsx)(`div`,{className:`px-[18px] py-4 text-sm text-fg-2`,children:o===`all`?`nothing yet — run a workflow or start a chat`:`nothing here for this filter`}):(0,P.jsx)(`div`,{className:`flex flex-col p-1.5`,children:l.map(e=>{let t=Zc(e),n=t===u?null:t;return u=t,(0,P.jsxs)(`div`,{children:[n&&(0,P.jsx)(tt,{className:`block px-2.5 pt-3 pb-1`,children:n}),(0,P.jsx)(J,{href:e.href,leading:(0,P.jsxs)(`span`,{className:`relative text-[18px] leading-none`,children:[(0,P.jsx)(`span`,{"aria-hidden":!0,children:e.emoji}),e.lamp===`running`&&(0,P.jsx)(`span`,{className:`absolute -right-1 -bottom-1 grid rounded-full bg-surface p-px`,children:(0,P.jsx)(H,{tone:`working`})})]}),title:Yc(e.title),titleExtra:(0,P.jsx)(`span`,{className:`max-[800px]:hidden`,children:(0,P.jsx)(U,{tone:el[e.kind],children:e.kind===`session`?`chat`:e.kind})}),sub:e.sub&&Yc(e.sub),meta:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.status&&(0,P.jsx)(U,{tone:tl[e.lamp]??`neutral`,children:e.status}),(0,P.jsx)(`span`,{title:new Date(e.at).toLocaleString(),children:Ke(e.at)}),(0,P.jsx)(F,{name:`chevron_right`,className:`ms-sm max-[800px]:hidden`})]})})]},`${e.kind}:${e.href}:${e.at}`)})})})}var el={run:`accent`,session:`ask`,knowledge:`ok`},tl={ok:`ok`,failed:`bad`,blocked:`bad`,running:`accent`,aborted:`neutral`};function nl(e){if(!e)return``;let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/6e4));return t<1?`just started`:t<60?`${t} min`:`${Math.floor(t/60)} h ${t%60} min`}var rl=e=>new Date(e).toDateString()===new Date().toDateString();function il({runs:e,chats:t,bundles:n,agents:r,workflows:i,projectTitle:a,loaded:o}){let s=It()??[],c=I(),l=M(`agents.status`,{},{interval:5e3}),u=e=>e?i.find(t=>t.slug===e)?.name??e:`workflow`,d=new Map;for(let e of Object.values(l??{}))for(let t of e.working)t.since&&d.set(t.chatId,t.since);let f=[...t.filter(e=>e.busy&&!e.awaitingApproval).map(e=>({key:`c:${e.id}`,owner:Jc(e,r,a),title:Yc(e.title||`new chat`),meta:`working${d.get(e.id)?` · ${nl(d.get(e.id))}`:``}`,href:qc(e),tone:`working`})),...e.filter(e=>e.status===`running`).map(e=>({key:`r:${e.id}`,owner:`⚙️ ${u(e.workflow)}`,title:Yc(e.request??``),meta:`running`,href:`/runs/${e.id}`,tone:`working`}))],p=[...t.filter(e=>!e.busy&&!e.awaitingApproval&&rl(e.updatedAt)&&e.title).map(e=>({key:`c:${e.id}`,at:e.updatedAt,owner:Jc(e,r,a),title:Yc(e.title),meta:Ke(e.updatedAt),href:qc(e)})),...e.filter(e=>e.status!==`running`&&rl(e.updatedAt)).map(e=>({key:`r:${e.id}`,at:e.updatedAt,owner:`⚙️ ${u(e.workflow)}`,title:Yc(e.request??``),meta:`${e.status===`ok`?`done`:e.status===`aborted`?`stopped`:`failed`} · ${Ke(e.updatedAt)}`,href:`/runs/${e.id}`})),...n.filter(e=>e.updatedAt&&rl(e.updatedAt)).map(e=>({key:`k:${e.name}`,at:e.updatedAt,owner:`📚 ${e.name}`,title:`knowledge updated`,meta:Ke(e.updatedAt),href:`/knowledge/${encodeURIComponent(e.name)}`}))].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,12),m=Ut(s,c),h=o&&s.length===0&&f.length===0;return(0,P.jsxs)(`div`,{className:`today flex flex-col gap-3.5`,children:[(0,P.jsxs)(q,{className:`today-section`,title:`needs you`,count:s.length,actions:m&&(0,P.jsxs)(B,{variant:`primary`,size:`sm`,onClick:()=>Wt(m),className:`bg-bad text-on-bad hover:bg-bad`,children:[`start `,(0,P.jsx)(F,{name:`arrow_forward`,className:`ms-sm`})]}),children:[s.length===0?(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-4 text-sm text-fg-2`,children:h?`Nothing waiting, nothing running.`:`Nothing is waiting for you.`}):(0,P.jsx)(`div`,{className:`p-1.5`,children:s.map(e=>(0,P.jsx)(J,{className:`today-row waiting`,onClick:()=>Wt(e),over:Bt(e.owner),title:e.title,meta:(0,P.jsxs)(`span`,{className:`font-semibold text-bad`,children:[zt(e.kind),` · `,Ke(e.since)]})},e.id))}),h&&(0,P.jsx)(`div`,{className:`px-[18px] pb-4`,children:(0,P.jsx)(B,{variant:`primary`,icon:`chat`,href:`/agents/chats`,children:`chat with Ralv`})})]}),f.length>0&&(0,P.jsx)(q,{className:`today-section`,title:`in progress`,children:(0,P.jsx)(`div`,{className:`p-1.5`,children:f.map(e=>(0,P.jsx)(al,{r:e},e.key))})}),(0,P.jsx)(q,{className:`today-section`,title:`done today`,children:p.length===0?(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-4 text-sm text-fg-2`,children:`Nothing finished yet today.`}):(0,P.jsx)(`div`,{className:`p-1.5`,children:p.map(e=>(0,P.jsx)(al,{r:e},e.key))})})]})}function al({r:e}){return(0,P.jsx)(J,{className:`today-row`,href:e.href,over:e.owner,title:e.title,meta:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e.tone===`working`&&(0,P.jsx)(H,{tone:`working`}),e.meta]})})}var ol=`modulepreload`,sl=function(e){return`/`+e},cl={},ll=function(e){return e.pathname.endsWith(`.css`)},ul=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=sl(t,n);let r=s(t);if(r.href in cl)return;cl[r.href]=!0;let i=ll(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:ol,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},dl=(0,v.lazy)(()=>ul(()=>import(`./editor-DHAdW1g_.js`).then(e=>({default:e.DocEditor})),__vite__mapDeps([0,1,2,3,4,5,6]))),fl=()=>ul(()=>import(`./editor-DHAdW1g_.js`),__vite__mapDeps([0,1,2,3,4,5,6]));function pl({bundle:e,conceptId:t}){let n=M(`knowledge.list`,{}),[r,i]=(0,v.useState)([]);(0,v.useEffect)(()=>{n&&i(e=>e.filter(e=>n.bundles.some(t=>t.name===e)))},[n]);let a=(n?.bundles??[]).filter(e=>!r.includes(e.name)),o=e===`new`,s=a.reduce((e,t)=>!e||(t.updatedAt??``)>(e.updatedAt??``)?t:e,void 0);return(0,v.useEffect)(()=>{!e&&s&&z(`/knowledge/${encodeURIComponent(s.name)}`,{replace:!0})},[e,s?.name]),(0,P.jsxs)(`div`,{className:`runs-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`bundles`,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,href:`/knowledge/new`,children:`new`})}),(0,P.jsxs)(Dt,{children:[a.map(t=>(0,P.jsx)(J,{href:`/knowledge/${encodeURIComponent(t.name)}`,active:t.name===e,size:`sm`,leading:(0,P.jsx)(H,{tone:`ok`}),title:t.name,meta:t.concepts,sub:`${t.okfVersion?`okf ${t.okfVersion}`:`okf`}${t.updatedAt?` · ${t.updatedAt.slice(0,10)}`:``}`},t.name)),n&&a.length===0&&(0,P.jsx)(Ot,{children:`no bundles yet`})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:e&&!o?(0,P.jsx)(bl,{name:e,conceptId:t,onRemoved:()=>{i(t=>[...t,e]),z(`/knowledge`,{replace:!0})}},e):o||n&&!s?(0,P.jsx)(ml,{}):(0,P.jsx)(G,{children:`loading…`})})]})}function ml(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(!1);async function o(){let t=e.trim();if(!t)return;a(!0),r(``);let n=await A.request(`knowledge.create`,{body:{name:t}});a(!1),n.ok?z(`/knowledge/${encodeURIComponent(t)}`):r(j(n))}return(0,P.jsxs)(`div`,{className:`empty-action flex flex-col items-center gap-3 px-4 py-16`,children:[(0,P.jsxs)(`div`,{className:`flex w-full max-w-[520px] gap-2.5`,children:[(0,P.jsx)(Y,{className:`flex-1 font-mono text-sm`,value:e,placeholder:`bundle name, e.g. customer-support`,"aria-label":`bundle name`,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&void o(),autoFocus:!0}),(0,P.jsx)(B,{variant:`primary`,icon:`add`,busy:i,disabled:!e.trim(),onClick:o,children:i?`creating…`:`new bundle`})]}),n&&(0,P.jsx)(K,{tone:`bad`,children:n})]})}function hl({tier:e}){return(0,P.jsx)(U,{tone:e===`human-reviewed`?`ok`:e===`machine-confirmed`?`accent`:`neutral`,children:e})}var gl=e=>e===`deprecated`||e===`stale`?`bad`:e===`draft`?`accent`:`neutral`,_l=()=>(0,v.useContext)(he)!==null,vl=`m-0 max-h-[560px] overflow-auto px-[18px] py-3.5 font-mono text-xs leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,yl=`@activity`;function bl({name:e,conceptId:t,onRemoved:n}){let r=M(`knowledge.get`,{bundle:e}),i=_l(),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(``);async function l(){let t=await A.request(`knowledge.delete`,{bundle:e}).catch(()=>null);if(!t?.ok){c(t?.error??`delete failed`),o(!1);return}n?n():z(`/knowledge`,{replace:!0})}if(!r)return(0,P.jsx)(G,{children:`loading…`});if(`error`in r)return(0,P.jsx)(G,{icon:`menu_book`,children:`bundle not found`});let u=t===yl?`activity`:`pages`,d=r.concepts,f=u===`pages`?t&&d.some(e=>e.id===t)?t:d[0]?.id:void 0,p=`/knowledge/${encodeURIComponent(e)}`;return(0,P.jsxs)(`div`,{className:N(`agent-view @container flex flex-col`,i?`gap-2.5`:`gap-4`),children:[(0,P.jsxs)(`div`,{className:N(`flex flex-wrap items-center gap-x-4 gap-y-2`,i?`mb-0.5`:`mx-0.5 mt-1 mb-2`),children:[(0,P.jsx)(rt,{size:i?`md`:`lg`,children:e}),(0,P.jsxs)(`span`,{className:N(`text-fg-2`,i?`text-[12.5px]`:`text-base`),children:[d.length,` pages`]}),(0,P.jsx)(pt,{bare:!0,className:`self-end`,label:`bundle views`,value:u,items:[{id:`pages`,href:p,label:`pages`},{id:`activity`,href:`${p}/${yl}`,label:`activity`}]}),(0,P.jsx)(`span`,{className:`flex-1`}),!i&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`picture_as_pdf`,onClick:()=>void ls(e),children:`export PDF`}),a?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:()=>void l(),children:`move to trash`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>o(!1),children:`cancel`})]}):(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`delete`,onClick:()=>o(!0),title:`Move the bundle to the trash`,children:`delete`}),(0,P.jsx)(B,{variant:`primary`,onClick:()=>void Lo(`claude`,{kind:`knowledge`,bundle:e}),children:`curate in chat`})]})]}),s&&(0,P.jsx)(K,{tone:`bad`,children:s}),u===`activity`?r.log?(0,P.jsx)(Cl,{name:e,log:r.log}):(0,P.jsx)(q,{children:(0,P.jsx)(`p`,{className:`m-0 px-[18px] py-3 text-sm text-fg-2`,children:`no activity yet`})}):d.length===0?(0,P.jsx)(q,{children:(0,P.jsxs)(`p`,{className:`m-0 px-[18px] py-3 text-sm text-fg-2`,children:[`No pages yet — start a chat to author some, or write one with`,` `,(0,P.jsxs)(`code`,{children:[`kraftwerk knowledge put `,e,`/<path>`]}),`.`]})}):(0,P.jsxs)(`div`,{className:N(`grid items-start`,i?`grid-cols-[170px_minmax(0,1fr)] gap-3.5 @max-[560px]:grid-cols-1`:`grid-cols-[260px_minmax(0,1fr)] gap-6 max-[1100px]:grid-cols-1`),children:[(0,P.jsx)(`aside`,{className:N(`flex flex-col gap-0.5 overflow-y-auto border-r border-line`,i?`sticky top-0 max-h-[calc(100vh-var(--topbar-h)-160px)] pr-2 pb-1.5 @max-[560px]:static @max-[560px]:max-h-[200px] @max-[560px]:border-r-0 @max-[560px]:pr-0`:`sticky top-[calc(var(--topbar-h)+18px)] max-h-[calc(100vh-var(--topbar-h)-36px)] py-1.5 pr-3 max-[1100px]:static max-[1100px]:max-h-none max-[1100px]:border-r-0 max-[1100px]:pr-0`),children:(0,P.jsx)(Tl,{concepts:d,base:p,selected:f})}),(0,P.jsx)(`div`,{className:`min-w-0`,children:f&&(0,P.jsx)(Dl,{bundle:e,conceptId:f},f)})]})]})}function xl(e){let t=[];for(let n of e.split(`
216
216
  `)){let e=n.match(/^##\s+(\d{4}-\d{2}-\d{2})/);if(e){t.push({date:e[1],entries:[]});continue}let r=n.match(/^[*-]\s+\*\*([^*]+)\*\*:\s*(.*)$/);r&&t.length>0&&t[t.length-1].entries.push({kind:r[1].toLowerCase(),text:r[2]})}return t.filter(e=>e.entries.length>0)}function Sl(e,t){let n=[],r=/\[([^\]]+)\]\(\/?([^)]+?)\.md\)/g,i=0,a;for(;a=r.exec(t);)a.index>i&&n.push(t.slice(i,a.index)),n.push((0,P.jsx)(ge,{href:`/knowledge/${encodeURIComponent(e)}/${a[2].replace(/^\//,``)}`,children:a[1]},a.index)),i=a.index+a[0].length;return i<t.length&&n.push(t.slice(i)),n}function Cl({name:e,log:t}){let n=xl(t),[r,i]=(0,v.useState)(!1);return(0,P.jsx)(q,{title:`activity`,actions:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>i(!r),children:r?`timeline`:`raw log`}),children:r||n.length===0?(0,P.jsx)(`pre`,{className:vl,children:t}):(0,P.jsx)(`div`,{className:`pt-0.5 pb-2.5`,children:n.map((t,n)=>(0,P.jsxs)(v.Fragment,{children:[(0,P.jsx)(`div`,{className:N(`px-[18px] pt-3.5 pb-1 font-mono text-2xs tracking-[0.05em] text-fg-2 tabular-nums`,n>0&&`mt-1 border-t border-line`),children:t.date}),t.entries.map((t,n)=>(0,P.jsxs)(`div`,{className:`flex items-baseline gap-2.5 px-[18px] py-1`,children:[(0,P.jsx)(U,{tone:t.kind===`verification`?`ok`:t.kind===`creation`||t.kind===`initialization`?`accent`:`neutral`,children:t.kind}),(0,P.jsx)(`span`,{className:`min-w-0 text-[12.5px] leading-[1.55] break-words text-fg-2 [&_a]:text-accent`,children:Sl(e,t.text)})]},n))]},t.date))})})}function wl(e){let t={name:``,path:``,folders:[],pages:[],total:0};for(let n of e){let e=n.id.split(`/`),r=t;r.total++;for(let t of e.slice(0,-1)){let e=r.folders.find(e=>e.name===t);e||(e={name:t,path:r.path?`${r.path}/${t}`:t,folders:[],pages:[],total:0},r.folders.push(e)),r=e,r.total++}r.pages.push(n)}let n=e=>{e.folders.sort((e,t)=>e.name.localeCompare(t.name)),e.pages.sort((e,t)=>e.title.localeCompare(t.title)),e.folders.forEach(n)};return n(t),t}function Tl({concepts:e,base:t,selected:n}){let r=(0,v.useMemo)(()=>wl(e),[e]),[i,a]=(0,v.useState)(()=>new Set);(0,v.useEffect)(()=>{n&&n.includes(`/`)&&a(e=>{let t=new Set(e),r=n.split(`/`).slice(0,-1);for(let e=1;e<=r.length;e++)t.delete(r.slice(0,e).join(`/`));return t.size===e.size?e:t})},[n]);let o=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),s=_l();return(0,P.jsx)(El,{folder:r,base:t,selected:n,closed:i,toggle:o,embedded:s})}function El({folder:e,base:t,selected:n,closed:r,toggle:i,embedded:a}){return(0,P.jsxs)(P.Fragment,{children:[e.pages.map(e=>{let r=e.id===n;return(0,P.jsxs)(ge,{href:`${t}/${e.id}`,"aria-current":r?`page`:void 0,className:N(`wiki-page flex items-center gap-2 rounded-control px-2.5 py-1.5 leading-[1.35] no-underline transition-colors`,a?`text-[12.5px]`:`text-sm`,r?`active bg-accent-soft font-medium text-on-accent-soft`:`text-fg hover:bg-surface-2`),title:`${e.id}.md`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(e.stale||e.error)&&(0,P.jsx)(`span`,{className:`size-1.5 flex-none rounded-full bg-bad`,title:e.error??`stale`})]},e.id)}),e.folders.map(e=>{let o=!r.has(e.path),s=!!n&&n.startsWith(`${e.path}/`)&&!o;return(0,P.jsxs)(v.Fragment,{children:[(0,P.jsxs)(`button`,{type:`button`,className:N(`wiki-folder mt-2.5 mb-0.5 flex w-full cursor-pointer items-center gap-1 rounded-control border-0 bg-transparent py-1 pr-2 pl-0.5 text-left`,`font-[inherit] text-2xs leading-[1.3] font-semibold tracking-[0.06em] uppercase transition-colors`,o&&`open`,s?`holds text-accent`:`text-fg-2 hover:text-fg`),onClick:()=>i(e.path),"aria-expanded":o,title:`${e.path}/`,children:[(0,P.jsx)(F,{name:`chevron_right`,className:N(`ms-sm flex-none text-[16px] transition-transform`,o&&`rotate-90`,!s&&`text-fg-2`)}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`text-[10.5px] font-medium tracking-normal text-fg-2 tabular-nums opacity-70`,children:e.total})]}),o&&(0,P.jsx)(`div`,{className:`wiki-branch ml-[9px] flex flex-col gap-0.5 border-l border-line pl-1`,children:(0,P.jsx)(El,{folder:e,base:t,selected:n,closed:r,toggle:i,embedded:a})})]},e.path)})]})}function Dl({bundle:e,conceptId:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(!1),c=_l(),[l,u]=(0,v.useState)(`document`),[d,f]=(0,v.useState)(``),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(`saved`),[S,C]=(0,v.useState)(``),w=(0,v.useRef)(``),T=(0,v.useRef)(null),E=(0,v.useRef)(!1),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(null),ee=()=>{A.call(`knowledge.concept`,{bundle:e,query:{id:t}}).then(r,()=>a(!0))};(0,v.useEffect)(()=>{if(l===`markdown`)return;let n=!0,i,o=async()=>{try{let i=await A.request(`knowledge.concept`,{bundle:e,query:{id:t}});if(i.ok){let e=i.data;n&&(a(!1),r(t=>JSON.stringify(t)===JSON.stringify(e)?t:e))}else i.status===404&&n&&a(!0)}catch{}n&&(i=setTimeout(o,6e3))};return o(),()=>{n=!1,clearTimeout(i)}},[e,t,l]),(0,v.useEffect)(()=>{if(!n||n.raw===T.current||D.current!==null||k.current)return;let e=!0;return fl().then(({splitFrontmatter:t,unwrapParagraphs:r})=>{if(!e)return;let{head:i,body:a}=t(n.raw);w.current=i,T.current=n.raw,E.current=!1,y(e=>({key:(e?.key??0)+1,body:r(a)}))}),()=>{e=!1}},[n]);async function te(){k.current&&await k.current;let n=D.current;if(n===null)return;D.current=null,x(`saving`);let i=(async()=>{try{let i=w.current,a=i?`${i}${i.endsWith(`
217
217
  `)?``:`
218
218
  `}${n.replace(/^\n+/,`
219
219
  `)}`:n,o=await A.request(`knowledge.putConcept`,{bundle:e,body:{id:t,content:a},keepalive:!0});if(!o.ok)throw Error(j(o));let s=o.data;if(s.error)throw Error(s.error);w.current=(await fl()).splitFrontmatter(s.raw).head,T.current=s.raw,r(s),C(``),x(D.current===null?`saved`:`unsaved`)}catch(e){C(e.message),x(`error`),D.current===null&&(D.current=n)}})();k.current=i,await i,k.current=null}function M(e){E.current&&(D.current=e,x(`unsaved`),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>void te(),1e3))}(0,v.useEffect)(()=>{let e=()=>{D.current!==null&&te()};return window.addEventListener(`beforeunload`,e),window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`beforeunload`,e),window.removeEventListener(`pagehide`,e),O.current&&clearTimeout(O.current),D.current!==null&&te()}},[]);async function ne(){s(!0),await A.request(`knowledge.verify`,{bundle:e,body:{id:t}}).catch(()=>{}),s(!1),ee()}function re(){n&&(f(n.raw),g(``),u(`markdown`))}async function F(){m(!0),g(``);let n=await A.request(`knowledge.putConcept`,{bundle:e,body:{id:t,content:d}}).catch(()=>null);m(!1),!n?.ok||!n.data||typeof n.data!=`object`?g(n?.error??`save failed`):n.data.error?g(n.data.error):(T.current=null,r(n.data),u(`document`))}if(i)return(0,P.jsx)(G,{icon:`description`,children:`concept not found`});if(!n)return(0,P.jsx)(G,{children:`loading…`});let I=b===`saving`?`saving…`:b===`unsaved`?`unsaved changes`:b===`error`?`not saved — ${S}`:`all changes saved`;return(0,P.jsxs)(`div`,{className:N(`agent-view flex flex-col`,c?`gap-2.5`:`gap-4`),children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,P.jsx)(rt,{size:c?`md`:`lg`,children:n.title}),n.type&&(0,P.jsx)(U,{children:n.type}),(0,P.jsx)(hl,{tier:n.trustTier}),n.status!==`stable`&&(0,P.jsx)(U,{tone:gl(n.status),children:n.status}),n.stale&&(0,P.jsxs)(U,{tone:`bad`,children:[`stale since `,n.staleAfter?.slice(0,10)]}),(0,P.jsx)(`span`,{className:`flex-1`}),!c&&(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`picture_as_pdf`,onClick:()=>void ls(e,n.id),children:`export PDF`}),(0,P.jsx)(B,{variant:`primary`,size:c?`sm`:`md`,icon:`check`,busy:o,onClick:ne,children:o?`verifying…`:`verify (human)`})]}),n.error&&(0,P.jsx)(K,{tone:`bad`,children:n.error}),(0,P.jsxs)(`div`,{className:N(`grid items-start`,c?`grid-cols-1 gap-3`:`grid-cols-[minmax(0,1fr)_320px] gap-4 max-[1020px]:grid-cols-1`),children:[(0,P.jsxs)(q,{className:`min-w-0`,title:`content`,actions:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{className:`min-w-0 truncate font-mono text-[10.5px] text-fg-2`,children:[e,`/`,n.id,`.md`]}),l===`markdown`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>{u(`document`),g(``)},children:`cancel`}),(0,P.jsx)(B,{size:`sm`,icon:`check`,busy:p,onClick:()=>void F(),children:p?`saving…`:`save`})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:N(`text-xs whitespace-nowrap`,b===`error`?`text-bad`:b===`unsaved`||b===`saving`?`text-ask`:`text-fg-2`),children:I}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`code`,title:`The whole file as text, frontmatter included`,onClick:re,children:`edit markdown`})]})]}),children:[l===`markdown`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`textarea`,{className:`concept-edit block w-full resize-y border-0 border-b border-line bg-surface px-[18px] py-3.5 font-mono text-[12.5px] leading-[1.65] text-fg outline-none`,value:d,rows:Math.min(40,Math.max(18,d.split(`
220
220
  `).length+2)),onChange:e=>f(e.target.value),spellCheck:!1}),(0,P.jsxs)(W,{className:`border-b border-line px-[18px] py-1.5`,children:[`full file (frontmatter + markdown body) — saving stamps provenance as `,(0,P.jsx)(`code`,{children:`human:user`}),` and logs an update.`]})]}):(0,P.jsxs)(`div`,{className:N(`concept-doc`,c?`[&_.editor-content]:min-h-[220px]`:`[&_.editor-content]:min-h-[280px]`),onPointerDownCapture:()=>E.current=!0,onKeyDownCapture:()=>E.current=!0,onPasteCapture:()=>E.current=!0,onDropCapture:()=>E.current=!0,children:[_?(0,P.jsx)(v.Suspense,{fallback:(0,P.jsx)(W,{className:`border-b border-line px-[18px] py-1.5`,children:`loading the editor…`}),children:(0,P.jsx)(dl,{markdown:_.body,autoFocus:!1,onChange:M,onError:re},_.key)}):(0,P.jsx)(W,{className:`border-b border-line px-[18px] py-1.5`,children:`loading…`}),(0,P.jsxs)(W,{className:`border-b border-line px-[18px] py-1.5`,children:[`the page as a document, saved as you type; every save stamps provenance as `,(0,P.jsx)(`code`,{children:`human:user`}),` and logs an update.`]})]}),h&&(0,P.jsx)(`div`,{className:`px-3 py-1`,children:(0,P.jsx)(K,{tone:`bad`,children:h})})]}),(0,P.jsxs)(`aside`,{className:N(`flex min-w-0 flex-col`,c?`gap-2.5`:`gap-4`),children:[(0,P.jsx)(q,{title:`about`,children:(0,P.jsxs)(dt,{compact:c,children:[(0,P.jsx)(ft,{label:`trust`,children:(0,P.jsx)(hl,{tier:n.trustTier})}),(0,P.jsx)(ft,{label:`generated`,dim:!n.generated,children:n.generated?`${n.generated.by??`?`} · ${(n.generated.at??`?`).slice(0,10)}`:`not stamped`}),(0,P.jsx)(ft,{label:`verified`,dim:n.verified.length===0,children:n.verified.length===0?`never`:n.verified.map((e,t)=>(0,P.jsxs)(`span`,{className:`block`,children:[e.by??`?`,` · `,(e.at??`?`).slice(0,10)]},t))}),n.staleAfter&&(0,P.jsxs)(ft,{label:`stale after`,dim:!n.stale,children:[n.staleAfter.slice(0,10),n.stale&&(0,P.jsx)(U,{tone:`bad`,children:`stale`})]}),n.tags.length>0&&(0,P.jsx)(ft,{label:`tags`,children:n.tags.map(e=>(0,P.jsx)(U,{children:e},e))})]})}),n.sources.length>0&&(0,P.jsx)(q,{title:`sources`,children:(0,P.jsx)(dt,{compact:c,children:n.sources.map((e,t)=>(0,P.jsxs)(`div`,{className:N(`flex flex-col gap-[3px] break-words`,c?`px-3.5 py-1.5 text-xs`:`px-[18px] py-2.5 text-[12.5px]`),children:[(0,P.jsxs)(`span`,{className:`text-fg [&_a]:text-accent`,children:[e.resource?.startsWith(`http`)?(0,P.jsx)(`a`,{href:e.resource,target:`_blank`,rel:`noreferrer`,children:e.title??e.resource}):e.title??e.resource??`?`,e.id&&(0,P.jsxs)(`span`,{className:`ml-2 font-mono text-2xs text-fg-2`,children:[`[^`,e.id,`]`]})]}),(0,P.jsx)(`span`,{className:`text-fg-2`,children:[e.author,e.usage_count==null?null:`${e.usage_count} uses`,e.last_modified?`mod ${e.last_modified.slice(0,10)}`:null].filter(Boolean).join(` · `)})]},t))})})]})]})]})}var Ol={workspace:`workspace`,project:`.claude`,user:`global`,agent:`agent`};function kl(e){return(0,P.jsx)(U,{tone:e===`workspace`?`ok`:e===`agent`?`accent`:`neutral`,children:Ol[e]})}function Al({name:e}){let t=M(`skills.list`,{}),n=t?.skills??[],r=n.filter(e=>e.source===`workspace`),i=n.filter(e=>e.source!==`workspace`),a=r[0]??i[0];(0,v.useEffect)(()=>{!e&&a&&z(`/skills/${encodeURIComponent(a.name)}`,{replace:!0})},[e,a?.name]);let o=t=>(0,P.jsx)(J,{href:`/skills/${encodeURIComponent(t.name)}`,active:t.name===e,size:`sm`,leading:(0,P.jsx)(H,{tone:t.source===`workspace`?`ok`:`idle`}),title:`/${t.name}`,titleExtra:t.source!==`workspace`&&kl(t.source),sub:t.description||`no description`},`${t.source}:${t.name}`);return(0,P.jsxs)(`div`,{className:`runs-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`workspace skills`}),(0,P.jsxs)(Dt,{children:[r.map(o),t&&r.length===0&&(0,P.jsx)(Ot,{children:`no workspace skills yet`}),i.length>0&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Tt,{title:`local (this machine / repo)`,divided:!0}),i.map(o)]})]})]}),(0,P.jsx)(`div`,{className:`runs-main`,children:e?(0,P.jsx)(Ml,{name:e},e):t&&!a?(0,P.jsx)(jl,{root:t.root}):(0,P.jsx)(G,{children:`loading…`})})]})}function jl({root:e}){return(0,P.jsx)(`div`,{className:`empty-action py-6`,children:(0,P.jsxs)(G,{icon:`extension`,children:[`Create `,(0,P.jsxs)(`code`,{children:[e,`/<name>/SKILL.md`]}),` and it appears here and in every session's `,(0,P.jsx)(`code`,{children:`/`}),` menu.`]})})}function Ml({name:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(`rendered`),s=(0,v.useMemo)(()=>t?t.content.replace(/^---\r?\n[\s\S]*?\r?\n---(\r?\n|$)/,``):``,[t?.content]),c=(0,v.useMemo)(()=>t?pa.sanitize(Q.parse(s,{async:!1})):``,[s]);return(0,v.useEffect)(()=>{A.call(`skills.get`,{name:e}).then(n,()=>i(!0))},[e]),r?(0,P.jsx)(G,{icon:`extension`,children:`skill not found`}):t?(0,P.jsxs)(`div`,{className:`agent-view flex flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,P.jsxs)(rt,{size:`lg`,children:[`/`,t.name]}),kl(t.source)]}),t.description&&(0,P.jsx)(`p`,{className:`-mt-2 mb-0 mx-0.5 text-sm leading-[1.6] text-fg-2`,children:t.description}),(0,P.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_320px] items-start gap-4 max-[1020px]:grid-cols-1`,children:[(0,P.jsx)(q,{className:`min-w-0`,title:`SKILL.md`,actions:(0,P.jsx)(pt,{bare:!0,label:`SKILL.md view`,value:a,onChange:o,items:[{id:`rendered`,label:`rendered`},{id:`source`,label:`source`}]}),children:a===`rendered`?(0,P.jsx)(`div`,{className:`md-body h-auto overflow-visible [&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2`,dangerouslySetInnerHTML:{__html:c}}):(0,P.jsx)(`pre`,{className:`m-0 max-h-[560px] overflow-auto px-[18px] py-3.5 font-mono text-xs leading-[1.55] break-words whitespace-pre-wrap text-fg-2`,children:t.content.trim()||`(empty)`})}),(0,P.jsx)(`aside`,{className:`flex min-w-0 flex-col gap-4`,children:(0,P.jsx)(q,{title:`about`,children:(0,P.jsxs)(dt,{children:[(0,P.jsx)(ft,{label:`source`,children:t.source===`workspace`?`workspace — git-tracked, shared with the team`:t.source===`project`?`repo .claude/skills — tracked, but outside the workspace root`:`global ~/.claude/skills — only on this machine`}),(0,P.jsx)(ft,{label:`path`,mono:!0,children:(0,P.jsx)(`span`,{title:t.path,children:t.path})}),(0,P.jsx)(ft,{label:`invoke`,children:(0,P.jsxs)(`span`,{children:[(0,P.jsxs)(`code`,{children:[`/`,t.name]}),` in any session`]})}),t.files.length>0&&(0,P.jsx)(ft,{label:`bundled files`,mono:!0,children:t.files.map(e=>(0,P.jsx)(`span`,{className:`block w-full`,children:e},e))})]})})})]})]}):(0,P.jsx)(G,{children:`loading…`})}var Nl=function(e,t){let n=e,r=Fl[t],i=null,a=0,o=null,s=[],c={},l=function(e,t){a=n*4+17,i=function(e){let t=Array(e);for(let n=0;n<e;n+=1){t[n]=Array(e);for(let r=0;r<e;r+=1)t[n][r]=null}return t}(a),u(0,0),u(a-7,0),u(0,a-7),p(),f(),h(e,t),n>=7&&m(e),o??=v(n,r,s),g(o,t)},u=function(e,t){for(let n=-1;n<=7;n+=1)if(!(e+n<=-1||a<=e+n))for(let r=-1;r<=7;r+=1)t+r<=-1||a<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?i[e+n][t+r]=!0:i[e+n][t+r]=!1)},d=function(){let e=0,t=0;for(let n=0;n<8;n+=1){l(!0,n);let r=Ll.getLostPoint(c);(n==0||e>r)&&(e=r,t=n)}return t},f=function(){for(let e=8;e<a-8;e+=1)i[e][6]??(i[e][6]=e%2==0);for(let e=8;e<a-8;e+=1)i[6][e]??(i[6][e]=e%2==0)},p=function(){let e=Ll.getPatternPosition(n);for(let t=0;t<e.length;t+=1)for(let n=0;n<e.length;n+=1){let r=e[t],a=e[n];if(i[r][a]==null)for(let e=-2;e<=2;e+=1)for(let t=-2;t<=2;t+=1)e==-2||e==2||t==-2||t==2||e==0&&t==0?i[r+e][a+t]=!0:i[r+e][a+t]=!1}},m=function(e){let t=Ll.getBCHTypeNumber(n);for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[Math.floor(n/3)][n%3+a-8-3]=r}for(let n=0;n<18;n+=1){let r=!e&&(t>>n&1)==1;i[n%3+a-8-3][Math.floor(n/3)]=r}},h=function(e,t){let n=r<<3|t,o=Ll.getBCHTypeInfo(n);for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<6?i[t][8]=n:t<8?i[t+1][8]=n:i[a-15+t][8]=n}for(let t=0;t<15;t+=1){let n=!e&&(o>>t&1)==1;t<8?i[8][a-t-1]=n:t<9?i[8][15-t-1+1]=n:i[8][15-t-1]=n}i[a-8][8]=!e},g=function(e,t){let n=-1,r=a-1,o=7,s=0,c=Ll.getMaskFunction(t);for(let t=a-1;t>0;t-=2)for(t==6&&--t;;){for(let n=0;n<2;n+=1)if(i[r][t-n]==null){let a=!1;s<e.length&&(a=(e[s]>>>o&1)==1),c(r,t-n)&&(a=!a),i[r][t-n]=a,--o,o==-1&&(s+=1,o=7)}if(r+=n,r<0||a<=r){r-=n,n=-n;break}}},_=function(e,t){let n=0,r=0,i=0,a=Array(t.length),o=Array(t.length);for(let s=0;s<t.length;s+=1){let c=t[s].dataCount,l=t[s].totalCount-c;r=Math.max(r,c),i=Math.max(i,l),a[s]=Array(c);for(let t=0;t<a[s].length;t+=1)a[s][t]=255&e.getBuffer()[t+n];n+=c;let u=Ll.getErrorCorrectPolynomial(l),d=zl(a[s],u.getLength()-1).mod(u);o[s]=Array(u.getLength()-1);for(let e=0;e<o[s].length;e+=1){let t=e+d.getLength()-o[s].length;o[s][e]=t>=0?d.getAt(t):0}}let s=0;for(let e=0;e<t.length;e+=1)s+=t[e].totalCount;let c=Array(s),l=0;for(let e=0;e<r;e+=1)for(let n=0;n<t.length;n+=1)e<a[n].length&&(c[l]=a[n][e],l+=1);for(let e=0;e<i;e+=1)for(let n=0;n<t.length;n+=1)e<o[n].length&&(c[l]=o[n][e],l+=1);return c},v=function(e,t,n){let r=Bl.getRSBlocks(e,t),i=Vl();for(let t=0;t<n.length;t+=1){let r=n[t];i.put(r.getMode(),4),i.put(r.getLength(),Ll.getLengthInBits(r.getMode(),e)),r.write(i)}let a=0;for(let e=0;e<r.length;e+=1)a+=r[e].dataCount;if(i.getLengthInBits()>a*8)throw`code length overflow. (`+i.getLengthInBits()+`>`+a*8+`)`;for(i.getLengthInBits()+4<=a*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=a*8||(i.put(236,8),i.getLengthInBits()>=a*8));)i.put(17,8);return _(i,r)};c.addData=function(e,t){t||=`Byte`;let n=null;switch(t){case`Numeric`:n=Hl(e);break;case`Alphanumeric`:n=Ul(e);break;case`Byte`:n=Wl(e);break;case`Kanji`:n=Gl(e);break;default:throw`mode:`+t}s.push(n),o=null},c.isDark=function(e,t){if(e<0||a<=e||t<0||a<=t)throw e+`,`+t;return i[e][t]},c.getModuleCount=function(){return a},c.make=function(){if(n<1){let e=1;for(;e<40;e++){let t=Bl.getRSBlocks(e,r),n=Vl();for(let t=0;t<s.length;t++){let r=s[t];n.put(r.getMode(),4),n.put(r.getLength(),Ll.getLengthInBits(r.getMode(),e)),r.write(n)}let i=0;for(let e=0;e<t.length;e++)i+=t[e].dataCount;if(n.getLengthInBits()<=i*8)break}n=e}l(!1,d())},c.createTableTag=function(e,t){e||=2,t=t===void 0?e*4:t;let n=``;n+=`<table style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: `+t+`px;`,n+=`">`,n+=`<tbody>`;for(let t=0;t<c.getModuleCount();t+=1){n+=`<tr>`;for(let r=0;r<c.getModuleCount();r+=1)n+=`<td style="`,n+=` border-width: 0px; border-style: none;`,n+=` border-collapse: collapse;`,n+=` padding: 0px; margin: 0px;`,n+=` width: `+e+`px;`,n+=` height: `+e+`px;`,n+=` background-color: `,n+=c.isDark(t,r)?`#000000`:`#ffffff`,n+=`;`,n+=`"/>`;n+=`</tr>`}return n+=`</tbody>`,n+=`</table>`,n},c.createSvgTag=function(e,t,n,r){let i={};typeof arguments[0]==`object`&&(i=arguments[0],e=i.cellSize,t=i.margin,n=i.alt,r=i.title),e||=2,t=t===void 0?e*4:t,n=typeof n==`string`?{text:n}:n||{},n.text=n.text||null,n.id=n.text?n.id||`qrcode-description`:null,r=typeof r==`string`?{text:r}:r||{},r.text=r.text||null,r.id=r.text?r.id||`qrcode-title`:null;let a=c.getModuleCount()*e+t*2,o,s,l,u,d=``,f;for(f=`l`+e+`,0 0,`+e+` -`+e+`,0 0,-`+e+`z `,d+=`<svg version="1.1" xmlns="http://www.w3.org/2000/svg"`,d+=i.scalable?``:` width="`+a+`px" height="`+a+`px"`,d+=` viewBox="0 0 `+a+` `+a+`" `,d+=` preserveAspectRatio="xMinYMin meet"`,d+=r.text||n.text?` role="img" aria-labelledby="`+y([r.id,n.id].join(` `).trim())+`"`:``,d+=`>`,d+=r.text?`<title id="`+y(r.id)+`">`+y(r.text)+`</title>`:``,d+=n.text?`<description id="`+y(n.id)+`">`+y(n.text)+`</description>`:``,d+=`<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>`,d+=`<path d="`,l=0;l<c.getModuleCount();l+=1)for(u=l*e+t,o=0;o<c.getModuleCount();o+=1)c.isDark(l,o)&&(s=o*e+t,d+=`M`+s+`,`+u+f);return d+=`" stroke="transparent" fill="black"/>`,d+=`</svg>`,d},c.createDataURL=function(e,t){e||=2,t=t===void 0?e*4:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t;return Xl(n,n,function(t,n){if(r<=t&&t<i&&r<=n&&n<i){let i=Math.floor((t-r)/e),a=Math.floor((n-r)/e);return+!c.isDark(a,i)}return 1})},c.createImgTag=function(e,t,n){e||=2,t=t===void 0?e*4:t;let r=c.getModuleCount()*e+t*2,i=``;return i+=`<img`,i+=` src="`,i+=c.createDataURL(e,t),i+=`"`,i+=` width="`,i+=r,i+=`"`,i+=` height="`,i+=r,i+=`"`,n&&(i+=` alt="`,i+=y(n),i+=`"`),i+=`/>`,i};let y=function(e){let t=``;for(let n=0;n<e.length;n+=1){let r=e.charAt(n);switch(r){case`<`:t+=`&lt;`;break;case`>`:t+=`&gt;`;break;case`&`:t+=`&amp;`;break;case`"`:t+=`&quot;`;break;default:t+=r}}return t},b=function(e){e=e===void 0?2:e;let t=c.getModuleCount()*1+e*2,n=e,r=t-e,i,a,o,s,l,u={"██":`█`,"█ ":`▀`," █":`▄`," ":` `},d={"██":`▀`,"█ ":`▀`," █":` `," ":` `},f=``;for(i=0;i<t;i+=2){for(o=Math.floor((i-n)/1),s=Math.floor((i+1-n)/1),a=0;a<t;a+=1)l=`█`,n<=a&&a<r&&n<=i&&i<r&&c.isDark(o,Math.floor((a-n)/1))&&(l=` `),n<=a&&a<r&&n<=i+1&&i+1<r&&c.isDark(s,Math.floor((a-n)/1))?l+=` `:l+=`█`,f+=e<1&&i+1>=r?d[l]:u[l];f+=`
221
221
  `}return t%2&&e>0?f.substring(0,f.length-t-1)+Array(t+1).join(`▀`):f.substring(0,f.length-1)};return c.createASCII=function(e,t){if(e||=1,e<2)return b(t);--e,t=t===void 0?e*2:t;let n=c.getModuleCount()*e+t*2,r=t,i=n-t,a,o,s,l,u=Array(e+1).join(`██`),d=Array(e+1).join(` `),f=``,p=``;for(a=0;a<n;a+=1){for(s=Math.floor((a-r)/e),p=``,o=0;o<n;o+=1)l=1,r<=o&&o<i&&r<=a&&a<i&&c.isDark(s,Math.floor((o-r)/e))&&(l=0),p+=l?u:d;for(s=0;s<e;s+=1)f+=p+`
222
- `}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};Nl.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},Nl.createStringToBytes=function(e,t){let n=function(){let n=Jl(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var Pl={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Fl={L:1,M:0,Q:3,H:2},Il={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Ll=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case Il.PATTERN000:return function(e,t){return(e+t)%2==0};case Il.PATTERN001:return function(e,t){return e%2==0};case Il.PATTERN010:return function(e,t){return t%3==0};case Il.PATTERN011:return function(e,t){return(e+t)%3==0};case Il.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case Il.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case Il.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case Il.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=zl([1],0);for(let n=0;n<e;n+=1)t=t.multiply(zl([1,Rl.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case Pl.MODE_NUMBER:return 10;case Pl.MODE_ALPHA_NUM:return 9;case Pl.MODE_8BIT_BYTE:return 8;case Pl.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case Pl.MODE_NUMBER:return 12;case Pl.MODE_ALPHA_NUM:return 11;case Pl.MODE_8BIT_BYTE:return 16;case Pl.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case Pl.MODE_NUMBER:return 14;case Pl.MODE_ALPHA_NUM:return 13;case Pl.MODE_8BIT_BYTE:return 16;case Pl.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),Rl=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),zl=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=Rl.gexp(Rl.glog(r.getAt(n))+Rl.glog(e.getAt(i)));return zl(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=Rl.glog(r.getAt(0))-Rl.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=Rl.gexp(Rl.glog(e.getAt(r))+t);return zl(n,0).mod(e)},r},Bl=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case Fl.L:return e[(t-1)*4+0];case Fl.M:return e[(t-1)*4+1];case Fl.Q:return e[(t-1)*4+2];case Fl.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),Vl=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},Hl=function(e){let t=Pl.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},Ul=function(e){let t=Pl.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},Wl=function(e){let t=Pl.MODE_8BIT_BYTE,n=Nl.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},Gl=function(e){let t=Pl.MODE_KANJI,n=Nl.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},Kl=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},ql=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},Jl=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},Yl=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=Kl(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},Xl=function(e,t,n){let r=Yl(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=Kl();r.write(i);let a=ql(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};Nl.stringToBytes;function Zl(){let e=navigator.userAgent,t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Mac/.test(e)?`Mac`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:`device`,n=/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n?`${t} · ${n}`:t}function Ql(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(Zl),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``),c=async()=>{a(!0),s(``);let t=await A.request(`devices.pair`,{body:{code:e,name:n}}).catch(()=>null);if(t?.ok)return location.reload();a(!1),s(t?j(t):`could not reach kraftwerk`)};return(0,P.jsxs)(`main`,{className:`mx-auto flex min-h-screen w-full max-w-[420px] flex-col justify-center gap-5 px-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsx)(F,{name:`phonelink_lock`,className:`text-[32px] text-fg-2`}),(0,P.jsx)(rt,{size:`lg`,children:`Pair this device`}),(0,P.jsxs)(`p`,{className:`m-0 text-sm leading-relaxed text-fg-2`,children:[`This kraftwerk runs on another machine. On that machine, run `,(0,P.jsx)(`code`,{children:`kraftwerk devices pair`}),` or open settings → devices, and enter the code here. You pair once; it stays paired until it is removed there.`]})]}),(0,P.jsxs)(`form`,{className:`flex flex-col gap-3.5`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,P.jsx)(X,{label:`pairing code`,children:(0,P.jsx)(Y,{value:e,onChange:e=>t(e.target.value.toUpperCase()),placeholder:`ABCD-EF23`,autoFocus:!0,autoComplete:`one-time-code`,autoCapitalize:`characters`,"aria-label":`pairing code`,className:`font-mono tracking-widest`})}),(0,P.jsx)(X,{label:`name of this device`,hint:`how it shows in the list of paired devices`,children:(0,P.jsx)(Y,{value:n,onChange:e=>r(e.target.value),"aria-label":`device name`})}),o&&(0,P.jsx)(K,{tone:`bad`,children:o}),(0,P.jsx)(B,{variant:`primary`,type:`submit`,busy:i,disabled:!e.trim(),children:`pair`})]})]})}function $l({children:e}){return O()?(0,P.jsx)(Ql,{}):(0,P.jsx)(P.Fragment,{children:e})}function eu({text:e,size:t=176}){let n=(0,v.useMemo)(()=>{let t=Nl(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i+4} ${e+4}h1v1h-1z`);return{d:r,n:n+8}},[e]);return(0,P.jsx)(`svg`,{viewBox:`0 0 ${n.n} ${n.n}`,width:t,height:t,role:`img`,"aria-label":`pairing QR code`,className:`rounded-lg bg-white text-black`,shapeRendering:`crispEdges`,children:(0,P.jsx)(`path`,{d:n.d,fill:`currentColor`})})}function tu({onError:e}){let t=M(`devices.relay`,{},{interval:1e4}),[n,r]=(0,v.useState)(!1);if(!t)return null;let i=async()=>{r(!0);let n=await A.request(`devices.setRelay`,{body:{enabled:!t.enabled}}).catch(()=>null);r(!1),n&&!n.ok&&e(j(n))},a=t.enabled?t.daemon?t.state===`connected`?`connected${t.clients?` · ${t.clients} device${t.clients===1?``:`s`} now`:``}`:t.state===`error`?`not connected: ${t.error??`unknown error`}`:`connecting…`:"on — the daemon connects it (this kraftwerk is not the daemon: `kraftwerk daemon`)":`off — devices reach this machine on your network only`;return(0,P.jsx)(lt,{children:(0,P.jsx)(ct,{icon:t.enabled?`public`:`public_off`,title:`reach this machine from anywhere`,"data-relay":t.enabled?t.state:`off`,action:(0,P.jsx)(B,{size:`sm`,busy:n,variant:t.enabled?void 0:`primary`,onClick:()=>void i(),children:t.enabled?`turn off`:`turn on`}),children:(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[a,t.enabled&&t.fingerprint&&(0,P.jsxs)(P.Fragment,{children:[` · machine key `,(0,P.jsx)(`code`,{children:t.fingerprint})]}),` — through the kraftwerk relay, end to end encrypted: it cannot read along`]})})})}function nu(){let e=M(`devices.self`,{},{interval:6e4}),t=e?.trust===`local`,n=M(`devices.list`,t?{}:null,{interval:15e3}),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``);if(!e)return null;if(!t)return(0,P.jsx)(q,{title:`devices`,children:(0,P.jsx)(lt,{children:(0,P.jsx)(ct,{icon:`phonelink_lock`,title:`this browser is paired as “${e.device?.name}”`,children:(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`devices are managed on the machine kraftwerk runs on`})})})});let s=async()=>{o(``);let e=await A.request(`devices.code`).catch(()=>null);e?.ok?i(e.data):o(e?j(e):`could not make a code`)},c=async(e,t)=>{if(!window.confirm(`Unpair “${t}”? It loses access at once.`))return;let n=await A.request(`devices.revoke`,{id:e}).catch(()=>null);n&&!n.ok&&o(j(n))};return(0,P.jsxs)(q,{title:`devices`,actions:(0,P.jsx)(B,{size:`sm`,icon:`add_link`,onClick:()=>void s(),children:`pair a device`}),children:[r&&(0,P.jsxs)(yt,{className:`border-b border-line`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-3`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[22px] font-semibold tracking-widest text-fg`,"aria-label":`pairing code`,children:r.code}),(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[`once, until `,new Date(r.expiresAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]})]}),r.remote&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,P.jsx)(eu,{text:r.remote}),(0,P.jsxs)(`span`,{className:`max-w-[28ch] text-sm text-fg-2`,children:[`From anywhere: scan this with the phone's camera, or open `,(0,P.jsx)(`a`,{href:r.remote,target:`_blank`,rel:`noreferrer`,children:`the pairing link`}),` on it. It carries the code — treat it like a password.`]})]}),r.urls.length?(0,P.jsxs)(`span`,{className:`text-sm text-fg-2`,children:[`On the device, open `,r.urls.map((e,t)=>(0,P.jsxs)(`span`,{children:[t>0&&` or `,(0,P.jsx)(`code`,{children:e})]},e)),` and enter the code.`]}):r.remote?null:(0,P.jsxs)(`span`,{className:`text-sm text-fg-2`,children:[`This kraftwerk only listens on this machine. Restart it with `,(0,P.jsx)(`code`,{children:`kraftwerk ui --lan`}),` to reach it from your network (or use a tunnel), then enter the code on the device — or turn on “reach this machine from anywhere”.`]})]}),(0,P.jsx)(tu,{onError:o}),a&&(0,P.jsx)(`div`,{className:`px-[18px] pt-3`,children:(0,P.jsx)(K,{tone:`bad`,children:a})}),n&&n.devices.length===0&&!r&&(0,P.jsx)(G,{icon:`devices`,children:`no paired devices — a phone or another computer can use this kraftwerk once paired`}),n&&n.devices.length>0&&(0,P.jsx)(lt,{children:n.devices.map(e=>(0,P.jsx)(ct,{icon:`devices`,title:e.name,"data-device":e.id,action:(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`link_off`,onClick:()=>void c(e.id,e.name),"aria-label":`unpair ${e.name}`,children:`unpair`}),children:(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[`paired `,Ke(e.createdAt),` · `,e.lastSeenAt?`last seen ${Ke(e.lastSeenAt)}`:`not used yet`]})},e.id))})]})}var ru={enabled:!1,remote:`origin`,branch:``,interval:`300`,autosync:`pull`};function iu(e){let t=e.config.git;return t?{enabled:t.enabled!==!1,remote:t.remote??ru.remote,branch:t.branch??``,interval:String(t.interval??ru.interval),autosync:t.autosync??ru.autosync}:ru}var au={enabled:!1,root:``};function ou(e){let t=e.config.repos;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function su(e){let t=e.config.vibeables;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function cu(e){let t=e.config.projects;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function lu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{let e=!0,n=()=>A.call(`meta.get`).then(n=>e&&n.cloud&&t(n.cloud)).catch(()=>{});n();let r=setInterval(n,1e4);return()=>{e=!1,clearInterval(r)}},[]),!e)return null;let i=e.state===`connected`?e.account?`claimed`:`unclaimed`:e.state,a=e.state===`connected`&&e.account?`ok`:e.state===`error`?`bad`:`neutral`;return(0,P.jsx)(q,{title:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[`cloud `,(0,P.jsx)(U,{tone:a,children:i})]}),actions:e.url&&(0,P.jsxs)(`a`,{className:Qe(`secondary`,`sm`),href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`cloud`,className:`ms-sm`}),` open the cloud`]}),children:(0,P.jsxs)(yt,{children:[e.state===`off`&&(0,P.jsxs)(W,{children:[`Off — `,(0,P.jsx)(`code`,{children:`cloud.enabled: false`}),` in kraftwerk.yml or `,(0,P.jsx)(`code`,{children:`KRAFTWERK_CLOUD_URL=off`}),` in the environment. Every other`,(0,P.jsx)(`code`,{children:` kraftwerk ui`}),` registers with the kraftwerk cloud on start, so its owner can see it running from anywhere.`]}),e.state===`connecting`&&(0,P.jsxs)(W,{children:[`Registering with `,e.url,` …`]}),e.state===`error`&&(0,P.jsxs)(W,{children:[`Could not reach `,e.url,`: `,e.error,`. Retrying every `,e.interval??60,`s — the UI works as before meanwhile.`]}),e.state===`connected`&&e.account&&(0,P.jsxs)(W,{children:[`This workspace is registered at `,(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}),` under `,(0,P.jsx)(`strong`,{children:e.account}),`. Last heartbeat `,e.lastSeen?new Date(e.lastSeen).toLocaleTimeString():`pending`,`.`]}),e.state===`connected`&&!e.account&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(W,{children:[`Registered at `,(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}),`, not yet under an account. Sign in there and enter this code — or open the link — and the workspace shows up under `,(0,P.jsx)(`em`,{children:`My instances`}),`:`]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,P.jsx)(`code`,{className:`rounded-control border border-line bg-surface-2 px-3 py-1.5 font-mono text-lg tracking-[0.12em] text-fg`,children:e.claimCode??`…`}),e.claimCode&&(0,P.jsx)(B,{size:`sm`,icon:`content_copy`,onClick:()=>{navigator.clipboard.writeText(e.claimCode),r(!0),setTimeout(()=>r(!1),1500)},children:n?`copied`:`copy`}),e.claimUrl&&(0,P.jsxs)(`a`,{className:Qe(`primary`,`sm`),href:e.claimUrl,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`link`,className:`ms-sm`}),` claim in the cloud`]})]}),(0,P.jsxs)(W,{children:[`A claim made there reaches this instance with the next heartbeat (every `,e.interval??60,`s). To keep this workspace out of the cloud, set `,(0,P.jsx)(`code`,{children:`cloud.enabled: false`}),` in kraftwerk.yml.`]})]})]})})}function uu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(ru),[f,p]=(0,v.useState)(au),[m,h]=(0,v.useState)(au),[g,_]=(0,v.useState)(au),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(``),D=M(`identity.get`,{},{interval:6e4});(0,v.useEffect)(()=>{A.call(`settings.get`).then(e=>{t(e),r(e.config.name??``),a(e.config.icon??``),s(e.config.color??``),l(e.config.switcher??[]),d(iu(e)),p(ou(e)),h(su(e)),_(cu(e))}).catch(()=>E(`could not load settings`))},[]);let O=()=>{b(!0),w(!1),E(``)};async function k(){S(!0),E(``);try{let e=await A.request(`settings.save`,{body:{name:n,icon:i,color:o,switcher:c,git:{...u,interval:u.interval===``?void 0:Number(u.interval)},repos:f,vibeables:m,projects:g}});if(!e.ok)throw Error(e.error||`save failed`);let r=e.data;t(r),l(r.config.switcher??[]),d(iu(r)),p(ou(r)),h(su(r)),_(cu(r)),b(!1),w(!0)}catch(e){E(e.message)}finally{S(!1)}}let ee=(e,t)=>{l(n=>n.map((n,r)=>r===e?{...n,...t}:n)),O()},te=e=>{d(t=>({...t,...e})),O()},j=e=>{p(t=>({...t,...e})),O()},N=e=>{h(t=>({...t,...e})),O()},ne=e=>{_(t=>({...t,...e})),O()};if(!e)return(0,P.jsx)(G,{children:T||`loading…`});let re=[[`identity`,D?.identity??`…`,`this machine — the runner routines name in runs_on (kraftwerk whoami to rename)`],[`port`,String(e.resolved.port),`kraftwerk ui listens here (CLI --port wins)`],[`workflows`,e.resolved.workflowsRoot??`— none found`,`workflow definitions`],[`output`,e.resolved.outputDir,`run artifacts`],[`knowledge`,e.config.knowledge??`knowledge`,`OKF knowledge bundles`],[`agents`,e.config.agents??`agents`,`agent definitions`],[`skills`,e.config.skills??`skills`,`workspace skills`]];return(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[860px] flex-col gap-4`,children:[(0,P.jsx)(it,{icon:(0,P.jsx)(F,{name:`settings`,className:`text-[28px] text-fg-2`}),title:`Settings`,actions:(0,P.jsxs)(P.Fragment,{children:[T&&(0,P.jsx)(K,{tone:`bad`,children:T}),C&&!y&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12.5px] text-ok`,children:[(0,P.jsx)(F,{name:`check`,className:`ms-sm`}),` saved`]}),(0,P.jsx)(B,{variant:`primary`,busy:x,disabled:!y,onClick:()=>void k(),children:x?`saving…`:`save changes`})]})}),(0,P.jsx)(q,{title:`workspace`,children:(0,P.jsxs)(yt,{children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`icon`,className:`w-[90px]`,children:(0,P.jsx)(Y,{value:i,placeholder:`🤖`,onChange:e=>{a(e.target.value),O()}})}),(0,P.jsx)(X,{label:`name`,className:`min-w-40 flex-1`,children:(0,P.jsx)(Y,{value:n,placeholder:`my workspace`,onChange:e=>{r(e.target.value),O()}})}),(0,P.jsxs)(`label`,{className:`flex w-[130px] flex-col gap-1.5`,title:`Accent in the workspace switcher; empty = derived from the folder`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`color`}),(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`color`,"aria-label":`pick a color`,className:`h-9 w-10 flex-none cursor-pointer rounded-control border border-line bg-surface p-0.5`,value:/^#[0-9a-f]{6}$/i.test(o)?o:`#888888`,onChange:e=>{s(e.target.value),O()}}),(0,P.jsx)(Y,{className:`min-w-0 px-2`,value:o,placeholder:`auto`,onChange:e=>{s(e.target.value),O()}})]})]})]}),(0,P.jsx)(W,{children:`Shown in the header, browser tab and to other workspaces discovering this one.`})]})}),(0,P.jsx)(q,{title:`workspace switcher`,actions:(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>{l(e=>[...e,{name:``,url:`http://localhost:`}]),O()},children:`add entry`}),children:(0,P.jsxs)(yt,{children:[c.length===0&&(0,P.jsx)(W,{children:`No manual entries.`}),c.map((e,t)=>(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`icon`,className:`w-[70px]`,children:(0,P.jsx)(Y,{value:e.icon??``,placeholder:`•`,onChange:e=>ee(t,{icon:e.target.value})})}),(0,P.jsx)(X,{label:`name`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:e.name,placeholder:`other workspace`,onChange:e=>ee(t,{name:e.target.value})})}),(0,P.jsx)(X,{label:`url`,className:`min-w-40 flex-[1.4]`,children:(0,P.jsx)(Y,{value:e.url,placeholder:`http://localhost:1982`,onChange:e=>ee(t,{url:e.target.value})})}),(0,P.jsx)(V,{icon:`close`,label:`remove entry`,className:`mb-0.5`,onClick:()=>{l(e=>e.filter((e,n)=>n!==t)),O()}})]},t)),(0,P.jsx)(W,{children:`Running workspaces on this machine are discovered automatically — manual entries are for remote instances or extra links.`})]})}),(0,P.jsx)(q,{title:`git sync`,actions:(0,P.jsx)(B,{size:`sm`,icon:`account_tree`,href:`/git`,children:`open git`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:u.enabled,onChange:e=>te({enabled:e}),children:`sync workflows, knowledge, agents and skills with a git remote`}),u.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`remote`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:u.remote,placeholder:`origin`,onChange:e=>te({remote:e.target.value})})}),(0,P.jsx)(X,{label:`branch`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:u.branch,placeholder:`checked-out branch`,onChange:e=>te({branch:e.target.value})})}),(0,P.jsx)(X,{label:`interval (s)`,className:`w-[120px]`,children:(0,P.jsx)(Y,{type:`number`,min:0,step:1,value:u.interval,placeholder:`300`,onChange:e=>te({interval:e.target.value})})}),(0,P.jsx)(X,{label:`autosync`,className:`w-[150px]`,children:(0,P.jsxs)(vt,{value:u.autosync,onChange:e=>te({autosync:e.target.value}),children:[(0,P.jsx)(`option`,{value:`pull`,children:`fetch and pull`}),(0,P.jsx)(`option`,{value:`off`,children:`fetch only`})]})})]}),(0,P.jsx)(W,{children:`The interval fetches in the background (0 turns the timer off); with autosync on it also fast-forwards when behind and nothing is modified locally. Commit and push stay manual on the git screen.`})]})]})}),(0,P.jsx)(q,{title:`repositories`,actions:(0,P.jsx)(B,{size:`sm`,icon:`source`,href:`/repos`,children:`open repositories`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:f.enabled,onChange:e=>j({enabled:e}),children:`keep git repositories the agents work on under one folder`}),f.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`repos root`,children:(0,P.jsx)(Y,{value:f.root,placeholder:`repos`,onChange:e=>j({root:e.target.value})})}),(0,P.jsxs)(W,{children:[`Relative to the project root. Saving creates the folder and adds it to .gitignore; every agent gets the list of clones as context and can add more with `,(0,P.jsx)(`code`,{children:`kraftwerk repos add`}),`.`]})]})]})}),(0,P.jsx)(q,{title:`apps (vibeables)`,actions:(0,P.jsx)(B,{size:`sm`,icon:`web`,href:`/vibeables`,children:`open apps`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:m.enabled,onChange:e=>N({enabled:e}),children:`build small apps live in a chat, with a preview pane next to the thread`}),m.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`vibeables root`,children:(0,P.jsx)(Y,{value:m.root,placeholder:`kraftwerk-data/vibeables`,onChange:e=>N({root:e.target.value})})}),(0,P.jsxs)(W,{children:[`Relative to the project root, one folder per app. Part of the workspace: versioned with it on the git screen, not git-ignored. Every chat gets a `,(0,P.jsx)(`b`,{children:`vibeable`}),` button; the agent then works inside the app folder.`]})]})]})}),(0,P.jsx)(q,{title:`projects`,actions:(0,P.jsx)(B,{size:`sm`,icon:`folder_special`,href:`/projects`,children:`open projects`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:g.enabled,onChange:e=>ne({enabled:e}),children:`gather a goal, its brief, systems of record and links in one folder, and chat inside it`}),g.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`projects root`,children:(0,P.jsx)(Y,{value:g.root,placeholder:`kraftwerk-data/projects`,onChange:e=>ne({root:e.target.value})})}),(0,P.jsx)(W,{children:`Relative to the project root, one folder per project (project.yml, brief.md, state.md, log.md). Part of the workspace: versioned with it on the git screen. A chat opened in a project starts with all of it as context.`})]})]})}),(0,P.jsx)(lu,{}),(0,P.jsx)(nu,{}),(0,P.jsxs)(q,{title:`paths & port`,actions:(0,P.jsx)(`code`,{className:`max-w-[60%] truncate text-2xs text-fg-2`,title:e.configPath,children:e.exists?e.configPath:`${e.configPath} (not created yet)`}),children:[(0,P.jsx)(`div`,{className:`flex flex-col pt-1.5 pb-2.5`,children:re.map(([e,t,n])=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[110px_1fr] items-baseline gap-x-3.5 gap-y-px border-line/55 px-[18px] py-2 [&+&]:border-t`,children:[(0,P.jsx)(tt,{children:e}),(0,P.jsx)(`code`,{className:`text-xs break-all`,children:t}),(0,P.jsx)(`span`,{className:`col-start-2 text-2xs text-fg-2`,children:n})]},e))}),(0,P.jsxs)(W,{className:`px-[18px] pb-3.5`,children:[`Read-only here — edit `,(0,P.jsx)(`code`,{children:`kraftwerk.yml`}),` directly to change these.`]})]})]})}var du={agents:{label:`agents`,icon:`smart_toy`},"agent-skills":{label:`agent skills`,icon:`extension`},projects:{label:`projects`,icon:`folder`},workflows:{label:`workflows`,icon:`account_tree`},knowledge:{label:`knowledge bundles`,icon:`menu_book`},vibeables:{label:`apps`,icon:`web`},channels:{label:`channels`,icon:`forum`},repos:{label:`repositories`,icon:`source`},chats:{label:`chats`,icon:`chat`},runs:{label:`runs`,icon:`play_circle`}};function fu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=(0,v.useCallback)(async()=>{let e=await A.request(`trash.list`).catch(()=>null);e?.ok?t(e.data):r(e?.status===404?`this server has no trash yet — restart it after updating`:`could not load the trash`)},[]);(0,v.useEffect)(()=>{c()},[c]);let l=async(e,t)=>{a(t),r(``),s(null);try{let n=e===`empty`?(await A.request(`trash.empty`)).error:j(await A.request(`trash.${e}`,{body:{id:t}}));if(n)throw Error(n)}catch(e){r(e.message)}finally{a(null),c()}},u=e?.entries??[],d=[...new Set(u.map(e=>e.kind))].sort((e,t)=>Object.keys(du).indexOf(e)-Object.keys(du).indexOf(t));return(0,P.jsxs)(at,{className:`px-6 py-6`,children:[(0,P.jsx)(it,{icon:(0,P.jsx)(F,{name:`delete`,className:`text-[28px] text-fg-2`}),title:`Trash`,sub:e?`${u.length} item${u.length===1?``:`s`}`:void 0,actions:u.length>0&&(o===`*`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(B,{variant:`danger`,icon:`delete_forever`,onClick:()=>void l(`empty`,`*`),children:[`delete all `,u.length,` for good`]}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>s(null),children:`cancel`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete_forever`,disabled:!!i,onClick:()=>s(`*`),children:`empty trash`}))}),n&&(0,P.jsx)(K,{tone:`bad`,children:n}),!e&&!n&&(0,P.jsx)(q,{children:(0,P.jsx)(G,{children:`loading…`})}),e&&u.length===0&&(0,P.jsx)(q,{children:(0,P.jsx)(G,{icon:`delete`,children:`The trash is empty. What you delete lands here first.`})}),d.map(e=>(0,P.jsx)(q,{title:du[e]?.label??e,actions:(0,P.jsxs)(`code`,{className:`text-xs text-fg-2`,children:[`trash/`,e,`/`]}),children:(0,P.jsx)(`div`,{className:`p-1.5`,children:u.filter(t=>t.kind===e).map(t=>(0,P.jsx)(J,{className:`trash-row`,leading:(0,P.jsx)(F,{name:du[e]?.icon??`draft`,className:`ms-sm`}),title:t.name,sub:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`font-mono`,children:t.from}),` · `,(0,P.jsxs)(`span`,{title:t.trashedAt,children:[`deleted `,Ke(t.trashedAt)]})]}),meta:(0,P.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(B,{size:`sm`,variant:`secondary`,icon:`restore_from_trash`,busy:i===t.id,disabled:!!i,onClick:()=>void l(`restore`,t.id),title:`Put it back at ${t.from}`,children:`restore`}),o===t.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete_forever`,onClick:()=>void l(`purge`,t.id),children:`delete for good`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>s(null),children:`cancel`})]}):(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete_forever`,disabled:!!i,onClick:()=>s(t.id),children:`delete`})]})},t.id))})},e)),e&&(0,P.jsxs)(`p`,{className:`m-0 text-sm text-fg-2`,children:[`The trash lives in `,(0,P.jsx)(`code`,{children:e.root}),`, kept out of the workspace git. From the terminal:`,` `,(0,P.jsx)(`code`,{children:`kraftwerk trash`}),`, `,(0,P.jsx)(`code`,{children:`kraftwerk trash restore <id>`}),`, `,(0,P.jsx)(`code`,{children:`kraftwerk trash empty`}),`.`]})]})}var pu=(e,t,n=!1)=>A.url(`files.raw`,{query:{scope:e,path:t,download:n}}),mu=(e,t=``,n)=>`/files/${encodeURIComponent(e)}${t?`/${t.split(`/`).map(encodeURIComponent).join(`/`)}`:``}${n?`?file=${encodeURIComponent(n)}`:``}`,hu=`inline-grid size-7 shrink-0 place-items-center rounded-control text-fg-2 no-underline hover:bg-surface-2 hover:text-fg`,gu=`whitespace-nowrap border-b border-line px-2.5 py-1.5 text-left`;function _u({here:e,onClick:t,children:n}){return(0,P.jsx)(`button`,{type:`button`,onClick:t,className:N(`cursor-pointer rounded-md border-0 bg-transparent px-1 py-0.5 font-[inherit] hover:bg-surface-2 hover:text-fg`,e?`font-semibold text-fg`:`text-fg-2`),children:n})}function vu(e){if(e.type===`dir`)return`folder`;let t=e.mime??``;return t.startsWith(`image/`)?`image`:t===`application/pdf`?`picture_as_pdf`:t.startsWith(`video/`)?`movie`:t.startsWith(`audio/`)?`music_note`:/csv|tab-separated|spreadsheet/.test(t)?`table`:/zip/.test(t)?`folder_zip`:/presentation/.test(t)?`slideshow`:t.startsWith(`text/`)||/json|yaml|xml|wordprocessing/.test(t)?`description`:`draft`}function yu({scope:e,dir:t,file:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(0);(0,v.useEffect)(()=>{A.call(`files.scopes`).then(e=>i(e.scopes),()=>i([]))},[a]);let s=(r??[]).filter(e=>e.scope!==`workspace`);return(0,P.jsxs)(`div`,{className:`runs-screen files-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`files`}),(0,P.jsxs)(Dt,{children:[(r??[]).filter(e=>e.scope===`workspace`).map(t=>(0,P.jsx)(bu,{s:t,active:e===t.scope,icon:`home_storage`},t.scope)),s.length>0&&(0,P.jsx)(Tt,{title:`projects`,divided:!0}),s.map(t=>(0,P.jsx)(bu,{s:t,active:e===t.scope,icon:`folder_special`},t.scope))]})]}),(0,P.jsx)(`div`,{className:`runs-main min-w-0`,children:(0,P.jsx)(xu,{scope:e,dir:t,file:n,onOpen:(t,n)=>z(mu(e,t,n)),onChanged:()=>o(e=>e+1)},e)})]})}function bu({s:e,active:t,icon:n}){return(0,P.jsx)(J,{href:mu(e.scope),active:t,size:`sm`,leading:(0,P.jsx)(F,{name:n,className:`ms-sm`}),title:e.label,sub:(0,P.jsxs)(`span`,{className:`font-mono`,children:[e.root,`/`]}),meta:e.count})}function xu({scope:e,dir:t,file:n,onOpen:r,onChanged:i,compact:a=!1}){let[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(null),x=(0,v.useRef)(null),S=(0,v.useCallback)(async()=>{let n=await A.request(`files.list`,{query:{scope:e,path:t}}).catch(()=>null);if(!n?.ok||!n.data||typeof n.data!=`object`){l(n?.error??`could not load the folder`),s(null);return}l(``),s(n.data)},[e,t]);(0,v.useEffect)(()=>{S();let e=setInterval(()=>void S(),1e4);return()=>clearInterval(e)},[S]);let C=async()=>{await S(),i?.()};async function w(n){let r=[...n];if(r.length){l(``);for(let[n,i]of r.entries()){d(r.length>1?`uploading ${n+1} of ${r.length}…`:`uploading ${i.name}…`);let a=await A.request(`files.upload`,{query:{scope:e,path:t},headers:{"x-file-name":encodeURIComponent(i.name),"content-type":i.type||`application/octet-stream`},body:i}).catch(()=>null);a?.ok||l(a?.error??`could not upload ${i.name}`)}d(``),await C()}}async function T(n){let r=n.trim();if(h(null),!r)return;let i=j(await A.request(`files.mkdir`,{body:{scope:e,path:t?`${t}/${r}`:r}}));i&&l(i),await C()}async function E(i,a){_(null);let o=a.trim();if(!o||o===i.split(`/`).pop())return;let s=i.includes(`/`)?`${i.slice(0,i.lastIndexOf(`/`))}/${o}`:o,c=j(await A.request(`files.move`,{body:{scope:e,from:i,to:s}}));c?l(c):n===i&&r(t,s),await C()}async function D(i){b(null);let a=await A.request(`files.delete`,{query:{scope:e,path:i}}).catch(()=>null);a?.ok||l(a?.error??`could not delete`),n===i&&r(t),await C()}let O=t?t.split(`/`):[],k=n?o?.entries.find(e=>e.path===n):void 0,ee=!(a&&n);return(0,P.jsxs)(`div`,{className:N(`files-browser h-full min-h-0`,a?`flex flex-col gap-2 px-1.5 py-1`:N(`grid gap-4`,n?`grid-cols-1 min-[900px]:grid-cols-[minmax(280px,1fr)_minmax(0,1.3fr)]`:`grid-cols-1`)),children:[ee&&(0,P.jsxs)(`div`,{className:N(`flex min-h-0 flex-col rounded-card outline-2 -outline-offset-2 outline-dashed transition-colors`,f?`bg-accent/5 outline-accent`:`outline-transparent`),onDragOver:e=>{[...e.dataTransfer.types].includes(`Files`)&&(e.preventDefault(),p(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||p(!1)},onDrop:e=>{e.preventDefault(),p(!1),w(e.dataTransfer.files)},children:[(0,P.jsxs)(`div`,{className:N(`flex items-center gap-1`,a?`px-1 pb-1.5 pt-0.5`:`px-0.5 pb-2.5 pt-1`),children:[(0,P.jsxs)(`nav`,{className:N(`flex min-w-0 flex-wrap items-center`,a?`text-sm`:`text-md`),"aria-label":`Folder`,children:[(0,P.jsx)(_u,{here:!O.length,onClick:()=>r(``),children:o?.label??(e===`workspace`?`Workspace`:e.replace(/^project:/,``))}),O.map((e,t)=>(0,P.jsxs)(`span`,{className:`inline-flex items-center text-fg-2`,children:[(0,P.jsx)(F,{name:`chevron_right`,className:`ms-sm`}),(0,P.jsx)(_u,{here:t===O.length-1,onClick:()=>r(O.slice(0,t+1).join(`/`)),children:e})]},t))]}),(0,P.jsx)(`span`,{className:`flex-1`}),a?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(V,{icon:`create_new_folder`,label:`New folder`,size:`sm`,onClick:()=>h(``)}),(0,P.jsx)(V,{icon:`upload`,label:`Upload files`,size:`sm`,onClick:()=>x.current?.click()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`quiet`,size:`sm`,icon:`create_new_folder`,onClick:()=>h(``),title:`New folder`,children:`folder`}),(0,P.jsx)(B,{variant:`quiet`,size:`sm`,icon:`upload`,onClick:()=>x.current?.click(),title:`Upload files`,children:`upload`})]}),(0,P.jsx)(`input`,{ref:x,type:`file`,multiple:!0,hidden:!0,"aria-label":`Upload files`,onChange:e=>e.target.files&&void w(e.target.files)})]}),u&&(0,P.jsx)(K,{children:u}),c&&(0,P.jsx)(K,{tone:`bad`,children:c}),(0,P.jsxs)(`div`,{className:`files-list flex min-h-0 flex-1 flex-col gap-px overflow-y-auto`,role:`list`,children:[m!==null&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5 px-2.5 py-1`,children:[(0,P.jsx)(F,{name:`create_new_folder`,className:`text-[20px] text-fg-2`}),(0,P.jsx)(Y,{className:`h-8`,autoFocus:!0,value:m,placeholder:`folder name`,"aria-label":`Folder name`,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T(m),e.key===`Escape`&&h(null)},onBlur:()=>void T(m)})]}),o?.entries.map(i=>g?.path===i.path?(0,P.jsxs)(`div`,{role:`listitem`,className:`flex items-center gap-2.5 px-2.5 py-1`,children:[(0,P.jsx)(F,{name:vu(i),className:`text-[20px] text-fg-2`}),(0,P.jsx)(Y,{className:`h-8`,autoFocus:!0,value:g.name,"aria-label":`New name`,onChange:e=>_({path:i.path,name:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&E(i.path,g.name),e.key===`Escape`&&_(null)},onBlur:()=>void E(i.path,g.name)})]},i.path):(0,P.jsx)(`div`,{role:`listitem`,children:(0,P.jsx)(J,{className:`files-row`,active:i.path===n,onClick:()=>i.type===`dir`?r(i.path):r(t,i.path),label:i.name,leading:(0,P.jsx)(F,{name:vu(i),className:`text-[20px] text-fg-2`}),title:(0,P.jsx)(`span`,{className:`font-normal`,children:i.name}),titleExtra:i.local?(0,P.jsx)(`span`,{className:`text-xs font-normal text-fg-2`,title:`Over 25 MB: kept out of git, stays on this machine`,children:`local only`}):void 0,meta:(0,P.jsxs)(P.Fragment,{children:[i.type===`dir`?`${i.count??0} file${i.count===1?``:`s`}`:We(i.size??0),!a&&` · ${Ke(i.modifiedAt)}`]}),actions:(0,P.jsxs)(P.Fragment,{children:[i.type===`file`&&(0,P.jsx)(`a`,{className:`inline-grid size-7 place-items-center rounded-control text-fg-2 no-underline hover:bg-surface-2 hover:text-fg`,href:pu(e,i.path,!0),title:`Download`,"aria-label":`Download ${i.name}`,children:(0,P.jsx)(F,{name:`download`,className:`ms-sm`})}),(0,P.jsx)(V,{icon:`edit`,size:`sm`,label:`Rename ${i.name}`,onClick:()=>_({path:i.path,name:i.name})}),y===i.path?(0,P.jsx)(B,{variant:`danger`,size:`sm`,autoFocus:!0,onClick:()=>void D(i.path),onBlur:()=>b(null),children:`move to trash`}):(0,P.jsx)(V,{icon:`delete`,size:`sm`,label:`Delete ${i.name}`,onClick:()=>b(i.path)})]})})},i.path)),o&&o.entries.length===0&&m===null&&(0,P.jsxs)(G,{icon:`upload_file`,action:(0,P.jsxs)(`span`,{className:`font-mono text-2xs opacity-80`,children:[o.root,`/`,t?`${t}/`:``]}),children:[`Drop files here, or`,` `,(0,P.jsx)(`button`,{type:`button`,className:`cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-accent underline`,onClick:()=>x.current?.click(),children:`choose some`}),`.`]}),!o&&!c&&(0,P.jsx)(G,{children:`loading…`})]})]}),n&&(0,P.jsx)(Su,{scope:e,path:n,entry:k,onClose:()=>r(t),compact:a})]})}function Su({scope:e,path:t,entry:n,onClose:r,compact:i}){let a=n?.mime??``,o=t.split(`/`).pop()??t,s=pu(e,t),c=/^text\/|json|yaml|xml/.test(a)&&!/html/.test(a),[l,u]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(u(null),!c||(n?.size??0)>2e6)return;let e=!0;return fetch(s,{cache:`no-store`}).then(e=>e.text()).then(t=>e&&u(t)).catch(()=>{}),()=>{e=!1}},[s,c,n?.size]);let d;return d=n?a.startsWith(`image/`)?(0,P.jsx)(`img`,{className:`m-auto max-h-full max-w-full flex-none object-contain p-4`,src:s,alt:o}):a===`application/pdf`?(0,P.jsx)(`iframe`,{className:N(`w-full border-0 bg-white`,i?`min-h-[60vh]`:`min-h-[70vh]`),src:s,title:o}):a.startsWith(`video/`)?(0,P.jsx)(`video`,{className:`m-auto max-h-full w-full p-4`,src:s,controls:!0}):a.startsWith(`audio/`)?(0,P.jsx)(`audio`,{className:`m-auto w-full p-4`,src:s,controls:!0}):c&&l!==null?/markdown/.test(a)?(0,P.jsx)(`div`,{className:`md-body files-md px-5 py-4`,dangerouslySetInnerHTML:{__html:pa.sanitize(Q.parse(l,{async:!1}))}}):/csv|tab-separated/.test(a)?(0,P.jsx)(Cu,{text:l,tab:/tab-separated/.test(a)}):(0,P.jsx)(`pre`,{className:`files-text m-0 whitespace-pre-wrap p-4 font-mono text-[12.5px] leading-relaxed [overflow-wrap:anywhere]`,children:l}):c&&(n.size??0)<=2e6?(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(G,{icon:vu(n),action:(0,P.jsx)(B,{variant:`primary`,size:`sm`,icon:`download`,href:void 0,onClick:()=>window.location.href=pu(e,t,!0),children:`download`}),children:`No preview for this kind of file.`}):(0,P.jsx)(G,{children:`loading…`}),(0,P.jsxs)(`section`,{className:N(`files-preview flex min-h-0 flex-col overflow-hidden rounded-card border border-line bg-surface`,i&&`min-h-[60vh]`),"aria-label":`Preview of ${o}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-line px-3 py-2`,children:[i&&(0,P.jsx)(V,{icon:`arrow_back`,label:`Back to the folder`,size:`sm`,onClick:r}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-base font-semibold`,title:t,children:o}),n?.size!==void 0&&(0,P.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-2`,children:We(n.size)}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(`a`,{className:hu,href:s,target:`_blank`,rel:`noopener`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,P.jsx)(F,{name:`open_in_new`,className:`ms-sm`})}),(0,P.jsx)(`a`,{className:hu,href:pu(e,t,!0),title:`Download`,"aria-label":`Download`,children:(0,P.jsx)(F,{name:`download`,className:`ms-sm`})}),!i&&(0,P.jsx)(V,{icon:`close`,label:`Close the preview`,size:`sm`,onClick:r})]}),(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-auto [&>*]:flex-1`,children:d})]})}function Cu({text:e,tab:t}){let n=t?` `:e.split(`
222
+ `}return f.substring(0,f.length-1)},c.renderTo2dContext=function(e,t){t||=2;let n=c.getModuleCount();for(let r=0;r<n;r++)for(let i=0;i<n;i++)e.fillStyle=c.isDark(r,i)?`black`:`white`,e.fillRect(i*t,r*t,t,t)},c};Nl.stringToBytes=function(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);t.push(r&255)}return t},Nl.createStringToBytes=function(e,t){let n=function(){let n=Jl(e),r=function(){let e=n.read();if(e==-1)throw`eof`;return e},i=0,a={};for(;;){let e=n.read();if(e==-1)break;let t=r(),o=r(),s=r(),c=String.fromCharCode(e<<8|t);a[c]=o<<8|s,i+=1}if(i!=t)throw i+` != `+t;return a}();return function(e){let t=[];for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i<128)t.push(i);else{let i=n[e.charAt(r)];typeof i==`number`?(i&255)==i?t.push(i):(t.push(i>>>8),t.push(i&255)):t.push(63)}}return t}};var Pl={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Fl={L:1,M:0,Q:3,H:2},Il={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Ll=function(){let e=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t=1335,n=7973,r={},i=function(e){let t=0;for(;e!=0;)t+=1,e>>>=1;return t};return r.getBCHTypeInfo=function(e){let n=e<<10;for(;i(n)-i(t)>=0;)n^=t<<i(n)-i(t);return(e<<10|n)^21522},r.getBCHTypeNumber=function(e){let t=e<<12;for(;i(t)-i(n)>=0;)t^=n<<i(t)-i(n);return e<<12|t},r.getPatternPosition=function(t){return e[t-1]},r.getMaskFunction=function(e){switch(e){case Il.PATTERN000:return function(e,t){return(e+t)%2==0};case Il.PATTERN001:return function(e,t){return e%2==0};case Il.PATTERN010:return function(e,t){return t%3==0};case Il.PATTERN011:return function(e,t){return(e+t)%3==0};case Il.PATTERN100:return function(e,t){return(Math.floor(e/2)+Math.floor(t/3))%2==0};case Il.PATTERN101:return function(e,t){return e*t%2+e*t%3==0};case Il.PATTERN110:return function(e,t){return(e*t%2+e*t%3)%2==0};case Il.PATTERN111:return function(e,t){return(e*t%3+(e+t)%2)%2==0};default:throw`bad maskPattern:`+e}},r.getErrorCorrectPolynomial=function(e){let t=zl([1],0);for(let n=0;n<e;n+=1)t=t.multiply(zl([1,Rl.gexp(n)],0));return t},r.getLengthInBits=function(e,t){if(1<=t&&t<10)switch(e){case Pl.MODE_NUMBER:return 10;case Pl.MODE_ALPHA_NUM:return 9;case Pl.MODE_8BIT_BYTE:return 8;case Pl.MODE_KANJI:return 8;default:throw`mode:`+e}else if(t<27)switch(e){case Pl.MODE_NUMBER:return 12;case Pl.MODE_ALPHA_NUM:return 11;case Pl.MODE_8BIT_BYTE:return 16;case Pl.MODE_KANJI:return 10;default:throw`mode:`+e}else if(t<41)switch(e){case Pl.MODE_NUMBER:return 14;case Pl.MODE_ALPHA_NUM:return 13;case Pl.MODE_8BIT_BYTE:return 16;case Pl.MODE_KANJI:return 12;default:throw`mode:`+e}else throw`type:`+t},r.getLostPoint=function(e){let t=e.getModuleCount(),n=0;for(let r=0;r<t;r+=1)for(let i=0;i<t;i+=1){let a=0,o=e.isDark(r,i);for(let n=-1;n<=1;n+=1)if(!(r+n<0||t<=r+n))for(let s=-1;s<=1;s+=1)i+s<0||t<=i+s||(n!=0||s!=0)&&o==e.isDark(r+n,i+s)&&(a+=1);a>5&&(n+=3+a-5)}for(let r=0;r<t-1;r+=1)for(let i=0;i<t-1;i+=1){let t=0;e.isDark(r,i)&&(t+=1),e.isDark(r+1,i)&&(t+=1),e.isDark(r,i+1)&&(t+=1),e.isDark(r+1,i+1)&&(t+=1),(t==0||t==4)&&(n+=3)}for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(let r=0;r<t;r+=1)for(let i=0;i<t-6;i+=1)e.isDark(i,r)&&!e.isDark(i+1,r)&&e.isDark(i+2,r)&&e.isDark(i+3,r)&&e.isDark(i+4,r)&&!e.isDark(i+5,r)&&e.isDark(i+6,r)&&(n+=40);let r=0;for(let n=0;n<t;n+=1)for(let i=0;i<t;i+=1)e.isDark(i,n)&&(r+=1);let i=Math.abs(100*r/t/t-50)/5;return n+=i*10,n},r}(),Rl=function(){let e=Array(256),t=Array(256);for(let t=0;t<8;t+=1)e[t]=1<<t;for(let t=8;t<256;t+=1)e[t]=e[t-4]^e[t-5]^e[t-6]^e[t-8];for(let n=0;n<255;n+=1)t[e[n]]=n;let n={};return n.glog=function(e){if(e<1)throw`glog(`+e+`)`;return t[e]},n.gexp=function(t){for(;t<0;)t+=255;for(;t>=256;)t-=255;return e[t]},n}(),zl=function(e,t){if(e.length===void 0)throw e.length+`/`+t;let n=function(){let n=0;for(;n<e.length&&e[n]==0;)n+=1;let r=Array(e.length-n+t);for(let t=0;t<e.length-n;t+=1)r[t]=e[t+n];return r}(),r={};return r.getAt=function(e){return n[e]},r.getLength=function(){return n.length},r.multiply=function(e){let t=Array(r.getLength()+e.getLength()-1);for(let n=0;n<r.getLength();n+=1)for(let i=0;i<e.getLength();i+=1)t[n+i]^=Rl.gexp(Rl.glog(r.getAt(n))+Rl.glog(e.getAt(i)));return zl(t,0)},r.mod=function(e){if(r.getLength()-e.getLength()<0)return r;let t=Rl.glog(r.getAt(0))-Rl.glog(e.getAt(0)),n=Array(r.getLength());for(let e=0;e<r.getLength();e+=1)n[e]=r.getAt(e);for(let r=0;r<e.getLength();r+=1)n[r]^=Rl.gexp(Rl.glog(e.getAt(r))+t);return zl(n,0).mod(e)},r},Bl=function(){let e=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(e,t){let n={};return n.totalCount=e,n.dataCount=t,n},n={},r=function(t,n){switch(n){case Fl.L:return e[(t-1)*4+0];case Fl.M:return e[(t-1)*4+1];case Fl.Q:return e[(t-1)*4+2];case Fl.H:return e[(t-1)*4+3];default:return}};return n.getRSBlocks=function(e,n){let i=r(e,n);if(i===void 0)throw`bad rs block @ typeNumber:`+e+`/errorCorrectionLevel:`+n;let a=i.length/3,o=[];for(let e=0;e<a;e+=1){let n=i[e*3+0],r=i[e*3+1],a=i[e*3+2];for(let e=0;e<n;e+=1)o.push(t(r,a))}return o},n}(),Vl=function(){let e=[],t=0,n={};return n.getBuffer=function(){return e},n.getAt=function(t){let n=Math.floor(t/8);return(e[n]>>>7-t%8&1)==1},n.put=function(e,t){for(let r=0;r<t;r+=1)n.putBit((e>>>t-r-1&1)==1)},n.getLengthInBits=function(){return t},n.putBit=function(n){let r=Math.floor(t/8);e.length<=r&&e.push(0),n&&(e[r]|=128>>>t%8),t+=1},n},Hl=function(e){let t=Pl.MODE_NUMBER,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+2<t.length;)e.put(i(t.substring(r,r+3)),10),r+=3;r<t.length&&(t.length-r==1?e.put(i(t.substring(r,r+1)),4):t.length-r==2&&e.put(i(t.substring(r,r+2)),7))};let i=function(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*10+a(e.charAt(n));return t},a=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;throw`illegal char :`+e};return r},Ul=function(e){let t=Pl.MODE_ALPHA_NUM,n=e,r={};r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){let t=n,r=0;for(;r+1<t.length;)e.put(i(t.charAt(r))*45+i(t.charAt(r+1)),11),r+=2;r<t.length&&e.put(i(t.charAt(r)),6)};let i=function(e){if(`0`<=e&&e<=`9`)return e.charCodeAt(0)-48;if(`A`<=e&&e<=`Z`)return e.charCodeAt(0)-65+10;switch(e){case` `:return 36;case`$`:return 37;case`%`:return 38;case`*`:return 39;case`+`:return 40;case`-`:return 41;case`.`:return 42;case`/`:return 43;case`:`:return 44;default:throw`illegal char :`+e}};return r},Wl=function(e){let t=Pl.MODE_8BIT_BYTE,n=Nl.stringToBytes(e),r={};return r.getMode=function(){return t},r.getLength=function(e){return n.length},r.write=function(e){for(let t=0;t<n.length;t+=1)e.put(n[t],8)},r},Gl=function(e){let t=Pl.MODE_KANJI,n=Nl.stringToBytes;(function(e,t){let r=n(e);if(r.length!=2||(r[0]<<8|r[1])!=t)throw`sjis not supported.`})(`友`,38726);let r=n(e),i={};return i.getMode=function(){return t},i.getLength=function(e){return~~(r.length/2)},i.write=function(e){let t=r,n=0;for(;n+1<t.length;){let r=(255&t[n])<<8|255&t[n+1];if(33088<=r&&r<=40956)r-=33088;else if(57408<=r&&r<=60351)r-=49472;else throw`illegal char at `+(n+1)+`/`+r;r=(r>>>8&255)*192+(r&255),e.put(r,13),n+=2}if(n<t.length)throw`illegal char at `+(n+1)},i},Kl=function(){let e=[],t={};return t.writeByte=function(t){e.push(t&255)},t.writeShort=function(e){t.writeByte(e),t.writeByte(e>>>8)},t.writeBytes=function(e,n,r){n||=0,r||=e.length;for(let i=0;i<r;i+=1)t.writeByte(e[i+n])},t.writeString=function(e){for(let n=0;n<e.length;n+=1)t.writeByte(e.charCodeAt(n))},t.toByteArray=function(){return e},t.toString=function(){let t=``;t+=`[`;for(let n=0;n<e.length;n+=1)n>0&&(t+=`,`),t+=e[n];return t+=`]`,t},t},ql=function(){let e=0,t=0,n=0,r=``,i={},a=function(e){r+=String.fromCharCode(o(e&63))},o=function(e){if(e<0)throw`n:`+e;if(e<26)return 65+e;if(e<52)return 97+(e-26);if(e<62)return 48+(e-52);if(e==62)return 43;if(e==63)return 47;throw`n:`+e};return i.writeByte=function(r){for(e=e<<8|r&255,t+=8,n+=1;t>=6;)a(e>>>t-6),t-=6},i.flush=function(){if(t>0&&(a(e<<6-t),e=0,t=0),n%3!=0){let e=3-n%3;for(let t=0;t<e;t+=1)r+=`=`}},i.toString=function(){return r},i},Jl=function(e){let t=e,n=0,r=0,i=0,a={};a.read=function(){for(;i<8;){if(n>=t.length){if(i==0)return-1;throw`unexpected end of file./`+i}let e=t.charAt(n);if(n+=1,e==`=`)return i=0,-1;e.match(/^\s$/)||(r=r<<6|o(e.charCodeAt(0)),i+=6)}let e=r>>>i-8&255;return i-=8,e};let o=function(e){if(65<=e&&e<=90)return e-65;if(97<=e&&e<=122)return e-97+26;if(48<=e&&e<=57)return e-48+52;if(e==43)return 62;if(e==47)return 63;throw`c:`+e};return a},Yl=function(e,t){let n=e,r=t,i=Array(e*t),a={};a.setPixel=function(e,t,r){i[t*n+e]=r},a.write=function(e){e.writeString(`GIF87a`),e.writeShort(n),e.writeShort(r),e.writeByte(128),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(0),e.writeByte(255),e.writeByte(255),e.writeByte(255),e.writeString(`,`),e.writeShort(0),e.writeShort(0),e.writeShort(n),e.writeShort(r),e.writeByte(0);let t=s(2);e.writeByte(2);let i=0;for(;t.length-i>255;)e.writeByte(255),e.writeBytes(t,i,255),i+=255;e.writeByte(t.length-i),e.writeBytes(t,i,t.length-i),e.writeByte(0),e.writeString(`;`)};let o=function(e){let t=e,n=0,r=0,i={};return i.write=function(e,i){if(e>>>i)throw`length over`;for(;n+i>=8;)t.writeByte(255&(e<<n|r)),i-=8-n,e>>>=8-n,r=0,n=0;r=e<<n|r,n+=i},i.flush=function(){n>0&&t.writeByte(r)},i},s=function(e){let t=1<<e,n=(1<<e)+1,r=e+1,a=c();for(let e=0;e<t;e+=1)a.add(String.fromCharCode(e));a.add(String.fromCharCode(t)),a.add(String.fromCharCode(n));let s=Kl(),l=o(s);l.write(t,r);let u=0,d=String.fromCharCode(i[u]);for(u+=1;u<i.length;){let e=String.fromCharCode(i[u]);u+=1,a.contains(d+e)?d+=e:(l.write(a.indexOf(d),r),a.size()<4095&&(a.size()==1<<r&&(r+=1),a.add(d+e)),d=e)}return l.write(a.indexOf(d),r),l.write(n,r),l.flush(),s.toByteArray()},c=function(){let e={},t=0,n={};return n.add=function(r){if(n.contains(r))throw`dup key:`+r;e[r]=t,t+=1},n.size=function(){return t},n.indexOf=function(t){return e[t]},n.contains=function(t){return e[t]!==void 0},n};return a},Xl=function(e,t,n){let r=Yl(e,t);for(let i=0;i<t;i+=1)for(let t=0;t<e;t+=1)r.setPixel(t,i,n(t,i));let i=Kl();r.write(i);let a=ql(),o=i.toByteArray();for(let e=0;e<o.length;e+=1)a.writeByte(o[e]);return a.flush(),`data:image/gif;base64,`+a};Nl.stringToBytes;function Zl(){let e=navigator.userAgent,t=/iPhone/.test(e)?`iPhone`:/iPad/.test(e)?`iPad`:/Android/.test(e)?`Android`:/Mac/.test(e)?`Mac`:/Windows/.test(e)?`Windows`:/Linux/.test(e)?`Linux`:`device`,n=/Edg\//.test(e)?`Edge`:/Firefox\//.test(e)?`Firefox`:/Chrome\//.test(e)?`Chrome`:/Safari\//.test(e)?`Safari`:``;return n?`${t} · ${n}`:t}function Ql(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(Zl),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``),c=async()=>{a(!0),s(``);let t=await A.request(`devices.pair`,{body:{code:e,name:n}}).catch(()=>null);if(t?.ok)return location.reload();a(!1),s(t?j(t):`could not reach kraftwerk`)};return(0,P.jsxs)(`main`,{className:`mx-auto flex min-h-screen w-full max-w-[420px] flex-col justify-center gap-5 px-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,P.jsx)(F,{name:`phonelink_lock`,className:`text-[32px] text-fg-2`}),(0,P.jsx)(rt,{size:`lg`,children:`Pair this device`}),(0,P.jsxs)(`p`,{className:`m-0 text-sm leading-relaxed text-fg-2`,children:[`This kraftwerk runs on another machine. On that machine, run `,(0,P.jsx)(`code`,{children:`kraftwerk devices pair`}),` or open settings → devices, and enter the code here. You pair once; it stays paired until it is removed there.`]})]}),(0,P.jsxs)(`form`,{className:`flex flex-col gap-3.5`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,P.jsx)(X,{label:`pairing code`,children:(0,P.jsx)(Y,{value:e,onChange:e=>t(e.target.value.toUpperCase()),placeholder:`ABCD-EF23`,autoFocus:!0,autoComplete:`one-time-code`,autoCapitalize:`characters`,"aria-label":`pairing code`,className:`font-mono tracking-widest`})}),(0,P.jsx)(X,{label:`name of this device`,hint:`how it shows in the list of paired devices`,children:(0,P.jsx)(Y,{value:n,onChange:e=>r(e.target.value),"aria-label":`device name`})}),o&&(0,P.jsx)(K,{tone:`bad`,children:o}),(0,P.jsx)(B,{variant:`primary`,type:`submit`,busy:i,disabled:!e.trim(),children:`pair`})]})]})}function $l({children:e}){return O()?(0,P.jsx)(Ql,{}):(0,P.jsx)(P.Fragment,{children:e})}function eu({text:e,size:t=176}){let n=(0,v.useMemo)(()=>{let t=Nl(0,`M`);t.addData(e),t.make();let n=t.getModuleCount(),r=``;for(let e=0;e<n;e++)for(let i=0;i<n;i++)t.isDark(e,i)&&(r+=`M${i+4} ${e+4}h1v1h-1z`);return{d:r,n:n+8}},[e]);return(0,P.jsx)(`svg`,{viewBox:`0 0 ${n.n} ${n.n}`,width:t,height:t,role:`img`,"aria-label":`pairing QR code`,className:`rounded-lg bg-white text-black`,shapeRendering:`crispEdges`,children:(0,P.jsx)(`path`,{d:n.d,fill:`currentColor`})})}function tu({onError:e}){let t=M(`devices.relay`,{},{interval:1e4}),[n,r]=(0,v.useState)(!1);if(!t)return null;let i=async()=>{r(!0);let n=await A.request(`devices.setRelay`,{body:{enabled:!t.enabled}}).catch(()=>null);r(!1),n&&!n.ok&&e(j(n))},a=t.enabled?t.daemon?t.state===`connected`?`connected${t.clients?` · ${t.clients} device${t.clients===1?``:`s`} now`:``}`:t.state===`error`?`not connected: ${t.error??`unknown error`}`:`connecting…`:"on — the daemon connects it (this kraftwerk is not the daemon: `kraftwerk daemon`)":`off — devices reach this machine on your network only`;return(0,P.jsx)(lt,{children:(0,P.jsx)(ct,{icon:t.enabled?`public`:`public_off`,title:`reach this machine from anywhere`,"data-relay":t.enabled?t.state:`off`,action:(0,P.jsx)(B,{size:`sm`,busy:n,variant:t.enabled?void 0:`primary`,onClick:()=>void i(),children:t.enabled?`turn off`:`turn on`}),children:(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[a,t.enabled&&t.fingerprint&&(0,P.jsxs)(P.Fragment,{children:[` · machine key `,(0,P.jsx)(`code`,{children:t.fingerprint})]}),` — through the kraftwerk relay, end to end encrypted: it cannot read along`]})})})}function nu(){let e=M(`devices.self`,{},{interval:6e4}),t=e?.trust===`local`,n=M(`devices.list`,t?{}:null,{interval:15e3}),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(``);if(!e)return null;if(!t)return(0,P.jsx)(q,{title:`devices`,children:(0,P.jsx)(lt,{children:(0,P.jsx)(ct,{icon:`phonelink_lock`,title:`this browser is paired as “${e.device?.name}”`,children:(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`devices are managed on the machine kraftwerk runs on`})})})});let s=async()=>{o(``);let e=await A.request(`devices.code`).catch(()=>null);e?.ok?i(e.data):o(e?j(e):`could not make a code`)},c=async(e,t)=>{if(!window.confirm(`Unpair “${t}”? It loses access at once.`))return;let n=await A.request(`devices.revoke`,{id:e}).catch(()=>null);n&&!n.ok&&o(j(n))};return(0,P.jsxs)(q,{title:`devices`,actions:(0,P.jsx)(B,{size:`sm`,icon:`add_link`,onClick:()=>void s(),children:`pair a device`}),children:[r&&(0,P.jsxs)(yt,{className:`border-b border-line`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-3`,children:[(0,P.jsx)(`span`,{className:`font-mono text-[22px] font-semibold tracking-widest text-fg`,"aria-label":`pairing code`,children:r.code}),(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[`once, until `,new Date(r.expiresAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})]})]}),r.remote&&(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,P.jsx)(eu,{text:r.remote}),(0,P.jsxs)(`span`,{className:`max-w-[28ch] text-sm text-fg-2`,children:[`From anywhere: scan this with the phone's camera, or open `,(0,P.jsx)(`a`,{href:r.remote,target:`_blank`,rel:`noreferrer`,children:`the pairing link`}),` on it. It carries the code — treat it like a password.`]})]}),r.urls.length?(0,P.jsxs)(`span`,{className:`text-sm text-fg-2`,children:[`On the device, open `,r.urls.map((e,t)=>(0,P.jsxs)(`span`,{children:[t>0&&` or `,(0,P.jsx)(`code`,{children:e})]},e)),` and enter the code.`]}):r.remote?null:(0,P.jsxs)(`span`,{className:`text-sm text-fg-2`,children:[`This kraftwerk only listens on this machine. Restart it with `,(0,P.jsx)(`code`,{children:`kraftwerk ui --lan`}),` to reach it from your network (or use a tunnel), then enter the code on the device — or turn on “reach this machine from anywhere”.`]})]}),(0,P.jsx)(tu,{onError:o}),a&&(0,P.jsx)(`div`,{className:`px-[18px] pt-3`,children:(0,P.jsx)(K,{tone:`bad`,children:a})}),n&&n.devices.length===0&&!r&&(0,P.jsx)(G,{icon:`devices`,children:`no paired devices — a phone or another computer can use this kraftwerk once paired`}),n&&n.devices.length>0&&(0,P.jsx)(lt,{children:n.devices.map(e=>(0,P.jsx)(ct,{icon:`devices`,title:e.name,"data-device":e.id,action:(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`link_off`,onClick:()=>void c(e.id,e.name),"aria-label":`unpair ${e.name}`,children:`unpair`}),children:(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[`paired `,Ke(e.createdAt),` · `,e.lastSeenAt?`last seen ${Ke(e.lastSeenAt)}`:`not used yet`]})},e.id))})]})}var ru={enabled:!1,remote:`origin`,branch:``,interval:`300`,autosync:`pull`};function iu(e){let t=e.config.git;return t?{enabled:t.enabled!==!1,remote:t.remote??ru.remote,branch:t.branch??``,interval:String(t.interval??ru.interval),autosync:t.autosync??ru.autosync}:ru}var au={enabled:!1,root:``};function ou(e){let t=e.config.repos;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function su(e){let t=e.config.vibeables;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function cu(e){let t=e.config.projects;return t?{enabled:t.enabled!==!1,root:t.root??``}:au}function lu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{let e=!0,n=()=>A.call(`meta.get`).then(n=>e&&n.cloud&&t(n.cloud)).catch(()=>{});n();let r=setInterval(n,1e4);return()=>{e=!1,clearInterval(r)}},[]),!e)return null;let i=e.state===`connected`?e.account?`claimed`:`unclaimed`:e.state,a=e.state===`connected`&&e.account?`ok`:e.state===`error`?`bad`:`neutral`;return(0,P.jsx)(q,{title:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[`cloud `,(0,P.jsx)(U,{tone:a,children:i})]}),actions:e.url&&(0,P.jsxs)(`a`,{className:Qe(`secondary`,`sm`),href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`cloud`,className:`ms-sm`}),` open the cloud`]}),children:(0,P.jsxs)(yt,{children:[e.state===`off`&&(0,P.jsxs)(W,{children:[`Off — `,e.reason??`turned off for this machine`,`. The daemon registers the machine with the kraftwerk cloud, so its owner sees its workspaces running from anywhere; `,(0,P.jsx)(`code`,{children:`kraftwerk cloud on`}),` and `,(0,P.jsx)(`code`,{children:`kraftwerk login`}),` in a terminal turn it on and claim it.`]}),e.state===`connecting`&&(0,P.jsxs)(W,{children:[`Registering with `,e.url,` …`]}),e.state===`error`&&(0,P.jsxs)(W,{children:[`Could not reach `,e.url,`: `,e.error,`. Retrying every `,e.interval??60,`s — the UI works as before meanwhile.`]}),e.state===`connected`&&e.account&&(0,P.jsxs)(W,{children:[`This machine`,e.machine?(0,P.jsxs)(P.Fragment,{children:[` (`,(0,P.jsx)(`code`,{children:e.machine}),`)`]}):null,` is registered at `,(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}),` under `,(0,P.jsx)(`strong`,{children:e.account}),`. Last heartbeat `,e.lastSeen?new Date(e.lastSeen).toLocaleTimeString():`pending`,`.`]}),e.state===`connected`&&!e.account&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(W,{children:[`This machine is registered at `,(0,P.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}),`, not yet under an account (no folder paths are sent until it is). Sign in there and enter this code — or open the link, or run `,(0,P.jsx)(`code`,{children:`kraftwerk login`}),`:`]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,P.jsx)(`code`,{className:`rounded-control border border-line bg-surface-2 px-3 py-1.5 font-mono text-lg tracking-[0.12em] text-fg`,children:e.claimCode??`…`}),e.claimCode&&(0,P.jsx)(B,{size:`sm`,icon:`content_copy`,onClick:()=>{navigator.clipboard.writeText(e.claimCode),r(!0),setTimeout(()=>r(!1),1500)},children:n?`copied`:`copy`}),e.claimUrl&&(0,P.jsxs)(`a`,{className:Qe(`primary`,`sm`),href:e.claimUrl,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(F,{name:`link`,className:`ms-sm`}),` claim in the cloud`]})]}),(0,P.jsxs)(W,{children:[`A claim made there reaches this machine with the next heartbeat (every `,e.interval??60,`s). To keep this workspace out of the cloud, set `,(0,P.jsx)(`code`,{children:`cloud.enabled: false`}),` in kraftwerk.yml.`]})]}),e.state!==`off`&&e.included===!1&&(0,P.jsxs)(W,{children:[`This workspace is left out of the machine's record: `,(0,P.jsx)(`code`,{children:`cloud.enabled: false`}),` in kraftwerk.yml.`]})]})})}function uu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)([]),[u,d]=(0,v.useState)(ru),[f,p]=(0,v.useState)(au),[m,h]=(0,v.useState)(au),[g,_]=(0,v.useState)(au),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(!1),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(``),D=M(`identity.get`,{},{interval:6e4});(0,v.useEffect)(()=>{A.call(`settings.get`).then(e=>{t(e),r(e.config.name??``),a(e.config.icon??``),s(e.config.color??``),l(e.config.switcher??[]),d(iu(e)),p(ou(e)),h(su(e)),_(cu(e))}).catch(()=>E(`could not load settings`))},[]);let O=()=>{b(!0),w(!1),E(``)};async function k(){S(!0),E(``);try{let e=await A.request(`settings.save`,{body:{name:n,icon:i,color:o,switcher:c,git:{...u,interval:u.interval===``?void 0:Number(u.interval)},repos:f,vibeables:m,projects:g}});if(!e.ok)throw Error(e.error||`save failed`);let r=e.data;t(r),l(r.config.switcher??[]),d(iu(r)),p(ou(r)),h(su(r)),_(cu(r)),b(!1),w(!0)}catch(e){E(e.message)}finally{S(!1)}}let ee=(e,t)=>{l(n=>n.map((n,r)=>r===e?{...n,...t}:n)),O()},te=e=>{d(t=>({...t,...e})),O()},j=e=>{p(t=>({...t,...e})),O()},N=e=>{h(t=>({...t,...e})),O()},ne=e=>{_(t=>({...t,...e})),O()};if(!e)return(0,P.jsx)(G,{children:T||`loading…`});let re=[[`identity`,D?.identity??`…`,`this machine — the runner routines name in runs_on (kraftwerk whoami to rename)`],[`port`,String(e.resolved.port),`kraftwerk ui listens here (CLI --port wins)`],[`workflows`,e.resolved.workflowsRoot??`— none found`,`workflow definitions`],[`output`,e.resolved.outputDir,`run artifacts`],[`knowledge`,e.config.knowledge??`knowledge`,`OKF knowledge bundles`],[`agents`,e.config.agents??`agents`,`agent definitions`],[`skills`,e.config.skills??`skills`,`workspace skills`]];return(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[860px] flex-col gap-4`,children:[(0,P.jsx)(it,{icon:(0,P.jsx)(F,{name:`settings`,className:`text-[28px] text-fg-2`}),title:`Settings`,actions:(0,P.jsxs)(P.Fragment,{children:[T&&(0,P.jsx)(K,{tone:`bad`,children:T}),C&&!y&&(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12.5px] text-ok`,children:[(0,P.jsx)(F,{name:`check`,className:`ms-sm`}),` saved`]}),(0,P.jsx)(B,{variant:`primary`,busy:x,disabled:!y,onClick:()=>void k(),children:x?`saving…`:`save changes`})]})}),(0,P.jsx)(q,{title:`workspace`,children:(0,P.jsxs)(yt,{children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`icon`,className:`w-[90px]`,children:(0,P.jsx)(Y,{value:i,placeholder:`🤖`,onChange:e=>{a(e.target.value),O()}})}),(0,P.jsx)(X,{label:`name`,className:`min-w-40 flex-1`,children:(0,P.jsx)(Y,{value:n,placeholder:`my workspace`,onChange:e=>{r(e.target.value),O()}})}),(0,P.jsxs)(`label`,{className:`flex w-[130px] flex-col gap-1.5`,title:`Accent in the workspace switcher; empty = derived from the folder`,children:[(0,P.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:`color`}),(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,P.jsx)(`input`,{type:`color`,"aria-label":`pick a color`,className:`h-9 w-10 flex-none cursor-pointer rounded-control border border-line bg-surface p-0.5`,value:/^#[0-9a-f]{6}$/i.test(o)?o:`#888888`,onChange:e=>{s(e.target.value),O()}}),(0,P.jsx)(Y,{className:`min-w-0 px-2`,value:o,placeholder:`auto`,onChange:e=>{s(e.target.value),O()}})]})]})]}),(0,P.jsx)(W,{children:`Shown in the header, browser tab and to other workspaces discovering this one.`})]})}),(0,P.jsx)(q,{title:`workspace switcher`,actions:(0,P.jsx)(B,{size:`sm`,icon:`add`,onClick:()=>{l(e=>[...e,{name:``,url:`http://localhost:`}]),O()},children:`add entry`}),children:(0,P.jsxs)(yt,{children:[c.length===0&&(0,P.jsx)(W,{children:`No manual entries.`}),c.map((e,t)=>(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`icon`,className:`w-[70px]`,children:(0,P.jsx)(Y,{value:e.icon??``,placeholder:`•`,onChange:e=>ee(t,{icon:e.target.value})})}),(0,P.jsx)(X,{label:`name`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:e.name,placeholder:`other workspace`,onChange:e=>ee(t,{name:e.target.value})})}),(0,P.jsx)(X,{label:`url`,className:`min-w-40 flex-[1.4]`,children:(0,P.jsx)(Y,{value:e.url,placeholder:`http://localhost:1982`,onChange:e=>ee(t,{url:e.target.value})})}),(0,P.jsx)(V,{icon:`close`,label:`remove entry`,className:`mb-0.5`,onClick:()=>{l(e=>e.filter((e,n)=>n!==t)),O()}})]},t)),(0,P.jsx)(W,{children:`Running workspaces on this machine are discovered automatically — manual entries are for remote instances or extra links.`})]})}),(0,P.jsx)(q,{title:`git sync`,actions:(0,P.jsx)(B,{size:`sm`,icon:`account_tree`,href:`/git`,children:`open git`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:u.enabled,onChange:e=>te({enabled:e}),children:`sync workflows, knowledge, agents and skills with a git remote`}),u.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(bt,{children:[(0,P.jsx)(X,{label:`remote`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:u.remote,placeholder:`origin`,onChange:e=>te({remote:e.target.value})})}),(0,P.jsx)(X,{label:`branch`,className:`min-w-32 flex-1`,children:(0,P.jsx)(Y,{value:u.branch,placeholder:`checked-out branch`,onChange:e=>te({branch:e.target.value})})}),(0,P.jsx)(X,{label:`interval (s)`,className:`w-[120px]`,children:(0,P.jsx)(Y,{type:`number`,min:0,step:1,value:u.interval,placeholder:`300`,onChange:e=>te({interval:e.target.value})})}),(0,P.jsx)(X,{label:`autosync`,className:`w-[150px]`,children:(0,P.jsxs)(vt,{value:u.autosync,onChange:e=>te({autosync:e.target.value}),children:[(0,P.jsx)(`option`,{value:`pull`,children:`fetch and pull`}),(0,P.jsx)(`option`,{value:`off`,children:`fetch only`})]})})]}),(0,P.jsx)(W,{children:`The interval fetches in the background (0 turns the timer off); with autosync on it also fast-forwards when behind and nothing is modified locally. Commit and push stay manual on the git screen.`})]})]})}),(0,P.jsx)(q,{title:`repositories`,actions:(0,P.jsx)(B,{size:`sm`,icon:`source`,href:`/repos`,children:`open repositories`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:f.enabled,onChange:e=>j({enabled:e}),children:`keep git repositories the agents work on under one folder`}),f.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`repos root`,children:(0,P.jsx)(Y,{value:f.root,placeholder:`repos`,onChange:e=>j({root:e.target.value})})}),(0,P.jsxs)(W,{children:[`Relative to the project root. Saving creates the folder and adds it to .gitignore; every agent gets the list of clones as context and can add more with `,(0,P.jsx)(`code`,{children:`kraftwerk repos add`}),`.`]})]})]})}),(0,P.jsx)(q,{title:`apps (vibeables)`,actions:(0,P.jsx)(B,{size:`sm`,icon:`web`,href:`/vibeables`,children:`open apps`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:m.enabled,onChange:e=>N({enabled:e}),children:`build small apps live in a chat, with a preview pane next to the thread`}),m.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`vibeables root`,children:(0,P.jsx)(Y,{value:m.root,placeholder:`kraftwerk-data/vibeables`,onChange:e=>N({root:e.target.value})})}),(0,P.jsxs)(W,{children:[`Relative to the project root, one folder per app. Part of the workspace: versioned with it on the git screen, not git-ignored. Every chat gets a `,(0,P.jsx)(`b`,{children:`vibeable`}),` button; the agent then works inside the app folder.`]})]})]})}),(0,P.jsx)(q,{title:`projects`,actions:(0,P.jsx)(B,{size:`sm`,icon:`folder_special`,href:`/projects`,children:`open projects`}),children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:g.enabled,onChange:e=>ne({enabled:e}),children:`gather a goal, its brief, systems of record and links in one folder, and chat inside it`}),g.enabled&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(X,{label:`projects root`,children:(0,P.jsx)(Y,{value:g.root,placeholder:`kraftwerk-data/projects`,onChange:e=>ne({root:e.target.value})})}),(0,P.jsx)(W,{children:`Relative to the project root, one folder per project (project.yml, brief.md, state.md, log.md). Part of the workspace: versioned with it on the git screen. A chat opened in a project starts with all of it as context.`})]})]})}),(0,P.jsx)(lu,{}),(0,P.jsx)(nu,{}),(0,P.jsxs)(q,{title:`paths & port`,actions:(0,P.jsx)(`code`,{className:`max-w-[60%] truncate text-2xs text-fg-2`,title:e.configPath,children:e.exists?e.configPath:`${e.configPath} (not created yet)`}),children:[(0,P.jsx)(`div`,{className:`flex flex-col pt-1.5 pb-2.5`,children:re.map(([e,t,n])=>(0,P.jsxs)(`div`,{className:`grid grid-cols-[110px_1fr] items-baseline gap-x-3.5 gap-y-px border-line/55 px-[18px] py-2 [&+&]:border-t`,children:[(0,P.jsx)(tt,{children:e}),(0,P.jsx)(`code`,{className:`text-xs break-all`,children:t}),(0,P.jsx)(`span`,{className:`col-start-2 text-2xs text-fg-2`,children:n})]},e))}),(0,P.jsxs)(W,{className:`px-[18px] pb-3.5`,children:[`Read-only here — edit `,(0,P.jsx)(`code`,{children:`kraftwerk.yml`}),` directly to change these.`]})]})]})}var du={agents:{label:`agents`,icon:`smart_toy`},"agent-skills":{label:`agent skills`,icon:`extension`},projects:{label:`projects`,icon:`folder`},workflows:{label:`workflows`,icon:`account_tree`},knowledge:{label:`knowledge bundles`,icon:`menu_book`},vibeables:{label:`apps`,icon:`web`},channels:{label:`channels`,icon:`forum`},repos:{label:`repositories`,icon:`source`},chats:{label:`chats`,icon:`chat`},runs:{label:`runs`,icon:`play_circle`}};function fu(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=(0,v.useCallback)(async()=>{let e=await A.request(`trash.list`).catch(()=>null);e?.ok?t(e.data):r(e?.status===404?`this server has no trash yet — restart it after updating`:`could not load the trash`)},[]);(0,v.useEffect)(()=>{c()},[c]);let l=async(e,t)=>{a(t),r(``),s(null);try{let n=e===`empty`?(await A.request(`trash.empty`)).error:j(await A.request(`trash.${e}`,{body:{id:t}}));if(n)throw Error(n)}catch(e){r(e.message)}finally{a(null),c()}},u=e?.entries??[],d=[...new Set(u.map(e=>e.kind))].sort((e,t)=>Object.keys(du).indexOf(e)-Object.keys(du).indexOf(t));return(0,P.jsxs)(at,{className:`px-6 py-6`,children:[(0,P.jsx)(it,{icon:(0,P.jsx)(F,{name:`delete`,className:`text-[28px] text-fg-2`}),title:`Trash`,sub:e?`${u.length} item${u.length===1?``:`s`}`:void 0,actions:u.length>0&&(o===`*`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(B,{variant:`danger`,icon:`delete_forever`,onClick:()=>void l(`empty`,`*`),children:[`delete all `,u.length,` for good`]}),(0,P.jsx)(B,{variant:`quiet`,onClick:()=>s(null),children:`cancel`})]}):(0,P.jsx)(B,{variant:`danger`,icon:`delete_forever`,disabled:!!i,onClick:()=>s(`*`),children:`empty trash`}))}),n&&(0,P.jsx)(K,{tone:`bad`,children:n}),!e&&!n&&(0,P.jsx)(q,{children:(0,P.jsx)(G,{children:`loading…`})}),e&&u.length===0&&(0,P.jsx)(q,{children:(0,P.jsx)(G,{icon:`delete`,children:`The trash is empty. What you delete lands here first.`})}),d.map(e=>(0,P.jsx)(q,{title:du[e]?.label??e,actions:(0,P.jsxs)(`code`,{className:`text-xs text-fg-2`,children:[`trash/`,e,`/`]}),children:(0,P.jsx)(`div`,{className:`p-1.5`,children:u.filter(t=>t.kind===e).map(t=>(0,P.jsx)(J,{className:`trash-row`,leading:(0,P.jsx)(F,{name:du[e]?.icon??`draft`,className:`ms-sm`}),title:t.name,sub:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`font-mono`,children:t.from}),` · `,(0,P.jsxs)(`span`,{title:t.trashedAt,children:[`deleted `,Ke(t.trashedAt)]})]}),meta:(0,P.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(B,{size:`sm`,variant:`secondary`,icon:`restore_from_trash`,busy:i===t.id,disabled:!!i,onClick:()=>void l(`restore`,t.id),title:`Put it back at ${t.from}`,children:`restore`}),o===t.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete_forever`,onClick:()=>void l(`purge`,t.id),children:`delete for good`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>s(null),children:`cancel`})]}):(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete_forever`,disabled:!!i,onClick:()=>s(t.id),children:`delete`})]})},t.id))})},e)),e&&(0,P.jsxs)(`p`,{className:`m-0 text-sm text-fg-2`,children:[`The trash lives in `,(0,P.jsx)(`code`,{children:e.root}),`, kept out of the workspace git. From the terminal:`,` `,(0,P.jsx)(`code`,{children:`kraftwerk trash`}),`, `,(0,P.jsx)(`code`,{children:`kraftwerk trash restore <id>`}),`, `,(0,P.jsx)(`code`,{children:`kraftwerk trash empty`}),`.`]})]})}var pu=(e,t,n=!1)=>A.url(`files.raw`,{query:{scope:e,path:t,download:n}}),mu=(e,t=``,n)=>`/files/${encodeURIComponent(e)}${t?`/${t.split(`/`).map(encodeURIComponent).join(`/`)}`:``}${n?`?file=${encodeURIComponent(n)}`:``}`,hu=`inline-grid size-7 shrink-0 place-items-center rounded-control text-fg-2 no-underline hover:bg-surface-2 hover:text-fg`,gu=`whitespace-nowrap border-b border-line px-2.5 py-1.5 text-left`;function _u({here:e,onClick:t,children:n}){return(0,P.jsx)(`button`,{type:`button`,onClick:t,className:N(`cursor-pointer rounded-md border-0 bg-transparent px-1 py-0.5 font-[inherit] hover:bg-surface-2 hover:text-fg`,e?`font-semibold text-fg`:`text-fg-2`),children:n})}function vu(e){if(e.type===`dir`)return`folder`;let t=e.mime??``;return t.startsWith(`image/`)?`image`:t===`application/pdf`?`picture_as_pdf`:t.startsWith(`video/`)?`movie`:t.startsWith(`audio/`)?`music_note`:/csv|tab-separated|spreadsheet/.test(t)?`table`:/zip/.test(t)?`folder_zip`:/presentation/.test(t)?`slideshow`:t.startsWith(`text/`)||/json|yaml|xml|wordprocessing/.test(t)?`description`:`draft`}function yu({scope:e,dir:t,file:n}){let[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(0);(0,v.useEffect)(()=>{A.call(`files.scopes`).then(e=>i(e.scopes),()=>i([]))},[a]);let s=(r??[]).filter(e=>e.scope!==`workspace`);return(0,P.jsxs)(`div`,{className:`runs-screen files-screen`,children:[(0,P.jsxs)(`aside`,{className:`runs-side`,children:[(0,P.jsx)(Tt,{title:`files`}),(0,P.jsxs)(Dt,{children:[(r??[]).filter(e=>e.scope===`workspace`).map(t=>(0,P.jsx)(bu,{s:t,active:e===t.scope,icon:`home_storage`},t.scope)),s.length>0&&(0,P.jsx)(Tt,{title:`projects`,divided:!0}),s.map(t=>(0,P.jsx)(bu,{s:t,active:e===t.scope,icon:`folder_special`},t.scope))]})]}),(0,P.jsx)(`div`,{className:`runs-main min-w-0`,children:(0,P.jsx)(xu,{scope:e,dir:t,file:n,onOpen:(t,n)=>z(mu(e,t,n)),onChanged:()=>o(e=>e+1)},e)})]})}function bu({s:e,active:t,icon:n}){return(0,P.jsx)(J,{href:mu(e.scope),active:t,size:`sm`,leading:(0,P.jsx)(F,{name:n,className:`ms-sm`}),title:e.label,sub:(0,P.jsxs)(`span`,{className:`font-mono`,children:[e.root,`/`]}),meta:e.count})}function xu({scope:e,dir:t,file:n,onOpen:r,onChanged:i,compact:a=!1}){let[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(!1),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),[y,b]=(0,v.useState)(null),x=(0,v.useRef)(null),S=(0,v.useCallback)(async()=>{let n=await A.request(`files.list`,{query:{scope:e,path:t}}).catch(()=>null);if(!n?.ok||!n.data||typeof n.data!=`object`){l(n?.error??`could not load the folder`),s(null);return}l(``),s(n.data)},[e,t]);(0,v.useEffect)(()=>{S();let e=setInterval(()=>void S(),1e4);return()=>clearInterval(e)},[S]);let C=async()=>{await S(),i?.()};async function w(n){let r=[...n];if(r.length){l(``);for(let[n,i]of r.entries()){d(r.length>1?`uploading ${n+1} of ${r.length}…`:`uploading ${i.name}…`);let a=await A.request(`files.upload`,{query:{scope:e,path:t},headers:{"x-file-name":encodeURIComponent(i.name),"content-type":i.type||`application/octet-stream`},body:i}).catch(()=>null);a?.ok||l(a?.error??`could not upload ${i.name}`)}d(``),await C()}}async function T(n){let r=n.trim();if(h(null),!r)return;let i=j(await A.request(`files.mkdir`,{body:{scope:e,path:t?`${t}/${r}`:r}}));i&&l(i),await C()}async function E(i,a){_(null);let o=a.trim();if(!o||o===i.split(`/`).pop())return;let s=i.includes(`/`)?`${i.slice(0,i.lastIndexOf(`/`))}/${o}`:o,c=j(await A.request(`files.move`,{body:{scope:e,from:i,to:s}}));c?l(c):n===i&&r(t,s),await C()}async function D(i){b(null);let a=await A.request(`files.delete`,{query:{scope:e,path:i}}).catch(()=>null);a?.ok||l(a?.error??`could not delete`),n===i&&r(t),await C()}let O=t?t.split(`/`):[],k=n?o?.entries.find(e=>e.path===n):void 0,ee=!(a&&n);return(0,P.jsxs)(`div`,{className:N(`files-browser h-full min-h-0`,a?`flex flex-col gap-2 px-1.5 py-1`:N(`grid gap-4`,n?`grid-cols-1 min-[900px]:grid-cols-[minmax(280px,1fr)_minmax(0,1.3fr)]`:`grid-cols-1`)),children:[ee&&(0,P.jsxs)(`div`,{className:N(`flex min-h-0 flex-col rounded-card outline-2 -outline-offset-2 outline-dashed transition-colors`,f?`bg-accent/5 outline-accent`:`outline-transparent`),onDragOver:e=>{[...e.dataTransfer.types].includes(`Files`)&&(e.preventDefault(),p(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||p(!1)},onDrop:e=>{e.preventDefault(),p(!1),w(e.dataTransfer.files)},children:[(0,P.jsxs)(`div`,{className:N(`flex items-center gap-1`,a?`px-1 pb-1.5 pt-0.5`:`px-0.5 pb-2.5 pt-1`),children:[(0,P.jsxs)(`nav`,{className:N(`flex min-w-0 flex-wrap items-center`,a?`text-sm`:`text-md`),"aria-label":`Folder`,children:[(0,P.jsx)(_u,{here:!O.length,onClick:()=>r(``),children:o?.label??(e===`workspace`?`Workspace`:e.replace(/^project:/,``))}),O.map((e,t)=>(0,P.jsxs)(`span`,{className:`inline-flex items-center text-fg-2`,children:[(0,P.jsx)(F,{name:`chevron_right`,className:`ms-sm`}),(0,P.jsx)(_u,{here:t===O.length-1,onClick:()=>r(O.slice(0,t+1).join(`/`)),children:e})]},t))]}),(0,P.jsx)(`span`,{className:`flex-1`}),a?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(V,{icon:`create_new_folder`,label:`New folder`,size:`sm`,onClick:()=>h(``)}),(0,P.jsx)(V,{icon:`upload`,label:`Upload files`,size:`sm`,onClick:()=>x.current?.click()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{variant:`quiet`,size:`sm`,icon:`create_new_folder`,onClick:()=>h(``),title:`New folder`,children:`folder`}),(0,P.jsx)(B,{variant:`quiet`,size:`sm`,icon:`upload`,onClick:()=>x.current?.click(),title:`Upload files`,children:`upload`})]}),(0,P.jsx)(`input`,{ref:x,type:`file`,multiple:!0,hidden:!0,"aria-label":`Upload files`,onChange:e=>e.target.files&&void w(e.target.files)})]}),u&&(0,P.jsx)(K,{children:u}),c&&(0,P.jsx)(K,{tone:`bad`,children:c}),(0,P.jsxs)(`div`,{className:`files-list flex min-h-0 flex-1 flex-col gap-px overflow-y-auto`,role:`list`,children:[m!==null&&(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5 px-2.5 py-1`,children:[(0,P.jsx)(F,{name:`create_new_folder`,className:`text-[20px] text-fg-2`}),(0,P.jsx)(Y,{className:`h-8`,autoFocus:!0,value:m,placeholder:`folder name`,"aria-label":`Folder name`,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&T(m),e.key===`Escape`&&h(null)},onBlur:()=>void T(m)})]}),o?.entries.map(i=>g?.path===i.path?(0,P.jsxs)(`div`,{role:`listitem`,className:`flex items-center gap-2.5 px-2.5 py-1`,children:[(0,P.jsx)(F,{name:vu(i),className:`text-[20px] text-fg-2`}),(0,P.jsx)(Y,{className:`h-8`,autoFocus:!0,value:g.name,"aria-label":`New name`,onChange:e=>_({path:i.path,name:e.target.value}),onKeyDown:e=>{e.key===`Enter`&&E(i.path,g.name),e.key===`Escape`&&_(null)},onBlur:()=>void E(i.path,g.name)})]},i.path):(0,P.jsx)(`div`,{role:`listitem`,children:(0,P.jsx)(J,{className:`files-row`,active:i.path===n,onClick:()=>i.type===`dir`?r(i.path):r(t,i.path),label:i.name,leading:(0,P.jsx)(F,{name:vu(i),className:`text-[20px] text-fg-2`}),title:(0,P.jsx)(`span`,{className:`font-normal`,children:i.name}),titleExtra:i.local?(0,P.jsx)(`span`,{className:`text-xs font-normal text-fg-2`,title:`Over 25 MB: kept out of git, stays on this machine`,children:`local only`}):void 0,meta:(0,P.jsxs)(P.Fragment,{children:[i.type===`dir`?`${i.count??0} file${i.count===1?``:`s`}`:We(i.size??0),!a&&` · ${Ke(i.modifiedAt)}`]}),actions:(0,P.jsxs)(P.Fragment,{children:[i.type===`file`&&(0,P.jsx)(`a`,{className:`inline-grid size-7 place-items-center rounded-control text-fg-2 no-underline hover:bg-surface-2 hover:text-fg`,href:pu(e,i.path,!0),title:`Download`,"aria-label":`Download ${i.name}`,children:(0,P.jsx)(F,{name:`download`,className:`ms-sm`})}),(0,P.jsx)(V,{icon:`edit`,size:`sm`,label:`Rename ${i.name}`,onClick:()=>_({path:i.path,name:i.name})}),y===i.path?(0,P.jsx)(B,{variant:`danger`,size:`sm`,autoFocus:!0,onClick:()=>void D(i.path),onBlur:()=>b(null),children:`move to trash`}):(0,P.jsx)(V,{icon:`delete`,size:`sm`,label:`Delete ${i.name}`,onClick:()=>b(i.path)})]})})},i.path)),o&&o.entries.length===0&&m===null&&(0,P.jsxs)(G,{icon:`upload_file`,action:(0,P.jsxs)(`span`,{className:`font-mono text-2xs opacity-80`,children:[o.root,`/`,t?`${t}/`:``]}),children:[`Drop files here, or`,` `,(0,P.jsx)(`button`,{type:`button`,className:`cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-accent underline`,onClick:()=>x.current?.click(),children:`choose some`}),`.`]}),!o&&!c&&(0,P.jsx)(G,{children:`loading…`})]})]}),n&&(0,P.jsx)(Su,{scope:e,path:n,entry:k,onClose:()=>r(t),compact:a})]})}function Su({scope:e,path:t,entry:n,onClose:r,compact:i}){let a=n?.mime??``,o=t.split(`/`).pop()??t,s=pu(e,t),c=/^text\/|json|yaml|xml/.test(a)&&!/html/.test(a),[l,u]=(0,v.useState)(null);(0,v.useEffect)(()=>{if(u(null),!c||(n?.size??0)>2e6)return;let e=!0;return fetch(s,{cache:`no-store`}).then(e=>e.text()).then(t=>e&&u(t)).catch(()=>{}),()=>{e=!1}},[s,c,n?.size]);let d;return d=n?a.startsWith(`image/`)?(0,P.jsx)(`img`,{className:`m-auto max-h-full max-w-full flex-none object-contain p-4`,src:s,alt:o}):a===`application/pdf`?(0,P.jsx)(`iframe`,{className:N(`w-full border-0 bg-white`,i?`min-h-[60vh]`:`min-h-[70vh]`),src:s,title:o}):a.startsWith(`video/`)?(0,P.jsx)(`video`,{className:`m-auto max-h-full w-full p-4`,src:s,controls:!0}):a.startsWith(`audio/`)?(0,P.jsx)(`audio`,{className:`m-auto w-full p-4`,src:s,controls:!0}):c&&l!==null?/markdown/.test(a)?(0,P.jsx)(`div`,{className:`md-body files-md px-5 py-4`,dangerouslySetInnerHTML:{__html:pa.sanitize(Q.parse(l,{async:!1}))}}):/csv|tab-separated/.test(a)?(0,P.jsx)(Cu,{text:l,tab:/tab-separated/.test(a)}):(0,P.jsx)(`pre`,{className:`files-text m-0 whitespace-pre-wrap p-4 font-mono text-[12.5px] leading-relaxed [overflow-wrap:anywhere]`,children:l}):c&&(n.size??0)<=2e6?(0,P.jsx)(G,{children:`loading…`}):(0,P.jsx)(G,{icon:vu(n),action:(0,P.jsx)(B,{variant:`primary`,size:`sm`,icon:`download`,href:void 0,onClick:()=>window.location.href=pu(e,t,!0),children:`download`}),children:`No preview for this kind of file.`}):(0,P.jsx)(G,{children:`loading…`}),(0,P.jsxs)(`section`,{className:N(`files-preview flex min-h-0 flex-col overflow-hidden rounded-card border border-line bg-surface`,i&&`min-h-[60vh]`),"aria-label":`Preview of ${o}`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-line px-3 py-2`,children:[i&&(0,P.jsx)(V,{icon:`arrow_back`,label:`Back to the folder`,size:`sm`,onClick:r}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-base font-semibold`,title:t,children:o}),n?.size!==void 0&&(0,P.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-fg-2`,children:We(n.size)}),(0,P.jsx)(`span`,{className:`flex-1`}),(0,P.jsx)(`a`,{className:hu,href:s,target:`_blank`,rel:`noopener`,title:`Open in a new tab`,"aria-label":`Open in a new tab`,children:(0,P.jsx)(F,{name:`open_in_new`,className:`ms-sm`})}),(0,P.jsx)(`a`,{className:hu,href:pu(e,t,!0),title:`Download`,"aria-label":`Download`,children:(0,P.jsx)(F,{name:`download`,className:`ms-sm`})}),!i&&(0,P.jsx)(V,{icon:`close`,label:`Close the preview`,size:`sm`,onClick:r})]}),(0,P.jsx)(`div`,{className:`flex min-h-0 flex-1 overflow-auto [&>*]:flex-1`,children:d})]})}function Cu({text:e,tab:t}){let n=t?` `:e.split(`
223
223
  `)[0].includes(`;`)&&!e.split(`
224
224
  `)[0].includes(`,`)?`;`:`,`,r=[];for(let t of e.split(/\r?\n/).slice(0,501)){if(!t)continue;let e=[],i=``,a=!1;for(let r=0;r<t.length;r++){let o=t[r];a&&o===`"`&&t[r+1]===`"`?(i+=`"`,r++):o===`"`?a=!a:o===n&&!a?(e.push(i),i=``):i+=o}e.push(i),r.push(e)}let[i,...a]=r;return(0,P.jsx)(`div`,{className:`overflow-auto`,children:(0,P.jsxs)(`table`,{className:`border-collapse text-[12.5px]`,children:[i&&(0,P.jsx)(`thead`,{children:(0,P.jsx)(`tr`,{children:i.map((e,t)=>(0,P.jsx)(`th`,{className:N(gu,`sticky top-0 bg-surface font-semibold`),children:e},t))})}),(0,P.jsx)(`tbody`,{children:a.map((e,t)=>(0,P.jsx)(`tr`,{children:e.map((e,t)=>(0,P.jsx)(`td`,{className:gu,children:e},t))},t))})]})})}function wu(){let[e,t]=(0,v.useState)(`overview`),[n,r]=(0,v.useState)(!0);return(0,P.jsxs)(`div`,{className:`mx-auto flex max-w-[1100px] flex-col gap-4 p-6`,children:[(0,P.jsx)(it,{title:`Components`,sub:`src/ui — what every screen is built from`,actions:(0,P.jsx)(B,{variant:`primary`,icon:`add`,children:`primary`})}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,P.jsxs)(q,{title:`Buttons`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 p-4`,children:[(0,P.jsx)(B,{variant:`primary`,icon:`play_arrow`,children:`Run`}),(0,P.jsx)(B,{variant:`secondary`,icon:`upload`,children:`Upload`}),(0,P.jsx)(B,{variant:`quiet`,icon:`create_new_folder`,children:`Folder`}),(0,P.jsx)(B,{variant:`danger`,icon:`delete`,children:`Move to trash`}),(0,P.jsx)(B,{variant:`primary`,busy:!0,children:`Saving`}),(0,P.jsx)(B,{variant:`secondary`,disabled:!0,children:`Disabled`})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-4 pb-4`,children:[(0,P.jsx)(B,{size:`sm`,variant:`primary`,children:`small`}),(0,P.jsx)(B,{size:`sm`,variant:`secondary`,children:`small`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,children:`small`}),(0,P.jsx)(V,{icon:`edit`,label:`Rename`}),(0,P.jsx)(V,{icon:`download`,label:`Download`}),(0,P.jsx)(V,{icon:`delete`,label:`Delete`,variant:`danger`}),(0,P.jsx)(V,{icon:`close`,label:`Close`,size:`sm`})]})]}),(0,P.jsxs)(q,{title:`Status`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,P.jsx)($e,{n:3}),` `,(0,P.jsx)($e,{n:12,tone:`neutral`}),(0,P.jsx)(H,{tone:`ok`}),` `,(0,P.jsx)(H,{tone:`bad`}),` `,(0,P.jsx)(H,{tone:`ask`}),` `,(0,P.jsx)(H,{tone:`live`}),` `,(0,P.jsx)(H,{tone:`working`}),` `,(0,P.jsx)(H,{tone:`idle`}),(0,P.jsx)(U,{children:`static`}),` `,(0,P.jsx)(U,{tone:`ok`,children:`done`}),` `,(0,P.jsx)(U,{tone:`bad`,children:`failed`}),` `,(0,P.jsx)(U,{tone:`ask`,children:`needs approval`}),` `,(0,P.jsx)(U,{tone:`accent`,children:`running`})]}),(0,P.jsx)(K,{tone:`bad`,children:`Could not upload brief.pdf`}),(0,P.jsx)(K,{children:`uploading 2 of 3…`})]}),(0,P.jsx)(q,{title:`Rows`,count:1,actions:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`arrow_forward`,children:`all`}),children:(0,P.jsxs)(`div`,{className:`p-1.5`,children:[(0,P.jsx)(J,{leading:`🐻`,title:`Max`,sub:`waiting for you · Set up the build`,subTone:`bad`,titleExtra:(0,P.jsx)($e,{n:1}),href:`/ui`}),(0,P.jsx)(J,{leading:`🦊`,title:`Lisa`,sub:`last active 2h ago`,href:`/ui`,active:!0}),(0,P.jsx)(J,{leading:(0,P.jsx)(`span`,{className:`ms material-symbols-rounded ms-sm`,children:`folder`}),title:`briefing`,meta:`3 files`,onClick:()=>{},actions:(0,P.jsx)(V,{icon:`edit`,label:`Rename`,size:`sm`})}),(0,P.jsx)(J,{leading:(0,P.jsx)(H,{tone:`working`}),title:`website-check`,sub:`https://netnode.ch`,meta:`running`,size:`sm`}),(0,P.jsx)(J,{leading:`📁`,title:`Gone project`,sub:`not in this workspace`,dim:!0})]})}),(0,P.jsxs)(q,{title:`Tabs and sections`,children:[(0,P.jsx)(pt,{items:[{id:`overview`,label:`overview`},{id:`files`,label:`files`,count:4},{id:`knowledge`,label:`knowledge`,count:0}],value:e,onChange:t}),(0,P.jsxs)(`div`,{className:`p-2`,children:[(0,P.jsx)(nt,{size:`lg`,title:`needs you`,count:2,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,children:`all`}),children:(0,P.jsx)(J,{leading:`✋`,title:`Run npm install`,sub:`🐻 Max · needs approval · 4m ago`,onClick:()=>{}})}),(0,P.jsx)(nt,{title:`team`,children:(0,P.jsx)(J,{leading:`🦊`,title:`Lisa`,sub:`Research`})})]})]}),(0,P.jsx)(q,{title:`Fields`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,P.jsx)(X,{label:`Name`,hint:`Shown in the rail.`,children:(0,P.jsx)(Y,{placeholder:`e.g. Max`})}),(0,P.jsx)(X,{label:`Harness`,children:(0,P.jsxs)(vt,{defaultValue:`claude`,children:[(0,P.jsx)(`option`,{children:`claude`}),(0,P.jsx)(`option`,{children:`codex`}),(0,P.jsx)(`option`,{children:`pi`})]})}),(0,P.jsx)(X,{label:`Role`,children:(0,P.jsx)(_t,{rows:3,placeholder:`What this agent does`})})]})}),(0,P.jsxs)(q,{title:`Empty and menus`,children:[(0,P.jsx)(G,{icon:`upload_file`,action:(0,P.jsx)(B,{variant:`secondary`,size:`sm`,icon:`upload`,children:`choose files`}),children:`Drop files here.`}),(0,P.jsx)(`div`,{className:`p-4`,children:(0,P.jsx)(kt,{trigger:({toggle:e})=>(0,P.jsx)(B,{onClick:e,icon:`expand_more`,children:`menu`}),children:e=>(0,P.jsxs)(`div`,{className:`flex flex-col`,children:[(0,P.jsx)(J,{leading:`⚙️`,title:`Settings`,onClick:e,size:`sm`}),(0,P.jsx)(J,{leading:`🗑`,title:`Trash`,onClick:e,size:`sm`})]})})})]}),(0,P.jsx)(q,{title:`Sidebar parts`,children:(0,P.jsxs)(`div`,{className:`w-[300px] border-r border-line`,children:[(0,P.jsx)(Tt,{title:`workflows`,count:3,action:(0,P.jsx)(B,{size:`sm`,variant:`quiet`,icon:`add`,children:`new`})}),(0,P.jsx)(Et,{placeholder:`search workflows`,"aria-label":`search workflows`}),(0,P.jsxs)(Dt,{children:[(0,P.jsx)(J,{leading:(0,P.jsx)(H,{tone:`ok`}),title:`triage`,sub:`checks, drafts, publishes`,size:`sm`,active:!0}),(0,P.jsx)(Ot,{children:`no workflow matches “x”`})]})]})}),(0,P.jsx)(q,{title:`Choices`,children:(0,P.jsxs)(yt,{children:[(0,P.jsx)(xt,{checked:n,onChange:r,hint:`every discovered skill`,children:`all skills`}),(0,P.jsx)(xt,{checked:!n,onChange:e=>r(!e),hint:`0 concepts`,mono:!0,children:`brand-guide`}),(0,P.jsxs)(bt,{children:[(0,P.jsx)(Ct,{checked:n,onChange:r,label:`routine enabled`}),(0,P.jsxs)(W,{children:[`Hint: a small explaining line. Keys look like `,(0,P.jsx)(et,{children:`⌘K`}),`.`]})]}),(0,P.jsx)(wt,{label:`Docker sandbox`,hint:`Docker is not running`,checked:n,onChange:r})]})}),(0,P.jsxs)(q,{title:`Page parts`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(ot,{children:`🐻`}),(0,P.jsx)(rt,{size:`lg`,children:`Max`}),(0,P.jsx)(U,{href:`#/ui`,children:`linked tag`})]}),(0,P.jsx)(pt,{bare:!0,label:`link tabs`,value:`pages`,items:[{id:`pages`,label:`pages`,href:`/ui`},{id:`activity`,label:`activity`,href:`/ui`}]})]}),(0,P.jsxs)(lt,{children:[(0,P.jsx)(ct,{icon:`account_tree`,title:`workflows`,action:(0,P.jsx)(B,{size:`sm`,children:`edit`}),children:(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:`none connected`})}),(0,P.jsx)(ct,{icon:`menu_book`,title:`knowledge`})]}),(0,P.jsxs)(dt,{children:[(0,P.jsx)(ft,{label:`source`,children:`workspace`}),(0,P.jsx)(ft,{label:`path`,mono:!0,children:`skills/release-notes/SKILL.md`})]})]})]})]})}var Tu={running:{label:`running`},stopped:{label:`stopped`},died:{label:`died`,note:`was killed or crashed`},missing:{label:`missing`,note:`folder is gone`},orphaned:{label:`orphaned`,note:`no kraftwerk.yml any more`}},Eu={running:`text-ok`,stopped:`text-fg-2`,died:`text-ask`,missing:`text-bad`,orphaned:`text-bad`},Du={running:``,stopped:`opacity-65 grayscale-50`,died:`opacity-80`,missing:`opacity-45 grayscale-80`,orphaned:`opacity-45 grayscale-80`};function Ou(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)({}),[o,s]=(0,v.useState)({}),[c,l]=(0,v.useState)(null),u=(0,v.useCallback)(async()=>{try{let e=await A.request(`workspaces.list`);if(e.ok){t(e.data),r(``);return}r(e.status===404?`This workspace runs a kraftwerk without the workspaces API. Update it and restart its UI.`:`Could not load the workspace registry (HTTP ${e.status}).`)}catch(e){r(e.message||`Could not reach this workspace's server.`)}},[]);(0,v.useEffect)(()=>{let e=!0,t,n=async()=>{await u(),e&&(t=setTimeout(n,6e3))};return n(),()=>{e=!1,clearTimeout(t)}},[u]);let d=e=>e.root??e.url,f=async(e,t)=>{let n=d(e);a(e=>({...e,[n]:t})),s(e=>({...e,[n]:``})),l(null);try{let n=t===`stop`?{root:e.root,url:e.url}:{root:e.root},r=await A.request(`workspaces.${t}`,{body:n});if(!r.ok)throw Error(j(r));if(!r.data.ok)throw Error(`failed`)}catch(e){s(t=>({...t,[n]:e.message}))}finally{a(e=>{let t={...e};return delete t[n],t}),u()}},p=e?.filter(e=>e.live).length??0,m=new Map;for(let t of e??[])t.icon&&m.set(t.icon,(m.get(t.icon)??0)+1);let h=e=>!!e&&(m.get(e)??0)>1;return(0,P.jsxs)(at,{children:[(0,P.jsx)(it,{icon:(0,P.jsx)(F,{name:`hub`,className:`text-[28px] text-fg-2`}),title:`Workspaces`,actions:(0,P.jsxs)(P.Fragment,{children:[e&&(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[e.length,` known · `,p,` running`]}),e&&n&&(0,P.jsx)(K,{tone:`bad`,children:n})]})}),(0,P.jsxs)(q,{title:`workspaces on this machine`,actions:(0,P.jsxs)(`span`,{className:`text-xs text-fg-2`,children:[`registry: `,(0,P.jsx)(`code`,{className:`text-2xs`,children:`~/.kraftwerk/workspaces`})]}),children:[!e&&!n&&(0,P.jsx)(G,{className:`py-6`,children:`loading…`}),!e&&n&&(0,P.jsx)(`div`,{className:`px-[18px] py-4`,children:(0,P.jsx)(K,{tone:`bad`,children:n})}),e&&e.length===0&&(0,P.jsx)(G,{className:`py-6`,children:`No workspaces known yet.`}),e?.map(e=>{let t=d(e),n=i[t],r=!e.live&&!!e.root&&(e.exists===!1||e.hasConfig===!1),a=N(`text-md font-semibold text-fg`,e.named===!1&&`italic text-fg-2`);return(0,P.jsxs)(`div`,{className:N(`grid grid-cols-[40px_minmax(0,1fr)_auto] items-start gap-3.5 px-[18px] py-3.5 [&+&]:border-t [&+&]:border-line/55`,e.state===`died`&&`bg-ask-soft/30`),children:[(0,P.jsx)(ze,{className:N(`size-10`,Du[e.state]),icon:e.icon,name:e.name,color:e.color,seed:e.root??e.url,ambiguous:h(e.icon)}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[3px]`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[e.live&&!e.current?(0,P.jsx)(`a`,{href:pe(e),className:N(a,`no-underline hover:underline`),children:e.name}):(0,P.jsx)(`span`,{className:a,children:e.name}),e.current&&(0,P.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.4px] text-fg-2 uppercase`,children:`current`}),(0,P.jsxs)(`span`,{className:N(`inline-flex items-center gap-1.5 text-2xs font-semibold tracking-[0.4px] uppercase`,Eu[e.state]),children:[e.live&&(0,P.jsx)(`span`,{className:`inline-block size-2 rounded-full bg-ok`}),Tu[e.state].label]}),Tu[e.state].note&&(0,P.jsx)(`span`,{className:`text-xs text-fg-2`,children:Tu[e.state].note})]}),(0,P.jsx)(`div`,{className:`font-mono text-xs [overflow-wrap:anywhere] text-fg-2`,title:e.root,children:e.rootLabel??(0,P.jsx)(`span`,{className:`font-sans opacity-70`,children:`no root recorded (started by an older version)`})}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-x-3.5 gap-y-1 text-xs text-fg-2`,children:[e.state!==`missing`&&e.state!==`orphaned`&&(0,P.jsx)(`span`,{children:e.url.replace(/^https?:\/\//,``)}),e.counts&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.counts.agents,` agents`]}),(0,P.jsxs)(`span`,{children:[e.counts.workflows,` workflows`]}),(0,P.jsxs)(`span`,{children:[e.counts.runs,` runs`]}),(0,P.jsxs)(`span`,{children:[e.counts.chats,` chats`]})]}),e.lastStarted&&(0,P.jsxs)(`span`,{title:e.lastStarted,children:[`started `,Ke(e.lastStarted)]}),!e.live&&e.lastStopped&&(0,P.jsxs)(`span`,{title:e.lastStopped,children:[`stopped `,Ke(e.lastStopped)]}),e.startCount!=null&&(0,P.jsxs)(`span`,{children:[e.startCount,`× launched`]}),e.firstSeen&&(0,P.jsxs)(`span`,{title:e.firstSeen,children:[`first seen `,Ke(e.firstSeen)]})]}),o[t]&&(0,P.jsx)(K,{tone:`bad`,children:o[t]})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e.live&&!e.current&&(0,P.jsxs)(`a`,{className:Qe(`secondary`,`sm`),href:pe(e),title:`Open this workspace`,children:[(0,P.jsx)(F,{name:`open_in_new`,className:`ms-sm`}),` open`]}),!e.live&&e.root&&e.exists!==!1&&!e.dirGone&&(0,P.jsx)(B,{size:`sm`,variant:`primary`,icon:`play_arrow`,busy:n===`start`,disabled:!!n,onClick:()=>void f(e,`start`),children:n===`start`?`starting…`:`start`}),e.live&&!e.current&&(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`stop`,busy:n===`stop`,disabled:!!n,onClick:()=>void f(e,`stop`),children:n===`stop`?`stopping…`:`stop`}),r&&c!==t&&(0,P.jsx)(B,{size:`sm`,icon:`delete`,disabled:!!n,title:`Drop this project from the registry (files untouched)`,onClick:()=>l(t),children:`remove`}),r&&c===t&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(B,{size:`sm`,variant:`danger`,icon:`delete`,onClick:()=>void f(e,`forget`),children:`confirm remove`}),(0,P.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>l(null),children:`cancel`})]})]})]},t)})]}),(0,P.jsxs)(`p`,{className:`m-0 text-xs text-fg-2 [&_code]:text-2xs`,children:[`Start launches `,(0,P.jsx)(`code`,{children:`kraftwerk ui`}),` detached in the project root (log in `,(0,P.jsx)(`code`,{children:`~/.kraftwerk/logs`}),`). Stop sends SIGTERM to the running server. Remove is offered only for records whose root no longer holds a `,(0,P.jsx)(`code`,{children:`kraftwerk.yml`}),` — the same from the terminal:`,` `,(0,P.jsx)(`code`,{children:`kraftwerk workspaces`}),`.`]})]})}function ku(e){if(e<60)return`${e}s`;let t=Math.round(e/60);if(t<60)return`${t} min`;let n=Math.floor(t/60),r=t%60;return r?`${n} h ${r} min`:`${n} h`}var Au=[[/^(\+\+\+|---|diff |index )/,`text-fg-2 opacity-80`],[/^@@/,`text-accent`],[/^\+/,`text-ok`],[/^-/,`text-bad`]],ju=e=>Au.find(([t])=>t.test(e))?.[1]??``;function Mu({file:e}){return(0,P.jsx)(Pu,{source:{route:`git.diff`,input:{query:{path:e}}}})}var Nu=e=>(e.route===`git.diff`||e.route,A.request(e.route,e.input));function Pu({source:e,refresh:t}){let[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(``),c=JSON.stringify(e);return(0,v.useEffect)(()=>{let t=!0;return r(null),s(``),Nu(e).then(e=>{if(t){if(!e.data||typeof e.data!=`object`)throw Error(`not json`);if(!e.ok){r(``),a(!1),s(e.error??``);return}r(e.data.diff??``),a(!!e.data.truncated),s(e.data.error??``)}}).catch(()=>t&&s(`could not load the diff`)),()=>{t=!1}},[c,t]),o?(0,P.jsx)(`div`,{className:N(Fu,`text-bad`),children:o}):n===null?(0,P.jsx)(`div`,{className:Fu,children:`loading…`}):n.trim()?(0,P.jsxs)(`pre`,{className:Fu,children:[n.split(`
225
225
  `).map((e,t)=>(0,P.jsxs)(`span`,{className:ju(e),children:[e||` `,`