pikibun 0.20.0 → 0.22.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.
- package/README.md +15 -6
- package/dist/chunks/{chunk-BVKSJ7PV.js → chunk-KOZ2NZL7.js} +4590 -3062
- package/dist/chunks/{cli-W7LFSBCE.js → cli-OGQRYOKN.js} +2523 -1644
- package/dist/cli.js +114 -5
- package/dist/migrations/postgres/0038_workspace_attachments.sql +11 -0
- package/dist/migrations/postgres/0039_extensions.sql +54 -0
- package/dist/migrations/postgres/0040_child_session_settings.sql +12 -0
- package/dist/migrations/postgres/0040_host_builtin_extensions.sql +5 -0
- package/dist/migrations/postgres/0040_notifications.sql +47 -0
- package/dist/migrations/postgres/0041_piki_extensions.sql +32 -0
- package/dist/migrations/postgres/0042_default_extensions.sql +23 -0
- package/dist/migrations/postgres/0043_host_required_extensions.sql +6 -0
- package/dist/migrations/sqlite/0045_workspace_attachments.sql +9 -0
- package/dist/migrations/sqlite/0046_extensions.sql +52 -0
- package/dist/migrations/sqlite/0047_child_session_settings.sql +10 -0
- package/dist/migrations/sqlite/0047_host_builtin_extensions.sql +3 -0
- package/dist/migrations/sqlite/0047_notifications.sql +45 -0
- package/dist/migrations/sqlite/0048_piki_extensions.sql +30 -0
- package/dist/migrations/sqlite/0049_default_extensions.sql +22 -0
- package/dist/migrations/sqlite/0050_host_required_extensions.sql +4 -0
- package/dist/web/assets/index-BdJ_-50H.js +62 -0
- package/dist/web/assets/{index-CnOXvi_D.js → index-ClW_3YVo.js} +1 -1
- package/dist/web/assets/index-DR-JFaOB.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +61 -0
- package/npm-shrinkwrap.json +3 -2
- package/package.json +2 -1
- package/dist/web/assets/index-BTJ7REap.css +0 -1
- package/dist/web/assets/index-D8LT-Xr6.js +0 -58
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const u of l)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function a(l){const u={};return l.integrity&&(u.integrity=l.integrity),l.referrerPolicy&&(u.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?u.credentials="include":l.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(l){if(l.ep)return;l.ep=!0;const u=a(l);fetch(l.href,u)}})();function Ab(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Od={exports:{}},$r={};var Ax;function z0(){if(Ax)return $r;Ax=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function a(r,l,u){var d=null;if(u!==void 0&&(d=""+u),l.key!==void 0&&(d=""+l.key),"key"in l){u={};for(var h in l)h!=="key"&&(u[h]=l[h])}else u=l;return l=u.ref,{$$typeof:e,type:r,key:d,ref:l!==void 0?l:null,props:u}}return $r.Fragment=i,$r.jsx=a,$r.jsxs=a,$r}var Nx;function O0(){return Nx||(Nx=1,Od.exports=z0()),Od.exports}var n=O0(),Rd={exports:{}},Ue={};var Tx;function R0(){if(Tx)return Ue;Tx=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),d=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),v=Symbol.iterator;function b(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(D,ee,z){this.props=D,this.context=ee,this.refs=C,this.updater=z||w}k.prototype.isReactComponent={},k.prototype.setState=function(D,ee){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,ee,"setState")},k.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function O(){}O.prototype=k.prototype;function T(D,ee,z){this.props=D,this.context=ee,this.refs=C,this.updater=z||w}var M=T.prototype=new O;M.constructor=T,S(M,k.prototype),M.isPureReactComponent=!0;var _=Array.isArray;function $(){}var G={H:null,A:null,T:null,S:null},J=Object.prototype.hasOwnProperty;function U(D,ee,z){var X=z.ref;return{$$typeof:e,type:D,key:ee,ref:X!==void 0?X:null,props:z}}function E(D,ee){return U(D.type,ee,D.props)}function I(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Q(D){var ee={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(z){return ee[z]})}var ie=/\/+/g;function re(D,ee){return typeof D=="object"&&D!==null&&D.key!=null?Q(""+D.key):ee.toString(36)}function Y(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then($,$):(D.status="pending",D.then(function(ee){D.status==="pending"&&(D.status="fulfilled",D.value=ee)},function(ee){D.status==="pending"&&(D.status="rejected",D.reason=ee)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function F(D,ee,z,X,Se){var ve=typeof D;(ve==="undefined"||ve==="boolean")&&(D=null);var Te=!1;if(D===null)Te=!0;else switch(ve){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(D.$$typeof){case e:case i:Te=!0;break;case x:return Te=D._init,F(Te(D._payload),ee,z,X,Se)}}if(Te)return Se=Se(D),Te=X===""?"."+re(D,0):X,_(Se)?(z="",Te!=null&&(z=Te.replace(ie,"$&/")+"/"),F(Se,ee,z,"",function(Fe){return Fe})):Se!=null&&(I(Se)&&(Se=E(Se,z+(Se.key==null||D&&D.key===Se.key?"":(""+Se.key).replace(ie,"$&/")+"/")+Te)),ee.push(Se)),1;Te=0;var Qe=X===""?".":X+":";if(_(D))for(var pe=0;pe<D.length;pe++)X=D[pe],ve=Qe+re(X,pe),Te+=F(X,ee,z,ve,Se);else if(pe=b(D),typeof pe=="function")for(D=pe.call(D),pe=0;!(X=D.next()).done;)X=X.value,ve=Qe+re(X,pe++),Te+=F(X,ee,z,ve,Se);else if(ve==="object"){if(typeof D.then=="function")return F(Y(D),ee,z,X,Se);throw ee=String(D),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.")}return Te}function B(D,ee,z){if(D==null)return D;var X=[],Se=0;return F(D,X,"","",function(ve){return ee.call(z,ve,Se++)}),X}function se(D){if(D._status===-1){var ee=D._result;ee=ee(),ee.then(function(z){(D._status===0||D._status===-1)&&(D._status=1,D._result=z)},function(z){(D._status===0||D._status===-1)&&(D._status=2,D._result=z)}),D._status===-1&&(D._status=0,D._result=ee)}if(D._status===1)return D._result.default;throw D._result}var de=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ee=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(ee))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},R={map:B,forEach:function(D,ee,z){B(D,function(){ee.apply(this,arguments)},z)},count:function(D){var ee=0;return B(D,function(){ee++}),ee},toArray:function(D){return B(D,function(ee){return ee})||[]},only:function(D){if(!I(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ue.Activity=y,Ue.Children=R,Ue.Component=k,Ue.Fragment=a,Ue.Profiler=l,Ue.PureComponent=T,Ue.StrictMode=r,Ue.Suspense=p,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=G,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(D){return G.H.useMemoCache(D)}},Ue.cache=function(D){return function(){return D.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(D,ee,z){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var X=S({},D.props),Se=D.key;if(ee!=null)for(ve in ee.key!==void 0&&(Se=""+ee.key),ee)!J.call(ee,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&ee.ref===void 0||(X[ve]=ee[ve]);var ve=arguments.length-2;if(ve===1)X.children=z;else if(1<ve){for(var Te=Array(ve),Qe=0;Qe<ve;Qe++)Te[Qe]=arguments[Qe+2];X.children=Te}return U(D.type,Se,X)},Ue.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:u,_context:D},D},Ue.createElement=function(D,ee,z){var X,Se={},ve=null;if(ee!=null)for(X in ee.key!==void 0&&(ve=""+ee.key),ee)J.call(ee,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(Se[X]=ee[X]);var Te=arguments.length-2;if(Te===1)Se.children=z;else if(1<Te){for(var Qe=Array(Te),pe=0;pe<Te;pe++)Qe[pe]=arguments[pe+2];Se.children=Qe}if(D&&D.defaultProps)for(X in Te=D.defaultProps,Te)Se[X]===void 0&&(Se[X]=Te[X]);return U(D,ve,Se)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(D){return{$$typeof:h,render:D}},Ue.isValidElement=I,Ue.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:se}},Ue.memo=function(D,ee){return{$$typeof:m,type:D,compare:ee===void 0?null:ee}},Ue.startTransition=function(D){var ee=G.T,z={};G.T=z;try{var X=D(),Se=G.S;Se!==null&&Se(z,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then($,de)}catch(ve){de(ve)}finally{ee!==null&&z.types!==null&&(ee.types=z.types),G.T=ee}},Ue.unstable_useCacheRefresh=function(){return G.H.useCacheRefresh()},Ue.use=function(D){return G.H.use(D)},Ue.useActionState=function(D,ee,z){return G.H.useActionState(D,ee,z)},Ue.useCallback=function(D,ee){return G.H.useCallback(D,ee)},Ue.useContext=function(D){return G.H.useContext(D)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(D,ee){return G.H.useDeferredValue(D,ee)},Ue.useEffect=function(D,ee){return G.H.useEffect(D,ee)},Ue.useEffectEvent=function(D){return G.H.useEffectEvent(D)},Ue.useId=function(){return G.H.useId()},Ue.useImperativeHandle=function(D,ee,z){return G.H.useImperativeHandle(D,ee,z)},Ue.useInsertionEffect=function(D,ee){return G.H.useInsertionEffect(D,ee)},Ue.useLayoutEffect=function(D,ee){return G.H.useLayoutEffect(D,ee)},Ue.useMemo=function(D,ee){return G.H.useMemo(D,ee)},Ue.useOptimistic=function(D,ee){return G.H.useOptimistic(D,ee)},Ue.useReducer=function(D,ee,z){return G.H.useReducer(D,ee,z)},Ue.useRef=function(D){return G.H.useRef(D)},Ue.useState=function(D){return G.H.useState(D)},Ue.useSyncExternalStore=function(D,ee,z){return G.H.useSyncExternalStore(D,ee,z)},Ue.useTransition=function(){return G.H.useTransition()},Ue.version="19.2.0",Ue}var Ex;function Gh(){return Ex||(Ex=1,Rd.exports=R0()),Rd.exports}var N=Gh(),Md={exports:{}},Ur={},Dd={exports:{}},Ld={};var zx;function M0(){return zx||(zx=1,(function(e){function i(F,B){var se=F.length;F.push(B);e:for(;0<se;){var de=se-1>>>1,R=F[de];if(0<l(R,B))F[de]=B,F[se]=R,se=de;else break e}}function a(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var B=F[0],se=F.pop();if(se!==B){F[0]=se;e:for(var de=0,R=F.length,D=R>>>1;de<D;){var ee=2*(de+1)-1,z=F[ee],X=ee+1,Se=F[X];if(0>l(z,se))X<R&&0>l(Se,z)?(F[de]=Se,F[X]=se,de=X):(F[de]=z,F[ee]=se,de=ee);else if(X<R&&0>l(Se,se))F[de]=Se,F[X]=se,de=X;else break e}}return B}function l(F,B){var se=F.sortIndex-B.sortIndex;return se!==0?se:F.id-B.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var p=[],m=[],x=1,y=null,v=3,b=!1,w=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function M(F){for(var B=a(m);B!==null;){if(B.callback===null)r(m);else if(B.startTime<=F)r(m),B.sortIndex=B.expirationTime,i(p,B);else break;B=a(m)}}function _(F){if(S=!1,M(F),!w)if(a(p)!==null)w=!0,$||($=!0,Q());else{var B=a(m);B!==null&&Y(_,B.startTime-F)}}var $=!1,G=-1,J=5,U=-1;function E(){return C?!0:!(e.unstable_now()-U<J)}function I(){if(C=!1,$){var F=e.unstable_now();U=F;var B=!0;try{e:{w=!1,S&&(S=!1,O(G),G=-1),b=!0;var se=v;try{t:{for(M(F),y=a(p);y!==null&&!(y.expirationTime>F&&E());){var de=y.callback;if(typeof de=="function"){y.callback=null,v=y.priorityLevel;var R=de(y.expirationTime<=F);if(F=e.unstable_now(),typeof R=="function"){y.callback=R,M(F),B=!0;break t}y===a(p)&&r(p),M(F)}else r(p);y=a(p)}if(y!==null)B=!0;else{var D=a(m);D!==null&&Y(_,D.startTime-F),B=!1}}break e}finally{y=null,v=se,b=!1}B=void 0}}finally{B?Q():$=!1}}}var Q;if(typeof T=="function")Q=function(){T(I)};else if(typeof MessageChannel<"u"){var ie=new MessageChannel,re=ie.port2;ie.port1.onmessage=I,Q=function(){re.postMessage(null)}}else Q=function(){k(I,0)};function Y(F,B){G=k(function(){F(e.unstable_now())},B)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):J=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(F){switch(v){case 1:case 2:case 3:var B=3;break;default:B=v}var se=v;v=B;try{return F()}finally{v=se}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(F,B){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var se=v;v=F;try{return B()}finally{v=se}},e.unstable_scheduleCallback=function(F,B,se){var de=e.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?de+se:de):se=de,F){case 1:var R=-1;break;case 2:R=250;break;case 5:R=1073741823;break;case 4:R=1e4;break;default:R=5e3}return R=se+R,F={id:x++,callback:B,priorityLevel:F,startTime:se,expirationTime:R,sortIndex:-1},se>de?(F.sortIndex=se,i(m,F),a(p)===null&&F===a(m)&&(S?(O(G),G=-1):S=!0,Y(_,se-de))):(F.sortIndex=R,i(p,F),w||b||(w=!0,$||($=!0,Q()))),F},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(F){var B=v;return function(){var se=v;v=B;try{return F.apply(this,arguments)}finally{v=se}}}})(Ld)),Ld}var Ox;function D0(){return Ox||(Ox=1,Dd.exports=M0()),Dd.exports}var _d={exports:{}},Jt={};var Rx;function L0(){if(Rx)return Jt;Rx=1;var e=Gh();function i(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)m+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var r={d:{f:a,r:function(){throw Error(i(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},l=Symbol.for("react.portal");function u(p,m,x){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:y==null?null:""+y,children:p,containerInfo:m,implementation:x}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Jt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Jt.createPortal=function(p,m){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(i(299));return u(p,m,null,x)},Jt.flushSync=function(p){var m=d.T,x=r.p;try{if(d.T=null,r.p=2,p)return p()}finally{d.T=m,r.p=x,r.d.f()}},Jt.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(p,m))},Jt.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Jt.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,b=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;x==="style"?r.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:y,integrity:v,fetchPriority:b}):x==="script"&&r.d.X(p,{crossOrigin:y,integrity:v,fetchPriority:b,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Jt.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var x=h(m.as,m.crossOrigin);r.d.M(p,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(p)},Jt.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var x=m.as,y=h(x,m.crossOrigin);r.d.L(p,x,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Jt.preloadModule=function(p,m){if(typeof p=="string")if(m){var x=h(m.as,m.crossOrigin);r.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(p)},Jt.requestFormReset=function(p){r.d.r(p)},Jt.unstable_batchedUpdates=function(p,m){return p(m)},Jt.useFormState=function(p,m,x){return d.H.useFormState(p,m,x)},Jt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Jt.version="19.2.0",Jt}var Mx;function Nb(){if(Mx)return _d.exports;Mx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),_d.exports=L0(),_d.exports}var Dx;function _0(){if(Dx)return Ur;Dx=1;var e=D0(),i=Gh(),a=Nb();function r(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function u(t){var s=t,o=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(o=s.return),t=s.return;while(t)}return s.tag===3?o:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function h(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function p(t){if(u(t)!==t)throw Error(r(188))}function m(t){var s=t.alternate;if(!s){if(s=u(t),s===null)throw Error(r(188));return s!==t?null:t}for(var o=t,c=s;;){var f=o.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){o=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===o)return p(f),t;if(g===c)return p(f),s;g=g.sibling}throw Error(r(188))}if(o.return!==c.return)o=f,c=g;else{for(var j=!1,A=f.child;A;){if(A===o){j=!0,o=f,c=g;break}if(A===c){j=!0,c=f,o=g;break}A=A.sibling}if(!j){for(A=g.child;A;){if(A===o){j=!0,o=g,c=f;break}if(A===c){j=!0,c=g,o=f;break}A=A.sibling}if(!j)throw Error(r(189))}}if(o.alternate!==c)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?t:s}function x(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=x(t),s!==null)return s;t=t.sibling}return null}var y=Object.assign,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),T=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),J=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),E=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function Q(t){return t===null||typeof t!="object"?null:(t=I&&t[I]||t["@@iterator"],typeof t=="function"?t:null)}var ie=Symbol.for("react.client.reference");function re(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ie?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case _:return"Suspense";case $:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case T:return t.displayName||"Context";case O:return(t._context.displayName||"Context")+".Consumer";case M:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case G:return s=t.displayName||null,s!==null?s:re(t.type)||"Memo";case J:s=t._payload,t=t._init;try{return re(t(s))}catch{}}return null}var Y=Array.isArray,F=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},de=[],R=-1;function D(t){return{current:t}}function ee(t){0>R||(t.current=de[R],de[R]=null,R--)}function z(t,s){R++,de[R]=t.current,t.current=s}var X=D(null),Se=D(null),ve=D(null),Te=D(null);function Qe(t,s){switch(z(ve,s),z(Se,t),z(X,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?Xg(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=Xg(s),t=Qg(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ee(X),z(X,t)}function pe(){ee(X),ee(Se),ee(ve)}function Fe(t){t.memoizedState!==null&&z(Te,t);var s=X.current,o=Qg(s,t.type);s!==o&&(z(Se,t),z(X,o))}function Dt(t){Se.current===t&&(ee(X),ee(Se)),Te.current===t&&(ee(Te),Mr._currentValue=se)}var Kt,yn;function yt(t){if(Kt===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);Kt=s&&s[1]||"",yn=-1<o.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Kt+t+yn}var bn=!1;function Rn(t,s){if(!t||bn)return"";bn=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(te){var K=te}Reflect.construct(t,[],ue)}else{try{ue.call()}catch(te){K=te}t.call(ue.prototype)}}else{try{throw Error()}catch(te){K=te}(ue=t())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(te){if(te&&K&&typeof te.stack=="string")return[te.stack,K.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),j=g[0],A=g[1];if(j&&A){var L=j.split(`
|
|
4
|
+
`),Z=A.split(`
|
|
5
|
+
`);for(f=c=0;c<L.length&&!L[c].includes("DetermineComponentFrameRoot");)c++;for(;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;if(c===L.length||f===Z.length)for(c=L.length-1,f=Z.length-1;1<=c&&0<=f&&L[c]!==Z[f];)f--;for(;1<=c&&0<=f;c--,f--)if(L[c]!==Z[f]){if(c!==1||f!==1)do if(c--,f--,0>f||L[c]!==Z[f]){var ae=`
|
|
6
|
+
`+L[c].replace(" at new "," at ");return t.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",t.displayName)),ae}while(1<=c&&0<=f);break}}}finally{bn=!1,Error.prepareStackTrace=o}return(o=t?t.displayName||t.name:"")?yt(o):""}function Oe(t,s){switch(t.tag){case 26:case 27:case 5:return yt(t.type);case 16:return yt("Lazy");case 13:return t.child!==s&&s!==null?yt("Suspense Fallback"):yt("Suspense");case 19:return yt("SuspenseList");case 0:case 15:return Rn(t.type,!1);case 11:return Rn(t.type.render,!1);case 1:return Rn(t.type,!0);case 31:return yt("Activity");default:return""}}function rt(t){try{var s="",o=null;do s+=Oe(t,o),o=t,t=t.return;while(t);return s}catch(c){return`
|
|
7
|
+
Error generating stack: `+c.message+`
|
|
8
|
+
`+c.stack}}var vn=Object.prototype.hasOwnProperty,wn=e.unstable_scheduleCallback,on=e.unstable_cancelCallback,Xn=e.unstable_shouldYield,Mn=e.unstable_requestPaint,Lt=e.unstable_now,nn=e.unstable_getCurrentPriorityLevel,ms=e.unstable_ImmediatePriority,ne=e.unstable_UserBlockingPriority,fe=e.unstable_NormalPriority,De=e.unstable_LowPriority,Le=e.unstable_IdlePriority,Ut=e.log,st=e.unstable_setDisableYieldValue,bt=null,Ke=null;function Wt(t){if(typeof Ut=="function"&&st(t),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode(bt,t)}catch{}}var At=Math.clz32?Math.clz32:bi,ps=Math.log,Qi=Math.LN2;function bi(t){return t>>>=0,t===0?32:31-(ps(t)/Qi|0)|0}var Nt=256,jn=262144,he=4194304;function Ee(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function vt(t,s,o){var c=t.pendingLanes;if(c===0)return 0;var f=0,g=t.suspendedLanes,j=t.pingedLanes;t=t.warmLanes;var A=c&134217727;return A!==0?(c=A&~g,c!==0?f=Ee(c):(j&=A,j!==0?f=Ee(j):o||(o=A&~t,o!==0&&(f=Ee(o))))):(A=c&~g,A!==0?f=Ee(A):j!==0?f=Ee(j):o||(o=c&~t,o!==0&&(f=Ee(o)))),f===0?0:s!==0&&s!==f&&(s&g)===0&&(g=f&-f,o=s&-s,g>=o||g===32&&(o&4194048)!==0)?s:f}function Ft(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Ya(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ki(){var t=he;return he<<=1,(he&62914560)===0&&(he=4194304),t}function Wi(t){for(var s=[],o=0;31>o;o++)s.push(t);return s}function qs(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function vi(t,s,o,c,f,g){var j=t.pendingLanes;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=o,t.entangledLanes&=o,t.errorRecoveryDisabledLanes&=o,t.shellSuspendCounter=0;var A=t.entanglements,L=t.expirationTimes,Z=t.hiddenUpdates;for(o=j&~o;0<o;){var ae=31-At(o),ue=1<<ae;A[ae]=0,L[ae]=-1;var K=Z[ae];if(K!==null)for(Z[ae]=null,ae=0;ae<K.length;ae++){var te=K[ae];te!==null&&(te.lane&=-536870913)}o&=~ue}c!==0&&Ji(t,c,0),g!==0&&f===0&&t.tag!==0&&(t.suspendedLanes|=g&~(j&~s))}function Ji(t,s,o){t.pendingLanes|=s,t.suspendedLanes&=~s;var c=31-At(s);t.entangledLanes|=s,t.entanglements[c]=t.entanglements[c]|1073741824|o&261930}function Va(t,s){var o=t.entangledLanes|=s;for(t=t.entanglements;o;){var c=31-At(o),f=1<<c;f&s|t[c]&s&&(t[c]|=s),o&=~f}}function Mf(t,s){var o=s&-s;return o=(o&42)!==0?1:vc(o),(o&(t.suspendedLanes|s))!==0?0:o}function vc(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function wc(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Df(){var t=B.p;return t!==0?t:(t=window.event,t===void 0?32:bx(t.type))}function Lf(t,s){var o=B.p;try{return B.p=t,s()}finally{B.p=o}}var Fs=Math.random().toString(36).slice(2),Gt="__reactFiber$"+Fs,ln="__reactProps$"+Fs,ea="__reactContainer$"+Fs,jc="__reactEvents$"+Fs,bj="__reactListeners$"+Fs,vj="__reactHandles$"+Fs,_f="__reactResources$"+Fs,Za="__reactMarker$"+Fs;function kc(t){delete t[Gt],delete t[ln],delete t[jc],delete t[bj],delete t[vj]}function ta(t){var s=t[Gt];if(s)return s;for(var o=t.parentNode;o;){if(s=o[ea]||o[Gt]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(t=sx(t);t!==null;){if(o=t[Gt])return o;t=sx(t)}return s}t=o,o=t.parentNode}return null}function na(t){if(t=t[Gt]||t[ea]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function Xa(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(r(33))}function sa(t){var s=t[_f];return s||(s=t[_f]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function It(t){t[Za]=!0}var $f=new Set,Uf={};function wi(t,s){ia(t,s),ia(t+"Capture",s)}function ia(t,s){for(Uf[t]=s,t=0;t<s.length;t++)$f.add(s[t])}var wj=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]*$"),If={},Bf={};function jj(t){return vn.call(Bf,t)?!0:vn.call(If,t)?!1:wj.test(t)?Bf[t]=!0:(If[t]=!0,!1)}function mo(t,s,o){if(jj(s))if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var c=s.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+o)}}function po(t,s,o){if(o===null)t.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+o)}}function gs(t,s,o,c){if(c===null)t.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttributeNS(s,o,""+c)}}function Dn(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Hf(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function kj(t,s,o){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var f=c.get,g=c.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return f.call(this)},set:function(j){o=""+j,g.call(this,j)}}),Object.defineProperty(t,s,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(j){o=""+j},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function Sc(t){if(!t._valueTracker){var s=Hf(t)?"checked":"value";t._valueTracker=kj(t,s,""+t[s])}}function qf(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var o=s.getValue(),c="";return t&&(c=Hf(t)?t.checked?"true":"false":t.value),t=c,t!==o?(s.setValue(t),!0):!1}function go(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var Sj=/[\n"\\]/g;function Ln(t){return t.replace(Sj,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Cc(t,s,o,c,f,g,j,A){t.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.type=j:t.removeAttribute("type"),s!=null?j==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+Dn(s)):t.value!==""+Dn(s)&&(t.value=""+Dn(s)):j!=="submit"&&j!=="reset"||t.removeAttribute("value"),s!=null?Ac(t,j,Dn(s)):o!=null?Ac(t,j,Dn(o)):c!=null&&t.removeAttribute("value"),f==null&&g!=null&&(t.defaultChecked=!!g),f!=null&&(t.checked=f&&typeof f!="function"&&typeof f!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+Dn(A):t.removeAttribute("name")}function Ff(t,s,o,c,f,g,j,A){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(t.type=g),s!=null||o!=null){if(!(g!=="submit"&&g!=="reset"||s!=null)){Sc(t);return}o=o!=null?""+Dn(o):"",s=s!=null?""+Dn(s):o,A||s===t.value||(t.value=s),t.defaultValue=s}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=A?t.checked:!!c,t.defaultChecked=!!c,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(t.name=j),Sc(t)}function Ac(t,s,o){s==="number"&&go(t.ownerDocument)===t||t.defaultValue===""+o||(t.defaultValue=""+o)}function aa(t,s,o,c){if(t=t.options,s){s={};for(var f=0;f<o.length;f++)s["$"+o[f]]=!0;for(o=0;o<t.length;o++)f=s.hasOwnProperty("$"+t[o].value),t[o].selected!==f&&(t[o].selected=f),f&&c&&(t[o].defaultSelected=!0)}else{for(o=""+Dn(o),s=null,f=0;f<t.length;f++){if(t[f].value===o){t[f].selected=!0,c&&(t[f].defaultSelected=!0);return}s!==null||t[f].disabled||(s=t[f])}s!==null&&(s.selected=!0)}}function Gf(t,s,o){if(s!=null&&(s=""+Dn(s),s!==t.value&&(t.value=s),o==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=o!=null?""+Dn(o):""}function Pf(t,s,o,c){if(s==null){if(c!=null){if(o!=null)throw Error(r(92));if(Y(c)){if(1<c.length)throw Error(r(93));c=c[0]}o=c}o==null&&(o=""),s=o}o=Dn(s),t.defaultValue=o,c=t.textContent,c===o&&c!==""&&c!==null&&(t.value=c),Sc(t)}function ra(t,s){if(s){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=s;return}}t.textContent=s}var Cj=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 Yf(t,s,o){var c=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":c?t.setProperty(s,o):typeof o!="number"||o===0||Cj.has(s)?s==="float"?t.cssFloat=o:t[s]=(""+o).trim():t[s]=o+"px"}function Vf(t,s,o){if(s!=null&&typeof s!="object")throw Error(r(62));if(t=t.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||s!=null&&s.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var f in s)c=s[f],s.hasOwnProperty(f)&&o[f]!==c&&Yf(t,f,c)}else for(var g in s)s.hasOwnProperty(g)&&Yf(t,g,s[g])}function Nc(t){if(t.indexOf("-")===-1)return!1;switch(t){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 Aj=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Nj=/^[\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 xo(t){return Nj.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function xs(){}var Tc=null;function Ec(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var oa=null,la=null;function Zf(t){var s=na(t);if(s&&(t=s.stateNode)){var o=t[ln]||null;e:switch(t=s.stateNode,s.type){case"input":if(Cc(t,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=t;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Ln(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var c=o[s];if(c!==t&&c.form===t.form){var f=c[ln]||null;if(!f)throw Error(r(90));Cc(c,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<o.length;s++)c=o[s],c.form===t.form&&qf(c)}break e;case"textarea":Gf(t,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&aa(t,!!o.multiple,s,!1)}}}var zc=!1;function Xf(t,s,o){if(zc)return t(s,o);zc=!0;try{var c=t(s);return c}finally{if(zc=!1,(oa!==null||la!==null)&&(il(),oa&&(s=oa,t=la,la=oa=null,Zf(s),t)))for(s=0;s<t.length;s++)Zf(t[s])}}function Qa(t,s){var o=t.stateNode;if(o===null)return null;var c=o[ln]||null;if(c===null)return null;o=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var ys=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oc=!1;if(ys)try{var Ka={};Object.defineProperty(Ka,"passive",{get:function(){Oc=!0}}),window.addEventListener("test",Ka,Ka),window.removeEventListener("test",Ka,Ka)}catch{Oc=!1}var Gs=null,Rc=null,yo=null;function Qf(){if(yo)return yo;var t,s=Rc,o=s.length,c,f="value"in Gs?Gs.value:Gs.textContent,g=f.length;for(t=0;t<o&&s[t]===f[t];t++);var j=o-t;for(c=1;c<=j&&s[o-c]===f[g-c];c++);return yo=f.slice(t,1<c?1-c:void 0)}function bo(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function vo(){return!0}function Kf(){return!1}function cn(t){function s(o,c,f,g,j){this._reactName=o,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(o=t[A],this[A]=o?o(g):g[A]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?vo:Kf,this.isPropagationStopped=Kf,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=vo)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=vo)},persist:function(){},isPersistent:vo}),s}var ji={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wo=cn(ji),Wa=y({},ji,{view:0,detail:0}),Tj=cn(Wa),Mc,Dc,Ja,jo=y({},Wa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:_c,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Ja&&(Ja&&t.type==="mousemove"?(Mc=t.screenX-Ja.screenX,Dc=t.screenY-Ja.screenY):Dc=Mc=0,Ja=t),Mc)},movementY:function(t){return"movementY"in t?t.movementY:Dc}}),Wf=cn(jo),Ej=y({},jo,{dataTransfer:0}),zj=cn(Ej),Oj=y({},Wa,{relatedTarget:0}),Lc=cn(Oj),Rj=y({},ji,{animationName:0,elapsedTime:0,pseudoElement:0}),Mj=cn(Rj),Dj=y({},ji,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Lj=cn(Dj),_j=y({},ji,{data:0}),Jf=cn(_j),$j={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Uj={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"},Ij={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bj(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=Ij[t])?!!s[t]:!1}function _c(){return Bj}var Hj=y({},Wa,{key:function(t){if(t.key){var s=$j[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=bo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Uj[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:_c,charCode:function(t){return t.type==="keypress"?bo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?bo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),qj=cn(Hj),Fj=y({},jo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),em=cn(Fj),Gj=y({},Wa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:_c}),Pj=cn(Gj),Yj=y({},ji,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vj=cn(Yj),Zj=y({},jo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Xj=cn(Zj),Qj=y({},ji,{newState:0,oldState:0}),Kj=cn(Qj),Wj=[9,13,27,32],$c=ys&&"CompositionEvent"in window,er=null;ys&&"documentMode"in document&&(er=document.documentMode);var Jj=ys&&"TextEvent"in window&&!er,tm=ys&&(!$c||er&&8<er&&11>=er),nm=" ",sm=!1;function im(t,s){switch(t){case"keyup":return Wj.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function am(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var ca=!1;function ek(t,s){switch(t){case"compositionend":return am(s);case"keypress":return s.which!==32?null:(sm=!0,nm);case"textInput":return t=s.data,t===nm&&sm?null:t;default:return null}}function tk(t,s){if(ca)return t==="compositionend"||!$c&&im(t,s)?(t=Qf(),yo=Rc=Gs=null,ca=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return tm&&s.locale!=="ko"?null:s.data;default:return null}}var nk={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 rm(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!nk[t.type]:s==="textarea"}function om(t,s,o,c){oa?la?la.push(c):la=[c]:oa=c,s=dl(s,"onChange"),0<s.length&&(o=new wo("onChange","change",null,o,c),t.push({event:o,listeners:s}))}var tr=null,nr=null;function sk(t){Fg(t,0)}function ko(t){var s=Xa(t);if(qf(s))return t}function lm(t,s){if(t==="change")return s}var cm=!1;if(ys){var Uc;if(ys){var Ic="oninput"in document;if(!Ic){var um=document.createElement("div");um.setAttribute("oninput","return;"),Ic=typeof um.oninput=="function"}Uc=Ic}else Uc=!1;cm=Uc&&(!document.documentMode||9<document.documentMode)}function dm(){tr&&(tr.detachEvent("onpropertychange",hm),nr=tr=null)}function hm(t){if(t.propertyName==="value"&&ko(nr)){var s=[];om(s,nr,t,Ec(t)),Xf(sk,s)}}function ik(t,s,o){t==="focusin"?(dm(),tr=s,nr=o,tr.attachEvent("onpropertychange",hm)):t==="focusout"&&dm()}function ak(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ko(nr)}function rk(t,s){if(t==="click")return ko(s)}function ok(t,s){if(t==="input"||t==="change")return ko(s)}function lk(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var kn=typeof Object.is=="function"?Object.is:lk;function sr(t,s){if(kn(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var o=Object.keys(t),c=Object.keys(s);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var f=o[c];if(!vn.call(s,f)||!kn(t[f],s[f]))return!1}return!0}function fm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function mm(t,s){var o=fm(t);t=0;for(var c;o;){if(o.nodeType===3){if(c=t+o.textContent.length,t<=s&&c>=s)return{node:o,offset:s-t};t=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=fm(o)}}function pm(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?pm(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function gm(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=go(t.document);s instanceof t.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)t=s.contentWindow;else break;s=go(t.document)}return s}function Bc(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var ck=ys&&"documentMode"in document&&11>=document.documentMode,ua=null,Hc=null,ir=null,qc=!1;function xm(t,s,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;qc||ua==null||ua!==go(c)||(c=ua,"selectionStart"in c&&Bc(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ir&&sr(ir,c)||(ir=c,c=dl(Hc,"onSelect"),0<c.length&&(s=new wo("onSelect","select",null,s,o),t.push({event:s,listeners:c}),s.target=ua)))}function ki(t,s){var o={};return o[t.toLowerCase()]=s.toLowerCase(),o["Webkit"+t]="webkit"+s,o["Moz"+t]="moz"+s,o}var da={animationend:ki("Animation","AnimationEnd"),animationiteration:ki("Animation","AnimationIteration"),animationstart:ki("Animation","AnimationStart"),transitionrun:ki("Transition","TransitionRun"),transitionstart:ki("Transition","TransitionStart"),transitioncancel:ki("Transition","TransitionCancel"),transitionend:ki("Transition","TransitionEnd")},Fc={},ym={};ys&&(ym=document.createElement("div").style,"AnimationEvent"in window||(delete da.animationend.animation,delete da.animationiteration.animation,delete da.animationstart.animation),"TransitionEvent"in window||delete da.transitionend.transition);function Si(t){if(Fc[t])return Fc[t];if(!da[t])return t;var s=da[t],o;for(o in s)if(s.hasOwnProperty(o)&&o in ym)return Fc[t]=s[o];return t}var bm=Si("animationend"),vm=Si("animationiteration"),wm=Si("animationstart"),uk=Si("transitionrun"),dk=Si("transitionstart"),hk=Si("transitioncancel"),jm=Si("transitionend"),km=new Map,Gc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Gc.push("scrollEnd");function Qn(t,s){km.set(t,s),wi(s,[t])}var So=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},_n=[],ha=0,Pc=0;function Co(){for(var t=ha,s=Pc=ha=0;s<t;){var o=_n[s];_n[s++]=null;var c=_n[s];_n[s++]=null;var f=_n[s];_n[s++]=null;var g=_n[s];if(_n[s++]=null,c!==null&&f!==null){var j=c.pending;j===null?f.next=f:(f.next=j.next,j.next=f),c.pending=f}g!==0&&Sm(o,f,g)}}function Ao(t,s,o,c){_n[ha++]=t,_n[ha++]=s,_n[ha++]=o,_n[ha++]=c,Pc|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function Yc(t,s,o,c){return Ao(t,s,o,c),No(t)}function Ci(t,s){return Ao(t,null,null,s),No(t)}function Sm(t,s,o){t.lanes|=o;var c=t.alternate;c!==null&&(c.lanes|=o);for(var f=!1,g=t.return;g!==null;)g.childLanes|=o,c=g.alternate,c!==null&&(c.childLanes|=o),g.tag===22&&(t=g.stateNode,t===null||t._visibility&1||(f=!0)),t=g,g=g.return;return t.tag===3?(g=t.stateNode,f&&s!==null&&(f=31-At(o),t=g.hiddenUpdates,c=t[f],c===null?t[f]=[s]:c.push(s),s.lane=o|536870912),g):null}function No(t){if(50<Ar)throw Ar=0,td=null,Error(r(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var fa={};function fk(t,s,o,c){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(t,s,o,c){return new fk(t,s,o,c)}function Vc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function bs(t,s){var o=t.alternate;return o===null?(o=Sn(t.tag,s,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=s,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&65011712,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,s=t.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o.refCleanup=t.refCleanup,o}function Cm(t,s){t.flags&=65011714;var o=t.alternate;return o===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=o.childLanes,t.lanes=o.lanes,t.child=o.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=o.memoizedProps,t.memoizedState=o.memoizedState,t.updateQueue=o.updateQueue,t.type=o.type,s=o.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function To(t,s,o,c,f,g){var j=0;if(c=t,typeof t=="function")Vc(t)&&(j=1);else if(typeof t=="string")j=y0(t,o,X.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case U:return t=Sn(31,o,s,f),t.elementType=U,t.lanes=g,t;case S:return Ai(o.children,f,g,s);case C:j=8,f|=24;break;case k:return t=Sn(12,o,s,f|2),t.elementType=k,t.lanes=g,t;case _:return t=Sn(13,o,s,f),t.elementType=_,t.lanes=g,t;case $:return t=Sn(19,o,s,f),t.elementType=$,t.lanes=g,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case T:j=10;break e;case O:j=9;break e;case M:j=11;break e;case G:j=14;break e;case J:j=16,c=null;break e}j=29,o=Error(r(130,t===null?"null":typeof t,"")),c=null}return s=Sn(j,o,s,f),s.elementType=t,s.type=c,s.lanes=g,s}function Ai(t,s,o,c){return t=Sn(7,t,c,s),t.lanes=o,t}function Zc(t,s,o){return t=Sn(6,t,null,s),t.lanes=o,t}function Am(t){var s=Sn(18,null,null,0);return s.stateNode=t,s}function Xc(t,s,o){return s=Sn(4,t.children!==null?t.children:[],t.key,s),s.lanes=o,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var Nm=new WeakMap;function $n(t,s){if(typeof t=="object"&&t!==null){var o=Nm.get(t);return o!==void 0?o:(s={value:t,source:s,stack:rt(s)},Nm.set(t,s),s)}return{value:t,source:s,stack:rt(s)}}var ma=[],pa=0,Eo=null,ar=0,Un=[],In=0,Ps=null,is=1,as="";function vs(t,s){ma[pa++]=ar,ma[pa++]=Eo,Eo=t,ar=s}function Tm(t,s,o){Un[In++]=is,Un[In++]=as,Un[In++]=Ps,Ps=t;var c=is;t=as;var f=32-At(c)-1;c&=~(1<<f),o+=1;var g=32-At(s)+f;if(30<g){var j=f-f%5;g=(c&(1<<j)-1).toString(32),c>>=j,f-=j,is=1<<32-At(s)+f|o<<f|c,as=g+t}else is=1<<g|o<<f|c,as=t}function Qc(t){t.return!==null&&(vs(t,1),Tm(t,1,0))}function Kc(t){for(;t===Eo;)Eo=ma[--pa],ma[pa]=null,ar=ma[--pa],ma[pa]=null;for(;t===Ps;)Ps=Un[--In],Un[In]=null,as=Un[--In],Un[In]=null,is=Un[--In],Un[In]=null}function Em(t,s){Un[In++]=is,Un[In++]=as,Un[In++]=Ps,is=s.id,as=s.overflow,Ps=t}var Pt=null,ft=null,Ze=!1,Ys=null,Bn=!1,Wc=Error(r(519));function Vs(t){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rr($n(s,t)),Wc}function zm(t){var s=t.stateNode,o=t.type,c=t.memoizedProps;switch(s[Gt]=t,s[ln]=c,o){case"dialog":Pe("cancel",s),Pe("close",s);break;case"iframe":case"object":case"embed":Pe("load",s);break;case"video":case"audio":for(o=0;o<Tr.length;o++)Pe(Tr[o],s);break;case"source":Pe("error",s);break;case"img":case"image":case"link":Pe("error",s),Pe("load",s);break;case"details":Pe("toggle",s);break;case"input":Pe("invalid",s),Ff(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Pe("invalid",s);break;case"textarea":Pe("invalid",s),Pf(s,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||c.suppressHydrationWarning===!0||Vg(s.textContent,o)?(c.popover!=null&&(Pe("beforetoggle",s),Pe("toggle",s)),c.onScroll!=null&&Pe("scroll",s),c.onScrollEnd!=null&&Pe("scrollend",s),c.onClick!=null&&(s.onclick=xs),s=!0):s=!1,s||Vs(t,!0)}function Om(t){for(Pt=t.return;Pt;)switch(Pt.tag){case 5:case 31:case 13:Bn=!1;return;case 27:case 3:Bn=!0;return;default:Pt=Pt.return}}function ga(t){if(t!==Pt)return!1;if(!Ze)return Om(t),Ze=!0,!1;var s=t.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=t.type,o=!(o!=="form"&&o!=="button")||gd(t.type,t.memoizedProps)),o=!o),o&&ft&&Vs(t),Om(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));ft=nx(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));ft=nx(t)}else s===27?(s=ft,oi(t.type)?(t=wd,wd=null,ft=t):ft=s):ft=Pt?qn(t.stateNode.nextSibling):null;return!0}function Ni(){ft=Pt=null,Ze=!1}function Jc(){var t=Ys;return t!==null&&(fn===null?fn=t:fn.push.apply(fn,t),Ys=null),t}function rr(t){Ys===null?Ys=[t]:Ys.push(t)}var eu=D(null),Ti=null,ws=null;function Zs(t,s,o){z(eu,s._currentValue),s._currentValue=o}function js(t){t._currentValue=eu.current,ee(eu)}function tu(t,s,o){for(;t!==null;){var c=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),t===o)break;t=t.return}}function nu(t,s,o,c){var f=t.child;for(f!==null&&(f.return=t);f!==null;){var g=f.dependencies;if(g!==null){var j=f.child;g=g.firstContext;e:for(;g!==null;){var A=g;g=f;for(var L=0;L<s.length;L++)if(A.context===s[L]){g.lanes|=o,A=g.alternate,A!==null&&(A.lanes|=o),tu(g.return,o,t),c||(j=null);break e}g=A.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(r(341));j.lanes|=o,g=j.alternate,g!==null&&(g.lanes|=o),tu(j,o,t),j=null}else j=f.child;if(j!==null)j.return=f;else for(j=f;j!==null;){if(j===t){j=null;break}if(f=j.sibling,f!==null){f.return=j.return,j=f;break}j=j.return}f=j}}function xa(t,s,o,c){t=null;for(var f=s,g=!1;f!==null;){if(!g){if((f.flags&524288)!==0)g=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var j=f.alternate;if(j===null)throw Error(r(387));if(j=j.memoizedProps,j!==null){var A=f.type;kn(f.pendingProps.value,j.value)||(t!==null?t.push(A):t=[A])}}else if(f===Te.current){if(j=f.alternate,j===null)throw Error(r(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(t!==null?t.push(Mr):t=[Mr])}f=f.return}t!==null&&nu(s,t,o,c),s.flags|=262144}function zo(t){for(t=t.firstContext;t!==null;){if(!kn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ei(t){Ti=t,ws=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Yt(t){return Rm(Ti,t)}function Oo(t,s){return Ti===null&&Ei(t),Rm(t,s)}function Rm(t,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},ws===null){if(t===null)throw Error(r(308));ws=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else ws=ws.next=s;return o}var mk=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(o,c){t.push(c)}};this.abort=function(){s.aborted=!0,t.forEach(function(o){return o()})}},pk=e.unstable_scheduleCallback,gk=e.unstable_NormalPriority,Tt={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function su(){return{controller:new mk,data:new Map,refCount:0}}function or(t){t.refCount--,t.refCount===0&&pk(gk,function(){t.controller.abort()})}var lr=null,iu=0,ya=0,ba=null;function xk(t,s){if(lr===null){var o=lr=[];iu=0,ya=od(),ba={status:"pending",value:void 0,then:function(c){o.push(c)}}}return iu++,s.then(Mm,Mm),s}function Mm(){if(--iu===0&&lr!==null){ba!==null&&(ba.status="fulfilled");var t=lr;lr=null,ya=0,ba=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function yk(t,s){var o=[],c={status:"pending",value:null,reason:null,then:function(f){o.push(f)}};return t.then(function(){c.status="fulfilled",c.value=s;for(var f=0;f<o.length;f++)(0,o[f])(s)},function(f){for(c.status="rejected",c.reason=f,f=0;f<o.length;f++)(0,o[f])(void 0)}),c}var Dm=F.S;F.S=function(t,s){xg=Lt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&xk(t,s),Dm!==null&&Dm(t,s)};var zi=D(null);function au(){var t=zi.current;return t!==null?t:ut.pooledCache}function Ro(t,s){s===null?z(zi,zi.current):z(zi,s.pool)}function Lm(){var t=au();return t===null?null:{parent:Tt._currentValue,pool:t}}var va=Error(r(460)),ru=Error(r(474)),Mo=Error(r(542)),Do={then:function(){}};function _m(t){return t=t.status,t==="fulfilled"||t==="rejected"}function $m(t,s,o){switch(o=t[o],o===void 0?t.push(s):o!==s&&(s.then(xs,xs),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Im(t),t;default:if(typeof s.status=="string")s.then(xs,xs);else{if(t=ut,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=s,t.status="pending",t.then(function(c){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=c}},function(c){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=c}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,Im(t),t}throw Ri=s,va}}function Oi(t){try{var s=t._init;return s(t._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Ri=o,va):o}}var Ri=null;function Um(){if(Ri===null)throw Error(r(459));var t=Ri;return Ri=null,t}function Im(t){if(t===va||t===Mo)throw Error(r(483))}var wa=null,cr=0;function Lo(t){var s=cr;return cr+=1,wa===null&&(wa=[]),$m(wa,t,s)}function ur(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function _o(t,s){throw s.$$typeof===v?Error(r(525)):(t=Object.prototype.toString.call(s),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function Bm(t){function s(P,H){if(t){var V=P.deletions;V===null?(P.deletions=[H],P.flags|=16):V.push(H)}}function o(P,H){if(!t)return null;for(;H!==null;)s(P,H),H=H.sibling;return null}function c(P){for(var H=new Map;P!==null;)P.key!==null?H.set(P.key,P):H.set(P.index,P),P=P.sibling;return H}function f(P,H){return P=bs(P,H),P.index=0,P.sibling=null,P}function g(P,H,V){return P.index=V,t?(V=P.alternate,V!==null?(V=V.index,V<H?(P.flags|=67108866,H):V):(P.flags|=67108866,H)):(P.flags|=1048576,H)}function j(P){return t&&P.alternate===null&&(P.flags|=67108866),P}function A(P,H,V,le){return H===null||H.tag!==6?(H=Zc(V,P.mode,le),H.return=P,H):(H=f(H,V),H.return=P,H)}function L(P,H,V,le){var ze=V.type;return ze===S?ae(P,H,V.props.children,le,V.key):H!==null&&(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===J&&Oi(ze)===H.type)?(H=f(H,V.props),ur(H,V),H.return=P,H):(H=To(V.type,V.key,V.props,null,P.mode,le),ur(H,V),H.return=P,H)}function Z(P,H,V,le){return H===null||H.tag!==4||H.stateNode.containerInfo!==V.containerInfo||H.stateNode.implementation!==V.implementation?(H=Xc(V,P.mode,le),H.return=P,H):(H=f(H,V.children||[]),H.return=P,H)}function ae(P,H,V,le,ze){return H===null||H.tag!==7?(H=Ai(V,P.mode,le,ze),H.return=P,H):(H=f(H,V),H.return=P,H)}function ue(P,H,V){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Zc(""+H,P.mode,V),H.return=P,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case b:return V=To(H.type,H.key,H.props,null,P.mode,V),ur(V,H),V.return=P,V;case w:return H=Xc(H,P.mode,V),H.return=P,H;case J:return H=Oi(H),ue(P,H,V)}if(Y(H)||Q(H))return H=Ai(H,P.mode,V,null),H.return=P,H;if(typeof H.then=="function")return ue(P,Lo(H),V);if(H.$$typeof===T)return ue(P,Oo(P,H),V);_o(P,H)}return null}function K(P,H,V,le){var ze=H!==null?H.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return ze!==null?null:A(P,H,""+V,le);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return V.key===ze?L(P,H,V,le):null;case w:return V.key===ze?Z(P,H,V,le):null;case J:return V=Oi(V),K(P,H,V,le)}if(Y(V)||Q(V))return ze!==null?null:ae(P,H,V,le,null);if(typeof V.then=="function")return K(P,H,Lo(V),le);if(V.$$typeof===T)return K(P,H,Oo(P,V),le);_o(P,V)}return null}function te(P,H,V,le,ze){if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return P=P.get(V)||null,A(H,P,""+le,ze);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case b:return P=P.get(le.key===null?V:le.key)||null,L(H,P,le,ze);case w:return P=P.get(le.key===null?V:le.key)||null,Z(H,P,le,ze);case J:return le=Oi(le),te(P,H,V,le,ze)}if(Y(le)||Q(le))return P=P.get(V)||null,ae(H,P,le,ze,null);if(typeof le.then=="function")return te(P,H,V,Lo(le),ze);if(le.$$typeof===T)return te(P,H,V,Oo(H,le),ze);_o(H,le)}return null}function Ce(P,H,V,le){for(var ze=null,We=null,Ne=H,Be=H=0,Ve=null;Ne!==null&&Be<V.length;Be++){Ne.index>Be?(Ve=Ne,Ne=null):Ve=Ne.sibling;var Je=K(P,Ne,V[Be],le);if(Je===null){Ne===null&&(Ne=Ve);break}t&&Ne&&Je.alternate===null&&s(P,Ne),H=g(Je,H,Be),We===null?ze=Je:We.sibling=Je,We=Je,Ne=Ve}if(Be===V.length)return o(P,Ne),Ze&&vs(P,Be),ze;if(Ne===null){for(;Be<V.length;Be++)Ne=ue(P,V[Be],le),Ne!==null&&(H=g(Ne,H,Be),We===null?ze=Ne:We.sibling=Ne,We=Ne);return Ze&&vs(P,Be),ze}for(Ne=c(Ne);Be<V.length;Be++)Ve=te(Ne,P,Be,V[Be],le),Ve!==null&&(t&&Ve.alternate!==null&&Ne.delete(Ve.key===null?Be:Ve.key),H=g(Ve,H,Be),We===null?ze=Ve:We.sibling=Ve,We=Ve);return t&&Ne.forEach(function(hi){return s(P,hi)}),Ze&&vs(P,Be),ze}function Re(P,H,V,le){if(V==null)throw Error(r(151));for(var ze=null,We=null,Ne=H,Be=H=0,Ve=null,Je=V.next();Ne!==null&&!Je.done;Be++,Je=V.next()){Ne.index>Be?(Ve=Ne,Ne=null):Ve=Ne.sibling;var hi=K(P,Ne,Je.value,le);if(hi===null){Ne===null&&(Ne=Ve);break}t&&Ne&&hi.alternate===null&&s(P,Ne),H=g(hi,H,Be),We===null?ze=hi:We.sibling=hi,We=hi,Ne=Ve}if(Je.done)return o(P,Ne),Ze&&vs(P,Be),ze;if(Ne===null){for(;!Je.done;Be++,Je=V.next())Je=ue(P,Je.value,le),Je!==null&&(H=g(Je,H,Be),We===null?ze=Je:We.sibling=Je,We=Je);return Ze&&vs(P,Be),ze}for(Ne=c(Ne);!Je.done;Be++,Je=V.next())Je=te(Ne,P,Be,Je.value,le),Je!==null&&(t&&Je.alternate!==null&&Ne.delete(Je.key===null?Be:Je.key),H=g(Je,H,Be),We===null?ze=Je:We.sibling=Je,We=Je);return t&&Ne.forEach(function(E0){return s(P,E0)}),Ze&&vs(P,Be),ze}function ct(P,H,V,le){if(typeof V=="object"&&V!==null&&V.type===S&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case b:e:{for(var ze=V.key;H!==null;){if(H.key===ze){if(ze=V.type,ze===S){if(H.tag===7){o(P,H.sibling),le=f(H,V.props.children),le.return=P,P=le;break e}}else if(H.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===J&&Oi(ze)===H.type){o(P,H.sibling),le=f(H,V.props),ur(le,V),le.return=P,P=le;break e}o(P,H);break}else s(P,H);H=H.sibling}V.type===S?(le=Ai(V.props.children,P.mode,le,V.key),le.return=P,P=le):(le=To(V.type,V.key,V.props,null,P.mode,le),ur(le,V),le.return=P,P=le)}return j(P);case w:e:{for(ze=V.key;H!==null;){if(H.key===ze)if(H.tag===4&&H.stateNode.containerInfo===V.containerInfo&&H.stateNode.implementation===V.implementation){o(P,H.sibling),le=f(H,V.children||[]),le.return=P,P=le;break e}else{o(P,H);break}else s(P,H);H=H.sibling}le=Xc(V,P.mode,le),le.return=P,P=le}return j(P);case J:return V=Oi(V),ct(P,H,V,le)}if(Y(V))return Ce(P,H,V,le);if(Q(V)){if(ze=Q(V),typeof ze!="function")throw Error(r(150));return V=ze.call(V),Re(P,H,V,le)}if(typeof V.then=="function")return ct(P,H,Lo(V),le);if(V.$$typeof===T)return ct(P,H,Oo(P,V),le);_o(P,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,H!==null&&H.tag===6?(o(P,H.sibling),le=f(H,V),le.return=P,P=le):(o(P,H),le=Zc(V,P.mode,le),le.return=P,P=le),j(P)):o(P,H)}return function(P,H,V,le){try{cr=0;var ze=ct(P,H,V,le);return wa=null,ze}catch(Ne){if(Ne===va||Ne===Mo)throw Ne;var We=Sn(29,Ne,null,P.mode);return We.lanes=le,We.return=P,We}}}var Mi=Bm(!0),Hm=Bm(!1),Xs=!1;function ou(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lu(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Qs(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ks(t,s,o){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(nt&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,s=No(t),Sm(t,null,o),s}return Ao(t,c,s,o),No(t)}function dr(t,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var c=s.lanes;c&=t.pendingLanes,o|=c,s.lanes=o,Va(t,o)}}function cu(t,s){var o=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var f=null,g=null;if(o=o.firstBaseUpdate,o!==null){do{var j={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};g===null?f=g=j:g=g.next=j,o=o.next}while(o!==null);g===null?f=g=s:g=g.next=s}else f=g=s;o={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=s:t.next=s,o.lastBaseUpdate=s}var uu=!1;function hr(){if(uu){var t=ba;if(t!==null)throw t}}function fr(t,s,o,c){uu=!1;var f=t.updateQueue;Xs=!1;var g=f.firstBaseUpdate,j=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var L=A,Z=L.next;L.next=null,j===null?g=Z:j.next=Z,j=L;var ae=t.alternate;ae!==null&&(ae=ae.updateQueue,A=ae.lastBaseUpdate,A!==j&&(A===null?ae.firstBaseUpdate=Z:A.next=Z,ae.lastBaseUpdate=L))}if(g!==null){var ue=f.baseState;j=0,ae=Z=L=null,A=g;do{var K=A.lane&-536870913,te=K!==A.lane;if(te?(Ye&K)===K:(c&K)===K){K!==0&&K===ya&&(uu=!0),ae!==null&&(ae=ae.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ce=t,Re=A;K=s;var ct=o;switch(Re.tag){case 1:if(Ce=Re.payload,typeof Ce=="function"){ue=Ce.call(ct,ue,K);break e}ue=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Re.payload,K=typeof Ce=="function"?Ce.call(ct,ue,K):Ce,K==null)break e;ue=y({},ue,K);break e;case 2:Xs=!0}}K=A.callback,K!==null&&(t.flags|=64,te&&(t.flags|=8192),te=f.callbacks,te===null?f.callbacks=[K]:te.push(K))}else te={lane:K,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ae===null?(Z=ae=te,L=ue):ae=ae.next=te,j|=K;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;te=A,A=te.next,te.next=null,f.lastBaseUpdate=te,f.shared.pending=null}}while(!0);ae===null&&(L=ue),f.baseState=L,f.firstBaseUpdate=Z,f.lastBaseUpdate=ae,g===null&&(f.shared.lanes=0),ni|=j,t.lanes=j,t.memoizedState=ue}}function qm(t,s){if(typeof t!="function")throw Error(r(191,t));t.call(s)}function Fm(t,s){var o=t.callbacks;if(o!==null)for(t.callbacks=null,t=0;t<o.length;t++)qm(o[t],s)}var ja=D(null),$o=D(0);function Gm(t,s){t=Os,z($o,t),z(ja,s),Os=t|s.baseLanes}function du(){z($o,Os),z(ja,ja.current)}function hu(){Os=$o.current,ee(ja),ee($o)}var Cn=D(null),Hn=null;function Ws(t){var s=t.alternate;z(St,St.current&1),z(Cn,t),Hn===null&&(s===null||ja.current!==null||s.memoizedState!==null)&&(Hn=t)}function fu(t){z(St,St.current),z(Cn,t),Hn===null&&(Hn=t)}function Pm(t){t.tag===22?(z(St,St.current),z(Cn,t),Hn===null&&(Hn=t)):Js()}function Js(){z(St,St.current),z(Cn,Cn.current)}function An(t){ee(Cn),Hn===t&&(Hn=null),ee(St)}var St=D(0);function Uo(t){for(var s=t;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||bd(o)||vd(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ks=0,Ie=null,ot=null,Et=null,Io=!1,ka=!1,Di=!1,Bo=0,mr=0,Sa=null,bk=0;function wt(){throw Error(r(321))}function mu(t,s){if(s===null)return!1;for(var o=0;o<s.length&&o<t.length;o++)if(!kn(t[o],s[o]))return!1;return!0}function pu(t,s,o,c,f,g){return ks=g,Ie=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,F.H=t===null||t.memoizedState===null?Tp:zu,Di=!1,g=o(c,f),Di=!1,ka&&(g=Vm(s,o,c,f)),Ym(t),g}function Ym(t){F.H=xr;var s=ot!==null&&ot.next!==null;if(ks=0,Et=ot=Ie=null,Io=!1,mr=0,Sa=null,s)throw Error(r(300));t===null||zt||(t=t.dependencies,t!==null&&zo(t)&&(zt=!0))}function Vm(t,s,o,c){Ie=t;var f=0;do{if(ka&&(Sa=null),mr=0,ka=!1,25<=f)throw Error(r(301));if(f+=1,Et=ot=null,t.updateQueue!=null){var g=t.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}F.H=Ep,g=s(o,c)}while(ka);return g}function vk(){var t=F.H,s=t.useState()[0];return s=typeof s.then=="function"?pr(s):s,t=t.useState()[0],(ot!==null?ot.memoizedState:null)!==t&&(Ie.flags|=1024),s}function gu(){var t=Bo!==0;return Bo=0,t}function xu(t,s,o){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~o}function yu(t){if(Io){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Io=!1}ks=0,Et=ot=Ie=null,ka=!1,mr=Bo=0,Sa=null}function sn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Et===null?Ie.memoizedState=Et=t:Et=Et.next=t,Et}function Ct(){if(ot===null){var t=Ie.alternate;t=t!==null?t.memoizedState:null}else t=ot.next;var s=Et===null?Ie.memoizedState:Et.next;if(s!==null)Et=s,ot=t;else{if(t===null)throw Ie.alternate===null?Error(r(467)):Error(r(310));ot=t,t={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},Et===null?Ie.memoizedState=Et=t:Et=Et.next=t}return Et}function Ho(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pr(t){var s=mr;return mr+=1,Sa===null&&(Sa=[]),t=$m(Sa,t,s),s=Ie,(Et===null?s.memoizedState:Et.next)===null&&(s=s.alternate,F.H=s===null||s.memoizedState===null?Tp:zu),t}function qo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return pr(t);if(t.$$typeof===T)return Yt(t)}throw Error(r(438,String(t)))}function bu(t){var s=null,o=Ie.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var c=Ie.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(s={data:c.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=Ho(),Ie.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(t),c=0;c<t;c++)o[c]=E;return s.index++,o}function Ss(t,s){return typeof s=="function"?s(t):s}function Fo(t){var s=Ct();return vu(s,ot,t)}function vu(t,s,o){var c=t.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=o;var f=t.baseQueue,g=c.pending;if(g!==null){if(f!==null){var j=f.next;f.next=g.next,g.next=j}s.baseQueue=f=g,c.pending=null}if(g=t.baseState,f===null)t.memoizedState=g;else{s=f.next;var A=j=null,L=null,Z=s,ae=!1;do{var ue=Z.lane&-536870913;if(ue!==Z.lane?(Ye&ue)===ue:(ks&ue)===ue){var K=Z.revertLane;if(K===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),ue===ya&&(ae=!0);else if((ks&K)===K){Z=Z.next,K===ya&&(ae=!0);continue}else ue={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(A=L=ue,j=g):L=L.next=ue,Ie.lanes|=K,ni|=K;ue=Z.action,Di&&o(g,ue),g=Z.hasEagerState?Z.eagerState:o(g,ue)}else K={lane:ue,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},L===null?(A=L=K,j=g):L=L.next=K,Ie.lanes|=ue,ni|=ue;Z=Z.next}while(Z!==null&&Z!==s);if(L===null?j=g:L.next=A,!kn(g,t.memoizedState)&&(zt=!0,ae&&(o=ba,o!==null)))throw o;t.memoizedState=g,t.baseState=j,t.baseQueue=L,c.lastRenderedState=g}return f===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function wu(t){var s=Ct(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=t;var c=o.dispatch,f=o.pending,g=s.memoizedState;if(f!==null){o.pending=null;var j=f=f.next;do g=t(g,j.action),j=j.next;while(j!==f);kn(g,s.memoizedState)||(zt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),o.lastRenderedState=g}return[g,c]}function Zm(t,s,o){var c=Ie,f=Ct(),g=Ze;if(g){if(o===void 0)throw Error(r(407));o=o()}else o=s();var j=!kn((ot||f).memoizedState,o);if(j&&(f.memoizedState=o,zt=!0),f=f.queue,Su(Km.bind(null,c,f,t),[t]),f.getSnapshot!==s||j||Et!==null&&Et.memoizedState.tag&1){if(c.flags|=2048,Ca(9,{destroy:void 0},Qm.bind(null,c,f,o,s),null),ut===null)throw Error(r(349));g||(ks&127)!==0||Xm(c,s,o)}return o}function Xm(t,s,o){t.flags|=16384,t={getSnapshot:s,value:o},s=Ie.updateQueue,s===null?(s=Ho(),Ie.updateQueue=s,s.stores=[t]):(o=s.stores,o===null?s.stores=[t]:o.push(t))}function Qm(t,s,o,c){s.value=o,s.getSnapshot=c,Wm(s)&&Jm(t)}function Km(t,s,o){return o(function(){Wm(s)&&Jm(t)})}function Wm(t){var s=t.getSnapshot;t=t.value;try{var o=s();return!kn(t,o)}catch{return!0}}function Jm(t){var s=Ci(t,2);s!==null&&mn(s,t,2)}function ju(t){var s=sn();if(typeof t=="function"){var o=t;if(t=o(),Di){Wt(!0);try{o()}finally{Wt(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:t},s}function ep(t,s,o,c){return t.baseState=o,vu(t,ot,typeof c=="function"?c:Ss)}function wk(t,s,o,c,f){if(Yo(t))throw Error(r(485));if(t=s.action,t!==null){var g={payload:f,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){g.listeners.push(j)}};F.T!==null?o(!0):g.isTransition=!1,c(g),o=s.pending,o===null?(g.next=s.pending=g,tp(s,g)):(g.next=o.next,s.pending=o.next=g)}}function tp(t,s){var o=s.action,c=s.payload,f=t.state;if(s.isTransition){var g=F.T,j={};F.T=j;try{var A=o(f,c),L=F.S;L!==null&&L(j,A),np(t,s,A)}catch(Z){ku(t,s,Z)}finally{g!==null&&j.types!==null&&(g.types=j.types),F.T=g}}else try{g=o(f,c),np(t,s,g)}catch(Z){ku(t,s,Z)}}function np(t,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){sp(t,s,c)},function(c){return ku(t,s,c)}):sp(t,s,o)}function sp(t,s,o){s.status="fulfilled",s.value=o,ip(s),t.state=o,s=t.pending,s!==null&&(o=s.next,o===s?t.pending=null:(o=o.next,s.next=o,tp(t,o)))}function ku(t,s,o){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=o,ip(s),s=s.next;while(s!==c)}t.action=null}function ip(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function ap(t,s){return s}function rp(t,s){if(Ze){var o=ut.formState;if(o!==null){e:{var c=Ie;if(Ze){if(ft){t:{for(var f=ft,g=Bn;f.nodeType!==8;){if(!g){f=null;break t}if(f=qn(f.nextSibling),f===null){f=null;break t}}g=f.data,f=g==="F!"||g==="F"?f:null}if(f){ft=qn(f.nextSibling),c=f.data==="F!";break e}}Vs(c)}c=!1}c&&(s=o[0])}}return o=sn(),o.memoizedState=o.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ap,lastRenderedState:s},o.queue=c,o=Cp.bind(null,Ie,c),c.dispatch=o,c=ju(!1),g=Eu.bind(null,Ie,!1,c.queue),c=sn(),f={state:s,dispatch:null,action:t,pending:null},c.queue=f,o=wk.bind(null,Ie,f,g,o),f.dispatch=o,c.memoizedState=t,[s,o,!1]}function op(t){var s=Ct();return lp(s,ot,t)}function lp(t,s,o){if(s=vu(t,s,ap)[0],t=Fo(Ss)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=pr(s)}catch(j){throw j===va?Mo:j}else c=s;s=Ct();var f=s.queue,g=f.dispatch;return o!==s.memoizedState&&(Ie.flags|=2048,Ca(9,{destroy:void 0},jk.bind(null,f,o),null)),[c,g,t]}function jk(t,s){t.action=s}function cp(t){var s=Ct(),o=ot;if(o!==null)return lp(s,o,t);Ct(),s=s.memoizedState,o=Ct();var c=o.queue.dispatch;return o.memoizedState=t,[s,c,!1]}function Ca(t,s,o,c){return t={tag:t,create:o,deps:c,inst:s,next:null},s=Ie.updateQueue,s===null&&(s=Ho(),Ie.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=t.next=t:(c=o.next,o.next=t,t.next=c,s.lastEffect=t),t}function up(){return Ct().memoizedState}function Go(t,s,o,c){var f=sn();Ie.flags|=t,f.memoizedState=Ca(1|s,{destroy:void 0},o,c===void 0?null:c)}function Po(t,s,o,c){var f=Ct();c=c===void 0?null:c;var g=f.memoizedState.inst;ot!==null&&c!==null&&mu(c,ot.memoizedState.deps)?f.memoizedState=Ca(s,g,o,c):(Ie.flags|=t,f.memoizedState=Ca(1|s,g,o,c))}function dp(t,s){Go(8390656,8,t,s)}function Su(t,s){Po(2048,8,t,s)}function kk(t){Ie.flags|=4;var s=Ie.updateQueue;if(s===null)s=Ho(),Ie.updateQueue=s,s.events=[t];else{var o=s.events;o===null?s.events=[t]:o.push(t)}}function hp(t){var s=Ct().memoizedState;return kk({ref:s,nextImpl:t}),function(){if((nt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function fp(t,s){return Po(4,2,t,s)}function mp(t,s){return Po(4,4,t,s)}function pp(t,s){if(typeof s=="function"){t=t();var o=s(t);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function gp(t,s,o){o=o!=null?o.concat([t]):null,Po(4,4,pp.bind(null,s,t),o)}function Cu(){}function xp(t,s){var o=Ct();s=s===void 0?null:s;var c=o.memoizedState;return s!==null&&mu(s,c[1])?c[0]:(o.memoizedState=[t,s],t)}function yp(t,s){var o=Ct();s=s===void 0?null:s;var c=o.memoizedState;if(s!==null&&mu(s,c[1]))return c[0];if(c=t(),Di){Wt(!0);try{t()}finally{Wt(!1)}}return o.memoizedState=[c,s],c}function Au(t,s,o){return o===void 0||(ks&1073741824)!==0&&(Ye&261930)===0?t.memoizedState=s:(t.memoizedState=o,t=bg(),Ie.lanes|=t,ni|=t,o)}function bp(t,s,o,c){return kn(o,s)?o:ja.current!==null?(t=Au(t,o,c),kn(t,s)||(zt=!0),t):(ks&42)===0||(ks&1073741824)!==0&&(Ye&261930)===0?(zt=!0,t.memoizedState=o):(t=bg(),Ie.lanes|=t,ni|=t,s)}function vp(t,s,o,c,f){var g=B.p;B.p=g!==0&&8>g?g:8;var j=F.T,A={};F.T=A,Eu(t,!1,s,o);try{var L=f(),Z=F.S;if(Z!==null&&Z(A,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var ae=yk(L,c);gr(t,s,ae,En(t))}else gr(t,s,c,En(t))}catch(ue){gr(t,s,{then:function(){},status:"rejected",reason:ue},En())}finally{B.p=g,j!==null&&A.types!==null&&(j.types=A.types),F.T=j}}function Sk(){}function Nu(t,s,o,c){if(t.tag!==5)throw Error(r(476));var f=wp(t).queue;vp(t,f,s,se,o===null?Sk:function(){return jp(t),o(c)})}function wp(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:se},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:o},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function jp(t){var s=wp(t);s.next===null&&(s=t.alternate.memoizedState),gr(t,s.next.queue,{},En())}function Tu(){return Yt(Mr)}function kp(){return Ct().memoizedState}function Sp(){return Ct().memoizedState}function Ck(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var o=En();t=Qs(o);var c=Ks(s,t,o);c!==null&&(mn(c,s,o),dr(c,s,o)),s={cache:su()},t.payload=s;return}s=s.return}}function Ak(t,s,o){var c=En();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Yo(t)?Ap(s,o):(o=Yc(t,s,o,c),o!==null&&(mn(o,t,c),Np(o,s,c)))}function Cp(t,s,o){var c=En();gr(t,s,o,c)}function gr(t,s,o,c){var f={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Yo(t))Ap(s,f);else{var g=t.alternate;if(t.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var j=s.lastRenderedState,A=g(j,o);if(f.hasEagerState=!0,f.eagerState=A,kn(A,j))return Ao(t,s,f,0),ut===null&&Co(),!1}catch{}if(o=Yc(t,s,f,c),o!==null)return mn(o,t,c),Np(o,s,c),!0}return!1}function Eu(t,s,o,c){if(c={lane:2,revertLane:od(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Yo(t)){if(s)throw Error(r(479))}else s=Yc(t,o,c,2),s!==null&&mn(s,t,2)}function Yo(t){var s=t.alternate;return t===Ie||s!==null&&s===Ie}function Ap(t,s){ka=Io=!0;var o=t.pending;o===null?s.next=s:(s.next=o.next,o.next=s),t.pending=s}function Np(t,s,o){if((o&4194048)!==0){var c=s.lanes;c&=t.pendingLanes,o|=c,s.lanes=o,Va(t,o)}}var xr={readContext:Yt,use:qo,useCallback:wt,useContext:wt,useEffect:wt,useImperativeHandle:wt,useLayoutEffect:wt,useInsertionEffect:wt,useMemo:wt,useReducer:wt,useRef:wt,useState:wt,useDebugValue:wt,useDeferredValue:wt,useTransition:wt,useSyncExternalStore:wt,useId:wt,useHostTransitionStatus:wt,useFormState:wt,useActionState:wt,useOptimistic:wt,useMemoCache:wt,useCacheRefresh:wt};xr.useEffectEvent=wt;var Tp={readContext:Yt,use:qo,useCallback:function(t,s){return sn().memoizedState=[t,s===void 0?null:s],t},useContext:Yt,useEffect:dp,useImperativeHandle:function(t,s,o){o=o!=null?o.concat([t]):null,Go(4194308,4,pp.bind(null,s,t),o)},useLayoutEffect:function(t,s){return Go(4194308,4,t,s)},useInsertionEffect:function(t,s){Go(4,2,t,s)},useMemo:function(t,s){var o=sn();s=s===void 0?null:s;var c=t();if(Di){Wt(!0);try{t()}finally{Wt(!1)}}return o.memoizedState=[c,s],c},useReducer:function(t,s,o){var c=sn();if(o!==void 0){var f=o(s);if(Di){Wt(!0);try{o(s)}finally{Wt(!1)}}}else f=s;return c.memoizedState=c.baseState=f,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:f},c.queue=t,t=t.dispatch=Ak.bind(null,Ie,t),[c.memoizedState,t]},useRef:function(t){var s=sn();return t={current:t},s.memoizedState=t},useState:function(t){t=ju(t);var s=t.queue,o=Cp.bind(null,Ie,s);return s.dispatch=o,[t.memoizedState,o]},useDebugValue:Cu,useDeferredValue:function(t,s){var o=sn();return Au(o,t,s)},useTransition:function(){var t=ju(!1);return t=vp.bind(null,Ie,t.queue,!0,!1),sn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,o){var c=Ie,f=sn();if(Ze){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),ut===null)throw Error(r(349));(Ye&127)!==0||Xm(c,s,o)}f.memoizedState=o;var g={value:o,getSnapshot:s};return f.queue=g,dp(Km.bind(null,c,g,t),[t]),c.flags|=2048,Ca(9,{destroy:void 0},Qm.bind(null,c,g,o,s),null),o},useId:function(){var t=sn(),s=ut.identifierPrefix;if(Ze){var o=as,c=is;o=(c&~(1<<32-At(c)-1)).toString(32)+o,s="_"+s+"R_"+o,o=Bo++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=bk++,s="_"+s+"r_"+o.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:Tu,useFormState:rp,useActionState:rp,useOptimistic:function(t){var s=sn();s.memoizedState=s.baseState=t;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=Eu.bind(null,Ie,!0,o),o.dispatch=s,[t,s]},useMemoCache:bu,useCacheRefresh:function(){return sn().memoizedState=Ck.bind(null,Ie)},useEffectEvent:function(t){var s=sn(),o={impl:t};return s.memoizedState=o,function(){if((nt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},zu={readContext:Yt,use:qo,useCallback:xp,useContext:Yt,useEffect:Su,useImperativeHandle:gp,useInsertionEffect:fp,useLayoutEffect:mp,useMemo:yp,useReducer:Fo,useRef:up,useState:function(){return Fo(Ss)},useDebugValue:Cu,useDeferredValue:function(t,s){var o=Ct();return bp(o,ot.memoizedState,t,s)},useTransition:function(){var t=Fo(Ss)[0],s=Ct().memoizedState;return[typeof t=="boolean"?t:pr(t),s]},useSyncExternalStore:Zm,useId:kp,useHostTransitionStatus:Tu,useFormState:op,useActionState:op,useOptimistic:function(t,s){var o=Ct();return ep(o,ot,t,s)},useMemoCache:bu,useCacheRefresh:Sp};zu.useEffectEvent=hp;var Ep={readContext:Yt,use:qo,useCallback:xp,useContext:Yt,useEffect:Su,useImperativeHandle:gp,useInsertionEffect:fp,useLayoutEffect:mp,useMemo:yp,useReducer:wu,useRef:up,useState:function(){return wu(Ss)},useDebugValue:Cu,useDeferredValue:function(t,s){var o=Ct();return ot===null?Au(o,t,s):bp(o,ot.memoizedState,t,s)},useTransition:function(){var t=wu(Ss)[0],s=Ct().memoizedState;return[typeof t=="boolean"?t:pr(t),s]},useSyncExternalStore:Zm,useId:kp,useHostTransitionStatus:Tu,useFormState:cp,useActionState:cp,useOptimistic:function(t,s){var o=Ct();return ot!==null?ep(o,ot,t,s):(o.baseState=t,[t,o.queue.dispatch])},useMemoCache:bu,useCacheRefresh:Sp};Ep.useEffectEvent=hp;function Ou(t,s,o,c){s=t.memoizedState,o=o(c,s),o=o==null?s:y({},s,o),t.memoizedState=o,t.lanes===0&&(t.updateQueue.baseState=o)}var Ru={enqueueSetState:function(t,s,o){t=t._reactInternals;var c=En(),f=Qs(c);f.payload=s,o!=null&&(f.callback=o),s=Ks(t,f,c),s!==null&&(mn(s,t,c),dr(s,t,c))},enqueueReplaceState:function(t,s,o){t=t._reactInternals;var c=En(),f=Qs(c);f.tag=1,f.payload=s,o!=null&&(f.callback=o),s=Ks(t,f,c),s!==null&&(mn(s,t,c),dr(s,t,c))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var o=En(),c=Qs(o);c.tag=2,s!=null&&(c.callback=s),s=Ks(t,c,o),s!==null&&(mn(s,t,o),dr(s,t,o))}};function zp(t,s,o,c,f,g,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,g,j):s.prototype&&s.prototype.isPureReactComponent?!sr(o,c)||!sr(f,g):!0}function Op(t,s,o,c){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,c),s.state!==t&&Ru.enqueueReplaceState(s,s.state,null)}function Li(t,s){var o=s;if("ref"in s){o={};for(var c in s)c!=="ref"&&(o[c]=s[c])}if(t=t.defaultProps){o===s&&(o=y({},o));for(var f in t)o[f]===void 0&&(o[f]=t[f])}return o}function Rp(t){So(t)}function Mp(t){console.error(t)}function Dp(t){So(t)}function Vo(t,s){try{var o=t.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function Lp(t,s,o){try{var c=t.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Mu(t,s,o){return o=Qs(o),o.tag=3,o.payload={element:null},o.callback=function(){Vo(t,s)},o}function _p(t){return t=Qs(t),t.tag=3,t}function $p(t,s,o,c){var f=o.type.getDerivedStateFromError;if(typeof f=="function"){var g=c.value;t.payload=function(){return f(g)},t.callback=function(){Lp(s,o,c)}}var j=o.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(t.callback=function(){Lp(s,o,c),typeof f!="function"&&(si===null?si=new Set([this]):si.add(this));var A=c.stack;this.componentDidCatch(c.value,{componentStack:A!==null?A:""})})}function Nk(t,s,o,c,f){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=o.alternate,s!==null&&xa(s,o,f,!0),o=Cn.current,o!==null){switch(o.tag){case 31:case 13:return Hn===null?al():o.alternate===null&&jt===0&&(jt=3),o.flags&=-257,o.flags|=65536,o.lanes=f,c===Do?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([c]):s.add(c),id(t,c,f)),!1;case 22:return o.flags|=65536,c===Do?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([c]):o.add(c)),id(t,c,f)),!1}throw Error(r(435,o.tag))}return id(t,c,f),al(),!1}if(Ze)return s=Cn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,c!==Wc&&(t=Error(r(422),{cause:c}),rr($n(t,o)))):(c!==Wc&&(s=Error(r(423),{cause:c}),rr($n(s,o))),t=t.current.alternate,t.flags|=65536,f&=-f,t.lanes|=f,c=$n(c,o),f=Mu(t.stateNode,c,f),cu(t,f),jt!==4&&(jt=2)),!1;var g=Error(r(520),{cause:c});if(g=$n(g,o),Cr===null?Cr=[g]:Cr.push(g),jt!==4&&(jt=2),s===null)return!0;c=$n(c,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,t=f&-f,o.lanes|=t,t=Mu(o.stateNode,c,t),cu(o,t),!1;case 1:if(s=o.type,g=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(si===null||!si.has(g))))return o.flags|=65536,f&=-f,o.lanes|=f,f=_p(f),$p(f,t,o,c),cu(o,f),!1}o=o.return}while(o!==null);return!1}var Du=Error(r(461)),zt=!1;function Vt(t,s,o,c){s.child=t===null?Hm(s,null,o,c):Mi(s,t.child,o,c)}function Up(t,s,o,c,f){o=o.render;var g=s.ref;if("ref"in c){var j={};for(var A in c)A!=="ref"&&(j[A]=c[A])}else j=c;return Ei(s),c=pu(t,s,o,j,g,f),A=gu(),t!==null&&!zt?(xu(t,s,f),Cs(t,s,f)):(Ze&&A&&Qc(s),s.flags|=1,Vt(t,s,c,f),s.child)}function Ip(t,s,o,c,f){if(t===null){var g=o.type;return typeof g=="function"&&!Vc(g)&&g.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=g,Bp(t,s,g,c,f)):(t=To(o.type,null,c,s,s.mode,f),t.ref=s.ref,t.return=s,s.child=t)}if(g=t.child,!qu(t,f)){var j=g.memoizedProps;if(o=o.compare,o=o!==null?o:sr,o(j,c)&&t.ref===s.ref)return Cs(t,s,f)}return s.flags|=1,t=bs(g,c),t.ref=s.ref,t.return=s,s.child=t}function Bp(t,s,o,c,f){if(t!==null){var g=t.memoizedProps;if(sr(g,c)&&t.ref===s.ref)if(zt=!1,s.pendingProps=c=g,qu(t,f))(t.flags&131072)!==0&&(zt=!0);else return s.lanes=t.lanes,Cs(t,s,f)}return Lu(t,s,o,c,f)}function Hp(t,s,o,c){var f=c.children,g=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((s.flags&128)!==0){if(g=g!==null?g.baseLanes|o:o,t!==null){for(c=s.child=t.child,f=0;c!==null;)f=f|c.lanes|c.childLanes,c=c.sibling;c=f&~g}else c=0,s.child=null;return qp(t,s,g,o,c)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ro(s,g!==null?g.cachePool:null),g!==null?Gm(s,g):du(),Pm(s);else return c=s.lanes=536870912,qp(t,s,g!==null?g.baseLanes|o:o,o,c)}else g!==null?(Ro(s,g.cachePool),Gm(s,g),Js(),s.memoizedState=null):(t!==null&&Ro(s,null),du(),Js());return Vt(t,s,f,o),s.child}function yr(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function qp(t,s,o,c,f){var g=au();return g=g===null?null:{parent:Tt._currentValue,pool:g},s.memoizedState={baseLanes:o,cachePool:g},t!==null&&Ro(s,null),du(),Pm(s),t!==null&&xa(t,s,c,!0),s.childLanes=f,null}function Zo(t,s){return s=Qo({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function Fp(t,s,o){return Mi(s,t.child,null,o),t=Zo(s,s.pendingProps),t.flags|=2,An(s),s.memoizedState=null,t}function Tk(t,s,o){var c=s.pendingProps,f=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ze){if(c.mode==="hidden")return t=Zo(s,c),s.lanes=536870912,yr(null,t);if(fu(s),(t=ft)?(t=tx(t,Bn),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ps!==null?{id:is,overflow:as}:null,retryLane:536870912,hydrationErrors:null},o=Am(t),o.return=s,s.child=o,Pt=s,ft=null)):t=null,t===null)throw Vs(s);return s.lanes=536870912,null}return Zo(s,c)}var g=t.memoizedState;if(g!==null){var j=g.dehydrated;if(fu(s),f)if(s.flags&256)s.flags&=-257,s=Fp(t,s,o);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(r(558));else if(zt||xa(t,s,o,!1),f=(o&t.childLanes)!==0,zt||f){if(c=ut,c!==null&&(j=Mf(c,o),j!==0&&j!==g.retryLane))throw g.retryLane=j,Ci(t,j),mn(c,t,j),Du;al(),s=Fp(t,s,o)}else t=g.treeContext,ft=qn(j.nextSibling),Pt=s,Ze=!0,Ys=null,Bn=!1,t!==null&&Em(s,t),s=Zo(s,c),s.flags|=4096;return s}return t=bs(t.child,{mode:c.mode,children:c.children}),t.ref=s.ref,s.child=t,t.return=s,t}function Xo(t,s){var o=s.ref;if(o===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(t===null||t.ref!==o)&&(s.flags|=4194816)}}function Lu(t,s,o,c,f){return Ei(s),o=pu(t,s,o,c,void 0,f),c=gu(),t!==null&&!zt?(xu(t,s,f),Cs(t,s,f)):(Ze&&c&&Qc(s),s.flags|=1,Vt(t,s,o,f),s.child)}function Gp(t,s,o,c,f,g){return Ei(s),s.updateQueue=null,o=Vm(s,c,o,f),Ym(t),c=gu(),t!==null&&!zt?(xu(t,s,g),Cs(t,s,g)):(Ze&&c&&Qc(s),s.flags|=1,Vt(t,s,o,g),s.child)}function Pp(t,s,o,c,f){if(Ei(s),s.stateNode===null){var g=fa,j=o.contextType;typeof j=="object"&&j!==null&&(g=Yt(j)),g=new o(c,g),s.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Ru,s.stateNode=g,g._reactInternals=s,g=s.stateNode,g.props=c,g.state=s.memoizedState,g.refs={},ou(s),j=o.contextType,g.context=typeof j=="object"&&j!==null?Yt(j):fa,g.state=s.memoizedState,j=o.getDerivedStateFromProps,typeof j=="function"&&(Ou(s,o,j,c),g.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(j=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),j!==g.state&&Ru.enqueueReplaceState(g,g.state,null),fr(s,c,g,f),hr(),g.state=s.memoizedState),typeof g.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(t===null){g=s.stateNode;var A=s.memoizedProps,L=Li(o,A);g.props=L;var Z=g.context,ae=o.contextType;j=fa,typeof ae=="object"&&ae!==null&&(j=Yt(ae));var ue=o.getDerivedStateFromProps;ae=typeof ue=="function"||typeof g.getSnapshotBeforeUpdate=="function",A=s.pendingProps!==A,ae||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(A||Z!==j)&&Op(s,g,c,j),Xs=!1;var K=s.memoizedState;g.state=K,fr(s,c,g,f),hr(),Z=s.memoizedState,A||K!==Z||Xs?(typeof ue=="function"&&(Ou(s,o,ue,c),Z=s.memoizedState),(L=Xs||zp(s,o,L,c,K,Z,j))?(ae||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(s.flags|=4194308)):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=Z),g.props=c,g.state=Z,g.context=j,c=L):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{g=s.stateNode,lu(t,s),j=s.memoizedProps,ae=Li(o,j),g.props=ae,ue=s.pendingProps,K=g.context,Z=o.contextType,L=fa,typeof Z=="object"&&Z!==null&&(L=Yt(Z)),A=o.getDerivedStateFromProps,(Z=typeof A=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j!==ue||K!==L)&&Op(s,g,c,L),Xs=!1,K=s.memoizedState,g.state=K,fr(s,c,g,f),hr();var te=s.memoizedState;j!==ue||K!==te||Xs||t!==null&&t.dependencies!==null&&zo(t.dependencies)?(typeof A=="function"&&(Ou(s,o,A,c),te=s.memoizedState),(ae=Xs||zp(s,o,ae,c,K,te,L)||t!==null&&t.dependencies!==null&&zo(t.dependencies))?(Z||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,te,L),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,te,L)),typeof g.componentDidUpdate=="function"&&(s.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof g.componentDidUpdate!="function"||j===t.memoizedProps&&K===t.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&K===t.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=te),g.props=c,g.state=te,g.context=L,c=ae):(typeof g.componentDidUpdate!="function"||j===t.memoizedProps&&K===t.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&K===t.memoizedState||(s.flags|=1024),c=!1)}return g=c,Xo(t,s),c=(s.flags&128)!==0,g||c?(g=s.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:g.render(),s.flags|=1,t!==null&&c?(s.child=Mi(s,t.child,null,f),s.child=Mi(s,null,o,f)):Vt(t,s,o,f),s.memoizedState=g.state,t=s.child):t=Cs(t,s,f),t}function Yp(t,s,o,c){return Ni(),s.flags|=256,Vt(t,s,o,c),s.child}var _u={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $u(t){return{baseLanes:t,cachePool:Lm()}}function Uu(t,s,o){return t=t!==null?t.childLanes&~o:0,s&&(t|=Tn),t}function Vp(t,s,o){var c=s.pendingProps,f=!1,g=(s.flags&128)!==0,j;if((j=g)||(j=t!==null&&t.memoizedState===null?!1:(St.current&2)!==0),j&&(f=!0,s.flags&=-129),j=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ze){if(f?Ws(s):Js(),(t=ft)?(t=tx(t,Bn),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:Ps!==null?{id:is,overflow:as}:null,retryLane:536870912,hydrationErrors:null},o=Am(t),o.return=s,s.child=o,Pt=s,ft=null)):t=null,t===null)throw Vs(s);return vd(t)?s.lanes=32:s.lanes=536870912,null}var A=c.children;return c=c.fallback,f?(Js(),f=s.mode,A=Qo({mode:"hidden",children:A},f),c=Ai(c,f,o,null),A.return=s,c.return=s,A.sibling=c,s.child=A,c=s.child,c.memoizedState=$u(o),c.childLanes=Uu(t,j,o),s.memoizedState=_u,yr(null,c)):(Ws(s),Iu(s,A))}var L=t.memoizedState;if(L!==null&&(A=L.dehydrated,A!==null)){if(g)s.flags&256?(Ws(s),s.flags&=-257,s=Bu(t,s,o)):s.memoizedState!==null?(Js(),s.child=t.child,s.flags|=128,s=null):(Js(),A=c.fallback,f=s.mode,c=Qo({mode:"visible",children:c.children},f),A=Ai(A,f,o,null),A.flags|=2,c.return=s,A.return=s,c.sibling=A,s.child=c,Mi(s,t.child,null,o),c=s.child,c.memoizedState=$u(o),c.childLanes=Uu(t,j,o),s.memoizedState=_u,s=yr(null,c));else if(Ws(s),vd(A)){if(j=A.nextSibling&&A.nextSibling.dataset,j)var Z=j.dgst;j=Z,c=Error(r(419)),c.stack="",c.digest=j,rr({value:c,source:null,stack:null}),s=Bu(t,s,o)}else if(zt||xa(t,s,o,!1),j=(o&t.childLanes)!==0,zt||j){if(j=ut,j!==null&&(c=Mf(j,o),c!==0&&c!==L.retryLane))throw L.retryLane=c,Ci(t,c),mn(j,t,c),Du;bd(A)||al(),s=Bu(t,s,o)}else bd(A)?(s.flags|=192,s.child=t.child,s=null):(t=L.treeContext,ft=qn(A.nextSibling),Pt=s,Ze=!0,Ys=null,Bn=!1,t!==null&&Em(s,t),s=Iu(s,c.children),s.flags|=4096);return s}return f?(Js(),A=c.fallback,f=s.mode,L=t.child,Z=L.sibling,c=bs(L,{mode:"hidden",children:c.children}),c.subtreeFlags=L.subtreeFlags&65011712,Z!==null?A=bs(Z,A):(A=Ai(A,f,o,null),A.flags|=2),A.return=s,c.return=s,c.sibling=A,s.child=c,yr(null,c),c=s.child,A=t.child.memoizedState,A===null?A=$u(o):(f=A.cachePool,f!==null?(L=Tt._currentValue,f=f.parent!==L?{parent:L,pool:L}:f):f=Lm(),A={baseLanes:A.baseLanes|o,cachePool:f}),c.memoizedState=A,c.childLanes=Uu(t,j,o),s.memoizedState=_u,yr(t.child,c)):(Ws(s),o=t.child,t=o.sibling,o=bs(o,{mode:"visible",children:c.children}),o.return=s,o.sibling=null,t!==null&&(j=s.deletions,j===null?(s.deletions=[t],s.flags|=16):j.push(t)),s.child=o,s.memoizedState=null,o)}function Iu(t,s){return s=Qo({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function Qo(t,s){return t=Sn(22,t,null,s),t.lanes=0,t}function Bu(t,s,o){return Mi(s,t.child,null,o),t=Iu(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Zp(t,s,o){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s),tu(t.return,s,o)}function Hu(t,s,o,c,f,g){var j=t.memoizedState;j===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:f,treeForkCount:g}:(j.isBackwards=s,j.rendering=null,j.renderingStartTime=0,j.last=c,j.tail=o,j.tailMode=f,j.treeForkCount=g)}function Xp(t,s,o){var c=s.pendingProps,f=c.revealOrder,g=c.tail;c=c.children;var j=St.current,A=(j&2)!==0;if(A?(j=j&1|2,s.flags|=128):j&=1,z(St,j),Vt(t,s,c,o),c=Ze?ar:0,!A&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Zp(t,o,s);else if(t.tag===19)Zp(t,o,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(f){case"forwards":for(o=s.child,f=null;o!==null;)t=o.alternate,t!==null&&Uo(t)===null&&(f=o),o=o.sibling;o=f,o===null?(f=s.child,s.child=null):(f=o.sibling,o.sibling=null),Hu(s,!1,f,o,g,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,f=s.child,s.child=null;f!==null;){if(t=f.alternate,t!==null&&Uo(t)===null){s.child=f;break}t=f.sibling,f.sibling=o,o=f,f=t}Hu(s,!0,o,null,g,c);break;case"together":Hu(s,!1,null,null,void 0,c);break;default:s.memoizedState=null}return s.child}function Cs(t,s,o){if(t!==null&&(s.dependencies=t.dependencies),ni|=s.lanes,(o&s.childLanes)===0)if(t!==null){if(xa(t,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(r(153));if(s.child!==null){for(t=s.child,o=bs(t,t.pendingProps),s.child=o,o.return=s;t.sibling!==null;)t=t.sibling,o=o.sibling=bs(t,t.pendingProps),o.return=s;o.sibling=null}return s.child}function qu(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&zo(t)))}function Ek(t,s,o){switch(s.tag){case 3:Qe(s,s.stateNode.containerInfo),Zs(s,Tt,t.memoizedState.cache),Ni();break;case 27:case 5:Fe(s);break;case 4:Qe(s,s.stateNode.containerInfo);break;case 10:Zs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,fu(s),null;break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(Ws(s),s.flags|=128,null):(o&s.child.childLanes)!==0?Vp(t,s,o):(Ws(s),t=Cs(t,s,o),t!==null?t.sibling:null);Ws(s);break;case 19:var f=(t.flags&128)!==0;if(c=(o&s.childLanes)!==0,c||(xa(t,s,o,!1),c=(o&s.childLanes)!==0),f){if(c)return Xp(t,s,o);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),z(St,St.current),c)break;return null;case 22:return s.lanes=0,Hp(t,s,o,s.pendingProps);case 24:Zs(s,Tt,t.memoizedState.cache)}return Cs(t,s,o)}function Qp(t,s,o){if(t!==null)if(t.memoizedProps!==s.pendingProps)zt=!0;else{if(!qu(t,o)&&(s.flags&128)===0)return zt=!1,Ek(t,s,o);zt=(t.flags&131072)!==0}else zt=!1,Ze&&(s.flags&1048576)!==0&&Tm(s,ar,s.index);switch(s.lanes=0,s.tag){case 16:e:{var c=s.pendingProps;if(t=Oi(s.elementType),s.type=t,typeof t=="function")Vc(t)?(c=Li(t,c),s.tag=1,s=Pp(null,s,t,c,o)):(s.tag=0,s=Lu(null,s,t,c,o));else{if(t!=null){var f=t.$$typeof;if(f===M){s.tag=11,s=Up(null,s,t,c,o);break e}else if(f===G){s.tag=14,s=Ip(null,s,t,c,o);break e}}throw s=re(t)||t,Error(r(306,s,""))}}return s;case 0:return Lu(t,s,s.type,s.pendingProps,o);case 1:return c=s.type,f=Li(c,s.pendingProps),Pp(t,s,c,f,o);case 3:e:{if(Qe(s,s.stateNode.containerInfo),t===null)throw Error(r(387));c=s.pendingProps;var g=s.memoizedState;f=g.element,lu(t,s),fr(s,c,null,o);var j=s.memoizedState;if(c=j.cache,Zs(s,Tt,c),c!==g.cache&&nu(s,[Tt],o,!0),hr(),c=j.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:j.cache},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){s=Yp(t,s,c,o);break e}else if(c!==f){f=$n(Error(r(424)),s),rr(f),s=Yp(t,s,c,o);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,ft=qn(t.firstChild),Pt=s,Ze=!0,Ys=null,Bn=!0,o=Hm(s,null,c,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Ni(),c===f){s=Cs(t,s,o);break e}Vt(t,s,c,o)}s=s.child}return s;case 26:return Xo(t,s),t===null?(o=ox(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ze||(o=s.type,t=s.pendingProps,c=hl(ve.current).createElement(o),c[Gt]=s,c[ln]=t,Zt(c,o,t),It(c),s.stateNode=c):s.memoizedState=ox(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return Fe(s),t===null&&Ze&&(c=s.stateNode=ix(s.type,s.pendingProps,ve.current),Pt=s,Bn=!0,f=ft,oi(s.type)?(wd=f,ft=qn(c.firstChild)):ft=f),Vt(t,s,s.pendingProps.children,o),Xo(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ze&&((f=c=ft)&&(c=a0(c,s.type,s.pendingProps,Bn),c!==null?(s.stateNode=c,Pt=s,ft=qn(c.firstChild),Bn=!1,f=!0):f=!1),f||Vs(s)),Fe(s),f=s.type,g=s.pendingProps,j=t!==null?t.memoizedProps:null,c=g.children,gd(f,g)?c=null:j!==null&&gd(f,j)&&(s.flags|=32),s.memoizedState!==null&&(f=pu(t,s,vk,null,null,o),Mr._currentValue=f),Xo(t,s),Vt(t,s,c,o),s.child;case 6:return t===null&&Ze&&((t=o=ft)&&(o=r0(o,s.pendingProps,Bn),o!==null?(s.stateNode=o,Pt=s,ft=null,t=!0):t=!1),t||Vs(s)),null;case 13:return Vp(t,s,o);case 4:return Qe(s,s.stateNode.containerInfo),c=s.pendingProps,t===null?s.child=Mi(s,null,c,o):Vt(t,s,c,o),s.child;case 11:return Up(t,s,s.type,s.pendingProps,o);case 7:return Vt(t,s,s.pendingProps,o),s.child;case 8:return Vt(t,s,s.pendingProps.children,o),s.child;case 12:return Vt(t,s,s.pendingProps.children,o),s.child;case 10:return c=s.pendingProps,Zs(s,s.type,c.value),Vt(t,s,c.children,o),s.child;case 9:return f=s.type._context,c=s.pendingProps.children,Ei(s),f=Yt(f),c=c(f),s.flags|=1,Vt(t,s,c,o),s.child;case 14:return Ip(t,s,s.type,s.pendingProps,o);case 15:return Bp(t,s,s.type,s.pendingProps,o);case 19:return Xp(t,s,o);case 31:return Tk(t,s,o);case 22:return Hp(t,s,o,s.pendingProps);case 24:return Ei(s),c=Yt(Tt),t===null?(f=au(),f===null&&(f=ut,g=su(),f.pooledCache=g,g.refCount++,g!==null&&(f.pooledCacheLanes|=o),f=g),s.memoizedState={parent:c,cache:f},ou(s),Zs(s,Tt,f)):((t.lanes&o)!==0&&(lu(t,s),fr(s,null,null,o),hr()),f=t.memoizedState,g=s.memoizedState,f.parent!==c?(f={parent:c,cache:c},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),Zs(s,Tt,c)):(c=g.cache,Zs(s,Tt,c),c!==f.cache&&nu(s,[Tt],o,!0))),Vt(t,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function As(t){t.flags|=4}function Fu(t,s,o,c,f){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(f&335544128)===f)if(t.stateNode.complete)t.flags|=8192;else if(kg())t.flags|=8192;else throw Ri=Do,ru}else t.flags&=-16777217}function Kp(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!hx(s))if(kg())t.flags|=8192;else throw Ri=Do,ru}function Ko(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?Ki():536870912,t.lanes|=s,Ea|=s)}function br(t,s){if(!Ze)switch(t.tailMode){case"hidden":s=t.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?t.tail=null:o.sibling=null;break;case"collapsed":o=t.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function mt(t){var s=t.alternate!==null&&t.alternate.child===t.child,o=0,c=0;if(s)for(var f=t.child;f!==null;)o|=f.lanes|f.childLanes,c|=f.subtreeFlags&65011712,c|=f.flags&65011712,f.return=t,f=f.sibling;else for(f=t.child;f!==null;)o|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=t,f=f.sibling;return t.subtreeFlags|=c,t.childLanes=o,s}function zk(t,s,o){var c=s.pendingProps;switch(Kc(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mt(s),null;case 1:return mt(s),null;case 3:return o=s.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),js(Tt),pe(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(t===null||t.child===null)&&(ga(s)?As(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Jc())),mt(s),null;case 26:var f=s.type,g=s.memoizedState;return t===null?(As(s),g!==null?(mt(s),Kp(s,g)):(mt(s),Fu(s,f,null,c,o))):g?g!==t.memoizedState?(As(s),mt(s),Kp(s,g)):(mt(s),s.flags&=-16777217):(t=t.memoizedProps,t!==c&&As(s),mt(s),Fu(s,f,t,c,o)),null;case 27:if(Dt(s),o=ve.current,f=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==c&&As(s);else{if(!c){if(s.stateNode===null)throw Error(r(166));return mt(s),null}t=X.current,ga(s)?zm(s):(t=ix(f,c,o),s.stateNode=t,As(s))}return mt(s),null;case 5:if(Dt(s),f=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==c&&As(s);else{if(!c){if(s.stateNode===null)throw Error(r(166));return mt(s),null}if(g=X.current,ga(s))zm(s);else{var j=hl(ve.current);switch(g){case 1:g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":g=j.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?j.createElement("select",{is:c.is}):j.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?j.createElement(f,{is:c.is}):j.createElement(f)}}g[Gt]=s,g[ln]=c;e:for(j=s.child;j!==null;){if(j.tag===5||j.tag===6)g.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===s)break e;for(;j.sibling===null;){if(j.return===null||j.return===s)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}s.stateNode=g;e:switch(Zt(g,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&As(s)}}return mt(s),Fu(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,o),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==c&&As(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(t=ve.current,ga(s)){if(t=s.stateNode,o=s.memoizedProps,c=null,f=Pt,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}t[Gt]=s,t=!!(t.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Vg(t.nodeValue,o)),t||Vs(s,!0)}else t=hl(t).createTextNode(c),t[Gt]=s,s.stateNode=t}return mt(s),null;case 31:if(o=s.memoizedState,t===null||t.memoizedState!==null){if(c=ga(s),o!==null){if(t===null){if(!c)throw Error(r(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[Gt]=s}else Ni(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;mt(s),t=!1}else o=Jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),t=!0;if(!t)return s.flags&256?(An(s),s):(An(s),null);if((s.flags&128)!==0)throw Error(r(558))}return mt(s),null;case 13:if(c=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(f=ga(s),c!==null&&c.dehydrated!==null){if(t===null){if(!f)throw Error(r(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[Gt]=s}else Ni(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;mt(s),f=!1}else f=Jc(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(An(s),s):(An(s),null)}return An(s),(s.flags&128)!==0?(s.lanes=o,s):(o=c!==null,t=t!==null&&t.memoizedState!==null,o&&(c=s.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==f&&(c.flags|=2048)),o!==t&&o&&(s.child.flags|=8192),Ko(s,s.updateQueue),mt(s),null);case 4:return pe(),t===null&&dd(s.stateNode.containerInfo),mt(s),null;case 10:return js(s.type),mt(s),null;case 19:if(ee(St),c=s.memoizedState,c===null)return mt(s),null;if(f=(s.flags&128)!==0,g=c.rendering,g===null)if(f)br(c,!1);else{if(jt!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(g=Uo(t),g!==null){for(s.flags|=128,br(c,!1),t=g.updateQueue,s.updateQueue=t,Ko(s,t),s.subtreeFlags=0,t=o,o=s.child;o!==null;)Cm(o,t),o=o.sibling;return z(St,St.current&1|2),Ze&&vs(s,c.treeForkCount),s.child}t=t.sibling}c.tail!==null&&Lt()>nl&&(s.flags|=128,f=!0,br(c,!1),s.lanes=4194304)}else{if(!f)if(t=Uo(g),t!==null){if(s.flags|=128,f=!0,t=t.updateQueue,s.updateQueue=t,Ko(s,t),br(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Ze)return mt(s),null}else 2*Lt()-c.renderingStartTime>nl&&o!==536870912&&(s.flags|=128,f=!0,br(c,!1),s.lanes=4194304);c.isBackwards?(g.sibling=s.child,s.child=g):(t=c.last,t!==null?t.sibling=g:s.child=g,c.last=g)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=Lt(),t.sibling=null,o=St.current,z(St,f?o&1|2:o&1),Ze&&vs(s,c.treeForkCount),t):(mt(s),null);case 22:case 23:return An(s),hu(),c=s.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(s.flags|=8192):c&&(s.flags|=8192),c?(o&536870912)!==0&&(s.flags&128)===0&&(mt(s),s.subtreeFlags&6&&(s.flags|=8192)):mt(s),o=s.updateQueue,o!==null&&Ko(s,o.retryQueue),o=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==o&&(s.flags|=2048),t!==null&&ee(zi),null;case 24:return o=null,t!==null&&(o=t.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),js(Tt),mt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function Ok(t,s){switch(Kc(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return js(Tt),pe(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Dt(s),null;case 31:if(s.memoizedState!==null){if(An(s),s.alternate===null)throw Error(r(340));Ni()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(An(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Ni()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return ee(St),null;case 4:return pe(),null;case 10:return js(s.type),null;case 22:case 23:return An(s),hu(),t!==null&&ee(zi),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return js(Tt),null;case 25:return null;default:return null}}function Wp(t,s){switch(Kc(s),s.tag){case 3:js(Tt),pe();break;case 26:case 27:case 5:Dt(s);break;case 4:pe();break;case 31:s.memoizedState!==null&&An(s);break;case 13:An(s);break;case 19:ee(St);break;case 10:js(s.type);break;case 22:case 23:An(s),hu(),t!==null&&ee(zi);break;case 24:js(Tt)}}function vr(t,s){try{var o=s.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var f=c.next;o=f;do{if((o.tag&t)===t){c=void 0;var g=o.create,j=o.inst;c=g(),j.destroy=c}o=o.next}while(o!==f)}}catch(A){at(s,s.return,A)}}function ei(t,s,o){try{var c=s.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var g=f.next;c=g;do{if((c.tag&t)===t){var j=c.inst,A=j.destroy;if(A!==void 0){j.destroy=void 0,f=s;var L=o,Z=A;try{Z()}catch(ae){at(f,L,ae)}}}c=c.next}while(c!==g)}}catch(ae){at(s,s.return,ae)}}function Jp(t){var s=t.updateQueue;if(s!==null){var o=t.stateNode;try{Fm(s,o)}catch(c){at(t,t.return,c)}}}function eg(t,s,o){o.props=Li(t.type,t.memoizedProps),o.state=t.memoizedState;try{o.componentWillUnmount()}catch(c){at(t,s,c)}}function wr(t,s){try{var o=t.ref;if(o!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof o=="function"?t.refCleanup=o(c):o.current=c}}catch(f){at(t,s,f)}}function rs(t,s){var o=t.ref,c=t.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(f){at(t,s,f)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){at(t,s,f)}else o.current=null}function tg(t){var s=t.type,o=t.memoizedProps,c=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(f){at(t,t.return,f)}}function Gu(t,s,o){try{var c=t.stateNode;Jk(c,t.type,o,s),c[ln]=s}catch(f){at(t,t.return,f)}}function ng(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&oi(t.type)||t.tag===4}function Pu(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||ng(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&oi(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yu(t,s,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(t,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(t),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=xs));else if(c!==4&&(c===27&&oi(t.type)&&(o=t.stateNode,s=null),t=t.child,t!==null))for(Yu(t,s,o),t=t.sibling;t!==null;)Yu(t,s,o),t=t.sibling}function Wo(t,s,o){var c=t.tag;if(c===5||c===6)t=t.stateNode,s?o.insertBefore(t,s):o.appendChild(t);else if(c!==4&&(c===27&&oi(t.type)&&(o=t.stateNode),t=t.child,t!==null))for(Wo(t,s,o),t=t.sibling;t!==null;)Wo(t,s,o),t=t.sibling}function sg(t){var s=t.stateNode,o=t.memoizedProps;try{for(var c=t.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);Zt(s,c,o),s[Gt]=t,s[ln]=o}catch(g){at(t,t.return,g)}}var Ns=!1,Ot=!1,Vu=!1,ig=typeof WeakSet=="function"?WeakSet:Set,Bt=null;function Rk(t,s){if(t=t.containerInfo,md=bl,t=gm(t),Bc(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{o.nodeType,g.nodeType}catch{o=null;break e}var j=0,A=-1,L=-1,Z=0,ae=0,ue=t,K=null;t:for(;;){for(var te;ue!==o||f!==0&&ue.nodeType!==3||(A=j+f),ue!==g||c!==0&&ue.nodeType!==3||(L=j+c),ue.nodeType===3&&(j+=ue.nodeValue.length),(te=ue.firstChild)!==null;)K=ue,ue=te;for(;;){if(ue===t)break t;if(K===o&&++Z===f&&(A=j),K===g&&++ae===c&&(L=j),(te=ue.nextSibling)!==null)break;ue=K,K=ue.parentNode}ue=te}o=A===-1||L===-1?null:{start:A,end:L}}else o=null}o=o||{start:0,end:0}}else o=null;for(pd={focusedElem:t,selectionRange:o},bl=!1,Bt=s;Bt!==null;)if(s=Bt,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,Bt=t;else for(;Bt!==null;){switch(s=Bt,g=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(o=0;o<t.length;o++)f=t[o],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&g!==null){t=void 0,o=s,f=g.memoizedProps,g=g.memoizedState,c=o.stateNode;try{var Ce=Li(o.type,f);t=c.getSnapshotBeforeUpdate(Ce,g),c.__reactInternalSnapshotBeforeUpdate=t}catch(Re){at(o,o.return,Re)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,o=t.nodeType,o===9)yd(t);else if(o===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":yd(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(r(163))}if(t=s.sibling,t!==null){t.return=s.return,Bt=t;break}Bt=s.return}}function ag(t,s,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:Es(t,o),c&4&&vr(5,o);break;case 1:if(Es(t,o),c&4)if(t=o.stateNode,s===null)try{t.componentDidMount()}catch(j){at(o,o.return,j)}else{var f=Li(o.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(f,s,t.__reactInternalSnapshotBeforeUpdate)}catch(j){at(o,o.return,j)}}c&64&&Jp(o),c&512&&wr(o,o.return);break;case 3:if(Es(t,o),c&64&&(t=o.updateQueue,t!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{Fm(t,s)}catch(j){at(o,o.return,j)}}break;case 27:s===null&&c&4&&sg(o);case 26:case 5:Es(t,o),s===null&&c&4&&tg(o),c&512&&wr(o,o.return);break;case 12:Es(t,o);break;case 31:Es(t,o),c&4&&lg(t,o);break;case 13:Es(t,o),c&4&&cg(t,o),c&64&&(t=o.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(o=Hk.bind(null,o),o0(t,o))));break;case 22:if(c=o.memoizedState!==null||Ns,!c){s=s!==null&&s.memoizedState!==null||Ot,f=Ns;var g=Ot;Ns=c,(Ot=s)&&!g?zs(t,o,(o.subtreeFlags&8772)!==0):Es(t,o),Ns=f,Ot=g}break;case 30:break;default:Es(t,o)}}function rg(t){var s=t.alternate;s!==null&&(t.alternate=null,rg(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&kc(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var gt=null,un=!1;function Ts(t,s,o){for(o=o.child;o!==null;)og(t,s,o),o=o.sibling}function og(t,s,o){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount(bt,o)}catch{}switch(o.tag){case 26:Ot||rs(o,s),Ts(t,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Ot||rs(o,s);var c=gt,f=un;oi(o.type)&&(gt=o.stateNode,un=!1),Ts(t,s,o),zr(o.stateNode),gt=c,un=f;break;case 5:Ot||rs(o,s);case 6:if(c=gt,f=un,gt=null,Ts(t,s,o),gt=c,un=f,gt!==null)if(un)try{(gt.nodeType===9?gt.body:gt.nodeName==="HTML"?gt.ownerDocument.body:gt).removeChild(o.stateNode)}catch(g){at(o,s,g)}else try{gt.removeChild(o.stateNode)}catch(g){at(o,s,g)}break;case 18:gt!==null&&(un?(t=gt,Jg(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,o.stateNode),$a(t)):Jg(gt,o.stateNode));break;case 4:c=gt,f=un,gt=o.stateNode.containerInfo,un=!0,Ts(t,s,o),gt=c,un=f;break;case 0:case 11:case 14:case 15:ei(2,o,s),Ot||ei(4,o,s),Ts(t,s,o);break;case 1:Ot||(rs(o,s),c=o.stateNode,typeof c.componentWillUnmount=="function"&&eg(o,s,c)),Ts(t,s,o);break;case 21:Ts(t,s,o);break;case 22:Ot=(c=Ot)||o.memoizedState!==null,Ts(t,s,o),Ot=c;break;default:Ts(t,s,o)}}function lg(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{$a(t)}catch(o){at(s,s.return,o)}}}function cg(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{$a(t)}catch(o){at(s,s.return,o)}}function Mk(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new ig),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new ig),s;default:throw Error(r(435,t.tag))}}function Jo(t,s){var o=Mk(t);s.forEach(function(c){if(!o.has(c)){o.add(c);var f=qk.bind(null,t,c);c.then(f,f)}})}function dn(t,s){var o=s.deletions;if(o!==null)for(var c=0;c<o.length;c++){var f=o[c],g=t,j=s,A=j;e:for(;A!==null;){switch(A.tag){case 27:if(oi(A.type)){gt=A.stateNode,un=!1;break e}break;case 5:gt=A.stateNode,un=!1;break e;case 3:case 4:gt=A.stateNode.containerInfo,un=!0;break e}A=A.return}if(gt===null)throw Error(r(160));og(g,j,f),gt=null,un=!1,g=f.alternate,g!==null&&(g.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)ug(s,t),s=s.sibling}var Kn=null;function ug(t,s){var o=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:dn(s,t),hn(t),c&4&&(ei(3,t,t.return),vr(3,t),ei(5,t,t.return));break;case 1:dn(s,t),hn(t),c&512&&(Ot||o===null||rs(o,o.return)),c&64&&Ns&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(o=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=o===null?c:o.concat(c))));break;case 26:var f=Kn;if(dn(s,t),hn(t),c&512&&(Ot||o===null||rs(o,o.return)),c&4){var g=o!==null?o.memoizedState:null;if(c=t.memoizedState,o===null)if(c===null)if(t.stateNode===null){e:{c=t.type,o=t.memoizedProps,f=f.ownerDocument||f;t:switch(c){case"title":g=f.getElementsByTagName("title")[0],(!g||g[Za]||g[Gt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=f.createElement(c),f.head.insertBefore(g,f.querySelector("head > title"))),Zt(g,c,o),g[Gt]=t,It(g),c=g;break e;case"link":var j=ux("link","href",f).get(c+(o.href||""));if(j){for(var A=0;A<j.length;A++)if(g=j[A],g.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&g.getAttribute("rel")===(o.rel==null?null:o.rel)&&g.getAttribute("title")===(o.title==null?null:o.title)&&g.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){j.splice(A,1);break t}}g=f.createElement(c),Zt(g,c,o),f.head.appendChild(g);break;case"meta":if(j=ux("meta","content",f).get(c+(o.content||""))){for(A=0;A<j.length;A++)if(g=j[A],g.getAttribute("content")===(o.content==null?null:""+o.content)&&g.getAttribute("name")===(o.name==null?null:o.name)&&g.getAttribute("property")===(o.property==null?null:o.property)&&g.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&g.getAttribute("charset")===(o.charSet==null?null:o.charSet)){j.splice(A,1);break t}}g=f.createElement(c),Zt(g,c,o),f.head.appendChild(g);break;default:throw Error(r(468,c))}g[Gt]=t,It(g),c=g}t.stateNode=c}else dx(f,t.type,t.stateNode);else t.stateNode=cx(f,c,t.memoizedProps);else g!==c?(g===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):g.count--,c===null?dx(f,t.type,t.stateNode):cx(f,c,t.memoizedProps)):c===null&&t.stateNode!==null&&Gu(t,t.memoizedProps,o.memoizedProps)}break;case 27:dn(s,t),hn(t),c&512&&(Ot||o===null||rs(o,o.return)),o!==null&&c&4&&Gu(t,t.memoizedProps,o.memoizedProps);break;case 5:if(dn(s,t),hn(t),c&512&&(Ot||o===null||rs(o,o.return)),t.flags&32){f=t.stateNode;try{ra(f,"")}catch(Ce){at(t,t.return,Ce)}}c&4&&t.stateNode!=null&&(f=t.memoizedProps,Gu(t,f,o!==null?o.memoizedProps:f)),c&1024&&(Vu=!0);break;case 6:if(dn(s,t),hn(t),c&4){if(t.stateNode===null)throw Error(r(162));c=t.memoizedProps,o=t.stateNode;try{o.nodeValue=c}catch(Ce){at(t,t.return,Ce)}}break;case 3:if(pl=null,f=Kn,Kn=fl(s.containerInfo),dn(s,t),Kn=f,hn(t),c&4&&o!==null&&o.memoizedState.isDehydrated)try{$a(s.containerInfo)}catch(Ce){at(t,t.return,Ce)}Vu&&(Vu=!1,dg(t));break;case 4:c=Kn,Kn=fl(t.stateNode.containerInfo),dn(s,t),hn(t),Kn=c;break;case 12:dn(s,t),hn(t);break;case 31:dn(s,t),hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Jo(t,c)));break;case 13:dn(s,t),hn(t),t.child.flags&8192&&t.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(tl=Lt()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Jo(t,c)));break;case 22:f=t.memoizedState!==null;var L=o!==null&&o.memoizedState!==null,Z=Ns,ae=Ot;if(Ns=Z||f,Ot=ae||L,dn(s,t),Ot=ae,Ns=Z,hn(t),c&8192)e:for(s=t.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(o===null||L||Ns||Ot||_i(t)),o=null,s=t;;){if(s.tag===5||s.tag===26){if(o===null){L=o=s;try{if(g=L.stateNode,f)j=g.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{A=L.stateNode;var ue=L.memoizedProps.style,K=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;A.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(Ce){at(L,L.return,Ce)}}}else if(s.tag===6){if(o===null){L=s;try{L.stateNode.nodeValue=f?"":L.memoizedProps}catch(Ce){at(L,L.return,Ce)}}}else if(s.tag===18){if(o===null){L=s;try{var te=L.stateNode;f?ex(te,!0):ex(L.stateNode,!1)}catch(Ce){at(L,L.return,Ce)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}c&4&&(c=t.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,Jo(t,o))));break;case 19:dn(s,t),hn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Jo(t,c)));break;case 30:break;case 21:break;default:dn(s,t),hn(t)}}function hn(t){var s=t.flags;if(s&2){try{for(var o,c=t.return;c!==null;){if(ng(c)){o=c;break}c=c.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var f=o.stateNode,g=Pu(t);Wo(t,g,f);break;case 5:var j=o.stateNode;o.flags&32&&(ra(j,""),o.flags&=-33);var A=Pu(t);Wo(t,A,j);break;case 3:case 4:var L=o.stateNode.containerInfo,Z=Pu(t);Yu(t,Z,L);break;default:throw Error(r(161))}}catch(ae){at(t,t.return,ae)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function dg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;dg(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function Es(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)ag(t,s.alternate,s),s=s.sibling}function _i(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:ei(4,s,s.return),_i(s);break;case 1:rs(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&eg(s,s.return,o),_i(s);break;case 27:zr(s.stateNode);case 26:case 5:rs(s,s.return),_i(s);break;case 22:s.memoizedState===null&&_i(s);break;case 30:_i(s);break;default:_i(s)}t=t.sibling}}function zs(t,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var c=s.alternate,f=t,g=s,j=g.flags;switch(g.tag){case 0:case 11:case 15:zs(f,g,o),vr(4,g);break;case 1:if(zs(f,g,o),c=g,f=c.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(Z){at(c,c.return,Z)}if(c=g,f=c.updateQueue,f!==null){var A=c.stateNode;try{var L=f.shared.hiddenCallbacks;if(L!==null)for(f.shared.hiddenCallbacks=null,f=0;f<L.length;f++)qm(L[f],A)}catch(Z){at(c,c.return,Z)}}o&&j&64&&Jp(g),wr(g,g.return);break;case 27:sg(g);case 26:case 5:zs(f,g,o),o&&c===null&&j&4&&tg(g),wr(g,g.return);break;case 12:zs(f,g,o);break;case 31:zs(f,g,o),o&&j&4&&lg(f,g);break;case 13:zs(f,g,o),o&&j&4&&cg(f,g);break;case 22:g.memoizedState===null&&zs(f,g,o),wr(g,g.return);break;case 30:break;default:zs(f,g,o)}s=s.sibling}}function Zu(t,s){var o=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(o=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==o&&(t!=null&&t.refCount++,o!=null&&or(o))}function Xu(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&or(t))}function Wn(t,s,o,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)hg(t,s,o,c),s=s.sibling}function hg(t,s,o,c){var f=s.flags;switch(s.tag){case 0:case 11:case 15:Wn(t,s,o,c),f&2048&&vr(9,s);break;case 1:Wn(t,s,o,c);break;case 3:Wn(t,s,o,c),f&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&or(t)));break;case 12:if(f&2048){Wn(t,s,o,c),t=s.stateNode;try{var g=s.memoizedProps,j=g.id,A=g.onPostCommit;typeof A=="function"&&A(j,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(L){at(s,s.return,L)}}else Wn(t,s,o,c);break;case 31:Wn(t,s,o,c);break;case 13:Wn(t,s,o,c);break;case 23:break;case 22:g=s.stateNode,j=s.alternate,s.memoizedState!==null?g._visibility&2?Wn(t,s,o,c):jr(t,s):g._visibility&2?Wn(t,s,o,c):(g._visibility|=2,Aa(t,s,o,c,(s.subtreeFlags&10256)!==0||!1)),f&2048&&Zu(j,s);break;case 24:Wn(t,s,o,c),f&2048&&Xu(s.alternate,s);break;default:Wn(t,s,o,c)}}function Aa(t,s,o,c,f){for(f=f&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var g=t,j=s,A=o,L=c,Z=j.flags;switch(j.tag){case 0:case 11:case 15:Aa(g,j,A,L,f),vr(8,j);break;case 23:break;case 22:var ae=j.stateNode;j.memoizedState!==null?ae._visibility&2?Aa(g,j,A,L,f):jr(g,j):(ae._visibility|=2,Aa(g,j,A,L,f)),f&&Z&2048&&Zu(j.alternate,j);break;case 24:Aa(g,j,A,L,f),f&&Z&2048&&Xu(j.alternate,j);break;default:Aa(g,j,A,L,f)}s=s.sibling}}function jr(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=t,c=s,f=c.flags;switch(c.tag){case 22:jr(o,c),f&2048&&Zu(c.alternate,c);break;case 24:jr(o,c),f&2048&&Xu(c.alternate,c);break;default:jr(o,c)}s=s.sibling}}var kr=8192;function Na(t,s,o){if(t.subtreeFlags&kr)for(t=t.child;t!==null;)fg(t,s,o),t=t.sibling}function fg(t,s,o){switch(t.tag){case 26:Na(t,s,o),t.flags&kr&&t.memoizedState!==null&&b0(o,Kn,t.memoizedState,t.memoizedProps);break;case 5:Na(t,s,o);break;case 3:case 4:var c=Kn;Kn=fl(t.stateNode.containerInfo),Na(t,s,o),Kn=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=kr,kr=16777216,Na(t,s,o),kr=c):Na(t,s,o));break;default:Na(t,s,o)}}function mg(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Sr(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var c=s[o];Bt=c,gg(c,t)}mg(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)pg(t),t=t.sibling}function pg(t){switch(t.tag){case 0:case 11:case 15:Sr(t),t.flags&2048&&ei(9,t,t.return);break;case 3:Sr(t);break;case 12:Sr(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,el(t)):Sr(t);break;default:Sr(t)}}function el(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var c=s[o];Bt=c,gg(c,t)}mg(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:ei(8,s,s.return),el(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,el(s));break;default:el(s)}t=t.sibling}}function gg(t,s){for(;Bt!==null;){var o=Bt;switch(o.tag){case 0:case 11:case 15:ei(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:or(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Bt=c;else e:for(o=t;Bt!==null;){c=Bt;var f=c.sibling,g=c.return;if(rg(c),c===o){Bt=null;break e}if(f!==null){f.return=g,Bt=f;break e}Bt=g}}}var Dk={getCacheForType:function(t){var s=Yt(Tt),o=s.data.get(t);return o===void 0&&(o=t(),s.data.set(t,o)),o},cacheSignal:function(){return Yt(Tt).controller.signal}},Lk=typeof WeakMap=="function"?WeakMap:Map,nt=0,ut=null,Ge=null,Ye=0,it=0,Nn=null,ti=!1,Ta=!1,Qu=!1,Os=0,jt=0,ni=0,$i=0,Ku=0,Tn=0,Ea=0,Cr=null,fn=null,Wu=!1,tl=0,xg=0,nl=1/0,sl=null,si=null,_t=0,ii=null,za=null,Rs=0,Ju=0,ed=null,yg=null,Ar=0,td=null;function En(){return(nt&2)!==0&&Ye!==0?Ye&-Ye:F.T!==null?od():Df()}function bg(){if(Tn===0)if((Ye&536870912)===0||Ze){var t=jn;jn<<=1,(jn&3932160)===0&&(jn=262144),Tn=t}else Tn=536870912;return t=Cn.current,t!==null&&(t.flags|=32),Tn}function mn(t,s,o){(t===ut&&(it===2||it===9)||t.cancelPendingCommit!==null)&&(Oa(t,0),ai(t,Ye,Tn,!1)),qs(t,o),((nt&2)===0||t!==ut)&&(t===ut&&((nt&2)===0&&($i|=o),jt===4&&ai(t,Ye,Tn,!1)),os(t))}function vg(t,s,o){if((nt&6)!==0)throw Error(r(327));var c=!o&&(s&127)===0&&(s&t.expiredLanes)===0||Ft(t,s),f=c?Uk(t,s):sd(t,s,!0),g=c;do{if(f===0){Ta&&!c&&ai(t,s,0,!1);break}else{if(o=t.current.alternate,g&&!_k(o)){f=sd(t,s,!1),g=!1;continue}if(f===2){if(g=s,t.errorRecoveryDisabledLanes&g)var j=0;else j=t.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){s=j;e:{var A=t;f=Cr;var L=A.current.memoizedState.isDehydrated;if(L&&(Oa(A,j).flags|=256),j=sd(A,j,!1),j!==2){if(Qu&&!L){A.errorRecoveryDisabledLanes|=g,$i|=g,f=4;break e}g=fn,fn=f,g!==null&&(fn===null?fn=g:fn.push.apply(fn,g))}f=j}if(g=!1,f!==2)continue}}if(f===1){Oa(t,0),ai(t,s,0,!0);break}e:{switch(c=t,g=f,g){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:ai(c,s,Tn,!ti);break e;case 2:fn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(f=tl+300-Lt(),10<f)){if(ai(c,s,Tn,!ti),vt(c,0,!0)!==0)break e;Rs=s,c.timeoutHandle=Kg(wg.bind(null,c,o,fn,sl,Wu,s,Tn,$i,Ea,ti,g,"Throttled",-0,0),f);break e}wg(c,o,fn,sl,Wu,s,Tn,$i,Ea,ti,g,null,-0,0)}}break}while(!0);os(t)}function wg(t,s,o,c,f,g,j,A,L,Z,ae,ue,K,te){if(t.timeoutHandle=-1,ue=s.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xs},fg(s,g,ue);var Ce=(g&62914560)===g?tl-Lt():(g&4194048)===g?xg-Lt():0;if(Ce=v0(ue,Ce),Ce!==null){Rs=g,t.cancelPendingCommit=Ce(Eg.bind(null,t,s,g,o,c,f,j,A,L,ae,ue,null,K,te)),ai(t,g,j,!Z);return}}Eg(t,s,g,o,c,f,j,A,L)}function _k(t){for(var s=t;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var f=o[c],g=f.getSnapshot;f=f.value;try{if(!kn(g(),f))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ai(t,s,o,c){s&=~Ku,s&=~$i,t.suspendedLanes|=s,t.pingedLanes&=~s,c&&(t.warmLanes|=s),c=t.expirationTimes;for(var f=s;0<f;){var g=31-At(f),j=1<<g;c[g]=-1,f&=~j}o!==0&&Ji(t,o,s)}function il(){return(nt&6)===0?(Nr(0),!1):!0}function nd(){if(Ge!==null){if(it===0)var t=Ge.return;else t=Ge,ws=Ti=null,yu(t),wa=null,cr=0,t=Ge;for(;t!==null;)Wp(t.alternate,t),t=t.return;Ge=null}}function Oa(t,s){var o=t.timeoutHandle;o!==-1&&(t.timeoutHandle=-1,n0(o)),o=t.cancelPendingCommit,o!==null&&(t.cancelPendingCommit=null,o()),Rs=0,nd(),ut=t,Ge=o=bs(t.current,null),Ye=s,it=0,Nn=null,ti=!1,Ta=Ft(t,s),Qu=!1,Ea=Tn=Ku=$i=ni=jt=0,fn=Cr=null,Wu=!1,(s&8)!==0&&(s|=s&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=s;0<c;){var f=31-At(c),g=1<<f;s|=t[f],c&=~g}return Os=s,Co(),o}function jg(t,s){Ie=null,F.H=xr,s===va||s===Mo?(s=Um(),it=3):s===ru?(s=Um(),it=4):it=s===Du?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Nn=s,Ge===null&&(jt=1,Vo(t,$n(s,t.current)))}function kg(){var t=Cn.current;return t===null?!0:(Ye&4194048)===Ye?Hn===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?t===Hn:!1}function Sg(){var t=F.H;return F.H=xr,t===null?xr:t}function Cg(){var t=F.A;return F.A=Dk,t}function al(){jt=4,ti||(Ye&4194048)!==Ye&&Cn.current!==null||(Ta=!0),(ni&134217727)===0&&($i&134217727)===0||ut===null||ai(ut,Ye,Tn,!1)}function sd(t,s,o){var c=nt;nt|=2;var f=Sg(),g=Cg();(ut!==t||Ye!==s)&&(sl=null,Oa(t,s)),s=!1;var j=jt;e:do try{if(it!==0&&Ge!==null){var A=Ge,L=Nn;switch(it){case 8:nd(),j=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(s=!0);var Z=it;if(it=0,Nn=null,Ra(t,A,L,Z),o&&Ta){j=0;break e}break;default:Z=it,it=0,Nn=null,Ra(t,A,L,Z)}}$k(),j=jt;break}catch(ae){jg(t,ae)}while(!0);return s&&t.shellSuspendCounter++,ws=Ti=null,nt=c,F.H=f,F.A=g,Ge===null&&(ut=null,Ye=0,Co()),j}function $k(){for(;Ge!==null;)Ag(Ge)}function Uk(t,s){var o=nt;nt|=2;var c=Sg(),f=Cg();ut!==t||Ye!==s?(sl=null,nl=Lt()+500,Oa(t,s)):Ta=Ft(t,s);e:do try{if(it!==0&&Ge!==null){s=Ge;var g=Nn;t:switch(it){case 1:it=0,Nn=null,Ra(t,s,g,1);break;case 2:case 9:if(_m(g)){it=0,Nn=null,Ng(s);break}s=function(){it!==2&&it!==9||ut!==t||(it=7),os(t)},g.then(s,s);break e;case 3:it=7;break e;case 4:it=5;break e;case 7:_m(g)?(it=0,Nn=null,Ng(s)):(it=0,Nn=null,Ra(t,s,g,7));break;case 5:var j=null;switch(Ge.tag){case 26:j=Ge.memoizedState;case 5:case 27:var A=Ge;if(j?hx(j):A.stateNode.complete){it=0,Nn=null;var L=A.sibling;if(L!==null)Ge=L;else{var Z=A.return;Z!==null?(Ge=Z,rl(Z)):Ge=null}break t}}it=0,Nn=null,Ra(t,s,g,5);break;case 6:it=0,Nn=null,Ra(t,s,g,6);break;case 8:nd(),jt=6;break e;default:throw Error(r(462))}}Ik();break}catch(ae){jg(t,ae)}while(!0);return ws=Ti=null,F.H=c,F.A=f,nt=o,Ge!==null?0:(ut=null,Ye=0,Co(),jt)}function Ik(){for(;Ge!==null&&!Xn();)Ag(Ge)}function Ag(t){var s=Qp(t.alternate,t,Os);t.memoizedProps=t.pendingProps,s===null?rl(t):Ge=s}function Ng(t){var s=t,o=s.alternate;switch(s.tag){case 15:case 0:s=Gp(o,s,s.pendingProps,s.type,void 0,Ye);break;case 11:s=Gp(o,s,s.pendingProps,s.type.render,s.ref,Ye);break;case 5:yu(s);default:Wp(o,s),s=Ge=Cm(s,Os),s=Qp(o,s,Os)}t.memoizedProps=t.pendingProps,s===null?rl(t):Ge=s}function Ra(t,s,o,c){ws=Ti=null,yu(s),wa=null,cr=0;var f=s.return;try{if(Nk(t,f,s,o,Ye)){jt=1,Vo(t,$n(o,t.current)),Ge=null;return}}catch(g){if(f!==null)throw Ge=f,g;jt=1,Vo(t,$n(o,t.current)),Ge=null;return}s.flags&32768?(Ze||c===1?t=!0:Ta||(Ye&536870912)!==0?t=!1:(ti=t=!0,(c===2||c===9||c===3||c===6)&&(c=Cn.current,c!==null&&c.tag===13&&(c.flags|=16384))),Tg(s,t)):rl(s)}function rl(t){var s=t;do{if((s.flags&32768)!==0){Tg(s,ti);return}t=s.return;var o=zk(s.alternate,s,Os);if(o!==null){Ge=o;return}if(s=s.sibling,s!==null){Ge=s;return}Ge=s=t}while(s!==null);jt===0&&(jt=5)}function Tg(t,s){do{var o=Ok(t.alternate,t);if(o!==null){o.flags&=32767,Ge=o;return}if(o=t.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(t=t.sibling,t!==null)){Ge=t;return}Ge=t=o}while(t!==null);jt=6,Ge=null}function Eg(t,s,o,c,f,g,j,A,L){t.cancelPendingCommit=null;do ol();while(_t!==0);if((nt&6)!==0)throw Error(r(327));if(s!==null){if(s===t.current)throw Error(r(177));if(g=s.lanes|s.childLanes,g|=Pc,vi(t,o,g,j,A,L),t===ut&&(Ge=ut=null,Ye=0),za=s,ii=t,Rs=o,Ju=g,ed=f,yg=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Fk(fe,function(){return Dg(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=F.T,F.T=null,f=B.p,B.p=2,j=nt,nt|=4;try{Rk(t,s,o)}finally{nt=j,B.p=f,F.T=c}}_t=1,zg(),Og(),Rg()}}function zg(){if(_t===1){_t=0;var t=ii,s=za,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=F.T,F.T=null;var c=B.p;B.p=2;var f=nt;nt|=4;try{ug(s,t);var g=pd,j=gm(t.containerInfo),A=g.focusedElem,L=g.selectionRange;if(j!==A&&A&&A.ownerDocument&&pm(A.ownerDocument.documentElement,A)){if(L!==null&&Bc(A)){var Z=L.start,ae=L.end;if(ae===void 0&&(ae=Z),"selectionStart"in A)A.selectionStart=Z,A.selectionEnd=Math.min(ae,A.value.length);else{var ue=A.ownerDocument||document,K=ue&&ue.defaultView||window;if(K.getSelection){var te=K.getSelection(),Ce=A.textContent.length,Re=Math.min(L.start,Ce),ct=L.end===void 0?Re:Math.min(L.end,Ce);!te.extend&&Re>ct&&(j=ct,ct=Re,Re=j);var P=mm(A,Re),H=mm(A,ct);if(P&&H&&(te.rangeCount!==1||te.anchorNode!==P.node||te.anchorOffset!==P.offset||te.focusNode!==H.node||te.focusOffset!==H.offset)){var V=ue.createRange();V.setStart(P.node,P.offset),te.removeAllRanges(),Re>ct?(te.addRange(V),te.extend(H.node,H.offset)):(V.setEnd(H.node,H.offset),te.addRange(V))}}}}for(ue=[],te=A;te=te.parentNode;)te.nodeType===1&&ue.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<ue.length;A++){var le=ue[A];le.element.scrollLeft=le.left,le.element.scrollTop=le.top}}bl=!!md,pd=md=null}finally{nt=f,B.p=c,F.T=o}}t.current=s,_t=2}}function Og(){if(_t===2){_t=0;var t=ii,s=za,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=F.T,F.T=null;var c=B.p;B.p=2;var f=nt;nt|=4;try{ag(t,s.alternate,s)}finally{nt=f,B.p=c,F.T=o}}_t=3}}function Rg(){if(_t===4||_t===3){_t=0,Mn();var t=ii,s=za,o=Rs,c=yg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?_t=5:(_t=0,za=ii=null,Mg(t,t.pendingLanes));var f=t.pendingLanes;if(f===0&&(si=null),wc(o),s=s.stateNode,Ke&&typeof Ke.onCommitFiberRoot=="function")try{Ke.onCommitFiberRoot(bt,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=F.T,f=B.p,B.p=2,F.T=null;try{for(var g=t.onRecoverableError,j=0;j<c.length;j++){var A=c[j];g(A.value,{componentStack:A.stack})}}finally{F.T=s,B.p=f}}(Rs&3)!==0&&ol(),os(t),f=t.pendingLanes,(o&261930)!==0&&(f&42)!==0?t===td?Ar++:(Ar=0,td=t):Ar=0,Nr(0)}}function Mg(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,or(s)))}function ol(){return zg(),Og(),Rg(),Dg()}function Dg(){if(_t!==5)return!1;var t=ii,s=Ju;Ju=0;var o=wc(Rs),c=F.T,f=B.p;try{B.p=32>o?32:o,F.T=null,o=ed,ed=null;var g=ii,j=Rs;if(_t=0,za=ii=null,Rs=0,(nt&6)!==0)throw Error(r(331));var A=nt;if(nt|=4,pg(g.current),hg(g,g.current,j,o),nt=A,Nr(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot(bt,g)}catch{}return!0}finally{B.p=f,F.T=c,Mg(t,s)}}function Lg(t,s,o){s=$n(o,s),s=Mu(t.stateNode,s,2),t=Ks(t,s,2),t!==null&&(qs(t,2),os(t))}function at(t,s,o){if(t.tag===3)Lg(t,t,o);else for(;s!==null;){if(s.tag===3){Lg(s,t,o);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(si===null||!si.has(c))){t=$n(o,t),o=_p(2),c=Ks(s,o,2),c!==null&&($p(o,c,s,t),qs(c,2),os(c));break}}s=s.return}}function id(t,s,o){var c=t.pingCache;if(c===null){c=t.pingCache=new Lk;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(o)||(Qu=!0,f.add(o),t=Bk.bind(null,t,s,o),s.then(t,t))}function Bk(t,s,o){var c=t.pingCache;c!==null&&c.delete(s),t.pingedLanes|=t.suspendedLanes&o,t.warmLanes&=~o,ut===t&&(Ye&o)===o&&(jt===4||jt===3&&(Ye&62914560)===Ye&&300>Lt()-tl?(nt&2)===0&&Oa(t,0):Ku|=o,Ea===Ye&&(Ea=0)),os(t)}function _g(t,s){s===0&&(s=Ki()),t=Ci(t,s),t!==null&&(qs(t,s),os(t))}function Hk(t){var s=t.memoizedState,o=0;s!==null&&(o=s.retryLane),_g(t,o)}function qk(t,s){var o=0;switch(t.tag){case 31:case 13:var c=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(s),_g(t,o)}function Fk(t,s){return wn(t,s)}var ll=null,Ma=null,ad=!1,cl=!1,rd=!1,ri=0;function os(t){t!==Ma&&t.next===null&&(Ma===null?ll=Ma=t:Ma=Ma.next=t),cl=!0,ad||(ad=!0,Pk())}function Nr(t,s){if(!rd&&cl){rd=!0;do for(var o=!1,c=ll;c!==null;){if(t!==0){var f=c.pendingLanes;if(f===0)var g=0;else{var j=c.suspendedLanes,A=c.pingedLanes;g=(1<<31-At(42|t)+1)-1,g&=f&~(j&~A),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(o=!0,Bg(c,g))}else g=Ye,g=vt(c,c===ut?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||Ft(c,g)||(o=!0,Bg(c,g));c=c.next}while(o);rd=!1}}function Gk(){$g()}function $g(){cl=ad=!1;var t=0;ri!==0&&t0()&&(t=ri);for(var s=Lt(),o=null,c=ll;c!==null;){var f=c.next,g=Ug(c,s);g===0?(c.next=null,o===null?ll=f:o.next=f,f===null&&(Ma=o)):(o=c,(t!==0||(g&3)!==0)&&(cl=!0)),c=f}_t!==0&&_t!==5||Nr(t),ri!==0&&(ri=0)}function Ug(t,s){for(var o=t.suspendedLanes,c=t.pingedLanes,f=t.expirationTimes,g=t.pendingLanes&-62914561;0<g;){var j=31-At(g),A=1<<j,L=f[j];L===-1?((A&o)===0||(A&c)!==0)&&(f[j]=Ya(A,s)):L<=s&&(t.expiredLanes|=A),g&=~A}if(s=ut,o=Ye,o=vt(t,t===s?o:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,o===0||t===s&&(it===2||it===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&on(c),t.callbackNode=null,t.callbackPriority=0;if((o&3)===0||Ft(t,o)){if(s=o&-o,s===t.callbackPriority)return s;switch(c!==null&&on(c),wc(o)){case 2:case 8:o=ne;break;case 32:o=fe;break;case 268435456:o=Le;break;default:o=fe}return c=Ig.bind(null,t),o=wn(o,c),t.callbackPriority=s,t.callbackNode=o,s}return c!==null&&c!==null&&on(c),t.callbackPriority=2,t.callbackNode=null,2}function Ig(t,s){if(_t!==0&&_t!==5)return t.callbackNode=null,t.callbackPriority=0,null;var o=t.callbackNode;if(ol()&&t.callbackNode!==o)return null;var c=Ye;return c=vt(t,t===ut?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(vg(t,c,s),Ug(t,Lt()),t.callbackNode!=null&&t.callbackNode===o?Ig.bind(null,t):null)}function Bg(t,s){if(ol())return null;vg(t,s,!0)}function Pk(){s0(function(){(nt&6)!==0?wn(ms,Gk):$g()})}function od(){if(ri===0){var t=ya;t===0&&(t=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),ri=t}return ri}function Hg(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:xo(""+t)}function qg(t,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,t.id&&o.setAttribute("form",t.id),s.parentNode.insertBefore(o,s),t=new FormData(t),o.parentNode.removeChild(o),t}function Yk(t,s,o,c,f){if(s==="submit"&&o&&o.stateNode===f){var g=Hg((f[ln]||null).action),j=c.submitter;j&&(s=(s=j[ln]||null)?Hg(s.formAction):j.getAttribute("formAction"),s!==null&&(g=s,j=null));var A=new wo("action","action",null,c,f);t.push({event:A,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(ri!==0){var L=j?qg(f,j):new FormData(f);Nu(o,{pending:!0,data:L,method:f.method,action:g},null,L)}}else typeof g=="function"&&(A.preventDefault(),L=j?qg(f,j):new FormData(f),Nu(o,{pending:!0,data:L,method:f.method,action:g},g,L))},currentTarget:f}]})}}for(var ld=0;ld<Gc.length;ld++){var cd=Gc[ld],Vk=cd.toLowerCase(),Zk=cd[0].toUpperCase()+cd.slice(1);Qn(Vk,"on"+Zk)}Qn(bm,"onAnimationEnd"),Qn(vm,"onAnimationIteration"),Qn(wm,"onAnimationStart"),Qn("dblclick","onDoubleClick"),Qn("focusin","onFocus"),Qn("focusout","onBlur"),Qn(uk,"onTransitionRun"),Qn(dk,"onTransitionStart"),Qn(hk,"onTransitionCancel"),Qn(jm,"onTransitionEnd"),ia("onMouseEnter",["mouseout","mouseover"]),ia("onMouseLeave",["mouseout","mouseover"]),ia("onPointerEnter",["pointerout","pointerover"]),ia("onPointerLeave",["pointerout","pointerover"]),wi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wi("onBeforeInput",["compositionend","keypress","textInput","paste"]),wi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="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(" "),Xk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tr));function Fg(t,s){s=(s&4)!==0;for(var o=0;o<t.length;o++){var c=t[o],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var j=c.length-1;0<=j;j--){var A=c[j],L=A.instance,Z=A.currentTarget;if(A=A.listener,L!==g&&f.isPropagationStopped())break e;g=A,f.currentTarget=Z;try{g(f)}catch(ae){So(ae)}f.currentTarget=null,g=L}else for(j=0;j<c.length;j++){if(A=c[j],L=A.instance,Z=A.currentTarget,A=A.listener,L!==g&&f.isPropagationStopped())break e;g=A,f.currentTarget=Z;try{g(f)}catch(ae){So(ae)}f.currentTarget=null,g=L}}}}function Pe(t,s){var o=s[jc];o===void 0&&(o=s[jc]=new Set);var c=t+"__bubble";o.has(c)||(Gg(s,t,2,!1),o.add(c))}function ud(t,s,o){var c=0;s&&(c|=4),Gg(o,t,c,s)}var ul="_reactListening"+Math.random().toString(36).slice(2);function dd(t){if(!t[ul]){t[ul]=!0,$f.forEach(function(o){o!=="selectionchange"&&(Xk.has(o)||ud(o,!1,t),ud(o,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[ul]||(s[ul]=!0,ud("selectionchange",!1,s))}}function Gg(t,s,o,c){switch(bx(s)){case 2:var f=k0;break;case 8:f=S0;break;default:f=Ad}o=f.bind(null,s,o,t),f=void 0,!Oc||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?t.addEventListener(s,o,{capture:!0,passive:f}):t.addEventListener(s,o,!0):f!==void 0?t.addEventListener(s,o,{passive:f}):t.addEventListener(s,o,!1)}function hd(t,s,o,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var j=c.tag;if(j===3||j===4){var A=c.stateNode.containerInfo;if(A===f)break;if(j===4)for(j=c.return;j!==null;){var L=j.tag;if((L===3||L===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;A!==null;){if(j=ta(A),j===null)return;if(L=j.tag,L===5||L===6||L===26||L===27){c=g=j;continue e}A=A.parentNode}}c=c.return}Xf(function(){var Z=g,ae=Ec(o),ue=[];e:{var K=km.get(t);if(K!==void 0){var te=wo,Ce=t;switch(t){case"keypress":if(bo(o)===0)break e;case"keydown":case"keyup":te=qj;break;case"focusin":Ce="focus",te=Lc;break;case"focusout":Ce="blur",te=Lc;break;case"beforeblur":case"afterblur":te=Lc;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=Wf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=zj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=Pj;break;case bm:case vm:case wm:te=Mj;break;case jm:te=Vj;break;case"scroll":case"scrollend":te=Tj;break;case"wheel":te=Xj;break;case"copy":case"cut":case"paste":te=Lj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=em;break;case"toggle":case"beforetoggle":te=Kj}var Re=(s&4)!==0,ct=!Re&&(t==="scroll"||t==="scrollend"),P=Re?K!==null?K+"Capture":null:K;Re=[];for(var H=Z,V;H!==null;){var le=H;if(V=le.stateNode,le=le.tag,le!==5&&le!==26&&le!==27||V===null||P===null||(le=Qa(H,P),le!=null&&Re.push(Er(H,le,V))),ct)break;H=H.return}0<Re.length&&(K=new te(K,Ce,null,o,ae),ue.push({event:K,listeners:Re}))}}if((s&7)===0){e:{if(K=t==="mouseover"||t==="pointerover",te=t==="mouseout"||t==="pointerout",K&&o!==Tc&&(Ce=o.relatedTarget||o.fromElement)&&(ta(Ce)||Ce[ea]))break e;if((te||K)&&(K=ae.window===ae?ae:(K=ae.ownerDocument)?K.defaultView||K.parentWindow:window,te?(Ce=o.relatedTarget||o.toElement,te=Z,Ce=Ce?ta(Ce):null,Ce!==null&&(ct=u(Ce),Re=Ce.tag,Ce!==ct||Re!==5&&Re!==27&&Re!==6)&&(Ce=null)):(te=null,Ce=Z),te!==Ce)){if(Re=Wf,le="onMouseLeave",P="onMouseEnter",H="mouse",(t==="pointerout"||t==="pointerover")&&(Re=em,le="onPointerLeave",P="onPointerEnter",H="pointer"),ct=te==null?K:Xa(te),V=Ce==null?K:Xa(Ce),K=new Re(le,H+"leave",te,o,ae),K.target=ct,K.relatedTarget=V,le=null,ta(ae)===Z&&(Re=new Re(P,H+"enter",Ce,o,ae),Re.target=V,Re.relatedTarget=ct,le=Re),ct=le,te&&Ce)t:{for(Re=Qk,P=te,H=Ce,V=0,le=P;le;le=Re(le))V++;le=0;for(var ze=H;ze;ze=Re(ze))le++;for(;0<V-le;)P=Re(P),V--;for(;0<le-V;)H=Re(H),le--;for(;V--;){if(P===H||H!==null&&P===H.alternate){Re=P;break t}P=Re(P),H=Re(H)}Re=null}else Re=null;te!==null&&Pg(ue,K,te,Re,!1),Ce!==null&&ct!==null&&Pg(ue,ct,Ce,Re,!0)}}e:{if(K=Z?Xa(Z):window,te=K.nodeName&&K.nodeName.toLowerCase(),te==="select"||te==="input"&&K.type==="file")var We=lm;else if(rm(K))if(cm)We=ok;else{We=ak;var Ne=ik}else te=K.nodeName,!te||te.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?Z&&Nc(Z.elementType)&&(We=lm):We=rk;if(We&&(We=We(t,Z))){om(ue,We,o,ae);break e}Ne&&Ne(t,K,Z),t==="focusout"&&Z&&K.type==="number"&&Z.memoizedProps.value!=null&&Ac(K,"number",K.value)}switch(Ne=Z?Xa(Z):window,t){case"focusin":(rm(Ne)||Ne.contentEditable==="true")&&(ua=Ne,Hc=Z,ir=null);break;case"focusout":ir=Hc=ua=null;break;case"mousedown":qc=!0;break;case"contextmenu":case"mouseup":case"dragend":qc=!1,xm(ue,o,ae);break;case"selectionchange":if(ck)break;case"keydown":case"keyup":xm(ue,o,ae)}var Be;if($c)e:{switch(t){case"compositionstart":var Ve="onCompositionStart";break e;case"compositionend":Ve="onCompositionEnd";break e;case"compositionupdate":Ve="onCompositionUpdate";break e}Ve=void 0}else ca?im(t,o)&&(Ve="onCompositionEnd"):t==="keydown"&&o.keyCode===229&&(Ve="onCompositionStart");Ve&&(tm&&o.locale!=="ko"&&(ca||Ve!=="onCompositionStart"?Ve==="onCompositionEnd"&&ca&&(Be=Qf()):(Gs=ae,Rc="value"in Gs?Gs.value:Gs.textContent,ca=!0)),Ne=dl(Z,Ve),0<Ne.length&&(Ve=new Jf(Ve,t,null,o,ae),ue.push({event:Ve,listeners:Ne}),Be?Ve.data=Be:(Be=am(o),Be!==null&&(Ve.data=Be)))),(Be=Jj?ek(t,o):tk(t,o))&&(Ve=dl(Z,"onBeforeInput"),0<Ve.length&&(Ne=new Jf("onBeforeInput","beforeinput",null,o,ae),ue.push({event:Ne,listeners:Ve}),Ne.data=Be)),Yk(ue,t,Z,o,ae)}Fg(ue,s)})}function Er(t,s,o){return{instance:t,listener:s,currentTarget:o}}function dl(t,s){for(var o=s+"Capture",c=[];t!==null;){var f=t,g=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||g===null||(f=Qa(t,o),f!=null&&c.unshift(Er(t,f,g)),f=Qa(t,s),f!=null&&c.push(Er(t,f,g))),t.tag===3)return c;t=t.return}return[]}function Qk(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Pg(t,s,o,c,f){for(var g=s._reactName,j=[];o!==null&&o!==c;){var A=o,L=A.alternate,Z=A.stateNode;if(A=A.tag,L!==null&&L===c)break;A!==5&&A!==26&&A!==27||Z===null||(L=Z,f?(Z=Qa(o,g),Z!=null&&j.unshift(Er(o,Z,L))):f||(Z=Qa(o,g),Z!=null&&j.push(Er(o,Z,L)))),o=o.return}j.length!==0&&t.push({event:s,listeners:j})}var Kk=/\r\n?/g,Wk=/\u0000|\uFFFD/g;function Yg(t){return(typeof t=="string"?t:""+t).replace(Kk,`
|
|
9
|
+
`).replace(Wk,"")}function Vg(t,s){return s=Yg(s),Yg(t)===s}function lt(t,s,o,c,f,g){switch(o){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||ra(t,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&ra(t,""+c);break;case"className":po(t,"class",c);break;case"tabIndex":po(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":po(t,o,c);break;case"style":Vf(t,c,g);break;case"data":if(s!=="object"){po(t,"data",c);break}case"src":case"href":if(c===""&&(s!=="a"||o!=="href")){t.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(o);break}c=xo(""+c),t.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(o==="formAction"?(s!=="input"&<(t,s,"name",f.name,f,null),lt(t,s,"formEncType",f.formEncType,f,null),lt(t,s,"formMethod",f.formMethod,f,null),lt(t,s,"formTarget",f.formTarget,f,null)):(lt(t,s,"encType",f.encType,f,null),lt(t,s,"method",f.method,f,null),lt(t,s,"target",f.target,f,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(o);break}c=xo(""+c),t.setAttribute(o,c);break;case"onClick":c!=null&&(t.onclick=xs);break;case"onScroll":c!=null&&Pe("scroll",t);break;case"onScrollEnd":c!=null&&Pe("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(f.children!=null)throw Error(r(60));t.innerHTML=o}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}o=xo(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,""+c):t.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,""):t.removeAttribute(o);break;case"capture":case"download":c===!0?t.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(o,c):t.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(o,c):t.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(o):t.setAttribute(o,c);break;case"popover":Pe("beforetoggle",t),Pe("toggle",t),mo(t,"popover",c);break;case"xlinkActuate":gs(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":gs(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":gs(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":gs(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":gs(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":gs(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":gs(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":gs(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":gs(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":mo(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Aj.get(o)||o,mo(t,o,c))}}function fd(t,s,o,c,f,g){switch(o){case"style":Vf(t,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(f.children!=null)throw Error(r(60));t.innerHTML=o}}break;case"children":typeof c=="string"?ra(t,c):(typeof c=="number"||typeof c=="bigint")&&ra(t,""+c);break;case"onScroll":c!=null&&Pe("scroll",t);break;case"onScrollEnd":c!=null&&Pe("scrollend",t);break;case"onClick":c!=null&&(t.onclick=xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Uf.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(f=o.endsWith("Capture"),s=o.slice(2,f?o.length-7:void 0),g=t[ln]||null,g=g!=null?g[o]:null,typeof g=="function"&&t.removeEventListener(s,g,f),typeof c=="function")){typeof g!="function"&&g!==null&&(o in t?t[o]=null:t.hasAttribute(o)&&t.removeAttribute(o)),t.addEventListener(s,c,f);break e}o in t?t[o]=c:c===!0?t.setAttribute(o,""):mo(t,o,c)}}}function Zt(t,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",t),Pe("load",t);var c=!1,f=!1,g;for(g in o)if(o.hasOwnProperty(g)){var j=o[g];if(j!=null)switch(g){case"src":c=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:lt(t,s,g,j,o,null)}}f&<(t,s,"srcSet",o.srcSet,o,null),c&<(t,s,"src",o.src,o,null);return;case"input":Pe("invalid",t);var A=g=j=f=null,L=null,Z=null;for(c in o)if(o.hasOwnProperty(c)){var ae=o[c];if(ae!=null)switch(c){case"name":f=ae;break;case"type":j=ae;break;case"checked":L=ae;break;case"defaultChecked":Z=ae;break;case"value":g=ae;break;case"defaultValue":A=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,s));break;default:lt(t,s,c,ae,o,null)}}Ff(t,g,A,L,Z,j,f,!1);return;case"select":Pe("invalid",t),c=j=g=null;for(f in o)if(o.hasOwnProperty(f)&&(A=o[f],A!=null))switch(f){case"value":g=A;break;case"defaultValue":j=A;break;case"multiple":c=A;default:lt(t,s,f,A,o,null)}s=g,o=j,t.multiple=!!c,s!=null?aa(t,!!c,s,!1):o!=null&&aa(t,!!c,o,!0);return;case"textarea":Pe("invalid",t),g=f=c=null;for(j in o)if(o.hasOwnProperty(j)&&(A=o[j],A!=null))switch(j){case"value":c=A;break;case"defaultValue":f=A;break;case"children":g=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(r(91));break;default:lt(t,s,j,A,o,null)}Pf(t,c,f,g);return;case"option":for(L in o)o.hasOwnProperty(L)&&(c=o[L],c!=null)&&(L==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":lt(t,s,L,c,o,null));return;case"dialog":Pe("beforetoggle",t),Pe("toggle",t),Pe("cancel",t),Pe("close",t);break;case"iframe":case"object":Pe("load",t);break;case"video":case"audio":for(c=0;c<Tr.length;c++)Pe(Tr[c],t);break;case"image":Pe("error",t),Pe("load",t);break;case"details":Pe("toggle",t);break;case"embed":case"source":case"link":Pe("error",t),Pe("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in o)if(o.hasOwnProperty(Z)&&(c=o[Z],c!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:lt(t,s,Z,c,o,null)}return;default:if(Nc(s)){for(ae in o)o.hasOwnProperty(ae)&&(c=o[ae],c!==void 0&&fd(t,s,ae,c,o,void 0));return}}for(A in o)o.hasOwnProperty(A)&&(c=o[A],c!=null&<(t,s,A,c,o,null))}function Jk(t,s,o,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,g=null,j=null,A=null,L=null,Z=null,ae=null;for(te in o){var ue=o[te];if(o.hasOwnProperty(te)&&ue!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":L=ue;default:c.hasOwnProperty(te)||lt(t,s,te,null,c,ue)}}for(var K in c){var te=c[K];if(ue=o[K],c.hasOwnProperty(K)&&(te!=null||ue!=null))switch(K){case"type":g=te;break;case"name":f=te;break;case"checked":Z=te;break;case"defaultChecked":ae=te;break;case"value":j=te;break;case"defaultValue":A=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,s));break;default:te!==ue&<(t,s,K,te,c,ue)}}Cc(t,j,A,L,Z,ae,g,f);return;case"select":te=j=A=K=null;for(g in o)if(L=o[g],o.hasOwnProperty(g)&&L!=null)switch(g){case"value":break;case"multiple":te=L;default:c.hasOwnProperty(g)||lt(t,s,g,null,c,L)}for(f in c)if(g=c[f],L=o[f],c.hasOwnProperty(f)&&(g!=null||L!=null))switch(f){case"value":K=g;break;case"defaultValue":A=g;break;case"multiple":j=g;default:g!==L&<(t,s,f,g,c,L)}s=A,o=j,c=te,K!=null?aa(t,!!o,K,!1):!!c!=!!o&&(s!=null?aa(t,!!o,s,!0):aa(t,!!o,o?[]:"",!1));return;case"textarea":te=K=null;for(A in o)if(f=o[A],o.hasOwnProperty(A)&&f!=null&&!c.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:lt(t,s,A,null,c,f)}for(j in c)if(f=c[j],g=o[j],c.hasOwnProperty(j)&&(f!=null||g!=null))switch(j){case"value":K=f;break;case"defaultValue":te=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==g&<(t,s,j,f,c,g)}Gf(t,K,te);return;case"option":for(var Ce in o)K=o[Ce],o.hasOwnProperty(Ce)&&K!=null&&!c.hasOwnProperty(Ce)&&(Ce==="selected"?t.selected=!1:lt(t,s,Ce,null,c,K));for(L in c)K=c[L],te=o[L],c.hasOwnProperty(L)&&K!==te&&(K!=null||te!=null)&&(L==="selected"?t.selected=K&&typeof K!="function"&&typeof K!="symbol":lt(t,s,L,K,c,te));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 Re in o)K=o[Re],o.hasOwnProperty(Re)&&K!=null&&!c.hasOwnProperty(Re)&<(t,s,Re,null,c,K);for(Z in c)if(K=c[Z],te=o[Z],c.hasOwnProperty(Z)&&K!==te&&(K!=null||te!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,s));break;default:lt(t,s,Z,K,c,te)}return;default:if(Nc(s)){for(var ct in o)K=o[ct],o.hasOwnProperty(ct)&&K!==void 0&&!c.hasOwnProperty(ct)&&fd(t,s,ct,void 0,c,K);for(ae in c)K=c[ae],te=o[ae],!c.hasOwnProperty(ae)||K===te||K===void 0&&te===void 0||fd(t,s,ae,K,c,te);return}}for(var P in o)K=o[P],o.hasOwnProperty(P)&&K!=null&&!c.hasOwnProperty(P)&<(t,s,P,null,c,K);for(ue in c)K=c[ue],te=o[ue],!c.hasOwnProperty(ue)||K===te||K==null&&te==null||lt(t,s,ue,K,c,te)}function Zg(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function e0(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var f=o[c],g=f.transferSize,j=f.initiatorType,A=f.duration;if(g&&A&&Zg(j)){for(j=0,A=f.responseEnd,c+=1;c<o.length;c++){var L=o[c],Z=L.startTime;if(Z>A)break;var ae=L.transferSize,ue=L.initiatorType;ae&&Zg(ue)&&(L=L.responseEnd,j+=ae*(L<A?1:(A-Z)/(L-Z)))}if(--c,s+=8*(g+j)/(f.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var md=null,pd=null;function hl(t){return t.nodeType===9?t:t.ownerDocument}function Xg(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Qg(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function gd(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var xd=null;function t0(){var t=window.event;return t&&t.type==="popstate"?t===xd?!1:(xd=t,!0):(xd=null,!1)}var Kg=typeof setTimeout=="function"?setTimeout:void 0,n0=typeof clearTimeout=="function"?clearTimeout:void 0,Wg=typeof Promise=="function"?Promise:void 0,s0=typeof queueMicrotask=="function"?queueMicrotask:typeof Wg<"u"?function(t){return Wg.resolve(null).then(t).catch(i0)}:Kg;function i0(t){setTimeout(function(){throw t})}function oi(t){return t==="head"}function Jg(t,s){var o=s,c=0;do{var f=o.nextSibling;if(t.removeChild(o),f&&f.nodeType===8)if(o=f.data,o==="/$"||o==="/&"){if(c===0){t.removeChild(f),$a(s);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")zr(t.ownerDocument.documentElement);else if(o==="head"){o=t.ownerDocument.head,zr(o);for(var g=o.firstChild;g;){var j=g.nextSibling,A=g.nodeName;g[Za]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&g.rel.toLowerCase()==="stylesheet"||o.removeChild(g),g=j}}else o==="body"&&zr(t.ownerDocument.body);o=f}while(o);$a(s)}function ex(t,s){var o=t;t=0;do{var c=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(t===0)break;t--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||t++;o=c}while(o)}function yd(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":yd(o),kc(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}t.removeChild(o)}}function a0(t,s,o,c){for(;t.nodeType===1;){var f=o;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[Za])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(g=t.getAttribute("rel"),g==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(g!==f.rel||t.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||t.getAttribute("title")!==(f.title==null?null:f.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(g=t.getAttribute("src"),(g!==(f.src==null?null:f.src)||t.getAttribute("type")!==(f.type==null?null:f.type)||t.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&g&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var g=f.name==null?null:""+f.name;if(f.type==="hidden"&&t.getAttribute("name")===g)return t}else return t;if(t=qn(t.nextSibling),t===null)break}return null}function r0(t,s,o){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!o||(t=qn(t.nextSibling),t===null))return null;return t}function tx(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=qn(t.nextSibling),t===null))return null;return t}function bd(t){return t.data==="$?"||t.data==="$~"}function vd(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function o0(t,s){var o=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||o.readyState!=="loading")s();else{var c=function(){s(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function qn(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var wd=null;function nx(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="/$"||o==="/&"){if(s===0)return qn(t.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}t=t.nextSibling}return null}function sx(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var o=t.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return t;s--}else o!=="/$"&&o!=="/&"||s++}t=t.previousSibling}return null}function ix(t,s,o){switch(s=hl(o),t){case"html":if(t=s.documentElement,!t)throw Error(r(452));return t;case"head":if(t=s.head,!t)throw Error(r(453));return t;case"body":if(t=s.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function zr(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);kc(t)}var Fn=new Map,ax=new Set;function fl(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Ms=B.d;B.d={f:l0,r:c0,D:u0,C:d0,L:h0,m:f0,X:p0,S:m0,M:g0};function l0(){var t=Ms.f(),s=il();return t||s}function c0(t){var s=na(t);s!==null&&s.tag===5&&s.type==="form"?jp(s):Ms.r(t)}var Da=typeof document>"u"?null:document;function rx(t,s,o){var c=Da;if(c&&typeof s=="string"&&s){var f=Ln(s);f='link[rel="'+t+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),ax.has(f)||(ax.add(f),t={rel:t,crossOrigin:o,href:s},c.querySelector(f)===null&&(s=c.createElement("link"),Zt(s,"link",t),It(s),c.head.appendChild(s)))}}function u0(t){Ms.D(t),rx("dns-prefetch",t,null)}function d0(t,s){Ms.C(t,s),rx("preconnect",t,s)}function h0(t,s,o){Ms.L(t,s,o);var c=Da;if(c&&t&&s){var f='link[rel="preload"][as="'+Ln(s)+'"]';s==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+Ln(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+Ln(o.imageSizes)+'"]')):f+='[href="'+Ln(t)+'"]';var g=f;switch(s){case"style":g=La(t);break;case"script":g=_a(t)}Fn.has(g)||(t=y({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:t,as:s},o),Fn.set(g,t),c.querySelector(f)!==null||s==="style"&&c.querySelector(Or(g))||s==="script"&&c.querySelector(Rr(g))||(s=c.createElement("link"),Zt(s,"link",t),It(s),c.head.appendChild(s)))}}function f0(t,s){Ms.m(t,s);var o=Da;if(o&&t){var c=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+Ln(c)+'"][href="'+Ln(t)+'"]',g=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=_a(t)}if(!Fn.has(g)&&(t=y({rel:"modulepreload",href:t},s),Fn.set(g,t),o.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Rr(g)))return}c=o.createElement("link"),Zt(c,"link",t),It(c),o.head.appendChild(c)}}}function m0(t,s,o){Ms.S(t,s,o);var c=Da;if(c&&t){var f=sa(c).hoistableStyles,g=La(t);s=s||"default";var j=f.get(g);if(!j){var A={loading:0,preload:null};if(j=c.querySelector(Or(g)))A.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":s},o),(o=Fn.get(g))&&jd(t,o);var L=j=c.createElement("link");It(L),Zt(L,"link",t),L._p=new Promise(function(Z,ae){L.onload=Z,L.onerror=ae}),L.addEventListener("load",function(){A.loading|=1}),L.addEventListener("error",function(){A.loading|=2}),A.loading|=4,ml(j,s,c)}j={type:"stylesheet",instance:j,count:1,state:A},f.set(g,j)}}}function p0(t,s){Ms.X(t,s);var o=Da;if(o&&t){var c=sa(o).hoistableScripts,f=_a(t),g=c.get(f);g||(g=o.querySelector(Rr(f)),g||(t=y({src:t,async:!0},s),(s=Fn.get(f))&&kd(t,s),g=o.createElement("script"),It(g),Zt(g,"link",t),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(f,g))}}function g0(t,s){Ms.M(t,s);var o=Da;if(o&&t){var c=sa(o).hoistableScripts,f=_a(t),g=c.get(f);g||(g=o.querySelector(Rr(f)),g||(t=y({src:t,async:!0,type:"module"},s),(s=Fn.get(f))&&kd(t,s),g=o.createElement("script"),It(g),Zt(g,"link",t),o.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(f,g))}}function ox(t,s,o,c){var f=(f=ve.current)?fl(f):null;if(!f)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=La(o.href),o=sa(f).hoistableStyles,c=o.get(s),c||(c={type:"style",instance:null,count:0,state:null},o.set(s,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){t=La(o.href);var g=sa(f).hoistableStyles,j=g.get(t);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(t,j),(g=f.querySelector(Or(t)))&&!g._p&&(j.instance=g,j.state.loading=5),Fn.has(t)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Fn.set(t,o),g||x0(f,t,o,j.state))),s&&c===null)throw Error(r(528,""));return j}if(s&&c!==null)throw Error(r(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=_a(o),o=sa(f).hoistableScripts,c=o.get(s),c||(c={type:"script",instance:null,count:0,state:null},o.set(s,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function La(t){return'href="'+Ln(t)+'"'}function Or(t){return'link[rel="stylesheet"]['+t+"]"}function lx(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function x0(t,s,o,c){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?c.loading=1:(s=t.createElement("link"),c.preload=s,s.addEventListener("load",function(){return c.loading|=1}),s.addEventListener("error",function(){return c.loading|=2}),Zt(s,"link",o),It(s),t.head.appendChild(s))}function _a(t){return'[src="'+Ln(t)+'"]'}function Rr(t){return"script[async]"+t}function cx(t,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var c=t.querySelector('style[data-href~="'+Ln(o.href)+'"]');if(c)return s.instance=c,It(c),c;var f=y({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),It(c),Zt(c,"style",f),ml(c,o.precedence,t),s.instance=c;case"stylesheet":f=La(o.href);var g=t.querySelector(Or(f));if(g)return s.state.loading|=4,s.instance=g,It(g),g;c=lx(o),(f=Fn.get(f))&&jd(c,f),g=(t.ownerDocument||t).createElement("link"),It(g);var j=g;return j._p=new Promise(function(A,L){j.onload=A,j.onerror=L}),Zt(g,"link",c),s.state.loading|=4,ml(g,o.precedence,t),s.instance=g;case"script":return g=_a(o.src),(f=t.querySelector(Rr(g)))?(s.instance=f,It(f),f):(c=o,(f=Fn.get(g))&&(c=y({},o),kd(c,f)),t=t.ownerDocument||t,f=t.createElement("script"),It(f),Zt(f,"link",c),t.head.appendChild(f),s.instance=f);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(c=s.instance,s.state.loading|=4,ml(c,o.precedence,t));return s.instance}function ml(t,s,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,g=f,j=0;j<c.length;j++){var A=c[j];if(A.dataset.precedence===s)g=A;else if(g!==f)break}g?g.parentNode.insertBefore(t,g.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(t,s.firstChild))}function jd(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function kd(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var pl=null;function ux(t,s,o){if(pl===null){var c=new Map,f=pl=new Map;f.set(o,c)}else f=pl,c=f.get(o),c||(c=new Map,f.set(o,c));if(c.has(t))return c;for(c.set(t,null),o=o.getElementsByTagName(t),f=0;f<o.length;f++){var g=o[f];if(!(g[Za]||g[Gt]||t==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var j=g.getAttribute(s)||"";j=t+j;var A=c.get(j);A?A.push(g):c.set(j,[g])}}return c}function dx(t,s,o){t=t.ownerDocument||t,t.head.insertBefore(o,s==="title"?t.querySelector("head > title"):null)}function y0(t,s,o){if(o===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function hx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function b0(t,s,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var f=La(c.href),g=s.querySelector(Or(f));if(g){s=g._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=gl.bind(t),s.then(t,t)),o.state.loading|=4,o.instance=g,It(g);return}g=s.ownerDocument||s,c=lx(c),(f=Fn.get(f))&&jd(c,f),g=g.createElement("link"),It(g);var j=g;j._p=new Promise(function(A,L){j.onload=A,j.onerror=L}),Zt(g,"link",c),o.instance=g}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(t.count++,o=gl.bind(t),s.addEventListener("load",o),s.addEventListener("error",o))}}var Sd=0;function v0(t,s){return t.stylesheets&&t.count===0&&yl(t,t.stylesheets),0<t.count||0<t.imgCount?function(o){var c=setTimeout(function(){if(t.stylesheets&&yl(t,t.stylesheets),t.unsuspend){var g=t.unsuspend;t.unsuspend=null,g()}},6e4+s);0<t.imgBytes&&Sd===0&&(Sd=62500*e0());var f=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&yl(t,t.stylesheets),t.unsuspend)){var g=t.unsuspend;t.unsuspend=null,g()}},(t.imgBytes>Sd?50:800)+s);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function gl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yl(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var xl=null;function yl(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,xl=new Map,s.forEach(w0,t),xl=null,gl.call(t))}function w0(t,s){if(!(s.state.loading&4)){var o=xl.get(t);if(o)var c=o.get(null);else{o=new Map,xl.set(t,o);for(var f=t.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<f.length;g++){var j=f[g];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(o.set(j.dataset.precedence,j),c=j)}c&&o.set(null,c)}f=s.instance,j=f.getAttribute("data-precedence"),g=o.get(j)||c,g===c&&o.set(null,f),o.set(j,f),this.count++,c=gl.bind(this),f.addEventListener("load",c),f.addEventListener("error",c),g?g.parentNode.insertBefore(f,g.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(f,t.firstChild)),s.state.loading|=4}}var Mr={$$typeof:T,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function j0(t,s,o,c,f,g,j,A,L){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Wi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wi(0),this.hiddenUpdates=Wi(null),this.identifierPrefix=c,this.onUncaughtError=f,this.onCaughtError=g,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.incompleteTransitions=new Map}function fx(t,s,o,c,f,g,j,A,L,Z,ae,ue){return t=new j0(t,s,o,j,L,Z,ae,ue,A),s=1,g===!0&&(s|=24),g=Sn(3,null,null,s),t.current=g,g.stateNode=t,s=su(),s.refCount++,t.pooledCache=s,s.refCount++,g.memoizedState={element:c,isDehydrated:o,cache:s},ou(g),t}function mx(t){return t?(t=fa,t):fa}function px(t,s,o,c,f,g){f=mx(f),c.context===null?c.context=f:c.pendingContext=f,c=Qs(s),c.payload={element:o},g=g===void 0?null:g,g!==null&&(c.callback=g),o=Ks(t,c,s),o!==null&&(mn(o,t,s),dr(o,t,s))}function gx(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var o=t.retryLane;t.retryLane=o!==0&&o<s?o:s}}function Cd(t,s){gx(t,s),(t=t.alternate)&&gx(t,s)}function xx(t){if(t.tag===13||t.tag===31){var s=Ci(t,67108864);s!==null&&mn(s,t,67108864),Cd(t,67108864)}}function yx(t){if(t.tag===13||t.tag===31){var s=En();s=vc(s);var o=Ci(t,s);o!==null&&mn(o,t,s),Cd(t,s)}}var bl=!0;function k0(t,s,o,c){var f=F.T;F.T=null;var g=B.p;try{B.p=2,Ad(t,s,o,c)}finally{B.p=g,F.T=f}}function S0(t,s,o,c){var f=F.T;F.T=null;var g=B.p;try{B.p=8,Ad(t,s,o,c)}finally{B.p=g,F.T=f}}function Ad(t,s,o,c){if(bl){var f=Nd(c);if(f===null)hd(t,s,c,vl,o),vx(t,c);else if(A0(f,t,s,o,c))c.stopPropagation();else if(vx(t,c),s&4&&-1<C0.indexOf(t)){for(;f!==null;){var g=na(f);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var j=Ee(g.pendingLanes);if(j!==0){var A=g;for(A.pendingLanes|=2,A.entangledLanes|=2;j;){var L=1<<31-At(j);A.entanglements[1]|=L,j&=~L}os(g),(nt&6)===0&&(nl=Lt()+500,Nr(0))}}break;case 31:case 13:A=Ci(g,2),A!==null&&mn(A,g,2),il(),Cd(g,2)}if(g=Nd(c),g===null&&hd(t,s,c,vl,o),g===f)break;f=g}f!==null&&c.stopPropagation()}else hd(t,s,c,null,o)}}function Nd(t){return t=Ec(t),Td(t)}var vl=null;function Td(t){if(vl=null,t=ta(t),t!==null){var s=u(t);if(s===null)t=null;else{var o=s.tag;if(o===13){if(t=d(s),t!==null)return t;t=null}else if(o===31){if(t=h(s),t!==null)return t;t=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return vl=t,null}function bx(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(nn()){case ms:return 2;case ne:return 8;case fe:case De:return 32;case Le:return 268435456;default:return 32}default:return 32}}var Ed=!1,li=null,ci=null,ui=null,Dr=new Map,Lr=new Map,di=[],C0="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 vx(t,s){switch(t){case"focusin":case"focusout":li=null;break;case"dragenter":case"dragleave":ci=null;break;case"mouseover":case"mouseout":ui=null;break;case"pointerover":case"pointerout":Dr.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lr.delete(s.pointerId)}}function _r(t,s,o,c,f,g){return t===null||t.nativeEvent!==g?(t={blockedOn:s,domEventName:o,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=na(s),s!==null&&xx(s)),t):(t.eventSystemFlags|=c,s=t.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),t)}function A0(t,s,o,c,f){switch(s){case"focusin":return li=_r(li,t,s,o,c,f),!0;case"dragenter":return ci=_r(ci,t,s,o,c,f),!0;case"mouseover":return ui=_r(ui,t,s,o,c,f),!0;case"pointerover":var g=f.pointerId;return Dr.set(g,_r(Dr.get(g)||null,t,s,o,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Lr.set(g,_r(Lr.get(g)||null,t,s,o,c,f)),!0}return!1}function wx(t){var s=ta(t.target);if(s!==null){var o=u(s);if(o!==null){if(s=o.tag,s===13){if(s=d(o),s!==null){t.blockedOn=s,Lf(t.priority,function(){yx(o)});return}}else if(s===31){if(s=h(o),s!==null){t.blockedOn=s,Lf(t.priority,function(){yx(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){t.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}t.blockedOn=null}function wl(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var o=Nd(t.nativeEvent);if(o===null){o=t.nativeEvent;var c=new o.constructor(o.type,o);Tc=c,o.target.dispatchEvent(c),Tc=null}else return s=na(o),s!==null&&xx(s),t.blockedOn=o,!1;s.shift()}return!0}function jx(t,s,o){wl(t)&&o.delete(s)}function N0(){Ed=!1,li!==null&&wl(li)&&(li=null),ci!==null&&wl(ci)&&(ci=null),ui!==null&&wl(ui)&&(ui=null),Dr.forEach(jx),Lr.forEach(jx)}function jl(t,s){t.blockedOn===s&&(t.blockedOn=null,Ed||(Ed=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,N0)))}var kl=null;function kx(t){kl!==t&&(kl=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kl===t&&(kl=null);for(var s=0;s<t.length;s+=3){var o=t[s],c=t[s+1],f=t[s+2];if(typeof c!="function"){if(Td(c||o)===null)continue;break}var g=na(o);g!==null&&(t.splice(s,3),s-=3,Nu(g,{pending:!0,data:f,method:o.method,action:c},c,f))}}))}function $a(t){function s(L){return jl(L,t)}li!==null&&jl(li,t),ci!==null&&jl(ci,t),ui!==null&&jl(ui,t),Dr.forEach(s),Lr.forEach(s);for(var o=0;o<di.length;o++){var c=di[o];c.blockedOn===t&&(c.blockedOn=null)}for(;0<di.length&&(o=di[0],o.blockedOn===null);)wx(o),o.blockedOn===null&&di.shift();if(o=(t.ownerDocument||t).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var f=o[c],g=o[c+1],j=f[ln]||null;if(typeof g=="function")j||kx(o);else if(j){var A=null;if(g&&g.hasAttribute("formAction")){if(f=g,j=g[ln]||null)A=j.formAction;else if(Td(f)!==null)continue}else A=j.action;typeof A=="function"?o[c+1]=A:(o.splice(c,3),c-=3),kx(o)}}}function Sx(){function t(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(j){return f=j})},focusReset:"manual",scroll:"manual"})}function s(){f!==null&&(f(),f=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,f=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),f!==null&&(f(),f=null)}}}function zd(t){this._internalRoot=t}Sl.prototype.render=zd.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(r(409));var o=s.current,c=En();px(o,c,t,s,null,null)},Sl.prototype.unmount=zd.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;px(t.current,2,null,t,null,null),il(),s[ea]=null}};function Sl(t){this._internalRoot=t}Sl.prototype.unstable_scheduleHydration=function(t){if(t){var s=Df();t={blockedOn:null,target:t,priority:s};for(var o=0;o<di.length&&s!==0&&s<di[o].priority;o++);di.splice(o,0,t),o===0&&wx(t)}};var Cx=i.version;if(Cx!=="19.2.0")throw Error(r(527,Cx,"19.2.0"));B.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=m(s),t=t!==null?x(t):null,t=t===null?null:t.stateNode,t};var T0={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cl.isDisabled&&Cl.supportsFiber)try{bt=Cl.inject(T0),Ke=Cl}catch{}}return Ur.createRoot=function(t,s){if(!l(t))throw Error(r(299));var o=!1,c="",f=Rp,g=Mp,j=Dp;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(g=s.onCaughtError),s.onRecoverableError!==void 0&&(j=s.onRecoverableError)),s=fx(t,1,!1,null,null,o,c,null,f,g,j,Sx),t[ea]=s.current,dd(t),new zd(s)},Ur.hydrateRoot=function(t,s,o){if(!l(t))throw Error(r(299));var c=!1,f="",g=Rp,j=Mp,A=Dp,L=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onUncaughtError!==void 0&&(g=o.onUncaughtError),o.onCaughtError!==void 0&&(j=o.onCaughtError),o.onRecoverableError!==void 0&&(A=o.onRecoverableError),o.formState!==void 0&&(L=o.formState)),s=fx(t,1,!0,s,o??null,c,f,L,g,j,A,Sx),s.context=mx(null),o=s.current,c=En(),c=vc(c),f=Qs(c),f.callback=null,Ks(o,f,c),o=c,s.current.lanes=o,qs(s,o),os(s),t[ea]=s.current,dd(t),new Sl(s)},Ur.version="19.2.0",Ur}var Lx;function $0(){if(Lx)return Md.exports;Lx=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),Md.exports=_0(),Md.exports}var Tb=$0();class Pn extends Error{constructor(i,a,r){super(r),this.status=i,this.code=a,this.name="ApiError"}status;code}const U0={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",408:"Request Timeout",409:"Conflict",413:"Payload Too Large",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",520:"Unknown Error",521:"Web Server Is Down",522:"Connection Timed Out",523:"Origin Is Unreachable",524:"A Timeout Occurred"},_x=200,I0=e=>e.replace(/<\/?[a-z!][^>]*>/gi," "),B0=e=>e.replace(/ /g," ").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&");function Pl(e){const i=u=>/<[a-z!/]/i.test(u),a=u=>{const d=B0(u);return i(d)?I0(d.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi," ")):d};let r=e;if(i(e)){const u=d=>{const h=new RegExp(`<${d}\\b[^>]*>([\\s\\S]*?)</${d}>`,"i").exec(e)?.[1];return h!==void 0&&a(h).trim()?h:void 0};r=u("title")??u("h1")??e}let l=a(r).replace(/[<>]/g,"");return l=l.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"").replace(/\s+/g," ").trim(),l.length>_x?`${l.slice(0,_x-1)}…`:l}function H0(e){if(typeof e=="string")return Pl(e);if(!e||typeof e!="object"||Array.isArray(e))return"";const i=e;for(const a of["message","detail","error_description","title","reason"]){const r=i[a];if(typeof r=="string"&&r.trim())return Pl(r)}return""}function $d(e,i){const a=e.status,r=e.statusText||U0[a]||"",l=i&&i.toLowerCase()!==r.toLowerCase()&&i!==String(a)?`: "${i}"`:"",u=`HTTP ${a}${r?` ${r}`:""}${l}`;return a===429?new Pn(429,"RATE_LIMITED",`Pikibun is over its request limit right now (${u}). Try again later.`):a===408||a===504||a===522||a===524?new Pn(a,"UPSTREAM_TIMEOUT",`The proxy in front of Pikibun stopped waiting for the server (${u}). The request took too long, but the server may have accepted it and still be working on it: check the result before retrying.`):a===502||a===503||a===520||a===521||a===523?new Pn(a,"BACKEND_UNAVAILABLE",`The proxy in front of Pikibun got no valid answer from the server (${u}). The server may have restarted, crashed or taken too long while handling this request; if it changes something, check the result before retrying.`):e.ok?new Pn(a,"BACKEND_UNAVAILABLE",`The Pikibun API answered with something other than JSON (${u}). Try again later.`):new Pn(a,"REQUEST_FAILED",`The request failed before reaching Pikibun's API (${u}).`)}async function $x(e){if(!(e.headers.get("content-type")??"").includes("application/json")){const p=await e.text().catch(()=>"");throw $d(e,Pl(p))}if(e.ok)try{return await e.json()}catch(p){throw p instanceof Error&&p.name==="AbortError"?p:new Pn(e.status,"BACKEND_UNAVAILABLE",`The Pikibun API's answer arrived incomplete or garbled (HTTP ${e.status}). The connection may have dropped; if the request changes something, check the result before retrying.`)}const a=await e.text().catch(()=>"");let r;try{r=JSON.parse(a)}catch{throw $d(e,Pl(a))}const l=r&&typeof r=="object"?r:{},u=l.error,d=typeof u=="string"?u:u&&typeof u=="object"&&typeof u.message=="string"?u.message:void 0,h=u&&typeof u=="object"&&typeof u.code=="string"?u.code:typeof l.code=="string"?l.code:void 0;throw d?new Pn(e.status,h??"REQUEST_FAILED",d):$d(e,H0(r))}function q0(e){const i=e.baseUrl??"",a=(r,l)=>(e.fetch??globalThis.fetch)(r,l);return async function(l,u={}){const d=u.method??"GET",h={...u.headers,Accept:"application/json"},p={method:d,headers:h,signal:u.signal};if(p.credentials="same-origin",d!=="GET"){const x=await $x(await a(`${i}/api/auth/csrf`,{credentials:"same-origin",signal:u.signal}));h["x-csrf-token"]=x.csrfToken}u.body!==void 0&&(h["Content-Type"]="application/json",p.body=JSON.stringify(u.body));const m=await a(`${i}${l}`,p);if(!(m.status===204&&m.ok))return await $x(m)}}function On(e){return e instanceof Pn?e.message:e instanceof TypeError?"Could not reach Pikibun. Check your connection and try again.":e instanceof Error?e.message:"Something went wrong. Please try again."}const oe=e=>encodeURIComponent(e),ce=q0({}),F0={plus:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M5 12h14"})]}),settings:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M12.2 2h-.4a2 2 0 0 0-2 2v.2a2 2 0 0 1-1 1.7l-.4.3a2 2 0 0 1-2 0l-.2-.1a2 2 0 0 0-2.7.7l-.2.4a2 2 0 0 0 .7 2.7l.2.1a2 2 0 0 1 1 1.7v.6a2 2 0 0 1-1 1.7l-.2.1a2 2 0 0 0-.7 2.7l.2.4a2 2 0 0 0 2.7.7l.2-.1a2 2 0 0 1 2 0l.4.3a2 2 0 0 1 1 1.7v.2a2 2 0 0 0 2 2h.4a2 2 0 0 0 2-2v-.2a2 2 0 0 1 1-1.7l.4-.3a2 2 0 0 1 2 0l.2.1a2 2 0 0 0 2.7-.7l.2-.4a2 2 0 0 0-.7-2.7l-.2-.1a2 2 0 0 1-1-1.7v-.6a2 2 0 0 1 1-1.7l.2-.1a2 2 0 0 0 .7-2.7l-.2-.4a2 2 0 0 0-2.7-.7l-.2.1a2 2 0 0 1-2 0l-.4-.3a2 2 0 0 1-1-1.7V4a2 2 0 0 0-2-2Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),pencil:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}),n.jsx("path",{d:"m15 5 4 4"})]}),more:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"5",r:"1"}),n.jsx("circle",{cx:"12",cy:"12",r:"1"}),n.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),"chevron-right":n.jsx("path",{d:"m9 18 6-6-6-6"}),"chevron-down":n.jsx("path",{d:"m6 9 6 6 6-6"}),"chevron-up":n.jsx("path",{d:"m18 15-6-6-6 6"}),"chevron-left":n.jsx("path",{d:"m15 18-6-6 6-6"}),x:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M18 6 6 18"}),n.jsx("path",{d:"m6 6 12 12"})]}),check:n.jsx("path",{d:"M20 6 9 17l-5-5"}),copy:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"8",y:"8",width:"13",height:"13",rx:"2"}),n.jsx("path",{d:"M4 16V5a2 2 0 0 1 2-2h11"})]}),folder:n.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9l-.8-1.2A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}),file:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),n.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),message:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"}),terminal:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"m4 17 6-6-6-6"}),n.jsx("path",{d:"M12 19h8"})]}),tool:n.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.8-3.8a6 6 0 0 1-7.9 7.9l-6.9 6.9a2.1 2.1 0 0 1-3-3l6.9-6.9a6 6 0 0 1 7.9-7.9Z"}),send:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M12 19V5"}),n.jsx("path",{d:"m5 12 7-7 7 7"})]}),stop:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"}),"panel-right":n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),n.jsx("path",{d:"M15 3v18"})]}),menu:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M4 6h16"}),n.jsx("path",{d:"M4 12h16"}),n.jsx("path",{d:"M4 18h16"})]}),info:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M12 16v-4"}),n.jsx("path",{d:"M12 8h.01"})]}),alert:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"m21.7 18-8-14a2 2 0 0 0-3.4 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.7-3Z"}),n.jsx("path",{d:"M12 9v4"}),n.jsx("path",{d:"M12 17h.01"})]}),shield:n.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.7 9a1 1 0 0 1-.6 0C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.2-2.7a1.2 1.2 0 0 1 1.6 0C14.5 3.8 17 5 19 5a1 1 0 0 1 1 1Z"}),server:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"2",y:"2",width:"20",height:"8",rx:"2"}),n.jsx("rect",{x:"2",y:"14",width:"20",height:"8",rx:"2"}),n.jsx("path",{d:"M6 6h.01"}),n.jsx("path",{d:"M6 18h.01"})]}),users:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),n.jsx("circle",{cx:"9",cy:"7",r:"4"}),n.jsx("path",{d:"M22 21v-2a4 4 0 0 0-3-3.9"}),n.jsx("path",{d:"M16 3.1a4 4 0 0 1 0 7.8"})]}),user:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"8",r:"4"}),n.jsx("path",{d:"M20 21a8 8 0 0 0-16 0"})]}),palette:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"13.5",cy:"6.5",r:".5"}),n.jsx("circle",{cx:"17.5",cy:"10.5",r:".5"}),n.jsx("circle",{cx:"8.5",cy:"7.5",r:".5"}),n.jsx("circle",{cx:"6.5",cy:"12.5",r:".5"}),n.jsx("path",{d:"M12 2a10 10 0 0 0 0 20 1.7 1.7 0 0 0 1.7-1.7c0-.4-.2-.8-.4-1.1-.3-.3-.4-.7-.4-1.1a1.7 1.7 0 0 1 1.6-1.7H16a5.6 5.6 0 0 0 5.6-5.6C21.6 6 17.3 2 12 2Z"})]}),sun:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"12",r:"4"}),n.jsx("path",{d:"M12 2v2"}),n.jsx("path",{d:"M12 20v2"}),n.jsx("path",{d:"m4.9 4.9 1.4 1.4"}),n.jsx("path",{d:"m17.7 17.7 1.4 1.4"}),n.jsx("path",{d:"M2 12h2"}),n.jsx("path",{d:"M20 12h2"}),n.jsx("path",{d:"m6.3 17.7-1.4 1.4"}),n.jsx("path",{d:"m19.1 4.9-1.4 1.4"})]}),moon:n.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"}),sparkle:n.jsx("path",{d:"M9.9 15.5a2 2 0 0 0-1.4-1.4l-6.1-1.6a.5.5 0 0 1 0-1l6.1-1.6a2 2 0 0 0 1.4-1.4l1.6-6.1a.5.5 0 0 1 1 0l1.6 6.1a2 2 0 0 0 1.4 1.4l6.1 1.6a.5.5 0 0 1 0 1l-6.1 1.6a2 2 0 0 0-1.4 1.4l-1.6 6.1a.5.5 0 0 1-1 0Z"}),monitor:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),n.jsx("path",{d:"M8 21h8"}),n.jsx("path",{d:"M12 17v4"})]}),logout:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),n.jsx("path",{d:"m16 17 5-5-5-5"}),n.jsx("path",{d:"M21 12H9"})]}),archive:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"2",y:"3",width:"20",height:"5",rx:"1"}),n.jsx("path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}),n.jsx("path",{d:"M10 12h4"})]}),"git-branch":n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M6 3v12"}),n.jsx("circle",{cx:"18",cy:"6",r:"3"}),n.jsx("circle",{cx:"6",cy:"18",r:"3"}),n.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),"git-pull-request":n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"18",cy:"18",r:"3"}),n.jsx("circle",{cx:"6",cy:"6",r:"3"}),n.jsx("path",{d:"M13 6h3a2 2 0 0 1 2 2v7"}),n.jsx("path",{d:"M6 9v12"})]}),lock:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2"}),n.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),globe:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),n.jsx("path",{d:"M2 12h20"})]}),refresh:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.8 9.8 0 0 1 6.7 2.7L21 8"}),n.jsx("path",{d:"M21 3v5h-5"}),n.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.8 9.8 0 0 1-6.7-2.7L3 16"}),n.jsx("path",{d:"M8 16H3v5"})]}),search:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("path",{d:"m21 21-4.3-4.3"})]}),eye:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),trash:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M3 6h18"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),n.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),external:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M15 3h6v6"}),n.jsx("path",{d:"M10 14 21 3"}),n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),history:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.8 9.8 0 0 0-6.7 2.7L3 8"}),n.jsx("path",{d:"M3 3v5h5"}),n.jsx("path",{d:"M12 7v5l4 2"})]}),clock:n.jsxs(n.Fragment,{children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M12 6v6l4 2"})]}),bell:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10.268 21a2 2 0 0 0 3.464 0"}),n.jsx("path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"})]}),image:n.jsxs(n.Fragment,{children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),n.jsx("circle",{cx:"9",cy:"9",r:"2"}),n.jsx("path",{d:"m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21"})]}),"arrow-down":n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"m19 12-7 7-7-7"})]}),paperclip:n.jsx("path",{d:"m16 6-8.4 8.6a2 2 0 0 0 2.8 2.8l8.4-8.6a4 4 0 1 0-5.6-5.6l-8.4 8.5a6 6 0 1 0 8.5 8.5l8.4-8.5"}),link:n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7"}),n.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7"})]})};function be({name:e,size:i=16}){return e==="github"?n.jsx(Yl,{size:i}):n.jsx("svg",{className:"icon",width:i,height:i,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:F0[e]})}const Al="M0 0C-1.6-.4-2.6-1.6-4.2-2.9-6.6-4.8-10.6-4.6-11.8-2.2-12.8-.2-11 2.6-8.2 3.2-5.8 3.7-3 1.6-1.6.6-1 .2-.5.05 0 0Z",Ux="M-1 .05C-4-.4-7.6-.6-11.2-1.4M-5-.45-7-2.9M-5-.45-6.8 1.9M-8.2-.85-9.9-3.1M-8.2-.85-9.6 1.6",Ud="translate(14.7 16.6) rotate(33) scale(1.15)",Id="translate(17.3 16.6) scale(-1 1) rotate(33) scale(1.15)";function Ba({size:e=24}){const i=N.useId().replace(/[^\w-]/g,""),[a,r,l,u]=["sky","ear","body","glow"].map(h=>`${i}${h}`),d=n.jsxs(n.Fragment,{children:[n.jsx("path",{d:Al,transform:Ud}),n.jsx("path",{d:Al,transform:Id}),n.jsx("ellipse",{cx:"11.1",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(-25 11.1 22.3)"}),n.jsx("ellipse",{cx:"20.9",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(25 20.9 22.3)"}),n.jsx("ellipse",{cx:"15",cy:"28.5",rx:".85",ry:"1.25"}),n.jsx("ellipse",{cx:"17",cy:"28.5",rx:".85",ry:"1.25"}),n.jsx("ellipse",{cx:"16",cy:"21.6",rx:"4.9",ry:"5.5"})]});return n.jsxs("svg",{className:"logo",width:e,height:e,viewBox:"0 0 32 32","aria-hidden":"true",focusable:"false",children:[n.jsxs("defs",{children:[n.jsxs("radialGradient",{id:a,cx:"50%",cy:"50%",r:"72%",children:[n.jsx("stop",{offset:"0",stopColor:"#2b1454"}),n.jsx("stop",{offset:"1",stopColor:"#110530"})]}),n.jsxs("linearGradient",{id:r,x1:"0",y1:".5",x2:"1",y2:".5",children:[n.jsx("stop",{offset:"0",stopColor:"#fdf0c9"}),n.jsx("stop",{offset:".5",stopColor:"#e2d2f5"}),n.jsx("stop",{offset:".85",stopColor:"#bba6ee"}),n.jsx("stop",{offset:"1",stopColor:"#f2e2cb"})]}),n.jsxs("radialGradient",{id:l,cx:"50%",cy:"74%",r:"70%",children:[n.jsx("stop",{offset:"0",stopColor:"#fdf1d6"}),n.jsx("stop",{offset:".45",stopColor:"#f4e0cd"}),n.jsx("stop",{offset:"1",stopColor:"#b5a3f0"})]}),n.jsx("filter",{id:u,x:"-30%",y:"-30%",width:"160%",height:"160%",children:n.jsx("feGaussianBlur",{stdDeviation:".8"})})]}),n.jsx("rect",{width:"32",height:"32",rx:"9",fill:`url(#${a})`}),n.jsxs("g",{transform:"translate(0 -1.4)",children:[n.jsx("g",{fill:"#fde9c4",opacity:".34",filter:`url(#${u})`,children:d}),n.jsxs("g",{stroke:"#3d1e45",strokeWidth:".5",strokeLinejoin:"round",children:[n.jsx("path",{d:Al,transform:Ud,fill:`url(#${r})`}),n.jsx("path",{d:Al,transform:Id,fill:`url(#${r})`}),n.jsx("ellipse",{cx:"11.1",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(-25 11.1 22.3)",fill:"#ebe0f7"}),n.jsx("ellipse",{cx:"20.9",cy:"22.3",rx:"1.45",ry:".75",transform:"rotate(25 20.9 22.3)",fill:"#ebe0f7"}),n.jsx("path",{d:"M15.1 26.8v.6M16.9 26.8v.6",fill:"none",stroke:"#f4e0cd",strokeWidth:".6"}),n.jsx("ellipse",{cx:"15",cy:"28.5",rx:".85",ry:"1.25",fill:"#8a64bf"}),n.jsx("ellipse",{cx:"17",cy:"28.5",rx:".85",ry:"1.25",fill:"#8a64bf"}),n.jsx("ellipse",{cx:"16",cy:"21.6",rx:"4.9",ry:"5.5",fill:`url(#${l})`})]}),n.jsxs("g",{fill:"none",stroke:"#a387d8",strokeWidth:".3",strokeLinecap:"round",opacity:".85",children:[n.jsx("path",{d:Ux,transform:Ud}),n.jsx("path",{d:Ux,transform:Id})]}),n.jsx("circle",{cx:"14.25",cy:"20.2",r:".85",fill:"#171412"}),n.jsx("circle",{cx:"17.75",cy:"20.2",r:".85",fill:"#171412"}),n.jsx("circle",{cx:"14.5",cy:"19.92",r:".27",fill:"#fff"}),n.jsx("circle",{cx:"18",cy:"19.92",r:".27",fill:"#fff"}),n.jsx("path",{d:"M15.47 20.85h1.06L16 21.55Z",fill:"#e0725f"})]})]})}function Yl({size:e=16}){return n.jsx("svg",{className:"icon",width:e,height:e,viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",focusable:"false",children:n.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}var G0=Nb();const Nl=4,Ir=8;function P0(e,i,a,r){const l=document.documentElement.clientWidth,d=window.innerHeight-e.bottom-Nl-Ir,h=e.top-Nl-Ir,p=a==="below"?d:h,m=a==="below"?h:d,x=p>=i.height||p>=m?a:a==="below"?"above":"below",v=Math.max(80,Math.floor(x==="below"?d:h)),b=x==="below"?e.bottom+Nl:document.documentElement.clientHeight-e.top+Nl,w=r==="end"?e.right-i.width:e.left,S=Math.min(Math.max(Ir,w),Math.max(Ir,l-Ir-i.width));return{edge:b,left:S,maxHeight:v,side:x}}function Ph({anchor:e,side:i="below",align:a="start",className:r="",role:l,id:u,label:d,style:h,children:p}){const m=N.useRef(null),[x,y]=N.useState(null);N.useLayoutEffect(()=>{const w=m.current,S=e.current;if(!w||!S)return;let C={width:0,height:0};const k=()=>{const M=w.style.maxHeight;w.style.maxHeight="";const{width:_,height:$}=w.getBoundingClientRect();w.style.maxHeight=M,C={width:_,height:$}},O=()=>y(P0(S.getBoundingClientRect(),C,i,a)),T=()=>{k(),O()};return T(),window.addEventListener("resize",T),document.addEventListener("scroll",O,!0),()=>{window.removeEventListener("resize",T),document.removeEventListener("scroll",O,!0)}},[e,i,a]);const v=x?{position:"fixed",...x.side==="below"?{top:x.edge}:{bottom:x.edge},left:x.left,maxHeight:x.maxHeight}:{position:"fixed",top:0,left:0,opacity:0,pointerEvents:"none"},b=e.current?.closest("dialog[open]")??document.body;return G0.createPortal(n.jsx("div",{ref:m,className:`popover portal ${x?.side??i} ${r}`.trim(),role:l,id:u,"aria-label":d,style:{...v,...h},children:p}),b)}function Eb(){return Yh()&&Math.min(window.screen.width,window.screen.height)<600}function Yh(){return typeof window<"u"&&window.matchMedia("(pointer: coarse)").matches}function zb(){return!Eb()}function Y0(){const e=window.visualViewport;if(!e||!Yh())return;const i=document.documentElement,a=()=>{Math.abs(e.scale-1)>.01||(i.style.setProperty("--viewport-height",`${Math.round(e.height)}px`),i.classList.toggle("short-viewport",e.height<=500),window.scrollY!==0&&document.body.scrollHeight<=e.height+1&&window.scrollTo(0,0))};e.addEventListener("resize",a),e.addEventListener("scroll",a),a()}function $e(e){const[i,a]=N.useState(null),[r,l]=N.useState(!!e),[u,d]=N.useState(""),[h,p]=N.useState(0),m=N.useRef(null),x=N.useCallback(()=>p(y=>y+1),[]);return N.useEffect(()=>{const y=new AbortController;if(m.current!==e&&(a(null),m.current=e),d(""),!e){l(!1);return}return l(!0),ce(e,{signal:y.signal}).then(v=>{y.signal.aborted||a(v)}).catch(v=>{y.signal.aborted||d(On(v))}).finally(()=>{y.signal.aborted||l(!1)}),()=>y.abort()},[e,h]),{data:i,loading:r,error:u,refresh:x,setData:a}}function je(){const[e,i]=N.useState(!1),[a,r]=N.useState(""),[l,u]=N.useState("");async function d(h,p=""){i(!0),r(""),u("");try{await h(),u(p)}catch(m){r(On(m))}finally{i(!1)}}return{busy:e,error:a,notice:l,run:d}}function q({variant:e="secondary",size:i="md",icon:a,block:r,className:l,children:u,type:d="button",...h}){const p=a&&!u;return n.jsxs("button",{type:d,className:["btn",e,i!=="md"&&i,r&&"block",p&&"icon-only",l].filter(Boolean).join(" "),...h,children:[a&&n.jsx(be,{name:a,size:i==="xs"?14:16}),u]})}function Ht({href:e,variant:i="secondary",size:a="md",icon:r,children:l,...u}){return n.jsxs("a",{href:e,className:["btn",i,a!=="md"&&a].filter(Boolean).join(" "),...u,children:[r&&n.jsx(be,{name:r,size:16}),l]})}function ge({tone:e="neutral",dot:i,children:a}){return n.jsxs("span",{className:`badge ${e==="running"?"info":e}`,children:[i&&n.jsx(gi,{tone:e}),n.jsx("span",{className:"badge-label",children:a})]})}function gi({tone:e="neutral",label:i,icon:a}){return a?n.jsx("span",{className:`status-icon ${e}`,role:i?"img":void 0,"aria-label":i,"aria-hidden":i?void 0:!0,children:n.jsx(be,{name:a,size:11})}):n.jsx("span",{className:`dot ${e==="info"?"running":e}`,role:i?"img":void 0,"aria-label":i,"aria-hidden":i?void 0:!0})}function qi({large:e,label:i}){return n.jsx("span",{className:e?"spinner large":"spinner",role:i?"status":void 0,"aria-label":i})}function $t({children:e="Loading..."}){return n.jsxs("span",{className:"loading-line",role:"status",children:[n.jsx(qi,{}),e]})}function ds(){return n.jsx("div",{className:"page-loading",children:n.jsx(qi,{large:!0,label:"Loading"})})}function we({variant:e="default",title:i,children:a,actions:r,role:l}){const u=e==="success"?"check":e==="warning"||e==="error"?"alert":"info";return n.jsxs("div",{className:`alert ${e}`,role:l??(e==="error"?"alert":"note"),children:[n.jsx(be,{name:u,size:16}),n.jsx("div",{className:"alert-title",children:i}),(a||r)&&n.jsxs("div",{className:"alert-body",children:[a,r&&n.jsx("div",{className:"alert-actions",children:r})]})]})}function ye({error:e,notice:i}){return n.jsxs(n.Fragment,{children:[e&&n.jsx("p",{className:"field-error",role:"alert",children:e}),i&&n.jsx("p",{className:"field-notice",role:"status",children:i})]})}function tt({loading:e,error:i,retry:a,children:r}){return e?n.jsx($t,{}):i?n.jsx(we,{variant:"error",title:"Couldn't load",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:a,children:"Try again"}),children:i}):n.jsx(n.Fragment,{children:r})}function xt({title:e,children:i,action:a}){return n.jsxs("div",{className:"empty-state",children:[n.jsx("div",{children:e}),i&&n.jsx("p",{children:i}),a]})}function Ae({title:e,info:i,action:a,children:r,bare:l}){return n.jsxs("section",{className:"section",children:[n.jsxs("div",{className:"section-header",children:[n.jsx("h2",{className:"section-title",children:e}),i&&n.jsx(Qr,{children:i}),a&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"spacer"}),a]})]}),l?r:n.jsx("div",{className:"card",children:r})]})}function ke({children:e}){return n.jsx("div",{className:"card-body",children:e})}function W({title:e,hint:i,leading:a,trailing:r,onClick:l,href:u,chevron:d,disabled:h}){const p=n.jsxs(n.Fragment,{children:[a&&n.jsx("span",{className:"row-leading",children:a}),n.jsxs("span",{className:"row-content",children:[n.jsx("span",{className:"row-title",children:e}),i&&n.jsx("span",{className:"row-hint",children:i})]}),(r||d)&&n.jsxs("span",{className:"row-trailing",children:[r,d&&n.jsx(be,{name:"chevron-right",size:16})]})]});return u?n.jsx("a",{className:"row",href:u,children:p}):l?n.jsx("button",{type:"button",className:"row",onClick:l,disabled:h,children:p}):n.jsx("div",{className:"row",children:p})}function ns({title:e,hint:i,leading:a,trailing:r,children:l,open:u,plain:d}){return n.jsxs("details",{className:d?"collapsible plain":"collapsible",open:u,children:[n.jsxs("summary",{children:[a&&n.jsx("span",{className:"row-leading",children:a}),n.jsxs("span",{className:"row-content",children:[n.jsx("span",{className:"row-title",children:e}),i&&n.jsx("span",{className:"row-hint",children:i})]}),r&&n.jsx("span",{className:"row-trailing",children:r}),n.jsx("span",{className:"chevron",children:n.jsx(be,{name:"chevron-right",size:16})})]}),n.jsx("div",{className:"collapsible-body",children:l})]})}function xe({label:e,hint:i,error:a,children:r}){return n.jsxs("label",{className:"field",children:[n.jsx("span",{className:"field-label",children:e}),r,i&&n.jsx("span",{className:"field-hint",children:i}),a&&n.jsx("span",{className:"field-error",children:a})]})}function Vh(e,i){const a=N.useRef(null);return N.useEffect(()=>{if(!e)return;const r=u=>{const d=u.target;a.current?.contains(d)||d instanceof Element&&d.closest(".popover.portal")||i()},l=u=>{u.key==="Escape"&&i()};return document.addEventListener("pointerdown",r),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",r),document.removeEventListener("keydown",l)}},[e,i]),a}function ss({label:e,icon:i="more",items:a,align:r="end",side:l="below",trigger:u,triggerVariant:d="ghost"}){const[h,p]=N.useState(!1),m=N.useCallback(()=>p(!1),[]),x=Vh(h,m),y=N.useId();return n.jsxs("div",{className:"menu-anchor",ref:x,children:[u?n.jsx("button",{type:"button",className:`btn ${d} sm`,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":y,onClick:()=>p(v=>!v),children:u}):n.jsx(q,{variant:"ghost",size:"xs",icon:i,"aria-label":e,title:e,"aria-haspopup":"menu","aria-expanded":h,"aria-controls":y,onClick:v=>{v.stopPropagation(),p(b=>!b)}}),h&&n.jsx(Ph,{anchor:x,side:l,align:r,role:"menu",id:y,className:"menu-scroll",children:a.map((v,b)=>v==="separator"?n.jsx("div",{className:"menu-separator",role:"separator"},`separator-${b}`):n.jsxs("button",{type:"button",role:"menuitem",className:v.destructive?"menu-item destructive":"menu-item",disabled:v.disabled,onClick:w=>{w.stopPropagation(),p(!1),v.onSelect()},children:[v.icon&&n.jsx(be,{name:v.icon,size:14}),n.jsxs("span",{className:"menu-text",children:[n.jsx("span",{children:v.label}),v.hint&&n.jsx("span",{className:"menu-hint",children:v.hint})]})]},v.label))})]})}function Xt({value:e,options:i,onChange:a,placeholder:r="Select...",label:l,disabled:u,side:d="below"}){const[h,p]=N.useState(!1),[m,x]=N.useState(""),y=N.useCallback(()=>{p(!1),x("")},[]),v=Vh(h,y),b=i.find(S=>S.value===e),w=i.filter(S=>`${S.label} ${S.hint??""}`.toLowerCase().includes(m.trim().toLowerCase()));return n.jsxs("div",{className:"menu-anchor",ref:v,children:[n.jsxs("button",{type:"button",className:"btn ghost sm","aria-label":l,title:l,"aria-haspopup":"listbox","aria-expanded":h,disabled:u,onClick:()=>p(S=>!S),children:[n.jsx("span",{className:"truncate",children:b?.label??r}),n.jsx(be,{name:"chevron-down",size:14})]}),h&&n.jsxs(Ph,{anchor:v,side:d,role:"dialog",label:l,className:"listbox-popover",children:[i.length>7&&n.jsx("input",{className:"input listbox-search",autoFocus:!Yh(),placeholder:"Search",value:m,onChange:S=>x(S.target.value),"aria-label":`Search ${l}`}),n.jsx("div",{role:"listbox",className:"listbox",children:w.length?w.map(S=>n.jsxs("button",{type:"button",role:"option","aria-selected":S.value===e,disabled:S.disabled,className:"menu-item",onClick:()=>{a(S.value),y()},children:[n.jsx("span",{className:"truncate",children:S.label}),S.hint&&n.jsx("span",{className:"menu-hint",children:S.hint})]},S.value)):n.jsx("div",{className:"menu-label",children:"No matches"})})]})]})}function hs({value:e,options:i,onChange:a,size:r="sm",label:l}){return n.jsx("div",{className:r==="xs"?"segmented xs":"segmented",role:"group","aria-label":l,children:i.map(u=>n.jsxs("button",{type:"button","aria-pressed":u.value===e,onClick:()=>a(u.value),title:u.hint,children:[u.icon&&n.jsx(be,{name:u.icon,size:14}),u.label]},u.value))})}function Qr({children:e,label:i="More information"}){const[a,r]=N.useState(!1),l=N.useCallback(()=>r(!1),[]),u=Vh(a,l);return n.jsxs("div",{className:"info-tip menu-anchor",ref:u,children:[n.jsx("button",{type:"button","aria-label":i,"aria-expanded":a,onClick:()=>r(d=>!d),children:n.jsx(be,{name:"info",size:14})}),a&&n.jsx(Ph,{anchor:u,side:"below",role:"note",className:"text menu-scroll",style:{width:320},children:e})]})}function qt({open:e,title:i,onClose:a,children:r,footer:l,wide:u}){const d=N.useRef(null);return N.useEffect(()=>{const h=d.current;h&&(e&&!h.open&&h.showModal(),!e&&h.open&&h.close())},[e]),n.jsx("dialog",{ref:d,className:u?"sheet wide":"sheet",onClose:a,onCancel:h=>{h.preventDefault(),a()},children:e&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"sheet-header",children:[n.jsx("h2",{className:"sheet-title",children:i}),n.jsx(q,{variant:"ghost",size:"sm",icon:"x","aria-label":"Close",onClick:a})]}),n.jsx("div",{className:"sheet-content",children:r}),l&&n.jsx("div",{className:"sheet-footer",children:l})]})})}function He({title:e,message:i,confirmLabel:a="Confirm",cancelLabel:r="Cancel",destructive:l=!1}){const{promise:u,resolve:d}=Promise.withResolvers(),h=document.createElement("div");document.body.appendChild(h);const p=Tb.createRoot(h),m=y=>{d(y),p.unmount(),h.remove()};function x(){const[y,v]=N.useState(!0),b=w=>{v(!1),m(w)};return n.jsx(qt,{open:y,title:e,onClose:()=>b(!1),footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{onClick:()=>b(!1),children:r}),n.jsx(q,{variant:l?"destructive":"default",onClick:()=>b(!0),autoFocus:!0,children:a})]}),children:n.jsx("div",{className:"muted",children:i})})}return p.render(n.jsx(x,{})),u}function rc({title:e,subtitle:i,leading:a,actions:r}){return n.jsxs("header",{className:"screen-header",children:[a,n.jsx("h1",{className:"screen-title",children:e}),i&&n.jsx("span",{className:"screen-subtitle",children:i}),r&&n.jsx("div",{className:"actions",children:r})]})}const Ix=["#5b7cfa","#e06c4f","#3fa37a","#b56fd8","#d39b2c","#3e9bc2","#d1577d","#7a8c35","#8a6bd1","#c4703a"];function Is({name:e,id:i}){let a=0;for(const r of i)a=a*31+r.charCodeAt(0)>>>0;return n.jsx("span",{className:"identity",style:{background:Ix[a%Ix.length]},"aria-hidden":"true",children:(e.trim()[0]??"?").toUpperCase()})}function Qt({value:e}){const i=new Date(e);return n.jsx("time",{dateTime:e,title:Number.isNaN(i.getTime())?e:i.toLocaleString(),children:Number.isNaN(i.getTime())?e:i.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})})}function Vn({value:e}){const i=new Date(e),a=Math.max(0,(Date.now()-i.getTime())/1e3),r=Number.isNaN(a)?e:a<60?"now":a<3600?`${Math.floor(a/60)}m`:a<86400?`${Math.floor(a/3600)}h`:a<7*86400?`${Math.floor(a/86400)}d`:i.toLocaleDateString(void 0,{month:"short",day:"numeric"});return n.jsx("time",{dateTime:e,title:Number.isNaN(i.getTime())?e:i.toLocaleString(),children:r})}function Vl(e){if(e<1e3)return`${Math.round(e)} ms`;const i=Math.round(e/100);if(i<100)return`${(i/10).toFixed(1)} s`;const a=Math.round(e/1e3);return a<60?`${a} s`:a%60?`${Math.floor(a/60)} min ${a%60} s`:`${a/60} min`}function Ob({value:e,label:i="Copy"}){const[a,r]=N.useState(!1);return N.useEffect(()=>{if(!a)return;const l=window.setTimeout(()=>r(!1),1500);return()=>window.clearTimeout(l)},[a]),n.jsx(q,{variant:"ghost",size:"xs",icon:a?"check":"copy","aria-label":a?"Copied":i,title:a?"Copied":i,onClick:()=>{navigator.clipboard.writeText(e).then(()=>r(!0))}})}function Yn({value:e,label:i}){return n.jsxs("div",{className:"copy-field",children:[n.jsx("code",{children:e}),n.jsx(Ob,{value:e,label:i})]})}const Bx="pikibun.workspace",Rb=N.createContext(null);function pt(){const e=N.useContext(Rb);if(!e)throw new Error("useApp must be used inside AppProvider");return e}function V0({user:e,setUser:i,signOut:a,children:r}){const l=$e("/api/workspaces"),u=$e("/api/sessions"),[d,h]=N.useState(null),[p,m]=N.useState(()=>{try{return localStorage.getItem(Bx)??""}catch{return""}}),x=N.useCallback(k=>{m(k);try{localStorage.setItem(Bx,k)}catch{}},[]),y=u.refresh,v=d?.activity==="working"||(u.data?.sessions??[]).some(k=>k.status!=="archived"&&k.activity==="working");N.useEffect(()=>{const k=window.setInterval(()=>{document.hidden||y()},v?1e4:3e4);return()=>window.clearInterval(k)},[y,v]);const b=l.data?.workspaces??[],w=b.find(k=>k.id===p)??b[0]??null,S=N.useMemo(()=>[...u.data?.sessions??[]].sort((k,O)=>O.createdAt.localeCompare(k.createdAt)),[u.data]),C={user:e,setUser:i,signOut:a,workspaces:b,workspacesLoading:l.loading,workspacesError:l.error,refreshWorkspaces:l.refresh,currentWorkspace:w,selectWorkspace:x,sessions:S,sessionsLoading:u.loading&&!u.data,refreshSessions:y,liveActivity:d,setLiveActivity:h};return n.jsx(Rb.Provider,{value:C,children:r})}const Z0=["profile","notifications","appearance","hosts","desktop","workspaces","admin"];function Ds(e){if(e)try{return decodeURIComponent(e)}catch{return}}function Hx(e){const i=e.replace(/^#\/?/,"").split("/").filter(Boolean),[a,r,l]=i;if(a==="s"&&Ds(r))return{name:"session",sessionId:Ds(r)};if(a==="sessions")return{name:"sessions"};if(a==="shared"&&Ds(r))return{name:"shared",token:Ds(r)};if(a==="join"&&Ds(r))return{name:"join",token:Ds(r)};if(a==="w"&&Ds(r)&&l==="new")return{name:"new",workspaceId:Ds(r)};if(a==="settings"){const u=Z0.find(h=>h===r)??"profile",d=Ds(l);return d?{name:"settings",section:u,id:d}:{name:"settings",section:u}}return{name:"home"}}function Xe(e){switch(e.name){case"home":return"#/";case"sessions":return"#/sessions";case"new":return`#/w/${encodeURIComponent(e.workspaceId)}/new`;case"session":return`#/s/${encodeURIComponent(e.sessionId)}`;case"settings":return`#/settings/${e.section}${e.id?`/${encodeURIComponent(e.id)}`:""}`;case"shared":return`#/shared/${encodeURIComponent(e.token)}`;case"join":return`#/join/${encodeURIComponent(e.token)}`}}function xi(e){const i=Xe(e);window.location.hash!==i&&(window.location.hash=i)}function Zh(){const[e,i]=N.useState(()=>Hx(window.location.hash));return N.useEffect(()=>{const a=()=>i(Hx(window.location.hash));return window.addEventListener("hashchange",a),()=>window.removeEventListener("hashchange",a)},[]),e}const ph="pikibun.pendingInvite";function X0(e){try{sessionStorage.setItem(ph,e)}catch{}}function Q0(){try{const e=sessionStorage.getItem(ph);return sessionStorage.removeItem(ph),e}catch{return null}}function K0(e){const[i,a]=N.useState(null),[r,l]=N.useState(!0),[u,d]=N.useState(""),[h,p]=N.useState(0),m=N.useCallback(()=>p(x=>x+1),[]);return N.useEffect(()=>{const x=new AbortController;return l(!0),d(""),ce("/api/invite",{headers:{"x-invite-token":e},signal:x.signal}).then(y=>{x.signal.aborted||a(y.invite)}).catch(y=>{x.signal.aborted||(a(null),d(On(y)))}).finally(()=>{x.signal.aborted||l(!1)}),()=>x.abort()},[e,h]),{invite:i,setInvite:a,loading:r,error:u,refresh:m}}function Xh(){const e=$e("/api/join-requests"),i=je(),a=e.data?.requests??[],[r,l]=N.useState(!1);N.useEffect(()=>{e.error?l(!0):e.data&&l(!1)},[e.error,e.data]);async function u(d){i.busy||!await He({title:"Withdraw request",message:`Stop waiting to join ${d.workspaceName}? You can ask again while you have a working invite link.`,confirmLabel:"Withdraw",destructive:!0})||i.run(async()=>{await ce(`/api/join-requests/${oe(d.workspaceId)}`,{method:"DELETE"}),e.refresh()},"Request withdrawn.")}return!a.length&&!i.notice&&!r?null:n.jsxs(Ae,{title:"Your requests to join",info:"Workspaces you asked to join through an invite link. An owner or admin of each accepts or declines you.",children:[r&&!a.length?n.jsx(ke,{children:n.jsx(we,{variant:"error",title:"Could not load your requests",actions:n.jsx(q,{size:"sm",disabled:e.loading,onClick:e.refresh,children:e.loading?"Trying...":"Try again"}),children:e.error||"Your requests could not be loaded."})}):a.length?a.map(d=>n.jsx(W,{title:d.workspaceName,hint:n.jsxs(n.Fragment,{children:["Waiting for approval · asked ",n.jsx(Vn,{value:d.createdAt})]}),trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:i.busy,"aria-label":`Withdraw request to join ${d.workspaceName}`,onClick:()=>{u(d)},children:"Withdraw"})},d.workspaceId)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"You aren't waiting to join any workspace"})}),(i.error||i.notice)&&n.jsx(ke,{children:n.jsx(ye,{...i})})]})}function W0({token:e}){const{refreshWorkspaces:i}=pt(),{invite:a,setInvite:r,loading:l,error:u,refresh:d}=K0(e),h=je();N.useEffect(()=>{a?.status==="member"&&i()},[a?.status,i]);function p(){h.busy||h.run(async()=>{r((await ce("/api/invite",{method:"POST",body:{token:e}})).invite)})}function m(){h.busy||h.run(async()=>{r((await ce("/api/invite",{method:"DELETE",headers:{"x-invite-token":e}})).invite)},"Request withdrawn.")}return l&&!a?n.jsx(ds,{}):n.jsx("div",{className:"welcome",children:n.jsxs("div",{className:"welcome-inner",children:[n.jsx(Ba,{size:40}),a?n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:a.workspaceName}),a.status==="none"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"You're invited to join this workspace. Ask to join, and an owner or admin reviews your request and chooses your role. Until they accept you, you can't see or do anything in it."}),n.jsx("div",{className:"actions",children:n.jsx(q,{variant:"default",size:"lg",disabled:h.busy,onClick:p,children:h.busy?"Asking...":"Ask to join"})})]}),a.status==="pending"&&n.jsxs(n.Fragment,{children:[n.jsxs(we,{variant:"info",title:"Waiting for approval",role:"status",children:["Your request to join was sent. Once an owner or admin of ",a.workspaceName," accepts you, the workspace appears in your sidebar."]}),n.jsxs("div",{className:"actions",children:[n.jsx(q,{disabled:h.busy||l,onClick:d,children:"Check again"}),n.jsx(q,{variant:"ghost",disabled:h.busy,onClick:m,children:"Withdraw request"})]})]}),a.status==="member"&&n.jsxs(n.Fragment,{children:[n.jsxs(we,{variant:"success",title:"You're a member",role:"status",children:["You're a member of ",a.workspaceName,"."]}),n.jsx("div",{className:"actions",children:n.jsx(Ht,{variant:"default",href:a.workspaceId?Xe({name:"settings",section:"workspaces",id:a.workspaceId}):Xe({name:"home"}),children:"Open workspace"})})]}),n.jsx(ye,{...h})]}):n.jsxs(n.Fragment,{children:[n.jsx("h1",{children:"Join a workspace"}),n.jsx(we,{variant:"error",title:"Invite link not available",actions:n.jsx(q,{size:"sm",onClick:d,children:"Try again"}),children:u}),n.jsx("div",{className:"actions",children:n.jsx(Ht,{href:Xe({name:"home"}),children:"Go to Pikibun"})}),n.jsx(Xh,{})]})]})})}const J0=["read","ask","write","approve","manage"],e1=["admin","collaborator","member","viewer"],Mb=["viewer","member","collaborator","admin"],qx={textBytes:256*1024,imageBytes:2*1024*1024},Yr=["off","minimal","low","medium","high","xhigh","max"];function t1(e,i){return e.includes(i)||i==="read"&&e.some(a=>J0.includes(a))}const n1=["owner","admin","collaborator","member"],Zl=["owner","admin"],Db=["collaborator","member","viewer"];function s1(e,i){return Zl.includes(e)?["read","ask","write","manage"]:i!=="workspace"?[]:i1.includes(e)?["read","ask","write"]:["read"]}function Qh(e,i,a){return e===i||a!==void 0&&Zl.includes(a)}const i1=["owner","admin","collaborator"],a1=["viewer"];function r1(e){return a1.includes(e)?["read"]:null}function so(e){return n1.includes(e??"member")}const oc={viewer:["read"],member:["read","ask"],collaborator:["read","ask","write"],admin:["read","ask","write","approve","manage"]};function Lb(e){const i=new Set(e);return i.size&&i.add("read"),Mb.find(a=>{const r=oc[a];return r.length===i.size&&r.every(l=>i.has(l))})??null}function o1(e,i){const a=i?r1(i):null;return!a||oc[e].every(r=>a.includes(r))}function l1(e,i){return oc[e].every(a=>t1(i,a))}const c1=new TextEncoder;new TextDecoder("utf-8",{fatal:!0});function u1(e){let i="";for(const a of e)i+=String.fromCharCode(a);return btoa(i).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}async function d1(e){return u1(new Uint8Array(await crypto.subtle.digest("SHA-256",c1.encode(e))))}const Kr={count:4,imageBase64:512*1024,totalBase64:720*1024},Us={defaultBytes:10*1024*1024,maxBytes:50*1024*1024,minBytes:1024*1024,chunkBytes:512*1024,count:10};function h1(e){let i=e.normalize("NFC").replace(/[\x00-\x1f\x7f/\\:*?"<>|]/g,"_").trim();const a=r=>new TextEncoder().encode(r).length;if(a(i)>200){const r=i.lastIndexOf("."),l=r>0&&i.length-r<=16?i.slice(r):"";let u=i.slice(0,i.length-l.length);for(;u&&a(u+l)>200;)u=u.slice(0,-1);i=u+l}return i=i.replace(/[. ]+$/,""),!i||/^\.+$/.test(i)||i.toLowerCase()===".git"?"":(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\.|$)/i.test(i)&&(i=`_${i}`),i.replace(new RegExp("[\\ud800-\\udbff](?![\\udc00-\\udfff])|(?<![\\ud800-\\udbff])[\\udc00-\\udfff]","g"),"_"))}function pi(e){if(e>=1024*1024){const i=e/1048576;return`${Number.isInteger(i)?i:i.toFixed(1)} MB`}return e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} bytes`}function f1(e){return e.length?`Attached ${e.length===1?"file":"files"}, uploaded into the session worktree:
|
|
10
|
+
`+e.map(i=>`- ${i.path} (${pi(i.size)})`).join(`
|
|
11
|
+
`):""}function Zi(){const e=typeof window>"u"?void 0:window.pikibunDesktop;return e&&e.version===1?e:void 0}async function rn(e){const i=await e;if(i&&!i.ok)throw new Error(i.error)}function _b(){const e=Zi(),[i,a]=N.useState(null),[r,l]=N.useState(""),u=N.useCallback(()=>{e&&e.view().then(d=>{a(d),l("")},()=>l("Pikibun's app settings are unavailable on this page."))},[e]);return N.useEffect(()=>{if(e)return u(),e.onUpdate(a)},[e,u]),{bridge:e,view:i,error:r,reload:u}}const gh=new Set;async function m1(e){const i=Zi();if(!(!i?.upload||!e?.capabilities.directUploads||gh.has(e.id))){try{if((await i.view()).hosts.connections.some(r=>r.running?.connectorId===e.id))return i}catch{}gh.add(e.id)}}async function p1(e){const i=new Uint8Array(await e.arrayBuffer());let a="";for(let r=0;r<i.length;r+=32768)a+=String.fromCharCode(...i.subarray(r,r+32768));return btoa(a)}function g1(e,i,a){const r=e?.path;if(!e||e.received!==i||r!==void 0&&(typeof r!="string"||!/^attachments\/[^/\x00-\x1f\x7f]+$/.test(r))||i===a!=(r!==void 0))throw new Error("The host answered the upload unexpectedly.");return e}function x1(e){try{const i=JSON.parse(e.slice(0,2048));if(typeof i.error=="string"&&/^[\w .,:;'()-]{1,300}$/.test(i.error))return i.error}catch{}return""}async function y1(e,i,a,r,l){const u=a.size,d=crypto.randomUUID();let h=await m1(i),p=0;for(;;){const m=Math.min(u,p+Us.chunkBytes),x={uploadId:d,name:r,size:u,offset:p,data:await p1(a.slice(p,m))};let y;if(h&&i){const v=JSON.stringify(x),{connectorId:b,grant:w}=await ce(`/api/sessions/${oe(e)}/uploads/direct`,{method:"POST",body:{bodyHash:await d1(v),size:u}}),S=await h.upload({connectorId:b,grant:w,body:v});if(S.ok){if(S.status>=400)throw new Error(x1(S.body)||"This computer's host could not take the file.");try{y=JSON.parse(S.body)}catch{throw new Error("The host answered the upload unexpectedly.")}}else{if(S.local||p>0)throw new Error(S.error);gh.add(i.id),h=void 0}}if(y??=await ce(`/api/sessions/${oe(e)}/uploads`,{method:"POST",body:x}),g1(y,m,u),l?.(m),y.path!==void 0)return{path:y.path,size:u};p=m}}const $b=["image/png","image/jpeg","image/gif","image/webp"],Bd=1568,b1=32*1024*1024;function Ub(e){return e&&!e.capabilities.chatImages?"Update the host's connector (npx pikibun@latest connect) to send images.":void 0}function v1(e){return e&&!e.capabilities.fileUploads?"Update the host's connector (npx pikibun@latest connect) to attach files.":void 0}function Ib(e,i){const a=$e(`/api/workspaces/${oe(e)}/attachments`),r=v1(i);return{...r?{unavailable:r}:{},maxBytes:a.data?.settings.maxFileBytes??Us.defaultBytes}}function w1(e){const i=Array.from(e.items??[]).filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null);return i.length?i:Array.from(e.files??[])}function j1(e){const i=e instanceof File?h1(e.name):"";if(i)return i;const a=/^[a-z]+\/([a-z0-9]{1,8})$/.exec(e.type)?.[1];return`pasted-${new Date().toISOString().slice(0,19).replace(/[:T]/g,"-")}${a?`.${a}`:""}`}function Bb(e,i,a,r){const[l,u]=N.useState(()=>(i?.()??[]).map(G=>({id:crypto.randomUUID(),file:G}))),[d,h]=N.useState(()=>r?.()??[]),[p,m]=N.useState({}),[x,y]=N.useState(""),v=N.useRef(l);v.current=l;const b=N.useRef(d);b.current=d;function w(G){if(!a){y("Only images can be attached here.");return}if(a.unavailable){y(a.unavailable);return}const J=G.filter(I=>I.size<=a.maxBytes),U=J.map(I=>({id:crypto.randomUUID(),file:I,name:j1(I)})),E=Us.count-b.current.length;y(J.length<G.length?`A file larger than ${pi(a.maxBytes)} can't be attached in this workspace.`:U.length>E?`A message can carry at most ${Us.count} files.`:""),U.length&&h(I=>[...I,...U].slice(0,Us.count))}function S(G){if(e){y(e);return}const J=G.filter(E=>E.size<=b1),U=J.map(E=>({id:crypto.randomUUID(),file:E}));y(J.length<G.length?"An image larger than 32 MiB can't be attached.":v.current.length+U.length>Kr.count?`A message can carry at most ${Kr.count} images.`:""),U.length&&u(E=>[...E,...U].slice(0,Kr.count))}function C(G){const J=G.filter(E=>$b.includes(E.type)&&(!e||!a||!!a.unavailable)),U=G.filter(E=>!J.includes(E));J.length&&S(J),U.length&&w(U)}function k(G){const J=w1(G.clipboardData).filter(U=>a||U.type.startsWith("image/"));J.length&&(G.clipboardData.types.includes("text/plain")||G.preventDefault(),C(J))}function O(G){const J=Array.from(G??[]);if(!a){const U=J.filter(E=>E.type.startsWith("image/"));U.length?S(U):J.length&&y("Only images can be attached here.");return}J.length&&C(J)}function T(G){u(J=>J.filter(U=>U.id!==G)),h(J=>J.filter(U=>U.id!==G)),y("")}function M(G,J=[]){const U=new Set([...G.map(E=>E.id),...J.map(E=>E.id)]);u(E=>E.filter(I=>!U.has(I.id))),h(E=>E.filter(I=>!U.has(I.id))),m({})}async function _(G,J,U){for(const E of U)E.uploaded||(E.uploaded=await y1(G,J,E.file,E.name,I=>m(Q=>({...Q,[E.id]:I}))));return f1(U.map(E=>E.uploaded))}const $=l.length+d.length;return{images:l,files:d,progress:p,count:$,notice:x,paste:k,pick:O,remove:T,sent:M,add:S,upload:_,takesFiles:!!(a&&!a.unavailable)}}function Hb(e,i){return i?e.trim()?`${e}
|
|
12
|
+
|
|
13
|
+
${i}`:i:e}function qb({attachments:e,disabled:i}){const a=N.useRef(null),r=e.takesFiles?"Attach files":"Attach images";return n.jsxs(n.Fragment,{children:[n.jsx(q,{variant:"ghost",size:"sm",icon:e.takesFiles?"paperclip":"image",className:"composer-attach","aria-label":r,title:r,disabled:i,onClick:()=>a.current?.click()}),n.jsx("input",{ref:a,type:"file",accept:e.takesFiles?void 0:$b.join(","),multiple:!0,hidden:!0,tabIndex:-1,onChange:l=>{e.pick(l.currentTarget.files),l.currentTarget.value=""}})]})}function Fb({attachments:e,disabled:i}){return e.count?n.jsxs("ul",{className:"composer-attachments","aria-label":"Attachments",children:[e.images.map((a,r)=>n.jsxs("li",{className:"composer-attachment",children:[n.jsx(k1,{file:a.file,label:`Image ${r+1}`}),n.jsx(q,{variant:"secondary",size:"xs",icon:"x",className:"composer-attachment-remove","aria-label":`Remove image ${r+1}`,title:"Remove image",disabled:i,onClick:()=>e.remove(a.id)})]},a.id)),e.files.map(a=>{const r=e.progress[a.id],l=a.uploaded?"Uploaded":r!==void 0&&a.file.size?`Uploading ${Math.floor(r/a.file.size*100)}%`:pi(a.file.size);return n.jsxs("li",{className:"composer-attachment composer-file",title:a.uploaded?`${a.uploaded.path} in the session's worktree`:a.name,children:[n.jsx(be,{name:"file",size:16}),n.jsxs("span",{className:"composer-file-text",children:[n.jsx("span",{className:"composer-file-name",children:a.name}),n.jsx("span",{className:"composer-file-status",children:l})]}),n.jsx(q,{variant:"secondary",size:"xs",icon:"x",className:"composer-attachment-remove","aria-label":`Remove ${a.name}`,title:"Remove file",disabled:i,onClick:()=>e.remove(a.id)})]},a.id)})]}):null}function k1({file:e,label:i}){const[a,r]=N.useState("");return N.useEffect(()=>{const l=URL.createObjectURL(e);return r(l),()=>URL.revokeObjectURL(l)},[e]),a?n.jsx("img",{src:a,alt:i}):null}const io=new Map;function S1(e,i){i.length&&io.set(e,i.map(a=>a.file))}const Kh=new Map;function C1(e,i){i.length&&Kh.set(e,[...i])}function A1(e){return Kh.get(e)??[]}const Ll=new Map;function N1(e,i){const a=N.useRef(i);a.current=i,N.useEffect(()=>{const r=l=>a.current.add(l);return Ll.set(e,r),()=>{Ll.get(e)===r&&Ll.delete(e)}},[e])}function T1(e,i){if(!i.length)return;const a=Ll.get(e);a?a([...i]):io.set(e,[...io.get(e)??[],...i])}function E1(e){return io.get(e)??[]}function z1(e){io.delete(e),Kh.delete(e)}function O1(e){return e.map(i=>{const a=atob(i.data),r=new Uint8Array(a.length);for(let l=0;l<a.length;l++)r[l]=a.charCodeAt(l);return new Blob([r],{type:i.mimeType})})}const Fx=e=>Math.ceil(e/3)*4;async function Gb(e){const i=Math.min(Kr.imageBase64,Math.floor(Kr.totalBase64/Math.max(1,e.length))),a=[];for(const r of e)a.push(await R1(r.file,i));return a}async function R1(e,i){let a;try{a=await createImageBitmap(e)}catch{throw new Error("A pasted image can't be read. Copy it again, or paste a PNG or JPEG.")}try{const r=await D1(e);if(r&&r!=="image/webp"&&a.width<=Bd&&a.height<=Bd&&Fx(e.size)<=i)return{mimeType:r,data:await Gx(e)};let l=Math.min(1,Bd/Math.max(a.width,a.height));for(let u=0;u<6;u++,l*=.75){const d=Math.max(1,Math.round(a.width*l)),h=Math.max(1,Math.round(a.height*l)),p=[...r==="image/png"?[{mimeType:"image/png"}]:[],{mimeType:"image/jpeg",quality:.85},{mimeType:"image/jpeg",quality:.7},{mimeType:"image/jpeg",quality:.55}];for(const{mimeType:m,quality:x}of p){const y=await M1(a,d,h,m,x);if(y&&Fx(y.size)<=i)return{mimeType:m,data:await Gx(y)}}}throw new Error("A pasted image is too large to send, even scaled down.")}finally{a.close()}}function M1(e,i,a,r,l){const u=document.createElement("canvas");u.width=i,u.height=a;const d=u.getContext("2d");return d?(r==="image/jpeg"&&(d.fillStyle="#fff",d.fillRect(0,0,i,a)),d.imageSmoothingQuality="high",d.drawImage(e,0,0,i,a),new Promise(h=>u.toBlob(h,r,l))):Promise.resolve(null)}async function D1(e){const i=new Uint8Array(await e.slice(0,12).arrayBuffer()),a=(r,l)=>String.fromCharCode(...i.subarray(r,l));if(i[0]===137&&a(1,4)==="PNG")return"image/png";if(i[0]===255&&i[1]===216&&i[2]===255)return"image/jpeg";if(a(0,4)==="GIF8")return"image/gif";if(a(0,4)==="RIFF"&&a(8,12)==="WEBP")return"image/webp"}function Gx(e){return new Promise((i,a)=>{const r=new FileReader;r.onload=()=>{const l=String(r.result);i(l.slice(l.indexOf(",")+1))},r.onerror=()=>a(new Error("A pasted image can't be read.")),r.readAsDataURL(e)})}const L1={off:"Off",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Max"},_l={read:{label:"Read only",hint:"Inspect files; edits, commands and commits ask the session owner first"},approval:{label:"Ask before acting",hint:"Edits are automatic; commands, commits, GitHub comments and merges need approval"},auto:{label:"Auto-approve",hint:"Commands, commits, pushes, GitHub comments, issues and merges run immediately as the owner, without asking"}};function Wh(e){return e?.capabilities.automaticGitHub===!0}function _1(e,i){const a=Wh(e)?" GitHub comments and new issues are posted, and pull requests merged, as you without asking too: the agent can merge any pull request of this workspace's github.com repositories that GitHub lets you merge, into its base branch. Branch protection and required checks on GitHub still apply.":" GitHub comments and merges still need approval.";return(i?`Commands, commits and pushes the agent writes will run immediately on ${e.name}, an UNSANDBOXED host: commands run directly on the owner's machine with their full user permissions and network access, and no resource limits. Tools outside the agent won't ask either.`:"Commands, commits and pushes the agent writes will run immediately as you, without asking, as will tools outside the agent and commands on a host without resource limits.")+a+$1(e)}function $1(e){return e.capabilities.hostCommands?e.hostCommandAccess==="auto"?` Its owner granted you automatic host commands, so host_bash also runs OUTSIDE the sandbox on ${e.name} without asking, with access to the owner's host files, credentials and network.`:e.hostCommandAccess==="owner"||!e.capabilities.hostGrants?" On your own host, host_bash also runs OUTSIDE the sandbox without asking, with access to your host files, credentials and network. On someone else's host it still needs their approval.":" On your own host, or one whose owner granted you automatic host commands, host_bash also runs OUTSIDE the sandbox without asking, with access to that host's files, credentials and network. Elsewhere it still needs approval.":""}const Px="Update the host's connector (npx pikibun@latest connect) to choose model, reasoning and access",Fi=e=>`${e.provider}
|
|
14
|
+
${e.modelId}`;function Ha(e,i){return i&&e?.models.find(a=>a.provider===i.provider&&a.modelId===i.modelId)}function U1(e){const i=e?.thinkingLevels??[];return i.some(a=>a!=="off")?i:[]}function Pb(e,i){if(!i||!e?.length||e.includes(i))return i;const a=Yr.indexOf(i);return e.filter(l=>Yr.indexOf(l)<=a).sort((l,u)=>Yr.indexOf(u)-Yr.indexOf(l))[0]??(e.includes("off")?"off":e[0])}function lc(e,i){const a=e?.thinkingLevels;if(!(!e||!a?.length))return i&&a.includes(i)?i:e.thinkingLevel&&a.includes(e.thinkingLevel)?e.thinkingLevel:Pb(a,i)}function I1(e,i){return{...e,model:{provider:i.provider,modelId:i.modelId},thinkingLevel:i.thinkingLevel??Pb(i.thinkingLevels,e.thinkingLevel)}}function B1(e,i,a){const r=e?.capabilities.chatOptions?Ha(e,i.model??a):void 0;if(!e||!r)return;const l=lc(r,i.thinkingLevel??(i.model?void 0:a?.thinkingLevel));return{connectorId:e.id,provider:r.provider,modelId:r.modelId,...l?{thinkingLevel:l}:{}}}function H1(e){if(e)try{const i=JSON.parse(e);if(!i||typeof i.connectorId!="string"||typeof i.provider!="string"||typeof i.modelId!="string")return;const a=Yr.includes(i.thinkingLevel)?i.thinkingLevel:void 0;return{connectorId:i.connectorId,provider:i.provider,modelId:i.modelId,...a?{thinkingLevel:a}:{}}}catch{return}}function q1(e,i,a,r=()=>!0){const l=i&&Ha(e,i),u=l&&r(l)?l:Ha(e,a);if(!u)return{access:"auto"};const d=u.thinkingLevels?.length?lc(u,i?.thinkingLevel):u.thinkingLevel;return{model:{provider:u.provider,modelId:u.modelId},thinkingLevel:d,access:"auto"}}function F1(e,i){const a=!e.entries?.some(l=>l.role==="user"),r=e.access??(i&&a?"auto":"approval");return{model:e.agent&&{provider:e.agent.provider,modelId:e.agent.modelId},thinkingLevel:e.agent?.thinkingLevel,access:r==="auto"&&!i?"approval":r}}function G1(e,i,a){if(!(a!=="submit"||e||i.access==="approval"))return`Still checking this session's host, so "${_l[i.access].label}" can't be applied yet. Try again in a moment.`}function P1(e,i){if(e?.capabilities.chatOptions){if(!e.models.length)return`${e.name} offers no models right now.`;if(i.model&&!Ha(e,i.model))return`${e.name} no longer offers ${i.model.modelId}. Choose another model.`}}function Yb(e,i,a){if(!e?.capabilities.chatOptions)return;const r=Ha(e,i.model),l={};r&&(l.model={provider:r.provider,modelId:r.modelId});const u=lc(r,i.thinkingLevel);return u&&(l.thinkingLevel=u),a==="submit"&&(l.access=i.access),a==="submit"&&i.access==="auto"&&Wh(e)&&(l.autoMerge=!0),l}const Vb="pikibun.autoApproveConfirmed";function Zb(e,i){return e?.autoMerge===!0&&!i}const Xb="pikibun.lastChat";function Y1(){try{return H1(localStorage.getItem(Xb))}catch{return}}function Qb(e,i,a){const r=B1(e,i,a);if(r)try{localStorage.setItem(Xb,JSON.stringify(r))}catch{}}let Kb=!1;function Wb(){if(Kb)return!0;try{return localStorage.getItem(Vb)==="1"}catch{return!1}}async function Jh(e,i){const a=await He({title:"Auto-approve commands?",message:_1(e,i),confirmLabel:"Enable auto-approve",destructive:!0});if(a&&Wh(e)){Kb=!0;try{localStorage.setItem(Vb,"1")}catch{}}return a}const Yx={read:"eye",approval:"shield",auto:"alert"};function Jb({host:e,value:i,onChange:a,owner:r,showAccess:l,unsandboxed:u}){if(!e)return null;if(!e.capabilities.chatOptions)return n.jsx("span",{className:"chat-options-hint truncate",title:Px,children:Px});const d=Ha(e,i.model),h=U1(d),p=lc(d,i.thinkingLevel);function m(w){const S=e.models.find(C=>Fi(C)===w);S&&a(I1(i,S))}async function x(w){w==="auto"&&i.access!=="auto"&&!await Jh(e,u)||a({...i,access:w})}const v=(r?["read","approval","auto"]:["read","approval"]).map(w=>({label:_l[w].label,icon:Yx[w],hint:_l[w].hint,destructive:w==="auto",onSelect:()=>{x(w)}})),b=_l[i.access];return n.jsxs(n.Fragment,{children:[n.jsx(Xt,{label:"Model",side:"above",placeholder:"Model",disabled:!e.models.length,value:i.model&&d?Fi(i.model):"",options:e.models.map(w=>({value:Fi(w),label:w.name,hint:w.provider})),onChange:m}),h.length>0&&n.jsx(Xt,{label:"Reasoning",side:"above",placeholder:"Default",value:p&&h.includes(p)?p:"",options:h.map(w=>({value:w,label:L1[w]})),onChange:w=>a({...i,thinkingLevel:w})}),l&&n.jsx("span",{className:i.access==="auto"?"chat-access auto":"chat-access",title:`Access: ${b.label}`,children:n.jsx(ss,{label:"Access",align:"end",side:"above",items:v,trigger:n.jsxs(n.Fragment,{children:[n.jsx(be,{name:Yx[i.access],size:14}),n.jsx("span",{className:"truncate",children:b.label})]})})})]})}const $s=e=>`pikibun.draft.${e}`,V1=e=>`new-session:${e}`,$l=new Map;function Xl(e){try{const i=localStorage.getItem($s(e));if(i!==null)return i;const a=sessionStorage.getItem($s(e));return a===null?"":(localStorage.setItem($s(e),a),sessionStorage.removeItem($s(e)),a)}catch{return""}}function oo(e,i){try{i?localStorage.setItem($s(e),i):localStorage.removeItem($s(e))}catch{}}function ef(e,i){try{localStorage.getItem($s(e))===i&&localStorage.removeItem($s(e))}catch{}for(const a of $l.get(e)??[])a(i)}const Ul=new Map;function Z1(e,i){const a=l=>l.trim()?`${l}
|
|
15
|
+
|
|
16
|
+
${i}`:i,r=Ul.get(e);if(r?.size)for(const l of r)l(a);else oo(e,a(Xl(e)))}function tf(e){const[i]=N.useState(()=>Xl(e)),[a,r]=N.useState(i);return N.useEffect(()=>{const l=x=>r(y=>y===x?"":y),u=$l.get(e)??new Set;u.add(l),$l.set(e,u);const d=x=>r(x),h=Ul.get(e)??new Set;h.add(d),Ul.set(e,h);const p=x=>{x.key===$s(e)&&x.newValue===null&&x.oldValue&&l(x.oldValue)};window.addEventListener("storage",p);const m=Xl(e);return m!==i&&r(x=>x===i?m:x),()=>{u.delete(l),u.size||$l.delete(e),h.delete(d),h.size||Ul.delete(e),window.removeEventListener("storage",p)}},[e,i]),N.useEffect(()=>{oo(e,a)},[e,a]),[a,r]}function lo(e){const[i,a]=N.useState(null),[r,l]=N.useState(!!e),[u,d]=N.useState(""),[h,p]=N.useState(0),m=N.useRef(void 0),x=N.useCallback(()=>p(y=>y+1),[]);return N.useEffect(()=>{const y=new AbortController;let v=!1;if(m.current!==e&&(m.current=e,a(null),l(!!e)),d(""),!e)return()=>y.abort();async function b(){if(!v){v=!0;try{const S=await ce(e,{signal:y.signal});y.signal.aborted||(a(S),d(""))}catch(S){y.signal.aborted||d(On(S))}finally{v=!1,y.signal.aborted||l(!1)}}}b();const w=window.setInterval(()=>{document.hidden||b()},1e4);return()=>{y.abort(),window.clearInterval(w)}},[e,h]),{data:i,loading:r,error:u,refresh:x}}function ev(e){return e.revokedAt?"Revoked":e.online?e.capabilities.unsandboxed?"Unsandboxed":e.capabilities.sandbox?"Online":"Sandbox unverified":"Offline"}function nf(e){const i=ev(e);return i==="Online"?"success":i==="Unsandboxed"?"danger":"warning"}function co({connector:e}){const i=ev(e);return n.jsx(ge,{tone:nf(e),dot:i==="Online",children:i})}function cc({connector:e}){const{capabilities:i}=e;return n.jsxs(n.Fragment,{children:[i.unsandboxed&&n.jsx(we,{variant:"error",role:"note",title:"Unsandboxed host",children:"Agent work runs directly on the owner's machine without isolation: approved commands and commits run as their user, with access to their files, credentials and network, and no resource limits. File tools are confined to the session folder by path checks only."}),n.jsx(ns,{plain:!0,title:"Host details",hint:i.platform||"Unknown platform",children:n.jsxs("div",{className:"stack small muted",children:[n.jsxs("span",{children:["Platform: ",i.platform||"Unknown",".",!e.online&&" Offline: it must reconnect before work can run."]}),n.jsxs("span",{children:["Sandbox: ",i.unsandboxed?"disabled by the host owner.":i.sandbox?"reported by the host; not a security attestation.":"unverified (not necessarily unavailable); the runner checks isolation when preparing each session."," Production shell limits: ",i.productionShell?"reported; still verified per session.":"not confirmed."]}),(e.config?.gitCredentials||i.gitCredentials)&&n.jsx("span",{children:"Git credentials: offered by the host owner for pushes in their own sessions, where a workspace's push access uses the host's Git credentials."}),i.repositoryCache&&n.jsx("span",{children:"Repository cache: this host fetches repositories into its own cache with the host owner's Git credentials, after Pikibun confirms that the session's owner can read them with their own account."}),e.config?.hostSessions&&i.hostConfig&&!i.unsandboxed&&n.jsx("span",{children:"Sessions on the host: its owner may start sessions that run directly on it, without the sandbox."}),e.config&&i.hostConfig&&n.jsxs("span",{children:["Commands: stopped after ",e.config.commandTimeoutSeconds," seconds",e.config.gpu&&i.gpu?`, with the host's GPU (${i.gpu==="dxg"?"WSL /dev/dxg":"render nodes"})`:"","."]}),i.hostMigration&&n.jsx("span",{children:"Moves: this host accepts sessions moved to it from another connected host."}),n.jsx("span",{children:"The runner verifies prerequisites for every session and stops work that fails. Production shell needs verified CPU, memory, process and storage limits. Without them, only the host's owner can let a command run unlimited, in their own sessions and still inside the sandbox."}),n.jsx("span",{children:"Native Windows is unsupported: use Linux or WSL2 with Pi configured there, or macOS without isolation."})]})})]})}function Bs(e){return{id:e.userId,githubLogin:e.githubLogin,role:e.role}}function Gi(e){return e.githubLogin||e.id}function Mt(e){return e.githubLogin?`${e.githubLogin}(${e.id})`:e.id}function X1(e){const i=new Map(e.map(a=>[a.id,a]));return a=>i.get(a)??{id:a}}function xh(e,i=[]){const a=e.trim(),r=/^@?[^\s()]*\s*\(\s*([^\s()]+)\s*\)$/.exec(a);if(r)return r[1];const l=a.replace(/^@/,"").toLowerCase(),u=l?i.filter(d=>d.githubLogin?.toLowerCase()===l):[];return u.length===1?u[0].id:a}function yh(e,i){return typeof e=="string"?Mt(i(e)):Array.isArray(e)?e.map(a=>yh(a,i)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,r])=>[a,yh(r,i)])):e}function tv(e){return{list:e,person:X1(e)}}function nv(e){const{user:i}=pt(),a=$e(e?`/api/workspaces/${oe(e)}/members`:null).data?.members;return N.useMemo(()=>{const r=(a??[]).map(Bs);return r.some(l=>l.id===i.id)||r.push({id:i.id,githubLogin:i.githubLogin}),tv(r)},[a,i.id,i.githubLogin])}const sv=N.createContext(null);function Q1({people:e,children:i}){return n.jsx(sv.Provider,{value:e,children:i})}function sf(){const{user:e}=pt(),i=N.useContext(sv),a=N.useMemo(()=>tv([{id:e.id,githubLogin:e.githubLogin}]),[e.id,e.githubLogin]);return i??a}function cs({id:e,you:i}){const{user:a}=pt(),r=sf().person(e);return n.jsx("span",{title:Mt(r),children:i&&e===a.id?"you":Gi(r)})}const iv=["github","github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],Zn={github:"GitHub","github-enterprise":"GitHub Enterprise Server",gitlab:"GitLab",bitbucket:"Bitbucket Cloud","azure-devops":"Azure DevOps",gitea:"Gitea / Forgejo",git:"Git server (HTTPS)"},us={github:{fixed:"github.com",default:"github.com"},"github-enterprise":{fixed:null,default:null},gitlab:{fixed:null,default:"gitlab.com"},bitbucket:{fixed:"bitbucket.org",default:"bitbucket.org"},"azure-devops":{fixed:"dev.azure.com",default:"dev.azure.com"},gitea:{fixed:null,default:null},git:{fixed:null,default:null}};function K1(e){return e!=="git"}const Tl={github:["github-app","owner-account","host-credentials"],"github-enterprise":["github-app","owner-account","host-credentials"],gitlab:["oauth-refresh","owner-account","host-credentials"],bitbucket:["bitbucket-client-credentials","owner-account","host-credentials"],"azure-devops":["entra-federation","owner-account","host-credentials"],gitea:["oauth-refresh","forgejo-integration","owner-account","host-credentials"],git:["owner-account","host-credentials"]},ao={repositories:5,pickerRepositories:3e3};function af(){return n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Each session starts with an empty worktree, and its agent clones the workspace repositories it needs with Git, through the session's egress proxy: reads use the session owner's access to the repository and pushes go only to the session's own branches. On a host without a sandbox, the host owner's sessions clone with the host's own Git. Sessions created before sessions cloned keep their pinned snapshots, read-only."}),n.jsx("p",{children:"Binding a repository grants teammates no access to your Git accounts. Tokens stay on the server; only a push with your own account, where a workspace's push access uses it, sends yours to your own host. The operator of the host running a session can see its files and prompts, including private source."}),n.jsxs("p",{className:"muted small",children:["Limit: ",ao.repositories," repositories per workspace."]})]})}function av(e){const i=$e(e?`/api/workspaces/${oe(e)}/repositories`:null),a=i.data?i.data.sources??i.data.repositories.length:null;return{repositories:i.data?.repositories??null,sourceCount:a,required:i.data?.required??!0,loading:i.loading,error:i.error,refresh:i.refresh}}function rv(e=!0){const i=$e(e?"/api/git/accounts":null);return{accounts:i.data?.accounts??null,loading:i.loading,error:i.error,refresh:i.refresh}}function uc(e,i){return i===us[e].default?Zn[e]:`${Zn[e]} (${i})`}function bh(e){return`${Zn[e.provider]} · ${e.host}${e.organization?`/${e.organization}`:""}`}const Vx="pikibun.lastStart",W1=80;function J1(e,i){try{return e().getItem(i)??""}catch{return""}}function eS(e,i,a){try{a===null?e().removeItem(i):e().setItem(i,a)}catch{}}function tS(e,i){const a=e.trim().split(`
|
|
17
|
+
`)[0]?.trim()??"";return Array.from(a).slice(0,W1).join("").trim()||i}const Zx=(e,i)=>e.provider===i.provider&&e.modelId===i.modelId;function nS({workspaceId:e,ownerId:i}){const a=nv(e);return n.jsx(n.Fragment,{children:Mt(a.person(i))})}function ov({workspaceId:e}){const{workspaces:i,workspacesLoading:a,workspacesError:r,refreshWorkspaces:l,currentWorkspace:u,selectWorkspace:d}=pt(),h=i.find(p=>p.id===e)??null;return N.useEffect(()=>{h&&u?.id!==h.id&&d(h.id)},[h,u?.id,d]),h?so(h.role)?n.jsx(sS,{workspace:h},h.id):n.jsx("div",{className:"new-session",children:n.jsx(xt,{title:"You're a viewer in this workspace",action:n.jsx(Ht,{variant:"ghost",href:Xe({name:"sessions"}),children:"View sessions"}),children:"Viewers follow the workspace's shared sessions read-only and can't start sessions. Ask a workspace owner or admin for the member role."})}):a?n.jsx(ds,{}):r?n.jsx("div",{className:"new-session",children:n.jsx(we,{variant:"error",title:"Unable to load workspaces",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:l,children:"Retry"}),children:r})}):n.jsx("div",{className:"new-session",children:n.jsx(xt,{title:"Workspace not found",action:n.jsx(Ht,{variant:"ghost",href:Xe({name:"sessions"}),children:"View sessions"}),children:"You may no longer be a member of this workspace."})})}function sS({workspace:e}){const{user:i,refreshSessions:a}=pt(),r=`/api/workspaces/${oe(e.id)}`,l=$e(`${r}/models`),u=lo(`${r}/connectors`),d=av(e.id),[h]=N.useState(()=>J1(()=>localStorage,Vx)),[p]=N.useState(Y1),[m,x]=N.useState(""),y=V1(e.id),[v,b]=tf(y),[w,S]=N.useState("workspace"),[C,k]=N.useState(""),[O,T]=N.useState(!1),M=je(),_=N.useRef(null),$=l.data?.models,G=u.data?.connectors,J=N.useMemo(()=>{const Oe=new Set(($??[]).map(rt=>rt.connectorId));return(G??[]).filter(rt=>Oe.has(rt.id)&&!rt.revokedAt).sort((rt,vn)=>+(vn.ownerId===i.id)-+(rt.ownerId===i.id))},[G,$,i.id]),U=h.startsWith("model:")?$?.find(Oe=>Oe.id===h.slice(6)):void 0,E=J.find(Oe=>Oe.id===m)??J.find(Oe=>Oe.id===U?.connectorId)??J.find(Oe=>Oe.online)??J[0],I=E?.id??"",Q=Oe=>Oe&&E&&E.models.some(rt=>Zx(rt,Oe))?$?.find(rt=>rt.connectorId===E.id&&Zx(rt,Oe)):void 0,[ie,re]=N.useState(null),Y=Q(U)??E?.models.map(Oe=>Q(Oe)).find(Boolean),F=ie?.key===I?ie.value:q1(E,p,Y,Oe=>!!Q(Oe)),B=Q(F.model),se=!!(E&&E.ownerId!==i.id),de=!!(E?.online&&!E.revokedAt&&B&&(E.ownerId===i.id||E.workspaceIds.includes(e.id))),R=d.repositories,D=!!(R&&!d.error&&!d.loading&&(d.sourceCount||!d.required)),ee=!se||!!(E&&C===E.id),z=!!E?.hostSessions,X=z&&O,Se=!!(E?.capabilities.unsandboxed||X),ve=!!(B&&E&&de&&D&&ee&&!M.busy),Te=Bb(Ub(E),void 0,Ib(e.id,E)),Qe=N.useRef(!1);N.useEffect(()=>{k("")},[I,E?.ownerId,R]),N.useEffect(()=>{T(!1)},[I]),N.useLayoutEffect(()=>{const Oe=_.current;Oe&&(Oe.style.height="auto",Oe.style.height=`${Oe.scrollHeight}px`)},[v]);async function pe(Oe){if(Oe?.preventDefault(),!ve||!B||!E||Qe.current)return;const rt=v,vn=v.trim(),wn=Te.images,on=Te.files,Xn=Yb(E,F,"submit");if(Zb(Xn,Wb())&&(Qe.current=!0,!await Jh(E,Se).finally(()=>{Qe.current=!1}))){re({key:I,value:{...F,access:"approval"}});return}M.run(async()=>{const Mn=await Gb(wn),nn=(await ce("/api/sessions",{method:"POST",body:{workspaceId:e.id,modelId:B.id,title:tS(v,B.name),visibility:w,...se?{trustedConnectorId:E.id}:{},...X?{hostEnvironment:!0}:{}}})).session.id;if(eS(()=>localStorage,Vx,`model:${B.id}`),Qb(E,F),vn||Mn.length||on.length)try{const ms=await Te.upload(nn,E,on);await ce(`/api/sessions/${oe(nn)}/submit`,{method:"POST",body:{content:Hb(vn,ms),requestId:crypto.randomUUID(),...Xn?{options:Xn}:{},...Mn.length?{images:Mn}:{}}})}catch{oo(nn,vn),S1(nn,wn),C1(nn,on)}ef(y,rt),a(),xi({name:"session",sessionId:nn})})}const[Fe]=N.useState(()=>zb()),[Dt]=N.useState(()=>!Eb());function Kt(Oe){Fe&&Oe.key==="Enter"&&!Oe.shiftKey&&!Oe.nativeEvent.isComposing&&(Oe.preventDefault(),pe())}const yn=Xe({name:"settings",section:"workspaces",id:e.id});function yt(){if(d.error)return n.jsx(we,{variant:"warning",title:"Unable to load sources",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:d.refresh,children:"Retry"}),children:d.error});if(R&&!d.sourceCount&&d.required)return n.jsx(we,{variant:"warning",title:"No sources in this workspace",actions:n.jsx(Ht,{variant:"outline",size:"sm",href:yn,children:"Add a source"}),children:"Sessions need at least one source, such as a repository or a Notion page. Workspace owners and admins add them in workspace settings."});if(l.error)return n.jsx(we,{variant:"error",title:"Unable to load models",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:l.refresh,children:"Retry"}),children:l.error});if(!l.loading&&!u.loading&&!u.error&&!J.length)return n.jsx(we,{variant:"info",title:"No host to chat with yet",actions:n.jsx(Ht,{variant:"outline",size:"sm",href:Xe({name:"settings",section:"hosts"}),children:"Pair a host"}),children:"Pair your own Pi to chat with its models, or ask a workspace member to share their host here."});if(!E||u.loading||!$)return null;const Oe=n.jsx(q,{variant:"outline",size:"sm",onClick:u.refresh,children:"Refresh host status"});return u.error?n.jsx(we,{variant:"warning",title:"Unable to check host",actions:Oe,children:u.error}):B?de?se?n.jsx(we,{variant:"warning",title:`Hosted by ${E.ownerName}`,children:n.jsxs("label",{className:"check-row new-session-trust",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:C===E.id,disabled:M.busy,onChange:rt=>k(rt.target.checked?E.id:"")}),n.jsxs("span",{children:["I trust ",E.ownerName,"'s host (",E.name,") to process this session's prompts and repository files, including private repository snapshots; its operator can read them. Repository access uses my GitHub identity, not the host owner's or a workspace admin's. I remain the session owner."]})]})}):null:n.jsx(we,{variant:"warning",title:`${E.name} is unavailable`,actions:Oe,children:E.revokedAt?"This host was revoked.":E.online?"This host isn't shared with this workspace.":"It must reconnect before work can run."}):n.jsxs(we,{variant:"warning",title:`No model on ${E.name}`,actions:Oe,children:[E.name," offers no model you can use in this workspace."]})}const bn=[{label:"Workspace",icon:"globe",hint:"Members can view",onSelect:()=>S("workspace")},{label:"Private",icon:"lock",hint:"You, workspace admins and grants",onSelect:()=>S("private")}],Rn=[{label:"Sandbox",icon:"shield",hint:"Isolated, with the workspace's network access",onSelect:()=>T(!1)},{label:"On this host",icon:"server",hint:"No sandbox: runs as the host's user",onSelect:()=>T(!0)}];return n.jsxs("div",{className:"new-session",children:[n.jsxs("div",{className:"new-session-hero",children:[n.jsx("h1",{className:"new-session-title",children:"What should we work on?"}),n.jsxs("div",{className:"new-session-subtitle",children:[n.jsx(Is,{name:e.name,id:e.id}),n.jsx("span",{className:"truncate",children:e.name}),n.jsx(Ht,{variant:"ghost",size:"xs",href:yn,children:"Workspace settings"})]})]}),yt(),n.jsx("form",{className:"composer-card",onSubmit:pe,"aria-busy":M.busy,children:n.jsxs("fieldset",{disabled:M.busy,children:[n.jsx(Fb,{attachments:Te,disabled:M.busy}),n.jsx("textarea",{ref:_,className:"composer-input",rows:2,value:v,onChange:Oe=>b(Oe.target.value),onKeyDown:Kt,onPaste:Te.paste,placeholder:"Describe the task","aria-label":"First message",enterKeyHint:Fe?"send":"enter",autoFocus:Dt}),Te.notice&&n.jsx("p",{className:"composer-notice",role:"status",children:Te.notice}),n.jsxs("div",{className:"composer-toolbar",children:[n.jsx(qb,{attachments:Te,disabled:M.busy}),n.jsx(Xt,{label:"Host",placeholder:l.loading||u.loading?"Loading...":"Choose a host",disabled:!J.length,value:I,options:J.map(Oe=>({value:Oe.id,label:Oe.name,hint:Oe.ownerId===i.id?"Your host":`${Oe.ownerName}'s host`})),onChange:x}),n.jsx(ss,{label:"Visibility",align:"start",items:bn,trigger:n.jsxs(n.Fragment,{children:[n.jsx(be,{name:w==="workspace"?"globe":"lock",size:14}),w==="workspace"?"Workspace":"Private"]})}),z&&n.jsx(ss,{label:"Where it runs",align:"start",items:Rn,trigger:n.jsxs(n.Fragment,{children:[n.jsx(be,{name:X?"server":"shield",size:14}),X?"On host":"Sandbox"]})}),n.jsx(Qr,{label:"Who can see and do what",children:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:w==="workspace"?"Workspace members can view prompts, output, tool results, and repository content shown in the transcript. Collaborators can also send messages to it, and the workspace's owner and admins manage it; approving tool calls needs an explicit grant.":"Workspace membership alone does not give access to a private session: only the workspace's owner and admins, who manage every session, and people you give a session role open it."}),n.jsx("p",{children:"You are the session owner; the host owner is a separate role. Viewing never grants access to your Git accounts, and visibility does not share your Pi host or local models."})]})}),n.jsx(Jb,{host:E,value:F,onChange:Oe=>re({key:I,value:Oe}),owner:!0,showAccess:!0,unsandboxed:Se}),n.jsx("span",{className:"spacer"}),M.busy&&n.jsx($t,{children:"Preparing repositories..."}),n.jsx(q,{type:"submit",variant:"default",icon:"send",className:"composer-send","aria-label":"Start session",title:"Start session",disabled:!ve})]})]})}),n.jsx(ye,{error:M.error}),X&&E&&n.jsxs(we,{variant:"warning",title:se?`Runs on ${E.ownerName}'s host, without the sandbox`:"Runs on your host, without the sandbox",children:[se&&n.jsxs(n.Fragment,{children:[E.ownerName," granted you sessions on ",E.name,". "]}),"Its commands run on ",E.name," as its user, with its files, credentials, network and GPU, and no resource limits; the workspace's network access doesn't apply. Approve them as you would commands you run yourself: ",se?`people you share the session with can decide them only if they also hold host commands on ${E.name}.`:"people you share the session with can't decide them unless you granted them host commands."]}),n.jsx("div",{className:"new-session-meta",children:M.busy?n.jsx("span",{role:"status",children:"Resolving repository commits and downloading snapshots to the Pi host's private session cache. The agent starts once every repository is ready."}):n.jsxs(n.Fragment,{children:[E&&(u.loading||l.loading?n.jsx($t,{children:"Checking host..."}):n.jsxs(n.Fragment,{children:[n.jsx(co,{connector:E}),n.jsx("span",{children:E.name}),n.jsx("span",{children:"·"}),n.jsx("span",{children:B?.name}),n.jsx("span",{children:"·"}),n.jsxs("span",{children:[se?`Hosted by ${E.ownerName}`:"Your host",", ",E.workspaceIds.includes(e.id)?"shared with this workspace":"private"]}),n.jsx(Qr,{label:"Host and model details",children:n.jsxs("div",{className:"stack",children:[n.jsxs("p",{children:["Model: ",B?.name," ",n.jsxs("span",{className:"muted",children:[B?.provider," / ",B?.modelId]})]}),n.jsxs("p",{className:"muted small",children:["Host owner: ",n.jsx(nS,{workspaceId:e.id,ownerId:E.ownerId}),n.jsx("br",{}),"Connection ID: ",E.id]}),n.jsx("p",{children:"This creates a new session, not access to the host's personal Pi history or old sessions. Your Git account credentials are not sent to the host; model credentials stay on it."})]})})]})),d.loading?n.jsx($t,{children:"Loading repositories..."}):R&&R.length>0&&n.jsxs(n.Fragment,{children:[E&&n.jsx("span",{children:"·"}),n.jsx("span",{children:R.length===1?"1 repository":`${R.length} repositories`}),n.jsx(Qr,{label:"Repositories for this session",children:n.jsxs("div",{className:"stack",children:[n.jsx("ul",{children:R.map(Oe=>n.jsxs("li",{children:[n.jsx("strong",{children:Oe.fullName})," ",n.jsxs("span",{className:"muted",children:["at ",n.jsx("code",{children:Oe.ref})]})]},Oe.id))}),n.jsx("p",{children:"Repository access uses your connected Git account as session owner, not the host owner's or an admin's. The agent clones the repositories it needs with Git as it works; where it can't run shell commands, the session starts with an empty worktree."}),n.jsx(af,{})]})}),n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",onClick:d.refresh})]})]})}),E&&!M.busy&&n.jsx(cc,{connector:E})]})}function lv(e){return e.sessionId?`/#/s/${encodeURIComponent(e.sessionId)}`:"/#/settings/notifications"}function Ql(e){const i=Zi();return i?.notify?{kind:"desktop"}:i?{kind:"unsupported",reason:"Update the Pikibun app to get notifications here."}:typeof window>"u"||!("Notification"in window)?{kind:"unsupported",reason:"This browser can't show notifications."}:e&&window.isSecureContext&&"serviceWorker"in navigator&&"PushManager"in window?{kind:"push"}:{kind:"page"}}const dc=e=>`pikibun.notifications.${e}`,qa=e=>`pikibun.notificationDevice.${e}`;function hc(e){try{return localStorage.getItem(e)}catch{return null}}function Fa(e,i){try{i===null?localStorage.removeItem(e):localStorage.setItem(e,i)}catch{}}const vh=new Set;function rf(){for(const e of vh)e()}function iS(e){vh.add(e);const i=a=>{a.key?.startsWith("pikibun.notification")&&e()};return window.addEventListener("storage",i),()=>{vh.delete(e),window.removeEventListener("storage",i)}}function aS(e){return hc(dc(e))!=="on"?!1:Zi()?.notify?!0:typeof Notification<"u"&&Notification.permission==="granted"}function cv(e){return N.useSyncExternalStore(iS,()=>aS(e),()=>!1)}function rS(){const e=navigator.userAgent,i=/Edg\//.test(e)?"Edge":/Firefox\//.test(e)?"Firefox":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)?"Safari":"Browser",a=/iPhone|iPad/.test(e)?"iOS":/Android/.test(e)?"Android":/Mac OS X/.test(e)?"macOS":/Windows/.test(e)?"Windows":/Linux/.test(e)?"Linux":"";return a?`${i} on ${a}`:i}function oS(e){const i=e.replace(/-/g,"+").replace(/_/g,"/"),a=atob(i+"=".repeat((4-i.length%4)%4));return Uint8Array.from(a,r=>r.charCodeAt(0))}function lS(e,i){if(!e)return!1;const a=new Uint8Array(e);return a.length===i.length&&a.every((r,l)=>r===i[l])}async function uv(e,i){const a=await navigator.serviceWorker.register("/sw.js");await navigator.serviceWorker.ready;const r=oS(i);let l=await a.pushManager.getSubscription();l&&!lS(l.options.applicationServerKey,r)&&(await l.unsubscribe(),l=null),l??=await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r});const{endpoint:u,keys:d}=l.toJSON(),{device:h}=await ce("/api/notifications/devices",{method:"POST",body:{kind:"web",endpoint:u,keys:{p256dh:d?.p256dh,auth:d?.auth},name:rS()}});return Fa(qa(e),h.id),h}async function cS(e,i){const a=Ql(i.webPushKey);if(a.kind==="unsupported")throw new Error(a.reason);if(a.kind!=="desktop"){const r=Notification.permission==="granted"?"granted":await Notification.requestPermission();if(r!=="granted")throw new Error(r==="denied"?"This browser blocks notifications from Pikibun. Allow them in the site's settings (the icon beside the address), then try again.":"Notifications weren't allowed.")}return a.kind==="push"&&await uv(e,i.webPushKey),Fa(dc(e),"on"),rf(),a}async function dv(){await(await("serviceWorker"in navigator?await navigator.serviceWorker.getRegistration("/sw.js").catch(()=>{}):void 0)?.pushManager?.getSubscription().catch(()=>null))?.unsubscribe().catch(()=>!1)}async function Xx(e){Fa(dc(e),null),rf();try{const i=hc(qa(e));i&&(await ce(`/api/notifications/devices/${oe(i)}`,{method:"DELETE"}).catch(a=>{if(!(a instanceof Pn&&a.status===404))throw a}),Fa(qa(e),null))}finally{await dv()}}function uS(e){return hc(qa(e))}function dS(e){return!!e.sessionId&&document.visibilityState==="visible"&&document.hasFocus()&&window.location.hash===lv(e).slice(1)}function hS(e){if(dS(e))return;const i=lv(e),a=Zi();if(a?.notify){a.notify({title:e.title,body:e.body,path:i,tag:e.id}).catch(()=>{});return}if(Notification.permission!=="granted")return;const r=new Notification(e.title,{body:e.body,tag:e.id,icon:"/favicon.svg"});r.onclick=()=>{window.focus(),window.location.hash=i.slice(1),r.close()}}const fS=2e4;function mS(e){const i=cv(e);N.useEffect(()=>{if(!i)return;let a=!1,r,l;const u=h=>{const p=h.data;p?.type==="pikibun-open"&&typeof p.path=="string"&&p.path.startsWith("/#/")&&(window.location.hash=p.path.slice(1))};"serviceWorker"in navigator&&navigator.serviceWorker.addEventListener("message",u);const d=async()=>{try{const h=await ce(`/api/notifications/feed${l?`?after=${encodeURIComponent(l)}`:""}`);if(a)return;if(l)for(const p of h.notifications)hS(p);l=h.cursor}catch{}a||(r=window.setTimeout(()=>{d()},fS))};return(async()=>{let h;try{const p=await ce("/api/notifications/config");h=Ql(p.webPushKey);const m=hc(qa(e));if(h.kind==="push"&&m&&!p.devices.some(x=>x.id===m)){Fa(qa(e),null),Fa(dc(e),null),rf(),await dv();return}h.kind==="push"&&await uv(e,p.webPushKey)}catch{h=Ql(null)}!a&&h.kind!=="push"&&h.kind!=="unsupported"&&d()})(),()=>{a=!0,window.clearTimeout(r),"serviceWorker"in navigator&&navigator.serviceWorker.removeEventListener("message",u)}},[i,e])}async function pS(e,i){const a=await fetch(e,{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(i)});if(a.ok)return;const r=await a.json().catch(()=>null);throw new Error(typeof r?.error=="string"?r.error:`Sign-in failed (HTTP ${a.status}). Try again.`)}function gS({signedIn:e,signup:i,inviteToken:a}){const r=i==="open"||i==="invite"&&a!==void 0,[l,u]=N.useState("signin"),[d,h]=N.useState(""),[p,m]=N.useState(""),[x,y]=N.useState(""),[v,b]=N.useState(!1),[w,S]=N.useState(""),C=l==="signup";function k(T){if(T.preventDefault(),C&&p!==x){S("The passwords don't match.");return}b(!0),S("");const M={username:d,password:p};C&&a!==void 0&&(M.inviteToken=a),pS(C?"/api/auth/password/signup":"/api/auth/password/login",M).then(e,_=>{S(_ instanceof Error?_.message:"Sign-in failed. Try again."),b(!1)})}function O(){u(C?"signin":"signup"),S(""),y("")}return n.jsxs("form",{className:"password-sign-in",onSubmit:k,children:[n.jsx(xe,{label:"Username",hint:C?"3 to 39 letters, digits, - and _. Your user ID is password: and this name; it can't be changed.":void 0,children:n.jsx("input",{className:"input",required:!0,value:d,onChange:T=>h(T.target.value),autoComplete:"username",autoCapitalize:"none",spellCheck:!1,maxLength:60})}),n.jsx(xe,{label:"Password",hint:C?"At least 12 characters. A few unrelated words make a good one.":void 0,children:n.jsx("input",{className:"input",type:"password",required:!0,value:p,onChange:T=>m(T.target.value),autoComplete:C?"new-password":"current-password",minLength:C?12:1,maxLength:256})}),C&&n.jsx(xe,{label:"Confirm password",children:n.jsx("input",{className:"input",type:"password",required:!0,value:x,onChange:T=>y(T.target.value),autoComplete:"new-password",maxLength:256})}),n.jsx(ye,{error:w}),n.jsx(q,{type:"submit",variant:"default",size:"lg",block:!0,disabled:v,children:v?C?"Creating account...":"Signing in...":C?"Create account":"Sign in"}),r&&n.jsx(q,{variant:"ghost",size:"sm",onClick:O,disabled:v,children:C?"Have an account? Sign in":"New here? Create an account"}),C&&a!==void 0&&n.jsx("p",{className:"field-hint",children:"Creating an account asks to join the workspace that invited you. An owner or admin accepts you before you can see anything in it."})]})}function of({open:e,onClose:i}){const{refreshWorkspaces:a,selectWorkspace:r}=pt(),[l,u]=N.useState(""),d=je();function h(p){p.preventDefault(),!(d.busy||!l.trim())&&d.run(async()=>{const m=await ce("/api/workspaces",{method:"POST",body:{name:l.trim()}});u(""),a(),r(m.workspace.id),i(),xi({name:"new",workspaceId:m.workspace.id})})}return n.jsx(qt,{open:e,title:"New workspace",onClose:()=>{d.busy||i()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:d.busy,onClick:i,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"new-workspace-form",disabled:d.busy||!l.trim(),children:d.busy?"Creating...":"Create workspace"})]}),children:n.jsxs("form",{id:"new-workspace-form",className:"stack",onSubmit:h,children:[n.jsx(xe,{label:"Name",hint:"A shared home for repositories, people, agents and sessions",children:n.jsx("input",{className:"input",required:!0,autoFocus:!0,maxLength:120,value:l,onChange:p=>u(p.target.value),placeholder:"The field studio"})}),n.jsx(ye,{error:d.error})]})})}const kt="[redacted]",xS=/^[A-Za-z0-9._~+/=:@%^!#,-]+$/,yS=/^(?:\$\{?[A-Za-z_]|\{\{|\{%|%\(|<[^<>]*>$|\*+$|x{3,}$|\.{3}$|\u2026$|your[_-]|(?:null|none|nil|undefined|true|false|empty)$)/i;function Hi(e,i){return!!e&&!e.includes(kt)&&!yS.test(e)&&(!i.command||xS.test(e))}function Qx(e){return e.length>=6&&(/^\d+$/.test(e)||/\d/.test(e)&&/[A-Za-z]/.test(e)||/[!@#%^*~]/.test(e)||/^[0-9a-f]{16,}$/i.test(e))}const bS=new Set(["string","text","number","integer","float","double","boolean","bytes","buffer","object","unknown","never","char","varchar","null","none","undefined","true","false","enabled","disabled","required","optional","invalid","valid","incorrect","correct","wrong","missing","empty","blank","expired","hidden","masked","redacted","sensitive","case-sensitive","stored","saved","encrypted","hashed","salted","protected","changed","reset","needed","necessary","mandatory","unset","weak","strong","long","short","ready","same","different","given","provided","supplied","generated","random","unique","default","allowed","accepted","rejected","denied","locked","unlocked","visible","shown","cleared","removed","deleted","updated","unchanged","secure","insecure","safe","unsafe","known","special","important","plain","plaintext","ciphertext","encoded","decoded","password","passwords","passwd","passphrase","pass","secret","token","value","values","credential","credentials","hash","input","data","body","form","user","args","params","options","config","field","entry","item","result","response","request","payload","answer","prompt","match"]);function vS(e){return/^[A-Za-z][A-Za-z-]{3,63}$/.test(e)&&!/^[a-z]+[A-Z]|^[A-Z][a-z]+[A-Z]/.test(e)&&!bS.has(e.toLowerCase())}function wS(e,i){let a=i;for(;e[a]===" "||e[a]===" ";)a++;const r=e[a]??"";return r===`
|
|
18
|
+
`||r==="\r"?"":r}const El=/-----BEGIN ((?:[A-Z0-9]{1,16} ){0,4})PRIVATE KEY( BLOCK)?-----/g,Hd=/(?:Proc-Type|DEK-Info|Version|Comment|Hash|Charset): [^\r\n\\]{0,256}/y,jS=/^(?:\r?\n|\\r\\n|\\n)/,kS=/(?:\r?\n|\\r\\n|\\n)[ \t]*$/;function SS(e){if(!e.includes("PRIVATE KEY"))return e;let i="",a=0;El.lastIndex=0;for(let r=El.exec(e);r;r=El.exec(e)){const l=r.index+r[0].length,u=`-----END ${r[1]}PRIVATE KEY${r[2]??""}-----`,d=Math.min(e.length,l+65536);let h=l,p=0,m=!0,x=!1;for(;h<d;){if(e.startsWith(u,h)){x=!0;break}const y=e[h];if(y===`
|
|
19
|
+
`||y==="\r"){h++,m=!0;continue}if(y==="\\"&&(e[h+1]==="n"||e[h+1]==="r")){h+=2,m=!0;continue}if((y===" "||y===" ")&&m){h++;continue}if(m&&(Hd.lastIndex=h,Hd.test(e))){h=Hd.lastIndex,m=!1;continue}if(/[A-Za-z0-9+/=]/.test(y)){h++,p++,m=!1;continue}break}if(p&&(x||p>=16)){const y=e.slice(l,h);i+=e.slice(a,l)+(jS.exec(y)?.[0]??"")+kt+(kS.exec(y)?.[0]??""),a=h}El.lastIndex=x?h+u.length:Math.max(h,l)}return i+e.slice(a)}const CS=String.raw`pass(?:word|wd|phrase)|secret|token|api[_-]?key|(?:access|secret|private|auth|account|encryption|signing|master|session)[_-]?key`,AS=/pass|secret|token|key/i,NS=String.raw`"((?:[^"\\\n\x60$]|\\[^\n]){1,8192})"|'([^'\n]{1,8192})'|\\"((?:[^"\\\n\x60$]|\\[^"\n]){1,8192})\\"`,TS=String.raw`([^\s'"\x60,;&|<>(){}\[\]$\\=][^\s'"\x60,;&|<>(){}\[\]$\\]{0,1023})`,ES=new RegExp(String.raw`(${CS})((?:\\?["'])?)([ \t]{0,16}(?::=|=>|[:=])[ \t]{0,16}|[ \t]{1,16}(?:is|was)[ \t]{1,16})(?:${NS}|${TS})`,"gi"),zS=/^[ \t]+(?:is|was)[ \t]+$/i;function OS(e,i){return e.replace(ES,(a,r,l,u,d,h,p,m,x)=>{let y=d??h??p??m??"",v="";if(m===void 0){if(/^\s|\s$/.test(y))return a}else{/[^.]\.$/.test(y)&&(y=y.slice(0,-1),v=".");const w=wS(e,x+a.length);if(u==="="){if(/[),}\]]/.test(w)?!Qx(y):/^\d{1,5}$/.test(y))return a}else{const S=zS.test(u);if(!S&&/[;,)}\]|<>({[=?:&]/.test(w))return a;const C=v!==""||w===""||(S?/[.!?,;)"']/.test(w):w==="#");if(!Qx(y)&&!(/^pass/i.test(r)&&C&&vS(y)))return a}}if(!Hi(y,i))return a;const b=d!==void 0?`"${kt}"`:h!==void 0?`'${kt}'`:p!==void 0?`\\"${kt}\\"`:kt+v;return r+l+u+b})}const RS=new RegExp(String.raw`(--(?:[A-Za-z0-9]{1,32}-){0,4}(?:pass(?:word|wd|phrase)|secret|token|api-?key|(?:access|secret|private|auth)-key))([ \t]{1,16})(?:"([^"\\\n\x60$]{1,1024})"|'([^'\n]{1,1024})'|([^\s'"\x60,;&|<>(){}\[\]$\\-][^\s'"\x60,;&|<>(){}\[\]$\\]{0,1023}))`,"gi");function MS(e,i){return e.includes("--")?e.replace(RS,(a,r,l,u,d,h)=>Hi(u??d??h??"",i)?r+l+(u!==void 0?`"${kt}"`:d!==void 0?`'${kt}'`:kt):a):e}const DS=/(\bcurl\b[^\n]{0,2048}?[ \t])(-u|--user)([ \t]{1,16}|=)(["']?)([^\s:'"\x60;&|<>(){}$\\]{1,256}):([^\s'"\x60;&|<>(){}$\\]{1,1024})\4(?![^\s])/g,LS=/\b(machine[ \t\r\n]{1,64}[^\s]{1,253}[ \t\r\n]{1,64}(?:login[ \t\r\n]{1,64}[^\s]{1,253}[ \t\r\n]{1,64})?password[ \t\r\n]{1,64})([^\s]{1,1024})/g,_S=/\b((?:proxy-)?authorization["']?[ \t]{0,16}[:=][ \t]{0,16}["']?(?:bearer|basic|token|bot|digest|negotiate|apikey|sso-key)[ \t]{1,16})([A-Za-z0-9._~+/=:-]{1,4096})/gi,$S=/\b(bearer[ \t]{1,16})([A-Za-z0-9._~+/-]{16,4096}=*)(?![A-Za-z0-9._~+/=-])/gi,US=/\b([a-z][a-z0-9+.-]{1,30}:\/\/[^\s:/@?#'"<>[\]]{0,256}:)([^\s@/?#'"<>[\]]{1,1024})(?=@)/gi;function IS(e,i){let a=e;return a.includes("curl")&&(a=a.replace(DS,(r,l,u,d,h,p,m)=>/^\d+$/.test(p)&&/^\d+$/.test(m)||!Hi(m,i)?r:`${l}${u}${d}${h}${p}:${kt}${h}`)),a.includes("machine")&&(a=a.replace(LS,(r,l,u)=>Hi(u,i)?l+kt:r)),/bearer|authorization|basic|token|digest|negotiate|apikey|sso-key|bot/i.test(a)&&(a=a.replace(_S,(r,l,u)=>Hi(u,i)?l+kt:r),a=a.replace($S,(r,l,u)=>/\d/.test(u)&&Hi(u,i)?l+kt:r)),a.includes("://")&&(a=a.replace(US,(r,l,u)=>Hi(u,i)?l+kt:r)),a}const BS=[{pattern:new RegExp("(?<![A-Za-z0-9_])(gh[pousr]_)([A-Za-z0-9]{36,251})(?![A-Za-z0-9_])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(github_pat_)([A-Za-z0-9_]{22,255})(?![A-Za-z0-9_])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(gl(?:pat|dt|rt|ptt|cbt|imt|soat|agent|oas|ffct|ft)-)([A-Za-z0-9_.-]{20,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(xox[abposr]-)([A-Za-z0-9-]{10,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(xapp-)([A-Za-z0-9-]{10,255})","g")},{pattern:/(https:\/\/hooks\.slack\.com\/(?:services|workflows|triggers)\/)([A-Za-z0-9/_-]{16,255})/g},{pattern:/(https:\/\/(?:ptb\.|canary\.)?discord(?:app)?\.com\/api\/webhooks\/[0-9]{1,30}\/)([A-Za-z0-9_-]{20,255})/g},{pattern:new RegExp("(?<![A-Za-z0-9])(AKIA|ASIA|ABIA|ACCA)([A-Z0-9]{16})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(sk-(?:proj-|ant-(?:api|admin)[0-9]{2}-|svcacct-|admin-)?)([A-Za-z0-9_-]{20,255})","g"),digit:!0},{pattern:new RegExp("(?<![A-Za-z0-9_-])(AIza)([0-9A-Za-z_-]{35})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(GOCSPX-)([A-Za-z0-9_-]{28})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])((?:sk|rk)_(?:live|test)_)([A-Za-z0-9]{10,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(whsec_)([A-Za-z0-9+/=]{20,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(npm_)([A-Za-z0-9]{36})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_-])(pypi-)([A-Za-z0-9_-]{50,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(hf_)([A-Za-z0-9]{30,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(SG\\.)([A-Za-z0-9_-]{22}\\.[A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(shp(?:at|ca|pa|ss)_)([a-fA-F0-9]{32})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(do[opr]_v1_)([a-f0-9]{64})(?![A-Za-z0-9])","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(hv[sb]\\.)([A-Za-z0-9_-]{24,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_.-])(dp\\.(?:pt|st|sa|ct|scim|audit)\\.)([A-Za-z0-9]{40,255})","g")},{pattern:new RegExp("(?<![A-Za-z0-9_])(lin_api_)([A-Za-z0-9]{40})(?![A-Za-z0-9])","g")}],HS=/gh[pousr]_|github_pat_|gl[a-z]{1,5}-|xox[abposr]-|xapp-|hooks\.slack\.com|discord(?:app)?\.com|A(?:KIA|SIA|BIA|CCA)|sk-|AIza|GOCSPX-|[sr]k_(?:live|test)_|whsec_|npm_|pypi-|hf_|SG\.|shp(?:at|ca|pa|ss)_|do[opr]_v1_|hv[sb]\.|dp\.|lin_api_/,qS=new RegExp("(?<![A-Za-z0-9_-])eyJ[A-Za-z0-9_-]{8,1024}\\.eyJ[A-Za-z0-9_-]{8,8192}\\.[A-Za-z0-9_-]{8,1024}(?![A-Za-z0-9_-])","g"),FS=/(#\/shared\/)([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/g;function GS(e){let i=e;if(HS.test(i))for(const{pattern:a,digit:r}of BS)i=i.replace(a,(l,u,d)=>r&&!/\d/.test(d)?l:u+kt);return i.includes("eyJ")&&(i=i.replace(qS,kt)),i.includes("#/shared/")&&(i=i.replace(FS,`$1${kt}`)),i}function PS(e,i={}){if(typeof e!="string"||!e)return e;let a=i.command?e:SS(e);return a=IS(a,i),AS.test(a)&&(a=MS(OS(a,i),i)),GS(a)}function wh(e){return JSON.stringify(e??"").includes(kt)}const YS=/^([a-z_]+)\(\{.*\}\)$/s,VS=/^ {0,3}(`{3,}|~{3,})(.*)$/s;function ZS(e){const i=[];let a="";for(const r of e.split(`
|
|
20
|
+
`)){const l=VS.exec(r);if(a){l&&l[1][0]===a[0]&&l[1].length>=a.length&&!l[2].trim()&&(a=""),i.push({line:r});continue}if(l&&!(l[1][0]==="`"&&l[2].includes("`"))){a=l[1],i.push({line:r});continue}const u=YS.exec(r);i.push(u?{line:r,tool:u[1]}:{line:r})}return i}function fc(e){const i=[],a=[];for(const{line:r,tool:l}of ZS(e))l!==void 0?a.push({name:l,line:r}):i.push(r);return{prose:i.join(`
|
|
21
|
+
`),calls:a}}const XS=/^\d{1,15}:\d{1,15}$/;function QS(e){if(XS.test(e.id)){if(e.role==="user")return{entryId:e.id,before:!0};if(!(e.role!=="assistant"||fc(e.text).calls.length>0))return{entryId:e.id,before:!1}}}function KS(e){return e.rewindable===!0}const WS=/^\[image [^\s\]]+\]$/;function Kx(e){return e.text.split(`
|
|
22
|
+
`).filter(i=>!WS.test(i)).join(`
|
|
23
|
+
`).trim()}function JS(e){return e.role==="assistant"?fc(e.text).prose.trim():e.text}const jh={size:50},eC={entries:e=>e.id,approvals:e=>e.id,conversations:e=>e.id,queue:e=>e.submissionId},qd=Object.keys(eC),tC=["entries","approvals","conversations"],Wx={items:2e5},nC=/^[0-9a-f]{32}$/;function Jx(e){return typeof e=="string"&&nC.test(e)}function sC(e){const{entries:i,approvals:a,conversations:r,queue:l,...u}=e;return{fields:u,lists:{entries:i,approvals:a,conversations:r,queue:l}}}function iC(e,i){if(!Array.isArray(i)||i.length>Wx.items)throw new Error("Invalid list patch");const a=[];let r=0;for(const l of i){if(typeof l=="number"){if(!Number.isSafeInteger(l)||l===0||r+Math.abs(l)>e.length)throw new Error("Invalid list patch");if(l>0)for(const u=r+l;r<u;r++)a.push(e[r]);else r-=l}else if(l&&typeof l=="object"&&!Array.isArray(l))a.push(l);else throw new Error("Invalid list patch");if(a.length>Wx.items)throw new Error("Invalid list patch")}return a}function hv(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const i=e;return!Jx(i.base)||!Jx(i.revision)?!1:i.base===i.revision?i.view===void 0&&i.lists===void 0:!!i.view&&typeof i.view=="object"&&!Array.isArray(i.view)&&!!i.lists&&typeof i.lists=="object"&&!Array.isArray(i.lists)}function aC(e,i){if(!hv(i))throw new Error("Invalid view patch");if(i.base===i.revision)return e;const a=i.lists,r=i.view;if(qd.some(d=>Object.hasOwn(r,d))||Object.keys(a).some(d=>!qd.includes(d)))throw new Error("Invalid view patch");const l=sC(e),u={...r};for(const d of qd)a[d]!==void 0&&(u[d]=iC(l.lists[d]??[],a[d]));if(tC.some(d=>!Array.isArray(u[d])))throw new Error("Invalid view patch");return u}function kh(e,i){return(e?.entries??[]).filter(a=>a.conversationId===i)}function rC(e,i,a){const r=new Map;for(const l of a.conversations??[]){const u=l.olderEntries??0;if(u<=0||!l.previousEntryId)continue;const d=kh(i,l.id),h=kh(a,l.id)[0]?.id,p=d.findIndex(y=>y.id===h),m=p<0?d:d.slice(0,p),x=[...e.get(l.id)??[],...m];!x.length||x.length>u||x.at(-1).id!==l.previousEntryId||r.set(l.id,x)}return r}function ey(e,i){if(!i.size)return e;const a=[],r=new Set;for(const l of e.entries){const u=l.conversationId,d=u===void 0?void 0:i.get(u);u!==void 0&&d&&!r.has(u)&&(a.push(...d),r.add(u)),a.push(l)}return{...e,entries:a,conversations:e.conversations.map(l=>{const u=i.get(l.id);if(!u)return l;const{olderEntries:d,previousEntryId:h,...p}=l,m=(l.olderEntries??0)-u.length;return m>0?{...p,olderEntries:m}:p})}}function ty(e,i,a){return i.get(a)?.[0]?.id??kh(e,a)[0]?.id}const Kl=["queued","admitting","running"],Br={activeReopenMs:1e3,idleReopenMs:1e4,firstBackoffMs:2e3,maxBackoffMs:6e4,accessCheckMs:3e4};function oC(e,i,a){const r=new AbortController,l=`/api/sessions/${oe(e)}`;let u=null,d=()=>{},h=0,p=!1,m=!1,x=!1,y,v=!1,b=null,w,S=new Map;const C=new Map,k=()=>!v&&!r.signal.aborted;function O(I,Q){S=rC(S,b,I),b=I,w=typeof Q=="string"?Q:void 0,p=I.busy||(I.queue??[]).some(ie=>Kl.includes(ie.status))||I.repositories?.status==="preparing",i.view(ey(I,S)),i.error("")}async function T(I){const Q=b,re=(Q?.conversations?.find(B=>B.id===I)?.olderEntries??0)-(S.get(I)?.length??0),Y=Q&&ty(Q,S,I);if(!k()||!Q||re<=0||!Y)return;const F=`conversation=${encodeURIComponent(I)}&before=${encodeURIComponent(Y)}&limit=${jh.size}`;try{const B=await a.api(`${l}/entries?${F}`,{signal:r.signal});if(!k()||!b||ty(b,S,I)!==Y||!Array.isArray(B?.entries))return;const se=S.get(I)??[],de=new Map(S);de.set(I,[...B.entries,...se]),S=de,i.view(ey(b,S))}catch(B){k()&&i.error(On(B))}}function M(){u?.close(),u=null}function _(){v=!0,b=null,w=void 0,S=new Map,M(),d(),i.session(null),i.view(null),i.status("offline")}async function $(I){if(!k())return;if(x){y=y===!0||I;return}x=!0;let Q=!0;try{const ie=await a.api(l,{signal:r.signal});if(Q=!1,!k()||(i.session(ie.session),!I))return;const re=await a.api(`${l}/view`,{signal:r.signal});k()&&O(re.view,re.revision)}catch(ie){if(!k())return;i.error(On(ie)),Q&&ie instanceof Pn&&[401,403,404].includes(ie.status)&&_()}finally{if(x=!1,y!==void 0&&k()){const ie=y;y=void 0,$(ie)}}}function G(I){if(d(),!k()||a.hidden())return;const Q=setTimeout(J,I);d=()=>clearTimeout(Q)}function J(){if(d(),!k()||a.hidden()||u)return;const I=a.openEvents(`${l}/events?since=${w??""}`);u=I;let Q=!1;const ie=(re,Y)=>{Q=!0,h=0,i.status("online"),O(re,Y)};I.addEventListener("view",re=>{if(u!==I||!k())return;let Y;try{Y=JSON.parse(String(re.data))}catch{return}Y?.view&&ie(Y.view,Y.revision)}),I.addEventListener("patch",re=>{if(u!==I||!k())return;let Y;try{Y=JSON.parse(String(re.data))?.patch}catch{return}if(!hv(Y)||!b||Y.base!==w){w=void 0;return}let F;try{F=aC(b,Y)}catch{w=void 0;return}ie(F,Y.revision)}),I.addEventListener("error",()=>{if(u!==I||(M(),!k()))return;const re=m;if(m=!1,Q)return G(p||re?Br.activeReopenMs:Br.idleReopenMs);h++,i.status("reconnecting"),$(!0),G(Math.min(Br.maxBackoffMs,Br.firstBackoffMs*2**(h-1)))})}const U=a.onVisibilityChange(()=>{if(k()){if(a.hidden()){d(),M();return}$(!1),J()}}),E=setInterval(()=>{a.hidden()||$(!1)},Br.accessCheckMs);return $(!0).then(J),{refresh(){$(!1),u?m=!0:J()},loadOlder(I){let Q=C.get(I);return Q||(Q=T(I).finally(()=>C.delete(I)),C.set(I,Q)),Q},stop(){r.abort(),M(),d(),clearInterval(E),U()}}}const lC={api:ce,openEvents:e=>new EventSource(e,{withCredentials:!0}),hidden:()=>document.hidden,onVisibilityChange(e){return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)}};function cC(e,i){return oC(e,i,lC)}function uC(e,i){const a={};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}const dC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fC={};function ny(e,i){return(fC.jsx?hC:dC).test(e)}const mC=/[ \t\n\f\r]/g;function pC(e){return typeof e=="object"?e.type==="text"?sy(e.value):!1:sy(e)}function sy(e){return e.replace(mC,"")===""}class uo{constructor(i,a,r){this.normal=a,this.property=i,r&&(this.space=r)}}uo.prototype.normal={};uo.prototype.property={};uo.prototype.space=void 0;function fv(e,i){const a={},r={};for(const l of e)Object.assign(a,l.property),Object.assign(r,l.normal);return new uo(a,r,i)}function Sh(e){return e.toLowerCase()}class xn{constructor(i,a){this.attribute=a,this.property=i}}xn.prototype.attribute="";xn.prototype.booleanish=!1;xn.prototype.boolean=!1;xn.prototype.commaOrSpaceSeparated=!1;xn.prototype.commaSeparated=!1;xn.prototype.defined=!1;xn.prototype.mustUseProperty=!1;xn.prototype.number=!1;xn.prototype.overloadedBoolean=!1;xn.prototype.property="";xn.prototype.spaceSeparated=!1;xn.prototype.space=void 0;let gC=0;const _e=Xi(),Rt=Xi(),Ch=Xi(),me=Xi(),dt=Xi(),Pi=Xi(),zn=Xi();function Xi(){return 2**++gC}const Ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:_e,booleanish:Rt,commaOrSpaceSeparated:zn,commaSeparated:Pi,number:me,overloadedBoolean:Ch,spaceSeparated:dt},Symbol.toStringTag,{value:"Module"})),Fd=Object.keys(Ah);class lf extends xn{constructor(i,a,r,l){let u=-1;if(super(i,a),iy(this,"space",l),typeof r=="number")for(;++u<Fd.length;){const d=Fd[u];iy(this,Fd[u],(r&Ah[d])===Ah[d])}}}lf.prototype.defined=!0;function iy(e,i,a){a&&(e[i]=a)}function Ga(e){const i={},a={};for(const[r,l]of Object.entries(e.properties)){const u=new lf(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),i[r]=u,a[Sh(r)]=r,a[Sh(u.attribute)]=r}return new uo(i,a,e.space)}const mv=Ga({properties:{ariaActiveDescendant:null,ariaAtomic:Rt,ariaAutoComplete:null,ariaBusy:Rt,ariaChecked:Rt,ariaColCount:me,ariaColIndex:me,ariaColSpan:me,ariaControls:dt,ariaCurrent:null,ariaDescribedBy:dt,ariaDetails:null,ariaDisabled:Rt,ariaDropEffect:dt,ariaErrorMessage:null,ariaExpanded:Rt,ariaFlowTo:dt,ariaGrabbed:Rt,ariaHasPopup:null,ariaHidden:Rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dt,ariaLevel:me,ariaLive:null,ariaModal:Rt,ariaMultiLine:Rt,ariaMultiSelectable:Rt,ariaOrientation:null,ariaOwns:dt,ariaPlaceholder:null,ariaPosInSet:me,ariaPressed:Rt,ariaReadOnly:Rt,ariaRelevant:null,ariaRequired:Rt,ariaRoleDescription:dt,ariaRowCount:me,ariaRowIndex:me,ariaRowSpan:me,ariaSelected:Rt,ariaSetSize:me,ariaSort:null,ariaValueMax:me,ariaValueMin:me,ariaValueNow:me,ariaValueText:null,role:null},transform(e,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function pv(e,i){return i in e?e[i]:i}function gv(e,i){return pv(e,i.toLowerCase())}const xC=Ga({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pi,acceptCharset:dt,accessKey:dt,action:null,allow:null,allowFullScreen:_e,allowPaymentRequest:_e,allowUserMedia:_e,alpha:_e,alt:null,as:null,async:_e,autoCapitalize:null,autoComplete:dt,autoFocus:_e,autoPlay:_e,blocking:dt,capture:null,charSet:null,checked:_e,cite:null,className:dt,closedBy:null,colorSpace:null,cols:me,colSpan:me,command:null,commandFor:null,content:null,contentEditable:Rt,controls:_e,controlsList:dt,coords:me|Pi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_e,defer:_e,dir:null,dirName:null,disabled:_e,download:Ch,draggable:Rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_e,formTarget:null,headers:dt,height:me,hidden:Ch,high:me,href:null,hrefLang:null,htmlFor:dt,httpEquiv:dt,id:null,imageSizes:null,imageSrcSet:null,inert:_e,inputMode:null,integrity:null,is:null,isMap:_e,itemId:null,itemProp:dt,itemRef:dt,itemScope:_e,itemType:dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_e,low:me,manifest:null,max:null,maxLength:me,media:null,method:null,min:null,minLength:me,multiple:_e,muted:_e,name:null,nonce:null,noModule:_e,noValidate:_e,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_e,optimum:me,pattern:null,ping:dt,placeholder:null,playsInline:_e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_e,referrerPolicy:null,rel:dt,required:_e,reversed:_e,rows:me,rowSpan:me,sandbox:dt,scope:null,scoped:_e,seamless:_e,selected:_e,shadowRootClonable:_e,shadowRootCustomElementRegistry:_e,shadowRootDelegatesFocus:_e,shadowRootMode:null,shadowRootSerializable:_e,shape:null,size:me,sizes:null,slot:null,span:me,spellCheck:Rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:me,step:null,style:null,tabIndex:me,target:null,title:null,translate:null,type:null,typeMustMatch:_e,useMap:null,value:Rt,width:me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dt,axis:null,background:null,bgColor:null,border:me,borderColor:null,bottomMargin:me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_e,declare:_e,event:null,face:null,frame:null,frameBorder:null,hSpace:me,leftMargin:me,link:null,longDesc:null,lowSrc:null,marginHeight:me,marginWidth:me,noResize:_e,noHref:_e,noShade:_e,noWrap:_e,object:null,profile:null,prompt:null,rev:null,rightMargin:me,rules:null,scheme:null,scrolling:Rt,standby:null,summary:null,text:null,topMargin:me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:me,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:_e,disablePictureInPicture:_e,disableRemotePlayback:_e,exportParts:Pi,part:dt,prefix:null,property:null,results:me,security:null,unselectable:null},space:"html",transform:gv}),yC=Ga({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:zn,accentHeight:me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:me,amplitude:me,arabicForm:null,ascent:me,attributeName:null,attributeType:null,azimuth:me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:me,by:null,calcMode:null,capHeight:me,className:dt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:me,diffuseConstant:me,direction:null,display:null,dur:null,divisor:me,dominantBaseline:null,download:_e,dx:null,dy:null,edgeMode:null,editable:null,elevation:me,enableBackground:null,end:null,event:null,exponent:me,externalResourcesRequired:null,fill:null,fillOpacity:me,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pi,g2:Pi,glyphName:Pi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:me,horizOriginX:me,horizOriginY:me,id:null,ideographic:me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:me,k:me,k1:me,k2:me,k3:me,k4:me,kernelMatrix:zn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:me,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:me,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:me,overlineThickness:me,paintOrder:null,panose1:null,path:null,pathLength:me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:me,pointsAtY:me,pointsAtZ:me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:zn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:zn,rev:zn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:zn,requiredFeatures:zn,requiredFonts:zn,requiredFormats:zn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:me,specularExponent:me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:me,strikethroughThickness:me,string:null,stroke:null,strokeDashArray:zn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:me,strokeOpacity:me,strokeWidth:null,style:null,surfaceScale:me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:zn,tabIndex:me,tableValues:null,target:null,targetX:me,targetY:me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:zn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:me,underlineThickness:me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:me,values:null,vAlphabetic:me,vMathematical:me,vectorEffect:null,vHanging:me,vIdeographic:me,version:null,vertAdvY:me,vertOriginX:me,vertOriginY:me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:pv}),xv=Ga({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,i){return"xlink:"+i.slice(5).toLowerCase()}}),yv=Ga({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gv}),bv=Ga({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,i){return"xml:"+i.slice(3).toLowerCase()}}),bC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},vC=/[A-Z]/g,ay=/-[a-z]/g,wC=/^data[-\w.:]+$/i;function jC(e,i){const a=Sh(i);let r=i,l=xn;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&wC.test(i)){if(i.charAt(4)==="-"){const u=i.slice(5).replace(ay,SC);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=i.slice(4);if(!ay.test(u)){let d=u.replace(vC,kC);d.charAt(0)!=="-"&&(d="-"+d),i="data"+d}}l=lf}return new l(r,i)}function kC(e){return"-"+e.toLowerCase()}function SC(e){return e.charAt(1).toUpperCase()}const CC=fv([mv,xC,xv,yv,bv],"html"),cf=fv([mv,yC,xv,yv,bv],"svg");function AC(e){return e.join(" ").trim()}var Ua={},Gd,ry;function NC(){if(ry)return Gd;ry=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,a=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,l=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,h=/^\s+|\s+$/g,p=`
|
|
24
|
+
`,m="/",x="*",y="",v="comment",b="declaration";function w(C,k){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];k=k||{};var O=1,T=1;function M(re){var Y=re.match(i);Y&&(O+=Y.length);var F=re.lastIndexOf(p);T=~F?re.length-F:T+re.length}function _(){var re={line:O,column:T};return function(Y){return Y.position=new $(re),U(),Y}}function $(re){this.start=re,this.end={line:O,column:T},this.source=k.source}$.prototype.content=C;function G(re){var Y=new Error(k.source+":"+O+":"+T+": "+re);if(Y.reason=re,Y.filename=k.source,Y.line=O,Y.column=T,Y.source=C,!k.silent)throw Y}function J(re){var Y=re.exec(C);if(Y){var F=Y[0];return M(F),C=C.slice(F.length),Y}}function U(){J(a)}function E(re){var Y;for(re=re||[];Y=I();)Y!==!1&&re.push(Y);return re}function I(){var re=_();if(!(m!=C.charAt(0)||x!=C.charAt(1))){for(var Y=2;y!=C.charAt(Y)&&(x!=C.charAt(Y)||m!=C.charAt(Y+1));)++Y;if(Y+=2,y===C.charAt(Y-1))return G("End of comment missing");var F=C.slice(2,Y-2);return T+=2,M(F),C=C.slice(Y),T+=2,re({type:v,comment:F})}}function Q(){var re=_(),Y=J(r);if(Y){if(I(),!J(l))return G("property missing ':'");var F=J(u),B=re({type:b,property:S(Y[0].replace(e,y)),value:F?S(F[0].replace(e,y)):y});return J(d),B}}function ie(){var re=[];E(re);for(var Y;Y=Q();)Y!==!1&&(re.push(Y),E(re));return re}return U(),ie()}function S(C){return C?C.replace(h,y):y}return Gd=w,Gd}var oy;function TC(){if(oy)return Ua;oy=1;var e=Ua&&Ua.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.default=a;const i=e(NC());function a(r,l){let u=null;if(!r||typeof r!="string")return u;const d=(0,i.default)(r),h=typeof l=="function";return d.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:x}=p;h?l(m,x,p):x&&(u=u||{},u[m]=x)}),u}return Ua}var Hr={},ly;function EC(){if(ly)return Hr;ly=1,Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,a=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,l=/^-(ms)-/,u=function(m){return!m||a.test(m)||e.test(m)},d=function(m,x){return x.toUpperCase()},h=function(m,x){return"".concat(x,"-")},p=function(m,x){return x===void 0&&(x={}),u(m)?m:(m=m.toLowerCase(),x.reactCompat?m=m.replace(l,h):m=m.replace(r,h),m.replace(i,d))};return Hr.camelCase=p,Hr}var qr,cy;function zC(){if(cy)return qr;cy=1;var e=qr&&qr.__importDefault||function(l){return l&&l.__esModule?l:{default:l}},i=e(TC()),a=EC();function r(l,u){var d={};return!l||typeof l!="string"||(0,i.default)(l,function(h,p){h&&p&&(d[(0,a.camelCase)(h,u)]=p)}),d}return r.default=r,qr=r,qr}var OC=zC();const RC=Ab(OC),vv=wv("end"),uf=wv("start");function wv(e){return i;function i(a){const r=a&&a.position&&a.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function MC(e){const i=uf(e),a=vv(e);if(i&&a)return{start:i,end:a}}function Wr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uy(e.position):"start"in e||"end"in e?uy(e):"line"in e||"column"in e?Nh(e):""}function Nh(e){return dy(e&&e.line)+":"+dy(e&&e.column)}function uy(e){return Nh(e&&e.start)+"-"+Nh(e&&e.end)}function dy(e){return e&&typeof e=="number"?e:1}class tn extends Error{constructor(i,a,r){super(),typeof a=="string"&&(r=a,a=void 0);let l="",u={},d=!1;if(a&&("line"in a&&"column"in a?u={place:a}:"start"in a&&"end"in a?u={place:a}:"type"in a?u={ancestors:[a],place:a.position}:u={...a}),typeof i=="string"?l=i:!u.cause&&i&&(d=!0,l=i.message,u.cause=i),!u.ruleId&&!u.source&&typeof r=="string"){const p=r.indexOf(":");p===-1?u.ruleId=r:(u.source=r.slice(0,p),u.ruleId=r.slice(p+1))}if(!u.place&&u.ancestors&&u.ancestors){const p=u.ancestors[u.ancestors.length-1];p&&(u.place=p.position)}const h=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=h?h.line:void 0,this.name=Wr(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}tn.prototype.file="";tn.prototype.name="";tn.prototype.reason="";tn.prototype.message="";tn.prototype.stack="";tn.prototype.column=void 0;tn.prototype.line=void 0;tn.prototype.ancestors=void 0;tn.prototype.cause=void 0;tn.prototype.fatal=void 0;tn.prototype.place=void 0;tn.prototype.ruleId=void 0;tn.prototype.source=void 0;const df={}.hasOwnProperty,DC=new Map,LC=/[A-Z]/g,_C=new Set(["table","tbody","thead","tfoot","tr"]),$C=new Set(["td","th"]),jv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function UC(e,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const a=i.filePath||void 0;let r;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=YC(a,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=PC(a,i.jsx,i.jsxs)}const l={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:r,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?cf:CC,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},u=kv(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}function kv(e,i,a){if(i.type==="element")return IC(e,i,a);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return BC(e,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return qC(e,i,a);if(i.type==="mdxjsEsm")return HC(e,i);if(i.type==="root")return FC(e,i,a);if(i.type==="text")return GC(e,i)}function IC(e,i,a){const r=e.schema;let l=r;i.tagName.toLowerCase()==="svg"&&r.space==="html"&&(l=cf,e.schema=l),e.ancestors.push(i);const u=Cv(e,i.tagName,!1),d=VC(e,i);let h=ff(e,i);return _C.has(i.tagName)&&(h=h.filter(function(p){return typeof p=="string"?!pC(p):!0})),Sv(e,d,u,i),hf(d,h),e.ancestors.pop(),e.schema=r,e.create(i,u,d,a)}function BC(e,i){if(i.data&&i.data.estree&&e.evaluater){const r=i.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}ro(e,i.position)}function HC(e,i){if(i.data&&i.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(i.data.estree);ro(e,i.position)}function qC(e,i,a){const r=e.schema;let l=r;i.name==="svg"&&r.space==="html"&&(l=cf,e.schema=l),e.ancestors.push(i);const u=i.name===null?e.Fragment:Cv(e,i.name,!0),d=ZC(e,i),h=ff(e,i);return Sv(e,d,u,i),hf(d,h),e.ancestors.pop(),e.schema=r,e.create(i,u,d,a)}function FC(e,i,a){const r={};return hf(r,ff(e,i)),e.create(i,e.Fragment,r,a)}function GC(e,i){return i.value}function Sv(e,i,a,r){typeof a!="string"&&a!==e.Fragment&&e.passNode&&(i.node=r)}function hf(e,i){if(i.length>0){const a=i.length>1?i:i[0];a&&(e.children=a)}}function PC(e,i,a){return r;function r(l,u,d,h){const m=Array.isArray(d.children)?a:i;return h?m(u,d,h):m(u,d)}}function YC(e,i){return a;function a(r,l,u,d){const h=Array.isArray(u.children),p=uf(r);return i(l,u,d,h,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function VC(e,i){const a={};let r,l;for(l in i.properties)if(l!=="children"&&df.call(i.properties,l)){const u=XC(e,l,i.properties[l]);if(u){const[d,h]=u;e.tableCellAlignToStyle&&d==="align"&&typeof h=="string"&&$C.has(i.tagName)?r=h:a[d]=h}}if(r){const u=a.style||(a.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return a}function ZC(e,i){const a={};for(const r of i.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const u=r.data.estree.body[0];u.type;const d=u.expression;d.type;const h=d.properties[0];h.type,Object.assign(a,e.evaluater.evaluateExpression(h.argument))}else ro(e,i.position);else{const l=r.name;let u;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const h=r.value.data.estree.body[0];h.type,u=e.evaluater.evaluateExpression(h.expression)}else ro(e,i.position);else u=r.value===null?!0:r.value;a[l]=u}return a}function ff(e,i){const a=[];let r=-1;const l=e.passKeys?new Map:DC;for(;++r<i.children.length;){const u=i.children[r];let d;if(e.passKeys){const p=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(p){const m=l.get(p)||0;d=p+"-"+m,l.set(p,m+1)}}const h=kv(e,u,d);h!==void 0&&a.push(h)}return a}function XC(e,i,a){const r=jC(e.schema,i);if(!(a==null||typeof a=="number"&&Number.isNaN(a))){if(Array.isArray(a)&&(a=r.commaSeparated?uC(a):AC(a)),r.property==="style"){let l=typeof a=="object"?a:QC(e,String(a));return e.stylePropertyNameCase==="css"&&(l=KC(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&r.space?bC[r.property]||r.property:r.attribute,a]}}function QC(e,i){try{return RC(i,{reactCompat:!0})}catch(a){if(e.ignoreInvalidStyle)return{};const r=a,l=new tn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=jv+"#cannot-parse-style-attribute",l}}function Cv(e,i,a){let r;if(!a)r={type:"Literal",value:i};else if(i.includes(".")){const l=i.split(".");let u=-1,d;for(;++u<l.length;){const h=ny(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};d=d?{type:"MemberExpression",object:d,property:h,computed:!!(u&&h.type==="Literal"),optional:!1}:h}r=d}else r=ny(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(r.type==="Literal"){const l=r.value;return df.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(r);ro(e)}function ro(e,i){const a=new tn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=jv+"#cannot-handle-mdx-estrees-without-createevaluater",a}function KC(e){const i={};let a;for(a in e)df.call(e,a)&&(i[WC(a)]=e[a]);return i}function WC(e){let i=e.replace(LC,JC);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function JC(e){return"-"+e.toLowerCase()}const Pd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},e2={};function mf(e,i){const a=e2,r=typeof a.includeImageAlt=="boolean"?a.includeImageAlt:!0,l=typeof a.includeHtml=="boolean"?a.includeHtml:!0;return Av(e,r,l)}function Av(e,i,a){if(t2(e)){if("value"in e)return e.type==="html"&&!a?"":e.value;if(i&&"alt"in e&&e.alt)return e.alt;if("children"in e)return hy(e.children,i,a)}return Array.isArray(e)?hy(e,i,a):""}function hy(e,i,a){const r=[];let l=-1;for(;++l<e.length;)r[l]=Av(e[l],i,a);return r.join("")}function t2(e){return!!(e&&typeof e=="object")}const fy=document.createElement("i");function pf(e){const i="&"+e+";";fy.innerHTML=i;const a=fy.textContent;return a.charCodeAt(a.length-1)===59&&e!=="semi"||a===i?!1:a}function es(e,i,a,r){const l=e.length;let u=0,d;if(i<0?i=-i>l?0:l+i:i=i>l?l:i,a=a>0?a:0,r.length<1e4)d=Array.from(r),d.unshift(i,a),e.splice(...d);else for(a&&e.splice(i,a);u<r.length;)d=r.slice(u,u+1e4),d.unshift(i,0),e.splice(...d),u+=1e4,i+=1e4}function Gn(e,i){return e.length>0?(es(e,e.length,0,i),e):i}const my={}.hasOwnProperty;function Nv(e){const i={};let a=-1;for(;++a<e.length;)n2(i,e[a]);return i}function n2(e,i){let a;for(a in i){const l=(my.call(e,a)?e[a]:void 0)||(e[a]={}),u=i[a];let d;if(u)for(d in u){my.call(l,d)||(l[d]=[]);const h=u[d];s2(l[d],Array.isArray(h)?h:h?[h]:[])}}}function s2(e,i){let a=-1;const r=[];for(;++a<i.length;)(i[a].add==="after"?e:r).push(i[a]);es(e,0,0,r)}function Tv(e,i){const a=Number.parseInt(e,i);return a<9||a===11||a>13&&a<32||a>126&&a<160||a>55295&&a<57344||a>64975&&a<65008||(a&65535)===65535||(a&65535)===65534||a>1114111?"�":String.fromCodePoint(a)}function ts(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const an=yi(/[A-Za-z]/),en=yi(/[\dA-Za-z]/),i2=yi(/[#-'*+\--9=?A-Z^-~]/);function Wl(e){return e!==null&&(e<32||e===127)}const Th=yi(/\d/),a2=yi(/[\dA-Fa-f]/),r2=yi(/[!-/:-@[-`{-~]/);function Me(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function qe(e){return e===-2||e===-1||e===32}const mc=yi(new RegExp("\\p{P}|\\p{S}","u")),Yi=yi(/\s/);function yi(e){return i;function i(a){return a!==null&&a>-1&&e.test(String.fromCharCode(a))}}function Pa(e){const i=[];let a=-1,r=0,l=0;for(;++a<e.length;){const u=e.charCodeAt(a);let d="";if(u===37&&en(e.charCodeAt(a+1))&&en(e.charCodeAt(a+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const h=e.charCodeAt(a+1);u<56320&&h>56319&&h<57344?(d=String.fromCharCode(u,h),l=1):d="�"}else d=String.fromCharCode(u);d&&(i.push(e.slice(r,a),encodeURIComponent(d)),r=a+l+1,d=""),l&&(a+=l,l=0)}return i.join("")+e.slice(r)}function et(e,i,a,r){const l=r?r-1:1/0;let u=0;return d;function d(p){return qe(p)?(e.enter(a),h(p)):i(p)}function h(p){return qe(p)&&u++<l?(e.consume(p),h):(e.exit(a),i(p))}}function Ev(e,i,a,r,l,u){let d=0;return h;function h(x){return qe(x)?(e.enter(r),p(x)):m(x)}function p(x){return qe(x)&&d<u?(e.consume(x),d++,p):(e.exit(r),m(x))}function m(x){return d>=l?i(x):a(x)}}const o2={tokenize:l2};function l2(e){const i=e.attempt(this.parser.constructs.contentInitial,r,l);let a;return i;function r(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),et(e,i,"linePrefix")}function l(h){return e.enter("paragraph"),u(h)}function u(h){const p=e.enter("chunkText",{contentType:"text",previous:a});return a&&(a.next=p),a=p,d(h)}function d(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Me(h)?(e.consume(h),e.exit("chunkText"),u):(e.consume(h),d)}}let Jl=class{constructor(){this.index=new Map,this.map=[]}add(i,a,r){py(this,i,a,r,!1)}addBefore(i,a,r){py(this,i,a,r,!0)}consume(i){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(i.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),i.length=this.map[a][0];r.push(i.slice()),i.length=0;let l=r.pop();for(;l;){for(const u of l)i.push(u);l=r.pop()}this.map.length=0,this.index.clear()}};function py(e,i,a,r,l){if(a===0&&r.length===0)return;const u=e.index.get(i);if(u){u[1]+=a,l?(r.push(...u[2]),u[2]=r):u[2].push(...r);return}const d=[i,a,r];e.map.push(d),e.index.set(i,d)}const c2={tokenize:u2},gy={tokenize:d2};function u2(e){const i=this,a=[];let r=0,l,u,d;return h;function h(T){if(r<a.length){const M=a[r];return i.containerState=M[1],e.attempt(M[0].continuation,p,m)(T)}return m(T)}function p(T){if(r++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,l&&O();const M=i.events.length;let _=M,$;for(;_--;)if(i.events[_][0]==="exit"&&i.events[_][1].type==="chunkFlow"){$=i.events[_][1].end;break}k(r);let G=M;for(;G<i.events.length;)i.events[G][1].end={...$},G++;const J=new Jl;return J.add(_+1,0,i.events.slice(M)),J.add(M,G-M,[]),J.consume(i.events),m(T)}return h(T)}function m(T){if(r===a.length){if(!l)return v(T);if(l.currentConstruct&&l.currentConstruct.concrete)return w(T);i.interrupt=!!(l.currentConstruct&&!l._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(gy,x,y)(T)}function x(T){return l&&O(),k(r),v(T)}function y(T){return i.parser.lazy[i.now().line]=r!==a.length,d=i.now().offset,w(T)}function v(T){return i.containerState={},e.attempt(gy,b,w)(T)}function b(T){return r++,a.push([i.currentConstruct,i.containerState]),v(T)}function w(T){if(T===null){l&&O(),k(0),e.consume(T);return}return l=l||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:l,contentType:"flow",previous:u}),S(T)}function S(T){if(T===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(T);return}return Me(T)?(e.consume(T),C(e.exit("chunkFlow")),r=0,i.interrupt=void 0,h):(e.consume(T),S)}function C(T,M){const _=i.sliceStream(T);if(M&&_.push(null),T.previous=u,u&&(u.next=T),u=T,l.defineSkip(T.start),l.write(_),i.parser.lazy[T.start.line]){let $=l.events.length;for(;$--;)if(l.events[$][1].start.offset<d&&(!l.events[$][1].end||l.events[$][1].end.offset>d))return;const G=i.events.length;let J=G,U,E;for(;J--;)if(i.events[J][0]==="exit"&&i.events[J][1].type==="chunkFlow"){if(U){E=i.events[J][1].end;break}U=!0}for(k(r),$=G;$<i.events.length;)i.events[$][1].end={...E},$++;const I=new Jl;I.add(J+1,0,i.events.slice(G)),I.add(G,$-G,[]),I.consume(i.events)}}function k(T){let M=a.length;for(;M-- >T;){const _=a[M];i.containerState=_[1],_[0].exit.call(i,e)}a.length=T}function O(){l.write([null]),u=void 0,l=void 0,i.containerState._closeFlow=void 0}}function d2(e,i,a){return et(e,e.attempt(this.parser.constructs.document,i,a),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ec(e){if(e===null||ht(e)||Yi(e))return 1;if(mc(e))return 2}function pc(e,i,a){const r=[];let l=-1;for(;++l<e.length;){const u=e[l].resolveAll;u&&!r.includes(u)&&(i=u(i,a),r.push(u))}return i}const Eh={name:"attention",resolveAll:h2,tokenize:f2};function h2(e,i){let a=-1,r;for(;++a<e.length;)if(e[a][0]==="enter"&&e[a][1].type==="attentionSequence"&&e[a][1]._close){let l=a;for(;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&i.sliceSerialize(e[l][1]).charCodeAt(0)===i.sliceSerialize(e[a][1]).charCodeAt(0)){if((e[l][1]._close||e[a][1]._open)&&(e[a][1].end.offset-e[a][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[a][1].end.offset-e[a][1].start.offset)%3))continue;const u=e[l][1].end.offset-e[l][1].start.offset>1&&e[a][1].end.offset-e[a][1].start.offset>1?2:1,d={...e[l][1].end},h={...e[a][1].start};xy(d,-u),xy(h,u);const p={type:u>1?"strongSequence":"emphasisSequence",start:d,end:{...e[l][1].end}},m={type:u>1?"strongSequence":"emphasisSequence",start:{...e[a][1].start},end:h},x={type:u>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[a][1].start}},y={type:u>1?"strong":"emphasis",start:{...p.start},end:{...m.end}};e[l][1].end={...p.start},e[a][1].start={...m.end},r=[],e[l][1].end.offset-e[l][1].start.offset&&(r=Gn(r,[["enter",e[l][1],i],["exit",e[l][1],i]])),r=Gn(r,[["enter",y,i],["enter",p,i],["exit",p,i],["enter",x,i]]),r=Gn(r,pc(i.parser.constructs.insideSpan.null,e.slice(l+1,a),i)),r=Gn(r,[["exit",x,i],["enter",m,i],["exit",m,i],["exit",y,i]]);let v=0;e[a][1].end.offset-e[a][1].start.offset&&(v=2,r=Gn(r,[["enter",e[a][1],i],["exit",e[a][1],i]])),es(e,l-1,a-l+3,r),a=l+r.length-v-2;break}}for(a=-1;++a<e.length;)e[a][1].type==="attentionSequence"&&(e[a][1].type="data");return e}function f2(e,i){const a=this.parser.constructs.attentionMarkers.null,r=this.previous,l=ec(r);let u;return d;function d(p){return u=p,e.enter("attentionSequence"),h(p)}function h(p){if(p===u)return e.consume(p),h;const m=e.exit("attentionSequence"),x=ec(p),y=!x||x===2&&l||a.includes(p)&&p!==42&&p!==95,v=!l||l===2&&x||a.includes(r)&&r!==42&&r!==95;return m._open=!!(u===42?y:y&&(l||!v)),m._close=!!(u===42?v:v&&(x||!y)),i(p)}}function xy(e,i){e.column+=i,e.offset+=i,e._bufferIndex+=i}const m2={name:"autolink",tokenize:p2};function p2(e,i,a){let r=0;return l;function l(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(b){return an(b)?(e.consume(b),d):b===64?a(b):m(b)}function d(b){return b===43||b===45||b===46||en(b)?(r=1,h(b)):m(b)}function h(b){return b===58?(e.consume(b),r=0,p):(b===43||b===45||b===46||en(b))&&r++<32?(e.consume(b),h):(r=0,m(b))}function p(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),i):b===null||b===32||b===60||Wl(b)?a(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),x):i2(b)?(e.consume(b),m):a(b)}function x(b){return en(b)?y(b):a(b)}function y(b){return b===46?(e.consume(b),r=0,x):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),i):v(b)}function v(b){if((b===45||en(b))&&r++<63){const w=b===45?v:y;return e.consume(b),w}return a(b)}}const ho={partial:!0,tokenize:g2};function g2(e,i,a){return r;function r(u){return qe(u)?et(e,l,"linePrefix")(u):l(u)}function l(u){return u===null||Me(u)?i(u):a(u)}}const zv={continuation:{tokenize:y2},exit:b2,name:"blockQuote",tokenize:x2};function x2(e,i,a){const r=this;return l;function l(d){if(d===62){const h=r.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return a(d)}function u(d){return qe(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),i):(e.exit("blockQuotePrefix"),i(d))}}function y2(e,i,a){const r=this;return l;function l(d){return qe(d)?et(e,u,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(zv,i,a)(d)}}function b2(e){e.exit("blockQuote")}const Ov={name:"characterEscape",tokenize:v2};function v2(e,i,a){return r;function r(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),l}function l(u){return r2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),i):a(u)}}const Rv={name:"characterReference",tokenize:w2};function w2(e,i,a){const r=this;let l=0,u,d;return h;function h(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),p}function p(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),u=31,d=en,x(y))}function m(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=a2,x):(e.enter("characterReferenceValue"),u=7,d=Th,x(y))}function x(y){if(y===59&&l){const v=e.exit("characterReferenceValue");return d===en&&!pf(r.sliceSerialize(v))?a(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),i)}return d(y)&&l++<u?(e.consume(y),x):a(y)}}const zh={partial:!0,tokenize:j2};function j2(e,i,a){const r=this;return l;function l(d){return d===null?a(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return r.parser.lazy[r.now().line]?a(d):i(d)}}const yy={concrete:!0,name:"codeFenced",tokenize:k2};function k2(e,i,a){const r=this,l={partial:!0,tokenize:_};let u=0,d=0,h;return p;function p($){return m($)}function m($){const G=r.events[r.events.length-1];return u=G&&G[1].type==="linePrefix"?G[2].sliceSerialize(G[1],!0).length:0,h=$,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),x($)}function x($){return $===h?(d++,e.consume($),x):d<3?a($):(e.exit("codeFencedFenceSequence"),qe($)?et(e,y,"whitespace")($):y($))}function y($){return $===null||Me($)?(e.exit("codeFencedFence"),r.interrupt?i($):e.check(zh,S,M)($)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v($))}function v($){return $===null||Me($)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y($)):qe($)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),et(e,b,"whitespace")($)):$===96&&$===h?a($):(e.consume($),v)}function b($){return $===null||Me($)?y($):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w($))}function w($){return $===null||Me($)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y($)):$===96&&$===h?a($):(e.consume($),w)}function S($){return e.attempt(l,M,C)($)}function C($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),k}function k($){return u>0&&qe($)?et(e,O,"linePrefix",u+1)($):O($)}function O($){return $===null||Me($)?e.check(zh,S,M)($):(e.enter("codeFlowValue"),T($))}function T($){return $===null||Me($)?(e.exit("codeFlowValue"),O($)):(e.consume($),T)}function M($){return e.exit("codeFenced"),i($)}function _($,G,J){let U=0;return E;function E(Y){return $.enter("lineEnding"),$.consume(Y),$.exit("lineEnding"),I}function I(Y){return $.enter("codeFencedFence"),qe(Y)?et($,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Y):Q(Y)}function Q(Y){return Y===h?($.enter("codeFencedFenceSequence"),ie(Y)):J(Y)}function ie(Y){return Y===h?(U++,$.consume(Y),ie):U>=d?($.exit("codeFencedFenceSequence"),qe(Y)?et($,re,"whitespace")(Y):re(Y)):J(Y)}function re(Y){return Y===null||Me(Y)?($.exit("codeFencedFence"),G(Y)):J(Y)}}}const Yd={name:"codeIndented",tokenize:C2},S2={partial:!0,tokenize:A2};function C2(e,i,a){return r;function r(h){return e.enter("codeIndented"),Ev(e,l,a,"linePrefix",4,4)(h)}function l(h){return h===null?d(h):Me(h)?e.attempt(S2,l,d)(h):(e.enter("codeFlowValue"),u(h))}function u(h){return h===null||Me(h)?(e.exit("codeFlowValue"),l(h)):(e.consume(h),u)}function d(h){return e.exit("codeIndented"),i(h)}}function A2(e,i,a){const r=this;return l;function l(d){return r.parser.lazy[r.now().line]?a(d):Me(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):Ev(e,i,u,"linePrefix",4,4)(d)}function u(d){return Me(d)?l(d):a(d)}}const N2={name:"codeText",previous:E2,resolve:T2,tokenize:z2};function T2(e){let i=e.length-4,a=3,r,l;if((e[a][1].type==="lineEnding"||e[a][1].type==="space")&&(e[i][1].type==="lineEnding"||e[i][1].type==="space")){for(r=a;++r<i;)if(e[r][1].type==="codeTextData"){e[a][1].type="codeTextPadding",e[i][1].type="codeTextPadding",a+=2,i-=2;break}}for(r=a-1,i++;++r<=i;)l===void 0?r!==i&&e[r][1].type!=="lineEnding"&&(l=r):(r===i||e[r][1].type==="lineEnding")&&(e[l][1].type="codeTextData",r!==l+2&&(e[l][1].end=e[r-1][1].end,e.splice(l+2,r-l-2),i-=r-l-2,r=l+2),l=void 0);return e}function E2(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function z2(e,i,a){let r=0,l,u;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),h(y)}function h(y){return y===96?(e.consume(y),r++,h):(e.exit("codeTextSequence"),p(y))}function p(y){return y===null?a(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),p):y===96?(u=e.enter("codeTextSequence"),l=0,x(y)):Me(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(y))}function m(y){return y===null||y===32||y===96||Me(y)?(e.exit("codeTextData"),p(y)):(e.consume(y),m)}function x(y){return y===96?(e.consume(y),l++,x):l===r?(e.exit("codeTextSequence"),e.exit("codeText"),i(y)):(u.type="codeTextData",m(y))}}class O2{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,a){const r=a??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(i,r):i>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(i,a,r){const l=a||0;this.setCursor(Math.trunc(i));const u=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return r&&Fr(this.left,r),u.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),Fr(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),Fr(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const a=this.left.splice(i,Number.POSITIVE_INFINITY);Fr(this.right,a.reverse())}else{const a=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);Fr(this.left,a.reverse())}}}function Fr(e,i){let a=0;if(i.length<1e4)e.push(...i);else for(;a<i.length;)e.push(...i.slice(a,a+1e4)),a+=1e4}function Mv(e){const i={};let a=-1,r,l,u,d,h,p,m;const x=new O2(e);for(;++a<x.length;){for(;a in i;)a=i[a];if(r=x.get(a),a&&r[1].type==="chunkFlow"&&x.get(a-1)[1].type==="listItemPrefix"&&(p=r[1]._tokenizer.events,u=0,u<p.length&&p[u][1].type==="lineEndingBlank"&&(u+=2),u<p.length&&p[u][1].type==="content"))for(;++u<p.length&&p[u][1].type!=="content";)p[u][1].type==="chunkText"&&(p[u][1]._isInFirstContentOfListItem=!0,u++);if(r[0]==="enter")r[1].contentType&&(Object.assign(i,R2(x,a)),a=i[a],m=!0);else if(r[1]._container){for(u=a,l=void 0;u--;)if(d=x.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(l&&(x.get(l)[1].type="lineEndingBlank"),d[1].type="lineEnding",l=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;l&&(r[1].end={...x.get(l)[1].start},h=x.slice(l,a),h.unshift(r),x.splice(l,a-l+1,h))}}return es(e,0,Number.POSITIVE_INFINITY,x.slice(0)),!m}function R2(e,i){const a=e.get(i)[1],r=e.get(i)[2];let l=i-1;const u=[];let d=a._tokenizer;d||(d=r.parser[a.contentType](a.start),a._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const h=d.events,p=[],m={};let x,y,v=-1,b=a,w=0,S=0;const C=[S];for(;b;){for(;e.get(++l)[1]!==b;);u.push(l),b._tokenizer||(x=r.sliceStream(b),b.next||x.push(null),y&&d.defineSkip(b.start),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(x),b._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=b,b=b.next}for(b=a;++v<h.length;)h[v][0]==="exit"&&h[v-1][0]==="enter"&&h[v][1].type===h[v-1][1].type&&h[v][1].start.line!==h[v][1].end.line&&(S=v+1,C.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(d.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),v=C.length;v--;){const k=h.slice(C[v],C[v+1]),O=u.pop();p.push([O,O+k.length-1]),e.splice(O,2,k)}for(p.reverse(),v=-1;++v<p.length;)m[w+p[v][0]]=w+p[v][1],w+=p[v][1]-p[v][0]-1;return m}const M2={resolve:L2,tokenize:_2},D2={partial:!0,tokenize:$2};function L2(e){return Mv(e),e}function _2(e,i){let a;return r;function r(h){return e.enter("content"),a=e.enter("chunkContent",{contentType:"content"}),l(h)}function l(h){return h===null?u(h):Me(h)?e.check(D2,d,u)(h):(e.consume(h),l)}function u(h){return e.exit("chunkContent"),e.exit("content"),i(h)}function d(h){return e.consume(h),e.exit("chunkContent"),a.next=e.enter("chunkContent",{contentType:"content",previous:a}),a=a.next,l}}function $2(e,i,a){const r=this;return l;function l(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),et(e,u,"linePrefix")}function u(d){if(d===null||Me(d))return a(d);const h=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?i(d):e.interrupt(r.parser.constructs.flow,a,i)(d)}}function Dv(e,i,a,r,l,u,d,h,p){const m=p||Number.POSITIVE_INFINITY;let x=0;return y;function y(k){return k===60?(e.enter(r),e.enter(l),e.enter(u),e.consume(k),e.exit(u),v):k===null||k===32||k===41||Wl(k)?a(k):(e.enter(r),e.enter(d),e.enter(h),e.enter("chunkString",{contentType:"string"}),S(k))}function v(k){return k===62?(e.enter(u),e.consume(k),e.exit(u),e.exit(l),e.exit(r),i):(e.enter(h),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(h),v(k)):k===null||k===60||Me(k)?a(k):(e.consume(k),k===92?w:b)}function w(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function S(k){return!x&&(k===null||k===41||ht(k))?(e.exit("chunkString"),e.exit(h),e.exit(d),e.exit(r),i(k)):x<m&&k===40?(e.consume(k),x++,S):k===41?(e.consume(k),x--,S):k===null||k===32||k===40||Wl(k)?a(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function Lv(e,i,a,r,l,u){const d=this;let h=0,p;return m;function m(b){return e.enter(r),e.enter(l),e.consume(b),e.exit(l),e.enter(u),x}function x(b){return h>999||b===null||b===91||b===93&&!p||b===94&&!h&&"_hiddenFootnoteSupport"in d.parser.constructs?a(b):b===93?(e.exit(u),e.enter(l),e.consume(b),e.exit(l),e.exit(r),i):Me(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),x):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===null||b===91||b===93||Me(b)||h++>999?(e.exit("chunkString"),x(b)):(e.consume(b),p||(p=!qe(b)),b===92?v:y)}function v(b){return b===91||b===92||b===93?(e.consume(b),h++,y):y(b)}}function _v(e,i,a,r,l,u){let d;return h;function h(v){return v===34||v===39||v===40?(e.enter(r),e.enter(l),e.consume(v),e.exit(l),d=v===40?41:v,p):a(v)}function p(v){return v===d?(e.enter(l),e.consume(v),e.exit(l),e.exit(r),i):(e.enter(u),m(v))}function m(v){return v===d?(e.exit(u),p(d)):v===null?a(v):Me(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),et(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),x(v))}function x(v){return v===d||v===null||Me(v)?(e.exit("chunkString"),m(v)):(e.consume(v),v===92?y:x)}function y(v){return v===d||v===92?(e.consume(v),x):x(v)}}function Jr(e,i){let a;return r;function r(l){return Me(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a=!0,r):qe(l)?et(e,r,a?"linePrefix":"lineSuffix")(l):i(l)}}const U2={name:"definition",tokenize:B2},I2={partial:!0,tokenize:H2};function B2(e,i,a){const r=this;let l;return u;function u(b){return e.enter("definition"),d(b)}function d(b){return Lv.call(r,e,h,a,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function h(b){return l=ts(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):a(b)}function p(b){return ht(b)?Jr(e,m)(b):m(b)}function m(b){return Dv(e,x,a,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function x(b){return e.attempt(I2,y,y)(b)}function y(b){return qe(b)?et(e,v,"whitespace")(b):v(b)}function v(b){return b===null||Me(b)?(e.exit("definition"),r.parser.defined.push(l),i(b)):a(b)}}function H2(e,i,a){return r;function r(h){return ht(h)?Jr(e,l)(h):a(h)}function l(h){return _v(e,u,a,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function u(h){return qe(h)?et(e,d,"whitespace")(h):d(h)}function d(h){return h===null||Me(h)?i(h):a(h)}}const q2={name:"hardBreakEscape",tokenize:F2};function F2(e,i,a){return r;function r(u){return e.enter("hardBreakEscape"),e.consume(u),l}function l(u){return Me(u)?(e.exit("hardBreakEscape"),i(u)):a(u)}}const G2={name:"headingAtx",resolve:P2,tokenize:Y2};function P2(e,i){let a=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),a-2>r&&e[a][1].type==="whitespace"&&(a-=2),e[a][1].type==="atxHeadingSequence"&&(r===a-1||a-4>r&&e[a-2][1].type==="whitespace")&&(a-=r+1===a?2:4),a>r){const l={type:"atxHeadingText",start:e[r][1].start,end:e[a][1].end},u={type:"chunkText",start:e[r][1].start,end:e[a][1].end,contentType:"text"};es(e,r,a-r+1,[["enter",l,i],["enter",u,i],["exit",u,i],["exit",l,i]])}return e}function Y2(e,i,a){let r=0;return l;function l(x){return e.enter("atxHeading"),u(x)}function u(x){return e.enter("atxHeadingSequence"),d(x)}function d(x){return x===35&&r++<6?(e.consume(x),d):x===null||ht(x)?(e.exit("atxHeadingSequence"),h(x)):a(x)}function h(x){return x===35?(e.enter("atxHeadingSequence"),p(x)):x===null||Me(x)?(e.exit("atxHeading"),i(x)):qe(x)?et(e,h,"whitespace")(x):(e.enter("atxHeadingText"),m(x))}function p(x){return x===35?(e.consume(x),p):(e.exit("atxHeadingSequence"),h(x))}function m(x){return x===null||x===35||ht(x)?(e.exit("atxHeadingText"),h(x)):(e.consume(x),m)}}const V2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],by=["pre","script","style","textarea"],Z2={concrete:!0,name:"htmlFlow",resolveTo:Q2,tokenize:K2},X2={partial:!0,tokenize:W2};function Q2(e){let i=e.length;for(;i--&&!(e[i][0]==="enter"&&e[i][1].type==="htmlFlow"););return i>1&&e[i-2][1].type==="linePrefix"&&(e[i][1].start=e[i-2][1].start,e[i+1][1].start=e[i-2][1].start,e.splice(i-2,2)),e}function K2(e,i,a){const r=this;let l,u,d,h,p;return m;function m(z){return x(z)}function x(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),y}function y(z){return z===33?(e.consume(z),v):z===47?(e.consume(z),u=!0,S):z===63?(e.consume(z),l=3,r.interrupt?i:R):an(z)?(e.consume(z),d=String.fromCharCode(z),C):a(z)}function v(z){return z===45?(e.consume(z),l=2,b):z===91?(e.consume(z),l=5,h=0,w):an(z)?(e.consume(z),l=4,r.interrupt?i:R):a(z)}function b(z){return z===45?(e.consume(z),r.interrupt?i:R):a(z)}function w(z){const X="CDATA[";return z===X.charCodeAt(h++)?(e.consume(z),h===X.length?r.interrupt?i:Q:w):a(z)}function S(z){return an(z)?(e.consume(z),d=String.fromCharCode(z),C):a(z)}function C(z){if(z===null||z===47||z===62||ht(z)){const X=z===47,Se=d.toLowerCase();return!X&&!u&&by.includes(Se)?(l=1,r.interrupt?i(z):Q(z)):V2.includes(d.toLowerCase())?(l=6,X?(e.consume(z),k):r.interrupt?i(z):Q(z)):(l=7,r.interrupt&&!r.parser.lazy[r.now().line]?a(z):u?O(z):T(z))}return z===45||en(z)?(e.consume(z),d+=String.fromCharCode(z),C):a(z)}function k(z){return z===62?(e.consume(z),r.interrupt?i:Q):a(z)}function O(z){return qe(z)?(e.consume(z),O):E(z)}function T(z){return z===47?(e.consume(z),E):z===58||z===95||an(z)?(e.consume(z),M):qe(z)?(e.consume(z),T):E(z)}function M(z){return z===45||z===46||z===58||z===95||en(z)?(e.consume(z),M):_(z)}function _(z){return z===61?(e.consume(z),$):qe(z)?(e.consume(z),_):T(z)}function $(z){return z===null||z===60||z===61||z===62||z===96?a(z):z===34||z===39?(e.consume(z),p=z,G):qe(z)?(e.consume(z),$):J(z)}function G(z){return z===p?(e.consume(z),p=null,U):z===null||Me(z)?a(z):(e.consume(z),G)}function J(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||ht(z)?_(z):(e.consume(z),J)}function U(z){return z===47||z===62||qe(z)?T(z):a(z)}function E(z){return z===62?(e.consume(z),I):a(z)}function I(z){return z===null||Me(z)?Q(z):qe(z)?(e.consume(z),I):a(z)}function Q(z){return z===45&&l===2?(e.consume(z),F):z===60&&l===1?(e.consume(z),B):z===62&&l===4?(e.consume(z),D):z===63&&l===3?(e.consume(z),R):z===93&&l===5?(e.consume(z),de):Me(z)&&(l===6||l===7)?(e.exit("htmlFlowData"),e.check(X2,ee,ie)(z)):z===null||Me(z)?(e.exit("htmlFlowData"),ie(z)):(e.consume(z),Q)}function ie(z){return e.check(zh,re,ee)(z)}function re(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),Y}function Y(z){return z===null||Me(z)?ie(z):(e.enter("htmlFlowData"),Q(z))}function F(z){return z===45?(e.consume(z),R):Q(z)}function B(z){return z===47?(e.consume(z),d="",se):Q(z)}function se(z){if(z===62){const X=d.toLowerCase();return by.includes(X)?(e.consume(z),D):Q(z)}return an(z)&&d.length<8?(e.consume(z),d+=String.fromCharCode(z),se):Q(z)}function de(z){return z===93?(e.consume(z),R):Q(z)}function R(z){return z===62?(e.consume(z),D):z===45&&l===2?(e.consume(z),R):Q(z)}function D(z){return z===null||Me(z)?(e.exit("htmlFlowData"),ee(z)):(e.consume(z),D)}function ee(z){return e.exit("htmlFlow"),i(z)}}function W2(e,i,a){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),e.attempt(ho,i,a)}}const J2={name:"htmlText",tokenize:eA};function eA(e,i,a){const r=this;let l,u,d;return h;function h(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),p}function p(R){return R===33?(e.consume(R),m):R===47?(e.consume(R),_):R===63?(e.consume(R),T):an(R)?(e.consume(R),J):a(R)}function m(R){return R===45?(e.consume(R),x):R===91?(e.consume(R),u=0,w):an(R)?(e.consume(R),O):a(R)}function x(R){return R===45?(e.consume(R),b):a(R)}function y(R){return R===null?a(R):R===45?(e.consume(R),v):Me(R)?(d=y,B(R)):(e.consume(R),y)}function v(R){return R===45?(e.consume(R),b):y(R)}function b(R){return R===62?F(R):R===45?v(R):y(R)}function w(R){const D="CDATA[";return R===D.charCodeAt(u++)?(e.consume(R),u===D.length?S:w):a(R)}function S(R){return R===null?a(R):R===93?(e.consume(R),C):Me(R)?(d=S,B(R)):(e.consume(R),S)}function C(R){return R===93?(e.consume(R),k):S(R)}function k(R){return R===62?F(R):R===93?(e.consume(R),k):S(R)}function O(R){return R===null||R===62?F(R):Me(R)?(d=O,B(R)):(e.consume(R),O)}function T(R){return R===null?a(R):R===63?(e.consume(R),M):Me(R)?(d=T,B(R)):(e.consume(R),T)}function M(R){return R===62?F(R):T(R)}function _(R){return an(R)?(e.consume(R),$):a(R)}function $(R){return R===45||en(R)?(e.consume(R),$):G(R)}function G(R){return Me(R)?(d=G,B(R)):qe(R)?(e.consume(R),G):F(R)}function J(R){return R===45||en(R)?(e.consume(R),J):R===47||R===62||ht(R)?U(R):a(R)}function U(R){return R===47?(e.consume(R),F):R===58||R===95||an(R)?(e.consume(R),E):Me(R)?(d=U,B(R)):qe(R)?(e.consume(R),U):F(R)}function E(R){return R===45||R===46||R===58||R===95||en(R)?(e.consume(R),E):I(R)}function I(R){return R===61?(e.consume(R),Q):Me(R)?(d=I,B(R)):qe(R)?(e.consume(R),I):U(R)}function Q(R){return R===null||R===60||R===61||R===62||R===96?a(R):R===34||R===39?(e.consume(R),l=R,ie):Me(R)?(d=Q,B(R)):qe(R)?(e.consume(R),Q):(e.consume(R),re)}function ie(R){return R===l?(e.consume(R),l=void 0,Y):R===null?a(R):Me(R)?(d=ie,B(R)):(e.consume(R),ie)}function re(R){return R===null||R===34||R===39||R===60||R===61||R===96?a(R):R===47||R===62||ht(R)?U(R):(e.consume(R),re)}function Y(R){return R===47||R===62||ht(R)?U(R):a(R)}function F(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),i):a(R)}function B(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),se}function se(R){return qe(R)?et(e,de,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):de(R)}function de(R){return e.enter("htmlTextData"),d(R)}}const gf={name:"labelEnd",resolveAll:iA,resolveTo:aA,tokenize:rA},tA={tokenize:oA},nA={tokenize:lA},sA={tokenize:cA};function iA(e){let i=-1;const a=[];for(;++i<e.length;){const r=e[i][1];if(a.push(e[i]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const l=r.type==="labelImage"?4:2;r.type="data",i+=l}}return e.length!==a.length&&es(e,0,e.length,a),e}function aA(e,i){let a=e.length,r=0,l,u,d;for(;a--;){const x=e[a][1];if(l){if(x.type==="link"||x.type==="labelLink"&&x._inactive)break;e[a][0]==="enter"&&x.type==="labelLink"&&(x._inactive=!0)}else if(u){if(e[a][0]==="enter"&&(x.type==="labelImage"||x.type==="labelLink")&&!x._balanced&&(l=a,x.type!=="labelLink")){r=2;break}}else x.type==="labelEnd"&&(u=a)}const h={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},m={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",h,i],["enter",p,i]],d=Gn(d,e.slice(l+1,l+r+3)),d=Gn(d,[["enter",m,i]]),d=Gn(d,pc(i.parser.constructs.insideSpan.null,e.slice(l+r+4,u-3),i)),d=Gn(d,[["exit",m,i],e[u-2],e[u-1],["exit",p,i]]),d=Gn(d,e.slice(u+1)),d=Gn(d,[["exit",h,i]]),es(e,l,e.length,d),e}function rA(e,i,a){const r=this,l=r._labelStarts;let u,d;if(l){for(;l.length>0&&l[l.length-1]._balanced;)l.pop();u=l[l.length-1]}return h;function h(v){return u?u._inactive?y(v):(d=r.parser.defined.includes(ts(r.sliceSerialize({start:u.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),p):a(v)}function p(v){return v===40?e.attempt(tA,x,d?x:y)(v):v===91?e.attempt(nA,x,d?m:y)(v):d?x(v):y(v)}function m(v){return e.attempt(sA,x,y)(v)}function x(v){return l.pop(),i(v)}function y(v){return u._balanced=!0,a(v)}}function oA(e,i,a){return r;function r(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),l}function l(y){return ht(y)?Jr(e,u)(y):u(y)}function u(y){return y===41?x(y):Dv(e,d,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return ht(y)?Jr(e,p)(y):x(y)}function h(y){return a(y)}function p(y){return y===34||y===39||y===40?_v(e,m,a,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):x(y)}function m(y){return ht(y)?Jr(e,x)(y):x(y)}function x(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),i):a(y)}}function lA(e,i,a){const r=this;return l;function l(h){return Lv.call(r,e,u,d,"reference","referenceMarker","referenceString")(h)}function u(h){return r.parser.defined.includes(ts(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?i(h):a(h)}function d(h){return a(h)}}function cA(e,i,a){return r;function r(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),l}function l(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),i):a(u)}}const uA={name:"labelStartImage",resolveAll:gf.resolveAll,tokenize:dA};function dA(e,i,a){const r=this;let l;return u;function u(p){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(p),e.exit("labelImageMarker"),d}function d(p){return p===91?(e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),l=e.exit("labelImage"),h):a(p)}function h(p){return p===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(p):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(l),i(p))}}const hA={name:"labelStartLink",resolveAll:gf.resolveAll,tokenize:fA};function fA(e,i,a){const r=this;let l;return u;function u(h){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),l=e.exit("labelLink"),d}function d(h){return h===94&&"_hiddenFootnoteSupport"in r.parser.constructs?a(h):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(l),i(h))}}const Vd={name:"lineEnding",tokenize:mA};function mA(e,i){return a;function a(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),et(e,i,"linePrefix")}}const Il={name:"thematicBreak",tokenize:pA};function pA(e,i,a){let r=0,l;return u;function u(m){return e.enter("thematicBreak"),d(m)}function d(m){return l=m,h(m)}function h(m){return m===l?(e.enter("thematicBreakSequence"),p(m)):r>=3&&(m===null||Me(m))?(e.exit("thematicBreak"),i(m)):a(m)}function p(m){return m===l?(e.consume(m),r++,p):(e.exit("thematicBreakSequence"),qe(m)?et(e,h,"whitespace")(m):h(m))}}const pn={continuation:{tokenize:bA},exit:wA,name:"list",tokenize:yA},gA={partial:!0,tokenize:jA},xA={partial:!0,tokenize:vA};function yA(e,i,a){const r=this,l=r.events[r.events.length-1];let u=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,d=0;return h;function h(b){const w=r.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||b===r.containerState.marker:Th(b)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Il,a,m)(b):m(b);if(!r.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return a(b)}function p(b){return Th(b)&&++d<10?(e.consume(b),p):(!r.interrupt||d<2)&&(r.containerState.marker?b===r.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):a(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||b,e.check(ho,r.interrupt?a:x,e.attempt(gA,v,y))}function x(b){return r.containerState.initialBlankLine=!0,u++,v(b)}function y(b){return qe(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),v):a(b)}function v(b){return r.containerState.size=u+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,i(b)}}function bA(e,i,a){const r=this;return r.containerState._closeFlow=void 0,e.check(ho,l,u);function l(h){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,i,"listItemIndent",r.containerState.size+1)(h)}function u(h){return r.containerState.furtherBlankLines||!qe(h)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,d(h)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(xA,i,d)(h))}function d(h){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(pn,i,a),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function vA(e,i,a){const r=this;return et(e,l,"listItemIndent",r.containerState.size+1);function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===r.containerState.size?i(u):a(u)}}function wA(e){e.exit(this.containerState.type)}function jA(e,i,a){const r=this;return et(e,l,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(u){const d=r.events[r.events.length-1];return!qe(u)&&d&&d[1].type==="listItemPrefixWhitespace"?i(u):a(u)}}const vy={name:"setextUnderline",resolveTo:kA,tokenize:SA};function kA(e,i){const a=new Jl;let r=e.length,l,u,d;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(u=r)}else e[r][1].type==="content"&&a.add(r,1,[]),!d&&e[r][1].type==="definition"&&(d=r);const h={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[u][1].type="setextHeadingText",d?(a.add(u,0,[["enter",h,i]]),a.add(d+1,0,[["exit",e[l][1],i]]),e[l][1].end={...e[d][1].end}):e[l][1]=h,a.add(e.length,0,[["exit",h,i]]),a.consume(e),e}function SA(e,i,a){const r=this;let l;return u;function u(m){let x=r.events.length,y;for(;x--;)if(r.events[x][1].type!=="lineEnding"&&r.events[x][1].type!=="linePrefix"&&r.events[x][1].type!=="content"){y=r.events[x][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||y)?(e.enter("setextHeadingLine"),l=m,d(m)):a(m)}function d(m){return e.enter("setextHeadingLineSequence"),h(m)}function h(m){return m===l?(e.consume(m),h):(e.exit("setextHeadingLineSequence"),qe(m)?et(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||Me(m)?(e.exit("setextHeadingLine"),i(m)):a(m)}}const CA={tokenize:AA};function AA(e){const i=this,a=e.attempt(ho,r,e.attempt(this.parser.constructs.flowInitial,l,et(e,e.attempt(this.parser.constructs.flow,l,e.attempt(M2,l)),"linePrefix")));return a;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),i.currentConstruct=void 0,a}function l(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),i.currentConstruct=void 0,a}}const NA={resolveAll:Uv()},TA=$v("string"),EA=$v("text");function $v(e){return{resolveAll:Uv(e==="text"?zA:void 0),tokenize:i};function i(a){const r=this,l=this.parser.constructs[e],u=a.attempt(l,d,h);return d;function d(x){return m(x)?u(x):h(x)}function h(x){if(x===null){a.consume(x);return}return a.enter("data"),a.consume(x),p}function p(x){return m(x)?(a.exit("data"),u(x)):(a.consume(x),p)}function m(x){if(x===null)return!0;const y=l[x];let v=-1;if(y)for(;++v<y.length;){const b=y[v];if(!b.previous||b.previous.call(r,r.previous))return!0}return!1}}}function Uv(e){return i;function i(a,r){let l=-1,u;for(;++l<=a.length;)u===void 0?a[l]&&a[l][1].type==="data"&&(u=l,l++):(!a[l]||a[l][1].type!=="data")&&(l!==u+2&&(a[u][1].end=a[l-1][1].end,a.splice(u+2,l-u-2),l=u+2),u=void 0);return e?e(a,r):a}}function zA(e,i){const a=new Jl;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const l=e[r-1][1],u=i.sliceStream(l);let d=u.length,h=-1,p=0,m;for(;d--;){const x=u[d];if(typeof x=="string"){for(h=x.length;x.charCodeAt(h-1)===32;)p++,h--;if(h)break;h=-1}else if(x===-2)m=!0,p++;else if(x!==-1){d++;break}}if(i._contentTypeTextTrailing&&r===e.length&&(p=0),p){const x={type:r===e.length||m||p<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:d?h:l.start._bufferIndex+h,_index:l.start._index+d,line:l.end.line,column:l.end.column-p,offset:l.end.offset-p},end:{...l.end}};l.end={...x.start},l.start.offset===l.end.offset?Object.assign(l,x):a.add(r,0,[["enter",x,i],["exit",x,i]])}r++}return a.consume(e),e}const OA={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:zv},RA={91:U2},MA={[-2]:Yd,[-1]:Yd,32:Yd},DA={35:G2,42:Il,45:[vy,Il],60:Z2,61:vy,95:Il,96:yy,126:yy},LA={38:Rv,92:Ov},_A={[-5]:Vd,[-4]:Vd,[-3]:Vd,33:uA,38:Rv,42:Eh,60:[m2,J2],91:hA,92:[q2,Ov],93:gf,95:Eh,96:N2},$A={null:[Eh,NA]},UA={null:[42,95]},IA={null:[]},BA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:UA,contentInitial:RA,disable:IA,document:OA,flow:DA,flowInitial:MA,insideSpan:$A,string:LA,text:_A},Symbol.toStringTag,{value:"Module"}));function HA(e,i,a){let r={_bufferIndex:-1,_index:0,line:a&&a.line||1,column:a&&a.column||1,offset:a&&a.offset||0};const l={},u=[];let d=[],h=[];const p={attempt:G(_),check:G($),consume:O,enter:T,exit:M,interrupt:G($,{interrupt:!0})},m={code:null,containerState:{},defineSkip:S,events:[],now:w,parser:e,previous:null,sliceSerialize:v,sliceStream:b,write:y};let x=i.tokenize.call(m,p);return i.resolveAll&&u.push(i),m;function y(I){return d=Gn(d,I),C(),d[d.length-1]!==null?[]:(J(i,0),m.events=pc(u,m.events,m),m.events)}function v(I,Q){return FA(b(I),Q)}function b(I){return qA(d,I)}function w(){const{_bufferIndex:I,_index:Q,line:ie,column:re,offset:Y}=r;return{_bufferIndex:I,_index:Q,line:ie,column:re,offset:Y}}function S(I){l[I.line]=I.column,E()}function C(){for(;r._index<d.length;){const I=d[r._index];if(typeof I=="string"){const Q=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===Q&&r._bufferIndex<I.length;)k(I.charCodeAt(r._bufferIndex))}else k(I)}}function k(I){x=x(I)}function O(I){Me(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,E()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===d[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=I}function T(I,Q){const ie=Q||{};return ie.type=I,ie.start=w(),m.events.push(["enter",ie,m]),h.push(ie),ie}function M(I){const Q=h.pop();return Q.end=w(),m.events.push(["exit",Q,m]),Q}function _(I,Q){J(I,Q.from)}function $(I,Q){Q.restore()}function G(I,Q){return ie;function ie(re,Y,F){let B,se,de,R;return Array.isArray(re)?ee(re):"tokenize"in re?ee([re]):D(re);function D(ve){return Te;function Te(Qe){const pe=Qe!==null&&ve[Qe],Fe=Qe!==null&&ve.null,Dt=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(Fe)?Fe:Fe?[Fe]:[]];return ee(Dt)(Qe)}}function ee(ve){return B=ve,se=0,ve.length===0?F:z(ve[se])}function z(ve){return Te;function Te(Qe){return R=U(),de=ve,ve.partial||(m.currentConstruct=ve),ve.name&&m.parser.constructs.disable.null.includes(ve.name)?Se():ve.tokenize.call(Q?Object.assign(Object.create(m),Q):m,p,X,Se)(Qe)}}function X(ve){return I(de,R),Y}function Se(ve){return R.restore(),++se<B.length?z(B[se]):F}}}function J(I,Q){I.resolveAll&&!u.includes(I)&&u.push(I),I.resolve&&es(m.events,Q,m.events.length-Q,I.resolve(m.events.slice(Q),m)),I.resolveTo&&(m.events=I.resolveTo(m.events,m))}function U(){const I=w(),Q=m.previous,ie=m.currentConstruct,re=m.events.length,Y=Array.from(h);return{from:re,restore:F};function F(){r=I,m.previous=Q,m.currentConstruct=ie,m.events.length=re,h=Y,E()}}function E(){r.line in l&&r.column<2&&(r.column=l[r.line],r.offset+=l[r.line]-1)}}function qA(e,i){const a=i.start._index,r=i.start._bufferIndex,l=i.end._index,u=i.end._bufferIndex;let d;if(a===l)d=[e[a].slice(r,u)];else{if(d=e.slice(a,l),r>-1){const h=d[0];typeof h=="string"?d[0]=h.slice(r):d.shift()}u>0&&d.push(e[l].slice(0,u))}return d}function FA(e,i){let a=-1;const r=[];let l;for(;++a<e.length;){const u=e[a];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
25
|
+
`;break}case-3:{d=`\r
|
|
26
|
+
`;break}case-2:{d=i?" ":" ";break}case-1:{if(!i&&l)continue;d=" ";break}default:d=String.fromCharCode(u)}l=u===-2,r.push(d)}return r.join("")}function GA(e){const r={constructs:Nv([BA,...(e||{}).extensions||[]]),content:l(o2),defined:[],document:l(c2),flow:l(CA),lazy:{},string:l(TA),text:l(EA)};return r;function l(u){return d;function d(h){return HA(r,u,h)}}}function PA(e){for(;!Mv(e););return e}const wy=/[\0\t\n\r]/g;function YA(){let e=1,i="",a=!0,r;return l;function l(u,d,h){u=i+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u));const p=[];let m=0;for(i="",a&&(u.charCodeAt(0)===65279&&m++,a=void 0);m<u.length;){wy.lastIndex=m;const x=wy.exec(u),y=x&&x.index!==void 0?x.index:u.length,v=u.charCodeAt(y);if(!x){i=u.slice(m);break}if(v===10&&m===y&&r)p.push(-3),r=void 0;else switch(r&&(p.push(-5),r=void 0),m<y&&(p.push(u.slice(m,y)),e+=y-m),v){case 0:{p.push(65533),e++;break}case 9:{const b=Math.ceil(e/4)*4;for(p.push(-2);e++<b;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:r=!0,e=1}m=y+1}return h&&(r&&p.push(-5),i&&p.push(i),p.push(null)),p}}const VA=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ZA(e){return e.replace(VA,XA)}function XA(e,i,a){if(i)return i;if(a.charCodeAt(0)===35){const l=a.charCodeAt(1),u=l===120||l===88;return Tv(a.slice(u?2:1),u?16:10)}return pf(a)||e}const Iv={}.hasOwnProperty;function QA(e,i,a){return i&&typeof i=="object"&&(a=i,i=void 0),KA(a)(PA(GA(a).document().write(YA()(e,i,!0))))}function KA(e){const i={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:d(wn),autolinkProtocol:E,autolinkEmail:E,atxHeading:d(Rn),blockQuote:d(Dt),characterEscape:E,characterReference:E,codeFenced:d(Kt),codeFencedFenceInfo:h,codeFencedFenceMeta:h,codeIndented:d(Kt,h),codeText:d(yn,h),codeTextData:E,data:E,codeFlowValue:E,definition:d(yt),definitionDestinationString:h,definitionLabelString:h,definitionTitleString:h,emphasis:d(bn),hardBreakEscape:d(Oe),hardBreakTrailing:d(Oe),htmlFlow:d(rt,h),htmlFlowData:E,htmlText:d(rt,h),htmlTextData:E,image:d(vn),label:h,link:d(wn),listItem:d(Xn),listItemValue:b,listOrdered:d(on,v),listUnordered:d(on),paragraph:d(Mn),reference:X,referenceString:h,resourceDestinationString:h,resourceTitleString:h,setextHeading:d(Rn),strong:d(Lt),thematicBreak:d(ms)},exit:{atxHeading:m(),atxHeadingSequence:$,autolink:m(),autolinkEmail:Fe,autolinkProtocol:pe,blockQuote:m(),characterEscapeValue:I,characterReferenceMarkerHexadecimal:ve,characterReferenceMarkerNumeric:ve,characterReferenceValue:Te,characterReference:Qe,codeFenced:m(k),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:I,codeIndented:m(O),codeText:m(F),codeTextData:I,data:I,definition:m(),definitionDestinationString:_,definitionLabelString:T,definitionTitleString:M,emphasis:m(),hardBreakEscape:m(ie),hardBreakTrailing:m(ie),htmlFlow:m(re),htmlFlowData:I,htmlText:m(Y),htmlTextData:I,image:m(se),label:R,labelText:de,lineEnding:Q,link:m(B),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Se,resourceDestinationString:D,resourceTitleString:ee,resource:z,setextHeading:m(U),setextHeadingLineSequence:J,setextHeadingText:G,strong:m(),thematicBreak:m()}};Bv(i,(e||{}).mdastExtensions||[]);const a={};return r;function r(ne){let fe={type:"root",children:[],position:void 0};const De={stack:[fe],tokenStack:[],config:i,enter:p,exit:x,buffer:h,resume:y,data:a},Le=[],Ut=[];let st=-1;for(;++st<ne.length;)if(Ut.push(ne[st]),ne[st][1].type==="listOrdered"||ne[st][1].type==="listUnordered")if(ne[st][0]==="enter")Le.push(Ut.length-1);else{const bt=Le.pop();u(Ut,bt)}for(ne=Ut,st=-1;++st<ne.length;){const bt=i[ne[st][0]];ne[st][0]==="enter"&&i.beforeEnter.length>0&&l(i.beforeEnter,{...De,sliceSerialize:ne[st][2].sliceSerialize},ne[st][1]),Iv.call(bt,ne[st][1].type)&&bt[ne[st][1].type].call({...De,sliceSerialize:ne[st][2].sliceSerialize},ne[st][1]),ne[st][0]==="exit"&&i.afterExit.length>0&&l(i.afterExit,{...De,sliceSerialize:ne[st][2].sliceSerialize},ne[st][1])}if(De.tokenStack.length>0){const bt=De.tokenStack[De.tokenStack.length-1];(bt[1]||jy).call(De,void 0,bt[0])}for(fe.position={start:fi(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:fi(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},st=-1;++st<i.transforms.length;)fe=i.transforms[st](fe)||fe;return fe}function l(ne,fe,De){let Le=-1;for(;++Le<ne.length;)ne[Le].call(fe,De)}function u(ne,fe){const De=ne.length-1;let Le=fe-1,Ut=-1,st=!1,bt,Ke,Wt,At;const ps=[];for(;++Le<=De;){const Nt=ne[Le];switch(Nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Nt[0]==="enter"?Ut++:Ut--,At=void 0;break}case"lineEndingBlank":{Nt[0]==="enter"&&(bt&&!At&&!Ut&&!Wt&&(Wt=Le),At=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:At=void 0}if(!Ut&&Nt[0]==="enter"&&Nt[1].type==="listItemPrefix"||Ut===-1&&Nt[0]==="exit"&&(Nt[1].type==="listUnordered"||Nt[1].type==="listOrdered")){if(bt){let jn=Le;for(Ke=void 0;jn--;){const he=ne[jn];if(he[1].type==="lineEnding"||he[1].type==="lineEndingBlank"){if(he[0]==="exit")continue;Ke&&(ne[Ke][1].type="lineEndingBlank",st=!0),he[1].type="lineEnding",Ke=jn}else if(!(he[1].type==="linePrefix"||he[1].type==="blockQuotePrefix"||he[1].type==="blockQuotePrefixWhitespace"||he[1].type==="blockQuoteMarker"||he[1].type==="listItemIndent"))break}Wt&&(!Ke||Wt<Ke)&&(bt._spread=!0),bt.end=Object.assign({},Ke?ne[Ke][1].start:Nt[1].end),ps.push({at:Ke||Le,event:["exit",bt,Nt[2]]})}if(Nt[1].type==="listItemPrefix"){const jn={type:"listItem",_spread:!1,start:Object.assign({},Nt[1].start),end:void 0};bt=jn,ps.push({at:Le,event:["enter",jn,Nt[2]]}),Wt=void 0,At=!0}}}const Qi=ne.splice(fe);let bi=0;for(Le=-1;++Le<Qi.length;){for(;bi<ps.length&&ps[bi].at===fe+Le;)ne.push(ps[bi++].event);ne.push(Qi[Le])}ne[fe][1]._spread=st}function d(ne,fe){return De;function De(Le){p.call(this,ne(Le),Le),fe&&fe.call(this,Le)}}function h(){this.stack.push({type:"fragment",children:[]})}function p(ne,fe,De){this.stack[this.stack.length-1].children.push(ne),this.stack.push(ne),this.tokenStack.push([fe,De||void 0]),ne.position={start:fi(fe.start),end:void 0}}function m(ne){return fe;function fe(De){ne&&ne.call(this,De),x.call(this,De)}}function x(ne,fe){const De=this.stack.pop(),Le=this.tokenStack.pop();if(!Le)throw new Error("Cannot close `"+ne.type+"` ("+Wr({start:ne.start,end:ne.end})+"): it’s not open");Le[0].type!==ne.type&&(fe?fe.call(this,ne,Le[0]):(Le[1]||jy).call(this,ne,Le[0])),De.position.end=fi(ne.end)}function y(){return mf(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function b(ne){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(ne),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=ne}function S(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=ne}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function O(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne.replace(/(\r?\n|\r)$/g,"")}function T(ne){const fe=this.resume(),De=this.stack[this.stack.length-1];De.label=fe,De.identifier=ts(this.sliceSerialize(ne)).toLowerCase()}function M(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function _(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function $(ne){const fe=this.stack[this.stack.length-1];if(!fe.depth){const De=this.sliceSerialize(ne).length;fe.depth=De}}function G(){this.data.setextHeadingSlurpLineEnding=!0}function J(ne){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(ne).codePointAt(0)===61?1:2}function U(){this.data.setextHeadingSlurpLineEnding=void 0}function E(ne){const De=this.stack[this.stack.length-1].children;let Le=De[De.length-1];(!Le||Le.type!=="text")&&(Le=nn(),Le.position={start:fi(ne.start),end:void 0},De.push(Le)),this.stack.push(Le)}function I(ne){const fe=this.stack.pop();fe.value+=this.sliceSerialize(ne),fe.position.end=fi(ne.end)}function Q(ne){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const De=fe.children[fe.children.length-1];De.position.end=fi(ne.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes(fe.type)&&(E.call(this,ne),I.call(this,ne))}function ie(){this.data.atHardBreak=!0}function re(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function Y(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function F(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.value=ne}function B(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function se(){const ne=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";ne.type+="Reference",ne.referenceType=fe,delete ne.url,delete ne.title}else delete ne.identifier,delete ne.label;this.data.referenceType=void 0}function de(ne){const fe=this.sliceSerialize(ne),De=this.stack[this.stack.length-2];De.label=ZA(fe),De.identifier=ts(fe).toLowerCase()}function R(){const ne=this.stack[this.stack.length-1],fe=this.resume(),De=this.stack[this.stack.length-1];if(this.data.inReference=!0,De.type==="link"){const Le=ne.children;De.children=Le}else De.alt=fe}function D(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.url=ne}function ee(){const ne=this.resume(),fe=this.stack[this.stack.length-1];fe.title=ne}function z(){this.data.inReference=void 0}function X(){this.data.referenceType="collapsed"}function Se(ne){const fe=this.resume(),De=this.stack[this.stack.length-1];De.label=fe,De.identifier=ts(this.sliceSerialize(ne)).toLowerCase(),this.data.referenceType="full"}function ve(ne){this.data.characterReferenceType=ne.type}function Te(ne){const fe=this.sliceSerialize(ne),De=this.data.characterReferenceType;let Le;De?(Le=Tv(fe,De==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Le=pf(fe);const Ut=this.stack[this.stack.length-1];Ut.value+=Le}function Qe(ne){const fe=this.stack.pop();fe.position.end=fi(ne.end)}function pe(ne){I.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(ne)}function Fe(ne){I.call(this,ne);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(ne)}function Dt(){return{type:"blockquote",children:[],position:void 0}}function Kt(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function yn(){return{type:"inlineCode",value:"",position:void 0}}function yt(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function bn(){return{type:"emphasis",children:[],position:void 0}}function Rn(){return{type:"heading",depth:0,children:[],position:void 0}}function Oe(){return{type:"break",position:void 0}}function rt(){return{type:"html",value:"",position:void 0}}function vn(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function wn(){return{type:"link",title:null,url:"",children:[],position:void 0}}function on(ne){return{type:"list",ordered:ne.type==="listOrdered",start:null,spread:ne._spread,children:[],position:void 0}}function Xn(ne){return{type:"listItem",spread:ne._spread,checked:null,children:[],position:void 0}}function Mn(){return{type:"paragraph",children:[],position:void 0}}function Lt(){return{type:"strong",children:[],position:void 0}}function nn(){return{type:"text",value:"",position:void 0}}function ms(){return{type:"thematicBreak",position:void 0}}}function fi(e){return{line:e.line,column:e.column,offset:e.offset}}function Bv(e,i){let a=-1;for(;++a<i.length;){const r=i[a];Array.isArray(r)?Bv(e,r):WA(e,r)}}function WA(e,i){let a;for(a in i)if(Iv.call(i,a))switch(a){case"canContainEols":{const r=i[a];r&&e[a].push(...r);break}case"transforms":{const r=i[a];r&&e[a].push(...r);break}case"afterExit":case"beforeEnter":{const r=i[a];r&&e[a].push(r);break}case"enter":case"exit":{const r=i[a];r&&Object.assign(e[a],r);break}}}function jy(e,i){throw e?new Error("Cannot close `"+e.type+"` ("+Wr({start:e.start,end:e.end})+"): a different token (`"+i.type+"`, "+Wr({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+Wr({start:i.start,end:i.end})+") is still open")}function JA(e){const i=this;i.parser=a;function a(r){return QA(r,{...i.data("settings"),...e,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function eN(e,i){const a={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(i),!0)};return e.patch(i,a),e.applyData(i,a)}function tN(e,i){const a={type:"element",tagName:"br",properties:{},children:[]};return e.patch(i,a),[e.applyData(i,a),{type:"text",value:`
|
|
27
|
+
`}]}function nN(e,i){const a=i.value?i.value+`
|
|
28
|
+
`:"",r={},l=i.lang?i.lang.split(/\s+/):[];l.length>0&&(r.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:r,children:[{type:"text",value:a}]};return i.meta&&(u.data={meta:i.meta}),e.patch(i,u),u=e.applyData(i,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(i,u),u}function sN(e,i){const a={type:"element",tagName:"del",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function iN(e,i){const a={type:"element",tagName:"em",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function aN(e,i){const a=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(i.identifier).toUpperCase(),l=Pa(r.toLowerCase()),u=e.footnoteOrder.indexOf(r);let d,h=e.footnoteCounts.get(r);h===void 0?(h=0,e.footnoteOrder.push(r),d=e.footnoteOrder.length):d=u+1,h+=1,e.footnoteCounts.set(r,h);const p={type:"element",tagName:"a",properties:{href:"#"+a+"fn-"+l,id:a+"fnref-"+l+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(i,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(i,m),e.applyData(i,m)}function rN(e,i){const a={type:"element",tagName:"h"+i.depth,properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function oN(e,i){if(e.options.allowDangerousHtml){const a={type:"raw",value:i.value};return e.patch(i,a),e.applyData(i,a)}}function Hv(e,i){const a=i.referenceType;let r="]";if(a==="collapsed"?r+="[]":a==="full"&&(r+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+r}];const l=e.all(i),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const d=l[l.length-1];return d&&d.type==="text"?d.value+=r:l.push({type:"text",value:r}),l}function lN(e,i){const a=String(i.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return Hv(e,i);const l={src:Pa(r.url||""),alt:i.alt};r.title!==null&&r.title!==void 0&&(l.title=r.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(i,u),e.applyData(i,u)}function cN(e,i){const a={src:Pa(i.url)};i.alt!==null&&i.alt!==void 0&&(a.alt=i.alt),i.title!==null&&i.title!==void 0&&(a.title=i.title);const r={type:"element",tagName:"img",properties:a,children:[]};return e.patch(i,r),e.applyData(i,r)}function uN(e,i){const a={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};e.patch(i,a);const r={type:"element",tagName:"code",properties:{},children:[a]};return e.patch(i,r),e.applyData(i,r)}function dN(e,i){const a=String(i.identifier).toUpperCase(),r=e.definitionById.get(a);if(!r)return Hv(e,i);const l={href:Pa(r.url||"")};r.title!==null&&r.title!==void 0&&(l.title=r.title);const u={type:"element",tagName:"a",properties:l,children:e.all(i)};return e.patch(i,u),e.applyData(i,u)}function hN(e,i){const a={href:Pa(i.url)};i.title!==null&&i.title!==void 0&&(a.title=i.title);const r={type:"element",tagName:"a",properties:a,children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function fN(e,i,a){const r=e.all(i),l=a?mN(a):qv(i),u={},d=[];if(typeof i.checked=="boolean"){const x=r[0];let y;x&&x.type==="element"&&x.tagName==="p"?y=x:(y={type:"element",tagName:"p",properties:{},children:[]},r.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let h=-1;for(;++h<r.length;){const x=r[h];(l||h!==0||x.type!=="element"||x.tagName!=="p")&&d.push({type:"text",value:`
|
|
29
|
+
`}),x.type==="element"&&x.tagName==="p"&&!l?d.push(...x.children):d.push(x)}const p=r[r.length-1];p&&(l||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
|
|
30
|
+
`});const m={type:"element",tagName:"li",properties:u,children:d};return e.patch(i,m),e.applyData(i,m)}function mN(e){let i=!1;if(e.type==="list"){i=e.spread||!1;const a=e.children;let r=-1;for(;!i&&++r<a.length;)i=qv(a[r])}return i}function qv(e){const i=e.spread;return i??e.children.length>1}function pN(e,i){const a={},r=e.all(i);let l=-1;for(typeof i.start=="number"&&i.start!==1&&(a.start=i.start);++l<r.length;){const d=r[l];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){a.className=["contains-task-list"];break}}const u={type:"element",tagName:i.ordered?"ol":"ul",properties:a,children:e.wrap(r,!0)};return e.patch(i,u),e.applyData(i,u)}function gN(e,i){const a={type:"element",tagName:"p",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function xN(e,i){const a={type:"root",children:e.wrap(e.all(i))};return e.patch(i,a),e.applyData(i,a)}function yN(e,i){const a={type:"element",tagName:"strong",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}function bN(e,i){const a=e.all(i),r=a.shift(),l=[];if(r){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(i.children[0],d),l.push(d)}if(a.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(a,!0)},h=uf(i.children[1]),p=vv(i.children[i.children.length-1]);h&&p&&(d.position={start:h,end:p}),l.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(l,!0)};return e.patch(i,u),e.applyData(i,u)}function vN(e,i,a){const r=a?a.children:void 0,u=(r?r.indexOf(i):1)===0?"th":"td",d=a&&a.type==="table"?a.align:void 0,h=d?d.length:i.children.length;let p=-1;const m=[];for(;++p<h;){const y=i.children[p],v={},b=d?d[p]:void 0;b&&(v.align=b);let w={type:"element",tagName:u,properties:v,children:[]};y&&(w.children=e.all(y),e.patch(y,w),w=e.applyData(y,w)),m.push(w)}const x={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(i,x),e.applyData(i,x)}function wN(e,i){const a={type:"element",tagName:"td",properties:{},children:e.all(i)};return e.patch(i,a),e.applyData(i,a)}const ky=9,Sy=32;function jN(e){const i=String(e),a=/\r?\n|\r/g;let r=a.exec(i),l=0;const u=[];for(;r;)u.push(Cy(i.slice(l,r.index),l>0,!0),r[0]),l=r.index+r[0].length,r=a.exec(i);return u.push(Cy(i.slice(l),l>0,!1)),u.join("")}function Cy(e,i,a){let r=0,l=e.length;if(i){let u=e.codePointAt(r);for(;u===ky||u===Sy;)r++,u=e.codePointAt(r)}if(a){let u=e.codePointAt(l-1);for(;u===ky||u===Sy;)l--,u=e.codePointAt(l-1)}return l>r?e.slice(r,l):""}function kN(e,i){const a={type:"text",value:jN(String(i.value))};return e.patch(i,a),e.applyData(i,a)}function SN(e,i){const a={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(i,a),e.applyData(i,a)}const CN={blockquote:eN,break:tN,code:nN,delete:sN,emphasis:iN,footnoteReference:aN,heading:rN,html:oN,imageReference:lN,image:cN,inlineCode:uN,linkReference:dN,link:hN,listItem:fN,list:pN,paragraph:gN,root:xN,strong:yN,table:bN,tableCell:wN,tableRow:vN,text:kN,thematicBreak:SN,toml:zl,yaml:zl,definition:zl,footnoteDefinition:zl};function zl(){}const Fv=-1,gc=0,eo=1,tc=2,xf=3,yf=4,bf=5,vf=6,Gv=7,Pv=8,{defineProperty:AN}=Object,Yv=typeof self=="object"?self:globalThis,Ay=(e,i)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new Yv[e](i)},NN=(e,i)=>{const a=(l,u)=>(e.set(u,l),l),r=l=>{if(e.has(l))return e.get(l);const[u,d]=i[l];switch(u){case gc:case Fv:return a(d,l);case eo:{const h=a([],l);for(const p of d)h.push(r(p));return h}case tc:{const h=a({},l);for(const[p,m]of d){const x=r(p),y=r(m);x==="__proto__"?AN(h,x,{value:y,configurable:!0,enumerable:!0,writable:!0}):h[x]=y}return h}case xf:return a(new Date(d),l);case yf:{const{source:h,flags:p}=d;return a(new RegExp(h,p),l)}case bf:{const h=a(new Map,l);for(const[p,m]of d)h.set(r(p),r(m));return h}case vf:{const h=a(new Set,l);for(const p of d)h.add(r(p));return h}case Gv:{const{name:h,message:p}=d;return a(typeof Yv[h]=="function"?Ay(h,p):new Error(p),l)}case Pv:return a(BigInt(d),l);case"BigInt":return a(Object(BigInt(d)),l);case"ArrayBuffer":return a(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:h}=new Uint8Array(d);return a(new DataView(h),d)}case"-0":return-0}return a(Ay(u,d),l)};return r},Ny=e=>NN(new Map,e)(0),Bi="",{toString:TN}={},{keys:EN,is:zN}=Object,Gr=e=>{const i=typeof e;if(i!=="object"||!e)return[gc,i];const a=TN.call(e).slice(8,-1);switch(a){case"Array":return[eo,Bi];case"Object":return[tc,Bi];case"Date":return[xf,Bi];case"RegExp":return[yf,Bi];case"Map":return[bf,Bi];case"Set":return[vf,Bi];case"DataView":return[eo,a]}return a.includes("Array")?[eo,a]:e instanceof Error?[Gv,e.name||"Error"]:[tc,a]},Ol=([e,i])=>e===gc&&(i==="function"||i==="symbol"),ON=(e,i,a,r)=>{const l=(d,h)=>{const p=r.push(d)-1;return a.set(h,p),p},u=d=>{if(a.has(d))return a.get(d);let[h,p]=Gr(d);switch(h){case gc:{let x=d;switch(p){case"bigint":h=Pv,x=d.toString();break;case"number":if(!d&&zN(d,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);x=null;break;case"undefined":return l([Fv],d)}return l([h,x],d)}case eo:{if(p){let v=d;return p==="DataView"?v=new Uint8Array(d.buffer):p==="ArrayBuffer"&&(v=new Uint8Array(d)),l([p,[...v]],d)}const x=[],y=l([h,x],d);for(const v of d)x.push(u(v));return y}case tc:{if(p)switch(p){case"BigInt":return l([p,d.toString()],d);case"Boolean":case"Number":case"String":return l([p,d.valueOf()],d)}if(i&&"toJSON"in d)return u(d.toJSON());const x=[],y=l([h,x],d);for(const v of EN(d))(e||!Ol(Gr(d[v])))&&x.push([u(v),u(d[v])]);return y}case xf:return l([h,isNaN(d.getTime())?Bi:d.toISOString()],d);case yf:{const{source:x,flags:y}=d;return l([h,{source:x,flags:y}],d)}case bf:{const x=[],y=l([h,x],d);for(const[v,b]of d)(e||!(Ol(Gr(v))||Ol(Gr(b))))&&x.push([u(v),u(b)]);return y}case vf:{const x=[],y=l([h,x],d);for(const v of d)(e||!Ol(Gr(v)))&&x.push(u(v));return y}}const{message:m}=d;return l([h,{name:p,message:m}],d)};return u},Ty=(e,{json:i,lossy:a}={})=>{const r=[];return ON(!(i||a),!!i,new Map,r)(e),r},nc=typeof structuredClone=="function"?(e,i)=>i&&("json"in i||"lossy"in i)?Ny(Ty(e,i)):structuredClone(e):(e,i)=>Ny(Ty(e,i));function RN(e,i){const a=[{type:"text",value:"↩"}];return i>1&&a.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),a}function MN(e,i){return"Back to reference "+(e+1)+(i>1?"-"+i:"")}function DN(e){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=e.options.footnoteBackContent||RN,r=e.options.footnoteBackLabel||MN,l=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const x=e.all(m),y=String(m.identifier).toUpperCase(),v=Pa(y.toLowerCase());let b=0;const w=[],S=e.footnoteCounts.get(y);for(;S!==void 0&&++b<=S;){w.length>0&&w.push({type:"text",value:" "});let O=typeof a=="string"?a:a(p,b);typeof O=="string"&&(O={type:"text",value:O}),w.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+v+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(p,b),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const C=x[x.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const O=C.children[C.children.length-1];O&&O.type==="text"?O.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else x.push(...w);const k={type:"element",tagName:"li",properties:{id:i+"fn-"+v},children:e.wrap(x,!0)};e.patch(m,k),h.push(k)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...nc(d),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:`
|
|
31
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
|
|
32
|
+
`}]}}const xc=(function(e){if(e==null)return UN;if(typeof e=="function")return yc(e);if(typeof e=="object")return Array.isArray(e)?LN(e):_N(e);if(typeof e=="string")return $N(e);throw new Error("Expected function, string, or object as test")});function LN(e){const i=[];let a=-1;for(;++a<e.length;)i[a]=xc(e[a]);return yc(r);function r(...l){let u=-1;for(;++u<i.length;)if(i[u].apply(this,l))return!0;return!1}}function _N(e){const i=e;return yc(a);function a(r){const l=r;let u;for(u in e)if(l[u]!==i[u])return!1;return!0}}function $N(e){return yc(i);function i(a){return a&&a.type===e}}function yc(e){return i;function i(a,r,l){return!!(IN(a)&&e.call(this,a,typeof r=="number"?r:void 0,l||void 0))}}function UN(){return!0}function IN(e){return e!==null&&typeof e=="object"&&"type"in e}const Vv=[],BN=!0,Oh=!1,HN="skip";function Zv(e,i,a,r){let l;typeof i=="function"&&typeof a!="function"?(r=a,a=i):l=i;const u=xc(l),d=r?-1:1;h(e,void 0,[])();function h(p,m,x){const y=p&&typeof p=="object"?p:{};if(typeof y.type=="string"){const b=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return v;function v(){let b=Vv,w,S,C;if((!i||u(p,m,x[x.length-1]||void 0))&&(b=qN(a(p,x)),b[0]===Oh))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==HN)for(S=(r?k.children.length:-1)+d,C=x.concat(k);S>-1&&S<k.children.length;){const O=k.children[S];if(w=h(O,S,C)(),w[0]===Oh)return w;S=typeof w[1]=="number"?w[1]:S+d}}return b}}}function qN(e){return Array.isArray(e)?e:typeof e=="number"?[BN,e]:e==null?Vv:[e]}function wf(e,i,a,r){let l,u,d;typeof i=="function"&&typeof a!="function"?(u=void 0,d=i,l=a):(u=i,d=a,l=r),Zv(e,u,h,l);function h(p,m){const x=m[m.length-1],y=x?x.children.indexOf(p):void 0;return d(p,y,x)}}const Rh={}.hasOwnProperty,FN={};function GN(e,i){const a=i||FN,r=new Map,l=new Map,u=new Map,d={...CN,...a.handlers},h={all:m,applyData:YN,definitionById:r,footnoteById:l,footnoteCounts:u,footnoteOrder:[],handlers:d,one:p,options:a,patch:PN,wrap:ZN};return wf(e,function(x){if(x.type==="definition"||x.type==="footnoteDefinition"){const y=x.type==="definition"?r:l,v=String(x.identifier).toUpperCase();y.has(v)||y.set(v,x)}}),h;function p(x,y){const v=x.type,b=h.handlers[v];if(Rh.call(h.handlers,v)&&b)return b(h,x,y);if(h.options.passThrough&&h.options.passThrough.includes(v)){if("children"in x){const{children:S,...C}=x,k=nc(C);return k.children=h.all(x),k}return nc(x)}return(h.options.unknownHandler||VN)(h,x,y)}function m(x){const y=[];if("children"in x){const v=x.children;let b=-1;for(;++b<v.length;){const w=h.one(v[b],x);if(w){if(b&&v[b-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Ey(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=Ey(S.value))}Array.isArray(w)?y.push(...w):y.push(w)}}}return y}}function PN(e,i){e.position&&(i.position=MC(e))}function YN(e,i){let a=i;if(e&&e.data){const r=e.data.hName,l=e.data.hChildren,u=e.data.hProperties;if(typeof r=="string")if(a.type==="element")a.tagName=r;else{const d="children"in a?a.children:[a];a={type:"element",tagName:r,properties:{},children:d}}a.type==="element"&&u&&Object.assign(a.properties,nc(u)),"children"in a&&a.children&&l!==null&&l!==void 0&&(a.children=l)}return a}function VN(e,i){const a=i.data||{},r="value"in i&&!(Rh.call(a,"hProperties")||Rh.call(a,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:e.all(i)};return e.patch(i,r),e.applyData(i,r)}function ZN(e,i){const a=[];let r=-1;for(i&&a.push({type:"text",value:`
|
|
33
|
+
`});++r<e.length;)r&&a.push({type:"text",value:`
|
|
34
|
+
`}),a.push(e[r]);return i&&e.length>0&&a.push({type:"text",value:`
|
|
35
|
+
`}),a}function Ey(e){let i=0,a=e.charCodeAt(i);for(;a===9||a===32;)i++,a=e.charCodeAt(i);return e.slice(i)}function zy(e,i){const a=GN(e,i),r=a.one(e,void 0),l=DN(a),u=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return l&&u.children.push({type:"text",value:`
|
|
36
|
+
`},l),u}function XN(e,i){return e&&"run"in e?async function(a,r){const l=zy(a,{file:r,...i});await e.run(l,r)}:function(a,r){return zy(a,{file:r,...e||i})}}function Oy(e){if(e)throw e}var Zd,Ry;function QN(){if(Ry)return Zd;Ry=1;var e=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=function(m){return typeof Array.isArray=="function"?Array.isArray(m):i.call(m)==="[object Array]"},u=function(m){if(!m||i.call(m)!=="[object Object]")return!1;var x=e.call(m,"constructor"),y=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!x&&!y)return!1;var v;for(v in m);return typeof v>"u"||e.call(m,v)},d=function(m,x){a&&x.name==="__proto__"?a(m,x.name,{enumerable:!0,configurable:!0,value:x.newValue,writable:!0}):m[x.name]=x.newValue},h=function(m,x){if(x==="__proto__")if(e.call(m,x)){if(r)return r(m,x).value}else return;return m[x]};return Zd=function p(){var m,x,y,v,b,w,S=arguments[0],C=1,k=arguments.length,O=!1;for(typeof S=="boolean"&&(O=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(m=arguments[C],m!=null)for(x in m)y=h(S,x),v=h(m,x),S!==v&&(O&&v&&(u(v)||(b=l(v)))?(b?(b=!1,w=y&&l(y)?y:[]):w=y&&u(y)?y:{},d(S,{name:x,newValue:p(O,w,v)})):typeof v<"u"&&d(S,{name:x,newValue:v}));return S},Zd}var KN=QN();const Xd=Ab(KN);function Mh(e){if(typeof e!="object"||e===null)return!1;const i=Object.getPrototypeOf(e);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function WN(){const e=[],i={run:a,use:r};return i;function a(...l){let u=-1;const d=l.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);h(null,...l);function h(p,...m){const x=e[++u];let y=-1;if(p){d(p);return}for(;++y<l.length;)(m[y]===null||m[y]===void 0)&&(m[y]=l[y]);l=m,x?JN(x,h)(...m):d(null,...m)}}function r(l){if(typeof l!="function")throw new TypeError("Expected `middelware` to be a function, not "+l);return e.push(l),i}}function JN(e,i){let a;return r;function r(...d){const h=e.length>d.length;let p;h&&d.push(l);try{p=e.apply(this,d)}catch(m){const x=m;if(h&&a)throw x;return l(x)}h||(p&&p.then&&typeof p.then=="function"?p.then(u,l):p instanceof Error?l(p):u(p))}function l(d,...h){a||(a=!0,i(d,...h))}function u(d){l(null,d)}}const ls={basename:eT,dirname:tT,extname:nT,join:sT,sep:"/"};function eT(e,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');fo(e);let a=0,r=-1,l=e.length,u;if(i===void 0||i.length===0||i.length>e.length){for(;l--;)if(e.codePointAt(l)===47){if(u){a=l+1;break}}else r<0&&(u=!0,r=l+1);return r<0?"":e.slice(a,r)}if(i===e)return"";let d=-1,h=i.length-1;for(;l--;)if(e.codePointAt(l)===47){if(u){a=l+1;break}}else d<0&&(u=!0,d=l+1),h>-1&&(e.codePointAt(l)===i.codePointAt(h--)?h<0&&(r=l):(h=-1,r=d));return a===r?r=d:r<0&&(r=e.length),e.slice(a,r)}function tT(e){if(fo(e),e.length===0)return".";let i=-1,a=e.length,r;for(;--a;)if(e.codePointAt(a)===47){if(r){i=a;break}}else r||(r=!0);return i<0?e.codePointAt(0)===47?"/":".":i===1&&e.codePointAt(0)===47?"//":e.slice(0,i)}function nT(e){fo(e);let i=e.length,a=-1,r=0,l=-1,u=0,d;for(;i--;){const h=e.codePointAt(i);if(h===47){if(d){r=i+1;break}continue}a<0&&(d=!0,a=i+1),h===46?l<0?l=i:u!==1&&(u=1):l>-1&&(u=-1)}return l<0||a<0||u===0||u===1&&l===a-1&&l===r+1?"":e.slice(l,a)}function sT(...e){let i=-1,a;for(;++i<e.length;)fo(e[i]),e[i]&&(a=a===void 0?e[i]:a+"/"+e[i]);return a===void 0?".":iT(a)}function iT(e){fo(e);const i=e.codePointAt(0)===47;let a=aT(e,!i);return a.length===0&&!i&&(a="."),a.length>0&&e.codePointAt(e.length-1)===47&&(a+="/"),i?"/"+a:a}function aT(e,i){let a="",r=0,l=-1,u=0,d=-1,h,p;for(;++d<=e.length;){if(d<e.length)h=e.codePointAt(d);else{if(h===47)break;h=47}if(h===47){if(!(l===d-1||u===1))if(l!==d-1&&u===2){if(a.length<2||r!==2||a.codePointAt(a.length-1)!==46||a.codePointAt(a.length-2)!==46){if(a.length>2){if(p=a.lastIndexOf("/"),p!==a.length-1){p<0?(a="",r=0):(a=a.slice(0,p),r=a.length-1-a.lastIndexOf("/")),l=d,u=0;continue}}else if(a.length>0){a="",r=0,l=d,u=0;continue}}i&&(a=a.length>0?a+"/..":"..",r=2)}else a.length>0?a+="/"+e.slice(l+1,d):a=e.slice(l+1,d),r=d-l-1;l=d,u=0}else h===46&&u>-1?u++:u=-1}return a}function fo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rT={cwd:oT};function oT(){return"/"}function Dh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function lT(e){if(typeof e=="string")e=new URL(e);else if(!Dh(e)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(e.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return cT(e)}function cT(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const i=e.pathname;let a=-1;for(;++a<i.length;)if(i.codePointAt(a)===37&&i.codePointAt(a+1)===50){const r=i.codePointAt(a+2);if(r===70||r===102){const l=new TypeError("File URL path must not include encoded / characters");throw l.code="ERR_INVALID_FILE_URL_PATH",l}}return decodeURIComponent(i)}const Qd=["history","path","basename","stem","extname","dirname"];class Xv{constructor(i){let a;i?Dh(i)?a={path:i}:typeof i=="string"||uT(i)?a={value:i}:a=i:a={},this.cwd="cwd"in a?"":rT.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Qd.length;){const u=Qd[r];u in a&&a[u]!==void 0&&a[u]!==null&&(this[u]=u==="history"?[...a[u]]:a[u])}let l;for(l in a)Qd.includes(l)||(this[l]=a[l])}get basename(){return typeof this.path=="string"?ls.basename(this.path):void 0}set basename(i){Wd(i,"basename"),Kd(i,"basename"),this.path=ls.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?ls.dirname(this.path):void 0}set dirname(i){My(this.basename,"dirname"),this.path=ls.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?ls.extname(this.path):void 0}set extname(i){if(Kd(i,"extname"),My(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ls.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){Dh(i)&&(i=lT(i)),Wd(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?ls.basename(this.path,this.extname):void 0}set stem(i){Wd(i,"stem"),Kd(i,"stem"),this.path=ls.join(this.dirname||"",i+(this.extname||""))}fail(i,a,r){const l=this.message(i,a,r);throw l.fatal=!0,l}info(i,a,r){const l=this.message(i,a,r);return l.fatal=void 0,l}message(i,a,r){const l=new tn(i,a,r);return this.path&&(l.name=this.path+":"+l.name,l.file=this.path),l.fatal=!1,this.messages.push(l),l}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function Kd(e,i){if(e&&e.includes(ls.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+ls.sep+"`")}function Wd(e,i){if(!e)throw new Error("`"+i+"` cannot be empty")}function My(e,i){if(!e)throw new Error("Setting `"+i+"` requires `path` to be set too")}function uT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const dT=(function(e){const r=this.constructor.prototype,l=r[e],u=function(){return l.apply(u,arguments)};return Object.setPrototypeOf(u,r),u}),hT={}.hasOwnProperty;class jf extends dT{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=WN()}copy(){const i=new jf;let a=-1;for(;++a<this.attachers.length;){const r=this.attachers[a];i.use(...r)}return i.data(Xd(!0,{},this.namespace)),i}data(i,a){return typeof i=="string"?arguments.length===2?(th("data",this.frozen),this.namespace[i]=a,this):hT.call(this.namespace,i)&&this.namespace[i]||void 0:i?(th("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[a,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const l=a.call(i,...r);typeof l=="function"&&this.transformers.use(l)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const a=Rl(i),r=this.parser||this.Parser;return Jd("parse",r),r(String(a),a)}process(i,a){const r=this;return this.freeze(),Jd("process",this.parser||this.Parser),eh("process",this.compiler||this.Compiler),a?l(void 0,a):new Promise(l);function l(u,d){const h=Rl(i),p=r.parse(h);r.run(p,h,function(x,y,v){if(x||!y||!v)return m(x);const b=y,w=r.stringify(b,v);pT(w)?v.value=w:v.result=w,m(x,v)});function m(x,y){x||!y?d(x):u?u(y):a(void 0,y)}}}processSync(i){let a=!1,r;return this.freeze(),Jd("processSync",this.parser||this.Parser),eh("processSync",this.compiler||this.Compiler),this.process(i,l),Ly("processSync","process",a),r;function l(u,d){a=!0,Oy(u),r=d}}run(i,a,r){Dy(i),this.freeze();const l=this.transformers;return!r&&typeof a=="function"&&(r=a,a=void 0),r?u(void 0,r):new Promise(u);function u(d,h){const p=Rl(a);l.run(i,p,m);function m(x,y,v){const b=y||i;x?h(x):d?d(b):r(void 0,b,v)}}}runSync(i,a){let r=!1,l;return this.run(i,a,u),Ly("runSync","run",r),l;function u(d,h){Oy(d),l=h,r=!0}}stringify(i,a){this.freeze();const r=Rl(a),l=this.compiler||this.Compiler;return eh("stringify",l),Dy(i),l(i,r)}use(i,...a){const r=this.attachers,l=this.namespace;if(th("use",this.frozen),i!=null)if(typeof i=="function")p(i,a);else if(typeof i=="object")Array.isArray(i)?h(i):d(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function u(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[x,...y]=m;p(x,y)}else d(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function d(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");h(m.plugins),m.settings&&(l.settings=Xd(!0,l.settings,m.settings))}function h(m){let x=-1;if(m!=null)if(Array.isArray(m))for(;++x<m.length;){const y=m[x];u(y)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,x){let y=-1,v=-1;for(;++y<r.length;)if(r[y][0]===m){v=y;break}if(v===-1)r.push([m,...x]);else if(x.length>0){let[b,...w]=x;const S=r[v][1];Mh(S)&&Mh(b)&&(b=Xd(!0,S,b)),r[v]=[m,b,...w]}}}}const fT=new jf().freeze();function Jd(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function eh(e,i){if(typeof i!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function th(e,i){if(i)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Dy(e){if(!Mh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ly(e,i,a){if(!a)throw new Error("`"+e+"` finished async. Use `"+i+"` instead")}function Rl(e){return mT(e)?e:new Xv(e)}function mT(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function pT(e){return typeof e=="string"||gT(e)}function gT(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const xT="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_y=[],$y={allowDangerousHtml:!0},yT=/^(https?|ircs?|mailto|xmpp)$/i,bT=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function vT(e){const i=wT(e),a=jT(e);return kT(i.runSync(i.parse(a),a),e)}function wT(e){const i=e.rehypePlugins||_y,a=e.remarkPlugins||_y,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$y}:$y;return fT().use(JA).use(a).use(XN,r).use(i)}function jT(e){const i=e.children||"",a=new Xv;return typeof i=="string"&&(a.value=i),a}function kT(e,i){const a=i.allowedElements,r=i.allowElement,l=i.components,u=i.disallowedElements,d=i.skipHtml,h=i.unwrapDisallowed,p=i.urlTransform||ST;for(const x of bT)Object.hasOwn(i,x.from)&&(""+x.from+(x.to?"use `"+x.to+"` instead":"remove it")+xT+x.id,void 0);return wf(e,m),UC(e,{Fragment:n.Fragment,components:l,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function m(x,y,v){if(x.type==="raw"&&v&&typeof y=="number")return d?v.children.splice(y,1):v.children[y]={type:"text",value:x.value},y;if(x.type==="element"){let b;for(b in Pd)if(Object.hasOwn(Pd,b)&&Object.hasOwn(x.properties,b)){const w=x.properties[b],S=Pd[b];(S===null||S.includes(x.tagName))&&(x.properties[b]=p(String(w||""),b,x))}}if(x.type==="element"){let b=a?!a.includes(x.tagName):u?u.includes(x.tagName):!1;if(!b&&r&&typeof y=="number"&&(b=!r(x,y,v)),b&&v&&typeof y=="number")return h&&x.children?v.children.splice(y,1,...x.children):v.children.splice(y,1),y}}}function ST(e){const i=e.indexOf(":"),a=e.indexOf("?"),r=e.indexOf("#"),l=e.indexOf("/");return i===-1||l!==-1&&i>l||a!==-1&&i>a||r!==-1&&i>r||yT.test(e.slice(0,i))?e:""}function CT(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Qv(e,i,a){const l=xc((a||{}).ignore||[]),u=AT(i);let d=-1;for(;++d<u.length;)Zv(e,"text",h);function h(m,x){let y=-1,v;for(;++y<x.length;){const b=x[y],w=v?v.children:void 0;if(l(b,w?w.indexOf(b):void 0,v))return;v=b}if(v)return p(m,x)}function p(m,x){const y=x[x.length-1],v=u[d][0],b=u[d][1];let w=0;const C=y.children.indexOf(m);let k=!1,O=[];v.lastIndex=0;let T=v.exec(m.value);for(;T;){const _=T.index,$={index:T.index,input:T.input,stack:[...x,m]};let G=b(...T,$);if(typeof G=="string"&&(G=G.length>0?{type:"text",value:G}:void 0),G===!1)v.lastIndex=_+1;else{if(w!==_&&M({type:"text",value:m.value.slice(w,_)}),Array.isArray(G))for(const J of G)M(J);else G&&M(G);w=_+T[0].length,k=!0}if(!v.global)break;T=v.exec(m.value)}return k?(w<m.value.length&&M({type:"text",value:m.value.slice(w)}),y.children.splice(C,1,...O)):O=[m],C+O.length;function M(_){const $=O[O.length-1];$&&$.type==="text"&&_.type==="text"?$.value+=_.value:O.push(_)}}}function AT(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=[],a=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<a.length;){const l=a[r];i.push([NT(l[0]),TT(l[1])])}return i}function NT(e){return typeof e=="string"?new RegExp(CT(e),"g"):e}function TT(e){return typeof e=="function"?e:function(){return e}}function ET(e){Qv(e,[/\r?\n|\r/g,zT])}function zT(){return{type:"break"}}function OT(){return function(e){ET(e)}}function Uy(e,i){const a=String(e);if(typeof i!="string")throw new TypeError("Expected character");let r=0,l=a.indexOf(i);for(;l!==-1;)r++,l=a.indexOf(i,l+i.length);return r}const nh="phrasing",sh=["autolink","link","image","label"];function RT(){return{transforms:[IT],enter:{literalAutolink:DT,literalAutolinkEmail:ih,literalAutolinkHttp:ih,literalAutolinkWww:ih},exit:{literalAutolink:UT,literalAutolinkEmail:$T,literalAutolinkHttp:LT,literalAutolinkWww:_T}}}function MT(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:nh,notInConstruct:sh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:nh,notInConstruct:sh},{character:":",before:"[ps]",after:"\\/",inConstruct:nh,notInConstruct:sh}]}}function DT(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ih(e){this.config.enter.autolinkProtocol.call(this,e)}function LT(e){this.config.exit.autolinkProtocol.call(this,e)}function _T(e){this.config.exit.data.call(this,e);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(e)}function $T(e){this.config.exit.autolinkEmail.call(this,e)}function UT(e){this.exit(e)}function IT(e){Qv(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,BT],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),HT]],{ignore:["link","linkReference"]})}function BT(e,i,a,r,l){let u="";if(!Kv(l)||(/^w/i.test(i)&&(a=i+a,i="",u="http://"),!qT(a)))return!1;const d=FT(a+r);if(!d[0])return!1;const h={type:"link",title:null,url:u+i+d[0],children:[{type:"text",value:i+d[0]}]};return d[1]?[h,{type:"text",value:d[1]}]:h}function HT(e,i,a,r){return!Kv(r,!0)||/[-\d_]$/.test(a)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+a,children:[{type:"text",value:i+"@"+a}]}}function qT(e){const i=e.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function FT(e){const i=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!i)return[e,void 0];e=e.slice(0,i.index);let a=i[0],r=a.indexOf(")");const l=Uy(e,"(");let u=Uy(e,")");for(;r!==-1&&l>u;)e+=a.slice(0,r+1),a=a.slice(r+1),r=a.indexOf(")"),u++;return[e,a]}function Kv(e,i){const a=e.input.charCodeAt(e.index-1);return(e.index===0||Yi(a)||mc(a))&&(!i||a!==47)}Wv.peek=WT;function GT(){this.buffer()}function PT(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function YT(){this.buffer()}function VT(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ZT(e){const i=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=ts(this.sliceSerialize(e)).toLowerCase(),a.label=i}function XT(e){this.exit(e)}function QT(e){const i=this.resume(),a=this.stack[this.stack.length-1];a.type,a.identifier=ts(this.sliceSerialize(e)).toLowerCase(),a.label=i}function KT(e){this.exit(e)}function WT(){return"["}function Wv(e,i,a,r){const l=a.createTracker(r);let u=l.move("[^");const d=a.enter("footnoteReference"),h=a.enter("reference");return u+=l.move(a.safe(a.associationId(e),{after:"]",before:u})),h(),d(),u+=l.move("]"),u}function JT(){return{enter:{gfmFootnoteCallString:GT,gfmFootnoteCall:PT,gfmFootnoteDefinitionLabelString:YT,gfmFootnoteDefinition:VT},exit:{gfmFootnoteCallString:ZT,gfmFootnoteCall:XT,gfmFootnoteDefinitionLabelString:QT,gfmFootnoteDefinition:KT}}}function eE(e){let i=!1;return e&&e.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:a,footnoteReference:Wv},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function a(r,l,u,d){const h=u.createTracker(d);let p=h.move("[^");const m=u.enter("footnoteDefinition"),x=u.enter("label");return p+=h.move(u.safe(u.associationId(r),{before:p,after:"]"})),x(),p+=h.move("]:"),r.children&&r.children.length>0&&(h.shift(4),p+=h.move((i?`
|
|
37
|
+
`:" ")+u.indentLines(u.containerFlow(r,h.current()),i?Jv:tE))),m(),p}}function tE(e,i,a){return i===0?e:Jv(e,i,a)}function Jv(e,i,a){return(a?"":" ")+e}const nE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];kf.attention=oE;kf.peek=lE;function sE(){return{canContainEols:["delete"],enter:{strikethrough:aE},exit:{strikethrough:rE}}}function iE(){return{handlers:{delete:kf},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:nE}]}}function aE(e){this.enter({type:"delete",children:[],position:void 0},e)}function rE(e){this.exit(e)}function kf(e,i,a,r){const l=a.createTracker(r),u=a.stack.includes("strikethrough")?"~":"~~",d=a.enter("strikethrough");let h=l.move(u);return h+=a.containerPhrasing(e,{...l.current(),before:h,after:"~"}),h+=l.move(u),d(),h}function oE(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function lE(){return"~"}function cE(e){return e.length}function uE(e,i){const a=i||{},r=(a.align||[]).concat(),l=a.stringLength||cE,u=[],d=[],h=[],p=[];let m=0,x=-1;for(;++x<e.length;){const S=[],C=[];let k=-1;for(e[x].length>m&&(m=e[x].length);++k<e[x].length;){const O=dE(e[x][k]);if(a.alignDelimiters!==!1){const T=l(O);C[k]=T,(p[k]===void 0||T>p[k])&&(p[k]=T)}S.push(O)}d[x]=S,h[x]=C}let y=-1;if(typeof r=="object"&&"length"in r)for(;++y<m;)u[y]=Iy(r[y]);else{const S=Iy(r);for(;++y<m;)u[y]=S}y=-1;const v=[],b=[];for(;++y<m;){const S=u[y];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let O=a.alignDelimiters===!1?1:Math.max(1,p[y]-C.length-k.length);const T=C+"-".repeat(O)+k;a.alignDelimiters!==!1&&(O=C.length+O+k.length,O>p[y]&&(p[y]=O),b[y]=O),v[y]=T}d.splice(1,0,v),h.splice(1,0,b),x=-1;const w=[];for(;++x<d.length;){const S=d[x],C=h[x];y=-1;const k=[];for(;++y<m;){const O=S[y]||"";let T="",M="";if(a.alignDelimiters!==!1){const _=p[y]-(C[y]||0),$=u[y];$===114?T=" ".repeat(_):$===99?_%2?(T=" ".repeat(_/2+.5),M=" ".repeat(_/2-.5)):(T=" ".repeat(_/2),M=T):M=" ".repeat(_)}a.delimiterStart!==!1&&!y&&k.push("|"),a.padding!==!1&&!(a.alignDelimiters===!1&&O==="")&&(a.delimiterStart!==!1||y)&&k.push(" "),a.alignDelimiters!==!1&&k.push(T),k.push(O),a.alignDelimiters!==!1&&k.push(M),a.padding!==!1&&k.push(" "),(a.delimiterEnd!==!1||y!==m-1)&&k.push("|")}w.push(a.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
|
|
38
|
+
`)}function dE(e){return e==null?"":String(e)}function Iy(e){const i=typeof e=="string"?e.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}const hE=xc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function fE(e,i,a,r){const l=a.enter("blockquote"),u=a.createTracker(r);u.move("> "),u.shift(2);const d=a.indentLines(a.containerFlow(e,u.current()),mE);return l(),d}function mE(e,i,a){return">"+(a?"":" ")+e}function pE(e,i){return By(e,i.inConstruct,!0)&&!By(e,i.notInConstruct,!1)}function By(e,i,a){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return a;let r=-1;for(;++r<i.length;)if(e.includes(i[r]))return!0;return!1}function Hy(e,i,a,r){let l=-1;for(;++l<a.unsafe.length;){const u=a.unsafe[l];if(u.character===`
|
|
39
|
+
`&&!u.before&&!u.after&&pE(a.stack,u))return/[\t ]/.test(r.before)?"":" "}return`\\
|
|
40
|
+
`}function gE(e,i){const a=String(e);let r=a.indexOf(i),l=r,u=0,d=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===l?++u>d&&(d=u):u=1,l=r+i.length,r=a.indexOf(i,l);return d}function xE(e,i){return!!(i.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function yE(e){const i=e.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function bE(e,i,a,r){const l=yE(a),u=e.value||"";if(xE(e,a)){const y=a.enter("codeIndented"),v=a.indentLines(u,vE);return y(),v}const d=a.createTracker(r),h=l.repeat(Math.max(gE(u,l)+1,3)),p=a.enter("codeFenced"),m=l==="`"?"GraveAccent":"Tilde";let x=d.move(h);if(e.lang){const y=a.enter(`codeFencedLang${m}`);x+=d.move(a.safe(e.lang,{before:x,after:" ",encode:["`"],...d.current()})),y()}if(e.lang&&e.meta){const y=a.enter(`codeFencedMeta${m}`);x+=d.move(" "),x+=d.move(a.safe(e.meta,{before:x,after:`
|
|
41
|
+
`,encode:["`"],...d.current()})),y()}return x+=d.move(`
|
|
42
|
+
`),u&&(x+=d.move(u+`
|
|
43
|
+
`)),x+=d.move(h),p(),x}function vE(e,i,a){return(a?"":" ")+e}function Sf(e){const i=e.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function wE(e,i,a,r){const l=Sf(a),u=l==='"'?"Quote":"Apostrophe",d=a.enter("definition");let h=a.enter("label");const p=a.createTracker(r);let m=p.move("[");return m+=p.move(a.safe(a.associationId(e),{before:m,after:"]",...p.current()})),m+=p.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(a.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(h=a.enter("destinationRaw"),m+=p.move(a.safe(e.url,{before:m,after:e.title?" ":`
|
|
44
|
+
`,...p.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=p.move(" "+l),m+=p.move(a.safe(e.title,{before:m,after:l,...p.current()})),m+=p.move(l),h()),d(),m}function jE(e){const i=e.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}Cf.attention=kE;Cf.peek=SE;function Cf(e,i,a,r){const l=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},r);return l(),u}function kE(e,i){return{construct:"emphasis",markers:jE(i)==="*"?["*","_"]:["_","*"],sizes:[1]}}function SE(e,i,a){return a.options.emphasis||"*"}function CE(e){return"&#x"+e.toString(16).toUpperCase()+";"}function AE(e,i){let a=!1;return wf(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return a=!0,Oh}),!!((!e.depth||e.depth<3)&&mf(e)&&(i.options.setext||a))}function NE(e,i,a,r){const l=Math.max(Math.min(6,e.depth||1),1),u=a.createTracker(r);if(AE(e,a)){const y=a.enter("headingSetext"),v=a.enter("phrasing"),b=a.containerPhrasing(e,{...u.current(),before:`
|
|
45
|
+
`,after:`
|
|
46
|
+
`});return v(),y(),b+`
|
|
47
|
+
`+(l===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
|
|
48
|
+
`))+1))}const d="#".repeat(l),h=a.enter("headingAtx"),p=a.enter("phrasing");u.move(d+" ");let m=a.containerPhrasing(e,{before:"# ",after:`
|
|
49
|
+
`,...u.current()});const x=m.charCodeAt(0);return(x===9||x===32)&&(m=CE(x)+m.slice(1)),m=m?d+" "+m:d,a.options.closeAtx&&(m+=" "+d),p(),h(),m}ew.peek=TE;function ew(e){return e.value||""}function TE(){return"<"}tw.peek=EE;function tw(e,i,a,r){const l=Sf(a),u=l==='"'?"Quote":"Apostrophe",d=a.enter("image");let h=a.enter("label");const p=a.createTracker(r);let m=p.move("![");return m+=p.move(a.safe(e.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=a.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(a.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(h=a.enter("destinationRaw"),m+=p.move(a.safe(e.url,{before:m,after:e.title?" ":")",...p.current()}))),h(),e.title&&(h=a.enter(`title${u}`),m+=p.move(" "+l),m+=p.move(a.safe(e.title,{before:m,after:l,...p.current()})),m+=p.move(l),h()),m+=p.move(")"),d(),m}function EE(){return"!"}nw.peek=zE;function nw(e,i,a,r){const l=e.referenceType,u=a.enter("imageReference");let d=a.enter("label");const h=a.createTracker(r);let p=h.move("![");const m=a.safe(e.alt,{before:p,after:"]",...h.current()});p+=h.move(m+"]["),d();const x=a.stack;a.stack=x.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const y=a.safe(a.associationId(e),{before:p,after:"]",...h.current()});return d(),a.stack=x,u(),l==="full"||!m||m!==y?p+=h.move(y+"]"):l==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function zE(){return"!"}sw.peek=OE;function sw(e,i,a){let r=e.value||"",l="`",u=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(r);)l+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++u<a.unsafe.length;){const d=a.unsafe[u],h=a.compilePattern(d);if(!d.atBreak)continue;let p;for(;p=h.exec(r);){let m=p.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(p.index+1)}}return l+r+l}function OE(){return"`"}function iw(e,i){const a=mf(e);return!!(!i.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(a===e.url||"mailto:"+a===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}aw.peek=RE;function aw(e,i,a,r){const l=Sf(a),u=l==='"'?"Quote":"Apostrophe",d=a.createTracker(r);if(iw(e,a)){const x=a.stack;a.stack=x.filter(function(b){return b!=="phrasing"});const y=a.enter("autolink");let v=d.move("<");return v+=d.move(a.containerPhrasing(e,{before:v,after:">",...d.current()})),v+=d.move(">"),y(),a.stack=x,v}const h=a.enter("link");let p=a.enter("label"),m=d.move("[");return m+=d.move(a.containerPhrasing(e,{before:m,after:"](",...d.current()})),m+=d.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=a.enter("destinationLiteral"),m+=d.move("<"),m+=d.move(a.safe(e.url,{before:m,after:">",...d.current()})),m+=d.move(">")):(p=a.enter("destinationRaw"),m+=d.move(a.safe(e.url,{before:m,after:e.title?" ":")",...d.current()}))),p(),e.title&&(p=a.enter(`title${u}`),m+=d.move(" "+l),m+=d.move(a.safe(e.title,{before:m,after:l,...d.current()})),m+=d.move(l),p()),m+=d.move(")"),h(),m}function RE(e,i,a){return iw(e,a)?"<":"["}rw.peek=ME;function rw(e,i,a,r){const l=e.referenceType,u=a.enter("linkReference");let d=a.enter("label");const h=a.createTracker(r);let p=h.move("[");const m=a.containerPhrasing(e,{before:p,after:"]",...h.current()});p+=h.move(m+"]["),d();const x=a.stack;a.stack=x.filter(function(v){return v!=="phrasing"}),d=a.enter("reference");const y=a.safe(a.associationId(e),{before:p,after:"]",...h.current()});return d(),a.stack=x,u(),l==="full"||!m||m!==y?p+=h.move(y+"]"):l==="shortcut"?p=p.slice(0,-1):p+=h.move("]"),p}function ME(){return"["}function Af(e){const i=e.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function DE(e){const i=Af(e),a=e.options.bulletOther;if(!a)return i==="*"?"-":"*";if(a!=="*"&&a!=="+"&&a!=="-")throw new Error("Cannot serialize items with `"+a+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(a===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+a+"`) to be different");return a}function LE(e){const i=e.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function ow(e){const i=e.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function _E(e,i,a,r){const l=a.enter("list"),u=a.bulletCurrent;let d=e.ordered?LE(a):Af(a);const h=e.ordered?d==="."?")":".":DE(a);let p=i&&a.bulletLastUsed?d===a.bulletLastUsed:!1;if(!e.ordered){const x=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&x&&(!x.children||!x.children[0])&&a.stack[a.stack.length-1]==="list"&&a.stack[a.stack.length-2]==="listItem"&&a.stack[a.stack.length-3]==="list"&&a.stack[a.stack.length-4]==="listItem"&&a.indexStack[a.indexStack.length-1]===0&&a.indexStack[a.indexStack.length-2]===0&&a.indexStack[a.indexStack.length-3]===0&&(p=!0),ow(a)===d&&x){let y=-1;for(;++y<e.children.length;){const v=e.children[y];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(d=h),a.bulletCurrent=d;const m=a.containerFlow(e,r);return a.bulletLastUsed=d,a.bulletCurrent=u,l(),m}function $E(e){const i=e.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function UE(e,i,a,r){const l=$E(a);let u=a.bulletCurrent||Af(a);i&&i.type==="list"&&i.ordered&&(u=(typeof i.start=="number"&&i.start>-1?i.start:1)+(a.options.incrementListMarker===!1?0:i.children.indexOf(e))+u);let d=u.length+1;(l==="tab"||l==="mixed"&&(i&&i.type==="list"&&i.spread||e.spread))&&(d=Math.ceil(d/4)*4);const h=a.createTracker(r);h.move(u+" ".repeat(d-u.length)),h.shift(d);const p=a.enter("listItem"),m=a.indentLines(a.containerFlow(e,h.current()),x);return p(),m;function x(y,v,b){return v?(b?"":" ".repeat(d))+y:(b?u:u+" ".repeat(d-u.length))+y}}function IE(e,i,a,r){const l=a.enter("paragraph"),u=a.enter("phrasing"),d=a.containerPhrasing(e,r);return u(),l(),d}function BE(e,i,a,r){if(!e.children.some(function(h){return hE(h)}))return a.containerFlow(e,r);const u=a.enter("phrasing"),d=a.containerPhrasing(e,r);return u(),d}function HE(e){const i=e.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}Nf.attention=qE;Nf.peek=FE;function Nf(e,i,a,r){const l=a.enter("phrasing"),u=a.containerPhrasing({type:"root",children:[e]},r);return l(),u}function qE(e,i){return{construct:"strong",markers:HE(i)==="*"?["*","_"]:["_","*"],sizes:[2]}}function FE(e,i,a){return a.options.strong||"*"}function GE(e,i,a,r){const l=i?i.children:[],u=l.indexOf(e);return a.safe(e.value,{...r,afterNode:l[u+1],beforeNode:l[u-1]})}function PE(e){const i=e.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function YE(e,i,a){const r=(ow(a)+(a.options.ruleSpaces?" ":"")).repeat(PE(a));return a.options.ruleSpaces?r.slice(0,-1):r}const lw={blockquote:fE,break:Hy,code:bE,definition:wE,emphasis:Cf,hardBreak:Hy,heading:NE,html:ew,image:tw,imageReference:nw,inlineCode:sw,link:aw,linkReference:rw,list:_E,listItem:UE,paragraph:IE,root:BE,strong:Nf,text:GE,thematicBreak:YE};function VE(){return{enter:{table:ZE,tableData:qy,tableHeader:qy,tableRow:QE},exit:{codeText:KE,table:XE,tableData:ah,tableHeader:ah,tableRow:ah}}}function ZE(e){const i=e._align;this.enter({type:"table",align:i.map(function(a){return a==="none"?null:a}),children:[]},e),this.data.inTable=!0}function XE(e){this.exit(e),this.data.inTable=void 0}function QE(e){this.enter({type:"tableRow",children:[]},e)}function ah(e){this.exit(e)}function qy(e){this.enter({type:"tableCell",children:[]},e)}function KE(e){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,WE));const a=this.stack[this.stack.length-1];a.type,a.value=i,this.exit(e)}function WE(e,i){return i==="|"?i:e}function JE(e){const i=e||{},a=i.tableCellPadding,r=i.tablePipeAlign,l=i.stringLength,u=a?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
50
|
+
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:d,tableCell:p,tableRow:h}};function d(b,w,S,C){return m(x(b,S,C),b.align)}function h(b,w,S,C){const k=y(b,S,C),O=m([k]);return O.slice(0,O.indexOf(`
|
|
51
|
+
`))}function p(b,w,S,C){const k=S.enter("tableCell"),O=S.enter("phrasing"),T=S.containerPhrasing(b,{...C,before:u,after:u});return O(),k(),T}function m(b,w){return uE(b,{align:w,alignDelimiters:r,padding:a,stringLength:l})}function x(b,w,S){const C=b.children;let k=-1;const O=[],T=w.enter("table");for(;++k<C.length;)O[k]=y(C[k],w,S);return T(),O}function y(b,w,S){const C=b.children;let k=-1;const O=[],T=w.enter("tableRow");for(;++k<C.length;)O[k]=p(C[k],b,w,S);return T(),O}function v(b,w,S){let C=lw.inlineCode(b,w,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function ez(){return{exit:{taskListCheckValueChecked:Fy,taskListCheckValueUnchecked:Fy,paragraph:nz}}}function tz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:sz}}}function Fy(e){const i=this.stack[this.stack.length-2];i.type,i.checked=e.type==="taskListCheckValueChecked"}function nz(e){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const a=this.stack[this.stack.length-1];a.type;const r=a.children[0];if(r&&r.type==="text"){const l=i.children;let u=-1,d;for(;++u<l.length;){const h=l[u];if(h.type==="paragraph"){d=h;break}}d===a&&(r.value=r.value.slice(1),r.value.length===0?a.children.shift():a.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,a.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function sz(e,i,a,r){const l=e.children[0],u=typeof e.checked=="boolean"&&l&&l.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",h=a.createTracker(r);u&&h.move(d);let p=lw.listItem(e,i,a,{...r,...h.current()});return u&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),p;function m(x){return x+d}}function iz(){return[RT(),JT(),sE(),VE(),ez()]}function az(e){return{extensions:[MT(),eE(e),iE(),JE(e),tz()]}}const rz={tokenize:hz,partial:!0},cw={tokenize:fz,partial:!0},uw={tokenize:mz,partial:!0},dw={tokenize:pz,partial:!0},oz={tokenize:gz,partial:!0},hw={name:"wwwAutolink",tokenize:uz,previous:mw},fw={name:"protocolAutolink",tokenize:dz,previous:pw},Hs={name:"emailAutolink",tokenize:cz,previous:gw},fs={};function lz(){return{text:fs}}let Ui=48;for(;Ui<123;)fs[Ui]=Hs,Ui++,Ui===58?Ui=65:Ui===91&&(Ui=97);fs[43]=Hs;fs[45]=Hs;fs[46]=Hs;fs[95]=Hs;fs[72]=[Hs,fw];fs[104]=[Hs,fw];fs[87]=[Hs,hw];fs[119]=[Hs,hw];function cz(e,i,a){const r=this;let l,u;return d;function d(y){return!Lh(y)||!gw.call(r,r.previous)||Tf(r.events)?a(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(y))}function h(y){return Lh(y)?(e.consume(y),h):y===64?(e.consume(y),p):a(y)}function p(y){return y===46?e.check(oz,x,m)(y):y===45||y===95||en(y)?(u=!0,e.consume(y),p):x(y)}function m(y){return e.consume(y),l=!0,p}function x(y){return u&&l&&an(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),i(y)):a(y)}}function uz(e,i,a){const r=this;return l;function l(d){return d!==87&&d!==119||!mw.call(r,r.previous)||Tf(r.events)?a(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(rz,e.attempt(cw,e.attempt(uw,u),a),a)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),i(d)}}function dz(e,i,a){const r=this;let l="",u=!1;return d;function d(y){return(y===72||y===104)&&pw.call(r,r.previous)&&!Tf(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),l+=String.fromCodePoint(y),e.consume(y),h):a(y)}function h(y){if(an(y)&&l.length<5)return l+=String.fromCodePoint(y),e.consume(y),h;if(y===58){const v=l.toLowerCase();if(v==="http"||v==="https")return e.consume(y),p}return a(y)}function p(y){return y===47?(e.consume(y),u?m:(u=!0,p)):a(y)}function m(y){return y===null||Wl(y)||ht(y)||Yi(y)||mc(y)?a(y):e.attempt(cw,e.attempt(uw,x),a)(y)}function x(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),i(y)}}function hz(e,i,a){let r=0;return l;function l(d){return(d===87||d===119)&&r<3?(r++,e.consume(d),l):d===46&&r===3?(e.consume(d),u):a(d)}function u(d){return d===null?a(d):i(d)}}function fz(e,i,a){let r,l,u;return d;function d(m){return m===46||m===95?e.check(dw,p,h)(m):m===null||ht(m)||Yi(m)||m!==45&&mc(m)?p(m):(u=!0,e.consume(m),d)}function h(m){return m===95?r=!0:(l=r,r=void 0),e.consume(m),d}function p(m){return l||r||!u?a(m):i(m)}}function mz(e,i){let a=0,r=0;return l;function l(d){return d===40?(a++,e.consume(d),l):d===41&&r<a?u(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(dw,i,u)(d):d===null||ht(d)||Yi(d)?i(d):(e.consume(d),l)}function u(d){return d===41&&r++,e.consume(d),l}}function pz(e,i,a){return r;function r(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),r):h===38?(e.consume(h),u):h===93?(e.consume(h),l):h===60||h===null||ht(h)||Yi(h)?i(h):a(h)}function l(h){return h===null||h===40||h===91||ht(h)||Yi(h)?i(h):r(h)}function u(h){return an(h)?d(h):a(h)}function d(h){return h===59?(e.consume(h),r):an(h)?(e.consume(h),d):a(h)}}function gz(e,i,a){return r;function r(u){return e.consume(u),l}function l(u){return en(u)?a(u):i(u)}}function mw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||ht(e)}function pw(e){return!an(e)}function gw(e){return!(e===47||Lh(e))}function Lh(e){return e===43||e===45||e===46||e===95||en(e)}function Tf(e){let i=e.length,a=!1;for(;i--;){const r=e[i][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){a=!0;break}if(r._gfmAutolinkLiteralWalkedInto){a=!1;break}}return e.length>0&&!a&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),a}const xz={tokenize:Cz,partial:!0};function yz(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:jz,continuation:{tokenize:kz},exit:Sz}},text:{91:{name:"gfmFootnoteCall",tokenize:wz},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:bz,resolveTo:vz}}}}function bz(e,i,a){const r=this;let l=r.events.length;const u=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let d;for(;l--;){const p=r.events[l][1];if(p.type==="labelImage"){d=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return h;function h(p){if(!d||!d._balanced)return a(p);const m=ts(r.sliceSerialize({start:d.end,end:r.now()}));return m.codePointAt(0)!==94||!u.includes(m.slice(1))?a(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),i(p))}}function vz(e,i){let a=e.length;for(;a--;)if(e[a][1].type==="labelImage"&&e[a][0]==="enter"){e[a][1];break}e[a+1][1].type="data",e[a+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[a+3][1].start),end:Object.assign({},e[e.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},e[a+3][1].end),end:Object.assign({},e[a+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const u={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},h=[e[a+1],e[a+2],["enter",r,i],e[a+3],e[a+4],["enter",l,i],["exit",l,i],["enter",u,i],["enter",d,i],["exit",d,i],["exit",u,i],e[e.length-2],e[e.length-1],["exit",r,i]];return e.splice(a,e.length-a+1,...h),e}function wz(e,i,a){const r=this,l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u=0,d;return h;function h(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),p}function p(y){return y!==94?a(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(y){if(u>999||y===93&&!d||y===null||y===91||ht(y))return a(y);if(y===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return l.includes(ts(r.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),i):a(y)}return ht(y)||(d=!0),u++,e.consume(y),y===92?x:m}function x(y){return y===91||y===92||y===93?(e.consume(y),u++,m):m(y)}}function jz(e,i,a){const r=this,l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u,d=0,h;return p;function p(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",x):a(w)}function x(w){if(d>999||w===93&&!h||w===null||w===91||ht(w))return a(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return u=ts(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return ht(w)||(h=!0),d++,e.consume(w),w===92?y:x}function y(w){return w===91||w===92||w===93?(e.consume(w),d++,x):x(w)}function v(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),l.includes(u)||l.push(u),et(e,b,"gfmFootnoteDefinitionWhitespace")):a(w)}function b(w){return i(w)}}function kz(e,i,a){return e.check(ho,i,e.attempt(xz,i,a))}function Sz(e){e.exit("gfmFootnoteDefinition")}function Cz(e,i,a){const r=this;return et(e,l,"gfmFootnoteDefinitionIndent",5);function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?i(u):a(u)}}function Az(e){let a=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:u,resolveAll:l};return a==null&&(a=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function l(d,h){let p=-1;for(;++p<d.length;)if(d[p][0]==="enter"&&d[p][1].type==="strikethroughSequenceTemporary"&&d[p][1]._close){let m=p;for(;m--;)if(d[m][0]==="exit"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._open&&d[p][1].end.offset-d[p][1].start.offset===d[m][1].end.offset-d[m][1].start.offset){d[p][1].type="strikethroughSequence",d[m][1].type="strikethroughSequence";const x={type:"strikethrough",start:Object.assign({},d[m][1].start),end:Object.assign({},d[p][1].end)},y={type:"strikethroughText",start:Object.assign({},d[m][1].end),end:Object.assign({},d[p][1].start)},v=[["enter",x,h],["enter",d[m][1],h],["exit",d[m][1],h],["enter",y,h]],b=h.parser.constructs.insideSpan.null;b&&es(v,v.length,0,pc(b,d.slice(m+1,p),h)),es(v,v.length,0,[["exit",y,h],["enter",d[p][1],h],["exit",d[p][1],h],["exit",x,h]]),es(d,m-1,p-m+3,v),p=m+v.length-2;break}}for(p=-1;++p<d.length;)d[p][1].type==="strikethroughSequenceTemporary"&&(d[p][1].type="data");return d}function u(d,h,p){const m=this.previous,x=this.events;let y=0;return v;function v(w){return m===126&&x[x.length-1][1].type!=="characterEscape"?p(w):(d.enter("strikethroughSequenceTemporary"),b(w))}function b(w){const S=ec(m);if(w===126)return y>1?p(w):(d.consume(w),y++,b);if(y<2&&!a)return p(w);const C=d.exit("strikethroughSequenceTemporary"),k=ec(w);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,h(w)}}}class Nz{constructor(){this.map=[],this.index=new Map}add(i,a,r){Tz(this,i,a,r)}consume(i){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let a=this.map.length;const r=[];for(;a>0;)a-=1,r.push(i.slice(this.map[a][0]+this.map[a][1]),this.map[a][2]),i.length=this.map[a][0];r.push(i.slice()),i.length=0;let l=r.pop();for(;l;){for(const u of l)i.push(u);l=r.pop()}this.map.length=0,this.index.clear()}}function Tz(e,i,a,r){if(a===0&&r.length===0)return;const l=e.index.get(i);if(l){l[1]+=a,l[2].push(...r);return}const u=[i,a,r];e.map.push(u),e.index.set(i,u)}function Ez(e,i){let a=!1;const r=[];for(;i<e.length;){const l=e[i];if(a){if(l[0]==="enter")l[1].type==="tableContent"&&r.push(e[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(l[1].type==="tableContent"){if(e[i-1][1].type==="tableDelimiterMarker"){const u=r.length-1;r[u]=r[u]==="left"?"center":"right"}}else if(l[1].type==="tableDelimiterRow")break}else l[0]==="enter"&&l[1].type==="tableDelimiterRow"&&(a=!0);i+=1}return r}function zz(){return{flow:{null:{name:"table",tokenize:Oz,resolveAll:Rz}}}}function Oz(e,i,a){const r=this;let l=0,u=0,d;return h;function h(E){let I=r.events.length-1;for(;I>-1;){const{type:re}=r.events[I][1];if(re==="lineEnding"||re==="linePrefix")I--;else break}const Q=I>-1?r.events[I][1].type:null,ie=Q==="tableHead"||Q==="tableRow"?$:p;return ie===$&&r.parser.lazy[r.now().line]?a(E):ie(E)}function p(E){return e.enter("tableHead"),e.enter("tableRow"),m(E)}function m(E){return E===124||(d=!0,u+=1),x(E)}function x(E){return E===null?a(E):Me(E)?u>1?(u=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),b):a(E):qe(E)?et(e,x,"whitespace")(E):(u+=1,d&&(d=!1,l+=1),E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),d=!0,x):(e.enter("data"),y(E)))}function y(E){return E===null||E===124||ht(E)?(e.exit("data"),x(E)):(e.consume(E),E===92?v:y)}function v(E){return E===92||E===124?(e.consume(E),y):y(E)}function b(E){return r.interrupt=!1,r.parser.lazy[r.now().line]?a(E):(e.enter("tableDelimiterRow"),d=!1,qe(E)?et(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):w(E))}function w(E){return E===45||E===58?C(E):E===124?(d=!0,e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),S):_(E)}function S(E){return qe(E)?et(e,C,"whitespace")(E):C(E)}function C(E){return E===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),k):E===45?(u+=1,k(E)):E===null||Me(E)?M(E):_(E)}function k(E){return E===45?(e.enter("tableDelimiterFiller"),O(E)):_(E)}function O(E){return E===45?(e.consume(E),O):E===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(E),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(E))}function T(E){return qe(E)?et(e,M,"whitespace")(E):M(E)}function M(E){return E===124?w(E):E===null||Me(E)?!d||l!==u?_(E):(e.exit("tableDelimiterRow"),e.exit("tableHead"),i(E)):_(E)}function _(E){return a(E)}function $(E){return e.enter("tableRow"),G(E)}function G(E){return E===124?(e.enter("tableCellDivider"),e.consume(E),e.exit("tableCellDivider"),G):E===null||Me(E)?(e.exit("tableRow"),i(E)):qe(E)?et(e,G,"whitespace")(E):(e.enter("data"),J(E))}function J(E){return E===null||E===124||ht(E)?(e.exit("data"),G(E)):(e.consume(E),E===92?U:J)}function U(E){return E===92||E===124?(e.consume(E),J):J(E)}}function Rz(e,i){let a=-1,r=!0,l=0,u=[0,0,0,0],d=[0,0,0,0],h=!1,p=0,m,x,y;const v=new Nz;for(;++a<e.length;){const b=e[a],w=b[1];b[0]==="enter"?w.type==="tableHead"?(h=!1,p!==0&&(Gy(v,i,p,m,x),x=void 0,p=0),m={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(a,0,[["enter",m,i]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,y=void 0,u=[0,0,0,0],d=[0,a+1,0,0],h&&(h=!1,x={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},v.add(a,0,[["enter",x,i]])),l=w.type==="tableDelimiterRow"?2:x?3:1):l&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],y=Ml(v,i,u,l,void 0,y),u=[0,0,0,0]),d[2]=a)):w.type==="tableCellDivider"&&(r?r=!1:(u[1]!==0&&(d[0]=d[1],y=Ml(v,i,u,l,void 0,y)),u=d,d=[u[1],a,0,0])):w.type==="tableHead"?(h=!0,p=a):w.type==="tableRow"||w.type==="tableDelimiterRow"?(p=a,u[1]!==0?(d[0]=d[1],y=Ml(v,i,u,l,a,y)):d[1]!==0&&(y=Ml(v,i,d,l,a,y)),l=0):l&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(d[3]=a)}for(p!==0&&Gy(v,i,p,m,x),v.consume(i.events),a=-1;++a<i.events.length;){const b=i.events[a];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=Ez(i.events,a))}return e}function Ml(e,i,a,r,l,u){const d=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",h="tableContent";a[0]!==0&&(u.end=Object.assign({},Ia(i.events,a[0])),e.add(a[0],0,[["exit",u,i]]));const p=Ia(i.events,a[1]);if(u={type:d,start:Object.assign({},p),end:Object.assign({},p)},e.add(a[1],0,[["enter",u,i]]),a[2]!==0){const m=Ia(i.events,a[2]),x=Ia(i.events,a[3]),y={type:h,start:Object.assign({},m),end:Object.assign({},x)};if(e.add(a[2],0,[["enter",y,i]]),r!==2){const v=i.events[a[2]],b=i.events[a[3]];if(v[1].end=Object.assign({},b[1].end),v[1].type="chunkText",v[1].contentType="text",a[3]>a[2]+1){const w=a[2]+1,S=a[3]-a[2]-1;e.add(w,S,[])}}e.add(a[3]+1,0,[["exit",y,i]])}return l!==void 0&&(u.end=Object.assign({},Ia(i.events,l)),e.add(l,0,[["exit",u,i]]),u=void 0),u}function Gy(e,i,a,r,l){const u=[],d=Ia(i.events,a);l&&(l.end=Object.assign({},d),u.push(["exit",l,i])),r.end=Object.assign({},d),u.push(["exit",r,i]),e.add(a+1,0,u)}function Ia(e,i){const a=e[i],r=a[0]==="enter"?"start":"end";return a[1][r]}const Mz={name:"tasklistCheck",tokenize:Lz};function Dz(){return{text:{91:Mz}}}function Lz(e,i,a){const r=this;return l;function l(p){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?a(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),u)}function u(p){return ht(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),d):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),d):a(p)}function d(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):a(p)}function h(p){return Me(p)?i(p):qe(p)?e.check({tokenize:_z},i,a)(p):a(p)}}function _z(e,i,a){return et(e,r,"whitespace");function r(l){return l===null?a(l):i(l)}}function $z(e){return Nv([lz(),yz(),Az(e),zz(),Dz()])}const Uz={};function Iz(e){const i=this,a=e||Uz,r=i.data(),l=r.micromarkExtensions||(r.micromarkExtensions=[]),u=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),d=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);l.push($z(a)),u.push(iz()),d.push(az(a))}const Bz=[Iz,OT],Hz={footnoteLabelProperties:{className:["visually-hidden"]}},qz=/^(?:https?|mailto):/i,xw=N.createContext(!1);function yw({href:e,title:i,children:a}){return n.jsx(xw,{value:!0,children:e&&qz.test(e)?n.jsx("a",{href:e,title:i,target:"_blank",rel:"noopener noreferrer",children:a}):n.jsx("span",{title:i||e||void 0,children:a})})}function Fz({src:e,alt:i}){const a=i||e;return N.useContext(xw)?n.jsx(n.Fragment,{children:a}):n.jsx(yw,{href:e,children:a})}const Gz={a:({href:e,title:i,children:a})=>n.jsx(yw,{href:e,title:i,children:a}),img:({src:e,alt:i})=>n.jsx(Fz,{src:typeof e=="string"?e:void 0,alt:i})},bw=N.memo(function({text:i}){return n.jsx("div",{className:"markdown",children:n.jsx(vT,{remarkPlugins:Bz,remarkRehypeOptions:Hz,components:Gz,children:i})})}),vw={draft:"Draft",open:"Open",failing:"CI failed",changes_requested:"Changes requested",merged:"Merged",closed:"Closed"},Ef={draft:"neutral",open:"success",failing:"danger",changes_requested:"danger",merged:"merged",closed:"neutral"};function ww(e){return e.number===void 0?"PR":`#${e.number}`}function Pz(e){let i;try{i=new URL(e).pathname.split("/").filter(Boolean).map(decodeURIComponent)}catch{return}const a=i.findIndex(u=>["pull","pulls","-","pull-requests","merge_requests","pullrequest"].includes(u));if(a<2)return;const r=i.slice(0,a),l=r.lastIndexOf("repos");return l>=2&&l===r.length-2&&["projects","users"].includes(r[l-2])?`${r[l-1]}/${r[l+1]}`:r.filter(u=>u!=="_git").join("/")}function _h(e){const i=Pz(e.url),a=e.state?`: ${vw[e.state]}`:"";return i?`Pull request ${ww(e)} in ${i}${a}`:`${e.url}${a}`}function jw({pull:e}){return e.state?n.jsx("span",{className:`pull-state ${Ef[e.state]}`,children:vw[e.state]}):null}function kw({pull:e}){return n.jsxs("span",{className:`session-pull${e.state?` ${Ef[e.state]}`:""}`,title:_h(e),children:[n.jsx(be,{name:"git-pull-request",size:12}),ww(e),e.state&&n.jsxs(n.Fragment,{children:[" ",n.jsx(jw,{pull:e})]})]})}function Yz({pull:e}){return n.jsxs("a",{className:`badge session-pull-link${e.state?` ${Ef[e.state]}`:""}`,href:e.url,target:"_blank",rel:"noreferrer",title:_h(e),"aria-label":_h(e),children:[n.jsx(be,{name:"git-pull-request",size:12}),e.number===void 0?"Pull request":n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"session-pull-prefix",children:"PR "}),"#",e.number]}),e.state&&n.jsxs("span",{className:"session-pull-state",children:[" · ",n.jsx(jw,{pull:e})]}),n.jsx(be,{name:"external",size:12})]})}const Py={queued:"Waiting its turn",authorizing:"Checking access",waiting:"Waiting for another session's fetch",connecting:"Connecting to the Git host",enumerating:"Enumerating objects",counting:"Counting objects",compressing:"Compressing objects",receiving:"Receiving objects",resolving:"Resolving deltas",verifying:"Verifying history",checking:"Checking files","checking-out":"Checking out",done:"Ready"};function Vz(e){return Object.hasOwn(Py,e)?Py[e]:"Preparing"}function Vr(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Zz(e){if(!Vr(e))return"";const i=["B","KiB","MiB","GiB","TiB"];let a=e,r=0;for(;a>=1024&&r<i.length-1;)a/=1024,r++;return`${r&&a<10?a.toFixed(1):Math.round(a)} ${i[r]}`}function Sw(e){return e.phase==="done"?100:typeof e.percent=="number"&&Number.isFinite(e.percent)?Math.min(100,Math.max(0,Math.round(e.percent))):void 0}function Xz(e){const i=[Vz(e.phase)],a=Sw(e);return a!==void 0&&e.phase!=="done"&&i.push(`${a}%`),Vr(e.done)&&Vr(e.total)&&e.total>0?i.push(`${e.done.toLocaleString("en-US")} of ${e.total.toLocaleString("en-US")}`):Vr(e.done)&&e.done>0&&i.push(e.done.toLocaleString("en-US")),Vr(e.bytes)&&e.bytes>0&&i.push(Zz(e.bytes)),i.join(" · ")}function Qz(e){return e?.repositories?.status==="preparing"}function Kz({sessionId:e,preparation:i,canRestart:a,onRestarted:r}){const l=je();if(i.status==="failed"){const u=()=>{l.run(async()=>{await ce(`/api/sessions/${oe(e)}/restart`,{method:"POST"}),r()})};return n.jsx(we,{variant:"error",title:"Repositories could not be prepared",actions:a?n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:u,children:l.busy?"Restarting...":"Restart session"}):void 0,children:n.jsxs("span",{className:"stack",children:[n.jsx("span",{children:i.error??"The host could not prepare this session's repositories."}),n.jsx("span",{className:"muted small",children:a?"Fix the cause on the host, then restart the session. Queued messages run once the repositories are ready.":"The session owner can restart the session once the cause is fixed."}),n.jsx(ye,{error:l.error})]})})}return n.jsxs("section",{className:"repository-preparation card","aria-label":"Preparing repositories",children:[n.jsxs("div",{className:"repository-preparation-head",children:[n.jsx(qi,{}),"Preparing repositories"]}),n.jsx("ul",{className:"repository-preparation-items",children:i.items.map(u=>{const d=Sw(u),h=Xz(u);return n.jsxs("li",{children:[n.jsxs("div",{className:"repository-preparation-row",children:[n.jsx("code",{children:u.path}),n.jsx("span",{className:"muted small",children:h})]}),n.jsx("progress",{className:"repository-progress",max:100,value:d,"aria-label":`${u.path}: ${h}`})]},u.path)})}),n.jsx("p",{className:"muted small",children:"The first session on a host clones each repository with its full history; later sessions fetch only what changed. Messages sent now run when this is done."})]})}function Wz(e){return e.connectorOwnerId!==e.ownerId}function $h(e,i,a=!1){return e.kind==="host.bash"||e.kind==="extension.tool"?!0:e.kind==="bash"&&(i.hostEnvironment===!0||a&&Wz(i))}function Jz(e,i,a=!1){return e.kind==="bash"?!a&&!$h(e,i,a):e.kind==="git.push"||e.kind==="github.comment"||e.kind==="github.issue"}function eO(e,i){return e.kind==="host.bash"||e.kind==="extension.tool"||e.kind==="bash"&&i.hostEnvironment===!0}function tO(e,i,a,r){return i.ownerId===r&&e.requestedBy!==i.ownerId&&i.requesterAutoApprove===!0&&(a===void 0||a.capabilities.requesterAutoApprove===!0)&&Jz(e.operation,i,e.unbounded===!0)}function nO(e,i,a){return e.connectorOwnerId!==void 0&&e.connectorOwnerId===a||i?.hostCommandAccess!==void 0}function Cw(e,i){return e.kind==="extension.tool"?!0:e.kind==="host.bash"&&i?.capabilities?.hostOwnerDecides===!0}function sO(e,i,a,r,l){const u=i.connectorOwnerId!==void 0&&i.connectorOwnerId===r;return l&&nO(i,a,r)||u&&Cw(e,a)}function iO(e,i){return Cw(e,i)?"Waiting for the host's owner, or a member granted host commands with approve access to this session":"Waiting for the host's owner or a member granted host commands, either with approve access to this session"}function aO(e){return`${e.tool} comes from the extension ${e.source}. It runs on the session's host, in its connector, as the host's OS user, with access to their files, credentials and network, outside the sandbox. Only the host's owner, or a member granted host commands, can approve it.`}function rO(e){try{return JSON.stringify(JSON.parse(e.arguments),null,2)}catch{return e.arguments}}function oO(e){return e.kind==="extension.tool"?"Ran without a decision: its workspace runs this extension's tools automatically on this host, or the owner's auto-approve access ran it":"Ran under the owner's auto-approve access, without a per-command decision"}const Aw=N.createContext(null),lO=Aw.Provider;function cO(){const e=N.useContext(Aw);return e?n.jsx(q,{variant:"ghost",size:"sm",icon:"menu",className:"nav-button","aria-label":"Open navigation","aria-expanded":e.expanded,onClick:e.open}):null}const uO=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/,dO=/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/,hO=/^[0-9a-f]{40}$/,fO=/^[a-z][a-z0-9-]{0,63}$/;class mi extends Error{}function Nw(e){if(typeof e!="string"||e.length>512)throw new mi("Invalid extension source");if(e.startsWith("piki:")){const i=e.slice(5);if(!fO.test(i))throw new mi(`Invalid Pikibun extension name: ${i}`);return{kind:"piki",name:i}}if(e.startsWith("npm:")){const i=e.slice(4),a=i.lastIndexOf("@"),r=a>0?i.slice(0,a):i,l=a>0?i.slice(a+1):"";if(!dO.test(r)||r.length>214)throw new mi(`Invalid npm package name: ${r}`);if(!uO.test(l))throw new mi(`Pin an exact version, such as npm:${r}@1.2.3: ranges and tags could load different code later.`);return{kind:"npm",package:r,version:l}}if(e.startsWith("git:")){const i=e.slice(4),a=i.lastIndexOf("@"),r=a>0?i.slice(0,a):i,l=a>0?i.slice(a+1):"";let u;try{u=new URL(r.startsWith("https://")?r:`https://${r}`)}catch{throw new mi(`Invalid Git URL: ${r}`)}if(u.protocol!=="https:"||u.username||u.password||u.search||u.hash||u.port)throw new mi("Git extensions install from an https:// URL without credentials.");if(!hO.test(l))throw new mi(`Pin a full commit, such as git:${r}@<40-character commit>: branches and tags could load different code later.`);return{kind:"git",url:u.href.replace(/\/$/,"").replace(/\.git$/,""),commit:l}}throw new mi("An extension source is npm:<package>@<version>, git:<https URL>@<commit> or piki:<name>.")}function mO(e){return e.kind==="npm"?`npm:${e.package}@${e.version}`:e.kind==="git"?`git:${e.url}@${e.commit}`:`piki:${e.name}`}function _s(e){return e.startsWith("piki:")}function Tw(e){return mO(Nw(e))}function Yy(e){const i=Nw(e);return i.kind==="npm"?`npm:${i.package}`:i.kind==="git"?`git:${i.url}`:`piki:${i.name}`}const pO=Object.freeze({workspace:32,installed:64,connector:16,modulesPerSource:16,toolsPerModule:64,flagsPerModule:64,text:1024,toolDescription:4096,settingsBytes:16*1024,reportBytes:512*1024}),gO=(e,i)=>e.some(a=>!a.dev&&a.source===i&&!a.error&&a.modules.every(r=>!r.error));function xO(e,i){return e.filter(a=>!gO(i,a.source)).map(a=>a.source)}const to=Object.freeze([Object.freeze({name:"pi:codemode",title:"Code mode",tools:Object.freeze(["codemode"]),description:"The codemode tool: the model writes JavaScript that calls the session's tools, run in a QuickJS sandbox in the connector, to batch, chain and filter calls. Each call it makes is decided like the model's own, and a script resumes where it was after a restart."})]);Object.freeze(to.map(e=>e.name));const zf=Object.freeze({commandTimeoutSeconds:Object.freeze({min:30,max:3600}),compactionTokens:Object.freeze({min:0,max:1e7}),compactionModels:200,requiredExtensions:16,requiredExtensionsBytes:32*1024}),Uh=Object.freeze({commandTimeoutSeconds:30,gpu:!1,gitCredentials:!1,repositoryCache:"off",hostSessions:!1,compaction:Object.freeze({}),builtinExtensions:Object.freeze([]),requiredExtensions:Object.freeze([])}),yO=Object.freeze(["gitCredentials","repositoryCache","hostSessions","requiredExtensions"]);function bO({session:e,user:i,manages:a,action:r,onChange:l}){const u=e.ownerId===i.id,d=$e(u?`/api/sessions/${oe(e.id)}/link`:null),h=d.data?d.data.link:void 0;async function p(){if(!u||r.busy||e.status==="archived")return!1;if(h)return!0;if(!await He({title:"Share with anyone who has the link?",message:"Anyone with the link will be able to view existing and future prompts and output of the shared conversation, including tool output and repository content shown in it, without signing in. They can't send messages, or see side asks, approvals, who sent each message, or the host. The session title and your display name are shown with it. Values that look like passwords, tokens or keys are hidden, but anyone who has the link can pass it on, so check the transcript for other sensitive content first. You can turn the link off at any time.",confirmLabel:"Create link"}))return!1;let y=!1;return await r.run(async()=>{const v=await ce(`/api/sessions/${oe(e.id)}/link`,{method:"PUT"});d.setData({link:v.link}),y=!0,l()},"Share link created. Anyone who has it can view the shared conversation."),y}async function m(){!a||r.busy||!await He({title:"Turn off the share link?",message:`The link stops working at once, for everyone who has it. Content already viewed or copied can't be recalled. ${u?"Turning link sharing on again creates a new link.":"Only the session's owner can share it by link again, with a new link."}`,confirmLabel:"Turn off link",destructive:!0})||await r.run(async()=>{await ce(`/api/sessions/${oe(e.id)}/link`,{method:"DELETE"}),u&&d.setData({link:null}),l()},"Share link turned off. It no longer opens this session.")}return{link:h,linkLoading:d.loading,linkError:d.error,shareLink:p,unshareLink:()=>{m()}}}function Ew(e){return`${e.location==="workspace-database"?" · Workspace database":""}${e.automatic?" · Automatic":""}${e.conversationOnly?" · Conversation only":""}`}function Bl(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function Vy(e){return e===15?"every 15 minutes":e===60?"every hour":e===360?"every 6 hours":e===1440?"every day":`every ${e} minutes`}function vO(e){if(!e.included)return`The workspace backs up changed sessions ${Vy(e.minutes)}, but not yours until you confirm its database under Settings → Workspaces → Session database`;const i=e.error?`The last attempt failed (${e.error}); it is retried within 15 minutes`:e.pending?"Changed since the last one: it is saved once the session is idle and due":"Up to date";return`Saved ${Vy(e.minutes)} when the session changed. ${i}`}function wO(e){return e==="workspace-database"?"This workspace keeps its backups in its own database, which this server no longer connects to. The workspace owner can disconnect it in the workspace settings":"This server keeps no session backups: its operator hasn't set up backup storage (STORAGE_URL)"}function jO(e){return e.location==="workspace-database"?"This backup was saved in the workspace's own database, which this server can't use now, so it can't be downloaded or restored":"This backup was saved in the server's backup storage, which isn't set up now (STORAGE_URL), so it can't be downloaded or restored"}const sc=new Map;function Zy(e,i,a){return`session-backup-restore:${JSON.stringify([e,i,a])}`}function Xy(e){const i=sc.get(e);if(i)return i;const a=sessionStorage.getItem(e);if(!a)return;const r=JSON.parse(a);if(!r||typeof r!="object"||!("requestId"in r)||typeof r.requestId!="string"||"title"in r&&typeof r.title!="string"||"targetSessionId"in r&&typeof r.targetSessionId!="string")throw new Error("The saved restore request could not be read. Restore is paused to avoid creating a duplicate session.");const l=r;return sc.set(e,l),l}function zw(e,i){return`/api/sessions/${oe(e)}/backups/${oe(i)}/download`}function kO({sourceId:e,ownerId:i,backups:a,latestBackup:r,refreshKey:l,openSession:u}){const d=`/api/sessions/${oe(e)}`,[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(),[b,w]=N.useState(""),[S,C]=N.useState(""),[k,O]=N.useState(!1),T=N.useRef(!1),M=a.data?.backups.find(re=>re.id===h),_=!!M?.unavailable&&!y?.targetSessionId;N.useEffect(()=>{(r||l)&&a.refresh()},[r,l,a.refresh]);function $(re){if(!k&&(p(re),w(""),C(""),v(void 0),x(""),!!re))try{const Y=Xy(Zy(i,e,re));v(Y),x(Y?.title??"")}catch(Y){C(`Cannot safely resume restore: ${On(Y)}`)}}async function G(re){if(re.preventDefault(),!(!M||T.current||S||_)){T.current=!0,O(!0),w("");try{const Y=Zy(i,e,M.id);let F=Xy(Y);if(!F){const de=m.trim();if(de.length>200||de.includes("\0"))throw new Error("Use a title of at most 200 characters with no NUL characters, or leave it blank");F={requestId:crypto.randomUUID(),...de?{title:de}:{}},sessionStorage.setItem(Y,JSON.stringify(F)),sc.set(Y,F)}if(v(F),F.targetSessionId){u(F.targetSessionId);return}const B=await ce(`${d}/backups/${oe(M.id)}/restore`,{method:"POST",body:{requestId:F.requestId,...F.title?{title:F.title}:{}}});if(!B.session?.id||B.session.id===e||B.restore?.status!=="completed"||B.restore.sourceSessionId!==e||B.restore.backupId!==M.id||B.restore.targetSessionId!==B.session.id)throw new Error("The server did not confirm a completed restore into a new session. Retry this same request to resolve its outcome.");const se={...F,targetSessionId:B.session.id};sc.set(Y,se),v(se);try{sessionStorage.setItem(Y,JSON.stringify(se))}catch{}u(B.session.id)}catch(Y){w(On(Y))}finally{T.current=!1,O(!1)}}}if(a.loading)return n.jsx(W,{title:n.jsx($t,{children:"Loading backups..."})});if(a.error)return n.jsx(W,{title:"Unable to load backups",hint:a.error,trailing:n.jsx(q,{variant:"outline",size:"sm",onClick:a.refresh,children:"Try again"})});const J=a.data?.backups??[],U=a.data?.enabled!==!1,E=a.data?.workspaceDatabase,I=U?E&&n.jsx(W,{leading:n.jsx(be,{name:"server",size:16}),title:"Saved to the workspace database",hint:E.confirm?`New backups of this session go to ${Bl(E)}, which the workspace owner connected. Whoever can read it can read them, including your personal environment values; you confirm before each backup`:E.consented?`New backups of this session go to ${Bl(E)}, which the workspace owner connected and you confirmed. Whoever can read it can read them, including your personal environment values`:`New backups of this session go to ${Bl(E)}, the database you connected for this workspace`}):n.jsx(W,{leading:n.jsx(be,{name:"info",size:16}),title:"Backups are off",hint:wO(a.data?.destination)}),Q=U&&a.data?.automaticBackups,ie=Q&&n.jsx(W,{leading:n.jsx(be,{name:Q.error?"info":"refresh",size:16}),title:"Automatic backups",hint:vO(Q)});return J.length?n.jsxs(n.Fragment,{children:[I,ie,J.map(re=>n.jsxs("div",{className:"backup-item",children:[n.jsx(W,{leading:n.jsx(be,{name:"archive",size:16}),title:n.jsx(Qt,{value:re.createdAt}),hint:`${re.size} bytes${Ew(re)}${re.unavailable?" · Unavailable":""}`,trailing:n.jsx(be,{name:re.id===h?"chevron-down":"chevron-right",size:16}),onClick:()=>$(re.id===h?"":re.id)}),M?.id===re.id&&n.jsx("form",{className:"backup-detail",onSubmit:G,children:n.jsxs("fieldset",{disabled:k,className:"stack",children:[n.jsxs("p",{className:"muted small",children:["ID ",n.jsx("code",{children:M.id}),"; SHA-256 ",n.jsx("code",{children:M.sha256})]}),M.unavailable?n.jsx("p",{className:"small",children:jO(M)}):n.jsx("div",{className:"inline",children:n.jsx(Ht,{variant:"outline",size:"sm",icon:"external",href:zw(e,M.id),children:"Download backup"})}),n.jsx(xe,{label:"New session title",hint:"Optional. Restore creates a new private session and never overwrites this one",children:n.jsx("input",{className:"input",autoComplete:"off",maxLength:200,value:m,disabled:!!y||!!S||_,onChange:Y=>x(Y.target.value)})}),y&&n.jsxs("p",{className:"muted small",children:["Restore request ",n.jsx("code",{children:y.requestId}),". Retrying reuses this request ID and title, so it resolves the same new session instead of creating another."]}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{type:"submit",variant:"secondary",size:"sm",disabled:!!S||_,children:k?"Restoring...":y?.targetSessionId?"Open restored session":y?"Retry same restore":"Restore into new private session"}),k&&n.jsx($t,{children:"Waiting for the server to confirm the new session..."})]}),n.jsx(ye,{error:S||b}),b&&y&&!y.targetSessionId&&n.jsx(we,{variant:"warning",title:"Outcome not confirmed",children:"Retry the same restore; an error doesn't mean no session was created."}),y?.targetSessionId&&n.jsxs("p",{className:"muted small",role:"status",children:["Restored session: ",n.jsx("code",{children:y.targetSessionId}),". It is private; only its owner, or the workspace's owner or an admin, can change visibility."]})]})})]},re.id))]}):n.jsxs(n.Fragment,{children:[I,ie,U&&n.jsx(W,{title:"No backups yet",hint:"Listing and downloading work while the host is offline"})]})}function SO({session:e,user:i,hosts:a,openSession:r,changed:l}){const u=$e(`/api/workspaces/${oe(e.workspaceId)}/models`),d=$e(`/api/sessions/${oe(e.id)}/migrations`),[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(""),[b,w]=N.useState(""),[S,C]=N.useState(!1),k=a.data?.connectors??[],O=k.find(I=>I.id===e.connectorId),T=d.data?.migrations.find(I=>I.status==="pending"&&I.sourceSessionId===e.id),M=N.useMemo(()=>(u.data?.models??[]).flatMap(I=>{const Q=k.find(ie=>ie.id===I.connectorId);return!Q||Q.id===e.connectorId||Q.revokedAt||Q.capabilities.hostMigration!==!0||!Q.models.some(ie=>ie.provider===I.provider&&ie.modelId===I.modelId)?[]:[{model:I,host:Q}]}),[u.data,k,e.connectorId]),_=M.find(I=>I.model.id===h),$=!!(_&&_.host.ownerId!==i.id),G=!!(_&&_.host.online&&O?.online&&(!$||y===_.host.id)&&!S);async function J(I){C(!0),w("");try{const Q=await ce(`/api/sessions/${oe(e.id)}/migrate`,{method:"POST",body:I});if(Q.migration?.status!=="completed"||Q.migration.sourceSessionId!==e.id||Q.migration.targetSessionId!==Q.session?.id)throw new Error("The server did not confirm the move. Retry it to resolve its outcome.");l(),r(Q.session.id)}catch(Q){w(On(Q)),d.refresh()}finally{C(!1)}}async function U(I){if(I.preventDefault(),!_||!G||!await He({title:"Move session",message:`Move this session to ${_.host.name} (${_.model.name})? Its conversation, files and history are copied there into a new session, and this one is archived. ${$?`${_.host.name}'s owner can access prompts and files processed on it. `:""}Session grants aren't copied.`,confirmLabel:"Move session"}))return;const ie=m.trim();await J({requestId:crypto.randomUUID(),modelId:_.model.id,...ie?{title:ie}:{},...$?{trustedConnectorId:_.host.id}:{}})}async function E(){if(!(!T||!await He({title:"Cancel move",message:"Cancel this move? This session accepts work again, and the unfinished copy on the other host is archived.",confirmLabel:"Cancel move",cancelLabel:"Keep",destructive:!0}))){C(!0),w("");try{await ce(`/api/sessions/${oe(e.id)}/migrations/${oe(T.id)}/cancel`,{method:"POST"}),d.refresh(),l()}catch(Q){w(On(Q))}finally{C(!1)}}}return n.jsxs(Ae,{title:"Move to another host",info:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"Copies this session's conversation, files and history to a model on another connected host, then archives this session. Both hosts must be connected and the session idle. No backup storage is needed."}),n.jsx("p",{children:"The new session keeps the same repositories, visibility and agent instructions, with the tools the new host can carry. Session grants and approvals given for the rest of this session aren't copied."})]}),children:[T?n.jsxs(n.Fragment,{children:[n.jsx(W,{leading:n.jsx(be,{name:"refresh",size:16}),title:"Move in progress",hint:n.jsxs(n.Fragment,{children:["To ",k.find(I=>I.id===T.targetConnectorId)?.name??"another host",". This session accepts only reads until the move finishes or is cancelled"]})}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"secondary",size:"sm",disabled:S,onClick:()=>{J({requestId:T.requestId,modelId:T.modelId,...T.title!==null?{title:T.title}:{},trustedConnectorId:T.targetConnectorId})},children:S?"Moving...":"Retry move"}),n.jsx(q,{variant:"outline",size:"sm",disabled:S,onClick:()=>{E()},children:"Cancel move"}),S&&n.jsx($t,{children:"Waiting for the other host..."})]})]}):u.loading||d.loading||a.loading?n.jsx(W,{title:n.jsx($t,{children:"Loading hosts..."})}):M.length?n.jsxs("form",{className:"stack",onSubmit:I=>{U(I)},children:[n.jsx(xe,{label:"Model on the new host",children:n.jsxs("select",{className:"input",value:h,disabled:S,onChange:I=>{p(I.target.value),v("")},children:[n.jsx("option",{value:"",children:"Choose a model..."}),M.map(({model:I,host:Q})=>n.jsxs("option",{value:I.id,children:[Q.name," · ",I.name,Q.online?"":" (offline)"]},I.id))]})}),n.jsx(xe,{label:"New session title",hint:"Optional. Defaults to this session's title",children:n.jsx("input",{className:"input",autoComplete:"off",maxLength:200,value:m,disabled:S,onChange:I=>x(I.target.value)})}),_&&$&&n.jsxs("label",{className:"inline small",children:[n.jsx("input",{type:"checkbox",checked:y===_.host.id,onChange:I=>v(I.target.checked?_.host.id:"")}),"I understand that ",_.host.name,"'s owner can access this session's prompts and files"]}),_&&!_.host.online&&n.jsxs(we,{variant:"warning",title:"Host offline",children:[_.host.name," must be connected to receive the session."]}),!O?.online&&n.jsx(we,{variant:"warning",title:"This session's host is offline",children:"Both hosts must be connected to start a move."}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{type:"submit",variant:"secondary",size:"sm",disabled:!G,children:S?"Moving...":"Move session"}),S&&n.jsx($t,{children:"Copying the session to the new host..."})]})]}):n.jsx(W,{leading:n.jsx(be,{name:"info",size:16}),title:"No other host available",hint:"Another connected host in this workspace, with an up-to-date connector on Linux, must offer a model here"}),n.jsx(ye,{error:b||u.error||d.error||a.error})]})}const CO="modulepreload",AO=function(e){return"/"+e},Qy={},NO=function(i,a,r){let l=Promise.resolve();if(a&&a.length>0){let p=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");l=p(a.map(m=>{if(m=AO(m),m in Qy)return;Qy[m]=!0;const x=m.endsWith(".css"),y=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${y}`))return;const v=document.createElement("link");if(v.rel=x?"stylesheet":CO,x||(v.as="script"),v.crossOrigin="",v.href=m,h&&v.setAttribute("nonce",h),document.head.appendChild(v),x)return new Promise((b,w)=>{v.addEventListener("load",b),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function u(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return l.then(d=>{for(const h of d||[])h.status==="rejected"&&u(h.reason);return i().catch(u)})};let Ow;async function TO(){const{createLowlight:e,common:i}=await NO(async()=>{const{createLowlight:a,common:r}=await import("./index-ClW_3YVo.js");return{createLowlight:a,common:r}},[]);return e(i)}const Ky={makefile:"makefile",gnumakefile:"makefile",gemfile:"ruby",rakefile:"ruby",podfile:"ruby",vagrantfile:"ruby","cmakelists.txt":"plaintext",".bashrc":"bash",".zshrc":"bash",".profile":"bash",".env":"bash",".gitconfig":"ini",".editorconfig":"ini",".npmrc":"ini",pipfile:"ini"},EO={h:"c",hh:"cpp",hxx:"cpp",ipp:"cpp",mdx:"markdown",jsonc:"json",json5:"json",geojson:"json",webmanifest:"json",lock:"plaintext",txt:"plaintext",log:"plaintext",csv:"plaintext",svelte:"xml",vue:"xml",astro:"xml",pyi:"python",pyw:"python",gemspec:"ruby",rake:"ruby",ru:"ruby",kts:"kotlin",gradle:"kotlin",cjs:"javascript",mjs:"javascript",mts:"typescript",cts:"typescript",fish:"bash",ksh:"bash",conf:"ini",cfg:"ini",properties:"ini",env:"bash",pem:"plaintext",tf:"plaintext",proto:"plaintext"},zO=128*1024;function OO(e,i){const a=e.slice(e.lastIndexOf("/")+1).toLowerCase();if(Ky[a])return Ky[a];if(a.startsWith(".env."))return"bash";if(a.startsWith("dockerfile"))return i("dockerfile")?"dockerfile":"bash";const r=a.lastIndexOf(".");if(r<=0)return null;const l=a.slice(r+1),u=EO[l]??l;return i(u)?u:null}function Rw(e){return e.map((i,a)=>{if(i.type==="text")return i.value;if(i.type!=="element")return null;const r=i.properties?.className;return n.jsx("span",{className:Array.isArray(r)?r.join(" "):void 0,children:Rw(i.children)},a)})}function RO(e,i){const[a,r]=N.useState(null);return N.useEffect(()=>{let l=!0;return DO().then(u=>{l&&r(u)},()=>{Ow=void 0}),()=>{l=!1}},[]),N.useMemo(()=>a?MO(a,e,i):{content:e,language:null},[a,e,i])}function MO(e,i,a){const r=OO(a,l=>e.registered(l));if(!r||r==="plaintext")return{content:i,language:null};if(i.length>zO)return{content:i,language:null,tooLarge:!0};try{return{content:Rw(e.highlight(r,i).children),language:r}}catch{return{content:i,language:null}}}function DO(){return Ow??=TO()}function Mw({text:e,path:i}){const{content:a,language:r,tooLarge:l}=RO(e,i),u=N.useMemo(()=>{const d=e.split(`
|
|
52
|
+
`).length-(e.endsWith(`
|
|
53
|
+
`)?1:0);return Array.from({length:Math.max(d,1)},(h,p)=>p+1).join(`
|
|
54
|
+
`)},[e]);return n.jsxs("div",{className:"stack",children:[n.jsxs("div",{className:"code-view","data-language":r??void 0,children:[n.jsx("pre",{className:"code-gutter","aria-hidden":"true",children:u}),n.jsx("pre",{className:"code-text",children:n.jsx("code",{className:r?`hljs language-${r}`:void 0,children:a})})]}),l&&n.jsx("p",{className:"muted small",children:"Highlighting is off for text over 128 KB."})]})}function LO(e,i){return e==="."?i:`${e}/${i}`}function _O(e){const i=e.lastIndexOf("/");return i<0?".":e.slice(0,i)}function Hl(e){if(e<1024)return`${e} B`;const i=["KB","MB","GB","TB"];let a=e/1024,r=0;for(;a>=1024&&r<i.length-1;)a/=1024,r++;return`${a<10?a.toFixed(1):Math.round(a)} ${i[r]}`}const $O={directory:"folder",file:"file",symlink:"link",other:"file"};function UO({session:e}){const i=e.permissions??[],[a,r]=N.useState("."),[l,u]=N.useState(null);if(N.useEffect(()=>{r("."),u(null)},[e.id]),e.status==="archived")return n.jsx(xt,{title:"Files unavailable",children:"Archived sessions don't show their files. Unarchive the session to browse them."});if(!i.includes("write"))return n.jsx(xt,{title:"Files unavailable",children:"Browsing the session's files takes the session collaborator role, as collaborators can already have the agent read any of them. Viewers follow the conversation."});const d=h=>{r(h),u(null)};return l?n.jsx(BO,{session:e,path:l,onBack:()=>u(null),onDirectory:d}):n.jsx(IO,{session:e,path:a,onOpen:d,onFile:u})}function Dw(e,i){return`/api/sessions/${oe(e.id)}/files?path=${encodeURIComponent(i)}`}function Lw({path:e,onOpen:i}){const a=e==="."?[]:e.split("/");return n.jsxs("nav",{className:"file-breadcrumbs","aria-label":"Worktree path",children:[n.jsx("button",{type:"button",className:"file-crumb",onClick:()=>i("."),disabled:!a.length,children:"worktree"}),a.map((r,l)=>{const u=a.slice(0,l+1).join("/"),d=l===a.length-1;return n.jsxs("span",{className:"file-crumb-item",children:[n.jsx("span",{className:"muted","aria-hidden":"true",children:"/"}),n.jsx("button",{type:"button",className:"file-crumb",onClick:()=>i(u),disabled:d,"aria-current":d?"location":void 0,children:r})]},u)})]})}function IO({session:e,path:i,onOpen:a,onFile:r}){const l=$e(Dw(e,i)),u=l.data?.files;return N.useEffect(()=>{u?.type==="file"&&r(i)},[u,i,r]),n.jsxs("div",{className:"file-browser",children:[n.jsxs("div",{className:"file-browser-bar",children:[n.jsx(Lw,{path:i,onOpen:a}),n.jsx("span",{className:"spacer"}),n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh files",title:"Refresh",disabled:l.loading,onClick:l.refresh})]}),n.jsx(tt,{loading:l.loading&&!u,error:l.error,retry:l.refresh,children:u?.type==="directory"&&(u.entries.length||i!=="."?n.jsxs("div",{className:"card file-list",children:[i!=="."&&n.jsx(W,{leading:n.jsx(be,{name:"chevron-left",size:16}),title:"..",hint:"Parent directory",onClick:()=>a(_O(i))}),u.entries.map(d=>{const h=LO(i,d.name);return n.jsx(W,{leading:n.jsx(be,{name:$O[d.type],size:16}),title:n.jsxs("span",{className:"file-name",children:[d.name,d.type==="directory"?"/":""]}),hint:d.type==="symlink"?"Symlink":d.type==="other"?"Special file":void 0,trailing:d.size!==void 0?n.jsx("span",{className:"muted small",children:Hl(d.size)}):void 0,onClick:d.type==="other"?void 0:()=>d.type==="directory"?a(h):r(h)},d.name)}),!u.entries.length&&n.jsx(W,{title:"Empty directory"}),u.truncated&&n.jsx(W,{title:`Showing ${u.entries.length} of ${u.total} entries`,hint:"Directories first, then by name"})]}):n.jsx(xt,{title:"The worktree is empty",children:"The agent clones the session's repositories into it as it works."}))})]})}function BO({session:e,path:i,onBack:a,onDirectory:r}){const l=$e(Dw(e,i)),u=l.data?.files;return N.useEffect(()=>{u?.type==="directory"&&r(i)},[u,i,r]),n.jsxs("div",{className:"file-browser",children:[n.jsxs("div",{className:"file-browser-bar",children:[n.jsx(q,{variant:"ghost",size:"xs",icon:"chevron-left","aria-label":"Back to directory",title:"Back",onClick:a}),n.jsx(Lw,{path:i,onOpen:r}),n.jsx("span",{className:"spacer"}),n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh file",title:"Refresh",disabled:l.loading,onClick:l.refresh})]}),n.jsx(tt,{loading:l.loading&&!u,error:l.error,retry:l.refresh,children:u?.type==="file"&&n.jsxs("div",{className:"stack",children:[n.jsxs("p",{className:"muted small",children:[Hl(u.size),u.text!==void 0&&u.truncated?` · showing the first ${Hl(qx.textBytes)}`:""]}),u.redacted&&n.jsxs(we,{title:"Secret hidden",children:["Something that looks like a secret is shown as ",n.jsx("code",{children:kt}),", as in the conversation."]}),u.text!==void 0&&(u.text?HO(i)&&!u.truncated?n.jsx(qO,{text:u.text,path:i},i):n.jsx(Mw,{text:u.text,path:i}):n.jsx(xt,{title:"Empty file"})),u.image&&n.jsx(_w,{src:`data:${u.image.mimeType};base64,${u.image.data}`,path:i},i),u.binary&&n.jsx(xt,{title:u.truncated?"Too large to preview":"No preview",children:u.truncated?`Images up to ${Hl(qx.imageBytes)} are shown.`:"This isn't a text file or an image."})]})})]})}const HO=e=>/\.svg$/i.test(e);function _w({src:e,path:i}){const[a,r]=N.useState(null),[l,u]=N.useState(!1),[d,h]=N.useState(!1);return d?n.jsx(xt,{title:"Can't show this image",children:"The browser couldn't decode it."}):n.jsxs("figure",{className:"file-image-view",children:[n.jsx("button",{type:"button",className:l?"file-image-frame actual":"file-image-frame",onClick:()=>u(p=>!p),title:l?"Fit to panel":"Show actual size","aria-label":l?"Fit image to panel":"Show image at actual size",children:n.jsx("img",{className:"file-image",alt:i,src:e,draggable:!1,onLoad:p=>r({width:p.currentTarget.naturalWidth,height:p.currentTarget.naturalHeight}),onError:()=>h(!0)})}),a&&n.jsxs("figcaption",{className:"muted small",children:[a.width," × ",a.height," px · ",l?"actual size":"fit to panel"]})]})}function qO({text:e,path:i}){const[a,r]=N.useState("preview");return n.jsxs("div",{className:"stack",children:[n.jsx(hs,{size:"xs",label:"SVG view",value:a,onChange:r,options:[{value:"preview",label:"Preview"},{value:"source",label:"Source"}]}),a==="preview"?n.jsx(_w,{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,path:i}):n.jsx(Mw,{text:e,path:i})]})}const Ih=5,FO={"@hourly":"0 * * * *","@daily":"0 0 * * *","@midnight":"0 0 * * *","@weekly":"0 0 * * 0","@monthly":"0 0 1 * *","@yearly":"0 0 1 1 *","@annually":"0 0 1 1 *"},GO=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],PO=["sun","mon","tue","wed","thu","fri","sat"];class Jn extends Error{}function rh(e,i,a,r,l=0){const u=e.toLowerCase(),d=r?.indexOf(u)??-1;if(d>=0)return d+l;if(!/^\d{1,2}$/.test(e))throw new Jn(`"${e}" is not a valid value.`);const h=Number(e);if(h<i||h>a)throw new Jn(`${h} is outside ${i}-${a}.`);return h}function Pr(e,i,a,r,l,u=0){const d=new Set;if(e==="*"||e==="?"){for(let h=i;h<=a;h++)d.add(h);return{values:d,any:!0}}try{for(const h of e.split(",")){const[p,m,x]=h.split("/");if(x!==void 0||!p)throw new Jn(`"${h}" is not a valid entry.`);let y=1;if(m!==void 0){if(!/^\d{1,2}$/.test(m)||Number(m)<1)throw new Jn(`"${m}" is not a valid step.`);y=Number(m)}let v,b;if(p==="*")v=i,b=a;else if(p.includes("-")){const[w,S,C]=p.split("-");if(C!==void 0||!w||!S)throw new Jn(`"${p}" is not a valid range.`);if(v=rh(w,i,a,l,u),b=rh(S,i,a,l,u),v>b)throw new Jn(`"${p}" runs backwards.`)}else v=rh(p,i,a,l,u),b=m===void 0?v:a;for(let w=v;w<=b;w+=y)d.add(w)}}catch(h){throw h instanceof Jn?new Jn(`${r}: ${h.message}`):h}return{values:d,any:!1}}function $w(e){const i=e.trim().replace(/\s+/g," "),r=(FO[i.toLowerCase()]??i).split(" ");if(r.length!==5)throw new Jn("A schedule has five fields: minute, hour, day of month, month and day of week.");const[l,u,d,h,p]=r,m=Pr(l,0,59,"Minute"),x=Pr(u,0,23,"Hour"),y=Pr(d,1,31,"Day of month"),v=Pr(h,1,12,"Month",GO,1),b=Pr(p,0,7,"Day of week",PO);b.values.delete(7)&&b.values.add(0);const w=[...m.values].sort((S,C)=>S-C);for(let S=0;S<w.length;S++){const C=S+1<w.length?w[S+1]:w[0]+60;if(w.length>1&&C-w[S]<Ih)throw new Jn(`Runs must be at least ${Ih} minutes apart.`)}return{minutes:m.values,hours:x.values,days:y.values,months:v.values,weekdays:b.values,anyDay:y.any,anyWeekday:b.any}}const Wy=new Map;function Uw(e){let i=Wy.get(e);return i||(i=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),Wy.set(e,i)),i}function YO(e){if(typeof e!="string"||!e||e.length>64)return!1;try{return Uw(e),!0}catch{return!1}}function ql(e,i){const a={};for(const r of Uw(i).formatToParts(new Date(e)))r.type!=="literal"&&(a[r.type]=Number(r.value));return Date.UTC(a.year,a.month-1,a.day,a.hour,a.minute,a.second)}function VO(e,i){let a=e-(ql(e,i)-e);return a=e-(ql(a,i)-a),ql(a,i)===e?a:null}function ZO(e,i){const a=e.days.has(i.getUTCDate()),r=e.weekdays.has(i.getUTCDay());return e.anyDay&&e.anyWeekday?!0:e.anyDay?r:e.anyWeekday?a:a||r}const Zr=6e4,XO=60*Zr,QO=24*XO;function KO(e,i,a){const r=typeof e=="string"?$w(e):e;let l=Math.floor(ql(a,i)/Zr)*Zr+Zr;const u=l+5*366*QO;for(;l<u;){const d=new Date(l);if(!r.months.has(d.getUTCMonth()+1)){l=Date.UTC(d.getUTCFullYear(),d.getUTCMonth()+1,1);continue}if(!ZO(r,d)){l=Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate()+1);continue}if(!r.hours.has(d.getUTCHours())){l=Date.UTC(d.getUTCFullYear(),d.getUTCMonth(),d.getUTCDate(),d.getUTCHours()+1);continue}if(r.minutes.has(d.getUTCMinutes())){const h=VO(l,i);if(h!==null&&h>a)return h}l+=Zr}return null}const Jy=[{label:"Every hour",cron:"0 * * * *"},{label:"Every day at 09:00",cron:"0 9 * * *"},{label:"Weekdays at 09:00",cron:"0 9 * * 1-5"},{label:"Every Monday at 09:00",cron:"0 9 * * 1"},{label:"First of the month at 09:00",cron:"0 9 1 * *"}],Iw={read:"Read-only",approval:"Ask for approval",auto:"Auto-approve"},WO={read:"The agent can look, but changes nothing",approval:"Commands and pushes wait for someone to approve them, as in the chat box",auto:"Commands run without asking, under your auto-approve. Nobody may be watching when it runs"},JO={session_busy:"Skipped: the agent was busy or waiting for an approval",connector_offline:"The host was offline",connector_unavailable:"The host was unavailable",connector_relay_error:"The host didn't answer",forbidden:"You no longer have write access",session_frozen:"The session runs nothing"};function e4(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function t4(e){const i=Math.max(0,(new Date(e).getTime()-Date.now())/1e3);return i<60?"in under a minute":i<3600?`in ${Math.round(i/60)}m`:i<86400?`in ${Math.round(i/3600)}h`:`in ${Math.round(i/86400)}d`}function n4(e,i){if(!YO(i))return{error:"Unknown time zone.",field:"timeZone"};try{const a=$w(e),r=[];let l=Date.now();for(let u=0;u<3;u++){const d=KO(a,i,l);if(d===null)break;r.push(new Date(d).toISOString()),l=d}return r.length?{runs:r}:{error:"This schedule never comes round.",field:"cron"}}catch(a){return{error:a instanceof Jn?a.message:"Invalid schedule.",field:"cron"}}}function s4({session:e,changed:i}){const a=`/api/sessions/${oe(e.id)}/schedules`,r=$e(a),{refreshSessions:l}=pt(),u=je(),[d,h]=N.useState(null),p=!!r.data?.canManage&&!e.frozen,m=()=>{r.refresh(),l(),i()},x=`${e.nextScheduledAt??""}|${e.activity??""}`,y=N.useRef(x),{refresh:v}=r;N.useEffect(()=>{y.current!==x&&(y.current=x,v())},[x,v]);function b(k){u.run(async()=>{await ce(`${a}/${oe(k.id)}`,{method:"PATCH",body:{enabled:!k.enabled}}),m()},k.enabled?`Paused ${k.name}`:`Resumed ${k.name}`)}function w(k){u.run(async()=>{await ce(`${a}/${oe(k.id)}/run`,{method:"POST"}),m()},`Sent ${k.name} to the agent`)}async function S(k){await He({title:"Delete schedule?",message:`${k.name} stops waking the agent. Messages it already sent stay in the conversation.`,confirmLabel:"Delete",destructive:!0})&&await u.run(async()=>{await ce(`${a}/${oe(k.id)}`,{method:"DELETE"}),m()},`Deleted ${k.name}`)}if(d)return n.jsx(i4,{base:a,schedule:d==="new"?null:d,isOwner:p,onDone:k=>{h(null),k&&m()}});const C=r.data?.schedules??[];return n.jsxs(Ae,{title:n.jsxs(n.Fragment,{children:["Scheduled prompts ",C.length>0&&n.jsx("span",{className:"muted",children:C.length})]}),info:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"A scheduled prompt sends the agent a message on a schedule, as the session owner, so the session wakes up and works on its own: a nightly check, a weekly report."}),n.jsx("p",{children:"A run that comes while the agent is working or waiting for an approval is skipped, not queued. Runs missed while the host or server was offline aren't caught up. The session's host must be online."}),n.jsx("p",{children:"Only the session owner manages its schedules; everyone who can view the session sees them."})]}),action:n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh schedules",title:"Refresh",disabled:r.loading,onClick:r.refresh}),p&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h("new"),children:"New"})]}),bare:!0,children:[n.jsx(tt,{...r,retry:r.refresh,children:C.length?n.jsx("div",{className:"stack",children:C.map(k=>n.jsxs("article",{className:"card schedule-card",children:[n.jsx(W,{leading:n.jsx(be,{name:"clock",size:16}),title:k.name,hint:n.jsxs(n.Fragment,{children:[n.jsx("code",{children:k.cron})," · ",k.timeZone," · ",Iw[k.access]]}),trailing:k.enabled?k.nextRunAt?n.jsxs(ge,{tone:"info",children:["Next ",t4(k.nextRunAt)]}):n.jsx(ge,{tone:"warning",children:"Never runs"}):n.jsx(ge,{tone:"neutral",children:"Paused"})}),n.jsxs(ke,{children:[n.jsx("pre",{className:"schedule-content",children:k.content}),n.jsxs("p",{className:"muted small",children:[k.enabled&&k.nextRunAt&&n.jsxs(n.Fragment,{children:["Next run ",n.jsx(Qt,{value:k.nextRunAt}),". "]}),k.lastRunAt?n.jsxs(n.Fragment,{children:["Last run ",n.jsx(Qt,{value:k.lastRunAt}),k.lastError?n.jsxs(n.Fragment,{children:[": ",n.jsx("span",{className:"session-status warning",children:JO[k.lastError]??k.lastError})]}):" sent its message","."]}):"Hasn't run yet."]}),p&&n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>b(k),children:k.enabled?"Pause":"Resume"}),n.jsx(q,{variant:"ghost",size:"sm",disabled:u.busy,title:"Send its message now; its schedule stays as it is",onClick:()=>w(k),children:"Run now"}),n.jsx(q,{variant:"ghost",size:"sm",icon:"pencil",disabled:u.busy,onClick:()=>h(k),children:"Edit"}),n.jsx(q,{variant:"ghost",size:"sm",icon:"trash",disabled:u.busy,"aria-label":`Delete ${k.name}`,title:"Delete",onClick:()=>{S(k)}})]})]})]},k.id))}):n.jsx(xt,{title:"No scheduled prompts",children:p?"Wake the agent with a message every hour, day or week.":"The session owner hasn't scheduled any prompts."})}),n.jsx(ye,{error:u.error,notice:u.notice})]})}function i4({base:e,schedule:i,isOwner:a,onDone:r}){const l=je(),[u,d]=N.useState(i?.name??""),[h,p]=N.useState(i?.cron??"0 9 * * 1-5"),[m,x]=N.useState(i?.timeZone??e4()),[y,v]=N.useState(i?.content??""),[b,w]=N.useState(i?.access??"approval"),S=N.useMemo(()=>n4(h,m),[h,m]),C=Jy.find(T=>T.cron===h.trim())?.cron??"",k=a&&y.trim().length>0&&"runs"in S;function O(T){T.preventDefault(),!(!k||l.busy)&&l.run(async()=>{const M={name:u.trim(),cron:h,timeZone:m,content:y,access:b};i?await ce(`${e}/${oe(i.id)}`,{method:"PATCH",body:{...M,...M.name?{}:{name:i.name}}}):await ce(e,{method:"POST",body:M}),r(!0)})}return n.jsx(Ae,{title:i?"Edit scheduled prompt":"New scheduled prompt",bare:!0,children:n.jsx("form",{className:"card",onSubmit:O,children:n.jsx(ke,{children:n.jsxs("fieldset",{disabled:l.busy,className:"stack",children:[n.jsx(xe,{label:"Message",hint:"Sent to the agent as you, as if you typed it in the chat box",children:n.jsx("textarea",{className:"textarea",required:!0,autoFocus:!i,rows:4,value:y,onChange:T=>v(T.target.value),placeholder:"Pull main, run the tests and summarise any failures"})}),n.jsx(xe,{label:"Name",hint:"Optional; the message's first line otherwise",children:n.jsx("input",{className:"input",maxLength:100,value:u,onChange:T=>d(T.target.value),placeholder:"Nightly test run"})}),n.jsx(xe,{label:"Repeat",children:n.jsxs("select",{className:"select",value:C,onChange:T=>{T.target.value&&p(T.target.value)},children:[Jy.map(T=>n.jsx("option",{value:T.cron,children:T.label},T.cron)),n.jsx("option",{value:"",children:"Custom"})]})}),n.jsx(xe,{label:"Cron expression",hint:n.jsxs(n.Fragment,{children:["Minute, hour, day of month, month, day of week, as in crontab: ",n.jsx("code",{children:"*/30 8-18 * * mon-fri"}),". Runs at least ",Ih," minutes apart."]}),error:"error"in S&&S.field==="cron"?S.error:void 0,children:n.jsx("input",{className:"input mono",required:!0,spellCheck:!1,autoComplete:"off",value:h,onChange:T=>p(T.target.value)})}),n.jsx(xe,{label:"Time zone",hint:"IANA name, such as UTC or Europe/Berlin",error:"error"in S&&S.field==="timeZone"?S.error:void 0,children:n.jsx("input",{className:"input",required:!0,spellCheck:!1,autoComplete:"off",value:m,onChange:T=>x(T.target.value)})}),"runs"in S&&n.jsxs("p",{className:"muted small",children:["Next runs: ",S.runs.map((T,M)=>n.jsxs("span",{children:[M?", ":"",n.jsx(Qt,{value:T})]},T))]}),n.jsx(xe,{label:"Access",hint:WO[b],children:n.jsx("select",{className:"select",value:b,onChange:T=>w(T.target.value),children:["approval","read","auto"].map(T=>n.jsx("option",{value:T,children:Iw[T]},T))})}),b==="auto"&&n.jsx(we,{variant:"error",title:"Runs commands unattended",children:"Every command this message's work runs is approved automatically, at times when nobody may be watching."}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{type:"submit",variant:"default",size:"sm",disabled:!k,children:l.busy?"Saving...":i?"Save":"Create schedule"}),n.jsx(q,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Cancel"})]}),n.jsx(ye,{error:l.error}),l.busy&&n.jsx($t,{children:"Saving"})]})})})})}const a4={ask:"Side ask",send:"Message",create:"Opening message",notify:"Notification"},r4={pending:{label:"Will notify",tone:"info"},delivered:{label:"Notified",tone:"success"},failed:{label:"Notification failed",tone:"danger"},expired:{label:"Notification expired",tone:"neutral"}};function eb({session:e,relation:i}){return n.jsx(W,{href:Xe({name:"session",sessionId:e.id}),chevron:!0,leading:n.jsx(be,{name:"link",size:16}),title:n.jsx("span",{className:"truncate",children:e.title}),hint:n.jsxs(n.Fragment,{children:[i," · ",e.status==="archived"?"Archived":e.activity??e.status]})})}function o4({session:e}){const i=$e(`/api/sessions/${oe(e.id)}/connections`),a=i.data;return a&&!a.parent&&!a.children.length&&!a.messages.length?null:n.jsx(Ae,{title:"Connected sessions",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Agents work with other sessions through the sessions tool, always as the person whose message they work on, with that person's own permissions there."}),n.jsx("p",{children:"Messages they send name this session and their sender in their first line; Pikibun also records each one here. Approvals in another session are decided only by people there."})]}),children:n.jsx(tt,{loading:i.loading,error:i.error,retry:i.refresh,children:a&&n.jsxs(n.Fragment,{children:[a.parent&&n.jsx(eb,{session:a.parent,relation:"Started this session"}),a.children.map(r=>n.jsx(eb,{session:r,relation:"Started by this session"},r.id)),a.messages.map(r=>{const l=r.originSessionId===e.id,u=l?r.targetSessionId:r.originSessionId,d=r.notify&&r4[r.notify];return n.jsx(W,{href:Xe({name:"session",sessionId:u}),leading:n.jsx(be,{name:l?"send":"message",size:16}),title:n.jsxs("span",{className:"truncate",children:[a4[r.kind]," ",l?"to":"from"," ",r.otherTitle]}),hint:n.jsxs(n.Fragment,{children:["By ",n.jsx(cs,{id:r.actorId,you:!0})," · hop ",r.hops," · ",n.jsx(Vn,{value:r.createdAt})]}),trailing:d&&n.jsx(ge,{tone:d.tone,children:d.label})},r.id)})]})})})}function l4({session:e,user:i,manages:a,backupBlocked:r,onChange:l}){const u=je(),[d,h]=N.useState(null),p=e?.ownerId===i.id,m=$e(e&&p&&e.status!=="archived"?`/api/sessions/${oe(e.id)}/backups`:null),x=m.data?.enabled===!1,y=!m.data&&!m.error,v=m.data?.conversationOnlySupported===!1;async function b(){if(!e||!a||u.busy)return;const T=(e.visibility??"private")==="workspace"?"private":"workspace";await He(T==="workspace"?{title:"Make session workspace-visible?",message:"All workspace members will be able to view existing and future prompts and output, including tool output, repository content shown in the transcript, and side asks, which may contain sensitive information. This grants viewing only, not direct GitHub access, permission to run tools, or ask/control permissions.",confirmLabel:"Make workspace-visible"}:{title:"Make session private?",message:"Workspace membership will no longer grant viewing access, except to the workspace's owner and admins, who manage every session. Existing explicit grants will remain in effect, and previously viewed or copied content cannot be recalled.",confirmLabel:"Make private"})&&await u.run(async()=>{await ce(`/api/sessions/${oe(e.id)}`,{method:"PATCH",body:{visibility:T}}),l()},T==="workspace"?"Session is workspace-visible. Workspace members can view prompts and output.":"Session is private. Existing explicit grants still apply.")}async function w({conversationOnly:T=!1}={}){if(!e||!p||r||x||y||u.busy||T&&v)return;h(null);const M=`/api/sessions/${oe(e.id)}`;let _;try{const{workspaceDatabase:$}=await ce(`${M}/backups`);if($?.confirm){if(!await He({title:"Save to the workspace database?",message:`This backup is saved in ${Bl($)}, the database the workspace owner connected. Whoever can read it can read this session: its prompts, output${T?"":" and files"}, and your personal environment values.`,confirmLabel:"Save backup"}))return;_=$.id}}catch{}await u.run(async()=>{const $={..._?{trustedDatabaseId:_}:{},...T?{conversationOnly:!0}:{}},G=await ce(`${M}/backup`,{method:"POST",...Object.keys($).length?{body:$}:{}});h(G.backup),l()},T?"Conversation backup created":"Backup created")}async function S(T){const M=T.trim();if(!e||!a||u.busy||!M)return!1;if(M===e.title)return!0;let _=!1;return await u.run(async()=>{await ce(`/api/sessions/${oe(e.id)}`,{method:"PATCH",body:{title:M}}),_=!0,l()},"Session renamed"),_}async function C(){!e||!a||u.busy||e.status==="archived"||!await He({title:"Archive session?",message:"The session becomes read-only for everyone and is hidden from the sidebar. Its history stays viewable, and nothing is deleted. Pending approvals can't be decided while it's archived. You can unarchive it later.",confirmLabel:"Archive"})||await u.run(async()=>{await ce(`/api/sessions/${oe(e.id)}/archive`,{method:"POST"}),l()},"Session archived")}function k(){!e||!a||u.busy||e.status!=="archived"||u.run(async()=>{await ce(`/api/sessions/${oe(e.id)}/unarchive`,{method:"POST"}),l()},e.packed?"Session unarchived, its files unpacked":"Session unarchived")}async function O(){!e||!p||u.busy||e.status!=="archived"||e.packed||!await He({title:"Pack this session's files?",message:"Its files on the host become one compressed file, to save the host's disk. Package caches and temporary files in its home folder are left out, and so are the files its clones' .gitignore ignores, such as node_modules: install them again when you need them. Clones keep their branches and uncommitted changes, and are cloned again when the session is unarchived, which unpacks the rest. The conversation stays as it is.",confirmLabel:"Pack files"})||await u.run(async()=>{await ce(`/api/sessions/${oe(e.id)}/pack`,{method:"POST"}),l()},"Session files packed")}return{action:u,backup:d,backups:m,backupsOff:x,backupsPending:y,backupBlocked:r,changeVisibility:()=>{b()},createBackup:T=>{w(T)},conversationOnlyOff:v,rename:S,archive:()=>{C()},unarchive:k,pack:()=>{O()}}}const Bw={pending:"warning",approved:"info",executing:"running",executed:"success",denied:"neutral",interrupted:"warning",failed:"danger"};function c4({approval:e}){return n.jsxs(n.Fragment,{children:[e.automatic&&n.jsx(ge,{tone:"warning",children:"Auto-approved"}),n.jsx(ge,{tone:Bw[e.status],dot:e.status==="executing",children:e.status})]})}function tb({calls:e}){return!Array.isArray(e)||!e.length?null:n.jsxs("span",{className:"approval-marks",title:"Ran under the owner's auto-approve access, without a per-command decision",children:[n.jsx(ge,{tone:"warning",children:"Auto-approved"}),e.some(i=>i.unbounded)&&n.jsx(ge,{tone:"warning",children:"No resource limits"}),e.filter(i=>i.status!=="executed").map((i,a)=>n.jsx(ge,{tone:Bw[i.status]??"neutral",dot:i.status==="executing",children:e.length>1?`${i.tool}: ${i.status}`:i.status},a))]})}function u4(e,i){let a=e;if(typeof e=="string")try{a=JSON.parse(e)}catch{return e}return JSON.stringify(yh(a,i),null,2)??""}function d4(e){const{tab:i,setTab:a,onClose:r,view:l,audit:u}=e,d=sf(),h=l?.approvals??[],p=h.filter(m=>m.status==="pending").length;return n.jsxs("aside",{className:"session-panel","aria-label":"Session panel",children:[n.jsxs("div",{className:"session-panel-header",children:[n.jsx(hs,{size:"xs",label:"Panel",value:i,onChange:a,options:[{value:"details",label:"Details"},{value:"approvals",label:p?`Approvals ${p}`:"Approvals"},{value:"files",label:"Files"},{value:"schedules",label:"Schedules"},{value:"activity",label:"Activity"}]}),n.jsx("span",{className:"spacer"}),n.jsx(q,{variant:"ghost",size:"xs",icon:"x","aria-label":"Close panel",title:"Close panel",onClick:r})]}),n.jsxs("div",{className:"session-panel-body",children:[i==="details"&&n.jsx(v4,{...e},JSON.stringify([e.session.id,e.session.ownerId,e.user.id,e.session.permissions,e.workspaceRole])),i==="approvals"&&(h.length?n.jsxs("div",{className:"stack",children:[[...h].sort((m,x)=>+(x.status==="pending")-+(m.status==="pending")).map(m=>n.jsx(qw,{approval:m},m.id)),!!l?.olderApprovals&&n.jsx("p",{className:"muted small",children:h4(l.olderApprovals)})]}):l?n.jsx(xt,{title:"No approvals",children:Hw}):n.jsx($t,{})),i==="files"&&n.jsx(UO,{session:e.session}),i==="schedules"&&n.jsx(s4,{session:e.session,changed:()=>{u.refresh(),e.refresh()}},e.session.id),i==="activity"&&n.jsx(Ae,{title:"Audit log",action:n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh activity",title:"Refresh",disabled:u.loading,onClick:u.refresh}),bare:!0,children:n.jsx(tt,{...u,retry:u.refresh,children:u.data?.events.length?n.jsx("div",{className:"card",children:u.data.events.map(m=>n.jsx(ns,{title:m.action,hint:n.jsxs(n.Fragment,{children:[Mt(d.person(m.actorId))," · ",n.jsx(Vn,{value:m.createdAt})]}),children:n.jsx("pre",{children:u4(m.detail,d.person)})},m.id))}):n.jsx(xt,{title:"No activity"})})})]})]})}const Hw="Commands that ran under auto-approve are marked on their tool calls in the conversation.";function h4(e){return`${e} older settled ${e===1?"approval isn't":"approvals aren't"} listed. ${Hw}`}function qw({approval:e,children:i}){const{operation:a}=e,r=(u,d)=>n.jsxs(n.Fragment,{children:[" · Allowed by ",n.jsx(cs,{id:u})," ",d==="session"?"for the rest of the session":"for this call"]}),l=a.kind==="permission"&&e.status==="approved"&&e.decidedBy?r(e.decidedBy,e.scope):n.jsxs(n.Fragment,{children:[e.permission&&r(e.permission.decidedBy,e.permission.scope),e.decidedBy&&n.jsxs(n.Fragment,{children:[" · Decision by ",n.jsx(cs,{id:e.decidedBy})]})]});return n.jsxs("article",{className:"approval-card card",children:[n.jsxs("div",{className:"approval-head",children:[n.jsx("span",{className:"approval-kind",children:a.kind==="permission"?"Permission":a.kind==="extension.tool"?`Extension tool · ${a.tool}`:a.kind}),n.jsx("span",{className:"spacer"}),e.unbounded&&n.jsx(ge,{tone:"warning",children:"No resource limits"}),wh(a)&&n.jsx(ge,{tone:"warning",children:"Secret hidden"}),n.jsx(c4,{approval:e})]}),a.kind==="permission"?n.jsx(g4,{request:a,pending:e.status==="pending"}):n.jsxs(n.Fragment,{children:[a.kind==="host.bash"&&n.jsxs(we,{variant:"error",title:"Runs outside the sandbox",children:["This command runs as the host's OS user with access to their files, credentials and network, without CPU, memory or disk quotas. It runs in this session's files, which the agent can change, so builds, package scripts and Git hooks or settings there can run the agent's code on the host too. Only the host's owner, or a member granted host commands, can approve it. The time limit is ",a.timeoutSeconds," seconds."]}),a.kind==="git.repin"&&n.jsxs(we,{title:"Creates a new private session",children:["Resolves ",n.jsx("code",{children:a.repository})," at ",n.jsx("code",{children:a.ref}),". Other repository pins stay unchanged. This session's files, commits and conversation stay here; they are not copied. Only the session owner can approve."]}),a.kind==="extension.tool"&&n.jsx(we,{variant:"error",title:"Runs on the host, outside the sandbox",children:aO(a)}),a.kind==="git.push"&&n.jsx(x4,{operation:a}),a.kind==="github.merge"&&n.jsx(b4,{operation:a}),a.kind==="extension.tool"?n.jsx("pre",{children:rO(a)}):n.jsx("pre",{children:JSON.stringify(a,null,2)}),e.status==="pending"&&wh(a)&&n.jsx(Fw,{})]}),n.jsxs("p",{className:"muted small",children:["Requested by ",n.jsx(cs,{id:e.requestedBy})," · ",n.jsx(Qt,{value:e.createdAt}),e.automatic?n.jsxs(n.Fragment,{children:[" · ",oO(a)]}):l]}),e.result&&n.jsx("pre",{children:e.result}),a.kind==="git.repin"&&e.status==="executed"&&n.jsx(f4,{result:e.result}),i]})}function f4({result:e}){try{const i=JSON.parse(e??"null");return typeof i?.sessionId!="string"||!/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/.test(i.sessionId)?null:n.jsx(Ht,{variant:"outline",size:"sm",href:Xe({name:"session",sessionId:i.sessionId}),children:"Open repinned session"})}catch{return null}}const m4={tool:"A tool this agent doesn't include",write:"A change in a Read-only message","unbounded-shell":"No resource limits: this host has none set up for commands. The command still runs in the sandbox, offline and for at most the host's command time limit, but with no cap on CPU, memory, processes or disk.",audience:"Sharing another session: this session's readers would see what the agent reads from a session they can't open themselves."},p4=["bash","git_commit","git_push","github_comment","github_merge","github_issue","host_bash","git_repin"];function g4({request:e,pending:i}){return n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[n.jsx("code",{children:e.tool})," ",i?"needs the session owner's permission for:":"asked the session owner's permission for:"]}),n.jsx("ul",{className:"permission-needs small",children:e.needs.map(a=>n.jsx("li",{children:m4[a]},a))}),e.target&&n.jsx("pre",{children:e.target}),i&&wh(e.target)&&n.jsx(Fw,{}),i&&p4.includes(e.tool)&&n.jsx("p",{className:"muted small",children:"Allowing it doesn't run anything yet: the operation still gets its own approval, unless the message auto-approves."})]})}function Fw(){return n.jsxs("p",{className:"small",children:["Something that looks like a secret is shown as ",n.jsx("code",{children:kt}),". Allowing or approving this uses the real value, so make sure it belongs here."]})}function x4({operation:e}){return n.jsxs("dl",{className:"small",children:[n.jsx("dt",{className:"muted",children:"Repository"}),n.jsx("dd",{children:n.jsx("code",{children:e.repository})}),e.directory&&n.jsxs(n.Fragment,{children:[n.jsx("dt",{className:"muted",children:"Clone"}),n.jsx("dd",{children:n.jsxs("code",{children:[e.directory,"/"]})})]}),e.tag!==void 0?n.jsxs(n.Fragment,{children:[n.jsx("dt",{className:"muted",children:"New tag"}),n.jsx("dd",{children:n.jsx("code",{children:e.tag})}),n.jsx("dt",{className:"muted",children:"On branch"}),n.jsxs("dd",{children:[n.jsx("code",{children:e.branch})," (not moved)"]})]}):n.jsxs(n.Fragment,{children:[n.jsx("dt",{className:"muted",children:"Branch"}),n.jsx("dd",{children:n.jsx("code",{children:e.branch})})]}),n.jsx("dt",{className:"muted",children:"Commit"}),n.jsx("dd",{children:n.jsx("code",{title:e.commit,children:e.commit.slice(0,12)})}),e.pullRequest&&n.jsxs(n.Fragment,{children:[n.jsx("dt",{className:"muted",children:"Pull request"}),n.jsxs("dd",{children:[e.pullRequest.title,e.pullRequest.base?n.jsxs(n.Fragment,{children:[" → ",n.jsx("code",{children:e.pullRequest.base})]}):" → default branch"]})]})]})}const y4={merge:"Merge commit",squash:"Squash and merge",rebase:"Rebase and merge"};function b4({operation:e}){return n.jsxs("dl",{className:"small",children:[n.jsx("dt",{className:"muted",children:"Pull request"}),n.jsx("dd",{children:n.jsx("a",{href:`https://github.com/${e.repository}/pull/${e.pull}`,target:"_blank",rel:"noreferrer",children:n.jsxs("code",{children:[e.repository,"#",e.pull]})})}),n.jsx("dt",{className:"muted",children:"Head commit"}),n.jsx("dd",{children:n.jsx("code",{title:e.sha,children:e.sha.slice(0,12)})}),n.jsx("dt",{className:"muted",children:"Method"}),n.jsx("dd",{children:y4[e.method]})]})}function v4({session:e,view:i,user:a,workspaceRole:r,hosts:l,refresh:u,audit:d,actions:h,openSession:p}){const m=e.permissions??[],x=e.ownerId===a.id,y=m.includes("write"),v=Qh(a.id,e.ownerId,r),b=()=>{d.refresh(),u()};return n.jsxs("div",{children:[n.jsx(j4,{session:e,user:a,hosts:l}),i?.extensions&&n.jsx(k4,{extensions:i.extensions}),n.jsx(S4,{session:e,refresh:u}),n.jsx(N4,{session:e,user:a,workspaceRole:r,actions:h,changed:b}),n.jsx(w4,{session:e,manages:v,changed:b}),n.jsx(o4,{session:e}),x&&e.status!=="archived"&&n.jsx(T4,{session:e,actions:h,openSession:p}),x&&e.status!=="archived"&&!e.frozen&&e.connectorId&&n.jsx(SO,{session:e,user:a,hosts:l,openSession:p,changed:b}),y&&e.status!=="archived"&&!e.frozen&&n.jsx(z4,{session:e,changed:b}),x&&n.jsx(E4,{session:e}),n.jsx(O4,{session:e,view:i,user:a})]})}function w4({session:e,manages:i,changed:a}){const r=je(),l=$e(`/api/workspaces/${oe(e.workspaceId)}/transcripts`),u=e.toolOutput!=="brief",d=i&&e.status!=="archived";function h(m){!d||r.busy||m===u||r.run(async()=>{await ce(`/api/sessions/${oe(e.id)}`,{method:"PATCH",body:{toolOutput:m?"full":"brief"}}),a()},m?"Full tool output is on for everyone viewing this session.":"Tool output is brief for everyone viewing this session: one line per tool result.")}const p=l.data?.settings.paging;return n.jsxs(Ae,{title:"Transcript",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"With full tool output on, the transcript shows everything each tool printed. Turned off, each tool result shows only its first line and long tool calls are cut short, for everyone viewing the session, its share link included. Long sessions then load much faster. The host keeps the whole output either way, and the agent still sees all of it. Only the session's owner, or the workspace's owner or an admin, can change this; new sessions start with their workspace's choice, under Settings → Workspaces."}),n.jsx("p",{children:"Whether the transcript loads latest messages first is a workspace setting, under Settings → Workspaces."})]}),children:[n.jsx(W,{title:"Full tool output",hint:u?"Every tool result in full":"One line per tool result",trailing:d?n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Full tool output",checked:u,disabled:r.busy,onChange:m=>h(m.target.checked)}):n.jsx(ge,{tone:"neutral",children:u?"On":"Off"})}),n.jsx(W,{title:"Loading",hint:p===void 0?l.error?"Couldn't check the workspace setting":n.jsx($t,{children:"Checking"}):p?"Latest messages first; earlier ones load as you scroll up":"The whole transcript at once"}),(r.error||r.notice)&&n.jsx(ke,{children:n.jsx(ye,{...r})})]})}function j4({session:e,user:i,hosts:a}){const r=a.data?.connectors.find(l=>l.id===e.connectorId);return n.jsxs(Ae,{title:"Host",info:n.jsxs("p",{children:["Work runs as the session owner (",n.jsx(cs,{id:e.ownerId,you:!0}),"), not the host owner. The host operator can access prompts and files processed on it. Sharing a host doesn't change who can view or control this session, and doesn't expose its owner's local history."]}),children:[e.connectorId?n.jsxs(n.Fragment,{children:[n.jsx(W,{leading:n.jsx(be,{name:"server",size:16}),title:r?.name??"Pinned host",hint:n.jsxs(n.Fragment,{children:["Hosted by ",r?.ownerName??(e.connectorOwnerId?n.jsx(cs,{id:e.connectorOwnerId}):"unknown"),e.connectorOwnerId===i.id?" (you)":""]}),trailing:a.loading?n.jsx($t,{children:"Checking"}):r?n.jsx(co,{connector:r}):e.hostUnsandboxed&&n.jsx(ge,{tone:"danger",children:"Unsandboxed"})}),e.hostEnvironment&&n.jsx(W,{leading:n.jsx(be,{name:"server",size:16}),title:"Runs on the host",hint:"No sandbox: its commands run on the host owner's machine, as its user",trailing:n.jsx(ge,{tone:"danger",children:"On host"})}),r&&n.jsx(cc,{connector:r}),!a.loading&&!r&&!a.error&&n.jsx(W,{title:"Host not in your list",hint:"It may be private to its owner, unshared, or revoked. Viewing a session doesn't let you use its host"}),n.jsx(W,{title:"Connection ID",hint:n.jsx("code",{children:e.connectorId})})]}):n.jsx(W,{leading:n.jsx(be,{name:"server",size:16}),title:"Operator-managed session",hint:"No local host is pinned"}),a.error&&n.jsx(ke,{children:n.jsx(ye,{error:a.error})})]})}function k4({extensions:e}){return n.jsxs(Ae,{title:"Extensions",info:n.jsx("p",{children:"Pi extensions the workspace chose, as this session's host has them installed. They run on the host, outside the sandbox; their tool calls are approved like host commands unless the workspace and the host's owner let them run automatically. Dev extensions are the host owner's own, in their own sessions. Built-in ones come with Pikibun, as the host's configuration turns them on. The host's owner can also require extensions of every session on their host, whatever the workspace chose."}),children:[e.running.map(i=>n.jsx(W,{leading:n.jsx(be,{name:"tool",size:16}),title:n.jsx("code",{children:i.source}),hint:i.tools.length?`Tools: ${i.tools.join(", ")}`:"No tools: prompt or hooks only",trailing:i.dev?n.jsx(ge,{tone:"warning",children:"Dev"}):i.required?n.jsx(ge,{tone:"success",children:"Required by the host"}):n.jsx(ge,{tone:"success",children:"Running"})},i.source)),(e.missingRequired??[]).map(i=>n.jsx(W,{leading:n.jsx(be,{name:"alert",size:16}),title:n.jsx("code",{children:i}),hint:"The host's owner requires it of every session on the host, which can't run it now: no message is sent until it can",trailing:n.jsx(ge,{tone:"danger",children:"Missing"})},`required ${i}`)),e.missing.map(i=>n.jsx(W,{title:n.jsx("code",{children:i}),hint:"Not on this host at this version: the session runs without it until the host's owner installs it",trailing:n.jsx(ge,{tone:"neutral",children:"Missing"})},i)),(e.builtin??[]).map(i=>{const a=to.find(r=>r.name===i);return n.jsx(W,{leading:n.jsx(be,{name:"tool",size:16}),title:a?n.jsxs(n.Fragment,{children:[a.title," ",n.jsx("code",{children:i})]}):n.jsx("code",{children:i}),hint:a?`Built in, as the host's configuration turns it on. Tools: ${a.tools.join(", ")}`:"Built in, as the host's configuration turns it on",trailing:n.jsx(ge,{tone:"success",children:"Running"})},`builtin ${i}`)})]})}function S4({session:e,refresh:i}){const a=e.repositories??[];return e.repositoryMode==="clone"?n.jsx(Ae,{title:"Repositories",info:n.jsx(af,{}),bare:!0,children:n.jsxs("div",{className:"card",children:[n.jsx(W,{leading:n.jsx(be,{name:"git-branch",size:16}),title:"Cloned on demand",hint:"Nothing is pinned: the agent clones and switches branches as it works"}),n.jsx(W,{title:"Manage repositories and network access",href:Xe({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})}):n.jsx(Ae,{title:n.jsxs(n.Fragment,{children:["Repositories ",n.jsx("span",{className:"muted",children:a.length})]}),info:n.jsx("p",{children:"This session was created before sessions cloned their repositories: it holds snapshots of these commits, pinned when it started, and is read-only."}),action:n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh",onClick:i}),bare:!0,children:n.jsxs("div",{className:"stack",children:[e.status==="error"&&n.jsx(we,{variant:"error",title:"Snapshots not confirmed",children:"This session is in an error state, so repository snapshots are not confirmed. Check the host, then refresh."}),e.status==="archived"&&n.jsx(we,{title:"Archived",children:"Pinned files may no longer be on the host."}),n.jsxs("div",{className:"card",children:[a.length?a.map(r=>n.jsx(W,{leading:n.jsx(be,{name:"git-branch",size:16}),title:r.fullName,hint:n.jsxs(n.Fragment,{children:[n.jsxs("span",{title:r.commit,children:[r.ref,"@",r.commit.slice(0,7)]})," · ",n.jsxs("code",{children:[r.path,"/"]})]})},r.bindingId)):n.jsx(W,{title:"No repository pins",hint:e.status==="provisioning"?"None recorded yet. Refresh to check progress":e.status==="error"?"None are available for this session":"This older session has no pinned repositories"}),n.jsx(W,{title:"Manage repositories for future sessions",href:Xe({name:"settings",section:"workspaces",id:e.workspaceId}),chevron:!0})]})]})})}const Fl={viewer:"Viewer",member:"Member",collaborator:"Collaborator",admin:"Admin"},C4={viewer:"Follows the session: prompts, output and side asks",member:"Viewer, and asks side questions without messaging the agent",collaborator:"Member, and sends messages to the agent and stops its work",admin:"Collaborator, and decides approvals and manages who has access"},oh={owner:"workspace owner",admin:"workspace admin",collaborator:"workspace collaborator",member:"workspace member",viewer:"workspace viewer"};function Bh(e){return e.sessionRole===void 0?Lb(e.permissions):e.sessionRole}function A4(e){const i=Bh(e);return i?Fl[i]:`Custom (${e.permissions.join(", ")||"none"})`}function N4({session:e,user:i,workspaceRole:a,actions:r,changed:l}){const u=je(),d=sf(),h=e.permissions??[],p=e.ownerId===i.id,m=Qh(i.id,e.ownerId,a),x=!p&&a&&Zl.includes(a)?a:null,y=e.visibility??"private",v=!p&&!h.some(X=>X!=="read"),b=Lb(h),w=h.includes("manage"),S=e.status==="archived",C=`/api/sessions/${oe(e.id)}`,k=$e(w&&!S?`${C}/grants`:null),[O,T]=N.useState(""),[M,_]=N.useState(null),$=xh(O,d.list);async function G(X){u.busy||await u.run(async()=>{await ce(`${C}/auto-approved-requesters/${oe(X)}`,{method:"DELETE"}),l()},`${Mt(d.person(X))}'s requests ask again.`)}const J=Mt(d.person($)),U=$===e.ownerId,E=k.data?.grants.find(X=>X.userId===$),I=E?Bh(E):null,Q=E?.workspaceRole??d.person($).role;function ie(X){return l1(X,h)?o1(X,Q)?null:"workspace viewers can only be session viewers":"needs permissions you don't hold"}const re=Q&&!U?s1(Q,y):[],Y=Q!==void 0&&Zl.includes(Q),F=w&&!U&&!!$&&M!==null&&!ie(M)&&M!==I;function B(){return[J!==$&&O.trim()!==J?J:null,Q?oh[Q]:null].filter(Boolean).join(" · ")||void 0}function se(X){T(X);const Se=xh(X,d.list),ve=k.data?.grants.find(Te=>Te.userId===Se);_(ve?Bh(ve):null)}function de(X){X.preventDefault(),!(!F||!M||u.busy)&&u.run(async()=>{await ce(`${C}/grants`,{method:"POST",body:{userId:$,role:M}}),k.refresh(),l()},`${J} is now a session ${Fl[M].toLowerCase()}`)}async function R(){!w||U||!E||u.busy||!await He({title:"Remove session access?",message:Y?`Remove ${J}'s session role? As a ${oh[Q]}, they still manage this session, as they do every session in the workspace.`:y==="workspace"?`Remove ${J}'s session role? They keep what their workspace role gives them while this session is workspace-visible. Making it private removes that.`:`Remove ${J}'s session role? They will no longer be able to open this private session.`,confirmLabel:"Remove access",destructive:!0})||await u.run(async()=>{await ce(`${C}/grants/${oe($)}`,{method:"DELETE"}),se(""),k.refresh(),l()},Y?"Session role removed. As a workspace owner or admin, they still manage this session.":y==="workspace"?"Session role removed. Workspace members can still view this session until it is made private.":"Session role removed")}const D=bO({session:e,user:i,manages:m,action:r.action,onChange:l}),ee=D.link,z=p&&ee!==void 0?ee!==null:!!e.linkShared;return n.jsxs(Ae,{title:"People",info:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"The server checks every request. You give a workspace member one of four session roles: a viewer follows the session; a member also asks side questions; a collaborator also sends messages to the agent; an admin also decides approvals and manages who has access. You can only give a role whose permissions you hold, and workspace viewers can only be session viewers. On a workspace-visible session, people also keep what their workspace role gives them there. Visibility doesn't grant GitHub or tool access, share a host, or publish an agent. The owner's access can't be changed."}),n.jsx("p",{children:"The workspace's owner and admins manage every session in it, private ones included: they follow it, message it, rename and archive it, change its visibility and give session roles up to collaborator. Deciding its approvals takes a session role from its owner, since approved operations run as the owner."}),n.jsx("p",{children:"The owner can also share a link: anyone who has it can view the shared conversation without signing in, but not side asks, approvals, who sent each message, or the host. It never grants anything else. The workspace's owner and admins can turn it off."})]}),children:[n.jsx(W,{leading:n.jsx(be,{name:"user",size:16}),title:p?"Owner":x?`Workspace ${x}`:b?`Session ${Fl[b].toLowerCase()}`:"Custom access",hint:n.jsxs(n.Fragment,{children:["Your permissions: ",h.join(", ")||"none",v?". You can follow committed work but can't ask, submit, approve, manage grants, change visibility, or use backups":x&&!h.includes("approve")?`. As the workspace's ${x}, you manage every session in it; deciding approvals takes a session role from the owner`:""]})}),n.jsx(W,{leading:n.jsx(be,{name:y==="workspace"?"globe":"lock",size:16}),title:y==="workspace"?"Workspace-visible":"Private",hint:n.jsxs(n.Fragment,{children:[y==="workspace"?"All workspace members can view existing and future prompts and output, including tool output, repository content in the transcript, and side asks":"Only the owner, the workspace's owner and admins, and people with a session role can view prompts and output",". ",m?y==="workspace"?"Making it private keeps explicit grants and can't recall content already viewed or copied":"Before sharing, check existing prompts, tool output and side asks for secrets":"Only the session owner, or the workspace's owner or an admin, can change visibility"]}),trailing:m&&!S&&n.jsx(q,{variant:"outline",size:"sm",disabled:r.action.busy,onClick:r.changeVisibility,children:y==="workspace"?"Make private":"Make workspace-visible"})}),(p||z)&&n.jsx(W,{leading:n.jsx(be,{name:"link",size:16}),title:z?"Anyone with the link can view":"Link sharing off",hint:p?z?"Without signing in, they can follow the shared conversation, but not side asks, approvals, who sent each message, or the host. Turning the link off stops it at once":S?"Archived sessions can't get a new share link":"Create a link that lets anyone who has it view the shared conversation, read-only, without signing in":`The owner shared this session by link: anyone who has it can view the shared conversation without signing in, including messages you send to it. Side asks stay hidden${m?". You can turn the link off, which stops it at once":""}`,trailing:p?z?n.jsx(q,{variant:"outline",size:"sm",disabled:r.action.busy,onClick:D.unshareLink,children:"Turn off"}):!S&&n.jsx(q,{variant:"outline",size:"sm",disabled:r.action.busy||D.linkLoading,onClick:()=>{D.shareLink()},children:"Create link"}):m&&z&&n.jsx(q,{variant:"outline",size:"sm",disabled:r.action.busy,onClick:D.unshareLink,children:"Turn off"})}),p&&ee&&n.jsx(ke,{children:n.jsx(xe,{label:"Share link",hint:n.jsxs(n.Fragment,{children:["Created ",n.jsx(Vn,{value:ee.createdAt})]}),children:n.jsx(Yn,{value:ee.url,label:"Copy share link"})})}),p&&D.linkError&&n.jsx(ke,{children:n.jsx(ye,{error:D.linkError})}),(e.autoApprovedRequesters??[]).map(X=>n.jsx(W,{leading:n.jsx(be,{name:"check",size:16}),title:n.jsxs(n.Fragment,{children:["Always approves ",n.jsx(cs,{id:X,you:!0})]}),hint:e.requesterAutoApprove?`Their commands, pushes, and GitHub comments and issues here run without asking, as the owner. Merges, host commands and new permissions still ask${p?"":". Only the owner can stop it"}`:"Paused: the workspace no longer lets owners auto-approve other members' requests, so they ask again. It applies again if that's turned back on",trailing:p&&n.jsx(q,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>{G(X)},children:"Stop"})},X)),w&&!S?n.jsx(ns,{title:"Session roles",hint:k.data?`${k.data.grants.length} ${k.data.grants.length===1?"person":"people"} with access`:void 0,leading:n.jsx(be,{name:"users",size:16}),trailing:n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh session roles",title:"Refresh session roles",disabled:k.loading,onClick:X=>{X.preventDefault(),k.refresh()}}),children:n.jsx(tt,{...k,retry:k.refresh,children:k.data&&n.jsx("form",{onSubmit:de,children:n.jsxs("fieldset",{disabled:u.busy,className:"stack",children:[n.jsx(xe,{label:"People with access",hint:k.data.grants.length>1?void 0:"Nobody else has a session role yet",children:n.jsxs("select",{className:"select",value:E?$:"",onChange:X=>se(X.target.value&&Mt(d.person(X.target.value))),children:[n.jsx("option",{value:"",children:"Add someone"}),k.data.grants.map(X=>n.jsxs("option",{value:X.userId,children:[Mt(d.person(X.userId)),": ",X.userId===e.ownerId?"Owner (immutable)":A4(X)]},X.userId))]})}),n.jsx(xe,{label:"Workspace member",hint:U?"The owner's access is immutable":$?B():void 0,children:n.jsx("input",{className:"input",required:!0,autoComplete:"off",spellCheck:!1,placeholder:"Username or user ID",value:O,onChange:X=>se(X.target.value)})}),n.jsxs("fieldset",{disabled:U,className:"stack session-permissions",children:[n.jsx("legend",{className:"small muted",children:"Session role"}),Mb.map(X=>{const Se=ie(X);return n.jsxs("label",{className:"check-row",children:[n.jsx("input",{className:"radio",type:"radio",name:"session-role",value:X,checked:M===X,disabled:!!Se,onChange:()=>_(X)}),n.jsxs("span",{children:[Fl[X],I===X&&n.jsx("span",{className:"muted",children:" (current)"}),Se&&n.jsxs("span",{className:"muted",children:[" (",Se,")"]}),n.jsxs("span",{className:"muted small session-role-hint",children:[C4[X]," · ",oc[X].join(", ")]})]})]},X)})]}),E&&!U&&!I&&n.jsxs("p",{className:"muted small",children:[J," has a custom grant (",E.permissions.join(", "),") from before session roles. Choose a role to replace it."]}),re.length>1&&Q&&n.jsxs("p",{className:"muted small",children:["As a ",oh[Q],", ",J," already has ",re.join(", ")," on this ",Y?"session, as on every session in the workspace":"workspace-visible session","; a session role adds to that."]}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{type:"submit",variant:"secondary",size:"sm",disabled:!F,children:u.busy?"Saving...":E?"Change role":"Give role"}),E&&!U&&n.jsx(q,{variant:"outline",size:"sm",onClick:()=>{R()},children:"Remove access"})]}),y==="workspace"&&n.jsx("p",{className:"muted small",children:"Removing someone's session role doesn't stop workspace members from viewing; make the session private for that. The workspace's owner and admins keep managing it either way."})]})})})}):n.jsx(W,{leading:n.jsx(be,{name:"users",size:16}),title:"Session roles",hint:w?"Unarchive the session to manage session roles":"Managing session roles takes the session admin role"}),(u.error||u.notice)&&n.jsx(ke,{children:n.jsx(ye,{...u})})]})}function T4({session:e,actions:i,openSession:a}){const[r,l]=N.useState(0),{backup:u}=i;return n.jsxs(Ae,{title:"Backups",info:n.jsxs(n.Fragment,{children:[n.jsx("p",{children:"Only the session owner can create, download or restore backups. Backups need the session to be idle."}),n.jsxs("p",{children:["A backup keeps the conversation, the session's files and each clone's local work. ",n.jsx("strong",{children:"Conversation only"})," keeps just the conversation: it's much smaller, and a session restored from it starts with an empty worktree, so the agent clones its repositories again."]}),n.jsx("p",{children:"Restore creates a new private session and never overwrites this one. It doesn't replay approvals or run operations, and needs the original host to be available. Listing and downloading work while offline."}),n.jsx("p",{children:"Backups are saved in the database the workspace owner connected, if there is one, and otherwise in the server's backup storage. A server without backup storage keeps no backups."})]}),action:n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"ghost",size:"xs",icon:"refresh","aria-label":"Refresh backups",title:"Refresh backups",onClick:()=>l(d=>d+1)}),n.jsx(q,{variant:"ghost",size:"sm",disabled:i.backupsOff||i.backupsPending||i.backupBlocked||i.conversationOnlyOff||i.action.busy,title:i.backupsOff?"Backups are off":i.conversationOnlyOff?"Update this session's host connector to back up its conversation only":"Back up the conversation without the session's files",onClick:()=>i.createBackup({conversationOnly:!0}),children:"Conversation only"}),n.jsx(q,{variant:"outline",size:"sm",disabled:i.backupsOff||i.backupsPending||i.backupBlocked||i.action.busy,title:i.backupsOff?"Backups are off":void 0,onClick:()=>i.createBackup(),children:i.action.busy?"Working...":"Create backup"})]}),children:[i.backupBlocked&&!i.backupsOff&&n.jsx(W,{title:"Backup unavailable right now",hint:"Unavailable while work is queued or running, or the live state can't be confirmed"}),u&&n.jsx(W,{leading:n.jsx(be,{name:"check",size:16}),title:n.jsxs(n.Fragment,{children:["Backup created ",n.jsx(Qt,{value:u.createdAt})]}),hint:n.jsxs(n.Fragment,{children:[u.size," bytes",Ew(u)," · ID ",n.jsx("code",{children:u.id})," · SHA-256 ",n.jsx("code",{children:u.sha256})]}),trailing:n.jsx(Ht,{variant:"outline",size:"sm",href:zw(e.id,u.id),children:"Download"})}),n.jsx(kO,{sourceId:e.id,ownerId:e.ownerId,backups:i.backups,latestBackup:u,refreshKey:r,openSession:a})]})}function E4({session:e}){return n.jsx(Ae,{title:"Export",info:n.jsx("p",{children:"Downloads this session's details, people, approvals, pushes, backup list and activity as JSON, without secrets. The conversation itself is in the session's backups. Only the session owner can export it."}),children:n.jsx(W,{leading:n.jsx(be,{name:"archive",size:16}),title:"Session data",hint:"JSON, without secrets",trailing:n.jsx(Ht,{variant:"outline",size:"sm",href:`/api/sessions/${oe(e.id)}/export`,download:!0,children:"Export"})})})}function z4({session:e,changed:i}){const a=je(),[r,l]=N.useState(null),[u,d]=N.useState("bash"),[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(""),[b,w]=N.useState(""),S=Number(y),C=u==="bash"?!!h.trim():/^[^/\s]+\/[^/\s]+$/.test(m.trim())&&Number.isSafeInteger(S)&&S>0&&!!b.trim();function k(O){if(O.preventDefault(),!C||a.busy)return;const T=u==="bash"?{kind:u,command:h}:{kind:u,repository:m.trim(),issue:S,body:b};l(null),a.run(async()=>{const M=await ce(`/api/sessions/${oe(e.id)}/operations`,{method:"POST",body:T});l({id:M.approval.id,status:M.approval.status}),i()},"Operation requested. Review its approval in the session.")}return n.jsx(Ae,{title:"Operation request",info:n.jsx("p",{children:"This only requests the operation; it runs after approval in the session. Don't include passwords, tokens or other secrets."}),children:n.jsx(ke,{children:n.jsx("form",{onSubmit:k,children:n.jsxs("fieldset",{disabled:a.busy,className:"stack",children:[n.jsx(xe,{label:"Operation",children:n.jsxs("select",{className:"select",value:u,onChange:O=>d(O.target.value),children:[n.jsx("option",{value:"bash",children:"Bash command"}),n.jsx("option",{value:"github.comment",children:"GitHub comment"})]})}),u==="bash"&&n.jsx(xe,{label:"Command",children:n.jsx("textarea",{className:"textarea mono",required:!0,autoComplete:"off",value:h,onChange:O=>p(O.target.value)})}),u==="github.comment"&&n.jsxs(n.Fragment,{children:[n.jsx(xe,{label:"Repository",hint:"owner/name",children:n.jsx("input",{className:"input",required:!0,autoComplete:"off",value:m,onChange:O=>x(O.target.value)})}),n.jsx(xe,{label:"Issue number",children:n.jsx("input",{className:"input",required:!0,type:"number",min:"1",step:"1",value:y,onChange:O=>v(O.target.value)})}),n.jsx(xe,{label:"Comment",children:n.jsx("textarea",{className:"textarea",required:!0,autoComplete:"off",value:b,onChange:O=>w(O.target.value)})})]}),n.jsx("div",{className:"inline",children:n.jsx(q,{type:"submit",variant:"secondary",size:"sm",disabled:!C,children:a.busy?"Requesting...":"Request approval"})}),r&&n.jsxs("p",{className:"muted small",role:"status",children:["Approval ",n.jsx("code",{children:r.id}),": ",r.status]})]})})})})}function O4({session:e,view:i,user:a}){const r=e.visibility??"private";return n.jsxs(Ae,{title:"Access",info:n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[r==="workspace"?"Workspace-visible: all workspace members can view existing and future prompts and output, including tool output, repository content in the transcript, and side asks.":"Private: only the owner, the workspace's owner and admins, and members with a session role can view prompts and output.",e.linkShared?" Anyone with the session's share link can also view the shared conversation, without signing in.":""," Viewing doesn't grant ask, write, approve or manage permissions, access to Git accounts, or tool use. Only the owner, or the workspace's owner or an admin, can change visibility; it's separate from host sharing and agent publishing."]}),n.jsxs("p",{children:["Values that look like passwords, tokens or keys are shown as ",kt," to everyone, in the transcript, approvals and share links. The agent and the host still see the real values."]})]}),children:[i?n.jsxs(n.Fragment,{children:[n.jsx(W,{leading:n.jsx(be,{name:"user",size:16}),title:n.jsxs(n.Fragment,{children:["Runs as ",i.owner.displayName,i.owner.id===a.id?" (you)":""]}),hint:i.owner.githubLogin?`GitHub @${i.owner.githubLogin}`:"No GitHub login connected"}),n.jsx(W,{leading:n.jsx(be,{name:"git-branch",size:16}),title:"Commits as",hint:n.jsxs(n.Fragment,{children:[i.owner.gitName," <",i.owner.gitEmail,">"]})})]}):n.jsx(W,{title:n.jsx($t,{children:"Loading identity..."})}),n.jsx(ke,{children:n.jsx(xe,{label:"Session ID",children:n.jsx(Yn,{value:e.id,label:"Copy session ID"})})})]})}const Gw="Context compaction failed",R4={token_limit:"Pi's summary of the conversation hit its token limit, so the context could not be compacted.",tool_call:"Pi's summarizer tried to call a tool instead of writing a summary, so the context could not be compacted.",no_text:"Pi's summarizer wrote no summary, so the context could not be compacted.",aborted:"Compacting the conversation's context was aborted."};function Pw(e,i={}){const a=R4[e]??"The conversation's context could not be compacted.";return i.advice===!1?a:e==="aborted"?`${a} Send the message again to retry.`:`${a} Retrying at the same reasoning level will fail the same way: send the next message with a lower reasoning level, or continue in a new session. The host's owner or an admin can also raise this model's reserve tokens under Settings → Hosts → the host → Compaction (Pi's compaction.reserveTokens).`}function M4(e){const[i,a]=N.useState(null),[r,l]=N.useState(null),[u,d]=N.useState(""),[h,p]=N.useState("connecting"),[m,x]=N.useState(0),y=N.useRef(()=>{}),v=N.useRef(async()=>{}),b=N.useCallback(()=>y.current(),[]),w=N.useCallback(C=>v.current(C),[]),S=N.useCallback(()=>x(C=>C+1),[]);return N.useEffect(()=>{p("connecting");const C=cC(e,{session:a,view:l,error:d,status:p});return y.current=C.refresh,v.current=C.loadOlder,()=>{C.stop(),y.current=()=>{},v.current=async()=>{}}},[e,m]),{session:i,view:r,error:u,status:h,refresh:b,loadOlder:w,reconnect:S}}const nb="pikibun.sessionPanel",sb="(min-width: 1100px)";function D4(){const[e,i]=N.useState(()=>{if(!window.matchMedia(sb).matches)return!1;try{const r=localStorage.getItem(nb);if(r)return r==="open"}catch{}return!0}),a=N.useCallback(r=>{if(i(r),!!window.matchMedia(sb).matches)try{localStorage.setItem(nb,r?"open":"closed")}catch{}},[]);return[e,a]}function L4({provider:e,modelId:i,status:a}){const r=e??"the provider";return a===401||a===403?`The host's Pi credentials for ${r} were rejected. The host owner should check Pi's login or API key, then restart the connector.`:a===429?`Rate limited by ${r}. Try again shortly.`:a!==void 0&&a>=500&&a<600?`${r} is unavailable. Try again shortly.`:`The request to ${[e,i].filter(Boolean).join("/")||"the model"} failed${a?` (HTTP ${a})`:""}`}function ib({role:e,icon:i,label:a,text:r,badges:l,trimmed:u}){return n.jsxs("details",{className:"entry-tool","data-role":e,children:[n.jsxs("summary",{children:[n.jsx(be,{name:i,size:14}),n.jsx("span",{className:"truncate",children:a}),l,n.jsx(be,{name:"chevron-right",size:14})]}),n.jsx("pre",{children:r}),u&&n.jsx(_4,{trimmed:u})]})}function _4({trimmed:e}){return n.jsxs("p",{className:"muted small entry-brief",children:["Brief tool output · ",e.lines===1?"1 line":`${e.lines.toLocaleString()} lines`,", ",e.chars.toLocaleString()," characters in full. The session's owner can show full tool output under Details."]})}function $4(e){return e.trimmed&&e.role==="toolResult"&&e.text.trim()?n.jsxs("span",{className:"muted",children:[" · ",e.text]}):null}function ab({entry:e,actions:i}){const[a,r]=N.useState(!1);N.useEffect(()=>{if(!a)return;const m=window.setTimeout(()=>r(!1),1500);return()=>window.clearTimeout(m)},[a]);const l=JS(e),u=i&&QS(e),d=u&&i?.revert,h=u&&i?.fork;if(!l&&!d&&!h)return null;const p=u?.before?"Go back to before this message":"Go back to this reply";return n.jsxs("span",{className:"entry-actions",role:"toolbar","aria-label":"Message actions",children:[l&&n.jsx(q,{variant:"ghost",size:"xs",icon:a?"check":"copy","aria-label":a?"Copied":"Copy message",title:a?"Copied":"Copy message",onClick:()=>{navigator.clipboard.writeText(l).then(()=>r(!0))}}),d&&n.jsx(q,{variant:"ghost",size:"xs",icon:"history","aria-label":p,title:d.disabled||p,disabled:!!d.disabled,onClick:()=>d.run(e,u)}),h&&n.jsx(q,{variant:"ghost",size:"xs",icon:"git-branch","aria-label":"Fork a new session from here",title:h.disabled||"Fork a new session from here",disabled:!!h.disabled,onClick:()=>h.run(e,u)})]})}function U4({entry:e,userId:i,actions:a}){const r=e.actorId&&n.jsx(cs,{id:e.actorId,you:!0}),{prose:l,calls:u}=e.role==="assistant"?fc(e.text):{prose:e.text,calls:[]},d=u.length>0&&`Tool · ${u[0].name}`;if(e.kind==="workspace.run-stopped")return n.jsx("div",{className:"entry-stopped",role:"note",children:n.jsxs("span",{children:["Stopped",r&&n.jsxs(n.Fragment,{children:[" by ",r]})]})});if(e.kind==="workspace.run-crashed")return n.jsx("div",{className:"entry-stopped",role:"note",children:n.jsx("span",{children:e.text})});if(e.kind==="workspace.run-refused")return n.jsx("div",{className:"entry-stopped",role:"note",children:n.jsxs("span",{children:[e.text,r&&n.jsxs(n.Fragment,{children:[" · ",r]})]})});if(d&&!l.trim()||e.role==="system"||e.role==="toolResult"){const p=d||(e.role==="toolResult"?"Tool result":"System"),m=e.role==="toolResult"&&e.durationMs!==void 0&&n.jsxs(n.Fragment,{children:[" · ",n.jsx("span",{title:"How long the tool ran",children:Vl(e.durationMs)})]});return n.jsx(ib,{role:e.role,icon:d?"tool":"terminal",label:n.jsxs(n.Fragment,{children:[p,m,r&&n.jsxs(n.Fragment,{children:[" · ",r]}),$4(e)]}),text:e.text,badges:n.jsx(tb,{calls:e.autoApproved}),trimmed:e.trimmed})}if(e.error)return n.jsxs("div",{className:"entry-error",title:e.kind,children:[e.error.compaction?n.jsx(we,{variant:"error",title:Gw,children:Pw(e.error.compaction)}):n.jsx(we,{variant:"error",title:"Model request failed",children:L4(e.error)}),r&&n.jsxs("div",{className:"entry-actor",children:["by ",r]})]});if(e.role==="user")return n.jsxs("div",{className:"entry-user",title:e.kind,children:[n.jsx("div",{className:"entry-bubble",children:e.text}),n.jsxs("div",{className:"entry-footer",children:[r&&e.actorId!==i&&n.jsxs("span",{className:"entry-actor",children:["by ",r]}),n.jsx(ab,{entry:e,actions:a})]})]});const h=e.durationMs!==void 0&&n.jsx("span",{title:"How long the model took to reply",children:Vl(e.durationMs)});return n.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[n.jsx(bw,{text:l}),d&&n.jsx(ib,{icon:"tool",label:d,text:u.map(p=>p.line).join(`
|
|
55
|
+
`),badges:n.jsx(tb,{calls:e.autoApproved}),trimmed:e.trimmed}),n.jsxs("div",{className:"entry-footer",children:[(r||h)&&n.jsxs("span",{className:"entry-actor",children:[r&&n.jsxs(n.Fragment,{children:["by ",r]}),r&&h&&" · ",h]}),n.jsx(ab,{entry:e,actions:a})]})]})}function I4({sessionId:e}){return n.jsx(B4,{id:e},e)}function B4({id:e}){const{user:i,workspaces:a,sessions:r,refreshSessions:l,setLiveActivity:u}=pt(),d=M4(e),h=d.session,p=d.view,m=$e(`/api/sessions/${oe(e)}/audit`),[x,y]=D4(),[v,b]=N.useState("details"),w=h?.permissions??[],S=w.includes("write");w.includes("ask");const C=h?.status==="archived",k=h?.frozen===!0,O=w.includes("approve")&&!C&&!k,T=h?.ownerId===i.id,[M,_]=N.useState(!1),$=lo(h?.connectorId?`/api/workspaces/${oe(h.workspaceId)}/connectors`:null),G=$.data?.connectors.find(pe=>pe.id===h?.connectorId),J=G?.online,U=N.useRef(J);N.useEffect(()=>{U.current===!1&&J&&d.refresh(),U.current=J},[J,d.refresh]);const E=p?.activity;N.useEffect(()=>{u(E?{sessionId:e,activity:E}:null)},[e,E,u]),N.useEffect(()=>()=>{u(null),l()},[u,l]);const I=(p?.queue??[]).filter(pe=>Kl.includes(pe.status)),Q=N.useCallback(()=>{d.refresh(),m.refresh(),l()},[d.refresh,m.refresh,l]),ie=h?a.find(pe=>pe.id===h.workspaceId)?.role:void 0,re=!!(h&&Qh(i.id,h.ownerId,ie)),Y=l4({session:h,user:i,manages:re,backupBlocked:C||k||!p||!!d.error||p.busy||I.length>0,onChange:Q}),F=N.useCallback(pe=>{l(),xi({name:"session",sessionId:pe})},[l]),B=je(),se=h??r.find(pe=>pe.id===e),de=nv(se?.workspaceId??null),R=se&&a.find(pe=>pe.id===se.workspaceId)?.name,D=r.find(pe=>pe.id===e)?.pullRequest??h?.pullRequest,ee=h?.visibility??"private",z=d.status==="online"?n.jsx(ge,{tone:"success",dot:!0,children:"Live"}):d.status==="reconnecting"?n.jsx(ge,{tone:"warning",dot:!0,children:"Reconnecting"}):d.status==="offline"?n.jsx(ge,{tone:"danger",dot:!0,children:"Disconnected"}):n.jsx(ge,{tone:"neutral",dot:!0,children:"Connecting"}),X=[{label:"Copy session ID",icon:"copy",onSelect:()=>{navigator.clipboard.writeText(e)}}];h&&re&&!C&&(X.push({label:"Rename",icon:"pencil",disabled:Y.action.busy,onSelect:()=>_(!0)}),X.push({label:ee==="workspace"?"Make private":"Make workspace-visible",icon:ee==="workspace"?"lock":"globe",disabled:Y.action.busy,onSelect:Y.changeVisibility}),T&&!k&&(X.push({label:"Create backup",icon:"archive",disabled:Y.backupsOff||Y.backupsPending||Y.backupBlocked||Y.action.busy,hint:Y.backupsOff?"Backups are off":Y.backupBlocked?"Session busy":void 0,onSelect:()=>Y.createBackup()}),X.push({label:"Back up conversation only",icon:"archive",disabled:Y.backupsOff||Y.backupsPending||Y.backupBlocked||Y.conversationOnlyOff||Y.action.busy,hint:Y.backupsOff?"Backups are off":Y.backupBlocked?"Session busy":Y.conversationOnlyOff?"Update the host's connector":void 0,onSelect:()=>Y.createBackup({conversationOnly:!0})})),X.push({label:"Archive",icon:"archive",disabled:Y.action.busy,onSelect:Y.archive})),h&&re&&C&&(X.push({label:"Unarchive",icon:"archive",disabled:Y.action.busy||!!h.packed&&!T,onSelect:Y.unarchive}),T&&!h.packed&&!k&&!h.hostEnvironment&&X.push({label:"Pack files",icon:"archive",disabled:Y.action.busy,onSelect:Y.pack})),se&&X.push("separator",{label:"Open in workspace settings",icon:"settings",onSelect:()=>xi({name:"settings",section:"workspaces",id:se.workspaceId})});function Se(pe){if(!h||C||k)return!1;if($h(pe.operation,h,pe.unbounded))return sO(pe.operation,h,G,i.id,w.includes("approve"));const Fe=pe.operation.kind==="permission"||pe.operation.kind==="git.repin";return O&&(!Fe||T)}async function ve(pe,Fe,Dt,Kt=!1){if(!Se(pe)||B.busy||!pe.reviewHash||pe.status!=="pending")return;const yn=pe.operation.kind==="permission"?Fe==="deny"?"Not allowed":Dt==="session"?"Allowed for the rest of the session":"Allowed for this call":Kt?`Approved. ${Gi(de.person(pe.requestedBy))}'s requests here now run without asking; stop it under Details › People.`:Fe==="approve"?"Approval decision recorded":"Operation denied";await B.run(async()=>{await ce(`/api/sessions/${oe(e)}/approvals/${oe(pe.id)}`,{method:"POST",body:{decision:Fe,reviewHash:pe.reviewHash,...Dt?{scope:Dt}:{},...Kt?{alwaysApprove:!0}:{}}}),d.refresh(),m.refresh()},yn)}const Te=!p&&!!(h&&(h.status==="error"||h.status==="provisioning")),Qe=Te?n.jsx(ge,{tone:h?.status==="error"?"danger":"running",dot:!0,children:h?.status==="error"?"Not started":"Starting"}):!p&&d.error?n.jsx(ge,{tone:"warning",dot:!0,children:"Unavailable"}):z;return n.jsx(Q1,{people:de,children:n.jsxs("div",{className:x&&h?`session-screen panel-open${v==="files"?" panel-wide":""}`:"session-screen",children:[n.jsxs("div",{className:"session-pane",children:[n.jsx(rc,{leading:n.jsx(cO,{}),title:se?.title??"Session",subtitle:R,actions:n.jsxs(n.Fragment,{children:[h&&n.jsxs("span",{className:"session-badges",children:[C?n.jsx(ge,{tone:"neutral",children:"Archived"}):Qe,h.packed&&n.jsx(ge,{tone:"neutral",children:"Files packed"}),n.jsx(ge,{children:ee==="workspace"?"Workspace-visible":"Private"}),h.linkShared&&n.jsx(ge,{tone:"info",children:"Link shared"})]}),h&&D&&n.jsx(Yz,{pull:D}),h&&n.jsx(q,{variant:"ghost",size:"xs",icon:"panel-right","aria-label":"Toggle session panel",title:"Session panel","aria-pressed":x,onClick:()=>y(!x)}),n.jsx(ss,{label:"Session actions",items:X})]})}),(C||k||h?.cloneUnavailable||d.error&&!Te||Y.action.error||Y.action.notice)&&n.jsxs("div",{className:"session-alerts",children:[k&&!C&&n.jsx(we,{title:"Read-only",children:"This session pinned its repositories when it started, which sessions no longer do. Its conversation, approvals and backups stay viewable, but it no longer runs. Start a new session to continue the work."}),h?.cloneUnavailable&&!k&&n.jsx(we,{variant:"warning",title:"Can't clone repositories",children:h.cloneUnavailable}),C&&n.jsxs(we,{title:"Archived",actions:re&&(!h?.packed||T)&&n.jsx(q,{variant:"outline",size:"sm",disabled:Y.action.busy,onClick:Y.unarchive,children:"Unarchive"}),children:["This session is read-only. ",h?.packed?T?"Its files are packed on its host. Unarchiving unpacks them and clones its repositories again, so its host must be online.":"Its files are packed on its host, so only its owner can unarchive it.":re?"Unarchive it to continue the work.":"Only its owner, or the workspace's owner or an admin, can unarchive it."]}),d.error&&!Te&&n.jsx(we,{variant:"error",title:h?"Live updates interrupted":"Unable to open session",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:d.reconnect,children:"Reconnect and check access"}),children:d.error}),n.jsx(ye,{...Y.action})]}),p?h&&n.jsx(q4,{id:e,user:i,session:h,view:p,host:G,stale:!!d.error,refresh:d.refresh,loadOlder:d.loadOlder,openSession:F,pinned:n.jsxs(n.Fragment,{children:[p.repositories&&n.jsx(Kz,{sessionId:e,preparation:p.repositories,canRestart:T&&!C&&w.includes("manage"),onRestarted:Q}),h.hostUnsandboxed&&(S||O)&&(h.hostEnvironment?n.jsx(we,{variant:"error",title:"Runs on the host",children:"This session runs directly on its host, without the sandbox. Approved commands and commits execute on the host owner's machine with their full user permissions, network access and no resource limits; only the host owner, or members they granted host commands, decide them."}):n.jsx(we,{variant:"error",title:"Unsandboxed host",children:"This session's host runs without a sandbox. Approved commands and commits execute directly on the host owner's machine with their full user permissions, network access and no resource limits."})),p.approvals.filter(pe=>pe.status==="pending").map(pe=>{const Fe=pe.operation.kind==="permission",Dt=eO(pe.operation,h),Kt=$h(pe.operation,h,pe.unbounded),yn=Fe||pe.operation.kind==="git.repin",yt=B.busy||!pe.reviewHash;return n.jsx(qw,{approval:pe,children:Se(pe)?n.jsxs(n.Fragment,{children:[!pe.reviewHash&&n.jsx(we,{variant:"warning",title:"No verified review commitment",actions:n.jsx(q,{variant:"outline",size:"sm",disabled:B.busy,onClick:d.refresh,children:"Refresh approval"}),children:"Refresh before deciding; the server must bind the displayed operation and requester."}),Fe?n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"default",size:"sm",disabled:yt,onClick:()=>{ve(pe,"approve","call")},children:"Allow once"}),!(pe.operation.kind==="permission"&&pe.operation.tool==="host_bash")&&n.jsx(q,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ve(pe,"approve","session")},title:"Also runs this tool's commands and pushes without asking for the rest of the session; GitHub comments and merges still ask",children:"Allow for this session"}),n.jsx(q,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ve(pe,"deny")},children:"Deny"})]}):n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"default",size:"sm",disabled:yt,onClick:()=>{ve(pe,"approve")},children:"Approve"}),tO(pe,h,G,i.id)&&n.jsxs(q,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ve(pe,"approve",void 0,!0)},title:`Approves this and runs ${Gi(de.person(pe.requestedBy))}'s later commands, pushes, and GitHub comments and issues in this session without asking, as you. Merges, host commands and new permissions still ask. Stop it any time under Details › People.`,children:["Always approve ",Gi(de.person(pe.requestedBy))]}),n.jsx(q,{variant:"outline",size:"sm",disabled:yt,onClick:()=>{ve(pe,"deny")},children:"Deny"}),n.jsxs("span",{className:"muted small",children:["Runs as ",Dt?"the host OS user (outside the sandbox)":p.owner.displayName," · each approval covers one exact operation and its arguments"]})]})]}):n.jsx("p",{className:"muted small",children:Kt?iO(pe.operation,G):yn?"Waiting for the session owner":"Waiting for an authorized approver"})},pe.id)}),n.jsx(ye,{...B})]})}):d.error?h?n.jsx(F4,{id:e,user:i,session:h,error:d.error,recovered:()=>{d.reconnect(),l()}}):n.jsx("div",{className:"session-transcript"}):n.jsx(ds,{})]}),h&&x&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"session-scrim","aria-label":"Close session panel",onClick:()=>y(!1)}),n.jsx(d4,{session:h,view:p,user:i,workspaceRole:ie,hosts:$,tab:v,setTab:b,onClose:()=>y(!1),refresh:d.refresh,audit:m,actions:Y,openSession:F})]}),h&&re&&n.jsx(H4,{open:M,title:h.title,busy:Y.action.busy,onClose:()=>_(!1),onSave:async pe=>{await Y.rename(pe)&&_(!1)}})]})})}function H4({open:e,title:i,busy:a,onClose:r,onSave:l}){const[u,d]=N.useState(i);N.useEffect(()=>{e&&d(i)},[e,i]);const h=u.trim();function p(m){m.preventDefault(),h&&!a&&l(h)}return n.jsx(qt,{open:e,title:"Rename session",onClose:r,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{variant:"ghost",onClick:r,children:"Cancel"}),n.jsx(q,{type:"submit",form:"rename-session-form",variant:"default",disabled:a||!h,children:a?"Saving...":"Rename"})]}),children:n.jsx("form",{id:"rename-session-form",className:"stack",onSubmit:p,children:n.jsx(xe,{label:"Title",children:n.jsx("input",{className:"input",required:!0,autoFocus:!0,maxLength:200,value:u,onChange:m=>d(m.target.value),autoComplete:"off"})})})})}function q4({id:e,user:i,session:a,view:r,host:l,stale:u,refresh:d,loadOlder:h,openSession:p,pinned:m}){const x=a.ownerId===i.id,[y,v]=N.useState(()=>F1(r,x)),[b,w]=N.useState("write"),[S,C]=tf(e),k=Ib(a.workspaceId,l),O=Bb(Ub(l),()=>E1(e),(a.permissions??[]).includes("write")?k:{...k,unavailable:"Attaching files writes them into the session, which takes write access."},()=>A1(e));N.useEffect(()=>{z1(e)},[e]),N1(e,O);const[T,M]=N.useState(""),_=N.useRef(null),$=N.useRef(!1),G=je(),J=je(),U=je(),[E,I]=N.useState(""),Q=N.useRef(!0);N.useEffect(()=>(Q.current=!0,()=>{Q.current=!1}),[]);const[ie,re]=N.useState(null),Y=N.useRef(null),F=N.useRef(!0),[B,se]=N.useState(!1),de=N.useRef(!1),R=N.useRef(void 0),D=a.permissions??[],ee=D.includes("write"),z=D.includes("ask"),X=b==="ask"&&!z?"write":b,Se=a.status==="archived",ve=a.frozen===!0,Te=!Se&&!ve&&(X==="write"?ee:z),Qe=!!(a.hostUnsandboxed||l?.capabilities.unsandboxed),pe=r.queue??[],Fe=pe.filter(he=>Kl.includes(he.status)),Dt=pe.filter(he=>!Kl.includes(he.status)).slice(-5).reverse(),Kt=!!r.stoppable&&!Se&&ee&&Fe.length>0,yn=pe.some(he=>he.status==="stopping"),yt=r.withdrawable&&!Se&&!ve?Fe.filter(he=>he.actorId===i.id&&he.status==="queued"&&(he.mode==="ask"?z:ee)):[],bn=O.images.length>0,Rn=r.conversations,Oe=Rn.filter(he=>he.mode==="ask"&&(!he.actorId||he.actorId===i.id)),rt=r.entries.filter(he=>{if(he.role==="system"&&!he.text.trim())return!1;const Ee=Rn.find(vt=>vt.id===he.conversationId);return X==="ask"?Ee?.mode==="ask"&&(!Ee.actorId||Ee.actorId===i.id)&&(!T||he.conversationId===T):Ee?.mode!=="ask"}),vn=rt.at(-1)?.id,wn=rt[0]?.id,on=Rn.filter(he=>(he.olderEntries??0)>0&&(X==="ask"?he.mode==="ask"&&(!he.actorId||he.actorId===i.id)&&(!T||he.id===T):he.mode!=="ask")),Xn=on.reduce((he,Ee)=>he+(Ee.olderEntries??0),0),[Mn,Lt]=N.useState(!1),nn=N.useRef(null);function ms(){if(Mn||!on.length)return;const he=Y.current;nn.current=he?{first:wn,height:he.scrollHeight,top:he.scrollTop}:null,Lt(!0),Promise.all(on.map(Ee=>h(Ee.id))).finally(()=>Lt(!1))}N.useLayoutEffect(()=>{const he=Y.current;he&&F.current&&(he.scrollTop=he.scrollHeight)},[vn,rt.length]),N.useEffect(()=>{const he=Y.current;if(!he||typeof ResizeObserver>"u")return;const Ee=()=>{F.current&&(he.scrollTop=he.scrollHeight)},vt=new ResizeObserver(Ee);return vt.observe(he),he.firstElementChild&&vt.observe(he.firstElementChild),()=>vt.disconnect()},[]);function ne(he){const Ee=he.scrollHeight-he.scrollTop-he.clientHeight;F.current=Ee<80;const vt=Ee>240;se(Ft=>Ft===vt?Ft:vt)}function fe(){de.current=!1,window.clearTimeout(R.current),R.current=void 0}N.useEffect(()=>()=>window.clearTimeout(R.current),[]);function De(){const he=Y.current;he&&(F.current=!0,de.current=!0,se(!1),he.scrollTo({top:he.scrollHeight,behavior:"smooth"}),window.clearTimeout(R.current),R.current=window.setTimeout(()=>{fe(),Y.current&&ne(Y.current)},1e3))}function Le(){de.current&&(fe(),Y.current&&ne(Y.current))}N.useLayoutEffect(()=>{F.current=!0,nn.current=null;const he=Y.current;he&&(he.scrollTop=he.scrollHeight)},[X,T]),N.useLayoutEffect(()=>{const he=Y.current,Ee=nn.current;!he||!Ee||Ee.first===wn||(nn.current=null,!(Ee.first===void 0||!rt.some(vt=>vt.id===Ee.first))&&(he.scrollTop=Ee.top+he.scrollHeight-Ee.height))},[wn]);async function Ut(he){he?.preventDefault();const Ee=O.images,vt=O.files;if(!Te||!S.trim()&&!Ee.length&&!vt.length||G.busy||$.current)return;const Ft=Yb(l,y,X==="ask"?"ask":"submit"),Ya=G1(l,y,X==="ask"?"ask":"submit")??P1(l,y);if(!Ya&&l&&Zb(Ft,Wb())&&($.current=!0,!await Jh(l,Qe).finally(()=>{$.current=!1}))){v(Ji=>({...Ji,access:"approval"}));return}re(null),I("");const Ki=S,Wi=`${X}:${JSON.stringify(Ft??null)}:${[...Ee,...vt].map(vi=>vi.id).join(",")}:${Ki}`;_.current?.key!==Wi&&(_.current={key:Wi,id:crypto.randomUUID()});const qs=_.current;F.current=!0,G.run(async()=>{if(Ya)throw new Error(Ya);const vi=qs.images??=await Gb(Ee),Ji=await O.upload(e,l,vt),Va=await ce(`/api/sessions/${oe(e)}/${X==="ask"?"ask":"submit"}`,{method:"POST",body:{content:Hb(Ki,Ji),requestId:qs.id,...Ft?{options:Ft}:{},...vi.length?{images:vi}:{}}});re(Va),Ft&&Qb(l,y,r.agent),X==="ask"&&M(Va.conversationId),ef(e,Ki),O.sent(Ee,vt),_.current=null,d()})}function st(he){U.busy||G.busy||bn||(I(""),U.run(async()=>{const Ee=await ce(`/api/sessions/${oe(e)}/withdraw`,{method:"POST",body:{submissionId:he}});Z1(e,Ee.content),T1(e,O1(Ee.images??[])),Q.current&&(Ee.imagesLost&&I("Its images were no longer on the host: attach them again before sending."),w(Ee.mode),F.current=!0,d())}))}function bt(){!Kt||J.busy||J.run(async()=>{await ce(`/api/sessions/${oe(e)}/stop`,{method:"POST",body:{}}),d()})}const Ke=je(),Wt=r.busy||Fe.length>0,ps=KS(r)&&X==="write"&&!Se&&!ve&&(ee||x)?{...ee?{revert:{run:Qi,disabled:Ke.busy?"Working...":Wt?"Stop the session's work to go back to an earlier message":void 0}}:{},...x?{fork:{run:bi,disabled:Ke.busy?"Working...":void 0}}:{}}:void 0;async function Qi(he,Ee){Ke.busy||!await He({title:Ee.before?"Go back to before this message?":"Go back to this reply?",message:n.jsxs(n.Fragment,{children:[Ee.before?"This message and everything after it leave":"Everything after this reply leaves"," the shared conversation, for everyone, and the agent continues from there.",Ee.before&&" The message goes back into your chat box, when it's empty, to edit and send again."," Only the conversation goes back: files, commits and pushes stay as they are."]}),confirmLabel:"Go back",destructive:!0})||Ke.run(async()=>{await ce(`/api/sessions/${oe(e)}/revert`,{method:"POST",body:{entryId:Ee.entryId}}),Ee.before&&!Xl(e).trim()&&C(Kx(he)),F.current=!0,d()})}async function bi(he,Ee){Ke.busy||!await He({title:"Fork a new session from here?",message:n.jsxs(n.Fragment,{children:["A new session of yours starts on the same host and model with this conversation up to ",Ee.before?"just before this message, which goes into its chat box":"this reply",". This session stays as it is. Like every new session, the fork's worktree starts empty: its agent clones the workspace's repositories again, and only what was pushed is there."]}),confirmLabel:"Fork session"})||Ke.run(async()=>{const Ft=await ce(`/api/sessions/${oe(e)}/fork`,{method:"POST",body:{entryId:Ee.entryId}});Ee.before&&oo(Ft.session.id,Kx(he)),p(Ft.session.id)})}const Nt=!!S.trim()&&PS(S)!==S,jn=Qz(r)?n.jsxs(n.Fragment,{children:[n.jsx(qi,{}),"Preparing repositories...",Fe.length>0&&n.jsxs("span",{className:"muted",children:[" · ",Fe.length," queued"]})]}):yn?n.jsxs(n.Fragment,{children:[n.jsx(qi,{}),"Stopping...",Fe.length>0&&n.jsxs("span",{className:"muted",children:[" · ",Fe.length," queued"]})]}):r.busy?n.jsxs(n.Fragment,{children:[n.jsx(qi,{}),r.activity==="waiting"?"Waiting for a decision":"Working","...",Fe.length>0&&n.jsxs("span",{className:"muted",children:[" · ",Fe.length," queued"]})]}):Fe.length?n.jsxs(n.Fragment,{children:[Fe.length," queued"]}):n.jsx(n.Fragment,{children:"Idle"});return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"session-transcript-frame",children:[n.jsx("div",{className:"session-transcript",ref:Y,onWheel:Le,onTouchStart:Le,onKeyDown:Le,onScroll:he=>{const Ee=he.currentTarget;if(de.current)if(Ee.scrollHeight-Ee.scrollTop-Ee.clientHeight<80)fe();else return;ne(Ee),Ee.scrollTop<240&&Xn>0&&ms()},"aria-label":X==="ask"?"Side ask history":"Shared session history",children:n.jsxs("div",{className:"chat-column",children:[Xn>0&&n.jsx("div",{className:"transcript-earlier",children:n.jsx(q,{variant:"ghost",size:"sm",icon:"chevron-up",disabled:Mn,onClick:ms,children:Mn?"Loading earlier messages...":`Show earlier messages (${Xn})`})}),rt.length?rt.map(he=>n.jsx(U4,{entry:he,userId:i.id,actions:ps},he.id)):n.jsx(xt,{title:X==="ask"?"A question on the side":"The conversation begins here",children:X==="ask"?"Ask about the work without changing it":"Committed messages and tool results will appear here"})]})}),B&&n.jsx(q,{variant:"secondary",size:"sm",icon:"arrow-down",className:"jump-to-latest","aria-label":"Jump to the latest message",title:"Jump to the latest message",onClick:De})]}),n.jsxs("div",{className:"session-bottom",children:[n.jsx("div",{className:"session-pinned",children:n.jsxs("div",{className:"chat-column stack",children:[m,n.jsxs("details",{className:"queue-line",children:[n.jsxs("summary",{role:"status","aria-live":"polite",children:[jn,n.jsx(be,{name:"chevron-down",size:14})]}),n.jsxs("div",{className:"queue-detail stack",children:[n.jsx("p",{className:"muted small",children:"Submissions and side asks share one queue; permissions are checked again before work runs. You can leave this page: accepted work continues while the host is online and authorized."}),u&&n.jsx("p",{className:"small",children:"This is the last received queue view; live host status is not confirmed."}),ie&&n.jsxs("p",{className:"small",children:["Last receipt ",n.jsx("code",{children:ie.submissionId})," · ",ie.status,ie.queuePosition!==void 0?` · queue position ${ie.queuePosition}`:""]}),Fe.length>0&&n.jsx("ol",{className:"queue-items",children:Fe.map((he,Ee)=>n.jsxs("li",{children:[n.jsxs("span",{children:[Ee+1,". ",he.mode==="ask"?"Read-only side ask":"Shared submission"," · ",he.status]}),n.jsxs("span",{className:"muted small",children:["By ",n.jsx(cs,{id:he.actorId,you:!0})," · Receipt ",n.jsx("code",{children:he.submissionId})]}),yt.includes(he)&&n.jsx("span",{className:"inline",children:n.jsx(q,{variant:"outline",size:"xs",icon:"pencil",disabled:U.busy||G.busy||bn,title:bn?"Remove the images from your chat box to edit this message there":"Take this message out of the queue and back into your chat box",onClick:()=>st(he.submissionId),children:"Edit"})})]},he.submissionId))}),Dt.length>0&&n.jsx("ul",{className:"queue-items",children:Dt.map(he=>n.jsxs("li",{children:[n.jsxs("span",{children:[he.status," · ",he.mode==="ask"?"Side ask":"Shared submission"]}),n.jsxs("span",{className:"muted small",children:["By ",n.jsx(cs,{id:he.actorId,you:!0})," · Receipt ",n.jsx("code",{children:he.submissionId})]})]},he.submissionId))}),n.jsx("div",{className:"inline",children:n.jsx(q,{variant:"outline",size:"sm",icon:"refresh",onClick:d,children:"Refresh queue"})})]})]})]})}),n.jsxs("div",{className:"chat-column stack",children:[n.jsx(Yw,{value:S,onChange:C,onSubmit:Ut,attachments:O,busy:G.busy,disabled:!Te,onStop:Kt?bt:void 0,stopping:J.busy,onRecall:Te&&yt.length&&!bn?()=>st(yt.at(-1).submissionId):void 0,label:X==="ask"?"Ask without making changes":"Continue the shared work",placeholder:Te?yt.length&&!bn?"Press ↑ to edit your queued message":X==="ask"?"Ask without changing anything":"Message the agent":"Read-only",sendLabel:X==="ask"?"Send side ask":"Submit to session",hintRequired:!Te||X==="ask",hint:Se?"Read-only · this session is archived":ve?"Read-only · this session pinned its repositories when it started":Te?X==="ask"?"Read-only · anyone who can view this session can see side asks":`Runs as ${r.owner.displayName}${r.owner.id===i.id?" (you)":""}`:z?"Read-only · switch to Side ask to ask questions":"Read-only · submitting needs write permission",tools:n.jsxs(n.Fragment,{children:[z&&n.jsx(hs,{size:"xs",label:"Conversation mode",value:X,onChange:w,options:[{value:"write",label:"Shared"},{value:"ask",label:"Side ask"}]}),X==="ask"&&Oe.length>0&&n.jsx(Xt,{label:"Side conversation",side:"above",value:T,onChange:M,options:[{value:"",label:"All my side asks"},...Oe.map((he,Ee)=>({value:he.id,label:`Side ask ${Ee+1}`,hint:he.id.slice(0,8)}))]}),Te&&n.jsx(Jb,{host:l,value:y,onChange:v,owner:x,showAccess:X==="write",unsandboxed:Qe})]})}),Nt&&n.jsxs("p",{className:"muted small",role:"status",children:["This message looks like it holds a secret. Everyone, you included, sees it as ",kt," in the transcript, but the agent and its host receive it as typed."]}),n.jsx(ye,{error:G.error||J.error||U.error||Ke.error,notice:E})]})]})]})}function Yw({value:e,onChange:i,onSubmit:a,attachments:r,onStop:l,stopping:u,onRecall:d,busy:h,disabled:p,label:m,placeholder:x,sendLabel:y,hint:v,hintRequired:b,tools:w}){const[S]=N.useState(()=>zb()),C=!!(e.trim()||r?.count),k=N.useRef(null);N.useLayoutEffect(()=>{const M=k.current;M&&(M.style.height="auto",M.style.height=`${M.scrollHeight}px`)},[e]);function O(M){M?.preventDefault(),!p&&!h&&C&&a()}function T(M){S&&M.key==="Enter"&&!M.shiftKey&&!M.nativeEvent.isComposing?O(M):d&&M.key==="ArrowUp"&&!M.shiftKey&&!M.altKey&&!M.ctrlKey&&!M.metaKey&&!M.nativeEvent.isComposing&&!p&&!h&&!e&&!r?.count&&(M.preventDefault(),d())}return n.jsxs("form",{className:"composer",onSubmit:O,children:[r&&n.jsx(Fb,{attachments:r,disabled:h||p}),n.jsx("textarea",{ref:k,rows:1,required:!r?.count,value:e,disabled:h||p,"aria-label":m,placeholder:x,enterKeyHint:S?"send":"enter",onChange:M=>i(M.target.value),onKeyDown:T,onPaste:r?.paste}),r?.notice&&n.jsx("p",{className:"composer-notice",role:"status",children:r.notice}),n.jsxs("div",{className:"composer-toolbar",children:[(r&&!p||w)&&n.jsxs("span",{className:"composer-tools",children:[r&&!p&&n.jsx(qb,{attachments:r,disabled:h}),w]}),n.jsx("span",{className:b?"composer-hint required":"composer-hint",children:v}),n.jsxs("span",{className:"composer-actions",children:[l&&n.jsx(q,{variant:"outline",size:"sm",icon:"stop",className:"composer-stop","aria-label":u?"Stopping...":"Stop",title:"Stop the running message and those queued",disabled:u,onClick:l}),n.jsx(q,{type:"submit",variant:"default",size:"sm",icon:"send",className:"composer-send","aria-label":h?"Sending...":y,title:y,disabled:h||p||!C})]})]})]})}function F4({id:e,user:i,session:a,error:r,recovered:l}){const[u,d]=tf(e),h=N.useRef(null),p=je(),m=a.status==="error"||a.status==="provisioning",x=m&&a.ownerId===i.id&&!!a.permissions?.includes("manage"),y=!!a.permissions?.includes("write");function v(){const S=u;h.current?.content!==S&&(h.current={content:S,id:crypto.randomUUID()});const C=h.current.id;p.run(async()=>{await ce(`/api/sessions/${oe(e)}/restart`,{method:"POST"});try{await ce(`/api/sessions/${oe(e)}/submit`,{method:"POST",body:{content:S,requestId:C}})}catch(k){throw oo(e,S),l(),k}h.current=null,ef(e,S),l()})}const b=a.status==="error"?"This session didn't start":a.status==="provisioning"?"This session is still starting":"This session can't be reached",w=x?"Send a message to start it again on its host. Your message runs once it's ready.":m?"Only the session owner can start it again.":y?"Messages can be sent once the host is back online.":"The conversation appears once the host is back online.";return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"session-transcript",children:n.jsx("div",{className:"chat-column",children:n.jsx(xt,{title:b,children:n.jsxs("span",{className:"stack",children:[n.jsx("span",{children:w}),m&&r&&n.jsx("span",{className:"muted small",children:r})]})})})}),n.jsx("div",{className:"session-bottom",children:n.jsxs("div",{className:"chat-column stack",children:[n.jsx(Yw,{value:u,onChange:d,onSubmit:v,busy:p.busy,disabled:!x,label:"Message the agent",placeholder:x?"Message the agent to start the session again":"Message the agent",sendLabel:x?"Restart and send":"Sending is unavailable",hintRequired:!0,hint:p.busy?"Starting the session and preparing repositories...":x?"Restarts the session, then sends":m?"Only the owner can restart this session":y?"Waiting for the host":"Read-only — submitting needs write permission"}),n.jsx(ye,{error:p.error})]})})]})}const rb={working:{tone:"running",label:"In progress"},waiting:{tone:"warning",label:"Needs approval"},failed:{tone:"danger",label:"Failed"},done:{tone:"success",label:"Done"},idle:{tone:"neutral",label:"Idle"}};function Vw(e,i=e.activity){return e.status==="archived"?{tone:"neutral",label:"Archived"}:e.status==="provisioning"?{tone:"running",label:"Starting"}:e.status==="error"?{tone:"danger",label:"Not started"}:e.nextScheduledAt&&i!=="working"&&i!=="waiting"&&i!=="failed"?{tone:"info",label:"Scheduled",icon:"clock"}:i&&Object.hasOwn(rb,i)?rb[i]:{tone:"success"}}function Zw(e){const i=new Set(e.map(h=>h.id)),a=new Map,r=[];for(const h of e){const p=h.parentSessionId;if(p&&i.has(p)&&p!==h.id){const m=a.get(p);m?m.push(h):a.set(p,[h])}else r.push(h)}const l=[],u=new Set,d=(h,p)=>{if(!u.has(h.id)){u.add(h.id),l.push({session:h,depth:p});for(const m of a.get(h.id)??[])d(m,Math.min(p+1,3))}};for(const h of r)d(h,0);for(const h of e)u.has(h.id)||d(h,0);return l}const ob=50;function G4(){const{user:e,sessions:i,sessionsLoading:a,workspaces:r,currentWorkspace:l}=pt(),[u,d]=N.useState(""),[h,p]=N.useState({}),[m,x]=N.useState(!1),[y,v]=N.useState(!1),b=N.useMemo(()=>i.filter(k=>k.status==="archived").length,[i]),w=N.useMemo(()=>{const k=u.trim().toLowerCase(),O=new Map;for(const _ of i){if(_.status==="archived"&&!y||k&&!_.title.toLowerCase().includes(k))continue;const $=O.get(_.workspaceId);$?$.push(_):O.set(_.workspaceId,[_])}const T=[l?.id,...r.map(_=>_.id)],M=_=>{const $=T.indexOf(_);return $<0?T.length:$};return[...O.entries()].sort(([_],[$])=>M(_)-M($)).map(([_,$])=>({id:_,name:r.find(G=>G.id===_)?.name??"Other workspace",sessions:$}))},[i,u,y,r,l?.id]),S=n.jsx(rc,{title:"Sessions",actions:n.jsxs(n.Fragment,{children:[n.jsx(Qr,{label:"Who can see a session",children:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Private sessions are visible to their owner, the workspace's owner and admins, and people with an explicit grant. Workspace-visible sessions can be viewed by every workspace member."}),n.jsx("p",{children:"Viewing never allows asking, writing, approving or managing; those need separate grants. The workspace's owner and admins manage every session in it, but approve only with a grant. Opening a session keeps its original owner identity and history."}),n.jsx("p",{children:"Only the owner, or the workspace's owner or an admin, can change visibility, which is separate from sharing a host."})]})}),b>0&&n.jsx(q,{variant:"ghost",size:"sm",icon:"archive","aria-pressed":y,onClick:()=>v(k=>!k),children:y?"Hide archived":`Show archived (${b})`}),n.jsx(q,{variant:"outline",size:"sm",onClick:()=>x(!0),children:"Open by ID"})]})}),C=n.jsx(P4,{open:m,onClose:()=>x(!1)});return a?n.jsxs(n.Fragment,{children:[S,n.jsx(ds,{}),C]}):i.length?n.jsxs(n.Fragment,{children:[S,n.jsxs("div",{className:"content-column",children:[n.jsx("input",{className:"input sessions-search",type:"search",value:u,onChange:k=>d(k.target.value),placeholder:"Search sessions","aria-label":"Search sessions by title"}),w.length?w.map(k=>{const O=h[k.id]??ob;return n.jsxs(Ae,{title:n.jsxs("span",{className:"inline",children:[n.jsx(Is,{name:k.name,id:k.id}),k.name]}),children:[Zw(k.sessions).slice(0,O).map(({session:T,depth:M})=>{const _=T.ownerId===e.id,$=!_&&T.permissions?.includes("read")&&T.permissions.every(J=>J==="read"),G=Vw(T);return n.jsx(W,{href:Xe({name:"session",sessionId:T.id}),chevron:!0,leading:n.jsx(gi,{tone:G.tone,icon:G.icon,label:G.label?void 0:T.status}),title:n.jsxs("span",{className:"truncate",children:[M>0&&n.jsxs("span",{className:"muted","aria-label":"Started by the session above",children:[" ".repeat(M-1),"↳ "]}),T.title]}),hint:n.jsxs(n.Fragment,{children:[G.label&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:`session-status ${G.tone}`,children:G.label})," · "]}),T.pullRequest&&n.jsxs(n.Fragment,{children:[n.jsx(kw,{pull:T.pullRequest})," · "]}),_?"Yours":$?"Viewer":"Shared"," · ",T.visibility==="workspace"?"Workspace-visible":"Private"," · ",n.jsx(Vn,{value:T.createdAt})]})},T.id)}),k.sessions.length>O&&n.jsx("div",{className:"sessions-more",children:n.jsx(q,{variant:"ghost",size:"sm",block:!0,onClick:()=>p(T=>({...T,[k.id]:O+ob})),children:"Load more"})})]},k.id)}):n.jsx(xt,{title:!u.trim()&&!y?"All sessions are archived":"No matching sessions"})]}),C]}):n.jsxs(n.Fragment,{children:[S,n.jsx(xt,{title:"No sessions yet",action:l&&n.jsx(Ht,{variant:"ghost",href:Xe({name:"new",workspaceId:l.id}),children:"Start a session"})}),C]})}function P4({open:e,onClose:i}){const[a,r]=N.useState(""),l=je();function u(d){d.preventDefault(),!(!a.trim()||l.busy)&&l.run(async()=>{const h=await ce(`/api/sessions/${oe(a.trim())}`);i(),r(""),xi({name:"session",sessionId:h.session.id})})}return n.jsx(qt,{open:e,title:"Open a session by ID",onClose:i,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{variant:"ghost",onClick:i,children:"Cancel"}),n.jsx(q,{type:"submit",form:"open-session-form",variant:"default",disabled:l.busy||!a.trim(),children:l.busy?"Checking access...":"Open session"})]}),children:n.jsxs("form",{id:"open-session-form",className:"stack",onSubmit:u,children:[n.jsx(xe,{label:"Session ID",hint:"Ask the session owner for its ID",children:n.jsx("input",{className:"input",required:!0,autoFocus:!0,value:a,onChange:d=>r(d.target.value),autoComplete:"off"})}),n.jsx(ye,{error:l.error})]})})}function Ls(e,i,a){return`${e.toLocaleString()} ${e===1?i:a}`}function lh(e,...i){const a=i.filter(Boolean).join(" ").toLowerCase();return e.toLowerCase().split(/\s+/).filter(Boolean).every(r=>a.includes(r))}function ch({list:e}){return e?.truncated?n.jsx(ke,{children:n.jsxs("span",{className:"muted small",children:["Only the newest ",e.items.length.toLocaleString()," are listed"]})}):null}function Y4(){const e=$e("/api/admin/overview"),i=$e("/api/admin/users"),a=$e("/api/admin/workspaces"),r=$e("/api/admin/hosts"),[l,u]=N.useState(""),d=je(),h=e.data?.overview;function p(){e.refresh(),i.refresh(),r.refresh()}async function m(w){await He({title:"Suspend account",destructive:!0,confirmLabel:"Suspend",message:`Suspend ${Mt(w)}? They're signed out everywhere and can't sign in, their hosts are disconnected, and nobody can open the sessions they own until you unsuspend them. Nothing is deleted.`})&&d.run(async()=>{await ce(`/api/admin/users/${oe(w.id)}/suspend`,{method:"POST"}),p()},"Account suspended.")}function x(w){d.run(async()=>{await ce(`/api/admin/users/${oe(w.id)}/unsuspend`,{method:"POST"}),p()},"Account unsuspended. They can sign in again and their hosts reconnect.")}const y=(i.data?.items??[]).filter(w=>lh(l,w.displayName,w.githubLogin,w.id)),v=(a.data?.items??[]).filter(w=>lh(l,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id)),b=(r.data?.items??[]).filter(w=>lh(l,w.name,w.ownerName,w.ownerGithubLogin,w.ownerId,w.id));return n.jsxs(n.Fragment,{children:[n.jsx(Ae,{title:"Overview",info:"Totals for this whole Pikibun server. You administer it because its operator lists your user ID in ADMIN_USER_IDS. Administration shows who uses the server and what they run it on, never what they work on: no session titles, prompts, repositories or credentials.",children:n.jsx(tt,{...e,retry:e.refresh,children:h&&n.jsxs(n.Fragment,{children:[n.jsx(W,{title:"Accounts",trailing:n.jsxs(n.Fragment,{children:[h.users.toLocaleString(),h.suspendedUsers>0&&n.jsxs(ge,{tone:"danger",children:[h.suspendedUsers.toLocaleString()," suspended"]})]})}),n.jsx(W,{title:"Workspaces",trailing:h.workspaces.toLocaleString()}),n.jsx(W,{title:"Hosts",trailing:`${h.onlineHosts.toLocaleString()} online of ${h.hosts.toLocaleString()}`}),n.jsx(W,{title:"Sessions",trailing:`${h.activeSessions.toLocaleString()} active of ${h.sessions.toLocaleString()}`})]})})}),n.jsx("input",{className:"input admin-filter",type:"search",value:l,onChange:w=>u(w.target.value),placeholder:"Filter by name, username or ID","aria-label":"Filter accounts, workspaces and hosts"}),n.jsx(Ae,{title:"Accounts",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Suspending an account signs it out everywhere, refuses its sign-ins, disconnects its hosts and closes the sessions it owns to everyone, as if it had left its workspaces. Nothing is deleted: unsuspending restores it as it was."}),n.jsx("p",{children:"Administrators can't be suspended here; remove them from ADMIN_USER_IDS first."})]}),children:n.jsxs(tt,{...i,retry:i.refresh,children:[y.length?y.map(w=>n.jsx(W,{leading:n.jsx(Is,{name:w.displayName,id:w.id}),title:w.displayName,hint:n.jsxs(n.Fragment,{children:[Mt(w)," · ",Ls(w.workspaces,"workspace","workspaces")," · ",Ls(w.hosts,"host","hosts")," · ",Ls(w.sessions,"session","sessions")," · Joined ",n.jsx(Vn,{value:w.createdAt})]}),trailing:n.jsxs(n.Fragment,{children:[w.instanceAdmin&&n.jsx(ge,{tone:"success",children:"Administrator"}),w.suspendedAt&&n.jsx(ge,{tone:"danger",children:"Suspended"}),!w.instanceAdmin&&n.jsx(ss,{label:`Actions for ${w.displayName}`,items:[w.suspendedAt?{label:"Unsuspend",icon:"refresh",disabled:d.busy,onSelect:()=>x(w)}:{label:"Suspend",icon:"lock",destructive:!0,disabled:d.busy,onSelect:()=>{m(w)}}]})]})},w.id)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:l.trim()?"No matching accounts":"No accounts"})}),n.jsx(ch,{list:i.data}),(d.error||d.notice)&&n.jsx(ke,{children:n.jsx(ye,{...d})})]})}),n.jsx(Ae,{title:"Workspaces",children:n.jsxs(tt,{...a,retry:a.refresh,children:[v.length?v.map(w=>n.jsx(W,{leading:n.jsx(Is,{name:w.name,id:w.id}),title:w.name,hint:n.jsxs(n.Fragment,{children:["Owner ",Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ls(w.members,"member","members")," · ",Ls(w.repositories,"repository","repositories")," · ",Ls(w.hosts,"host","hosts")," · ",Ls(w.sessions,"session","sessions")," · Created ",n.jsx(Vn,{value:w.createdAt})]})},w.id)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:l.trim()?"No matching workspaces":"No workspaces"})}),n.jsx(ch,{list:a.data})]})}),n.jsx(Ae,{title:"Hosts",info:"Every paired host that hasn't been removed. A suspended account's hosts stay paired but can't connect until it is unsuspended.",children:n.jsxs(tt,{...r,retry:r.refresh,children:[b.length?b.map(w=>{const[S,C]=w.revokedAt?["danger","Revoked"]:w.online?["success","Online"]:["neutral","Offline"];return n.jsx(W,{leading:n.jsx(gi,{tone:S,label:C}),title:w.name,hint:n.jsxs(n.Fragment,{children:[Mt({id:w.ownerId,githubLogin:w.ownerGithubLogin})," · ",Ls(w.workspaces,"workspace","workspaces")," · ",Ls(w.sessions,"session","sessions"),w.lastSeenAt&&n.jsxs(n.Fragment,{children:[" · Last connected ",n.jsx(Vn,{value:w.lastSeenAt})]})]}),trailing:n.jsx(ge,{tone:S,children:C})},w.id)}):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:l.trim()?"No matching hosts":"No hosts"})}),n.jsx(ch,{list:r.data})]})})]})}const Xw="pikibun.theme";function Qw(){try{const e=localStorage.getItem(Xw);return e==="light"||e==="dark"||e==="pikibun"?e:"system"}catch{return"system"}}function Hh(e=Qw()){if(e==="pikibun"){document.documentElement.dataset.theme="pikibun";return}const i=e==="dark"||e==="system"&&matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.dataset.theme=i?"dark":"light"}function Kw(){const[e,i]=N.useState(Qw);return N.useEffect(()=>{Hh(e);const a=matchMedia("(prefers-color-scheme: dark)"),r=()=>Hh();return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[e]),[e,a=>{try{localStorage.setItem(Xw,a)}catch{}i(a)}]}function V4(){const[e,i]=Kw();return n.jsx(Ae,{title:"Theme",children:n.jsx(W,{title:"Color theme",hint:"System follows your device setting",trailing:n.jsx(hs,{label:"Color theme",value:e,onChange:i,options:[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"pikibun",label:"Pikibun",icon:"sparkle",hint:"Night sky, lavender and cream, after Pikibun"},{value:"system",label:"System",icon:"monitor"}]})})})}function Z4(e){const i=e?.prerequisites??[],a=(e?.sandboxPrerequisites??[]).filter(r=>!r.ok&&!i.some(l=>l.name===r.name));return[...i.map(r=>({entry:r,sandbox:!1})),...a.map(r=>({entry:r,sandbox:!0}))]}const X4={stopped:"Stopped",starting:"Starting",connecting:"Connecting",connected:"Online",disconnected:"Reconnecting",stopping:"Stopping"},ic=e=>{try{return new URL(e).host}catch{return e}};function Ww(e){const i=e.error&&e.state==="stopped",a=e.state==="connected"?"success":i?"danger":e.state==="stopped"?"neutral":"warning";return n.jsx(ge,{tone:a,dot:e.state==="connected",children:i?"Stopped (error)":X4[e.state]})}function Jw(e){const i=e.inspection;if(i?.unsupported)return i.unsupported;const a=e.running?e.running.unsandboxed?"unsandboxed":"sandboxed":i?.mode,r=e.running?e.running.sandbox:i?.sandbox,l=e.windows?.sandbox==="wsl2";return a==="sandboxed"?r==="windows"?"Sandboxed (Windows process containers, experimental)":r==="seatbelt"?"Sandboxed (macOS Seatbelt, experimental)":l?"Sandboxed (bubblewrap in WSL2)":"Sandboxed (bubblewrap)":a==="unsandboxed"?`Unsandboxed${l?" in WSL2":""}, after your consent in the app`:"Checking..."}function ej({connection:e,view:i,bridge:a}){return e.mac?n.jsx(Q4,{connection:e,bridge:a}):n.jsx(K4,{connection:e,view:i,bridge:a})}function Q4({connection:e,bridge:i}){const a=je(),r=e.mac,l=i.host.setSandbox;if(!r||!l)return null;const u=e.state==="stopped",d=h=>{!u||a.busy||h===r.sandbox||a.run(()=>rn(l(e.id,{sandbox:h})))};return n.jsx(xe,{label:"Sandbox",hint:r.sandbox==="seatbelt"?"Sessions run in macOS's own Seatbelt sandbox, which is experimental (macOS 15 or later with the developer tools: xcode-select --install), or without one, after your consent, while it isn't ready. Each session sees only its own files and reaches the network only through its egress proxy. macOS can't limit a session's memory or processes, so shell commands run only in your own sessions on this host.":"Sessions run directly as you on this Mac, after your consent in the app at each start: approved commands can read and change anything you can. Choose macOS sandbox to isolate them.",children:n.jsxs("div",{className:"stack",children:[n.jsx("fieldset",{className:"stack",disabled:a.busy||!u,children:n.jsx(hs,{label:"Sandbox",value:r.sandbox,onChange:d,options:[{value:"none",label:"None",hint:"Unsandboxed, after your consent"},{value:"seatbelt",label:"macOS sandbox",hint:"Seatbelt (experimental)"}]})}),!u&&n.jsx("span",{className:"small muted",children:"Stop the host to change where its sessions run."}),n.jsx(ye,{...a})]})})}function K4({connection:e,view:i,bridge:a}){const r=je(),l=e.windows,u=a.host.setSandbox;if(!l||!u)return null;const d=e.state==="stopped",h=i.hosts.wsl?.distros??[],p=h.find(y=>y.default&&y.version===2)??h.find(y=>y.version===2),m=l.sandbox==="wsl2"?l.distro:void 0,x=y=>{!d||r.busy||r.run(()=>rn(u(e.id,y)))};return n.jsx(xe,{label:"Sandbox",hint:l.sandbox==="wsl2"?"Sessions run in WSL2's bubblewrap sandbox, with Node.js, Pi's models and the host's pairing inside that distribution, as `pikibun connect` run there does.":"Sessions run in Windows' own sandbox, which is experimental (Windows 11 24H2 or later with the October 2026 update, Git for Windows, busybox-w32 and Microsoft's MXC SDK), or without one, after your consent, while it isn't ready. Pi's models and the host's pairing are your Windows profile's.",children:n.jsxs("div",{className:"stack",children:[n.jsx("fieldset",{className:"stack",disabled:r.busy||!d,children:n.jsx(hs,{label:"Sandbox",value:l.sandbox,onChange:y=>x(y==="native"?{sandbox:"native"}:{sandbox:"wsl2"}),options:[{value:"wsl2",label:"WSL2",hint:"bubblewrap in a WSL2 distribution"},{value:"native",label:"Native Windows",hint:"Windows' own sandbox (experimental)"}]})}),l.sandbox==="wsl2"&&n.jsxs("select",{className:"select","aria-label":"WSL distribution",value:m??"",disabled:r.busy||!d,onChange:y=>x(y.target.value?{sandbox:"wsl2",distro:y.target.value}:{sandbox:"wsl2"}),children:[n.jsx("option",{value:"",children:p?`WSL's default (${p.name})`:"WSL's default"}),h.map(y=>n.jsxs("option",{value:y.name,disabled:y.version!==2,children:[y.name,y.version===2?"":" (WSL 1: no sandbox)"]},y.name)),m&&!h.some(y=>y.name===m)&&n.jsxs("option",{value:m,disabled:!0,children:[m," (not found)"]})]}),!d&&n.jsx("span",{className:"small muted",children:"Stop the host to change where its sessions run."}),n.jsx(ye,{...r})]})})}function W4(){const{bridge:e,view:i,error:a}=_b();return e?i?n.jsxs(n.Fragment,{children:[n.jsx(J4,{view:i,bridge:e}),n.jsx(eR,{view:i,bridge:e}),n.jsx(iR,{view:i,bridge:e}),n.jsx(aR,{view:i,bridge:e})]}):a?n.jsx(we,{variant:"error",title:"App settings unavailable",children:a}):n.jsx($t,{}):n.jsx(xt,{title:"Only in the Pikibun app",children:"Open Pikibun in its desktop app to run sessions on this computer, connect it to several servers, or run Pikibun itself here."})}function J4({view:e,bridge:i}){const a=e.hosts.connections.find(x=>x.id===e.connectionHere),[r,l]=N.useState(e.title==="This Mac"?"My Mac":"My computer"),u=je(),d=ic(e.origin);if(e.local.status.origin===e.origin)return n.jsx(Ae,{title:`${e.title} and ${d}`,children:n.jsx(W,{title:"Pikibun runs on this computer",hint:`It becomes its own host once you have signed in: no pairing needed. Sessions: ${e.local.status.host}.`})});const h=a?.inspection?.pairedServer===e.origin,p=a?.inspection&&!h&&(a.inspection.pairedServer||a.inspection.pairingError);function m(x){x.preventDefault(),u.run(async()=>{const{pairing:y}=await ce("/api/connectors/pairings",{method:"POST",body:{name:r.trim()}});await rn(i.host.pairHere({id:y.id,code:y.code},!!p))},`${e.title} is pairing with ${d}. It appears under Hosts once it is online.`)}return n.jsx(Ae,{title:`${e.title} and ${d}`,info:`${e.title} runs sessions for this server as one of your hosts, as \`pikibun connect\` does. Its other servers are below.`,children:a&&h?n.jsxs(n.Fragment,{children:[n.jsx(W,{title:`${e.title} is a host of ${d}`,hint:Jw(a),trailing:Ww(a)}),n.jsxs(ke,{children:[a.error&&n.jsx(we,{variant:"error",title:"The host stopped",children:a.error}),n.jsx("div",{className:"inline",children:a.state==="stopped"?n.jsx(q,{variant:"default",disabled:u.busy,onClick:()=>{u.run(()=>rn(i.host.start(a.id)))},children:"Start host"}):n.jsx(q,{variant:"outline",disabled:u.busy||a.state==="stopping",onClick:()=>{u.run(()=>rn(i.host.stop(a.id)))},children:"Stop host"})}),n.jsx(ye,{...u})]})]}):n.jsx("form",{onSubmit:m,children:n.jsxs(ke,{children:[n.jsx("span",{className:"small muted",children:p?`${e.title}'s connection to this server is paired elsewhere (${a?.inspection?.pairedServer??"an unreadable pairing"}). Pairing again replaces it; the old host stays in that Pikibun, offline, until you remove it there.`:`Pair ${e.title} with ${d} as your host in one step: no code to copy.${a?"":" The app asks before it adds this server to its list."}`}),a&&n.jsx(ej,{connection:a,view:e,bridge:i}),n.jsx(xe,{label:"Host name",children:n.jsx("input",{className:"input",required:!0,maxLength:120,autoComplete:"off",value:r,onChange:x=>l(x.target.value)})}),n.jsx("div",{className:"inline",children:n.jsx(q,{type:"submit",variant:"default",disabled:u.busy||!r.trim(),children:u.busy?"Pairing...":`Pair ${e.title}`})}),n.jsx(ye,{...u})]})})})}function eR({view:e,bridge:i}){const[a,r]=N.useState(""),l=je();function u(d){d.preventDefault(),l.run(async()=>{await rn(i.host.add(a)),r("")},`Added. Pair it from that server's Settings, or in the app's ${e.title} window.`)}return n.jsxs(Ae,{title:"Servers",info:`${e.title} can run sessions for several Pikibun servers at once, each with its own pairing and host, as one \`pikibun connect\` per server would. The primary server is the one the Pikibun window opens.`,children:[e.hosts.connections.map(d=>n.jsx(tR,{connection:d,view:e,bridge:i},d.id)),n.jsx("form",{onSubmit:u,children:n.jsxs(ke,{children:[n.jsx(xe,{label:"Add a server",hint:"HTTPS; plain HTTP only for localhost and 127.0.0.1.",children:n.jsx("input",{className:"input",type:"url",required:!0,autoComplete:"off",spellCheck:!1,placeholder:"https://pikibun.example.com",value:a,onChange:d=>r(d.target.value)})}),n.jsx("div",{className:"inline",children:n.jsx(q,{type:"submit",variant:"outline",icon:"plus",disabled:l.busy||!a.trim(),children:"Add server"})}),n.jsx(ye,{...l})]})})]})}function tR({connection:e,view:i,bridge:a}){const r=je(),l=e.inspection,u=l?.models??[],d=v=>`${v.provider}/${v.modelId}`,[h,p]=N.useState(null),m=h??new Set(e.models?e.models.map(d):u.map(d)),x=e.server===i.origin,y=(v,b)=>{r.run(async()=>{await rn(v())},b)};return n.jsx(ns,{title:n.jsxs(n.Fragment,{children:[ic(e.server),e.primary&&n.jsx("span",{className:"muted",children:" · primary"}),x&&n.jsx("span",{className:"muted",children:" · this server"})]}),hint:l?l.pairedServer?`Paired · ${Jw(e)}`:l.pairingError??"Not paired yet":e.server,trailing:Ww(e),children:n.jsxs("div",{className:"stack",children:[e.error&&n.jsx(we,{variant:"error",title:"The host stopped",children:e.error}),n.jsx(xe,{label:"Server",children:n.jsx("span",{children:e.server})}),l?.stateDir&&n.jsx(xe,{label:"State directory",children:n.jsx("span",{className:"small",children:l.stateDir})}),n.jsx(ej,{connection:e,view:i,bridge:a}),n.jsx(xe,{label:"The same connection in a terminal",children:n.jsx(Yn,{value:e.command,label:"Copy command"})}),n.jsxs("div",{className:"inline",children:[e.state==="stopped"?n.jsx(q,{variant:"default",size:"sm",disabled:r.busy||!l?.pairedServer,onClick:()=>y(()=>a.host.start(e.id)),children:"Start host"}):n.jsx(q,{variant:"outline",size:"sm",disabled:r.busy||e.state==="stopping",onClick:()=>y(()=>a.host.stop(e.id)),children:"Stop host"}),!x&&n.jsx(q,{variant:"outline",size:"sm",icon:"external",onClick:()=>y(()=>a.host.open(e.id)),children:"Open"}),n.jsx(q,{variant:"ghost",size:"sm",icon:"refresh",disabled:e.inspecting,onClick:()=>y(()=>a.host.refresh(e.id)),children:"Refresh"}),!e.primary&&n.jsx(q,{variant:"ghost",size:"sm",icon:"trash",disabled:r.busy,onClick:()=>y(()=>a.host.remove(e.id)),children:"Remove"})]}),!l?.pairedServer&&!x&&n.jsxs("span",{className:"small muted",children:["Pair it from ",ic(e.server),"'s own Settings › ",i.title," (Open, then Settings), or with a pairing code in the app's ",i.title," window."]}),u.length>0&&n.jsx(xe,{label:"Models offered",hint:e.models?"Only the checked models; a change applies from the host's next start.":"Pi chooses: its enabledModels setting, or every model with configured authentication. Uncheck some to offer only the rest.",children:n.jsxs("div",{className:"stack",children:[u.map(v=>n.jsxs("label",{className:"check-row",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:m.has(d(v)),disabled:r.busy,onChange:b=>{const w=new Set(m);b.target.checked?w.add(d(v)):w.delete(d(v)),p(w)}}),n.jsxs("span",{children:[v.name," ",n.jsx("span",{className:"small muted",children:d(v)})]})]},d(v))),n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"outline",size:"sm",disabled:r.busy||!h,onClick:()=>y(async()=>{await rn(a.host.setModels(e.id,u.filter(v=>m.has(d(v))).map(v=>({provider:v.provider,modelId:v.modelId})))),p(null)},"Saved: the host offers these from its next start."),children:"Offer checked models"}),e.models&&n.jsx(q,{variant:"ghost",size:"sm",disabled:r.busy,onClick:()=>y(async()=>{await rn(a.host.setModels(e.id,null)),p(null)}),children:"Let Pi choose"})]})]})}),n.jsx(nR,{connection:e,view:i,bridge:a}),e.logs.length>0&&n.jsx(ns,{plain:!0,title:"Recent activity",children:n.jsx("ol",{className:"small mono desktop-logs",children:e.logs.slice(-30).reverse().map((v,b)=>n.jsxs("li",{className:v.level==="error"?"danger":v.level==="warning"?"muted":void 0,children:[new Date(v.time).toLocaleTimeString()," ",v.message]},b))})}),n.jsx(ye,{...r})]})})}function nR({connection:e,view:i,bridge:a}){const r=e.inspection;if(!r)return null;const l=Z4(r).map(h=>h.entry).filter(h=>!h.ok),u=[...new Map(l.flatMap(h=>h.fix?[[JSON.stringify(h.fix),h.fix]]:[])).values()];r.unsupportedFix&&u.unshift(r.unsupportedFix);const d=!r.unsupported&&!r.models.length&&r.modelsError;return!l.length&&!r.prerequisitesError&&!r.unsupportedFix&&!d?null:n.jsx(we,{variant:"warning",title:`Set up ${i.title==="This Mac"?"this Mac":"this computer"} to host`,children:n.jsxs("div",{className:"stack",children:[r.prerequisitesError&&n.jsx("span",{children:r.prerequisitesError}),u.map(h=>n.jsxs("span",{children:[h.text,h.command&&n.jsxs(n.Fragment,{children:[" ",n.jsx("code",{children:h.command})]})]},h.text)),d&&n.jsxs("span",{children:[r.modelsError," Sign Pi in to your provider in the ",i.title," window: no separate Pi install is needed."]}),n.jsx("div",{className:"inline",children:n.jsx(q,{size:"sm",variant:"outline",onClick:()=>{a.openWindow("host")},children:u.some(h=>h.action)||d?`Set up in ${i.title}…`:`Open ${i.title}…`})})]})})}const sR={origin:"",listen:"loopback",trustProxy:!0,signup:"invite",passwordAuth:!0,admins:[]};function iR({view:e,bridge:i}){const{status:a,inspection:r,error:l,notice:u}=e.local,d=a.state!=="stopped",[h,p]=N.useState(e.local.mode),[m,x]=N.useState(r?.shared??sR),[y,v]=N.useState((r?.shared?.admins??[]).join(`
|
|
56
|
+
`)),[b,w]=N.useState(!!r),S=je();N.useEffect(()=>{b||!r||(w(!0),r.shared&&(x(r.shared),v(r.shared.admins.join(`
|
|
57
|
+
`))))},[b,r]);const C=d&&a.mode?a.mode:h,k=a.state==="running"?a.mode==="shared"?"Shared":"Running":a.state==="stopped"?"Off":a.state==="starting"?"Starting":"Stopping",O=C==="local"?!r?.githubClientId:!r?.shared?.githubClientId&&!m.passwordAuth;function T(_){_.preventDefault(),S.run(()=>rn(i.local.start(C==="local"?{mode:"local"}:{mode:"shared",shared:{origin:m.origin.trim().replace(/\/+$/,""),listen:m.listen,trustProxy:m.trustProxy,signup:m.signup,passwordAuth:m.passwordAuth,admins:y.split(/[\n,]/).map($=>$.trim()).filter(Boolean)}})))}const M=_=>x($=>({...$,..._}));return n.jsx(Ae,{title:"Pikibun on this computer",info:"Pikibun itself, run by the app as `pikibun serve` does and from the same data: just for you on this computer, or shared with others at a public HTTPS address, as `pikibun serve --share`.",action:n.jsx(ge,{tone:a.state==="running"?"success":"neutral",dot:a.state==="running",children:k}),children:n.jsx("form",{onSubmit:T,children:n.jsxs(ke,{children:[n.jsx(hs,{label:"Who uses it",value:C,onChange:_=>{d||p(_)},options:[{value:"local",label:"Just for me",icon:"user"},{value:"shared",label:"Share with others",icon:"users"}]}),d&&n.jsxs(n.Fragment,{children:[n.jsx(xe,{label:"Address",children:n.jsx("span",{children:a.origin})}),a.address&&n.jsx(xe,{label:"Listens on",hint:a.mode==="shared"?"Your TLS proxy or tunnel forwards the public address here.":void 0,children:n.jsx("span",{children:a.address})}),n.jsx(xe,{label:"Sessions",children:n.jsx("span",{children:a.host==="connected"?"Run on this computer":a.host==="waiting"?"On this computer, once you have signed in":a.host==="off"?"Not on this computer":a.host})})]}),C==="local"&&!d&&n.jsxs("span",{className:"small muted",children:["Only this computer can reach it, and only your GitHub account can sign in, through a GitHub OAuth app of your own whose callback is ",n.jsx("code",{children:"http://127.0.0.1/api/auth/github/callback"}),". ",r?.githubClientId?`Saved: client ID ${r.githubClientId}.`:""]}),C==="shared"&&n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"small muted",children:["A full Pikibun server for your team: people sign in, create workspaces and pair their own hosts. It serves plain HTTP on this computer; people reach it at a public HTTPS address through a TLS proxy or tunnel you run (",n.jsx("code",{children:"tailscale serve"}),", Cloudflare Tunnel, Caddy)."]}),n.jsxs("fieldset",{className:"stack",disabled:d,children:[n.jsx(xe,{label:"Public address",children:n.jsx("input",{className:"input",type:"url",required:!0,spellCheck:!1,placeholder:"https://pikibun.example.com",value:m.origin,onChange:_=>M({origin:_.target.value})})}),n.jsx(xe,{label:"Listen on",children:n.jsxs("select",{className:"select",value:m.listen,onChange:_=>M({listen:_.target.value==="all"?"all":"loopback"}),children:[n.jsx("option",{value:"loopback",children:"This computer only: the proxy or tunnel runs here"}),n.jsx("option",{value:"all",children:"Every network interface: the proxy runs on another machine"})]})}),n.jsxs("label",{className:"check-row",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:m.trustProxy,onChange:_=>M({trustProxy:_.target.checked})}),n.jsx("span",{children:"Trust the proxy's X-Forwarded-Proto and X-Forwarded-Host"})]}),n.jsx(xe,{label:"Who may create an account",children:n.jsxs("select",{className:"select",value:m.signup,onChange:_=>M({signup:_.target.value==="open"?"open":_.target.value==="off"?"off":"invite"}),children:[n.jsx("option",{value:"invite",children:"Only people with a workspace's invite link"}),n.jsx("option",{value:"open",children:"Anyone who reaches it"}),n.jsx("option",{value:"off",children:"Nobody new: only the administrators"})]})}),n.jsxs("label",{className:"check-row",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:m.passwordAuth,onChange:_=>M({passwordAuth:_.target.checked})}),n.jsx("span",{children:"Usernames and passwords, besides GitHub or instead of it"})]}),n.jsx(xe,{label:"Administrators",hint:"One per line: a GitHub login (the app looks up its user ID), github:12345 or password:alice. The first with an account owns this computer's host.",children:n.jsx("textarea",{className:"textarea mono",rows:3,spellCheck:!1,value:y,onChange:_=>v(_.target.value),placeholder:`octocat
|
|
58
|
+
password:admin`})}),n.jsxs("span",{className:"small muted",children:["GitHub sign-in: ",r?.shared?.githubClientId?`saved OAuth app ${r.shared.githubClientId}`:"no OAuth app yet",". Its callback is ",n.jsxs("code",{children:[m.origin.trim().replace(/\/+$/,"")||"https://…","/api/auth/github/callback"]}),"."]})]})]}),O&&!d&&n.jsx(we,{variant:"info",title:C==="local"?"Add your GitHub OAuth app first":"Add a GitHub OAuth app, or turn on usernames and passwords",actions:n.jsx(q,{size:"sm",variant:"outline",onClick:()=>{i.openWindow("settings")},children:"Open app Settings"}),children:"Secrets are entered only in the app's own Settings window, never in a web page."}),a.state==="running"&&a.mode==="shared"&&r?.shared?.passwordAuth&&n.jsx("span",{className:"small muted",children:"Create a listed password administrator's account in the app's own Settings window, where its password stays out of web pages."}),l&&n.jsx(we,{variant:"error",title:"Pikibun on this computer",children:l}),u&&n.jsx(we,{variant:"success",title:"Done",children:u}),n.jsxs("div",{className:"inline",children:[d?n.jsx(q,{variant:"outline",disabled:S.busy||a.state==="stopping",onClick:()=>{S.run(()=>rn(i.local.stop()))},children:"Stop"}):n.jsx(q,{type:"submit",variant:"default",disabled:S.busy||O,children:C==="shared"?"Share from this computer":"Run on this computer"}),n.jsx(q,{variant:"ghost",onClick:()=>{i.openWindow("settings")},children:"App Settings…"})]}),n.jsx(ye,{...S})]})})})}function aR({view:e,bridge:i}){const[a,r]=N.useState(e.primaryServer),l=je(),u=je();function d(h){h.preventDefault(),l.run(()=>rn(i.setServer(a)),"Saved. The Pikibun window opens this server.")}return n.jsxs(Ae,{title:"App",children:[n.jsx("form",{onSubmit:d,children:n.jsxs(ke,{children:[n.jsx(xe,{label:"Primary server",hint:"The Pikibun window opens it, and this computer's primary host pairs with it. It keeps the command line's connector state, so a pairing made with `pikibun connect` carries over.",children:n.jsx("input",{className:"input",type:"url",required:!0,spellCheck:!1,value:a,onChange:h=>r(h.target.value)})}),n.jsxs("div",{className:"inline",children:[n.jsx(q,{type:"submit",variant:"outline",disabled:l.busy||a.trim()===e.primaryServer,children:"Save"}),e.primaryServer!==e.defaultServer&&n.jsxs(q,{variant:"ghost",disabled:l.busy,onClick:()=>{r(e.defaultServer),l.run(()=>rn(i.setServer(e.defaultServer)))},children:["Use ",ic(e.defaultServer)]})]}),n.jsx(ye,{...l})]})}),e.hosts.openAtLogin!==void 0&&n.jsx(W,{title:"Open Pikibun at login",hint:"Hosts left running when Pikibun quits start again when it opens.",trailing:n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Open Pikibun at login",checked:e.hosts.openAtLogin,disabled:u.busy,onChange:h=>{const p=h.target.checked;u.run(()=>rn(i.setOpenAtLogin(p)))}})}),u.error&&n.jsx(ke,{children:n.jsx(ye,{...u})}),e.version&&n.jsx(W,{title:e.update?`Pikibun ${e.update.version} is available`:"Version",hint:e.update?`You have ${e.version}. Download the new version from its GitHub release page and install it over this one.`:`Pikibun ${e.version}`,trailing:e.update&&i.openUpdate?n.jsx(q,{variant:"default",onClick:()=>{i.openUpdate?.()},children:"Update"}):void 0}),n.jsx(W,{title:`${e.title} window`,hint:"Prerequisites, activity, and pairing with a code for any server",onClick:()=>{i.openWindow("host")},chevron:!0}),n.jsx(W,{title:"App Settings window",hint:"GitHub OAuth apps' secrets and password administrators, and settings while no server answers",onClick:()=>{i.openWindow("settings")},chevron:!0})]})}const qh={approve:{label:"Approve host commands",hint:"Decides each host command in sessions they can approve"},auto:{label:"Auto-approve host commands",hint:"Also runs the host commands of their own Auto-approve messages without asking"}},lb=[{value:"never",label:"No expiry",days:0},{value:"1",label:"1 day",days:1},{value:"7",label:"7 days",days:7},{value:"30",label:"30 days",days:30}],Ii="*";function tj(e){return $e(e?`/api/workspaces/${oe(e)}/members`:null)}function rR({connector:e,refresh:i}){const{user:a,workspaces:r}=pt(),l=je(),u=e.role==="owner",d=e.admins??[],h=r.filter(O=>(e.connectedWorkspaceIds??e.workspaceIds).includes(O.id)),[p,m]=N.useState(""),x=h.find(O=>O.id===p)??h[0],y=tj(u?x?.id:void 0),v=(y.data?.members??[]).filter(O=>O.userId!==e.ownerId&&!d.some(T=>T.userId===O.userId)),[b,w]=N.useState(""),S=v.find(O=>O.userId===b)??v[0];function C(){S&&(async()=>await He({title:`Make ${Mt(Bs(S))} an admin?`,message:`They will manage ${e.name}'s sharing: share it with workspaces you both belong to, and grant members host commands there, including themselves. Host commands run on your machine with your files, credentials and network. They will also choose which of its models it offers, to everyone including you. Only you can add admins, revoke or remove the host.`,confirmLabel:"Add admin",destructive:!0})&&await l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/admins/${oe(S.userId)}`,{method:"PUT",body:{}}),i()},"Admin added."))()}function k(O){const T=O===a.id;(async()=>await He({title:T?"Stop managing this host?":"Remove this admin?",message:T?"You will no longer manage its sharing. Grants already given stay until someone removes them.":"They will no longer manage its sharing. Grants they gave stay until someone removes them.",confirmLabel:T?"Step down":"Remove admin"})&&await l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/admins/${oe(O)}`,{method:"DELETE"}),i()},T?"You no longer manage this host.":"Admin removed."))()}return n.jsxs(Ae,{title:"Admins",bare:!0,info:"Admins manage this host's sharing for you: its workspace shares and host command grants, and which of its models it offers. They hold no host command access of their own unless a grant gives it to them, and only the owner can add admins, revoke or remove the host.",children:[n.jsxs("div",{className:"card",children:[!d.length&&n.jsx(W,{title:"No admins",hint:u?"Only you manage this host":void 0}),d.map(O=>n.jsx(W,{title:O.name||O.userId,hint:n.jsxs(n.Fragment,{children:["Admin since ",n.jsx(Qt,{value:O.createdAt})]}),trailing:(u||O.userId===a.id)&&n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>k(O.userId),children:O.userId===a.id?"Step down":"Remove"})},O.userId)),u&&!e.revokedAt&&(h.length?n.jsx(W,{title:"Add admin",hint:y.loading?"Loading members...":v.length?"A member of a workspace this host is connected to":`No other members in ${x?.name??"this workspace"}`,trailing:n.jsxs(n.Fragment,{children:[h.length>1&&n.jsx(Xt,{label:"Workspace",value:x?.id??"",options:h.map(O=>({value:O.id,label:O.name})),onChange:O=>{m(O),w("")},disabled:l.busy}),v.length>0&&n.jsx(Xt,{label:"Member",value:S?.userId??"",options:v.map(O=>({value:O.userId,label:Mt(Bs(O))})),onChange:w,disabled:l.busy}),n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy||!S,onClick:C,children:"Add"})]})}):n.jsx(W,{title:"Add admin",hint:"Connect the host to a workspace first"}))]}),n.jsx(ye,{error:l.error,notice:l.notice})]})}function oR(e){return n.jsxs(n.Fragment,{children:[qh[e.level].hint,e.hostSessions?" · may start sessions on the host":"",e.expiresAt?n.jsxs(n.Fragment,{children:[" · expires ",n.jsx(Qt,{value:e.expiresAt})]}):" · no expiry"]})}function lR({connector:e,refresh:i}){const{workspaces:a}=pt(),r=je(),l=e.role==="owner",u=e.hostGrants??[],d=new Map(a.map(B=>[B.id,B.name])),h=a.filter(B=>e.workspaceIds.includes(B.id)),[p,m]=N.useState(""),x=h.find(B=>B.id===p)??h[0],y=tj(x?.id),v=(y.data?.members??[]).filter(B=>B.userId!==e.ownerId&&B.role!=="viewer"),[b,w]=N.useState(Ii),[S,C]=N.useState("approve"),k=e.config?.hostSessions===!0&&!e.capabilities.unsandboxed,O=!e.capabilities.productionShell&&!e.capabilities.unsandboxed,T=O&&e.capabilities.unboundedShellGrants===!0,M=l&&u.some(B=>B.hostSessions)&&e.capabilities.hostGrants&&!e.capabilities.hostSessionGrants,[_,$]=N.useState("7"),G=v.find(B=>B.userId===b),J=G?Mt(Bs(G)):`every member of ${x?.name??"the workspace"}`,U=u.find(B=>B.workspaceId===x?.id&&(B.userId??Ii)===(G?.userId??Ii)),E=`${x?.id??""}:${G?.userId??Ii}`,[I,Q]=N.useState(null),ie=I?.key===E?I.value:U?.hostSessions===!0,re=B=>Q({key:E,value:B});function Y(){x&&(async()=>{const B=S==="auto",se=l&&ie,de=l&&!ie&&U?.hostSessions===!0;if(!await He({title:se?"Grant sessions on the host?":B?"Grant automatic host commands?":"Grant host command approval?",message:(B?`${J} will be able to run host_bash on ${e.name} OUTSIDE the sandbox without anyone approving each command, whenever they send a message with Auto-approve. Commands run on the owner's machine as its user, with its files, credentials and network, and no resource limits.`:`${J} will be able to approve host_bash commands on ${e.name}, which run OUTSIDE the sandbox on the owner's machine with its files, credentials and network.`)+(se?` They will also be able to start their own sessions directly on ${e.name}, without the sandbox: every command of those sessions runs as its user${B?", without asking under their Auto-approve":", once approved"}, and their clones use its Git and credentials.`:"")+(T?` As ${e.name} has no resource limits for commands, the shell commands of their own sandboxed sessions will run there without them too${B?", without asking under their Auto-approve":", each once approved like a host command"}.`:"")+(de?` This replaces their current grant, which includes sessions on the host: they will no longer start sessions directly on ${e.name}, and the next command of any they have there will stop.`:""),confirmLabel:"Grant",destructive:B||se}))return;const R=lb.find(D=>D.value===_).days;await r.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/host-grants/${oe(x.id)}`,{method:"PUT",body:{...G?{userId:G.userId}:{},level:S,...l?{hostSessions:ie}:{},...R?{expiresAt:new Date(Date.now()+R*864e5).toISOString()}:{}}}),Q(null),i()},"Host command access granted.")})()}function F(B){r.run(async()=>{const se=B.userId?`?userId=${encodeURIComponent(B.userId)}`:"";await ce(`/api/connectors/${oe(e.id)}/host-grants/${oe(B.workspaceId)}${se}`,{method:"DELETE"}),i()},"Host command access removed.")}return n.jsxs(Ae,{title:"Host command access",bare:!0,info:"host_bash runs OUTSIDE the sandbox, on this machine as its user. By default only the owner decides those commands. Grant members of a shared workspace the right to approve them, or to run their own without asking under Auto-approve. The owner may also let them start their own sessions directly on the host, without the sandbox. On a host without resource limits, a grant also lets the member's own sandboxed sessions run shell commands without them, decided like host commands. Grants end when they expire, when you remove them, or when the host stops being shared there.",children:[n.jsxs("div",{className:"card",children:[!u.length&&n.jsx(W,{title:"Only the owner",hint:"No one else decides host commands on this host"}),u.map(B=>n.jsx(W,{title:n.jsxs(n.Fragment,{children:[B.userId?B.userName??B.userId:"All members"," ",n.jsxs("span",{className:"muted",children:["· ",d.get(B.workspaceId)??B.workspaceId]})]}),hint:oR(B),trailing:n.jsxs(n.Fragment,{children:[n.jsx(ge,{tone:B.level==="auto"?"warning":"neutral",children:B.level==="auto"?"Auto-approve":"Approve"}),B.hostSessions&&n.jsx(ge,{tone:"danger",children:"Sessions on host"}),n.jsx(q,{variant:"outline",size:"sm",disabled:r.busy,onClick:()=>F(B),children:"Remove"})]})},`${B.workspaceId}:${B.userId??""}`)),!e.revokedAt&&(h.length?n.jsx(W,{title:"Grant access",hint:y.loading?"Loading members...":qh[S].hint,trailing:n.jsxs(n.Fragment,{children:[h.length>1&&n.jsx(Xt,{label:"Workspace",value:x?.id??"",options:h.map(B=>({value:B.id,label:B.name})),onChange:B=>{m(B),w(Ii)},disabled:r.busy}),n.jsx(Xt,{label:"Member",value:G?G.userId:Ii,options:[{value:Ii,label:"All members"},...v.map(B=>({value:B.userId,label:Mt(Bs(B))}))],onChange:w,disabled:r.busy}),n.jsx(Xt,{label:"Access",value:S,options:["approve","auto"].map(B=>({value:B,label:qh[B].label})),onChange:C,disabled:r.busy}),l&&!e.capabilities.unsandboxed&&n.jsxs("label",{className:"check-row small",title:k?"Their own sessions may run directly on this machine, without the sandbox, as its user":"Turn on Sessions on the host under Configuration for this to apply",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:ie,disabled:r.busy,onChange:B=>re(B.target.checked)}),n.jsx("span",{children:"Sessions on the host"})]}),n.jsx(Xt,{label:"Expires",value:_,options:lb.map(B=>({value:B.value,label:B.label})),onChange:$,disabled:r.busy}),n.jsx(q,{variant:"outline",size:"sm",disabled:r.busy||!x,onClick:Y,children:"Grant"})]})}):n.jsx(W,{title:"Grant access",hint:"Share the host with a workspace first"}))]}),l&&u.some(B=>B.hostSessions)&&!k&&n.jsx(W,{title:"Sessions on the host are off",hint:"Grants that include sessions on the host apply only while Configuration → Sessions on the host is on."}),M&&n.jsx(W,{title:"Update the host's connector",hint:"This host's connector runs only your own sessions on the host: until it is updated (npx pikibun@latest connect), members you granted that get the sandbox."}),!M&&u.length>0&&O&&e.capabilities.hostGrants&&!e.capabilities.unboundedShellGrants&&n.jsx(W,{title:"Update the host's connector",hint:"This host has no resource limits, and its connector refuses every command of other members' sandboxed sessions: until it is updated (npx pikibun@latest connect), the members you granted host commands can't run commands, or clone, in their own."}),!e.capabilities.hostGrants&&n.jsx(W,{title:"Update the host's connector",hint:"This host's connector predates grants: until it is updated (npx pikibun@latest connect), only the owner decides its host commands."}),n.jsx(ye,{error:r.error,notice:r.notice})]})}const nj=["reserveTokens","keepRecentTokens"],cR={reserveTokens:"",keepRecentTokens:""},cb=e=>({reserveTokens:e?.reserveTokens?.toString()??"",keepRecentTokens:e?.keepRecentTokens?.toString()??""});function uh(e){return{overall:cb(e),models:Object.fromEntries(Object.entries(e.modelOverrides??{}).map(([i,a])=>[i,cb(a)]))}}function sj(e){const i=e.trim().replace(/[,_\s]/g,"");if(!i)return null;if(!/^\d{1,9}$/.test(i))return;const a=Number(i);return a<=zf.compactionTokens.max?a:void 0}function ub(e){const i={};for(const a of nj){const r=sj(e[a]);if(r===void 0)return;r!==null&&(i[a]=r)}return i}function uR(e){const i=ub(e.overall);if(!i)return;const a={};for(const r of Object.keys(e.models).sort()){const l=ub(e.models[r]);if(!l)return;Object.keys(l).length&&(a[r]=l)}return Object.keys(a).length?{...i,modelOverrides:a}:i}const dh=(e,i)=>e<i?-1:e>i?1:0,dR=n.jsxs("div",{className:"stack",children:[n.jsxs("p",{children:["Pi summarizes a long conversation once it comes within ",n.jsx("em",{children:"reserve"})," tokens of the model's context window, and keeps the most recent ",n.jsx("em",{children:"keep recent"})," tokens word for word. The summary may use up to 80% of the reserve, thinking included."]}),n.jsx("p",{children:"Counts set here replace those of Pi's settings.json on the host (compaction.reserveTokens, compaction.keepRecentTokens and compaction.modelOverrides); an empty one keeps the host's setting, or the default. A model's own count wins over the one for all models, here or in the host's settings."}),n.jsx("p",{children:"By default a reasoning model reserves a tenth of its context window, from 16K to 64K tokens. If messages fail because Pi's summary hit its token limit, raise the reserve for that model."}),n.jsx("p",{children:"Sessions on the host pick up a change within a minute, from the next message they send after it."})]});function db({value:e,onChange:i,disabled:a,label:r}){return n.jsx("span",{className:"token-inputs",children:nj.map(l=>{const u=l==="reserveTokens"?"Reserve":"Keep recent";return n.jsxs("label",{className:"token-field",children:[n.jsx("span",{className:"small muted",children:u}),n.jsx("input",{className:"input token-input",inputMode:"numeric",autoComplete:"off",spellCheck:!1,placeholder:"Host's Pi",value:e[l],disabled:a,"aria-label":`${u} tokens, ${r}`,"aria-invalid":sj(e[l])===void 0||void 0,onChange:d=>i({...e,[l]:d.target.value})})]},l)})})}function hR({connector:e,refresh:i}){const a=e.config?.compaction??{},r=JSON.stringify(a),[l,u]=N.useState(()=>uh(a)),d=N.useRef(r),h=je();N.useEffect(()=>{d.current!==r&&(d.current=r,u(uh(JSON.parse(r))))},[r]);const p=!!e.role&&!e.revokedAt&&!h.busy,m=uR(l),x=m===void 0||JSON.stringify(m)!==r,y=[...e.models,...e.disabledModels??[]].sort((k,O)=>dh(k.provider,O.provider)||dh(k.modelId,O.modelId)),v=new Set(y.map(k=>`${k.provider}/${k.modelId}`)),b=Object.keys(l.models).filter(k=>!v.has(k)).sort(dh),w=Object.keys(m?.modelOverrides??{}).length;function S(){m&&h.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/config`,{method:"PATCH",body:{compaction:m}}),i()},"Compaction saved. Sessions on the host pick it up within a minute.")}const C=k=>{const O=typeof k=="string"?k:`${k.provider}/${k.modelId}`;return n.jsx(W,{title:typeof k=="string"?k:k.name,hint:typeof k=="string"?"Not offered by this host now":`${k.provider} / ${k.modelId}`,trailing:n.jsx(db,{label:O,value:l.models[O]??cR,disabled:!p,onChange:T=>u(M=>({...M,models:{...M.models,[O]:T}}))})},typeof k=="string"?k:Fi(k))};return n.jsx(Ae,{title:"Compaction",bare:!0,info:dR,children:n.jsxs("div",{className:"card",children:[n.jsx(W,{title:"All models",hint:"Tokens kept free for compaction, and recent tokens kept unsummarized. Empty keeps the host's Pi setting",trailing:n.jsx(db,{label:"all models",value:l.overall,disabled:!p,onChange:k=>u(O=>({...O,overall:k}))})}),y.length+b.length>0&&n.jsxs(ns,{title:"Per model",hint:w?`${w} ${w===1?"model has its":"models have their"} own counts`:"Counts for one model, over those for all models",children:[y.map(C),b.map(C)]}),e.capabilities.hostConfig&&!e.capabilities.compactionConfig&&n.jsx(W,{title:"Update the host's connector",hint:"This host's connector predates compaction settings in Pikibun and follows its Pi settings alone until it is updated (npx pikibun@latest connect). What you save here applies then."}),(x||h.error||h.notice)&&n.jsx(ke,{children:n.jsxs("div",{className:"stack",children:[n.jsx(ye,{...h}),!m&&n.jsxs("span",{className:"small muted",children:["Token counts are whole numbers from 0 to ",zf.compactionTokens.max.toLocaleString(),"."]}),x&&n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"default",size:"sm",disabled:h.busy||!m,onClick:S,children:"Save compaction"}),n.jsx(q,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u(uh(a)),children:"Discard"})]})]})})]})})}const fR=[30,60,120,300,600,1800,3600];function mR(e){return e%3600===0?e===3600?"1 hour":`${e/3600} hours`:e%60===0?e===60?"1 minute":`${e/60} minutes`:`${e} seconds`}const hb=Object.keys(Uh).filter(e=>e!=="compaction"&&e!=="builtinExtensions"),fb={off:"Off",host:"Shared",owner:"Per owner"},mb={off:"Each session downloads its clones itself",host:"One mirror of each repository, which every session's clones borrow from",owner:"A separate mirror of each repository for each session owner"},pR=n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"How this host runs sessions. Its owner and admins change the command time limit and the GPU; only its owner decides whether it uses its Git credentials, keeps a repository cache or runs their sessions without the sandbox."}),n.jsx("p",{children:"Running sessions pick up a change within a minute. A repository cache change applies when the host's connector next connects."}),n.jsx("p",{children:"A longer time limit also lifts the per-process limits of short commands (25 seconds of CPU, 64 MiB files, 256 open files) so builds fit. Without provisioned resource limits on the host (connect --resources), a command can use the whole machine for that long."})]});function gR({connector:e,refresh:i}){const a=e.role!=="admin",r=e.config??Uh,[l,u]=N.useState(r),d=N.useRef(r),h=je();N.useEffect(()=>{const C=d.current;d.current=r;const k=hb.filter(O=>r[O]!==C[O]);k.length&&u(O=>({...O,...Object.fromEntries(k.map(T=>[T,r[T]]))}))},[r.commandTimeoutSeconds,r.gpu,r.gitCredentials,r.repositoryCache,r.hostSessions]);const p=hb.filter(C=>l[C]!==r[C]&&(a||!yO.includes(C))),m=p.length>0,x=!e.revokedAt&&!h.busy,{unsandboxed:y,gpu:v}=e.capabilities,b=[...new Set([...fR,r.commandTimeoutSeconds])].sort((C,k)=>C-k);function w(){(async()=>l.gitCredentials&&!r.gitCredentials&&!await He({title:"Use this host's Git credentials?",message:`Pushes in your own sessions on ${e.name} will use the credentials Git on that machine would use (its credential helpers), wherever a workspace's push access chooses the host's Git credentials. Other members' sessions never use them.`,confirmLabel:"Turn on",destructive:!0})||l.repositoryCache!=="off"&&r.repositoryCache==="off"&&!await He({title:"Keep a repository cache on this host?",message:`${e.name} will keep a full mirror of each repository its sessions clone, in its state directory, and their clones will borrow objects from it. It fills the mirrors straight from the repositories' hosts with the credentials Git on that machine would use (its credential helpers), and a session borrows from one only once Pikibun confirms that the session's owner can read the repository with their own account.`,confirmLabel:"Keep a cache"})||l.hostSessions&&!r.hostSessions&&!await He({title:"Let your sessions run directly on this host?",message:`When you start a session on ${e.name}, you'll be able to run it without the sandbox. Its commands then run as that machine's user, with its files, credentials, network and GPU, and no resource limits, and only you, or members you granted host commands, decide them. Other members' sessions stay in the sandbox, and so do yours unless you choose otherwise when you start one.`,confirmLabel:"Allow",destructive:!0})||l.gpu&&!r.gpu&&!await He({title:"Lend this host's GPU to sandboxed commands?",message:`Shell commands in every session on ${e.name} will be able to use its GPU for rendering and compute. They get its render device only, never the screen, windows or input, but its driver is more of the kernel exposed to them, and they share the GPU with everything else on the machine.`,confirmLabel:"Lend GPU",destructive:!0})||await h.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/config`,{method:"PATCH",body:Object.fromEntries(p.map(C=>[C,l[C]]))}),i()},"Configuration saved. Running sessions pick it up within a minute."))()}const S=y?"Commands on an unsandboxed host already run on the machine itself":v?`${v==="dxg"?"WSL GPU (/dev/dxg)":"Linux render nodes (/dev/dri)"}: rendering and compute, never the screen, windows or input`:"No GPU render device found on this host (WSL's /dev/dxg or Linux render nodes)";return n.jsx(Ae,{title:"Configuration",bare:!0,info:pR,children:n.jsxs("div",{className:"card",children:[n.jsx(W,{title:"Command time limit",hint:y?"How long a shell command may run before it is stopped":"How long a shell command may run in the sandbox before it is stopped",trailing:n.jsx(Xt,{label:"Command time limit",value:String(l.commandTimeoutSeconds),disabled:!x,options:b.map(C=>({value:String(C),label:mR(C),...C===Uh.commandTimeoutSeconds?{hint:"Default"}:{}})),onChange:C=>u({...l,commandTimeoutSeconds:Number(C)})})}),n.jsx(W,{title:"GPU",hint:S,trailing:n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:l.gpu,disabled:!x||!l.gpu&&(!v||y),onChange:C=>u({...l,gpu:C.target.checked})}),n.jsx("span",{children:"Lend to sandboxed commands"})]})}),n.jsx(W,{title:"Git credentials",hint:a?"Pushes in your own sessions may use this machine's Git credential helpers, where a workspace's push access chooses the host's Git credentials":"Only the host's owner changes this",trailing:a?n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:l.gitCredentials,disabled:!x,onChange:C=>u({...l,gitCredentials:C.target.checked})}),n.jsx("span",{children:"Use for my pushes"})]}):n.jsx(ge,{tone:r.gitCredentials?"warning":"neutral",children:r.gitCredentials?"On":"Off"})}),n.jsx(W,{title:"Repository cache",hint:a?`${mb[l.repositoryCache]}. Applies when the host next connects.`:"Only the host's owner changes this",trailing:a&&x?n.jsx(hs,{label:"Repository cache",value:l.repositoryCache,onChange:C=>u({...l,repositoryCache:C}),options:["off","host","owner"].map(C=>({value:C,label:fb[C],hint:mb[C]}))}):n.jsx(ge,{tone:r.repositoryCache==="off"?"neutral":"success",children:fb[r.repositoryCache]})}),n.jsx(W,{title:"Sessions on the host",hint:y?"This host runs every session without the sandbox":a?"You, and members you grant it under Host command access, may start sessions that run directly on this machine, without the sandbox, as its user. Turning it off stops their commands within half a minute":"Only the host's owner changes this",trailing:y?n.jsx(ge,{tone:"danger",children:"Every session"}):a?n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:l.hostSessions,disabled:!x,onChange:C=>u({...l,hostSessions:C.target.checked})}),n.jsx("span",{children:"Allow sessions on the host"})]}):n.jsx(ge,{tone:r.hostSessions?"danger":"neutral",children:r.hostSessions?"On":"Off"})}),!e.capabilities.hostConfig&&n.jsx(W,{title:"Update the host's connector",hint:"This host's connector predates configuration in Pikibun and keeps its connect options until it is updated (npx pikibun@latest connect). What you save here applies then."}),(m||h.error||h.notice)&&n.jsx(ke,{children:n.jsxs("div",{className:"stack",children:[n.jsx(ye,{...h}),m&&n.jsxs("div",{className:"inline",children:[n.jsx(q,{variant:"default",size:"sm",disabled:h.busy,onClick:w,children:"Save configuration"}),n.jsx(q,{variant:"ghost",size:"sm",disabled:h.busy,onClick:()=>u(r),children:"Discard"})]})]})})]})})}const ij=Object.freeze([{name:"gh",source:"piki:gh",tool:"gh",title:"GitHub CLI",description:"Runs the GitHub CLI (gh) in the session's sandbox, as the session owner: pull requests, issues, Actions runs and their logs, releases, and the GitHub API.",install:"https://cli.github.com",account:"their GitHub sign-in",signIn:"gh auth login",providers:["github","github-enterprise"]},{name:"glab",source:"piki:glab",tool:"glab",title:"GitLab CLI",description:"Runs the GitLab CLI (glab) in the session's sandbox, as the session owner: merge requests, issues, CI/CD pipelines and their logs, releases, and the GitLab API of gitlab.com.",install:"https://gitlab.com/gitlab-org/cli",account:"their GitLab (gitlab.com) access token under Git accounts",signIn:"glab auth login",providers:["gitlab"]},{name:"azure-cli",source:"piki:azure-cli",tool:"az",title:"Azure CLI",description:"Runs the Azure CLI (az) in the session's sandbox, as the session owner: Azure DevOps pull requests, pipelines and work items (with the azure-devops extension).",install:"https://learn.microsoft.com/cli/azure/install-azure-cli",account:"their Azure DevOps access token for the organization under Git accounts",signIn:"az login (and az extension add --name azure-devops)",providers:["azure-devops"]},{name:"prompt-audit",source:"piki:prompt-audit",title:"Prompt audit",description:"Has a model of the host check each message from anyone but the host's owner before it reaches the agent, and refuses ones that reach for the host's credentials, files, environment or network. A message it can't check is refused too.",providers:[]}]);function bc(e){return ij.find(i=>i.source===e)}function xR(){return ij.filter(e=>e.tool!==void 0)}const pb=4096;function aj({flags:e,settings:i,onChange:a,busy:r,multiline:l}){const u=new Set(e.map(p=>p.name)),d=Object.keys(i).filter(p=>!u.has(p)),h=(p,m)=>{const x={...i};m?x[p]=m:delete x[p],a(x)};return n.jsxs(n.Fragment,{children:[e.map(p=>n.jsx(xe,{label:p.name,hint:p.description??(p.default!==void 0?`Default: ${String(p.default)}`:void 0),children:p.type==="boolean"?n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",disabled:r,checked:(i[p.name]??p.default)===!0,onChange:m=>a({...i,[p.name]:m.target.checked})}),n.jsx("span",{children:"On"})]}):l?.includes(p.name)?n.jsx("textarea",{className:"textarea",rows:4,disabled:r,spellCheck:!1,maxLength:pb,placeholder:typeof p.default=="string"?p.default:"",value:typeof i[p.name]=="string"?i[p.name]:"",onChange:m=>h(p.name,m.target.value)}):n.jsx("input",{className:"input",disabled:r,autoComplete:"off",spellCheck:!1,maxLength:pb,placeholder:typeof p.default=="string"?p.default:"",value:typeof i[p.name]=="string"?i[p.name]:"",onChange:m=>h(p.name,m.target.value)})},p.name)),d.map(p=>n.jsx(W,{title:p,hint:`Kept: ${String(i[p])}. The installed version doesn't declare it`,trailing:n.jsx(q,{variant:"ghost",size:"sm",disabled:r,onClick:()=>{const m={...i};delete m[p],a(m)},children:"Clear"})},p))]})}const yR=n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Pi extensions this host runs for the sessions on it: those a workspace chose that it has installed at the same version. They run in its connector, as your OS user, outside the sandbox."}),n.jsxs("p",{children:["Install what your workspaces use here, or on the host with ",n.jsx("code",{children:"pikibun extensions add"}),". A dev extension, installed there from a local path, runs only in your own sessions on this host."]}),n.jsxs("p",{children:["Pikibun's own built-in extensions come with the connector too: ",n.jsx("code",{children:"piki:gh"}),", ",n.jsx("code",{children:"piki:glab"})," and ",n.jsx("code",{children:"piki:azure-cli"})," run the GitHub, GitLab and Azure CLIs where your workspaces use them, as you are signed in to them on this host (",n.jsx("code",{children:"gh auth login"}),", ",n.jsx("code",{children:"glab auth login"}),", ",n.jsx("code",{children:"az login"}),")."]}),n.jsx("p",{children:"Extension tool calls need the approval of you or a member granted host commands, unless a workspace sets an extension's tools to automatic and you let workspaces do that here."}),n.jsx("p",{children:"Built-in extensions come with Pikibun. Turned on, every session on this host runs with them, in every workspace; the tools they call are the session's own, decided as usual."}),n.jsxs("p",{children:["Require an extension of every session to run it on this host whatever each workspace chose, yours included, with the settings you give it here. Guards belong here: ",n.jsx("code",{children:"piki:prompt-audit"}),", which has a model check other members' messages before they reach the agent, or a tool-call guard such as ",n.jsx("code",{children:"npm:cc-safety-net"}),". While this host can't run one you require, its sessions take no messages."]})]});function bR({extension:e}){return e.error?n.jsx(W,{title:"Doesn't load",hint:e.error,trailing:n.jsx(ge,{tone:"danger",children:"Error"})}):n.jsx(n.Fragment,{children:e.modules.map(i=>n.jsx(ke,{children:n.jsxs("div",{className:"stack small",children:[n.jsx("strong",{children:n.jsx("code",{children:i.path})}),i.error&&n.jsxs("span",{children:["Doesn't load: ",i.error]}),!!i.tools.length&&n.jsxs("span",{children:["Tools: ",i.tools.map(a=>a.name).join(", ")]}),!!i.events.length&&n.jsxs("span",{className:"muted",children:["Events: ",i.events.join(", ")]}),!!i.flags.length&&n.jsxs("span",{className:"muted",children:["Settings: ",i.flags.map(a=>a.name).join(", ")]}),!!i.noops.length&&n.jsxs("span",{className:"muted",children:["Does nothing in Pikibun: ",i.noops.join(", ")]}),!!i.ignored.length&&n.jsxs("span",{className:"muted",children:["Not supported: ",i.ignored.join(", ")]})]})},i.path))})}function vR({connector:e,refresh:i}){const a=`/api/connectors/${oe(e.id)}/extensions`,r=$e(a),l=je(),[u,d]=N.useState(!1),h=r.data,p=h?.role==="owner",m=h?.requests.filter(U=>U.status==="pending")??[];N.useEffect(()=>{if(!m.length)return;const U=setInterval(r.refresh,5e3);return()=>clearInterval(U)},[m.length,r.refresh]);async function x(U,E){let I=!1;return await l.run(async()=>{await ce(`${a}/requests`,{method:"POST",body:{action:U,source:E}}),I=!0,r.refresh()},e.online?"Asked the host: it carries this out within half a minute.":"Asked the host: it carries this out once it is online."),I}function y(U){(async()=>await He({title:"Remove this extension from the host?",message:n.jsxs(n.Fragment,{children:["Sessions on this host stop running ",n.jsx("code",{children:U})," once it is removed, in every workspace that uses it."]}),confirmLabel:"Remove",destructive:!0})&&await x("remove",U))()}function v(U){l.run(async()=>{await ce(a,{method:"PATCH",body:{automaticTools:U}}),r.refresh()},U?"Workspaces may now run extension tools without approval on this host, where they set them to automatic.":"Extension tools on this host need approval again.")}const b=e.config?.builtinExtensions??[];function w(U,E){const I=to.map(ie=>ie.name).filter(ie=>ie===U?E:b.includes(ie)),Q=to.find(ie=>ie.name===U)?.title??U;l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/config`,{method:"PATCH",body:{builtinExtensions:I}}),i()},E?`${Q} is on: sessions on this host get it with their next message, within a minute.`:`${Q} is off: sessions on this host run without it from their next message, within a minute.`)}const S=e.config?.requiredExtensions??[],[C,k]=N.useState(null);async function O(U,E){let I=!1;return await l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/config`,{method:"PATCH",body:{requiredExtensions:U}}),I=!0,i()},E),I}function T(U,E){(async()=>{const I=bc(U.source)?.title??U.source;if(E&&!await He({title:`Require ${I} of every session?`,message:n.jsxs(n.Fragment,{children:["Every session on ",e.name," will run ",n.jsx("code",{children:U.source}),", yours included, in every workspace, whatever the workspace chose. It runs in this host's connector, as your OS user. Its settings are yours to set here."]}),confirmLabel:"Require"}))return;const Q=E?[...S,{source:U.source,settings:{}}]:S.filter(re=>re.source!==U.source);await O(Q,E?`Every session on this host runs ${I} from its next message, within a minute.`:`${I} is no longer required: sessions run it only where their workspace chose it.`)&&E&&U.modules.some(re=>re.flags.length)&&k({extension:{source:U.source,settings:{}},flags:U.modules.flatMap(re=>re.flags)})})()}const M=U=>S.some(E=>E.source===U),_=new Set(h?.report?.installed.map(U=>U.source)??[]),$=h?.report?xO(S,h.report.installed).flatMap(U=>S.filter(E=>E.source===U)):[],G=(h?.workspaces??[]).flatMap(U=>U.extensions.filter(E=>E.availability.status!=="installed").map(E=>({workspace:U,...E}))),J=U=>m.some(E=>E.source===U);return n.jsxs(Ae,{title:"Extensions",bare:!0,info:yR,action:p&&h?.report?.remoteInstalls!==!1?n.jsx(q,{variant:"outline",size:"sm",icon:"plus",disabled:!!e.revokedAt,onClick:()=>d(!0),children:"Install extension"}):void 0,children:[n.jsx(tt,{loading:r.loading&&!h,error:r.error,retry:r.refresh,children:h&&n.jsxs("div",{className:"card",children:[e.config&&to.map(U=>n.jsx(W,{leading:n.jsx(be,{name:"tool",size:16}),title:n.jsxs(n.Fragment,{children:[U.title," ",n.jsx("code",{children:U.name})]}),hint:e.capabilities.builtinExtensions?`${U.description} Tools: ${U.tools.join(", ")}`:"This host's connector predates built-in extensions: its sessions run without them until it is updated (npx pikibun@latest connect)",trailing:n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox","aria-label":`Run ${U.title} in every session on this host`,checked:b.includes(U.name),disabled:l.busy||!!e.revokedAt,onChange:E=>w(U.name,E.target.checked)}),n.jsx("span",{children:"Every session"})]})},`builtin ${U.name}`)),!e.capabilities.extensions&&n.jsx(W,{title:"Update the host's connector",hint:"This host's connector predates extensions: its sessions run none until it is updated (npx pikibun@latest connect)."}),e.capabilities.extensions&&!h.report&&n.jsx(W,{title:"Not reported yet",hint:"The host reports its extensions once its connector is online"}),h.report&&!h.report.remoteInstalls&&n.jsx(W,{title:"Installs from Pikibun are off",hint:"Its connector runs with --no-remote-installs: install extensions on the host with pikibun extensions"}),h.report&&!h.report.installed.length&&n.jsx(W,{title:"No extensions installed",hint:"Install those your workspaces use, below"}),h.report?.installed.map(U=>n.jsxs(ns,{leading:n.jsx(be,{name:"tool",size:16}),title:n.jsx("code",{children:U.source}),hint:U.dev?"Dev extension: your own sessions on this host":U.description??`${U.modules.flatMap(E=>E.tools).length} tools`,trailing:U.error||U.modules.some(E=>E.error)?n.jsx(ge,{tone:"danger",children:"Error"}):U.dev?n.jsx(ge,{tone:"warning",children:"Dev"}):_s(U.source)?n.jsx(ge,{tone:"neutral",children:"With the connector"}):J(U.source)?n.jsx(ge,{tone:"neutral",dot:!0,children:"Removing"}):n.jsx(ge,{tone:"success",children:"Installed"}),children:[n.jsx(bR,{extension:U}),!U.dev&&!U.error&&(p||M(U.source))&&n.jsx(ke,{children:n.jsxs("div",{className:"inline",children:[p?n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:M(U.source),disabled:l.busy||!!e.revokedAt||!M(U.source)&&S.length>=zf.requiredExtensions,onChange:E=>T(U,E.target.checked)}),n.jsx("span",{children:"Require of every session"})]}):n.jsx(ge,{tone:"success",children:"Required of every session"}),p&&M(U.source)&&U.modules.some(E=>E.flags.length)&&n.jsx(q,{variant:"outline",size:"sm",icon:"pencil",disabled:l.busy,onClick:()=>k({extension:S.find(E=>E.source===U.source),flags:U.modules.flatMap(E=>E.flags)}),children:"Settings"}),n.jsx("span",{className:"spacer"}),p&&!_s(U.source)&&h.report?.remoteInstalls&&n.jsx(q,{variant:"ghost",size:"sm",icon:"trash",disabled:l.busy||J(U.source),onClick:()=>y(U.source),children:"Remove"})]})})]},U.source)),e.capabilities.extensions&&!e.capabilities.requiredExtensions&&!!S.length&&n.jsx(W,{leading:n.jsx(be,{name:"alert",size:16}),title:"Update the host's connector",hint:"This host's connector predates required extensions: its sessions run only what their workspace chose, and messages go unaudited, until it is updated (npx pikibun@latest connect)"}),$.map(U=>n.jsx(W,{leading:n.jsx(be,{name:"alert",size:16}),title:n.jsx("code",{children:U.source}),hint:_s(U.source)?"Required of every session, but this host's connector doesn't have it: no session here takes messages until the connector is updated (npx pikibun@latest connect), or you stop requiring it":_.has(U.source)?"Required of every session, but it doesn't load here: no session takes messages until it does, or you stop requiring it":"Required of every session, but not installed here: no session takes messages until it is, or you stop requiring it",trailing:n.jsxs("span",{className:"inline",children:[p&&!_s(U.source)&&!_.has(U.source)&&h.report?.remoteInstalls&&(J(U.source)?n.jsx(ge,{tone:"neutral",dot:!0,children:"Installing"}):n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy||!!e.revokedAt,onClick:()=>{x("install",U.source)},children:"Install"})),p?n.jsx(q,{variant:"ghost",size:"sm",disabled:l.busy,onClick:()=>{O(S.filter(E=>E.source!==U.source),"No longer required.")},children:"Stop requiring"}):n.jsx(ge,{tone:"danger",children:"Missing"})]})},`required ${U.source}`)),G.map(U=>n.jsx(W,{leading:n.jsx(be,{name:"alert",size:16}),title:n.jsx("code",{children:U.source}),hint:_s(U.source)?`${U.workspace.name} uses it, which comes with newer connectors. Its sessions here run without it until this host's connector is updated (npx pikibun@latest connect)`:`${U.workspace.name} uses it${U.availability.status==="other-version"?`; this host has ${U.availability.installed}`:"; this host doesn't have it"}. Its sessions here run without it`,trailing:_s(U.source)?n.jsx(ge,{tone:"warning",children:"Update the connector"}):J(U.source)?n.jsx(ge,{tone:"neutral",dot:!0,children:"Installing"}):p&&h.report?.remoteInstalls!==!1?n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy||!!e.revokedAt,onClick:()=>{x("install",U.source)},children:U.availability.status==="other-version"?"Update":"Install"}):n.jsx(ge,{tone:"neutral",children:"Missing"})},`${U.workspace.id} ${U.source}`)),p&&n.jsx(W,{title:"Let workspaces run extension tools without approval",hint:"Only where a workspace sets an extension's tools to automatic. Off: each call waits for you, or a member granted host commands",trailing:n.jsx("input",{type:"checkbox",className:"checkbox","aria-label":"Let workspaces run extension tools without approval",checked:h.automaticTools,disabled:l.busy,onChange:U=>v(U.target.checked)})}),!p&&n.jsx(W,{title:"Extension tools without approval",trailing:n.jsx(ge,{tone:h.automaticTools?"warning":"neutral",children:h.automaticTools?"Allowed":"Off"})}),!!h.requests.length&&n.jsx(ns,{title:"Recent requests",hint:m.length?`${m.length} waiting for the host`:"Installs and removals asked for here",children:h.requests.map(U=>n.jsx(W,{title:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"muted",children:U.action==="install"?"Install":"Remove"})," ",n.jsx("code",{children:U.source})]}),hint:U.error??n.jsx(Vn,{value:U.finishedAt??U.requestedAt}),trailing:n.jsx(ge,{tone:U.status==="done"?"success":U.status==="failed"?"danger":"neutral",dot:U.status==="pending",children:U.status==="pending"?"Waiting":U.status==="done"?"Done":"Failed"})},U.id))}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})}),u&&n.jsx(jR,{close:()=>d(!1),busy:l.busy,error:l.error,install:async U=>{await x("install",U)&&d(!1)}}),C&&n.jsx(wR,{extension:C.extension,flags:C.flags,busy:l.busy,error:l.error,close:()=>k(null),save:async U=>{const E=S.map(I=>I.source===C.extension.source?{...I,settings:U}:I);await O(E,"Settings saved. Sessions on this host use them from their next message, within a minute.")&&k(null)}})]})}function wR({extension:e,flags:i,close:a,save:r,busy:l,error:u}){const[d,h]=N.useState(e.settings),p=bc(e.source);function m(x){x.preventDefault(),r(d)}return n.jsx(qt,{open:!0,title:`${p?.title??e.source} settings`,onClose:()=>{l||a()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:l,onClick:a,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"required-extension-form",disabled:l,children:l?"Saving...":"Save"})]}),children:n.jsxs("form",{id:"required-extension-form",className:"stack",onSubmit:m,children:[p&&n.jsx("p",{className:"muted small",children:p.description}),n.jsx(aj,{flags:i,settings:d,onChange:h,busy:l,multiline:["policy"]}),n.jsx("p",{className:"muted small",children:"Every session on this host runs it with these settings, whatever its workspace set. Never put secrets here: they are in the host's audit log, which its admins can read."}),n.jsx(ye,{error:u})]})})}function jR({close:e,install:i,busy:a,error:r}){const[l,u]=N.useState("");let d,h="";try{d=l.trim()?Tw(l.trim()):void 0}catch(m){h=m instanceof Error?m.message:"Invalid source"}function p(m){m.preventDefault(),d&&i(d)}return n.jsx(qt,{open:!0,title:"Install extension",onClose:()=>{a||e()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:a,onClick:e,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"install-extension-form",disabled:a||!d,children:a?"Asking...":"Install"})]}),children:n.jsxs("form",{id:"install-extension-form",className:"stack",onSubmit:p,children:[n.jsx(we,{variant:"warning",title:"Runs on your machine",children:"An extension runs in this host's connector, as your OS user, with your files, credentials and network. Install only code you trust. npm runs none of its install scripts."}),n.jsx(xe,{label:"Source",hint:"npm:<package>@<exact version>, or git:<https URL>@<full commit>",error:h,children:n.jsx("input",{className:"input mono",value:l,onChange:m=>u(m.target.value),disabled:a,autoComplete:"off",spellCheck:!1,maxLength:512,placeholder:"npm:cc-safety-net@2.7.2",autoFocus:!0})}),n.jsx(ye,{error:r})]})})}const kR=n.jsx(n.Fragment,{children:"Hosts are the Pis you pair. A paired host is yours, not a workspace's: it runs a dedicated app runtime you can use in every workspace you belong to, and stays private to you until you share it with one. Whoever operates a host sees the prompts and repository files processed on it, including private source, but never receives a GitHub token. Model credentials stay in Pi on the host. Status refreshes every 10 seconds."}),rj=e=>Xe(e?{name:"settings",section:"workspaces",id:e}:{name:"settings",section:"workspaces"});function oj(e,i,a){return`${e} ${e===1?i:a}`}function gb(e,i){return e<i?-1:e>i?1:0}function SR(e){const i=e.disabledModels?.length??0;return`${oj(e.models.length,"model","models")}${i?`, ${i} disabled`:""}`}function CR(e){const i=$e(e?`/api/workspaces/${oe(e.id)}/repositories`:null),a=!i.loading&&!i.error?i.data:null,r=!!(e&&a&&(a.repositories.length||a.sources||!a.required));return{...i,configured:r}}function AR({id:e}){const i=lo("/api/connectors"),[a,r]=N.useState(!1);if(e)return n.jsx(ER,{id:e,resource:i});const l=i.data?.connectors??[],u=!i.loading&&!i.error&&!l.length,d=n.jsx(q,{variant:u?"default":"outline",size:u?"md":"sm",icon:"plus",onClick:()=>r(!0),children:"Pair a host"});return n.jsxs(n.Fragment,{children:[n.jsx(Ae,{title:"Hosts",info:kR,action:l.length?d:void 0,bare:u,children:n.jsx(tt,{...i,retry:i.refresh,children:u?n.jsx(xt,{title:"No hosts yet",action:d}):l.map(h=>n.jsx(W,{leading:n.jsx(gi,{tone:nf(h)}),title:h.name,hint:`${h.role==="admin"?`${h.ownerName}'s host, you are an admin · `:""}${SR(h)} · ${h.workspaceIds.length?`Shared with ${oj(h.workspaceIds.length,"workspace","workspaces")}`:"Private"}`,trailing:n.jsx(co,{connector:h}),href:Xe({name:"settings",section:"hosts",id:h.id}),chevron:!0},h.id))})}),n.jsx(NR,{}),a&&n.jsx(lj,{onClose:()=>r(!1),refresh:i.refresh})]})}function NR(){const{user:e,workspaces:i}=pt(),[a,r]=N.useState({}),l=N.useCallback((h,p)=>r(m=>m[h]===p?m:{...m,[h]:p}),[]),u=i.every(h=>h.id in a),d=i.reduce((h,p)=>h+(a[p.id]??0),0);return n.jsxs(Ae,{title:"Shared with you",info:"Hosts other members shared into your workspaces. You can run your own sessions on them; their operator sees your prompts and repository files. Agents, session permissions and GitHub credentials are not shared.",children:[i.map(h=>n.jsx(TR,{workspace:h,userId:e.id,report:l},h.id)),u?!d&&n.jsx(W,{title:"Nothing shared with you",hint:"Hosts members share into your workspaces appear here"}):n.jsx(ke,{children:n.jsx($t,{})})]})}function TR({workspace:e,userId:i,report:a}){const r=lo(`/api/workspaces/${oe(e.id)}/connectors`),l=(r.data?.connectors??[]).filter(d=>d.ownerId!==i),u=r.error?1:l.length;return N.useEffect(()=>{r.loading||a(e.id,u)},[a,e.id,r.loading,u]),r.error?n.jsx(W,{leading:n.jsx(gi,{tone:"danger"}),title:`Unable to load hosts for ${e.name}`,hint:r.error,trailing:n.jsx(q,{variant:"outline",size:"sm",onClick:r.refresh,children:"Try again"})}):n.jsx(n.Fragment,{children:l.map(d=>n.jsxs(ns,{leading:n.jsx(gi,{tone:nf(d)}),title:d.name,hint:`${d.ownerName} · ${e.name}`,trailing:n.jsx(co,{connector:d}),children:[n.jsx(cc,{connector:d}),n.jsx("span",{className:"small muted",children:d.models.length?d.models.map(h=>h.name).join(", "):"No models offered"})]},d.id))})}function lj({onClose:e,refresh:i}){const{workspaces:a,currentWorkspace:r}=pt(),[l,u]=N.useState(""),[d,h]=N.useState(null),[p,m]=N.useState(!1),x=je(),y=N.useRef(!0);N.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),N.useEffect(()=>{if(!d)return;const M=Math.max(0,new Date(d.expiresAt).getTime()-Date.now()),_=window.setTimeout(()=>{h(null),m(!0)},M);return()=>window.clearTimeout(_)},[d]);function v(M){M?.preventDefault(),!(x.busy||!l.trim())&&(h(null),m(!1),x.run(async()=>{const _=await ce("/api/connectors/pairings",{method:"POST",body:{name:l.trim()}});y.current&&h(_.pairing)}))}function b(){h(null),i(),e()}const w=Zi(),S=je();function C(){if(!d||!w)return;const M={id:d.id,code:d.code};S.run(async()=>{await rn(w.host.pairHere(M,!1)),h(null)},"This computer is pairing. It appears in this list once it is online.")}const k=r??a[0]??null,O=x.busy?"Creating code...":d?"Create another code":"Create pairing code",T=d?n.jsxs(n.Fragment,{children:[n.jsx(q,{variant:"outline",disabled:x.busy||!l.trim(),onClick:()=>v(),children:O}),n.jsx(q,{variant:"default",onClick:b,children:"Done"})]}):n.jsx(q,{variant:"default",disabled:x.busy||!l.trim(),onClick:()=>v(),children:O});return n.jsx(qt,{open:!0,wide:!0,title:"Pair a host",onClose:e,footer:T,children:n.jsxs("div",{className:"stack",children:[n.jsx("form",{onSubmit:v,children:n.jsx(xe,{label:"Host name",hint:"The host is yours: you can use it in every workspace you belong to, and it stays private to you until you share it with one",children:n.jsx("input",{className:"input",required:!0,maxLength:120,autoComplete:"off",value:l,onChange:M=>u(M.target.value),placeholder:"My Linux workstation"})})}),n.jsx(ye,{...x}),p&&n.jsx(we,{variant:"warning",role:"status",title:"Pairing code expired",children:"The code was cleared. Create a new code to try again."}),d&&w&&n.jsx(we,{variant:"info",title:"Pairing this computer?",actions:n.jsx(q,{size:"sm",variant:"outline",disabled:S.busy,onClick:C,children:"Pair this computer"}),children:"Pikibun's app runs here: it can pair this computer with the code below and start it as your host, with nothing to copy."}),n.jsx(ye,{...S}),d&&n.jsxs("section",{className:"stack","aria-label":"One-time pairing instructions",children:[n.jsxs("span",{role:"status",children:["Code ready. Expires ",n.jsx(Qt,{value:d.expiresAt})]}),n.jsx(xe,{label:"Run this on your host",children:n.jsx(Yn,{value:`npx pikibun@latest connect --server ${window.location.origin} --pairing-id ${d.id}`,label:"Copy command"})}),n.jsx(xe,{label:"Paste at the hidden prompt, not on the command line",children:n.jsx(Yn,{value:d.code,label:"Copy code"})}),n.jsxs("span",{className:"small muted",children:["Single-use secret: don't share it. It is held only in this page's memory. Hiding it doesn't revoke it; an unused code stays valid until it expires.",k&&n.jsxs(n.Fragment,{children:[" Once the host is online, ",n.jsx("a",{href:Xe({name:"new",workspaceId:k.id}),children:"start a session"})," with one of its models."]})]})]}),n.jsxs(ns,{plain:!0,title:"Host requirements",children:[n.jsx("span",{className:"small",children:"Linux or WSL2 (native Windows is unsupported) with Node.js 24, Pi configured there with its providers and models, and bubblewrap, Python 3, Git and flock installed."}),n.jsx("span",{className:"small",children:"No app checkout is needed; run from any folder. Session source downloads into private caches. Never paste a token into this page or a command."}),n.jsxs("span",{className:"small",children:["macOS has no sandbox: add ",n.jsx("code",{children:"--unsafe-no-sandbox"})," to run agent work directly on your Mac as your user, with only Git required. The connector asks you to confirm, and Pikibun labels the host Unsandboxed: approved commands run with access to your files, credentials and network, and no resource limits."]})]})]})})}function ER({id:e,resource:i}){const a=i.data?.connectors.find(r=>r.id===e);return n.jsxs(n.Fragment,{children:[n.jsxs("a",{className:"btn ghost sm settings-back",href:Xe({name:"settings",section:"hosts"}),children:[n.jsx(be,{name:"chevron-left"}),"Hosts"]}),n.jsx(tt,{...i,retry:i.refresh,children:a?n.jsx(zR,{connector:a,refresh:i.refresh},a.id):n.jsx(xt,{title:"Host not found"})})]})}function zR({connector:e,refresh:i}){const{workspaces:a}=pt(),r=je(),l=je(),[u,d]=N.useState(!1),[h,p]=N.useState(!1),m=new Map(a.map(C=>[C.id,C.name])),x=e.role!=="admin",y=[...new Set([...e.connectedWorkspaceIds??[],...e.workspaceIds])],v=a.filter(C=>!e.workspaceIds.includes(C.id));function b(C){(async()=>await He({title:"Stop sharing this host?",message:"Other members' sessions can no longer run work on it in this workspace. It stays connected for your own use; existing session records and visibility are unchanged.",confirmLabel:"Unshare"})&&await r.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/shares/${oe(C)}`,{method:"DELETE"}),i()},"Host sharing stopped. Your private connection remains available."))()}function w(){(async()=>await He({title:`Permanently remove ${e.name}?`,message:"This permanently removes the host from your list, invalidates its credentials and stops sharing it in all workspaces. Existing sessions and their historical host references remain, but cannot run on this host. Local files are not deleted. To use this machine again, pair it as a new host.",confirmLabel:"Remove permanently",destructive:!0})&&await l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/permanent`,{method:"DELETE"}),xi({name:"settings",section:"hosts"}),i()}))()}function S(){(async()=>await He({title:`Revoke ${e.name}?`,message:"This disconnects its runtime and blocks work in every connected workspace, including your own sessions. Pair again to reconnect; existing session records are not deleted.",confirmLabel:"Revoke host",destructive:!0})&&await l.run(async()=>{await ce(`/api/connectors/${oe(e.id)}`,{method:"DELETE"}),i()},"Host revoked."))()}return n.jsxs(n.Fragment,{children:[n.jsxs(Ae,{title:"Status",bare:!0,children:[n.jsxs("div",{className:"card",children:[n.jsx(W,{title:"Status",trailing:n.jsx(co,{connector:e})}),x&&!e.online&&n.jsx(W,{title:e.revokedAt?"Pair again":"Reconnect host",hint:e.revokedAt?"Revoked credentials cannot be reused; create a new pairing":"Restart the saved connection on your host machine",trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>e.revokedAt?p(!0):d(!0),children:e.revokedAt?"Pair again":"Reconnect"})}),n.jsx(W,{title:"Owner",trailing:e.ownerName}),n.jsx(W,{title:"Paired",trailing:n.jsx(Qt,{value:e.createdAt})}),e.revokedAt&&n.jsx(W,{title:"Revoked",trailing:n.jsx(Qt,{value:e.revokedAt})})]}),n.jsx(cc,{connector:e})]}),n.jsx(OR,{connector:e,refresh:i}),n.jsxs(Ae,{title:"Sharing",bare:!0,info:"Sharing with a workspace is optional and lets its members run their own sessions on this host; you will see their prompts and repository snapshots. Agents, session permissions and GitHub credentials are not shared, and personal Pi history is never imported.",children:[n.jsxs("div",{className:"card",children:[!y.length&&n.jsx(W,{title:"Not in any workspace yet",hint:"Create or join a workspace to use this host there"}),y.map(C=>{const k=e.workspaceIds.includes(C);return n.jsx(W,{title:m.get(C)??C,hint:k?"Shared with members":x?"Private: your use only":"Private: the owner's use only",trailing:k&&!e.revokedAt&&n.jsx(q,{variant:"outline",size:"sm",disabled:r.busy,onClick:()=>b(C),children:"Unshare"})},C)}),!e.revokedAt&&(v.length?n.jsx(RR,{connector:e,available:v,busy:r.busy,run:r.run,refresh:i}):!a.length&&n.jsx(W,{title:"Share with workspace",hint:"Create or join a workspace and configure its repositories before sharing",href:rj(),chevron:!0}))]}),n.jsx(ye,{error:r.error,notice:r.notice})]}),n.jsx(gR,{connector:e,refresh:i}),e.config&&n.jsx(hR,{connector:e,refresh:i}),e.role&&n.jsx(vR,{connector:e,refresh:i}),e.capabilities.hostCommands&&n.jsx(lR,{connector:e,refresh:i}),n.jsx(rR,{connector:e,refresh:i}),n.jsx(Ae,{title:"Details",children:n.jsx(ke,{children:n.jsx(xe,{label:"Connection ID",children:n.jsx(Yn,{value:e.id,label:"Copy connection ID"})})})}),x&&n.jsxs(Ae,{title:"Danger zone",bare:!0,children:[n.jsxs("div",{className:"card",children:[n.jsx(W,{title:"Revoke host",hint:e.revokedAt?n.jsxs(n.Fragment,{children:["Revoked ",n.jsx(Qt,{value:e.revokedAt})]}):"Disconnects its runtime and blocks work in every connected workspace",trailing:!e.revokedAt&&n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:S,children:l.busy?"Revoking...":"Revoke"})}),n.jsx(W,{title:"Permanently remove host",hint:"Remove from Pikibun and invalidate access. Session history and local files are retained.",trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:w,children:"Remove permanently"})})]}),n.jsx(ye,{error:l.error,notice:l.notice})]}),h&&n.jsx(lj,{onClose:()=>p(!1),refresh:i}),u&&n.jsx(qt,{open:!0,title:`Reconnect ${e.name}`,onClose:()=>d(!1),footer:n.jsx(q,{onClick:()=>{i(),d(!1)},children:"Done"}),children:n.jsxs("div",{className:"stack",children:[n.jsx(we,{variant:e.online?"success":"warning",title:e.online?"Host is connected":"Start the connection on your host",children:"Pikibun cannot remotely start an offline host. If you use the desktop app, open it on the host and start its connection. For a CLI host, run the command below on the original machine with its saved pairing."}),n.jsx(xe,{label:"Run on your host",children:n.jsx(Yn,{value:`npx pikibun@latest connect${e.capabilities.unsandboxed?" --unsafe-no-sandbox":""}`,label:"Copy reconnect command"})}),n.jsx("span",{className:"small muted",children:"Use the same OS user and any original options of the machine's own setup: --state-dir, --resources, --pi-agent-dir and --model. Everything else is this host's Configuration, here. Do not add --pairing-id or --force: the saved credentials preserve this host and its sessions. Stop any existing connector before starting another. Status refreshes every 10 seconds."}),n.jsx("span",{className:"small muted",children:"If the saved pairing is missing, pair a new host instead. A new pairing does not reconnect this host's existing sessions."}),n.jsx(q,{variant:"outline",onClick:i,children:"Refresh status"})]})})]})}function OR({connector:e,refresh:i}){const a=je(),r=new Set((e.disabledModels??[]).map(Fi)),l=[...e.models,...e.disabledModels??[]].sort((h,p)=>gb(h.provider,p.provider)||gb(h.modelId,p.modelId)),u=!!e.role&&!e.revokedAt;function d(h,p){a.busy||!u||a.run(async()=>{await ce(`/api/connectors/${oe(e.id)}/models`,{method:"PATCH",body:{provider:h.provider,modelId:h.modelId,enabled:p}}),i()},p?`${h.name} enabled.`:`${h.name} disabled. No new session or message can use it.`)}return n.jsxs(Ae,{title:"Models",bare:!0,info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"The models Pi on this host offers. Configure providers and models in Pi on the host; credentials never leave it."}),n.jsx("p",{children:"The owner and admins can disable a model: no session starts from it and no message switches to it, for everyone who uses this host, the owner included, in every workspace. Sessions already on it keep their history and continue on another model."})]}),children:[n.jsx("div",{className:"card",children:l.length?l.map(h=>n.jsx(W,{title:h.name,hint:`${h.provider} / ${h.modelId}`,trailing:n.jsxs("label",{className:"inline small",title:"Sessions can start from this model and messages can switch to it",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:!r.has(Fi(h)),disabled:!u||a.busy,onChange:p=>d(h,p.target.checked)}),"Enabled"]})},Fi(h))):n.jsx(W,{title:"No models advertised",hint:"Configure models in Pi on the host"})}),n.jsx(ye,{error:a.error,notice:a.notice})]})}function RR({connector:e,available:i,busy:a,run:r,refresh:l}){const[u,d]=N.useState(""),h=i.find(y=>y.id===u)??i[0],p=CR(h);async function m(){!p.configured||a||e.capabilities.unsandboxed&&!await He({title:"Share an unsandboxed host?",message:`Share an unsandboxed Pi with ${h.name}? Members' approved commands will run directly on your machine as your user, with access to your files, credentials and network, and no resource limits.`,confirmLabel:"Share host",destructive:!0})||await r(async()=>{await ce(`/api/connectors/${oe(e.id)}/shares/${oe(h.id)}`,{method:"PUT",body:{}}),l()},"Host shared with workspace. Session visibility and permissions are unchanged; personal Pi history is not imported.")}const x=p.loading?n.jsx($t,{children:"Checking repositories..."}):p.error?n.jsx("span",{className:"field-error",children:p.error}):p.configured?`Members of ${h.name} can run their own sessions on this host`:n.jsxs(n.Fragment,{children:["No repositories configured for ",h.name,". Ask an owner or admin to ",n.jsx("a",{href:rj(h.id),children:"bind one"})," before sharing"]});return n.jsx(W,{title:"Share with workspace",hint:x,trailing:n.jsxs(n.Fragment,{children:[n.jsx(Xt,{label:"Workspace to share with",value:h.id,options:i.map(y=>({value:y.id,label:y.name})),onChange:d,disabled:a}),(p.error||!p.configured)&&!p.loading&&n.jsx(q,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh repositories",title:"Refresh repositories",disabled:a,onClick:p.refresh}),n.jsx(q,{variant:"outline",size:"sm",disabled:a||!p.configured,onClick:()=>{m()},children:a?"Saving...":"Share"})]})})}const MR=[{key:"approvals",title:"Needs approval",hint:"A session's agent waits for someone to approve what it wants to do"},{key:"finished",title:"Finished",hint:"A session's agent finished the message it was working on"},{key:"failed",title:"Failed",hint:"A session's agent stopped on an error"},{key:"details",title:"Show session titles",hint:"Off, notifications only say what happened, not which session or workspace"}],DR={desktop:"This app shows notifications while it is open, even with its windows hidden.",push:"This browser shows notifications even when no Pikibun tab is open.",page:"This browser shows notifications while a Pikibun tab is open."};function LR(){const{user:e}=pt(),i=$e("/api/notifications/config"),a=cv(e.id),r=je(),l=je(),u=je(),d=Ql(i.data?.webPushKey??null),h=d.kind!=="desktop"&&d.kind!=="unsupported"&&Notification.permission==="denied";function p(v){r.busy||!i.data||r.run(async()=>{v?await cS(e.id,i.data):await Xx(e.id),i.refresh()},v?"Notifications are on for this device.":"Notifications are off for this device.")}function m(v,b){l.busy||l.run(async()=>{const{preferences:w}=await ce("/api/notifications/preferences",{method:"PUT",body:{[v]:b}});i.setData(S=>S&&{...S,preferences:w})})}function x(v){u.busy||u.run(async()=>{v.id===uS(e.id)?await Xx(e.id):await ce(`/api/notifications/devices/${oe(v.id)}`,{method:"DELETE"}),i.refresh()},`${v.name??"The device"} no longer gets notifications.`)}function y(){u.busy||u.run(async()=>{await ce("/api/notifications/test",{method:"POST"})},"Sent. It should appear on each device with notifications on within a few seconds.")}return n.jsxs(n.Fragment,{children:[n.jsx(Ae,{title:"This device",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Pikibun tells you when one of your sessions waits for an approval, finishes or fails: sessions you own, and those you sent the latest message to."}),n.jsx("p",{children:"Turn notifications on in each browser, and in the Pikibun apps, where you want them. In a browser they come through its push service (Google's, Mozilla's, Apple's or Microsoft's), encrypted so that only your browser can read them."})]}),children:n.jsxs(tt,{loading:i.loading&&!i.data,error:i.error,retry:i.refresh,children:[i.data&&n.jsx(W,{title:"Notifications on this device",hint:d.kind==="unsupported"?d.reason:h?"This browser blocks notifications from Pikibun. Allow them in the site's settings (the icon beside the address).":DR[d.kind],trailing:d.kind==="unsupported"?n.jsx(ge,{tone:"neutral",children:"Unavailable"}):n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Notifications on this device",checked:a,disabled:r.busy||h&&!a,onChange:v=>p(v.target.checked)})}),(r.error||r.notice)&&n.jsx(ke,{children:n.jsx(ye,{...r})})]})}),n.jsxs(Ae,{title:"Notify me when",info:"These apply to every device you turned notifications on for.",children:[i.data&&MR.map(v=>n.jsx(W,{title:v.title,hint:v.hint,trailing:n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":v.title,checked:i.data.preferences[v.key],disabled:l.busy,onChange:b=>m(v.key,b.target.checked)})},v.key)),l.error&&n.jsx(ke,{children:n.jsx(ye,{error:l.error})})]}),n.jsxs(Ae,{title:"Devices",info:"The browsers and apps that get your notifications even when Pikibun isn't open. Signing out of one stops its notifications.",action:n.jsx(q,{size:"sm",variant:"outline",icon:"bell",disabled:u.busy,onClick:y,children:"Send a test"}),children:[i.data&&!i.data.devices.length&&n.jsx(W,{title:"No devices yet",hint:"Turn notifications on above, or in the Pikibun app's settings"}),i.data?.devices.map(v=>n.jsx(W,{title:n.jsxs(n.Fragment,{children:[v.name??(v.kind==="expo"?"Pikibun app":"Browser"),v.current&&n.jsxs(n.Fragment,{children:[" ",n.jsx(ge,{tone:"info",children:"This device"})]})]}),hint:n.jsxs(n.Fragment,{children:[v.kind==="expo"?"App":"Browser"," · since ",n.jsx(Qt,{value:v.createdAt})]}),trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>x(v),children:"Remove"})},v.id)),(u.error||u.notice)&&n.jsx(ke,{children:n.jsx(ye,{...u})})]})]})}const no=["notion","google-drive","feishu","dropbox","onedrive","tencent-docs"],gn={notion:"Notion","google-drive":"Google Drive",feishu:"Feishu / Lark",dropbox:"Dropbox",onedrive:"OneDrive / SharePoint","tencent-docs":"Tencent Docs"},xb=["notion","google-drive","feishu"],yb={documents:20},_R=iv.filter(e=>e!=="github"),bb={"github-enterprise":"Fine-grained: Contents and Metadata read (or classic repo); opening pull requests needs Pull requests write, and pushing with your account Contents write (or classic repo)",gitlab:"read_api and read_repository; opening merge requests needs api, and pushing with your account write_repository (or api)",bitbucket:"API token with read:repository:bitbucket and read:user:bitbucket, connected with your Atlassian account email above; agent pushes need this API token (workspace or repository access tokens can browse but cannot pass the push owner check); opening pull requests needs write:pullrequest:bitbucket, and pushing with your account write:repository:bitbucket","azure-devops":"Code (Read); opening pull requests or pushing with your account needs Code (Read & write)",gitea:"read:repository and read:user; opening pull requests or pushing with your account needs write:repository",git:"read access to the repositories; pushing with your account needs write access"},$R="Repositories you bind or pin are read with your Git accounts, and the pull requests your agents ask for are opened with them. Their tokens are encrypted on the server and never sent to other people's hosts. Where a workspace's push access uses the session owner's account, your own host receives yours in memory for each push in your sessions; Pikibun resets your GitHub token when the push ends, so that copy stops working.";function UR(e){if(e==="git")return"Any server over HTTPS, without pull requests";const i=us[e];return i.fixed??(i.default?`${i.default} or self-managed`:"Self-hosted")}function IR(){const{user:e}=pt(),{accounts:i,loading:a,error:r,refresh:l}=rv(),u=je(),[d,h]=N.useState(null);async function p(m){u.busy||!await He({title:"Remove Git account",message:`Remove ${bh(m)} (${m.login})? Its token is deleted from the server. New sessions you own can no longer read repositories through it; existing session snapshots are kept.`,confirmLabel:"Remove",destructive:!0})||u.run(async()=>{await ce(`/api/git/accounts/${oe(m.id)}`,{method:"DELETE"}),l()},"Git account removed.")}return n.jsxs("div",{className:"stack",id:"git-accounts",children:[n.jsx("div",{className:"section-header",children:n.jsx("h3",{className:"section-title",children:"Git"})}),n.jsxs("div",{className:"card",children:[e.passwordSignIn?n.jsx(W,{leading:n.jsx(Yl,{}),title:Zn.github,hint:`${us.github.default} · Repositories on github.com need an account that signs in with GitHub; this account signs in with a password`,trailing:n.jsx(ge,{tone:"warning",children:"Not available"})}):n.jsx(W,{leading:n.jsx(Yl,{}),title:Zn.github,hint:e.githubConnected?`${us.github.default} · ${e.githubLogin?`@${e.githubLogin} · `:""}signed in`:`${us.github.default} · Not connected`,trailing:e.githubConnected?n.jsx(ge,{tone:"success",children:"Connected"}):n.jsx(Ht,{variant:"outline",size:"sm",href:"/api/auth/github",children:"Sign in"})}),n.jsx(tt,{loading:a&&!i,error:r,retry:l,children:_R.map(m=>{const x=i?.filter(v=>v.provider===m)??[],y=Zn[m];return n.jsxs(N.Fragment,{children:[n.jsx(W,{leading:n.jsx(be,{name:"git-branch",size:16}),title:y,hint:`${UR(m)} · ${x.length?`${x.length} connected`:"Not connected"}`,trailing:n.jsxs(n.Fragment,{children:[x.length>0&&n.jsx(ge,{tone:"success",children:"Connected"}),n.jsx(q,{variant:x.length?"ghost":"outline",size:"sm",disabled:u.busy,"aria-label":`Connect ${y}`,onClick:()=>h(m),children:x.length?"Add another":"Connect"})]})}),x.map(v=>n.jsx(W,{leading:n.jsx("span",{className:"git-account-indent","aria-hidden":!0}),title:`${v.host}${v.organization?`/${v.organization}`:""}`,hint:v.login,trailing:n.jsx(q,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Remove ${bh(v)}`,onClick:()=>{p(v)},children:"Remove"})},v.id))]},m)})}),(u.error||u.notice)&&n.jsx(ke,{children:n.jsx(ye,{...u})})]}),n.jsx(cj,{provider:d,close:()=>h(null),added:l})]})}function cj({provider:e,close:i,added:a,save:r,initial:l}){const[u,d]=N.useState(""),[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(""),b=je(),w=e?us[e].fixed:null;N.useEffect(()=>{d(l?.host??(e?us[e].default??"":"")),p(l?.organization??""),x(l?.username??""),v("")},[e,l]);function S(){b.busy||(v(""),i())}function C(T){if(T.preventDefault(),!e||b.busy)return;const M={provider:e,token:y,...w?{}:{host:u.trim()},...e==="azure-devops"?{organization:h.trim()}:{},...(e==="bitbucket"||e==="git")&&m.trim()?{username:m.trim()}:{}};b.run(async()=>{try{r?await r(M):await ce("/api/git/accounts",{method:"POST",body:M})}finally{v("")}a(),i()})}const k=!!(e&&y&&(w||u.trim())&&(e!=="azure-devops"||h.trim())&&(e!=="git"||m.trim())),O=!!r;return n.jsx(qt,{open:e!==null,title:`Connect ${e?Zn[e]:"Git"}${O?" for the workspace":""}`,onClose:S,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:b.busy,onClick:S,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"git-account-form",disabled:!k||b.busy,children:b.busy?"Verifying...":"Connect"})]}),children:n.jsxs("form",{id:"git-account-form",className:"stack",onSubmit:C,children:[e&&n.jsxs(n.Fragment,{children:[O&&n.jsx("p",{className:"muted small",children:"Use a service account made for this, such as a bot or a deploy user, never your own: every member's sessions read with it. It only reads; pushes keep using each session owner's account or the workspace's push access."}),e==="git"&&n.jsx("p",{className:"muted small",children:"Any Git server that serves smart HTTP over HTTPS (git http-backend, cgit, Gerrit, a forge without its API). There is no repository list and agents can't open pull requests; you add each repository by its clone URL. SSH isn't supported."}),!w&&n.jsx(xe,{label:"Host",hint:e==="git"?"The host name in the server's https:// clone URLs, with its port if it has one, for example git.example.com":"HTTPS host name of the instance, without https://, for example git.example.com",children:n.jsx("input",{className:"input",required:!0,value:u,onChange:T=>d(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:253,placeholder:"git.example.com"})}),e==="azure-devops"&&n.jsx(xe,{label:"Organization",hint:"From dev.azure.com/<organization>",children:n.jsx("input",{className:"input",required:!0,value:h,onChange:T=>p(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:100})}),e==="bitbucket"&&n.jsx(xe,{label:"Username or email",hint:"Your Atlassian account email when using an API token (required for agent pushes); leave blank for a workspace or repository access token, which can browse but not push",children:n.jsx("input",{className:"input",value:m,onChange:T=>x(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),e==="git"&&n.jsx(xe,{label:"User name",hint:O?"The service account's user name over HTTPS":"The user name you clone with over HTTPS",children:n.jsx("input",{className:"input",required:!0,value:m,onChange:T=>x(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,maxLength:254})}),n.jsx(xe,{label:e==="git"?"Password or token":"Token",hint:O?`Read access to the repositories it will read is enough. ${e==="git"?"Encrypted on the server and checked when a repository reads with it":`Verified with ${Zn[e]}, then encrypted on the server`}`:e==="git"?`Needs ${bb.git}. Encrypted on the server and checked when you add a repository: a Git server has no account to verify it against`:`Scopes: ${bb[e]}. Verified with ${Zn[e]}, then encrypted on the server`,children:n.jsx("input",{className:"input",required:!0,type:"password",value:y,onChange:T=>v(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1})})]}),n.jsx(ye,{error:b.error})]})})}const BR=["github-enterprise","gitlab","bitbucket","azure-devops","gitea","git"],uj=["notion","google-drive","feishu"],vb=20;function HR(e){const i=$e(e?`/api/workspaces/${oe(e)}/connections`:null);return{connections:i.data?.connections??null,loading:i.loading,error:i.error,refresh:i.refresh}}function Xr(e){if(e.family==="document")return gn[e.provider];const i=uc(e.provider,e.host);return e.organization?`${i} · ${e.organization}`:i}function qR(e,i){const a=i.provider==="azure-devops"?i.fullName.split("/")[0].toLowerCase():"";return e?.find(r=>r.family==="git"&&r.provider===i.provider&&r.host===i.host&&r.organization===a)??null}function wb(e,i){return e?.find(a=>a.family==="document"&&a.provider===i)??null}function dj({workspaceId:e,sourceId:i,title:a,readAs:r,connection:l,admin:u,action:d,changed:h}){if(!u)return r==="workspace"?n.jsx(ge,{children:"Workspace connection"}):null;function p(m){m===r||d.busy||d.run(async()=>{await ce(`/api/workspaces/${oe(e)}/sources/${oe(i)}/read-as`,{method:"PUT",body:{readAs:m}}),h()},m==="workspace"?`${a} now reads with the workspace connection.`:`${a} now reads with each session owner's own account.`)}return n.jsxs("label",{className:"inline small",title:"Which account sessions read this source with",children:["Reads with",n.jsxs("select",{className:"select compact",value:r,disabled:d.busy,"aria-label":`Account ${a} reads with`,onChange:m=>p(m.target.value),children:[n.jsx("option",{value:"members",children:"Members' accounts"}),n.jsx("option",{value:"workspace",disabled:!l&&r!=="workspace",children:l?`Workspace: ${l.name}`:"Workspace (not connected)"})]})]})}function FR({workspaceId:e,admin:i,connections:a,loading:r,error:l,refresh:u,changed:d}){const h=je(),[p,m]=N.useState(null),[x,y]=N.useState(null),v=N.useMemo(()=>x?{host:x.host,organization:x.organization,...x.provider==="git"?{username:x.name}:{}}:null,[x]),[b,w]=N.useState(null),S=`/api/workspaces/${oe(e)}/connections`,C=(a?.length??0)>=vb;async function k(T){h.busy||!await He({title:"Remove connection",message:`Remove the workspace's ${Xr(T)} connection (${T.name})? Its secret is deleted from the server.`,confirmLabel:"Remove",destructive:!0})||h.run(async()=>{await ce(`${S}/${oe(T.id)}`,{method:"DELETE"}),u(),d()},"Connection removed.")}const O=()=>{u(),d()};return n.jsxs(Ae,{title:"Connections",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Service accounts this workspace reads its sources with, instead of each member's own: a GitLab or Gitea bot, a Git server's deploy user, a Notion integration, a Google service account or a Feishu/Lark app. Connect accounts made for that, never your personal one: every member's sessions read with it."}),n.jsx("p",{children:"A source uses a connection only where an owner or admin sets it to, under Sources; Pikibun reads the source with the connection first. Otherwise sessions read with their owner's own account, as before, and never fall back from one to the other."}),n.jsx("p",{children:"Connections only read. Pushes and pull requests use the session owner's account or the workspace's push access. Secrets are encrypted on the server and never sent to any host; members see only which account it is. github.com repositories, Dropbox, OneDrive and Tencent Docs read with each member's own sign-in."})]}),action:i&&!C&&n.jsx(ss,{label:"Add connection",triggerVariant:"outline",trigger:n.jsxs(n.Fragment,{children:[n.jsx(be,{name:"plus",size:16}),"Add connection"]}),items:[...BR.map(T=>({label:Zn[T],onSelect:()=>m(T)})),"separator",...uj.map(T=>({label:gn[T],onSelect:()=>w(T)}))]}),children:[n.jsxs(tt,{loading:r&&!a,error:l,retry:u,children:[a?.length?a.map(T=>n.jsx(W,{leading:n.jsx(be,{name:T.family==="git"?"git-branch":"file",size:16}),title:Xr(T),hint:`${T.name} · ${T.sources?`${T.sources} source${T.sources===1?"":"s"} read with it`:"No source reads with it yet"}`,trailing:i&&n.jsxs(n.Fragment,{children:[n.jsx(q,{variant:"ghost",size:"sm",disabled:h.busy,"aria-label":`Replace ${Xr(T)}`,title:"Connect it again with a new secret, keeping the sources that read with it",onClick:()=>T.family==="git"?(y(T),m(T.provider)):w(T.provider),children:"Replace"}),n.jsx(q,{variant:"ghost",size:"sm",disabled:h.busy||T.sources>0,title:T.sources>0?"Switch its sources to members' own accounts first":void 0,"aria-label":`Remove ${Xr(T)}`,onClick:()=>{k(T)},children:"Remove"})]})},T.id)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"No connections. Sessions read every source with their owner's own account"})}),(h.error||h.notice)&&n.jsx(ke,{children:n.jsx(ye,{...h})})]}),i&&C&&n.jsx(ke,{children:n.jsxs("span",{className:"muted small",children:["This workspace has ",vb," connections, the most it can have. Replace one, or remove one to add another."]})}),i&&n.jsx(cj,{provider:p,close:()=>{m(null),y(null)},added:O,initial:v,save:async T=>{await ce(S,{method:"POST",body:{family:"git",...T}})}}),i&&n.jsx(hj,{provider:b,close:()=>w(null),connected:O,save:async(T,M)=>{await ce(S,{method:"POST",body:{family:"document",provider:T,...M}})}})]})}function GR(e=!0){const i=$e(e?"/api/source-accounts":null);return{accounts:i.data?.accounts??null,loading:i.loading,error:i.error,refresh:i.refresh}}function PR(e){const i=$e(e?`/api/workspaces/${oe(e)}/sources`:null);return{sources:i.data?.sources??null,loading:i.loading,error:i.error,refresh:i.refresh}}const YR={notion:n.jsx(n.Fragment,{children:"Create an internal integration at notion.so/profile/integrations with Read content, and share the pages it may read with it (a page's ••• menu → Connections)."}),"google-drive":n.jsx(n.Fragment,{children:"Create a service account in Google Cloud with the Drive API enabled, download its JSON key, and share the folders and files it may read with the service account's email, as Viewer."}),feishu:n.jsx(n.Fragment,{children:"Create a custom app in the Feishu or Lark developer console with read access to Drive, Docs and Wiki, publish it, and add it to the folders, documents or wiki spaces it may read."}),dropbox:n.jsx(n.Fragment,{children:"Sign in to Dropbox. Sessions read the folders and files under the workspace's Dropbox sources that your account can see."}),onedrive:n.jsx(n.Fragment,{children:"Sign in with your Microsoft account. Sessions read the OneDrive and SharePoint folders and files under the workspace's sources that you can open."}),"tencent-docs":n.jsx(n.Fragment,{children:"Sign in to Tencent Docs. Sessions read the folders and documents under the workspace's Tencent Docs sources that you can open."})},VR={page:"Page",database:"Database",folder:"Folder",document:"Document",spreadsheet:"Spreadsheet",presentation:"Presentation",file:"File",wiki:"Wiki page"};function ZR(){const e=$e("/api/source-accounts"),{accounts:i,loading:a,error:r,refresh:l}={accounts:e.data?.accounts??null,loading:e.loading,error:e.error,refresh:e.refresh},u=e.data?.oauth??[],d=je(),[h,p]=N.useState(null),[m,x]=N.useState(null);N.useEffect(()=>{const b=new URLSearchParams(window.location.search),w=b.get("source_account");!w||!no.includes(w)||(x({kind:w,ok:b.get("result")==="connected",reason:b.get("reason")??""}),window.history.replaceState(null,"",`${window.location.pathname}${window.location.hash}`))},[]);const y=no.filter(b=>xb.includes(b)||u.includes(b)||i?.some(w=>w.provider===b));async function v(b,w){d.busy||!await He({title:`Disconnect ${gn[b]}`,message:`Disconnect ${gn[b]} (${w})? Its secret is deleted from the server, and sessions you own can no longer read the workspaces' ${gn[b]} sources.`,confirmLabel:"Disconnect",destructive:!0})||d.run(async()=>{await ce(`/api/source-accounts/${b}`,{method:"DELETE"}),l()},`${gn[b]} disconnected.`)}return n.jsxs(Ae,{bare:!0,title:"Connected accounts",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Sessions you own work on the workspaces' sources with your own accounts here, through Pikibun."}),n.jsx("p",{children:$R}),n.jsx("p",{children:"Documents are read with your own connections: sign in to a provider, or for Notion, Google Drive and Feishu/Lark paste a secret. Their tokens and secrets are encrypted on the server, refreshed there, and never sent to any host, yours included. Each provider lets its connection read only what you share with it, and sessions read only what lies under the workspace's sources."}),n.jsx("p",{children:"Connecting an account doesn't change how you sign in; viewing a session, sharing a host or publishing an agent never grants access to your accounts."})]}),children:[n.jsx(IR,{}),n.jsxs("div",{className:"stack",id:"document-accounts",children:[n.jsx("div",{className:"section-header",children:n.jsx("h3",{className:"section-title",children:"Documents"})}),n.jsxs("div",{className:"card",children:[n.jsx(tt,{loading:a&&!i,error:r,retry:l,children:y.map(b=>{const w=i?.find(O=>O.provider===b),S=u.includes(b),C=xb.includes(b),k=n.jsxs(n.Fragment,{children:[S&&n.jsx(Ht,{variant:w?"ghost":"outline",size:"sm",href:`/api/source-accounts/${b}/oauth/start`,children:w?"Sign in again":"Sign in"}),C&&n.jsx(q,{variant:w||S?"ghost":"outline",size:"sm",disabled:d.busy,onClick:()=>p(b),children:S?"Paste secret":w?"Replace":"Connect"})]});return n.jsx(W,{leading:n.jsx(be,{name:"file",size:16}),title:gn[b],hint:w?`${w.name}${w.method==="oauth"?" · signed in":""}`:"Not connected",trailing:w?n.jsxs(n.Fragment,{children:[n.jsx(ge,{tone:"success",children:"Connected"}),k,n.jsx(q,{variant:"ghost",size:"sm",disabled:d.busy,"aria-label":`Disconnect ${gn[b]}`,onClick:()=>{v(b,w.name)},children:"Disconnect"})]}):k},b)})}),m&&n.jsx(ke,{children:n.jsx(ye,{...m.ok?{notice:`${gn[m.kind]} connected.`,error:""}:{notice:"",error:`${gn[m.kind]} wasn't connected${m.reason==="access_denied"?": the sign-in was cancelled":m.reason?` (${m.reason})`:""}. Try again.`}})}),(d.error||d.notice)&&n.jsx(ke,{children:n.jsx(ye,{...d})})]})]}),n.jsx(hj,{provider:h,close:()=>p(null),connected:l})]})}function hj({provider:e,close:i,connected:a,save:r}){const[l,u]=N.useState(""),[d,h]=N.useState(""),[p,m]=N.useState("feishu"),x=je();function y(){u(""),h(""),m("feishu")}function v(){x.busy||(y(),i())}const b=!!(l.trim()&&(e!=="feishu"||d.trim()));function w(C){if(C.preventDefault(),!e||!b||x.busy)return;const k=e==="notion"?{token:l.trim()}:e==="google-drive"?{key:l}:{appId:d.trim(),appSecret:l.trim(),domain:p};x.run(async()=>{try{r?await r(e,k):await ce(`/api/source-accounts/${e}`,{method:"PUT",body:k})}finally{u("")}y(),a(),i()})}const S=e?gn[e]:"";return n.jsx(qt,{open:e!==null,title:`Connect ${S}${r?" for the workspace":""}`,onClose:v,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:x.busy,onClick:v,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"source-account-form",disabled:!b||x.busy,children:x.busy?"Verifying...":"Connect"})]}),children:n.jsxs("form",{id:"source-account-form",className:"stack",onSubmit:w,children:[e&&n.jsxs("p",{className:"muted small",children:[YR[e]," Pikibun verifies it with ",S,", then encrypts it on the server."]}),e&&r&&n.jsx("p",{className:"muted small",children:"This is the workspace's connection: every member's sessions read the sources set to it with it. Share with it only what the workspace should read."}),e==="notion"&&n.jsx(xe,{label:"Internal integration secret",children:n.jsx("input",{className:"input",required:!0,type:"password",value:l,onChange:C=>u(C.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,placeholder:"ntn_…"})}),e==="google-drive"&&n.jsx(xe,{label:"Service account JSON key",hint:"The whole key file. Only its email and private key are kept",children:n.jsx("textarea",{className:"input",required:!0,rows:6,value:l,onChange:C=>u(C.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,placeholder:'{"type": "service_account", …}'})}),e==="feishu"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Platform"}),n.jsx(Xt,{label:"Platform",value:p,disabled:x.busy,options:[{value:"feishu",label:"Feishu",hint:"open.feishu.cn"},{value:"lark",label:"Lark",hint:"open.larksuite.com"}],onChange:m})]}),n.jsx(xe,{label:"App ID",children:n.jsx("input",{className:"input",required:!0,value:d,onChange:C=>h(C.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1,placeholder:"cli_…"})}),n.jsx(xe,{label:"App Secret",children:n.jsx("input",{className:"input",required:!0,type:"password",value:l,onChange:C=>u(C.target.value),disabled:x.busy,autoComplete:"off",spellCheck:!1})})]}),n.jsx(ye,{error:x.error})]})})}function XR({workspaceId:e,workspaceName:i,admin:a,sources:r,loading:l,error:u,refresh:d,changed:h,connections:p}){const m=je(),x=GR(a),[y,v]=N.useState(!1),b=no.filter(O=>x.accounts?.some(T=>T.provider===O)),w=no.filter(O=>wb(p,O)),S=no.filter(O=>b.includes(O)||w.includes(O)),C=(r?.length??0)>=yb.documents;async function k(O){m.busy||!a||!await He({title:"Remove source",message:`Remove ${O.title} (${gn[O.kind]}) from ${i}? Sessions, running ones too, can no longer read it or what is under it.`,confirmLabel:"Remove",destructive:!0})||m.run(async()=>{await ce(`/api/workspaces/${oe(e)}/sources/${oe(O.id)}`,{method:"DELETE"}),d(),h()},"Source removed.")}return n.jsxs("div",{className:"stack",children:[n.jsxs("div",{className:"section-header",children:[n.jsx("h3",{className:"section-title",children:"Documents"}),n.jsx("span",{className:"spacer"}),a&&S.length>0&&!C&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",disabled:l||!!u||m.busy,onClick:()=>v(!0),children:"Add document source"})]}),n.jsx("div",{className:"card",children:n.jsxs(tt,{loading:l,error:u,retry:d,children:[r?.length?r.map(O=>n.jsx(W,{leading:n.jsx(be,{name:"file",size:16}),title:O.title,hint:n.jsxs(n.Fragment,{children:[gn[O.kind]," · ",VR[O.itemType]," · ",n.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer",children:"Open"})]}),trailing:n.jsxs(n.Fragment,{children:[uj.includes(O.kind)&&n.jsx(dj,{workspaceId:e,sourceId:O.id,title:O.title,readAs:O.readAs,connection:wb(p,O.kind),admin:a,action:m,changed:h}),a&&n.jsx(q,{variant:"outline",size:"sm",disabled:m.busy,"aria-label":`Remove ${O.title}`,onClick:()=>{k(O)},children:"Remove"})]})},O.id)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"No documents yet. Sessions read a bound Notion page or a folder or document in Google Drive, Dropbox, OneDrive, Feishu/Lark or Tencent Docs, and what is under it, with their owner's own connection"})}),(m.error||m.notice)&&n.jsx(ke,{children:n.jsx(ye,{...m})})]})}),a&&x.accounts&&!S.length&&n.jsx(we,{variant:"info",title:"Connect an account to add documents",actions:n.jsx(Ht,{variant:"outline",size:"sm",href:Xe({name:"settings",section:"profile"}),children:"Open profile"}),children:"Pikibun checks each item you add with your own connection to its provider, in Settings → Profile → Connected accounts, or with the workspace's connection under Connections."}),a&&C&&n.jsxs(we,{variant:"info",title:"Document source limit reached",children:["A workspace has at most ",yb.documents," document sources. Remove one to add another."]}),a&&S.length>0&&n.jsx(KR,{open:y,kinds:S,own:b,workspaceKinds:w,workspaceId:e,close:()=>v(!1),added:()=>{d(),h()}})]})}const QR={notion:"A page or database link (Share → Copy link). It must be shared with your Notion integration","google-drive":"A folder, file, Google Doc, Sheet or Slides link. It must be shared with your service account",feishu:"A folder, docx document or wiki page link. Your app must be added to it",dropbox:"A folder or file link, or its path in your Dropbox (/Specs). Shared folders must be added to your Dropbox",onedrive:"A OneDrive or SharePoint folder or file link","tencent-docs":"A Tencent Docs folder or document link (docs.qq.com/…)"};function KR({open:e,kinds:i,own:a,workspaceKinds:r,workspaceId:l,close:u,added:d}){const[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(""),b=je(),w=h||(i.length===1?i[0]:""),S=w?[...a.includes(w)?["members"]:[],...r.includes(w)?["workspace"]:[]]:[],C=y&&S.includes(y)?y:S[0]??"members";function k(){b.busy||(x(""),p(""),u())}function O(T){T.preventDefault(),!(!w||!m.trim()||b.busy)&&b.run(async()=>{await ce(`/api/workspaces/${oe(l)}/sources`,{method:"POST",body:{kind:w,target:m.trim(),readAs:C}}),x(""),p(""),v(""),d(),u()})}return n.jsx(qt,{open:e,title:"Add document source",onClose:k,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:b.busy,onClick:k,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"document-source-form",disabled:!w||!m.trim()||b.busy,children:b.busy?"Checking...":"Add source"})]}),children:n.jsxs("form",{id:"document-source-form",className:"stack",onSubmit:O,children:[n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Provider"}),n.jsx(Xt,{label:"Provider",placeholder:"Choose a provider",value:w,disabled:b.busy,options:i.map(T=>({value:T,label:gn[T]})),onChange:p})]}),S.length>1&&n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Reads with"}),n.jsx(Xt,{label:"Reads with",value:C,disabled:b.busy,onChange:v,options:[{value:"members",label:"Members' own accounts",hint:"Each session reads with its owner's own account; yours checks the link"},{value:"workspace",label:"Workspace connection",hint:"Every session reads with the workspace's connection, which checks the link"}]})]}),w&&n.jsx(xe,{label:"Link",hint:`${QR[w]}. ${C==="workspace"?"Every session reads it with the workspace's connection":"Each session reads it with its owner's own connection"}`,children:n.jsx("input",{className:"input",required:!0,value:m,onChange:T=>x(T.target.value),disabled:b.busy,autoComplete:"off",spellCheck:!1,placeholder:"https://…"})}),n.jsx(ye,{error:b.error})]})})}function WR(){const e=$e("/api/me/devices"),i=je();async function a(r){i.busy||!await He({title:"Sign out this app?",message:`${r.name??"This app"} is signed out at once and has to sign in again to reach your sessions.`,confirmLabel:"Sign out app",destructive:!0})||i.run(async()=>{await ce(`/api/me/devices/${oe(r.id)}`,{method:"DELETE"}),e.refresh()},"App signed out.")}return n.jsxs(Ae,{title:"Signed-in apps",info:"The Pikibun apps on your phone, tablet or computer that signed in as you. Each stays signed in for 30 days unless you sign it out here or in the app.",children:[n.jsxs(tt,{...e,retry:e.refresh,children:[e.data&&!e.data.devices.length&&n.jsx(W,{title:"No apps signed in",hint:"Sign in from the Pikibun app on iPhone, iPad or Mac"}),e.data?.devices.map(r=>n.jsx(W,{title:r.name??"Unnamed app",hint:n.jsxs(n.Fragment,{children:["Signed in ",n.jsx(Qt,{value:r.createdAt})," · until ",n.jsx(Qt,{value:r.expiresAt})]}),trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:i.busy,onClick:()=>{a(r)},children:"Sign out"})},r.id))]}),n.jsx(ye,{...i})]})}function JR(){const[e,i]=N.useState(""),[a,r]=N.useState(""),[l,u]=N.useState(""),d=je();function h(p){p.preventDefault(),d.run(async()=>{if(a!==l)throw new Error("The new passwords don't match.");await ce("/api/me/password",{method:"POST",body:{currentPassword:e,newPassword:a}}),i(""),r(""),u("")},"Password changed. Your other browsers are signed out.")}return n.jsxs("form",{className:"settings-form",onSubmit:h,children:[n.jsx(Ae,{title:"Password",info:"You sign in with your username and this password. Changing it signs out every other browser signed in as you.",children:n.jsxs(ke,{children:[n.jsx(xe,{label:"Current password",children:n.jsx("input",{className:"input",type:"password",required:!0,value:e,onChange:p=>i(p.target.value),autoComplete:"current-password",maxLength:256})}),n.jsx(xe,{label:"New password",hint:"At least 12 characters.",children:n.jsx("input",{className:"input",type:"password",required:!0,minLength:12,maxLength:256,value:a,onChange:p=>r(p.target.value),autoComplete:"new-password"})}),n.jsx(xe,{label:"Confirm new password",children:n.jsx("input",{className:"input",type:"password",required:!0,maxLength:256,value:l,onChange:p=>u(p.target.value),autoComplete:"new-password"})})]})}),n.jsxs("div",{className:"settings-actions",children:[n.jsx(ye,{...d}),n.jsx("span",{className:"spacer"}),n.jsx(q,{type:"submit",variant:"default",disabled:d.busy,children:d.busy?"Changing...":"Change password"})]})]})}function eM(){const{user:e,setUser:i,signOut:a}=pt(),[r,l]=N.useState(e.displayName),[u,d]=N.useState(e.gitName),[h,p]=N.useState(e.gitEmail),[m,x]=N.useState(()=>Object.entries(e.env).map(([w,S])=>({id:crypto.randomUUID(),key:w,value:S}))),y=je();function v(w){w.preventDefault(),y.run(async()=>{const S={};for(const k of m){if(!/^APP_[A-Z0-9_]+$/.test(k.key))throw new Error("Environment names must start with APP_ and contain only uppercase letters, digits, and underscores.");if(Object.hasOwn(S,k.key))throw new Error(`Duplicate environment name: ${k.key}`);S[k.key]=k.value}const C=await ce("/api/me",{method:"PATCH",body:{displayName:r,gitName:u,gitEmail:h,env:S}});i(C.user)},"Profile saved. New sessions use your configured identity.")}const b=(w,S)=>x(C=>C.map(k=>k.id===w?{...k,...S}:k));return n.jsxs(n.Fragment,{children:[n.jsxs("form",{className:"settings-form",onSubmit:v,children:[n.jsx(Ae,{title:"Identity",info:"Sessions you own act with this Git identity and your connected Git accounts. New sessions use the saved values.",children:n.jsxs(ke,{children:[n.jsx(xe,{label:"Display name",children:n.jsx("input",{className:"input",required:!0,maxLength:120,value:r,onChange:w=>l(w.target.value),autoComplete:"name"})}),n.jsx(xe,{label:"Git author name",children:n.jsx("input",{className:"input",required:!0,maxLength:120,value:u,onChange:w=>d(w.target.value)})}),n.jsx(xe,{label:"Git author email",children:n.jsx("input",{className:"input",required:!0,type:"email",value:h,onChange:w=>p(w.target.value),autoComplete:"email"})})]})}),n.jsxs(Ae,{title:"Environment",info:"Nonsecret APP_ variables only. They are sent to the host of every session you own. Never put Git tokens, provider keys or other credentials here; model credentials belong in Pi on your host.",action:n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>x(w=>[...w,{id:crypto.randomUUID(),key:"APP_",value:""}]),children:"Add variable"}),children:[!m.length&&n.jsx(W,{title:"No variables",hint:"Add APP_ variables your sessions need"}),m.map((w,S)=>n.jsx(W,{title:n.jsxs("span",{className:"env-row",children:[n.jsx("input",{className:"input","aria-label":`Variable ${S+1} name`,required:!0,pattern:"APP_[A-Z0-9_]+",placeholder:"APP_PROJECT",value:w.key,onChange:C=>b(w.id,{key:C.target.value}),autoComplete:"off",spellCheck:!1}),n.jsx("span",{className:"muted",children:"="}),n.jsx("input",{className:"input","aria-label":`Variable ${S+1} value`,value:w.value,onChange:C=>b(w.id,{value:C.target.value}),autoComplete:"off"})]}),trailing:n.jsx(q,{variant:"ghost",size:"sm",icon:"trash","aria-label":`Remove variable ${S+1}`,title:"Remove variable",onClick:()=>x(C=>C.filter(k=>k.id!==w.id))})},w.id))]}),n.jsxs("div",{className:"settings-actions",children:[n.jsx(ye,{...y}),n.jsx("span",{className:"spacer"}),n.jsx(q,{type:"submit",variant:"default",disabled:y.busy,children:y.busy?"Saving...":"Save profile"})]})]}),n.jsx(ZR,{}),e.passwordSignIn&&n.jsx(JR,{}),n.jsx(WR,{}),n.jsx(Xh,{}),n.jsxs(Ae,{title:"Account",children:[n.jsx(W,{title:"User ID",hint:n.jsx("code",{children:Mt(e)}),trailing:n.jsx(Ob,{value:e.id,label:"Copy user ID"})}),n.jsx(W,{title:"Sign out",trailing:n.jsx(q,{variant:"outline",size:"sm",onClick:a,children:"Sign out"})})]})]})}const tM={domains:100},jb={off:"Off",allowlist:"Allowlist",open:"Open"},nM={off:"Sandboxed commands reach only this workspace's repositories",allowlist:"The workspace's repositories, plus the domains below",open:"The workspace's repositories, plus any public host"};function sM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/network-policy`,r=$e(a),l=je(),[u,d]=N.useState("off"),[h,p]=N.useState(""),[m,x]=N.useState(!0),y=r.data?.policy;N.useEffect(()=>{y&&(d(y.mode),p(y.domains.join(`
|
|
59
|
+
`)),x(y.packageRegistries))},[y]);const v=h.split(/[\s,]+/).map(S=>S.trim().toLowerCase()).filter(Boolean),b=!!y&&(u!==y.mode||m!==y.packageRegistries||v.join(`
|
|
60
|
+
`)!==y.domains.join(`
|
|
61
|
+
`));function w(){!i||l.busy||l.run(async()=>{await ce(a,{method:"PUT",body:{mode:u,domains:v,packageRegistries:m}}),r.refresh()},"Network access saved. Running sessions pick it up within a minute.")}return n.jsx(Ae,{title:"Network access",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can change network access."}),n.jsx("p",{children:"Sandboxed shell commands have no direct network. Everything goes through the host's egress proxy: Git reads of this workspace's repositories always work, with the session owner's own account, which never leaves Pikibun."}),n.jsx("p",{children:"This setting decides what else is reachable over HTTPS. Addresses inside the host's own networks are never reachable. Hosts running without the sandbox aren't confined by it."}),n.jsx("p",{children:"Web search and page reading come from the workspace's extensions, which run on the host outside the sandbox: this setting doesn't confine them."})]}),children:n.jsx(tt,{loading:r.loading,error:r.error,retry:r.refresh,children:y&&n.jsxs(n.Fragment,{children:[n.jsx(W,{title:"Access",hint:nM[u],trailing:i?n.jsx(hs,{label:"Network access",value:u,onChange:d,options:["off","allowlist","open"].map(S=>({value:S,label:jb[S]}))}):n.jsx(ge,{tone:y.mode==="off"?"neutral":"success",children:jb[y.mode]})}),u==="allowlist"&&n.jsx(ke,{children:n.jsxs("div",{className:"stack",children:[n.jsx(xe,{label:"Allowed domains",hint:`One per line, up to ${tM.domains}. *.example.com allows its subdomains.`,children:n.jsx("textarea",{className:"textarea mono",rows:4,disabled:!i,value:h,onChange:S=>p(S.target.value),autoComplete:"off",spellCheck:!1,placeholder:"docs.example.com"})}),n.jsxs("label",{className:"check-row small",title:r.data.packageRegistryDomains.join(", "),children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:m,disabled:!i,onChange:S=>x(S.target.checked)}),n.jsx("span",{children:"Allow package registries (npm, PyPI, crates.io, Go, RubyGems, Maven, NuGet, Packagist)"})]})]})}),i&&(b||l.error||l.notice)&&n.jsx(ke,{children:n.jsxs("div",{className:"stack",children:[n.jsx(ye,{...l}),b&&n.jsx("div",{children:n.jsx(q,{variant:"default",size:"sm",disabled:l.busy,onClick:w,children:"Save network access"})})]})})]})})})}const fj={approval:"Approval",automatic:"Automatic"},iM=n.jsxs("div",{className:"stack",children:[n.jsxs("p",{children:["Pi extensions add tools, prompt text and hooks to this workspace's sessions. A session runs those enabled here that its host has installed at the same version: its host's owner installs them there, from the host's page or with ",n.jsx("code",{children:"pikibun extensions"}),"."]}),n.jsxs("p",{children:["Pikibun's built-in extensions come with every host's connector: ",n.jsx("code",{children:"piki:gh"}),", ",n.jsx("code",{children:"piki:glab"})," and ",n.jsx("code",{children:"piki:azure-cli"})," run the GitHub, GitLab or Azure CLI the host has installed and signed in. The workspace gets the one for a forge when it binds its first repository there."]}),n.jsx("p",{children:"Extensions run on the host, as its owner's OS user, outside the sandbox and the network access above. Their tool calls are approved like host commands, by the host's owner or a member granted host commands, unless you set their tools to run automatically and the host's owner allows that on their host."}),n.jsx("p",{children:"Settings are the extension's own options. Never put secrets in them: an extension reads keys on its host, which its owner sets up."})]});function aM(e,i){for(const a of i){const r=a.report?.installed.find(l=>l.source===e);if(r)return r.modules.flatMap(l=>l.flags)}}function rM(e){return e?.modules.flatMap(i=>i.tools.map(a=>a.name))??[]}function oM(e,i){const a=new Map;for(const r of e.filter(l=>l.enabled)){const l=i.flatMap(u=>u.report?.installed??[]).find(u=>u.source===r.source);for(const u of new Set(rM(l)))a.set(u,[...a.get(u)??[],r.source])}return[...a].filter(([,r])=>r.length>1).map(([r,l])=>({tool:r,sources:l}))}function lM(e,i){return e?e.status==="installed"?n.jsx(ge,{tone:"success",children:_s(i)?"Available":"Installed"}):_s(i)?n.jsx(ge,{tone:"warning",children:"Update its connector"}):e.status==="other-version"?n.jsxs(ge,{tone:"warning",children:[e.installed.slice(e.installed.lastIndexOf("@")+1)," installed"]}):n.jsx(ge,{tone:"neutral",children:"Missing"}):n.jsx(ge,{tone:"neutral",children:"Not reported"})}function cM({workspace:e,userId:i}){const a=`/api/workspaces/${oe(e.id)}/extensions`,r=$e(a),l=je(),[u,d]=N.useState(null),h=r.data,p=h?.admin===!0;async function m(b,w="Extension saved. Sessions pick it up from their next message."){let S=!1;return await l.run(async()=>{const C=await ce(a,{method:"PUT",body:b});r.setData(k=>k&&{...k,...C}),S=!0},w),S&&r.refresh(),S}function x(b,w){l.run(async()=>{await ce(`/api/connectors/${oe(b.id)}/extensions/requests`,{method:"POST",body:{action:"install",source:w}})},`Asked ${b.name} to install it: it does within half a minute while it is online. Its page shows how it went.`)}function y(b){(async()=>await He({title:"Remove this extension?",message:n.jsxs(n.Fragment,{children:["Sessions stop running ",n.jsx("code",{children:b.source})," from their next message. Hosts keep it installed until their owners remove it."]}),confirmLabel:"Remove",destructive:!0})&&await l.run(async()=>{const w=await ce(`${a}?source=${encodeURIComponent(b.source)}`,{method:"DELETE"});r.setData(S=>S&&{...S,...w})},"Extension removed."))()}const v=h?oM(h.extensions,h.hosts):[];return n.jsxs(Ae,{title:"Extensions",bare:!0,info:iM,action:p&&(h?.extensions.length??0)<pO.workspace?n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d("new"),children:"Add extension"}):void 0,children:[n.jsx(tt,{loading:r.loading&&!h,error:r.error,retry:r.refresh,children:h&&n.jsxs("div",{className:"card",children:[!h.extensions.length&&n.jsx(xt,{title:"No extensions",children:p?"Add a Pi extension, such as npm:cc-safety-net@2.7.2 or piki:gh (the GitHub CLI), to run it in this workspace's sessions.":"Owners and admins add the Pi extensions this workspace's sessions run."}),h.extensions.map(b=>{const w=h.hosts.filter(C=>C.availability?.[b.source]?.status==="installed").length,S=bc(b.source);return n.jsxs(ns,{leading:n.jsx(be,{name:"tool",size:16}),title:S?n.jsxs(n.Fragment,{children:[S.title," ",n.jsx("code",{children:b.source})]}):n.jsx("code",{children:b.source}),hint:`Tools: ${fj[b.tools].toLowerCase()} · ${S?"on":"installed on"} ${w} of ${h.hosts.length} ${h.hosts.length===1?"host":"hosts"}`,trailing:b.enabled?n.jsx(ge,{tone:"success",children:"On"}):n.jsx(ge,{tone:"neutral",children:"Off"}),children:[h.hosts.map(C=>{const k=C.availability?.[b.source],O=!S&&C.ownerId===i&&C.report?.remoteInstalls===!0&&k&&k.status!=="installed";return n.jsx(W,{leading:n.jsx(be,{name:"server",size:16}),title:C.name,hint:`Hosted by ${C.ownerId===i?"you":C.ownerName}`,trailing:n.jsxs("span",{className:"inline",children:[lM(k,b.source),O&&n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>x(C,b.source),children:k.status==="other-version"?"Update":"Install"})]})},C.id)}),!h.hosts.length&&n.jsx(W,{title:"No hosts",hint:"No host is connected to this workspace yet"}),S&&n.jsx(ke,{children:n.jsxs("p",{className:"muted small",children:[S.description,S.tool&&S.install&&S.account&&n.jsxs(n.Fragment,{children:[" Each host needs ",n.jsx("code",{children:S.tool})," installed (",n.jsx("a",{href:S.install,target:"_blank",rel:"noreferrer",children:S.install}),") where its sandbox finds it. It acts as the session's owner, with ",S.account," in Pikibun: it reads the workspace's repositories, and writes only in a call a person approved, on the session owner's own host. Turn on ",n.jsx("strong",{children:"read-only"})," under Edit before running its tools automatically."]})]})}),p&&n.jsx(ke,{children:n.jsxs("div",{className:"inline",children:[n.jsxs("label",{className:"check-row small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:b.enabled,disabled:l.busy,onChange:C=>{m({...b,enabled:C.target.checked},C.target.checked?"Extension on.":"Extension off.")}}),n.jsx("span",{children:"Enabled"})]}),n.jsx("span",{className:"spacer"}),n.jsx(q,{variant:"outline",size:"sm",icon:"pencil",disabled:l.busy,onClick:()=>d(b),children:"Edit"}),n.jsx(q,{variant:"ghost",size:"sm",icon:"trash",disabled:l.busy,onClick:()=>y(b),children:"Remove"})]})})]},b.source)}),v.map(b=>n.jsx(ke,{children:n.jsxs(we,{variant:"warning",title:`Two extensions offer ${b.tool}`,children:[b.sources.join(" and ")," both register a tool named ",n.jsx("code",{children:b.tool}),". Sessions keep the first one's, in this list's order, and leave out the other's."]})},b.tool)),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})}),u&&h&&n.jsx(uM,{extension:u==="new"?void 0:u,taken:h.extensions,flags:u==="new"?void 0:aM(u.source,h.hosts),close:()=>d(null),save:async b=>{await m(b)&&d(null)},busy:l.busy,error:l.error})]})}function uM({extension:e,taken:i,flags:a,close:r,save:l,busy:u,error:d}){const[h,p]=N.useState(e?.source??""),[m,x]=N.useState(e?.tools??"approval"),[y,v]=N.useState(e?.settings??{});let b,w="";try{b=h.trim()?Tw(h.trim()):void 0}catch(_){w=_ instanceof Error?_.message:"Invalid source"}const S=!e&&b?i.find(_=>Yy(_.source)===Yy(b)):void 0,C=b?bc(b):void 0,k=xR().filter(_=>!i.some($=>$.source===_.source)),O=!!e&&_s(e.source),T=Object.keys(y).filter(_=>!a?.some($=>$.name===_));function M(_){_.preventDefault(),b&&l({source:b,enabled:e?.enabled??!0,tools:m,settings:y})}return n.jsx(qt,{open:!0,title:e?"Edit extension":"Add extension",onClose:()=>{u||r()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:u,onClick:r,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"extension-form",disabled:u||!b,children:u?"Saving...":"Save"})]}),children:n.jsxs("form",{id:"extension-form",className:"stack",onSubmit:M,children:[!e&&!!k.length&&n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Command-line tools"}),n.jsx("div",{className:"inline",children:k.map(_=>n.jsx(q,{variant:b===_.source?"default":"outline",size:"sm",disabled:u,onClick:()=>p(_.source),children:_.title},_.source))}),n.jsx("span",{className:"field-hint",children:"These come with every host's connector: each host needs only the command itself, signed in by its owner."})]}),n.jsx(xe,{label:"Source",hint:O?"Built into the connector: its version is each host's connector's":e?"Change the version to move every host to it: until a host's owner installs it there, sessions on that host run without it":"npm:<package>@<exact version>, git:<https URL>@<full commit>, or piki:<name>. A Pi extension package, pinned",error:w,children:n.jsx("input",{className:"input mono",value:h,onChange:_=>p(_.target.value),disabled:u||O,autoComplete:"off",spellCheck:!1,maxLength:512,placeholder:"npm:cc-safety-net@2.7.2",autoFocus:!e})}),C&&n.jsxs("p",{className:"muted small",children:[C.description,C.tool&&n.jsxs(n.Fragment,{children:[" It runs ",n.jsx("code",{children:C.tool})," as the host's owner is signed in to it."]})]}),S&&n.jsxs("p",{className:"muted small",children:["The workspace uses ",S.source,": this replaces it, in its place."]}),n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Tools"}),n.jsx(hs,{label:"Tools",value:m,onChange:x,options:["approval","automatic"].map(_=>({value:_,label:fj[_]}))}),n.jsx("span",{className:"field-hint",children:m==="approval"?"Each tool call waits for the host's owner, or a member granted host commands, to approve it.":"Tool calls run at once, outside the sandbox, on hosts whose owner lets workspaces do that; elsewhere they still wait for approval."})]}),e&&(a===void 0?n.jsx("p",{className:"muted small",children:"Its settings show here once a host that has it installed reports them."}):!a.length&&!T.length?n.jsx("p",{className:"muted small",children:"This extension has no settings."}):n.jsxs("div",{className:"stack",children:[n.jsx(aj,{flags:a,settings:y,onChange:v,busy:u}),n.jsx("p",{className:"muted small",children:"Never put secrets here: every member of the workspace can read these, and they are in its audit log."})]})),n.jsx(ye,{error:d})]})})}function dM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/transcripts`,r=$e(a),l=je(),u=r.data?.settings,d=u?.paging,h=u?u.toolOutput!=="brief":void 0;function p(x){!i||l.busy||x===d||l.run(async()=>{await ce(a,{method:"PUT",body:{paging:x}}),r.refresh()},x?"Transcripts load latest messages first. Open sessions switch within a few seconds.":"Transcripts load whole again. Open sessions switch within a few seconds.")}function m(x){!i||l.busy||x===h||l.run(async()=>{await ce(a,{method:"PUT",body:{toolOutput:x?"full":"brief"}}),r.refresh()},x?"New sessions start with full tool output. Existing sessions keep theirs.":"New sessions start with brief tool output. Existing sessions keep theirs.")}return n.jsx(Ae,{title:"Transcripts",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can change these."}),n.jsxs("p",{children:["With latest messages first, a session opens with the newest ",jh.size," entries of each conversation, and earlier ones load as you scroll up. Long sessions open much faster this way; your browser's find on the page only searches what has loaded."]}),n.jsx("p",{children:"Full tool output sets how new sessions here start: with every tool result in full, or with one line per tool result and long tool calls cut short. Each session's owner can still change their session's under its Details, and changing this leaves existing sessions as they are."}),n.jsx("p",{children:"Hosts still send Pikibun whole transcripts; these change only what reaches each viewer."})]}),children:n.jsxs(tt,{loading:r.loading,error:r.error,retry:r.refresh,children:[d!==void 0&&n.jsx(W,{title:"Latest messages first",hint:d?`Sessions open with the newest ${jh.size} entries of each conversation`:"Sessions open with their whole transcript",trailing:i?n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Load latest messages first",checked:d,disabled:l.busy,onChange:x=>p(x.target.checked)}):n.jsx(ge,{tone:d?"success":"neutral",children:d?"On":"Off"})}),h!==void 0&&n.jsx(W,{title:"Full tool output",hint:h?"New sessions show every tool result in full":"New sessions show one line per tool result",trailing:i?n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Full tool output for new sessions",checked:h,disabled:l.busy,onChange:x=>m(x.target.checked)}):n.jsx(ge,{tone:h?"success":"neutral",children:h?"On":"Off"})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})})}const hM=1024*1024,hh=[1,2,5,10,20,25,50].map(e=>e*hM).filter(e=>e>=Us.minBytes&&e<=Us.maxBytes);function fM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/attachments`,r=$e(a),l=je(),u=r.data?.settings.maxFileBytes,d=u===void 0||hh.includes(u)?hh:[...hh,u].sort((p,m)=>p-m);function h(p){!i||l.busy||p===u||l.run(async()=>{await ce(a,{method:"PUT",body:{maxFileBytes:p}}),r.refresh()},`Files up to ${pi(p)} can now be attached to messages here.`)}return n.jsx(Ae,{title:"Attachments",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can change this."}),n.jsxs("p",{children:["Files attached to a message, other than the images the model looks at, are uploaded into the session's worktree, under ",n.jsx("code",{children:"attachments/"}),", before the message is sent, and the message tells the agent where they are. This is the largest file one message may carry; it is ",pi(Us.defaultBytes)," until changed, and at most ",pi(Us.maxBytes),"."]}),n.jsx("p",{children:"In the Pikibun desktop app, a file attached to a session that runs on that same computer goes straight to its host there; elsewhere it goes through this server to the session's host."})]}),children:n.jsxs(tt,{loading:r.loading,error:r.error,retry:r.refresh,children:[u!==void 0&&n.jsx(W,{title:"Largest attached file",hint:"Each file attached to a message, uploaded into the session's worktree",trailing:i?n.jsx("select",{className:"select compact","aria-label":"Largest attached file",value:u,disabled:l.busy,onChange:p=>h(Number(p.target.value)),children:d.map(p=>n.jsx("option",{value:p,children:pi(p)},p))}):n.jsx(ge,{tone:"neutral",children:pi(u)})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})})}function mM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/child-sessions`,r=$e(a),l=je(),u=r.data?.settings.childModels;function d(h){!i||l.busy||h===u||l.run(async()=>{await ce(a,{method:"PUT",body:{childModels:h}}),r.refresh()},h?"Agents now choose the model and reasoning level of each session they start, to suit its task.":"Sessions that agents start now run on their parent session's model and reasoning level.")}return n.jsx(Ae,{title:"Sub-task sessions",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can change this."}),n.jsxs("p",{children:["A session's agent can start other sessions for sub-tasks with its ",n.jsx("code",{children:"sessions"})," tool. With this on, it chooses each one's model, among those the person it works for can use here, and the reasoning level its first message runs at: a capable model thinking hard for difficult work, a fast one thinking little for simple work. What it leaves out is the same as its own session's."]}),n.jsx("p",{children:"With this off, every session an agent starts runs on its parent session's current model and reasoning level. People still choose models and reasoning in any session's chat themselves."})]}),children:n.jsxs(tt,{loading:r.loading,error:r.error,retry:r.refresh,children:[u!==void 0&&n.jsx(W,{title:"Agents choose models for sub-tasks",hint:u?"Each session an agent starts runs on the model and reasoning level it chose for its task":"Sessions agents start run on their parent's model and reasoning level",trailing:i?n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Let agents choose the model and reasoning level of sessions they start",checked:u,disabled:l.busy,onChange:h=>d(h.target.checked)}):n.jsx(ge,{tone:u?"success":"neutral",children:u?"On":"Off"})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})})}function pM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/approvals`,r=$e(a),l=je(),u=r.data?.settings.requesterAutoApprove;function d(h){!i||l.busy||h===u||l.run(async()=>{await ce(a,{method:"PUT",body:{requesterAutoApprove:h}}),r.refresh()},h?"Session owners can now choose Always approve on other members' approval cards.":"Other members' requests ask again everywhere. Session owners' choices are kept for when this is turned back on.")}return n.jsx(Ae,{title:"Approvals",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can change this."}),n.jsxs("p",{children:["Approved operations run as the session's owner, with their Git and GitHub access. With this on, a session's owner can choose ",n.jsx("strong",{children:"Always approve"})," on an approval card from another member, and that member's later commands, pushes, and GitHub comments and issues in that session run without asking."]}),n.jsx("p",{children:"Each owner decides for their own sessions and members, and can stop it in the session panel, under Details › People. Merges, host commands, commands without the host's resource limits, and anything the session doesn't allow yet still ask."}),n.jsx("p",{children:"Turning this off makes those requests ask again in every session; owners' choices are kept and apply again if it's turned back on."})]}),children:n.jsxs(tt,{loading:r.loading,error:r.error,retry:r.refresh,children:[u!==void 0&&n.jsx(W,{title:"Auto-approve other members' requests",hint:u?"Session owners can choose to always approve another member's requests":"Only each session's owner can run things without asking, in their own messages",trailing:i?n.jsx("input",{type:"checkbox",className:"checkbox",role:"switch","aria-label":"Let session owners auto-approve other members' requests",checked:u,disabled:l.busy,onChange:h=>d(h.target.checked)}):n.jsx(ge,{tone:u?"success":"neutral",children:u?"On":"Off"})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]})})}const Fh={"github-app":"GitHub App","entra-federation":"Entra workload identity federation","bitbucket-client-credentials":"Bitbucket OAuth consumer","oauth-refresh":"OAuth app authorized by a bot account","forgejo-integration":"Forgejo authorized integration","owner-account":"Session owner's account","host-credentials":"Host's Git credentials"},gM={github:"the GitHub account they signed in with","github-enterprise":"the GitHub Enterprise token they connected, which needs Contents write (or classic repo)",gitlab:"the GitLab token they connected, which needs write_repository (or api)",bitbucket:"the Bitbucket API token they connected, which needs write:repository:bitbucket","azure-devops":"the Azure DevOps token they connected, which needs Code (Read & write)",gitea:"the Gitea token they connected, which needs write:repository",git:"the Git server account they connected, which needs write access"},xM="api://AzureADTokenExchange";function yM({workspace:e,admin:i}){const a=`/api/workspaces/${oe(e.id)}/push-identities`,r=$e(a),l=je(),[u,d]=N.useState(null);async function h(x){await He({title:"Remove push identity",message:`Remove the ${fh(x)} push identity (${Fh[x.kind]})? Agents can no longer push to these repositories until another identity is configured.`,confirmLabel:"Remove",destructive:!0})&&l.run(async()=>{await ce(`${a}/${oe(x.id)}`,{method:"DELETE"}),r.refresh()},"Push identity removed.")}function p(x){l.run(async()=>{const y=await ce(`${a}/${oe(x.id)}/authorize`,{method:"POST"});window.location.assign(y.url)})}const m=r.data;return n.jsxs(Ae,{title:"Push access",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can manage push identities."}),n.jsx("p",{children:"Agents push with short-lived credentials minted from these workspace app or bot identities, held only in the host's memory. An identity can instead push with the session owner's own account or the host's own Git credentials, for sessions on the owner's own hosts. The session owner must also be able to push to the repository, and to the branch where the Git host reports branch permissions; pull requests are opened as the session owner."}),n.jsxs("p",{children:["Except for GitHub, the minted token carries everything the identity can reach until it expires, and the host running the session receives it. Give bot accounts, OAuth consumers, service principals and integrations access only to this workspace's repositories; for Forgejo integrations, add claim rules on the ",n.jsx("code",{children:"repository"})," and ",n.jsx("code",{children:"ref"})," claims."]}),n.jsx("p",{children:"Secrets are write-only: they are never shown again after saving."})]}),action:i&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d({provider:"github"}),children:"Add identity"}),children:[n.jsxs(tt,{...r,retry:r.refresh,children:[m?.githubApp&&n.jsx(W,{title:`Operator GitHub App (${m.githubApp.slug})`,hint:"Used for github.com repositories without a workspace GitHub App. Install it on the repositories agents should push to",trailing:n.jsx(Ht,{variant:"outline",size:"sm",href:m.githubApp.installUrl,target:"_blank",rel:"noreferrer",children:"Install"})}),m?.identities.length?m.identities.map(x=>n.jsx(W,{title:fh(x),hint:n.jsxs(n.Fragment,{children:[Fh[x.kind],x.config.slug?n.jsxs(n.Fragment,{children:[" · ",n.jsx("code",{children:x.config.slug})]}):null,x.config.login?n.jsxs(n.Fragment,{children:[" · bot ",n.jsx("code",{children:x.config.login})]}):null]}),trailing:n.jsxs(n.Fragment,{children:[n.jsx(ge,{tone:x.status==="ready"?"success":"warning",children:x.status==="ready"?"Ready":"Authorization required"}),i&&x.kind==="oauth-refresh"&&n.jsx(q,{variant:"outline",size:"sm",disabled:l.busy,onClick:()=>p(x),children:"Authorize"}),i&&n.jsx(ss,{label:`Actions for ${fh(x)}`,items:[{label:"Replace",icon:"refresh",disabled:l.busy,onSelect:()=>d({provider:x.provider,identity:x})},{label:"Remove",icon:"trash",destructive:!0,disabled:l.busy,onSelect:()=>{h(x)}}]})]})},x.id)):!m?.githubApp&&n.jsx(ke,{children:n.jsx("span",{className:"muted",children:i?"No push identities yet. Add one per provider so agents can push":"No push identities yet. Ask a workspace owner or admin to add one"})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]}),i&&u&&n.jsx(bM,{path:a,oidc:m?.oidc??null,redirectUri:m?.redirectUri??null,initial:u,close:()=>d(null),saved:r.refresh},u.identity?.id??"new")]})}function fh(e){return`${uc(e.provider,e.host)}${e.scope?` · ${e.scope}`:""}`}function bM({path:e,oidc:i,redirectUri:a,initial:r,close:l,saved:u}){const d=r.identity,[h,p]=N.useState(r.provider),[m,x]=N.useState(d?.kind??Tl[r.provider][0]),[y,v]=N.useState(d?.host??us[r.provider].default??""),[b,w]=N.useState(d?.scope??""),[S,C]=N.useState(d?{...d.config}:{}),[k,O]=N.useState(""),[T,M]=N.useState(null),_=je(),$=us[h].fixed,G=h==="azure-devops"||h==="bitbucket",J=de=>S[de]??"",U=(de,R)=>C(D=>({...D,[de]:R}));function E(de){p(de),x(Tl[de][0]),v(us[de].default??""),w(""),C({}),O("")}const I={"github-app":["appId","slug"],"entra-federation":["tenantId","clientId"],"bitbucket-client-credentials":["key"],"oauth-refresh":["clientId"],"forgejo-integration":["audience"],"owner-account":[],"host-credentials":[]},Q=m==="github-app"||m==="bitbucket-client-credentials"||m==="oauth-refresh",ie=!!(($||y.trim())&&(!G||b.trim())&&I[m].every(de=>J(de).trim())&&(!Q||k.trim()));function re(){_.busy||l()}function Y(de){if(de.preventDefault(),!ie||_.busy)return;const R={provider:h,kind:m,...$?{}:{host:y.trim()},...G?{scope:b.trim()}:{},config:Object.fromEntries(I[m].map(D=>[D,J(D).trim()])),...Q?{secret:m==="github-app"?k:k.trim()}:{}};_.run(async()=>{const D=await ce(e,{method:"POST",body:R});O(""),u(),D.identity.kind==="oauth-refresh"?M(D.identity):l()})}function F(de){_.run(async()=>{const R=await ce(`${e}/${oe(de.id)}/authorize`,{method:"POST"});window.location.assign(R.url)})}const B=(de,R,D,ee)=>n.jsx(xe,{label:R,hint:D,children:n.jsx("input",{className:"input",required:!0,value:J(de),onChange:z=>U(de,z.target.value),autoComplete:"off",spellCheck:!1,placeholder:ee})}),se=de=>i?n.jsxs("div",{className:"stack",children:[n.jsx(Yn,{label:"Issuer",value:i.issuer}),n.jsx(Yn,{label:"Subject",value:i.subject}),de&&n.jsx(Yn,{label:"Audience",value:de})]}):n.jsx(we,{variant:"warning",title:"OIDC issuer unavailable",children:"The operator has not configured Pikibun's OIDC signing key, so this identity cannot be used yet."});return n.jsx(qt,{open:!0,title:d?"Replace push identity":"Add push identity",onClose:re,footer:T?n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:_.busy,onClick:l,children:"Later"}),n.jsx(q,{variant:"default",disabled:_.busy,onClick:()=>F(T),children:"Authorize"})]}):n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:_.busy,onClick:re,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"push-identity-form",disabled:!ie||_.busy,children:_.busy?"Verifying...":"Save"})]}),children:T?n.jsxs("div",{className:"stack",children:[n.jsxs("p",{children:["Saved. Sign in to ",uc(T.provider,T.host)," as the bot account, then authorize the OAuth app so Pikibun can mint push tokens."]}),n.jsx(ye,{error:_.error})]}):n.jsxs("form",{id:"push-identity-form",className:"stack",onSubmit:Y,children:[n.jsx(xe,{label:"Provider",hint:d?"Saving replaces the identity for the same provider, host and scope":void 0,children:n.jsx("select",{className:"select",value:h,disabled:!!d,onChange:de=>E(de.target.value),children:iv.map(de=>n.jsx("option",{value:de,children:Zn[de]},de))})}),Tl[h].length>1&&n.jsx(xe,{label:"Identity type",children:n.jsx("select",{className:"select",value:m,onChange:de=>{x(de.target.value),C({}),O("")},children:Tl[h].map(de=>n.jsx("option",{value:de,children:Fh[de]},de))})}),!$&&n.jsx(xe,{label:"Host",hint:"Hostname of the instance, for example git.example.com",children:n.jsx("input",{className:"input",required:!0,value:y,disabled:!!d,onChange:de=>v(de.target.value),autoComplete:"off",spellCheck:!1,placeholder:"git.example.com"})}),G&&n.jsx(xe,{label:h==="azure-devops"?"Azure DevOps organization":"Bitbucket workspace",children:n.jsx("input",{className:"input",required:!0,value:b,disabled:!!d,onChange:de=>w(de.target.value),autoComplete:"off",spellCheck:!1})}),m==="github-app"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"muted small",children:"Create a GitHub App with Repository contents read & write and install it on the repositories agents push to."}),B("appId","App ID"),B("slug","App slug","From the app's public URL: github.com/apps/<slug>"),n.jsx(xe,{label:"Private key",hint:"PEM file contents. Write-only",children:n.jsx("textarea",{className:"textarea mono",required:!0,value:k,onChange:de=>O(de.target.value),autoComplete:"off",spellCheck:!1,placeholder:"-----BEGIN RSA PRIVATE KEY-----"})})]}),m==="entra-federation"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"muted small",children:"Register a Microsoft Entra app, add its service principal to the Azure DevOps organization with Code (Read & write) on the repositories, and add a federated credential with these values:"}),se(xM),B("tenantId","Tenant ID",void 0,"00000000-0000-0000-0000-000000000000"),B("clientId","Client ID",void 0,"00000000-0000-0000-0000-000000000000")]}),m==="bitbucket-client-credentials"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"muted small",children:"Create an OAuth consumer in the Bitbucket workspace settings with the Repositories: Write permission, marked as a private consumer."}),B("key","Key"),n.jsx(xe,{label:"Secret",hint:"Write-only",children:n.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:de=>O(de.target.value),autoComplete:"new-password"})})]}),m==="oauth-refresh"&&n.jsxs(n.Fragment,{children:[n.jsxs("p",{className:"muted small",children:["Register an OAuth application on the instance (",h==="gitlab"?"scopes write_repository and read_user":"scopes write:repository and read:user, Gitea 1.23 or later",") with this redirect URI. After saving, sign in as a dedicated bot account with push access and authorize it."]}),a?n.jsx(Yn,{label:"Redirect URI",value:a}):n.jsx(we,{variant:"warning",title:"Redirect URI unavailable",children:"The operator has not configured Pikibun's application origin, so this identity cannot be authorized yet."}),B("clientId","Client ID"),n.jsx(xe,{label:"Client secret",hint:"Write-only",children:n.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:de=>O(de.target.value),autoComplete:"new-password"})})]}),m==="forgejo-integration"&&n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"muted small",children:"As a bot account with push access (Forgejo 16 or later), create a Generic JWT authorized integration trusting this issuer and subject, then enter its audience."}),se(""),B("audience","Audience")]}),m==="owner-account"&&n.jsxs("p",{className:"muted small",children:["Agents push as the session owner, with ",gM[h]," (Settings → Profile → Connected accounts). Only sessions on the owner's own hosts push this way: the token is sent to that host for each push and held only in its memory. ",h==="github"?"Pikibun resets it when the push ends, so the host's copy stops working while the owner stays connected.":"It stays valid after the push: these tokens can't be reset."]}),m==="host-credentials"&&n.jsx("p",{className:"muted small",children:"Agents push with the Git credentials set up on the host running the session, read through its Git credential helpers (for example gh auth setup-git, the macOS keychain or Git Credential Manager). Only the host's owner pushes this way, in sessions on their own host, once they turn on Git credentials in its configuration (Settings → Hosts)."}),n.jsx(ye,{error:_.error})]})})}const mj=[{minutes:null,label:"Off"},{minutes:15,label:"Every 15 minutes"},{minutes:60,label:"Every hour"},{minutes:360,label:"Every 6 hours"},{minutes:1440,label:"Every day"}];function kb(e){return mj.find(i=>i.minutes===e)?.label??`Every ${e} minutes`}function vM(e){return e?"session backups are kept in the server's backup storage":"this server keeps no session backups, as it has no backup storage of its own (STORAGE_URL)"}const wM=32*1024*1024,jM={"verify-full":"TLS, server certificate verified",require:"TLS, server certificate not verified",disable:"Unencrypted"};function ac(e){return`${e.host.includes(":")?`[${e.host}]`:e.host}:${e.port}/${e.database}`}function kM(e){const i=e.trim(),a=/^postgres(?:ql)?:\/\//i.exec(i);if(!a)throw new Error("Use a postgres:// or postgresql:// URL.");const r=new URL(`http://${i.slice(a[0].length)}`);if(!r.hostname)throw new Error("The URL has no host.");return{host:r.hostname.replace(/^\[(.*)\]$/,"$1"),port:r.port||"5432",database:decodeURIComponent(r.pathname.replace(/^\//,"")),user:decodeURIComponent(r.username),password:decodeURIComponent(r.password),unencrypted:r.searchParams.get("sslmode")==="disable"}}function SM({workspace:e,owner:i}){const a=`/api/workspaces/${oe(e.id)}/database`,r=$e(a),l=je(),[u,d]=N.useState(!1),[h,p]=N.useState(!1),m=r.data,x=m?.database??null;async function y(){!x||l.busy||!await He({title:"Disconnect database",message:`Disconnect ${ac(x)}? ${m?.backupStorage?"New session backups go to the server's backup storage again.":"This server has no backup storage of its own, so no new session backups can be saved."} Backups already saved in that database stay there, but can't be downloaded or restored until it is connected again.`,confirmLabel:"Disconnect",destructive:!0})||l.run(async()=>{await ce(a,{method:"DELETE"}),r.refresh()},m?.backupStorage?"Database disconnected. New session backups go to the server's backup storage.":"Database disconnected. This server keeps no session backups without one.")}const v=[...m?.available?[{label:"Import dump",icon:"folder",hint:"A session or workspace export",disabled:l.busy,onSelect:()=>p(!0)},{label:"Replace",icon:"refresh",disabled:l.busy,onSelect:()=>d(!0)}]:[],{label:"Disconnect",icon:"trash",destructive:!0,disabled:l.busy,onSelect:()=>{y()}}],b=vM(m?.backupStorage??!1),w=m?.available?i?`No database connected, so ${b}`:`No database connected, so ${b}. Only the workspace owner can connect one`:`Session databases are turned off on this server, so ${b}. The server's operator can turn them on with WORKSPACE_DATABASES=true`;return n.jsxs(Ae,{title:"Session database",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"The workspace owner can connect a Postgres database of their own. Backups of this workspace's sessions are then saved there, with each session's details, instead of in the server's own backup storage (if it has any), and downloads and restores read them back from it."}),n.jsx("p",{children:"Whoever can read that database can read the sessions saved there, private ones and their owners' personal environment values included. Other members confirm the database before each of their backups goes there, and again after it is pointed at another database."}),n.jsx("p",{children:"The owner can also have changed sessions backed up there on their own, once they're idle, on a schedule. Members' sessions take part once their owner confirms the database for all their backups, which also stops it asking before each one; pointing the connection at another database asks again."}),n.jsxs("p",{children:["The owner can also import a session or workspace export into it, adding session details and activity. Pikibun creates the tables ",n.jsx("code",{children:"pikibun_workspaces"}),", ",n.jsx("code",{children:"pikibun_sessions"}),", ",n.jsx("code",{children:"pikibun_session_backups"})," and ",n.jsx("code",{children:"pikibun_audit"})," when they are missing. The password is write-only: it is never shown again after saving."]})]}),action:i&&m?.available&&!x&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Connect database"}),children:[n.jsxs(tt,{...r,retry:r.refresh,children:[x?n.jsx(W,{title:ac(x),hint:n.jsxs(n.Fragment,{children:["User ",n.jsx("code",{children:x.user})," · ",jM[x.tls],x.customCa?" with a custom CA":""]}),trailing:n.jsxs(n.Fragment,{children:[n.jsx(ge,{tone:m?.available?"success":"warning",children:m?.available?"Connected":"Unavailable"}),i&&n.jsx(ss,{label:"Actions for the session database",items:v})]})}):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:w})}),x&&m?.available&&m.automaticBackups&&n.jsx(CM,{path:a,database:x,owner:i,state:m.automaticBackups,saved:r.refresh}),x&&m&&!m.available&&n.jsx(ke,{children:n.jsxs(we,{variant:"warning",title:"Workspace databases are turned off",children:["This server no longer connects to workspace databases, so backups of this workspace's sessions can't be created, downloaded or restored. ",m.backupStorage?i?"Disconnect the database to use the server's backup storage again, or ask the server's operator to turn workspace databases on again.":"The workspace owner can disconnect it to use the server's backup storage again.":"The server's operator can turn them on again with WORKSPACE_DATABASES=true."]})}),(l.error||l.notice)&&n.jsx(ke,{children:n.jsx(ye,{...l})})]}),i&&u&&m?.available&&n.jsx(NM,{path:a,privateHosts:m.privateHosts,existing:x,close:()=>d(!1),saved:r.refresh}),i&&h&&m?.available&&x&&n.jsx(AM,{path:a,database:x,close:()=>p(!1)})]})}function CM({path:e,database:i,owner:a,state:r,saved:l}){const u=je();function d(p){const m=p===""?null:Number(p);u.run(async()=>{await ce(`${e}/automatic-backups`,{method:"PUT",body:{minutes:m}}),l()},m===null?"Automatic backups turned off.":`Changed sessions are now backed up ${kb(m).toLowerCase()} at most.`)}async function h(p){p&&!await He({title:"Confirm this database",message:`Back up your sessions in ${ac(i)} without asking each time, automatic backups included? Whoever can read it can read them, including your personal environment values. Pikibun asks again if the owner points the connection at another database.`,confirmLabel:"Confirm database"})||u.run(async()=>{await ce(`${e}/consent`,p?{method:"PUT",body:{databaseId:i.id}}:{method:"DELETE"}),l()},p?"Database confirmed for your sessions' backups.":"Confirmation withdrawn. Backups of your sessions ask first again, and aren't taken automatically.")}return n.jsxs(n.Fragment,{children:[n.jsx(W,{title:"Automatic backups",hint:a?"Backs up sessions that changed since their last automatic backup, once they're idle. Members' sessions only once they confirm this database":r.minutes===null?"Off. The workspace owner chooses the schedule":`${kb(r.minutes)}, for sessions that changed, once they're idle`,trailing:a&&n.jsx("select",{className:"select","aria-label":"Automatic backup schedule",value:r.minutes??"",disabled:u.busy,onChange:p=>d(p.target.value),children:mj.map(p=>n.jsx("option",{value:p.minutes??"",children:p.label},p.label))})}),!a&&n.jsx(W,{title:"Your sessions",hint:r.consented?"You confirmed this database: your backups go there without asking, automatic ones included":"You confirm this database before each backup, and your sessions aren't backed up automatically",trailing:n.jsx(q,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>{h(!r.consented)},children:r.consented?"Withdraw":"Confirm database"})}),(u.error||u.notice)&&n.jsx(ke,{children:n.jsx(ye,{...u})})]})}function AM({path:e,database:i,close:a}){const[r,l]=N.useState(null),[u,d]=N.useState(null),h=je();function p(){h.busy||a()}function m(x){x.preventDefault(),!(!r||h.busy)&&(d(null),h.run(async()=>{if(r.size>wM)throw new Error("This dump is larger than 32 MiB. The server's operator can import it with the --import-dump option.");let y;try{y=JSON.parse(await r.text())}catch{throw new Error("This file is not a JSON dump.")}const v=await ce(`${e}/import`,{method:"POST",body:y});d(v.imported)}))}return n.jsx(qt,{open:!0,title:"Import a dump",onClose:p,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:h.busy,onClick:p,children:u?"Done":"Cancel"}),!u&&n.jsx(q,{variant:"default",type:"submit",form:"workspace-import-form",disabled:!r||h.busy,children:h.busy?"Importing...":"Import"})]}),children:n.jsxs("form",{id:"workspace-import-form",className:"stack",onSubmit:m,children:[n.jsxs("p",{className:"muted small",children:["Adds an export of this workspace, or of one of its sessions, to ",ac(i),": session records and details (grants, approvals, pushes, backups and restores), their activity and the workspace's settings. A record replaces an older one of the same session; activity is added once, so importing a dump again changes nothing. Pikibun itself is unchanged."]}),n.jsx(xe,{label:"Dump file",hint:"A JSON export from Pikibun, up to 32 MiB",children:n.jsx("input",{className:"input",type:"file",accept:"application/json,.json",disabled:h.busy,onChange:x=>{l(x.target.files?.[0]??null),d(null)}})}),u&&n.jsxs(we,{variant:"success",title:"Imported",role:"status",children:[u.sessions," session record",u.sessions===1?"":"s"," (",u.sessionDetails," with details) and ",u.auditEntries," activity entr",u.auditEntries===1?"y":"ies",u.workspaceSettings?", with the workspace's settings,":""," from the ",u.format," export of ",n.jsx(Qt,{value:u.exportedAt}),"."]}),n.jsx(ye,{error:h.error})]})})}function NM({path:e,privateHosts:i,existing:a,close:r,saved:l}){const[u,d]=N.useState(""),[h,p]=N.useState(""),[m,x]=N.useState(a?.host??""),[y,v]=N.useState(String(a?.port??5432)),[b,w]=N.useState(a?.database??""),[S,C]=N.useState(a?.user??""),[k,O]=N.useState(""),[T,M]=N.useState(a&&(a.tls!=="disable"||i)?a.tls:"verify-full"),[_,$]=N.useState(""),G=je(),J=Number(y),U=!!(m.trim()&&b.trim()&&S.trim()&&k)&&Number.isInteger(J)&&J>=1&&J<=65535;function E(){G.busy||r()}function I(){try{const ie=kM(u);x(ie.host),v(ie.port),ie.database&&w(ie.database),ie.user&&C(ie.user),ie.password&&O(ie.password),ie.unencrypted&&i&&M("disable"),d(""),p("")}catch(ie){p(ie instanceof Error?ie.message:"The connection URL could not be read.")}}function Q(ie){if(ie.preventDefault(),!U||G.busy)return;const re={host:m.trim(),port:J,database:b.trim(),user:S.trim(),password:k,tls:T,...T==="verify-full"&&_.trim()?{caCertificate:_.trim()}:{}};G.run(async()=>{await ce(e,{method:"PUT",body:re}),O(""),l(),r()})}return n.jsx(qt,{open:!0,title:a?"Replace session database":"Connect session database",onClose:E,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:G.busy,onClick:E,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"workspace-database-form",disabled:!U||G.busy,children:G.busy?"Connecting...":"Save"})]}),children:n.jsxs("form",{id:"workspace-database-form",className:"stack",onSubmit:Q,children:[n.jsxs("p",{className:"muted small",children:["Pikibun connects when you save, to check the settings and create its tables. From then on, backups of this workspace's sessions are saved in this database",a?"; backups saved before stay where they are":"","."]}),n.jsx(xe,{label:"Connection URL",hint:"Optional. Paste a postgres:// URL and fill in the fields below from it; the URL itself isn't sent",children:n.jsx("input",{className:"input",value:u,onChange:ie=>d(ie.target.value),autoComplete:"off",spellCheck:!1,placeholder:"postgres://user:password@db.example.com:5432/pikibun"})}),n.jsx("div",{className:"inline",children:n.jsx(q,{variant:"outline",size:"sm",disabled:!u.trim()||G.busy,onClick:I,children:"Fill in from URL"})}),n.jsx(ye,{error:h}),n.jsx(xe,{label:"Host",hint:"Host name or IP address, without a scheme or port",children:n.jsx("input",{className:"input",required:!0,value:m,onChange:ie=>x(ie.target.value),autoComplete:"off",spellCheck:!1,placeholder:"db.example.com"})}),n.jsx(xe,{label:"Port",children:n.jsx("input",{className:"input",required:!0,inputMode:"numeric",value:y,onChange:ie=>v(ie.target.value),autoComplete:"off",spellCheck:!1})}),n.jsx(xe,{label:"Database",children:n.jsx("input",{className:"input",required:!0,value:b,onChange:ie=>w(ie.target.value),autoComplete:"off",spellCheck:!1})}),n.jsx(xe,{label:"User",hint:"Needs to create Pikibun's tables, or SELECT, INSERT and UPDATE on them if you create them yourself",children:n.jsx("input",{className:"input",required:!0,value:S,onChange:ie=>C(ie.target.value),autoComplete:"off",spellCheck:!1})}),n.jsx(xe,{label:"Password",hint:"Write-only. Needed every time the connection is saved",children:n.jsx("input",{className:"input",type:"password",required:!0,value:k,onChange:ie=>O(ie.target.value),autoComplete:"new-password"})}),n.jsx(xe,{label:"Encryption",hint:i?void 0:"This server only connects to databases on the public internet, always encrypted",children:n.jsxs("select",{className:"select",value:T,onChange:ie=>M(ie.target.value),children:[n.jsx("option",{value:"verify-full",children:"TLS, verify the server certificate (recommended)"}),n.jsx("option",{value:"require",children:"TLS, don't verify the server certificate"}),i&&n.jsx("option",{value:"disable",children:"Unencrypted, private networks only"})]})}),T==="verify-full"&&n.jsx(xe,{label:"CA certificate",hint:a?.customCa?"Paste it again to keep verifying with it: saving replaces the connection's CA certificate":"Optional. PEM certificates of a private CA, such as your cloud provider's bundle. The public roots are used otherwise",children:n.jsx("textarea",{className:"textarea mono",value:_,onChange:ie=>$(ie.target.value),autoComplete:"off",spellCheck:!1,placeholder:"-----BEGIN CERTIFICATE-----"})}),T==="require"&&n.jsx(we,{variant:"warning",title:"Certificate not verified",children:"The connection is encrypted, but whoever can intercept it could pose as the database and read the password and the sessions saved there."}),T==="disable"&&n.jsx(we,{variant:"warning",title:"Unencrypted",children:"The password and the sessions cross the network in the clear. Use this only on a network you trust."}),n.jsx(ye,{error:G.error})]})})}const Vi={owner:"Owner",admin:"Admin",collaborator:"Collaborator",member:"Member",viewer:"Viewer"},Of={admin:"Collaborator, and manages the workspace: members, models, repositories and settings",collaborator:"Starts sessions, and sends messages to any session shared with the workspace",member:"Starts sessions, and follows other shared sessions read-only unless granted more",viewer:"Follows shared sessions read-only, and can't start sessions"};function TM({id:e}){const{user:i,workspaces:a,workspacesLoading:r,workspacesError:l,refreshWorkspaces:u}=pt(),[d,h]=N.useState(!1),p=n.jsx(of,{open:d,onClose:()=>h(!1)});if(e){const m=a.find(x=>x.id===e);return m?n.jsxs(n.Fragment,{children:[n.jsx(Sb,{}),n.jsx(EM,{user:i,workspace:m},m.id)]}):r?n.jsx(ds,{}):n.jsxs(n.Fragment,{children:[n.jsx(Sb,{}),l?n.jsx(we,{variant:"error",title:"Unable to load workspaces",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:l}):n.jsx(xt,{title:"Workspace not found"})]})}return r&&!a.length?n.jsx(ds,{}):l&&!a.length?n.jsx(we,{variant:"error",title:"Unable to load workspaces",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:u,children:"Try again"}),children:l}):a.length?n.jsxs(n.Fragment,{children:[n.jsx(Ae,{title:"Workspaces",info:"A shared home for your repositories, people, agents and sessions",action:n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>h(!0),children:"New workspace"}),children:a.map(m=>n.jsx(W,{leading:n.jsx(Is,{name:m.name,id:m.id}),title:m.name,hint:Vi[pj(m,i)],href:Xe({name:"settings",section:"workspaces",id:m.id}),chevron:!0},m.id))}),p]}):n.jsxs(n.Fragment,{children:[n.jsx(xt,{title:"No workspaces yet",action:n.jsx(q,{variant:"default",icon:"plus",onClick:()=>h(!0),children:"New workspace"})}),p]})}function Sb(){return n.jsxs("a",{className:"btn ghost sm",href:Xe({name:"settings",section:"workspaces"}),children:[n.jsx(be,{name:"chevron-left",size:16}),"Workspaces"]})}function pj(e,i){return e.ownerId===i.id?"owner":e.role??"member"}function EM({user:e,workspace:i}){const a=pj(i,e),r=a==="owner"||a==="admin",l=av(i.id),u=PR(i.id),d=HR(i.id),h=()=>{l.refresh(),u.refresh(),d.refresh()};return n.jsxs(n.Fragment,{children:[n.jsxs(Ae,{title:"General",children:[n.jsx(W,{title:"Name",trailing:n.jsx("span",{children:i.name})}),n.jsx(W,{title:"Your role",trailing:n.jsx(ge,{tone:r?"success":"neutral",children:Vi[a]})})]}),so(a)&&n.jsx(OM,{user:e,workspace:i,admin:r,sourceCount:l.sourceCount}),n.jsx(RM,{workspace:i,admin:r,...l,connections:d.connections,changed:h,documents:n.jsx(XR,{workspaceId:i.id,workspaceName:i.name,admin:r,...u,connections:d.connections,changed:h})}),n.jsx(FR,{workspaceId:i.id,admin:r,...d,changed:h}),n.jsx(yM,{workspace:i,admin:r}),n.jsx(sM,{workspace:i,admin:r}),n.jsx(cM,{workspace:i,userId:e.id}),n.jsx(dM,{workspace:i,admin:r}),n.jsx(pM,{workspace:i,admin:r}),n.jsx(mM,{workspace:i,admin:r}),n.jsx(fM,{workspace:i,admin:r}),n.jsx(SM,{workspace:i,owner:a==="owner"}),n.jsx(LM,{workspace:i,admin:r,owner:a==="owner"}),r&&n.jsx(zM,{workspace:i})]})}function zM({workspace:e}){return n.jsx(Ae,{title:"Data export",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"Downloads this workspace as JSON: its settings, members, models, published agents, repositories, push access, session database connection and activity, with your own sessions in full and the records of every other session, which owners and admins manage."}),n.jsx("p",{children:"The rest of another member's session, such as its people, approvals and activity, is in its owner's export of it. Secrets are never included, and a session's conversation is in its backups."}),n.jsx("p",{children:"The workspace owner can import exports into the workspace's session database."})]}),children:n.jsx(W,{title:"Workspace data",hint:"JSON, without secrets",trailing:n.jsx(Ht,{variant:"outline",size:"sm",href:`/api/workspaces/${oe(e.id)}/export`,download:!0,children:"Export"})})})}function OM({user:e,workspace:i,admin:a,sourceCount:r}){const{sessions:l,sessionsLoading:u}=pt(),d=lo(`/api/workspaces/${oe(i.id)}/connectors`);if(r===null||!d.data||u)return null;const h=[{label:"Add a source",done:r>0,hint:a?void 0:"An owner or admin does this",onClick:()=>document.getElementById("workspace-repositories")?.scrollIntoView({behavior:"smooth"})},{label:"Pair a host",done:d.data.connectors.some(p=>!p.revokedAt&&p.online&&(p.ownerId===e.id||p.workspaceIds.includes(i.id))),link:Xe({name:"settings",section:"hosts"})},{label:"Start a session",done:l.some(p=>p.workspaceId===i.id),link:Xe({name:"new",workspaceId:i.id})}];return h.every(p=>p.done)?null:n.jsx(Ae,{title:"Setup",action:n.jsxs("span",{className:"muted small",children:[h.filter(p=>p.done).length," / ",h.length]}),children:h.map(p=>n.jsx(W,{leading:n.jsx(gi,{tone:p.done?"success":"neutral",label:p.done?"Done":"To do"}),title:p.label,hint:p.done?void 0:p.hint,href:p.done?void 0:p.link,onClick:p.done?void 0:p.onClick,chevron:!p.done},p.label))})}function RM({workspace:e,admin:i,repositories:a,sourceCount:r,loading:l,error:u,refresh:d,documents:h,connections:p,changed:m}){const x=je(),y=rv(i),[v,b]=N.useState(!1),w=(a?.length??0)>=ao.repositories;async function S(M){if(x.busy||!i)return;const _=r===1;await He({title:"Remove repository",message:`Remove ${M.fullName} from ${e.name}? Existing sessions keep their pinned snapshots.${_?" With no sources, new sessions, pairing and sharing will be disabled until an owner or admin adds a source.":" This changes new sessions only."}`,confirmLabel:"Remove",destructive:!0})&&x.run(async()=>{await ce(`/api/workspaces/${oe(e.id)}/repositories/${oe(M.id)}`,{method:"DELETE"}),d()},"Repository removed. Existing sessions keep their pinned snapshots.")}function C(M,_){x.busy||!i||x.run(async()=>{await ce(`/api/workspaces/${oe(e.id)}/repositories/${oe(M.id)}/push-policy`,{method:"PUT",body:{forbidDefaultBranch:!_}}),d()},"Push policy saved.")}function k(M,_){x.busy||!i||x.run(async()=>{await ce(`/api/workspaces/${oe(e.id)}/repositories/${oe(M.id)}/lfs`,{method:"PUT",body:{enabled:_}}),d()},_?"Git LFS turned on. New clones download LFS files.":"Git LFS turned off. Clones check out LFS pointer files.")}const O=p?.filter(M=>M.family==="git")??[],T=i&&!!(y.accounts?.length||O.length)&&!w;return n.jsxs(Ae,{bare:!0,title:"Sources",info:n.jsxs("div",{className:"stack",children:[n.jsx("p",{children:"What this workspace's sessions work on: Git repositories, which agents clone, and documents (Notion, Google Drive, Dropbox, OneDrive, Feishu/Lark, Tencent Docs), which agents read. Every session in the workspace gets every source, and reads each with its owner's own accounts."}),!i&&n.jsx("p",{children:"Only workspace owners and admins can add or remove sources."}),n.jsx("p",{children:"Changes apply at once, in running sessions too: a removed source can no longer be read, nor a removed repository pushed. To change a ref, remove and re-add the repository."}),n.jsx("p",{children:"Git LFS is off by default, and clones check out LFS pointer files. Turned on, sessions download the repository's LFS files with their owner's own account, where the host has git-lfs installed. Sessions never upload LFS files."}),n.jsx(af,{})]}),action:T&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",disabled:l||!!u||x.busy,onClick:()=>b(!0),children:"Add repository"}),children:[n.jsxs("div",{className:"stack",id:"workspace-repositories",children:[n.jsx("div",{className:"section-header",children:n.jsx("h3",{className:"section-title",children:"Git repositories"})}),n.jsx("div",{className:"card",children:n.jsxs(tt,{loading:l,error:u,retry:d,children:[a?.length?a.map(M=>n.jsx(W,{title:M.fullName,hint:n.jsxs(n.Fragment,{children:[uc(M.provider,M.host)," · ",n.jsx("code",{children:M.ref})]}),trailing:n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"inline small",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:!M.forbidDefaultBranchPush,disabled:!i||x.busy,onChange:_=>C(M,_.target.checked)}),"Allow agent pushes to the default branch"]}),n.jsxs("label",{className:"inline small",title:"Sessions download this repository's Git LFS files instead of checking out pointer files",children:[n.jsx("input",{type:"checkbox",className:"checkbox",checked:M.lfs,disabled:!i||x.busy,onChange:_=>k(M,_.target.checked)}),"Git LFS"]}),M.provider!=="github"&&n.jsx(dj,{workspaceId:e.id,sourceId:M.id,title:M.fullName,readAs:M.readAs,connection:qR(p,M),admin:i,action:x,changed:m}),n.jsx(ge,{children:M.private?"Private":"Public"}),i&&n.jsx(q,{variant:"outline",size:"sm",disabled:x.busy,"aria-label":`Remove ${M.fullName}`,onClick:()=>{S(M)},children:"Remove"})]})},M.id)):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:i?"No repositories yet":"No repositories yet. Ask a workspace owner or admin to bind one"})}),(x.error||x.notice)&&n.jsx(ke,{children:n.jsx(ye,{...x})})]})}),i&&y.error&&n.jsx(we,{variant:"error",title:"Unable to load Git accounts",actions:n.jsx(q,{variant:"outline",size:"sm",onClick:y.refresh,children:"Try again"}),children:y.error}),i&&y.accounts&&!y.accounts.length&&!O.length&&n.jsx(we,{variant:"warning",title:"No Git accounts connected",actions:n.jsx(Ht,{variant:"outline",size:"sm",href:Xe({name:"settings",section:"profile"}),children:"Open profile"}),children:"Connect GitHub or add a Git account in Settings → Profile before choosing repositories."}),i&&!!y.accounts?.length&&w&&n.jsxs(we,{variant:"info",title:"Repository limit reached",children:["The workspace has reached its ",ao.repositories,"-repository limit. Remove a binding to choose another."]})]}),h,T&&n.jsx(DM,{open:v,workspace:e,accounts:[...y.accounts??[],...O.map(MM)],repositories:a??[],disabled:l||!!u||x.busy,refresh:d,close:()=>b(!1)})]})}const Gl="workspace:";function MM(e){return{id:`${Gl}${e.id}`,provider:e.provider,host:e.host,organization:e.organization,login:e.name,createdAt:e.createdAt}}function DM({open:e,workspace:i,accounts:a,repositories:r,disabled:l,refresh:u,close:d}){const[h,p]=N.useState(""),[m,x]=N.useState(""),[y,v]=N.useState(""),b=a.find(se=>se.id===h)??a[0],w=b?K1(b.provider):!0,S=b?.id.startsWith(Gl)??!1,C=b?S?`/api/workspaces/${oe(i.id)}/connections/${oe(b.id.slice(Gl.length))}/repositories`:`/api/git/accounts/${oe(b.id)}/repositories`:null,[k,O]=N.useState(""),[T,M]=N.useState(null),_=je(),$=$e(e&&C&&w?C:null),G=je(),J=w?$.data?.repositories.find(se=>se.id===m):T??void 0,U=se=>r.some(de=>de.provider===b?.provider&&de.host===b.host&&(de.repositoryId===se.id||de.fullName.toLowerCase()===se.fullName.toLowerCase())),E=l||G.busy||_.busy||w&&($.loading||!!$.error)||!b||!J||U(J)||r.length>=ao.repositories,I=b?Zn[b.provider]:"Git";function Q(se){x(se),v("")}function ie(se){p(se),Q(""),O(""),M(null)}function re(){!b||_.busy||!k.trim()||(M(null),v(""),_.run(async()=>{const se=await ce(`${C}?path=${encodeURIComponent(k.trim())}`);M(se.repositories[0]??null)}))}function Y(){G.busy||(x(""),v(""),O(""),M(null),d())}function F(se){se.preventDefault(),!(E||!J||!b)&&G.run(async()=>{await ce(`/api/workspaces/${oe(i.id)}/repositories`,{method:"POST",body:{provider:b.provider,host:b.host,repositoryId:J.id,fullName:J.fullName,...y.trim()?{ref:y.trim()}:{},...S?{readAs:"workspace"}:{}}}),u(),x(""),v(""),O(""),M(null),d()})}const B=n.jsx(xe,{label:"Branch, tag or commit",hint:`Optional. Leave blank to use ${J?`the default branch, ${J.defaultBranch}`:"the repository's default branch"}. New sessions pin this ref to a commit; existing sessions never follow branch changes`,children:n.jsx("input",{className:"input",value:y,onChange:se=>v(se.target.value),disabled:l||G.busy||!J,autoComplete:"off",spellCheck:!1,maxLength:255,placeholder:J?.defaultBranch??"Repository default branch"})});return n.jsx(qt,{open:e,title:"Add repository",onClose:Y,footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:G.busy,onClick:Y,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"repository-picker-form",disabled:E,children:G.busy?"Binding...":"Bind repository"})]}),children:n.jsxs("form",{id:"repository-picker-form",className:"stack",onSubmit:F,children:[n.jsxs("div",{className:"field",children:[n.jsx("span",{className:"field-label",children:"Account"}),n.jsx(Xt,{label:"Account",placeholder:"Choose an account",value:b?.id??"",disabled:l||G.busy,options:a.map(se=>se.id.startsWith(Gl)?{value:se.id,label:`Workspace · ${Xr({family:"git",provider:se.provider,host:se.host,organization:se.organization})}`,hint:se.login}:{value:se.id,label:bh(se),hint:se.login}),onChange:ie})]}),S&&n.jsxs("p",{className:"muted small",children:["Sessions read this repository with the workspace's connection (",b?.login,"), not their owner's account. Pushes still use the session owner's account or the workspace's push access"]}),w?n.jsxs("p",{className:"muted small",children:["Only repositories this ",I," account can access are listed. Sessions read them with their owner's own account for the same provider. Never paste a token or clone URL"]}):n.jsxs("p",{className:"muted small",children:["A Git server lists no repositories: enter the one to add. Pikibun reads it with this ",S?"connection":"account"," to check it",S?"":", and sessions read it with their owner's own account for the same server",". Never paste a token"]}),!w&&b&&n.jsxs(n.Fragment,{children:[n.jsx(xe,{label:"Clone URL or path",hint:`The repository's https:// clone URL on ${b.host}, or its path there, such as team/project.git`,children:n.jsxs("span",{className:"lookup-row",children:[n.jsx("input",{className:"input",value:k,onChange:se=>{O(se.target.value),M(null)},onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),re())},disabled:l||G.busy||_.busy,autoComplete:"off",spellCheck:!1,maxLength:600,placeholder:`https://${b.host}/team/project.git`}),n.jsx(q,{variant:"outline",size:"sm",disabled:l||G.busy||_.busy||!k.trim(),onClick:re,children:_.busy?"Checking...":"Look up"})]})}),T&&n.jsx(W,{leading:n.jsx(be,{name:"git-branch",size:16}),title:T.fullName,hint:`${T.private?"Private":"Public"} · default branch ${T.defaultBranch}${U(T)?" · Already configured":""}`}),n.jsx(ye,{error:_.error}),T&&B]}),w&&n.jsx(tt,{...$,retry:$.refresh,children:$.data?.repositories.length?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"field",children:[n.jsxs("span",{className:"field-label",children:[I," repository"]}),n.jsx(Xt,{label:`${I} repository`,placeholder:"Choose a repository",value:J?.id??"",disabled:l||G.busy,options:$.data.repositories.map(se=>({value:se.id,label:se.fullName,disabled:U(se),hint:`${se.private?"Private":"Public"}${U(se)?" · Already configured":""}`})),onChange:Q}),$.data.truncated&&n.jsxs("span",{className:"field-hint",children:["Only the first ",ao.pickerRepositories.toLocaleString()," repositories this account can access are listed"]})]}),B]}):n.jsxs(xt,{title:"No repositories found",children:["Check your ",I," account and organization access"]})}),$.error&&n.jsxs("p",{className:"muted small",children:["Review your ",n.jsx("a",{href:Xe({name:"settings",section:"profile"}),children:"Git accounts"})," and repository access, then retry. An owner or admin with access can also configure this workspace"]}),n.jsx(ye,{error:G.error})]})})}function LM({workspace:e,admin:i,owner:a}){const r=`/api/workspaces/${oe(e.id)}/members`,l=$e(r),[u,d]=N.useState(!1),[h,p]=N.useState(null),m=je();async function x(y){await He({title:"Remove member",message:`Remove ${Mt(Bs(y))} from this workspace?`,confirmLabel:"Remove",destructive:!0})&&m.run(async()=>{await ce(`${r}/${oe(y.userId)}`,{method:"DELETE"}),l.refresh()},"Membership removed.")}return n.jsxs(n.Fragment,{children:[n.jsx(Ae,{title:"Members",info:n.jsxs("div",{className:"stack",children:[!i&&n.jsx("p",{children:"Only workspace owners and admins can manage membership."}),n.jsx("p",{children:"Every role can follow workspace-visible sessions, which shows prompts, tool output and repository content in the transcript."}),n.jsxs("ul",{children:[n.jsxs("li",{children:[n.jsx("strong",{children:"Viewer"}),": follows them read-only and can't start sessions, whatever a session grants."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Member"}),": starts sessions, and follows other people's read-only unless they grant more."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Collaborator"}),": starts sessions, and sends messages to any workspace-visible session."]}),n.jsxs("li",{children:[n.jsx("strong",{children:"Admin"}),": a collaborator who also manages the workspace and every session in it, private ones included. Only the owner manages admins."]})]}),n.jsx("p",{children:"Opening someone else's private session takes a session role, except for the owner and admins. Approving tool calls takes one from the session's owner whatever the role."}),n.jsx("p",{children:"Membership never grants GitHub access, tool execution, or use of anyone's private Pi host."})]}),action:i&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",onClick:()=>d(!0),children:"Add member"}),children:n.jsxs(tt,{...l,retry:l.refresh,children:[l.data?.members.length?l.data.members.map(y=>{const v=Bs(y),b=y.displayName||Gi(v);return n.jsx(W,{leading:n.jsx(Is,{name:b,id:y.userId}),title:b,hint:Mt(v),trailing:n.jsxs(n.Fragment,{children:[n.jsx(ge,{tone:y.role==="owner"||y.role==="admin"?"success":"neutral",children:Vi[y.role]}),i&&y.userId!==e.ownerId&&(a||Db.includes(y.role))&&n.jsx(ss,{label:`Actions for ${b}`,items:[{label:"Change role",icon:"shield",disabled:m.busy,onSelect:()=>p(y)},{label:"Remove",icon:"trash",destructive:!0,disabled:m.busy,onSelect:()=>{x(y)}}]})]})},y.userId)}):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"No members to display"})}),(m.error||m.notice)&&n.jsx(ke,{children:n.jsx(ye,{...m})})]})}),i&&n.jsx(_M,{workspace:e}),i&&n.jsx($M,{workspace:e,owner:a,accepted:l.refresh}),i&&n.jsx(IM,{open:u,path:r,owner:a,close:()=>d(!1),saved:l.refresh}),i&&h&&n.jsx(UM,{member:h,path:r,owner:a,close:()=>p(null),saved:l.refresh},h.userId)]})}function _M({workspace:e}){const i=`/api/workspaces/${oe(e.id)}/invite-link`,a=$e(i),r=je(),l=a.data?.link;function u(){r.busy||r.run(async()=>{a.setData(await ce(i,{method:"PUT"}))},"Invite link created. Share it with the people you want to invite.")}async function d(h){r.busy||!await He(h?{title:"Replace the invite link?",message:"The current link stops working at once, and a new one replaces it. People already waiting to join stay pending.",confirmLabel:"Replace link",destructive:!0}:{title:"Turn off the invite link?",message:"The link stops working at once, for everyone who has it. People already waiting to join stay pending until you accept or decline them. Turning the link on again creates a new link.",confirmLabel:"Turn off link",destructive:!0})||r.run(async()=>{await ce(i,{method:"DELETE"}),a.setData(h?await ce(i,{method:"PUT"}):{link:null})},h?"Invite link replaced. The old link no longer works.":"Invite link turned off.")}return n.jsx(Ae,{title:"Invite link",info:n.jsxs("div",{className:"stack",children:[n.jsxs("p",{children:["Share this link with anyone. When someone signed in to this Pikibun server opens it, they can ask to join, and appear under ",n.jsx("strong",{children:"Pending members"}),"."]}),n.jsx("p",{children:"A pending member can't see or do anything in the workspace until an owner or admin accepts them with a role. Anyone with the link can ask, so only accept people you recognize."})]}),action:l?n.jsx(ss,{label:"Invite link actions",items:[{label:"Replace link",icon:"refresh",disabled:r.busy,onSelect:()=>{d(!0)}},{label:"Turn off link",icon:"trash",destructive:!0,disabled:r.busy,onSelect:()=>{d(!1)}}]}):a.data&&n.jsx(q,{variant:"outline",size:"sm",icon:"plus",disabled:r.busy,onClick:u,children:"Create link"}),children:n.jsxs(tt,{...a,retry:a.refresh,children:[l?n.jsx(ke,{children:n.jsx(xe,{label:"Invite link",hint:n.jsxs(n.Fragment,{children:["Created ",n.jsx(Vn,{value:l.createdAt}),". Anyone who opens it can ask to join"]}),children:n.jsx(Yn,{value:l.url,label:"Copy invite link"})})}):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"No invite link. Create one to let people ask to join"})}),(r.error||r.notice)&&n.jsx(ke,{children:n.jsx(ye,{...r})})]})})}function $M({workspace:e,owner:i,accepted:a}){const r=`/api/workspaces/${oe(e.id)}/join-requests`,l=$e(r),u=je(),[d,h]=N.useState({}),p=Rf(i),m=l.data?.requests??[];function x(v,b){if(u.busy)return;const w=d[v.userId]??"member";u.run(async()=>{l.setData(await ce(`${r}/${oe(v.userId)}/accept`,{method:"POST",body:{role:w}})),a()},`${b} joined as ${Vi[w].toLowerCase()}.`)}async function y(v,b){u.busy||!await He({title:"Decline request",message:`Decline ${b}'s request to join? They can ask again while they have a working invite link.`,confirmLabel:"Decline",destructive:!0})||u.run(async()=>{l.setData(await ce(`${r}/${oe(v.userId)}`,{method:"DELETE"}))},"Request declined.")}return n.jsx(Ae,{title:"Pending members",info:n.jsx("p",{children:"People who asked to join through the invite link. Choose a role and accept them, or decline. Until then they can't see or do anything in the workspace."}),action:n.jsx(q,{variant:"ghost",size:"sm",icon:"refresh","aria-label":"Refresh pending members",disabled:l.loading,onClick:l.refresh}),children:n.jsxs(tt,{...l,retry:l.refresh,children:[m.length?m.map(v=>{const b=Bs({...v,role:"member"}),w=v.displayName||Gi(b),S=d[v.userId]??"member";return n.jsx(W,{leading:n.jsx(Is,{name:w,id:v.userId}),title:w,hint:n.jsxs(n.Fragment,{children:[Mt(b)," · asked ",n.jsx(Vn,{value:v.createdAt})]}),trailing:n.jsxs(n.Fragment,{children:[n.jsx("select",{className:"select","aria-label":`Role for ${w}`,value:S,disabled:u.busy,title:Of[S],onChange:C=>h(k=>({...k,[v.userId]:C.target.value})),children:p.map(C=>n.jsx("option",{value:C,children:Vi[C]},C))}),n.jsx(q,{variant:"outline",size:"sm",disabled:u.busy,onClick:()=>x(v,w),children:"Accept"}),n.jsx(q,{variant:"ghost",size:"sm",disabled:u.busy,"aria-label":`Decline ${w}`,onClick:()=>{y(v,w)},children:"Decline"})]})},v.userId)}):n.jsx(ke,{children:n.jsx("span",{className:"muted",children:"Nobody is waiting to join"})}),(u.error||u.notice)&&n.jsx(ke,{children:n.jsx(ye,{...u})})]})})}function Rf(e){return e1.filter(i=>e||Db.includes(i))}function UM({member:e,path:i,owner:a,close:r,saved:l}){const u=e.role==="owner"?null:e.role,[d,h]=N.useState(u??"member"),p=Rf(a),m=je(),x=e.displayName||Gi(Bs(e));function y(v){v.preventDefault(),!(m.busy||d===u)&&m.run(async()=>{await ce(`${i}/${oe(e.userId)}`,{method:"PATCH",body:{role:d}}),l(),r()})}return n.jsx(qt,{open:!0,title:`Change role of ${x}`,onClose:()=>{m.busy||r()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:m.busy,onClick:r,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"change-role-form",disabled:m.busy||d===u,children:m.busy?"Saving...":"Save"})]}),children:n.jsxs("form",{id:"change-role-form",className:"stack",onSubmit:y,children:[n.jsx(xe,{label:"Role",hint:`${Of[d]}. Takes effect at once, in their open sessions too`,children:n.jsx("select",{className:"select",autoFocus:!0,value:d,onChange:v=>h(v.target.value),children:p.map(v=>n.jsxs("option",{value:v,children:[Vi[v],v===u?" (current)":""]},v))})}),n.jsx(ye,{error:m.error})]})})}function IM({open:e,path:i,owner:a,close:r,saved:l}){const[u,d]=N.useState(""),[h,p]=N.useState("member"),m=Rf(a),x=je();function y(v){v.preventDefault(),!(x.busy||!u.trim())&&x.run(async()=>{await ce(i,{method:"POST",body:{userId:xh(u),role:h}}),d(""),l(),r()})}return n.jsx(qt,{open:e,title:"Add member",onClose:()=>{x.busy||r()},footer:n.jsxs(n.Fragment,{children:[n.jsx(q,{disabled:x.busy,onClick:r,children:"Cancel"}),n.jsx(q,{variant:"default",type:"submit",form:"add-member-form",disabled:x.busy||!u.trim(),children:x.busy?"Saving...":"Save"})]}),children:n.jsxs("form",{id:"add-member-form",className:"stack",onSubmit:y,children:[n.jsx(xe,{label:"User ID",hint:"Copy it from their profile. To change an existing member's role, use Change role in their menu",children:n.jsx("input",{className:"input",required:!0,autoFocus:!0,value:u,onChange:v=>d(v.target.value),placeholder:"User ID",autoComplete:"off",spellCheck:!1})}),n.jsx(xe,{label:"Role",hint:Of[h],children:n.jsx("select",{className:"select",value:h,onChange:v=>p(v.target.value),children:m.map(v=>n.jsx("option",{value:v,children:Vi[v]},v))})}),n.jsx(ye,{error:x.error})]})})}const BM=[{id:"profile",label:"Profile",icon:"user"},{id:"notifications",label:"Notifications",icon:"bell"},{id:"hosts",label:"Hosts",icon:"server"},{id:"desktop",label:"This Computer",icon:"monitor",desktop:!0},{id:"workspaces",label:"Workspaces",icon:"users"},{id:"appearance",label:"Appearance",icon:"palette"},{id:"admin",label:"Administration",icon:"shield",admin:!0}],HM=()=>/Mac/i.test(navigator.platform)?"This Mac":"This Computer";function qM({section:e,id:i}){const{user:a}=pt(),r=!!Zi(),l=BM.filter(d=>(!d.admin||a.instanceAdmin)&&(!d.desktop||r)).map(d=>d.desktop?{...d,label:HM()}:d),u=l.find(d=>d.id===e)??l[0];return n.jsxs("div",{className:"settings-shell",children:[n.jsxs("nav",{className:"settings-list","aria-label":"Settings",children:[n.jsx("div",{className:"settings-list-title",children:"Settings"}),l.map(d=>n.jsxs("a",{className:"nav-item",href:Xe({name:"settings",section:d.id}),"aria-current":d.id===u.id?"page":void 0,children:[n.jsx(be,{name:d.icon}),n.jsx("span",{className:"label",children:d.label})]},d.id))]}),n.jsxs("div",{className:"settings-detail",children:[n.jsx(rc,{title:u.label}),n.jsx("div",{className:"content-column",children:u.id==="profile"?n.jsx(eM,{}):u.id==="notifications"?n.jsx(LR,{}):u.id==="hosts"?n.jsx(AR,{id:i}):u.id==="desktop"?n.jsx(W4,{}):u.id==="workspaces"?n.jsx(TM,{id:i}):u.id==="admin"?n.jsx(Y4,{}):n.jsx(V4,{})})]})]})}const Dl={busyMs:3e3,idleMs:15e3,firstBackoffMs:5e3,maxBackoffMs:6e4};function FM(e){const[i,a]=N.useState({session:null,view:null,error:"",invalid:!1});return N.useEffect(()=>{const r=new AbortController,l={"X-Share-Token":e};let u,d=!1,h=0,p=!1;function m(){if(clearTimeout(u),r.signal.aborted||document.hidden)return;const v=h?Math.min(Dl.maxBackoffMs,Dl.firstBackoffMs*2**(h-1)):p?Dl.busyMs:Dl.idleMs;u=setTimeout(()=>{x()},v)}async function x(){if(!(r.signal.aborted||d)){d=!0,clearTimeout(u);try{const{session:v}=await ce("/api/shared",{signal:r.signal,headers:l});if(r.signal.aborted)return;a(w=>({...w,session:v}));const{view:b}=await ce("/api/shared/view",{signal:r.signal,headers:l});if(r.signal.aborted)return;p=b.busy,h=0,a(w=>({...w,view:b,error:""}))}catch(v){if(r.signal.aborted)return;if(v instanceof Pn&&v.status===404&&v.code==="not_found"){a({session:null,view:null,error:"",invalid:!0});return}h++,a(b=>({...b,error:On(v)}))}finally{d=!1}m()}}function y(){document.hidden?clearTimeout(u):x()}return document.addEventListener("visibilitychange",y),x(),()=>{r.abort(),clearTimeout(u),document.removeEventListener("visibilitychange",y)}},[e]),i}function GM({provider:e,modelId:i,status:a}){const r=e??"the provider";return a===401||a===403?`The host's Pi credentials for ${r} were rejected.`:a===429?`Rate limited by ${r}.`:a!==void 0&&a>=500&&a<600?`${r} was unavailable.`:`The request to ${[e,i].filter(Boolean).join("/")||"the model"} failed${a?` (HTTP ${a})`:""}`}function Cb({role:e,icon:i,label:a,text:r,trimmed:l}){return n.jsxs("details",{className:"entry-tool","data-role":e,children:[n.jsxs("summary",{children:[n.jsx(be,{name:i,size:14}),n.jsx("span",{className:"truncate",children:a}),n.jsx(be,{name:"chevron-right",size:14})]}),n.jsx("pre",{children:r}),l&&n.jsxs("p",{className:"muted small entry-brief",children:["Brief tool output · ",l.lines===1?"1 line":`${l.lines.toLocaleString()} lines`,", ",l.chars.toLocaleString()," characters in full."]})]})}function PM({entry:e}){const{prose:i,calls:a}=e.role==="assistant"?fc(e.text):{prose:e.text,calls:[]},r=a.length>0&&`Tool · ${a[0].name}`;if(e.kind==="workspace.run-stopped")return n.jsx("div",{className:"entry-stopped",role:"note",children:n.jsx("span",{children:"Stopped"})});if(e.kind==="workspace.run-crashed"||e.kind==="workspace.run-refused")return n.jsx("div",{className:"entry-stopped",role:"note",children:n.jsx("span",{children:e.text})});if(r&&!i.trim()||e.role==="system"||e.role==="toolResult"){const u=r||(e.role==="toolResult"?"Tool result":"System"),d=e.role==="toolResult"&&e.durationMs!==void 0&&n.jsxs(n.Fragment,{children:[" · ",n.jsx("span",{title:"How long the tool ran",children:Vl(e.durationMs)})]}),h=e.trimmed&&e.role==="toolResult"&&e.text.trim()?n.jsxs("span",{className:"muted",children:[" · ",e.text]}):null;return n.jsx(Cb,{role:e.role,icon:r?"tool":"terminal",label:n.jsxs(n.Fragment,{children:[u,d,h]}),text:e.text,trimmed:e.trimmed})}if(e.error)return e.error.compaction?n.jsx("div",{className:"entry-error",title:e.kind,children:n.jsx(we,{variant:"error",title:Gw,children:Pw(e.error.compaction,{advice:!1})})}):n.jsx("div",{className:"entry-error",title:e.kind,children:n.jsx(we,{variant:"error",title:"Model request failed",children:GM(e.error)})});if(e.role==="user")return n.jsx("div",{className:"entry-user",title:e.kind,children:n.jsx("div",{className:"entry-bubble",children:e.text})});const l=e.durationMs!==void 0&&n.jsx("span",{title:"How long the model took to reply",children:Vl(e.durationMs)});return n.jsxs("div",{className:"entry-assistant","data-role":e.role,title:e.kind,children:[n.jsx(bw,{text:i}),r&&n.jsx(Cb,{icon:"tool",label:r,text:a.map(u=>u.line).join(`
|
|
62
|
+
`),trimmed:e.trimmed}),l&&n.jsx("div",{className:"entry-actor",children:l})]})}function YM({token:e}){const{session:i,view:a,error:r,invalid:l}=FM(e),u=N.useRef(null),d=N.useRef(!0),h=(a?.entries??[]).filter(y=>y.role!=="system"||y.text.trim()),p=h.at(-1)?.id,m=i?.title;if(N.useEffect(()=>{document.title=m?`${m} · Pikibun`:"Shared session · Pikibun"},[m]),N.useLayoutEffect(()=>{const y=u.current;y&&d.current&&(y.scrollTop=y.scrollHeight)},[p,h.length]),l||!i)return!l&&!r?n.jsx(ds,{}):n.jsx("div",{className:"welcome",children:n.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[n.jsx(Ba,{size:40}),n.jsx("h1",{children:l?"This link doesn't work":"Can't open this session right now"}),l?n.jsx("p",{children:"The session's owner may have turned the link off. Ask them for a new one."}):n.jsxs(we,{variant:"error",title:"Couldn't load the shared session",children:[r," This page keeps trying."]})]})});const x=r?n.jsx(ge,{tone:"warning",dot:!0,children:"Reconnecting"}):a?a.busy?n.jsx(ge,{tone:"running",dot:!0,children:"Working"}):i.status==="archived"?n.jsx(ge,{tone:"neutral",children:"Archived"}):n.jsx(ge,{tone:"success",dot:!0,children:"Live"}):n.jsx(ge,{tone:"neutral",dot:!0,children:"Connecting"});return n.jsxs("div",{className:"shared-screen",children:[n.jsx(rc,{leading:n.jsx(Ba,{size:22}),title:i.title,subtitle:`Shared by ${i.ownerName}`,actions:n.jsxs("span",{className:"session-badges",children:[x,n.jsx(ge,{children:"Read-only"})]})}),r&&a&&n.jsx("div",{className:"session-alerts",children:n.jsxs(we,{variant:"warning",role:"status",title:"Can't refresh right now",children:[r," This page keeps trying and shows the last view it received."]})}),n.jsx("main",{id:"main-content",className:"session-transcript",ref:u,tabIndex:-1,"aria-label":"Shared session history",onScroll:y=>{const v=y.currentTarget;d.current=v.scrollHeight-v.scrollTop-v.clientHeight<80},children:n.jsx("div",{className:"chat-column",children:a?h.length?h.map(y=>n.jsx(PM,{entry:y},y.id)):n.jsx(xt,{title:"The conversation begins here",children:"Messages and tool results appear here as the work goes on"}):r?n.jsx(xt,{title:"The conversation isn't available right now",children:"The session's host may be offline. This page keeps trying."}):n.jsx(ds,{})})}),n.jsx("footer",{className:"shared-status",children:n.jsxs("div",{className:"chat-column",children:[a?.busy?n.jsxs(n.Fragment,{children:[n.jsx(qi,{}),"Working..."]}):a?"Idle":null,a&&n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsxs("span",{children:["Read-only, shared by link · Started ",n.jsx(Qt,{value:i.createdAt})]})]})})]})}const mh=6,gj="pikibun.collapsedWorkspaces";function VM(){try{return JSON.parse(localStorage.getItem(gj)??"[]")}catch{return[]}}function ZM({workspace:e,sessions:i,route:a,collapsed:r,toggle:l,onNavigate:u}){const{user:d,selectWorkspace:h,liveActivity:p}=pt(),[m,x]=N.useState(!1),y=Zw(i),v=m?y:y.slice(0,mh),b=Xe({name:"new",workspaceId:e.id});return n.jsxs("div",{className:"workspace-group",children:[n.jsxs("div",{className:"workspace-row",children:[n.jsxs("button",{type:"button",className:"nav-item",onClick:l,"aria-expanded":!r,title:e.name,children:[n.jsx(Is,{name:e.name,id:e.id}),n.jsx("span",{className:"label",children:e.name})]}),n.jsxs("div",{className:"row-actions",children:[so(e.role)&&n.jsx("a",{className:"btn ghost xs icon-only",href:b,"aria-label":`New session in ${e.name}`,title:"New session",onClick:()=>{h(e.id),u()},children:n.jsx(be,{name:"plus",size:14})}),n.jsx(ss,{label:`${e.name} options`,items:[...so(e.role)?[{label:"New session",icon:"plus",onSelect:()=>{h(e.id),window.location.hash=b,u()}}]:[],{label:"Workspace settings",icon:"settings",onSelect:()=>{window.location.hash=Xe({name:"settings",section:"workspaces",id:e.id}),u()}}]})]})]}),!r&&n.jsxs("ul",{children:[v.map(({session:w,depth:S})=>{const C=a.name==="session"&&a.sessionId===w.id,k=w.ownerId===d.id?null:w.permissions?.every(T=>T==="read")?"Viewer":"Shared",O=Vw(w,p?.sessionId===w.id?p.activity:void 0);return n.jsx("li",{style:S?{marginLeft:S*12}:void 0,children:n.jsxs("a",{className:"nav-item session-item",href:Xe({name:"session",sessionId:w.id}),"aria-current":C?"page":void 0,onClick:()=>{h(e.id),u()},children:[n.jsx(gi,{tone:O.tone,icon:O.icon,label:O.label?void 0:w.status}),n.jsxs("span",{className:"label",children:[n.jsxs("span",{className:"title",children:[S>0&&n.jsx("span",{className:"muted","aria-label":"Started by the session above",children:"↳ "}),w.title]}),(O.label||w.pullRequest||k)&&n.jsx("span",{className:"sub",children:[O.label&&n.jsx("span",{className:`session-status ${O.tone}`,children:O.label},"status"),w.pullRequest&&n.jsx(kw,{pull:w.pullRequest},"pull"),k].filter(Boolean).flatMap((T,M)=>M?[" · ",T]:[T])})]}),n.jsx("span",{className:"meta",children:n.jsx(Vn,{value:w.createdAt})})]})},w.id)}),i.length>mh&&n.jsx("li",{children:n.jsx("button",{type:"button",className:"nav-item sidebar-more",onClick:()=>x(w=>!w),children:n.jsx("span",{className:"label muted",children:m?"Show less":`Show ${i.length-mh} more`})})}),!i.length&&n.jsx("li",{children:n.jsx("a",{className:"nav-item session-item",href:b,onClick:()=>{h(e.id),u()},children:n.jsx("span",{className:"label muted",children:"Start a session"})})})]})]})}function XM({route:e,onNavigate:i}){const{user:a,workspaces:r,workspacesLoading:l,workspacesError:u,sessions:d,sessionsLoading:h,currentWorkspace:p}=pt(),[m,x]=N.useState(!1),[y,v]=N.useState(VM);function b(O){v(T=>{const M=T.includes(O)?T.filter(_=>_!==O):[...T,O];try{localStorage.setItem(gj,JSON.stringify(M))}catch{}return M})}const w=_b(),S=w.view?.update,C=w.bridge?.openUpdate,k=p&&so(p.role)?Xe({name:"new",workspaceId:p.id}):void 0;return n.jsxs("aside",{className:"sidebar","aria-label":"Workspaces and sessions",children:[n.jsxs("div",{className:"sidebar-top",children:[n.jsxs("a",{className:"nav-item",href:"#/",onClick:i,children:[n.jsx(Ba,{size:20}),n.jsx("span",{className:"label",style:{color:"var(--foreground)",fontWeight:500},children:"Pikibun"})]}),k&&n.jsxs("a",{className:"nav-item",href:k,onClick:i,"aria-current":e.name==="new"?"page":void 0,children:[n.jsx(be,{name:"plus"}),n.jsx("span",{className:"label",children:"New session"})]}),n.jsxs("a",{className:"nav-item",href:Xe({name:"sessions"}),onClick:i,"aria-current":e.name==="sessions"?"page":void 0,children:[n.jsx(be,{name:"history"}),n.jsx("span",{className:"label",children:"Sessions"})]})]}),n.jsxs("nav",{className:"sidebar-scroll","aria-label":"Workspaces",children:[l?n.jsx("div",{style:{padding:8},children:n.jsx($t,{})}):u?n.jsx("p",{className:"field-error",style:{padding:8},children:u}):r.length?r.map(O=>n.jsx(ZM,{workspace:O,route:e,onNavigate:i,sessions:d.filter(T=>T.workspaceId===O.id&&(T.status!=="archived"||e.name==="session"&&e.sessionId===T.id)),collapsed:y.includes(O.id),toggle:()=>b(O.id)},O.id)):n.jsxs("div",{className:"empty-card",children:[n.jsx("div",{className:"title",children:"No workspaces yet"}),n.jsx("div",{className:"description",children:"A workspace groups people, repositories, hosts and sessions."}),n.jsx("button",{type:"button",className:"btn secondary xs",onClick:()=>x(!0),children:"New workspace"})]}),h&&r.length>0&&n.jsx("div",{style:{padding:8},children:n.jsx($t,{children:"Loading sessions..."})}),!l&&r.length>0&&n.jsxs("button",{type:"button",className:"nav-item",style:{marginTop:12},onClick:()=>x(!0),children:[n.jsx(be,{name:"plus",size:14}),n.jsx("span",{className:"label",children:"New workspace"})]})]}),S&&C&&n.jsx("div",{className:"sidebar-update",children:n.jsxs("button",{type:"button",className:"btn default sm block",onClick:()=>{C()},title:`Pikibun ${S.version} is available: open its download page`,children:[n.jsx(be,{name:"sparkle",size:14}),"Update to ",S.version]})}),n.jsxs("div",{className:"sidebar-footer",children:[n.jsxs("a",{className:"nav-item host-chip",href:Xe({name:"settings",section:"profile"}),onClick:i,title:a.displayName,children:[n.jsx(Is,{name:a.displayName,id:a.id}),n.jsx("span",{className:"label",children:a.githubLogin?`@${a.githubLogin}`:a.displayName})]}),n.jsx("a",{className:"btn ghost sm icon-only",href:Xe({name:"settings",section:"hosts"}),onClick:i,"aria-label":"Hosts",title:"Hosts",children:n.jsx(be,{name:"server"})}),n.jsx("a",{className:"btn ghost sm icon-only",href:Xe({name:"settings",section:"profile"}),onClick:i,"aria-label":"Settings",title:"Settings","aria-current":e.name==="settings"?"page":void 0,children:n.jsx(be,{name:"settings"})})]}),n.jsx(of,{open:m,onClose:()=>{x(!1),i()}})]})}Hh();Y0();const xj=n.jsx("a",{href:"#main-content",className:"btn secondary sm skip-link",onClick:e=>{e.preventDefault(),document.getElementById("main-content")?.focus()},children:"Skip to content"});function QM(e){switch(e.name){case"home":return"Pikibun";case"sessions":return"Sessions · Pikibun";case"new":return"New session · Pikibun";case"session":return"Session · Pikibun";case"settings":return"Settings · Pikibun";case"shared":return"Shared session · Pikibun";case"join":return"Join workspace · Pikibun"}}function KM({error:e,retry:i,inviteToken:a}){const r=a!==void 0,l=$e("/api/health"),[u,d]=N.useState(!1),[h,p]=N.useState(""),m=new URLSearchParams(window.location.search).get("error"),x=e||l.error||h||(m?`GitHub sign-in did not complete: ${m.slice(0,300)}`:""),y=l.data?.githubConfigured===!1,v=l.data?.passwordAuth===!0,b=y&&!v,w=l.data?.localServer,S=[...!y&&!w?[l.data?.githubSignup??"open"]:[],...v?[l.data?.passwordSignup??"off"]:[]],C=r||!l.data||S.includes("open")?"":S.includes("invite")?"New here? Open the invite link a workspace owner or admin shared with you to create an account.":"This Pikibun doesn't take new accounts. If you have one, sign in.";async function k(O){if(a!==void 0){O.preventDefault(),d(!0),p("");try{const T=await fetch("/api/auth/github/start",{method:"POST",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({inviteToken:a})}),M=await T.json().catch(()=>null);if(!T.ok||typeof M?.url!="string")throw new Error(typeof M?.error=="string"?M.error:`GitHub sign-in could not start (HTTP ${T.status}).`);window.location.assign(M.url)}catch(T){p(T instanceof Error?T.message:"GitHub sign-in could not start."),d(!1)}}}return n.jsxs("div",{className:"welcome",children:[xj,n.jsxs("main",{id:"main-content",className:"welcome-inner",tabIndex:-1,children:[n.jsx(Ba,{size:40}),n.jsx("h1",{children:"Pikibun"}),n.jsx("p",{children:"Run Pi agents on your own machine, and work on them together with your team."}),r&&n.jsx(we,{variant:"info",title:"You're invited to a workspace",role:"status",children:"Sign in to ask to join it. An owner or admin accepts you before you can see anything in it."}),x&&n.jsx(we,{variant:"error",title:"Sign-in problem",children:x}),b&&(w?n.jsxs(we,{variant:"warning",title:"GitHub sign-in is not set up",children:["This Pikibun runs on this computer and needs a GitHub OAuth app of yours to sign you in. Add one where you started it: run ",n.jsx("code",{children:"pikibun serve"})," again in a terminal, which shows how, or use the Pikibun app's Settings."]}):n.jsx(we,{variant:"warning",title:"GitHub sign-in is not configured",children:"The operator needs to configure the GitHub OAuth app, its callback URL and the server's GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET and VAULT_KEY settings."})),!b&&w&&!w.claimed&&n.jsxs(we,{variant:"info",title:"Set up this Pikibun",role:"status",children:["This Pikibun runs on this computer and has no owner yet. Sign in with the link ",n.jsx("code",{children:"pikibun serve"})," printed when it started, or from the Pikibun app, which opens it for you: your GitHub account becomes its owner, and the only one that can sign in."]}),n.jsxs("div",{className:"actions",children:[v&&n.jsx(gS,{signedIn:i,signup:l.data?.passwordSignup??"off",inviteToken:a}),v&&!y&&n.jsx("div",{className:"sign-in-divider",role:"separator",children:"or"}),!y&&n.jsxs("a",{className:"btn default lg",href:"/api/auth/github","aria-disabled":u,onClick:O=>{k(O)},children:[n.jsx(Yl,{}),"Continue with GitHub"]}),C&&n.jsx("p",{className:"welcome-footnote",children:C}),(x||b)&&n.jsx(q,{onClick:()=>{i(),l.refresh()},children:"Try again"})]}),n.jsxs("p",{className:"welcome-footnote",children:["Model credentials stay on your host. GitHub tokens stay on the server, or go only to your own hosts when you push with your account.",v&&!y&&" Repositories on github.com need the GitHub sign-in; a password account reaches other Git providers with their tokens."]})]})]})}function WM(){const{workspaces:e,workspacesLoading:i,workspacesError:a,refreshWorkspaces:r,currentWorkspace:l}=pt(),[u,d]=N.useState(!1);return i?n.jsx(ds,{}):a?n.jsx("div",{className:"content-column",children:n.jsx(we,{variant:"error",title:"Could not load workspaces",actions:n.jsx(q,{size:"sm",onClick:r,children:"Try again"}),children:a})}):l?n.jsx(ov,{workspaceId:l.id},l.id):n.jsxs("div",{className:"welcome",children:[n.jsxs("div",{className:"welcome-inner",children:[n.jsx(Ba,{size:40}),n.jsx("h1",{children:"Welcome to Pikibun"}),n.jsx("p",{children:"Create a workspace for your team, add a repository and pair a host to start your first session."}),n.jsx("div",{className:"actions",children:n.jsx(q,{variant:"default",size:"lg",onClick:()=>d(!0),children:"New workspace"})}),n.jsx("p",{className:"welcome-footnote",children:"Joining a team? Open the invite link an owner or admin shared, or ask them to add you with your User ID from Settings."}),n.jsx(Xh,{})]}),n.jsx(of,{open:u,onClose:()=>d(!1)})]})}function JM(){const e=Zh(),{user:i}=pt(),[a,r]=N.useState(!1);mS(i.id),N.useEffect(()=>{document.title=QM(e)},[e]),N.useEffect(()=>{document.getElementById("main-content")?.scrollTo({top:0})},[e]),N.useEffect(()=>{const d=Q0();d&&e.name!=="join"&&xi({name:"join",token:d})},[]);const l=e.name==="session"?n.jsx(I4,{sessionId:e.sessionId},e.sessionId):e.name==="join"?n.jsx(W0,{token:e.token},e.token):e.name==="new"?n.jsx(ov,{workspaceId:e.workspaceId},e.workspaceId):e.name==="sessions"?n.jsx(G4,{}):e.name==="settings"?n.jsx(qM,{section:e.section,id:e.id},`${e.section}/${e.id??""}`):n.jsx(WM,{}),u=e.name==="session";return n.jsx(lO,{value:{open:()=>r(!0),expanded:a},children:n.jsxs("div",{className:`app${a?" sidebar-open":""}${u?" own-header":""}`,children:[xj,n.jsxs("header",{className:"mobile-header",children:[n.jsx("button",{type:"button",className:"btn ghost sm icon-only","aria-label":"Open navigation","aria-expanded":a,onClick:()=>r(!0),children:n.jsx(be,{name:"menu"})}),n.jsx("span",{className:"screen-title",children:"Pikibun"})]}),n.jsx(XM,{route:e,onNavigate:()=>r(!1)}),n.jsx("div",{className:"scrim",onClick:()=>r(!1),"aria-hidden":"true"}),n.jsx("main",{id:"main-content",className:`main${e.name==="session"?" no-scroll":""}`,tabIndex:-1,children:l})]})})}function eD(){const[e,i]=N.useState(null),[a,r]=N.useState(!0),[l,u]=N.useState(""),[d,h]=N.useState(0);N.useEffect(()=>{const x=new AbortController;return r(!0),u(""),ce("/api/me",{signal:x.signal}).then(y=>{x.signal.aborted||i(y.user)}).catch(y=>{x.signal.aborted||(i(null),y instanceof Pn&&y.status===401||u(On(y)))}).finally(()=>{x.signal.aborted||r(!1)}),()=>x.abort()},[d]);async function p(){try{await ce("/api/auth/logout",{method:"POST"})}catch(x){u(On(x));return}i(null),xi({name:"home"})}const m=Zh();return N.useEffect(()=>{!a&&!e&&m.name==="join"&&X0(m.token)},[a,e,m]),a?n.jsx(ds,{}):e?n.jsx(V0,{user:e,setUser:i,signOut:()=>{p()},children:n.jsx(JM,{})},e.id):n.jsx(KM,{error:l,retry:()=>h(x=>x+1),inviteToken:m.name==="join"?m.token:void 0})}function tD(){Kw();const e=Zh();return e.name==="shared"?n.jsx(YM,{token:e.token},e.token):n.jsx(eD,{})}const yj=document.getElementById("root");if(!yj)throw new Error("Application root is missing.");Tb.createRoot(yj).render(n.jsx(N.StrictMode,{children:n.jsx(tD,{})}));export{Ab as g};
|