bugxhunter 0.11.1 → 0.13.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.
@@ -1,4 +1,4 @@
1
- var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in l?fS(l,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[o]=c;var Ct=(l,o,c)=>hS(l,typeof o!="symbol"?o+"":o,c),mS=(l,o,c)=>o.has(l)||Ey("Cannot "+c);var Cy=(l,o,c)=>o.has(l)?Ey("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,c);var My=(l,o,c)=>(mS(l,o,"access private method"),c);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function c(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function u(d){if(d.ep)return;d.ep=!0;const h=c(d);fetch(d.href,h)}})();function Dv(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var vf={exports:{}},yo={};/**
1
+ var pS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var gS=(l,o,c)=>o in l?pS(l,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[o]=c;var Ct=(l,o,c)=>gS(l,typeof o!="symbol"?o+"":o,c),yS=(l,o,c)=>o.has(l)||Ey("Cannot "+c);var Cy=(l,o,c)=>o.has(l)?Ey("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,c);var My=(l,o,c)=>(yS(l,o,"access private method"),c);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))u(d);new MutationObserver(d=>{for(const h of d)if(h.type==="childList")for(const m of h.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&u(m)}).observe(document,{childList:!0,subtree:!0});function c(d){const h={};return d.integrity&&(h.integrity=d.integrity),d.referrerPolicy&&(h.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?h.credentials="include":d.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function u(d){if(d.ep)return;d.ep=!0;const h=c(d);fetch(d.href,h)}})();function Lv(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var vf={exports:{}},yo={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,7 +6,7 @@ var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var _y;function pS(){if(_y)return yo;_y=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,d,h){var m=null;if(h!==void 0&&(m=""+h),d.key!==void 0&&(m=""+d.key),"key"in d){h={};for(var y in d)y!=="key"&&(h[y]=d[y])}else h=d;return d=h.ref,{$$typeof:l,type:u,key:m,ref:d!==void 0?d:null,props:h}}return yo.Fragment=o,yo.jsx=c,yo.jsxs=c,yo}var Ry;function gS(){return Ry||(Ry=1,vf.exports=pS()),vf.exports}var i=gS(),bf={exports:{}},Ke={};/**
9
+ */var _y;function vS(){if(_y)return yo;_y=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function c(u,d,h){var m=null;if(h!==void 0&&(m=""+h),d.key!==void 0&&(m=""+d.key),"key"in d){h={};for(var y in d)y!=="key"&&(h[y]=d[y])}else h=d;return d=h.ref,{$$typeof:l,type:u,key:m,ref:d!==void 0?d:null,props:h}}return yo.Fragment=o,yo.jsx=c,yo.jsxs=c,yo}var Ry;function bS(){return Ry||(Ry=1,vf.exports=vS()),vf.exports}var s=bS(),bf={exports:{}},Ke={};/**
10
10
  * @license React
11
11
  * react.production.js
12
12
  *
@@ -14,7 +14,7 @@ var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Oy;function yS(){if(Oy)return Ke;Oy=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),k=Symbol.iterator;function D(j){return j===null||typeof j!="object"?null:(j=k&&j[k]||j["@@iterator"],typeof j=="function"?j:null)}var V={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},L=Object.assign,K={};function ce(j,ae,je){this.props=j,this.context=ae,this.refs=K,this.updater=je||V}ce.prototype.isReactComponent={},ce.prototype.setState=function(j,ae){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,ae,"setState")},ce.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function de(){}de.prototype=ce.prototype;function E(j,ae,je){this.props=j,this.context=ae,this.refs=K,this.updater=je||V}var G=E.prototype=new de;G.constructor=E,L(G,ce.prototype),G.isPureReactComponent=!0;var H=Array.isArray;function Y(){}var F={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function X(j,ae,je){var pe=je.ref;return{$$typeof:l,type:j,key:ae,ref:pe!==void 0?pe:null,props:je}}function P(j,ae){return X(j.type,ae,j.props)}function Q(j){return typeof j=="object"&&j!==null&&j.$$typeof===l}function me(j){var ae={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(je){return ae[je]})}var ve=/\/+/g;function Ce(j,ae){return typeof j=="object"&&j!==null&&j.key!=null?me(""+j.key):ae.toString(36)}function ne(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(Y,Y):(j.status="pending",j.then(function(ae){j.status==="pending"&&(j.status="fulfilled",j.value=ae)},function(ae){j.status==="pending"&&(j.status="rejected",j.reason=ae)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function te(j,ae,je,pe,Ie){var Oe=typeof j;(Oe==="undefined"||Oe==="boolean")&&(j=null);var ze=!1;if(j===null)ze=!0;else switch(Oe){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(j.$$typeof){case l:case o:ze=!0;break;case g:return ze=j._init,te(ze(j._payload),ae,je,pe,Ie)}}if(ze)return Ie=Ie(j),ze=pe===""?"."+Ce(j,0):pe,H(Ie)?(je="",ze!=null&&(je=ze.replace(ve,"$&/")+"/"),te(Ie,ae,je,"",function(mt){return mt})):Ie!=null&&(Q(Ie)&&(Ie=P(Ie,je+(Ie.key==null||j&&j.key===Ie.key?"":(""+Ie.key).replace(ve,"$&/")+"/")+ze)),ae.push(Ie)),1;ze=0;var Se=pe===""?".":pe+":";if(H(j))for(var _e=0;_e<j.length;_e++)pe=j[_e],Oe=Se+Ce(pe,_e),ze+=te(pe,ae,je,Oe,Ie);else if(_e=D(j),typeof _e=="function")for(j=_e.call(j),_e=0;!(pe=j.next()).done;)pe=pe.value,Oe=Se+Ce(pe,_e++),ze+=te(pe,ae,je,Oe,Ie);else if(Oe==="object"){if(typeof j.then=="function")return te(ne(j),ae,je,pe,Ie);throw ae=String(j),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return ze}function re(j,ae,je){if(j==null)return j;var pe=[],Ie=0;return te(j,pe,"","",function(Oe){return ae.call(je,Oe,Ie++)}),pe}function ee(j){if(j._status===-1){var ae=j._result,je=ae();je.then(function(pe){(j._status===0||j._status===-1)&&(j._status=1,j._result=pe,je.status===void 0&&(je.status="fulfilled",je.value=pe))},function(pe){(j._status===0||j._status===-1)&&(j._status=2,j._result=pe,je.status===void 0&&(je.status="rejected",je.reason=pe))}),j._status===-1&&(j._status=0,j._result=je)}if(j._status===1)return j._result.default;throw j._result}var ke=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)};function Ze(j){var ae=F.T,je={};je.types=ae!==null?ae.types:null,F.T=je;try{var pe=j(),Ie=F.S;Ie!==null&&Ie(je,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(Y,ke)}catch(Oe){ke(Oe)}finally{ae!==null&&je.types!==null&&(ae.types=je.types),F.T=ae}}function bt(j){var ae=F.T;if(ae!==null){var je=ae.types;je===null?ae.types=[j]:je.indexOf(j)===-1&&je.push(j)}else Ze(bt.bind(null,j))}var kt={map:re,forEach:function(j,ae,je){re(j,function(){ae.apply(this,arguments)},je)},count:function(j){var ae=0;return re(j,function(){ae++}),ae},toArray:function(j){return re(j,function(ae){return ae})||[]},only:function(j){if(!Q(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Ke.Activity=b,Ke.Children=kt,Ke.Component=ce,Ke.Fragment=c,Ke.Profiler=d,Ke.PureComponent=E,Ke.StrictMode=u,Ke.Suspense=v,Ke.ViewTransition=x,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(j){return F.H.useMemoCache(j)}},Ke.addTransitionType=bt,Ke.cache=function(j){return function(){return j.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(j,ae,je){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var pe=L({},j.props),Ie=j.key;if(ae!=null)for(Oe in ae.key!==void 0&&(Ie=""+ae.key),ae)!ie.call(ae,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&ae.ref===void 0||(pe[Oe]=ae[Oe]);var Oe=arguments.length-2;if(Oe===1)pe.children=je;else if(1<Oe){for(var ze=Array(Oe),Se=0;Se<Oe;Se++)ze[Se]=arguments[Se+2];pe.children=ze}return X(j.type,Ie,pe)},Ke.createContext=function(j){return j={$$typeof:m,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:h,_context:j},j},Ke.createElement=function(j,ae,je){var pe,Ie={},Oe=null;if(ae!=null)for(pe in ae.key!==void 0&&(Oe=""+ae.key),ae)ie.call(ae,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Ie[pe]=ae[pe]);var ze=arguments.length-2;if(ze===1)Ie.children=je;else if(1<ze){for(var Se=Array(ze),_e=0;_e<ze;_e++)Se[_e]=arguments[_e+2];Ie.children=Se}if(j&&j.defaultProps)for(pe in ze=j.defaultProps,ze)Ie[pe]===void 0&&(Ie[pe]=ze[pe]);return X(j,Oe,Ie)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(j){return{$$typeof:y,render:j}},Ke.isValidElement=Q,Ke.lazy=function(j){return{$$typeof:g,_payload:{_status:-1,_result:j},_init:ee}},Ke.memo=function(j,ae){return{$$typeof:S,type:j,compare:ae===void 0?null:ae}},Ke.startTransition=Ze,Ke.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ke.use=function(j){return F.H.use(j)},Ke.useActionState=function(j,ae,je){return F.H.useActionState(j,ae,je)},Ke.useCallback=function(j,ae){return F.H.useCallback(j,ae)},Ke.useContext=function(j){return F.H.useContext(j)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(j,ae){return F.H.useDeferredValue(j,ae)},Ke.useEffect=function(j,ae){return F.H.useEffect(j,ae)},Ke.useEffectEvent=function(j){return F.H.useEffectEvent(j)},Ke.useId=function(){return F.H.useId()},Ke.useImperativeHandle=function(j,ae,je){return F.H.useImperativeHandle(j,ae,je)},Ke.useInsertionEffect=function(j,ae){return F.H.useInsertionEffect(j,ae)},Ke.useLayoutEffect=function(j,ae){return F.H.useLayoutEffect(j,ae)},Ke.useMemo=function(j,ae){return F.H.useMemo(j,ae)},Ke.useOptimistic=function(j,ae){return F.H.useOptimistic(j,ae)},Ke.useReducer=function(j,ae,je){return F.H.useReducer(j,ae,je)},Ke.useRef=function(j){return F.H.useRef(j)},Ke.useState=function(j){return F.H.useState(j)},Ke.useSyncExternalStore=function(j,ae,je){return F.H.useSyncExternalStore(j,ae,je)},Ke.useTransition=function(){return F.H.useTransition()},Ke.version="19.3.0",Ke}var Dy;function Wf(){return Dy||(Dy=1,bf.exports=yS()),bf.exports}var A=Wf();const vS=Dv(A);var xf={exports:{}},vo={},Sf={exports:{}},wf={};/**
17
+ */var Oy;function xS(){if(Oy)return Ke;Oy=1;var l=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),m=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.for("react.view_transition"),k=Symbol.iterator;function L(j){return j===null||typeof j!="object"?null:(j=k&&j[k]||j["@@iterator"],typeof j=="function"?j:null)}var V={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,Z={};function oe(j,ae,je){this.props=j,this.context=ae,this.refs=Z,this.updater=je||V}oe.prototype.isReactComponent={},oe.prototype.setState=function(j,ae){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,ae,"setState")},oe.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function de(){}de.prototype=oe.prototype;function C(j,ae,je){this.props=j,this.context=ae,this.refs=Z,this.updater=je||V}var Y=C.prototype=new de;Y.constructor=C,z(Y,oe.prototype),Y.isPureReactComponent=!0;var O=Array.isArray;function X(){}var F={H:null,A:null,T:null,S:null},ie=Object.prototype.hasOwnProperty;function G(j,ae,je){var pe=je.ref;return{$$typeof:l,type:j,key:ae,ref:pe!==void 0?pe:null,props:je}}function Q(j,ae){return G(j.type,ae,j.props)}function K(j){return typeof j=="object"&&j!==null&&j.$$typeof===l}function me(j){var ae={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(je){return ae[je]})}var ve=/\/+/g;function Ce(j,ae){return typeof j=="object"&&j!==null&&j.key!=null?me(""+j.key):ae.toString(36)}function ne(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(X,X):(j.status="pending",j.then(function(ae){j.status==="pending"&&(j.status="fulfilled",j.value=ae)},function(ae){j.status==="pending"&&(j.status="rejected",j.reason=ae)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function te(j,ae,je,pe,Ie){var Oe=typeof j;(Oe==="undefined"||Oe==="boolean")&&(j=null);var ze=!1;if(j===null)ze=!0;else switch(Oe){case"bigint":case"string":case"number":ze=!0;break;case"object":switch(j.$$typeof){case l:case o:ze=!0;break;case g:return ze=j._init,te(ze(j._payload),ae,je,pe,Ie)}}if(ze)return Ie=Ie(j),ze=pe===""?"."+Ce(j,0):pe,O(Ie)?(je="",ze!=null&&(je=ze.replace(ve,"$&/")+"/"),te(Ie,ae,je,"",function(mt){return mt})):Ie!=null&&(K(Ie)&&(Ie=Q(Ie,je+(Ie.key==null||j&&j.key===Ie.key?"":(""+Ie.key).replace(ve,"$&/")+"/")+ze)),ae.push(Ie)),1;ze=0;var Se=pe===""?".":pe+":";if(O(j))for(var _e=0;_e<j.length;_e++)pe=j[_e],Oe=Se+Ce(pe,_e),ze+=te(pe,ae,je,Oe,Ie);else if(_e=L(j),typeof _e=="function")for(j=_e.call(j),_e=0;!(pe=j.next()).done;)pe=pe.value,Oe=Se+Ce(pe,_e++),ze+=te(pe,ae,je,Oe,Ie);else if(Oe==="object"){if(typeof j.then=="function")return te(ne(j),ae,je,pe,Ie);throw ae=String(j),Error("Objects are not valid as a React child (found: "+(ae==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":ae)+"). If you meant to render a collection of children, use an array instead.")}return ze}function ce(j,ae,je){if(j==null)return j;var pe=[],Ie=0;return te(j,pe,"","",function(Oe){return ae.call(je,Oe,Ie++)}),pe}function ee(j){if(j._status===-1){var ae=j._result,je=ae();je.then(function(pe){(j._status===0||j._status===-1)&&(j._status=1,j._result=pe,je.status===void 0&&(je.status="fulfilled",je.value=pe))},function(pe){(j._status===0||j._status===-1)&&(j._status=2,j._result=pe,je.status===void 0&&(je.status="rejected",je.reason=pe))}),j._status===-1&&(j._status=0,j._result=je)}if(j._status===1)return j._result.default;throw j._result}var ke=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ae=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(ae))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)};function Ze(j){var ae=F.T,je={};je.types=ae!==null?ae.types:null,F.T=je;try{var pe=j(),Ie=F.S;Ie!==null&&Ie(je,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(X,ke)}catch(Oe){ke(Oe)}finally{ae!==null&&je.types!==null&&(ae.types=je.types),F.T=ae}}function bt(j){var ae=F.T;if(ae!==null){var je=ae.types;je===null?ae.types=[j]:je.indexOf(j)===-1&&je.push(j)}else Ze(bt.bind(null,j))}var kt={map:ce,forEach:function(j,ae,je){ce(j,function(){ae.apply(this,arguments)},je)},count:function(j){var ae=0;return ce(j,function(){ae++}),ae},toArray:function(j){return ce(j,function(ae){return ae})||[]},only:function(j){if(!K(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Ke.Activity=b,Ke.Children=kt,Ke.Component=oe,Ke.Fragment=c,Ke.Profiler=d,Ke.PureComponent=C,Ke.StrictMode=u,Ke.Suspense=v,Ke.ViewTransition=x,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(j){return F.H.useMemoCache(j)}},Ke.addTransitionType=bt,Ke.cache=function(j){return function(){return j.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(j,ae,je){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var pe=z({},j.props),Ie=j.key;if(ae!=null)for(Oe in ae.key!==void 0&&(Ie=""+ae.key),ae)!ie.call(ae,Oe)||Oe==="key"||Oe==="__self"||Oe==="__source"||Oe==="ref"&&ae.ref===void 0||(pe[Oe]=ae[Oe]);var Oe=arguments.length-2;if(Oe===1)pe.children=je;else if(1<Oe){for(var ze=Array(Oe),Se=0;Se<Oe;Se++)ze[Se]=arguments[Se+2];pe.children=ze}return G(j.type,Ie,pe)},Ke.createContext=function(j){return j={$$typeof:m,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:h,_context:j},j},Ke.createElement=function(j,ae,je){var pe,Ie={},Oe=null;if(ae!=null)for(pe in ae.key!==void 0&&(Oe=""+ae.key),ae)ie.call(ae,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(Ie[pe]=ae[pe]);var ze=arguments.length-2;if(ze===1)Ie.children=je;else if(1<ze){for(var Se=Array(ze),_e=0;_e<ze;_e++)Se[_e]=arguments[_e+2];Ie.children=Se}if(j&&j.defaultProps)for(pe in ze=j.defaultProps,ze)Ie[pe]===void 0&&(Ie[pe]=ze[pe]);return G(j,Oe,Ie)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(j){return{$$typeof:y,render:j}},Ke.isValidElement=K,Ke.lazy=function(j){return{$$typeof:g,_payload:{_status:-1,_result:j},_init:ee}},Ke.memo=function(j,ae){return{$$typeof:S,type:j,compare:ae===void 0?null:ae}},Ke.startTransition=Ze,Ke.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Ke.use=function(j){return F.H.use(j)},Ke.useActionState=function(j,ae,je){return F.H.useActionState(j,ae,je)},Ke.useCallback=function(j,ae){return F.H.useCallback(j,ae)},Ke.useContext=function(j){return F.H.useContext(j)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(j,ae){return F.H.useDeferredValue(j,ae)},Ke.useEffect=function(j,ae){return F.H.useEffect(j,ae)},Ke.useEffectEvent=function(j){return F.H.useEffectEvent(j)},Ke.useId=function(){return F.H.useId()},Ke.useImperativeHandle=function(j,ae,je){return F.H.useImperativeHandle(j,ae,je)},Ke.useInsertionEffect=function(j,ae){return F.H.useInsertionEffect(j,ae)},Ke.useLayoutEffect=function(j,ae){return F.H.useLayoutEffect(j,ae)},Ke.useMemo=function(j,ae){return F.H.useMemo(j,ae)},Ke.useOptimistic=function(j,ae){return F.H.useOptimistic(j,ae)},Ke.useReducer=function(j,ae,je){return F.H.useReducer(j,ae,je)},Ke.useRef=function(j){return F.H.useRef(j)},Ke.useState=function(j){return F.H.useState(j)},Ke.useSyncExternalStore=function(j,ae,je){return F.H.useSyncExternalStore(j,ae,je)},Ke.useTransition=function(){return F.H.useTransition()},Ke.version="19.3.0",Ke}var Dy;function Wf(){return Dy||(Dy=1,bf.exports=xS()),bf.exports}var A=Wf();const SS=Lv(A);var xf={exports:{}},vo={},Sf={exports:{}},wf={};/**
18
18
  * @license React
19
19
  * scheduler.production.js
20
20
  *
@@ -22,7 +22,7 @@ var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Ly;function bS(){return Ly||(Ly=1,(function(l){function o(ne,te){var re=ne.length;ne.push(te);e:for(;0<re;){var ee=re-1>>>1,ke=ne[ee];if(0<d(ke,te))ne[ee]=te,ne[re]=ke,re=ee;else break e}}function c(ne){return ne.length===0?null:ne[0]}function u(ne){if(ne.length===0)return null;var te=ne[0],re=ne.pop();if(re!==te){ne[0]=re;e:for(var ee=0,ke=ne.length,Ze=ke>>>1;ee<Ze;){var bt=2*(ee+1)-1,kt=ne[bt],j=bt+1,ae=ne[j];if(0>d(kt,re))j<ke&&0>d(ae,kt)?(ne[ee]=ae,ne[j]=re,ee=j):(ne[ee]=kt,ne[bt]=re,ee=bt);else if(j<ke&&0>d(ae,re))ne[ee]=ae,ne[j]=re,ee=j;else break e}}return te}function d(ne,te){var re=ne.sortIndex-te.sortIndex;return re!==0?re:ne.id-te.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;l.unstable_now=function(){return h.now()}}else{var m=Date,y=m.now();l.unstable_now=function(){return m.now()-y}}var v=[],S=[],g=1,b=null,x=3,k=!1,D=!1,V=!1,L=!1,K=typeof setTimeout=="function"?setTimeout:null,ce=typeof clearTimeout=="function"?clearTimeout:null,de=typeof setImmediate<"u"?setImmediate:null;function E(ne){for(var te=c(S);te!==null;){if(te.callback===null)u(S);else if(te.startTime<=ne)u(S),te.sortIndex=te.expirationTime,o(v,te);else break;te=c(S)}}function G(ne){if(V=!1,E(ne),!D)if(c(v)!==null)D=!0,H||(H=!0,Q());else{var te=c(S);te!==null&&Ce(G,te.startTime-ne)}}var H=!1,Y=-1,F=5,ie=-1;function X(){return L?!0:!(l.unstable_now()-ie<F)}function P(){if(L=!1,H){var ne=l.unstable_now();ie=ne;var te=!0;try{e:{D=!1,V&&(V=!1,ce(Y),Y=-1),k=!0;var re=x;try{t:{for(E(ne),b=c(v);b!==null&&!(b.expirationTime>ne&&X());){var ee=b.callback;if(typeof ee=="function"){b.callback=null,x=b.priorityLevel;var ke=ee(b.expirationTime<=ne);if(ne=l.unstable_now(),typeof ke=="function"){b.callback=ke,E(ne),te=!0;break t}b===c(v)&&u(v),E(ne)}else u(v);b=c(v)}if(b!==null)te=!0;else{var Ze=c(S);Ze!==null&&Ce(G,Ze.startTime-ne),te=!1}}break e}finally{b=null,x=re,k=!1}te=void 0}}finally{te?Q():H=!1}}}var Q;if(typeof de=="function")Q=function(){de(P)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,ve=me.port2;me.port1.onmessage=P,Q=function(){ve.postMessage(null)}}else Q=function(){K(P,0)};function Ce(ne,te){Y=K(function(){ne(l.unstable_now())},te)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(ne){ne.callback=null},l.unstable_forceFrameRate=function(ne){0>ne||125<ne?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<ne?Math.floor(1e3/ne):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(ne){switch(x){case 1:case 2:case 3:var te=3;break;default:te=x}var re=x;x=te;try{return ne()}finally{x=re}},l.unstable_requestPaint=function(){L=!0},l.unstable_runWithPriority=function(ne,te){switch(ne){case 1:case 2:case 3:case 4:case 5:break;default:ne=3}var re=x;x=ne;try{return te()}finally{x=re}},l.unstable_scheduleCallback=function(ne,te,re){var ee=l.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?ee+re:ee):re=ee,ne){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=re+ke,ne={id:g++,callback:te,priorityLevel:ne,startTime:re,expirationTime:ke,sortIndex:-1},re>ee?(ne.sortIndex=re,o(S,ne),c(v)===null&&ne===c(S)&&(V?(ce(Y),Y=-1):V=!0,Ce(G,re-ee))):(ne.sortIndex=ke,o(v,ne),D||k||(D=!0,H||(H=!0,Q()))),ne},l.unstable_shouldYield=X,l.unstable_wrapCallback=function(ne){var te=x;return function(){var re=x;x=te;try{return ne.apply(this,arguments)}finally{x=re}}}})(wf)),wf}var zy;function xS(){return zy||(zy=1,Sf.exports=bS()),Sf.exports}var Af={exports:{}},hn={};/**
25
+ */var Ly;function wS(){return Ly||(Ly=1,(function(l){function o(ne,te){var ce=ne.length;ne.push(te);e:for(;0<ce;){var ee=ce-1>>>1,ke=ne[ee];if(0<d(ke,te))ne[ee]=te,ne[ce]=ke,ce=ee;else break e}}function c(ne){return ne.length===0?null:ne[0]}function u(ne){if(ne.length===0)return null;var te=ne[0],ce=ne.pop();if(ce!==te){ne[0]=ce;e:for(var ee=0,ke=ne.length,Ze=ke>>>1;ee<Ze;){var bt=2*(ee+1)-1,kt=ne[bt],j=bt+1,ae=ne[j];if(0>d(kt,ce))j<ke&&0>d(ae,kt)?(ne[ee]=ae,ne[j]=ce,ee=j):(ne[ee]=kt,ne[bt]=ce,ee=bt);else if(j<ke&&0>d(ae,ce))ne[ee]=ae,ne[j]=ce,ee=j;else break e}}return te}function d(ne,te){var ce=ne.sortIndex-te.sortIndex;return ce!==0?ce:ne.id-te.id}if(l.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;l.unstable_now=function(){return h.now()}}else{var m=Date,y=m.now();l.unstable_now=function(){return m.now()-y}}var v=[],S=[],g=1,b=null,x=3,k=!1,L=!1,V=!1,z=!1,Z=typeof setTimeout=="function"?setTimeout:null,oe=typeof clearTimeout=="function"?clearTimeout:null,de=typeof setImmediate<"u"?setImmediate:null;function C(ne){for(var te=c(S);te!==null;){if(te.callback===null)u(S);else if(te.startTime<=ne)u(S),te.sortIndex=te.expirationTime,o(v,te);else break;te=c(S)}}function Y(ne){if(V=!1,C(ne),!L)if(c(v)!==null)L=!0,O||(O=!0,K());else{var te=c(S);te!==null&&Ce(Y,te.startTime-ne)}}var O=!1,X=-1,F=5,ie=-1;function G(){return z?!0:!(l.unstable_now()-ie<F)}function Q(){if(z=!1,O){var ne=l.unstable_now();ie=ne;var te=!0;try{e:{L=!1,V&&(V=!1,oe(X),X=-1),k=!0;var ce=x;try{t:{for(C(ne),b=c(v);b!==null&&!(b.expirationTime>ne&&G());){var ee=b.callback;if(typeof ee=="function"){b.callback=null,x=b.priorityLevel;var ke=ee(b.expirationTime<=ne);if(ne=l.unstable_now(),typeof ke=="function"){b.callback=ke,C(ne),te=!0;break t}b===c(v)&&u(v),C(ne)}else u(v);b=c(v)}if(b!==null)te=!0;else{var Ze=c(S);Ze!==null&&Ce(Y,Ze.startTime-ne),te=!1}}break e}finally{b=null,x=ce,k=!1}te=void 0}}finally{te?K():O=!1}}}var K;if(typeof de=="function")K=function(){de(Q)};else if(typeof MessageChannel<"u"){var me=new MessageChannel,ve=me.port2;me.port1.onmessage=Q,K=function(){ve.postMessage(null)}}else K=function(){Z(Q,0)};function Ce(ne,te){X=Z(function(){ne(l.unstable_now())},te)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(ne){ne.callback=null},l.unstable_forceFrameRate=function(ne){0>ne||125<ne?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<ne?Math.floor(1e3/ne):5},l.unstable_getCurrentPriorityLevel=function(){return x},l.unstable_next=function(ne){switch(x){case 1:case 2:case 3:var te=3;break;default:te=x}var ce=x;x=te;try{return ne()}finally{x=ce}},l.unstable_requestPaint=function(){z=!0},l.unstable_runWithPriority=function(ne,te){switch(ne){case 1:case 2:case 3:case 4:case 5:break;default:ne=3}var ce=x;x=ne;try{return te()}finally{x=ce}},l.unstable_scheduleCallback=function(ne,te,ce){var ee=l.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?ee+ce:ee):ce=ee,ne){case 1:var ke=-1;break;case 2:ke=250;break;case 5:ke=1073741823;break;case 4:ke=1e4;break;default:ke=5e3}return ke=ce+ke,ne={id:g++,callback:te,priorityLevel:ne,startTime:ce,expirationTime:ke,sortIndex:-1},ce>ee?(ne.sortIndex=ce,o(S,ne),c(v)===null&&ne===c(S)&&(V?(oe(X),X=-1):V=!0,Ce(Y,ce-ee))):(ne.sortIndex=ke,o(v,ne),L||k||(L=!0,O||(O=!0,K()))),ne},l.unstable_shouldYield=G,l.unstable_wrapCallback=function(ne){var te=x;return function(){var ce=x;x=te;try{return ne.apply(this,arguments)}finally{x=ce}}}})(wf)),wf}var zy;function AS(){return zy||(zy=1,Sf.exports=wS()),Sf.exports}var Af={exports:{}},hn={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@ var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var Uy;function SS(){if(Uy)return hn;Uy=1;var l=Wf();function o(g){var b="https://react.dev/errors/"+g;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)b+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+g+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(o(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},d=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),m=Symbol.for("react.optimistic_key");function y(g,b,x){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:k==null?null:k===m?m:""+k,children:g,containerInfo:b,implementation:x}}var v=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S(g,b){if(g==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,hn.browser=function(g){return{$$typeof:h,_reason:g}},hn.createPortal=function(g,b){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(o(299));return y(g,b,null,x)},hn.flushSync=function(g){var b=v.T,x=u.p;try{if(v.T=null,u.p=2,g)return g()}finally{v.T=b,u.p=x,u.d.f()}},hn.preconnect=function(g,b){typeof g=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,u.d.C(g,b))},hn.prefetchDNS=function(g){typeof g=="string"&&u.d.D(g)},hn.preinit=function(g,b){if(typeof g=="string"&&b&&typeof b.as=="string"){var x=b.as,k=S(x,b.crossOrigin),D=typeof b.integrity=="string"?b.integrity:void 0,V=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;x==="style"?u.d.S(g,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:k,integrity:D,fetchPriority:V}):x==="script"&&u.d.X(g,{crossOrigin:k,integrity:D,fetchPriority:V,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},hn.preinitModule=function(g,b){if(typeof g=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var x=S(b.as,b.crossOrigin);u.d.M(g,{crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&u.d.M(g)},hn.preload=function(g,b){if(typeof g=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var x=b.as,k=S(x,b.crossOrigin);u.d.L(g,x,{crossOrigin:k,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},hn.preloadModule=function(g,b){if(typeof g=="string")if(b){var x=S(b.as,b.crossOrigin);u.d.m(g,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else u.d.m(g)},hn.requestFormReset=function(g){u.d.r(g)},hn.unstable_batchedUpdates=function(g,b){return g(b)},hn.useFormState=function(g,b,x){return v.H.useFormState(g,b,x)},hn.useFormStatus=function(){return v.H.useHostTransitionStatus()},hn.version="19.3.0",hn}var Hy;function wS(){if(Hy)return Af.exports;Hy=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),Af.exports=SS(),Af.exports}/**
33
+ */var Uy;function TS(){if(Uy)return hn;Uy=1;var l=Wf();function o(g){var b="https://react.dev/errors/"+g;if(1<arguments.length){b+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)b+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+g+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var u={d:{f:c,r:function(){throw Error(o(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},d=Symbol.for("react.portal"),h=Symbol.for("react.recoverable"),m=Symbol.for("react.optimistic_key");function y(g,b,x){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:d,key:k==null?null:k===m?m:""+k,children:g,containerInfo:b,implementation:x}}var v=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function S(g,b){if(g==="font")return"";if(typeof b=="string")return b==="use-credentials"?b:""}return hn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=u,hn.browser=function(g){return{$$typeof:h,_reason:g}},hn.createPortal=function(g,b){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!b||b.nodeType!==1&&b.nodeType!==9&&b.nodeType!==11)throw Error(o(299));return y(g,b,null,x)},hn.flushSync=function(g){var b=v.T,x=u.p;try{if(v.T=null,u.p=2,g)return g()}finally{v.T=b,u.p=x,u.d.f()}},hn.preconnect=function(g,b){typeof g=="string"&&(b?(b=b.crossOrigin,b=typeof b=="string"?b==="use-credentials"?b:"":void 0):b=null,u.d.C(g,b))},hn.prefetchDNS=function(g){typeof g=="string"&&u.d.D(g)},hn.preinit=function(g,b){if(typeof g=="string"&&b&&typeof b.as=="string"){var x=b.as,k=S(x,b.crossOrigin),L=typeof b.integrity=="string"?b.integrity:void 0,V=typeof b.fetchPriority=="string"?b.fetchPriority:void 0;x==="style"?u.d.S(g,typeof b.precedence=="string"?b.precedence:void 0,{crossOrigin:k,integrity:L,fetchPriority:V}):x==="script"&&u.d.X(g,{crossOrigin:k,integrity:L,fetchPriority:V,nonce:typeof b.nonce=="string"?b.nonce:void 0})}},hn.preinitModule=function(g,b){if(typeof g=="string")if(typeof b=="object"&&b!==null){if(b.as==null||b.as==="script"){var x=S(b.as,b.crossOrigin);u.d.M(g,{crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}}else b==null&&u.d.M(g)},hn.preload=function(g,b){if(typeof g=="string"&&typeof b=="object"&&b!==null&&typeof b.as=="string"){var x=b.as,k=S(x,b.crossOrigin);u.d.L(g,x,{crossOrigin:k,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,type:typeof b.type=="string"?b.type:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0,referrerPolicy:typeof b.referrerPolicy=="string"?b.referrerPolicy:void 0,imageSrcSet:typeof b.imageSrcSet=="string"?b.imageSrcSet:void 0,imageSizes:typeof b.imageSizes=="string"?b.imageSizes:void 0,media:typeof b.media=="string"?b.media:void 0})}},hn.preloadModule=function(g,b){if(typeof g=="string")if(b){var x=S(b.as,b.crossOrigin);u.d.m(g,{as:typeof b.as=="string"&&b.as!=="script"?b.as:void 0,crossOrigin:x,integrity:typeof b.integrity=="string"?b.integrity:void 0,nonce:typeof b.nonce=="string"?b.nonce:void 0,fetchPriority:typeof b.fetchPriority=="string"?b.fetchPriority:void 0})}else u.d.m(g)},hn.requestFormReset=function(g){u.d.r(g)},hn.unstable_batchedUpdates=function(g,b){return g(b)},hn.useFormState=function(g,b,x){return v.H.useFormState(g,b,x)},hn.useFormStatus=function(){return v.H.useHostTransitionStatus()},hn.version="19.3.0",hn}var Hy;function kS(){if(Hy)return Af.exports;Hy=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),Af.exports=TS(),Af.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,61 +38,61 @@ var fS=Object.defineProperty;var Ey=l=>{throw TypeError(l)};var hS=(l,o,c)=>o in
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var By;function AS(){if(By)return vo;By=1;var l=xS(),o=Wf(),c=wS();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(h(e)!==e)throw Error(u(188))}function S(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,a=t;;){var s=n.return;if(s===null)break;var r=s.alternate;if(r===null){if(a=s.return,a!==null){n=a;continue}break}if(s.child===r.child){for(r=s.child;r;){if(r===n)return v(s),e;if(r===a)return v(s),t;r=r.sibling}throw Error(u(188))}if(n.return!==a.return)n=s,a=r;else{for(var f=!1,p=s.child;p;){if(p===n){f=!0,n=s,a=r;break}if(p===a){f=!0,a=s,n=r;break}p=p.sibling}if(!f){for(p=r.child;p;){if(p===n){f=!0,n=r,a=s;break}if(p===a){f=!0,a=r,n=s;break}p=p.sibling}if(!f)throw Error(u(189))}}if(n.alternate!==a)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}function b(e,t,n,a,s,r){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,a,s,r)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,n,a,s,r))return!0;e=e.sibling}return!1}function x(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function k(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function D(e){var t=[null,null],n=x(e);return n===null||V(t,e,n.child,{foundSelf:!1}),t}function V(e,t,n,a){for(;n!==null;){if(n===t)a.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(a.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&V(e,t,n.child,a))return!0;n=n.sibling}return!1}function L(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(u(559))}}var K=null,ce=null;function de(e,t,n){return e===n?!0:e===t?(K=e,!0):!1}function E(e,t,n){return e===n?(ce=e,!1):e===t?(ce!==null&&(K=e),!0):!1}function G(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function H(e,t,n){for(var a=0,s=e;s;s=n(s))a++;s=0;for(var r=t;r;r=n(r))s++;for(;0<a-s;)e=n(e),a--;for(;0<s-a;)t=n(t),s--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var Y=Object.assign,F=Symbol.for("react.element"),ie=Symbol.for("react.transitional.element"),X=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),ve=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),re=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),Ze=Symbol.for("react.activity"),bt=Symbol.for("react.legacy_hidden"),kt=Symbol.for("react.memo_cache_sentinel"),j=Symbol.for("react.view_transition"),ae=Symbol.for("react.recoverable"),je=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=je&&e[je]||e["@@iterator"],typeof e=="function"?e:null)}var Ie=Symbol.for("react.client.reference");function Oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case P:return"Fragment";case me:return"Profiler";case Q:return"StrictMode";case te:return"Suspense";case re:return"SuspenseList";case Ze:return"Activity";case j:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case X:return"Portal";case Ce:return e.displayName||"Context";case ve:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return t=e.displayName||null,t!==null?t:Oe(e.type)||"Memo";case ke:t=e._payload,e=e._init;try{return Oe(e(t))}catch{}}return null}var ze=Array.isArray,Se=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,mt={pending:!1,data:null,method:null,action:null},O=[],we=-1;function he(e){return{current:e}}function Be(e){0>we||(e.current=O[we],O[we]=null,we--)}function Ee(e,t){we++,O[we]=e.current,e.current=t}var le=he(null),Te=he(null),be=he(null),qe=he(null);function q(e,t){switch(Ee(be,t),Ee(Te,e),Ee(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ug(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ug(t),e=Hg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Be(le),Ee(le,e)}function Re(){Be(le),Be(Te),Be(be)}function He(e){var t=e.memoizedState;t!==null&&(di._currentValue=t.memoizedState,Ee(qe,e)),t=le.current;var n=Hg(t,e.type);t!==n&&(Ee(Te,e),Ee(le,n))}function pt(e){Te.current===e&&(Be(le),Be(Te)),qe.current===e&&(Be(qe),di._currentValue=mt)}var Ve,ht;function $e(e){if(Ve===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||"",ht=-1<n.stack.indexOf(`
41
+ */var By;function jS(){if(By)return vo;By=1;var l=AS(),o=Wf(),c=kS();function u(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function h(e){for(var t=e,n=t;n&&!n.alternate;)t=n,(t.flags&4098)!==0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function m(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(h(e)!==e)throw Error(u(188))}function S(e){var t=e.alternate;if(!t){if(t=h(e),t===null)throw Error(u(188));return t!==e?null:e}for(var n=e,a=t;;){var i=n.return;if(i===null)break;var r=i.alternate;if(r===null){if(a=i.return,a!==null){n=a;continue}break}if(i.child===r.child){for(r=i.child;r;){if(r===n)return v(i),e;if(r===a)return v(i),t;r=r.sibling}throw Error(u(188))}if(n.return!==a.return)n=i,a=r;else{for(var f=!1,p=i.child;p;){if(p===n){f=!0,n=i,a=r;break}if(p===a){f=!0,a=i,n=r;break}p=p.sibling}if(!f){for(p=r.child;p;){if(p===n){f=!0,n=r,a=i;break}if(p===a){f=!0,a=r,n=i;break}p=p.sibling}if(!f)throw Error(u(189))}}if(n.alternate!==a)throw Error(u(190))}if(n.tag!==3)throw Error(u(188));return n.stateNode.current===n?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}function b(e,t,n,a,i,r){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,a,i,r)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&b(e.child,t,n,a,i,r))return!0;e=e.sibling}return!1}function x(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function k(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),!(e.tag===3||e.tag===5||e.tag===27));)e=e.return;return t}function L(e){var t=[null,null],n=x(e);return n===null||V(t,e,n.child,{foundSelf:!1}),t}function V(e,t,n,a){for(;n!==null;){if(n===t)a.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(a.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&V(e,t,n.child,a))return!0;n=n.sibling}return!1}function z(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(u(559))}}var Z=null,oe=null;function de(e,t,n){return e===n?!0:e===t?(Z=e,!0):!1}function C(e,t,n){return e===n?(oe=e,!1):e===t?(oe!==null&&(Z=e),!0):!1}function Y(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function O(e,t,n){for(var a=0,i=e;i;i=n(i))a++;i=0;for(var r=t;r;r=n(r))i++;for(;0<a-i;)e=n(e),a--;for(;0<i-a;)t=n(t),i--;for(;a--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var X=Object.assign,F=Symbol.for("react.element"),ie=Symbol.for("react.transitional.element"),G=Symbol.for("react.portal"),Q=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),ve=Symbol.for("react.consumer"),Ce=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),ce=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),ke=Symbol.for("react.lazy"),Ze=Symbol.for("react.activity"),bt=Symbol.for("react.legacy_hidden"),kt=Symbol.for("react.memo_cache_sentinel"),j=Symbol.for("react.view_transition"),ae=Symbol.for("react.recoverable"),je=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=je&&e[je]||e["@@iterator"],typeof e=="function"?e:null)}var Ie=Symbol.for("react.client.reference");function Oe(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ie?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Q:return"Fragment";case me:return"Profiler";case K:return"StrictMode";case te:return"Suspense";case ce:return"SuspenseList";case Ze:return"Activity";case j:return"ViewTransition"}if(typeof e=="object")switch(e.$$typeof){case G:return"Portal";case Ce:return e.displayName||"Context";case ve:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return t=e.displayName||null,t!==null?t:Oe(e.type)||"Memo";case ke:t=e._payload,e=e._init;try{return Oe(e(t))}catch{}}return null}var ze=Array.isArray,Se=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_e=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,mt={pending:!1,data:null,method:null,action:null},D=[],we=-1;function he(e){return{current:e}}function Be(e){0>we||(e.current=D[we],D[we]=null,we--)}function Ee(e,t){we++,D[we]=e.current,e.current=t}var le=he(null),Te=he(null),be=he(null),qe=he(null);function q(e,t){switch(Ee(be,t),Ee(Te,e),Ee(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Ug(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Ug(t),e=Hg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Be(le),Ee(le,e)}function Re(){Be(le),Be(Te),Be(be)}function He(e){var t=e.memoizedState;t!==null&&(di._currentValue=t.memoizedState,Ee(qe,e)),t=le.current;var n=Hg(t,e.type);t!==n&&(Ee(Te,e),Ee(le,n))}function pt(e){Te.current===e&&(Be(le),Be(Te)),qe.current===e&&(Be(qe),di._currentValue=mt)}var Ve,ht;function $e(e){if(Ve===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ve=t&&t[1]||"",ht=-1<n.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Ve+e+ht}var Vt=!1;function ea(e,t){if(!e||Vt)return"";Vt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(ye){var M=ye}Reflect.construct(e,[],W)}else{try{W.call()}catch(ye){M=ye}W=!1;try{var I=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),W=!0,new e}finally{W&&(I!==void 0?Object.defineProperty(e.prototype,"props",I):delete e.prototype.props)}}}else{try{throw Error()}catch(ye){M=ye}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(ye){if(ye&&M&&typeof ye.stack=="string")return[ye.stack,M.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),f=r[0],p=r[1];if(f&&p){var T=f.split(`
43
+ `+Ve+e+ht}var Vt=!1;function ea(e,t){if(!e||Vt)return"";Vt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var W=function(){throw Error()};if(Object.defineProperty(W.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(W,[])}catch(ye){var M=ye}Reflect.construct(e,[],W)}else{try{W.call()}catch(ye){M=ye}W=!1;try{var I=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),W=!0,new e}finally{W&&(I!==void 0?Object.defineProperty(e.prototype,"props",I):delete e.prototype.props)}}}else{try{throw Error()}catch(ye){M=ye}(W=e())&&typeof W.catch=="function"&&W.catch(function(){})}}catch(ye){if(ye&&M&&typeof ye.stack=="string")return[ye.stack,M.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var i=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");i&&i.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),f=r[0],p=r[1];if(f&&p){var T=f.split(`
44
44
  `),R=p.split(`
45
- `);for(s=a=0;a<T.length&&!T[a].includes("DetermineComponentFrameRoot");)a++;for(;s<R.length&&!R[s].includes("DetermineComponentFrameRoot");)s++;if(a===T.length||s===R.length)for(a=T.length-1,s=R.length-1;1<=a&&0<=s&&T[a]!==R[s];)s--;for(;1<=a&&0<=s;a--,s--)if(T[a]!==R[s]){if(a!==1||s!==1)do if(a--,s--,0>s||T[a]!==R[s]){var $=`
46
- `+T[a].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=a&&0<=s);break}}}finally{Vt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?$e(n):""}function fa(e,t){switch(e.tag){case 26:case 27:case 5:return $e(e.type);case 16:return $e("Lazy");case 13:return e.child!==t&&t!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return ea(e.type,!1);case 11:return ea(e.type.render,!1);case 1:return ea(e.type,!0);case 31:return $e("Activity");case 30:return $e("ViewTransition");default:return""}}function gn(e){try{var t="",n=null;do t+=fa(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
45
+ `);for(i=a=0;a<T.length&&!T[a].includes("DetermineComponentFrameRoot");)a++;for(;i<R.length&&!R[i].includes("DetermineComponentFrameRoot");)i++;if(a===T.length||i===R.length)for(a=T.length-1,i=R.length-1;1<=a&&0<=i&&T[a]!==R[i];)i--;for(;1<=a&&0<=i;a--,i--)if(T[a]!==R[i]){if(a!==1||i!==1)do if(a--,i--,0>i||T[a]!==R[i]){var $=`
46
+ `+T[a].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=a&&0<=i);break}}}finally{Vt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?$e(n):""}function fa(e,t){switch(e.tag){case 26:case 27:case 5:return $e(e.type);case 16:return $e("Lazy");case 13:return e.child!==t&&t!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return ea(e.type,!1);case 11:return ea(e.type.render,!1);case 1:return ea(e.type,!0);case 31:return $e("Activity");case 30:return $e("ViewTransition");default:return""}}function gn(e){try{var t="",n=null;do t+=fa(e,n),n=e,e=e.return;while(e);return t}catch(a){return`
47
47
  Error generating stack: `+a.message+`
48
- `+a.stack}}var wn=Object.prototype.hasOwnProperty,Bn=l.unstable_scheduleCallback,ka=l.unstable_cancelCallback,An=l.unstable_shouldYield,nn=l.unstable_requestPaint,yt=l.unstable_now,Ga=l.unstable_getCurrentPriorityLevel,yn=l.unstable_ImmediatePriority,vn=l.unstable_UserBlockingPriority,Cn=l.unstable_NormalPriority,B=l.unstable_LowPriority,ue=l.unstable_IdlePriority,Ae=l.log,De=l.unstable_setDisableYieldValue,Ye=null,Qe=null;function Fe(e){if(typeof Ae=="function"&&De(e),Qe&&typeof Qe.setStrictMode=="function")try{Qe.setStrictMode(Ye,e)}catch{}}var jt=Math.clz32?Math.clz32:hl,Wt=Math.log,Mn=Math.LN2;function hl(e){return e>>>=0,e===0?32:31-(Wt(e)/Mn|0)|0}var ja=256,ha=262144,N=4194304;function Z(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ge(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var s=0,r=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~r,a!==0?s=Z(a):(f&=p,f!==0?s=Z(f):n||(n=p&~e,n!==0&&(s=Z(n))))):(p=a&~r,p!==0?s=Z(p):f!==0?s=Z(f):n||(n=a&~e,n!==0&&(s=Z(n)))),s===0?0:t!==0&&t!==s&&(t&r)===0&&(r=s&-s,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:s}function xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var a=31-jt(n),s=1<<a;t|=e[a],n&=~s}return t}function ct(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=N;return N<<=1,(N&62914560)===0&&(N=4194304),e}function Nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function lt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bt(e,t,n,a,s,r){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,T=e.expirationTimes,R=e.hiddenUpdates;for(n=f&~n;0<n;){var $=31-jt(n),W=1<<$;p[$]=0,T[$]=-1;var M=R[$];if(M!==null)for(R[$]=null,$=0;$<M.length;$++){var I=M[$];I!==null&&(I.lane&=-536870913)}n&=~W}a!==0&&In(e,a,0),r!==0&&s===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function In(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-jt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Xa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-jt(n),s=1<<a;s&t|e[a]&t&&(e[a]|=t),n&=~s}}function Na(e,t){var n=t&-t;return n=(n&42)!==0?1:Zl(n),(n&(e.suspendedLanes|t))!==0?0:n}function Zl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ea(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ml(){var e=_e.p;return e!==0?e:(e=window.event,e===void 0?32:Sy(e.type))}function Es(e,t){var n=_e.p;try{return _e.p=e,t()}finally{_e.p=n}}var Gt=Math.random().toString(36).slice(2),zt="__reactFiber$"+Gt,Ut="__reactProps$"+Gt,_n="__reactContainer$"+Gt,Xo="__reactEvents$"+Gt,Cs="__reactListeners$"+Gt,Yo="__reactHandles$"+Gt,Vo="__reactResources$"+Gt,pl="__reactMarker$"+Gt,Fl="__reactLoad$"+Gt;function Ya(e){delete e[zt],delete e[Ut],delete e[Cs],delete e[Yo]}function ma(e){var t;if(t=e[zt])return t;for(var n=e.parentNode;n;){if(t=n[_n]||n[zt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ty(e);e!==null;){if(n=e[zt])return n;e=ty(e)}return t}e=n,n=e.parentNode}return null}function pa(e){if(e=e[zt]||e[_n]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ta(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function na(e){var t=e[Vo];return t||(t=e[Vo]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[pl]=!0}function Qo(e){e[Fl]=void 0}var Pl=new Set,Ko={};function Ca(e,t){qn(e,t),qn(e+"Capture",t)}function qn(e,t){for(Ko[e]=t,e=0;e<t.length;e++)Pl.add(t[e])}var Zo=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]*$"),Ni={},Fo={};function Po(e){return wn.call(Fo,e)?!0:wn.call(Ni,e)?!1:Zo.test(e)?Fo[e]=!0:(Ni[e]=!0,!1)}var ut=!1;function Jo(){var e=ut;return ut=!1,e}function Jl(e,t,n){if(Po(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Va(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function $n(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,a)}}function se(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function w(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function z(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var s=a.get,r=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(f){n=""+f,r.call(this,f)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oe(e){if(!e._valueTracker){var t=w(e)?"checked":"value";e._valueTracker=z(e,t,""+e[t])}}function fe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=w(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}var Ue=/[\n"\\]/g;function Ge(e){return e.replace(Ue,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function nt(e,t,n,a,s,r,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+se(t)):e.value!==""+se(t)&&(e.value=""+se(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?f==="number"&&e.value==t?bn(e,se(e.value)):bn(e,se(t)):n!=null?bn(e,se(n)):a!=null&&e.removeAttribute("value"),s==null&&r!=null&&(e.defaultChecked=!!r),s!=null&&(e.checked=s&&typeof s!="function"&&typeof s!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+se(p):e.removeAttribute("name")}function Ot(e,t,n,a,s,r,f,p){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){oe(e);return}n=n!=null?""+se(n):"",t=t!=null?""+se(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??s,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),oe(e)}function bn(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Qt(e,t,n,a){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&a&&(e[n].defaultSelected=!0)}else{for(n=""+se(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,a&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Qa(e,t,n){if(t!=null&&(t=""+se(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+se(n):""}function Ms(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(u(92));if(ze(a)){if(1<a.length)throw Error(u(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=se(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),oe(e)}function It(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wo=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 Ch(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||Wo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Mh(e,t,n){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="",ut=!0);for(var s in t)a=t[s],t.hasOwnProperty(s)&&n[s]!==a&&(Ch(e,s,a),ut=!0)}else for(var r in t)t.hasOwnProperty(r)&&Ch(e,r,t[r])}function Fc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var L0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),z0=/^[\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 er(e){return z0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ma(){}var Pc=null;function Jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _s=null,Rs=null;function _h(e){var t=pa(e);if(t&&(e=t.stateNode)){var n=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ge(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var s=a[Ut]||null;if(!s)throw Error(u(90));nt(a,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&fe(a)}break e;case"textarea":Qa(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Qt(e,!!n.multiple,t,!1)}}}var Wc=!1;function Rh(e,t,n){if(Wc)return e(t,n);Wc=!0;try{var a=e(t);return a}finally{if(Wc=!1,(_s!==null||Rs!==null)&&(ec(),_s&&(t=_s,e=Rs,Rs=_s=null,_h(t),e)))for(t=0;t<e.length;t++)_h(e[t])}}function Ei(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ut]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(u(231,t,typeof n));return n}var Ka=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eu=!1;if(Ka)try{var Ci={};Object.defineProperty(Ci,"passive",{get:function(){eu=!0}}),window.addEventListener("test",Ci,Ci),window.removeEventListener("test",Ci,Ci)}catch{eu=!1}var gl=null,tu=null,tr=null;function Oh(){if(tr)return tr;var e,t=tu,n=t.length,a,s="value"in gl?gl.value:gl.textContent,r=s.length;for(e=0;e<n&&t[e]===s[e];e++);var f=n-e;for(a=1;a<=f&&t[n-a]===s[r-a];a++);return tr=s.slice(e,1<a?1-a:void 0)}function nr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ar(){return!0}function Dh(){return!1}function Tn(e){function t(n,a,s,r,f){this._reactName=n,this._targetInst=s,this.type=a,this.nativeEvent=r,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(r):r[p]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?ar:Dh,this.isPropagationStopped=Dh,this}return Y(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ar)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ar)},persist:function(){},isPersistent:ar}),t}var yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=Tn(yl),Mi=Y({},yl,{view:0,detail:0}),U0=Tn(Mi),nu,au,_i,sr=Y({},Mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:su,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==_i&&(_i&&e.type==="mousemove"?(nu=e.screenX-_i.screenX,au=e.screenY-_i.screenY):au=nu=0,_i=e),nu)},movementY:function(e){return"movementY"in e?e.movementY:au}}),Lh=Tn(sr),H0=Y({},sr,{dataTransfer:0}),B0=Tn(H0),I0=Y({},Mi,{relatedTarget:0}),lu=Tn(I0),q0=Y({},yl,{animationName:0,elapsedTime:0,pseudoElement:0}),$0=Tn(q0),G0=Y({},yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),X0=Tn(G0),Y0=Y({},yl,{data:0}),zh=Tn(Y0),V0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Q0={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"},K0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=K0[e])?!!t[e]:!1}function su(){return Z0}var F0=Y({},Mi,{key:function(e){if(e.key){var t=V0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Q0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:su,charCode:function(e){return e.type==="keypress"?nr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),P0=Tn(F0),J0=Y({},sr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uh=Tn(J0),W0=Y({},yl,{submitter:0}),eb=Tn(W0),tb=Y({},Mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:su}),nb=Tn(tb),ab=Y({},yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),lb=Tn(ab),sb=Y({},sr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ib=Tn(sb),ob=Y({},yl,{newState:0,oldState:0,source:0}),rb=Tn(ob),cb=[9,13,27,32],iu=Ka&&"CompositionEvent"in window,Ri=null;Ka&&"documentMode"in document&&(Ri=document.documentMode);var ub=Ka&&"TextEvent"in window&&!Ri,Hh=Ka&&(!iu||Ri&&8<Ri&&11>=Ri),Bh=" ",Ih=!1;function qh(e,t){switch(e){case"keyup":return cb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $h(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Os=!1;function db(e,t){switch(e){case"compositionend":return $h(t);case"keypress":return t.which!==32?null:(Ih=!0,Bh);case"textInput":return e=t.data,e===Bh&&Ih?null:e;default:return null}}function fb(e,t){if(Os)return e==="compositionend"||!iu&&qh(e,t)?(e=Oh(),tr=tu=gl=null,Os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Hh&&t.locale!=="ko"?null:t.data;default:return null}}var hb={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 Gh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!hb[e.type]:t==="textarea"}function Xh(e,t,n,a){_s?Rs?Rs.push(a):Rs=[a]:_s=a,t=ic(t,"onChange"),0<t.length&&(n=new lr("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Oi=null,Di=null;function mb(e){_g(e,0)}function ir(e){var t=ta(e);if(fe(t))return e}function Yh(e,t){if(e==="change")return t}var Vh=!1;if(Ka){var ou;if(Ka){var ru="oninput"in document;if(!ru){var Qh=document.createElement("div");Qh.setAttribute("oninput","return;"),ru=typeof Qh.oninput=="function"}ou=ru}else ou=!1;Vh=ou&&(!document.documentMode||9<document.documentMode)}function Kh(){Oi&&(Oi.detachEvent("onpropertychange",Zh),Di=Oi=null)}function Zh(e){if(e.propertyName==="value"&&ir(Di)){var t=[];Xh(t,Di,e,Jc(e)),Rh(mb,t)}}function pb(e,t,n){e==="focusin"?(Kh(),Oi=t,Di=n,Oi.attachEvent("onpropertychange",Zh)):e==="focusout"&&Kh()}function gb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ir(Di)}function yb(e,t){if(e==="click")return ir(t)}function vb(e,t){if(e==="input"||e==="change")return ir(t)}function bb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gn=typeof Object.is=="function"?Object.is:bb;function Li(e,t){if(Gn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var s=n[a];if(!wn.call(t,s)||!Gn(e[s],t[s]))return!1}return!0}function cu(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Fh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ph(e,t){var n=Fh(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fh(n)}}function Jh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=cu(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cu(e.document)}return t}function uu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var xb=Ka&&"documentMode"in document&&11>=document.documentMode,Ds=null,du=null,zi=null,fu=!1;function em(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fu||Ds==null||Ds!==cu(a)||(a=Ds,"selectionStart"in a&&uu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),zi&&Li(zi,a)||(zi=a,a=ic(du,"onSelect"),0<a.length&&(t=new lr("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Ds)))}function Wl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ls={animationend:Wl("Animation","AnimationEnd"),animationiteration:Wl("Animation","AnimationIteration"),animationstart:Wl("Animation","AnimationStart"),transitionrun:Wl("Transition","TransitionRun"),transitionstart:Wl("Transition","TransitionStart"),transitioncancel:Wl("Transition","TransitionCancel"),transitionend:Wl("Transition","TransitionEnd")},hu={},tm={};Ka&&(tm=document.createElement("div").style,"AnimationEvent"in window||(delete Ls.animationend.animation,delete Ls.animationiteration.animation,delete Ls.animationstart.animation),"TransitionEvent"in window||delete Ls.transitionend.transition);function es(e){if(hu[e])return hu[e];if(!Ls[e])return e;var t=Ls[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in tm)return hu[e]=t[n];return e}var nm=es("animationend"),am=es("animationiteration"),lm=es("animationstart"),Sb=es("transitionrun"),wb=es("transitionstart"),Ab=es("transitioncancel"),sm=es("transitionend"),im=new Map,mu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");mu.push("scrollEnd");function ga(e,t){im.set(e,t),Ca(t,[e])}var Tb=0;function Za(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=xa.identifierPrefix;var n=Tb++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function om(e){if(e==null||typeof e=="string")return e;var t=null,n=ti;if(n!==null)for(var a=0;a<n.length;a++){var s=e[n[a]];if(s!=null){if(s==="none")return"none";t=t==null?s:t+(" "+s)}}return t??e.default}function Fa(e,t){return e=om(e),t=om(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var or=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},aa=[],zs=0,pu=0;function rr(){for(var e=zs,t=pu=zs=0;t<e;){var n=aa[t];aa[t++]=null;var a=aa[t];aa[t++]=null;var s=aa[t];aa[t++]=null;var r=aa[t];if(aa[t++]=null,a!==null&&s!==null){var f=a.pending;f===null?s.next=s:(s.next=f.next,f.next=s),a.pending=s}r!==0&&rm(n,s,r)}}function cr(e,t,n,a){aa[zs++]=e,aa[zs++]=t,aa[zs++]=n,aa[zs++]=a,pu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function gu(e,t,n,a){return cr(e,t,n,a),ur(e)}function ts(e,t){return cr(e,null,null,t),ur(e)}function rm(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var s=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(s=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,s&&t!==null&&(s=31-jt(n),e=r.hiddenUpdates,a=e[s],a===null?e[s]=[t]:a.push(t),t.lane=n|536870912),r):null}function ur(e){if(50<lo)throw lo=0,Wr=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Us={};function kb(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,t,n,a){return new kb(e,t,n,a)}function yu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Pa(e,t){var n=e.alternate;return n===null?(n=Rn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function cm(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function dr(e,t,n,a,s,r){var f=0;if(a=e,typeof a=="function")yu(a)&&(f=1);else if(typeof a=="string")f=Wx(e,n,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case Ze:return e=Rn(31,n,t,s),e.elementType=Ze,e.lanes=r,e;case P:return ns(n.children,s,r,t);case Q:f=8,s|=24;break;case me:return e=Rn(12,n,t,s|2),e.elementType=me,e.lanes=r,e;case te:return e=Rn(13,n,t,s),e.elementType=te,e.lanes=r,e;case re:return e=Rn(19,n,t,s),e.elementType=re,e.lanes=r,e;case bt:case j:return e=s|32,e=Rn(30,n,t,e),e.elementType=j,e.lanes=r,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case Ce:f=10;break e;case ve:f=9;break e;case ne:f=11;break e;case ee:f=14;break e;case ke:f=16,a=null;break e}f=29,n=Error(u(130,e===null?"null":typeof e,"")),a=null}return t=Rn(f,n,t,s),t.elementType=e,t.type=a,t.lanes=r,t}function ns(e,t,n,a){return e=Rn(7,e,a,t),e.lanes=n,e}function vu(e,t,n){return e=Rn(6,e,null,t),e.lanes=n,e}function um(e){var t=Rn(18,null,null,0);return t.stateNode=e,t}function bu(e,t,n){return t=Rn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var dm=new WeakMap;function la(e,t){if(typeof e=="object"&&e!==null){var n=dm.get(e);return n!==void 0?n:(t={value:e,source:t,stack:gn(t)},dm.set(e,t),t)}return{value:e,source:t,stack:gn(t)}}var Hs=[],Bs=0,fr=null,Ui=0,sa=[],ia=0,vl=null,_a=1,Ra="";function Ja(e,t){Hs[Bs++]=Ui,Hs[Bs++]=fr,fr=e,Ui=t}function fm(e,t,n){sa[ia++]=_a,sa[ia++]=Ra,sa[ia++]=vl,vl=e;var a=_a;e=Ra;var s=32-jt(a)-1;a&=~(1<<s),n+=1;var r=32-jt(t)+s;if(30<r){var f=s-s%5;r=(a&(1<<f)-1).toString(32),a>>=f,s-=f,_a=1<<32-jt(t)+s|n<<s|a,Ra=r+e}else _a=1<<r|n<<s|a,Ra=e}function hr(e){e.return!==null&&(Ja(e,1),fm(e,1,0))}function xu(e){for(;e===fr;)fr=Hs[--Bs],Hs[Bs]=null,Ui=Hs[--Bs],Hs[Bs]=null;for(;e===vl;)vl=sa[--ia],sa[ia]=null,Ra=sa[--ia],sa[ia]=null,_a=sa[--ia],sa[ia]=null}function hm(e,t){sa[ia++]=_a,sa[ia++]=Ra,sa[ia++]=vl,_a=t.id,Ra=t.overflow,vl=e}var an=null,_t=null,tt=!1,bl=null,oa=!1,Su=Error(u(519));function xl(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hi(la(t,e)),Su}function mm(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[zt]=e,t[Ut]=a,n){case"dialog":it("cancel",t),it("close",t);break;case"iframe":case"object":case"embed":it("load",t);break;case"video":case"audio":for(n=0;n<io.length;n++)it(io[n],t);break;case"source":it("error",t);break;case"img":case"image":case"link":it("error",t),it("load",t);break;case"details":it("toggle",t);break;case"input":it("invalid",t),Ot(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":it("invalid",t);break;case"textarea":it("invalid",t),Ms(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Lg(t.textContent,n)?(a.popover!=null&&(it("beforetoggle",t),it("toggle",t)),a.onScroll!=null&&it("scroll",t),a.onScrollEnd!=null&&it("scrollend",t),a.onClick!=null&&(t.onclick=Ma),t=!0):t=!1,t||xl(e,!0)}function mr(e){for(an=e.return;an;)switch(an.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:an=an.return}}function Is(e){if(e!==an)return!1;if(!tt)return mr(e),tt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Pd(e.type,e.memoizedProps)),n=!n),n&&_t&&xl(e),mr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));_t=ey(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));_t=ey(e)}else t===27?(t=_t,zl(e.type)?(e=of,of=null,_t=e):_t=t):_t=an?ca(e.stateNode.nextSibling):null;return!0}function as(){_t=an=null,tt=!1}function wu(){var e=bl;return e!==null&&(Ln===null?Ln=e:Ln.push.apply(Ln,e),bl=null),e}function Hi(e){bl===null?bl=[e]:bl.push(e)}var Au=he(null),ls=null,Wa=null;function Sl(e,t,n){Ee(Au,t._currentValue),t._currentValue=n}function el(e){e._currentValue=Au.current,Be(Au)}function pr(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Tu(e,t,n,a){var s=e.child;for(s!==null&&(s.return=e);s!==null;){var r=s.dependencies;if(r!==null){var f=s.child;r=r.firstContext;e:for(;r!==null;){var p=r;r=s;for(var T=0;T<t.length;T++)if(p.context===t[T]){r.lanes|=n,p=r.alternate,p!==null&&(p.lanes|=n),pr(r.return,n,e),a||(f=null);break e}r=p.next}}else if(s.tag===18){if(f=s.return,f===null)throw Error(u(341));f.lanes|=n,r=f.alternate,r!==null&&(r.lanes|=n),pr(f,n,e),f=null}else s.tag===13&&s.memoizedState!==null&&s.memoizedState.dehydrated===null?(s.lanes|=n,f=s.alternate,f!==null&&(f.lanes|=n),pr(s.return,n,e),f=s.child,f=f!==null?f.sibling:null):f=s.child;if(f!==null)f.return=s;else for(f=s;f!==null;){if(f===e){f=null;break}if(s=f.sibling,s!==null){s.return=f.return,f=s;break}f=f.return}s=f}}function ss(e,t,n,a){e=null;for(var s=t,r=!1;s!==null;){if(!r){if((s.flags&524288)!==0)r=!0;else if((s.flags&262144)!==0)break}if(s.tag===10){var f=s.alternate;if(f===null)throw Error(u(387));if(f=f.memoizedProps,f!==null){var p=s.type;Gn(s.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(s===qe.current){if(f=s.alternate,f===null)throw Error(u(387));f.memoizedState.memoizedState!==s.memoizedState.memoizedState&&(e!==null?e.push(di):e=[di])}s=s.return}return e!==null&&Tu(t,e,n,a),t.flags|=262144,e!==null}function gr(e){for(e=e.firstContext;e!==null;){if(!Gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function is(e){ls=e,Wa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rn(e){return pm(ls,e)}function yr(e,t){return ls===null&&is(e),pm(e,t)}function pm(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wa===null){if(e===null)throw Error(u(308));Wa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wa=Wa.next=t;return n}var jb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Nb=l.unstable_scheduleCallback,Eb=l.unstable_NormalPriority,Kt={$$typeof:Ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new jb,data:new Map,refCount:0}}function Bi(e){e.refCount--,e.refCount===0&&Nb(Eb,function(){e.controller.abort()})}function gm(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];n.indexOf(a)===-1&&n.push(a)}}}var Ii=null;function Cb(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var qi=null,ju=0,os=0,qs=null;function Mb(e,t){if(qi===null){var n=qi=[];ju=0,os=$d(),qs={status:"pending",value:void 0,then:function(a){n.push(a)}}}return ju++,t.then(ym,ym),t}function ym(){if(--ju===0&&(Ii=null,qi!==null)){qs!==null&&(qs.status="fulfilled");var e=qi;qi=null,os=0,qs=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _b(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(s){n.push(s)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var s=0;s<n.length;s++)(0,n[s])(t)},function(s){for(a.status="rejected",a.reason=s,s=0;s<n.length;s++)(0,n[s])(void 0)}),a}var vm=Se.S;Se.S=function(e,t){if(ug=yt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Mb(e,t),Ii!==null)for(var n=si;n!==null;)gm(n,Ii),n=n.next;if(n=e.types,n!==null){for(var a=si;a!==null;)gm(a,n),a=a.next;if(os!==0){a=Ii,a===null&&(a=Ii=[]);for(var s=0;s<n.length;s++){var r=n[s];a.indexOf(r)===-1&&a.push(r)}}}vm!==null&&vm(e,t)};var rs=he(null);function Nu(){var e=rs.current;return e!==null?e:Mt.pooledCache}function vr(e,t){t===null?Ee(rs,rs.current):Ee(rs,t.pool)}function bm(){var e=Nu();return e===null?null:{parent:Kt._currentValue,pool:e}}var $s=Error(u(460)),Eu=Error(u(474)),br=Error(u(542)),xr={then:function(){}};function xm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Sm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ma,Ma),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Am(e),e===void 0&&!("reason"in t)?Error(u(600)):e;default:if(typeof t.status=="string")t.then(Ma,Ma);else{if(e=Mt,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var s=t;s.status="fulfilled",s.value=a}},function(a){if(t.status==="pending"){var s=t;s.status="rejected",s.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Am(e),e}throw us=t,$s}}function cs(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(us=n,$s):n}}var us=null;function wm(){if(us===null)throw Error(u(459));var e=us;return us=null,e}function Am(e){if(e===$s||e===br)throw Error(u(483))}var Gs=null,$i=0;function Sr(e){var t=$i;return $i+=1,Gs===null&&(Gs=[]),Sm(Gs,e,t)}function wl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wr(e,t){throw t.$$typeof===F?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Tm(e){function t(_,C){if(e){var U=_.deletions;U===null?(_.deletions=[C],_.flags|=16):U.push(C)}}function n(_,C){if(!e)return null;for(;C!==null;)t(_,C),C=C.sibling;return null}function a(_){for(var C=new Map;_!==null;)_.key===null?C.set(_.index,_):C.set(_.key,_),_=_.sibling;return C}function s(_,C){return _=Pa(_,C),_.index=0,_.sibling=null,_}function r(_,C,U){return _.index=U,e?(U=_.alternate,U!==null?(U=U.index,U<C?(_.flags|=2,C):U):(_.flags|=134217730,C)):(_.flags|=1048576,C)}function f(_){return e&&_.alternate===null&&(_.flags|=134217730),_}function p(_,C,U,J){return C===null||C.tag!==6?(C=vu(U,_.mode,J),C.return=_,C):(C=s(C,U),C.return=_,C)}function T(_,C,U,J){var Ne=U.type;return Ne===P?(_=$(_,C,U.props.children,J,U.key),wl(_,U),_):C!==null&&(C.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ke&&cs(Ne)===C.type)?(C=s(C,U.props),wl(C,U),C.return=_,C):(C=dr(U.type,U.key,U.props,null,_.mode,J),wl(C,U),C.return=_,C)}function R(_,C,U,J){return C===null||C.tag!==4||C.stateNode.containerInfo!==U.containerInfo||C.stateNode.implementation!==U.implementation?(C=bu(U,_.mode,J),C.return=_,C):(C=s(C,U.children||[]),C.return=_,C)}function $(_,C,U,J,Ne){return C===null||C.tag!==7?(C=ns(U,_.mode,J,Ne),C.return=_,C):(C=s(C,U),C.return=_,C)}function W(_,C,U){if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return C=vu(""+C,_.mode,U),C.return=_,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case ie:return U=dr(C.type,C.key,C.props,null,_.mode,U),wl(U,C),U.return=_,U;case X:return C=bu(C,_.mode,U),C.return=_,C;case ke:return C=cs(C),W(_,C,U)}if(ze(C)||pe(C))return C=ns(C,_.mode,U,null),C.return=_,C;if(typeof C.then=="function")return W(_,Sr(C),U);if(C.$$typeof===Ce)return W(_,yr(_,C),U);wr(_,C)}return null}function M(_,C,U,J){var Ne=C!==null?C.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return Ne!==null?null:p(_,C,""+U,J);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case ie:return U.key===Ne?T(_,C,U,J):null;case X:return U.key===Ne?R(_,C,U,J):null;case ke:return U=cs(U),M(_,C,U,J)}if(ze(U)||pe(U))return Ne!==null?null:$(_,C,U,J,null);if(typeof U.then=="function")return M(_,C,Sr(U),J);if(U.$$typeof===Ce)return M(_,C,yr(_,U),J);wr(_,U)}return null}function I(_,C,U,J,Ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return _=_.get(U)||null,p(C,_,""+J,Ne);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case ie:return _=_.get(J.key===null?U:J.key)||null,T(C,_,J,Ne);case X:return _=_.get(J.key===null?U:J.key)||null,R(C,_,J,Ne);case ke:return J=cs(J),I(_,C,U,J,Ne)}if(ze(J)||pe(J))return _=_.get(U)||null,$(C,_,J,Ne,null);if(typeof J.then=="function")return I(_,C,U,Sr(J),Ne);if(J.$$typeof===Ce)return I(_,C,U,yr(C,J),Ne);wr(C,J)}return null}function ye(_,C,U,J){for(var Ne=null,rt=null,Le=C,Xe=C=0,Pt=null;Le!==null&&Xe<U.length;Xe++){Le.index>Xe?(Pt=Le,Le=null):Pt=Le.sibling;var dt=M(_,Le,U[Xe],J);if(dt===null){Le===null&&(Le=Pt);break}e&&Le&&dt.alternate===null&&t(_,Le),C=r(dt,C,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt,Le=Pt}if(Xe===U.length)return n(_,Le),tt&&Ja(_,Xe),Ne;if(Le===null){for(;Xe<U.length;Xe++)Le=W(_,U[Xe],J),Le!==null&&(C=r(Le,C,Xe),rt===null?Ne=Le:rt.sibling=Le,rt=Le);return tt&&Ja(_,Xe),Ne}for(Le=a(Le);Xe<U.length;Xe++)Pt=I(Le,_,Xe,U[Xe],J),Pt!==null&&(e&&(dt=Pt.alternate,dt!==null&&Le.delete(dt.key===null?Xe:dt.key)),C=r(Pt,C,Xe),rt===null?Ne=Pt:rt.sibling=Pt,rt=Pt);return e&&Le.forEach(function(ql){return t(_,ql)}),tt&&Ja(_,Xe),Ne}function Me(_,C,U,J){if(U==null)throw Error(u(151));for(var Ne=null,rt=null,Le=C,Xe=C=0,Pt=null,dt=U.next();Le!==null&&!dt.done;Xe++,dt=U.next()){Le.index>Xe?(Pt=Le,Le=null):Pt=Le.sibling;var ql=M(_,Le,dt.value,J);if(ql===null){Le===null&&(Le=Pt);break}e&&Le&&ql.alternate===null&&t(_,Le),C=r(ql,C,Xe),rt===null?Ne=ql:rt.sibling=ql,rt=ql,Le=Pt}if(dt.done)return n(_,Le),tt&&Ja(_,Xe),Ne;if(Le===null){for(;!dt.done;Xe++,dt=U.next())dt=W(_,dt.value,J),dt!==null&&(C=r(dt,C,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt);return tt&&Ja(_,Xe),Ne}for(Le=a(Le);!dt.done;Xe++,dt=U.next())dt=I(Le,_,Xe,dt.value,J),dt!==null&&(e&&(Pt=dt.alternate,Pt!==null&&Le.delete(Pt.key===null?Xe:Pt.key)),C=r(dt,C,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt);return e&&Le.forEach(function(dS){return t(_,dS)}),tt&&Ja(_,Xe),Ne}function Je(_,C,U,J){if(typeof U=="object"&&U!==null&&U.type===P&&U.key===null&&U.props.ref===void 0&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case ie:e:{for(var Ne=U.key;C!==null;){if(C.key===Ne){if(Ne=U.type,Ne===P){if(C.tag===7){n(_,C.sibling),J=s(C,U.props.children),wl(J,U),J.return=_,_=J;break e}}else if(C.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ke&&cs(Ne)===C.type){n(_,C.sibling),J=s(C,U.props),wl(J,U),J.return=_,_=J;break e}n(_,C);break}else t(_,C);C=C.sibling}U.type===P?(J=ns(U.props.children,_.mode,J,U.key),wl(J,U),J.return=_,_=J):(J=dr(U.type,U.key,U.props,null,_.mode,J),wl(J,U),J.return=_,_=J)}return f(_);case X:e:{for(Ne=U.key;C!==null;){if(C.key===Ne)if(C.tag===4&&C.stateNode.containerInfo===U.containerInfo&&C.stateNode.implementation===U.implementation){n(_,C.sibling),J=s(C,U.children||[]),J.return=_,_=J;break e}else{n(_,C);break}else t(_,C);C=C.sibling}J=bu(U,_.mode,J),J.return=_,_=J}return f(_);case ke:return U=cs(U),Je(_,C,U,J)}if(ze(U))return ye(_,C,U,J);if(pe(U)){if(Ne=pe(U),typeof Ne!="function")throw Error(u(150));return U=Ne.call(U),Me(_,C,U,J)}if(typeof U.then=="function")return Je(_,C,Sr(U),J);if(U.$$typeof===Ce)return Je(_,C,yr(_,U),J);wr(_,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,C!==null&&C.tag===6?(n(_,C.sibling),J=s(C,U),J.return=_,_=J):(n(_,C),J=vu(U,_.mode,J),J.return=_,_=J),f(_)):n(_,C)}return function(_,C,U,J){try{$i=0;var Ne=Je(_,C,U,J);return Gs=null,Ne}catch(Le){if(Le===$s||Le===br)throw Le;var rt=Rn(29,Le,null,_.mode);return rt.lanes=J,rt.return=_,rt}finally{}}}var ds=Tm(!0),km=Tm(!1),Al=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Tl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function kl(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(gt&2)!==0){var s=a.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),a.pending=t,t=ur(e),rm(e,null,n),t}return cr(e,a,t,n),ur(e)}function Gi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Xa(e,n)}}function _u(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var s=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?s=r=f:r=r.next=f,n=n.next}while(n!==null);r===null?s=r=t:r=r.next=t}else s=r=t;n={baseState:a.baseState,firstBaseUpdate:s,lastBaseUpdate:r,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ru=!1;function Xi(){if(Ru){var e=qs;if(e!==null)throw e}}function Yi(e,t,n,a){Ru=!1;var s=e.updateQueue;Al=!1;var r=s.firstBaseUpdate,f=s.lastBaseUpdate,p=s.shared.pending;if(p!==null){s.shared.pending=null;var T=p,R=T.next;T.next=null,f===null?r=R:f.next=R,f=T;var $=e.alternate;$!==null&&($=$.updateQueue,p=$.lastBaseUpdate,p!==f&&(p===null?$.firstBaseUpdate=R:p.next=R,$.lastBaseUpdate=T))}if(r!==null){var W=s.baseState;f=0,$=R=T=null,p=r;do{var M=p.lane&-536870913,I=M!==p.lane;if(I?(ot&M)===M:(a&M)===M){M!==0&&M===os&&(Ru=!0),$!==null&&($=$.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var ye=e,Me=p;M=t;var Je=n;switch(Me.tag){case 1:if(ye=Me.payload,typeof ye=="function"){W=ye.call(Je,W,M);break e}W=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Me.payload,M=typeof ye=="function"?ye.call(Je,W,M):ye,M==null)break e;W=Y({},W,M);break e;case 2:Al=!0}}M=p.callback,M!==null&&(e.flags|=64,I&&(e.flags|=8192),I=s.callbacks,I===null?s.callbacks=[M]:I.push(M))}else I={lane:M,tag:p.tag,payload:p.payload,callback:p.callback,next:null},$===null?(R=$=I,T=W):$=$.next=I,f|=M;if(p=p.next,p===null){if(p=s.shared.pending,p===null)break;I=p,p=I.next,I.next=null,s.lastBaseUpdate=I,s.shared.pending=null}}while(!0);$===null&&(T=W),s.baseState=T,s.firstBaseUpdate=R,s.lastBaseUpdate=$,r===null&&(s.shared.lanes=0),Rl|=f,e.lanes=f,e.memoizedState=W}}function jm(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Nm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)jm(n[e],t)}var jl=he(null),Ar=he(0);function Em(e,t){e=sl,Ee(Ar,e),Ee(jl,t),sl=e|t.baseLanes}function Ou(){Ee(Ar,sl),Ee(jl,jl.current)}function Du(){sl=Ar.current,Be(jl),Be(Ar)}var cn=he(null),xn=null;function Nl(e){var t=e.alternate;Ee(un,un.current&1),Ee(cn,e),xn===null&&(t===null||jl.current!==null||t.memoizedState!==null)&&(xn=e)}function Lu(e){Ee(un,un.current),Ee(cn,e),xn===null&&(xn=e)}function Cm(e){e.tag===22?(Ee(un,un.current),Ee(cn,e),xn===null&&(xn=e)):El()}function El(){Ee(un,un.current),Ee(cn,cn.current)}function Xn(e){Be(cn),xn===e&&(xn=null),Be(un)}var un=he(0);function Vi(e,t){Ee(cn,cn.current),Ee(un,t)}function zu(e){Be(un),Be(cn),xn===e&&(xn=null)}function Tr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||sf(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tl=0,Pe=null,Et=null,Zt=null,kr=!1,Xs=!1,fs=!1,jr=0,Qi=0,Ys=null,Rb=0;function qt(){throw Error(u(321))}function Uu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gn(e[n],t[n]))return!1;return!0}function Hu(e,t,n,a,s,r){return tl=r,Pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Se.H=e===null||e.memoizedState===null?fp:hp,fs=!1,r=n(a,s),fs=!1,Xs&&(r=_m(t,n,a,s)),Mm(e),r}function Mm(e){Se.H=Or;var t=Et!==null&&Et.next!==null;if(tl=0,Zt=Et=Pe=null,kr=!1,Qi=0,Ys=null,t)throw Error(u(300));e===null||Ft||(e=e.dependencies,e!==null&&gr(e)&&(Ft=!0))}function _m(e,t,n,a){Pe=e;var s=0;do{if(Xs&&(Ys=null),Qi=0,Xs=!1,25<=s)throw Error(u(301));if(s+=1,Zt=Et=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}Se.H=Ib,r=t(n,a)}while(Xs);return r}function Ob(){var e=Se.H,t=e.useState()[0];return t=typeof t.then=="function"?Ki(t):t,e=e.useState()[0],(Et!==null?Et.memoizedState:null)!==e&&(Pe.flags|=1024),t}function Bu(){var e=jr!==0;return jr=0,e}function Iu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function qu(e){if(kr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}kr=!1}tl=0,Zt=Et=Pe=null,Xs=!1,Qi=jr=0,Ys=null}function kn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Pe.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Xt(){if(Et===null){var e=Pe.alternate;e=e!==null?e.memoizedState:null}else e=Et.next;var t=Zt===null?Pe.memoizedState:Zt.next;if(t!==null)Zt=t,Et=e;else{if(e===null)throw Pe.alternate===null?Error(u(467)):Error(u(310));Et=e,e={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},Zt===null?Pe.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function Nr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ki(e){var t=Qi;return Qi+=1,Ys===null&&(Ys=[]),e=Sm(Ys,e,t),t=Pe,(Zt===null?t.memoizedState:Zt.next)===null&&(t=t.alternate,Se.H=t===null||t.memoizedState===null?fp:hp),e}function Er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ki(e);if(e.$$typeof===ae)return;if(e.$$typeof===Ce)return rn(e)}throw Error(u(438,String(e)))}function $u(e){var t=null,n=Pe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Pe.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(s){return s.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Nr(),Pe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=kt;return t.index++,n}function nl(e,t){return typeof t=="function"?t(e):t}function Cr(e){var t=Xt();return Gu(t,Et,e)}function Gu(e,t,n){var a=e.queue;if(a===null)throw Error(u(311));a.lastRenderedReducer=n;var s=e.baseQueue,r=a.pending;if(r!==null){if(s!==null){var f=s.next;s.next=r.next,r.next=f}t.baseQueue=s=r,a.pending=null}if(r=e.baseState,s===null)e.memoizedState=r;else{t=s.next;var p=f=null,T=null,R=t,$=!1;do{var W=R.lane&-536870913;if(W!==R.lane?(ot&W)===W:(tl&W)===W){var M=R.revertLane;if(M===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),W===os&&($=!0);else if((tl&M)===M){R=R.next,M===os&&($=!0);continue}else W={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},T===null?(p=T=W,f=r):T=T.next=W,Pe.lanes|=M,Rl|=M;W=R.action,fs&&n(r,W),r=R.hasEagerState?R.eagerState:n(r,W)}else M={lane:W,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},T===null?(p=T=M,f=r):T=T.next=M,Pe.lanes|=W,Rl|=W;R=R.next}while(R!==null&&R!==t);if(T===null?f=r:T.next=p,!Gn(r,e.memoizedState)&&(Ft=!0,$&&(n=qs,n!==null)))throw n;e.memoizedState=r,e.baseState=f,e.baseQueue=T,a.lastRenderedState=r}return s===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Xu(e){var t=Xt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var a=n.dispatch,s=n.pending,r=t.memoizedState;if(s!==null){n.pending=null;var f=s=s.next;do r=e(r,f.action),f=f.next;while(f!==s);Gn(r,t.memoizedState)||(Ft=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function Rm(e,t,n){var a=Pe,s=Xt(),r=tt;if(r){if(n===void 0)throw Error(u(407));n=n()}else n=t();var f=!Gn((Et||s).memoizedState,n);if(f&&(s.memoizedState=n,Ft=!0),s=s.queue,Qu(Lm.bind(null,a,s,e),[e]),e=s.getSnapshot!==t||f||Zt!==null&&(Zt.memoizedState.tag&1)!==0,Vs(e?9:8,{destroy:void 0},Dm.bind(null,a,s,n,t),null),e){if(a.flags|=2048,Mt===null)throw Error(u(349));r||(tl&127)!==0||Om(a,t,n)}return n}function Om(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Pe.updateQueue,t===null?(t=Nr(),Pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Dm(e,t,n,a){t.value=n,t.getSnapshot=a,zm(t)&&Um(e)}function Lm(e,t,n){return n(function(){zm(t)&&Um(e)})}function zm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gn(e,n)}catch{return!0}}function Um(e){var t=ts(e,2);t!==null&&zn(t,e,2)}function Yu(e){var t=kn();if(typeof e=="function"){var n=e;if(e=n(),fs){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:e},t}function Hm(e,t,n,a){return e.baseState=n,Gu(e,Et,typeof a=="function"?a:nl)}function Db(e,t,n,a,s){if(Rr(e))throw Error(u(485));if(e=t.action,e!==null){var r={payload:s,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){r.listeners.push(f)}};Se.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,Bm(t,r)):(r.next=n.next,t.pending=n.next=r)}}function Bm(e,t){var n=t.action,a=t.payload,s=e.state;if(t.isTransition){var r=Se.T,f={};f.types=r!==null?r.types:null,Se.T=f;try{var p=n(s,a),T=Se.S;T!==null&&T(f,p),Im(e,t,p)}catch(R){Vu(e,t,R)}finally{r!==null&&f.types!==null&&(r.types=f.types),Se.T=r}}else try{r=n(s,a),Im(e,t,r)}catch(R){Vu(e,t,R)}}function Im(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){qm(e,t,a)},function(a){return Vu(e,t,a)}):qm(e,t,n)}function qm(e,t,n){t.status="fulfilled",t.value=n,$m(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bm(e,n)))}function Vu(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,$m(t),t=t.next;while(t!==a)}e.action=null}function $m(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Gm(e,t){return t}function Xm(e,t){if(tt){var n=Mt.formState;if(n!==null){e:{var a=Pe;if(tt){if(_t){t:{for(var s=_t,r=oa;s.nodeType!==8;){if(!r){s=null;break t}if(s=ca(s.nextSibling),s===null){s=null;break t}}r=s.data,s=r==="F!"||r==="F"?s:null}if(s){_t=ca(s.nextSibling),a=s.data==="F!";break e}}xl(a)}a=!1}a&&(t=n[0])}}return n=kn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gm,lastRenderedState:t},n.queue=a,n=cp.bind(null,Pe,a),a.dispatch=n,a=Yu(!1),r=Ju.bind(null,Pe,!1,a.queue),a=kn(),s={state:t,dispatch:null,action:e,pending:null},a.queue=s,n=Db.bind(null,Pe,s,r,n),s.dispatch=n,a.memoizedState=e,[t,n,!1]}function Ym(e){var t=Xt();return Vm(t,Et,e)}function Vm(e,t,n){if(t=Gu(e,t,Gm)[0],e=Cr(nl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ki(t)}catch(f){throw f===$s?br:f}else a=t;t=Xt();var s=t.queue,r=s.dispatch;return n!==t.memoizedState&&(Pe.flags|=2048,Vs(9,{destroy:void 0},Lb.bind(null,s,n),null)),[a,r,e]}function Lb(e,t){e.action=t}function Qm(e){var t=Xt(),n=Et;if(n!==null)return Vm(t,n,e);Xt(),t=t.memoizedState,n=Xt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Vs(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Pe.updateQueue,t===null&&(t=Nr(),Pe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Km(){return Xt().memoizedState}function Mr(e,t,n,a){var s=kn();Pe.flags|=e,s.memoizedState=Vs(1|t,{destroy:void 0},n,a===void 0?null:a)}function _r(e,t,n,a){var s=Xt();a=a===void 0?null:a;var r=s.memoizedState.inst;Et!==null&&a!==null&&Uu(a,Et.memoizedState.deps)?s.memoizedState=Vs(t,r,n,a):(Pe.flags|=e,s.memoizedState=Vs(1|t,r,n,a))}function Zm(e,t){Mr(8390656,8,e,t)}function Qu(e,t){_r(2048,8,e,t)}function zb(e){Pe.flags|=4;var t=Pe.updateQueue;if(t===null)t=Nr(),Pe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Fm(e){var t=Xt().memoizedState;return zb({ref:t,nextImpl:e}),function(){if((gt&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function Pm(e,t){return _r(4,2,e,t)}function Jm(e,t){return _r(4,4,e,t)}function Wm(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ep(e,t,n){n=n!=null?n.concat([e]):null,_r(4,4,Wm.bind(null,t,e),n)}function Ku(){}function tp(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Uu(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function np(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Uu(t,a[1]))return a[0];if(a=e(),fs){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[a,t],a}function Zu(e,t,n){return n===void 0||(tl&1073741824)!==0&&(ot&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=fg(),Pe.lanes|=e,Rl|=e,n)}function ap(e,t,n,a){return Gn(n,t)?n:jl.current!==null?(e=Zu(e,n,a),Gn(e,t)||(Ft=!0),e):(tl&106)===0||(tl&1073741824)!==0&&(ot&261930)===0?(Ft=!0,e.memoizedState=n):(e=fg(),Pe.lanes|=e,Rl|=e,t)}function lp(e,t,n,a,s){var r=_e.p;_e.p=r!==0&&8>r?r:8;var f=Se.T,p={};p.types=f!==null?f.types:null,Se.T=p,Ju(e,!1,t,n);try{var T=s(),R=Se.S;if(R!==null&&R(p,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var $=_b(T,a);Zi(e,t,$,Kn(e))}else Zi(e,t,a,Kn(e))}catch(W){Zi(e,t,{then:function(){},status:"rejected",reason:W},Kn())}finally{_e.p=r,f!==null&&p.types!==null&&(f.types=p.types),Se.T=f}}function Ub(){}function Fu(e,t,n,a){if(e.tag!==5)throw Error(u(476));var s=sp(e).queue;lp(e,s,t,mt,n===null?Ub:function(){return ip(e),n(a)})}function sp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:mt,baseState:mt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:mt},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ip(e){var t=sp(e);t.next===null&&(t=e.alternate.memoizedState),Zi(e,t.next.queue,{},Kn())}function Pu(){return rn(di)}function op(){return Xt().memoizedState}function rp(){return Xt().memoizedState}function Hb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Kn();e=Tl(n);var a=kl(t,e,n);a!==null&&(zn(a,t,n),Gi(a,t,n)),t={cache:ku()},e.payload=t;return}t=t.return}}function Bb(e,t,n){var a=Kn();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rr(e)?up(t,n):(n=gu(e,t,n,a),n!==null&&(zn(n,e,a),dp(n,t,a)))}function cp(e,t,n){var a=Kn();Zi(e,t,n,a)}function Zi(e,t,n,a){var s={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rr(e))up(t,s);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var f=t.lastRenderedState,p=r(f,n);if(s.hasEagerState=!0,s.eagerState=p,Gn(p,f))return cr(e,t,s,0),Mt===null&&rr(),!1}catch{}finally{}if(n=gu(e,t,s,a),n!==null)return zn(n,e,a),dp(n,t,a),!0}return!1}function Ju(e,t,n,a){if(a={lane:2,revertLane:$d(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Rr(e)){if(t)throw Error(u(479))}else t=gu(e,n,a,2),t!==null&&zn(t,e,2)}function Rr(e){var t=e.alternate;return e===Pe||t!==null&&t===Pe}function up(e,t){Xs=kr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dp(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Xa(e,n)}}var Or={readContext:rn,use:Er,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt,useEffectEvent:qt},fp={readContext:rn,use:Er,useCallback:function(e,t){return kn().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:Zm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Mr(4194308,4,Wm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mr(4194308,4,e,t)},useInsertionEffect:function(e,t){Mr(4,2,e,t)},useMemo:function(e,t){var n=kn();t=t===void 0?null:t;var a=e();if(fs){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=kn();if(n!==void 0){var s=n(t);if(fs){Fe(!0);try{n(t)}finally{Fe(!1)}}}else s=t;return a.memoizedState=a.baseState=s,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:s},a.queue=e,e=e.dispatch=Bb.bind(null,Pe,e),[a.memoizedState,e]},useRef:function(e){var t=kn();return e={current:e},t.memoizedState=e},useState:function(e){e=Yu(e);var t=e.queue,n=cp.bind(null,Pe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ku,useDeferredValue:function(e,t){var n=kn();return Zu(n,e,t)},useTransition:function(){var e=Yu(!1);return e=lp.bind(null,Pe,e.queue,!0,!1),kn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Pe,s=kn();if(tt){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Mt===null)throw Error(u(349));(ot&127)!==0||Om(a,t,n)}s.memoizedState=n;var r={value:n,getSnapshot:t};return s.queue=r,Zm(Lm.bind(null,a,r,e),[e]),a.flags|=2048,Vs(9,{destroy:void 0},Dm.bind(null,a,r,n,t),null),n},useId:function(){var e=kn(),t=Mt.identifierPrefix;if(tt){var n=Ra,a=_a;n=(a&~(1<<32-jt(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=jr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Rb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Pu,useFormState:Xm,useActionState:Xm,useOptimistic:function(e){var t=kn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ju.bind(null,Pe,!0,n),n.dispatch=t,[e,t]},useMemoCache:$u,useCacheRefresh:function(){return kn().memoizedState=Hb.bind(null,Pe)},useEffectEvent:function(e){var t=kn(),n={impl:e};return t.memoizedState=n,function(){if((gt&2)!==0)throw Error(u(440));return n.impl.apply(void 0,arguments)}}},hp={readContext:rn,use:Er,useCallback:tp,useContext:rn,useEffect:Qu,useImperativeHandle:ep,useInsertionEffect:Pm,useLayoutEffect:Jm,useMemo:np,useReducer:Cr,useRef:Km,useState:function(){return Cr(nl)},useDebugValue:Ku,useDeferredValue:function(e,t){var n=Xt();return ap(n,Et.memoizedState,e,t)},useTransition:function(){var e=Cr(nl)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Rm,useId:op,useHostTransitionStatus:Pu,useFormState:Ym,useActionState:Ym,useOptimistic:function(e,t){var n=Xt();return Hm(n,Et,e,t)},useMemoCache:$u,useCacheRefresh:rp,useEffectEvent:Fm},Ib={readContext:rn,use:Er,useCallback:tp,useContext:rn,useEffect:Qu,useImperativeHandle:ep,useInsertionEffect:Pm,useLayoutEffect:Jm,useMemo:np,useReducer:Xu,useRef:Km,useState:function(){return Xu(nl)},useDebugValue:Ku,useDeferredValue:function(e,t){var n=Xt();return Et===null?Zu(n,e,t):ap(n,Et.memoizedState,e,t)},useTransition:function(){var e=Xu(nl)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Rm,useId:op,useHostTransitionStatus:Pu,useFormState:Qm,useActionState:Qm,useOptimistic:function(e,t){var n=Xt();return Et!==null?Hm(n,Et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:$u,useCacheRefresh:rp,useEffectEvent:Fm};function Wu(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:Y({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ed={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Kn(),s=Tl(a);s.payload=t,n!=null&&(s.callback=n),t=kl(e,s,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Kn(),s=Tl(a);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=kl(e,s,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Kn(),a=Tl(n);a.tag=2,t!=null&&(a.callback=t),t=kl(e,a,n),t!==null&&(zn(t,e,n),Gi(t,e,n))}};function mp(e,t,n,a,s,r,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,f):t.prototype&&t.prototype.isPureReactComponent?!Li(n,a)||!Li(s,r):!0}function pp(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&ed.enqueueReplaceState(t,t.state,null)}function hs(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=Y({},n));for(var s in e)n[s]===void 0&&(n[s]=e[s])}return n}function gp(e){or(e)}function yp(e){console.error(e)}function vp(e){or(e)}function Dr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function bp(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(s){setTimeout(function(){throw s})}}function td(e,t,n){return n=Tl(n),n.tag=3,n.payload={element:null},n.callback=function(){Dr(e,t)},n}function xp(e){return e=Tl(e),e.tag=3,e}function Sp(e,t,n,a){var s=n.type.getDerivedStateFromError;if(typeof s=="function"){var r=a.value;e.payload=function(){return s(r)},e.callback=function(){bp(t,n,a)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){bp(t,n,a),typeof s!="function"&&(Ol===null?Ol=new Set([this]):Ol.add(this));var p=a.stack;this.componentDidCatch(a.value,{componentStack:p!==null?p:""})})}function qb(e,t,n,a,s){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&ss(t,n,s,!0),n=cn.current,n!==null){switch(n.tag){case 31:case 13:case 19:return xn===null?tc():n.alternate===null&&$t===0&&($t=3),n.flags&=-257,n.flags|=65536,n.lanes=s,a===xr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Bd(e,a,s)),!1;case 22:return n.flags|=65536,a===xr?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Bd(e,a,s)),!1}throw Error(u(435,n.tag))}return Bd(e,a,s),tc(),!1}if(tt)return t=cn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=s,a!==Su&&(e=Error(u(422),{cause:a}),Hi(la(e,n)))):(a!==Su&&(t=Error(u(423),{cause:a}),Hi(la(t,n))),e=e.current.alternate,e.flags|=65536,s&=-s,e.lanes|=s,a=la(a,n),s=td(e.stateNode,a,s),_u(e,s),$t!==4&&($t=2)),!1;var r=Error(u(520),{cause:a});if(r=la(r,n),ao===null?ao=[r]:ao.push(r),$t!==4&&($t=2),t===null)return!0;a=la(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=s&-s,n.lanes|=e,e=td(n.stateNode,a,e),_u(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Ol===null||!Ol.has(r))))return n.flags|=65536,s&=-s,n.lanes|=s,s=xp(s),Sp(s,e,n,a),_u(n,s),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var nd=Error(u(461)),Ft=!1;function en(e,t,n,a){t.child=e===null?km(t,null,n,a):ds(t,e.child,n,a)}function wp(e,t,n,a,s){n=n.render;var r=t.ref;if("ref"in a){var f={};for(var p in a)p!=="ref"&&(f[p]=a[p])}else f=a;return is(t),a=Hu(e,t,n,f,r,s),p=Bu(),e!==null&&!Ft?(Iu(e,t,s),al(e,t,s)):(tt&&p&&hr(t),t.flags|=1,en(e,t,a,s),t.child)}function Ap(e,t,n,a,s){if(e===null){var r=n.type;return typeof r=="function"&&!yu(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,Tp(e,t,r,a,s)):(e=dr(n.type,null,a,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!ud(e,s)){var f=r.memoizedProps;if(n=n.compare,n=n!==null?n:Li,n(f,a)&&e.ref===t.ref)return al(e,t,s)}return t.flags|=1,e=Pa(r,a),e.ref=t.ref,e.return=t,t.child=e}function Tp(e,t,n,a,s){if(e!==null){var r=e.memoizedProps;if(Li(r,a)&&e.ref===t.ref)if(Ft=!1,t.pendingProps=a=r,ud(e,s))(e.flags&131072)!==0&&(Ft=!0);else return t.lanes=e.lanes,al(e,t,s)}return ad(e,t,n,a,s)}function kp(e,t,n,a){var s=a.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(a=t.child=e.child,s=0;a!==null;)s=s|a.lanes|a.childLanes,a=a.sibling;a=s&~r}else a=0,t.child=null;return jp(e,t,r,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&vr(t,r!==null?r.cachePool:null),r!==null?Em(t,r):Ou(),Cm(t);else return a=t.lanes=536870912,jp(e,t,r!==null?r.baseLanes|n:n,n,a)}else r!==null?(vr(t,r.cachePool),Em(t,r),El(),t.memoizedState=null):(e!==null&&vr(t,null),Ou(),El());return en(e,t,s,n),t.child}function Fi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jp(e,t,n,a,s){var r=Nu();return r=r===null?null:{parent:Kt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&vr(t,null),Ou(),Cm(t),e!==null&&ss(e,t,a,!0),t.childLanes=s,null}function Lr(e,t){return t=zr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Np(e,t,n){return ds(t,e.child,null,n),e=Lr(t,t.pendingProps),e.flags|=2,Xn(t),t.memoizedState=null,e}function $b(e,t,n){var a=t.pendingProps,s=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(tt){if(a.mode==="hidden")return e=Lr(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Fi(null,e);if(Lu(t),(e=_t)?(e=Wg(e,oa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vl!==null?{id:_a,overflow:Ra}:null,retryLane:536870912,hydrationErrors:null},n=um(e),n.return=t,t.child=n,an=t,_t=null)):e=null,e===null)throw xl(t);return t.lanes=536870912,null}return Lr(t,a)}var r=e.memoizedState;if(r!==null){var f=r.dehydrated;if(Lu(t),s)if(t.flags&256)t.flags&=-257,t=Np(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(Ft||ss(e,t,n,!1),s=(n&e.childLanes)!==0,Ft||s){if(jl.current===null){if(a=Mt,a!==null&&(f=Na(a,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,ts(e,f),zn(a,e,f),nd;tc()}t=Np(e,t,n)}else e=r.treeContext,_t=ca(f.nextSibling),an=t,tt=!0,bl=null,oa=!1,e!==null&&hm(t,e),t=Lr(t,a),t.flags|=134221824;return t}return e=Pa(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Qs(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(u(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ad(e,t,n,a,s){return is(t),n=Hu(e,t,n,a,void 0,s),a=Bu(),e!==null&&!Ft?(Iu(e,t,s),al(e,t,s)):(tt&&a&&hr(t),t.flags|=1,en(e,t,n,s),t.child)}function Ep(e,t,n,a,s,r){return is(t),t.updateQueue=null,n=_m(t,a,n,s),Mm(e),a=Bu(),e!==null&&!Ft?(Iu(e,t,r),al(e,t,r)):(tt&&a&&hr(t),t.flags|=1,en(e,t,n,r),t.child)}function Cp(e,t,n,a,s){if(is(t),t.stateNode===null){var r=Us,f=n.contextType;typeof f=="object"&&f!==null&&(r=rn(f)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=ed,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},Cu(t),f=n.contextType,r.context=typeof f=="object"&&f!==null?rn(f):Us,r.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(Wu(t,n,f,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(f=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),f!==r.state&&ed.enqueueReplaceState(r,r.state,null),Yi(t,a,r,s),Xi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var p=t.memoizedProps,T=hs(n,p);r.props=T;var R=r.context,$=n.contextType;f=Us,typeof $=="object"&&$!==null&&(f=rn($));var W=n.getDerivedStateFromProps;$=typeof W=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,$||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||R!==f)&&pp(t,r,a,f),Al=!1;var M=t.memoizedState;r.state=M,Yi(t,a,r,s),Xi(),R=t.memoizedState,p||M!==R||Al?(typeof W=="function"&&(Wu(t,n,W,a),R=t.memoizedState),(T=Al||mp(t,n,T,a,M,R,f))?($||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=R),r.props=a,r.state=R,r.context=f,a=T):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,Mu(e,t),f=t.memoizedProps,$=hs(n,f),r.props=$,W=t.pendingProps,M=r.context,R=n.contextType,T=Us,typeof R=="object"&&R!==null&&(T=rn(R)),p=n.getDerivedStateFromProps,(R=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==W||M!==T)&&pp(t,r,a,T),Al=!1,M=t.memoizedState,r.state=M,Yi(t,a,r,s),Xi();var I=t.memoizedState;f!==W||M!==I||Al||e!==null&&e.dependencies!==null&&gr(e.dependencies)?(typeof p=="function"&&(Wu(t,n,p,a),I=t.memoizedState),($=Al||mp(t,n,$,a,M,I,T)||e!==null&&e.dependencies!==null&&gr(e.dependencies))?(R||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,I,T),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,I,T)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=I),r.props=a,r.state=I,r.context=T,a=$):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,Qs(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=ds(t,e.child,null,s),t.child=ds(t,null,n,s)):en(e,t,n,s),t.memoizedState=r.state,e=t.child):e=al(e,t,s),e}function Mp(e,t,n,a){return as(),t.flags|=256,en(e,t,n,a),t.child}var ld={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sd(e){return{baseLanes:e,cachePool:bm()}}function id(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Qn),e}function _p(e,t,n){var a=t.pendingProps,s=!1,r=(t.flags&128)!==0,f;if((f=r)||(f=e!==null&&e.memoizedState===null?!1:(un.current&2)!==0),f&&(s=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(tt){if(s?Nl(t):El(),(e=_t)?(e=Wg(e,oa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vl!==null?{id:_a,overflow:Ra}:null,retryLane:536870912,hydrationErrors:null},n=um(e),n.return=t,t.child=n,an=t,_t=null)):e=null,e===null)throw xl(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}return r=a.children,a=a.fallback,s?(El(),s=t.mode,r=zr({mode:"hidden",children:r},s),a=ns(a,s,n,null),r.return=t,a.return=t,r.sibling=a,t.child=r,a=t.child,a.memoizedState=sd(n),a.childLanes=id(e,f,n),t.memoizedState=ld,Fi(null,a)):(Nl(t),od(t,r))}var p=e.memoizedState;if(p!==null){var T=p.dehydrated;if(T!==null)return Gb(e,t,r,f,a,T,p,n)}return s?(El(),s=a.fallback,r=t.mode,p=e.child,T=p.sibling,a=Pa(p,{mode:"hidden",children:a.children}),a.subtreeFlags=p.subtreeFlags&1206910976,T!==null?s=Pa(T,s):(s=ns(s,r,n,null),s.flags|=2),s.return=t,a.return=t,a.sibling=s,t.child=a,Fi(null,a),a=t.child,s=e.child.memoizedState,s===null?s=sd(n):(r=s.cachePool,r!==null?(p=Kt._currentValue,r=r.parent!==p?{parent:p,pool:p}:r):r=bm(),s={baseLanes:s.baseLanes|n,cachePool:r}),a.memoizedState=s,a.childLanes=id(e,f,n),t.memoizedState=ld,Fi(e.child,a)):(Nl(t),n=e.child,e=n.sibling,n=Pa(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function od(e,t){return t=zr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zr(e,t){return e=Rn(22,e,null,t),e.lanes=0,e}function Ur(e,t,n){return ds(t,e.child,null,n),e=od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gb(e,t,n,a,s,r,f,p){if(n)return t.flags&256?(Nl(t),t.flags&=-257,Ur(e,t,p)):t.memoizedState!==null?(El(),t.child=e.child,t.flags|=128,null):(El(),r=s.fallback,f=t.mode,s=zr({mode:"visible",children:s.children},f),r=ns(r,f,p,null),r.flags|=2,s.return=t,r.return=t,s.sibling=r,t.child=s,ds(t,e.child,null,p),s=t.child,s.memoizedState=sd(p),s.childLanes=id(e,a,p),t.memoizedState=ld,Fi(null,s));if(Nl(t),sf(r)){if(a=r.nextSibling&&r.nextSibling.dataset,a)var T=a.dgst;return a=T,a!==""&&(s=Error(u(419)),s.stack="",s.digest=a,Hi({value:s,source:null,stack:null})),Ur(e,t,p)}if(Ft||ss(e,t,p,!1),a=(p&e.childLanes)!==0,Ft||a){if(jl.current!==null)return Ur(e,t,p);if(a=Mt,a!==null&&(s=Na(a,p),s!==0&&s!==f.retryLane))throw f.retryLane=s,ts(e,s),zn(a,e,s),nd;return lf(r)||tc(),Ur(e,t,p)}return lf(r)?(t.flags|=192,t.child=e.child,null):(e=f.treeContext,_t=ca(r.nextSibling),an=t,tt=!0,bl=null,oa=!1,e!==null&&hm(t,e),t=od(t,s.children),t.flags|=134221824,t)}function Rp(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),pr(e.return,t,n)}function Op(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Tr(n)===null&&(t=e),e=e.sibling}return t}function Hr(e,t,n,a,s,r){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:s,treeForkCount:r}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=a,f.tail=n,f.tailMode=s,f.treeForkCount=r)}function rd(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function cd(e,t,n){var a=t.pendingProps,s=a.revealOrder,r=a.tail;a=a.children;var f=un.current;if(t.flags&128)return Vi(t,f),null;var p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,Vi(t,f),s==="backwards"&&e!==null?(rd(e),en(e,t,a,n),rd(e)):en(e,t,a,n),a=tt?Ui:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rp(e,n,t);else if(e.tag===19)Rp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(s){case"backwards":n=Op(t.child),n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null,rd(t)),Hr(t,!0,s,null,r,a);break;case"unstable_legacy-backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Tr(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Hr(t,!0,n,null,r,a);break;case"together":Hr(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:n=Op(t.child),n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Hr(t,!1,s,n,r,a)}return t.child}function Dp(e,t,n){var a=t.pendingProps;return Sl(t,t.type,a.value),en(e,t,a.children,n),t.child}function al(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Rl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ss(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=Pa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Pa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ud(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gr(e)))}function Xb(e,t,n){switch(t.tag){case 3:q(t,t.stateNode.containerInfo),Sl(t,Kt,e.memoizedState.cache),as();break;case 27:case 5:He(t);break;case 4:q(t,t.stateNode.containerInfo);break;case 10:Sl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return Nl(t),t.flags|=128,null;a=ss(e,t,n,!1);var s=t.child.childLanes;return a||(n&s)!==0?_p(e,t,n):(Nl(t),e=al(e,t,n),e!==null?e.sibling:null)}Nl(t);break;case 19:if(t.flags&128)return cd(e,t,n);if(s=(e.flags&128)!==0,a=(n&t.childLanes)!==0,a||(ss(e,t,n,!1),a=(n&t.childLanes)!==0),s){if(a)return cd(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Vi(t,un.current),a)break;return null;case 22:return t.lanes=0,kp(e,t,n,t.pendingProps);case 24:Sl(t,Kt,e.memoizedState.cache)}return al(e,t,n)}function Lp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ft=!0;else{if(!ud(e,n)&&(t.flags&128)===0)return Ft=!1,Xb(e,t,n);Ft=(e.flags&131072)!==0}else Ft=!1,tt&&(t.flags&1048576)!==0&&fm(t,Ui,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=cs(t.elementType),t.type=e,typeof e=="function")yu(e)?(a=hs(e,a),t.tag=1,t=Cp(null,t,e,a,n)):(t.tag=0,t=ad(null,t,e,a,n));else{if(e!=null){var s=e.$$typeof;if(s===ne){t.tag=11,t=wp(null,t,e,a,n);break e}else if(s===ee){t.tag=14,t=Ap(null,t,e,a,n);break e}else if(s===Ce){t.tag=10,t.type=e,t=Dp(null,t,n);break e}}throw t=Oe(e)||e,Error(u(306,t,""))}}return t;case 0:return ad(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,s=hs(a,t.pendingProps),Cp(e,t,a,s,n);case 3:e:{if(q(t,t.stateNode.containerInfo),e===null)throw Error(u(387));a=t.pendingProps;var r=t.memoizedState;s=r.element,Mu(e,t),Yi(t,a,null,n);var f=t.memoizedState;if(a=f.cache,Sl(t,Kt,a),a!==r.cache&&Tu(t,[Kt],n,!0),Xi(),a=f.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=Mp(e,t,a,n);break e}else if(a!==s){s=la(Error(u(424)),t),Hi(s),t=Mp(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=ca(e.firstChild),an=t,tt=!0,bl=null,oa=!0,n=km(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(as(),a===s){t=al(e,t,n);break e}en(e,t,a,n)}t=t.child}return t;case 26:return Qs(e,t),e===null?(n=iy(t.type,null,t.pendingProps,null))?t.memoizedState=n:tt||(t.stateNode=Bg(t.type,t.pendingProps,be.current,t)):t.memoizedState=iy(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return He(t),e===null&&tt&&(a=t.stateNode=ny(t.type,t.pendingProps,be.current),an=t,oa=!0,s=_t,zl(t.type)?(of=s,_t=ca(a.firstChild)):_t=s),en(e,t,t.pendingProps.children,n),Qs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&tt&&((s=a=_t)&&(a=Hx(a,t.type,t.pendingProps,oa),a!==null?(t.stateNode=a,an=t,_t=ca(a.firstChild),oa=!1,s=!0):s=!1),s||xl(t)),He(t),s=t.type,r=t.pendingProps,f=e!==null?e.memoizedProps:null,a=r.children,Pd(s,r)?a=null:f!==null&&Pd(s,f)&&(t.flags|=32),t.memoizedState!==null&&(s=Hu(e,t,Ob,null,null,n),di._currentValue=s),Qs(e,t),en(e,t,a,n),t.child;case 6:return e===null&&tt&&((e=n=_t)&&(n=Bx(n,t.pendingProps,oa),n!==null?(t.stateNode=n,an=t,_t=null,e=!0):e=!1),e||xl(t)),null;case 13:return _p(e,t,n);case 4:return q(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=ds(t,null,a,n):en(e,t,a,n),t.child;case 11:return wp(e,t,t.type,t.pendingProps,n);case 7:return a=t.pendingProps,Qs(e,t),en(e,t,a,n),t.child;case 8:return en(e,t,t.pendingProps.children,n),t.child;case 12:return en(e,t,t.pendingProps.children,n),t.child;case 10:return Dp(e,t,n);case 9:return s=t.type._context,a=t.pendingProps.children,is(t),s=rn(s),a=a(s),t.flags|=1,en(e,t,a,n),t.child;case 14:return Ap(e,t,t.type,t.pendingProps,n);case 15:return Tp(e,t,t.type,t.pendingProps,n);case 19:return cd(e,t,n);case 31:return $b(e,t,n);case 22:return kp(e,t,n,t.pendingProps);case 24:return is(t),a=rn(Kt),e===null?(s=Nu(),s===null&&(s=Mt,r=ku(),s.pooledCache=r,r.refCount++,r!==null&&(s.pooledCacheLanes|=n),s=r),t.memoizedState={parent:a,cache:s},Cu(t),Sl(t,Kt,s)):((e.lanes&n)!==0&&(Mu(e,t),Yi(t,null,null,n),Xi()),s=e.memoizedState,r=t.memoizedState,s.parent!==a?(s={parent:a,cache:a},t.memoizedState=s,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=s),Sl(t,Kt,a)):(a=r.cache,Sl(t,Kt,a),a!==s.cache&&Tu(t,[Kt],n,!0))),en(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:tt&&hr(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Qs(e,t),en(e,t,a.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function ll(e){e.flags|=4}function dd(e,t,n,a,s){var r;if((r=(e.mode&32)!==0)&&(r=n===null?uy(t,a):uy(t,a)&&(a.src!==n.src||a.srcSet!==n.srcSet)),r){if(e.flags|=16777216,(s&335544128)===s)if(e.stateNode.complete)e.flags|=8192;else if(gg())e.flags|=8192;else throw us=xr,Eu}else e.flags&=-16777217}function zp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dy(t))if(gg())e.flags|=8192;else throw us=xr,Eu}function Br(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?at():536870912,e.lanes|=t,Js|=t)}function Pi(e,t){if(!tt)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function Rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,a|=s.subtreeFlags&1206910976,a|=s.flags&1206910976,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,a|=s.subtreeFlags,a|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function Yb(e,t,n){var a=t.pendingProps;switch(xu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(t),null;case 1:return Rt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),el(Kt),Re(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Is(t)?ll(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wu())),Rt(t),null;case 26:var s=t.type,r=t.memoizedState;return e===null?(ll(t),r!==null?(Rt(t),zp(t,r)):(Rt(t),dd(t,s,null,a,n))):r?r!==e.memoizedState?(ll(t),Rt(t),zp(t,r)):(Rt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&ll(t),Rt(t),dd(t,s,e,a,n)),null;case 27:if(pt(t),n=be.current,s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return Rt(t),t.subtreeFlags&=-33554433,null}e=le.current,Is(t)?mm(t):(e=ny(s,a,n),t.stateNode=e,ll(t))}return Rt(t),t.subtreeFlags&=-33554433,null;case 5:if(pt(t),s=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return Rt(t),t.subtreeFlags&=-33554433,null}if(r=le.current,Is(t))mm(t);else{var f=ro(be.current);switch(r){case 1:r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case 2:r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;default:switch(s){case"svg":r=f.createElementNS("http://www.w3.org/2000/svg",s);break;case"math":r=f.createElementNS("http://www.w3.org/1998/Math/MathML",s);break;case"script":r=f.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof a.is=="string"?f.createElement("select",{is:a.is}):f.createElement("select"),a.multiple?r.multiple=!0:a.size&&(r.size=a.size);break;default:r=typeof a.is=="string"?f.createElement(s,{is:a.is}):f.createElement(s)}}r[zt]=t,r[Ut]=a;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)r.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=r;e:switch(fn(r,s,a),s){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&ll(t)}}return Rt(t),t.subtreeFlags&=-33554433,dd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(u(166));if(e=be.current,Is(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,s=an,s!==null)switch(s.tag){case 27:case 5:a=s.memoizedProps}e[zt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Lg(e.nodeValue,n)),e||xl(t,!0)}else e=ro(e).createTextNode(a),e[zt]=t,t.stateNode=e}return Rt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=Is(t),n!==null){if(e===null){if(!a)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[zt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),e=!1}else n=wu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xn(t),t):(Xn(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Rt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(s=Is(t),a!==null&&a.dehydrated!==null){if(e===null){if(!s)throw Error(u(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(u(317));s[zt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),s=!1}else s=wu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),s=!0;if(!s)return t.flags&256?(Xn(t),t):(Xn(t),null)}return Xn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,s=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(s=a.alternate.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==s&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Br(t,t.updateQueue),Rt(t),null);case 4:return Re(),e===null&&Vd(t.stateNode.containerInfo),t.flags|=67108864,Rt(t),null;case 10:return el(t.type),Rt(t),null;case 19:if(zu(t),a=t.memoizedState,a===null)return Rt(t),null;if(s=(t.flags&128)!==0,r=a.rendering,r===null)if(s)Pi(a,!1);else{if($t!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=Tr(e),r!==null){for(t.flags|=128,Pi(a,!1),e=r.updateQueue,t.updateQueue=e,Br(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)cm(n,e),n=n.sibling;return Vi(t,un.current&1|2),tt&&Ja(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&yt()>Pr&&(t.flags|=128,s=!0,Pi(a,!1),t.lanes=4194304)}else{if(!s)if(e=Tr(r),e!==null){if(t.flags|=128,s=!0,e=e.updateQueue,t.updateQueue=e,Br(t,e),Pi(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!r.alternate&&!tt)return Rt(t),null}else 2*yt()-a.renderingStartTime>Pr&&n!==536870912&&(t.flags|=128,s=!0,Pi(a,!1),t.lanes=4194304);a.isBackwards?(r.sibling=t.child,t.child=r):(e=a.last,e!==null?e.sibling=r:t.child=r,a.last=r)}if(a.tail!==null){e=a.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=yt(),e.sibling=null,r=un.current,r=s?r&1|2:r&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!n||tt?Vi(t,r):(n=r,Ee(cn,t),Ee(un,n),xn===null&&(xn=t)),tt&&Ja(t,a.treeForkCount),e}return Rt(t),null;case 22:case 23:return Xn(t),Du(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),n=t.updateQueue,n!==null&&Br(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Be(rs),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),el(Kt),Rt(t),null;case 25:return null;case 30:return t.flags|=33554432,Rt(t),null}throw Error(u(156,t.tag))}function Vb(e,t){switch(xu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return el(Kt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Xn(t),t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Re(),null;case 10:return el(t.type),null;case 22:case 23:return Xn(t),Du(),e!==null&&Be(rs),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return el(Kt),null;case 25:return null;default:return null}}function Up(e,t){switch(xu(t),t.tag){case 3:el(Kt),Re();break;case 26:case 27:case 5:pt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Xn(t);break;case 13:Xn(t);break;case 19:zu(t);break;case 10:el(t.type);break;case 22:case 23:Xn(t),Du(),e!==null&&Be(rs);break;case 24:el(Kt)}}function Ji(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var s=a.next;n=s;do{if((n.tag&e)===e){a=void 0;var r=n.create,f=n.inst;a=r(),f.destroy=a}n=n.next}while(n!==s)}}catch(p){wt(t,t.return,p)}}function Cl(e,t,n){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var r=s.next;a=r;do{if((a.tag&e)===e){var f=a.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,s=t;var T=n,R=p;try{R()}catch($){wt(s,T,$)}}}a=a.next}while(a!==r)}}catch($){wt(t,t.return,$)}}function Hp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Nm(t,n)}catch(a){wt(e,e.return,a)}}}function Bp(e,t,n){n.props=hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){wt(e,t,a)}}function Oa(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var s=e.stateNode,r=Za(e.memoizedProps,s);(s.ref===null||s.ref.name!==r)&&(s.ref=Vg(r)),a=s.ref;break;case 7:if(e.stateNode===null){var f=new Zn(e);b(e.child,!1,zx,f,void 0,void 0),e.stateNode=f}a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(p){wt(e,t,p)}}function dn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(s){wt(e,t,s)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(s){wt(e,t,s)}else n.current=null}function Ir(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)Jg(e.stateNode,t[n])}function Ip(e){for(var t=e.return;t!==null&&(hd(t)&&Jg(e.stateNode,t.stateNode),!fd(t));)t=t.return}function Wi(e){for(var t=e.return;t!==null&&(hd(t)&&Ux(e.stateNode,t.stateNode),!fd(t));)t=t.return}function fd(e){return e.tag===5||e.tag===3||e.tag===27}function hd(e){return e&&e.tag===7&&e.stateNode!==null}function md(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(s){wt(e,e.return,s)}}function pd(e,t,n){try{var a=e.stateNode;vx(a,e.type,n,t),a[Ut]=t}catch(s){wt(e,e.return,s)}}function qp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&zl(e.type)||e.tag===4}function gd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&zl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yd(e,t,n,a){var s=e.tag;if(s===5||s===6)s=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(s,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(s),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ma)),Ir(e,a),ut=!0;else if(s!==4&&(s===27&&(Ir(e,a),a=null,zl(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(yd(e,t,n,a),e=e.sibling;e!==null;)yd(e,t,n,a),e=e.sibling}function qr(e,t,n,a){var s=e.tag;if(s===5||s===6)s=e.stateNode,t?n.insertBefore(s,t):n.appendChild(s),Ir(e,a),ut=!0;else if(s!==4&&(s===27&&(Ir(e,a),a=null,zl(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(qr(e,t,n,a),e=e.sibling;e!==null;)qr(e,t,n,a),e=e.sibling}function $p(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,s=t.attributes;s.length;)t.removeAttributeNode(s[0]);fn(t,a,n),t[zt]=e,t[Ut]=n}catch(r){wt(e,e.return,r)}}var $r=!1,Yn=null;function Gp(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&($r=!0)}var Da=null;function Xp(){var e=Da;return Da=null,e}var On=0;function Ks(e,t,n,a,s){return On=0,Yp(e.child,t,n,a,s)}function Yp(e,t,n,a,s){for(var r=!1;e!==null;){if(e.tag===5){var f=e.stateNode;if(a!==null){var p=ef(f);a.push(p),p.view&&(r=!0)}else r||ef(f).view&&(r=!0);$r=!0,Xg(f,On===0?t:t+"_"+On,n),On++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&s||Yp(e.child,t,n,a,s)&&(r=!0));e=e.sibling}return r}function La(e,t){for(;e!==null;)e.tag===5?Yg(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||La(e.child,t)),e=e.sibling}function Gr(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Gr(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(u(544));var n=t.name;t=Fa(t.default,t.share),t!=="none"&&(Ks(e,n,t,null,!1)||La(e.child,!1))}e=e.sibling}}function vd(e,t){if(e.tag===30){var n=e.stateNode,a=e.memoizedProps,s=Za(a,n),r=Fa(a.default,n.paired?a.share:a.enter);r!=="none"?Ks(e,s,r,null,!1)?(Gr(e),n.paired||t||ni(e,a.onEnter)):La(e.child,!1):Gr(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)vd(e,t),e=e.sibling;else Gr(e)}function bd(e){if(Yn!==null&&Yn.size!==0){var t=Yn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,a=n.name;if(a!=null&&a!=="auto"){var s=t.get(a);if(s!==void 0){var r=Fa(n.default,n.share);if(r!=="none"&&(Ks(e,a,r,null,!1)?(r=e.stateNode,s.paired=r,r.paired=s,ni(e,n.onShare)):La(e.child,!1)),t.delete(a),t.size===0)break}}}bd(e)}e=e.sibling}}}function xd(e){if(e.tag===30){var t=e.memoizedProps,n=Za(t,e.stateNode),a=Yn!==null?Yn.get(n):void 0,s=Fa(t.default,a!==void 0?t.share:t.exit);s!=="none"&&(Ks(e,n,s,null,!1)?a!==void 0?(s=e.stateNode,a.paired=s,s.paired=a,Yn.delete(n),ni(e,t.onShare)):ni(e,t.onExit):La(e.child,!1)),Yn!==null&&bd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)xd(e),e=e.sibling;else Yn!==null&&bd(e)}function Vp(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Za(t,e.stateNode);t=Fa(t.default,t.update),e.flags&=-5,t!=="none"&&Ks(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Vp(e);e=e.sibling}}function Sd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,La(e.child,!1))}Sd(e)}e=e.sibling}}function Xr(e){if(e.tag===30)e.stateNode.paired=null,La(e.child,!1),Sd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Xr(e),e=e.sibling;else Sd(e)}function Qp(e){for(e=e.child;e!==null;)e.tag===30?La(e.child,!1):(e.subtreeFlags&33554432)!==0&&Qp(e),e=e.sibling}function wd(e,t,n,a,s,r,f){for(var p=!1;t!==null;){if(t.tag===5){var T=t.stateNode;if(r!==null&&On<r.length){var R=r[On],$=ef(T);(R.view||$.view)&&(p=!0);var W;if(W=(e.flags&4)===0)if($.clip)W=!0;else{W=R.rect;var M=$.rect;W=W.y!==M.y||W.x!==M.x||W.height!==M.height||W.width!==M.width}W&&(e.flags|=4),$.abs?$=!R.abs:(R=R.rect,$=$.rect,$=R.height!==$.height||R.width!==$.width),$&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Xg(T,On===0?n:n+"_"+On,s),p&&(e.flags&4)!==0||(Da===null&&(Da=[]),Da.push(T,On===0?a:a+"_"+On,t.memoizedProps)),On++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&f?e.flags|=t.flags&32:wd(e,t.child,n,a,s,r,f)&&(p=!0));t=t.sibling}return p}function Kp(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,a=e.stateNode,s=Za(n,a),r=Fa(n.default,n.update),f;f=e.memoizedState,e.memoizedState=null,a=e;var p=e.child;On=0,s=wd(a,p,s,s,r,f,!1),(e.flags&4)!==0&&s&&ni(e,n.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Kp(e);e=e.sibling}}var ln=!1,vt=!1,za=!1,Ad=!1,Zp=typeof WeakSet=="function"?WeakSet:Set,sn=null,Ua=!1,eo=!1,Yr=!1,Td=!1;function Qb(e,t,n){if(e=e.containerInfo,Zd=fi,e=Wh(e),uu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var r=s.anchorOffset,f=s.focusNode;s=s.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,T=-1,R=-1,$=0,W=0,M=e,I=null;t:for(;;){for(var ye;M!==a||r!==0&&M.nodeType!==3||(T=p+r),M!==f||s!==0&&M.nodeType!==3||(R=p+s),M.nodeType===3&&(p+=M.nodeValue.length),(ye=M.firstChild)!==null;)I=M,M=ye;for(;;){if(M===e)break t;if(I===a&&++$===r&&(T=p),I===f&&++W===s&&(R=p),(ye=M.nextSibling)!==null)break;M=I,I=M.parentNode}M=ye}a=T===-1||R===-1?null:{start:T,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Fd={focusedElem:e,selectionRange:a},fi=!1,n=(n&335544064)===n,sn=t,t=n?9270:1024;sn!==null;){if(e=sn,n&&(a=e.deletions,a!==null))for(r=0;r<a.length;r++)n&&xd(a[r]);if(e.alternate===null&&(e.flags&2)!==0)n&&Gp(e),Vr(n);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&n&&xd(a),Vr(n);continue}else if(a!==null&&a.memoizedState!==null){n&&Gp(e),Vr(n);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,sn=a):(n&&Vp(e),Vr(n))}}Yn=null}function Vr(e){for(;sn!==null;){var t=sn,n=e,a=t.alternate,s=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((s&1024)!==0&&a!==null){n=void 0,s=a.memoizedProps,a=a.memoizedState;var r=t.stateNode;try{var f=hs(t.type,s);n=r.getSnapshotBeforeUpdate(f,a),r.__reactInternalSnapshotBeforeUpdate=n}catch(p){wt(t,t.return,p)}}break;case 3:if((s&1024)!==0){if(a=t.stateNode.containerInfo,n=a.nodeType,n===9)af(a);else if(n===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":af(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&a!==null&&(n=Za(a.memoizedProps,a.stateNode),s=t.memoizedProps,s=Fa(s.default,s.update),s!=="none"&&Ks(a,n,s,a.memoizedState=[],!0));break;default:if((s&1024)!==0)throw Error(u(163))}if(a=t.sibling,a!==null){a.return=t.return,sn=a;break}sn=t.return}}function Fp(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:Ha(e,n),a&4&&Ji(5,n);break;case 1:if(Ha(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){wt(n,n.return,f)}else{var s=hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(s,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){wt(n,n.return,f)}}a&64&&Hp(n),a&512&&Oa(n,n.return);break;case 3:if(Ha(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Nm(e,t)}catch(f){wt(n,n.return,f)}}break;case 27:t===null&&a&4&&$p(n);case 26:case 5:Ha(e,n),t===null&&a&4&&md(n),a&512&&Oa(n,n.return);break;case 12:Ha(e,n);break;case 31:Ha(e,n),a&4&&eg(e,n);break;case 13:Ha(e,n),a&4&&tg(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=sx.bind(null,n),Ix(e,n))));break;case 22:if(a=n.memoizedState!==null||ln,!a){var r=t!==null&&t.memoizedState!==null||vt;t=ln,s=vt,ln=a,(vt=r)&&!s?(a=2,(n.subtreeFlags&8772)!==0&&(a|=1),ba(e,n,a)):Ha(e,n),ln=t,vt=s}break;case 30:Ha(e,n),a&512&&Oa(n,n.return);break;case 7:a&512&&Oa(n,n.return);default:Ha(e,n)}}function kd(e,t){for(e=e.child;e!==null;)Pp(e,t),e=e.sibling}function Pp(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var a=n.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var s=e.stateNode,r=e.memoizedProps.style,f=r!=null&&r.hasOwnProperty("display")?r.display:null;s.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(T){wt(e,e.return,T)}jd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,ut=!0}catch(T){wt(e,e.return,T)}break;case 18:try{var p=e.stateNode;t?Gg(p,!0):Gg(e.stateNode,!1)}catch(T){wt(e,e.return,T)}break;case 22:case 23:e.memoizedState===null&&kd(e,t);break;default:kd(e,t)}}function jd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,a=t;switch(n.tag){case 4:Pp(n,a);break e;case 22:n.memoizedState===null&&jd(n,a);break e;default:jd(n,a)}}e=e.sibling}}function Jp(e){var t=e.alternate;t!==null&&(e.alternate=null,Jp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ya(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Lt=null,Dn=!1;function ya(e,t,n){for(n=n.child;n!==null;)Wp(e,t,n),n=n.sibling}function Wp(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount=="function")try{Qe.onCommitFiberUnmount(Ye,n)}catch{}switch(n.tag){case 26:vt||dn(n,t),ya(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!vt&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:vt||dn(n,t),Wi(n);var a=Lt,s=Dn;zl(n.type)&&(Lt=n.stateNode,Dn=!1),ya(e,t,n),ay(n.stateNode,n.type,n.memoizedProps),Lt=a,Dn=s;break;case 5:vt||dn(n,t),Wi(n);case 6:if(n.tag===6&&Wi(n),a=Lt,s=Dn,Lt=null,ya(e,t,n),Lt=a,Dn=s,Lt!==null)if(Dn)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(n.stateNode),ut=!0}catch(r){wt(n,t,r)}else try{Lt.removeChild(n.stateNode),ut=!0}catch(r){wt(n,t,r)}break;case 18:Lt!==null&&(Dn?(e=Lt,$g(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),hi(e)):$g(Lt,n.stateNode));break;case 4:a=Lt,s=Dn,Lt=n.stateNode.containerInfo,Dn=!0,ya(e,t,n),Lt=a,Dn=s;break;case 0:case 11:case 14:case 15:Cl(2,n,t),vt||Cl(4,n,t),ya(e,t,n);break;case 1:vt||(dn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Bp(n,t,a)),ya(e,t,n);break;case 21:ya(e,t,n);break;case 22:vt=(a=vt)||n.memoizedState!==null,ya(e,t,n),vt=a;break;case 30:dn(n,t),ya(e,t,n);break;case 7:vt||dn(n,t),ya(e,t,n);break;default:ya(e,t,n)}}function eg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hi(e)}catch(n){wt(t,t.return,n)}}}function tg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hi(e)}catch(n){wt(t,t.return,n)}}function Kb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zp),t;default:throw Error(u(435,e.tag))}}function Qr(e,t){var n=Kb(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var s=ix.bind(null,e,a);a.then(s,s)}})}function jn(e,t,n){var a=t.deletions;if(a!==null)for(var s=0;s<a.length;s++){var r=a[s],f=e,p=t,T=p;e:for(;T!==null;){switch(T.tag){case 27:if(zl(T.type)){Lt=T.stateNode,Dn=!1;break e}break;case 5:Lt=T.stateNode,Dn=!1;break e;case 3:case 4:Lt=T.stateNode.containerInfo,Dn=!0;break e}T=T.return}if(Lt===null)throw Error(u(160));Wp(f,p,r),Lt=null,Dn=!1,f=r.alternate,f!==null&&(f.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ng(t,e,n),t=t.sibling}var va=null;function ng(e,t,n){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(s&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var r=0;r<a.length;r++){var f=a[r];f.ref.impl=f.nextImpl}jn(t,e,n),Nn(e),s&4&&(Cl(3,e,e.return),Ji(3,e),Cl(5,e,e.return));break;case 1:jn(t,e,n),Nn(e),s&512&&(vt||a===null||dn(a,a.return)),s&64&&ln&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(r=va,jn(t,e,n),Nn(e),s&512&&(vt||a===null||dn(a,a.return)),s&4)if(s=a!==null?a.memoizedState:null,n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null)if(ln)e.stateNode=Bg(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,s=r.ownerDocument||r;t:switch(t){case"title":a=s.getElementsByTagName("title")[0],(!a||a[pl]||a[zt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=s.createElement(t),s.head.insertBefore(a,s.querySelector("head > title"))),fn(a,t,n),a[zt]=e,xt(a),t=a;break e;case"link":if(r=cy("link","href",s).get(t+(n.href||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&a.getAttribute("rel")===(n.rel==null?null:n.rel)&&a.getAttribute("title")===(n.title==null?null:n.title)&&a.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){r.splice(f,1);break t}}a=s.createElement(t),fn(a,t,n),s.head.appendChild(a);break;case"meta":if(r=cy("meta","content",s).get(t+(n.content||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("content")===(n.content==null?null:""+n.content)&&a.getAttribute("name")===(n.name==null?null:n.name)&&a.getAttribute("property")===(n.property==null?null:n.property)&&a.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute("charset")===(n.charSet==null?null:n.charSet)){r.splice(f,1);break t}}a=s.createElement(t),fn(a,t,n),s.head.appendChild(a);break;default:throw Error(u(468,t))}a[zt]=e,xt(a),t=a}e.stateNode=t}else ln||df(r,e.type,e.stateNode);else e.stateNode=ry(r,n,e.memoizedProps);else s!==n?(s===null?(t=a.stateNode,t===null||vt||t.parentNode.removeChild(t)):s.count--,n===null?ln||df(r,e.type,e.stateNode):ry(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&pd(e,e.memoizedProps,a.memoizedProps);break;case 27:jn(t,e,n),Nn(e),s&512&&(vt||a===null||dn(a,a.return)),a!==null&&s&4&&pd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(r=za,za=!1,jn(t,e,n),za=r,Nn(e),s&512&&(vt||a===null||dn(a,a.return)),e.flags&32){t=e.stateNode;try{It(t,""),ut=!0}catch($){wt(e,e.return,$)}}s&4&&e.stateNode!=null&&(t=e.memoizedProps,pd(e,t,a!==null?a.memoizedProps:t)),s&1024&&(Ad=!0);break;case 6:if(jn(t,e,n),Nn(e),s&4){if(e.stateNode===null)throw Error(u(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,ut=!0}catch($){wt(e,e.return,$)}}break;case 3:if(ut=!1,rc=null,r=va,va=co(t.containerInfo),jn(t,e,n),va=r,Nn(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{hi(t.containerInfo)}catch($){wt(e,e.return,$)}Ad&&(Ad=!1,ag(e)),ut=!1;break;case 4:s=za,za=ln,a=Jo(),r=va,va=co(e.stateNode.containerInfo),jn(t,e,n),Nn(e),va=r,ut&&eo&&(Yr=!0),ut=a,za=s;break;case 12:jn(t,e,n),Nn(e);break;case 31:jn(t,e,n),Nn(e),s&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 13:jn(t,e,n),Nn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Fr=yt()),s&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 22:r=e.memoizedState!==null,f=a!==null&&a.memoizedState!==null;var p=ln,T=vt,R=za;ln=p||r,za=R||r,vt=T||f,jn(t,e,n),vt=T,za=R,ln=p,Nn(e),s&8192&&(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,!r||a===null||f||ln||vt||(t=f||vt,n=ln,a=vt,ln=r||ln,vt=t,Ml(e,2),ln=n,vt=a),!r&&za||kd(e,r)),s&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Qr(e,n))));break;case 19:jn(t,e,n),Nn(e),s&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 30:s&512&&(vt||a===null||dn(a,a.return)),s=Jo(),r=eo,f=(n&335544064)===n,p=e.memoizedProps,eo=f&&Fa(p.default,p.update)!=="none",jn(t,e,n),Nn(e),f&&a!==null&&ut&&(e.flags|=4),eo=r,ut=s;break;case 21:break;case 7:s&512&&(vt||a===null||dn(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:jn(t,e,n),Nn(e)}}function Nn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(qp(a)){n=a;break}a=a.return}a=null;for(var s=e.return;s!==null;){if(hd(s)){var r=s.stateNode;a===null?a=[r]:a.push(r)}if(fd(s))break;s=s.return}var f=a;if(n==null)throw Error(u(160));switch(n.tag){case 27:var p=n.stateNode,T=gd(e);qr(e,T,p,f);break;case 5:var R=n.stateNode;n.flags&32&&(It(R,""),n.flags&=-33);var $=gd(e);qr(e,$,R,f);break;case 3:case 4:var W=n.stateNode.containerInfo,M=gd(e);yd(e,M,W,f);break;default:throw Error(u(161))}}catch(I){wt(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ag(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ag(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,fi=!0,t.reset(),fi=!1),e=e.sibling}}function Zs(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)lg(t,e),t=t.sibling;else Kp(t)}function lg(e,t){var n=e.alternate;if(n===null)vd(e,!1);else switch(e.tag){case 3:if(Td=Ua=!1,Xp(),Zs(t,e),!Ua&&!Yr){if(e=Da,e!==null)for(var a=0;a<e.length;a+=3){n=e[a];var s=e[a+1];Yg(n,e[a+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+s+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Td=!0}Da=null;break;case 5:Zs(t,e);break;case 4:a=Ua,Ua=!1,Zs(t,e),Ua&&(Yr=!0),Ua=a;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?vd(e,!1):Zs(t,e));break;case 30:a=Ua,s=Xp(),Ua=!1,Zs(t,e),Ua&&(e.flags|=4);var r=e.memoizedProps,f=e.stateNode;t=Za(r,f),f=Za(n.memoizedProps,f);var p=Fa(r.default,r.update);p==="none"?t=!1:(r=n.memoizedState,n.memoizedState=null,n=e.child,On=0,t=wd(e,n,t,f,p,r,!0),On!==(r===null?0:r.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(ni(e,e.memoizedProps.onUpdate),Da=s):s!==null&&(s.push.apply(s,Da),Da=s),Ua=(e.flags&32)!==0?!0:a;break;default:Zs(t,e)}}function Ha(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Fp(e,t.alternate,t),t=t.sibling}function Ml(e,t){for(e=e.child;e!==null;){var n=e,a=t;switch(n.tag){case 0:case 11:case 14:case 15:Cl(4,n,n.return),Ml(n,a);break;case 1:dn(n,n.return);var s=n.stateNode;typeof s.componentWillUnmount=="function"&&Bp(n,n.return,s),Ml(n,a);break;case 27:(a&2)!==0&&ay(n.stateNode,n.type,n.memoizedProps);case 5:dn(n,n.return),n.tag!==5&&n.tag!==27||Wi(n),Ml(n,a);break;case 6:Wi(n);break;case 26:dn(n,n.return),s=n.stateNode,n.memoizedState!==null||s===null||vt||s.parentNode.removeChild(s),Ml(n,a);break;case 22:n.memoizedState===null&&Ml(n,a);break;case 30:dn(n,n.return),Ml(n,a);break;case 7:dn(n,n.return);default:Ml(n,a)}e=e.sibling}}function ba(e,t,n){for(n=(t.subtreeFlags&8772)!==0?n:n&-2,t=t.child;t!==null;){var a=t.alternate,s=e,r=t,f=r.flags,p=(n&1)!==0;switch(r.tag){case 0:case 11:case 15:ba(s,r,n),Ji(4,r);break;case 1:if(ba(s,r,n),a=r,s=a.stateNode,typeof s.componentDidMount=="function")try{s.componentDidMount()}catch($){wt(a,a.return,$)}if(a=r,s=a.updateQueue,s!==null){var T=a.stateNode;try{var R=s.shared.hiddenCallbacks;if(R!==null)for(s.shared.hiddenCallbacks=null,s=0;s<R.length;s++)jm(R[s],T)}catch($){wt(a,a.return,$)}}p&&f&64&&Hp(r),Oa(r,r.return);break;case 27:(n&2)!==0&&$p(r);case 5:r.tag!==5&&r.tag!==27||Ip(r),ba(s,r,n),p&&a===null&&f&4&&md(r),Oa(r,r.return);break;case 6:Ip(r);break;case 26:T=r.stateNode,r.memoizedState!==null||T===null||ln||df(co(T.ownerDocument),r.type,T),ba(s,r,n),p&&a===null&&f&4&&md(r),Oa(r,r.return);break;case 12:ba(s,r,n);break;case 31:ba(s,r,n),p&&f&4&&eg(s,r);break;case 13:ba(s,r,n),p&&f&4&&tg(s,r);break;case 22:r.memoizedState===null&&ba(s,r,n),Oa(r,r.return);break;case 30:ba(s,r,n),Oa(r,r.return);break;case 7:Oa(r,r.return);default:ba(s,r,n)}t=t.sibling}}function Nd(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Bi(n))}function Ed(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Bi(e))}function ra(e,t,n,a){var s=(n&335544064)===n;if(t.subtreeFlags&(s?10262:10256))for(t=t.child;t!==null;)sg(e,t,n,a),t=t.sibling;else s&&Qp(t)}function sg(e,t,n,a){var s=(n&335544064)===n;s&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Xr(t);var r=t.flags;switch(t.tag){case 0:case 11:case 15:ra(e,t,n,a),r&2048&&Ji(9,t);break;case 1:ra(e,t,n,a);break;case 3:ra(e,t,n,a),s&&Td&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),r&2048&&(r=null,t.alternate!==null&&(r=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==r&&(t.refCount++,r!=null&&Bi(r)));break;case 12:if(r&2048){ra(e,t,n,a),r=t.stateNode;try{var f=t.memoizedProps,p=f.id,T=f.onPostCommit;typeof T=="function"&&T(p,t.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(R){wt(t,t.return,R)}}else ra(e,t,n,a);break;case 31:ra(e,t,n,a);break;case 13:ra(e,t,n,a);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?(s&&p!==null&&p.memoizedState===null&&Xr(p),f._visibility&2?ra(e,t,n,a):to(e,t)):(s&&p!==null&&p.memoizedState!==null&&Xr(t),f._visibility&2?ra(e,t,n,a):(f._visibility|=2,Fs(e,t,n,a,(t.subtreeFlags&10256)!==0||!1))),r&2048&&Nd(p,t);break;case 24:ra(e,t,n,a),r&2048&&Ed(t.alternate,t);break;case 30:s&&(r=t.alternate,r!==null&&(La(r.child,!0),La(t.child,!0))),ra(e,t,n,a);break;default:ra(e,t,n,a)}}function Fs(e,t,n,a,s){for(s=s&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,f=t,p=n,T=a,R=f.flags;switch(f.tag){case 0:case 11:case 15:Fs(r,f,p,T,s),Ji(8,f);break;case 23:break;case 22:var $=f.stateNode;f.memoizedState!==null?$._visibility&2?Fs(r,f,p,T,s):to(r,f):($._visibility|=2,Fs(r,f,p,T,s)),s&&R&2048&&Nd(f.alternate,f);break;case 24:Fs(r,f,p,T,s),s&&R&2048&&Ed(f.alternate,f);break;default:Fs(r,f,p,T,s)}t=t.sibling}}function to(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,s=a.flags;switch(a.tag){case 22:to(n,a),s&2048&&Nd(a.alternate,a);break;case 24:to(n,a),s&2048&&Ed(a.alternate,a);break;default:to(n,a)}t=t.sibling}}var ms=8192;function ps(e,t,n){if(e.subtreeFlags&ms)for(e=e.child;e!==null;)ig(e,t,n),e=e.sibling}function ig(e,t,n){switch(e.tag){case 26:ps(e,t,n),e.flags&ms&&(e.memoizedState!==null?eS(n,va,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&hy(n,e)));break;case 5:ps(e,t,n),e.flags&ms&&(e=e.stateNode,(t&335544128)===t&&hy(n,e));break;case 3:case 4:var a=va;va=co(e.stateNode.containerInfo),ps(e,t,n),va=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=ms,ms=16777216,ps(e,t,n),ms=a):ps(e,t,n));break;case 30:if((e.flags&ms)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var s=e.stateNode;s.paired=null,Yn===null&&(Yn=new Map),Yn.set(a,s)}ps(e,t,n);break;default:ps(e,t,n)}}function og(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function no(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,cg(a,e)}og(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)rg(e),e=e.sibling}function rg(e){switch(e.tag){case 0:case 11:case 15:no(e),e.flags&2048&&Cl(9,e,e.return);break;case 3:no(e);break;case 12:no(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kr(e)):no(e);break;default:no(e)}}function Kr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,cg(a,e)}og(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cl(8,t,t.return),Kr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kr(t));break;default:Kr(t)}e=e.sibling}}function cg(e,t){for(;sn!==null;){var n=sn;switch(n.tag){case 0:case 11:case 15:Cl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Bi(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,sn=a;else e:for(n=e;sn!==null;){a=sn;var s=a.sibling,r=a.return;if(Jp(a),a===n){sn=null;break e}if(s!==null){s.return=r,sn=s;break e}sn=r}}}var Zb={getCacheForType:function(e){var t=rn(Kt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rn(Kt).controller.signal}},Fb=typeof WeakMap=="function"?WeakMap:Map,gt=0,Mt=null,st=null,ot=0,St=0,Vn=null,_l=!1,Ps=!1,Cd=!1,sl=0,$t=0,Rl=0,gs=0,Zr=0,Qn=0,Js=0,ao=null,Ln=null,Md=!1,Fr=0,ug=0,Pr=1/0,Jr=null,Ol=null,Ht=0,xa=null,ys=null,Ba=0,_d=0,Rd=null,dg=null,Ws=null,ei=null,ti=null,lo=0,Wr=null;function Kn(){return(gt&2)!==0&&ot!==0?ot&-ot:Se.T!==null?$d():ml()}function fg(){if(Qn===0)if((ot&536870912)===0||tt){var e=ha;ha<<=1,(ha&3932160)===0&&(ha=262144),Qn=e}else Qn=536870912;return e=cn.current,e!==null&&(e.flags|=32),Qn}function ni(e,t){if(t!=null){var n=e.stateNode,a=n.ref;a===null&&(a=n.ref=Vg(Za(e.memoizedProps,n))),ei===null&&(ei=[]),ei.push(t.bind(null,a))}}function zn(e,t,n){(e===Mt&&(St===2||St===9)||e.cancelPendingCommit!==null)&&(ai(e,0),Dl(e,ot,Qn,!1)),lt(e,n),((gt&2)===0||e!==Mt)&&(e===Mt&&((gt&2)===0&&(gs|=n),$t===4&&Dl(e,ot,Qn,!1)),Ia(e))}function hg(e,t,n){if((gt&6)!==0)throw Error(u(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||xe(e,t),s=a?Wb(e,t):Dd(e,t,!0),r=a;do{if(s===0){Ps&&!a&&Dl(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!Pb(n)){s=Dd(e,t,!1),r=!1;continue}if(s===2){if(r=t,e.errorRecoveryDisabledLanes&r)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;s=ao;var T=p.current.memoizedState.isDehydrated;if(T&&(ai(p,f).flags|=256),f=Dd(p,f,!1),f!==2&&f!==6){if(Cd&&!T){p.errorRecoveryDisabledLanes|=r,gs|=r,s=4;break e}r=Ln,Ln=s,r!==null&&(Ln===null?Ln=r:Ln.push.apply(Ln,r))}s=f}if(r=!1,s!==2)continue}}if(s===1){ai(e,0),Dl(e,t,0,!0);break}e:{switch(a=e,r=s,r){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Dl(a,t,Qn,!_l);break e;case 2:Ln=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(s=Fr+300-yt(),10<s)){if(Dl(a,t,Qn,!_l),ge(a,0,!0)!==0)break e;Ba=t,a.timeoutHandle=Wd(mg.bind(null,a,n,Ln,Jr,Md,t,Qn,gs,Js,_l,r,"Throttled",-0,0),s);break e}mg(a,n,Ln,Jr,Md,t,Qn,gs,Js,_l,r,null,-0,0)}}break}while(!0);Ia(e)}function mg(e,t,n,a,s,r,f,p,T,R,$,W,M,I){e.timeoutHandle=-1;var ye=t.subtreeFlags,Me=(r&335544064)===r;if(W=null,(Me||ye&8192||(ye&16785408)===16785408)&&(W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ma},Yn=null,ig(t,r,W),Me&&(ye=W,Me=e.containerInfo,Me=(Me.nodeType===9?Me:Me.ownerDocument).__reactViewTransition,Me!=null&&(ye.count++,ye.waitingForViewTransition=!0,ye=ho.bind(ye),Me.finished.then(ye,ye))),ye=(r&62914560)===r?Fr-yt():(r&4194048)===r?ug-yt():0,ye=tS(W,ye),ye!==null)){Ba=r,e.cancelPendingCommit=ye(wg.bind(null,e,t,r,n,a,s,f,p,T,R,$,W,null,M,I)),Dl(e,r,f,!R);return}wg(e,t,r,n,a,s,f,p,T,R,$,W)}function Pb(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var s=n[a],r=s.getSnapshot;s=s.value;try{if(!Gn(r(),s))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Dl(e,t,n,a){t=et(e,t),t&=~Zr,t&=~gs,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var s=t;0<s;){var r=31-jt(s),f=1<<r;a[r]=-1,s&=~f}n!==0&&In(e,n,t)}function ec(){return(gt&6)===0?(so(0),!1):!0}function Od(){if(st!==null){if(St===0)var e=st.return;else e=st,Wa=ls=null,qu(e),Gs=null,$i=0,e=st;for(;e!==null;)Up(e.alternate,e),e=e.return;st=null}}function ai(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Sx(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ba=0,Od(),Mt=e,st=n=Pa(e.current,null),ot=t,St=0,Vn=null,_l=!1,Ps=xe(e,t),Cd=!1,Js=Qn=Zr=gs=Rl=$t=0,Ln=ao=null,Md=!1,sl=et(e,t),rr(),n}function pg(e,t){Pe=null,Se.H=Or,t===$s||t===br?(t=wm(),St=3):t===Eu?(t=wm(),St=4):St=t===nd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vn=t,st===null&&($t=1,Dr(e,la(t,e.current)))}function gg(){var e=cn.current;return e===null?!0:(ot&4194048)===ot?xn===null:(ot&62914560)===ot||(ot&536870912)!==0?e===xn:!1}function yg(){var e=Se.H;return Se.H=Or,e===null?Or:e}function vg(){var e=Se.A;return Se.A=Zb,e}function tc(){$t=4,_l||(ot&4194048)!==ot&&cn.current!==null||(Ps=!0),(Rl&134217727)===0&&(gs&134217727)===0||Mt===null||Dl(Mt,ot,Qn,!1)}function Dd(e,t,n){var a=gt;gt|=2;var s=yg(),r=vg();(Mt!==e||ot!==t)&&(Jr=null,ai(e,t)),t=!1;var f=$t;e:do try{if(St!==0&&st!==null){var p=st,T=Vn;switch(St){case 8:Od(),f=6;break e;case 3:case 2:case 9:case 6:cn.current===null&&(t=!0);var R=St;if(St=0,Vn=null,li(e,p,T,R),n&&Ps){f=0;break e}break;default:R=St,St=0,Vn=null,li(e,p,T,R)}}Jb(),f=$t;break}catch($){pg(e,$)}while(!0);return t&&e.shellSuspendCounter++,Wa=ls=null,gt=a,Se.H=s,Se.A=r,st===null&&(Mt=null,ot=0,rr()),f}function Jb(){for(;st!==null;)bg(st)}function Wb(e,t){var n=gt;gt|=2;var a=yg(),s=vg();Mt!==e||ot!==t?(Jr=null,Pr=yt()+500,ai(e,t)):Ps=xe(e,t);e:do try{if(St!==0&&st!==null){t=st;var r=Vn;t:switch(St){case 1:St=0,Vn=null,li(e,t,r,1);break;case 2:case 9:if(xm(r)){St=0,Vn=null,xg(t);break}t=function(){St!==2&&St!==9||Mt!==e||(St=7),Ia(e)},r.then(t,t);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:xm(r)?(St=0,Vn=null,xg(t)):(St=0,Vn=null,li(e,t,r,7));break;case 5:var f=null;switch(st.tag){case 26:f=st.memoizedState;case 5:case 27:var p=st;if(f?dy(f):p.stateNode.complete){St=0,Vn=null;var T=p.sibling;if(T!==null)st=T;else{var R=p.return;R!==null?(st=R,nc(R)):st=null}break t}}St=0,Vn=null,li(e,t,r,5);break;case 6:St=0,Vn=null,li(e,t,r,6);break;case 8:Od(),$t=6;break e;default:throw Error(u(462))}}ex();break}catch($){pg(e,$)}while(!0);return Wa=ls=null,Se.H=a,Se.A=s,gt=n,st!==null?0:(Mt=null,ot=0,rr(),$t)}function ex(){for(;st!==null&&!An();)bg(st)}function bg(e){var t=Lp(e.alternate,e,sl);e.memoizedProps=e.pendingProps,t===null?nc(e):st=t}function xg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ep(n,t,t.pendingProps,t.type,void 0,ot);break;case 11:t=Ep(n,t,t.pendingProps,t.type.render,t.ref,ot);break;case 5:qu(t);var a=t;a===an&&(tt?(mr(a),a.tag===5&&a.stateNode!=null&&(_t=a.stateNode)):(mr(a),tt=!0));default:Up(n,t),t=st=cm(t,sl),t=Lp(n,t,sl)}e.memoizedProps=e.pendingProps,t===null?nc(e):st=t}function li(e,t,n,a){Wa=ls=null,qu(t),Gs=null,$i=0;var s=t.return;try{if(qb(e,s,t,n,ot)){$t=1,Dr(e,la(n,e.current)),st=null;return}}catch(r){if(s!==null)throw st=s,r;$t=1,Dr(e,la(n,e.current)),st=null;return}t.flags&32768?(tt||a===1?e=!0:Ps||(ot&536870912)!==0?e=!1:(_l=e=!0,(a===2||a===9||a===3||a===6)&&(a=cn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Sg(t,e)):nc(t)}function nc(e){var t=e;do{if((t.flags&32768)!==0){Sg(t,_l);return}e=t.return;var n=Yb(t.alternate,t,sl);if(n!==null){st=n;return}if(t=t.sibling,t!==null){st=t;return}st=t=e}while(t!==null);$t===0&&($t=5)}function Sg(e,t){do{var n=Vb(e.alternate,e);if(n!==null){n.flags&=32767,st=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){st=e;return}st=e=n}while(e!==null);$t=6,st=null}function wg(e,t,n,a,s,r,f,p,T,R,$,W){e.cancelPendingCommit=null;do ac();while(Ht!==0);if((gt&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));e===Mt&&(st=Mt=null,ot=0),ys=t,xa=e,Ba=n,Rd=s,dg=a,tx(e,t,n,f,p,T,W)}}function tx(e,t,n,a,s,r,f){var p=t.lanes|t.childLanes;if(_d=p,p|=pu,Bt(e,n,p,a,s,r),ei=null,(n&335544064)===n?(ti=Cb(e),a=10262):(ti=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,ox(Cn,function(){return Hd(),null})):(e.callbackNode=null,e.callbackPriority=0),$r=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=Se.T,Se.T=null,s=_e.p,_e.p=2,r=gt,gt|=4;try{Qb(e,t,n)}finally{gt=r,_e.p=s,Se.T=a}}Ht=1,$r?Ws=Nx(f,e.containerInfo,ti,Ld,zd,ax,Ud,Hd,nx):(Ld(),zd(),Ud())}function nx(e){if(Ht!==0){var t=xa.onRecoverableError;t(e,{componentStack:null})}}function ax(){Ht===3&&(Ht=0,lg(ys,xa),Ht=4)}function Ld(){if(Ht===1){Ht=0;var e=xa,t=ys,n=Ba,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=Se.T,Se.T=null;var s=_e.p;_e.p=2;var r=gt;gt|=4;try{eo=Yr=!1,ng(t,e,n),n=Fd;var f=Wh(e.containerInfo),p=n.focusedElem,T=n.selectionRange;if(f!==p&&p&&p.ownerDocument&&Jh(p.ownerDocument.documentElement,p)){if(T!==null&&uu(p)){var R=T.start,$=T.end;if($===void 0&&($=R),"selectionStart"in p)p.selectionStart=R,p.selectionEnd=Math.min($,p.value.length);else{var W=p.ownerDocument||document,M=W&&W.defaultView||window;if(M.getSelection){var I=M.getSelection(),ye=p.textContent.length,Me=Math.min(T.start,ye),Je=T.end===void 0?Me:Math.min(T.end,ye);!I.extend&&Me>Je&&(f=Je,Je=Me,Me=f);var _=Ph(p,Me),C=Ph(p,Je);if(_&&C&&(I.rangeCount!==1||I.anchorNode!==_.node||I.anchorOffset!==_.offset||I.focusNode!==C.node||I.focusOffset!==C.offset)){var U=W.createRange();U.setStart(_.node,_.offset),I.removeAllRanges(),Me>Je?(I.addRange(U),I.extend(C.node,C.offset)):(U.setEnd(C.node,C.offset),I.addRange(U))}}}}for(W=[],I=p;I=I.parentNode;)I.nodeType===1&&W.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<W.length;p++){var J=W[p];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}fi=!!Zd,Fd=Zd=null}finally{gt=r,_e.p=s,Se.T=a}}e.current=t,Ht=2}}function zd(){if(Ht===2){Ht=0;var e=xa,t=ys,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=Se.T,Se.T=null;var a=_e.p;_e.p=2;var s=gt;gt|=4;try{Fp(e,t.alternate,t)}finally{gt=s,_e.p=a,Se.T=n}}Ht=3}}function Ud(){if(Ht===4||Ht===3){Ht=0;var e=Ws;Ws=null,nn();var t=xa,n=ys,a=Ba,s=dg,r=(a&335544064)===a?10262:10256;if((n.subtreeFlags&r)!==0||(n.flags&r)!==0?Ht=5:(Ht=0,ys=xa=null,Ag(t,t.pendingLanes)),r=t.pendingLanes,r===0&&(Ol=null),Ea(a),n=n.stateNode,Qe&&typeof Qe.onCommitFiberRoot=="function")try{Qe.onCommitFiberRoot(Ye,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=Se.T,r=_e.p,_e.p=2,Se.T=null;try{for(var f=t.onRecoverableError,p=0;p<s.length;p++){var T=s[p];f(T.value,{componentStack:T.stack})}}finally{Se.T=n,_e.p=r}}if(s=ei,f=ti,ti=null,s!==null&&(ei=null,f===null&&(f=[]),e!==null))for(T=0;T<s.length;T++)n=(0,s[T])(f),n!==void 0&&e.finished.finally(n);(Ba&3)!==0&&ac(),Ia(t),r=t.pendingLanes,(a&261930)!==0&&(r&42)!==0?t===Wr?lo++:(lo=0,Wr=t):(lo=0,Wr=null),so(0)}}function Ag(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Bi(t)))}function ac(){return Ws!==null&&(Ws.skipTransition(),Ws=null),Ld(),zd(),Ud(),Hd()}function Hd(){if(Ht!==5)return!1;var e=xa,t=_d;_d=0;var n=Ea(Ba),a=Se.T,s=_e.p;try{_e.p=32>n?32:n,Se.T=null,n=Rd,Rd=null;var r=xa,f=Ba;if(Ht=0,ys=xa=null,Ba=0,(gt&6)!==0)throw Error(u(331));var p=gt;if(gt|=4,rg(r.current),sg(r,r.current,f,n),gt=p,so(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot=="function")try{Qe.onPostCommitFiberRoot(Ye,r)}catch{}return!0}finally{_e.p=s,Se.T=a,Ag(e,t)}}function Tg(e,t,n){t=la(n,t),t=td(e.stateNode,t,2),e=kl(e,t,2),e!==null&&(lt(e,2),Ia(e))}function wt(e,t,n){if(e.tag===3)Tg(e,e,n);else for(;t!==null;){if(t.tag===3){Tg(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ol===null||!Ol.has(a))){e=la(n,e),n=xp(2),a=kl(t,n,2),a!==null&&(Sp(n,a,t,e),lt(a,2),Ia(a));break}}t=t.return}}function Bd(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Fb;var s=new Set;a.set(t,s)}else s=a.get(t),s===void 0&&(s=new Set,a.set(t,s));s.has(n)||(Cd=!0,s.add(n),e=lx.bind(null,e,t,n),t.then(e,e))}function lx(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Mt===e&&(ot&n)===n&&(($t===4||$t===3&&(ot&62914560)===ot&&300>yt()-Fr)&&(gt&2)===0?ai(e,0):Zr|=n,Js===ot&&(Js=0)),Ia(e)}function kg(e,t){t===0&&(t=at()),e=ts(e,t),e!==null&&(lt(e,t),Ia(e))}function sx(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),kg(e,n)}function ix(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(u(314))}a!==null&&a.delete(t),kg(e,n)}function ox(e,t){return Bn(e,t)}var si=null,ii=null,Id=!1,lc=!1,qd=!1,Ll=0;function Ia(e){e!==ii&&e.next===null&&(ii===null?si=ii=e:ii=ii.next=e),lc=!0,Id||(Id=!0,cx())}function so(e,t){if(!qd&&lc){qd=!0;do for(var n=!1,a=si;a!==null;){if(e!==0){var s=a.pendingLanes;if(s===0)var r=0;else{var f=a.suspendedLanes,p=a.pingedLanes;r=(1<<31-jt(42|e)+1)-1,r&=s&~(f&~p),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,Cg(a,r))}else r=ot,r=ge(a,a===Mt?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(r&3)===0||xe(a,r)||(n=!0,Cg(a,r));a=a.next}while(n);qd=!1}}function rx(){jg()}function jg(){lc=Id=!1;var e=0;Ll!==0&&xx()&&(e=Ll);for(var t=yt(),n=null,a=si;a!==null;){var s=a.next,r=Ng(a,t);r===0?(a.next=null,n===null?si=s:n.next=s,s===null&&(ii=n)):(n=a,(e!==0||(r&3)!==0)&&(lc=!0)),a=s}Ht!==0&&Ht!==5||so(e),Ll!==0&&(Ll=0)}function Ng(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,s=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var f=31-jt(r),p=1<<f,T=s[f];T===-1?((p&n)===0||(p&a)!==0)&&(s[f]=ct(p,t)):T<=t&&(e.expiredLanes|=p),r&=~p}if(t=Mt,n=ot,n=ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(St===2||St===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&ka(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&ka(a),Ea(n)){case 2:case 8:n=vn;break;case 32:n=Cn;break;case 268435456:n=ue;break;default:n=Cn}return a=Eg.bind(null,e),n=Bn(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&ka(a),e.callbackPriority=2,e.callbackNode=null,2}function Eg(e,t){if(Ht!==0&&Ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ac()&&e.callbackNode!==n)return null;var a=ot;return a=ge(e,e===Mt?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(hg(e,a,t),Ng(e,yt()),e.callbackNode!=null&&e.callbackNode===n?Eg.bind(null,e):null)}function Cg(e,t){if(ac())return null;hg(e,t,!0)}function cx(){wx(function(){(gt&6)!==0?Bn(yn,rx):jg()})}function $d(){if(Ll===0){var e=os;e===0&&(e=ja,ja<<=1,(ja&261888)===0&&(ja=256)),Ll=e}return Ll}function Mg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:er(e)}function ux(e,t,n,a,s){if(t==="submit"&&n&&n.stateNode===s){var r=Mg((s[Ut]||null).action),f=a.submitter;f&&(t=(t=f[Ut]||null)?Mg(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new lr("action","action",null,a,s);e.push({event:p,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Ll!==0){var T=new FormData(s,f);Fu(n,{pending:!0,data:T,method:s.method,action:r},null,T)}}else typeof r=="function"&&(p.preventDefault(),T=new FormData(s,f),Fu(n,{pending:!0,data:T,method:s.method,action:r},r,T))},currentTarget:s}]})}}for(var Gd=0;Gd<mu.length;Gd++){var Xd=mu[Gd],dx=Xd.toLowerCase(),fx=Xd[0].toUpperCase()+Xd.slice(1);ga(dx,"on"+fx)}ga(nm,"onAnimationEnd"),ga(am,"onAnimationIteration"),ga(lm,"onAnimationStart"),ga("dblclick","onDoubleClick"),ga("focusin","onFocus"),ga("focusout","onBlur"),ga(Sb,"onTransitionRun"),ga(wb,"onTransitionStart"),ga(Ab,"onTransitionCancel"),ga(sm,"onTransitionEnd"),qn("onMouseEnter",["mouseout","mouseover"]),qn("onMouseLeave",["mouseout","mouseover"]),qn("onPointerEnter",["pointerout","pointerover"]),qn("onPointerLeave",["pointerout","pointerover"]),Ca("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ca("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ca("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ca("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ca("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ca("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="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(" "),hx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(io));function _g(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],s=a.event;a=a.listeners;e:{var r=void 0;if(t)for(var f=a.length-1;0<=f;f--){var p=a[f],T=p.instance,R=p.currentTarget;if(p=p.listener,T!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=R;try{r(s)}catch($){or($)}s.currentTarget=null,r=T}else for(f=0;f<a.length;f++){if(p=a[f],T=p.instance,R=p.currentTarget,p=p.listener,T!==r&&s.isPropagationStopped())break e;r=p,s.currentTarget=R;try{r(s)}catch($){or($)}s.currentTarget=null,r=T}}}}function it(e,t){var n=t[Xo];n===void 0&&(n=t[Xo]=new Set);var a=e+"__bubble";n.has(a)||(Rg(t,e,2,!1),n.add(a))}function Yd(e,t,n){var a=0;t&&(a|=4),Rg(n,e,a,t)}var sc="_reactListening"+Math.random().toString(36).slice(2);function Vd(e){if(!e[sc]){e[sc]=!0,Pl.forEach(function(n){n!=="selectionchange"&&(hx.has(n)||Yd(n,!1,e),Yd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[sc]||(t[sc]=!0,Yd("selectionchange",!1,t))}}function Rg(e,t,n,a){switch(Sy(t)){case 2:var s=sS;break;case 8:s=iS;break;default:s=hf}n=s.bind(null,t,n,e),s=void 0,!eu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),a?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Qd(e,t,n,a,s){var r=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var f=a.tag;if(f===3||f===4){var p=a.stateNode.containerInfo;if(p===s)break;if(f===4)for(f=a.return;f!==null;){var T=f.tag;if((T===3||T===4)&&f.stateNode.containerInfo===s)return;f=f.return}for(;p!==null;){if(f=ma(p),f===null)return;if(T=f.tag,T===5||T===6||T===26||T===27){a=r=f;continue e}p=p.parentNode}}a=a.return}Rh(function(){var R=r,$=Jc(n),W=[];e:{var M=im.get(e);if(M!==void 0){var I=lr,ye=e;switch(e){case"keypress":if(nr(n)===0)break e;case"keydown":case"keyup":I=P0;break;case"focusin":ye="focus",I=lu;break;case"focusout":ye="blur",I=lu;break;case"beforeblur":case"afterblur":I=lu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":I=Lh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=B0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=nb;break;case nm:case am:case lm:I=$0;break;case sm:I=lb;break;case"scroll":case"scrollend":I=U0;break;case"wheel":I=ib;break;case"copy":case"cut":case"paste":I=X0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=Uh;break;case"submit":I=eb;break;case"toggle":case"beforetoggle":I=rb}var Me=(t&4)!==0,Je=!Me&&(e==="scroll"||e==="scrollend"),_=Me?M!==null?M+"Capture":null:M;Me=[];for(var C=R,U;C!==null;){var J=C;if(U=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||U===null||_===null||(J=Ei(C,_),J!=null&&Me.push(oo(C,J,U))),Je)break;C=C.return}0<Me.length&&(M=new I(M,ye,null,n,$),W.push({event:M,listeners:Me}))}}if((t&7)===0){e:{if(I=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",I&&n!==Pc&&(ye=n.relatedTarget||n.fromElement)&&(ma(ye)||ye[_n]))break e;(M||I)&&(ye=$.window===$?$:(I=$.ownerDocument)?I.defaultView||I.parentWindow:window,M?(I=n.relatedTarget||n.toElement,M=R,I=I?ma(I):null,I!==null&&(Je=h(I),Me=I.tag,I!==Je||Me!==5&&Me!==27&&Me!==6)&&(I=null)):(M=null,I=R),M!==I&&(Me=Lh,J="onMouseLeave",_="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(Me=Uh,J="onPointerLeave",_="onPointerEnter",C="pointer"),Je=M==null?ye:ta(M),U=I==null?ye:ta(I),ye=new Me(J,C+"leave",M,n,$),ye.target=Je,ye.relatedTarget=U,J=null,ma($)===R&&(Me=new Me(_,C+"enter",I,n,$),Me.target=U,Me.relatedTarget=Je,J=Me),Je=J,Me=M&&I?H(M,I,mx):null,M!==null&&Og(W,ye,M,Me,!1),I!==null&&Je!==null&&Og(W,Je,I,Me,!0)))}e:{if(M=R?ta(R):window,I=M.nodeName&&M.nodeName.toLowerCase(),I==="select"||I==="input"&&M.type==="file")var Ne=Yh;else if(Gh(M))if(Vh)Ne=vb;else{Ne=gb;var rt=pb}else I=M.nodeName,!I||I.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?R&&Fc(R.elementType)&&(Ne=Yh):Ne=yb;if(Ne&&(Ne=Ne(e,R))){Xh(W,Ne,n,$);break e}rt&&rt(e,M,R)}switch(rt=R?ta(R):window,e){case"focusin":(Gh(rt)||rt.contentEditable==="true")&&(Ds=rt,du=R,zi=null);break;case"focusout":zi=du=Ds=null;break;case"mousedown":fu=!0;break;case"contextmenu":case"mouseup":case"dragend":fu=!1,em(W,n,$);break;case"selectionchange":if(xb)break;case"keydown":case"keyup":em(W,n,$)}var Le;if(iu)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Os?qh(e,n)&&(Xe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Xe="onCompositionStart");Xe&&(Hh&&n.locale!=="ko"&&(Os||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Os&&(Le=Oh()):(gl=$,tu="value"in gl?gl.value:gl.textContent,Os=!0)),rt=ic(R,Xe),0<rt.length&&(Xe=new zh(Xe,e,null,n,$),W.push({event:Xe,listeners:rt}),Le?Xe.data=Le:(Le=$h(n),Le!==null&&(Xe.data=Le)))),(Le=ub?db(e,n):fb(e,n))&&(Xe=ic(R,"onBeforeInput"),0<Xe.length&&(rt=new zh("onBeforeInput","beforeinput",null,n,$),W.push({event:rt,listeners:Xe}),rt.data=Le)),ux(W,e,R,n,$)}_g(W,t)})}function oo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ic(e,t){for(var n=t+"Capture",a=[];e!==null;){var s=e,r=s.stateNode;if(s=s.tag,s!==5&&s!==26&&s!==27||r===null||(s=Ei(e,n),s!=null&&a.unshift(oo(e,s,r)),s=Ei(e,t),s!=null&&a.push(oo(e,s,r))),e.tag===3)return a;e=e.return}return[]}function mx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Og(e,t,n,a,s){for(var r=t._reactName,f=[];n!==null&&n!==a;){var p=n,T=p.alternate,R=p.stateNode;if(p=p.tag,T!==null&&T===a)break;p!==5&&p!==26&&p!==27||R===null||(T=R,s?(R=Ei(n,r),R!=null&&f.unshift(oo(n,R,T))):s||(R=Ei(n,r),R!=null&&f.push(oo(n,R,T)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var px=/\r\n?/g,gx=/\u0000|\uFFFD/g;function Dg(e){return(typeof e=="string"?e:""+e).replace(px,`
49
- `).replace(gx,"")}function Lg(e,t){return t=Dg(t),Dg(e)===t}function At(e,t,n,a,s,r){switch(n){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||It(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&It(e,""+a);else return;break;case"className":Va(e,"class",a);break;case"tabIndex":Va(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Va(e,n,a);break;case"style":Mh(e,a,r);return;case"data":if(t!=="object"){Va(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=er(a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(n==="formAction"?(t!=="input"&&At(e,t,"name",s.name,s,null),At(e,t,"formEncType",s.formEncType,s,null),At(e,t,"formMethod",s.formMethod,s,null),At(e,t,"formTarget",s.formTarget,s,null)):(At(e,t,"encType",s.encType,s,null),At(e,t,"method",s.method,s,null),At(e,t,"target",s.target,s,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=er(a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Ma);return;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(s.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=er(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":it("beforetoggle",e),it("toggle",e),Jl(e,"popover",a);break;case"xlinkActuate":$n(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":$n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":$n(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":$n(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":$n(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":$n(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":$n(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":$n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":$n(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Jl(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=L0.get(n)||n,Jl(e,n,a);else return}ut=!0}function Kd(e,t,n,a,s,r){switch(n){case"style":Mh(e,a,r);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(s.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof a=="string")It(e,a);else if(typeof a=="number"||typeof a=="bigint")It(e,""+a);else return;break;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"onClick":a!=null&&(e.onclick=Ma);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Ko.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(s=n.endsWith("Capture"),r=n.slice(2,s?n.length-7:void 0),t=e[Ut]||null,t=t!=null?t[n]:null,typeof t=="function"&&e.removeEventListener(r,t,s),typeof a=="function")){typeof t!="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(r,a,s);break e}ut=!0,n in e?e[n]=a:a===!0?e.setAttribute(n,""):Jl(e,n,a)}return}ut=!0}function fn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",e),it("load",e);var a=!1,s=!1,r;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"src":a=!0;break;case"srcSet":s=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:At(e,t,r,f,n,null)}}s&&At(e,t,"srcSet",n.srcSet,n,null),a&&At(e,t,"src",n.src,n,null);return;case"input":it("invalid",e);var p=r=f=s=null,T=null,R=null;for(a in n)if(n.hasOwnProperty(a)){var $=n[a];if($!=null)switch(a){case"name":s=$;break;case"type":f=$;break;case"checked":T=$;break;case"defaultChecked":R=$;break;case"value":r=$;break;case"defaultValue":p=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(u(137,t));break;default:At(e,t,a,$,n,null)}}Ot(e,r,p,T,R,f,s,!1);return;case"select":it("invalid",e),a=f=r=null;for(s in n)if(n.hasOwnProperty(s)&&(p=n[s],p!=null))switch(s){case"value":r=p;break;case"defaultValue":f=p;break;case"multiple":a=p;default:At(e,t,s,p,n,null)}t=r,n=f,e.multiple=!!a,t!=null?Qt(e,!!a,t,!1):n!=null&&Qt(e,!!a,n,!0);return;case"textarea":it("invalid",e),r=s=a=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":a=p;break;case"defaultValue":s=p;break;case"children":r=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(u(91));break;default:At(e,t,f,p,n,null)}Ms(e,a,s,r);return;case"option":for(T in n)if(n.hasOwnProperty(T)&&(a=n[T],a!=null))switch(T){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:At(e,t,T,a,n,null)}return;case"dialog":it("beforetoggle",e),it("toggle",e),it("cancel",e),it("close",e);break;case"iframe":case"object":it("load",e);break;case"video":case"audio":for(a=0;a<io.length;a++)it(io[a],e);break;case"image":it("error",e),it("load",e);break;case"details":it("toggle",e);break;case"embed":case"source":case"link":it("error",e),it("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(R in n)if(n.hasOwnProperty(R)&&(a=n[R],a!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:At(e,t,R,a,n,null)}return;default:if(Fc(t)){for($ in n)n.hasOwnProperty($)&&(a=n[$],a!==void 0&&Kd(e,t,$,a,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(a=n[p],a!=null&&At(e,t,p,a,n,null))}var yx={};function vx(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var s=null,r=null,f=null,p=null,T=null,R=null,$=null;for(I in n){var W=n[I];if(n.hasOwnProperty(I)&&W!=null)switch(I){case"checked":break;case"value":break;case"defaultValue":T=W;default:a.hasOwnProperty(I)||At(e,t,I,null,a,W)}}for(var M in a){var I=a[M];if(W=n[M],a.hasOwnProperty(M)&&(I!=null||W!=null))switch(M){case"type":I!==W&&(ut=!0),r=I;break;case"name":I!==W&&(ut=!0),s=I;break;case"checked":I!==W&&(ut=!0),R=I;break;case"defaultChecked":I!==W&&(ut=!0),$=I;break;case"value":I!==W&&(ut=!0),f=I;break;case"defaultValue":I!==W&&(ut=!0),p=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(u(137,t));break;default:I!==W&&At(e,t,M,I,a,W)}}nt(e,f,p,T,R,$,r,s);return;case"select":I=f=p=M=null;for(r in n)if(T=n[r],n.hasOwnProperty(r)&&T!=null)switch(r){case"value":break;case"multiple":I=T;default:a.hasOwnProperty(r)||At(e,t,r,null,a,T)}for(s in a)if(r=a[s],T=n[s],a.hasOwnProperty(s)&&(r!=null||T!=null))switch(s){case"value":r!==T&&(ut=!0),M=r;break;case"defaultValue":r!==T&&(ut=!0),p=r;break;case"multiple":r!==T&&(ut=!0),f=r;default:r!==T&&At(e,t,s,r,a,T)}t=p,n=f,a=I,M!=null?Qt(e,!!n,M,!1):!!a!=!!n&&(t!=null?Qt(e,!!n,t,!0):Qt(e,!!n,n?[]:"",!1));return;case"textarea":I=M=null;for(p in n)if(s=n[p],n.hasOwnProperty(p)&&s!=null&&!a.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:At(e,t,p,null,a,s)}for(f in a)if(s=a[f],r=n[f],a.hasOwnProperty(f)&&(s!=null||r!=null))switch(f){case"value":s!==r&&(ut=!0),M=s;break;case"defaultValue":s!==r&&(ut=!0),I=s;break;case"children":break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(u(91));break;default:s!==r&&At(e,t,f,s,a,r)}Qa(e,M,I);return;case"option":for(var ye in n)if(M=n[ye],n.hasOwnProperty(ye)&&M!=null&&!a.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:At(e,t,ye,null,a,M)}for(T in a)if(M=a[T],I=n[T],a.hasOwnProperty(T)&&M!==I&&(M!=null||I!=null))switch(T){case"selected":M!==I&&(ut=!0),e.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:At(e,t,T,M,a,I)}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 Me in n)M=n[Me],n.hasOwnProperty(Me)&&M!=null&&!a.hasOwnProperty(Me)&&At(e,t,Me,null,a,M);for(R in a)if(M=a[R],I=n[R],a.hasOwnProperty(R)&&M!==I&&(M!=null||I!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(u(137,t));break;default:At(e,t,R,M,a,I)}return;default:if(Fc(t)){for(var Je in n)M=n[Je],n.hasOwnProperty(Je)&&M!==void 0&&!a.hasOwnProperty(Je)&&Kd(e,t,Je,void 0,a,M);for($ in a)M=a[$],I=n[$],!a.hasOwnProperty($)||M===I||M===void 0&&I===void 0||Kd(e,t,$,M,a,I);return}}for(var _ in n)M=n[_],n.hasOwnProperty(_)&&M!=null&&!a.hasOwnProperty(_)&&At(e,t,_,null,a,M);for(W in a)M=a[W],I=n[W],!a.hasOwnProperty(W)||M===I||M==null&&I==null||At(e,t,W,M,a,I)}function zg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function bx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var s=n[a],r=s.transferSize,f=s.initiatorType,p=s.duration;if(r&&p&&zg(f)){for(f=0,p=s.responseEnd,a+=1;a<n.length;a++){var T=n[a],R=T.startTime;if(R>p)break;var $=T.transferSize,W=T.initiatorType;$&&zg(W)&&(T=T.responseEnd,f+=$*(T<p?1:(p-R)/(T-R)))}if(--a,t+=8*(r+f)/(s.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Zd=null,Fd=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Ug(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Hg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Bg(e,t,n,a){return n=ro(n).createElement(e),n[zt]=a,n[Ut]=t,fn(n,e,t),xt(n),n}function Pd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function xx(){var e=window.event;return e&&e.type==="popstate"?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Wd=typeof setTimeout=="function"?setTimeout:void 0,Sx=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,qg=typeof requestAnimationFrame=="function"?requestAnimationFrame:Wd,wx=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(e){return Ig.resolve(null).then(e).catch(Ax)}:Wd;function Ax(e){setTimeout(function(){throw e})}function zl(e){return e==="head"}function $g(e,t){var n=t,a=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(s),hi(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")rf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,rf(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[pl]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&rf(e.ownerDocument.body);n=s}while(n);hi(t)}function Gg(e,t){var n=e;e=0;do{var a=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Xg(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var s=a=0;s<t.length;s++){var r=t[s];0<r.width&&0<r.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function Yg(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n=="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n=="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Tx(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function ef(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return Tx(t,n,e)}function kx(e){return e.documentElement.clientHeight}function jx(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Nx(e,t,n,a,s,r,f,p,T){var R=t.nodeType===9?t:t.ownerDocument;try{var $=R.startViewTransition({update:function(){var M=R.defaultView,I=M.navigation&&M.navigation.transition,ye=R.fonts.status;a();var Me=[];if(ye==="loaded"&&(kx(R),R.fonts.status==="loading"&&Me.push(R.fonts.ready)),ye=Me.length,e!==null)for(var Je=e.suspenseyImages,_=0,C=0;C<Je.length;C++){var U=Je[C];if(!U.complete){var J=U.getBoundingClientRect();if(0<J.bottom&&0<J.right&&J.top<M.innerHeight&&J.left<M.innerWidth){if(_+=fy(U),_>cc){Me.length=ye;break}U=new Promise(jx.bind(U)),Me.push(U)}}}if(0<Me.length)return M=Promise.race([Promise.all(Me),new Promise(function(Ne){return setTimeout(Ne,500)})]).then(s,s),(I?Promise.allSettled([I.finished,M]):M).then(r,r);if(s(),I)return I.finished.then(r,r);r()},types:n});R.__reactViewTransition=$;var W=[];return $.ready.then(function(){for(var M=R.documentElement.getAnimations({subtree:!0}),I=0;I<M.length;I++){var ye=M[I],Me=ye.effect,Je=Me.pseudoElement;if(Je!=null&&Je.startsWith("::view-transition")){W.push(ye),ye=Me.getKeyframes();for(var _=Je=void 0,C=!0,U=0;U<ye.length;U++){var J=ye[U],Ne=J.width;if(Je===void 0)Je=Ne;else if(Je!==Ne){C=!1;break}if(Ne=J.height,_===void 0)_=Ne;else if(_!==Ne){C=!1;break}delete J.width,delete J.height,J.transform==="none"&&delete J.transform}C&&Je!==void 0&&_!==void 0&&(Me.setKeyframes(ye),C=getComputedStyle(Me.target,Me.pseudoElement),C.width!==Je||C.height!==_)&&(C=ye[0],C.width=Je,C.height=_,C=ye[ye.length-1],C.width=Je,C.height=_,Me.setKeyframes(ye))}}f()},function(M){R.__reactViewTransition===$&&(R.__reactViewTransition=null);try{if(typeof M=="object"&&M!==null)switch(M.name){case"InvalidStateError":(M.message==="View transition was skipped because document visibility state is hidden."||M.message==="Skipping view transition because document visibility state has become hidden."||M.message==="Skipping view transition because viewport size changed."||M.message==="Transition was aborted because of invalid state")&&(M=null)}M!==null&&T(M)}finally{a(),s(),f()}}),$.finished.finally(function(){for(var M=0;M<W.length;M++)W[M].cancel();R.__reactViewTransition===$&&(R.__reactViewTransition=null),p()}),$}catch{return a(),s(),f(),null}}function vs(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}vs.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:Y({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},vs.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),a=[],s=0;s<n.length;s++){var r=n[s].effect;r!==null&&r.target===e&&r.pseudoElement===t&&a.push(n[s])}return a},vs.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Vg(e){return{name:e,group:new vs("group",e),imagePair:new vs("image-pair",e),old:new vs("old",e),new:new vs("new",e)}}function Zn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Zn.prototype.addEventListener=function(e,t,n){var a=null,s=null;if(!(n!=null&&typeof n!="boolean"&&(a=n.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var r=this._eventListeners;if(Kg(r,e,t,n)===-1){var f=this,p=t;n!=null&&typeof n!="boolean"&&n.once===!0&&(p=function(T){f.removeEventListener(e,t,n),typeof t=="function"?t.call(this,T):t.handleEvent(T)}),a!==null&&(s=f.removeEventListener.bind(f,e,t,n),a.addEventListener("abort",s,{once:!0}),s=a.removeEventListener.bind(a,"abort",s)),a=oi(n),r.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:p,cleanup:s}),b(this._fragmentFiber.child,!1,Ex,e,p,a)}this._eventListeners=r}};function Ex(e,t,n,a){return L(e).addEventListener(t,n,a),!1}Zn.prototype.removeEventListener=function(e,t,n){var a=this._eventListeners;if(a!==null&&(t=Kg(a,e,t,n),t!==-1)){var s=a[t];n=s.attachedListener;var r=s.cleanup;s=oi(s.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Cx,e,n,s),a.splice(t,1),r!==null&&r()}};function Cx(e,t,n,a){return L(e).removeEventListener(t,n,a),!1}function oi(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Qg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Kg(e,t,n,a){if(e.length===0)return-1;a=Qg(a);for(var s=0;s<e.length;s++){var r=e[s];if(r.type===t&&r.listener===n&&Qg(r.optionsOrUseCapture)===a)return s}return-1}Zn.prototype.dispatchEvent=function(e){var t=x(this._fragmentFiber);if(t===null)return!0;t=L(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var s=0;s<n.length;s++){var r=n[s];a.addEventListener(r.type,r.attachedListener,oi(r.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),n)for(s=0;s<n.length;s++)r=n[s],a.removeEventListener(r.type,r.attachedListener,oi(r.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},Zn.prototype.focus=function(e){b(this._fragmentFiber.child,!0,Zg,e,void 0,void 0)};function Zg(e,t){return e.tag===6?!1:(e=L(e),qx(e,t))}Zn.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,tf,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Zg(t[n],e);n--);};function tf(e,t){return t.push(e),!1}Zn.prototype.blur=function(){var e=x(this._fragmentFiber);e!==null&&(e=L(e),e=ro(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Mx,e,void 0,void 0))};function Mx(e,t){return e.tag===6?!1:(e=L(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Zn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,_x,e,void 0,void 0)};function _x(e,t){return e.tag===6||(e=L(e),t.observe(e)),!1}Zn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Rx,e,void 0,void 0);for(var n=t=0;n<Sa.length;n++){var a=Sa[n];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Sa[t++]=a}Sa.length=t}};function Rx(e,t){return e.tag===6||(e=L(e),t.unobserve(e)),!1}var Sa=[],nf=!1;function Ox(e,t,n){Sa.push({fragmentInstance:e,observer:t,instance:n}),nf||(nf=!0,$x(function(){nf=!1;var a=Sa;Sa=[];for(var s=0;s<a.length;s++){var r=a[s];r.observer.unobserve(r.instance)}}))}Zn.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,Dx,e,void 0,void 0),e};function Dx(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=L(e),t.push.apply(t,e.getClientRects());return!1}Zn.prototype.getRootNode=function(e){var t=x(this._fragmentFiber);return t===null?this:L(t).getRootNode(e)},Zn.prototype.compareDocumentPosition=function(e){var t=x(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];b(this._fragmentFiber.child,!1,tf,n,void 0,void 0);var a=L(t);if(n.length===0){if(n=a,k(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var s=a=n.compareDocumentPosition(e);return n===e?s=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=D(t)[1],n===null?s=Node.DOCUMENT_POSITION_PRECEDING:(e=L(n).compareDocumentPosition(e),s=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),s|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=L(n[0]),s=L(n[n.length-1]);var r=k(this._fragmentFiber)?t.parentElement:a;if(r==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=r.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,r=r.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY;var f=t.compareDocumentPosition(e),p=s.compareDocumentPosition(e),T=f&Node.DOCUMENT_POSITION_CONTAINED_BY||p&Node.DOCUMENT_POSITION_CONTAINED_BY;return p=a&&r&&f&Node.DOCUMENT_POSITION_FOLLOWING&&p&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||r&&s===e||T||p?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!r&&s===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:f,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Lx(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Lx(e,t,n,a,s){var r=ma(s);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!r)e:{for(;r!==null;){if(r.tag===7&&(r===t||r.alternate===t)){n=!0;break e}r=r.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(r===null)return r=s.ownerDocument,s===r||s===r.documentElement||s===r.body;e:{for(r=t,t=x(t);r!==null;){if(!(r.tag!==5&&r.tag!==3&&r.tag!==27||r!==t&&r.alternate!==t)){r=!0;break e}r=r.return}r=!1}return r}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!r)&&!(t=r===n)&&(t=H(n,r,G),t===null?t=!1:(b(t,!0,de,r,n),r=K,K=null,t=r!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!r)&&!(t=r===a)&&(t=H(a,r,G),t===null?t=!1:(b(t,!0,E,r,a),r=K,ce=K=null,t=r!==null)),t):!1}function Fg(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Zn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(u(566));var t=[];b(this._fragmentFiber.child,!1,tf,t,void 0,void 0);var n=e!==!1;if(t.length===0){var a=D(this._fragmentFiber);if(a=n?a[1]||a[0]||x(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=L(a),Fg(e,n);return}if(a=L(a),a.nodeType!==9){if(a.nodeType===11){n="host"in a?a.host:null,n!==null&&n.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=n?t.length-1:0;a!==(n?-1:t.length);){var s=t[a];s.tag===6?(s=L(s),Fg(s,n)):L(s).scrollIntoView(e),a+=n?-1:1}};function zx(e,t){return e=L(e),Pg(e,t),!1}function Pg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Jg(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];e.addEventListener(s.type,s.attachedListener,oi(s.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){for(var f=0,p=0;p<Sa.length;p++){var T=Sa[p];(T.fragmentInstance!==t||T.observer!==r||T.instance!==e)&&(Sa[f++]=T)}Sa.length=f,r.observe(e)}),Pg(e,t))}function Ux(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var s=n[a];e.removeEventListener(s.type,s.attachedListener,oi(s.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){typeof r.rootMargin=="string"?Ox(t,r,e):r.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":af(n),Ya(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Hx(e,t,n,a){for(;e.nodeType===1;){var s=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[pl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==s.rel||e.getAttribute("href")!==(s.href==null||s.href===""?null:s.href)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin)||e.getAttribute("title")!==(s.title==null?null:s.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(s.src==null?null:s.src)||e.getAttribute("type")!==(s.type==null?null:s.type)||e.getAttribute("crossorigin")!==(s.crossOrigin==null?null:s.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=s.name==null?null:""+s.name;if(s.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=ca(e.nextSibling),e===null)break}return null}function Bx(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ca(e.nextSibling),e===null))return null;return e}function Wg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ca(e.nextSibling),e===null))return null;return e}function lf(e){return e.data==="$?"||e.data==="$~"}function sf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Ix(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function ca(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var of=null;function ey(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ca(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function ty(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function qx(e,t){function n(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return a}function $x(e){qg(function(){qg(function(t){return e(t)})})}function ny(e,t,n){switch(t=ro(n),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function ay(e,t,n){for(var a in n){var s=n[a];n.hasOwnProperty(a)&&s!=null&&At(e,t,a,null,yx,s)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Ma&&(e.onclick=null),Ya(e)}function rf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ya(e)}var ua=new Map,ly=new Set;function co(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var il=_e.d;_e.d={f:Gx,r:Xx,D:Yx,C:Vx,L:Qx,m:Kx,X:Fx,S:Zx,M:Px};function Gx(){var e=il.f(),t=ec();return e||t}function Xx(e){var t=pa(e);t!==null&&t.tag===5&&t.type==="form"?ip(t):il.r(e)}var ri=typeof document>"u"?null:document;function sy(e,t,n){var a=ri;if(a&&typeof t=="string"&&t){var s=Ge(t);s='link[rel="'+e+'"][href="'+s+'"]',typeof n=="string"&&(s+='[crossorigin="'+n+'"]'),ly.has(s)||(ly.add(s),e={rel:e,crossOrigin:n,href:t},a.querySelector(s)===null&&(t=a.createElement("link"),fn(t,"link",e),xt(t),a.head.appendChild(t)))}}function Yx(e){il.D(e),sy("dns-prefetch",e,null)}function Vx(e,t){il.C(e,t),sy("preconnect",e,t)}function Qx(e,t,n){il.L(e,t,n);var a=ri;if(a&&e&&t){var s='link[rel="preload"][as="'+Ge(t)+'"]';t==="image"&&n&&n.imageSrcSet?(s+='[imagesrcset="'+Ge(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(s+='[imagesizes="'+Ge(n.imageSizes)+'"]')):s+='[href="'+Ge(e)+'"]';var r=s;switch(t){case"style":r=ci(e);break;case"script":r=ui(e)}if(!(ua.has(r)||(e=Y({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ua.set(r,e),a.querySelector(s)!==null||t==="style"&&a.querySelector(uo(r))||t==="script"&&a.querySelector(fo(r))))){var f=a.createElement("link");fn(f,"link",e),t==="style"&&(f[Fl]=!0,f.onload=f.onerror=function(){Qo(f)}),xt(f),a.head.appendChild(f)}}}function Kx(e,t){il.m(e,t);var n=ri;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",s='link[rel="modulepreload"][as="'+Ge(a)+'"][href="'+Ge(e)+'"]',r=s;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=ui(e)}if(!ua.has(r)&&(e=Y({rel:"modulepreload",href:e},t),ua.set(r,e),n.querySelector(s)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(fo(r)))return}a=n.createElement("link"),fn(a,"link",e),xt(a),n.head.appendChild(a)}}}function Zx(e,t,n){il.S(e,t,n);var a=ri;if(a&&e){var s=na(a).hoistableStyles,r=ci(e);t=t||"default";var f=s.get(r);if(!f){var p={loading:0,preload:null};if(f=a.querySelector(uo(r)))p.loading=5;else{e=Y({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ua.get(r))&&cf(e,n);var T=f=a.createElement("link");xt(T),fn(T,"link",e),T._p=new Promise(function(R,$){T.onload=R,T.onerror=$}),T.addEventListener("load",function(){p.loading|=1}),T.addEventListener("error",function(){p.loading|=2}),p.loading|=4,oc(f,t,a)}f={type:"stylesheet",instance:f,count:1,state:p},s.set(r,f)}}}function Fx(e,t){il.X(e,t);var n=ri;if(n&&e){var a=na(n).hoistableScripts,s=ui(e),r=a.get(s);r||(r=n.querySelector(fo(s)),r||(e=Y({src:e,async:!0},t),(t=ua.get(s))&&uf(e,t),r=n.createElement("script"),xt(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(s,r))}}function Px(e,t){il.M(e,t);var n=ri;if(n&&e){var a=na(n).hoistableScripts,s=ui(e),r=a.get(s);r||(r=n.querySelector(fo(s)),r||(e=Y({src:e,async:!0,type:"module"},t),(t=ua.get(s))&&uf(e,t),r=n.createElement("script"),xt(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(s,r))}}function iy(e,t,n,a){var s=(s=be.current)?co(s):null;if(!s)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=ci(n.href),t=na(s).hoistableStyles,a=t.get(n),a||(a={type:"style",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ci(n.href);var r=na(s).hoistableStyles,f=r.get(e);if(f||(s=s.ownerDocument||s,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,f),(r=s.querySelector(uo(e)))?r._p||(f.instance=r,f.state.loading=5):(r=ua.get(e),r||(r={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ua.set(e,r)),Jx(s,e,r,f.state))),t&&a===null)throw Error(u(528,""));return f}if(t&&a!==null)throw Error(u(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(n=ui(n),t=na(s).hoistableScripts,a=t.get(n),a||(a={type:"script",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function ci(e){return'href="'+Ge(e)+'"'}function uo(e){return'link[rel="stylesheet"]['+e+"]"}function oy(e){return Y({},e,{"data-precedence":e.precedence,precedence:null})}function Jx(e,t,n,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Fl]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Fl]=!0,t.onload=t.onerror=Qo.bind(null,t),fn(t,"link",n),xt(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function ui(e){return'[src="'+Ge(e)+'"]'}function fo(e){return"script[async]"+e}function ry(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ge(n.href)+'"]');if(a)return t.instance=a,xt(a),a;var s=Y({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),xt(a),fn(a,"style",s),oc(a,n.precedence,e),t.instance=a;case"stylesheet":s=ci(n.href);var r=e.querySelector(uo(s));if(r)return t.state.loading|=4,t.instance=r,xt(r),r;a=oy(n),(s=ua.get(s))&&cf(a,s),r=(e.ownerDocument||e).createElement("link"),xt(r);var f=r;return f._p=new Promise(function(p,T){f.onload=p,f.onerror=T}),fn(r,"link",a),t.state.loading|=4,oc(r,n.precedence,e),t.instance=r;case"script":return r=ui(n.src),(s=e.querySelector(fo(r)))?(t.instance=s,xt(s),s):(a=n,(s=ua.get(r))&&(a=Y({},n),uf(a,s)),e=e.ownerDocument||e,s=e.createElement("script"),xt(s),fn(s,"link",a),e.head.appendChild(s),t.instance=s);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,oc(a,n.precedence,e));return t.instance}function oc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),s=a.length?a[a.length-1]:null,r=s,f=0;f<a.length;f++){var p=a[f];if(p.dataset.precedence===t)r=p;else if(r!==s)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function uf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var rc=null;function cy(e,t,n){if(rc===null){var a=new Map,s=rc=new Map;s.set(n,a)}else s=rc,a=s.get(n),a||(a=new Map,s.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),s=0;s<n.length;s++){var r=n[s];if(!(r[pl]||r[zt]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var f=r.getAttribute(t)||"";f=e+f;var p=a.get(f);p?p.push(r):a.set(f,[r])}}return a}function df(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Wx(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function uy(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function dy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function fy(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function hy(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=fy(t),e.suspenseyImages.push(t)),e=nS.bind(e),t.decode().then(e,e))}function eS(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var s=ci(a.href),r=t.querySelector(uo(s));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ho.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,xt(r);return}r=t.ownerDocument||t,a=oy(a),(s=ua.get(s))&&cf(a,s),r=r.createElement("link"),xt(r);var f=r;f._p=new Promise(function(p,T){f.onload=p,f.onerror=T}),fn(r,"link",a),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=ho.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var cc=0;function tS(e,t){return e.stylesheets&&e.count===0&&dc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&cc===0&&(cc=62500*bx());var s=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>cc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(s)}}:null}function my(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)dc(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ho(){this.count--,my(this)}function nS(){this.imgCount--,my(this)}var uc=null;function dc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,uc=new Map,t.forEach(aS,e),uc=null,ho.call(e))}function aS(e,t){if(!(t.state.loading&4)){var n=uc.get(e);if(n)var a=n.get(null);else{n=new Map,uc.set(e,n);for(var s=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<s.length;r++){var f=s[r];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),a=f)}a&&n.set(null,a)}s=t.instance,f=s.getAttribute("data-precedence"),r=n.get(f)||a,r===a&&n.set(null,s),n.set(f,s),this.count++,a=ho.bind(this),s.addEventListener("load",a),s.addEventListener("error",a),r?r.parentNode.insertBefore(s,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(s,e.firstChild)),t.state.loading|=4}}var di={$$typeof:Ce,Provider:null,Consumer:null,_currentValue:mt,_currentValue2:mt,_threadCount:0};function lS(e,t,n,a,s,r,f,p,T){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.hiddenUpdates=Nt(null),this.identifierPrefix=a,this.onUncaughtError=s,this.onCaughtError=r,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function py(e,t,n,a,s,r,f,p,T,R,$,W){return e=new lS(e,t,n,f,T,R,$,W,p),t=1,r===!0&&(t|=24),r=Rn(3,null,null,t),e.current=r,r.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},Cu(r),e}function gy(e){return e?(e=Us,e):Us}function yy(e,t,n,a,s,r){s=gy(s),a.context===null?a.context=s:a.pendingContext=s,a=Tl(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=kl(e,a,t),n!==null&&(zn(n,e,t),Gi(n,e,t))}function vy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ff(e,t){vy(e,t),(e=e.alternate)&&vy(e,t)}function by(e){if(e.tag===13||e.tag===31){var t=ts(e,67108864);t!==null&&zn(t,e,67108864),ff(e,67108864)}}function xy(e){if(e.tag===13||e.tag===31){var t=Kn();t=Zl(t);var n=ts(e,t);n!==null&&zn(n,e,t),ff(e,t)}}var fi=!0;function sS(e,t,n,a){var s=Se.T;Se.T=null;var r=_e.p;try{_e.p=2,hf(e,t,n,a)}finally{_e.p=r,Se.T=s}}function iS(e,t,n,a){var s=Se.T;Se.T=null;var r=_e.p;try{_e.p=8,hf(e,t,n,a)}finally{_e.p=r,Se.T=s}}function hf(e,t,n,a){if(fi){var s=mf(a);if(s===null)Qd(e,t,a,fc,n),wy(e,a);else if(rS(s,e,t,n,a))a.stopPropagation();else if(wy(e,a),t&4&&-1<oS.indexOf(e)){for(;s!==null;){var r=pa(s);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=Z(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var T=1<<31-jt(f);p.entanglements[1]|=T,f&=~T}Ia(r),(gt&6)===0&&(Pr=yt()+500,so(0))}}break;case 31:case 13:p=ts(r,2),p!==null&&zn(p,r,2),ec(),ff(r,2)}if(r=mf(a),r===null&&Qd(e,t,a,fc,n),r===s)break;s=r}s!==null&&a.stopPropagation()}else Qd(e,t,a,null,n)}}function mf(e){return e=Jc(e),pf(e)}var fc=null;function pf(e){if(fc=null,e=ma(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fc=e,null}function Sy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ga()){case yn:return 2;case vn:return 8;case Cn:case B:return 32;case ue:return 268435456;default:return 32}default:return 32}}var gf=!1,Ul=null,Hl=null,Bl=null,mo=new Map,po=new Map,Il=[],oS="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 wy(e,t){switch(e){case"focusin":case"focusout":Ul=null;break;case"dragenter":case"dragleave":Hl=null;break;case"mouseover":case"mouseout":Bl=null;break;case"pointerover":case"pointerout":mo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function go(e,t,n,a,s,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[s]},t!==null&&(t=pa(t),t!==null&&by(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function rS(e,t,n,a,s){switch(t){case"focusin":return Ul=go(Ul,e,t,n,a,s),!0;case"dragenter":return Hl=go(Hl,e,t,n,a,s),!0;case"mouseover":return Bl=go(Bl,e,t,n,a,s),!0;case"pointerover":var r=s.pointerId;return mo.set(r,go(mo.get(r)||null,e,t,n,a,s)),!0;case"gotpointercapture":return r=s.pointerId,po.set(r,go(po.get(r)||null,e,t,n,a,s)),!0}return!1}function Ay(e){var t=ma(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Es(e.priority,function(){xy(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Es(e.priority,function(){xy(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function hc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mf(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);Pc=a,n.target.dispatchEvent(a),Pc=null}else return t=pa(n),t!==null&&by(t),e.blockedOn=n,!1;t.shift()}return!0}function Ty(e,t,n){hc(e)&&n.delete(t)}function cS(){gf=!1,Ul!==null&&hc(Ul)&&(Ul=null),Hl!==null&&hc(Hl)&&(Hl=null),Bl!==null&&hc(Bl)&&(Bl=null),mo.forEach(Ty),po.forEach(Ty)}function mc(e,t){e.blockedOn===t&&(e.blockedOn=null,gf||(gf=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,cS)))}var pc=null;function ky(e){pc!==e&&(pc=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){pc===e&&(pc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],s=e[t+2];if(typeof a!="function"){if(pf(a||n)===null)continue;break}var r=pa(n);r!==null&&(e.splice(t,3),t-=3,Fu(r,{pending:!0,data:s,method:n.method,action:a},a,s))}}))}function hi(e){function t(T){return mc(T,e)}Ul!==null&&mc(Ul,e),Hl!==null&&mc(Hl,e),Bl!==null&&mc(Bl,e),mo.forEach(t),po.forEach(t);for(var n=0;n<Il.length;n++){var a=Il[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Il.length&&(n=Il[0],n.blockedOn===null);)Ay(n),n.blockedOn===null&&Il.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var s=n[a],r=n[a+1],f=s[Ut]||null;if(typeof r=="function")f||ky(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(s=r,f=r[Ut]||null)p=f.formAction;else if(pf(s)!==null)continue}else p=f.action;typeof p=="function"?n[a+1]=p:(n.splice(a,3),a-=3),ky(n)}}}function jy(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(f){return s=f})},focusReset:"manual",scroll:"manual"})}function t(){s!==null&&(s(),s=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,s=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),s!==null&&(s(),s=null)}}}function yf(e){this._internalRoot=e}gc.prototype.render=yf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var n=t.current,a=Kn();yy(n,a,e,t,null,null)},gc.prototype.unmount=yf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;yy(e.current,2,null,e,null,null),ec(),t[_n]=null}};function gc(e){this._internalRoot=e}gc.prototype.unstable_scheduleHydration=function(e){if(e){var t=ml();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Il.length&&t!==0&&t<Il[n].priority;n++);Il.splice(n,0,e),n===0&&Ay(e)}};var Ny=o.version;if(Ny!=="19.3.0")throw Error(u(527,Ny,"19.3.0"));_e.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=S(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var uS={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Se,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yc.isDisabled&&yc.supportsFiber)try{Ye=yc.inject(uS),Qe=yc}catch{}}return vo.createRoot=function(e,t){if(!d(e))throw Error(u(299));var n=!1,a="",s=gp,r=yp,f=vp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(s=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=py(e,1,!1,null,null,n,a,null,s,r,f,jy),e[_n]=t.current,Vd(e),new yf(t)},vo.hydrateRoot=function(e,t,n){if(!d(e))throw Error(u(299));var a=!1,s="",r=gp,f=yp,p=vp,T=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=py(e,1,!0,t,n??null,a,s,T,r,f,p,jy),t.context=gy(null),n=t.current,a=Kn(),a=Zl(a),s=Tl(a),s.callback=null,kl(n,s,a),n=a,t.current.lanes=n,lt(t,n),Ia(t),e[_n]=t.current,Vd(e),new gc(t)},vo.version="19.3.0",vo}var Iy;function TS(){if(Iy)return xf.exports;Iy=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),xf.exports=AS(),xf.exports}var kS=TS();const jS=Dv(kS);async function NS(){const l=await fetch("/api/models");if(!l.ok)throw new Error(await Xc(l)||`Failed to load models (${l.status})`);return(await l.json()).data}async function ES(){const l=await fetch("/api/kb");return l.ok?(await l.json()).docs:[]}async function CS(l,o){const c=await fetch("/api/kb",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l,text:o})});if(!c.ok)throw new Error(await Xc(c)||`Failed to add document (${c.status})`);return(await c.json()).docs}async function MS(l){const o=await fetch(`/api/kb/${l}`,{method:"DELETE"});return o.ok?(await o.json()).docs:[]}async function eh(l,o){var S,g,b,x,k,D,V;if(l.stream===!1)return _S(l,o);const c=Date.now(),u=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,stream:!0}),signal:o.signal});if(!u.ok||!u.body){o.onError(await Xc(u)||`Chat request failed (${u.status})`);return}const d=u.body.getReader(),h=new TextDecoder;let m="";const y={};let v=null;for(;;){const{value:L,done:K}=await d.read();if(K)break;m+=h.decode(L,{stream:!0});let ce;for(;(ce=m.indexOf(`
50
- `))!==-1;){const de=m.slice(0,ce).replace(/\r$/,"");if(m=m.slice(ce+1),!de.startsWith("data:"))continue;const E=de.slice(5).trim();if(E==="[DONE]"){qy(y,o),o.onDone(v);return}let G;try{G=JSON.parse(E)}catch{continue}if(G.error){o.onError(G.error.message??"stream error");return}if(G.scx_sources){(S=o.onSources)==null||S.call(o,G.scx_sources);continue}const H=(g=G.choices)==null?void 0:g[0],Y=H==null?void 0:H.delta;if(Y!=null&&Y.content&&o.onDelta(Y.content),Y!=null&&Y.tool_calls)for(const F of Y.tool_calls){const ie=F.index??0;y[ie]??(y[ie]={id:F.id??`call_${ie}`,type:"function",function:{name:"",arguments:""}}),F.id&&(y[ie].id=F.id),(b=F.function)!=null&&b.name&&(y[ie].function.name+=F.function.name),(x=F.function)!=null&&x.arguments&&(y[ie].function.arguments+=F.function.arguments)}H!=null&&H.finish_reason&&(v=H.finish_reason),G.usage&&((D=o.onUsage)==null||D.call(o,{prompt:G.usage.prompt_tokens,completion:G.usage.completion_tokens,reasoning:(k=G.usage.completion_tokens_details)==null?void 0:k.reasoning_tokens}))}}if(qy(y,o),!v&&!((V=o.signal)!=null&&V.aborted)){const L=Math.round((Date.now()-c)/6e4);o.onError(`The connection closed before the model finished${L?` (after about ${L} min)`:""}. Long answers can hit a provider's time limit: try again, a faster model, or a smaller request.`);return}o.onDone(v)}async function _S(l,o){var m,y,v,S,g,b;const c=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,stream:!1}),signal:o.signal});if(!c.ok){o.onError(await Xc(c)||`Chat request failed (${c.status})`);return}const u=await c.json();u.scx_sources&&((m=o.onSources)==null||m.call(o,u.scx_sources));const d=(y=u.choices)==null?void 0:y[0],h=d==null?void 0:d.message;h!=null&&h.content&&o.onDelta(h.content),(v=h==null?void 0:h.tool_calls)!=null&&v.length&&((S=o.onToolCalls)==null||S.call(o,h.tool_calls)),u.usage&&((b=o.onUsage)==null||b.call(o,{prompt:u.usage.prompt_tokens,completion:u.usage.completion_tokens,reasoning:(g=u.usage.completion_tokens_details)==null?void 0:g.reasoning_tokens})),o.onDone((d==null?void 0:d.finish_reason)??null)}function qy(l,o){const c=Object.values(l).filter(u=>u.function.name);c.length&&o.onToolCalls&&o.onToolCalls(c)}async function Xc(l){var o;try{const c=await l.json();return((o=c==null?void 0:c.error)==null?void 0:o.message)??""}catch{return""}}async function RS(l){const o=await fetch(`/api/agent/sessions?directory=${encodeURIComponent(l)}`);if(!o.ok)throw new Error(await Hn(o)||`Could not list sessions (${o.status})`);return(await o.json()).sessions}async function OS(l,o){const c=await fetch(`/api/agent/session/${encodeURIComponent(l)}/messages?directory=${encodeURIComponent(o)}`);if(!c.ok)throw new Error(await Hn(c)||`Could not load session (${c.status})`);return c.json()}async function DS(l,o){const c=await fetch(`/api/agent/session/${encodeURIComponent(l)}?directory=${encodeURIComponent(o)}`,{method:"DELETE"});if(!c.ok)throw new Error(await Hn(c)||`Could not delete session (${c.status})`)}async function LS(l){const o=await fetch(`/api/agent/commands?directory=${encodeURIComponent(l)}`);return o.ok?(await o.json()).commands:[]}async function zS(l){const o=await fetch("/api/agent/command",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Command failed (${o.status})`)}async function US(l,o,c){const u=await fetch("/api/agent/compact",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l,directory:o,model:c})});if(!u.ok)throw new Error(await Hn(u)||`Compact failed (${u.status})`)}async function HS(){const l=await fetch("/api/agent/status");if(!l.ok)throw new Error(await Hn(l)||`Agent server not ready (${l.status})`);return l.json()}async function Lv(l){const o=await fetch(`/api/agent/directory?directory=${encodeURIComponent(l)}`);if(!o.ok)throw new Error(await Hn(o)||`Folder not found (${o.status})`);return(await o.json()).directory}async function BS(l,o){const c=await fetch(`/api/agent/pending?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`);return c.ok?c.json():{permissions:[],questions:[]}}async function IS(l){const o=await fetch("/api/agent/session",{method:"POST",headers:dl(),body:JSON.stringify({directory:l})});if(!o.ok)throw new Error(await Hn(o)||`Could not create session (${o.status})`);return o.json()}async function qS(l){const o=await fetch("/api/agent/prompt",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Prompt failed (${o.status})`)}async function $S(l){const o=await fetch("/api/agent/permission",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Permission reply failed (${o.status})`)}async function GS(l){const o=await fetch("/api/agent/question",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Answer failed (${o.status})`)}async function XS(l,o){await fetch("/api/agent/abort",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l,directory:o})})}async function YS(l,o){const c=await fetch(`/api/agent/diff?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`);return c.ok?(await c.json()).diff:null}async function VS(l,o,c,u,d){let h=1e3,m=!1;for(;!u.aborted;){try{await QS(l,o,c,u,()=>{h=1e3,m&&(d==null||d()),m=!0})}catch(y){if(u.aborted)return;if(y.fatal)throw y}if(u.aborted)return;await new Promise(y=>setTimeout(y,h)),h=Math.min(h*2,1e4)}}async function QS(l,o,c,u,d){const h=await fetch(`/api/agent/events?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`,{signal:u});if(!h.ok||!h.body)throw Object.assign(new Error(await Hn(h)||`Event stream failed (${h.status})`),{fatal:!0});d();const m=h.body.getReader(),y=new TextDecoder;let v="";for(;;){const{value:S,done:g}=await m.read();if(g)break;v+=y.decode(S,{stream:!0});let b;for(;(b=v.indexOf(`
51
- `))!==-1;){const x=v.slice(0,b).replace(/\r$/,"");if(v=v.slice(b+1),!!x.startsWith("data:"))try{c(JSON.parse(x.slice(5).trim()))}catch{}}}}async function KS(l){const o=await fetch("/api/agent/recon",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Could not start recon (${o.status})`);return(await o.json()).recon}async function $y(l){const o=await fetch(`/api/agent/recon?sessionID=${encodeURIComponent(l)}`);return o.ok?(await o.json()).recon:null}async function ZS(l){const o=await fetch("/api/agent/recon/stop",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l})});return o.ok?(await o.json()).recon:null}const dl=()=>({"Content-Type":"application/json"});async function Hn(l){var o,c;try{return((c=(o=await l.json())==null?void 0:o.error)==null?void 0:c.message)??""}catch{return""}}async function Ho(l,o){if(!l.ok)throw new Error(await Hn(l)||`${o} failed (${l.status})`);return l.json()}const FS=()=>fetch("/api/workspaces").then(l=>Ho(l,"Listing workspaces")),PS=l=>fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}).then(o=>Ho(o,"Creating the workspace")),JS=l=>fetch(`/api/workspaces?directory=${encodeURIComponent(l)}`,{method:"DELETE"}).then(o=>Ho(o,"Deleting the workspace")),WS=(l,o)=>fetch(`/api/agent/files?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}`).then(c=>Ho(c,"Listing files")),e1=(l,o,c)=>fetch(`/api/agent/upload?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}&name=${encodeURIComponent(c.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:c}).then(u=>Ho(u,`Uploading ${c.name}`)),t1=(l,o)=>`/api/agent/file?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}`,zv=["low","medium","high","xhigh","max"];function th(l,o){var c;if(!(!l||!((c=o==null?void 0:o.supported_features)!=null&&c.includes("reasoning"))))return zv.includes(l)?l:void 0}let n1=0;const Uf=()=>`tool_${Date.now().toString(36)}_${(n1++).toString(36)}`,a1=l=>l.map(o=>o.id?o:{...o,id:Uf()}),l1=l=>l.map(({id:o,...c})=>c);function Uv({cursor:l=!1}){return i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"prompt",children:">_"}),i.jsxs("span",{className:"word",children:["Bug",i.jsx("span",{className:"x",children:"X"}),"Hunter",l&&i.jsx("span",{className:"cursor big","aria-hidden":!0})]})]})}function s1({size:l=20,tagline:o=!0}){return i.jsxs("div",{className:"brand","aria-label":"BugXHunter",children:[i.jsx("span",{className:"logo",style:{fontSize:l},children:i.jsx(Uv,{})}),o&&i.jsxs("span",{className:"brand-sub",children:["Open-source AI security testing ",i.jsxs("span",{className:"brand-ver",title:"BugXHunter release v0.11.1",children:["v","0.11.1"]})]})]})}function nh(){return typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function Hv(l){const o=window.SpeechRecognition||window.webkitSpeechRecognition;if(!o)return{stop:()=>{},promise:Promise.resolve("")};const c=new o;c.lang=navigator.language||"en-US",c.interimResults=!0,c.continuous=!1;let u="";const d=new Promise(h=>{var m;c.onresult=y=>{var S;let v="";for(let g=y.resultIndex;g<y.results.length;g++){const b=y.results[g][0].transcript;y.results[g].isFinal?u+=b:v+=b}(S=l.onPartial)==null||S.call(l,u+v)},c.onend=()=>{var y;(y=l.onEnd)==null||y.call(l),h(u.trim())},c.onerror=()=>h(u.trim()),(m=l.onStart)==null||m.call(l),c.start()});return{stop:()=>c.stop(),promise:d}}let Nc=null;function i1(l){if(typeof window>"u"||!window.speechSynthesis)return;const o=l.replace(/[*_`#>]/g,"").replace(/\[(\d+)\]/g,"").trim();o&&(window.speechSynthesis.cancel(),Nc=new SpeechSynthesisUtterance(o),Nc.rate=1.05,window.speechSynthesis.speak(Nc))}function o1(){typeof window<"u"&&window.speechSynthesis&&window.speechSynthesis.cancel(),Nc=null}function Bo({title:l,tooltip:o,children:c}){return i.jsxs("header",{className:"term-bar",children:[i.jsx("span",{className:"dot r","aria-hidden":!0}),i.jsx("span",{className:"dot y","aria-hidden":!0}),i.jsx("span",{className:"dot g","aria-hidden":!0}),i.jsx("span",{className:"term-title",title:o??l,children:l}),c&&i.jsx("div",{className:"head-actions",children:c})]})}const r1={p:"$ ",out:"[*] ",ok:"[+] "};function Bv({lines:l}){const o=A.useMemo(()=>{var h;return typeof window<"u"&&!!((h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)},[]),[c,u]=A.useState(()=>o?{line:l.length,chars:0,started:!0}:{line:0,chars:0,started:!1});A.useEffect(()=>{if(c.line>=l.length)return;const h=l[c.line],m=c.chars<h.text.length,y=c.started?m?h.pace??22:260:400,v=setTimeout(()=>{u(m?{line:c.line,chars:c.chars+1,started:!0}:{line:c.line+1,chars:0,started:!0})},y);return()=>clearTimeout(v)},[c,l]);const d=c.line>=l.length;return i.jsxs("div",{className:"boot",children:[l.map((h,m)=>{if(m>c.line)return i.jsx("div",{className:"line","aria-hidden":!0},m);const y=m<c.line,v=y?h.text:h.text.slice(0,c.chars);return i.jsxs("div",{className:"line",children:[i.jsx("span",{className:h.kind,children:r1[h.kind]}),v,y&&h.ok?i.jsxs("span",{className:"ok",children:[" ",h.ok]}):null,m===c.line&&c.started&&i.jsx("span",{className:"cursor"})]},m)}),d&&i.jsxs("div",{className:"line",children:[i.jsx("span",{className:"p",children:"$ "}),i.jsx("span",{className:"cursor"})]})]})}async function En(l,o){var u,d;const c=await fetch(l,{headers:{"Content-Type":"application/json"},...o});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const Kl=l=>({method:"POST",body:l===void 0?void 0:JSON.stringify(l)}),c1=()=>En("/api/vault"),u1=(l,o)=>En("/api/vault/init",Kl({doc:l,dek:o})),Iv=l=>En("/api/vault/unseal",Kl({dek:l})),d1=()=>En("/api/vault/seal",Kl()),f1=(l,o)=>En(`/api/vault/items/${encodeURIComponent(l)}`,{method:"PUT",body:JSON.stringify({value:o})}),h1=l=>En(`/api/vault/items/${encodeURIComponent(l)}`,{method:"DELETE"}),Gy=(l,o)=>En("/api/vault/methods",Kl({method:l,dek:o})),m1=l=>En(`/api/vault/methods/${encodeURIComponent(l)}`,{method:"DELETE"}),p1=l=>En("/api/vault",{method:"DELETE",body:JSON.stringify({dek:l})}),g1=()=>En("/api/auth/me"),Tf=()=>En("/api/auth/methods"),y1=()=>En("/api/auth/challenge",Kl()),v1=l=>En("/api/auth/passkey",Kl(l)),b1=l=>En("/api/auth/recover",Kl({dek:l})),x1=()=>En("/api/auth/logout",Kl()),S1=6e5,ah="bugxhunter-vault-prf-v1",w1="bugxhunter-vault-kek-v1",A1="bugxhunter-vault-ok",Si=new TextEncoder,Ql=crypto.subtle,pn={enc:l=>btoa(String.fromCharCode(...l instanceof Uint8Array?l:new Uint8Array(l))),dec:l=>Uint8Array.from(atob(l),o=>o.charCodeAt(0))},qa={enc:l=>pn.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),dec:l=>pn.dec(l.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-l.length%4)%4))},$a=l=>crypto.getRandomValues(new Uint8Array(l)),ul=l=>l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);async function qv(l,o){const c=await Ql.importKey("raw",Si.encode(l),"PBKDF2",!1,["deriveBits"]),u=await Ql.deriveBits({name:"PBKDF2",hash:o.hash,salt:ul(pn.dec(o.salt)),iterations:o.iterations},c,256);return new Uint8Array(u)}async function $v(l,o,c){if(l.length!==32)throw new Error("PRF output must be 32 bytes");let u;if(o.passphrase){if(!c)throw new Error("This passkey was enrolled with a passphrase; enter it as well.");const m=await qv(c,o.passphrase);u=new Uint8Array(64),u.set(l,0),u.set(m,32),m.fill(0)}else u=new Uint8Array(l);const d=await Ql.importKey("raw",ul(u),"HKDF",!1,["deriveKey"]),h=await Ql.deriveKey({name:"HKDF",hash:"SHA-256",salt:ul(pn.dec(o.hkdfSalt)),info:Si.encode(w1)},d,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return u.fill(0),h}async function Yc(l,o){const c=await qv(l,o),u=await Ql.importKey("raw",ul(c),"AES-GCM",!1,["encrypt","decrypt"]);return c.fill(0),u}async function Oo(l,o,c){const u=$a(12),d=await Ql.encrypt({name:"AES-GCM",iv:ul(u),additionalData:Si.encode(c)},l,ul(o));return{iv:pn.enc(u),ct:pn.enc(d)}}async function lh(l,o,c){const u=await Ql.decrypt({name:"AES-GCM",iv:ul(pn.dec(o.iv)),additionalData:Si.encode(c)},l,ul(pn.dec(o.ct)));return new Uint8Array(u)}const Hf="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function T1(){const l=$a(16);let o=0,c=0,u="";for(const d of l)for(c=c<<8|d,o+=8;o>=5;)u+=Hf[c>>>o-5&31],o-=5;return o>0&&(u+=Hf[c<<5-o&31]),u.match(/.{1,5}/g).join("-")}const sh=l=>l.toUpperCase().replace(/[^A-Z2-9]/g,"");function Bf(l){const o=sh(l);return o.length===26&&[...o].every(c=>Hf.includes(c))}const ih=l=>`${l}-${qa.enc($a(6))}`,Gv=()=>({name:"PBKDF2",hash:"SHA-256",iterations:S1,salt:pn.enc($a(16))});async function Xv(l,o,c){const u={type:"passkey",id:ih("pk"),label:c,credentialId:o.credentialId,transports:o.transports,publicKey:o.publicKey,alg:o.alg,signCount:0,prfSalt:ah,hkdfSalt:pn.enc($a(16)),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return u.wrapped=await Oo(await $v(o.prf,u),l,u.id),u}async function oh(l,o){const c={type:"password",id:ih("pw"),label:"Backup passphrase",kdf:Gv(),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return c.wrapped=await Oo(await Yc(o,c.kdf),l,c.id),c}async function k1(l){const o=$a(32),c=await Ql.importKey("raw",ul(o),"AES-GCM",!1,["encrypt"]),u=new Date().toISOString(),d=[await Xv(o,l,l.label)];l.passphrase&&d.push(await oh(o,l.passphrase));const h=T1(),m={type:"recovery",id:ih("rc"),label:"Recovery code",kdf:Gv(),wrapped:{iv:"",ct:""},createdAt:u};m.wrapped=await Oo(await Yc(sh(h),m.kdf),o,m.id),d.push(m);const y={};for(const[g,b]of Object.entries(l.items))b&&(y[g]=await Oo(c,Si.encode(b),g));const v={version:1,createdAt:u,methods:d,verifier:await Oo(c,Si.encode(A1),"verifier"),items:y},S=pn.enc(o);return o.fill(0),{doc:v,dek:S,recoveryCode:h}}async function Yv(l,o,c){const u=await $v(o,l,c);return pn.enc(await lh(u,l.wrapped,l.id))}async function Vv(l,o){const c=await Yc(o,l.kdf);return pn.enc(await lh(c,l.wrapped,l.id))}async function Qv(l,o){const c=await Yc(sh(o),l.kdf);return pn.enc(await lh(c,l.wrapped,l.id))}class cl extends Error{constructor(o){super(o),this.name="PrfUnsupportedError"}}class rh extends Error{constructor(){super("Passkey prompt cancelled or timed out."),this.name="PasskeyCancelledError"}}const wi=()=>typeof window<"u"&&!!window.PublicKeyCredential&&!!navigator.credentials,j1=new TextEncoder;function _c(){const l=location.hostname;if(/^\d{1,3}(\.\d{1,3}){3}$/.test(l)||l.startsWith("["))throw new cl(`Passkeys can't be bound to an IP address (${l}). Open the app via http://localhost:${location.port||80} or a hostname.`);return l}function Kv(l){const o=l;return(o==null?void 0:o.name)==="NotAllowedError"?new rh:(o==null?void 0:o.name)==="OperationError"?new cl("Another passkey request is pending in this tab. Close any stray OS dialog or reload, then try again."):(o==null?void 0:o.name)==="SecurityError"?new cl(`The browser refused the passkey request (SecurityError: ${o.message}). Passkeys need https or localhost, and a relying-party name equal to the page's host (${location.hostname}).`):(o==null?void 0:o.name)==="NotSupportedError"||(o==null?void 0:o.name)==="ConstraintError"?new cl(`The authenticator can't do this (${o.name}: ${o.message}).`):o instanceof Error?new Error(`${o.name??"Error"}: ${o.message}`):new Error(String(l))}const Zv=l=>({prf:{eval:{first:j1.encode(l)}}});async function Fv(l,o){var S,g,b,x;if(!wi())throw new cl("This browser has no passkey support.");let c;try{c=await navigator.credentials.create({publicKey:{rp:{id:_c(),name:"BugXHunter"},user:{id:$a(16),name:l,displayName:"BugXHunter vault"},challenge:$a(32),pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-8},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"preferred",userVerification:"required"},timeout:12e4,extensions:Zv(o)}})}catch(k){throw Kv(k)}if(!c)throw new rh;const u=c.getClientExtensionResults();if(!((S=u.prf)!=null&&S.enabled))throw new cl("This passkey can't derive keys (no PRF support). Use a platform passkey (Windows Hello, Touch ID, Android) or a recent security key, in Chrome, Edge or Safari 18+.");const d=c.response,h=(g=d.getPublicKey)==null?void 0:g.call(d);if(!h)throw new cl("This browser doesn't expose the passkey's public key (needed for sign-in). Use Chrome, Edge or Safari.");const m=((b=d.getTransports)==null?void 0:b.call(d))??void 0,y=qa.enc(new Uint8Array(c.rawId)),v=(x=u.prf.results)!=null&&x.first?new Uint8Array(u.prf.results.first):(await ch({challenge:qa.enc($a(32)),rpId:_c(),allowCredentials:[{id:y,transports:m}]},o)).prf;return{credentialId:y,transports:m,prf:v,publicKey:pn.enc(h),alg:d.getPublicKeyAlgorithm()}}async function ch(l,o){var m,y;if(!wi())throw new cl("This browser has no passkey support.");const c=_c();l.rpId&&l.rpId!==c&&console.warn(`[vault] server suggested rpId ${l.rpId}; using the page's host ${c}`);let u;try{u=await navigator.credentials.get({publicKey:{rpId:c,challenge:qa.dec(l.challenge),allowCredentials:l.allowCredentials.map(v=>({type:"public-key",id:qa.dec(v.id),transports:v.transports})),userVerification:"required",timeout:12e4,extensions:Zv(o)}})}catch(v){throw Kv(v)}if(!u)throw new rh;const d=u.response,h=u.getClientExtensionResults();return{assertion:{credentialId:qa.enc(new Uint8Array(u.rawId)),clientDataJSON:qa.enc(new Uint8Array(d.clientDataJSON)),authenticatorData:qa.enc(new Uint8Array(d.authenticatorData)),signature:qa.enc(new Uint8Array(d.signature))},prf:(y=(m=h.prf)==null?void 0:m.results)!=null&&y.first?new Uint8Array(h.prf.results.first):void 0}}async function N1(l,o,c){const{prf:u}=await ch({challenge:qa.enc($a(32)),rpId:_c(),allowCredentials:[{id:l,transports:o}]},c);if(!u)throw new cl("The authenticator returned no PRF output. Use a passkey that supports PRF, or your recovery code.");return u}let uh=null;const Rc=l=>{uh=l},dh=()=>{uh=null},E1=()=>uh,If="or:unauthorized";async function C1(){dh(),await x1().catch(()=>{}),window.location.reload()}function M1({children:l}){const[o,c]=A.useState("checking");return A.useEffect(()=>{g1().then(d=>c(d.required?d.authenticated?"signed-in":"signed-out":"open")).catch(()=>c("open"));const u=()=>c("signed-out");return window.addEventListener(If,u),()=>window.removeEventListener(If,u)},[]),o==="checking"?null:o==="signed-out"?i.jsx(_1,{onSuccess:()=>c("signed-in")}):i.jsx(i.Fragment,{children:l})}function _1({onSuccess:l}){const[o,c]=A.useState("passkey"),[u,d]=A.useState(""),[h,m]=A.useState(""),[y,v]=A.useState(""),[S,g]=A.useState(!1),[b,x]=A.useState(!1),[k,D]=A.useState(!1),[V,L]=A.useState(null),[K,ce]=A.useState(null);A.useEffect(()=>{Tf().then(({methods:H})=>{g(H.some(Y=>Y.type==="passkey"&&!!Y.passphrase)),x(H.some(Y=>Y.type==="password"))}).catch(()=>{})},[]);async function de(){var H;D(!0),L(null),ce(null);try{const Y=await y1();if("open"in Y)return l();const{methods:F}=await Tf(),ie=F.filter(ve=>ve.type==="passkey"),X=((H=ie[0])==null?void 0:H.prfSalt)??"bugxhunter-vault-prf-v1",{assertion:P,prf:Q}=await ch(Y,X);await v1(P);const me=ie.find(ve=>ve.credentialId===P.credentialId);if(me&&Q)try{const ve=await Yv(me,Q,me.passphrase?u:void 0);await Iv(ve),Rc(ve)}catch{ce(me.passphrase?"Signed in; the vault stays locked (passphrase?) — unlock it from the sidebar.":"Signed in, but the vault didn't unlock — unlock it from the sidebar.")}l()}catch(Y){L(Y.message),D(!1)}}async function E(H){D(!0),L(null);try{const{methods:Y}=await Tf();let F;try{if(H==="password"){const ie=Y.find(X=>X.type==="password");if(!ie)throw new Error("no method");F=await Vv(ie,h)}else{const ie=Y.find(X=>X.type==="recovery");if(!ie)throw new Error("no method");F=await Qv(ie,y)}}catch{throw new Error(H==="password"?"Wrong backup passphrase.":"That recovery code doesn't open the vault.")}await b1(F),Rc(F),l()}catch(Y){L(Y.message),D(!1)}}const G=()=>{o==="passkey"?de():o==="password"?E("password"):o==="recovery"&&E("recovery")};return i.jsx("div",{className:"login-page grid-bg",children:i.jsxs("form",{className:"login-card",onSubmit:H=>{H.preventDefault(),G()},children:[i.jsx(Bo,{title:"bugxhunter@redteam: ~/login"}),i.jsxs("div",{className:"login-body",children:[i.jsx("span",{className:"logo login-mark",style:{fontSize:34},"aria-label":"BugXHunter",children:i.jsx(Uv,{cursor:!0})}),i.jsx("div",{className:"login-tag",children:"Open-source AI security testing"}),o==="passkey"&&i.jsxs(i.Fragment,{children:[S&&i.jsxs(i.Fragment,{children:[i.jsxs("label",{htmlFor:"pp",children:["vault passphrase ",i.jsx("span",{className:"muted",children:"(this passkey was enrolled with one)"})]}),i.jsx("input",{id:"pp",type:"password",autoFocus:!0,autoComplete:"current-password",value:u,onChange:H=>d(H.target.value)})]}),!wi()&&i.jsx("div",{className:"form-status error",children:"This browser has no passkey support. Use Chrome, Edge or Safari, or a backup."}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",type:"submit",autoFocus:!S,disabled:k||!wi(),children:k?"waiting for the passkey…":"./sign_in --passkey →"})}),i.jsxs("div",{className:"login-links",children:[b&&i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("password"),L(null)},children:"use the backup passphrase"}),i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("recovery"),L(null)},children:"use the recovery code"})]})]}),o==="password"&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"bp",children:"backup passphrase"}),i.jsx("input",{id:"bp",type:"password",autoFocus:!0,autoComplete:"current-password",value:h,onChange:H=>m(H.target.value)}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",type:"submit",disabled:k||!h,children:k?"checking…":"./sign_in --passphrase →"})}),i.jsxs("div",{className:"login-links",children:[i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("passkey"),L(null)},children:"back to the passkey"}),i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("recovery"),L(null)},children:"use the recovery code"})]})]}),o==="recovery"&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"rc",children:"recovery code"}),i.jsx("input",{id:"rc",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:y,onChange:H=>v(H.target.value)}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",type:"submit",disabled:k||!Bf(y),children:k?"checking…":"./sign_in --recovery →"})}),i.jsx("p",{className:"hint",style:{margin:0},children:"This signs you in and unlocks the vault. Enrol a new passkey right after, from the keys dialog."}),i.jsxs("div",{className:"login-links",children:[i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("passkey"),L(null)},children:"back to the passkey"}),i.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("lost"),L(null)},children:"lost that too?"})]})]}),o==="lost"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"hint",style:{margin:0},children:"Without the passkey, the backup passphrase or the recovery code the vault's secrets can't be recovered — by design, and by anyone. Someone with access to the server's files can reset it, which deletes the vault and reopens the app for a fresh setup:"}),i.jsx("pre",{className:"tool-output",style:{borderTop:"1px solid var(--border)"},children:`npm run vault:reset
48
+ `+a.stack}}var wn=Object.prototype.hasOwnProperty,Bn=l.unstable_scheduleCallback,ka=l.unstable_cancelCallback,An=l.unstable_shouldYield,nn=l.unstable_requestPaint,yt=l.unstable_now,Ga=l.unstable_getCurrentPriorityLevel,yn=l.unstable_ImmediatePriority,vn=l.unstable_UserBlockingPriority,Cn=l.unstable_NormalPriority,B=l.unstable_LowPriority,ue=l.unstable_IdlePriority,Ae=l.log,De=l.unstable_setDisableYieldValue,Ye=null,Qe=null;function Pe(e){if(typeof Ae=="function"&&De(e),Qe&&typeof Qe.setStrictMode=="function")try{Qe.setStrictMode(Ye,e)}catch{}}var jt=Math.clz32?Math.clz32:hl,Wt=Math.log,Mn=Math.LN2;function hl(e){return e>>>=0,e===0?32:31-(Wt(e)/Mn|0)|0}var ja=256,ha=262144,N=4194304;function P(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ge(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var i=0,r=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var p=a&134217727;return p!==0?(a=p&~r,a!==0?i=P(a):(f&=p,f!==0?i=P(f):n||(n=p&~e,n!==0&&(i=P(n))))):(p=a&~r,p!==0?i=P(p):f!==0?i=P(f):n||(n=a&~e,n!==0&&(i=P(n)))),i===0?0:t!==0&&t!==i&&(t&r)===0&&(r=i&-i,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:i}function xe(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(e,t){(t&8)!==0&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var a=31-jt(n),i=1<<a;t|=e[a],n&=~i}return t}function ct(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var e=N;return N<<=1,(N&62914560)===0&&(N=4194304),e}function Nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function lt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Bt(e,t,n,a,i,r){var f=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var p=e.entanglements,T=e.expirationTimes,R=e.hiddenUpdates;for(n=f&~n;0<n;){var $=31-jt(n),W=1<<$;p[$]=0,T[$]=-1;var M=R[$];if(M!==null)for(R[$]=null,$=0;$<M.length;$++){var I=M[$];I!==null&&(I.lane&=-536870913)}n&=~W}a!==0&&In(e,a,0),r!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=r&~(f&~t))}function In(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-jt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&261930}function Xa(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-jt(n),i=1<<a;i&t|e[a]&t&&(e[a]|=t),n&=~i}}function Na(e,t){var n=t&-t;return n=(n&42)!==0?1:Zl(n),(n&(e.suspendedLanes|t))!==0?0:n}function Zl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ea(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ml(){var e=_e.p;return e!==0?e:(e=window.event,e===void 0?32:Sy(e.type))}function Es(e,t){var n=_e.p;try{return _e.p=e,t()}finally{_e.p=n}}var Gt=Math.random().toString(36).slice(2),zt="__reactFiber$"+Gt,Ut="__reactProps$"+Gt,_n="__reactContainer$"+Gt,Xo="__reactEvents$"+Gt,Cs="__reactListeners$"+Gt,Yo="__reactHandles$"+Gt,Vo="__reactResources$"+Gt,pl="__reactMarker$"+Gt,Pl="__reactLoad$"+Gt;function Ya(e){delete e[zt],delete e[Ut],delete e[Cs],delete e[Yo]}function ma(e){var t;if(t=e[zt])return t;for(var n=e.parentNode;n;){if(t=n[_n]||n[zt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ty(e);e!==null;){if(n=e[zt])return n;e=ty(e)}return t}e=n,n=e.parentNode}return null}function pa(e){if(e=e[zt]||e[_n]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ta(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(u(33))}function na(e){var t=e[Vo];return t||(t=e[Vo]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[pl]=!0}function Qo(e){e[Pl]=void 0}var Fl=new Set,Ko={};function Ca(e,t){qn(e,t),qn(e+"Capture",t)}function qn(e,t){for(Ko[e]=t,e=0;e<t.length;e++)Fl.add(t[e])}var Zo=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]*$"),Ni={},Po={};function Fo(e){return wn.call(Po,e)?!0:wn.call(Ni,e)?!1:Zo.test(e)?Po[e]=!0:(Ni[e]=!0,!1)}var ut=!1;function Jo(){var e=ut;return ut=!1,e}function Jl(e,t,n){if(Fo(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,n)}}function Va(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,n)}}function $n(e,t,n,a){if(a===null)e.removeAttribute(n);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,a)}}function se(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function w(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function U(e,t,n){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var i=a.get,r=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(f){n=""+f,r.call(this,f)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return n},setValue:function(f){n=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function re(e){if(!e._valueTracker){var t=w(e)?"checked":"value";e._valueTracker=U(e,t,""+e[t])}}function fe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=w(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}var Ue=/[\n"\\]/g;function Ge(e){return e.replace(Ue,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function nt(e,t,n,a,i,r,f,p){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+se(t)):e.value!==""+se(t)&&(e.value=""+se(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?f==="number"&&e.value==t?bn(e,se(e.value)):bn(e,se(t)):n!=null?bn(e,se(n)):a!=null&&e.removeAttribute("value"),i==null&&r!=null&&(e.defaultChecked=!!r),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"?e.name=""+se(p):e.removeAttribute("name")}function Ot(e,t,n,a,i,r,f,p){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null)){re(e);return}n=n!=null?""+se(n):"",t=t!=null?""+se(t):n,p||t===e.value||(e.value=t),e.defaultValue=t}a=a??i,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=p?e.checked:!!a,e.defaultChecked=!!a,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),re(e)}function bn(e,t){e.defaultValue!==""+t&&(e.defaultValue=""+t)}function Qt(e,t,n,a){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&a&&(e[n].defaultSelected=!0)}else{for(n=""+se(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,a&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Qa(e,t,n){if(t!=null&&(t=""+se(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+se(n):""}function Ms(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(u(92));if(ze(a)){if(1<a.length)throw Error(u(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=se(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a),re(e)}function It(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wo=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 Ch(e,t,n){var a=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,n):typeof n!="number"||n===0||Wo.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Mh(e,t,n){if(t!=null&&typeof t!="object")throw Error(u(62));if(e=e.style,n!=null){for(var a in n)!n.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="",ut=!0);for(var i in t)a=t[i],t.hasOwnProperty(i)&&n[i]!==a&&(Ch(e,i,a),ut=!0)}else for(var r in t)t.hasOwnProperty(r)&&Ch(e,r,t[r])}function Pc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var H0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),B0=/^[\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 er(e){return B0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ma(){}var Fc=null;function Jc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _s=null,Rs=null;function _h(e){var t=pa(e);if(t&&(e=t.stateNode)){var n=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ge(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var i=a[Ut]||null;if(!i)throw Error(u(90));nt(a,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&fe(a)}break e;case"textarea":Qa(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Qt(e,!!n.multiple,t,!1)}}}var Wc=!1;function Rh(e,t,n){if(Wc)return e(t,n);Wc=!0;try{var a=e(t);return a}finally{if(Wc=!1,(_s!==null||Rs!==null)&&(ec(),_s&&(t=_s,e=Rs,Rs=_s=null,_h(t),e)))for(t=0;t<e.length;t++)_h(e[t])}}function Ei(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Ut]||null;if(a===null)return null;n=a[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(u(231,t,typeof n));return n}var Ka=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eu=!1;if(Ka)try{var Ci={};Object.defineProperty(Ci,"passive",{get:function(){eu=!0}}),window.addEventListener("test",Ci,Ci),window.removeEventListener("test",Ci,Ci)}catch{eu=!1}var gl=null,tu=null,tr=null;function Oh(){if(tr)return tr;var e,t=tu,n=t.length,a,i="value"in gl?gl.value:gl.textContent,r=i.length;for(e=0;e<n&&t[e]===i[e];e++);var f=n-e;for(a=1;a<=f&&t[n-a]===i[r-a];a++);return tr=i.slice(e,1<a?1-a:void 0)}function nr(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ar(){return!0}function Dh(){return!1}function Tn(e){function t(n,a,i,r,f){this._reactName=n,this._targetInst=i,this.type=a,this.nativeEvent=r,this.target=f,this.currentTarget=null;for(var p in e)e.hasOwnProperty(p)&&(n=e[p],this[p]=n?n(r):r[p]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?ar:Dh,this.isPropagationStopped=Dh,this}return X(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ar)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ar)},persist:function(){},isPersistent:ar}),t}var yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lr=Tn(yl),Mi=X({},yl,{view:0,detail:0}),I0=Tn(Mi),nu,au,_i,sr=X({},Mi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:su,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==_i&&(_i&&e.type==="mousemove"?(nu=e.screenX-_i.screenX,au=e.screenY-_i.screenY):au=nu=0,_i=e),nu)},movementY:function(e){return"movementY"in e?e.movementY:au}}),Lh=Tn(sr),q0=X({},sr,{dataTransfer:0}),$0=Tn(q0),G0=X({},Mi,{relatedTarget:0}),lu=Tn(G0),X0=X({},yl,{animationName:0,elapsedTime:0,pseudoElement:0}),Y0=Tn(X0),V0=X({},yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Q0=Tn(V0),K0=X({},yl,{data:0}),zh=Tn(K0),Z0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},P0={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"},F0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function J0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=F0[e])?!!t[e]:!1}function su(){return J0}var W0=X({},Mi,{key:function(e){if(e.key){var t=Z0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?P0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:su,charCode:function(e){return e.type==="keypress"?nr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),eb=Tn(W0),tb=X({},sr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Uh=Tn(tb),nb=X({},yl,{submitter:0}),ab=Tn(nb),lb=X({},Mi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:su}),sb=Tn(lb),ib=X({},yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),ob=Tn(ib),rb=X({},sr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),cb=Tn(rb),ub=X({},yl,{newState:0,oldState:0,source:0}),db=Tn(ub),fb=[9,13,27,32],iu=Ka&&"CompositionEvent"in window,Ri=null;Ka&&"documentMode"in document&&(Ri=document.documentMode);var hb=Ka&&"TextEvent"in window&&!Ri,Hh=Ka&&(!iu||Ri&&8<Ri&&11>=Ri),Bh=" ",Ih=!1;function qh(e,t){switch(e){case"keyup":return fb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $h(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Os=!1;function mb(e,t){switch(e){case"compositionend":return $h(t);case"keypress":return t.which!==32?null:(Ih=!0,Bh);case"textInput":return e=t.data,e===Bh&&Ih?null:e;default:return null}}function pb(e,t){if(Os)return e==="compositionend"||!iu&&qh(e,t)?(e=Oh(),tr=tu=gl=null,Os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Hh&&t.locale!=="ko"?null:t.data;default:return null}}var gb={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 Gh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!gb[e.type]:t==="textarea"}function Xh(e,t,n,a){_s?Rs?Rs.push(a):Rs=[a]:_s=a,t=ic(t,"onChange"),0<t.length&&(n=new lr("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Oi=null,Di=null;function yb(e){_g(e,0)}function ir(e){var t=ta(e);if(fe(t))return e}function Yh(e,t){if(e==="change")return t}var Vh=!1;if(Ka){var ou;if(Ka){var ru="oninput"in document;if(!ru){var Qh=document.createElement("div");Qh.setAttribute("oninput","return;"),ru=typeof Qh.oninput=="function"}ou=ru}else ou=!1;Vh=ou&&(!document.documentMode||9<document.documentMode)}function Kh(){Oi&&(Oi.detachEvent("onpropertychange",Zh),Di=Oi=null)}function Zh(e){if(e.propertyName==="value"&&ir(Di)){var t=[];Xh(t,Di,e,Jc(e)),Rh(yb,t)}}function vb(e,t,n){e==="focusin"?(Kh(),Oi=t,Di=n,Oi.attachEvent("onpropertychange",Zh)):e==="focusout"&&Kh()}function bb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ir(Di)}function xb(e,t){if(e==="click")return ir(t)}function Sb(e,t){if(e==="input"||e==="change")return ir(t)}function wb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gn=typeof Object.is=="function"?Object.is:wb;function Li(e,t){if(Gn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),a=Object.keys(t);if(n.length!==a.length)return!1;for(a=0;a<n.length;a++){var i=n[a];if(!wn.call(t,i)||!Gn(e[i],t[i]))return!1}return!0}function cu(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ph(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fh(e,t){var n=Ph(e);e=0;for(var a;n;){if(n.nodeType===3){if(a=e+n.textContent.length,e<=t&&a>=t)return{node:n,offset:t-e};e=a}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ph(n)}}function Jh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Jh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=cu(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cu(e.document)}return t}function uu(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Ab=Ka&&"documentMode"in document&&11>=document.documentMode,Ds=null,du=null,zi=null,fu=!1;function em(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fu||Ds==null||Ds!==cu(a)||(a=Ds,"selectionStart"in a&&uu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),zi&&Li(zi,a)||(zi=a,a=ic(du,"onSelect"),0<a.length&&(t=new lr("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Ds)))}function Wl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ls={animationend:Wl("Animation","AnimationEnd"),animationiteration:Wl("Animation","AnimationIteration"),animationstart:Wl("Animation","AnimationStart"),transitionrun:Wl("Transition","TransitionRun"),transitionstart:Wl("Transition","TransitionStart"),transitioncancel:Wl("Transition","TransitionCancel"),transitionend:Wl("Transition","TransitionEnd")},hu={},tm={};Ka&&(tm=document.createElement("div").style,"AnimationEvent"in window||(delete Ls.animationend.animation,delete Ls.animationiteration.animation,delete Ls.animationstart.animation),"TransitionEvent"in window||delete Ls.transitionend.transition);function es(e){if(hu[e])return hu[e];if(!Ls[e])return e;var t=Ls[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in tm)return hu[e]=t[n];return e}var nm=es("animationend"),am=es("animationiteration"),lm=es("animationstart"),Tb=es("transitionrun"),kb=es("transitionstart"),jb=es("transitioncancel"),sm=es("transitionend"),im=new Map,mu="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");mu.push("scrollEnd");function ga(e,t){im.set(e,t),Ca(t,[e])}var Nb=0;function Za(e,t){if(e.name!=null&&e.name!=="auto")return e.name;if(t.autoName!==null)return t.autoName;e=xa.identifierPrefix;var n=Nb++;return e="_"+e+"t_"+n.toString(32)+"_",t.autoName=e}function om(e){if(e==null||typeof e=="string")return e;var t=null,n=ti;if(n!==null)for(var a=0;a<n.length;a++){var i=e[n[a]];if(i!=null){if(i==="none")return"none";t=t==null?i:t+(" "+i)}}return t??e.default}function Pa(e,t){return e=om(e),t=om(t),t==null?e==="auto"?null:e:t==="auto"?null:t}var or=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},aa=[],zs=0,pu=0;function rr(){for(var e=zs,t=pu=zs=0;t<e;){var n=aa[t];aa[t++]=null;var a=aa[t];aa[t++]=null;var i=aa[t];aa[t++]=null;var r=aa[t];if(aa[t++]=null,a!==null&&i!==null){var f=a.pending;f===null?i.next=i:(i.next=f.next,f.next=i),a.pending=i}r!==0&&rm(n,i,r)}}function cr(e,t,n,a){aa[zs++]=e,aa[zs++]=t,aa[zs++]=n,aa[zs++]=a,pu|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function gu(e,t,n,a){return cr(e,t,n,a),ur(e)}function ts(e,t){return cr(e,null,null,t),ur(e)}function rm(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var i=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(i=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,i&&t!==null&&(i=31-jt(n),e=r.hiddenUpdates,a=e[i],a===null?e[i]=[t]:a.push(t),t.lane=n|536870912),r):null}function ur(e){if(50<lo)throw lo=0,Wr=null,Error(u(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Us={};function Eb(e,t,n,a){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(e,t,n,a){return new Eb(e,t,n,a)}function yu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fa(e,t){var n=e.alternate;return n===null?(n=Rn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function cm(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function dr(e,t,n,a,i,r){var f=0;if(a=e,typeof a=="function")yu(a)&&(f=1);else if(typeof a=="string")f=nS(e,n,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(a){case Ze:return e=Rn(31,n,t,i),e.elementType=Ze,e.lanes=r,e;case Q:return ns(n.children,i,r,t);case K:f=8,i|=24;break;case me:return e=Rn(12,n,t,i|2),e.elementType=me,e.lanes=r,e;case te:return e=Rn(13,n,t,i),e.elementType=te,e.lanes=r,e;case ce:return e=Rn(19,n,t,i),e.elementType=ce,e.lanes=r,e;case bt:case j:return e=i|32,e=Rn(30,n,t,e),e.elementType=j,e.lanes=r,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case Ce:f=10;break e;case ve:f=9;break e;case ne:f=11;break e;case ee:f=14;break e;case ke:f=16,a=null;break e}f=29,n=Error(u(130,e===null?"null":typeof e,"")),a=null}return t=Rn(f,n,t,i),t.elementType=e,t.type=a,t.lanes=r,t}function ns(e,t,n,a){return e=Rn(7,e,a,t),e.lanes=n,e}function vu(e,t,n){return e=Rn(6,e,null,t),e.lanes=n,e}function um(e){var t=Rn(18,null,null,0);return t.stateNode=e,t}function bu(e,t,n){return t=Rn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var dm=new WeakMap;function la(e,t){if(typeof e=="object"&&e!==null){var n=dm.get(e);return n!==void 0?n:(t={value:e,source:t,stack:gn(t)},dm.set(e,t),t)}return{value:e,source:t,stack:gn(t)}}var Hs=[],Bs=0,fr=null,Ui=0,sa=[],ia=0,vl=null,_a=1,Ra="";function Ja(e,t){Hs[Bs++]=Ui,Hs[Bs++]=fr,fr=e,Ui=t}function fm(e,t,n){sa[ia++]=_a,sa[ia++]=Ra,sa[ia++]=vl,vl=e;var a=_a;e=Ra;var i=32-jt(a)-1;a&=~(1<<i),n+=1;var r=32-jt(t)+i;if(30<r){var f=i-i%5;r=(a&(1<<f)-1).toString(32),a>>=f,i-=f,_a=1<<32-jt(t)+i|n<<i|a,Ra=r+e}else _a=1<<r|n<<i|a,Ra=e}function hr(e){e.return!==null&&(Ja(e,1),fm(e,1,0))}function xu(e){for(;e===fr;)fr=Hs[--Bs],Hs[Bs]=null,Ui=Hs[--Bs],Hs[Bs]=null;for(;e===vl;)vl=sa[--ia],sa[ia]=null,Ra=sa[--ia],sa[ia]=null,_a=sa[--ia],sa[ia]=null}function hm(e,t){sa[ia++]=_a,sa[ia++]=Ra,sa[ia++]=vl,_a=t.id,Ra=t.overflow,vl=e}var an=null,_t=null,tt=!1,bl=null,oa=!1,Su=Error(u(519));function xl(e){var t=Error(u(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Hi(la(t,e)),Su}function mm(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[zt]=e,t[Ut]=a,n){case"dialog":it("cancel",t),it("close",t);break;case"iframe":case"object":case"embed":it("load",t);break;case"video":case"audio":for(n=0;n<io.length;n++)it(io[n],t);break;case"source":it("error",t);break;case"img":case"image":case"link":it("error",t),it("load",t);break;case"details":it("toggle",t);break;case"input":it("invalid",t),Ot(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":it("invalid",t);break;case"textarea":it("invalid",t),Ms(t,a.value,a.defaultValue,a.children)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Lg(t.textContent,n)?(a.popover!=null&&(it("beforetoggle",t),it("toggle",t)),a.onScroll!=null&&it("scroll",t),a.onScrollEnd!=null&&it("scrollend",t),a.onClick!=null&&(t.onclick=Ma),t=!0):t=!1,t||xl(e,!0)}function mr(e){for(an=e.return;an;)switch(an.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:an=an.return}}function Is(e){if(e!==an)return!1;if(!tt)return mr(e),tt=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Fd(e.type,e.memoizedProps)),n=!n),n&&_t&&xl(e),mr(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));_t=ey(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(317));_t=ey(e)}else t===27?(t=_t,zl(e.type)?(e=of,of=null,_t=e):_t=t):_t=an?ca(e.stateNode.nextSibling):null;return!0}function as(){_t=an=null,tt=!1}function wu(){var e=bl;return e!==null&&(Ln===null?Ln=e:Ln.push.apply(Ln,e),bl=null),e}function Hi(e){bl===null?bl=[e]:bl.push(e)}var Au=he(null),ls=null,Wa=null;function Sl(e,t,n){Ee(Au,t._currentValue),t._currentValue=n}function el(e){e._currentValue=Au.current,Be(Au)}function pr(e,t,n){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===n)break;e=e.return}}function Tu(e,t,n,a){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var r=i.dependencies;if(r!==null){var f=i.child;r=r.firstContext;e:for(;r!==null;){var p=r;r=i;for(var T=0;T<t.length;T++)if(p.context===t[T]){r.lanes|=n,p=r.alternate,p!==null&&(p.lanes|=n),pr(r.return,n,e),a||(f=null);break e}r=p.next}}else if(i.tag===18){if(f=i.return,f===null)throw Error(u(341));f.lanes|=n,r=f.alternate,r!==null&&(r.lanes|=n),pr(f,n,e),f=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,f=i.alternate,f!==null&&(f.lanes|=n),pr(i.return,n,e),f=i.child,f=f!==null?f.sibling:null):f=i.child;if(f!==null)f.return=i;else for(f=i;f!==null;){if(f===e){f=null;break}if(i=f.sibling,i!==null){i.return=f.return,f=i;break}f=f.return}i=f}}function ss(e,t,n,a){e=null;for(var i=t,r=!1;i!==null;){if(!r){if((i.flags&524288)!==0)r=!0;else if((i.flags&262144)!==0)break}if(i.tag===10){var f=i.alternate;if(f===null)throw Error(u(387));if(f=f.memoizedProps,f!==null){var p=i.type;Gn(i.pendingProps.value,f.value)||(e!==null?e.push(p):e=[p])}}else if(i===qe.current){if(f=i.alternate,f===null)throw Error(u(387));f.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e!==null?e.push(di):e=[di])}i=i.return}return e!==null&&Tu(t,e,n,a),t.flags|=262144,e!==null}function gr(e){for(e=e.firstContext;e!==null;){if(!Gn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function is(e){ls=e,Wa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rn(e){return pm(ls,e)}function yr(e,t){return ls===null&&is(e),pm(e,t)}function pm(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Wa===null){if(e===null)throw Error(u(308));Wa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wa=Wa.next=t;return n}var Cb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},Mb=l.unstable_scheduleCallback,_b=l.unstable_NormalPriority,Kt={$$typeof:Ce,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ku(){return{controller:new Cb,data:new Map,refCount:0}}function Bi(e){e.refCount--,e.refCount===0&&Mb(_b,function(){e.controller.abort()})}function gm(e,t){if((e.pendingLanes&4194048)!==0){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var a=t[e];n.indexOf(a)===-1&&n.push(a)}}}var Ii=null;function Rb(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var qi=null,ju=0,os=0,qs=null;function Ob(e,t){if(qi===null){var n=qi=[];ju=0,os=$d(),qs={status:"pending",value:void 0,then:function(a){n.push(a)}}}return ju++,t.then(ym,ym),t}function ym(){if(--ju===0&&(Ii=null,qi!==null)){qs!==null&&(qs.status="fulfilled");var e=qi;qi=null,os=0,qs=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Db(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(i){n.push(i)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var i=0;i<n.length;i++)(0,n[i])(t)},function(i){for(a.status="rejected",a.reason=i,i=0;i<n.length;i++)(0,n[i])(void 0)}),a}var vm=Se.S;Se.S=function(e,t){if(ug=yt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Ob(e,t),Ii!==null)for(var n=si;n!==null;)gm(n,Ii),n=n.next;if(n=e.types,n!==null){for(var a=si;a!==null;)gm(a,n),a=a.next;if(os!==0){a=Ii,a===null&&(a=Ii=[]);for(var i=0;i<n.length;i++){var r=n[i];a.indexOf(r)===-1&&a.push(r)}}}vm!==null&&vm(e,t)};var rs=he(null);function Nu(){var e=rs.current;return e!==null?e:Mt.pooledCache}function vr(e,t){t===null?Ee(rs,rs.current):Ee(rs,t.pool)}function bm(){var e=Nu();return e===null?null:{parent:Kt._currentValue,pool:e}}var $s=Error(u(460)),Eu=Error(u(474)),br=Error(u(542)),xr={then:function(){}};function xm(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Sm(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ma,Ma),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Am(e),e===void 0&&!("reason"in t)?Error(u(600)):e;default:if(typeof t.status=="string")t.then(Ma,Ma);else{if(e=Mt,e!==null&&100<e.shellSuspendCounter)throw Error(u(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var i=t;i.status="fulfilled",i.value=a}},function(a){if(t.status==="pending"){var i=t;i.status="rejected",i.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Am(e),e}throw us=t,$s}}function cs(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(us=n,$s):n}}var us=null;function wm(){if(us===null)throw Error(u(459));var e=us;return us=null,e}function Am(e){if(e===$s||e===br)throw Error(u(483))}var Gs=null,$i=0;function Sr(e){var t=$i;return $i+=1,Gs===null&&(Gs=[]),Sm(Gs,e,t)}function wl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function wr(e,t){throw t.$$typeof===F?Error(u(525)):(e=Object.prototype.toString.call(t),Error(u(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Tm(e){function t(_,E){if(e){var H=_.deletions;H===null?(_.deletions=[E],_.flags|=16):H.push(E)}}function n(_,E){if(!e)return null;for(;E!==null;)t(_,E),E=E.sibling;return null}function a(_){for(var E=new Map;_!==null;)_.key===null?E.set(_.index,_):E.set(_.key,_),_=_.sibling;return E}function i(_,E){return _=Fa(_,E),_.index=0,_.sibling=null,_}function r(_,E,H){return _.index=H,e?(H=_.alternate,H!==null?(H=H.index,H<E?(_.flags|=2,E):H):(_.flags|=134217730,E)):(_.flags|=1048576,E)}function f(_){return e&&_.alternate===null&&(_.flags|=134217730),_}function p(_,E,H,J){return E===null||E.tag!==6?(E=vu(H,_.mode,J),E.return=_,E):(E=i(E,H),E.return=_,E)}function T(_,E,H,J){var Ne=H.type;return Ne===Q?(_=$(_,E,H.props.children,J,H.key),wl(_,H),_):E!==null&&(E.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ke&&cs(Ne)===E.type)?(E=i(E,H.props),wl(E,H),E.return=_,E):(E=dr(H.type,H.key,H.props,null,_.mode,J),wl(E,H),E.return=_,E)}function R(_,E,H,J){return E===null||E.tag!==4||E.stateNode.containerInfo!==H.containerInfo||E.stateNode.implementation!==H.implementation?(E=bu(H,_.mode,J),E.return=_,E):(E=i(E,H.children||[]),E.return=_,E)}function $(_,E,H,J,Ne){return E===null||E.tag!==7?(E=ns(H,_.mode,J,Ne),E.return=_,E):(E=i(E,H),E.return=_,E)}function W(_,E,H){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=vu(""+E,_.mode,H),E.return=_,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case ie:return H=dr(E.type,E.key,E.props,null,_.mode,H),wl(H,E),H.return=_,H;case G:return E=bu(E,_.mode,H),E.return=_,E;case ke:return E=cs(E),W(_,E,H)}if(ze(E)||pe(E))return E=ns(E,_.mode,H,null),E.return=_,E;if(typeof E.then=="function")return W(_,Sr(E),H);if(E.$$typeof===Ce)return W(_,yr(_,E),H);wr(_,E)}return null}function M(_,E,H,J){var Ne=E!==null?E.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return Ne!==null?null:p(_,E,""+H,J);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case ie:return H.key===Ne?T(_,E,H,J):null;case G:return H.key===Ne?R(_,E,H,J):null;case ke:return H=cs(H),M(_,E,H,J)}if(ze(H)||pe(H))return Ne!==null?null:$(_,E,H,J,null);if(typeof H.then=="function")return M(_,E,Sr(H),J);if(H.$$typeof===Ce)return M(_,E,yr(_,H),J);wr(_,H)}return null}function I(_,E,H,J,Ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return _=_.get(H)||null,p(E,_,""+J,Ne);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case ie:return _=_.get(J.key===null?H:J.key)||null,T(E,_,J,Ne);case G:return _=_.get(J.key===null?H:J.key)||null,R(E,_,J,Ne);case ke:return J=cs(J),I(_,E,H,J,Ne)}if(ze(J)||pe(J))return _=_.get(H)||null,$(E,_,J,Ne,null);if(typeof J.then=="function")return I(_,E,H,Sr(J),Ne);if(J.$$typeof===Ce)return I(_,E,H,yr(E,J),Ne);wr(E,J)}return null}function ye(_,E,H,J){for(var Ne=null,rt=null,Le=E,Xe=E=0,Ft=null;Le!==null&&Xe<H.length;Xe++){Le.index>Xe?(Ft=Le,Le=null):Ft=Le.sibling;var dt=M(_,Le,H[Xe],J);if(dt===null){Le===null&&(Le=Ft);break}e&&Le&&dt.alternate===null&&t(_,Le),E=r(dt,E,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt,Le=Ft}if(Xe===H.length)return n(_,Le),tt&&Ja(_,Xe),Ne;if(Le===null){for(;Xe<H.length;Xe++)Le=W(_,H[Xe],J),Le!==null&&(E=r(Le,E,Xe),rt===null?Ne=Le:rt.sibling=Le,rt=Le);return tt&&Ja(_,Xe),Ne}for(Le=a(Le);Xe<H.length;Xe++)Ft=I(Le,_,Xe,H[Xe],J),Ft!==null&&(e&&(dt=Ft.alternate,dt!==null&&Le.delete(dt.key===null?Xe:dt.key)),E=r(Ft,E,Xe),rt===null?Ne=Ft:rt.sibling=Ft,rt=Ft);return e&&Le.forEach(function(ql){return t(_,ql)}),tt&&Ja(_,Xe),Ne}function Me(_,E,H,J){if(H==null)throw Error(u(151));for(var Ne=null,rt=null,Le=E,Xe=E=0,Ft=null,dt=H.next();Le!==null&&!dt.done;Xe++,dt=H.next()){Le.index>Xe?(Ft=Le,Le=null):Ft=Le.sibling;var ql=M(_,Le,dt.value,J);if(ql===null){Le===null&&(Le=Ft);break}e&&Le&&ql.alternate===null&&t(_,Le),E=r(ql,E,Xe),rt===null?Ne=ql:rt.sibling=ql,rt=ql,Le=Ft}if(dt.done)return n(_,Le),tt&&Ja(_,Xe),Ne;if(Le===null){for(;!dt.done;Xe++,dt=H.next())dt=W(_,dt.value,J),dt!==null&&(E=r(dt,E,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt);return tt&&Ja(_,Xe),Ne}for(Le=a(Le);!dt.done;Xe++,dt=H.next())dt=I(Le,_,Xe,dt.value,J),dt!==null&&(e&&(Ft=dt.alternate,Ft!==null&&Le.delete(Ft.key===null?Xe:Ft.key)),E=r(dt,E,Xe),rt===null?Ne=dt:rt.sibling=dt,rt=dt);return e&&Le.forEach(function(mS){return t(_,mS)}),tt&&Ja(_,Xe),Ne}function Je(_,E,H,J){if(typeof H=="object"&&H!==null&&H.type===Q&&H.key===null&&H.props.ref===void 0&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case ie:e:{for(var Ne=H.key;E!==null;){if(E.key===Ne){if(Ne=H.type,Ne===Q){if(E.tag===7){n(_,E.sibling),J=i(E,H.props.children),wl(J,H),J.return=_,_=J;break e}}else if(E.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ke&&cs(Ne)===E.type){n(_,E.sibling),J=i(E,H.props),wl(J,H),J.return=_,_=J;break e}n(_,E);break}else t(_,E);E=E.sibling}H.type===Q?(J=ns(H.props.children,_.mode,J,H.key),wl(J,H),J.return=_,_=J):(J=dr(H.type,H.key,H.props,null,_.mode,J),wl(J,H),J.return=_,_=J)}return f(_);case G:e:{for(Ne=H.key;E!==null;){if(E.key===Ne)if(E.tag===4&&E.stateNode.containerInfo===H.containerInfo&&E.stateNode.implementation===H.implementation){n(_,E.sibling),J=i(E,H.children||[]),J.return=_,_=J;break e}else{n(_,E);break}else t(_,E);E=E.sibling}J=bu(H,_.mode,J),J.return=_,_=J}return f(_);case ke:return H=cs(H),Je(_,E,H,J)}if(ze(H))return ye(_,E,H,J);if(pe(H)){if(Ne=pe(H),typeof Ne!="function")throw Error(u(150));return H=Ne.call(H),Me(_,E,H,J)}if(typeof H.then=="function")return Je(_,E,Sr(H),J);if(H.$$typeof===Ce)return Je(_,E,yr(_,H),J);wr(_,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,E!==null&&E.tag===6?(n(_,E.sibling),J=i(E,H),J.return=_,_=J):(n(_,E),J=vu(H,_.mode,J),J.return=_,_=J),f(_)):n(_,E)}return function(_,E,H,J){try{$i=0;var Ne=Je(_,E,H,J);return Gs=null,Ne}catch(Le){if(Le===$s||Le===br)throw Le;var rt=Rn(29,Le,null,_.mode);return rt.lanes=J,rt.return=_,rt}finally{}}}var ds=Tm(!0),km=Tm(!1),Al=!1;function Cu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Tl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function kl(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(gt&2)!==0){var i=a.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),a.pending=t,t=ur(e),rm(e,null,n),t}return cr(e,a,t,n),ur(e)}function Gi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Xa(e,n)}}function _u(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var i=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var f={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?i=r=f:r=r.next=f,n=n.next}while(n!==null);r===null?i=r=t:r=r.next=t}else i=r=t;n={baseState:a.baseState,firstBaseUpdate:i,lastBaseUpdate:r,shared:a.shared,callbacks:a.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ru=!1;function Xi(){if(Ru){var e=qs;if(e!==null)throw e}}function Yi(e,t,n,a){Ru=!1;var i=e.updateQueue;Al=!1;var r=i.firstBaseUpdate,f=i.lastBaseUpdate,p=i.shared.pending;if(p!==null){i.shared.pending=null;var T=p,R=T.next;T.next=null,f===null?r=R:f.next=R,f=T;var $=e.alternate;$!==null&&($=$.updateQueue,p=$.lastBaseUpdate,p!==f&&(p===null?$.firstBaseUpdate=R:p.next=R,$.lastBaseUpdate=T))}if(r!==null){var W=i.baseState;f=0,$=R=T=null,p=r;do{var M=p.lane&-536870913,I=M!==p.lane;if(I?(ot&M)===M:(a&M)===M){M!==0&&M===os&&(Ru=!0),$!==null&&($=$.next={lane:0,tag:p.tag,payload:p.payload,callback:null,next:null});e:{var ye=e,Me=p;M=t;var Je=n;switch(Me.tag){case 1:if(ye=Me.payload,typeof ye=="function"){W=ye.call(Je,W,M);break e}W=ye;break e;case 3:ye.flags=ye.flags&-65537|128;case 0:if(ye=Me.payload,M=typeof ye=="function"?ye.call(Je,W,M):ye,M==null)break e;W=X({},W,M);break e;case 2:Al=!0}}M=p.callback,M!==null&&(e.flags|=64,I&&(e.flags|=8192),I=i.callbacks,I===null?i.callbacks=[M]:I.push(M))}else I={lane:M,tag:p.tag,payload:p.payload,callback:p.callback,next:null},$===null?(R=$=I,T=W):$=$.next=I,f|=M;if(p=p.next,p===null){if(p=i.shared.pending,p===null)break;I=p,p=I.next,I.next=null,i.lastBaseUpdate=I,i.shared.pending=null}}while(!0);$===null&&(T=W),i.baseState=T,i.firstBaseUpdate=R,i.lastBaseUpdate=$,r===null&&(i.shared.lanes=0),Rl|=f,e.lanes=f,e.memoizedState=W}}function jm(e,t){if(typeof e!="function")throw Error(u(191,e));e.call(t)}function Nm(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)jm(n[e],t)}var jl=he(null),Ar=he(0);function Em(e,t){e=sl,Ee(Ar,e),Ee(jl,t),sl=e|t.baseLanes}function Ou(){Ee(Ar,sl),Ee(jl,jl.current)}function Du(){sl=Ar.current,Be(jl),Be(Ar)}var cn=he(null),xn=null;function Nl(e){var t=e.alternate;Ee(un,un.current&1),Ee(cn,e),xn===null&&(t===null||jl.current!==null||t.memoizedState!==null)&&(xn=e)}function Lu(e){Ee(un,un.current),Ee(cn,e),xn===null&&(xn=e)}function Cm(e){e.tag===22?(Ee(un,un.current),Ee(cn,e),xn===null&&(xn=e)):El()}function El(){Ee(un,un.current),Ee(cn,cn.current)}function Xn(e){Be(cn),xn===e&&(xn=null),Be(un)}var un=he(0);function Vi(e,t){Ee(cn,cn.current),Ee(un,t)}function zu(e){Be(un),Be(cn),xn===e&&(xn=null)}function Tr(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||sf(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!=="independent"){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var tl=0,Fe=null,Et=null,Zt=null,kr=!1,Xs=!1,fs=!1,jr=0,Qi=0,Ys=null,Lb=0;function qt(){throw Error(u(321))}function Uu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gn(e[n],t[n]))return!1;return!0}function Hu(e,t,n,a,i,r){return tl=r,Fe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Se.H=e===null||e.memoizedState===null?fp:hp,fs=!1,r=n(a,i),fs=!1,Xs&&(r=_m(t,n,a,i)),Mm(e),r}function Mm(e){Se.H=Or;var t=Et!==null&&Et.next!==null;if(tl=0,Zt=Et=Fe=null,kr=!1,Qi=0,Ys=null,t)throw Error(u(300));e===null||Pt||(e=e.dependencies,e!==null&&gr(e)&&(Pt=!0))}function _m(e,t,n,a){Fe=e;var i=0;do{if(Xs&&(Ys=null),Qi=0,Xs=!1,25<=i)throw Error(u(301));if(i+=1,Zt=Et=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}Se.H=Gb,r=t(n,a)}while(Xs);return r}function zb(){var e=Se.H,t=e.useState()[0];return t=typeof t.then=="function"?Ki(t):t,e=e.useState()[0],(Et!==null?Et.memoizedState:null)!==e&&(Fe.flags|=1024),t}function Bu(){var e=jr!==0;return jr=0,e}function Iu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function qu(e){if(kr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}kr=!1}tl=0,Zt=Et=Fe=null,Xs=!1,Qi=jr=0,Ys=null}function kn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Zt===null?Fe.memoizedState=Zt=e:Zt=Zt.next=e,Zt}function Xt(){if(Et===null){var e=Fe.alternate;e=e!==null?e.memoizedState:null}else e=Et.next;var t=Zt===null?Fe.memoizedState:Zt.next;if(t!==null)Zt=t,Et=e;else{if(e===null)throw Fe.alternate===null?Error(u(467)):Error(u(310));Et=e,e={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},Zt===null?Fe.memoizedState=Zt=e:Zt=Zt.next=e}return Zt}function Nr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ki(e){var t=Qi;return Qi+=1,Ys===null&&(Ys=[]),e=Sm(Ys,e,t),t=Fe,(Zt===null?t.memoizedState:Zt.next)===null&&(t=t.alternate,Se.H=t===null||t.memoizedState===null?fp:hp),e}function Er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ki(e);if(e.$$typeof===ae)return;if(e.$$typeof===Ce)return rn(e)}throw Error(u(438,String(e)))}function $u(e){var t=null,n=Fe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Fe.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(i){return i.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Nr(),Fe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),a=0;a<e;a++)n[a]=kt;return t.index++,n}function nl(e,t){return typeof t=="function"?t(e):t}function Cr(e){var t=Xt();return Gu(t,Et,e)}function Gu(e,t,n){var a=e.queue;if(a===null)throw Error(u(311));a.lastRenderedReducer=n;var i=e.baseQueue,r=a.pending;if(r!==null){if(i!==null){var f=i.next;i.next=r.next,r.next=f}t.baseQueue=i=r,a.pending=null}if(r=e.baseState,i===null)e.memoizedState=r;else{t=i.next;var p=f=null,T=null,R=t,$=!1;do{var W=R.lane&-536870913;if(W!==R.lane?(ot&W)===W:(tl&W)===W){var M=R.revertLane;if(M===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),W===os&&($=!0);else if((tl&M)===M){R=R.next,M===os&&($=!0);continue}else W={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},T===null?(p=T=W,f=r):T=T.next=W,Fe.lanes|=M,Rl|=M;W=R.action,fs&&n(r,W),r=R.hasEagerState?R.eagerState:n(r,W)}else M={lane:W,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},T===null?(p=T=M,f=r):T=T.next=M,Fe.lanes|=W,Rl|=W;R=R.next}while(R!==null&&R!==t);if(T===null?f=r:T.next=p,!Gn(r,e.memoizedState)&&(Pt=!0,$&&(n=qs,n!==null)))throw n;e.memoizedState=r,e.baseState=f,e.baseQueue=T,a.lastRenderedState=r}return i===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function Xu(e){var t=Xt(),n=t.queue;if(n===null)throw Error(u(311));n.lastRenderedReducer=e;var a=n.dispatch,i=n.pending,r=t.memoizedState;if(i!==null){n.pending=null;var f=i=i.next;do r=e(r,f.action),f=f.next;while(f!==i);Gn(r,t.memoizedState)||(Pt=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function Rm(e,t,n){var a=Fe,i=Xt(),r=tt;if(r){if(n===void 0)throw Error(u(407));n=n()}else n=t();var f=!Gn((Et||i).memoizedState,n);if(f&&(i.memoizedState=n,Pt=!0),i=i.queue,Qu(Lm.bind(null,a,i,e),[e]),e=i.getSnapshot!==t||f||Zt!==null&&(Zt.memoizedState.tag&1)!==0,Vs(e?9:8,{destroy:void 0},Dm.bind(null,a,i,n,t),null),e){if(a.flags|=2048,Mt===null)throw Error(u(349));r||(tl&127)!==0||Om(a,t,n)}return n}function Om(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Fe.updateQueue,t===null?(t=Nr(),Fe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Dm(e,t,n,a){t.value=n,t.getSnapshot=a,zm(t)&&Um(e)}function Lm(e,t,n){return n(function(){zm(t)&&Um(e)})}function zm(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gn(e,n)}catch{return!0}}function Um(e){var t=ts(e,2);t!==null&&zn(t,e,2)}function Yu(e){var t=kn();if(typeof e=="function"){var n=e;if(e=n(),fs){Pe(!0);try{n()}finally{Pe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:e},t}function Hm(e,t,n,a){return e.baseState=n,Gu(e,Et,typeof a=="function"?a:nl)}function Ub(e,t,n,a,i){if(Rr(e))throw Error(u(485));if(e=t.action,e!==null){var r={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){r.listeners.push(f)}};Se.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,Bm(t,r)):(r.next=n.next,t.pending=n.next=r)}}function Bm(e,t){var n=t.action,a=t.payload,i=e.state;if(t.isTransition){var r=Se.T,f={};f.types=r!==null?r.types:null,Se.T=f;try{var p=n(i,a),T=Se.S;T!==null&&T(f,p),Im(e,t,p)}catch(R){Vu(e,t,R)}finally{r!==null&&f.types!==null&&(r.types=f.types),Se.T=r}}else try{r=n(i,a),Im(e,t,r)}catch(R){Vu(e,t,R)}}function Im(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){qm(e,t,a)},function(a){return Vu(e,t,a)}):qm(e,t,n)}function qm(e,t,n){t.status="fulfilled",t.value=n,$m(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Bm(e,n)))}function Vu(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,$m(t),t=t.next;while(t!==a)}e.action=null}function $m(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Gm(e,t){return t}function Xm(e,t){if(tt){var n=Mt.formState;if(n!==null){e:{var a=Fe;if(tt){if(_t){t:{for(var i=_t,r=oa;i.nodeType!==8;){if(!r){i=null;break t}if(i=ca(i.nextSibling),i===null){i=null;break t}}r=i.data,i=r==="F!"||r==="F"?i:null}if(i){_t=ca(i.nextSibling),a=i.data==="F!";break e}}xl(a)}a=!1}a&&(t=n[0])}}return n=kn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gm,lastRenderedState:t},n.queue=a,n=cp.bind(null,Fe,a),a.dispatch=n,a=Yu(!1),r=Ju.bind(null,Fe,!1,a.queue),a=kn(),i={state:t,dispatch:null,action:e,pending:null},a.queue=i,n=Ub.bind(null,Fe,i,r,n),i.dispatch=n,a.memoizedState=e,[t,n,!1]}function Ym(e){var t=Xt();return Vm(t,Et,e)}function Vm(e,t,n){if(t=Gu(e,t,Gm)[0],e=Cr(nl)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Ki(t)}catch(f){throw f===$s?br:f}else a=t;t=Xt();var i=t.queue,r=i.dispatch;return n!==t.memoizedState&&(Fe.flags|=2048,Vs(9,{destroy:void 0},Hb.bind(null,i,n),null)),[a,r,e]}function Hb(e,t){e.action=t}function Qm(e){var t=Xt(),n=Et;if(n!==null)return Vm(t,n,e);Xt(),t=t.memoizedState,n=Xt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Vs(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Fe.updateQueue,t===null&&(t=Nr(),Fe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(a=n.next,n.next=e,e.next=a,t.lastEffect=e),e}function Km(){return Xt().memoizedState}function Mr(e,t,n,a){var i=kn();Fe.flags|=e,i.memoizedState=Vs(1|t,{destroy:void 0},n,a===void 0?null:a)}function _r(e,t,n,a){var i=Xt();a=a===void 0?null:a;var r=i.memoizedState.inst;Et!==null&&a!==null&&Uu(a,Et.memoizedState.deps)?i.memoizedState=Vs(t,r,n,a):(Fe.flags|=e,i.memoizedState=Vs(1|t,r,n,a))}function Zm(e,t){Mr(8390656,8,e,t)}function Qu(e,t){_r(2048,8,e,t)}function Bb(e){Fe.flags|=4;var t=Fe.updateQueue;if(t===null)t=Nr(),Fe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Pm(e){var t=Xt().memoizedState;return Bb({ref:t,nextImpl:e}),function(){if((gt&2)!==0)throw Error(u(440));return t.impl.apply(void 0,arguments)}}function Fm(e,t){return _r(4,2,e,t)}function Jm(e,t){return _r(4,4,e,t)}function Wm(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ep(e,t,n){n=n!=null?n.concat([e]):null,_r(4,4,Wm.bind(null,t,e),n)}function Ku(){}function tp(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Uu(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function np(e,t){var n=Xt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Uu(t,a[1]))return a[0];if(a=e(),fs){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[a,t],a}function Zu(e,t,n){return n===void 0||(tl&1073741824)!==0&&(ot&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=fg(),Fe.lanes|=e,Rl|=e,n)}function ap(e,t,n,a){return Gn(n,t)?n:jl.current!==null?(e=Zu(e,n,a),Gn(e,t)||(Pt=!0),e):(tl&106)===0||(tl&1073741824)!==0&&(ot&261930)===0?(Pt=!0,e.memoizedState=n):(e=fg(),Fe.lanes|=e,Rl|=e,t)}function lp(e,t,n,a,i){var r=_e.p;_e.p=r!==0&&8>r?r:8;var f=Se.T,p={};p.types=f!==null?f.types:null,Se.T=p,Ju(e,!1,t,n);try{var T=i(),R=Se.S;if(R!==null&&R(p,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var $=Db(T,a);Zi(e,t,$,Kn(e))}else Zi(e,t,a,Kn(e))}catch(W){Zi(e,t,{then:function(){},status:"rejected",reason:W},Kn())}finally{_e.p=r,f!==null&&p.types!==null&&(f.types=p.types),Se.T=f}}function Ib(){}function Pu(e,t,n,a){if(e.tag!==5)throw Error(u(476));var i=sp(e).queue;lp(e,i,t,mt,n===null?Ib:function(){return ip(e),n(a)})}function sp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:mt,baseState:mt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:mt},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:nl,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ip(e){var t=sp(e);t.next===null&&(t=e.alternate.memoizedState),Zi(e,t.next.queue,{},Kn())}function Fu(){return rn(di)}function op(){return Xt().memoizedState}function rp(){return Xt().memoizedState}function qb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Kn();e=Tl(n);var a=kl(t,e,n);a!==null&&(zn(a,t,n),Gi(a,t,n)),t={cache:ku()},e.payload=t;return}t=t.return}}function $b(e,t,n){var a=Kn();n={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Rr(e)?up(t,n):(n=gu(e,t,n,a),n!==null&&(zn(n,e,a),dp(n,t,a)))}function cp(e,t,n){var a=Kn();Zi(e,t,n,a)}function Zi(e,t,n,a){var i={lane:a,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rr(e))up(t,i);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var f=t.lastRenderedState,p=r(f,n);if(i.hasEagerState=!0,i.eagerState=p,Gn(p,f))return cr(e,t,i,0),Mt===null&&rr(),!1}catch{}finally{}if(n=gu(e,t,i,a),n!==null)return zn(n,e,a),dp(n,t,a),!0}return!1}function Ju(e,t,n,a){if(a={lane:2,revertLane:$d(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Rr(e)){if(t)throw Error(u(479))}else t=gu(e,n,a,2),t!==null&&zn(t,e,2)}function Rr(e){var t=e.alternate;return e===Fe||t!==null&&t===Fe}function up(e,t){Xs=kr=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dp(e,t,n){if((n&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Xa(e,n)}}var Or={readContext:rn,use:Er,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt,useEffectEvent:qt},fp={readContext:rn,use:Er,useCallback:function(e,t){return kn().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:Zm,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Mr(4194308,4,Wm.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mr(4194308,4,e,t)},useInsertionEffect:function(e,t){Mr(4,2,e,t)},useMemo:function(e,t){var n=kn();t=t===void 0?null:t;var a=e();if(fs){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=kn();if(n!==void 0){var i=n(t);if(fs){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return a.memoizedState=a.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},a.queue=e,e=e.dispatch=$b.bind(null,Fe,e),[a.memoizedState,e]},useRef:function(e){var t=kn();return e={current:e},t.memoizedState=e},useState:function(e){e=Yu(e);var t=e.queue,n=cp.bind(null,Fe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ku,useDeferredValue:function(e,t){var n=kn();return Zu(n,e,t)},useTransition:function(){var e=Yu(!1);return e=lp.bind(null,Fe,e.queue,!0,!1),kn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Fe,i=kn();if(tt){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Mt===null)throw Error(u(349));(ot&127)!==0||Om(a,t,n)}i.memoizedState=n;var r={value:n,getSnapshot:t};return i.queue=r,Zm(Lm.bind(null,a,r,e),[e]),a.flags|=2048,Vs(9,{destroy:void 0},Dm.bind(null,a,r,n,t),null),n},useId:function(){var e=kn(),t=Mt.identifierPrefix;if(tt){var n=Ra,a=_a;n=(a&~(1<<32-jt(a)-1)).toString(32)+n,t="_"+t+"R_"+n,n=jr++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Lb++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Fu,useFormState:Xm,useActionState:Xm,useOptimistic:function(e){var t=kn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ju.bind(null,Fe,!0,n),n.dispatch=t,[e,t]},useMemoCache:$u,useCacheRefresh:function(){return kn().memoizedState=qb.bind(null,Fe)},useEffectEvent:function(e){var t=kn(),n={impl:e};return t.memoizedState=n,function(){if((gt&2)!==0)throw Error(u(440));return n.impl.apply(void 0,arguments)}}},hp={readContext:rn,use:Er,useCallback:tp,useContext:rn,useEffect:Qu,useImperativeHandle:ep,useInsertionEffect:Fm,useLayoutEffect:Jm,useMemo:np,useReducer:Cr,useRef:Km,useState:function(){return Cr(nl)},useDebugValue:Ku,useDeferredValue:function(e,t){var n=Xt();return ap(n,Et.memoizedState,e,t)},useTransition:function(){var e=Cr(nl)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Rm,useId:op,useHostTransitionStatus:Fu,useFormState:Ym,useActionState:Ym,useOptimistic:function(e,t){var n=Xt();return Hm(n,Et,e,t)},useMemoCache:$u,useCacheRefresh:rp,useEffectEvent:Pm},Gb={readContext:rn,use:Er,useCallback:tp,useContext:rn,useEffect:Qu,useImperativeHandle:ep,useInsertionEffect:Fm,useLayoutEffect:Jm,useMemo:np,useReducer:Xu,useRef:Km,useState:function(){return Xu(nl)},useDebugValue:Ku,useDeferredValue:function(e,t){var n=Xt();return Et===null?Zu(n,e,t):ap(n,Et.memoizedState,e,t)},useTransition:function(){var e=Xu(nl)[0],t=Xt().memoizedState;return[typeof e=="boolean"?e:Ki(e),t]},useSyncExternalStore:Rm,useId:op,useHostTransitionStatus:Fu,useFormState:Qm,useActionState:Qm,useOptimistic:function(e,t){var n=Xt();return Et!==null?Hm(n,Et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:$u,useCacheRefresh:rp,useEffectEvent:Pm};function Wu(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:X({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ed={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Kn(),i=Tl(a);i.payload=t,n!=null&&(i.callback=n),t=kl(e,i,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Kn(),i=Tl(a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=kl(e,i,a),t!==null&&(zn(t,e,a),Gi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Kn(),a=Tl(n);a.tag=2,t!=null&&(a.callback=t),t=kl(e,a,n),t!==null&&(zn(t,e,n),Gi(t,e,n))}};function mp(e,t,n,a,i,r,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,f):t.prototype&&t.prototype.isPureReactComponent?!Li(n,a)||!Li(i,r):!0}function pp(e,t,n,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,a),t.state!==e&&ed.enqueueReplaceState(t,t.state,null)}function hs(e,t){var n=t;if("ref"in t){n={};for(var a in t)a!=="ref"&&(n[a]=t[a])}if(e=e.defaultProps){n===t&&(n=X({},n));for(var i in e)n[i]===void 0&&(n[i]=e[i])}return n}function gp(e){or(e)}function yp(e){console.error(e)}function vp(e){or(e)}function Dr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function bp(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(i){setTimeout(function(){throw i})}}function td(e,t,n){return n=Tl(n),n.tag=3,n.payload={element:null},n.callback=function(){Dr(e,t)},n}function xp(e){return e=Tl(e),e.tag=3,e}function Sp(e,t,n,a){var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=a.value;e.payload=function(){return i(r)},e.callback=function(){bp(t,n,a)}}var f=n.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){bp(t,n,a),typeof i!="function"&&(Ol===null?Ol=new Set([this]):Ol.add(this));var p=a.stack;this.componentDidCatch(a.value,{componentStack:p!==null?p:""})})}function Xb(e,t,n,a,i){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&ss(t,n,i,!0),n=cn.current,n!==null){switch(n.tag){case 31:case 13:case 19:return xn===null?tc():n.alternate===null&&$t===0&&($t=3),n.flags&=-257,n.flags|=65536,n.lanes=i,a===xr?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),Bd(e,a,i)),!1;case 22:return n.flags|=65536,a===xr?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([a]):n.add(a)),Bd(e,a,i)),!1}throw Error(u(435,n.tag))}return Bd(e,a,i),tc(),!1}if(tt)return t=cn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=i,a!==Su&&(e=Error(u(422),{cause:a}),Hi(la(e,n)))):(a!==Su&&(t=Error(u(423),{cause:a}),Hi(la(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,a=la(a,n),i=td(e.stateNode,a,i),_u(e,i),$t!==4&&($t=2)),!1;var r=Error(u(520),{cause:a});if(r=la(r,n),ao===null?ao=[r]:ao.push(r),$t!==4&&($t=2),t===null)return!0;a=la(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=td(n.stateNode,a,e),_u(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Ol===null||!Ol.has(r))))return n.flags|=65536,i&=-i,n.lanes|=i,i=xp(i),Sp(i,e,n,a),_u(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var nd=Error(u(461)),Pt=!1;function en(e,t,n,a){t.child=e===null?km(t,null,n,a):ds(t,e.child,n,a)}function wp(e,t,n,a,i){n=n.render;var r=t.ref;if("ref"in a){var f={};for(var p in a)p!=="ref"&&(f[p]=a[p])}else f=a;return is(t),a=Hu(e,t,n,f,r,i),p=Bu(),e!==null&&!Pt?(Iu(e,t,i),al(e,t,i)):(tt&&p&&hr(t),t.flags|=1,en(e,t,a,i),t.child)}function Ap(e,t,n,a,i){if(e===null){var r=n.type;return typeof r=="function"&&!yu(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,Tp(e,t,r,a,i)):(e=dr(n.type,null,a,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!ud(e,i)){var f=r.memoizedProps;if(n=n.compare,n=n!==null?n:Li,n(f,a)&&e.ref===t.ref)return al(e,t,i)}return t.flags|=1,e=Fa(r,a),e.ref=t.ref,e.return=t,t.child=e}function Tp(e,t,n,a,i){if(e!==null){var r=e.memoizedProps;if(Li(r,a)&&e.ref===t.ref)if(Pt=!1,t.pendingProps=a=r,ud(e,i))(e.flags&131072)!==0&&(Pt=!0);else return t.lanes=e.lanes,al(e,t,i)}return ad(e,t,n,a,i)}function kp(e,t,n,a){var i=a.children,r=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(r=r!==null?r.baseLanes|n:n,e!==null){for(a=t.child=e.child,i=0;a!==null;)i=i|a.lanes|a.childLanes,a=a.sibling;a=i&~r}else a=0,t.child=null;return jp(e,t,r,n,a)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&vr(t,r!==null?r.cachePool:null),r!==null?Em(t,r):Ou(),Cm(t);else return a=t.lanes=536870912,jp(e,t,r!==null?r.baseLanes|n:n,n,a)}else r!==null?(vr(t,r.cachePool),Em(t,r),El(),t.memoizedState=null):(e!==null&&vr(t,null),Ou(),El());return en(e,t,i,n),t.child}function Pi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function jp(e,t,n,a,i){var r=Nu();return r=r===null?null:{parent:Kt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&vr(t,null),Ou(),Cm(t),e!==null&&ss(e,t,a,!0),t.childLanes=i,null}function Lr(e,t){return t=zr({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Np(e,t,n){return ds(t,e.child,null,n),e=Lr(t,t.pendingProps),e.flags|=2,Xn(t),t.memoizedState=null,e}function Yb(e,t,n){var a=t.pendingProps,i=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(tt){if(a.mode==="hidden")return e=Lr(t,a),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Pi(null,e);if(Lu(t),(e=_t)?(e=Wg(e,oa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vl!==null?{id:_a,overflow:Ra}:null,retryLane:536870912,hydrationErrors:null},n=um(e),n.return=t,t.child=n,an=t,_t=null)):e=null,e===null)throw xl(t);return t.lanes=536870912,null}return Lr(t,a)}var r=e.memoizedState;if(r!==null){var f=r.dehydrated;if(Lu(t),i)if(t.flags&256)t.flags&=-257,t=Np(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(u(558));else if(Pt||ss(e,t,n,!1),i=(n&e.childLanes)!==0,Pt||i){if(jl.current===null){if(a=Mt,a!==null&&(f=Na(a,n),f!==0&&f!==r.retryLane))throw r.retryLane=f,ts(e,f),zn(a,e,f),nd;tc()}t=Np(e,t,n)}else e=r.treeContext,_t=ca(f.nextSibling),an=t,tt=!0,bl=null,oa=!1,e!==null&&hm(t,e),t=Lr(t,a),t.flags|=134221824;return t}return e=Fa(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Qs(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(u(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function ad(e,t,n,a,i){return is(t),n=Hu(e,t,n,a,void 0,i),a=Bu(),e!==null&&!Pt?(Iu(e,t,i),al(e,t,i)):(tt&&a&&hr(t),t.flags|=1,en(e,t,n,i),t.child)}function Ep(e,t,n,a,i,r){return is(t),t.updateQueue=null,n=_m(t,a,n,i),Mm(e),a=Bu(),e!==null&&!Pt?(Iu(e,t,r),al(e,t,r)):(tt&&a&&hr(t),t.flags|=1,en(e,t,n,r),t.child)}function Cp(e,t,n,a,i){if(is(t),t.stateNode===null){var r=Us,f=n.contextType;typeof f=="object"&&f!==null&&(r=rn(f)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=ed,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},Cu(t),f=n.contextType,r.context=typeof f=="object"&&f!==null?rn(f):Us,r.state=t.memoizedState,f=n.getDerivedStateFromProps,typeof f=="function"&&(Wu(t,n,f,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(f=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),f!==r.state&&ed.enqueueReplaceState(r,r.state,null),Yi(t,a,r,i),Xi(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var p=t.memoizedProps,T=hs(n,p);r.props=T;var R=r.context,$=n.contextType;f=Us,typeof $=="object"&&$!==null&&(f=rn($));var W=n.getDerivedStateFromProps;$=typeof W=="function"||typeof r.getSnapshotBeforeUpdate=="function",p=t.pendingProps!==p,$||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(p||R!==f)&&pp(t,r,a,f),Al=!1;var M=t.memoizedState;r.state=M,Yi(t,a,r,i),Xi(),R=t.memoizedState,p||M!==R||Al?(typeof W=="function"&&(Wu(t,n,W,a),R=t.memoizedState),(T=Al||mp(t,n,T,a,M,R,f))?($||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=R),r.props=a,r.state=R,r.context=f,a=T):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,Mu(e,t),f=t.memoizedProps,$=hs(n,f),r.props=$,W=t.pendingProps,M=r.context,R=n.contextType,T=Us,typeof R=="object"&&R!==null&&(T=rn(R)),p=n.getDerivedStateFromProps,(R=typeof p=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(f!==W||M!==T)&&pp(t,r,a,T),Al=!1,M=t.memoizedState,r.state=M,Yi(t,a,r,i),Xi();var I=t.memoizedState;f!==W||M!==I||Al||e!==null&&e.dependencies!==null&&gr(e.dependencies)?(typeof p=="function"&&(Wu(t,n,p,a),I=t.memoizedState),($=Al||mp(t,n,$,a,M,I,T)||e!==null&&e.dependencies!==null&&gr(e.dependencies))?(R||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,I,T),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,I,T)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=I),r.props=a,r.state=I,r.context=T,a=$):(typeof r.componentDidUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&M===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,Qs(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=ds(t,e.child,null,i),t.child=ds(t,null,n,i)):en(e,t,n,i),t.memoizedState=r.state,e=t.child):e=al(e,t,i),e}function Mp(e,t,n,a){return as(),t.flags|=256,en(e,t,n,a),t.child}var ld={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function sd(e){return{baseLanes:e,cachePool:bm()}}function id(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Qn),e}function _p(e,t,n){var a=t.pendingProps,i=!1,r=(t.flags&128)!==0,f;if((f=r)||(f=e!==null&&e.memoizedState===null?!1:(un.current&2)!==0),f&&(i=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(tt){if(i?Nl(t):El(),(e=_t)?(e=Wg(e,oa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:vl!==null?{id:_a,overflow:Ra}:null,retryLane:536870912,hydrationErrors:null},n=um(e),n.return=t,t.child=n,an=t,_t=null)):e=null,e===null)throw xl(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}return r=a.children,a=a.fallback,i?(El(),i=t.mode,r=zr({mode:"hidden",children:r},i),a=ns(a,i,n,null),r.return=t,a.return=t,r.sibling=a,t.child=r,a=t.child,a.memoizedState=sd(n),a.childLanes=id(e,f,n),t.memoizedState=ld,Pi(null,a)):(Nl(t),od(t,r))}var p=e.memoizedState;if(p!==null){var T=p.dehydrated;if(T!==null)return Vb(e,t,r,f,a,T,p,n)}return i?(El(),i=a.fallback,r=t.mode,p=e.child,T=p.sibling,a=Fa(p,{mode:"hidden",children:a.children}),a.subtreeFlags=p.subtreeFlags&1206910976,T!==null?i=Fa(T,i):(i=ns(i,r,n,null),i.flags|=2),i.return=t,a.return=t,a.sibling=i,t.child=a,Pi(null,a),a=t.child,i=e.child.memoizedState,i===null?i=sd(n):(r=i.cachePool,r!==null?(p=Kt._currentValue,r=r.parent!==p?{parent:p,pool:p}:r):r=bm(),i={baseLanes:i.baseLanes|n,cachePool:r}),a.memoizedState=i,a.childLanes=id(e,f,n),t.memoizedState=ld,Pi(e.child,a)):(Nl(t),n=e.child,e=n.sibling,n=Fa(n,{mode:"visible",children:a.children}),n.return=t,n.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=n,t.memoizedState=null,n)}function od(e,t){return t=zr({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function zr(e,t){return e=Rn(22,e,null,t),e.lanes=0,e}function Ur(e,t,n){return ds(t,e.child,null,n),e=od(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vb(e,t,n,a,i,r,f,p){if(n)return t.flags&256?(Nl(t),t.flags&=-257,Ur(e,t,p)):t.memoizedState!==null?(El(),t.child=e.child,t.flags|=128,null):(El(),r=i.fallback,f=t.mode,i=zr({mode:"visible",children:i.children},f),r=ns(r,f,p,null),r.flags|=2,i.return=t,r.return=t,i.sibling=r,t.child=i,ds(t,e.child,null,p),i=t.child,i.memoizedState=sd(p),i.childLanes=id(e,a,p),t.memoizedState=ld,Pi(null,i));if(Nl(t),sf(r)){if(a=r.nextSibling&&r.nextSibling.dataset,a)var T=a.dgst;return a=T,a!==""&&(i=Error(u(419)),i.stack="",i.digest=a,Hi({value:i,source:null,stack:null})),Ur(e,t,p)}if(Pt||ss(e,t,p,!1),a=(p&e.childLanes)!==0,Pt||a){if(jl.current!==null)return Ur(e,t,p);if(a=Mt,a!==null&&(i=Na(a,p),i!==0&&i!==f.retryLane))throw f.retryLane=i,ts(e,i),zn(a,e,i),nd;return lf(r)||tc(),Ur(e,t,p)}return lf(r)?(t.flags|=192,t.child=e.child,null):(e=f.treeContext,_t=ca(r.nextSibling),an=t,tt=!0,bl=null,oa=!1,e!==null&&hm(t,e),t=od(t,i.children),t.flags|=134221824,t)}function Rp(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),pr(e.return,t,n)}function Op(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Tr(n)===null&&(t=e),e=e.sibling}return t}function Hr(e,t,n,a,i,r){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:i,treeForkCount:r}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=a,f.tail=n,f.tailMode=i,f.treeForkCount=r)}function rd(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function cd(e,t,n){var a=t.pendingProps,i=a.revealOrder,r=a.tail;a=a.children;var f=un.current;if(t.flags&128)return Vi(t,f),null;var p=(f&2)!==0;if(p?(f=f&1|2,t.flags|=128):f&=1,Vi(t,f),i==="backwards"&&e!==null?(rd(e),en(e,t,a,n),rd(e)):en(e,t,a,n),a=tt?Ui:0,!p&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rp(e,n,t);else if(e.tag===19)Rp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case"backwards":n=Op(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,rd(t)),Hr(t,!0,i,null,r,a);break;case"unstable_legacy-backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Tr(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Hr(t,!0,n,null,r,a);break;case"together":Hr(t,!1,null,null,void 0,a);break;case"independent":t.memoizedState=null;break;default:n=Op(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Hr(t,!1,i,n,r,a)}return t.child}function Dp(e,t,n){var a=t.pendingProps;return Sl(t,t.type,a.value),en(e,t,a.children,n),t.child}function al(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Rl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ss(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(u(153));if(t.child!==null){for(e=t.child,n=Fa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Fa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ud(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&gr(e)))}function Qb(e,t,n){switch(t.tag){case 3:q(t,t.stateNode.containerInfo),Sl(t,Kt,e.memoizedState.cache),as();break;case 27:case 5:He(t);break;case 4:q(t,t.stateNode.containerInfo);break;case 10:Sl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Lu(t),null;break;case 13:var a=t.memoizedState;if(a!==null){if(a.dehydrated!==null)return Nl(t),t.flags|=128,null;a=ss(e,t,n,!1);var i=t.child.childLanes;return a||(n&i)!==0?_p(e,t,n):(Nl(t),e=al(e,t,n),e!==null?e.sibling:null)}Nl(t);break;case 19:if(t.flags&128)return cd(e,t,n);if(i=(e.flags&128)!==0,a=(n&t.childLanes)!==0,a||(ss(e,t,n,!1),a=(n&t.childLanes)!==0),i){if(a)return cd(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Vi(t,un.current),a)break;return null;case 22:return t.lanes=0,kp(e,t,n,t.pendingProps);case 24:Sl(t,Kt,e.memoizedState.cache)}return al(e,t,n)}function Lp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Pt=!0;else{if(!ud(e,n)&&(t.flags&128)===0)return Pt=!1,Qb(e,t,n);Pt=(e.flags&131072)!==0}else Pt=!1,tt&&(t.flags&1048576)!==0&&fm(t,Ui,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=cs(t.elementType),t.type=e,typeof e=="function")yu(e)?(a=hs(e,a),t.tag=1,t=Cp(null,t,e,a,n)):(t.tag=0,t=ad(null,t,e,a,n));else{if(e!=null){var i=e.$$typeof;if(i===ne){t.tag=11,t=wp(null,t,e,a,n);break e}else if(i===ee){t.tag=14,t=Ap(null,t,e,a,n);break e}else if(i===Ce){t.tag=10,t.type=e,t=Dp(null,t,n);break e}}throw t=Oe(e)||e,Error(u(306,t,""))}}return t;case 0:return ad(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,i=hs(a,t.pendingProps),Cp(e,t,a,i,n);case 3:e:{if(q(t,t.stateNode.containerInfo),e===null)throw Error(u(387));a=t.pendingProps;var r=t.memoizedState;i=r.element,Mu(e,t),Yi(t,a,null,n);var f=t.memoizedState;if(a=f.cache,Sl(t,Kt,a),a!==r.cache&&Tu(t,[Kt],n,!0),Xi(),a=f.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=Mp(e,t,a,n);break e}else if(a!==i){i=la(Error(u(424)),t),Hi(i),t=Mp(e,t,a,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(_t=ca(e.firstChild),an=t,tt=!0,bl=null,oa=!0,n=km(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(as(),a===i){t=al(e,t,n);break e}en(e,t,a,n)}t=t.child}return t;case 26:return Qs(e,t),e===null?(n=iy(t.type,null,t.pendingProps,null))?t.memoizedState=n:tt||(t.stateNode=Bg(t.type,t.pendingProps,be.current,t)):t.memoizedState=iy(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return He(t),e===null&&tt&&(a=t.stateNode=ny(t.type,t.pendingProps,be.current),an=t,oa=!0,i=_t,zl(t.type)?(of=i,_t=ca(a.firstChild)):_t=i),en(e,t,t.pendingProps.children,n),Qs(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&tt&&((i=a=_t)&&(a=qx(a,t.type,t.pendingProps,oa),a!==null?(t.stateNode=a,an=t,_t=ca(a.firstChild),oa=!1,i=!0):i=!1),i||xl(t)),He(t),i=t.type,r=t.pendingProps,f=e!==null?e.memoizedProps:null,a=r.children,Fd(i,r)?a=null:f!==null&&Fd(i,f)&&(t.flags|=32),t.memoizedState!==null&&(i=Hu(e,t,zb,null,null,n),di._currentValue=i),Qs(e,t),en(e,t,a,n),t.child;case 6:return e===null&&tt&&((e=n=_t)&&(n=$x(n,t.pendingProps,oa),n!==null?(t.stateNode=n,an=t,_t=null,e=!0):e=!1),e||xl(t)),null;case 13:return _p(e,t,n);case 4:return q(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=ds(t,null,a,n):en(e,t,a,n),t.child;case 11:return wp(e,t,t.type,t.pendingProps,n);case 7:return a=t.pendingProps,Qs(e,t),en(e,t,a,n),t.child;case 8:return en(e,t,t.pendingProps.children,n),t.child;case 12:return en(e,t,t.pendingProps.children,n),t.child;case 10:return Dp(e,t,n);case 9:return i=t.type._context,a=t.pendingProps.children,is(t),i=rn(i),a=a(i),t.flags|=1,en(e,t,a,n),t.child;case 14:return Ap(e,t,t.type,t.pendingProps,n);case 15:return Tp(e,t,t.type,t.pendingProps,n);case 19:return cd(e,t,n);case 31:return Yb(e,t,n);case 22:return kp(e,t,n,t.pendingProps);case 24:return is(t),a=rn(Kt),e===null?(i=Nu(),i===null&&(i=Mt,r=ku(),i.pooledCache=r,r.refCount++,r!==null&&(i.pooledCacheLanes|=n),i=r),t.memoizedState={parent:a,cache:i},Cu(t),Sl(t,Kt,i)):((e.lanes&n)!==0&&(Mu(e,t),Yi(t,null,null,n),Xi()),i=e.memoizedState,r=t.memoizedState,i.parent!==a?(i={parent:a,cache:a},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Sl(t,Kt,a)):(a=r.cache,Sl(t,Kt,a),a!==i.cache&&Tu(t,[Kt],n,!0))),en(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),a=t.pendingProps,a.name!=null&&a.name!=="auto"?t.flags|=e===null?18882560:18874368:tt&&hr(t),e!==null&&e.memoizedProps.name!==a.name?t.flags|=4194816:Qs(e,t),en(e,t,a.children,n),t.child;case 29:throw t.pendingProps}throw Error(u(156,t.tag))}function ll(e){e.flags|=4}function dd(e,t,n,a,i){var r;if((r=(e.mode&32)!==0)&&(r=n===null?uy(t,a):uy(t,a)&&(a.src!==n.src||a.srcSet!==n.srcSet)),r){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(gg())e.flags|=8192;else throw us=xr,Eu}else e.flags&=-16777217}function zp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dy(t))if(gg())e.flags|=8192;else throw us=xr,Eu}function Br(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?at():536870912,e.lanes|=t,Js|=t)}function Fi(e,t){if(!tt)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,a=null;n!==null;)n.alternate!==null&&(a=n),n=n.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function Rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags&1206910976,a|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,a|=i.subtreeFlags,a|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function Kb(e,t,n){var a=t.pendingProps;switch(xu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(t),null;case 1:return Rt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),el(Kt),Re(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Is(t)?ll(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,wu())),Rt(t),null;case 26:var i=t.type,r=t.memoizedState;return e===null?(ll(t),r!==null?(Rt(t),zp(t,r)):(Rt(t),dd(t,i,null,a,n))):r?r!==e.memoizedState?(ll(t),Rt(t),zp(t,r)):(Rt(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&ll(t),Rt(t),dd(t,i,e,a,n)),null;case 27:if(pt(t),n=be.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return Rt(t),t.subtreeFlags&=-33554433,null}e=le.current,Is(t)?mm(t):(e=ny(i,a,n),t.stateNode=e,ll(t))}return Rt(t),t.subtreeFlags&=-33554433,null;case 5:if(pt(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(!a){if(t.stateNode===null)throw Error(u(166));return Rt(t),t.subtreeFlags&=-33554433,null}if(r=le.current,Is(t))mm(t);else{var f=ro(be.current);switch(r){case 1:r=f.createElementNS("http://www.w3.org/2000/svg",i);break;case 2:r=f.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;default:switch(i){case"svg":r=f.createElementNS("http://www.w3.org/2000/svg",i);break;case"math":r=f.createElementNS("http://www.w3.org/1998/Math/MathML",i);break;case"script":r=f.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild);break;case"select":r=typeof a.is=="string"?f.createElement("select",{is:a.is}):f.createElement("select"),a.multiple?r.multiple=!0:a.size&&(r.size=a.size);break;default:r=typeof a.is=="string"?f.createElement(i,{is:a.is}):f.createElement(i)}}r[zt]=t,r[Ut]=a;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)r.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=r;e:switch(fn(r,i,a),i){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&ll(t)}}return Rt(t),t.subtreeFlags&=-33554433,dd(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&ll(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(u(166));if(e=be.current,Is(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,i=an,i!==null)switch(i.tag){case 27:case 5:a=i.memoizedProps}e[zt]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Lg(e.nodeValue,n)),e||xl(t,!0)}else e=ro(e).createTextNode(a),e[zt]=t,t.stateNode=e}return Rt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(a=Is(t),n!==null){if(e===null){if(!a)throw Error(u(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(u(557));e[zt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),e=!1}else n=wu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xn(t),t):(Xn(t),null);if((t.flags&128)!==0)throw Error(u(558))}return Rt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Is(t),a!==null&&a.dehydrated!==null){if(e===null){if(!i)throw Error(u(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(u(317));i[zt]=t}else as(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Rt(t),i=!1}else i=wu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Xn(t),t):(Xn(t),null)}return Xn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=a!==null,e=e!==null&&e.memoizedState!==null,n&&(a=t.child,i=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(i=a.alternate.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==i&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Br(t,t.updateQueue),Rt(t),null);case 4:return Re(),e===null&&Vd(t.stateNode.containerInfo),t.flags|=67108864,Rt(t),null;case 10:return el(t.type),Rt(t),null;case 19:if(zu(t),a=t.memoizedState,a===null)return Rt(t),null;if(i=(t.flags&128)!==0,r=a.rendering,r===null)if(i)Fi(a,!1);else{if($t!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(r=Tr(e),r!==null){for(t.flags|=128,Fi(a,!1),e=r.updateQueue,t.updateQueue=e,Br(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)cm(n,e),n=n.sibling;return Vi(t,un.current&1|2),tt&&Ja(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&yt()>Fr&&(t.flags|=128,i=!0,Fi(a,!1),t.lanes=4194304)}else{if(!i)if(e=Tr(r),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Br(t,e),Fi(a,!0),a.tail===null&&a.tailMode!=="collapsed"&&a.tailMode!=="visible"&&!r.alternate&&!tt)return Rt(t),null}else 2*yt()-a.renderingStartTime>Fr&&n!==536870912&&(t.flags|=128,i=!0,Fi(a,!1),t.lanes=4194304);a.isBackwards?(r.sibling=t.child,t.child=r):(e=a.last,e!==null?e.sibling=r:t.child=r,a.last=r)}if(a.tail!==null){e=a.tail;e:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=yt(),e.sibling=null,r=un.current,r=i?r&1|2:r&1,a.tailMode==="visible"||a.tailMode==="collapsed"||!n||tt?Vi(t,r):(n=r,Ee(cn,t),Ee(un,n),xn===null&&(xn=t)),tt&&Ja(t,a.treeForkCount),e}return Rt(t),null;case 22:case 23:return Xn(t),Du(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(n&536870912)!==0&&(t.flags&128)===0&&(Rt(t),t.subtreeFlags&6&&(t.flags|=8192)):Rt(t),n=t.updateQueue,n!==null&&Br(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&Be(rs),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),el(Kt),Rt(t),null;case 25:return null;case 30:return t.flags|=33554432,Rt(t),null}throw Error(u(156,t.tag))}function Zb(e,t){switch(xu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return el(Kt),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Xn(t),t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));as()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zu(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Re(),null;case 10:return el(t.type),null;case 22:case 23:return Xn(t),Du(),e!==null&&Be(rs),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return el(Kt),null;case 25:return null;default:return null}}function Up(e,t){switch(xu(t),t.tag){case 3:el(Kt),Re();break;case 26:case 27:case 5:pt(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&Xn(t);break;case 13:Xn(t);break;case 19:zu(t);break;case 10:el(t.type);break;case 22:case 23:Xn(t),Du(),e!==null&&Be(rs);break;case 24:el(Kt)}}function Ji(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var i=a.next;n=i;do{if((n.tag&e)===e){a=void 0;var r=n.create,f=n.inst;a=r(),f.destroy=a}n=n.next}while(n!==i)}}catch(p){wt(t,t.return,p)}}function Cl(e,t,n){try{var a=t.updateQueue,i=a!==null?a.lastEffect:null;if(i!==null){var r=i.next;a=r;do{if((a.tag&e)===e){var f=a.inst,p=f.destroy;if(p!==void 0){f.destroy=void 0,i=t;var T=n,R=p;try{R()}catch($){wt(i,T,$)}}}a=a.next}while(a!==r)}}catch($){wt(t,t.return,$)}}function Hp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Nm(t,n)}catch(a){wt(e,e.return,a)}}}function Bp(e,t,n){n.props=hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){wt(e,t,a)}}function Oa(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:var i=e.stateNode,r=Za(e.memoizedProps,i);(i.ref===null||i.ref.name!==r)&&(i.ref=Vg(r)),a=i.ref;break;case 7:if(e.stateNode===null){var f=new Zn(e);b(e.child,!1,Bx,f,void 0,void 0),e.stateNode=f}a=e.stateNode;break;default:a=e.stateNode}typeof n=="function"?e.refCleanup=n(a):n.current=a}}catch(p){wt(e,t,p)}}function dn(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(i){wt(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){wt(e,t,i)}else n.current=null}function Ir(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)Jg(e.stateNode,t[n])}function Ip(e){for(var t=e.return;t!==null&&(hd(t)&&Jg(e.stateNode,t.stateNode),!fd(t));)t=t.return}function Wi(e){for(var t=e.return;t!==null&&(hd(t)&&Ix(e.stateNode,t.stateNode),!fd(t));)t=t.return}function fd(e){return e.tag===5||e.tag===3||e.tag===27}function hd(e){return e&&e.tag===7&&e.stateNode!==null}function md(e){var t=e.type,n=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&a.focus();break e;case"img":n.src?a.src=n.src:n.srcSet&&(a.srcset=n.srcSet)}}catch(i){wt(e,e.return,i)}}function pd(e,t,n){try{var a=e.stateNode;Sx(a,e.type,n,t),a[Ut]=t}catch(i){wt(e,e.return,i)}}function qp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&zl(e.type)||e.tag===4}function gd(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&zl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function yd(e,t,n,a){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ma)),Ir(e,a),ut=!0;else if(i!==4&&(i===27&&(Ir(e,a),a=null,zl(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(yd(e,t,n,a),e=e.sibling;e!==null;)yd(e,t,n,a),e=e.sibling}function qr(e,t,n,a){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Ir(e,a),ut=!0;else if(i!==4&&(i===27&&(Ir(e,a),a=null,zl(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(qr(e,t,n,a),e=e.sibling;e!==null;)qr(e,t,n,a),e=e.sibling}function $p(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);fn(t,a,n),t[zt]=e,t[Ut]=n}catch(r){wt(e,e.return,r)}}var $r=!1,Yn=null;function Gp(e){(e.tag===30||(e.subtreeFlags&33554432)!==0)&&($r=!0)}var Da=null;function Xp(){var e=Da;return Da=null,e}var On=0;function Ks(e,t,n,a,i){return On=0,Yp(e.child,t,n,a,i)}function Yp(e,t,n,a,i){for(var r=!1;e!==null;){if(e.tag===5){var f=e.stateNode;if(a!==null){var p=ef(f);a.push(p),p.view&&(r=!0)}else r||ef(f).view&&(r=!0);$r=!0,Xg(f,On===0?t:t+"_"+On,n),On++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Yp(e.child,t,n,a,i)&&(r=!0));e=e.sibling}return r}function La(e,t){for(;e!==null;)e.tag===5?Yg(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||La(e.child,t)),e=e.sibling}function Gr(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Gr(e),e.tag===30&&(e.flags&18874368)!==0&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name==="auto")throw Error(u(544));var n=t.name;t=Pa(t.default,t.share),t!=="none"&&(Ks(e,n,t,null,!1)||La(e.child,!1))}e=e.sibling}}function vd(e,t){if(e.tag===30){var n=e.stateNode,a=e.memoizedProps,i=Za(a,n),r=Pa(a.default,n.paired?a.share:a.enter);r!=="none"?Ks(e,i,r,null,!1)?(Gr(e),n.paired||t||ni(e,a.onEnter)):La(e.child,!1):Gr(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)vd(e,t),e=e.sibling;else Gr(e)}function bd(e){if(Yn!==null&&Yn.size!==0){var t=Yn;if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var n=e.memoizedProps,a=n.name;if(a!=null&&a!=="auto"){var i=t.get(a);if(i!==void 0){var r=Pa(n.default,n.share);if(r!=="none"&&(Ks(e,a,r,null,!1)?(r=e.stateNode,i.paired=r,r.paired=i,ni(e,n.onShare)):La(e.child,!1)),t.delete(a),t.size===0)break}}}bd(e)}e=e.sibling}}}function xd(e){if(e.tag===30){var t=e.memoizedProps,n=Za(t,e.stateNode),a=Yn!==null?Yn.get(n):void 0,i=Pa(t.default,a!==void 0?t.share:t.exit);i!=="none"&&(Ks(e,n,i,null,!1)?a!==void 0?(i=e.stateNode,a.paired=i,i.paired=a,Yn.delete(n),ni(e,t.onShare)):ni(e,t.onExit):La(e.child,!1)),Yn!==null&&bd(e)}else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)xd(e),e=e.sibling;else Yn!==null&&bd(e)}function Vp(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=Za(t,e.stateNode);t=Pa(t.default,t.update),e.flags&=-5,t!=="none"&&Ks(e,n,t,e.memoizedState=[],!1)}else(e.subtreeFlags&33554432)!==0&&Vp(e);e=e.sibling}}function Sd(e){if((e.subtreeFlags&18874368)!==0)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&(e.flags&18874368)!==0){var t=e.stateNode;t.paired!==null&&(t.paired=null,La(e.child,!1))}Sd(e)}e=e.sibling}}function Xr(e){if(e.tag===30)e.stateNode.paired=null,La(e.child,!1),Sd(e);else if((e.subtreeFlags&33554432)!==0)for(e=e.child;e!==null;)Xr(e),e=e.sibling;else Sd(e)}function Qp(e){for(e=e.child;e!==null;)e.tag===30?La(e.child,!1):(e.subtreeFlags&33554432)!==0&&Qp(e),e=e.sibling}function wd(e,t,n,a,i,r,f){for(var p=!1;t!==null;){if(t.tag===5){var T=t.stateNode;if(r!==null&&On<r.length){var R=r[On],$=ef(T);(R.view||$.view)&&(p=!0);var W;if(W=(e.flags&4)===0)if($.clip)W=!0;else{W=R.rect;var M=$.rect;W=W.y!==M.y||W.x!==M.x||W.height!==M.height||W.width!==M.width}W&&(e.flags|=4),$.abs?$=!R.abs:(R=R.rect,$=$.rect,$=R.height!==$.height||R.width!==$.width),$&&(e.flags|=32)}else e.flags|=32;(e.flags&4)!==0&&Xg(T,On===0?n:n+"_"+On,i),p&&(e.flags&4)!==0||(Da===null&&(Da=[]),Da.push(T,On===0?a:a+"_"+On,t.memoizedProps)),On++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&f?e.flags|=t.flags&32:wd(e,t.child,n,a,i,r,f)&&(p=!0));t=t.sibling}return p}function Kp(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,a=e.stateNode,i=Za(n,a),r=Pa(n.default,n.update),f;f=e.memoizedState,e.memoizedState=null,a=e;var p=e.child;On=0,i=wd(a,p,i,i,r,f,!1),(e.flags&4)!==0&&i&&ni(e,n.onUpdate)}else(e.subtreeFlags&33554432)!==0&&Kp(e);e=e.sibling}}var ln=!1,vt=!1,za=!1,Ad=!1,Zp=typeof WeakSet=="function"?WeakSet:Set,sn=null,Ua=!1,eo=!1,Yr=!1,Td=!1;function Pb(e,t,n){if(e=e.containerInfo,Zd=fi,e=Wh(e),uu(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var i=a.getSelection&&a.getSelection();if(i&&i.rangeCount!==0){a=i.anchorNode;var r=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{a.nodeType,f.nodeType}catch{a=null;break e}var p=0,T=-1,R=-1,$=0,W=0,M=e,I=null;t:for(;;){for(var ye;M!==a||r!==0&&M.nodeType!==3||(T=p+r),M!==f||i!==0&&M.nodeType!==3||(R=p+i),M.nodeType===3&&(p+=M.nodeValue.length),(ye=M.firstChild)!==null;)I=M,M=ye;for(;;){if(M===e)break t;if(I===a&&++$===r&&(T=p),I===f&&++W===i&&(R=p),(ye=M.nextSibling)!==null)break;M=I,I=M.parentNode}M=ye}a=T===-1||R===-1?null:{start:T,end:R}}else a=null}a=a||{start:0,end:0}}else a=null;for(Pd={focusedElem:e,selectionRange:a},fi=!1,n=(n&335544064)===n,sn=t,t=n?9270:1024;sn!==null;){if(e=sn,n&&(a=e.deletions,a!==null))for(r=0;r<a.length;r++)n&&xd(a[r]);if(e.alternate===null&&(e.flags&2)!==0)n&&Gp(e),Vr(n);else{if(e.tag===22){if(a=e.alternate,e.memoizedState!==null){a!==null&&a.memoizedState===null&&n&&xd(a),Vr(n);continue}else if(a!==null&&a.memoizedState!==null){n&&Gp(e),Vr(n);continue}}a=e.child,(e.subtreeFlags&t)!==0&&a!==null?(a.return=e,sn=a):(n&&Vp(e),Vr(n))}}Yn=null}function Vr(e){for(;sn!==null;){var t=sn,n=e,a=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if((i&1024)!==0&&a!==null){n=void 0,i=a.memoizedProps,a=a.memoizedState;var r=t.stateNode;try{var f=hs(t.type,i);n=r.getSnapshotBeforeUpdate(f,a),r.__reactInternalSnapshotBeforeUpdate=n}catch(p){wt(t,t.return,p)}}break;case 3:if((i&1024)!==0){if(a=t.stateNode.containerInfo,n=a.nodeType,n===9)af(a);else if(n===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":af(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&a!==null&&(n=Za(a.memoizedProps,a.stateNode),i=t.memoizedProps,i=Pa(i.default,i.update),i!=="none"&&Ks(a,n,i,a.memoizedState=[],!0));break;default:if((i&1024)!==0)throw Error(u(163))}if(a=t.sibling,a!==null){a.return=t.return,sn=a;break}sn=t.return}}function Pp(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:Ha(e,n),a&4&&Ji(5,n);break;case 1:if(Ha(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(f){wt(n,n.return,f)}else{var i=hs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){wt(n,n.return,f)}}a&64&&Hp(n),a&512&&Oa(n,n.return);break;case 3:if(Ha(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Nm(e,t)}catch(f){wt(n,n.return,f)}}break;case 27:t===null&&a&4&&$p(n);case 26:case 5:Ha(e,n),t===null&&a&4&&md(n),a&512&&Oa(n,n.return);break;case 12:Ha(e,n);break;case 31:Ha(e,n),a&4&&eg(e,n);break;case 13:Ha(e,n),a&4&&tg(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=rx.bind(null,n),Gx(e,n))));break;case 22:if(a=n.memoizedState!==null||ln,!a){var r=t!==null&&t.memoizedState!==null||vt;t=ln,i=vt,ln=a,(vt=r)&&!i?(a=2,(n.subtreeFlags&8772)!==0&&(a|=1),ba(e,n,a)):Ha(e,n),ln=t,vt=i}break;case 30:Ha(e,n),a&512&&Oa(n,n.return);break;case 7:a&512&&Oa(n,n.return);default:Ha(e,n)}}function kd(e,t){for(e=e.child;e!==null;)Fp(e,t),e=e.sibling}function Fp(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var a=n.style;typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"}else{var i=e.stateNode,r=e.memoizedProps.style,f=r!=null&&r.hasOwnProperty("display")?r.display:null;i.style.display=f==null||typeof f=="boolean"?"":(""+f).trim()}}catch(T){wt(e,e.return,T)}jd(e,t);break;case 6:try{e.stateNode.nodeValue=t?"":e.memoizedProps,ut=!0}catch(T){wt(e,e.return,T)}break;case 18:try{var p=e.stateNode;t?Gg(p,!0):Gg(e.stateNode,!1)}catch(T){wt(e,e.return,T)}break;case 22:case 23:e.memoizedState===null&&kd(e,t);break;default:kd(e,t)}}function jd(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){e:{var n=e,a=t;switch(n.tag){case 4:Fp(n,a);break e;case 22:n.memoizedState===null&&jd(n,a);break e;default:jd(n,a)}}e=e.sibling}}function Jp(e){var t=e.alternate;t!==null&&(e.alternate=null,Jp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ya(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Lt=null,Dn=!1;function ya(e,t,n){for(n=n.child;n!==null;)Wp(e,t,n),n=n.sibling}function Wp(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount=="function")try{Qe.onCommitFiberUnmount(Ye,n)}catch{}switch(n.tag){case 26:vt||dn(n,t),ya(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!vt&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:vt||dn(n,t),Wi(n);var a=Lt,i=Dn;zl(n.type)&&(Lt=n.stateNode,Dn=!1),ya(e,t,n),ay(n.stateNode,n.type,n.memoizedProps),Lt=a,Dn=i;break;case 5:vt||dn(n,t),Wi(n);case 6:if(n.tag===6&&Wi(n),a=Lt,i=Dn,Lt=null,ya(e,t,n),Lt=a,Dn=i,Lt!==null)if(Dn)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(n.stateNode),ut=!0}catch(r){wt(n,t,r)}else try{Lt.removeChild(n.stateNode),ut=!0}catch(r){wt(n,t,r)}break;case 18:Lt!==null&&(Dn?(e=Lt,$g(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),hi(e)):$g(Lt,n.stateNode));break;case 4:a=Lt,i=Dn,Lt=n.stateNode.containerInfo,Dn=!0,ya(e,t,n),Lt=a,Dn=i;break;case 0:case 11:case 14:case 15:Cl(2,n,t),vt||Cl(4,n,t),ya(e,t,n);break;case 1:vt||(dn(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Bp(n,t,a)),ya(e,t,n);break;case 21:ya(e,t,n);break;case 22:vt=(a=vt)||n.memoizedState!==null,ya(e,t,n),vt=a;break;case 30:dn(n,t),ya(e,t,n);break;case 7:vt||dn(n,t),ya(e,t,n);break;default:ya(e,t,n)}}function eg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hi(e)}catch(n){wt(t,t.return,n)}}}function tg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hi(e)}catch(n){wt(t,t.return,n)}}function Fb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zp),t;default:throw Error(u(435,e.tag))}}function Qr(e,t){var n=Fb(e);t.forEach(function(a){if(!n.has(a)){n.add(a);var i=cx.bind(null,e,a);a.then(i,i)}})}function jn(e,t,n){var a=t.deletions;if(a!==null)for(var i=0;i<a.length;i++){var r=a[i],f=e,p=t,T=p;e:for(;T!==null;){switch(T.tag){case 27:if(zl(T.type)){Lt=T.stateNode,Dn=!1;break e}break;case 5:Lt=T.stateNode,Dn=!1;break e;case 3:case 4:Lt=T.stateNode.containerInfo,Dn=!0;break e}T=T.return}if(Lt===null)throw Error(u(160));Wp(f,p,r),Lt=null,Dn=!1,f=r.alternate,f!==null&&(f.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ng(t,e,n),t=t.sibling}var va=null;function ng(e,t,n){var a=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(a=e.updateQueue,a=a!==null?a.events:null,a!==null))for(var r=0;r<a.length;r++){var f=a[r];f.ref.impl=f.nextImpl}jn(t,e,n),Nn(e),i&4&&(Cl(3,e,e.return),Ji(3,e),Cl(5,e,e.return));break;case 1:jn(t,e,n),Nn(e),i&512&&(vt||a===null||dn(a,a.return)),i&64&&ln&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(r=va,jn(t,e,n),Nn(e),i&512&&(vt||a===null||dn(a,a.return)),i&4)if(i=a!==null?a.memoizedState:null,n=e.memoizedState,a===null)if(n===null)if(e.stateNode===null)if(ln)e.stateNode=Bg(e.type,e.memoizedProps,t.containerInfo,e);else{e:{t=e.type,n=e.memoizedProps,i=r.ownerDocument||r;t:switch(t){case"title":a=i.getElementsByTagName("title")[0],(!a||a[pl]||a[zt]||a.namespaceURI==="http://www.w3.org/2000/svg"||a.hasAttribute("itemprop"))&&(a=i.createElement(t),i.head.insertBefore(a,i.querySelector("head > title"))),fn(a,t,n),a[zt]=e,xt(a),t=a;break e;case"link":if(r=cy("link","href",i).get(t+(n.href||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&a.getAttribute("rel")===(n.rel==null?null:n.rel)&&a.getAttribute("title")===(n.title==null?null:n.title)&&a.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){r.splice(f,1);break t}}a=i.createElement(t),fn(a,t,n),i.head.appendChild(a);break;case"meta":if(r=cy("meta","content",i).get(t+(n.content||""))){for(f=0;f<r.length;f++)if(a=r[f],a.getAttribute("content")===(n.content==null?null:""+n.content)&&a.getAttribute("name")===(n.name==null?null:n.name)&&a.getAttribute("property")===(n.property==null?null:n.property)&&a.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute("charset")===(n.charSet==null?null:n.charSet)){r.splice(f,1);break t}}a=i.createElement(t),fn(a,t,n),i.head.appendChild(a);break;default:throw Error(u(468,t))}a[zt]=e,xt(a),t=a}e.stateNode=t}else ln||df(r,e.type,e.stateNode);else e.stateNode=ry(r,n,e.memoizedProps);else i!==n?(i===null?(t=a.stateNode,t===null||vt||t.parentNode.removeChild(t)):i.count--,n===null?ln||df(r,e.type,e.stateNode):ry(r,n,e.memoizedProps)):n===null&&e.stateNode!==null&&pd(e,e.memoizedProps,a.memoizedProps);break;case 27:jn(t,e,n),Nn(e),i&512&&(vt||a===null||dn(a,a.return)),a!==null&&i&4&&pd(e,e.memoizedProps,a.memoizedProps);break;case 5:if(r=za,za=!1,jn(t,e,n),za=r,Nn(e),i&512&&(vt||a===null||dn(a,a.return)),e.flags&32){t=e.stateNode;try{It(t,""),ut=!0}catch($){wt(e,e.return,$)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,pd(e,t,a!==null?a.memoizedProps:t)),i&1024&&(Ad=!0);break;case 6:if(jn(t,e,n),Nn(e),i&4){if(e.stateNode===null)throw Error(u(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,ut=!0}catch($){wt(e,e.return,$)}}break;case 3:if(ut=!1,rc=null,r=va,va=co(t.containerInfo),jn(t,e,n),va=r,Nn(e),i&4&&a!==null&&a.memoizedState.isDehydrated)try{hi(t.containerInfo)}catch($){wt(e,e.return,$)}Ad&&(Ad=!1,ag(e)),ut=!1;break;case 4:i=za,za=ln,a=Jo(),r=va,va=co(e.stateNode.containerInfo),jn(t,e,n),Nn(e),va=r,ut&&eo&&(Yr=!0),ut=a,za=i;break;case 12:jn(t,e,n),Nn(e);break;case 31:jn(t,e,n),Nn(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 13:jn(t,e,n),Nn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Pr=yt()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 22:r=e.memoizedState!==null,f=a!==null&&a.memoizedState!==null;var p=ln,T=vt,R=za;ln=p||r,za=R||r,vt=T||f,jn(t,e,n),vt=T,za=R,ln=p,Nn(e),i&8192&&(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,!r||a===null||f||ln||vt||(t=f||vt,n=ln,a=vt,ln=r||ln,vt=t,Ml(e,2),ln=n,vt=a),!r&&za||kd(e,r)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Qr(e,n))));break;case 19:jn(t,e,n),Nn(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Qr(e,t)));break;case 30:i&512&&(vt||a===null||dn(a,a.return)),i=Jo(),r=eo,f=(n&335544064)===n,p=e.memoizedProps,eo=f&&Pa(p.default,p.update)!=="none",jn(t,e,n),Nn(e),f&&a!==null&&ut&&(e.flags|=4),eo=r,ut=i;break;case 21:break;case 7:i&512&&(vt||a===null||dn(a,a.return)),a&&a.stateNode!==null&&(a.stateNode._fragmentFiber=e);default:jn(t,e,n),Nn(e)}}function Nn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(qp(a)){n=a;break}a=a.return}a=null;for(var i=e.return;i!==null;){if(hd(i)){var r=i.stateNode;a===null?a=[r]:a.push(r)}if(fd(i))break;i=i.return}var f=a;if(n==null)throw Error(u(160));switch(n.tag){case 27:var p=n.stateNode,T=gd(e);qr(e,T,p,f);break;case 5:var R=n.stateNode;n.flags&32&&(It(R,""),n.flags&=-33);var $=gd(e);qr(e,$,R,f);break;case 3:case 4:var W=n.stateNode.containerInfo,M=gd(e);yd(e,M,W,f);break;default:throw Error(u(161))}}catch(I){wt(e,e.return,I)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ag(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ag(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,fi=!0,t.reset(),fi=!1),e=e.sibling}}function Zs(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)lg(t,e),t=t.sibling;else Kp(t)}function lg(e,t){var n=e.alternate;if(n===null)vd(e,!1);else switch(e.tag){case 3:if(Td=Ua=!1,Xp(),Zs(t,e),!Ua&&!Yr){if(e=Da,e!==null)for(var a=0;a<e.length;a+=3){n=e[a];var i=e[a+1];Yg(n,e[a+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+i+")"})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===""&&(e.style.viewTransitionName="none",e.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Td=!0}Da=null;break;case 5:Zs(t,e);break;case 4:a=Ua,Ua=!1,Zs(t,e),Ua&&(Yr=!0),Ua=a;break;case 22:e.memoizedState===null&&(n.memoizedState!==null?vd(e,!1):Zs(t,e));break;case 30:a=Ua,i=Xp(),Ua=!1,Zs(t,e),Ua&&(e.flags|=4);var r=e.memoizedProps,f=e.stateNode;t=Za(r,f),f=Za(n.memoizedProps,f);var p=Pa(r.default,r.update);p==="none"?t=!1:(r=n.memoizedState,n.memoizedState=null,n=e.child,On=0,t=wd(e,n,t,f,p,r,!0),On!==(r===null?0:r.length)&&(e.flags|=32)),(e.flags&4)!==0&&t?(ni(e,e.memoizedProps.onUpdate),Da=i):i!==null&&(i.push.apply(i,Da),Da=i),Ua=(e.flags&32)!==0?!0:a;break;default:Zs(t,e)}}function Ha(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Pp(e,t.alternate,t),t=t.sibling}function Ml(e,t){for(e=e.child;e!==null;){var n=e,a=t;switch(n.tag){case 0:case 11:case 14:case 15:Cl(4,n,n.return),Ml(n,a);break;case 1:dn(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount=="function"&&Bp(n,n.return,i),Ml(n,a);break;case 27:(a&2)!==0&&ay(n.stateNode,n.type,n.memoizedProps);case 5:dn(n,n.return),n.tag!==5&&n.tag!==27||Wi(n),Ml(n,a);break;case 6:Wi(n);break;case 26:dn(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||vt||i.parentNode.removeChild(i),Ml(n,a);break;case 22:n.memoizedState===null&&Ml(n,a);break;case 30:dn(n,n.return),Ml(n,a);break;case 7:dn(n,n.return);default:Ml(n,a)}e=e.sibling}}function ba(e,t,n){for(n=(t.subtreeFlags&8772)!==0?n:n&-2,t=t.child;t!==null;){var a=t.alternate,i=e,r=t,f=r.flags,p=(n&1)!==0;switch(r.tag){case 0:case 11:case 15:ba(i,r,n),Ji(4,r);break;case 1:if(ba(i,r,n),a=r,i=a.stateNode,typeof i.componentDidMount=="function")try{i.componentDidMount()}catch($){wt(a,a.return,$)}if(a=r,i=a.updateQueue,i!==null){var T=a.stateNode;try{var R=i.shared.hiddenCallbacks;if(R!==null)for(i.shared.hiddenCallbacks=null,i=0;i<R.length;i++)jm(R[i],T)}catch($){wt(a,a.return,$)}}p&&f&64&&Hp(r),Oa(r,r.return);break;case 27:(n&2)!==0&&$p(r);case 5:r.tag!==5&&r.tag!==27||Ip(r),ba(i,r,n),p&&a===null&&f&4&&md(r),Oa(r,r.return);break;case 6:Ip(r);break;case 26:T=r.stateNode,r.memoizedState!==null||T===null||ln||df(co(T.ownerDocument),r.type,T),ba(i,r,n),p&&a===null&&f&4&&md(r),Oa(r,r.return);break;case 12:ba(i,r,n);break;case 31:ba(i,r,n),p&&f&4&&eg(i,r);break;case 13:ba(i,r,n),p&&f&4&&tg(i,r);break;case 22:r.memoizedState===null&&ba(i,r,n),Oa(r,r.return);break;case 30:ba(i,r,n),Oa(r,r.return);break;case 7:Oa(r,r.return);default:ba(i,r,n)}t=t.sibling}}function Nd(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Bi(n))}function Ed(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Bi(e))}function ra(e,t,n,a){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)sg(e,t,n,a),t=t.sibling;else i&&Qp(t)}function sg(e,t,n,a){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Xr(t);var r=t.flags;switch(t.tag){case 0:case 11:case 15:ra(e,t,n,a),r&2048&&Ji(9,t);break;case 1:ra(e,t,n,a);break;case 3:ra(e,t,n,a),i&&Td&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,e.style.viewTransitionName==="root"&&(e.style.viewTransitionName=""),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName==="none"&&(e.style.viewTransitionName="")),r&2048&&(r=null,t.alternate!==null&&(r=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==r&&(t.refCount++,r!=null&&Bi(r)));break;case 12:if(r&2048){ra(e,t,n,a),r=t.stateNode;try{var f=t.memoizedProps,p=f.id,T=f.onPostCommit;typeof T=="function"&&T(p,t.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(R){wt(t,t.return,R)}}else ra(e,t,n,a);break;case 31:ra(e,t,n,a);break;case 13:ra(e,t,n,a);break;case 23:break;case 22:f=t.stateNode,p=t.alternate,t.memoizedState!==null?(i&&p!==null&&p.memoizedState===null&&Xr(p),f._visibility&2?ra(e,t,n,a):to(e,t)):(i&&p!==null&&p.memoizedState!==null&&Xr(t),f._visibility&2?ra(e,t,n,a):(f._visibility|=2,Ps(e,t,n,a,(t.subtreeFlags&10256)!==0||!1))),r&2048&&Nd(p,t);break;case 24:ra(e,t,n,a),r&2048&&Ed(t.alternate,t);break;case 30:i&&(r=t.alternate,r!==null&&(La(r.child,!0),La(t.child,!0))),ra(e,t,n,a);break;default:ra(e,t,n,a)}}function Ps(e,t,n,a,i){for(i=i&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var r=e,f=t,p=n,T=a,R=f.flags;switch(f.tag){case 0:case 11:case 15:Ps(r,f,p,T,i),Ji(8,f);break;case 23:break;case 22:var $=f.stateNode;f.memoizedState!==null?$._visibility&2?Ps(r,f,p,T,i):to(r,f):($._visibility|=2,Ps(r,f,p,T,i)),i&&R&2048&&Nd(f.alternate,f);break;case 24:Ps(r,f,p,T,i),i&&R&2048&&Ed(f.alternate,f);break;default:Ps(r,f,p,T,i)}t=t.sibling}}function to(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,i=a.flags;switch(a.tag){case 22:to(n,a),i&2048&&Nd(a.alternate,a);break;case 24:to(n,a),i&2048&&Ed(a.alternate,a);break;default:to(n,a)}t=t.sibling}}var ms=8192;function ps(e,t,n){if(e.subtreeFlags&ms)for(e=e.child;e!==null;)ig(e,t,n),e=e.sibling}function ig(e,t,n){switch(e.tag){case 26:ps(e,t,n),e.flags&ms&&(e.memoizedState!==null?aS(n,va,e.memoizedState,e.memoizedProps):(e=e.stateNode,(t&335544128)===t&&hy(n,e)));break;case 5:ps(e,t,n),e.flags&ms&&(e=e.stateNode,(t&335544128)===t&&hy(n,e));break;case 3:case 4:var a=va;va=co(e.stateNode.containerInfo),ps(e,t,n),va=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=ms,ms=16777216,ps(e,t,n),ms=a):ps(e,t,n));break;case 30:if((e.flags&ms)!==0&&(a=e.memoizedProps.name,a!=null&&a!=="auto")){var i=e.stateNode;i.paired=null,Yn===null&&(Yn=new Map),Yn.set(a,i)}ps(e,t,n);break;default:ps(e,t,n)}}function og(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function no(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,cg(a,e)}og(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)rg(e),e=e.sibling}function rg(e){switch(e.tag){case 0:case 11:case 15:no(e),e.flags&2048&&Cl(9,e,e.return);break;case 3:no(e);break;case 12:no(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kr(e)):no(e);break;default:no(e)}}function Kr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];sn=a,cg(a,e)}og(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Cl(8,t,t.return),Kr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kr(t));break;default:Kr(t)}e=e.sibling}}function cg(e,t){for(;sn!==null;){var n=sn;switch(n.tag){case 0:case 11:case 15:Cl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var a=n.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Bi(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,sn=a;else e:for(n=e;sn!==null;){a=sn;var i=a.sibling,r=a.return;if(Jp(a),a===n){sn=null;break e}if(i!==null){i.return=r,sn=i;break e}sn=r}}}var Jb={getCacheForType:function(e){var t=rn(Kt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return rn(Kt).controller.signal}},Wb=typeof WeakMap=="function"?WeakMap:Map,gt=0,Mt=null,st=null,ot=0,St=0,Vn=null,_l=!1,Fs=!1,Cd=!1,sl=0,$t=0,Rl=0,gs=0,Zr=0,Qn=0,Js=0,ao=null,Ln=null,Md=!1,Pr=0,ug=0,Fr=1/0,Jr=null,Ol=null,Ht=0,xa=null,ys=null,Ba=0,_d=0,Rd=null,dg=null,Ws=null,ei=null,ti=null,lo=0,Wr=null;function Kn(){return(gt&2)!==0&&ot!==0?ot&-ot:Se.T!==null?$d():ml()}function fg(){if(Qn===0)if((ot&536870912)===0||tt){var e=ha;ha<<=1,(ha&3932160)===0&&(ha=262144),Qn=e}else Qn=536870912;return e=cn.current,e!==null&&(e.flags|=32),Qn}function ni(e,t){if(t!=null){var n=e.stateNode,a=n.ref;a===null&&(a=n.ref=Vg(Za(e.memoizedProps,n))),ei===null&&(ei=[]),ei.push(t.bind(null,a))}}function zn(e,t,n){(e===Mt&&(St===2||St===9)||e.cancelPendingCommit!==null)&&(ai(e,0),Dl(e,ot,Qn,!1)),lt(e,n),((gt&2)===0||e!==Mt)&&(e===Mt&&((gt&2)===0&&(gs|=n),$t===4&&Dl(e,ot,Qn,!1)),Ia(e))}function hg(e,t,n){if((gt&6)!==0)throw Error(u(327));var a=!n&&(t&127)===0&&(t&e.expiredLanes)===0||xe(e,t),i=a?nx(e,t):Dd(e,t,!0),r=a;do{if(i===0){Fs&&!a&&Dl(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!ex(n)){i=Dd(e,t,!1),r=!1;continue}if(i===2){if(r=t,e.errorRecoveryDisabledLanes&r)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var p=e;i=ao;var T=p.current.memoizedState.isDehydrated;if(T&&(ai(p,f).flags|=256),f=Dd(p,f,!1),f!==2&&f!==6){if(Cd&&!T){p.errorRecoveryDisabledLanes|=r,gs|=r,i=4;break e}r=Ln,Ln=i,r!==null&&(Ln===null?Ln=r:Ln.push.apply(Ln,r))}i=f}if(r=!1,i!==2)continue}}if(i===1){ai(e,0),Dl(e,t,0,!0);break}e:{switch(a=e,r=i,r){case 0:case 1:throw Error(u(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Dl(a,t,Qn,!_l);break e;case 2:Ln=null;break;case 3:case 5:break;default:throw Error(u(329))}if((t&62914560)===t&&(i=Pr+300-yt(),10<i)){if(Dl(a,t,Qn,!_l),ge(a,0,!0)!==0)break e;Ba=t,a.timeoutHandle=Wd(mg.bind(null,a,n,Ln,Jr,Md,t,Qn,gs,Js,_l,r,"Throttled",-0,0),i);break e}mg(a,n,Ln,Jr,Md,t,Qn,gs,Js,_l,r,null,-0,0)}}break}while(!0);Ia(e)}function mg(e,t,n,a,i,r,f,p,T,R,$,W,M,I){e.timeoutHandle=-1;var ye=t.subtreeFlags,Me=(r&335544064)===r;if(W=null,(Me||ye&8192||(ye&16785408)===16785408)&&(W={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ma},Yn=null,ig(t,r,W),Me&&(ye=W,Me=e.containerInfo,Me=(Me.nodeType===9?Me:Me.ownerDocument).__reactViewTransition,Me!=null&&(ye.count++,ye.waitingForViewTransition=!0,ye=ho.bind(ye),Me.finished.then(ye,ye))),ye=(r&62914560)===r?Pr-yt():(r&4194048)===r?ug-yt():0,ye=lS(W,ye),ye!==null)){Ba=r,e.cancelPendingCommit=ye(wg.bind(null,e,t,r,n,a,i,f,p,T,R,$,W,null,M,I)),Dl(e,r,f,!R);return}wg(e,t,r,n,a,i,f,p,T,R,$,W)}function ex(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var a=0;a<n.length;a++){var i=n[a],r=i.getSnapshot;i=i.value;try{if(!Gn(r(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Dl(e,t,n,a){t=et(e,t),t&=~Zr,t&=~gs,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var i=t;0<i;){var r=31-jt(i),f=1<<r;a[r]=-1,i&=~f}n!==0&&In(e,n,t)}function ec(){return(gt&6)===0?(so(0),!1):!0}function Od(){if(st!==null){if(St===0)var e=st.return;else e=st,Wa=ls=null,qu(e),Gs=null,$i=0,e=st;for(;e!==null;)Up(e.alternate,e),e=e.return;st=null}}function ai(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Tx(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ba=0,Od(),Mt=e,st=n=Fa(e.current,null),ot=t,St=0,Vn=null,_l=!1,Fs=xe(e,t),Cd=!1,Js=Qn=Zr=gs=Rl=$t=0,Ln=ao=null,Md=!1,sl=et(e,t),rr(),n}function pg(e,t){Fe=null,Se.H=Or,t===$s||t===br?(t=wm(),St=3):t===Eu?(t=wm(),St=4):St=t===nd?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Vn=t,st===null&&($t=1,Dr(e,la(t,e.current)))}function gg(){var e=cn.current;return e===null?!0:(ot&4194048)===ot?xn===null:(ot&62914560)===ot||(ot&536870912)!==0?e===xn:!1}function yg(){var e=Se.H;return Se.H=Or,e===null?Or:e}function vg(){var e=Se.A;return Se.A=Jb,e}function tc(){$t=4,_l||(ot&4194048)!==ot&&cn.current!==null||(Fs=!0),(Rl&134217727)===0&&(gs&134217727)===0||Mt===null||Dl(Mt,ot,Qn,!1)}function Dd(e,t,n){var a=gt;gt|=2;var i=yg(),r=vg();(Mt!==e||ot!==t)&&(Jr=null,ai(e,t)),t=!1;var f=$t;e:do try{if(St!==0&&st!==null){var p=st,T=Vn;switch(St){case 8:Od(),f=6;break e;case 3:case 2:case 9:case 6:cn.current===null&&(t=!0);var R=St;if(St=0,Vn=null,li(e,p,T,R),n&&Fs){f=0;break e}break;default:R=St,St=0,Vn=null,li(e,p,T,R)}}tx(),f=$t;break}catch($){pg(e,$)}while(!0);return t&&e.shellSuspendCounter++,Wa=ls=null,gt=a,Se.H=i,Se.A=r,st===null&&(Mt=null,ot=0,rr()),f}function tx(){for(;st!==null;)bg(st)}function nx(e,t){var n=gt;gt|=2;var a=yg(),i=vg();Mt!==e||ot!==t?(Jr=null,Fr=yt()+500,ai(e,t)):Fs=xe(e,t);e:do try{if(St!==0&&st!==null){t=st;var r=Vn;t:switch(St){case 1:St=0,Vn=null,li(e,t,r,1);break;case 2:case 9:if(xm(r)){St=0,Vn=null,xg(t);break}t=function(){St!==2&&St!==9||Mt!==e||(St=7),Ia(e)},r.then(t,t);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:xm(r)?(St=0,Vn=null,xg(t)):(St=0,Vn=null,li(e,t,r,7));break;case 5:var f=null;switch(st.tag){case 26:f=st.memoizedState;case 5:case 27:var p=st;if(f?dy(f):p.stateNode.complete){St=0,Vn=null;var T=p.sibling;if(T!==null)st=T;else{var R=p.return;R!==null?(st=R,nc(R)):st=null}break t}}St=0,Vn=null,li(e,t,r,5);break;case 6:St=0,Vn=null,li(e,t,r,6);break;case 8:Od(),$t=6;break e;default:throw Error(u(462))}}ax();break}catch($){pg(e,$)}while(!0);return Wa=ls=null,Se.H=a,Se.A=i,gt=n,st!==null?0:(Mt=null,ot=0,rr(),$t)}function ax(){for(;st!==null&&!An();)bg(st)}function bg(e){var t=Lp(e.alternate,e,sl);e.memoizedProps=e.pendingProps,t===null?nc(e):st=t}function xg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Ep(n,t,t.pendingProps,t.type,void 0,ot);break;case 11:t=Ep(n,t,t.pendingProps,t.type.render,t.ref,ot);break;case 5:qu(t);var a=t;a===an&&(tt?(mr(a),a.tag===5&&a.stateNode!=null&&(_t=a.stateNode)):(mr(a),tt=!0));default:Up(n,t),t=st=cm(t,sl),t=Lp(n,t,sl)}e.memoizedProps=e.pendingProps,t===null?nc(e):st=t}function li(e,t,n,a){Wa=ls=null,qu(t),Gs=null,$i=0;var i=t.return;try{if(Xb(e,i,t,n,ot)){$t=1,Dr(e,la(n,e.current)),st=null;return}}catch(r){if(i!==null)throw st=i,r;$t=1,Dr(e,la(n,e.current)),st=null;return}t.flags&32768?(tt||a===1?e=!0:Fs||(ot&536870912)!==0?e=!1:(_l=e=!0,(a===2||a===9||a===3||a===6)&&(a=cn.current,a!==null&&a.tag===13&&(a.flags|=16384))),Sg(t,e)):nc(t)}function nc(e){var t=e;do{if((t.flags&32768)!==0){Sg(t,_l);return}e=t.return;var n=Kb(t.alternate,t,sl);if(n!==null){st=n;return}if(t=t.sibling,t!==null){st=t;return}st=t=e}while(t!==null);$t===0&&($t=5)}function Sg(e,t){do{var n=Zb(e.alternate,e);if(n!==null){n.flags&=32767,st=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){st=e;return}st=e=n}while(e!==null);$t=6,st=null}function wg(e,t,n,a,i,r,f,p,T,R,$,W){e.cancelPendingCommit=null;do ac();while(Ht!==0);if((gt&6)!==0)throw Error(u(327));if(t!==null){if(t===e.current)throw Error(u(177));e===Mt&&(st=Mt=null,ot=0),ys=t,xa=e,Ba=n,Rd=i,dg=a,lx(e,t,n,f,p,T,W)}}function lx(e,t,n,a,i,r,f){var p=t.lanes|t.childLanes;if(_d=p,p|=pu,Bt(e,n,p,a,i,r),ei=null,(n&335544064)===n?(ti=Rb(e),a=10262):(ti=null,a=10256),(t.subtreeFlags&a)!==0||(t.flags&a)!==0?(e.callbackNode=null,e.callbackPriority=0,ux(Cn,function(){return Hd(),null})):(e.callbackNode=null,e.callbackPriority=0),$r=!1,a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=Se.T,Se.T=null,i=_e.p,_e.p=2,r=gt,gt|=4;try{Pb(e,t,n)}finally{gt=r,_e.p=i,Se.T=a}}Ht=1,$r?Ws=Mx(f,e.containerInfo,ti,Ld,zd,ix,Ud,Hd,sx):(Ld(),zd(),Ud())}function sx(e){if(Ht!==0){var t=xa.onRecoverableError;t(e,{componentStack:null})}}function ix(){Ht===3&&(Ht=0,lg(ys,xa),Ht=4)}function Ld(){if(Ht===1){Ht=0;var e=xa,t=ys,n=Ba,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=Se.T,Se.T=null;var i=_e.p;_e.p=2;var r=gt;gt|=4;try{eo=Yr=!1,ng(t,e,n),n=Pd;var f=Wh(e.containerInfo),p=n.focusedElem,T=n.selectionRange;if(f!==p&&p&&p.ownerDocument&&Jh(p.ownerDocument.documentElement,p)){if(T!==null&&uu(p)){var R=T.start,$=T.end;if($===void 0&&($=R),"selectionStart"in p)p.selectionStart=R,p.selectionEnd=Math.min($,p.value.length);else{var W=p.ownerDocument||document,M=W&&W.defaultView||window;if(M.getSelection){var I=M.getSelection(),ye=p.textContent.length,Me=Math.min(T.start,ye),Je=T.end===void 0?Me:Math.min(T.end,ye);!I.extend&&Me>Je&&(f=Je,Je=Me,Me=f);var _=Fh(p,Me),E=Fh(p,Je);if(_&&E&&(I.rangeCount!==1||I.anchorNode!==_.node||I.anchorOffset!==_.offset||I.focusNode!==E.node||I.focusOffset!==E.offset)){var H=W.createRange();H.setStart(_.node,_.offset),I.removeAllRanges(),Me>Je?(I.addRange(H),I.extend(E.node,E.offset)):(H.setEnd(E.node,E.offset),I.addRange(H))}}}}for(W=[],I=p;I=I.parentNode;)I.nodeType===1&&W.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<W.length;p++){var J=W[p];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}fi=!!Zd,Pd=Zd=null}finally{gt=r,_e.p=i,Se.T=a}}e.current=t,Ht=2}}function zd(){if(Ht===2){Ht=0;var e=xa,t=ys,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=Se.T,Se.T=null;var a=_e.p;_e.p=2;var i=gt;gt|=4;try{Pp(e,t.alternate,t)}finally{gt=i,_e.p=a,Se.T=n}}Ht=3}}function Ud(){if(Ht===4||Ht===3){Ht=0;var e=Ws;Ws=null,nn();var t=xa,n=ys,a=Ba,i=dg,r=(a&335544064)===a?10262:10256;if((n.subtreeFlags&r)!==0||(n.flags&r)!==0?Ht=5:(Ht=0,ys=xa=null,Ag(t,t.pendingLanes)),r=t.pendingLanes,r===0&&(Ol=null),Ea(a),n=n.stateNode,Qe&&typeof Qe.onCommitFiberRoot=="function")try{Qe.onCommitFiberRoot(Ye,n,void 0,(n.current.flags&128)===128)}catch{}if(i!==null){n=Se.T,r=_e.p,_e.p=2,Se.T=null;try{for(var f=t.onRecoverableError,p=0;p<i.length;p++){var T=i[p];f(T.value,{componentStack:T.stack})}}finally{Se.T=n,_e.p=r}}if(i=ei,f=ti,ti=null,i!==null&&(ei=null,f===null&&(f=[]),e!==null))for(T=0;T<i.length;T++)n=(0,i[T])(f),n!==void 0&&e.finished.finally(n);(Ba&3)!==0&&ac(),Ia(t),r=t.pendingLanes,(a&261930)!==0&&(r&42)!==0?t===Wr?lo++:(lo=0,Wr=t):(lo=0,Wr=null),so(0)}}function Ag(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Bi(t)))}function ac(){return Ws!==null&&(Ws.skipTransition(),Ws=null),Ld(),zd(),Ud(),Hd()}function Hd(){if(Ht!==5)return!1;var e=xa,t=_d;_d=0;var n=Ea(Ba),a=Se.T,i=_e.p;try{_e.p=32>n?32:n,Se.T=null,n=Rd,Rd=null;var r=xa,f=Ba;if(Ht=0,ys=xa=null,Ba=0,(gt&6)!==0)throw Error(u(331));var p=gt;if(gt|=4,rg(r.current),sg(r,r.current,f,n),gt=p,so(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot=="function")try{Qe.onPostCommitFiberRoot(Ye,r)}catch{}return!0}finally{_e.p=i,Se.T=a,Ag(e,t)}}function Tg(e,t,n){t=la(n,t),t=td(e.stateNode,t,2),e=kl(e,t,2),e!==null&&(lt(e,2),Ia(e))}function wt(e,t,n){if(e.tag===3)Tg(e,e,n);else for(;t!==null;){if(t.tag===3){Tg(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ol===null||!Ol.has(a))){e=la(n,e),n=xp(2),a=kl(t,n,2),a!==null&&(Sp(n,a,t,e),lt(a,2),Ia(a));break}}t=t.return}}function Bd(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new Wb;var i=new Set;a.set(t,i)}else i=a.get(t),i===void 0&&(i=new Set,a.set(t,i));i.has(n)||(Cd=!0,i.add(n),e=ox.bind(null,e,t,n),t.then(e,e))}function ox(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Mt===e&&(ot&n)===n&&(($t===4||$t===3&&(ot&62914560)===ot&&300>yt()-Pr)&&(gt&2)===0?ai(e,0):Zr|=n,Js===ot&&(Js=0)),Ia(e)}function kg(e,t){t===0&&(t=at()),e=ts(e,t),e!==null&&(lt(e,t),Ia(e))}function rx(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),kg(e,n)}function cx(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(u(314))}a!==null&&a.delete(t),kg(e,n)}function ux(e,t){return Bn(e,t)}var si=null,ii=null,Id=!1,lc=!1,qd=!1,Ll=0;function Ia(e){e!==ii&&e.next===null&&(ii===null?si=ii=e:ii=ii.next=e),lc=!0,Id||(Id=!0,fx())}function so(e,t){if(!qd&&lc){qd=!0;do for(var n=!1,a=si;a!==null;){if(e!==0){var i=a.pendingLanes;if(i===0)var r=0;else{var f=a.suspendedLanes,p=a.pingedLanes;r=(1<<31-jt(42|e)+1)-1,r&=i&~(f&~p),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,Cg(a,r))}else r=ot,r=ge(a,a===Mt?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(r&3)===0||xe(a,r)||(n=!0,Cg(a,r));a=a.next}while(n);qd=!1}}function dx(){jg()}function jg(){lc=Id=!1;var e=0;Ll!==0&&Ax()&&(e=Ll);for(var t=yt(),n=null,a=si;a!==null;){var i=a.next,r=Ng(a,t);r===0?(a.next=null,n===null?si=i:n.next=i,i===null&&(ii=n)):(n=a,(e!==0||(r&3)!==0)&&(lc=!0)),a=i}Ht!==0&&Ht!==5||so(e),Ll!==0&&(Ll=0)}function Ng(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,i=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var f=31-jt(r),p=1<<f,T=i[f];T===-1?((p&n)===0||(p&a)!==0)&&(i[f]=ct(p,t)):T<=t&&(e.expiredLanes|=p),r&=~p}if(t=Mt,n=ot,n=ge(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(St===2||St===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&ka(a),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||xe(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&ka(a),Ea(n)){case 2:case 8:n=vn;break;case 32:n=Cn;break;case 268435456:n=ue;break;default:n=Cn}return a=Eg.bind(null,e),n=Bn(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&ka(a),e.callbackPriority=2,e.callbackNode=null,2}function Eg(e,t){if(Ht!==0&&Ht!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ac()&&e.callbackNode!==n)return null;var a=ot;return a=ge(e,e===Mt?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(hg(e,a,t),Ng(e,yt()),e.callbackNode!=null&&e.callbackNode===n?Eg.bind(null,e):null)}function Cg(e,t){if(ac())return null;hg(e,t,!0)}function fx(){kx(function(){(gt&6)!==0?Bn(yn,dx):jg()})}function $d(){if(Ll===0){var e=os;e===0&&(e=ja,ja<<=1,(ja&261888)===0&&(ja=256)),Ll=e}return Ll}function Mg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:er(e)}function hx(e,t,n,a,i){if(t==="submit"&&n&&n.stateNode===i){var r=Mg((i[Ut]||null).action),f=a.submitter;f&&(t=(t=f[Ut]||null)?Mg(t.formAction):f.getAttribute("formAction"),t!==null&&(r=t,f=null));var p=new lr("action","action",null,a,i);e.push({event:p,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Ll!==0){var T=new FormData(i,f);Pu(n,{pending:!0,data:T,method:i.method,action:r},null,T)}}else typeof r=="function"&&(p.preventDefault(),T=new FormData(i,f),Pu(n,{pending:!0,data:T,method:i.method,action:r},r,T))},currentTarget:i}]})}}for(var Gd=0;Gd<mu.length;Gd++){var Xd=mu[Gd],mx=Xd.toLowerCase(),px=Xd[0].toUpperCase()+Xd.slice(1);ga(mx,"on"+px)}ga(nm,"onAnimationEnd"),ga(am,"onAnimationIteration"),ga(lm,"onAnimationStart"),ga("dblclick","onDoubleClick"),ga("focusin","onFocus"),ga("focusout","onBlur"),ga(Tb,"onTransitionRun"),ga(kb,"onTransitionStart"),ga(jb,"onTransitionCancel"),ga(sm,"onTransitionEnd"),qn("onMouseEnter",["mouseout","mouseover"]),qn("onMouseLeave",["mouseout","mouseover"]),qn("onPointerEnter",["pointerout","pointerover"]),qn("onPointerLeave",["pointerout","pointerover"]),Ca("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ca("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ca("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ca("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ca("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ca("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var io="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(" "),gx=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(io));function _g(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],i=a.event;a=a.listeners;e:{var r=void 0;if(t)for(var f=a.length-1;0<=f;f--){var p=a[f],T=p.instance,R=p.currentTarget;if(p=p.listener,T!==r&&i.isPropagationStopped())break e;r=p,i.currentTarget=R;try{r(i)}catch($){or($)}i.currentTarget=null,r=T}else for(f=0;f<a.length;f++){if(p=a[f],T=p.instance,R=p.currentTarget,p=p.listener,T!==r&&i.isPropagationStopped())break e;r=p,i.currentTarget=R;try{r(i)}catch($){or($)}i.currentTarget=null,r=T}}}}function it(e,t){var n=t[Xo];n===void 0&&(n=t[Xo]=new Set);var a=e+"__bubble";n.has(a)||(Rg(t,e,2,!1),n.add(a))}function Yd(e,t,n){var a=0;t&&(a|=4),Rg(n,e,a,t)}var sc="_reactListening"+Math.random().toString(36).slice(2);function Vd(e){if(!e[sc]){e[sc]=!0,Fl.forEach(function(n){n!=="selectionchange"&&(gx.has(n)||Yd(n,!1,e),Yd(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[sc]||(t[sc]=!0,Yd("selectionchange",!1,t))}}function Rg(e,t,n,a){switch(Sy(t)){case 2:var i=rS;break;case 8:i=cS;break;default:i=hf}n=i.bind(null,t,n,e),i=void 0,!eu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),a?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Qd(e,t,n,a,i){var r=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var f=a.tag;if(f===3||f===4){var p=a.stateNode.containerInfo;if(p===i)break;if(f===4)for(f=a.return;f!==null;){var T=f.tag;if((T===3||T===4)&&f.stateNode.containerInfo===i)return;f=f.return}for(;p!==null;){if(f=ma(p),f===null)return;if(T=f.tag,T===5||T===6||T===26||T===27){a=r=f;continue e}p=p.parentNode}}a=a.return}Rh(function(){var R=r,$=Jc(n),W=[];e:{var M=im.get(e);if(M!==void 0){var I=lr,ye=e;switch(e){case"keypress":if(nr(n)===0)break e;case"keydown":case"keyup":I=eb;break;case"focusin":ye="focus",I=lu;break;case"focusout":ye="blur",I=lu;break;case"beforeblur":case"afterblur":I=lu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":I=Lh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":I=$0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":I=sb;break;case nm:case am:case lm:I=Y0;break;case sm:I=ob;break;case"scroll":case"scrollend":I=I0;break;case"wheel":I=cb;break;case"copy":case"cut":case"paste":I=Q0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":I=Uh;break;case"submit":I=ab;break;case"toggle":case"beforetoggle":I=db}var Me=(t&4)!==0,Je=!Me&&(e==="scroll"||e==="scrollend"),_=Me?M!==null?M+"Capture":null:M;Me=[];for(var E=R,H;E!==null;){var J=E;if(H=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||H===null||_===null||(J=Ei(E,_),J!=null&&Me.push(oo(E,J,H))),Je)break;E=E.return}0<Me.length&&(M=new I(M,ye,null,n,$),W.push({event:M,listeners:Me}))}}if((t&7)===0){e:{if(I=e==="mouseover"||e==="pointerover",M=e==="mouseout"||e==="pointerout",I&&n!==Fc&&(ye=n.relatedTarget||n.fromElement)&&(ma(ye)||ye[_n]))break e;(M||I)&&(ye=$.window===$?$:(I=$.ownerDocument)?I.defaultView||I.parentWindow:window,M?(I=n.relatedTarget||n.toElement,M=R,I=I?ma(I):null,I!==null&&(Je=h(I),Me=I.tag,I!==Je||Me!==5&&Me!==27&&Me!==6)&&(I=null)):(M=null,I=R),M!==I&&(Me=Lh,J="onMouseLeave",_="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(Me=Uh,J="onPointerLeave",_="onPointerEnter",E="pointer"),Je=M==null?ye:ta(M),H=I==null?ye:ta(I),ye=new Me(J,E+"leave",M,n,$),ye.target=Je,ye.relatedTarget=H,J=null,ma($)===R&&(Me=new Me(_,E+"enter",I,n,$),Me.target=H,Me.relatedTarget=Je,J=Me),Je=J,Me=M&&I?O(M,I,yx):null,M!==null&&Og(W,ye,M,Me,!1),I!==null&&Je!==null&&Og(W,Je,I,Me,!0)))}e:{if(M=R?ta(R):window,I=M.nodeName&&M.nodeName.toLowerCase(),I==="select"||I==="input"&&M.type==="file")var Ne=Yh;else if(Gh(M))if(Vh)Ne=Sb;else{Ne=bb;var rt=vb}else I=M.nodeName,!I||I.toLowerCase()!=="input"||M.type!=="checkbox"&&M.type!=="radio"?R&&Pc(R.elementType)&&(Ne=Yh):Ne=xb;if(Ne&&(Ne=Ne(e,R))){Xh(W,Ne,n,$);break e}rt&&rt(e,M,R)}switch(rt=R?ta(R):window,e){case"focusin":(Gh(rt)||rt.contentEditable==="true")&&(Ds=rt,du=R,zi=null);break;case"focusout":zi=du=Ds=null;break;case"mousedown":fu=!0;break;case"contextmenu":case"mouseup":case"dragend":fu=!1,em(W,n,$);break;case"selectionchange":if(Ab)break;case"keydown":case"keyup":em(W,n,$)}var Le;if(iu)e:{switch(e){case"compositionstart":var Xe="onCompositionStart";break e;case"compositionend":Xe="onCompositionEnd";break e;case"compositionupdate":Xe="onCompositionUpdate";break e}Xe=void 0}else Os?qh(e,n)&&(Xe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Xe="onCompositionStart");Xe&&(Hh&&n.locale!=="ko"&&(Os||Xe!=="onCompositionStart"?Xe==="onCompositionEnd"&&Os&&(Le=Oh()):(gl=$,tu="value"in gl?gl.value:gl.textContent,Os=!0)),rt=ic(R,Xe),0<rt.length&&(Xe=new zh(Xe,e,null,n,$),W.push({event:Xe,listeners:rt}),Le?Xe.data=Le:(Le=$h(n),Le!==null&&(Xe.data=Le)))),(Le=hb?mb(e,n):pb(e,n))&&(Xe=ic(R,"onBeforeInput"),0<Xe.length&&(rt=new zh("onBeforeInput","beforeinput",null,n,$),W.push({event:rt,listeners:Xe}),rt.data=Le)),hx(W,e,R,n,$)}_g(W,t)})}function oo(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ic(e,t){for(var n=t+"Capture",a=[];e!==null;){var i=e,r=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||r===null||(i=Ei(e,n),i!=null&&a.unshift(oo(e,i,r)),i=Ei(e,t),i!=null&&a.push(oo(e,i,r))),e.tag===3)return a;e=e.return}return[]}function yx(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Og(e,t,n,a,i){for(var r=t._reactName,f=[];n!==null&&n!==a;){var p=n,T=p.alternate,R=p.stateNode;if(p=p.tag,T!==null&&T===a)break;p!==5&&p!==26&&p!==27||R===null||(T=R,i?(R=Ei(n,r),R!=null&&f.unshift(oo(n,R,T))):i||(R=Ei(n,r),R!=null&&f.push(oo(n,R,T)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var vx=/\r\n?/g,bx=/\u0000|\uFFFD/g;function Dg(e){return(typeof e=="string"?e:""+e).replace(vx,`
49
+ `).replace(bx,"")}function Lg(e,t){return t=Dg(t),Dg(e)===t}function At(e,t,n,a,i,r){switch(n){case"children":if(typeof a=="string")t==="body"||t==="textarea"&&a===""||It(e,a);else if(typeof a=="number"||typeof a=="bigint")t!=="body"&&It(e,""+a);else return;break;case"className":Va(e,"class",a);break;case"tabIndex":Va(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Va(e,n,a);break;case"style":Mh(e,a,r);return;case"data":if(t!=="object"){Va(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=er(a),e.setAttribute(n,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof r=="function"&&(n==="formAction"?(t!=="input"&&At(e,t,"name",i.name,i,null),At(e,t,"formEncType",i.formEncType,i,null),At(e,t,"formMethod",i.formMethod,i,null),At(e,t,"formTarget",i.formTarget,i,null)):(At(e,t,"encType",i.encType,i,null),At(e,t,"method",i.method,i,null),At(e,t,"target",i.target,i,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=er(a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Ma);return;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}n=er(a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":a===!0?e.setAttribute(n,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(n,a):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(n,a):e.removeAttribute(n);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(n):e.setAttribute(n,a);break;case"popover":it("beforetoggle",e),it("toggle",e),Jl(e,"popover",a);break;case"xlinkActuate":$n(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":$n(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":$n(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":$n(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":$n(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":$n(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":$n(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":$n(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":$n(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Jl(e,"is",a);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=H0.get(n)||n,Jl(e,n,a);else return}ut=!0}function Kd(e,t,n,a,i,r){switch(n){case"style":Mh(e,a,r);return;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(u(61));if(n=a.__html,n!=null){if(i.children!=null)throw Error(u(60));(r!=null?r.__html:void 0)!==n&&(e.innerHTML=n)}}break;case"children":if(typeof a=="string")It(e,a);else if(typeof a=="number"||typeof a=="bigint")It(e,""+a);else return;break;case"onScroll":a!=null&&it("scroll",e);return;case"onScrollEnd":a!=null&&it("scrollend",e);return;case"onClick":a!=null&&(e.onclick=Ma);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Ko.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(i=n.endsWith("Capture"),r=n.slice(2,i?n.length-7:void 0),t=e[Ut]||null,t=t!=null?t[n]:null,typeof t=="function"&&e.removeEventListener(r,t,i),typeof a=="function")){typeof t!="function"&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(r,a,i);break e}ut=!0,n in e?e[n]=a:a===!0?e.setAttribute(n,""):Jl(e,n,a)}return}ut=!0}function fn(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",e),it("load",e);var a=!1,i=!1,r;for(r in n)if(n.hasOwnProperty(r)){var f=n[r];if(f!=null)switch(r){case"src":a=!0;break;case"srcSet":i=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:At(e,t,r,f,n,null)}}i&&At(e,t,"srcSet",n.srcSet,n,null),a&&At(e,t,"src",n.src,n,null);return;case"input":it("invalid",e);var p=r=f=i=null,T=null,R=null;for(a in n)if(n.hasOwnProperty(a)){var $=n[a];if($!=null)switch(a){case"name":i=$;break;case"type":f=$;break;case"checked":T=$;break;case"defaultChecked":R=$;break;case"value":r=$;break;case"defaultValue":p=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(u(137,t));break;default:At(e,t,a,$,n,null)}}Ot(e,r,p,T,R,f,i,!1);return;case"select":it("invalid",e),a=f=r=null;for(i in n)if(n.hasOwnProperty(i)&&(p=n[i],p!=null))switch(i){case"value":r=p;break;case"defaultValue":f=p;break;case"multiple":a=p;default:At(e,t,i,p,n,null)}t=r,n=f,e.multiple=!!a,t!=null?Qt(e,!!a,t,!1):n!=null&&Qt(e,!!a,n,!0);return;case"textarea":it("invalid",e),r=i=a=null;for(f in n)if(n.hasOwnProperty(f)&&(p=n[f],p!=null))switch(f){case"value":a=p;break;case"defaultValue":i=p;break;case"children":r=p;break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(u(91));break;default:At(e,t,f,p,n,null)}Ms(e,a,i,r);return;case"option":for(T in n)if(n.hasOwnProperty(T)&&(a=n[T],a!=null))switch(T){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:At(e,t,T,a,n,null)}return;case"dialog":it("beforetoggle",e),it("toggle",e),it("cancel",e),it("close",e);break;case"iframe":case"object":it("load",e);break;case"video":case"audio":for(a=0;a<io.length;a++)it(io[a],e);break;case"image":it("error",e),it("load",e);break;case"details":it("toggle",e);break;case"embed":case"source":case"link":it("error",e),it("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(R in n)if(n.hasOwnProperty(R)&&(a=n[R],a!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,t));default:At(e,t,R,a,n,null)}return;default:if(Pc(t)){for($ in n)n.hasOwnProperty($)&&(a=n[$],a!==void 0&&Kd(e,t,$,a,n,void 0));return}}for(p in n)n.hasOwnProperty(p)&&(a=n[p],a!=null&&At(e,t,p,a,n,null))}var xx={};function Sx(e,t,n,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var i=null,r=null,f=null,p=null,T=null,R=null,$=null;for(I in n){var W=n[I];if(n.hasOwnProperty(I)&&W!=null)switch(I){case"checked":break;case"value":break;case"defaultValue":T=W;default:a.hasOwnProperty(I)||At(e,t,I,null,a,W)}}for(var M in a){var I=a[M];if(W=n[M],a.hasOwnProperty(M)&&(I!=null||W!=null))switch(M){case"type":I!==W&&(ut=!0),r=I;break;case"name":I!==W&&(ut=!0),i=I;break;case"checked":I!==W&&(ut=!0),R=I;break;case"defaultChecked":I!==W&&(ut=!0),$=I;break;case"value":I!==W&&(ut=!0),f=I;break;case"defaultValue":I!==W&&(ut=!0),p=I;break;case"children":case"dangerouslySetInnerHTML":if(I!=null)throw Error(u(137,t));break;default:I!==W&&At(e,t,M,I,a,W)}}nt(e,f,p,T,R,$,r,i);return;case"select":I=f=p=M=null;for(r in n)if(T=n[r],n.hasOwnProperty(r)&&T!=null)switch(r){case"value":break;case"multiple":I=T;default:a.hasOwnProperty(r)||At(e,t,r,null,a,T)}for(i in a)if(r=a[i],T=n[i],a.hasOwnProperty(i)&&(r!=null||T!=null))switch(i){case"value":r!==T&&(ut=!0),M=r;break;case"defaultValue":r!==T&&(ut=!0),p=r;break;case"multiple":r!==T&&(ut=!0),f=r;default:r!==T&&At(e,t,i,r,a,T)}t=p,n=f,a=I,M!=null?Qt(e,!!n,M,!1):!!a!=!!n&&(t!=null?Qt(e,!!n,t,!0):Qt(e,!!n,n?[]:"",!1));return;case"textarea":I=M=null;for(p in n)if(i=n[p],n.hasOwnProperty(p)&&i!=null&&!a.hasOwnProperty(p))switch(p){case"value":break;case"children":break;default:At(e,t,p,null,a,i)}for(f in a)if(i=a[f],r=n[f],a.hasOwnProperty(f)&&(i!=null||r!=null))switch(f){case"value":i!==r&&(ut=!0),M=i;break;case"defaultValue":i!==r&&(ut=!0),I=i;break;case"children":break;case"dangerouslySetInnerHTML":if(i!=null)throw Error(u(91));break;default:i!==r&&At(e,t,f,i,a,r)}Qa(e,M,I);return;case"option":for(var ye in n)if(M=n[ye],n.hasOwnProperty(ye)&&M!=null&&!a.hasOwnProperty(ye))switch(ye){case"selected":e.selected=!1;break;default:At(e,t,ye,null,a,M)}for(T in a)if(M=a[T],I=n[T],a.hasOwnProperty(T)&&M!==I&&(M!=null||I!=null))switch(T){case"selected":M!==I&&(ut=!0),e.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:At(e,t,T,M,a,I)}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 Me in n)M=n[Me],n.hasOwnProperty(Me)&&M!=null&&!a.hasOwnProperty(Me)&&At(e,t,Me,null,a,M);for(R in a)if(M=a[R],I=n[R],a.hasOwnProperty(R)&&M!==I&&(M!=null||I!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(M!=null)throw Error(u(137,t));break;default:At(e,t,R,M,a,I)}return;default:if(Pc(t)){for(var Je in n)M=n[Je],n.hasOwnProperty(Je)&&M!==void 0&&!a.hasOwnProperty(Je)&&Kd(e,t,Je,void 0,a,M);for($ in a)M=a[$],I=n[$],!a.hasOwnProperty($)||M===I||M===void 0&&I===void 0||Kd(e,t,$,M,a,I);return}}for(var _ in n)M=n[_],n.hasOwnProperty(_)&&M!=null&&!a.hasOwnProperty(_)&&At(e,t,_,null,a,M);for(W in a)M=a[W],I=n[W],!a.hasOwnProperty(W)||M===I||M==null&&I==null||At(e,t,W,M,a,I)}function zg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function wx(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),a=0;a<n.length;a++){var i=n[a],r=i.transferSize,f=i.initiatorType,p=i.duration;if(r&&p&&zg(f)){for(f=0,p=i.responseEnd,a+=1;a<n.length;a++){var T=n[a],R=T.startTime;if(R>p)break;var $=T.transferSize,W=T.initiatorType;$&&zg(W)&&(T=T.responseEnd,f+=$*(T<p?1:(p-R)/(T-R)))}if(--a,t+=8*(r+f)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Zd=null,Pd=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Ug(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Hg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Bg(e,t,n,a){return n=ro(n).createElement(e),n[zt]=a,n[Ut]=t,fn(n,e,t),xt(n),n}function Fd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Ax(){var e=window.event;return e&&e.type==="popstate"?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Wd=typeof setTimeout=="function"?setTimeout:void 0,Tx=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,qg=typeof requestAnimationFrame=="function"?requestAnimationFrame:Wd,kx=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(e){return Ig.resolve(null).then(e).catch(jx)}:Wd;function jx(e){setTimeout(function(){throw e})}function zl(e){return e==="head"}function $g(e,t){var n=t,a=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"||n==="/&"){if(a===0){e.removeChild(i),hi(t);return}a--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")a++;else if(n==="html")rf(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,rf(n);for(var r=n.firstChild;r;){var f=r.nextSibling,p=r.nodeName;r[pl]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&r.rel.toLowerCase()==="stylesheet"||n.removeChild(r),r=f}}else n==="body"&&rf(e.ownerDocument.body);n=i}while(n);hi(t)}function Gg(e,t){var n=e;e=0;do{var a=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=a}while(n)}function Xg(e,t,n){if(t=CSS.escape(t)!==t?"r-"+btoa(t).replace(/=/g,""):t,e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display==="inline"){if(t=e.getClientRects(),t.length===1)var a=1;else for(var i=a=0;i<t.length;i++){var r=t[i];0<r.width&&0<r.height&&a++}a===1&&(e=e.style,e.display=t.length===1?"inline-block":"block",e.marginTop="-"+n.paddingTop,e.marginBottom="-"+n.paddingBottom)}}function Yg(e,t){e=e.style,t=t.style;var n=t!=null?t.hasOwnProperty("viewTransitionName")?t.viewTransitionName:t.hasOwnProperty("view-transition-name")?t["view-transition-name"]:null:null;e.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=t!=null?t.hasOwnProperty("viewTransitionClass")?t.viewTransitionClass:t.hasOwnProperty("view-transition-class")?t["view-transition-class"]:null:null,e.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),e.display==="inline-block"&&(t==null?e.display=e.margin="":(n=t.display,e.display=n==null||typeof n=="boolean"?"":n,n=t.margin,n!=null?e.margin=n:(n=t.hasOwnProperty("marginTop")?t.marginTop:t["margin-top"],e.marginTop=n==null||typeof n=="boolean"?"":n,t=t.hasOwnProperty("marginBottom")?t.marginBottom:t["margin-bottom"],e.marginBottom=t==null||typeof t=="boolean"?"":t)))}function Nx(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position==="absolute"||t.position==="fixed",clip:t.clipPath!=="none"||t.overflow!=="visible"||t.filter!=="none"||t.mask!=="none"||t.mask!=="none"||t.borderRadius!=="0px",view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function ef(e){var t=e.getBoundingClientRect(),n=getComputedStyle(e);return Nx(t,n,e)}function Ex(e){return e.documentElement.clientHeight}function Cx(e){this.addEventListener("load",e),this.addEventListener("error",e)}function Mx(e,t,n,a,i,r,f,p,T){var R=t.nodeType===9?t:t.ownerDocument;try{var $=R.startViewTransition({update:function(){var M=R.defaultView,I=M.navigation&&M.navigation.transition,ye=R.fonts.status;a();var Me=[];if(ye==="loaded"&&(Ex(R),R.fonts.status==="loading"&&Me.push(R.fonts.ready)),ye=Me.length,e!==null)for(var Je=e.suspenseyImages,_=0,E=0;E<Je.length;E++){var H=Je[E];if(!H.complete){var J=H.getBoundingClientRect();if(0<J.bottom&&0<J.right&&J.top<M.innerHeight&&J.left<M.innerWidth){if(_+=fy(H),_>cc){Me.length=ye;break}H=new Promise(Cx.bind(H)),Me.push(H)}}}if(0<Me.length)return M=Promise.race([Promise.all(Me),new Promise(function(Ne){return setTimeout(Ne,500)})]).then(i,i),(I?Promise.allSettled([I.finished,M]):M).then(r,r);if(i(),I)return I.finished.then(r,r);r()},types:n});R.__reactViewTransition=$;var W=[];return $.ready.then(function(){for(var M=R.documentElement.getAnimations({subtree:!0}),I=0;I<M.length;I++){var ye=M[I],Me=ye.effect,Je=Me.pseudoElement;if(Je!=null&&Je.startsWith("::view-transition")){W.push(ye),ye=Me.getKeyframes();for(var _=Je=void 0,E=!0,H=0;H<ye.length;H++){var J=ye[H],Ne=J.width;if(Je===void 0)Je=Ne;else if(Je!==Ne){E=!1;break}if(Ne=J.height,_===void 0)_=Ne;else if(_!==Ne){E=!1;break}delete J.width,delete J.height,J.transform==="none"&&delete J.transform}E&&Je!==void 0&&_!==void 0&&(Me.setKeyframes(ye),E=getComputedStyle(Me.target,Me.pseudoElement),E.width!==Je||E.height!==_)&&(E=ye[0],E.width=Je,E.height=_,E=ye[ye.length-1],E.width=Je,E.height=_,Me.setKeyframes(ye))}}f()},function(M){R.__reactViewTransition===$&&(R.__reactViewTransition=null);try{if(typeof M=="object"&&M!==null)switch(M.name){case"InvalidStateError":(M.message==="View transition was skipped because document visibility state is hidden."||M.message==="Skipping view transition because document visibility state has become hidden."||M.message==="Skipping view transition because viewport size changed."||M.message==="Transition was aborted because of invalid state")&&(M=null)}M!==null&&T(M)}finally{a(),i(),f()}}),$.finished.finally(function(){for(var M=0;M<W.length;M++)W[M].cancel();R.__reactViewTransition===$&&(R.__reactViewTransition=null),p()}),$}catch{return a(),i(),f(),null}}function vs(e,t){this._scope=document.documentElement,this._selector="::view-transition-"+e+"("+t+")"}vs.prototype.animate=function(e,t){return t=typeof t=="number"?{duration:t}:X({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},vs.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),a=[],i=0;i<n.length;i++){var r=n[i].effect;r!==null&&r.target===e&&r.pseudoElement===t&&a.push(n[i])}return a},vs.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Vg(e){return{name:e,group:new vs("group",e),imagePair:new vs("image-pair",e),old:new vs("old",e),new:new vs("new",e)}}function Zn(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Zn.prototype.addEventListener=function(e,t,n){var a=null,i=null;if(!(n!=null&&typeof n!="boolean"&&(a=n.signal||null,a!==null&&a.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var r=this._eventListeners;if(Kg(r,e,t,n)===-1){var f=this,p=t;n!=null&&typeof n!="boolean"&&n.once===!0&&(p=function(T){f.removeEventListener(e,t,n),typeof t=="function"?t.call(this,T):t.handleEvent(T)}),a!==null&&(i=f.removeEventListener.bind(f,e,t,n),a.addEventListener("abort",i,{once:!0}),i=a.removeEventListener.bind(a,"abort",i)),a=oi(n),r.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:p,cleanup:i}),b(this._fragmentFiber.child,!1,_x,e,p,a)}this._eventListeners=r}};function _x(e,t,n,a){return z(e).addEventListener(t,n,a),!1}Zn.prototype.removeEventListener=function(e,t,n){var a=this._eventListeners;if(a!==null&&(t=Kg(a,e,t,n),t!==-1)){var i=a[t];n=i.attachedListener;var r=i.cleanup;i=oi(i.optionsOrUseCapture),b(this._fragmentFiber.child,!1,Rx,e,n,i),a.splice(t,1),r!==null&&r()}};function Rx(e,t,n,a){return z(e).removeEventListener(t,n,a),!1}function oi(e){return e!=null&&typeof e!="boolean"&&(e.once===!0||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Qg(e){return e==null?"c=0":typeof e=="boolean"?"c="+(e?"1":"0"):"c="+(e.capture?"1":"0")}function Kg(e,t,n,a){if(e.length===0)return-1;a=Qg(a);for(var i=0;i<e.length;i++){var r=e[i];if(r.type===t&&r.listener===n&&Qg(r.optionsOrUseCapture)===a)return i}return-1}Zn.prototype.dispatchEvent=function(e){var t=x(this._fragmentFiber);if(t===null)return!0;t=z(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var a=t.nodeType===9?t.createComment(""):document.createTextNode("");if(n)for(var i=0;i<n.length;i++){var r=n[i];a.addEventListener(r.type,r.attachedListener,oi(r.optionsOrUseCapture))}if(t.appendChild(a),e=a.dispatchEvent(e),n)for(i=0;i<n.length;i++)r=n[i],a.removeEventListener(r.type,r.attachedListener,oi(r.optionsOrUseCapture));return t.removeChild(a),e}return t.dispatchEvent(e)},Zn.prototype.focus=function(e){b(this._fragmentFiber.child,!0,Zg,e,void 0,void 0)};function Zg(e,t){return e.tag===6?!1:(e=z(e),Xx(e,t))}Zn.prototype.focusLast=function(e){var t=[];b(this._fragmentFiber.child,!0,tf,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Zg(t[n],e);n--);};function tf(e,t){return t.push(e),!1}Zn.prototype.blur=function(){var e=x(this._fragmentFiber);e!==null&&(e=z(e),e=ro(e).activeElement,e!==null&&b(this._fragmentFiber.child,!1,Ox,e,void 0,void 0))};function Ox(e,t){return e.tag===6?!1:(e=z(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Zn.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),b(this._fragmentFiber.child,!1,Dx,e,void 0,void 0)};function Dx(e,t){return e.tag===6||(e=z(e),t.observe(e)),!1}Zn.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),b(this._fragmentFiber.child,!1,Lx,e,void 0,void 0);for(var n=t=0;n<Sa.length;n++){var a=Sa[n];a.fragmentInstance===this&&a.observer===e?e.unobserve(a.instance):Sa[t++]=a}Sa.length=t}};function Lx(e,t){return e.tag===6||(e=z(e),t.unobserve(e)),!1}var Sa=[],nf=!1;function zx(e,t,n){Sa.push({fragmentInstance:e,observer:t,instance:n}),nf||(nf=!0,Yx(function(){nf=!1;var a=Sa;Sa=[];for(var i=0;i<a.length;i++){var r=a[i];r.observer.unobserve(r.instance)}}))}Zn.prototype.getClientRects=function(){var e=[];return b(this._fragmentFiber.child,!1,Ux,e,void 0,void 0),e};function Ux(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=z(e),t.push.apply(t,e.getClientRects());return!1}Zn.prototype.getRootNode=function(e){var t=x(this._fragmentFiber);return t===null?this:z(t).getRootNode(e)},Zn.prototype.compareDocumentPosition=function(e){var t=x(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];b(this._fragmentFiber.child,!1,tf,n,void 0,void 0);var a=z(t);if(n.length===0){if(n=a,k(this._fragmentFiber)){e:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break e}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=a=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:a&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=L(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=z(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=z(n[0]),i=z(n[n.length-1]);var r=k(this._fragmentFiber)?t.parentElement:a;if(r==null)return Node.DOCUMENT_POSITION_DISCONNECTED;a=r.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,r=r.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var f=t.compareDocumentPosition(e),p=i.compareDocumentPosition(e),T=f&Node.DOCUMENT_POSITION_CONTAINED_BY||p&Node.DOCUMENT_POSITION_CONTAINED_BY;return p=a&&r&&f&Node.DOCUMENT_POSITION_FOLLOWING&&p&Node.DOCUMENT_POSITION_PRECEDING,t=a&&t===e||r&&i===e||T||p?Node.DOCUMENT_POSITION_CONTAINED_BY:!a&&t===e||!r&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:f,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Hx(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Hx(e,t,n,a,i){var r=ma(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!r)e:{for(;r!==null;){if(r.tag===7&&(r===t||r.alternate===t)){n=!0;break e}r=r.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(r===null)return r=i.ownerDocument,i===r||i===r.documentElement||i===r.body;e:{for(r=t,t=x(t);r!==null;){if(!(r.tag!==5&&r.tag!==3&&r.tag!==27||r!==t&&r.alternate!==t)){r=!0;break e}r=r.return}r=!1}return r}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!r)&&!(t=r===n)&&(t=O(n,r,Y),t===null?t=!1:(b(t,!0,de,r,n),r=Z,Z=null,t=r!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!r)&&!(t=r===a)&&(t=O(a,r,Y),t===null?t=!1:(b(t,!0,C,r,a),r=Z,oe=Z=null,t=r!==null)),t):!1}function Pg(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Zn.prototype.scrollIntoView=function(e){if(typeof e=="object")throw Error(u(566));var t=[];b(this._fragmentFiber.child,!1,tf,t,void 0,void 0);var n=e!==!1;if(t.length===0){var a=L(this._fragmentFiber);if(a=n?a[1]||a[0]||x(this._fragmentFiber):a[0]||a[1],a===null)return;if(a.tag===6){e=z(a),Pg(e,n);return}if(a=z(a),a.nodeType!==9){if(a.nodeType===11){n="host"in a?a.host:null,n!==null&&n.scrollIntoView(e);return}a.scrollIntoView(e)}}for(a=n?t.length-1:0;a!==(n?-1:t.length);){var i=t[a];i.tag===6?(i=z(i),Pg(i,n)):z(i).scrollIntoView(e),a+=n?-1:1}};function Bx(e,t){return e=z(e),Fg(e,t),!1}function Fg(e,t){e.reactFragments==null&&(e.reactFragments=new Set),e.reactFragments.add(t)}function Jg(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var i=n[a];e.addEventListener(i.type,i.attachedListener,oi(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){for(var f=0,p=0;p<Sa.length;p++){var T=Sa[p];(T.fragmentInstance!==t||T.observer!==r||T.instance!==e)&&(Sa[f++]=T)}Sa.length=f,r.observe(e)}),Fg(e,t))}function Ix(e,t){var n=t._eventListeners;if(n!==null)for(var a=0;a<n.length;a++){var i=n[a];e.removeEventListener(i.type,i.attachedListener,oi(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(r){typeof r.rootMargin=="string"?zx(t,r,e):r.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":af(n),Ya(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function qx(e,t,n,a){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[pl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==i.rel||e.getAttribute("href")!==(i.href==null||i.href===""?null:i.href)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute("title")!==(i.title==null?null:i.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(i.src==null?null:i.src)||e.getAttribute("type")!==(i.type==null?null:i.type)||e.getAttribute("crossorigin")!==(i.crossOrigin==null?null:i.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=i.name==null?null:""+i.name;if(i.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=ca(e.nextSibling),e===null)break}return null}function $x(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ca(e.nextSibling),e===null))return null;return e}function Wg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ca(e.nextSibling),e===null))return null;return e}function lf(e){return e.data==="$?"||e.data==="$~"}function sf(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Gx(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var a=function(){t(),n.removeEventListener("DOMContentLoaded",a)};n.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function ca(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var of=null;function ey(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ca(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function ty(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Xx(e,t){function n(){a=!0}if(e.ownerDocument.activeElement===e)return!0;var a=!1;try{e.ownerDocument.addEventListener("focus",n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener("focus",n,!0)}return a}function Yx(e){qg(function(){qg(function(t){return e(t)})})}function ny(e,t,n){switch(t=ro(n),e){case"html":if(e=t.documentElement,!e)throw Error(u(452));return e;case"head":if(e=t.head,!e)throw Error(u(453));return e;case"body":if(e=t.body,!e)throw Error(u(454));return e;default:throw Error(u(451))}}function ay(e,t,n){for(var a in n){var i=n[a];n.hasOwnProperty(a)&&i!=null&&At(e,t,a,null,xx,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=""),e.onclick===Ma&&(e.onclick=null),Ya(e)}function rf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ya(e)}var ua=new Map,ly=new Set;function co(e){if(typeof e.getRootNode=="function"){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var il=_e.d;_e.d={f:Vx,r:Qx,D:Kx,C:Zx,L:Px,m:Fx,X:Wx,S:Jx,M:eS};function Vx(){var e=il.f(),t=ec();return e||t}function Qx(e){var t=pa(e);t!==null&&t.tag===5&&t.type==="form"?ip(t):il.r(e)}var ri=typeof document>"u"?null:document;function sy(e,t,n){var a=ri;if(a&&typeof t=="string"&&t){var i=Ge(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),ly.has(i)||(ly.add(i),e={rel:e,crossOrigin:n,href:t},a.querySelector(i)===null&&(t=a.createElement("link"),fn(t,"link",e),xt(t),a.head.appendChild(t)))}}function Kx(e){il.D(e),sy("dns-prefetch",e,null)}function Zx(e,t){il.C(e,t),sy("preconnect",e,t)}function Px(e,t,n){il.L(e,t,n);var a=ri;if(a&&e&&t){var i='link[rel="preload"][as="'+Ge(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+Ge(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+Ge(n.imageSizes)+'"]')):i+='[href="'+Ge(e)+'"]';var r=i;switch(t){case"style":r=ci(e);break;case"script":r=ui(e)}if(!(ua.has(r)||(e=X({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ua.set(r,e),a.querySelector(i)!==null||t==="style"&&a.querySelector(uo(r))||t==="script"&&a.querySelector(fo(r))))){var f=a.createElement("link");fn(f,"link",e),t==="style"&&(f[Pl]=!0,f.onload=f.onerror=function(){Qo(f)}),xt(f),a.head.appendChild(f)}}}function Fx(e,t){il.m(e,t);var n=ri;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+Ge(a)+'"][href="'+Ge(e)+'"]',r=i;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=ui(e)}if(!ua.has(r)&&(e=X({rel:"modulepreload",href:e},t),ua.set(r,e),n.querySelector(i)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(fo(r)))return}a=n.createElement("link"),fn(a,"link",e),xt(a),n.head.appendChild(a)}}}function Jx(e,t,n){il.S(e,t,n);var a=ri;if(a&&e){var i=na(a).hoistableStyles,r=ci(e);t=t||"default";var f=i.get(r);if(!f){var p={loading:0,preload:null};if(f=a.querySelector(uo(r)))p.loading=5;else{e=X({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ua.get(r))&&cf(e,n);var T=f=a.createElement("link");xt(T),fn(T,"link",e),T._p=new Promise(function(R,$){T.onload=R,T.onerror=$}),T.addEventListener("load",function(){p.loading|=1}),T.addEventListener("error",function(){p.loading|=2}),p.loading|=4,oc(f,t,a)}f={type:"stylesheet",instance:f,count:1,state:p},i.set(r,f)}}}function Wx(e,t){il.X(e,t);var n=ri;if(n&&e){var a=na(n).hoistableScripts,i=ui(e),r=a.get(i);r||(r=n.querySelector(fo(i)),r||(e=X({src:e,async:!0},t),(t=ua.get(i))&&uf(e,t),r=n.createElement("script"),xt(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(i,r))}}function eS(e,t){il.M(e,t);var n=ri;if(n&&e){var a=na(n).hoistableScripts,i=ui(e),r=a.get(i);r||(r=n.querySelector(fo(i)),r||(e=X({src:e,async:!0,type:"module"},t),(t=ua.get(i))&&uf(e,t),r=n.createElement("script"),xt(r),fn(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(i,r))}}function iy(e,t,n,a){var i=(i=be.current)?co(i):null;if(!i)throw Error(u(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=ci(n.href),t=na(i).hoistableStyles,a=t.get(n),a||(a={type:"style",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=ci(n.href);var r=na(i).hoistableStyles,f=r.get(e);if(f||(i=i.ownerDocument||i,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,f),(r=i.querySelector(uo(e)))?r._p||(f.instance=r,f.state.loading=5):(r=ua.get(e),r||(r={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ua.set(e,r)),tS(i,e,r,f.state))),t&&a===null)throw Error(u(528,""));return f}if(t&&a!==null)throw Error(u(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(n=ui(n),t=na(i).hoistableScripts,a=t.get(n),a||(a={type:"script",instance:null,count:0,state:null},t.set(n,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,e))}}function ci(e){return'href="'+Ge(e)+'"'}function uo(e){return'link[rel="stylesheet"]['+e+"]"}function oy(e){return X({},e,{"data-precedence":e.precedence,precedence:null})}function tS(e,t,n,a){if(t=e.querySelector('link[rel="preload"][as="style"]['+t+"]")){if(t[Pl]!==!0){a.loading=1;return}}else t=e.createElement("link"),t[Pl]=!0,t.onload=t.onerror=Qo.bind(null,t),fn(t,"link",n),xt(t),e.head.appendChild(t);a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2})}function ui(e){return'[src="'+Ge(e)+'"]'}function fo(e){return"script[async]"+e}function ry(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Ge(n.href)+'"]');if(a)return t.instance=a,xt(a),a;var i=X({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),xt(a),fn(a,"style",i),oc(a,n.precedence,e),t.instance=a;case"stylesheet":i=ci(n.href);var r=e.querySelector(uo(i));if(r)return t.state.loading|=4,t.instance=r,xt(r),r;a=oy(n),(i=ua.get(i))&&cf(a,i),r=(e.ownerDocument||e).createElement("link"),xt(r);var f=r;return f._p=new Promise(function(p,T){f.onload=p,f.onerror=T}),fn(r,"link",a),t.state.loading|=4,oc(r,n.precedence,e),t.instance=r;case"script":return r=ui(n.src),(i=e.querySelector(fo(r)))?(t.instance=i,xt(i),i):(a=n,(i=ua.get(r))&&(a=X({},n),uf(a,i)),e=e.ownerDocument||e,i=e.createElement("script"),xt(i),fn(i,"link",a),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(u(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,oc(a,n.precedence,e));return t.instance}function oc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=a.length?a[a.length-1]:null,r=i,f=0;f<a.length;f++){var p=a[f];if(p.dataset.precedence===t)r=p;else if(r!==i)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function cf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function uf(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var rc=null;function cy(e,t,n){if(rc===null){var a=new Map,i=rc=new Map;i.set(n,a)}else i=rc,a=i.get(n),a||(a=new Map,i.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var r=n[i];if(!(r[pl]||r[zt]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var f=r.getAttribute(t)||"";f=e+f;var p=a.get(f);p?p.push(r):a.set(f,[r])}}return a}function df(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function nS(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function uy(e,t){return e==="img"&&t.src!=null&&t.src!==""&&t.onLoad==null&&t.loading!=="lazy"}function dy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function fy(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function hy(e,t){typeof t.decode=="function"&&(e.imgCount++,t.complete||(e.imgBytes+=fy(t),e.suspenseyImages.push(t)),e=sS.bind(e),t.decode().then(e,e))}function aS(e,t,n,a){if(n.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=ci(a.href),r=t.querySelector(uo(i));if(r){t=r._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ho.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=r,xt(r);return}r=t.ownerDocument||t,a=oy(a),(i=ua.get(i))&&cf(a,i),r=r.createElement("link"),xt(r);var f=r;f._p=new Promise(function(p,T){f.onload=p,f.onerror=T}),fn(r,"link",a),n.instance=r}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=ho.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var cc=0;function lS(e,t){return e.stylesheets&&e.count===0&&dc(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var a=setTimeout(function(){if(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend){var r=e.unsuspend;e.unsuspend=null,r()}},6e4+t);0<e.imgBytes&&cc===0&&(cc=62500*wx());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&dc(e,e.stylesheets),e.unsuspend)){var r=e.unsuspend;e.unsuspend=null,r()}},(e.imgBytes>cc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(i)}}:null}function my(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)dc(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ho(){this.count--,my(this)}function sS(){this.imgCount--,my(this)}var uc=null;function dc(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,uc=new Map,t.forEach(iS,e),uc=null,ho.call(e))}function iS(e,t){if(!(t.state.loading&4)){var n=uc.get(e);if(n)var a=n.get(null);else{n=new Map,uc.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<i.length;r++){var f=i[r];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(n.set(f.dataset.precedence,f),a=f)}a&&n.set(null,a)}i=t.instance,f=i.getAttribute("data-precedence"),r=n.get(f)||a,r===a&&n.set(null,i),n.set(f,i),this.count++,a=ho.bind(this),i.addEventListener("load",a),i.addEventListener("error",a),r?r.parentNode.insertBefore(i,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var di={$$typeof:Ce,Provider:null,Consumer:null,_currentValue:mt,_currentValue2:mt,_threadCount:0};function oS(e,t,n,a,i,r,f,p,T){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nt(0),this.hiddenUpdates=Nt(null),this.identifierPrefix=a,this.onUncaughtError=i,this.onCaughtError=r,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.transitionTypes=null,this.incompleteTransitions=new Map}function py(e,t,n,a,i,r,f,p,T,R,$,W){return e=new oS(e,t,n,f,T,R,$,W,p),t=1,r===!0&&(t|=24),r=Rn(3,null,null,t),e.current=r,r.stateNode=e,t=ku(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},Cu(r),e}function gy(e){return e?(e=Us,e):Us}function yy(e,t,n,a,i,r){i=gy(i),a.context===null?a.context=i:a.pendingContext=i,a=Tl(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=kl(e,a,t),n!==null&&(zn(n,e,t),Gi(n,e,t))}function vy(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ff(e,t){vy(e,t),(e=e.alternate)&&vy(e,t)}function by(e){if(e.tag===13||e.tag===31){var t=ts(e,67108864);t!==null&&zn(t,e,67108864),ff(e,67108864)}}function xy(e){if(e.tag===13||e.tag===31){var t=Kn();t=Zl(t);var n=ts(e,t);n!==null&&zn(n,e,t),ff(e,t)}}var fi=!0;function rS(e,t,n,a){var i=Se.T;Se.T=null;var r=_e.p;try{_e.p=2,hf(e,t,n,a)}finally{_e.p=r,Se.T=i}}function cS(e,t,n,a){var i=Se.T;Se.T=null;var r=_e.p;try{_e.p=8,hf(e,t,n,a)}finally{_e.p=r,Se.T=i}}function hf(e,t,n,a){if(fi){var i=mf(a);if(i===null)Qd(e,t,a,fc,n),wy(e,a);else if(dS(i,e,t,n,a))a.stopPropagation();else if(wy(e,a),t&4&&-1<uS.indexOf(e)){for(;i!==null;){var r=pa(i);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var f=P(r.pendingLanes);if(f!==0){var p=r;for(p.pendingLanes|=2,p.entangledLanes|=2;f;){var T=1<<31-jt(f);p.entanglements[1]|=T,f&=~T}Ia(r),(gt&6)===0&&(Fr=yt()+500,so(0))}}break;case 31:case 13:p=ts(r,2),p!==null&&zn(p,r,2),ec(),ff(r,2)}if(r=mf(a),r===null&&Qd(e,t,a,fc,n),r===i)break;i=r}i!==null&&a.stopPropagation()}else Qd(e,t,a,null,n)}}function mf(e){return e=Jc(e),pf(e)}var fc=null;function pf(e){if(fc=null,e=ma(e),e!==null){var t=h(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=m(t),e!==null)return e;e=null}else if(n===31){if(e=y(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fc=e,null}function Sy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ga()){case yn:return 2;case vn:return 8;case Cn:case B:return 32;case ue:return 268435456;default:return 32}default:return 32}}var gf=!1,Ul=null,Hl=null,Bl=null,mo=new Map,po=new Map,Il=[],uS="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 wy(e,t){switch(e){case"focusin":case"focusout":Ul=null;break;case"dragenter":case"dragleave":Hl=null;break;case"mouseover":case"mouseout":Bl=null;break;case"pointerover":case"pointerout":mo.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":po.delete(t.pointerId)}}function go(e,t,n,a,i,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[i]},t!==null&&(t=pa(t),t!==null&&by(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function dS(e,t,n,a,i){switch(t){case"focusin":return Ul=go(Ul,e,t,n,a,i),!0;case"dragenter":return Hl=go(Hl,e,t,n,a,i),!0;case"mouseover":return Bl=go(Bl,e,t,n,a,i),!0;case"pointerover":var r=i.pointerId;return mo.set(r,go(mo.get(r)||null,e,t,n,a,i)),!0;case"gotpointercapture":return r=i.pointerId,po.set(r,go(po.get(r)||null,e,t,n,a,i)),!0}return!1}function Ay(e){var t=ma(e.target);if(t!==null){var n=h(t);if(n!==null){if(t=n.tag,t===13){if(t=m(n),t!==null){e.blockedOn=t,Es(e.priority,function(){xy(n)});return}}else if(t===31){if(t=y(n),t!==null){e.blockedOn=t,Es(e.priority,function(){xy(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function hc(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mf(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);Fc=a,n.target.dispatchEvent(a),Fc=null}else return t=pa(n),t!==null&&by(t),e.blockedOn=n,!1;t.shift()}return!0}function Ty(e,t,n){hc(e)&&n.delete(t)}function fS(){gf=!1,Ul!==null&&hc(Ul)&&(Ul=null),Hl!==null&&hc(Hl)&&(Hl=null),Bl!==null&&hc(Bl)&&(Bl=null),mo.forEach(Ty),po.forEach(Ty)}function mc(e,t){e.blockedOn===t&&(e.blockedOn=null,gf||(gf=!0,l.unstable_scheduleCallback(l.unstable_NormalPriority,fS)))}var pc=null;function ky(e){pc!==e&&(pc=e,l.unstable_scheduleCallback(l.unstable_NormalPriority,function(){pc===e&&(pc=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],i=e[t+2];if(typeof a!="function"){if(pf(a||n)===null)continue;break}var r=pa(n);r!==null&&(e.splice(t,3),t-=3,Pu(r,{pending:!0,data:i,method:n.method,action:a},a,i))}}))}function hi(e){function t(T){return mc(T,e)}Ul!==null&&mc(Ul,e),Hl!==null&&mc(Hl,e),Bl!==null&&mc(Bl,e),mo.forEach(t),po.forEach(t);for(var n=0;n<Il.length;n++){var a=Il[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Il.length&&(n=Il[0],n.blockedOn===null);)Ay(n),n.blockedOn===null&&Il.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var i=n[a],r=n[a+1],f=i[Ut]||null;if(typeof r=="function")f||ky(n);else if(f){var p=null;if(r&&r.hasAttribute("formAction")){if(i=r,f=r[Ut]||null)p=f.formAction;else if(pf(i)!==null)continue}else p=f.action;typeof p=="function"?n[a+1]=p:(n.splice(a,3),a-=3),ky(n)}}}function jy(){function e(r){r.canIntercept&&r.info==="react-transition"&&r.intercept({handler:function(){return new Promise(function(f){return i=f})},focusReset:"manual",scroll:"manual"})}function t(){i!==null&&(i(),i=null),a||setTimeout(n,20)}function n(){if(!a&&!navigation.transition){var r=navigation.currentEntry;r&&r.url!=null&&navigation.navigate(r.url,{state:r.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,i=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),i!==null&&(i(),i=null)}}}function yf(e){this._internalRoot=e}gc.prototype.render=yf.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(u(409));var n=t.current,a=Kn();yy(n,a,e,t,null,null)},gc.prototype.unmount=yf.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;yy(e.current,2,null,e,null,null),ec(),t[_n]=null}};function gc(e){this._internalRoot=e}gc.prototype.unstable_scheduleHydration=function(e){if(e){var t=ml();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Il.length&&t!==0&&t<Il[n].priority;n++);Il.splice(n,0,e),n===0&&Ay(e)}};var Ny=o.version;if(Ny!=="19.3.0")throw Error(u(527,Ny,"19.3.0"));_e.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(u(188)):(e=Object.keys(e).join(","),Error(u(268,e)));return e=S(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var hS={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:Se,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yc.isDisabled&&yc.supportsFiber)try{Ye=yc.inject(hS),Qe=yc}catch{}}return vo.createRoot=function(e,t){if(!d(e))throw Error(u(299));var n=!1,a="",i=gp,r=yp,f=vp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=py(e,1,!1,null,null,n,a,null,i,r,f,jy),e[_n]=t.current,Vd(e),new yf(t)},vo.hydrateRoot=function(e,t,n){if(!d(e))throw Error(u(299));var a=!1,i="",r=gp,f=yp,p=vp,T=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=n.onUncaughtError),n.onCaughtError!==void 0&&(f=n.onCaughtError),n.onRecoverableError!==void 0&&(p=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=py(e,1,!0,t,n??null,a,i,T,r,f,p,jy),t.context=gy(null),n=t.current,a=Kn(),a=Zl(a),i=Tl(a),i.callback=null,kl(n,i,a),n=a,t.current.lanes=n,lt(t,n),Ia(t),e[_n]=t.current,Vd(e),new gc(t)},vo.version="19.3.0",vo}var Iy;function NS(){if(Iy)return xf.exports;Iy=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),xf.exports=jS(),xf.exports}var ES=NS();const CS=Lv(ES);async function MS(){const l=await fetch("/api/models");if(!l.ok)throw new Error(await Xc(l)||`Failed to load models (${l.status})`);return(await l.json()).data}async function _S(){const l=await fetch("/api/kb");return l.ok?(await l.json()).docs:[]}async function RS(l,o){const c=await fetch("/api/kb",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l,text:o})});if(!c.ok)throw new Error(await Xc(c)||`Failed to add document (${c.status})`);return(await c.json()).docs}async function OS(l){const o=await fetch(`/api/kb/${l}`,{method:"DELETE"});return o.ok?(await o.json()).docs:[]}async function eh(l,o){var S,g,b,x,k,L,V,z,Z;if(l.stream===!1)return DS(l,o);const c=Date.now(),u=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,stream:!0}),signal:o.signal});if(!u.ok||!u.body){o.onError(await Xc(u)||`Chat request failed (${u.status})`);return}const d=u.body.getReader(),h=new TextDecoder;let m="";const y={};let v=null;for(;;){const{value:oe,done:de}=await d.read();if(de)break;m+=h.decode(oe,{stream:!0});let C;for(;(C=m.indexOf(`
50
+ `))!==-1;){const Y=m.slice(0,C).replace(/\r$/,"");if(m=m.slice(C+1),!Y.startsWith("data:"))continue;const O=Y.slice(5).trim();if(O==="[DONE]"){qy(y,o),o.onDone(v);return}let X;try{X=JSON.parse(O)}catch{continue}if(X.error){o.onError(X.error.message??"stream error");return}if(X.scx_sources){(S=o.onSources)==null||S.call(o,X.scx_sources);continue}const F=(g=X.choices)==null?void 0:g[0],ie=F==null?void 0:F.delta;if(ie!=null&&ie.content&&o.onDelta(ie.content),ie!=null&&ie.tool_calls)for(const G of ie.tool_calls){const Q=G.index??0;y[Q]??(y[Q]={id:G.id??`call_${Q}`,type:"function",function:{name:"",arguments:""}}),G.id&&(y[Q].id=G.id),(b=G.function)!=null&&b.name&&(y[Q].function.name+=G.function.name),(x=G.function)!=null&&x.arguments&&(y[Q].function.arguments+=G.function.arguments)}F!=null&&F.finish_reason&&(v=F.finish_reason),X.usage&&((z=o.onUsage)==null||z.call(o,{prompt:X.usage.prompt_tokens,completion:X.usage.completion_tokens,reasoning:(k=X.usage.completion_tokens_details)==null?void 0:k.reasoning_tokens,cached:(L=X.usage.prompt_tokens_details)==null?void 0:L.cached_tokens,cacheWrite:(V=X.usage.prompt_tokens_details)==null?void 0:V.cache_write_tokens}))}}if(qy(y,o),!v&&!((Z=o.signal)!=null&&Z.aborted)){const oe=Math.round((Date.now()-c)/6e4);o.onError(`The connection closed before the model finished${oe?` (after about ${oe} min)`:""}. Long answers can hit a provider's time limit: try again, a faster model, or a smaller request.`);return}o.onDone(v)}async function DS(l,o){var m,y,v,S,g,b,x,k;const c=await fetch("/api/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...l,stream:!1}),signal:o.signal});if(!c.ok){o.onError(await Xc(c)||`Chat request failed (${c.status})`);return}const u=await c.json();u.scx_sources&&((m=o.onSources)==null||m.call(o,u.scx_sources));const d=(y=u.choices)==null?void 0:y[0],h=d==null?void 0:d.message;h!=null&&h.content&&o.onDelta(h.content),(v=h==null?void 0:h.tool_calls)!=null&&v.length&&((S=o.onToolCalls)==null||S.call(o,h.tool_calls)),u.usage&&((k=o.onUsage)==null||k.call(o,{prompt:u.usage.prompt_tokens,completion:u.usage.completion_tokens,reasoning:(g=u.usage.completion_tokens_details)==null?void 0:g.reasoning_tokens,cached:(b=u.usage.prompt_tokens_details)==null?void 0:b.cached_tokens,cacheWrite:(x=u.usage.prompt_tokens_details)==null?void 0:x.cache_write_tokens})),o.onDone((d==null?void 0:d.finish_reason)??null)}function qy(l,o){const c=Object.values(l).filter(u=>u.function.name);c.length&&o.onToolCalls&&o.onToolCalls(c)}async function Xc(l){var o;try{const c=await l.json();return((o=c==null?void 0:c.error)==null?void 0:o.message)??""}catch{return""}}async function LS(l){const o=await fetch(`/api/agent/sessions?directory=${encodeURIComponent(l)}`);if(!o.ok)throw new Error(await Hn(o)||`Could not list sessions (${o.status})`);return(await o.json()).sessions}async function zS(l,o){const c=await fetch(`/api/agent/session/${encodeURIComponent(l)}/messages?directory=${encodeURIComponent(o)}`);if(!c.ok)throw new Error(await Hn(c)||`Could not load session (${c.status})`);return c.json()}async function US(l,o){const c=await fetch(`/api/agent/session/${encodeURIComponent(l)}?directory=${encodeURIComponent(o)}`,{method:"DELETE"});if(!c.ok)throw new Error(await Hn(c)||`Could not delete session (${c.status})`)}async function HS(l){const o=await fetch(`/api/agent/commands?directory=${encodeURIComponent(l)}`);return o.ok?(await o.json()).commands:[]}async function BS(l){const o=await fetch("/api/agent/command",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Command failed (${o.status})`)}async function IS(l,o,c){const u=await fetch("/api/agent/compact",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l,directory:o,model:c})});if(!u.ok)throw new Error(await Hn(u)||`Compact failed (${u.status})`)}async function qS(){const l=await fetch("/api/agent/status");if(!l.ok)throw new Error(await Hn(l)||`Agent server not ready (${l.status})`);return l.json()}async function zv(l){const o=await fetch(`/api/agent/directory?directory=${encodeURIComponent(l)}`);if(!o.ok)throw new Error(await Hn(o)||`Folder not found (${o.status})`);return(await o.json()).directory}async function $S(l,o){const c=await fetch(`/api/agent/pending?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`);return c.ok?c.json():{permissions:[],questions:[]}}async function GS(l){const o=await fetch("/api/agent/session",{method:"POST",headers:dl(),body:JSON.stringify({directory:l})});if(!o.ok)throw new Error(await Hn(o)||`Could not create session (${o.status})`);return o.json()}async function XS(l){const o=await fetch("/api/agent/prompt",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Prompt failed (${o.status})`)}async function YS(l){const o=await fetch("/api/agent/permission",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Permission reply failed (${o.status})`)}async function VS(l){const o=await fetch("/api/agent/question",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Answer failed (${o.status})`)}async function QS(l,o){await fetch("/api/agent/abort",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l,directory:o})})}async function KS(l,o){const c=await fetch(`/api/agent/diff?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`);return c.ok?(await c.json()).diff:null}async function ZS(l,o,c,u,d){let h=1e3,m=!1;for(;!u.aborted;){try{await PS(l,o,c,u,()=>{h=1e3,m&&(d==null||d()),m=!0})}catch(y){if(u.aborted)return;if(y.fatal)throw y}if(u.aborted)return;await new Promise(y=>setTimeout(y,h)),h=Math.min(h*2,1e4)}}async function PS(l,o,c,u,d){const h=await fetch(`/api/agent/events?sessionID=${encodeURIComponent(l)}&directory=${encodeURIComponent(o)}`,{signal:u});if(!h.ok||!h.body)throw Object.assign(new Error(await Hn(h)||`Event stream failed (${h.status})`),{fatal:!0});d();const m=h.body.getReader(),y=new TextDecoder;let v="";for(;;){const{value:S,done:g}=await m.read();if(g)break;v+=y.decode(S,{stream:!0});let b;for(;(b=v.indexOf(`
51
+ `))!==-1;){const x=v.slice(0,b).replace(/\r$/,"");if(v=v.slice(b+1),!!x.startsWith("data:"))try{c(JSON.parse(x.slice(5).trim()))}catch{}}}}async function FS(l){const o=await fetch("/api/agent/recon",{method:"POST",headers:dl(),body:JSON.stringify(l)});if(!o.ok)throw new Error(await Hn(o)||`Could not start recon (${o.status})`);return(await o.json()).recon}async function $y(l){const o=await fetch(`/api/agent/recon?sessionID=${encodeURIComponent(l)}`);return o.ok?(await o.json()).recon:null}async function JS(l){const o=await fetch("/api/agent/recon/stop",{method:"POST",headers:dl(),body:JSON.stringify({sessionID:l})});return o.ok?(await o.json()).recon:null}const dl=()=>({"Content-Type":"application/json"});async function Hn(l){var o,c;try{return((c=(o=await l.json())==null?void 0:o.error)==null?void 0:c.message)??""}catch{return""}}async function Ho(l,o){if(!l.ok)throw new Error(await Hn(l)||`${o} failed (${l.status})`);return l.json()}const WS=()=>fetch("/api/workspaces").then(l=>Ho(l,"Listing workspaces")),ew=l=>fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}).then(o=>Ho(o,"Creating the workspace")),tw=l=>fetch(`/api/workspaces?directory=${encodeURIComponent(l)}`,{method:"DELETE"}).then(o=>Ho(o,"Deleting the workspace")),nw=(l,o)=>fetch(`/api/agent/files?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}`).then(c=>Ho(c,"Listing files")),aw=(l,o,c)=>fetch(`/api/agent/upload?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}&name=${encodeURIComponent(c.name)}`,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:c}).then(u=>Ho(u,`Uploading ${c.name}`)),lw=(l,o)=>`/api/agent/file?directory=${encodeURIComponent(l)}&path=${encodeURIComponent(o)}`,Uv=["low","medium","high","xhigh","max"];function th(l,o){var c;if(!(!l||!((c=o==null?void 0:o.supported_features)!=null&&c.includes("reasoning"))))return Uv.includes(l)?l:void 0}let sw=0;const Uf=()=>`tool_${Date.now().toString(36)}_${(sw++).toString(36)}`,iw=l=>l.map(o=>o.id?o:{...o,id:Uf()}),ow=l=>l.map(({id:o,...c})=>c);function Hv({cursor:l=!1}){return s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"prompt",children:">_"}),s.jsxs("span",{className:"word",children:["Bug",s.jsx("span",{className:"x",children:"X"}),"Hunter",l&&s.jsx("span",{className:"cursor big","aria-hidden":!0})]})]})}function rw({size:l=20,tagline:o=!0}){return s.jsxs("div",{className:"brand","aria-label":"BugXHunter",children:[s.jsx("span",{className:"logo",style:{fontSize:l},children:s.jsx(Hv,{})}),o&&s.jsxs("span",{className:"brand-sub",children:["Open-source AI security testing ",s.jsxs("span",{className:"brand-ver",title:"BugXHunter release v0.13.0",children:["v","0.13.0"]})]})]})}function nh(){return typeof window<"u"&&!!(window.SpeechRecognition||window.webkitSpeechRecognition)}function Bv(l){const o=window.SpeechRecognition||window.webkitSpeechRecognition;if(!o)return{stop:()=>{},promise:Promise.resolve("")};const c=new o;c.lang=navigator.language||"en-US",c.interimResults=!0,c.continuous=!1;let u="";const d=new Promise(h=>{var m;c.onresult=y=>{var S;let v="";for(let g=y.resultIndex;g<y.results.length;g++){const b=y.results[g][0].transcript;y.results[g].isFinal?u+=b:v+=b}(S=l.onPartial)==null||S.call(l,u+v)},c.onend=()=>{var y;(y=l.onEnd)==null||y.call(l),h(u.trim())},c.onerror=()=>h(u.trim()),(m=l.onStart)==null||m.call(l),c.start()});return{stop:()=>c.stop(),promise:d}}let Nc=null;function cw(l){if(typeof window>"u"||!window.speechSynthesis)return;const o=l.replace(/[*_`#>]/g,"").replace(/\[(\d+)\]/g,"").trim();o&&(window.speechSynthesis.cancel(),Nc=new SpeechSynthesisUtterance(o),Nc.rate=1.05,window.speechSynthesis.speak(Nc))}function uw(){typeof window<"u"&&window.speechSynthesis&&window.speechSynthesis.cancel(),Nc=null}function Bo({title:l,tooltip:o,children:c}){return s.jsxs("header",{className:"term-bar",children:[s.jsx("span",{className:"dot r","aria-hidden":!0}),s.jsx("span",{className:"dot y","aria-hidden":!0}),s.jsx("span",{className:"dot g","aria-hidden":!0}),s.jsx("span",{className:"term-title",title:o??l,children:l}),c&&s.jsx("div",{className:"head-actions",children:c})]})}const dw={p:"$ ",out:"[*] ",ok:"[+] "};function Iv({lines:l}){const o=A.useMemo(()=>{var h;return typeof window<"u"&&!!((h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)},[]),[c,u]=A.useState(()=>o?{line:l.length,chars:0,started:!0}:{line:0,chars:0,started:!1});A.useEffect(()=>{if(c.line>=l.length)return;const h=l[c.line],m=c.chars<h.text.length,y=c.started?m?h.pace??22:260:400,v=setTimeout(()=>{u(m?{line:c.line,chars:c.chars+1,started:!0}:{line:c.line+1,chars:0,started:!0})},y);return()=>clearTimeout(v)},[c,l]);const d=c.line>=l.length;return s.jsxs("div",{className:"boot",children:[l.map((h,m)=>{if(m>c.line)return s.jsx("div",{className:"line","aria-hidden":!0},m);const y=m<c.line,v=y?h.text:h.text.slice(0,c.chars);return s.jsxs("div",{className:"line",children:[s.jsx("span",{className:h.kind,children:dw[h.kind]}),v,y&&h.ok?s.jsxs("span",{className:"ok",children:[" ",h.ok]}):null,m===c.line&&c.started&&s.jsx("span",{className:"cursor"})]},m)}),d&&s.jsxs("div",{className:"line",children:[s.jsx("span",{className:"p",children:"$ "}),s.jsx("span",{className:"cursor"})]})]})}async function En(l,o){var u,d;const c=await fetch(l,{headers:{"Content-Type":"application/json"},...o});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const Kl=l=>({method:"POST",body:l===void 0?void 0:JSON.stringify(l)}),fw=()=>En("/api/vault"),hw=(l,o)=>En("/api/vault/init",Kl({doc:l,dek:o})),qv=l=>En("/api/vault/unseal",Kl({dek:l})),mw=()=>En("/api/vault/seal",Kl()),pw=(l,o)=>En(`/api/vault/items/${encodeURIComponent(l)}`,{method:"PUT",body:JSON.stringify({value:o})}),gw=l=>En(`/api/vault/items/${encodeURIComponent(l)}`,{method:"DELETE"}),Gy=(l,o)=>En("/api/vault/methods",Kl({method:l,dek:o})),yw=l=>En(`/api/vault/methods/${encodeURIComponent(l)}`,{method:"DELETE"}),vw=l=>En("/api/vault",{method:"DELETE",body:JSON.stringify({dek:l})}),bw=()=>En("/api/auth/me"),Tf=()=>En("/api/auth/methods"),xw=()=>En("/api/auth/challenge",Kl()),Sw=l=>En("/api/auth/passkey",Kl(l)),ww=l=>En("/api/auth/recover",Kl({dek:l})),Aw=()=>En("/api/auth/logout",Kl()),Tw=6e5,ah="bugxhunter-vault-prf-v1",kw="bugxhunter-vault-kek-v1",jw="bugxhunter-vault-ok",Si=new TextEncoder,Ql=crypto.subtle,pn={enc:l=>btoa(String.fromCharCode(...l instanceof Uint8Array?l:new Uint8Array(l))),dec:l=>Uint8Array.from(atob(l),o=>o.charCodeAt(0))},qa={enc:l=>pn.enc(l).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),dec:l=>pn.dec(l.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-l.length%4)%4))},$a=l=>crypto.getRandomValues(new Uint8Array(l)),ul=l=>l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength);async function $v(l,o){const c=await Ql.importKey("raw",Si.encode(l),"PBKDF2",!1,["deriveBits"]),u=await Ql.deriveBits({name:"PBKDF2",hash:o.hash,salt:ul(pn.dec(o.salt)),iterations:o.iterations},c,256);return new Uint8Array(u)}async function Gv(l,o,c){if(l.length!==32)throw new Error("PRF output must be 32 bytes");let u;if(o.passphrase){if(!c)throw new Error("This passkey was enrolled with a passphrase; enter it as well.");const m=await $v(c,o.passphrase);u=new Uint8Array(64),u.set(l,0),u.set(m,32),m.fill(0)}else u=new Uint8Array(l);const d=await Ql.importKey("raw",ul(u),"HKDF",!1,["deriveKey"]),h=await Ql.deriveKey({name:"HKDF",hash:"SHA-256",salt:ul(pn.dec(o.hkdfSalt)),info:Si.encode(kw)},d,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return u.fill(0),h}async function Yc(l,o){const c=await $v(l,o),u=await Ql.importKey("raw",ul(c),"AES-GCM",!1,["encrypt","decrypt"]);return c.fill(0),u}async function Oo(l,o,c){const u=$a(12),d=await Ql.encrypt({name:"AES-GCM",iv:ul(u),additionalData:Si.encode(c)},l,ul(o));return{iv:pn.enc(u),ct:pn.enc(d)}}async function lh(l,o,c){const u=await Ql.decrypt({name:"AES-GCM",iv:ul(pn.dec(o.iv)),additionalData:Si.encode(c)},l,ul(pn.dec(o.ct)));return new Uint8Array(u)}const Hf="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function Nw(){const l=$a(16);let o=0,c=0,u="";for(const d of l)for(c=c<<8|d,o+=8;o>=5;)u+=Hf[c>>>o-5&31],o-=5;return o>0&&(u+=Hf[c<<5-o&31]),u.match(/.{1,5}/g).join("-")}const sh=l=>l.toUpperCase().replace(/[^A-Z2-9]/g,"");function Bf(l){const o=sh(l);return o.length===26&&[...o].every(c=>Hf.includes(c))}const ih=l=>`${l}-${qa.enc($a(6))}`,Xv=()=>({name:"PBKDF2",hash:"SHA-256",iterations:Tw,salt:pn.enc($a(16))});async function Yv(l,o,c){const u={type:"passkey",id:ih("pk"),label:c,credentialId:o.credentialId,transports:o.transports,publicKey:o.publicKey,alg:o.alg,signCount:0,prfSalt:ah,hkdfSalt:pn.enc($a(16)),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return u.wrapped=await Oo(await Gv(o.prf,u),l,u.id),u}async function oh(l,o){const c={type:"password",id:ih("pw"),label:"Backup passphrase",kdf:Xv(),wrapped:{iv:"",ct:""},createdAt:new Date().toISOString()};return c.wrapped=await Oo(await Yc(o,c.kdf),l,c.id),c}async function Ew(l){const o=$a(32),c=await Ql.importKey("raw",ul(o),"AES-GCM",!1,["encrypt"]),u=new Date().toISOString(),d=[await Yv(o,l,l.label)];l.passphrase&&d.push(await oh(o,l.passphrase));const h=Nw(),m={type:"recovery",id:ih("rc"),label:"Recovery code",kdf:Xv(),wrapped:{iv:"",ct:""},createdAt:u};m.wrapped=await Oo(await Yc(sh(h),m.kdf),o,m.id),d.push(m);const y={};for(const[g,b]of Object.entries(l.items))b&&(y[g]=await Oo(c,Si.encode(b),g));const v={version:1,createdAt:u,methods:d,verifier:await Oo(c,Si.encode(jw),"verifier"),items:y},S=pn.enc(o);return o.fill(0),{doc:v,dek:S,recoveryCode:h}}async function Vv(l,o,c){const u=await Gv(o,l,c);return pn.enc(await lh(u,l.wrapped,l.id))}async function Qv(l,o){const c=await Yc(o,l.kdf);return pn.enc(await lh(c,l.wrapped,l.id))}async function Kv(l,o){const c=await Yc(sh(o),l.kdf);return pn.enc(await lh(c,l.wrapped,l.id))}class cl extends Error{constructor(o){super(o),this.name="PrfUnsupportedError"}}class rh extends Error{constructor(){super("Passkey prompt cancelled or timed out."),this.name="PasskeyCancelledError"}}const wi=()=>typeof window<"u"&&!!window.PublicKeyCredential&&!!navigator.credentials,Cw=new TextEncoder;function _c(){const l=location.hostname;if(/^\d{1,3}(\.\d{1,3}){3}$/.test(l)||l.startsWith("["))throw new cl(`Passkeys can't be bound to an IP address (${l}). Open the app via http://localhost:${location.port||80} or a hostname.`);return l}function Zv(l){const o=l;return(o==null?void 0:o.name)==="NotAllowedError"?new rh:(o==null?void 0:o.name)==="OperationError"?new cl("Another passkey request is pending in this tab. Close any stray OS dialog or reload, then try again."):(o==null?void 0:o.name)==="SecurityError"?new cl(`The browser refused the passkey request (SecurityError: ${o.message}). Passkeys need https or localhost, and a relying-party name equal to the page's host (${location.hostname}).`):(o==null?void 0:o.name)==="NotSupportedError"||(o==null?void 0:o.name)==="ConstraintError"?new cl(`The authenticator can't do this (${o.name}: ${o.message}).`):o instanceof Error?new Error(`${o.name??"Error"}: ${o.message}`):new Error(String(l))}const Pv=l=>({prf:{eval:{first:Cw.encode(l)}}});async function Fv(l,o){var S,g,b,x;if(!wi())throw new cl("This browser has no passkey support.");let c;try{c=await navigator.credentials.create({publicKey:{rp:{id:_c(),name:"BugXHunter"},user:{id:$a(16),name:l,displayName:"BugXHunter vault"},challenge:$a(32),pubKeyCredParams:[{type:"public-key",alg:-7},{type:"public-key",alg:-8},{type:"public-key",alg:-257}],authenticatorSelection:{residentKey:"preferred",userVerification:"required"},timeout:12e4,extensions:Pv(o)}})}catch(k){throw Zv(k)}if(!c)throw new rh;const u=c.getClientExtensionResults();if(!((S=u.prf)!=null&&S.enabled))throw new cl("This passkey can't derive keys (no PRF support). Use a platform passkey (Windows Hello, Touch ID, Android) or a recent security key, in Chrome, Edge or Safari 18+.");const d=c.response,h=(g=d.getPublicKey)==null?void 0:g.call(d);if(!h)throw new cl("This browser doesn't expose the passkey's public key (needed for sign-in). Use Chrome, Edge or Safari.");const m=((b=d.getTransports)==null?void 0:b.call(d))??void 0,y=qa.enc(new Uint8Array(c.rawId)),v=(x=u.prf.results)!=null&&x.first?new Uint8Array(u.prf.results.first):(await ch({challenge:qa.enc($a(32)),rpId:_c(),allowCredentials:[{id:y,transports:m}]},o)).prf;return{credentialId:y,transports:m,prf:v,publicKey:pn.enc(h),alg:d.getPublicKeyAlgorithm()}}async function ch(l,o){var m,y;if(!wi())throw new cl("This browser has no passkey support.");const c=_c();l.rpId&&l.rpId!==c&&console.warn(`[vault] server suggested rpId ${l.rpId}; using the page's host ${c}`);let u;try{u=await navigator.credentials.get({publicKey:{rpId:c,challenge:qa.dec(l.challenge),allowCredentials:l.allowCredentials.map(v=>({type:"public-key",id:qa.dec(v.id),transports:v.transports})),userVerification:"required",timeout:12e4,extensions:Pv(o)}})}catch(v){throw Zv(v)}if(!u)throw new rh;const d=u.response,h=u.getClientExtensionResults();return{assertion:{credentialId:qa.enc(new Uint8Array(u.rawId)),clientDataJSON:qa.enc(new Uint8Array(d.clientDataJSON)),authenticatorData:qa.enc(new Uint8Array(d.authenticatorData)),signature:qa.enc(new Uint8Array(d.signature))},prf:(y=(m=h.prf)==null?void 0:m.results)!=null&&y.first?new Uint8Array(h.prf.results.first):void 0}}async function Mw(l,o,c){const{prf:u}=await ch({challenge:qa.enc($a(32)),rpId:_c(),allowCredentials:[{id:l,transports:o}]},c);if(!u)throw new cl("The authenticator returned no PRF output. Use a passkey that supports PRF, or your recovery code.");return u}let uh=null;const Rc=l=>{uh=l},dh=()=>{uh=null},_w=()=>uh,If="or:unauthorized";async function Rw(){dh(),await Aw().catch(()=>{}),window.location.reload()}function Ow({children:l}){const[o,c]=A.useState("checking");return A.useEffect(()=>{bw().then(d=>c(d.required?d.authenticated?"signed-in":"signed-out":"open")).catch(()=>c("open"));const u=()=>c("signed-out");return window.addEventListener(If,u),()=>window.removeEventListener(If,u)},[]),o==="checking"?null:o==="signed-out"?s.jsx(Dw,{onSuccess:()=>c("signed-in")}):s.jsx(s.Fragment,{children:l})}function Dw({onSuccess:l}){const[o,c]=A.useState("passkey"),[u,d]=A.useState(""),[h,m]=A.useState(""),[y,v]=A.useState(""),[S,g]=A.useState(!1),[b,x]=A.useState(!1),[k,L]=A.useState(!1),[V,z]=A.useState(null),[Z,oe]=A.useState(null);A.useEffect(()=>{Tf().then(({methods:O})=>{g(O.some(X=>X.type==="passkey"&&!!X.passphrase)),x(O.some(X=>X.type==="password"))}).catch(()=>{})},[]);async function de(){var O;L(!0),z(null),oe(null);try{const X=await xw();if("open"in X)return l();const{methods:F}=await Tf(),ie=F.filter(ve=>ve.type==="passkey"),G=((O=ie[0])==null?void 0:O.prfSalt)??"bugxhunter-vault-prf-v1",{assertion:Q,prf:K}=await ch(X,G);await Sw(Q);const me=ie.find(ve=>ve.credentialId===Q.credentialId);if(me&&K)try{const ve=await Vv(me,K,me.passphrase?u:void 0);await qv(ve),Rc(ve)}catch{oe(me.passphrase?"Signed in; the vault stays locked (passphrase?) — unlock it from the sidebar.":"Signed in, but the vault didn't unlock — unlock it from the sidebar.")}l()}catch(X){z(X.message),L(!1)}}async function C(O){L(!0),z(null);try{const{methods:X}=await Tf();let F;try{if(O==="password"){const ie=X.find(G=>G.type==="password");if(!ie)throw new Error("no method");F=await Qv(ie,h)}else{const ie=X.find(G=>G.type==="recovery");if(!ie)throw new Error("no method");F=await Kv(ie,y)}}catch{throw new Error(O==="password"?"Wrong backup passphrase.":"That recovery code doesn't open the vault.")}await ww(F),Rc(F),l()}catch(X){z(X.message),L(!1)}}const Y=()=>{o==="passkey"?de():o==="password"?C("password"):o==="recovery"&&C("recovery")};return s.jsx("div",{className:"login-page grid-bg",children:s.jsxs("form",{className:"login-card",onSubmit:O=>{O.preventDefault(),Y()},children:[s.jsx(Bo,{title:"bugxhunter@redteam: ~/login"}),s.jsxs("div",{className:"login-body",children:[s.jsx("span",{className:"logo login-mark",style:{fontSize:34},"aria-label":"BugXHunter",children:s.jsx(Hv,{cursor:!0})}),s.jsx("div",{className:"login-tag",children:"Open-source AI security testing"}),o==="passkey"&&s.jsxs(s.Fragment,{children:[S&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{htmlFor:"pp",children:["vault passphrase ",s.jsx("span",{className:"muted",children:"(this passkey was enrolled with one)"})]}),s.jsx("input",{id:"pp",type:"password",autoFocus:!0,autoComplete:"current-password",value:u,onChange:O=>d(O.target.value)})]}),!wi()&&s.jsx("div",{className:"form-status error",children:"This browser has no passkey support. Use Chrome, Edge or Safari, or a backup."}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",type:"submit",autoFocus:!S,disabled:k||!wi(),children:k?"waiting for the passkey…":"./sign_in --passkey →"})}),s.jsxs("div",{className:"login-links",children:[b&&s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("password"),z(null)},children:"use the backup passphrase"}),s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("recovery"),z(null)},children:"use the recovery code"})]})]}),o==="password"&&s.jsxs(s.Fragment,{children:[s.jsx("label",{htmlFor:"bp",children:"backup passphrase"}),s.jsx("input",{id:"bp",type:"password",autoFocus:!0,autoComplete:"current-password",value:h,onChange:O=>m(O.target.value)}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",type:"submit",disabled:k||!h,children:k?"checking…":"./sign_in --passphrase →"})}),s.jsxs("div",{className:"login-links",children:[s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("passkey"),z(null)},children:"back to the passkey"}),s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("recovery"),z(null)},children:"use the recovery code"})]})]}),o==="recovery"&&s.jsxs(s.Fragment,{children:[s.jsx("label",{htmlFor:"rc",children:"recovery code"}),s.jsx("input",{id:"rc",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:y,onChange:O=>v(O.target.value)}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",type:"submit",disabled:k||!Bf(y),children:k?"checking…":"./sign_in --recovery →"})}),s.jsx("p",{className:"hint",style:{margin:0},children:"This signs you in and unlocks the vault. Enrol a new passkey right after, from the keys dialog."}),s.jsxs("div",{className:"login-links",children:[s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("passkey"),z(null)},children:"back to the passkey"}),s.jsx("button",{type:"button",className:"link-btn",disabled:k,onClick:()=>{c("lost"),z(null)},children:"lost that too?"})]})]}),o==="lost"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"hint",style:{margin:0},children:"Without the passkey, the backup passphrase or the recovery code the vault's secrets can't be recovered — by design, and by anyone. Someone with access to the server's files can reset it, which deletes the vault and reopens the app for a fresh setup:"}),s.jsx("pre",{className:"tool-output",style:{borderTop:"1px solid var(--border)"},children:`npm run vault:reset
52
52
  # Docker:
53
- docker compose exec runner rm /data/vault.json`}),i.jsx("p",{className:"hint",style:{margin:0},children:"Nothing on the network can do this, which is what keeps the lock meaningful."}),i.jsx("button",{type:"button",className:"link-btn",onClick:()=>{c("passkey"),L(null)},children:"back"})]}),K&&i.jsx("div",{className:"form-status success",children:K}),V&&i.jsx("div",{className:"form-status error",children:V})]})]})})}function ks({title:l,onClose:o,children:c}){return A.useEffect(()=>{if(!o)return;const u=d=>d.key==="Escape"&&o();return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[o]),i.jsx("div",{className:"overlay vault-dialog",onClick:o,children:i.jsxs("div",{className:"modal",role:"dialog","aria-label":l,onClick:u=>u.stopPropagation(),children:[i.jsxs("div",{className:"modal-head",children:[i.jsxs("span",{className:"modal-title",children:[i.jsx("span",{className:"dot y","aria-hidden":!0}),l]}),o&&i.jsx("button",{className:"icon-btn close-x",onClick:o,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),i.jsx("div",{className:"modal-body",children:c})]})})}const Do=10,Oc=()=>`BugXHunter vault (${location.hostname})`,kf="__custom__",pi=[{name:"SCX_API",short:"SCX.ai — the default provider",label:"SCX.ai model key — the default provider"},{name:"NVIDIA_API_KEY",short:"NVIDIA NIM — build.nvidia.com models",label:"NVIDIA NIM key — build.nvidia.com models incl. Nemotron, DeepSeek, GLM-5.3 (optional)"},{name:"ANTHROPIC_API_KEY",short:"Anthropic — Claude models",label:"Anthropic key — Claude Opus, Sonnet and Haiku (optional)"},{name:"OPENROUTER_API_KEY",short:"OpenRouter — one key, its whole catalogue",label:"OpenRouter key — unlocks its model catalogue (optional)"},{name:"AWS_BEARER_TOKEN_BEDROCK",short:"Amazon Bedrock — API key",label:"Amazon Bedrock API key — GLM 5.3 on Bedrock (optional; not needed when the runner has an AWS role or profile)"}],R1={SCX_API:"sk-scx-…",NVIDIA_API_KEY:"nvapi-…",ANTHROPIC_API_KEY:"sk-ant-…",OPENROUTER_API_KEY:"sk-or-…",AWS_BEARER_TOKEN_BEDROCK:"Bedrock API key"};function O1(){const[l,o]=A.useState(null),[c,u]=A.useState(null),[d,h]=A.useState(Date.now()),m=A.useCallback(()=>c1().then(o).catch(()=>{}),[]);A.useEffect(()=>{m();const g=setInterval(()=>{m(),h(Date.now())},3e4);return()=>clearInterval(g)},[m]);const y=()=>{u(null),m()},v=A.useCallback(()=>{dh(),d1().then(o).catch(()=>{})},[]);if(A.useEffect(()=>{const g=b=>{(b.ctrlKey||b.metaKey)&&b.shiftKey&&b.key.toLowerCase()==="l"&&(b.preventDefault(),v())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[v]),!l)return null;const S=l.initialised?l.unsealed?i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"vault-state open",title:l.idleMinutes?`Auto-locks after ${l.idleMinutes} min without activity`:"Auto-lock off",children:["vault open",l.sealsAt?` · locks in ${U1(l.sealsAt-d)}`:""]}),i.jsx("button",{className:"icon-btn vault-btn",onClick:()=>u("manage"),title:"Keys in the vault","aria-label":"Keys in the vault",children:i.jsx(L1,{})}),i.jsx("button",{className:"icon-btn vault-btn",onClick:v,title:"Lock the vault (Ctrl+Shift+L)","aria-label":"Lock the vault (Ctrl+Shift+L)",children:i.jsx(z1,{})})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"vault-state sealed",children:"vault locked"}),i.jsx("button",{className:"icon-btn vault-btn primary",onClick:()=>u("unlock"),title:"Unlock the vault","aria-label":"Unlock the vault",children:i.jsx(D1,{})})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"vault-state none",title:l.keySource==="none"?"No model key yet":l.keySource==="file"?"Model key comes from a key file":`Model key comes from ${l.keySource==="env"?".env":"OpenCode's auth.json"}, in the clear`,children:l.keySource==="none"?"no vault, no model key":"vault not set up"}),i.jsx("button",{className:"btn primary sm",onClick:()=>u("setup"),children:"set_up"})]});return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"vault-row",children:S}),c==="setup"&&i.jsx(H1,{onClose:y}),c==="unlock"&&i.jsx(B1,{status:l,onClose:y}),c==="manage"&&i.jsx(I1,{status:l,onChange:o,onClose:y})]})}const D1=()=>i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("circle",{cx:"12",cy:"16",r:"1"}),i.jsx("rect",{width:"18",height:"12",x:"3",y:"10",rx:"2"}),i.jsx("path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5"})]}),L1=()=>i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z"}),i.jsx("path",{d:"m14 7 3 3"}),i.jsx("path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814"})]}),z1=()=>i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[i.jsx("path",{d:"M12 13v3"}),i.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 01-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 011-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 011.52 0C14.51 3.81 17 5 19 5a1 1 0 011 1z"}),i.jsx("circle",{cx:"12",cy:"11",r:"2"})]});function U1(l){const o=Math.max(0,Math.round(l/6e4));return o>=60?`${Math.floor(o/60)}h ${String(o%60).padStart(2,"0")}m`:`${o}m`}const jf=["passkey","key","backups"];function H1({onClose:l}){const[o,c]=A.useState("passkey"),[u,d]=A.useState(null),[h,m]=A.useState("SCX_API"),[y,v]=A.useState(""),[S,g]=A.useState(""),[b,x]=A.useState(""),[k,D]=A.useState(null),[V,L]=A.useState(!1),[K,ce]=A.useState(!1),[de,E]=A.useState(!1),[G,H]=A.useState(null);async function Y(){E(!0),H(null);try{d(await Fv(Oc(),ah)),c("key")}catch(P){H(P.message)}finally{E(!1)}}async function F(){if(u){E(!0),H(null);try{D(await k1({...u,label:Oc(),items:y.trim()?{[h]:y.trim()}:{}})),c("backups")}catch(P){H(P.message)}finally{E(!1)}}}async function ie(){if(k){E(!0),H(null);try{let P=k.doc;S&&(P={...P,methods:[...P.methods,await oh(pn.dec(k.dek),S)]}),await u1(P,k.dek),Rc(k.dek),l()}catch(P){H(P.message),E(!1)}}}const X=!S||S.length>=Do&&S===b;return i.jsxs(ks,{title:"vault --init",onClose:o==="backups"?void 0:l,children:[i.jsx("div",{className:"steps",children:jf.map(P=>i.jsx("span",{className:P===o?"on":jf.indexOf(P)<jf.indexOf(o)?"done":"",children:P},P))}),o==="passkey"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Your model keys will be sealed at rest, and this passkey will unlock them and sign you in — one touch. The authenticator (Windows Hello, Touch ID, Android, or a security key) derives a secret that never leaves it. Works in Chrome, Edge and Safari 18+; Firefox can't do this yet."}),!wi()&&i.jsx("div",{className:"form-status error",children:"This browser has no passkey support."}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",disabled:de||!wi(),onClick:Y,children:de?"waiting for the authenticator…":"create passkey →"})})]}),o==="key"&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Passkey enrolled. Add a model key now, or later from the keys dialog (where you can add the other provider too). It goes straight into the sealed vault; ",i.jsx("code",{className:"mono",children:".env"})," can then drop the key."]}),i.jsx("label",{htmlFor:"v-provider",children:"Provider"}),i.jsx("select",{id:"v-provider",className:"mono",value:h,onChange:P=>m(P.target.value),children:pi.map(P=>i.jsx("option",{value:P.name,children:P.short},P.name))}),i.jsxs("label",{htmlFor:"v-key",children:[h," (optional)"]}),i.jsx("input",{id:"v-key",type:"password",autoFocus:!0,autoComplete:"off",placeholder:R1[h]??"",value:y,onChange:P=>v(P.target.value)}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",disabled:de,onClick:F,children:de?"sealing…":"next →"})})]}),o==="backups"&&k&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Backups, for when the passkey isn't at hand. This recovery code is shown ",i.jsx("b",{children:"once"})," and stored nowhere — keep it offline, like a password-manager note or paper."]}),i.jsxs("button",{type:"button",className:"recovery-code"+(K?" copied":""),"aria-label":"Recovery code — click to copy",title:"Click to copy",onClick:()=>{var P;(P=navigator.clipboard)==null||P.writeText(k.recoveryCode).then(()=>{ce(!0),setTimeout(()=>ce(!1),2e3)}).catch(()=>{})},children:[i.jsx("span",{className:"code",children:k.recoveryCode}),i.jsx("span",{className:"copy-hint",children:K?"✓ copied":"click to copy"})]}),i.jsxs("label",{className:"check",children:[i.jsx("input",{type:"checkbox",checked:V,onChange:P=>L(P.target.checked)})," I have stored this code somewhere safe."]}),i.jsxs("label",{htmlFor:"v-pass",children:["Backup passphrase (optional, at least ",Do," characters)"]}),i.jsx("input",{id:"v-pass",type:"password",autoComplete:"new-password",value:S,onChange:P=>g(P.target.value)}),S&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"v-pass2",children:"Again"}),i.jsx("input",{id:"v-pass2",type:"password",autoComplete:"new-password",value:b,onChange:P=>x(P.target.value)}),b&&S!==b&&i.jsx("div",{className:"form-status error",children:"The passphrases differ."})]}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",disabled:!V||!X||de,onClick:ie,children:de?"creating…":"create vault →"})})]}),G&&i.jsx("div",{className:"form-status error",children:G})]})}function B1({status:l,onClose:o}){const[c,u]=A.useState("passkey"),[d,h]=A.useState(""),[m,y]=A.useState(""),[v,S]=A.useState(!1),[g,b]=A.useState(null),x=l.methods.find(E=>E.type==="passkey"),k=l.methods.find(E=>E.type==="password"),D=l.methods.find(E=>E.type==="recovery"),V=!!(x!=null&&x.passphrase);async function L(E,G){S(!0),b(null);try{let H;try{H=await E()}catch(Y){throw Y instanceof Error&&/Passkey|authenticator|pending|origin/i.test(Y.message)?Y:new Error(G)}await Iv(H),Rc(H),o()}catch(H){b(H.message),S(!1)}}const K=()=>x&&L(async()=>{const E=await N1(x.credentialId,x.transports,x.prfSalt);return Yv(x,E,V?d:void 0)},V?"Wrong passphrase, or a different passkey than the one enrolled.":"A different passkey than the one enrolled."),ce=()=>k&&L(()=>Vv(k,d),"Wrong backup passphrase."),de=()=>D&&L(()=>Qv(D,m),"That recovery code doesn't open the vault.");return i.jsxs(ks,{title:"vault --unlock",onClose:o,children:[c==="passkey"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{children:V?"This passkey was enrolled with a passphrase: enter it, then confirm with the passkey.":"One touch: confirm with your passkey."}),V&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"v-unlock-pass",children:"Passphrase"}),i.jsx("input",{id:"v-unlock-pass",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:E=>h(E.target.value),onKeyDown:E=>{E.key==="Enter"&&d&&K()}})]}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",autoFocus:!V,disabled:v||!x||V&&!d,onClick:K,children:v?"waiting for the authenticator…":"unlock with passkey →"})}),i.jsxs("div",{className:"login-links",children:[k&&i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"}),D&&i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="password"&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"v-unlock-pw",children:"Backup passphrase"}),i.jsx("input",{id:"v-unlock-pw",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:E=>h(E.target.value),onKeyDown:E=>{E.key==="Enter"&&d&&ce()}}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",disabled:v||!d,onClick:ce,children:v?"unlocking…":"unlock →"})}),i.jsxs("div",{className:"login-links",children:[i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),D&&i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="recovery"&&i.jsxs(i.Fragment,{children:[i.jsx("p",{children:"Enter the recovery code shown when the vault was created."}),i.jsx("label",{htmlFor:"v-code",children:"Recovery code"}),i.jsx("input",{id:"v-code",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:m,onChange:E=>y(E.target.value),onKeyDown:E=>{E.key==="Enter"&&Bf(m)&&de()}}),i.jsx("div",{className:"perm-actions center",children:i.jsx("button",{className:"btn primary wide",disabled:v||!Bf(m),onClick:de,children:v?"unlocking…":"unlock →"})}),i.jsxs("div",{className:"login-links",children:[i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),k&&i.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"})]})]}),g&&i.jsx("div",{className:"form-status error",children:g})]})}function I1({status:l,onChange:o,onClose:c}){const[u,d]=A.useState("SCX_API"),[h,m]=A.useState(""),[y,v]=A.useState(""),[S,g]=A.useState(!1),[b,x]=A.useState(""),[k,D]=A.useState(!1),[V,L]=A.useState(null),K=E1(),ce=l.methods.filter(Q=>Q.type==="passkey"),de=l.methods.find(Q=>Q.type==="password");async function E(Q){D(!0),L(null);try{const me=await Q();me&&o(me)}catch(me){L(me.message)}finally{D(!1)}}const G=()=>{if(!K)throw new Error("Unlock the vault in this tab first (the change must wrap the current key).");return pn.dec(K)},H=()=>E(async()=>{const Q=await f1(u.trim().toUpperCase(),h);return m(""),Q}),Y=Q=>E(()=>h1(Q)),F=Q=>E(()=>m1(Q)),ie=()=>E(async()=>{const Q=G(),me=await Xv(Q,await Fv(Oc(),ah),Oc());return Gy(me,K)}),X=()=>E(async()=>{const Q=G(),me=await Gy(await oh(Q,y),K);return g(!1),v(""),me}),P=()=>E(async()=>{G();const Q=await p1(K);return dh(),c(),Q});return i.jsxs(ks,{title:"vault --keys",onClose:c,children:[i.jsx("p",{children:"Secrets sealed in the vault. Values are never shown again; replace one by saving it under the same name."}),i.jsxs("div",{className:"vault-items",children:[pi.map(Q=>{const me=l.items.includes(Q.name);return i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:me?"ok":"missing","aria-hidden":!0,children:me?"✓":"○"}),i.jsxs("span",{className:"name",children:[Q.name,i.jsxs("span",{className:"desc",children:[" — ",Q.label]})]}),me?i.jsx("button",{className:"btn danger",disabled:k,onClick:()=>Y(Q.name),title:"Remove",children:"✕"}):i.jsx("button",{className:"btn sm",disabled:k,onClick:()=>{d(Q.name),setTimeout(()=>{var ve;return(ve=document.getElementById("v-value"))==null?void 0:ve.focus()},0)},children:"add"})]},Q.name)}),l.items.filter(Q=>!pi.some(me=>me.name===Q)).map(Q=>i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),i.jsx("span",{className:"name",children:Q}),i.jsx("button",{className:"btn danger",disabled:k,onClick:()=>Y(Q),title:"Remove",children:"✕"})]},Q))]}),i.jsx("label",{htmlFor:"v-name",children:"Key"}),i.jsxs("select",{id:"v-name",className:"mono",value:pi.some(Q=>Q.name===u)?u:kf,onChange:Q=>d(Q.target.value===kf?"":Q.target.value),children:[pi.map(Q=>i.jsxs("option",{value:Q.name,children:[Q.name,l.items.includes(Q.name)?" (replace)":""]},Q.name)),i.jsx("option",{value:kf,children:"custom…"})]}),!pi.some(Q=>Q.name===u)&&i.jsx("input",{type:"text",className:"mono",placeholder:"NAME_IN_UPPER_SNAKE_CASE","aria-label":"Custom key name",value:u,onChange:Q=>d(Q.target.value),spellCheck:!1,autoFocus:!0}),i.jsx("label",{htmlFor:"v-value",children:"Value"}),i.jsx("input",{id:"v-value",type:"password",autoComplete:"off",value:h,onChange:Q=>m(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&h&&H()}}),i.jsxs("div",{className:"perm-actions",children:[i.jsx("button",{className:"btn primary sm",disabled:k||!h||!u.trim(),onClick:H,children:k?"sealing…":"save"}),i.jsx("span",{className:"hint",style:{margin:0},children:l.idleMinutes?`Auto-locks after ${l.idleMinutes} min idle.`:"Auto-lock is off."})]}),i.jsx("div",{className:"section-title",children:"passkeys"}),i.jsx("p",{children:"Each passkey unlocks the vault and signs you in with one touch. Keep two, on different devices, so losing one is not an emergency."}),i.jsx("div",{className:"vault-items",children:ce.map(Q=>i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:Q.canLogin?"ok":"warn","aria-hidden":!0,children:Q.canLogin?"✓":"!"}),i.jsxs("span",{className:"name",children:[Q.label,Q.passphrase?" — needs its passphrase (older enrolment)":"",Q.canLogin?"":" — unlock only, can't sign in; add a new passkey"]}),i.jsx("button",{className:"btn danger",disabled:k||ce.length<=1,onClick:()=>F(Q.id),title:ce.length<=1?"Add another passkey first":"Remove",children:"✕"})]},Q.id))}),i.jsx("div",{className:"perm-actions",children:i.jsx("button",{className:"btn sm",disabled:k||!K,onClick:ie,title:K?"":"Unlock the vault in this tab first",children:k?"waiting for the authenticator…":"+ add passkey"})}),i.jsx("div",{className:"section-title",children:"backups"}),i.jsx("p",{children:"The recovery code from setup always works. A backup passphrase is optional: a way in on a device without the passkey."}),i.jsxs("div",{className:"vault-items",children:[i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),i.jsx("span",{className:"name",children:"Recovery code"})]}),de&&i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),i.jsx("span",{className:"name",children:"Backup passphrase"}),i.jsx("button",{className:"btn danger",disabled:k,onClick:()=>F(de.id),title:"Remove",children:"✕"})]})]}),S?i.jsxs(i.Fragment,{children:[i.jsxs("label",{htmlFor:"v-newpass",children:[de?"New backup passphrase":"Backup passphrase"," (at least ",Do," characters)"]}),i.jsx("input",{id:"v-newpass",type:"password",autoFocus:!0,autoComplete:"new-password",value:y,onChange:Q=>v(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&y.length>=Do&&X()}}),i.jsxs("div",{className:"perm-actions",children:[i.jsx("button",{className:"btn primary sm",disabled:k||y.length<Do,onClick:X,children:k?"sealing…":"save"}),i.jsx("button",{className:"btn sm",disabled:k,onClick:()=>g(!1),children:"cancel"})]})]}):i.jsx("div",{className:"perm-actions",children:i.jsx("button",{className:"btn sm",disabled:k||!K,onClick:()=>g(!0),title:K?"":"Unlock the vault in this tab first",children:de?"replace backup passphrase":"+ set a backup passphrase"})}),i.jsx("div",{className:"section-title",children:"danger zone"}),i.jsxs("p",{children:["Delete the vault to start over with new factors. Its secrets are gone; the app reopens without sign-in until a new vault exists. Lost every factor instead? Run ",i.jsx("code",{className:"mono",children:"npm run vault:reset"})," on the server."]}),i.jsxs("div",{className:"perm-actions",children:[i.jsx("input",{type:"text",className:"mono",placeholder:"type DELETE",value:b,onChange:Q=>x(Q.target.value),style:{width:160}}),i.jsx("button",{className:"btn danger-outline sm",disabled:k||b!=="DELETE"||!K,onClick:P,children:"delete vault"})]}),V&&i.jsx("div",{className:"form-status error",children:V})]})}function Yt({size:l=14,children:o,className:c}){return i.jsx("svg",{className:c,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o})}const fh=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),i.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),i.jsx("path",{d:"M10 9H8"}),i.jsx("path",{d:"M16 13H8"}),i.jsx("path",{d:"M16 17H8"})]}),q1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34"}),i.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),i.jsx("path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z"})]}),$1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M12 19h8"}),i.jsx("path",{d:"m4 17 6-6-6-6"})]}),Xy=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"m21 21-4.34-4.34"}),i.jsx("circle",{cx:"11",cy:"11",r:"8"})]}),G1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1"}),i.jsx("path",{d:"m21 21-1.9-1.9"}),i.jsx("circle",{cx:"17",cy:"17",r:"3"})]}),X1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M3 5h.01"}),i.jsx("path",{d:"M3 12h.01"}),i.jsx("path",{d:"M3 19h.01"}),i.jsx("path",{d:"M8 5h13"}),i.jsx("path",{d:"M8 12h13"}),i.jsx("path",{d:"M8 19h13"})]}),Y1=l=>i.jsxs(Yt,{...l,children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),i.jsx("path",{d:"M2 12h20"})]}),V1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M13 5h8"}),i.jsx("path",{d:"M13 12h8"}),i.jsx("path",{d:"M13 19h8"}),i.jsx("path",{d:"m3 17 2 2 4-4"}),i.jsx("path",{d:"m3 7 2 2 4-4"})]}),Q1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),i.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.jsx("path",{d:"M12 17h.01"})]}),K1=l=>i.jsx(Yt,{...l,children:i.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"})}),Z1=l=>i.jsxs(Yt,{...l,children:[i.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"18",r:"3"}),i.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),Pv=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),i.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),F1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V3a1 1 0 0 1 1-1h2.172a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 13.828 4H20Z"}),i.jsx("path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1"})]}),hh=l=>i.jsx(Yt,{...l,children:i.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),P1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),i.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"})]}),J1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M12 3v12"}),i.jsx("path",{d:"m17 8-5-5-5 5"}),i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]}),W1=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M12 15V3"}),i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("path",{d:"m7 10 5 5 5-5"})]}),ew=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M10 11v6"}),i.jsx("path",{d:"M14 11v6"}),i.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),tw=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M5 12h14"}),i.jsx("path",{d:"M12 5v14"})]}),nw=l=>i.jsxs(Yt,{...l,children:[i.jsx("path",{d:"M14 9 9 4 4 9"}),i.jsx("path",{d:"M20 20h-7a4 4 0 0 1-4-4V4"})]}),Vc=l=>i.jsx(Yt,{...l,children:i.jsx("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})});function aw({tool:l,size:o=14}){switch(l){case"read":return i.jsx(fh,{size:o});case"write":case"edit":case"patch":case"apply_patch":return i.jsx(q1,{size:o});case"bash":return i.jsx($1,{size:o});case"grep":return i.jsx(Xy,{size:o});case"glob":case"list":return i.jsx(G1,{size:o});case"webfetch":return i.jsx(Y1,{size:o});case"websearch":return i.jsx(Xy,{size:o});case"todowrite":case"todoread":return i.jsx(V1,{size:o});case"task":return i.jsx(X1,{size:o});case"question":return i.jsx(Q1,{size:o});default:return i.jsx(K1,{size:o})}}async function js(l,o){var u,d;const c=await fetch(l,{headers:{"Content-Type":"application/json"},...o});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const lw=()=>js("/api/github"),sw=()=>js("/api/github/repos").then(l=>l.repos),iw=l=>js(`/api/github/branches?repo=${encodeURIComponent(l)}`).then(o=>o.branches),ow=l=>js("/api/github/clone",{method:"POST",body:JSON.stringify(l)}),rw=()=>js("/api/github/connect/start",{method:"POST"}),cw=l=>js("/api/github/connect/poll",{method:"POST",body:JSON.stringify({id:l})}),uw=()=>js("/api/github/connect",{method:"DELETE"});function Dc(l){if(!l)return"";const o=Math.max(0,(Date.now()-new Date(l).getTime())/1e3);return o<3600?`${Math.max(1,Math.round(o/60))} min ago`:o<86400?`${Math.round(o/3600)} h ago`:o<86400*30?`${Math.round(o/86400)} d ago`:o<86400*365?`${Math.round(o/(86400*30))} mo ago`:`${Math.round(o/(86400*365))} y ago`}function dw({onOpen:l,onClose:o}){const[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState(""),[g,b]=A.useState(null),[x,k]=A.useState(null),[D,V]=A.useState(""),[L,K]=A.useState(null),[ce,de]=A.useState(null),[E,G]=A.useState(null),[H,Y]=A.useState(!1),F=A.useCallback(()=>lw().then(ee=>{u(ee),h(null)}).catch(ee=>h(ee.message)),[]);A.useEffect(()=>{F()},[F]);const ie=!!(c!=null&&c.connected&&!c.sealed&&!c.error),X=A.useCallback(()=>{K("repos"),sw().then(y).catch(ee=>de(ee.message)).finally(()=>K(ee=>ee==="repos"?null:ee))},[]);A.useEffect(()=>{ie&&X()},[ie,X]),A.useEffect(()=>{if(!ie)return;const ee=()=>X();return window.addEventListener("focus",ee),()=>window.removeEventListener("focus",ee)},[ie,X]);const P=A.useRef(null),Q=()=>{P.current&&(window.clearTimeout(P.current),P.current=null)};A.useEffect(()=>Q,[]);async function me(){K("connect"),de(null);try{const ee=await rw();G(ee);try{await navigator.clipboard.writeText(ee.userCode),Y(!0)}catch{Y(!1)}const ke=async()=>{try{const Ze=await cw(ee.id);if(Ze.status==="pending"){P.current=window.setTimeout(ke,ee.interval*1e3);return}if(G(null),K(null),Ze.status==="connected"){await F();return}de(Ze.status==="denied"?"The sign-in was cancelled on GitHub.":"The code expired. Start again.")}catch(Ze){G(null),K(null),de(Ze.message)}};P.current=window.setTimeout(ke,ee.interval*1e3)}catch(ee){K(null),de(ee.message)}}function ve(){Q(),G(null),K(null)}async function Ce(){de(null);try{await uw(),y(null),b(null),await F()}catch(ee){de(ee.message)}}function ne(ee){b(ee),V(ee.defaultBranch),k(null),de(null),K("branches"),iw(ee.fullName).then(ke=>{k(ke),!ke.some(Ze=>Ze.name===ee.defaultBranch)&&ke[0]&&V(ke[0].name)}).catch(ke=>de(ke.message)).finally(()=>K(ke=>ke==="branches"?null:ke))}async function te(){if(g){K("clone"),de(null);try{const ee=await ow({repo:g.fullName,branch:D});l(ee.directory),o()}catch(ee){de(ee.message)}finally{K(null)}}}const re=A.useMemo(()=>{const ee=v.trim().toLowerCase();return(m??[]).filter(ke=>!ee||ke.fullName.toLowerCase().includes(ee)||(ke.description??"").toLowerCase().includes(ee))},[m,v]);return i.jsxs(ks,{title:"github --clone",onClose:o,children:[d&&i.jsx("div",{className:"hint danger",children:d}),c&&!c.connected&&!E&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Clone a repository into the workspace so the agent can review it. ",i.jsx("b",{children:"Read-only"}),": the app can only read code, it reaches only the repositories you install it on, and nothing in the sandbox can push."]}),i.jsx("div",{className:"perm-actions center",children:i.jsxs("button",{className:"btn primary wide",disabled:L!==null,onClick:me,children:[i.jsx(Pv,{size:15})," ",L==="connect"?"contacting GitHub…":"Connect GitHub"]})}),c.storage==="memory"&&i.jsx("div",{className:"hint",style:{textAlign:"center"},children:"No vault yet, so the sign-in is kept until the runner restarts. Set up the vault to keep it."})]}),E&&i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Enter this code on GitHub to connect. ",H?"It is on your clipboard.":"Click it to copy."]}),i.jsx("button",{className:"recovery-code gh-code",onClick:()=>navigator.clipboard.writeText(E.userCode).then(()=>Y(!0)).catch(()=>{}),title:"Copy",children:E.userCode}),i.jsx("div",{className:"perm-actions center",children:i.jsx("a",{className:"btn primary wide",href:E.verificationUri,target:"_blank",rel:"noreferrer",children:"Open github.com/login/device ↗"})}),i.jsxs("div",{className:"hint",style:{textAlign:"center"},children:["Waiting for your approval… this finishes by itself. ",i.jsx("button",{className:"link-btn",onClick:ve,children:"cancel"})]})]}),(c==null?void 0:c.sealed)&&i.jsx("p",{children:"Your GitHub sign-in is in the vault, which is locked. Unlock it (the lock icon below) and reopen this dialog."}),(c==null?void 0:c.error)&&i.jsx("div",{className:"hint danger",children:c.error}),ie&&i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"gh-head",children:[i.jsxs("span",{children:["connected as ",i.jsx("b",{children:c.login}),c.storage==="memory"?" · until restart (no vault yet)":""," · ",i.jsx("button",{className:"link-btn",onClick:Ce,children:"disconnect"})]}),i.jsx("a",{href:c.installUrl,target:"_blank",rel:"noreferrer",children:"choose repositories on GitHub ↗"})]}),c.clones.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"section-title",children:"in the workspace"}),i.jsx("div",{className:"vault-items",children:c.clones.map(ee=>i.jsxs("div",{className:"vault-item",children:[i.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),i.jsxs("span",{className:"name",title:ee.directory,children:[ee.fullName,i.jsxs("span",{className:"desc",children:[" — ",ee.branch??"detached"]})]}),i.jsx("button",{className:"btn sm",onClick:()=>{l(ee.directory),o()},children:"open"})]},ee.directory))})]}),m&&m.length===0?i.jsxs("div",{className:"gh-callout",children:[i.jsx("b",{children:"One more step."})," Signing in says who you are; which repositories BugXHunter may read is chosen separately, on GitHub's install screen. An organisation's owner may have to approve it. This list refreshes when you come back.",i.jsx("div",{className:"perm-actions center",children:i.jsx("a",{className:"btn primary wide",href:c.installUrl,target:"_blank",rel:"noreferrer",children:"Choose repositories on GitHub ↗"})})]}):i.jsxs(i.Fragment,{children:[i.jsx("input",{type:"text",className:"mono",placeholder:"filter repositories…",value:v,onChange:ee=>S(ee.target.value),spellCheck:!1,autoFocus:!0}),i.jsxs("div",{className:"gh-list",role:"listbox","aria-label":"Repositories",children:[L==="repos"&&!m&&i.jsx("div",{className:"hint",children:"loading…"}),m&&m.length>0&&re.length===0&&i.jsx("div",{className:"hint",children:"Nothing matches."}),re.map(ee=>i.jsxs("button",{className:`gh-repo${(g==null?void 0:g.fullName)===ee.fullName?" selected":""}`,role:"option","aria-selected":(g==null?void 0:g.fullName)===ee.fullName,onClick:()=>ne(ee),children:[i.jsxs("span",{className:"gh-name",children:[ee.fullName,ee.private&&i.jsx("span",{className:"badge",children:"private"}),ee.archived&&i.jsx("span",{className:"badge",children:"archived"}),ee.directory&&i.jsx("span",{className:"badge on",children:"in workspace"})]}),ee.description&&i.jsx("span",{className:"gh-desc",children:ee.description}),i.jsxs("span",{className:"gh-meta",children:[i.jsx(Z1,{size:11})," ",ee.defaultBranch,ee.pushedAt?` · pushed ${Dc(ee.pushedAt)}`:""]})]},ee.fullName))]})]}),g&&i.jsxs("div",{className:"gh-clone",children:[i.jsx("label",{htmlFor:"gh-branch",children:"Branch"}),i.jsx("select",{id:"gh-branch",className:"mono",value:D,onChange:ee=>V(ee.target.value),disabled:!x,children:(x??[{name:D,isDefault:!0}]).map(ee=>i.jsxs("option",{value:ee.name,children:[ee.name,ee.isDefault?" (default)":""]},ee.name))}),i.jsx("button",{className:"btn primary sm",disabled:L!==null||!D,onClick:te,children:L==="clone"?g.directory?"updating…":"cloning…":g.directory?"update & open":"clone & open"})]}),g&&i.jsxs("div",{className:"hint",children:["Lands in ",i.jsxs("span",{className:"mono",children:[c.cloneRoot,"/",g.fullName]}),". An existing clone is fast-forwarded, never reset; the agent's local edits stay."]})]}),ce&&i.jsx("div",{className:"hint danger",children:ce})]})}function fw({current:l,onOpen:o,onDeleted:c,onClose:u}){const[d,h]=A.useState(""),[m,y]=A.useState(null),[v,S]=A.useState(""),[g,b]=A.useState(null),[x,k]=A.useState(""),[D,V]=A.useState(!1),[L,K]=A.useState(null),ce=A.useCallback(()=>FS().then(H=>{h(H.root),y(H.workspaces)}).catch(H=>K(H.message)),[]);A.useEffect(()=>{ce()},[ce]);async function de(H){V(!0),K(null);try{await H()}catch(Y){K(Y.message)}finally{V(!1)}}const E=()=>de(async()=>{const H=await PS(v.trim());S(""),o(H.directory),u()}),G=H=>de(async()=>{await JS(H.directory),c(H.directory),b(null),k(""),await ce()});return i.jsxs(ks,{title:"workspace --list",onClose:u,children:[i.jsxs("p",{children:["Each workspace is a folder the agent works in",d?i.jsxs(i.Fragment,{children:[" under ",i.jsx("span",{className:"mono",children:d})]}):null,". Repositories cloned from GitHub appear here too."]}),i.jsxs("div",{className:"ws-new",children:[i.jsx("input",{type:"text",className:"mono",placeholder:"new-workspace-name","aria-label":"New workspace name",value:v,spellCheck:!1,onChange:H=>S(H.target.value),onKeyDown:H=>{H.key==="Enter"&&v.trim()&&E()}}),i.jsxs("button",{className:"btn primary sm",disabled:D||!v.trim(),onClick:E,children:[i.jsx(tw,{size:13})," create"]})]}),i.jsxs("div",{className:"gh-list",role:"list",children:[!m&&!L&&i.jsx("div",{className:"hint",children:"loading…"}),m&&m.length===0&&i.jsx("div",{className:"hint",children:"No workspaces yet. Create one above, or clone a repository from GitHub."}),m==null?void 0:m.map(H=>{const Y=H.directory===l;return i.jsxs("div",{className:`ws-row${Y?" current":""}`,role:"listitem",children:[i.jsxs("button",{className:"ws-open",onClick:()=>{o(H.directory),u()},disabled:Y,title:Y?"This is the open project":`Open ${H.directory}`,children:[i.jsx(hh,{size:14}),i.jsxs("span",{className:"gh-name",children:[H.name,Y&&i.jsx("span",{className:"badge on",children:"open"}),!H.git&&i.jsx("span",{className:"badge",children:"no git"})]}),i.jsx("span",{className:"gh-meta",children:H.modified?`changed ${Dc(H.modified)}`:""})]}),i.jsx("button",{className:"icon-btn ws-del",disabled:D||Y,onClick:()=>{b(H),k("")},title:Y?"Open another project before deleting this one":`Delete ${H.name}`,"aria-label":`Delete ${H.name}`,children:i.jsx(ew,{size:14})})]},H.directory)})]}),g&&i.jsxs("div",{className:"ws-confirm",children:[i.jsxs("p",{children:[i.jsxs("b",{children:["Delete ",g.name,"?"]})," Everything in ",i.jsx("span",{className:"mono",children:g.directory})," is removed, including work the agent has not pushed anywhere. Type the name to confirm."]}),i.jsxs("div",{className:"ws-new",children:[i.jsx("input",{type:"text",className:"mono",autoFocus:!0,placeholder:g.name,"aria-label":"Type the workspace name to confirm",value:x,spellCheck:!1,onChange:H=>k(H.target.value),onKeyDown:H=>{H.key==="Enter"&&x===g.name&&G(g)}}),i.jsx("button",{className:"btn danger-outline sm",disabled:D||x!==g.name,onClick:()=>G(g),children:D?"deleting…":"delete"}),i.jsx("button",{className:"btn sm",disabled:D,onClick:()=>b(null),children:"cancel"})]})]}),L&&i.jsx("div",{className:"hint danger",children:L})]})}function zo(l){return l>=1024*1024?(l/1024/1024).toFixed(1)+" MB":l>=1024?Math.round(l/1024)+" KB":l+" B"}function Ai(l){return l>=1e6?(l/1e6).toFixed(l%1e6?1:0)+"M":l>=1e3?Math.round(l/1e3)+"k":String(l)}const Yy=l=>(l<1e4?(l/1e3).toFixed(1):Math.round(l/1e3))+"s";function Jv(l,o,c){const u=[];l.ttft!==void 0&&u.push(`${Yy(l.ttft)} to first token`);const d=c?l.total:l.total-(l.ttft??0);return o&&d>50&&u.push(`${Math.round(o/(d/1e3))} tok/s`),u.push(`${Yy(l.total)} total`),u.join(" · ")}function hw(l,o){const c=o?` ${o.toLocaleString("en")} tokens went on reasoning.`:"";return l!=null&&l.trim()?`Cut off at the Max tokens limit.${c} Raise Max tokens in the sidebar to get the rest.`:`The model reached the Max tokens limit before it wrote an answer.${c||" A reasoning model thinks first, and that counts."} Raise Max tokens in the sidebar and send again.`}function mw({directory:l,onClose:o}){const[c,u]=A.useState(""),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState([]),[g,b]=A.useState(null),[x,k]=A.useState(!1),D=A.useRef(null),V=A.useCallback(E=>{b(null),WS(l,E).then(G=>{h(G),u(G.path)}).catch(G=>b(G.message))},[l]);A.useEffect(()=>{V("")},[V]);async function L(E){const G=Array.from(E);if(!G.length)return;b(null);const H=[];for(let Y=0;Y<G.length;Y++){const F=G[Y];y(`uploading ${Y+1} of ${G.length}: ${F.name}`);try{const ie=await e1(l,c,F);H.push(ie.name===F.name?`${ie.path} (${zo(ie.bytes)})`:`${F.name} → ${ie.path}, as a file of that name exists`)}catch(ie){H.push(`${F.name}: ${ie.message}`)}}y(null),S(H),V(c)}const K=E=>{E.preventDefault(),k(!1),E.dataTransfer.files.length&&L(E.dataTransfer.files)},ce=c?c.split("/"):[],de=l.split(/[\\/]/).filter(Boolean).pop()??l;return i.jsxs(ks,{title:"files --browse",onClose:o,children:[i.jsxs("div",{className:"files-head",children:[i.jsxs("nav",{className:"files-crumbs mono","aria-label":"Folder",children:[i.jsx("button",{className:"link-btn",onClick:()=>V(""),title:l,children:de}),ce.map((E,G)=>i.jsxs("span",{children:[i.jsx("span",{className:"sep",children:"/"}),i.jsx("button",{className:"link-btn",onClick:()=>V(ce.slice(0,G+1).join("/")),children:E})]},G))]}),i.jsxs("button",{className:"btn primary sm",disabled:!!m,onClick:()=>{var E;return(E=D.current)==null?void 0:E.click()},children:[i.jsx(J1,{size:13})," upload"]}),i.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,onChange:E=>{E.target.files&&L(E.target.files),E.target.value=""}})]}),i.jsxs("div",{className:`gh-list files-list${x?" dragging":""}`,role:"list",onDragOver:E=>{E.preventDefault(),k(!0)},onDragLeave:()=>k(!1),onDrop:K,children:[!d&&!g&&i.jsx("div",{className:"hint",children:"loading…"}),c&&i.jsxs("button",{className:"file-row",onClick:()=>V(ce.slice(0,-1).join("/")),children:[i.jsx(nw,{size:14}),i.jsx("span",{className:"file-name",children:".."})]}),d&&d.entries.length===0&&i.jsx("div",{className:"hint",children:"Empty. Drop files here, or use upload."}),d==null?void 0:d.entries.map(E=>{const G=c?`${c}/${E.name}`:E.name;return E.type==="dir"?i.jsxs("button",{className:"file-row",onClick:()=>V(G),children:[i.jsx(hh,{size:14}),i.jsxs("span",{className:"file-name",children:[E.name,"/"]}),i.jsx("span",{className:"gh-meta",children:E.modified?Dc(E.modified):""})]},E.name):i.jsxs("a",{className:"file-row",href:t1(l,G),download:E.name,title:`Download ${G}`,children:[i.jsx(P1,{size:14}),i.jsx("span",{className:"file-name",children:E.name}),i.jsxs("span",{className:"gh-meta",children:[zo(E.size),E.modified?` · ${Dc(E.modified)}`:""]}),i.jsx(W1,{size:13,className:"file-dl"})]},E.name)}),(d==null?void 0:d.truncated)&&i.jsx("div",{className:"hint",children:"Showing the first 2000 entries."})]}),i.jsx("div",{className:"hint",children:m??"Click a file to download it. Drop files on the list to upload them into this folder; nothing is overwritten."}),v.length>0&&i.jsx("ul",{className:"files-notes",children:v.map((E,G)=>i.jsx("li",{className:"mono",children:E},G))}),g&&i.jsx("div",{className:"hint danger",children:g})]})}const pw=/(embed|rerank|retriev|guard|safety|detector|deplot|calibration|reward|whisper|\bstt\b|\btts\b|parse|ocr|opir)/i;function Lc(l){return l.output_modalities.includes("text")?!pw.test(`${l.id} ${l.name}`):!1}function gw(l,o){const c=o.trim().toLowerCase();return!c||`${l.name} ${l.id}`.toLowerCase().includes(c)}const Wv=[{id:"A01:2025",name:"Broken Access Control",stride:"E",look:"object or function reachable by changing an id, role or URL; missing checks server-side; CORS, path traversal, IDOR, forced browsing, JWT or cookie tampering",fix:"deny by default, enforce ownership and role on the server for every object and function, log failures, rate-limit automation"},{id:"A02:2025",name:"Security Misconfiguration",stride:"I",look:"defaults left on, debug or admin interfaces exposed, verbose errors, permissive cloud storage, missing hardening headers, unneeded features and ports",fix:"hardened repeatable builds, minimal platform, configuration review per environment, automated drift checks"},{id:"A03:2025",name:"Software Supply Chain Failures",stride:"T",look:"unpinned or unverified dependencies, build and CI steps that can be tampered with, packages from untrusted registries, no SBOM, unsigned artifacts",fix:"pin and verify dependencies, signed builds with provenance, SBOM, dependency and container scanning, least privilege for CI tokens"},{id:"A04:2025",name:"Cryptographic Failures",stride:"I",look:"plaintext or weak transport, secrets or PII stored unencrypted, weak algorithms or key sizes, home-made crypto, keys in code, poor randomness",fix:"TLS everywhere, modern algorithms (AES-256-GCM, SHA-256+, Argon2 or bcrypt for passwords), key management, encrypt data at rest, no custom crypto"},{id:"A05:2025",name:"Injection",stride:"T",look:"user input reaching SQL, NoSQL, OS commands, LDAP, templates, XPath or HTML without separation; string-built queries; reflected or stored script",fix:"parameterised queries and safe APIs, allow-list validation, contextual output encoding, CSP, no shell from input"},{id:"A06:2025",name:"Insecure Design",stride:"STRIDE",look:"missing threat model, business-logic abuse (replay, race, quota bypass), trust placed in the client, recovery flows that leak or bypass, no abuse cases",fix:"threat modelling in design, secure design patterns and reference architectures, abuse-case tests, limits on business flows"},{id:"A07:2025",name:"Authentication Failures",stride:"S",look:"credential stuffing and brute force possible, weak or default passwords, no MFA on sensitive actions, session ids in URLs, sessions not rotated or expired, weak recovery",fix:"MFA, breached-password checks, rate limits and lockout, server-side session management with rotation and expiry, secure recovery"},{id:"A08:2025",name:"Software or Data Integrity Failures",stride:"T",look:"unsigned updates and plugins, insecure deserialisation, CI pipelines or auto-update channels that trust unverified input, integrity of data in transit between services unchecked",fix:"signatures and verification for code, updates and serialised data; integrity checks in pipelines; no deserialisation of untrusted input"},{id:"A09:2025",name:"Security Logging and Alerting Failures",stride:"R",look:"logins, access failures and high-value actions not logged, logs without context or integrity, no alerting, no response plan, logs that leak secrets",fix:"log auth and authorisation events with user and time, protect log integrity, alert on patterns, test the response playbook"},{id:"A10:2025",name:"Mishandling of Exceptional Conditions",stride:"D",look:"errors that fail open, unhandled exceptions, resource exhaustion, retries without limits, partial failures that leave state inconsistent, error messages with internals",fix:"fail closed, handle every error path, timeouts and limits, idempotent operations, generic errors to users with detail in logs"}],e0=[{id:"API1:2023",name:"Broken Object Level Authorization",stride:"E",look:"endpoints that take an object id and never check the caller owns it",fix:"authorise every object access against the session's identity; random ids are not a control"},{id:"API2:2023",name:"Broken Authentication",stride:"S",look:"weak tokens, no expiry or rotation, credentials in URLs, unauthenticated sensitive endpoints, auth that differs between API versions",fix:"standard, tested auth on every endpoint; short-lived tokens; MFA for sensitive flows"},{id:"API3:2023",name:"Broken Object Property Level Authorization",stride:"I",look:"responses that return more fields than the client needs; mass assignment of fields the user may not set",fix:"explicit response schemas and allow-lists for writable properties"},{id:"API4:2023",name:"Unrestricted Resource Consumption",stride:"D",look:"no limits on request rate, payload size, pagination, uploads or paid third-party calls",fix:"rate limits, quotas, size and pagination caps, spend limits on paid services"},{id:"API5:2023",name:"Broken Function Level Authorization",stride:"E",look:"admin or privileged functions reachable by guessing the route or changing the method",fix:"deny by default, role checks on every function, one authorisation module"},{id:"API6:2023",name:"Unrestricted Access to Sensitive Business Flows",stride:"D",look:"flows like purchase, signup, voting or booking callable at scale by scripts",fix:"detect and slow automation: device fingerprinting, step-up, human checks, business limits"},{id:"API7:2023",name:"Server Side Request Forgery",stride:"I",look:"the API fetches a URL the client supplies: webhooks, imports, previews, image fetchers",fix:"allow-list destinations, block internal ranges and metadata endpoints, no redirects, isolated fetcher"},{id:"API8:2023",name:"Security Misconfiguration",stride:"I",look:"missing TLS, permissive CORS, verbose errors, unneeded HTTP methods, unpatched components",fix:"hardening baseline, automated configuration checks, patching"},{id:"API9:2023",name:"Improper Inventory Management",stride:"I",look:"old API versions, debug or staging endpoints still live, undocumented hosts and data flows",fix:"inventory of hosts, versions and data flows; retire old versions; document data sharing"},{id:"API10:2023",name:"Unsafe Consumption of APIs",stride:"T",look:"data from third-party APIs trusted without validation, followed redirects, unencrypted upstream calls",fix:"validate and limit upstream responses, TLS to upstreams, timeouts, no blind redirects"}],t0=[{id:"LLM01:2025",name:"Prompt Injection",stride:"T",look:"user or retrieved content changes the model's instructions; indirect injection through documents, web pages, tool results, emails",fix:"treat all model input as untrusted, separate instructions from data, constrain output format, least privilege for what the model can trigger, human approval for consequential actions"},{id:"LLM02:2025",name:"Sensitive Information Disclosure",stride:"I",look:"secrets, PII or system details in training data, context or outputs; model repeats what one user told it to another",fix:"scrub data, scope context per user, output filtering, no secrets in prompts"},{id:"LLM03:2025",name:"Supply Chain",stride:"T",look:"third-party models, adapters, datasets, plugins or packages with no provenance; pickled or unsigned model files",fix:"verified sources, signed artifacts, AI bill of materials, scan model files, pin versions"},{id:"LLM04:2025",name:"Data and Model Poisoning",stride:"T",look:"training, fine-tuning or embedding data that an outsider can influence; backdoor triggers",fix:"dataset provenance and validation, anomaly checks, hold-out evaluation, sandbox fine-tuning"},{id:"LLM05:2025",name:"Improper Output Handling",stride:"T",look:"model output rendered as HTML, executed as code or SQL, or passed to a shell or another API without validation",fix:"treat output as untrusted input: encode, validate, parameterise, sandbox execution"},{id:"LLM06:2025",name:"Excessive Agency",stride:"E",look:"tools and permissions beyond the task, autonomous actions with no approval, one credential for every tool",fix:"minimal tools and scopes, per-action authorisation, human in the loop for consequential actions, kill switch"},{id:"LLM07:2025",name:"System Prompt Leakage",stride:"I",look:"system prompt holds secrets, roles or rules the security depends on; it can be extracted by asking",fix:"no secrets or security decisions in prompts; enforce rules outside the model"},{id:"LLM08:2025",name:"Vector and Embedding Weaknesses",stride:"I",look:"shared vector store across tenants, poisoned or stale documents, embedding inversion, retrieval of restricted documents",fix:"per-tenant and per-user access control on retrieval, validate sources, monitor retrieved content"},{id:"LLM09:2025",name:"Misinformation",stride:"R",look:"hallucinated facts, packages or citations acted on without checking; over-reliance in decisions",fix:"grounding with retrieval, verification steps, human review for decisions, communicate uncertainty"},{id:"LLM10:2025",name:"Unbounded Consumption",stride:"D",look:"no limits on tokens, requests, recursion or cost; model extraction through many queries",fix:"rate and spend limits, input size caps, timeouts, query monitoring, watermark or limit API detail"}],n0=[{id:"ASI01:2026",name:"Agent Goal Hijack",stride:"T",look:"content the agent reads (pages, files, tool results, other agents) redirects what it is trying to do",fix:"isolate instructions from data, verify intent before acting, constrain plans to the task"},{id:"ASI02:2026",name:"Tool Misuse and Exploitation",stride:"E",look:"permitted tools used in loops, unsafe chains or at runaway volume; tool parameters from untrusted text",fix:"least-agency tool scoping, parameter validation, budgets and loop limits, approval for risky tools"},{id:"ASI03:2026",name:"Identity and Privilege Abuse",stride:"S",look:"agent acts with a human's or a service's broad credential; delegation with no bound identity or scope",fix:"per-agent identity, short-lived scoped tokens, delegation that carries the principal and the task"},{id:"ASI04:2026",name:"Agentic Supply Chain Vulnerabilities",stride:"T",look:"imported tools, MCP servers, schemas, prompts or other agents trusted without verification",fix:"verify and pin tool and agent sources, review tool definitions, sandbox third-party tools"},{id:"ASI05:2026",name:"Unexpected Code Execution",stride:"E",look:"generated code or commands run without validation or isolation; interpreters reachable from prompts",fix:"sandboxed execution, allow-listed commands, review before run, no shell from model text"},{id:"ASI06:2026",name:"Memory and Context Poisoning",stride:"T",look:"injected or leaked memory, notes or thread context keeps steering later runs",fix:"validate what is written to memory, scope memory per user and task, expiry, review of persistent context"},{id:"ASI07:2026",name:"Insecure Inter-Agent Communication",stride:"S",look:"messages between agents can be read, forged or altered; no authentication between agents",fix:"authenticated, integrity-protected channels; schemas; treat other agents' output as untrusted"},{id:"ASI08:2026",name:"Cascading Failures",stride:"D",look:"one bad output or outage propagates through chained tools and agents; no circuit breakers",fix:"isolation boundaries, timeouts, circuit breakers, idempotent actions, rollback"},{id:"ASI09:2026",name:"Human-Agent Trust Exploitation",stride:"R",look:"confident agent output accepted without verification; approvals rubber-stamped; UI that hides what the agent did",fix:"show evidence and provenance, require review for consequential actions, measure override rates"},{id:"ASI10:2026",name:"Rogue Agents",stride:"E",look:"agents acting outside their intended behaviour or scope, surviving beyond their task, no way to stop them",fix:"kill switch, task-bound lifetimes, monitoring of actions against policy, audit trail"}],yw=[{id:"M1:2024",name:"Improper Credential Usage",look:"hardcoded keys, credentials stored or transmitted insecurely",fix:"no secrets in the app, platform keystores, short-lived tokens"},{id:"M2:2024",name:"Inadequate Supply Chain Security",look:"unverified SDKs and libraries, compromised build",fix:"vetted dependencies, signed builds, integrity checks"},{id:"M3:2024",name:"Insecure Authentication/Authorization",look:"client-side auth decisions, weak session handling, missing server checks",fix:"server-side authorisation, MFA, secure session tokens"},{id:"M4:2024",name:"Insufficient Input/Output Validation",look:"injection via deep links, intents, WebViews, file inputs",fix:"validate and encode at every boundary, restrict WebView bridges"},{id:"M5:2024",name:"Insecure Communication",look:"plaintext or weakly validated TLS, no pinning where warranted",fix:"TLS with validation, pinning for high-value apps"},{id:"M6:2024",name:"Inadequate Privacy Controls",look:"over-collection, PII in logs, leakage to third parties",fix:"data minimisation, consent, scrub logs"},{id:"M7:2024",name:"Insufficient Binary Protections",look:"easy reverse engineering and tampering of the binary",fix:"obfuscation and integrity checks where the threat model needs them; keep secrets off the device"},{id:"M8:2024",name:"Security Misconfiguration",look:"debug flags, exported components, permissive permissions",fix:"hardened release config, minimal permissions"},{id:"M9:2024",name:"Insecure Data Storage",look:"sensitive data in plain files, caches, backups, clipboard",fix:"platform secure storage, encryption, exclude from backups"},{id:"M10:2024",name:"Insufficient Cryptography",look:"weak algorithms, poor key handling, custom crypto",fix:"platform crypto APIs, modern algorithms, key management"}],vw=[{id:"V1",name:"Encoding and Sanitization",covers:"injection prevention, output encoding, sanitisation of HTML, SQL, OS, templates"},{id:"V2",name:"Validation and Business Logic",covers:"input validation, business-logic limits, anti-automation, sequence and timing"},{id:"V3",name:"Web Frontend Security",covers:"browser security headers, CSP, cookies, CORS, clickjacking"},{id:"V4",name:"API and Web Service",covers:"REST, GraphQL, WebSocket, schema validation, HTTP method handling"},{id:"V5",name:"File Handling",covers:"uploads, downloads, path traversal, file type and size limits, storage"},{id:"V6",name:"Authentication",covers:"passwords, MFA, credential recovery, lookup secrets, out-of-band, rate limits"},{id:"V7",name:"Session Management",covers:"session ids, binding, timeout, logout, re-authentication, cookie attributes"},{id:"V8",name:"Authorization",covers:"object, function and field-level authorisation, ownership, admin interfaces"},{id:"V9",name:"Self-contained Tokens",covers:"JWT and similar: signature, algorithm, audience, expiry, revocation"},{id:"V10",name:"OAuth and OIDC",covers:"flows, PKCE, redirect validation, token handling, client registration"},{id:"V11",name:"Cryptography",covers:"algorithms, key management, randomness, password hashing, crypto agility"},{id:"V12",name:"Secure Communication",covers:"TLS configuration, certificate validation, internal service encryption"},{id:"V13",name:"Configuration",covers:"secrets management, dependencies, unneeded features, secure defaults, build integrity"},{id:"V14",name:"Data Protection",covers:"classification, encryption at rest, minimisation, caching, data in logs and backups"},{id:"V15",name:"Secure Coding and Architecture",covers:"threat modelling, trust boundaries, defensive coding, memory safety, concurrency"},{id:"V16",name:"Security Logging and Error Handling",covers:"what to log, log protection, error handling that fails closed"},{id:"V17",name:"WebRTC",covers:"media and signalling security, TURN, DoS resistance"}],bw=[{id:"4.1",code:"WSTG-INFO",name:"Information Gathering",tests:"search engine and metadata leakage, fingerprint server and framework, enumerate applications and entry points, map architecture and execution paths"},{id:"4.2",code:"WSTG-CONF",name:"Configuration and Deployment Management",tests:"platform and framework configuration, file extensions and backups, admin interfaces, HTTP methods, HSTS, cloud storage, subdomain takeover, path confusion"},{id:"4.3",code:"WSTG-IDNT",name:"Identity Management",tests:"role definitions, registration and provisioning, account enumeration, username policy"},{id:"4.4",code:"WSTG-ATHN",name:"Authentication",tests:"credentials over encrypted channel, default credentials, lockout, bypass, remember-me, cache, password policy and reset, MFA"},{id:"4.5",code:"WSTG-ATHZ",name:"Authorization",tests:"directory traversal and file include, authorisation bypass, privilege escalation, IDOR, OAuth"},{id:"4.6",code:"WSTG-SESS",name:"Session Management",tests:"session schema, cookie attributes, fixation, exposed variables, CSRF, logout, timeout, puzzling, hijacking, JWT"},{id:"4.7",code:"WSTG-INPV",name:"Injection",tests:"reflected and stored XSS, HTTP verb and parameter tampering, SQL, LDAP, XML, SSI, XPath, IMAP/SMTP, code, command, format string, buffer, HTTP splitting, request smuggling, SSRF, mass assignment"},{id:"4.8",code:"WSTG-ERRH",name:"Error Handling",tests:"improper error handling, stack traces"},{id:"4.9",code:"WSTG-CRYP",name:"Weak Cryptography",tests:"TLS, padding oracle, sensitive data over unencrypted channels, weak encryption"},{id:"4.10",code:"WSTG-BUSL",name:"Business Logic",tests:"data validation, request forgery, integrity checks, process timing, function limits, workflow circumvention, defences against misuse, unexpected file types, malicious file upload, payment functionality"},{id:"4.11",code:"WSTG-CLNT",name:"Client-side",tests:"DOM XSS, JavaScript execution, HTML and CSS injection, client-side redirect, resource manipulation, CORS, cross-site flashing, clickjacking, WebSockets, web messaging, browser storage, script inclusion, reverse tabnabbing"},{id:"4.12",code:"WSTG-APIT",name:"API Testing",tests:"GraphQL (introspection, batching, injection), API reconnaissance, broken object-level authorisation"}],qf=[{id:"AML.TA0002",name:"Reconnaissance",techniques:["AML.T0000 Search Open Technical Databases","AML.T0001 Search Open AI Vulnerability Analysis","AML.T0003 Search Victim-Owned Websites","AML.T0004 Search Application Repositories","AML.T0006 Active Scanning","AML.T0064 Gather RAG-Indexed Targets","AML.T0087 Gather Victim Identity Information","AML.T0095 Search Open Websites/Domains"]},{id:"AML.TA0003",name:"Resource Development",techniques:["AML.T0002 Acquire Public AI Artifacts","AML.T0008 Acquire Infrastructure","AML.T0016 Obtain Capabilities","AML.T0017 Develop Capabilities","AML.T0019 Publish Poisoned Datasets","AML.T0020 Poison Training Data","AML.T0021 Establish Accounts","AML.T0058 Publish Poisoned Models","AML.T0060 Publish Hallucinated Entities","AML.T0065 LLM Prompt Crafting","AML.T0066 Retrieval Content Crafting","AML.T0079 Stage Capabilities","AML.T0104 Publish Poisoned AI Agent Tool"]},{id:"AML.TA0004",name:"Initial Access",techniques:["AML.T0010 AI Supply Chain Compromise (hardware, AI software, data, model, container registry, AI agent tool)","AML.T0012 Valid Accounts","AML.T0015 Evade AI Model","AML.T0049 Exploit Public-Facing Application","AML.T0052 Phishing (LLM-written spearphishing, deepfake-assisted)","AML.T0078 Drive-by Compromise","AML.T0093 Prompt Infiltration via Public-Facing Application"]},{id:"AML.TA0000",name:"AI Model Access",techniques:["AML.T0040 AI Model Inference API Access","AML.T0041 Physical Environment Access","AML.T0044 Full AI Model Access","AML.T0047 AI-Enabled Product or Service"]},{id:"AML.TA0005",name:"Execution",techniques:["AML.T0011 User Execution (unsafe AI artifacts, malicious package, poisoned AI agent tool, malicious link)","AML.T0050 Command and Scripting Interpreter","AML.T0051 LLM Prompt Injection (AML.T0051.000 direct, AML.T0051.001 indirect, AML.T0051.002 triggered)","AML.T0053 AI Agent Tool Invocation","AML.T0100 AI Agent Clickbait","AML.T0103 Deploy AI Agent"]},{id:"AML.TA0006",name:"Persistence",techniques:["AML.T0018 Manipulate AI Model (poison, modify architecture, embed malware)","AML.T0020 Poison Training Data","AML.T0061 LLM Prompt Self-Replication","AML.T0070 RAG Poisoning","AML.T0080 AI Agent Context Poisoning (memory, thread)","AML.T0081 Modify AI Agent Configuration","AML.T0093 Prompt Infiltration via Public-Facing Application","AML.T0099 AI Agent Tool Data Poisoning","AML.T0110 AI Agent Tool Poisoning"]},{id:"AML.TA0012",name:"Privilege Escalation",techniques:["AML.T0012 Valid Accounts","AML.T0053 AI Agent Tool Invocation","AML.T0054 LLM Jailbreak","AML.T0105 Escape to Host"]},{id:"AML.TA0007",name:"Defense Evasion",techniques:["AML.T0015 Evade AI Model","AML.T0054 LLM Jailbreak","AML.T0067 LLM Trusted Output Components Manipulation (citations)","AML.T0068 LLM Prompt Obfuscation","AML.T0071 False RAG Entry Injection","AML.T0073 Impersonation","AML.T0074 Masquerading","AML.T0076 Corrupt AI Model","AML.T0081 Modify AI Agent Configuration","AML.T0092 Manipulate User LLM Chat History","AML.T0094 Delay Execution of LLM Instructions","AML.T0097 Virtualization/Sandbox Evasion","AML.T0107 Exploitation for Defense Evasion","AML.T0109 AI Supply Chain Rug Pull","AML.T0111 AI Supply Chain Reputation Inflation"]},{id:"AML.TA0013",name:"Credential Access",techniques:["AML.T0055 Unsecured Credentials","AML.T0082 RAG Credential Harvesting","AML.T0083 Credentials from AI Agent Configuration","AML.T0090 OS Credential Dumping","AML.T0098 AI Agent Tool Credential Harvesting","AML.T0106 Exploitation for Credential Access"]},{id:"AML.TA0008",name:"Discovery",techniques:["AML.T0007 Discover AI Artifacts","AML.T0013 Discover AI Model Ontology","AML.T0014 Discover AI Model Family","AML.T0062 Discover LLM Hallucinations","AML.T0063 Discover AI Model Outputs","AML.T0069 Discover LLM System Information (special character sets, system instruction keywords, system prompt)","AML.T0075 Cloud Service Discovery","AML.T0084 Discover AI Agent Configuration (embedded knowledge, tool definitions, activation triggers, call chains)","AML.T0089 Process Discovery"]},{id:"AML.TA0015",name:"Lateral Movement",techniques:["AML.T0052 Phishing (from a compromised assistant)","AML.T0091 Use Alternate Authentication Material (application access token)"]},{id:"AML.TA0009",name:"Collection",techniques:["AML.T0035 AI Artifact Collection","AML.T0036 Data from Information Repositories","AML.T0037 Data from Local System","AML.T0085 Data from AI Services (RAG databases, AI agent tools)"]},{id:"AML.TA0001",name:"AI Attack Staging",techniques:["AML.T0005 Create Proxy AI Model","AML.T0018 Manipulate AI Model","AML.T0042 Verify Attack","AML.T0043 Craft Adversarial Data (white-box, black-box, transfer, manual, backdoor trigger)","AML.T0088 Generate Deepfakes","AML.T0102 Generate Malicious Commands"]},{id:"AML.TA0014",name:"Command and Control",techniques:["AML.T0072 Reverse Shell","AML.T0096 AI Service API","AML.T0108 AI Agent"]},{id:"AML.TA0010",name:"Exfiltration",techniques:["AML.T0024 Exfiltration via AI Inference API (membership inference, model inversion, model extraction)","AML.T0025 Exfiltration via Cyber Means","AML.T0056 Extract LLM System Prompt","AML.T0057 LLM Data Leakage","AML.T0077 LLM Response Rendering (markdown images, links that carry data)","AML.T0086 Exfiltration via AI Agent Tool Invocation"]},{id:"AML.TA0011",name:"Impact",techniques:["AML.T0015 Evade AI Model","AML.T0029 Denial of AI Service","AML.T0031 Erode AI Model Integrity","AML.T0034 Cost Harvesting (excessive queries, resource-intensive queries, agentic resource consumption)","AML.T0046 Spamming AI System with Chaff Data","AML.T0048 External Harms (financial, reputational, societal, user, AI IP theft)","AML.T0059 Erode Dataset Integrity","AML.T0101 Data Destruction via AI Agent Tool Invocation","AML.T0112 Machine Compromise (local AI agent, AI artifacts)"]}],xw=[{id:"AML.M0000",name:"Limit Public Release of Information"},{id:"AML.M0001",name:"Limit Model Artifact Release"},{id:"AML.M0002",name:"Passive AI Output Obfuscation"},{id:"AML.M0003",name:"Model Hardening"},{id:"AML.M0004",name:"Restrict Number of AI Model Queries"},{id:"AML.M0005",name:"Control Access to AI Models and Data at Rest"},{id:"AML.M0006",name:"Use Ensemble Methods"},{id:"AML.M0007",name:"Sanitize Training Data"},{id:"AML.M0008",name:"Validate AI Model"},{id:"AML.M0009",name:"Use Multi-Modal Sensors"},{id:"AML.M0010",name:"Input Restoration"},{id:"AML.M0011",name:"Restrict Library Loading"},{id:"AML.M0012",name:"Encrypt Sensitive Information"},{id:"AML.M0013",name:"Code Signing"},{id:"AML.M0014",name:"Verify AI Artifacts"},{id:"AML.M0015",name:"Adversarial Input Detection"},{id:"AML.M0016",name:"Vulnerability Scanning"},{id:"AML.M0017",name:"AI Model Distribution Methods"},{id:"AML.M0018",name:"User Training"},{id:"AML.M0019",name:"Control Access to AI Models and Data in Production"},{id:"AML.M0020",name:"Generative AI Guardrails"},{id:"AML.M0021",name:"Generative AI Guidelines"},{id:"AML.M0022",name:"Generative AI Model Alignment"},{id:"AML.M0023",name:"AI Bill of Materials"},{id:"AML.M0024",name:"AI Telemetry Logging"},{id:"AML.M0025",name:"Maintain AI Dataset Provenance"},{id:"AML.M0026",name:"Privileged AI Agent Permissions Configuration"},{id:"AML.M0027",name:"Single-User AI Agent Permissions Configuration"},{id:"AML.M0028",name:"AI Agent Tools Permissions Configuration"},{id:"AML.M0029",name:"Human In-the-Loop for AI Agent Actions"},{id:"AML.M0030",name:"Restrict AI Agent Tool Invocation on Untrusted Data"},{id:"AML.M0031",name:"Memory Hardening"},{id:"AML.M0032",name:"Segmentation of AI Agent Components"},{id:"AML.M0033",name:"Input and Output Validation for AI Agent Components"},{id:"AML.M0034",name:"Deepfake Detection"}],Sw=[{letter:"S",name:"Spoofing",violates:"authentication",asks:"can someone pretend to be this user, service or device?"},{letter:"T",name:"Tampering",violates:"integrity",asks:"can data, code, config or a message be changed without detection?"},{letter:"R",name:"Repudiation",violates:"non-repudiation",asks:"can an action be denied later because nothing trustworthy recorded it?"},{letter:"I",name:"Information disclosure",violates:"confidentiality",asks:"can data be read by someone who should not?"},{letter:"D",name:"Denial of service",violates:"availability",asks:"can it be exhausted, crashed or locked?"},{letter:"E",name:"Elevation of privilege",violates:"authorisation",asks:"can a lower-privileged party do a higher-privileged thing?"}],ww={actor:"SR",external:"SRD",service:"STRIDE",ai:"STRIDE",datastore:"TRID",flow:"TID"},Io=(l,o,c=!0)=>`${l}
53
+ docker compose exec runner rm /data/vault.json`}),s.jsx("p",{className:"hint",style:{margin:0},children:"Nothing on the network can do this, which is what keeps the lock meaningful."}),s.jsx("button",{type:"button",className:"link-btn",onClick:()=>{c("passkey"),z(null)},children:"back"})]}),Z&&s.jsx("div",{className:"form-status success",children:Z}),V&&s.jsx("div",{className:"form-status error",children:V})]})]})})}function ks({title:l,onClose:o,children:c}){return A.useEffect(()=>{if(!o)return;const u=d=>d.key==="Escape"&&o();return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[o]),s.jsx("div",{className:"overlay vault-dialog",onClick:o,children:s.jsxs("div",{className:"modal",role:"dialog","aria-label":l,onClick:u=>u.stopPropagation(),children:[s.jsxs("div",{className:"modal-head",children:[s.jsxs("span",{className:"modal-title",children:[s.jsx("span",{className:"dot y","aria-hidden":!0}),l]}),o&&s.jsx("button",{className:"icon-btn close-x",onClick:o,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),s.jsx("div",{className:"modal-body",children:c})]})})}const Do=10,Oc=()=>`BugXHunter vault (${location.hostname})`,kf="__custom__",pi=[{name:"SCX_API",short:"SCX.ai — the default provider",label:"SCX.ai model key — the default provider"},{name:"NVIDIA_API_KEY",short:"NVIDIA NIM — build.nvidia.com models",label:"NVIDIA NIM key — build.nvidia.com models incl. Nemotron, DeepSeek, GLM-5.3 (optional)"},{name:"ANTHROPIC_API_KEY",short:"Anthropic — Claude models",label:"Anthropic key — Claude Opus, Sonnet and Haiku (optional)"},{name:"OPENROUTER_API_KEY",short:"OpenRouter — one key, its whole catalogue",label:"OpenRouter key — unlocks its model catalogue (optional)"},{name:"AWS_BEARER_TOKEN_BEDROCK",short:"Amazon Bedrock — API key",label:"Amazon Bedrock API key — GLM 5.3 on Bedrock (optional; not needed when the runner has an AWS role or profile)"}],Lw={SCX_API:"sk-scx-…",NVIDIA_API_KEY:"nvapi-…",ANTHROPIC_API_KEY:"sk-ant-…",OPENROUTER_API_KEY:"sk-or-…",AWS_BEARER_TOKEN_BEDROCK:"Bedrock API key"};function zw(){const[l,o]=A.useState(null),[c,u]=A.useState(null),[d,h]=A.useState(Date.now()),m=A.useCallback(()=>fw().then(o).catch(()=>{}),[]);A.useEffect(()=>{m();const g=setInterval(()=>{m(),h(Date.now())},3e4);return()=>clearInterval(g)},[m]);const y=()=>{u(null),m()},v=A.useCallback(()=>{dh(),mw().then(o).catch(()=>{})},[]);if(A.useEffect(()=>{const g=b=>{(b.ctrlKey||b.metaKey)&&b.shiftKey&&b.key.toLowerCase()==="l"&&(b.preventDefault(),v())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[v]),!l)return null;const S=l.initialised?l.unsealed?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"vault-state open",title:l.idleMinutes?`Auto-locks after ${l.idleMinutes} min without activity`:"Auto-lock off",children:["vault open",l.sealsAt?` · locks in ${Iw(l.sealsAt-d)}`:""]}),s.jsx("button",{className:"icon-btn vault-btn",onClick:()=>u("manage"),title:"Keys in the vault","aria-label":"Keys in the vault",children:s.jsx(Hw,{})}),s.jsx("button",{className:"icon-btn vault-btn",onClick:v,title:"Lock the vault (Ctrl+Shift+L)","aria-label":"Lock the vault (Ctrl+Shift+L)",children:s.jsx(Bw,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"vault-state sealed",children:"vault locked"}),s.jsx("button",{className:"icon-btn vault-btn primary",onClick:()=>u("unlock"),title:"Unlock the vault","aria-label":"Unlock the vault",children:s.jsx(Uw,{})})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"vault-state none",title:l.keySource==="none"?"No model key yet":l.keySource==="file"?"Model key comes from a key file":`Model key comes from ${l.keySource==="env"?".env":"OpenCode's auth.json"}, in the clear`,children:l.keySource==="none"?"no vault, no model key":"vault not set up"}),s.jsx("button",{className:"btn primary sm",onClick:()=>u("setup"),children:"set_up"})]});return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"vault-row",children:S}),c==="setup"&&s.jsx(qw,{onClose:y}),c==="unlock"&&s.jsx($w,{status:l,onClose:y}),c==="manage"&&s.jsx(Gw,{status:l,onChange:o,onClose:y})]})}const Uw=()=>s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("circle",{cx:"12",cy:"16",r:"1"}),s.jsx("rect",{width:"18",height:"12",x:"3",y:"10",rx:"2"}),s.jsx("path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5"})]}),Hw=()=>s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z"}),s.jsx("path",{d:"m14 7 3 3"}),s.jsx("path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814"})]}),Bw=()=>s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[s.jsx("path",{d:"M12 13v3"}),s.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 01-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 011-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 011.52 0C14.51 3.81 17 5 19 5a1 1 0 011 1z"}),s.jsx("circle",{cx:"12",cy:"11",r:"2"})]});function Iw(l){const o=Math.max(0,Math.round(l/6e4));return o>=60?`${Math.floor(o/60)}h ${String(o%60).padStart(2,"0")}m`:`${o}m`}const jf=["passkey","key","backups"];function qw({onClose:l}){const[o,c]=A.useState("passkey"),[u,d]=A.useState(null),[h,m]=A.useState("SCX_API"),[y,v]=A.useState(""),[S,g]=A.useState(""),[b,x]=A.useState(""),[k,L]=A.useState(null),[V,z]=A.useState(!1),[Z,oe]=A.useState(!1),[de,C]=A.useState(!1),[Y,O]=A.useState(null);async function X(){C(!0),O(null);try{d(await Fv(Oc(),ah)),c("key")}catch(Q){O(Q.message)}finally{C(!1)}}async function F(){if(u){C(!0),O(null);try{L(await Ew({...u,label:Oc(),items:y.trim()?{[h]:y.trim()}:{}})),c("backups")}catch(Q){O(Q.message)}finally{C(!1)}}}async function ie(){if(k){C(!0),O(null);try{let Q=k.doc;S&&(Q={...Q,methods:[...Q.methods,await oh(pn.dec(k.dek),S)]}),await hw(Q,k.dek),Rc(k.dek),l()}catch(Q){O(Q.message),C(!1)}}}const G=!S||S.length>=Do&&S===b;return s.jsxs(ks,{title:"vault --init",onClose:o==="backups"?void 0:l,children:[s.jsx("div",{className:"steps",children:jf.map(Q=>s.jsx("span",{className:Q===o?"on":jf.indexOf(Q)<jf.indexOf(o)?"done":"",children:Q},Q))}),o==="passkey"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Your model keys will be sealed at rest, and this passkey will unlock them and sign you in — one touch. The authenticator (Windows Hello, Touch ID, Android, or a security key) derives a secret that never leaves it. Works in Chrome, Edge and Safari 18+; Firefox can't do this yet."}),!wi()&&s.jsx("div",{className:"form-status error",children:"This browser has no passkey support."}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",disabled:de||!wi(),onClick:X,children:de?"waiting for the authenticator…":"create passkey →"})})]}),o==="key"&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Passkey enrolled. Add a model key now, or later from the keys dialog (where you can add the other provider too). It goes straight into the sealed vault; ",s.jsx("code",{className:"mono",children:".env"})," can then drop the key."]}),s.jsx("label",{htmlFor:"v-provider",children:"Provider"}),s.jsx("select",{id:"v-provider",className:"mono",value:h,onChange:Q=>m(Q.target.value),children:pi.map(Q=>s.jsx("option",{value:Q.name,children:Q.short},Q.name))}),s.jsxs("label",{htmlFor:"v-key",children:[h," (optional)"]}),s.jsx("input",{id:"v-key",type:"password",autoFocus:!0,autoComplete:"off",placeholder:Lw[h]??"",value:y,onChange:Q=>v(Q.target.value)}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",disabled:de,onClick:F,children:de?"sealing…":"next →"})})]}),o==="backups"&&k&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Backups, for when the passkey isn't at hand. This recovery code is shown ",s.jsx("b",{children:"once"})," and stored nowhere — keep it offline, like a password-manager note or paper."]}),s.jsxs("button",{type:"button",className:"recovery-code"+(Z?" copied":""),"aria-label":"Recovery code — click to copy",title:"Click to copy",onClick:()=>{var Q;(Q=navigator.clipboard)==null||Q.writeText(k.recoveryCode).then(()=>{oe(!0),setTimeout(()=>oe(!1),2e3)}).catch(()=>{})},children:[s.jsx("span",{className:"code",children:k.recoveryCode}),s.jsx("span",{className:"copy-hint",children:Z?"✓ copied":"click to copy"})]}),s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:V,onChange:Q=>z(Q.target.checked)})," I have stored this code somewhere safe."]}),s.jsxs("label",{htmlFor:"v-pass",children:["Backup passphrase (optional, at least ",Do," characters)"]}),s.jsx("input",{id:"v-pass",type:"password",autoComplete:"new-password",value:S,onChange:Q=>g(Q.target.value)}),S&&s.jsxs(s.Fragment,{children:[s.jsx("label",{htmlFor:"v-pass2",children:"Again"}),s.jsx("input",{id:"v-pass2",type:"password",autoComplete:"new-password",value:b,onChange:Q=>x(Q.target.value)}),b&&S!==b&&s.jsx("div",{className:"form-status error",children:"The passphrases differ."})]}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",disabled:!V||!G||de,onClick:ie,children:de?"creating…":"create vault →"})})]}),Y&&s.jsx("div",{className:"form-status error",children:Y})]})}function $w({status:l,onClose:o}){const[c,u]=A.useState("passkey"),[d,h]=A.useState(""),[m,y]=A.useState(""),[v,S]=A.useState(!1),[g,b]=A.useState(null),x=l.methods.find(C=>C.type==="passkey"),k=l.methods.find(C=>C.type==="password"),L=l.methods.find(C=>C.type==="recovery"),V=!!(x!=null&&x.passphrase);async function z(C,Y){S(!0),b(null);try{let O;try{O=await C()}catch(X){throw X instanceof Error&&/Passkey|authenticator|pending|origin/i.test(X.message)?X:new Error(Y)}await qv(O),Rc(O),o()}catch(O){b(O.message),S(!1)}}const Z=()=>x&&z(async()=>{const C=await Mw(x.credentialId,x.transports,x.prfSalt);return Vv(x,C,V?d:void 0)},V?"Wrong passphrase, or a different passkey than the one enrolled.":"A different passkey than the one enrolled."),oe=()=>k&&z(()=>Qv(k,d),"Wrong backup passphrase."),de=()=>L&&z(()=>Kv(L,m),"That recovery code doesn't open the vault.");return s.jsxs(ks,{title:"vault --unlock",onClose:o,children:[c==="passkey"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:V?"This passkey was enrolled with a passphrase: enter it, then confirm with the passkey.":"One touch: confirm with your passkey."}),V&&s.jsxs(s.Fragment,{children:[s.jsx("label",{htmlFor:"v-unlock-pass",children:"Passphrase"}),s.jsx("input",{id:"v-unlock-pass",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&d&&Z()}})]}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",autoFocus:!V,disabled:v||!x||V&&!d,onClick:Z,children:v?"waiting for the authenticator…":"unlock with passkey →"})}),s.jsxs("div",{className:"login-links",children:[k&&s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"}),L&&s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="password"&&s.jsxs(s.Fragment,{children:[s.jsx("label",{htmlFor:"v-unlock-pw",children:"Backup passphrase"}),s.jsx("input",{id:"v-unlock-pw",type:"password",autoFocus:!0,autoComplete:"current-password",value:d,onChange:C=>h(C.target.value),onKeyDown:C=>{C.key==="Enter"&&d&&oe()}}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",disabled:v||!d,onClick:oe,children:v?"unlocking…":"unlock →"})}),s.jsxs("div",{className:"login-links",children:[s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),L&&s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("recovery"),b(null)},children:"use the recovery code"})]})]}),c==="recovery"&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Enter the recovery code shown when the vault was created."}),s.jsx("label",{htmlFor:"v-code",children:"Recovery code"}),s.jsx("input",{id:"v-code",type:"text",className:"mono",autoFocus:!0,autoComplete:"off",spellCheck:!1,placeholder:"XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-X",value:m,onChange:C=>y(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Bf(m)&&de()}}),s.jsx("div",{className:"perm-actions center",children:s.jsx("button",{className:"btn primary wide",disabled:v||!Bf(m),onClick:de,children:v?"unlocking…":"unlock →"})}),s.jsxs("div",{className:"login-links",children:[s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("passkey"),b(null)},children:"use the passkey instead"}),k&&s.jsx("button",{className:"link-btn",disabled:v,onClick:()=>{u("password"),b(null)},children:"use the backup passphrase"})]})]}),g&&s.jsx("div",{className:"form-status error",children:g})]})}function Gw({status:l,onChange:o,onClose:c}){const[u,d]=A.useState("SCX_API"),[h,m]=A.useState(""),[y,v]=A.useState(""),[S,g]=A.useState(!1),[b,x]=A.useState(""),[k,L]=A.useState(!1),[V,z]=A.useState(null),Z=_w(),oe=l.methods.filter(K=>K.type==="passkey"),de=l.methods.find(K=>K.type==="password");async function C(K){L(!0),z(null);try{const me=await K();me&&o(me)}catch(me){z(me.message)}finally{L(!1)}}const Y=()=>{if(!Z)throw new Error("Unlock the vault in this tab first (the change must wrap the current key).");return pn.dec(Z)},O=()=>C(async()=>{const K=await pw(u.trim().toUpperCase(),h);return m(""),K}),X=K=>C(()=>gw(K)),F=K=>C(()=>yw(K)),ie=()=>C(async()=>{const K=Y(),me=await Yv(K,await Fv(Oc(),ah),Oc());return Gy(me,Z)}),G=()=>C(async()=>{const K=Y(),me=await Gy(await oh(K,y),Z);return g(!1),v(""),me}),Q=()=>C(async()=>{Y();const K=await vw(Z);return dh(),c(),K});return s.jsxs(ks,{title:"vault --keys",onClose:c,children:[s.jsx("p",{children:"Secrets sealed in the vault. Values are never shown again; replace one by saving it under the same name."}),s.jsxs("div",{className:"vault-items",children:[pi.map(K=>{const me=l.items.includes(K.name);return s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:me?"ok":"missing","aria-hidden":!0,children:me?"✓":"○"}),s.jsxs("span",{className:"name",children:[K.name,s.jsxs("span",{className:"desc",children:[" — ",K.label]})]}),me?s.jsx("button",{className:"btn danger",disabled:k,onClick:()=>X(K.name),title:"Remove",children:"✕"}):s.jsx("button",{className:"btn sm",disabled:k,onClick:()=>{d(K.name),setTimeout(()=>{var ve;return(ve=document.getElementById("v-value"))==null?void 0:ve.focus()},0)},children:"add"})]},K.name)}),l.items.filter(K=>!pi.some(me=>me.name===K)).map(K=>s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),s.jsx("span",{className:"name",children:K}),s.jsx("button",{className:"btn danger",disabled:k,onClick:()=>X(K),title:"Remove",children:"✕"})]},K))]}),s.jsx("label",{htmlFor:"v-name",children:"Key"}),s.jsxs("select",{id:"v-name",className:"mono",value:pi.some(K=>K.name===u)?u:kf,onChange:K=>d(K.target.value===kf?"":K.target.value),children:[pi.map(K=>s.jsxs("option",{value:K.name,children:[K.name,l.items.includes(K.name)?" (replace)":""]},K.name)),s.jsx("option",{value:kf,children:"custom…"})]}),!pi.some(K=>K.name===u)&&s.jsx("input",{type:"text",className:"mono",placeholder:"NAME_IN_UPPER_SNAKE_CASE","aria-label":"Custom key name",value:u,onChange:K=>d(K.target.value),spellCheck:!1,autoFocus:!0}),s.jsx("label",{htmlFor:"v-value",children:"Value"}),s.jsx("input",{id:"v-value",type:"password",autoComplete:"off",value:h,onChange:K=>m(K.target.value),onKeyDown:K=>{K.key==="Enter"&&h&&O()}}),s.jsxs("div",{className:"perm-actions",children:[s.jsx("button",{className:"btn primary sm",disabled:k||!h||!u.trim(),onClick:O,children:k?"sealing…":"save"}),s.jsx("span",{className:"hint",style:{margin:0},children:l.idleMinutes?`Auto-locks after ${l.idleMinutes} min idle.`:"Auto-lock is off."})]}),s.jsx("div",{className:"section-title",children:"passkeys"}),s.jsx("p",{children:"Each passkey unlocks the vault and signs you in with one touch. Keep two, on different devices, so losing one is not an emergency."}),s.jsx("div",{className:"vault-items",children:oe.map(K=>s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:K.canLogin?"ok":"warn","aria-hidden":!0,children:K.canLogin?"✓":"!"}),s.jsxs("span",{className:"name",children:[K.label,K.passphrase?" — needs its passphrase (older enrolment)":"",K.canLogin?"":" — unlock only, can't sign in; add a new passkey"]}),s.jsx("button",{className:"btn danger",disabled:k||oe.length<=1,onClick:()=>F(K.id),title:oe.length<=1?"Add another passkey first":"Remove",children:"✕"})]},K.id))}),s.jsx("div",{className:"perm-actions",children:s.jsx("button",{className:"btn sm",disabled:k||!Z,onClick:ie,title:Z?"":"Unlock the vault in this tab first",children:k?"waiting for the authenticator…":"+ add passkey"})}),s.jsx("div",{className:"section-title",children:"backups"}),s.jsx("p",{children:"The recovery code from setup always works. A backup passphrase is optional: a way in on a device without the passkey."}),s.jsxs("div",{className:"vault-items",children:[s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),s.jsx("span",{className:"name",children:"Recovery code"})]}),de&&s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),s.jsx("span",{className:"name",children:"Backup passphrase"}),s.jsx("button",{className:"btn danger",disabled:k,onClick:()=>F(de.id),title:"Remove",children:"✕"})]})]}),S?s.jsxs(s.Fragment,{children:[s.jsxs("label",{htmlFor:"v-newpass",children:[de?"New backup passphrase":"Backup passphrase"," (at least ",Do," characters)"]}),s.jsx("input",{id:"v-newpass",type:"password",autoFocus:!0,autoComplete:"new-password",value:y,onChange:K=>v(K.target.value),onKeyDown:K=>{K.key==="Enter"&&y.length>=Do&&G()}}),s.jsxs("div",{className:"perm-actions",children:[s.jsx("button",{className:"btn primary sm",disabled:k||y.length<Do,onClick:G,children:k?"sealing…":"save"}),s.jsx("button",{className:"btn sm",disabled:k,onClick:()=>g(!1),children:"cancel"})]})]}):s.jsx("div",{className:"perm-actions",children:s.jsx("button",{className:"btn sm",disabled:k||!Z,onClick:()=>g(!0),title:Z?"":"Unlock the vault in this tab first",children:de?"replace backup passphrase":"+ set a backup passphrase"})}),s.jsx("div",{className:"section-title",children:"danger zone"}),s.jsxs("p",{children:["Delete the vault to start over with new factors. Its secrets are gone; the app reopens without sign-in until a new vault exists. Lost every factor instead? Run ",s.jsx("code",{className:"mono",children:"npm run vault:reset"})," on the server."]}),s.jsxs("div",{className:"perm-actions",children:[s.jsx("input",{type:"text",className:"mono",placeholder:"type DELETE",value:b,onChange:K=>x(K.target.value),style:{width:160}}),s.jsx("button",{className:"btn danger-outline sm",disabled:k||b!=="DELETE"||!Z,onClick:Q,children:"delete vault"})]}),V&&s.jsx("div",{className:"form-status error",children:V})]})}function Yt({size:l=14,children:o,className:c}){return s.jsx("svg",{className:c,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:o})}const fh=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),s.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),s.jsx("path",{d:"M10 9H8"}),s.jsx("path",{d:"M16 13H8"}),s.jsx("path",{d:"M16 17H8"})]}),Xw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34"}),s.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}),s.jsx("path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z"})]}),Yw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M12 19h8"}),s.jsx("path",{d:"m4 17 6-6-6-6"})]}),Xy=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"m21 21-4.34-4.34"}),s.jsx("circle",{cx:"11",cy:"11",r:"8"})]}),Vw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1"}),s.jsx("path",{d:"m21 21-1.9-1.9"}),s.jsx("circle",{cx:"17",cy:"17",r:"3"})]}),Qw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M3 5h.01"}),s.jsx("path",{d:"M3 12h.01"}),s.jsx("path",{d:"M3 19h.01"}),s.jsx("path",{d:"M8 5h13"}),s.jsx("path",{d:"M8 12h13"}),s.jsx("path",{d:"M8 19h13"})]}),Kw=l=>s.jsxs(Yt,{...l,children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),s.jsx("path",{d:"M2 12h20"})]}),Zw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M13 5h8"}),s.jsx("path",{d:"M13 12h8"}),s.jsx("path",{d:"M13 19h8"}),s.jsx("path",{d:"m3 17 2 2 4-4"}),s.jsx("path",{d:"m3 7 2 2 4-4"})]}),Pw=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719"}),s.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),s.jsx("path",{d:"M12 17h.01"})]}),Fw=l=>s.jsx(Yt,{...l,children:s.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"})}),Jw=l=>s.jsxs(Yt,{...l,children:[s.jsx("line",{x1:"6",x2:"6",y1:"3",y2:"15"}),s.jsx("circle",{cx:"18",cy:"6",r:"3"}),s.jsx("circle",{cx:"6",cy:"18",r:"3"}),s.jsx("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),Jv=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),s.jsx("path",{d:"M9 18c-4.51 2-5-2-7-2"})]}),Ww=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V3a1 1 0 0 1 1-1h2.172a2 2 0 0 1 1.414.586l.828.828A2 2 0 0 0 13.828 4H20Z"}),s.jsx("path",{d:"M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1"})]}),hh=l=>s.jsx(Yt,{...l,children:s.jsx("path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"})}),e1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}),s.jsx("path",{d:"M14 2v5a1 1 0 0 0 1 1h5"})]}),t1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M12 3v12"}),s.jsx("path",{d:"m17 8-5-5-5 5"}),s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"})]}),n1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M12 15V3"}),s.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),s.jsx("path",{d:"m7 10 5 5 5-5"})]}),a1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M10 11v6"}),s.jsx("path",{d:"M14 11v6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}),s.jsx("path",{d:"M3 6h18"}),s.jsx("path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),l1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M5 12h14"}),s.jsx("path",{d:"M12 5v14"})]}),s1=l=>s.jsxs(Yt,{...l,children:[s.jsx("path",{d:"M14 9 9 4 4 9"}),s.jsx("path",{d:"M20 20h-7a4 4 0 0 1-4-4V4"})]}),Vc=l=>s.jsx(Yt,{...l,children:s.jsx("path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"})});function i1({tool:l,size:o=14}){switch(l){case"read":return s.jsx(fh,{size:o});case"write":case"edit":case"patch":case"apply_patch":return s.jsx(Xw,{size:o});case"bash":return s.jsx(Yw,{size:o});case"grep":return s.jsx(Xy,{size:o});case"glob":case"list":return s.jsx(Vw,{size:o});case"webfetch":return s.jsx(Kw,{size:o});case"websearch":return s.jsx(Xy,{size:o});case"todowrite":case"todoread":return s.jsx(Zw,{size:o});case"task":return s.jsx(Qw,{size:o});case"question":return s.jsx(Pw,{size:o});default:return s.jsx(Fw,{size:o})}}async function js(l,o){var u,d;const c=await fetch(l,{headers:{"Content-Type":"application/json"},...o});if(!c.ok){let h=`${c.status}`;try{h=((d=(u=await c.json())==null?void 0:u.error)==null?void 0:d.message)??h}catch{}throw new Error(h)}return c.json()}const o1=()=>js("/api/github"),r1=()=>js("/api/github/repos").then(l=>l.repos),c1=l=>js(`/api/github/branches?repo=${encodeURIComponent(l)}`).then(o=>o.branches),u1=l=>js("/api/github/clone",{method:"POST",body:JSON.stringify(l)}),d1=()=>js("/api/github/connect/start",{method:"POST"}),f1=l=>js("/api/github/connect/poll",{method:"POST",body:JSON.stringify({id:l})}),h1=()=>js("/api/github/connect",{method:"DELETE"});function Dc(l){if(!l)return"";const o=Math.max(0,(Date.now()-new Date(l).getTime())/1e3);return o<3600?`${Math.max(1,Math.round(o/60))} min ago`:o<86400?`${Math.round(o/3600)} h ago`:o<86400*30?`${Math.round(o/86400)} d ago`:o<86400*365?`${Math.round(o/(86400*30))} mo ago`:`${Math.round(o/(86400*365))} y ago`}function m1({onOpen:l,onClose:o}){const[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState(""),[g,b]=A.useState(null),[x,k]=A.useState(null),[L,V]=A.useState(""),[z,Z]=A.useState(null),[oe,de]=A.useState(null),[C,Y]=A.useState(null),[O,X]=A.useState(!1),F=A.useCallback(()=>o1().then(ee=>{u(ee),h(null)}).catch(ee=>h(ee.message)),[]);A.useEffect(()=>{F()},[F]);const ie=!!(c!=null&&c.connected&&!c.sealed&&!c.error),G=A.useCallback(()=>{Z("repos"),r1().then(y).catch(ee=>de(ee.message)).finally(()=>Z(ee=>ee==="repos"?null:ee))},[]);A.useEffect(()=>{ie&&G()},[ie,G]),A.useEffect(()=>{if(!ie)return;const ee=()=>G();return window.addEventListener("focus",ee),()=>window.removeEventListener("focus",ee)},[ie,G]);const Q=A.useRef(null),K=()=>{Q.current&&(window.clearTimeout(Q.current),Q.current=null)};A.useEffect(()=>K,[]);async function me(){Z("connect"),de(null);try{const ee=await d1();Y(ee);try{await navigator.clipboard.writeText(ee.userCode),X(!0)}catch{X(!1)}const ke=async()=>{try{const Ze=await f1(ee.id);if(Ze.status==="pending"){Q.current=window.setTimeout(ke,ee.interval*1e3);return}if(Y(null),Z(null),Ze.status==="connected"){await F();return}de(Ze.status==="denied"?"The sign-in was cancelled on GitHub.":"The code expired. Start again.")}catch(Ze){Y(null),Z(null),de(Ze.message)}};Q.current=window.setTimeout(ke,ee.interval*1e3)}catch(ee){Z(null),de(ee.message)}}function ve(){K(),Y(null),Z(null)}async function Ce(){de(null);try{await h1(),y(null),b(null),await F()}catch(ee){de(ee.message)}}function ne(ee){b(ee),V(ee.defaultBranch),k(null),de(null),Z("branches"),c1(ee.fullName).then(ke=>{k(ke),!ke.some(Ze=>Ze.name===ee.defaultBranch)&&ke[0]&&V(ke[0].name)}).catch(ke=>de(ke.message)).finally(()=>Z(ke=>ke==="branches"?null:ke))}async function te(){if(g){Z("clone"),de(null);try{const ee=await u1({repo:g.fullName,branch:L});l(ee.directory),o()}catch(ee){de(ee.message)}finally{Z(null)}}}const ce=A.useMemo(()=>{const ee=v.trim().toLowerCase();return(m??[]).filter(ke=>!ee||ke.fullName.toLowerCase().includes(ee)||(ke.description??"").toLowerCase().includes(ee))},[m,v]);return s.jsxs(ks,{title:"github --clone",onClose:o,children:[d&&s.jsx("div",{className:"hint danger",children:d}),c&&!c.connected&&!C&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Clone a repository into the workspace so the agent can review it. ",s.jsx("b",{children:"Read-only"}),": the app can only read code, it reaches only the repositories you install it on, and nothing in the sandbox can push."]}),s.jsx("div",{className:"perm-actions center",children:s.jsxs("button",{className:"btn primary wide",disabled:z!==null,onClick:me,children:[s.jsx(Jv,{size:15})," ",z==="connect"?"contacting GitHub…":"Connect GitHub"]})}),c.storage==="memory"&&s.jsx("div",{className:"hint",style:{textAlign:"center"},children:"No vault yet, so the sign-in is kept until the runner restarts. Set up the vault to keep it."})]}),C&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:["Enter this code on GitHub to connect. ",O?"It is on your clipboard.":"Click it to copy."]}),s.jsx("button",{className:"recovery-code gh-code",onClick:()=>navigator.clipboard.writeText(C.userCode).then(()=>X(!0)).catch(()=>{}),title:"Copy",children:C.userCode}),s.jsx("div",{className:"perm-actions center",children:s.jsx("a",{className:"btn primary wide",href:C.verificationUri,target:"_blank",rel:"noreferrer",children:"Open github.com/login/device ↗"})}),s.jsxs("div",{className:"hint",style:{textAlign:"center"},children:["Waiting for your approval… this finishes by itself. ",s.jsx("button",{className:"link-btn",onClick:ve,children:"cancel"})]})]}),(c==null?void 0:c.sealed)&&s.jsx("p",{children:"Your GitHub sign-in is in the vault, which is locked. Unlock it (the lock icon below) and reopen this dialog."}),(c==null?void 0:c.error)&&s.jsx("div",{className:"hint danger",children:c.error}),ie&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"gh-head",children:[s.jsxs("span",{children:["connected as ",s.jsx("b",{children:c.login}),c.storage==="memory"?" · until restart (no vault yet)":""," · ",s.jsx("button",{className:"link-btn",onClick:Ce,children:"disconnect"})]}),s.jsx("a",{href:c.installUrl,target:"_blank",rel:"noreferrer",children:"choose repositories on GitHub ↗"})]}),c.clones.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"section-title",children:"in the workspace"}),s.jsx("div",{className:"vault-items",children:c.clones.map(ee=>s.jsxs("div",{className:"vault-item",children:[s.jsx("span",{className:"ok","aria-hidden":!0,children:"✓"}),s.jsxs("span",{className:"name",title:ee.directory,children:[ee.fullName,s.jsxs("span",{className:"desc",children:[" — ",ee.branch??"detached"]})]}),s.jsx("button",{className:"btn sm",onClick:()=>{l(ee.directory),o()},children:"open"})]},ee.directory))})]}),m&&m.length===0?s.jsxs("div",{className:"gh-callout",children:[s.jsx("b",{children:"One more step."})," Signing in says who you are; which repositories BugXHunter may read is chosen separately, on GitHub's install screen. An organisation's owner may have to approve it. This list refreshes when you come back.",s.jsx("div",{className:"perm-actions center",children:s.jsx("a",{className:"btn primary wide",href:c.installUrl,target:"_blank",rel:"noreferrer",children:"Choose repositories on GitHub ↗"})})]}):s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"text",className:"mono",placeholder:"filter repositories…",value:v,onChange:ee=>S(ee.target.value),spellCheck:!1,autoFocus:!0}),s.jsxs("div",{className:"gh-list",role:"listbox","aria-label":"Repositories",children:[z==="repos"&&!m&&s.jsx("div",{className:"hint",children:"loading…"}),m&&m.length>0&&ce.length===0&&s.jsx("div",{className:"hint",children:"Nothing matches."}),ce.map(ee=>s.jsxs("button",{className:`gh-repo${(g==null?void 0:g.fullName)===ee.fullName?" selected":""}`,role:"option","aria-selected":(g==null?void 0:g.fullName)===ee.fullName,onClick:()=>ne(ee),children:[s.jsxs("span",{className:"gh-name",children:[ee.fullName,ee.private&&s.jsx("span",{className:"badge",children:"private"}),ee.archived&&s.jsx("span",{className:"badge",children:"archived"}),ee.directory&&s.jsx("span",{className:"badge on",children:"in workspace"})]}),ee.description&&s.jsx("span",{className:"gh-desc",children:ee.description}),s.jsxs("span",{className:"gh-meta",children:[s.jsx(Jw,{size:11})," ",ee.defaultBranch,ee.pushedAt?` · pushed ${Dc(ee.pushedAt)}`:""]})]},ee.fullName))]})]}),g&&s.jsxs("div",{className:"gh-clone",children:[s.jsx("label",{htmlFor:"gh-branch",children:"Branch"}),s.jsx("select",{id:"gh-branch",className:"mono",value:L,onChange:ee=>V(ee.target.value),disabled:!x,children:(x??[{name:L,isDefault:!0}]).map(ee=>s.jsxs("option",{value:ee.name,children:[ee.name,ee.isDefault?" (default)":""]},ee.name))}),s.jsx("button",{className:"btn primary sm",disabled:z!==null||!L,onClick:te,children:z==="clone"?g.directory?"updating…":"cloning…":g.directory?"update & open":"clone & open"})]}),g&&s.jsxs("div",{className:"hint",children:["Lands in ",s.jsxs("span",{className:"mono",children:[c.cloneRoot,"/",g.fullName]}),". An existing clone is fast-forwarded, never reset; the agent's local edits stay."]})]}),oe&&s.jsx("div",{className:"hint danger",children:oe})]})}function p1({current:l,onOpen:o,onDeleted:c,onClose:u}){const[d,h]=A.useState(""),[m,y]=A.useState(null),[v,S]=A.useState(""),[g,b]=A.useState(null),[x,k]=A.useState(""),[L,V]=A.useState(!1),[z,Z]=A.useState(null),oe=A.useCallback(()=>WS().then(O=>{h(O.root),y(O.workspaces)}).catch(O=>Z(O.message)),[]);A.useEffect(()=>{oe()},[oe]);async function de(O){V(!0),Z(null);try{await O()}catch(X){Z(X.message)}finally{V(!1)}}const C=()=>de(async()=>{const O=await ew(v.trim());S(""),o(O.directory),u()}),Y=O=>de(async()=>{await tw(O.directory),c(O.directory),b(null),k(""),await oe()});return s.jsxs(ks,{title:"workspace --list",onClose:u,children:[s.jsxs("p",{children:["Each workspace is a folder the agent works in",d?s.jsxs(s.Fragment,{children:[" under ",s.jsx("span",{className:"mono",children:d})]}):null,". Repositories cloned from GitHub appear here too."]}),s.jsxs("div",{className:"ws-new",children:[s.jsx("input",{type:"text",className:"mono",placeholder:"new-workspace-name","aria-label":"New workspace name",value:v,spellCheck:!1,onChange:O=>S(O.target.value),onKeyDown:O=>{O.key==="Enter"&&v.trim()&&C()}}),s.jsxs("button",{className:"btn primary sm",disabled:L||!v.trim(),onClick:C,children:[s.jsx(l1,{size:13})," create"]})]}),s.jsxs("div",{className:"gh-list",role:"list",children:[!m&&!z&&s.jsx("div",{className:"hint",children:"loading…"}),m&&m.length===0&&s.jsx("div",{className:"hint",children:"No workspaces yet. Create one above, or clone a repository from GitHub."}),m==null?void 0:m.map(O=>{const X=O.directory===l;return s.jsxs("div",{className:`ws-row${X?" current":""}`,role:"listitem",children:[s.jsxs("button",{className:"ws-open",onClick:()=>{o(O.directory),u()},disabled:X,title:X?"This is the open project":`Open ${O.directory}`,children:[s.jsx(hh,{size:14}),s.jsxs("span",{className:"gh-name",children:[O.name,X&&s.jsx("span",{className:"badge on",children:"open"}),!O.git&&s.jsx("span",{className:"badge",children:"no git"})]}),s.jsx("span",{className:"gh-meta",children:O.modified?`changed ${Dc(O.modified)}`:""})]}),s.jsx("button",{className:"icon-btn ws-del",disabled:L||X,onClick:()=>{b(O),k("")},title:X?"Open another project before deleting this one":`Delete ${O.name}`,"aria-label":`Delete ${O.name}`,children:s.jsx(a1,{size:14})})]},O.directory)})]}),g&&s.jsxs("div",{className:"ws-confirm",children:[s.jsxs("p",{children:[s.jsxs("b",{children:["Delete ",g.name,"?"]})," Everything in ",s.jsx("span",{className:"mono",children:g.directory})," is removed, including work the agent has not pushed anywhere. Type the name to confirm."]}),s.jsxs("div",{className:"ws-new",children:[s.jsx("input",{type:"text",className:"mono",autoFocus:!0,placeholder:g.name,"aria-label":"Type the workspace name to confirm",value:x,spellCheck:!1,onChange:O=>k(O.target.value),onKeyDown:O=>{O.key==="Enter"&&x===g.name&&Y(g)}}),s.jsx("button",{className:"btn danger-outline sm",disabled:L||x!==g.name,onClick:()=>Y(g),children:L?"deleting…":"delete"}),s.jsx("button",{className:"btn sm",disabled:L,onClick:()=>b(null),children:"cancel"})]})]}),z&&s.jsx("div",{className:"hint danger",children:z})]})}function zo(l){return l>=1024*1024?(l/1024/1024).toFixed(1)+" MB":l>=1024?Math.round(l/1024)+" KB":l+" B"}function Ai(l){return l>=1e6?(l/1e6).toFixed(l%1e6?1:0)+"M":l>=1e3?Math.round(l/1e3)+"k":String(l)}function Wv(l){const o=[];return l!=null&&l.cached&&o.push(`${l.cached} cached`),l!=null&&l.cacheWrite&&o.push(`${l.cacheWrite} written`),o.length?` (${o.join(", ")})`:""}const Yy=l=>(l<1e4?(l/1e3).toFixed(1):Math.round(l/1e3))+"s";function e0(l,o,c){const u=[];l.ttft!==void 0&&u.push(`${Yy(l.ttft)} to first token`);const d=c?l.total:l.total-(l.ttft??0);return o&&d>50&&u.push(`${Math.round(o/(d/1e3))} tok/s`),u.push(`${Yy(l.total)} total`),u.join(" · ")}function g1(l,o){const c=o?` ${o.toLocaleString("en")} tokens went on reasoning.`:"";return l!=null&&l.trim()?`Cut off at the Max tokens limit.${c} Raise Max tokens in the sidebar to get the rest.`:`The model reached the Max tokens limit before it wrote an answer.${c||" A reasoning model thinks first, and that counts."} Raise Max tokens in the sidebar and send again.`}function y1({directory:l,onClose:o}){const[c,u]=A.useState(""),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState([]),[g,b]=A.useState(null),[x,k]=A.useState(!1),L=A.useRef(null),V=A.useCallback(C=>{b(null),nw(l,C).then(Y=>{h(Y),u(Y.path)}).catch(Y=>b(Y.message))},[l]);A.useEffect(()=>{V("")},[V]);async function z(C){const Y=Array.from(C);if(!Y.length)return;b(null);const O=[];for(let X=0;X<Y.length;X++){const F=Y[X];y(`uploading ${X+1} of ${Y.length}: ${F.name}`);try{const ie=await aw(l,c,F);O.push(ie.name===F.name?`${ie.path} (${zo(ie.bytes)})`:`${F.name} → ${ie.path}, as a file of that name exists`)}catch(ie){O.push(`${F.name}: ${ie.message}`)}}y(null),S(O),V(c)}const Z=C=>{C.preventDefault(),k(!1),C.dataTransfer.files.length&&z(C.dataTransfer.files)},oe=c?c.split("/"):[],de=l.split(/[\\/]/).filter(Boolean).pop()??l;return s.jsxs(ks,{title:"files --browse",onClose:o,children:[s.jsxs("div",{className:"files-head",children:[s.jsxs("nav",{className:"files-crumbs mono","aria-label":"Folder",children:[s.jsx("button",{className:"link-btn",onClick:()=>V(""),title:l,children:de}),oe.map((C,Y)=>s.jsxs("span",{children:[s.jsx("span",{className:"sep",children:"/"}),s.jsx("button",{className:"link-btn",onClick:()=>V(oe.slice(0,Y+1).join("/")),children:C})]},Y))]}),s.jsxs("button",{className:"btn primary sm",disabled:!!m,onClick:()=>{var C;return(C=L.current)==null?void 0:C.click()},children:[s.jsx(t1,{size:13})," upload"]}),s.jsx("input",{ref:L,type:"file",multiple:!0,hidden:!0,onChange:C=>{C.target.files&&z(C.target.files),C.target.value=""}})]}),s.jsxs("div",{className:`gh-list files-list${x?" dragging":""}`,role:"list",onDragOver:C=>{C.preventDefault(),k(!0)},onDragLeave:()=>k(!1),onDrop:Z,children:[!d&&!g&&s.jsx("div",{className:"hint",children:"loading…"}),c&&s.jsxs("button",{className:"file-row",onClick:()=>V(oe.slice(0,-1).join("/")),children:[s.jsx(s1,{size:14}),s.jsx("span",{className:"file-name",children:".."})]}),d&&d.entries.length===0&&s.jsx("div",{className:"hint",children:"Empty. Drop files here, or use upload."}),d==null?void 0:d.entries.map(C=>{const Y=c?`${c}/${C.name}`:C.name;return C.type==="dir"?s.jsxs("button",{className:"file-row",onClick:()=>V(Y),children:[s.jsx(hh,{size:14}),s.jsxs("span",{className:"file-name",children:[C.name,"/"]}),s.jsx("span",{className:"gh-meta",children:C.modified?Dc(C.modified):""})]},C.name):s.jsxs("a",{className:"file-row",href:lw(l,Y),download:C.name,title:`Download ${Y}`,children:[s.jsx(e1,{size:14}),s.jsx("span",{className:"file-name",children:C.name}),s.jsxs("span",{className:"gh-meta",children:[zo(C.size),C.modified?` · ${Dc(C.modified)}`:""]}),s.jsx(n1,{size:13,className:"file-dl"})]},C.name)}),(d==null?void 0:d.truncated)&&s.jsx("div",{className:"hint",children:"Showing the first 2000 entries."})]}),s.jsx("div",{className:"hint",children:m??"Click a file to download it. Drop files on the list to upload them into this folder; nothing is overwritten."}),v.length>0&&s.jsx("ul",{className:"files-notes",children:v.map((C,Y)=>s.jsx("li",{className:"mono",children:C},Y))}),g&&s.jsx("div",{className:"hint danger",children:g})]})}const v1=/(embed|rerank|retriev|guard|safety|detector|deplot|calibration|reward|whisper|\bstt\b|\btts\b|parse|ocr|opir)/i;function Lc(l){return l.output_modalities.includes("text")?!v1.test(`${l.id} ${l.name}`):!1}function b1(l,o){const c=o.trim().toLowerCase();return!c||`${l.name} ${l.id}`.toLowerCase().includes(c)}const t0=[{id:"A01:2025",name:"Broken Access Control",stride:"E",look:"object or function reachable by changing an id, role or URL; missing checks server-side; CORS, path traversal, IDOR, forced browsing, JWT or cookie tampering",fix:"deny by default, enforce ownership and role on the server for every object and function, log failures, rate-limit automation"},{id:"A02:2025",name:"Security Misconfiguration",stride:"I",look:"defaults left on, debug or admin interfaces exposed, verbose errors, permissive cloud storage, missing hardening headers, unneeded features and ports",fix:"hardened repeatable builds, minimal platform, configuration review per environment, automated drift checks"},{id:"A03:2025",name:"Software Supply Chain Failures",stride:"T",look:"unpinned or unverified dependencies, build and CI steps that can be tampered with, packages from untrusted registries, no SBOM, unsigned artifacts",fix:"pin and verify dependencies, signed builds with provenance, SBOM, dependency and container scanning, least privilege for CI tokens"},{id:"A04:2025",name:"Cryptographic Failures",stride:"I",look:"plaintext or weak transport, secrets or PII stored unencrypted, weak algorithms or key sizes, home-made crypto, keys in code, poor randomness",fix:"TLS everywhere, modern algorithms (AES-256-GCM, SHA-256+, Argon2 or bcrypt for passwords), key management, encrypt data at rest, no custom crypto"},{id:"A05:2025",name:"Injection",stride:"T",look:"user input reaching SQL, NoSQL, OS commands, LDAP, templates, XPath or HTML without separation; string-built queries; reflected or stored script",fix:"parameterised queries and safe APIs, allow-list validation, contextual output encoding, CSP, no shell from input"},{id:"A06:2025",name:"Insecure Design",stride:"STRIDE",look:"missing threat model, business-logic abuse (replay, race, quota bypass), trust placed in the client, recovery flows that leak or bypass, no abuse cases",fix:"threat modelling in design, secure design patterns and reference architectures, abuse-case tests, limits on business flows"},{id:"A07:2025",name:"Authentication Failures",stride:"S",look:"credential stuffing and brute force possible, weak or default passwords, no MFA on sensitive actions, session ids in URLs, sessions not rotated or expired, weak recovery",fix:"MFA, breached-password checks, rate limits and lockout, server-side session management with rotation and expiry, secure recovery"},{id:"A08:2025",name:"Software or Data Integrity Failures",stride:"T",look:"unsigned updates and plugins, insecure deserialisation, CI pipelines or auto-update channels that trust unverified input, integrity of data in transit between services unchecked",fix:"signatures and verification for code, updates and serialised data; integrity checks in pipelines; no deserialisation of untrusted input"},{id:"A09:2025",name:"Security Logging and Alerting Failures",stride:"R",look:"logins, access failures and high-value actions not logged, logs without context or integrity, no alerting, no response plan, logs that leak secrets",fix:"log auth and authorisation events with user and time, protect log integrity, alert on patterns, test the response playbook"},{id:"A10:2025",name:"Mishandling of Exceptional Conditions",stride:"D",look:"errors that fail open, unhandled exceptions, resource exhaustion, retries without limits, partial failures that leave state inconsistent, error messages with internals",fix:"fail closed, handle every error path, timeouts and limits, idempotent operations, generic errors to users with detail in logs"}],n0=[{id:"API1:2023",name:"Broken Object Level Authorization",stride:"E",look:"endpoints that take an object id and never check the caller owns it",fix:"authorise every object access against the session's identity; random ids are not a control"},{id:"API2:2023",name:"Broken Authentication",stride:"S",look:"weak tokens, no expiry or rotation, credentials in URLs, unauthenticated sensitive endpoints, auth that differs between API versions",fix:"standard, tested auth on every endpoint; short-lived tokens; MFA for sensitive flows"},{id:"API3:2023",name:"Broken Object Property Level Authorization",stride:"I",look:"responses that return more fields than the client needs; mass assignment of fields the user may not set",fix:"explicit response schemas and allow-lists for writable properties"},{id:"API4:2023",name:"Unrestricted Resource Consumption",stride:"D",look:"no limits on request rate, payload size, pagination, uploads or paid third-party calls",fix:"rate limits, quotas, size and pagination caps, spend limits on paid services"},{id:"API5:2023",name:"Broken Function Level Authorization",stride:"E",look:"admin or privileged functions reachable by guessing the route or changing the method",fix:"deny by default, role checks on every function, one authorisation module"},{id:"API6:2023",name:"Unrestricted Access to Sensitive Business Flows",stride:"D",look:"flows like purchase, signup, voting or booking callable at scale by scripts",fix:"detect and slow automation: device fingerprinting, step-up, human checks, business limits"},{id:"API7:2023",name:"Server Side Request Forgery",stride:"I",look:"the API fetches a URL the client supplies: webhooks, imports, previews, image fetchers",fix:"allow-list destinations, block internal ranges and metadata endpoints, no redirects, isolated fetcher"},{id:"API8:2023",name:"Security Misconfiguration",stride:"I",look:"missing TLS, permissive CORS, verbose errors, unneeded HTTP methods, unpatched components",fix:"hardening baseline, automated configuration checks, patching"},{id:"API9:2023",name:"Improper Inventory Management",stride:"I",look:"old API versions, debug or staging endpoints still live, undocumented hosts and data flows",fix:"inventory of hosts, versions and data flows; retire old versions; document data sharing"},{id:"API10:2023",name:"Unsafe Consumption of APIs",stride:"T",look:"data from third-party APIs trusted without validation, followed redirects, unencrypted upstream calls",fix:"validate and limit upstream responses, TLS to upstreams, timeouts, no blind redirects"}],a0=[{id:"LLM01:2025",name:"Prompt Injection",stride:"T",look:"user or retrieved content changes the model's instructions; indirect injection through documents, web pages, tool results, emails",fix:"treat all model input as untrusted, separate instructions from data, constrain output format, least privilege for what the model can trigger, human approval for consequential actions"},{id:"LLM02:2025",name:"Sensitive Information Disclosure",stride:"I",look:"secrets, PII or system details in training data, context or outputs; model repeats what one user told it to another",fix:"scrub data, scope context per user, output filtering, no secrets in prompts"},{id:"LLM03:2025",name:"Supply Chain",stride:"T",look:"third-party models, adapters, datasets, plugins or packages with no provenance; pickled or unsigned model files",fix:"verified sources, signed artifacts, AI bill of materials, scan model files, pin versions"},{id:"LLM04:2025",name:"Data and Model Poisoning",stride:"T",look:"training, fine-tuning or embedding data that an outsider can influence; backdoor triggers",fix:"dataset provenance and validation, anomaly checks, hold-out evaluation, sandbox fine-tuning"},{id:"LLM05:2025",name:"Improper Output Handling",stride:"T",look:"model output rendered as HTML, executed as code or SQL, or passed to a shell or another API without validation",fix:"treat output as untrusted input: encode, validate, parameterise, sandbox execution"},{id:"LLM06:2025",name:"Excessive Agency",stride:"E",look:"tools and permissions beyond the task, autonomous actions with no approval, one credential for every tool",fix:"minimal tools and scopes, per-action authorisation, human in the loop for consequential actions, kill switch"},{id:"LLM07:2025",name:"System Prompt Leakage",stride:"I",look:"system prompt holds secrets, roles or rules the security depends on; it can be extracted by asking",fix:"no secrets or security decisions in prompts; enforce rules outside the model"},{id:"LLM08:2025",name:"Vector and Embedding Weaknesses",stride:"I",look:"shared vector store across tenants, poisoned or stale documents, embedding inversion, retrieval of restricted documents",fix:"per-tenant and per-user access control on retrieval, validate sources, monitor retrieved content"},{id:"LLM09:2025",name:"Misinformation",stride:"R",look:"hallucinated facts, packages or citations acted on without checking; over-reliance in decisions",fix:"grounding with retrieval, verification steps, human review for decisions, communicate uncertainty"},{id:"LLM10:2025",name:"Unbounded Consumption",stride:"D",look:"no limits on tokens, requests, recursion or cost; model extraction through many queries",fix:"rate and spend limits, input size caps, timeouts, query monitoring, watermark or limit API detail"}],l0=[{id:"ASI01:2026",name:"Agent Goal Hijack",stride:"T",look:"content the agent reads (pages, files, tool results, other agents) redirects what it is trying to do",fix:"isolate instructions from data, verify intent before acting, constrain plans to the task"},{id:"ASI02:2026",name:"Tool Misuse and Exploitation",stride:"E",look:"permitted tools used in loops, unsafe chains or at runaway volume; tool parameters from untrusted text",fix:"least-agency tool scoping, parameter validation, budgets and loop limits, approval for risky tools"},{id:"ASI03:2026",name:"Identity and Privilege Abuse",stride:"S",look:"agent acts with a human's or a service's broad credential; delegation with no bound identity or scope",fix:"per-agent identity, short-lived scoped tokens, delegation that carries the principal and the task"},{id:"ASI04:2026",name:"Agentic Supply Chain Vulnerabilities",stride:"T",look:"imported tools, MCP servers, schemas, prompts or other agents trusted without verification",fix:"verify and pin tool and agent sources, review tool definitions, sandbox third-party tools"},{id:"ASI05:2026",name:"Unexpected Code Execution",stride:"E",look:"generated code or commands run without validation or isolation; interpreters reachable from prompts",fix:"sandboxed execution, allow-listed commands, review before run, no shell from model text"},{id:"ASI06:2026",name:"Memory and Context Poisoning",stride:"T",look:"injected or leaked memory, notes or thread context keeps steering later runs",fix:"validate what is written to memory, scope memory per user and task, expiry, review of persistent context"},{id:"ASI07:2026",name:"Insecure Inter-Agent Communication",stride:"S",look:"messages between agents can be read, forged or altered; no authentication between agents",fix:"authenticated, integrity-protected channels; schemas; treat other agents' output as untrusted"},{id:"ASI08:2026",name:"Cascading Failures",stride:"D",look:"one bad output or outage propagates through chained tools and agents; no circuit breakers",fix:"isolation boundaries, timeouts, circuit breakers, idempotent actions, rollback"},{id:"ASI09:2026",name:"Human-Agent Trust Exploitation",stride:"R",look:"confident agent output accepted without verification; approvals rubber-stamped; UI that hides what the agent did",fix:"show evidence and provenance, require review for consequential actions, measure override rates"},{id:"ASI10:2026",name:"Rogue Agents",stride:"E",look:"agents acting outside their intended behaviour or scope, surviving beyond their task, no way to stop them",fix:"kill switch, task-bound lifetimes, monitoring of actions against policy, audit trail"}],x1=[{id:"M1:2024",name:"Improper Credential Usage",look:"hardcoded keys, credentials stored or transmitted insecurely",fix:"no secrets in the app, platform keystores, short-lived tokens"},{id:"M2:2024",name:"Inadequate Supply Chain Security",look:"unverified SDKs and libraries, compromised build",fix:"vetted dependencies, signed builds, integrity checks"},{id:"M3:2024",name:"Insecure Authentication/Authorization",look:"client-side auth decisions, weak session handling, missing server checks",fix:"server-side authorisation, MFA, secure session tokens"},{id:"M4:2024",name:"Insufficient Input/Output Validation",look:"injection via deep links, intents, WebViews, file inputs",fix:"validate and encode at every boundary, restrict WebView bridges"},{id:"M5:2024",name:"Insecure Communication",look:"plaintext or weakly validated TLS, no pinning where warranted",fix:"TLS with validation, pinning for high-value apps"},{id:"M6:2024",name:"Inadequate Privacy Controls",look:"over-collection, PII in logs, leakage to third parties",fix:"data minimisation, consent, scrub logs"},{id:"M7:2024",name:"Insufficient Binary Protections",look:"easy reverse engineering and tampering of the binary",fix:"obfuscation and integrity checks where the threat model needs them; keep secrets off the device"},{id:"M8:2024",name:"Security Misconfiguration",look:"debug flags, exported components, permissive permissions",fix:"hardened release config, minimal permissions"},{id:"M9:2024",name:"Insecure Data Storage",look:"sensitive data in plain files, caches, backups, clipboard",fix:"platform secure storage, encryption, exclude from backups"},{id:"M10:2024",name:"Insufficient Cryptography",look:"weak algorithms, poor key handling, custom crypto",fix:"platform crypto APIs, modern algorithms, key management"}],S1=[{id:"V1",name:"Encoding and Sanitization",covers:"injection prevention, output encoding, sanitisation of HTML, SQL, OS, templates"},{id:"V2",name:"Validation and Business Logic",covers:"input validation, business-logic limits, anti-automation, sequence and timing"},{id:"V3",name:"Web Frontend Security",covers:"browser security headers, CSP, cookies, CORS, clickjacking"},{id:"V4",name:"API and Web Service",covers:"REST, GraphQL, WebSocket, schema validation, HTTP method handling"},{id:"V5",name:"File Handling",covers:"uploads, downloads, path traversal, file type and size limits, storage"},{id:"V6",name:"Authentication",covers:"passwords, MFA, credential recovery, lookup secrets, out-of-band, rate limits"},{id:"V7",name:"Session Management",covers:"session ids, binding, timeout, logout, re-authentication, cookie attributes"},{id:"V8",name:"Authorization",covers:"object, function and field-level authorisation, ownership, admin interfaces"},{id:"V9",name:"Self-contained Tokens",covers:"JWT and similar: signature, algorithm, audience, expiry, revocation"},{id:"V10",name:"OAuth and OIDC",covers:"flows, PKCE, redirect validation, token handling, client registration"},{id:"V11",name:"Cryptography",covers:"algorithms, key management, randomness, password hashing, crypto agility"},{id:"V12",name:"Secure Communication",covers:"TLS configuration, certificate validation, internal service encryption"},{id:"V13",name:"Configuration",covers:"secrets management, dependencies, unneeded features, secure defaults, build integrity"},{id:"V14",name:"Data Protection",covers:"classification, encryption at rest, minimisation, caching, data in logs and backups"},{id:"V15",name:"Secure Coding and Architecture",covers:"threat modelling, trust boundaries, defensive coding, memory safety, concurrency"},{id:"V16",name:"Security Logging and Error Handling",covers:"what to log, log protection, error handling that fails closed"},{id:"V17",name:"WebRTC",covers:"media and signalling security, TURN, DoS resistance"}],w1=[{id:"4.1",code:"WSTG-INFO",name:"Information Gathering",tests:"search engine and metadata leakage, fingerprint server and framework, enumerate applications and entry points, map architecture and execution paths"},{id:"4.2",code:"WSTG-CONF",name:"Configuration and Deployment Management",tests:"platform and framework configuration, file extensions and backups, admin interfaces, HTTP methods, HSTS, cloud storage, subdomain takeover, path confusion"},{id:"4.3",code:"WSTG-IDNT",name:"Identity Management",tests:"role definitions, registration and provisioning, account enumeration, username policy"},{id:"4.4",code:"WSTG-ATHN",name:"Authentication",tests:"credentials over encrypted channel, default credentials, lockout, bypass, remember-me, cache, password policy and reset, MFA"},{id:"4.5",code:"WSTG-ATHZ",name:"Authorization",tests:"directory traversal and file include, authorisation bypass, privilege escalation, IDOR, OAuth"},{id:"4.6",code:"WSTG-SESS",name:"Session Management",tests:"session schema, cookie attributes, fixation, exposed variables, CSRF, logout, timeout, puzzling, hijacking, JWT"},{id:"4.7",code:"WSTG-INPV",name:"Injection",tests:"reflected and stored XSS, HTTP verb and parameter tampering, SQL, LDAP, XML, SSI, XPath, IMAP/SMTP, code, command, format string, buffer, HTTP splitting, request smuggling, SSRF, mass assignment"},{id:"4.8",code:"WSTG-ERRH",name:"Error Handling",tests:"improper error handling, stack traces"},{id:"4.9",code:"WSTG-CRYP",name:"Weak Cryptography",tests:"TLS, padding oracle, sensitive data over unencrypted channels, weak encryption"},{id:"4.10",code:"WSTG-BUSL",name:"Business Logic",tests:"data validation, request forgery, integrity checks, process timing, function limits, workflow circumvention, defences against misuse, unexpected file types, malicious file upload, payment functionality"},{id:"4.11",code:"WSTG-CLNT",name:"Client-side",tests:"DOM XSS, JavaScript execution, HTML and CSS injection, client-side redirect, resource manipulation, CORS, cross-site flashing, clickjacking, WebSockets, web messaging, browser storage, script inclusion, reverse tabnabbing"},{id:"4.12",code:"WSTG-APIT",name:"API Testing",tests:"GraphQL (introspection, batching, injection), API reconnaissance, broken object-level authorisation"}],qf=[{id:"AML.TA0002",name:"Reconnaissance",techniques:["AML.T0000 Search Open Technical Databases","AML.T0001 Search Open AI Vulnerability Analysis","AML.T0003 Search Victim-Owned Websites","AML.T0004 Search Application Repositories","AML.T0006 Active Scanning","AML.T0064 Gather RAG-Indexed Targets","AML.T0087 Gather Victim Identity Information","AML.T0095 Search Open Websites/Domains"]},{id:"AML.TA0003",name:"Resource Development",techniques:["AML.T0002 Acquire Public AI Artifacts","AML.T0008 Acquire Infrastructure","AML.T0016 Obtain Capabilities","AML.T0017 Develop Capabilities","AML.T0019 Publish Poisoned Datasets","AML.T0020 Poison Training Data","AML.T0021 Establish Accounts","AML.T0058 Publish Poisoned Models","AML.T0060 Publish Hallucinated Entities","AML.T0065 LLM Prompt Crafting","AML.T0066 Retrieval Content Crafting","AML.T0079 Stage Capabilities","AML.T0104 Publish Poisoned AI Agent Tool"]},{id:"AML.TA0004",name:"Initial Access",techniques:["AML.T0010 AI Supply Chain Compromise (hardware, AI software, data, model, container registry, AI agent tool)","AML.T0012 Valid Accounts","AML.T0015 Evade AI Model","AML.T0049 Exploit Public-Facing Application","AML.T0052 Phishing (LLM-written spearphishing, deepfake-assisted)","AML.T0078 Drive-by Compromise","AML.T0093 Prompt Infiltration via Public-Facing Application"]},{id:"AML.TA0000",name:"AI Model Access",techniques:["AML.T0040 AI Model Inference API Access","AML.T0041 Physical Environment Access","AML.T0044 Full AI Model Access","AML.T0047 AI-Enabled Product or Service"]},{id:"AML.TA0005",name:"Execution",techniques:["AML.T0011 User Execution (unsafe AI artifacts, malicious package, poisoned AI agent tool, malicious link)","AML.T0050 Command and Scripting Interpreter","AML.T0051 LLM Prompt Injection (AML.T0051.000 direct, AML.T0051.001 indirect, AML.T0051.002 triggered)","AML.T0053 AI Agent Tool Invocation","AML.T0100 AI Agent Clickbait","AML.T0103 Deploy AI Agent"]},{id:"AML.TA0006",name:"Persistence",techniques:["AML.T0018 Manipulate AI Model (poison, modify architecture, embed malware)","AML.T0020 Poison Training Data","AML.T0061 LLM Prompt Self-Replication","AML.T0070 RAG Poisoning","AML.T0080 AI Agent Context Poisoning (memory, thread)","AML.T0081 Modify AI Agent Configuration","AML.T0093 Prompt Infiltration via Public-Facing Application","AML.T0099 AI Agent Tool Data Poisoning","AML.T0110 AI Agent Tool Poisoning"]},{id:"AML.TA0012",name:"Privilege Escalation",techniques:["AML.T0012 Valid Accounts","AML.T0053 AI Agent Tool Invocation","AML.T0054 LLM Jailbreak","AML.T0105 Escape to Host"]},{id:"AML.TA0007",name:"Defense Evasion",techniques:["AML.T0015 Evade AI Model","AML.T0054 LLM Jailbreak","AML.T0067 LLM Trusted Output Components Manipulation (citations)","AML.T0068 LLM Prompt Obfuscation","AML.T0071 False RAG Entry Injection","AML.T0073 Impersonation","AML.T0074 Masquerading","AML.T0076 Corrupt AI Model","AML.T0081 Modify AI Agent Configuration","AML.T0092 Manipulate User LLM Chat History","AML.T0094 Delay Execution of LLM Instructions","AML.T0097 Virtualization/Sandbox Evasion","AML.T0107 Exploitation for Defense Evasion","AML.T0109 AI Supply Chain Rug Pull","AML.T0111 AI Supply Chain Reputation Inflation"]},{id:"AML.TA0013",name:"Credential Access",techniques:["AML.T0055 Unsecured Credentials","AML.T0082 RAG Credential Harvesting","AML.T0083 Credentials from AI Agent Configuration","AML.T0090 OS Credential Dumping","AML.T0098 AI Agent Tool Credential Harvesting","AML.T0106 Exploitation for Credential Access"]},{id:"AML.TA0008",name:"Discovery",techniques:["AML.T0007 Discover AI Artifacts","AML.T0013 Discover AI Model Ontology","AML.T0014 Discover AI Model Family","AML.T0062 Discover LLM Hallucinations","AML.T0063 Discover AI Model Outputs","AML.T0069 Discover LLM System Information (special character sets, system instruction keywords, system prompt)","AML.T0075 Cloud Service Discovery","AML.T0084 Discover AI Agent Configuration (embedded knowledge, tool definitions, activation triggers, call chains)","AML.T0089 Process Discovery"]},{id:"AML.TA0015",name:"Lateral Movement",techniques:["AML.T0052 Phishing (from a compromised assistant)","AML.T0091 Use Alternate Authentication Material (application access token)"]},{id:"AML.TA0009",name:"Collection",techniques:["AML.T0035 AI Artifact Collection","AML.T0036 Data from Information Repositories","AML.T0037 Data from Local System","AML.T0085 Data from AI Services (RAG databases, AI agent tools)"]},{id:"AML.TA0001",name:"AI Attack Staging",techniques:["AML.T0005 Create Proxy AI Model","AML.T0018 Manipulate AI Model","AML.T0042 Verify Attack","AML.T0043 Craft Adversarial Data (white-box, black-box, transfer, manual, backdoor trigger)","AML.T0088 Generate Deepfakes","AML.T0102 Generate Malicious Commands"]},{id:"AML.TA0014",name:"Command and Control",techniques:["AML.T0072 Reverse Shell","AML.T0096 AI Service API","AML.T0108 AI Agent"]},{id:"AML.TA0010",name:"Exfiltration",techniques:["AML.T0024 Exfiltration via AI Inference API (membership inference, model inversion, model extraction)","AML.T0025 Exfiltration via Cyber Means","AML.T0056 Extract LLM System Prompt","AML.T0057 LLM Data Leakage","AML.T0077 LLM Response Rendering (markdown images, links that carry data)","AML.T0086 Exfiltration via AI Agent Tool Invocation"]},{id:"AML.TA0011",name:"Impact",techniques:["AML.T0015 Evade AI Model","AML.T0029 Denial of AI Service","AML.T0031 Erode AI Model Integrity","AML.T0034 Cost Harvesting (excessive queries, resource-intensive queries, agentic resource consumption)","AML.T0046 Spamming AI System with Chaff Data","AML.T0048 External Harms (financial, reputational, societal, user, AI IP theft)","AML.T0059 Erode Dataset Integrity","AML.T0101 Data Destruction via AI Agent Tool Invocation","AML.T0112 Machine Compromise (local AI agent, AI artifacts)"]}],A1=[{id:"AML.M0000",name:"Limit Public Release of Information"},{id:"AML.M0001",name:"Limit Model Artifact Release"},{id:"AML.M0002",name:"Passive AI Output Obfuscation"},{id:"AML.M0003",name:"Model Hardening"},{id:"AML.M0004",name:"Restrict Number of AI Model Queries"},{id:"AML.M0005",name:"Control Access to AI Models and Data at Rest"},{id:"AML.M0006",name:"Use Ensemble Methods"},{id:"AML.M0007",name:"Sanitize Training Data"},{id:"AML.M0008",name:"Validate AI Model"},{id:"AML.M0009",name:"Use Multi-Modal Sensors"},{id:"AML.M0010",name:"Input Restoration"},{id:"AML.M0011",name:"Restrict Library Loading"},{id:"AML.M0012",name:"Encrypt Sensitive Information"},{id:"AML.M0013",name:"Code Signing"},{id:"AML.M0014",name:"Verify AI Artifacts"},{id:"AML.M0015",name:"Adversarial Input Detection"},{id:"AML.M0016",name:"Vulnerability Scanning"},{id:"AML.M0017",name:"AI Model Distribution Methods"},{id:"AML.M0018",name:"User Training"},{id:"AML.M0019",name:"Control Access to AI Models and Data in Production"},{id:"AML.M0020",name:"Generative AI Guardrails"},{id:"AML.M0021",name:"Generative AI Guidelines"},{id:"AML.M0022",name:"Generative AI Model Alignment"},{id:"AML.M0023",name:"AI Bill of Materials"},{id:"AML.M0024",name:"AI Telemetry Logging"},{id:"AML.M0025",name:"Maintain AI Dataset Provenance"},{id:"AML.M0026",name:"Privileged AI Agent Permissions Configuration"},{id:"AML.M0027",name:"Single-User AI Agent Permissions Configuration"},{id:"AML.M0028",name:"AI Agent Tools Permissions Configuration"},{id:"AML.M0029",name:"Human In-the-Loop for AI Agent Actions"},{id:"AML.M0030",name:"Restrict AI Agent Tool Invocation on Untrusted Data"},{id:"AML.M0031",name:"Memory Hardening"},{id:"AML.M0032",name:"Segmentation of AI Agent Components"},{id:"AML.M0033",name:"Input and Output Validation for AI Agent Components"},{id:"AML.M0034",name:"Deepfake Detection"}],T1=[{letter:"S",name:"Spoofing",violates:"authentication",asks:"can someone pretend to be this user, service or device?"},{letter:"T",name:"Tampering",violates:"integrity",asks:"can data, code, config or a message be changed without detection?"},{letter:"R",name:"Repudiation",violates:"non-repudiation",asks:"can an action be denied later because nothing trustworthy recorded it?"},{letter:"I",name:"Information disclosure",violates:"confidentiality",asks:"can data be read by someone who should not?"},{letter:"D",name:"Denial of service",violates:"availability",asks:"can it be exhausted, crashed or locked?"},{letter:"E",name:"Elevation of privilege",violates:"authorisation",asks:"can a lower-privileged party do a higher-privileged thing?"}],k1={actor:"SR",external:"SRD",service:"STRIDE",ai:"STRIDE",datastore:"TRID",flow:"TID"},Io=(l,o,c=!0)=>`${l}
54
54
  `+o.map(u=>`- ${u.id} ${u.name}: look for ${u.look}.${c?` Fix: ${u.fix}.`:""}`).join(`
55
- `),Yl=(l=!0)=>Io("OWASP Top 10:2025 (web applications):",Wv,l),gi=(l=!0)=>Io("OWASP API Security Top 10:2023:",e0,l),ol=(l=!0)=>Io("OWASP Top 10 for LLM Applications 2025:",t0,l),yi=(l=!0)=>Io("OWASP Top 10 for Agentic Applications 2026:",n0,l),a0=(l=!0)=>Io("OWASP Mobile Top 10 2024:",yw,l),No=()=>`OWASP ASVS 5.0 chapters (the requirements a control is verified against):
56
- `+vw.map(l=>`- ${l.id} ${l.name}: ${l.covers}`).join(`
57
- `),Aw=()=>`OWASP WSTG 4.2 test categories (the order a web test runs in):
58
- `+bw.map(l=>`- ${l.id} ${l.code} ${l.name}: ${l.tests}`).join(`
55
+ `),Yl=(l=!0)=>Io("OWASP Top 10:2025 (web applications):",t0,l),gi=(l=!0)=>Io("OWASP API Security Top 10:2023:",n0,l),ol=(l=!0)=>Io("OWASP Top 10 for LLM Applications 2025:",a0,l),yi=(l=!0)=>Io("OWASP Top 10 for Agentic Applications 2026:",l0,l),s0=(l=!0)=>Io("OWASP Mobile Top 10 2024:",x1,l),No=()=>`OWASP ASVS 5.0 chapters (the requirements a control is verified against):
56
+ `+S1.map(l=>`- ${l.id} ${l.name}: ${l.covers}`).join(`
57
+ `),j1=()=>`OWASP WSTG 4.2 test categories (the order a web test runs in):
58
+ `+w1.map(l=>`- ${l.id} ${l.code} ${l.name}: ${l.tests}`).join(`
59
59
  `),bs=()=>`MITRE ATLAS tactics and techniques (attacks on AI systems, ids AML.Txxxx; cite them for AI components):
60
60
  `+qf.map(l=>`- ${l.id} ${l.name}: ${l.techniques.join("; ")}`).join(`
61
61
  `),Ec=()=>`MITRE ATLAS mitigations (cite the id in a fix for an AI component):
62
- `+xw.map(l=>`${l.id} ${l.name}`).join("; "),mh=()=>`STRIDE, per element:
63
- `+Sw.map(l=>`- ${l.letter} ${l.name} (violates ${l.violates}): ${l.asks}`).join(`
62
+ `+A1.map(l=>`${l.id} ${l.name}`).join("; "),mh=()=>`STRIDE, per element:
63
+ `+T1.map(l=>`- ${l.letter} ${l.name} (violates ${l.violates}): ${l.asks}`).join(`
64
64
  `)+`
65
- Applicable categories by element: `+Object.entries(ww).map(([l,o])=>`${l} ${o}`).join(", ")+".",l0=`Severity (rate by what an attacker gets, not by how clever the bug is):
65
+ Applicable categories by element: `+Object.entries(k1).map(([l,o])=>`${l} ${o}`).join(", ")+".",i0=`Severity (rate by what an attacker gets, not by how clever the bug is):
66
66
  - critical: unauthenticated, or any user, reaches other users' or regulated data, runs code, or takes over accounts or infrastructure; no mitigating control in the way.
67
67
  - high: the same with one precondition (a low-privilege account, user interaction, an internal position), or a sensitive-data exposure at scale.
68
68
  - medium: limited data or limited users, needs chaining or an unlikely precondition, or a missing defence-in-depth control that the threat model relies on.
69
69
  - low: hygiene, information with no direct path to harm, or an issue needing an already-compromised position.
70
- Business-critical data (regulated, financial, safety) raises a rating one step; a tested compensating control lowers it one step. Say which applied.`,Tw=`Working rules:
70
+ Business-critical data (regulated, financial, safety) raises a rating one step; a tested compensating control lowers it one step. Say which applied.`,N1=`Working rules:
71
71
  - Only assess systems the user owns or is authorised to test (engagements, labs, CTFs). Decline to help attack anything else, and say so briefly.
72
72
  - Separate evidence from inference. Only report what the material shows; say what you assumed and what you could not check. Never invent components, findings or citations.
73
73
  - Cite the reference for every finding: the OWASP id (A01:2025, API1:2023, LLM01:2025, ASI01:2026, M1:2024), the CWE, and for AI components the ATLAS technique (AML.Txxxx) and mitigation (AML.Mxxxx); ATT&CK ids (Txxxx) for adversary behaviour outside the AI system.
74
74
  - Every finding carries a concrete fix a developer can act on, and the ASVS chapter it is verified against.
75
75
  - Rate severity with the rubric below and show the reasoning in one line.
76
- - Finish with a coverage line: which categories you considered and found nothing for, so silence is not mistaken for safety.`,kw=()=>[Yl(),gi(),ol(),yi(),a0(!1),No(),bs(),Ec()].join(`
76
+ - Finish with a coverage line: which categories you considered and found nothing for, so silence is not mistaken for safety.`,E1=()=>[Yl(),gi(),ol(),yi(),s0(!1),No(),bs(),Ec()].join(`
77
77
 
78
- `),jw=()=>[`OWASP Top 10:2025: ${Wv.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP API Top 10:2023: ${e0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP LLM Top 10 2025: ${t0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP Agentic Top 10 2026: ${n0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`ATLAS tactics: ${qf.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`ATLAS techniques to cite on AI components: ${qf.flatMap(l=>l.techniques).filter((l,o,c)=>c.indexOf(l)===o).map(l=>l.replace(/ \(.*\)$/,"")).join("; ")}.`].join(`
79
- `),Nw=[{id:"web",name:"Web",first:["read the page source, robots.txt, sitemap.xml, .git/, .env, backup names (index.php~, .bak, .old), and every JS bundle for routes and secrets","map every parameter (query, body, cookie, header) and what each changes; note the stack from headers and error pages","try the obvious on each input: a quote, {{7*7}}, ../, a URL you control, an id one off yours, a different HTTP method"],families:["injection: SQL (error, union, blind, time), NoSQL ($ne, $regex), command, SSTI ({{7*7}}, ${7*7}, Jinja2 and Twig gadget chains), XXE, LDAP","access: IDOR, forced browsing, JWT (alg none, key confusion, weak secret, kid injection), session fixation, mass assignment","files: LFI with wrappers (php://filter, data://, zip://), log poisoning, upload bypass (double extension, content-type, polyglot, .htaccess)","client: XSS (reflected, stored, DOM, in attributes and JS strings), CSRF, prototype pollution, postMessage, open redirect","server: SSRF to 127.0.0.1, 169.254.169.254 and internal names, deserialisation (PHP, Java, Python pickle, .NET), race conditions, HTTP smuggling, cache poisoning","logic: coupon and quantity tricks, negative numbers, unicode normalisation, type juggling (== in PHP, 0e hashes), length limits that truncate"],tools:["curl -i -s (see the raw response), ffuf -w wordlist -u URL/FUZZ (directories, parameters, vhosts), katana (crawl), httpx (fingerprint)","sqlmap -u URL --batch (once a manual probe shows injection), jwt_tool or a python one-liner for JWT, Burp or mitmproxy for a repeater","python requests scripts for anything repetitive; a race needs threads or h2 single-packet"],stuck:["what does the challenge name or theme hint at?","which parameter have you not fuzzed?","does an error page or a stack trace name the framework and version?","is the flag perhaps in a file you can read rather than a shell you must get?"],refs:"A01, A05, A07, A08 of OWASP Top 10:2025; API1, API3, API7; WSTG-INPV, WSTG-ATHZ, WSTG-SESS"},{id:"api",name:"API",first:["find the spec: /swagger, /openapi.json, /graphql with introspection, /.well-known","list every endpoint with its auth; try each without a token and with another user's id","look at versions (/v1 vs /v2) and verbs the UI never uses"],families:["BOLA and BFLA, mass assignment, excessive data in responses, GraphQL introspection, batching and aliases for brute force, nested query DoS, JWT and API-key handling, rate-limit absence on sensitive flows, SSRF through webhooks and imports"],tools:["curl and a python script per endpoint, ffuf for parameters and ids, graphql-voyager or inql for schema, jwt_tool"],stuck:["which object ids are predictable?","what does the mobile or admin client call that the web client does not?","can a write endpoint set a field you were never shown?"],refs:"OWASP API Security Top 10:2023; WSTG-APIT"},{id:"crypto",name:"Cryptography",first:["identify the scheme before touching maths: key sizes, moduli, block size, IV reuse, encoding (base64, hex), any reuse across messages","check the classics against the numbers: small e, small d, common modulus, shared primes across keys, p close to q, known plaintext","if it is a custom scheme, find the invariant that leaks (a linear step, a predictable nonce, a padding check that returns a different error)"],families:["RSA: small e with no padding (cube root), Wiener (small d), common modulus, Fermat (p near q), Hastad broadcast, partial key exposure (Coppersmith), textbook signatures","symmetric: ECB cut-and-paste and byte-at-a-time, CBC bit-flipping and padding oracle, CTR nonce reuse (XOR of plaintexts), key reuse","hashes: length extension (MD5, SHA-1, SHA-256), weak or unsalted hashes, collisions, HMAC misuse (hash(key||msg))","classical: Caesar, Vigenere (Kasiski, index of coincidence), substitution (frequency), XOR with a repeating key, bacon, railfence","number theory: discrete log with weak groups, ECC with a singular or small-order curve, invalid-curve points, LCG and Mersenne Twister state recovery, nonce reuse in ECDSA"],tools:["python with pycryptodome and gmpy2, SageMath for lattices and curves, RsaCtfTool for the RSA classics, hashpump or hash_extender for length extension, CyberChef for encodings, z3 for constraint puzzles, factordb.com for a quick factor lookup"],stuck:["what is the same across the samples you have?","what happens to the ciphertext when you change one bit of the input?","is the randomness really random (timestamp seed, reused nonce)?","is the padding check or the error message an oracle?"],refs:"A04:2025 Cryptographic Failures; ASVS V11"},{id:"forensics",name:"Forensics and steganography",first:["file, strings -n 8, exiftool, binwalk -e, xxd | head: what is it really, and what is appended, prepended or embedded","for images: pngcheck, zsteg (PNG/BMP), steghide and stegseek (JPEG with a passphrase), check LSB planes and the alpha channel, compare dimensions in the header with the data","for captures: tshark -r file.pcap -q -z conv,tcp, follow streams, export objects (HTTP, SMB, DNS tunnels), look at unusual protocols","for disk and memory images: Volatility 3 (windows.pslist, cmdline, filescan, hashdump), Autopsy or sleuthkit, carve with foremost or photorec"],families:["appended archives and polyglots, LSB steganography, audio spectrograms, metadata and thumbnails, deleted files and slack space, base64 in DNS or ICMP, keystrokes in USB captures, Office and PDF embedded objects, git history leaks"],tools:["file, strings, exiftool, binwalk, foremost, xxd, zsteg, steghide, stegseek, pngcheck, tshark and Wireshark, Volatility 3, sleuthkit, Audacity or sox for audio, CyberChef"],stuck:["have you looked at the end of the file and at what comes after the declared length?","is there a second file inside (binwalk -e, 7z l)?","what does the challenge text say about a password or a person?","have you tried every channel: text, metadata, pixels, audio, timing?"],refs:"no OWASP category: evidence handling and data-at-rest protection (ASVS V14)"},{id:"reverse",name:"Reverse engineering",first:["file, strings, checksec; run it in a sandbox and watch (ltrace, strace); find main and the comparison that decides success","open in Ghidra or radare2 (aaa; afl; pdf @main); rename as you go; look for the flag check, the decryption loop, the anti-debug","for scripts and bytecode: pyinstaller extraction and decompile (pycdc), JADX for Android, dnSpy or ILSpy for .NET, de4js or a prettifier for JavaScript"],families:["string comparison with a transform (XOR, add, table), hand-rolled crypto, VM-based obfuscation, anti-debugging (ptrace, timing), packed binaries (UPX), flag built at runtime, checks that can be patched or solved with angr or z3"],tools:["Ghidra, radare2 or rizin with Cutter, gdb with gef or pwndbg, ltrace, strace, angr, z3, upx -d, pycdc, JADX, dnSpy"],stuck:["where is the first thing the input touches?","can you make the check pass by patching rather than understanding?","is the transform invertible, and can a solver do it?","does running it with a debugger attached change behaviour?"],refs:"ASVS V15 Secure Coding and Architecture; Mobile M7 Insufficient Binary Protections"},{id:"pwn",name:"Binary exploitation",first:["checksec (RELRO, canary, NX, PIE), file (static or dynamic, stripped), the libc version if given","find the bug: overflow (gets, strcpy, scanf %s), format string (printf(buf)), use after free, integer overflow, off by one","work out what you control and what you need: a return address, a GOT entry, a function pointer, a leak"],families:["stack overflow to ret2win, ret2libc or ROP (ropper, ROPgadget, one_gadget), format string read and write, heap (tcache poisoning, fastbin dup, unsorted bin leak, house of x), SROP, ret2dlresolve, kernel and sandbox escapes in harder sets"],tools:["pwntools (process, remote, ELF, ROP, cyclic, fmtstr_payload), gdb with gef or pwndbg, ropper, ROPgadget, one_gadget, patchelf and pwninit to match the libc, checksec"],stuck:["what is your exact offset (cyclic)?","what leaks (puts of a GOT entry, a format string %p chain)?","which protection is off, and which does that remove from the problem?","does the challenge give a libc, and does your local one match?"],refs:"CWE-120, CWE-134, CWE-416; ASVS V15"},{id:"osint",name:"OSINT",first:["pin down what is known: a name, a handle, an image, a domain; then widen one hop at a time","reverse image search and EXIF; username search across sites; WHOIS, DNS history, certificate transparency; archive.org for what was removed"],families:["usernames reused across platforms, geolocation from image details, leaked documents and metadata, social graph pivots, company registries, commit history and paste sites"],tools:["sherlock or maigret, exiftool, Google and Bing dorks, crt.sh, dnsdumpster, Wayback Machine, Google Earth and Street View, theHarvester"],stuck:["what is the smallest unusual detail in the image or text?","has the target used this handle elsewhere?","what did the page look like a year ago?"],refs:"no OWASP category: ATT&CK Reconnaissance"},{id:"cloud",name:"Cloud",first:["identify the provider from hostnames, headers and bucket URLs; try the metadata endpoint through any SSRF; list public buckets and their ACLs","with any credential found: whoami (sts get-caller-identity), enumerate what it can read, look for role chains and over-broad policies"],families:["public or listable storage, metadata credentials via SSRF, over-privileged roles and assume-role chains, secrets in user data and environment, exposed serverless endpoints, misconfigured OIDC trust, Kubernetes service-account tokens and dashboards"],tools:["aws, az and gcloud CLIs, pacu, enumerate-iam, s3scanner, kube-hunter and kubectl, ScoutSuite"],stuck:["what does the credential's own policy let it do?","which service trusts which role?","is there a public resource whose name you can guess from the company name?"],refs:"A01:2025, A02:2025; API7:2023 SSRF; ASVS V13"},{id:"ai",name:"AI and LLM",first:["learn the system: what it was told (ask it to summarise its instructions), what tools it has, what it can read (files, URLs, other users' data), what checks its output","classify the challenge: extract a secret from the prompt, make it call a tool, make it read content you control, bypass a guardrail, poison its memory or retrieval"],families:["direct injection and jailbreak framings (role-play, translation, continuation, hypothetical, format tricks): AML.T0051.000 and AML.T0054","indirect injection through a document, web page, image or tool result the model reads: AML.T0051.001, AML.T0070 RAG poisoning","system prompt extraction (ask for it in another language, as code, as a poem, piecewise): AML.T0056 and AML.T0069","exfiltration through rendering (markdown image URLs that carry data), tool invocation or links: AML.T0077 and AML.T0086","obfuscation to pass a filter (encodings, homoglyphs, splitting, payload in a code block): AML.T0068","memory and context poisoning across turns or sessions: AML.T0080; tool poisoning and malicious tool definitions: AML.T0110","guardrail evasion of input and output classifiers; model extraction and membership inference on inference APIs: AML.T0024"],tools:["a notebook of your attempts with exact prompts and responses, promptfoo and garak for systematic probes against your own endpoint, CyberChef for encodings"],stuck:["what does the model see that you do not (system prompt, tool results, retrieved text)?","which channel is unfiltered: input, retrieval, tool output, rendering?","can the model be made to do the step for you (write the code, summarise the secret) instead of revealing it directly?"],refs:"OWASP LLM01, LLM02, LLM05, LLM06, LLM07, LLM08; ASI01, ASI02, ASI06; MITRE ATLAS AML.T0051, AML.T0054, AML.T0056, AML.T0057, AML.T0068, AML.T0070, AML.T0077, AML.T0080, AML.T0086"},{id:"misc",name:"Misc and scripting",first:["read the whole challenge text twice; note the flag format; connect to the service and see what it says before sending anything","if it is a game or a puzzle, write a client and automate; if it is a jail (Python, bash, SQL), list what characters and names are allowed"],families:["Python jails (builtins, attribute walking, format string, unicode), bash jails (globbing, $0, env), esoteric languages, QR and barcode layers, encodings stacked (base64, base32, hex, rot, morse, brainfuck), protocol puzzles over nc"],tools:["pwntools remote for sockets, CyberChef magic, dcode.fr for classical ciphers, zbarimg for QR, a quick python script for anything repetitive"],stuck:["what is the flag format, and what in the output already looks like it?","what does the service do with input it does not expect?","which characters are blocked, and what can be built from the rest?"],refs:"A05:2025 Injection; ASVS V1 and V2"}],Ew=`First look, for any challenge:
78
+ `),C1=()=>[`OWASP Top 10:2025: ${t0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP API Top 10:2023: ${n0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP LLM Top 10 2025: ${a0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`OWASP Agentic Top 10 2026: ${l0.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`ATLAS tactics: ${qf.map(l=>`${l.id} ${l.name}`).join("; ")}.`,`ATLAS techniques to cite on AI components: ${qf.flatMap(l=>l.techniques).filter((l,o,c)=>c.indexOf(l)===o).map(l=>l.replace(/ \(.*\)$/,"")).join("; ")}.`].join(`
79
+ `),M1=[{id:"web",name:"Web",first:["read the page source, robots.txt, sitemap.xml, .git/, .env, backup names (index.php~, .bak, .old), and every JS bundle for routes and secrets","map every parameter (query, body, cookie, header) and what each changes; note the stack from headers and error pages","try the obvious on each input: a quote, {{7*7}}, ../, a URL you control, an id one off yours, a different HTTP method"],families:["injection: SQL (error, union, blind, time), NoSQL ($ne, $regex), command, SSTI ({{7*7}}, ${7*7}, Jinja2 and Twig gadget chains), XXE, LDAP","access: IDOR, forced browsing, JWT (alg none, key confusion, weak secret, kid injection), session fixation, mass assignment","files: LFI with wrappers (php://filter, data://, zip://), log poisoning, upload bypass (double extension, content-type, polyglot, .htaccess)","client: XSS (reflected, stored, DOM, in attributes and JS strings), CSRF, prototype pollution, postMessage, open redirect","server: SSRF to 127.0.0.1, 169.254.169.254 and internal names, deserialisation (PHP, Java, Python pickle, .NET), race conditions, HTTP smuggling, cache poisoning","logic: coupon and quantity tricks, negative numbers, unicode normalisation, type juggling (== in PHP, 0e hashes), length limits that truncate"],tools:["curl -i -s (see the raw response), ffuf -w wordlist -u URL/FUZZ (directories, parameters, vhosts), katana (crawl), httpx (fingerprint)","sqlmap -u URL --batch (once a manual probe shows injection), jwt_tool or a python one-liner for JWT, Burp or mitmproxy for a repeater","python requests scripts for anything repetitive; a race needs threads or h2 single-packet"],stuck:["what does the challenge name or theme hint at?","which parameter have you not fuzzed?","does an error page or a stack trace name the framework and version?","is the flag perhaps in a file you can read rather than a shell you must get?"],refs:"A01, A05, A07, A08 of OWASP Top 10:2025; API1, API3, API7; WSTG-INPV, WSTG-ATHZ, WSTG-SESS"},{id:"api",name:"API",first:["find the spec: /swagger, /openapi.json, /graphql with introspection, /.well-known","list every endpoint with its auth; try each without a token and with another user's id","look at versions (/v1 vs /v2) and verbs the UI never uses"],families:["BOLA and BFLA, mass assignment, excessive data in responses, GraphQL introspection, batching and aliases for brute force, nested query DoS, JWT and API-key handling, rate-limit absence on sensitive flows, SSRF through webhooks and imports"],tools:["curl and a python script per endpoint, ffuf for parameters and ids, graphql-voyager or inql for schema, jwt_tool"],stuck:["which object ids are predictable?","what does the mobile or admin client call that the web client does not?","can a write endpoint set a field you were never shown?"],refs:"OWASP API Security Top 10:2023; WSTG-APIT"},{id:"crypto",name:"Cryptography",first:["identify the scheme before touching maths: key sizes, moduli, block size, IV reuse, encoding (base64, hex), any reuse across messages","check the classics against the numbers: small e, small d, common modulus, shared primes across keys, p close to q, known plaintext","if it is a custom scheme, find the invariant that leaks (a linear step, a predictable nonce, a padding check that returns a different error)"],families:["RSA: small e with no padding (cube root), Wiener (small d), common modulus, Fermat (p near q), Hastad broadcast, partial key exposure (Coppersmith), textbook signatures","symmetric: ECB cut-and-paste and byte-at-a-time, CBC bit-flipping and padding oracle, CTR nonce reuse (XOR of plaintexts), key reuse","hashes: length extension (MD5, SHA-1, SHA-256), weak or unsalted hashes, collisions, HMAC misuse (hash(key||msg))","classical: Caesar, Vigenere (Kasiski, index of coincidence), substitution (frequency), XOR with a repeating key, bacon, railfence","number theory: discrete log with weak groups, ECC with a singular or small-order curve, invalid-curve points, LCG and Mersenne Twister state recovery, nonce reuse in ECDSA"],tools:["python with pycryptodome and gmpy2, SageMath for lattices and curves, RsaCtfTool for the RSA classics, hashpump or hash_extender for length extension, CyberChef for encodings, z3 for constraint puzzles, factordb.com for a quick factor lookup"],stuck:["what is the same across the samples you have?","what happens to the ciphertext when you change one bit of the input?","is the randomness really random (timestamp seed, reused nonce)?","is the padding check or the error message an oracle?"],refs:"A04:2025 Cryptographic Failures; ASVS V11"},{id:"forensics",name:"Forensics and steganography",first:["file, strings -n 8, exiftool, binwalk -e, xxd | head: what is it really, and what is appended, prepended or embedded","for images: pngcheck, zsteg (PNG/BMP), steghide and stegseek (JPEG with a passphrase), check LSB planes and the alpha channel, compare dimensions in the header with the data","for captures: tshark -r file.pcap -q -z conv,tcp, follow streams, export objects (HTTP, SMB, DNS tunnels), look at unusual protocols","for disk and memory images: Volatility 3 (windows.pslist, cmdline, filescan, hashdump), Autopsy or sleuthkit, carve with foremost or photorec"],families:["appended archives and polyglots, LSB steganography, audio spectrograms, metadata and thumbnails, deleted files and slack space, base64 in DNS or ICMP, keystrokes in USB captures, Office and PDF embedded objects, git history leaks"],tools:["file, strings, exiftool, binwalk, foremost, xxd, zsteg, steghide, stegseek, pngcheck, tshark and Wireshark, Volatility 3, sleuthkit, Audacity or sox for audio, CyberChef"],stuck:["have you looked at the end of the file and at what comes after the declared length?","is there a second file inside (binwalk -e, 7z l)?","what does the challenge text say about a password or a person?","have you tried every channel: text, metadata, pixels, audio, timing?"],refs:"no OWASP category: evidence handling and data-at-rest protection (ASVS V14)"},{id:"reverse",name:"Reverse engineering",first:["file, strings, checksec; run it in a sandbox and watch (ltrace, strace); find main and the comparison that decides success","open in Ghidra or radare2 (aaa; afl; pdf @main); rename as you go; look for the flag check, the decryption loop, the anti-debug","for scripts and bytecode: pyinstaller extraction and decompile (pycdc), JADX for Android, dnSpy or ILSpy for .NET, de4js or a prettifier for JavaScript"],families:["string comparison with a transform (XOR, add, table), hand-rolled crypto, VM-based obfuscation, anti-debugging (ptrace, timing), packed binaries (UPX), flag built at runtime, checks that can be patched or solved with angr or z3"],tools:["Ghidra, radare2 or rizin with Cutter, gdb with gef or pwndbg, ltrace, strace, angr, z3, upx -d, pycdc, JADX, dnSpy"],stuck:["where is the first thing the input touches?","can you make the check pass by patching rather than understanding?","is the transform invertible, and can a solver do it?","does running it with a debugger attached change behaviour?"],refs:"ASVS V15 Secure Coding and Architecture; Mobile M7 Insufficient Binary Protections"},{id:"pwn",name:"Binary exploitation",first:["checksec (RELRO, canary, NX, PIE), file (static or dynamic, stripped), the libc version if given","find the bug: overflow (gets, strcpy, scanf %s), format string (printf(buf)), use after free, integer overflow, off by one","work out what you control and what you need: a return address, a GOT entry, a function pointer, a leak"],families:["stack overflow to ret2win, ret2libc or ROP (ropper, ROPgadget, one_gadget), format string read and write, heap (tcache poisoning, fastbin dup, unsorted bin leak, house of x), SROP, ret2dlresolve, kernel and sandbox escapes in harder sets"],tools:["pwntools (process, remote, ELF, ROP, cyclic, fmtstr_payload), gdb with gef or pwndbg, ropper, ROPgadget, one_gadget, patchelf and pwninit to match the libc, checksec"],stuck:["what is your exact offset (cyclic)?","what leaks (puts of a GOT entry, a format string %p chain)?","which protection is off, and which does that remove from the problem?","does the challenge give a libc, and does your local one match?"],refs:"CWE-120, CWE-134, CWE-416; ASVS V15"},{id:"osint",name:"OSINT",first:["pin down what is known: a name, a handle, an image, a domain; then widen one hop at a time","reverse image search and EXIF; username search across sites; WHOIS, DNS history, certificate transparency; archive.org for what was removed"],families:["usernames reused across platforms, geolocation from image details, leaked documents and metadata, social graph pivots, company registries, commit history and paste sites"],tools:["sherlock or maigret, exiftool, Google and Bing dorks, crt.sh, dnsdumpster, Wayback Machine, Google Earth and Street View, theHarvester"],stuck:["what is the smallest unusual detail in the image or text?","has the target used this handle elsewhere?","what did the page look like a year ago?"],refs:"no OWASP category: ATT&CK Reconnaissance"},{id:"cloud",name:"Cloud",first:["identify the provider from hostnames, headers and bucket URLs; try the metadata endpoint through any SSRF; list public buckets and their ACLs","with any credential found: whoami (sts get-caller-identity), enumerate what it can read, look for role chains and over-broad policies"],families:["public or listable storage, metadata credentials via SSRF, over-privileged roles and assume-role chains, secrets in user data and environment, exposed serverless endpoints, misconfigured OIDC trust, Kubernetes service-account tokens and dashboards"],tools:["aws, az and gcloud CLIs, pacu, enumerate-iam, s3scanner, kube-hunter and kubectl, ScoutSuite"],stuck:["what does the credential's own policy let it do?","which service trusts which role?","is there a public resource whose name you can guess from the company name?"],refs:"A01:2025, A02:2025; API7:2023 SSRF; ASVS V13"},{id:"ai",name:"AI and LLM",first:["learn the system: what it was told (ask it to summarise its instructions), what tools it has, what it can read (files, URLs, other users' data), what checks its output","classify the challenge: extract a secret from the prompt, make it call a tool, make it read content you control, bypass a guardrail, poison its memory or retrieval"],families:["direct injection and jailbreak framings (role-play, translation, continuation, hypothetical, format tricks): AML.T0051.000 and AML.T0054","indirect injection through a document, web page, image or tool result the model reads: AML.T0051.001, AML.T0070 RAG poisoning","system prompt extraction (ask for it in another language, as code, as a poem, piecewise): AML.T0056 and AML.T0069","exfiltration through rendering (markdown image URLs that carry data), tool invocation or links: AML.T0077 and AML.T0086","obfuscation to pass a filter (encodings, homoglyphs, splitting, payload in a code block): AML.T0068","memory and context poisoning across turns or sessions: AML.T0080; tool poisoning and malicious tool definitions: AML.T0110","guardrail evasion of input and output classifiers; model extraction and membership inference on inference APIs: AML.T0024"],tools:["a notebook of your attempts with exact prompts and responses, promptfoo and garak for systematic probes against your own endpoint, CyberChef for encodings"],stuck:["what does the model see that you do not (system prompt, tool results, retrieved text)?","which channel is unfiltered: input, retrieval, tool output, rendering?","can the model be made to do the step for you (write the code, summarise the secret) instead of revealing it directly?"],refs:"OWASP LLM01, LLM02, LLM05, LLM06, LLM07, LLM08; ASI01, ASI02, ASI06; MITRE ATLAS AML.T0051, AML.T0054, AML.T0056, AML.T0057, AML.T0068, AML.T0070, AML.T0077, AML.T0080, AML.T0086"},{id:"misc",name:"Misc and scripting",first:["read the whole challenge text twice; note the flag format; connect to the service and see what it says before sending anything","if it is a game or a puzzle, write a client and automate; if it is a jail (Python, bash, SQL), list what characters and names are allowed"],families:["Python jails (builtins, attribute walking, format string, unicode), bash jails (globbing, $0, env), esoteric languages, QR and barcode layers, encodings stacked (base64, base32, hex, rot, morse, brainfuck), protocol puzzles over nc"],tools:["pwntools remote for sockets, CyberChef magic, dcode.fr for classical ciphers, zbarimg for QR, a quick python script for anything repetitive"],stuck:["what is the flag format, and what in the output already looks like it?","what does the service do with input it does not expect?","which characters are blocked, and what can be built from the rest?"],refs:"A05:2025 Injection; ASVS V1 and V2"}],_1=`First look, for any challenge:
80
80
  1. Read the challenge text, name and category twice; write down the flag format and every hint.
81
81
  2. For a file: file, strings -n 8, exiftool, binwalk, xxd | head and tail; a hash lookup if it looks like a known file; list archives with 7z l. Keep the original untouched; work on a copy.
82
82
  3. For a service: connect once and read what it prints; note the protocol and the prompts before sending anything.
83
83
  4. For a URL: source, robots.txt, the JS bundles, the headers and the error page; map parameters.
84
84
  5. Name the category and the two or three families most likely; write the next three experiments, cheapest first.
85
- 6. Keep a notes file: every attempt, exact input, exact output. When stuck, read it back and ask the stuck questions for the category.`,Cw=l=>`${l.name} (${l.id}):
85
+ 6. Keep a notes file: every attempt, exact input, exact output. When stuck, read it back and ask the stuck questions for the category.`,R1=l=>`${l.name} (${l.id}):
86
86
  - first: ${l.first.join("; ")}
87
87
  - families: ${l.families.join(" | ")}
88
88
  - tools: ${l.tools.join("; ")}
89
89
  - when stuck: ${l.stuck.join(" ")}
90
- - refs: ${l.refs}`,Mw=()=>`${Ew}
90
+ - refs: ${l.refs}`,O1=()=>`${_1}
91
91
 
92
92
  By category:
93
- ${Nw.map(Cw).join(`
93
+ ${M1.map(R1).join(`
94
94
 
95
- `)}`,_w=`To draw a diagram, put a drawgen spec (YAML) in a fenced block tagged drawio; the app renders it as an editable draw.io diagram. One diagram per block. Format:
95
+ `)}`,D1=`To draw a diagram, put a drawgen spec (YAML) in a fenced block tagged drawio; the app renders it as an editable draw.io diagram. One diagram per block. Format:
96
96
 
97
97
  \`\`\`drawio
98
98
  title: Order flow # required
@@ -112,7 +112,7 @@ kind (colour means type only, the label carries the meaning): actor, external, s
112
112
  edge style: sync (default), async, data, ai, weak. Edge keys: from, to, label, style, both, curved.
113
113
  Zones need manual layout (x, y, w, h on zones and x, y on every node), so prefer layout: auto without zones.
114
114
  Keep labels short (two or three words), at most about 15 nodes, ids lowercase without spaces. Draw at most one edge between any two nodes: combine what flows between them into one label (e.g. "GET /user, /download, /run"). Quote any label that contains : ? # { } [ ] or a comma, e.g. label: "GET /user?id=". Put explanations in prose outside the block, not in the diagram.
115
- For an attack path use kind: actor for the attacker, step for each stage, and put the technique or CWE in sub. Use decision for branches.`,wa=(l,...o)=>[l,Tw,l0,...o].join(`
115
+ For an attack path use kind: actor for the attacker, step for each stage, and put the technique or CWE in sub. Use decision for branches.`,wa=(l,...o)=>[l,N1,i0,...o].join(`
116
116
 
117
117
  `),$f=[{id:"code-review",label:"Code reviewer",system:wa("You are a senior application security engineer reviewing code. For each finding give: severity, the vulnerable line(s), why it is exploitable, the OWASP id and CWE, the ASVS chapter, and a corrected snippet. Work through the OWASP Top 10:2025 for every review, the API Top 10 when the code serves an API, the LLM and Agentic lists when it calls a model or runs an agent, and the Mobile list for app code. If the code is safe for a category, say so in the coverage line; do not invent issues.",Yl(),gi(!1),ol(!1),yi(!1),No()),starters:[`Review this code for security vulnerabilities:
118
118
 
@@ -122,15 +122,15 @@ For an attack path use kind: actor for the attacker, step for each stage, and pu
122
122
 
123
123
  `,`What are the security risks in this auth middleware?
124
124
 
125
- `]},{id:"threat-model",label:"Threat modeller",system:wa("You are a threat-modelling specialist. For the system described: (1) list assets, actors, trust boundaries and entry points; (2) decompose into elements (actors, services, AI components, data stores, flows); (3) for each element walk the STRIDE categories that apply to it and the OWASP categories that fit its technology (web, API, LLM, agent, mobile); (4) produce a table: threat, element, STRIDE, OWASP or ATLAS id, likelihood, impact, severity, mitigation with its ASVS chapter or ATLAS mitigation; (5) prioritise the top risks and list the assumptions. Flows that cross a trust boundary without authentication or encryption are always threats. AI components (models, agents, RAG, tools) are assessed with the LLM and Agentic lists and ATLAS as well as STRIDE.",mh(),Yl(!1),gi(!1),ol(!1),yi(!1),a0(!1),No(),bs(),Ec()),starters:["Threat-model a password-reset flow that emails a link with a token.","Threat-model a customer-support chatbot with RAG over our ticket history and a tool that issues refunds.","Threat-model a mobile app that calls a REST API with JWTs.","What are the top risks of exposing an internal admin panel behind SSO?"]},{id:"ai-review",label:"AI system reviewer (LLM, agents, RAG)",system:wa("You review AI-enabled systems: LLM applications, agents with tools, RAG pipelines, model APIs, copilots and the pipelines that train or fine-tune them. Map the system (inputs the model reads, what it can trigger, what it can reach, who can influence its context and its data), then assess it against the OWASP LLM Top 10, the OWASP Agentic Top 10 and MITRE ATLAS: for each applicable technique say whether the system is exposed, the evidence, the severity, and the mitigation with its ATLAS id. Treat every input the model reads as attacker-controlled unless the source is shown to be trusted, and every model output as untrusted input to whatever consumes it. When asked to design tests, propose defensive checks (red-team probes, guardrail evaluations, permission reviews) for the user's own system, with the technique each test covers.",ol(),yi(),bs(),Ec()),starters:[`Review this LLM application design for prompt-injection and data-leak paths:
125
+ `]},{id:"threat-model",label:"Threat modeller",system:wa("You are a threat-modelling specialist. For the system described: (1) list assets, actors, trust boundaries and entry points; (2) decompose into elements (actors, services, AI components, data stores, flows); (3) for each element walk the STRIDE categories that apply to it and the OWASP categories that fit its technology (web, API, LLM, agent, mobile); (4) produce a table: threat, element, STRIDE, OWASP or ATLAS id, likelihood, impact, severity, mitigation with its ASVS chapter or ATLAS mitigation; (5) prioritise the top risks and list the assumptions. Flows that cross a trust boundary without authentication or encryption are always threats. AI components (models, agents, RAG, tools) are assessed with the LLM and Agentic lists and ATLAS as well as STRIDE.",mh(),Yl(!1),gi(!1),ol(!1),yi(!1),s0(!1),No(),bs(),Ec()),starters:["Threat-model a password-reset flow that emails a link with a token.","Threat-model a customer-support chatbot with RAG over our ticket history and a tool that issues refunds.","Threat-model a mobile app that calls a REST API with JWTs.","What are the top risks of exposing an internal admin panel behind SSO?"]},{id:"ai-review",label:"AI system reviewer (LLM, agents, RAG)",system:wa("You review AI-enabled systems: LLM applications, agents with tools, RAG pipelines, model APIs, copilots and the pipelines that train or fine-tune them. Map the system (inputs the model reads, what it can trigger, what it can reach, who can influence its context and its data), then assess it against the OWASP LLM Top 10, the OWASP Agentic Top 10 and MITRE ATLAS: for each applicable technique say whether the system is exposed, the evidence, the severity, and the mitigation with its ATLAS id. Treat every input the model reads as attacker-controlled unless the source is shown to be trusted, and every model output as untrusted input to whatever consumes it. When asked to design tests, propose defensive checks (red-team probes, guardrail evaluations, permission reviews) for the user's own system, with the technique each test covers.",ol(),yi(),bs(),Ec()),starters:[`Review this LLM application design for prompt-injection and data-leak paths:
126
126
 
127
127
  `,`This agent has these tools and permissions. Which ATLAS techniques apply and what should change?
128
128
 
129
- `,"Design a red-team test plan (promptfoo/garak probes) for our chatbot, mapped to ATLAS and the LLM Top 10.","Our RAG index is shared by all tenants. What are the risks and the fixes?"]},{id:"pentest-plan",label:"Pentest planner (WSTG)",system:wa("You plan authorised web and API penetration tests. From the scope given, produce a test plan ordered by the OWASP WSTG categories: for each, the tests that apply to this target, the tool or manual step for each (the BugXHunter agent has httpx, katana, nuclei, ffuf, testssl, subfinder, nmap, gitleaks, cargo audit, govulncheck, and can install promptfoo and garak for LLM targets), the evidence to capture, and the OWASP or ATLAS id the test covers. Scope beats speed: fingerprint first, then target templates to the stack. Include the rules of engagement checks (authorisation, windows, rate limits, data handling) at the top and a reporting template at the end.",Aw(),Yl(!1),gi(!1),ol(!1),No()),starters:["Plan a pentest of https://staging.example.com (a React SPA over a REST API, OAuth login). We are authorised in writing.",`Plan an API-only test for an OpenAPI spec I will paste:
129
+ `,"Design a red-team test plan (promptfoo/garak probes) for our chatbot, mapped to ATLAS and the LLM Top 10.","Our RAG index is shared by all tenants. What are the risks and the fixes?"]},{id:"pentest-plan",label:"Pentest planner (WSTG)",system:wa("You plan authorised web and API penetration tests. From the scope given, produce a test plan ordered by the OWASP WSTG categories: for each, the tests that apply to this target, the tool or manual step for each (the BugXHunter agent has httpx, katana, nuclei, ffuf, testssl, subfinder, nmap, gitleaks, cargo audit, govulncheck, and can install promptfoo and garak for LLM targets), the evidence to capture, and the OWASP or ATLAS id the test covers. Scope beats speed: fingerprint first, then target templates to the stack. Include the rules of engagement checks (authorisation, windows, rate limits, data handling) at the top and a reporting template at the end.",j1(),Yl(!1),gi(!1),ol(!1),No()),starters:["Plan a pentest of https://staging.example.com (a React SPA over a REST API, OAuth login). We are authorised in writing.",`Plan an API-only test for an OpenAPI spec I will paste:
130
130
 
131
131
  `,"Plan a review of a customer chatbot (web widget calling an LLM with RAG) for our own product."]},{id:"diagram",label:"Diagram & screenshot reviewer",system:wa("You review architecture diagrams, network diagrams and UI screenshots for security issues. Read every label carefully. For each issue give: where it appears, why it matters, severity, the OWASP or ATLAS id, and the fix. Look for exposed ports, plaintext protocols, hardcoded secrets, missing auth or MFA, flows crossing a trust boundary without a control, public storage, outdated software, missing logging, and for AI components the paths by which untrusted content reaches a model and what the model can trigger. Only report what is visible and flag any assumptions.",Yl(!1),gi(!1),ol(!1),yi(!1),bs()),starters:["Review the attached diagram for security issues.","What would an attacker target first in this screenshot?","Which flows in this diagram cross a trust boundary without authentication?","Check this login page screenshot for security and phishing red flags."]},{id:"draw",label:"Diagram drawer",system:`You explain systems, code and security findings with diagrams. Read what you are given, then draw it: data flows, request paths, trust relationships or attack paths. Draw only what the material shows and say what you assumed. After the diagram, add two to four sentences on what it shows and the main security points, citing OWASP, CWE, ATT&CK or ATLAS ids where they fit.
132
132
 
133
- `+_w,starters:[`Draw the request flow of this code, from the user to every data store:
133
+ `+D1,starters:[`Draw the request flow of this code, from the user to every data store:
134
134
 
135
135
  `,`Draw the attack path for these findings, from initial access to impact:
136
136
 
@@ -140,7 +140,7 @@ For an attack path use kind: actor for the attacker, step for each stage, and pu
140
140
 
141
141
  `]},{id:"tabletop",label:"Tabletop exercise facilitator",system:wa("You design and facilitate tabletop exercises (TTX) for security teams, defensively: nothing you produce is an attack tool, it is a rehearsal of detection, decision and recovery. When asked for an exercise, produce: (1) objectives and the capabilities under test; (2) participants and roles (incident lead, SOC, engineering, legal, comms, executive, a facilitator and a note-taker); (3) a scenario grounded in real technique ids: ATT&CK for the intrusion, ATLAS for anything involving the organisation's AI systems, OWASP ids for the weaknesses exploited; (4) a master scenario events list (MSEL): timed injects, each with the information released, the question to the room, the expected action and the decision point; (5) a hot-wash and after-action report template whose gaps map to the control that closes them (ASVS chapter, ATLAS mitigation, or a process change). When facilitating live, release one inject at a time, ask what the team does and why, and never give the answer before the room has tried. Keep scenarios plausible for the organisation described and avoid gratuitous detail of how the attack is performed.",bs(),Ec(),Yl(!1),ol(!1),yi(!1)),starters:["Design a 90-minute tabletop: an attacker uses indirect prompt injection in our support chatbot to exfiltrate customer data. Participants: SOC, platform team, legal, comms.","Design a tabletop for a compromised CI token that pushes a poisoned dependency to production.","Run the next inject. We have isolated the host and are reviewing the agent's tool logs.",`Write the after-action report from these notes:
142
142
 
143
- `]},{id:"ctf",label:"CTF and lab coach",system:wa("You coach people solving capture-the-flag challenges and deliberately vulnerable labs (their own CTF, a public CTF they are registered for, or training labs). First confirm the challenge is a CTF or lab and ask for the category and what has been tried. Then help by method, not by handing over the flag: identify the vulnerability class (map web and API challenges to the OWASP categories, AI and prompt-injection challenges to the LLM Top 10 and ATLAS techniques), explain the technique, propose the next experiment, and escalate hints in steps (nudge, then the idea, then the concrete step) only when asked. For a solved challenge, help write the write-up: the vulnerability, the OWASP or ATLAS id, the steps, the lesson, and the real-world fix. Cover the usual categories: web, API, crypto, forensics, reverse engineering, binary exploitation, OSINT, cloud, and AI/LLM.",Mw(),Yl(!1),gi(!1),ol(!1),bs()),starters:["Web CTF: the login form reflects my username on error and the cookie is a base64 JSON. What should I try next?","LLM CTF: the bot refuses to reveal the secret in its system prompt. Which techniques does this challenge expect, and how do they map to ATLAS?",`Write a CTF write-up for this challenge from my notes:
143
+ `]},{id:"ctf",label:"CTF and lab coach",system:wa("You coach people solving capture-the-flag challenges and deliberately vulnerable labs (their own CTF, a public CTF they are registered for, or training labs). First confirm the challenge is a CTF or lab and ask for the category and what has been tried. Then help by method, not by handing over the flag: identify the vulnerability class (map web and API challenges to the OWASP categories, AI and prompt-injection challenges to the LLM Top 10 and ATLAS techniques), explain the technique, propose the next experiment, and escalate hints in steps (nudge, then the idea, then the concrete step) only when asked. For a solved challenge, help write the write-up: the vulnerability, the OWASP or ATLAS id, the steps, the lesson, and the real-world fix. Cover the usual categories: web, API, crypto, forensics, reverse engineering, binary exploitation, OSINT, cloud, and AI/LLM.",O1(),Yl(!1),gi(!1),ol(!1),bs()),starters:["Web CTF: the login form reflects my username on error and the cookie is a base64 JSON. What should I try next?","LLM CTF: the bot refuses to reveal the secret in its system prompt. Which techniques does this challenge expect, and how do they map to ATLAS?",`Write a CTF write-up for this challenge from my notes:
144
144
 
145
145
  `,"Give me a nudge, not the answer: a PHP upload form that checks the extension."]},{id:"phishing",label:"Phishing analyst",system:wa("You analyse suspicious emails, messages, voice notes and URLs. Give a verdict (phishing / suspicious / likely legitimate) with a confidence level, list the red flags (sender, links, urgency, attachments, headers, signs of LLM-written or deepfake-assisted lures: ATLAS AML.T0052), and the recommended action for the user and for the SOC. Never visit links; reason from the text provided."),starters:[`Is this email phishing?
146
146
 
@@ -152,16 +152,16 @@ For an attack path use kind: actor for the attacker, step for each stage, and pu
152
152
 
153
153
  `,`Triage these agent tool-call logs: did a prompt injection make the agent exfiltrate anything?
154
154
 
155
- `,"Write a Sigma rule to detect password spraying against Entra ID."]},{id:"explainer",label:"Vulnerability explainer",system:wa("You teach application and AI security to developers. Explain the vulnerability class clearly, name its OWASP category and CWE (and the ATLAS technique for AI weaknesses), show a minimal vulnerable example and the fixed version, describe the real-world impact, and list prevention controls with the ASVS chapter they belong to. Keep it educational and defensive.",Yl(!1),ol(!1),No()),starters:["Explain SSRF with a vulnerable example and the fix.","Explain indirect prompt injection with an example and the defences.","Explain IDOR and how to test for it in an API.","What is prototype pollution in JavaScript?"]}];wa("You are a security engineer with the whole catalogue below at hand.",mh(),kw());const Rw=["Explain SSRF with a vulnerable example and the fix.","Threat-model a password-reset flow that emails a link with a token.",`Is this email phishing?
155
+ `,"Write a Sigma rule to detect password spraying against Entra ID."]},{id:"explainer",label:"Vulnerability explainer",system:wa("You teach application and AI security to developers. Explain the vulnerability class clearly, name its OWASP category and CWE (and the ATLAS technique for AI weaknesses), show a minimal vulnerable example and the fixed version, describe the real-world impact, and list prevention controls with the ASVS chapter they belong to. Keep it educational and defensive.",Yl(!1),ol(!1),No()),starters:["Explain SSRF with a vulnerable example and the fix.","Explain indirect prompt injection with an example and the defences.","Explain IDOR and how to test for it in an API.","What is prototype pollution in JavaScript?"]}];wa("You are a security engineer with the whole catalogue below at hand.",mh(),E1());const L1=["Explain SSRF with a vulnerable example and the fix.","Threat-model a password-reset flow that emails a link with a token.",`Is this email phishing?
156
156
 
157
157
  `,`Review this code for security vulnerabilities:
158
158
 
159
- `];function s0(l){return $f.find(o=>o.system===l.trim())}const Gf="or_flag_pattern",ki="\\b[A-Za-z][A-Za-z0-9_-]{1,15}\\{[^{}\\s]{3,120}\\}";let As=ki;try{As=localStorage.getItem(Gf)||ki}catch{}const ph=()=>As;function Ow(l){const o=l.trim();As=o&&i0(o)?o:ki;try{o?localStorage.setItem(Gf,o):localStorage.removeItem(Gf)}catch{}return As}function i0(l){try{return new RegExp(l,"g"),!0}catch{return!1}}const o0=(l=As)=>new RegExp(l,"g");function Dw(l,o=As){if(o===ki&&!l.includes("{"))return l;const c=o0(o);return l.split(/(<[^>]+>)/).map(u=>u.startsWith("<")||!u?u:u.replace(c,d=>`<mark class="flag">${d}</mark>`)).join("")}function Lw(l,o=As){if(o===ki&&!l.includes("{"))return[l];const c=o0(o),u=[];let d=0;for(const h of l.matchAll(c)){const m=h.index??0;h[0]&&(u.push(l.slice(d,m),h[0]),d=m+h[0].length)}return u.push(l.slice(d)),u}const zw={low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Maximum"},Uw={type:"function",function:{name:"get_weather",description:"Get the current weather for a city",parameters:{type:"object",properties:{city:{type:"string",description:"City name"}},required:["city"]}}};function Hw({onCollapse:l,sessions:o,mode:c,setMode:u,runner:d,status:h,statusError:m,onOpenDirectory:y,onForgetDirectory:v,config:S,setConfig:g,models:b,modelError:x,activeModel:k,onReset:D,saved:V}){var be,qe;const[L,K]=A.useState(ph()),ce=(q,Re)=>g(He=>({...He,[q]:Re})),[de,E]=A.useState(!1);A.useEffect(()=>{const q=()=>fetch("/api/auth/me").then(He=>He.json()).then(He=>E(!!He.required)).catch(()=>{});q();const Re=setInterval(q,3e4);return()=>clearInterval(Re)},[]);const[G,H]=A.useState([]),[Y,F]=A.useState(""),[ie,X]=A.useState(""),[P,Q]=A.useState(!1),[me,ve]=A.useState(null),[Ce,ne]=A.useState(null);A.useEffect(()=>{ES().then(H).catch(()=>{})},[]);async function te(){if(ie.trim()){Q(!0),ve(null);try{const q=await CS(Y.trim()||`Document ${G.length+1}`,ie);H(q),F(""),X(""),S.useKnowledge||ce("useKnowledge",!0)}catch(q){ve(String(q.message??q))}finally{Q(!1)}}}async function re(q){H(await MS(q))}const ee=(k==null?void 0:k.supported_features)??[],ke=ee.includes("tools"),Ze=ee.includes("json_mode"),bt=ee.includes("reasoning"),[kt,j]=A.useState(""),[ae,je]=A.useState(!1),pe=b.filter(q=>q.output_modalities.includes("text")),Ie=pe.filter(q=>ae||Lc(q)||q.id===S.model),Oe=pe.filter(q=>!Lc(q)).length,ze=Ie.filter(q=>gw(q,kt)||q.id===S.model),Se=["scx","anthropic","nvidia","bedrock","openrouter"].map(q=>[q,ze.filter(Re=>(Re.provider??"scx")===q)]).filter(([,q])=>q.length>0),_e=s0(S.system),mt=b.some(q=>q.provider==="nvidia"),[O,we]=A.useState([]);A.useEffect(()=>{mt&&fetch("/api/models/nvidia-health").then(q=>q.ok?q.json():null).then(q=>we(Array.isArray(q==null?void 0:q.retired)?q.retired:[])).catch(()=>{})},[mt,b]);function he(q,Re){g(He=>{const pt=He.tools.slice();return pt[q]={...pt[q],function:{...pt[q].function,...Re}},{...He,tools:pt}})}function Be(q,Re){try{const He=JSON.parse(Re);he(q,{parameters:He})}catch{}}function Ee(q){if(!q)return null;const Re=q.function??q;return Re!=null&&Re.name?{type:"function",id:Uf(),function:{name:Re.name,description:Re.description,parameters:Re.parameters??Re.schema}}:null}async function le(){ne(null);try{const q=await fetch("/example-tools.json",{cache:"no-store"});if(!q.ok)throw new Error(`No example-tools.json yet (${q.status}) — add web/public/example-tools.json first.`);const Re=await q.json(),He=(Array.isArray(Re)?Re:Re.tools??[]).map(Ee).filter(Boolean);if(!He.length)throw new Error("File had no valid tools.");let pt=0;g(Ve=>{const ht=new Set(Ve.tools.map(Vt=>Vt.function.name)),$e=He.filter(Vt=>!ht.has(Vt.function.name));return pt=$e.length,{...Ve,tools:[...Ve.tools,...$e]}}),ne(pt?`Loaded ${pt} tool${pt>1?"s":""}.`:"Already loaded.")}catch(q){ne(String(q.message??q))}}function Te(){const q=new Blob([JSON.stringify(S,null,2)],{type:"application/json"}),Re=URL.createObjectURL(q),He=document.createElement("a");He.href=Re,He.download=`${S.name.replace(/\s+/g,"-").toLowerCase()||"bot"}.json`,He.click(),URL.revokeObjectURL(Re)}return i.jsxs("aside",{className:"sidebar",children:[i.jsxs("div",{className:"sidebar-head",children:[i.jsxs("div",{className:"sidebar-top",children:[i.jsx(s1,{}),i.jsx("button",{className:"sidebar-toggle",onClick:l,title:"Hide sidebar (Ctrl+B)","aria-label":"Hide sidebar",children:"«"})]}),i.jsx("div",{className:"mode-switch",children:["runner","playground"].map(q=>i.jsx("button",{className:"seg"+(c===q?" on":""),onClick:()=>u(q),children:q==="runner"?"Runner":"Playground"},q))})]}),c==="runner"?i.jsx(Bw,{runner:d,status:h,statusError:m,onOpen:y,onForget:v,sessions:o}):i.jsxs("div",{className:"sidebar-body",children:[i.jsx("p",{className:"hint",style:{marginTop:0},children:"Chat with any SCX model directly — no agent, no file access. Useful for comparing models and prompts."}),i.jsx("div",{className:"section-title",children:"Identity"}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Bot name"}),i.jsx("input",{type:"text",value:S.name,onChange:q=>ce("name",q.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Model"}),i.jsx("input",{type:"search",placeholder:`Search ${Ie.length} models…`,value:kt,onChange:q=>j(q.target.value),style:{marginBottom:6},"aria-label":"Search models"}),i.jsx("select",{value:S.model,onChange:q=>ce("model",q.target.value),children:Se.map(([q,Re])=>i.jsx("optgroup",{label:q==="openrouter"?"OpenRouter":q==="nvidia"?"NVIDIA NIM":q==="bedrock"?"Amazon Bedrock":q==="anthropic"?"Anthropic":"SCX.ai",children:Re.map(He=>i.jsxs("option",{value:He.id,children:[He.name,He.context_length?` · ${Math.round(He.context_length/1e3)}k ctx`:""]},He.id))},q))}),Oe>0&&i.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:ae,onChange:q=>je(q.target.checked)}),"Show non-chat models (",Oe," hidden: embeddings, guards, speech…)"]}),O.length>0&&i.jsxs("div",{className:"hint",title:O.join(", "),children:[O.length," retired NVIDIA model",O.length===1?"":"s"," hidden (no longer served)"]}),x&&i.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:x}),(k==null?void 0:k.description)&&i.jsx("div",{className:"hint",children:k.description}),i.jsxs("div",{className:"cap-badges",children:[i.jsx("span",{className:"badge"+(ke?" on":""),children:"tools"}),i.jsx("span",{className:"badge"+(Ze?" on":""),children:"json"}),i.jsx("span",{className:"badge"+(bt?" on":""),children:"reasoning"}),i.jsx("span",{className:"badge"+((be=k==null?void 0:k.input_modalities)!=null&&be.includes("image")?" on":""),children:"vision"}),(qe=k==null?void 0:k.datacenters)==null?void 0:qe.map(q=>i.jsx("span",{className:"badge",children:q.country_code},q.country_code))]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Security preset"}),i.jsxs("select",{value:(_e==null?void 0:_e.id)??"custom",onChange:q=>{const Re=$f.find(He=>He.id===q.target.value);Re&&ce("system",Re.system)},children:[i.jsx("option",{value:"custom",children:"Custom (your own system prompt)"}),$f.map(q=>i.jsx("option",{value:q.id,children:q.label},q.id))]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"System prompt"}),i.jsx("textarea",{value:S.system,onChange:q=>ce("system",q.target.value),placeholder:"Describe the bot's personality, role, and rules…",style:{minHeight:110}})]}),i.jsx("div",{className:"section-title",children:"Generation"}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Temperature"}),i.jsxs("div",{className:"range-row",children:[i.jsx("input",{type:"range",min:0,max:2,step:.05,value:S.temperature,onChange:q=>ce("temperature",Number(q.target.value))}),i.jsx("span",{className:"range-val",children:S.temperature.toFixed(2)})]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Top P"}),i.jsxs("div",{className:"range-row",children:[i.jsx("input",{type:"range",min:0,max:1,step:.05,value:S.topP,onChange:q=>ce("topP",Number(q.target.value))}),i.jsx("span",{className:"range-val",children:S.topP.toFixed(2)})]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Max output tokens"}),i.jsxs("div",{className:"range-row",children:[i.jsx("input",{type:"range",min:64,max:(k==null?void 0:k.max_output_length)??4096,step:64,value:Math.min(S.maxTokens,(k==null?void 0:k.max_output_length)??4096),onChange:q=>ce("maxTokens",Number(q.target.value))}),i.jsx("span",{className:"range-val",children:S.maxTokens})]})]}),bt&&i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"reasoning-effort",children:"Reasoning effort"}),i.jsxs("select",{id:"reasoning-effort",value:S.reasoningEffort??"",onChange:q=>ce("reasoningEffort",q.target.value),children:[i.jsx("option",{value:"",children:"Model default"}),zv.map(q=>i.jsx("option",{value:q,children:zw[q]},q))]}),i.jsx("span",{className:"hint",children:"Reasoning counts against Max output tokens. Lower effort answers sooner and leaves more of the limit for the answer."})]}),i.jsx(vc,{label:"Stream responses",sub:"Token-by-token output via SSE",checked:S.stream,onChange:q=>ce("stream",q)}),i.jsx(vc,{label:"JSON mode",sub:Ze?"Force valid JSON output":"Not supported by this model",checked:S.jsonMode&&Ze,disabled:!Ze,onChange:q=>ce("jsonMode",q)}),i.jsxs("div",{className:"section-title",children:["Tools ",ke?"":"(model has no tool support)"]}),S.tools.map((q,Re)=>i.jsxs("div",{className:"tool-card",children:[i.jsxs("div",{className:"tc-head",children:[i.jsx("input",{type:"text",value:q.function.name,placeholder:"function_name",onChange:He=>he(Re,{name:He.target.value})}),i.jsx("button",{className:"btn danger",onClick:()=>g(He=>({...He,tools:He.tools.filter((pt,Ve)=>Ve!==Re)})),children:"✕"})]}),i.jsx("input",{type:"text",value:q.function.description??"",placeholder:"description",style:{marginBottom:8},onChange:He=>he(Re,{description:He.target.value})}),i.jsx("textarea",{defaultValue:JSON.stringify(q.function.parameters??{},null,2),onChange:He=>Be(Re,He.target.value),spellCheck:!1}),i.jsx("div",{className:"hint",children:"JSON Schema for the function parameters."})]},q.id??Re)),i.jsxs("div",{className:"btn-row",children:[i.jsx("button",{className:"btn block ghost mini",disabled:!ke,onClick:()=>g(q=>({...q,tools:[...q.tools,{...structuredClone(Uw),id:Uf()}]})),children:"+ Add tool"}),i.jsx("button",{className:"btn block ghost mini",onClick:le,title:"Import tools from web/public/example-tools.json",children:"↓ Load example tools"})]}),Ce&&i.jsx("div",{className:"hint",style:{color:Ce.startsWith("Loaded")?"var(--accent-2)":"var(--muted-2)"},children:Ce}),i.jsx("div",{className:"section-title",children:"Knowledge (RAG)"}),i.jsx(vc,{label:"Ground answers in knowledge",sub:G.length?`Retrieve from ${G.length} doc${G.length>1?"s":""} via embeddings`:"Add a document to enable",checked:S.useKnowledge&&G.length>0,disabled:G.length===0,onChange:q=>ce("useKnowledge",q)}),G.map(q=>i.jsxs("div",{className:"tool-card",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[i.jsxs("div",{style:{minWidth:0},children:[i.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:q.name}),i.jsxs("div",{className:"hint",style:{margin:0},children:[q.chunks," chunks · ",q.chars.toLocaleString()," chars"]})]}),i.jsx("button",{className:"btn danger",onClick:()=>re(q.id),children:"✕"})]},q.id)),i.jsxs("div",{className:"field",style:{marginTop:10},children:[i.jsx("input",{type:"text",placeholder:"Document name (optional)",value:Y,onChange:q=>F(q.target.value),style:{marginBottom:8}}),i.jsx("textarea",{placeholder:"Paste text to give your bot a knowledge base…",value:ie,onChange:q=>X(q.target.value),style:{minHeight:80}}),me&&i.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:me}),i.jsx("button",{className:"btn block ghost mini",style:{marginTop:8},disabled:P||!ie.trim(),onClick:te,children:P?"Embedding…":"+ Add to knowledge base"})]}),i.jsx("div",{className:"section-title",children:"Voice"}),i.jsx(vc,{label:"Speak replies aloud",sub:"Browser text-to-speech",checked:S.speak,onChange:q=>ce("speak",q)}),i.jsxs("div",{className:"hint",children:[nh()?"Mic dictation available in the composer.":"Voice input not supported in this browser."," ","SCX-native audio (scx-tts/scx-stt) is gated on this tier."]}),i.jsx("div",{className:"section-title",children:"Saved chats"}),i.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[i.jsx("input",{type:"checkbox",checked:S.saveSessions,onChange:q=>ce("saveSessions",q.target.checked)}),"Save chats on this runner, encrypted with your vault"]}),i.jsxs("div",{className:"btn-row",children:[i.jsx("button",{className:"btn block ghost",onClick:D,children:"+ New chat"}),i.jsx("button",{className:"btn block ghost",onClick:Te,title:"Download the bot settings as JSON",children:"Export settings"})]}),V.status&&i.jsx("div",{className:"hint",style:{color:V.status.ok?"var(--muted)":"var(--amber)"},children:V.status.text}),i.jsx(Iw,{saved:V})]}),i.jsxs("div",{className:"sidebar-foot",children:[i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Flag format"}),i.jsx("input",{type:"text",value:L,placeholder:ki,spellCheck:!1,onChange:q=>{K(q.target.value),Ow(q.target.value)},title:"A regular expression. Anything matching it is highlighted in replies and tool output (CTFs, labs). Blank = the default: a short prefix before braces, e.g. flag{...}."}),L.trim()&&!i0(L)&&i.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:"Not a valid regular expression; the default is in use."})]}),i.jsx(O1,{}),de&&i.jsx("button",{className:"btn ghost sm block",onClick:C1,children:"Sign out"}),i.jsxs("a",{className:"powered-by",href:"https://www.anthropic.com/claude/mythos",target:"_blank",rel:"noopener noreferrer","aria-label":"Reviewed by Claude Mythos 5.1",children:[i.jsx("span",{className:"powered-by-lead",children:"Reviewed by"}),i.jsx("img",{className:"powered-by-logo",src:"/claude-logo-ivory.svg",alt:"Claude",width:"83",height:"18"}),i.jsx("span",{className:"powered-by-model",children:"Mythos 5.1"})]})]})]})}function Bw({runner:l,status:o,statusError:c,onOpen:u,onForget:d,sessions:h}){const[m,y]=A.useState(l.directory),[v,S]=A.useState(null),[g,b]=A.useState(!1),[x,k]=A.useState(!1),[D,V]=A.useState(!1),[L,K]=A.useState(!1);A.useEffect(()=>y(l.directory),[l.directory]);async function ce(G=m){if(G.trim()){b(!0),S(null);try{u(await Lv(G))}catch(H){S(String(H.message??H))}finally{b(!1)}}}const de=l.recent.filter(G=>G!==l.directory),E=(o==null?void 0:o.models.filter(G=>G.id.startsWith("scx/")).length)??0;return i.jsxs("div",{className:"sidebar-body",children:[i.jsx("div",{className:"section-title",children:"Project"}),i.jsxs("div",{className:"field",children:[i.jsxs("form",{className:"dir-row",onSubmit:G=>{G.preventDefault(),ce()},children:[i.jsx("input",{type:"text",className:"mono",value:m,onChange:G=>y(G.target.value),placeholder:"C:\\code\\my-project",spellCheck:!1}),i.jsx("button",{className:"btn sm",type:"submit",disabled:g||!m.trim()||m===l.directory,children:"Open"})]}),v&&i.jsx("div",{className:"hint danger",children:v}),i.jsx("div",{className:"hint",children:"The agent reads, edits and runs commands in this folder. Switching folders starts a new session."}),i.jsxs("div",{className:"project-actions",children:[i.jsxs("button",{className:"btn sm gh-open",onClick:()=>V(!0),title:"Create, open or delete workspaces",children:[i.jsx(F1,{size:13})," workspaces"]}),i.jsxs("button",{className:"btn sm gh-open",onClick:()=>K(!0),disabled:!l.directory,title:"Browse, upload and download this project's files",children:[i.jsx(hh,{size:13})," files"]}),i.jsxs("button",{className:"btn sm gh-open",onClick:()=>k(!0),title:"Clone a repository into the workspace (read-only)",children:[i.jsx(Pv,{size:13})," clone from GitHub"]})]}),x&&i.jsx(dw,{onOpen:G=>ce(G),onClose:()=>k(!1)}),D&&i.jsx(fw,{current:l.directory,onOpen:G=>ce(G),onDeleted:d,onClose:()=>V(!1)}),L&&l.directory&&i.jsx(mw,{directory:l.directory,onClose:()=>K(!1)})]}),de.length>0&&i.jsxs("div",{className:"field",children:[i.jsx("label",{children:"Recent"}),i.jsx("div",{className:"recent-list",children:de.map(G=>i.jsxs("button",{className:"recent-item",onClick:()=>ce(G),title:G,children:[i.jsx("span",{className:"recent-name",children:G.split(/[\\/]/).filter(Boolean).pop()}),i.jsx("span",{className:"recent-path mono",children:G})]},G))})]}),l.directory&&i.jsx(qw,{directory:l.directory,nav:h}),i.jsx("div",{className:"section-title",children:"Agents"}),i.jsxs("div",{className:"agent-info",children:[i.jsxs("div",{className:"ai-row",children:[i.jsx("span",{className:"ai-name",children:"build"}),i.jsx("span",{className:"hint",children:"edits & runs"})]}),i.jsx("div",{className:"hint ai-desc",children:"Every file edit and shell command waits for your approval."}),i.jsxs("div",{className:"ai-row",children:[i.jsx("span",{className:"ai-name",children:"plan"}),i.jsx("span",{className:"hint",children:"read-only"})]}),i.jsx("div",{className:"hint ai-desc",children:"Explores and reasons without changing anything."})]}),i.jsx("div",{className:"section-title",children:"Engine"}),c?i.jsx("div",{className:"hint danger",children:c}):i.jsxs("div",{className:"engine",children:[i.jsxs("div",{children:[i.jsx("span",{className:"muted",children:"Agent"}),i.jsx("span",{children:"OpenCode"})]}),i.jsxs("div",{children:[i.jsx("span",{className:"muted",children:"Provider"}),i.jsxs("span",{children:["SCX.ai · ",E," models"]})]}),i.jsxs("div",{children:[i.jsx("span",{className:"muted",children:"Default"}),i.jsx("span",{className:"mono",children:(o==null?void 0:o.defaultModel)??"…"})]})]})]})}function Iw({saved:l}){const[o,c]=A.useState(null),[u,d]=A.useState(!1);A.useEffect(()=>{if(!o)return;const y=setTimeout(()=>c(null),3e3);return()=>clearTimeout(y)},[o]);const h=l.list??[];if(l.list&&!h.length)return i.jsx("div",{className:"hint",children:"No saved chats yet."});const m=u?h:h.slice(0,8);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"session-list",children:m.map(y=>i.jsxs("div",{className:"session-item"+(y.id===l.activeId?" on":""),children:[i.jsxs("button",{className:"session-open",onClick:()=>l.onOpen(y.id),title:y.title,children:[i.jsx("span",{className:"session-title",children:y.title||"Untitled chat"}),i.jsx("span",{className:"session-meta",children:r0(Date.parse(y.updatedAt))})]}),i.jsx("button",{className:"session-del"+(o===y.id?" confirm":""),onClick:()=>{if(o!==y.id)return c(y.id);c(null),l.onDelete(y.id)},title:o===y.id?"Click again to delete":"Delete chat","aria-label":o===y.id?"Confirm delete":"Delete chat",children:o===y.id?"Delete?":"✕"})]},y.id))}),h.length>8&&i.jsx("button",{className:"btn ghost sm block",onClick:()=>d(y=>!y),children:u?"Show fewer":`Show all ${h.length}`})]})}function qw({directory:l,nav:o}){const[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState(!1);A.useEffect(()=>{let x=!0;return RS(l).then(k=>{x&&(u(k),h(null))}).catch(k=>x&&h(String(k.message??k))),()=>{x=!1}},[l,o.version,o.active]),A.useEffect(()=>{if(!m)return;const x=setTimeout(()=>y(null),3e3);return()=>clearTimeout(x)},[m]);async function g(x){if(m!==x){y(x);return}y(null);try{await DS(x,l),o.active===x&&o.open(null),u(k=>(k==null?void 0:k.filter(D=>D.id!==x))??null)}catch(k){h(String(k.message??k))}}const b=v?c??[]:(c??[]).slice(0,8);return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"section-title",children:"Sessions"}),i.jsx("button",{className:"btn ghost sm block new-session",onClick:()=>o.open(null),children:"+ New session"}),d&&i.jsx("div",{className:"hint danger",children:d}),c&&c.length===0&&i.jsx("div",{className:"hint",children:"No past sessions in this folder yet."}),i.jsx("div",{className:"session-list",children:b.map(x=>i.jsxs("div",{className:"session-item"+(x.id===o.active?" on":""),children:[i.jsxs("button",{className:"session-open",onClick:()=>o.open(x.id),title:x.title,children:[i.jsx("span",{className:"session-title",children:x.title||"Untitled session"}),i.jsxs("span",{className:"session-meta",children:[r0(x.updated),x.files>0&&i.jsxs(i.Fragment,{children:[" · ",i.jsxs("span",{className:"adds",children:["+",x.additions]})," ",i.jsxs("span",{className:"dels",children:["−",x.deletions]})]})]})]}),i.jsx("button",{className:"session-del"+(m===x.id?" confirm":""),onClick:()=>g(x.id),title:m===x.id?"Click again to delete":"Delete session","aria-label":m===x.id?"Confirm delete":"Delete session",children:m===x.id?"Delete?":"✕"})]},x.id))}),c&&c.length>8&&i.jsx("button",{className:"btn ghost sm block",onClick:()=>S(x=>!x),children:v?"Show fewer":`Show all ${c.length}`})]})}function r0(l){if(!l)return"";const o=Math.max(0,(Date.now()-l)/1e3);return o<60?"just now":o<3600?`${Math.floor(o/60)}m ago`:o<86400?`${Math.floor(o/3600)}h ago`:o<7*86400?`${Math.floor(o/86400)}d ago`:new Date(l).toLocaleDateString()}function vc({label:l,sub:o,checked:c,onChange:u,disabled:d}){return i.jsxs("div",{className:"toggle",children:[i.jsxs("div",{className:"tg-label",children:[l,o&&i.jsx("small",{children:o})]}),i.jsxs("label",{className:"switch"+(d?" disabled":""),children:[i.jsx("input",{type:"checkbox",checked:c,disabled:d,onChange:h=>u(h.target.checked)}),i.jsx("span",{})]})]})}function c0({text:l}){const o=ph(),c=A.useMemo(()=>Lw(l,o),[l,o]);return c.length===1?i.jsx(i.Fragment,{children:l}):i.jsx(i.Fragment,{children:c.map((u,d)=>d%2?i.jsx("mark",{className:"flag",children:u},d):u)})}const $w=512*1024,Vy=5,Gw=".md,.markdown,.txt,text/markdown,text/plain";function Xw(l,o=""){return/\.(md|markdown|txt)$/i.test(l)?!0:o==="text/markdown"||o==="text/plain"}function Yw(l){return/[\u0000-\u0008\u000E-\u001A]/.test(l.slice(0,8192))}const Vw=5*1024*1024,Nf=4,Qw=3*1024*1024-2048,Qy=3,gh=`image/*,.drawio,.xml,.svg,${Gw}`;function Kw(l){return new Promise((o,c)=>{const u=new FileReader;u.onload=()=>o(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(l)})}const Zw=l=>/\.drawio(\.(svg|xml))?$/i.test(l)||/\.xml$/i.test(l);async function Fw(l){if(/\.drawio\.png$/i.test(l.name))return!1;if(Zw(l.name))return!0;if(l.type==="image/svg+xml"||/\.svg$/i.test(l.name)){const o=await l.slice(0,4096).text();return/content="[^"]*(mxfile|mxGraphModel)/.test(o)||/&lt;mxfile/.test(o)}return!1}async function Pw(l){var u;const o=await fetch("/api/render/outline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:await l.text()})}),c=await o.json().catch(()=>({}));if(!o.ok)throw new Error(((u=c==null?void 0:c.error)==null?void 0:u.message)||`Reading ${l.name} failed (${o.status})`);return{name:l.name,text:c.outline,pages:c.pages}}function yh(){const[l,o]=A.useState([]),[c,u]=A.useState([]),[d,h]=A.useState(0),[m,y]=A.useState(null);async function v(b){y(null);const x=Array.from(b),k=[],D=[],V=[];for(const L of x)if(await Fw(L))D.push(L);else if(L.type.startsWith("image/"))L.size>Vw?y(`${L.name} is over 5 MB.`):k.push({name:L.name||"pasted-image.png",url:await Kw(L)});else if(Xw(L.name,L.type)){if(L.size>$w){y(`${L.name} is over 512 KB.`);continue}const K=await L.text();Yw(K)?y(`${L.name} is not a text file.`):K.trim()?V.push({name:L.name||"pasted-text.txt",text:K,kind:"text"}):y(`${L.name} is empty.`)}else y(`${L.name}: attach images, draw.io files (.drawio, .drawio.svg), or Markdown / text files (.md, .txt).`);V.length&&u(L=>{const K=Vy-L.filter(ce=>ce.kind==="text").length;return V.length>K&&y(`Up to ${Vy} text files per message.`),[...L,...V.slice(0,Math.max(0,K))]}),o(L=>{const K=[...L,...k];return K.length>Nf&&y(`Up to ${Nf} images per message.`),K.slice(0,Nf)});for(const L of D){if(L.size>Qw){y(`${L.name} is over 3 MB.`);continue}h(K=>K+1);try{const K=await Pw(L);u(ce=>ce.filter(de=>de.kind!=="text").length>=Qy?(y(`Up to ${Qy} diagrams per message.`),ce):[...ce,K])}catch(K){y(String(K.message??K))}finally{h(K=>K-1)}}}function S(b){const x=Array.from(b.clipboardData.files);x.length&&(b.preventDefault(),v(x))}function g(b){b.dataTransfer.files.length&&(b.preventDefault(),v(b.dataTransfer.files))}return{images:l,docs:c,reading:d>0,attachError:m,addImages:v,onPaste:S,onDrop:g,remove:b=>o(x=>x.filter((k,D)=>D!==b)),removeDoc:b=>u(x=>x.filter((k,D)=>D!==b)),clear:()=>{o([]),u([]),y(null)}}}function vh({images:l,docs:o=[],onRemove:c,onRemoveDoc:u,reading:d}){return!l.length&&!o.length&&!d?null:i.jsxs("div",{className:"attach-row",children:[l.map((h,m)=>i.jsxs("span",{className:"attach-chip",title:h.name,children:[i.jsx("img",{src:h.url,alt:""}),i.jsx("span",{className:"attach-name",children:h.name}),i.jsx("button",{className:"attach-x",onClick:()=>c(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`i${m}`)),o.map((h,m)=>i.jsxs("span",{className:"attach-chip doc",title:h.kind==="text"?`${h.name}: attached as text (${h.text.length.toLocaleString()} characters)`:`${h.name}: read as an exact outline (${h.text.length.toLocaleString()} characters${h.pages&&h.pages.length>1?`, ${h.pages.length} pages`:""})`,children:[i.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),i.jsx("span",{className:"attach-name",children:h.name}),u&&i.jsx("button",{className:"attach-x",onClick:()=>u(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`d${m}`)),d&&i.jsx("span",{className:"attach-chip doc",children:i.jsx("span",{className:"attach-name",children:"reading diagram…"})})]})}function bh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ns=bh();function u0(l){Ns=l}var Ss={exec:()=>null};function mi(l){let o=[];return c=>{let u=Math.max(0,Math.min(3,c-1)),d=o[u];return d||(d=l(u),o[u]=d),d}}function We(l,o=""){let c=typeof l=="string"?l:l.source,u={replace:(d,h)=>{let m=typeof h=="string"?h:h.source;return m=m.replace(mn.caret,"$1"),c=c.replace(d,m),u},getRegex:()=>new RegExp(c,o)};return u}var Jw=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),mn={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:mi(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:mi(l=>new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:mi(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:mi(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:mi(l=>new RegExp(`^ {0,${l}}(?:</?(?:${$o})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:mi(l=>new RegExp(`^ {0,${l}}>`))},Ww=/^(?:[ \t]*(?:\n|$))+/,eA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,d0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,f0=We(d0).replace(/bull/g,xh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),aA=We(d0).replace(/bull/g,xh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,lA=/^[^\n]+/,wh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sA=We(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),iA=We(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,xh).getRegex(),$o="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ah=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,oA=We("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ah).replace("tag",$o).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h0=l=>We(Sh).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),rA=h0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),cA=h0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),uA=We(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cA).getRegex(),Th={blockquote:uA,code:eA,def:sA,fences:tA,heading:nA,hr:qo,html:oA,lheading:f0,list:iA,newline:Ww,paragraph:rA,table:Ss,text:lA},Ky=We("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),dA={...Th,lheading:aA,table:Ky,paragraph:We(Sh).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ky).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex()},fA={...Th,html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ah).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ss,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:We(Sh).replace("hr",qo).replace("heading",` *#{1,6} *[^
160
- ]`).replace("lheading",f0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},hA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mA=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,m0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,pA=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,fl=/[\p{P}\p{S}]/u,ji=/[\s\p{P}\p{S}]/u,Go=/[^\s\p{P}\p{S}]/u,gA=We(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ji).getRegex(),yA=/[\p{Pi}\p{Ps}"']/u,p0=/(?!~)[\p{P}\p{S}]/u,vA=/(?!~)[\s\p{P}\p{S}]/u,bA=/(?:[^\s\p{P}\p{S}]|~)/u,xA=We(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Jw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),g0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,SA=We(g0,"u").replace(/punct/g,fl).getRegex(),wA=We(g0,"u").replace(/punct/g,p0).getRegex(),AA=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,TA=We(AA,"u").replace(/openQuote/g,yA).replace(/punct/g,fl).getRegex(),y0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",kA=We(y0,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),jA=We(y0,"gu").replace(/notPunctSpace/g,bA).replace(/punctSpace/g,vA).replace(/punct/g,p0).getRegex(),NA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",EA=We(NA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),CA=We("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),MA="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",_A=We(MA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),RA=We(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,fl).getRegex(),OA="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",DA=We(OA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),LA=We(/\\(punct)/,"gu").replace(/punct/g,fl).getRegex(),zA=We(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),UA=We(Ah).replace("(?:-->|$)","-->").getRegex(),HA=We("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",UA).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),v0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,zc=We(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",v0).getRegex(),BA=We(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",zc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),IA=We(/^!?\[(label)\]\[(ref)\]/).replace("label",zc).replace("ref",wh).getRegex(),qA=We(/^!?\[(ref)\](?:\[\])?/).replace("ref",wh).getRegex(),Zy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,$A=We(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",v0).getRegex(),GA=We("reflink|nolink(?!\\()","g").replace("reflink",We(/^!?\[(label)\]\[(ref)\]/).replace("label",$A).replace("ref",Zy).getRegex()).replace("nolink",We(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zy).getRegex()).getRegex(),Fy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,XA=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,YA=We(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,XA).getRegex(),kh={_backpedal:Ss,anyPunctuation:LA,autolink:zA,blockSkip:xA,br:m0,code:mA,del:Ss,delLDelim:Ss,delRDelim:Ss,emStrongLDelim:SA,emStrongRDelimAst:kA,emStrongRDelimUnd:CA,escape:hA,link:BA,nolink:qA,punctuation:gA,reflink:IA,reflinkSearch:GA,tag:HA,text:pA,url:Ss},VA={...kh,emStrongLDelim:TA,emStrongRDelimAst:EA,emStrongRDelimUnd:_A,link:We(/^!?\[(label)\]\((.*?)\)/).replace("label",zc).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zc).getRegex()},Xf={...kh,emStrongRDelimAst:jA,emStrongLDelim:wA,delLDelim:RA,delRDelim:DA,url:We(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",YA).replace("protocol",Fy).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:We(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Fy).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},QA={...Xf,br:We(m0).replace("{2,}","*").getRegex(),text:We(Xf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bc={normal:Th,gfm:dA,pedantic:fA},bo={normal:kh,gfm:Xf,breaks:QA,pedantic:VA},KA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Py=l=>KA[l];function Pn(l,o){if(o){if(mn.escapeTest.test(l))return l.replace(mn.escapeReplace,Py)}else if(mn.escapeTestNoEncode.test(l))return l.replace(mn.escapeReplaceNoEncode,Py);return l}function ZA(l){return l.replace(mn.numericCharacterReference,(o,c,u)=>{let d=c===void 0?Number.parseInt(u,16):Number.parseInt(c,10);return d===0||d>1114111||d>=55296&&d<=57343?"�":String.fromCodePoint(d)})}function Jy(l){try{l=encodeURI(l).replace(mn.percentDecode,"%")}catch{return null}return l}function Wy(l,o){var h;let c=l.replace(mn.findPipe,(m,y,v)=>{let S=!1,g=y;for(;--g>=0&&v[g]==="\\";)S=!S;return S?"|":" |"}),u=c.split(mn.splitPipe),d=0;if(u[0].trim()||u.shift(),u.length>0&&!((h=u.at(-1))!=null&&h.trim())&&u.pop(),o)if(u.length>o)u.splice(o);else for(;u.length<o;)u.push("");for(;d<u.length;d++)u[d]=u[d].trim().replace(mn.slashPipe,"|");return u}function $l(l,o,c){let u=l.length;if(u===0)return"";let d=0;for(;d<u&&l.charAt(u-d-1)===o;)d++;return l.slice(0,u-d)}function ev(l){let o=l.split(`
159
+ `];function o0(l){return $f.find(o=>o.system===l.trim())}const Gf="or_flag_pattern",ki="\\b[A-Za-z][A-Za-z0-9_-]{1,15}\\{[^{}\\s]{3,120}\\}";let As=ki;try{As=localStorage.getItem(Gf)||ki}catch{}const ph=()=>As;function z1(l){const o=l.trim();As=o&&r0(o)?o:ki;try{o?localStorage.setItem(Gf,o):localStorage.removeItem(Gf)}catch{}return As}function r0(l){try{return new RegExp(l,"g"),!0}catch{return!1}}const c0=(l=As)=>new RegExp(l,"g");function U1(l,o=As){if(o===ki&&!l.includes("{"))return l;const c=c0(o);return l.split(/(<[^>]+>)/).map(u=>u.startsWith("<")||!u?u:u.replace(c,d=>`<mark class="flag">${d}</mark>`)).join("")}function H1(l,o=As){if(o===ki&&!l.includes("{"))return[l];const c=c0(o),u=[];let d=0;for(const h of l.matchAll(c)){const m=h.index??0;h[0]&&(u.push(l.slice(d,m),h[0]),d=m+h[0].length)}return u.push(l.slice(d)),u}const B1={low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Maximum"},I1={type:"function",function:{name:"get_weather",description:"Get the current weather for a city",parameters:{type:"object",properties:{city:{type:"string",description:"City name"}},required:["city"]}}};function q1({onCollapse:l,sessions:o,mode:c,setMode:u,runner:d,status:h,statusError:m,onOpenDirectory:y,onForgetDirectory:v,config:S,setConfig:g,models:b,modelError:x,activeModel:k,onReset:L,saved:V}){var be,qe;const[z,Z]=A.useState(ph()),oe=(q,Re)=>g(He=>({...He,[q]:Re})),[de,C]=A.useState(!1);A.useEffect(()=>{const q=()=>fetch("/api/auth/me").then(He=>He.json()).then(He=>C(!!He.required)).catch(()=>{});q();const Re=setInterval(q,3e4);return()=>clearInterval(Re)},[]);const[Y,O]=A.useState([]),[X,F]=A.useState(""),[ie,G]=A.useState(""),[Q,K]=A.useState(!1),[me,ve]=A.useState(null),[Ce,ne]=A.useState(null);A.useEffect(()=>{_S().then(O).catch(()=>{})},[]);async function te(){if(ie.trim()){K(!0),ve(null);try{const q=await RS(X.trim()||`Document ${Y.length+1}`,ie);O(q),F(""),G(""),S.useKnowledge||oe("useKnowledge",!0)}catch(q){ve(String(q.message??q))}finally{K(!1)}}}async function ce(q){O(await OS(q))}const ee=(k==null?void 0:k.supported_features)??[],ke=ee.includes("tools"),Ze=ee.includes("json_mode"),bt=ee.includes("reasoning"),[kt,j]=A.useState(""),[ae,je]=A.useState(!1),pe=b.filter(q=>q.output_modalities.includes("text")),Ie=pe.filter(q=>ae||Lc(q)||q.id===S.model),Oe=pe.filter(q=>!Lc(q)).length,ze=Ie.filter(q=>b1(q,kt)||q.id===S.model),Se=["scx","anthropic","nvidia","bedrock","openrouter"].map(q=>[q,ze.filter(Re=>(Re.provider??"scx")===q)]).filter(([,q])=>q.length>0),_e=o0(S.system),mt=b.some(q=>q.provider==="nvidia"),[D,we]=A.useState([]);A.useEffect(()=>{mt&&fetch("/api/models/nvidia-health").then(q=>q.ok?q.json():null).then(q=>we(Array.isArray(q==null?void 0:q.retired)?q.retired:[])).catch(()=>{})},[mt,b]);function he(q,Re){g(He=>{const pt=He.tools.slice();return pt[q]={...pt[q],function:{...pt[q].function,...Re}},{...He,tools:pt}})}function Be(q,Re){try{const He=JSON.parse(Re);he(q,{parameters:He})}catch{}}function Ee(q){if(!q)return null;const Re=q.function??q;return Re!=null&&Re.name?{type:"function",id:Uf(),function:{name:Re.name,description:Re.description,parameters:Re.parameters??Re.schema}}:null}async function le(){ne(null);try{const q=await fetch("/example-tools.json",{cache:"no-store"});if(!q.ok)throw new Error(`No example-tools.json yet (${q.status}) — add web/public/example-tools.json first.`);const Re=await q.json(),He=(Array.isArray(Re)?Re:Re.tools??[]).map(Ee).filter(Boolean);if(!He.length)throw new Error("File had no valid tools.");let pt=0;g(Ve=>{const ht=new Set(Ve.tools.map(Vt=>Vt.function.name)),$e=He.filter(Vt=>!ht.has(Vt.function.name));return pt=$e.length,{...Ve,tools:[...Ve.tools,...$e]}}),ne(pt?`Loaded ${pt} tool${pt>1?"s":""}.`:"Already loaded.")}catch(q){ne(String(q.message??q))}}function Te(){const q=new Blob([JSON.stringify(S,null,2)],{type:"application/json"}),Re=URL.createObjectURL(q),He=document.createElement("a");He.href=Re,He.download=`${S.name.replace(/\s+/g,"-").toLowerCase()||"bot"}.json`,He.click(),URL.revokeObjectURL(Re)}return s.jsxs("aside",{className:"sidebar",children:[s.jsxs("div",{className:"sidebar-head",children:[s.jsxs("div",{className:"sidebar-top",children:[s.jsx(rw,{}),s.jsx("button",{className:"sidebar-toggle",onClick:l,title:"Hide sidebar (Ctrl+B)","aria-label":"Hide sidebar",children:"«"})]}),s.jsx("div",{className:"mode-switch",children:["runner","playground"].map(q=>s.jsx("button",{className:"seg"+(c===q?" on":""),onClick:()=>u(q),children:q==="runner"?"Runner":"Playground"},q))})]}),c==="runner"?s.jsx($1,{runner:d,status:h,statusError:m,onOpen:y,onForget:v,sessions:o}):s.jsxs("div",{className:"sidebar-body",children:[s.jsx("p",{className:"hint",style:{marginTop:0},children:"Chat with any SCX model directly — no agent, no file access. Useful for comparing models and prompts."}),s.jsx("div",{className:"section-title",children:"Identity"}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Bot name"}),s.jsx("input",{type:"text",value:S.name,onChange:q=>oe("name",q.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Model"}),s.jsx("input",{type:"search",placeholder:`Search ${Ie.length} models…`,value:kt,onChange:q=>j(q.target.value),style:{marginBottom:6},"aria-label":"Search models"}),s.jsx("select",{value:S.model,onChange:q=>oe("model",q.target.value),children:Se.map(([q,Re])=>s.jsx("optgroup",{label:q==="openrouter"?"OpenRouter":q==="nvidia"?"NVIDIA NIM":q==="bedrock"?"Amazon Bedrock":q==="anthropic"?"Anthropic":"SCX.ai",children:Re.map(He=>s.jsxs("option",{value:He.id,children:[He.name,He.context_length?` · ${Math.round(He.context_length/1e3)}k ctx`:""]},He.id))},q))}),Oe>0&&s.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:ae,onChange:q=>je(q.target.checked)}),"Show non-chat models (",Oe," hidden: embeddings, guards, speech…)"]}),D.length>0&&s.jsxs("div",{className:"hint",title:D.join(", "),children:[D.length," retired NVIDIA model",D.length===1?"":"s"," hidden (no longer served)"]}),x&&s.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:x}),(k==null?void 0:k.description)&&s.jsx("div",{className:"hint",children:k.description}),s.jsxs("div",{className:"cap-badges",children:[s.jsx("span",{className:"badge"+(ke?" on":""),children:"tools"}),s.jsx("span",{className:"badge"+(Ze?" on":""),children:"json"}),s.jsx("span",{className:"badge"+(bt?" on":""),children:"reasoning"}),s.jsx("span",{className:"badge"+((be=k==null?void 0:k.input_modalities)!=null&&be.includes("image")?" on":""),children:"vision"}),(qe=k==null?void 0:k.datacenters)==null?void 0:qe.map(q=>s.jsx("span",{className:"badge",children:q.country_code},q.country_code))]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Security preset"}),s.jsxs("select",{value:(_e==null?void 0:_e.id)??"custom",onChange:q=>{const Re=$f.find(He=>He.id===q.target.value);Re&&oe("system",Re.system)},children:[s.jsx("option",{value:"custom",children:"Custom (your own system prompt)"}),$f.map(q=>s.jsx("option",{value:q.id,children:q.label},q.id))]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"System prompt"}),s.jsx("textarea",{value:S.system,onChange:q=>oe("system",q.target.value),placeholder:"Describe the bot's personality, role, and rules…",style:{minHeight:110}})]}),s.jsx("div",{className:"section-title",children:"Generation"}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Temperature"}),s.jsxs("div",{className:"range-row",children:[s.jsx("input",{type:"range",min:0,max:2,step:.05,value:S.temperature,onChange:q=>oe("temperature",Number(q.target.value))}),s.jsx("span",{className:"range-val",children:S.temperature.toFixed(2)})]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Top P"}),s.jsxs("div",{className:"range-row",children:[s.jsx("input",{type:"range",min:0,max:1,step:.05,value:S.topP,onChange:q=>oe("topP",Number(q.target.value))}),s.jsx("span",{className:"range-val",children:S.topP.toFixed(2)})]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Max output tokens"}),s.jsxs("div",{className:"range-row",children:[s.jsx("input",{type:"range",min:64,max:(k==null?void 0:k.max_output_length)??4096,step:64,value:Math.min(S.maxTokens,(k==null?void 0:k.max_output_length)??4096),onChange:q=>oe("maxTokens",Number(q.target.value))}),s.jsx("span",{className:"range-val",children:S.maxTokens})]})]}),bt&&s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"reasoning-effort",children:"Reasoning effort"}),s.jsxs("select",{id:"reasoning-effort",value:S.reasoningEffort??"",onChange:q=>oe("reasoningEffort",q.target.value),children:[s.jsx("option",{value:"",children:"Model default"}),Uv.map(q=>s.jsx("option",{value:q,children:B1[q]},q))]}),s.jsx("span",{className:"hint",children:"Reasoning counts against Max output tokens. Lower effort answers sooner and leaves more of the limit for the answer."})]}),s.jsx(vc,{label:"Stream responses",sub:"Token-by-token output via SSE",checked:S.stream,onChange:q=>oe("stream",q)}),s.jsx(vc,{label:"JSON mode",sub:Ze?"Force valid JSON output":"Not supported by this model",checked:S.jsonMode&&Ze,disabled:!Ze,onChange:q=>oe("jsonMode",q)}),s.jsxs("div",{className:"section-title",children:["Tools ",ke?"":"(model has no tool support)"]}),S.tools.map((q,Re)=>s.jsxs("div",{className:"tool-card",children:[s.jsxs("div",{className:"tc-head",children:[s.jsx("input",{type:"text",value:q.function.name,placeholder:"function_name",onChange:He=>he(Re,{name:He.target.value})}),s.jsx("button",{className:"btn danger",onClick:()=>g(He=>({...He,tools:He.tools.filter((pt,Ve)=>Ve!==Re)})),children:"✕"})]}),s.jsx("input",{type:"text",value:q.function.description??"",placeholder:"description",style:{marginBottom:8},onChange:He=>he(Re,{description:He.target.value})}),s.jsx("textarea",{defaultValue:JSON.stringify(q.function.parameters??{},null,2),onChange:He=>Be(Re,He.target.value),spellCheck:!1}),s.jsx("div",{className:"hint",children:"JSON Schema for the function parameters."})]},q.id??Re)),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn block ghost mini",disabled:!ke,onClick:()=>g(q=>({...q,tools:[...q.tools,{...structuredClone(I1),id:Uf()}]})),children:"+ Add tool"}),s.jsx("button",{className:"btn block ghost mini",onClick:le,title:"Import tools from web/public/example-tools.json",children:"↓ Load example tools"})]}),Ce&&s.jsx("div",{className:"hint",style:{color:Ce.startsWith("Loaded")?"var(--accent-2)":"var(--muted-2)"},children:Ce}),s.jsx("div",{className:"section-title",children:"Knowledge (RAG)"}),s.jsx(vc,{label:"Ground answers in knowledge",sub:Y.length?`Retrieve from ${Y.length} doc${Y.length>1?"s":""} via embeddings`:"Add a document to enable",checked:S.useKnowledge&&Y.length>0,disabled:Y.length===0,onChange:q=>oe("useKnowledge",q)}),Y.map(q=>s.jsxs("div",{className:"tool-card",style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[s.jsxs("div",{style:{minWidth:0},children:[s.jsx("div",{style:{fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:q.name}),s.jsxs("div",{className:"hint",style:{margin:0},children:[q.chunks," chunks · ",q.chars.toLocaleString()," chars"]})]}),s.jsx("button",{className:"btn danger",onClick:()=>ce(q.id),children:"✕"})]},q.id)),s.jsxs("div",{className:"field",style:{marginTop:10},children:[s.jsx("input",{type:"text",placeholder:"Document name (optional)",value:X,onChange:q=>F(q.target.value),style:{marginBottom:8}}),s.jsx("textarea",{placeholder:"Paste text to give your bot a knowledge base…",value:ie,onChange:q=>G(q.target.value),style:{minHeight:80}}),me&&s.jsx("div",{className:"hint",style:{color:"var(--danger)"},children:me}),s.jsx("button",{className:"btn block ghost mini",style:{marginTop:8},disabled:Q||!ie.trim(),onClick:te,children:Q?"Embedding…":"+ Add to knowledge base"})]}),s.jsx("div",{className:"section-title",children:"Voice"}),s.jsx(vc,{label:"Speak replies aloud",sub:"Browser text-to-speech",checked:S.speak,onChange:q=>oe("speak",q)}),s.jsxs("div",{className:"hint",children:[nh()?"Mic dictation available in the composer.":"Voice input not supported in this browser."," ","SCX-native audio (scx-tts/scx-stt) is gated on this tier."]}),s.jsx("div",{className:"section-title",children:"Saved chats"}),s.jsxs("label",{className:"hint",style:{display:"flex",gap:6,alignItems:"center",cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:S.saveSessions,onChange:q=>oe("saveSessions",q.target.checked)}),"Save chats on this runner, encrypted with your vault"]}),s.jsxs("div",{className:"btn-row",children:[s.jsx("button",{className:"btn block ghost",onClick:L,children:"+ New chat"}),s.jsx("button",{className:"btn block ghost",onClick:Te,title:"Download the bot settings as JSON",children:"Export settings"})]}),V.status&&s.jsx("div",{className:"hint",style:{color:V.status.ok?"var(--muted)":"var(--amber)"},children:V.status.text}),s.jsx(G1,{saved:V})]}),s.jsxs("div",{className:"sidebar-foot",children:[s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Flag format"}),s.jsx("input",{type:"text",value:z,placeholder:ki,spellCheck:!1,onChange:q=>{Z(q.target.value),z1(q.target.value)},title:"A regular expression. Anything matching it is highlighted in replies and tool output (CTFs, labs). Blank = the default: a short prefix before braces, e.g. flag{...}."}),z.trim()&&!r0(z)&&s.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:"Not a valid regular expression; the default is in use."})]}),s.jsx(zw,{}),de&&s.jsx("button",{className:"btn ghost sm block",onClick:Rw,children:"Sign out"}),s.jsxs("a",{className:"powered-by",href:"https://www.anthropic.com/claude/mythos",target:"_blank",rel:"noopener noreferrer","aria-label":"Reviewed by Claude Mythos 5.1",children:[s.jsx("span",{className:"powered-by-lead",children:"Reviewed by"}),s.jsx("img",{className:"powered-by-logo",src:"/claude-logo-ivory.svg",alt:"Claude",width:"83",height:"18"}),s.jsx("span",{className:"powered-by-model",children:"Mythos 5.1"})]})]})]})}function $1({runner:l,status:o,statusError:c,onOpen:u,onForget:d,sessions:h}){const[m,y]=A.useState(l.directory),[v,S]=A.useState(null),[g,b]=A.useState(!1),[x,k]=A.useState(!1),[L,V]=A.useState(!1),[z,Z]=A.useState(!1);A.useEffect(()=>y(l.directory),[l.directory]);async function oe(Y=m){if(Y.trim()){b(!0),S(null);try{u(await zv(Y))}catch(O){S(String(O.message??O))}finally{b(!1)}}}const de=l.recent.filter(Y=>Y!==l.directory),C=(o==null?void 0:o.models.filter(Y=>Y.id.startsWith("scx/")).length)??0;return s.jsxs("div",{className:"sidebar-body",children:[s.jsx("div",{className:"section-title",children:"Project"}),s.jsxs("div",{className:"field",children:[s.jsxs("form",{className:"dir-row",onSubmit:Y=>{Y.preventDefault(),oe()},children:[s.jsx("input",{type:"text",className:"mono",value:m,onChange:Y=>y(Y.target.value),placeholder:"C:\\code\\my-project",spellCheck:!1}),s.jsx("button",{className:"btn sm",type:"submit",disabled:g||!m.trim()||m===l.directory,children:"Open"})]}),v&&s.jsx("div",{className:"hint danger",children:v}),s.jsx("div",{className:"hint",children:"The agent reads, edits and runs commands in this folder. Switching folders starts a new session."}),s.jsxs("div",{className:"project-actions",children:[s.jsxs("button",{className:"btn sm gh-open",onClick:()=>V(!0),title:"Create, open or delete workspaces",children:[s.jsx(Ww,{size:13})," workspaces"]}),s.jsxs("button",{className:"btn sm gh-open",onClick:()=>Z(!0),disabled:!l.directory,title:"Browse, upload and download this project's files",children:[s.jsx(hh,{size:13})," files"]}),s.jsxs("button",{className:"btn sm gh-open",onClick:()=>k(!0),title:"Clone a repository into the workspace (read-only)",children:[s.jsx(Jv,{size:13})," clone from GitHub"]})]}),x&&s.jsx(m1,{onOpen:Y=>oe(Y),onClose:()=>k(!1)}),L&&s.jsx(p1,{current:l.directory,onOpen:Y=>oe(Y),onDeleted:d,onClose:()=>V(!1)}),z&&l.directory&&s.jsx(y1,{directory:l.directory,onClose:()=>Z(!1)})]}),de.length>0&&s.jsxs("div",{className:"field",children:[s.jsx("label",{children:"Recent"}),s.jsx("div",{className:"recent-list",children:de.map(Y=>s.jsxs("button",{className:"recent-item",onClick:()=>oe(Y),title:Y,children:[s.jsx("span",{className:"recent-name",children:Y.split(/[\\/]/).filter(Boolean).pop()}),s.jsx("span",{className:"recent-path mono",children:Y})]},Y))})]}),l.directory&&s.jsx(X1,{directory:l.directory,nav:h}),s.jsx("div",{className:"section-title",children:"Agents"}),s.jsxs("div",{className:"agent-info",children:[s.jsxs("div",{className:"ai-row",children:[s.jsx("span",{className:"ai-name",children:"build"}),s.jsx("span",{className:"hint",children:"edits & runs"})]}),s.jsx("div",{className:"hint ai-desc",children:"Every file edit and shell command waits for your approval."}),s.jsxs("div",{className:"ai-row",children:[s.jsx("span",{className:"ai-name",children:"plan"}),s.jsx("span",{className:"hint",children:"read-only"})]}),s.jsx("div",{className:"hint ai-desc",children:"Explores and reasons without changing anything."})]}),s.jsx("div",{className:"section-title",children:"Engine"}),c?s.jsx("div",{className:"hint danger",children:c}):s.jsxs("div",{className:"engine",children:[s.jsxs("div",{children:[s.jsx("span",{className:"muted",children:"Agent"}),s.jsx("span",{children:"OpenCode"})]}),s.jsxs("div",{children:[s.jsx("span",{className:"muted",children:"Provider"}),s.jsxs("span",{children:["SCX.ai · ",C," models"]})]}),s.jsxs("div",{children:[s.jsx("span",{className:"muted",children:"Default"}),s.jsx("span",{className:"mono",children:(o==null?void 0:o.defaultModel)??"…"})]})]})]})}function G1({saved:l}){const[o,c]=A.useState(null),[u,d]=A.useState(!1);A.useEffect(()=>{if(!o)return;const y=setTimeout(()=>c(null),3e3);return()=>clearTimeout(y)},[o]);const h=l.list??[];if(l.list&&!h.length)return s.jsx("div",{className:"hint",children:"No saved chats yet."});const m=u?h:h.slice(0,8);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"session-list",children:m.map(y=>s.jsxs("div",{className:"session-item"+(y.id===l.activeId?" on":""),children:[s.jsxs("button",{className:"session-open",onClick:()=>l.onOpen(y.id),title:y.title,children:[s.jsx("span",{className:"session-title",children:y.title||"Untitled chat"}),s.jsx("span",{className:"session-meta",children:u0(Date.parse(y.updatedAt))})]}),s.jsx("button",{className:"session-del"+(o===y.id?" confirm":""),onClick:()=>{if(o!==y.id)return c(y.id);c(null),l.onDelete(y.id)},title:o===y.id?"Click again to delete":"Delete chat","aria-label":o===y.id?"Confirm delete":"Delete chat",children:o===y.id?"Delete?":"✕"})]},y.id))}),h.length>8&&s.jsx("button",{className:"btn ghost sm block",onClick:()=>d(y=>!y),children:u?"Show fewer":`Show all ${h.length}`})]})}function X1({directory:l,nav:o}){const[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(null),[v,S]=A.useState(!1);A.useEffect(()=>{let x=!0;return LS(l).then(k=>{x&&(u(k),h(null))}).catch(k=>x&&h(String(k.message??k))),()=>{x=!1}},[l,o.version,o.active]),A.useEffect(()=>{if(!m)return;const x=setTimeout(()=>y(null),3e3);return()=>clearTimeout(x)},[m]);async function g(x){if(m!==x){y(x);return}y(null);try{await US(x,l),o.active===x&&o.open(null),u(k=>(k==null?void 0:k.filter(L=>L.id!==x))??null)}catch(k){h(String(k.message??k))}}const b=v?c??[]:(c??[]).slice(0,8);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"section-title",children:"Sessions"}),s.jsx("button",{className:"btn ghost sm block new-session",onClick:()=>o.open(null),children:"+ New session"}),d&&s.jsx("div",{className:"hint danger",children:d}),c&&c.length===0&&s.jsx("div",{className:"hint",children:"No past sessions in this folder yet."}),s.jsx("div",{className:"session-list",children:b.map(x=>s.jsxs("div",{className:"session-item"+(x.id===o.active?" on":""),children:[s.jsxs("button",{className:"session-open",onClick:()=>o.open(x.id),title:x.title,children:[s.jsx("span",{className:"session-title",children:x.title||"Untitled session"}),s.jsxs("span",{className:"session-meta",children:[u0(x.updated),x.files>0&&s.jsxs(s.Fragment,{children:[" · ",s.jsxs("span",{className:"adds",children:["+",x.additions]})," ",s.jsxs("span",{className:"dels",children:["−",x.deletions]})]})]})]}),s.jsx("button",{className:"session-del"+(m===x.id?" confirm":""),onClick:()=>g(x.id),title:m===x.id?"Click again to delete":"Delete session","aria-label":m===x.id?"Confirm delete":"Delete session",children:m===x.id?"Delete?":"✕"})]},x.id))}),c&&c.length>8&&s.jsx("button",{className:"btn ghost sm block",onClick:()=>S(x=>!x),children:v?"Show fewer":`Show all ${c.length}`})]})}function u0(l){if(!l)return"";const o=Math.max(0,(Date.now()-l)/1e3);return o<60?"just now":o<3600?`${Math.floor(o/60)}m ago`:o<86400?`${Math.floor(o/3600)}h ago`:o<7*86400?`${Math.floor(o/86400)}d ago`:new Date(l).toLocaleDateString()}function vc({label:l,sub:o,checked:c,onChange:u,disabled:d}){return s.jsxs("div",{className:"toggle",children:[s.jsxs("div",{className:"tg-label",children:[l,o&&s.jsx("small",{children:o})]}),s.jsxs("label",{className:"switch"+(d?" disabled":""),children:[s.jsx("input",{type:"checkbox",checked:c,disabled:d,onChange:h=>u(h.target.checked)}),s.jsx("span",{})]})]})}function d0({text:l}){const o=ph(),c=A.useMemo(()=>H1(l,o),[l,o]);return c.length===1?s.jsx(s.Fragment,{children:l}):s.jsx(s.Fragment,{children:c.map((u,d)=>d%2?s.jsx("mark",{className:"flag",children:u},d):u)})}const Y1=512*1024,Vy=5,V1=".md,.markdown,.txt,text/markdown,text/plain";function Q1(l,o=""){return/\.(md|markdown|txt)$/i.test(l)?!0:o==="text/markdown"||o==="text/plain"}function K1(l){return/[\u0000-\u0008\u000E-\u001A]/.test(l.slice(0,8192))}const Z1=5*1024*1024,Nf=4,P1=3*1024*1024-2048,Qy=3,gh=`image/*,.drawio,.xml,.svg,${V1}`;function F1(l){return new Promise((o,c)=>{const u=new FileReader;u.onload=()=>o(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(l)})}const J1=l=>/\.drawio(\.(svg|xml))?$/i.test(l)||/\.xml$/i.test(l);async function W1(l){if(/\.drawio\.png$/i.test(l.name))return!1;if(J1(l.name))return!0;if(l.type==="image/svg+xml"||/\.svg$/i.test(l.name)){const o=await l.slice(0,4096).text();return/content="[^"]*(mxfile|mxGraphModel)/.test(o)||/&lt;mxfile/.test(o)}return!1}async function eA(l){var u;const o=await fetch("/api/render/outline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:await l.text()})}),c=await o.json().catch(()=>({}));if(!o.ok)throw new Error(((u=c==null?void 0:c.error)==null?void 0:u.message)||`Reading ${l.name} failed (${o.status})`);return{name:l.name,text:c.outline,pages:c.pages}}function yh(){const[l,o]=A.useState([]),[c,u]=A.useState([]),[d,h]=A.useState(0),[m,y]=A.useState(null);async function v(b){y(null);const x=Array.from(b),k=[],L=[],V=[];for(const z of x)if(await W1(z))L.push(z);else if(z.type.startsWith("image/"))z.size>Z1?y(`${z.name} is over 5 MB.`):k.push({name:z.name||"pasted-image.png",url:await F1(z)});else if(Q1(z.name,z.type)){if(z.size>Y1){y(`${z.name} is over 512 KB.`);continue}const Z=await z.text();K1(Z)?y(`${z.name} is not a text file.`):Z.trim()?V.push({name:z.name||"pasted-text.txt",text:Z,kind:"text"}):y(`${z.name} is empty.`)}else y(`${z.name}: attach images, draw.io files (.drawio, .drawio.svg), or Markdown / text files (.md, .txt).`);V.length&&u(z=>{const Z=Vy-z.filter(oe=>oe.kind==="text").length;return V.length>Z&&y(`Up to ${Vy} text files per message.`),[...z,...V.slice(0,Math.max(0,Z))]}),o(z=>{const Z=[...z,...k];return Z.length>Nf&&y(`Up to ${Nf} images per message.`),Z.slice(0,Nf)});for(const z of L){if(z.size>P1){y(`${z.name} is over 3 MB.`);continue}h(Z=>Z+1);try{const Z=await eA(z);u(oe=>oe.filter(de=>de.kind!=="text").length>=Qy?(y(`Up to ${Qy} diagrams per message.`),oe):[...oe,Z])}catch(Z){y(String(Z.message??Z))}finally{h(Z=>Z-1)}}}function S(b){const x=Array.from(b.clipboardData.files);x.length&&(b.preventDefault(),v(x))}function g(b){b.dataTransfer.files.length&&(b.preventDefault(),v(b.dataTransfer.files))}return{images:l,docs:c,reading:d>0,attachError:m,addImages:v,onPaste:S,onDrop:g,remove:b=>o(x=>x.filter((k,L)=>L!==b)),removeDoc:b=>u(x=>x.filter((k,L)=>L!==b)),clear:()=>{o([]),u([]),y(null)}}}function vh({images:l,docs:o=[],onRemove:c,onRemoveDoc:u,reading:d}){return!l.length&&!o.length&&!d?null:s.jsxs("div",{className:"attach-row",children:[l.map((h,m)=>s.jsxs("span",{className:"attach-chip",title:h.name,children:[s.jsx("img",{src:h.url,alt:""}),s.jsx("span",{className:"attach-name",children:h.name}),s.jsx("button",{className:"attach-x",onClick:()=>c(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`i${m}`)),o.map((h,m)=>s.jsxs("span",{className:"attach-chip doc",title:h.kind==="text"?`${h.name}: attached as text (${h.text.length.toLocaleString()} characters)`:`${h.name}: read as an exact outline (${h.text.length.toLocaleString()} characters${h.pages&&h.pages.length>1?`, ${h.pages.length} pages`:""})`,children:[s.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),s.jsx("span",{className:"attach-name",children:h.name}),u&&s.jsx("button",{className:"attach-x",onClick:()=>u(m),"aria-label":`Remove ${h.name}`,children:"✕"})]},`d${m}`)),d&&s.jsx("span",{className:"attach-chip doc",children:s.jsx("span",{className:"attach-name",children:"reading diagram…"})})]})}function bh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ns=bh();function f0(l){Ns=l}var Ss={exec:()=>null};function mi(l){let o=[];return c=>{let u=Math.max(0,Math.min(3,c-1)),d=o[u];return d||(d=l(u),o[u]=d),d}}function We(l,o=""){let c=typeof l=="string"?l:l.source,u={replace:(d,h)=>{let m=typeof h=="string"?h:h.source;return m=m.replace(mn.caret,"$1"),c=c.replace(d,m),u},getRegex:()=>new RegExp(c,o)};return u}var tA=((l="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+l)}catch{return!1}})(),mn={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:l=>new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:mi(l=>new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:mi(l=>new RegExp(`^ {0,${l}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:mi(l=>new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)),headingBeginRegex:mi(l=>new RegExp(`^ {0,${l}}#`)),htmlBeginRegex:mi(l=>new RegExp(`^ {0,${l}}(?:</?(?:${$o})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,"i")),blockquoteBeginRegex:mi(l=>new RegExp(`^ {0,${l}}>`))},nA=/^(?:[ \t]*(?:\n|$))+/,aA=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lA=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sA=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xh=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,h0=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,m0=We(h0).replace(/bull/g,xh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),iA=We(h0).replace(/bull/g,xh).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,oA=/^[^\n]+/,wh=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,rA=We(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cA=We(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,xh).getRegex(),$o="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ah=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,uA=We("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ah).replace("tag",$o).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),p0=l=>We(Sh).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",l).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),dA=p0(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),fA=p0(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),hA=We(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fA).getRegex(),Th={blockquote:hA,code:aA,def:rA,fences:lA,heading:sA,hr:qo,html:uA,lheading:m0,list:cA,newline:nA,paragraph:dA,table:Ss,text:oA},Ky=We("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),mA={...Th,lheading:iA,table:Ky,paragraph:We(Sh).replace("hr",qo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ky).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex()},pA={...Th,html:We(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ah).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ss,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:We(Sh).replace("hr",qo).replace("heading",` *#{1,6} *[^
160
+ ]`).replace("lheading",m0).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},gA=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,yA=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,g0=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,vA=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,fl=/[\p{P}\p{S}]/u,ji=/[\s\p{P}\p{S}]/u,Go=/[^\s\p{P}\p{S}]/u,bA=We(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ji).getRegex(),xA=/[\p{Pi}\p{Ps}"']/u,y0=/(?!~)[\p{P}\p{S}]/u,SA=/(?!~)[\s\p{P}\p{S}]/u,wA=/(?:[^\s\p{P}\p{S}]|~)/u,AA=We(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",tA?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),v0=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,TA=We(v0,"u").replace(/punct/g,fl).getRegex(),kA=We(v0,"u").replace(/punct/g,y0).getRegex(),jA=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,NA=We(jA,"u").replace(/openQuote/g,xA).replace(/punct/g,fl).getRegex(),b0="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",EA=We(b0,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),CA=We(b0,"gu").replace(/notPunctSpace/g,wA).replace(/punctSpace/g,SA).replace(/punct/g,y0).getRegex(),MA="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",_A=We(MA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),RA=We("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),OA="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",DA=We(OA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),LA=We(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,fl).getRegex(),zA="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",UA=We(zA,"gu").replace(/notPunctSpace/g,Go).replace(/punctSpace/g,ji).replace(/punct/g,fl).getRegex(),HA=We(/\\(punct)/,"gu").replace(/punct/g,fl).getRegex(),BA=We(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),IA=We(Ah).replace("(?:-->|$)","-->").getRegex(),qA=We("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",IA).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),x0=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,zc=We(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",x0).getRegex(),$A=We(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",zc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),GA=We(/^!?\[(label)\]\[(ref)\]/).replace("label",zc).replace("ref",wh).getRegex(),XA=We(/^!?\[(ref)\](?:\[\])?/).replace("ref",wh).getRegex(),Zy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,YA=We(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",x0).getRegex(),VA=We("reflink|nolink(?!\\()","g").replace("reflink",We(/^!?\[(label)\]\[(ref)\]/).replace("label",YA).replace("ref",Zy).getRegex()).replace("nolink",We(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zy).getRegex()).getRegex(),Py=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,QA=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,KA=We(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,QA).getRegex(),kh={_backpedal:Ss,anyPunctuation:HA,autolink:BA,blockSkip:AA,br:g0,code:yA,del:Ss,delLDelim:Ss,delRDelim:Ss,emStrongLDelim:TA,emStrongRDelimAst:EA,emStrongRDelimUnd:RA,escape:gA,link:$A,nolink:XA,punctuation:bA,reflink:GA,reflinkSearch:VA,tag:qA,text:vA,url:Ss},ZA={...kh,emStrongLDelim:NA,emStrongRDelimAst:_A,emStrongRDelimUnd:DA,link:We(/^!?\[(label)\]\((.*?)\)/).replace("label",zc).getRegex(),reflink:We(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zc).getRegex()},Xf={...kh,emStrongRDelimAst:CA,emStrongLDelim:kA,delLDelim:LA,delRDelim:UA,url:We(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",KA).replace("protocol",Py).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:We(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",Py).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},PA={...Xf,br:We(g0).replace("{2,}","*").getRegex(),text:We(Xf.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},bc={normal:Th,gfm:mA,pedantic:pA},bo={normal:kh,gfm:Xf,breaks:PA,pedantic:ZA},FA={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Fy=l=>FA[l];function Fn(l,o){if(o){if(mn.escapeTest.test(l))return l.replace(mn.escapeReplace,Fy)}else if(mn.escapeTestNoEncode.test(l))return l.replace(mn.escapeReplaceNoEncode,Fy);return l}function JA(l){return l.replace(mn.numericCharacterReference,(o,c,u)=>{let d=c===void 0?Number.parseInt(u,16):Number.parseInt(c,10);return d===0||d>1114111||d>=55296&&d<=57343?"�":String.fromCodePoint(d)})}function Jy(l){try{l=encodeURI(l).replace(mn.percentDecode,"%")}catch{return null}return l}function Wy(l,o){var h;let c=l.replace(mn.findPipe,(m,y,v)=>{let S=!1,g=y;for(;--g>=0&&v[g]==="\\";)S=!S;return S?"|":" |"}),u=c.split(mn.splitPipe),d=0;if(u[0].trim()||u.shift(),u.length>0&&!((h=u.at(-1))!=null&&h.trim())&&u.pop(),o)if(u.length>o)u.splice(o);else for(;u.length<o;)u.push("");for(;d<u.length;d++)u[d]=u[d].trim().replace(mn.slashPipe,"|");return u}function $l(l,o,c){let u=l.length;if(u===0)return"";let d=0;for(;d<u&&l.charAt(u-d-1)===o;)d++;return l.slice(0,u-d)}function ev(l){let o=l.split(`
161
161
  `),c=o.length-1;for(;c>=0&&mn.blankLine.test(o[c]);)c--;return o.length-c<=2?l:o.slice(0,c+1).join(`
162
- `)}function Uc(l){return l.trim().toLowerCase().toUpperCase().toLowerCase()}function tv(l,o){if(l.indexOf(o[0])===-1&&l.indexOf(o[1])===-1)return-1;let c=0;for(let u=0;u<l.length;u++)if(l[u]==="\\")u++;else if(l[u]===o[0])c++;else if(l[u]===o[1]&&(c--,c<0))return u;return c>0?-2:-1}function nv(l,o=0){let c=o,u="";for(let d of l)if(d===" "){let h=4-c%4;u+=" ".repeat(h),c+=h}else u+=d,c++;return u}function av(l,o,c,u,d){let h=o.href,m=o.title||null,y=l[1].replace(d.other.outputLinkReplace,"$1"),v=l[0].charAt(0)==="!";u.state.inLink=!0;let S=u.state.linkEmitted,g=u.state.inRawBlock;u.state.linkEmitted=!1;let b=u.inlineTokens(y),x=u.state.linkEmitted;if(u.state.linkEmitted=S,u.state.inLink=!1,!v){if(x){u.state.inRawBlock=g;return}u.state.linkEmitted=!0}return{type:v?"image":"link",raw:c,href:h,title:m,text:y,tokens:b}}function FA(l,o,c){let u=l.match(c.other.indentCodeCompensation);if(u===null)return o;let d=u[1];return o.split(`
162
+ `)}function Uc(l){return l.trim().toLowerCase().toUpperCase().toLowerCase()}function tv(l,o){if(l.indexOf(o[0])===-1&&l.indexOf(o[1])===-1)return-1;let c=0;for(let u=0;u<l.length;u++)if(l[u]==="\\")u++;else if(l[u]===o[0])c++;else if(l[u]===o[1]&&(c--,c<0))return u;return c>0?-2:-1}function nv(l,o=0){let c=o,u="";for(let d of l)if(d===" "){let h=4-c%4;u+=" ".repeat(h),c+=h}else u+=d,c++;return u}function av(l,o,c,u,d){let h=o.href,m=o.title||null,y=l[1].replace(d.other.outputLinkReplace,"$1"),v=l[0].charAt(0)==="!";u.state.inLink=!0;let S=u.state.linkEmitted,g=u.state.inRawBlock;u.state.linkEmitted=!1;let b=u.inlineTokens(y),x=u.state.linkEmitted;if(u.state.linkEmitted=S,u.state.inLink=!1,!v){if(x){u.state.inRawBlock=g;return}u.state.linkEmitted=!0}return{type:v?"image":"link",raw:c,href:h,title:m,text:y,tokens:b}}function WA(l,o,c){let u=l.match(c.other.indentCodeCompensation);if(u===null)return o;let d=u[1];return o.split(`
163
163
  `).map(h=>{let m=h.match(c.other.beginningSpace);if(m===null)return h;let[y]=m;return h.slice(Math.min(y.length,d.length))}).join(`
164
- `)}function lv(l,o,c,u){if(!o.includes("<"))return!1;for(let d=0;d<o.length;d++){if(o[d]==="\\"){d++;continue}if(o[d]==="`"){let y=u.inline.code.exec(o.slice(d));if(y){d+=y[0].length-1;continue}}if(o[d]!=="<")continue;let h=l.slice(c+d),m=u.inline.tag.exec(h)||u.inline.autolink.exec(h);if(m){if(m[0].length>o.length-d)return!0;d+=m[0].length-1}}return!1}var Hc=class{constructor(l){Ct(this,"options");Ct(this,"rules");Ct(this,"lexer");this.options=l||Ns}space(l){let o=this.rules.block.newline.exec(l);if(o&&o[0].length>0)return{type:"space",raw:o[0]}}code(l){let o=this.rules.block.code.exec(l);if(o){let c=this.options.pedantic?o[0]:ev(o[0]),u=c.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:c,codeBlockStyle:"indented",text:u}}}fences(l){let o=this.rules.block.fences.exec(l);if(o){let c=o[0],u=FA(c,o[3]||"",this.rules);return{type:"code",raw:c,lang:o[2]?o[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):o[2],text:u}}}heading(l){let o=this.rules.block.heading.exec(l);if(o){let c=o[2].trim();if(this.rules.other.endingHash.test(c)){let u=$l(c,"#");(this.options.pedantic||!u||this.rules.other.endingSpaceTabChar.test(u))&&(c=u.trim())}return{type:"heading",raw:$l(o[0],`
164
+ `)}function lv(l,o,c,u){if(!o.includes("<"))return!1;for(let d=0;d<o.length;d++){if(o[d]==="\\"){d++;continue}if(o[d]==="`"){let y=u.inline.code.exec(o.slice(d));if(y){d+=y[0].length-1;continue}}if(o[d]!=="<")continue;let h=l.slice(c+d),m=u.inline.tag.exec(h)||u.inline.autolink.exec(h);if(m){if(m[0].length>o.length-d)return!0;d+=m[0].length-1}}return!1}var Hc=class{constructor(l){Ct(this,"options");Ct(this,"rules");Ct(this,"lexer");this.options=l||Ns}space(l){let o=this.rules.block.newline.exec(l);if(o&&o[0].length>0)return{type:"space",raw:o[0]}}code(l){let o=this.rules.block.code.exec(l);if(o){let c=this.options.pedantic?o[0]:ev(o[0]),u=c.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:c,codeBlockStyle:"indented",text:u}}}fences(l){let o=this.rules.block.fences.exec(l);if(o){let c=o[0],u=WA(c,o[3]||"",this.rules);return{type:"code",raw:c,lang:o[2]?o[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):o[2],text:u}}}heading(l){let o=this.rules.block.heading.exec(l);if(o){let c=o[2].trim();if(this.rules.other.endingHash.test(c)){let u=$l(c,"#");(this.options.pedantic||!u||this.rules.other.endingSpaceTabChar.test(u))&&(c=u.trim())}return{type:"heading",raw:$l(o[0],`
165
165
  `),depth:o[1].length,text:c,tokens:this.lexer.inline(c)}}}hr(l){let o=this.rules.block.hr.exec(l);if(o)return{type:"hr",raw:$l(o[0],`
166
166
  `)}}blockquote(l){let o=this.rules.block.blockquote.exec(l);if(o){let c=$l(o[0],`
167
167
  `).split(`
@@ -169,27 +169,27 @@ For an attack path use kind: actor for the attacker, step for each stage, and pu
169
169
  `),g=S.replace(this.rules.other.blockquoteSetextReplace,`
170
170
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");u=u?`${u}
171
171
  ${S}`:S,d=d?`${d}
172
- ${g}`:g;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,h,!0),this.lexer.state.top=b,c.length===0)break;let x=h.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let k=x,D=c.join(`
172
+ ${g}`:g;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(g,h,!0),this.lexer.state.top=b,c.length===0)break;let x=h.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let k=x,L=c.join(`
173
173
  `),V=k.raw+`
174
- `+D.replace(this.rules.other.blockquoteSetextReplace2,""),L=this.blockquote(V);h[h.length-1]=L;let K=V.substring(L.raw.length).replace(/^\n/,""),ce=K?K.split(`
175
- `).length:0,de=ce?c.slice(0,-ce):c;de.length>0&&(u=`${u}
174
+ `+L.replace(this.rules.other.blockquoteSetextReplace2,""),z=this.blockquote(V);h[h.length-1]=z;let Z=V.substring(z.raw.length).replace(/^\n/,""),oe=Z?Z.split(`
175
+ `).length:0,de=oe?c.slice(0,-oe):c;de.length>0&&(u=`${u}
176
176
  ${de.join(`
177
- `)}`),d=d.substring(0,d.length-k.text.length)+L.text;break}else if((x==null?void 0:x.type)==="list"){let k=x,D=k.raw+`
177
+ `)}`),d=d.substring(0,d.length-k.text.length)+z.text;break}else if((x==null?void 0:x.type)==="list"){let k=x,L=k.raw+`
178
178
  `+c.join(`
179
- `),V=this.list(D);h[h.length-1]=V,u=u.substring(0,u.length-x.raw.length)+V.raw,d=d.substring(0,d.length-k.raw.length)+V.raw,c=D.substring(h.at(-1).raw.length).split(`
179
+ `),V=this.list(L);h[h.length-1]=V,u=u.substring(0,u.length-x.raw.length)+V.raw,d=d.substring(0,d.length-k.raw.length)+V.raw,c=L.substring(h.at(-1).raw.length).split(`
180
180
  `);continue}}return{type:"blockquote",raw:u,tokens:h,text:d}}}list(l){let o=this.rules.block.list.exec(l);if(o){let c=o[1].trim(),u=c.length>1,d={type:"list",raw:"",ordered:u,start:u?+c.slice(0,-1):"",loose:!1,items:[]};c=u?`\\d{1,9}\\${c.slice(-1)}`:`\\${c}`,this.options.pedantic&&(c=u?c:"[*+-]");let h=this.rules.other.listItemRegex(c),m=!1;for(;l;){let v=!1,S="",g="";if(!(o=h.exec(l))||this.rules.block.hr.test(l))break;S=o[0],l=l.substring(S.length);let b=o[2].split(`
181
- `,1)[0],x=o[1].length,k=this.options.pedantic?nv(b,x):b.replace(this.rules.other.leadingSpaceTab,K=>nv(K,x)),D=l.split(`
182
- `,1)[0],V=!k.trim(),L=0;if(this.options.pedantic?(L=2,g=k.trimStart()):V?L=x+1:(L=k.search(this.rules.other.nonSpaceChar),L=L>4?1:L,g=k.slice(L),L+=x),V&&this.rules.other.blankLine.test(D)&&(S+=D+`
183
- `,l=l.substring(D.length+1),v=!0),!v){let K=this.rules.other.nextBulletRegex(L),ce=this.rules.other.hrRegex(L),de=this.rules.other.fencesBeginRegex(L),E=this.rules.other.headingBeginRegex(L),G=this.rules.other.htmlBeginRegex(L),H=this.rules.other.blockquoteBeginRegex(L);for(;l;){let Y=l.split(`
184
- `,1)[0],F;if(D=Y,this.options.pedantic?(D=D.replace(this.rules.other.listReplaceNesting," "),F=D):F=D.replace(this.rules.other.leadingSpaceTab,ie=>ie.replace(this.rules.other.tabCharGlobal," ")),de.test(D)||E.test(D)||G.test(D)||H.test(D)||K.test(D)||ce.test(D))break;if(F.search(this.rules.other.nonSpaceChar)>=L||!D.trim())g+=`
185
- `+F.slice(L);else{if(V||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||de.test(k)||E.test(k)||ce.test(k))break;g+=`
186
- `+D}V=!D.trim(),S+=Y+`
187
- `,l=l.substring(Y.length+1),k=F.slice(L)}}d.loose||(m?d.loose=!0:this.rules.other.doubleBlankLine.test(S)&&(m=!0)),d.items.push({type:"list_item",raw:S,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),d.raw+=S}let y=d.items.at(-1);if(y)y.raw=y.raw.trimEnd(),y.text=y.text.trimEnd();else return;d.raw=d.raw.trimEnd();for(let v of d.items)if(this.lexer.state.top=!1,v.tokens=this.lexer.blockTokens(v.text,[]),!d.loose){let S=v.tokens.filter(b=>b.type==="space"),g=S.length>0&&S.some(b=>this.rules.other.anyLine.test(b.raw));d.loose=g}for(let v of d.items){let S=v.tokens[0];if(v.task&&((S==null?void 0:S.type)==="text"||(S==null?void 0:S.type)==="paragraph")){v.text=v.text.replace(this.rules.other.listReplaceTask,""),S.raw=S.raw.replace(this.rules.other.listReplaceTask,""),S.text=S.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let g=this.rules.other.listTaskCheckbox.exec(v.raw);if(g){let b={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};v.checked=b.checked,d.loose?v.tokens[0]&&["paragraph","text"].includes(v.tokens[0].type)&&"tokens"in v.tokens[0]&&v.tokens[0].tokens?(v.tokens[0].raw=b.raw+v.tokens[0].raw,v.tokens[0].text=b.raw+v.tokens[0].text,v.tokens[0].tokens.unshift(b)):v.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):v.tokens.unshift(b)}}else v.task&&(v.task=!1)}if(d.loose)for(let v of d.items){v.loose=!0;for(let S of v.tokens)S.type==="text"&&(S.type="paragraph")}return d}}html(l){let o=this.rules.block.html.exec(l);if(o){let c=ev(o[0]);return{type:"html",block:!0,raw:c,pre:o[1]==="pre"||o[1]==="script"||o[1]==="style",text:c}}}def(l){let o=this.rules.block.def.exec(l);if(o){if(!this.rules.other.startAngleBracket.test(o[2])&&tv(o[2],"()")!==-1)return;let c=Uc(o[1]).replace(this.rules.other.multipleSpaceGlobal," "),u=o[2]?o[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=o[3]?o[3].substring(1,o[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):o[3];return{type:"def",tag:c,raw:$l(o[0],`
181
+ `,1)[0],x=o[1].length,k=this.options.pedantic?nv(b,x):b.replace(this.rules.other.leadingSpaceTab,Z=>nv(Z,x)),L=l.split(`
182
+ `,1)[0],V=!k.trim(),z=0;if(this.options.pedantic?(z=2,g=k.trimStart()):V?z=x+1:(z=k.search(this.rules.other.nonSpaceChar),z=z>4?1:z,g=k.slice(z),z+=x),V&&this.rules.other.blankLine.test(L)&&(S+=L+`
183
+ `,l=l.substring(L.length+1),v=!0),!v){let Z=this.rules.other.nextBulletRegex(z),oe=this.rules.other.hrRegex(z),de=this.rules.other.fencesBeginRegex(z),C=this.rules.other.headingBeginRegex(z),Y=this.rules.other.htmlBeginRegex(z),O=this.rules.other.blockquoteBeginRegex(z);for(;l;){let X=l.split(`
184
+ `,1)[0],F;if(L=X,this.options.pedantic?(L=L.replace(this.rules.other.listReplaceNesting," "),F=L):F=L.replace(this.rules.other.leadingSpaceTab,ie=>ie.replace(this.rules.other.tabCharGlobal," ")),de.test(L)||C.test(L)||Y.test(L)||O.test(L)||Z.test(L)||oe.test(L))break;if(F.search(this.rules.other.nonSpaceChar)>=z||!L.trim())g+=`
185
+ `+F.slice(z);else{if(V||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||de.test(k)||C.test(k)||oe.test(k))break;g+=`
186
+ `+L}V=!L.trim(),S+=X+`
187
+ `,l=l.substring(X.length+1),k=F.slice(z)}}d.loose||(m?d.loose=!0:this.rules.other.doubleBlankLine.test(S)&&(m=!0)),d.items.push({type:"list_item",raw:S,task:!!this.options.gfm&&this.rules.other.listIsTask.test(g),loose:!1,text:g,tokens:[]}),d.raw+=S}let y=d.items.at(-1);if(y)y.raw=y.raw.trimEnd(),y.text=y.text.trimEnd();else return;d.raw=d.raw.trimEnd();for(let v of d.items)if(this.lexer.state.top=!1,v.tokens=this.lexer.blockTokens(v.text,[]),!d.loose){let S=v.tokens.filter(b=>b.type==="space"),g=S.length>0&&S.some(b=>this.rules.other.anyLine.test(b.raw));d.loose=g}for(let v of d.items){let S=v.tokens[0];if(v.task&&((S==null?void 0:S.type)==="text"||(S==null?void 0:S.type)==="paragraph")){v.text=v.text.replace(this.rules.other.listReplaceTask,""),S.raw=S.raw.replace(this.rules.other.listReplaceTask,""),S.text=S.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let g=this.rules.other.listTaskCheckbox.exec(v.raw);if(g){let b={type:"checkbox",raw:g[0]+" ",checked:g[0]!=="[ ]"};v.checked=b.checked,d.loose?v.tokens[0]&&["paragraph","text"].includes(v.tokens[0].type)&&"tokens"in v.tokens[0]&&v.tokens[0].tokens?(v.tokens[0].raw=b.raw+v.tokens[0].raw,v.tokens[0].text=b.raw+v.tokens[0].text,v.tokens[0].tokens.unshift(b)):v.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):v.tokens.unshift(b)}}else v.task&&(v.task=!1)}if(d.loose)for(let v of d.items){v.loose=!0;for(let S of v.tokens)S.type==="text"&&(S.type="paragraph")}return d}}html(l){let o=this.rules.block.html.exec(l);if(o){let c=ev(o[0]);return{type:"html",block:!0,raw:c,pre:o[1]==="pre"||o[1]==="script"||o[1]==="style",text:c}}}def(l){let o=this.rules.block.def.exec(l);if(o){if(!this.rules.other.startAngleBracket.test(o[2])&&tv(o[2],"()")!==-1)return;let c=Uc(o[1]).replace(this.rules.other.multipleSpaceGlobal," "),u=o[2]?o[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=o[3]?o[3].substring(1,o[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):o[3];return{type:"def",tag:c,raw:$l(o[0],`
188
188
  `),href:u,title:d}}}table(l){var m;let o=this.rules.block.table.exec(l);if(!o||!this.rules.other.tableDelimiter.test(o[2]))return;let c=Wy(o[1]),u=o[2].replace(this.rules.other.tableAlignChars,"").split("|"),d=(m=o[3])!=null&&m.trim()?o[3].replace(this.rules.other.tableRowBlankLine,"").split(`
189
189
  `):[],h={type:"table",raw:$l(o[0],`
190
190
  `),header:[],align:[],rows:[]};if(c.length===u.length){for(let y of u)this.rules.other.tableAlignRight.test(y)?h.align.push("right"):this.rules.other.tableAlignCenter.test(y)?h.align.push("center"):this.rules.other.tableAlignLeft.test(y)?h.align.push("left"):h.align.push(null);for(let y=0;y<c.length;y++)h.header.push({text:c[y],tokens:this.lexer.inline(c[y]),header:!0,align:h.align[y]});for(let y of d)h.rows.push(Wy(y,h.header.length).map((v,S)=>({text:v,tokens:this.lexer.inline(v),header:!1,align:h.align[S]})));return h}}lheading(l){let o=this.rules.block.lheading.exec(l);if(o){let c=o[1].trim();return{type:"heading",raw:$l(o[0],`
191
191
  `),depth:o[2].charAt(0)==="="?1:2,text:c,tokens:this.lexer.inline(c)}}}paragraph(l){let o=this.rules.block.paragraph.exec(l);if(o){let c=o[1].charAt(o[1].length-1)===`
192
- `?o[1].slice(0,-1):o[1];return{type:"paragraph",raw:o[0],text:c,tokens:this.lexer.inline(c)}}}text(l){let o=this.rules.block.text.exec(l);if(o)return{type:"text",raw:o[0],text:o[0],tokens:this.lexer.inline(o[0])}}escape(l){let o=this.rules.inline.escape.exec(l);if(o)return{type:"escape",raw:o[0],text:o[1]}}tag(l){let o=this.rules.inline.tag.exec(l);if(o)return!this.lexer.state.inLink&&this.rules.other.startATag.test(o[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(o[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(o[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(o[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:o[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:o[0]}}link(l){if(this.lexer.state.linkParenPossible===!1)return;let o=this.rules.inline.link.exec(l);if(o){let c=o[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&lv(l,o[1],c,this.rules))return;let u=o[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(u)){if(!this.rules.other.endAngleBracket.test(u))return;let m=$l(u.slice(0,-1),"\\");if((u.length-m.length)%2===0)return}else{let m=tv(o[2],"()");if(m===-2)return;if(m>-1){let y=(o[0].indexOf("!")===0?5:4)+o[1].length+m;o[2]=o[2].substring(0,m),o[0]=o[0].substring(0,y).trim(),o[3]=""}}let d=o[2],h="";if(this.options.pedantic){let m=this.rules.other.pedanticHrefTitle.exec(d);m&&(d=m[1],h=m[3])}else h=o[3]?o[3].slice(1,-1):"";return d=d.trim(),this.rules.other.startAngleBracket.test(d)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(u)?d=d.slice(1):d=d.slice(1,-1)),av(o,{href:d&&d.replace(this.rules.inline.anyPunctuation,"$1"),title:h&&h.replace(this.rules.inline.anyPunctuation,"$1")},o[0],this.lexer,this.rules)}}reflink(l,o){let c;if((c=this.rules.inline.reflink.exec(l))||(c=this.rules.inline.nolink.exec(l))){let u=c[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&lv(l,c[1],u,this.rules))return;let d=(c[2]||c[1]).replace(this.rules.other.multipleSpaceGlobal," "),h=o[Uc(d)];if(!h){let m=c[0].charAt(0);return{type:"text",raw:m,text:m}}return av(c,h,c[0],this.lexer,this.rules)}}emStrong(l,o,c=""){let u=this.rules.inline.emStrongLDelim.exec(l);if(!(!u||!u[1]&&!u[2]&&!u[3]&&!u[4]||u[4]&&c.match(this.rules.other.unicodeAlphaNumeric))&&(!(u[1]||u[3])||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,v=0,S=u[0][0],g=c===S,b=S==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,o=o.slice(-1*l.length+d);(u=b.exec(o))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h)continue;if(m=[...h].length,u[3]||u[4]){y+=m;continue}else if(u[5]||u[6]){if(d%3&&!((d+m)%3)){v+=m;continue}if(g)break}if(y-=m,y>0)continue;m=Math.min(m,m+y+v);let x=[...u[0]][0].length,k=l.slice(0,d+u.index+x+m);if(Math.min(d,m)%2){let V=k.slice(1,-1);return{type:"em",raw:k,text:V,tokens:this.lexer.inlineTokens(V)}}let D=k.slice(2,-2);return{type:"strong",raw:k,text:D,tokens:this.lexer.inlineTokens(D)}}}}codespan(l){let o=this.rules.inline.code.exec(l);if(o){let c=o[2].replace(this.rules.other.newLineCharGlobal," "),u=this.rules.other.nonSpaceChar.test(c),d=this.rules.other.startingSpaceChar.test(c)&&this.rules.other.endingSpaceChar.test(c);return u&&d&&(c=c.substring(1,c.length-1)),{type:"codespan",raw:o[0],text:c}}}br(l){let o=this.rules.inline.br.exec(l);if(o)return{type:"br",raw:o[0]}}del(l,o,c=""){let u=this.rules.inline.delLDelim.exec(l);if(u&&(!u[1]||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,v=this.rules.inline.delRDelim;for(v.lastIndex=0,o=o.slice(-1*l.length+d);(u=v.exec(o))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h||(m=[...h].length,m!==d))continue;if(u[3]||u[4]){y+=m;continue}if(y-=m,y>0)continue;m=Math.min(m,m+y);let S=[...u[0]][0].length,g=l.slice(0,d+u.index+S+m),b=g.slice(d,-d);return{type:"del",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(l){let o=this.rules.inline.autolink.exec(l);if(o){let c,u;return o[2]==="@"?(c=o[1],u="mailto:"+c):(c=o[1],u=c),{type:"link",raw:o[0],text:c,href:u,autolink:!0,tokens:[{type:"text",raw:c,text:c}]}}}url(l){var c;let o;if(o=this.rules.inline.url.exec(l)){let u,d;if(o[2]==="@")u=o[0],d="mailto:"+u;else{let h;do h=o[0],o[0]=((c=this.rules.inline._backpedal.exec(o[0]))==null?void 0:c[0])??"";while(h!==o[0]);u=o[0],o[1]==="www."?d="http://"+o[0]:d=o[0]}return{type:"link",raw:o[0],text:u,href:d,autolink:!0,tokens:[{type:"text",raw:u,text:u}]}}}inlineText(l){let o=this.rules.inline.text.exec(l);if(o){let c=this.lexer.state.inRawBlock;return{type:"text",raw:o[0],text:c?o[0]:ZA(o[0]),escaped:c}}}},Gc,b0,ws,Aa=(ws=class{constructor(o){Cy(this,Gc);Ct(this,"tokens");Ct(this,"options");Ct(this,"state");Ct(this,"inlineQueue");Ct(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=o||Ns,this.options.tokenizer=this.options.tokenizer||new Hc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let c={other:mn,block:bc.normal,inline:bo.normal};this.options.pedantic?(c.block=bc.pedantic,c.inline=bo.pedantic):this.options.gfm&&(c.block=bc.gfm,this.options.breaks?c.inline=bo.breaks:c.inline=bo.gfm),this.tokenizer.rules=c}static get rules(){return{block:bc,inline:bo}}static lex(o,c){return new ws(c).lex(o)}static lexInline(o,c){return new ws(c).inlineTokens(o)}lex(o){o=o.replace(mn.carriageReturn,`
192
+ `?o[1].slice(0,-1):o[1];return{type:"paragraph",raw:o[0],text:c,tokens:this.lexer.inline(c)}}}text(l){let o=this.rules.block.text.exec(l);if(o)return{type:"text",raw:o[0],text:o[0],tokens:this.lexer.inline(o[0])}}escape(l){let o=this.rules.inline.escape.exec(l);if(o)return{type:"escape",raw:o[0],text:o[1]}}tag(l){let o=this.rules.inline.tag.exec(l);if(o)return!this.lexer.state.inLink&&this.rules.other.startATag.test(o[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(o[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(o[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(o[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:o[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:o[0]}}link(l){if(this.lexer.state.linkParenPossible===!1)return;let o=this.rules.inline.link.exec(l);if(o){let c=o[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&lv(l,o[1],c,this.rules))return;let u=o[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(u)){if(!this.rules.other.endAngleBracket.test(u))return;let m=$l(u.slice(0,-1),"\\");if((u.length-m.length)%2===0)return}else{let m=tv(o[2],"()");if(m===-2)return;if(m>-1){let y=(o[0].indexOf("!")===0?5:4)+o[1].length+m;o[2]=o[2].substring(0,m),o[0]=o[0].substring(0,y).trim(),o[3]=""}}let d=o[2],h="";if(this.options.pedantic){let m=this.rules.other.pedanticHrefTitle.exec(d);m&&(d=m[1],h=m[3])}else h=o[3]?o[3].slice(1,-1):"";return d=d.trim(),this.rules.other.startAngleBracket.test(d)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(u)?d=d.slice(1):d=d.slice(1,-1)),av(o,{href:d&&d.replace(this.rules.inline.anyPunctuation,"$1"),title:h&&h.replace(this.rules.inline.anyPunctuation,"$1")},o[0],this.lexer,this.rules)}}reflink(l,o){let c;if((c=this.rules.inline.reflink.exec(l))||(c=this.rules.inline.nolink.exec(l))){let u=c[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&lv(l,c[1],u,this.rules))return;let d=(c[2]||c[1]).replace(this.rules.other.multipleSpaceGlobal," "),h=o[Uc(d)];if(!h){let m=c[0].charAt(0);return{type:"text",raw:m,text:m}}return av(c,h,c[0],this.lexer,this.rules)}}emStrong(l,o,c=""){let u=this.rules.inline.emStrongLDelim.exec(l);if(!(!u||!u[1]&&!u[2]&&!u[3]&&!u[4]||u[4]&&c.match(this.rules.other.unicodeAlphaNumeric))&&(!(u[1]||u[3])||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,v=0,S=u[0][0],g=c===S,b=S==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,o=o.slice(-1*l.length+d);(u=b.exec(o))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h)continue;if(m=[...h].length,u[3]||u[4]){y+=m;continue}else if(u[5]||u[6]){if(d%3&&!((d+m)%3)){v+=m;continue}if(g)break}if(y-=m,y>0)continue;m=Math.min(m,m+y+v);let x=[...u[0]][0].length,k=l.slice(0,d+u.index+x+m);if(Math.min(d,m)%2){let V=k.slice(1,-1);return{type:"em",raw:k,text:V,tokens:this.lexer.inlineTokens(V)}}let L=k.slice(2,-2);return{type:"strong",raw:k,text:L,tokens:this.lexer.inlineTokens(L)}}}}codespan(l){let o=this.rules.inline.code.exec(l);if(o){let c=o[2].replace(this.rules.other.newLineCharGlobal," "),u=this.rules.other.nonSpaceChar.test(c),d=this.rules.other.startingSpaceChar.test(c)&&this.rules.other.endingSpaceChar.test(c);return u&&d&&(c=c.substring(1,c.length-1)),{type:"codespan",raw:o[0],text:c}}}br(l){let o=this.rules.inline.br.exec(l);if(o)return{type:"br",raw:o[0]}}del(l,o,c=""){let u=this.rules.inline.delLDelim.exec(l);if(u&&(!u[1]||!c||this.rules.inline.punctuation.exec(c))){let d=[...u[0]].length-1,h,m,y=d,v=this.rules.inline.delRDelim;for(v.lastIndex=0,o=o.slice(-1*l.length+d);(u=v.exec(o))!==null;){if(h=u[1]||u[2]||u[3]||u[4]||u[5]||u[6],!h||(m=[...h].length,m!==d))continue;if(u[3]||u[4]){y+=m;continue}if(y-=m,y>0)continue;m=Math.min(m,m+y);let S=[...u[0]][0].length,g=l.slice(0,d+u.index+S+m),b=g.slice(d,-d);return{type:"del",raw:g,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(l){let o=this.rules.inline.autolink.exec(l);if(o){let c,u;return o[2]==="@"?(c=o[1],u="mailto:"+c):(c=o[1],u=c),{type:"link",raw:o[0],text:c,href:u,autolink:!0,tokens:[{type:"text",raw:c,text:c}]}}}url(l){var c;let o;if(o=this.rules.inline.url.exec(l)){let u,d;if(o[2]==="@")u=o[0],d="mailto:"+u;else{let h;do h=o[0],o[0]=((c=this.rules.inline._backpedal.exec(o[0]))==null?void 0:c[0])??"";while(h!==o[0]);u=o[0],o[1]==="www."?d="http://"+o[0]:d=o[0]}return{type:"link",raw:o[0],text:u,href:d,autolink:!0,tokens:[{type:"text",raw:u,text:u}]}}}inlineText(l){let o=this.rules.inline.text.exec(l);if(o){let c=this.lexer.state.inRawBlock;return{type:"text",raw:o[0],text:c?o[0]:JA(o[0]),escaped:c}}}},Gc,S0,ws,Aa=(ws=class{constructor(o){Cy(this,Gc);Ct(this,"tokens");Ct(this,"options");Ct(this,"state");Ct(this,"inlineQueue");Ct(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=o||Ns,this.options.tokenizer=this.options.tokenizer||new Hc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let c={other:mn,block:bc.normal,inline:bo.normal};this.options.pedantic?(c.block=bc.pedantic,c.inline=bo.pedantic):this.options.gfm&&(c.block=bc.gfm,this.options.breaks?c.inline=bo.breaks:c.inline=bo.gfm),this.tokenizer.rules=c}static get rules(){return{block:bc,inline:bo}}static lex(o,c){return new ws(c).lex(o)}static lexInline(o,c){return new ws(c).inlineTokens(o)}lex(o){o=o.replace(mn.carriageReturn,`
193
193
  `),this.blockTokens(o,this.tokens);for(let c=0;c<this.inlineQueue.length;c++){let u=this.inlineQueue[c];this.inlineTokens(u.src,u.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(o,c=[],u=!1){var h,m,y;this.tokenizer.lexer=this,this.options.pedantic&&(o=o.replace(mn.tabCharGlobal," ").replace(mn.spaceLine,""));let d=1/0;for(;o;){if(o.length<d)d=o.length;else{this.infiniteLoopError(o.charCodeAt(0));break}let v;if((m=(h=this.options.extensions)==null?void 0:h.block)!=null&&m.some(g=>(v=g.call({lexer:this},o,c))?(o=o.substring(v.raw.length),c.push(v),!0):!1))continue;if(v=this.tokenizer.space(o)){o=o.substring(v.raw.length);let g=c.at(-1);v.raw.length===1&&g!==void 0?g.raw+=`
194
194
  `:c.push(v);continue}if(v=this.tokenizer.code(o)){o=o.substring(v.raw.length);let g=c.at(-1);(g==null?void 0:g.type)==="paragraph"||(g==null?void 0:g.type)==="text"?(g.raw+=(g.raw.endsWith(`
195
195
  `)?"":`
@@ -203,9 +203,9 @@ ${de.join(`
203
203
  `+v.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):c.push(v),u=S.length!==o.length,o=o.substring(v.raw.length);continue}if(v=this.tokenizer.text(o)){o=o.substring(v.raw.length);let g=c.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=(g.raw.endsWith(`
204
204
  `)?"":`
205
205
  `)+v.raw,g.text+=`
206
- `+v.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):c.push(v);continue}if(o){this.infiniteLoopError(o.charCodeAt(0));break}}return this.state.top=!0,c}inline(o,c=[]){return this.inlineQueue.push({src:o,tokens:c}),c}linkInText(o){if(!o.includes("["))return!1;let c=this.tokenizer.rules.inline.link;for(let u of o.matchAll(this.tokenizer.rules.inline.blockSkip))if(c.test(u[0])&&o.charAt(u.index-1)!=="!")return!0;for(let u of o.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let d=u[0],h=d.lastIndexOf("[");if(!(d.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Uc(d.slice(h+1,-1))))&&!(h>1&&this.linkInText(d.slice(1,h-1))))return!0}return!1}inlineTokens(o,c=[]){this.tokenizer.lexer=this;let u=this.state.linkParenPossible;this.state.linkParenPossible=u&&o.includes(")");try{return My(this,Gc,b0).call(this,o,c)}finally{this.state.linkParenPossible=u}}infiniteLoopError(o){let c="Infinite loop on byte: "+o;if(this.options.silent)console.error(c);else throw new Error(c)}},Gc=new WeakSet,b0=function(o,c){var y,v,S,g,b;let u=o;if(this.tokens.links&&o.includes("[")){let x=this.tokenizer.rules.inline.reflinkSearch,k=D=>{let V=D.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Uc(D.slice(V+1,-1))))return D;if(V>1&&D.charAt(0)!=="!"){let L=D.slice(1,V-1);if(this.linkInText(L))return"["+L.replace(x,k)+"]["+"a".repeat(D.length-V-2)+"]"}return"["+"a".repeat(D.length-2)+"]"};u=u.replace(x,k)}u=u.replace(this.tokenizer.rules.inline.anyPunctuation,x=>"+".repeat(x.length)),u=u.replace(this.tokenizer.rules.inline.blockSkip,(x,k,D)=>{let V=D?D.length:0;return x.slice(0,V)+"["+"a".repeat(x.length-V-2)+"]"}),u=((v=(y=this.options.hooks)==null?void 0:y.emStrongMask)==null?void 0:v.call({lexer:this},u))??u;let d=!1,h="",m=1/0;for(;o;){if(o.length<m)m=o.length;else{this.infiniteLoopError(o.charCodeAt(0));break}d||(h=""),d=!1;let x;if((g=(S=this.options.extensions)==null?void 0:S.inline)!=null&&g.some(D=>(x=D.call({lexer:this},o,c))?(o=o.substring(x.raw.length),c.push(x),!0):!1))continue;if(x=this.tokenizer.escape(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.tag(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.link(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.reflink(o,this.tokens.links)){o=o.substring(x.raw.length);let D=c.at(-1);x.type==="text"&&(D==null?void 0:D.type)==="text"?(D.raw+=x.raw,D.text+=x.text):c.push(x);continue}if(x=this.tokenizer.emStrong(o,u,h)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.codespan(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.br(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.del(o,u,h)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.autolink(o)){o=o.substring(x.raw.length),c.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(o))){o=o.substring(x.raw.length),c.push(x);continue}let k=o;if((b=this.options.extensions)!=null&&b.startInline){let D=1/0,V=o.slice(1),L;this.options.extensions.startInline.forEach(K=>{L=K.call({lexer:this},V),typeof L=="number"&&L>=0&&(D=Math.min(D,L))}),D<1/0&&D>=0&&(k=o.substring(0,D+1))}if(x=this.tokenizer.inlineText(k)){o=o.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(h=x.raw.slice(-1)),d=!0;let D=c.at(-1);(D==null?void 0:D.type)==="text"?(D.raw+=x.raw,D.text+=x.text):c.push(x);continue}if(o){this.infiniteLoopError(o.charCodeAt(0));break}}return c},ws),Bc=class{constructor(l){Ct(this,"options");Ct(this,"parser");this.options=l||Ns}space(l){return""}code({text:l,lang:o,escaped:c}){var h;let u=(h=(o||"").match(mn.notSpaceStart))==null?void 0:h[0],d=l?l.replace(mn.endingNewline,"")+`
207
- `:"";return u?'<pre><code class="language-'+Pn(u)+'">'+(c?d:Pn(d,!0))+`</code></pre>
208
- `:"<pre><code>"+(c?d:Pn(d,!0))+`</code></pre>
206
+ `+v.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=g.text):c.push(v);continue}if(o){this.infiniteLoopError(o.charCodeAt(0));break}}return this.state.top=!0,c}inline(o,c=[]){return this.inlineQueue.push({src:o,tokens:c}),c}linkInText(o){if(!o.includes("["))return!1;let c=this.tokenizer.rules.inline.link;for(let u of o.matchAll(this.tokenizer.rules.inline.blockSkip))if(c.test(u[0])&&o.charAt(u.index-1)!=="!")return!0;for(let u of o.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let d=u[0],h=d.lastIndexOf("[");if(!(d.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Uc(d.slice(h+1,-1))))&&!(h>1&&this.linkInText(d.slice(1,h-1))))return!0}return!1}inlineTokens(o,c=[]){this.tokenizer.lexer=this;let u=this.state.linkParenPossible;this.state.linkParenPossible=u&&o.includes(")");try{return My(this,Gc,S0).call(this,o,c)}finally{this.state.linkParenPossible=u}}infiniteLoopError(o){let c="Infinite loop on byte: "+o;if(this.options.silent)console.error(c);else throw new Error(c)}},Gc=new WeakSet,S0=function(o,c){var y,v,S,g,b;let u=o;if(this.tokens.links&&o.includes("[")){let x=this.tokenizer.rules.inline.reflinkSearch,k=L=>{let V=L.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Uc(L.slice(V+1,-1))))return L;if(V>1&&L.charAt(0)!=="!"){let z=L.slice(1,V-1);if(this.linkInText(z))return"["+z.replace(x,k)+"]["+"a".repeat(L.length-V-2)+"]"}return"["+"a".repeat(L.length-2)+"]"};u=u.replace(x,k)}u=u.replace(this.tokenizer.rules.inline.anyPunctuation,x=>"+".repeat(x.length)),u=u.replace(this.tokenizer.rules.inline.blockSkip,(x,k,L)=>{let V=L?L.length:0;return x.slice(0,V)+"["+"a".repeat(x.length-V-2)+"]"}),u=((v=(y=this.options.hooks)==null?void 0:y.emStrongMask)==null?void 0:v.call({lexer:this},u))??u;let d=!1,h="",m=1/0;for(;o;){if(o.length<m)m=o.length;else{this.infiniteLoopError(o.charCodeAt(0));break}d||(h=""),d=!1;let x;if((g=(S=this.options.extensions)==null?void 0:S.inline)!=null&&g.some(L=>(x=L.call({lexer:this},o,c))?(o=o.substring(x.raw.length),c.push(x),!0):!1))continue;if(x=this.tokenizer.escape(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.tag(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.link(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.reflink(o,this.tokens.links)){o=o.substring(x.raw.length);let L=c.at(-1);x.type==="text"&&(L==null?void 0:L.type)==="text"?(L.raw+=x.raw,L.text+=x.text):c.push(x);continue}if(x=this.tokenizer.emStrong(o,u,h)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.codespan(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.br(o)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.del(o,u,h)){o=o.substring(x.raw.length),c.push(x);continue}if(x=this.tokenizer.autolink(o)){o=o.substring(x.raw.length),c.push(x);continue}if(!this.state.inLink&&(x=this.tokenizer.url(o))){o=o.substring(x.raw.length),c.push(x);continue}let k=o;if((b=this.options.extensions)!=null&&b.startInline){let L=1/0,V=o.slice(1),z;this.options.extensions.startInline.forEach(Z=>{z=Z.call({lexer:this},V),typeof z=="number"&&z>=0&&(L=Math.min(L,z))}),L<1/0&&L>=0&&(k=o.substring(0,L+1))}if(x=this.tokenizer.inlineText(k)){o=o.substring(x.raw.length),x.raw.slice(-1)!=="_"&&(h=x.raw.slice(-1)),d=!0;let L=c.at(-1);(L==null?void 0:L.type)==="text"?(L.raw+=x.raw,L.text+=x.text):c.push(x);continue}if(o){this.infiniteLoopError(o.charCodeAt(0));break}}return c},ws),Bc=class{constructor(l){Ct(this,"options");Ct(this,"parser");this.options=l||Ns}space(l){return""}code({text:l,lang:o,escaped:c}){var h;let u=(h=(o||"").match(mn.notSpaceStart))==null?void 0:h[0],d=l?l.replace(mn.endingNewline,"")+`
207
+ `:"";return u?'<pre><code class="language-'+Fn(u)+'">'+(c?d:Fn(d,!0))+`</code></pre>
208
+ `:"<pre><code>"+(c?d:Fn(d,!0))+`</code></pre>
209
209
  `}blockquote({tokens:l}){return`<blockquote>
210
210
  ${this.parser.parse(l)}</blockquote>
211
211
  `}html({text:l}){return l}def(l){return""}heading({tokens:l,depth:o}){return`<h${o}>${this.parser.parseInline(l)}</h${o}>
@@ -221,17 +221,17 @@ ${this.parser.parse(l)}</blockquote>
221
221
  `}tablerow({text:l}){return`<tr>
222
222
  ${l}</tr>
223
223
  `}tablecell(l){let o=this.parser.parseInline(l.tokens),c=l.header?"th":"td";return(l.align?`<${c} align="${l.align}">`:`<${c}>`)+o+`</${c}>
224
- `}strong({tokens:l}){return`<strong>${this.parser.parseInline(l)}</strong>`}em({tokens:l}){return`<em>${this.parser.parseInline(l)}</em>`}codespan({text:l}){return`<code>${Pn(l,!0)}</code>`}br(l){return"<br>"}del({tokens:l}){return`<del>${this.parser.parseInline(l)}</del>`}link({href:l,title:o,text:c,tokens:u,autolink:d}){let h=d?Pn(c,!0):this.parser.parseInline(u),m=Jy(l);if(m===null)return h;l=Pn(m,d);let y='<a href="'+l+'"';return o&&(y+=' title="'+Pn(o)+'"'),y+=">"+h+"</a>",y}image({href:l,title:o,text:c,tokens:u}){u&&(c=this.parser.parseInline(u,this.parser.textRenderer));let d=Jy(l);if(d===null)return Pn(c);l=d;let h=`<img src="${Pn(l)}" alt="${Pn(c)}"`;return o&&(h+=` title="${Pn(o)}"`),h+=">",h}text(l){return"tokens"in l&&l.tokens?this.parser.parseInline(l.tokens):"escaped"in l&&l.escaped?l.text:Pn(l.text)}},jh=class{strong({text:l}){return l}em({text:l}){return l}codespan({text:l}){return l}del({text:l}){return l}html({text:l}){return l}text({text:l}){return l}link({text:l}){return""+l}image({text:l}){return""+l}br(){return""}checkbox({raw:l}){return l}},Ta=class Yf{constructor(o){Ct(this,"options");Ct(this,"renderer");Ct(this,"textRenderer");this.options=o||Ns,this.options.renderer=this.options.renderer||new Bc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new jh}static parse(o,c){return new Yf(c).parse(o)}static parseInline(o,c){return new Yf(c).parseInline(o)}parse(o){var u,d;this.renderer.parser=this;let c="";for(let h=0;h<o.length;h++){let m=o[h];if((d=(u=this.options.extensions)==null?void 0:u.renderers)!=null&&d[m.type]){let v=m,S=this.options.extensions.renderers[v.type].call({parser:this},v);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(v.type)){c+=S||"";continue}}let y=m;switch(y.type){case"space":{c+=this.renderer.space(y);break}case"hr":{c+=this.renderer.hr(y);break}case"heading":{c+=this.renderer.heading(y);break}case"code":{c+=this.renderer.code(y);break}case"table":{c+=this.renderer.table(y);break}case"blockquote":{c+=this.renderer.blockquote(y);break}case"list":{c+=this.renderer.list(y);break}case"checkbox":{c+=this.renderer.checkbox(y);break}case"html":{c+=this.renderer.html(y);break}case"def":{c+=this.renderer.def(y);break}case"paragraph":{c+=this.renderer.paragraph(y);break}case"text":{c+=this.renderer.text(y);break}default:{let v='Token with "'+y.type+'" type was not found.';if(this.options.silent)return console.error(v),"";throw new Error(v)}}}return c}parseInline(o,c=this.renderer){var d,h;this.renderer.parser=this;let u="";for(let m=0;m<o.length;m++){let y=o[m];if((h=(d=this.options.extensions)==null?void 0:d.renderers)!=null&&h[y.type]){let S=this.options.extensions.renderers[y.type].call({parser:this},y);if(S!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(y.type)){u+=S||"";continue}}let v=y;switch(v.type){case"escape":{u+=c.text(v);break}case"html":{u+=c.html(v);break}case"link":{u+=c.link(v);break}case"image":{u+=c.image(v);break}case"checkbox":{u+=c.checkbox(v);break}case"strong":{u+=c.strong(v);break}case"em":{u+=c.em(v);break}case"codespan":{u+=c.codespan(v);break}case"br":{u+=c.br(v);break}case"del":{u+=c.del(v);break}case"text":{u+=c.text(v);break}default:{let S='Token with "'+v.type+'" type was not found.';if(this.options.silent)return console.error(S),"";throw new Error(S)}}}return u}},jc,Eo=(jc=class{constructor(l){Ct(this,"options");Ct(this,"block");this.options=l||Ns}preprocess(l){return l}postprocess(l){return l}processAllTokens(l){return l}emStrongMask(l){return l}provideLexer(l=this.block){return l?Aa.lex:Aa.lexInline}provideParser(l=this.block){return l?Ta.parse:Ta.parseInline}},Ct(jc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Ct(jc,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),jc),PA=class{constructor(...l){Ct(this,"defaults",bh());Ct(this,"options",this.setOptions);Ct(this,"parse",this.parseMarkdown(!0));Ct(this,"parseInline",this.parseMarkdown(!1));Ct(this,"Parser",Ta);Ct(this,"Renderer",Bc);Ct(this,"TextRenderer",jh);Ct(this,"Lexer",Aa);Ct(this,"Tokenizer",Hc);Ct(this,"Hooks",Eo);this.use(...l)}walkTokens(l,o){var u,d;let c=[];for(let h of l)switch(c=c.concat(o.call(this,h)),h.type){case"table":{let m=h;for(let y of m.header)c=c.concat(this.walkTokens(y.tokens,o));for(let y of m.rows)for(let v of y)c=c.concat(this.walkTokens(v.tokens,o));break}case"list":{let m=h;c=c.concat(this.walkTokens(m.items,o));break}default:{let m=h;(d=(u=this.defaults.extensions)==null?void 0:u.childTokens)!=null&&d[m.type]?this.defaults.extensions.childTokens[m.type].forEach(y=>{let v=m[y].flat(1/0);c=c.concat(this.walkTokens(v,o))}):m.tokens&&(c=c.concat(this.walkTokens(m.tokens,o)))}}return c}use(...l){let o=this.defaults.extensions||{renderers:{},childTokens:{}};return l.forEach(c=>{let u={...c};if(u.async=this.defaults.async||u.async||!1,c.extensions&&(c.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){let h=o.renderers[d.name];h?o.renderers[d.name]=function(...m){let y=d.renderer.apply(this,m);return y===!1&&(y=h.apply(this,m)),y}:o.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let h=o[d.level];h?h.unshift(d.tokenizer):o[d.level]=[d.tokenizer],d.start&&(d.level==="block"?o.startBlock?o.startBlock.push(d.start):o.startBlock=[d.start]:d.level==="inline"&&(o.startInline?o.startInline.push(d.start):o.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(o.childTokens[d.name]=d.childTokens)}),u.extensions=o),c.renderer){let d=this.defaults.renderer||new Bc(this.defaults);for(let h in c.renderer){if(!(h in d))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;let m=h,y=c.renderer[m],v=d[m];d[m]=(...S)=>{let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g||""}}u.renderer=d}if(c.tokenizer){let d=this.defaults.tokenizer||new Hc(this.defaults);for(let h in c.tokenizer){if(!(h in d))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;let m=h,y=c.tokenizer[m],v=d[m];d[m]=(...S)=>{let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g}}u.tokenizer=d}if(c.hooks){let d=this.defaults.hooks||new Eo;for(let h in c.hooks){if(!(h in d))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;let m=h,y=c.hooks[m],v=d[m];Eo.passThroughHooks.has(h)?d[m]=S=>{if(this.defaults.async&&Eo.passThroughHooksRespectAsync.has(h))return(async()=>{let b=await y.call(d,S);return v.call(d,b)})();let g=y.call(d,S);return v.call(d,g)}:d[m]=(...S)=>{if(this.defaults.async)return(async()=>{let b=await y.apply(d,S);return b===!1&&(b=await v.apply(d,S)),b})();let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g}}u.hooks=d}if(c.walkTokens){let d=this.defaults.walkTokens,h=c.walkTokens;u.walkTokens=function(m){let y=[];return y.push(h.call(this,m)),d&&(y=y.concat(d.call(this,m))),y}}this.defaults={...this.defaults,...u}}),this}setOptions(l){return this.defaults={...this.defaults,...l},this}lexer(l,o){return Aa.lex(l,o??this.defaults)}parser(l,o){return Ta.parse(l,o??this.defaults)}parseMarkdown(l){return(o,c)=>{let u={...c},d={...this.defaults,...u},h=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&u.async===!1)return h(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return h(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return h(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(d.hooks&&(d.hooks.options=d,d.hooks.block=l),d.async)return(async()=>{let m=d.hooks?await d.hooks.preprocess(o):o,y=await(d.hooks?await d.hooks.provideLexer(l):l?Aa.lex:Aa.lexInline)(m,d),v=d.hooks?await d.hooks.processAllTokens(y):y;d.walkTokens&&await Promise.all(this.walkTokens(v,d.walkTokens));let S=await(d.hooks?await d.hooks.provideParser(l):l?Ta.parse:Ta.parseInline)(v,d);return d.hooks?await d.hooks.postprocess(S):S})().catch(h);try{d.hooks&&(o=d.hooks.preprocess(o));let m=(d.hooks?d.hooks.provideLexer(l):l?Aa.lex:Aa.lexInline)(o,d);d.hooks&&(m=d.hooks.processAllTokens(m)),d.walkTokens&&this.walkTokens(m,d.walkTokens);let y=(d.hooks?d.hooks.provideParser(l):l?Ta.parse:Ta.parseInline)(m,d);return d.hooks&&(y=d.hooks.postprocess(y)),y}catch(m){return h(m)}}}onError(l,o){return c=>{if(c.message+=`
225
- Please report this to https://github.com/markedjs/marked.`,l){let u="<p>An error occurred:</p><pre>"+Pn(c.message+"",!0)+"</pre>";return o?Promise.resolve(u):u}if(o)return Promise.reject(c);throw c}}},Ts=new PA;function Tt(l,o){return Ts.parse(l,o)}Tt.options=Tt.setOptions=function(l){return Ts.setOptions(l),Tt.defaults=Ts.defaults,u0(Tt.defaults),Tt};Tt.getDefaults=bh;Tt.defaults=Ns;function JA(...l){return Ts.use(...l),Tt.defaults=Ts.defaults,u0(Tt.defaults),Tt}Tt.use=JA;Tt.walkTokens=function(l,o){return Ts.walkTokens(l,o)};Tt.parseInline=Ts.parseInline;Tt.Parser=Ta;Tt.parser=Ta.parse;Tt.Renderer=Bc;Tt.TextRenderer=jh;Tt.Lexer=Aa;Tt.lexer=Aa.lex;Tt.Tokenizer=Hc;Tt.Hooks=Eo;Tt.parse=Tt;Tt.options;Tt.setOptions;Tt.walkTokens;Tt.parseInline;Ta.parse;Aa.lex;/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */function sv(l,o){(o==null||o>l.length)&&(o=l.length);for(var c=0,u=Array(o);c<o;c++)u[c]=l[c];return u}function WA(l){if(Array.isArray(l))return l}function eT(l,o){var c=l==null?null:typeof Symbol<"u"&&l[Symbol.iterator]||l["@@iterator"];if(c!=null){var u,d,h,m,y=[],v=!0,S=!1;try{if(h=(c=c.call(l)).next,o!==0)for(;!(v=(u=h.call(c)).done)&&(y.push(u.value),y.length!==o);v=!0);}catch(g){S=!0,d=g}finally{try{if(!v&&c.return!=null&&(m=c.return(),Object(m)!==m))return}finally{if(S)throw d}}return y}}function tT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
226
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function nT(l,o){return WA(l)||eT(l,o)||aT(l,o)||tT()}function aT(l,o){if(l){if(typeof l=="string")return sv(l,o);var c={}.toString.call(l).slice(8,-1);return c==="Object"&&l.constructor&&(c=l.constructor.name),c==="Map"||c==="Set"?Array.from(l):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?sv(l,o):void 0}}const x0=Object.entries,iv=Object.setPrototypeOf,lT=Object.isFrozen,sT=Object.getPrototypeOf,iT=Object.getOwnPropertyDescriptor;let tn=Object.freeze,on=Object.seal,vi=Object.create,S0=typeof Reflect<"u"&&Reflect,Vf=S0.apply,Qf=S0.construct;tn||(tn=function(o){return o});on||(on=function(o){return o});Vf||(Vf=function(o,c){for(var u=arguments.length,d=new Array(u>2?u-2:0),h=2;h<u;h++)d[h-2]=arguments[h];return o.apply(c,d)});Qf||(Qf=function(o){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return new o(...u)});const xs=Jt(Array.prototype.forEach),oT=Jt(Array.prototype.lastIndexOf),ov=Jt(Array.prototype.pop),xo=Jt(Array.prototype.push),rT=Jt(Array.prototype.splice),xi=Array.isArray,Co=Jt(String.prototype.toLowerCase),Ef=Jt(String.prototype.toString),rv=Jt(String.prototype.match),So=Jt(String.prototype.replace),cv=Jt(String.prototype.indexOf),cT=Jt(String.prototype.trim),uT=Jt(Number.prototype.toString),dT=Jt(Boolean.prototype.toString),uv=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),dv=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),Un=Jt(Object.prototype.hasOwnProperty),wo=Jt(Object.prototype.toString),Sn=Jt(RegExp.prototype.test),Gl=fT(TypeError);function Jt(l){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return Vf(l,o,u)}}function fT(l){return function(){for(var o=arguments.length,c=new Array(o),u=0;u<o;u++)c[u]=arguments[u];return Qf(l,c)}}function ft(l,o){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Co;if(iv&&iv(l,null),!xi(o))return l;let u=o.length;for(;u--;){let d=o[u];if(typeof d=="string"){const h=c(d);h!==d&&(lT(o)||(o[u]=h),d=h)}l[d]=!0}return l}function hT(l){for(let o=0;o<l.length;o++)Un(l,o)||(l[o]=null);return l}function Jn(l){const o=vi(null);for(const u of x0(l)){var c=nT(u,2);const d=c[0],h=c[1];Un(l,d)&&(xi(h)?o[d]=hT(h):h&&typeof h=="object"&&h.constructor===Object?o[d]=Jn(h):o[d]=h)}return o}function mT(l){switch(typeof l){case"string":return l;case"number":return uT(l);case"boolean":return dT(l);case"bigint":return uv?uv(l):"0";case"symbol":return dv?dv(l):"Symbol()";case"undefined":return wo(l);case"function":case"object":{if(l===null)return wo(l);const o=l,c=da(o,"toString");if(typeof c=="function"){const u=c(o);return typeof u=="string"?u:wo(u)}return wo(l)}default:return wo(l)}}function da(l,o){for(;l!==null;){const u=iT(l,o);if(u){if(u.get)return Jt(u.get);if(typeof u.value=="function")return Jt(u.value)}l=sT(l)}function c(){return null}return c}function pT(l){try{return Sn(l,""),!0}catch{return!1}}const fv=tn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cf=tn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mf=tn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),gT=tn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_f=tn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yT=tn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),hv=tn(["#text"]),mv=tn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Rf=tn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pv=tn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xc=tn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),vT=on(/{{[\w\W]*|^[\w\W]*}}/g),bT=on(/<%[\w\W]*|^[\w\W]*%>/g),xT=on(/\${[\w\W]*/g),ST=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),wT=on(/^aria-[\-\w]+$/),gv=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),AT=on(/^(?:\w+script|data):/i),TT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kT=on(/^html$/i),jT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),yv=on(/<[/\w!]/g),vv=on(/<[/\w]/g),NT=on(/<\/no(script|embed|frames)/i),ET=on(/\/>/i),Fn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},w0=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],CT=tn(ft({},w0)),MT=(function(){const l={};return xs(w0,o=>{l[o]=on(new RegExp("</"+o+"(?=[\\t\\n\\f\\r />])","i"))}),tn(l)})(),_T=function(){return typeof window>"u"?null:window},RT=function(o,c){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let u=null;const d="data-tt-policy-suffix";c&&c.hasAttribute(d)&&(u=c.getAttribute(d));const h="dompurify"+(u?"#"+u:"");try{return o.createPolicy(h,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+h+" could not be created."),null}},bv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Xl=function(o,c,u,d){return Un(o,c)&&xi(o[c])?ft(d.base?Jn(d.base):{},o[c],d.transform):u},Of=function(o,c,u){const d=Un(o,c)?o[c]:void 0;return d&&typeof d=="object"?Jn(d):u()};function A0(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_T();const o=se=>A0(se);if(o.version="3.4.16",o.removed=[],!l||!l.document||l.document.nodeType!==Fn.document||!l.Element)return o.isSupported=!1,o;let c=l.document;const u=c,d=u.currentScript;l.DocumentFragment;const h=l.HTMLTemplateElement,m=l.Node,y=l.Element,v=l.NodeFilter;l.NamedNodeMap===void 0&&(l.NamedNodeMap||l.MozNamedAttrMap),l.HTMLFormElement;const S=l.DOMParser,g=l.trustedTypes,b=y.prototype,x=da(b,"cloneNode"),k=da(b,"remove"),D=da(b,"removeAttributeNode"),V=da(b,"nextSibling"),L=da(b,"childNodes"),K=da(b,"parentNode"),ce=da(b,"shadowRoot"),de=da(b,"attributes"),E=m&&m.prototype?da(m.prototype,"nodeType"):null,G=m&&m.prototype?da(m.prototype,"nodeName"):null,H=m&&m.prototype?da(m.prototype,"ownerDocument"):null,Y=function(w){return E?E(w):w.nodeType},F=function(w){return G?G(w):w.nodeName};if(typeof h=="function"){const se=c.createElement("template");se.content&&se.content.ownerDocument&&(c=se.content.ownerDocument)}let ie,X="",P,Q=!1,me=0;const ve=function(){if(me>0)throw Gl('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(w){ve(),me++;try{return ie.createHTML(w)}finally{me--}},ne=function(w){ve(),me++;try{return ie.createScriptURL(w)}finally{me--}},te=function(){return Q||(P=RT(g,d),Q=!0),P},re=c,ee=re.implementation,ke=re.createNodeIterator,Ze=re.createDocumentFragment,bt=re.getElementsByTagName,kt=u.importNode;let j=bv();o.isSupported=typeof x0=="function"&&typeof K=="function"&&ee&&ee.createHTMLDocument!==void 0;const ae=vT,je=bT,pe=xT,Ie=ST,Oe=wT,ze=AT,Se=TT,_e=jT;let mt=gv,O=null;const we=ft({},[...fv,...Cf,...Mf,..._f,...hv]);let he=null;const Be=ft({},[...mv,...Rf,...pv,...xc]);let Ee=Object.seal(vi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,Te=null;const be=Object.seal(vi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let qe=!0,q=!0,Re=!1,He=!0,pt=!1,Ve=!0,ht=!1,$e=!1,Vt=null,ea=null,fa=!1,gn=!1,wn=!1,Bn=!1,ka=!0,An=!1;const nn="user-content-";let yt=!0,Ga=!1,yn={},vn=null;const Cn=ft({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let B=null;const ue=ft({},["audio","video","img","source","image","track"]);let Ae=null;const De=ft({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let jt=Fe,Wt=!1,Mn=null;const hl=ft({},[Ye,Qe,Fe],Ef),ja=tn(["mi","mo","mn","ms","mtext"]);let ha=ft({},ja);const N=tn(["annotation-xml"]);let Z=ft({},N);const ge=ft({},["title","style","font","a","script"]);let xe=null;const et=["application/xhtml+xml","text/html"],ct="text/html";let at=null,Nt=null;const lt=c.createElement("form"),Bt=function(w){return w instanceof RegExp||w instanceof Function},In=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Nt&&Nt===w)return;(!w||typeof w!="object")&&(w={}),w=Jn(w),xe=et.indexOf(w.PARSER_MEDIA_TYPE)===-1?ct:w.PARSER_MEDIA_TYPE,at=xe==="application/xhtml+xml"?Ef:Co,O=Xl(w,"ALLOWED_TAGS",we,{transform:at}),he=Xl(w,"ALLOWED_ATTR",Be,{transform:at}),Mn=Xl(w,"ALLOWED_NAMESPACES",hl,{transform:Ef}),Ae=Xl(w,"ADD_URI_SAFE_ATTR",De,{transform:at,base:De}),B=Xl(w,"ADD_DATA_URI_TAGS",ue,{transform:at,base:ue}),vn=Xl(w,"FORBID_CONTENTS",Cn,{transform:at}),le=Xl(w,"FORBID_TAGS",Jn({}),{transform:at}),Te=Xl(w,"FORBID_ATTR",Jn({}),{transform:at}),yn=Un(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Jn(w.USE_PROFILES):w.USE_PROFILES:!1,qe=w.ALLOW_ARIA_ATTR!==!1,q=w.ALLOW_DATA_ATTR!==!1,Re=w.ALLOW_UNKNOWN_PROTOCOLS||!1,He=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pt=w.SAFE_FOR_TEMPLATES||!1,Ve=w.SAFE_FOR_XML!==!1,ht=w.WHOLE_DOCUMENT||!1,gn=w.RETURN_DOM||!1,wn=w.RETURN_DOM_FRAGMENT||!1,Bn=w.RETURN_TRUSTED_TYPE||!1,fa=w.FORCE_BODY||!1,ka=w.SANITIZE_DOM!==!1,An=w.SANITIZE_NAMED_PROPS||!1,yt=w.KEEP_CONTENT!==!1,Ga=w.IN_PLACE||!1,mt=pT(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:gv,jt=typeof w.NAMESPACE=="string"?w.NAMESPACE:Fe,ha=Of(w,"MATHML_TEXT_INTEGRATION_POINTS",()=>ft({},ja)),Z=Of(w,"HTML_INTEGRATION_POINTS",()=>ft({},N));const z=Of(w,"CUSTOM_ELEMENT_HANDLING",()=>vi(null));if(Ee=vi(null),Un(z,"tagNameCheck")&&Bt(z.tagNameCheck)&&(Ee.tagNameCheck=z.tagNameCheck),Un(z,"attributeNameCheck")&&Bt(z.attributeNameCheck)&&(Ee.attributeNameCheck=z.attributeNameCheck),Un(z,"allowCustomizedBuiltInElements")&&typeof z.allowCustomizedBuiltInElements=="boolean"&&(Ee.allowCustomizedBuiltInElements=z.allowCustomizedBuiltInElements),on(Ee),pt&&(q=!1),wn&&(gn=!0),yn&&(O=ft({},hv),he=vi(null),yn.html===!0&&(ft(O,fv),ft(he,mv)),yn.svg===!0&&(ft(O,Cf),ft(he,Rf),ft(he,xc)),yn.svgFilters===!0&&(ft(O,Mf),ft(he,Rf),ft(he,xc)),yn.mathMl===!0&&(ft(O,_f),ft(he,pv),ft(he,xc))),be.tagCheck=null,be.attributeCheck=null,Un(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?be.tagCheck=w.ADD_TAGS:xi(w.ADD_TAGS)&&(O===we&&(O=Jn(O)),ft(O,w.ADD_TAGS,at))),Un(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?be.attributeCheck=w.ADD_ATTR:xi(w.ADD_ATTR)&&(he===Be&&(he=Jn(he)),ft(he,w.ADD_ATTR,at))),Un(w,"ADD_FORBID_CONTENTS")&&xi(w.ADD_FORBID_CONTENTS)&&(vn===Cn&&(vn=Jn(vn)),ft(vn,w.ADD_FORBID_CONTENTS,at)),yt&&(O["#text"]=!0),ht&&ft(O,["html","head","body"]),O.table&&(ft(O,["tbody"]),delete le.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const oe=ie;ie=w.TRUSTED_TYPES_POLICY;try{X=Ce("")}catch(fe){throw ie=oe,fe}}else w.TRUSTED_TYPES_POLICY===null?(ie=void 0,X=""):(ie===void 0&&(ie=te()),ie&&typeof X=="string"&&(X=Ce("")));tn&&tn(w),Nt=w},Xa=ft({},[...Cf,...Mf,...gT]),Na=ft({},[..._f,...yT]),Zl=function(w,z,oe){return z.namespaceURI===Fe?w==="svg":z.namespaceURI===Ye?w==="svg"&&(oe==="annotation-xml"||ha[oe]):!!Xa[w]},Ea=function(w,z,oe){return z.namespaceURI===Fe?w==="math":z.namespaceURI===Qe?w==="math"&&Z[oe]:!!Na[w]},ml=function(w,z,oe){return z.namespaceURI===Qe&&!Z[oe]||z.namespaceURI===Ye&&!ha[oe]?!1:!Na[w]&&(ge[w]||!Xa[w])},Es=function(w){let z=K(w);(!z||!z.tagName)&&(z={namespaceURI:jt,tagName:"template"});const oe=Co(w.tagName),fe=Co(z.tagName);return Mn[w.namespaceURI]?w.namespaceURI===Qe?Zl(oe,z,fe):w.namespaceURI===Ye?Ea(oe,z,fe):w.namespaceURI===Fe?ml(oe,z,fe):!!(xe==="application/xhtml+xml"&&Mn[w.namespaceURI]):!1},Gt=function(w){xo(o.removed,{element:w});try{K(w).removeChild(w)}catch{if(k(w),!K(w))throw Gl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},zt=function(w,z,oe){try{D(w,z)}catch{try{w.removeAttribute(oe)}catch{}}},Ut=function(w){Cs(w);const z=L(w);if(z){const fe=[];xs(z,Ue=>{xo(fe,Ue)}),xs(fe,Ue=>{try{k(Ue)}catch{}})}const oe=de(w);if(oe)for(let fe=oe.length-1;fe>=0;--fe){const Ue=oe[fe],Ge=Ue&&Ue.name;typeof Ge=="string"&&zt(w,Ue,Ge)}},_n=function(w,z,oe){if(!oe)try{oe=z.getAttributeNode(w)}catch{oe=null}xo(o.removed,{attribute:oe||null,from:z});try{oe?D(z,oe):z.removeAttribute(w)}catch{try{z.removeAttribute(w)}catch{}}if(w==="is")if(gn||wn)try{Gt(z)}catch{}else try{z.setAttribute(w,"")}catch{}},Xo=function(w){const z=de(w);if(z)for(let oe=z.length-1;oe>=0;--oe){const fe=z[oe],Ue=fe&&fe.name;typeof Ue!="string"||he[at(Ue)]||zt(w,fe,Ue)}},Cs=function(w){const z=[w];for(;z.length>0;){const oe=z.pop();Y(oe)===Fn.element&&Xo(oe);const fe=L(oe);if(fe)for(let Ue=fe.length-1;Ue>=0;--Ue)z.push(fe[Ue])}},Yo=function(w,z){return Ve?w==="patchsrc"?!0:w==="for"&&z!=="label"&&z!=="output":!1},Vo=function(w){if(!Ve)return;const z=[w];for(;z.length>0;){const oe=z.pop(),fe=Y(oe);if(fe===Fn.processingInstruction||fe===Fn.comment&&Sn(vv,oe.data)){try{k(oe)}catch{}continue}if(fe===Fn.element){const Ge=oe,nt=at(F(oe));try{Ge.hasAttribute&&Ge.hasAttribute("patchsrc")&&Ge.removeAttribute("patchsrc"),Ge.hasAttribute&&Ge.hasAttribute("for")&&Yo("for",nt)&&Ge.removeAttribute("for")}catch{}}const Ue=L(oe);if(Ue)for(let Ge=Ue.length-1;Ge>=0;--Ge)z.push(Ue[Ge])}},pl=function(w){let z=null,oe=null;if(fa)w="<remove></remove>"+w;else{const Ge=rv(w,/^[\r\n\t ]+/);oe=Ge&&Ge[0]}xe==="application/xhtml+xml"&&jt===Fe&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const fe=ie?Ce(w):w;if(jt===Fe)try{z=new S().parseFromString(fe,xe)}catch{}if(!z||!z.documentElement){z=ee.createDocument(jt,"template",null);try{z.documentElement.innerHTML=Wt?X:fe}catch{}}const Ue=z.body||z.documentElement;return w&&oe&&Ue.insertBefore(c.createTextNode(oe),Ue.childNodes[0]||null),jt===Fe?bt.call(z,ht?"html":"body")[0]:ht?z.documentElement:Ue},Fl=function(w){const z=H?H(w):w.ownerDocument;return ke.call(z||w,w,v.SHOW_ELEMENT|v.SHOW_COMMENT|v.SHOW_TEXT|v.SHOW_PROCESSING_INSTRUCTION|v.SHOW_CDATA_SECTION,null)},Ya=function(w){return w=So(w,ae," "),w=So(w,je," "),w=So(w,pe," "),w},ma=function(w){var z;w.normalize();const oe=H?H(w):w.ownerDocument,fe=ke.call(oe||w,w,v.SHOW_TEXT|v.SHOW_COMMENT|v.SHOW_CDATA_SECTION|v.SHOW_PROCESSING_INSTRUCTION,null);let Ue=fe.nextNode();for(;Ue;)Ue.data=Ya(Ue.data),Ue=fe.nextNode();const Ge=(z=w.querySelectorAll)===null||z===void 0?void 0:z.call(w,"template");Ge&&xs(Ge,nt=>{ta(nt.content)&&ma(nt.content)})},pa=function(w){const z=G?G(w):null;return typeof z!="string"||at(z)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==de(w)||typeof w.removeAttribute!="function"||typeof w.removeAttributeNode!="function"||typeof w.getAttributeNode!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==E(w)||w.childNodes!==L(w)},ta=function(w){if(!E||typeof w!="object"||w===null)return!1;try{return E(w)===Fn.documentFragment}catch{return!1}},na=function(w){if(!E||typeof w!="object"||w===null)return!1;try{return typeof E(w)=="number"}catch{return!1}};function xt(se,w,z){se.length!==0&&xs(se,oe=>{oe.call(o,w,z,Nt)})}const Qo=function(w,z){return!!(Ve&&w.hasChildNodes()&&!na(w.firstElementChild)&&Sn(yv,w.textContent)&&Sn(yv,w.innerHTML)||Ve&&w.namespaceURI===Fe&&CT[z]&&(na(w.firstElementChild)||typeof w.textContent=="string"&&Sn(MT[z],w.textContent))||w.nodeType===Fn.processingInstruction||Ve&&w.nodeType===Fn.comment&&Sn(vv,w.data))},Pl=function(w,z){if(w instanceof RegExp)return Sn(w,z);if(w instanceof Function){for(var oe=arguments.length,fe=new Array(oe>2?oe-2:0),Ue=2;Ue<oe;Ue++)fe[Ue-2]=arguments[Ue];return!!w(z,...fe)}return!1},Ko=function(w,z,oe){if(!le[z]&&Po(z)&&Pl(Ee.tagNameCheck,z))return!1;if(yt&&!vn[z]){const fe=K(w),Ue=L(w);if(Ue&&fe){const Ge=Ue.length;for(let nt=Ge-1;nt>=0;--nt){const Ot=w===oe?x(Ue[nt],!0):Ue[nt];fe.insertBefore(Ot,V(w))}}}return Gt(w),!0},Ca=function(w,z,oe,fe){return w.length===0?z:z===oe||z===fe?Jn(z):z},qn=function(w,z){return w===z||K(w)!==null?!1:(Ga&&Cs(w),!0)},Zo=function(w,z){if(xt(j.beforeSanitizeElements,w,null),qn(w,z))return!0;if(pa(w))return Gt(w),!0;const oe=at(F(w));if(O=Ca(j.uponSanitizeElement,O,we,Vt),xt(j.uponSanitizeElement,w,{tagName:oe,allowedTags:O}),qn(w,z))return!0;if(Qo(w,oe))return Gt(w),!0;if(le[oe]||!(be.tagCheck instanceof Function&&be.tagCheck(oe))&&!O[oe]){const fe=Ko(w,oe,z);return fe===!1&&(xt(j.afterSanitizeElements,w,null),qn(w,z))?!0:fe}if(Y(w)===Fn.element&&!Es(w)||(oe==="noscript"||oe==="noembed"||oe==="noframes")&&Sn(NT,w.innerHTML))return Gt(w),!0;if(pt&&w.nodeType===Fn.text){const fe=Ya(w.textContent);w.textContent!==fe&&(xo(o.removed,{element:w.cloneNode()}),w.textContent=fe)}return xt(j.afterSanitizeElements,w,null),qn(w,z)},Ni=function(w,z,oe){if(Te[z]||Yo(z,w)||ka&&(z==="id"||z==="name")&&(oe in c||oe in lt))return!1;const fe=he[z]||be.attributeCheck instanceof Function&&be.attributeCheck(z,w);return q&&Sn(Ie,z)||qe&&Sn(Oe,z)?!0:fe?Ae[z]||Sn(mt,So(oe,Se,""))||(z==="src"||z==="xlink:href"||z==="href")&&w!=="script"&&cv(oe,"data:")===0&&B[w]||Re&&!Sn(ze,So(oe,Se,""))?!0:!oe:Po(w)&&Pl(Ee.tagNameCheck,w)&&Pl(Ee.attributeNameCheck,z,w)||z==="is"&&Ee.allowCustomizedBuiltInElements&&Pl(Ee.tagNameCheck,oe)},Fo=ft({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Po=function(w){return!Fo[Co(w)]&&Sn(_e,w)},ut=function(w,z,oe,fe){if(ie&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!oe)switch(g.getAttributeType(w,z)){case"TrustedHTML":return Ce(fe);case"TrustedScriptURL":return ne(fe)}return fe},Jo=function(w,z,oe,fe){try{return oe?w.setAttributeNS(oe,z,fe):w.setAttribute(z,fe),pa(w)?(Gt(w),!1):!0}catch{return _n(z,w),!1}},Jl=function(w,z){if(xt(j.beforeSanitizeAttributes,w,null),qn(w,z))return;const oe=w.attributes;if(!oe||pa(w))return;he=Ca(j.uponSanitizeAttribute,he,Be,ea);const fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:he,forceKeepAttr:void 0};let Ue=oe.length;const Ge=at(w.nodeName);for(;Ue--;){const nt=oe[Ue],Ot=nt.name,bn=nt.namespaceURI,Qt=nt.value,Qa=at(Ot),Ms=Qt;let It=Ot==="value"?Ms:cT(Ms),Wo=!1;if(fe.attrName=Qa,fe.attrValue=It,fe.keepAttr=!0,fe.forceKeepAttr=void 0,xt(j.uponSanitizeAttribute,w,fe),It=fe.attrValue,An&&(Qa==="id"||Qa==="name")&&cv(It,nn)!==0&&(_n(Ot,w,nt),It=nn+It,Wo=!0),Ve&&Sn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,It)){_n(Ot,w,nt);continue}if(Qa==="attributename"&&rv(It,"href")){_n(Ot,w,nt);continue}if(!fe.forceKeepAttr){if(!fe.keepAttr){_n(Ot,w,nt);continue}if(!He&&Sn(ET,It)){_n(Ot,w,nt);continue}if(pt&&(It=Ya(It)),!Ni(Ge,Qa,It)){_n(Ot,w,nt);continue}It=ut(Ge,Qa,bn,It),It!==Ms&&Jo(w,Ot,bn,It)&&Wo&&ov(o.removed)}}xt(j.afterSanitizeAttributes,w,null),qn(w,z)},Va=function(w){let z=null;const oe=Fl(w);for(xt(j.beforeSanitizeShadowDOM,w,null);z=oe.nextNode();)if(xt(j.uponSanitizeShadowNode,z,null),Zo(z,w),Jl(z,w),ta(z.content)&&Va(z.content),Y(z)===Fn.element){const fe=ce(z);ta(fe)&&($n(fe),Va(fe))}xt(j.afterSanitizeShadowDOM,w,null)},$n=function(w){const z=[{node:w,shadow:null}];for(;z.length>0;){const oe=z.pop();if(oe.shadow){Va(oe.shadow);continue}const fe=oe.node,Ue=Y(fe)===Fn.element,Ge=L(fe);if(Ge)for(let nt=Ge.length-1;nt>=0;--nt)z.push({node:Ge[nt],shadow:null});if(Ue){const nt=G?G(fe):null;if(typeof nt=="string"&&at(nt)==="template"){const Ot=fe.content;ta(Ot)&&z.push({node:Ot,shadow:null})}}if(Ue){const nt=ce(fe);ta(nt)&&z.push({node:null,shadow:nt},{node:nt,shadow:null})}}};return o.sanitize=function(se){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=null,oe=null,fe=null,Ue=null;if(Wt=!se,Wt&&(se="<!-->"),typeof se!="string"&&!na(se)&&(se=mT(se),typeof se!="string"))throw Gl("dirty is not a string, aborting");if(!o.isSupported)return se;$e?(O=Vt,he=ea):In(w),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(O=Jn(O)),j.uponSanitizeAttribute.length>0&&(he=Jn(he)),o.removed=[];const Ge=Ga&&typeof se!="string"&&na(se);if(Ge){Vo(se);const bn=F(se);if(typeof bn=="string"){const Qt=at(bn);if(!O[Qt]||le[Qt])throw Ut(se),Gl("root node is forbidden and cannot be sanitized in-place")}if(pa(se))throw Ut(se),Gl("root node is clobbered and cannot be sanitized in-place");try{$n(se)}catch(Qt){throw Ut(se),Qt}}else if(na(se))z=pl("<!---->"),oe=z.ownerDocument.importNode(se,!0),oe.nodeType===Fn.element&&oe.nodeName==="BODY"||oe.nodeName==="HTML"?z=oe:z.appendChild(oe),$n(z);else{if(!gn&&!pt&&!ht&&se.indexOf("<")===-1)return ie&&Bn?Ce(se):se;if(z=pl(se),!z)return gn?null:Bn?X:""}z&&fa&&Gt(z.firstChild);const nt=Ge?se:z;try{const bn=Fl(nt);for(;fe=bn.nextNode();)Zo(fe,nt),Jl(fe,nt),ta(fe.content)&&Va(fe.content)}catch(bn){throw Ge&&(Ut(se),xs(o.removed,Qt=>{Qt.element&&Cs(Qt.element)})),bn}if(Ge){let bn=!1;if(xs(o.removed,Qt=>{Qt.element&&(Qt.element===se&&(bn=!0),Cs(Qt.element))}),bn)throw Gl("a node selected for removal could not be safely returned; refusing to sanitize in place");return pt&&ma(se),se}if(gn){if(pt&&ma(z),wn)for(Ue=Ze.call(z.ownerDocument);z.firstChild;)Ue.appendChild(z.firstChild);else Ue=z;return(he.shadowroot||he.shadowrootmode)&&(Ue=kt.call(u,Ue,!0)),Ue}let Ot=ht?z.outerHTML:z.innerHTML;return ht&&O["!doctype"]&&z.ownerDocument&&z.ownerDocument.doctype&&z.ownerDocument.doctype.name&&Sn(kT,z.ownerDocument.doctype.name)&&(Ot="<!DOCTYPE "+z.ownerDocument.doctype.name+`>
227
- `+Ot),pt&&(Ot=Ya(Ot)),ie&&Bn?Ce(Ot):Ot},o.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};In(se),$e=!0,Vt=O,ea=he},o.clearConfig=function(){Nt=null,$e=!1,Vt=null,ea=null,ie=P,X=""},o.isValidAttribute=function(se,w,z){Nt||In({});const oe=at(se),fe=at(w);return Ni(oe,fe,z)},o.addHook=function(se,w){typeof w=="function"&&Un(j,se)&&xo(j[se],w)},o.removeHook=function(se,w){if(Un(j,se)){if(w!==void 0){const z=oT(j[se],w);return z===-1?void 0:rT(j[se],z,1)[0]}return ov(j[se])}},o.removeHooks=function(se){Un(j,se)&&(j[se]=[])},o.removeAllHooks=function(){j=bv()},o}var T0=A0();let Nh=[],Qc="";function OT(l,o=[]){Qc=l,Nh=[l,...o].filter(Boolean)}const DT=()=>Nh,LT=()=>Qc,zT=l=>l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),UT=l=>l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function HT(l,o=Qc){return`/api/agent/file?directory=${encodeURIComponent(o)}&path=${encodeURIComponent(l)}`}function BT(l){if(!l.length)return null;const o=l.map(c=>zT(c.replace(/[\\/]+$/,"")).replace(/\\\\|\//g,"[\\\\/]")).join("|");return new RegExp(`(?:${o})(?:[\\\\/][^\\s"'<>\`()\\[\\]{}|]*?)+?\\.[A-Za-z0-9]{1,8}(?=[\\s"'<>\`()\\[\\]{}|.,;:!?]|$)`,"g")}function IT(l,o=Nh,c=Qc){const u=BT(o);if(!u)return l;let d=0;return l.split(/(<[^>]+>)/).map(h=>h.startsWith("<")?(/^<a[\s>]/i.test(h)?d++:/^<\/a>/i.test(h)&&(d=Math.max(0,d-1)),h):d||!h?h:h.replace(u,m=>`<a class="file-link" href="${HT(qT(m),c)}" download title="Download ${UT(m)}">${m}</a>`)).join("")}function qT(l){return l.replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}Tt.setOptions({gfm:!0,breaks:!1});const $T=[];T0.addHook("afterSanitizeAttributes",l=>{l.tagName==="A"&&(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))});function Ic({text:l,className:o="",files:c=!1}){const u=c?DT():$T,d=c?LT():"",h=ph(),m=A.useMemo(()=>{const y=T0.sanitize(Tt.parse(l,{async:!1}));return Dw(c?IT(y,u,d):y,h)},[l,c,u,d,h]);return i.jsx("div",{className:"md "+o,dangerouslySetInnerHTML:{__html:m}})}const GT=/^ {0,3}(`{3,}|~{3,})[ \t]*(?:drawio|drawgen)\b[^\n]*$/i;function XT(l){const o=l.split(`
224
+ `}strong({tokens:l}){return`<strong>${this.parser.parseInline(l)}</strong>`}em({tokens:l}){return`<em>${this.parser.parseInline(l)}</em>`}codespan({text:l}){return`<code>${Fn(l,!0)}</code>`}br(l){return"<br>"}del({tokens:l}){return`<del>${this.parser.parseInline(l)}</del>`}link({href:l,title:o,text:c,tokens:u,autolink:d}){let h=d?Fn(c,!0):this.parser.parseInline(u),m=Jy(l);if(m===null)return h;l=Fn(m,d);let y='<a href="'+l+'"';return o&&(y+=' title="'+Fn(o)+'"'),y+=">"+h+"</a>",y}image({href:l,title:o,text:c,tokens:u}){u&&(c=this.parser.parseInline(u,this.parser.textRenderer));let d=Jy(l);if(d===null)return Fn(c);l=d;let h=`<img src="${Fn(l)}" alt="${Fn(c)}"`;return o&&(h+=` title="${Fn(o)}"`),h+=">",h}text(l){return"tokens"in l&&l.tokens?this.parser.parseInline(l.tokens):"escaped"in l&&l.escaped?l.text:Fn(l.text)}},jh=class{strong({text:l}){return l}em({text:l}){return l}codespan({text:l}){return l}del({text:l}){return l}html({text:l}){return l}text({text:l}){return l}link({text:l}){return""+l}image({text:l}){return""+l}br(){return""}checkbox({raw:l}){return l}},Ta=class Yf{constructor(o){Ct(this,"options");Ct(this,"renderer");Ct(this,"textRenderer");this.options=o||Ns,this.options.renderer=this.options.renderer||new Bc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new jh}static parse(o,c){return new Yf(c).parse(o)}static parseInline(o,c){return new Yf(c).parseInline(o)}parse(o){var u,d;this.renderer.parser=this;let c="";for(let h=0;h<o.length;h++){let m=o[h];if((d=(u=this.options.extensions)==null?void 0:u.renderers)!=null&&d[m.type]){let v=m,S=this.options.extensions.renderers[v.type].call({parser:this},v);if(S!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(v.type)){c+=S||"";continue}}let y=m;switch(y.type){case"space":{c+=this.renderer.space(y);break}case"hr":{c+=this.renderer.hr(y);break}case"heading":{c+=this.renderer.heading(y);break}case"code":{c+=this.renderer.code(y);break}case"table":{c+=this.renderer.table(y);break}case"blockquote":{c+=this.renderer.blockquote(y);break}case"list":{c+=this.renderer.list(y);break}case"checkbox":{c+=this.renderer.checkbox(y);break}case"html":{c+=this.renderer.html(y);break}case"def":{c+=this.renderer.def(y);break}case"paragraph":{c+=this.renderer.paragraph(y);break}case"text":{c+=this.renderer.text(y);break}default:{let v='Token with "'+y.type+'" type was not found.';if(this.options.silent)return console.error(v),"";throw new Error(v)}}}return c}parseInline(o,c=this.renderer){var d,h;this.renderer.parser=this;let u="";for(let m=0;m<o.length;m++){let y=o[m];if((h=(d=this.options.extensions)==null?void 0:d.renderers)!=null&&h[y.type]){let S=this.options.extensions.renderers[y.type].call({parser:this},y);if(S!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(y.type)){u+=S||"";continue}}let v=y;switch(v.type){case"escape":{u+=c.text(v);break}case"html":{u+=c.html(v);break}case"link":{u+=c.link(v);break}case"image":{u+=c.image(v);break}case"checkbox":{u+=c.checkbox(v);break}case"strong":{u+=c.strong(v);break}case"em":{u+=c.em(v);break}case"codespan":{u+=c.codespan(v);break}case"br":{u+=c.br(v);break}case"del":{u+=c.del(v);break}case"text":{u+=c.text(v);break}default:{let S='Token with "'+v.type+'" type was not found.';if(this.options.silent)return console.error(S),"";throw new Error(S)}}}return u}},jc,Eo=(jc=class{constructor(l){Ct(this,"options");Ct(this,"block");this.options=l||Ns}preprocess(l){return l}postprocess(l){return l}processAllTokens(l){return l}emStrongMask(l){return l}provideLexer(l=this.block){return l?Aa.lex:Aa.lexInline}provideParser(l=this.block){return l?Ta.parse:Ta.parseInline}},Ct(jc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),Ct(jc,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),jc),eT=class{constructor(...l){Ct(this,"defaults",bh());Ct(this,"options",this.setOptions);Ct(this,"parse",this.parseMarkdown(!0));Ct(this,"parseInline",this.parseMarkdown(!1));Ct(this,"Parser",Ta);Ct(this,"Renderer",Bc);Ct(this,"TextRenderer",jh);Ct(this,"Lexer",Aa);Ct(this,"Tokenizer",Hc);Ct(this,"Hooks",Eo);this.use(...l)}walkTokens(l,o){var u,d;let c=[];for(let h of l)switch(c=c.concat(o.call(this,h)),h.type){case"table":{let m=h;for(let y of m.header)c=c.concat(this.walkTokens(y.tokens,o));for(let y of m.rows)for(let v of y)c=c.concat(this.walkTokens(v.tokens,o));break}case"list":{let m=h;c=c.concat(this.walkTokens(m.items,o));break}default:{let m=h;(d=(u=this.defaults.extensions)==null?void 0:u.childTokens)!=null&&d[m.type]?this.defaults.extensions.childTokens[m.type].forEach(y=>{let v=m[y].flat(1/0);c=c.concat(this.walkTokens(v,o))}):m.tokens&&(c=c.concat(this.walkTokens(m.tokens,o)))}}return c}use(...l){let o=this.defaults.extensions||{renderers:{},childTokens:{}};return l.forEach(c=>{let u={...c};if(u.async=this.defaults.async||u.async||!1,c.extensions&&(c.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){let h=o.renderers[d.name];h?o.renderers[d.name]=function(...m){let y=d.renderer.apply(this,m);return y===!1&&(y=h.apply(this,m)),y}:o.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let h=o[d.level];h?h.unshift(d.tokenizer):o[d.level]=[d.tokenizer],d.start&&(d.level==="block"?o.startBlock?o.startBlock.push(d.start):o.startBlock=[d.start]:d.level==="inline"&&(o.startInline?o.startInline.push(d.start):o.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(o.childTokens[d.name]=d.childTokens)}),u.extensions=o),c.renderer){let d=this.defaults.renderer||new Bc(this.defaults);for(let h in c.renderer){if(!(h in d))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;let m=h,y=c.renderer[m],v=d[m];d[m]=(...S)=>{let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g||""}}u.renderer=d}if(c.tokenizer){let d=this.defaults.tokenizer||new Hc(this.defaults);for(let h in c.tokenizer){if(!(h in d))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;let m=h,y=c.tokenizer[m],v=d[m];d[m]=(...S)=>{let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g}}u.tokenizer=d}if(c.hooks){let d=this.defaults.hooks||new Eo;for(let h in c.hooks){if(!(h in d))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;let m=h,y=c.hooks[m],v=d[m];Eo.passThroughHooks.has(h)?d[m]=S=>{if(this.defaults.async&&Eo.passThroughHooksRespectAsync.has(h))return(async()=>{let b=await y.call(d,S);return v.call(d,b)})();let g=y.call(d,S);return v.call(d,g)}:d[m]=(...S)=>{if(this.defaults.async)return(async()=>{let b=await y.apply(d,S);return b===!1&&(b=await v.apply(d,S)),b})();let g=y.apply(d,S);return g===!1&&(g=v.apply(d,S)),g}}u.hooks=d}if(c.walkTokens){let d=this.defaults.walkTokens,h=c.walkTokens;u.walkTokens=function(m){let y=[];return y.push(h.call(this,m)),d&&(y=y.concat(d.call(this,m))),y}}this.defaults={...this.defaults,...u}}),this}setOptions(l){return this.defaults={...this.defaults,...l},this}lexer(l,o){return Aa.lex(l,o??this.defaults)}parser(l,o){return Ta.parse(l,o??this.defaults)}parseMarkdown(l){return(o,c)=>{let u={...c},d={...this.defaults,...u},h=this.onError(!!d.silent,!!d.async);if(this.defaults.async===!0&&u.async===!1)return h(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof o>"u"||o===null)return h(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return h(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(d.hooks&&(d.hooks.options=d,d.hooks.block=l),d.async)return(async()=>{let m=d.hooks?await d.hooks.preprocess(o):o,y=await(d.hooks?await d.hooks.provideLexer(l):l?Aa.lex:Aa.lexInline)(m,d),v=d.hooks?await d.hooks.processAllTokens(y):y;d.walkTokens&&await Promise.all(this.walkTokens(v,d.walkTokens));let S=await(d.hooks?await d.hooks.provideParser(l):l?Ta.parse:Ta.parseInline)(v,d);return d.hooks?await d.hooks.postprocess(S):S})().catch(h);try{d.hooks&&(o=d.hooks.preprocess(o));let m=(d.hooks?d.hooks.provideLexer(l):l?Aa.lex:Aa.lexInline)(o,d);d.hooks&&(m=d.hooks.processAllTokens(m)),d.walkTokens&&this.walkTokens(m,d.walkTokens);let y=(d.hooks?d.hooks.provideParser(l):l?Ta.parse:Ta.parseInline)(m,d);return d.hooks&&(y=d.hooks.postprocess(y)),y}catch(m){return h(m)}}}onError(l,o){return c=>{if(c.message+=`
225
+ Please report this to https://github.com/markedjs/marked.`,l){let u="<p>An error occurred:</p><pre>"+Fn(c.message+"",!0)+"</pre>";return o?Promise.resolve(u):u}if(o)return Promise.reject(c);throw c}}},Ts=new eT;function Tt(l,o){return Ts.parse(l,o)}Tt.options=Tt.setOptions=function(l){return Ts.setOptions(l),Tt.defaults=Ts.defaults,f0(Tt.defaults),Tt};Tt.getDefaults=bh;Tt.defaults=Ns;function tT(...l){return Ts.use(...l),Tt.defaults=Ts.defaults,f0(Tt.defaults),Tt}Tt.use=tT;Tt.walkTokens=function(l,o){return Ts.walkTokens(l,o)};Tt.parseInline=Ts.parseInline;Tt.Parser=Ta;Tt.parser=Ta.parse;Tt.Renderer=Bc;Tt.TextRenderer=jh;Tt.Lexer=Aa;Tt.lexer=Aa.lex;Tt.Tokenizer=Hc;Tt.Hooks=Eo;Tt.parse=Tt;Tt.options;Tt.setOptions;Tt.walkTokens;Tt.parseInline;Ta.parse;Aa.lex;/*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE */function sv(l,o){(o==null||o>l.length)&&(o=l.length);for(var c=0,u=Array(o);c<o;c++)u[c]=l[c];return u}function nT(l){if(Array.isArray(l))return l}function aT(l,o){var c=l==null?null:typeof Symbol<"u"&&l[Symbol.iterator]||l["@@iterator"];if(c!=null){var u,d,h,m,y=[],v=!0,S=!1;try{if(h=(c=c.call(l)).next,o!==0)for(;!(v=(u=h.call(c)).done)&&(y.push(u.value),y.length!==o);v=!0);}catch(g){S=!0,d=g}finally{try{if(!v&&c.return!=null&&(m=c.return(),Object(m)!==m))return}finally{if(S)throw d}}return y}}function lT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
226
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */function sT(l,o){return nT(l)||aT(l,o)||iT(l,o)||lT()}function iT(l,o){if(l){if(typeof l=="string")return sv(l,o);var c={}.toString.call(l).slice(8,-1);return c==="Object"&&l.constructor&&(c=l.constructor.name),c==="Map"||c==="Set"?Array.from(l):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?sv(l,o):void 0}}const w0=Object.entries,iv=Object.setPrototypeOf,oT=Object.isFrozen,rT=Object.getPrototypeOf,cT=Object.getOwnPropertyDescriptor;let tn=Object.freeze,on=Object.seal,vi=Object.create,A0=typeof Reflect<"u"&&Reflect,Vf=A0.apply,Qf=A0.construct;tn||(tn=function(o){return o});on||(on=function(o){return o});Vf||(Vf=function(o,c){for(var u=arguments.length,d=new Array(u>2?u-2:0),h=2;h<u;h++)d[h-2]=arguments[h];return o.apply(c,d)});Qf||(Qf=function(o){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return new o(...u)});const xs=Jt(Array.prototype.forEach),uT=Jt(Array.prototype.lastIndexOf),ov=Jt(Array.prototype.pop),xo=Jt(Array.prototype.push),dT=Jt(Array.prototype.splice),xi=Array.isArray,Co=Jt(String.prototype.toLowerCase),Ef=Jt(String.prototype.toString),rv=Jt(String.prototype.match),So=Jt(String.prototype.replace),cv=Jt(String.prototype.indexOf),fT=Jt(String.prototype.trim),hT=Jt(Number.prototype.toString),mT=Jt(Boolean.prototype.toString),uv=typeof BigInt>"u"?null:Jt(BigInt.prototype.toString),dv=typeof Symbol>"u"?null:Jt(Symbol.prototype.toString),Un=Jt(Object.prototype.hasOwnProperty),wo=Jt(Object.prototype.toString),Sn=Jt(RegExp.prototype.test),Gl=pT(TypeError);function Jt(l){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return Vf(l,o,u)}}function pT(l){return function(){for(var o=arguments.length,c=new Array(o),u=0;u<o;u++)c[u]=arguments[u];return Qf(l,c)}}function ft(l,o){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Co;if(iv&&iv(l,null),!xi(o))return l;let u=o.length;for(;u--;){let d=o[u];if(typeof d=="string"){const h=c(d);h!==d&&(oT(o)||(o[u]=h),d=h)}l[d]=!0}return l}function gT(l){for(let o=0;o<l.length;o++)Un(l,o)||(l[o]=null);return l}function Jn(l){const o=vi(null);for(const u of w0(l)){var c=sT(u,2);const d=c[0],h=c[1];Un(l,d)&&(xi(h)?o[d]=gT(h):h&&typeof h=="object"&&h.constructor===Object?o[d]=Jn(h):o[d]=h)}return o}function yT(l){switch(typeof l){case"string":return l;case"number":return hT(l);case"boolean":return mT(l);case"bigint":return uv?uv(l):"0";case"symbol":return dv?dv(l):"Symbol()";case"undefined":return wo(l);case"function":case"object":{if(l===null)return wo(l);const o=l,c=da(o,"toString");if(typeof c=="function"){const u=c(o);return typeof u=="string"?u:wo(u)}return wo(l)}default:return wo(l)}}function da(l,o){for(;l!==null;){const u=cT(l,o);if(u){if(u.get)return Jt(u.get);if(typeof u.value=="function")return Jt(u.value)}l=rT(l)}function c(){return null}return c}function vT(l){try{return Sn(l,""),!0}catch{return!1}}const fv=tn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cf=tn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mf=tn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),bT=tn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_f=tn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),xT=tn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),hv=tn(["#text"]),mv=tn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Rf=tn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pv=tn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xc=tn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ST=on(/{{[\w\W]*|^[\w\W]*}}/g),wT=on(/<%[\w\W]*|^[\w\W]*%>/g),AT=on(/\${[\w\W]*/g),TT=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),kT=on(/^aria-[\-\w]+$/),gv=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jT=on(/^(?:\w+script|data):/i),NT=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ET=on(/^html$/i),CT=on(/^[a-z][.\w]*(-[.\w]+)+$/i),yv=on(/<[/\w!]/g),vv=on(/<[/\w]/g),MT=on(/<\/no(script|embed|frames)/i),_T=on(/\/>/i),Pn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},T0=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],RT=tn(ft({},T0)),OT=(function(){const l={};return xs(T0,o=>{l[o]=on(new RegExp("</"+o+"(?=[\\t\\n\\f\\r />])","i"))}),tn(l)})(),DT=function(){return typeof window>"u"?null:window},LT=function(o,c){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let u=null;const d="data-tt-policy-suffix";c&&c.hasAttribute(d)&&(u=c.getAttribute(d));const h="dompurify"+(u?"#"+u:"");try{return o.createPolicy(h,{createHTML(m){return m},createScriptURL(m){return m}})}catch{return console.warn("TrustedTypes policy "+h+" could not be created."),null}},bv=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Xl=function(o,c,u,d){return Un(o,c)&&xi(o[c])?ft(d.base?Jn(d.base):{},o[c],d.transform):u},Of=function(o,c,u){const d=Un(o,c)?o[c]:void 0;return d&&typeof d=="object"?Jn(d):u()};function k0(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:DT();const o=se=>k0(se);if(o.version="3.4.16",o.removed=[],!l||!l.document||l.document.nodeType!==Pn.document||!l.Element)return o.isSupported=!1,o;let c=l.document;const u=c,d=u.currentScript;l.DocumentFragment;const h=l.HTMLTemplateElement,m=l.Node,y=l.Element,v=l.NodeFilter;l.NamedNodeMap===void 0&&(l.NamedNodeMap||l.MozNamedAttrMap),l.HTMLFormElement;const S=l.DOMParser,g=l.trustedTypes,b=y.prototype,x=da(b,"cloneNode"),k=da(b,"remove"),L=da(b,"removeAttributeNode"),V=da(b,"nextSibling"),z=da(b,"childNodes"),Z=da(b,"parentNode"),oe=da(b,"shadowRoot"),de=da(b,"attributes"),C=m&&m.prototype?da(m.prototype,"nodeType"):null,Y=m&&m.prototype?da(m.prototype,"nodeName"):null,O=m&&m.prototype?da(m.prototype,"ownerDocument"):null,X=function(w){return C?C(w):w.nodeType},F=function(w){return Y?Y(w):w.nodeName};if(typeof h=="function"){const se=c.createElement("template");se.content&&se.content.ownerDocument&&(c=se.content.ownerDocument)}let ie,G="",Q,K=!1,me=0;const ve=function(){if(me>0)throw Gl('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Ce=function(w){ve(),me++;try{return ie.createHTML(w)}finally{me--}},ne=function(w){ve(),me++;try{return ie.createScriptURL(w)}finally{me--}},te=function(){return K||(Q=LT(g,d),K=!0),Q},ce=c,ee=ce.implementation,ke=ce.createNodeIterator,Ze=ce.createDocumentFragment,bt=ce.getElementsByTagName,kt=u.importNode;let j=bv();o.isSupported=typeof w0=="function"&&typeof Z=="function"&&ee&&ee.createHTMLDocument!==void 0;const ae=ST,je=wT,pe=AT,Ie=TT,Oe=kT,ze=jT,Se=NT,_e=CT;let mt=gv,D=null;const we=ft({},[...fv,...Cf,...Mf,..._f,...hv]);let he=null;const Be=ft({},[...mv,...Rf,...pv,...xc]);let Ee=Object.seal(vi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,Te=null;const be=Object.seal(vi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let qe=!0,q=!0,Re=!1,He=!0,pt=!1,Ve=!0,ht=!1,$e=!1,Vt=null,ea=null,fa=!1,gn=!1,wn=!1,Bn=!1,ka=!0,An=!1;const nn="user-content-";let yt=!0,Ga=!1,yn={},vn=null;const Cn=ft({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let B=null;const ue=ft({},["audio","video","img","source","image","track"]);let Ae=null;const De=ft({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ye="http://www.w3.org/1998/Math/MathML",Qe="http://www.w3.org/2000/svg",Pe="http://www.w3.org/1999/xhtml";let jt=Pe,Wt=!1,Mn=null;const hl=ft({},[Ye,Qe,Pe],Ef),ja=tn(["mi","mo","mn","ms","mtext"]);let ha=ft({},ja);const N=tn(["annotation-xml"]);let P=ft({},N);const ge=ft({},["title","style","font","a","script"]);let xe=null;const et=["application/xhtml+xml","text/html"],ct="text/html";let at=null,Nt=null;const lt=c.createElement("form"),Bt=function(w){return w instanceof RegExp||w instanceof Function},In=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Nt&&Nt===w)return;(!w||typeof w!="object")&&(w={}),w=Jn(w),xe=et.indexOf(w.PARSER_MEDIA_TYPE)===-1?ct:w.PARSER_MEDIA_TYPE,at=xe==="application/xhtml+xml"?Ef:Co,D=Xl(w,"ALLOWED_TAGS",we,{transform:at}),he=Xl(w,"ALLOWED_ATTR",Be,{transform:at}),Mn=Xl(w,"ALLOWED_NAMESPACES",hl,{transform:Ef}),Ae=Xl(w,"ADD_URI_SAFE_ATTR",De,{transform:at,base:De}),B=Xl(w,"ADD_DATA_URI_TAGS",ue,{transform:at,base:ue}),vn=Xl(w,"FORBID_CONTENTS",Cn,{transform:at}),le=Xl(w,"FORBID_TAGS",Jn({}),{transform:at}),Te=Xl(w,"FORBID_ATTR",Jn({}),{transform:at}),yn=Un(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Jn(w.USE_PROFILES):w.USE_PROFILES:!1,qe=w.ALLOW_ARIA_ATTR!==!1,q=w.ALLOW_DATA_ATTR!==!1,Re=w.ALLOW_UNKNOWN_PROTOCOLS||!1,He=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pt=w.SAFE_FOR_TEMPLATES||!1,Ve=w.SAFE_FOR_XML!==!1,ht=w.WHOLE_DOCUMENT||!1,gn=w.RETURN_DOM||!1,wn=w.RETURN_DOM_FRAGMENT||!1,Bn=w.RETURN_TRUSTED_TYPE||!1,fa=w.FORCE_BODY||!1,ka=w.SANITIZE_DOM!==!1,An=w.SANITIZE_NAMED_PROPS||!1,yt=w.KEEP_CONTENT!==!1,Ga=w.IN_PLACE||!1,mt=vT(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:gv,jt=typeof w.NAMESPACE=="string"?w.NAMESPACE:Pe,ha=Of(w,"MATHML_TEXT_INTEGRATION_POINTS",()=>ft({},ja)),P=Of(w,"HTML_INTEGRATION_POINTS",()=>ft({},N));const U=Of(w,"CUSTOM_ELEMENT_HANDLING",()=>vi(null));if(Ee=vi(null),Un(U,"tagNameCheck")&&Bt(U.tagNameCheck)&&(Ee.tagNameCheck=U.tagNameCheck),Un(U,"attributeNameCheck")&&Bt(U.attributeNameCheck)&&(Ee.attributeNameCheck=U.attributeNameCheck),Un(U,"allowCustomizedBuiltInElements")&&typeof U.allowCustomizedBuiltInElements=="boolean"&&(Ee.allowCustomizedBuiltInElements=U.allowCustomizedBuiltInElements),on(Ee),pt&&(q=!1),wn&&(gn=!0),yn&&(D=ft({},hv),he=vi(null),yn.html===!0&&(ft(D,fv),ft(he,mv)),yn.svg===!0&&(ft(D,Cf),ft(he,Rf),ft(he,xc)),yn.svgFilters===!0&&(ft(D,Mf),ft(he,Rf),ft(he,xc)),yn.mathMl===!0&&(ft(D,_f),ft(he,pv),ft(he,xc))),be.tagCheck=null,be.attributeCheck=null,Un(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?be.tagCheck=w.ADD_TAGS:xi(w.ADD_TAGS)&&(D===we&&(D=Jn(D)),ft(D,w.ADD_TAGS,at))),Un(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?be.attributeCheck=w.ADD_ATTR:xi(w.ADD_ATTR)&&(he===Be&&(he=Jn(he)),ft(he,w.ADD_ATTR,at))),Un(w,"ADD_FORBID_CONTENTS")&&xi(w.ADD_FORBID_CONTENTS)&&(vn===Cn&&(vn=Jn(vn)),ft(vn,w.ADD_FORBID_CONTENTS,at)),yt&&(D["#text"]=!0),ht&&ft(D,["html","head","body"]),D.table&&(ft(D,["tbody"]),delete le.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const re=ie;ie=w.TRUSTED_TYPES_POLICY;try{G=Ce("")}catch(fe){throw ie=re,fe}}else w.TRUSTED_TYPES_POLICY===null?(ie=void 0,G=""):(ie===void 0&&(ie=te()),ie&&typeof G=="string"&&(G=Ce("")));tn&&tn(w),Nt=w},Xa=ft({},[...Cf,...Mf,...bT]),Na=ft({},[..._f,...xT]),Zl=function(w,U,re){return U.namespaceURI===Pe?w==="svg":U.namespaceURI===Ye?w==="svg"&&(re==="annotation-xml"||ha[re]):!!Xa[w]},Ea=function(w,U,re){return U.namespaceURI===Pe?w==="math":U.namespaceURI===Qe?w==="math"&&P[re]:!!Na[w]},ml=function(w,U,re){return U.namespaceURI===Qe&&!P[re]||U.namespaceURI===Ye&&!ha[re]?!1:!Na[w]&&(ge[w]||!Xa[w])},Es=function(w){let U=Z(w);(!U||!U.tagName)&&(U={namespaceURI:jt,tagName:"template"});const re=Co(w.tagName),fe=Co(U.tagName);return Mn[w.namespaceURI]?w.namespaceURI===Qe?Zl(re,U,fe):w.namespaceURI===Ye?Ea(re,U,fe):w.namespaceURI===Pe?ml(re,U,fe):!!(xe==="application/xhtml+xml"&&Mn[w.namespaceURI]):!1},Gt=function(w){xo(o.removed,{element:w});try{Z(w).removeChild(w)}catch{if(k(w),!Z(w))throw Gl("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},zt=function(w,U,re){try{L(w,U)}catch{try{w.removeAttribute(re)}catch{}}},Ut=function(w){Cs(w);const U=z(w);if(U){const fe=[];xs(U,Ue=>{xo(fe,Ue)}),xs(fe,Ue=>{try{k(Ue)}catch{}})}const re=de(w);if(re)for(let fe=re.length-1;fe>=0;--fe){const Ue=re[fe],Ge=Ue&&Ue.name;typeof Ge=="string"&&zt(w,Ue,Ge)}},_n=function(w,U,re){if(!re)try{re=U.getAttributeNode(w)}catch{re=null}xo(o.removed,{attribute:re||null,from:U});try{re?L(U,re):U.removeAttribute(w)}catch{try{U.removeAttribute(w)}catch{}}if(w==="is")if(gn||wn)try{Gt(U)}catch{}else try{U.setAttribute(w,"")}catch{}},Xo=function(w){const U=de(w);if(U)for(let re=U.length-1;re>=0;--re){const fe=U[re],Ue=fe&&fe.name;typeof Ue!="string"||he[at(Ue)]||zt(w,fe,Ue)}},Cs=function(w){const U=[w];for(;U.length>0;){const re=U.pop();X(re)===Pn.element&&Xo(re);const fe=z(re);if(fe)for(let Ue=fe.length-1;Ue>=0;--Ue)U.push(fe[Ue])}},Yo=function(w,U){return Ve?w==="patchsrc"?!0:w==="for"&&U!=="label"&&U!=="output":!1},Vo=function(w){if(!Ve)return;const U=[w];for(;U.length>0;){const re=U.pop(),fe=X(re);if(fe===Pn.processingInstruction||fe===Pn.comment&&Sn(vv,re.data)){try{k(re)}catch{}continue}if(fe===Pn.element){const Ge=re,nt=at(F(re));try{Ge.hasAttribute&&Ge.hasAttribute("patchsrc")&&Ge.removeAttribute("patchsrc"),Ge.hasAttribute&&Ge.hasAttribute("for")&&Yo("for",nt)&&Ge.removeAttribute("for")}catch{}}const Ue=z(re);if(Ue)for(let Ge=Ue.length-1;Ge>=0;--Ge)U.push(Ue[Ge])}},pl=function(w){let U=null,re=null;if(fa)w="<remove></remove>"+w;else{const Ge=rv(w,/^[\r\n\t ]+/);re=Ge&&Ge[0]}xe==="application/xhtml+xml"&&jt===Pe&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");const fe=ie?Ce(w):w;if(jt===Pe)try{U=new S().parseFromString(fe,xe)}catch{}if(!U||!U.documentElement){U=ee.createDocument(jt,"template",null);try{U.documentElement.innerHTML=Wt?G:fe}catch{}}const Ue=U.body||U.documentElement;return w&&re&&Ue.insertBefore(c.createTextNode(re),Ue.childNodes[0]||null),jt===Pe?bt.call(U,ht?"html":"body")[0]:ht?U.documentElement:Ue},Pl=function(w){const U=O?O(w):w.ownerDocument;return ke.call(U||w,w,v.SHOW_ELEMENT|v.SHOW_COMMENT|v.SHOW_TEXT|v.SHOW_PROCESSING_INSTRUCTION|v.SHOW_CDATA_SECTION,null)},Ya=function(w){return w=So(w,ae," "),w=So(w,je," "),w=So(w,pe," "),w},ma=function(w){var U;w.normalize();const re=O?O(w):w.ownerDocument,fe=ke.call(re||w,w,v.SHOW_TEXT|v.SHOW_COMMENT|v.SHOW_CDATA_SECTION|v.SHOW_PROCESSING_INSTRUCTION,null);let Ue=fe.nextNode();for(;Ue;)Ue.data=Ya(Ue.data),Ue=fe.nextNode();const Ge=(U=w.querySelectorAll)===null||U===void 0?void 0:U.call(w,"template");Ge&&xs(Ge,nt=>{ta(nt.content)&&ma(nt.content)})},pa=function(w){const U=Y?Y(w):null;return typeof U!="string"||at(U)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==de(w)||typeof w.removeAttribute!="function"||typeof w.removeAttributeNode!="function"||typeof w.getAttributeNode!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==C(w)||w.childNodes!==z(w)},ta=function(w){if(!C||typeof w!="object"||w===null)return!1;try{return C(w)===Pn.documentFragment}catch{return!1}},na=function(w){if(!C||typeof w!="object"||w===null)return!1;try{return typeof C(w)=="number"}catch{return!1}};function xt(se,w,U){se.length!==0&&xs(se,re=>{re.call(o,w,U,Nt)})}const Qo=function(w,U){return!!(Ve&&w.hasChildNodes()&&!na(w.firstElementChild)&&Sn(yv,w.textContent)&&Sn(yv,w.innerHTML)||Ve&&w.namespaceURI===Pe&&RT[U]&&(na(w.firstElementChild)||typeof w.textContent=="string"&&Sn(OT[U],w.textContent))||w.nodeType===Pn.processingInstruction||Ve&&w.nodeType===Pn.comment&&Sn(vv,w.data))},Fl=function(w,U){if(w instanceof RegExp)return Sn(w,U);if(w instanceof Function){for(var re=arguments.length,fe=new Array(re>2?re-2:0),Ue=2;Ue<re;Ue++)fe[Ue-2]=arguments[Ue];return!!w(U,...fe)}return!1},Ko=function(w,U,re){if(!le[U]&&Fo(U)&&Fl(Ee.tagNameCheck,U))return!1;if(yt&&!vn[U]){const fe=Z(w),Ue=z(w);if(Ue&&fe){const Ge=Ue.length;for(let nt=Ge-1;nt>=0;--nt){const Ot=w===re?x(Ue[nt],!0):Ue[nt];fe.insertBefore(Ot,V(w))}}}return Gt(w),!0},Ca=function(w,U,re,fe){return w.length===0?U:U===re||U===fe?Jn(U):U},qn=function(w,U){return w===U||Z(w)!==null?!1:(Ga&&Cs(w),!0)},Zo=function(w,U){if(xt(j.beforeSanitizeElements,w,null),qn(w,U))return!0;if(pa(w))return Gt(w),!0;const re=at(F(w));if(D=Ca(j.uponSanitizeElement,D,we,Vt),xt(j.uponSanitizeElement,w,{tagName:re,allowedTags:D}),qn(w,U))return!0;if(Qo(w,re))return Gt(w),!0;if(le[re]||!(be.tagCheck instanceof Function&&be.tagCheck(re))&&!D[re]){const fe=Ko(w,re,U);return fe===!1&&(xt(j.afterSanitizeElements,w,null),qn(w,U))?!0:fe}if(X(w)===Pn.element&&!Es(w)||(re==="noscript"||re==="noembed"||re==="noframes")&&Sn(MT,w.innerHTML))return Gt(w),!0;if(pt&&w.nodeType===Pn.text){const fe=Ya(w.textContent);w.textContent!==fe&&(xo(o.removed,{element:w.cloneNode()}),w.textContent=fe)}return xt(j.afterSanitizeElements,w,null),qn(w,U)},Ni=function(w,U,re){if(Te[U]||Yo(U,w)||ka&&(U==="id"||U==="name")&&(re in c||re in lt))return!1;const fe=he[U]||be.attributeCheck instanceof Function&&be.attributeCheck(U,w);return q&&Sn(Ie,U)||qe&&Sn(Oe,U)?!0:fe?Ae[U]||Sn(mt,So(re,Se,""))||(U==="src"||U==="xlink:href"||U==="href")&&w!=="script"&&cv(re,"data:")===0&&B[w]||Re&&!Sn(ze,So(re,Se,""))?!0:!re:Fo(w)&&Fl(Ee.tagNameCheck,w)&&Fl(Ee.attributeNameCheck,U,w)||U==="is"&&Ee.allowCustomizedBuiltInElements&&Fl(Ee.tagNameCheck,re)},Po=ft({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Fo=function(w){return!Po[Co(w)]&&Sn(_e,w)},ut=function(w,U,re,fe){if(ie&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!re)switch(g.getAttributeType(w,U)){case"TrustedHTML":return Ce(fe);case"TrustedScriptURL":return ne(fe)}return fe},Jo=function(w,U,re,fe){try{return re?w.setAttributeNS(re,U,fe):w.setAttribute(U,fe),pa(w)?(Gt(w),!1):!0}catch{return _n(U,w),!1}},Jl=function(w,U){if(xt(j.beforeSanitizeAttributes,w,null),qn(w,U))return;const re=w.attributes;if(!re||pa(w))return;he=Ca(j.uponSanitizeAttribute,he,Be,ea);const fe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:he,forceKeepAttr:void 0};let Ue=re.length;const Ge=at(w.nodeName);for(;Ue--;){const nt=re[Ue],Ot=nt.name,bn=nt.namespaceURI,Qt=nt.value,Qa=at(Ot),Ms=Qt;let It=Ot==="value"?Ms:fT(Ms),Wo=!1;if(fe.attrName=Qa,fe.attrValue=It,fe.keepAttr=!0,fe.forceKeepAttr=void 0,xt(j.uponSanitizeAttribute,w,fe),It=fe.attrValue,An&&(Qa==="id"||Qa==="name")&&cv(It,nn)!==0&&(_n(Ot,w,nt),It=nn+It,Wo=!0),Ve&&Sn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,It)){_n(Ot,w,nt);continue}if(Qa==="attributename"&&rv(It,"href")){_n(Ot,w,nt);continue}if(!fe.forceKeepAttr){if(!fe.keepAttr){_n(Ot,w,nt);continue}if(!He&&Sn(_T,It)){_n(Ot,w,nt);continue}if(pt&&(It=Ya(It)),!Ni(Ge,Qa,It)){_n(Ot,w,nt);continue}It=ut(Ge,Qa,bn,It),It!==Ms&&Jo(w,Ot,bn,It)&&Wo&&ov(o.removed)}}xt(j.afterSanitizeAttributes,w,null),qn(w,U)},Va=function(w){let U=null;const re=Pl(w);for(xt(j.beforeSanitizeShadowDOM,w,null);U=re.nextNode();)if(xt(j.uponSanitizeShadowNode,U,null),Zo(U,w),Jl(U,w),ta(U.content)&&Va(U.content),X(U)===Pn.element){const fe=oe(U);ta(fe)&&($n(fe),Va(fe))}xt(j.afterSanitizeShadowDOM,w,null)},$n=function(w){const U=[{node:w,shadow:null}];for(;U.length>0;){const re=U.pop();if(re.shadow){Va(re.shadow);continue}const fe=re.node,Ue=X(fe)===Pn.element,Ge=z(fe);if(Ge)for(let nt=Ge.length-1;nt>=0;--nt)U.push({node:Ge[nt],shadow:null});if(Ue){const nt=Y?Y(fe):null;if(typeof nt=="string"&&at(nt)==="template"){const Ot=fe.content;ta(Ot)&&U.push({node:Ot,shadow:null})}}if(Ue){const nt=oe(fe);ta(nt)&&U.push({node:null,shadow:nt},{node:nt,shadow:null})}}};return o.sanitize=function(se){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},U=null,re=null,fe=null,Ue=null;if(Wt=!se,Wt&&(se="<!-->"),typeof se!="string"&&!na(se)&&(se=yT(se),typeof se!="string"))throw Gl("dirty is not a string, aborting");if(!o.isSupported)return se;$e?(D=Vt,he=ea):In(w),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(D=Jn(D)),j.uponSanitizeAttribute.length>0&&(he=Jn(he)),o.removed=[];const Ge=Ga&&typeof se!="string"&&na(se);if(Ge){Vo(se);const bn=F(se);if(typeof bn=="string"){const Qt=at(bn);if(!D[Qt]||le[Qt])throw Ut(se),Gl("root node is forbidden and cannot be sanitized in-place")}if(pa(se))throw Ut(se),Gl("root node is clobbered and cannot be sanitized in-place");try{$n(se)}catch(Qt){throw Ut(se),Qt}}else if(na(se))U=pl("<!---->"),re=U.ownerDocument.importNode(se,!0),re.nodeType===Pn.element&&re.nodeName==="BODY"||re.nodeName==="HTML"?U=re:U.appendChild(re),$n(U);else{if(!gn&&!pt&&!ht&&se.indexOf("<")===-1)return ie&&Bn?Ce(se):se;if(U=pl(se),!U)return gn?null:Bn?G:""}U&&fa&&Gt(U.firstChild);const nt=Ge?se:U;try{const bn=Pl(nt);for(;fe=bn.nextNode();)Zo(fe,nt),Jl(fe,nt),ta(fe.content)&&Va(fe.content)}catch(bn){throw Ge&&(Ut(se),xs(o.removed,Qt=>{Qt.element&&Cs(Qt.element)})),bn}if(Ge){let bn=!1;if(xs(o.removed,Qt=>{Qt.element&&(Qt.element===se&&(bn=!0),Cs(Qt.element))}),bn)throw Gl("a node selected for removal could not be safely returned; refusing to sanitize in place");return pt&&ma(se),se}if(gn){if(pt&&ma(U),wn)for(Ue=Ze.call(U.ownerDocument);U.firstChild;)Ue.appendChild(U.firstChild);else Ue=U;return(he.shadowroot||he.shadowrootmode)&&(Ue=kt.call(u,Ue,!0)),Ue}let Ot=ht?U.outerHTML:U.innerHTML;return ht&&D["!doctype"]&&U.ownerDocument&&U.ownerDocument.doctype&&U.ownerDocument.doctype.name&&Sn(ET,U.ownerDocument.doctype.name)&&(Ot="<!DOCTYPE "+U.ownerDocument.doctype.name+`>
227
+ `+Ot),pt&&(Ot=Ya(Ot)),ie&&Bn?Ce(Ot):Ot},o.setConfig=function(){let se=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};In(se),$e=!0,Vt=D,ea=he},o.clearConfig=function(){Nt=null,$e=!1,Vt=null,ea=null,ie=Q,G=""},o.isValidAttribute=function(se,w,U){Nt||In({});const re=at(se),fe=at(w);return Ni(re,fe,U)},o.addHook=function(se,w){typeof w=="function"&&Un(j,se)&&xo(j[se],w)},o.removeHook=function(se,w){if(Un(j,se)){if(w!==void 0){const U=uT(j[se],w);return U===-1?void 0:dT(j[se],U,1)[0]}return ov(j[se])}},o.removeHooks=function(se){Un(j,se)&&(j[se]=[])},o.removeAllHooks=function(){j=bv()},o}var j0=k0();let Nh=[],Qc="";function zT(l,o=[]){Qc=l,Nh=[l,...o].filter(Boolean)}const UT=()=>Nh,HT=()=>Qc,BT=l=>l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),IT=l=>l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function qT(l,o=Qc){return`/api/agent/file?directory=${encodeURIComponent(o)}&path=${encodeURIComponent(l)}`}function $T(l){if(!l.length)return null;const o=l.map(c=>BT(c.replace(/[\\/]+$/,"")).replace(/\\\\|\//g,"[\\\\/]")).join("|");return new RegExp(`(?:${o})(?:[\\\\/][^\\s"'<>\`()\\[\\]{}|]*?)+?\\.[A-Za-z0-9]{1,8}(?=[\\s"'<>\`()\\[\\]{}|.,;:!?]|$)`,"g")}function GT(l,o=Nh,c=Qc){const u=$T(o);if(!u)return l;let d=0;return l.split(/(<[^>]+>)/).map(h=>h.startsWith("<")?(/^<a[\s>]/i.test(h)?d++:/^<\/a>/i.test(h)&&(d=Math.max(0,d-1)),h):d||!h?h:h.replace(u,m=>`<a class="file-link" href="${qT(XT(m),c)}" download title="Download ${IT(m)}">${m}</a>`)).join("")}function XT(l){return l.replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}Tt.setOptions({gfm:!0,breaks:!1});const YT=[];j0.addHook("afterSanitizeAttributes",l=>{l.tagName==="A"&&(l.setAttribute("target","_blank"),l.setAttribute("rel","noopener noreferrer"))});function Ic({text:l,className:o="",files:c=!1}){const u=c?UT():YT,d=c?HT():"",h=ph(),m=A.useMemo(()=>{const y=j0.sanitize(Tt.parse(l,{async:!1}));return U1(c?GT(y,u,d):y,h)},[l,c,u,d,h]);return s.jsx("div",{className:"md "+o,dangerouslySetInnerHTML:{__html:m}})}const VT=/^ {0,3}(`{3,}|~{3,})[ \t]*(?:drawio|drawgen)\b[^\n]*$/i;function QT(l){const o=l.split(`
228
228
  `),c=[];let u=[];const d=()=>{u.join(`
229
229
  `).trim()&&c.push({type:"md",text:u.join(`
230
- `)}),u=[]};for(let h=0;h<o.length;h++){const m=o[h].match(GT);if(!m){u.push(o[h]);continue}const y=m[1],v=new RegExp(`^ {0,3}${y[0]==="`"?"`":"~"}{${y.length},}[ \\t]*$`),S=[];let g=h+1;for(;g<o.length&&!v.test(o[g]);)S.push(o[g++]);d(),c.push({type:"drawio",spec:S.join(`
231
- `),closed:g<o.length}),h=g}return d(),c}function YT(l,o){return["The diagram renderer reported these problems with your drawio spec:",...(l?l.split(`
230
+ `)}),u=[]};for(let h=0;h<o.length;h++){const m=o[h].match(VT);if(!m){u.push(o[h]);continue}const y=m[1],v=new RegExp(`^ {0,3}${y[0]==="`"?"`":"~"}{${y.length},}[ \\t]*$`),S=[];let g=h+1;for(;g<o.length&&!v.test(o[g]);)S.push(o[g++]);d(),c.push({type:"drawio",spec:S.join(`
231
+ `),closed:g<o.length}),h=g}return d(),c}function KT(l,o){return["The diagram renderer reported these problems with your drawio spec:",...(l?l.split(`
232
232
  `).filter(Boolean):o.map(u=>`${u.severity} ${u.code} ${u.cell}: ${u.message}`)).slice(0,30).map(u=>`- ${u}`),"","Reply with the corrected spec in a single ```drawio block."].join(`
233
- `)}const VT=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"diagram",Ao=new Map;let QT=null;const k0=()=>QT??(QT=fetch("/api/render/status").then(l=>l.json()).then(l=>!!(l!=null&&l.ok)).catch(()=>!1));function j0(l){const o=typeof l=="string"?l:JSON.stringify(l);let c=Ao.get(o);return c||(c=fetch("/api/render/drawio",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spec:l})}).then(async u=>{var h;const d=await u.json().catch(()=>({}));return u.ok?{ok:!0,r:d}:{ok:!1,error:((h=d==null?void 0:d.error)==null?void 0:h.message)||`Rendering failed (${u.status})`}}).catch(u=>({ok:!1,error:String((u==null?void 0:u.message)??u)})),Ao.set(o,c),Ao.size>60&&Ao.delete(Ao.keys().next().value)),c}function xv(l,o,c){const u=URL.createObjectURL(new Blob([o],{type:c}));Object.assign(document.createElement("a"),{href:u,download:l}).click(),setTimeout(()=>URL.revokeObjectURL(u),1e3)}function KT({text:l,streaming:o,onFix:c}){const u=A.useMemo(()=>XT(l),[l]);return u.length===1&&u[0].type==="md"?i.jsx(Ic,{text:l}):i.jsx(i.Fragment,{children:u.map((d,h)=>d.type==="md"?i.jsx(Ic,{text:d.text},h):i.jsx(ZT,{spec:d.spec,pending:!d.closed&&o,onFix:c},h))})}function ZT({spec:l,pending:o,onFix:c}){const[u,d]=A.useState(null),[h,m]=A.useState(null),[y,v]=A.useState(!1);A.useEffect(()=>{k0().then(d)},[]),A.useEffect(()=>{if(o||!u||!l.trim())return;let k=!0;return m(null),j0(l).then(D=>k&&m(D)),()=>{k=!1}},[l,o,u]);const S=A.useMemo(()=>h!=null&&h.ok?URL.createObjectURL(new Blob([h.r.svg],{type:"image/svg+xml"})):null,[h]);A.useEffect(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);const g=i.jsx("pre",{className:"diagram-spec",children:i.jsx("code",{children:l})});if(o)return i.jsxs("div",{className:"diagram-card",children:[i.jsxs("div",{className:"diagram-head",children:[i.jsx("span",{className:"diagram-tag",children:"drawio"})," drawing…"]}),g]});if(u===!1)return i.jsxs("div",{className:"diagram-card",children:[i.jsxs("div",{className:"diagram-head",children:[i.jsx("span",{className:"diagram-tag",children:"drawio"})," Diagram rendering needs the render service (Docker setup)."]}),g]});if(!h)return i.jsx("div",{className:"diagram-card",children:i.jsxs("div",{className:"diagram-head",children:[i.jsx("span",{className:"diagram-tag",children:"drawio"})," rendering…"]})});const b=h.ok?h.r.check.issues:[],x=h.ok?VT(h.r.title):"diagram";return i.jsxs("div",{className:"diagram-card",children:[i.jsxs("div",{className:"diagram-head",children:[i.jsx("span",{className:"diagram-tag",children:"drawio"}),i.jsx("span",{className:"diagram-title",children:h.ok?h.r.title:"Diagram spec has problems"}),h.ok&&(b.length?i.jsxs("span",{className:"diagram-warn",title:b.map(k=>`${k.severity} ${k.code} ${k.cell}: ${k.message}`).join(`
234
- `),children:[b.length," layout issue",b.length===1?"":"s"]}):i.jsx("span",{className:"diagram-ok",children:"checked"})),i.jsx("span",{className:"spacer"}),h.ok&&i.jsx("button",{className:"btn ghost sm",onClick:()=>xv(`${x}.drawio.svg`,h.r.svg,"image/svg+xml"),title:"An SVG with the diagram embedded: opens for editing in draw.io and its VS Code extension",children:".drawio.svg"}),h.ok&&i.jsx("button",{className:"btn ghost sm",onClick:()=>xv(`${x}.drawio`,h.r.xml,"application/xml"),children:".drawio"}),i.jsx("button",{className:"btn ghost sm",onClick:()=>v(k=>!k),children:y?"hide spec":"spec"}),c&&(!h.ok||b.length>0)&&i.jsx("button",{className:"btn sm",onClick:()=>c(YT(h.ok?null:h.error,b)),title:"Send the problems back to the model",children:"ask model to fix"})]}),h.ok?i.jsx("img",{className:"diagram-img",src:S,alt:h.r.title}):i.jsx("pre",{className:"diagram-error",children:h.error}),y&&g]})}function FT({config:l,activeModel:o,messages:c,busy:u,error:d,onSend:h,onStop:m,onReset:y,onToolResult:v,onCompare:S,onCanvas:g}){var ne;const[b,x]=A.useState(""),k=yh(),D=k.images,[V,L]=A.useState(!1),K=A.useRef(null),ce=A.useRef(null),de=A.useRef(null),E=A.useRef(null),G=((ne=o==null?void 0:o.input_modalities)==null?void 0:ne.includes("image"))??!1,H=D.length>0&&!G;A.useEffect(()=>{const te=de.current;te&&(te.style.height="auto",te.style.height=Math.min(te.scrollHeight,260)+"px")},[b]);function Y(te){var ee;te.target.closest("button, select, input, textarea, a")||(ee=de.current)==null||ee.focus()}function F(){var re;if(V){(re=K.current)==null||re.stop();return}const te=Hv({onStart:()=>L(!0),onEnd:()=>{L(!1),K.current=null},onPartial:ee=>x(ee)});K.current=te}A.useEffect(()=>{var te;(te=ce.current)==null||te.scrollTo({top:ce.current.scrollHeight,behavior:"smooth"})},[c]);function ie(){!b.trim()&&!D.length&&!k.docs.length||u||H||k.reading||(h(b,D.length?D:void 0,k.docs.length?k.docs:void 0),x(""),k.clear())}function X(te){te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),ie())}const P=c.filter(te=>te.role!=="system"),Q=(o==null?void 0:o.name)??l.model,me=s0(l.system),ve=(me==null?void 0:me.starters)??Rw;function Ce(te){x(te),requestAnimationFrame(()=>{const re=de.current;re&&(re.focus(),re.setSelectionRange(te.length,te.length))})}return i.jsxs("main",{className:"main",children:[i.jsxs(Bo,{title:`bugxhunter@playground: ~/${Q}`,children:[i.jsxs("span",{className:"status-pill"+(u?" live":""),children:[i.jsx("span",{className:"dot"}),u?l.stream?"streaming":"thinking":"ready"]}),i.jsx("button",{className:"btn ghost sm",onClick:g,disabled:u,title:"Threat-model canvas: map a system from a diagram and track its findings",children:"canvas"}),i.jsx("button",{className:"btn ghost sm",onClick:S,disabled:u,title:"Ask 2–3 models the same question side by side",children:"compare"}),i.jsx("button",{className:"btn ghost sm",onClick:y,disabled:u,children:"clear"})]}),i.jsx("div",{className:"transcript grid-bg",ref:ce,children:i.jsxs("div",{className:"transcript-inner",children:[P.length===0&&i.jsxs("div",{className:"empty-state",children:[i.jsx(Bv,{lines:[{kind:"p",text:`./bxh --playground --model ${Q}`,pace:26},{kind:"out",text:"Direct model access: no agent, no file system."},{kind:"out",text:me?`Preset: ${me.label}.${G?" Attach, paste or drop an image to review.":""}`:"Pick a security preset or tune the prompt on the left.",pace:18},{kind:"ok",text:"Model ready ",ok:"OK"}]},Q),i.jsx("div",{className:"suggestions",children:ve.map(te=>i.jsx("button",{className:"chip",onClick:()=>Ce(te),title:"Puts this in the message box",children:te.trim()},te))})]}),P.map((te,re)=>i.jsx(PT,{msg:te,streaming:u&&re===P.length-1,onToolResult:v,onFix:u?void 0:ee=>h(ee)},re)),d&&i.jsx("div",{className:"error-banner",children:d})]})}),i.jsxs("div",{className:"composer",children:[i.jsxs("div",{className:"composer-box",onClick:Y,onDragOver:te=>te.preventDefault(),onDrop:k.onDrop,children:[i.jsx(vh,{images:D,docs:k.docs,reading:k.reading,onRemove:k.remove,onRemoveDoc:k.removeDoc}),i.jsx("textarea",{ref:de,value:b,onChange:te=>x(te.target.value),onKeyDown:X,onPaste:k.onPaste,rows:3,placeholder:V?"Listening…":G?`Message ${Q}… (attach, paste or drop an image, a .drawio file or a .md / .txt file)`:`Message ${Q}… (attach or drop a .drawio diagram or a .md / .txt file)`}),i.jsxs("div",{className:"composer-bar",children:[i.jsx("input",{ref:E,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:te=>{te.target.files&&k.addImages(te.target.files),te.target.value=""}}),i.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var te;return(te=E.current)==null?void 0:te.click()},disabled:u,title:G?"Attach images, draw.io diagrams or Markdown / text files (or paste / drop them)":"Attach draw.io diagrams or Markdown / text files (images need a vision model)","aria-label":"Attach images, diagrams or text files",children:i.jsx(Vc,{})}),!H&&!k.attachError&&k.docs.some(te=>te.kind!=="text")&&l.maxTokens<12e3&&i.jsxs("span",{className:"hint",style:{margin:"0 8px"},title:"Reasoning models think before they answer; a short limit can end the reply before any text",children:["Diagram reviews can need 10–16k output tokens; Max tokens is ",l.maxTokens.toLocaleString(),"."]}),(H||k.attachError)&&i.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:H?`${Q} can't see images — pick a vision model (e.g. Nemotron 3.5 Super VL)`:k.attachError}),i.jsx("div",{className:"spacer"}),nh()&&i.jsx("button",{className:"send-btn mic"+(V?" stop":""),onClick:F,title:V?"Stop dictation":"Dictate",children:V?"●":"🎤"}),u?i.jsx("button",{className:"send-btn stop",onClick:m,title:"Stop",children:"■"}):i.jsx("button",{className:"send-btn",onClick:ie,disabled:!b.trim()&&!D.length||H,title:"Send",children:"↑"})]})]}),i.jsx("div",{className:"composer-hint",children:"Enter to send · Shift+Enter for a new line"})]})]})}function PT({msg:l,streaming:o,onToolResult:c,onFix:u}){var m,y,v,S,g,b;const d=l.role==="user";return l.role==="tool"?i.jsxs("div",{className:"msg assistant",children:[i.jsx("div",{className:"avatar fn","aria-hidden":!0,children:"fn"}),i.jsx("div",{className:"msg-body",children:i.jsxs("div",{className:"tool-call",children:[i.jsx("span",{className:"tc-name",children:"tool result"}),i.jsx("pre",{children:i.jsx(c0,{text:String(l.content??"")})})]})})]}):d?i.jsx("div",{className:"msg user",children:i.jsxs("div",{className:"bubble user-bubble",children:[l.content,(m=l.images)!=null&&m.length?i.jsx("div",{className:"bubble-images",children:l.images.map((x,k)=>i.jsx("img",{src:x.url,alt:x.name,title:x.name},k))}):null,(y=l.docs)!=null&&y.length?i.jsx("div",{className:"attach-row bubble-docs",children:l.docs.map((x,k)=>i.jsxs("span",{className:"attach-chip doc",title:`Sent as ${x.kind==="text"?"text":"an exact outline"} (${x.text.length.toLocaleString()} characters)`,children:[i.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),i.jsx("span",{className:"attach-name",children:x.name})]},k))}):null]})}):i.jsxs("div",{className:"msg assistant",children:[i.jsx("div",{className:"avatar","aria-hidden":!0,children:"▶"}),i.jsxs("div",{className:"msg-body",children:[i.jsxs("div",{children:[l.content?i.jsx(KT,{text:l.content,streaming:o,onFix:u}):null,o&&!l.tool_calls&&i.jsx("span",{className:"cursor"}),(v=l.tool_calls)==null?void 0:v.map(x=>i.jsx(JT,{call:x,onResult:c},x.id))]}),l.sources&&l.sources.length>0&&i.jsxs("div",{className:"sources",children:[i.jsx("span",{className:"sources-label",children:"grounded in"}),l.sources.map((x,k)=>i.jsx("span",{className:"badge on",title:`similarity ${x.score}`,children:x.doc},k))]}),l.finish==="length"&&i.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:hw(l.content,(S=l.usage)==null?void 0:S.reasoning)}),(l.usage||l.timing)&&i.jsxs("div",{className:"msg-meta",children:[l.timing&&Jv(l.timing,(g=l.usage)==null?void 0:g.completion,(b=l.usage)==null?void 0:b.reasoning),l.timing&&l.usage&&" · ",l.usage&&i.jsxs(i.Fragment,{children:[l.usage.prompt??0," in · ",l.usage.completion??0," out",l.usage.reasoning?` · ${l.usage.reasoning} reasoning`:""," tokens"]})]})]})]})}function JT({call:l,onResult:o}){const[c,u]=A.useState(""),[d,h]=A.useState(!1);let m=l.function.arguments;try{m=JSON.stringify(JSON.parse(l.function.arguments),null,2)}catch{}return i.jsxs("div",{className:"tool-call",children:[i.jsxs("span",{className:"tc-name",children:[l.function.name,"()"]}),i.jsx("pre",{children:m}),d?i.jsx("div",{className:"tc-result mini",style:{color:"var(--muted)"},children:"↳ result submitted"}):i.jsxs("div",{className:"tc-result",children:[i.jsx("textarea",{placeholder:"Return a tool result (JSON or text), then continue…",value:c,onChange:y=>u(y.target.value),style:{minHeight:50,fontSize:12}}),i.jsx("button",{className:"btn mini",style:{marginTop:6},disabled:!c.trim(),onClick:()=>{o(l,c),h(!0)},children:"Submit result & continue"})]})]})}function WT(l,o){if(!(o!=null&&o.length))return l;const c=o.map(d=>{const h=d.name.replace(/"/g,"'");return d.kind==="text"?`Attached file "${d.name}", in full:
233
+ `)}const ZT=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48)||"diagram",Ao=new Map;let PT=null;const N0=()=>PT??(PT=fetch("/api/render/status").then(l=>l.json()).then(l=>!!(l!=null&&l.ok)).catch(()=>!1));function E0(l){const o=typeof l=="string"?l:JSON.stringify(l);let c=Ao.get(o);return c||(c=fetch("/api/render/drawio",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({spec:l})}).then(async u=>{var h;const d=await u.json().catch(()=>({}));return u.ok?{ok:!0,r:d}:{ok:!1,error:((h=d==null?void 0:d.error)==null?void 0:h.message)||`Rendering failed (${u.status})`}}).catch(u=>({ok:!1,error:String((u==null?void 0:u.message)??u)})),Ao.set(o,c),Ao.size>60&&Ao.delete(Ao.keys().next().value)),c}function xv(l,o,c){const u=URL.createObjectURL(new Blob([o],{type:c}));Object.assign(document.createElement("a"),{href:u,download:l}).click(),setTimeout(()=>URL.revokeObjectURL(u),1e3)}function FT({text:l,streaming:o,onFix:c}){const u=A.useMemo(()=>QT(l),[l]);return u.length===1&&u[0].type==="md"?s.jsx(Ic,{text:l}):s.jsx(s.Fragment,{children:u.map((d,h)=>d.type==="md"?s.jsx(Ic,{text:d.text},h):s.jsx(JT,{spec:d.spec,pending:!d.closed&&o,onFix:c},h))})}function JT({spec:l,pending:o,onFix:c}){const[u,d]=A.useState(null),[h,m]=A.useState(null),[y,v]=A.useState(!1);A.useEffect(()=>{N0().then(d)},[]),A.useEffect(()=>{if(o||!u||!l.trim())return;let k=!0;return m(null),E0(l).then(L=>k&&m(L)),()=>{k=!1}},[l,o,u]);const S=A.useMemo(()=>h!=null&&h.ok?URL.createObjectURL(new Blob([h.r.svg],{type:"image/svg+xml"})):null,[h]);A.useEffect(()=>()=>{S&&URL.revokeObjectURL(S)},[S]);const g=s.jsx("pre",{className:"diagram-spec",children:s.jsx("code",{children:l})});if(o)return s.jsxs("div",{className:"diagram-card",children:[s.jsxs("div",{className:"diagram-head",children:[s.jsx("span",{className:"diagram-tag",children:"drawio"})," drawing…"]}),g]});if(u===!1)return s.jsxs("div",{className:"diagram-card",children:[s.jsxs("div",{className:"diagram-head",children:[s.jsx("span",{className:"diagram-tag",children:"drawio"})," Diagram rendering needs the render service (Docker setup)."]}),g]});if(!h)return s.jsx("div",{className:"diagram-card",children:s.jsxs("div",{className:"diagram-head",children:[s.jsx("span",{className:"diagram-tag",children:"drawio"})," rendering…"]})});const b=h.ok?h.r.check.issues:[],x=h.ok?ZT(h.r.title):"diagram";return s.jsxs("div",{className:"diagram-card",children:[s.jsxs("div",{className:"diagram-head",children:[s.jsx("span",{className:"diagram-tag",children:"drawio"}),s.jsx("span",{className:"diagram-title",children:h.ok?h.r.title:"Diagram spec has problems"}),h.ok&&(b.length?s.jsxs("span",{className:"diagram-warn",title:b.map(k=>`${k.severity} ${k.code} ${k.cell}: ${k.message}`).join(`
234
+ `),children:[b.length," layout issue",b.length===1?"":"s"]}):s.jsx("span",{className:"diagram-ok",children:"checked"})),s.jsx("span",{className:"spacer"}),h.ok&&s.jsx("button",{className:"btn ghost sm",onClick:()=>xv(`${x}.drawio.svg`,h.r.svg,"image/svg+xml"),title:"An SVG with the diagram embedded: opens for editing in draw.io and its VS Code extension",children:".drawio.svg"}),h.ok&&s.jsx("button",{className:"btn ghost sm",onClick:()=>xv(`${x}.drawio`,h.r.xml,"application/xml"),children:".drawio"}),s.jsx("button",{className:"btn ghost sm",onClick:()=>v(k=>!k),children:y?"hide spec":"spec"}),c&&(!h.ok||b.length>0)&&s.jsx("button",{className:"btn sm",onClick:()=>c(KT(h.ok?null:h.error,b)),title:"Send the problems back to the model",children:"ask model to fix"})]}),h.ok?s.jsx("img",{className:"diagram-img",src:S,alt:h.r.title}):s.jsx("pre",{className:"diagram-error",children:h.error}),y&&g]})}function WT({config:l,activeModel:o,messages:c,busy:u,error:d,onSend:h,onStop:m,onReset:y,onToolResult:v,onCompare:S,onCanvas:g}){var ne;const[b,x]=A.useState(""),k=yh(),L=k.images,[V,z]=A.useState(!1),Z=A.useRef(null),oe=A.useRef(null),de=A.useRef(null),C=A.useRef(null),Y=((ne=o==null?void 0:o.input_modalities)==null?void 0:ne.includes("image"))??!1,O=L.length>0&&!Y;A.useEffect(()=>{const te=de.current;te&&(te.style.height="auto",te.style.height=Math.min(te.scrollHeight,260)+"px")},[b]);function X(te){var ee;te.target.closest("button, select, input, textarea, a")||(ee=de.current)==null||ee.focus()}function F(){var ce;if(V){(ce=Z.current)==null||ce.stop();return}const te=Bv({onStart:()=>z(!0),onEnd:()=>{z(!1),Z.current=null},onPartial:ee=>x(ee)});Z.current=te}A.useEffect(()=>{var te;(te=oe.current)==null||te.scrollTo({top:oe.current.scrollHeight,behavior:"smooth"})},[c]);function ie(){!b.trim()&&!L.length&&!k.docs.length||u||O||k.reading||(h(b,L.length?L:void 0,k.docs.length?k.docs:void 0),x(""),k.clear())}function G(te){te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),ie())}const Q=c.filter(te=>te.role!=="system"),K=(o==null?void 0:o.name)??l.model,me=o0(l.system),ve=(me==null?void 0:me.starters)??L1;function Ce(te){x(te),requestAnimationFrame(()=>{const ce=de.current;ce&&(ce.focus(),ce.setSelectionRange(te.length,te.length))})}return s.jsxs("main",{className:"main",children:[s.jsxs(Bo,{title:`bugxhunter@playground: ~/${K}`,children:[s.jsxs("span",{className:"status-pill"+(u?" live":""),children:[s.jsx("span",{className:"dot"}),u?l.stream?"streaming":"thinking":"ready"]}),s.jsx("button",{className:"btn ghost sm",onClick:g,disabled:u,title:"Threat-model canvas: map a system from a diagram and track its findings",children:"canvas"}),s.jsx("button",{className:"btn ghost sm",onClick:S,disabled:u,title:"Ask 2–3 models the same question side by side",children:"compare"}),s.jsx("button",{className:"btn ghost sm",onClick:y,disabled:u,children:"clear"})]}),s.jsx("div",{className:"transcript grid-bg",ref:oe,children:s.jsxs("div",{className:"transcript-inner",children:[Q.length===0&&s.jsxs("div",{className:"empty-state",children:[s.jsx(Iv,{lines:[{kind:"p",text:`./bxh --playground --model ${K}`,pace:26},{kind:"out",text:"Direct model access: no agent, no file system."},{kind:"out",text:me?`Preset: ${me.label}.${Y?" Attach, paste or drop an image to review.":""}`:"Pick a security preset or tune the prompt on the left.",pace:18},{kind:"ok",text:"Model ready ",ok:"OK"}]},K),s.jsx("div",{className:"suggestions",children:ve.map(te=>s.jsx("button",{className:"chip",onClick:()=>Ce(te),title:"Puts this in the message box",children:te.trim()},te))})]}),Q.map((te,ce)=>s.jsx(ek,{msg:te,streaming:u&&ce===Q.length-1,onToolResult:v,onFix:u?void 0:ee=>h(ee)},ce)),d&&s.jsx("div",{className:"error-banner",children:d})]})}),s.jsxs("div",{className:"composer",children:[s.jsxs("div",{className:"composer-box",onClick:X,onDragOver:te=>te.preventDefault(),onDrop:k.onDrop,children:[s.jsx(vh,{images:L,docs:k.docs,reading:k.reading,onRemove:k.remove,onRemoveDoc:k.removeDoc}),s.jsx("textarea",{ref:de,value:b,onChange:te=>x(te.target.value),onKeyDown:G,onPaste:k.onPaste,rows:3,placeholder:V?"Listening…":Y?`Message ${K}… (attach, paste or drop an image, a .drawio file or a .md / .txt file)`:`Message ${K}… (attach or drop a .drawio diagram or a .md / .txt file)`}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("input",{ref:C,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:te=>{te.target.files&&k.addImages(te.target.files),te.target.value=""}}),s.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var te;return(te=C.current)==null?void 0:te.click()},disabled:u,title:Y?"Attach images, draw.io diagrams or Markdown / text files (or paste / drop them)":"Attach draw.io diagrams or Markdown / text files (images need a vision model)","aria-label":"Attach images, diagrams or text files",children:s.jsx(Vc,{})}),!O&&!k.attachError&&k.docs.some(te=>te.kind!=="text")&&l.maxTokens<12e3&&s.jsxs("span",{className:"hint",style:{margin:"0 8px"},title:"Reasoning models think before they answer; a short limit can end the reply before any text",children:["Diagram reviews can need 10–16k output tokens; Max tokens is ",l.maxTokens.toLocaleString(),"."]}),(O||k.attachError)&&s.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:O?`${K} can't see images — pick a vision model (e.g. Nemotron 3.5 Super VL)`:k.attachError}),s.jsx("div",{className:"spacer"}),nh()&&s.jsx("button",{className:"send-btn mic"+(V?" stop":""),onClick:F,title:V?"Stop dictation":"Dictate",children:V?"●":"🎤"}),u?s.jsx("button",{className:"send-btn stop",onClick:m,title:"Stop",children:"■"}):s.jsx("button",{className:"send-btn",onClick:ie,disabled:!b.trim()&&!L.length||O,title:"Send",children:"↑"})]})]}),s.jsx("div",{className:"composer-hint",children:"Enter to send · Shift+Enter for a new line"})]})]})}function ek({msg:l,streaming:o,onToolResult:c,onFix:u}){var m,y,v,S,g,b;const d=l.role==="user";return l.role==="tool"?s.jsxs("div",{className:"msg assistant",children:[s.jsx("div",{className:"avatar fn","aria-hidden":!0,children:"fn"}),s.jsx("div",{className:"msg-body",children:s.jsxs("div",{className:"tool-call",children:[s.jsx("span",{className:"tc-name",children:"tool result"}),s.jsx("pre",{children:s.jsx(d0,{text:String(l.content??"")})})]})})]}):d?s.jsx("div",{className:"msg user",children:s.jsxs("div",{className:"bubble user-bubble",children:[l.content,(m=l.images)!=null&&m.length?s.jsx("div",{className:"bubble-images",children:l.images.map((x,k)=>s.jsx("img",{src:x.url,alt:x.name,title:x.name},k))}):null,(y=l.docs)!=null&&y.length?s.jsx("div",{className:"attach-row bubble-docs",children:l.docs.map((x,k)=>s.jsxs("span",{className:"attach-chip doc",title:`Sent as ${x.kind==="text"?"text":"an exact outline"} (${x.text.length.toLocaleString()} characters)`,children:[s.jsx("span",{className:"attach-doc-icon","aria-hidden":!0,children:"◇"}),s.jsx("span",{className:"attach-name",children:x.name})]},k))}):null]})}):s.jsxs("div",{className:"msg assistant",children:[s.jsx("div",{className:"avatar","aria-hidden":!0,children:"▶"}),s.jsxs("div",{className:"msg-body",children:[s.jsxs("div",{children:[l.content?s.jsx(FT,{text:l.content,streaming:o,onFix:u}):null,o&&!l.tool_calls&&s.jsx("span",{className:"cursor"}),(v=l.tool_calls)==null?void 0:v.map(x=>s.jsx(tk,{call:x,onResult:c},x.id))]}),l.sources&&l.sources.length>0&&s.jsxs("div",{className:"sources",children:[s.jsx("span",{className:"sources-label",children:"grounded in"}),l.sources.map((x,k)=>s.jsx("span",{className:"badge on",title:`similarity ${x.score}`,children:x.doc},k))]}),l.finish==="length"&&s.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:g1(l.content,(S=l.usage)==null?void 0:S.reasoning)}),(l.usage||l.timing)&&s.jsxs("div",{className:"msg-meta",children:[l.timing&&e0(l.timing,(g=l.usage)==null?void 0:g.completion,(b=l.usage)==null?void 0:b.reasoning),l.timing&&l.usage&&" · ",l.usage&&s.jsxs(s.Fragment,{children:[l.usage.prompt??0," in",Wv(l.usage)," · ",l.usage.completion??0," out",l.usage.reasoning?` · ${l.usage.reasoning} reasoning`:""," tokens"]})]})]})]})}function tk({call:l,onResult:o}){const[c,u]=A.useState(""),[d,h]=A.useState(!1);let m=l.function.arguments;try{m=JSON.stringify(JSON.parse(l.function.arguments),null,2)}catch{}return s.jsxs("div",{className:"tool-call",children:[s.jsxs("span",{className:"tc-name",children:[l.function.name,"()"]}),s.jsx("pre",{children:m}),d?s.jsx("div",{className:"tc-result mini",style:{color:"var(--muted)"},children:"↳ result submitted"}):s.jsxs("div",{className:"tc-result",children:[s.jsx("textarea",{placeholder:"Return a tool result (JSON or text), then continue…",value:c,onChange:y=>u(y.target.value),style:{minHeight:50,fontSize:12}}),s.jsx("button",{className:"btn mini",style:{marginTop:6},disabled:!c.trim(),onClick:()=>{o(l,c),h(!0)},children:"Submit result & continue"})]})]})}function nk(l,o){if(!(o!=null&&o.length))return l;const c=o.map(d=>{const h=d.name.replace(/"/g,"'");return d.kind==="text"?`Attached file "${d.name}", in full:
235
235
 
236
236
  <file name="${h}">
237
237
  ${d.text.trimEnd()}
@@ -241,9 +241,9 @@ ${d.text.trimEnd()}
241
241
  ${d.text.trimEnd()}
242
242
  </diagram>`}),u=o.every(d=>d.kind==="text")?"Review this document for security issues.":"Review this diagram for security issues.";return[(l==null?void 0:l.trim())||u,...c].join(`
243
243
 
244
- `)}function Eh(l,o,c){const u=WT(l,c);return o!=null&&o.length?[{type:"text",text:(u==null?void 0:u.trim())||"Describe this image."},...o.map(d=>({type:"image_url",image_url:{url:d.url}}))]:u}const ek=3,tk={scx:"SCX.ai",anthropic:"Anthropic",nvidia:"NVIDIA NIM",bedrock:"Amazon Bedrock",openrouter:"OpenRouter"},To=l=>({model:l,text:"",busy:!1,error:null});function Sv(l,o){var d;const c=l.find(h=>h.id===o[0]),u=l.filter(h=>!o.includes(h.id));return(d=u.find(h=>(h.provider??"scx")!==((c==null?void 0:c.provider)??"scx"))??u[0])==null?void 0:d.id}function nk({config:l,models:o,onExit:c}){const u=o.filter(Lc),[d,h]=A.useState(()=>[l.model,Sv(u,[l.model])].filter(E=>!!E).map(To)),[m,y]=A.useState(""),[v,S]=A.useState(null),g=yh(),b=A.useRef(null),x=A.useRef([]),k=d.some(E=>E.busy),D=(E,G)=>h(H=>H.map((Y,F)=>F===E?{...Y,...G}:Y));function V(){x.current.forEach(E=>E.abort()),x.current=[]}function L(){if(!m.trim()&&!g.images.length&&!g.docs.length||k||g.reading)return;V();const E=g.images,G=[...l.system.trim()?[{role:"system",content:l.system}]:[],{role:"user",content:Eh(m,E,g.docs)}],H=[E.length?`${E.length} image${E.length>1?"s":""}`:"",...g.docs.map(Y=>Y.name)].filter(Boolean);S((m.trim()||(g.docs.length?g.docs.every(Y=>Y.kind==="text")?"Review this document for security issues.":"Review this diagram for security issues.":"Describe this image."))+(H.length?` [+${H.join(", ")}]`:"")),x.current=d.map(()=>new AbortController),d.forEach((Y,F)=>{var Q,me;const ie=o.find(ve=>ve.id===Y.model);if(E.length&&!((Q=ie==null?void 0:ie.input_modalities)!=null&&Q.includes("image"))){h(ve=>ve.map((Ce,ne)=>ne===F?{...To(Ce.model),skipped:"This model can't see images, so it was skipped."}:Ce));return}h(ve=>ve.map((Ce,ne)=>ne===F?{...To(Ce.model),busy:!0}:Ce));const X=performance.now();let P;eh({model:Y.model,messages:G,temperature:l.temperature,top_p:l.topP,max_tokens:l.maxTokens,reasoning_effort:th(l.reasoningEffort,o.find(ve=>ve.id===Y.model)),response_format:l.jsonMode?{type:"json_object"}:void 0,stream:l.stream},{signal:(me=x.current[F])==null?void 0:me.signal,onDelta:ve=>{P??(P=performance.now()-X),h(Ce=>Ce.map((ne,te)=>te===F?{...ne,text:ne.text+ve}:ne))},onUsage:ve=>D(F,{usage:ve}),onError:ve=>D(F,{error:ve}),onDone:()=>D(F,{timing:{ttft:P,total:performance.now()-X}})}).catch(ve=>{(ve==null?void 0:ve.name)!=="AbortError"&&D(F,{error:String((ve==null?void 0:ve.message)??ve)})}).finally(()=>D(F,{busy:!1}))}),y(""),g.clear()}function K(E){E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),L())}const ce=["scx","anthropic","nvidia","bedrock","openrouter"].map(E=>[E,u.filter(G=>(G.provider??"scx")===E)]).filter(([,E])=>E.length>0),de=d.some(E=>{var G,H;return(H=(G=o.find(Y=>Y.id===E.model))==null?void 0:G.input_modalities)==null?void 0:H.includes("image")});return i.jsxs("main",{className:"main",children:[i.jsxs(Bo,{title:`bugxhunter@playground: ~/compare (${d.length} models)`,children:[i.jsxs("span",{className:"status-pill"+(k?" live":""),children:[i.jsx("span",{className:"dot"}),k?"running":"ready"]}),d.length<ek&&i.jsx("button",{className:"btn ghost sm",disabled:k,onClick:()=>h(E=>[...E,To(Sv(u,E.map(G=>G.model))??l.model)]),children:"+ model"}),i.jsx("button",{className:"btn ghost sm",onClick:()=>{V(),c()},children:"back to chat"})]}),i.jsxs("div",{className:"transcript grid-bg",children:[v&&i.jsxs("div",{className:"compare-prompt mono",children:["$ ",v]}),i.jsx("div",{className:"compare-grid",style:{"--cols":d.length},children:d.map((E,G)=>{var H,Y;return i.jsxs("section",{className:"compare-col",children:[i.jsxs("div",{className:"compare-head",children:[i.jsxs("select",{value:E.model,disabled:k,onChange:F=>D(G,{...To(F.target.value)}),"aria-label":`Model ${G+1}`,children:[!u.some(F=>F.id===E.model)&&i.jsx("option",{value:E.model,children:E.model}),ce.map(([F,ie])=>i.jsx("optgroup",{label:tk[F],children:ie.map(X=>{var P;return i.jsxs("option",{value:X.id,children:[X.name,(P=X.input_modalities)!=null&&P.includes("image")?" · vision":""]},X.id)})},F))]}),d.length>1&&i.jsx("button",{className:"attach-x",disabled:k,onClick:()=>h(F=>F.filter((ie,X)=>X!==G)),"aria-label":"Remove this model",children:"✕"})]}),i.jsxs("div",{className:"compare-body",children:[E.skipped&&i.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:E.skipped}),E.error&&i.jsx("div",{className:"error-banner",children:E.error}),E.text&&i.jsx(Ic,{text:E.text}),E.busy&&i.jsx("span",{className:"cursor"}),!E.text&&!E.busy&&!E.skipped&&!E.error&&i.jsx("p",{className:"muted mono",style:{margin:0},children:v?"No answer.":"Waiting for a prompt…"})]}),(E.timing||E.usage)&&i.jsxs("div",{className:"msg-meta",children:[E.timing&&Jv(E.timing,(H=E.usage)==null?void 0:H.completion,(Y=E.usage)==null?void 0:Y.reasoning),E.usage&&`${E.timing?" · ":""}${E.usage.prompt??0} in · ${E.usage.completion??0} out tokens`]})]},G)})})]}),i.jsxs("div",{className:"composer",children:[i.jsxs("div",{className:"composer-box",onDragOver:E=>E.preventDefault(),onDrop:g.onDrop,children:[i.jsx(vh,{images:g.images,docs:g.docs,reading:g.reading,onRemove:g.remove,onRemoveDoc:g.removeDoc}),i.jsx("textarea",{value:m,onChange:E=>y(E.target.value),onKeyDown:K,onPaste:g.onPaste,rows:3,placeholder:`Ask all ${d.length} models the same thing…${de?" (images go to the vision models)":""}`}),i.jsxs("div",{className:"composer-bar",children:[i.jsx("input",{ref:b,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:E=>{E.target.files&&g.addImages(E.target.files),E.target.value=""}}),i.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var E;return(E=b.current)==null?void 0:E.click()},disabled:k,title:"Attach images (or paste / drop them)","aria-label":"Attach images",children:i.jsx(Vc,{})}),g.attachError&&i.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:g.attachError}),i.jsx("div",{className:"spacer"}),k?i.jsx("button",{className:"send-btn stop",onClick:V,title:"Stop all",children:"■"}):i.jsx("button",{className:"send-btn",onClick:L,disabled:!m.trim()&&!g.images.length&&!g.docs.length||g.reading,title:"Run on all models",children:"↑"})]})]}),i.jsx("div",{className:"composer-hint",children:"Enter to run on every model · uses the sidebar's system prompt and settings · single turn"})]})]})}const Ti=["data","management","attestation","identity","control","blocked"],Uo={data:"Data",management:"Management",attestation:"Attestation / evidence",identity:"Identity / credential",control:"Control / config",blocked:"Blocked"},ak=["actor","service","ai","datastore","external"],N0=["critical","high","medium","low"],qc={critical:0,high:1,medium:2,low:3},Sc=()=>({title:"Untitled threat model",nodes:[],edges:[]}),Dt=(l,o="")=>typeof l=="string"?l.trim():o,Mo=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"node";function lk(l){const o=Dt(l).toLowerCase();return ak.includes(o)?o:/user|client|admin|customer|attacker|person|internet/.test(o)?"actor":/\b(ai|llm|model|agent|copilot|assistant|rag|retriev|inference|embedding)/.test(o)?"ai":/db|database|store|bucket|storage|cache|queue|file|repo|config|secret/.test(o)?"datastore":/third|external|saas|vendor|partner/.test(o)?"external":"service"}function sk(l,o){const c=Dt(l).toLowerCase();return Ti.includes(c)?c:c?/block|denied|disabled|cut/.test(c)?"blocked":/attest|evidence|spdm|measure/.test(c)?"attestation":/ident|credential|cert|svid|token|key|auth/.test(c)?"identity":/manag|admin|mgmt|bmc|redfish|ssh|console/.test(c)?"management":/control|config|crd|gitops|policy|deploy|boot|admission/.test(c)?"control":"data":/\bblocked\b/i.test(o)?"blocked":"data"}function wv(l,o){return(Array.isArray(l)?l:[]).flatMap((c,u)=>{if(!c||typeof c!="object")return[];const d=c,h=Dt(d.title)||Dt(d.issue)||Dt(d.name);if(!h)return[];const m=Dt(d.status).toLowerCase();return[{id:`${o}-f${u+1}`,title:h,severity:ik(d.severity),fix:Dt(d.fix)||Dt(d.mitigation)||void 0,ref:Dt(d.ref)||Dt(d.cwe)||void 0,status:m==="fixed"||m==="verified"?m:"open"}]})}function ik(l){const o=Dt(l).toLowerCase();return N0.includes(o)?o:o.startsWith("crit")||o==="p1"?"critical":o.startsWith("hi")||o==="p2"?"high":o.startsWith("lo")||o==="p4"||o==="p5"||o.startsWith("info")?"low":"medium"}function ok(l){const o=l.match(/```(?:json)?\s*([\s\S]*?)```/i),c=o?o[1]:l,u=c.indexOf("{"),d=c.lastIndexOf("}");if(u<0||d<=u)throw new Error("No JSON object in the model's reply.");return JSON.parse(c.slice(u,d+1))}function ko(l){if(!l||typeof l!="object")throw new Error("Threat model must be a JSON object.");const o=l,c=new Set,u=y=>{let v=y;for(let S=2;c.has(v);S++)v=`${y}-${S}`;return c.add(v),v},d=new Map,h=(Array.isArray(o.nodes)?o.nodes:[]).flatMap((y,v)=>{if(!y||typeof y!="object")return[];const S=y,g=Dt(S.label)||Dt(S.name)||`Component ${v+1}`,b=Dt(S.id)||Mo(g),x=u(Mo(b));d.has(b)||d.set(b,x),d.has(g)||d.set(g,x);const k=wv(S.findings,x);return[{id:x,label:g,kind:lk(S.kind??S.type),details:(Array.isArray(S.details)?S.details:[]).map(D=>Dt(D)).filter(Boolean).slice(0,8),inScope:S.inScope!==!1,tested:S.tested===!0,findings:k,x:typeof S.x=="number"?S.x:void 0,y:typeof S.y=="number"?S.y:void 0}]}),m=(Array.isArray(o.edges)?o.edges:[]).flatMap((y,v)=>{if(!y||typeof y!="object")return[];const S=y,g=d.get(Dt(S.from))??d.get(Mo(Dt(S.from))),b=d.get(Dt(S.to))??d.get(Mo(Dt(S.to)));if(!g||!b||g===b)return[];let x=Dt(S.label);const k=/\s*\(implied\)\s*$/i.test(x);k&&(x=x.replace(/\s*\(implied\)\s*$/i,""));const D=`e${v+1}`;return[{id:D,from:g,to:b,label:x||Dt(S.protocol)||void 0,kind:sk(S.kind??S.type,x),encrypted:typeof S.encrypted=="boolean"?S.encrypted:void 0,implied:S.implied===!0||k||void 0,protocol:Dt(S.protocol)||void 0,auth:Dt(S.auth)||Dt(S.authentication)||void 0,findings:wv(S.findings,D)}]});return{title:Dt(o.title)||"Untitled threat model",nodes:h,edges:m}}const Wn=200,rl=86,rk=120,ck=40,Kf=Wn+rk,Lo=rl+ck,Av=6,wc={actor:0,external:1,service:2,ai:3,datastore:4},Df=l=>l.x!==void 0&&l.y!==void 0;function Vl(l){const o=l.nodes.filter(y=>!Df(y));if(!o.length)return l;if(o.length===l.nodes.length)return{...l,nodes:dk(l.nodes,l.edges)};const c=l.nodes.filter(Df),u=Math.min(...c.map(y=>y.x)),d=Math.max(...c.map(y=>y.y))+Lo;let h=0;const m=l.nodes.map(y=>{if(Df(y))return y;const v=h++;return{...y,x:u+v%4*Kf,y:d+Math.floor(v/4)*Lo}});return{...l,nodes:m}}function uk(l){return Vl({...l,nodes:l.nodes.map(({x:o,y:c,...u})=>u)})}function dk(l,o){var ie;const c=new Map(l.map((X,P)=>[X.id,P])),u=new Map(l.map(X=>[X.id,new Set])),d=new Map(l.map(X=>[X.id,new Set]));for(const X of o)X.from===X.to||!u.has(X.from)||!u.has(X.to)||(u.get(X.from).add(X.to),d.get(X.to).add(X.from));const h=l.filter(X=>u.get(X.id).size||d.get(X.id).size),m=l.filter(X=>!u.get(X.id).size&&!d.get(X.id).size),y=[...h].sort((X,P)=>(d.get(X.id).size?1:0)-(d.get(P.id).size?1:0)||wc[X.kind]-wc[P.kind]||c.get(X.id)-c.get(P.id)),v=new Map(h.map(X=>[X.id,[]])),S=new Map(h.map(X=>[X.id,[]])),g=new Map,b=X=>{g.set(X,1);for(const P of u.get(X))g.get(P)!==1&&(v.get(X).push(P),S.get(P).push(X),g.has(P)||b(P));g.set(X,2)};for(const X of y)g.has(X.id)||b(X.id);const x=[],k=new Map(h.map(X=>[X.id,S.get(X.id).length])),D=h.filter(X=>!k.get(X.id)).map(X=>X.id);for(;D.length;){const X=D.shift();x.push(X);for(const P of v.get(X))k.set(P,k.get(P)-1),k.get(P)||D.push(P)}const V=new Map;for(const X of x)V.set(X,Math.max(0,...S.get(X).map(P=>V.get(P)+1)));for(const X of[...x].reverse()){const P=l[c.get(X)];S.get(X).length||!v.get(X).length||P.kind==="actor"||V.set(X,Math.max(0,Math.min(...v.get(X).map(Q=>V.get(Q)))-1))}const L=[];for(const X of x)(L[ie=V.get(X)]??(L[ie]=[])).push(X);const K=L.filter(Boolean),ce=new Map;K.forEach(X=>X.forEach((P,Q)=>ce.set(P,Q-(X.length-1)/2)));for(let X=0;X<8;X++){const P=X%2===0;for(const Q of P?K:[...K].reverse()){const me=V.get(Q[0]),ve=new Map(Q.map(Ce=>{const ne=[...d.get(Ce),...u.get(Ce)].filter(te=>V.has(te)&&(P?V.get(te)<me:V.get(te)>me));return[Ce,ne.length?ne.reduce((te,re)=>te+ce.get(re),0)/ne.length:ce.get(Ce)]}));Q.sort((Ce,ne)=>ve.get(Ce)-ve.get(ne)),Q.forEach((Ce,ne)=>ce.set(Ce,ne-(Q.length-1)/2))}}const E=Math.min(Av,Math.max(0,...K.map(X=>X.length))),G=new Map;let H=0;for(const X of K){const P=Math.ceil(X.length/Av),Q=Math.ceil(X.length/P);X.forEach((me,ve)=>{const Ce=Math.floor(ve/Q),ne=Math.min(Q,X.length-Ce*Q);G.set(me,{x:40+(H+Ce)*Kf,y:40+((E-ne)/2+ve%Q)*Lo})}),H+=P}const Y=K.length?40+(E+.5)*Lo:40,F=Math.max(4,H);return[...m].sort((X,P)=>wc[X.kind]-wc[P.kind]||c.get(X.id)-c.get(P.id)).forEach((X,P)=>G.set(X.id,{x:40+P%F*Kf,y:Y+Math.floor(P/F)*Lo})),l.map(X=>({...X,...G.get(X.id)}))}function Tv(l){let o=null;for(const c of l.findings)c.status==="open"&&(!o||qc[c.severity]<qc[o])&&(o=c.severity);return o}function fk(l){const o={critical:0,high:0,medium:0,low:0};let c=0;for(const h of[...l.nodes.flatMap(m=>m.findings),...l.edges.flatMap(m=>m.findings??[])])h.status==="open"?o[h.severity]++:c++;const u=Object.fromEntries(Ti.map(h=>[h,0]));for(const h of l.edges)u[h.kind??"data"]++;const d=l.nodes.filter(h=>h.inScope);return{components:l.nodes.length,inScope:d.length,tested:d.filter(h=>h.tested).length,open:o,fixed:c,plaintextFlows:l.edges.filter(h=>h.encrypted===!1).length,flows:l.edges.length,impliedFlows:l.edges.filter(h=>h.implied).length,blockedFlows:u.blocked,byKind:u}}function hk(l){const o=new Map(l.nodes.map(h=>[h.id,h.label])),c=[...l.nodes.flatMap(h=>h.findings.map(m=>({where:h.label,f:m}))),...l.edges.flatMap(h=>(h.findings??[]).map(m=>({where:`${o.get(h.from)??h.from} → ${o.get(h.to)??h.to} (${Uo[h.kind??"data"].toLowerCase()} flow)`,f:m})))].sort((h,m)=>qc[h.f.severity]-qc[m.f.severity]),u=(h="")=>h.replace(/\|/g,"\\|").replace(/\n/g," ");return[`# ${u(l.title)}`,"","| Severity | Component or flow | Finding | Fix | Ref | Status |","|---|---|---|---|---|---|",...c.map(({where:h,f:m})=>`| ${m.severity} | ${u(h)} | ${u(m.title)} | ${u(m.fix)} | ${u(m.ref)} | ${m.status} |`)].join(`
244
+ `)}function Eh(l,o,c){const u=nk(l,c);return o!=null&&o.length?[{type:"text",text:(u==null?void 0:u.trim())||"Describe this image."},...o.map(d=>({type:"image_url",image_url:{url:d.url}}))]:u}const ak=3,lk={scx:"SCX.ai",anthropic:"Anthropic",nvidia:"NVIDIA NIM",bedrock:"Amazon Bedrock",openrouter:"OpenRouter"},To=l=>({model:l,text:"",busy:!1,error:null});function Sv(l,o){var d;const c=l.find(h=>h.id===o[0]),u=l.filter(h=>!o.includes(h.id));return(d=u.find(h=>(h.provider??"scx")!==((c==null?void 0:c.provider)??"scx"))??u[0])==null?void 0:d.id}function sk({config:l,models:o,onExit:c}){const u=o.filter(Lc),[d,h]=A.useState(()=>[l.model,Sv(u,[l.model])].filter(C=>!!C).map(To)),[m,y]=A.useState(""),[v,S]=A.useState(null),g=yh(),b=A.useRef(null),x=A.useRef([]),k=d.some(C=>C.busy),L=(C,Y)=>h(O=>O.map((X,F)=>F===C?{...X,...Y}:X));function V(){x.current.forEach(C=>C.abort()),x.current=[]}function z(){if(!m.trim()&&!g.images.length&&!g.docs.length||k||g.reading)return;V();const C=g.images,Y=[...l.system.trim()?[{role:"system",content:l.system}]:[],{role:"user",content:Eh(m,C,g.docs)}],O=[C.length?`${C.length} image${C.length>1?"s":""}`:"",...g.docs.map(X=>X.name)].filter(Boolean);S((m.trim()||(g.docs.length?g.docs.every(X=>X.kind==="text")?"Review this document for security issues.":"Review this diagram for security issues.":"Describe this image."))+(O.length?` [+${O.join(", ")}]`:"")),x.current=d.map(()=>new AbortController),d.forEach((X,F)=>{var K,me;const ie=o.find(ve=>ve.id===X.model);if(C.length&&!((K=ie==null?void 0:ie.input_modalities)!=null&&K.includes("image"))){h(ve=>ve.map((Ce,ne)=>ne===F?{...To(Ce.model),skipped:"This model can't see images, so it was skipped."}:Ce));return}h(ve=>ve.map((Ce,ne)=>ne===F?{...To(Ce.model),busy:!0}:Ce));const G=performance.now();let Q;eh({model:X.model,messages:Y,temperature:l.temperature,top_p:l.topP,max_tokens:l.maxTokens,reasoning_effort:th(l.reasoningEffort,o.find(ve=>ve.id===X.model)),response_format:l.jsonMode?{type:"json_object"}:void 0,stream:l.stream},{signal:(me=x.current[F])==null?void 0:me.signal,onDelta:ve=>{Q??(Q=performance.now()-G),h(Ce=>Ce.map((ne,te)=>te===F?{...ne,text:ne.text+ve}:ne))},onUsage:ve=>L(F,{usage:ve}),onError:ve=>L(F,{error:ve}),onDone:()=>L(F,{timing:{ttft:Q,total:performance.now()-G}})}).catch(ve=>{(ve==null?void 0:ve.name)!=="AbortError"&&L(F,{error:String((ve==null?void 0:ve.message)??ve)})}).finally(()=>L(F,{busy:!1}))}),y(""),g.clear()}function Z(C){C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),z())}const oe=["scx","anthropic","nvidia","bedrock","openrouter"].map(C=>[C,u.filter(Y=>(Y.provider??"scx")===C)]).filter(([,C])=>C.length>0),de=d.some(C=>{var Y,O;return(O=(Y=o.find(X=>X.id===C.model))==null?void 0:Y.input_modalities)==null?void 0:O.includes("image")});return s.jsxs("main",{className:"main",children:[s.jsxs(Bo,{title:`bugxhunter@playground: ~/compare (${d.length} models)`,children:[s.jsxs("span",{className:"status-pill"+(k?" live":""),children:[s.jsx("span",{className:"dot"}),k?"running":"ready"]}),d.length<ak&&s.jsx("button",{className:"btn ghost sm",disabled:k,onClick:()=>h(C=>[...C,To(Sv(u,C.map(Y=>Y.model))??l.model)]),children:"+ model"}),s.jsx("button",{className:"btn ghost sm",onClick:()=>{V(),c()},children:"back to chat"})]}),s.jsxs("div",{className:"transcript grid-bg",children:[v&&s.jsxs("div",{className:"compare-prompt mono",children:["$ ",v]}),s.jsx("div",{className:"compare-grid",style:{"--cols":d.length},children:d.map((C,Y)=>{var O,X;return s.jsxs("section",{className:"compare-col",children:[s.jsxs("div",{className:"compare-head",children:[s.jsxs("select",{value:C.model,disabled:k,onChange:F=>L(Y,{...To(F.target.value)}),"aria-label":`Model ${Y+1}`,children:[!u.some(F=>F.id===C.model)&&s.jsx("option",{value:C.model,children:C.model}),oe.map(([F,ie])=>s.jsx("optgroup",{label:lk[F],children:ie.map(G=>{var Q;return s.jsxs("option",{value:G.id,children:[G.name,(Q=G.input_modalities)!=null&&Q.includes("image")?" · vision":""]},G.id)})},F))]}),d.length>1&&s.jsx("button",{className:"attach-x",disabled:k,onClick:()=>h(F=>F.filter((ie,G)=>G!==Y)),"aria-label":"Remove this model",children:"✕"})]}),s.jsxs("div",{className:"compare-body",children:[C.skipped&&s.jsx("div",{className:"hint",style:{color:"var(--amber)"},children:C.skipped}),C.error&&s.jsx("div",{className:"error-banner",children:C.error}),C.text&&s.jsx(Ic,{text:C.text}),C.busy&&s.jsx("span",{className:"cursor"}),!C.text&&!C.busy&&!C.skipped&&!C.error&&s.jsx("p",{className:"muted mono",style:{margin:0},children:v?"No answer.":"Waiting for a prompt…"})]}),(C.timing||C.usage)&&s.jsxs("div",{className:"msg-meta",children:[C.timing&&e0(C.timing,(O=C.usage)==null?void 0:O.completion,(X=C.usage)==null?void 0:X.reasoning),C.usage&&`${C.timing?" · ":""}${C.usage.prompt??0} in${Wv(C.usage)} · ${C.usage.completion??0} out tokens`]})]},Y)})})]}),s.jsxs("div",{className:"composer",children:[s.jsxs("div",{className:"composer-box",onDragOver:C=>C.preventDefault(),onDrop:g.onDrop,children:[s.jsx(vh,{images:g.images,docs:g.docs,reading:g.reading,onRemove:g.remove,onRemoveDoc:g.removeDoc}),s.jsx("textarea",{value:m,onChange:C=>y(C.target.value),onKeyDown:Z,onPaste:g.onPaste,rows:3,placeholder:`Ask all ${d.length} models the same thing…${de?" (images go to the vision models)":""}`}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("input",{ref:b,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:C=>{C.target.files&&g.addImages(C.target.files),C.target.value=""}}),s.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var C;return(C=b.current)==null?void 0:C.click()},disabled:k,title:"Attach images (or paste / drop them)","aria-label":"Attach images",children:s.jsx(Vc,{})}),g.attachError&&s.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:g.attachError}),s.jsx("div",{className:"spacer"}),k?s.jsx("button",{className:"send-btn stop",onClick:V,title:"Stop all",children:"■"}):s.jsx("button",{className:"send-btn",onClick:z,disabled:!m.trim()&&!g.images.length&&!g.docs.length||g.reading,title:"Run on all models",children:"↑"})]})]}),s.jsx("div",{className:"composer-hint",children:"Enter to run on every model · uses the sidebar's system prompt and settings · single turn"})]})]})}const Ti=["data","management","attestation","identity","control","blocked"],Uo={data:"Data",management:"Management",attestation:"Attestation / evidence",identity:"Identity / credential",control:"Control / config",blocked:"Blocked"},ik=["actor","service","ai","datastore","external"],C0=["critical","high","medium","low"],qc={critical:0,high:1,medium:2,low:3},Sc=()=>({title:"Untitled threat model",nodes:[],edges:[]}),Dt=(l,o="")=>typeof l=="string"?l.trim():o,Mo=l=>l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"node";function ok(l){const o=Dt(l).toLowerCase();return ik.includes(o)?o:/user|client|admin|customer|attacker|person|internet/.test(o)?"actor":/\b(ai|llm|model|agent|copilot|assistant|rag|retriev|inference|embedding)/.test(o)?"ai":/db|database|store|bucket|storage|cache|queue|file|repo|config|secret/.test(o)?"datastore":/third|external|saas|vendor|partner/.test(o)?"external":"service"}function rk(l,o){const c=Dt(l).toLowerCase();return Ti.includes(c)?c:c?/block|denied|disabled|cut/.test(c)?"blocked":/attest|evidence|spdm|measure/.test(c)?"attestation":/ident|credential|cert|svid|token|key|auth/.test(c)?"identity":/manag|admin|mgmt|bmc|redfish|ssh|console/.test(c)?"management":/control|config|crd|gitops|policy|deploy|boot|admission/.test(c)?"control":"data":/\bblocked\b/i.test(o)?"blocked":"data"}function wv(l,o){return(Array.isArray(l)?l:[]).flatMap((c,u)=>{if(!c||typeof c!="object")return[];const d=c,h=Dt(d.title)||Dt(d.issue)||Dt(d.name);if(!h)return[];const m=Dt(d.status).toLowerCase();return[{id:`${o}-f${u+1}`,title:h,severity:ck(d.severity),fix:Dt(d.fix)||Dt(d.mitigation)||void 0,ref:Dt(d.ref)||Dt(d.cwe)||void 0,status:m==="fixed"||m==="verified"?m:"open"}]})}function ck(l){const o=Dt(l).toLowerCase();return C0.includes(o)?o:o.startsWith("crit")||o==="p1"?"critical":o.startsWith("hi")||o==="p2"?"high":o.startsWith("lo")||o==="p4"||o==="p5"||o.startsWith("info")?"low":"medium"}function uk(l){const o=l.match(/```(?:json)?\s*([\s\S]*?)```/i),c=o?o[1]:l,u=c.indexOf("{"),d=c.lastIndexOf("}");if(u<0||d<=u)throw new Error("No JSON object in the model's reply.");return JSON.parse(c.slice(u,d+1))}function ko(l){if(!l||typeof l!="object")throw new Error("Threat model must be a JSON object.");const o=l,c=new Set,u=y=>{let v=y;for(let S=2;c.has(v);S++)v=`${y}-${S}`;return c.add(v),v},d=new Map,h=(Array.isArray(o.nodes)?o.nodes:[]).flatMap((y,v)=>{if(!y||typeof y!="object")return[];const S=y,g=Dt(S.label)||Dt(S.name)||`Component ${v+1}`,b=Dt(S.id)||Mo(g),x=u(Mo(b));d.has(b)||d.set(b,x),d.has(g)||d.set(g,x);const k=wv(S.findings,x);return[{id:x,label:g,kind:ok(S.kind??S.type),details:(Array.isArray(S.details)?S.details:[]).map(L=>Dt(L)).filter(Boolean).slice(0,8),inScope:S.inScope!==!1,tested:S.tested===!0,findings:k,x:typeof S.x=="number"?S.x:void 0,y:typeof S.y=="number"?S.y:void 0}]}),m=(Array.isArray(o.edges)?o.edges:[]).flatMap((y,v)=>{if(!y||typeof y!="object")return[];const S=y,g=d.get(Dt(S.from))??d.get(Mo(Dt(S.from))),b=d.get(Dt(S.to))??d.get(Mo(Dt(S.to)));if(!g||!b||g===b)return[];let x=Dt(S.label);const k=/\s*\(implied\)\s*$/i.test(x);k&&(x=x.replace(/\s*\(implied\)\s*$/i,""));const L=`e${v+1}`;return[{id:L,from:g,to:b,label:x||Dt(S.protocol)||void 0,kind:rk(S.kind??S.type,x),encrypted:typeof S.encrypted=="boolean"?S.encrypted:void 0,implied:S.implied===!0||k||void 0,protocol:Dt(S.protocol)||void 0,auth:Dt(S.auth)||Dt(S.authentication)||void 0,findings:wv(S.findings,L)}]});return{title:Dt(o.title)||"Untitled threat model",nodes:h,edges:m}}const Wn=200,rl=86,dk=120,fk=40,Kf=Wn+dk,Lo=rl+fk,Av=6,wc={actor:0,external:1,service:2,ai:3,datastore:4},Df=l=>l.x!==void 0&&l.y!==void 0;function Vl(l){const o=l.nodes.filter(y=>!Df(y));if(!o.length)return l;if(o.length===l.nodes.length)return{...l,nodes:mk(l.nodes,l.edges)};const c=l.nodes.filter(Df),u=Math.min(...c.map(y=>y.x)),d=Math.max(...c.map(y=>y.y))+Lo;let h=0;const m=l.nodes.map(y=>{if(Df(y))return y;const v=h++;return{...y,x:u+v%4*Kf,y:d+Math.floor(v/4)*Lo}});return{...l,nodes:m}}function hk(l){return Vl({...l,nodes:l.nodes.map(({x:o,y:c,...u})=>u)})}function mk(l,o){var ie;const c=new Map(l.map((G,Q)=>[G.id,Q])),u=new Map(l.map(G=>[G.id,new Set])),d=new Map(l.map(G=>[G.id,new Set]));for(const G of o)G.from===G.to||!u.has(G.from)||!u.has(G.to)||(u.get(G.from).add(G.to),d.get(G.to).add(G.from));const h=l.filter(G=>u.get(G.id).size||d.get(G.id).size),m=l.filter(G=>!u.get(G.id).size&&!d.get(G.id).size),y=[...h].sort((G,Q)=>(d.get(G.id).size?1:0)-(d.get(Q.id).size?1:0)||wc[G.kind]-wc[Q.kind]||c.get(G.id)-c.get(Q.id)),v=new Map(h.map(G=>[G.id,[]])),S=new Map(h.map(G=>[G.id,[]])),g=new Map,b=G=>{g.set(G,1);for(const Q of u.get(G))g.get(Q)!==1&&(v.get(G).push(Q),S.get(Q).push(G),g.has(Q)||b(Q));g.set(G,2)};for(const G of y)g.has(G.id)||b(G.id);const x=[],k=new Map(h.map(G=>[G.id,S.get(G.id).length])),L=h.filter(G=>!k.get(G.id)).map(G=>G.id);for(;L.length;){const G=L.shift();x.push(G);for(const Q of v.get(G))k.set(Q,k.get(Q)-1),k.get(Q)||L.push(Q)}const V=new Map;for(const G of x)V.set(G,Math.max(0,...S.get(G).map(Q=>V.get(Q)+1)));for(const G of[...x].reverse()){const Q=l[c.get(G)];S.get(G).length||!v.get(G).length||Q.kind==="actor"||V.set(G,Math.max(0,Math.min(...v.get(G).map(K=>V.get(K)))-1))}const z=[];for(const G of x)(z[ie=V.get(G)]??(z[ie]=[])).push(G);const Z=z.filter(Boolean),oe=new Map;Z.forEach(G=>G.forEach((Q,K)=>oe.set(Q,K-(G.length-1)/2)));for(let G=0;G<8;G++){const Q=G%2===0;for(const K of Q?Z:[...Z].reverse()){const me=V.get(K[0]),ve=new Map(K.map(Ce=>{const ne=[...d.get(Ce),...u.get(Ce)].filter(te=>V.has(te)&&(Q?V.get(te)<me:V.get(te)>me));return[Ce,ne.length?ne.reduce((te,ce)=>te+oe.get(ce),0)/ne.length:oe.get(Ce)]}));K.sort((Ce,ne)=>ve.get(Ce)-ve.get(ne)),K.forEach((Ce,ne)=>oe.set(Ce,ne-(K.length-1)/2))}}const C=Math.min(Av,Math.max(0,...Z.map(G=>G.length))),Y=new Map;let O=0;for(const G of Z){const Q=Math.ceil(G.length/Av),K=Math.ceil(G.length/Q);G.forEach((me,ve)=>{const Ce=Math.floor(ve/K),ne=Math.min(K,G.length-Ce*K);Y.set(me,{x:40+(O+Ce)*Kf,y:40+((C-ne)/2+ve%K)*Lo})}),O+=Q}const X=Z.length?40+(C+.5)*Lo:40,F=Math.max(4,O);return[...m].sort((G,Q)=>wc[G.kind]-wc[Q.kind]||c.get(G.id)-c.get(Q.id)).forEach((G,Q)=>Y.set(G.id,{x:40+Q%F*Kf,y:X+Math.floor(Q/F)*Lo})),l.map(G=>({...G,...Y.get(G.id)}))}function Tv(l){let o=null;for(const c of l.findings)c.status==="open"&&(!o||qc[c.severity]<qc[o])&&(o=c.severity);return o}function pk(l){const o={critical:0,high:0,medium:0,low:0};let c=0;for(const h of[...l.nodes.flatMap(m=>m.findings),...l.edges.flatMap(m=>m.findings??[])])h.status==="open"?o[h.severity]++:c++;const u=Object.fromEntries(Ti.map(h=>[h,0]));for(const h of l.edges)u[h.kind??"data"]++;const d=l.nodes.filter(h=>h.inScope);return{components:l.nodes.length,inScope:d.length,tested:d.filter(h=>h.tested).length,open:o,fixed:c,plaintextFlows:l.edges.filter(h=>h.encrypted===!1).length,flows:l.edges.length,impliedFlows:l.edges.filter(h=>h.implied).length,blockedFlows:u.blocked,byKind:u}}function gk(l){const o=new Map(l.nodes.map(h=>[h.id,h.label])),c=[...l.nodes.flatMap(h=>h.findings.map(m=>({where:h.label,f:m}))),...l.edges.flatMap(h=>(h.findings??[]).map(m=>({where:`${o.get(h.from)??h.from} → ${o.get(h.to)??h.to} (${Uo[h.kind??"data"].toLowerCase()} flow)`,f:m})))].sort((h,m)=>qc[h.f.severity]-qc[m.f.severity]),u=(h="")=>h.replace(/\|/g,"\\|").replace(/\n/g," ");return[`# ${u(l.title)}`,"","| Severity | Component or flow | Finding | Fix | Ref | Status |","|---|---|---|---|---|---|",...c.map(({where:h,f:m})=>`| ${m.severity} | ${u(h)} | ${u(m.title)} | ${u(m.fix)} | ${u(m.ref)} | ${m.status} |`)].join(`
245
245
  `)+`
246
- `}function mk(l){const o=Vl(l),c=new Map(o.nodes.map((y,v)=>[y.id,`n${v}-${Mo(y.id)}`])),u=(y,v)=>y.length>v?y.slice(0,v-1)+"…":y,d=y=>{if(!y.inScope)return"out of scope";const v=N0.map(S=>[S,y.findings.filter(g=>g.status==="open"&&g.severity===S).length]).filter(([,S])=>S>0);return v.length?v.map(([S,g])=>`${g} ${S}`).join(" · "):"no open findings"},h=Math.min(...o.nodes.map(y=>y.x??0)),m=Math.min(...o.nodes.map(y=>y.y??0));return{title:u(l.title||"Threat model",80),nodes:o.nodes.map(y=>({id:c.get(y.id),label:u(y.label,40),kind:y.kind,sub:d(y),x:Math.round((y.x??0)-h+40),y:Math.round((y.y??0)-m+90),w:Wn,h:rl})),edges:o.edges.filter(y=>c.has(y.from)&&c.has(y.to)).map(y=>{const v=y.kind??"data",S=y.encrypted===!1&&!/plain/i.test(y.label??""),g=S?"async":v==="blocked"?"weak":v==="management"||v==="control"?"sync":v==="attestation"||v==="identity"?"ai":"data",b=[v==="data"?"":`${v}:`,y.label,S?"(plaintext)":"",y.implied?"(implied)":""].filter(Boolean).join(" ");return{from:c.get(y.from),to:c.get(y.to),style:g,...b?{label:u(b,48)}:{}}}),legend:{edges:[]}}}function pk(l,o,c){const u=Math.max(l,o?65536:8192);return c&&c>0?Math.min(u,Math.max(c,1024)):u}let jo;function gk(){if(jo!==void 0)return jo;try{jo=typeof document<"u"?document.createElement("canvas").getContext("2d"):null}catch{jo=null}return jo}function Zf(l,o){var h;const c=gk();if(c)return c.font=o,c.measureText(l).width;const u=Number(((h=/(\d+(?:\.\d+)?)px/.exec(o))==null?void 0:h[1])??12),d=/mono/i.test(o)||/\b[6-9]00\b|bold/.test(o)?.6:.56;return l.length*u*d}function Ac(l,o,c){if(o<=0)return"";if(Zf(l,c)<=o)return l;const u=Array.from(l);let d=0,h=u.length;for(;d<h;){const m=Math.ceil((d+h)/2);Zf(u.slice(0,m).join("").trimEnd()+"…",c)<=o?d=m:h=m-1}return d?u.slice(0,d).join("").trimEnd()+"…":"…"}const yk="700 14px Inter, system-ui, sans-serif",vk="10px JetBrains Mono, monospace",bk="11px Inter, system-ui, sans-serif",kv="11px JetBrains Mono, monospace",xk=`You are a security architect building a threat model of a system the user owns or is authorised to assess.
246
+ `}function yk(l){const o=Vl(l),c=new Map(o.nodes.map((y,v)=>[y.id,`n${v}-${Mo(y.id)}`])),u=(y,v)=>y.length>v?y.slice(0,v-1)+"…":y,d=y=>{if(!y.inScope)return"out of scope";const v=C0.map(S=>[S,y.findings.filter(g=>g.status==="open"&&g.severity===S).length]).filter(([,S])=>S>0);return v.length?v.map(([S,g])=>`${g} ${S}`).join(" · "):"no open findings"},h=Math.min(...o.nodes.map(y=>y.x??0)),m=Math.min(...o.nodes.map(y=>y.y??0));return{title:u(l.title||"Threat model",80),nodes:o.nodes.map(y=>({id:c.get(y.id),label:u(y.label,40),kind:y.kind,sub:d(y),x:Math.round((y.x??0)-h+40),y:Math.round((y.y??0)-m+90),w:Wn,h:rl})),edges:o.edges.filter(y=>c.has(y.from)&&c.has(y.to)).map(y=>{const v=y.kind??"data",S=y.encrypted===!1&&!/plain/i.test(y.label??""),g=S?"async":v==="blocked"?"weak":v==="management"||v==="control"?"sync":v==="attestation"||v==="identity"?"ai":"data",b=[v==="data"?"":`${v}:`,y.label,S?"(plaintext)":"",y.implied?"(implied)":""].filter(Boolean).join(" ");return{from:c.get(y.from),to:c.get(y.to),style:g,...b?{label:u(b,48)}:{}}}),legend:{edges:[]}}}function vk(l,o,c){const u=Math.max(l,o?65536:8192);return c&&c>0?Math.min(u,Math.max(c,1024)):u}let jo;function bk(){if(jo!==void 0)return jo;try{jo=typeof document<"u"?document.createElement("canvas").getContext("2d"):null}catch{jo=null}return jo}function Zf(l,o){var h;const c=bk();if(c)return c.font=o,c.measureText(l).width;const u=Number(((h=/(\d+(?:\.\d+)?)px/.exec(o))==null?void 0:h[1])??12),d=/mono/i.test(o)||/\b[6-9]00\b|bold/.test(o)?.6:.56;return l.length*u*d}function Ac(l,o,c){if(o<=0)return"";if(Zf(l,c)<=o)return l;const u=Array.from(l);let d=0,h=u.length;for(;d<h;){const m=Math.ceil((d+h)/2);Zf(u.slice(0,m).join("").trimEnd()+"…",c)<=o?d=m:h=m-1}return d?u.slice(0,d).join("").trimEnd()+"…":"…"}const xk="700 14px Inter, system-ui, sans-serif",Sk="10px JetBrains Mono, monospace",wk="11px Inter, system-ui, sans-serif",kv="11px JetBrains Mono, monospace",Ak=`You are a security architect building a threat model of a system the user owns or is authorised to assess.
247
247
  From the diagram, screenshot or description you are given, map the system and its weaknesses.
248
248
 
249
249
  Reply with ONE JSON object and nothing else, in exactly this shape:
@@ -285,19 +285,19 @@ Rules:
285
285
  - "ref" holds the ids only, space-separated, e.g. "A01:2025 CWE-284" or "LLM01:2025 AML.T0051.001". Prefer the most specific id you are sure of; omit "ref" rather than guess.
286
286
  - Keep every string short. No markdown, no commentary outside the JSON.
287
287
 
288
- ${l0}
288
+ ${i0}
289
289
 
290
290
  ${mh()}
291
291
 
292
- ${jw()}`;function Sk(l,o){const c=o?"the attached diagram, screenshot or document":"the system described below",u=l.trim()?`
292
+ ${C1()}`;function Tk(l,o){const c=o?"the attached diagram, screenshot or document":"the system described below",u=l.trim()?`
293
293
 
294
294
  Context from the user:
295
- ${l.trim()}`:"";return`Build the threat model JSON for ${c}.${u}`}const _o=()=>crypto.randomUUID().toLowerCase(),Kc=l=>`/api/playground/sessions/${l}`;async function Zc(l,o){var u,d;if(l.ok)return l.json();let c="";try{c=((d=(u=await l.json())==null?void 0:u.error)==null?void 0:d.message)??""}catch{}throw new Error(c||`${o} failed (${l.status})`)}const Cc=l=>fetch(Kc(l)).then(o=>Zc(o,"Listing saved sessions")).then(o=>o.sessions),Ff=(l,o)=>fetch(`${Kc(l)}/${o}`).then(c=>Zc(c,"Opening the session")),Mc=(l,o,c,u)=>fetch(`${Kc(l)}/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:c,body:u})}).then(d=>Zc(d,"Saving")),E0=(l,o)=>fetch(`${Kc(l)}/${o}`,{method:"DELETE"}).then(c=>Zc(c,"Deleting")),jv="or_threat_model",wk=1200,C0="or_canvas_panel",Nv="or_canvas_build_box",M0=340,_0=260,R0=640;function Ak(){try{const l=JSON.parse(localStorage.getItem(C0)??"null");if(l&&typeof l.width=="number")return{width:Math.min(R0,Math.max(_0,l.width)),collapsed:l.collapsed===!0}}catch{}return{width:M0,collapsed:!1}}const Ev={actor:"#00e5ff",service:"#8fa8ff",ai:"#c58cff",datastore:"#ffb300",external:"#b4bcc6"},Ro={critical:"#ff3c3c",high:"#ff7a45",medium:"#ffb300",low:"#6e7681"},Pf=["critical","high","medium","low"],Tk=["actor","service","ai","datastore","external"],bi={data:"#9aa4b2",management:"#c792ea",attestation:"#e3b341",identity:"#3fb950",control:"#58a6ff",blocked:"#5c6370"},Jf="#ff3c3c";function kk(l,o){const c=(l.x??0)+Wn/2,u=(l.y??0)+rl/2,d=(o.x??0)+Wn/2,h=(o.y??0)+rl/2;if(Math.abs(d-c)>Wn){const b=d>c?1:-1,x=c+b*Wn/2,k=d-b*(Wn/2+2),D=Math.max(40,Math.abs(k-x)/2)*b;return{d:`M${x},${u} C${x+D},${u} ${k-D},${h} ${k},${h}`,ax:x,ay:u,ex:k,ey:h}}const m=d-c,y=h-u,v=Math.min(Math.abs(Wn/2/(m||1e-6)),Math.abs(rl/2/(y||1e-6)),1),S=d-m*v,g=h-y*v;return{d:`M${c},${u} L${S},${g}`,ax:c,ay:u,ex:S,ey:g}}function jk(l){const o=l.encrypted===!1,c=o?Jf:bi[l.kind??"data"],u=l.kind==="blocked"?"2 5":o?"7 5":l.implied?"4 4":void 0;return{plain:o,color:c,dash:u,opacity:l.implied?.6:1,marker:o?"tm-arrow-plain":`tm-arrow-${l.kind??"data"}`}}const Nk=(l,o)=>l.length>o?l.slice(0,o-1)+"…":l;function Tc(l,o,c){const u=URL.createObjectURL(new Blob([o],{type:c})),d=document.createElement("a");d.href=u,d.download=l,d.click(),URL.revokeObjectURL(u)}function Ek({config:l,models:o,onExit:c}){var hl,ja,ha;const[u,d]=A.useState(Sc),[h,m]=A.useState(_o),[y,v]=A.useState(null),[S,g]=A.useState([]),[b,x]=A.useState(null),[k,D]=A.useState(!1),V=A.useRef(""),[L,K]=A.useState(null),[ce,de]=A.useState(null),[E,G]=A.useState(Ak);A.useEffect(()=>{try{localStorage.setItem(C0,JSON.stringify(E))}catch{}},[E]);const[H,Y]=A.useState(()=>{try{return localStorage.getItem(Nv)==="hidden"}catch{return!1}});A.useEffect(()=>{try{localStorage.setItem(Nv,H?"hidden":"shown")}catch{}},[H]);const[F,ie]=A.useState(!1);A.useEffect(()=>{var ct,at,Nt;if(!F)return;let N=!1;const Z=()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{})};(at=(ct=document.documentElement).requestFullscreen)==null||at.call(ct).then(()=>{N&&Z()}).catch(()=>{});const ge=[];for(let lt=X.current;lt!=null&&lt.parentElement&&lt.parentElement!==document.body;lt=lt.parentElement)for(const Bt of Array.from(((Nt=lt.parentElement)==null?void 0:Nt.children)??[]))Bt!==lt&&!Bt.hasAttribute("inert")&&(Bt.setAttribute("inert",""),ge.push(Bt));const xe=lt=>{var In;if(lt.key!=="Escape"||lt.defaultPrevented||lt.isComposing)return;const Bt=lt.target;(In=Bt==null?void 0:Bt.closest)!=null&&In.call(Bt,"input, textarea, select, [contenteditable]")||document.querySelector(".overlay")||ie(!1)},et=()=>{document.fullscreenElement||ie(!1)};return window.addEventListener("keydown",xe),document.addEventListener("fullscreenchange",et),()=>{N=!0,window.removeEventListener("keydown",xe),document.removeEventListener("fullscreenchange",et);for(const lt of ge)lt.removeAttribute("inert");Z()}},[F]);const X=A.useRef(null);function P(N){var ct;N.preventDefault();const Z=N.currentTarget;Z.setPointerCapture(N.pointerId),document.body.classList.add("resizing");const ge=((ct=X.current)==null?void 0:ct.getBoundingClientRect().right)??window.innerWidth,xe=at=>G(Nt=>({...Nt,width:Math.round(Math.min(R0,Math.max(_0,ge-at.clientX)))})),et=()=>{Z.removeEventListener("pointermove",xe),Z.removeEventListener("pointerup",et),document.body.classList.remove("resizing")};Z.addEventListener("pointermove",xe),Z.addEventListener("pointerup",et)}const[Q,me]=A.useState(""),[ve,Ce]=A.useState(!1),[ne,te]=A.useState(null),re=yh(),ee=A.useRef(null),ke=A.useRef(null),Ze=A.useRef(null),bt=A.useRef(null),kt=()=>Cc("canvas").then(g).catch(N=>x({ok:!1,text:String(N.message??N)}));function j(N,Z,ge){d(N),m(Z),K(null),de(null),An(null),V.current=ge?JSON.stringify(N):""}A.useEffect(()=>{let N=!0;return(async()=>{try{let Z=null;try{Z=localStorage.getItem(jv)}catch{}if(Z){const xe=Vl(ko(JSON.parse(Z)));xe.nodes.length&&await Mc("canvas",_o(),xe.title,xe);try{localStorage.removeItem(jv)}catch{}}const ge=await Cc("canvas");if(!N)return;if(g(ge),ge[0]){const xe=await Ff("canvas",ge[0].id);N&&j(Vl(ko(xe.body)),ge[0].id,!0)}}catch(Z){N&&x({ok:!1,text:`Saved canvases unavailable: ${String(Z.message??Z)}`})}finally{N&&D(!0)}})(),()=>{N=!1}},[]),A.useEffect(()=>{if(!k||!u.nodes.length)return;const N=JSON.stringify(u);if(N===V.current)return;const Z=setTimeout(()=>{Mc("canvas",h,u.title,u).then(()=>(V.current=N,x({ok:!0,text:"Saved, encrypted with your vault"}),Cc("canvas").then(g))).catch(ge=>x({ok:!1,text:`Not saved: ${String(ge.message??ge)}`}))},wk);return()=>clearTimeout(Z)},[u,h,k]);async function ae(N){try{const Z=await Ff("canvas",N);v(null),j(Vl(ko(Z.body)),N,!0)}catch(Z){x({ok:!1,text:String(Z.message??Z)})}}async function je(N){try{await E0("canvas",N),N===h&&j(Sc(),_o(),!1),await kt()}catch(Z){x({ok:!1,text:String(Z.message??Z)})}}const pe=o.filter(Lc),Ie=pe.filter(N=>{var Z;return(Z=N.input_modalities)==null?void 0:Z.includes("image")}),Oe=re.images.length>0,ze=Oe?Ie:pe,[Se,_e]=A.useState(l.model),mt=ze.some(N=>N.id===Se)?Se:((hl=ze[0])==null?void 0:hl.id)??"",O=fk(u),we=u.nodes.find(N=>N.id===L)??null,he=u.edges.find(N=>N.id===ce)??null;function Be(N){u.nodes.length&&JSON.stringify(u)!==V.current&&Mc("canvas",h,u.title,u).catch(()=>{}),v({model:u,id:h}),j(N,_o(),!1)}const Ee=(N,Z)=>d(ge=>({...ge,nodes:ge.nodes.map(xe=>xe.id===N?{...xe,...Z}:xe)})),le=(N,Z,ge)=>d(xe=>({...xe,nodes:xe.nodes.map(et=>et.id===N?{...et,findings:et.findings.map(ct=>ct.id===Z?{...ct,...ge}:ct)}:et)}));function Te(){const N=`component-${Date.now().toString(36)}`;d(Z=>Vl({...Z,nodes:[...Z.nodes,{id:N,label:"New component",kind:"service",details:[],inScope:!0,tested:!1,findings:[]}]})),K(N)}function be(N){d(Z=>({...Z,nodes:Z.nodes.filter(ge=>ge.id!==N),edges:Z.edges.filter(ge=>ge.from!==N&&ge.to!==N)})),K(null)}const qe=(N,Z)=>d(ge=>({...ge,edges:ge.edges.map(xe=>xe.id===N?{...xe,...Z}:xe)})),q=(N,Z,ge)=>d(xe=>({...xe,edges:xe.edges.map(et=>et.id===N?{...et,findings:et.findings.map(ct=>ct.id===Z?{...ct,...ge}:ct)}:et)}));function Re(N,Z,ge){const xe=`e-${Date.now().toString(36)}`;d(et=>({...et,edges:[...et.edges,{id:xe,from:N,to:Z,kind:ge,findings:[]}]})),K(null),de(xe)}function He(N){d(Z=>({...Z,edges:Z.edges.filter(ge=>ge.id!==N)})),de(null)}function pt(N,Z){N.stopPropagation(),K(null),de(Z)}function Ve(){var ge;if(ve||!Q.trim()&&!re.images.length&&!re.docs.length||re.reading||!mt)return;Ce(!0),te(null);const N=new AbortController;bt.current=N;let Z="";eh({model:mt,messages:[{role:"system",content:xk},{role:"user",content:Eh(Sk(Q,re.images.length>0||re.docs.length>0),re.images,re.docs)}],temperature:.2,max_tokens:pk(l.maxTokens,re.docs.length>0,(ge=pe.find(xe=>xe.id===mt))==null?void 0:ge.max_output_length),reasoning_effort:th(l.reasoningEffort,pe.find(xe=>xe.id===mt)),stream:!0},{signal:N.signal,onDelta:xe=>{Z+=xe},onError:xe=>te(xe),onDone:xe=>{if(!Z.trim()){te(xe==="length"?"The model used its whole output limit thinking and wrote no threat model. Try again, raise Max tokens, or pick a faster model.":"The model returned no answer. Try again or pick another model.");return}try{const et=Vl(ko(ok(Z)));if(!et.nodes.length)throw new Error("The model returned no components.");Be(et),me(""),re.clear()}catch(et){te(xe==="length"?"The model ran out of output tokens before finishing the threat model. Raise Max tokens or ask for fewer components.":`Couldn't read the model's threat model: ${et.message}`)}}}).catch(xe=>{(xe==null?void 0:xe.name)!=="AbortError"&&te(String((xe==null?void 0:xe.message)??xe))}).finally(()=>{Ce(!1),bt.current=null})}async function ht(N){try{Be(Vl(ko(JSON.parse(await N.text()))))}catch(Z){te(`Import failed: ${Z.message}`)}}const $e=u.title.replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-|-$/g,"")||"threat-model",[Vt,ea]=A.useState(!1),[fa,gn]=A.useState(!1);A.useEffect(()=>{k0().then(ea)},[]);async function wn(){gn(!0);const N=await j0(mk(u));gn(!1),N.ok?Tc(`${$e}.drawio.svg`,N.r.svg,"image/svg+xml"):x({ok:!1,text:`draw.io export failed: ${N.error}`})}function Bn(){const N=Ze.current;if(!N)return;const Z=N.cloneNode(!0);Z.setAttribute("xmlns","http://www.w3.org/2000/svg"),Z.removeAttribute("class"),Z.removeAttribute("style"),Z.setAttribute("viewBox",`${nn.x} ${nn.y} ${nn.w} ${nn.h}`),Z.setAttribute("width",String(Math.round(nn.w))),Z.setAttribute("height",String(Math.round(nn.h))),Tc(`${$e}.svg`,new XMLSerializer().serializeToString(Z),"image/svg+xml")}const[ka,An]=A.useState(null),nn=A.useMemo(()=>{if(!u.nodes.length)return{x:0,y:0,w:900,h:520};const N=u.nodes.map(et=>et.x??0),Z=u.nodes.map(et=>et.y??0),ge=Math.min(...N)-40,xe=Math.min(...Z)-40;return{x:ge,y:xe,w:Math.max(900,Math.max(...N)+Wn+40-ge),h:Math.max(520,Math.max(...Z)+rl+40-xe)}},[u.nodes]),yt=ka??nn,Ga=Math.round(nn.w/yt.w*100),yn=A.useRef(nn);yn.current=nn;function vn(N,Z,ge){An(xe=>{const et=yn.current,ct=xe??et,at=Math.min(et.w*4,Math.max(et.w/4,ct.w/N)),Nt=ct.w/at,lt=Z??ct.x+ct.w/2,Bt=ge??ct.y+ct.h/2;return{x:lt-(lt-ct.x)/Nt,y:Bt-(Bt-ct.y)/Nt,w:at,h:ct.h/Nt}})}function Cn(N,Z){const ge=new DOMPoint(N,Z).matrixTransform(Ze.current.getScreenCTM().inverse());return{x:ge.x,y:ge.y}}const B=u.nodes.length>0;A.useEffect(()=>{const N=Ze.current;if(!N)return;const Z=ge=>{ge.preventDefault();const xe=Cn(ge.clientX,ge.clientY);vn(ge.deltaY<0?1.15:1/1.15,xe.x,xe.y)};return N.addEventListener("wheel",Z,{passive:!1}),()=>N.removeEventListener("wheel",Z)},[B]);const ue=A.useRef(null),Ae=A.useRef(null),[De,Ye]=A.useState(!1);function Qe(N,Z){var xe;N.stopPropagation(),An(yt);const ge=Cn(N.clientX,N.clientY);ue.current={id:Z.id,dx:ge.x-(Z.x??0),dy:ge.y-(Z.y??0)},(xe=Ze.current)==null||xe.setPointerCapture(N.pointerId),K(Z.id),de(null)}function Fe(N){var ge;const Z=Ze.current.getBoundingClientRect();Ae.current={cx:N.clientX,cy:N.clientY,start:yt,scale:Math.max(yt.w/Z.width,yt.h/Z.height)},(ge=Ze.current)==null||ge.setPointerCapture(N.pointerId),Ye(!0)}function jt(N){const Z=ue.current;if(Z){const xe=Cn(N.clientX,N.clientY);Ee(Z.id,{x:Math.round(xe.x-Z.dx),y:Math.round(xe.y-Z.dy)});return}const ge=Ae.current;ge&&An({...ge.start,x:ge.start.x-(N.clientX-ge.cx)*ge.scale,y:ge.start.y-(N.clientY-ge.cy)*ge.scale})}function Wt(){ue.current=null,Ae.current=null,Ye(!1)}const Mn=new Map(u.nodes.map(N=>[N.id,N]));return i.jsxs("main",{className:"main",children:[i.jsxs(Bo,{title:`bugxhunter@playground: ~/canvas: ${Nk(u.title,40)}`,children:[i.jsxs("span",{className:"status-pill",children:[i.jsx("span",{className:"dot"}),O.components," components · ",O.tested,"/",O.inScope," tested · ",O.open.critical+O.open.high," crit/high open"]}),i.jsx("button",{className:"btn ghost sm",onClick:Te,children:"+ component"}),i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,title:"Lay the canvas out again, left to right along its flows (undo puts it back)",onClick:()=>{v({model:u,id:h}),d(uk(u)),An(null)},children:"tidy"}),i.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;return(N=ke.current)==null?void 0:N.click()},children:"import"}),i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${$e}.json`,JSON.stringify(u,null,2),"application/json"),children:"json"}),i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${$e}-findings.md`,hk(u),"text/markdown"),children:"findings.md"}),i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:Bn,children:"svg"}),Vt&&i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length||fa,onClick:wn,title:"An editable diagram: opens in draw.io and its VS Code extension",children:fa?"draw.io…":"draw.io"}),y&&i.jsx("button",{className:"btn ghost sm",onClick:()=>{j(y.model,y.id,!1),v(null)},children:"undo"}),i.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Be(Sc()),children:"clear"}),i.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;(N=bt.current)==null||N.abort(),c()},children:"back to chat"}),i.jsx("input",{ref:ke,type:"file",accept:"application/json,.json",hidden:!0,onChange:N=>{var ge;const Z=(ge=N.target.files)==null?void 0:ge[0];Z&&ht(Z),N.target.value=""}})]}),i.jsxs("div",{className:"canvas-wrap"+(F?" full":""),ref:X,children:[i.jsxs("div",{className:"canvas-stage grid-bg",onPointerDown:()=>{K(null),de(null)},children:[(B||F)&&i.jsx("button",{className:"canvas-full-btn"+(F?" on":""),onPointerDown:N=>N.stopPropagation(),onClick:()=>ie(N=>!N),"aria-pressed":F,title:F?"Exit full screen (Esc)":"Full screen","aria-label":F?"Exit full screen":"Full screen",children:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:F?i.jsx("path",{d:"M6 2v4H2M10 2v4h4M6 14v-4H2M10 14v-4h4"}):i.jsx("path",{d:"M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4"})})}),F&&(ve||ne)&&i.jsxs("div",{className:"canvas-full-status"+(ne&&!ve?" failed":""),role:"status",onPointerDown:N=>N.stopPropagation(),children:[ve?"Building the threat model…":ne,ve&&i.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},children:"stop"})]}),B&&i.jsxs("div",{className:"canvas-zoom",onPointerDown:N=>N.stopPropagation(),children:[i.jsx("button",{onClick:()=>vn(1/1.25),title:"Zoom out","aria-label":"Zoom out",children:"−"}),i.jsxs("span",{title:"Zoom (100% = fit)",children:[Ga,"%"]}),i.jsx("button",{onClick:()=>vn(1.25),title:"Zoom in","aria-label":"Zoom in",children:"+"}),i.jsx("button",{onClick:()=>An(null),title:"Fit the whole model",children:"fit"})]}),u.nodes.length?i.jsxs("svg",{ref:Ze,className:"canvas-svg",viewBox:`${yt.x} ${yt.y} ${yt.w} ${yt.h}`,preserveAspectRatio:"xMidYMin meet",onPointerMove:jt,onPointerUp:Wt,onPointerCancel:Wt,style:{cursor:De?"grabbing":void 0},children:[i.jsxs("defs",{children:[[...Ti.map(N=>[`tm-arrow-${N}`,bi[N]]),["tm-arrow-plain",Jf],["tm-arrow-sel","#ffffff"]].map(([N,Z])=>i.jsx("marker",{id:N,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:i.jsx("path",{d:"M0,0 L10,5 L0,10 z",fill:Z})},N)),i.jsx("clipPath",{id:"tm-card-clip",children:i.jsx("rect",{width:Wn,height:rl,rx:10})})]}),i.jsx("rect",{x:"-100000",y:"-100000",width:"200000",height:"200000",fill:"#0a0e14",style:{cursor:De?"grabbing":"grab"},onPointerDown:Fe}),u.edges.map(N=>{var zt;const Z=Mn.get(N.from),ge=Mn.get(N.to);if(!Z||!ge)return null;const{d:xe,ax:et,ay:ct,ex:at,ey:Nt}=kk(Z,ge),lt=jk(N),Bt=ce===N.id,In=(et+at)/2,Xa=(ct+Nt)/2,Na=[N.label,lt.plain&&!/plain/i.test(N.label??"")?"(plaintext)":"",N.implied?"(implied)":""].filter(Boolean).join(" "),Zl=Math.min(240,Math.max(70,Math.hypot(at-et,Nt-ct)-24)),Ea=Na?Ac(Na,Zl,kv):"",ml=Ea?Zf(Ea,kv)+10:0,Es=Tv(N),Gt=((zt=N.findings)==null?void 0:zt.filter(Ut=>Ut.status==="open").length)??0;return i.jsxs("g",{opacity:lt.opacity,style:{cursor:"pointer"},onPointerDown:Ut=>pt(Ut,N.id),children:[i.jsx("title",{children:`${Uo[N.kind??"data"]} flow${N.implied?" (implied)":""}${Na?`: ${Na}`:""}`}),i.jsx("path",{d:xe,fill:"none",stroke:"transparent",strokeWidth:14}),i.jsx("path",{d:xe,fill:"none",stroke:Bt?"#ffffff":lt.color,strokeWidth:Bt?3:2,strokeDasharray:lt.dash,markerEnd:`url(#${Bt?"tm-arrow-sel":lt.marker})`}),N.kind==="blocked"&&i.jsxs("g",{transform:`translate(${In},${Xa})`,children:[i.jsx("circle",{r:8,fill:"#0a0e14",stroke:bi.blocked,strokeWidth:2}),i.jsx("line",{x1:-5,y1:5,x2:5,y2:-5,stroke:bi.blocked,strokeWidth:2})]}),Ea&&i.jsxs("g",{transform:`translate(${In},${Xa-(N.kind==="blocked"?18:10)})`,children:[i.jsx("rect",{x:-ml/2,y:-9,width:ml,height:15,rx:4,fill:"#0a0e14",opacity:.85}),i.jsx("text",{y:2,fill:lt.plain?"#ff8080":lt.color,fontSize:11,fontFamily:"JetBrains Mono, monospace",textAnchor:"middle",children:Ea})]}),Gt>0&&i.jsxs("g",{transform:`translate(${In+ml/2+4},${Xa-20})`,children:[i.jsx("rect",{width:20,height:16,rx:8,fill:Ro[Es??"low"]}),i.jsx("text",{x:10,y:12,fill:"#0a0e14",fontSize:10,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:Gt})]})]},N.id)}),u.nodes.map(N=>{const Z=Tv(N),ge=N.findings.filter(Nt=>Nt.status==="open").length,xe=N.x??0,et=N.y??0,ct=Wn-16-12,at=`${N.kind.toUpperCase()}${N.inScope?"":" · OUT OF SCOPE"}${N.tested?" · TESTED ✓":""}`;return i.jsxs("g",{transform:`translate(${xe},${et})`,opacity:N.inScope?1:.45,style:{cursor:"grab"},onPointerDown:Nt=>Qe(Nt,N),children:[i.jsx("title",{children:[N.label,...N.details].join(`
296
- `)}),i.jsx("rect",{width:Wn,height:rl,rx:10,fill:"#161b22",stroke:L===N.id?"#ffffff":Ev[N.kind],strokeWidth:L===N.id?2.5:1.5,strokeDasharray:N.inScope?void 0:"5 4"}),i.jsxs("g",{clipPath:"url(#tm-card-clip)",children:[Z&&i.jsx("rect",{width:6,height:rl,fill:Ro[Z]}),i.jsx("text",{x:16,y:22,fill:"#e6edf3",fontSize:14,fontWeight:700,fontFamily:"Inter, system-ui, sans-serif",children:Ac(N.label,ct-(ge>0?30:0),yk)}),i.jsx("text",{x:16,y:40,fill:Ev[N.kind],fontSize:10,fontFamily:"JetBrains Mono, monospace",children:Ac(at,ct,vk)}),N.details.slice(0,2).map((Nt,lt)=>i.jsx("text",{x:16,y:58+lt*14,fill:"#8b949e",fontSize:11,fontFamily:"Inter, system-ui, sans-serif",children:Ac(Nt,ct,bk)},lt))]}),ge>0&&i.jsxs("g",{transform:`translate(${Wn-30},8)`,children:[i.jsx("rect",{width:22,height:18,rx:9,fill:Ro[Z??"low"]}),i.jsx("text",{x:11,y:13,fill:"#0a0e14",fontSize:11,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:ge})]})]},N.id)})]}):i.jsx("div",{className:"empty-state center",children:i.jsxs("p",{className:"muted mono",children:["No threat model yet. Attach an architecture diagram or describe the system below, then ",i.jsx("b",{children:"build"}),". Or add components by hand, or import a saved model."]})}),E.collapsed&&i.jsx("button",{className:"sidebar-toggle floating canvas-panel-show",onPointerDown:N=>N.stopPropagation(),onClick:()=>G(N=>({...N,collapsed:!1})),title:"Show panel","aria-label":"Show panel",children:"«"})]}),!E.collapsed&&i.jsx("div",{className:"splitter canvas-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",title:"Drag to resize · double-click to reset",onPointerDown:P,onDoubleClick:()=>G(N=>({...N,width:M0}))}),i.jsxs("aside",{className:"canvas-panel",hidden:E.collapsed,style:{width:E.width},children:[i.jsxs("div",{className:"canvas-panel-head",children:[i.jsx("span",{className:"section-title",children:we?"Component":he?"Flow":"Canvas"}),i.jsx("button",{className:"sidebar-toggle",onClick:()=>G(N=>({...N,collapsed:!0})),title:"Hide panel","aria-label":"Hide panel",children:"»"})]}),we?i.jsx(Mk,{node:we,others:u.nodes.filter(N=>N.id!==we.id),onChange:N=>Ee(we.id,N),onFinding:(N,Z)=>le(we.id,N,Z),onAddFinding:N=>Ee(we.id,{findings:[...we.findings,N]}),onRemoveFinding:N=>Ee(we.id,{findings:we.findings.filter(Z=>Z.id!==N)}),onAddFlow:(N,Z)=>Re(we.id,N,Z),onDelete:()=>be(we.id)}):he?i.jsx(_k,{edge:he,fromLabel:((ja=Mn.get(he.from))==null?void 0:ja.label)??he.from,toLabel:((ha=Mn.get(he.to))==null?void 0:ha.label)??he.to,onChange:N=>qe(he.id,N),onFinding:(N,Z)=>q(he.id,N,Z),onAddFinding:N=>qe(he.id,{findings:[...he.findings,N]}),onRemoveFinding:N=>qe(he.id,{findings:he.findings.filter(Z=>Z.id!==N)}),onDelete:()=>He(he.id)}):i.jsxs("div",{className:"canvas-summary",children:[i.jsx("label",{children:"Title"}),i.jsx("input",{type:"text",value:u.title,onChange:N=>d(Z=>({...Z,title:N.target.value}))}),i.jsx("div",{className:"section-title",children:"Summary"}),i.jsxs("ul",{className:"canvas-stats",children:[i.jsxs("li",{children:[O.components," components, ",O.inScope," in scope"]}),i.jsxs("li",{children:["Coverage: ",O.tested,"/",O.inScope," tested"]}),Pf.map(N=>i.jsxs("li",{children:[i.jsx("span",{className:"sev-dot",style:{background:Ro[N]}}),O.open[N]," ",N," open"]},N)),i.jsxs("li",{children:[O.fixed," fixed or verified"]}),i.jsxs("li",{children:[O.flows," flow",O.flows===1?"":"s",": ",O.plaintextFlows," plaintext, ",O.impliedFlows," implied, ",O.blockedFlows," blocked"]})]}),i.jsx("div",{className:"section-title",children:"Flows"}),i.jsxs("ul",{className:"canvas-legend",children:[Ti.map(N=>i.jsxs("li",{children:[i.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:i.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:bi[N],strokeWidth:"2",strokeDasharray:N==="blocked"?"2 5":void 0})}),Uo[N]," ",i.jsxs("span",{className:"muted",children:["(",O.byKind[N],")"]})]},N)),i.jsxs("li",{children:[i.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:i.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:Jf,strokeWidth:"2",strokeDasharray:"7 5"})}),"Plaintext (any type)"]}),i.jsxs("li",{children:[i.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:i.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:bi.data,strokeWidth:"2",strokeDasharray:"4 4",opacity:"0.6"})}),"Implied: not drawn in the source"]})]}),i.jsx("p",{className:"hint",children:"Click a component or a flow to edit it and track its findings. Drag components to rearrange."}),i.jsx("div",{className:"section-title",children:"Saved canvases"}),b&&i.jsx("div",{className:"hint",style:{color:b.ok?"var(--muted)":"var(--amber)"},children:b.text}),i.jsx("button",{className:"btn ghost sm block",onClick:()=>Be(Sc()),disabled:!u.nodes.length,children:"+ New canvas"}),i.jsx(Ck,{list:S,activeId:h,onOpen:N=>void ae(N),onDelete:N=>void je(N)})]})]})]}),H?i.jsxs("div",{className:"composer canvas-box-collapsed",children:[i.jsxs("button",{className:"canvas-box-toggle",onClick:()=>Y(!1),title:"Show the build box","aria-label":"Show the build box","aria-expanded":!1,children:[i.jsx("span",{"aria-hidden":!0,children:"▴"})," build box"]}),ve?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"hint",children:"Building the threat model…"}),i.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},children:"stop"})]}):ne||re.attachError?i.jsx("span",{className:"hint",style:{color:"var(--amber)"},children:ne??re.attachError}):null]}):i.jsxs("div",{className:"composer",children:[i.jsxs("div",{className:"composer-box canvas-build-box",onDragOver:N=>N.preventDefault(),onDrop:re.onDrop,children:[i.jsx("button",{className:"sidebar-toggle canvas-box-hide",onClick:()=>Y(!0),title:"Hide the build box","aria-label":"Hide the build box","aria-expanded":!0,children:"▾"}),i.jsx(vh,{images:re.images,docs:re.docs,reading:re.reading,onRemove:re.remove,onRemoveDoc:re.removeDoc}),i.jsx("textarea",{value:Q,onChange:N=>me(N.target.value),onPaste:re.onPaste,rows:2,placeholder:"Attach an architecture diagram or a .md / .txt description, or describe the system (components, data stores, flows)…"}),i.jsxs("div",{className:"composer-bar",children:[i.jsx("input",{ref:ee,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:N=>{N.target.files&&re.addImages(N.target.files),N.target.value=""}}),i.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var N;return(N=ee.current)==null?void 0:N.click()},disabled:ve,title:"Attach a diagram or a Markdown / text file (or paste / drop it)","aria-label":"Attach a diagram or text file",children:i.jsx(Vc,{})}),i.jsxs("select",{className:"canvas-builder",value:mt,onChange:N=>_e(N.target.value),disabled:ve,"aria-label":"Model that builds the threat model",children:[!ze.length&&i.jsx("option",{value:"",children:Oe?"No vision model available":"No models"}),ze.map(N=>{var Z;return i.jsxs("option",{value:N.id,children:[N.name,(Z=N.input_modalities)!=null&&Z.includes("image")?" · vision":""]},N.id)})]}),(ne||re.attachError)&&i.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:ne??re.attachError}),i.jsx("div",{className:"spacer"}),ve?i.jsx("button",{className:"send-btn stop",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},title:"Stop",children:"■"}):i.jsx("button",{className:"btn primary sm",onClick:Ve,disabled:!Q.trim()&&!re.images.length&&!re.docs.length||re.reading||!mt,children:u.nodes.length?"rebuild":"build"})]})]}),i.jsx("div",{className:"composer-hint",children:ve?"Building the threat model… (reasoning models can take several minutes on a big diagram)":"Each build starts a new saved canvas; undo brings the previous one back. Saved on the runner, encrypted with your vault."})]})]})}function Ck({list:l,activeId:o,onOpen:c,onDelete:u}){const[d,h]=A.useState(null);return A.useEffect(()=>{if(!d)return;const m=setTimeout(()=>h(null),3e3);return()=>clearTimeout(m)},[d]),l.length?i.jsx("div",{className:"session-list",children:l.map(m=>i.jsxs("div",{className:"session-item"+(m.id===o?" on":""),children:[i.jsxs("button",{className:"session-open",onClick:()=>c(m.id),title:m.title,children:[i.jsx("span",{className:"session-title",children:m.title||"Untitled threat model"}),i.jsx("span",{className:"session-meta",children:new Date(m.updatedAt).toLocaleString()})]}),i.jsx("button",{className:"session-del"+(d===m.id?" confirm":""),onClick:()=>{if(d!==m.id)return h(m.id);h(null),u(m.id)},title:d===m.id?"Click again to delete":"Delete canvas","aria-label":d===m.id?"Confirm delete":"Delete canvas",children:d===m.id?"Delete?":"✕"})]},m.id))}):i.jsx("div",{className:"hint",children:"No saved canvases yet. Build one and it saves itself."})}function O0({ownerId:l,findings:o,onFinding:c,onAddFinding:u,onRemoveFinding:d}){const[h,m]=A.useState(""),[y,v]=A.useState("medium");return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"section-title",children:["Findings (",o.length,")"]}),o.map(S=>i.jsxs("div",{className:"canvas-finding",children:[i.jsxs("div",{className:"cf-head",children:[i.jsx("span",{className:"sev-pill",style:{background:Ro[S.severity]},children:S.severity}),i.jsx("span",{className:"cf-title",children:S.title}),i.jsx("button",{className:"attach-x",onClick:()=>d(S.id),"aria-label":"Remove finding",children:"✕"})]}),S.fix&&i.jsxs("div",{className:"cf-fix",children:["Fix: ",S.fix]}),S.ref&&i.jsx("div",{className:"cf-ref",children:S.ref}),i.jsxs("div",{className:"cf-controls",children:[i.jsx("select",{value:S.severity,onChange:g=>c(S.id,{severity:g.target.value}),"aria-label":"Severity",children:Pf.map(g=>i.jsx("option",{value:g,children:g},g))}),i.jsxs("select",{value:S.status,onChange:g=>c(S.id,{status:g.target.value}),"aria-label":"Status",children:[i.jsx("option",{value:"open",children:"open"}),i.jsx("option",{value:"fixed",children:"fixed"}),i.jsx("option",{value:"verified",children:"verified (retested)"})]})]})]},S.id)),i.jsxs("div",{className:"cf-add",children:[i.jsx("input",{type:"text",placeholder:"Add a finding…",value:h,onChange:S=>m(S.target.value)}),i.jsx("select",{value:y,onChange:S=>v(S.target.value),children:Pf.map(S=>i.jsx("option",{value:S,children:S},S))}),i.jsx("button",{className:"btn mini",disabled:!h.trim(),onClick:()=>{u({id:`${l}-f${Date.now().toString(36)}`,title:h.trim(),severity:y,status:"open"}),m("")},children:"add"})]})]})}function Mk({node:l,others:o,onChange:c,onFinding:u,onAddFinding:d,onRemoveFinding:h,onAddFlow:m,onDelete:y}){const[v,S]=A.useState(""),[g,b]=A.useState("data");return i.jsxs("div",{className:"canvas-inspector",children:[i.jsx("label",{children:"Component"}),i.jsx("input",{type:"text",value:l.label,onChange:x=>c({label:x.target.value})}),i.jsx("label",{children:"Kind"}),i.jsx("select",{value:l.kind,onChange:x=>c({kind:x.target.value}),children:Tk.map(x=>i.jsx("option",{value:x,children:x},x))}),i.jsxs("label",{className:"check",children:[i.jsx("input",{type:"checkbox",checked:l.inScope,onChange:x=>c({inScope:x.target.checked})})," In scope"]}),i.jsxs("label",{className:"check",children:[i.jsx("input",{type:"checkbox",checked:l.tested,onChange:x=>c({tested:x.target.checked})})," Tested"]}),l.details.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"section-title",children:"Details"}),i.jsx("ul",{className:"canvas-details",children:l.details.map((x,k)=>i.jsx("li",{children:x},k))})]}),i.jsx(O0,{ownerId:l.id,findings:l.findings,onFinding:u,onAddFinding:d,onRemoveFinding:h}),o.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"section-title",children:"Add a flow from here"}),i.jsxs("div",{className:"cf-add",children:[i.jsxs("select",{value:v,onChange:x=>S(x.target.value),"aria-label":"Flow goes to",children:[i.jsx("option",{value:"",children:"to…"}),o.map(x=>i.jsx("option",{value:x.id,children:x.label},x.id))]}),i.jsx("select",{value:g,onChange:x=>b(x.target.value),"aria-label":"Flow type",children:Ti.map(x=>i.jsx("option",{value:x,children:Uo[x]},x))}),i.jsx("button",{className:"btn mini",disabled:!v,onClick:()=>{m(v,g),S("")},children:"add"})]})]}),i.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete component"})]})}function _k({edge:l,fromLabel:o,toLabel:c,onChange:u,onFinding:d,onAddFinding:h,onRemoveFinding:m,onDelete:y}){const v=l.encrypted===!0?"yes":l.encrypted===!1?"no":"unknown";return i.jsxs("div",{className:"canvas-inspector",children:[i.jsx("label",{children:"Flow"}),i.jsxs("div",{className:"cf-route",title:`${o} → ${c}`,children:[o," ",i.jsx("span",{className:"muted",children:"→"})," ",c]}),i.jsx("label",{children:"Label"}),i.jsx("input",{type:"text",value:l.label??"",placeholder:"what it carries",onChange:S=>u({label:S.target.value||void 0})}),i.jsx("label",{children:"Type"}),i.jsx("select",{value:l.kind??"data",onChange:S=>u({kind:S.target.value}),children:Ti.map(S=>i.jsx("option",{value:S,children:Uo[S]},S))}),i.jsx("label",{children:"Encrypted"}),i.jsxs("select",{value:v,onChange:S=>u({encrypted:S.target.value==="yes"?!0:S.target.value==="no"?!1:void 0}),children:[i.jsx("option",{value:"unknown",children:"not stated"}),i.jsx("option",{value:"yes",children:"yes"}),i.jsx("option",{value:"no",children:"no (plaintext)"})]}),i.jsx("label",{children:"Protocol"}),i.jsx("input",{type:"text",value:l.protocol??"",placeholder:"not stated",onChange:S=>u({protocol:S.target.value||void 0})}),i.jsx("label",{children:"Authentication"}),i.jsx("input",{type:"text",value:l.auth??"",placeholder:"not stated",onChange:S=>u({auth:S.target.value||void 0})}),i.jsxs("label",{className:"check",title:"Not drawn in the source, but implied by its labels",children:[i.jsx("input",{type:"checkbox",checked:l.implied===!0,onChange:S=>u({implied:S.target.checked||void 0})})," Implied (not drawn in the source)"]}),i.jsx(O0,{ownerId:l.id,findings:l.findings??[],onFinding:d,onAddFinding:h,onRemoveFinding:m}),i.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete flow"})]})}const Rk={done:"the executor reported the in-scope surface exhausted",idle:"a round found nothing new",budget:"the token budget is spent",rounds:"the round limit was reached",stuck:"the executor stayed stuck, even after escalating","rate-limited":"every model is rate-limited",error:"a round failed",aborted:"stopped by you"};function Ok({onStart:l,onClose:o}){const[c,u]=A.useState(""),[d,h]=A.useState("Map the attack surface and test access control, authentication and injection, one hypothesis at a time."),[m,y]=A.useState("staging"),[v,S]=A.useState(""),[g,b]=A.useState(""),[x,k]=A.useState(!1),[D,V]=A.useState(!1),[L,K]=A.useState(null),ce=c.trim()&&d.trim()&&v.trim()&&x&&!D;async function de(){V(!0),K(null);try{const E=g.split(",").map(G=>G.trim()).filter(Boolean);await l({scope:c.trim(),objective:d.trim(),env:{kind:m,divergences:v.trim(),...E.length?{nonProdSettings:E}:{}}}),o()}catch(E){K(E.message),V(!1)}}return i.jsxs(ks,{title:"recon --supervised",onClose:D?void 0:o,children:[i.jsx("p",{children:"The agent tests one target round after round: it enumerates, forms a hypothesis, probes it and hands candidates to a verifier. Read-only requests to the target run on their own; anything else waits for your approval."}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"recon-scope",children:"Target (one host or URL)"}),i.jsx("input",{id:"recon-scope",type:"text",className:"mono",autoFocus:!0,spellCheck:!1,placeholder:"https://staging.example.com",value:c,onChange:E=>u(E.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"recon-objective",children:"Objective"}),i.jsx("textarea",{id:"recon-objective",rows:3,value:d,onChange:E=>h(E.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"recon-kind",children:"Environment"}),i.jsxs("select",{id:"recon-kind",value:m,onChange:E=>y(E.target.value),children:[i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"staging",children:"staging"}),i.jsx("option",{value:"production",children:"production"})]})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"recon-div",children:"How it differs from production"}),i.jsx("textarea",{id:"recon-div",rows:2,placeholder:"e.g. seed data, SSO replaced by a test login; or: none, this is production",value:v,onChange:E=>S(E.target.value)})]}),i.jsxs("div",{className:"field",children:[i.jsx("label",{htmlFor:"recon-settings",children:"Non-production settings (optional, comma-separated)"}),i.jsx("input",{id:"recon-settings",type:"text",className:"mono",spellCheck:!1,placeholder:"DEBUG=1, AUTH_DISABLED",value:g,onChange:E=>b(E.target.value)})]}),i.jsxs("label",{className:"recon-consent",children:[i.jsx("input",{type:"checkbox",checked:x,onChange:E=>k(E.target.checked)}),i.jsx("span",{children:"I am authorised to test this target, and it is the only one in scope."})]}),L&&i.jsx("div",{className:"hint danger",children:L}),i.jsxs("div",{className:"perm-actions recon-actions",children:[i.jsx("button",{className:"btn primary sm",disabled:!ce,onClick:de,children:D?"starting…":"start recon"}),i.jsx("button",{className:"btn sm",disabled:D,onClick:o,children:"cancel"})]})]})}function Dk({recon:l,onStop:o,onDismiss:c}){const u=l.status==="running";return i.jsxs("div",{className:"recon-strip"+(u?" live":""),role:"status",children:[i.jsx("span",{className:"recon-name",children:"recon"}),i.jsx("span",{className:"mono",title:l.objective,children:l.scope}),i.jsxs("span",{children:["round ",u?l.rounds+1:l.rounds,"/",l.maxRounds]}),i.jsxs("span",{children:[Ai(l.tokens),"/",Ai(l.budgetTokens)," tokens"]}),u&&l.model&&i.jsx("span",{title:`profile ${l.profile}`,children:l.model}),i.jsxs("span",{title:"Approvals the gate answered itself, and the ones it left for you",children:["auto-allowed ",l.gate.allowed," · asked ",l.gate.asked," · blocked ",l.gate.denied]}),u?i.jsx("button",{className:"btn sm danger-outline",onClick:o,children:"stop"}):i.jsxs(i.Fragment,{children:[i.jsxs("span",{className:"recon-end",children:["ended: ",l.stopped?Rk[l.stopped]:"finished"]}),i.jsx("button",{className:"link-btn",onClick:c,children:"dismiss"})]})]})}function Lk({recon:l}){return l.status==="running"&&!l.findings.length?null:i.jsxs("div",{className:"recon-findings",children:[i.jsxs("div",{className:"perm-title recon-title",children:["Recon findings (",l.findings.length,") · ",l.env.kind]}),l.error&&i.jsx("div",{className:"hint danger",children:l.error}),!l.findings.length&&i.jsx("div",{className:"hint",children:"The verifier confirmed no findings in this run."}),l.findings.map((o,c)=>i.jsx(zk,{f:o},c))]})}function zk({f:l}){return i.jsxs("div",{className:"recon-finding",children:[i.jsxs("div",{className:"recon-finding-head",children:[i.jsx("span",{className:`badge sev-${l.severity}`,children:l.severity}),i.jsx("span",{className:"recon-finding-title",children:l.title}),l.standardId&&i.jsx("span",{className:"badge",children:l.standardId}),l.verdict==="config-dependent"&&i.jsx("span",{className:"badge sev-medium",children:"config-dependent"})]}),i.jsx("pre",{className:"recon-repro",children:l.repro}),l.prodCaveat&&i.jsxs("div",{className:"hint",children:["Re-test against production: ",l.prodCaveat]})]})}const $c=[{name:"new",description:"Start a new session",hint:""},{name:"compact",description:"Summarise the conversation to free up context",hint:""},{name:"model",description:"Switch model, e.g. /model kimi",hint:"<name>"},{name:"plan",description:"Switch to the read-only plan agent",hint:""},{name:"build",description:"Switch to the build agent",hint:""},{name:"help",description:"List available commands",hint:""}],Uk=25*1024*1024,Cv=30*1024*1024,D0="or_cmd_history";function Hk(){try{const l=localStorage.getItem(D0);if(l)return JSON.parse(l)}catch{}return[]}function Bk({agent:l,setAgent:o,model:c,setModel:u,models:d,commands:h,busy:m,onSend:y,onStop:v,draft:S,onDraftUsed:g}){var mt;const[b,x]=A.useState(""),[k,D]=A.useState([]),[V,L]=A.useState(null),[K,ce]=A.useState(!1),[de,E]=A.useState(0),G=A.useRef(null),H=A.useRef(null),[Y,F]=A.useState(!1),ie=A.useRef(null);function X(){var he,Be;if(Y){(he=ie.current)==null||he.stop();return}const O=b.trim(),we=Hv({onStart:()=>F(!0),onEnd:()=>{F(!1),ie.current=null},onPartial:Ee=>x(O?O+" "+Ee:Ee)});ie.current=we,(Be=G.current)==null||Be.focus()}const[P,Q]=A.useState(Hk),me=A.useRef(-1),ve=A.useRef("");function Ce(O){O.trim()&&Q(we=>{const he=(we[we.length-1]===O?we:[...we,O]).slice(-200);try{localStorage.setItem(D0,JSON.stringify(he))}catch{}return he})}function ne(){requestAnimationFrame(()=>{const O=G.current;O&&(O.selectionStart=O.selectionEnd=O.value.length)})}const te=()=>{const O=G.current;return!O||!O.value.slice(0,O.selectionStart??0).includes(`
297
- `)},re=()=>{const O=G.current;return!O||!O.value.slice(O.selectionEnd??0).includes(`
298
- `)};function ee(O){if(!P.length)return!1;if(me.current===-1){if(O===1)return!1;ve.current=b,me.current=P.length-1}else{const we=me.current+O;if(we<0)return!0;if(we>=P.length)return me.current=-1,x(ve.current),ne(),!0;me.current=we}return x(P[me.current]),ne(),!0}A.useEffect(()=>{var O;S!==null&&(x(S),g(),(O=G.current)==null||O.focus())},[S,g]),A.useEffect(()=>{const O=G.current;O&&(O.style.height="auto",O.style.height=Math.min(O.scrollHeight,260)+"px")},[b]);function ke(O){var he;O.target.closest("button, select, input, textarea, a")||(he=G.current)==null||he.focus()}const Ze=A.useMemo(()=>{const O=new Set($c.map(we=>we.name));return[...$c,...h.filter(we=>!O.has(we.name))]},[h]),bt=(mt=/^\/(\S*)$/.exec(b))==null?void 0:mt[1],kt=bt!==void 0?Ze.filter(O=>O.name.startsWith(bt.toLowerCase())):[],j=kt.length>0;A.useEffect(()=>E(0),[bt]);function ae(O){var we;O.hint?(x(`/${O.name} `),(we=G.current)==null||we.focus()):Ie(`/${O.name}`)}async function je(O){L(null);const we=[];let he=k.reduce((Be,Ee)=>Be+Ee.size,0);for(const Be of Array.from(O)){if(Be.size>Uk){L(`${Be.name} is over 25 MB.`);continue}if(he+Be.size>Cv){L(`Attachments are limited to ${zo(Cv)} per message; ${Be.name} doesn't fit.`);continue}he+=Be.size;const Ee=await Ik(Be);we.push({name:Be.name||`pasted-${Date.now()}.${(Be.type.split("/")[1]||"bin").replace(/\W/g,"")}`,mime:Be.type||"application/octet-stream",size:Be.size,data:Ee.slice(Ee.indexOf(",")+1),preview:Be.type.startsWith("image/")?Ee:void 0})}D(Be=>[...Be,...we])}function pe(O){const we=Array.from(O.clipboardData.files);we.length&&(O.preventDefault(),je(we))}function Ie(O=b){!O.trim()&&!k.length||(Ce(O),me.current=-1,y(O,k),x(""),D([]),L(null))}function Oe(O){if(j){if(O.key==="ArrowDown"){O.preventDefault(),E(we=>(we+1)%kt.length);return}if(O.key==="ArrowUp"){O.preventDefault(),E(we=>(we-1+kt.length)%kt.length);return}if(O.key==="Tab"||O.key==="Enter"&&!O.shiftKey){O.preventDefault(),ae(kt[de]);return}if(O.key==="Escape"){O.preventDefault(),x("");return}}if(O.key==="ArrowUp"&&te()&&ee(-1)){O.preventDefault();return}if(O.key==="ArrowDown"&&me.current!==-1&&re()&&ee(1)){O.preventDefault();return}O.key==="Enter"&&!O.shiftKey&&(O.preventDefault(),Ie())}const ze=d.find(O=>O.id===c),Se=A.useMemo(()=>{const O=new Map;for(const we of d)O.set(we.provider,[...O.get(we.provider)??[],we]);return[...O.entries()]},[d]),_e=k.some(O=>O.mime.startsWith("image/"));return i.jsxs("div",{className:"composer-wrap",children:[j&&i.jsx("div",{className:"slash-menu",role:"listbox",children:kt.map((O,we)=>i.jsxs("button",{role:"option","aria-selected":we===de,className:"slash-item"+(we===de?" on":""),onMouseEnter:()=>E(we),onMouseDown:he=>{he.preventDefault(),ae(O)},children:[i.jsxs("span",{className:"slash-name mono",children:["/",O.name,O.hint?i.jsxs("span",{className:"slash-hint",children:[" ",O.hint]}):null]}),i.jsx("span",{className:"slash-desc",children:O.description})]},O.name))}),i.jsxs("div",{className:"composer-box"+(K?" dragging":""),onClick:ke,onDragOver:O=>{O.dataTransfer.types.includes("Files")&&(O.preventDefault(),ce(!0))},onDragLeave:()=>ce(!1),onDrop:O=>{O.preventDefault(),ce(!1),O.dataTransfer.files.length&&je(O.dataTransfer.files)},children:[k.length>0&&i.jsx("div",{className:"attach-row",children:k.map((O,we)=>i.jsxs("span",{className:"attach-chip",title:`${O.name} · ${zo(O.size)}`,children:[O.preview?i.jsx("img",{src:O.preview,alt:""}):i.jsx("span",{className:"attach-icon",children:i.jsx(fh,{})}),i.jsx("span",{className:"attach-name",children:O.name}),i.jsx("button",{className:"attach-x",onClick:()=>D(he=>he.filter((Be,Ee)=>Ee!==we)),"aria-label":`Remove ${O.name}`,children:"✕"})]},we))}),i.jsx("textarea",{ref:G,value:b,onChange:O=>{x(O.target.value),me.current=-1},onKeyDown:Oe,onPaste:pe,rows:3,placeholder:Y?"Listening…":l==="build"?"Ask BugXHunter to change something… (/ for commands)":"Ask BugXHunter to plan or explain… (/ for commands)"}),i.jsxs("div",{className:"composer-bar",children:[i.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var O;return(O=H.current)==null?void 0:O.click()},title:"Attach files (or paste / drop them)","aria-label":"Attach files",children:i.jsx(Vc,{size:20})}),i.jsx("input",{ref:H,type:"file",multiple:!0,hidden:!0,onChange:O=>{O.target.files&&je(O.target.files),O.target.value=""}}),i.jsx("div",{className:"agent-switch",role:"tablist",children:["build","plan"].map(O=>i.jsx("button",{className:"seg"+(l===O?" on":""),onClick:()=>o(O),disabled:m,children:O},O))}),i.jsxs("select",{className:"model-select",value:c,onChange:O=>u(O.target.value),disabled:m,title:"Model",children:[!ze&&i.jsx("option",{value:c,children:c}),Se.map(([O,we])=>i.jsx("optgroup",{label:O,children:we.map(he=>i.jsxs("option",{value:he.id,children:[he.name,he.images?" · sees images":"",he.output?` · ${Ai(he.output)} out`:""]},he.id))},O))]}),i.jsx("div",{className:"spacer"}),nh()&&i.jsx("button",{className:"send-btn mic"+(Y?" stop":""),onClick:X,disabled:m,title:Y?"Stop dictation":"Dictate","aria-label":Y?"Stop dictation":"Dictate",children:Y?"●":"🎤"}),m?i.jsx("button",{className:"send-btn stop",onClick:v,title:"Stop",children:"■"}):i.jsx("button",{className:"send-btn",onClick:()=>Ie(),disabled:!b.trim()&&!k.length,title:"Send (Enter)",children:"↑"})]})]}),i.jsx("div",{className:"composer-hint",children:V?i.jsx("span",{className:"danger",children:V}):_e&&ze&&!ze.images?i.jsxs("span",{className:"warn",children:[ze.name," can't see images — it gets the saved file only. Pick a model marked “sees images” to let it look."]}):"Enter to send · Shift+Enter new line · / commands · paste or drop files"})]})}function Ik(l){return new Promise((o,c)=>{const u=new FileReader;u.onload=()=>o(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(l)})}const qk={completed:"✓",in_progress:"◐",pending:"○",cancelled:"✕"};function $k({todos:l}){const[o,c]=A.useState(!0);if(!l.length)return null;const u=l.filter(h=>h.status==="completed").length,d=l.find(h=>h.status==="in_progress");return i.jsxs("div",{className:"todo-panel",children:[i.jsxs("button",{className:"todo-head",onClick:()=>c(h=>!h),"aria-expanded":o,children:[i.jsx("span",{className:"chev"+(o?" open":""),children:"›"}),i.jsx("span",{className:"todo-title",children:"Tasks"}),i.jsxs("span",{className:"todo-count",children:[u,"/",l.length]}),i.jsx("span",{className:"todo-bar",children:i.jsx("span",{style:{width:`${u/l.length*100}%`}})}),!o&&d&&i.jsx("span",{className:"todo-current",children:d.content})]}),o&&i.jsx("ul",{className:"todo-list",children:l.map((h,m)=>i.jsxs("li",{className:"todo s-"+h.status,children:[i.jsx("span",{className:"todo-icon","aria-hidden":!0,children:qk[h.status]??"○"}),i.jsx("span",{className:"todo-text",children:h.content}),h.priority==="high"&&h.status!=="completed"&&i.jsx("span",{className:"todo-prio",children:"high"})]},m))})]})}function Gk(l){var u,d;const o=[];let c=!1;for(const h of l.split(`
299
- `)){const m=h.replace(/\r$/,"");if(m.startsWith("@@")){o.push(null),c=!0;continue}!c||m.startsWith("\\")||(m.startsWith("+")?o.push({kind:"add",text:m.slice(1)}):m.startsWith("-")?o.push({kind:"del",text:m.slice(1)}):o.push({kind:"same",text:m.slice(1)}))}return o[0]===null&&o.shift(),o.length&&((u=o[o.length-1])==null?void 0:u.kind)==="same"&&((d=o[o.length-1])==null?void 0:d.text)===""&&o.pop(),o}function Xk(l,o){const c=l?l.split(`
295
+ ${l.trim()}`:"";return`Build the threat model JSON for ${c}.${u}`}const _o=()=>crypto.randomUUID().toLowerCase(),Kc=l=>`/api/playground/sessions/${l}`;async function Zc(l,o){var u,d;if(l.ok)return l.json();let c="";try{c=((d=(u=await l.json())==null?void 0:u.error)==null?void 0:d.message)??""}catch{}throw new Error(c||`${o} failed (${l.status})`)}const Cc=l=>fetch(Kc(l)).then(o=>Zc(o,"Listing saved sessions")).then(o=>o.sessions),Pf=(l,o)=>fetch(`${Kc(l)}/${o}`).then(c=>Zc(c,"Opening the session")),Mc=(l,o,c,u)=>fetch(`${Kc(l)}/${o}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:c,body:u})}).then(d=>Zc(d,"Saving")),M0=(l,o)=>fetch(`${Kc(l)}/${o}`,{method:"DELETE"}).then(c=>Zc(c,"Deleting")),jv="or_threat_model",kk=1200,_0="or_canvas_panel",Nv="or_canvas_build_box",R0=340,O0=260,D0=640;function jk(){try{const l=JSON.parse(localStorage.getItem(_0)??"null");if(l&&typeof l.width=="number")return{width:Math.min(D0,Math.max(O0,l.width)),collapsed:l.collapsed===!0}}catch{}return{width:R0,collapsed:!1}}const Ev={actor:"#00e5ff",service:"#8fa8ff",ai:"#c58cff",datastore:"#ffb300",external:"#b4bcc6"},Ro={critical:"#ff3c3c",high:"#ff7a45",medium:"#ffb300",low:"#6e7681"},Ff=["critical","high","medium","low"],Nk=["actor","service","ai","datastore","external"],bi={data:"#9aa4b2",management:"#c792ea",attestation:"#e3b341",identity:"#3fb950",control:"#58a6ff",blocked:"#5c6370"},Jf="#ff3c3c";function Ek(l,o){const c=(l.x??0)+Wn/2,u=(l.y??0)+rl/2,d=(o.x??0)+Wn/2,h=(o.y??0)+rl/2;if(Math.abs(d-c)>Wn){const b=d>c?1:-1,x=c+b*Wn/2,k=d-b*(Wn/2+2),L=Math.max(40,Math.abs(k-x)/2)*b;return{d:`M${x},${u} C${x+L},${u} ${k-L},${h} ${k},${h}`,ax:x,ay:u,ex:k,ey:h}}const m=d-c,y=h-u,v=Math.min(Math.abs(Wn/2/(m||1e-6)),Math.abs(rl/2/(y||1e-6)),1),S=d-m*v,g=h-y*v;return{d:`M${c},${u} L${S},${g}`,ax:c,ay:u,ex:S,ey:g}}function Ck(l){const o=l.encrypted===!1,c=o?Jf:bi[l.kind??"data"],u=l.kind==="blocked"?"2 5":o?"7 5":l.implied?"4 4":void 0;return{plain:o,color:c,dash:u,opacity:l.implied?.6:1,marker:o?"tm-arrow-plain":`tm-arrow-${l.kind??"data"}`}}const Mk=(l,o)=>l.length>o?l.slice(0,o-1)+"…":l;function Tc(l,o,c){const u=URL.createObjectURL(new Blob([o],{type:c})),d=document.createElement("a");d.href=u,d.download=l,d.click(),URL.revokeObjectURL(u)}function _k({config:l,models:o,onExit:c}){var hl,ja,ha;const[u,d]=A.useState(Sc),[h,m]=A.useState(_o),[y,v]=A.useState(null),[S,g]=A.useState([]),[b,x]=A.useState(null),[k,L]=A.useState(!1),V=A.useRef(""),[z,Z]=A.useState(null),[oe,de]=A.useState(null),[C,Y]=A.useState(jk);A.useEffect(()=>{try{localStorage.setItem(_0,JSON.stringify(C))}catch{}},[C]);const[O,X]=A.useState(()=>{try{return localStorage.getItem(Nv)==="hidden"}catch{return!1}});A.useEffect(()=>{try{localStorage.setItem(Nv,O?"hidden":"shown")}catch{}},[O]);const[F,ie]=A.useState(!1);A.useEffect(()=>{var ct,at,Nt;if(!F)return;let N=!1;const P=()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{})};(at=(ct=document.documentElement).requestFullscreen)==null||at.call(ct).then(()=>{N&&P()}).catch(()=>{});const ge=[];for(let lt=G.current;lt!=null&&lt.parentElement&&lt.parentElement!==document.body;lt=lt.parentElement)for(const Bt of Array.from(((Nt=lt.parentElement)==null?void 0:Nt.children)??[]))Bt!==lt&&!Bt.hasAttribute("inert")&&(Bt.setAttribute("inert",""),ge.push(Bt));const xe=lt=>{var In;if(lt.key!=="Escape"||lt.defaultPrevented||lt.isComposing)return;const Bt=lt.target;(In=Bt==null?void 0:Bt.closest)!=null&&In.call(Bt,"input, textarea, select, [contenteditable]")||document.querySelector(".overlay")||ie(!1)},et=()=>{document.fullscreenElement||ie(!1)};return window.addEventListener("keydown",xe),document.addEventListener("fullscreenchange",et),()=>{N=!0,window.removeEventListener("keydown",xe),document.removeEventListener("fullscreenchange",et);for(const lt of ge)lt.removeAttribute("inert");P()}},[F]);const G=A.useRef(null);function Q(N){var ct;N.preventDefault();const P=N.currentTarget;P.setPointerCapture(N.pointerId),document.body.classList.add("resizing");const ge=((ct=G.current)==null?void 0:ct.getBoundingClientRect().right)??window.innerWidth,xe=at=>Y(Nt=>({...Nt,width:Math.round(Math.min(D0,Math.max(O0,ge-at.clientX)))})),et=()=>{P.removeEventListener("pointermove",xe),P.removeEventListener("pointerup",et),document.body.classList.remove("resizing")};P.addEventListener("pointermove",xe),P.addEventListener("pointerup",et)}const[K,me]=A.useState(""),[ve,Ce]=A.useState(!1),[ne,te]=A.useState(null),ce=yh(),ee=A.useRef(null),ke=A.useRef(null),Ze=A.useRef(null),bt=A.useRef(null),kt=()=>Cc("canvas").then(g).catch(N=>x({ok:!1,text:String(N.message??N)}));function j(N,P,ge){d(N),m(P),Z(null),de(null),An(null),V.current=ge?JSON.stringify(N):""}A.useEffect(()=>{let N=!0;return(async()=>{try{let P=null;try{P=localStorage.getItem(jv)}catch{}if(P){const xe=Vl(ko(JSON.parse(P)));xe.nodes.length&&await Mc("canvas",_o(),xe.title,xe);try{localStorage.removeItem(jv)}catch{}}const ge=await Cc("canvas");if(!N)return;if(g(ge),ge[0]){const xe=await Pf("canvas",ge[0].id);N&&j(Vl(ko(xe.body)),ge[0].id,!0)}}catch(P){N&&x({ok:!1,text:`Saved canvases unavailable: ${String(P.message??P)}`})}finally{N&&L(!0)}})(),()=>{N=!1}},[]),A.useEffect(()=>{if(!k||!u.nodes.length)return;const N=JSON.stringify(u);if(N===V.current)return;const P=setTimeout(()=>{Mc("canvas",h,u.title,u).then(()=>(V.current=N,x({ok:!0,text:"Saved, encrypted with your vault"}),Cc("canvas").then(g))).catch(ge=>x({ok:!1,text:`Not saved: ${String(ge.message??ge)}`}))},kk);return()=>clearTimeout(P)},[u,h,k]);async function ae(N){try{const P=await Pf("canvas",N);v(null),j(Vl(ko(P.body)),N,!0)}catch(P){x({ok:!1,text:String(P.message??P)})}}async function je(N){try{await M0("canvas",N),N===h&&j(Sc(),_o(),!1),await kt()}catch(P){x({ok:!1,text:String(P.message??P)})}}const pe=o.filter(Lc),Ie=pe.filter(N=>{var P;return(P=N.input_modalities)==null?void 0:P.includes("image")}),Oe=ce.images.length>0,ze=Oe?Ie:pe,[Se,_e]=A.useState(l.model),mt=ze.some(N=>N.id===Se)?Se:((hl=ze[0])==null?void 0:hl.id)??"",D=pk(u),we=u.nodes.find(N=>N.id===z)??null,he=u.edges.find(N=>N.id===oe)??null;function Be(N){u.nodes.length&&JSON.stringify(u)!==V.current&&Mc("canvas",h,u.title,u).catch(()=>{}),v({model:u,id:h}),j(N,_o(),!1)}const Ee=(N,P)=>d(ge=>({...ge,nodes:ge.nodes.map(xe=>xe.id===N?{...xe,...P}:xe)})),le=(N,P,ge)=>d(xe=>({...xe,nodes:xe.nodes.map(et=>et.id===N?{...et,findings:et.findings.map(ct=>ct.id===P?{...ct,...ge}:ct)}:et)}));function Te(){const N=`component-${Date.now().toString(36)}`;d(P=>Vl({...P,nodes:[...P.nodes,{id:N,label:"New component",kind:"service",details:[],inScope:!0,tested:!1,findings:[]}]})),Z(N)}function be(N){d(P=>({...P,nodes:P.nodes.filter(ge=>ge.id!==N),edges:P.edges.filter(ge=>ge.from!==N&&ge.to!==N)})),Z(null)}const qe=(N,P)=>d(ge=>({...ge,edges:ge.edges.map(xe=>xe.id===N?{...xe,...P}:xe)})),q=(N,P,ge)=>d(xe=>({...xe,edges:xe.edges.map(et=>et.id===N?{...et,findings:et.findings.map(ct=>ct.id===P?{...ct,...ge}:ct)}:et)}));function Re(N,P,ge){const xe=`e-${Date.now().toString(36)}`;d(et=>({...et,edges:[...et.edges,{id:xe,from:N,to:P,kind:ge,findings:[]}]})),Z(null),de(xe)}function He(N){d(P=>({...P,edges:P.edges.filter(ge=>ge.id!==N)})),de(null)}function pt(N,P){N.stopPropagation(),Z(null),de(P)}function Ve(){var ge;if(ve||!K.trim()&&!ce.images.length&&!ce.docs.length||ce.reading||!mt)return;Ce(!0),te(null);const N=new AbortController;bt.current=N;let P="";eh({model:mt,messages:[{role:"system",content:Ak},{role:"user",content:Eh(Tk(K,ce.images.length>0||ce.docs.length>0),ce.images,ce.docs)}],temperature:.2,max_tokens:vk(l.maxTokens,ce.docs.length>0,(ge=pe.find(xe=>xe.id===mt))==null?void 0:ge.max_output_length),reasoning_effort:th(l.reasoningEffort,pe.find(xe=>xe.id===mt)),stream:!0},{signal:N.signal,onDelta:xe=>{P+=xe},onError:xe=>te(xe),onDone:xe=>{if(!P.trim()){te(xe==="length"?"The model used its whole output limit thinking and wrote no threat model. Try again, raise Max tokens, or pick a faster model.":"The model returned no answer. Try again or pick another model.");return}try{const et=Vl(ko(uk(P)));if(!et.nodes.length)throw new Error("The model returned no components.");Be(et),me(""),ce.clear()}catch(et){te(xe==="length"?"The model ran out of output tokens before finishing the threat model. Raise Max tokens or ask for fewer components.":`Couldn't read the model's threat model: ${et.message}`)}}}).catch(xe=>{(xe==null?void 0:xe.name)!=="AbortError"&&te(String((xe==null?void 0:xe.message)??xe))}).finally(()=>{Ce(!1),bt.current=null})}async function ht(N){try{Be(Vl(ko(JSON.parse(await N.text()))))}catch(P){te(`Import failed: ${P.message}`)}}const $e=u.title.replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-|-$/g,"")||"threat-model",[Vt,ea]=A.useState(!1),[fa,gn]=A.useState(!1);A.useEffect(()=>{N0().then(ea)},[]);async function wn(){gn(!0);const N=await E0(yk(u));gn(!1),N.ok?Tc(`${$e}.drawio.svg`,N.r.svg,"image/svg+xml"):x({ok:!1,text:`draw.io export failed: ${N.error}`})}function Bn(){const N=Ze.current;if(!N)return;const P=N.cloneNode(!0);P.setAttribute("xmlns","http://www.w3.org/2000/svg"),P.removeAttribute("class"),P.removeAttribute("style"),P.setAttribute("viewBox",`${nn.x} ${nn.y} ${nn.w} ${nn.h}`),P.setAttribute("width",String(Math.round(nn.w))),P.setAttribute("height",String(Math.round(nn.h))),Tc(`${$e}.svg`,new XMLSerializer().serializeToString(P),"image/svg+xml")}const[ka,An]=A.useState(null),nn=A.useMemo(()=>{if(!u.nodes.length)return{x:0,y:0,w:900,h:520};const N=u.nodes.map(et=>et.x??0),P=u.nodes.map(et=>et.y??0),ge=Math.min(...N)-40,xe=Math.min(...P)-40;return{x:ge,y:xe,w:Math.max(900,Math.max(...N)+Wn+40-ge),h:Math.max(520,Math.max(...P)+rl+40-xe)}},[u.nodes]),yt=ka??nn,Ga=Math.round(nn.w/yt.w*100),yn=A.useRef(nn);yn.current=nn;function vn(N,P,ge){An(xe=>{const et=yn.current,ct=xe??et,at=Math.min(et.w*4,Math.max(et.w/4,ct.w/N)),Nt=ct.w/at,lt=P??ct.x+ct.w/2,Bt=ge??ct.y+ct.h/2;return{x:lt-(lt-ct.x)/Nt,y:Bt-(Bt-ct.y)/Nt,w:at,h:ct.h/Nt}})}function Cn(N,P){const ge=new DOMPoint(N,P).matrixTransform(Ze.current.getScreenCTM().inverse());return{x:ge.x,y:ge.y}}const B=u.nodes.length>0;A.useEffect(()=>{const N=Ze.current;if(!N)return;const P=ge=>{ge.preventDefault();const xe=Cn(ge.clientX,ge.clientY);vn(ge.deltaY<0?1.15:1/1.15,xe.x,xe.y)};return N.addEventListener("wheel",P,{passive:!1}),()=>N.removeEventListener("wheel",P)},[B]);const ue=A.useRef(null),Ae=A.useRef(null),[De,Ye]=A.useState(!1);function Qe(N,P){var xe;N.stopPropagation(),An(yt);const ge=Cn(N.clientX,N.clientY);ue.current={id:P.id,dx:ge.x-(P.x??0),dy:ge.y-(P.y??0)},(xe=Ze.current)==null||xe.setPointerCapture(N.pointerId),Z(P.id),de(null)}function Pe(N){var ge;const P=Ze.current.getBoundingClientRect();Ae.current={cx:N.clientX,cy:N.clientY,start:yt,scale:Math.max(yt.w/P.width,yt.h/P.height)},(ge=Ze.current)==null||ge.setPointerCapture(N.pointerId),Ye(!0)}function jt(N){const P=ue.current;if(P){const xe=Cn(N.clientX,N.clientY);Ee(P.id,{x:Math.round(xe.x-P.dx),y:Math.round(xe.y-P.dy)});return}const ge=Ae.current;ge&&An({...ge.start,x:ge.start.x-(N.clientX-ge.cx)*ge.scale,y:ge.start.y-(N.clientY-ge.cy)*ge.scale})}function Wt(){ue.current=null,Ae.current=null,Ye(!1)}const Mn=new Map(u.nodes.map(N=>[N.id,N]));return s.jsxs("main",{className:"main",children:[s.jsxs(Bo,{title:`bugxhunter@playground: ~/canvas: ${Mk(u.title,40)}`,children:[s.jsxs("span",{className:"status-pill",children:[s.jsx("span",{className:"dot"}),D.components," components · ",D.tested,"/",D.inScope," tested · ",D.open.critical+D.open.high," crit/high open"]}),s.jsx("button",{className:"btn ghost sm",onClick:Te,children:"+ component"}),s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,title:"Lay the canvas out again, left to right along its flows (undo puts it back)",onClick:()=>{v({model:u,id:h}),d(hk(u)),An(null)},children:"tidy"}),s.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;return(N=ke.current)==null?void 0:N.click()},children:"import"}),s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${$e}.json`,JSON.stringify(u,null,2),"application/json"),children:"json"}),s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Tc(`${$e}-findings.md`,gk(u),"text/markdown"),children:"findings.md"}),s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:Bn,children:"svg"}),Vt&&s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length||fa,onClick:wn,title:"An editable diagram: opens in draw.io and its VS Code extension",children:fa?"draw.io…":"draw.io"}),y&&s.jsx("button",{className:"btn ghost sm",onClick:()=>{j(y.model,y.id,!1),v(null)},children:"undo"}),s.jsx("button",{className:"btn ghost sm",disabled:!u.nodes.length,onClick:()=>Be(Sc()),children:"clear"}),s.jsx("button",{className:"btn ghost sm",onClick:()=>{var N;(N=bt.current)==null||N.abort(),c()},children:"back to chat"}),s.jsx("input",{ref:ke,type:"file",accept:"application/json,.json",hidden:!0,onChange:N=>{var ge;const P=(ge=N.target.files)==null?void 0:ge[0];P&&ht(P),N.target.value=""}})]}),s.jsxs("div",{className:"canvas-wrap"+(F?" full":""),ref:G,children:[s.jsxs("div",{className:"canvas-stage grid-bg",onPointerDown:()=>{Z(null),de(null)},children:[(B||F)&&s.jsx("button",{className:"canvas-full-btn"+(F?" on":""),onPointerDown:N=>N.stopPropagation(),onClick:()=>ie(N=>!N),"aria-pressed":F,title:F?"Exit full screen (Esc)":"Full screen","aria-label":F?"Exit full screen":"Full screen",children:s.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:F?s.jsx("path",{d:"M6 2v4H2M10 2v4h4M6 14v-4H2M10 14v-4h4"}):s.jsx("path",{d:"M2 6V2h4M14 6V2h-4M2 10v4h4M14 10v4h-4"})})}),F&&(ve||ne)&&s.jsxs("div",{className:"canvas-full-status"+(ne&&!ve?" failed":""),role:"status",onPointerDown:N=>N.stopPropagation(),children:[ve?"Building the threat model…":ne,ve&&s.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},children:"stop"})]}),B&&s.jsxs("div",{className:"canvas-zoom",onPointerDown:N=>N.stopPropagation(),children:[s.jsx("button",{onClick:()=>vn(1/1.25),title:"Zoom out","aria-label":"Zoom out",children:"−"}),s.jsxs("span",{title:"Zoom (100% = fit)",children:[Ga,"%"]}),s.jsx("button",{onClick:()=>vn(1.25),title:"Zoom in","aria-label":"Zoom in",children:"+"}),s.jsx("button",{onClick:()=>An(null),title:"Fit the whole model",children:"fit"})]}),u.nodes.length?s.jsxs("svg",{ref:Ze,className:"canvas-svg",viewBox:`${yt.x} ${yt.y} ${yt.w} ${yt.h}`,preserveAspectRatio:"xMidYMin meet",onPointerMove:jt,onPointerUp:Wt,onPointerCancel:Wt,style:{cursor:De?"grabbing":void 0},children:[s.jsxs("defs",{children:[[...Ti.map(N=>[`tm-arrow-${N}`,bi[N]]),["tm-arrow-plain",Jf],["tm-arrow-sel","#ffffff"]].map(([N,P])=>s.jsx("marker",{id:N,viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:s.jsx("path",{d:"M0,0 L10,5 L0,10 z",fill:P})},N)),s.jsx("clipPath",{id:"tm-card-clip",children:s.jsx("rect",{width:Wn,height:rl,rx:10})})]}),s.jsx("rect",{x:"-100000",y:"-100000",width:"200000",height:"200000",fill:"#0a0e14",style:{cursor:De?"grabbing":"grab"},onPointerDown:Pe}),u.edges.map(N=>{var zt;const P=Mn.get(N.from),ge=Mn.get(N.to);if(!P||!ge)return null;const{d:xe,ax:et,ay:ct,ex:at,ey:Nt}=Ek(P,ge),lt=Ck(N),Bt=oe===N.id,In=(et+at)/2,Xa=(ct+Nt)/2,Na=[N.label,lt.plain&&!/plain/i.test(N.label??"")?"(plaintext)":"",N.implied?"(implied)":""].filter(Boolean).join(" "),Zl=Math.min(240,Math.max(70,Math.hypot(at-et,Nt-ct)-24)),Ea=Na?Ac(Na,Zl,kv):"",ml=Ea?Zf(Ea,kv)+10:0,Es=Tv(N),Gt=((zt=N.findings)==null?void 0:zt.filter(Ut=>Ut.status==="open").length)??0;return s.jsxs("g",{opacity:lt.opacity,style:{cursor:"pointer"},onPointerDown:Ut=>pt(Ut,N.id),children:[s.jsx("title",{children:`${Uo[N.kind??"data"]} flow${N.implied?" (implied)":""}${Na?`: ${Na}`:""}`}),s.jsx("path",{d:xe,fill:"none",stroke:"transparent",strokeWidth:14}),s.jsx("path",{d:xe,fill:"none",stroke:Bt?"#ffffff":lt.color,strokeWidth:Bt?3:2,strokeDasharray:lt.dash,markerEnd:`url(#${Bt?"tm-arrow-sel":lt.marker})`}),N.kind==="blocked"&&s.jsxs("g",{transform:`translate(${In},${Xa})`,children:[s.jsx("circle",{r:8,fill:"#0a0e14",stroke:bi.blocked,strokeWidth:2}),s.jsx("line",{x1:-5,y1:5,x2:5,y2:-5,stroke:bi.blocked,strokeWidth:2})]}),Ea&&s.jsxs("g",{transform:`translate(${In},${Xa-(N.kind==="blocked"?18:10)})`,children:[s.jsx("rect",{x:-ml/2,y:-9,width:ml,height:15,rx:4,fill:"#0a0e14",opacity:.85}),s.jsx("text",{y:2,fill:lt.plain?"#ff8080":lt.color,fontSize:11,fontFamily:"JetBrains Mono, monospace",textAnchor:"middle",children:Ea})]}),Gt>0&&s.jsxs("g",{transform:`translate(${In+ml/2+4},${Xa-20})`,children:[s.jsx("rect",{width:20,height:16,rx:8,fill:Ro[Es??"low"]}),s.jsx("text",{x:10,y:12,fill:"#0a0e14",fontSize:10,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:Gt})]})]},N.id)}),u.nodes.map(N=>{const P=Tv(N),ge=N.findings.filter(Nt=>Nt.status==="open").length,xe=N.x??0,et=N.y??0,ct=Wn-16-12,at=`${N.kind.toUpperCase()}${N.inScope?"":" · OUT OF SCOPE"}${N.tested?" · TESTED ✓":""}`;return s.jsxs("g",{transform:`translate(${xe},${et})`,opacity:N.inScope?1:.45,style:{cursor:"grab"},onPointerDown:Nt=>Qe(Nt,N),children:[s.jsx("title",{children:[N.label,...N.details].join(`
296
+ `)}),s.jsx("rect",{width:Wn,height:rl,rx:10,fill:"#161b22",stroke:z===N.id?"#ffffff":Ev[N.kind],strokeWidth:z===N.id?2.5:1.5,strokeDasharray:N.inScope?void 0:"5 4"}),s.jsxs("g",{clipPath:"url(#tm-card-clip)",children:[P&&s.jsx("rect",{width:6,height:rl,fill:Ro[P]}),s.jsx("text",{x:16,y:22,fill:"#e6edf3",fontSize:14,fontWeight:700,fontFamily:"Inter, system-ui, sans-serif",children:Ac(N.label,ct-(ge>0?30:0),xk)}),s.jsx("text",{x:16,y:40,fill:Ev[N.kind],fontSize:10,fontFamily:"JetBrains Mono, monospace",children:Ac(at,ct,Sk)}),N.details.slice(0,2).map((Nt,lt)=>s.jsx("text",{x:16,y:58+lt*14,fill:"#8b949e",fontSize:11,fontFamily:"Inter, system-ui, sans-serif",children:Ac(Nt,ct,wk)},lt))]}),ge>0&&s.jsxs("g",{transform:`translate(${Wn-30},8)`,children:[s.jsx("rect",{width:22,height:18,rx:9,fill:Ro[P??"low"]}),s.jsx("text",{x:11,y:13,fill:"#0a0e14",fontSize:11,fontWeight:700,textAnchor:"middle",fontFamily:"Inter, system-ui, sans-serif",children:ge})]})]},N.id)})]}):s.jsx("div",{className:"empty-state center",children:s.jsxs("p",{className:"muted mono",children:["No threat model yet. Attach an architecture diagram or describe the system below, then ",s.jsx("b",{children:"build"}),". Or add components by hand, or import a saved model."]})}),C.collapsed&&s.jsx("button",{className:"sidebar-toggle floating canvas-panel-show",onPointerDown:N=>N.stopPropagation(),onClick:()=>Y(N=>({...N,collapsed:!1})),title:"Show panel","aria-label":"Show panel",children:"«"})]}),!C.collapsed&&s.jsx("div",{className:"splitter canvas-splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize panel",title:"Drag to resize · double-click to reset",onPointerDown:Q,onDoubleClick:()=>Y(N=>({...N,width:R0}))}),s.jsxs("aside",{className:"canvas-panel",hidden:C.collapsed,style:{width:C.width},children:[s.jsxs("div",{className:"canvas-panel-head",children:[s.jsx("span",{className:"section-title",children:we?"Component":he?"Flow":"Canvas"}),s.jsx("button",{className:"sidebar-toggle",onClick:()=>Y(N=>({...N,collapsed:!0})),title:"Hide panel","aria-label":"Hide panel",children:"»"})]}),we?s.jsx(Ok,{node:we,others:u.nodes.filter(N=>N.id!==we.id),onChange:N=>Ee(we.id,N),onFinding:(N,P)=>le(we.id,N,P),onAddFinding:N=>Ee(we.id,{findings:[...we.findings,N]}),onRemoveFinding:N=>Ee(we.id,{findings:we.findings.filter(P=>P.id!==N)}),onAddFlow:(N,P)=>Re(we.id,N,P),onDelete:()=>be(we.id)}):he?s.jsx(Dk,{edge:he,fromLabel:((ja=Mn.get(he.from))==null?void 0:ja.label)??he.from,toLabel:((ha=Mn.get(he.to))==null?void 0:ha.label)??he.to,onChange:N=>qe(he.id,N),onFinding:(N,P)=>q(he.id,N,P),onAddFinding:N=>qe(he.id,{findings:[...he.findings,N]}),onRemoveFinding:N=>qe(he.id,{findings:he.findings.filter(P=>P.id!==N)}),onDelete:()=>He(he.id)}):s.jsxs("div",{className:"canvas-summary",children:[s.jsx("label",{children:"Title"}),s.jsx("input",{type:"text",value:u.title,onChange:N=>d(P=>({...P,title:N.target.value}))}),s.jsx("div",{className:"section-title",children:"Summary"}),s.jsxs("ul",{className:"canvas-stats",children:[s.jsxs("li",{children:[D.components," components, ",D.inScope," in scope"]}),s.jsxs("li",{children:["Coverage: ",D.tested,"/",D.inScope," tested"]}),Ff.map(N=>s.jsxs("li",{children:[s.jsx("span",{className:"sev-dot",style:{background:Ro[N]}}),D.open[N]," ",N," open"]},N)),s.jsxs("li",{children:[D.fixed," fixed or verified"]}),s.jsxs("li",{children:[D.flows," flow",D.flows===1?"":"s",": ",D.plaintextFlows," plaintext, ",D.impliedFlows," implied, ",D.blockedFlows," blocked"]})]}),s.jsx("div",{className:"section-title",children:"Flows"}),s.jsxs("ul",{className:"canvas-legend",children:[Ti.map(N=>s.jsxs("li",{children:[s.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:s.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:bi[N],strokeWidth:"2",strokeDasharray:N==="blocked"?"2 5":void 0})}),Uo[N]," ",s.jsxs("span",{className:"muted",children:["(",D.byKind[N],")"]})]},N)),s.jsxs("li",{children:[s.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:s.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:Jf,strokeWidth:"2",strokeDasharray:"7 5"})}),"Plaintext (any type)"]}),s.jsxs("li",{children:[s.jsx("svg",{width:"34",height:"10","aria-hidden":!0,children:s.jsx("line",{x1:"1",y1:"5",x2:"33",y2:"5",stroke:bi.data,strokeWidth:"2",strokeDasharray:"4 4",opacity:"0.6"})}),"Implied: not drawn in the source"]})]}),s.jsx("p",{className:"hint",children:"Click a component or a flow to edit it and track its findings. Drag components to rearrange."}),s.jsx("div",{className:"section-title",children:"Saved canvases"}),b&&s.jsx("div",{className:"hint",style:{color:b.ok?"var(--muted)":"var(--amber)"},children:b.text}),s.jsx("button",{className:"btn ghost sm block",onClick:()=>Be(Sc()),disabled:!u.nodes.length,children:"+ New canvas"}),s.jsx(Rk,{list:S,activeId:h,onOpen:N=>void ae(N),onDelete:N=>void je(N)})]})]})]}),O?s.jsxs("div",{className:"composer canvas-box-collapsed",children:[s.jsxs("button",{className:"canvas-box-toggle",onClick:()=>X(!1),title:"Show the build box","aria-label":"Show the build box","aria-expanded":!1,children:[s.jsx("span",{"aria-hidden":!0,children:"▴"})," build box"]}),ve?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hint",children:"Building the threat model…"}),s.jsx("button",{className:"btn ghost mini",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},children:"stop"})]}):ne||ce.attachError?s.jsx("span",{className:"hint",style:{color:"var(--amber)"},children:ne??ce.attachError}):null]}):s.jsxs("div",{className:"composer",children:[s.jsxs("div",{className:"composer-box canvas-build-box",onDragOver:N=>N.preventDefault(),onDrop:ce.onDrop,children:[s.jsx("button",{className:"sidebar-toggle canvas-box-hide",onClick:()=>X(!0),title:"Hide the build box","aria-label":"Hide the build box","aria-expanded":!0,children:"▾"}),s.jsx(vh,{images:ce.images,docs:ce.docs,reading:ce.reading,onRemove:ce.remove,onRemoveDoc:ce.removeDoc}),s.jsx("textarea",{value:K,onChange:N=>me(N.target.value),onPaste:ce.onPaste,rows:2,placeholder:"Attach an architecture diagram or a .md / .txt description, or describe the system (components, data stores, flows)…"}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("input",{ref:ee,type:"file",accept:gh,multiple:!0,hidden:!0,onChange:N=>{N.target.files&&ce.addImages(N.target.files),N.target.value=""}}),s.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var N;return(N=ee.current)==null?void 0:N.click()},disabled:ve,title:"Attach a diagram or a Markdown / text file (or paste / drop it)","aria-label":"Attach a diagram or text file",children:s.jsx(Vc,{})}),s.jsxs("select",{className:"canvas-builder",value:mt,onChange:N=>_e(N.target.value),disabled:ve,"aria-label":"Model that builds the threat model",children:[!ze.length&&s.jsx("option",{value:"",children:Oe?"No vision model available":"No models"}),ze.map(N=>{var P;return s.jsxs("option",{value:N.id,children:[N.name,(P=N.input_modalities)!=null&&P.includes("image")?" · vision":""]},N.id)})]}),(ne||ce.attachError)&&s.jsx("span",{className:"hint",style:{color:"var(--amber)",margin:"0 8px"},children:ne??ce.attachError}),s.jsx("div",{className:"spacer"}),ve?s.jsx("button",{className:"send-btn stop",onClick:()=>{var N;return(N=bt.current)==null?void 0:N.abort()},title:"Stop",children:"■"}):s.jsx("button",{className:"btn primary sm",onClick:Ve,disabled:!K.trim()&&!ce.images.length&&!ce.docs.length||ce.reading||!mt,children:u.nodes.length?"rebuild":"build"})]})]}),s.jsx("div",{className:"composer-hint",children:ve?"Building the threat model… (reasoning models can take several minutes on a big diagram)":"Each build starts a new saved canvas; undo brings the previous one back. Saved on the runner, encrypted with your vault."})]})]})}function Rk({list:l,activeId:o,onOpen:c,onDelete:u}){const[d,h]=A.useState(null);return A.useEffect(()=>{if(!d)return;const m=setTimeout(()=>h(null),3e3);return()=>clearTimeout(m)},[d]),l.length?s.jsx("div",{className:"session-list",children:l.map(m=>s.jsxs("div",{className:"session-item"+(m.id===o?" on":""),children:[s.jsxs("button",{className:"session-open",onClick:()=>c(m.id),title:m.title,children:[s.jsx("span",{className:"session-title",children:m.title||"Untitled threat model"}),s.jsx("span",{className:"session-meta",children:new Date(m.updatedAt).toLocaleString()})]}),s.jsx("button",{className:"session-del"+(d===m.id?" confirm":""),onClick:()=>{if(d!==m.id)return h(m.id);h(null),u(m.id)},title:d===m.id?"Click again to delete":"Delete canvas","aria-label":d===m.id?"Confirm delete":"Delete canvas",children:d===m.id?"Delete?":"✕"})]},m.id))}):s.jsx("div",{className:"hint",children:"No saved canvases yet. Build one and it saves itself."})}function L0({ownerId:l,findings:o,onFinding:c,onAddFinding:u,onRemoveFinding:d}){const[h,m]=A.useState(""),[y,v]=A.useState("medium");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"section-title",children:["Findings (",o.length,")"]}),o.map(S=>s.jsxs("div",{className:"canvas-finding",children:[s.jsxs("div",{className:"cf-head",children:[s.jsx("span",{className:"sev-pill",style:{background:Ro[S.severity]},children:S.severity}),s.jsx("span",{className:"cf-title",children:S.title}),s.jsx("button",{className:"attach-x",onClick:()=>d(S.id),"aria-label":"Remove finding",children:"✕"})]}),S.fix&&s.jsxs("div",{className:"cf-fix",children:["Fix: ",S.fix]}),S.ref&&s.jsx("div",{className:"cf-ref",children:S.ref}),s.jsxs("div",{className:"cf-controls",children:[s.jsx("select",{value:S.severity,onChange:g=>c(S.id,{severity:g.target.value}),"aria-label":"Severity",children:Ff.map(g=>s.jsx("option",{value:g,children:g},g))}),s.jsxs("select",{value:S.status,onChange:g=>c(S.id,{status:g.target.value}),"aria-label":"Status",children:[s.jsx("option",{value:"open",children:"open"}),s.jsx("option",{value:"fixed",children:"fixed"}),s.jsx("option",{value:"verified",children:"verified (retested)"})]})]})]},S.id)),s.jsxs("div",{className:"cf-add",children:[s.jsx("input",{type:"text",placeholder:"Add a finding…",value:h,onChange:S=>m(S.target.value)}),s.jsx("select",{value:y,onChange:S=>v(S.target.value),children:Ff.map(S=>s.jsx("option",{value:S,children:S},S))}),s.jsx("button",{className:"btn mini",disabled:!h.trim(),onClick:()=>{u({id:`${l}-f${Date.now().toString(36)}`,title:h.trim(),severity:y,status:"open"}),m("")},children:"add"})]})]})}function Ok({node:l,others:o,onChange:c,onFinding:u,onAddFinding:d,onRemoveFinding:h,onAddFlow:m,onDelete:y}){const[v,S]=A.useState(""),[g,b]=A.useState("data");return s.jsxs("div",{className:"canvas-inspector",children:[s.jsx("label",{children:"Component"}),s.jsx("input",{type:"text",value:l.label,onChange:x=>c({label:x.target.value})}),s.jsx("label",{children:"Kind"}),s.jsx("select",{value:l.kind,onChange:x=>c({kind:x.target.value}),children:Nk.map(x=>s.jsx("option",{value:x,children:x},x))}),s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:l.inScope,onChange:x=>c({inScope:x.target.checked})})," In scope"]}),s.jsxs("label",{className:"check",children:[s.jsx("input",{type:"checkbox",checked:l.tested,onChange:x=>c({tested:x.target.checked})})," Tested"]}),l.details.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"section-title",children:"Details"}),s.jsx("ul",{className:"canvas-details",children:l.details.map((x,k)=>s.jsx("li",{children:x},k))})]}),s.jsx(L0,{ownerId:l.id,findings:l.findings,onFinding:u,onAddFinding:d,onRemoveFinding:h}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"section-title",children:"Add a flow from here"}),s.jsxs("div",{className:"cf-add",children:[s.jsxs("select",{value:v,onChange:x=>S(x.target.value),"aria-label":"Flow goes to",children:[s.jsx("option",{value:"",children:"to…"}),o.map(x=>s.jsx("option",{value:x.id,children:x.label},x.id))]}),s.jsx("select",{value:g,onChange:x=>b(x.target.value),"aria-label":"Flow type",children:Ti.map(x=>s.jsx("option",{value:x,children:Uo[x]},x))}),s.jsx("button",{className:"btn mini",disabled:!v,onClick:()=>{m(v,g),S("")},children:"add"})]})]}),s.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete component"})]})}function Dk({edge:l,fromLabel:o,toLabel:c,onChange:u,onFinding:d,onAddFinding:h,onRemoveFinding:m,onDelete:y}){const v=l.encrypted===!0?"yes":l.encrypted===!1?"no":"unknown";return s.jsxs("div",{className:"canvas-inspector",children:[s.jsx("label",{children:"Flow"}),s.jsxs("div",{className:"cf-route",title:`${o} → ${c}`,children:[o," ",s.jsx("span",{className:"muted",children:"→"})," ",c]}),s.jsx("label",{children:"Label"}),s.jsx("input",{type:"text",value:l.label??"",placeholder:"what it carries",onChange:S=>u({label:S.target.value||void 0})}),s.jsx("label",{children:"Type"}),s.jsx("select",{value:l.kind??"data",onChange:S=>u({kind:S.target.value}),children:Ti.map(S=>s.jsx("option",{value:S,children:Uo[S]},S))}),s.jsx("label",{children:"Encrypted"}),s.jsxs("select",{value:v,onChange:S=>u({encrypted:S.target.value==="yes"?!0:S.target.value==="no"?!1:void 0}),children:[s.jsx("option",{value:"unknown",children:"not stated"}),s.jsx("option",{value:"yes",children:"yes"}),s.jsx("option",{value:"no",children:"no (plaintext)"})]}),s.jsx("label",{children:"Protocol"}),s.jsx("input",{type:"text",value:l.protocol??"",placeholder:"not stated",onChange:S=>u({protocol:S.target.value||void 0})}),s.jsx("label",{children:"Authentication"}),s.jsx("input",{type:"text",value:l.auth??"",placeholder:"not stated",onChange:S=>u({auth:S.target.value||void 0})}),s.jsxs("label",{className:"check",title:"Not drawn in the source, but implied by its labels",children:[s.jsx("input",{type:"checkbox",checked:l.implied===!0,onChange:S=>u({implied:S.target.checked||void 0})})," Implied (not drawn in the source)"]}),s.jsx(L0,{ownerId:l.id,findings:l.findings??[],onFinding:d,onAddFinding:h,onRemoveFinding:m}),s.jsx("button",{className:"btn danger-outline sm",style:{marginTop:14},onClick:y,children:"delete flow"})]})}function z0(l){const o=l??[];return{demonstrated:o.filter(c=>c.status==="demonstrated"),partial:o.filter(c=>c.status==="partial")}}function Lk(l,o){if(!l)return[];const{demonstrated:c,partial:u}=z0(o);return[...c,...u].filter(d=>d.links.includes(l)).map(d=>d.id).filter(d=>!!d)}function zk(l){var c;const o=((c=l.blockedWhy)==null?void 0:c.trim())||"not shown";return l.blockedAt?`Stopped at step ${l.blockedAt}: ${o}`:`Not shown: ${o}`}function Uk(l){const o=l.status==="running";if(o&&l.phase==="chains")return`chaining findings · turn ${(l.chainRounds??0)+1}`;const c=`round ${o?l.rounds+1:l.rounds}/${l.maxRounds}`;return!o&&l.chainRounds?`${c} · ${l.chainRounds} chaining`:c}function Hk(l){var o;if(l.status!=="finished")return null;switch(l.chainPass){case"ran":return(o=l.chains)!=null&&o.length?null:"No attack path was recorded.";case"off":return"Attack paths were not looked for: the chain pass was turned off for this run.";case"skipped":return"Attack paths were not looked for: the run ended before the chain pass.";case"few-findings":return"Attack paths were not looked for: it takes at least two findings to combine.";case"budget":return"Attack paths were not looked for: the token budget was spent.";case"no-paths":return"The findings were reviewed for attack paths and no combination was proposed.";case"rate-limited":return"The chain pass stopped: every model was rate-limited.";case"error":return"The chain pass stopped early. What it had recorded is shown.";default:return null}}const Bk={done:"the executor reported the in-scope surface exhausted",idle:"a round found nothing new",budget:"the token budget is spent",rounds:"the round limit was reached",stuck:"the executor stayed stuck, even after escalating","rate-limited":"every model is rate-limited",error:"a round failed",aborted:"stopped by you"};function Ik({onStart:l,onClose:o}){const[c,u]=A.useState(""),[d,h]=A.useState("Map the attack surface and test access control, authentication and injection, one hypothesis at a time."),[m,y]=A.useState("staging"),[v,S]=A.useState(""),[g,b]=A.useState(""),[x,k]=A.useState(!1),[L,V]=A.useState(!0),[z,Z]=A.useState(!1),[oe,de]=A.useState(null),C=c.trim()&&d.trim()&&v.trim()&&x&&!z;async function Y(){Z(!0),de(null);try{const O=g.split(",").map(X=>X.trim()).filter(Boolean);await l({scope:c.trim(),objective:d.trim(),env:{kind:m,divergences:v.trim(),...O.length?{nonProdSettings:O}:{}},chainPass:{enabled:L}}),o()}catch(O){de(O.message),Z(!1)}}return s.jsxs(ks,{title:"recon --supervised",onClose:z?void 0:o,children:[s.jsx("p",{children:"The agent tests one target round after round: it enumerates, forms a hypothesis, probes it and hands candidates to a verifier. Read-only requests to the target run on their own; anything else waits for your approval."}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"recon-scope",children:"Target (one host or URL)"}),s.jsx("input",{id:"recon-scope",type:"text",className:"mono",autoFocus:!0,spellCheck:!1,placeholder:"https://staging.example.com",value:c,onChange:O=>u(O.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"recon-objective",children:"Objective"}),s.jsx("textarea",{id:"recon-objective",rows:3,value:d,onChange:O=>h(O.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"recon-kind",children:"Environment"}),s.jsxs("select",{id:"recon-kind",value:m,onChange:O=>y(O.target.value),children:[s.jsx("option",{value:"local",children:"local"}),s.jsx("option",{value:"staging",children:"staging"}),s.jsx("option",{value:"production",children:"production"})]})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"recon-div",children:"How it differs from production"}),s.jsx("textarea",{id:"recon-div",rows:2,placeholder:"e.g. seed data, SSO replaced by a test login; or: none, this is production",value:v,onChange:O=>S(O.target.value)})]}),s.jsxs("div",{className:"field",children:[s.jsx("label",{htmlFor:"recon-settings",children:"Non-production settings (optional, comma-separated)"}),s.jsx("input",{id:"recon-settings",type:"text",className:"mono",spellCheck:!1,placeholder:"DEBUG=1, AUTH_DISABLED",value:g,onChange:O=>b(O.target.value)})]}),s.jsxs("label",{className:"recon-consent recon-option",children:[s.jsx("input",{type:"checkbox",checked:L,onChange:O=>V(O.target.checked)}),s.jsx("span",{children:"Look for attack paths afterwards: with two or more findings, try to combine them and show each path end to end. Same approvals, same target; up to 15% of the token budget is kept for it."})]}),s.jsxs("label",{className:"recon-consent",children:[s.jsx("input",{type:"checkbox",checked:x,onChange:O=>k(O.target.checked)}),s.jsx("span",{children:"I am authorised to test this target, and it is the only one in scope."})]}),oe&&s.jsx("div",{className:"hint danger",children:oe}),s.jsxs("div",{className:"perm-actions recon-actions",children:[s.jsx("button",{className:"btn primary sm",disabled:!C,onClick:Y,children:z?"starting…":"start recon"}),s.jsx("button",{className:"btn sm",disabled:z,onClick:o,children:"cancel"})]})]})}function qk({recon:l,onStop:o,onDismiss:c}){const u=l.status==="running";return s.jsxs("div",{className:"recon-strip"+(u?" live":""),role:"status",children:[s.jsx("span",{className:"recon-name",children:"recon"}),s.jsx("span",{className:"mono",title:l.objective,children:l.scope}),s.jsx("span",{children:Uk(l)}),s.jsxs("span",{children:[Ai(l.tokens),"/",Ai(l.budgetTokens)," tokens"]}),u&&l.model&&s.jsx("span",{title:`profile ${l.profile}`,children:l.model}),s.jsxs("span",{title:"Approvals the gate answered itself, and the ones it left for you",children:["auto-allowed ",l.gate.allowed," · asked ",l.gate.asked," · blocked ",l.gate.denied]}),u?s.jsx("button",{className:"btn sm danger-outline",onClick:o,children:"stop"}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"recon-end",children:["ended: ",l.stopped?Bk[l.stopped]:"finished"]}),s.jsx("button",{className:"link-btn",onClick:c,children:"dismiss"})]})]})}function $k({recon:l}){if(l.status==="running"&&!l.findings.length)return null;const{demonstrated:o,partial:c}=z0(l.chains),u=l.status==="running"&&l.phase==="chains",d=Hk(l);return s.jsxs("div",{className:"recon-findings",children:[(o.length>0||u)&&s.jsxs("div",{className:"recon-section",children:[s.jsxs("div",{className:"perm-title recon-title",children:["Attack paths (",o.length,")"]}),u&&s.jsx("div",{className:"hint",children:"Combining the findings into attack paths and trying each one…"}),o.map((h,m)=>s.jsx(Cv,{c:h},h.id??m))]}),s.jsxs("div",{className:"recon-section",children:[s.jsxs("div",{className:"perm-title recon-title",children:["Recon findings (",l.findings.length,") · ",l.env.kind]}),l.error&&s.jsx("div",{className:"hint danger",children:l.error}),!l.findings.length&&s.jsx("div",{className:"hint",children:"The verifier confirmed no findings in this run."}),l.findings.map((h,m)=>s.jsx(Gk,{f:h,paths:Lk(h.id,l.chains)},h.id??m))]}),c.length>0&&s.jsxs("div",{className:"recon-section",children:[s.jsxs("div",{className:"perm-title recon-title recon-title-lead",children:["Unproven paths (",c.length,")"]}),s.jsx("div",{className:"hint",children:"Leads, not findings: each stopped before it was shown end to end."}),c.map((h,m)=>s.jsx(Cv,{c:h},h.id??m))]}),d&&s.jsx("div",{className:"hint recon-note",children:d})]})}function Cv({c:l}){const o=l.status==="partial";return s.jsxs("div",{className:"recon-finding recon-chain"+(o?" partial":""),children:[s.jsxs("div",{className:"recon-finding-head",children:[l.id&&s.jsx("span",{className:"badge recon-id",children:l.id}),s.jsx("span",{className:`badge sev-${l.severity}`,title:o?"The worst this path could be: it was not shown":void 0,children:o?`up to ${l.severity}`:l.severity}),s.jsx("span",{className:"recon-finding-title",children:l.title}),l.standardId&&s.jsx("span",{className:"badge",children:l.standardId}),l.verdict==="config-dependent"&&s.jsx("span",{className:"badge sev-medium",children:"config-dependent"})]}),s.jsx("div",{className:"recon-impact",children:l.impact}),s.jsxs("div",{className:"recon-links",children:[s.jsx("span",{children:"uses"}),l.links.map(c=>s.jsx("span",{className:"badge recon-id",children:c},c))]}),o&&s.jsx("div",{className:"hint recon-stopped",children:zk(l)}),s.jsx("ol",{className:"recon-steps",children:l.steps.map((c,u)=>s.jsxs("li",{className:o&&l.blockedAt===u+1?"blocked":void 0,children:[s.jsx("div",{children:c.action}),c.evidence&&s.jsx("pre",{className:"recon-repro",children:c.evidence})]},u))}),l.prodCaveat&&s.jsxs("div",{className:"hint",children:["Re-test against production: ",l.prodCaveat]})]})}function Gk({f:l,paths:o}){return s.jsxs("div",{className:"recon-finding",children:[s.jsxs("div",{className:"recon-finding-head",children:[l.id&&s.jsx("span",{className:"badge recon-id",children:l.id}),s.jsx("span",{className:`badge sev-${l.severity}`,children:l.severity}),s.jsx("span",{className:"recon-finding-title",children:l.title}),l.standardId&&s.jsx("span",{className:"badge",children:l.standardId}),l.verdict==="config-dependent"&&s.jsx("span",{className:"badge sev-medium",children:"config-dependent"}),o.length>0&&s.jsxs("span",{className:"recon-in-paths",title:"Attack paths that build on this finding",children:["in ",o.join(", ")]})]}),s.jsx("pre",{className:"recon-repro",children:l.repro}),l.prodCaveat&&s.jsxs("div",{className:"hint",children:["Re-test against production: ",l.prodCaveat]})]})}const $c=[{name:"new",description:"Start a new session",hint:""},{name:"compact",description:"Summarise the conversation to free up context",hint:""},{name:"model",description:"Switch model, e.g. /model kimi",hint:"<name>"},{name:"plan",description:"Switch to the read-only plan agent",hint:""},{name:"build",description:"Switch to the build agent",hint:""},{name:"help",description:"List available commands",hint:""}],Xk=25*1024*1024,Mv=30*1024*1024,U0="or_cmd_history";function Yk(){try{const l=localStorage.getItem(U0);if(l)return JSON.parse(l)}catch{}return[]}function Vk({agent:l,setAgent:o,model:c,setModel:u,models:d,commands:h,busy:m,onSend:y,onStop:v,draft:S,onDraftUsed:g}){var mt;const[b,x]=A.useState(""),[k,L]=A.useState([]),[V,z]=A.useState(null),[Z,oe]=A.useState(!1),[de,C]=A.useState(0),Y=A.useRef(null),O=A.useRef(null),[X,F]=A.useState(!1),ie=A.useRef(null);function G(){var he,Be;if(X){(he=ie.current)==null||he.stop();return}const D=b.trim(),we=Bv({onStart:()=>F(!0),onEnd:()=>{F(!1),ie.current=null},onPartial:Ee=>x(D?D+" "+Ee:Ee)});ie.current=we,(Be=Y.current)==null||Be.focus()}const[Q,K]=A.useState(Yk),me=A.useRef(-1),ve=A.useRef("");function Ce(D){D.trim()&&K(we=>{const he=(we[we.length-1]===D?we:[...we,D]).slice(-200);try{localStorage.setItem(U0,JSON.stringify(he))}catch{}return he})}function ne(){requestAnimationFrame(()=>{const D=Y.current;D&&(D.selectionStart=D.selectionEnd=D.value.length)})}const te=()=>{const D=Y.current;return!D||!D.value.slice(0,D.selectionStart??0).includes(`
297
+ `)},ce=()=>{const D=Y.current;return!D||!D.value.slice(D.selectionEnd??0).includes(`
298
+ `)};function ee(D){if(!Q.length)return!1;if(me.current===-1){if(D===1)return!1;ve.current=b,me.current=Q.length-1}else{const we=me.current+D;if(we<0)return!0;if(we>=Q.length)return me.current=-1,x(ve.current),ne(),!0;me.current=we}return x(Q[me.current]),ne(),!0}A.useEffect(()=>{var D;S!==null&&(x(S),g(),(D=Y.current)==null||D.focus())},[S,g]),A.useEffect(()=>{const D=Y.current;D&&(D.style.height="auto",D.style.height=Math.min(D.scrollHeight,260)+"px")},[b]);function ke(D){var he;D.target.closest("button, select, input, textarea, a")||(he=Y.current)==null||he.focus()}const Ze=A.useMemo(()=>{const D=new Set($c.map(we=>we.name));return[...$c,...h.filter(we=>!D.has(we.name))]},[h]),bt=(mt=/^\/(\S*)$/.exec(b))==null?void 0:mt[1],kt=bt!==void 0?Ze.filter(D=>D.name.startsWith(bt.toLowerCase())):[],j=kt.length>0;A.useEffect(()=>C(0),[bt]);function ae(D){var we;D.hint?(x(`/${D.name} `),(we=Y.current)==null||we.focus()):Ie(`/${D.name}`)}async function je(D){z(null);const we=[];let he=k.reduce((Be,Ee)=>Be+Ee.size,0);for(const Be of Array.from(D)){if(Be.size>Xk){z(`${Be.name} is over 25 MB.`);continue}if(he+Be.size>Mv){z(`Attachments are limited to ${zo(Mv)} per message; ${Be.name} doesn't fit.`);continue}he+=Be.size;const Ee=await Qk(Be);we.push({name:Be.name||`pasted-${Date.now()}.${(Be.type.split("/")[1]||"bin").replace(/\W/g,"")}`,mime:Be.type||"application/octet-stream",size:Be.size,data:Ee.slice(Ee.indexOf(",")+1),preview:Be.type.startsWith("image/")?Ee:void 0})}L(Be=>[...Be,...we])}function pe(D){const we=Array.from(D.clipboardData.files);we.length&&(D.preventDefault(),je(we))}function Ie(D=b){!D.trim()&&!k.length||(Ce(D),me.current=-1,y(D,k),x(""),L([]),z(null))}function Oe(D){if(j){if(D.key==="ArrowDown"){D.preventDefault(),C(we=>(we+1)%kt.length);return}if(D.key==="ArrowUp"){D.preventDefault(),C(we=>(we-1+kt.length)%kt.length);return}if(D.key==="Tab"||D.key==="Enter"&&!D.shiftKey){D.preventDefault(),ae(kt[de]);return}if(D.key==="Escape"){D.preventDefault(),x("");return}}if(D.key==="ArrowUp"&&te()&&ee(-1)){D.preventDefault();return}if(D.key==="ArrowDown"&&me.current!==-1&&ce()&&ee(1)){D.preventDefault();return}D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),Ie())}const ze=d.find(D=>D.id===c),Se=A.useMemo(()=>{const D=new Map;for(const we of d)D.set(we.provider,[...D.get(we.provider)??[],we]);return[...D.entries()]},[d]),_e=k.some(D=>D.mime.startsWith("image/"));return s.jsxs("div",{className:"composer-wrap",children:[j&&s.jsx("div",{className:"slash-menu",role:"listbox",children:kt.map((D,we)=>s.jsxs("button",{role:"option","aria-selected":we===de,className:"slash-item"+(we===de?" on":""),onMouseEnter:()=>C(we),onMouseDown:he=>{he.preventDefault(),ae(D)},children:[s.jsxs("span",{className:"slash-name mono",children:["/",D.name,D.hint?s.jsxs("span",{className:"slash-hint",children:[" ",D.hint]}):null]}),s.jsx("span",{className:"slash-desc",children:D.description})]},D.name))}),s.jsxs("div",{className:"composer-box"+(Z?" dragging":""),onClick:ke,onDragOver:D=>{D.dataTransfer.types.includes("Files")&&(D.preventDefault(),oe(!0))},onDragLeave:()=>oe(!1),onDrop:D=>{D.preventDefault(),oe(!1),D.dataTransfer.files.length&&je(D.dataTransfer.files)},children:[k.length>0&&s.jsx("div",{className:"attach-row",children:k.map((D,we)=>s.jsxs("span",{className:"attach-chip",title:`${D.name} · ${zo(D.size)}`,children:[D.preview?s.jsx("img",{src:D.preview,alt:""}):s.jsx("span",{className:"attach-icon",children:s.jsx(fh,{})}),s.jsx("span",{className:"attach-name",children:D.name}),s.jsx("button",{className:"attach-x",onClick:()=>L(he=>he.filter((Be,Ee)=>Ee!==we)),"aria-label":`Remove ${D.name}`,children:"✕"})]},we))}),s.jsx("textarea",{ref:Y,value:b,onChange:D=>{x(D.target.value),me.current=-1},onKeyDown:Oe,onPaste:pe,rows:3,placeholder:X?"Listening…":l==="build"?"Ask BugXHunter to change something… (/ for commands)":"Ask BugXHunter to plan or explain… (/ for commands)"}),s.jsxs("div",{className:"composer-bar",children:[s.jsx("button",{className:"icon-btn attach-btn",onClick:()=>{var D;return(D=O.current)==null?void 0:D.click()},title:"Attach files (or paste / drop them)","aria-label":"Attach files",children:s.jsx(Vc,{size:20})}),s.jsx("input",{ref:O,type:"file",multiple:!0,hidden:!0,onChange:D=>{D.target.files&&je(D.target.files),D.target.value=""}}),s.jsx("div",{className:"agent-switch",role:"tablist",children:["build","plan"].map(D=>s.jsx("button",{className:"seg"+(l===D?" on":""),onClick:()=>o(D),disabled:m,children:D},D))}),s.jsxs("select",{className:"model-select",value:c,onChange:D=>u(D.target.value),disabled:m,title:"Model",children:[!ze&&s.jsx("option",{value:c,children:c}),Se.map(([D,we])=>s.jsx("optgroup",{label:D,children:we.map(he=>s.jsxs("option",{value:he.id,children:[he.name,he.images?" · sees images":"",he.output?` · ${Ai(he.output)} out`:""]},he.id))},D))]}),s.jsx("div",{className:"spacer"}),nh()&&s.jsx("button",{className:"send-btn mic"+(X?" stop":""),onClick:G,disabled:m,title:X?"Stop dictation":"Dictate","aria-label":X?"Stop dictation":"Dictate",children:X?"●":"🎤"}),m?s.jsx("button",{className:"send-btn stop",onClick:v,title:"Stop",children:"■"}):s.jsx("button",{className:"send-btn",onClick:()=>Ie(),disabled:!b.trim()&&!k.length,title:"Send (Enter)",children:"↑"})]})]}),s.jsx("div",{className:"composer-hint",children:V?s.jsx("span",{className:"danger",children:V}):_e&&ze&&!ze.images?s.jsxs("span",{className:"warn",children:[ze.name," can't see images — it gets the saved file only. Pick a model marked “sees images” to let it look."]}):"Enter to send · Shift+Enter new line · / commands · paste or drop files"})]})}function Qk(l){return new Promise((o,c)=>{const u=new FileReader;u.onload=()=>o(String(u.result)),u.onerror=()=>c(u.error),u.readAsDataURL(l)})}const Kk={completed:"✓",in_progress:"◐",pending:"○",cancelled:"✕"};function Zk({todos:l}){const[o,c]=A.useState(!0);if(!l.length)return null;const u=l.filter(h=>h.status==="completed").length,d=l.find(h=>h.status==="in_progress");return s.jsxs("div",{className:"todo-panel",children:[s.jsxs("button",{className:"todo-head",onClick:()=>c(h=>!h),"aria-expanded":o,children:[s.jsx("span",{className:"chev"+(o?" open":""),children:"›"}),s.jsx("span",{className:"todo-title",children:"Tasks"}),s.jsxs("span",{className:"todo-count",children:[u,"/",l.length]}),s.jsx("span",{className:"todo-bar",children:s.jsx("span",{style:{width:`${u/l.length*100}%`}})}),!o&&d&&s.jsx("span",{className:"todo-current",children:d.content})]}),o&&s.jsx("ul",{className:"todo-list",children:l.map((h,m)=>s.jsxs("li",{className:"todo s-"+h.status,children:[s.jsx("span",{className:"todo-icon","aria-hidden":!0,children:Kk[h.status]??"○"}),s.jsx("span",{className:"todo-text",children:h.content}),h.priority==="high"&&h.status!=="completed"&&s.jsx("span",{className:"todo-prio",children:"high"})]},m))})]})}function Pk(l){var u,d;const o=[];let c=!1;for(const h of l.split(`
299
+ `)){const m=h.replace(/\r$/,"");if(m.startsWith("@@")){o.push(null),c=!0;continue}!c||m.startsWith("\\")||(m.startsWith("+")?o.push({kind:"add",text:m.slice(1)}):m.startsWith("-")?o.push({kind:"del",text:m.slice(1)}):o.push({kind:"same",text:m.slice(1)}))}return o[0]===null&&o.shift(),o.length&&((u=o[o.length-1])==null?void 0:u.kind)==="same"&&((d=o[o.length-1])==null?void 0:d.text)===""&&o.pop(),o}function Fk(l,o){const c=l?l.split(`
300
300
  `):[],u=o?o.split(`
301
- `):[];if(c.length*u.length>4e6)return[...c.map(g=>({kind:"del",text:g})),...u.map(g=>({kind:"add",text:g}))];const d=c.length,h=u.length,m=Array.from({length:d+1},()=>new Uint32Array(h+1));for(let g=d-1;g>=0;g--)for(let b=h-1;b>=0;b--)m[g][b]=c[g]===u[b]?m[g+1][b+1]+1:Math.max(m[g+1][b],m[g][b+1]);const y=[];let v=0,S=0;for(;v<d&&S<h;)c[v]===u[S]?(y.push({kind:"same",text:c[v]}),v++,S++):m[v+1][S]>=m[v][S+1]?y.push({kind:"del",text:c[v++]}):y.push({kind:"add",text:u[S++]});for(;v<d;)y.push({kind:"del",text:c[v++]});for(;S<h;)y.push({kind:"add",text:u[S++]});return y}function Yk(l,o=3){const c=new Array(l.length).fill(!1);l.forEach((h,m)=>{if(h.kind!=="same")for(let y=Math.max(0,m-o);y<=Math.min(l.length-1,m+o);y++)c[y]=!0});const u=[];let d=!1;return l.forEach((h,m)=>{c[m]?(u.push(h),d=!1):d||(u.push(null),d=!0)}),u}function Vk({diff:l,onClose:o}){return A.useEffect(()=>{const c=u=>u.key==="Escape"&&o();return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[o]),i.jsx("div",{className:"overlay",onClick:o,children:i.jsxs("div",{className:"modal",onClick:c=>c.stopPropagation(),children:[i.jsxs("div",{className:"modal-head",children:[i.jsxs("span",{className:"modal-title",children:[i.jsx("span",{className:"dot r","aria-hidden":!0}),"git diff --session"]}),i.jsx("button",{className:"icon-btn close-x",onClick:o,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),i.jsx("div",{className:"modal-body",children:typeof l=="string"?i.jsx("pre",{className:"diff-raw",children:l}):l.length===0?i.jsxs("p",{className:"muted",children:["No changes recorded. OpenCode tracks changes only in git repositories — run ",i.jsx("code",{className:"mono",children:"git init"})," in the project folder to see them here."]}):l.map((c,u)=>i.jsx(Qk,{f:c},`${c.turn??0}-${c.file}-${u}`))})]})})}function Qk({f:l}){const[o,c]=A.useState(!0),u=A.useMemo(()=>l.patch!==void 0?Gk(l.patch):Yk(Xk(l.before??"",l.after??"")),[l.patch,l.before,l.after]);return i.jsxs("div",{className:"file-diff",children:[i.jsxs("button",{className:"file-diff-head",onClick:()=>c(d=>!d),children:[i.jsx("span",{className:"chev"+(o?" open":""),children:"›"}),i.jsx("span",{className:"mono",children:l.file}),l.turn?i.jsxs("span",{className:"muted turn",children:["prompt ",l.turn]}):null,i.jsxs("span",{className:"adds",children:["+",l.additions??0]}),i.jsxs("span",{className:"dels",children:["−",l.deletions??0]})]}),o&&i.jsx("pre",{className:"diff-lines",children:u.map((d,h)=>d===null?i.jsx("div",{className:"dl gap",children:"⋯"},h):i.jsxs("div",{className:"dl "+d.kind,children:[d.kind==="add"?"+ ":d.kind==="del"?"- ":" ",d.text]},h))})]})}function Kk({req:l,onAnswer:o,onDismiss:c}){const[u,d]=A.useState(()=>l.questions.map(()=>[])),[h,m]=A.useState(()=>l.questions.map(()=>""));function y(g,b,x){d(k=>k.map((D,V)=>V!==g?D:x?D.includes(b)?D.filter(L=>L!==b):[...D,b]:D[0]===b?[]:[b])),x||m(k=>k.map((D,V)=>V===g?"":D))}const v=l.questions.map((g,b)=>{const x=h[b].trim();return!g.multiple&&x?[x]:x?[...u[b],x]:u[b]}),S=v.every(g=>g.length>0);return i.jsxs("div",{className:"question-card",children:[i.jsxs("div",{className:"perm-title",children:["The agent has a question",l.subagent&&i.jsxs("span",{className:"perm-sub",children:["subagent · ",l.subagent]})]}),l.questions.map((g,b)=>i.jsxs("div",{className:"q-block",children:[g.header&&i.jsx("span",{className:"q-header",children:g.header}),i.jsx("div",{className:"q-text",children:g.question}),g.multiple&&i.jsx("div",{className:"hint",style:{marginTop:0},children:"Choose any that apply."}),i.jsx("div",{className:"q-options",role:g.multiple?"group":"radiogroup",children:g.options.map(x=>{const k=u[b].includes(x.label);return i.jsxs("button",{className:"q-option"+(k?" on":""),role:g.multiple?"checkbox":"radio","aria-checked":k,onClick:()=>y(b,x.label,g.multiple),children:[i.jsx("span",{className:"q-mark"+(g.multiple?" box":""),"aria-hidden":!0,children:k?"✓":""}),i.jsx("span",{className:"q-label",children:x.label}),x.description&&i.jsx("span",{className:"q-desc",children:x.description})]},x.label)})}),g.custom!==!1&&i.jsx("input",{type:"text",className:"q-custom",placeholder:"Or type your own answer…",value:h[b],onChange:x=>{const k=x.target.value;m(D=>D.map((V,L)=>L===b?k:V)),!g.multiple&&k.trim()&&d(D=>D.map((V,L)=>L===b?[]:V))},onKeyDown:x=>{x.key==="Enter"&&S&&o(v)}})]},b)),i.jsxs("div",{className:"perm-actions",children:[i.jsx("button",{className:"btn primary sm",disabled:!S,onClick:()=>o(v),children:"Send answer"}),i.jsx("button",{className:"btn sm",onClick:c,children:"Dismiss"})]})]})}const Zk={build:"Edits files and runs commands. You approve each change.",plan:"Read-only. Explores the code and writes a plan."};function Fk(l,o){return[{kind:"p",text:`./bxh --project ${l} --agent ${o}`,pace:26},{kind:"out",text:"Loading project context..."},{kind:"out",text:Zk[o],pace:18},{kind:"ok",text:"Agent ready ",ok:"OK"}]}const Pk=["Summarise the architecture of this project.","Find and explain the main entry points.","Review this project against the OWASP Top 10:2025 and report findings with ids and fixes.","Map every place this code calls a model or runs an agent, and assess it against the OWASP LLM and Agentic Top 10 and ATLAS.","/init"],Jk=80;function Wk({status:l,statusError:o,directory:c,model:u,setModel:d,resume:h,onActiveSession:m,onSessionsChanged:y}){const[v,S]=A.useState("build"),[g,b]=A.useState(null),[x,k]=A.useState([]),[D,V]=A.useState([]),[L,K]=A.useState([]),[ce,de]=A.useState([]),[E,G]=A.useState(!1),[H,Y]=A.useState(!1),[F,ie]=A.useState(null),[X,P]=A.useState(null),[Q,me]=A.useState(null),[ve,Ce]=A.useState([]),[ne,te]=A.useState(null),[re,ee]=A.useState(!0),[ke,Ze]=A.useState(null),[bt,kt]=A.useState(!1),j=A.useRef(!1),[ae,je]=A.useState([]),pe=A.useRef([]),Ie=A.useRef(0),Oe=A.useRef(!1),ze=A.useRef(()=>{}),Se=A.useRef({}),_e=A.useRef(""),mt=A.useRef(0),O=A.useRef(null),we=A.useRef(null),he=A.useRef(!0);A.useEffect(()=>{LS(c).then(Ce).catch(()=>{}),OT(c,["/workspace"])},[c]);function Be(){const B=we.current;if(!B)return;const ue=B.scrollHeight-B.scrollTop-B.clientHeight<Jk;he.current=ue,ee(ue)}function Ee(B=!0){const ue=we.current;ue&&(he.current=!0,ee(!0),ue.scrollTo({top:ue.scrollHeight,behavior:B?"smooth":"auto"}))}A.useEffect(()=>{var B;he.current&&((B=we.current)==null||B.scrollTo({top:we.current.scrollHeight}))},[x,D,L]);const le=A.useCallback((B,ue,Ae)=>{k(De=>{const Ye=De.slice();let Qe=Ye.findIndex(jt=>jt.id===B);Qe===-1&&(Ye.push({id:B,role:"assistant",parts:[]}),Qe=Ye.length-1);const Fe={...Ye[Qe],parts:Ye[Qe].parts.slice()};return Ae&&(Fe.subagent=Ae),ue(Fe),Ye[Qe]=Fe,Ye})},[]),Te=A.useCallback(B=>{switch(B.kind){case"message":Se.current[B.messageID]=B.role,B.role==="assistant"&&le(B.messageID,ue=>{ue.tokens=B.tokens,ue.cost=B.cost,ue.model=B.model},B.subagent);break;case"text":case"reasoning":{const ue=Se.current[B.messageID];if(ue==="user"||!ue&&B.text.trim()===_e.current.trim())break;const Ae=B.partID??`${B.kind}-${B.messageID}`;le(B.messageID,De=>{const Ye=De.parts.findIndex(Fe=>Fe.type===B.kind&&"id"in Fe&&Fe.id===Ae),Qe={type:B.kind,id:Ae,text:B.text};Ye===-1?De.parts.push(Qe):De.parts[Ye]=Qe},B.subagent);break}case"tool":le(B.messageID,ue=>{const Ae=ue.parts.findIndex(Ye=>Ye.type==="tool"&&Ye.callID===B.callID),De={type:"tool",callID:B.callID,tool:B.tool,status:B.status,title:B.title,input:B.input,output:B.output,error:B.error};Ae===-1?ue.parts.push(De):ue.parts[Ae]={...ue.parts[Ae],...De}},B.subagent);break;case"todo":de(B.todos);break;case"session":y();break;case"permission":V(ue=>ue.some(Ae=>Ae.permissionID===B.permissionID)?ue:[...ue,B]);break;case"permission-replied":V(ue=>ue.filter(Ae=>Ae.permissionID!==B.permissionID));break;case"question":K(ue=>ue.some(Ae=>Ae.requestID===B.requestID)?ue:[...ue,{requestID:B.requestID,questions:B.questions,subagent:B.subagent}]);break;case"question-closed":K(ue=>ue.filter(Ae=>Ae.requestID!==B.requestID));break;case"idle":k(ue=>ue.map(ej)),y(),j.current||ze.current();break;case"error":ie(B.message),j.current||ze.current();break}},[le,y]);function be(){var B;(B=O.current)==null||B.abort(),O.current=null,b(null),k([]),V([]),K([]),de([]),ie(null),P(null),G(!1),Ze(null),j.current=!1,pe.current=[],$e(),Oe.current=!1,Se.current={},he.current=!0,ee(!0)}function qe(B){var Ae;(Ae=O.current)==null||Ae.abort();const ue=new AbortController;O.current=ue,VS(B,c,Te,ue.signal,()=>q(B,ue)).catch(De=>{(De==null?void 0:De.name)!=="AbortError"&&ie(String((De==null?void 0:De.message)??De))}),q(B,ue)}function q(B,ue){BS(B,c).then(({permissions:Ae,questions:De})=>{ue.signal.aborted||(Ae.length&&(V(Ye=>{const Qe=new Set(Ye.map(Fe=>Fe.permissionID));return[...Ye,...Ae.filter(Fe=>!Qe.has(Fe.permissionID))]}),G(!0)),De.length&&(K(Ye=>{const Qe=new Set(Ye.map(Fe=>Fe.requestID));return[...Ye,...De.filter(Fe=>!Qe.has(Fe.requestID)).map(Fe=>({requestID:Fe.requestID,questions:Fe.questions,subagent:Fe.subagent}))]}),G(!0)))}).catch(()=>{})}async function Re(){if(g)return g;const B=await IS(c);return b(B.id),m(B.id),qe(B.id),B.id}function He(){be(),m(null)}A.useEffect(()=>{if(!h)return;if(!h.id){He();return}const B=h.id;be(),Y(!0),OS(B,c).then(({messages:ue,todos:Ae})=>{for(const De of ue)Se.current[De.id]=De.role;k(ue.map(tj)),de(Ae??[]),b(B),m(B),qe(B),$y(B).then(pt).catch(()=>{}),requestAnimationFrame(()=>Ee(!1))}).catch(ue=>ie(String(ue.message??ue))).finally(()=>Y(!1))},[h==null?void 0:h.n]);function pt(B){Ze(B),(B==null?void 0:B.status)==="running"&&(j.current=!0,Oe.current=!0,G(!0))}async function Ve(B){ie(null),P(null);const ue=await Re(),Ae=await KS({sessionID:ue,directory:c,...B,authorised:!0}),De=`local-${mt.current++}`,Ye=`Supervised recon of ${B.scope} (${B.env.kind})
302
- ${B.objective}`;k(Qe=>[...Qe,{id:De,role:"user",parts:[{type:"text",id:De,text:Ye}]}]),pt(Ae),Ee()}const ht=(ke==null?void 0:ke.status)==="running";A.useEffect(()=>{if(!ht||!g)return;const B=setInterval(()=>{$y(g).then(ue=>{ue&&(Ze(ue),ue.status!=="running"&&(j.current=!1,ze.current(),y()))}).catch(()=>{})},2500);return()=>clearInterval(B)},[ht,g,y]);const $e=()=>je([...pe.current]);function Vt(B,ue=[]){if(!(!B.trim()&&!ue.length)){if(Oe.current){pe.current.push({id:Ie.current++,text:B,files:ue}),$e(),Ee();return}Bn(B,ue)}}function ea(B){pe.current=pe.current.filter(ue=>ue.id!==B),$e()}function fa(){if(Oe.current)return;const B=pe.current.shift();$e(),B&&Bn(B.text,B.files)}const gn=A.useRef(!1);function wn(){Oe.current=!1,G(!1),!gn.current&&(gn.current=!0,requestAnimationFrame(()=>{gn.current=!1,fa()}))}ze.current=wn;async function Bn(B,ue=[]){const Ae=B.trim();ie(null),P(null),Ee();const De=/^\/(\S+)(?:\s+([\s\S]*))?$/.exec(Ae);if(De&&!ue.length){await ka(De[1].toLowerCase(),(De[2]??"").trim()),Oe.current||fa();return}try{Oe.current=!0;const Ye=await Re();_e.current=Ae;const Qe=`local-${mt.current++}`,Fe=ue.map((Wt,Mn)=>({type:"file",id:`${Qe}-f${Mn}`,filename:Wt.name,mime:Wt.mime,url:Wt.preview,size:Wt.size}));k(Wt=>[...Wt,{id:Qe,role:"user",parts:[...Ae?[{type:"text",id:Qe,text:Ae}]:[],...Fe]}]),G(!0);const jt=l==null?void 0:l.models.find(Wt=>Wt.id===u);await qS({sessionID:Ye,text:Ae,agent:v,model:u,directory:c,files:ue.map(({name:Wt,mime:Mn,data:hl})=>({name:Wt,mime:Mn,data:hl})),inlineImages:!!(jt!=null&&jt.images)})}catch(Ye){ie(String(Ye.message??Ye)),wn()}}async function ka(B,ue){switch(B){case"new":He();return;case"plan":case"build":S(B),P(`Switched to the ${B} agent.`);return;case"help":{const Ae=[...$c,...ve.filter(De=>!$c.some(Ye=>Ye.name===De.name))];P(Ae.map(De=>`/${De.name}${De.hint?" "+De.hint:""} — ${De.description}`).join(`
303
- `));return}case"model":{const Ae=ue.toLowerCase(),De=(l==null?void 0:l.models)??[],Ye=Ae&&(De.find(Qe=>Qe.id.toLowerCase()===Ae||Qe.name.toLowerCase()===Ae)??De.find(Qe=>Qe.id.toLowerCase().includes(Ae)||Qe.name.toLowerCase().includes(Ae)));if(!Ye){ie(Ae?`No model matches “${ue}”.`:"Usage: /model <name>, e.g. /model kimi");return}d(Ye.id),P(`Model: ${Ye.name}`);return}case"compact":if(!g){ie("Nothing to compact yet.");return}try{Oe.current=!0,G(!0),await US(g,c,u),P("Compacting the conversation…")}catch(Ae){ie(String(Ae.message??Ae)),wn()}return}if(!ve.some(Ae=>Ae.name===B)){ie(`Unknown command /${B}. Type / to see the list.`);return}try{const Ae=await Re(),De=`local-${mt.current++}`,Ye=`/${B}${ue?" "+ue:""}`;_e.current=Ye,k(Qe=>[...Qe,{id:De,role:"user",parts:[{type:"text",id:De,text:Ye}]}]),Oe.current=!0,G(!0),await zS({sessionID:Ae,command:B,arguments:ue,agent:v,model:u,directory:c})}catch(Ae){ie(String(Ae.message??Ae)),wn()}}async function An(B,ue){V(Ae=>Ae.filter(De=>De.permissionID!==B.permissionID));try{await $S({sessionID:B.sessionID,permissionID:B.permissionID,response:ue,directory:c})}catch(Ae){ie(String(Ae.message??Ae))}}async function nn(B,ue){K(Ae=>Ae.filter(De=>De.requestID!==B.requestID));try{await GS(ue?{requestID:B.requestID,answers:ue,directory:c}:{requestID:B.requestID,reject:!0,directory:c})}catch(Ae){ie(String(Ae.message??Ae))}}async function yt(){if(pe.current=[],$e(),j.current&&g){await ZS(g).catch(()=>{});return}Oe.current=!1,G(!1),g&&await XS(g,c).catch(()=>{})}async function Ga(){if(!g)return;const B=await YS(g,c);me(Array.isArray(B)||typeof B=="string"?B:B?JSON.stringify(B,null,2):[])}A.useEffect(()=>()=>{var B;return(B=O.current)==null?void 0:B.abort()},[]);const yn=c.split(/[\\/]/).filter(Boolean).pop()??c,vn=A.useMemo(()=>x.reduce((B,ue)=>{var Ae,De;return B+(((Ae=ue.tokens)==null?void 0:Ae.input)??0)+(((De=ue.tokens)==null?void 0:De.output)??0)},0),[x]),Cn=D.length>0||L.length>0;return i.jsxs("main",{className:"main",children:[i.jsxs(Bo,{title:`bugxhunter@redteam: ~/${yn}`,tooltip:c,children:[i.jsxs("span",{className:"status-pill"+(E?" live":""),children:[i.jsx("span",{className:"dot"}),E?Cn?"waiting for you":"running":g?"idle":"ready"]}),vn>0&&i.jsxs("span",{className:"token-pill",children:[Ai(vn)," tokens"]}),i.jsx("button",{className:"btn ghost sm",onClick:()=>kt(!0),disabled:E||!(l!=null&&l.ready),title:"Supervised recon: test one target round after round, approving anything that is not a read-only request",children:"recon"}),i.jsx("button",{className:"btn ghost sm",onClick:Ga,disabled:!g,children:"changes"}),i.jsx("button",{className:"btn ghost sm",onClick:He,disabled:E,children:"new_session"})]}),i.jsxs("div",{className:"transcript-wrap",children:[i.jsx("div",{className:"transcript grid-bg",ref:we,onScroll:Be,children:i.jsxs("div",{className:"transcript-inner",children:[H&&i.jsx("p",{className:"muted center mono",children:"Loading session…"}),!H&&x.length===0&&i.jsxs("div",{className:"empty-state",children:[i.jsx(Bv,{lines:Fk(yn,v)},`${yn}:${v}`),i.jsx("div",{className:"suggestions",children:Pk.map(B=>i.jsx("button",{className:"chip",onClick:()=>B.startsWith("/")?Vt(B):te(B),children:B==="/init"?"/init — create AGENTS.md, the project's memory for future sessions":B},B))}),o&&i.jsx("div",{className:"error-banner",children:o})]}),x.map(B=>i.jsx(nj,{msg:B},B.id)),ke&&i.jsx(Lk,{recon:ke}),D.map(B=>i.jsxs("div",{className:"perm-card",children:[i.jsxs("div",{className:"perm-title",children:["Approval needed",B.subagent&&i.jsxs("span",{className:"perm-sub",children:["subagent · ",B.subagent]})]}),i.jsxs("div",{className:"perm-body",children:[i.jsx("span",{className:"perm-type",children:B.permType??"action"})," ",B.title??(Array.isArray(B.pattern)?B.pattern.join(", "):B.pattern)??""]}),i.jsxs("div",{className:"perm-actions",children:[i.jsx("button",{className:"btn primary sm",onClick:()=>An(B,"once"),children:"Approve"}),!ht&&i.jsx("button",{className:"btn sm",onClick:()=>An(B,"always"),children:"Always allow"}),i.jsx("button",{className:"btn sm danger-outline",onClick:()=>An(B,"reject"),children:"Reject"})]})]},B.permissionID)),L.map(B=>i.jsx(Kk,{req:B,onAnswer:ue=>nn(B,ue),onDismiss:()=>nn(B,null)},B.requestID)),E&&!Cn&&i.jsxs("div",{className:"working",children:[i.jsx("span",{}),i.jsx("span",{}),i.jsx("span",{})]}),ae.map(B=>i.jsx("div",{className:"msg user",children:i.jsxs("div",{className:"user-col",children:[i.jsx("div",{className:"bubble user-bubble queued-bubble",children:B.text||`(${B.files.length} file${B.files.length>1?"s":""})`}),i.jsxs("div",{className:"queued-label",children:["queued · ",i.jsx("button",{className:"link-btn",onClick:()=>ea(B.id),children:"cancel"})]})]})},B.id)),X&&i.jsx("div",{className:"notice",children:X}),F&&i.jsx("div",{className:"error-banner",children:F})]})}),!re&&i.jsx("button",{className:"jump-btn",onClick:()=>Ee(),"aria-label":"Scroll to latest",children:"↓ latest"})]}),i.jsxs("div",{className:"composer",children:[ke&&i.jsx(Dk,{recon:ke,onStop:yt,onDismiss:()=>Ze(null)}),i.jsx($k,{todos:ce}),i.jsx(Bk,{agent:v,setAgent:S,model:u,setModel:d,models:(l==null?void 0:l.models)??[],commands:ve,busy:E,onSend:Vt,onStop:yt,draft:ne,onDraftUsed:A.useCallback(()=>te(null),[])})]}),Q!==null&&i.jsx(Vk,{diff:Q,onClose:()=>me(null)}),bt&&i.jsx(Ok,{onStart:Ve,onClose:()=>kt(!1)})]})}function ej(l){return l.parts.some(o=>o.type==="tool"&&(o.status==="running"||o.status==="pending"))?{...l,parts:l.parts.map(o=>o.type==="tool"&&(o.status==="running"||o.status==="pending")?{...o,status:"interrupted"}:o)}:l}function tj(l){return{id:l.id,role:l.role,parts:l.parts,tokens:l.tokens,cost:l.cost,model:l.model,error:l.error,subagent:l.subagent}}function nj({msg:l}){if(l.role==="user"){const o=l.parts.map(u=>u.type==="text"?u.text:"").join(""),c=l.parts.filter(u=>u.type==="file");return i.jsx("div",{className:"msg user",children:i.jsxs("div",{className:"user-col",children:[c.length>0&&i.jsx("div",{className:"attach-row right",children:c.map(u=>i.jsxs("span",{className:"attach-chip",title:u.filename,children:[u.url?i.jsx("img",{src:u.url,alt:""}):i.jsx("span",{className:"attach-icon",children:i.jsx(fh,{})}),i.jsx("span",{className:"attach-name",children:u.filename}),u.size?i.jsx("span",{className:"attach-size",children:zo(u.size)}):null]},u.id))}),o&&i.jsx("div",{className:"bubble user-bubble",children:o})]})})}return!l.parts.length&&!l.error?null:i.jsxs("div",{className:"msg assistant"+(l.subagent?" subagent":""),children:[i.jsx("div",{className:"avatar","aria-hidden":!0,children:l.subagent?"↳":"▶"}),i.jsxs("div",{className:"msg-body",children:[l.subagent&&i.jsxs("div",{className:"subagent-tag",title:l.subagent,children:["subagent · ",l.subagent]}),l.parts.map((o,c)=>o.type==="tool"?i.jsx(lj,{t:o},o.callID):o.type==="reasoning"?i.jsx(aj,{text:o.text},o.id):o.type==="text"?i.jsx(Ic,{text:o.text,files:!0},o.id):i.jsx("span",{},o.id??c)),l.error&&i.jsx("div",{className:"error-banner",children:l.error}),l.tokens&&(l.tokens.output??0)>0&&i.jsxs("div",{className:"msg-meta",children:[l.model&&i.jsx("span",{children:l.model}),i.jsxs("span",{children:[Ai(l.tokens.input??0)," in · ",Ai(l.tokens.output??0)," out"]}),l.cost?i.jsxs("span",{children:["$",l.cost.toFixed(4)]}):null]})]})]})}function aj({text:l}){const[o,c]=A.useState(!1);return i.jsxs("div",{className:"reasoning",children:[i.jsxs("button",{className:"reasoning-toggle",onClick:()=>c(u=>!u),children:[i.jsx("span",{className:"chev"+(o?" open":""),children:"›"})," Thinking"]}),o&&i.jsx("div",{className:"reasoning-body",children:l})]})}function lj({t:l}){const[o,c]=A.useState(!1),u=l.title||(l.input?String(Object.values(l.input)[0]??""):""),d=!!(l.output||l.error);return i.jsxs("div",{className:"tool s-"+l.status,children:[i.jsxs("button",{className:"tool-head",onClick:()=>d&&c(h=>!h),disabled:!d,children:[i.jsx("span",{className:"tool-icon",children:i.jsx(aw,{tool:l.tool})}),i.jsx("span",{className:"tool-name",children:l.tool}),i.jsx("span",{className:"tool-summary",children:u.slice(0,120)}),i.jsx("span",{className:"tool-state",children:l.status==="running"||l.status==="pending"?i.jsx("span",{className:"spin"}):l.status==="error"?"failed":l.status==="interrupted"?"interrupted":""}),d&&i.jsx("span",{className:"chev"+(o?" open":""),children:"›"})]}),o&&d&&i.jsx("pre",{className:"tool-output",children:i.jsx(c0,{text:l.error?"error: "+l.error:String(l.output??"")})})]})}const Mv="or_playground_config",Lf="or_runner",_v="or_mode",Rv="or_layout",Ov=320,sj=240,ij=560,oj={name:"Assistant",model:"GLM-5.3",system:"You are a helpful, concise assistant.",temperature:.7,maxTokens:4096,topP:1,jsonMode:!1,stream:!0,tools:[],useKnowledge:!1,speak:!1,saveSessions:!0};function kc(l,o){try{const c=localStorage.getItem(l);if(c)return{...o,...JSON.parse(c)}}catch{}return o}function zf(l,o){try{localStorage.setItem(l,JSON.stringify(o))}catch{}}function rj(){const[l,o]=A.useState(()=>{try{return localStorage.getItem(_v)||"runner"}catch{return"runner"}}),[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(()=>kc(Lf,{directory:"",model:"",recent:[]}));A.useEffect(()=>{HS().then(async le=>{u(le);const Te=kc(Lf,{directory:"",model:"",recent:[]}).directory,be=Te?await Lv(Te).catch(()=>le.directory):le.directory;y(qe=>({...qe,directory:be,model:le.models.some(q=>q.id===qe.model)?qe.model:le.defaultModel}))}).catch(le=>h(String(le.message??le)))},[]),A.useEffect(()=>zf(Lf,m),[m]),A.useEffect(()=>{try{localStorage.setItem(_v,l)}catch{}},[l]);const[v,S]=A.useState(null),[g,b]=A.useState(null),[x,k]=A.useState(0),D=le=>{o("runner"),b(Te=>({id:le,n:((Te==null?void 0:Te.n)??0)+1}))},V=A.useCallback(()=>k(le=>le+1),[]),[L,K]=A.useState(()=>kc(Rv,{width:Ov,collapsed:!1}));A.useEffect(()=>zf(Rv,L),[L]);const ce=()=>K(le=>({...le,collapsed:!le.collapsed}));A.useEffect(()=>{const le=Te=>{(Te.ctrlKey||Te.metaKey)&&Te.key.toLowerCase()==="b"&&(Te.preventDefault(),ce())};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]);function de(le){le.preventDefault();const Te=le.currentTarget;Te.setPointerCapture(le.pointerId),document.body.classList.add("resizing");const be=q=>K(Re=>({...Re,width:Math.round(Math.min(ij,Math.max(sj,q.clientX)))})),qe=()=>{Te.removeEventListener("pointermove",be),Te.removeEventListener("pointerup",qe),document.body.classList.remove("resizing")};Te.addEventListener("pointermove",be),Te.addEventListener("pointerup",qe)}function E(le){S(null),b(null),y(Te=>({...Te,directory:le,recent:[le,...Te.recent.filter(be=>be!==le)].slice(0,8)}))}function G(le){y(Te=>({...Te,recent:Te.recent.filter(be=>be!==le)}))}const[H,Y]=A.useState(()=>{const le=kc(Mv,oj);return{...le,tools:a1(le.tools??[])}}),[F,ie]=A.useState([]),[X,P]=A.useState(null),[Q,me]=A.useState([]),[ve,Ce]=A.useState(!1),[ne,te]=A.useState(null),[re,ee]=A.useState("chat"),ke=A.useRef(null);A.useEffect(()=>{NS().then(le=>{ie(le),Y(Te=>{var be;return le.some(qe=>qe.id===Te.model)?Te:{...Te,model:((be=le[0])==null?void 0:be.id)??Te.model}})}).catch(le=>P(String(le.message??le)))},[]),A.useEffect(()=>zf(Mv,H),[H]);const Ze=A.useMemo(()=>F.find(le=>le.id===H.model),[F,H.model]),[bt,kt]=A.useState(null),[j,ae]=A.useState(null),[je,pe]=A.useState(null),Ie=A.useRef(null),Oe=A.useRef(null),ze=A.useCallback(()=>{Cc("chat").then(le=>ae(le)).catch(le=>pe({ok:!1,text:String(le.message??le)}))},[]);A.useEffect(()=>{l==="playground"&&ze()},[l,ze]),A.useEffect(()=>{var qe,q,Re;if(ve||!H.saveSessions||Q===Ie.current)return;const le=Q.find(He=>He.role==="user");if(!le)return;Ie.current=Q;const Te=Oe.current??_o();Oe.current=Te,kt(Te);const be=(((qe=le.content)==null?void 0:qe.trim())||((q=le.docs)!=null&&q.length?`${le.docs[0].kind==="text"?"File":"Diagram"} review: ${le.docs[0].name}`:(Re=le.images)!=null&&Re.length?"Image review":"Chat")).replace(/\s+/g," ").slice(0,80);Mc("chat",Te,be,{v:1,model:H.model,system:H.system,messages:Q}).then(()=>{pe({ok:!0,text:"Saved, encrypted with your vault"}),ze()}).catch(He=>pe({ok:!1,text:`Not saved: ${String(He.message??He)}`}))},[ve,Q,H.saveSessions,H.model,H.system,ze]);async function Se(le){var Te;if(!ve)try{const be=await Ff("chat",le),qe=Array.isArray((Te=be.body)==null?void 0:Te.messages)?be.body.messages:[];Ie.current=qe,Oe.current=le,kt(le),me(qe),te(null),ee("chat"),Y(q=>({...q,...be.body.model&&F.some(Re=>Re.id===be.body.model)?{model:be.body.model}:{},...typeof be.body.system=="string"?{system:be.body.system}:{}}))}catch(be){pe({ok:!1,text:String(be.message??be)})}}async function _e(le){try{await E0("chat",le),Oe.current===le&&Ee(),ze()}catch(Te){pe({ok:!1,text:String(Te.message??Te)})}}function mt(le){var be;const Te=[];H.system.trim()&&Te.push({role:"system",content:H.system});for(const qe of le)qe.role==="assistant"&&((be=qe.tool_calls)!=null&&be.length)?Te.push({role:"assistant",content:qe.content??"",tool_calls:qe.tool_calls}):qe.role==="tool"?Te.push({role:"tool",content:qe.content,tool_call_id:qe.tool_call_id}):Te.push({role:qe.role,content:qe.role==="user"?Eh(qe.content,qe.images,qe.docs):qe.content});return Te}async function O(le){Ce(!0),te(null);const Te=new AbortController;ke.current=Te;const be=le.length;me([...le,{role:"assistant",content:""}]);const qe=H.tools.length?l1(H.tools):void 0;let q="";const Re=performance.now();let He;const pt=()=>me(Ve=>{const ht=[...Ve],$e=ht[be];return $e&&(ht[be]={...$e,timing:{ttft:He,total:performance.now()-Re}}),ht});await eh({model:H.model,messages:mt(le),temperature:H.temperature,top_p:H.topP,max_tokens:H.maxTokens,reasoning_effort:th(H.reasoningEffort,F.find(Ve=>Ve.id===H.model)),tools:qe,response_format:H.jsonMode?{type:"json_object"}:void 0,rag:H.useKnowledge,stream:H.stream},{signal:Te.signal,onDelta:Ve=>{He??(He=performance.now()-Re),q+=Ve,me(ht=>{const $e=[...ht],Vt=$e[be];return $e[be]={...Vt,content:(Vt.content??"")+Ve},$e})},onToolCalls:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],tool_calls:Ve},$e}),onSources:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],sources:Ve},$e}),onUsage:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],usage:Ve},$e}),onError:Ve=>te(Ve),onDone:Ve=>{pt(),Ve==="length"&&me(ht=>{const $e=[...ht];return $e[be]&&($e[be]={...$e[be],finish:Ve}),$e}),H.speak&&q.trim()&&i1(q)}}).catch(Ve=>{(Ve==null?void 0:Ve.name)!=="AbortError"&&te(String((Ve==null?void 0:Ve.message)??Ve))}),Ce(!1),ke.current=null}function we(le,Te,be){if(!le.trim()&&!(Te!=null&&Te.length)&&!(be!=null&&be.length)||ve)return;const qe=[...Q,{role:"user",content:le,...Te!=null&&Te.length?{images:Te}:{},...be!=null&&be.length?{docs:be}:{}}];me(qe),O(qe)}function he(le,Te){const be=[...Q,{role:"tool",tool_call_id:le.id,content:Te}];me(be),O(be)}function Be(){var le;(le=ke.current)==null||le.abort(),o1(),Ce(!1)}function Ee(){Be(),me([]),te(null),Oe.current=null,kt(null),Ie.current=null}return i.jsxs("div",{className:"app"+(L.collapsed?" collapsed":""),style:{"--sidebar-w":`${L.width}px`},children:[L.collapsed&&i.jsx("button",{className:"sidebar-toggle floating",onClick:ce,title:"Show sidebar (Ctrl+B)","aria-label":"Show sidebar",children:"»"}),i.jsx(Hw,{onCollapse:ce,sessions:{active:v,version:x,open:D},mode:l,setMode:o,runner:m,status:c,statusError:d,onOpenDirectory:E,onForgetDirectory:G,config:H,setConfig:Y,models:F,modelError:X,activeModel:Ze,onReset:Ee,saved:{list:j,activeId:bt,status:je,onOpen:le=>void Se(le),onDelete:le=>void _e(le)}}),i.jsx("div",{className:"splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:de,onDoubleClick:()=>K(le=>({...le,width:Ov}))}),l==="runner"?m.directory?i.jsx(Wk,{status:c,statusError:d,directory:m.directory,model:m.model||(c==null?void 0:c.defaultModel)||"",setModel:le=>y(Te=>({...Te,model:le})),resume:g,onActiveSession:S,onSessionsChanged:V},m.directory):i.jsx("main",{className:"main",children:i.jsx("div",{className:"transcript grid-bg",children:i.jsx("div",{className:"empty-state center",children:d?i.jsx("div",{className:"error-banner",children:d}):i.jsx("p",{className:"muted mono",children:"Starting OpenCode…"})})})}):re==="compare"?i.jsx(nk,{config:H,models:F,onExit:()=>ee("chat")}):re==="canvas"?i.jsx(Ek,{config:H,models:F,onExit:()=>ee("chat")}):i.jsx(FT,{config:H,activeModel:Ze,messages:Q,busy:ve,error:ne,onSend:we,onStop:Be,onReset:Ee,onToolResult:he,onCompare:()=>ee("compare"),onCanvas:()=>ee("canvas")})]})}const cj=window.fetch.bind(window);window.fetch=async(l,o)=>{const c=await cj(l,o),u=typeof l=="string"?l:l instanceof URL?l.pathname:l.url;return c.status===401&&u.startsWith("/api/")&&!u.startsWith("/api/auth/")&&c.headers.get("WWW-Authenticate")==="BXH-Passkey"&&window.dispatchEvent(new Event(If)),c};jS.createRoot(document.getElementById("root")).render(i.jsx(vS.StrictMode,{children:i.jsx(M1,{children:i.jsx(rj,{})})}));
301
+ `):[];if(c.length*u.length>4e6)return[...c.map(g=>({kind:"del",text:g})),...u.map(g=>({kind:"add",text:g}))];const d=c.length,h=u.length,m=Array.from({length:d+1},()=>new Uint32Array(h+1));for(let g=d-1;g>=0;g--)for(let b=h-1;b>=0;b--)m[g][b]=c[g]===u[b]?m[g+1][b+1]+1:Math.max(m[g+1][b],m[g][b+1]);const y=[];let v=0,S=0;for(;v<d&&S<h;)c[v]===u[S]?(y.push({kind:"same",text:c[v]}),v++,S++):m[v+1][S]>=m[v][S+1]?y.push({kind:"del",text:c[v++]}):y.push({kind:"add",text:u[S++]});for(;v<d;)y.push({kind:"del",text:c[v++]});for(;S<h;)y.push({kind:"add",text:u[S++]});return y}function Jk(l,o=3){const c=new Array(l.length).fill(!1);l.forEach((h,m)=>{if(h.kind!=="same")for(let y=Math.max(0,m-o);y<=Math.min(l.length-1,m+o);y++)c[y]=!0});const u=[];let d=!1;return l.forEach((h,m)=>{c[m]?(u.push(h),d=!1):d||(u.push(null),d=!0)}),u}function Wk({diff:l,onClose:o}){return A.useEffect(()=>{const c=u=>u.key==="Escape"&&o();return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[o]),s.jsx("div",{className:"overlay",onClick:o,children:s.jsxs("div",{className:"modal",onClick:c=>c.stopPropagation(),children:[s.jsxs("div",{className:"modal-head",children:[s.jsxs("span",{className:"modal-title",children:[s.jsx("span",{className:"dot r","aria-hidden":!0}),"git diff --session"]}),s.jsx("button",{className:"icon-btn close-x",onClick:o,"aria-label":"Close",title:"Close (Esc)",children:"✕"})]}),s.jsx("div",{className:"modal-body",children:typeof l=="string"?s.jsx("pre",{className:"diff-raw",children:l}):l.length===0?s.jsxs("p",{className:"muted",children:["No changes recorded. OpenCode tracks changes only in git repositories — run ",s.jsx("code",{className:"mono",children:"git init"})," in the project folder to see them here."]}):l.map((c,u)=>s.jsx(ej,{f:c},`${c.turn??0}-${c.file}-${u}`))})]})})}function ej({f:l}){const[o,c]=A.useState(!0),u=A.useMemo(()=>l.patch!==void 0?Pk(l.patch):Jk(Fk(l.before??"",l.after??"")),[l.patch,l.before,l.after]);return s.jsxs("div",{className:"file-diff",children:[s.jsxs("button",{className:"file-diff-head",onClick:()=>c(d=>!d),children:[s.jsx("span",{className:"chev"+(o?" open":""),children:"›"}),s.jsx("span",{className:"mono",children:l.file}),l.turn?s.jsxs("span",{className:"muted turn",children:["prompt ",l.turn]}):null,s.jsxs("span",{className:"adds",children:["+",l.additions??0]}),s.jsxs("span",{className:"dels",children:["−",l.deletions??0]})]}),o&&s.jsx("pre",{className:"diff-lines",children:u.map((d,h)=>d===null?s.jsx("div",{className:"dl gap",children:"⋯"},h):s.jsxs("div",{className:"dl "+d.kind,children:[d.kind==="add"?"+ ":d.kind==="del"?"- ":" ",d.text]},h))})]})}function tj({req:l,onAnswer:o,onDismiss:c}){const[u,d]=A.useState(()=>l.questions.map(()=>[])),[h,m]=A.useState(()=>l.questions.map(()=>""));function y(g,b,x){d(k=>k.map((L,V)=>V!==g?L:x?L.includes(b)?L.filter(z=>z!==b):[...L,b]:L[0]===b?[]:[b])),x||m(k=>k.map((L,V)=>V===g?"":L))}const v=l.questions.map((g,b)=>{const x=h[b].trim();return!g.multiple&&x?[x]:x?[...u[b],x]:u[b]}),S=v.every(g=>g.length>0);return s.jsxs("div",{className:"question-card",children:[s.jsxs("div",{className:"perm-title",children:["The agent has a question",l.subagent&&s.jsxs("span",{className:"perm-sub",children:["subagent · ",l.subagent]})]}),l.questions.map((g,b)=>s.jsxs("div",{className:"q-block",children:[g.header&&s.jsx("span",{className:"q-header",children:g.header}),s.jsx("div",{className:"q-text",children:g.question}),g.multiple&&s.jsx("div",{className:"hint",style:{marginTop:0},children:"Choose any that apply."}),s.jsx("div",{className:"q-options",role:g.multiple?"group":"radiogroup",children:g.options.map(x=>{const k=u[b].includes(x.label);return s.jsxs("button",{className:"q-option"+(k?" on":""),role:g.multiple?"checkbox":"radio","aria-checked":k,onClick:()=>y(b,x.label,g.multiple),children:[s.jsx("span",{className:"q-mark"+(g.multiple?" box":""),"aria-hidden":!0,children:k?"✓":""}),s.jsx("span",{className:"q-label",children:x.label}),x.description&&s.jsx("span",{className:"q-desc",children:x.description})]},x.label)})}),g.custom!==!1&&s.jsx("input",{type:"text",className:"q-custom",placeholder:"Or type your own answer…",value:h[b],onChange:x=>{const k=x.target.value;m(L=>L.map((V,z)=>z===b?k:V)),!g.multiple&&k.trim()&&d(L=>L.map((V,z)=>z===b?[]:V))},onKeyDown:x=>{x.key==="Enter"&&S&&o(v)}})]},b)),s.jsxs("div",{className:"perm-actions",children:[s.jsx("button",{className:"btn primary sm",disabled:!S,onClick:()=>o(v),children:"Send answer"}),s.jsx("button",{className:"btn sm",onClick:c,children:"Dismiss"})]})]})}const nj={build:"Edits files and runs commands. You approve each change.",plan:"Read-only. Explores the code and writes a plan."};function aj(l,o){return[{kind:"p",text:`./bxh --project ${l} --agent ${o}`,pace:26},{kind:"out",text:"Loading project context..."},{kind:"out",text:nj[o],pace:18},{kind:"ok",text:"Agent ready ",ok:"OK"}]}const lj=["Summarise the architecture of this project.","Find and explain the main entry points.","Review this project against the OWASP Top 10:2025 and report findings with ids and fixes.","Map every place this code calls a model or runs an agent, and assess it against the OWASP LLM and Agentic Top 10 and ATLAS.","/init"],sj=80;function ij({status:l,statusError:o,directory:c,model:u,setModel:d,resume:h,onActiveSession:m,onSessionsChanged:y}){const[v,S]=A.useState("build"),[g,b]=A.useState(null),[x,k]=A.useState([]),[L,V]=A.useState([]),[z,Z]=A.useState([]),[oe,de]=A.useState([]),[C,Y]=A.useState(!1),[O,X]=A.useState(!1),[F,ie]=A.useState(null),[G,Q]=A.useState(null),[K,me]=A.useState(null),[ve,Ce]=A.useState([]),[ne,te]=A.useState(null),[ce,ee]=A.useState(!0),[ke,Ze]=A.useState(null),[bt,kt]=A.useState(!1),j=A.useRef(!1),[ae,je]=A.useState([]),pe=A.useRef([]),Ie=A.useRef(0),Oe=A.useRef(!1),ze=A.useRef(()=>{}),Se=A.useRef({}),_e=A.useRef(""),mt=A.useRef(0),D=A.useRef(null),we=A.useRef(null),he=A.useRef(!0);A.useEffect(()=>{HS(c).then(Ce).catch(()=>{}),zT(c,["/workspace"])},[c]);function Be(){const B=we.current;if(!B)return;const ue=B.scrollHeight-B.scrollTop-B.clientHeight<sj;he.current=ue,ee(ue)}function Ee(B=!0){const ue=we.current;ue&&(he.current=!0,ee(!0),ue.scrollTo({top:ue.scrollHeight,behavior:B?"smooth":"auto"}))}A.useEffect(()=>{var B;he.current&&((B=we.current)==null||B.scrollTo({top:we.current.scrollHeight}))},[x,L,z]);const le=A.useCallback((B,ue,Ae)=>{k(De=>{const Ye=De.slice();let Qe=Ye.findIndex(jt=>jt.id===B);Qe===-1&&(Ye.push({id:B,role:"assistant",parts:[]}),Qe=Ye.length-1);const Pe={...Ye[Qe],parts:Ye[Qe].parts.slice()};return Ae&&(Pe.subagent=Ae),ue(Pe),Ye[Qe]=Pe,Ye})},[]),Te=A.useCallback(B=>{switch(B.kind){case"message":Se.current[B.messageID]=B.role,B.role==="assistant"&&le(B.messageID,ue=>{ue.tokens=B.tokens,ue.cost=B.cost,ue.model=B.model},B.subagent);break;case"text":case"reasoning":{const ue=Se.current[B.messageID];if(ue==="user"||!ue&&B.text.trim()===_e.current.trim())break;const Ae=B.partID??`${B.kind}-${B.messageID}`;le(B.messageID,De=>{const Ye=De.parts.findIndex(Pe=>Pe.type===B.kind&&"id"in Pe&&Pe.id===Ae),Qe={type:B.kind,id:Ae,text:B.text};Ye===-1?De.parts.push(Qe):De.parts[Ye]=Qe},B.subagent);break}case"tool":le(B.messageID,ue=>{const Ae=ue.parts.findIndex(Ye=>Ye.type==="tool"&&Ye.callID===B.callID),De={type:"tool",callID:B.callID,tool:B.tool,status:B.status,title:B.title,input:B.input,output:B.output,error:B.error};Ae===-1?ue.parts.push(De):ue.parts[Ae]={...ue.parts[Ae],...De}},B.subagent);break;case"todo":de(B.todos);break;case"session":y();break;case"permission":V(ue=>ue.some(Ae=>Ae.permissionID===B.permissionID)?ue:[...ue,B]);break;case"permission-replied":V(ue=>ue.filter(Ae=>Ae.permissionID!==B.permissionID));break;case"question":Z(ue=>ue.some(Ae=>Ae.requestID===B.requestID)?ue:[...ue,{requestID:B.requestID,questions:B.questions,subagent:B.subagent}]);break;case"question-closed":Z(ue=>ue.filter(Ae=>Ae.requestID!==B.requestID));break;case"idle":k(ue=>ue.map(oj)),y(),j.current||ze.current();break;case"error":ie(B.message),j.current||ze.current();break}},[le,y]);function be(){var B;(B=D.current)==null||B.abort(),D.current=null,b(null),k([]),V([]),Z([]),de([]),ie(null),Q(null),Y(!1),Ze(null),j.current=!1,pe.current=[],$e(),Oe.current=!1,Se.current={},he.current=!0,ee(!0)}function qe(B){var Ae;(Ae=D.current)==null||Ae.abort();const ue=new AbortController;D.current=ue,ZS(B,c,Te,ue.signal,()=>q(B,ue)).catch(De=>{(De==null?void 0:De.name)!=="AbortError"&&ie(String((De==null?void 0:De.message)??De))}),q(B,ue)}function q(B,ue){$S(B,c).then(({permissions:Ae,questions:De})=>{ue.signal.aborted||(Ae.length&&(V(Ye=>{const Qe=new Set(Ye.map(Pe=>Pe.permissionID));return[...Ye,...Ae.filter(Pe=>!Qe.has(Pe.permissionID))]}),Y(!0)),De.length&&(Z(Ye=>{const Qe=new Set(Ye.map(Pe=>Pe.requestID));return[...Ye,...De.filter(Pe=>!Qe.has(Pe.requestID)).map(Pe=>({requestID:Pe.requestID,questions:Pe.questions,subagent:Pe.subagent}))]}),Y(!0)))}).catch(()=>{})}async function Re(){if(g)return g;const B=await GS(c);return b(B.id),m(B.id),qe(B.id),B.id}function He(){be(),m(null)}A.useEffect(()=>{if(!h)return;if(!h.id){He();return}const B=h.id;be(),X(!0),zS(B,c).then(({messages:ue,todos:Ae})=>{for(const De of ue)Se.current[De.id]=De.role;k(ue.map(rj)),de(Ae??[]),b(B),m(B),qe(B),$y(B).then(pt).catch(()=>{}),requestAnimationFrame(()=>Ee(!1))}).catch(ue=>ie(String(ue.message??ue))).finally(()=>X(!1))},[h==null?void 0:h.n]);function pt(B){Ze(B),(B==null?void 0:B.status)==="running"&&(j.current=!0,Oe.current=!0,Y(!0))}async function Ve(B){ie(null),Q(null);const ue=await Re(),Ae=await FS({sessionID:ue,directory:c,...B,authorised:!0}),De=`local-${mt.current++}`,Ye=`Supervised recon of ${B.scope} (${B.env.kind})
302
+ ${B.objective}`;k(Qe=>[...Qe,{id:De,role:"user",parts:[{type:"text",id:De,text:Ye}]}]),pt(Ae),Ee()}const ht=(ke==null?void 0:ke.status)==="running";A.useEffect(()=>{if(!ht||!g)return;const B=setInterval(()=>{$y(g).then(ue=>{ue&&(Ze(ue),ue.status!=="running"&&(j.current=!1,ze.current(),y()))}).catch(()=>{})},2500);return()=>clearInterval(B)},[ht,g,y]);const $e=()=>je([...pe.current]);function Vt(B,ue=[]){if(!(!B.trim()&&!ue.length)){if(Oe.current){pe.current.push({id:Ie.current++,text:B,files:ue}),$e(),Ee();return}Bn(B,ue)}}function ea(B){pe.current=pe.current.filter(ue=>ue.id!==B),$e()}function fa(){if(Oe.current)return;const B=pe.current.shift();$e(),B&&Bn(B.text,B.files)}const gn=A.useRef(!1);function wn(){Oe.current=!1,Y(!1),!gn.current&&(gn.current=!0,requestAnimationFrame(()=>{gn.current=!1,fa()}))}ze.current=wn;async function Bn(B,ue=[]){const Ae=B.trim();ie(null),Q(null),Ee();const De=/^\/(\S+)(?:\s+([\s\S]*))?$/.exec(Ae);if(De&&!ue.length){await ka(De[1].toLowerCase(),(De[2]??"").trim()),Oe.current||fa();return}try{Oe.current=!0;const Ye=await Re();_e.current=Ae;const Qe=`local-${mt.current++}`,Pe=ue.map((Wt,Mn)=>({type:"file",id:`${Qe}-f${Mn}`,filename:Wt.name,mime:Wt.mime,url:Wt.preview,size:Wt.size}));k(Wt=>[...Wt,{id:Qe,role:"user",parts:[...Ae?[{type:"text",id:Qe,text:Ae}]:[],...Pe]}]),Y(!0);const jt=l==null?void 0:l.models.find(Wt=>Wt.id===u);await XS({sessionID:Ye,text:Ae,agent:v,model:u,directory:c,files:ue.map(({name:Wt,mime:Mn,data:hl})=>({name:Wt,mime:Mn,data:hl})),inlineImages:!!(jt!=null&&jt.images)})}catch(Ye){ie(String(Ye.message??Ye)),wn()}}async function ka(B,ue){switch(B){case"new":He();return;case"plan":case"build":S(B),Q(`Switched to the ${B} agent.`);return;case"help":{const Ae=[...$c,...ve.filter(De=>!$c.some(Ye=>Ye.name===De.name))];Q(Ae.map(De=>`/${De.name}${De.hint?" "+De.hint:""} — ${De.description}`).join(`
303
+ `));return}case"model":{const Ae=ue.toLowerCase(),De=(l==null?void 0:l.models)??[],Ye=Ae&&(De.find(Qe=>Qe.id.toLowerCase()===Ae||Qe.name.toLowerCase()===Ae)??De.find(Qe=>Qe.id.toLowerCase().includes(Ae)||Qe.name.toLowerCase().includes(Ae)));if(!Ye){ie(Ae?`No model matches “${ue}”.`:"Usage: /model <name>, e.g. /model kimi");return}d(Ye.id),Q(`Model: ${Ye.name}`);return}case"compact":if(!g){ie("Nothing to compact yet.");return}try{Oe.current=!0,Y(!0),await IS(g,c,u),Q("Compacting the conversation…")}catch(Ae){ie(String(Ae.message??Ae)),wn()}return}if(!ve.some(Ae=>Ae.name===B)){ie(`Unknown command /${B}. Type / to see the list.`);return}try{const Ae=await Re(),De=`local-${mt.current++}`,Ye=`/${B}${ue?" "+ue:""}`;_e.current=Ye,k(Qe=>[...Qe,{id:De,role:"user",parts:[{type:"text",id:De,text:Ye}]}]),Oe.current=!0,Y(!0),await BS({sessionID:Ae,command:B,arguments:ue,agent:v,model:u,directory:c})}catch(Ae){ie(String(Ae.message??Ae)),wn()}}async function An(B,ue){V(Ae=>Ae.filter(De=>De.permissionID!==B.permissionID));try{await YS({sessionID:B.sessionID,permissionID:B.permissionID,response:ue,directory:c})}catch(Ae){ie(String(Ae.message??Ae))}}async function nn(B,ue){Z(Ae=>Ae.filter(De=>De.requestID!==B.requestID));try{await VS(ue?{requestID:B.requestID,answers:ue,directory:c}:{requestID:B.requestID,reject:!0,directory:c})}catch(Ae){ie(String(Ae.message??Ae))}}async function yt(){if(pe.current=[],$e(),j.current&&g){await JS(g).catch(()=>{});return}Oe.current=!1,Y(!1),g&&await QS(g,c).catch(()=>{})}async function Ga(){if(!g)return;const B=await KS(g,c);me(Array.isArray(B)||typeof B=="string"?B:B?JSON.stringify(B,null,2):[])}A.useEffect(()=>()=>{var B;return(B=D.current)==null?void 0:B.abort()},[]);const yn=c.split(/[\\/]/).filter(Boolean).pop()??c,vn=A.useMemo(()=>x.reduce((B,ue)=>{var Ae,De;return B+(((Ae=ue.tokens)==null?void 0:Ae.input)??0)+(((De=ue.tokens)==null?void 0:De.output)??0)},0),[x]),Cn=L.length>0||z.length>0;return s.jsxs("main",{className:"main",children:[s.jsxs(Bo,{title:`bugxhunter@redteam: ~/${yn}`,tooltip:c,children:[s.jsxs("span",{className:"status-pill"+(C?" live":""),children:[s.jsx("span",{className:"dot"}),C?Cn?"waiting for you":"running":g?"idle":"ready"]}),vn>0&&s.jsxs("span",{className:"token-pill",children:[Ai(vn)," tokens"]}),s.jsx("button",{className:"btn ghost sm",onClick:()=>kt(!0),disabled:C||!(l!=null&&l.ready),title:"Supervised recon: test one target round after round, approving anything that is not a read-only request",children:"recon"}),s.jsx("button",{className:"btn ghost sm",onClick:Ga,disabled:!g,children:"changes"}),s.jsx("button",{className:"btn ghost sm",onClick:He,disabled:C,children:"new_session"})]}),s.jsxs("div",{className:"transcript-wrap",children:[s.jsx("div",{className:"transcript grid-bg",ref:we,onScroll:Be,children:s.jsxs("div",{className:"transcript-inner",children:[O&&s.jsx("p",{className:"muted center mono",children:"Loading session…"}),!O&&x.length===0&&s.jsxs("div",{className:"empty-state",children:[s.jsx(Iv,{lines:aj(yn,v)},`${yn}:${v}`),s.jsx("div",{className:"suggestions",children:lj.map(B=>s.jsx("button",{className:"chip",onClick:()=>B.startsWith("/")?Vt(B):te(B),children:B==="/init"?"/init — create AGENTS.md, the project's memory for future sessions":B},B))}),o&&s.jsx("div",{className:"error-banner",children:o})]}),x.map(B=>s.jsx(cj,{msg:B},B.id)),ke&&s.jsx($k,{recon:ke}),L.map(B=>s.jsxs("div",{className:"perm-card",children:[s.jsxs("div",{className:"perm-title",children:["Approval needed",B.subagent&&s.jsxs("span",{className:"perm-sub",children:["subagent · ",B.subagent]})]}),s.jsxs("div",{className:"perm-body",children:[s.jsx("span",{className:"perm-type",children:B.permType??"action"})," ",B.title??(Array.isArray(B.pattern)?B.pattern.join(", "):B.pattern)??""]}),s.jsxs("div",{className:"perm-actions",children:[s.jsx("button",{className:"btn primary sm",onClick:()=>An(B,"once"),children:"Approve"}),!ht&&s.jsx("button",{className:"btn sm",onClick:()=>An(B,"always"),children:"Always allow"}),s.jsx("button",{className:"btn sm danger-outline",onClick:()=>An(B,"reject"),children:"Reject"})]})]},B.permissionID)),z.map(B=>s.jsx(tj,{req:B,onAnswer:ue=>nn(B,ue),onDismiss:()=>nn(B,null)},B.requestID)),C&&!Cn&&s.jsxs("div",{className:"working",children:[s.jsx("span",{}),s.jsx("span",{}),s.jsx("span",{})]}),ae.map(B=>s.jsx("div",{className:"msg user",children:s.jsxs("div",{className:"user-col",children:[s.jsx("div",{className:"bubble user-bubble queued-bubble",children:B.text||`(${B.files.length} file${B.files.length>1?"s":""})`}),s.jsxs("div",{className:"queued-label",children:["queued · ",s.jsx("button",{className:"link-btn",onClick:()=>ea(B.id),children:"cancel"})]})]})},B.id)),G&&s.jsx("div",{className:"notice",children:G}),F&&s.jsx("div",{className:"error-banner",children:F})]})}),!ce&&s.jsx("button",{className:"jump-btn",onClick:()=>Ee(),"aria-label":"Scroll to latest",children:"↓ latest"})]}),s.jsxs("div",{className:"composer",children:[ke&&s.jsx(qk,{recon:ke,onStop:yt,onDismiss:()=>Ze(null)}),s.jsx(Zk,{todos:oe}),s.jsx(Vk,{agent:v,setAgent:S,model:u,setModel:d,models:(l==null?void 0:l.models)??[],commands:ve,busy:C,onSend:Vt,onStop:yt,draft:ne,onDraftUsed:A.useCallback(()=>te(null),[])})]}),K!==null&&s.jsx(Wk,{diff:K,onClose:()=>me(null)}),bt&&s.jsx(Ik,{onStart:Ve,onClose:()=>kt(!1)})]})}function oj(l){return l.parts.some(o=>o.type==="tool"&&(o.status==="running"||o.status==="pending"))?{...l,parts:l.parts.map(o=>o.type==="tool"&&(o.status==="running"||o.status==="pending")?{...o,status:"interrupted"}:o)}:l}function rj(l){return{id:l.id,role:l.role,parts:l.parts,tokens:l.tokens,cost:l.cost,model:l.model,error:l.error,subagent:l.subagent}}function cj({msg:l}){if(l.role==="user"){const o=l.parts.map(u=>u.type==="text"?u.text:"").join(""),c=l.parts.filter(u=>u.type==="file");return s.jsx("div",{className:"msg user",children:s.jsxs("div",{className:"user-col",children:[c.length>0&&s.jsx("div",{className:"attach-row right",children:c.map(u=>s.jsxs("span",{className:"attach-chip",title:u.filename,children:[u.url?s.jsx("img",{src:u.url,alt:""}):s.jsx("span",{className:"attach-icon",children:s.jsx(fh,{})}),s.jsx("span",{className:"attach-name",children:u.filename}),u.size?s.jsx("span",{className:"attach-size",children:zo(u.size)}):null]},u.id))}),o&&s.jsx("div",{className:"bubble user-bubble",children:o})]})})}return!l.parts.length&&!l.error?null:s.jsxs("div",{className:"msg assistant"+(l.subagent?" subagent":""),children:[s.jsx("div",{className:"avatar","aria-hidden":!0,children:l.subagent?"↳":"▶"}),s.jsxs("div",{className:"msg-body",children:[l.subagent&&s.jsxs("div",{className:"subagent-tag",title:l.subagent,children:["subagent · ",l.subagent]}),l.parts.map((o,c)=>o.type==="tool"?s.jsx(dj,{t:o},o.callID):o.type==="reasoning"?s.jsx(uj,{text:o.text},o.id):o.type==="text"?s.jsx(Ic,{text:o.text,files:!0},o.id):s.jsx("span",{},o.id??c)),l.error&&s.jsx("div",{className:"error-banner",children:l.error}),l.tokens&&(l.tokens.output??0)>0&&s.jsxs("div",{className:"msg-meta",children:[l.model&&s.jsx("span",{children:l.model}),s.jsxs("span",{children:[Ai(l.tokens.input??0)," in · ",Ai(l.tokens.output??0)," out"]}),l.cost?s.jsxs("span",{children:["$",l.cost.toFixed(4)]}):null]})]})]})}function uj({text:l}){const[o,c]=A.useState(!1);return s.jsxs("div",{className:"reasoning",children:[s.jsxs("button",{className:"reasoning-toggle",onClick:()=>c(u=>!u),children:[s.jsx("span",{className:"chev"+(o?" open":""),children:"›"})," Thinking"]}),o&&s.jsx("div",{className:"reasoning-body",children:l})]})}function dj({t:l}){const[o,c]=A.useState(!1),u=l.title||(l.input?String(Object.values(l.input)[0]??""):""),d=!!(l.output||l.error);return s.jsxs("div",{className:"tool s-"+l.status,children:[s.jsxs("button",{className:"tool-head",onClick:()=>d&&c(h=>!h),disabled:!d,children:[s.jsx("span",{className:"tool-icon",children:s.jsx(i1,{tool:l.tool})}),s.jsx("span",{className:"tool-name",children:l.tool}),s.jsx("span",{className:"tool-summary",children:u.slice(0,120)}),s.jsx("span",{className:"tool-state",children:l.status==="running"||l.status==="pending"?s.jsx("span",{className:"spin"}):l.status==="error"?"failed":l.status==="interrupted"?"interrupted":""}),d&&s.jsx("span",{className:"chev"+(o?" open":""),children:"›"})]}),o&&d&&s.jsx("pre",{className:"tool-output",children:s.jsx(d0,{text:l.error?"error: "+l.error:String(l.output??"")})})]})}const _v="or_playground_config",Lf="or_runner",Rv="or_mode",Ov="or_layout",Dv=320,fj=240,hj=560,mj={name:"Assistant",model:"GLM-5.3",system:"You are a helpful, concise assistant.",temperature:.7,maxTokens:4096,topP:1,jsonMode:!1,stream:!0,tools:[],useKnowledge:!1,speak:!1,saveSessions:!0};function kc(l,o){try{const c=localStorage.getItem(l);if(c)return{...o,...JSON.parse(c)}}catch{}return o}function zf(l,o){try{localStorage.setItem(l,JSON.stringify(o))}catch{}}function pj(){const[l,o]=A.useState(()=>{try{return localStorage.getItem(Rv)||"runner"}catch{return"runner"}}),[c,u]=A.useState(null),[d,h]=A.useState(null),[m,y]=A.useState(()=>kc(Lf,{directory:"",model:"",recent:[]}));A.useEffect(()=>{qS().then(async le=>{u(le);const Te=kc(Lf,{directory:"",model:"",recent:[]}).directory,be=Te?await zv(Te).catch(()=>le.directory):le.directory;y(qe=>({...qe,directory:be,model:le.models.some(q=>q.id===qe.model)?qe.model:le.defaultModel}))}).catch(le=>h(String(le.message??le)))},[]),A.useEffect(()=>zf(Lf,m),[m]),A.useEffect(()=>{try{localStorage.setItem(Rv,l)}catch{}},[l]);const[v,S]=A.useState(null),[g,b]=A.useState(null),[x,k]=A.useState(0),L=le=>{o("runner"),b(Te=>({id:le,n:((Te==null?void 0:Te.n)??0)+1}))},V=A.useCallback(()=>k(le=>le+1),[]),[z,Z]=A.useState(()=>kc(Ov,{width:Dv,collapsed:!1}));A.useEffect(()=>zf(Ov,z),[z]);const oe=()=>Z(le=>({...le,collapsed:!le.collapsed}));A.useEffect(()=>{const le=Te=>{(Te.ctrlKey||Te.metaKey)&&Te.key.toLowerCase()==="b"&&(Te.preventDefault(),oe())};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[]);function de(le){le.preventDefault();const Te=le.currentTarget;Te.setPointerCapture(le.pointerId),document.body.classList.add("resizing");const be=q=>Z(Re=>({...Re,width:Math.round(Math.min(hj,Math.max(fj,q.clientX)))})),qe=()=>{Te.removeEventListener("pointermove",be),Te.removeEventListener("pointerup",qe),document.body.classList.remove("resizing")};Te.addEventListener("pointermove",be),Te.addEventListener("pointerup",qe)}function C(le){S(null),b(null),y(Te=>({...Te,directory:le,recent:[le,...Te.recent.filter(be=>be!==le)].slice(0,8)}))}function Y(le){y(Te=>({...Te,recent:Te.recent.filter(be=>be!==le)}))}const[O,X]=A.useState(()=>{const le=kc(_v,mj);return{...le,tools:iw(le.tools??[])}}),[F,ie]=A.useState([]),[G,Q]=A.useState(null),[K,me]=A.useState([]),[ve,Ce]=A.useState(!1),[ne,te]=A.useState(null),[ce,ee]=A.useState("chat"),ke=A.useRef(null);A.useEffect(()=>{MS().then(le=>{ie(le),X(Te=>{var be;return le.some(qe=>qe.id===Te.model)?Te:{...Te,model:((be=le[0])==null?void 0:be.id)??Te.model}})}).catch(le=>Q(String(le.message??le)))},[]),A.useEffect(()=>zf(_v,O),[O]);const Ze=A.useMemo(()=>F.find(le=>le.id===O.model),[F,O.model]),[bt,kt]=A.useState(null),[j,ae]=A.useState(null),[je,pe]=A.useState(null),Ie=A.useRef(null),Oe=A.useRef(null),ze=A.useCallback(()=>{Cc("chat").then(le=>ae(le)).catch(le=>pe({ok:!1,text:String(le.message??le)}))},[]);A.useEffect(()=>{l==="playground"&&ze()},[l,ze]),A.useEffect(()=>{var qe,q,Re;if(ve||!O.saveSessions||K===Ie.current)return;const le=K.find(He=>He.role==="user");if(!le)return;Ie.current=K;const Te=Oe.current??_o();Oe.current=Te,kt(Te);const be=(((qe=le.content)==null?void 0:qe.trim())||((q=le.docs)!=null&&q.length?`${le.docs[0].kind==="text"?"File":"Diagram"} review: ${le.docs[0].name}`:(Re=le.images)!=null&&Re.length?"Image review":"Chat")).replace(/\s+/g," ").slice(0,80);Mc("chat",Te,be,{v:1,model:O.model,system:O.system,messages:K}).then(()=>{pe({ok:!0,text:"Saved, encrypted with your vault"}),ze()}).catch(He=>pe({ok:!1,text:`Not saved: ${String(He.message??He)}`}))},[ve,K,O.saveSessions,O.model,O.system,ze]);async function Se(le){var Te;if(!ve)try{const be=await Pf("chat",le),qe=Array.isArray((Te=be.body)==null?void 0:Te.messages)?be.body.messages:[];Ie.current=qe,Oe.current=le,kt(le),me(qe),te(null),ee("chat"),X(q=>({...q,...be.body.model&&F.some(Re=>Re.id===be.body.model)?{model:be.body.model}:{},...typeof be.body.system=="string"?{system:be.body.system}:{}}))}catch(be){pe({ok:!1,text:String(be.message??be)})}}async function _e(le){try{await M0("chat",le),Oe.current===le&&Ee(),ze()}catch(Te){pe({ok:!1,text:String(Te.message??Te)})}}function mt(le){var be;const Te=[];O.system.trim()&&Te.push({role:"system",content:O.system});for(const qe of le)qe.role==="assistant"&&((be=qe.tool_calls)!=null&&be.length)?Te.push({role:"assistant",content:qe.content??"",tool_calls:qe.tool_calls}):qe.role==="tool"?Te.push({role:"tool",content:qe.content,tool_call_id:qe.tool_call_id}):Te.push({role:qe.role,content:qe.role==="user"?Eh(qe.content,qe.images,qe.docs):qe.content});return Te}async function D(le){Ce(!0),te(null);const Te=new AbortController;ke.current=Te;const be=le.length;me([...le,{role:"assistant",content:""}]);const qe=O.tools.length?ow(O.tools):void 0;let q="";const Re=performance.now();let He;const pt=()=>me(Ve=>{const ht=[...Ve],$e=ht[be];return $e&&(ht[be]={...$e,timing:{ttft:He,total:performance.now()-Re}}),ht});await eh({model:O.model,messages:mt(le),temperature:O.temperature,top_p:O.topP,max_tokens:O.maxTokens,reasoning_effort:th(O.reasoningEffort,F.find(Ve=>Ve.id===O.model)),tools:qe,response_format:O.jsonMode?{type:"json_object"}:void 0,rag:O.useKnowledge,stream:O.stream},{signal:Te.signal,onDelta:Ve=>{He??(He=performance.now()-Re),q+=Ve,me(ht=>{const $e=[...ht],Vt=$e[be];return $e[be]={...Vt,content:(Vt.content??"")+Ve},$e})},onToolCalls:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],tool_calls:Ve},$e}),onSources:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],sources:Ve},$e}),onUsage:Ve=>me(ht=>{const $e=[...ht];return $e[be]={...$e[be],usage:Ve},$e}),onError:Ve=>te(Ve),onDone:Ve=>{pt(),Ve==="length"&&me(ht=>{const $e=[...ht];return $e[be]&&($e[be]={...$e[be],finish:Ve}),$e}),O.speak&&q.trim()&&cw(q)}}).catch(Ve=>{(Ve==null?void 0:Ve.name)!=="AbortError"&&te(String((Ve==null?void 0:Ve.message)??Ve))}),Ce(!1),ke.current=null}function we(le,Te,be){if(!le.trim()&&!(Te!=null&&Te.length)&&!(be!=null&&be.length)||ve)return;const qe=[...K,{role:"user",content:le,...Te!=null&&Te.length?{images:Te}:{},...be!=null&&be.length?{docs:be}:{}}];me(qe),D(qe)}function he(le,Te){const be=[...K,{role:"tool",tool_call_id:le.id,content:Te}];me(be),D(be)}function Be(){var le;(le=ke.current)==null||le.abort(),uw(),Ce(!1)}function Ee(){Be(),me([]),te(null),Oe.current=null,kt(null),Ie.current=null}return s.jsxs("div",{className:"app"+(z.collapsed?" collapsed":""),style:{"--sidebar-w":`${z.width}px`},children:[z.collapsed&&s.jsx("button",{className:"sidebar-toggle floating",onClick:oe,title:"Show sidebar (Ctrl+B)","aria-label":"Show sidebar",children:"»"}),s.jsx(q1,{onCollapse:oe,sessions:{active:v,version:x,open:L},mode:l,setMode:o,runner:m,status:c,statusError:d,onOpenDirectory:C,onForgetDirectory:Y,config:O,setConfig:X,models:F,modelError:G,activeModel:Ze,onReset:Ee,saved:{list:j,activeId:bt,status:je,onOpen:le=>void Se(le),onDelete:le=>void _e(le)}}),s.jsx("div",{className:"splitter",role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize · double-click to reset",onPointerDown:de,onDoubleClick:()=>Z(le=>({...le,width:Dv}))}),l==="runner"?m.directory?s.jsx(ij,{status:c,statusError:d,directory:m.directory,model:m.model||(c==null?void 0:c.defaultModel)||"",setModel:le=>y(Te=>({...Te,model:le})),resume:g,onActiveSession:S,onSessionsChanged:V},m.directory):s.jsx("main",{className:"main",children:s.jsx("div",{className:"transcript grid-bg",children:s.jsx("div",{className:"empty-state center",children:d?s.jsx("div",{className:"error-banner",children:d}):s.jsx("p",{className:"muted mono",children:"Starting OpenCode…"})})})}):ce==="compare"?s.jsx(sk,{config:O,models:F,onExit:()=>ee("chat")}):ce==="canvas"?s.jsx(_k,{config:O,models:F,onExit:()=>ee("chat")}):s.jsx(WT,{config:O,activeModel:Ze,messages:K,busy:ve,error:ne,onSend:we,onStop:Be,onReset:Ee,onToolResult:he,onCompare:()=>ee("compare"),onCanvas:()=>ee("canvas")})]})}const gj=window.fetch.bind(window);window.fetch=async(l,o)=>{const c=await gj(l,o),u=typeof l=="string"?l:l instanceof URL?l.pathname:l.url;return c.status===401&&u.startsWith("/api/")&&!u.startsWith("/api/auth/")&&c.headers.get("WWW-Authenticate")==="BXH-Passkey"&&window.dispatchEvent(new Event(If)),c};CS.createRoot(document.getElementById("root")).render(s.jsx(SS.StrictMode,{children:s.jsx(Ow,{children:s.jsx(pj,{})})}));