@cjhyy/code-shell-web 0.9.27 → 0.9.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/outputJournalRecovery.d.ts +28 -0
- package/dist/lib/outputJournalRecovery.js +148 -0
- package/dist/lib/streamReducer.d.ts +1 -0
- package/dist/lib/streamReducer.js +11 -1
- package/dist/lib/transcriptReplay.d.ts +2 -7
- package/dist/lib/transcriptReplay.js +3 -85
- package/dist/lib/userMessageDisplay.d.ts +17 -0
- package/dist/lib/userMessageDisplay.js +130 -0
- package/dist-app/assets/index-Do7zJ7tU.js +57 -0
- package/dist-app/index.html +1 -1
- package/package.json +3 -3
- package/dist-app/assets/index-BvtE7Xk1.js +0 -57
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))a(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const o of f.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&a(o)}).observe(document,{childList:!0,subtree:!0});function l(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function a(c){if(c.ep)return;c.ep=!0;const f=l(c);fetch(c.href,f)}})();function ro(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jc={exports:{}},na={};var ag;function L0(){if(ag)return na;ag=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function l(a,c,f){var o=null;if(f!==void 0&&(o=""+f),c.key!==void 0&&(o=""+c.key),"key"in c){f={};for(var p in c)p!=="key"&&(f[p]=c[p])}else f=c;return c=f.ref,{$$typeof:t,type:a,key:o,ref:c!==void 0?c:null,props:f}}return na.Fragment=i,na.jsx=l,na.jsxs=l,na}var sg;function B0(){return sg||(sg=1,jc.exports=L0()),jc.exports}var u=B0(),kc={exports:{}},He={};var og;function U0(){if(og)return He;og=1;var t=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),o=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),v=Symbol.iterator;function x(O){return O===null||typeof O!="object"?null:(O=v&&O[v]||O["@@iterator"],typeof O=="function"?O:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,D={};function R(O,J,A){this.props=O,this.context=J,this.refs=D,this.updater=A||k}R.prototype.isReactComponent={},R.prototype.setState=function(O,J){if(typeof O!="object"&&typeof O!="function"&&O!=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,O,J,"setState")},R.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function z(){}z.prototype=R.prototype;function L(O,J,A){this.props=O,this.context=J,this.refs=D,this.updater=A||k}var G=L.prototype=new z;G.constructor=L,_(G,R.prototype),G.isPureReactComponent=!0;var se=Array.isArray;function T(){}var V={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function q(O,J,A){var ae=A.ref;return{$$typeof:t,type:O,key:J,ref:ae!==void 0?ae:null,props:A}}function E(O,J){return q(O.type,J,O.props)}function U(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function H(O){var J={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(A){return J[A]})}var Z=/\/+/g;function ee(O,J){return typeof O=="object"&&O!==null&&O.key!=null?H(""+O.key):J.toString(36)}function W(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(T,T):(O.status="pending",O.then(function(J){O.status==="pending"&&(O.status="fulfilled",O.value=J)},function(J){O.status==="pending"&&(O.status="rejected",O.reason=J)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function N(O,J,A,ae,pe){var te=typeof O;(te==="undefined"||te==="boolean")&&(O=null);var oe=!1;if(O===null)oe=!0;else switch(te){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(O.$$typeof){case t:case i:oe=!0;break;case b:return oe=O._init,N(oe(O._payload),J,A,ae,pe)}}if(oe)return pe=pe(O),oe=ae===""?"."+ee(O,0):ae,se(pe)?(A="",oe!=null&&(A=oe.replace(Z,"$&/")+"/"),N(pe,J,A,"",function(be){return be})):pe!=null&&(U(pe)&&(pe=E(pe,A+(pe.key==null||O&&O.key===pe.key?"":(""+pe.key).replace(Z,"$&/")+"/")+oe)),J.push(pe)),1;oe=0;var we=ae===""?".":ae+":";if(se(O))for(var F=0;F<O.length;F++)ae=O[F],te=we+ee(ae,F),oe+=N(ae,J,A,te,pe);else if(F=x(O),typeof F=="function")for(O=F.call(O),F=0;!(ae=O.next()).done;)ae=ae.value,te=we+ee(ae,F++),oe+=N(ae,J,A,te,pe);else if(te==="object"){if(typeof O.then=="function")return N(W(O),J,A,ae,pe);throw J=String(O),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return oe}function K(O,J,A){if(O==null)return O;var ae=[],pe=0;return N(O,ae,"","",function(te){return J.call(A,te,pe++)}),ae}function he(O){if(O._status===-1){var J=O._result;J=J(),J.then(function(A){(O._status===0||O._status===-1)&&(O._status=1,O._result=A)},function(A){(O._status===0||O._status===-1)&&(O._status=2,O._result=A)}),O._status===-1&&(O._status=0,O._result=J)}if(O._status===1)return O._result.default;throw O._result}var ge=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},j={map:K,forEach:function(O,J,A){K(O,function(){J.apply(this,arguments)},A)},count:function(O){var J=0;return K(O,function(){J++}),J},toArray:function(O){return K(O,function(J){return J})||[]},only:function(O){if(!U(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return He.Activity=y,He.Children=j,He.Component=R,He.Fragment=l,He.Profiler=c,He.PureComponent=L,He.StrictMode=a,He.Suspense=h,He.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,He.__COMPILER_RUNTIME={__proto__:null,c:function(O){return V.H.useMemoCache(O)}},He.cache=function(O){return function(){return O.apply(null,arguments)}},He.cacheSignal=function(){return null},He.cloneElement=function(O,J,A){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ae=_({},O.props),pe=O.key;if(J!=null)for(te in J.key!==void 0&&(pe=""+J.key),J)!X.call(J,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&J.ref===void 0||(ae[te]=J[te]);var te=arguments.length-2;if(te===1)ae.children=A;else if(1<te){for(var oe=Array(te),we=0;we<te;we++)oe[we]=arguments[we+2];ae.children=oe}return q(O.type,pe,ae)},He.createContext=function(O){return O={$$typeof:o,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:f,_context:O},O},He.createElement=function(O,J,A){var ae,pe={},te=null;if(J!=null)for(ae in J.key!==void 0&&(te=""+J.key),J)X.call(J,ae)&&ae!=="key"&&ae!=="__self"&&ae!=="__source"&&(pe[ae]=J[ae]);var oe=arguments.length-2;if(oe===1)pe.children=A;else if(1<oe){for(var we=Array(oe),F=0;F<oe;F++)we[F]=arguments[F+2];pe.children=we}if(O&&O.defaultProps)for(ae in oe=O.defaultProps,oe)pe[ae]===void 0&&(pe[ae]=oe[ae]);return q(O,te,pe)},He.createRef=function(){return{current:null}},He.forwardRef=function(O){return{$$typeof:p,render:O}},He.isValidElement=U,He.lazy=function(O){return{$$typeof:b,_payload:{_status:-1,_result:O},_init:he}},He.memo=function(O,J){return{$$typeof:g,type:O,compare:J===void 0?null:J}},He.startTransition=function(O){var J=V.T,A={};V.T=A;try{var ae=O(),pe=V.S;pe!==null&&pe(A,ae),typeof ae=="object"&&ae!==null&&typeof ae.then=="function"&&ae.then(T,ge)}catch(te){ge(te)}finally{J!==null&&A.types!==null&&(J.types=A.types),V.T=J}},He.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},He.use=function(O){return V.H.use(O)},He.useActionState=function(O,J,A){return V.H.useActionState(O,J,A)},He.useCallback=function(O,J){return V.H.useCallback(O,J)},He.useContext=function(O){return V.H.useContext(O)},He.useDebugValue=function(){},He.useDeferredValue=function(O,J){return V.H.useDeferredValue(O,J)},He.useEffect=function(O,J){return V.H.useEffect(O,J)},He.useEffectEvent=function(O){return V.H.useEffectEvent(O)},He.useId=function(){return V.H.useId()},He.useImperativeHandle=function(O,J,A){return V.H.useImperativeHandle(O,J,A)},He.useInsertionEffect=function(O,J){return V.H.useInsertionEffect(O,J)},He.useLayoutEffect=function(O,J){return V.H.useLayoutEffect(O,J)},He.useMemo=function(O,J){return V.H.useMemo(O,J)},He.useOptimistic=function(O,J){return V.H.useOptimistic(O,J)},He.useReducer=function(O,J,A){return V.H.useReducer(O,J,A)},He.useRef=function(O){return V.H.useRef(O)},He.useState=function(O){return V.H.useState(O)},He.useSyncExternalStore=function(O,J,A){return V.H.useSyncExternalStore(O,J,A)},He.useTransition=function(){return V.H.useTransition()},He.version="19.2.6",He}var ug;function Vf(){return ug||(ug=1,kc.exports=U0()),kc.exports}var q0=Vf();const w=ro(q0);let ba,lo=null;const I0=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,ib=/^\/p\/([0-9a-f-]{36})(\/.*)$/;function pa(t){return typeof t=="string"&&I0.test(t)}function Os(t){if(t!==null&&!pa(t))throw new Error("项目标识无效。");lo=t}function ma(){return lo}function $s(){return{workspace:ba??"",projectId:lo}}function Ls(t){ba=void 0}function Zs(){return ba}function cg(t=ba){return t?{"X-CodeShell-Workspace":encodeURIComponent(t)}:{}}function rb(t){return/^\/api\/v1\/(?:auth|projects|environment)(?:\/|\?|$)/.test(t)||/^\/api\/v1\/desktop\/session(?:\?|$)/.test(t)}function H0(t){const i=ib.exec(t);return!!i&&pa(i[1])}function yt(t,i=ba,l=lo){const a=ib.exec(t),c=a?a[2]:t;if(a&&!pa(a[1])||!c.startsWith("/api/v1/")&&c!=="/ws"||/[\\\r\n]/.test(t))throw new Error("Workspace URLs must use the local API");const f=new URL(c,"http://codeshell.invalid");if(f.pathname!==c.split(/[?#]/,1)[0])throw new Error("Workspace URLs must use the local API");if(rb(c))return c;if(a)return t;if(l!==null&&!pa(l))throw new Error("项目标识无效。");return i&&c.startsWith("/api/v1/")&&f.searchParams.set("workspace",i),`${l?`/p/${l}`:""}${f.pathname}${f.search}${f.hash}`}class Xe extends Error{constructor(i,l,a,c){super(i),this.status=l,this.code=a,this.retryAfterMs=c}status;code;retryAfterMs}async function Ue(t,i={},l){const a=l?cg(l.workspace):cg(),c={...i};if(Object.keys(a).length&&!rb(t)&&!H0(t)&&!t.includes("workspace=")){const p=new Headers(i.headers);for(const[h,g]of Object.entries(a))p.has(h)||p.set(h,g);c.headers=p}const f=await fetch(l?yt(t,l.workspace,l.projectId):yt(t,""),{...c,credentials:"same-origin",cache:"no-store"}),o=await f.json().catch(()=>({}));if(!f.ok){const p=typeof o.error=="string"?o.error:o.error?.message;throw new Xe(p??o.message??`请求失败(${f.status})`,f.status,typeof o.code=="string"?o.code:void 0,typeof o.retryAfterMs=="number"?o.retryAfterMs:void 0)}return o}function lb(t,i={}){return Ue(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}async function V0(){try{const t=await Ue("/api/v1/auth/status");if(typeof t.initialized!="boolean"||typeof t.authenticated!="boolean")throw new Error("服务端返回了无效的登录状态,请稍后重试。");return t}catch(t){if(t instanceof Xe&&t.status===404)return null;throw t}}function Y0(t,i){const l=new URLSearchParams(t.hash.replace(/^#/,"")),a=l.get("setup")??"";if(l.has("setup")){l.delete("setup");const c=l.toString();i.replaceState(i.state,"",`${t.pathname}${t.search}${c?`#${c}`:""}`)}return a}function va(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=crypto.getRandomValues(new Uint8Array(16));t[6]=t[6]&15|64,t[8]=t[8]&63|128;const i=Array.from(t,l=>l.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}async function G0(t,i={}){const l=i.scope??$s();return Ue(yt(`/api/v1/uploads/${va()}`,l.workspace,l.projectId),{method:"PUT",headers:{"Content-Type":t.type||"application/octet-stream","X-File-Name":encodeURIComponent(t.name)},body:t,signal:i.signal})}function F0(t){try{const i=new URL(t??"");return(i.protocol==="https:"||i.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(i.hostname))&&!i.username&&!i.password?i.href:void 0}catch{return}}function Cc(t,i){const l=t.authModes?.filter(a=>a.available&&(!i||a.methodId===i));return l?.find(a=>a.preferred)??l?.[0]}function mi(t){if(t.state==="pending"){if(t.step)return t.step;if(t.redirect)return{id:t.id,kind:"redirect",...t.redirect};if(t.prompt)return{id:t.id,kind:"device-code",...t.prompt}}}const Q0=new Set(["redirect","device-code","qr-code","credential-input","local-session","consent","processing"]);function X0(t,i){if(typeof t.id!="string"||!t.id||i&&t.id!==i)throw new Error("授权响应与当前连接不匹配。");if(!["pending","connected","failed","cancelled"].includes(t.state))throw new Error("无法识别授权状态,请更新客户端。");if(t.state==="connected"&&!t.connection)throw new Error("服务尚未确认连接已保存,请刷新后重试。");if(t.state==="connected"&&(t.connection?.providerId!==t.providerId||t.methodId&&t.connection.methodId!==t.methodId))throw new Error("保存的连接与当前授权不匹配。");const l=mi(t);if(t.state==="pending"&&(!l||!Q0.has(l.kind)))throw new Error("当前客户端不支持这个授权步骤,请更新客户端。");if(l&&(!l.id||!Number.isFinite(Date.parse(l.expiresAt))))throw new Error("授权步骤缺少有效期限,请重新连接。");if(t.expiresAt&&(!Number.isFinite(Date.parse(t.expiresAt))||l&&Date.parse(l.expiresAt)>Date.parse(t.expiresAt)))throw new Error("授权任务的有效期限无效,请重新连接。")}class K0{constructor(i,l={}){this.transport=i,this.options=l}transport;options;value={busy:!1};listeners=new Set;timer;generation=0;disposed=!1;binding;getSnapshot=()=>this.value;subscribe=i=>(this.listeners.add(i),()=>this.listeners.delete(i));publish(i){if(!this.disposed){this.value=i;for(const l of this.listeners)l()}}stop(){return clearTimeout(this.timer),++this.generation}current(i){return!this.disposed&&i===this.generation}deadline(i){const l=mi(i);return Math.min(i.expiresAt?Date.parse(i.expiresAt):1/0,l?Date.parse(l.expiresAt):1/0)}accept(i,l,a){if(this.current(l)){if(X0(i,a),this.binding&&(i.providerId!==this.binding.providerId||i.methodId&&i.methodId!==this.binding.methodId))throw new Error("授权响应与当前服务不匹配。");this.publish({authorization:i,busy:!1}),i.state==="pending"&&this.schedule(l)}}schedule(i,l=this.options.pollIntervalMs??2e3){const a=this.value.authorization;if(!this.current(i)||a?.state!=="pending")return;const c=this.deadline(a)-Date.now();if(c<=0){this.stop(),this.publish({busy:!1,authorization:{...a,state:"failed",step:void 0,prompt:void 0,redirect:void 0,errorCode:"authorization_expired"}}),this.transport.cancel(a.id).catch(()=>{});return}const f=mi(a),o=f&&["credential-input","local-session","consent"].includes(f.kind);this.timer=setTimeout(()=>{o?this.schedule(i):this.poll(i)},Math.min(l,c))}async poll(i){const l=this.value.authorization;if(!(!this.current(i)||l?.state!=="pending")){if(this.deadline(l)<=Date.now()){this.schedule(i);return}try{const a=await this.transport.status(l.id);this.accept(a,i,l.id)}catch(a){if(!this.current(i))return;this.publish({...this.value,busy:!1,error:Bs(a)});const c=a?.status;c!==401&&c!==404&&this.schedule(i,this.options.retryIntervalMs??4e3)}}}async begin(i,l){if(this.disposed||this.value.busy||this.value.authorization?.state==="pending")return;const a=this.stop();this.binding=i,this.publish({busy:!0});try{const c=await this.transport.begin(i,l);if(!this.current(a)){c.state==="pending"&&this.transport.cancel(c.id).catch(()=>{});return}try{this.accept(c,a)}catch(f){throw c.state==="pending"&&this.transport.cancel(c.id).catch(()=>{}),f}return c}catch(c){this.current(a)&&this.publish({busy:!1,error:Bs(c)})}}async respond(i){const l=this.value.authorization,a=l&&mi(l);if(this.disposed||this.value.busy||l?.state!=="pending"||!a||a.id!==i.stepId)return;if(this.deadline(l)<=Date.now()){this.schedule(this.generation);return}const c=this.stop();this.publish({authorization:l,busy:!0});try{const f=await this.transport.respond(l.id,i);return this.accept(f,c,l.id),this.current(c)?f:void 0}catch(f){this.current(c)&&(this.publish({authorization:l,busy:!1,error:Bs(f)}),this.timer=setTimeout(()=>{this.poll(c)},this.options.retryIntervalMs??4e3))}}async cancel(){const i=this.value.authorization,l=this.stop();if(i?.state!=="pending"){this.publish({busy:!1});return}this.publish({authorization:i,busy:!0});try{const a=await this.transport.cancel(i.id);if(!this.current(l))return;this.publish({busy:!1,authorization:a??{...i,state:"cancelled",step:void 0,prompt:void 0,redirect:void 0}})}catch(a){this.current(l)&&(this.publish({authorization:i,busy:!1,error:Bs(a)}),this.schedule(l,this.options.retryIntervalMs??4e3))}}clearError(){this.publish({...this.value,error:void 0})}reset(){this.value.busy||this.value.authorization?.state==="pending"||(this.stop(),this.publish({busy:!1}))}dispose(){const i=this.value.authorization;this.stop(),this.disposed=!0,this.listeners.clear(),i?.state==="pending"&&this.transport.cancel(i.id).catch(()=>{})}}function Bs(t){return t instanceof Error?t:new Error("连接操作失败,请重试。")}const jf="codeshell.remote-link.authorization.v1",Yf="/api/v1/links/authorizations/",kf="[a-f0-9-]{36}",$0=new RegExp(`^(?:/p/${kf})?${Yf}${kf}$`);function Gf(t){return t==="/link/callback"?"/":t==="/mobile/link/callback"?"/mobile/":void 0}function Z0(t,i){const l=new URL(t),a=new URL(i);if(l.origin!==a.origin||l.pathname!=="/oauth/authorize"||l.username||l.password||l.hash||l.protocol!=="https:"&&!(l.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(l.hostname)))throw new Error("授权地址无效,请检查 Link 服务配置。");return l}function P0(t,i,l,a=window.location.origin,c=window.sessionStorage){const f=mi(t);if(f?.kind!=="redirect"||!new RegExp(`^${kf}$`).test(t.id))throw new Error("授权请求无效。");const o=Z0(f.authorizationUrl,i),p=o.searchParams.get("state"),h=o.searchParams.get("redirect_uri"),g=Date.parse(f.expiresAt),b=h?Gf(new URL(h,a).pathname):void 0;if(!p||!h||!b||h!==`${a}${b}link/callback`||b==="/mobile/"&&l.projectId!==null||o.searchParams.getAll("state").length!==1||o.searchParams.getAll("redirect_uri").length!==1||!Number.isFinite(g)||g<=Date.now())throw new Error("授权回调地址或有效期无效,请检查服务配置。");const y=yt(Yf+t.id,l.workspace,l.projectId),v=new URLSearchParams({view:"links",...l.projectId?{project:l.projectId}:{},...b==="/mobile/"?{workspace:l.workspace}:{}});return c.setItem(jf,JSON.stringify({target:y,state:p,redirectUri:h,returnUrl:`${b}?${v}`,expiresAt:g,providerId:t.providerId})),o.href}function J0(t,i,l){const a=Gf(t.pathname);if(!a)return;const c=t.href;i.replaceState(i.state,"",t.pathname);try{const f=l.getItem(jf);l.removeItem(jf);const o=JSON.parse(f??"null");if(!o||!Number.isFinite(o.expiresAt)||o.expiresAt<=Date.now())throw new Error;const p=new URL(c),h=new URL(o.target,t.origin),g=new URL(o.returnUrl,t.origin);if(o.redirectUri!==`${t.origin}${t.pathname}`||p.origin!==t.origin||p.hash||p.searchParams.getAll("state").length!==1||p.searchParams.get("state")!==o.state||h.origin!==t.origin||!$0.test(h.pathname)||h.hash||h.username||h.password||[...h.searchParams.keys()].some(b=>b!=="workspace")||h.searchParams.getAll("workspace").length>1||g.origin!==t.origin||g.pathname!==a||g.username||g.password||g.hash||[...g.searchParams.keys()].some(b=>!(a==="/mobile/"?["workspace","view"]:["project","view"]).includes(b))||g.searchParams.getAll("view").length!==1||g.searchParams.get("view")!=="links"||a==="/mobile/"&&(!h.pathname.startsWith(Yf)||g.searchParams.getAll("workspace").length!==1||g.searchParams.get("workspace")!==(h.searchParams.get("workspace")??"")))throw new Error;return{callbackUrl:c,pending:o,denied:p.searchParams.has("error")}}catch{return{error:"找不到匹配的授权,或授权已过期。请返回原项目重新连接。",home:a}}}async function W0(t){const i=new URL(t.pending.target,window.location.origin),l=ab(i);return t.denied?(await Ue(t.pending.target,{method:"DELETE"},l),{id:"",providerId:t.pending.providerId??"",state:"cancelled"}):(i.pathname+="/complete",Ue(i.pathname+i.search,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({callbackUrl:t.callbackUrl})},l))}function ab(t){return{workspace:t.searchParams.get("workspace")??"",projectId:/^\/p\/([a-f0-9-]{36})\//.exec(t.pathname)?.[1]??null}}function e1(t){const i=new URL(t.pending.target,window.location.origin);return Ue(t.pending.target,{},ab(i))}function t1(){const t=Gf(window.location.pathname);if(t)try{return J0(window.location,window.history,window.sessionStorage)}catch{return window.history.replaceState(window.history.state,"",window.location.pathname),{error:"浏览器无法读取原授权记录。请允许此站点保存临时数据后重新连接。",home:t}}}function n1({callback:t}){const i=w.useRef(void 0),[l,a]=w.useState(),[c,f]=w.useState("error"in t?t.error:""),[o,p]=w.useState(!1),h=y=>f(y instanceof Xe&&y.status===401?"原登录已失效。请返回工作台登录,并重新发起授权。":y instanceof Error?y.message:"无法确认授权结果,请检查结果或返回项目重新连接。"),g=y=>{if(y.state==="connected"&&!y.connection){h(new Error("服务尚未确认连接已保存,请检查授权结果。"));return}a(y),f("")};w.useEffect(()=>{if("error"in t)return;let y=!0;return i.current??=W0(t),i.current.then(v=>{y&&g(v)},v=>{y&&h(v)}),()=>{y=!1}},[t]);const b=!l&&!c;return u.jsx("main",{className:"auth-page",children:u.jsxs("section",{className:"auth-card",children:[u.jsx("h1",{children:"Link 授权"}),b&&u.jsx("p",{role:"status",children:"正在确认授权并保存到原项目…"}),l?.state==="connected"&&u.jsxs("p",{role:"status",children:["已连接 ",l.connection?.account?.label??l.connection?.providerId,",授权已保存到原项目。"]}),l?.previousGrantRevocationPending&&u.jsx("p",{role:"alert",children:"新连接已保存。有遗留授权等待撤销,项目所在环境将自动重试,重启后仍会继续;也可在 Link 服务中撤销。"}),l?.state==="cancelled"&&u.jsx("p",{role:"status",children:"授权已取消,没有新增连接。"}),l?.state==="failed"&&u.jsx("p",{role:"alert",children:"授权未完成。请返回原项目重新连接。"}),l?.state==="pending"&&u.jsx("p",{role:"status",children:"服务端尚未确认完成。可以稍后检查结果,或返回项目重新发起授权。"}),c&&u.jsx("p",{className:"form-error",role:"alert",children:c}),!("error"in t)&&(c||l?.state==="pending")&&u.jsx("button",{disabled:o,onClick:()=>{o||(p(!0),e1(t).then(g,h).finally(()=>p(!1)))},children:o?"正在查询…":"检查授权结果"}),!b&&u.jsx("a",{href:"error"in t?t.home??"/":t.pending.returnUrl,children:"返回原项目"})]})})}var Ec={exports:{}},ia={},Nc={exports:{}},Ac={};var fg;function i1(){return fg||(fg=1,(function(t){function i(N,K){var he=N.length;N.push(K);e:for(;0<he;){var ge=he-1>>>1,j=N[ge];if(0<c(j,K))N[ge]=K,N[he]=j,he=ge;else break e}}function l(N){return N.length===0?null:N[0]}function a(N){if(N.length===0)return null;var K=N[0],he=N.pop();if(he!==K){N[0]=he;e:for(var ge=0,j=N.length,O=j>>>1;ge<O;){var J=2*(ge+1)-1,A=N[J],ae=J+1,pe=N[ae];if(0>c(A,he))ae<j&&0>c(pe,A)?(N[ge]=pe,N[ae]=he,ge=ae):(N[ge]=A,N[J]=he,ge=J);else if(ae<j&&0>c(pe,he))N[ge]=pe,N[ae]=he,ge=ae;else break e}}return K}function c(N,K){var he=N.sortIndex-K.sortIndex;return he!==0?he:N.id-K.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;t.unstable_now=function(){return f.now()}}else{var o=Date,p=o.now();t.unstable_now=function(){return o.now()-p}}var h=[],g=[],b=1,y=null,v=3,x=!1,k=!1,_=!1,D=!1,R=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function G(N){for(var K=l(g);K!==null;){if(K.callback===null)a(g);else if(K.startTime<=N)a(g),K.sortIndex=K.expirationTime,i(h,K);else break;K=l(g)}}function se(N){if(_=!1,G(N),!k)if(l(h)!==null)k=!0,T||(T=!0,H());else{var K=l(g);K!==null&&W(se,K.startTime-N)}}var T=!1,V=-1,X=5,q=-1;function E(){return D?!0:!(t.unstable_now()-q<X)}function U(){if(D=!1,T){var N=t.unstable_now();q=N;var K=!0;try{e:{k=!1,_&&(_=!1,z(V),V=-1),x=!0;var he=v;try{t:{for(G(N),y=l(h);y!==null&&!(y.expirationTime>N&&E());){var ge=y.callback;if(typeof ge=="function"){y.callback=null,v=y.priorityLevel;var j=ge(y.expirationTime<=N);if(N=t.unstable_now(),typeof j=="function"){y.callback=j,G(N),K=!0;break t}y===l(h)&&a(h),G(N)}else a(h);y=l(h)}if(y!==null)K=!0;else{var O=l(g);O!==null&&W(se,O.startTime-N),K=!1}}break e}finally{y=null,v=he,x=!1}K=void 0}}finally{K?H():T=!1}}}var H;if(typeof L=="function")H=function(){L(U)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,ee=Z.port2;Z.port1.onmessage=U,H=function(){ee.postMessage(null)}}else H=function(){R(U,0)};function W(N,K){V=R(function(){N(t.unstable_now())},K)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(N){N.callback=null},t.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<N?Math.floor(1e3/N):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(N){switch(v){case 1:case 2:case 3:var K=3;break;default:K=v}var he=v;v=K;try{return N()}finally{v=he}},t.unstable_requestPaint=function(){D=!0},t.unstable_runWithPriority=function(N,K){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var he=v;v=N;try{return K()}finally{v=he}},t.unstable_scheduleCallback=function(N,K,he){var ge=t.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?ge+he:ge):he=ge,N){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=he+j,N={id:b++,callback:K,priorityLevel:N,startTime:he,expirationTime:j,sortIndex:-1},he>ge?(N.sortIndex=he,i(g,N),l(h)===null&&N===l(g)&&(_?(z(V),V=-1):_=!0,W(se,he-ge))):(N.sortIndex=j,i(h,N),k||x||(k=!0,T||(T=!0,H()))),N},t.unstable_shouldYield=E,t.unstable_wrapCallback=function(N){var K=v;return function(){var he=v;v=K;try{return N.apply(this,arguments)}finally{v=he}}}})(Ac)),Ac}var dg;function r1(){return dg||(dg=1,Nc.exports=i1()),Nc.exports}var Tc={exports:{}},Pt={};var hg;function l1(){if(hg)return Pt;hg=1;var t=Vf();function i(h){var g="https://react.dev/errors/"+h;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)g+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+h+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(){}var a={d:{f:l,r:function(){throw Error(i(522))},D:l,C:l,L:l,m:l,X:l,S:l,M:l},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(h,g,b){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:y==null?null:""+y,children:h,containerInfo:g,implementation:b}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(h,g){if(h==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Pt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Pt.createPortal=function(h,g){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(i(299));return f(h,g,null,b)},Pt.flushSync=function(h){var g=o.T,b=a.p;try{if(o.T=null,a.p=2,h)return h()}finally{o.T=g,a.p=b,a.d.f()}},Pt.preconnect=function(h,g){typeof h=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,a.d.C(h,g))},Pt.prefetchDNS=function(h){typeof h=="string"&&a.d.D(h)},Pt.preinit=function(h,g){if(typeof h=="string"&&g&&typeof g.as=="string"){var b=g.as,y=p(b,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,x=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;b==="style"?a.d.S(h,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:y,integrity:v,fetchPriority:x}):b==="script"&&a.d.X(h,{crossOrigin:y,integrity:v,fetchPriority:x,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Pt.preinitModule=function(h,g){if(typeof h=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var b=p(g.as,g.crossOrigin);a.d.M(h,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&a.d.M(h)},Pt.preload=function(h,g){if(typeof h=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var b=g.as,y=p(b,g.crossOrigin);a.d.L(h,b,{crossOrigin:y,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Pt.preloadModule=function(h,g){if(typeof h=="string")if(g){var b=p(g.as,g.crossOrigin);a.d.m(h,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else a.d.m(h)},Pt.requestFormReset=function(h){a.d.r(h)},Pt.unstable_batchedUpdates=function(h,g){return h(g)},Pt.useFormState=function(h,g,b){return o.H.useFormState(h,g,b)},Pt.useFormStatus=function(){return o.H.useHostTransitionStatus()},Pt.version="19.2.6",Pt}var pg;function sb(){if(pg)return Tc.exports;pg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(i){console.error(i)}}return t(),Tc.exports=l1(),Tc.exports}var mg;function a1(){if(mg)return ia;mg=1;var t=r1(),i=Vf(),l=sb();function a(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var n=e,r=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(r=n.return),e=n.return;while(e)}return n.tag===3?r:null}function o(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function p(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function h(e){if(f(e)!==e)throw Error(a(188))}function g(e){var n=e.alternate;if(!n){if(n=f(e),n===null)throw Error(a(188));return n!==e?null:e}for(var r=e,s=n;;){var d=r.return;if(d===null)break;var m=d.alternate;if(m===null){if(s=d.return,s!==null){r=s;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===r)return h(d),e;if(m===s)return h(d),n;m=m.sibling}throw Error(a(188))}if(r.return!==s.return)r=d,s=m;else{for(var S=!1,C=d.child;C;){if(C===r){S=!0,r=d,s=m;break}if(C===s){S=!0,s=d,r=m;break}C=C.sibling}if(!S){for(C=m.child;C;){if(C===r){S=!0,r=m,s=d;break}if(C===s){S=!0,s=m,r=d;break}C=C.sibling}if(!S)throw Error(a(189))}}if(r.alternate!==s)throw Error(a(190))}if(r.tag!==3)throw Error(a(188));return r.stateNode.current===r?e:n}function b(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=b(e),n!==null)return n;e=e.sibling}return null}var y=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),L=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),q=Symbol.for("react.activity"),E=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function H(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var Z=Symbol.for("react.client.reference");function ee(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Z?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _:return"Fragment";case R:return"Profiler";case D:return"StrictMode";case se:return"Suspense";case T:return"SuspenseList";case q:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case L:return e.displayName||"Context";case z:return(e._context.displayName||"Context")+".Consumer";case G:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return n=e.displayName||null,n!==null?n:ee(e.type)||"Memo";case X:n=e._payload,e=e._init;try{return ee(e(n))}catch{}}return null}var W=Array.isArray,N=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],j=-1;function O(e){return{current:e}}function J(e){0>j||(e.current=ge[j],ge[j]=null,j--)}function A(e,n){j++,ge[j]=e.current,e.current=n}var ae=O(null),pe=O(null),te=O(null),oe=O(null);function we(e,n){switch(A(te,n),A(pe,e),A(ae,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Tm(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Tm(n),e=zm(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}J(ae),A(ae,e)}function F(){J(ae),J(pe),J(te)}function be(e){e.memoizedState!==null&&A(oe,e);var n=ae.current,r=zm(n,e.type);n!==r&&(A(pe,e),A(ae,r))}function Ee(e){pe.current===e&&(J(ae),J(pe)),oe.current===e&&(J(oe),Jl._currentValue=he)}var Re,Qe;function Ve(e){if(Re===void 0)try{throw Error()}catch(r){var n=r.stack.trim().match(/\n( *(at )?)/);Re=n&&n[1]||"",Qe=-1<r.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Re+e+Qe}var at=!1;function st(e,n){if(!e||at)return"";at=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(n){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(ue){var le=ue}Reflect.construct(e,[],de)}else{try{de.call()}catch(ue){le=ue}e.call(de.prototype)}}else{try{throw Error()}catch(ue){le=ue}(de=e())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(ue){if(ue&&le&&typeof ue.stack=="string")return[ue.stack,le.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=s.DetermineComponentFrameRoot(),S=m[0],C=m[1];if(S&&C){var I=S.split(`
|
|
4
|
-
`),ie=C.split(`
|
|
5
|
-
`);for(d=s=0;s<I.length&&!I[s].includes("DetermineComponentFrameRoot");)s++;for(;d<ie.length&&!ie[d].includes("DetermineComponentFrameRoot");)d++;if(s===I.length||d===ie.length)for(s=I.length-1,d=ie.length-1;1<=s&&0<=d&&I[s]!==ie[d];)d--;for(;1<=s&&0<=d;s--,d--)if(I[s]!==ie[d]){if(s!==1||d!==1)do if(s--,d--,0>d||I[s]!==ie[d]){var ce=`
|
|
6
|
-
`+I[s].replace(" at new "," at ");return e.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",e.displayName)),ce}while(1<=s&&0<=d);break}}}finally{at=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?Ve(r):""}function pt(e,n){switch(e.tag){case 26:case 27:case 5:return Ve(e.type);case 16:return Ve("Lazy");case 13:return e.child!==n&&n!==null?Ve("Suspense Fallback"):Ve("Suspense");case 19:return Ve("SuspenseList");case 0:case 15:return st(e.type,!1);case 11:return st(e.type.render,!1);case 1:return st(e.type,!0);case 31:return Ve("Activity");default:return""}}function Nt(e){try{var n="",r=null;do n+=pt(e,r),r=e,e=e.return;while(e);return n}catch(s){return`
|
|
7
|
-
Error generating stack: `+s.message+`
|
|
8
|
-
`+s.stack}}var qe=Object.prototype.hasOwnProperty,ct=t.unstable_scheduleCallback,Fe=t.unstable_cancelCallback,nt=t.unstable_shouldYield,Dt=t.unstable_requestPaint,rt=t.unstable_now,wt=t.unstable_getCurrentPriorityLevel,M=t.unstable_ImmediatePriority,$=t.unstable_UserBlockingPriority,me=t.unstable_NormalPriority,ve=t.unstable_LowPriority,Ce=t.unstable_IdlePriority,_e=t.log,Ke=t.unstable_setDisableYieldValue,bt=null,ft=null;function $e(e){if(typeof _e=="function"&&Ke(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(bt,e)}catch{}}var Ze=Math.clz32?Math.clz32:ze,Q=Math.log,xe=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Q(e)/xe|0)|0}var re=256,je=262144,Be=4194304;function ke(e){var n=e&42;if(n!==0)return n;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&261888;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 Ae(e,n,r){var s=e.pendingLanes;if(s===0)return 0;var d=0,m=e.suspendedLanes,S=e.pingedLanes;e=e.warmLanes;var C=s&134217727;return C!==0?(s=C&~m,s!==0?d=ke(s):(S&=C,S!==0?d=ke(S):r||(r=C&~e,r!==0&&(d=ke(r))))):(C=s&~m,C!==0?d=ke(C):S!==0?d=ke(S):r||(r=s&~e,r!==0&&(d=ke(r)))),d===0?0:n!==0&&n!==d&&(n&m)===0&&(m=d&-d,r=n&-n,m>=r||m===32&&(r&4194048)!==0)?n:d}function ye(e,n){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)===0}function B(e,n){switch(e){case 1:case 2:case 4:case 8:case 64:return n+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 n+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 Ne(){var e=Be;return Be<<=1,(Be&62914560)===0&&(Be=4194304),e}function dt(e){for(var n=[],r=0;31>r;r++)n.push(e);return n}function en(e,n){e.pendingLanes|=n,n!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zn(e,n,r,s,d,m){var S=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var C=e.entanglements,I=e.expirationTimes,ie=e.hiddenUpdates;for(r=S&~r;0<r;){var ce=31-Ze(r),de=1<<ce;C[ce]=0,I[ce]=-1;var le=ie[ce];if(le!==null)for(ie[ce]=null,ce=0;ce<le.length;ce++){var ue=le[ce];ue!==null&&(ue.lane&=-536870913)}r&=~de}s!==0&&Xi(e,s,0),m!==0&&d===0&&e.tag!==0&&(e.suspendedLanes|=m&~(S&~n))}function Xi(e,n,r){e.pendingLanes|=n,e.suspendedLanes&=~n;var s=31-Ze(n);e.entangledLanes|=n,e.entanglements[s]=e.entanglements[s]|1073741824|r&261930}function On(e,n){var r=e.entangledLanes|=n;for(e=e.entanglements;r;){var s=31-Ze(r),d=1<<s;d&n|e[s]&n&&(e[s]|=n),r&=~d}}function yi(e,n){var r=n&-n;return r=(r&42)!==0?1:Ft(r),(r&(e.suspendedLanes|n))!==0?0:r}function Ft(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 bi(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function dl(){var e=K.p;return e!==0?e:(e=window.event,e===void 0?32:Wm(e.type))}function br(e,n){var r=K.p;try{return K.p=e,n()}finally{K.p=r}}var tn=Math.random().toString(36).slice(2),Qt="__reactFiber$"+tn,ln="__reactProps$"+tn,vr="__reactContainer$"+tn,po="__reactEvents$"+tn,Cv="__reactListeners$"+tn,Ev="__reactHandles$"+tn,gd="__reactResources$"+tn,hl="__reactMarker$"+tn;function mo(e){delete e[Qt],delete e[ln],delete e[po],delete e[Cv],delete e[Ev]}function xr(e){var n=e[Qt];if(n)return n;for(var r=e.parentNode;r;){if(n=r[vr]||r[Qt]){if(r=n.alternate,n.child!==null||r!==null&&r.child!==null)for(e=Bm(e);e!==null;){if(r=e[Qt])return r;e=Bm(e)}return n}e=r,r=e.parentNode}return null}function Sr(e){if(e=e[Qt]||e[vr]){var n=e.tag;if(n===5||n===6||n===13||n===31||n===26||n===27||n===3)return e}return null}function pl(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e.stateNode;throw Error(a(33))}function wr(e){var n=e[gd];return n||(n=e[gd]={hoistableStyles:new Map,hoistableScripts:new Map}),n}function Yt(e){e[hl]=!0}var yd=new Set,bd={};function Ki(e,n){jr(e,n),jr(e+"Capture",n)}function jr(e,n){for(bd[e]=n,e=0;e<n.length;e++)yd.add(n[e])}var Nv=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]*$"),vd={},xd={};function Av(e){return qe.call(xd,e)?!0:qe.call(vd,e)?!1:Nv.test(e)?xd[e]=!0:(vd[e]=!0,!1)}function ja(e,n,r){if(Av(n))if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(n);return;case"boolean":var s=n.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(n);return}}e.setAttribute(n,""+r)}}function ka(e,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttribute(n,""+r)}}function Pn(e,n,r,s){if(s===null)e.removeAttribute(r);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(n,r,""+s)}}function kn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sd(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Tv(e,n,r){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n);if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var d=s.get,m=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(S){r=""+S,m.call(this,S)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return r},setValue:function(S){r=""+S},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function go(e){if(!e._valueTracker){var n=Sd(e)?"checked":"value";e._valueTracker=Tv(e,n,""+e[n])}}function wd(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var r=n.getValue(),s="";return e&&(s=Sd(e)?e.checked?"true":"false":e.value),e=s,e!==r?(n.setValue(e),!0):!1}function Ca(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}}var zv=/[\n"\\]/g;function Cn(e){return e.replace(zv,function(n){return"\\"+n.charCodeAt(0).toString(16)+" "})}function yo(e,n,r,s,d,m,S,C){e.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.type=S:e.removeAttribute("type"),n!=null?S==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+kn(n)):e.value!==""+kn(n)&&(e.value=""+kn(n)):S!=="submit"&&S!=="reset"||e.removeAttribute("value"),n!=null?bo(e,S,kn(n)):r!=null?bo(e,S,kn(r)):s!=null&&e.removeAttribute("value"),d==null&&m!=null&&(e.defaultChecked=!!m),d!=null&&(e.checked=d&&typeof d!="function"&&typeof d!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+kn(C):e.removeAttribute("name")}function jd(e,n,r,s,d,m,S,C){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.type=m),n!=null||r!=null){if(!(m!=="submit"&&m!=="reset"||n!=null)){go(e);return}r=r!=null?""+kn(r):"",n=n!=null?""+kn(n):r,C||n===e.value||(e.value=n),e.defaultValue=n}s=s??d,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=C?e.checked:!!s,e.defaultChecked=!!s,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(e.name=S),go(e)}function bo(e,n,r){n==="number"&&Ca(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function kr(e,n,r,s){if(e=e.options,n){n={};for(var d=0;d<r.length;d++)n["$"+r[d]]=!0;for(r=0;r<e.length;r++)d=n.hasOwnProperty("$"+e[r].value),e[r].selected!==d&&(e[r].selected=d),d&&s&&(e[r].defaultSelected=!0)}else{for(r=""+kn(r),n=null,d=0;d<e.length;d++){if(e[d].value===r){e[d].selected=!0,s&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function kd(e,n,r){if(n!=null&&(n=""+kn(n),n!==e.value&&(e.value=n),r==null)){e.defaultValue!==n&&(e.defaultValue=n);return}e.defaultValue=r!=null?""+kn(r):""}function Cd(e,n,r,s){if(n==null){if(s!=null){if(r!=null)throw Error(a(92));if(W(s)){if(1<s.length)throw Error(a(93));s=s[0]}r=s}r==null&&(r=""),n=r}r=kn(n),e.defaultValue=r,s=e.textContent,s===r&&s!==""&&s!==null&&(e.value=s),go(e)}function Cr(e,n){if(n){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=n;return}}e.textContent=n}var Rv=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 Ed(e,n,r){var s=n.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?s?e.setProperty(n,""):n==="float"?e.cssFloat="":e[n]="":s?e.setProperty(n,r):typeof r!="number"||r===0||Rv.has(n)?n==="float"?e.cssFloat=r:e[n]=(""+r).trim():e[n]=r+"px"}function Nd(e,n,r){if(n!=null&&typeof n!="object")throw Error(a(62));if(e=e.style,r!=null){for(var s in r)!r.hasOwnProperty(s)||n!=null&&n.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var d in n)s=n[d],n.hasOwnProperty(d)&&r[d]!==s&&Ed(e,d,s)}else for(var m in n)n.hasOwnProperty(m)&&Ed(e,m,n[m])}function vo(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 Dv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Mv=/^[\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 Ea(e){return Mv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Jn(){}var xo=null;function So(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Er=null,Nr=null;function Ad(e){var n=Sr(e);if(n&&(e=n.stateNode)){var r=e[ln]||null;e:switch(e=n.stateNode,n.type){case"input":if(yo(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),n=r.name,r.type==="radio"&&n!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Cn(""+n)+'"][type="radio"]'),n=0;n<r.length;n++){var s=r[n];if(s!==e&&s.form===e.form){var d=s[ln]||null;if(!d)throw Error(a(90));yo(s,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(n=0;n<r.length;n++)s=r[n],s.form===e.form&&wd(s)}break e;case"textarea":kd(e,r.value,r.defaultValue);break e;case"select":n=r.value,n!=null&&kr(e,!!r.multiple,n,!1)}}}var wo=!1;function Td(e,n,r){if(wo)return e(n,r);wo=!0;try{var s=e(n);return s}finally{if(wo=!1,(Er!==null||Nr!==null)&&(hs(),Er&&(n=Er,e=Nr,Nr=Er=null,Ad(n),e)))for(n=0;n<e.length;n++)Ad(e[n])}}function ml(e,n){var r=e.stateNode;if(r===null)return null;var s=r[ln]||null;if(s===null)return null;r=s[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(a(231,n,typeof r));return r}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),jo=!1;if(Wn)try{var gl={};Object.defineProperty(gl,"passive",{get:function(){jo=!0}}),window.addEventListener("test",gl,gl),window.removeEventListener("test",gl,gl)}catch{jo=!1}var vi=null,ko=null,Na=null;function zd(){if(Na)return Na;var e,n=ko,r=n.length,s,d="value"in vi?vi.value:vi.textContent,m=d.length;for(e=0;e<r&&n[e]===d[e];e++);var S=r-e;for(s=1;s<=S&&n[r-s]===d[m-s];s++);return Na=d.slice(e,1<s?1-s:void 0)}function Aa(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ta(){return!0}function Rd(){return!1}function an(e){function n(r,s,d,m,S){this._reactName=r,this._targetInst=d,this.type=s,this.nativeEvent=m,this.target=S,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(r=e[C],this[C]=r?r(m):m[C]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Ta:Rd,this.isPropagationStopped=Rd,this}return y(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ta)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ta)},persist:function(){},isPersistent:Ta}),n}var $i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},za=an($i),yl=y({},$i,{view:0,detail:0}),_v=an(yl),Co,Eo,bl,Ra=y({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ao,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!==bl&&(bl&&e.type==="mousemove"?(Co=e.screenX-bl.screenX,Eo=e.screenY-bl.screenY):Eo=Co=0,bl=e),Co)},movementY:function(e){return"movementY"in e?e.movementY:Eo}}),Dd=an(Ra),Ov=y({},Ra,{dataTransfer:0}),Lv=an(Ov),Bv=y({},yl,{relatedTarget:0}),No=an(Bv),Uv=y({},$i,{animationName:0,elapsedTime:0,pseudoElement:0}),qv=an(Uv),Iv=y({},$i,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hv=an(Iv),Vv=y({},$i,{data:0}),Md=an(Vv),Yv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gv={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"},Fv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Qv(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Fv[e])?!!n[e]:!1}function Ao(){return Qv}var Xv=y({},yl,{key:function(e){if(e.key){var n=Yv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Aa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ao,charCode:function(e){return e.type==="keypress"?Aa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Aa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Kv=an(Xv),$v=y({},Ra,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),_d=an($v),Zv=y({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ao}),Pv=an(Zv),Jv=y({},$i,{propertyName:0,elapsedTime:0,pseudoElement:0}),Wv=an(Jv),ex=y({},Ra,{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}),tx=an(ex),nx=y({},$i,{newState:0,oldState:0}),ix=an(nx),rx=[9,13,27,32],To=Wn&&"CompositionEvent"in window,vl=null;Wn&&"documentMode"in document&&(vl=document.documentMode);var lx=Wn&&"TextEvent"in window&&!vl,Od=Wn&&(!To||vl&&8<vl&&11>=vl),Ld=" ",Bd=!1;function Ud(e,n){switch(e){case"keyup":return rx.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ar=!1;function ax(e,n){switch(e){case"compositionend":return qd(n);case"keypress":return n.which!==32?null:(Bd=!0,Ld);case"textInput":return e=n.data,e===Ld&&Bd?null:e;default:return null}}function sx(e,n){if(Ar)return e==="compositionend"||!To&&Ud(e,n)?(e=zd(),Na=ko=vi=null,Ar=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Od&&n.locale!=="ko"?null:n.data;default:return null}}var ox={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 Id(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!ox[e.type]:n==="textarea"}function Hd(e,n,r,s){Er?Nr?Nr.push(s):Nr=[s]:Er=s,n=xs(n,"onChange"),0<n.length&&(r=new za("onChange","change",null,r,s),e.push({event:r,listeners:n}))}var xl=null,Sl=null;function ux(e){jm(e,0)}function Da(e){var n=pl(e);if(wd(n))return e}function Vd(e,n){if(e==="change")return n}var Yd=!1;if(Wn){var zo;if(Wn){var Ro="oninput"in document;if(!Ro){var Gd=document.createElement("div");Gd.setAttribute("oninput","return;"),Ro=typeof Gd.oninput=="function"}zo=Ro}else zo=!1;Yd=zo&&(!document.documentMode||9<document.documentMode)}function Fd(){xl&&(xl.detachEvent("onpropertychange",Qd),Sl=xl=null)}function Qd(e){if(e.propertyName==="value"&&Da(Sl)){var n=[];Hd(n,Sl,e,So(e)),Td(ux,n)}}function cx(e,n,r){e==="focusin"?(Fd(),xl=n,Sl=r,xl.attachEvent("onpropertychange",Qd)):e==="focusout"&&Fd()}function fx(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Da(Sl)}function dx(e,n){if(e==="click")return Da(n)}function hx(e,n){if(e==="input"||e==="change")return Da(n)}function px(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var mn=typeof Object.is=="function"?Object.is:px;function wl(e,n){if(mn(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var r=Object.keys(e),s=Object.keys(n);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var d=r[s];if(!qe.call(n,d)||!mn(e[d],n[d]))return!1}return!0}function Xd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kd(e,n){var r=Xd(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=n&&s>=n)return{node:r,offset:n-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Xd(r)}}function $d(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?$d(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Zd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var n=Ca(e.document);n instanceof e.HTMLIFrameElement;){try{var r=typeof n.contentWindow.location.href=="string"}catch{r=!1}if(r)e=n.contentWindow;else break;n=Ca(e.document)}return n}function Do(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}var mx=Wn&&"documentMode"in document&&11>=document.documentMode,Tr=null,Mo=null,jl=null,_o=!1;function Pd(e,n,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;_o||Tr==null||Tr!==Ca(s)||(s=Tr,"selectionStart"in s&&Do(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),jl&&wl(jl,s)||(jl=s,s=xs(Mo,"onSelect"),0<s.length&&(n=new za("onSelect","select",null,n,r),e.push({event:n,listeners:s}),n.target=Tr)))}function Zi(e,n){var r={};return r[e.toLowerCase()]=n.toLowerCase(),r["Webkit"+e]="webkit"+n,r["Moz"+e]="moz"+n,r}var zr={animationend:Zi("Animation","AnimationEnd"),animationiteration:Zi("Animation","AnimationIteration"),animationstart:Zi("Animation","AnimationStart"),transitionrun:Zi("Transition","TransitionRun"),transitionstart:Zi("Transition","TransitionStart"),transitioncancel:Zi("Transition","TransitionCancel"),transitionend:Zi("Transition","TransitionEnd")},Oo={},Jd={};Wn&&(Jd=document.createElement("div").style,"AnimationEvent"in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),"TransitionEvent"in window||delete zr.transitionend.transition);function Pi(e){if(Oo[e])return Oo[e];if(!zr[e])return e;var n=zr[e],r;for(r in n)if(n.hasOwnProperty(r)&&r in Jd)return Oo[e]=n[r];return e}var Wd=Pi("animationend"),eh=Pi("animationiteration"),th=Pi("animationstart"),gx=Pi("transitionrun"),yx=Pi("transitionstart"),bx=Pi("transitioncancel"),nh=Pi("transitionend"),ih=new Map,Lo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Lo.push("scrollEnd");function Ln(e,n){ih.set(e,n),Ki(n,[e])}var Ma=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var n=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(n))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},En=[],Rr=0,Bo=0;function _a(){for(var e=Rr,n=Bo=Rr=0;n<e;){var r=En[n];En[n++]=null;var s=En[n];En[n++]=null;var d=En[n];En[n++]=null;var m=En[n];if(En[n++]=null,s!==null&&d!==null){var S=s.pending;S===null?d.next=d:(d.next=S.next,S.next=d),s.pending=d}m!==0&&rh(r,d,m)}}function Oa(e,n,r,s){En[Rr++]=e,En[Rr++]=n,En[Rr++]=r,En[Rr++]=s,Bo|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function Uo(e,n,r,s){return Oa(e,n,r,s),La(e)}function Ji(e,n){return Oa(e,null,null,n),La(e)}function rh(e,n,r){e.lanes|=r;var s=e.alternate;s!==null&&(s.lanes|=r);for(var d=!1,m=e.return;m!==null;)m.childLanes|=r,s=m.alternate,s!==null&&(s.childLanes|=r),m.tag===22&&(e=m.stateNode,e===null||e._visibility&1||(d=!0)),e=m,m=m.return;return e.tag===3?(m=e.stateNode,d&&n!==null&&(d=31-Ze(r),e=m.hiddenUpdates,s=e[d],s===null?e[d]=[n]:s.push(n),n.lane=r|536870912),m):null}function La(e){if(50<Fl)throw Fl=0,Xu=null,Error(a(185));for(var n=e.return;n!==null;)e=n,n=e.return;return e.tag===3?e.stateNode:null}var Dr={};function vx(e,n,r,s){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(e,n,r,s){return new vx(e,n,r,s)}function qo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ei(e,n){var r=e.alternate;return r===null?(r=gn(e.tag,n,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function lh(e,n){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=n,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,n=r.dependencies,e.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),e}function Ba(e,n,r,s,d,m){var S=0;if(s=e,typeof e=="function")qo(e)&&(S=1);else if(typeof e=="string")S=k0(e,r,ae.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case q:return e=gn(31,r,n,d),e.elementType=q,e.lanes=m,e;case _:return Wi(r.children,d,m,n);case D:S=8,d|=24;break;case R:return e=gn(12,r,n,d|2),e.elementType=R,e.lanes=m,e;case se:return e=gn(13,r,n,d),e.elementType=se,e.lanes=m,e;case T:return e=gn(19,r,n,d),e.elementType=T,e.lanes=m,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:S=10;break e;case z:S=9;break e;case G:S=11;break e;case V:S=14;break e;case X:S=16,s=null;break e}S=29,r=Error(a(130,e===null?"null":typeof e,"")),s=null}return n=gn(S,r,n,d),n.elementType=e,n.type=s,n.lanes=m,n}function Wi(e,n,r,s){return e=gn(7,e,s,n),e.lanes=r,e}function Io(e,n,r){return e=gn(6,e,null,n),e.lanes=r,e}function ah(e){var n=gn(18,null,null,0);return n.stateNode=e,n}function Ho(e,n,r){return n=gn(4,e.children!==null?e.children:[],e.key,n),n.lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}var sh=new WeakMap;function Nn(e,n){if(typeof e=="object"&&e!==null){var r=sh.get(e);return r!==void 0?r:(n={value:e,source:n,stack:Nt(n)},sh.set(e,n),n)}return{value:e,source:n,stack:Nt(n)}}var Mr=[],_r=0,Ua=null,kl=0,An=[],Tn=0,xi=null,Yn=1,Gn="";function ti(e,n){Mr[_r++]=kl,Mr[_r++]=Ua,Ua=e,kl=n}function oh(e,n,r){An[Tn++]=Yn,An[Tn++]=Gn,An[Tn++]=xi,xi=e;var s=Yn;e=Gn;var d=32-Ze(s)-1;s&=~(1<<d),r+=1;var m=32-Ze(n)+d;if(30<m){var S=d-d%5;m=(s&(1<<S)-1).toString(32),s>>=S,d-=S,Yn=1<<32-Ze(n)+d|r<<d|s,Gn=m+e}else Yn=1<<m|r<<d|s,Gn=e}function Vo(e){e.return!==null&&(ti(e,1),oh(e,1,0))}function Yo(e){for(;e===Ua;)Ua=Mr[--_r],Mr[_r]=null,kl=Mr[--_r],Mr[_r]=null;for(;e===xi;)xi=An[--Tn],An[Tn]=null,Gn=An[--Tn],An[Tn]=null,Yn=An[--Tn],An[Tn]=null}function uh(e,n){An[Tn++]=Yn,An[Tn++]=Gn,An[Tn++]=xi,Yn=n.id,Gn=n.overflow,xi=e}var Xt=null,At=null,it=!1,Si=null,zn=!1,Go=Error(a(519));function wi(e){var n=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Cl(Nn(n,e)),Go}function ch(e){var n=e.stateNode,r=e.type,s=e.memoizedProps;switch(n[Qt]=e,n[ln]=s,r){case"dialog":Je("cancel",n),Je("close",n);break;case"iframe":case"object":case"embed":Je("load",n);break;case"video":case"audio":for(r=0;r<Xl.length;r++)Je(Xl[r],n);break;case"source":Je("error",n);break;case"img":case"image":case"link":Je("error",n),Je("load",n);break;case"details":Je("toggle",n);break;case"input":Je("invalid",n),jd(n,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":Je("invalid",n);break;case"textarea":Je("invalid",n),Cd(n,s.value,s.defaultValue,s.children)}r=s.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||n.textContent===""+r||s.suppressHydrationWarning===!0||Nm(n.textContent,r)?(s.popover!=null&&(Je("beforetoggle",n),Je("toggle",n)),s.onScroll!=null&&Je("scroll",n),s.onScrollEnd!=null&&Je("scrollend",n),s.onClick!=null&&(n.onclick=Jn),n=!0):n=!1,n||wi(e,!0)}function fh(e){for(Xt=e.return;Xt;)switch(Xt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Xt=Xt.return}}function Or(e){if(e!==Xt)return!1;if(!it)return fh(e),it=!0,!1;var n=e.tag,r;if((r=n!==3&&n!==27)&&((r=n===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||oc(e.type,e.memoizedProps)),r=!r),r&&At&&wi(e),fh(e),n===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));At=Lm(e)}else if(n===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));At=Lm(e)}else n===27?(n=At,Li(e.type)?(e=hc,hc=null,At=e):At=n):At=Xt?Dn(e.stateNode.nextSibling):null;return!0}function er(){At=Xt=null,it=!1}function Fo(){var e=Si;return e!==null&&(cn===null?cn=e:cn.push.apply(cn,e),Si=null),e}function Cl(e){Si===null?Si=[e]:Si.push(e)}var Qo=O(null),tr=null,ni=null;function ji(e,n,r){A(Qo,n._currentValue),n._currentValue=r}function ii(e){e._currentValue=Qo.current,J(Qo)}function Xo(e,n,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,s!==null&&(s.childLanes|=n)):s!==null&&(s.childLanes&n)!==n&&(s.childLanes|=n),e===r)break;e=e.return}}function Ko(e,n,r,s){var d=e.child;for(d!==null&&(d.return=e);d!==null;){var m=d.dependencies;if(m!==null){var S=d.child;m=m.firstContext;e:for(;m!==null;){var C=m;m=d;for(var I=0;I<n.length;I++)if(C.context===n[I]){m.lanes|=r,C=m.alternate,C!==null&&(C.lanes|=r),Xo(m.return,r,e),s||(S=null);break e}m=C.next}}else if(d.tag===18){if(S=d.return,S===null)throw Error(a(341));S.lanes|=r,m=S.alternate,m!==null&&(m.lanes|=r),Xo(S,r,e),S=null}else S=d.child;if(S!==null)S.return=d;else for(S=d;S!==null;){if(S===e){S=null;break}if(d=S.sibling,d!==null){d.return=S.return,S=d;break}S=S.return}d=S}}function Lr(e,n,r,s){e=null;for(var d=n,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var S=d.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var C=d.type;mn(d.pendingProps.value,S.value)||(e!==null?e.push(C):e=[C])}}else if(d===oe.current){if(S=d.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(e!==null?e.push(Jl):e=[Jl])}d=d.return}e!==null&&Ko(n,e,r,s),n.flags|=262144}function qa(e){for(e=e.firstContext;e!==null;){if(!mn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function nr(e){tr=e,ni=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Kt(e){return dh(tr,e)}function Ia(e,n){return tr===null&&nr(e),dh(e,n)}function dh(e,n){var r=n._currentValue;if(n={context:n,memoizedValue:r,next:null},ni===null){if(e===null)throw Error(a(308));ni=n,e.dependencies={lanes:0,firstContext:n},e.flags|=524288}else ni=ni.next=n;return r}var xx=typeof AbortController<"u"?AbortController:function(){var e=[],n=this.signal={aborted:!1,addEventListener:function(r,s){e.push(s)}};this.abort=function(){n.aborted=!0,e.forEach(function(r){return r()})}},Sx=t.unstable_scheduleCallback,wx=t.unstable_NormalPriority,Bt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $o(){return{controller:new xx,data:new Map,refCount:0}}function El(e){e.refCount--,e.refCount===0&&Sx(wx,function(){e.controller.abort()})}var Nl=null,Zo=0,Br=0,Ur=null;function jx(e,n){if(Nl===null){var r=Nl=[];Zo=0,Br=Wu(),Ur={status:"pending",value:void 0,then:function(s){r.push(s)}}}return Zo++,n.then(hh,hh),n}function hh(){if(--Zo===0&&Nl!==null){Ur!==null&&(Ur.status="fulfilled");var e=Nl;Nl=null,Br=0,Ur=null;for(var n=0;n<e.length;n++)(0,e[n])()}}function kx(e,n){var r=[],s={status:"pending",value:null,reason:null,then:function(d){r.push(d)}};return e.then(function(){s.status="fulfilled",s.value=n;for(var d=0;d<r.length;d++)(0,r[d])(n)},function(d){for(s.status="rejected",s.reason=d,d=0;d<r.length;d++)(0,r[d])(void 0)}),s}var ph=N.S;N.S=function(e,n){Pp=rt(),typeof n=="object"&&n!==null&&typeof n.then=="function"&&jx(e,n),ph!==null&&ph(e,n)};var ir=O(null);function Po(){var e=ir.current;return e!==null?e:jt.pooledCache}function Ha(e,n){n===null?A(ir,ir.current):A(ir,n.pool)}function mh(){var e=Po();return e===null?null:{parent:Bt._currentValue,pool:e}}var qr=Error(a(460)),Jo=Error(a(474)),Va=Error(a(542)),Ya={then:function(){}};function gh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function yh(e,n,r){switch(r=e[r],r===void 0?e.push(n):r!==n&&(n.then(Jn,Jn),n=r),n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,vh(e),e;default:if(typeof n.status=="string")n.then(Jn,Jn);else{if(e=jt,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=n,e.status="pending",e.then(function(s){if(n.status==="pending"){var d=n;d.status="fulfilled",d.value=s}},function(s){if(n.status==="pending"){var d=n;d.status="rejected",d.reason=s}})}switch(n.status){case"fulfilled":return n.value;case"rejected":throw e=n.reason,vh(e),e}throw lr=n,qr}}function rr(e){try{var n=e._init;return n(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(lr=r,qr):r}}var lr=null;function bh(){if(lr===null)throw Error(a(459));var e=lr;return lr=null,e}function vh(e){if(e===qr||e===Va)throw Error(a(483))}var Ir=null,Al=0;function Ga(e){var n=Al;return Al+=1,Ir===null&&(Ir=[]),yh(Ir,e,n)}function Tl(e,n){n=n.props.ref,e.ref=n!==void 0?n:null}function Fa(e,n){throw n.$$typeof===v?Error(a(525)):(e=Object.prototype.toString.call(n),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)))}function xh(e){function n(P,Y){if(e){var ne=P.deletions;ne===null?(P.deletions=[Y],P.flags|=16):ne.push(Y)}}function r(P,Y){if(!e)return null;for(;Y!==null;)n(P,Y),Y=Y.sibling;return null}function s(P){for(var Y=new Map;P!==null;)P.key!==null?Y.set(P.key,P):Y.set(P.index,P),P=P.sibling;return Y}function d(P,Y){return P=ei(P,Y),P.index=0,P.sibling=null,P}function m(P,Y,ne){return P.index=ne,e?(ne=P.alternate,ne!==null?(ne=ne.index,ne<Y?(P.flags|=67108866,Y):ne):(P.flags|=67108866,Y)):(P.flags|=1048576,Y)}function S(P){return e&&P.alternate===null&&(P.flags|=67108866),P}function C(P,Y,ne,fe){return Y===null||Y.tag!==6?(Y=Io(ne,P.mode,fe),Y.return=P,Y):(Y=d(Y,ne),Y.return=P,Y)}function I(P,Y,ne,fe){var Me=ne.type;return Me===_?ce(P,Y,ne.props.children,fe,ne.key):Y!==null&&(Y.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===X&&rr(Me)===Y.type)?(Y=d(Y,ne.props),Tl(Y,ne),Y.return=P,Y):(Y=Ba(ne.type,ne.key,ne.props,null,P.mode,fe),Tl(Y,ne),Y.return=P,Y)}function ie(P,Y,ne,fe){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==ne.containerInfo||Y.stateNode.implementation!==ne.implementation?(Y=Ho(ne,P.mode,fe),Y.return=P,Y):(Y=d(Y,ne.children||[]),Y.return=P,Y)}function ce(P,Y,ne,fe,Me){return Y===null||Y.tag!==7?(Y=Wi(ne,P.mode,fe,Me),Y.return=P,Y):(Y=d(Y,ne),Y.return=P,Y)}function de(P,Y,ne){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Y=Io(""+Y,P.mode,ne),Y.return=P,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case x:return ne=Ba(Y.type,Y.key,Y.props,null,P.mode,ne),Tl(ne,Y),ne.return=P,ne;case k:return Y=Ho(Y,P.mode,ne),Y.return=P,Y;case X:return Y=rr(Y),de(P,Y,ne)}if(W(Y)||H(Y))return Y=Wi(Y,P.mode,ne,null),Y.return=P,Y;if(typeof Y.then=="function")return de(P,Ga(Y),ne);if(Y.$$typeof===L)return de(P,Ia(P,Y),ne);Fa(P,Y)}return null}function le(P,Y,ne,fe){var Me=Y!==null?Y.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Me!==null?null:C(P,Y,""+ne,fe);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:return ne.key===Me?I(P,Y,ne,fe):null;case k:return ne.key===Me?ie(P,Y,ne,fe):null;case X:return ne=rr(ne),le(P,Y,ne,fe)}if(W(ne)||H(ne))return Me!==null?null:ce(P,Y,ne,fe,null);if(typeof ne.then=="function")return le(P,Y,Ga(ne),fe);if(ne.$$typeof===L)return le(P,Y,Ia(P,ne),fe);Fa(P,ne)}return null}function ue(P,Y,ne,fe,Me){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return P=P.get(ne)||null,C(Y,P,""+fe,Me);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return P=P.get(fe.key===null?ne:fe.key)||null,I(Y,P,fe,Me);case k:return P=P.get(fe.key===null?ne:fe.key)||null,ie(Y,P,fe,Me);case X:return fe=rr(fe),ue(P,Y,ne,fe,Me)}if(W(fe)||H(fe))return P=P.get(ne)||null,ce(Y,P,fe,Me,null);if(typeof fe.then=="function")return ue(P,Y,ne,Ga(fe),Me);if(fe.$$typeof===L)return ue(P,Y,ne,Ia(Y,fe),Me);Fa(Y,fe)}return null}function Te(P,Y,ne,fe){for(var Me=null,ot=null,De=Y,Ge=Y=0,tt=null;De!==null&&Ge<ne.length;Ge++){De.index>Ge?(tt=De,De=null):tt=De.sibling;var ut=le(P,De,ne[Ge],fe);if(ut===null){De===null&&(De=tt);break}e&&De&&ut.alternate===null&&n(P,De),Y=m(ut,Y,Ge),ot===null?Me=ut:ot.sibling=ut,ot=ut,De=tt}if(Ge===ne.length)return r(P,De),it&&ti(P,Ge),Me;if(De===null){for(;Ge<ne.length;Ge++)De=de(P,ne[Ge],fe),De!==null&&(Y=m(De,Y,Ge),ot===null?Me=De:ot.sibling=De,ot=De);return it&&ti(P,Ge),Me}for(De=s(De);Ge<ne.length;Ge++)tt=ue(De,P,Ge,ne[Ge],fe),tt!==null&&(e&&tt.alternate!==null&&De.delete(tt.key===null?Ge:tt.key),Y=m(tt,Y,Ge),ot===null?Me=tt:ot.sibling=tt,ot=tt);return e&&De.forEach(function(Hi){return n(P,Hi)}),it&&ti(P,Ge),Me}function Le(P,Y,ne,fe){if(ne==null)throw Error(a(151));for(var Me=null,ot=null,De=Y,Ge=Y=0,tt=null,ut=ne.next();De!==null&&!ut.done;Ge++,ut=ne.next()){De.index>Ge?(tt=De,De=null):tt=De.sibling;var Hi=le(P,De,ut.value,fe);if(Hi===null){De===null&&(De=tt);break}e&&De&&Hi.alternate===null&&n(P,De),Y=m(Hi,Y,Ge),ot===null?Me=Hi:ot.sibling=Hi,ot=Hi,De=tt}if(ut.done)return r(P,De),it&&ti(P,Ge),Me;if(De===null){for(;!ut.done;Ge++,ut=ne.next())ut=de(P,ut.value,fe),ut!==null&&(Y=m(ut,Y,Ge),ot===null?Me=ut:ot.sibling=ut,ot=ut);return it&&ti(P,Ge),Me}for(De=s(De);!ut.done;Ge++,ut=ne.next())ut=ue(De,P,Ge,ut.value,fe),ut!==null&&(e&&ut.alternate!==null&&De.delete(ut.key===null?Ge:ut.key),Y=m(ut,Y,Ge),ot===null?Me=ut:ot.sibling=ut,ot=ut);return e&&De.forEach(function(O0){return n(P,O0)}),it&&ti(P,Ge),Me}function St(P,Y,ne,fe){if(typeof ne=="object"&&ne!==null&&ne.type===_&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case x:e:{for(var Me=ne.key;Y!==null;){if(Y.key===Me){if(Me=ne.type,Me===_){if(Y.tag===7){r(P,Y.sibling),fe=d(Y,ne.props.children),fe.return=P,P=fe;break e}}else if(Y.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===X&&rr(Me)===Y.type){r(P,Y.sibling),fe=d(Y,ne.props),Tl(fe,ne),fe.return=P,P=fe;break e}r(P,Y);break}else n(P,Y);Y=Y.sibling}ne.type===_?(fe=Wi(ne.props.children,P.mode,fe,ne.key),fe.return=P,P=fe):(fe=Ba(ne.type,ne.key,ne.props,null,P.mode,fe),Tl(fe,ne),fe.return=P,P=fe)}return S(P);case k:e:{for(Me=ne.key;Y!==null;){if(Y.key===Me)if(Y.tag===4&&Y.stateNode.containerInfo===ne.containerInfo&&Y.stateNode.implementation===ne.implementation){r(P,Y.sibling),fe=d(Y,ne.children||[]),fe.return=P,P=fe;break e}else{r(P,Y);break}else n(P,Y);Y=Y.sibling}fe=Ho(ne,P.mode,fe),fe.return=P,P=fe}return S(P);case X:return ne=rr(ne),St(P,Y,ne,fe)}if(W(ne))return Te(P,Y,ne,fe);if(H(ne)){if(Me=H(ne),typeof Me!="function")throw Error(a(150));return ne=Me.call(ne),Le(P,Y,ne,fe)}if(typeof ne.then=="function")return St(P,Y,Ga(ne),fe);if(ne.$$typeof===L)return St(P,Y,Ia(P,ne),fe);Fa(P,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,Y!==null&&Y.tag===6?(r(P,Y.sibling),fe=d(Y,ne),fe.return=P,P=fe):(r(P,Y),fe=Io(ne,P.mode,fe),fe.return=P,P=fe),S(P)):r(P,Y)}return function(P,Y,ne,fe){try{Al=0;var Me=St(P,Y,ne,fe);return Ir=null,Me}catch(De){if(De===qr||De===Va)throw De;var ot=gn(29,De,null,P.mode);return ot.lanes=fe,ot.return=P,ot}}}var ar=xh(!0),Sh=xh(!1),ki=!1;function Wo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eu(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ci(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ei(e,n,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(ht&2)!==0){var d=s.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),s.pending=n,n=La(e),rh(e,null,r),n}return Oa(e,s,n,r),La(e)}function zl(e,n,r){if(n=n.updateQueue,n!==null&&(n=n.shared,(r&4194048)!==0)){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,On(e,r)}}function tu(e,n){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var d=null,m=null;if(r=r.firstBaseUpdate,r!==null){do{var S={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};m===null?d=m=S:m=m.next=S,r=r.next}while(r!==null);m===null?d=m=n:m=m.next=n}else d=m=n;r={baseState:s.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:s.shared,callbacks:s.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=n:e.next=n,r.lastBaseUpdate=n}var nu=!1;function Rl(){if(nu){var e=Ur;if(e!==null)throw e}}function Dl(e,n,r,s){nu=!1;var d=e.updateQueue;ki=!1;var m=d.firstBaseUpdate,S=d.lastBaseUpdate,C=d.shared.pending;if(C!==null){d.shared.pending=null;var I=C,ie=I.next;I.next=null,S===null?m=ie:S.next=ie,S=I;var ce=e.alternate;ce!==null&&(ce=ce.updateQueue,C=ce.lastBaseUpdate,C!==S&&(C===null?ce.firstBaseUpdate=ie:C.next=ie,ce.lastBaseUpdate=I))}if(m!==null){var de=d.baseState;S=0,ce=ie=I=null,C=m;do{var le=C.lane&-536870913,ue=le!==C.lane;if(ue?(et&le)===le:(s&le)===le){le!==0&&le===Br&&(nu=!0),ce!==null&&(ce=ce.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var Te=e,Le=C;le=n;var St=r;switch(Le.tag){case 1:if(Te=Le.payload,typeof Te=="function"){de=Te.call(St,de,le);break e}de=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Le.payload,le=typeof Te=="function"?Te.call(St,de,le):Te,le==null)break e;de=y({},de,le);break e;case 2:ki=!0}}le=C.callback,le!==null&&(e.flags|=64,ue&&(e.flags|=8192),ue=d.callbacks,ue===null?d.callbacks=[le]:ue.push(le))}else ue={lane:le,tag:C.tag,payload:C.payload,callback:C.callback,next:null},ce===null?(ie=ce=ue,I=de):ce=ce.next=ue,S|=le;if(C=C.next,C===null){if(C=d.shared.pending,C===null)break;ue=C,C=ue.next,ue.next=null,d.lastBaseUpdate=ue,d.shared.pending=null}}while(!0);ce===null&&(I=de),d.baseState=I,d.firstBaseUpdate=ie,d.lastBaseUpdate=ce,m===null&&(d.shared.lanes=0),Ri|=S,e.lanes=S,e.memoizedState=de}}function wh(e,n){if(typeof e!="function")throw Error(a(191,e));e.call(n)}function jh(e,n){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)wh(r[e],n)}var Hr=O(null),Qa=O(0);function kh(e,n){e=di,A(Qa,e),A(Hr,n),di=e|n.baseLanes}function iu(){A(Qa,di),A(Hr,Hr.current)}function ru(){di=Qa.current,J(Hr),J(Qa)}var yn=O(null),Rn=null;function Ni(e){var n=e.alternate;A(Ot,Ot.current&1),A(yn,e),Rn===null&&(n===null||Hr.current!==null||n.memoizedState!==null)&&(Rn=e)}function lu(e){A(Ot,Ot.current),A(yn,e),Rn===null&&(Rn=e)}function Ch(e){e.tag===22?(A(Ot,Ot.current),A(yn,e),Rn===null&&(Rn=e)):Ai()}function Ai(){A(Ot,Ot.current),A(yn,yn.current)}function bn(e){J(yn),Rn===e&&(Rn=null),J(Ot)}var Ot=O(0);function Xa(e){for(var n=e;n!==null;){if(n.tag===13){var r=n.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||fc(r)||dc(r)))return n}else if(n.tag===19&&(n.memoizedProps.revealOrder==="forwards"||n.memoizedProps.revealOrder==="backwards"||n.memoizedProps.revealOrder==="unstable_legacy-backwards"||n.memoizedProps.revealOrder==="together")){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var ri=0,Ye=null,vt=null,Ut=null,Ka=!1,Vr=!1,sr=!1,$a=0,Ml=0,Yr=null,Cx=0;function Mt(){throw Error(a(321))}function au(e,n){if(n===null)return!1;for(var r=0;r<n.length&&r<e.length;r++)if(!mn(e[r],n[r]))return!1;return!0}function su(e,n,r,s,d,m){return ri=m,Ye=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,N.H=e===null||e.memoizedState===null?op:wu,sr=!1,m=r(s,d),sr=!1,Vr&&(m=Nh(n,r,s,d)),Eh(e),m}function Eh(e){N.H=Ll;var n=vt!==null&&vt.next!==null;if(ri=0,Ut=vt=Ye=null,Ka=!1,Ml=0,Yr=null,n)throw Error(a(300));e===null||qt||(e=e.dependencies,e!==null&&qa(e)&&(qt=!0))}function Nh(e,n,r,s){Ye=e;var d=0;do{if(Vr&&(Yr=null),Ml=0,Vr=!1,25<=d)throw Error(a(301));if(d+=1,Ut=vt=null,e.updateQueue!=null){var m=e.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}N.H=up,m=n(r,s)}while(Vr);return m}function Ex(){var e=N.H,n=e.useState()[0];return n=typeof n.then=="function"?_l(n):n,e=e.useState()[0],(vt!==null?vt.memoizedState:null)!==e&&(Ye.flags|=1024),n}function ou(){var e=$a!==0;return $a=0,e}function uu(e,n,r){n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~r}function cu(e){if(Ka){for(e=e.memoizedState;e!==null;){var n=e.queue;n!==null&&(n.pending=null),e=e.next}Ka=!1}ri=0,Ut=vt=Ye=null,Vr=!1,Ml=$a=0,Yr=null}function nn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ut===null?Ye.memoizedState=Ut=e:Ut=Ut.next=e,Ut}function Lt(){if(vt===null){var e=Ye.alternate;e=e!==null?e.memoizedState:null}else e=vt.next;var n=Ut===null?Ye.memoizedState:Ut.next;if(n!==null)Ut=n,vt=e;else{if(e===null)throw Ye.alternate===null?Error(a(467)):Error(a(310));vt=e,e={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},Ut===null?Ye.memoizedState=Ut=e:Ut=Ut.next=e}return Ut}function Za(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function _l(e){var n=Ml;return Ml+=1,Yr===null&&(Yr=[]),e=yh(Yr,e,n),n=Ye,(Ut===null?n.memoizedState:Ut.next)===null&&(n=n.alternate,N.H=n===null||n.memoizedState===null?op:wu),e}function Pa(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return _l(e);if(e.$$typeof===L)return Kt(e)}throw Error(a(438,String(e)))}function fu(e){var n=null,r=Ye.updateQueue;if(r!==null&&(n=r.memoCache),n==null){var s=Ye.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(n={data:s.data.map(function(d){return d.slice()}),index:0})))}if(n==null&&(n={data:[],index:0}),r===null&&(r=Za(),Ye.updateQueue=r),r.memoCache=n,r=n.data[n.index],r===void 0)for(r=n.data[n.index]=Array(e),s=0;s<e;s++)r[s]=E;return n.index++,r}function li(e,n){return typeof n=="function"?n(e):n}function Ja(e){var n=Lt();return du(n,vt,e)}function du(e,n,r){var s=e.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=r;var d=e.baseQueue,m=s.pending;if(m!==null){if(d!==null){var S=d.next;d.next=m.next,m.next=S}n.baseQueue=d=m,s.pending=null}if(m=e.baseState,d===null)e.memoizedState=m;else{n=d.next;var C=S=null,I=null,ie=n,ce=!1;do{var de=ie.lane&-536870913;if(de!==ie.lane?(et&de)===de:(ri&de)===de){var le=ie.revertLane;if(le===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),de===Br&&(ce=!0);else if((ri&le)===le){ie=ie.next,le===Br&&(ce=!0);continue}else de={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},I===null?(C=I=de,S=m):I=I.next=de,Ye.lanes|=le,Ri|=le;de=ie.action,sr&&r(m,de),m=ie.hasEagerState?ie.eagerState:r(m,de)}else le={lane:de,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},I===null?(C=I=le,S=m):I=I.next=le,Ye.lanes|=de,Ri|=de;ie=ie.next}while(ie!==null&&ie!==n);if(I===null?S=m:I.next=C,!mn(m,e.memoizedState)&&(qt=!0,ce&&(r=Ur,r!==null)))throw r;e.memoizedState=m,e.baseState=S,e.baseQueue=I,s.lastRenderedState=m}return d===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function hu(e){var n=Lt(),r=n.queue;if(r===null)throw Error(a(311));r.lastRenderedReducer=e;var s=r.dispatch,d=r.pending,m=n.memoizedState;if(d!==null){r.pending=null;var S=d=d.next;do m=e(m,S.action),S=S.next;while(S!==d);mn(m,n.memoizedState)||(qt=!0),n.memoizedState=m,n.baseQueue===null&&(n.baseState=m),r.lastRenderedState=m}return[m,s]}function Ah(e,n,r){var s=Ye,d=Lt(),m=it;if(m){if(r===void 0)throw Error(a(407));r=r()}else r=n();var S=!mn((vt||d).memoizedState,r);if(S&&(d.memoizedState=r,qt=!0),d=d.queue,gu(Rh.bind(null,s,d,e),[e]),d.getSnapshot!==n||S||Ut!==null&&Ut.memoizedState.tag&1){if(s.flags|=2048,Gr(9,{destroy:void 0},zh.bind(null,s,d,r,n),null),jt===null)throw Error(a(349));m||(ri&127)!==0||Th(s,n,r)}return r}function Th(e,n,r){e.flags|=16384,e={getSnapshot:n,value:r},n=Ye.updateQueue,n===null?(n=Za(),Ye.updateQueue=n,n.stores=[e]):(r=n.stores,r===null?n.stores=[e]:r.push(e))}function zh(e,n,r,s){n.value=r,n.getSnapshot=s,Dh(n)&&Mh(e)}function Rh(e,n,r){return r(function(){Dh(n)&&Mh(e)})}function Dh(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!mn(e,r)}catch{return!0}}function Mh(e){var n=Ji(e,2);n!==null&&fn(n,e,2)}function pu(e){var n=nn();if(typeof e=="function"){var r=e;if(e=r(),sr){$e(!0);try{r()}finally{$e(!1)}}}return n.memoizedState=n.baseState=e,n.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:e},n}function _h(e,n,r,s){return e.baseState=r,du(e,vt,typeof s=="function"?s:li)}function Nx(e,n,r,s,d){if(ts(e))throw Error(a(485));if(e=n.action,e!==null){var m={payload:d,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){m.listeners.push(S)}};N.T!==null?r(!0):m.isTransition=!1,s(m),r=n.pending,r===null?(m.next=n.pending=m,Oh(n,m)):(m.next=r.next,n.pending=r.next=m)}}function Oh(e,n){var r=n.action,s=n.payload,d=e.state;if(n.isTransition){var m=N.T,S={};N.T=S;try{var C=r(d,s),I=N.S;I!==null&&I(S,C),Lh(e,n,C)}catch(ie){mu(e,n,ie)}finally{m!==null&&S.types!==null&&(m.types=S.types),N.T=m}}else try{m=r(d,s),Lh(e,n,m)}catch(ie){mu(e,n,ie)}}function Lh(e,n,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(s){Bh(e,n,s)},function(s){return mu(e,n,s)}):Bh(e,n,r)}function Bh(e,n,r){n.status="fulfilled",n.value=r,Uh(n),e.state=r,n=e.pending,n!==null&&(r=n.next,r===n?e.pending=null:(r=r.next,n.next=r,Oh(e,r)))}function mu(e,n,r){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do n.status="rejected",n.reason=r,Uh(n),n=n.next;while(n!==s)}e.action=null}function Uh(e){e=e.listeners;for(var n=0;n<e.length;n++)(0,e[n])()}function qh(e,n){return n}function Ih(e,n){if(it){var r=jt.formState;if(r!==null){e:{var s=Ye;if(it){if(At){t:{for(var d=At,m=zn;d.nodeType!==8;){if(!m){d=null;break t}if(d=Dn(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){At=Dn(d.nextSibling),s=d.data==="F!";break e}}wi(s)}s=!1}s&&(n=r[0])}}return r=nn(),r.memoizedState=r.baseState=n,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qh,lastRenderedState:n},r.queue=s,r=lp.bind(null,Ye,s),s.dispatch=r,s=pu(!1),m=Su.bind(null,Ye,!1,s.queue),s=nn(),d={state:n,dispatch:null,action:e,pending:null},s.queue=d,r=Nx.bind(null,Ye,d,m,r),d.dispatch=r,s.memoizedState=e,[n,r,!1]}function Hh(e){var n=Lt();return Vh(n,vt,e)}function Vh(e,n,r){if(n=du(e,n,qh)[0],e=Ja(li)[0],typeof n=="object"&&n!==null&&typeof n.then=="function")try{var s=_l(n)}catch(S){throw S===qr?Va:S}else s=n;n=Lt();var d=n.queue,m=d.dispatch;return r!==n.memoizedState&&(Ye.flags|=2048,Gr(9,{destroy:void 0},Ax.bind(null,d,r),null)),[s,m,e]}function Ax(e,n){e.action=n}function Yh(e){var n=Lt(),r=vt;if(r!==null)return Vh(n,r,e);Lt(),n=n.memoizedState,r=Lt();var s=r.queue.dispatch;return r.memoizedState=e,[n,s,!1]}function Gr(e,n,r,s){return e={tag:e,create:r,deps:s,inst:n,next:null},n=Ye.updateQueue,n===null&&(n=Za(),Ye.updateQueue=n),r=n.lastEffect,r===null?n.lastEffect=e.next=e:(s=r.next,r.next=e,e.next=s,n.lastEffect=e),e}function Gh(){return Lt().memoizedState}function Wa(e,n,r,s){var d=nn();Ye.flags|=e,d.memoizedState=Gr(1|n,{destroy:void 0},r,s===void 0?null:s)}function es(e,n,r,s){var d=Lt();s=s===void 0?null:s;var m=d.memoizedState.inst;vt!==null&&s!==null&&au(s,vt.memoizedState.deps)?d.memoizedState=Gr(n,m,r,s):(Ye.flags|=e,d.memoizedState=Gr(1|n,m,r,s))}function Fh(e,n){Wa(8390656,8,e,n)}function gu(e,n){es(2048,8,e,n)}function Tx(e){Ye.flags|=4;var n=Ye.updateQueue;if(n===null)n=Za(),Ye.updateQueue=n,n.events=[e];else{var r=n.events;r===null?n.events=[e]:r.push(e)}}function Qh(e){var n=Lt().memoizedState;return Tx({ref:n,nextImpl:e}),function(){if((ht&2)!==0)throw Error(a(440));return n.impl.apply(void 0,arguments)}}function Xh(e,n){return es(4,2,e,n)}function Kh(e,n){return es(4,4,e,n)}function $h(e,n){if(typeof n=="function"){e=e();var r=n(e);return function(){typeof r=="function"?r():n(null)}}if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Zh(e,n,r){r=r!=null?r.concat([e]):null,es(4,4,$h.bind(null,n,e),r)}function yu(){}function Ph(e,n){var r=Lt();n=n===void 0?null:n;var s=r.memoizedState;return n!==null&&au(n,s[1])?s[0]:(r.memoizedState=[e,n],e)}function Jh(e,n){var r=Lt();n=n===void 0?null:n;var s=r.memoizedState;if(n!==null&&au(n,s[1]))return s[0];if(s=e(),sr){$e(!0);try{e()}finally{$e(!1)}}return r.memoizedState=[s,n],s}function bu(e,n,r){return r===void 0||(ri&1073741824)!==0&&(et&261930)===0?e.memoizedState=n:(e.memoizedState=r,e=Wp(),Ye.lanes|=e,Ri|=e,r)}function Wh(e,n,r,s){return mn(r,n)?r:Hr.current!==null?(e=bu(e,r,s),mn(e,n)||(qt=!0),e):(ri&42)===0||(ri&1073741824)!==0&&(et&261930)===0?(qt=!0,e.memoizedState=r):(e=Wp(),Ye.lanes|=e,Ri|=e,n)}function ep(e,n,r,s,d){var m=K.p;K.p=m!==0&&8>m?m:8;var S=N.T,C={};N.T=C,Su(e,!1,n,r);try{var I=d(),ie=N.S;if(ie!==null&&ie(C,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ce=kx(I,s);Ol(e,n,ce,Sn(e))}else Ol(e,n,s,Sn(e))}catch(de){Ol(e,n,{then:function(){},status:"rejected",reason:de},Sn())}finally{K.p=m,S!==null&&C.types!==null&&(S.types=C.types),N.T=S}}function zx(){}function vu(e,n,r,s){if(e.tag!==5)throw Error(a(476));var d=tp(e).queue;ep(e,d,n,he,r===null?zx:function(){return np(e),r(s)})}function tp(e){var n=e.memoizedState;if(n!==null)return n;n={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:he},next:null};var r={};return n.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:li,lastRenderedState:r},next:null},e.memoizedState=n,e=e.alternate,e!==null&&(e.memoizedState=n),n}function np(e){var n=tp(e);n.next===null&&(n=e.alternate.memoizedState),Ol(e,n.next.queue,{},Sn())}function xu(){return Kt(Jl)}function ip(){return Lt().memoizedState}function rp(){return Lt().memoizedState}function Rx(e){for(var n=e.return;n!==null;){switch(n.tag){case 24:case 3:var r=Sn();e=Ci(r);var s=Ei(n,e,r);s!==null&&(fn(s,n,r),zl(s,n,r)),n={cache:$o()},e.payload=n;return}n=n.return}}function Dx(e,n,r){var s=Sn();r={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},ts(e)?ap(n,r):(r=Uo(e,n,r,s),r!==null&&(fn(r,e,s),sp(r,n,s)))}function lp(e,n,r){var s=Sn();Ol(e,n,r,s)}function Ol(e,n,r,s){var d={lane:s,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(ts(e))ap(n,d);else{var m=e.alternate;if(e.lanes===0&&(m===null||m.lanes===0)&&(m=n.lastRenderedReducer,m!==null))try{var S=n.lastRenderedState,C=m(S,r);if(d.hasEagerState=!0,d.eagerState=C,mn(C,S))return Oa(e,n,d,0),jt===null&&_a(),!1}catch{}if(r=Uo(e,n,d,s),r!==null)return fn(r,e,s),sp(r,n,s),!0}return!1}function Su(e,n,r,s){if(s={lane:2,revertLane:Wu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},ts(e)){if(n)throw Error(a(479))}else n=Uo(e,r,s,2),n!==null&&fn(n,e,2)}function ts(e){var n=e.alternate;return e===Ye||n!==null&&n===Ye}function ap(e,n){Vr=Ka=!0;var r=e.pending;r===null?n.next=n:(n.next=r.next,r.next=n),e.pending=n}function sp(e,n,r){if((r&4194048)!==0){var s=n.lanes;s&=e.pendingLanes,r|=s,n.lanes=r,On(e,r)}}var Ll={readContext:Kt,use:Pa,useCallback:Mt,useContext:Mt,useEffect:Mt,useImperativeHandle:Mt,useLayoutEffect:Mt,useInsertionEffect:Mt,useMemo:Mt,useReducer:Mt,useRef:Mt,useState:Mt,useDebugValue:Mt,useDeferredValue:Mt,useTransition:Mt,useSyncExternalStore:Mt,useId:Mt,useHostTransitionStatus:Mt,useFormState:Mt,useActionState:Mt,useOptimistic:Mt,useMemoCache:Mt,useCacheRefresh:Mt};Ll.useEffectEvent=Mt;var op={readContext:Kt,use:Pa,useCallback:function(e,n){return nn().memoizedState=[e,n===void 0?null:n],e},useContext:Kt,useEffect:Fh,useImperativeHandle:function(e,n,r){r=r!=null?r.concat([e]):null,Wa(4194308,4,$h.bind(null,n,e),r)},useLayoutEffect:function(e,n){return Wa(4194308,4,e,n)},useInsertionEffect:function(e,n){Wa(4,2,e,n)},useMemo:function(e,n){var r=nn();n=n===void 0?null:n;var s=e();if(sr){$e(!0);try{e()}finally{$e(!1)}}return r.memoizedState=[s,n],s},useReducer:function(e,n,r){var s=nn();if(r!==void 0){var d=r(n);if(sr){$e(!0);try{r(n)}finally{$e(!1)}}}else d=n;return s.memoizedState=s.baseState=d,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:d},s.queue=e,e=e.dispatch=Dx.bind(null,Ye,e),[s.memoizedState,e]},useRef:function(e){var n=nn();return e={current:e},n.memoizedState=e},useState:function(e){e=pu(e);var n=e.queue,r=lp.bind(null,Ye,n);return n.dispatch=r,[e.memoizedState,r]},useDebugValue:yu,useDeferredValue:function(e,n){var r=nn();return bu(r,e,n)},useTransition:function(){var e=pu(!1);return e=ep.bind(null,Ye,e.queue,!0,!1),nn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,n,r){var s=Ye,d=nn();if(it){if(r===void 0)throw Error(a(407));r=r()}else{if(r=n(),jt===null)throw Error(a(349));(et&127)!==0||Th(s,n,r)}d.memoizedState=r;var m={value:r,getSnapshot:n};return d.queue=m,Fh(Rh.bind(null,s,m,e),[e]),s.flags|=2048,Gr(9,{destroy:void 0},zh.bind(null,s,m,r,n),null),r},useId:function(){var e=nn(),n=jt.identifierPrefix;if(it){var r=Gn,s=Yn;r=(s&~(1<<32-Ze(s)-1)).toString(32)+r,n="_"+n+"R_"+r,r=$a++,0<r&&(n+="H"+r.toString(32)),n+="_"}else r=Cx++,n="_"+n+"r_"+r.toString(32)+"_";return e.memoizedState=n},useHostTransitionStatus:xu,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var n=nn();n.memoizedState=n.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return n.queue=r,n=Su.bind(null,Ye,!0,r),r.dispatch=n,[e,n]},useMemoCache:fu,useCacheRefresh:function(){return nn().memoizedState=Rx.bind(null,Ye)},useEffectEvent:function(e){var n=nn(),r={impl:e};return n.memoizedState=r,function(){if((ht&2)!==0)throw Error(a(440));return r.impl.apply(void 0,arguments)}}},wu={readContext:Kt,use:Pa,useCallback:Ph,useContext:Kt,useEffect:gu,useImperativeHandle:Zh,useInsertionEffect:Xh,useLayoutEffect:Kh,useMemo:Jh,useReducer:Ja,useRef:Gh,useState:function(){return Ja(li)},useDebugValue:yu,useDeferredValue:function(e,n){var r=Lt();return Wh(r,vt.memoizedState,e,n)},useTransition:function(){var e=Ja(li)[0],n=Lt().memoizedState;return[typeof e=="boolean"?e:_l(e),n]},useSyncExternalStore:Ah,useId:ip,useHostTransitionStatus:xu,useFormState:Hh,useActionState:Hh,useOptimistic:function(e,n){var r=Lt();return _h(r,vt,e,n)},useMemoCache:fu,useCacheRefresh:rp};wu.useEffectEvent=Qh;var up={readContext:Kt,use:Pa,useCallback:Ph,useContext:Kt,useEffect:gu,useImperativeHandle:Zh,useInsertionEffect:Xh,useLayoutEffect:Kh,useMemo:Jh,useReducer:hu,useRef:Gh,useState:function(){return hu(li)},useDebugValue:yu,useDeferredValue:function(e,n){var r=Lt();return vt===null?bu(r,e,n):Wh(r,vt.memoizedState,e,n)},useTransition:function(){var e=hu(li)[0],n=Lt().memoizedState;return[typeof e=="boolean"?e:_l(e),n]},useSyncExternalStore:Ah,useId:ip,useHostTransitionStatus:xu,useFormState:Yh,useActionState:Yh,useOptimistic:function(e,n){var r=Lt();return vt!==null?_h(r,vt,e,n):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:fu,useCacheRefresh:rp};up.useEffectEvent=Qh;function ju(e,n,r,s){n=e.memoizedState,r=r(s,n),r=r==null?n:y({},n,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var ku={enqueueSetState:function(e,n,r){e=e._reactInternals;var s=Sn(),d=Ci(s);d.payload=n,r!=null&&(d.callback=r),n=Ei(e,d,s),n!==null&&(fn(n,e,s),zl(n,e,s))},enqueueReplaceState:function(e,n,r){e=e._reactInternals;var s=Sn(),d=Ci(s);d.tag=1,d.payload=n,r!=null&&(d.callback=r),n=Ei(e,d,s),n!==null&&(fn(n,e,s),zl(n,e,s))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var r=Sn(),s=Ci(r);s.tag=2,n!=null&&(s.callback=n),n=Ei(e,s,r),n!==null&&(fn(n,e,r),zl(n,e,r))}};function cp(e,n,r,s,d,m,S){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,m,S):n.prototype&&n.prototype.isPureReactComponent?!wl(r,s)||!wl(d,m):!0}function fp(e,n,r,s){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(r,s),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(r,s),n.state!==e&&ku.enqueueReplaceState(n,n.state,null)}function or(e,n){var r=n;if("ref"in n){r={};for(var s in n)s!=="ref"&&(r[s]=n[s])}if(e=e.defaultProps){r===n&&(r=y({},r));for(var d in e)r[d]===void 0&&(r[d]=e[d])}return r}function dp(e){Ma(e)}function hp(e){console.error(e)}function pp(e){Ma(e)}function ns(e,n){try{var r=e.onUncaughtError;r(n.value,{componentStack:n.stack})}catch(s){setTimeout(function(){throw s})}}function mp(e,n,r){try{var s=e.onCaughtError;s(r.value,{componentStack:r.stack,errorBoundary:n.tag===1?n.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Cu(e,n,r){return r=Ci(r),r.tag=3,r.payload={element:null},r.callback=function(){ns(e,n)},r}function gp(e){return e=Ci(e),e.tag=3,e}function yp(e,n,r,s){var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var m=s.value;e.payload=function(){return d(m)},e.callback=function(){mp(n,r,s)}}var S=r.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(e.callback=function(){mp(n,r,s),typeof d!="function"&&(Di===null?Di=new Set([this]):Di.add(this));var C=s.stack;this.componentDidCatch(s.value,{componentStack:C!==null?C:""})})}function Mx(e,n,r,s,d){if(r.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(n=r.alternate,n!==null&&Lr(n,r,d,!0),r=yn.current,r!==null){switch(r.tag){case 31:case 13:return Rn===null?ps():r.alternate===null&&_t===0&&(_t=3),r.flags&=-257,r.flags|=65536,r.lanes=d,s===Ya?r.flags|=16384:(n=r.updateQueue,n===null?r.updateQueue=new Set([s]):n.add(s),Zu(e,s,d)),!1;case 22:return r.flags|=65536,s===Ya?r.flags|=16384:(n=r.updateQueue,n===null?(n={transitions:null,markerInstances:null,retryQueue:new Set([s])},r.updateQueue=n):(r=n.retryQueue,r===null?n.retryQueue=new Set([s]):r.add(s)),Zu(e,s,d)),!1}throw Error(a(435,r.tag))}return Zu(e,s,d),ps(),!1}if(it)return n=yn.current,n!==null?((n.flags&65536)===0&&(n.flags|=256),n.flags|=65536,n.lanes=d,s!==Go&&(e=Error(a(422),{cause:s}),Cl(Nn(e,r)))):(s!==Go&&(n=Error(a(423),{cause:s}),Cl(Nn(n,r))),e=e.current.alternate,e.flags|=65536,d&=-d,e.lanes|=d,s=Nn(s,r),d=Cu(e.stateNode,s,d),tu(e,d),_t!==4&&(_t=2)),!1;var m=Error(a(520),{cause:s});if(m=Nn(m,r),Gl===null?Gl=[m]:Gl.push(m),_t!==4&&(_t=2),n===null)return!0;s=Nn(s,r),r=n;do{switch(r.tag){case 3:return r.flags|=65536,e=d&-d,r.lanes|=e,e=Cu(r.stateNode,s,e),tu(r,e),!1;case 1:if(n=r.type,m=r.stateNode,(r.flags&128)===0&&(typeof n.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(Di===null||!Di.has(m))))return r.flags|=65536,d&=-d,r.lanes|=d,d=gp(d),yp(d,e,r,s),tu(r,d),!1}r=r.return}while(r!==null);return!1}var Eu=Error(a(461)),qt=!1;function $t(e,n,r,s){n.child=e===null?Sh(n,null,r,s):ar(n,e.child,r,s)}function bp(e,n,r,s,d){r=r.render;var m=n.ref;if("ref"in s){var S={};for(var C in s)C!=="ref"&&(S[C]=s[C])}else S=s;return nr(n),s=su(e,n,r,S,m,d),C=ou(),e!==null&&!qt?(uu(e,n,d),ai(e,n,d)):(it&&C&&Vo(n),n.flags|=1,$t(e,n,s,d),n.child)}function vp(e,n,r,s,d){if(e===null){var m=r.type;return typeof m=="function"&&!qo(m)&&m.defaultProps===void 0&&r.compare===null?(n.tag=15,n.type=m,xp(e,n,m,s,d)):(e=Ba(r.type,null,s,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(m=e.child,!_u(e,d)){var S=m.memoizedProps;if(r=r.compare,r=r!==null?r:wl,r(S,s)&&e.ref===n.ref)return ai(e,n,d)}return n.flags|=1,e=ei(m,s),e.ref=n.ref,e.return=n,n.child=e}function xp(e,n,r,s,d){if(e!==null){var m=e.memoizedProps;if(wl(m,s)&&e.ref===n.ref)if(qt=!1,n.pendingProps=s=m,_u(e,d))(e.flags&131072)!==0&&(qt=!0);else return n.lanes=e.lanes,ai(e,n,d)}return Nu(e,n,r,s,d)}function Sp(e,n,r,s){var d=s.children,m=e!==null?e.memoizedState:null;if(e===null&&n.stateNode===null&&(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((n.flags&128)!==0){if(m=m!==null?m.baseLanes|r:r,e!==null){for(s=n.child=e.child,d=0;s!==null;)d=d|s.lanes|s.childLanes,s=s.sibling;s=d&~m}else s=0,n.child=null;return wp(e,n,m,r,s)}if((r&536870912)!==0)n.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ha(n,m!==null?m.cachePool:null),m!==null?kh(n,m):iu(),Ch(n);else return s=n.lanes=536870912,wp(e,n,m!==null?m.baseLanes|r:r,r,s)}else m!==null?(Ha(n,m.cachePool),kh(n,m),Ai(),n.memoizedState=null):(e!==null&&Ha(n,null),iu(),Ai());return $t(e,n,d,r),n.child}function Bl(e,n){return e!==null&&e.tag===22||n.stateNode!==null||(n.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),n.sibling}function wp(e,n,r,s,d){var m=Po();return m=m===null?null:{parent:Bt._currentValue,pool:m},n.memoizedState={baseLanes:r,cachePool:m},e!==null&&Ha(n,null),iu(),Ch(n),e!==null&&Lr(e,n,s,!0),n.childLanes=d,null}function is(e,n){return n=ls({mode:n.mode,children:n.children},e.mode),n.ref=e.ref,e.child=n,n.return=e,n}function jp(e,n,r){return ar(n,e.child,null,r),e=is(n,n.pendingProps),e.flags|=2,bn(n),n.memoizedState=null,e}function _x(e,n,r){var s=n.pendingProps,d=(n.flags&128)!==0;if(n.flags&=-129,e===null){if(it){if(s.mode==="hidden")return e=is(n,s),n.lanes=536870912,Bl(null,e);if(lu(n),(e=At)?(e=Om(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:xi!==null?{id:Yn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},r=ah(e),r.return=n,n.child=r,Xt=n,At=null)):e=null,e===null)throw wi(n);return n.lanes=536870912,null}return is(n,s)}var m=e.memoizedState;if(m!==null){var S=m.dehydrated;if(lu(n),d)if(n.flags&256)n.flags&=-257,n=jp(e,n,r);else if(n.memoizedState!==null)n.child=e.child,n.flags|=128,n=null;else throw Error(a(558));else if(qt||Lr(e,n,r,!1),d=(r&e.childLanes)!==0,qt||d){if(s=jt,s!==null&&(S=yi(s,r),S!==0&&S!==m.retryLane))throw m.retryLane=S,Ji(e,S),fn(s,e,S),Eu;ps(),n=jp(e,n,r)}else e=m.treeContext,At=Dn(S.nextSibling),Xt=n,it=!0,Si=null,zn=!1,e!==null&&uh(n,e),n=is(n,s),n.flags|=4096;return n}return e=ei(e.child,{mode:s.mode,children:s.children}),e.ref=n.ref,n.child=e,e.return=n,e}function rs(e,n){var r=n.ref;if(r===null)e!==null&&e.ref!==null&&(n.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(a(284));(e===null||e.ref!==r)&&(n.flags|=4194816)}}function Nu(e,n,r,s,d){return nr(n),r=su(e,n,r,s,void 0,d),s=ou(),e!==null&&!qt?(uu(e,n,d),ai(e,n,d)):(it&&s&&Vo(n),n.flags|=1,$t(e,n,r,d),n.child)}function kp(e,n,r,s,d,m){return nr(n),n.updateQueue=null,r=Nh(n,s,r,d),Eh(e),s=ou(),e!==null&&!qt?(uu(e,n,m),ai(e,n,m)):(it&&s&&Vo(n),n.flags|=1,$t(e,n,r,m),n.child)}function Cp(e,n,r,s,d){if(nr(n),n.stateNode===null){var m=Dr,S=r.contextType;typeof S=="object"&&S!==null&&(m=Kt(S)),m=new r(s,m),n.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=ku,n.stateNode=m,m._reactInternals=n,m=n.stateNode,m.props=s,m.state=n.memoizedState,m.refs={},Wo(n),S=r.contextType,m.context=typeof S=="object"&&S!==null?Kt(S):Dr,m.state=n.memoizedState,S=r.getDerivedStateFromProps,typeof S=="function"&&(ju(n,r,S,s),m.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(S=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),S!==m.state&&ku.enqueueReplaceState(m,m.state,null),Dl(n,s,m,d),Rl(),m.state=n.memoizedState),typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!0}else if(e===null){m=n.stateNode;var C=n.memoizedProps,I=or(r,C);m.props=I;var ie=m.context,ce=r.contextType;S=Dr,typeof ce=="object"&&ce!==null&&(S=Kt(ce));var de=r.getDerivedStateFromProps;ce=typeof de=="function"||typeof m.getSnapshotBeforeUpdate=="function",C=n.pendingProps!==C,ce||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(C||ie!==S)&&fp(n,m,s,S),ki=!1;var le=n.memoizedState;m.state=le,Dl(n,s,m,d),Rl(),ie=n.memoizedState,C||le!==ie||ki?(typeof de=="function"&&(ju(n,r,de,s),ie=n.memoizedState),(I=ki||cp(n,r,I,s,le,ie,S))?(ce||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(n.flags|=4194308)):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=s,n.memoizedState=ie),m.props=s,m.state=ie,m.context=S,s=I):(typeof m.componentDidMount=="function"&&(n.flags|=4194308),s=!1)}else{m=n.stateNode,eu(e,n),S=n.memoizedProps,ce=or(r,S),m.props=ce,de=n.pendingProps,le=m.context,ie=r.contextType,I=Dr,typeof ie=="object"&&ie!==null&&(I=Kt(ie)),C=r.getDerivedStateFromProps,(ie=typeof C=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(S!==de||le!==I)&&fp(n,m,s,I),ki=!1,le=n.memoizedState,m.state=le,Dl(n,s,m,d),Rl();var ue=n.memoizedState;S!==de||le!==ue||ki||e!==null&&e.dependencies!==null&&qa(e.dependencies)?(typeof C=="function"&&(ju(n,r,C,s),ue=n.memoizedState),(ce=ki||cp(n,r,ce,s,le,ue,I)||e!==null&&e.dependencies!==null&&qa(e.dependencies))?(ie||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(s,ue,I),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(s,ue,I)),typeof m.componentDidUpdate=="function"&&(n.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&le===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&le===e.memoizedState||(n.flags|=1024),n.memoizedProps=s,n.memoizedState=ue),m.props=s,m.state=ue,m.context=I,s=ce):(typeof m.componentDidUpdate!="function"||S===e.memoizedProps&&le===e.memoizedState||(n.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||S===e.memoizedProps&&le===e.memoizedState||(n.flags|=1024),s=!1)}return m=s,rs(e,n),s=(n.flags&128)!==0,m||s?(m=n.stateNode,r=s&&typeof r.getDerivedStateFromError!="function"?null:m.render(),n.flags|=1,e!==null&&s?(n.child=ar(n,e.child,null,d),n.child=ar(n,null,r,d)):$t(e,n,r,d),n.memoizedState=m.state,e=n.child):e=ai(e,n,d),e}function Ep(e,n,r,s){return er(),n.flags|=256,$t(e,n,r,s),n.child}var Au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tu(e){return{baseLanes:e,cachePool:mh()}}function zu(e,n,r){return e=e!==null?e.childLanes&~r:0,n&&(e|=xn),e}function Np(e,n,r){var s=n.pendingProps,d=!1,m=(n.flags&128)!==0,S;if((S=m)||(S=e!==null&&e.memoizedState===null?!1:(Ot.current&2)!==0),S&&(d=!0,n.flags&=-129),S=(n.flags&32)!==0,n.flags&=-33,e===null){if(it){if(d?Ni(n):Ai(),(e=At)?(e=Om(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(n.memoizedState={dehydrated:e,treeContext:xi!==null?{id:Yn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},r=ah(e),r.return=n,n.child=r,Xt=n,At=null)):e=null,e===null)throw wi(n);return dc(e)?n.lanes=32:n.lanes=536870912,null}var C=s.children;return s=s.fallback,d?(Ai(),d=n.mode,C=ls({mode:"hidden",children:C},d),s=Wi(s,d,r,null),C.return=n,s.return=n,C.sibling=s,n.child=C,s=n.child,s.memoizedState=Tu(r),s.childLanes=zu(e,S,r),n.memoizedState=Au,Bl(null,s)):(Ni(n),Ru(n,C))}var I=e.memoizedState;if(I!==null&&(C=I.dehydrated,C!==null)){if(m)n.flags&256?(Ni(n),n.flags&=-257,n=Du(e,n,r)):n.memoizedState!==null?(Ai(),n.child=e.child,n.flags|=128,n=null):(Ai(),C=s.fallback,d=n.mode,s=ls({mode:"visible",children:s.children},d),C=Wi(C,d,r,null),C.flags|=2,s.return=n,C.return=n,s.sibling=C,n.child=s,ar(n,e.child,null,r),s=n.child,s.memoizedState=Tu(r),s.childLanes=zu(e,S,r),n.memoizedState=Au,n=Bl(null,s));else if(Ni(n),dc(C)){if(S=C.nextSibling&&C.nextSibling.dataset,S)var ie=S.dgst;S=ie,s=Error(a(419)),s.stack="",s.digest=S,Cl({value:s,source:null,stack:null}),n=Du(e,n,r)}else if(qt||Lr(e,n,r,!1),S=(r&e.childLanes)!==0,qt||S){if(S=jt,S!==null&&(s=yi(S,r),s!==0&&s!==I.retryLane))throw I.retryLane=s,Ji(e,s),fn(S,e,s),Eu;fc(C)||ps(),n=Du(e,n,r)}else fc(C)?(n.flags|=192,n.child=e.child,n=null):(e=I.treeContext,At=Dn(C.nextSibling),Xt=n,it=!0,Si=null,zn=!1,e!==null&&uh(n,e),n=Ru(n,s.children),n.flags|=4096);return n}return d?(Ai(),C=s.fallback,d=n.mode,I=e.child,ie=I.sibling,s=ei(I,{mode:"hidden",children:s.children}),s.subtreeFlags=I.subtreeFlags&65011712,ie!==null?C=ei(ie,C):(C=Wi(C,d,r,null),C.flags|=2),C.return=n,s.return=n,s.sibling=C,n.child=s,Bl(null,s),s=n.child,C=e.child.memoizedState,C===null?C=Tu(r):(d=C.cachePool,d!==null?(I=Bt._currentValue,d=d.parent!==I?{parent:I,pool:I}:d):d=mh(),C={baseLanes:C.baseLanes|r,cachePool:d}),s.memoizedState=C,s.childLanes=zu(e,S,r),n.memoizedState=Au,Bl(e.child,s)):(Ni(n),r=e.child,e=r.sibling,r=ei(r,{mode:"visible",children:s.children}),r.return=n,r.sibling=null,e!==null&&(S=n.deletions,S===null?(n.deletions=[e],n.flags|=16):S.push(e)),n.child=r,n.memoizedState=null,r)}function Ru(e,n){return n=ls({mode:"visible",children:n},e.mode),n.return=e,e.child=n}function ls(e,n){return e=gn(22,e,null,n),e.lanes=0,e}function Du(e,n,r){return ar(n,e.child,null,r),e=Ru(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ap(e,n,r){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n),Xo(e.return,n,r)}function Mu(e,n,r,s,d,m){var S=e.memoizedState;S===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:d,treeForkCount:m}:(S.isBackwards=n,S.rendering=null,S.renderingStartTime=0,S.last=s,S.tail=r,S.tailMode=d,S.treeForkCount=m)}function Tp(e,n,r){var s=n.pendingProps,d=s.revealOrder,m=s.tail;s=s.children;var S=Ot.current,C=(S&2)!==0;if(C?(S=S&1|2,n.flags|=128):S&=1,A(Ot,S),$t(e,n,s,r),s=it?kl:0,!C&&e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ap(e,r,n);else if(e.tag===19)Ap(e,r,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(d){case"forwards":for(r=n.child,d=null;r!==null;)e=r.alternate,e!==null&&Xa(e)===null&&(d=r),r=r.sibling;r=d,r===null?(d=n.child,n.child=null):(d=r.sibling,r.sibling=null),Mu(n,!1,d,r,m,s);break;case"backwards":case"unstable_legacy-backwards":for(r=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&Xa(e)===null){n.child=d;break}e=d.sibling,d.sibling=r,r=d,d=e}Mu(n,!0,r,null,m,s);break;case"together":Mu(n,!1,null,null,void 0,s);break;default:n.memoizedState=null}return n.child}function ai(e,n,r){if(e!==null&&(n.dependencies=e.dependencies),Ri|=n.lanes,(r&n.childLanes)===0)if(e!==null){if(Lr(e,n,r,!1),(r&n.childLanes)===0)return null}else return null;if(e!==null&&n.child!==e.child)throw Error(a(153));if(n.child!==null){for(e=n.child,r=ei(e,e.pendingProps),n.child=r,r.return=n;e.sibling!==null;)e=e.sibling,r=r.sibling=ei(e,e.pendingProps),r.return=n;r.sibling=null}return n.child}function _u(e,n){return(e.lanes&n)!==0?!0:(e=e.dependencies,!!(e!==null&&qa(e)))}function Ox(e,n,r){switch(n.tag){case 3:we(n,n.stateNode.containerInfo),ji(n,Bt,e.memoizedState.cache),er();break;case 27:case 5:be(n);break;case 4:we(n,n.stateNode.containerInfo);break;case 10:ji(n,n.type,n.memoizedProps.value);break;case 31:if(n.memoizedState!==null)return n.flags|=128,lu(n),null;break;case 13:var s=n.memoizedState;if(s!==null)return s.dehydrated!==null?(Ni(n),n.flags|=128,null):(r&n.child.childLanes)!==0?Np(e,n,r):(Ni(n),e=ai(e,n,r),e!==null?e.sibling:null);Ni(n);break;case 19:var d=(e.flags&128)!==0;if(s=(r&n.childLanes)!==0,s||(Lr(e,n,r,!1),s=(r&n.childLanes)!==0),d){if(s)return Tp(e,n,r);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),A(Ot,Ot.current),s)break;return null;case 22:return n.lanes=0,Sp(e,n,r,n.pendingProps);case 24:ji(n,Bt,e.memoizedState.cache)}return ai(e,n,r)}function zp(e,n,r){if(e!==null)if(e.memoizedProps!==n.pendingProps)qt=!0;else{if(!_u(e,r)&&(n.flags&128)===0)return qt=!1,Ox(e,n,r);qt=(e.flags&131072)!==0}else qt=!1,it&&(n.flags&1048576)!==0&&oh(n,kl,n.index);switch(n.lanes=0,n.tag){case 16:e:{var s=n.pendingProps;if(e=rr(n.elementType),n.type=e,typeof e=="function")qo(e)?(s=or(e,s),n.tag=1,n=Cp(null,n,e,s,r)):(n.tag=0,n=Nu(null,n,e,s,r));else{if(e!=null){var d=e.$$typeof;if(d===G){n.tag=11,n=bp(null,n,e,s,r);break e}else if(d===V){n.tag=14,n=vp(null,n,e,s,r);break e}}throw n=ee(e)||e,Error(a(306,n,""))}}return n;case 0:return Nu(e,n,n.type,n.pendingProps,r);case 1:return s=n.type,d=or(s,n.pendingProps),Cp(e,n,s,d,r);case 3:e:{if(we(n,n.stateNode.containerInfo),e===null)throw Error(a(387));s=n.pendingProps;var m=n.memoizedState;d=m.element,eu(e,n),Dl(n,s,null,r);var S=n.memoizedState;if(s=S.cache,ji(n,Bt,s),s!==m.cache&&Ko(n,[Bt],r,!0),Rl(),s=S.element,m.isDehydrated)if(m={element:s,isDehydrated:!1,cache:S.cache},n.updateQueue.baseState=m,n.memoizedState=m,n.flags&256){n=Ep(e,n,s,r);break e}else if(s!==d){d=Nn(Error(a(424)),n),Cl(d),n=Ep(e,n,s,r);break e}else for(e=n.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,At=Dn(e.firstChild),Xt=n,it=!0,Si=null,zn=!0,r=Sh(n,null,s,r),n.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(er(),s===d){n=ai(e,n,r);break e}$t(e,n,s,r)}n=n.child}return n;case 26:return rs(e,n),e===null?(r=Hm(n.type,null,n.pendingProps,null))?n.memoizedState=r:it||(r=n.type,e=n.pendingProps,s=Ss(te.current).createElement(r),s[Qt]=n,s[ln]=e,Zt(s,r,e),Yt(s),n.stateNode=s):n.memoizedState=Hm(n.type,e.memoizedProps,n.pendingProps,e.memoizedState),null;case 27:return be(n),e===null&&it&&(s=n.stateNode=Um(n.type,n.pendingProps,te.current),Xt=n,zn=!0,d=At,Li(n.type)?(hc=d,At=Dn(s.firstChild)):At=d),$t(e,n,n.pendingProps.children,r),rs(e,n),e===null&&(n.flags|=4194304),n.child;case 5:return e===null&&it&&((d=s=At)&&(s=f0(s,n.type,n.pendingProps,zn),s!==null?(n.stateNode=s,Xt=n,At=Dn(s.firstChild),zn=!1,d=!0):d=!1),d||wi(n)),be(n),d=n.type,m=n.pendingProps,S=e!==null?e.memoizedProps:null,s=m.children,oc(d,m)?s=null:S!==null&&oc(d,S)&&(n.flags|=32),n.memoizedState!==null&&(d=su(e,n,Ex,null,null,r),Jl._currentValue=d),rs(e,n),$t(e,n,s,r),n.child;case 6:return e===null&&it&&((e=r=At)&&(r=d0(r,n.pendingProps,zn),r!==null?(n.stateNode=r,Xt=n,At=null,e=!0):e=!1),e||wi(n)),null;case 13:return Np(e,n,r);case 4:return we(n,n.stateNode.containerInfo),s=n.pendingProps,e===null?n.child=ar(n,null,s,r):$t(e,n,s,r),n.child;case 11:return bp(e,n,n.type,n.pendingProps,r);case 7:return $t(e,n,n.pendingProps,r),n.child;case 8:return $t(e,n,n.pendingProps.children,r),n.child;case 12:return $t(e,n,n.pendingProps.children,r),n.child;case 10:return s=n.pendingProps,ji(n,n.type,s.value),$t(e,n,s.children,r),n.child;case 9:return d=n.type._context,s=n.pendingProps.children,nr(n),d=Kt(d),s=s(d),n.flags|=1,$t(e,n,s,r),n.child;case 14:return vp(e,n,n.type,n.pendingProps,r);case 15:return xp(e,n,n.type,n.pendingProps,r);case 19:return Tp(e,n,r);case 31:return _x(e,n,r);case 22:return Sp(e,n,r,n.pendingProps);case 24:return nr(n),s=Kt(Bt),e===null?(d=Po(),d===null&&(d=jt,m=$o(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=r),d=m),n.memoizedState={parent:s,cache:d},Wo(n),ji(n,Bt,d)):((e.lanes&r)!==0&&(eu(e,n),Dl(n,null,null,r),Rl()),d=e.memoizedState,m=n.memoizedState,d.parent!==s?(d={parent:s,cache:s},n.memoizedState=d,n.lanes===0&&(n.memoizedState=n.updateQueue.baseState=d),ji(n,Bt,s)):(s=m.cache,ji(n,Bt,s),s!==d.cache&&Ko(n,[Bt],r,!0))),$t(e,n,n.pendingProps.children,r),n.child;case 29:throw n.pendingProps}throw Error(a(156,n.tag))}function si(e){e.flags|=4}function Ou(e,n,r,s,d){if((n=(e.mode&32)!==0)&&(n=!1),n){if(e.flags|=16777216,(d&335544128)===d)if(e.stateNode.complete)e.flags|=8192;else if(im())e.flags|=8192;else throw lr=Ya,Jo}else e.flags&=-16777217}function Rp(e,n){if(n.type!=="stylesheet"||(n.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Qm(n))if(im())e.flags|=8192;else throw lr=Ya,Jo}function as(e,n){n!==null&&(e.flags|=4),e.flags&16384&&(n=e.tag!==22?Ne():536870912,e.lanes|=n,Kr|=n)}function Ul(e,n){if(!it)switch(e.tailMode){case"hidden":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Tt(e){var n=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(n)for(var d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags&65011712,s|=d.flags&65011712,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)r|=d.lanes|d.childLanes,s|=d.subtreeFlags,s|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=s,e.childLanes=r,n}function Lx(e,n,r){var s=n.pendingProps;switch(Yo(n),n.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tt(n),null;case 1:return Tt(n),null;case 3:return r=n.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),n.memoizedState.cache!==s&&(n.flags|=2048),ii(Bt),F(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Or(n)?si(n):e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,Fo())),Tt(n),null;case 26:var d=n.type,m=n.memoizedState;return e===null?(si(n),m!==null?(Tt(n),Rp(n,m)):(Tt(n),Ou(n,d,null,s,r))):m?m!==e.memoizedState?(si(n),Tt(n),Rp(n,m)):(Tt(n),n.flags&=-16777217):(e=e.memoizedProps,e!==s&&si(n),Tt(n),Ou(n,d,e,s,r)),null;case 27:if(Ee(n),r=te.current,d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&si(n);else{if(!s){if(n.stateNode===null)throw Error(a(166));return Tt(n),null}e=ae.current,Or(n)?ch(n):(e=Um(d,s,r),n.stateNode=e,si(n))}return Tt(n),null;case 5:if(Ee(n),d=n.type,e!==null&&n.stateNode!=null)e.memoizedProps!==s&&si(n);else{if(!s){if(n.stateNode===null)throw Error(a(166));return Tt(n),null}if(m=ae.current,Or(n))ch(n);else{var S=Ss(te.current);switch(m){case 1:m=S.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:m=S.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":m=S.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":m=S.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":m=S.createElement("div"),m.innerHTML="<script><\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof s.is=="string"?S.createElement("select",{is:s.is}):S.createElement("select"),s.multiple?m.multiple=!0:s.size&&(m.size=s.size);break;default:m=typeof s.is=="string"?S.createElement(d,{is:s.is}):S.createElement(d)}}m[Qt]=n,m[ln]=s;e:for(S=n.child;S!==null;){if(S.tag===5||S.tag===6)m.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===n)break e;for(;S.sibling===null;){if(S.return===null||S.return===n)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}n.stateNode=m;e:switch(Zt(m,d,s),d){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&si(n)}}return Tt(n),Ou(n,n.type,e===null?null:e.memoizedProps,n.pendingProps,r),null;case 6:if(e&&n.stateNode!=null)e.memoizedProps!==s&&si(n);else{if(typeof s!="string"&&n.stateNode===null)throw Error(a(166));if(e=te.current,Or(n)){if(e=n.stateNode,r=n.memoizedProps,s=null,d=Xt,d!==null)switch(d.tag){case 27:case 5:s=d.memoizedProps}e[Qt]=n,e=!!(e.nodeValue===r||s!==null&&s.suppressHydrationWarning===!0||Nm(e.nodeValue,r)),e||wi(n,!0)}else e=Ss(e).createTextNode(s),e[Qt]=n,n.stateNode=e}return Tt(n),null;case 31:if(r=n.memoizedState,e===null||e.memoizedState!==null){if(s=Or(n),r!==null){if(e===null){if(!s)throw Error(a(318));if(e=n.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[Qt]=n}else er(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Tt(n),e=!1}else r=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return n.flags&256?(bn(n),n):(bn(n),null);if((n.flags&128)!==0)throw Error(a(558))}return Tt(n),null;case 13:if(s=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(d=Or(n),s!==null&&s.dehydrated!==null){if(e===null){if(!d)throw Error(a(318));if(d=n.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(a(317));d[Qt]=n}else er(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;Tt(n),d=!1}else d=Fo(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=d),d=!0;if(!d)return n.flags&256?(bn(n),n):(bn(n),null)}return bn(n),(n.flags&128)!==0?(n.lanes=r,n):(r=s!==null,e=e!==null&&e.memoizedState!==null,r&&(s=n.child,d=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(d=s.alternate.memoizedState.cachePool.pool),m=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(m=s.memoizedState.cachePool.pool),m!==d&&(s.flags|=2048)),r!==e&&r&&(n.child.flags|=8192),as(n,n.updateQueue),Tt(n),null);case 4:return F(),e===null&&ic(n.stateNode.containerInfo),Tt(n),null;case 10:return ii(n.type),Tt(n),null;case 19:if(J(Ot),s=n.memoizedState,s===null)return Tt(n),null;if(d=(n.flags&128)!==0,m=s.rendering,m===null)if(d)Ul(s,!1);else{if(_t!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(m=Xa(e),m!==null){for(n.flags|=128,Ul(s,!1),e=m.updateQueue,n.updateQueue=e,as(n,e),n.subtreeFlags=0,e=r,r=n.child;r!==null;)lh(r,e),r=r.sibling;return A(Ot,Ot.current&1|2),it&&ti(n,s.treeForkCount),n.child}e=e.sibling}s.tail!==null&&rt()>fs&&(n.flags|=128,d=!0,Ul(s,!1),n.lanes=4194304)}else{if(!d)if(e=Xa(m),e!==null){if(n.flags|=128,d=!0,e=e.updateQueue,n.updateQueue=e,as(n,e),Ul(s,!0),s.tail===null&&s.tailMode==="hidden"&&!m.alternate&&!it)return Tt(n),null}else 2*rt()-s.renderingStartTime>fs&&r!==536870912&&(n.flags|=128,d=!0,Ul(s,!1),n.lanes=4194304);s.isBackwards?(m.sibling=n.child,n.child=m):(e=s.last,e!==null?e.sibling=m:n.child=m,s.last=m)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=rt(),e.sibling=null,r=Ot.current,A(Ot,d?r&1|2:r&1),it&&ti(n,s.treeForkCount),e):(Tt(n),null);case 22:case 23:return bn(n),ru(),s=n.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(n.flags|=8192):s&&(n.flags|=8192),s?(r&536870912)!==0&&(n.flags&128)===0&&(Tt(n),n.subtreeFlags&6&&(n.flags|=8192)):Tt(n),r=n.updateQueue,r!==null&&as(n,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),s=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),s!==r&&(n.flags|=2048),e!==null&&J(ir),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),n.memoizedState.cache!==r&&(n.flags|=2048),ii(Bt),Tt(n),null;case 25:return null;case 30:return null}throw Error(a(156,n.tag))}function Bx(e,n){switch(Yo(n),n.tag){case 1:return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ii(Bt),F(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 26:case 27:case 5:return Ee(n),null;case 31:if(n.memoizedState!==null){if(bn(n),n.alternate===null)throw Error(a(340));er()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 13:if(bn(n),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(a(340));er()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return J(Ot),null;case 4:return F(),null;case 10:return ii(n.type),null;case 22:case 23:return bn(n),ru(),e!==null&&J(ir),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 24:return ii(Bt),null;case 25:return null;default:return null}}function Dp(e,n){switch(Yo(n),n.tag){case 3:ii(Bt),F();break;case 26:case 27:case 5:Ee(n);break;case 4:F();break;case 31:n.memoizedState!==null&&bn(n);break;case 13:bn(n);break;case 19:J(Ot);break;case 10:ii(n.type);break;case 22:case 23:bn(n),ru(),e!==null&&J(ir);break;case 24:ii(Bt)}}function ql(e,n){try{var r=n.updateQueue,s=r!==null?r.lastEffect:null;if(s!==null){var d=s.next;r=d;do{if((r.tag&e)===e){s=void 0;var m=r.create,S=r.inst;s=m(),S.destroy=s}r=r.next}while(r!==d)}}catch(C){gt(n,n.return,C)}}function Ti(e,n,r){try{var s=n.updateQueue,d=s!==null?s.lastEffect:null;if(d!==null){var m=d.next;s=m;do{if((s.tag&e)===e){var S=s.inst,C=S.destroy;if(C!==void 0){S.destroy=void 0,d=n;var I=r,ie=C;try{ie()}catch(ce){gt(d,I,ce)}}}s=s.next}while(s!==m)}}catch(ce){gt(n,n.return,ce)}}function Mp(e){var n=e.updateQueue;if(n!==null){var r=e.stateNode;try{jh(n,r)}catch(s){gt(e,e.return,s)}}}function _p(e,n,r){r.props=or(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(s){gt(e,n,s)}}function Il(e,n){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof r=="function"?e.refCleanup=r(s):r.current=s}}catch(d){gt(e,n,d)}}function Fn(e,n){var r=e.ref,s=e.refCleanup;if(r!==null)if(typeof s=="function")try{s()}catch(d){gt(e,n,d)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(d){gt(e,n,d)}else r.current=null}function Op(e){var n=e.type,r=e.memoizedProps,s=e.stateNode;try{e:switch(n){case"button":case"input":case"select":case"textarea":r.autoFocus&&s.focus();break e;case"img":r.src?s.src=r.src:r.srcSet&&(s.srcset=r.srcSet)}}catch(d){gt(e,e.return,d)}}function Lu(e,n,r){try{var s=e.stateNode;l0(s,e.type,r,n),s[ln]=n}catch(d){gt(e,e.return,d)}}function Lp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Li(e.type)||e.tag===4}function Bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lp(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&&Li(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 Uu(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,n):(n=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,n.appendChild(e),r=r._reactRootContainer,r!=null||n.onclick!==null||(n.onclick=Jn));else if(s!==4&&(s===27&&Li(e.type)&&(r=e.stateNode,n=null),e=e.child,e!==null))for(Uu(e,n,r),e=e.sibling;e!==null;)Uu(e,n,r),e=e.sibling}function ss(e,n,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,n?r.insertBefore(e,n):r.appendChild(e);else if(s!==4&&(s===27&&Li(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(ss(e,n,r),e=e.sibling;e!==null;)ss(e,n,r),e=e.sibling}function Bp(e){var n=e.stateNode,r=e.memoizedProps;try{for(var s=e.type,d=n.attributes;d.length;)n.removeAttributeNode(d[0]);Zt(n,s,r),n[Qt]=e,n[ln]=r}catch(m){gt(e,e.return,m)}}var oi=!1,It=!1,qu=!1,Up=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function Ux(e,n){if(e=e.containerInfo,ac=As,e=Zd(e),Do(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var d=s.anchorOffset,m=s.focusNode;s=s.focusOffset;try{r.nodeType,m.nodeType}catch{r=null;break e}var S=0,C=-1,I=-1,ie=0,ce=0,de=e,le=null;t:for(;;){for(var ue;de!==r||d!==0&&de.nodeType!==3||(C=S+d),de!==m||s!==0&&de.nodeType!==3||(I=S+s),de.nodeType===3&&(S+=de.nodeValue.length),(ue=de.firstChild)!==null;)le=de,de=ue;for(;;){if(de===e)break t;if(le===r&&++ie===d&&(C=S),le===m&&++ce===s&&(I=S),(ue=de.nextSibling)!==null)break;de=le,le=de.parentNode}de=ue}r=C===-1||I===-1?null:{start:C,end:I}}else r=null}r=r||{start:0,end:0}}else r=null;for(sc={focusedElem:e,selectionRange:r},As=!1,Gt=n;Gt!==null;)if(n=Gt,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Gt=e;else for(;Gt!==null;){switch(n=Gt,m=n.alternate,e=n.flags,n.tag){case 0:if((e&4)!==0&&(e=n.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)d=e[r],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&m!==null){e=void 0,r=n,d=m.memoizedProps,m=m.memoizedState,s=r.stateNode;try{var Te=or(r.type,d);e=s.getSnapshotBeforeUpdate(Te,m),s.__reactInternalSnapshotBeforeUpdate=e}catch(Le){gt(r,r.return,Le)}}break;case 3:if((e&1024)!==0){if(e=n.stateNode.containerInfo,r=e.nodeType,r===9)cc(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":cc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=n.sibling,e!==null){e.return=n.return,Gt=e;break}Gt=n.return}}function qp(e,n,r){var s=r.flags;switch(r.tag){case 0:case 11:case 15:ci(e,r),s&4&&ql(5,r);break;case 1:if(ci(e,r),s&4)if(e=r.stateNode,n===null)try{e.componentDidMount()}catch(S){gt(r,r.return,S)}else{var d=or(r.type,n.memoizedProps);n=n.memoizedState;try{e.componentDidUpdate(d,n,e.__reactInternalSnapshotBeforeUpdate)}catch(S){gt(r,r.return,S)}}s&64&&Mp(r),s&512&&Il(r,r.return);break;case 3:if(ci(e,r),s&64&&(e=r.updateQueue,e!==null)){if(n=null,r.child!==null)switch(r.child.tag){case 27:case 5:n=r.child.stateNode;break;case 1:n=r.child.stateNode}try{jh(e,n)}catch(S){gt(r,r.return,S)}}break;case 27:n===null&&s&4&&Bp(r);case 26:case 5:ci(e,r),n===null&&s&4&&Op(r),s&512&&Il(r,r.return);break;case 12:ci(e,r);break;case 31:ci(e,r),s&4&&Vp(e,r);break;case 13:ci(e,r),s&4&&Yp(e,r),s&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Xx.bind(null,r),h0(e,r))));break;case 22:if(s=r.memoizedState!==null||oi,!s){n=n!==null&&n.memoizedState!==null||It,d=oi;var m=It;oi=s,(It=n)&&!m?fi(e,r,(r.subtreeFlags&8772)!==0):ci(e,r),oi=d,It=m}break;case 30:break;default:ci(e,r)}}function Ip(e){var n=e.alternate;n!==null&&(e.alternate=null,Ip(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&mo(n)),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 zt=null,sn=!1;function ui(e,n,r){for(r=r.child;r!==null;)Hp(e,n,r),r=r.sibling}function Hp(e,n,r){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(bt,r)}catch{}switch(r.tag){case 26:It||Fn(r,n),ui(e,n,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:It||Fn(r,n);var s=zt,d=sn;Li(r.type)&&(zt=r.stateNode,sn=!1),ui(e,n,r),$l(r.stateNode),zt=s,sn=d;break;case 5:It||Fn(r,n);case 6:if(s=zt,d=sn,zt=null,ui(e,n,r),zt=s,sn=d,zt!==null)if(sn)try{(zt.nodeType===9?zt.body:zt.nodeName==="HTML"?zt.ownerDocument.body:zt).removeChild(r.stateNode)}catch(m){gt(r,n,m)}else try{zt.removeChild(r.stateNode)}catch(m){gt(r,n,m)}break;case 18:zt!==null&&(sn?(e=zt,Mm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),nl(e)):Mm(zt,r.stateNode));break;case 4:s=zt,d=sn,zt=r.stateNode.containerInfo,sn=!0,ui(e,n,r),zt=s,sn=d;break;case 0:case 11:case 14:case 15:Ti(2,r,n),It||Ti(4,r,n),ui(e,n,r);break;case 1:It||(Fn(r,n),s=r.stateNode,typeof s.componentWillUnmount=="function"&&_p(r,n,s)),ui(e,n,r);break;case 21:ui(e,n,r);break;case 22:It=(s=It)||r.memoizedState!==null,ui(e,n,r),It=s;break;default:ui(e,n,r)}}function Vp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{nl(e)}catch(r){gt(n,n.return,r)}}}function Yp(e,n){if(n.memoizedState===null&&(e=n.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{nl(e)}catch(r){gt(n,n.return,r)}}function qx(e){switch(e.tag){case 31:case 13:case 19:var n=e.stateNode;return n===null&&(n=e.stateNode=new Up),n;case 22:return e=e.stateNode,n=e._retryCache,n===null&&(n=e._retryCache=new Up),n;default:throw Error(a(435,e.tag))}}function os(e,n){var r=qx(e);n.forEach(function(s){if(!r.has(s)){r.add(s);var d=Kx.bind(null,e,s);s.then(d,d)}})}function on(e,n){var r=n.deletions;if(r!==null)for(var s=0;s<r.length;s++){var d=r[s],m=e,S=n,C=S;e:for(;C!==null;){switch(C.tag){case 27:if(Li(C.type)){zt=C.stateNode,sn=!1;break e}break;case 5:zt=C.stateNode,sn=!1;break e;case 3:case 4:zt=C.stateNode.containerInfo,sn=!0;break e}C=C.return}if(zt===null)throw Error(a(160));Hp(m,S,d),zt=null,sn=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(n.subtreeFlags&13886)for(n=n.child;n!==null;)Gp(n,e),n=n.sibling}var Bn=null;function Gp(e,n){var r=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(n,e),un(e),s&4&&(Ti(3,e,e.return),ql(3,e),Ti(5,e,e.return));break;case 1:on(n,e),un(e),s&512&&(It||r===null||Fn(r,r.return)),s&64&&oi&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?s:r.concat(s))));break;case 26:var d=Bn;if(on(n,e),un(e),s&512&&(It||r===null||Fn(r,r.return)),s&4){var m=r!==null?r.memoizedState:null;if(s=e.memoizedState,r===null)if(s===null)if(e.stateNode===null){e:{s=e.type,r=e.memoizedProps,d=d.ownerDocument||d;t:switch(s){case"title":m=d.getElementsByTagName("title")[0],(!m||m[hl]||m[Qt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(s),d.head.insertBefore(m,d.querySelector("head > title"))),Zt(m,s,r),m[Qt]=e,Yt(m),s=m;break e;case"link":var S=Gm("link","href",d).get(s+(r.href||""));if(S){for(var C=0;C<S.length;C++)if(m=S[C],m.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&m.getAttribute("rel")===(r.rel==null?null:r.rel)&&m.getAttribute("title")===(r.title==null?null:r.title)&&m.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){S.splice(C,1);break t}}m=d.createElement(s),Zt(m,s,r),d.head.appendChild(m);break;case"meta":if(S=Gm("meta","content",d).get(s+(r.content||""))){for(C=0;C<S.length;C++)if(m=S[C],m.getAttribute("content")===(r.content==null?null:""+r.content)&&m.getAttribute("name")===(r.name==null?null:r.name)&&m.getAttribute("property")===(r.property==null?null:r.property)&&m.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&m.getAttribute("charset")===(r.charSet==null?null:r.charSet)){S.splice(C,1);break t}}m=d.createElement(s),Zt(m,s,r),d.head.appendChild(m);break;default:throw Error(a(468,s))}m[Qt]=e,Yt(m),s=m}e.stateNode=s}else Fm(d,e.type,e.stateNode);else e.stateNode=Ym(d,s,e.memoizedProps);else m!==s?(m===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):m.count--,s===null?Fm(d,e.type,e.stateNode):Ym(d,s,e.memoizedProps)):s===null&&e.stateNode!==null&&Lu(e,e.memoizedProps,r.memoizedProps)}break;case 27:on(n,e),un(e),s&512&&(It||r===null||Fn(r,r.return)),r!==null&&s&4&&Lu(e,e.memoizedProps,r.memoizedProps);break;case 5:if(on(n,e),un(e),s&512&&(It||r===null||Fn(r,r.return)),e.flags&32){d=e.stateNode;try{Cr(d,"")}catch(Te){gt(e,e.return,Te)}}s&4&&e.stateNode!=null&&(d=e.memoizedProps,Lu(e,d,r!==null?r.memoizedProps:d)),s&1024&&(qu=!0);break;case 6:if(on(n,e),un(e),s&4){if(e.stateNode===null)throw Error(a(162));s=e.memoizedProps,r=e.stateNode;try{r.nodeValue=s}catch(Te){gt(e,e.return,Te)}}break;case 3:if(ks=null,d=Bn,Bn=ws(n.containerInfo),on(n,e),Bn=d,un(e),s&4&&r!==null&&r.memoizedState.isDehydrated)try{nl(n.containerInfo)}catch(Te){gt(e,e.return,Te)}qu&&(qu=!1,Fp(e));break;case 4:s=Bn,Bn=ws(e.stateNode.containerInfo),on(n,e),un(e),Bn=s;break;case 12:on(n,e),un(e);break;case 31:on(n,e),un(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,os(e,s)));break;case 13:on(n,e),un(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(cs=rt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,os(e,s)));break;case 22:d=e.memoizedState!==null;var I=r!==null&&r.memoizedState!==null,ie=oi,ce=It;if(oi=ie||d,It=ce||I,on(n,e),It=ce,oi=ie,un(e),s&8192)e:for(n=e.stateNode,n._visibility=d?n._visibility&-2:n._visibility|1,d&&(r===null||I||oi||It||ur(e)),r=null,n=e;;){if(n.tag===5||n.tag===26){if(r===null){I=r=n;try{if(m=I.stateNode,d)S=m.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{C=I.stateNode;var de=I.memoizedProps.style,le=de!=null&&de.hasOwnProperty("display")?de.display:null;C.style.display=le==null||typeof le=="boolean"?"":(""+le).trim()}}catch(Te){gt(I,I.return,Te)}}}else if(n.tag===6){if(r===null){I=n;try{I.stateNode.nodeValue=d?"":I.memoizedProps}catch(Te){gt(I,I.return,Te)}}}else if(n.tag===18){if(r===null){I=n;try{var ue=I.stateNode;d?_m(ue,!0):_m(I.stateNode,!1)}catch(Te){gt(I,I.return,Te)}}}else if((n.tag!==22&&n.tag!==23||n.memoizedState===null||n===e)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;r===n&&(r=null),n=n.return}r===n&&(r=null),n.sibling.return=n.return,n=n.sibling}s&4&&(s=e.updateQueue,s!==null&&(r=s.retryQueue,r!==null&&(s.retryQueue=null,os(e,r))));break;case 19:on(n,e),un(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,os(e,s)));break;case 30:break;case 21:break;default:on(n,e),un(e)}}function un(e){var n=e.flags;if(n&2){try{for(var r,s=e.return;s!==null;){if(Lp(s)){r=s;break}s=s.return}if(r==null)throw Error(a(160));switch(r.tag){case 27:var d=r.stateNode,m=Bu(e);ss(e,m,d);break;case 5:var S=r.stateNode;r.flags&32&&(Cr(S,""),r.flags&=-33);var C=Bu(e);ss(e,C,S);break;case 3:case 4:var I=r.stateNode.containerInfo,ie=Bu(e);Uu(e,ie,I);break;default:throw Error(a(161))}}catch(ce){gt(e,e.return,ce)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Fp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var n=e;Fp(n),n.tag===5&&n.flags&1024&&n.stateNode.reset(),e=e.sibling}}function ci(e,n){if(n.subtreeFlags&8772)for(n=n.child;n!==null;)qp(e,n.alternate,n),n=n.sibling}function ur(e){for(e=e.child;e!==null;){var n=e;switch(n.tag){case 0:case 11:case 14:case 15:Ti(4,n,n.return),ur(n);break;case 1:Fn(n,n.return);var r=n.stateNode;typeof r.componentWillUnmount=="function"&&_p(n,n.return,r),ur(n);break;case 27:$l(n.stateNode);case 26:case 5:Fn(n,n.return),ur(n);break;case 22:n.memoizedState===null&&ur(n);break;case 30:ur(n);break;default:ur(n)}e=e.sibling}}function fi(e,n,r){for(r=r&&(n.subtreeFlags&8772)!==0,n=n.child;n!==null;){var s=n.alternate,d=e,m=n,S=m.flags;switch(m.tag){case 0:case 11:case 15:fi(d,m,r),ql(4,m);break;case 1:if(fi(d,m,r),s=m,d=s.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(ie){gt(s,s.return,ie)}if(s=m,d=s.updateQueue,d!==null){var C=s.stateNode;try{var I=d.shared.hiddenCallbacks;if(I!==null)for(d.shared.hiddenCallbacks=null,d=0;d<I.length;d++)wh(I[d],C)}catch(ie){gt(s,s.return,ie)}}r&&S&64&&Mp(m),Il(m,m.return);break;case 27:Bp(m);case 26:case 5:fi(d,m,r),r&&s===null&&S&4&&Op(m),Il(m,m.return);break;case 12:fi(d,m,r);break;case 31:fi(d,m,r),r&&S&4&&Vp(d,m);break;case 13:fi(d,m,r),r&&S&4&&Yp(d,m);break;case 22:m.memoizedState===null&&fi(d,m,r),Il(m,m.return);break;case 30:break;default:fi(d,m,r)}n=n.sibling}}function Iu(e,n){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(e=n.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&El(r))}function Hu(e,n){e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&El(e))}function Un(e,n,r,s){if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Qp(e,n,r,s),n=n.sibling}function Qp(e,n,r,s){var d=n.flags;switch(n.tag){case 0:case 11:case 15:Un(e,n,r,s),d&2048&&ql(9,n);break;case 1:Un(e,n,r,s);break;case 3:Un(e,n,r,s),d&2048&&(e=null,n.alternate!==null&&(e=n.alternate.memoizedState.cache),n=n.memoizedState.cache,n!==e&&(n.refCount++,e!=null&&El(e)));break;case 12:if(d&2048){Un(e,n,r,s),e=n.stateNode;try{var m=n.memoizedProps,S=m.id,C=m.onPostCommit;typeof C=="function"&&C(S,n.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){gt(n,n.return,I)}}else Un(e,n,r,s);break;case 31:Un(e,n,r,s);break;case 13:Un(e,n,r,s);break;case 23:break;case 22:m=n.stateNode,S=n.alternate,n.memoizedState!==null?m._visibility&2?Un(e,n,r,s):Hl(e,n):m._visibility&2?Un(e,n,r,s):(m._visibility|=2,Fr(e,n,r,s,(n.subtreeFlags&10256)!==0||!1)),d&2048&&Iu(S,n);break;case 24:Un(e,n,r,s),d&2048&&Hu(n.alternate,n);break;default:Un(e,n,r,s)}}function Fr(e,n,r,s,d){for(d=d&&((n.subtreeFlags&10256)!==0||!1),n=n.child;n!==null;){var m=e,S=n,C=r,I=s,ie=S.flags;switch(S.tag){case 0:case 11:case 15:Fr(m,S,C,I,d),ql(8,S);break;case 23:break;case 22:var ce=S.stateNode;S.memoizedState!==null?ce._visibility&2?Fr(m,S,C,I,d):Hl(m,S):(ce._visibility|=2,Fr(m,S,C,I,d)),d&&ie&2048&&Iu(S.alternate,S);break;case 24:Fr(m,S,C,I,d),d&&ie&2048&&Hu(S.alternate,S);break;default:Fr(m,S,C,I,d)}n=n.sibling}}function Hl(e,n){if(n.subtreeFlags&10256)for(n=n.child;n!==null;){var r=e,s=n,d=s.flags;switch(s.tag){case 22:Hl(r,s),d&2048&&Iu(s.alternate,s);break;case 24:Hl(r,s),d&2048&&Hu(s.alternate,s);break;default:Hl(r,s)}n=n.sibling}}var Vl=8192;function Qr(e,n,r){if(e.subtreeFlags&Vl)for(e=e.child;e!==null;)Xp(e,n,r),e=e.sibling}function Xp(e,n,r){switch(e.tag){case 26:Qr(e,n,r),e.flags&Vl&&e.memoizedState!==null&&C0(r,Bn,e.memoizedState,e.memoizedProps);break;case 5:Qr(e,n,r);break;case 3:case 4:var s=Bn;Bn=ws(e.stateNode.containerInfo),Qr(e,n,r),Bn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=Vl,Vl=16777216,Qr(e,n,r),Vl=s):Qr(e,n,r));break;default:Qr(e,n,r)}}function Kp(e){var n=e.alternate;if(n!==null&&(e=n.child,e!==null)){n.child=null;do n=e.sibling,e.sibling=null,e=n;while(e!==null)}}function Yl(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];Gt=s,Zp(s,e)}Kp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$p(e),e=e.sibling}function $p(e){switch(e.tag){case 0:case 11:case 15:Yl(e),e.flags&2048&&Ti(9,e,e.return);break;case 3:Yl(e);break;case 12:Yl(e);break;case 22:var n=e.stateNode;e.memoizedState!==null&&n._visibility&2&&(e.return===null||e.return.tag!==13)?(n._visibility&=-3,us(e)):Yl(e);break;default:Yl(e)}}function us(e){var n=e.deletions;if((e.flags&16)!==0){if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];Gt=s,Zp(s,e)}Kp(e)}for(e=e.child;e!==null;){switch(n=e,n.tag){case 0:case 11:case 15:Ti(8,n,n.return),us(n);break;case 22:r=n.stateNode,r._visibility&2&&(r._visibility&=-3,us(n));break;default:us(n)}e=e.sibling}}function Zp(e,n){for(;Gt!==null;){var r=Gt;switch(r.tag){case 0:case 11:case 15:Ti(8,r,n);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var s=r.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:El(r.memoizedState.cache)}if(s=r.child,s!==null)s.return=r,Gt=s;else e:for(r=e;Gt!==null;){s=Gt;var d=s.sibling,m=s.return;if(Ip(s),s===r){Gt=null;break e}if(d!==null){d.return=m,Gt=d;break e}Gt=m}}}var Ix={getCacheForType:function(e){var n=Kt(Bt),r=n.data.get(e);return r===void 0&&(r=e(),n.data.set(e,r)),r},cacheSignal:function(){return Kt(Bt).controller.signal}},Hx=typeof WeakMap=="function"?WeakMap:Map,ht=0,jt=null,Pe=null,et=0,mt=0,vn=null,zi=!1,Xr=!1,Vu=!1,di=0,_t=0,Ri=0,cr=0,Yu=0,xn=0,Kr=0,Gl=null,cn=null,Gu=!1,cs=0,Pp=0,fs=1/0,ds=null,Di=null,Vt=0,Mi=null,$r=null,hi=0,Fu=0,Qu=null,Jp=null,Fl=0,Xu=null;function Sn(){return(ht&2)!==0&&et!==0?et&-et:N.T!==null?Wu():dl()}function Wp(){if(xn===0)if((et&536870912)===0||it){var e=je;je<<=1,(je&3932160)===0&&(je=262144),xn=e}else xn=536870912;return e=yn.current,e!==null&&(e.flags|=32),xn}function fn(e,n,r){(e===jt&&(mt===2||mt===9)||e.cancelPendingCommit!==null)&&(Zr(e,0),_i(e,et,xn,!1)),en(e,r),((ht&2)===0||e!==jt)&&(e===jt&&((ht&2)===0&&(cr|=r),_t===4&&_i(e,et,xn,!1)),Qn(e))}function em(e,n,r){if((ht&6)!==0)throw Error(a(327));var s=!r&&(n&127)===0&&(n&e.expiredLanes)===0||ye(e,n),d=s?Gx(e,n):$u(e,n,!0),m=s;do{if(d===0){Xr&&!s&&_i(e,n,0,!1);break}else{if(r=e.current.alternate,m&&!Vx(r)){d=$u(e,n,!1),m=!1;continue}if(d===2){if(m=n,e.errorRecoveryDisabledLanes&m)var S=0;else S=e.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){n=S;e:{var C=e;d=Gl;var I=C.current.memoizedState.isDehydrated;if(I&&(Zr(C,S).flags|=256),S=$u(C,S,!1),S!==2){if(Vu&&!I){C.errorRecoveryDisabledLanes|=m,cr|=m,d=4;break e}m=cn,cn=d,m!==null&&(cn===null?cn=m:cn.push.apply(cn,m))}d=S}if(m=!1,d!==2)continue}}if(d===1){Zr(e,0),_i(e,n,0,!0);break}e:{switch(s=e,m=d,m){case 0:case 1:throw Error(a(345));case 4:if((n&4194048)!==n)break;case 6:_i(s,n,xn,!zi);break e;case 2:cn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((n&62914560)===n&&(d=cs+300-rt(),10<d)){if(_i(s,n,xn,!zi),Ae(s,0,!0)!==0)break e;hi=n,s.timeoutHandle=Rm(tm.bind(null,s,r,cn,ds,Gu,n,xn,cr,Kr,zi,m,"Throttled",-0,0),d);break e}tm(s,r,cn,ds,Gu,n,xn,cr,Kr,zi,m,null,-0,0)}}break}while(!0);Qn(e)}function tm(e,n,r,s,d,m,S,C,I,ie,ce,de,le,ue){if(e.timeoutHandle=-1,de=n.subtreeFlags,de&8192||(de&16785408)===16785408){de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Jn},Xp(n,m,de);var Te=(m&62914560)===m?cs-rt():(m&4194048)===m?Pp-rt():0;if(Te=E0(de,Te),Te!==null){hi=m,e.cancelPendingCommit=Te(um.bind(null,e,n,m,r,s,d,S,C,I,ce,de,null,le,ue)),_i(e,m,S,!ie);return}}um(e,n,m,r,s,d,S,C,I)}function Vx(e){for(var n=e;;){var r=n.tag;if((r===0||r===11||r===15)&&n.flags&16384&&(r=n.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var s=0;s<r.length;s++){var d=r[s],m=d.getSnapshot;d=d.value;try{if(!mn(m(),d))return!1}catch{return!1}}if(r=n.child,n.subtreeFlags&16384&&r!==null)r.return=n,n=r;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function _i(e,n,r,s){n&=~Yu,n&=~cr,e.suspendedLanes|=n,e.pingedLanes&=~n,s&&(e.warmLanes|=n),s=e.expirationTimes;for(var d=n;0<d;){var m=31-Ze(d),S=1<<m;s[m]=-1,d&=~S}r!==0&&Xi(e,r,n)}function hs(){return(ht&6)===0?(Ql(0),!1):!0}function Ku(){if(Pe!==null){if(mt===0)var e=Pe.return;else e=Pe,ni=tr=null,cu(e),Ir=null,Al=0,e=Pe;for(;e!==null;)Dp(e.alternate,e),e=e.return;Pe=null}}function Zr(e,n){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,o0(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),hi=0,Ku(),jt=e,Pe=r=ei(e.current,null),et=n,mt=0,vn=null,zi=!1,Xr=ye(e,n),Vu=!1,Kr=xn=Yu=cr=Ri=_t=0,cn=Gl=null,Gu=!1,(n&8)!==0&&(n|=n&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=n;0<s;){var d=31-Ze(s),m=1<<d;n|=e[d],s&=~m}return di=n,_a(),r}function nm(e,n){Ye=null,N.H=Ll,n===qr||n===Va?(n=bh(),mt=3):n===Jo?(n=bh(),mt=4):mt=n===Eu?8:n!==null&&typeof n=="object"&&typeof n.then=="function"?6:1,vn=n,Pe===null&&(_t=1,ns(e,Nn(n,e.current)))}function im(){var e=yn.current;return e===null?!0:(et&4194048)===et?Rn===null:(et&62914560)===et||(et&536870912)!==0?e===Rn:!1}function rm(){var e=N.H;return N.H=Ll,e===null?Ll:e}function lm(){var e=N.A;return N.A=Ix,e}function ps(){_t=4,zi||(et&4194048)!==et&&yn.current!==null||(Xr=!0),(Ri&134217727)===0&&(cr&134217727)===0||jt===null||_i(jt,et,xn,!1)}function $u(e,n,r){var s=ht;ht|=2;var d=rm(),m=lm();(jt!==e||et!==n)&&(ds=null,Zr(e,n)),n=!1;var S=_t;e:do try{if(mt!==0&&Pe!==null){var C=Pe,I=vn;switch(mt){case 8:Ku(),S=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(n=!0);var ie=mt;if(mt=0,vn=null,Pr(e,C,I,ie),r&&Xr){S=0;break e}break;default:ie=mt,mt=0,vn=null,Pr(e,C,I,ie)}}Yx(),S=_t;break}catch(ce){nm(e,ce)}while(!0);return n&&e.shellSuspendCounter++,ni=tr=null,ht=s,N.H=d,N.A=m,Pe===null&&(jt=null,et=0,_a()),S}function Yx(){for(;Pe!==null;)am(Pe)}function Gx(e,n){var r=ht;ht|=2;var s=rm(),d=lm();jt!==e||et!==n?(ds=null,fs=rt()+500,Zr(e,n)):Xr=ye(e,n);e:do try{if(mt!==0&&Pe!==null){n=Pe;var m=vn;t:switch(mt){case 1:mt=0,vn=null,Pr(e,n,m,1);break;case 2:case 9:if(gh(m)){mt=0,vn=null,sm(n);break}n=function(){mt!==2&&mt!==9||jt!==e||(mt=7),Qn(e)},m.then(n,n);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:gh(m)?(mt=0,vn=null,sm(n)):(mt=0,vn=null,Pr(e,n,m,7));break;case 5:var S=null;switch(Pe.tag){case 26:S=Pe.memoizedState;case 5:case 27:var C=Pe;if(S?Qm(S):C.stateNode.complete){mt=0,vn=null;var I=C.sibling;if(I!==null)Pe=I;else{var ie=C.return;ie!==null?(Pe=ie,ms(ie)):Pe=null}break t}}mt=0,vn=null,Pr(e,n,m,5);break;case 6:mt=0,vn=null,Pr(e,n,m,6);break;case 8:Ku(),_t=6;break e;default:throw Error(a(462))}}Fx();break}catch(ce){nm(e,ce)}while(!0);return ni=tr=null,N.H=s,N.A=d,ht=r,Pe!==null?0:(jt=null,et=0,_a(),_t)}function Fx(){for(;Pe!==null&&!nt();)am(Pe)}function am(e){var n=zp(e.alternate,e,di);e.memoizedProps=e.pendingProps,n===null?ms(e):Pe=n}function sm(e){var n=e,r=n.alternate;switch(n.tag){case 15:case 0:n=kp(r,n,n.pendingProps,n.type,void 0,et);break;case 11:n=kp(r,n,n.pendingProps,n.type.render,n.ref,et);break;case 5:cu(n);default:Dp(r,n),n=Pe=lh(n,di),n=zp(r,n,di)}e.memoizedProps=e.pendingProps,n===null?ms(e):Pe=n}function Pr(e,n,r,s){ni=tr=null,cu(n),Ir=null,Al=0;var d=n.return;try{if(Mx(e,d,n,r,et)){_t=1,ns(e,Nn(r,e.current)),Pe=null;return}}catch(m){if(d!==null)throw Pe=d,m;_t=1,ns(e,Nn(r,e.current)),Pe=null;return}n.flags&32768?(it||s===1?e=!0:Xr||(et&536870912)!==0?e=!1:(zi=e=!0,(s===2||s===9||s===3||s===6)&&(s=yn.current,s!==null&&s.tag===13&&(s.flags|=16384))),om(n,e)):ms(n)}function ms(e){var n=e;do{if((n.flags&32768)!==0){om(n,zi);return}e=n.return;var r=Lx(n.alternate,n,di);if(r!==null){Pe=r;return}if(n=n.sibling,n!==null){Pe=n;return}Pe=n=e}while(n!==null);_t===0&&(_t=5)}function om(e,n){do{var r=Bx(e.alternate,e);if(r!==null){r.flags&=32767,Pe=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!n&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=r}while(e!==null);_t=6,Pe=null}function um(e,n,r,s,d,m,S,C,I){e.cancelPendingCommit=null;do gs();while(Vt!==0);if((ht&6)!==0)throw Error(a(327));if(n!==null){if(n===e.current)throw Error(a(177));if(m=n.lanes|n.childLanes,m|=Bo,Zn(e,r,m,S,C,I),e===jt&&(Pe=jt=null,et=0),$r=n,Mi=e,hi=r,Fu=m,Qu=d,Jp=s,(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,$x(me,function(){return pm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(n.flags&13878)!==0,(n.subtreeFlags&13878)!==0||s){s=N.T,N.T=null,d=K.p,K.p=2,S=ht,ht|=4;try{Ux(e,n,r)}finally{ht=S,K.p=d,N.T=s}}Vt=1,cm(),fm(),dm()}}function cm(){if(Vt===1){Vt=0;var e=Mi,n=$r,r=(n.flags&13878)!==0;if((n.subtreeFlags&13878)!==0||r){r=N.T,N.T=null;var s=K.p;K.p=2;var d=ht;ht|=4;try{Gp(n,e);var m=sc,S=Zd(e.containerInfo),C=m.focusedElem,I=m.selectionRange;if(S!==C&&C&&C.ownerDocument&&$d(C.ownerDocument.documentElement,C)){if(I!==null&&Do(C)){var ie=I.start,ce=I.end;if(ce===void 0&&(ce=ie),"selectionStart"in C)C.selectionStart=ie,C.selectionEnd=Math.min(ce,C.value.length);else{var de=C.ownerDocument||document,le=de&&de.defaultView||window;if(le.getSelection){var ue=le.getSelection(),Te=C.textContent.length,Le=Math.min(I.start,Te),St=I.end===void 0?Le:Math.min(I.end,Te);!ue.extend&&Le>St&&(S=St,St=Le,Le=S);var P=Kd(C,Le),Y=Kd(C,St);if(P&&Y&&(ue.rangeCount!==1||ue.anchorNode!==P.node||ue.anchorOffset!==P.offset||ue.focusNode!==Y.node||ue.focusOffset!==Y.offset)){var ne=de.createRange();ne.setStart(P.node,P.offset),ue.removeAllRanges(),Le>St?(ue.addRange(ne),ue.extend(Y.node,Y.offset)):(ne.setEnd(Y.node,Y.offset),ue.addRange(ne))}}}}for(de=[],ue=C;ue=ue.parentNode;)ue.nodeType===1&&de.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<de.length;C++){var fe=de[C];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}As=!!ac,sc=ac=null}finally{ht=d,K.p=s,N.T=r}}e.current=n,Vt=2}}function fm(){if(Vt===2){Vt=0;var e=Mi,n=$r,r=(n.flags&8772)!==0;if((n.subtreeFlags&8772)!==0||r){r=N.T,N.T=null;var s=K.p;K.p=2;var d=ht;ht|=4;try{qp(e,n.alternate,n)}finally{ht=d,K.p=s,N.T=r}}Vt=3}}function dm(){if(Vt===4||Vt===3){Vt=0,Dt();var e=Mi,n=$r,r=hi,s=Jp;(n.subtreeFlags&10256)!==0||(n.flags&10256)!==0?Vt=5:(Vt=0,$r=Mi=null,hm(e,e.pendingLanes));var d=e.pendingLanes;if(d===0&&(Di=null),bi(r),n=n.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(bt,n,void 0,(n.current.flags&128)===128)}catch{}if(s!==null){n=N.T,d=K.p,K.p=2,N.T=null;try{for(var m=e.onRecoverableError,S=0;S<s.length;S++){var C=s[S];m(C.value,{componentStack:C.stack})}}finally{N.T=n,K.p=d}}(hi&3)!==0&&gs(),Qn(e),d=e.pendingLanes,(r&261930)!==0&&(d&42)!==0?e===Xu?Fl++:(Fl=0,Xu=e):Fl=0,Ql(0)}}function hm(e,n){(e.pooledCacheLanes&=n)===0&&(n=e.pooledCache,n!=null&&(e.pooledCache=null,El(n)))}function gs(){return cm(),fm(),dm(),pm()}function pm(){if(Vt!==5)return!1;var e=Mi,n=Fu;Fu=0;var r=bi(hi),s=N.T,d=K.p;try{K.p=32>r?32:r,N.T=null,r=Qu,Qu=null;var m=Mi,S=hi;if(Vt=0,$r=Mi=null,hi=0,(ht&6)!==0)throw Error(a(331));var C=ht;if(ht|=4,$p(m.current),Qp(m,m.current,S,r),ht=C,Ql(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(bt,m)}catch{}return!0}finally{K.p=d,N.T=s,hm(e,n)}}function mm(e,n,r){n=Nn(r,n),n=Cu(e.stateNode,n,2),e=Ei(e,n,2),e!==null&&(en(e,2),Qn(e))}function gt(e,n,r){if(e.tag===3)mm(e,e,r);else for(;n!==null;){if(n.tag===3){mm(n,e,r);break}else if(n.tag===1){var s=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Di===null||!Di.has(s))){e=Nn(r,e),r=gp(2),s=Ei(n,r,2),s!==null&&(yp(r,s,n,e),en(s,2),Qn(s));break}}n=n.return}}function Zu(e,n,r){var s=e.pingCache;if(s===null){s=e.pingCache=new Hx;var d=new Set;s.set(n,d)}else d=s.get(n),d===void 0&&(d=new Set,s.set(n,d));d.has(r)||(Vu=!0,d.add(r),e=Qx.bind(null,e,n,r),n.then(e,e))}function Qx(e,n,r){var s=e.pingCache;s!==null&&s.delete(n),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,jt===e&&(et&r)===r&&(_t===4||_t===3&&(et&62914560)===et&&300>rt()-cs?(ht&2)===0&&Zr(e,0):Yu|=r,Kr===et&&(Kr=0)),Qn(e)}function gm(e,n){n===0&&(n=Ne()),e=Ji(e,n),e!==null&&(en(e,n),Qn(e))}function Xx(e){var n=e.memoizedState,r=0;n!==null&&(r=n.retryLane),gm(e,r)}function Kx(e,n){var r=0;switch(e.tag){case 31:case 13:var s=e.stateNode,d=e.memoizedState;d!==null&&(r=d.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(a(314))}s!==null&&s.delete(n),gm(e,r)}function $x(e,n){return ct(e,n)}var ys=null,Jr=null,Pu=!1,bs=!1,Ju=!1,Oi=0;function Qn(e){e!==Jr&&e.next===null&&(Jr===null?ys=Jr=e:Jr=Jr.next=e),bs=!0,Pu||(Pu=!0,Px())}function Ql(e,n){if(!Ju&&bs){Ju=!0;do for(var r=!1,s=ys;s!==null;){if(e!==0){var d=s.pendingLanes;if(d===0)var m=0;else{var S=s.suspendedLanes,C=s.pingedLanes;m=(1<<31-Ze(42|e)+1)-1,m&=d&~(S&~C),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(r=!0,xm(s,m))}else m=et,m=Ae(s,s===jt?m:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(m&3)===0||ye(s,m)||(r=!0,xm(s,m));s=s.next}while(r);Ju=!1}}function Zx(){ym()}function ym(){bs=Pu=!1;var e=0;Oi!==0&&s0()&&(e=Oi);for(var n=rt(),r=null,s=ys;s!==null;){var d=s.next,m=bm(s,n);m===0?(s.next=null,r===null?ys=d:r.next=d,d===null&&(Jr=r)):(r=s,(e!==0||(m&3)!==0)&&(bs=!0)),s=d}Vt!==0&&Vt!==5||Ql(e),Oi!==0&&(Oi=0)}function bm(e,n){for(var r=e.suspendedLanes,s=e.pingedLanes,d=e.expirationTimes,m=e.pendingLanes&-62914561;0<m;){var S=31-Ze(m),C=1<<S,I=d[S];I===-1?((C&r)===0||(C&s)!==0)&&(d[S]=B(C,n)):I<=n&&(e.expiredLanes|=C),m&=~C}if(n=jt,r=et,r=Ae(e,e===n?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,r===0||e===n&&(mt===2||mt===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Fe(s),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||ye(e,r)){if(n=r&-r,n===e.callbackPriority)return n;switch(s!==null&&Fe(s),bi(r)){case 2:case 8:r=$;break;case 32:r=me;break;case 268435456:r=Ce;break;default:r=me}return s=vm.bind(null,e),r=ct(r,s),e.callbackPriority=n,e.callbackNode=r,n}return s!==null&&s!==null&&Fe(s),e.callbackPriority=2,e.callbackNode=null,2}function vm(e,n){if(Vt!==0&&Vt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(gs()&&e.callbackNode!==r)return null;var s=et;return s=Ae(e,e===jt?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(em(e,s,n),bm(e,rt()),e.callbackNode!=null&&e.callbackNode===r?vm.bind(null,e):null)}function xm(e,n){if(gs())return null;em(e,n,!0)}function Px(){u0(function(){(ht&6)!==0?ct(M,Zx):ym()})}function Wu(){if(Oi===0){var e=Br;e===0&&(e=re,re<<=1,(re&261888)===0&&(re=256)),Oi=e}return Oi}function Sm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ea(""+e)}function wm(e,n){var r=n.ownerDocument.createElement("input");return r.name=n.name,r.value=n.value,e.id&&r.setAttribute("form",e.id),n.parentNode.insertBefore(r,n),e=new FormData(e),r.parentNode.removeChild(r),e}function Jx(e,n,r,s,d){if(n==="submit"&&r&&r.stateNode===d){var m=Sm((d[ln]||null).action),S=s.submitter;S&&(n=(n=S[ln]||null)?Sm(n.formAction):S.getAttribute("formAction"),n!==null&&(m=n,S=null));var C=new za("action","action",null,s,d);e.push({event:C,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Oi!==0){var I=S?wm(d,S):new FormData(d);vu(r,{pending:!0,data:I,method:d.method,action:m},null,I)}}else typeof m=="function"&&(C.preventDefault(),I=S?wm(d,S):new FormData(d),vu(r,{pending:!0,data:I,method:d.method,action:m},m,I))},currentTarget:d}]})}}for(var ec=0;ec<Lo.length;ec++){var tc=Lo[ec],Wx=tc.toLowerCase(),e0=tc[0].toUpperCase()+tc.slice(1);Ln(Wx,"on"+e0)}Ln(Wd,"onAnimationEnd"),Ln(eh,"onAnimationIteration"),Ln(th,"onAnimationStart"),Ln("dblclick","onDoubleClick"),Ln("focusin","onFocus"),Ln("focusout","onBlur"),Ln(gx,"onTransitionRun"),Ln(yx,"onTransitionStart"),Ln(bx,"onTransitionCancel"),Ln(nh,"onTransitionEnd"),jr("onMouseEnter",["mouseout","mouseover"]),jr("onMouseLeave",["mouseout","mouseover"]),jr("onPointerEnter",["pointerout","pointerover"]),jr("onPointerLeave",["pointerout","pointerover"]),Ki("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ki("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ki("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ki("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ki("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ki("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xl="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(" "),t0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xl));function jm(e,n){n=(n&4)!==0;for(var r=0;r<e.length;r++){var s=e[r],d=s.event;s=s.listeners;e:{var m=void 0;if(n)for(var S=s.length-1;0<=S;S--){var C=s[S],I=C.instance,ie=C.currentTarget;if(C=C.listener,I!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=ie;try{m(d)}catch(ce){Ma(ce)}d.currentTarget=null,m=I}else for(S=0;S<s.length;S++){if(C=s[S],I=C.instance,ie=C.currentTarget,C=C.listener,I!==m&&d.isPropagationStopped())break e;m=C,d.currentTarget=ie;try{m(d)}catch(ce){Ma(ce)}d.currentTarget=null,m=I}}}}function Je(e,n){var r=n[po];r===void 0&&(r=n[po]=new Set);var s=e+"__bubble";r.has(s)||(km(n,e,2,!1),r.add(s))}function nc(e,n,r){var s=0;n&&(s|=4),km(r,e,s,n)}var vs="_reactListening"+Math.random().toString(36).slice(2);function ic(e){if(!e[vs]){e[vs]=!0,yd.forEach(function(r){r!=="selectionchange"&&(t0.has(r)||nc(r,!1,e),nc(r,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[vs]||(n[vs]=!0,nc("selectionchange",!1,n))}}function km(e,n,r,s){switch(Wm(n)){case 2:var d=T0;break;case 8:d=z0;break;default:d=bc}r=d.bind(null,n,r,e),d=void 0,!jo||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),s?d!==void 0?e.addEventListener(n,r,{capture:!0,passive:d}):e.addEventListener(n,r,!0):d!==void 0?e.addEventListener(n,r,{passive:d}):e.addEventListener(n,r,!1)}function rc(e,n,r,s,d){var m=s;if((n&1)===0&&(n&2)===0&&s!==null)e:for(;;){if(s===null)return;var S=s.tag;if(S===3||S===4){var C=s.stateNode.containerInfo;if(C===d)break;if(S===4)for(S=s.return;S!==null;){var I=S.tag;if((I===3||I===4)&&S.stateNode.containerInfo===d)return;S=S.return}for(;C!==null;){if(S=xr(C),S===null)return;if(I=S.tag,I===5||I===6||I===26||I===27){s=m=S;continue e}C=C.parentNode}}s=s.return}Td(function(){var ie=m,ce=So(r),de=[];e:{var le=ih.get(e);if(le!==void 0){var ue=za,Te=e;switch(e){case"keypress":if(Aa(r)===0)break e;case"keydown":case"keyup":ue=Kv;break;case"focusin":Te="focus",ue=No;break;case"focusout":Te="blur",ue=No;break;case"beforeblur":case"afterblur":ue=No;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Dd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Lv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=Pv;break;case Wd:case eh:case th:ue=qv;break;case nh:ue=Wv;break;case"scroll":case"scrollend":ue=_v;break;case"wheel":ue=tx;break;case"copy":case"cut":case"paste":ue=Hv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=_d;break;case"toggle":case"beforetoggle":ue=ix}var Le=(n&4)!==0,St=!Le&&(e==="scroll"||e==="scrollend"),P=Le?le!==null?le+"Capture":null:le;Le=[];for(var Y=ie,ne;Y!==null;){var fe=Y;if(ne=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||ne===null||P===null||(fe=ml(Y,P),fe!=null&&Le.push(Kl(Y,fe,ne))),St)break;Y=Y.return}0<Le.length&&(le=new ue(le,Te,null,r,ce),de.push({event:le,listeners:Le}))}}if((n&7)===0){e:{if(le=e==="mouseover"||e==="pointerover",ue=e==="mouseout"||e==="pointerout",le&&r!==xo&&(Te=r.relatedTarget||r.fromElement)&&(xr(Te)||Te[vr]))break e;if((ue||le)&&(le=ce.window===ce?ce:(le=ce.ownerDocument)?le.defaultView||le.parentWindow:window,ue?(Te=r.relatedTarget||r.toElement,ue=ie,Te=Te?xr(Te):null,Te!==null&&(St=f(Te),Le=Te.tag,Te!==St||Le!==5&&Le!==27&&Le!==6)&&(Te=null)):(ue=null,Te=ie),ue!==Te)){if(Le=Dd,fe="onMouseLeave",P="onMouseEnter",Y="mouse",(e==="pointerout"||e==="pointerover")&&(Le=_d,fe="onPointerLeave",P="onPointerEnter",Y="pointer"),St=ue==null?le:pl(ue),ne=Te==null?le:pl(Te),le=new Le(fe,Y+"leave",ue,r,ce),le.target=St,le.relatedTarget=ne,fe=null,xr(ce)===ie&&(Le=new Le(P,Y+"enter",Te,r,ce),Le.target=ne,Le.relatedTarget=St,fe=Le),St=fe,ue&&Te)t:{for(Le=n0,P=ue,Y=Te,ne=0,fe=P;fe;fe=Le(fe))ne++;fe=0;for(var Me=Y;Me;Me=Le(Me))fe++;for(;0<ne-fe;)P=Le(P),ne--;for(;0<fe-ne;)Y=Le(Y),fe--;for(;ne--;){if(P===Y||Y!==null&&P===Y.alternate){Le=P;break t}P=Le(P),Y=Le(Y)}Le=null}else Le=null;ue!==null&&Cm(de,le,ue,Le,!1),Te!==null&&St!==null&&Cm(de,St,Te,Le,!0)}}e:{if(le=ie?pl(ie):window,ue=le.nodeName&&le.nodeName.toLowerCase(),ue==="select"||ue==="input"&&le.type==="file")var ot=Vd;else if(Id(le))if(Yd)ot=hx;else{ot=fx;var De=cx}else ue=le.nodeName,!ue||ue.toLowerCase()!=="input"||le.type!=="checkbox"&&le.type!=="radio"?ie&&vo(ie.elementType)&&(ot=Vd):ot=dx;if(ot&&(ot=ot(e,ie))){Hd(de,ot,r,ce);break e}De&&De(e,le,ie),e==="focusout"&&ie&&le.type==="number"&&ie.memoizedProps.value!=null&&bo(le,"number",le.value)}switch(De=ie?pl(ie):window,e){case"focusin":(Id(De)||De.contentEditable==="true")&&(Tr=De,Mo=ie,jl=null);break;case"focusout":jl=Mo=Tr=null;break;case"mousedown":_o=!0;break;case"contextmenu":case"mouseup":case"dragend":_o=!1,Pd(de,r,ce);break;case"selectionchange":if(mx)break;case"keydown":case"keyup":Pd(de,r,ce)}var Ge;if(To)e:{switch(e){case"compositionstart":var tt="onCompositionStart";break e;case"compositionend":tt="onCompositionEnd";break e;case"compositionupdate":tt="onCompositionUpdate";break e}tt=void 0}else Ar?Ud(e,r)&&(tt="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(tt="onCompositionStart");tt&&(Od&&r.locale!=="ko"&&(Ar||tt!=="onCompositionStart"?tt==="onCompositionEnd"&&Ar&&(Ge=zd()):(vi=ce,ko="value"in vi?vi.value:vi.textContent,Ar=!0)),De=xs(ie,tt),0<De.length&&(tt=new Md(tt,e,null,r,ce),de.push({event:tt,listeners:De}),Ge?tt.data=Ge:(Ge=qd(r),Ge!==null&&(tt.data=Ge)))),(Ge=lx?ax(e,r):sx(e,r))&&(tt=xs(ie,"onBeforeInput"),0<tt.length&&(De=new Md("onBeforeInput","beforeinput",null,r,ce),de.push({event:De,listeners:tt}),De.data=Ge)),Jx(de,e,ie,r,ce)}jm(de,n)})}function Kl(e,n,r){return{instance:e,listener:n,currentTarget:r}}function xs(e,n){for(var r=n+"Capture",s=[];e!==null;){var d=e,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=ml(e,r),d!=null&&s.unshift(Kl(e,d,m)),d=ml(e,n),d!=null&&s.push(Kl(e,d,m))),e.tag===3)return s;e=e.return}return[]}function n0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Cm(e,n,r,s,d){for(var m=n._reactName,S=[];r!==null&&r!==s;){var C=r,I=C.alternate,ie=C.stateNode;if(C=C.tag,I!==null&&I===s)break;C!==5&&C!==26&&C!==27||ie===null||(I=ie,d?(ie=ml(r,m),ie!=null&&S.unshift(Kl(r,ie,I))):d||(ie=ml(r,m),ie!=null&&S.push(Kl(r,ie,I)))),r=r.return}S.length!==0&&e.push({event:n,listeners:S})}var i0=/\r\n?/g,r0=/\u0000|\uFFFD/g;function Em(e){return(typeof e=="string"?e:""+e).replace(i0,`
|
|
9
|
-
`).replace(r0,"")}function Nm(e,n){return n=Em(n),Em(e)===n}function xt(e,n,r,s,d,m){switch(r){case"children":typeof s=="string"?n==="body"||n==="textarea"&&s===""||Cr(e,s):(typeof s=="number"||typeof s=="bigint")&&n!=="body"&&Cr(e,""+s);break;case"className":ka(e,"class",s);break;case"tabIndex":ka(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ka(e,r,s);break;case"style":Nd(e,s,m);break;case"data":if(n!=="object"){ka(e,"data",s);break}case"src":case"href":if(s===""&&(n!=="a"||r!=="href")){e.removeAttribute(r);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=Ea(""+s),e.setAttribute(r,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(r,"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 m=="function"&&(r==="formAction"?(n!=="input"&&xt(e,n,"name",d.name,d,null),xt(e,n,"formEncType",d.formEncType,d,null),xt(e,n,"formMethod",d.formMethod,d,null),xt(e,n,"formTarget",d.formTarget,d,null)):(xt(e,n,"encType",d.encType,d,null),xt(e,n,"method",d.method,d,null),xt(e,n,"target",d.target,d,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(r);break}s=Ea(""+s),e.setAttribute(r,s);break;case"onClick":s!=null&&(e.onclick=Jn);break;case"onScroll":s!=null&&Je("scroll",e);break;case"onScrollEnd":s!=null&&Je("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(a(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}r=Ea(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""+s):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":s===!0?e.setAttribute(r,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(r,s):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(r,s):e.removeAttribute(r);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(r):e.setAttribute(r,s);break;case"popover":Je("beforetoggle",e),Je("toggle",e),ja(e,"popover",s);break;case"xlinkActuate":Pn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Pn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Pn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Pn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Pn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Pn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Pn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":ja(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=Dv.get(r)||r,ja(e,r,s))}}function lc(e,n,r,s,d,m){switch(r){case"style":Nd(e,s,m);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(a(61));if(r=s.__html,r!=null){if(d.children!=null)throw Error(a(60));e.innerHTML=r}}break;case"children":typeof s=="string"?Cr(e,s):(typeof s=="number"||typeof s=="bigint")&&Cr(e,""+s);break;case"onScroll":s!=null&&Je("scroll",e);break;case"onScrollEnd":s!=null&&Je("scrollend",e);break;case"onClick":s!=null&&(e.onclick=Jn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!bd.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(d=r.endsWith("Capture"),n=r.slice(2,d?r.length-7:void 0),m=e[ln]||null,m=m!=null?m[r]:null,typeof m=="function"&&e.removeEventListener(n,m,d),typeof s=="function")){typeof m!="function"&&m!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(n,s,d);break e}r in e?e[r]=s:s===!0?e.setAttribute(r,""):ja(e,r,s)}}}function Zt(e,n,r){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Je("error",e),Je("load",e);var s=!1,d=!1,m;for(m in r)if(r.hasOwnProperty(m)){var S=r[m];if(S!=null)switch(m){case"src":s=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:xt(e,n,m,S,r,null)}}d&&xt(e,n,"srcSet",r.srcSet,r,null),s&&xt(e,n,"src",r.src,r,null);return;case"input":Je("invalid",e);var C=m=S=d=null,I=null,ie=null;for(s in r)if(r.hasOwnProperty(s)){var ce=r[s];if(ce!=null)switch(s){case"name":d=ce;break;case"type":S=ce;break;case"checked":I=ce;break;case"defaultChecked":ie=ce;break;case"value":m=ce;break;case"defaultValue":C=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,n));break;default:xt(e,n,s,ce,r,null)}}jd(e,m,C,I,ie,S,d,!1);return;case"select":Je("invalid",e),s=S=m=null;for(d in r)if(r.hasOwnProperty(d)&&(C=r[d],C!=null))switch(d){case"value":m=C;break;case"defaultValue":S=C;break;case"multiple":s=C;default:xt(e,n,d,C,r,null)}n=m,r=S,e.multiple=!!s,n!=null?kr(e,!!s,n,!1):r!=null&&kr(e,!!s,r,!0);return;case"textarea":Je("invalid",e),m=d=s=null;for(S in r)if(r.hasOwnProperty(S)&&(C=r[S],C!=null))switch(S){case"value":s=C;break;case"defaultValue":d=C;break;case"children":m=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(a(91));break;default:xt(e,n,S,C,r,null)}Cd(e,s,d,m);return;case"option":for(I in r)r.hasOwnProperty(I)&&(s=r[I],s!=null)&&(I==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":xt(e,n,I,s,r,null));return;case"dialog":Je("beforetoggle",e),Je("toggle",e),Je("cancel",e),Je("close",e);break;case"iframe":case"object":Je("load",e);break;case"video":case"audio":for(s=0;s<Xl.length;s++)Je(Xl[s],e);break;case"image":Je("error",e),Je("load",e);break;case"details":Je("toggle",e);break;case"embed":case"source":case"link":Je("error",e),Je("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(ie in r)if(r.hasOwnProperty(ie)&&(s=r[ie],s!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,n));default:xt(e,n,ie,s,r,null)}return;default:if(vo(n)){for(ce in r)r.hasOwnProperty(ce)&&(s=r[ce],s!==void 0&&lc(e,n,ce,s,r,void 0));return}}for(C in r)r.hasOwnProperty(C)&&(s=r[C],s!=null&&xt(e,n,C,s,r,null))}function l0(e,n,r,s){switch(n){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,S=null,C=null,I=null,ie=null,ce=null;for(ue in r){var de=r[ue];if(r.hasOwnProperty(ue)&&de!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":I=de;default:s.hasOwnProperty(ue)||xt(e,n,ue,null,s,de)}}for(var le in s){var ue=s[le];if(de=r[le],s.hasOwnProperty(le)&&(ue!=null||de!=null))switch(le){case"type":m=ue;break;case"name":d=ue;break;case"checked":ie=ue;break;case"defaultChecked":ce=ue;break;case"value":S=ue;break;case"defaultValue":C=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(a(137,n));break;default:ue!==de&&xt(e,n,le,ue,s,de)}}yo(e,S,C,I,ie,ce,m,d);return;case"select":ue=S=C=le=null;for(m in r)if(I=r[m],r.hasOwnProperty(m)&&I!=null)switch(m){case"value":break;case"multiple":ue=I;default:s.hasOwnProperty(m)||xt(e,n,m,null,s,I)}for(d in s)if(m=s[d],I=r[d],s.hasOwnProperty(d)&&(m!=null||I!=null))switch(d){case"value":le=m;break;case"defaultValue":C=m;break;case"multiple":S=m;default:m!==I&&xt(e,n,d,m,s,I)}n=C,r=S,s=ue,le!=null?kr(e,!!r,le,!1):!!s!=!!r&&(n!=null?kr(e,!!r,n,!0):kr(e,!!r,r?[]:"",!1));return;case"textarea":ue=le=null;for(C in r)if(d=r[C],r.hasOwnProperty(C)&&d!=null&&!s.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:xt(e,n,C,null,s,d)}for(S in s)if(d=s[S],m=r[S],s.hasOwnProperty(S)&&(d!=null||m!=null))switch(S){case"value":le=d;break;case"defaultValue":ue=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(a(91));break;default:d!==m&&xt(e,n,S,d,s,m)}kd(e,le,ue);return;case"option":for(var Te in r)le=r[Te],r.hasOwnProperty(Te)&&le!=null&&!s.hasOwnProperty(Te)&&(Te==="selected"?e.selected=!1:xt(e,n,Te,null,s,le));for(I in s)le=s[I],ue=r[I],s.hasOwnProperty(I)&&le!==ue&&(le!=null||ue!=null)&&(I==="selected"?e.selected=le&&typeof le!="function"&&typeof le!="symbol":xt(e,n,I,le,s,ue));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 Le in r)le=r[Le],r.hasOwnProperty(Le)&&le!=null&&!s.hasOwnProperty(Le)&&xt(e,n,Le,null,s,le);for(ie in s)if(le=s[ie],ue=r[ie],s.hasOwnProperty(ie)&&le!==ue&&(le!=null||ue!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(a(137,n));break;default:xt(e,n,ie,le,s,ue)}return;default:if(vo(n)){for(var St in r)le=r[St],r.hasOwnProperty(St)&&le!==void 0&&!s.hasOwnProperty(St)&&lc(e,n,St,void 0,s,le);for(ce in s)le=s[ce],ue=r[ce],!s.hasOwnProperty(ce)||le===ue||le===void 0&&ue===void 0||lc(e,n,ce,le,s,ue);return}}for(var P in r)le=r[P],r.hasOwnProperty(P)&&le!=null&&!s.hasOwnProperty(P)&&xt(e,n,P,null,s,le);for(de in s)le=s[de],ue=r[de],!s.hasOwnProperty(de)||le===ue||le==null&&ue==null||xt(e,n,de,le,s,ue)}function Am(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,n=0,r=performance.getEntriesByType("resource"),s=0;s<r.length;s++){var d=r[s],m=d.transferSize,S=d.initiatorType,C=d.duration;if(m&&C&&Am(S)){for(S=0,C=d.responseEnd,s+=1;s<r.length;s++){var I=r[s],ie=I.startTime;if(ie>C)break;var ce=I.transferSize,de=I.initiatorType;ce&&Am(de)&&(I=I.responseEnd,S+=ce*(I<C?1:(C-ie)/(I-ie)))}if(--s,n+=8*(m+S)/(d.duration/1e3),e++,10<e)break}}if(0<e)return n/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var ac=null,sc=null;function Ss(e){return e.nodeType===9?e:e.ownerDocument}function Tm(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 zm(e,n){if(e===0)switch(n){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&n==="foreignObject"?0:e}function oc(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.children=="bigint"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var uc=null;function s0(){var e=window.event;return e&&e.type==="popstate"?e===uc?!1:(uc=e,!0):(uc=null,!1)}var Rm=typeof setTimeout=="function"?setTimeout:void 0,o0=typeof clearTimeout=="function"?clearTimeout:void 0,Dm=typeof Promise=="function"?Promise:void 0,u0=typeof queueMicrotask=="function"?queueMicrotask:typeof Dm<"u"?function(e){return Dm.resolve(null).then(e).catch(c0)}:Rm;function c0(e){setTimeout(function(){throw e})}function Li(e){return e==="head"}function Mm(e,n){var r=n,s=0;do{var d=r.nextSibling;if(e.removeChild(r),d&&d.nodeType===8)if(r=d.data,r==="/$"||r==="/&"){if(s===0){e.removeChild(d),nl(n);return}s--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")s++;else if(r==="html")$l(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,$l(r);for(var m=r.firstChild;m;){var S=m.nextSibling,C=m.nodeName;m[hl]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&m.rel.toLowerCase()==="stylesheet"||r.removeChild(m),m=S}}else r==="body"&&$l(e.ownerDocument.body);r=d}while(r);nl(n)}function _m(e,n){var r=e;e=0;do{var s=r.nextSibling;if(r.nodeType===1?n?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(n?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),s&&s.nodeType===8)if(r=s.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=s}while(r)}function cc(e){var n=e.firstChild;for(n&&n.nodeType===10&&(n=n.nextSibling);n;){var r=n;switch(n=n.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":cc(r),mo(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function f0(e,n,r,s){for(;e.nodeType===1;){var d=r;if(e.nodeName.toLowerCase()!==n.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[hl])switch(n){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(m=e.getAttribute("rel"),m==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(m!==d.rel||e.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||e.getAttribute("title")!==(d.title==null?null:d.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(m=e.getAttribute("src"),(m!==(d.src==null?null:d.src)||e.getAttribute("type")!==(d.type==null?null:d.type)||e.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(n==="input"&&e.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&e.getAttribute("name")===m)return e}else return e;if(e=Dn(e.nextSibling),e===null)break}return null}function d0(e,n,r){if(n==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Dn(e.nextSibling),e===null))return null;return e}function Om(e,n){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Dn(e.nextSibling),e===null))return null;return e}function fc(e){return e.data==="$?"||e.data==="$~"}function dc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function h0(e,n){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=n;else if(e.data!=="$?"||r.readyState!=="loading")n();else{var s=function(){n(),r.removeEventListener("DOMContentLoaded",s)};r.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Dn(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"||n==="F!"||n==="F")break;if(n==="/$"||n==="/&")return null}}return e}var hc=null;function Lm(e){e=e.nextSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(n===0)return Dn(e.nextSibling);n--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||n++}e=e.nextSibling}return null}function Bm(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(n===0)return e;n--}else r!=="/$"&&r!=="/&"||n++}e=e.previousSibling}return null}function Um(e,n,r){switch(n=Ss(r),e){case"html":if(e=n.documentElement,!e)throw Error(a(452));return e;case"head":if(e=n.head,!e)throw Error(a(453));return e;case"body":if(e=n.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function $l(e){for(var n=e.attributes;n.length;)e.removeAttributeNode(n[0]);mo(e)}var Mn=new Map,qm=new Set;function ws(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var pi=K.d;K.d={f:p0,r:m0,D:g0,C:y0,L:b0,m:v0,X:S0,S:x0,M:w0};function p0(){var e=pi.f(),n=hs();return e||n}function m0(e){var n=Sr(e);n!==null&&n.tag===5&&n.type==="form"?np(n):pi.r(e)}var Wr=typeof document>"u"?null:document;function Im(e,n,r){var s=Wr;if(s&&typeof n=="string"&&n){var d=Cn(n);d='link[rel="'+e+'"][href="'+d+'"]',typeof r=="string"&&(d+='[crossorigin="'+r+'"]'),qm.has(d)||(qm.add(d),e={rel:e,crossOrigin:r,href:n},s.querySelector(d)===null&&(n=s.createElement("link"),Zt(n,"link",e),Yt(n),s.head.appendChild(n)))}}function g0(e){pi.D(e),Im("dns-prefetch",e,null)}function y0(e,n){pi.C(e,n),Im("preconnect",e,n)}function b0(e,n,r){pi.L(e,n,r);var s=Wr;if(s&&e&&n){var d='link[rel="preload"][as="'+Cn(n)+'"]';n==="image"&&r&&r.imageSrcSet?(d+='[imagesrcset="'+Cn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(d+='[imagesizes="'+Cn(r.imageSizes)+'"]')):d+='[href="'+Cn(e)+'"]';var m=d;switch(n){case"style":m=el(e);break;case"script":m=tl(e)}Mn.has(m)||(e=y({rel:"preload",href:n==="image"&&r&&r.imageSrcSet?void 0:e,as:n},r),Mn.set(m,e),s.querySelector(d)!==null||n==="style"&&s.querySelector(Zl(m))||n==="script"&&s.querySelector(Pl(m))||(n=s.createElement("link"),Zt(n,"link",e),Yt(n),s.head.appendChild(n)))}}function v0(e,n){pi.m(e,n);var r=Wr;if(r&&e){var s=n&&typeof n.as=="string"?n.as:"script",d='link[rel="modulepreload"][as="'+Cn(s)+'"][href="'+Cn(e)+'"]',m=d;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=tl(e)}if(!Mn.has(m)&&(e=y({rel:"modulepreload",href:e},n),Mn.set(m,e),r.querySelector(d)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Pl(m)))return}s=r.createElement("link"),Zt(s,"link",e),Yt(s),r.head.appendChild(s)}}}function x0(e,n,r){pi.S(e,n,r);var s=Wr;if(s&&e){var d=wr(s).hoistableStyles,m=el(e);n=n||"default";var S=d.get(m);if(!S){var C={loading:0,preload:null};if(S=s.querySelector(Zl(m)))C.loading=5;else{e=y({rel:"stylesheet",href:e,"data-precedence":n},r),(r=Mn.get(m))&&pc(e,r);var I=S=s.createElement("link");Yt(I),Zt(I,"link",e),I._p=new Promise(function(ie,ce){I.onload=ie,I.onerror=ce}),I.addEventListener("load",function(){C.loading|=1}),I.addEventListener("error",function(){C.loading|=2}),C.loading|=4,js(S,n,s)}S={type:"stylesheet",instance:S,count:1,state:C},d.set(m,S)}}}function S0(e,n){pi.X(e,n);var r=Wr;if(r&&e){var s=wr(r).hoistableScripts,d=tl(e),m=s.get(d);m||(m=r.querySelector(Pl(d)),m||(e=y({src:e,async:!0},n),(n=Mn.get(d))&&mc(e,n),m=r.createElement("script"),Yt(m),Zt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(d,m))}}function w0(e,n){pi.M(e,n);var r=Wr;if(r&&e){var s=wr(r).hoistableScripts,d=tl(e),m=s.get(d);m||(m=r.querySelector(Pl(d)),m||(e=y({src:e,async:!0,type:"module"},n),(n=Mn.get(d))&&mc(e,n),m=r.createElement("script"),Yt(m),Zt(m,"link",e),r.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},s.set(d,m))}}function Hm(e,n,r,s){var d=(d=te.current)?ws(d):null;if(!d)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(n=el(r.href),r=wr(d).hoistableStyles,s=r.get(n),s||(s={type:"style",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=el(r.href);var m=wr(d).hoistableStyles,S=m.get(e);if(S||(d=d.ownerDocument||d,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(e,S),(m=d.querySelector(Zl(e)))&&!m._p&&(S.instance=m,S.state.loading=5),Mn.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},Mn.set(e,r),m||j0(d,e,r,S.state))),n&&s===null)throw Error(a(528,""));return S}if(n&&s!==null)throw Error(a(529,""));return null;case"script":return n=r.async,r=r.src,typeof r=="string"&&n&&typeof n!="function"&&typeof n!="symbol"?(n=tl(r),r=wr(d).hoistableScripts,s=r.get(n),s||(s={type:"script",instance:null,count:0,state:null},r.set(n,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function el(e){return'href="'+Cn(e)+'"'}function Zl(e){return'link[rel="stylesheet"]['+e+"]"}function Vm(e){return y({},e,{"data-precedence":e.precedence,precedence:null})}function j0(e,n,r,s){e.querySelector('link[rel="preload"][as="style"]['+n+"]")?s.loading=1:(n=e.createElement("link"),s.preload=n,n.addEventListener("load",function(){return s.loading|=1}),n.addEventListener("error",function(){return s.loading|=2}),Zt(n,"link",r),Yt(n),e.head.appendChild(n))}function tl(e){return'[src="'+Cn(e)+'"]'}function Pl(e){return"script[async]"+e}function Ym(e,n,r){if(n.count++,n.instance===null)switch(n.type){case"style":var s=e.querySelector('style[data-href~="'+Cn(r.href)+'"]');if(s)return n.instance=s,Yt(s),s;var d=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),Yt(s),Zt(s,"style",d),js(s,r.precedence,e),n.instance=s;case"stylesheet":d=el(r.href);var m=e.querySelector(Zl(d));if(m)return n.state.loading|=4,n.instance=m,Yt(m),m;s=Vm(r),(d=Mn.get(d))&&pc(s,d),m=(e.ownerDocument||e).createElement("link"),Yt(m);var S=m;return S._p=new Promise(function(C,I){S.onload=C,S.onerror=I}),Zt(m,"link",s),n.state.loading|=4,js(m,r.precedence,e),n.instance=m;case"script":return m=tl(r.src),(d=e.querySelector(Pl(m)))?(n.instance=d,Yt(d),d):(s=r,(d=Mn.get(m))&&(s=y({},r),mc(s,d)),e=e.ownerDocument||e,d=e.createElement("script"),Yt(d),Zt(d,"link",s),e.head.appendChild(d),n.instance=d);case"void":return null;default:throw Error(a(443,n.type))}else n.type==="stylesheet"&&(n.state.loading&4)===0&&(s=n.instance,n.state.loading|=4,js(s,r.precedence,e));return n.instance}function js(e,n,r){for(var s=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=s.length?s[s.length-1]:null,m=d,S=0;S<s.length;S++){var C=s[S];if(C.dataset.precedence===n)m=C;else if(m!==d)break}m?m.parentNode.insertBefore(e,m.nextSibling):(n=r.nodeType===9?r.head:r,n.insertBefore(e,n.firstChild))}function pc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.title==null&&(e.title=n.title)}function mc(e,n){e.crossOrigin==null&&(e.crossOrigin=n.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=n.referrerPolicy),e.integrity==null&&(e.integrity=n.integrity)}var ks=null;function Gm(e,n,r){if(ks===null){var s=new Map,d=ks=new Map;d.set(r,s)}else d=ks,s=d.get(r),s||(s=new Map,d.set(r,s));if(s.has(e))return s;for(s.set(e,null),r=r.getElementsByTagName(e),d=0;d<r.length;d++){var m=r[d];if(!(m[hl]||m[Qt]||e==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var S=m.getAttribute(n)||"";S=e+S;var C=s.get(S);C?C.push(m):s.set(S,[m])}}return s}function Fm(e,n,r){e=e.ownerDocument||e,e.head.insertBefore(r,n==="title"?e.querySelector("head > title"):null)}function k0(e,n,r){if(r===1||n.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof n.precedence!="string"||typeof n.href!="string"||n.href==="")break;return!0;case"link":if(typeof n.rel!="string"||typeof n.href!="string"||n.href===""||n.onLoad||n.onError)break;return n.rel==="stylesheet"?(e=n.disabled,typeof n.precedence=="string"&&e==null):!0;case"script":if(n.async&&typeof n.async!="function"&&typeof n.async!="symbol"&&!n.onLoad&&!n.onError&&n.src&&typeof n.src=="string")return!0}return!1}function Qm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function C0(e,n,r,s){if(r.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var d=el(s.href),m=n.querySelector(Zl(d));if(m){n=m._p,n!==null&&typeof n=="object"&&typeof n.then=="function"&&(e.count++,e=Cs.bind(e),n.then(e,e)),r.state.loading|=4,r.instance=m,Yt(m);return}m=n.ownerDocument||n,s=Vm(s),(d=Mn.get(d))&&pc(s,d),m=m.createElement("link"),Yt(m);var S=m;S._p=new Promise(function(C,I){S.onload=C,S.onerror=I}),Zt(m,"link",s),r.instance=m}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,n),(n=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Cs.bind(e),n.addEventListener("load",r),n.addEventListener("error",r))}}var gc=0;function E0(e,n){return e.stylesheets&&e.count===0&&Ns(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var s=setTimeout(function(){if(e.stylesheets&&Ns(e,e.stylesheets),e.unsuspend){var m=e.unsuspend;e.unsuspend=null,m()}},6e4+n);0<e.imgBytes&&gc===0&&(gc=62500*a0());var d=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ns(e,e.stylesheets),e.unsuspend)){var m=e.unsuspend;e.unsuspend=null,m()}},(e.imgBytes>gc?50:800)+n);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(d)}}:null}function Cs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ns(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Es=null;function Ns(e,n){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Es=new Map,n.forEach(N0,e),Es=null,Cs.call(e))}function N0(e,n){if(!(n.state.loading&4)){var r=Es.get(e);if(r)var s=r.get(null);else{r=new Map,Es.set(e,r);for(var d=e.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var S=d[m];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(r.set(S.dataset.precedence,S),s=S)}s&&r.set(null,s)}d=n.instance,S=d.getAttribute("data-precedence"),m=r.get(S)||s,m===s&&r.set(null,d),r.set(S,d),this.count++,s=Cs.bind(this),d.addEventListener("load",s),d.addEventListener("error",s),m?m.parentNode.insertBefore(d,m.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(d,e.firstChild)),n.state.loading|=4}}var Jl={$$typeof:L,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function A0(e,n,r,s,d,m,S,C,I){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=dt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dt(0),this.hiddenUpdates=dt(null),this.identifierPrefix=s,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function Xm(e,n,r,s,d,m,S,C,I,ie,ce,de){return e=new A0(e,n,r,S,I,ie,ce,de,C),n=1,m===!0&&(n|=24),m=gn(3,null,null,n),e.current=m,m.stateNode=e,n=$o(),n.refCount++,e.pooledCache=n,n.refCount++,m.memoizedState={element:s,isDehydrated:r,cache:n},Wo(m),e}function Km(e){return e?(e=Dr,e):Dr}function $m(e,n,r,s,d,m){d=Km(d),s.context===null?s.context=d:s.pendingContext=d,s=Ci(n),s.payload={element:r},m=m===void 0?null:m,m!==null&&(s.callback=m),r=Ei(e,s,n),r!==null&&(fn(r,e,n),zl(r,e,n))}function Zm(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<n?r:n}}function yc(e,n){Zm(e,n),(e=e.alternate)&&Zm(e,n)}function Pm(e){if(e.tag===13||e.tag===31){var n=Ji(e,67108864);n!==null&&fn(n,e,67108864),yc(e,67108864)}}function Jm(e){if(e.tag===13||e.tag===31){var n=Sn();n=Ft(n);var r=Ji(e,n);r!==null&&fn(r,e,n),yc(e,n)}}var As=!0;function T0(e,n,r,s){var d=N.T;N.T=null;var m=K.p;try{K.p=2,bc(e,n,r,s)}finally{K.p=m,N.T=d}}function z0(e,n,r,s){var d=N.T;N.T=null;var m=K.p;try{K.p=8,bc(e,n,r,s)}finally{K.p=m,N.T=d}}function bc(e,n,r,s){if(As){var d=vc(s);if(d===null)rc(e,n,s,Ts,r),eg(e,s);else if(D0(d,e,n,r,s))s.stopPropagation();else if(eg(e,s),n&4&&-1<R0.indexOf(e)){for(;d!==null;){var m=Sr(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var S=ke(m.pendingLanes);if(S!==0){var C=m;for(C.pendingLanes|=2,C.entangledLanes|=2;S;){var I=1<<31-Ze(S);C.entanglements[1]|=I,S&=~I}Qn(m),(ht&6)===0&&(fs=rt()+500,Ql(0))}}break;case 31:case 13:C=Ji(m,2),C!==null&&fn(C,m,2),hs(),yc(m,2)}if(m=vc(s),m===null&&rc(e,n,s,Ts,r),m===d)break;d=m}d!==null&&s.stopPropagation()}else rc(e,n,s,null,r)}}function vc(e){return e=So(e),xc(e)}var Ts=null;function xc(e){if(Ts=null,e=xr(e),e!==null){var n=f(e);if(n===null)e=null;else{var r=n.tag;if(r===13){if(e=o(n),e!==null)return e;e=null}else if(r===31){if(e=p(n),e!==null)return e;e=null}else if(r===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null)}}return Ts=e,null}function Wm(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"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(wt()){case M:return 2;case $:return 8;case me:case ve:return 32;case Ce:return 268435456;default:return 32}default:return 32}}var Sc=!1,Bi=null,Ui=null,qi=null,Wl=new Map,ea=new Map,Ii=[],R0="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 eg(e,n){switch(e){case"focusin":case"focusout":Bi=null;break;case"dragenter":case"dragleave":Ui=null;break;case"mouseover":case"mouseout":qi=null;break;case"pointerover":case"pointerout":Wl.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":ea.delete(n.pointerId)}}function ta(e,n,r,s,d,m){return e===null||e.nativeEvent!==m?(e={blockedOn:n,domEventName:r,eventSystemFlags:s,nativeEvent:m,targetContainers:[d]},n!==null&&(n=Sr(n),n!==null&&Pm(n)),e):(e.eventSystemFlags|=s,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function D0(e,n,r,s,d){switch(n){case"focusin":return Bi=ta(Bi,e,n,r,s,d),!0;case"dragenter":return Ui=ta(Ui,e,n,r,s,d),!0;case"mouseover":return qi=ta(qi,e,n,r,s,d),!0;case"pointerover":var m=d.pointerId;return Wl.set(m,ta(Wl.get(m)||null,e,n,r,s,d)),!0;case"gotpointercapture":return m=d.pointerId,ea.set(m,ta(ea.get(m)||null,e,n,r,s,d)),!0}return!1}function tg(e){var n=xr(e.target);if(n!==null){var r=f(n);if(r!==null){if(n=r.tag,n===13){if(n=o(r),n!==null){e.blockedOn=n,br(e.priority,function(){Jm(r)});return}}else if(n===31){if(n=p(r),n!==null){e.blockedOn=n,br(e.priority,function(){Jm(r)});return}}else if(n===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zs(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var r=vc(e.nativeEvent);if(r===null){r=e.nativeEvent;var s=new r.constructor(r.type,r);xo=s,r.target.dispatchEvent(s),xo=null}else return n=Sr(r),n!==null&&Pm(n),e.blockedOn=r,!1;n.shift()}return!0}function ng(e,n,r){zs(e)&&r.delete(n)}function M0(){Sc=!1,Bi!==null&&zs(Bi)&&(Bi=null),Ui!==null&&zs(Ui)&&(Ui=null),qi!==null&&zs(qi)&&(qi=null),Wl.forEach(ng),ea.forEach(ng)}function Rs(e,n){e.blockedOn===n&&(e.blockedOn=null,Sc||(Sc=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,M0)))}var Ds=null;function ig(e){Ds!==e&&(Ds=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ds===e&&(Ds=null);for(var n=0;n<e.length;n+=3){var r=e[n],s=e[n+1],d=e[n+2];if(typeof s!="function"){if(xc(s||r)===null)continue;break}var m=Sr(r);m!==null&&(e.splice(n,3),n-=3,vu(m,{pending:!0,data:d,method:r.method,action:s},s,d))}}))}function nl(e){function n(I){return Rs(I,e)}Bi!==null&&Rs(Bi,e),Ui!==null&&Rs(Ui,e),qi!==null&&Rs(qi,e),Wl.forEach(n),ea.forEach(n);for(var r=0;r<Ii.length;r++){var s=Ii[r];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ii.length&&(r=Ii[0],r.blockedOn===null);)tg(r),r.blockedOn===null&&Ii.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(s=0;s<r.length;s+=3){var d=r[s],m=r[s+1],S=d[ln]||null;if(typeof m=="function")S||ig(r);else if(S){var C=null;if(m&&m.hasAttribute("formAction")){if(d=m,S=m[ln]||null)C=S.formAction;else if(xc(d)!==null)continue}else C=S.action;typeof C=="function"?r[s+1]=C:(r.splice(s,3),s-=3),ig(r)}}}function rg(){function e(m){m.canIntercept&&m.info==="react-transition"&&m.intercept({handler:function(){return new Promise(function(S){return d=S})},focusReset:"manual",scroll:"manual"})}function n(){d!==null&&(d(),d=null),s||setTimeout(r,20)}function r(){if(!s&&!navigation.transition){var m=navigation.currentEntry;m&&m.url!=null&&navigation.navigate(m.url,{state:m.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,d=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",n),navigation.addEventListener("navigateerror",n),setTimeout(r,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",n),navigation.removeEventListener("navigateerror",n),d!==null&&(d(),d=null)}}}function wc(e){this._internalRoot=e}Ms.prototype.render=wc.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(a(409));var r=n.current,s=Sn();$m(r,s,e,n,null,null)},Ms.prototype.unmount=wc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;$m(e.current,2,null,e,null,null),hs(),n[vr]=null}};function Ms(e){this._internalRoot=e}Ms.prototype.unstable_scheduleHydration=function(e){if(e){var n=dl();e={blockedOn:null,target:e,priority:n};for(var r=0;r<Ii.length&&n!==0&&n<Ii[r].priority;r++);Ii.splice(r,0,e),r===0&&tg(e)}};var lg=i.version;if(lg!=="19.2.6")throw Error(a(527,lg,"19.2.6"));K.findDOMNode=function(e){var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=g(n),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var _0={bundleType:0,version:"19.2.6",rendererPackageName:"react-dom",currentDispatcherRef:N,reconcilerVersion:"19.2.6"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _s=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_s.isDisabled&&_s.supportsFiber)try{bt=_s.inject(_0),ft=_s}catch{}}return ia.createRoot=function(e,n){if(!c(e))throw Error(a(299));var r=!1,s="",d=dp,m=hp,S=pp;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError)),n=Xm(e,1,!1,null,null,r,s,null,d,m,S,rg),e[vr]=n.current,ic(e),new wc(n)},ia.hydrateRoot=function(e,n,r){if(!c(e))throw Error(a(299));var s=!1,d="",m=dp,S=hp,C=pp,I=null;return r!=null&&(r.unstable_strictMode===!0&&(s=!0),r.identifierPrefix!==void 0&&(d=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(S=r.onCaughtError),r.onRecoverableError!==void 0&&(C=r.onRecoverableError),r.formState!==void 0&&(I=r.formState)),n=Xm(e,1,!0,n,r??null,s,d,I,m,S,C,rg),n.context=Km(null),r=n.current,s=Sn(),s=Ft(s),d=Ci(s),d.callback=null,Ei(r,d,s),r=s,n.current.lanes=r,en(n,r),Qn(n),e[vr]=n.current,ic(e),new Ms(n)},ia.version="19.2.6",ia}var gg;function s1(){if(gg)return Ec.exports;gg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(i){console.error(i)}}return t(),Ec.exports=a1(),Ec.exports}var o1=s1();const u1=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function ob(t){if(!t||typeof t!="object")return!1;const i=t;return i.version===1&&typeof i.id=="string"&&u1.test(i.id)&&typeof i.name=="string"&&i.name.trim().length>0&&i.name.length<=128&&!/[\u0000-\u001f\u007f]/.test(i.name)&&["desktop","hub","project-host"].includes(i.kind)&&i.entryPath===(i.kind==="desktop"?"/mobile":"/")}const Ff="codeshell.environments.v1",ub=32;function Qf(t){if(t.length>2048||/[\\\u0000-\u0020\u007f]/.test(t))throw new Error("请输入完整的工作台地址。");const i=new URL(t);if(!["https:","http:"].includes(i.protocol)||i.username||i.password||i.search||i.hash)throw new Error("请使用不含密码、配对令牌或查询参数的工作台地址。");if(!["/","/mobile","/mobile/"].includes(i.pathname))throw new Error("请填写工作台首页或桌面 /mobile 地址。");return i.origin+(i.pathname.startsWith("/mobile")?"/mobile":"/")}function cb(t){if(!t||typeof t!="object")throw new Error("无效的连接记录。");const i=t;if(typeof i.address!="string"||typeof i.name!="string"||!i.name.trim()||i.name.length>80||/[\u0000-\u001f\u007f]/.test(i.name))throw new Error("连接名称需为 1–80 个字符。");if(i.environmentId!==void 0&&!ob({version:1,id:i.environmentId,name:"Host",kind:"hub",entryPath:"/"}))throw new Error("无效的环境身份。");return{address:Qf(i.address),name:i.name.trim(),...i.environmentId?{environmentId:i.environmentId}:{}}}function Ps(t){const i=t.getItem(Ff);if(i===null)return[];if(i.length>1e5)throw new Error("连接记录过大,请清理当前工作台的连接记录。");const l=JSON.parse(i);if(!Array.isArray(l)||l.length>ub)throw new Error("连接记录格式无效。");return l.map(cb)}function yg(t,i){const l=cb(i),a=Ps(t),c=a.find(o=>o.address===l.address);if(c?.environmentId&&l.environmentId&&c.environmentId!==l.environmentId)throw new Error("这个地址的环境身份已变化。请确认目标后,删除旧连接再添加。");const f=[...a.filter(o=>o.address!==l.address),{...l,...c?.environmentId?{environmentId:c.environmentId}:{}}];if(f.length>ub)throw new Error("最多保存 32 个环境,请先移除不再使用的连接。");return t.setItem(Ff,JSON.stringify(f)),f}function c1(t,i){const l=Ps(t).filter(a=>a.address!==Qf(i));return t.setItem(Ff,JSON.stringify(l)),l}function f1(t,i,l){const a=t.find(c=>c.address===i+l.entryPath);if(a?.environmentId&&a.environmentId!==l.id)throw new Error("当前地址对应的环境已变化,请核对项目后重新保存连接。")}function Xf({discover:t=!0,navigate:i}){const[l,a]=w.useState(!1),[c,f]=w.useState(),[o,p]=w.useState([]),[h,g]=w.useState(""),[b,y]=w.useState(""),[v,x]=w.useState(""),k=w.useRef(null),_=w.useRef(null);w.useEffect(()=>{try{p(Ps(window.localStorage))}catch{x("无法读取连接记录。当前项目仍可使用。")}},[]),w.useEffect(()=>{if(!t)return;const z=new AbortController;return Ue("/api/v1/environment",{signal:z.signal}).then(L=>{if(!z.signal.aborted){if(!ob(L))throw new Error("环境信息无效,请更新工作台后重试。");f(L),f1(Ps(window.localStorage),window.location.origin,L)}}).catch(L=>{z.signal.aborted||L instanceof Xe&&[401,404].includes(L.status)||x(L instanceof Error?L.message:"无法读取环境信息。")}),()=>z.abort()},[t]),w.useEffect(()=>{l&&(k.current?.showModal(),_.current?.focus())},[l]);const D=z=>{try{p(z()),x("")}catch(L){x(L instanceof Error?L.message:"保存连接失败。")}},R=z=>{const L=Qf(z);a(!1),i?i(L):window.location.assign(L)};return u.jsxs("div",{className:"environment-switcher",children:[u.jsxs("button",{type:"button",className:"ghost environment-trigger",onClick:()=>a(!0),children:[c?.name??"连接环境",u.jsx("span",{"aria-hidden":"true",children:" ▾"})]}),l?u.jsxs("dialog",{ref:k,className:"environment-dialog","aria-labelledby":"environment-title",onCancel:()=>a(!1),onClose:()=>a(!1),children:[u.jsxs("header",{children:[u.jsx("h2",{id:"environment-title",children:"电脑与云端"}),u.jsx("button",{ref:_,type:"button",className:"ghost",onClick:()=>a(!1),children:"关闭"})]}),u.jsx("p",{children:"打开目标环境后选择项目。切换入口不会移动文件或正在运行的任务。"}),u.jsxs("p",{className:"environment-location",children:["当前地址:",window.location.origin]}),v?u.jsx("p",{role:"alert",className:"form-error",children:v}):null,c?u.jsx("button",{type:"button",className:"library-button",onClick:()=>D(()=>yg(window.localStorage,{name:c.name,address:window.location.origin+c.entryPath,environmentId:c.id})),children:"保存当前环境"}):null,u.jsx("ul",{className:"environment-list",children:o.map(z=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsx("strong",{children:z.name}),u.jsx("small",{children:z.address})]}),u.jsx("button",{type:"button",className:"library-button",onClick:()=>R(z.address),children:"打开"}),u.jsx("button",{type:"button",className:"ghost","aria-label":`移除 ${z.name}`,onClick:()=>D(()=>c1(window.localStorage,z.address)),children:"移除"})]},z.address))}),u.jsxs("form",{onSubmit:z=>{z.preventDefault(),D(()=>yg(window.localStorage,{name:h,address:b.trim()}))},children:[u.jsxs("label",{children:["连接名称",u.jsx("input",{required:!0,maxLength:80,value:h,onChange:z=>g(z.target.value),placeholder:"例如:家里的电脑"})]}),u.jsxs("label",{children:["工作台地址",u.jsx("input",{required:!0,type:"url",maxLength:2048,value:b,onChange:z=>y(z.target.value),placeholder:"https://example.com/"})]}),u.jsx("button",{type:"submit",className:"library-button primary",children:"添加连接"})]}),u.jsx("p",{className:"environment-hint",children:"连接记录保存在当前工作台的浏览器存储中。目标环境需要单独登录或配对,请勿保存带配对令牌的地址。未连接的环境不会显示为在线。"})]}):null]})}function d1({session:t,onClose:i,onAuthLost:l}){const[a,c]=w.useState([]),[f,o]=w.useState(""),[p,h]=w.useState("loading"),g=w.useRef(null),b=w.useCallback(x=>{x instanceof Xe&&x.status===401?l():o(x instanceof Error?x.message:"操作失败,请重试。")},[l]);w.useEffect(()=>{let x=!0;return g.current?.showModal(),Ue("/api/v1/auth/sessions").then(k=>{x&&c(k.sessions)}).catch(k=>{x&&b(k)}).finally(()=>{x&&h(null)}),()=>{x=!1}},[b]);const y=async x=>{h(x.id),o("");try{await Ue(`/api/v1/auth/sessions/${encodeURIComponent(x.id)}`,{method:"DELETE"}),x.current?l():c(k=>k.filter(_=>_.id!==x.id))}catch(k){b(k)}finally{h(null)}},v=async()=>{h("logout"),o("");try{await lb("/api/v1/auth/logout"),l()}catch(x){b(x)}finally{h(null)}};return u.jsxs("dialog",{className:"devices-dialog",ref:g,onCancel:i,"aria-labelledby":"devices-title",children:[u.jsxs("div",{className:"dialog-head",children:[u.jsx("h2",{id:"devices-title",children:"账号与设备"}),u.jsx("button",{className:"ghost",onClick:i,"aria-label":"关闭",children:"×"})]}),u.jsxs("p",{className:"muted",children:[t?.username," · ",t?.deviceName||"当前设备"]}),f?u.jsx("p",{className:"form-error",role:"alert",children:f}):null,p==="loading"?u.jsx("p",{role:"status",children:"正在读取设备…"}):null,u.jsx("ul",{className:"device-list",children:a.map(x=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsxs("strong",{children:[x.deviceName||"未命名设备",x.current?"(当前)":""]}),u.jsxs("span",{children:["最近活动 ",new Date(x.lastSeenAt).toLocaleString()]})]}),u.jsx("button",{className:"ghost",disabled:p!==null,onClick:()=>{y(x)},children:p===x.id?"处理中…":"撤销登录"})]},x.id))}),u.jsx("button",{className:"stop",disabled:p!==null,onClick:()=>{v()},children:"退出当前设备"})]})}function zc(t){return{expectedRevision:t?t.revision:null,id:t?.id??"",catalogId:t?.catalogId??"",model:t?.model??"",baseUrl:t?.baseUrl??"",apiKey:""}}function h1(t){const i={id:t.id.trim(),catalogId:t.catalogId,model:t.model.trim(),baseUrl:t.baseUrl.trim()};return t.expectedRevision!==void 0&&(i.expectedRevision=t.expectedRevision),t.apiKey.trim()&&(i.apiKey=t.apiKey.trim()),i}function Kf(t){if(!t||typeof t.workspace?.path!="string"||!t.defaults||!Array.isArray(t.connections)||!Array.isArray(t.catalog)||!Array.isArray(t.skills)||!Array.isArray(t.mcpServers)||!Array.isArray(t.workspace.skillDirectories))throw new Error("服务端返回了无效的设置,请刷新后重试。");return t}async function fb(t){return Kf(await Ue("/api/v1/configuration",{signal:t}))}async function $f(t,i,l){return Kf(await Ue(`/api/v1/configuration/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:l}))}function p1(t,i){return $f("connections",h1(t),i)}function m1(t,i){return $f("defaults",t,i)}function g1(t,i,l){return $f("skills",{name:t,enabled:i},l)}function db(t){const i=t instanceof Error?t.message:"设置更新失败,请重试。",l={"provide an API key when changing the endpoint origin":"更换服务地址时,请同时填写该服务使用的 API Key。现有密钥不会自动发送到新的服务地址。","baseUrl must be an HTTP(S) URL without credentials, query or fragment":"请填写 HTTP 或 HTTPS 服务地址,不要在地址中包含账号、密码、查询参数或片段。","enable the owning plugin on the server first":"请先在服务器上启用这个 Skill 所属的插件。","select an existing text connection":"这个模型连接已不可用,请刷新后重新选择。","configuration request failed":"配置操作未完成,请刷新设置确认当前状态后重试。","too many model connections":"模型连接数量已达上限,请先删除不用的连接。","skill not found":"这个 Skill 已不在服务器上,请刷新列表。","unknown text provider":"这个模型服务商不可用,请刷新设置后重新选择。","existing connection provider cannot be changed":"已有连接的服务商不能直接更换,请创建新连接。"};return l[i]?l[i]:/^(id|catalogId|model|text|auxText|apiKey) is invalid$/.exec(i)?"配置字段无效,请检查名称、模型与密钥后重试。":i}async function y1(t,i,l,a){return Kf(await Ue("/api/v1/configuration/connections",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,...i?{replacementText:i}:{},...a?{expectedRevision:a}:{}}),signal:l}))}async function b1(t,i){const l=va(),a=yt("/api/v1/configuration/connections/probe"),c=yt("/api/v1/configuration/connections/probe/cancel");let f;try{f=await Ue(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,requestId:l}),signal:i})}catch(o){throw i?.aborted&&await Ue(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:l}),signal:AbortSignal.timeout(2e3)}).catch(()=>{}),o}if(!f||f.connectionId!==t||typeof f.ok!="boolean"||typeof f.message!="string"||typeof f.code!="string"||!Number.isFinite(f.latencyMs))throw new Error("服务端返回了无效的测试结果,请重试。");return f}const Zf="/api/v1/skills";async function bg(t){const i=await Ue(Zf,{signal:t});if(!i||!Array.isArray(i.skills)||!Array.isArray(i.directories))throw new Error("Skills 列表读取失败,请刷新重试。");return i}async function v1(t,i){const l=await Ue(`${Zf}/detail?name=${encodeURIComponent(t)}`,{signal:i});if(l.name!==t||typeof l.content!="string"||typeof l.revision!="string")throw new Error("Skill 内容读取失败,请重试。");return l}function pr(t,i,l,a){return Ue(`${Zf}${t}`,{method:i,headers:{"Content-Type":"application/json"},body:JSON.stringify(l),signal:a})}const x1=(t,i,l)=>pr("/local","POST",{name:t,content:i},l),S1=(t,i,l,a)=>pr("/local","PUT",{name:t,content:i,revision:l},a),w1=(t,i,l)=>pr("/local","DELETE",{name:t,revision:i},l),j1=(t,i)=>pr("/github/preview","POST",{url:t.trim()},i),k1=(t,i,l,a)=>pr("/github/install","POST",{reviewToken:t,pathInRepo:i,name:l.trim()},a),C1=(t,i,l)=>pr("/github/update-preview","POST",{name:t,revision:i},l),E1=(t,i)=>pr("/github/update","POST",{reviewToken:t},i);function Us(t){return`---
|
|
10
|
-
name: ${t||"my-skill"}
|
|
11
|
-
description: 描述这个 Skill 适合处理什么任务
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# 工作方式
|
|
15
|
-
|
|
16
|
-
在这里写下具体步骤、输入要求和完成标准。
|
|
17
|
-
`}function Cf(t){return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)&&!t.includes("..")}function N1(t,i,l){const a=i.trim().toLocaleLowerCase();return t.filter(c=>(l==="all"||c.source===l)&&(!a||`${c.name} ${c.description}`.toLocaleLowerCase().includes(a)))}const vg={project:"工作区",user:"用户级",plugin:"插件","panel-app":"Panel App"};function A1({onAuthLost:t,onChanged:i,onDirtyChange:l,configurationVersion:a=0}){const[c,f]=w.useState(null),[o,p]=w.useState(null),[h,g]=w.useState(""),[b,y]=w.useState("all"),[v,x]=w.useState(""),[k,_]=w.useState(""),[D,R]=w.useState(""),[z,L]=w.useState(0),[G,se]=w.useState(!1),[T,V]=w.useState(!1),X=w.useRef(null),q=w.useRef(null),E=w.useRef(!1),U=w.useRef({onAuthLost:t,onChanged:i});U.current={onAuthLost:t,onChanged:i};const H=w.useRef(null),Z=w.useRef(null),ee=w.useCallback(j=>{j instanceof Xe&&j.status===401?U.current.onAuthLost():_(j instanceof Error?j.message:"操作失败,请重试。")},[]);w.useEffect(()=>()=>{X.current?.abort(),q.current?.abort()},[]),w.useEffect(()=>{if(X.current){E.current=!0;return}const j=new AbortController;return q.current=j,bg(j.signal).then(O=>{j.signal.aborted||f(O)}).catch(O=>{j.signal.aborted||ee(O)}),()=>j.abort()},[z,a,ee]),w.useEffect(()=>{o&&H.current?.focus()},[o?.kind]);const W=j=>{Z.current=document.activeElement,_(""),R(""),se(!1),V(!1),p(j)},N=()=>{p(null),se(!1),V(!1),_(""),Z.current?.focus()},K=()=>{if(!X.current){if(G){V(!0);return}N()}},he=async(j,O,J=!1)=>{if(X.current)return;q.current?.abort();const A=new AbortController;X.current=A,x(j),_(""),R("");try{const ae=await O(A.signal);if(A.signal.aborted)return;if(J){try{const pe=await bg(A.signal);A.signal.aborted||f(pe)}catch(pe){if(pe instanceof Xe&&pe.status===401)throw pe;A.signal.aborted||_("操作已完成,但列表刷新失败。请点击刷新查看最新状态。")}if(A.signal.aborted)return;R(ae.message||"设置已保存,下次任务生效。"),U.current.onChanged?.()}return ae}catch(ae){A.signal.aborted||ee(ae);return}finally{X.current===A&&(X.current=null),A.signal.aborted||(x(""),E.current&&(E.current=!1,L(ae=>ae+1)))}};w.useEffect(()=>(l?.(G||!!v),()=>l?.(!1)),[G,v,l]);const ge=N1(c?.skills??[],h,b);return u.jsxs("section",{className:"hub-skills","aria-labelledby":"skills-title",onKeyDown:j=>{j.key==="Escape"&&o&&!v&&(j.preventDefault(),K())},children:[u.jsxs("header",{className:"skills-heading",children:[u.jsxs("div",{children:[u.jsx("span",{className:"skills-eyebrow",children:"工作区能力"}),u.jsx("h1",{id:"skills-title",children:"Skills"}),u.jsx("p",{children:"创建工作说明,导入社区技能,把常用流程留在工作区。"})]}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",disabled:!!v||!!o,onClick:()=>W({kind:"import"}),children:"从 GitHub 导入"}),u.jsx("button",{className:"config-button config-button-primary",disabled:!!v||!!o,onClick:()=>W({kind:"create"}),children:"+ 创建 Skill"})]})]}),k&&u.jsx("div",{className:"config-message config-error",role:"alert",children:k}),D&&u.jsx("div",{className:"config-message config-success",role:"status",children:D}),v&&u.jsxs("p",{className:"skills-progress",role:"status",children:[v,"…"]}),o&&u.jsxs("section",{className:"skills-workspace-panel","aria-labelledby":"skills-panel-title",children:[u.jsxs("header",{children:[u.jsx("h2",{id:"skills-panel-title",ref:H,tabIndex:-1,children:o.kind==="create"?"创建 Skill":o.kind==="detail"?o.detail.editable?`编辑 ${o.detail.name}`:o.detail.name:o.kind==="import"?"从 GitHub 导入":o.kind==="update"?`更新 ${o.preview.name}`:`移除 ${o.skill.name}`}),u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v,onClick:K,children:"关闭"})]}),T&&u.jsxs("div",{className:"skills-discard-confirm",role:"alert",children:[u.jsx("p",{children:"还有未保存的修改。关闭会丢弃这些修改。"}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",onClick:()=>V(!1),children:"继续编辑"}),u.jsx("button",{className:"config-button skills-danger",onClick:N,children:"放弃修改并关闭"})]})]}),(o.kind==="create"||o.kind==="detail")&&u.jsx(T1,{detail:o.kind==="detail"?o.detail:void 0,busy:!!v,run:he,onSaved:N,onDirtyChange:se},o.kind==="detail"?o.detail.name+o.detail.revision:"create"),o.kind==="import"&&u.jsx(z1,{preview:o.preview,busy:!!v,run:he,onPreview:j=>p({kind:"import",preview:j}),onInstalled:N},o.preview?.reviewToken??"url"),o.kind==="update"&&u.jsx(R1,{preview:o.preview,busy:!!v,run:he,onUpdated:N}),o.kind==="remove"&&u.jsxs("div",{className:"skills-remove-confirm",children:[u.jsxs("p",{children:["确认从当前工作区移除 ",u.jsx("strong",{children:o.skill.name}),"?它的 SKILL.md、脚本和资源文件都会移除。"]}),u.jsx("p",{className:"config-help",children:"已保存的对话会保留。其他设备下一次运行任务时将不再使用这个工作区 Skill。"}),u.jsxs("div",{className:"skills-actions",children:[u.jsx("button",{className:"config-button",disabled:!!v,onClick:K,children:"取消"}),u.jsx("button",{className:"config-button skills-danger",disabled:!!v,onClick:()=>{he("正在移除 Skill",j=>w1(o.skill.name,o.skill.revision,j),!0).then(j=>{j&&N()})},children:"确认移除"})]})]})]}),u.jsxs("div",{className:"skills-filter",children:[u.jsxs("label",{children:[u.jsx("span",{className:"config-sr-only",children:"搜索 Skills"}),u.jsx("input",{type:"search","aria-label":"搜索 Skills",value:h,onChange:j=>g(j.target.value),placeholder:"搜索名称或用途…"})]}),u.jsxs("select",{"aria-label":"Skill 来源",value:b,onChange:j=>y(j.target.value),children:[u.jsx("option",{value:"all",children:"全部来源"}),Object.entries(vg).map(([j,O])=>u.jsx("option",{value:j,children:O},j))]}),u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v,onClick:()=>{_(""),L(j=>j+1)},children:"刷新"})]}),!c&&!k?u.jsx("p",{className:"config-help",children:"正在读取 Skills…"}):c?u.jsxs("p",{className:"skills-count",children:[ge.length===c.skills.length?`${ge.length} 个 Skill`:`显示 ${ge.length} / ${c.skills.length} 个 Skill`," · ",c.skills.filter(j=>j.enabled).length," 个已启用"]}):null,c&&!ge.length&&u.jsxs("div",{className:"skills-empty",children:[u.jsx("h2",{children:h||b!=="all"?"没有匹配的 Skills":"从一个常用流程开始"}),u.jsx("p",{children:h||b!=="all"?"调整搜索词或来源筛选。":"创建自己的 Skill,或粘贴 GitHub 地址导入完整的社区技能。"})]}),u.jsx("div",{className:"skills-list",children:ge.map(j=>u.jsxs("article",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{children:j.name}),u.jsx("span",{className:"config-badge",children:vg[j.source]}),j.origin&&u.jsx("span",{className:"config-badge",children:"GitHub"})]}),u.jsx("button",{className:"config-switch",role:"switch","aria-checked":j.enabled,"aria-label":`${j.enabled?"停用":"启用"} ${j.name}`,disabled:!!v||!!j.disabledReason,title:j.disabledReason,onClick:()=>{he("正在更新 Skill",async O=>(await g1(j.name,!j.enabled,O),{ok:!0,name:j.name,message:j.enabled?"Skill 已停用,下次任务生效。":"Skill 已启用,下次任务生效。"}),!0)},children:u.jsx("span",{})})]}),u.jsx("p",{children:j.description||"暂未填写用途描述。"}),j.origin&&u.jsxs("p",{className:"skills-source",children:[j.origin.url.replace("https://github.com/","")," · ",j.origin.ref," ·"," ",j.origin.commit.slice(0,8)]}),j.readOnlyReason&&u.jsx("p",{className:"config-help",children:j.readOnlyReason}),j.disabledReason&&u.jsx("p",{className:"config-help",children:j.disabledReason}),u.jsxs("footer",{className:"skills-actions",children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v||!!o,onClick:()=>{Z.current=document.activeElement,he("正在读取 Skill",O=>v1(j.name,O)).then(O=>{O&&W({kind:"detail",detail:O})})},children:j.editable?"查看与编辑":"查看说明"}),j.editable&&j.origin&&u.jsx("button",{className:"config-button config-button-quiet",disabled:!!v||!!o,onClick:()=>{he("正在检查来源更新",O=>C1(j.name,j.revision,O)).then(O=>{O?.changed?W({kind:"update",preview:O}):O&&R(`${j.name} 已是最新版本。`)})},children:"检查更新"}),j.removable&&u.jsx("button",{className:"config-button config-button-quiet skills-remove",disabled:!!v||!!o,onClick:()=>W({kind:"remove",skill:j}),children:"移除"})]})]},j.name))}),c&&u.jsxs("details",{className:"skills-directories",children:[u.jsx("summary",{children:"Skills 存在哪里"}),u.jsx("p",{children:"这里管理当前工作区。用户级、插件和 Panel App 的 Skills 可以查看和启停,安装内容由各自来源管理。"}),u.jsx("ul",{children:c.directories.map(j=>u.jsx("li",{children:u.jsx("code",{children:j})},j))})]})]})}function T1({detail:t,busy:i,run:l,onSaved:a,onDirtyChange:c}){const[f,o]=w.useState(t?.name??"my-skill"),[p,h]=w.useState(t?.content??Us("my-skill")),g=p!==t?.content,b=!t||t.editable;return w.useEffect(()=>{c(b&&(t?p!==t.content:f!=="my-skill"||p!==Us("my-skill")))},[p,f,t,b,c]),u.jsx("form",{className:"skills-editor",onSubmit:y=>{y.preventDefault(),l(t?"正在保存 Skill":"正在创建 Skill",v=>t?S1(t.name,p,t.revision,v):x1(f.trim(),p,v),!0).then(v=>{v&&a()})},children:u.jsxs("fieldset",{disabled:i,children:[!t&&u.jsxs("label",{children:[u.jsx("span",{children:"名称"}),u.jsx("input",{required:!0,value:f,maxLength:128,onChange:y=>{const v=y.target.value;p===Us(f)&&h(Us(v)),o(v)},"aria-describedby":"skill-name-help","aria-label":"Skill 名称"}),u.jsx("small",{id:"skill-name-help",children:"字母、数字、短横线、下划线或点;创建后名称保持不变。"}),!Cf(f)&&u.jsx("span",{className:"skills-field-error",children:"请输入有效名称。"})]}),u.jsxs("label",{children:[u.jsxs("span",{children:[b?"SKILL.md":"说明",t&&b&&g&&u.jsx("small",{className:"skills-unsaved",children:"未保存"})]}),u.jsx("textarea",{value:p,readOnly:!b,onChange:y=>h(y.target.value),rows:18,spellCheck:!1,"aria-label":"SKILL.md 内容"})]}),t?.origin&&b&&u.jsx("p",{className:"config-help",children:"手动编辑会保留 GitHub 来源;以后更新来源时,会预览将替换的完整内容。"}),b&&u.jsxs("div",{className:"skills-actions",children:[u.jsx("span",{className:"config-help",children:"支持 Markdown 和 YAML Frontmatter。变更在下一次任务中生效。"}),u.jsx("button",{className:"config-button config-button-primary",type:"submit",disabled:!p.trim()||!t&&!Cf(f)||!!t&&!g,children:t?"保存修改":"创建 Skill"})]})]})})}function z1({preview:t,busy:i,run:l,onPreview:a,onInstalled:c}){const[f,o]=w.useState(""),[p,h]=w.useState(t?.skills[0]?.pathInRepo??""),[g,b]=w.useState(t?.skills[0]?.name??"");return t?u.jsxs("form",{className:"skills-import-preview",onSubmit:y=>{y.preventDefault(),l("正在导入 Skill 与资源",v=>k1(t.reviewToken,p,g,v),!0).then(v=>{v&&c()})},children:[u.jsxs("p",{children:[u.jsx("a",{href:t.repoUrl,target:"_blank",rel:"noreferrer",children:t.repoUrl.replace("https://github.com/","")})," ",u.jsx("span",{className:"config-badge",children:t.commit.slice(0,8)})]}),t.warning&&u.jsx("p",{className:"config-help",children:t.warning}),u.jsxs("fieldset",{disabled:i,children:[u.jsx("legend",{children:"选择一个 Skill"}),u.jsx("div",{className:"skills-source-choices",children:t.skills.map(y=>u.jsxs("label",{children:[u.jsx("input",{type:"radio",name:"github-skill",checked:p===y.pathInRepo,onChange:()=>{h(y.pathInRepo),b(y.name)}}),u.jsxs("span",{children:[u.jsx("strong",{children:y.name}),u.jsx("small",{children:y.description||y.pathInRepo}),y.alreadyInstalled&&u.jsx("small",{children:"已有同名 Skill,可修改安装名称。"})]})]},y.pathInRepo))}),!!t.skills.length&&u.jsxs(u.Fragment,{children:[u.jsxs("label",{children:[u.jsx("span",{children:"安装到工作区时使用的名称"}),u.jsx("input",{required:!0,maxLength:128,value:g,onChange:y=>b(y.target.value)})]}),u.jsx("p",{className:"config-help",children:"将导入预览时的确定版本。不会执行其中的脚本。"}),u.jsx("button",{className:"config-button config-button-primary",disabled:!p||!Cf(g),type:"submit",children:"确认导入到工作区"})]})]})]}):u.jsxs("form",{className:"skills-import-url",onSubmit:y=>{y.preventDefault(),l("正在检查 GitHub 来源",v=>j1(f,v)).then(v=>{v&&a(v)})},children:[u.jsxs("label",{children:[u.jsx("span",{children:"GitHub 仓库或 Skill 目录地址"}),u.jsx("input",{type:"url",required:!0,value:f,onChange:y=>o(y.target.value),placeholder:"https://github.com/owner/repository/tree/main/skills/example",disabled:i})]}),u.jsx("p",{className:"config-help",children:"先查看可导入的技能,再确认安装。脚本和资源文件会一起保留。"}),u.jsx("button",{className:"config-button config-button-primary",disabled:i||!f.trim(),children:"预览来源"})]})}function R1({preview:t,busy:i,run:l,onUpdated:a}){return u.jsxs("div",{className:"skills-update-preview",children:[u.jsxs("p",{children:["来源版本 ",u.jsx("code",{children:t.currentCommit.slice(0,8)})," →"," ",u.jsx("code",{children:t.latestCommit.slice(0,8)})]}),u.jsx("p",{children:"确认后会用下方版本替换此 Skill 的说明、脚本和资源,包括你在其中做过的本地修改。"}),u.jsxs("details",{children:[u.jsxs("summary",{children:["查看将导入的 ",t.files?.length??0," 个文件"]}),u.jsx("ul",{children:t.files?.map(c=>u.jsxs("li",{children:[u.jsx("code",{children:c.path}),u.jsxs("span",{children:[Math.ceil(c.size/1024)," KB",c.executable?" · 可执行脚本":""]})]},c.path))})]}),u.jsxs("label",{children:[u.jsx("span",{children:"新的 SKILL.md"}),u.jsx("textarea",{value:t.content??"",readOnly:!0,rows:16,"aria-label":"更新后的 SKILL.md"})]}),u.jsx("button",{className:"config-button config-button-primary",disabled:i||!t.reviewToken,onClick:()=>{l("正在更新 Skill",c=>E1(t.reviewToken,c),!0).then(c=>{c&&a()})},children:"确认更新到预览版本"})]})}function D1(t){const i=l=>l.map((a,c)=>({id:`stored-${c}`,name:a,value:"",stored:!0,removed:!1}));return{name:t?.name??"",transport:t?.transport??"stdio",command:t?.command??"",args:"",clearArgs:!1,url:t?.url??"",env:i(t?.envKeys??[]),headers:i(t?.headerKeys??[]),envHeaders:Object.entries(t?.envHeaders??{}).map(([l,a],c)=>({id:`stored-${c}`,name:l,value:a,initialValue:a,stored:!0,removed:!1})),envVars:(t?.envVars??[]).join(`
|
|
18
|
-
`),bearerTokenEnvVar:t?.bearerTokenEnvVar??"",credentialRef:t?.credentialRef??"",enabled:t?.enabled??!0,restrictTools:t?.allowedTools!==void 0,allowedTools:(t?.allowedTools??[]).join(`
|
|
19
|
-
`),disabledTools:(t?.disabledTools??[]).join(`
|
|
20
|
-
`),reuseStoredSecrets:!1}}function Rc(t){return t.split(/\r?\n/).map(i=>i.trim()).filter(Boolean)}function M1(t,i){const l={},a=new Set;for(const c of t){if(!c.stored&&c.removed)continue;const f=c.name.trim();if(["__proto__","prototype","constructor"].includes(f))throw new Error(`${i}名称无效。`);if(!f&&!c.value&&!c.stored)continue;if(!f||!c.stored&&!c.value)throw new Error(`请完整填写${i}的名称和值,或移除空行。`);const o=i==="环境变量"?f:f.toLowerCase();if(a.has(o))throw new Error(`${i}名称不能重复。`);a.add(o),c.removed?l[f]=null:c.value&&c.value!==c.initialValue&&(l[f]=c.value)}return l}function xg(t){try{return new URL(t).origin}catch{return""}}function _1(t,i){if(!i)return!1;const l=i.envKeys.length||i.headerKeys.length||i.envVars.length||Object.keys(i.envHeaders).length||i.credentialRef||i.bearerTokenEnvVar||i.argsCount,a=t.transport!==i.transport||(t.transport==="stdio"?t.command.trim()!==i.command||!!t.args.trim()||t.clearArgs:xg(t.url)!==xg(i.url??""));return!!l&&a}function O1(t,i){const l={name:t.name.trim()};(!i||t.transport!==i.transport)&&(l.transport=t.transport),(!i||t.enabled!==i.enabled)&&(l.enabled=t.enabled),t.transport==="stdio"?((!i||t.command.trim()!==i.command)&&(l.command=t.command.trim()),t.clearArgs?l.args=[]:t.args.trim()&&(l.args=t.args.split(/\r?\n/).filter(o=>o.length>0))):(!i||t.url.trim()!==i.url)&&(l.url=t.url.trim());for(const[o,p]of[["env","环境变量"],["headers","请求头"],["envHeaders","环境变量请求头"]]){const h=M1(t[o],p);Object.keys(h).length&&(l[o]=h)}const a=Rc(t.envVars);(!i||JSON.stringify(a)!==JSON.stringify(i.envVars))&&(l.envVars=a);for(const o of["bearerTokenEnvVar","credentialRef"])(!i||t[o].trim()!==(i[o]??""))&&(l[o]=t[o].trim()||null);const c=t.restrictTools?Rc(t.allowedTools):void 0;(!i||JSON.stringify(c)!==JSON.stringify(i.allowedTools))&&(l.allowedTools=c??null);const f=Rc(t.disabledTools);return(!i||JSON.stringify(f)!==JSON.stringify(i.disabledTools))&&(l.disabledTools=f),t.reuseStoredSecrets&&(l.reuseStoredSecrets=!0),l}function hb(t){if(!t||typeof t.workspacePath!="string"||!Array.isArray(t.servers)||!Array.isArray(t.removed))throw new Error("服务端返回了无效的 MCP 配置,请刷新重试。");return t}const ul=(t,i="")=>`/api/v1/mcp/servers/${encodeURIComponent(t)}${i}`;async function L1(t){return hb(await Ue("/api/v1/mcp",{signal:t}))}async function ao(t,i,l,a){return hb(await Ue(t,{method:i,headers:{"Content-Type":"application/json"},...l===void 0?{}:{body:JSON.stringify(l)},signal:a}))}function B1(t,i,l){return ao(i?ul(i.name):"/api/v1/mcp/servers",i?"PUT":"POST",O1(t,i),l)}function U1(t,i,l){return ao(ul(t,"/enabled"),"PUT",{enabled:i},l)}function q1(t,i){return ao(ul(t),"DELETE",void 0,i)}function Sg(t,i){return ao(ul(t,"/inherit"),"POST",{},i)}async function I1(t,i){const l=await Ue(ul(t,"/probe"),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",signal:i});if(l.name!==t||!["ok","error","cancelled"].includes(l.status))throw new Error("服务端返回了无效的连接测试结果。");return l}function wg(t,i,l){return Ue(yt(ul(t,"/cancel-probe"),i,l),{method:"POST",headers:{"Content-Type":"application/json"},body:"{}",keepalive:!0})}const H1={local:"工作区本地",project:"工作区配置",user:"用户级",managed:"启动配置",plugin:"插件提供"};function V1({onAuthLost:t,onConfigurationChange:i,configurationVersion:l=0,onDirtyChange:a}){const[c,f]=w.useState(null),[o,p]=w.useState(!0),[h,g]=w.useState(!1),[b,y]=w.useState(!1),[v,x]=w.useState(""),[k,_]=w.useState(""),[D,R]=w.useState(null),[z,L]=w.useState(null),[G,se]=w.useState(""),[T,V]=w.useState({}),[X,q]=w.useState(null),[E,U]=w.useState(0),H=w.useRef({onAuthLost:t,onConfigurationChange:i,onDirtyChange:a});H.current={onAuthLost:t,onConfigurationChange:i,onDirtyChange:a};const Z=w.useRef(!1),ee=w.useRef(null),W=w.useRef(null),N=w.useRef(null),K=w.useRef(0),he=w.useRef(!1),ge=w.useRef(l);w.useEffect(()=>{H.current.onDirtyChange?.(b||h)},[b,h]);const j=w.useCallback(F=>{F instanceof Xe&&F.status===401?H.current.onAuthLost():x(F instanceof Error?F.message:"MCP 操作失败,请重试。")},[]);w.useEffect(()=>(Z.current=!0,()=>{Z.current=!1,H.current.onDirtyChange?.(!1),W.current?.abort();const F=N.current;F&&(F.controller.abort(),wg(F.name,F.workspace,F.projectId).catch(()=>{}))}),[]),w.useEffect(()=>{ge.current!==l&&(ge.current=l,W.current?he.current=!0:U(F=>F+1))},[l]),w.useEffect(()=>{const F=new AbortController;ee.current=F;const be=Date.now(),Ee=++K.current;return p(!0),x(""),L1(F.signal).then(Re=>{!F.signal.aborted&&Ee===K.current&&(f(Re),V(Qe=>Object.fromEntries(Object.entries(Qe).filter(([,Ve])=>Date.parse(Ve.checkedAt)>=be))))}).catch(Re=>{!F.signal.aborted&&Ee===K.current&&j(Re)}).finally(()=>{!F.signal.aborted&&Ee===K.current&&p(!1)}),()=>F.abort()},[E,j]);const O=async(F,be="MCP 设置已保存,任务进程会加载新的配置。")=>{if(W.current||N.current)return!1;ee.current?.abort();const Ee=++K.current,Re=new AbortController;W.current=Re,g(!0),p(!1),x(""),_("");try{const Qe=await F(Re.signal);return!Z.current||Re.signal.aborted||Ee!==K.current?!1:(f(Qe),V({}),_(be),H.current.onConfigurationChange?.(),!0)}catch(Qe){return Z.current&&!Re.signal.aborted&&j(Qe),!1}finally{W.current===Re&&(W.current=null),Z.current&&!Re.signal.aborted&&(g(!1),he.current&&(he.current=!1,U(Qe=>Qe+1)))}},J=async F=>{if(N.current||W.current)return;const be=new AbortController;N.current={name:F,controller:be,workspace:Zs()??"",projectId:ma()},q(F),x(""),_(""),V(Ee=>{const Re={...Ee};return delete Re[F],Re});try{const Ee=await I1(F,be.signal);Z.current&&!be.signal.aborted&&V(Re=>({...Re,[F]:Ee}))}catch(Ee){Z.current&&!be.signal.aborted&&j(Ee)}finally{N.current?.controller===be&&(N.current=null),Z.current&&q(null)}},A=async()=>{const F=N.current;if(F)try{await wg(F.name,F.workspace,F.projectId)}catch(be){Z.current&&j(be)}finally{F.controller.abort(),N.current===F&&(N.current=null),Z.current&&(q(null),V(be=>({...be,[F.name]:{name:F.name,status:"cancelled",checkedAt:new Date().toISOString(),durationMs:0,error:{code:"cancelled",message:"测试已取消。"}}})))}},ae=h||o||X!==null,pe=G.trim().toLocaleLowerCase(),te=[...c?.servers??[]];D?.kind==="edit"&&!te.some(F=>F.name===D.name)&&te.push(D.original);const oe=te.filter(F=>!pe||F.name.toLocaleLowerCase().includes(pe)||D?.kind==="edit"&&D.name===F.name),we=D?.kind==="edit"?te.find(F=>F.name===D.name):void 0;return u.jsxs("div",{className:"hub-mcp",children:[u.jsxs("div",{className:"config-section-heading hub-mcp-toolbar",children:[u.jsxs("label",{className:"config-search",children:[u.jsx("span",{"aria-hidden":"true",children:"⌕"}),u.jsx("input",{type:"search",value:G,onChange:F=>se(F.target.value),placeholder:"搜索 MCP 服务…","aria-label":"搜索 MCP 服务"})]}),u.jsxs("div",{className:"hub-mcp-toolbar-actions",children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:ae,onClick:()=>U(F=>F+1),children:"刷新 MCP"}),u.jsx("button",{className:"config-button",disabled:ae||D!==null,onClick:()=>R({kind:"new"}),children:"+ 添加服务"})]})]}),v&&u.jsx("p",{className:"config-message config-error",role:"alert",children:v}),k&&u.jsx("p",{className:"config-message config-success",role:"status",children:k}),h&&u.jsx("p",{className:"config-help",role:"status",children:"正在保存 MCP 配置…"}),o&&!c&&u.jsx("p",{className:"config-help",role:"status",children:"正在读取 MCP 配置…"}),D?.kind==="new"&&u.jsxs("div",{className:"config-card hub-mcp-editor-card",children:[u.jsx("h2",{children:"添加 MCP 服务"}),u.jsx(jg,{disabled:ae,save:O,onDone:()=>R(null),onProbe:F=>{J(F)},onDirtyChange:y})]}),!oe.length&&c&&D?.kind!=="new"&&u.jsxs("div",{className:"config-empty",children:[u.jsx("span",{"aria-hidden":"true",children:"⌘"}),u.jsx("h3",{children:pe?"没有匹配的服务":"连接你的工具与数据"}),u.jsx("p",{children:pe?"试试其他服务名称。":"添加运行 CodeShell 的设备上的命令,或连接提供 MCP 接口的 HTTP 服务。"})]}),u.jsx("div",{className:"hub-mcp-list",children:oe.map(F=>u.jsxs("article",{className:"config-card hub-mcp-card",children:[u.jsxs("div",{className:"hub-mcp-card-head",children:[u.jsx("span",{className:"config-row-icon","aria-hidden":"true",children:"⌘"}),u.jsxs("div",{className:"config-row-copy",children:[u.jsx("strong",{children:F.name}),u.jsxs("span",{children:[F.transport==="stdio"?"本地命令":F.transport==="inprocess"?"内置工具":"HTTP 服务"," ","· ",H1[F.scope]]})]}),u.jsx("button",{className:"config-switch",type:"button",role:"switch","aria-checked":F.enabled,"aria-label":`${F.enabled?"停用":"启用"} MCP ${F.name}`,disabled:ae||F.pluginDisabled,onClick:()=>{O(be=>U1(F.name,!F.enabled,be))},children:u.jsx("span",{})})]}),D?.kind==="edit"&&D.name===F.name&&we?u.jsx(jg,{server:we,disabled:ae,save:O,onDone:()=>R(null),onProbe:be=>{J(be)},onDirtyChange:y},F.name):u.jsxs(u.Fragment,{children:[u.jsxs("p",{className:"hub-mcp-endpoint",children:[u.jsx("code",{children:F.transport==="stdio"?F.command:F.url||"由任务进程提供"}),F.argsCount>0&&u.jsxs("span",{children:[F.argsCount," 个已保存参数"]})]}),u.jsxs("div",{className:"hub-mcp-metadata",children:[u.jsx("span",{className:`config-badge${F.enabled?" config-badge-accent":""}`,children:F.enabled?"配置启用":"配置停用"}),F.envKeys.length>0&&u.jsxs("span",{children:[F.envKeys.length," 个环境变量"]}),(F.headerKeys.length>0||F.credentialRef||F.bearerTokenEnvVar||Object.keys(F.envHeaders).length>0)&&u.jsx("span",{children:"已配置认证"}),F.hasLocalOverride&&u.jsx("span",{children:"本地覆盖"})]}),F.source==="plugin"&&u.jsx("p",{className:"config-help",children:F.pluginDisabled?"所属插件已停用。启用插件后,才能启用或测试这个服务。":"连接命令与地址由插件提供,可在此启停或测试。"}),u.jsxs("div",{className:"hub-mcp-card-actions",children:[X===F.name?u.jsx("button",{className:"config-button",onClick:()=>{A()},children:"取消测试"}):u.jsx("button",{className:"config-button",disabled:ae||F.pluginDisabled||F.transport==="inprocess",onClick:()=>{J(F.name)},children:"测试连接"}),F.editable&&u.jsx("button",{className:"config-button config-button-quiet",disabled:ae||D!==null,onClick:()=>{L(null),R({kind:"edit",name:F.name,original:F})},children:"编辑"}),F.hasLocalOverride&&u.jsx("button",{className:"config-button config-button-quiet",disabled:ae,onClick:()=>{O(be=>Sg(F.name,be),"已移除本地覆盖,恢复继承配置。")},children:"恢复继承"}),F.deletable&&u.jsx("button",{className:"config-button config-button-quiet hub-mcp-remove",disabled:ae||D!==null,onClick:()=>L(F.name),children:"移除"})]}),z===F.name&&u.jsxs("div",{className:"hub-mcp-delete",role:"alert",children:[u.jsxs("span",{children:["从当前工作区移除 ",F.name,"?其他工作区的配置不受影响。"]}),u.jsxs("div",{children:[u.jsx("button",{className:"config-button config-button-quiet",disabled:ae,onClick:()=>L(null),children:"取消"}),u.jsx("button",{className:"config-button hub-mcp-remove",disabled:ae,onClick:async()=>{await O(be=>q1(F.name,be),"已从当前工作区移除服务。")&&L(null)},children:"确认移除"})]})]}),X===F.name&&u.jsx("p",{className:"hub-mcp-probing",role:"status",children:"正在建立测试连接并读取工具列表…"}),T[F.name]&&u.jsx(Y1,{result:T[F.name]})]})]},F.name))}),!!c?.removed.length&&u.jsxs("details",{className:"hub-mcp-removed",children:[u.jsxs("summary",{children:["已在当前工作区移除(",c.removed.length,")"]}),c.removed.map(F=>u.jsxs("div",{className:"hub-mcp-removed-row",children:[u.jsx("span",{children:F.name}),u.jsx("button",{className:"config-button config-button-quiet",disabled:ae,onClick:()=>{O(be=>Sg(F.name,be),"已恢复继承的 MCP 配置。")},children:"恢复继承"})]},F.name))]}),u.jsx("p",{className:"config-help hub-mcp-explanation",children:"连接使用运行 CodeShell 的设备上的网络、环境和凭据。测试只建立一次短连接并读取工具列表,完成后关闭;不会调用工具或改变启用状态。"})]})}function jg({server:t,disabled:i,save:l,onDone:a,onProbe:c,onDirtyChange:f}){const o=w.useRef(t).current,[p,h]=w.useState(()=>D1(o)),g=w.useRef(JSON.stringify(p)).current,b=JSON.stringify(p)!==g;w.useEffect(()=>{f(b)},[b,f]),w.useEffect(()=>()=>f(!1),[f]);const[y,v]=w.useState(""),x=(D,R)=>h(z=>({...z,[D]:R})),k=_1(p,o),_=p.transport==="stdio";return u.jsx("form",{className:"hub-mcp-editor",onSubmit:async D=>{D.preventDefault(),v("");const R=D.nativeEvent.submitter?.getAttribute("data-probe")==="true";try{await l(z=>B1(p,o,z))&&(a(),R&&c(p.name.trim()))}catch(z){v(z instanceof Error?z.message:"请检查填写内容。")}},children:u.jsxs("fieldset",{disabled:i,children:[u.jsx("legend",{className:"config-sr-only",children:o?`编辑 MCP ${o.name}`:"新 MCP 服务"}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"服务名称"}),u.jsx("input",{required:!0,readOnly:!!o,maxLength:128,pattern:"[A-Za-z0-9][A-Za-z0-9._:\\-]*",value:p.name,onChange:D=>x("name",D.target.value),placeholder:"例如 workspace-tools"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"连接方式"}),u.jsxs("select",{"aria-label":"连接方式",value:p.transport,onChange:D=>x("transport",D.target.value),children:[u.jsx("option",{value:"stdio",children:"本地命令(stdio)"}),u.jsx("option",{value:"streamable-http",children:"HTTP(Streamable HTTP)"}),o?.transport==="sse"&&u.jsx("option",{value:"sse",children:"HTTP(已有 SSE 配置)"})]})]}),_?u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"启动命令"}),u.jsx("input",{required:!0,"aria-label":"启动命令",value:p.command,onChange:D=>x("command",D.target.value),placeholder:"例如 node、uvx 或可执行文件路径"}),u.jsx("small",{children:"在当前工作区执行。命令与参数分别填写。"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"命令参数"}),u.jsx("textarea",{"aria-label":"命令参数",rows:3,disabled:p.clearArgs,value:p.args,onChange:D=>x("args",D.target.value),placeholder:o?.argsCount?`已有 ${o.argsCount} 个参数,留空保留。填写后将完整替换。`:"每行一个参数,不需要额外添加引号",autoComplete:"off",spellCheck:!1}),u.jsx("small",{children:"参数可能含密钥,因此不会读回已有值。每一行会作为一个完整参数。"})]}),!!o?.argsCount&&u.jsxs("label",{className:"hub-mcp-check config-full-width",children:[u.jsx("input",{type:"checkbox",checked:p.clearArgs,onChange:D=>x("clearArgs",D.target.checked)}),u.jsx("span",{children:"清空已保存的所有参数"})]})]}):u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"MCP 接口地址"}),u.jsx("input",{type:"url","aria-label":"MCP 接口地址",required:!0,value:p.url,onChange:D=>x("url",D.target.value),placeholder:"https://example.com/mcp"}),o?.urlHasHiddenParts&&u.jsx("small",{children:"已有地址的查询参数已隐藏;不修改地址时会保留。"})]})]}),_?u.jsx(Dc,{title:"环境变量",rows:p.env,onChange:D=>x("env",D)}):u.jsx(Dc,{title:"请求头",rows:p.headers,onChange:D=>x("headers",D)}),u.jsxs("details",{className:"hub-mcp-advanced",children:[u.jsx("summary",{children:"高级配置"}),u.jsx("div",{className:"config-form-grid",children:_?u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"转发运行环境变量"}),u.jsx("textarea",{"aria-label":"转发运行环境变量",rows:2,value:p.envVars,onChange:D=>x("envVars",D.target.value),placeholder:"每行一个环境变量名称,例如 GITHUB_TOKEN"}),u.jsx("small",{children:"只填写名称,实际值在连接时从CodeShell 的启动环境读取。"})]}):u.jsxs(u.Fragment,{children:[u.jsxs("label",{children:[u.jsx("span",{children:"Bearer Token 环境变量"}),u.jsx("input",{"aria-label":"Bearer Token 环境变量",value:p.bearerTokenEnvVar,onChange:D=>x("bearerTokenEnvVar",D.target.value),placeholder:"例如 MCP_ACCESS_TOKEN",autoComplete:"off"}),u.jsx("small",{children:"填写运行环境中的变量名称。"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"已存储的凭据 ID"}),u.jsx("input",{"aria-label":"已存储的凭据 ID",value:p.credentialRef,onChange:D=>x("credentialRef",D.target.value),placeholder:"可选",autoComplete:"off"}),u.jsx("small",{children:"引用已有凭据;优先于 Bearer 环境变量。"})]})]})}),!_&&u.jsx(Dc,{title:"环境变量请求头",rows:p.envHeaders,onChange:D=>x("envHeaders",D),visibleValues:!0}),u.jsxs("label",{className:"hub-mcp-check",children:[u.jsx("input",{type:"checkbox",checked:p.restrictTools,onChange:D=>x("restrictTools",D.target.checked)}),u.jsx("span",{children:"只允许指定工具"})]}),u.jsxs("div",{className:"config-form-grid",children:[p.restrictTools&&u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"允许的工具名称"}),u.jsx("textarea",{rows:2,value:p.allowedTools,onChange:D=>x("allowedTools",D.target.value),placeholder:"每行一个精确工具名称;留空则不开放任何工具"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"停用的工具名称"}),u.jsx("textarea",{rows:2,value:p.disabledTools,onChange:D=>x("disabledTools",D.target.value),placeholder:"每行一个精确工具名称,可留空"})]})]})]}),u.jsxs("label",{className:"hub-mcp-check",children:[u.jsx("input",{type:"checkbox",checked:p.enabled,onChange:D=>x("enabled",D.target.checked)}),u.jsx("span",{children:"启用服务,让任务可以使用这些工具"})]}),k&&u.jsxs("label",{className:"hub-mcp-check hub-mcp-reuse",children:[u.jsx("input",{type:"checkbox",required:!0,checked:p.reuseStoredSecrets,onChange:D=>x("reuseStoredSecrets",D.target.checked)}),u.jsx("span",{children:"允许新的启动方式或服务地址使用已保存的参数、环境变量和认证配置。"})]}),y&&u.jsx("p",{className:"config-error config-message",role:"alert",children:y}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button config-button-quiet",onClick:a,children:"取消"}),u.jsx("button",{type:"submit","data-probe":"true",className:"config-button",children:"保存并测试"}),u.jsx("button",{type:"submit",className:"config-button config-button-primary",children:"保存配置"})]})]})})}function Dc({title:t,rows:i,onChange:l,visibleValues:a=!1}){const c=(f,o)=>l(i.map(p=>p.id===f?{...p,...o}:p));return u.jsxs("div",{className:"hub-mcp-keys",children:[u.jsxs("div",{className:"hub-mcp-key-heading",children:[u.jsx("h3",{children:t}),u.jsxs("button",{className:"config-text-button",type:"button",onClick:()=>l([...i,{id:va(),name:"",value:"",stored:!1,removed:!1}]),children:["+ 添加",t]})]}),!i.length&&u.jsx("p",{className:"config-help",children:a?"可按请求头名称引用运行环境变量。":"无需此项时可以留空。"}),i.map(f=>u.jsxs("div",{className:`hub-mcp-key-row${f.removed?" hub-mcp-key-removed":""}`,children:[u.jsxs("label",{children:[u.jsxs("span",{className:"config-sr-only",children:[t,"名称"]}),u.jsx("input",{"aria-label":`${t}名称`,value:f.name,readOnly:f.stored,disabled:f.removed,onChange:o=>c(f.id,{name:o.target.value}),placeholder:t==="环境变量"?"例如 API_KEY":"例如 Authorization",autoComplete:"off"})]}),u.jsxs("label",{children:[u.jsxs("span",{className:"config-sr-only",children:[t,"值"]}),u.jsx("input",{"aria-label":`${t} ${f.name||"新条目"} 的值`,type:a?"text":"password",value:f.value,disabled:f.removed,onChange:o=>c(f.id,{value:o.target.value}),placeholder:f.removed?"保存时移除":a?"运行环境变量名称":f.stored?"已配置 · 留空保留":"输入值",autoComplete:a?"off":"new-password",spellCheck:!1})]}),u.jsx("button",{className:"config-button config-button-quiet",type:"button",onClick:()=>f.stored?c(f.id,{removed:!f.removed}):l(i.filter(o=>o.id!==f.id)),children:f.removed?"撤销移除":"移除"})]},f.id)),!!i.length&&!a&&u.jsx("p",{className:"config-help",children:"已有值保留在运行 CodeShell 的设备上;留空保留,填写新值替换,点击“移除”后保存才能删除。"})]})}function Y1({result:t}){return u.jsxs("div",{className:`hub-mcp-probe-result hub-mcp-probe-${t.status}`,role:"status",children:[u.jsxs("div",{className:"hub-mcp-probe-summary",children:[u.jsx("strong",{children:t.status==="ok"?"测试连接成功":t.status==="cancelled"?"测试已取消":"连接测试失败"}),u.jsxs("span",{children:[new Date(t.checkedAt).toLocaleTimeString()," ·"," ",t.durationMs<1e3?`${t.durationMs} ms`:`${(t.durationMs/1e3).toFixed(1)} 秒`]})]}),t.error&&u.jsx("p",{children:t.error.message}),t.status==="ok"&&u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["发现 ",t.toolCount??0," 个工具",t.truncated?"(列表已截取)":"","。测试连接现已关闭。"]}),!!t.tools?.length&&u.jsxs("details",{children:[u.jsx("summary",{children:"查看工具列表"}),u.jsx("ul",{children:t.tools.map((i,l)=>u.jsxs("li",{children:[u.jsxs("div",{children:[u.jsx("code",{children:i.name}),!i.allowed&&u.jsx("span",{className:"config-badge",children:"被工具策略停用"})]}),i.description&&u.jsx("p",{children:i.description})]},`${i.name}-${l}`))})]})]})]})}const G1={overview:{title:"设置",description:"管理当前工作区的模型、Skills 和工具连接。"},models:{title:"模型与连接",description:"选择默认模型,管理工作区使用的服务商连接与凭据。"},skills:{title:"Skills",description:"让 CodeShell 按照你熟悉的工作方式完成任务。"},mcp:{title:"MCP 工具",description:"管理工具连接,测试连接并查看可用工具。"}};function F1(t){return t.section==="skills"?u.jsx(A1,{onAuthLost:t.onAuthLost,onDirtyChange:t.onDirtyChange,onChanged:t.onConfigurationChange,configurationVersion:t.configurationVersion}):u.jsx(Q1,{...t})}function Q1({host:t="hub",section:i,onSectionChange:l,onAuthLost:a,onDirtyChange:c,onConfigurationChange:f,configurationVersion:o=0}){const[p,h]=w.useState(null),[g,b]=w.useState(!0),[y,v]=w.useState(""),[x,k]=w.useState(""),[_,D]=w.useState(null),[R,z]=w.useState(0),L=w.useRef({onAuthLost:a,onConfigurationChange:f});L.current={onAuthLost:a,onConfigurationChange:f};const G=w.useRef(!1),se=w.useRef(0),T=w.useRef(null),V=w.useRef(null),X=w.useRef(!1),q=w.useRef(o),E=w.useCallback(Z=>{Z instanceof Xe&&Z.status===401?L.current.onAuthLost():v(db(Z))},[]);w.useEffect(()=>{o!==q.current&&(q.current=o,V.current?X.current=!0:z(Z=>Z+1))},[o]),w.useEffect(()=>(G.current=!0,()=>{G.current=!1,V.current?.abort()}),[]),w.useEffect(()=>{const Z=new AbortController;T.current=Z;const ee=++se.current;return b(!0),v(""),fb(Z.signal).then(W=>{!Z.signal.aborted&&ee===se.current&&h(W)}).catch(W=>{!Z.signal.aborted&&ee===se.current&&E(W)}).finally(()=>{!Z.signal.aborted&&ee===se.current&&b(!1)}),()=>Z.abort()},[R,E]);const U=async(Z,ee)=>{if(V.current)return!1;T.current?.abort();const W=++se.current,N=new AbortController;V.current=N,b(!1),D(Z),v(""),k("");try{const K=await ee(N.signal);return!G.current||N.signal.aborted||W!==se.current?!1:(h(K),k(K.restartRequired?"设置已保存,重启服务后生效。":"设置已保存,下次运行任务时生效。"),L.current.onConfigurationChange?.(),!0)}catch(K){return K instanceof Xe&&K.status===409&&(X.current=!0),G.current&&!N.signal.aborted&&E(K),!1}finally{V.current===N&&(V.current=null),G.current&&!N.signal.aborted&&(D(null),X.current&&(X.current=!1,z(K=>K+1)))}},H=G1[i];return u.jsxs("section",{className:"hub-settings","aria-labelledby":"hub-settings-title",children:[u.jsxs("div",{className:"hub-settings-heading",children:[u.jsxs("div",{children:[u.jsx("span",{className:"hub-settings-eyebrow",children:t==="desktop"?"桌面工作区":"服务端工作区"}),u.jsx("h1",{id:"hub-settings-title",children:H.title}),u.jsx("p",{children:H.description})]}),u.jsx("button",{className:"config-button config-button-quiet",disabled:g||_!==null,onClick:()=>{k(""),z(Z=>Z+1)},children:g?"读取中…":"刷新"})]}),y&&u.jsx("div",{className:"config-message config-error",role:"alert",children:y}),x&&u.jsx("div",{className:"config-message config-success",role:"status",children:x}),_&&u.jsxs("p",{className:"config-loading",role:"status",children:["正在保存",_,"…"]}),!p&&g?u.jsx("p",{className:"config-loading",role:"status",children:"正在读取工作区设置…"}):null,p&&u.jsxs(u.Fragment,{children:[i==="overview"&&u.jsx(X1,{host:t,configuration:p,onSectionChange:l}),i==="models"&&u.jsx(K1,{configuration:p,disabled:_!==null||g,saving:_!==null,save:U,onDirtyChange:c,onAuthLost:a}),i==="mcp"&&u.jsx(V1,{onAuthLost:a,onDirtyChange:c,onConfigurationChange:f,configurationVersion:o}),u.jsx("p",{className:"config-scope-note",children:"配置作用于当前工作区,所有连接到这里的设备共用。"})]})]})}function X1({host:t,configuration:i,onSectionChange:l}){const a=i.connections.find(o=>o.id===i.defaults.text),c=i.skills.filter(o=>o.enabled).length,f=[{section:"models",title:"模型与连接",summary:a?`${a.id} · ${a.model}`:"尚未设置默认模型",icon:"◈"},{section:"skills",title:"Skills",summary:`${i.skills.length} 个可用 · ${c} 个已启用`,icon:"✧"},{section:"mcp",title:"MCP 工具",summary:`${i.mcpServers.length} 个已配置的工具服务`,icon:"⌘"}];return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"config-workspace-card",children:[u.jsx("span",{className:"config-workspace-icon","aria-hidden":"true",children:"▱"}),u.jsxs("div",{children:[u.jsx("strong",{children:"当前工作区"}),u.jsx("code",{children:i.workspace.path}),u.jsx("p",{children:t==="desktop"?"对话、文件操作和工具都由已连接的桌面端执行。":"对话、文件操作和工具都在服务端运行。"})]}),u.jsx("span",{className:"config-badge",children:t==="desktop"?"桌面工作区":"服务端工作区"})]}),u.jsx("h2",{className:"config-section-title",children:"工作区配置"}),u.jsx("div",{className:"config-card config-overview-list",children:f.map(o=>{const p=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"config-row-icon","aria-hidden":"true",children:o.icon}),u.jsxs("span",{className:"config-row-copy",children:[u.jsx("strong",{children:o.title}),u.jsx("span",{children:o.summary})]}),l&&u.jsx("span",{className:"config-chevron","aria-hidden":"true",children:"›"})]});return l?u.jsx("button",{className:"config-overview-row",onClick:()=>l(o.section),children:p},o.section):u.jsx("div",{className:"config-overview-row",children:p},o.section)})}),u.jsxs("div",{className:"config-explanation",children:[u.jsx("h2",{children:"工作区与执行位置"}),u.jsx("p",{children:t==="desktop"?"这里直接使用桌面端的任务、模型、Skills 和工具连接。修改配置后,桌面窗口和已配对的网页共同使用。":"这里使用服务端的任务、模型、Skills 和工具连接。修改配置后,连接到这个服务端的网页共同使用。"}),u.jsx("p",{children:t==="desktop"?"切换项目会切换对应的文件、历史和工作区设置;无需复制桌面配置。":"独立部署使用自己的运行环境。部署到另一台机器时,需要迁移配置和数据,或在这里重新设置。"})]})]})}function K1({configuration:t,disabled:i,saving:l,save:a,onDirtyChange:c,onAuthLost:f}){const[o,p]=w.useState(null),[h,g]=w.useState(null),[b,y]=w.useState(""),[v,x]=w.useState(!1),[k,_]=w.useState(!1),[D,R]=w.useState(null),[z,L]=w.useState({}),G=w.useRef(null),se=t.connections.filter(E=>E.tag==="text"),T=t.connections.length-se.length,V=i||!!D;w.useEffect(()=>{h&&!t.connections.some(E=>E.id===h.id)&&g(null)},[t.connections,h]),w.useEffect(()=>()=>G.current?.abort(),[]);const X=w.useRef(new Map);w.useEffect(()=>{const E=new Map(t.connections.map(H=>[H.id,H.revision??JSON.stringify(H)])),U=new Set([...X.current].filter(([H,Z])=>E.get(H)!==Z).map(([H])=>H));X.current=E,D&&U.has(D)&&G.current?.abort(),U.size&&L(H=>Object.fromEntries(Object.entries(H).filter(([Z])=>!U.has(Z))))},[t,D]),w.useEffect(()=>(c?.(v||k||l||!!D),()=>c?.(!1)),[v,k,l,D,c]);const q=async E=>{if(G.current)return;const U=new AbortController;G.current=U,R(E.id),L(H=>({...H,[E.id]:"正在发送一条简短测试请求…"}));try{const H=await b1(E.id,U.signal);U.signal.aborted||L(Z=>({...Z,[E.id]:H}))}catch(H){U.signal.aborted||(H instanceof Xe&&H.status===401?f():L(Z=>({...Z,[E.id]:db(H)})))}finally{G.current===U&&(G.current=null,R(null))}};return u.jsxs(u.Fragment,{children:[u.jsx($1,{configuration:t,disabled:V,save:a,onDirtyChange:_}),u.jsxs("div",{className:"config-section-heading",children:[u.jsxs("h2",{children:["文字模型连接 ",u.jsx("span",{className:"config-count",children:se.length})]}),u.jsxs("button",{className:"config-button",disabled:V||o!==null||h!==null||!t.catalog.length,onClick:()=>p("__new__"),children:[u.jsx("span",{"aria-hidden":"true",children:"+"})," 添加连接"]})]}),o!==null&&u.jsxs("div",{className:"config-card config-editor-card",children:[u.jsx("h3",{children:o==="__new__"?"添加模型连接":`编辑 ${o.id}`}),u.jsx(Z1,{connection:o==="__new__"?void 0:o,configuration:t,disabled:V,save:a,onDone:()=>p(null),onDirtyChange:x},o==="__new__"?"new":o.id)]}),!se.length&&o!=="__new__"&&u.jsx(P1,{title:"还没有文字模型连接",description:"添加服务商地址、模型名称和 API Key,再选择一个默认模型。"}),u.jsx("div",{className:"config-connection-list",children:se.map(E=>{const U=t.catalog.find(N=>N.id===E.catalogId),H=h?.id===E.id,Z=H&&h?.revision!==E.revision,ee=t.defaults.text===E.id&&se.length>1,W=z[E.id];return u.jsxs("article",{className:"config-card config-connection-card",children:[u.jsxs("div",{className:"config-connection-head",children:[u.jsx("span",{className:"config-model-icon","aria-hidden":"true",children:"◈"}),u.jsxs("div",{className:"config-row-copy",children:[u.jsx("strong",{children:E.id}),u.jsx("span",{children:U?.displayName??E.catalogId})]}),t.defaults.text===E.id&&u.jsx("span",{className:"config-badge config-badge-accent",children:"默认"}),u.jsx("button",{className:"config-button config-button-quiet",disabled:V||o!==null||h!==null,onClick:()=>p(E),children:"编辑"})]}),u.jsxs("dl",{className:"config-connection-facts",children:[u.jsxs("div",{children:[u.jsx("dt",{children:"模型"}),u.jsx("dd",{children:E.model||"未填写"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"服务地址"}),u.jsx("dd",{children:E.baseUrl||U?.defaultBaseUrl||"服务商默认地址"})]}),u.jsxs("div",{children:[u.jsx("dt",{children:"API Key"}),u.jsx("dd",{children:E.hasApiKey?"•••••••• · 已配置":E.needsKey?"未配置":"无需 API Key"})]})]}),u.jsxs("div",{className:"config-model-actions",children:[D===E.id?u.jsx("button",{className:"config-button",onClick:()=>{G.current?.abort(),L(N=>({...N,[E.id]:"已取消连接测试。"}))},children:"取消测试"}):u.jsx("button",{className:"config-button",disabled:V||o!==null||h!==null,onClick:()=>{q(E)},children:"测试连接"}),u.jsx("span",{className:"config-help",children:"发送一条简短请求,服务商可能计费。"}),u.jsx("button",{className:"config-button config-button-quiet config-remove-connection",disabled:V||o!==null||h!==null,onClick:()=>{g(E),y("")},children:"删除"})]}),W&&u.jsxs("div",{className:`config-probe-result ${typeof W!="string"&&W.ok?"is-success":""}`,role:"status",children:[u.jsx("span",{children:typeof W=="string"?W:W.message}),typeof W!="string"&&u.jsxs("small",{children:[Math.max(.01,W.latencyMs/1e3).toFixed(2)," 秒 ·"," ",new Date(W.checkedAt).toLocaleTimeString()]})]}),H&&u.jsxs("div",{className:"config-remove-confirm",children:[u.jsxs("h3",{children:["删除连接 ",E.id,"?"]}),u.jsx("p",{children:"连接会从当前工作区移除,已有对话记录会保留。"}),Z&&u.jsx("p",{role:"alert",children:"连接已被其他设备更新,请取消后重新检查再删除。"}),se.length===1&&u.jsx("p",{children:"这是最后一个文字模型连接。删除后需重新添加连接才能继续对话。"}),ee&&u.jsxs("label",{children:[u.jsx("span",{children:"替代默认模型"}),u.jsxs("select",{"aria-label":"替代默认模型",value:b,onChange:N=>y(N.target.value),disabled:V,children:[u.jsx("option",{value:"",children:"请选择其他连接"}),se.filter(N=>N.id!==E.id).map(N=>u.jsxs("option",{value:N.id,children:[N.id," · ",N.model]},N.id))]})]}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{className:"config-button",disabled:V,onClick:()=>g(null),children:"取消删除"}),u.jsx("button",{className:"config-button config-button-danger",disabled:V||Z||ee&&!b,onClick:()=>{a("删除连接",N=>y1(E.id,b||void 0,N,h?.revision)).then(N=>{N&&g(null)})},children:"确认删除连接"})]})]})]},E.id)})}),T>0&&u.jsxs("p",{className:"config-help",children:["另有 ",T," 个其他类型的模型连接,保留在工作区配置中。目前此处提供文字模型编辑。"]})]})}function $1({configuration:t,disabled:i,save:l,onDirtyChange:a}){const[c,f]=w.useState(t.defaults.text??""),[o,p]=w.useState(t.defaults.auxText??""),h=w.useRef(t.defaults);w.useEffect(()=>{const y=h.current;h.current=t.defaults,f(v=>v===(y.text??"")?t.defaults.text??"":v),p(v=>v===(y.auxText??"")?t.defaults.auxText??"":v)},[t.defaults]);const g=t.connections.filter(y=>y.tag==="text"),b=c!==(t.defaults.text??"")||o!==(t.defaults.auxText??"");return w.useEffect(()=>(a(b),()=>a(!1)),[b,a]),u.jsx("form",{className:"config-card config-defaults",onSubmit:y=>{y.preventDefault(),l("默认模型",v=>m1({text:c,auxText:o||null},v))},children:u.jsxs("fieldset",{disabled:i||!g.length,children:[u.jsx("legend",{children:"默认模型"}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"对话模型"}),u.jsxs("select",{required:!0,value:c,onChange:y=>f(y.target.value),"aria-label":"默认对话模型",children:[u.jsx("option",{value:"",disabled:!0,children:"选择模型连接"}),c&&!g.some(y=>y.id===c)&&u.jsxs("option",{value:c,disabled:!0,children:[c,"(连接不可用)"]}),g.map(y=>u.jsxs("option",{value:y.id,children:[y.id," · ",y.model]},y.id))]})]}),u.jsxs("label",{children:[u.jsx("span",{children:"辅助模型"}),u.jsxs("select",{value:o,onChange:y=>p(y.target.value),"aria-label":"默认辅助模型",children:[u.jsx("option",{value:"",children:"跟随对话模型"}),o&&!g.some(y=>y.id===o)&&u.jsxs("option",{value:o,disabled:!0,children:[o,"(连接不可用)"]}),g.map(y=>u.jsxs("option",{value:y.id,children:[y.id," · ",y.model]},y.id))]})]})]}),u.jsxs("div",{className:"config-form-footer",children:[u.jsx("p",{className:"config-help",children:"辅助模型用于标题生成等轻量任务。"}),u.jsx("button",{className:"config-button",disabled:!b||!c,type:"submit",children:"保存默认模型"})]})]})})}function Z1({connection:t,configuration:i,disabled:l,save:a,onDone:c,onDirtyChange:f}){const[o,p]=w.useState(()=>{const z=zc(t);return t||(z.catalogId=i.catalog[0]?.id??""),z}),h=w.useRef(o),g=JSON.stringify(o)!==JSON.stringify(h.current),[b,y]=w.useState(!1),v=t?i.connections.find(z=>z.id===t.id):void 0,x=!!t&&(!v||o.expectedRevision!==v.revision);w.useEffect(()=>{if(!g&&v&&o.expectedRevision!==v.revision){const z=zc(v);h.current=z,p(z)}},[g,v,o.expectedRevision]);const k=()=>{if(!v)return;const z=zc(v);h.current=z,p(z),y(!1)};w.useEffect(()=>(f(g),()=>f(!1)),[g,f]);const _=i.catalog.find(z=>z.id===o.catalogId),D=!t&&i.connections.some(z=>z.id===o.id.trim()),R=(z,L)=>p(G=>({...G,[z]:L}));return u.jsx("form",{className:"config-connection-editor",onSubmit:async z=>{z.preventDefault(),!x&&await a("模型连接",L=>p1(o,L))&&c()},children:u.jsxs("fieldset",{disabled:l,children:[u.jsx("legend",{className:"config-sr-only",children:t?`编辑 ${t.id}`:"新模型连接"}),x&&u.jsxs("div",{className:"config-remove-confirm",role:"alert",children:[u.jsx("p",{children:v?"其他设备已更新这个连接。你的草稿已保留,请检查最新设置后再保存。":"这个连接已被其他设备删除。草稿仍保留,你可以复制内容后关闭编辑。"}),v&&u.jsx("button",{className:"config-button",type:"button",onClick:k,children:"放弃草稿并载入最新设置"})]}),u.jsxs("div",{className:"config-form-grid",children:[u.jsxs("label",{children:[u.jsx("span",{children:"连接名称"}),u.jsx("input",{required:!0,maxLength:120,value:o.id,readOnly:!!t,onChange:z=>R("id",z.target.value),placeholder:"例如 work-model",autoComplete:"off"})]}),u.jsxs("label",{children:[u.jsx("span",{children:"服务商"}),u.jsxs("select",{required:!0,disabled:!!t,"aria-label":"服务商",value:o.catalogId,onChange:z=>R("catalogId",z.target.value),children:[t&&!_&&u.jsx("option",{value:o.catalogId,children:o.catalogId}),i.catalog.map(z=>u.jsx("option",{value:z.id,children:z.displayName},z.id))]})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"模型名称"}),u.jsx("input",{required:!0,maxLength:240,value:o.model,onChange:z=>R("model",z.target.value),placeholder:"服务商提供的模型 ID",autoComplete:"off"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsx("span",{children:"服务地址"}),u.jsx("input",{type:"url","aria-label":"服务地址",value:o.baseUrl,onChange:z=>R("baseUrl",z.target.value),placeholder:_?.defaultBaseUrl||"使用服务商默认地址",autoComplete:"off"}),u.jsx("small",{children:"留空使用服务商默认地址,支持兼容接口。"})]}),u.jsxs("label",{className:"config-full-width",children:[u.jsxs("span",{children:["API Key ",t?.hasApiKey&&u.jsx("span",{className:"config-field-meta",children:"已配置"})]}),u.jsx("input",{type:"password","aria-label":"API Key",required:_?.needsKey&&!t?.hasApiKey,value:o.apiKey,onChange:z=>R("apiKey",z.target.value),placeholder:t?.hasApiKey?"留空保留现有 API Key":_?.needsKey?"输入 API Key":"可选",autoComplete:"new-password",spellCheck:!1}),u.jsx("small",{children:t?.hasApiKey?"现有密钥保留在运行 CodeShell 的设备上,输入新值可替换。":"密钥保存在当前工作区配置中。"})]})]}),D&&u.jsx("p",{className:"config-error config-message",role:"alert",children:"连接名称已存在,请使用其他名称或编辑现有连接。"}),u.jsx("p",{className:"config-help",children:"保存后可在连接卡片中测试实际连接。"}),b&&u.jsxs("div",{className:"config-remove-confirm",role:"alert",children:[u.jsx("p",{children:"还有未保存的修改,确定放弃?"}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button",onClick:()=>y(!1),children:"继续编辑"}),u.jsx("button",{type:"button",className:"config-button config-button-danger",onClick:c,children:"放弃修改"})]})]}),u.jsxs("div",{className:"config-form-actions",children:[u.jsx("button",{type:"button",className:"config-button config-button-quiet",onClick:()=>g?y(!0):c(),children:"取消"}),u.jsx("button",{type:"submit",className:"config-button config-button-primary",disabled:D||x,children:"保存连接"})]})]})})}function P1({title:t,description:i}){return u.jsxs("div",{className:"config-empty",children:[u.jsx("span",{"aria-hidden":"true",children:"◇"}),u.jsx("h3",{children:t}),u.jsx("p",{children:i})]})}function Mc(t,i=!1){return yt(`/api/v1/files/content?path=${encodeURIComponent(t)}${i?"&inline=true":""}`)}function kg(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function J1({initialPath:t,openVersion:i=0,onAuthLost:l}){const[a,c]=w.useState(""),[f,o]=w.useState(null),[p,h]=w.useState(null),[g,b]=w.useState(!1),[y,v]=w.useState(!1),[x,k]=w.useState(""),[_,D]=w.useState(0),[R,z]=w.useState(""),L=w.useRef(null),G=w.useRef(l);G.current=l;const se=w.useCallback(q=>{q instanceof Xe&&q.status===401?G.current():k(q instanceof Error?q.message:"文件读取失败,请重试。")},[]);w.useEffect(()=>{const q=new AbortController;return b(!0),k(""),Ue(`/api/v1/files?path=${encodeURIComponent(a)}`,{signal:q.signal}).then(E=>{q.signal.aborted||o(E)}).catch(E=>{q.signal.aborted||se(E)}).finally(()=>{q.signal.aborted||b(!1)}),()=>q.abort()},[a,_,se]);const T=w.useCallback((q,E=!1)=>{L.current?.abort();const U=new AbortController;L.current=U,h(null),v(!0),k(""),Ue(`${Mc(q)}&preview=true`,{signal:U.signal}).then(H=>{U.signal.aborted||(E&&c(H.path.split("/").slice(0,-1).join("/")),h(H))}).catch(H=>{U.signal.aborted||se(H)}).finally(()=>{U.signal.aborted||v(!1)})},[se]);w.useEffect(()=>{t&&T(t,!0)},[t,i,T]),w.useEffect(()=>()=>L.current?.abort(),[]);const V=q=>{L.current?.abort(),v(!1),h(null),c(q),z("")},X=f?.files.filter(q=>q.name.toLocaleLowerCase().includes(R.toLocaleLowerCase()))??[];return u.jsxs("section",{className:"hub-library hub-files","aria-labelledby":"hub-files-heading",children:[u.jsxs("header",{className:"library-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{id:"hub-files-heading",children:"工作区文件"}),u.jsx("p",{children:"查看任务生成的内容,下载到当前设备。"})]}),u.jsx("button",{className:"library-button",onClick:()=>{D(q=>q+1),p&&T(p.path)},children:"刷新"})]}),x?u.jsx("div",{className:"library-error",role:"alert",children:x}):null,u.jsxs("nav",{className:"file-breadcrumbs","aria-label":"文件位置",children:[u.jsx("button",{onClick:()=>V(""),children:"工作区"}),(f?.path??a).split("/").filter(Boolean).map((q,E,U)=>u.jsxs(w.Fragment,{children:[u.jsx("span",{"aria-hidden":"true",children:"/"}),u.jsx("button",{onClick:()=>V(U.slice(0,E+1).join("/")),children:q})]},E))]}),u.jsxs("div",{className:`file-columns${p||y?" has-preview":""}`,children:[u.jsxs("div",{className:"file-directory",children:[u.jsxs("label",{className:"library-search",children:[u.jsx("span",{className:"sr-only",children:"筛选当前文件夹"}),u.jsx("input",{type:"search",placeholder:"筛选当前文件夹…",value:R,onChange:q=>z(q.target.value)})]}),u.jsx("div",{className:"file-entries","aria-busy":g,children:g?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取文件…"}):X.length===0?u.jsx("p",{className:"library-empty",children:R?"没有匹配的文件。":"这个文件夹还没有文件。"}):X.map(q=>u.jsxs("button",{className:`file-entry${p?.path===q.path?" selected":""}`,onClick:()=>q.kind==="directory"?V(q.path):T(q.path),children:[u.jsx("span",{className:"file-glyph","aria-hidden":"true",children:q.kind==="directory"?"▱":"▤"}),u.jsx("span",{className:"file-entry-name",children:q.name}),u.jsx("span",{className:"file-entry-size",children:q.kind==="directory"?"文件夹":kg(q.size)})]},q.path))}),f?.truncated?u.jsx("p",{className:"library-hint",children:"这里只显示前 500 项。可以进入子文件夹继续查看。"}):null]}),y||p?u.jsxs("article",{className:"file-preview","aria-label":"文件预览",children:[u.jsxs("header",{children:[u.jsxs("div",{children:[u.jsx("strong",{children:p?.name??"正在打开…"}),p?u.jsx("span",{children:kg(p.size)}):null]}),u.jsxs("div",{className:"library-actions",children:[p?u.jsx("a",{className:"library-button",href:Mc(p.path),download:!0,children:"下载"}):null,u.jsx("button",{className:"library-button",onClick:()=>{L.current?.abort(),v(!1),h(null)},children:"关闭预览"})]})]}),y?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取内容…"}):p?.kind==="text"?u.jsxs(u.Fragment,{children:[u.jsx("pre",{tabIndex:0,children:p.content}),p.truncated?u.jsx("p",{className:"library-hint",children:"预览显示前 512 KB,下载可获取完整内容。"}):null]}):p?.kind==="image"?u.jsx("img",{src:Mc(p.path,!0),alt:p.name,onError:()=>k("图片无法预览,可以下载后打开。")}):u.jsx("div",{className:"library-empty",children:"这个文件暂不支持直接预览,可以下载后打开。"})]}):null]})]})}async function Ef(t={}){const i=new URLSearchParams({archived:t.archived??"false",limit:"50"});return t.query&&i.set("query",t.query),t.cursor&&i.set("cursor",t.cursor),Ue(`/api/v1/sessions?${i}`,{signal:t.signal})}function Cg(t,i="markdown"){return yt(`/api/v1/sessions/${encodeURIComponent(t)}/export?format=${i}`)}function W1({onAuthLost:t,onOpen:i,onChanged:l,version:a=0,onDirtyChange:c}){const[f,o]=w.useState(""),[p,h]=w.useState(""),[g,b]=w.useState("false"),[y,v]=w.useState([]),[x,k]=w.useState(null),[_,D]=w.useState(!0),[R,z]=w.useState(!1),[L,G]=w.useState(""),[se,T]=w.useState(""),[V,X]=w.useState(0),[q,E]=w.useState(""),[U,H]=w.useState(null),Z=w.useRef(null),ee=w.useRef(null),W=w.useRef(null),N=w.useRef(null);w.useEffect(()=>{U?.id&&Z.current?.focus()},[U?.id]),w.useEffect(()=>{U?.error&&ee.current?.focus()},[U?.error]);const K=()=>{H(null),requestAnimationFrame(()=>{W.current?.isConnected?W.current.focus():N.current?.focus()})};w.useEffect(()=>{c?.(!!U||!!q)},[U,q,c]),w.useEffect(()=>()=>c?.(!1),[c]);const he=w.useRef(null),ge=w.useRef(null),j=w.useRef({onAuthLost:t,onChanged:l,onOpen:i});j.current={onAuthLost:t,onChanged:l,onOpen:i};const O=w.useCallback(te=>{te instanceof Xe&&te.status===401?j.current.onAuthLost():G(te instanceof Error?te.message:"会话操作失败,请重试。")},[]);w.useEffect(()=>{const te=setTimeout(()=>h(f.trim()),200);return()=>clearTimeout(te)},[f]),w.useEffect(()=>{he.current?.abort();const te=new AbortController;return he.current=te,D(!0),z(!1),G(""),Ef({query:p,archived:g,signal:te.signal}).then(oe=>{te.signal.aborted||(v(oe.sessions),k(oe.nextCursor))}).catch(oe=>{te.signal.aborted||O(oe)}).finally(()=>{te.signal.aborted||D(!1)}),()=>te.abort()},[p,g,a,V,O]),w.useEffect(()=>()=>{he.current?.abort(),ge.current?.abort()},[]);const J=()=>{if(!x||R||_)return;const te=new AbortController;he.current?.abort(),he.current=te,z(!0),Ef({query:p,archived:g,cursor:x,signal:te.signal}).then(oe=>{te.signal.aborted||(v(we=>{const F=new Set(we.map(be=>be.sessionId));return[...we,...oe.sessions.filter(be=>!F.has(be.sessionId))]}),k(oe.nextCursor))}).catch(oe=>{te.signal.aborted||O(oe)}).finally(()=>{te.signal.aborted||z(!1)})},A=async(te,oe,we=!1)=>{if(ge.current)return;const F=new AbortController;ge.current=F,E(te),G(""),T(""),"title"in oe&&H(be=>be&&{...be,error:""});try{if(await Ue(`/api/v1/sessions/${encodeURIComponent(te)}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(oe),signal:F.signal}),F.signal.aborted)return;"title"in oe?(K(),T(oe.title?"标题已保存。":"已恢复自动标题。")):T(oe.archived?"对话已归档,可以在“已归档”中恢复。":"对话已恢复。"),X(be=>be+1),j.current.onChanged?.(),we&&j.current.onOpen(te)}catch(be){F.signal.aborted||("title"in oe&&!(be instanceof Xe&&be.status===401)?H(Ee=>Ee?.id===te?{...Ee,error:be instanceof Error?be.message:"标题保存失败,请重试。",conflict:be instanceof Xe&&be.status===409,unavailable:be instanceof Xe&&be.status===404}:Ee):O(be))}finally{ge.current===F&&(ge.current=null),F.signal.aborted||E("")}},ae=async()=>{if(!U||ge.current)return;const te=U.id,oe=new AbortController;ge.current=oe,E(te),H(we=>we&&{...we,error:""});try{const we=await Ue(`/api/v1/sessions/${encodeURIComponent(te)}`,{signal:oe.signal});if(oe.signal.aborted)return;H(F=>F?.id===te?{...F,expectedTitle:we.customTitle,reviewedTitle:we.title,conflict:!1,unavailable:!1,error:""}:F),Z.current?.focus()}catch(we){oe.signal.aborted||(we instanceof Xe&&we.status===401?O(we):H(F=>F?.id===te?{...F,error:we instanceof Error?we.message:"无法读取最新标题,请重试。",unavailable:we instanceof Xe&&we.status===404}:F))}finally{ge.current===oe&&(ge.current=null),oe.signal.aborted||E("")}},pe=te=>te.archivedAt?void A(te.sessionId,{archived:!1},!0):j.current.onOpen(te.sessionId);return u.jsxs("section",{className:"hub-library hub-sessions","aria-labelledby":"hub-history-heading",children:[u.jsxs("header",{className:"library-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{id:"hub-history-heading",children:"历史对话"}),u.jsx("p",{children:"查找、整理并导出当前工作区的对话。"})]}),u.jsx("button",{className:"library-button",onClick:()=>X(te=>te+1),children:"刷新"})]}),L?u.jsx("div",{className:"library-error",role:"alert",children:L}):null,se?u.jsx("p",{className:"library-hint",role:"status",children:se}):null,u.jsxs("div",{className:"session-toolbar",children:[u.jsxs("label",{className:"library-search",children:[u.jsx("span",{className:"sr-only",children:"搜索对话标题"}),u.jsx("input",{ref:N,type:"search",placeholder:"搜索对话标题…",value:f,onChange:te=>o(te.target.value)})]}),u.jsxs("label",{children:[u.jsx("span",{className:"sr-only",children:"对话范围"}),u.jsxs("select",{value:g,onChange:te=>b(te.target.value),children:[u.jsx("option",{value:"false",children:"当前对话"}),u.jsx("option",{value:"true",children:"已归档"}),u.jsx("option",{value:"all",children:"全部对话"})]})]})]}),U?u.jsxs("form",{className:"session-history-editor","aria-labelledby":"session-title-editor-heading",onSubmit:te=>{te.preventDefault(),!q&&!U.conflict&&!U.unavailable&&A(U.id,{title:U.title,expectedTitle:U.expectedTitle})},children:[u.jsxs("div",{children:[u.jsx("h2",{id:"session-title-editor-heading",children:"重命名对话"}),u.jsxs("p",{className:"library-hint",children:["正在编辑:",U.originalTitle]}),!_&&!y.some(te=>te.sessionId===U.id)?u.jsx("p",{className:"library-hint",children:"此对话已不在当前列表中,标题草稿仍保留在这里。"}):null]}),U.error?u.jsx("div",{className:"library-error",id:"session-title-error",role:"alert",tabIndex:-1,ref:ee,children:U.error}):null,U.reviewedTitle?u.jsxs("p",{className:"session-title-review",role:"status",children:["最新标题:",u.jsx("strong",{children:U.reviewedTitle}),"。你的草稿仍保留,请核对后再保存。"]}):null,u.jsxs("label",{children:[u.jsx("span",{children:"对话标题"}),u.jsx("input",{ref:Z,className:"library-title-input",value:U.title,maxLength:1024,"aria-describedby":U.error?"session-title-error":void 0,onChange:te=>{const oe=te.target.value;H(we=>we&&{...we,title:oe})},readOnly:!!q})]}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{type:"submit",className:"library-button primary",disabled:!!q||U.conflict||U.unavailable,children:q?"处理中…":U.reviewedTitle?"确认保存我的标题":"保存标题"}),U.conflict||U.unavailable?u.jsx("button",{type:"button",className:"library-button",disabled:!!q,onClick:()=>{ae()},children:"读取最新标题"}):null,u.jsx("button",{type:"button",className:"library-button",disabled:!!q,onClick:K,children:"取消"}),U.expectedTitle?u.jsx("button",{type:"button",className:"library-button",disabled:!!q||U.conflict||U.unavailable,onClick:()=>{A(U.id,{title:"",expectedTitle:U.expectedTitle})},children:"使用自动标题"}):null]})]}):null,u.jsx("div",{className:"session-history-list","aria-busy":_,children:_?u.jsx("p",{className:"library-empty",role:"status",children:"正在读取对话…"}):y.length===0?u.jsx("p",{className:"library-empty",children:p?"没有找到匹配的对话。":g==="true"?"还没有归档的对话。":"还没有保存的对话,开始一条新对话后会显示在这里。"}):y.map(te=>u.jsxs("article",{className:"session-history-row",children:[u.jsxs("div",{className:"session-history-info",children:[u.jsx("button",{className:"session-history-title",onClick:()=>pe(te),children:te.title}),te.preview&&te.preview!==te.title?u.jsx("p",{children:te.preview.slice(0,150)}):null,u.jsxs("div",{className:"session-history-meta",children:[u.jsx("span",{children:new Date(te.lastActiveAt||te.startedAt).toLocaleString()}),u.jsxs("span",{children:[te.turnCount," 轮"]}),te.running?u.jsx("span",{children:"正在运行"}):te.archivedAt?u.jsx("span",{children:"已归档"}):null]})]}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button",disabled:!!q||!!U,onClick:oe=>{W.current=oe.currentTarget,T(""),H({id:te.sessionId,title:te.title,originalTitle:te.title,expectedTitle:te.customTitle})},children:U?.id===te.sessionId?"正在编辑":"重命名"}),u.jsx("button",{className:"library-button",disabled:!!q||te.running,onClick:()=>{A(te.sessionId,{archived:!te.archivedAt})},children:q===te.sessionId?"处理中…":te.archivedAt?"恢复":"归档"}),te.running?u.jsx("button",{className:"library-button",disabled:!0,children:"运行结束后导出"}):u.jsxs("details",{className:"session-export",children:[u.jsx("summary",{className:"library-button",children:"导出"}),u.jsxs("div",{children:[u.jsx("a",{href:Cg(te.sessionId),download:!0,children:"Markdown 文档"}),u.jsx("a",{href:Cg(te.sessionId,"json"),download:!0,children:"完整 JSON 记录"})]})]})]})]},te.sessionId))}),x&&!_?u.jsx("div",{className:"session-load-more",children:u.jsx("button",{className:"library-button",disabled:R,onClick:J,children:R?"读取中…":"加载更多"})}):null]})}var eS=sb();function Eg(t){return t.replace(/<system-reminder>[\s\S]*?<\/system-reminder>\s*/g,"")}function Xs(){return{items:[],run:"idle",seq:0,liveByAgent:{}}}function ra(t){return t.agentId??""}function qs(t,i,l=!1){const a=i.goalId;if(t.goalId!==a&&!(l&&t.goalId===void 0&&a!==void 0))return!0;const c=i.revision;return t.goalRevision!==void 0&&(c===void 0||c<t.goalRevision)}function tS(t){switch(t){case"aborted_streaming":case"aborted_tools":return"idle";case"prompt_too_long":case"model_error":case"image_error":case"replay_incomplete":case"unverified_write":return"error";default:return"completed"}}function nS(t){if(!t||typeof t!="object")return null;const i=t;if(i.method==="agent/streamEvent"&&i.params&&typeof i.params=="object"){const l=i.params;if(l.event&&typeof l.event=="object")return{event:l.event,sessionId:typeof l.sessionId=="string"?l.sessionId:void 0}}return typeof i.type=="string"?{event:i}:null}function Js(t,i){const l=nS(i);if(!l)return t;const{event:a,sessionId:c}=l,f=a.type;let o=t;c&&c!==o.sessionId&&(o={...o,sessionId:c});const p=h=>{const g=o.seq+1;return[`${h}-${g}`,{...o,seq:g}]};switch(f){case"stream_request_start":{const h=ra(a),[g,b]=p("a"),y={kind:"assistant",id:g,text:"",reasoning:"",done:!1,agentId:a.agentId,...typeof a.messageId=="string"?{messageId:a.messageId}:{}};return{...b,items:[...b.items,y],liveByAgent:{...b.liveByAgent,[h]:g},run:"running"}}case"text_delta":{const h=a.text??"",g=ra(a),b=o.liveByAgent[g];if(b&&o.items.find(_=>_.id===b&&_.kind==="assistant"))return{...o,run:"running",items:o.items.map(_=>_.id===b&&_.kind==="assistant"?{..._,text:_.text+h}:_)};const[v,x]=p("a"),k={kind:"assistant",id:v,text:h,reasoning:"",done:!1,agentId:a.agentId};return{...x,items:[...x.items,k],liveByAgent:{...x.liveByAgent,[g]:v},run:"running"}}case"thinking_delta":{const h=a.text??"",g=ra(a),b=o.liveByAgent[g];if(b&&o.items.some(k=>k.id===b&&k.kind==="assistant"))return{...o,run:"running",items:o.items.map(k=>k.id===b&&k.kind==="assistant"?{...k,reasoning:k.reasoning+h}:k)};const[y,v]=p("a"),x={kind:"assistant",id:y,text:"",reasoning:h,done:!1,agentId:a.agentId};return{...v,items:[...v.items,x],liveByAgent:{...v.liveByAgent,[g]:y},run:"running"}}case"tool_use_start":{const h=a.toolCall;if(!h||o.items.some(v=>v.kind==="tool"&&v.id===h.id))return o;const g=o.orphanResults?.[h.id],b={kind:"tool",id:h.id,name:h.toolName,args:h.args,summary:h.summary,done:!!g,result:g?.result,error:g?.error,agentId:a.agentId};let y=o.orphanResults;if(g){const{[h.id]:v,...x}=o.orphanResults;y=Object.keys(x).length>0?x:void 0}return{...o,run:"running",items:[...o.items,b],orphanResults:y}}case"tool_use_args_delta":{const h=a.toolCallId,g=a.args;return!h||!g?o:{...o,items:o.items.map(b=>b.kind==="tool"&&b.id===h?{...b,args:{...b.args??{},...g}}:b)}}case"tool_result":{const h=a.result;return h?o.items.some(b=>b.kind==="tool"&&b.id===h.id)?{...o,items:o.items.map(b=>b.kind==="tool"&&b.id===h.id?{...b,done:!0,result:Eg(h.result??h.error??""),error:!!(h.isError||h.error)}:b)}:{...o,orphanResults:{...o.orphanResults??{},[h.id]:{result:h.result??h.error??"",error:!!(h.isError||h.error)}}}:o}case"room_tool_result":{const h=a.summary??"",g=Eg(h),b=!!a.isError;let y=-1;for(let k=o.items.length-1;k>=0;k--)if(o.items[k].kind==="tool"&&!o.items[k].done){y=k;break}if(y===-1)return o;const v=o.items.slice(),x=v[y];return v[y]={...x,done:!0,result:g,summary:g||x.summary,error:b},{...o,items:v}}case"tool_summary":{const h=a.summary??"",g=Array.isArray(a.toolCallIds)?a.toolCallIds.filter(_=>typeof _=="string"):[],y=g.length>0?g[g.length-1]:void 0,v=a.agentId;if(y){let _=!1;const D=o.items.map(R=>R.kind!=="tool"||R.id!==y||R.agentId!==v?R:(_=!0,{...R,summary:h}));return _?{...o,items:D}:o}if(v){let _=-1;for(let R=o.items.length-1;R>=0;R--){const z=o.items[R];if(z.kind==="tool"&&z.agentId===v){_=R;break}}if(_===-1)return o;const D=o.items.slice();return D[_]={...D[_],summary:h},{...o,items:D}}let x=-1;for(let _=o.items.length-1;_>=0;_--){const D=o.items[_];if(D.kind==="tool"&&D.agentId===void 0){x=_;break}}if(x===-1)return o;const k=o.items.slice();return k[x]={...k[x],summary:h},{...o,items:k}}case"tombstone":{if(typeof a.messageId!="string")return o;const h=new Set(o.items.filter(g=>g.kind==="assistant"&&g.messageId===a.messageId||g.kind==="tool"&&g.id===a.messageId).map(g=>g.id));return h.size?{...o,items:o.items.filter(g=>!h.has(g.id)),liveByAgent:Object.fromEntries(Object.entries(o.liveByAgent).filter(([,g])=>!h.has(g)))}:o}case"assistant_message":{const h=ra(a);if(!(h in o.liveByAgent))return o;const{[h]:g,...b}=o.liveByAgent,y=o.items.map(v=>v.kind==="assistant"&&!v.done&&(v.agentId??"")===h?{...v,done:!0}:v);return{...o,liveByAgent:b,items:y}}case"turn_complete":{const h=a.reason??"completed",g=ra(a),{[g]:b,...y}=o.liveByAgent,v=o.items.map(x=>x.kind==="assistant"&&!x.done&&(x.agentId??"")===g?{...x,done:!0}:x);return a.agentId?{...o,liveByAgent:y,items:v}:{...o,liveByAgent:y,items:v,run:tS(h)}}case"goal_set":{const h=a.objective??"",g=!!a.paused;return o.goal&&o.goalId===a.goalId&&qs(o,a)?o:{...o,goal:h?`◎ ${h}${g?" (已暂停)":""}`:"◎ 目标",goalId:a.goalId,goalPaused:g,goalRevision:a.revision}}case"goal_updated":{if(o.goal&&qs(o,a,!0))return o;const h=a.goalId,g=a.objective??"",b=!!a.paused;return{...o,goal:g?`◎ ${g}${b?" (已暂停)":""}`:o.goal,goalId:h??o.goalId,goalPaused:b,goalRevision:a.revision??o.goalRevision}}case"goal_cleared":return o.goal&&qs(o,a)?o:{...o,goal:void 0,goalId:void 0,goalPaused:void 0,goalRevision:void 0};case"goal_progress":{if(o.goal&&qs(o,a))return o;const h=a.status??"";if(h==="met"||h==="exhausted")return{...o,goal:void 0,goalId:void 0,goalPaused:void 0,goalRevision:void 0};const g=a.round,b=g?`目标 · 第 ${g} 轮 (${h})`:`目标 (${h})`;return{...o,goal:b,goalRevision:a.revision??o.goalRevision}}case"task_update":{const h=a.agentId;if(!h)return o;const g=a.tasks??[],b=g.filter(k=>k.status==="completed").length,y=`任务 ${b}/${g.length}`,v=o.items.findIndex(k=>k.kind==="subagent"&&k.agentId===h),x={kind:"subagent",id:`sub-${h}`,agentId:h,label:y,status:g.length>0&&b===g.length?"completed":"running"};if(v>=0){const k=o.items.slice();return k[v]=x,{...o,items:k}}return{...o,items:[...o.items,x]}}case"agent_start":{const h=a.agentId;if(!h)return o;const g={kind:"subagent",id:`sub-${h}`,agentId:h,label:a.name||a.description||"子代理",status:a.status==="recorded"?"recorded":"running"};return o.items.some(b=>b.kind==="subagent"&&b.agentId===h)?o:{...o,items:[...o.items,g]}}case"agent_end":{const h=a.agentId;return{...o,items:o.items.map(g=>g.kind==="subagent"&&g.agentId===h?{...g,status:a.error?"error":"completed"}:g)}}case"error":{const[h,g]=p("err");return{...g,run:"error",liveByAgent:{},items:[...g.items,{kind:"system_error",id:h,text:a.error||"运行出错"}]}}case"session_title":return{...o,title:a.title};case"session_user_message":case"user_message":{const h=typeof a.clientMessageId=="string"?a.clientMessageId:void 0,g=Array.isArray(a.attachments)?a.attachments.map(v=>v).filter(v=>!!v&&typeof v.name=="string"&&typeof v.size=="number"&&Number.isFinite(v.size)&&v.size>=0).map(v=>({name:v.name,size:v.size,...typeof v.mime=="string"?{mime:v.mime}:{},...typeof v.path=="string"?{path:v.path}:{}})):void 0;if(h&&o.items.some(v=>v.kind==="user"&&v.clientMessageId===h))return g?.length?{...o,items:o.items.map(v=>v.kind==="user"&&v.clientMessageId===h?{...v,attachments:g.map((x,k)=>{const _=v.attachments?.[k];return _?.name===x.name?{..._,...x}:x})}:v)}:o;const[b,y]=p("u");return{...y,items:[...y.items,{kind:"user",id:b,text:a.text??"",...g?.length?{attachments:g}:{},...h?{clientMessageId:h}:{}}]}}case"assistant_text":{const[h,g]=p("a");return{...g,run:"running",items:[...g.items,{kind:"assistant",id:h,text:a.text??"",reasoning:"",done:!0,agentId:a.agentId}]}}default:return o}}function iS(t,i,l,a){const c=`u-${t.seq+1}`;return{...t,seq:t.seq+1,items:[...t.items,{kind:"user",id:c,text:i,...l?.length?{attachments:l}:{},...a?{clientMessageId:a}:{}}]}}const rS="codeshell.uiLanguage";function lS(){try{const t=globalThis.localStorage?.getItem(rS);if(t==="zh"||t==="en")return t}catch{}return"zh"}const aS={zh:{mobile:{app:{extendGoal:"延长目标",clearGoal:"清除目标",loadingCcSession:"正在加载 CC 会话…",loadingSession:"正在加载会话…",conversationFallback:"对话",desktopSession:"桌面会话",newSession:"新会话",openSessionsAria:"打开会话",leaveSessionAria:"退出会话",deviceFallback:"设备",logoutAria:"退出登录",permission:"权限",ccRoomObserving:"此会话当前为只读查看;请在桌面端明确接管后再发送消息。"},approval:{risk:{low:"低风险",medium:"中风险",high:"高风险"},readSourceSummary:"读取数据源 {source} / {scope} / {resource}",question:"问题",customPlaceholder:"或输入自定义回答…",sendCustom:"发送自定义回答",rememberScope:"记住范围",scope:{once:"仅本次",session:"本会话",project:"本项目"},pathScopeLabel:"路径范围",pathScope:{file:"此文件",dir:"此目录",tool:"此工具"},allow:"允许",reject:"拒绝"},cc:{title:"CC 会话",subtitle:"外部 {label} 会话",selectProjectFirst:"先选择一个项目。",probingCli:"正在检测 {label} CLI…",cliMissing:"未检测到 {label} CLI(需在桌面端机器的 PATH 中)。",loadingSessions:"正在加载 cc 会话…",empty:"该项目下没有 {label} 会话。",messageCount:"{count} 条"},sidePane:{localTab:"会话",ccTab:"CC 会话"},composer:{disconnected:"未连接",placeholder:"发消息…",stop:"停止",send:"发送",chooseImages:"从相册选择图片",takePhoto:"拍照",removeImage:"移除图片",uploading:"上传中…",tooManyImages:"每条消息最多发送 4 张图片",unsupportedImage:"不支持此图片格式",sendFailed:"图片发送失败,请重试"},connection:{connectingTitle:"正在连接…",connectingBody:"与 CodeShell 建立通道",authenticatingTitle:"认证中…",authenticatingBody:"正在校验设备身份",unpairedTitle:"未配对",unpairedBody:"请在 CodeShell 桌面端打开「设置 → 远程」,扫码或打开配对链接。",offlineTitle:"连接断开",offlineBody:"正在自动重连…"},format:{noProject:"无项目",justNow:"刚刚",minutesAgo:"{n} 分钟前",hoursAgo:"{n} 小时前",daysAgo:"{n} 天前",monthsAgo:"{n} 个月前",yearsAgo:"{n} 年前"},notice:{roomMissing:"会话不存在或未就绪",roomError:"会话错误",sessionRecoveryIncomplete:"当前回复的开头尚未恢复,请重新打开会话以读取已保存的内容。",sessionRecoveryHistoryOnly:"已恢复保存的聊天记录。当前回复的实时部分暂时无法接续,请稍后重新打开会话。",goalExtendFailed:"延长目标失败",ccRoomOpenFailed:"cc 会话无法打开",ccRoomObserving:"此 CC 会话当前为只读查看,消息未发送",attachmentSendFailed:"图片发送失败:{error}"},permissionMode:{default:"默认",acceptEdits:"自动改",bypassPermissions:"全放行",defaultDesc:"每个工具调用都要你确认",acceptEditsDesc:"自动放行文件编辑,其余仍确认",bypassDesc:"跳过所有权限确认(危险)",title:"选择权限模式",confirmBypass:"全放行模式会跳过所有权限确认。确定吗?"},sessionList:{title:"会话",takeoverCount:"{count} 个可接管",refreshAria:"刷新会话",new:"新建",createHint:"新会话默认使用当前目录",currentProject:"当前项目 · {name}",noProjectConversation:"无项目对话",desktopCwd:"当前桌面目录",unboundRepo:"不绑定 repo",followsDesktopCwd:"跟随桌面当前 cwd",otherProjects:"其他项目",loading:"正在加载会话…",empty:"还没有会话。点「新建」开一个,或在桌面端开始。",automation:"自动",noProjectPath:"无项目路径",unreadAria:"有新内容",primaryRoot:"主目录",secondaryRoot:"次目录"},status:{conn:{connecting:"连接中…",authenticating:"认证中…",unpaired:"未配对",online:"在线",offline:"已断开"},run:{idle:"空闲",running:"运行中",waiting:"待审批",completed:"已完成",error:"出错"}},storage:{browserDevice:"{platform} 浏览器"},stream:{showReasoning:"显示思考",hideReasoning:"隐藏思考",subagent:"子代理",loading:"正在加载…",generating:"正在生成回复",emptyHint:"发个任务试试,或在侧栏打开一个 Claude Code 会话。"},tool:{running:"运行中",failed:"失败",completed:"完成",fallbackName:"操作",truncated:"… (已截断)"}}},en:{mobile:{app:{extendGoal:"Extend goal",clearGoal:"Clear goal",loadingCcSession:"Loading CC session…",loadingSession:"Loading conversation…",conversationFallback:"Conversation",desktopSession:"Desktop session",newSession:"New session",openSessionsAria:"Open sessions",leaveSessionAria:"Leave session",deviceFallback:"Device",logoutAria:"Log out",permission:"Permission",ccRoomObserving:"This session is read-only. Take it over explicitly on desktop before sending messages."},approval:{risk:{low:"Low risk",medium:"Medium risk",high:"High risk"},readSourceSummary:"Read data source {source} / {scope} / {resource}",question:"Question",customPlaceholder:"Or enter a custom answer…",sendCustom:"Send custom answer",rememberScope:"Remember scope",scope:{once:"Once",session:"This session",project:"This project"},pathScopeLabel:"Path scope",pathScope:{file:"This file",dir:"This directory",tool:"This tool"},allow:"Allow",reject:"Deny"},cc:{title:"CC sessions",subtitle:"External {label} sessions",selectProjectFirst:"Select a project first.",probingCli:"Checking {label} CLI…",cliMissing:"{label} CLI was not found (it must be in PATH on the desktop machine).",loadingSessions:"Loading cc sessions…",empty:"No {label} sessions in this project.",messageCount:"{count} messages"},sidePane:{localTab:"Sessions",ccTab:"CC"},composer:{disconnected:"Disconnected",placeholder:"Message…",stop:"Stop",send:"Send",chooseImages:"Choose images",takePhoto:"Take photo",removeImage:"Remove image",uploading:"Uploading…",tooManyImages:"Up to 4 images can be sent per message",unsupportedImage:"This image format is not supported",sendFailed:"Could not send images; try again"},connection:{connectingTitle:"Connecting…",connectingBody:"Opening a channel to CodeShell",authenticatingTitle:"Authenticating…",authenticatingBody:"Verifying this device",unpairedTitle:"Not paired",unpairedBody:"Open Settings → Remote in CodeShell desktop, then scan the QR code or open the pairing link.",offlineTitle:"Disconnected",offlineBody:"Reconnecting automatically…"},format:{noProject:"No project",justNow:"Just now",minutesAgo:"{n} min ago",hoursAgo:"{n} hr ago",daysAgo:"{n} days ago",monthsAgo:"{n} mo ago",yearsAgo:"{n} yr ago"},notice:{roomMissing:"Session does not exist or is not ready",roomError:"Session error",sessionRecoveryIncomplete:"The beginning of this reply could not be restored. Reopen the conversation to read its saved content.",sessionRecoveryHistoryOnly:"Saved chat history has been restored. Reopen the conversation later to see the rest of this reply.",goalExtendFailed:"Failed to extend goal",ccRoomOpenFailed:"Could not open cc session",ccRoomObserving:"This CC session is read-only; the message was not sent",attachmentSendFailed:"Could not send images: {error}"},permissionMode:{default:"Default",acceptEdits:"Auto-edit",bypassPermissions:"Allow all",defaultDesc:"Confirm every tool call",acceptEditsDesc:"Allow file edits automatically; confirm everything else",bypassDesc:"Skip all permission confirmations (dangerous)",title:"Choose permission mode",confirmBypass:"Allow all mode skips every permission confirmation. Continue?"},sessionList:{title:"Sessions",takeoverCount:"{count} available",refreshAria:"Refresh sessions",new:"New",createHint:"New sessions default to the current directory",currentProject:"Current project · {name}",noProjectConversation:"No-project conversation",desktopCwd:"Current desktop directory",unboundRepo:"Do not bind a repo",followsDesktopCwd:"Follow desktop current cwd",otherProjects:"Other projects",loading:"Loading sessions…",empty:"No sessions yet. Tap “New” to start one, or start from desktop.",automation:"Automation",noProjectPath:"No project path",unreadAria:"New content",primaryRoot:"Primary",secondaryRoot:"Secondary"},status:{conn:{connecting:"Connecting…",authenticating:"Authenticating…",unpaired:"Not paired",online:"Online",offline:"Disconnected"},run:{idle:"Idle",running:"Running",waiting:"Awaiting approval",completed:"Completed",error:"Error"}},storage:{browserDevice:"{platform} browser"},stream:{showReasoning:"Show reasoning",hideReasoning:"Hide reasoning",subagent:"Subagent",loading:"Loading…",generating:"Generating response",emptyHint:"Send a task, or open a Claude Code session from the sidebar."},tool:{running:"Running",failed:"Failed",completed:"Completed",fallbackName:"Operation",truncated:"… (truncated)"}}}},Ng=aS;function Ag(t,i){let l=t;for(const a of i.split(".")){if(l==null||typeof l!="object")return;l=l[a]}return typeof l=="string"?l:void 0}function sS(t,i){return i?t.replace(/\{(\w+)\}/g,(l,a)=>a in i?String(i[a]):l):t}function oS(t,i,l){const a=Ag(Ng[t],i)??Ag(Ng.zh,i)??i;return sS(a,l)}function uS(t,i){return oS(lS(),t,i)}const cS=["command","file_path","path","url","pattern","query"];function fS(t,i,l){let a="";const c=t?.source,f=t?.scope,o=t?.resource;if(l==="ReadSource"&&typeof c=="string"&&c.length>0&&typeof f=="string"&&f.length>0&&typeof o=="string"&&o.length>0)a=uS("mobile.approval.readSourceSummary",{source:c,scope:f,resource:o});else for(const h of cS){const g=t?.[h];if(typeof g=="string"&&g.length>0){a=g;break}}a||(a=JSON.stringify(t??{}));let p;return i==="low"||i==="medium"||i==="high"?p=i:i===void 0||i===""?p="medium":p="high",{summary:a,risk:p}}function Hn(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function kt(t){return typeof t=="string"?t:""}function Ws(t){return Array.isArray(t)?t.map(Hn).filter(i=>i!==void 0):[]}function Nf(t){return typeof t=="string"?t:Ws(t).filter(i=>i.type==="text").map(i=>kt(i.text)).join("")}function Is(t){return t.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}function _c(t){const i=t.replace(/\\/g,"/").split("/").filter(Boolean).pop()||"附件";return t.includes(".code-shell/attachments/")?i.replace(/^[a-f0-9]{16}-/,""):i}function Tg(t){const i=typeof t=="number"?t:Number(t);return Number.isSafeInteger(i)&&i>=0?i:0}function dS(t){const i=[],l=[];let a=Nf(t.content);a=a.replace(/<attached-file\s+path="([^"]*)">\s*([\s\S]*?)<\/attached-file>/g,(o,p,h)=>{if(!/^absolutePath:\s*.+$/m.test(h)||!/^origin:\s*.+$/m.test(h))return o;const g=h.match(/^mime:\s*(.+)$/m)?.[1]?.trim();return i.push({name:_c(Is(p)),path:Is(p),size:Tg(h.match(/^size:\s*(\d+)\s*$/m)?.[1]),...g?{mime:g}:{}}),""}),a=a.replace(/<attached-directory\s+path="([^"]*)"[^>]*>[\s\S]*?<\/attached-directory>/g,(o,p)=>(i.push({name:`${_c(Is(p))}/`,path:Is(p),size:0}),"")),a=a.replace(/<attached-image-paths>\s*([\s\S]*?)<\/attached-image-paths>\s*(?:\(上面附带的图片在工作区的真实路径[^\n]*\))?/g,(o,p)=>(l.push(...p.split(`
|
|
21
|
-
`).map(h=>h.trim()).filter(Boolean)),""));const c=Ws(t.content).filter(o=>o.type==="image");for(let o=0;o<Math.max(c.length,l.length);o++){const p=Hn(c[o]?.source),h=kt(p?.data).replace(/\s/g,"");i.push({name:l[o]?_c(l[o]):`图片 ${o+1}`,...l[o]?{path:l[o]}:{},size:h?Math.max(0,Math.floor(h.length*3/4)-(h.match(/=+$/)?.[0].length??0)):0,...typeof p?.media_type=="string"?{mime:p.media_type}:{}})}const f=Array.isArray(t.attachments)?t.attachments.flatMap(o=>{const p=Hn(o),h=kt(p?.name)||kt(p?.originalName);return h?[{name:h,size:Tg(p?.size),...typeof p?.mime=="string"?{mime:p.mime}:{},...typeof p?.path=="string"?{path:p.path}:{}}]:[]}):[];return{text:typeof t.displayText=="string"?t.displayText:a.trim(),attachments:f.length?f:i}}function zg(t){return Hn(t.data)??Hn(t.message)??t}function hS(t){const i=[],l=new Set,a=new Set,c=new Map;for(const p of t){const h=Hn(p);if(!h)continue;const g=zg(h);h.type==="tool_use"&&kt(g.toolCallId)&&c.set(kt(g.toolCallId),{name:kt(g.toolName)||"工具",args:Hn(g.args)??{}});for(const b of Ws(g.content))b.type==="tool_use"&&kt(b.id)&&c.set(kt(b.id),{name:kt(b.name)||"工具",args:Hn(b.input)??{}})}const f=(p,h,g,b)=>{p&&(a.has(p)?i.push({type:"tool_use_args_delta",toolCallId:p,args:g,...b?{agentId:b}:{}}):(a.add(p),i.push({type:"tool_use_start",toolCall:{id:p,toolName:h||"工具",args:g},...b?{agentId:b}:{}})))},o=(p,h,g)=>{if(!p)return;const b=c.get(p);a.has(p)||f(p,b?.name||kt(h.toolName)||"工具",b?.args??{},g);const y=typeof h.result=="string"?h.result:Nf(h.content??h.contentBlocks),v=kt(h.error);i.push({type:"tool_result",result:{id:p,result:y||v,...v?{error:v}:{},isError:h.isError===!0||h.is_error===!0||!!v},...g?{agentId:g}:{}})};for(const p of t){const h=Hn(p);if(!h)continue;const g=kt(h.id);if(g&&l.has(g))continue;g&&l.add(g);const b=zg(h),y=kt(b.agentId)||void 0;switch(typeof h.type=="string"?h.type:typeof b.role=="string"?"message":""){case"message":{const x=Ws(b.content);if(b.role==="user"){if(b.injected===!0||b.authority==="agent"||b.authority==="system"||b.authority==="policy")break;const k=dS(b);if(k.text.startsWith("<system-reminder>"))break;(k.text||k.attachments.length)&&i.push({type:"user_message",...k,...typeof b.clientMessageId=="string"?{clientMessageId:b.clientMessageId}:{}});for(const _ of x)_.type==="tool_result"&&o(kt(_.tool_use_id),_,y)}else if(b.role==="assistant"){const k=Nf(b.content),_=x.filter(D=>D.type==="reasoning").map(D=>kt(D.reasoningContent)||kt(D.text)).join("");if(k||_){const D=y?{agentId:y}:{};i.push({type:"stream_request_start",...D}),_&&i.push({type:"thinking_delta",text:_,...D}),k&&i.push({type:"text_delta",text:k,...D}),i.push({type:"assistant_message",...D})}for(const D of x)D.type==="tool_use"&&f(kt(D.id),kt(D.name),Hn(D.input)??{},y)}else b.role==="tool"&&o(kt(b.tool_call_id),b,y);break}case"tool_use":f(kt(b.toolCallId),kt(b.toolName),Hn(b.args)??{},y);break;case"tool_result":o(kt(b.toolCallId),b,y);break;case"subagent":y&&i.push({type:"agent_start",agentId:y,name:kt(b.name),description:kt(b.description),status:"recorded"});break;case"error":kt(b.error)&&i.push({type:"error",error:b.error});break;case"turn_stopped":i.push({type:"turn_complete",reason:"aborted_tools"});break;case"session_meta":kt(b.sessionId)&&i.push({type:"session_started",sessionId:b.sessionId});break}}return i}function pS(t){let i=Xs();for(const l of hS(t))i=Js(i,l);return{...i,run:i.run==="error"?"error":"idle",liveByAgent:{}}}var il={},Oc,Rg;function mS(){return Rg||(Rg=1,Oc=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Oc}var Lc={},Vi={},Dg;function mr(){if(Dg)return Vi;Dg=1;let t;const i=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Vi.getSymbolSize=function(a){if(!a)throw new Error('"version" cannot be null or undefined');if(a<1||a>40)throw new Error('"version" should be in range from 1 to 40');return a*4+17},Vi.getSymbolTotalCodewords=function(a){return i[a]},Vi.getBCHDigit=function(l){let a=0;for(;l!==0;)a++,l>>>=1;return a},Vi.setToSJISFunction=function(a){if(typeof a!="function")throw new Error('"toSJISFunc" is not a valid function.');t=a},Vi.isKanjiModeEnabled=function(){return typeof t<"u"},Vi.toSJIS=function(a){return t(a)},Vi}var Bc={},Mg;function Pf(){return Mg||(Mg=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function i(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+l)}}t.isValid=function(a){return a&&typeof a.bit<"u"&&a.bit>=0&&a.bit<4},t.from=function(a,c){if(t.isValid(a))return a;try{return i(a)}catch{return c}}})(Bc)),Bc}var Uc,_g;function gS(){if(_g)return Uc;_g=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(i){const l=Math.floor(i/8);return(this.buffer[l]>>>7-i%8&1)===1},put:function(i,l){for(let a=0;a<l;a++)this.putBit((i>>>l-a-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(i){const l=Math.floor(this.length/8);this.buffer.length<=l&&this.buffer.push(0),i&&(this.buffer[l]|=128>>>this.length%8),this.length++}},Uc=t,Uc}var qc,Og;function yS(){if(Og)return qc;Og=1;function t(i){if(!i||i<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=i,this.data=new Uint8Array(i*i),this.reservedBit=new Uint8Array(i*i)}return t.prototype.set=function(i,l,a,c){const f=i*this.size+l;this.data[f]=a,c&&(this.reservedBit[f]=!0)},t.prototype.get=function(i,l){return this.data[i*this.size+l]},t.prototype.xor=function(i,l,a){this.data[i*this.size+l]^=a},t.prototype.isReserved=function(i,l){return this.reservedBit[i*this.size+l]},qc=t,qc}var Ic={},Lg;function bS(){return Lg||(Lg=1,(function(t){const i=mr().getSymbolSize;t.getRowColCoords=function(a){if(a===1)return[];const c=Math.floor(a/7)+2,f=i(a),o=f===145?26:Math.ceil((f-13)/(2*c-2))*2,p=[f-7];for(let h=1;h<c-1;h++)p[h]=p[h-1]-o;return p.push(6),p.reverse()},t.getPositions=function(a){const c=[],f=t.getRowColCoords(a),o=f.length;for(let p=0;p<o;p++)for(let h=0;h<o;h++)p===0&&h===0||p===0&&h===o-1||p===o-1&&h===0||c.push([f[p],f[h]]);return c}})(Ic)),Ic}var Hc={},Bg;function vS(){if(Bg)return Hc;Bg=1;const t=mr().getSymbolSize,i=7;return Hc.getPositions=function(a){const c=t(a);return[[0,0],[c-i,0],[0,c-i]]},Hc}var Vc={},Ug;function xS(){return Ug||(Ug=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const i={N1:3,N2:3,N3:40,N4:10};t.isValid=function(c){return c!=null&&c!==""&&!isNaN(c)&&c>=0&&c<=7},t.from=function(c){return t.isValid(c)?parseInt(c,10):void 0},t.getPenaltyN1=function(c){const f=c.size;let o=0,p=0,h=0,g=null,b=null;for(let y=0;y<f;y++){p=h=0,g=b=null;for(let v=0;v<f;v++){let x=c.get(y,v);x===g?p++:(p>=5&&(o+=i.N1+(p-5)),g=x,p=1),x=c.get(v,y),x===b?h++:(h>=5&&(o+=i.N1+(h-5)),b=x,h=1)}p>=5&&(o+=i.N1+(p-5)),h>=5&&(o+=i.N1+(h-5))}return o},t.getPenaltyN2=function(c){const f=c.size;let o=0;for(let p=0;p<f-1;p++)for(let h=0;h<f-1;h++){const g=c.get(p,h)+c.get(p,h+1)+c.get(p+1,h)+c.get(p+1,h+1);(g===4||g===0)&&o++}return o*i.N2},t.getPenaltyN3=function(c){const f=c.size;let o=0,p=0,h=0;for(let g=0;g<f;g++){p=h=0;for(let b=0;b<f;b++)p=p<<1&2047|c.get(g,b),b>=10&&(p===1488||p===93)&&o++,h=h<<1&2047|c.get(b,g),b>=10&&(h===1488||h===93)&&o++}return o*i.N3},t.getPenaltyN4=function(c){let f=0;const o=c.data.length;for(let h=0;h<o;h++)f+=c.data[h];return Math.abs(Math.ceil(f*100/o/5)-10)*i.N4};function l(a,c,f){switch(a){case t.Patterns.PATTERN000:return(c+f)%2===0;case t.Patterns.PATTERN001:return c%2===0;case t.Patterns.PATTERN010:return f%3===0;case t.Patterns.PATTERN011:return(c+f)%3===0;case t.Patterns.PATTERN100:return(Math.floor(c/2)+Math.floor(f/3))%2===0;case t.Patterns.PATTERN101:return c*f%2+c*f%3===0;case t.Patterns.PATTERN110:return(c*f%2+c*f%3)%2===0;case t.Patterns.PATTERN111:return(c*f%3+(c+f)%2)%2===0;default:throw new Error("bad maskPattern:"+a)}}t.applyMask=function(c,f){const o=f.size;for(let p=0;p<o;p++)for(let h=0;h<o;h++)f.isReserved(h,p)||f.xor(h,p,l(c,h,p))},t.getBestMask=function(c,f){const o=Object.keys(t.Patterns).length;let p=0,h=1/0;for(let g=0;g<o;g++){f(g),t.applyMask(g,c);const b=t.getPenaltyN1(c)+t.getPenaltyN2(c)+t.getPenaltyN3(c)+t.getPenaltyN4(c);t.applyMask(g,c),b<h&&(h=b,p=g)}return p}})(Vc)),Vc}var Hs={},qg;function pb(){if(qg)return Hs;qg=1;const t=Pf(),i=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],l=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Hs.getBlocksCount=function(c,f){switch(f){case t.L:return i[(c-1)*4+0];case t.M:return i[(c-1)*4+1];case t.Q:return i[(c-1)*4+2];case t.H:return i[(c-1)*4+3];default:return}},Hs.getTotalCodewordsCount=function(c,f){switch(f){case t.L:return l[(c-1)*4+0];case t.M:return l[(c-1)*4+1];case t.Q:return l[(c-1)*4+2];case t.H:return l[(c-1)*4+3];default:return}},Hs}var Yc={},la={},Ig;function SS(){if(Ig)return la;Ig=1;const t=new Uint8Array(512),i=new Uint8Array(256);return(function(){let a=1;for(let c=0;c<255;c++)t[c]=a,i[a]=c,a<<=1,a&256&&(a^=285);for(let c=255;c<512;c++)t[c]=t[c-255]})(),la.log=function(a){if(a<1)throw new Error("log("+a+")");return i[a]},la.exp=function(a){return t[a]},la.mul=function(a,c){return a===0||c===0?0:t[i[a]+i[c]]},la}var Hg;function wS(){return Hg||(Hg=1,(function(t){const i=SS();t.mul=function(a,c){const f=new Uint8Array(a.length+c.length-1);for(let o=0;o<a.length;o++)for(let p=0;p<c.length;p++)f[o+p]^=i.mul(a[o],c[p]);return f},t.mod=function(a,c){let f=new Uint8Array(a);for(;f.length-c.length>=0;){const o=f[0];for(let h=0;h<c.length;h++)f[h]^=i.mul(c[h],o);let p=0;for(;p<f.length&&f[p]===0;)p++;f=f.slice(p)}return f},t.generateECPolynomial=function(a){let c=new Uint8Array([1]);for(let f=0;f<a;f++)c=t.mul(c,new Uint8Array([1,i.exp(f)]));return c}})(Yc)),Yc}var Gc,Vg;function jS(){if(Vg)return Gc;Vg=1;const t=wS();function i(l){this.genPoly=void 0,this.degree=l,this.degree&&this.initialize(this.degree)}return i.prototype.initialize=function(a){this.degree=a,this.genPoly=t.generateECPolynomial(this.degree)},i.prototype.encode=function(a){if(!this.genPoly)throw new Error("Encoder not initialized");const c=new Uint8Array(a.length+this.degree);c.set(a);const f=t.mod(c,this.genPoly),o=this.degree-f.length;if(o>0){const p=new Uint8Array(this.degree);return p.set(f,o),p}return f},Gc=i,Gc}var Fc={},Qc={},Xc={},Yg;function mb(){return Yg||(Yg=1,Xc.isValid=function(i){return!isNaN(i)&&i>=1&&i<=40}),Xc}var Xn={},Gg;function gb(){if(Gg)return Xn;Gg=1;const t="[0-9]+",i="[A-Z $%*+\\-./:]+";let l="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";l=l.replace(/u/g,"\\u");const a="(?:(?![A-Z0-9 $%*+\\-./:]|"+l+`)(?:.|[\r
|
|
22
|
-
]))+`;Xn.KANJI=new RegExp(l,"g"),Xn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Xn.BYTE=new RegExp(a,"g"),Xn.NUMERIC=new RegExp(t,"g"),Xn.ALPHANUMERIC=new RegExp(i,"g");const c=new RegExp("^"+l+"$"),f=new RegExp("^"+t+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Xn.testKanji=function(h){return c.test(h)},Xn.testNumeric=function(h){return f.test(h)},Xn.testAlphanumeric=function(h){return o.test(h)},Xn}var Fg;function gr(){return Fg||(Fg=1,(function(t){const i=mb(),l=gb();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(f,o){if(!f.ccBits)throw new Error("Invalid mode: "+f);if(!i.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?f.ccBits[0]:o<27?f.ccBits[1]:f.ccBits[2]},t.getBestModeForData=function(f){return l.testNumeric(f)?t.NUMERIC:l.testAlphanumeric(f)?t.ALPHANUMERIC:l.testKanji(f)?t.KANJI:t.BYTE},t.toString=function(f){if(f&&f.id)return f.id;throw new Error("Invalid mode")},t.isValid=function(f){return f&&f.bit&&f.ccBits};function a(c){if(typeof c!="string")throw new Error("Param is not a string");switch(c.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+c)}}t.from=function(f,o){if(t.isValid(f))return f;try{return a(f)}catch{return o}}})(Qc)),Qc}var Qg;function kS(){return Qg||(Qg=1,(function(t){const i=mr(),l=pb(),a=Pf(),c=gr(),f=mb(),o=7973,p=i.getBCHDigit(o);function h(v,x,k){for(let _=1;_<=40;_++)if(x<=t.getCapacity(_,k,v))return _}function g(v,x){return c.getCharCountIndicator(v,x)+4}function b(v,x){let k=0;return v.forEach(function(_){const D=g(_.mode,x);k+=D+_.getBitsLength()}),k}function y(v,x){for(let k=1;k<=40;k++)if(b(v,k)<=t.getCapacity(k,x,c.MIXED))return k}t.from=function(x,k){return f.isValid(x)?parseInt(x,10):k},t.getCapacity=function(x,k,_){if(!f.isValid(x))throw new Error("Invalid QR Code version");typeof _>"u"&&(_=c.BYTE);const D=i.getSymbolTotalCodewords(x),R=l.getTotalCodewordsCount(x,k),z=(D-R)*8;if(_===c.MIXED)return z;const L=z-g(_,x);switch(_){case c.NUMERIC:return Math.floor(L/10*3);case c.ALPHANUMERIC:return Math.floor(L/11*2);case c.KANJI:return Math.floor(L/13);case c.BYTE:default:return Math.floor(L/8)}},t.getBestVersionForData=function(x,k){let _;const D=a.from(k,a.M);if(Array.isArray(x)){if(x.length>1)return y(x,D);if(x.length===0)return 1;_=x[0]}else _=x;return h(_.mode,_.getLength(),D)},t.getEncodedBits=function(x){if(!f.isValid(x)||x<7)throw new Error("Invalid QR Code version");let k=x<<12;for(;i.getBCHDigit(k)-p>=0;)k^=o<<i.getBCHDigit(k)-p;return x<<12|k}})(Fc)),Fc}var Kc={},Xg;function CS(){if(Xg)return Kc;Xg=1;const t=mr(),i=1335,l=21522,a=t.getBCHDigit(i);return Kc.getEncodedBits=function(f,o){const p=f.bit<<3|o;let h=p<<10;for(;t.getBCHDigit(h)-a>=0;)h^=i<<t.getBCHDigit(h)-a;return(p<<10|h)^l},Kc}var $c={},Zc,Kg;function ES(){if(Kg)return Zc;Kg=1;const t=gr();function i(l){this.mode=t.NUMERIC,this.data=l.toString()}return i.getBitsLength=function(a){return 10*Math.floor(a/3)+(a%3?a%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(a){let c,f,o;for(c=0;c+3<=this.data.length;c+=3)f=this.data.substr(c,3),o=parseInt(f,10),a.put(o,10);const p=this.data.length-c;p>0&&(f=this.data.substr(c),o=parseInt(f,10),a.put(o,p*3+1))},Zc=i,Zc}var Pc,$g;function NS(){if($g)return Pc;$g=1;const t=gr(),i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function l(a){this.mode=t.ALPHANUMERIC,this.data=a}return l.getBitsLength=function(c){return 11*Math.floor(c/2)+6*(c%2)},l.prototype.getLength=function(){return this.data.length},l.prototype.getBitsLength=function(){return l.getBitsLength(this.data.length)},l.prototype.write=function(c){let f;for(f=0;f+2<=this.data.length;f+=2){let o=i.indexOf(this.data[f])*45;o+=i.indexOf(this.data[f+1]),c.put(o,11)}this.data.length%2&&c.put(i.indexOf(this.data[f]),6)},Pc=l,Pc}var Jc,Zg;function AS(){if(Zg)return Jc;Zg=1;const t=gr();function i(l){this.mode=t.BYTE,typeof l=="string"?this.data=new TextEncoder().encode(l):this.data=new Uint8Array(l)}return i.getBitsLength=function(a){return a*8},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(l){for(let a=0,c=this.data.length;a<c;a++)l.put(this.data[a],8)},Jc=i,Jc}var Wc,Pg;function TS(){if(Pg)return Wc;Pg=1;const t=gr(),i=mr();function l(a){this.mode=t.KANJI,this.data=a}return l.getBitsLength=function(c){return c*13},l.prototype.getLength=function(){return this.data.length},l.prototype.getBitsLength=function(){return l.getBitsLength(this.data.length)},l.prototype.write=function(a){let c;for(c=0;c<this.data.length;c++){let f=i.toSJIS(this.data[c]);if(f>=33088&&f<=40956)f-=33088;else if(f>=57408&&f<=60351)f-=49472;else throw new Error("Invalid SJIS character: "+this.data[c]+`
|
|
23
|
-
Make sure your charset is UTF-8`);f=(f>>>8&255)*192+(f&255),a.put(f,13)}},Wc=l,Wc}var ef={exports:{}},Jg;function zS(){return Jg||(Jg=1,(function(t){var i={single_source_shortest_paths:function(l,a,c){var f={},o={};o[a]=0;var p=i.PriorityQueue.make();p.push(a,0);for(var h,g,b,y,v,x,k,_,D;!p.empty();){h=p.pop(),g=h.value,y=h.cost,v=l[g]||{};for(b in v)v.hasOwnProperty(b)&&(x=v[b],k=y+x,_=o[b],D=typeof o[b]>"u",(D||_>k)&&(o[b]=k,p.push(b,k),f[b]=g))}if(typeof c<"u"&&typeof o[c]>"u"){var R=["Could not find a path from ",a," to ",c,"."].join("");throw new Error(R)}return f},extract_shortest_path_from_predecessor_list:function(l,a){for(var c=[],f=a;f;)c.push(f),l[f],f=l[f];return c.reverse(),c},find_path:function(l,a,c){var f=i.single_source_shortest_paths(l,a,c);return i.extract_shortest_path_from_predecessor_list(f,c)},PriorityQueue:{make:function(l){var a=i.PriorityQueue,c={},f;l=l||{};for(f in a)a.hasOwnProperty(f)&&(c[f]=a[f]);return c.queue=[],c.sorter=l.sorter||a.default_sorter,c},default_sorter:function(l,a){return l.cost-a.cost},push:function(l,a){var c={value:l,cost:a};this.queue.push(c),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t.exports=i})(ef)),ef.exports}var Wg;function RS(){return Wg||(Wg=1,(function(t){const i=gr(),l=ES(),a=NS(),c=AS(),f=TS(),o=gb(),p=mr(),h=zS();function g(R){return unescape(encodeURIComponent(R)).length}function b(R,z,L){const G=[];let se;for(;(se=R.exec(L))!==null;)G.push({data:se[0],index:se.index,mode:z,length:se[0].length});return G}function y(R){const z=b(o.NUMERIC,i.NUMERIC,R),L=b(o.ALPHANUMERIC,i.ALPHANUMERIC,R);let G,se;return p.isKanjiModeEnabled()?(G=b(o.BYTE,i.BYTE,R),se=b(o.KANJI,i.KANJI,R)):(G=b(o.BYTE_KANJI,i.BYTE,R),se=[]),z.concat(L,G,se).sort(function(V,X){return V.index-X.index}).map(function(V){return{data:V.data,mode:V.mode,length:V.length}})}function v(R,z){switch(z){case i.NUMERIC:return l.getBitsLength(R);case i.ALPHANUMERIC:return a.getBitsLength(R);case i.KANJI:return f.getBitsLength(R);case i.BYTE:return c.getBitsLength(R)}}function x(R){return R.reduce(function(z,L){const G=z.length-1>=0?z[z.length-1]:null;return G&&G.mode===L.mode?(z[z.length-1].data+=L.data,z):(z.push(L),z)},[])}function k(R){const z=[];for(let L=0;L<R.length;L++){const G=R[L];switch(G.mode){case i.NUMERIC:z.push([G,{data:G.data,mode:i.ALPHANUMERIC,length:G.length},{data:G.data,mode:i.BYTE,length:G.length}]);break;case i.ALPHANUMERIC:z.push([G,{data:G.data,mode:i.BYTE,length:G.length}]);break;case i.KANJI:z.push([G,{data:G.data,mode:i.BYTE,length:g(G.data)}]);break;case i.BYTE:z.push([{data:G.data,mode:i.BYTE,length:g(G.data)}])}}return z}function _(R,z){const L={},G={start:{}};let se=["start"];for(let T=0;T<R.length;T++){const V=R[T],X=[];for(let q=0;q<V.length;q++){const E=V[q],U=""+T+q;X.push(U),L[U]={node:E,lastCount:0},G[U]={};for(let H=0;H<se.length;H++){const Z=se[H];L[Z]&&L[Z].node.mode===E.mode?(G[Z][U]=v(L[Z].lastCount+E.length,E.mode)-v(L[Z].lastCount,E.mode),L[Z].lastCount+=E.length):(L[Z]&&(L[Z].lastCount=E.length),G[Z][U]=v(E.length,E.mode)+4+i.getCharCountIndicator(E.mode,z))}}se=X}for(let T=0;T<se.length;T++)G[se[T]].end=0;return{map:G,table:L}}function D(R,z){let L;const G=i.getBestModeForData(R);if(L=i.from(z,G),L!==i.BYTE&&L.bit<G.bit)throw new Error('"'+R+'" cannot be encoded with mode '+i.toString(L)+`.
|
|
24
|
-
Suggested mode is: `+i.toString(G));switch(L===i.KANJI&&!p.isKanjiModeEnabled()&&(L=i.BYTE),L){case i.NUMERIC:return new l(R);case i.ALPHANUMERIC:return new a(R);case i.KANJI:return new f(R);case i.BYTE:return new c(R)}}t.fromArray=function(z){return z.reduce(function(L,G){return typeof G=="string"?L.push(D(G,null)):G.data&&L.push(D(G.data,G.mode)),L},[])},t.fromString=function(z,L){const G=y(z,p.isKanjiModeEnabled()),se=k(G),T=_(se,L),V=h.find_path(T.map,"start","end"),X=[];for(let q=1;q<V.length-1;q++)X.push(T.table[V[q]].node);return t.fromArray(x(X))},t.rawSplit=function(z){return t.fromArray(y(z,p.isKanjiModeEnabled()))}})($c)),$c}var ey;function DS(){if(ey)return Lc;ey=1;const t=mr(),i=Pf(),l=gS(),a=yS(),c=bS(),f=vS(),o=xS(),p=pb(),h=jS(),g=kS(),b=CS(),y=gr(),v=RS();function x(T,V){const X=T.size,q=f.getPositions(V);for(let E=0;E<q.length;E++){const U=q[E][0],H=q[E][1];for(let Z=-1;Z<=7;Z++)if(!(U+Z<=-1||X<=U+Z))for(let ee=-1;ee<=7;ee++)H+ee<=-1||X<=H+ee||(Z>=0&&Z<=6&&(ee===0||ee===6)||ee>=0&&ee<=6&&(Z===0||Z===6)||Z>=2&&Z<=4&&ee>=2&&ee<=4?T.set(U+Z,H+ee,!0,!0):T.set(U+Z,H+ee,!1,!0))}}function k(T){const V=T.size;for(let X=8;X<V-8;X++){const q=X%2===0;T.set(X,6,q,!0),T.set(6,X,q,!0)}}function _(T,V){const X=c.getPositions(V);for(let q=0;q<X.length;q++){const E=X[q][0],U=X[q][1];for(let H=-2;H<=2;H++)for(let Z=-2;Z<=2;Z++)H===-2||H===2||Z===-2||Z===2||H===0&&Z===0?T.set(E+H,U+Z,!0,!0):T.set(E+H,U+Z,!1,!0)}}function D(T,V){const X=T.size,q=g.getEncodedBits(V);let E,U,H;for(let Z=0;Z<18;Z++)E=Math.floor(Z/3),U=Z%3+X-8-3,H=(q>>Z&1)===1,T.set(E,U,H,!0),T.set(U,E,H,!0)}function R(T,V,X){const q=T.size,E=b.getEncodedBits(V,X);let U,H;for(U=0;U<15;U++)H=(E>>U&1)===1,U<6?T.set(U,8,H,!0):U<8?T.set(U+1,8,H,!0):T.set(q-15+U,8,H,!0),U<8?T.set(8,q-U-1,H,!0):U<9?T.set(8,15-U-1+1,H,!0):T.set(8,15-U-1,H,!0);T.set(q-8,8,1,!0)}function z(T,V){const X=T.size;let q=-1,E=X-1,U=7,H=0;for(let Z=X-1;Z>0;Z-=2)for(Z===6&&Z--;;){for(let ee=0;ee<2;ee++)if(!T.isReserved(E,Z-ee)){let W=!1;H<V.length&&(W=(V[H]>>>U&1)===1),T.set(E,Z-ee,W),U--,U===-1&&(H++,U=7)}if(E+=q,E<0||X<=E){E-=q,q=-q;break}}}function L(T,V,X){const q=new l;X.forEach(function(ee){q.put(ee.mode.bit,4),q.put(ee.getLength(),y.getCharCountIndicator(ee.mode,T)),ee.write(q)});const E=t.getSymbolTotalCodewords(T),U=p.getTotalCodewordsCount(T,V),H=(E-U)*8;for(q.getLengthInBits()+4<=H&&q.put(0,4);q.getLengthInBits()%8!==0;)q.putBit(0);const Z=(H-q.getLengthInBits())/8;for(let ee=0;ee<Z;ee++)q.put(ee%2?17:236,8);return G(q,T,V)}function G(T,V,X){const q=t.getSymbolTotalCodewords(V),E=p.getTotalCodewordsCount(V,X),U=q-E,H=p.getBlocksCount(V,X),Z=q%H,ee=H-Z,W=Math.floor(q/H),N=Math.floor(U/H),K=N+1,he=W-N,ge=new h(he);let j=0;const O=new Array(H),J=new Array(H);let A=0;const ae=new Uint8Array(T.buffer);for(let F=0;F<H;F++){const be=F<ee?N:K;O[F]=ae.slice(j,j+be),J[F]=ge.encode(O[F]),j+=be,A=Math.max(A,be)}const pe=new Uint8Array(q);let te=0,oe,we;for(oe=0;oe<A;oe++)for(we=0;we<H;we++)oe<O[we].length&&(pe[te++]=O[we][oe]);for(oe=0;oe<he;oe++)for(we=0;we<H;we++)pe[te++]=J[we][oe];return pe}function se(T,V,X,q){let E;if(Array.isArray(T))E=v.fromArray(T);else if(typeof T=="string"){let W=V;if(!W){const N=v.rawSplit(T);W=g.getBestVersionForData(N,X)}E=v.fromString(T,W||40)}else throw new Error("Invalid data");const U=g.getBestVersionForData(E,X);if(!U)throw new Error("The amount of data is too big to be stored in a QR Code");if(!V)V=U;else if(V<U)throw new Error(`
|
|
25
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
26
|
-
Minimum version required to store current data is: `+U+`.
|
|
27
|
-
`);const H=L(V,X,E),Z=t.getSymbolSize(V),ee=new a(Z);return x(ee,V),k(ee),_(ee,V),R(ee,X,0),V>=7&&D(ee,V),z(ee,H),isNaN(q)&&(q=o.getBestMask(ee,R.bind(null,ee,X))),o.applyMask(q,ee),R(ee,X,q),{modules:ee,version:V,errorCorrectionLevel:X,maskPattern:q,segments:E}}return Lc.create=function(V,X){if(typeof V>"u"||V==="")throw new Error("No input text");let q=i.M,E,U;return typeof X<"u"&&(q=i.from(X.errorCorrectionLevel,i.M),E=g.from(X.version),U=o.from(X.maskPattern),X.toSJISFunc&&t.setToSJISFunction(X.toSJISFunc)),se(V,E,q,U)},Lc}var tf={},nf={},ty;function yb(){return ty||(ty=1,(function(t){function i(l){if(typeof l=="number"&&(l=l.toString()),typeof l!="string")throw new Error("Color should be defined as hex string");let a=l.slice().replace("#","").split("");if(a.length<3||a.length===5||a.length>8)throw new Error("Invalid hex color: "+l);(a.length===3||a.length===4)&&(a=Array.prototype.concat.apply([],a.map(function(f){return[f,f]}))),a.length===6&&a.push("F","F");const c=parseInt(a.join(""),16);return{r:c>>24&255,g:c>>16&255,b:c>>8&255,a:c&255,hex:"#"+a.slice(0,6).join("")}}t.getOptions=function(a){a||(a={}),a.color||(a.color={});const c=typeof a.margin>"u"||a.margin===null||a.margin<0?4:a.margin,f=a.width&&a.width>=21?a.width:void 0,o=a.scale||4;return{width:f,scale:f?4:o,margin:c,color:{dark:i(a.color.dark||"#000000ff"),light:i(a.color.light||"#ffffffff")},type:a.type,rendererOpts:a.rendererOpts||{}}},t.getScale=function(a,c){return c.width&&c.width>=a+c.margin*2?c.width/(a+c.margin*2):c.scale},t.getImageWidth=function(a,c){const f=t.getScale(a,c);return Math.floor((a+c.margin*2)*f)},t.qrToImageData=function(a,c,f){const o=c.modules.size,p=c.modules.data,h=t.getScale(o,f),g=Math.floor((o+f.margin*2)*h),b=f.margin*h,y=[f.color.light,f.color.dark];for(let v=0;v<g;v++)for(let x=0;x<g;x++){let k=(v*g+x)*4,_=f.color.light;if(v>=b&&x>=b&&v<g-b&&x<g-b){const D=Math.floor((v-b)/h),R=Math.floor((x-b)/h);_=y[p[D*o+R]?1:0]}a[k++]=_.r,a[k++]=_.g,a[k++]=_.b,a[k]=_.a}}})(nf)),nf}var ny;function MS(){return ny||(ny=1,(function(t){const i=yb();function l(c,f,o){c.clearRect(0,0,f.width,f.height),f.style||(f.style={}),f.height=o,f.width=o,f.style.height=o+"px",f.style.width=o+"px"}function a(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(f,o,p){let h=p,g=o;typeof h>"u"&&(!o||!o.getContext)&&(h=o,o=void 0),o||(g=a()),h=i.getOptions(h);const b=i.getImageWidth(f.modules.size,h),y=g.getContext("2d"),v=y.createImageData(b,b);return i.qrToImageData(v.data,f,h),l(y,g,b),y.putImageData(v,0,0),g},t.renderToDataURL=function(f,o,p){let h=p;typeof h>"u"&&(!o||!o.getContext)&&(h=o,o=void 0),h||(h={});const g=t.render(f,o,h),b=h.type||"image/png",y=h.rendererOpts||{};return g.toDataURL(b,y.quality)}})(tf)),tf}var rf={},iy;function _S(){if(iy)return rf;iy=1;const t=yb();function i(c,f){const o=c.a/255,p=f+'="'+c.hex+'"';return o<1?p+" "+f+'-opacity="'+o.toFixed(2).slice(1)+'"':p}function l(c,f,o){let p=c+f;return typeof o<"u"&&(p+=" "+o),p}function a(c,f,o){let p="",h=0,g=!1,b=0;for(let y=0;y<c.length;y++){const v=Math.floor(y%f),x=Math.floor(y/f);!v&&!g&&(g=!0),c[y]?(b++,y>0&&v>0&&c[y-1]||(p+=g?l("M",v+o,.5+x+o):l("m",h,0),h=0,g=!1),v+1<f&&c[y+1]||(p+=l("h",b),b=0)):h++}return p}return rf.render=function(f,o,p){const h=t.getOptions(o),g=f.modules.size,b=f.modules.data,y=g+h.margin*2,v=h.color.light.a?"<path "+i(h.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",x="<path "+i(h.color.dark,"stroke")+' d="'+a(b,g,h.margin)+'"/>',k='viewBox="0 0 '+y+" "+y+'"',D='<svg xmlns="http://www.w3.org/2000/svg" '+(h.width?'width="'+h.width+'" height="'+h.width+'" ':"")+k+' shape-rendering="crispEdges">'+v+x+`</svg>
|
|
28
|
-
`;return typeof p=="function"&&p(null,D),D},rf}var ry;function OS(){if(ry)return il;ry=1;const t=mS(),i=DS(),l=MS(),a=_S();function c(f,o,p,h,g){const b=[].slice.call(arguments,1),y=b.length,v=typeof b[y-1]=="function";if(!v&&!t())throw new Error("Callback required as last argument");if(v){if(y<2)throw new Error("Too few arguments provided");y===2?(g=p,p=o,o=h=void 0):y===3&&(o.getContext&&typeof g>"u"?(g=h,h=void 0):(g=h,h=p,p=o,o=void 0))}else{if(y<1)throw new Error("Too few arguments provided");return y===1?(p=o,o=h=void 0):y===2&&!o.getContext&&(h=p,p=o,o=void 0),new Promise(function(x,k){try{const _=i.create(p,h);x(f(_,o,h))}catch(_){k(_)}})}try{const x=i.create(p,h);g(null,f(x,o,h))}catch(x){g(x)}}return il.create=i.create,il.toCanvas=c.bind(null,l.render),il.toDataURL=c.bind(null,l.renderToDataURL),il.toString=c.bind(null,function(f,o,p){return a.render(f,p)}),il}var LS=OS();const BS=ro(LS),US={openPage:"打开授权页面",waitingBrowser:"在服务商页面完成授权,返回后会自动确认连接。",deviceInstruction:"在授权页面输入此验证码:",copy:"复制验证码",submit:"验证并保存",verifyCode:"输入服务商提供的验证码",secondFactor:"完成服务商要求的追加验证",detectSession:"检查登录状态",bindSession:"使用这个账号",loginSession:"登录账号",notInstalled:"此环境尚未安装对应 CLI。",notAuthenticated:"请先在当前环境登录对应 CLI,再检查状态。",authenticated:"已登录",processing:"正在确认并保存连接…",connected:"连接已保存。",cancelled:"授权已取消。",failed:"授权未完成,请重新连接。",expired:"授权已过期,请重新连接。",unsupported:"当前客户端不支持这个授权步骤,请更新客户端。",invalidUrl:"授权地址无效,请检查服务配置。",scan:"使用服务商的手机应用扫描二维码。",confirmOnPhone:"已扫码,请在手机上确认。",qrExpired:"二维码已过期。",refreshQr:"刷新二维码",qrError:"无法显示二维码,请重试。",qrAlt:"服务商授权二维码",confirm:"确认授权",resourcesTruncated:"此列表仅显示部分资源,请缩小选择范围后继续。",expiresAt:"有效期至",rejected:"服务商未接受此凭据,请检查后重试。",cliUnavailable:"此环境没有可用的 CLI 登录,请检查登录状态或选择其他方式。"};function qS(t){const i={...US,...t.labels},l=mi(t.authorization),[a,c]=w.useState({}),[f,o]=w.useState({}),[p,h]=w.useState(),[g,b]=w.useState(!1),[y,v]=w.useState(Date.now()),x=Math.min(t.authorization.expiresAt?Date.parse(t.authorization.expiresAt):1/0,l?Date.parse(l.expiresAt):1/0),k=l?.kind==="qr-code"&&l.qr?Date.parse(l.qr.challengeExpiresAt):1/0,_=l?.kind==="qr-code"&&l.phase!=="expired"?l.qr?.payload:void 0;if(w.useEffect(()=>{c({}),o({})},[t.authorization.id,l?.id]),w.useEffect(()=>{v(Date.now());const T=[x,k].filter(V=>Number.isFinite(V)&&V>Date.now()).map(V=>setTimeout(()=>v(Date.now()),V-Date.now()+1));return()=>{for(const V of T)clearTimeout(V)}},[x,k]),w.useEffect(()=>{let T=!0;if(h(void 0),b(!1),!_||_.length>4096||k<=Date.now()){_&&_.length>4096&&b(!0);return}return BS.toDataURL(_,{width:220,margin:2,errorCorrectionLevel:"M"}).then(V=>{T&&h(V)}).catch(()=>{T&&b(!0)}),()=>{T=!1}},[_,k]),t.authorization.state!=="pending"){const T=t.authorization.state==="connected"?t.authorization.connection?i.connected:i.processing:t.authorization.state==="cancelled"?i.cancelled:t.authorization.errorCode==="authorization_expired"?i.expired:i.failed;return u.jsx("p",{className:"link-authorization-status",role:"status",children:T})}if(!l)return u.jsx("p",{role:"alert",children:i.unsupported});if(!Number.isFinite(x)||x<=y)return u.jsx("p",{className:"link-authorization-status",role:"status",children:i.expired});const D=!!t.busy,R=(T,V)=>t.onRespond({stepId:l.id,operation:T,...V?{input:V}:{}}),z=T=>{if(t.canOpenUrl===!1)return null;const V=F0(T);return V?u.jsxs("button",{type:"button",disabled:D,onClick:()=>t.onOpenUrl(V),children:[i.openPage," ↗"]}):u.jsx("p",{role:"alert",children:i.invalidUrl})},L=u.jsxs("p",{className:"link-authorization-expires",children:[i.expiresAt," ",new Date(x).toLocaleTimeString()]}),G=t.authorization.errorCode?u.jsx("p",{className:"link-authorization-error",role:"alert",children:t.authorization.errorCode==="provider_rejected"?i.rejected:t.authorization.errorCode==="cli_unavailable"?i.cliUnavailable:i.failed}):null,se=()=>{switch(l.kind){case"redirect":return u.jsxs("div",{className:"link-authorization-step",role:"status",children:[u.jsx("p",{children:i.waitingBrowser}),z(l.authorizationUrl),L]});case"device-code":return u.jsxs("div",{className:"link-authorization-step link-authorization-device",children:[u.jsx("p",{children:i.deviceInstruction}),u.jsx("strong",{className:"link-authorization-code",children:l.userCode}),u.jsxs("div",{className:"link-authorization-actions",children:[t.onCopy&&u.jsx("button",{type:"button",onClick:()=>t.onCopy?.(l.userCode),children:i.copy}),z(l.verificationUriComplete??l.verificationUri)]}),L]});case"qr-code":{const T=l.phase==="expired"||k<=y;return u.jsxs("div",{className:"link-authorization-step link-authorization-qr",children:[u.jsx("p",{role:"status",children:T?i.qrExpired:l.phase==="awaiting-confirmation"?i.confirmOnPhone:i.scan}),!T&&p&&u.jsx("img",{width:220,height:220,src:p,alt:i.qrAlt}),!T&&g&&u.jsx("p",{role:"alert",children:i.qrError}),!T&&l.qr?.instructions.map((V,X)=>u.jsx("p",{children:V},X)),l.canRefresh&&u.jsx("button",{type:"button",disabled:D,onClick:()=>R("refresh-qr"),children:i.refreshQr}),L]})}case"credential-input":return u.jsxs("form",{className:"link-authorization-step link-authorization-fields",onSubmit:T=>{if(T.preventDefault(),D)return;const V={};for(const X of l.fields)V[X.id]=a[X.id]??"";c({}),R("submit",V)},children:[l.purpose!=="credential"&&u.jsx("p",{children:l.purpose==="verification-code"?i.verifyCode:i.secondFactor}),l.fields.map(T=>u.jsxs("label",{children:[T.label,u.jsx("input",{name:T.id,type:T.secret?"password":"text",autoComplete:"off",spellCheck:!1,value:a[T.id]??"",placeholder:T.placeholder,maxLength:Math.min(T.maxLength??16384,16384),required:T.required,disabled:D,onChange:V=>c(X=>({...X,[T.id]:V.target.value}))})]},T.id)),u.jsx("button",{type:"submit",disabled:D||l.fields.some(T=>T.required&&!a[T.id]?.trim()),children:i.submit}),L]});case"local-session":return u.jsxs("div",{className:"link-authorization-step",children:[u.jsx("p",{role:"status",children:l.session.authenticated?`${i.authenticated}${l.session.account?`:${l.session.account}`:""}`:l.session.installed?i.notAuthenticated:i.notInstalled}),l.session.message&&u.jsx("p",{children:l.session.message}),u.jsxs("div",{className:"link-authorization-actions",children:[u.jsx("button",{type:"button",disabled:D,onClick:()=>R("detect-session"),children:i.detectSession}),!l.session.authenticated&&l.session.canLogin&&u.jsx("button",{type:"button",disabled:D,onClick:()=>R("login-session"),children:i.loginSession}),l.session.authenticated&&u.jsx("button",{type:"button",disabled:D,onClick:()=>R("bind-session"),children:i.bindSession})]}),L]});case"consent":{const T=f.permissions??l.permissions.filter(q=>q.required).map(q=>q.id),V=(q,E,U,H)=>o(Z=>({...Z,[q]:U?[...new Set([...H,E])]:H.filter(ee=>ee!==E)})),X=l.resourceGroups.some(q=>{const E=(f[q.id]??[]).length;return E<(q.minSelected??0)||E>(q.maxSelected??1/0)||q.truncated});return u.jsxs("form",{className:"link-authorization-step link-authorization-consent",onSubmit:q=>{q.preventDefault(),!D&&!X&&R("confirm",{...f,permissions:T})},children:[u.jsx("p",{children:u.jsx("strong",{children:l.account.label})}),u.jsx("div",{children:l.permissions.map(q=>u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:q.required||T.includes(q.id),disabled:D||q.required,onChange:E=>V("permissions",q.id,E.target.checked,T)}),q.label,q.description&&u.jsx("small",{children:q.description})]},q.id))}),l.resourceGroups.map(q=>u.jsxs("fieldset",{children:[u.jsx("legend",{children:q.label}),q.items.map(E=>u.jsxs("label",{children:[u.jsx("input",{type:"checkbox",checked:(f[q.id]??[]).includes(E.id),disabled:D,onChange:U=>V(q.id,E.id,U.target.checked,f[q.id]??[])}),E.label,E.description&&u.jsx("small",{children:E.description})]},E.id)),q.truncated&&u.jsx("p",{children:i.resourcesTruncated})]},q.id)),u.jsx("button",{type:"submit",disabled:D||X,children:i.confirm}),L]})}case"processing":return u.jsx("p",{className:"link-authorization-status",role:"status",children:i.processing});default:return u.jsx("p",{role:"alert",children:i.unsupported})}};return u.jsxs(u.Fragment,{children:[G,se()]})}const qn="/api/v1/links",IS={connected:"已连接",expired:"授权已过期",invalid:"需要重新连接",unavailable:"凭据不可用"};function rl(t){try{const i=new URL(t??"");return i.protocol==="https:"&&!i.username&&!i.password?i.href:void 0}catch{return}}function HS({onAuthLost:t,onDirtyChange:i,hostLabel:l="服务端",configurationVersion:a=0}){const[c,f]=w.useState(),[o,p]=w.useState(),[h,g]=w.useState(""),[b,y]=w.useState(""),[v,x]=w.useState(""),[k,_]=w.useState(!0),[D,R]=w.useState(!1),[z,L]=w.useState(),[G,se]=w.useState(),[T,V]=w.useState(),[X,q]=w.useState(),E=w.useRef(new Map),U=w.useRef(new Set),[H,Z]=w.useState(),ee=w.useMemo(()=>new K0({begin:async(M,$)=>{const me=$s(),{workspace:ve,projectId:Ce}=me,_e=await Ue(yt(`${qn}/authorizations`,ve,Ce),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...M,authModeId:$})},me);return E.current.set(_e.id,{target:yt(`${qn}/authorizations/${encodeURIComponent(_e.id)}`,ve,Ce),scope:me}),_e},status:M=>{const $=E.current.get(M);return Ue($.target,{},$.scope)},respond:(M,$)=>{const me=E.current.get(M),ve=new URL(me.target,window.location.origin);return ve.pathname+="/responses",Ue(ve.pathname+ve.search,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)},me.scope)},cancel:async M=>{if(U.current.has(M))return;const $=E.current.get(M);$&&(await Ue($.target,{method:"DELETE",keepalive:!0},$.scope),E.current.delete(M))}}),[]),W=w.useSyncExternalStore(ee.subscribe,ee.getSnapshot),N=c?.capabilities.authorizationSteps===1&&!!o?.provider.authModes,K=N&&W.authorization?.state==="pending",[he,ge]=w.useState(0),j=w.useRef(!1),O=w.useRef(0),J=w.useRef(null),A=w.useRef(void 0),ae=w.useRef(void 0),pe=w.useRef(void 0),te=w.useRef(void 0),oe=w.useRef({onAuthLost:t,onDirtyChange:i});oe.current={onAuthLost:t,onDirtyChange:i};const we=D||W.busy||K||T?.state==="pending"||!!(o&&(o.token||o.label!==(o.original?.label??o.provider.displayName))),F=w.useCallback(M=>{M instanceof Xe&&M.status===401?oe.current.onAuthLost():y(M instanceof Error?M.message:"连接操作失败,请重试。")},[]);w.useEffect(()=>{if(!o)return;const M=document.activeElement;return J.current?.querySelector("input:not(:disabled), button:not(:disabled)")?.focus(),()=>M?.focus?.()},[!!o]),w.useEffect(()=>{oe.current.onDirtyChange?.(we)},[we]),w.useEffect(()=>{j.current=!0;const M=++O.current;return()=>{j.current=!1,oe.current.onDirtyChange?.(!1),A.current?.abort(),queueMicrotask(()=>{O.current===M&&ee.dispose()}),ae.current&&Ue(ae.current,{method:"DELETE",keepalive:!0},pe.current).catch(()=>{})}},[ee]),w.useEffect(()=>{const M=new AbortController;return te.current=M,_(!0),Ue(qn,{signal:M.signal}).then($=>{M.signal.aborted||f($)}).catch($=>{M.signal.aborted||F($)}).finally(()=>{M.signal.aborted||_(!1)}),()=>M.abort()},[he,a,F]),w.useEffect(()=>{N&&(W.error&&F(W.error),W.authorization?.state==="connected"&&W.authorization.connection&&(p(void 0),x("授权完成,连接已保存。"),ge(M=>M+1)))},[N,W.authorization,W.error,F]),w.useEffect(()=>{if(!c?.remoteCleanupPending)return;const M=setInterval(()=>ge($=>$+1),3e4);return()=>clearInterval(M)},[c?.remoteCleanupPending]),w.useEffect(()=>{if(T?.state!=="pending"||!ae.current)return;const M=ae.current,$=pe.current,me=new AbortController;let ve;const Ce=async()=>{try{const _e=await Ue(M,{signal:me.signal},$);if(me.signal.aborted||ae.current!==M)return;V(_e),_e.state==="connected"?(ae.current=void 0,p(void 0),x("授权完成,连接已保存。"),ge(Ke=>Ke+1)):_e.state!=="pending"?(ae.current=void 0,y(_e.state==="cancelled"?"授权已取消。":"授权未完成或已过期,请重新开始。")):ve=setTimeout(()=>{Ce()},2e3)}catch(_e){if(me.signal.aborted||ae.current!==M)return;F(_e),_e instanceof Xe&&[401,404].includes(_e.status)?(ae.current=void 0,V(Ke=>Ke?{...Ke,state:"failed"}:void 0)):ve=setTimeout(()=>{Ce()},4e3)}};return ve=setTimeout(()=>{Ce()},1e3),()=>{me.abort(),clearTimeout(ve)}},[T?.id,T?.state,F]);async function be(M,$){if(A.current)return;const me=new AbortController;A.current=me,te.current?.abort(),R(!0),_(!1),y(""),x("");try{const ve=await M(me.signal);j.current&&!me.signal.aborted&&$(ve)}catch(ve){j.current&&!me.signal.aborted&&(F(ve),ve instanceof Xe&&[409,503].includes(ve.status)&&ge(Ce=>Ce+1))}finally{A.current===me&&(A.current=void 0),j.current&&R(!1)}}function Ee(M,$,me,ve,Ce){return Ue(M,{method:$,headers:{"Content-Type":"application/json"},body:JSON.stringify(me),signal:ve},Ce)}function Re(){return{providerId:o.provider.id,methodId:o.methodId,label:o.label.trim(),expectedRevision:o.original?.revision??null,...o.original?{connectionId:o.original.id}:{}}}function Qe(){p(void 0),se(void 0),x("连接已保存。"),ge(M=>M+1)}function Ve(M,$){if(D||W.busy||K||T?.state==="pending"||we&&!window.confirm("放弃当前未保存的连接修改?"))return;ee.reset();const me=$?Cc(M,$.methodId):Cc(M),ve=$?M.connectionMethods.find(_e=>_e.id===$.methodId):M.connectionMethods.find(_e=>_e.id===me?.methodId)??M.connectionMethods.find(_e=>_e.executionRuntime==="local"&&_e.availability==="available");if(!ve){y("当前环境未提供此连接的授权方式,请检查服务器连接设置。");return}const Ce={provider:M,original:$,methodId:ve.id,label:$?.label??M.displayName,token:""};p(Ce),se(void 0),V(void 0),q(me?.id),y(""),x(""),!$&&c?.capabilities.authorizationSteps===1&&me&&at(Ce,me)}async function at(M,$){if(!$.available||!M.label.trim()||ee.getSnapshot().authorization?.state==="pending"&&(await ee.cancel(),ee.getSnapshot().authorization?.state==="pending"))return;y(""),q($.id),p({...M,methodId:$.methodId});const me={workspace:Zs()??"",projectId:ma()},ve=await ee.begin({providerId:M.provider.id,methodId:$.methodId,label:M.label.trim(),expectedRevision:M.original?.revision??null,...M.original?{connectionId:M.original.id}:{}},$.id);if(!(ve?.state!=="pending"||mi(ve)?.kind!=="redirect"))try{if(c?.capabilities.browserHandoff===1){const Ke=E.current.get(ve.id),bt=new URL(Ke.target,window.location.origin);bt.pathname+="/browser";const ft=await Ue(bt.pathname+bt.search,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},Ke.scope),$e=new URL(ft.launchUrl);if($e.origin!==window.location.origin||$e.pathname!=="/link/authorize"||$e.username||$e.password||$e.hash||$e.searchParams.size!==1||!/^[A-Za-z0-9_-]{43}$/.test($e.searchParams.get("ticket")??""))throw new Error("授权浏览器入口无效,请重新连接。");ee.getSnapshot().authorization?.id===ve.id&&ee.getSnapshot().authorization?.state==="pending"&&Z({id:ve.id,url:$e.href});return}const Ce=c?.remoteServer?.issuer;if(!Ce)throw new Error("当前 Host 尚未配置授权服务。");const _e=P0(ve,Ce,me);U.current.add(ve.id),eS.flushSync(()=>{p(void 0),oe.current.onDirtyChange?.(!1)}),window.location.assign(_e)}catch(Ce){await ee.cancel(),F(Ce)}}async function st(){if(K){await ee.cancel(),ee.getSnapshot().authorization?.state==="cancelled"&&x("授权已取消。");return}if(!ae.current)return;const M=ae.current,$=pe.current;await be(me=>Ue(M,{method:"DELETE",signal:me},$),()=>{ae.current=void 0,V(void 0),x("授权已取消。")})}function pt(){N?ee.cancel().then(()=>{ee.getSnapshot().authorization?.state!=="pending"&&p(void 0)}):!Fe&&(!we||window.confirm("放弃未保存的连接修改?"))&&p(void 0)}function Nt(M,$=$s()){if(N&&ee.getSnapshot().authorization?.state==="pending"&&o?.original?.id===M.id){ee.cancel().then(()=>{ee.getSnapshot().authorization?.state!=="pending"&&Nt(M,$)});return}const me=o?.original?.id===M.id&&T?.state==="pending"?ae.current:void 0,ve=yt(`${qn}/connections/${encodeURIComponent(M.id)}`,$.workspace,$.projectId),Ce=pe.current;be(async _e=>{if(me){try{await Ue(me,{method:"DELETE",signal:_e},Ce)}catch(Ke){if(!(Ke instanceof Xe&&Ke.status===404))throw Ke}j.current&&!_e.aborted&&ae.current===me&&(ae.current=void 0,V(void 0))}return Ee(ve,"DELETE",{expectedRevision:M.revision},_e,$)},()=>{o?.original?.id===M.id&&p(void 0),L(void 0),ge(_e=>_e+1),x("连接已断开。")})}const qe=o?.provider.connectionMethods.find(M=>M.id===o.methodId),ct=T?.state==="pending",Fe=D||W.busy||ct||K,nt=h.trim().toLowerCase(),Dt=(c?.providers??[]).filter(M=>(c?.capabilities.authorizationSteps!==1||M.authModes?.some($=>$.available))&&`${M.displayName} ${M.description.zh}`.toLowerCase().includes(nt)),rt=o&&c?.connections.find(M=>o.original?M.id===o.original.id:M.id===`link-${o.provider.id}-${o.methodId}`&&M.providerId===o.provider.id&&M.methodId===o.methodId),wt=o&&c&&(o.original?rt?.revision!==o.original.revision:!!rt);return u.jsxs("section",{className:"hub-links",children:[u.jsxs("header",{className:"links-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:"Link"}),u.jsx("p",{children:"连接你的工具与账号,让任务访问已授权的服务。"})]}),u.jsx("button",{onClick:()=>{y(""),ge(M=>M+1)},disabled:D||k,children:"刷新"})]}),!!c?.remoteCleanupPending&&u.jsxs("p",{role:"status",className:"links-muted",children:["有 ",c.remoteCleanupPending," 项遗留授权等待撤销。项目所在环境 会自动重试,重启后仍会继续;也可在 Link 服务中撤销。"]}),u.jsxs("p",{className:"links-host",children:["连接由当前项目所属的",l,"管理,授权后只访问你允许的服务与资源。"]}),b&&u.jsx("p",{className:"form-error",role:"alert",children:b}),v&&u.jsx("p",{className:"links-notice",role:"status",children:v}),k&&!c&&u.jsx("p",{role:"status",children:"正在加载连接…"}),u.jsx("h2",{children:"已连接"}),c&&c.connections.length===0&&u.jsx("p",{className:"links-muted",children:"还没有连接。选择下面的服务开始。"}),u.jsx("div",{className:"links-connections",children:c?.connections.map(M=>{const $=c.providers.find(me=>me.id===M.providerId);return u.jsxs("article",{className:"links-connection",children:[u.jsxs("div",{children:[u.jsx("strong",{children:M.label}),u.jsxs("p",{children:[$?.displayName??M.providerId," ·"," ",M.account?.label??M.account?.id??"已授权账号"]}),u.jsx("span",{className:`links-state ${M.status==="connected"?"ready":""}`,children:IS[M.status]}),u.jsxs("small",{children:[M.authSource==="remote-link"?"独立 Link 授权":M.authSource==="cli-session"?"CLI 登录":M.authSource==="browser-oauth"?"浏览器授权":"Token",M.expiresAt?` · 到期 ${new Date(M.expiresAt).toLocaleString()}`:""]}),M.account?.resources.length?u.jsx("p",{children:M.account.resources.join("、")}):null]}),u.jsx("div",{className:"links-actions",children:M.editable?u.jsxs(u.Fragment,{children:[u.jsx("button",{disabled:Fe||!$,onClick:()=>$&&Ve($,M),children:"管理连接"}),u.jsx("button",{disabled:D,onClick:()=>L(M),children:"断开"})]}):u.jsx("small",{children:"项目配置管理"})})]},M.id)})}),z&&u.jsxs("div",{className:"links-confirm",role:"alertdialog","aria-label":"断开连接",children:[u.jsxs("p",{children:["断开「",z.label,"」后,后续任务将无法使用这个连接,正在执行的请求会尝试停止。"]}),u.jsx("button",{disabled:D,onClick:()=>Nt(z),children:"确认断开"}),u.jsx("button",{disabled:D,onClick:()=>L(void 0),children:"取消"})]}),o&&qe&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"links-editor-backdrop","aria-hidden":"true"}),u.jsxs("section",{className:"links-editor",ref:J,onKeyDown:M=>{if(M.key==="Escape"&&(M.preventDefault(),pt()),M.key!=="Tab")return;const $=J.current?.querySelectorAll("button:not(:disabled), input:not(:disabled), a[href], summary");if(!$?.length)return;const me=$[0],ve=$[$.length-1];M.shiftKey&&document.activeElement===me?(M.preventDefault(),ve.focus()):!M.shiftKey&&document.activeElement===ve&&(M.preventDefault(),me.focus())},role:"dialog","aria-modal":"true","aria-label":`${o.provider.displayName} 连接设置`,children:[u.jsxs("div",{className:"links-heading",children:[u.jsxs("h2",{children:[o.provider.displayName," · ",o.original?"管理连接":"添加连接"]}),u.jsx("button",{disabled:!N&&Fe,onClick:pt,children:"关闭"})]}),u.jsxs("label",{children:["连接名称",u.jsx("input",{maxLength:100,value:o.label,disabled:Fe,onChange:M=>p({...o,label:M.target.value})})]}),wt&&u.jsxs("div",{className:"links-conflict",role:"alert",children:[u.jsx("p",{children:"这个连接已在其他设备创建、修改或删除。你的输入仍然保留,请先载入最新版本。"}),u.jsx("button",{disabled:Fe,onClick:()=>p({...o,original:rt||void 0}),children:"载入最新版本,保留输入"})]}),N?u.jsxs("div",{className:"links-authorization",children:[u.jsx("p",{className:"links-muted",children:qe.executionRuntime==="server"?"由 Link 服务保存授权并访问已选择的资源。":`连接保存到当前项目所属的${l}。`}),W.authorization?u.jsx(qS,{authorization:W.authorization,busy:W.busy||!!wt||c?.capabilities.browserHandoff===1&&mi(W.authorization)?.kind==="redirect"&&H?.id!==W.authorization.id,onRespond:M=>{ee.respond(M)},onOpenUrl:M=>{const me=c?.capabilities.browserHandoff===1&&mi(W.authorization)?.kind==="redirect"?H&&H.id===W.authorization?.id?H.url:void 0:M;me&&window.open(me,"_blank","noopener,noreferrer")},onCopy:M=>{navigator.clipboard?.writeText(M).catch(F)}}):u.jsx("button",{disabled:W.busy||!!wt||!o.label.trim(),onClick:()=>{const M=o.provider.authModes?.find($=>$.id===X&&$.available)??Cc(o.provider,o.methodId);M&&at(o,M)},children:W.busy?"正在连接…":o.original?"重新连接":"开始连接"}),u.jsxs("div",{className:"links-actions",children:[K&&u.jsx("button",{disabled:W.busy,onClick:()=>{st()},children:"取消授权"}),W.authorization&&W.authorization.state!=="pending"&&u.jsx("button",{disabled:W.busy||!!wt||!o.label.trim(),onClick:()=>{const M=o.provider.authModes?.find($=>$.id===X&&$.available);M&&at(o,M)},children:"重新连接"})]}),u.jsxs("details",{className:"links-other-methods",children:[u.jsx("summary",{children:"其他连接方式"}),u.jsx("div",{className:"links-methods",children:o.provider.authModes?.map(M=>u.jsxs("button",{disabled:W.busy||!M.available||!!wt||!o.label.trim(),title:M.unavailableReason,onClick:()=>{at(o,M)},children:[M.label,M.id===X?" · 当前":""]},M.id))})]}),o.original&&u.jsx("button",{disabled:Fe||!!wt||!o.label.trim(),onClick:()=>{be(M=>Ee(`${qn}/connections/${encodeURIComponent(o.original.id)}`,"PATCH",{label:o.label.trim(),expectedRevision:o.original.revision},M),Qe)},children:"保存名称"})]}):u.jsxs(u.Fragment,{children:[qe.browserAuth&&u.jsxs("div",{className:"links-auth-option",children:[u.jsx("h3",{children:"浏览器授权"}),o.provider.deviceAuth?.configured?u.jsx("button",{disabled:Fe||!o.label.trim()||!!wt,onClick:()=>{const M=Zs()??"",$=ma(),me={workspace:M,projectId:$},ve=yt(`${qn}/authorizations/device`,M,$);be(Ce=>Ee(ve,"POST",Re(),Ce,me),Ce=>{ae.current=yt(`${qn}/authorizations/${encodeURIComponent(Ce.id)}`,M,$),pe.current=me,V(Ce)})},children:"开始授权"}):u.jsxs("p",{className:"links-muted",children:["这台",l,"尚未配置此服务的浏览器授权,可使用下面的连接方式。"]}),ct&&T.prompt&&u.jsxs("div",{className:"links-device-code",role:"status",children:[u.jsx("p",{children:"在服务商页面输入验证码:"}),u.jsx("strong",{children:T.prompt.userCode}),u.jsx("p",{children:rl(T.prompt.verificationUriComplete??T.prompt.verificationUri)&&u.jsx("a",{href:rl(T.prompt.verificationUriComplete??T.prompt.verificationUri),target:"_blank",rel:"noreferrer",children:"打开授权页面 ↗"})}),u.jsxs("p",{children:["完成后会自动保存。有效期至"," ",new Date(T.prompt.expiresAt).toLocaleTimeString(),"。"]}),u.jsx("button",{disabled:D,onClick:()=>{st()},children:"取消授权"})]})]}),qe.quickAuth&&u.jsxs("div",{className:"links-auth-option",children:[u.jsx("h3",{children:"使用已登录的 CLI"}),u.jsxs("p",{children:[l,"需要已安装并登录 ",qe.quickAuth.command,"。"]}),u.jsx("button",{disabled:Fe,onClick:()=>{be(M=>Ue(`${qn}/providers/${encodeURIComponent(o.provider.id)}/cli`,{signal:M}),se)},children:"检查登录状态"}),G&&u.jsx("p",{role:"status",children:G.authenticated?`已登录${G.account?`:${G.account}`:""}`:G.installed?"已安装,尚未登录。请在运行服务的机器上登录。":"尚未安装。"}),G?.authenticated&&u.jsx("button",{disabled:Fe||!o.label.trim()||!!wt,onClick:()=>{be(M=>Ee(`${qn}/connections/cli`,"POST",Re(),M),Qe)},children:"绑定这个登录"})]}),qe.authKind==="token"&&u.jsxs("form",{className:"links-auth-option",onSubmit:M=>{M.preventDefault(),!(Fe||wt)&&be($=>o.original&&!o.token.trim()?Ee(`${qn}/connections/${encodeURIComponent(o.original.id)}`,"PATCH",{label:o.label.trim(),expectedRevision:o.original.revision},$):Ee(`${qn}/connections/token`,"POST",{...Re(),token:o.token.trim()},$),Qe)},children:[u.jsx("h3",{children:o.original?"名称与 Token":"使用 Token"}),qe.authGuide&&u.jsxs(u.Fragment,{children:[u.jsx("p",{children:qe.authGuide.summary.zh}),u.jsxs("div",{className:"links-actions",children:[rl(qe.authGuide.createCredentialUrl)&&u.jsx("a",{href:rl(qe.authGuide.createCredentialUrl),target:"_blank",rel:"noreferrer",children:"创建凭据 ↗"}),rl(qe.authGuide.docsUrl)&&u.jsx("a",{href:rl(qe.authGuide.docsUrl),target:"_blank",rel:"noreferrer",children:"授权说明 ↗"})]}),u.jsxs("details",{children:[u.jsx("summary",{children:"所需权限与设置步骤"}),u.jsx("ul",{children:qe.authGuide.permissions.map(M=>u.jsxs("li",{children:[M.label,"(",M.level==="required"?"必需":"可选",")",M.description?`:${M.description.zh}`:""]},M.id))}),u.jsx("ol",{children:qe.authGuide.steps.map((M,$)=>u.jsx("li",{children:M.zh},$))})]})]}),u.jsxs("label",{children:[qe.tokenLabel??o.provider.tokenLabel,u.jsx("input",{type:"password",autoComplete:"off",value:o.token,disabled:Fe,placeholder:o.original?"留空保留当前授权,仅修改名称":qe.tokenPlaceholder??o.provider.tokenPlaceholder,onChange:M=>p({...o,token:M.target.value}),required:!o.original,maxLength:16384})]}),u.jsx("button",{type:"submit",className:"send",disabled:Fe||!!wt||!o.label.trim(),children:D?"正在验证并保存…":o.token.trim()||!o.original?"验证并保存":"保存名称"})]})]}),u.jsxs("details",{children:[u.jsxs("summary",{children:[N?"服务支持的操作":"可用操作","(",o.provider.actions.length,")"]}),N&&u.jsx("p",{className:"links-muted",children:"此连接实际可用的操作以授权时确认的权限为准。"}),u.jsx("ul",{children:o.provider.actions.map(M=>u.jsxs("li",{children:[u.jsx("strong",{children:M.title}),M.risk==="write"?" · 执行前需要确认":"",u.jsx("p",{children:M.description})]},M.id))})]})]})]}),u.jsxs("div",{className:"links-heading",children:[u.jsx("h2",{children:"添加服务"}),u.jsx("input",{type:"search","aria-label":"搜索 Link 服务",placeholder:"搜索服务",value:h,onChange:M=>g(M.target.value)})]}),u.jsx("div",{className:"links-providers",children:Dt.map(M=>{const $=c?.connections.find(me=>me.providerId===M.id);return u.jsxs("article",{className:"links-provider",children:[u.jsx("div",{className:`links-brand accent-${M.accent}`,"aria-hidden":"true",children:M.brandText}),u.jsx("h3",{children:M.displayName}),u.jsx("p",{children:M.description.zh}),u.jsxs("small",{children:[M.actions.length," 项操作"]}),u.jsx("button",{disabled:Fe||c?.capabilities.authorizationSteps!==1&&!!($&&!$.editable),onClick:()=>Ve(M,c?.capabilities.authorizationSteps===1?void 0:$),children:c?.capabilities.authorizationSteps===1?"添加连接":$?$.editable?"管理连接":"项目配置管理":"添加连接"})]},M.id)})}),c&&Dt.length===0&&u.jsx("p",{className:"links-muted",children:"没有匹配的服务。"})]})}const lf="/api/v1/panels",ly="https://github.com/cjhyy/codeshell-panel-apps.git",ay={"context.session":"读取当前对话信息","context.workspace":"读取当前工作区信息",storage:"保存面板自己的数据","external.open":"打开外部网页","agent.submitPrompt":"向当前对话提交任务","agent.task":"创建和管理 Agent 任务","workspace.info":"查看工作区信息","workspace.read":"读取工作区文件","workspace.write":"修改工作区文件","notifications.send":"发送通知","audio.transcribe":"将音频转成文字","credentials.cookies":"使用宿主授权的浏览器 Cookie","automations.manage":"管理自动化任务",process:"在宿主运行命令和进程",media:"处理宿主上的音视频文件","media.capture":"使用麦克风、摄像头或屏幕录制"};function In(t){return t["zh-CN"]||t.default}function Vs({value:t}){return t.supported&&t.reasons.length===0?null:u.jsxs("div",{className:"panels-warning",children:[u.jsx("strong",{children:t.supported?"部分功能可用":"当前 Web 工作台暂不支持此面板"}),t.supported&&u.jsx("p",{children:"可以打开面板,以下功能当前不可用或需要额外配置。"}),t.reasons.length>0&&u.jsx("ul",{children:t.reasons.map(i=>u.jsx("li",{children:i},i))})]})}function VS({onAuthLost:t,onDirtyChange:i,onChanged:l,onOpen:a,hostLabel:c="服务端",configurationVersion:f=0}){const[o,p]=w.useState(),[h,g]=w.useState(""),[b,y]=w.useState(""),[v,x]=w.useState(""),[k,_]=w.useState(""),[D,R]=w.useState(),[z,L]=w.useState(),[G,se]=w.useState(),[T,V]=w.useState(),[X,q]=w.useState(!1),[E,U]=w.useState(),[H,Z]=w.useState(),[ee,W]=w.useState(!1),[N,K]=w.useState(!0),[he,ge]=w.useState(!1),[j,O]=w.useState(),[J,A]=w.useState(!0),[ae,pe]=w.useState(""),[te,oe]=w.useState(""),[we,F]=w.useState(""),[be,Ee]=w.useState(0),Re=w.useRef(!1),Qe=w.useRef(void 0),Ve=w.useRef(void 0),at=w.useRef(!1),st=w.useRef(void 0),pt=w.useRef(null),Nt=w.useRef({onAuthLost:t,onDirtyChange:i,onChanged:l,onOpen:a});Nt.current={onAuthLost:t,onDirtyChange:i,onChanged:l,onOpen:a};function qe(B){fetch(B.target,{method:"DELETE",credentials:"same-origin",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewToken:B.token}),keepalive:!0,signal:AbortSignal.timeout(5e3)}).catch(()=>{})}const ct=!!(ae||z||G||H||j||h.trim()||b.trim()||v.trim()),Fe=w.useCallback(B=>{B instanceof Xe&&B.status===401?Nt.current.onAuthLost():oe(B instanceof Error?B.message:"面板操作失败,请重试。")},[]);w.useEffect(()=>(Re.current=!0,()=>{Re.current=!1,Qe.current?.abort(),Ve.current?.abort(),st.current&&(qe(st.current),st.current=void 0),Nt.current.onDirtyChange?.(!1)}),[]),w.useEffect(()=>{Nt.current.onDirtyChange?.(ct)},[ct]),w.useEffect(()=>{if(Qe.current){at.current=!0;return}const B=new AbortController;return Ve.current=B,A(!0),Ue(yt(lf),{signal:B.signal}).then(Ne=>{B.signal.aborted||p(Ne)}).catch(Ne=>{B.signal.aborted||Fe(Ne)}).finally(()=>{B.signal.aborted||A(!1)}),()=>B.abort()},[be,f,Fe]),w.useEffect(()=>{z&&pt.current?.focus()},[z?.reviewToken]);async function nt(B,Ne,dt,en,Zn=!1,Xi){if(Qe.current||!Re.current)return;const On=new AbortController;Qe.current=On,Ve.current?.abort(),A(!1),pe(B),oe(""),F("");const yi=yt(`${lf}${Ne}`);try{const Ft=await Ue(yi,{method:dt,headers:{"Content-Type":"application/json"},body:JSON.stringify(en),signal:On.signal});if(On.signal.aborted||!Re.current){Xi?.(Ft);return}return Zn&&(at.current=!0,Nt.current.onChanged?.()),Ft}catch(Ft){if(On.signal.aborted||!Re.current)return;Ft instanceof Xe&&(Ft.status===409||Ft.status===410)&&(z&&W(!0),T&&q(!0),at.current=!0),Fe(Ft);return}finally{Qe.current===On&&(Qe.current=void 0),Re.current&&!On.signal.aborted&&(pe(""),at.current&&(at.current=!1,Ee(Ft=>Ft+1)))}}const Dt=async B=>{if(!await Ke())return;se(void 0),V(void 0),Z(void 0),L(void 0),O(void 0),R(void 0);const Ne=await nt("正在读取仓库…","/github/discover","POST",{url:B.url,...B.ref?{ref:B.ref}:{},...B.subdir?{subdir:B.subdir}:{}});Ne&&R(Ne)},rt=async B=>{if(!await Ke())return;se(void 0),V(void 0);const Ne=await nt("正在准备安装审阅…","/preview","POST",{source:B});Ne&&(O(void 0),U(B),L(Ne),W(!1),ge(!1),K(!!o?.hasProject&&Ne.compatibility.supported))},wt=async B=>{if(!await Ke())return;se(void 0),V(void 0);const Ne=await nt("正在检查更新…",`/${encodeURIComponent(B.id)}/update-preview`,"POST",{expectedRevision:B.revision});Ne&&(O(void 0),U(void 0),L(Ne),W(!1),ge(B.bound),K(B.bound&&Ne.compatibility.supported))},M=()=>{if(z)if(z.kind==="update"){const B=o?.panels.find(Ne=>Ne.id===z.preview.id);B?wt(B):(oe("此面板已被卸载,请重新从 GitHub 选择安装。"),L(void 0))}else E&&rt(E)},$=()=>{Z(void 0),R(void 0),g(""),y(""),x("")},me=async()=>{if(L(void 0),!H||H.position+1>=H.candidates.length){$();return}const B=H.position+1;Z({...H,position:B}),await rt(H.candidates[B].source)},ve=async B=>{B.length&&(Z({candidates:B,position:0}),await rt(B[0].source))},Ce=async()=>{if(!z||ee)return;if(z.expiresAt<=Date.now()){W(!0),oe("安装审阅已过期,请重新审阅后继续。");return}await nt(z.kind==="update"?"正在更新面板…":"正在安装面板…","/install","POST",{reviewToken:z.reviewToken,bind:N},!0)&&(F(`${In(z.preview.title)} 已${z.kind==="update"?"更新":"安装"}${N?"并绑定当前工作区":""}。`),L(void 0),H?await me():$())},_e=async B=>{const Ne=await nt(B.bound?"正在解除绑定…":"正在绑定工作区…",`/${encodeURIComponent(B.id)}/binding`,"PATCH",{bound:!B.bound,expectedRevision:B.revision},!0);Ne&&(p(Ne),F(`${In(B.title)} 已${B.bound?"解除当前工作区绑定":"绑定当前工作区"}。`))},Ke=async()=>T?(await nt("正在关闭版本审阅…","/restore/review","DELETE",{reviewToken:T.reviewToken}))?.cancelled?(st.current=void 0,V(void 0),!0):!1:!0,bt=async()=>{await Ke()&&se(void 0)},ft=async B=>{if(!await Ke())return;L(void 0),O(void 0),V(void 0),se(void 0);const Ne=await nt("正在检查保留版本…",`/${encodeURIComponent(B.id)}/versions`,"POST",{expectedRevision:B.revision});Ne&&(se(Ne),q(!1))},$e=async B=>{if(!G||!await Ke())return;const Ne=yt(`${lf}/restore/review`),dt=await nt("正在审阅项目版本…",`/${encodeURIComponent(G.appId)}/restore-preview`,"POST",{packageDigest:B,expectedRevision:G.expectedRevision},!1,en=>qe({target:Ne,token:en.reviewToken}));if(dt){if(!Re.current){qe({target:Ne,token:dt.reviewToken});return}st.current={target:Ne,token:dt.reviewToken},V(dt),q(!1)}},Ze=async()=>{if(!T||ye)return;if(T.expiresAt<=Date.now()){q(!0),oe("版本审阅已过期,请重新选择版本。");return}await nt("正在恢复项目版本…","/restore","POST",{reviewToken:T.reviewToken},!0)&&(st.current=void 0,F(`${In(T.title)} 的项目版本已恢复为 v${T.version}。`),se(void 0),V(void 0))},Q=async()=>{if(!j||o?.panels.find(Ne=>Ne.id===j.id)?.revision!==j.revision)return;(await nt("正在卸载面板…",`/${encodeURIComponent(j.id)}`,"DELETE",{expectedRevision:j.revision},!0))?.removed&&(F(`${In(j.title)} 已卸载。`),O(void 0))},xe=!!ae||!o||!!H,ze=k.trim().toLowerCase(),re=(o?.panels??[]).filter(B=>[In(B.title),B.id,B.description??"",B.source.label].join(" ").toLowerCase().includes(ze)),je=D?.panels.filter(B=>!o?.panels.some(Ne=>Ne.id===B.id)&&!o?.issues?.some(Ne=>Ne.id===B.id)&&D.panels.filter(Ne=>Ne.id===B.id).length===1)??[],Be=j&&o?.panels.find(B=>B.id===j.id),ke=!!j&&Be?.revision!==j.revision,Ae=z?.kind==="update"?o?.panels.find(B=>B.id===z.preview.id):void 0,ye=X||!!G&&(o?.panels.find(B=>B.id===G.appId)?.revision??o?.issues?.find(B=>B.id===G.appId)?.revision)!==G.expectedRevision;return u.jsxs("section",{className:"hub-panels",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:"面板"}),u.jsx("p",{children:"从 GitHub 安装工具面板,绑定工作区后直接在工作台中打开。"})]}),u.jsx("button",{disabled:!!ae||J,onClick:()=>Ee(B=>B+1),children:J?"正在刷新…":"刷新"})]}),u.jsxs("p",{className:"panels-muted",children:["面板安装在",c,"上,文件和任务操作使用当前工作区。"]}),o&&!o.hasProject&&u.jsx("div",{className:"panels-warning",children:"请先选择一个项目,才能绑定和打开面板。"}),te&&u.jsx("p",{role:"alert",className:"error",children:te}),we&&u.jsx("p",{role:"status",className:"panels-notice",children:we}),ae&&u.jsx("p",{role:"status",className:"panels-muted",children:ae}),o?.issues?.filter(B=>B.id.toLowerCase().includes(ze)).map(B=>u.jsxs("section",{className:"panels-warning","aria-label":"需要修复的面板",children:[u.jsx("h2",{children:B.id}),u.jsxs("p",{children:["项目记录版本:",B.version??"未记录","。安装包缺失或无法校验,面板暂不可用。"]}),u.jsx("p",{children:"项目数据和任务记录仍保留。可检查宿主保留的版本,审阅权限后恢复。"}),u.jsx("button",{disabled:!!ae||!B.bound||!o.canRestorePackages,onClick:()=>{ft(B)},children:"检查可用版本"})]},B.id)),G&&u.jsxs("section",{className:"panels-review","aria-label":"项目保留版本",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsxs("h2",{children:[In(G.title)," · 项目版本"]}),u.jsxs("p",{children:["项目记录版本:",G.current.version]})]}),u.jsx("button",{disabled:!!ae,onClick:()=>{bt()},children:"关闭版本记录"})]}),u.jsx("p",{children:"选择宿主已保留的程序版本,仅切换当前项目。其他项目继续使用各自版本。"}),u.jsx("p",{className:"panels-warning",children:"切换程序版本不会恢复旧数据。请先备份项目,确认该版本支持当前文档格式;任务与产物记录会保留。"}),G.current.unavailable&&u.jsx("p",{role:"status",children:"当前安装包不可用,无法读取原权限;恢复前需重新审阅目标版本的全部权限。"}),G.unavailablePackages>0&&u.jsxs("p",{role:"status",children:["有 ",G.unavailablePackages," 个保留包无法校验,暂不能选择。"]}),!G.versions.length&&u.jsx("p",{children:"没有可用的保留版本。"}),u.jsx("div",{className:"panels-grid",children:G.versions.map(B=>u.jsxs("article",{className:"panels-card",children:[u.jsxs("h3",{children:["v",B.version]}),u.jsxs("small",{children:["内容编号 ",B.packageDigest.slice(0,12)]}),u.jsx(Vs,{value:B.compatibility}),u.jsx("button",{disabled:!!ae||!B.compatibility.supported||B.packageDigest===G.current.packageDigest,onClick:()=>{$e(B.packageDigest)},children:B.packageDigest===G.current.packageDigest?"当前项目版本":`审阅 v${B.version}`})]},B.packageDigest))}),T&&u.jsxs("section",{className:"panels-confirm","aria-label":"确认恢复项目版本",children:[u.jsxs("h3",{children:["v",T.current.version," → v",T.version]}),u.jsx("h4",{children:"此版本请求的权限"}),!T.permissions.length&&u.jsx("p",{children:"未申请宿主权限。"}),T.permissions.map(B=>u.jsxs("div",{className:"panels-permission",children:[u.jsx("span",{children:ay[B]??B}),T.addedPermissions.includes(B)&&u.jsx("strong",{children:T.current.unavailable?"需重新确认":"新增权限"})]},B)),u.jsx(Vs,{value:T.compatibility}),ye&&u.jsx("p",{role:"alert",children:"项目或审阅已变化,请关闭版本记录并重新读取。"}),u.jsx("button",{disabled:!!ae||ye||!T.compatibility.supported,onClick:()=>{Ze()},children:"确认权限并恢复项目版本"})]})]}),H&&u.jsxs("section",{className:"panels-confirm","aria-label":"逐个审阅面板",children:[u.jsxs("p",{children:["正在审阅第 ",H.position+1," / ",H.candidates.length," 个面板:",In(H.candidates[H.position].title),"。每个面板都需要单独确认安装。"]}),u.jsxs("div",{className:"panels-actions",children:[!z&&u.jsx("button",{disabled:!!ae,onClick:()=>{rt(H.candidates[H.position].source)},children:"重新读取此面板"}),u.jsx("button",{disabled:!!ae,onClick:()=>{me()},children:"跳过此面板"}),u.jsx("button",{disabled:!!ae,onClick:()=>{Z(void 0),L(void 0),oe("")},children:"取消逐个审阅"})]})]}),z&&u.jsxs("section",{className:"panels-review","aria-labelledby":"panel-review-heading",children:[u.jsxs("header",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{id:"panel-review-heading",ref:pt,tabIndex:-1,children:z.kind==="update"?"审阅面板更新":"审阅面板安装"}),u.jsxs("p",{children:[In(z.preview.title)," · ",z.preview.id," · v",z.preview.version]})]}),u.jsx("button",{disabled:!!ae,onClick:()=>{Z(void 0),L(void 0),oe("")},children:"取消审阅"})]}),z.preview.description&&u.jsx("p",{children:z.preview.description}),Ae&&u.jsxs("p",{className:"panels-warning",children:["当前版本 v",Ae.version," → 更新后 v",z.preview.version,Ae.source.commit&&u.jsxs(u.Fragment,{children:[u.jsx("br",{}),"当前提交 ",u.jsx("code",{children:Ae.source.commit.slice(0,12)})," → 更新提交"," ",u.jsx("code",{children:z.source.commit.slice(0,12)})]})]}),u.jsxs("section",{children:[u.jsx("h3",{children:"安装来源"}),u.jsxs("dl",{children:[u.jsx("dt",{children:"仓库"}),u.jsx("dd",{children:z.source.url}),u.jsx("dt",{children:"分支 / 标签"}),u.jsx("dd",{children:z.source.ref}),u.jsx("dt",{children:"已锁定提交"}),u.jsx("dd",{children:u.jsx("code",{children:z.source.commit})}),u.jsx("dt",{children:"面板目录"}),u.jsx("dd",{children:z.source.subdir||"仓库根目录"}),u.jsx("dt",{children:"界面入口"}),u.jsx("dd",{children:u.jsx("code",{children:z.preview.entry})})]})]}),u.jsxs("section",{children:[u.jsx("h3",{children:"面板请求的权限"}),z.preview.permissions.length===0?u.jsx("p",{className:"panels-muted",children:"未申请宿主权限。"}):z.preview.permissions.map(B=>u.jsxs("div",{className:"panels-permission",children:[u.jsx("span",{children:ay[B]??B}),u.jsx("small",{children:B})]},B))]}),u.jsxs("section",{children:[u.jsx("h3",{children:"随面板安装的工具与 Skills"}),z.preview.agent?.tools.length||z.preview.agent?.skills.length?u.jsxs("div",{className:"panels-badges",children:[z.preview.agent?.tools.map(B=>u.jsxs("span",{className:"panels-badge",title:B.description,children:[B.name," · ",B.readOnly?"只读":"可修改数据"]},B.name)),z.preview.agent?.skills.map(B=>u.jsxs("span",{className:"panels-badge",children:["Skill · ",B.split("/").at(-2)??B]},B))]}):u.jsx("p",{className:"panels-muted",children:"此面板没有额外的 Agent 工具或 Skills。"})]}),u.jsx(Vs,{value:z.compatibility}),z.preview.warnings.length>0&&u.jsx("div",{className:"panels-warning",children:u.jsx("ul",{children:z.preview.warnings.map(B=>u.jsx("li",{children:B},B))})}),u.jsxs("footer",{children:[!z.compatibility.supported&&u.jsxs("p",{className:"panels-muted",children:["可以安装到",c,",但当前 Web 工作台无法绑定或打开它。"]}),he?u.jsx("p",{className:"panels-muted",children:"已绑定当前工作区,更新将保留绑定。"}):u.jsxs("label",{className:"panels-check",children:[u.jsx("input",{type:"checkbox",checked:N,disabled:!!ae||!o?.hasProject||!z.compatibility.supported,onChange:B=>K(B.target.checked)}),"绑定当前工作区"]}),ee?u.jsxs("div",{className:"panels-actions",children:[u.jsx("span",{className:"panels-muted",children:"安装内容或本地版本已变化,请重新审阅。"}),u.jsx("button",{disabled:!!ae,onClick:M,children:"重新审阅"})]}):u.jsx("button",{className:"panels-primary",disabled:!!ae,onClick:()=>{Ce()},children:z.kind==="update"?"确认更新":"确认安装"})]})]}),u.jsxs("section",{className:"panels-section","aria-labelledby":"installed-panels-heading",children:[u.jsxs("div",{className:"panels-heading",children:[u.jsxs("h2",{id:"installed-panels-heading",children:["已安装面板",o?` · ${o.panels.length+(o.issues?.length??0)}`:""]}),u.jsx("input",{type:"search","aria-label":"搜索已安装面板",placeholder:"搜索已安装面板",value:k,onChange:B=>_(B.target.value)})]}),!o&&u.jsx("p",{className:"panels-muted",children:J?"正在读取面板…":"暂时无法读取面板,请刷新重试。"}),o&&re.length===0&&!o.issues?.some(B=>B.id.toLowerCase().includes(ze))&&u.jsxs("div",{className:"panels-empty",children:[u.jsx("strong",{children:o.panels.length||o.issues?.length?"没有匹配的面板":"还没有安装面板"}),u.jsx("p",{className:"panels-muted",children:o.panels.length||o.issues?.length?"试试其他名称或清除搜索。":"在下方粘贴 GitHub 仓库地址,或浏览官方面板仓库。"})]}),u.jsx("div",{className:"panels-grid",children:re.map(B=>u.jsxs("article",{className:"panels-card",children:[u.jsxs("div",{className:"panels-card-heading",children:[u.jsx("h3",{children:In(B.title)}),u.jsxs("span",{className:"panels-badge",children:["v",B.version]})]}),u.jsx("small",{children:B.id}),B.description&&u.jsx("p",{children:B.description}),u.jsx("div",{className:"panels-badges",children:u.jsx("span",{className:`panels-badge ${B.enabled&&B.compatibility.supported?"panels-badge-ready":""}`,children:B.globalDisabled?"已全局停用":B.bound?"已绑定当前工作区":"未绑定当前工作区"})}),u.jsxs("dl",{children:[u.jsx("dt",{children:"来源"}),u.jsx("dd",{children:B.source.label}),B.source.ref&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"分支 / 标签"}),u.jsx("dd",{children:B.source.ref})]})]}),u.jsx(Vs,{value:B.compatibility}),B.globalDisabled&&u.jsx("p",{className:"panels-muted",children:"请在宿主配置中启用此面板后使用。"}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{className:"panels-primary",disabled:xe||!B.enabled||!B.compatibility.supported,onClick:()=>Nt.current.onOpen(B),children:"打开面板"}),u.jsx("button",{disabled:xe||!o?.hasProject||!B.bound&&(B.globalDisabled||!B.compatibility.supported),onClick:()=>{_e(B)},children:B.bound?"解除绑定":"绑定工作区"}),B.updatable&&u.jsx("button",{disabled:xe,onClick:()=>{wt(B)},children:"检查更新"}),o?.canRestorePackages&&B.bound&&u.jsx("button",{disabled:xe,onClick:()=>{ft(B)},children:"项目版本"}),u.jsx("button",{className:"panels-danger",disabled:xe,onClick:async()=>{!await Ke()||!Re.current||(O(B),L(void 0),se(void 0),V(void 0),oe(""),F(""))},children:"卸载"})]})]},B.id))}),j&&u.jsxs("section",{className:"panels-confirm","aria-label":"确认卸载面板",children:[u.jsxs("p",{children:["卸载「",In(j.title),"」v",j.version,"?面板将从",c,"移除,其他工作区也将无法打开它。"]}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{disabled:!!ae,onClick:()=>O(void 0),children:"取消卸载"}),ke&&u.jsx("span",{className:"panels-muted",children:Be?"面板已被其他设备修改,请查看最新版本后重新确认。":"此面板已被其他设备卸载。"}),ke&&Be&&u.jsx("button",{disabled:!!ae||J,onClick:()=>{O(Be),oe("")},children:"查看最新版本"}),u.jsx("button",{className:"panels-danger",disabled:!!ae||J||ke,onClick:()=>{Q()},children:"确认卸载"})]})]})]}),u.jsxs("section",{className:"panels-import panels-section","aria-labelledby":"github-panels-heading",children:[u.jsxs("div",{className:"panels-heading",children:[u.jsxs("div",{children:[u.jsx("h2",{id:"github-panels-heading",children:"从 GitHub 安装"}),u.jsx("p",{children:"先读取仓库并选择面板,再查看安装内容和所需权限。"})]}),u.jsx("button",{disabled:xe,onClick:()=>{g(ly),y(""),x(""),Dt({url:ly})},children:"浏览官方仓库"})]}),u.jsxs("form",{onSubmit:B=>{B.preventDefault(),h.trim()&&Dt({url:h.trim(),...b.trim()?{ref:b.trim()}:{},...v.trim()?{subdir:v.trim()}:{}})},children:[u.jsxs("label",{children:["GitHub 仓库地址",u.jsx("input",{type:"url",placeholder:"https://github.com/owner/repository",value:h,required:!0,disabled:!!ae||!!H,onChange:B=>{g(B.target.value),R(void 0)}})]}),u.jsxs("details",{children:[u.jsx("summary",{children:"指定分支或子目录"}),u.jsxs("div",{className:"panels-source-fields",children:[u.jsxs("label",{children:["分支 / 标签(可选)",u.jsx("input",{value:b,placeholder:"使用默认分支",disabled:!!ae||!!H,onChange:B=>{y(B.target.value),R(void 0)}})]}),u.jsxs("label",{children:["子目录(可选)",u.jsx("input",{value:v,placeholder:"例如 apps/my-panel",disabled:!!ae||!!H,onChange:B=>{x(B.target.value),R(void 0)}})]})]})]}),u.jsxs("div",{className:"panels-actions",children:[u.jsx("button",{type:"submit",disabled:xe||!h.trim(),children:"读取仓库"}),(h||b||v||D)&&u.jsx("button",{type:"button",disabled:!!ae,onClick:()=>{$(),L(void 0)},children:"清除"})]})]}),D&&u.jsxs("div",{className:"panels-candidates",children:[u.jsxs("h3",{children:["找到 ",D.panels.length," 个面板"]}),u.jsxs("p",{className:"panels-muted",children:[D.source.url," · ",D.source.ref," ·"," ",u.jsx("code",{children:D.source.commit.slice(0,12)})]}),D.panels.length===0&&u.jsx("p",{className:"panels-muted",children:"仓库中没有找到可安装的面板。请检查地址和子目录。"}),je.length>1&&u.jsxs("div",{className:"panels-actions panels-batch-start",children:[u.jsxs("button",{disabled:xe,onClick:()=>{ve(je)},children:["逐个审阅未安装面板(",je.length,")"]}),u.jsx("small",{children:"按顺序确认,可随时跳过或停止。"})]}),u.jsx("div",{className:"panels-grid",children:D.panels.map(B=>{const Ne=o?.panels.find(dt=>dt.id===B.id);return u.jsxs("article",{className:"panels-card",children:[u.jsxs("div",{className:"panels-card-heading",children:[u.jsx("h3",{children:In(B.title)}),u.jsxs("span",{className:"panels-badge",children:["v",B.version]})]}),B.description&&u.jsx("p",{children:B.description}),u.jsx("small",{children:B.subdir==="."?"仓库根目录":B.subdir}),u.jsx("div",{className:"panels-actions",children:u.jsx("button",{disabled:xe||!!(Ne&&!Ne.updatable),onClick:()=>Ne?void wt(Ne):void rt(B.source),children:Ne?Ne.updatable?"已安装 · 检查更新":"已从其他来源安装":"审阅安装"})})]},`${B.id}:${B.subdir}`)})}),D.issues.length>0&&u.jsxs("div",{className:"panels-warning",children:[u.jsx("strong",{children:"部分目录无法作为面板安装"}),u.jsx("ul",{children:D.issues.map(B=>u.jsxs("li",{children:[B.subdir,":",B.error]},B.subdir))})]})]})]})]})}function YS(t){const i=t.projectId===void 0?ma():t.projectId,l=`/api/v1/panels/runtime/${encodeURIComponent(t.instanceId)}`,a=new Set,c=new Set;let f=!1,o=t.expiresAt,p=o-6e4,h,g=0,b=0,y=0,v,x;const k=(E,U)=>{const H=setTimeout(()=>{a.delete(H),f||E()},Math.max(0,Math.min(U,2147483647)));return a.add(H),H},_=E=>{E!==void 0&&(clearTimeout(E),a.delete(E))},D=()=>{if(!f){f=!0;for(const E of a)clearTimeout(E);a.clear();for(const E of c)E.abort();c.clear()}},R=E=>{f||(D(),t.onTerminal(E))},z=()=>R(new Error("面板连接已到期,请重新打开继续使用。")),L=E=>E instanceof Xe&&[401,403,410].includes(E.status),G=()=>{f||t.onStatus(g||b?"面板连接暂时中断,正在重试;当前内容会保留。":"")},se=async(E,U="GET")=>{const H=new AbortController;c.add(H);const Z=k(()=>H.abort(),8e3);try{return await Ue(yt(`${l}${E}`,t.workspace,i),{method:U,...U==="POST"?{headers:{"Content-Type":"application/json"},body:"{}"}:{},signal:H.signal})}finally{_(Z),c.delete(H)}},T=()=>{_(v),v=k(()=>{Date.now()>=o?z():T()},o-Date.now())},V=()=>{_(x),g<5&&(x=k(X,p-Date.now()))};function X(){if(!f){if(Date.now()>=o){z();return}h||g>=5||Date.now()<p||(h=(async()=>{try{const E=await se("/renew","POST");if(f)return;if(!E||typeof E!="object"||!("expiresAt"in E)||typeof E.expiresAt!="number"||!Number.isFinite(E.expiresAt)||E.expiresAt<=Date.now()+6e4)throw new Error("面板续期响应无效。");o=E.expiresAt,p=o-6e4,g=0,T(),G()}catch(E){if(f)return;if(L(E)){R(E);return}g++,p=Date.now()+Math.min(5e3*2**(g-1),3e4),G()}finally{h=void 0,f||V()}})())}}async function q(){try{const E=await se(`/events?after=${y}`);if(f)return;if(!E||typeof E!="object"||!("cursor"in E)||!("events"in E))throw new Error("面板事件响应无效。");if(!Number.isSafeInteger(E.cursor)||E.cursor<y||!Array.isArray(E.events)||E.events.length>2048)throw new Error("面板事件响应无效。");const U=[];let H=y;for(const Z of E.events){if(!Z||typeof Z!="object"||!Number.isSafeInteger(Z.id)||Z.id<=H||Z.id>E.cursor||typeof Z.event!="string"||!/^[A-Za-z][A-Za-z0-9._-]{0,100}$/.test(Z.event))throw new Error("面板事件响应无效。");H=Z.id,U.push(Z)}t.onEvents(U),y=E.cursor,b=0,G()}catch(E){if(f)return;if(L(E)){R(E);return}b++,G()}finally{f||k(()=>{q()},Math.min(1e3*2**b,5e3))}}return T(),V(),q(),{stop:D,refresh:X}}function GS(t){if(!Number.isInteger(t.maxDurationSeconds)||t.maxDurationSeconds<1||t.maxDurationSeconds>600||!Number.isInteger(t.maxBytes)||t.maxBytes<1||t.maxBytes>25*1024*1024)throw new Error("录音限制无效。");let i={phase:"idle",elapsedSeconds:0,message:"点击开始录音后,浏览器才会请求麦克风。"},l=0,a,c,f,o=[],p=0,h="",g=t.signal.aborted;const b=k=>{i={...i,...k},g||t.onChange({...i})},y=()=>{a?.getTracks().forEach(k=>k.stop()),a=void 0,f&&clearInterval(f),f=void 0},v=()=>{try{c?.state!=="inactive"&&c?.stop()}finally{y()}},x=()=>{if(!g){g=!0,l++,c&&(c.ondataavailable=null,c.onstop=null,c.onerror=null);try{v()}finally{y()}o=[],i={phase:"closed",elapsedSeconds:0,message:"录音已关闭。"},t.signal.removeEventListener("abort",x)}};return g?i={phase:"closed",elapsedSeconds:0,message:"录音授权已结束。"}:t.signal.addEventListener("abort",x,{once:!0}),{snapshot:()=>({...i}),async start(){if(g||t.signal.aborted)throw new Error("录音授权已结束。");if(["requesting","recording"].includes(i.phase))throw new Error("已有录音正在进行。");const k=++l,_=()=>!g&&k===l&&!t.signal.aborted;o=[],p=0,h="",b({phase:"requesting",elapsedSeconds:0,blob:void 0,message:"正在等待麦克风授权…"});try{const D=await(t.getStream?t.getStream():navigator.mediaDevices.getUserMedia({audio:!0,video:!1}));if(!_()){D.getTracks().forEach(G=>G.stop());return}a=D;const R=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/ogg;codecs=opus"].find(G=>typeof MediaRecorder<"u"&&MediaRecorder.isTypeSupported(G));c=t.makeRecorder?t.makeRecorder(a):new MediaRecorder(a,{...R?{mimeType:R}:{},audioBitsPerSecond:128e3});const z=c;z.ondataavailable=G=>{!_()||!G.data.size||(o.push(G.data),p+=G.data.size,p>t.maxBytes&&(h="录音超过大小限制;可以下载备份,或重新录制较短的音频。",v()))},z.onerror=()=>{if(_()){h="录音设备发生错误;请检查麦克风后重新录制。";try{v()}catch{y()}b({phase:"error",message:h})}},z.onstop=()=>{if(!_())return;y();const G=new Blob(o,{type:z.mimeType.split(";")[0]||"audio/webm"});o=[],b({phase:G.size&&!h?"review":"error",blob:G.size?G:void 0,message:h||(G.size?"录音已停止。可以试听,再保存到当前项目。":"没有录到声音,请重新录制。")})};const L=Date.now();z.start(250),b({phase:"recording",message:"正在使用这台设备的麦克风录音。"}),f=setInterval(()=>{if(!_())return;const G=Math.floor((Date.now()-L)/1e3);b({elapsedSeconds:G}),G>=t.maxDurationSeconds&&v()},250)}catch(D){if(y(),!_())return;b({phase:"error",message:D instanceof Error&&["NotAllowedError","SecurityError"].includes(D.name)?"麦克风未获授权,请检查浏览器和系统的麦克风权限。":"无法启动录音,请确认安全连接、麦克风和浏览器录音支持。"})}},stop:v,close:x}}function FS(t){let i,l=!1,a;const c=()=>t.signal.throwIfAborted(),f=async(p,h)=>{c();const g=await t.call(p,h);return c(),g},o=p=>{const h=p;if(!h||typeof h.sessionId!="string"||!/^upload-[a-f0-9-]{36}$/.test(h.sessionId)||i&&i!==h.sessionId||h.mimeType!==t.blob.type||!["uploading","finished"].includes(String(h.state))||!Number.isSafeInteger(h.receivedBytes)||Number(h.receivedBytes)<0||Number(h.receivedBytes)>t.blob.size||!Number.isSafeInteger(h.nextSequence)||Number(h.nextSequence)<0||!Number.isSafeInteger(h.maxChunkBytes)||Number(h.maxChunkBytes)<1||Number(h.maxChunkBytes)>32768)throw new Error("录音上传状态无效,请保留本机备份后重新打开面板。");return h};return{async save(){if(c(),l)throw new Error("录音正在保存,请稍候。");if(!t.blob.size||t.blob.size>25*1024*1024||!["audio/webm","audio/mp4","audio/ogg","audio/wav"].includes(t.blob.type))throw new Error("录音格式或大小无效。");l=!0;try{if(!a){const g=await t.blob.arrayBuffer();c(),a=Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",g)),b=>b.toString(16).padStart(2,"0")).join(""),c()}let p=o(i?await f("resources.upload.get",{sessionId:i}):await f("resources.upload.begin",{name:t.name,mimeType:t.blob.type,expectedBytes:t.blob.size,expectedSha256:a}));for(i=p.sessionId,t.onProgress(p.receivedBytes);p.receivedBytes<t.blob.size;){if(p.state!=="uploading")throw new Error("录音上传已结束,文件大小不匹配。");const g=p.receivedBytes,b=new Uint8Array(await t.blob.slice(g,g+p.maxChunkBytes).arrayBuffer());c();const y=o(await f("resources.upload.write",{sessionId:i,sequence:p.nextSequence,offset:g,dataBase64:btoa(String.fromCharCode(...b))}));if(y.receivedBytes!==g+b.length||y.nextSequence!==p.nextSequence+1)throw new Error("录音上传进度不匹配,请重试保存以核对服务端状态。");p=y,t.onProgress(p.receivedBytes)}const h=await f("resources.upload.finish",{sessionId:i});if(!h?.asset||h.asset.id!==`asset-${a}`||h.asset.bytes!==t.blob.size||h.asset.mimeType!==t.blob.type)throw new Error("录音保存回执不匹配,请保留本机备份并重试。");return h}finally{l=!1}}}}function QS({request:t}){const[i,l]=w.useState({phase:"idle",elapsedSeconds:0,message:"点击开始录音后,浏览器才会请求麦克风。"}),[a,c]=w.useState(""),[f,o]=w.useState(!1),[p,h]=w.useState(0),[g,b]=w.useState(""),y=w.useRef(null),v=w.useRef(void 0),x=w.useRef(void 0),k=w.useRef(void 0);w.useEffect(()=>{const R=new AbortController;k.current=R;const z=AbortSignal.any([t.signal,R.signal]);return v.current=GS({...t,signal:z,onChange:l}),y.current?.focus(),y.current?.scrollIntoView?.({block:"nearest"}),()=>{R.abort(),v.current?.close(),v.current=void 0,x.current=void 0}},[t]),w.useEffect(()=>{if(!i.blob){b("");return}const R=URL.createObjectURL(i.blob);return b(R),()=>URL.revokeObjectURL(R)},[i.blob]);const _=i.blob?.type==="audio/mp4"?"m4a":i.blob?.type==="audio/ogg"?"ogg":"webm",D=async()=>{const R=i.blob,z=k.current;if(!R||!z||f||i.phase!=="review")return;const L=AbortSignal.any([t.signal,z.signal]);o(!0),c("");try{x.current?.blob!==R&&(x.current={blob:R,transfer:FS({blob:R,name:`recording.${_}`,signal:L,call:(se,T)=>t.call(se,T,L),onProgress:h})});const G=await x.current.transfer.save();L.throwIfAborted(),t.finish(G)}catch(G){L.aborted||c(`${G instanceof Error?G.message:"保存失败。"} 录音仍保留在本页,可重试保存或下载备份。`)}finally{L.aborted||o(!1)}};return u.jsxs("section",{className:"panel-host-audio panel-host-preview","aria-label":"录音",tabIndex:-1,ref:y,children:[u.jsxs("header",{children:[u.jsx("h2",{children:"录音并保存到当前项目"}),u.jsx("button",{onClick:()=>t.finish({cancelled:!0}),children:"取消录音"})]}),u.jsxs("p",{children:["使用当前设备的麦克风;最长 ",t.maxDurationSeconds," ","秒。停止后可试听,点击保存才会上传到当前项目。关闭面板会丢弃未保存录音。"]}),u.jsxs("p",{role:"status",children:[i.message," ",i.elapsedSeconds>0&&`${i.elapsedSeconds} 秒`]}),g&&u.jsx("audio",{controls:!0,src:g}),a&&u.jsx("p",{role:"alert",children:a}),f&&u.jsxs("p",{role:"status",children:["正在保存录音:",Math.round(p/(i.blob?.size||1)*100),"%"]}),u.jsxs("div",{className:"panel-host-actions",children:[["idle","error"].includes(i.phase)&&!i.blob&&u.jsx("button",{onClick:()=>{c(""),v.current?.start().catch(R=>c(String(R)))},children:"开始录音"}),i.phase==="recording"&&u.jsx("button",{onClick:()=>v.current?.stop(),children:"停止录音"}),i.phase==="review"&&u.jsx("button",{disabled:f,className:"panel-host-primary",onClick:()=>{D()},children:f?"正在保存…":"保存到当前项目"}),g&&u.jsx("button",{disabled:f,onClick:()=>{c(""),x.current=void 0,v.current?.start().catch(R=>c(String(R)))},children:"丢弃并重新录制"}),g&&u.jsx("a",{href:g,download:`recording.${_}`,children:"下载本机备份"})]})]})}const Gi="/api/v1/panels/runtime";function hn(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function XS(t){try{if(typeof t!="string"||t.length>2048)return;const i=new URL(t);if(i.protocol==="https:"&&!i.username&&!i.password)return i.href}catch{}}function KS(t,i){const l=`${Gi}/${i}/directory/`;return typeof t=="string"&&t.startsWith(l)&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t.slice(l.length))}function $S(t,i,l){if(!hn(t)||t.effect!=="resources.open"||!hn(t.asset))return;const a=t.asset;if(typeof a.id!="string"||!/^(?:asset|external)-[a-f0-9]{64}$/.test(a.id)||a.id!==l||t.url!==`${Gi}/${i}/resources/${a.id}`||typeof a.name!="string"||!a.name||a.name.length>1024||typeof a.mimeType!="string"||!Number.isSafeInteger(a.bytes)||Number(a.bytes)<0)return;const c=["video/mp4","video/webm","video/ogg","video/quicktime"].includes(a.mimeType)?"video":["audio/mpeg","audio/mp4","audio/ogg","audio/wav","audio/webm","audio/flac","audio/aac"].includes(a.mimeType)?"audio":["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp"].includes(a.mimeType)?"image":"file";return{name:a.name,url:t.url,kind:c}}function ZS(t){if(typeof t!="string"||!/^\/api\/v1\/panel-assets\/[A-Za-z0-9_-]{20,128}\/[A-Za-z0-9_%./-]+$/.test(t))return!1;try{return t.split("/").slice(5).every(i=>{const l=decodeURIComponent(i);return!!l&&!l.startsWith(".")&&!/[\\/:\u0000-\u001f\u007f]/.test(l)})}catch{return!1}}function PS(t){return hn(t)?typeof t.instanceId=="string"&&/^[A-Za-z0-9_-]{20,128}$/.test(t.instanceId)&&ZS(t.src)&&typeof t.expiresAt=="number"&&Number.isFinite(t.expiresAt)&&hn(t.context)&&Array.isArray(t.limitations)&&t.limitations.every(i=>typeof i=="string"):!1}function JS({panel:t,sessionId:i,busy:l,onClose:a,onAuthLost:c,onDirtyChange:f,onSubmitPrompt:o}){const p=w.useRef(null),[h,g]=w.useState(),[b,y]=w.useState(!0),[v,x]=w.useState(""),[k,_]=w.useState(""),[D,R]=w.useState(),[z,L]=w.useState(),[G,se]=w.useState(!1),T=w.useRef(null);w.useEffect(()=>{z&&(T.current?.focus(),T.current?.scrollIntoView?.({block:"nearest"}))},[z]);const[V,X]=w.useState(""),[q,E]=w.useState(""),[U,H]=w.useState(),[Z,ee]=w.useState(),W=w.useRef(void 0),[N,K]=w.useState(!1),[he,ge]=w.useState(0),j=w.useRef({onClose:a,onAuthLost:c,onDirtyChange:f,onSubmitPrompt:o,busy:l});j.current={onClose:a,onAuthLost:c,onDirtyChange:f,onSubmitPrompt:o,busy:l};const O=w.useRef(!1),J=w.useRef(void 0),A=w.useRef(void 0),ae=w.useRef(null);return w.useEffect(()=>{j.current.onDirtyChange?.(!!U||N||!!Z),U&&(ae.current?.focus(),ae.current?.scrollIntoView?.({block:"nearest"}))},[U,N,Z]),w.useEffect(()=>{const pe=Zs()??"",te=ma(),oe={workspace:pe,grant:void 0},we=new AbortController,F=new Set,be=new Set;let Ee=!1,Re;const Qe=[],Ve=[],at=new Set,st=new Set;let pt,Nt=!1,qe=!1,ct=!1,Fe=!1;const nt=()=>{const Q=p.current?.contentWindow;if(!(Ee||!oe.grant||!Q||!Fe))for(const xe of Qe.splice(0))xe.event==="tools.invoke"&&hn(xe.payload)&&typeof xe.payload.requestId=="string"&&/^[A-Za-z0-9_-]{1,128}$/.test(xe.payload.requestId)&&st.add(xe.payload.requestId),Q.postMessage({type:"codeshell-panel:event",instanceId:oe.grant.instanceId,event:xe.event,payload:xe.payload},"*")},Dt=()=>{Ee||!ct||!Fe||!oe.grant||(pt&&clearTimeout(pt),y(!1),nt())},rt={loaded:()=>{ct=!0,Dt()}};A.current=rt,g(void 0),y(!0),x(""),_(""),R(void 0),L(void 0),se(!1),X(""),E(""),H(void 0),K(!1),ee(void 0);const wt=Q=>{Nt||(Nt=!0,Ue(yt(`${Gi}/${encodeURIComponent(Q.instanceId)}`,pe,te),{method:"DELETE",keepalive:!0}).catch(()=>{}))},M=Q=>{Ee||(Q instanceof Xe&&Q.status===401&&!O.current&&(O.current=!0,j.current.onAuthLost()),x(Q instanceof Error?Q.message:"面板连接失败,请重新打开。"))},$=Q=>{if(Ee||!oe.grant)return;const xe=oe.grant;oe.grant=void 0,Re?.stop(),J.current?.cancel(),Ve.length=0,Qe.length=0,wt(xe);for(const ze of F)ze.abort();pt&&clearTimeout(pt),g(void 0),R(void 0),L(void 0),y(!1),K(!1),X(""),M(Q)},me=Q=>({...Q,...typeof Q.sessionId=="string"?{busy:j.current.busy}:{}}),ve=(Q,xe,ze,re,je)=>{Ee||!oe.grant||Q!==p.current?.contentWindow||Q.postMessage({type:"codeshell-panel:response",instanceId:oe.grant.instanceId,requestId:xe,...re?{error:re,...je?.code?{code:je.code}:{},...je?.retryAfterMs!==void 0?{retryAfterMs:je.retryAfterMs}:{}}:{result:ze}},"*")},Ce=()=>{if(Ee||!oe.grant||J.current||W.current||qe)return;const Q=Ve.shift();if(!Q)return;if(Q.expiresAt<=Date.now()){Ce();return}let xe=!1;const ze={effect:Q,cancel:()=>{J.current===ze&&(clearTimeout(re),J.current=void 0,Ee||(H(void 0),E(""),K(!1)))},finish:je=>{if(Ee||!oe.grant||J.current!==ze||xe)return;xe=!0,K(!0),E("");const Be=new AbortController;F.add(Be);const ke=setTimeout(()=>Be.abort(),8e3);Ue(yt(`${Gi}/${oe.grant.instanceId}/confirm`,pe,te),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requestId:Q.requestId,allowed:je}),signal:Be.signal}).then(Ae=>{if(!(Ee||J.current!==ze)){if(typeof Ae.allowed!="boolean")throw new Error("确认响应无效。");je&&Ae.allowed===!1&&_("此确认已超时或被取消,操作未获准执行,请在面板中重新发起。"),!je&&Ae.allowed===!0&&_("该操作此前已获准执行,请在面板中查看进度或停止。"),ze.cancel(),Ce()}}).catch(Ae=>{if(!(Ee||J.current!==ze)){if(Ae instanceof Xe&&[401,403,410].includes(Ae.status)){$(Ae);return}if(Ae instanceof Xe&&Ae.status===409){ze.cancel(),_("面板操作确认已失效,请在面板中重新发起。"),Ce();return}E("暂未收到确认结果。可以重试本次确认,或取消尚未执行的请求。")}}).finally(()=>{clearTimeout(ke),F.delete(Be),xe=!1,!Ee&&J.current===ze&&K(!1)})}},re=setTimeout(()=>{ze.cancel(),!Ee&&oe.grant&&(_("面板操作确认已超时,请在面板中重新发起。"),Ce())},Q.expiresAt-Date.now());J.current=ze,H(ze),E("")},_e=Q=>{for(const xe of Q){if(xe.event!=="host.confirm"){Qe.push(xe);continue}const ze=xe.payload;if(!hn(ze)||typeof ze.requestId!="string"||!/^[A-Za-z0-9_-]{1,128}$/.test(ze.requestId)||typeof ze.title!="string"||ze.title.length>500||typeof ze.body!="string"||ze.body.length>3e4)throw new Error("面板操作确认格式无效。");at.has(ze.requestId)||(at.add(ze.requestId),Ve.push({effect:"host.confirm",requestId:ze.requestId,title:ze.title,body:ze.body,expiresAt:Date.now()+5e4}))}if(Qe.length>2048||Ve.length>32){$(new Error("面板状态积压过多,请重新打开面板。"));return}Ce(),nt()},Ke=Q=>new Promise(xe=>{if(J.current||W.current||qe){xe(!1);return}const ze={effect:Q,finish:je=>{J.current===ze&&(clearTimeout(re),J.current=void 0,Ee||H(void 0),xe(je),queueMicrotask(Ce))},cancel:()=>ze.finish(!1)},re=setTimeout(()=>ze.finish(!1),55e3);J.current=ze,H(ze)}),bt=async Q=>{const xe=p.current?.contentWindow,ze=oe.grant,re=Q.data;if(Ee||!xe||Q.source!==xe||Q.origin!=="null"||!ze||!hn(re)||re.instanceId!==ze.instanceId)return;if(re.type==="codeshell-panel:ready"){Fe=!0,Dt();return}if(re.type==="codeshell-panel:tool-result"){if(typeof re.requestId!="string"||!st.has(re.requestId)||F.size>=32)return;let ye;try{if(ye=JSON.stringify({requestId:re.requestId,...typeof re.error=="string"?{error:re.error}:{result:re.result}}),new TextEncoder().encode(ye).length>512*1024)return}catch{return}st.delete(re.requestId);const B=new AbortController;F.add(B);const Ne=setTimeout(()=>B.abort(),8e3);try{await Ue(yt(`${Gi}/${ze.instanceId}/tool-results`,pe,te),{method:"POST",headers:{"Content-Type":"application/json"},body:ye,signal:B.signal})}catch(dt){!Ee&&oe.grant&&(dt instanceof Xe&&[401,410].includes(dt.status)?$(dt):_("面板工具结果未能送达,请在对话中重新发起操作。"))}finally{clearTimeout(Ne),F.delete(B)}return}if(re.type!=="codeshell-panel:call"||typeof re.requestId!="string"||!/^[A-Za-z0-9_-]{1,80}$/.test(re.requestId))return;const je=re.requestId;if(be.has(je)){ve(xe,je,void 0,"此请求已经处理,请重新发起。");return}if(be.size>=8192||F.size>=32){ve(xe,je,void 0,"面板请求过于频繁,请稍后重试。");return}if(be.add(je),typeof re.method!="string"||!/^[A-Za-z][A-Za-z0-9.]{0,63}$/.test(re.method)){ve(xe,je,void 0,"面板方法无效。");return}let Be;try{if(Be=JSON.stringify({method:re.method,params:re.params}),new TextEncoder().encode(Be).length>3*1024*1024)throw new Error("too large")}catch{ve(xe,je,void 0,"面板请求内容过大或格式无效。");return}const ke=new AbortController;let Ae=!1;F.add(ke);try{const ye=await Ue(yt(`${Gi}/${ze.instanceId}/call`,pe,te),{method:"POST",headers:{"Content-Type":"application/json"},body:Be,signal:ke.signal});if(Ee||ke.signal.aborted)return;if(re.method==="context.get"&&(Fe=!0,Dt()),re.method==="external.open"){const B=hn(ye)&&ye.effect===re.method?XS(ye.url):void 0;if(!B)throw new Error("面板返回的外部链接无效。");if(!await Ke({effect:"external.open",url:B}))throw new Error("你取消了打开链接,或确认已超时。");ve(xe,je,{opened:!0})}else if(re.method==="agent.submitPrompt"){if(!hn(ye)||ye.effect!==re.method||typeof ye.prompt!="string"||!ye.prompt.trim()||ye.prompt.length>2e4||ye.sessionId!==i)throw new Error("面板任务与当前对话不匹配,请重新打开面板。");if(!await Ke({effect:"agent.submitPrompt",prompt:ye.prompt,sessionId:i}))throw new Error("你取消了发送任务,或确认已超时。");if(Ee||ke.signal.aborted)return;Ae=!0,qe=!0,K(!0);const B=await j.current.onSubmitPrompt({prompt:ye.prompt,sessionId:i});if(Ee||ke.signal.aborted)return;_("面板任务已提交到当前对话,可切换到对话查看进度。"),ve(xe,je,B)}else if(re.method==="resources.recordAudio"){if(!hn(ye)||ye.effect!==re.method||!Number.isInteger(ye.maxDurationSeconds)||Number(ye.maxDurationSeconds)<1||Number(ye.maxDurationSeconds)>600||!Number.isInteger(ye.maxBytes)||Number(ye.maxBytes)<1||Number(ye.maxBytes)>25*1024*1024)throw new Error("录音请求无效。");if(W.current||J.current||qe)throw new Error("请先完成当前的录音或确认操作。");const B=await new Promise((Ne,dt)=>{let en=!1;const Zn=(Ft,bi)=>{en||(en=!0,clearTimeout(On),ke.signal.removeEventListener("abort",Xi),W.current===yi&&(W.current=void 0,Ee||ee(void 0)),bi?dt(bi):Ne(Ft),Ce())},Xi=()=>Zn(void 0,new Error("录音已关闭或授权已结束。")),On=setTimeout(()=>Zn(void 0,new Error("录音操作已超时,请重新打开。")),25*6e4),yi={signal:ke.signal,maxDurationSeconds:Number(ye.maxDurationSeconds),maxBytes:Number(ye.maxBytes),call:async(Ft,bi,dl)=>{const br=dl?AbortSignal.any([ke.signal,dl]):ke.signal;if(br.throwIfAborted(),Ee||oe.grant!==ze)throw new Error("当前项目授权已结束。");try{const tn=await Ue(yt(`${Gi}/${ze.instanceId}/call`,pe,te),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:Ft,params:bi}),signal:br});if(br.throwIfAborted(),Ee||oe.grant!==ze)throw new Error("当前项目授权已结束。");return tn}catch(tn){throw tn instanceof Xe&&[401,403,410].includes(tn.status)&&$(tn),tn}},finish:Zn};W.current=yi,ke.signal.addEventListener("abort",Xi,{once:!0}),ee(yi)});ve(xe,je,B)}else if(re.method==="resources.open"){L(void 0),se(!1);const B=$S(ye,ze.instanceId,hn(re.params)?re.params.assetId:void 0);if(!B)throw new Error("面板文件预览链接无效,请重新打开文件。");L({...B,url:yt(B.url,pe,te),downloadUrl:yt(`${B.url}?download=1`,pe,te)}),ve(xe,je,{opened:!0})}else if(re.method==="filesystem.openDirectory"){if(R(void 0),!hn(ye)||ye.effect!==re.method||typeof ye.path!="string")throw new Error("面板目录信息无效。");if(ye.url!==void 0&&!KS(ye.url,ze.instanceId))throw new Error("面板目录链接无效,请重新打开目录。");R({path:ye.path,...typeof ye.url=="string"?{url:yt(ye.url,pe,te)}:{}}),ve(xe,je,{opened:!1,path:ye.path})}else if(re.method==="notifications.send"){if(!hn(ye)||ye.effect!==re.method||typeof ye.title!="string"||ye.title.length>160||typeof ye.body!="string"||ye.body.length>2e3)throw new Error("面板通知格式无效。");_(`${ye.title}${ye.body?`:${ye.body}`:""}`),ve(xe,je,{sent:!0})}else ve(xe,je,re.method==="context.get"&&hn(ye)?me(ye):ye)}catch(ye){!Ee&&!ke.signal.aborted&&(ye instanceof Xe&&[401,410].includes(ye.status)&&$(ye),(re.method==="agent.submitPrompt"||re.method==="external.open")&&_(ye instanceof Error?ye.message:"面板操作未完成。"),ve(xe,je,void 0,ye instanceof Error?ye.message:"面板请求失败。",ye instanceof Xe?{code:ye.code,retryAfterMs:ye.retryAfterMs}:void 0))}finally{F.delete(ke),Ae&&(qe=!1,Ee||K(!1),Ce())}},ft=Q=>{bt(Q)};window.addEventListener("message",ft);const $e=()=>Re?.refresh(),Ze=()=>{document.visibilityState==="visible"&&$e()};return window.addEventListener("focus",$e),window.addEventListener("online",$e),document.addEventListener("visibilitychange",Ze),Ue(yt(`${Gi}/prepare`,pe,te),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({appId:t.id,revision:t.revision,...i?{sessionId:i}:{},theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",locale:"zh-CN"}),signal:we.signal}).then(Q=>{if(!PS(Q))throw new Error("面板启动信息无效,请刷新面板列表后重试。");if(Ee||we.signal.aborted){wt(Q);return}if(Q.expiresAt<=Date.now())throw wt(Q),new Error("面板授权已过期,请重新打开。");oe.grant=Q,g({...Q,src:yt(Q.src,pe,te)}),pt=setTimeout(()=>{$(new Error("面板未能完成加载,请重新打开。若仍无法加载,可检查面板文件或使用桌面客户端。"))},45e3),Re=YS({instanceId:Q.instanceId,expiresAt:Q.expiresAt,workspace:pe,projectId:te,onEvents:_e,onTerminal:$,onStatus:X})}).catch(Q=>{!Ee&&!we.signal.aborted&&(y(!1),M(Q))}),()=>{Ee=!0,J.current?.cancel(),window.removeEventListener("message",ft),window.removeEventListener("focus",$e),window.removeEventListener("online",$e),document.removeEventListener("visibilitychange",Ze),Re?.stop(),we.abort();for(const Q of F)Q.abort();pt&&clearTimeout(pt),oe.grant&&wt(oe.grant),j.current.onDirtyChange?.(!1),A.current===rt&&(A.current=void 0)}},[t.id,t.revision,i,he]),w.useEffect(()=>{!h||!p.current?.contentWindow||p.current.contentWindow.postMessage({type:"codeshell-panel:event",instanceId:h.instanceId,event:"context.changed",payload:{...h.context,...typeof h.context.sessionId=="string"?{busy:l}:{}}},"*")},[l,h]),u.jsxs("section",{className:"panel-host",children:[u.jsxs("header",{className:"panel-host-heading",children:[u.jsxs("div",{children:[u.jsx("h1",{children:t.title["zh-CN"]||t.title.default}),u.jsxs("p",{children:["v",t.version," · 运行于当前工作区"]})]}),u.jsx("button",{onClick:a,children:"返回面板"})]}),(h?.limitations??t.compatibility.reasons).length>0&&u.jsxs("details",{className:"panel-host-limitations",open:!0,children:[u.jsx("summary",{children:"部分功能可用"}),u.jsx("p",{children:"面板界面可以使用;以下功能尚未接入网页,使用时会显示具体限制。"}),u.jsx("ul",{children:(h?.limitations??t.compatibility.reasons).map(pe=>u.jsx("li",{children:pe},pe))})]}),k&&u.jsx("p",{className:"panel-host-notice",role:"status",children:k}),D&&u.jsxs("div",{className:"panel-host-notice panel-host-directory",role:"status",children:[u.jsxs("p",{children:["文件保存在服务器目录:",D.path]}),D.url&&u.jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",children:"查看并下载文件"})]}),z&&u.jsxs("section",{className:"panel-host-preview","aria-label":"文件预览",tabIndex:-1,ref:T,children:[u.jsxs("header",{children:[u.jsx("h2",{children:z.name}),u.jsx("button",{onClick:()=>L(void 0),children:"关闭预览"})]}),!G&&z.kind==="video"&&u.jsx("video",{src:z.url,controls:!0,playsInline:!0,preload:"metadata",onError:()=>se(!0)},z.url),!G&&z.kind==="audio"&&u.jsx("audio",{src:z.url,controls:!0,preload:"metadata",onError:()=>se(!0)},z.url),!G&&z.kind==="image"&&u.jsx("img",{src:z.url,alt:z.name,onError:()=>se(!0)},z.url),(G||z.kind==="file")&&u.jsx("p",{role:"status",children:"当前浏览器无法预览此文件。可以保存后打开;若保存失败,请重新打开面板检查访问权限。"}),u.jsx("a",{href:z.downloadUrl,download:z.name,children:"保存到此设备"})]}),V&&u.jsx("p",{className:"panel-host-notice",role:"status",children:V}),v&&u.jsxs("div",{className:"panel-host-error",role:"alert",children:[u.jsx("p",{children:v}),u.jsx("button",{disabled:b,onClick:()=>ge(pe=>pe+1),children:"重新打开面板"})]}),b&&u.jsx("p",{className:"panel-host-loading",role:"status",children:"正在打开面板…"}),Z&&u.jsx(QS,{request:Z}),U&&u.jsxs("section",{className:"panel-host-confirm",ref:ae,tabIndex:-1,onKeyDown:pe=>{pe.key==="Escape"&&!N&&(pe.preventDefault(),U.finish(!1))},"aria-label":U.effect.effect==="external.open"?"确认打开外部链接":U.effect.effect==="host.confirm"?"确认面板操作":"确认发送面板任务",children:[u.jsx("h2",{children:U.effect.effect==="external.open"?"面板请求打开网页":U.effect.effect==="host.confirm"?U.effect.title:"面板请求向当前对话发送任务"}),U.effect.effect==="external.open"?u.jsx("p",{className:"panel-host-url",children:U.effect.url}):U.effect.effect==="host.confirm"?u.jsx("pre",{children:U.effect.body}):u.jsx("pre",{children:U.effect.prompt}),q&&u.jsx("p",{role:"alert",children:q}),u.jsxs("div",{className:"panel-host-actions",children:[u.jsx("button",{disabled:N,onClick:()=>U.finish(!1),children:"取消"}),U.effect.effect==="external.open"?u.jsx("a",{href:U.effect.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>U.finish(!0),children:"确认打开网页"}):u.jsx("button",{className:"panel-host-primary",disabled:N,onClick:()=>U.finish(!0),children:N?"正在确认…":U.effect.effect==="host.confirm"?"确认执行":"确认发送任务"})]})]}),h&&u.jsx("iframe",{ref:p,src:h.src,title:`${t.title["zh-CN"]||t.title.default}面板`,sandbox:"allow-scripts allow-downloads",referrerPolicy:"no-referrer",inert:!!U||N||!!Z,onLoad:()=>A.current?.loaded(),allow:"camera 'none'; microphone 'none'; geolocation 'none'; display-capture 'none'; clipboard-read 'none'; clipboard-write 'none'",className:"panel-host-frame"})]})}function WS(t,i){const l={};return(t[t.length-1]===""?[...t,""]:t).join((l.padRight?" ":"")+","+(l.padLeft===!1?"":" ")).trim()}const ew=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tw=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nw={};function sy(t,i){return(nw.jsx?tw:ew).test(t)}const iw=/[ \t\n\f\r]/g;function rw(t){return typeof t=="object"?t.type==="text"?oy(t.value):!1:oy(t)}function oy(t){return t.replace(iw,"")===""}class xa{constructor(i,l,a){this.normal=l,this.property=i,a&&(this.space=a)}}xa.prototype.normal={};xa.prototype.property={};xa.prototype.space=void 0;function bb(t,i){const l={},a={};for(const c of t)Object.assign(l,c.property),Object.assign(a,c.normal);return new xa(l,a,i)}function Af(t){return t.toLowerCase()}class pn{constructor(i,l){this.attribute=l,this.property=i}}pn.prototype.attribute="";pn.prototype.booleanish=!1;pn.prototype.boolean=!1;pn.prototype.commaOrSpaceSeparated=!1;pn.prototype.commaSeparated=!1;pn.prototype.defined=!1;pn.prototype.mustUseProperty=!1;pn.prototype.number=!1;pn.prototype.overloadedBoolean=!1;pn.prototype.property="";pn.prototype.spaceSeparated=!1;pn.prototype.space=void 0;let lw=0;const Ie=yr(),Ht=yr(),Tf=yr(),Se=yr(),Ct=yr(),dr=yr(),wn=yr();function yr(){return 2**++lw}const zf=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:Ht,commaOrSpaceSeparated:wn,commaSeparated:dr,number:Se,overloadedBoolean:Tf,spaceSeparated:Ct},Symbol.toStringTag,{value:"Module"})),af=Object.keys(zf);class Jf extends pn{constructor(i,l,a,c){let f=-1;if(super(i,l),uy(this,"space",c),typeof a=="number")for(;++f<af.length;){const o=af[f];uy(this,af[f],(a&zf[o])===zf[o])}}}Jf.prototype.defined=!0;function uy(t,i,l){l&&(t[i]=l)}function cl(t){const i={},l={};for(const[a,c]of Object.entries(t.properties)){const f=new Jf(a,t.transform(t.attributes||{},a),c,t.space);t.mustUseProperty&&t.mustUseProperty.includes(a)&&(f.mustUseProperty=!0),i[a]=f,l[Af(a)]=a,l[Af(f.attribute)]=a}return new xa(i,l,t.space)}const vb=cl({properties:{ariaActiveDescendant:null,ariaAtomic:Ht,ariaAutoComplete:null,ariaBusy:Ht,ariaChecked:Ht,ariaColCount:Se,ariaColIndex:Se,ariaColSpan:Se,ariaControls:Ct,ariaCurrent:null,ariaDescribedBy:Ct,ariaDetails:null,ariaDisabled:Ht,ariaDropEffect:Ct,ariaErrorMessage:null,ariaExpanded:Ht,ariaFlowTo:Ct,ariaGrabbed:Ht,ariaHasPopup:null,ariaHidden:Ht,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ct,ariaLevel:Se,ariaLive:null,ariaModal:Ht,ariaMultiLine:Ht,ariaMultiSelectable:Ht,ariaOrientation:null,ariaOwns:Ct,ariaPlaceholder:null,ariaPosInSet:Se,ariaPressed:Ht,ariaReadOnly:Ht,ariaRelevant:null,ariaRequired:Ht,ariaRoleDescription:Ct,ariaRowCount:Se,ariaRowIndex:Se,ariaRowSpan:Se,ariaSelected:Ht,ariaSetSize:Se,ariaSort:null,ariaValueMax:Se,ariaValueMin:Se,ariaValueNow:Se,ariaValueText:null,role:null},transform(t,i){return i==="role"?i:"aria-"+i.slice(4).toLowerCase()}});function xb(t,i){return i in t?t[i]:i}function Sb(t,i){return xb(t,i.toLowerCase())}const aw=cl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:dr,acceptCharset:Ct,accessKey:Ct,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alpha:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:Ct,autoFocus:Ie,autoPlay:Ie,blocking:Ct,capture:null,charSet:null,checked:Ie,cite:null,className:Ct,closedBy:null,colorSpace:null,cols:Se,colSpan:Se,command:null,commandFor:null,content:null,contentEditable:Ht,controls:Ie,controlsList:Ct,coords:Se|dr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:Tf,draggable:Ht,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:Ct,height:Se,hidden:Tf,high:Se,href:null,hrefLang:null,htmlFor:Ct,httpEquiv:Ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:Ct,itemRef:Ct,itemScope:Ie,itemType:Ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:Se,manifest:null,max:null,maxLength:Se,media:null,method:null,min:null,minLength:Se,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ie,optimum:Se,pattern:null,ping:Ct,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:Ct,required:Ie,reversed:Ie,rows:Se,rowSpan:Se,sandbox:Ct,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootCustomElementRegistry:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shadowRootSerializable:Ie,shape:null,size:Se,sizes:null,slot:null,span:Se,spellCheck:Ht,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Se,step:null,style:null,tabIndex:Se,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:Ht,width:Se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ct,axis:null,background:null,bgColor:null,border:Se,borderColor:null,bottomMargin:Se,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:Se,leftMargin:Se,link:null,longDesc:null,lowSrc:null,marginHeight:Se,marginWidth:Se,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:Se,rules:null,scheme:null,scrolling:Ht,standby:null,summary:null,text:null,topMargin:Se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Se,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ie,disablePictureInPicture:Ie,disableRemotePlayback:Ie,exportParts:dr,part:Ct,prefix:null,property:null,results:Se,security:null,unselectable:null},space:"html",transform:Sb}),sw=cl({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:wn,accentHeight:Se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Se,amplitude:Se,arabicForm:null,ascent:Se,attributeName:null,attributeType:null,azimuth:Se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Se,by:null,calcMode:null,capHeight:Se,className:Ct,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Se,diffuseConstant:Se,direction:null,display:null,dur:null,divisor:Se,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:Se,enableBackground:null,end:null,event:null,exponent:Se,externalResourcesRequired:null,fill:null,fillOpacity:Se,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:dr,g2:dr,glyphName:dr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Se,horizOriginX:Se,horizOriginY:Se,id:null,ideographic:Se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Se,k:Se,k1:Se,k2:Se,k3:Se,k4:Se,kernelMatrix:wn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Se,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Se,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Se,overlineThickness:Se,paintOrder:null,panose1:null,path:null,pathLength:Se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Se,pointsAtY:Se,pointsAtZ:Se,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:wn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:wn,rev:wn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:wn,requiredFeatures:wn,requiredFonts:wn,requiredFormats:wn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Se,specularExponent:Se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Se,strikethroughThickness:Se,string:null,stroke:null,strokeDashArray:wn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Se,strokeOpacity:Se,strokeWidth:null,style:null,surfaceScale:Se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:wn,tabIndex:Se,tableValues:null,target:null,targetX:Se,targetY:Se,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:wn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Se,underlineThickness:Se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Se,values:null,vAlphabetic:Se,vMathematical:Se,vectorEffect:null,vHanging:Se,vIdeographic:Se,version:null,vertAdvY:Se,vertOriginX:Se,vertOriginY:Se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xb}),wb=cl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,i){return"xlink:"+i.slice(5).toLowerCase()}}),jb=cl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sb}),kb=cl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,i){return"xml:"+i.slice(3).toLowerCase()}}),ow={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},uw=/[A-Z]/g,cy=/-[a-z]/g,cw=/^data[-\w.:]+$/i;function fw(t,i){const l=Af(i);let a=i,c=pn;if(l in t.normal)return t.property[t.normal[l]];if(l.length>4&&l.slice(0,4)==="data"&&cw.test(i)){if(i.charAt(4)==="-"){const f=i.slice(5).replace(cy,hw);a="data"+f.charAt(0).toUpperCase()+f.slice(1)}else{const f=i.slice(4);if(!cy.test(f)){let o=f.replace(uw,dw);o.charAt(0)!=="-"&&(o="-"+o),i="data"+o}}c=Jf}return new c(a,i)}function dw(t){return"-"+t.toLowerCase()}function hw(t){return t.charAt(1).toUpperCase()}const pw=bb([vb,aw,wb,jb,kb],"html"),Wf=bb([vb,sw,wb,jb,kb],"svg");function mw(t){return t.join(" ").trim()}var ll={},sf,fy;function gw(){if(fy)return sf;fy=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,l=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,c=/^:\s*/,f=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,p=/^\s+|\s+$/g,h=`
|
|
29
|
-
`,g="/",b="*",y="",v="comment",x="declaration";function k(D,R){if(typeof D!="string")throw new TypeError("First argument must be a string");if(!D)return[];R=R||{};var z=1,L=1;function G(ee){var W=ee.match(i);W&&(z+=W.length);var N=ee.lastIndexOf(h);L=~N?ee.length-N:L+ee.length}function se(){var ee={line:z,column:L};return function(W){return W.position=new T(ee),q(),W}}function T(ee){this.start=ee,this.end={line:z,column:L},this.source=R.source}T.prototype.content=D;function V(ee){var W=new Error(R.source+":"+z+":"+L+": "+ee);if(W.reason=ee,W.filename=R.source,W.line=z,W.column=L,W.source=D,!R.silent)throw W}function X(ee){var W=ee.exec(D);if(W){var N=W[0];return G(N),D=D.slice(N.length),W}}function q(){X(l)}function E(ee){var W;for(ee=ee||[];W=U();)W!==!1&&ee.push(W);return ee}function U(){var ee=se();if(!(g!=D.charAt(0)||b!=D.charAt(1))){for(var W=2;y!=D.charAt(W)&&(b!=D.charAt(W)||g!=D.charAt(W+1));)++W;if(W+=2,y===D.charAt(W-1))return V("End of comment missing");var N=D.slice(2,W-2);return L+=2,G(N),D=D.slice(W),L+=2,ee({type:v,comment:N})}}function H(){var ee=se(),W=X(a);if(W){if(U(),!X(c))return V("property missing ':'");var N=X(f),K=ee({type:x,property:_(W[0].replace(t,y)),value:N?_(N[0].replace(t,y)):y});return X(o),K}}function Z(){var ee=[];E(ee);for(var W;W=H();)W!==!1&&(ee.push(W),E(ee));return ee}return q(),Z()}function _(D){return D?D.replace(p,y):y}return sf=k,sf}var dy;function yw(){if(dy)return ll;dy=1;var t=ll&&ll.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(ll,"__esModule",{value:!0}),ll.default=l;const i=t(gw());function l(a,c){let f=null;if(!a||typeof a!="string")return f;const o=(0,i.default)(a),p=typeof c=="function";return o.forEach(h=>{if(h.type!=="declaration")return;const{property:g,value:b}=h;p?c(g,b,h):b&&(f=f||{},f[g]=b)}),f}return ll}var aa={},hy;function bw(){if(hy)return aa;hy=1,Object.defineProperty(aa,"__esModule",{value:!0}),aa.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,l=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,c=/^-(ms)-/,f=function(g){return!g||l.test(g)||t.test(g)},o=function(g,b){return b.toUpperCase()},p=function(g,b){return"".concat(b,"-")},h=function(g,b){return b===void 0&&(b={}),f(g)?g:(g=g.toLowerCase(),b.reactCompat?g=g.replace(c,p):g=g.replace(a,p),g.replace(i,o))};return aa.camelCase=h,aa}var sa,py;function vw(){if(py)return sa;py=1;var t=sa&&sa.__importDefault||function(c){return c&&c.__esModule?c:{default:c}},i=t(yw()),l=bw();function a(c,f){var o={};return!c||typeof c!="string"||(0,i.default)(c,function(p,h){p&&h&&(o[(0,l.camelCase)(p,f)]=h)}),o}return a.default=a,sa=a,sa}var xw=vw();const Sw=ro(xw),Cb=Eb("end"),ed=Eb("start");function Eb(t){return i;function i(l){const a=l&&l.position&&l.position[t]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function ww(t){const i=ed(t),l=Cb(t);if(i&&l)return{start:i,end:l}}function fa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?my(t.position):"start"in t||"end"in t?my(t):"line"in t||"column"in t?Rf(t):""}function Rf(t){return gy(t&&t.line)+":"+gy(t&&t.column)}function my(t){return Rf(t&&t.start)+"-"+Rf(t&&t.end)}function gy(t){return t&&typeof t=="number"?t:1}class Wt extends Error{constructor(i,l,a){super(),typeof l=="string"&&(a=l,l=void 0);let c="",f={},o=!1;if(l&&("line"in l&&"column"in l?f={place:l}:"start"in l&&"end"in l?f={place:l}:"type"in l?f={ancestors:[l],place:l.position}:f={...l}),typeof i=="string"?c=i:!f.cause&&i&&(o=!0,c=i.message,f.cause=i),!f.ruleId&&!f.source&&typeof a=="string"){const h=a.indexOf(":");h===-1?f.ruleId=a:(f.source=a.slice(0,h),f.ruleId=a.slice(h+1))}if(!f.place&&f.ancestors&&f.ancestors){const h=f.ancestors[f.ancestors.length-1];h&&(f.place=h.position)}const p=f.place&&"start"in f.place?f.place.start:f.place;this.ancestors=f.ancestors||void 0,this.cause=f.cause||void 0,this.column=p?p.column:void 0,this.fatal=void 0,this.file="",this.message=c,this.line=p?p.line:void 0,this.name=fa(f.place)||"1:1",this.place=f.place||void 0,this.reason=this.message,this.ruleId=f.ruleId||void 0,this.source=f.source||void 0,this.stack=o&&f.cause&&typeof f.cause.stack=="string"?f.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;const td={}.hasOwnProperty,jw=new Map,kw=/[A-Z]/g,Cw=new Set(["table","tbody","thead","tfoot","tr"]),Ew=new Set(["td","th"]),Nb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Nw(t,i){if(!i||i.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const l=i.filePath||void 0;let a;if(i.development){if(typeof i.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=Ow(l,i.jsxDEV)}else{if(typeof i.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof i.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=_w(l,i.jsx,i.jsxs)}const c={Fragment:i.Fragment,ancestors:[],components:i.components||{},create:a,elementAttributeNameCase:i.elementAttributeNameCase||"react",evaluater:i.createEvaluater?i.createEvaluater():void 0,filePath:l,ignoreInvalidStyle:i.ignoreInvalidStyle||!1,passKeys:i.passKeys!==!1,passNode:i.passNode||!1,schema:i.space==="svg"?Wf:pw,stylePropertyNameCase:i.stylePropertyNameCase||"dom",tableCellAlignToStyle:i.tableCellAlignToStyle!==!1},f=Ab(c,t,void 0);return f&&typeof f!="string"?f:c.create(t,c.Fragment,{children:f||void 0},void 0)}function Ab(t,i,l){if(i.type==="element")return Aw(t,i,l);if(i.type==="mdxFlowExpression"||i.type==="mdxTextExpression")return Tw(t,i);if(i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement")return Rw(t,i,l);if(i.type==="mdxjsEsm")return zw(t,i);if(i.type==="root")return Dw(t,i,l);if(i.type==="text")return Mw(t,i)}function Aw(t,i,l){const a=t.schema;let c=a;i.tagName.toLowerCase()==="svg"&&a.space==="html"&&(c=Wf,t.schema=c),t.ancestors.push(i);const f=zb(t,i.tagName,!1),o=Lw(t,i);let p=id(t,i);return Cw.has(i.tagName)&&(p=p.filter(function(h){return typeof h=="string"?!rw(h):!0})),Tb(t,o,f,i),nd(o,p),t.ancestors.pop(),t.schema=a,t.create(i,f,o,l)}function Tw(t,i){if(i.data&&i.data.estree&&t.evaluater){const a=i.data.estree.body[0];return a.type,t.evaluater.evaluateExpression(a.expression)}ga(t,i.position)}function zw(t,i){if(i.data&&i.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(i.data.estree);ga(t,i.position)}function Rw(t,i,l){const a=t.schema;let c=a;i.name==="svg"&&a.space==="html"&&(c=Wf,t.schema=c),t.ancestors.push(i);const f=i.name===null?t.Fragment:zb(t,i.name,!0),o=Bw(t,i),p=id(t,i);return Tb(t,o,f,i),nd(o,p),t.ancestors.pop(),t.schema=a,t.create(i,f,o,l)}function Dw(t,i,l){const a={};return nd(a,id(t,i)),t.create(i,t.Fragment,a,l)}function Mw(t,i){return i.value}function Tb(t,i,l,a){typeof l!="string"&&l!==t.Fragment&&t.passNode&&(i.node=a)}function nd(t,i){if(i.length>0){const l=i.length>1?i:i[0];l&&(t.children=l)}}function _w(t,i,l){return a;function a(c,f,o,p){const g=Array.isArray(o.children)?l:i;return p?g(f,o,p):g(f,o)}}function Ow(t,i){return l;function l(a,c,f,o){const p=Array.isArray(f.children),h=ed(a);return i(c,f,o,p,{columnNumber:h?h.column-1:void 0,fileName:t,lineNumber:h?h.line:void 0},void 0)}}function Lw(t,i){const l={};let a,c;for(c in i.properties)if(c!=="children"&&td.call(i.properties,c)){const f=Uw(t,c,i.properties[c]);if(f){const[o,p]=f;t.tableCellAlignToStyle&&o==="align"&&typeof p=="string"&&Ew.has(i.tagName)?a=p:l[o]=p}}if(a){const f=l.style||(l.style={});f[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return l}function Bw(t,i){const l={};for(const a of i.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&t.evaluater){const f=a.data.estree.body[0];f.type;const o=f.expression;o.type;const p=o.properties[0];p.type,Object.assign(l,t.evaluater.evaluateExpression(p.argument))}else ga(t,i.position);else{const c=a.name;let f;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&t.evaluater){const p=a.value.data.estree.body[0];p.type,f=t.evaluater.evaluateExpression(p.expression)}else ga(t,i.position);else f=a.value===null?!0:a.value;l[c]=f}return l}function id(t,i){const l=[];let a=-1;const c=t.passKeys?new Map:jw;for(;++a<i.children.length;){const f=i.children[a];let o;if(t.passKeys){const h=f.type==="element"?f.tagName:f.type==="mdxJsxFlowElement"||f.type==="mdxJsxTextElement"?f.name:void 0;if(h){const g=c.get(h)||0;o=h+"-"+g,c.set(h,g+1)}}const p=Ab(t,f,o);p!==void 0&&l.push(p)}return l}function Uw(t,i,l){const a=fw(t.schema,i);if(!(l==null||typeof l=="number"&&Number.isNaN(l))){if(Array.isArray(l)&&(l=a.commaSeparated?WS(l):mw(l)),a.property==="style"){let c=typeof l=="object"?l:qw(t,String(l));return t.stylePropertyNameCase==="css"&&(c=Iw(c)),["style",c]}return[t.elementAttributeNameCase==="react"&&a.space?ow[a.property]||a.property:a.attribute,l]}}function qw(t,i){try{return Sw(i,{reactCompat:!0})}catch(l){if(t.ignoreInvalidStyle)return{};const a=l,c=new Wt("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=t.filePath||void 0,c.url=Nb+"#cannot-parse-style-attribute",c}}function zb(t,i,l){let a;if(!l)a={type:"Literal",value:i};else if(i.includes(".")){const c=i.split(".");let f=-1,o;for(;++f<c.length;){const p=sy(c[f])?{type:"Identifier",name:c[f]}:{type:"Literal",value:c[f]};o=o?{type:"MemberExpression",object:o,property:p,computed:!!(f&&p.type==="Literal"),optional:!1}:p}a=o}else a=sy(i)&&!/^[a-z]/.test(i)?{type:"Identifier",name:i}:{type:"Literal",value:i};if(a.type==="Literal"){const c=a.value;return td.call(t.components,c)?t.components[c]:c}if(t.evaluater)return t.evaluater.evaluateExpression(a);ga(t)}function ga(t,i){const l=new Wt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:i,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw l.file=t.filePath||void 0,l.url=Nb+"#cannot-handle-mdx-estrees-without-createevaluater",l}function Iw(t){const i={};let l;for(l in t)td.call(t,l)&&(i[Hw(l)]=t[l]);return i}function Hw(t){let i=t.replace(kw,Vw);return i.slice(0,3)==="ms-"&&(i="-"+i),i}function Vw(t){return"-"+t.toLowerCase()}const of={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Yw={};function rd(t,i){const l=Yw,a=typeof l.includeImageAlt=="boolean"?l.includeImageAlt:!0,c=typeof l.includeHtml=="boolean"?l.includeHtml:!0;return Rb(t,a,c)}function Rb(t,i,l){if(Gw(t)){if("value"in t)return t.type==="html"&&!l?"":t.value;if(i&&"alt"in t&&t.alt)return t.alt;if("children"in t)return yy(t.children,i,l)}return Array.isArray(t)?yy(t,i,l):""}function yy(t,i,l){const a=[];let c=-1;for(;++c<t.length;)a[c]=Rb(t[c],i,l);return a.join("")}function Gw(t){return!!(t&&typeof t=="object")}const by=document.createElement("i");function ld(t){const i="&"+t+";";by.innerHTML=i;const l=by.textContent;return l.charCodeAt(l.length-1)===59&&t!=="semi"||l===i?!1:l}function jn(t,i,l,a){const c=t.length;let f=0,o;if(i<0?i=-i>c?0:c+i:i=i>c?c:i,l=l>0?l:0,a.length<1e4)o=Array.from(a),o.unshift(i,l),t.splice(...o);else for(l&&t.splice(i,l);f<a.length;)o=a.slice(f,f+1e4),o.unshift(i,0),t.splice(...o),f+=1e4,i+=1e4}function _n(t,i){return t.length>0?(jn(t,t.length,0,i),t):i}const vy={}.hasOwnProperty;function Db(t){const i={};let l=-1;for(;++l<t.length;)Fw(i,t[l]);return i}function Fw(t,i){let l;for(l in i){const c=(vy.call(t,l)?t[l]:void 0)||(t[l]={}),f=i[l];let o;if(f)for(o in f){vy.call(c,o)||(c[o]=[]);const p=f[o];Qw(c[o],Array.isArray(p)?p:p?[p]:[])}}}function Qw(t,i){let l=-1;const a=[];for(;++l<i.length;)(i[l].add==="after"?t:a).push(i[l]);jn(t,0,0,a)}function Mb(t,i){const l=Number.parseInt(t,i);return l<9||l===11||l>13&&l<32||l>126&&l<160||l>55295&&l<57344||l>64975&&l<65008||(l&65535)===65535||(l&65535)===65534||l>1114111?"�":String.fromCodePoint(l)}function Vn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const rn=Qi(/[A-Za-z]/),Jt=Qi(/[\dA-Za-z]/),Xw=Qi(/[#-'*+\--9=?A-Z^-~]/);function eo(t){return t!==null&&(t<32||t===127)}const Df=Qi(/\d/),Kw=Qi(/[\dA-Fa-f]/),$w=Qi(/[!-/:-@[-`{-~]/);function Oe(t){return t!==null&&t<-2}function Et(t){return t!==null&&(t<0||t===32)}function We(t){return t===-2||t===-1||t===32}const so=Qi(new RegExp("\\p{P}|\\p{S}","u")),hr=Qi(/\s/);function Qi(t){return i;function i(l){return l!==null&&l>-1&&t.test(String.fromCharCode(l))}}function fl(t){const i=[];let l=-1,a=0,c=0;for(;++l<t.length;){const f=t.charCodeAt(l);let o="";if(f===37&&Jt(t.charCodeAt(l+1))&&Jt(t.charCodeAt(l+2)))c=2;else if(f<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(f))||(o=String.fromCharCode(f));else if(f>55295&&f<57344){const p=t.charCodeAt(l+1);f<56320&&p>56319&&p<57344?(o=String.fromCharCode(f,p),c=1):o="�"}else o=String.fromCharCode(f);o&&(i.push(t.slice(a,l),encodeURIComponent(o)),a=l+c+1,o=""),c&&(l+=c,c=0)}return i.join("")+t.slice(a)}function lt(t,i,l,a){const c=a?a-1:Number.POSITIVE_INFINITY;let f=0;return o;function o(h){return We(h)?(t.enter(l),p(h)):i(h)}function p(h){return We(h)&&f++<c?(t.consume(h),p):(t.exit(l),i(h))}}const Zw={tokenize:Pw};function Pw(t){const i=t.attempt(this.parser.constructs.contentInitial,a,c);let l;return i;function a(p){if(p===null){t.consume(p);return}return t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),lt(t,i,"linePrefix")}function c(p){return t.enter("paragraph"),f(p)}function f(p){const h=t.enter("chunkText",{contentType:"text",previous:l});return l&&(l.next=h),l=h,o(p)}function o(p){if(p===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(p);return}return Oe(p)?(t.consume(p),t.exit("chunkText"),f):(t.consume(p),o)}}const Jw={tokenize:Ww},xy={tokenize:ej};function Ww(t){const i=this,l=[];let a=0,c,f,o;return p;function p(L){if(a<l.length){const G=l[a];return i.containerState=G[1],t.attempt(G[0].continuation,h,g)(L)}return g(L)}function h(L){if(a++,i.containerState._closeFlow){i.containerState._closeFlow=void 0,c&&z();const G=i.events.length;let se=G,T;for(;se--;)if(i.events[se][0]==="exit"&&i.events[se][1].type==="chunkFlow"){T=i.events[se][1].end;break}R(a);let V=G;for(;V<i.events.length;)i.events[V][1].end={...T},V++;return jn(i.events,se+1,0,i.events.slice(G)),i.events.length=V,g(L)}return p(L)}function g(L){if(a===l.length){if(!c)return v(L);if(c.currentConstruct&&c.currentConstruct.concrete)return k(L);i.interrupt=!!(c.currentConstruct&&!c._gfmTableDynamicInterruptHack)}return i.containerState={},t.check(xy,b,y)(L)}function b(L){return c&&z(),R(a),v(L)}function y(L){return i.parser.lazy[i.now().line]=a!==l.length,o=i.now().offset,k(L)}function v(L){return i.containerState={},t.attempt(xy,x,k)(L)}function x(L){return a++,l.push([i.currentConstruct,i.containerState]),v(L)}function k(L){if(L===null){c&&z(),R(0),t.consume(L);return}return c=c||i.parser.flow(i.now()),t.enter("chunkFlow",{_tokenizer:c,contentType:"flow",previous:f}),_(L)}function _(L){if(L===null){D(t.exit("chunkFlow"),!0),R(0),t.consume(L);return}return Oe(L)?(t.consume(L),D(t.exit("chunkFlow")),a=0,i.interrupt=void 0,p):(t.consume(L),_)}function D(L,G){const se=i.sliceStream(L);if(G&&se.push(null),L.previous=f,f&&(f.next=L),f=L,c.defineSkip(L.start),c.write(se),i.parser.lazy[L.start.line]){let T=c.events.length;for(;T--;)if(c.events[T][1].start.offset<o&&(!c.events[T][1].end||c.events[T][1].end.offset>o))return;const V=i.events.length;let X=V,q,E;for(;X--;)if(i.events[X][0]==="exit"&&i.events[X][1].type==="chunkFlow"){if(q){E=i.events[X][1].end;break}q=!0}for(R(a),T=V;T<i.events.length;)i.events[T][1].end={...E},T++;jn(i.events,X+1,0,i.events.slice(V)),i.events.length=T}}function R(L){let G=l.length;for(;G-- >L;){const se=l[G];i.containerState=se[1],se[0].exit.call(i,t)}l.length=L}function z(){c.write([null]),f=void 0,c=void 0,i.containerState._closeFlow=void 0}}function ej(t,i,l){return lt(t,t.attempt(this.parser.constructs.document,i,l),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ol(t){if(t===null||Et(t)||hr(t))return 1;if(so(t))return 2}function oo(t,i,l){const a=[];let c=-1;for(;++c<t.length;){const f=t[c].resolveAll;f&&!a.includes(f)&&(i=f(i,l),a.push(f))}return i}const Mf={name:"attention",resolveAll:tj,tokenize:nj};function tj(t,i){let l=-1,a,c,f,o,p,h,g,b;for(;++l<t.length;)if(t[l][0]==="enter"&&t[l][1].type==="attentionSequence"&&t[l][1]._close){for(a=l;a--;)if(t[a][0]==="exit"&&t[a][1].type==="attentionSequence"&&t[a][1]._open&&i.sliceSerialize(t[a][1]).charCodeAt(0)===i.sliceSerialize(t[l][1]).charCodeAt(0)){if((t[a][1]._close||t[l][1]._open)&&(t[l][1].end.offset-t[l][1].start.offset)%3&&!((t[a][1].end.offset-t[a][1].start.offset+t[l][1].end.offset-t[l][1].start.offset)%3))continue;h=t[a][1].end.offset-t[a][1].start.offset>1&&t[l][1].end.offset-t[l][1].start.offset>1?2:1;const y={...t[a][1].end},v={...t[l][1].start};Sy(y,-h),Sy(v,h),o={type:h>1?"strongSequence":"emphasisSequence",start:y,end:{...t[a][1].end}},p={type:h>1?"strongSequence":"emphasisSequence",start:{...t[l][1].start},end:v},f={type:h>1?"strongText":"emphasisText",start:{...t[a][1].end},end:{...t[l][1].start}},c={type:h>1?"strong":"emphasis",start:{...o.start},end:{...p.end}},t[a][1].end={...o.start},t[l][1].start={...p.end},g=[],t[a][1].end.offset-t[a][1].start.offset&&(g=_n(g,[["enter",t[a][1],i],["exit",t[a][1],i]])),g=_n(g,[["enter",c,i],["enter",o,i],["exit",o,i],["enter",f,i]]),g=_n(g,oo(i.parser.constructs.insideSpan.null,t.slice(a+1,l),i)),g=_n(g,[["exit",f,i],["enter",p,i],["exit",p,i],["exit",c,i]]),t[l][1].end.offset-t[l][1].start.offset?(b=2,g=_n(g,[["enter",t[l][1],i],["exit",t[l][1],i]])):b=0,jn(t,a-1,l-a+3,g),l=a+g.length-b-2;break}}for(l=-1;++l<t.length;)t[l][1].type==="attentionSequence"&&(t[l][1].type="data");return t}function nj(t,i){const l=this.parser.constructs.attentionMarkers.null,a=this.previous,c=ol(a);let f;return o;function o(h){return f=h,t.enter("attentionSequence"),p(h)}function p(h){if(h===f)return t.consume(h),p;const g=t.exit("attentionSequence"),b=ol(h),y=!b||b===2&&c||l.includes(h),v=!c||c===2&&b||l.includes(a);return g._open=!!(f===42?y:y&&(c||!v)),g._close=!!(f===42?v:v&&(b||!y)),i(h)}}function Sy(t,i){t.column+=i,t.offset+=i,t._bufferIndex+=i}const ij={name:"autolink",tokenize:rj};function rj(t,i,l){let a=0;return c;function c(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),f}function f(x){return rn(x)?(t.consume(x),o):x===64?l(x):g(x)}function o(x){return x===43||x===45||x===46||Jt(x)?(a=1,p(x)):g(x)}function p(x){return x===58?(t.consume(x),a=0,h):(x===43||x===45||x===46||Jt(x))&&a++<32?(t.consume(x),p):(a=0,g(x))}function h(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),i):x===null||x===32||x===60||eo(x)?l(x):(t.consume(x),h)}function g(x){return x===64?(t.consume(x),b):Xw(x)?(t.consume(x),g):l(x)}function b(x){return Jt(x)?y(x):l(x)}function y(x){return x===46?(t.consume(x),a=0,b):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),i):v(x)}function v(x){if((x===45||Jt(x))&&a++<63){const k=x===45?v:y;return t.consume(x),k}return l(x)}}const Sa={partial:!0,tokenize:lj};function lj(t,i,l){return a;function a(f){return We(f)?lt(t,c,"linePrefix")(f):c(f)}function c(f){return f===null||Oe(f)?i(f):l(f)}}const _b={continuation:{tokenize:sj},exit:oj,name:"blockQuote",tokenize:aj};function aj(t,i,l){const a=this;return c;function c(o){if(o===62){const p=a.containerState;return p.open||(t.enter("blockQuote",{_container:!0}),p.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),f}return l(o)}function f(o){return We(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),i):(t.exit("blockQuotePrefix"),i(o))}}function sj(t,i,l){const a=this;return c;function c(o){return We(o)?lt(t,f,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):f(o)}function f(o){return t.attempt(_b,i,l)(o)}}function oj(t){t.exit("blockQuote")}const Ob={name:"characterEscape",tokenize:uj};function uj(t,i,l){return a;function a(f){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(f),t.exit("escapeMarker"),c}function c(f){return $w(f)?(t.enter("characterEscapeValue"),t.consume(f),t.exit("characterEscapeValue"),t.exit("characterEscape"),i):l(f)}}const Lb={name:"characterReference",tokenize:cj};function cj(t,i,l){const a=this;let c=0,f,o;return p;function p(y){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),h}function h(y){return y===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(y),t.exit("characterReferenceMarkerNumeric"),g):(t.enter("characterReferenceValue"),f=31,o=Jt,b(y))}function g(y){return y===88||y===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(y),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),f=6,o=Kw,b):(t.enter("characterReferenceValue"),f=7,o=Df,b(y))}function b(y){if(y===59&&c){const v=t.exit("characterReferenceValue");return o===Jt&&!ld(a.sliceSerialize(v))?l(y):(t.enter("characterReferenceMarker"),t.consume(y),t.exit("characterReferenceMarker"),t.exit("characterReference"),i)}return o(y)&&c++<f?(t.consume(y),b):l(y)}}const wy={partial:!0,tokenize:dj},jy={concrete:!0,name:"codeFenced",tokenize:fj};function fj(t,i,l){const a=this,c={partial:!0,tokenize:se};let f=0,o=0,p;return h;function h(T){return g(T)}function g(T){const V=a.events[a.events.length-1];return f=V&&V[1].type==="linePrefix"?V[2].sliceSerialize(V[1],!0).length:0,p=T,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),b(T)}function b(T){return T===p?(o++,t.consume(T),b):o<3?l(T):(t.exit("codeFencedFenceSequence"),We(T)?lt(t,y,"whitespace")(T):y(T))}function y(T){return T===null||Oe(T)?(t.exit("codeFencedFence"),a.interrupt?i(T):t.check(wy,_,G)(T)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),v(T))}function v(T){return T===null||Oe(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),y(T)):We(T)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),lt(t,x,"whitespace")(T)):T===96&&T===p?l(T):(t.consume(T),v)}function x(T){return T===null||Oe(T)?y(T):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||Oe(T)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),y(T)):T===96&&T===p?l(T):(t.consume(T),k)}function _(T){return t.attempt(c,G,D)(T)}function D(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),R}function R(T){return f>0&&We(T)?lt(t,z,"linePrefix",f+1)(T):z(T)}function z(T){return T===null||Oe(T)?t.check(wy,_,G)(T):(t.enter("codeFlowValue"),L(T))}function L(T){return T===null||Oe(T)?(t.exit("codeFlowValue"),z(T)):(t.consume(T),L)}function G(T){return t.exit("codeFenced"),i(T)}function se(T,V,X){let q=0;return E;function E(W){return T.enter("lineEnding"),T.consume(W),T.exit("lineEnding"),U}function U(W){return T.enter("codeFencedFence"),We(W)?lt(T,H,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):H(W)}function H(W){return W===p?(T.enter("codeFencedFenceSequence"),Z(W)):X(W)}function Z(W){return W===p?(q++,T.consume(W),Z):q>=o?(T.exit("codeFencedFenceSequence"),We(W)?lt(T,ee,"whitespace")(W):ee(W)):X(W)}function ee(W){return W===null||Oe(W)?(T.exit("codeFencedFence"),V(W)):X(W)}}}function dj(t,i,l){const a=this;return c;function c(o){return o===null?l(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),f)}function f(o){return a.parser.lazy[a.now().line]?l(o):i(o)}}const uf={name:"codeIndented",tokenize:pj},hj={partial:!0,tokenize:mj};function pj(t,i,l){const a=this;return c;function c(g){return t.enter("codeIndented"),lt(t,f,"linePrefix",5)(g)}function f(g){const b=a.events[a.events.length-1];return b&&b[1].type==="linePrefix"&&b[2].sliceSerialize(b[1],!0).length>=4?o(g):l(g)}function o(g){return g===null?h(g):Oe(g)?t.attempt(hj,o,h)(g):(t.enter("codeFlowValue"),p(g))}function p(g){return g===null||Oe(g)?(t.exit("codeFlowValue"),o(g)):(t.consume(g),p)}function h(g){return t.exit("codeIndented"),i(g)}}function mj(t,i,l){const a=this;return c;function c(o){return a.parser.lazy[a.now().line]?l(o):Oe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),c):lt(t,f,"linePrefix",5)(o)}function f(o){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?i(o):Oe(o)?c(o):l(o)}}const gj={name:"codeText",previous:bj,resolve:yj,tokenize:vj};function yj(t){let i=t.length-4,l=3,a,c;if((t[l][1].type==="lineEnding"||t[l][1].type==="space")&&(t[i][1].type==="lineEnding"||t[i][1].type==="space")){for(a=l;++a<i;)if(t[a][1].type==="codeTextData"){t[l][1].type="codeTextPadding",t[i][1].type="codeTextPadding",l+=2,i-=2;break}}for(a=l-1,i++;++a<=i;)c===void 0?a!==i&&t[a][1].type!=="lineEnding"&&(c=a):(a===i||t[a][1].type==="lineEnding")&&(t[c][1].type="codeTextData",a!==c+2&&(t[c][1].end=t[a-1][1].end,t.splice(c+2,a-c-2),i-=a-c-2,a=c+2),c=void 0);return t}function bj(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vj(t,i,l){let a=0,c,f;return o;function o(y){return t.enter("codeText"),t.enter("codeTextSequence"),p(y)}function p(y){return y===96?(t.consume(y),a++,p):(t.exit("codeTextSequence"),h(y))}function h(y){return y===null?l(y):y===32?(t.enter("space"),t.consume(y),t.exit("space"),h):y===96?(f=t.enter("codeTextSequence"),c=0,b(y)):Oe(y)?(t.enter("lineEnding"),t.consume(y),t.exit("lineEnding"),h):(t.enter("codeTextData"),g(y))}function g(y){return y===null||y===32||y===96||Oe(y)?(t.exit("codeTextData"),h(y)):(t.consume(y),g)}function b(y){return y===96?(t.consume(y),c++,b):c===a?(t.exit("codeTextSequence"),t.exit("codeText"),i(y)):(f.type="codeTextData",g(y))}}class xj{constructor(i){this.left=i?[...i]:[],this.right=[]}get(i){if(i<0||i>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+i+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return i<this.left.length?this.left[i]:this.right[this.right.length-i+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(i,l){const a=l??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(i,a):i>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-i+this.left.length).reverse():this.left.slice(i).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(i,l,a){const c=l||0;this.setCursor(Math.trunc(i));const f=this.right.splice(this.right.length-c,Number.POSITIVE_INFINITY);return a&&oa(this.left,a),f.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(i){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(i)}pushMany(i){this.setCursor(Number.POSITIVE_INFINITY),oa(this.left,i)}unshift(i){this.setCursor(0),this.right.push(i)}unshiftMany(i){this.setCursor(0),oa(this.right,i.reverse())}setCursor(i){if(!(i===this.left.length||i>this.left.length&&this.right.length===0||i<0&&this.left.length===0))if(i<this.left.length){const l=this.left.splice(i,Number.POSITIVE_INFINITY);oa(this.right,l.reverse())}else{const l=this.right.splice(this.left.length+this.right.length-i,Number.POSITIVE_INFINITY);oa(this.left,l.reverse())}}}function oa(t,i){let l=0;if(i.length<1e4)t.push(...i);else for(;l<i.length;)t.push(...i.slice(l,l+1e4)),l+=1e4}function Bb(t){const i={};let l=-1,a,c,f,o,p,h,g;const b=new xj(t);for(;++l<b.length;){for(;l in i;)l=i[l];if(a=b.get(l),l&&a[1].type==="chunkFlow"&&b.get(l-1)[1].type==="listItemPrefix"&&(h=a[1]._tokenizer.events,f=0,f<h.length&&h[f][1].type==="lineEndingBlank"&&(f+=2),f<h.length&&h[f][1].type==="content"))for(;++f<h.length&&h[f][1].type!=="content";)h[f][1].type==="chunkText"&&(h[f][1]._isInFirstContentOfListItem=!0,f++);if(a[0]==="enter")a[1].contentType&&(Object.assign(i,Sj(b,l)),l=i[l],g=!0);else if(a[1]._container){for(f=l,c=void 0;f--;)if(o=b.get(f),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(c&&(b.get(c)[1].type="lineEndingBlank"),o[1].type="lineEnding",c=f);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;c&&(a[1].end={...b.get(c)[1].start},p=b.slice(c,l),p.unshift(a),b.splice(c,l-c+1,p))}}return jn(t,0,Number.POSITIVE_INFINITY,b.slice(0)),!g}function Sj(t,i){const l=t.get(i)[1],a=t.get(i)[2];let c=i-1;const f=[];let o=l._tokenizer;o||(o=a.parser[l.contentType](l.start),l._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const p=o.events,h=[],g={};let b,y,v=-1,x=l,k=0,_=0;const D=[_];for(;x;){for(;t.get(++c)[1]!==x;);f.push(c),x._tokenizer||(b=a.sliceStream(x),x.next||b.push(null),y&&o.defineSkip(x.start),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(b),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),y=x,x=x.next}for(x=l;++v<p.length;)p[v][0]==="exit"&&p[v-1][0]==="enter"&&p[v][1].type===p[v-1][1].type&&p[v][1].start.line!==p[v][1].end.line&&(_=v+1,D.push(_),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(o.events=[],x?(x._tokenizer=void 0,x.previous=void 0):D.pop(),v=D.length;v--;){const R=p.slice(D[v],D[v+1]),z=f.pop();h.push([z,z+R.length-1]),t.splice(z,2,R)}for(h.reverse(),v=-1;++v<h.length;)g[k+h[v][0]]=k+h[v][1],k+=h[v][1]-h[v][0]-1;return g}const wj={resolve:kj,tokenize:Cj},jj={partial:!0,tokenize:Ej};function kj(t){return Bb(t),t}function Cj(t,i){let l;return a;function a(p){return t.enter("content"),l=t.enter("chunkContent",{contentType:"content"}),c(p)}function c(p){return p===null?f(p):Oe(p)?t.check(jj,o,f)(p):(t.consume(p),c)}function f(p){return t.exit("chunkContent"),t.exit("content"),i(p)}function o(p){return t.consume(p),t.exit("chunkContent"),l.next=t.enter("chunkContent",{contentType:"content",previous:l}),l=l.next,c}}function Ej(t,i,l){const a=this;return c;function c(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),lt(t,f,"linePrefix")}function f(o){if(o===null||Oe(o))return l(o);const p=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?i(o):t.interrupt(a.parser.constructs.flow,l,i)(o)}}function Ub(t,i,l,a,c,f,o,p,h){const g=h||Number.POSITIVE_INFINITY;let b=0;return y;function y(R){return R===60?(t.enter(a),t.enter(c),t.enter(f),t.consume(R),t.exit(f),v):R===null||R===32||R===41||eo(R)?l(R):(t.enter(a),t.enter(o),t.enter(p),t.enter("chunkString",{contentType:"string"}),_(R))}function v(R){return R===62?(t.enter(f),t.consume(R),t.exit(f),t.exit(c),t.exit(a),i):(t.enter(p),t.enter("chunkString",{contentType:"string"}),x(R))}function x(R){return R===62?(t.exit("chunkString"),t.exit(p),v(R)):R===null||R===60||Oe(R)?l(R):(t.consume(R),R===92?k:x)}function k(R){return R===60||R===62||R===92?(t.consume(R),x):x(R)}function _(R){return!b&&(R===null||R===41||Et(R))?(t.exit("chunkString"),t.exit(p),t.exit(o),t.exit(a),i(R)):b<g&&R===40?(t.consume(R),b++,_):R===41?(t.consume(R),b--,_):R===null||R===32||R===40||eo(R)?l(R):(t.consume(R),R===92?D:_)}function D(R){return R===40||R===41||R===92?(t.consume(R),_):_(R)}}function qb(t,i,l,a,c,f){const o=this;let p=0,h;return g;function g(x){return t.enter(a),t.enter(c),t.consume(x),t.exit(c),t.enter(f),b}function b(x){return p>999||x===null||x===91||x===93&&!h||x===94&&!p&&"_hiddenFootnoteSupport"in o.parser.constructs?l(x):x===93?(t.exit(f),t.enter(c),t.consume(x),t.exit(c),t.exit(a),i):Oe(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),b):(t.enter("chunkString",{contentType:"string"}),y(x))}function y(x){return x===null||x===91||x===93||Oe(x)||p++>999?(t.exit("chunkString"),b(x)):(t.consume(x),h||(h=!We(x)),x===92?v:y)}function v(x){return x===91||x===92||x===93?(t.consume(x),p++,y):y(x)}}function Ib(t,i,l,a,c,f){let o;return p;function p(v){return v===34||v===39||v===40?(t.enter(a),t.enter(c),t.consume(v),t.exit(c),o=v===40?41:v,h):l(v)}function h(v){return v===o?(t.enter(c),t.consume(v),t.exit(c),t.exit(a),i):(t.enter(f),g(v))}function g(v){return v===o?(t.exit(f),h(o)):v===null?l(v):Oe(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),lt(t,g,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),b(v))}function b(v){return v===o||v===null||Oe(v)?(t.exit("chunkString"),g(v)):(t.consume(v),v===92?y:b)}function y(v){return v===o||v===92?(t.consume(v),b):b(v)}}function da(t,i){let l;return a;function a(c){return Oe(c)?(t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),l=!0,a):We(c)?lt(t,a,l?"linePrefix":"lineSuffix")(c):i(c)}}const Nj={name:"definition",tokenize:Tj},Aj={partial:!0,tokenize:zj};function Tj(t,i,l){const a=this;let c;return f;function f(x){return t.enter("definition"),o(x)}function o(x){return qb.call(a,t,p,l,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function p(x){return c=Vn(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),h):l(x)}function h(x){return Et(x)?da(t,g)(x):g(x)}function g(x){return Ub(t,b,l,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function b(x){return t.attempt(Aj,y,y)(x)}function y(x){return We(x)?lt(t,v,"whitespace")(x):v(x)}function v(x){return x===null||Oe(x)?(t.exit("definition"),a.parser.defined.push(c),i(x)):l(x)}}function zj(t,i,l){return a;function a(p){return Et(p)?da(t,c)(p):l(p)}function c(p){return Ib(t,f,l,"definitionTitle","definitionTitleMarker","definitionTitleString")(p)}function f(p){return We(p)?lt(t,o,"whitespace")(p):o(p)}function o(p){return p===null||Oe(p)?i(p):l(p)}}const Rj={name:"hardBreakEscape",tokenize:Dj};function Dj(t,i,l){return a;function a(f){return t.enter("hardBreakEscape"),t.consume(f),c}function c(f){return Oe(f)?(t.exit("hardBreakEscape"),i(f)):l(f)}}const Mj={name:"headingAtx",resolve:_j,tokenize:Oj};function _j(t,i){let l=t.length-2,a=3,c,f;return t[a][1].type==="whitespace"&&(a+=2),l-2>a&&t[l][1].type==="whitespace"&&(l-=2),t[l][1].type==="atxHeadingSequence"&&(a===l-1||l-4>a&&t[l-2][1].type==="whitespace")&&(l-=a+1===l?2:4),l>a&&(c={type:"atxHeadingText",start:t[a][1].start,end:t[l][1].end},f={type:"chunkText",start:t[a][1].start,end:t[l][1].end,contentType:"text"},jn(t,a,l-a+1,[["enter",c,i],["enter",f,i],["exit",f,i],["exit",c,i]])),t}function Oj(t,i,l){let a=0;return c;function c(b){return t.enter("atxHeading"),f(b)}function f(b){return t.enter("atxHeadingSequence"),o(b)}function o(b){return b===35&&a++<6?(t.consume(b),o):b===null||Et(b)?(t.exit("atxHeadingSequence"),p(b)):l(b)}function p(b){return b===35?(t.enter("atxHeadingSequence"),h(b)):b===null||Oe(b)?(t.exit("atxHeading"),i(b)):We(b)?lt(t,p,"whitespace")(b):(t.enter("atxHeadingText"),g(b))}function h(b){return b===35?(t.consume(b),h):(t.exit("atxHeadingSequence"),p(b))}function g(b){return b===null||b===35||Et(b)?(t.exit("atxHeadingText"),p(b)):(t.consume(b),g)}}const Lj=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ky=["pre","script","style","textarea"],Bj={concrete:!0,name:"htmlFlow",resolveTo:Ij,tokenize:Hj},Uj={partial:!0,tokenize:Yj},qj={partial:!0,tokenize:Vj};function Ij(t){let i=t.length;for(;i--&&!(t[i][0]==="enter"&&t[i][1].type==="htmlFlow"););return i>1&&t[i-2][1].type==="linePrefix"&&(t[i][1].start=t[i-2][1].start,t[i+1][1].start=t[i-2][1].start,t.splice(i-2,2)),t}function Hj(t,i,l){const a=this;let c,f,o,p,h;return g;function g(A){return b(A)}function b(A){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(A),y}function y(A){return A===33?(t.consume(A),v):A===47?(t.consume(A),f=!0,_):A===63?(t.consume(A),c=3,a.interrupt?i:j):rn(A)?(t.consume(A),o=String.fromCharCode(A),D):l(A)}function v(A){return A===45?(t.consume(A),c=2,x):A===91?(t.consume(A),c=5,p=0,k):rn(A)?(t.consume(A),c=4,a.interrupt?i:j):l(A)}function x(A){return A===45?(t.consume(A),a.interrupt?i:j):l(A)}function k(A){const ae="CDATA[";return A===ae.charCodeAt(p++)?(t.consume(A),p===ae.length?a.interrupt?i:H:k):l(A)}function _(A){return rn(A)?(t.consume(A),o=String.fromCharCode(A),D):l(A)}function D(A){if(A===null||A===47||A===62||Et(A)){const ae=A===47,pe=o.toLowerCase();return!ae&&!f&&ky.includes(pe)?(c=1,a.interrupt?i(A):H(A)):Lj.includes(o.toLowerCase())?(c=6,ae?(t.consume(A),R):a.interrupt?i(A):H(A)):(c=7,a.interrupt&&!a.parser.lazy[a.now().line]?l(A):f?z(A):L(A))}return A===45||Jt(A)?(t.consume(A),o+=String.fromCharCode(A),D):l(A)}function R(A){return A===62?(t.consume(A),a.interrupt?i:H):l(A)}function z(A){return We(A)?(t.consume(A),z):E(A)}function L(A){return A===47?(t.consume(A),E):A===58||A===95||rn(A)?(t.consume(A),G):We(A)?(t.consume(A),L):E(A)}function G(A){return A===45||A===46||A===58||A===95||Jt(A)?(t.consume(A),G):se(A)}function se(A){return A===61?(t.consume(A),T):We(A)?(t.consume(A),se):L(A)}function T(A){return A===null||A===60||A===61||A===62||A===96?l(A):A===34||A===39?(t.consume(A),h=A,V):We(A)?(t.consume(A),T):X(A)}function V(A){return A===h?(t.consume(A),h=null,q):A===null||Oe(A)?l(A):(t.consume(A),V)}function X(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Et(A)?se(A):(t.consume(A),X)}function q(A){return A===47||A===62||We(A)?L(A):l(A)}function E(A){return A===62?(t.consume(A),U):l(A)}function U(A){return A===null||Oe(A)?H(A):We(A)?(t.consume(A),U):l(A)}function H(A){return A===45&&c===2?(t.consume(A),N):A===60&&c===1?(t.consume(A),K):A===62&&c===4?(t.consume(A),O):A===63&&c===3?(t.consume(A),j):A===93&&c===5?(t.consume(A),ge):Oe(A)&&(c===6||c===7)?(t.exit("htmlFlowData"),t.check(Uj,J,Z)(A)):A===null||Oe(A)?(t.exit("htmlFlowData"),Z(A)):(t.consume(A),H)}function Z(A){return t.check(qj,ee,J)(A)}function ee(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),W}function W(A){return A===null||Oe(A)?Z(A):(t.enter("htmlFlowData"),H(A))}function N(A){return A===45?(t.consume(A),j):H(A)}function K(A){return A===47?(t.consume(A),o="",he):H(A)}function he(A){if(A===62){const ae=o.toLowerCase();return ky.includes(ae)?(t.consume(A),O):H(A)}return rn(A)&&o.length<8?(t.consume(A),o+=String.fromCharCode(A),he):H(A)}function ge(A){return A===93?(t.consume(A),j):H(A)}function j(A){return A===62?(t.consume(A),O):A===45&&c===2?(t.consume(A),j):H(A)}function O(A){return A===null||Oe(A)?(t.exit("htmlFlowData"),J(A)):(t.consume(A),O)}function J(A){return t.exit("htmlFlow"),i(A)}}function Vj(t,i,l){const a=this;return c;function c(o){return Oe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),f):l(o)}function f(o){return a.parser.lazy[a.now().line]?l(o):i(o)}}function Yj(t,i,l){return a;function a(c){return t.enter("lineEnding"),t.consume(c),t.exit("lineEnding"),t.attempt(Sa,i,l)}}const Gj={name:"htmlText",tokenize:Fj};function Fj(t,i,l){const a=this;let c,f,o;return p;function p(j){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(j),h}function h(j){return j===33?(t.consume(j),g):j===47?(t.consume(j),se):j===63?(t.consume(j),L):rn(j)?(t.consume(j),X):l(j)}function g(j){return j===45?(t.consume(j),b):j===91?(t.consume(j),f=0,k):rn(j)?(t.consume(j),z):l(j)}function b(j){return j===45?(t.consume(j),x):l(j)}function y(j){return j===null?l(j):j===45?(t.consume(j),v):Oe(j)?(o=y,K(j)):(t.consume(j),y)}function v(j){return j===45?(t.consume(j),x):y(j)}function x(j){return j===62?N(j):j===45?v(j):y(j)}function k(j){const O="CDATA[";return j===O.charCodeAt(f++)?(t.consume(j),f===O.length?_:k):l(j)}function _(j){return j===null?l(j):j===93?(t.consume(j),D):Oe(j)?(o=_,K(j)):(t.consume(j),_)}function D(j){return j===93?(t.consume(j),R):_(j)}function R(j){return j===62?N(j):j===93?(t.consume(j),R):_(j)}function z(j){return j===null||j===62?N(j):Oe(j)?(o=z,K(j)):(t.consume(j),z)}function L(j){return j===null?l(j):j===63?(t.consume(j),G):Oe(j)?(o=L,K(j)):(t.consume(j),L)}function G(j){return j===62?N(j):L(j)}function se(j){return rn(j)?(t.consume(j),T):l(j)}function T(j){return j===45||Jt(j)?(t.consume(j),T):V(j)}function V(j){return Oe(j)?(o=V,K(j)):We(j)?(t.consume(j),V):N(j)}function X(j){return j===45||Jt(j)?(t.consume(j),X):j===47||j===62||Et(j)?q(j):l(j)}function q(j){return j===47?(t.consume(j),N):j===58||j===95||rn(j)?(t.consume(j),E):Oe(j)?(o=q,K(j)):We(j)?(t.consume(j),q):N(j)}function E(j){return j===45||j===46||j===58||j===95||Jt(j)?(t.consume(j),E):U(j)}function U(j){return j===61?(t.consume(j),H):Oe(j)?(o=U,K(j)):We(j)?(t.consume(j),U):q(j)}function H(j){return j===null||j===60||j===61||j===62||j===96?l(j):j===34||j===39?(t.consume(j),c=j,Z):Oe(j)?(o=H,K(j)):We(j)?(t.consume(j),H):(t.consume(j),ee)}function Z(j){return j===c?(t.consume(j),c=void 0,W):j===null?l(j):Oe(j)?(o=Z,K(j)):(t.consume(j),Z)}function ee(j){return j===null||j===34||j===39||j===60||j===61||j===96?l(j):j===47||j===62||Et(j)?q(j):(t.consume(j),ee)}function W(j){return j===47||j===62||Et(j)?q(j):l(j)}function N(j){return j===62?(t.consume(j),t.exit("htmlTextData"),t.exit("htmlText"),i):l(j)}function K(j){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(j),t.exit("lineEnding"),he}function he(j){return We(j)?lt(t,ge,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):ge(j)}function ge(j){return t.enter("htmlTextData"),o(j)}}const ad={name:"labelEnd",resolveAll:$j,resolveTo:Zj,tokenize:Pj},Qj={tokenize:Jj},Xj={tokenize:Wj},Kj={tokenize:ek};function $j(t){let i=-1;const l=[];for(;++i<t.length;){const a=t[i][1];if(l.push(t[i]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const c=a.type==="labelImage"?4:2;a.type="data",i+=c}}return t.length!==l.length&&jn(t,0,t.length,l),t}function Zj(t,i){let l=t.length,a=0,c,f,o,p;for(;l--;)if(c=t[l][1],f){if(c.type==="link"||c.type==="labelLink"&&c._inactive)break;t[l][0]==="enter"&&c.type==="labelLink"&&(c._inactive=!0)}else if(o){if(t[l][0]==="enter"&&(c.type==="labelImage"||c.type==="labelLink")&&!c._balanced&&(f=l,c.type!=="labelLink")){a=2;break}}else c.type==="labelEnd"&&(o=l);const h={type:t[f][1].type==="labelLink"?"link":"image",start:{...t[f][1].start},end:{...t[t.length-1][1].end}},g={type:"label",start:{...t[f][1].start},end:{...t[o][1].end}},b={type:"labelText",start:{...t[f+a+2][1].end},end:{...t[o-2][1].start}};return p=[["enter",h,i],["enter",g,i]],p=_n(p,t.slice(f+1,f+a+3)),p=_n(p,[["enter",b,i]]),p=_n(p,oo(i.parser.constructs.insideSpan.null,t.slice(f+a+4,o-3),i)),p=_n(p,[["exit",b,i],t[o-2],t[o-1],["exit",g,i]]),p=_n(p,t.slice(o+1)),p=_n(p,[["exit",h,i]]),jn(t,f,t.length,p),t}function Pj(t,i,l){const a=this;let c=a.events.length,f,o;for(;c--;)if((a.events[c][1].type==="labelImage"||a.events[c][1].type==="labelLink")&&!a.events[c][1]._balanced){f=a.events[c][1];break}return p;function p(v){return f?f._inactive?y(v):(o=a.parser.defined.includes(Vn(a.sliceSerialize({start:f.end,end:a.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(v),t.exit("labelMarker"),t.exit("labelEnd"),h):l(v)}function h(v){return v===40?t.attempt(Qj,b,o?b:y)(v):v===91?t.attempt(Xj,b,o?g:y)(v):o?b(v):y(v)}function g(v){return t.attempt(Kj,b,y)(v)}function b(v){return i(v)}function y(v){return f._balanced=!0,l(v)}}function Jj(t,i,l){return a;function a(y){return t.enter("resource"),t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),c}function c(y){return Et(y)?da(t,f)(y):f(y)}function f(y){return y===41?b(y):Ub(t,o,p,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function o(y){return Et(y)?da(t,h)(y):b(y)}function p(y){return l(y)}function h(y){return y===34||y===39||y===40?Ib(t,g,l,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):b(y)}function g(y){return Et(y)?da(t,b)(y):b(y)}function b(y){return y===41?(t.enter("resourceMarker"),t.consume(y),t.exit("resourceMarker"),t.exit("resource"),i):l(y)}}function Wj(t,i,l){const a=this;return c;function c(p){return qb.call(a,t,f,o,"reference","referenceMarker","referenceString")(p)}function f(p){return a.parser.defined.includes(Vn(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?i(p):l(p)}function o(p){return l(p)}}function ek(t,i,l){return a;function a(f){return t.enter("reference"),t.enter("referenceMarker"),t.consume(f),t.exit("referenceMarker"),c}function c(f){return f===93?(t.enter("referenceMarker"),t.consume(f),t.exit("referenceMarker"),t.exit("reference"),i):l(f)}}const tk={name:"labelStartImage",resolveAll:ad.resolveAll,tokenize:nk};function nk(t,i,l){const a=this;return c;function c(p){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(p),t.exit("labelImageMarker"),f}function f(p){return p===91?(t.enter("labelMarker"),t.consume(p),t.exit("labelMarker"),t.exit("labelImage"),o):l(p)}function o(p){return p===94&&"_hiddenFootnoteSupport"in a.parser.constructs?l(p):i(p)}}const ik={name:"labelStartLink",resolveAll:ad.resolveAll,tokenize:rk};function rk(t,i,l){const a=this;return c;function c(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),f}function f(o){return o===94&&"_hiddenFootnoteSupport"in a.parser.constructs?l(o):i(o)}}const cf={name:"lineEnding",tokenize:lk};function lk(t,i){return l;function l(a){return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),lt(t,i,"linePrefix")}}const Ks={name:"thematicBreak",tokenize:ak};function ak(t,i,l){let a=0,c;return f;function f(g){return t.enter("thematicBreak"),o(g)}function o(g){return c=g,p(g)}function p(g){return g===c?(t.enter("thematicBreakSequence"),h(g)):a>=3&&(g===null||Oe(g))?(t.exit("thematicBreak"),i(g)):l(g)}function h(g){return g===c?(t.consume(g),a++,h):(t.exit("thematicBreakSequence"),We(g)?lt(t,p,"whitespace")(g):p(g))}}const dn={continuation:{tokenize:ck},exit:dk,name:"list",tokenize:uk},sk={partial:!0,tokenize:hk},ok={partial:!0,tokenize:fk};function uk(t,i,l){const a=this,c=a.events[a.events.length-1];let f=c&&c[1].type==="linePrefix"?c[2].sliceSerialize(c[1],!0).length:0,o=0;return p;function p(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Df(x)){if(a.containerState.type||(a.containerState.type=k,t.enter(k,{_container:!0})),k==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(Ks,l,g)(x):g(x);if(!a.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),h(x)}return l(x)}function h(x){return Df(x)&&++o<10?(t.consume(x),h):(!a.interrupt||o<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),g(x)):l(x)}function g(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,t.check(Sa,a.interrupt?l:b,t.attempt(sk,v,y))}function b(x){return a.containerState.initialBlankLine=!0,f++,v(x)}function y(x){return We(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),v):l(x)}function v(x){return a.containerState.size=f+a.sliceSerialize(t.exit("listItemPrefix"),!0).length,i(x)}}function ck(t,i,l){const a=this;return a.containerState._closeFlow=void 0,t.check(Sa,c,f);function c(p){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,lt(t,i,"listItemIndent",a.containerState.size+1)(p)}function f(p){return a.containerState.furtherBlankLines||!We(p)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(p)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,t.attempt(ok,i,o)(p))}function o(p){return a.containerState._closeFlow=!0,a.interrupt=void 0,lt(t,t.attempt(dn,i,l),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(p)}}function fk(t,i,l){const a=this;return lt(t,c,"listItemIndent",a.containerState.size+1);function c(f){const o=a.events[a.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?i(f):l(f)}}function dk(t){t.exit(this.containerState.type)}function hk(t,i,l){const a=this;return lt(t,c,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function c(f){const o=a.events[a.events.length-1];return!We(f)&&o&&o[1].type==="listItemPrefixWhitespace"?i(f):l(f)}}const Cy={name:"setextUnderline",resolveTo:pk,tokenize:mk};function pk(t,i){let l=t.length,a,c,f;for(;l--;)if(t[l][0]==="enter"){if(t[l][1].type==="content"){a=l;break}t[l][1].type==="paragraph"&&(c=l)}else t[l][1].type==="content"&&t.splice(l,1),!f&&t[l][1].type==="definition"&&(f=l);const o={type:"setextHeading",start:{...t[a][1].start},end:{...t[t.length-1][1].end}};return t[c][1].type="setextHeadingText",f?(t.splice(c,0,["enter",o,i]),t.splice(f+1,0,["exit",t[a][1],i]),t[a][1].end={...t[f][1].end}):t[a][1]=o,t.push(["exit",o,i]),t}function mk(t,i,l){const a=this;let c;return f;function f(g){let b=a.events.length,y;for(;b--;)if(a.events[b][1].type!=="lineEnding"&&a.events[b][1].type!=="linePrefix"&&a.events[b][1].type!=="content"){y=a.events[b][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||y)?(t.enter("setextHeadingLine"),c=g,o(g)):l(g)}function o(g){return t.enter("setextHeadingLineSequence"),p(g)}function p(g){return g===c?(t.consume(g),p):(t.exit("setextHeadingLineSequence"),We(g)?lt(t,h,"lineSuffix")(g):h(g))}function h(g){return g===null||Oe(g)?(t.exit("setextHeadingLine"),i(g)):l(g)}}const gk={tokenize:yk};function yk(t){const i=this,l=t.attempt(Sa,a,t.attempt(this.parser.constructs.flowInitial,c,lt(t,t.attempt(this.parser.constructs.flow,c,t.attempt(wj,c)),"linePrefix")));return l;function a(f){if(f===null){t.consume(f);return}return t.enter("lineEndingBlank"),t.consume(f),t.exit("lineEndingBlank"),i.currentConstruct=void 0,l}function c(f){if(f===null){t.consume(f);return}return t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),i.currentConstruct=void 0,l}}const bk={resolveAll:Vb()},vk=Hb("string"),xk=Hb("text");function Hb(t){return{resolveAll:Vb(t==="text"?Sk:void 0),tokenize:i};function i(l){const a=this,c=this.parser.constructs[t],f=l.attempt(c,o,p);return o;function o(b){return g(b)?f(b):p(b)}function p(b){if(b===null){l.consume(b);return}return l.enter("data"),l.consume(b),h}function h(b){return g(b)?(l.exit("data"),f(b)):(l.consume(b),h)}function g(b){if(b===null)return!0;const y=c[b];let v=-1;if(y)for(;++v<y.length;){const x=y[v];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function Vb(t){return i;function i(l,a){let c=-1,f;for(;++c<=l.length;)f===void 0?l[c]&&l[c][1].type==="data"&&(f=c,c++):(!l[c]||l[c][1].type!=="data")&&(c!==f+2&&(l[f][1].end=l[c-1][1].end,l.splice(f+2,c-f-2),c=f+2),f=void 0);return t?t(l,a):l}}function Sk(t,i){let l=0;for(;++l<=t.length;)if((l===t.length||t[l][1].type==="lineEnding")&&t[l-1][1].type==="data"){const a=t[l-1][1],c=i.sliceStream(a);let f=c.length,o=-1,p=0,h;for(;f--;){const g=c[f];if(typeof g=="string"){for(o=g.length;g.charCodeAt(o-1)===32;)p++,o--;if(o)break;o=-1}else if(g===-2)h=!0,p++;else if(g!==-1){f++;break}}if(i._contentTypeTextTrailing&&l===t.length&&(p=0),p){const g={type:l===t.length||h||p<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:f?o:a.start._bufferIndex+o,_index:a.start._index+f,line:a.end.line,column:a.end.column-p,offset:a.end.offset-p},end:{...a.end}};a.end={...g.start},a.start.offset===a.end.offset?Object.assign(a,g):(t.splice(l,0,["enter",g,i],["exit",g,i]),l+=2)}l++}return t}const wk={42:dn,43:dn,45:dn,48:dn,49:dn,50:dn,51:dn,52:dn,53:dn,54:dn,55:dn,56:dn,57:dn,62:_b},jk={91:Nj},kk={[-2]:uf,[-1]:uf,32:uf},Ck={35:Mj,42:Ks,45:[Cy,Ks],60:Bj,61:Cy,95:Ks,96:jy,126:jy},Ek={38:Lb,92:Ob},Nk={[-5]:cf,[-4]:cf,[-3]:cf,33:tk,38:Lb,42:Mf,60:[ij,Gj],91:ik,92:[Rj,Ob],93:ad,95:Mf,96:gj},Ak={null:[Mf,bk]},Tk={null:[42,95]},zk={null:[]},Rk=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Tk,contentInitial:jk,disable:zk,document:wk,flow:Ck,flowInitial:kk,insideSpan:Ak,string:Ek,text:Nk},Symbol.toStringTag,{value:"Module"}));function Dk(t,i,l){let a={_bufferIndex:-1,_index:0,line:l&&l.line||1,column:l&&l.column||1,offset:l&&l.offset||0};const c={},f=[];let o=[],p=[];const h={attempt:V(se),check:V(T),consume:z,enter:L,exit:G,interrupt:V(T,{interrupt:!0})},g={code:null,containerState:{},defineSkip:_,events:[],now:k,parser:t,previous:null,sliceSerialize:v,sliceStream:x,write:y};let b=i.tokenize.call(g,h);return i.resolveAll&&f.push(i),g;function y(U){return o=_n(o,U),D(),o[o.length-1]!==null?[]:(X(i,0),g.events=oo(f,g.events,g),g.events)}function v(U,H){return _k(x(U),H)}function x(U){return Mk(o,U)}function k(){const{_bufferIndex:U,_index:H,line:Z,column:ee,offset:W}=a;return{_bufferIndex:U,_index:H,line:Z,column:ee,offset:W}}function _(U){c[U.line]=U.column,E()}function D(){let U;for(;a._index<o.length;){const H=o[a._index];if(typeof H=="string")for(U=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===U&&a._bufferIndex<H.length;)R(H.charCodeAt(a._bufferIndex));else R(H)}}function R(U){b=b(U)}function z(U){Oe(U)?(a.line++,a.column=1,a.offset+=U===-3?2:1,E()):U!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===o[a._index].length&&(a._bufferIndex=-1,a._index++)),g.previous=U}function L(U,H){const Z=H||{};return Z.type=U,Z.start=k(),g.events.push(["enter",Z,g]),p.push(Z),Z}function G(U){const H=p.pop();return H.end=k(),g.events.push(["exit",H,g]),H}function se(U,H){X(U,H.from)}function T(U,H){H.restore()}function V(U,H){return Z;function Z(ee,W,N){let K,he,ge,j;return Array.isArray(ee)?J(ee):"tokenize"in ee?J([ee]):O(ee);function O(te){return oe;function oe(we){const F=we!==null&&te[we],be=we!==null&&te.null,Ee=[...Array.isArray(F)?F:F?[F]:[],...Array.isArray(be)?be:be?[be]:[]];return J(Ee)(we)}}function J(te){return K=te,he=0,te.length===0?N:A(te[he])}function A(te){return oe;function oe(we){return j=q(),ge=te,te.partial||(g.currentConstruct=te),te.name&&g.parser.constructs.disable.null.includes(te.name)?pe():te.tokenize.call(H?Object.assign(Object.create(g),H):g,h,ae,pe)(we)}}function ae(te){return U(ge,j),W}function pe(te){return j.restore(),++he<K.length?A(K[he]):N}}}function X(U,H){U.resolveAll&&!f.includes(U)&&f.push(U),U.resolve&&jn(g.events,H,g.events.length-H,U.resolve(g.events.slice(H),g)),U.resolveTo&&(g.events=U.resolveTo(g.events,g))}function q(){const U=k(),H=g.previous,Z=g.currentConstruct,ee=g.events.length,W=Array.from(p);return{from:ee,restore:N};function N(){a=U,g.previous=H,g.currentConstruct=Z,g.events.length=ee,p=W,E()}}function E(){a.line in c&&a.column<2&&(a.column=c[a.line],a.offset+=c[a.line]-1)}}function Mk(t,i){const l=i.start._index,a=i.start._bufferIndex,c=i.end._index,f=i.end._bufferIndex;let o;if(l===c)o=[t[l].slice(a,f)];else{if(o=t.slice(l,c),a>-1){const p=o[0];typeof p=="string"?o[0]=p.slice(a):o.shift()}f>0&&o.push(t[c].slice(0,f))}return o}function _k(t,i){let l=-1;const a=[];let c;for(;++l<t.length;){const f=t[l];let o;if(typeof f=="string")o=f;else switch(f){case-5:{o="\r";break}case-4:{o=`
|
|
30
|
-
`;break}case-3:{o=`\r
|
|
31
|
-
`;break}case-2:{o=i?" ":" ";break}case-1:{if(!i&&c)continue;o=" ";break}default:o=String.fromCharCode(f)}c=f===-2,a.push(o)}return a.join("")}function Ok(t){const a={constructs:Db([Rk,...(t||{}).extensions||[]]),content:c(Zw),defined:[],document:c(Jw),flow:c(gk),lazy:{},string:c(vk),text:c(xk)};return a;function c(f){return o;function o(p){return Dk(a,f,p)}}}function Lk(t){for(;!Bb(t););return t}const Ey=/[\0\t\n\r]/g;function Bk(){let t=1,i="",l=!0,a;return c;function c(f,o,p){const h=[];let g,b,y,v,x;for(f=i+(typeof f=="string"?f.toString():new TextDecoder(o||void 0).decode(f)),y=0,i="",l&&(f.charCodeAt(0)===65279&&y++,l=void 0);y<f.length;){if(Ey.lastIndex=y,g=Ey.exec(f),v=g&&g.index!==void 0?g.index:f.length,x=f.charCodeAt(v),!g){i=f.slice(y);break}if(x===10&&y===v&&a)h.push(-3),a=void 0;else switch(a&&(h.push(-5),a=void 0),y<v&&(h.push(f.slice(y,v)),t+=v-y),x){case 0:{h.push(65533),t++;break}case 9:{for(b=Math.ceil(t/4)*4,h.push(-2);t++<b;)h.push(-1);break}case 10:{h.push(-4),t=1;break}default:a=!0,t=1}y=v+1}return p&&(a&&h.push(-5),i&&h.push(i),h.push(null)),h}}const Uk=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qk(t){return t.replace(Uk,Ik)}function Ik(t,i,l){if(i)return i;if(l.charCodeAt(0)===35){const c=l.charCodeAt(1),f=c===120||c===88;return Mb(l.slice(f?2:1),f?16:10)}return ld(l)||t}const Yb={}.hasOwnProperty;function Hk(t,i,l){return i&&typeof i=="object"&&(l=i,i=void 0),Vk(l)(Lk(Ok(l).document().write(Bk()(t,i,!0))))}function Vk(t){const i={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:f(qe),autolinkProtocol:q,autolinkEmail:q,atxHeading:f(at),blockQuote:f(be),characterEscape:q,characterReference:q,codeFenced:f(Ee),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:f(Ee,o),codeText:f(Re,o),codeTextData:q,data:q,codeFlowValue:q,definition:f(Qe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:f(Ve),hardBreakEscape:f(st),hardBreakTrailing:f(st),htmlFlow:f(pt,o),htmlFlowData:q,htmlText:f(pt,o),htmlTextData:q,image:f(Nt),label:o,link:f(qe),listItem:f(Fe),listItemValue:v,listOrdered:f(ct,y),listUnordered:f(ct),paragraph:f(nt),reference:A,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:f(at),strong:f(Dt),thematicBreak:f(wt)},exit:{atxHeading:h(),atxHeadingSequence:se,autolink:h(),autolinkEmail:F,autolinkProtocol:we,blockQuote:h(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:pe,characterReferenceMarkerNumeric:pe,characterReferenceValue:te,characterReference:oe,codeFenced:h(D),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:E,codeIndented:h(R),codeText:h(W),codeTextData:E,data:E,definition:h(),definitionDestinationString:G,definitionLabelString:z,definitionTitleString:L,emphasis:h(),hardBreakEscape:h(H),hardBreakTrailing:h(H),htmlFlow:h(Z),htmlFlowData:E,htmlText:h(ee),htmlTextData:E,image:h(K),label:ge,labelText:he,lineEnding:U,link:h(N),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:ae,resourceDestinationString:j,resourceTitleString:O,resource:J,setextHeading:h(X),setextHeadingLineSequence:V,setextHeadingText:T,strong:h(),thematicBreak:h()}};Gb(i,(t||{}).mdastExtensions||[]);const l={};return a;function a(M){let $={type:"root",children:[]};const me={stack:[$],tokenStack:[],config:i,enter:p,exit:g,buffer:o,resume:b,data:l},ve=[];let Ce=-1;for(;++Ce<M.length;)if(M[Ce][1].type==="listOrdered"||M[Ce][1].type==="listUnordered")if(M[Ce][0]==="enter")ve.push(Ce);else{const _e=ve.pop();Ce=c(M,_e,Ce)}for(Ce=-1;++Ce<M.length;){const _e=i[M[Ce][0]];Yb.call(_e,M[Ce][1].type)&&_e[M[Ce][1].type].call(Object.assign({sliceSerialize:M[Ce][2].sliceSerialize},me),M[Ce][1])}if(me.tokenStack.length>0){const _e=me.tokenStack[me.tokenStack.length-1];(_e[1]||Ny).call(me,void 0,_e[0])}for($.position={start:Yi(M.length>0?M[0][1].start:{line:1,column:1,offset:0}),end:Yi(M.length>0?M[M.length-2][1].end:{line:1,column:1,offset:0})},Ce=-1;++Ce<i.transforms.length;)$=i.transforms[Ce]($)||$;return $}function c(M,$,me){let ve=$-1,Ce=-1,_e=!1,Ke,bt,ft,$e;for(;++ve<=me;){const Ze=M[ve];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?Ce++:Ce--,$e=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Ke&&!$e&&!Ce&&!ft&&(ft=ve),$e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$e=void 0}if(!Ce&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||Ce===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Ke){let Q=ve;for(bt=void 0;Q--;){const xe=M[Q];if(xe[1].type==="lineEnding"||xe[1].type==="lineEndingBlank"){if(xe[0]==="exit")continue;bt&&(M[bt][1].type="lineEndingBlank",_e=!0),xe[1].type="lineEnding",bt=Q}else if(!(xe[1].type==="linePrefix"||xe[1].type==="blockQuotePrefix"||xe[1].type==="blockQuotePrefixWhitespace"||xe[1].type==="blockQuoteMarker"||xe[1].type==="listItemIndent"))break}ft&&(!bt||ft<bt)&&(Ke._spread=!0),Ke.end=Object.assign({},bt?M[bt][1].start:Ze[1].end),M.splice(bt||ve,0,["exit",Ke,Ze[2]]),ve++,me++}if(Ze[1].type==="listItemPrefix"){const Q={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Ke=Q,M.splice(ve,0,["enter",Q,Ze[2]]),ve++,me++,ft=void 0,$e=!0}}}return M[$][1]._spread=_e,me}function f(M,$){return me;function me(ve){p.call(this,M(ve),ve),$&&$.call(this,ve)}}function o(){this.stack.push({type:"fragment",children:[]})}function p(M,$,me){this.stack[this.stack.length-1].children.push(M),this.stack.push(M),this.tokenStack.push([$,me||void 0]),M.position={start:Yi($.start),end:void 0}}function h(M){return $;function $(me){M&&M.call(this,me),g.call(this,me)}}function g(M,$){const me=this.stack.pop(),ve=this.tokenStack.pop();if(ve)ve[0].type!==M.type&&($?$.call(this,M,ve[0]):(ve[1]||Ny).call(this,M,ve[0]));else throw new Error("Cannot close `"+M.type+"` ("+fa({start:M.start,end:M.end})+"): it’s not open");me.position.end=Yi(M.end)}function b(){return rd(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function v(M){if(this.data.expectingFirstListItemValue){const $=this.stack[this.stack.length-2];$.start=Number.parseInt(this.sliceSerialize(M),10),this.data.expectingFirstListItemValue=void 0}}function x(){const M=this.resume(),$=this.stack[this.stack.length-1];$.lang=M}function k(){const M=this.resume(),$=this.stack[this.stack.length-1];$.meta=M}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function D(){const M=this.resume(),$=this.stack[this.stack.length-1];$.value=M.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const M=this.resume(),$=this.stack[this.stack.length-1];$.value=M.replace(/(\r?\n|\r)$/g,"")}function z(M){const $=this.resume(),me=this.stack[this.stack.length-1];me.label=$,me.identifier=Vn(this.sliceSerialize(M)).toLowerCase()}function L(){const M=this.resume(),$=this.stack[this.stack.length-1];$.title=M}function G(){const M=this.resume(),$=this.stack[this.stack.length-1];$.url=M}function se(M){const $=this.stack[this.stack.length-1];if(!$.depth){const me=this.sliceSerialize(M).length;$.depth=me}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function V(M){const $=this.stack[this.stack.length-1];$.depth=this.sliceSerialize(M).codePointAt(0)===61?1:2}function X(){this.data.setextHeadingSlurpLineEnding=void 0}function q(M){const me=this.stack[this.stack.length-1].children;let ve=me[me.length-1];(!ve||ve.type!=="text")&&(ve=rt(),ve.position={start:Yi(M.start),end:void 0},me.push(ve)),this.stack.push(ve)}function E(M){const $=this.stack.pop();$.value+=this.sliceSerialize(M),$.position.end=Yi(M.end)}function U(M){const $=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=$.children[$.children.length-1];me.position.end=Yi(M.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&i.canContainEols.includes($.type)&&(q.call(this,M),E.call(this,M))}function H(){this.data.atHardBreak=!0}function Z(){const M=this.resume(),$=this.stack[this.stack.length-1];$.value=M}function ee(){const M=this.resume(),$=this.stack[this.stack.length-1];$.value=M}function W(){const M=this.resume(),$=this.stack[this.stack.length-1];$.value=M}function N(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=$,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function K(){const M=this.stack[this.stack.length-1];if(this.data.inReference){const $=this.data.referenceType||"shortcut";M.type+="Reference",M.referenceType=$,delete M.url,delete M.title}else delete M.identifier,delete M.label;this.data.referenceType=void 0}function he(M){const $=this.sliceSerialize(M),me=this.stack[this.stack.length-2];me.label=qk($),me.identifier=Vn($).toLowerCase()}function ge(){const M=this.stack[this.stack.length-1],$=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const ve=M.children;me.children=ve}else me.alt=$}function j(){const M=this.resume(),$=this.stack[this.stack.length-1];$.url=M}function O(){const M=this.resume(),$=this.stack[this.stack.length-1];$.title=M}function J(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function ae(M){const $=this.resume(),me=this.stack[this.stack.length-1];me.label=$,me.identifier=Vn(this.sliceSerialize(M)).toLowerCase(),this.data.referenceType="full"}function pe(M){this.data.characterReferenceType=M.type}function te(M){const $=this.sliceSerialize(M),me=this.data.characterReferenceType;let ve;me?(ve=Mb($,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ve=ld($);const Ce=this.stack[this.stack.length-1];Ce.value+=ve}function oe(M){const $=this.stack.pop();$.position.end=Yi(M.end)}function we(M){E.call(this,M);const $=this.stack[this.stack.length-1];$.url=this.sliceSerialize(M)}function F(M){E.call(this,M);const $=this.stack[this.stack.length-1];$.url="mailto:"+this.sliceSerialize(M)}function be(){return{type:"blockquote",children:[]}}function Ee(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function Qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ve(){return{type:"emphasis",children:[]}}function at(){return{type:"heading",depth:0,children:[]}}function st(){return{type:"break"}}function pt(){return{type:"html",value:""}}function Nt(){return{type:"image",title:null,url:"",alt:null}}function qe(){return{type:"link",title:null,url:"",children:[]}}function ct(M){return{type:"list",ordered:M.type==="listOrdered",start:null,spread:M._spread,children:[]}}function Fe(M){return{type:"listItem",spread:M._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function Dt(){return{type:"strong",children:[]}}function rt(){return{type:"text",value:""}}function wt(){return{type:"thematicBreak"}}}function Yi(t){return{line:t.line,column:t.column,offset:t.offset}}function Gb(t,i){let l=-1;for(;++l<i.length;){const a=i[l];Array.isArray(a)?Gb(t,a):Yk(t,a)}}function Yk(t,i){let l;for(l in i)if(Yb.call(i,l))switch(l){case"canContainEols":{const a=i[l];a&&t[l].push(...a);break}case"transforms":{const a=i[l];a&&t[l].push(...a);break}case"enter":case"exit":{const a=i[l];a&&Object.assign(t[l],a);break}}}function Ny(t,i){throw t?new Error("Cannot close `"+t.type+"` ("+fa({start:t.start,end:t.end})+"): a different token (`"+i.type+"`, "+fa({start:i.start,end:i.end})+") is open"):new Error("Cannot close document, a token (`"+i.type+"`, "+fa({start:i.start,end:i.end})+") is still open")}function Gk(t){const i=this;i.parser=l;function l(a){return Hk(a,{...i.data("settings"),...t,extensions:i.data("micromarkExtensions")||[],mdastExtensions:i.data("fromMarkdownExtensions")||[]})}}function Fk(t,i){const l={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(i),!0)};return t.patch(i,l),t.applyData(i,l)}function Qk(t,i){const l={type:"element",tagName:"br",properties:{},children:[]};return t.patch(i,l),[t.applyData(i,l),{type:"text",value:`
|
|
32
|
-
`}]}function Xk(t,i){const l=i.value?i.value+`
|
|
33
|
-
`:"",a={},c=i.lang?i.lang.split(/\s+/):[];c.length>0&&(a.className=["language-"+c[0]]);let f={type:"element",tagName:"code",properties:a,children:[{type:"text",value:l}]};return i.meta&&(f.data={meta:i.meta}),t.patch(i,f),f=t.applyData(i,f),f={type:"element",tagName:"pre",properties:{},children:[f]},t.patch(i,f),f}function Kk(t,i){const l={type:"element",tagName:"del",properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}function $k(t,i){const l={type:"element",tagName:"em",properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}function Zk(t,i){const l=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",a=String(i.identifier).toUpperCase(),c=fl(a.toLowerCase()),f=t.footnoteOrder.indexOf(a);let o,p=t.footnoteCounts.get(a);p===void 0?(p=0,t.footnoteOrder.push(a),o=t.footnoteOrder.length):o=f+1,p+=1,t.footnoteCounts.set(a,p);const h={type:"element",tagName:"a",properties:{href:"#"+l+"fn-"+c,id:l+"fnref-"+c+(p>1?"-"+p:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(i,h);const g={type:"element",tagName:"sup",properties:{},children:[h]};return t.patch(i,g),t.applyData(i,g)}function Pk(t,i){const l={type:"element",tagName:"h"+i.depth,properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}function Jk(t,i){if(t.options.allowDangerousHtml){const l={type:"raw",value:i.value};return t.patch(i,l),t.applyData(i,l)}}function Fb(t,i){const l=i.referenceType;let a="]";if(l==="collapsed"?a+="[]":l==="full"&&(a+="["+(i.label||i.identifier)+"]"),i.type==="imageReference")return[{type:"text",value:"!["+i.alt+a}];const c=t.all(i),f=c[0];f&&f.type==="text"?f.value="["+f.value:c.unshift({type:"text",value:"["});const o=c[c.length-1];return o&&o.type==="text"?o.value+=a:c.push({type:"text",value:a}),c}function Wk(t,i){const l=String(i.identifier).toUpperCase(),a=t.definitionById.get(l);if(!a)return Fb(t,i);const c={src:fl(a.url||""),alt:i.alt};a.title!==null&&a.title!==void 0&&(c.title=a.title);const f={type:"element",tagName:"img",properties:c,children:[]};return t.patch(i,f),t.applyData(i,f)}function eC(t,i){const l={src:fl(i.url)};i.alt!==null&&i.alt!==void 0&&(l.alt=i.alt),i.title!==null&&i.title!==void 0&&(l.title=i.title);const a={type:"element",tagName:"img",properties:l,children:[]};return t.patch(i,a),t.applyData(i,a)}function tC(t,i){const l={type:"text",value:i.value.replace(/\r?\n|\r/g," ")};t.patch(i,l);const a={type:"element",tagName:"code",properties:{},children:[l]};return t.patch(i,a),t.applyData(i,a)}function nC(t,i){const l=String(i.identifier).toUpperCase(),a=t.definitionById.get(l);if(!a)return Fb(t,i);const c={href:fl(a.url||"")};a.title!==null&&a.title!==void 0&&(c.title=a.title);const f={type:"element",tagName:"a",properties:c,children:t.all(i)};return t.patch(i,f),t.applyData(i,f)}function iC(t,i){const l={href:fl(i.url)};i.title!==null&&i.title!==void 0&&(l.title=i.title);const a={type:"element",tagName:"a",properties:l,children:t.all(i)};return t.patch(i,a),t.applyData(i,a)}function rC(t,i,l){const a=t.all(i),c=l?lC(l):Qb(i),f={},o=[];if(typeof i.checked=="boolean"){const b=a[0];let y;b&&b.type==="element"&&b.tagName==="p"?y=b:(y={type:"element",tagName:"p",properties:{},children:[]},a.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:i.checked,disabled:!0},children:[]}),f.className=["task-list-item"]}let p=-1;for(;++p<a.length;){const b=a[p];(c||p!==0||b.type!=="element"||b.tagName!=="p")&&o.push({type:"text",value:`
|
|
34
|
-
`}),b.type==="element"&&b.tagName==="p"&&!c?o.push(...b.children):o.push(b)}const h=a[a.length-1];h&&(c||h.type!=="element"||h.tagName!=="p")&&o.push({type:"text",value:`
|
|
35
|
-
`});const g={type:"element",tagName:"li",properties:f,children:o};return t.patch(i,g),t.applyData(i,g)}function lC(t){let i=!1;if(t.type==="list"){i=t.spread||!1;const l=t.children;let a=-1;for(;!i&&++a<l.length;)i=Qb(l[a])}return i}function Qb(t){const i=t.spread;return i??t.children.length>1}function aC(t,i){const l={},a=t.all(i);let c=-1;for(typeof i.start=="number"&&i.start!==1&&(l.start=i.start);++c<a.length;){const o=a[c];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){l.className=["contains-task-list"];break}}const f={type:"element",tagName:i.ordered?"ol":"ul",properties:l,children:t.wrap(a,!0)};return t.patch(i,f),t.applyData(i,f)}function sC(t,i){const l={type:"element",tagName:"p",properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}function oC(t,i){const l={type:"root",children:t.wrap(t.all(i))};return t.patch(i,l),t.applyData(i,l)}function uC(t,i){const l={type:"element",tagName:"strong",properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}function cC(t,i){const l=t.all(i),a=l.shift(),c=[];if(a){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([a],!0)};t.patch(i.children[0],o),c.push(o)}if(l.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(l,!0)},p=ed(i.children[1]),h=Cb(i.children[i.children.length-1]);p&&h&&(o.position={start:p,end:h}),c.push(o)}const f={type:"element",tagName:"table",properties:{},children:t.wrap(c,!0)};return t.patch(i,f),t.applyData(i,f)}function fC(t,i,l){const a=l?l.children:void 0,f=(a?a.indexOf(i):1)===0?"th":"td",o=l&&l.type==="table"?l.align:void 0,p=o?o.length:i.children.length;let h=-1;const g=[];for(;++h<p;){const y=i.children[h],v={},x=o?o[h]:void 0;x&&(v.align=x);let k={type:"element",tagName:f,properties:v,children:[]};y&&(k.children=t.all(y),t.patch(y,k),k=t.applyData(y,k)),g.push(k)}const b={type:"element",tagName:"tr",properties:{},children:t.wrap(g,!0)};return t.patch(i,b),t.applyData(i,b)}function dC(t,i){const l={type:"element",tagName:"td",properties:{},children:t.all(i)};return t.patch(i,l),t.applyData(i,l)}const Ay=9,Ty=32;function hC(t){const i=String(t),l=/\r?\n|\r/g;let a=l.exec(i),c=0;const f=[];for(;a;)f.push(zy(i.slice(c,a.index),c>0,!0),a[0]),c=a.index+a[0].length,a=l.exec(i);return f.push(zy(i.slice(c),c>0,!1)),f.join("")}function zy(t,i,l){let a=0,c=t.length;if(i){let f=t.codePointAt(a);for(;f===Ay||f===Ty;)a++,f=t.codePointAt(a)}if(l){let f=t.codePointAt(c-1);for(;f===Ay||f===Ty;)c--,f=t.codePointAt(c-1)}return c>a?t.slice(a,c):""}function pC(t,i){const l={type:"text",value:hC(String(i.value))};return t.patch(i,l),t.applyData(i,l)}function mC(t,i){const l={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(i,l),t.applyData(i,l)}const gC={blockquote:Fk,break:Qk,code:Xk,delete:Kk,emphasis:$k,footnoteReference:Zk,heading:Pk,html:Jk,imageReference:Wk,image:eC,inlineCode:tC,linkReference:nC,link:iC,listItem:rC,list:aC,paragraph:sC,root:oC,strong:uC,table:cC,tableCell:dC,tableRow:fC,text:pC,thematicBreak:mC,toml:Ys,yaml:Ys,definition:Ys,footnoteDefinition:Ys};function Ys(){}const Xb=-1,uo=0,ha=1,to=2,sd=3,od=4,ud=5,cd=6,Kb=7,$b=8,yC=typeof self=="object"?self:globalThis,Ry=(t,i)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new yC[t](i)},bC=(t,i)=>{const l=(c,f)=>(t.set(f,c),c),a=c=>{if(t.has(c))return t.get(c);const[f,o]=i[c];switch(f){case uo:case Xb:return l(o,c);case ha:{const p=l([],c);for(const h of o)p.push(a(h));return p}case to:{const p=l({},c);for(const[h,g]of o)p[a(h)]=a(g);return p}case sd:return l(new Date(o),c);case od:{const{source:p,flags:h}=o;return l(new RegExp(p,h),c)}case ud:{const p=l(new Map,c);for(const[h,g]of o)p.set(a(h),a(g));return p}case cd:{const p=l(new Set,c);for(const h of o)p.add(a(h));return p}case Kb:{const{name:p,message:h}=o;return l(Ry(p,h),c)}case $b:return l(BigInt(o),c);case"BigInt":return l(Object(BigInt(o)),c);case"ArrayBuffer":return l(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:p}=new Uint8Array(o);return l(new DataView(p),o)}}return l(Ry(f,o),c)};return a},Dy=t=>bC(new Map,t)(0),al="",{toString:vC}={},{keys:xC}=Object,ua=t=>{const i=typeof t;if(i!=="object"||!t)return[uo,i];const l=vC.call(t).slice(8,-1);switch(l){case"Array":return[ha,al];case"Object":return[to,al];case"Date":return[sd,al];case"RegExp":return[od,al];case"Map":return[ud,al];case"Set":return[cd,al];case"DataView":return[ha,l]}return l.includes("Array")?[ha,l]:l.includes("Error")?[Kb,l]:[to,l]},Gs=([t,i])=>t===uo&&(i==="function"||i==="symbol"),SC=(t,i,l,a)=>{const c=(o,p)=>{const h=a.push(o)-1;return l.set(p,h),h},f=o=>{if(l.has(o))return l.get(o);let[p,h]=ua(o);switch(p){case uo:{let b=o;switch(h){case"bigint":p=$b,b=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+h);b=null;break;case"undefined":return c([Xb],o)}return c([p,b],o)}case ha:{if(h){let v=o;return h==="DataView"?v=new Uint8Array(o.buffer):h==="ArrayBuffer"&&(v=new Uint8Array(o)),c([h,[...v]],o)}const b=[],y=c([p,b],o);for(const v of o)b.push(f(v));return y}case to:{if(h)switch(h){case"BigInt":return c([h,o.toString()],o);case"Boolean":case"Number":case"String":return c([h,o.valueOf()],o)}if(i&&"toJSON"in o)return f(o.toJSON());const b=[],y=c([p,b],o);for(const v of xC(o))(t||!Gs(ua(o[v])))&&b.push([f(v),f(o[v])]);return y}case sd:return c([p,o.toISOString()],o);case od:{const{source:b,flags:y}=o;return c([p,{source:b,flags:y}],o)}case ud:{const b=[],y=c([p,b],o);for(const[v,x]of o)(t||!(Gs(ua(v))||Gs(ua(x))))&&b.push([f(v),f(x)]);return y}case cd:{const b=[],y=c([p,b],o);for(const v of o)(t||!Gs(ua(v)))&&b.push(f(v));return y}}const{message:g}=o;return c([p,{name:h,message:g}],o)};return f},My=(t,{json:i,lossy:l}={})=>{const a=[];return SC(!(i||l),!!i,new Map,a)(t),a},no=typeof structuredClone=="function"?(t,i)=>i&&("json"in i||"lossy"in i)?Dy(My(t,i)):structuredClone(t):(t,i)=>Dy(My(t,i));function wC(t,i){const l=[{type:"text",value:"↩"}];return i>1&&l.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(i)}]}),l}function jC(t,i){return"Back to reference "+(t+1)+(i>1?"-"+i:"")}function kC(t){const i=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",l=t.options.footnoteBackContent||wC,a=t.options.footnoteBackLabel||jC,c=t.options.footnoteLabel||"Footnotes",f=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},p=[];let h=-1;for(;++h<t.footnoteOrder.length;){const g=t.footnoteById.get(t.footnoteOrder[h]);if(!g)continue;const b=t.all(g),y=String(g.identifier).toUpperCase(),v=fl(y.toLowerCase());let x=0;const k=[],_=t.footnoteCounts.get(y);for(;_!==void 0&&++x<=_;){k.length>0&&k.push({type:"text",value:" "});let z=typeof l=="string"?l:l(h,x);typeof z=="string"&&(z={type:"text",value:z}),k.push({type:"element",tagName:"a",properties:{href:"#"+i+"fnref-"+v+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(h,x),className:["data-footnote-backref"]},children:Array.isArray(z)?z:[z]})}const D=b[b.length-1];if(D&&D.type==="element"&&D.tagName==="p"){const z=D.children[D.children.length-1];z&&z.type==="text"?z.value+=" ":D.children.push({type:"text",value:" "}),D.children.push(...k)}else b.push(...k);const R={type:"element",tagName:"li",properties:{id:i+"fn-"+v},children:t.wrap(b,!0)};t.patch(g,R),p.push(R)}if(p.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:f,properties:{...no(o),id:"footnote-label"},children:[{type:"text",value:c}]},{type:"text",value:`
|
|
36
|
-
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(p,!0)},{type:"text",value:`
|
|
37
|
-
`}]}}const co=(function(t){if(t==null)return AC;if(typeof t=="function")return fo(t);if(typeof t=="object")return Array.isArray(t)?CC(t):EC(t);if(typeof t=="string")return NC(t);throw new Error("Expected function, string, or object as test")});function CC(t){const i=[];let l=-1;for(;++l<t.length;)i[l]=co(t[l]);return fo(a);function a(...c){let f=-1;for(;++f<i.length;)if(i[f].apply(this,c))return!0;return!1}}function EC(t){const i=t;return fo(l);function l(a){const c=a;let f;for(f in t)if(c[f]!==i[f])return!1;return!0}}function NC(t){return fo(i);function i(l){return l&&l.type===t}}function fo(t){return i;function i(l,a,c){return!!(TC(l)&&t.call(this,l,typeof a=="number"?a:void 0,c||void 0))}}function AC(){return!0}function TC(t){return t!==null&&typeof t=="object"&&"type"in t}const Zb=[],zC=!0,_f=!1,RC="skip";function Pb(t,i,l,a){let c;typeof i=="function"&&typeof l!="function"?(a=l,l=i):c=i;const f=co(c),o=a?-1:1;p(t,void 0,[])();function p(h,g,b){const y=h&&typeof h=="object"?h:{};if(typeof y.type=="string"){const x=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(h.type+(x?"<"+x+">":""))+")"})}return v;function v(){let x=Zb,k,_,D;if((!i||f(h,g,b[b.length-1]||void 0))&&(x=DC(l(h,b)),x[0]===_f))return x;if("children"in h&&h.children){const R=h;if(R.children&&x[0]!==RC)for(_=(a?R.children.length:-1)+o,D=b.concat(R);_>-1&&_<R.children.length;){const z=R.children[_];if(k=p(z,_,D)(),k[0]===_f)return k;_=typeof k[1]=="number"?k[1]:_+o}}return x}}}function DC(t){return Array.isArray(t)?t:typeof t=="number"?[zC,t]:t==null?Zb:[t]}function fd(t,i,l,a){let c,f,o;typeof i=="function"&&typeof l!="function"?(f=void 0,o=i,c=l):(f=i,o=l,c=a),Pb(t,f,p,c);function p(h,g){const b=g[g.length-1],y=b?b.children.indexOf(h):void 0;return o(h,y,b)}}const Of={}.hasOwnProperty,MC={};function _C(t,i){const l=i||MC,a=new Map,c=new Map,f=new Map,o={...gC,...l.handlers},p={all:g,applyData:LC,definitionById:a,footnoteById:c,footnoteCounts:f,footnoteOrder:[],handlers:o,one:h,options:l,patch:OC,wrap:UC};return fd(t,function(b){if(b.type==="definition"||b.type==="footnoteDefinition"){const y=b.type==="definition"?a:c,v=String(b.identifier).toUpperCase();y.has(v)||y.set(v,b)}}),p;function h(b,y){const v=b.type,x=p.handlers[v];if(Of.call(p.handlers,v)&&x)return x(p,b,y);if(p.options.passThrough&&p.options.passThrough.includes(v)){if("children"in b){const{children:_,...D}=b,R=no(D);return R.children=p.all(b),R}return no(b)}return(p.options.unknownHandler||BC)(p,b,y)}function g(b){const y=[];if("children"in b){const v=b.children;let x=-1;for(;++x<v.length;){const k=p.one(v[x],b);if(k){if(x&&v[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=_y(k.value)),!Array.isArray(k)&&k.type==="element")){const _=k.children[0];_&&_.type==="text"&&(_.value=_y(_.value))}Array.isArray(k)?y.push(...k):y.push(k)}}}return y}}function OC(t,i){t.position&&(i.position=ww(t))}function LC(t,i){let l=i;if(t&&t.data){const a=t.data.hName,c=t.data.hChildren,f=t.data.hProperties;if(typeof a=="string")if(l.type==="element")l.tagName=a;else{const o="children"in l?l.children:[l];l={type:"element",tagName:a,properties:{},children:o}}l.type==="element"&&f&&Object.assign(l.properties,no(f)),"children"in l&&l.children&&c!==null&&c!==void 0&&(l.children=c)}return l}function BC(t,i){const l=i.data||{},a="value"in i&&!(Of.call(l,"hProperties")||Of.call(l,"hChildren"))?{type:"text",value:i.value}:{type:"element",tagName:"div",properties:{},children:t.all(i)};return t.patch(i,a),t.applyData(i,a)}function UC(t,i){const l=[];let a=-1;for(i&&l.push({type:"text",value:`
|
|
38
|
-
`});++a<t.length;)a&&l.push({type:"text",value:`
|
|
39
|
-
`}),l.push(t[a]);return i&&t.length>0&&l.push({type:"text",value:`
|
|
40
|
-
`}),l}function _y(t){let i=0,l=t.charCodeAt(i);for(;l===9||l===32;)i++,l=t.charCodeAt(i);return t.slice(i)}function Oy(t,i){const l=_C(t,i),a=l.one(t,void 0),c=kC(l),f=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return c&&f.children.push({type:"text",value:`
|
|
41
|
-
`},c),f}function qC(t,i){return t&&"run"in t?async function(l,a){const c=Oy(l,{file:a,...i});await t.run(c,a)}:function(l,a){return Oy(l,{file:a,...t||i})}}function Ly(t){if(t)throw t}var ff,By;function IC(){if(By)return ff;By=1;var t=Object.prototype.hasOwnProperty,i=Object.prototype.toString,l=Object.defineProperty,a=Object.getOwnPropertyDescriptor,c=function(g){return typeof Array.isArray=="function"?Array.isArray(g):i.call(g)==="[object Array]"},f=function(g){if(!g||i.call(g)!=="[object Object]")return!1;var b=t.call(g,"constructor"),y=g.constructor&&g.constructor.prototype&&t.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!b&&!y)return!1;var v;for(v in g);return typeof v>"u"||t.call(g,v)},o=function(g,b){l&&b.name==="__proto__"?l(g,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):g[b.name]=b.newValue},p=function(g,b){if(b==="__proto__")if(t.call(g,b)){if(a)return a(g,b).value}else return;return g[b]};return ff=function h(){var g,b,y,v,x,k,_=arguments[0],D=1,R=arguments.length,z=!1;for(typeof _=="boolean"&&(z=_,_=arguments[1]||{},D=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});D<R;++D)if(g=arguments[D],g!=null)for(b in g)y=p(_,b),v=p(g,b),_!==v&&(z&&v&&(f(v)||(x=c(v)))?(x?(x=!1,k=y&&c(y)?y:[]):k=y&&f(y)?y:{},o(_,{name:b,newValue:h(z,k,v)})):typeof v<"u"&&o(_,{name:b,newValue:v}));return _},ff}var HC=IC();const df=ro(HC);function Lf(t){if(typeof t!="object"||t===null)return!1;const i=Object.getPrototypeOf(t);return(i===null||i===Object.prototype||Object.getPrototypeOf(i)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function VC(){const t=[],i={run:l,use:a};return i;function l(...c){let f=-1;const o=c.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);p(null,...c);function p(h,...g){const b=t[++f];let y=-1;if(h){o(h);return}for(;++y<c.length;)(g[y]===null||g[y]===void 0)&&(g[y]=c[y]);c=g,b?YC(b,p)(...g):o(null,...g)}}function a(c){if(typeof c!="function")throw new TypeError("Expected `middelware` to be a function, not "+c);return t.push(c),i}}function YC(t,i){let l;return a;function a(...o){const p=t.length>o.length;let h;p&&o.push(c);try{h=t.apply(this,o)}catch(g){const b=g;if(p&&l)throw b;return c(b)}p||(h&&h.then&&typeof h.then=="function"?h.then(f,c):h instanceof Error?c(h):f(h))}function c(o,...p){l||(l=!0,i(o,...p))}function f(o){c(null,o)}}const Kn={basename:GC,dirname:FC,extname:QC,join:XC,sep:"/"};function GC(t,i){if(i!==void 0&&typeof i!="string")throw new TypeError('"ext" argument must be a string');wa(t);let l=0,a=-1,c=t.length,f;if(i===void 0||i.length===0||i.length>t.length){for(;c--;)if(t.codePointAt(c)===47){if(f){l=c+1;break}}else a<0&&(f=!0,a=c+1);return a<0?"":t.slice(l,a)}if(i===t)return"";let o=-1,p=i.length-1;for(;c--;)if(t.codePointAt(c)===47){if(f){l=c+1;break}}else o<0&&(f=!0,o=c+1),p>-1&&(t.codePointAt(c)===i.codePointAt(p--)?p<0&&(a=c):(p=-1,a=o));return l===a?a=o:a<0&&(a=t.length),t.slice(l,a)}function FC(t){if(wa(t),t.length===0)return".";let i=-1,l=t.length,a;for(;--l;)if(t.codePointAt(l)===47){if(a){i=l;break}}else a||(a=!0);return i<0?t.codePointAt(0)===47?"/":".":i===1&&t.codePointAt(0)===47?"//":t.slice(0,i)}function QC(t){wa(t);let i=t.length,l=-1,a=0,c=-1,f=0,o;for(;i--;){const p=t.codePointAt(i);if(p===47){if(o){a=i+1;break}continue}l<0&&(o=!0,l=i+1),p===46?c<0?c=i:f!==1&&(f=1):c>-1&&(f=-1)}return c<0||l<0||f===0||f===1&&c===l-1&&c===a+1?"":t.slice(c,l)}function XC(...t){let i=-1,l;for(;++i<t.length;)wa(t[i]),t[i]&&(l=l===void 0?t[i]:l+"/"+t[i]);return l===void 0?".":KC(l)}function KC(t){wa(t);const i=t.codePointAt(0)===47;let l=$C(t,!i);return l.length===0&&!i&&(l="."),l.length>0&&t.codePointAt(t.length-1)===47&&(l+="/"),i?"/"+l:l}function $C(t,i){let l="",a=0,c=-1,f=0,o=-1,p,h;for(;++o<=t.length;){if(o<t.length)p=t.codePointAt(o);else{if(p===47)break;p=47}if(p===47){if(!(c===o-1||f===1))if(c!==o-1&&f===2){if(l.length<2||a!==2||l.codePointAt(l.length-1)!==46||l.codePointAt(l.length-2)!==46){if(l.length>2){if(h=l.lastIndexOf("/"),h!==l.length-1){h<0?(l="",a=0):(l=l.slice(0,h),a=l.length-1-l.lastIndexOf("/")),c=o,f=0;continue}}else if(l.length>0){l="",a=0,c=o,f=0;continue}}i&&(l=l.length>0?l+"/..":"..",a=2)}else l.length>0?l+="/"+t.slice(c+1,o):l=t.slice(c+1,o),a=o-c-1;c=o,f=0}else p===46&&f>-1?f++:f=-1}return l}function wa(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const ZC={cwd:PC};function PC(){return"/"}function Bf(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function JC(t){if(typeof t=="string")t=new URL(t);else if(!Bf(t)){const i=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw i.code="ERR_INVALID_ARG_TYPE",i}if(t.protocol!=="file:"){const i=new TypeError("The URL must be of scheme file");throw i.code="ERR_INVALID_URL_SCHEME",i}return WC(t)}function WC(t){if(t.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const i=t.pathname;let l=-1;for(;++l<i.length;)if(i.codePointAt(l)===37&&i.codePointAt(l+1)===50){const a=i.codePointAt(l+2);if(a===70||a===102){const c=new TypeError("File URL path must not include encoded / characters");throw c.code="ERR_INVALID_FILE_URL_PATH",c}}return decodeURIComponent(i)}const hf=["history","path","basename","stem","extname","dirname"];class Jb{constructor(i){let l;i?Bf(i)?l={path:i}:typeof i=="string"||eE(i)?l={value:i}:l=i:l={},this.cwd="cwd"in l?"":ZC.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<hf.length;){const f=hf[a];f in l&&l[f]!==void 0&&l[f]!==null&&(this[f]=f==="history"?[...l[f]]:l[f])}let c;for(c in l)hf.includes(c)||(this[c]=l[c])}get basename(){return typeof this.path=="string"?Kn.basename(this.path):void 0}set basename(i){mf(i,"basename"),pf(i,"basename"),this.path=Kn.join(this.dirname||"",i)}get dirname(){return typeof this.path=="string"?Kn.dirname(this.path):void 0}set dirname(i){Uy(this.basename,"dirname"),this.path=Kn.join(i||"",this.basename)}get extname(){return typeof this.path=="string"?Kn.extname(this.path):void 0}set extname(i){if(pf(i,"extname"),Uy(this.dirname,"extname"),i){if(i.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(i.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kn.join(this.dirname,this.stem+(i||""))}get path(){return this.history[this.history.length-1]}set path(i){Bf(i)&&(i=JC(i)),mf(i,"path"),this.path!==i&&this.history.push(i)}get stem(){return typeof this.path=="string"?Kn.basename(this.path,this.extname):void 0}set stem(i){mf(i,"stem"),pf(i,"stem"),this.path=Kn.join(this.dirname||"",i+(this.extname||""))}fail(i,l,a){const c=this.message(i,l,a);throw c.fatal=!0,c}info(i,l,a){const c=this.message(i,l,a);return c.fatal=void 0,c}message(i,l,a){const c=new Wt(i,l,a);return this.path&&(c.name=this.path+":"+c.name,c.file=this.path),c.fatal=!1,this.messages.push(c),c}toString(i){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(i||void 0).decode(this.value)}}function pf(t,i){if(t&&t.includes(Kn.sep))throw new Error("`"+i+"` cannot be a path: did not expect `"+Kn.sep+"`")}function mf(t,i){if(!t)throw new Error("`"+i+"` cannot be empty")}function Uy(t,i){if(!t)throw new Error("Setting `"+i+"` requires `path` to be set too")}function eE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tE=(function(t){const a=this.constructor.prototype,c=a[t],f=function(){return c.apply(f,arguments)};return Object.setPrototypeOf(f,a),f}),nE={}.hasOwnProperty;class dd extends tE{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=VC()}copy(){const i=new dd;let l=-1;for(;++l<this.attachers.length;){const a=this.attachers[l];i.use(...a)}return i.data(df(!0,{},this.namespace)),i}data(i,l){return typeof i=="string"?arguments.length===2?(bf("data",this.frozen),this.namespace[i]=l,this):nE.call(this.namespace,i)&&this.namespace[i]||void 0:i?(bf("data",this.frozen),this.namespace=i,this):this.namespace}freeze(){if(this.frozen)return this;const i=this;for(;++this.freezeIndex<this.attachers.length;){const[l,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const c=l.call(i,...a);typeof c=="function"&&this.transformers.use(c)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(i){this.freeze();const l=Fs(i),a=this.parser||this.Parser;return gf("parse",a),a(String(l),l)}process(i,l){const a=this;return this.freeze(),gf("process",this.parser||this.Parser),yf("process",this.compiler||this.Compiler),l?c(void 0,l):new Promise(c);function c(f,o){const p=Fs(i),h=a.parse(p);a.run(h,p,function(b,y,v){if(b||!y||!v)return g(b);const x=y,k=a.stringify(x,v);lE(k)?v.value=k:v.result=k,g(b,v)});function g(b,y){b||!y?o(b):f?f(y):l(void 0,y)}}}processSync(i){let l=!1,a;return this.freeze(),gf("processSync",this.parser||this.Parser),yf("processSync",this.compiler||this.Compiler),this.process(i,c),Iy("processSync","process",l),a;function c(f,o){l=!0,Ly(f),a=o}}run(i,l,a){qy(i),this.freeze();const c=this.transformers;return!a&&typeof l=="function"&&(a=l,l=void 0),a?f(void 0,a):new Promise(f);function f(o,p){const h=Fs(l);c.run(i,h,g);function g(b,y,v){const x=y||i;b?p(b):o?o(x):a(void 0,x,v)}}}runSync(i,l){let a=!1,c;return this.run(i,l,f),Iy("runSync","run",a),c;function f(o,p){Ly(o),c=p,a=!0}}stringify(i,l){this.freeze();const a=Fs(l),c=this.compiler||this.Compiler;return yf("stringify",c),qy(i),c(i,a)}use(i,...l){const a=this.attachers,c=this.namespace;if(bf("use",this.frozen),i!=null)if(typeof i=="function")h(i,l);else if(typeof i=="object")Array.isArray(i)?p(i):o(i);else throw new TypeError("Expected usable value, not `"+i+"`");return this;function f(g){if(typeof g=="function")h(g,[]);else if(typeof g=="object")if(Array.isArray(g)){const[b,...y]=g;h(b,y)}else o(g);else throw new TypeError("Expected usable value, not `"+g+"`")}function o(g){if(!("plugins"in g)&&!("settings"in g))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");p(g.plugins),g.settings&&(c.settings=df(!0,c.settings,g.settings))}function p(g){let b=-1;if(g!=null)if(Array.isArray(g))for(;++b<g.length;){const y=g[b];f(y)}else throw new TypeError("Expected a list of plugins, not `"+g+"`")}function h(g,b){let y=-1,v=-1;for(;++y<a.length;)if(a[y][0]===g){v=y;break}if(v===-1)a.push([g,...b]);else if(b.length>0){let[x,...k]=b;const _=a[v][1];Lf(_)&&Lf(x)&&(x=df(!0,_,x)),a[v]=[g,x,...k]}}}}const iE=new dd().freeze();function gf(t,i){if(typeof i!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function yf(t,i){if(typeof i!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function bf(t,i){if(i)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function qy(t){if(!Lf(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Iy(t,i,l){if(!l)throw new Error("`"+t+"` finished async. Use `"+i+"` instead")}function Fs(t){return rE(t)?t:new Jb(t)}function rE(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function lE(t){return typeof t=="string"||aE(t)}function aE(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const sE="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hy=[],Vy={allowDangerousHtml:!0},oE=/^(https?|ircs?|mailto|xmpp)$/i,uE=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function cE(t){const i=fE(t),l=dE(t);return hE(i.runSync(i.parse(l),l),t)}function fE(t){const i=t.rehypePlugins||Hy,l=t.remarkPlugins||Hy,a=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Vy}:Vy;return iE().use(Gk).use(l).use(qC,a).use(i)}function dE(t){const i=t.children||"",l=new Jb;return typeof i=="string"&&(l.value=i),l}function hE(t,i){const l=i.allowedElements,a=i.allowElement,c=i.components,f=i.disallowedElements,o=i.skipHtml,p=i.unwrapDisallowed,h=i.urlTransform||pE;for(const b of uE)Object.hasOwn(i,b.from)&&(""+b.from+(b.to?"use `"+b.to+"` instead":"remove it")+sE+b.id,void 0);return i.className&&(t={type:"element",tagName:"div",properties:{className:i.className},children:t.type==="root"?t.children:[t]}),fd(t,g),Nw(t,{Fragment:u.Fragment,components:c,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function g(b,y,v){if(b.type==="raw"&&v&&typeof y=="number")return o?v.children.splice(y,1):v.children[y]={type:"text",value:b.value},y;if(b.type==="element"){let x;for(x in of)if(Object.hasOwn(of,x)&&Object.hasOwn(b.properties,x)){const k=b.properties[x],_=of[x];(_===null||_.includes(b.tagName))&&(b.properties[x]=h(String(k||""),x,b))}}if(b.type==="element"){let x=l?!l.includes(b.tagName):f?f.includes(b.tagName):!1;if(!x&&a&&typeof y=="number"&&(x=!a(b,y,v)),x&&v&&typeof y=="number")return p&&b.children?v.children.splice(y,1,...b.children):v.children.splice(y,1),y}}}function pE(t){const i=t.indexOf(":"),l=t.indexOf("?"),a=t.indexOf("#"),c=t.indexOf("/");return i===-1||c!==-1&&i>c||l!==-1&&i>l||a!==-1&&i>a||oE.test(t.slice(0,i))?t:""}function Yy(t,i){const l=String(t);if(typeof i!="string")throw new TypeError("Expected character");let a=0,c=l.indexOf(i);for(;c!==-1;)a++,c=l.indexOf(i,c+i.length);return a}function mE(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function gE(t,i,l){const c=co((l||{}).ignore||[]),f=yE(i);let o=-1;for(;++o<f.length;)Pb(t,"text",p);function p(g,b){let y=-1,v;for(;++y<b.length;){const x=b[y],k=v?v.children:void 0;if(c(x,k?k.indexOf(x):void 0,v))return;v=x}if(v)return h(g,b)}function h(g,b){const y=b[b.length-1],v=f[o][0],x=f[o][1];let k=0;const D=y.children.indexOf(g);let R=!1,z=[];v.lastIndex=0;let L=v.exec(g.value);for(;L;){const G=L.index,se={index:L.index,input:L.input,stack:[...b,g]};let T=x(...L,se);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?v.lastIndex=G+1:(k!==G&&z.push({type:"text",value:g.value.slice(k,G)}),Array.isArray(T)?z.push(...T):T&&z.push(T),k=G+L[0].length,R=!0),!v.global)break;L=v.exec(g.value)}return R?(k<g.value.length&&z.push({type:"text",value:g.value.slice(k)}),y.children.splice(D,1,...z)):z=[g],D+z.length}}function yE(t){const i=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const l=!t[0]||Array.isArray(t[0])?t:[t];let a=-1;for(;++a<l.length;){const c=l[a];i.push([bE(c[0]),vE(c[1])])}return i}function bE(t){return typeof t=="string"?new RegExp(mE(t),"g"):t}function vE(t){return typeof t=="function"?t:function(){return t}}const vf="phrasing",xf=["autolink","link","image","label"];function xE(){return{transforms:[NE],enter:{literalAutolink:wE,literalAutolinkEmail:Sf,literalAutolinkHttp:Sf,literalAutolinkWww:Sf},exit:{literalAutolink:EE,literalAutolinkEmail:CE,literalAutolinkHttp:jE,literalAutolinkWww:kE}}}function SE(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:vf,notInConstruct:xf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:vf,notInConstruct:xf},{character:":",before:"[ps]",after:"\\/",inConstruct:vf,notInConstruct:xf}]}}function wE(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Sf(t){this.config.enter.autolinkProtocol.call(this,t)}function jE(t){this.config.exit.autolinkProtocol.call(this,t)}function kE(t){this.config.exit.data.call(this,t);const i=this.stack[this.stack.length-1];i.type,i.url="http://"+this.sliceSerialize(t)}function CE(t){this.config.exit.autolinkEmail.call(this,t)}function EE(t){this.exit(t)}function NE(t){gE(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,AE],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),TE]],{ignore:["link","linkReference"]})}function AE(t,i,l,a,c){let f="";if(!Wb(c)||(/^w/i.test(i)&&(l=i+l,i="",f="http://"),!zE(l)))return!1;const o=RE(l+a);if(!o[0])return!1;const p={type:"link",title:null,url:f+i+o[0],children:[{type:"text",value:i+o[0]}]};return o[1]?[p,{type:"text",value:o[1]}]:p}function TE(t,i,l,a){return!Wb(a,!0)||/[-\d_]$/.test(l)?!1:{type:"link",title:null,url:"mailto:"+i+"@"+l,children:[{type:"text",value:i+"@"+l}]}}function zE(t){const i=t.split(".");return!(i.length<2||i[i.length-1]&&(/_/.test(i[i.length-1])||!/[a-zA-Z\d]/.test(i[i.length-1]))||i[i.length-2]&&(/_/.test(i[i.length-2])||!/[a-zA-Z\d]/.test(i[i.length-2])))}function RE(t){const i=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!i)return[t,void 0];t=t.slice(0,i.index);let l=i[0],a=l.indexOf(")");const c=Yy(t,"(");let f=Yy(t,")");for(;a!==-1&&c>f;)t+=l.slice(0,a+1),l=l.slice(a+1),a=l.indexOf(")"),f++;return[t,l]}function Wb(t,i){const l=t.input.charCodeAt(t.index-1);return(t.index===0||hr(l)||so(l))&&(!i||l!==47)}ev.peek=IE;function DE(){this.buffer()}function ME(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function _E(){this.buffer()}function OE(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function LE(t){const i=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=Vn(this.sliceSerialize(t)).toLowerCase(),l.label=i}function BE(t){this.exit(t)}function UE(t){const i=this.resume(),l=this.stack[this.stack.length-1];l.type,l.identifier=Vn(this.sliceSerialize(t)).toLowerCase(),l.label=i}function qE(t){this.exit(t)}function IE(){return"["}function ev(t,i,l,a){const c=l.createTracker(a);let f=c.move("[^");const o=l.enter("footnoteReference"),p=l.enter("reference");return f+=c.move(l.safe(l.associationId(t),{after:"]",before:f})),p(),o(),f+=c.move("]"),f}function HE(){return{enter:{gfmFootnoteCallString:DE,gfmFootnoteCall:ME,gfmFootnoteDefinitionLabelString:_E,gfmFootnoteDefinition:OE},exit:{gfmFootnoteCallString:LE,gfmFootnoteCall:BE,gfmFootnoteDefinitionLabelString:UE,gfmFootnoteDefinition:qE}}}function VE(t){let i=!1;return t&&t.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:l,footnoteReference:ev},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function l(a,c,f,o){const p=f.createTracker(o);let h=p.move("[^");const g=f.enter("footnoteDefinition"),b=f.enter("label");return h+=p.move(f.safe(f.associationId(a),{before:h,after:"]"})),b(),h+=p.move("]:"),a.children&&a.children.length>0&&(p.shift(4),h+=p.move((i?`
|
|
42
|
-
`:" ")+f.indentLines(f.containerFlow(a,p.current()),i?tv:YE))),g(),h}}function YE(t,i,l){return i===0?t:tv(t,i,l)}function tv(t,i,l){return(l?"":" ")+t}const GE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];nv.peek=$E;function FE(){return{canContainEols:["delete"],enter:{strikethrough:XE},exit:{strikethrough:KE}}}function QE(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:GE}],handlers:{delete:nv}}}function XE(t){this.enter({type:"delete",children:[]},t)}function KE(t){this.exit(t)}function nv(t,i,l,a){const c=l.createTracker(a),f=l.enter("strikethrough");let o=c.move("~~");return o+=l.containerPhrasing(t,{...c.current(),before:o,after:"~"}),o+=c.move("~~"),f(),o}function $E(){return"~"}function ZE(t){return t.length}function PE(t,i){const l=i||{},a=(l.align||[]).concat(),c=l.stringLength||ZE,f=[],o=[],p=[],h=[];let g=0,b=-1;for(;++b<t.length;){const _=[],D=[];let R=-1;for(t[b].length>g&&(g=t[b].length);++R<t[b].length;){const z=JE(t[b][R]);if(l.alignDelimiters!==!1){const L=c(z);D[R]=L,(h[R]===void 0||L>h[R])&&(h[R]=L)}_.push(z)}o[b]=_,p[b]=D}let y=-1;if(typeof a=="object"&&"length"in a)for(;++y<g;)f[y]=Gy(a[y]);else{const _=Gy(a);for(;++y<g;)f[y]=_}y=-1;const v=[],x=[];for(;++y<g;){const _=f[y];let D="",R="";_===99?(D=":",R=":"):_===108?D=":":_===114&&(R=":");let z=l.alignDelimiters===!1?1:Math.max(1,h[y]-D.length-R.length);const L=D+"-".repeat(z)+R;l.alignDelimiters!==!1&&(z=D.length+z+R.length,z>h[y]&&(h[y]=z),x[y]=z),v[y]=L}o.splice(1,0,v),p.splice(1,0,x),b=-1;const k=[];for(;++b<o.length;){const _=o[b],D=p[b];y=-1;const R=[];for(;++y<g;){const z=_[y]||"";let L="",G="";if(l.alignDelimiters!==!1){const se=h[y]-(D[y]||0),T=f[y];T===114?L=" ".repeat(se):T===99?se%2?(L=" ".repeat(se/2+.5),G=" ".repeat(se/2-.5)):(L=" ".repeat(se/2),G=L):G=" ".repeat(se)}l.delimiterStart!==!1&&!y&&R.push("|"),l.padding!==!1&&!(l.alignDelimiters===!1&&z==="")&&(l.delimiterStart!==!1||y)&&R.push(" "),l.alignDelimiters!==!1&&R.push(L),R.push(z),l.alignDelimiters!==!1&&R.push(G),l.padding!==!1&&R.push(" "),(l.delimiterEnd!==!1||y!==g-1)&&R.push("|")}k.push(l.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return k.join(`
|
|
43
|
-
`)}function JE(t){return t==null?"":String(t)}function Gy(t){const i=typeof t=="string"?t.codePointAt(0):0;return i===67||i===99?99:i===76||i===108?108:i===82||i===114?114:0}function WE(t,i,l,a){const c=l.enter("blockquote"),f=l.createTracker(a);f.move("> "),f.shift(2);const o=l.indentLines(l.containerFlow(t,f.current()),e2);return c(),o}function e2(t,i,l){return">"+(l?"":" ")+t}function t2(t,i){return Fy(t,i.inConstruct,!0)&&!Fy(t,i.notInConstruct,!1)}function Fy(t,i,l){if(typeof i=="string"&&(i=[i]),!i||i.length===0)return l;let a=-1;for(;++a<i.length;)if(t.includes(i[a]))return!0;return!1}function Qy(t,i,l,a){let c=-1;for(;++c<l.unsafe.length;)if(l.unsafe[c].character===`
|
|
44
|
-
`&&t2(l.stack,l.unsafe[c]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
45
|
-
`}function n2(t,i){const l=String(t);let a=l.indexOf(i),c=a,f=0,o=0;if(typeof i!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===c?++f>o&&(o=f):f=1,c=a+i.length,a=l.indexOf(i,c);return o}function i2(t,i){return!!(i.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function r2(t){const i=t.options.fence||"`";if(i!=="`"&&i!=="~")throw new Error("Cannot serialize code with `"+i+"` for `options.fence`, expected `` ` `` or `~`");return i}function l2(t,i,l,a){const c=r2(l),f=t.value||"",o=c==="`"?"GraveAccent":"Tilde";if(i2(t,l)){const y=l.enter("codeIndented"),v=l.indentLines(f,a2);return y(),v}const p=l.createTracker(a),h=c.repeat(Math.max(n2(f,c)+1,3)),g=l.enter("codeFenced");let b=p.move(h);if(t.lang){const y=l.enter(`codeFencedLang${o}`);b+=p.move(l.safe(t.lang,{before:b,after:" ",encode:["`"],...p.current()})),y()}if(t.lang&&t.meta){const y=l.enter(`codeFencedMeta${o}`);b+=p.move(" "),b+=p.move(l.safe(t.meta,{before:b,after:`
|
|
46
|
-
`,encode:["`"],...p.current()})),y()}return b+=p.move(`
|
|
47
|
-
`),f&&(b+=p.move(f+`
|
|
48
|
-
`)),b+=p.move(h),g(),b}function a2(t,i,l){return(l?"":" ")+t}function hd(t){const i=t.options.quote||'"';if(i!=='"'&&i!=="'")throw new Error("Cannot serialize title with `"+i+"` for `options.quote`, expected `\"`, or `'`");return i}function s2(t,i,l,a){const c=hd(l),f=c==='"'?"Quote":"Apostrophe",o=l.enter("definition");let p=l.enter("label");const h=l.createTracker(a);let g=h.move("[");return g+=h.move(l.safe(l.associationId(t),{before:g,after:"]",...h.current()})),g+=h.move("]: "),p(),!t.url||/[\0- \u007F]/.test(t.url)?(p=l.enter("destinationLiteral"),g+=h.move("<"),g+=h.move(l.safe(t.url,{before:g,after:">",...h.current()})),g+=h.move(">")):(p=l.enter("destinationRaw"),g+=h.move(l.safe(t.url,{before:g,after:t.title?" ":`
|
|
49
|
-
`,...h.current()}))),p(),t.title&&(p=l.enter(`title${f}`),g+=h.move(" "+c),g+=h.move(l.safe(t.title,{before:g,after:c,...h.current()})),g+=h.move(c),p()),o(),g}function o2(t){const i=t.options.emphasis||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize emphasis with `"+i+"` for `options.emphasis`, expected `*`, or `_`");return i}function ya(t){return"&#x"+t.toString(16).toUpperCase()+";"}function io(t,i,l){const a=ol(t),c=ol(i);return a===void 0?c===void 0?l==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:c===void 0?{inside:!1,outside:!1}:c===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}iv.peek=u2;function iv(t,i,l,a){const c=o2(l),f=l.enter("emphasis"),o=l.createTracker(a),p=o.move(c);let h=o.move(l.containerPhrasing(t,{after:c,before:p,...o.current()}));const g=h.charCodeAt(0),b=io(a.before.charCodeAt(a.before.length-1),g,c);b.inside&&(h=ya(g)+h.slice(1));const y=h.charCodeAt(h.length-1),v=io(a.after.charCodeAt(0),y,c);v.inside&&(h=h.slice(0,-1)+ya(y));const x=o.move(c);return f(),l.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},p+h+x}function u2(t,i,l){return l.options.emphasis||"*"}function c2(t,i){let l=!1;return fd(t,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return l=!0,_f}),!!((!t.depth||t.depth<3)&&rd(t)&&(i.options.setext||l))}function f2(t,i,l,a){const c=Math.max(Math.min(6,t.depth||1),1),f=l.createTracker(a);if(c2(t,l)){const b=l.enter("headingSetext"),y=l.enter("phrasing"),v=l.containerPhrasing(t,{...f.current(),before:`
|
|
50
|
-
`,after:`
|
|
51
|
-
`});return y(),b(),v+`
|
|
52
|
-
`+(c===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
53
|
-
`))+1))}const o="#".repeat(c),p=l.enter("headingAtx"),h=l.enter("phrasing");f.move(o+" ");let g=l.containerPhrasing(t,{before:"# ",after:`
|
|
54
|
-
`,...f.current()});return/^[\t ]/.test(g)&&(g=ya(g.charCodeAt(0))+g.slice(1)),g=g?o+" "+g:o,l.options.closeAtx&&(g+=" "+o),h(),p(),g}rv.peek=d2;function rv(t){return t.value||""}function d2(){return"<"}lv.peek=h2;function lv(t,i,l,a){const c=hd(l),f=c==='"'?"Quote":"Apostrophe",o=l.enter("image");let p=l.enter("label");const h=l.createTracker(a);let g=h.move("![");return g+=h.move(l.safe(t.alt,{before:g,after:"]",...h.current()})),g+=h.move("]("),p(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(p=l.enter("destinationLiteral"),g+=h.move("<"),g+=h.move(l.safe(t.url,{before:g,after:">",...h.current()})),g+=h.move(">")):(p=l.enter("destinationRaw"),g+=h.move(l.safe(t.url,{before:g,after:t.title?" ":")",...h.current()}))),p(),t.title&&(p=l.enter(`title${f}`),g+=h.move(" "+c),g+=h.move(l.safe(t.title,{before:g,after:c,...h.current()})),g+=h.move(c),p()),g+=h.move(")"),o(),g}function h2(){return"!"}av.peek=p2;function av(t,i,l,a){const c=t.referenceType,f=l.enter("imageReference");let o=l.enter("label");const p=l.createTracker(a);let h=p.move("![");const g=l.safe(t.alt,{before:h,after:"]",...p.current()});h+=p.move(g+"]["),o();const b=l.stack;l.stack=[],o=l.enter("reference");const y=l.safe(l.associationId(t),{before:h,after:"]",...p.current()});return o(),l.stack=b,f(),c==="full"||!g||g!==y?h+=p.move(y+"]"):c==="shortcut"?h=h.slice(0,-1):h+=p.move("]"),h}function p2(){return"!"}sv.peek=m2;function sv(t,i,l){let a=t.value||"",c="`",f=-1;for(;new RegExp("(^|[^`])"+c+"([^`]|$)").test(a);)c+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++f<l.unsafe.length;){const o=l.unsafe[f],p=l.compilePattern(o);let h;if(o.atBreak)for(;h=p.exec(a);){let g=h.index;a.charCodeAt(g)===10&&a.charCodeAt(g-1)===13&&g--,a=a.slice(0,g)+" "+a.slice(h.index+1)}}return c+a+c}function m2(){return"`"}function ov(t,i){const l=rd(t);return!!(!i.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(l===t.url||"mailto:"+l===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}uv.peek=g2;function uv(t,i,l,a){const c=hd(l),f=c==='"'?"Quote":"Apostrophe",o=l.createTracker(a);let p,h;if(ov(t,l)){const b=l.stack;l.stack=[],p=l.enter("autolink");let y=o.move("<");return y+=o.move(l.containerPhrasing(t,{before:y,after:">",...o.current()})),y+=o.move(">"),p(),l.stack=b,y}p=l.enter("link"),h=l.enter("label");let g=o.move("[");return g+=o.move(l.containerPhrasing(t,{before:g,after:"](",...o.current()})),g+=o.move("]("),h(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(h=l.enter("destinationLiteral"),g+=o.move("<"),g+=o.move(l.safe(t.url,{before:g,after:">",...o.current()})),g+=o.move(">")):(h=l.enter("destinationRaw"),g+=o.move(l.safe(t.url,{before:g,after:t.title?" ":")",...o.current()}))),h(),t.title&&(h=l.enter(`title${f}`),g+=o.move(" "+c),g+=o.move(l.safe(t.title,{before:g,after:c,...o.current()})),g+=o.move(c),h()),g+=o.move(")"),p(),g}function g2(t,i,l){return ov(t,l)?"<":"["}cv.peek=y2;function cv(t,i,l,a){const c=t.referenceType,f=l.enter("linkReference");let o=l.enter("label");const p=l.createTracker(a);let h=p.move("[");const g=l.containerPhrasing(t,{before:h,after:"]",...p.current()});h+=p.move(g+"]["),o();const b=l.stack;l.stack=[],o=l.enter("reference");const y=l.safe(l.associationId(t),{before:h,after:"]",...p.current()});return o(),l.stack=b,f(),c==="full"||!g||g!==y?h+=p.move(y+"]"):c==="shortcut"?h=h.slice(0,-1):h+=p.move("]"),h}function y2(){return"["}function pd(t){const i=t.options.bullet||"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bullet`, expected `*`, `+`, or `-`");return i}function b2(t){const i=pd(t),l=t.options.bulletOther;if(!l)return i==="*"?"-":"*";if(l!=="*"&&l!=="+"&&l!=="-")throw new Error("Cannot serialize items with `"+l+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(l===i)throw new Error("Expected `bullet` (`"+i+"`) and `bulletOther` (`"+l+"`) to be different");return l}function v2(t){const i=t.options.bulletOrdered||".";if(i!=="."&&i!==")")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOrdered`, expected `.` or `)`");return i}function fv(t){const i=t.options.rule||"*";if(i!=="*"&&i!=="-"&&i!=="_")throw new Error("Cannot serialize rules with `"+i+"` for `options.rule`, expected `*`, `-`, or `_`");return i}function x2(t,i,l,a){const c=l.enter("list"),f=l.bulletCurrent;let o=t.ordered?v2(l):pd(l);const p=t.ordered?o==="."?")":".":b2(l);let h=i&&l.bulletLastUsed?o===l.bulletLastUsed:!1;if(!t.ordered){const b=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&b&&(!b.children||!b.children[0])&&l.stack[l.stack.length-1]==="list"&&l.stack[l.stack.length-2]==="listItem"&&l.stack[l.stack.length-3]==="list"&&l.stack[l.stack.length-4]==="listItem"&&l.indexStack[l.indexStack.length-1]===0&&l.indexStack[l.indexStack.length-2]===0&&l.indexStack[l.indexStack.length-3]===0&&(h=!0),fv(l)===o&&b){let y=-1;for(;++y<t.children.length;){const v=t.children[y];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){h=!0;break}}}}h&&(o=p),l.bulletCurrent=o;const g=l.containerFlow(t,a);return l.bulletLastUsed=o,l.bulletCurrent=f,c(),g}function S2(t){const i=t.options.listItemIndent||"one";if(i!=="tab"&&i!=="one"&&i!=="mixed")throw new Error("Cannot serialize items with `"+i+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return i}function w2(t,i,l,a){const c=S2(l);let f=l.bulletCurrent||pd(l);i&&i.type==="list"&&i.ordered&&(f=(typeof i.start=="number"&&i.start>-1?i.start:1)+(l.options.incrementListMarker===!1?0:i.children.indexOf(t))+f);let o=f.length+1;(c==="tab"||c==="mixed"&&(i&&i.type==="list"&&i.spread||t.spread))&&(o=Math.ceil(o/4)*4);const p=l.createTracker(a);p.move(f+" ".repeat(o-f.length)),p.shift(o);const h=l.enter("listItem"),g=l.indentLines(l.containerFlow(t,p.current()),b);return h(),g;function b(y,v,x){return v?(x?"":" ".repeat(o))+y:(x?f:f+" ".repeat(o-f.length))+y}}function j2(t,i,l,a){const c=l.enter("paragraph"),f=l.enter("phrasing"),o=l.containerPhrasing(t,a);return f(),c(),o}const k2=co(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function C2(t,i,l,a){return(t.children.some(function(o){return k2(o)})?l.containerPhrasing:l.containerFlow).call(l,t,a)}function E2(t){const i=t.options.strong||"*";if(i!=="*"&&i!=="_")throw new Error("Cannot serialize strong with `"+i+"` for `options.strong`, expected `*`, or `_`");return i}dv.peek=N2;function dv(t,i,l,a){const c=E2(l),f=l.enter("strong"),o=l.createTracker(a),p=o.move(c+c);let h=o.move(l.containerPhrasing(t,{after:c,before:p,...o.current()}));const g=h.charCodeAt(0),b=io(a.before.charCodeAt(a.before.length-1),g,c);b.inside&&(h=ya(g)+h.slice(1));const y=h.charCodeAt(h.length-1),v=io(a.after.charCodeAt(0),y,c);v.inside&&(h=h.slice(0,-1)+ya(y));const x=o.move(c+c);return f(),l.attentionEncodeSurroundingInfo={after:v.outside,before:b.outside},p+h+x}function N2(t,i,l){return l.options.strong||"*"}function A2(t,i,l,a){return l.safe(t.value,a)}function T2(t){const i=t.options.ruleRepetition||3;if(i<3)throw new Error("Cannot serialize rules with repetition `"+i+"` for `options.ruleRepetition`, expected `3` or more");return i}function z2(t,i,l){const a=(fv(l)+(l.options.ruleSpaces?" ":"")).repeat(T2(l));return l.options.ruleSpaces?a.slice(0,-1):a}const hv={blockquote:WE,break:Qy,code:l2,definition:s2,emphasis:iv,hardBreak:Qy,heading:f2,html:rv,image:lv,imageReference:av,inlineCode:sv,link:uv,linkReference:cv,list:x2,listItem:w2,paragraph:j2,root:C2,strong:dv,text:A2,thematicBreak:z2};function R2(){return{enter:{table:D2,tableData:Xy,tableHeader:Xy,tableRow:_2},exit:{codeText:O2,table:M2,tableData:wf,tableHeader:wf,tableRow:wf}}}function D2(t){const i=t._align;this.enter({type:"table",align:i.map(function(l){return l==="none"?null:l}),children:[]},t),this.data.inTable=!0}function M2(t){this.exit(t),this.data.inTable=void 0}function _2(t){this.enter({type:"tableRow",children:[]},t)}function wf(t){this.exit(t)}function Xy(t){this.enter({type:"tableCell",children:[]},t)}function O2(t){let i=this.resume();this.data.inTable&&(i=i.replace(/\\([\\|])/g,L2));const l=this.stack[this.stack.length-1];l.type,l.value=i,this.exit(t)}function L2(t,i){return i==="|"?i:t}function B2(t){const i=t||{},l=i.tableCellPadding,a=i.tablePipeAlign,c=i.stringLength,f=l?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
55
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:o,tableCell:h,tableRow:p}};function o(x,k,_,D){return g(b(x,_,D),x.align)}function p(x,k,_,D){const R=y(x,_,D),z=g([R]);return z.slice(0,z.indexOf(`
|
|
56
|
-
`))}function h(x,k,_,D){const R=_.enter("tableCell"),z=_.enter("phrasing"),L=_.containerPhrasing(x,{...D,before:f,after:f});return z(),R(),L}function g(x,k){return PE(x,{align:k,alignDelimiters:a,padding:l,stringLength:c})}function b(x,k,_){const D=x.children;let R=-1;const z=[],L=k.enter("table");for(;++R<D.length;)z[R]=y(D[R],k,_);return L(),z}function y(x,k,_){const D=x.children;let R=-1;const z=[],L=k.enter("tableRow");for(;++R<D.length;)z[R]=h(D[R],x,k,_);return L(),z}function v(x,k,_){let D=hv.inlineCode(x,k,_);return _.stack.includes("tableCell")&&(D=D.replace(/\|/g,"\\$&")),D}}function U2(){return{exit:{taskListCheckValueChecked:Ky,taskListCheckValueUnchecked:Ky,paragraph:I2}}}function q2(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:H2}}}function Ky(t){const i=this.stack[this.stack.length-2];i.type,i.checked=t.type==="taskListCheckValueChecked"}function I2(t){const i=this.stack[this.stack.length-2];if(i&&i.type==="listItem"&&typeof i.checked=="boolean"){const l=this.stack[this.stack.length-1];l.type;const a=l.children[0];if(a&&a.type==="text"){const c=i.children;let f=-1,o;for(;++f<c.length;){const p=c[f];if(p.type==="paragraph"){o=p;break}}o===l&&(a.value=a.value.slice(1),a.value.length===0?l.children.shift():l.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,l.position.start=Object.assign({},a.position.start)))}}this.exit(t)}function H2(t,i,l,a){const c=t.children[0],f=typeof t.checked=="boolean"&&c&&c.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",p=l.createTracker(a);f&&p.move(o);let h=hv.listItem(t,i,l,{...a,...p.current()});return f&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,g)),h;function g(b){return b+o}}function V2(){return[xE(),HE(),FE(),R2(),U2()]}function Y2(t){return{extensions:[SE(),VE(t),QE(),B2(t),q2()]}}const G2={tokenize:Z2,partial:!0},pv={tokenize:P2,partial:!0},mv={tokenize:J2,partial:!0},gv={tokenize:W2,partial:!0},F2={tokenize:eN,partial:!0},yv={name:"wwwAutolink",tokenize:K2,previous:vv},bv={name:"protocolAutolink",tokenize:$2,previous:xv},gi={name:"emailAutolink",tokenize:X2,previous:Sv},$n={};function Q2(){return{text:$n}}let fr=48;for(;fr<123;)$n[fr]=gi,fr++,fr===58?fr=65:fr===91&&(fr=97);$n[43]=gi;$n[45]=gi;$n[46]=gi;$n[95]=gi;$n[72]=[gi,bv];$n[104]=[gi,bv];$n[87]=[gi,yv];$n[119]=[gi,yv];function X2(t,i,l){const a=this;let c,f;return o;function o(y){return!Uf(y)||!Sv.call(a,a.previous)||md(a.events)?l(y):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),p(y))}function p(y){return Uf(y)?(t.consume(y),p):y===64?(t.consume(y),h):l(y)}function h(y){return y===46?t.check(F2,b,g)(y):y===45||y===95||Jt(y)?(f=!0,t.consume(y),h):b(y)}function g(y){return t.consume(y),c=!0,h}function b(y){return f&&c&&rn(a.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),i(y)):l(y)}}function K2(t,i,l){const a=this;return c;function c(o){return o!==87&&o!==119||!vv.call(a,a.previous)||md(a.events)?l(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(G2,t.attempt(pv,t.attempt(mv,f),l),l)(o))}function f(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),i(o)}}function $2(t,i,l){const a=this;let c="",f=!1;return o;function o(y){return(y===72||y===104)&&xv.call(a,a.previous)&&!md(a.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),c+=String.fromCodePoint(y),t.consume(y),p):l(y)}function p(y){if(rn(y)&&c.length<5)return c+=String.fromCodePoint(y),t.consume(y),p;if(y===58){const v=c.toLowerCase();if(v==="http"||v==="https")return t.consume(y),h}return l(y)}function h(y){return y===47?(t.consume(y),f?g:(f=!0,h)):l(y)}function g(y){return y===null||eo(y)||Et(y)||hr(y)||so(y)?l(y):t.attempt(pv,t.attempt(mv,b),l)(y)}function b(y){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),i(y)}}function Z2(t,i,l){let a=0;return c;function c(o){return(o===87||o===119)&&a<3?(a++,t.consume(o),c):o===46&&a===3?(t.consume(o),f):l(o)}function f(o){return o===null?l(o):i(o)}}function P2(t,i,l){let a,c,f;return o;function o(g){return g===46||g===95?t.check(gv,h,p)(g):g===null||Et(g)||hr(g)||g!==45&&so(g)?h(g):(f=!0,t.consume(g),o)}function p(g){return g===95?a=!0:(c=a,a=void 0),t.consume(g),o}function h(g){return c||a||!f?l(g):i(g)}}function J2(t,i){let l=0,a=0;return c;function c(o){return o===40?(l++,t.consume(o),c):o===41&&a<l?f(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(gv,i,f)(o):o===null||Et(o)||hr(o)?i(o):(t.consume(o),c)}function f(o){return o===41&&a++,t.consume(o),c}}function W2(t,i,l){return a;function a(p){return p===33||p===34||p===39||p===41||p===42||p===44||p===46||p===58||p===59||p===63||p===95||p===126?(t.consume(p),a):p===38?(t.consume(p),f):p===93?(t.consume(p),c):p===60||p===null||Et(p)||hr(p)?i(p):l(p)}function c(p){return p===null||p===40||p===91||Et(p)||hr(p)?i(p):a(p)}function f(p){return rn(p)?o(p):l(p)}function o(p){return p===59?(t.consume(p),a):rn(p)?(t.consume(p),o):l(p)}}function eN(t,i,l){return a;function a(f){return t.consume(f),c}function c(f){return Jt(f)?l(f):i(f)}}function vv(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Et(t)}function xv(t){return!rn(t)}function Sv(t){return!(t===47||Uf(t))}function Uf(t){return t===43||t===45||t===46||t===95||Jt(t)}function md(t){let i=t.length,l=!1;for(;i--;){const a=t[i][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){l=!0;break}if(a._gfmAutolinkLiteralWalkedInto){l=!1;break}}return t.length>0&&!l&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),l}const tN={tokenize:uN,partial:!0};function nN(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:aN,continuation:{tokenize:sN},exit:oN}},text:{91:{name:"gfmFootnoteCall",tokenize:lN},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iN,resolveTo:rN}}}}function iN(t,i,l){const a=this;let c=a.events.length;const f=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o;for(;c--;){const h=a.events[c][1];if(h.type==="labelImage"){o=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return p;function p(h){if(!o||!o._balanced)return l(h);const g=Vn(a.sliceSerialize({start:o.end,end:a.now()}));return g.codePointAt(0)!==94||!f.includes(g.slice(1))?l(h):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(h),t.exit("gfmFootnoteCallLabelMarker"),i(h))}}function rN(t,i){let l=t.length;for(;l--;)if(t[l][1].type==="labelImage"&&t[l][0]==="enter"){t[l][1];break}t[l+1][1].type="data",t[l+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},t[l+3][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"gfmFootnoteCallMarker",start:Object.assign({},t[l+3][1].end),end:Object.assign({},t[l+3][1].end)};c.end.column++,c.end.offset++,c.end._bufferIndex++;const f={type:"gfmFootnoteCallString",start:Object.assign({},c.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},p=[t[l+1],t[l+2],["enter",a,i],t[l+3],t[l+4],["enter",c,i],["exit",c,i],["enter",f,i],["enter",o,i],["exit",o,i],["exit",f,i],t[t.length-2],t[t.length-1],["exit",a,i]];return t.splice(l,t.length-l+1,...p),t}function lN(t,i,l){const a=this,c=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let f=0,o;return p;function p(y){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),h}function h(y){return y!==94?l(y):(t.enter("gfmFootnoteCallMarker"),t.consume(y),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",g)}function g(y){if(f>999||y===93&&!o||y===null||y===91||Et(y))return l(y);if(y===93){t.exit("chunkString");const v=t.exit("gfmFootnoteCallString");return c.includes(Vn(a.sliceSerialize(v)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(y),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),i):l(y)}return Et(y)||(o=!0),f++,t.consume(y),y===92?b:g}function b(y){return y===91||y===92||y===93?(t.consume(y),f++,g):g(y)}}function aN(t,i,l){const a=this,c=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let f,o=0,p;return h;function h(k){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),g}function g(k){return k===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",b):l(k)}function b(k){if(o>999||k===93&&!p||k===null||k===91||Et(k))return l(k);if(k===93){t.exit("chunkString");const _=t.exit("gfmFootnoteDefinitionLabelString");return f=Vn(a.sliceSerialize(_)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(k),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),v}return Et(k)||(p=!0),o++,t.consume(k),k===92?y:b}function y(k){return k===91||k===92||k===93?(t.consume(k),o++,b):b(k)}function v(k){return k===58?(t.enter("definitionMarker"),t.consume(k),t.exit("definitionMarker"),c.includes(f)||c.push(f),lt(t,x,"gfmFootnoteDefinitionWhitespace")):l(k)}function x(k){return i(k)}}function sN(t,i,l){return t.check(Sa,i,t.attempt(tN,i,l))}function oN(t){t.exit("gfmFootnoteDefinition")}function uN(t,i,l){const a=this;return lt(t,c,"gfmFootnoteDefinitionIndent",5);function c(f){const o=a.events[a.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?i(f):l(f)}}function cN(t){let l=(t||{}).singleTilde;const a={name:"strikethrough",tokenize:f,resolveAll:c};return l==null&&(l=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function c(o,p){let h=-1;for(;++h<o.length;)if(o[h][0]==="enter"&&o[h][1].type==="strikethroughSequenceTemporary"&&o[h][1]._close){let g=h;for(;g--;)if(o[g][0]==="exit"&&o[g][1].type==="strikethroughSequenceTemporary"&&o[g][1]._open&&o[h][1].end.offset-o[h][1].start.offset===o[g][1].end.offset-o[g][1].start.offset){o[h][1].type="strikethroughSequence",o[g][1].type="strikethroughSequence";const b={type:"strikethrough",start:Object.assign({},o[g][1].start),end:Object.assign({},o[h][1].end)},y={type:"strikethroughText",start:Object.assign({},o[g][1].end),end:Object.assign({},o[h][1].start)},v=[["enter",b,p],["enter",o[g][1],p],["exit",o[g][1],p],["enter",y,p]],x=p.parser.constructs.insideSpan.null;x&&jn(v,v.length,0,oo(x,o.slice(g+1,h),p)),jn(v,v.length,0,[["exit",y,p],["enter",o[h][1],p],["exit",o[h][1],p],["exit",b,p]]),jn(o,g-1,h-g+3,v),h=g+v.length-2;break}}for(h=-1;++h<o.length;)o[h][1].type==="strikethroughSequenceTemporary"&&(o[h][1].type="data");return o}function f(o,p,h){const g=this.previous,b=this.events;let y=0;return v;function v(k){return g===126&&b[b.length-1][1].type!=="characterEscape"?h(k):(o.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const _=ol(g);if(k===126)return y>1?h(k):(o.consume(k),y++,x);if(y<2&&!l)return h(k);const D=o.exit("strikethroughSequenceTemporary"),R=ol(k);return D._open=!R||R===2&&!!_,D._close=!_||_===2&&!!R,p(k)}}}class fN{constructor(){this.map=[]}add(i,l,a){dN(this,i,l,a)}consume(i){if(this.map.sort(function(f,o){return f[0]-o[0]}),this.map.length===0)return;let l=this.map.length;const a=[];for(;l>0;)l-=1,a.push(i.slice(this.map[l][0]+this.map[l][1]),this.map[l][2]),i.length=this.map[l][0];a.push(i.slice()),i.length=0;let c=a.pop();for(;c;){for(const f of c)i.push(f);c=a.pop()}this.map.length=0}}function dN(t,i,l,a){let c=0;if(!(l===0&&a.length===0)){for(;c<t.map.length;){if(t.map[c][0]===i){t.map[c][1]+=l,t.map[c][2].push(...a);return}c+=1}t.map.push([i,l,a])}}function hN(t,i){let l=!1;const a=[];for(;i<t.length;){const c=t[i];if(l){if(c[0]==="enter")c[1].type==="tableContent"&&a.push(t[i+1][1].type==="tableDelimiterMarker"?"left":"none");else if(c[1].type==="tableContent"){if(t[i-1][1].type==="tableDelimiterMarker"){const f=a.length-1;a[f]=a[f]==="left"?"center":"right"}}else if(c[1].type==="tableDelimiterRow")break}else c[0]==="enter"&&c[1].type==="tableDelimiterRow"&&(l=!0);i+=1}return a}function pN(){return{flow:{null:{name:"table",tokenize:mN,resolveAll:gN}}}}function mN(t,i,l){const a=this;let c=0,f=0,o;return p;function p(E){let U=a.events.length-1;for(;U>-1;){const ee=a.events[U][1].type;if(ee==="lineEnding"||ee==="linePrefix")U--;else break}const H=U>-1?a.events[U][1].type:null,Z=H==="tableHead"||H==="tableRow"?T:h;return Z===T&&a.parser.lazy[a.now().line]?l(E):Z(E)}function h(E){return t.enter("tableHead"),t.enter("tableRow"),g(E)}function g(E){return E===124||(o=!0,f+=1),b(E)}function b(E){return E===null?l(E):Oe(E)?f>1?(f=0,a.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),x):l(E):We(E)?lt(t,b,"whitespace")(E):(f+=1,o&&(o=!1,c+=1),E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),o=!0,b):(t.enter("data"),y(E)))}function y(E){return E===null||E===124||Et(E)?(t.exit("data"),b(E)):(t.consume(E),E===92?v:y)}function v(E){return E===92||E===124?(t.consume(E),y):y(E)}function x(E){return a.interrupt=!1,a.parser.lazy[a.now().line]?l(E):(t.enter("tableDelimiterRow"),o=!1,We(E)?lt(t,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):k(E))}function k(E){return E===45||E===58?D(E):E===124?(o=!0,t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),_):se(E)}function _(E){return We(E)?lt(t,D,"whitespace")(E):D(E)}function D(E){return E===58?(f+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),R):E===45?(f+=1,R(E)):E===null||Oe(E)?G(E):se(E)}function R(E){return E===45?(t.enter("tableDelimiterFiller"),z(E)):se(E)}function z(E){return E===45?(t.consume(E),z):E===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(E),t.exit("tableDelimiterMarker"),L):(t.exit("tableDelimiterFiller"),L(E))}function L(E){return We(E)?lt(t,G,"whitespace")(E):G(E)}function G(E){return E===124?k(E):E===null||Oe(E)?!o||c!==f?se(E):(t.exit("tableDelimiterRow"),t.exit("tableHead"),i(E)):se(E)}function se(E){return l(E)}function T(E){return t.enter("tableRow"),V(E)}function V(E){return E===124?(t.enter("tableCellDivider"),t.consume(E),t.exit("tableCellDivider"),V):E===null||Oe(E)?(t.exit("tableRow"),i(E)):We(E)?lt(t,V,"whitespace")(E):(t.enter("data"),X(E))}function X(E){return E===null||E===124||Et(E)?(t.exit("data"),V(E)):(t.consume(E),E===92?q:X)}function q(E){return E===92||E===124?(t.consume(E),X):X(E)}}function gN(t,i){let l=-1,a=!0,c=0,f=[0,0,0,0],o=[0,0,0,0],p=!1,h=0,g,b,y;const v=new fN;for(;++l<t.length;){const x=t[l],k=x[1];x[0]==="enter"?k.type==="tableHead"?(p=!1,h!==0&&($y(v,i,h,g,b),b=void 0,h=0),g={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(l,0,[["enter",g,i]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,y=void 0,f=[0,0,0,0],o=[0,l+1,0,0],p&&(p=!1,b={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},v.add(l,0,[["enter",b,i]])),c=k.type==="tableDelimiterRow"?2:b?3:1):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,o[2]===0&&(f[1]!==0&&(o[0]=o[1],y=Qs(v,i,f,c,void 0,y),f=[0,0,0,0]),o[2]=l)):k.type==="tableCellDivider"&&(a?a=!1:(f[1]!==0&&(o[0]=o[1],y=Qs(v,i,f,c,void 0,y)),f=o,o=[f[1],l,0,0])):k.type==="tableHead"?(p=!0,h=l):k.type==="tableRow"||k.type==="tableDelimiterRow"?(h=l,f[1]!==0?(o[0]=o[1],y=Qs(v,i,f,c,l,y)):o[1]!==0&&(y=Qs(v,i,o,c,l,y)),c=0):c&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(o[3]=l)}for(h!==0&&$y(v,i,h,g,b),v.consume(i.events),l=-1;++l<i.events.length;){const x=i.events[l];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=hN(i.events,l))}return t}function Qs(t,i,l,a,c,f){const o=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",p="tableContent";l[0]!==0&&(f.end=Object.assign({},sl(i.events,l[0])),t.add(l[0],0,[["exit",f,i]]));const h=sl(i.events,l[1]);if(f={type:o,start:Object.assign({},h),end:Object.assign({},h)},t.add(l[1],0,[["enter",f,i]]),l[2]!==0){const g=sl(i.events,l[2]),b=sl(i.events,l[3]),y={type:p,start:Object.assign({},g),end:Object.assign({},b)};if(t.add(l[2],0,[["enter",y,i]]),a!==2){const v=i.events[l[2]],x=i.events[l[3]];if(v[1].end=Object.assign({},x[1].end),v[1].type="chunkText",v[1].contentType="text",l[3]>l[2]+1){const k=l[2]+1,_=l[3]-l[2]-1;t.add(k,_,[])}}t.add(l[3]+1,0,[["exit",y,i]])}return c!==void 0&&(f.end=Object.assign({},sl(i.events,c)),t.add(c,0,[["exit",f,i]]),f=void 0),f}function $y(t,i,l,a,c){const f=[],o=sl(i.events,l);c&&(c.end=Object.assign({},o),f.push(["exit",c,i])),a.end=Object.assign({},o),f.push(["exit",a,i]),t.add(l+1,0,f)}function sl(t,i){const l=t[i],a=l[0]==="enter"?"start":"end";return l[1][a]}const yN={name:"tasklistCheck",tokenize:vN};function bN(){return{text:{91:yN}}}function vN(t,i,l){const a=this;return c;function c(h){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?l(h):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),f)}function f(h){return Et(h)?(t.enter("taskListCheckValueUnchecked"),t.consume(h),t.exit("taskListCheckValueUnchecked"),o):h===88||h===120?(t.enter("taskListCheckValueChecked"),t.consume(h),t.exit("taskListCheckValueChecked"),o):l(h)}function o(h){return h===93?(t.enter("taskListCheckMarker"),t.consume(h),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),p):l(h)}function p(h){return Oe(h)?i(h):We(h)?t.check({tokenize:xN},i,l)(h):l(h)}}function xN(t,i,l){return lt(t,a,"whitespace");function a(c){return c===null?l(c):i(c)}}function SN(t){return Db([Q2(),nN(),cN(t),pN(),bN()])}const wN={};function jN(t){const i=this,l=t||wN,a=i.data(),c=a.micromarkExtensions||(a.micromarkExtensions=[]),f=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),o=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);c.push(SN(l)),f.push(V2()),o.push(Y2(l))}function qf(t){const i=t.trim();if(!(!i||/[\u0000-\u0020\u007f]/.test(i)))try{const l=new URL(i);if(l.protocol==="https:"||l.protocol==="http:"||l.protocol==="mailto:")return i}catch{}}function If(t){return!!t&&!/[\u0000-\u001f\u007f]/.test(t)&&!/^[a-z][a-z\d+.-]*:/i.test(t)&&!t.startsWith("//")}function Zy(t){if(!If(t))return;const i=t.split(/[?#]/,1)[0];if(i)try{const l=decodeURIComponent(i);return If(l)?l:void 0}catch{return}}async function kN(t){if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(t);return}const i=document.activeElement,l=document.createElement("textarea");l.value=t,l.setAttribute("aria-label","复制内容"),l.style.cssText="position:fixed;left:-10000px;top:0",document.body.append(l);try{if(l.select(),!document.execCommand("copy"))throw new Error("复制不可用")}finally{l.remove(),i instanceof HTMLElement&&i.focus({preventScroll:!0})}}function ho({text:t,label:i="复制"}){const[l,a]=w.useState("idle"),c=w.useRef(!0),f=w.useRef(void 0);w.useEffect(()=>(c.current=!0,()=>{c.current=!1,clearTimeout(f.current)}),[]);const o=async()=>{clearTimeout(f.current);try{await kN(t),c.current&&a("copied")}catch{c.current&&a("error")}c.current&&(f.current=setTimeout(()=>a("idle"),2500))};return u.jsx("button",{className:"message-copy",onClick:()=>{o()},"aria-label":i,title:i,children:l==="copied"?"已复制":l==="error"?"复制失败":i})}function Hf(t){return typeof t=="string"||typeof t=="number"?String(t):Array.isArray(t)?t.map(Hf).join(""):w.isValidElement(t)?Hf(t.props.children):""}function CN({children:t}){const i=w.Children.toArray(t).find(f=>w.isValidElement(f)),a=(w.isValidElement(i)?i.props.className??"":"").match(/(?:^|\s)language-([\w+-]+)/)?.[1]??"代码",c=Hf(t).replace(/\n$/,"");return u.jsxs("div",{className:"message-code-block",children:[u.jsxs("div",{className:"message-code-heading",children:[u.jsx("span",{children:a}),u.jsx(ho,{text:c,label:"复制代码"})]}),u.jsx("pre",{tabIndex:0,children:t})]})}function EN(t){return{a:({href:i,children:l,title:a})=>{const c=qf(i??"");if(c)return u.jsx("a",{href:c,title:a,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:l});const f=i?Zy(i):void 0;return f?u.jsxs("span",{className:"message-file-reference",title:f,children:[t?u.jsx("button",{className:"message-file-open",onClick:()=>t(f),children:l}):l,u.jsx(ho,{text:f,label:"复制路径"})]}):u.jsx("span",{children:l})},img:({src:i,alt:l})=>{const a=qf(typeof i=="string"?i:""),c=typeof i=="string"?Zy(i):void 0;return a?u.jsxs("a",{className:"message-image-reference",href:a,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",children:[l||"图片",u.jsx("span",{children:"打开图片 ↗"})]}):c&&t?u.jsxs("button",{className:"message-image-reference",title:c,onClick:()=>t(c),children:[l||"图片",u.jsx("span",{children:"查看图片"})]}):u.jsxs("span",{className:"message-image-reference",children:[l||"图片",u.jsx("span",{children:"图片路径不可直接访问"})]})},pre:({children:i})=>u.jsx(CN,{children:i}),table:({children:i})=>u.jsx("div",{className:"message-table-scroll",role:"region","aria-label":"表格",tabIndex:0,children:u.jsx("table",{children:i})})}}const NN=w.memo(function({text:i,reasoning:l="",streaming:a=!1,onOpenFile:c}){const f=w.useMemo(()=>EN(c),[c]);return u.jsxs("div",{className:"message-content",children:[l?u.jsxs("details",{className:"message-reasoning",children:[u.jsx("summary",{children:a&&!i?"思考中…":"思考过程"}),u.jsx("pre",{children:l})]}):null,a?u.jsxs("div",{className:"message-streaming",children:[i||(l?"":"正在思考…"),u.jsx("span",{className:"cursor","aria-hidden":"true",children:"▍"})]}):i?u.jsx(cE,{remarkPlugins:[jN],skipHtml:!0,urlTransform:o=>qf(o)??(If(o)?o:""),components:f,children:i}):null,!a&&i?u.jsx("div",{className:"message-actions",children:u.jsx(ho,{text:i,label:"复制回复"})}):null]})});function AN(t){const i=t.args??{},l=t.summary||[i.description,i.command,i.file_path,i.path,i.query,i.url].find(a=>typeof a=="string"&&a.trim());return typeof l=="string"?l.replace(/\s+/g," ").slice(0,180):""}const TN=w.memo(function({item:i,running:l}){const a=AN(i),c=i.done?i.error?"失败":"已完成":l?"执行中":"未完成";return u.jsxs("details",{className:`message-tool-card${i.error?" message-tool-error":""}`,children:[u.jsxs("summary",{children:[u.jsx("span",{className:"message-tool-indicator","aria-hidden":"true",children:i.done?i.error?"!":"✓":"·"}),u.jsx("span",{className:"message-tool-name",children:i.name}),u.jsx("span",{className:"message-tool-summary",children:a}),u.jsx("span",{className:"message-tool-status",children:c})]}),i.args&&Object.keys(i.args).length?u.jsxs("div",{className:"message-tool-section",children:[u.jsx("strong",{children:"参数"}),u.jsx("pre",{tabIndex:0,children:JSON.stringify(i.args,null,2)})]}):null,u.jsxs("div",{className:"message-tool-section",children:[u.jsxs("div",{className:"message-tool-result-heading",children:[u.jsx("strong",{children:"结果"}),i.result?u.jsx(ho,{text:i.result,label:"复制结果"}):null]}),u.jsx("pre",{tabIndex:0,children:i.result??(i.done?"工具没有返回文本内容。":l?"等待工具返回结果…":"这次工具调用没有保存结果。")})]})]})});function zN(t){return{running:"运行中",completed:"已完成",error:"失败",recorded:"历史记录"}[t]??t}function RN(t){const i=new URLSearchParams(t).get("session");return i&&/^[a-zA-Z0-9_-]{1,128}$/.test(i)?i:null}function wv(t,i){return!i||!t.hubEpoch||t.hubSequence===void 0?!0:t.hubEpoch===i.epoch&&t.hubSequence>i.sequence}function Py(t,i=[]){let l=pS(t.transcript);for(const c of t.liveStream?.events??[])l=Js(l,c.event);t.running?l={...l,run:"running"}:t.running===!1&&(l.run==="running"||l.run==="waiting")&&(l={...l,run:"idle"});let a=t.streamCursor;for(const c of i)wv(c,a)&&(l=Js(l,c.event),c.hubEpoch&&c.hubSequence!==void 0&&(a={epoch:c.hubEpoch,sequence:c.hubSequence}));return{chat:l,cursor:a,truncated:t.liveStream?.truncated??!1}}function jv(t,i){if(t?.title)return t.title;const l=t?.items.find(a=>a.kind==="user");if(l&&l.kind==="user"&&l.text.trim()){const a=l.text.trim().split(`
|
|
57
|
-
`)[0];return a.length>32?`${a.slice(0,32)}…`:a}return l?.kind==="user"&&l.attachments?.length?`附件:${l.attachments[0].name}`:i.slice(0,8)}function DN(t,i){if(i.workspaceKey!==t.workspaceKey||i.sessionId!==t.activeId)throw new Error("当前工作区或对话已经变化,请重新打开面板后发送。");if(t.connection!=="open"||t.loading)throw new Error("工作台尚未连接,请连接后重新发送面板任务。");if(t.readOnly)throw new Error("当前对话为只读,无法发送面板任务。");if(t.running||t.chat.run==="running"||t.chat.run==="waiting"||t.approvals.some(l=>!l.sessionId||l.sessionId===i.sessionId))throw new Error("当前对话仍在处理任务,请完成后再发送面板任务。");if(t.uncertain||t.uploading||t.uploadBusy)throw new Error("当前消息或附件仍在发送,请等待结果后重试。");if(t.draft.length>0||t.files.length>0)throw new Error("当前对话还有草稿或附件,请先处理它们,再发送面板任务。");if(!i.prompt.trim()||i.prompt.length>2e4)throw new Error("面板任务内容无效。");if(t.setDraft(i.prompt),!t.send())throw t.setDraft(""),new Error("当前对话暂时无法接收任务,请稍后重新发送。");return{accepted:!0}}function MN({controller:t,onBackToProjects:i,projectName:l}){const{connection:a,sessions:c,activeId:f,chat:o,draft:p,files:h,uploading:g,workerNote:b,replayNote:y,error:v,workspaceCwd:x,workspaceName:k,configuration:_,configurationVersion:D,sessionsVersion:R,localDrafts:z,running:L,title:G,approvalCount:se,onAuthLost:T,refreshSessions:V,refreshConfiguration:X,session:q}=t,E=t.workspaceApi,U=t.host==="desktop"?"桌面":"服务端",[H,Z]=w.useState(!1),ee=w.useRef(null),W=w.useRef(null),[N,K]=w.useState(()=>new URLSearchParams(window.location?.search??"").get("view")==="links"?"links":"chat"),[he,ge]=w.useState(),[j,O]=w.useState(),[J,A]=w.useState(0),[ae,pe]=w.useState(!1),[te,oe]=w.useState(null),[we,F]=w.useState("overview"),[be,Ee]=w.useState(()=>window.matchMedia("(max-width: 760px)").matches),[Re,Qe]=w.useState(()=>!window.matchMedia("(max-width: 760px)").matches),Ve=w.useRef(null),at=w.useRef(null),st=w.useRef(!1),pt=w.useRef(null),Nt=w.useRef(null),qe=w.useRef(!0);w.useEffect(()=>{ge(void 0),K(Q=>Q==="panel"?"panels":Q)},[t.workspaceKey]),w.useEffect(()=>{be&&!Re&&st.current&&!H&&at.current?.focus(),st.current=Re},[be,Re,H]),w.useEffect(()=>{const Q=window.matchMedia("(max-width: 760px)"),xe=()=>{Ee(Q.matches),Qe(!Q.matches)};return Q.addEventListener("change",xe),()=>Q.removeEventListener("change",xe)},[]),w.useEffect(()=>{if(!be||!Re)return;const Q=Ve.current;Q?.querySelector("button")?.focus();const xe=ze=>{if(!document.querySelector("dialog[open]")){if(ze.key==="Escape"&&!ze.isComposing)ze.preventDefault(),Qe(!1),at.current?.focus();else if(ze.key==="Tab"){const re=Array.from(Q?.querySelectorAll('button:not(:disabled), select:not(:disabled), input:not(:disabled), textarea:not(:disabled), a[href], summary, [tabindex]:not([tabindex="-1"])')??[]).filter(ke=>ke.getClientRects().length>0),je=re?.[0],Be=re?.[re.length-1];ze.shiftKey&&document.activeElement===je?(ze.preventDefault(),Be?.focus()):!ze.shiftKey&&document.activeElement===Be&&(ze.preventDefault(),je?.focus())}}};return document.addEventListener("keydown",xe),()=>document.removeEventListener("keydown",xe)},[be,Re]),w.useLayoutEffect(()=>{const Q=Nt.current;!Q||N!=="chat"||(Q.style.height="auto",Q.style.height=`${Math.min(180,Math.max(64,Q.scrollHeight))}px`)},[p,N]),w.useLayoutEffect(()=>{const Q=pt.current;Q&&qe.current&&N==="chat"&&(Q.scrollTop=Q.scrollHeight)},[o.items,t.approvals.length,N]);const ct=()=>{be&&(Qe(!1),at.current?.focus())},Fe=Q=>{if(N==="settings"&&we===Q){ct();return}nt(()=>{F(Q),K("settings"),ct()})},nt=Q=>{ae?oe(()=>Q):Q()},Dt=Q=>nt(()=>{O(Q),A(xe=>xe+1),K("files"),ct()}),rt=w.useRef(Dt);rt.current=Dt;const wt=w.useCallback(Q=>rt.current(Q),[]);w.useEffect(()=>{if(!ae&&!t.uploadBusy&&!t.hasUnsent)return;const Q=xe=>{xe.preventDefault(),xe.returnValue=""};return window.addEventListener("beforeunload",Q),()=>window.removeEventListener("beforeunload",Q)},[ae,t.uploadBusy,t.hasUnsent]);const M=Q=>nt(()=>{K("chat"),ct(),qe.current=!0,Q()}),$=Q=>M(()=>{t.selectSession(Q)}),me=()=>M(t.newSession),ve=()=>{qe.current=!0,t.send()},Ce=t.stop,_e=t.approvals.filter(Q=>!Q.sessionId||Q.sessionId===f),Ke=t.approvals.filter(Q=>Q.sessionId&&Q.sessionId!==f),bt=o.items.length===0&&_e.length===0,ft=_?.connections.find(Q=>Q.id===_.defaults.text),$e=a==="open"?"已连接":a==="connecting"?"连接中":"正在重连",Ze=N==="chat"?G:N==="files"?"工作区文件":N==="history"?"历史对话":N==="links"?"Link":N==="panels"||N==="panel"?he&&N==="panel"?he.panel.title["zh-CN"]||he.panel.title.default:"面板":we==="skills"?"Skills":"设置";return u.jsxs("div",{className:`shell${Re?" sidebar-open":""}`,children:[be&&Re?u.jsx("div",{className:"sidebar-backdrop",onClick:()=>{Qe(!1),at.current?.focus()},"aria-hidden":"true"}):null,u.jsxs("aside",{id:"workbench-sidebar",ref:Ve,className:"rail",hidden:!Re,role:be?"dialog":void 0,"aria-modal":be&&Re?!0:void 0,"aria-label":"工作台导航",children:[u.jsxs("div",{className:"rail-head",children:[u.jsx("span",{className:"brand-mark",children:u.jsx(Rt,{name:"brand"})}),u.jsx("strong",{children:"CodeShell"}),u.jsx("span",{className:"hub-badge",children:t.host==="desktop"?"Desktop":E?"Hub":"Web"}),u.jsx("button",{className:"icon-button sidebar-close","aria-label":"收起侧栏",onClick:()=>{Qe(!1),at.current?.focus()},children:u.jsx(Rt,{name:"sidebar"})})]}),u.jsx(Xf,{discover:t.workspaceApi,navigate:Q=>{const xe=()=>window.location.assign(Q);ae||t.hasUnsent||t.uploadBusy?oe(()=>xe):xe()}}),u.jsxs("nav",{className:"workbench-nav","aria-label":"主要功能",children:[i?u.jsxs("button",{className:"nav-button",title:l,onClick:()=>{ae||t.hasUnsent||t.uploadBusy?oe(()=>i):i()},children:[u.jsx(Rt,{name:"folder"}),u.jsx("span",{children:"返回项目列表"})]}):null,u.jsxs("button",{className:"nav-button new-chat-button",onClick:me,children:[u.jsx(Rt,{name:"plus"}),u.jsx("span",{children:"新对话"})]}),u.jsxs("button",{className:`nav-button${N==="chat"?" active":""}`,onClick:()=>{nt(()=>{K("chat"),ct()})},"aria-current":N==="chat"?"page":void 0,children:[u.jsx(Rt,{name:"chat"}),u.jsx("span",{children:"对话"})]}),E?u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`nav-button${N==="history"?" active":""}`,onClick:()=>nt(()=>{K("history"),ct()}),"aria-current":N==="history"?"page":void 0,children:[u.jsx(Rt,{name:"history"}),u.jsx("span",{children:"历史对话"})]}),u.jsxs("button",{className:`nav-button${N==="files"?" active":""}`,onClick:()=>Dt(),"aria-current":N==="files"?"page":void 0,children:[u.jsx(Rt,{name:"folder"}),u.jsx("span",{children:"文件"})]}),u.jsxs("button",{className:`nav-button${N==="settings"&&we==="skills"?" active":""}`,onClick:()=>Fe("skills"),"aria-current":N==="settings"&&we==="skills"?"page":void 0,children:[u.jsx(Rt,{name:"skills"}),u.jsx("span",{children:"Skills"})]}),u.jsxs("button",{className:`nav-button${N==="panels"||N==="panel"?" active":""}`,onClick:()=>nt(()=>{K("panels"),ct()}),"aria-current":N==="panels"||N==="panel"?"page":void 0,children:[u.jsx(Rt,{name:"panels"}),u.jsx("span",{children:"面板"})]}),u.jsxs("button",{className:`nav-button${N==="links"?" active":""}`,onClick:()=>nt(()=>{K("links"),ct()}),"aria-current":N==="links"?"page":void 0,children:[u.jsx(Rt,{name:"links"}),u.jsx("span",{children:"Link"})]}),u.jsxs("button",{className:`nav-button${N==="settings"&&we!=="skills"?" active":""}`,onClick:()=>Fe("overview"),"aria-current":N==="settings"&&we!=="skills"?"page":void 0,children:[u.jsx(Rt,{name:"settings"}),u.jsx("span",{children:"设置"})]})]}):null]}),u.jsx("div",{className:"rail-section-label",children:"工作区"}),E?u.jsxs("button",{className:"workspace-button",title:x??void 0,onClick:()=>Dt(),children:[u.jsx(Rt,{name:"folder"}),u.jsx("span",{children:l??k}),u.jsx(Rt,{name:"chevron"})]}):u.jsxs("div",{className:"workspace-button",title:x??void 0,children:[u.jsx(Rt,{name:"folder"}),u.jsx("span",{children:l??k})]}),u.jsxs("div",{className:"rail-section-label history-label",children:[u.jsx("span",{children:"最近对话"}),u.jsx("span",{children:c.length})]}),t.renderSidebar?.({guard:nt,conversation:M}),u.jsxs("ul",{className:"sessions","aria-label":"最近对话",children:[z.map(({sessionId:Q,draft:xe})=>u.jsx("li",{children:u.jsxs("button",{className:Q===f&&N==="chat"?"session active":"session",onClick:()=>{$(Q)},children:[u.jsx("span",{className:"session-title",children:xe.text.trim()||`附件:${xe.files[0]?.name??"新对话"}`}),u.jsx("span",{className:"session-meta",children:"草稿"})]})},`draft-${Q}`)),c.map(Q=>u.jsx("li",{children:u.jsxs("button",{className:Q.sessionId===f&&N==="chat"?"session active":"session",onClick:()=>{$(Q.sessionId)},"aria-current":Q.sessionId===f&&N==="chat"?"page":void 0,children:[u.jsx("span",{className:"session-title",children:Q.sessionId===f?Q.customTitle||o.title||Q.title||jv(o,Q.sessionId):Q.title||Q.preview?.trim()||Q.sessionId.slice(0,8)}),u.jsxs("span",{className:"session-meta",children:[t.unreadSessionIds?.has(Q.sessionId)&&Q.sessionId!==f?u.jsxs("span",{className:"session-unread","aria-label":"有新消息",children:["●"," "]}):null,se(Q.sessionId)?`${se(Q.sessionId)} 项待审批`:Q.running?"进行中":ON(Q.status),t.showTurnCounts!==!1?u.jsxs("span",{children:[" · ",Q.turnCount," 轮"]}):null]})]})},Q.sessionId)),c.length===0&&z.length===0?u.jsx("li",{className:"empty",children:"开始对话后,记录会保存在这里。"}):null]}),u.jsxs("div",{className:"rail-footer",children:[u.jsxs("div",{className:"host-label",children:[u.jsx("span",{className:`dot ${a}`}),u.jsxs("span",{children:[U,$e]})]}),t.host==="hub"?u.jsxs("button",{className:"account-button",onClick:()=>{ct(),Z(!0)},children:[u.jsx("span",{className:"account-avatar",children:(q?.username||"C").slice(0,1).toUpperCase()}),u.jsxs("span",{className:"account-copy",children:[u.jsx("strong",{children:q?.username||"账号"}),u.jsx("span",{children:"设备与退出"})]}),u.jsx(Rt,{name:"chevron"})]}):null,t.logout?u.jsxs("button",{className:"account-button",onClick:t.logout,children:[u.jsx("span",{className:"account-avatar",children:(t.accountName||"D").slice(0,1)}),u.jsxs("span",{className:"account-copy",children:[u.jsx("strong",{children:t.accountName||"已配对设备"}),u.jsx("span",{children:"退出此设备"})]})]}):null]})]}),u.jsxs("main",{className:"workbench-main",inert:be&&Re?!0:void 0,children:[u.jsxs("header",{className:"workbench-topbar",children:[u.jsx("button",{ref:at,className:"icon-button","aria-label":Re?"收起侧栏":"展开侧栏","aria-expanded":Re,"aria-controls":"workbench-sidebar",onClick:()=>Qe(Q=>!Q),children:u.jsx(Rt,{name:"sidebar"})}),u.jsxs("div",{className:"topbar-context",children:[u.jsx("span",{className:"topbar-project","aria-label":"当前项目",title:l??k,children:l??k}),u.jsx("span",{className:"topbar-title",title:Ze,children:Ze})]}),u.jsxs("span",{className:"connection-pill",title:`任务在${U}工作区执行`,children:[u.jsx("span",{className:`dot ${a}`}),u.jsx("span",{children:U})]})]}),b?u.jsx("div",{className:"banner",children:b}):null,y?u.jsx("div",{className:"banner",children:y}):null,v?u.jsxs("div",{className:"banner form-error",role:"alert",children:[v,u.jsx("button",{className:"ghost","aria-label":"关闭错误提示",onClick:t.clearError,children:"×"})]}):null,Ke.length?u.jsxs("div",{className:"banner",children:["其他会话有待处理审批。",Ke.map(Q=>u.jsxs("button",{className:"ghost",onClick:()=>{$(Q.sessionId)},children:["打开 ",Q.sessionId.slice(0,8)]},Q.id))]}):null,a!=="open"?u.jsxs("div",{className:"banner",children:["连接",a==="connecting"?"中…":"已断开,重连中…"]}):null,N!=="chat"&&_e.length>0?u.jsxs("div",{className:"banner",children:["当前对话需要你的确认。",u.jsx("button",{className:"ghost",onClick:()=>nt(()=>K("chat")),children:"返回对话"})]}):null,u.jsxs("section",{className:`chat${bt?" chat-empty":""}`,hidden:N!=="chat","aria-label":"对话",children:[u.jsx("div",{className:"messages",ref:pt,onScroll:Q=>{const xe=Q.currentTarget;qe.current=xe.scrollHeight-xe.scrollTop-xe.clientHeight<100},children:u.jsxs("div",{className:"transcript",children:[t.chatControls,t.loading?u.jsx("div",{className:"banner",role:"status",children:"正在恢复会话记录…"}):null,o.goal?u.jsxs("div",{className:"banner goal",children:[u.jsx("span",{children:o.goal}),t.goalActions]}):null,o.items.map(Q=>{switch(Q.kind){case"user":return u.jsxs("div",{className:"msg user",children:[Q.text,Q.attachments?.map((xe,ze)=>E&&xe.path?u.jsxs("button",{className:"attachment attachment-open",onClick:()=>Dt(xe.path),children:["📎 ",xe.name]},ze):u.jsxs("span",{className:"attachment",children:["📎 ",xe.name]},ze))]},Q.id);case"assistant":return Q.done&&!Q.text&&!Q.reasoning?null:u.jsx("div",{className:"msg assistant",children:u.jsx(NN,{text:Q.text,reasoning:Q.reasoning,streaming:!Q.done,onOpenFile:E?wt:void 0})},Q.id);case"tool":return u.jsx("div",{className:`msg tool${Q.error?" tool-error":""}`,children:u.jsx(TN,{item:Q,running:L})},Q.id);case"subagent":return u.jsxs("div",{className:"msg info",children:["↳ ",Q.label," · ",zN(Q.status)]},Q.id);case"system_error":return u.jsx("div",{className:"msg error",children:Q.text},Q.id);default:return null}}),t.approvalContent,bt?u.jsxs("div",{className:"empty-chat",children:[u.jsx("span",{className:"welcome-mark",children:u.jsx(Rt,{name:"brand"})}),u.jsx("h1",{children:"今天想完成什么?"}),u.jsx("p",{children:"从一个问题或想法开始,让 CodeShell 帮你一步步完成。"}),u.jsxs("span",{className:"welcome-workspace",children:[u.jsx(Rt,{name:"folder"}),l??k]})]}):null]})}),t.readOnlyNote?u.jsx("div",{className:"banner",children:t.readOnlyNote}):null,u.jsxs("div",{className:"composer-wrap",children:[u.jsxs("footer",{className:"composer",children:[h.length||g&&t.host==="hub"?u.jsxs("div",{className:"attachments","aria-live":"polite",children:[h.map(Q=>u.jsxs("span",{className:"attachment",children:[u.jsx(Rt,{name:"attachment"}),Q.name,u.jsx("button",{className:"ghost","aria-label":`移除 ${Q.name}`,onClick:()=>{t.removeFile(Q.id)},children:"×"})]},Q.id)),g&&t.host==="hub"?u.jsx("span",{children:"正在上传…"}):null]}):null,u.jsx("textarea",{ref:Nt,"aria-label":"任务内容",value:p,disabled:t.readOnly,rows:2,placeholder:"描述你的任务,或提出一个问题…",onChange:Q=>{t.setDraft(Q.target.value)},onKeyDown:Q=>{Q.key==="Enter"&&!Q.shiftKey&&!Q.nativeEvent.isComposing&&(Q.preventDefault(),ve())}}),u.jsxs("div",{className:"composer-toolbar",children:[E?u.jsxs(u.Fragment,{children:[u.jsx("input",{hidden:!0,multiple:!0,type:"file",accept:t.attachmentAccept,ref:ee,onChange:Q=>{const xe=Q.currentTarget;Promise.resolve(t.addFiles(xe.files)).finally(()=>{xe.value=""})}}),u.jsx("button",{className:"icon-button attach-button","aria-label":"添加附件",title:"添加附件",disabled:t.uploadBusy||a!=="open"||t.readOnly,onClick:()=>ee.current?.click(),children:u.jsx(Rt,{name:"plus"})}),t.cameraAttachments?u.jsxs(u.Fragment,{children:[u.jsx("input",{hidden:!0,type:"file",accept:"image/*",capture:"environment",ref:W,onChange:Q=>{const xe=Q.currentTarget;Promise.resolve(t.addFiles(xe.files)).finally(()=>{xe.value=""})}}),u.jsx("button",{className:"icon-button attach-button","aria-label":"拍照",title:"拍照",disabled:t.uploadBusy||a!=="open"||t.readOnly,onClick:()=>W.current?.click(),children:u.jsx(Rt,{name:"camera"})})]}):null,u.jsxs("button",{className:"model-button",title:"打开模型设置",onClick:()=>Fe("models"),children:[u.jsx("span",{children:ft?.model||"配置模型"}),u.jsx(Rt,{name:"chevron"})]})]}):null,u.jsx("span",{className:"composer-run-status",role:"status",children:t.uncertain?"正在核对消息…":g?t.host==="desktop"?"正在发送…":"正在上传附件…":_e.length?"等待你的确认":L?"正在处理…":""}),L?u.jsx("button",{className:"stop composer-submit","aria-label":"停止",title:"停止",onClick:Ce,disabled:a!=="open",children:u.jsx(Rt,{name:"stop"})}):u.jsx("button",{className:"send composer-submit","aria-label":"发送",title:"发送",onClick:ve,disabled:a!=="open"||g||t.uncertain||t.readOnly||!p.trim()&&!h.length,children:u.jsx(Rt,{name:"send"})})]})]}),u.jsxs("div",{className:"composer-caption",children:[u.jsxs("span",{children:["任务在",U,"工作区执行"]}),u.jsx("span",{children:"Enter 发送 · Shift + Enter 换行"})]})]})]}),N==="settings"&&E?u.jsx(F1,{host:t.host==="desktop"?"desktop":"hub",section:we,onSectionChange:Fe,onAuthLost:T,onConfigurationChange:()=>{X()},configurationVersion:D,onDirtyChange:pe},`${t.workspaceKey}:settings`):null,N==="files"&&E?u.jsx(J1,{initialPath:j,openVersion:J,onAuthLost:T},`${t.workspaceKey}:files`):null,N==="history"&&E?u.jsx(W1,{onAuthLost:T,onOpen:Q=>{$(Q)},onChanged:()=>{V()},version:R,onDirtyChange:pe},`${t.workspaceKey}:history`):null,N==="links"&&E?u.jsx(HS,{onAuthLost:T,onDirtyChange:pe,hostLabel:U,configurationVersion:D},`${t.workspaceKey}:links`):null,N==="panels"&&E?u.jsx(VS,{onAuthLost:T,onDirtyChange:pe,onChanged:()=>{X()},hostLabel:U,configurationVersion:D,onOpen:Q=>nt(()=>{ge({panel:Q,workspaceKey:t.workspaceKey}),K("panel"),ct()})},`${t.workspaceKey}:panels`):null,N==="panel"&&E&&he?.workspaceKey===t.workspaceKey?u.jsx(JS,{panel:he.panel,sessionId:f,busy:L||g||t.uncertain,onAuthLost:T,onDirtyChange:pe,onClose:()=>nt(()=>K("panels")),onSubmitPrompt:async Q=>DN(t,{...Q,workspaceKey:he.workspaceKey})},`${t.workspaceKey}:panel:${he.panel.id}:${f}`):null]}),te?u.jsx(_N,{onStay:()=>oe(null),onLeave:()=>{const Q=te;oe(null),pe(!1),Q()}}):null,H&&t.host==="hub"?u.jsx(d1,{session:q,onClose:()=>Z(!1),onAuthLost:T}):null]})}function _N({onStay:t,onLeave:i}){const l=w.useRef(null);return w.useEffect(()=>{const a=document.activeElement;return l.current?.showModal(),()=>{l.current?.close(),a?.focus()}},[]),u.jsxs("dialog",{className:"navigation-prompt",ref:l,"aria-labelledby":"navigation-prompt-title",onCancel:a=>{a.preventDefault(),t()},children:[u.jsx("h2",{id:"navigation-prompt-title",children:"还有未保存的修改"}),u.jsx("p",{children:"离开会丢弃未提交的修改;切换项目还会清除未发送的草稿和附件。已经提交的操作可能仍会完成,请等待结果后再离开。"}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",onClick:t,autoFocus:!0,children:"留在此页"}),u.jsx("button",{className:"library-button",onClick:i,children:"放弃修改并离开"})]})]})}function ON(t){switch(t){case"running":return"进行中";case"waiting":case"waiting_approval":return"等待确认";case"completed":return"已完成";case"cancelled":case"canceled":return"已停止";case"failed":case"error":return"发生错误";case"idle":return"可继续";default:return"对话"}}function Rt({name:t}){const i={panels:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),u.jsx("path",{d:"M15 3v18M15 10h6"})]}),camera:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 7h4l2-3h6l2 3h4v13H3Z"}),u.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),links:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-2 2"}),u.jsx("path",{d:"M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l2-2"})]}),brand:u.jsx(u.Fragment,{children:u.jsx("path",{d:"m5 7 5 5-5 5M13 17h6"})}),sidebar:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 4v16"})]}),plus:u.jsx("path",{d:"M12 5v14M5 12h14"}),chat:u.jsx("path",{d:"M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8v.5Z"}),history:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),u.jsx("path",{d:"M3 3v5h5M12 7v5l3 2"})]}),skills:u.jsx(u.Fragment,{children:u.jsx("path",{d:"m12 3 2.7 5.5L21 9.4l-4.5 4.4 1.1 6.2L12 17.1 6.4 20l1.1-6.2L3 9.4l6.3-.9L12 3Z"})}),settings:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"m9 3-.7 3-2.6 1-2.6 2 1.4 3-1.4 3 2.6 2 2.6 1 .7 3h6l.7-3 2.6-1 2.6-2-1.4-3 1.4-3-2.6-2-2.6-1L15 3H9Z"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),folder:u.jsx("path",{d:"M3 7V5a1 1 0 0 1 1-1h5l2 3h9a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7Z"}),chevron:u.jsx("path",{d:"m9 5 7 7-7 7"}),attachment:u.jsx("path",{d:"m21 11-8 8a6 6 0 0 1-8.5-8.5l9-9A4 4 0 0 1 19 7l-9 9a2 2 0 0 1-2.8-2.8l8-8"}),send:u.jsx("path",{d:"M12 19V5m-6 6 6-6 6 6"}),stop:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor",stroke:"none"})};return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i[t]})}class Fi extends Error{constructor(i,l,a){super(i),this.kind=l,this.code=a,this.name="ProtocolRequestError"}kind;code}const LN=3e4,Jy=800,BN=15e3;class UN{constructor(i){this.url=i}url;ws=null;nextId=1;pending=new Map;notificationHandlers=new Set;stateHandlers=new Set;reconnectDelay=Jy;closedByUser=!1;reconnectTimer;authHandlers=new Set;connect(){this.ws||(clearTimeout(this.reconnectTimer),this.closedByUser=!1,this.openSocket())}openSocket(){if(this.closedByUser)return;this.reconnectTimer=void 0,this.emitState("connecting");const i=new WebSocket(this.url);this.ws=i,i.onopen=()=>{this.ws!==i||this.closedByUser||(this.reconnectDelay=Jy,this.emitState("open"))},i.onmessage=l=>{if(this.ws!==i||this.closedByUser)return;let a;try{if(a=JSON.parse(String(l.data)),!a||typeof a!="object"||Array.isArray(a))return}catch{return}if(a.id!==void 0&&a.method===void 0){const c=this.pending.get(String(a.id));if(!c)return;this.pending.delete(String(a.id)),clearTimeout(c.timer),a.error?c.reject(new Fi(a.error.message??"request failed","response",a.error.code)):c.resolve(a.result);return}if(a.method)for(const c of this.notificationHandlers)c(a.method,a.params??{})},i.onclose=l=>{if(this.ws===i){if(this.ws=null,this.emitState("closed"),this.failAllPending(new Fi("connection closed","transport")),l.code===4401||l.code===4403){this.closedByUser=!0;for(const a of this.authHandlers)a()}this.closedByUser||(this.reconnectTimer=setTimeout(()=>this.openSocket(),this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,BN))}},i.onerror=()=>{}}close(){this.closedByUser=!0,clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0;const i=this.ws;this.ws=null,i?.close(),this.failAllPending(new Fi("connection closed","transport"))}onNotification(i){return this.notificationHandlers.add(i),()=>this.notificationHandlers.delete(i)}onStateChange(i){return this.stateHandlers.add(i),()=>this.stateHandlers.delete(i)}onAuthLost(i){return this.authHandlers.add(i),()=>this.authHandlers.delete(i)}request(i,l,a=LN){const c=this.ws;if(!c||c.readyState!==WebSocket.OPEN)return Promise.reject(new Fi("not connected","not-sent"));const f=`web-${this.nextId++}`;return new Promise((o,p)=>{const h=a>0?setTimeout(()=>{this.pending.delete(f),p(new Fi(`request timed out: ${i}`,"timeout"))},a):void 0;this.pending.set(f,{resolve:o,reject:p,timer:h});try{c.send(JSON.stringify({jsonrpc:"2.0",id:f,method:i,params:l}))}catch(g){clearTimeout(h),this.pending.delete(f),p(new Fi(g instanceof Error?g.message:"send failed","not-sent"))}})}run(i){return this.request("agent/run",i,0)}listSessions(){return this.request("agent/query",{type:"sessions"})}sessionDetail(i){return this.request("agent/query",{type:"session_detail",sessionId:i})}approve(i,l,a){return this.request("agent/approve",{sessionId:i.sessionId??"",...i.connectionId?{connectionId:i.connectionId}:{},...i.generation!==void 0?{generation:i.generation}:{},requestId:i.requestId,decision:l?{approved:!0,...a?{answer:a}:{}}:{approved:!1}})}cancel(i){return this.request("agent/cancel",{sessionId:i})}emitState(i){for(const l of this.stateHandlers)l(i)}failAllPending(i){for(const[,l]of this.pending)clearTimeout(l.timer),l.reject(i);this.pending.clear()}}function qN(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${yt("/ws")}`}function IN(t,i){const{method:l,params:a}=i;if(l==="serve/approvalSnapshot"){if(!Array.isArray(a.approvals))return t;const f={};for(const o of a.approvals)o?.requestId&&o.request&&(f[o.requestId]={payload:o});return f}if(l==="agent/approvalRequest"){const f=a;return!f.requestId||!f.request?t:{...t,[f.requestId]:{...t[f.requestId],payload:f}}}const c=a.requestId;if(typeof c!="string"||!t[c])return t;if(l==="agent/approvalResolved"){const f={...t};return delete f[c],f}return l==="serve/approvalLease"?{...t,[c]:{...t[c],lease:a}}:t}class HN{drafts=new Map;get(i){return this.drafts.get(i)??{text:"",files:[],revision:0}}update(i,l){const a={...l,revision:this.get(i).revision+1};return this.drafts.set(i,a),a}setText(i,l){return this.update(i,{...this.get(i),text:l})}addFile(i,l){const a=this.get(i);return this.update(i,{...a,files:[...a.files,l]})}removeFile(i,l){const a=this.get(i);return this.update(i,{...a,files:a.files.filter(c=>c.id!==l)})}take(i){const l=this.get(i),a=this.update(i,{text:"",files:[]});return{sessionId:i,draft:l,clearedRevision:a.revision}}restore(i){const l=this.get(i.sessionId);return l.revision!==i.clearedRevision||l.text||l.files.length?!1:(this.update(i.sessionId,i.draft),!0)}unsent(){return[...this.drafts].flatMap(([i,l])=>l.text.trim()||l.files.length?[{sessionId:i,draft:l}]:[])}}function VN({payload:t,onDecide:i,busy:l,connected:a}){const[c,f]=w.useState(""),o=t.request.toolName==="__ask_user__",{summary:p,risk:h}=fS(t.request.args,t.request.riskLevel,t.request.toolName);return u.jsxs("div",{className:"approval",children:[u.jsxs("div",{className:"approval-title",children:[o?"Agent 提问":`工具审批:${t.request.toolName}`,o?null:u.jsxs("em",{children:[" · ",h]})]}),t.request.description?u.jsx("div",{className:"approval-desc",children:t.request.description}):null,o?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"approval-summary",children:p}),u.jsxs("details",{className:"approval-raw",children:[u.jsx("summary",{children:"原始参数"}),u.jsx("pre",{className:"approval-args",children:JSON.stringify(t.request.args,null,2)})]})]}),o?u.jsx("textarea",{className:"approval-answer",value:c,placeholder:"输入回答…",onChange:g=>f(g.target.value)}):null,l?u.jsx("span",{className:"muted",role:"status",children:"设备正在处理此审批…"}):null,u.jsxs("div",{className:"approval-actions",children:[u.jsx("button",{className:"send",disabled:l||!a||o&&!c.trim(),onClick:()=>i(t,!0,o?c:void 0),children:o?"回答":"允许"}),u.jsx("button",{className:"stop",disabled:l||!a,onClick:()=>i(t,!1),children:"拒绝"})]})]})}function Wy(){return va()}const YN=()=>{},GN=async()=>{};function FN({session:t,hub:i=!1,onAuthLost:l=YN,onCheckAuth:a=GN}){const c=w.useRef(null),[f,o]=w.useState("connecting"),[p,h]=w.useState([]),g=w.useRef([]),[b,y]=w.useState(()=>RN(window.location.search)??Wy()),[v,x]=w.useState(Xs()),[k,_]=w.useReducer(IN,{}),[D,R]=w.useState({}),[z,L]=w.useState(""),[G,se]=w.useState([]),T=w.useRef(new HN),[V,X]=w.useState(0),[q,E]=w.useState(null),U=q===b,[H,Z]=w.useState(null),[ee,W]=w.useState(null),[N,K]=w.useState(""),[he,ge]=w.useState(Date.now()),[j,O]=w.useState(0),[J,A]=w.useState(null),[ae,pe]=w.useState(0),te=w.useRef(0),oe=w.useRef(b),we=w.useRef(null),F=w.useRef(new Map),be=w.useRef(new Map),Ee=w.useRef(new Set),Re=w.useRef(new Set),Qe=w.useRef(new Set),Ve=w.useRef(!1),at=w.useRef(null),st=w.useRef(null),pt=w.useCallback(re=>{if(X(Be=>Be+1),oe.current!==re)return;const je=T.current.get(re);L(je.text),se(je.files)},[]);w.useEffect(()=>{const re=new URL(window.location.href);re.searchParams.set("session",b),window.history.replaceState(window.history.state,"",re)},[b]);const Nt=w.useCallback((re,je)=>{const Be=T.current.restore(re.draft);pt(re.draft.sessionId),oe.current===re.draft.sessionId&&(x(ke=>({...ke,run:"error",items:ke.items.filter(Ae=>Ae.kind!=="user"||Ae.clientMessageId!==re.clientMessageId)})),Be&&K(`${je?`${je} `:"消息未送达。"}内容和附件已恢复,可以重试。`))},[pt]),qe=w.useCallback(re=>{Ve.current&&(re instanceof Xe&&re.status===401?l():K(re instanceof Error?re.message:"操作失败,请重试。"))},[l]),ct=w.useCallback(async()=>{if(!i||!Ve.current)return;const re=++te.current;try{const je=await fb();Ve.current&&re===te.current&&A(je)}catch(je){Ve.current&&je instanceof Xe&&je.status===401&&l()}},[i,l]),Fe=w.useCallback(async()=>{const re=c.current;if(re)try{const je=i?(await Ef()).sessions:(await re.listSessions()).data;if(c.current===re&&Ve.current){const Be=[...je].sort((ke,Ae)=>(Ae.lastActiveAt??Ae.startedAt)-(ke.lastActiveAt??ke.startedAt));g.current=Be,h(Be)}}catch(je){qe(je)}},[qe,i]),nt=w.useCallback(async()=>{const re=c.current;if(re)for(const[je,Be]of be.current)try{const ke=await re.sessionDetail(je);if(!Ve.current||re!==c.current||be.current.get(je)!==Be)continue;Py(ke.data).chat.items.some(B=>B.kind==="user"&&B.clientMessageId===Be.clientMessageId)?be.current.delete(je):ke.data.running||(be.current.delete(je),Nt(Be))}catch(ke){if(!Ve.current||re!==c.current||be.current.get(je)!==Be)continue;ke instanceof Fi&&ke.kind==="response"&&ke.code===-32001&&ke.message===`Session not found: ${je}`&&(be.current.delete(je),Nt(Be))}},[Nt]),Dt=w.useCallback(async re=>{const je=c.current;if(!je)return;const Be={sessionId:re,events:[]};st.current=Be;try{const ke=await je.sessionDetail(re);if(!Ve.current||st.current!==Be||oe.current!==re)return;const Ae=Be.running??ke.data.running;Ae?Re.current.add(re):Ae===!1&&Re.current.delete(re);const ye=Py(ke.data,Be.events),B=ye.chat;we.current=ye.cursor??null,W(ye.truncated?"这次运行的实时记录较长,已恢复已保存的内容;结束后重新打开可查看完整记录。":null),Ae||Ee.current.has(re)?B.run="running":Ae===!1&&(B.run==="running"||B.run==="waiting")&&(B.run="idle"),x(B)}catch(ke){oe.current===re&&qe(ke)}finally{st.current===Be&&(st.current=null)}},[qe]);w.useEffect(()=>{Ve.current=!0;const re=new UN(qN());c.current=re;const je=re.onAuthLost(l),Be=re.onStateChange(Ae=>{o(Ae),Ae==="open"?(Z(null),K(""),Fe().then(()=>{const ye=oe.current;Ve.current&&c.current===re&&(g.current.some(B=>B.sessionId===ye)||Re.current.has(ye)||Ee.current.has(ye)||be.current.has(ye))&&Dt(ye)}),ct(),nt()):Ae==="closed"&&(i&&a(),x(ye=>({...ye,run:"idle"})))}),ke=re.onNotification((Ae,ye)=>{if(Ae==="serve/sessionsChanged"){Fe(),O(B=>B+1);return}if(Ae==="agent/runAccepted"&&typeof ye.sessionId=="string"){const B=F.current.get(ye.sessionId);B&&(B.accepted=!0);return}if(Ae==="serve/configurationChanged"){ct(),pe(B=>B+1);return}if(Ae==="agent/streamEvent"){const B=ye,{sessionId:Ne,event:dt}=B,en=F.current.get(Ne);if(en&&["stream_request_start","text_delta","thinking_delta","tool_use_start"].includes(String(dt.type))&&(en.accepted=!0),Ne===oe.current){if(st.current?.sessionId===Ne&&st.current.events.push(B),!wv(B,we.current))return;B.hubEpoch&&B.hubSequence!==void 0&&(we.current={epoch:B.hubEpoch,sequence:B.hubSequence}),x(Zn=>Js(Zn,dt))}dt.type==="stream_request_start"&&Z(null),dt.type==="turn_complete"&&Fe();return}if(Ae==="serve/sessionStatus"){O(dt=>dt+1);const{sessionId:B,running:Ne}=ye;if(typeof B!="string"||typeof Ne!="boolean")return;st.current?.sessionId===B&&(st.current.running=Ne),Ne?Re.current.add(B):Re.current.delete(B),!Ne&&be.current.has(B)&&nt(),B===oe.current&&x(dt=>Ne?{...dt,run:"running"}:dt.run==="running"||dt.run==="waiting"?{...dt,run:"idle"}:dt),Fe();return}if(Ae==="agent/approvalRequest"||Ae==="agent/approvalResolved"||Ae==="serve/approvalSnapshot"||Ae==="serve/approvalLease"){_({method:Ae,params:ye});return}if(Ae==="serve/workerExit"){Re.current.clear();const B=ye.clean;Z(B?"服务进程已退出,发送消息会自动重启":"服务进程异常退出,发送消息会自动重启"),x(Ne=>({...Ne,run:"idle"}))}});return re.connect(),()=>{Ve.current=!1,at.current?.abort(),Be(),ke(),je(),re.close(),c.current=null}},[Fe,Dt,ct,nt,l,a,i]);const rt=Object.values(k).some(re=>re.lease?.holderId&&(re.lease.expiresAt??0)>he);w.useEffect(()=>{if(!rt)return;ge(Date.now());const re=setInterval(()=>ge(Date.now()),1e3);return()=>clearInterval(re)},[rt]);const wt=async re=>{oe.current=re,we.current=null,y(re),pt(re),x(Xs()),K(""),W(null),!(!p.some(je=>je.sessionId===re)&&!Re.current.has(re)&&T.current.unsent().some(je=>je.sessionId===re))&&await Dt(re)},M=()=>{const re=Wy();oe.current=re,we.current=null,st.current=null,y(re),pt(re),x(Xs()),K(""),W(null)},$=()=>{const re=T.current.get(oe.current),je=re.text.trim(),Be=c.current;if(!je&&!re.files.length||!Be||f!=="open"||U)return!1;const ke=oe.current;if(Ee.current.has(ke)||Re.current.has(ke)||v.run==="running"||v.run==="waiting"||Object.values(k).some(B=>B.payload.sessionId===ke)||be.current.has(ke))return!1;oe.current=ke,y(ke),Ee.current.add(ke);const Ae={clientMessageId:va(),draft:T.current.take(ke),accepted:!1};F.current.set(ke,Ae);const ye=Ae.draft.draft.files;return pt(ke),K(""),x(B=>({...iS(B,je,ye.map(Ne=>({name:Ne.name,mime:Ne.mimeType,size:Ne.size})),Ae.clientMessageId),run:"running"})),Be.run({sessionId:ke,task:je,clientMessageId:Ae.clientMessageId,displayText:je,...ye.length?{uploadIds:ye.map(B=>B.id)}:{}}).catch(B=>{Ve.current&&(qe(B),B instanceof Fi&&(B.kind==="transport"||B.kind==="timeout")?(be.current.set(ke,Ae),K("连接中断,重新连接后会核对这条消息是否已经送达。")):Ae.accepted||Nt(Ae,B instanceof Error?B.message==="upload not found or expired"?"附件已失效,请移除后重新上传。":B.message:void 0),oe.current===ke&&x(Ne=>({...Ne,run:"error"})))}).finally(()=>{Ee.current.delete(ke),F.current.get(ke)===Ae&&F.current.delete(ke),Ve.current&&oe.current===ke&&!Re.current.has(ke)&&x(B=>B.run==="running"?{...B,run:"idle"}:B)}),!0},me=(re,je,Be)=>{const ke=c.current;!ke||f!=="open"||Qe.current.has(re.requestId)||(Qe.current.add(re.requestId),R(Ae=>({...Ae,[re.requestId]:!0})),K(""),ke.approve({...re,sessionId:re.sessionId??oe.current??""},je,Be).then(()=>_({method:"agent/approvalResolved",params:{requestId:re.requestId}})).catch(qe).finally(()=>{Qe.current.delete(re.requestId),R(Ae=>{const ye={...Ae};return delete ye[re.requestId],ye})}))},ve=()=>{b&&c.current?.cancel(b).catch(qe)},Ce=async re=>{if(!re?.length||at.current)return;const je=new AbortController,Be=$s();at.current=je,E(oe.current),K("");const ke=oe.current;try{for(const Ae of Array.from(re)){if(!Ve.current||je.signal.aborted)break;const ye=await G0(Ae,{signal:je.signal,scope:Be});Ve.current&&!je.signal.aborted&&(T.current.addFile(ke,ye),pt(ke))}}catch(Ae){qe(Ae)}finally{at.current===je&&(at.current=null),Ve.current&&E(null)}},_e=Object.values(k).filter(re=>!re.payload.sessionId||re.payload.sessionId===b),Ke=re=>Object.values(k).filter(je=>je.payload.sessionId===re).length,bt=v.run==="running"||v.run==="waiting"||_e.length>0,ft=w.useMemo(()=>T.current.unsent().filter(re=>!p.some(je=>je.sessionId===re.sessionId)),[V,p]),$e=J?.workspace.path??p.find(re=>re.sessionId===b)?.cwd??p[0]?.cwd??null,Ze=$e?.split(/[\\/]/).filter(Boolean).pop()??"服务端工作区",Q=v.items.length===0&&_e.length===0,xe=p.find(re=>re.sessionId===b),ze=Q?"新对话":xe?.customTitle||v.title||xe?.title||xe?.preview?.trim()||jv(v,b??"新对话");return{host:i?"hub":"legacy",workspaceApi:i,connection:f,session:t,activeId:b,chat:v,sessions:p,workspaceCwd:$e,workspaceName:Ze,title:ze,workspaceKey:$e??"hub",configuration:J,configurationVersion:ae,sessionsVersion:j,draft:z,files:G,uploading:U,uploadBusy:q!==null,hasUnsent:T.current.unsent().length>0,localDrafts:ft,uncertain:be.current.has(b),running:bt,approvals:Object.values(k).map(re=>({id:re.payload.requestId,sessionId:re.payload.sessionId})),approvalCount:Ke,approvalContent:_e.map(re=>u.jsx(VN,{payload:re.payload,onDecide:me,busy:!!D[re.payload.requestId]||!!(re.lease?.holderId&&(re.lease.expiresAt??0)>he),connected:f==="open"},re.payload.requestId)),workerNote:H,replayNote:ee,error:N,clearError:()=>K(""),setDraft:re=>{T.current.setText(oe.current,re),pt(oe.current)},removeFile:re=>{T.current.removeFile(oe.current,re),pt(oe.current)},selectSession:wt,newSession:M,send:$,stop:ve,addFiles:Ce,refreshSessions:Fe,refreshConfiguration:ct,onAuthLost:l}}function eb({onBackToProjects:t,projectName:i,...l}){return u.jsx(MN,{controller:FN(l),onBackToProjects:t,projectName:i})}function kv(t){if(!t||typeof t!="object")return!1;const i=t;return pa(i.id)&&typeof i.name=="string"&&i.name.length>0&&["stopped","starting","running","stopping","error"].includes(i.status)&&Number.isSafeInteger(i.generation)&&i.generation>=0&&Number.isSafeInteger(i.createdAt)&&i.createdAt>=0&&(i.error===void 0||typeof i.error=="string")}function QN(t){const i=t;if(!i||i.runtime!=="docker"||typeof i.available!="boolean"||!Array.isArray(i.projects)||!i.projects.every(kv)||new Set(i.projects.map(l=>l.id)).size!==i.projects.length||i.error!==void 0&&typeof i.error!="string")throw new Error("服务端返回了无效的项目列表,请重试。");return i}function tb(){return new URL(window.location.href).searchParams.get("project")}function ca(t,i=!1){const l=new URL(window.location.href);t?l.searchParams.set("project",t):l.searchParams.delete("project"),i||l.searchParams.delete("session"),window.history.replaceState(window.history.state,"",l)}const XN={stopped:"已停止",starting:"正在启动",running:"运行中",stopping:"正在停止",error:"启动失败"};function KN({children:t,onAuthLost:i}){const[l,a]=w.useState(null),[c,f]=w.useState(!1),[o,p]=w.useState(null),[h,g]=w.useState(""),[b,y]=w.useState(!0),[v,x]=w.useState(null),[k,_]=w.useState(""),[D,R]=w.useState(null),z=w.useRef(null),L=w.useRef(tb()),G=w.useRef(o),se=w.useRef(l),T=w.useRef(0),V=w.useRef(0),X=w.useRef(null),q=w.useRef(i),E=w.useRef(!1);q.current=i,G.current=o,se.current=l;const U=w.useCallback(N=>{if(N.status!=="running")return;const K=tb()===N.id;Ls(),Os(N.id),ca(N.id,K),L.current=null,G.current=N,p(N),g("")},[]),H=w.useCallback(()=>{L.current=null,G.current=null,p(null),Os(null),Ls(),ca(null)},[]),Z=w.useCallback(async N=>{if(E.current)return;const K=++V.current,he=T.current;try{const ge=QN(await Ue("/api/v1/projects",{signal:N}));if(N?.aborted||K!==V.current||he!==T.current)return;a(ge),se.current=ge,y(!1),g("");const j=G.current;if(j){const J=ge.projects.find(A=>A.id===j.id);(!J||J.status!=="running"||J.generation!==j.generation)&&(H(),g("项目运行状态已经变化,请重新打开项目。未发送的内容不会带入其他项目。"));return}if(!L.current)return;const O=ge.projects.find(J=>J.id===L.current);O?O.status==="running"&&ge.available&&U(O):(L.current=null,ca(null),g("链接中的项目不存在或当前账号无权访问,请选择一个项目。"))}catch(ge){if(N?.aborted||K!==V.current||he!==T.current)return;y(!1),ge instanceof Xe&&ge.status===404&&!se.current?(Os(null),Ls(),E.current=!0,f(!0)):ge instanceof Xe&&ge.status===401?q.current():g(ge instanceof Error?ge.message:"无法读取项目,请重试。")}},[H,U]);w.useEffect(()=>{T.current++;const N=new AbortController;Z(N.signal);const K=()=>{Z(N.signal)},he=()=>{document.visibilityState==="visible"&&K()};return window.addEventListener("focus",K),document.addEventListener("visibilitychange",he),()=>{T.current++,N.abort(),X.current?.abort(),window.removeEventListener("focus",K),document.removeEventListener("visibilitychange",he),Os(null),Ls()}},[Z]);const ee=l?.projects.some(N=>N.status==="starting"||N.status==="stopping");w.useEffect(()=>{if(c||!l)return;const N=new AbortController,K=setInterval(()=>{Z(N.signal)},ee?2e3:1e4);return()=>{clearInterval(K),N.abort()}},[c,!!l,ee,Z]),w.useEffect(()=>{if(!D)return;const N=document.activeElement,K=z.current;return K?.showModal?.(),()=>{K?.close?.(),N?.focus()}},[D]);const W=async(N,K)=>{if(X.current||N==="create"&&!k.trim())return;const he=new AbortController;X.current=he,x(K?.id??"create"),g(""),V.current++;try{const ge=await Ue(N==="create"?"/api/v1/projects":`/api/v1/projects/${K.id}/${N}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N==="create"?{name:k.trim()}:{}),signal:he.signal});if(he.signal.aborted)return;if(!kv(ge.project)||K&&K.id!==ge.project.id)throw new Error("服务端返回了无效的项目状态,请刷新列表。");const j=ge.project;a(O=>O&&{...O,projects:O.projects.some(J=>J.id===j.id)?O.projects.map(J=>J.id===j.id?j:J):[...O.projects,j]}),N==="create"&&_(""),N==="start"&&(L.current=j.id,ca(j.id),j.status==="running"&&U(j)),N==="stop"&&(L.current===j.id&&(L.current=null,ca(null)),R(null)),await Z(he.signal)}catch(ge){if(he.signal.aborted)return;ge instanceof Xe&&ge.status===401?q.current():g(ge instanceof Error?ge.message:"项目操作失败,请重试。")}finally{X.current===he&&(X.current=null),he.signal.aborted||x(null)}};return c?u.jsx(w.Fragment,{children:t(null)},"single-project"):o?u.jsxs(w.Fragment,{children:[h?u.jsxs("div",{className:"project-connection-note",role:"status",children:["项目状态暂时无法刷新,当前工作台会保留。",h]}):null,t(o,H)]},`${o.id}:${o.generation}`):u.jsxs("main",{className:"projects-page",children:[u.jsxs("header",{className:"projects-header",children:[u.jsxs("div",{className:"auth-brand",children:["CodeShell ",u.jsx("span",{children:"Hub"})]}),u.jsx(Xf,{}),u.jsx("h1",{children:"你的项目"}),u.jsx("p",{children:"每个项目有独立的运行环境、文件、会话和配置。启动后进入同一个工作台。"})]}),b?u.jsx("p",{role:"status",children:"正在读取项目…"}):null,h?u.jsxs("div",{className:"form-error",role:"alert",children:[h,u.jsx("button",{className:"library-button",onClick:()=>{Z()},children:"刷新项目"})]}):null,l?u.jsxs(u.Fragment,{children:[l.available?null:u.jsxs("p",{className:"form-error",role:"alert",children:["项目运行环境暂不可用。",l.error||"请检查服务端 Docker 是否已启动。"]}),u.jsxs("form",{className:"project-create",onSubmit:N=>{N.preventDefault(),W("create")},children:[u.jsxs("label",{children:["新项目名称",u.jsx("input",{value:k,maxLength:80,required:!0,placeholder:"例如:个人网站",onChange:N=>_(N.target.value)})]}),u.jsx("button",{className:"library-button primary",disabled:!!v||!k.trim(),type:"submit",children:v==="create"?"正在创建…":"创建项目"})]}),u.jsxs("section",{className:"projects-grid","aria-label":"项目列表",children:[l.projects.length===0?u.jsx("p",{className:"project-empty",children:"创建第一个项目,开始配置模型、添加技能和使用面板。"}):null,l.projects.map(N=>u.jsxs("article",{className:"project-card",children:[u.jsxs("div",{className:"project-card-heading",children:[u.jsx("h2",{children:N.name}),u.jsx("span",{className:`project-status ${N.status}`,children:XN[N.status]})]}),u.jsxs("p",{className:"project-date",children:["创建于 ",new Date(N.createdAt).toLocaleDateString()]}),N.error?u.jsx("p",{className:"form-error",role:"alert",children:N.error}):null,u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",disabled:!!v||!l.available||N.status==="starting"||N.status==="stopping",onClick:()=>N.status==="running"?U(N):void W("start",N),children:v===N.id||N.status==="starting"||N.status==="stopping"?"正在处理…":N.status==="running"?"打开项目":"启动并打开"}),N.status==="running"?u.jsx("button",{className:"library-button",disabled:!!v,onClick:()=>R(N),children:"停止项目"}):null]})]},N.id))]})]}):null,D?u.jsxs("dialog",{className:"project-stop-confirm",ref:z,role:"alertdialog","aria-modal":"true","aria-labelledby":"project-stop-title",onCancel:N=>{N.preventDefault(),v||R(null)},children:[u.jsxs("h2",{id:"project-stop-title",children:["停止 ",D.name,"?"]}),u.jsx("p",{children:"正在运行的任务和面板进程会中断。项目文件和配置保留,可稍后重新启动。"}),u.jsxs("div",{className:"library-actions",children:[u.jsx("button",{className:"library-button primary",disabled:!!v,onClick:()=>R(null),children:"继续运行"}),u.jsx("button",{className:"library-button",disabled:!!v,onClick:()=>{W("stop",D)},children:"确认停止"})]})]}):null]})}function $N({setupToken:t}){const[i,l]=w.useState("checking"),[a,c]=w.useState(),[f,o]=w.useState(""),[p,h]=w.useState(""),[g,b]=w.useState(""),[y,v]=w.useState(t),[x,k]=w.useState(""),[_,D]=w.useState(!1),R=w.useRef(!1),z=w.useRef(0),L=w.useRef(i);L.current=i;const G=w.useCallback(X=>{R.current&&(c(X?.session),l(X===null?"legacy":X.initialized?X.authenticated?"authenticated":"login":"setup"),k(""),X?.initialized&&v(""))},[]),se=w.useCallback(async()=>{const X=++z.current;try{const q=await V0();X===z.current&&G(q)}catch(q){if(!R.current||X!==z.current||L.current==="authenticated"||L.current==="legacy")return;l("error"),k(q instanceof Error?q.message:"无法连接服务端")}},[G]);w.useEffect(()=>{R.current=!0,se();const X=()=>{se()},q=()=>{document.visibilityState==="visible"&&se()};return window.addEventListener("focus",X),document.addEventListener("visibilitychange",q),()=>{R.current=!1,window.removeEventListener("focus",X),document.removeEventListener("visibilitychange",q)}},[se]);const T=w.useCallback(()=>{z.current++,c(void 0),l("login"),h(""),k("登录已过期或此设备已被撤销,请重新登录。")},[]),V=async X=>{if(X.preventDefault(),!_){z.current++,D(!0),k("");try{const q=await lb(`/api/v1/auth/${i==="setup"?"setup":"login"}`,{username:f.trim(),password:p,deviceName:g.trim()||void 0,...i==="setup"?{token:y.trim()}:{}});if(!q.authenticated)throw new Error("登录失败,请重试。");z.current++,h(""),v(""),G({initialized:!0,authenticated:!0,session:q.session})}catch(q){k(q instanceof Error?q.message:"登录失败,请重试。"),q instanceof Xe&&q.status===409&&se()}finally{D(!1)}}};return i==="authenticated"?u.jsx(KN,{onAuthLost:T,children:(X,q)=>u.jsx(eb,{session:a,hub:!0,onAuthLost:T,onCheckAuth:se,projectName:X?.name,onBackToProjects:q})}):i==="legacy"?u.jsx(eb,{session:a,hub:!1,onAuthLost:T,onCheckAuth:se}):u.jsx("main",{className:"auth-page",children:u.jsxs("section",{className:"auth-card",children:[u.jsx(Xf,{discover:!1}),u.jsxs("div",{className:"auth-brand",children:["CodeShell ",u.jsx("span",{children:"Hub"})]}),i==="checking"?u.jsx("p",{role:"status",children:"正在连接你的工作空间…"}):null,i==="error"?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"form-error",role:"alert",children:x}),u.jsx("button",{className:"send",onClick:()=>{se()},children:"重试连接"})]}):null,i==="setup"||i==="login"?u.jsxs("form",{onSubmit:X=>{V(X)},children:[u.jsx("h1",{children:i==="setup"?"创建管理员账号":"登录工作空间"}),u.jsx("p",{children:i==="setup"?"首次启动需要服务端提供的初始化令牌。创建后,可在其他设备使用此账号登录。":"连接服务端,继续你的会话与任务。"}),i==="setup"?u.jsxs("label",{children:["初始化令牌",u.jsx("input",{type:"password",autoComplete:"off",required:!0,value:y,onChange:X=>v(X.target.value)})]}):null,u.jsxs("label",{children:["用户名",u.jsx("input",{autoComplete:"username",required:!0,maxLength:64,value:f,onChange:X=>o(X.target.value)})]}),u.jsxs("label",{children:["密码",u.jsx("input",{type:"password",autoComplete:i==="setup"?"new-password":"current-password",required:!0,maxLength:256,minLength:i==="setup"?12:void 0,value:p,onChange:X=>h(X.target.value)})]}),i==="setup"?u.jsx("small",{children:"密码至少 12 个字符。"}):null,u.jsxs("label",{children:["设备名称 ",u.jsx("span",{children:"(可选)"}),u.jsx("input",{autoComplete:"off",maxLength:100,placeholder:"例如:我的笔记本",value:g,onChange:X=>b(X.target.value)})]}),x?u.jsx("p",{className:"form-error",role:"alert",children:x}):null,u.jsx("button",{className:"send",type:"submit",disabled:_,children:_?"正在连接…":i==="setup"?"创建并进入":"登录"})]}):null]})})}function ZN(t="/"){"serviceWorker"in navigator&&window.isSecureContext&&navigator.serviceWorker.register(`${t}sw.js`).catch(()=>{})}const nb=t1(),PN=Y0(window.location,window.history);o1.createRoot(document.getElementById("root")).render(u.jsx(w.StrictMode,{children:nb?u.jsx(n1,{callback:nb}):u.jsx($N,{setupToken:PN})}));ZN("/");
|