@locode2/harness 0.1.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +27 -0
  2. package/THIRD_PARTY_LICENSES.txt +32769 -0
  3. package/THIRD_PARTY_NOTICES.md +13 -0
  4. package/apps/host/dist/document-parser-worker.js +215 -0
  5. package/apps/host/dist/frontend-runtime-worker.js +1755 -0
  6. package/apps/host/dist/index.js +23380 -0
  7. package/apps/web/dist/assets/LocalMonacoEditor-CXkKwxiP.css +1 -0
  8. package/apps/web/dist/assets/LocalMonacoEditor-WKAHQmzG.js +940 -0
  9. package/apps/web/dist/assets/LogsView-BFFFSFB-.js +1 -0
  10. package/apps/web/dist/assets/PluginsView-DM_ZnENS.js +1 -0
  11. package/apps/web/dist/assets/SettingsView-Cb5Q4ile.js +1 -0
  12. package/apps/web/dist/assets/abap-DLDM7-KI.js +1 -0
  13. package/apps/web/dist/assets/apex-DNDY2TF8.js +1 -0
  14. package/apps/web/dist/assets/azcli-Y6nb8tq_.js +1 -0
  15. package/apps/web/dist/assets/bat-BwHxbl9M.js +1 -0
  16. package/apps/web/dist/assets/bicep-CFznDFnq.js +2 -0
  17. package/apps/web/dist/assets/cameligo-Bf6VGUru.js +1 -0
  18. package/apps/web/dist/assets/clojure-Dnu-v4kV.js +1 -0
  19. package/apps/web/dist/assets/codicon-Brq4_Ui5.ttf +0 -0
  20. package/apps/web/dist/assets/coffee-Bd8akH9Z.js +1 -0
  21. package/apps/web/dist/assets/cpp-BbWJElDN.js +1 -0
  22. package/apps/web/dist/assets/csharp-Co3qMtFm.js +1 -0
  23. package/apps/web/dist/assets/csp-D-4FJmMZ.js +1 -0
  24. package/apps/web/dist/assets/css-DdJfP1eB.js +3 -0
  25. package/apps/web/dist/assets/css.worker-11mhRRLC.js +97 -0
  26. package/apps/web/dist/assets/cssMode-L5f5LAEn.js +1 -0
  27. package/apps/web/dist/assets/cypher-cTPe9QuQ.js +1 -0
  28. package/apps/web/dist/assets/dart-BOtBlQCF.js +1 -0
  29. package/apps/web/dist/assets/dockerfile-BG73LgW2.js +1 -0
  30. package/apps/web/dist/assets/ecl-BEgZUVRK.js +1 -0
  31. package/apps/web/dist/assets/editor.worker-DysRFSaV.js +30 -0
  32. package/apps/web/dist/assets/elixir-BkW5O-1t.js +1 -0
  33. package/apps/web/dist/assets/flow9-BeJ5waoc.js +1 -0
  34. package/apps/web/dist/assets/freemarker2-UOwftS75.js +3 -0
  35. package/apps/web/dist/assets/fsharp-PahG7c26.js +1 -0
  36. package/apps/web/dist/assets/go-acbASCJo.js +1 -0
  37. package/apps/web/dist/assets/graphql-BxJiqAUM.js +1 -0
  38. package/apps/web/dist/assets/handlebars-C_E41ffr.js +1 -0
  39. package/apps/web/dist/assets/hcl-DtV1sZF8.js +1 -0
  40. package/apps/web/dist/assets/html-HsrixH2x.js +1 -0
  41. package/apps/web/dist/assets/html.worker-C8Tw8ncf.js +474 -0
  42. package/apps/web/dist/assets/htmlMode-DipGmEOi.js +1 -0
  43. package/apps/web/dist/assets/index-COUF63cT.js +213 -0
  44. package/apps/web/dist/assets/index-SNSmF2-c.css +1 -0
  45. package/apps/web/dist/assets/ini-Kd9XrMLS.js +1 -0
  46. package/apps/web/dist/assets/java-CXBNlu9o.js +1 -0
  47. package/apps/web/dist/assets/javascript-D36WEqF9.js +1 -0
  48. package/apps/web/dist/assets/json.worker-BzkYZgJ7.js +62 -0
  49. package/apps/web/dist/assets/jsonMode-D9BrIats.js +7 -0
  50. package/apps/web/dist/assets/julia-cl7-CwDS.js +1 -0
  51. package/apps/web/dist/assets/kotlin-s7OhZKlX.js +1 -0
  52. package/apps/web/dist/assets/less-9HpZscsL.js +2 -0
  53. package/apps/web/dist/assets/lexon-OrD6JF1K.js +1 -0
  54. package/apps/web/dist/assets/liquid-DES89Tjc.js +1 -0
  55. package/apps/web/dist/assets/lock-keyhole-jo-FJcGq.js +1 -0
  56. package/apps/web/dist/assets/lspLanguageFeatures-YKkgcn4q.js +4 -0
  57. package/apps/web/dist/assets/lua-Cyyb5UIc.js +1 -0
  58. package/apps/web/dist/assets/m3-B8OfTtLu.js +1 -0
  59. package/apps/web/dist/assets/markdown-BFxVWTOG.js +1 -0
  60. package/apps/web/dist/assets/mdx-D1Bfax8e.js +1 -0
  61. package/apps/web/dist/assets/mips-CiqrrVzr.js +1 -0
  62. package/apps/web/dist/assets/msdax-DmeGPVcC.js +1 -0
  63. package/apps/web/dist/assets/mysql-C_tMU-Nz.js +1 -0
  64. package/apps/web/dist/assets/objective-c-BDtDVThU.js +1 -0
  65. package/apps/web/dist/assets/pascal-vHIfCaH5.js +1 -0
  66. package/apps/web/dist/assets/pascaligo-DtZ0uQbO.js +1 -0
  67. package/apps/web/dist/assets/perl-Ub6l9XKa.js +1 -0
  68. package/apps/web/dist/assets/pgsql-BlNEE0v7.js +1 -0
  69. package/apps/web/dist/assets/php-BBUBE1dy.js +1 -0
  70. package/apps/web/dist/assets/pla-DSh2-awV.js +1 -0
  71. package/apps/web/dist/assets/postiats-CocnycG-.js +1 -0
  72. package/apps/web/dist/assets/powerquery-tScXyioY.js +1 -0
  73. package/apps/web/dist/assets/powershell-COWaemsV.js +1 -0
  74. package/apps/web/dist/assets/protobuf-Brw8urJB.js +2 -0
  75. package/apps/web/dist/assets/pug-8SOpv6rk.js +1 -0
  76. package/apps/web/dist/assets/python-DKhPhY0N.js +1 -0
  77. package/apps/web/dist/assets/qsharp-Bw9ernYp.js +1 -0
  78. package/apps/web/dist/assets/r-j7ic8hl3.js +1 -0
  79. package/apps/web/dist/assets/razor-Cha8qrI6.js +1 -0
  80. package/apps/web/dist/assets/redis-Bu5POkcn.js +1 -0
  81. package/apps/web/dist/assets/redshift-Bs9aos_-.js +1 -0
  82. package/apps/web/dist/assets/restructuredtext-CqXO7rUv.js +1 -0
  83. package/apps/web/dist/assets/ruby-zBfavPgS.js +1 -0
  84. package/apps/web/dist/assets/rust-BzKRNQWT.js +1 -0
  85. package/apps/web/dist/assets/sb-BBc9UKZt.js +1 -0
  86. package/apps/web/dist/assets/scala-D9hQfWCl.js +1 -0
  87. package/apps/web/dist/assets/scheme-BPhDTwHR.js +1 -0
  88. package/apps/web/dist/assets/scss-CBJaRo0y.js +3 -0
  89. package/apps/web/dist/assets/shell-DiJ1NA_G.js +1 -0
  90. package/apps/web/dist/assets/solidity-Db0IVjzk.js +1 -0
  91. package/apps/web/dist/assets/sophia-CnS9iZB_.js +1 -0
  92. package/apps/web/dist/assets/sparql-CJmd_6j2.js +1 -0
  93. package/apps/web/dist/assets/sql-ClhHkBeG.js +1 -0
  94. package/apps/web/dist/assets/st-CHwy0fLd.js +1 -0
  95. package/apps/web/dist/assets/swift-CnmFD0ga.js +1 -0
  96. package/apps/web/dist/assets/systemverilog-Bs9z6M-B.js +1 -0
  97. package/apps/web/dist/assets/tcl-Dm6ycUr_.js +1 -0
  98. package/apps/web/dist/assets/ts.worker-Bupg6llt.js +67722 -0
  99. package/apps/web/dist/assets/tsMode-CEhssXv8.js +11 -0
  100. package/apps/web/dist/assets/twig-Csy3S7wG.js +1 -0
  101. package/apps/web/dist/assets/typescript-DWqmw58R.js +1 -0
  102. package/apps/web/dist/assets/typespec-Btyra-wh.js +1 -0
  103. package/apps/web/dist/assets/vb-Db0cS2oM.js +1 -0
  104. package/apps/web/dist/assets/wgsl-DumH7NcR.js +298 -0
  105. package/apps/web/dist/assets/workers-BmZvNFRq.js +1 -0
  106. package/apps/web/dist/assets/xml-WQTAFV9b.js +1 -0
  107. package/apps/web/dist/assets/yaml-Ke2Lf79d.js +1 -0
  108. package/apps/web/dist/index.html +15 -0
  109. package/bin/launch.mjs +71 -0
  110. package/bin/locode-mini.mjs +12 -0
  111. package/bin/options.mjs +49 -0
  112. package/bin/restore-assets.mjs +40 -0
  113. package/bundled-plugins/fast-frontend/.gitignore +2 -0
  114. package/bundled-plugins/fast-frontend/README.md +29 -0
  115. package/bundled-plugins/fast-frontend/harness.plugin.json +123 -0
  116. package/bundled-plugins/fast-frontend/runtimes/antd-admin/PUBLIC_CONTRACT.md +139 -0
  117. package/bundled-plugins/fast-frontend/runtimes/antd-admin/contracts/app.schema.json +24 -0
  118. package/bundled-plugins/fast-frontend/runtimes/antd-admin/contracts/route.schema.json +52 -0
  119. package/bundled-plugins/fast-frontend/runtimes/antd-admin/examples/app.json +9 -0
  120. package/bundled-plugins/fast-frontend/runtimes/antd-admin/examples/route.json +8 -0
  121. package/bundled-plugins/fast-frontend/runtimes/antd-admin/index.html +17 -0
  122. package/bundled-plugins/fast-frontend/runtimes/antd-admin/package.json +31 -0
  123. package/bundled-plugins/fast-frontend/runtimes/antd-admin/scripts/smoke-build.mjs +40 -0
  124. package/bundled-plugins/fast-frontend/runtimes/antd-admin/src/inspector/index.ts +612 -0
  125. package/bundled-plugins/fast-frontend/runtimes/antd-admin/src/main.tsx +17 -0
  126. package/bundled-plugins/fast-frontend/runtimes/antd-admin/src/sdk/index.ts +1028 -0
  127. package/bundled-plugins/fast-frontend/runtimes/antd-admin/src/shell/RuntimeApp.tsx +380 -0
  128. package/bundled-plugins/fast-frontend/runtimes/antd-admin/src/shell/runtime.css +246 -0
  129. package/bundled-plugins/fast-frontend/runtimes/antd-admin/tsconfig.json +20 -0
  130. package/bundled-plugins/fast-frontend/runtimes/antd-admin/types/runtime.consumer-smoke.ts +70 -0
  131. package/bundled-plugins/fast-frontend/runtimes/antd-admin/types/runtime.d.ts +227 -0
  132. package/bundled-plugins/fast-frontend/templates/antd-admin/.gitignore +9 -0
  133. package/bundled-plugins/fast-frontend/templates/antd-admin/.harness/template.json +10 -0
  134. package/bundled-plugins/fast-frontend/templates/antd-admin/index.html +13 -0
  135. package/bundled-plugins/fast-frontend/templates/antd-admin/package.json +34 -0
  136. package/bundled-plugins/fast-frontend/templates/antd-admin/pnpm-lock.yaml +1451 -0
  137. package/bundled-plugins/fast-frontend/templates/antd-admin/pnpm-workspace.yaml +4 -0
  138. package/bundled-plugins/fast-frontend/templates/antd-admin/public/generated/.gitkeep +1 -0
  139. package/bundled-plugins/fast-frontend/templates/antd-admin/scripts/validate-routes.mjs +153 -0
  140. package/bundled-plugins/fast-frontend/templates/antd-admin/src/app/App.tsx +27 -0
  141. package/bundled-plugins/fast-frontend/templates/antd-admin/src/app/NotFoundPage.tsx +15 -0
  142. package/bundled-plugins/fast-frontend/templates/antd-admin/src/features/.gitkeep +1 -0
  143. package/bundled-plugins/fast-frontend/templates/antd-admin/src/layouts/MainLayout.tsx +77 -0
  144. package/bundled-plugins/fast-frontend/templates/antd-admin/src/main.tsx +14 -0
  145. package/bundled-plugins/fast-frontend/templates/antd-admin/src/mocks/dashboard.ts +48 -0
  146. package/bundled-plugins/fast-frontend/templates/antd-admin/src/pages/dashboard/page.tsx +151 -0
  147. package/bundled-plugins/fast-frontend/templates/antd-admin/src/pages/dashboard/route.ts +9 -0
  148. package/bundled-plugins/fast-frontend/templates/antd-admin/src/routes/definition.ts +21 -0
  149. package/bundled-plugins/fast-frontend/templates/antd-admin/src/routes/menu.tsx +44 -0
  150. package/bundled-plugins/fast-frontend/templates/antd-admin/src/routes/registry.ts +48 -0
  151. package/bundled-plugins/fast-frontend/templates/antd-admin/src/routes/router.tsx +34 -0
  152. package/bundled-plugins/fast-frontend/templates/antd-admin/src/shared/components/business/.gitkeep +1 -0
  153. package/bundled-plugins/fast-frontend/templates/antd-admin/src/shared/components/business/BusinessProviders.tsx +9 -0
  154. package/bundled-plugins/fast-frontend/templates/antd-admin/src/styles/global.css +180 -0
  155. package/bundled-plugins/fast-frontend/templates/antd-admin/src/vite-env.d.ts +1 -0
  156. package/bundled-plugins/fast-frontend/templates/antd-admin/tsconfig.app.json +24 -0
  157. package/bundled-plugins/fast-frontend/templates/antd-admin/tsconfig.json +7 -0
  158. package/bundled-plugins/fast-frontend/templates/antd-admin/tsconfig.node.json +17 -0
  159. package/bundled-plugins/fast-frontend/templates/antd-admin/vite.config.ts +39 -0
  160. package/npm-shrinkwrap.json +9737 -0
  161. package/package.json +80 -0
  162. package/release-integrity.json +168 -0
@@ -0,0 +1,213 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LocalMonacoEditor-WKAHQmzG.js","assets/LocalMonacoEditor-CXkKwxiP.css","assets/PluginsView-DM_ZnENS.js","assets/lock-keyhole-jo-FJcGq.js","assets/SettingsView-Cb5Q4ile.js"])))=>i.map(i=>d[i]);
2
+ function lM(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function vv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fm={exports:{}},ec={};var lw;function cM(){if(lw)return ec;lw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var l=null;if(s!==void 0&&(l=""+s),o.key!==void 0&&(l=""+o.key),"key"in o){s={};for(var u in o)u!=="key"&&(s[u]=o[u])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:l,ref:o!==void 0?o:null,props:s}}return ec.Fragment=t,ec.jsx=n,ec.jsxs=n,ec}var cw;function uM(){return cw||(cw=1,fm.exports=cM()),fm.exports}var h=uM(),pm={exports:{}},Ye={};var uw;function dM(){if(uw)return Ye;uw=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function y($){return $===null||typeof $!="object"?null:($=x&&$[x]||$["@@iterator"],typeof $=="function"?$:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,T={};function k($,te,A){this.props=$,this.context=te,this.refs=T,this.updater=A||w}k.prototype.isReactComponent={},k.prototype.setState=function($,te){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,te,"setState")},k.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function _(){}_.prototype=k.prototype;function C($,te,A){this.props=$,this.context=te,this.refs=T,this.updater=A||w}var E=C.prototype=new _;E.constructor=C,S(E,k.prototype),E.isPureReactComponent=!0;var O=Array.isArray;function M(){}var R={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function K($,te,A){var L=A.ref;return{$$typeof:e,type:$,key:te,ref:L!==void 0?L:null,props:A}}function q($,te){return K($.type,te,$.props)}function Z($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function Y($){var te={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(A){return te[A]})}var ae=/\/+/g;function J($,te){return typeof $=="object"&&$!==null&&$.key!=null?Y(""+$.key):te.toString(36)}function he($){switch($.status){case"fulfilled":return $.value;case"rejected":throw $.reason;default:switch(typeof $.status=="string"?$.then(M,M):($.status="pending",$.then(function(te){$.status==="pending"&&($.status="fulfilled",$.value=te)},function(te){$.status==="pending"&&($.status="rejected",$.reason=te)})),$.status){case"fulfilled":return $.value;case"rejected":throw $.reason}}throw $}function F($,te,A,L,X){var ue=typeof $;(ue==="undefined"||ue==="boolean")&&($=null);var we=!1;if($===null)we=!0;else switch(ue){case"bigint":case"string":case"number":we=!0;break;case"object":switch($.$$typeof){case e:case t:we=!0;break;case m:return we=$._init,F(we($._payload),te,A,L,X)}}if(we)return X=X($),we=L===""?"."+J($,0):L,O(X)?(A="",we!=null&&(A=we.replace(ae,"$&/")+"/"),F(X,te,A,"",function(B){return B})):X!=null&&(Z(X)&&(X=q(X,A+(X.key==null||$&&$.key===X.key?"":(""+X.key).replace(ae,"$&/")+"/")+we)),te.push(X)),1;we=0;var ge=L===""?".":L+":";if(O($))for(var Se=0;Se<$.length;Se++)L=$[Se],ue=ge+J(L,Se),we+=F(L,te,A,ue,X);else if(Se=y($),typeof Se=="function")for($=Se.call($),Se=0;!(L=$.next()).done;)L=L.value,ue=ge+J(L,Se++),we+=F(L,te,A,ue,X);else if(ue==="object"){if(typeof $.then=="function")return F(he($),te,A,L,X);throw te=String($),Error("Objects are not valid as a React child (found: "+(te==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":te)+"). If you meant to render a collection of children, use an array instead.")}return we}function ee($,te,A){if($==null)return $;var L=[],X=0;return F($,L,"","",function(ue){return te.call(A,ue,X++)}),L}function Q($){if($._status===-1){var te=$._result;te=te(),te.then(function(A){($._status===0||$._status===-1)&&($._status=1,$._result=A)},function(A){($._status===0||$._status===-1)&&($._status=2,$._result=A)}),$._status===-1&&($._status=0,$._result=te)}if($._status===1)return $._result.default;throw $._result}var xe=typeof reportError=="function"?reportError:function($){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var te=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof $=="object"&&$!==null&&typeof $.message=="string"?String($.message):String($),error:$});if(!window.dispatchEvent(te))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",$);return}console.error($)},P={map:ee,forEach:function($,te,A){ee($,function(){te.apply(this,arguments)},A)},count:function($){var te=0;return ee($,function(){te++}),te},toArray:function($){return ee($,function(te){return te})||[]},only:function($){if(!Z($))throw Error("React.Children.only expected to receive a single React element child.");return $}};return Ye.Activity=g,Ye.Children=P,Ye.Component=k,Ye.Fragment=n,Ye.Profiler=o,Ye.PureComponent=C,Ye.StrictMode=r,Ye.Suspense=f,Ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Ye.__COMPILER_RUNTIME={__proto__:null,c:function($){return R.H.useMemoCache($)}},Ye.cache=function($){return function(){return $.apply(null,arguments)}},Ye.cacheSignal=function(){return null},Ye.cloneElement=function($,te,A){if($==null)throw Error("The argument must be a React element, but you passed "+$+".");var L=S({},$.props),X=$.key;if(te!=null)for(ue in te.key!==void 0&&(X=""+te.key),te)!z.call(te,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&te.ref===void 0||(L[ue]=te[ue]);var ue=arguments.length-2;if(ue===1)L.children=A;else if(1<ue){for(var we=Array(ue),ge=0;ge<ue;ge++)we[ge]=arguments[ge+2];L.children=we}return K($.type,X,L)},Ye.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null},$.Provider=$,$.Consumer={$$typeof:s,_context:$},$},Ye.createElement=function($,te,A){var L,X={},ue=null;if(te!=null)for(L in te.key!==void 0&&(ue=""+te.key),te)z.call(te,L)&&L!=="key"&&L!=="__self"&&L!=="__source"&&(X[L]=te[L]);var we=arguments.length-2;if(we===1)X.children=A;else if(1<we){for(var ge=Array(we),Se=0;Se<we;Se++)ge[Se]=arguments[Se+2];X.children=ge}if($&&$.defaultProps)for(L in we=$.defaultProps,we)X[L]===void 0&&(X[L]=we[L]);return K($,ue,X)},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function($){return{$$typeof:u,render:$}},Ye.isValidElement=Z,Ye.lazy=function($){return{$$typeof:m,_payload:{_status:-1,_result:$},_init:Q}},Ye.memo=function($,te){return{$$typeof:p,type:$,compare:te===void 0?null:te}},Ye.startTransition=function($){var te=R.T,A={};R.T=A;try{var L=$(),X=R.S;X!==null&&X(A,L),typeof L=="object"&&L!==null&&typeof L.then=="function"&&L.then(M,xe)}catch(ue){xe(ue)}finally{te!==null&&A.types!==null&&(te.types=A.types),R.T=te}},Ye.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Ye.use=function($){return R.H.use($)},Ye.useActionState=function($,te,A){return R.H.useActionState($,te,A)},Ye.useCallback=function($,te){return R.H.useCallback($,te)},Ye.useContext=function($){return R.H.useContext($)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function($,te){return R.H.useDeferredValue($,te)},Ye.useEffect=function($,te){return R.H.useEffect($,te)},Ye.useEffectEvent=function($){return R.H.useEffectEvent($)},Ye.useId=function(){return R.H.useId()},Ye.useImperativeHandle=function($,te,A){return R.H.useImperativeHandle($,te,A)},Ye.useInsertionEffect=function($,te){return R.H.useInsertionEffect($,te)},Ye.useLayoutEffect=function($,te){return R.H.useLayoutEffect($,te)},Ye.useMemo=function($,te){return R.H.useMemo($,te)},Ye.useOptimistic=function($,te){return R.H.useOptimistic($,te)},Ye.useReducer=function($,te,A){return R.H.useReducer($,te,A)},Ye.useRef=function($){return R.H.useRef($)},Ye.useState=function($){return R.H.useState($)},Ye.useSyncExternalStore=function($,te,A){return R.H.useSyncExternalStore($,te,A)},Ye.useTransition=function(){return R.H.useTransition()},Ye.version="19.2.8",Ye}var dw;function yv(){return dw||(dw=1,pm.exports=dM()),pm.exports}var I=yv();const Cs=vv(I),Lc=lM({__proto__:null,default:Cs},[I]);var hm={exports:{}},tc={},mm={exports:{}},gm={};var fw;function fM(){return fw||(fw=1,(function(e){function t(F,ee){var Q=F.length;F.push(ee);e:for(;0<Q;){var xe=Q-1>>>1,P=F[xe];if(0<o(P,ee))F[xe]=ee,F[Q]=P,Q=xe;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var ee=F[0],Q=F.pop();if(Q!==ee){F[0]=Q;e:for(var xe=0,P=F.length,$=P>>>1;xe<$;){var te=2*(xe+1)-1,A=F[te],L=te+1,X=F[L];if(0>o(A,Q))L<P&&0>o(X,A)?(F[xe]=X,F[L]=Q,xe=L):(F[xe]=A,F[te]=Q,xe=te);else if(L<P&&0>o(X,Q))F[xe]=X,F[L]=Q,xe=L;else break e}}return ee}function o(F,ee){var Q=F.sortIndex-ee.sortIndex;return Q!==0?Q:F.id-ee.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],p=[],m=1,g=null,x=3,y=!1,w=!1,S=!1,T=!1,k=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function E(F){for(var ee=n(p);ee!==null;){if(ee.callback===null)r(p);else if(ee.startTime<=F)r(p),ee.sortIndex=ee.expirationTime,t(f,ee);else break;ee=n(p)}}function O(F){if(S=!1,E(F),!w)if(n(f)!==null)w=!0,M||(M=!0,Y());else{var ee=n(p);ee!==null&&he(O,ee.startTime-F)}}var M=!1,R=-1,z=5,K=-1;function q(){return T?!0:!(e.unstable_now()-K<z)}function Z(){if(T=!1,M){var F=e.unstable_now();K=F;var ee=!0;try{e:{w=!1,S&&(S=!1,_(R),R=-1),y=!0;var Q=x;try{t:{for(E(F),g=n(f);g!==null&&!(g.expirationTime>F&&q());){var xe=g.callback;if(typeof xe=="function"){g.callback=null,x=g.priorityLevel;var P=xe(g.expirationTime<=F);if(F=e.unstable_now(),typeof P=="function"){g.callback=P,E(F),ee=!0;break t}g===n(f)&&r(f),E(F)}else r(f);g=n(f)}if(g!==null)ee=!0;else{var $=n(p);$!==null&&he(O,$.startTime-F),ee=!1}}break e}finally{g=null,x=Q,y=!1}ee=void 0}}finally{ee?Y():M=!1}}}var Y;if(typeof C=="function")Y=function(){C(Z)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,J=ae.port2;ae.port1.onmessage=Z,Y=function(){J.postMessage(null)}}else Y=function(){k(Z,0)};function he(F,ee){R=k(function(){F(e.unstable_now())},ee)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(F){switch(x){case 1:case 2:case 3:var ee=3;break;default:ee=x}var Q=x;x=ee;try{return F()}finally{x=Q}},e.unstable_requestPaint=function(){T=!0},e.unstable_runWithPriority=function(F,ee){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Q=x;x=F;try{return ee()}finally{x=Q}},e.unstable_scheduleCallback=function(F,ee,Q){var xe=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?xe+Q:xe):Q=xe,F){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=Q+P,F={id:m++,callback:ee,priorityLevel:F,startTime:Q,expirationTime:P,sortIndex:-1},Q>xe?(F.sortIndex=Q,t(p,F),n(f)===null&&F===n(p)&&(S?(_(R),R=-1):S=!0,he(O,Q-xe))):(F.sortIndex=P,t(f,F),w||y||(w=!0,M||(M=!0,Y()))),F},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(F){var ee=x;return function(){var Q=x;x=ee;try{return F.apply(this,arguments)}finally{x=Q}}}})(gm)),gm}var pw;function pM(){return pw||(pw=1,mm.exports=fM()),mm.exports}var vm={exports:{}},jn={};var hw;function hM(){if(hw)return jn;hw=1;var e=yv();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(f,p,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:p,implementation:m}}var l=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,jn.createPortal=function(f,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return s(f,p,null,m)},jn.flushSync=function(f){var p=l.T,m=r.p;try{if(l.T=null,r.p=2,f)return f()}finally{l.T=p,r.p=m,r.d.f()}},jn.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(f,p))},jn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},jn.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,g=u(m,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?r.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:y}):m==="script"&&r.d.X(f,{crossOrigin:g,integrity:x,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},jn.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=u(p.as,p.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(f)},jn.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,g=u(m,p.crossOrigin);r.d.L(f,m,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},jn.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=u(p.as,p.crossOrigin);r.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(f)},jn.requestFormReset=function(f){r.d.r(f)},jn.unstable_batchedUpdates=function(f,p){return f(p)},jn.useFormState=function(f,p,m){return l.H.useFormState(f,p,m)},jn.useFormStatus=function(){return l.H.useHostTransitionStatus()},jn.version="19.2.8",jn}var mw;function CI(){if(mw)return vm.exports;mw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),vm.exports=hM(),vm.exports}var gw;function mM(){if(gw)return tc;gw=1;var e=pM(),t=yv(),n=CI();function r(i){var a="https://react.dev/errors/"+i;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function s(i){var a=i,c=i;if(i.alternate)for(;a.return;)a=a.return;else{i=a;do a=i,(a.flags&4098)!==0&&(c=a.return),i=a.return;while(i)}return a.tag===3?c:null}function l(i){if(i.tag===13){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function u(i){if(i.tag===31){var a=i.memoizedState;if(a===null&&(i=i.alternate,i!==null&&(a=i.memoizedState)),a!==null)return a.dehydrated}return null}function f(i){if(s(i)!==i)throw Error(r(188))}function p(i){var a=i.alternate;if(!a){if(a=s(i),a===null)throw Error(r(188));return a!==i?null:i}for(var c=i,d=a;;){var v=c.return;if(v===null)break;var b=v.alternate;if(b===null){if(d=v.return,d!==null){c=d;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===c)return f(v),i;if(b===d)return f(v),a;b=b.sibling}throw Error(r(188))}if(c.return!==d.return)c=v,d=b;else{for(var j=!1,N=v.child;N;){if(N===c){j=!0,c=v,d=b;break}if(N===d){j=!0,d=v,c=b;break}N=N.sibling}if(!j){for(N=b.child;N;){if(N===c){j=!0,c=b,d=v;break}if(N===d){j=!0,d=b,c=v;break}N=N.sibling}if(!j)throw Error(r(189))}}if(c.alternate!==d)throw Error(r(190))}if(c.tag!==3)throw Error(r(188));return c.stateNode.current===c?i:a}function m(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i;for(i=i.child;i!==null;){if(a=m(i),a!==null)return a;i=i.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),M=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function Y(i){return i===null||typeof i!="object"?null:(i=Z&&i[Z]||i["@@iterator"],typeof i=="function"?i:null)}var ae=Symbol.for("react.client.reference");function J(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===ae?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case S:return"Fragment";case k:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case M:return"SuspenseList";case K:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case C:return i.displayName||"Context";case _:return(i._context.displayName||"Context")+".Consumer";case E:var a=i.render;return i=i.displayName,i||(i=a.displayName||a.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case R:return a=i.displayName||null,a!==null?a:J(i.type)||"Memo";case z:a=i._payload,i=i._init;try{return J(i(a))}catch{}}return null}var he=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},xe=[],P=-1;function $(i){return{current:i}}function te(i){0>P||(i.current=xe[P],xe[P]=null,P--)}function A(i,a){P++,xe[P]=i.current,i.current=a}var L=$(null),X=$(null),ue=$(null),we=$(null);function ge(i,a){switch(A(ue,a),A(X,i),A(L,null),a.nodeType){case 9:case 11:i=(i=a.documentElement)&&(i=i.namespaceURI)?M1(i):0;break;default:if(i=a.tagName,a=a.namespaceURI)a=M1(a),i=N1(a,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(L),A(L,i)}function Se(){te(L),te(X),te(ue)}function B(i){i.memoizedState!==null&&A(we,i);var a=L.current,c=N1(a,i.type);a!==c&&(A(X,i),A(L,c))}function U(i){X.current===i&&(te(L),te(X)),we.current===i&&(te(we),Yl._currentValue=Q)}var ve,_e;function qe(i){if(ve===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);ve=a&&a[1]||"",_e=-1<c.stack.indexOf(`
3
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
4
+ `+ve+i+_e}var Qe=!1;function ze(i,a){if(!i||Qe)return"";Qe=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(se){var oe=se}Reflect.construct(i,[],ye)}else{try{ye.call()}catch(se){oe=se}i.call(ye.prototype)}}else{try{throw Error()}catch(se){oe=se}(ye=i())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(se){if(se&&oe&&typeof se.stack=="string")return[se.stack,oe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=d.DetermineComponentFrameRoot(),j=b[0],N=b[1];if(j&&N){var H=j.split(`
5
+ `),ie=N.split(`
6
+ `);for(v=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;v<ie.length&&!ie[v].includes("DetermineComponentFrameRoot");)v++;if(d===H.length||v===ie.length)for(d=H.length-1,v=ie.length-1;1<=d&&0<=v&&H[d]!==ie[v];)v--;for(;1<=d&&0<=v;d--,v--)if(H[d]!==ie[v]){if(d!==1||v!==1)do if(d--,v--,0>v||H[d]!==ie[v]){var de=`
7
+ `+H[d].replace(" at new "," at ");return i.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",i.displayName)),de}while(1<=d&&0<=v);break}}}finally{Qe=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?qe(c):""}function ut(i,a){switch(i.tag){case 26:case 27:case 5:return qe(i.type);case 16:return qe("Lazy");case 13:return i.child!==a&&a!==null?qe("Suspense Fallback"):qe("Suspense");case 19:return qe("SuspenseList");case 0:case 15:return ze(i.type,!1);case 11:return ze(i.type.render,!1);case 1:return ze(i.type,!0);case 31:return qe("Activity");default:return""}}function Kt(i){try{var a="",c=null;do a+=ut(i,c),c=i,i=i.return;while(i);return a}catch(d){return`
8
+ Error generating stack: `+d.message+`
9
+ `+d.stack}}var Ft=Object.prototype.hasOwnProperty,dr=e.unstable_scheduleCallback,Lr=e.unstable_cancelCallback,Lo=e.unstable_shouldYield,oi=e.unstable_requestPaint,an=e.unstable_now,ai=e.unstable_getCurrentPriorityLevel,pe=e.unstable_ImmediatePriority,Ie=e.unstable_UserBlockingPriority,Le=e.unstable_NormalPriority,ne=e.unstable_LowPriority,je=e.unstable_IdlePriority,Be=e.log,We=e.unstable_setDisableYieldValue,ft=null,Xe=null;function sn(i){if(typeof Be=="function"&&We(i),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(ft,i)}catch{}}var mt=Math.clz32?Math.clz32:be,Bn=Math.log,Jn=Math.LN2;function be(i){return i>>>=0,i===0?32:31-(Bn(i)/Jn|0)|0}var $t=256,Mn=262144,Br=4194304;function si(i){var a=i&42;if(a!==0)return a;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Xc(i,a,c){var d=i.pendingLanes;if(d===0)return 0;var v=0,b=i.suspendedLanes,j=i.pingedLanes;i=i.warmLanes;var N=d&134217727;return N!==0?(d=N&~b,d!==0?v=si(d):(j&=N,j!==0?v=si(j):c||(c=N&~i,c!==0&&(v=si(c))))):(N=d&~b,N!==0?v=si(N):j!==0?v=si(j):c||(c=d&~i,c!==0&&(v=si(c)))),v===0?0:a!==0&&a!==v&&(a&b)===0&&(b=v&-v,c=a&-a,b>=c||b===32&&(c&4194048)!==0)?a:v}function cl(i,a){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&a)===0}function GE(i,a){switch(i){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 fb(){var i=Br;return Br<<=1,(Br&62914560)===0&&(Br=4194304),i}function ep(i){for(var a=[],c=0;31>c;c++)a.push(i);return a}function ul(i,a){i.pendingLanes|=a,a!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function YE(i,a,c,d,v,b){var j=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var N=i.entanglements,H=i.expirationTimes,ie=i.hiddenUpdates;for(c=j&~c;0<c;){var de=31-mt(c),ye=1<<de;N[de]=0,H[de]=-1;var oe=ie[de];if(oe!==null)for(ie[de]=null,de=0;de<oe.length;de++){var se=oe[de];se!==null&&(se.lane&=-536870913)}c&=~ye}d!==0&&pb(i,d,0),b!==0&&v===0&&i.tag!==0&&(i.suspendedLanes|=b&~(j&~a))}function pb(i,a,c){i.pendingLanes|=a,i.suspendedLanes&=~a;var d=31-mt(a);i.entangledLanes|=a,i.entanglements[d]=i.entanglements[d]|1073741824|c&261930}function hb(i,a){var c=i.entangledLanes|=a;for(i=i.entanglements;c;){var d=31-mt(c),v=1<<d;v&a|i[d]&a&&(i[d]|=a),c&=~v}}function mb(i,a){var c=a&-a;return c=(c&42)!==0?1:tp(c),(c&(i.suspendedLanes|a))!==0?0:c}function tp(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function np(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function gb(){var i=ee.p;return i!==0?i:(i=window.event,i===void 0?32:tw(i.type))}function vb(i,a){var c=ee.p;try{return ee.p=i,a()}finally{ee.p=c}}var Zi=Math.random().toString(36).slice(2),xn="__reactFiber$"+Zi,qn="__reactProps$"+Zi,Pa="__reactContainer$"+Zi,rp="__reactEvents$"+Zi,WE="__reactListeners$"+Zi,XE="__reactHandles$"+Zi,yb="__reactResources$"+Zi,dl="__reactMarker$"+Zi;function ip(i){delete i[xn],delete i[qn],delete i[rp],delete i[WE],delete i[XE]}function Ra(i){var a=i[xn];if(a)return a;for(var c=i.parentNode;c;){if(a=c[Pa]||c[xn]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(i=B1(i);i!==null;){if(c=i[xn])return c;i=B1(i)}return a}i=c,c=i.parentNode}return null}function Oa(i){if(i=i[xn]||i[Pa]){var a=i.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return i}return null}function fl(i){var a=i.tag;if(a===5||a===26||a===27||a===6)return i.stateNode;throw Error(r(33))}function za(i){var a=i[yb];return a||(a=i[yb]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function hn(i){i[dl]=!0}var bb=new Set,xb={};function Bo(i,a){Da(i,a),Da(i+"Capture",a)}function Da(i,a){for(xb[i]=a,i=0;i<a.length;i++)bb.add(a[i])}var JE=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]*$"),wb={},Sb={};function e_(i){return Ft.call(Sb,i)?!0:Ft.call(wb,i)?!1:JE.test(i)?Sb[i]=!0:(wb[i]=!0,!1)}function Jc(i,a,c){if(e_(a))if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){i.removeAttribute(a);return}}i.setAttribute(a,""+c)}}function eu(i,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttribute(a,""+c)}}function li(i,a,c,d){if(d===null)i.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(a,c,""+d)}}function fr(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function kb(i){var a=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function t_(i,a,c){var d=Object.getOwnPropertyDescriptor(i.constructor.prototype,a);if(!i.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,b=d.set;return Object.defineProperty(i,a,{configurable:!0,get:function(){return v.call(this)},set:function(j){c=""+j,b.call(this,j)}}),Object.defineProperty(i,a,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(j){c=""+j},stopTracking:function(){i._valueTracker=null,delete i[a]}}}}function op(i){if(!i._valueTracker){var a=kb(i)?"checked":"value";i._valueTracker=t_(i,a,""+i[a])}}function Ib(i){if(!i)return!1;var a=i._valueTracker;if(!a)return!0;var c=a.getValue(),d="";return i&&(d=kb(i)?i.checked?"true":"false":i.value),i=d,i!==c?(a.setValue(i),!0):!1}function tu(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var n_=/[\n"\\]/g;function pr(i){return i.replace(n_,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function ap(i,a,c,d,v,b,j,N){i.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?i.type=j:i.removeAttribute("type"),a!=null?j==="number"?(a===0&&i.value===""||i.value!=a)&&(i.value=""+fr(a)):i.value!==""+fr(a)&&(i.value=""+fr(a)):j!=="submit"&&j!=="reset"||i.removeAttribute("value"),a!=null?sp(i,j,fr(a)):c!=null?sp(i,j,fr(c)):d!=null&&i.removeAttribute("value"),v==null&&b!=null&&(i.defaultChecked=!!b),v!=null&&(i.checked=v&&typeof v!="function"&&typeof v!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.name=""+fr(N):i.removeAttribute("name")}function Tb(i,a,c,d,v,b,j,N){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.type=b),a!=null||c!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){op(i);return}c=c!=null?""+fr(c):"",a=a!=null?""+fr(a):c,N||a===i.value||(i.value=a),i.defaultValue=a}d=d??v,d=typeof d!="function"&&typeof d!="symbol"&&!!d,i.checked=N?i.checked:!!d,i.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(i.name=j),op(i)}function sp(i,a,c){a==="number"&&tu(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function La(i,a,c,d){if(i=i.options,a){a={};for(var v=0;v<c.length;v++)a["$"+c[v]]=!0;for(c=0;c<i.length;c++)v=a.hasOwnProperty("$"+i[c].value),i[c].selected!==v&&(i[c].selected=v),v&&d&&(i[c].defaultSelected=!0)}else{for(c=""+fr(c),a=null,v=0;v<i.length;v++){if(i[v].value===c){i[v].selected=!0,d&&(i[v].defaultSelected=!0);return}a!==null||i[v].disabled||(a=i[v])}a!==null&&(a.selected=!0)}}function jb(i,a,c){if(a!=null&&(a=""+fr(a),a!==i.value&&(i.value=a),c==null)){i.defaultValue!==a&&(i.defaultValue=a);return}i.defaultValue=c!=null?""+fr(c):""}function Cb(i,a,c,d){if(a==null){if(d!=null){if(c!=null)throw Error(r(92));if(he(d)){if(1<d.length)throw Error(r(93));d=d[0]}c=d}c==null&&(c=""),a=c}c=fr(a),i.defaultValue=c,d=i.textContent,d===c&&d!==""&&d!==null&&(i.value=d),op(i)}function Ba(i,a){if(a){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=a;return}}i.textContent=a}var r_=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 Eb(i,a,c){var d=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?i.setProperty(a,""):a==="float"?i.cssFloat="":i[a]="":d?i.setProperty(a,c):typeof c!="number"||c===0||r_.has(a)?a==="float"?i.cssFloat=c:i[a]=(""+c).trim():i[a]=c+"px"}function _b(i,a,c){if(a!=null&&typeof a!="object")throw Error(r(62));if(i=i.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?i.setProperty(d,""):d==="float"?i.cssFloat="":i[d]="");for(var v in a)d=a[v],a.hasOwnProperty(v)&&c[v]!==d&&Eb(i,v,d)}else for(var b in a)a.hasOwnProperty(b)&&Eb(i,b,a[b])}function lp(i){if(i.indexOf("-")===-1)return!1;switch(i){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 i_=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"]]),o_=/^[\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 nu(i){return o_.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function ci(){}var cp=null;function up(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var qa=null,$a=null;function Ab(i){var a=Oa(i);if(a&&(i=a.stateNode)){var c=i[qn]||null;e:switch(i=a.stateNode,a.type){case"input":if(ap(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+pr(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var d=c[a];if(d!==i&&d.form===i.form){var v=d[qn]||null;if(!v)throw Error(r(90));ap(d,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(a=0;a<c.length;a++)d=c[a],d.form===i.form&&Ib(d)}break e;case"textarea":jb(i,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&La(i,!!c.multiple,a,!1)}}}var dp=!1;function Mb(i,a,c){if(dp)return i(a,c);dp=!0;try{var d=i(a);return d}finally{if(dp=!1,(qa!==null||$a!==null)&&(Hu(),qa&&(a=qa,i=$a,$a=qa=null,Ab(a),i)))for(a=0;a<i.length;a++)Ab(i[a])}}function pl(i,a){var c=i.stateNode;if(c===null)return null;var d=c[qn]||null;if(d===null)return null;c=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(r(231,a,typeof c));return c}var ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fp=!1;if(ui)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){fp=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{fp=!1}var Ki=null,pp=null,ru=null;function Nb(){if(ru)return ru;var i,a=pp,c=a.length,d,v="value"in Ki?Ki.value:Ki.textContent,b=v.length;for(i=0;i<c&&a[i]===v[i];i++);var j=c-i;for(d=1;d<=j&&a[c-d]===v[b-d];d++);return ru=v.slice(i,1<d?1-d:void 0)}function iu(i){var a=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&a===13&&(i=13)):i=a,i===10&&(i=13),32<=i||i===13?i:0}function ou(){return!0}function Pb(){return!1}function $n(i){function a(c,d,v,b,j){this._reactName=c,this._targetInst=v,this.type=d,this.nativeEvent=b,this.target=j,this.currentTarget=null;for(var N in i)i.hasOwnProperty(N)&&(c=i[N],this[N]=c?c(b):b[N]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?ou:Pb,this.isPropagationStopped=Pb,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ou)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ou)},persist:function(){},isPersistent:ou}),a}var qo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},au=$n(qo),ml=g({},qo,{view:0,detail:0}),a_=$n(ml),hp,mp,gl,su=g({},ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vp,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==gl&&(gl&&i.type==="mousemove"?(hp=i.screenX-gl.screenX,mp=i.screenY-gl.screenY):mp=hp=0,gl=i),hp)},movementY:function(i){return"movementY"in i?i.movementY:mp}}),Rb=$n(su),s_=g({},su,{dataTransfer:0}),l_=$n(s_),c_=g({},ml,{relatedTarget:0}),gp=$n(c_),u_=g({},qo,{animationName:0,elapsedTime:0,pseudoElement:0}),d_=$n(u_),f_=g({},qo,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),p_=$n(f_),h_=g({},qo,{data:0}),Ob=$n(h_),m_={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g_={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"},v_={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function y_(i){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(i):(i=v_[i])?!!a[i]:!1}function vp(){return y_}var b_=g({},ml,{key:function(i){if(i.key){var a=m_[i.key]||i.key;if(a!=="Unidentified")return a}return i.type==="keypress"?(i=iu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?g_[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vp,charCode:function(i){return i.type==="keypress"?iu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?iu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),x_=$n(b_),w_=g({},su,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zb=$n(w_),S_=g({},ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vp}),k_=$n(S_),I_=g({},qo,{propertyName:0,elapsedTime:0,pseudoElement:0}),T_=$n(I_),j_=g({},su,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),C_=$n(j_),E_=g({},qo,{newState:0,oldState:0}),__=$n(E_),A_=[9,13,27,32],yp=ui&&"CompositionEvent"in window,vl=null;ui&&"documentMode"in document&&(vl=document.documentMode);var M_=ui&&"TextEvent"in window&&!vl,Db=ui&&(!yp||vl&&8<vl&&11>=vl),Lb=" ",Bb=!1;function qb(i,a){switch(i){case"keyup":return A_.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $b(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ua=!1;function N_(i,a){switch(i){case"compositionend":return $b(a);case"keypress":return a.which!==32?null:(Bb=!0,Lb);case"textInput":return i=a.data,i===Lb&&Bb?null:i;default:return null}}function P_(i,a){if(Ua)return i==="compositionend"||!yp&&qb(i,a)?(i=Nb(),ru=pp=Ki=null,Ua=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Db&&a.locale!=="ko"?null:a.data;default:return null}}var R_={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 Ub(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a==="input"?!!R_[i.type]:a==="textarea"}function Hb(i,a,c,d){qa?$a?$a.push(d):$a=[d]:qa=d,a=Yu(a,"onChange"),0<a.length&&(c=new au("onChange","change",null,c,d),i.push({event:c,listeners:a}))}var yl=null,bl=null;function O_(i){T1(i,0)}function lu(i){var a=fl(i);if(Ib(a))return i}function Fb(i,a){if(i==="change")return a}var Vb=!1;if(ui){var bp;if(ui){var xp="oninput"in document;if(!xp){var Zb=document.createElement("div");Zb.setAttribute("oninput","return;"),xp=typeof Zb.oninput=="function"}bp=xp}else bp=!1;Vb=bp&&(!document.documentMode||9<document.documentMode)}function Kb(){yl&&(yl.detachEvent("onpropertychange",Qb),bl=yl=null)}function Qb(i){if(i.propertyName==="value"&&lu(bl)){var a=[];Hb(a,bl,i,up(i)),Mb(O_,a)}}function z_(i,a,c){i==="focusin"?(Kb(),yl=a,bl=c,yl.attachEvent("onpropertychange",Qb)):i==="focusout"&&Kb()}function D_(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return lu(bl)}function L_(i,a){if(i==="click")return lu(a)}function B_(i,a){if(i==="input"||i==="change")return lu(a)}function q_(i,a){return i===a&&(i!==0||1/i===1/a)||i!==i&&a!==a}var er=typeof Object.is=="function"?Object.is:q_;function xl(i,a){if(er(i,a))return!0;if(typeof i!="object"||i===null||typeof a!="object"||a===null)return!1;var c=Object.keys(i),d=Object.keys(a);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var v=c[d];if(!Ft.call(a,v)||!er(i[v],a[v]))return!1}return!0}function Gb(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Yb(i,a){var c=Gb(i);i=0;for(var d;c;){if(c.nodeType===3){if(d=i+c.textContent.length,i<=a&&d>=a)return{node:c,offset:a-i};i=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Gb(c)}}function Wb(i,a){return i&&a?i===a?!0:i&&i.nodeType===3?!1:a&&a.nodeType===3?Wb(i,a.parentNode):"contains"in i?i.contains(a):i.compareDocumentPosition?!!(i.compareDocumentPosition(a)&16):!1:!1}function Xb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var a=tu(i.document);a instanceof i.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)i=a.contentWindow;else break;a=tu(i.document)}return a}function wp(i){var a=i&&i.nodeName&&i.nodeName.toLowerCase();return a&&(a==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||a==="textarea"||i.contentEditable==="true")}var $_=ui&&"documentMode"in document&&11>=document.documentMode,Ha=null,Sp=null,wl=null,kp=!1;function Jb(i,a,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;kp||Ha==null||Ha!==tu(d)||(d=Ha,"selectionStart"in d&&wp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),wl&&xl(wl,d)||(wl=d,d=Yu(Sp,"onSelect"),0<d.length&&(a=new au("onSelect","select",null,a,c),i.push({event:a,listeners:d}),a.target=Ha)))}function $o(i,a){var c={};return c[i.toLowerCase()]=a.toLowerCase(),c["Webkit"+i]="webkit"+a,c["Moz"+i]="moz"+a,c}var Fa={animationend:$o("Animation","AnimationEnd"),animationiteration:$o("Animation","AnimationIteration"),animationstart:$o("Animation","AnimationStart"),transitionrun:$o("Transition","TransitionRun"),transitionstart:$o("Transition","TransitionStart"),transitioncancel:$o("Transition","TransitionCancel"),transitionend:$o("Transition","TransitionEnd")},Ip={},ex={};ui&&(ex=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function Uo(i){if(Ip[i])return Ip[i];if(!Fa[i])return i;var a=Fa[i],c;for(c in a)if(a.hasOwnProperty(c)&&c in ex)return Ip[i]=a[c];return i}var tx=Uo("animationend"),nx=Uo("animationiteration"),rx=Uo("animationstart"),U_=Uo("transitionrun"),H_=Uo("transitionstart"),F_=Uo("transitioncancel"),ix=Uo("transitionend"),ox=new Map,Tp="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(" ");Tp.push("scrollEnd");function _r(i,a){ox.set(i,a),Bo(a,[i])}var cu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},hr=[],Va=0,jp=0;function uu(){for(var i=Va,a=jp=Va=0;a<i;){var c=hr[a];hr[a++]=null;var d=hr[a];hr[a++]=null;var v=hr[a];hr[a++]=null;var b=hr[a];if(hr[a++]=null,d!==null&&v!==null){var j=d.pending;j===null?v.next=v:(v.next=j.next,j.next=v),d.pending=v}b!==0&&ax(c,v,b)}}function du(i,a,c,d){hr[Va++]=i,hr[Va++]=a,hr[Va++]=c,hr[Va++]=d,jp|=d,i.lanes|=d,i=i.alternate,i!==null&&(i.lanes|=d)}function Cp(i,a,c,d){return du(i,a,c,d),fu(i)}function Ho(i,a){return du(i,null,null,a),fu(i)}function ax(i,a,c){i.lanes|=c;var d=i.alternate;d!==null&&(d.lanes|=c);for(var v=!1,b=i.return;b!==null;)b.childLanes|=c,d=b.alternate,d!==null&&(d.childLanes|=c),b.tag===22&&(i=b.stateNode,i===null||i._visibility&1||(v=!0)),i=b,b=b.return;return i.tag===3?(b=i.stateNode,v&&a!==null&&(v=31-mt(c),i=b.hiddenUpdates,d=i[v],d===null?i[v]=[a]:d.push(a),a.lane=c|536870912),b):null}function fu(i){if(50<Hl)throw Hl=0,zh=null,Error(r(185));for(var a=i.return;a!==null;)i=a,a=i.return;return i.tag===3?i.stateNode:null}var Za={};function V_(i,a,c,d){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tr(i,a,c,d){return new V_(i,a,c,d)}function Ep(i){return i=i.prototype,!(!i||!i.isReactComponent)}function di(i,a){var c=i.alternate;return c===null?(c=tr(i.tag,a,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=a,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,a=i.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function sx(i,a){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=a,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,a=c.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),i}function pu(i,a,c,d,v,b){var j=0;if(d=i,typeof i=="function")Ep(i)&&(j=1);else if(typeof i=="string")j=YA(i,c,L.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case K:return i=tr(31,c,a,v),i.elementType=K,i.lanes=b,i;case S:return Fo(c.children,v,b,a);case T:j=8,v|=24;break;case k:return i=tr(12,c,a,v|2),i.elementType=k,i.lanes=b,i;case O:return i=tr(13,c,a,v),i.elementType=O,i.lanes=b,i;case M:return i=tr(19,c,a,v),i.elementType=M,i.lanes=b,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case C:j=10;break e;case _:j=9;break e;case E:j=11;break e;case R:j=14;break e;case z:j=16,d=null;break e}j=29,c=Error(r(130,i===null?"null":typeof i,"")),d=null}return a=tr(j,c,a,v),a.elementType=i,a.type=d,a.lanes=b,a}function Fo(i,a,c,d){return i=tr(7,i,d,a),i.lanes=c,i}function _p(i,a,c){return i=tr(6,i,null,a),i.lanes=c,i}function lx(i){var a=tr(18,null,null,0);return a.stateNode=i,a}function Ap(i,a,c){return a=tr(4,i.children!==null?i.children:[],i.key,a),a.lanes=c,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}var cx=new WeakMap;function mr(i,a){if(typeof i=="object"&&i!==null){var c=cx.get(i);return c!==void 0?c:(a={value:i,source:a,stack:Kt(a)},cx.set(i,a),a)}return{value:i,source:a,stack:Kt(a)}}var Ka=[],Qa=0,hu=null,Sl=0,gr=[],vr=0,Qi=null,qr=1,$r="";function fi(i,a){Ka[Qa++]=Sl,Ka[Qa++]=hu,hu=i,Sl=a}function ux(i,a,c){gr[vr++]=qr,gr[vr++]=$r,gr[vr++]=Qi,Qi=i;var d=qr;i=$r;var v=32-mt(d)-1;d&=~(1<<v),c+=1;var b=32-mt(a)+v;if(30<b){var j=v-v%5;b=(d&(1<<j)-1).toString(32),d>>=j,v-=j,qr=1<<32-mt(a)+v|c<<v|d,$r=b+i}else qr=1<<b|c<<v|d,$r=i}function Mp(i){i.return!==null&&(fi(i,1),ux(i,1,0))}function Np(i){for(;i===hu;)hu=Ka[--Qa],Ka[Qa]=null,Sl=Ka[--Qa],Ka[Qa]=null;for(;i===Qi;)Qi=gr[--vr],gr[vr]=null,$r=gr[--vr],gr[vr]=null,qr=gr[--vr],gr[vr]=null}function dx(i,a){gr[vr++]=qr,gr[vr++]=$r,gr[vr++]=Qi,qr=a.id,$r=a.overflow,Qi=i}var wn=null,Pt=null,dt=!1,Gi=null,yr=!1,Pp=Error(r(519));function Yi(i){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw kl(mr(a,i)),Pp}function fx(i){var a=i.stateNode,c=i.type,d=i.memoizedProps;switch(a[xn]=i,a[qn]=d,c){case"dialog":at("cancel",a),at("close",a);break;case"iframe":case"object":case"embed":at("load",a);break;case"video":case"audio":for(c=0;c<Vl.length;c++)at(Vl[c],a);break;case"source":at("error",a);break;case"img":case"image":case"link":at("error",a),at("load",a);break;case"details":at("toggle",a);break;case"input":at("invalid",a),Tb(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":at("invalid",a);break;case"textarea":at("invalid",a),Cb(a,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||d.suppressHydrationWarning===!0||_1(a.textContent,c)?(d.popover!=null&&(at("beforetoggle",a),at("toggle",a)),d.onScroll!=null&&at("scroll",a),d.onScrollEnd!=null&&at("scrollend",a),d.onClick!=null&&(a.onclick=ci),a=!0):a=!1,a||Yi(i,!0)}function px(i){for(wn=i.return;wn;)switch(wn.tag){case 5:case 31:case 13:yr=!1;return;case 27:case 3:yr=!0;return;default:wn=wn.return}}function Ga(i){if(i!==wn)return!1;if(!dt)return px(i),dt=!0,!1;var a=i.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||Wh(i.type,i.memoizedProps)),c=!c),c&&Pt&&Yi(i),px(i),a===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Pt=L1(i)}else if(a===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Pt=L1(i)}else a===27?(a=Pt,uo(i.type)?(i=nm,nm=null,Pt=i):Pt=a):Pt=wn?xr(i.stateNode.nextSibling):null;return!0}function Vo(){Pt=wn=null,dt=!1}function Rp(){var i=Gi;return i!==null&&(Vn===null?Vn=i:Vn.push.apply(Vn,i),Gi=null),i}function kl(i){Gi===null?Gi=[i]:Gi.push(i)}var Op=$(null),Zo=null,pi=null;function Wi(i,a,c){A(Op,a._currentValue),a._currentValue=c}function hi(i){i._currentValue=Op.current,te(Op)}function zp(i,a,c){for(;i!==null;){var d=i.alternate;if((i.childLanes&a)!==a?(i.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),i===c)break;i=i.return}}function Dp(i,a,c,d){var v=i.child;for(v!==null&&(v.return=i);v!==null;){var b=v.dependencies;if(b!==null){var j=v.child;b=b.firstContext;e:for(;b!==null;){var N=b;b=v;for(var H=0;H<a.length;H++)if(N.context===a[H]){b.lanes|=c,N=b.alternate,N!==null&&(N.lanes|=c),zp(b.return,c,i),d||(j=null);break e}b=N.next}}else if(v.tag===18){if(j=v.return,j===null)throw Error(r(341));j.lanes|=c,b=j.alternate,b!==null&&(b.lanes|=c),zp(j,c,i),j=null}else j=v.child;if(j!==null)j.return=v;else for(j=v;j!==null;){if(j===i){j=null;break}if(v=j.sibling,v!==null){v.return=j.return,j=v;break}j=j.return}v=j}}function Ya(i,a,c,d){i=null;for(var v=a,b=!1;v!==null;){if(!b){if((v.flags&524288)!==0)b=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var j=v.alternate;if(j===null)throw Error(r(387));if(j=j.memoizedProps,j!==null){var N=v.type;er(v.pendingProps.value,j.value)||(i!==null?i.push(N):i=[N])}}else if(v===we.current){if(j=v.alternate,j===null)throw Error(r(387));j.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(i!==null?i.push(Yl):i=[Yl])}v=v.return}i!==null&&Dp(a,i,c,d),a.flags|=262144}function mu(i){for(i=i.firstContext;i!==null;){if(!er(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ko(i){Zo=i,pi=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Sn(i){return hx(Zo,i)}function gu(i,a){return Zo===null&&Ko(i),hx(i,a)}function hx(i,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},pi===null){if(i===null)throw Error(r(308));pi=a,i.dependencies={lanes:0,firstContext:a},i.flags|=524288}else pi=pi.next=a;return c}var Z_=typeof AbortController<"u"?AbortController:function(){var i=[],a=this.signal={aborted:!1,addEventListener:function(c,d){i.push(d)}};this.abort=function(){a.aborted=!0,i.forEach(function(c){return c()})}},K_=e.unstable_scheduleCallback,Q_=e.unstable_NormalPriority,Jt={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Lp(){return{controller:new Z_,data:new Map,refCount:0}}function Il(i){i.refCount--,i.refCount===0&&K_(Q_,function(){i.controller.abort()})}var Tl=null,Bp=0,Wa=0,Xa=null;function G_(i,a){if(Tl===null){var c=Tl=[];Bp=0,Wa=Uh(),Xa={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Bp++,a.then(mx,mx),a}function mx(){if(--Bp===0&&Tl!==null){Xa!==null&&(Xa.status="fulfilled");var i=Tl;Tl=null,Wa=0,Xa=null;for(var a=0;a<i.length;a++)(0,i[a])()}}function Y_(i,a){var c=[],d={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return i.then(function(){d.status="fulfilled",d.value=a;for(var v=0;v<c.length;v++)(0,c[v])(a)},function(v){for(d.status="rejected",d.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),d}var gx=F.S;F.S=function(i,a){J0=an(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&G_(i,a),gx!==null&&gx(i,a)};var Qo=$(null);function qp(){var i=Qo.current;return i!==null?i:Et.pooledCache}function vu(i,a){a===null?A(Qo,Qo.current):A(Qo,a.pool)}function vx(){var i=qp();return i===null?null:{parent:Jt._currentValue,pool:i}}var Ja=Error(r(460)),$p=Error(r(474)),yu=Error(r(542)),bu={then:function(){}};function yx(i){return i=i.status,i==="fulfilled"||i==="rejected"}function bx(i,a,c){switch(c=i[c],c===void 0?i.push(a):c!==a&&(a.then(ci,ci),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,wx(i),i;default:if(typeof a.status=="string")a.then(ci,ci);else{if(i=Et,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=a,i.status="pending",i.then(function(d){if(a.status==="pending"){var v=a;v.status="fulfilled",v.value=d}},function(d){if(a.status==="pending"){var v=a;v.status="rejected",v.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw i=a.reason,wx(i),i}throw Yo=a,Ja}}function Go(i){try{var a=i._init;return a(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Yo=c,Ja):c}}var Yo=null;function xx(){if(Yo===null)throw Error(r(459));var i=Yo;return Yo=null,i}function wx(i){if(i===Ja||i===yu)throw Error(r(483))}var es=null,jl=0;function xu(i){var a=jl;return jl+=1,es===null&&(es=[]),bx(es,i,a)}function Cl(i,a){a=a.props.ref,i.ref=a!==void 0?a:null}function wu(i,a){throw a.$$typeof===x?Error(r(525)):(i=Object.prototype.toString.call(a),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":i)))}function Sx(i){function a(W,V){if(i){var re=W.deletions;re===null?(W.deletions=[V],W.flags|=16):re.push(V)}}function c(W,V){if(!i)return null;for(;V!==null;)a(W,V),V=V.sibling;return null}function d(W){for(var V=new Map;W!==null;)W.key!==null?V.set(W.key,W):V.set(W.index,W),W=W.sibling;return V}function v(W,V){return W=di(W,V),W.index=0,W.sibling=null,W}function b(W,V,re){return W.index=re,i?(re=W.alternate,re!==null?(re=re.index,re<V?(W.flags|=67108866,V):re):(W.flags|=67108866,V)):(W.flags|=1048576,V)}function j(W){return i&&W.alternate===null&&(W.flags|=67108866),W}function N(W,V,re,me){return V===null||V.tag!==6?(V=_p(re,W.mode,me),V.return=W,V):(V=v(V,re),V.return=W,V)}function H(W,V,re,me){var Ue=re.type;return Ue===S?de(W,V,re.props.children,me,re.key):V!==null&&(V.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===z&&Go(Ue)===V.type)?(V=v(V,re.props),Cl(V,re),V.return=W,V):(V=pu(re.type,re.key,re.props,null,W.mode,me),Cl(V,re),V.return=W,V)}function ie(W,V,re,me){return V===null||V.tag!==4||V.stateNode.containerInfo!==re.containerInfo||V.stateNode.implementation!==re.implementation?(V=Ap(re,W.mode,me),V.return=W,V):(V=v(V,re.children||[]),V.return=W,V)}function de(W,V,re,me,Ue){return V===null||V.tag!==7?(V=Fo(re,W.mode,me,Ue),V.return=W,V):(V=v(V,re),V.return=W,V)}function ye(W,V,re){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=_p(""+V,W.mode,re),V.return=W,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return re=pu(V.type,V.key,V.props,null,W.mode,re),Cl(re,V),re.return=W,re;case w:return V=Ap(V,W.mode,re),V.return=W,V;case z:return V=Go(V),ye(W,V,re)}if(he(V)||Y(V))return V=Fo(V,W.mode,re,null),V.return=W,V;if(typeof V.then=="function")return ye(W,xu(V),re);if(V.$$typeof===C)return ye(W,gu(W,V),re);wu(W,V)}return null}function oe(W,V,re,me){var Ue=V!==null?V.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return Ue!==null?null:N(W,V,""+re,me);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case y:return re.key===Ue?H(W,V,re,me):null;case w:return re.key===Ue?ie(W,V,re,me):null;case z:return re=Go(re),oe(W,V,re,me)}if(he(re)||Y(re))return Ue!==null?null:de(W,V,re,me,null);if(typeof re.then=="function")return oe(W,V,xu(re),me);if(re.$$typeof===C)return oe(W,V,gu(W,re),me);wu(W,re)}return null}function se(W,V,re,me,Ue){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return W=W.get(re)||null,N(V,W,""+me,Ue);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case y:return W=W.get(me.key===null?re:me.key)||null,H(V,W,me,Ue);case w:return W=W.get(me.key===null?re:me.key)||null,ie(V,W,me,Ue);case z:return me=Go(me),se(W,V,re,me,Ue)}if(he(me)||Y(me))return W=W.get(re)||null,de(V,W,me,Ue,null);if(typeof me.then=="function")return se(W,V,re,xu(me),Ue);if(me.$$typeof===C)return se(W,V,re,gu(V,me),Ue);wu(V,me)}return null}function Pe(W,V,re,me){for(var Ue=null,gt=null,Oe=V,rt=V=0,ct=null;Oe!==null&&rt<re.length;rt++){Oe.index>rt?(ct=Oe,Oe=null):ct=Oe.sibling;var vt=oe(W,Oe,re[rt],me);if(vt===null){Oe===null&&(Oe=ct);break}i&&Oe&&vt.alternate===null&&a(W,Oe),V=b(vt,V,rt),gt===null?Ue=vt:gt.sibling=vt,gt=vt,Oe=ct}if(rt===re.length)return c(W,Oe),dt&&fi(W,rt),Ue;if(Oe===null){for(;rt<re.length;rt++)Oe=ye(W,re[rt],me),Oe!==null&&(V=b(Oe,V,rt),gt===null?Ue=Oe:gt.sibling=Oe,gt=Oe);return dt&&fi(W,rt),Ue}for(Oe=d(Oe);rt<re.length;rt++)ct=se(Oe,W,rt,re[rt],me),ct!==null&&(i&&ct.alternate!==null&&Oe.delete(ct.key===null?rt:ct.key),V=b(ct,V,rt),gt===null?Ue=ct:gt.sibling=ct,gt=ct);return i&&Oe.forEach(function(go){return a(W,go)}),dt&&fi(W,rt),Ue}function Ve(W,V,re,me){if(re==null)throw Error(r(151));for(var Ue=null,gt=null,Oe=V,rt=V=0,ct=null,vt=re.next();Oe!==null&&!vt.done;rt++,vt=re.next()){Oe.index>rt?(ct=Oe,Oe=null):ct=Oe.sibling;var go=oe(W,Oe,vt.value,me);if(go===null){Oe===null&&(Oe=ct);break}i&&Oe&&go.alternate===null&&a(W,Oe),V=b(go,V,rt),gt===null?Ue=go:gt.sibling=go,gt=go,Oe=ct}if(vt.done)return c(W,Oe),dt&&fi(W,rt),Ue;if(Oe===null){for(;!vt.done;rt++,vt=re.next())vt=ye(W,vt.value,me),vt!==null&&(V=b(vt,V,rt),gt===null?Ue=vt:gt.sibling=vt,gt=vt);return dt&&fi(W,rt),Ue}for(Oe=d(Oe);!vt.done;rt++,vt=re.next())vt=se(Oe,W,rt,vt.value,me),vt!==null&&(i&&vt.alternate!==null&&Oe.delete(vt.key===null?rt:vt.key),V=b(vt,V,rt),gt===null?Ue=vt:gt.sibling=vt,gt=vt);return i&&Oe.forEach(function(sM){return a(W,sM)}),dt&&fi(W,rt),Ue}function Tt(W,V,re,me){if(typeof re=="object"&&re!==null&&re.type===S&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case y:e:{for(var Ue=re.key;V!==null;){if(V.key===Ue){if(Ue=re.type,Ue===S){if(V.tag===7){c(W,V.sibling),me=v(V,re.props.children),me.return=W,W=me;break e}}else if(V.elementType===Ue||typeof Ue=="object"&&Ue!==null&&Ue.$$typeof===z&&Go(Ue)===V.type){c(W,V.sibling),me=v(V,re.props),Cl(me,re),me.return=W,W=me;break e}c(W,V);break}else a(W,V);V=V.sibling}re.type===S?(me=Fo(re.props.children,W.mode,me,re.key),me.return=W,W=me):(me=pu(re.type,re.key,re.props,null,W.mode,me),Cl(me,re),me.return=W,W=me)}return j(W);case w:e:{for(Ue=re.key;V!==null;){if(V.key===Ue)if(V.tag===4&&V.stateNode.containerInfo===re.containerInfo&&V.stateNode.implementation===re.implementation){c(W,V.sibling),me=v(V,re.children||[]),me.return=W,W=me;break e}else{c(W,V);break}else a(W,V);V=V.sibling}me=Ap(re,W.mode,me),me.return=W,W=me}return j(W);case z:return re=Go(re),Tt(W,V,re,me)}if(he(re))return Pe(W,V,re,me);if(Y(re)){if(Ue=Y(re),typeof Ue!="function")throw Error(r(150));return re=Ue.call(re),Ve(W,V,re,me)}if(typeof re.then=="function")return Tt(W,V,xu(re),me);if(re.$$typeof===C)return Tt(W,V,gu(W,re),me);wu(W,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,V!==null&&V.tag===6?(c(W,V.sibling),me=v(V,re),me.return=W,W=me):(c(W,V),me=_p(re,W.mode,me),me.return=W,W=me),j(W)):c(W,V)}return function(W,V,re,me){try{jl=0;var Ue=Tt(W,V,re,me);return es=null,Ue}catch(Oe){if(Oe===Ja||Oe===yu)throw Oe;var gt=tr(29,Oe,null,W.mode);return gt.lanes=me,gt.return=W,gt}}}var Wo=Sx(!0),kx=Sx(!1),Xi=!1;function Up(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Hp(i,a){i=i.updateQueue,a.updateQueue===i&&(a.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function Ji(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function eo(i,a,c){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(yt&2)!==0){var v=d.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a,a=fu(i),ax(i,null,c),a}return du(i,d,a,c),fu(i)}function El(i,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var d=a.lanes;d&=i.pendingLanes,c|=d,a.lanes=c,hb(i,c)}}function Fp(i,a){var c=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var v=null,b=null;if(c=c.firstBaseUpdate,c!==null){do{var j={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};b===null?v=b=j:b=b.next=j,c=c.next}while(c!==null);b===null?v=b=a:b=b.next=a}else v=b=a;c={baseState:d.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:d.shared,callbacks:d.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=a:i.next=a,c.lastBaseUpdate=a}var Vp=!1;function _l(){if(Vp){var i=Xa;if(i!==null)throw i}}function Al(i,a,c,d){Vp=!1;var v=i.updateQueue;Xi=!1;var b=v.firstBaseUpdate,j=v.lastBaseUpdate,N=v.shared.pending;if(N!==null){v.shared.pending=null;var H=N,ie=H.next;H.next=null,j===null?b=ie:j.next=ie,j=H;var de=i.alternate;de!==null&&(de=de.updateQueue,N=de.lastBaseUpdate,N!==j&&(N===null?de.firstBaseUpdate=ie:N.next=ie,de.lastBaseUpdate=H))}if(b!==null){var ye=v.baseState;j=0,de=ie=H=null,N=b;do{var oe=N.lane&-536870913,se=oe!==N.lane;if(se?(lt&oe)===oe:(d&oe)===oe){oe!==0&&oe===Wa&&(Vp=!0),de!==null&&(de=de.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Pe=i,Ve=N;oe=a;var Tt=c;switch(Ve.tag){case 1:if(Pe=Ve.payload,typeof Pe=="function"){ye=Pe.call(Tt,ye,oe);break e}ye=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Ve.payload,oe=typeof Pe=="function"?Pe.call(Tt,ye,oe):Pe,oe==null)break e;ye=g({},ye,oe);break e;case 2:Xi=!0}}oe=N.callback,oe!==null&&(i.flags|=64,se&&(i.flags|=8192),se=v.callbacks,se===null?v.callbacks=[oe]:se.push(oe))}else se={lane:oe,tag:N.tag,payload:N.payload,callback:N.callback,next:null},de===null?(ie=de=se,H=ye):de=de.next=se,j|=oe;if(N=N.next,N===null){if(N=v.shared.pending,N===null)break;se=N,N=se.next,se.next=null,v.lastBaseUpdate=se,v.shared.pending=null}}while(!0);de===null&&(H=ye),v.baseState=H,v.firstBaseUpdate=ie,v.lastBaseUpdate=de,b===null&&(v.shared.lanes=0),oo|=j,i.lanes=j,i.memoizedState=ye}}function Ix(i,a){if(typeof i!="function")throw Error(r(191,i));i.call(a)}function Tx(i,a){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)Ix(c[i],a)}var ts=$(null),Su=$(0);function jx(i,a){i=ki,A(Su,i),A(ts,a),ki=i|a.baseLanes}function Zp(){A(Su,ki),A(ts,ts.current)}function Kp(){ki=Su.current,te(ts),te(Su)}var nr=$(null),br=null;function to(i){var a=i.alternate;A(Qt,Qt.current&1),A(nr,i),br===null&&(a===null||ts.current!==null||a.memoizedState!==null)&&(br=i)}function Qp(i){A(Qt,Qt.current),A(nr,i),br===null&&(br=i)}function Cx(i){i.tag===22?(A(Qt,Qt.current),A(nr,i),br===null&&(br=i)):no()}function no(){A(Qt,Qt.current),A(nr,nr.current)}function rr(i){te(nr),br===i&&(br=null),te(Qt)}var Qt=$(0);function ku(i){for(var a=i;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||em(c)||tm(c)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var mi=0,nt=null,kt=null,en=null,Iu=!1,ns=!1,Xo=!1,Tu=0,Ml=0,rs=null,W_=0;function Vt(){throw Error(r(321))}function Gp(i,a){if(a===null)return!1;for(var c=0;c<a.length&&c<i.length;c++)if(!er(i[c],a[c]))return!1;return!0}function Yp(i,a,c,d,v,b){return mi=b,nt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,F.H=i===null||i.memoizedState===null?u0:dh,Xo=!1,b=c(d,v),Xo=!1,ns&&(b=_x(a,c,d,v)),Ex(i),b}function Ex(i){F.H=Rl;var a=kt!==null&&kt.next!==null;if(mi=0,en=kt=nt=null,Iu=!1,Ml=0,rs=null,a)throw Error(r(300));i===null||tn||(i=i.dependencies,i!==null&&mu(i)&&(tn=!0))}function _x(i,a,c,d){nt=i;var v=0;do{if(ns&&(rs=null),Ml=0,ns=!1,25<=v)throw Error(r(301));if(v+=1,en=kt=null,i.updateQueue!=null){var b=i.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}F.H=d0,b=a(c,d)}while(ns);return b}function X_(){var i=F.H,a=i.useState()[0];return a=typeof a.then=="function"?Nl(a):a,i=i.useState()[0],(kt!==null?kt.memoizedState:null)!==i&&(nt.flags|=1024),a}function Wp(){var i=Tu!==0;return Tu=0,i}function Xp(i,a,c){a.updateQueue=i.updateQueue,a.flags&=-2053,i.lanes&=~c}function Jp(i){if(Iu){for(i=i.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Iu=!1}mi=0,en=kt=nt=null,ns=!1,Ml=Tu=0,rs=null}function Nn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return en===null?nt.memoizedState=en=i:en=en.next=i,en}function Gt(){if(kt===null){var i=nt.alternate;i=i!==null?i.memoizedState:null}else i=kt.next;var a=en===null?nt.memoizedState:en.next;if(a!==null)en=a,kt=i;else{if(i===null)throw nt.alternate===null?Error(r(467)):Error(r(310));kt=i,i={memoizedState:kt.memoizedState,baseState:kt.baseState,baseQueue:kt.baseQueue,queue:kt.queue,next:null},en===null?nt.memoizedState=en=i:en=en.next=i}return en}function ju(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nl(i){var a=Ml;return Ml+=1,rs===null&&(rs=[]),i=bx(rs,i,a),a=nt,(en===null?a.memoizedState:en.next)===null&&(a=a.alternate,F.H=a===null||a.memoizedState===null?u0:dh),i}function Cu(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Nl(i);if(i.$$typeof===C)return Sn(i)}throw Error(r(438,String(i)))}function eh(i){var a=null,c=nt.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var d=nt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(v){return v.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=ju(),nt.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(i),d=0;d<i;d++)c[d]=q;return a.index++,c}function gi(i,a){return typeof a=="function"?a(i):a}function Eu(i){var a=Gt();return th(a,kt,i)}function th(i,a,c){var d=i.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=c;var v=i.baseQueue,b=d.pending;if(b!==null){if(v!==null){var j=v.next;v.next=b.next,b.next=j}a.baseQueue=v=b,d.pending=null}if(b=i.baseState,v===null)i.memoizedState=b;else{a=v.next;var N=j=null,H=null,ie=a,de=!1;do{var ye=ie.lane&-536870913;if(ye!==ie.lane?(lt&ye)===ye:(mi&ye)===ye){var oe=ie.revertLane;if(oe===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),ye===Wa&&(de=!0);else if((mi&oe)===oe){ie=ie.next,oe===Wa&&(de=!0);continue}else ye={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(N=H=ye,j=b):H=H.next=ye,nt.lanes|=oe,oo|=oe;ye=ie.action,Xo&&c(b,ye),b=ie.hasEagerState?ie.eagerState:c(b,ye)}else oe={lane:ye,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},H===null?(N=H=oe,j=b):H=H.next=oe,nt.lanes|=ye,oo|=ye;ie=ie.next}while(ie!==null&&ie!==a);if(H===null?j=b:H.next=N,!er(b,i.memoizedState)&&(tn=!0,de&&(c=Xa,c!==null)))throw c;i.memoizedState=b,i.baseState=j,i.baseQueue=H,d.lastRenderedState=b}return v===null&&(d.lanes=0),[i.memoizedState,d.dispatch]}function nh(i){var a=Gt(),c=a.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=i;var d=c.dispatch,v=c.pending,b=a.memoizedState;if(v!==null){c.pending=null;var j=v=v.next;do b=i(b,j.action),j=j.next;while(j!==v);er(b,a.memoizedState)||(tn=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),c.lastRenderedState=b}return[b,d]}function Ax(i,a,c){var d=nt,v=Gt(),b=dt;if(b){if(c===void 0)throw Error(r(407));c=c()}else c=a();var j=!er((kt||v).memoizedState,c);if(j&&(v.memoizedState=c,tn=!0),v=v.queue,oh(Px.bind(null,d,v,i),[i]),v.getSnapshot!==a||j||en!==null&&en.memoizedState.tag&1){if(d.flags|=2048,is(9,{destroy:void 0},Nx.bind(null,d,v,c,a),null),Et===null)throw Error(r(349));b||(mi&127)!==0||Mx(d,a,c)}return c}function Mx(i,a,c){i.flags|=16384,i={getSnapshot:a,value:c},a=nt.updateQueue,a===null?(a=ju(),nt.updateQueue=a,a.stores=[i]):(c=a.stores,c===null?a.stores=[i]:c.push(i))}function Nx(i,a,c,d){a.value=c,a.getSnapshot=d,Rx(a)&&Ox(i)}function Px(i,a,c){return c(function(){Rx(a)&&Ox(i)})}function Rx(i){var a=i.getSnapshot;i=i.value;try{var c=a();return!er(i,c)}catch{return!0}}function Ox(i){var a=Ho(i,2);a!==null&&Zn(a,i,2)}function rh(i){var a=Nn();if(typeof i=="function"){var c=i;if(i=c(),Xo){sn(!0);try{c()}finally{sn(!1)}}}return a.memoizedState=a.baseState=i,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gi,lastRenderedState:i},a}function zx(i,a,c,d){return i.baseState=c,th(i,kt,typeof d=="function"?d:gi)}function J_(i,a,c,d,v){if(Mu(i))throw Error(r(485));if(i=a.action,i!==null){var b={payload:v,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){b.listeners.push(j)}};F.T!==null?c(!0):b.isTransition=!1,d(b),c=a.pending,c===null?(b.next=a.pending=b,Dx(a,b)):(b.next=c.next,a.pending=c.next=b)}}function Dx(i,a){var c=a.action,d=a.payload,v=i.state;if(a.isTransition){var b=F.T,j={};F.T=j;try{var N=c(v,d),H=F.S;H!==null&&H(j,N),Lx(i,a,N)}catch(ie){ih(i,a,ie)}finally{b!==null&&j.types!==null&&(b.types=j.types),F.T=b}}else try{b=c(v,d),Lx(i,a,b)}catch(ie){ih(i,a,ie)}}function Lx(i,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){Bx(i,a,d)},function(d){return ih(i,a,d)}):Bx(i,a,c)}function Bx(i,a,c){a.status="fulfilled",a.value=c,qx(a),i.state=c,a=i.pending,a!==null&&(c=a.next,c===a?i.pending=null:(c=c.next,a.next=c,Dx(i,c)))}function ih(i,a,c){var d=i.pending;if(i.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=c,qx(a),a=a.next;while(a!==d)}i.action=null}function qx(i){i=i.listeners;for(var a=0;a<i.length;a++)(0,i[a])()}function $x(i,a){return a}function Ux(i,a){if(dt){var c=Et.formState;if(c!==null){e:{var d=nt;if(dt){if(Pt){t:{for(var v=Pt,b=yr;v.nodeType!==8;){if(!b){v=null;break t}if(v=xr(v.nextSibling),v===null){v=null;break t}}b=v.data,v=b==="F!"||b==="F"?v:null}if(v){Pt=xr(v.nextSibling),d=v.data==="F!";break e}}Yi(d)}d=!1}d&&(a=c[0])}}return c=Nn(),c.memoizedState=c.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$x,lastRenderedState:a},c.queue=d,c=s0.bind(null,nt,d),d.dispatch=c,d=rh(!1),b=uh.bind(null,nt,!1,d.queue),d=Nn(),v={state:a,dispatch:null,action:i,pending:null},d.queue=v,c=J_.bind(null,nt,v,b,c),v.dispatch=c,d.memoizedState=i,[a,c,!1]}function Hx(i){var a=Gt();return Fx(a,kt,i)}function Fx(i,a,c){if(a=th(i,a,$x)[0],i=Eu(gi)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=Nl(a)}catch(j){throw j===Ja?yu:j}else d=a;a=Gt();var v=a.queue,b=v.dispatch;return c!==a.memoizedState&&(nt.flags|=2048,is(9,{destroy:void 0},eA.bind(null,v,c),null)),[d,b,i]}function eA(i,a){i.action=a}function Vx(i){var a=Gt(),c=kt;if(c!==null)return Fx(a,c,i);Gt(),a=a.memoizedState,c=Gt();var d=c.queue.dispatch;return c.memoizedState=i,[a,d,!1]}function is(i,a,c,d){return i={tag:i,create:c,deps:d,inst:a,next:null},a=nt.updateQueue,a===null&&(a=ju(),nt.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=i.next=i:(d=c.next,c.next=i,i.next=d,a.lastEffect=i),i}function Zx(){return Gt().memoizedState}function _u(i,a,c,d){var v=Nn();nt.flags|=i,v.memoizedState=is(1|a,{destroy:void 0},c,d===void 0?null:d)}function Au(i,a,c,d){var v=Gt();d=d===void 0?null:d;var b=v.memoizedState.inst;kt!==null&&d!==null&&Gp(d,kt.memoizedState.deps)?v.memoizedState=is(a,b,c,d):(nt.flags|=i,v.memoizedState=is(1|a,b,c,d))}function Kx(i,a){_u(8390656,8,i,a)}function oh(i,a){Au(2048,8,i,a)}function tA(i){nt.flags|=4;var a=nt.updateQueue;if(a===null)a=ju(),nt.updateQueue=a,a.events=[i];else{var c=a.events;c===null?a.events=[i]:c.push(i)}}function Qx(i){var a=Gt().memoizedState;return tA({ref:a,nextImpl:i}),function(){if((yt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function Gx(i,a){return Au(4,2,i,a)}function Yx(i,a){return Au(4,4,i,a)}function Wx(i,a){if(typeof a=="function"){i=i();var c=a(i);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return i=i(),a.current=i,function(){a.current=null}}function Xx(i,a,c){c=c!=null?c.concat([i]):null,Au(4,4,Wx.bind(null,a,i),c)}function ah(){}function Jx(i,a){var c=Gt();a=a===void 0?null:a;var d=c.memoizedState;return a!==null&&Gp(a,d[1])?d[0]:(c.memoizedState=[i,a],i)}function e0(i,a){var c=Gt();a=a===void 0?null:a;var d=c.memoizedState;if(a!==null&&Gp(a,d[1]))return d[0];if(d=i(),Xo){sn(!0);try{i()}finally{sn(!1)}}return c.memoizedState=[d,a],d}function sh(i,a,c){return c===void 0||(mi&1073741824)!==0&&(lt&261930)===0?i.memoizedState=a:(i.memoizedState=c,i=t1(),nt.lanes|=i,oo|=i,c)}function t0(i,a,c,d){return er(c,a)?c:ts.current!==null?(i=sh(i,c,d),er(i,a)||(tn=!0),i):(mi&42)===0||(mi&1073741824)!==0&&(lt&261930)===0?(tn=!0,i.memoizedState=c):(i=t1(),nt.lanes|=i,oo|=i,a)}function n0(i,a,c,d,v){var b=ee.p;ee.p=b!==0&&8>b?b:8;var j=F.T,N={};F.T=N,uh(i,!1,a,c);try{var H=v(),ie=F.S;if(ie!==null&&ie(N,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var de=Y_(H,d);Pl(i,a,de,ar(i))}else Pl(i,a,d,ar(i))}catch(ye){Pl(i,a,{then:function(){},status:"rejected",reason:ye},ar())}finally{ee.p=b,j!==null&&N.types!==null&&(j.types=N.types),F.T=j}}function nA(){}function lh(i,a,c,d){if(i.tag!==5)throw Error(r(476));var v=r0(i).queue;n0(i,v,a,Q,c===null?nA:function(){return i0(i),c(d)})}function r0(i){var a=i.memoizedState;if(a!==null)return a;a={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gi,lastRenderedState:Q},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:gi,lastRenderedState:c},next:null},i.memoizedState=a,i=i.alternate,i!==null&&(i.memoizedState=a),a}function i0(i){var a=r0(i);a.next===null&&(a=i.alternate.memoizedState),Pl(i,a.next.queue,{},ar())}function ch(){return Sn(Yl)}function o0(){return Gt().memoizedState}function a0(){return Gt().memoizedState}function rA(i){for(var a=i.return;a!==null;){switch(a.tag){case 24:case 3:var c=ar();i=Ji(c);var d=eo(a,i,c);d!==null&&(Zn(d,a,c),El(d,a,c)),a={cache:Lp()},i.payload=a;return}a=a.return}}function iA(i,a,c){var d=ar();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Mu(i)?l0(a,c):(c=Cp(i,a,c,d),c!==null&&(Zn(c,i,d),c0(c,a,d)))}function s0(i,a,c){var d=ar();Pl(i,a,c,d)}function Pl(i,a,c,d){var v={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Mu(i))l0(a,v);else{var b=i.alternate;if(i.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var j=a.lastRenderedState,N=b(j,c);if(v.hasEagerState=!0,v.eagerState=N,er(N,j))return du(i,a,v,0),Et===null&&uu(),!1}catch{}if(c=Cp(i,a,v,d),c!==null)return Zn(c,i,d),c0(c,a,d),!0}return!1}function uh(i,a,c,d){if(d={lane:2,revertLane:Uh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Mu(i)){if(a)throw Error(r(479))}else a=Cp(i,c,d,2),a!==null&&Zn(a,i,2)}function Mu(i){var a=i.alternate;return i===nt||a!==null&&a===nt}function l0(i,a){ns=Iu=!0;var c=i.pending;c===null?a.next=a:(a.next=c.next,c.next=a),i.pending=a}function c0(i,a,c){if((c&4194048)!==0){var d=a.lanes;d&=i.pendingLanes,c|=d,a.lanes=c,hb(i,c)}}var Rl={readContext:Sn,use:Cu,useCallback:Vt,useContext:Vt,useEffect:Vt,useImperativeHandle:Vt,useLayoutEffect:Vt,useInsertionEffect:Vt,useMemo:Vt,useReducer:Vt,useRef:Vt,useState:Vt,useDebugValue:Vt,useDeferredValue:Vt,useTransition:Vt,useSyncExternalStore:Vt,useId:Vt,useHostTransitionStatus:Vt,useFormState:Vt,useActionState:Vt,useOptimistic:Vt,useMemoCache:Vt,useCacheRefresh:Vt};Rl.useEffectEvent=Vt;var u0={readContext:Sn,use:Cu,useCallback:function(i,a){return Nn().memoizedState=[i,a===void 0?null:a],i},useContext:Sn,useEffect:Kx,useImperativeHandle:function(i,a,c){c=c!=null?c.concat([i]):null,_u(4194308,4,Wx.bind(null,a,i),c)},useLayoutEffect:function(i,a){return _u(4194308,4,i,a)},useInsertionEffect:function(i,a){_u(4,2,i,a)},useMemo:function(i,a){var c=Nn();a=a===void 0?null:a;var d=i();if(Xo){sn(!0);try{i()}finally{sn(!1)}}return c.memoizedState=[d,a],d},useReducer:function(i,a,c){var d=Nn();if(c!==void 0){var v=c(a);if(Xo){sn(!0);try{c(a)}finally{sn(!1)}}}else v=a;return d.memoizedState=d.baseState=v,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:v},d.queue=i,i=i.dispatch=iA.bind(null,nt,i),[d.memoizedState,i]},useRef:function(i){var a=Nn();return i={current:i},a.memoizedState=i},useState:function(i){i=rh(i);var a=i.queue,c=s0.bind(null,nt,a);return a.dispatch=c,[i.memoizedState,c]},useDebugValue:ah,useDeferredValue:function(i,a){var c=Nn();return sh(c,i,a)},useTransition:function(){var i=rh(!1);return i=n0.bind(null,nt,i.queue,!0,!1),Nn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,a,c){var d=nt,v=Nn();if(dt){if(c===void 0)throw Error(r(407));c=c()}else{if(c=a(),Et===null)throw Error(r(349));(lt&127)!==0||Mx(d,a,c)}v.memoizedState=c;var b={value:c,getSnapshot:a};return v.queue=b,Kx(Px.bind(null,d,b,i),[i]),d.flags|=2048,is(9,{destroy:void 0},Nx.bind(null,d,b,c,a),null),c},useId:function(){var i=Nn(),a=Et.identifierPrefix;if(dt){var c=$r,d=qr;c=(d&~(1<<32-mt(d)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Tu++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=W_++,a="_"+a+"r_"+c.toString(32)+"_";return i.memoizedState=a},useHostTransitionStatus:ch,useFormState:Ux,useActionState:Ux,useOptimistic:function(i){var a=Nn();a.memoizedState=a.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=uh.bind(null,nt,!0,c),c.dispatch=a,[i,a]},useMemoCache:eh,useCacheRefresh:function(){return Nn().memoizedState=rA.bind(null,nt)},useEffectEvent:function(i){var a=Nn(),c={impl:i};return a.memoizedState=c,function(){if((yt&2)!==0)throw Error(r(440));return c.impl.apply(void 0,arguments)}}},dh={readContext:Sn,use:Cu,useCallback:Jx,useContext:Sn,useEffect:oh,useImperativeHandle:Xx,useInsertionEffect:Gx,useLayoutEffect:Yx,useMemo:e0,useReducer:Eu,useRef:Zx,useState:function(){return Eu(gi)},useDebugValue:ah,useDeferredValue:function(i,a){var c=Gt();return t0(c,kt.memoizedState,i,a)},useTransition:function(){var i=Eu(gi)[0],a=Gt().memoizedState;return[typeof i=="boolean"?i:Nl(i),a]},useSyncExternalStore:Ax,useId:o0,useHostTransitionStatus:ch,useFormState:Hx,useActionState:Hx,useOptimistic:function(i,a){var c=Gt();return zx(c,kt,i,a)},useMemoCache:eh,useCacheRefresh:a0};dh.useEffectEvent=Qx;var d0={readContext:Sn,use:Cu,useCallback:Jx,useContext:Sn,useEffect:oh,useImperativeHandle:Xx,useInsertionEffect:Gx,useLayoutEffect:Yx,useMemo:e0,useReducer:nh,useRef:Zx,useState:function(){return nh(gi)},useDebugValue:ah,useDeferredValue:function(i,a){var c=Gt();return kt===null?sh(c,i,a):t0(c,kt.memoizedState,i,a)},useTransition:function(){var i=nh(gi)[0],a=Gt().memoizedState;return[typeof i=="boolean"?i:Nl(i),a]},useSyncExternalStore:Ax,useId:o0,useHostTransitionStatus:ch,useFormState:Vx,useActionState:Vx,useOptimistic:function(i,a){var c=Gt();return kt!==null?zx(c,kt,i,a):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:eh,useCacheRefresh:a0};d0.useEffectEvent=Qx;function fh(i,a,c,d){a=i.memoizedState,c=c(d,a),c=c==null?a:g({},a,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var ph={enqueueSetState:function(i,a,c){i=i._reactInternals;var d=ar(),v=Ji(d);v.payload=a,c!=null&&(v.callback=c),a=eo(i,v,d),a!==null&&(Zn(a,i,d),El(a,i,d))},enqueueReplaceState:function(i,a,c){i=i._reactInternals;var d=ar(),v=Ji(d);v.tag=1,v.payload=a,c!=null&&(v.callback=c),a=eo(i,v,d),a!==null&&(Zn(a,i,d),El(a,i,d))},enqueueForceUpdate:function(i,a){i=i._reactInternals;var c=ar(),d=Ji(c);d.tag=2,a!=null&&(d.callback=a),a=eo(i,d,c),a!==null&&(Zn(a,i,c),El(a,i,c))}};function f0(i,a,c,d,v,b,j){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,b,j):a.prototype&&a.prototype.isPureReactComponent?!xl(c,d)||!xl(v,b):!0}function p0(i,a,c,d){i=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,d),a.state!==i&&ph.enqueueReplaceState(a,a.state,null)}function Jo(i,a){var c=a;if("ref"in a){c={};for(var d in a)d!=="ref"&&(c[d]=a[d])}if(i=i.defaultProps){c===a&&(c=g({},c));for(var v in i)c[v]===void 0&&(c[v]=i[v])}return c}function h0(i){cu(i)}function m0(i){console.error(i)}function g0(i){cu(i)}function Nu(i,a){try{var c=i.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function v0(i,a,c){try{var d=i.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function hh(i,a,c){return c=Ji(c),c.tag=3,c.payload={element:null},c.callback=function(){Nu(i,a)},c}function y0(i){return i=Ji(i),i.tag=3,i}function b0(i,a,c,d){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var b=d.value;i.payload=function(){return v(b)},i.callback=function(){v0(a,c,d)}}var j=c.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(i.callback=function(){v0(a,c,d),typeof v!="function"&&(ao===null?ao=new Set([this]):ao.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function oA(i,a,c,d,v){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=c.alternate,a!==null&&Ya(a,c,v,!0),c=nr.current,c!==null){switch(c.tag){case 31:case 13:return br===null?Fu():c.alternate===null&&Zt===0&&(Zt=3),c.flags&=-257,c.flags|=65536,c.lanes=v,d===bu?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([d]):a.add(d),Bh(i,d,v)),!1;case 22:return c.flags|=65536,d===bu?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([d]):c.add(d)),Bh(i,d,v)),!1}throw Error(r(435,c.tag))}return Bh(i,d,v),Fu(),!1}if(dt)return a=nr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=v,d!==Pp&&(i=Error(r(422),{cause:d}),kl(mr(i,c)))):(d!==Pp&&(a=Error(r(423),{cause:d}),kl(mr(a,c))),i=i.current.alternate,i.flags|=65536,v&=-v,i.lanes|=v,d=mr(d,c),v=hh(i.stateNode,d,v),Fp(i,v),Zt!==4&&(Zt=2)),!1;var b=Error(r(520),{cause:d});if(b=mr(b,c),Ul===null?Ul=[b]:Ul.push(b),Zt!==4&&(Zt=2),a===null)return!0;d=mr(d,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,i=v&-v,c.lanes|=i,i=hh(c.stateNode,d,i),Fp(c,i),!1;case 1:if(a=c.type,b=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ao===null||!ao.has(b))))return c.flags|=65536,v&=-v,c.lanes|=v,v=y0(v),b0(v,i,c,d),Fp(c,v),!1}c=c.return}while(c!==null);return!1}var mh=Error(r(461)),tn=!1;function kn(i,a,c,d){a.child=i===null?kx(a,null,c,d):Wo(a,i.child,c,d)}function x0(i,a,c,d,v){c=c.render;var b=a.ref;if("ref"in d){var j={};for(var N in d)N!=="ref"&&(j[N]=d[N])}else j=d;return Ko(a),d=Yp(i,a,c,j,b,v),N=Wp(),i!==null&&!tn?(Xp(i,a,v),vi(i,a,v)):(dt&&N&&Mp(a),a.flags|=1,kn(i,a,d,v),a.child)}function w0(i,a,c,d,v){if(i===null){var b=c.type;return typeof b=="function"&&!Ep(b)&&b.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=b,S0(i,a,b,d,v)):(i=pu(c.type,null,d,a,a.mode,v),i.ref=a.ref,i.return=a,a.child=i)}if(b=i.child,!kh(i,v)){var j=b.memoizedProps;if(c=c.compare,c=c!==null?c:xl,c(j,d)&&i.ref===a.ref)return vi(i,a,v)}return a.flags|=1,i=di(b,d),i.ref=a.ref,i.return=a,a.child=i}function S0(i,a,c,d,v){if(i!==null){var b=i.memoizedProps;if(xl(b,d)&&i.ref===a.ref)if(tn=!1,a.pendingProps=d=b,kh(i,v))(i.flags&131072)!==0&&(tn=!0);else return a.lanes=i.lanes,vi(i,a,v)}return gh(i,a,c,d,v)}function k0(i,a,c,d){var v=d.children,b=i!==null?i.memoizedState:null;if(i===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|c:c,i!==null){for(d=a.child=i.child,v=0;d!==null;)v=v|d.lanes|d.childLanes,d=d.sibling;d=v&~b}else d=0,a.child=null;return I0(i,a,b,c,d)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},i!==null&&vu(a,b!==null?b.cachePool:null),b!==null?jx(a,b):Zp(),Cx(a);else return d=a.lanes=536870912,I0(i,a,b!==null?b.baseLanes|c:c,c,d)}else b!==null?(vu(a,b.cachePool),jx(a,b),no(),a.memoizedState=null):(i!==null&&vu(a,null),Zp(),no());return kn(i,a,v,c),a.child}function Ol(i,a){return i!==null&&i.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function I0(i,a,c,d,v){var b=qp();return b=b===null?null:{parent:Jt._currentValue,pool:b},a.memoizedState={baseLanes:c,cachePool:b},i!==null&&vu(a,null),Zp(),Cx(a),i!==null&&Ya(i,a,d,!0),a.childLanes=v,null}function Pu(i,a){return a=Ou({mode:a.mode,children:a.children},i.mode),a.ref=i.ref,i.child=a,a.return=i,a}function T0(i,a,c){return Wo(a,i.child,null,c),i=Pu(a,a.pendingProps),i.flags|=2,rr(a),a.memoizedState=null,i}function aA(i,a,c){var d=a.pendingProps,v=(a.flags&128)!==0;if(a.flags&=-129,i===null){if(dt){if(d.mode==="hidden")return i=Pu(a,d),a.lanes=536870912,Ol(null,i);if(Qp(a),(i=Pt)?(i=D1(i,yr),i=i!==null&&i.data==="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:qr,overflow:$r}:null,retryLane:536870912,hydrationErrors:null},c=lx(i),c.return=a,a.child=c,wn=a,Pt=null)):i=null,i===null)throw Yi(a);return a.lanes=536870912,null}return Pu(a,d)}var b=i.memoizedState;if(b!==null){var j=b.dehydrated;if(Qp(a),v)if(a.flags&256)a.flags&=-257,a=T0(i,a,c);else if(a.memoizedState!==null)a.child=i.child,a.flags|=128,a=null;else throw Error(r(558));else if(tn||Ya(i,a,c,!1),v=(c&i.childLanes)!==0,tn||v){if(d=Et,d!==null&&(j=mb(d,c),j!==0&&j!==b.retryLane))throw b.retryLane=j,Ho(i,j),Zn(d,i,j),mh;Fu(),a=T0(i,a,c)}else i=b.treeContext,Pt=xr(j.nextSibling),wn=a,dt=!0,Gi=null,yr=!1,i!==null&&dx(a,i),a=Pu(a,d),a.flags|=4096;return a}return i=di(i.child,{mode:d.mode,children:d.children}),i.ref=a.ref,a.child=i,i.return=a,i}function Ru(i,a){var c=a.ref;if(c===null)i!==null&&i.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(r(284));(i===null||i.ref!==c)&&(a.flags|=4194816)}}function gh(i,a,c,d,v){return Ko(a),c=Yp(i,a,c,d,void 0,v),d=Wp(),i!==null&&!tn?(Xp(i,a,v),vi(i,a,v)):(dt&&d&&Mp(a),a.flags|=1,kn(i,a,c,v),a.child)}function j0(i,a,c,d,v,b){return Ko(a),a.updateQueue=null,c=_x(a,d,c,v),Ex(i),d=Wp(),i!==null&&!tn?(Xp(i,a,b),vi(i,a,b)):(dt&&d&&Mp(a),a.flags|=1,kn(i,a,c,b),a.child)}function C0(i,a,c,d,v){if(Ko(a),a.stateNode===null){var b=Za,j=c.contextType;typeof j=="object"&&j!==null&&(b=Sn(j)),b=new c(d,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=ph,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=d,b.state=a.memoizedState,b.refs={},Up(a),j=c.contextType,b.context=typeof j=="object"&&j!==null?Sn(j):Za,b.state=a.memoizedState,j=c.getDerivedStateFromProps,typeof j=="function"&&(fh(a,c,j,d),b.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(j=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),j!==b.state&&ph.enqueueReplaceState(b,b.state,null),Al(a,d,b,v),_l(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(i===null){b=a.stateNode;var N=a.memoizedProps,H=Jo(c,N);b.props=H;var ie=b.context,de=c.contextType;j=Za,typeof de=="object"&&de!==null&&(j=Sn(de));var ye=c.getDerivedStateFromProps;de=typeof ye=="function"||typeof b.getSnapshotBeforeUpdate=="function",N=a.pendingProps!==N,de||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(N||ie!==j)&&p0(a,b,d,j),Xi=!1;var oe=a.memoizedState;b.state=oe,Al(a,d,b,v),_l(),ie=a.memoizedState,N||oe!==ie||Xi?(typeof ye=="function"&&(fh(a,c,ye,d),ie=a.memoizedState),(H=Xi||f0(a,c,H,d,oe,ie,j))?(de||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=ie),b.props=d,b.state=ie,b.context=j,d=H):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{b=a.stateNode,Hp(i,a),j=a.memoizedProps,de=Jo(c,j),b.props=de,ye=a.pendingProps,oe=b.context,ie=c.contextType,H=Za,typeof ie=="object"&&ie!==null&&(H=Sn(ie)),N=c.getDerivedStateFromProps,(ie=typeof N=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(j!==ye||oe!==H)&&p0(a,b,d,H),Xi=!1,oe=a.memoizedState,b.state=oe,Al(a,d,b,v),_l();var se=a.memoizedState;j!==ye||oe!==se||Xi||i!==null&&i.dependencies!==null&&mu(i.dependencies)?(typeof N=="function"&&(fh(a,c,N,d),se=a.memoizedState),(de=Xi||f0(a,c,de,d,oe,se,H)||i!==null&&i.dependencies!==null&&mu(i.dependencies))?(ie||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(d,se,H),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(d,se,H)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=se),b.props=d,b.state=se,b.context=H,d=de):(typeof b.componentDidUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&oe===i.memoizedState||(a.flags|=1024),d=!1)}return b=d,Ru(i,a),d=(a.flags&128)!==0,b||d?(b=a.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,i!==null&&d?(a.child=Wo(a,i.child,null,v),a.child=Wo(a,null,c,v)):kn(i,a,c,v),a.memoizedState=b.state,i=a.child):i=vi(i,a,v),i}function E0(i,a,c,d){return Vo(),a.flags|=256,kn(i,a,c,d),a.child}var vh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yh(i){return{baseLanes:i,cachePool:vx()}}function bh(i,a,c){return i=i!==null?i.childLanes&~c:0,a&&(i|=or),i}function _0(i,a,c){var d=a.pendingProps,v=!1,b=(a.flags&128)!==0,j;if((j=b)||(j=i!==null&&i.memoizedState===null?!1:(Qt.current&2)!==0),j&&(v=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,i===null){if(dt){if(v?to(a):no(),(i=Pt)?(i=D1(i,yr),i=i!==null&&i.data!=="&"?i:null,i!==null&&(a.memoizedState={dehydrated:i,treeContext:Qi!==null?{id:qr,overflow:$r}:null,retryLane:536870912,hydrationErrors:null},c=lx(i),c.return=a,a.child=c,wn=a,Pt=null)):i=null,i===null)throw Yi(a);return tm(i)?a.lanes=32:a.lanes=536870912,null}var N=d.children;return d=d.fallback,v?(no(),v=a.mode,N=Ou({mode:"hidden",children:N},v),d=Fo(d,v,c,null),N.return=a,d.return=a,N.sibling=d,a.child=N,d=a.child,d.memoizedState=yh(c),d.childLanes=bh(i,j,c),a.memoizedState=vh,Ol(null,d)):(to(a),xh(a,N))}var H=i.memoizedState;if(H!==null&&(N=H.dehydrated,N!==null)){if(b)a.flags&256?(to(a),a.flags&=-257,a=wh(i,a,c)):a.memoizedState!==null?(no(),a.child=i.child,a.flags|=128,a=null):(no(),N=d.fallback,v=a.mode,d=Ou({mode:"visible",children:d.children},v),N=Fo(N,v,c,null),N.flags|=2,d.return=a,N.return=a,d.sibling=N,a.child=d,Wo(a,i.child,null,c),d=a.child,d.memoizedState=yh(c),d.childLanes=bh(i,j,c),a.memoizedState=vh,a=Ol(null,d));else if(to(a),tm(N)){if(j=N.nextSibling&&N.nextSibling.dataset,j)var ie=j.dgst;j=ie,d=Error(r(419)),d.stack="",d.digest=j,kl({value:d,source:null,stack:null}),a=wh(i,a,c)}else if(tn||Ya(i,a,c,!1),j=(c&i.childLanes)!==0,tn||j){if(j=Et,j!==null&&(d=mb(j,c),d!==0&&d!==H.retryLane))throw H.retryLane=d,Ho(i,d),Zn(j,i,d),mh;em(N)||Fu(),a=wh(i,a,c)}else em(N)?(a.flags|=192,a.child=i.child,a=null):(i=H.treeContext,Pt=xr(N.nextSibling),wn=a,dt=!0,Gi=null,yr=!1,i!==null&&dx(a,i),a=xh(a,d.children),a.flags|=4096);return a}return v?(no(),N=d.fallback,v=a.mode,H=i.child,ie=H.sibling,d=di(H,{mode:"hidden",children:d.children}),d.subtreeFlags=H.subtreeFlags&65011712,ie!==null?N=di(ie,N):(N=Fo(N,v,c,null),N.flags|=2),N.return=a,d.return=a,d.sibling=N,a.child=d,Ol(null,d),d=a.child,N=i.child.memoizedState,N===null?N=yh(c):(v=N.cachePool,v!==null?(H=Jt._currentValue,v=v.parent!==H?{parent:H,pool:H}:v):v=vx(),N={baseLanes:N.baseLanes|c,cachePool:v}),d.memoizedState=N,d.childLanes=bh(i,j,c),a.memoizedState=vh,Ol(i.child,d)):(to(a),c=i.child,i=c.sibling,c=di(c,{mode:"visible",children:d.children}),c.return=a,c.sibling=null,i!==null&&(j=a.deletions,j===null?(a.deletions=[i],a.flags|=16):j.push(i)),a.child=c,a.memoizedState=null,c)}function xh(i,a){return a=Ou({mode:"visible",children:a},i.mode),a.return=i,i.child=a}function Ou(i,a){return i=tr(22,i,null,a),i.lanes=0,i}function wh(i,a,c){return Wo(a,i.child,null,c),i=xh(a,a.pendingProps.children),i.flags|=2,a.memoizedState=null,i}function A0(i,a,c){i.lanes|=a;var d=i.alternate;d!==null&&(d.lanes|=a),zp(i.return,a,c)}function Sh(i,a,c,d,v,b){var j=i.memoizedState;j===null?i.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:v,treeForkCount:b}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=c,j.tailMode=v,j.treeForkCount=b)}function M0(i,a,c){var d=a.pendingProps,v=d.revealOrder,b=d.tail;d=d.children;var j=Qt.current,N=(j&2)!==0;if(N?(j=j&1|2,a.flags|=128):j&=1,A(Qt,j),kn(i,a,d,c),d=dt?Sl:0,!N&&i!==null&&(i.flags&128)!==0)e:for(i=a.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&A0(i,c,a);else if(i.tag===19)A0(i,c,a);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===a)break e;for(;i.sibling===null;){if(i.return===null||i.return===a)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(v){case"forwards":for(c=a.child,v=null;c!==null;)i=c.alternate,i!==null&&ku(i)===null&&(v=c),c=c.sibling;c=v,c===null?(v=a.child,a.child=null):(v=c.sibling,c.sibling=null),Sh(a,!1,v,c,b,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,v=a.child,a.child=null;v!==null;){if(i=v.alternate,i!==null&&ku(i)===null){a.child=v;break}i=v.sibling,v.sibling=c,c=v,v=i}Sh(a,!0,c,null,b,d);break;case"together":Sh(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function vi(i,a,c){if(i!==null&&(a.dependencies=i.dependencies),oo|=a.lanes,(c&a.childLanes)===0)if(i!==null){if(Ya(i,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(i!==null&&a.child!==i.child)throw Error(r(153));if(a.child!==null){for(i=a.child,c=di(i,i.pendingProps),a.child=c,c.return=a;i.sibling!==null;)i=i.sibling,c=c.sibling=di(i,i.pendingProps),c.return=a;c.sibling=null}return a.child}function kh(i,a){return(i.lanes&a)!==0?!0:(i=i.dependencies,!!(i!==null&&mu(i)))}function sA(i,a,c){switch(a.tag){case 3:ge(a,a.stateNode.containerInfo),Wi(a,Jt,i.memoizedState.cache),Vo();break;case 27:case 5:B(a);break;case 4:ge(a,a.stateNode.containerInfo);break;case 10:Wi(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Qp(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(to(a),a.flags|=128,null):(c&a.child.childLanes)!==0?_0(i,a,c):(to(a),i=vi(i,a,c),i!==null?i.sibling:null);to(a);break;case 19:var v=(i.flags&128)!==0;if(d=(c&a.childLanes)!==0,d||(Ya(i,a,c,!1),d=(c&a.childLanes)!==0),v){if(d)return M0(i,a,c);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),A(Qt,Qt.current),d)break;return null;case 22:return a.lanes=0,k0(i,a,c,a.pendingProps);case 24:Wi(a,Jt,i.memoizedState.cache)}return vi(i,a,c)}function N0(i,a,c){if(i!==null)if(i.memoizedProps!==a.pendingProps)tn=!0;else{if(!kh(i,c)&&(a.flags&128)===0)return tn=!1,sA(i,a,c);tn=(i.flags&131072)!==0}else tn=!1,dt&&(a.flags&1048576)!==0&&ux(a,Sl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(i=Go(a.elementType),a.type=i,typeof i=="function")Ep(i)?(d=Jo(i,d),a.tag=1,a=C0(null,a,i,d,c)):(a.tag=0,a=gh(null,a,i,d,c));else{if(i!=null){var v=i.$$typeof;if(v===E){a.tag=11,a=x0(null,a,i,d,c);break e}else if(v===R){a.tag=14,a=w0(null,a,i,d,c);break e}}throw a=J(i)||i,Error(r(306,a,""))}}return a;case 0:return gh(i,a,a.type,a.pendingProps,c);case 1:return d=a.type,v=Jo(d,a.pendingProps),C0(i,a,d,v,c);case 3:e:{if(ge(a,a.stateNode.containerInfo),i===null)throw Error(r(387));d=a.pendingProps;var b=a.memoizedState;v=b.element,Hp(i,a),Al(a,d,null,c);var j=a.memoizedState;if(d=j.cache,Wi(a,Jt,d),d!==b.cache&&Dp(a,[Jt],c,!0),_l(),d=j.element,b.isDehydrated)if(b={element:d,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=E0(i,a,d,c);break e}else if(d!==v){v=mr(Error(r(424)),a),kl(v),a=E0(i,a,d,c);break e}else for(i=a.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Pt=xr(i.firstChild),wn=a,dt=!0,Gi=null,yr=!0,c=kx(a,null,d,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Vo(),d===v){a=vi(i,a,c);break e}kn(i,a,d,c)}a=a.child}return a;case 26:return Ru(i,a),i===null?(c=H1(a.type,null,a.pendingProps,null))?a.memoizedState=c:dt||(c=a.type,i=a.pendingProps,d=Wu(ue.current).createElement(c),d[xn]=a,d[qn]=i,In(d,c,i),hn(d),a.stateNode=d):a.memoizedState=H1(a.type,i.memoizedProps,a.pendingProps,i.memoizedState),null;case 27:return B(a),i===null&&dt&&(d=a.stateNode=q1(a.type,a.pendingProps,ue.current),wn=a,yr=!0,v=Pt,uo(a.type)?(nm=v,Pt=xr(d.firstChild)):Pt=v),kn(i,a,a.pendingProps.children,c),Ru(i,a),i===null&&(a.flags|=4194304),a.child;case 5:return i===null&&dt&&((v=d=Pt)&&(d=DA(d,a.type,a.pendingProps,yr),d!==null?(a.stateNode=d,wn=a,Pt=xr(d.firstChild),yr=!1,v=!0):v=!1),v||Yi(a)),B(a),v=a.type,b=a.pendingProps,j=i!==null?i.memoizedProps:null,d=b.children,Wh(v,b)?d=null:j!==null&&Wh(v,j)&&(a.flags|=32),a.memoizedState!==null&&(v=Yp(i,a,X_,null,null,c),Yl._currentValue=v),Ru(i,a),kn(i,a,d,c),a.child;case 6:return i===null&&dt&&((i=c=Pt)&&(c=LA(c,a.pendingProps,yr),c!==null?(a.stateNode=c,wn=a,Pt=null,i=!0):i=!1),i||Yi(a)),null;case 13:return _0(i,a,c);case 4:return ge(a,a.stateNode.containerInfo),d=a.pendingProps,i===null?a.child=Wo(a,null,d,c):kn(i,a,d,c),a.child;case 11:return x0(i,a,a.type,a.pendingProps,c);case 7:return kn(i,a,a.pendingProps,c),a.child;case 8:return kn(i,a,a.pendingProps.children,c),a.child;case 12:return kn(i,a,a.pendingProps.children,c),a.child;case 10:return d=a.pendingProps,Wi(a,a.type,d.value),kn(i,a,d.children,c),a.child;case 9:return v=a.type._context,d=a.pendingProps.children,Ko(a),v=Sn(v),d=d(v),a.flags|=1,kn(i,a,d,c),a.child;case 14:return w0(i,a,a.type,a.pendingProps,c);case 15:return S0(i,a,a.type,a.pendingProps,c);case 19:return M0(i,a,c);case 31:return aA(i,a,c);case 22:return k0(i,a,c,a.pendingProps);case 24:return Ko(a),d=Sn(Jt),i===null?(v=qp(),v===null&&(v=Et,b=Lp(),v.pooledCache=b,b.refCount++,b!==null&&(v.pooledCacheLanes|=c),v=b),a.memoizedState={parent:d,cache:v},Up(a),Wi(a,Jt,v)):((i.lanes&c)!==0&&(Hp(i,a),Al(a,null,null,c),_l()),v=i.memoizedState,b=a.memoizedState,v.parent!==d?(v={parent:d,cache:d},a.memoizedState=v,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=v),Wi(a,Jt,d)):(d=b.cache,Wi(a,Jt,d),d!==v.cache&&Dp(a,[Jt],c,!0))),kn(i,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function yi(i){i.flags|=4}function Ih(i,a,c,d,v){if((a=(i.mode&32)!==0)&&(a=!1),a){if(i.flags|=16777216,(v&335544128)===v)if(i.stateNode.complete)i.flags|=8192;else if(o1())i.flags|=8192;else throw Yo=bu,$p}else i.flags&=-16777217}function P0(i,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!Q1(a))if(o1())i.flags|=8192;else throw Yo=bu,$p}function zu(i,a){a!==null&&(i.flags|=4),i.flags&16384&&(a=i.tag!==22?fb():536870912,i.lanes|=a,ls|=a)}function zl(i,a){if(!dt)switch(i.tailMode){case"hidden":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?a||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function Rt(i){var a=i.alternate!==null&&i.alternate.child===i.child,c=0,d=0;if(a)for(var v=i.child;v!==null;)c|=v.lanes|v.childLanes,d|=v.subtreeFlags&65011712,d|=v.flags&65011712,v.return=i,v=v.sibling;else for(v=i.child;v!==null;)c|=v.lanes|v.childLanes,d|=v.subtreeFlags,d|=v.flags,v.return=i,v=v.sibling;return i.subtreeFlags|=d,i.childLanes=c,a}function lA(i,a,c){var d=a.pendingProps;switch(Np(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Rt(a),null;case 1:return Rt(a),null;case 3:return c=a.stateNode,d=null,i!==null&&(d=i.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),hi(Jt),Se(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(Ga(a)?yi(a):i===null||i.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Rp())),Rt(a),null;case 26:var v=a.type,b=a.memoizedState;return i===null?(yi(a),b!==null?(Rt(a),P0(a,b)):(Rt(a),Ih(a,v,null,d,c))):b?b!==i.memoizedState?(yi(a),Rt(a),P0(a,b)):(Rt(a),a.flags&=-16777217):(i=i.memoizedProps,i!==d&&yi(a),Rt(a),Ih(a,v,i,d,c)),null;case 27:if(U(a),c=ue.current,v=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==d&&yi(a);else{if(!d){if(a.stateNode===null)throw Error(r(166));return Rt(a),null}i=L.current,Ga(a)?fx(a):(i=q1(v,d,c),a.stateNode=i,yi(a))}return Rt(a),null;case 5:if(U(a),v=a.type,i!==null&&a.stateNode!=null)i.memoizedProps!==d&&yi(a);else{if(!d){if(a.stateNode===null)throw Error(r(166));return Rt(a),null}if(b=L.current,Ga(a))fx(a);else{var j=Wu(ue.current);switch(b){case 1:b=j.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:b=j.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":b=j.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":b=j.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":b=j.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?b.multiple=!0:d.size&&(b.size=d.size);break;default:b=typeof d.is=="string"?j.createElement(v,{is:d.is}):j.createElement(v)}}b[xn]=a,b[qn]=d;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)b.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=b;e:switch(In(b,v,d),v){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&yi(a)}}return Rt(a),Ih(a,a.type,i===null?null:i.memoizedProps,a.pendingProps,c),null;case 6:if(i&&a.stateNode!=null)i.memoizedProps!==d&&yi(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(r(166));if(i=ue.current,Ga(a)){if(i=a.stateNode,c=a.memoizedProps,d=null,v=wn,v!==null)switch(v.tag){case 27:case 5:d=v.memoizedProps}i[xn]=a,i=!!(i.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||_1(i.nodeValue,c)),i||Yi(a,!0)}else i=Wu(i).createTextNode(d),i[xn]=a,a.stateNode=i}return Rt(a),null;case 31:if(c=a.memoizedState,i===null||i.memoizedState!==null){if(d=Ga(a),c!==null){if(i===null){if(!d)throw Error(r(318));if(i=a.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[xn]=a}else Vo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Rt(a),i=!1}else c=Rp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return a.flags&256?(rr(a),a):(rr(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Rt(a),null;case 13:if(d=a.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(v=Ga(a),d!==null&&d.dehydrated!==null){if(i===null){if(!v)throw Error(r(318));if(v=a.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(r(317));v[xn]=a}else Vo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Rt(a),v=!1}else v=Rp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=v),v=!0;if(!v)return a.flags&256?(rr(a),a):(rr(a),null)}return rr(a),(a.flags&128)!==0?(a.lanes=c,a):(c=d!==null,i=i!==null&&i.memoizedState!==null,c&&(d=a.child,v=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(v=d.alternate.memoizedState.cachePool.pool),b=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),b!==v&&(d.flags|=2048)),c!==i&&c&&(a.child.flags|=8192),zu(a,a.updateQueue),Rt(a),null);case 4:return Se(),i===null&&Zh(a.stateNode.containerInfo),Rt(a),null;case 10:return hi(a.type),Rt(a),null;case 19:if(te(Qt),d=a.memoizedState,d===null)return Rt(a),null;if(v=(a.flags&128)!==0,b=d.rendering,b===null)if(v)zl(d,!1);else{if(Zt!==0||i!==null&&(i.flags&128)!==0)for(i=a.child;i!==null;){if(b=ku(i),b!==null){for(a.flags|=128,zl(d,!1),i=b.updateQueue,a.updateQueue=i,zu(a,i),a.subtreeFlags=0,i=c,c=a.child;c!==null;)sx(c,i),c=c.sibling;return A(Qt,Qt.current&1|2),dt&&fi(a,d.treeForkCount),a.child}i=i.sibling}d.tail!==null&&an()>$u&&(a.flags|=128,v=!0,zl(d,!1),a.lanes=4194304)}else{if(!v)if(i=ku(b),i!==null){if(a.flags|=128,v=!0,i=i.updateQueue,a.updateQueue=i,zu(a,i),zl(d,!0),d.tail===null&&d.tailMode==="hidden"&&!b.alternate&&!dt)return Rt(a),null}else 2*an()-d.renderingStartTime>$u&&c!==536870912&&(a.flags|=128,v=!0,zl(d,!1),a.lanes=4194304);d.isBackwards?(b.sibling=a.child,a.child=b):(i=d.last,i!==null?i.sibling=b:a.child=b,d.last=b)}return d.tail!==null?(i=d.tail,d.rendering=i,d.tail=i.sibling,d.renderingStartTime=an(),i.sibling=null,c=Qt.current,A(Qt,v?c&1|2:c&1),dt&&fi(a,d.treeForkCount),i):(Rt(a),null);case 22:case 23:return rr(a),Kp(),d=a.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(c&536870912)!==0&&(a.flags&128)===0&&(Rt(a),a.subtreeFlags&6&&(a.flags|=8192)):Rt(a),c=a.updateQueue,c!==null&&zu(a,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==c&&(a.flags|=2048),i!==null&&te(Qo),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),hi(Jt),Rt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function cA(i,a){switch(Np(a),a.tag){case 1:return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return hi(Jt),Se(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 26:case 27:case 5:return U(a),null;case 31:if(a.memoizedState!==null){if(rr(a),a.alternate===null)throw Error(r(340));Vo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 13:if(rr(a),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Vo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return te(Qt),null;case 4:return Se(),null;case 10:return hi(a.type),null;case 22:case 23:return rr(a),Kp(),i!==null&&te(Qo),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 24:return hi(Jt),null;case 25:return null;default:return null}}function R0(i,a){switch(Np(a),a.tag){case 3:hi(Jt),Se();break;case 26:case 27:case 5:U(a);break;case 4:Se();break;case 31:a.memoizedState!==null&&rr(a);break;case 13:rr(a);break;case 19:te(Qt);break;case 10:hi(a.type);break;case 22:case 23:rr(a),Kp(),i!==null&&te(Qo);break;case 24:hi(Jt)}}function Dl(i,a){try{var c=a.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var v=d.next;c=v;do{if((c.tag&i)===i){d=void 0;var b=c.create,j=c.inst;d=b(),j.destroy=d}c=c.next}while(c!==v)}}catch(N){wt(a,a.return,N)}}function ro(i,a,c){try{var d=a.updateQueue,v=d!==null?d.lastEffect:null;if(v!==null){var b=v.next;d=b;do{if((d.tag&i)===i){var j=d.inst,N=j.destroy;if(N!==void 0){j.destroy=void 0,v=a;var H=c,ie=N;try{ie()}catch(de){wt(v,H,de)}}}d=d.next}while(d!==b)}}catch(de){wt(a,a.return,de)}}function O0(i){var a=i.updateQueue;if(a!==null){var c=i.stateNode;try{Tx(a,c)}catch(d){wt(i,i.return,d)}}}function z0(i,a,c){c.props=Jo(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(d){wt(i,a,d)}}function Ll(i,a){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:d=i.stateNode;break;default:d=i.stateNode}typeof c=="function"?i.refCleanup=c(d):c.current=d}}catch(v){wt(i,a,v)}}function Ur(i,a){var c=i.ref,d=i.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(v){wt(i,a,v)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){wt(i,a,v)}else c.current=null}function D0(i){var a=i.type,c=i.memoizedProps,d=i.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(v){wt(i,i.return,v)}}function Th(i,a,c){try{var d=i.stateNode;MA(d,i.type,c,a),d[qn]=a}catch(v){wt(i,i.return,v)}}function L0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&uo(i.type)||i.tag===4}function jh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||L0(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&uo(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Ch(i,a,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(i),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=ci));else if(d!==4&&(d===27&&uo(i.type)&&(c=i.stateNode,a=null),i=i.child,i!==null))for(Ch(i,a,c),i=i.sibling;i!==null;)Ch(i,a,c),i=i.sibling}function Du(i,a,c){var d=i.tag;if(d===5||d===6)i=i.stateNode,a?c.insertBefore(i,a):c.appendChild(i);else if(d!==4&&(d===27&&uo(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(Du(i,a,c),i=i.sibling;i!==null;)Du(i,a,c),i=i.sibling}function B0(i){var a=i.stateNode,c=i.memoizedProps;try{for(var d=i.type,v=a.attributes;v.length;)a.removeAttributeNode(v[0]);In(a,d,c),a[xn]=i,a[qn]=c}catch(b){wt(i,i.return,b)}}var bi=!1,nn=!1,Eh=!1,q0=typeof WeakSet=="function"?WeakSet:Set,mn=null;function uA(i,a){if(i=i.containerInfo,Gh=id,i=Xb(i),wp(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else e:{c=(c=i.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var v=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{c.nodeType,b.nodeType}catch{c=null;break e}var j=0,N=-1,H=-1,ie=0,de=0,ye=i,oe=null;t:for(;;){for(var se;ye!==c||v!==0&&ye.nodeType!==3||(N=j+v),ye!==b||d!==0&&ye.nodeType!==3||(H=j+d),ye.nodeType===3&&(j+=ye.nodeValue.length),(se=ye.firstChild)!==null;)oe=ye,ye=se;for(;;){if(ye===i)break t;if(oe===c&&++ie===v&&(N=j),oe===b&&++de===d&&(H=j),(se=ye.nextSibling)!==null)break;ye=oe,oe=ye.parentNode}ye=se}c=N===-1||H===-1?null:{start:N,end:H}}else c=null}c=c||{start:0,end:0}}else c=null;for(Yh={focusedElem:i,selectionRange:c},id=!1,mn=a;mn!==null;)if(a=mn,i=a.child,(a.subtreeFlags&1028)!==0&&i!==null)i.return=a,mn=i;else for(;mn!==null;){switch(a=mn,b=a.alternate,i=a.flags,a.tag){case 0:if((i&4)!==0&&(i=a.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)v=i[c],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&b!==null){i=void 0,c=a,v=b.memoizedProps,b=b.memoizedState,d=c.stateNode;try{var Pe=Jo(c.type,v);i=d.getSnapshotBeforeUpdate(Pe,b),d.__reactInternalSnapshotBeforeUpdate=i}catch(Ve){wt(c,c.return,Ve)}}break;case 3:if((i&1024)!==0){if(i=a.stateNode.containerInfo,c=i.nodeType,c===9)Jh(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Jh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=a.sibling,i!==null){i.return=a.return,mn=i;break}mn=a.return}}function $0(i,a,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:wi(i,c),d&4&&Dl(5,c);break;case 1:if(wi(i,c),d&4)if(i=c.stateNode,a===null)try{i.componentDidMount()}catch(j){wt(c,c.return,j)}else{var v=Jo(c.type,a.memoizedProps);a=a.memoizedState;try{i.componentDidUpdate(v,a,i.__reactInternalSnapshotBeforeUpdate)}catch(j){wt(c,c.return,j)}}d&64&&O0(c),d&512&&Ll(c,c.return);break;case 3:if(wi(i,c),d&64&&(i=c.updateQueue,i!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{Tx(i,a)}catch(j){wt(c,c.return,j)}}break;case 27:a===null&&d&4&&B0(c);case 26:case 5:wi(i,c),a===null&&d&4&&D0(c),d&512&&Ll(c,c.return);break;case 12:wi(i,c);break;case 31:wi(i,c),d&4&&F0(i,c);break;case 13:wi(i,c),d&4&&V0(i,c),d&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=bA.bind(null,c),BA(i,c))));break;case 22:if(d=c.memoizedState!==null||bi,!d){a=a!==null&&a.memoizedState!==null||nn,v=bi;var b=nn;bi=d,(nn=a)&&!b?Si(i,c,(c.subtreeFlags&8772)!==0):wi(i,c),bi=v,nn=b}break;case 30:break;default:wi(i,c)}}function U0(i){var a=i.alternate;a!==null&&(i.alternate=null,U0(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&ip(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var Lt=null,Un=!1;function xi(i,a,c){for(c=c.child;c!==null;)H0(i,a,c),c=c.sibling}function H0(i,a,c){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(ft,c)}catch{}switch(c.tag){case 26:nn||Ur(c,a),xi(i,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:nn||Ur(c,a);var d=Lt,v=Un;uo(c.type)&&(Lt=c.stateNode,Un=!1),xi(i,a,c),Kl(c.stateNode),Lt=d,Un=v;break;case 5:nn||Ur(c,a);case 6:if(d=Lt,v=Un,Lt=null,xi(i,a,c),Lt=d,Un=v,Lt!==null)if(Un)try{(Lt.nodeType===9?Lt.body:Lt.nodeName==="HTML"?Lt.ownerDocument.body:Lt).removeChild(c.stateNode)}catch(b){wt(c,a,b)}else try{Lt.removeChild(c.stateNode)}catch(b){wt(c,a,b)}break;case 18:Lt!==null&&(Un?(i=Lt,O1(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),gs(i)):O1(Lt,c.stateNode));break;case 4:d=Lt,v=Un,Lt=c.stateNode.containerInfo,Un=!0,xi(i,a,c),Lt=d,Un=v;break;case 0:case 11:case 14:case 15:ro(2,c,a),nn||ro(4,c,a),xi(i,a,c);break;case 1:nn||(Ur(c,a),d=c.stateNode,typeof d.componentWillUnmount=="function"&&z0(c,a,d)),xi(i,a,c);break;case 21:xi(i,a,c);break;case 22:nn=(d=nn)||c.memoizedState!==null,xi(i,a,c),nn=d;break;default:xi(i,a,c)}}function F0(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{gs(i)}catch(c){wt(a,a.return,c)}}}function V0(i,a){if(a.memoizedState===null&&(i=a.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{gs(i)}catch(c){wt(a,a.return,c)}}function dA(i){switch(i.tag){case 31:case 13:case 19:var a=i.stateNode;return a===null&&(a=i.stateNode=new q0),a;case 22:return i=i.stateNode,a=i._retryCache,a===null&&(a=i._retryCache=new q0),a;default:throw Error(r(435,i.tag))}}function Lu(i,a){var c=dA(i);a.forEach(function(d){if(!c.has(d)){c.add(d);var v=xA.bind(null,i,d);d.then(v,v)}})}function Hn(i,a){var c=a.deletions;if(c!==null)for(var d=0;d<c.length;d++){var v=c[d],b=i,j=a,N=j;e:for(;N!==null;){switch(N.tag){case 27:if(uo(N.type)){Lt=N.stateNode,Un=!1;break e}break;case 5:Lt=N.stateNode,Un=!1;break e;case 3:case 4:Lt=N.stateNode.containerInfo,Un=!0;break e}N=N.return}if(Lt===null)throw Error(r(160));H0(b,j,v),Lt=null,Un=!1,b=v.alternate,b!==null&&(b.return=null),v.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Z0(a,i),a=a.sibling}var Ar=null;function Z0(i,a){var c=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Hn(a,i),Fn(i),d&4&&(ro(3,i,i.return),Dl(3,i),ro(5,i,i.return));break;case 1:Hn(a,i),Fn(i),d&512&&(nn||c===null||Ur(c,c.return)),d&64&&bi&&(i=i.updateQueue,i!==null&&(d=i.callbacks,d!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var v=Ar;if(Hn(a,i),Fn(i),d&512&&(nn||c===null||Ur(c,c.return)),d&4){var b=c!==null?c.memoizedState:null;if(d=i.memoizedState,c===null)if(d===null)if(i.stateNode===null){e:{d=i.type,c=i.memoizedProps,v=v.ownerDocument||v;t:switch(d){case"title":b=v.getElementsByTagName("title")[0],(!b||b[dl]||b[xn]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=v.createElement(d),v.head.insertBefore(b,v.querySelector("head > title"))),In(b,d,c),b[xn]=i,hn(b),d=b;break e;case"link":var j=Z1("link","href",v).get(d+(c.href||""));if(j){for(var N=0;N<j.length;N++)if(b=j[N],b.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&b.getAttribute("rel")===(c.rel==null?null:c.rel)&&b.getAttribute("title")===(c.title==null?null:c.title)&&b.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){j.splice(N,1);break t}}b=v.createElement(d),In(b,d,c),v.head.appendChild(b);break;case"meta":if(j=Z1("meta","content",v).get(d+(c.content||""))){for(N=0;N<j.length;N++)if(b=j[N],b.getAttribute("content")===(c.content==null?null:""+c.content)&&b.getAttribute("name")===(c.name==null?null:c.name)&&b.getAttribute("property")===(c.property==null?null:c.property)&&b.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&b.getAttribute("charset")===(c.charSet==null?null:c.charSet)){j.splice(N,1);break t}}b=v.createElement(d),In(b,d,c),v.head.appendChild(b);break;default:throw Error(r(468,d))}b[xn]=i,hn(b),d=b}i.stateNode=d}else K1(v,i.type,i.stateNode);else i.stateNode=V1(v,d,i.memoizedProps);else b!==d?(b===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):b.count--,d===null?K1(v,i.type,i.stateNode):V1(v,d,i.memoizedProps)):d===null&&i.stateNode!==null&&Th(i,i.memoizedProps,c.memoizedProps)}break;case 27:Hn(a,i),Fn(i),d&512&&(nn||c===null||Ur(c,c.return)),c!==null&&d&4&&Th(i,i.memoizedProps,c.memoizedProps);break;case 5:if(Hn(a,i),Fn(i),d&512&&(nn||c===null||Ur(c,c.return)),i.flags&32){v=i.stateNode;try{Ba(v,"")}catch(Pe){wt(i,i.return,Pe)}}d&4&&i.stateNode!=null&&(v=i.memoizedProps,Th(i,v,c!==null?c.memoizedProps:v)),d&1024&&(Eh=!0);break;case 6:if(Hn(a,i),Fn(i),d&4){if(i.stateNode===null)throw Error(r(162));d=i.memoizedProps,c=i.stateNode;try{c.nodeValue=d}catch(Pe){wt(i,i.return,Pe)}}break;case 3:if(ed=null,v=Ar,Ar=Xu(a.containerInfo),Hn(a,i),Ar=v,Fn(i),d&4&&c!==null&&c.memoizedState.isDehydrated)try{gs(a.containerInfo)}catch(Pe){wt(i,i.return,Pe)}Eh&&(Eh=!1,K0(i));break;case 4:d=Ar,Ar=Xu(i.stateNode.containerInfo),Hn(a,i),Fn(i),Ar=d;break;case 12:Hn(a,i),Fn(i);break;case 31:Hn(a,i),Fn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Lu(i,d)));break;case 13:Hn(a,i),Fn(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(qu=an()),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Lu(i,d)));break;case 22:v=i.memoizedState!==null;var H=c!==null&&c.memoizedState!==null,ie=bi,de=nn;if(bi=ie||v,nn=de||H,Hn(a,i),nn=de,bi=ie,Fn(i),d&8192)e:for(a=i.stateNode,a._visibility=v?a._visibility&-2:a._visibility|1,v&&(c===null||H||bi||nn||ea(i)),c=null,a=i;;){if(a.tag===5||a.tag===26){if(c===null){H=c=a;try{if(b=H.stateNode,v)j=b.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{N=H.stateNode;var ye=H.memoizedProps.style,oe=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;N.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Pe){wt(H,H.return,Pe)}}}else if(a.tag===6){if(c===null){H=a;try{H.stateNode.nodeValue=v?"":H.memoizedProps}catch(Pe){wt(H,H.return,Pe)}}}else if(a.tag===18){if(c===null){H=a;try{var se=H.stateNode;v?z1(se,!0):z1(H.stateNode,!1)}catch(Pe){wt(H,H.return,Pe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===i)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break e;for(;a.sibling===null;){if(a.return===null||a.return===i)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=i.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Lu(i,c))));break;case 19:Hn(a,i),Fn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Lu(i,d)));break;case 30:break;case 21:break;default:Hn(a,i),Fn(i)}}function Fn(i){var a=i.flags;if(a&2){try{for(var c,d=i.return;d!==null;){if(L0(d)){c=d;break}d=d.return}if(c==null)throw Error(r(160));switch(c.tag){case 27:var v=c.stateNode,b=jh(i);Du(i,b,v);break;case 5:var j=c.stateNode;c.flags&32&&(Ba(j,""),c.flags&=-33);var N=jh(i);Du(i,N,j);break;case 3:case 4:var H=c.stateNode.containerInfo,ie=jh(i);Ch(i,ie,H);break;default:throw Error(r(161))}}catch(de){wt(i,i.return,de)}i.flags&=-3}a&4096&&(i.flags&=-4097)}function K0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var a=i;K0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),i=i.sibling}}function wi(i,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)$0(i,a.alternate,a),a=a.sibling}function ea(i){for(i=i.child;i!==null;){var a=i;switch(a.tag){case 0:case 11:case 14:case 15:ro(4,a,a.return),ea(a);break;case 1:Ur(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&z0(a,a.return,c),ea(a);break;case 27:Kl(a.stateNode);case 26:case 5:Ur(a,a.return),ea(a);break;case 22:a.memoizedState===null&&ea(a);break;case 30:ea(a);break;default:ea(a)}i=i.sibling}}function Si(i,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,v=i,b=a,j=b.flags;switch(b.tag){case 0:case 11:case 15:Si(v,b,c),Dl(4,b);break;case 1:if(Si(v,b,c),d=b,v=d.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ie){wt(d,d.return,ie)}if(d=b,v=d.updateQueue,v!==null){var N=d.stateNode;try{var H=v.shared.hiddenCallbacks;if(H!==null)for(v.shared.hiddenCallbacks=null,v=0;v<H.length;v++)Ix(H[v],N)}catch(ie){wt(d,d.return,ie)}}c&&j&64&&O0(b),Ll(b,b.return);break;case 27:B0(b);case 26:case 5:Si(v,b,c),c&&d===null&&j&4&&D0(b),Ll(b,b.return);break;case 12:Si(v,b,c);break;case 31:Si(v,b,c),c&&j&4&&F0(v,b);break;case 13:Si(v,b,c),c&&j&4&&V0(v,b);break;case 22:b.memoizedState===null&&Si(v,b,c),Ll(b,b.return);break;case 30:break;default:Si(v,b,c)}a=a.sibling}}function _h(i,a){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&Il(c))}function Ah(i,a){i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Il(i))}function Mr(i,a,c,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Q0(i,a,c,d),a=a.sibling}function Q0(i,a,c,d){var v=a.flags;switch(a.tag){case 0:case 11:case 15:Mr(i,a,c,d),v&2048&&Dl(9,a);break;case 1:Mr(i,a,c,d);break;case 3:Mr(i,a,c,d),v&2048&&(i=null,a.alternate!==null&&(i=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==i&&(a.refCount++,i!=null&&Il(i)));break;case 12:if(v&2048){Mr(i,a,c,d),i=a.stateNode;try{var b=a.memoizedProps,j=b.id,N=b.onPostCommit;typeof N=="function"&&N(j,a.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(H){wt(a,a.return,H)}}else Mr(i,a,c,d);break;case 31:Mr(i,a,c,d);break;case 13:Mr(i,a,c,d);break;case 23:break;case 22:b=a.stateNode,j=a.alternate,a.memoizedState!==null?b._visibility&2?Mr(i,a,c,d):Bl(i,a):b._visibility&2?Mr(i,a,c,d):(b._visibility|=2,os(i,a,c,d,(a.subtreeFlags&10256)!==0||!1)),v&2048&&_h(j,a);break;case 24:Mr(i,a,c,d),v&2048&&Ah(a.alternate,a);break;default:Mr(i,a,c,d)}}function os(i,a,c,d,v){for(v=v&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=i,j=a,N=c,H=d,ie=j.flags;switch(j.tag){case 0:case 11:case 15:os(b,j,N,H,v),Dl(8,j);break;case 23:break;case 22:var de=j.stateNode;j.memoizedState!==null?de._visibility&2?os(b,j,N,H,v):Bl(b,j):(de._visibility|=2,os(b,j,N,H,v)),v&&ie&2048&&_h(j.alternate,j);break;case 24:os(b,j,N,H,v),v&&ie&2048&&Ah(j.alternate,j);break;default:os(b,j,N,H,v)}a=a.sibling}}function Bl(i,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=i,d=a,v=d.flags;switch(d.tag){case 22:Bl(c,d),v&2048&&_h(d.alternate,d);break;case 24:Bl(c,d),v&2048&&Ah(d.alternate,d);break;default:Bl(c,d)}a=a.sibling}}var ql=8192;function as(i,a,c){if(i.subtreeFlags&ql)for(i=i.child;i!==null;)G0(i,a,c),i=i.sibling}function G0(i,a,c){switch(i.tag){case 26:as(i,a,c),i.flags&ql&&i.memoizedState!==null&&WA(c,Ar,i.memoizedState,i.memoizedProps);break;case 5:as(i,a,c);break;case 3:case 4:var d=Ar;Ar=Xu(i.stateNode.containerInfo),as(i,a,c),Ar=d;break;case 22:i.memoizedState===null&&(d=i.alternate,d!==null&&d.memoizedState!==null?(d=ql,ql=16777216,as(i,a,c),ql=d):as(i,a,c));break;default:as(i,a,c)}}function Y0(i){var a=i.alternate;if(a!==null&&(i=a.child,i!==null)){a.child=null;do a=i.sibling,i.sibling=null,i=a;while(i!==null)}}function $l(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];mn=d,X0(d,i)}Y0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)W0(i),i=i.sibling}function W0(i){switch(i.tag){case 0:case 11:case 15:$l(i),i.flags&2048&&ro(9,i,i.return);break;case 3:$l(i);break;case 12:$l(i);break;case 22:var a=i.stateNode;i.memoizedState!==null&&a._visibility&2&&(i.return===null||i.return.tag!==13)?(a._visibility&=-3,Bu(i)):$l(i);break;default:$l(i)}}function Bu(i){var a=i.deletions;if((i.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var d=a[c];mn=d,X0(d,i)}Y0(i)}for(i=i.child;i!==null;){switch(a=i,a.tag){case 0:case 11:case 15:ro(8,a,a.return),Bu(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Bu(a));break;default:Bu(a)}i=i.sibling}}function X0(i,a){for(;mn!==null;){var c=mn;switch(c.tag){case 0:case 11:case 15:ro(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Il(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,mn=d;else e:for(c=i;mn!==null;){d=mn;var v=d.sibling,b=d.return;if(U0(d),d===c){mn=null;break e}if(v!==null){v.return=b,mn=v;break e}mn=b}}}var fA={getCacheForType:function(i){var a=Sn(Jt),c=a.data.get(i);return c===void 0&&(c=i(),a.data.set(i,c)),c},cacheSignal:function(){return Sn(Jt).controller.signal}},pA=typeof WeakMap=="function"?WeakMap:Map,yt=0,Et=null,ot=null,lt=0,xt=0,ir=null,io=!1,ss=!1,Mh=!1,ki=0,Zt=0,oo=0,ta=0,Nh=0,or=0,ls=0,Ul=null,Vn=null,Ph=!1,qu=0,J0=0,$u=1/0,Uu=null,ao=null,ln=0,so=null,cs=null,Ii=0,Rh=0,Oh=null,e1=null,Hl=0,zh=null;function ar(){return(yt&2)!==0&&lt!==0?lt&-lt:F.T!==null?Uh():gb()}function t1(){if(or===0)if((lt&536870912)===0||dt){var i=Mn;Mn<<=1,(Mn&3932160)===0&&(Mn=262144),or=i}else or=536870912;return i=nr.current,i!==null&&(i.flags|=32),or}function Zn(i,a,c){(i===Et&&(xt===2||xt===9)||i.cancelPendingCommit!==null)&&(us(i,0),lo(i,lt,or,!1)),ul(i,c),((yt&2)===0||i!==Et)&&(i===Et&&((yt&2)===0&&(ta|=c),Zt===4&&lo(i,lt,or,!1)),Hr(i))}function n1(i,a,c){if((yt&6)!==0)throw Error(r(327));var d=!c&&(a&127)===0&&(a&i.expiredLanes)===0||cl(i,a),v=d?gA(i,a):Lh(i,a,!0),b=d;do{if(v===0){ss&&!d&&lo(i,a,0,!1);break}else{if(c=i.current.alternate,b&&!hA(c)){v=Lh(i,a,!1),b=!1;continue}if(v===2){if(b=a,i.errorRecoveryDisabledLanes&b)var j=0;else j=i.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var N=i;v=Ul;var H=N.current.memoizedState.isDehydrated;if(H&&(us(N,j).flags|=256),j=Lh(N,j,!1),j!==2){if(Mh&&!H){N.errorRecoveryDisabledLanes|=b,ta|=b,v=4;break e}b=Vn,Vn=v,b!==null&&(Vn===null?Vn=b:Vn.push.apply(Vn,b))}v=j}if(b=!1,v!==2)continue}}if(v===1){us(i,0),lo(i,a,0,!0);break}e:{switch(d=i,b=v,b){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:lo(d,a,or,!io);break e;case 2:Vn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(v=qu+300-an(),10<v)){if(lo(d,a,or,!io),Xc(d,0,!0)!==0)break e;Ii=a,d.timeoutHandle=P1(r1.bind(null,d,c,Vn,Uu,Ph,a,or,ta,ls,io,b,"Throttled",-0,0),v);break e}r1(d,c,Vn,Uu,Ph,a,or,ta,ls,io,b,null,-0,0)}}break}while(!0);Hr(i)}function r1(i,a,c,d,v,b,j,N,H,ie,de,ye,oe,se){if(i.timeoutHandle=-1,ye=a.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ci},G0(a,b,ye);var Pe=(b&62914560)===b?qu-an():(b&4194048)===b?J0-an():0;if(Pe=XA(ye,Pe),Pe!==null){Ii=b,i.cancelPendingCommit=Pe(d1.bind(null,i,a,b,c,d,v,j,N,H,de,ye,null,oe,se)),lo(i,b,j,!ie);return}}d1(i,a,b,c,d,v,j,N,H)}function hA(i){for(var a=i;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var v=c[d],b=v.getSnapshot;v=v.value;try{if(!er(b(),v))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function lo(i,a,c,d){a&=~Nh,a&=~ta,i.suspendedLanes|=a,i.pingedLanes&=~a,d&&(i.warmLanes|=a),d=i.expirationTimes;for(var v=a;0<v;){var b=31-mt(v),j=1<<b;d[b]=-1,v&=~j}c!==0&&pb(i,c,a)}function Hu(){return(yt&6)===0?(Fl(0),!1):!0}function Dh(){if(ot!==null){if(xt===0)var i=ot.return;else i=ot,pi=Zo=null,Jp(i),es=null,jl=0,i=ot;for(;i!==null;)R0(i.alternate,i),i=i.return;ot=null}}function us(i,a){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,RA(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Ii=0,Dh(),Et=i,ot=c=di(i.current,null),lt=a,xt=0,ir=null,io=!1,ss=cl(i,a),Mh=!1,ls=or=Nh=ta=oo=Zt=0,Vn=Ul=null,Ph=!1,(a&8)!==0&&(a|=a&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=a;0<d;){var v=31-mt(d),b=1<<v;a|=i[v],d&=~b}return ki=a,uu(),c}function i1(i,a){nt=null,F.H=Rl,a===Ja||a===yu?(a=xx(),xt=3):a===$p?(a=xx(),xt=4):xt=a===mh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ir=a,ot===null&&(Zt=1,Nu(i,mr(a,i.current)))}function o1(){var i=nr.current;return i===null?!0:(lt&4194048)===lt?br===null:(lt&62914560)===lt||(lt&536870912)!==0?i===br:!1}function a1(){var i=F.H;return F.H=Rl,i===null?Rl:i}function s1(){var i=F.A;return F.A=fA,i}function Fu(){Zt=4,io||(lt&4194048)!==lt&&nr.current!==null||(ss=!0),(oo&134217727)===0&&(ta&134217727)===0||Et===null||lo(Et,lt,or,!1)}function Lh(i,a,c){var d=yt;yt|=2;var v=a1(),b=s1();(Et!==i||lt!==a)&&(Uu=null,us(i,a)),a=!1;var j=Zt;e:do try{if(xt!==0&&ot!==null){var N=ot,H=ir;switch(xt){case 8:Dh(),j=6;break e;case 3:case 2:case 9:case 6:nr.current===null&&(a=!0);var ie=xt;if(xt=0,ir=null,ds(i,N,H,ie),c&&ss){j=0;break e}break;default:ie=xt,xt=0,ir=null,ds(i,N,H,ie)}}mA(),j=Zt;break}catch(de){i1(i,de)}while(!0);return a&&i.shellSuspendCounter++,pi=Zo=null,yt=d,F.H=v,F.A=b,ot===null&&(Et=null,lt=0,uu()),j}function mA(){for(;ot!==null;)l1(ot)}function gA(i,a){var c=yt;yt|=2;var d=a1(),v=s1();Et!==i||lt!==a?(Uu=null,$u=an()+500,us(i,a)):ss=cl(i,a);e:do try{if(xt!==0&&ot!==null){a=ot;var b=ir;t:switch(xt){case 1:xt=0,ir=null,ds(i,a,b,1);break;case 2:case 9:if(yx(b)){xt=0,ir=null,c1(a);break}a=function(){xt!==2&&xt!==9||Et!==i||(xt=7),Hr(i)},b.then(a,a);break e;case 3:xt=7;break e;case 4:xt=5;break e;case 7:yx(b)?(xt=0,ir=null,c1(a)):(xt=0,ir=null,ds(i,a,b,7));break;case 5:var j=null;switch(ot.tag){case 26:j=ot.memoizedState;case 5:case 27:var N=ot;if(j?Q1(j):N.stateNode.complete){xt=0,ir=null;var H=N.sibling;if(H!==null)ot=H;else{var ie=N.return;ie!==null?(ot=ie,Vu(ie)):ot=null}break t}}xt=0,ir=null,ds(i,a,b,5);break;case 6:xt=0,ir=null,ds(i,a,b,6);break;case 8:Dh(),Zt=6;break e;default:throw Error(r(462))}}vA();break}catch(de){i1(i,de)}while(!0);return pi=Zo=null,F.H=d,F.A=v,yt=c,ot!==null?0:(Et=null,lt=0,uu(),Zt)}function vA(){for(;ot!==null&&!Lo();)l1(ot)}function l1(i){var a=N0(i.alternate,i,ki);i.memoizedProps=i.pendingProps,a===null?Vu(i):ot=a}function c1(i){var a=i,c=a.alternate;switch(a.tag){case 15:case 0:a=j0(c,a,a.pendingProps,a.type,void 0,lt);break;case 11:a=j0(c,a,a.pendingProps,a.type.render,a.ref,lt);break;case 5:Jp(a);default:R0(c,a),a=ot=sx(a,ki),a=N0(c,a,ki)}i.memoizedProps=i.pendingProps,a===null?Vu(i):ot=a}function ds(i,a,c,d){pi=Zo=null,Jp(a),es=null,jl=0;var v=a.return;try{if(oA(i,v,a,c,lt)){Zt=1,Nu(i,mr(c,i.current)),ot=null;return}}catch(b){if(v!==null)throw ot=v,b;Zt=1,Nu(i,mr(c,i.current)),ot=null;return}a.flags&32768?(dt||d===1?i=!0:ss||(lt&536870912)!==0?i=!1:(io=i=!0,(d===2||d===9||d===3||d===6)&&(d=nr.current,d!==null&&d.tag===13&&(d.flags|=16384))),u1(a,i)):Vu(a)}function Vu(i){var a=i;do{if((a.flags&32768)!==0){u1(a,io);return}i=a.return;var c=lA(a.alternate,a,ki);if(c!==null){ot=c;return}if(a=a.sibling,a!==null){ot=a;return}ot=a=i}while(a!==null);Zt===0&&(Zt=5)}function u1(i,a){do{var c=cA(i.alternate,i);if(c!==null){c.flags&=32767,ot=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(i=i.sibling,i!==null)){ot=i;return}ot=i=c}while(i!==null);Zt=6,ot=null}function d1(i,a,c,d,v,b,j,N,H){i.cancelPendingCommit=null;do Zu();while(ln!==0);if((yt&6)!==0)throw Error(r(327));if(a!==null){if(a===i.current)throw Error(r(177));if(b=a.lanes|a.childLanes,b|=jp,YE(i,c,b,j,N,H),i===Et&&(ot=Et=null,lt=0),cs=a,so=i,Ii=c,Rh=b,Oh=v,e1=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,wA(Le,function(){return g1(),null})):(i.callbackNode=null,i.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=F.T,F.T=null,v=ee.p,ee.p=2,j=yt,yt|=4;try{uA(i,a,c)}finally{yt=j,ee.p=v,F.T=d}}ln=1,f1(),p1(),h1()}}function f1(){if(ln===1){ln=0;var i=so,a=cs,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=F.T,F.T=null;var d=ee.p;ee.p=2;var v=yt;yt|=4;try{Z0(a,i);var b=Yh,j=Xb(i.containerInfo),N=b.focusedElem,H=b.selectionRange;if(j!==N&&N&&N.ownerDocument&&Wb(N.ownerDocument.documentElement,N)){if(H!==null&&wp(N)){var ie=H.start,de=H.end;if(de===void 0&&(de=ie),"selectionStart"in N)N.selectionStart=ie,N.selectionEnd=Math.min(de,N.value.length);else{var ye=N.ownerDocument||document,oe=ye&&ye.defaultView||window;if(oe.getSelection){var se=oe.getSelection(),Pe=N.textContent.length,Ve=Math.min(H.start,Pe),Tt=H.end===void 0?Ve:Math.min(H.end,Pe);!se.extend&&Ve>Tt&&(j=Tt,Tt=Ve,Ve=j);var W=Yb(N,Ve),V=Yb(N,Tt);if(W&&V&&(se.rangeCount!==1||se.anchorNode!==W.node||se.anchorOffset!==W.offset||se.focusNode!==V.node||se.focusOffset!==V.offset)){var re=ye.createRange();re.setStart(W.node,W.offset),se.removeAllRanges(),Ve>Tt?(se.addRange(re),se.extend(V.node,V.offset)):(re.setEnd(V.node,V.offset),se.addRange(re))}}}}for(ye=[],se=N;se=se.parentNode;)se.nodeType===1&&ye.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<ye.length;N++){var me=ye[N];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}id=!!Gh,Yh=Gh=null}finally{yt=v,ee.p=d,F.T=c}}i.current=a,ln=2}}function p1(){if(ln===2){ln=0;var i=so,a=cs,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=F.T,F.T=null;var d=ee.p;ee.p=2;var v=yt;yt|=4;try{$0(i,a.alternate,a)}finally{yt=v,ee.p=d,F.T=c}}ln=3}}function h1(){if(ln===4||ln===3){ln=0,oi();var i=so,a=cs,c=Ii,d=e1;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?ln=5:(ln=0,cs=so=null,m1(i,i.pendingLanes));var v=i.pendingLanes;if(v===0&&(ao=null),np(c),a=a.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(ft,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=F.T,v=ee.p,ee.p=2,F.T=null;try{for(var b=i.onRecoverableError,j=0;j<d.length;j++){var N=d[j];b(N.value,{componentStack:N.stack})}}finally{F.T=a,ee.p=v}}(Ii&3)!==0&&Zu(),Hr(i),v=i.pendingLanes,(c&261930)!==0&&(v&42)!==0?i===zh?Hl++:(Hl=0,zh=i):Hl=0,Fl(0)}}function m1(i,a){(i.pooledCacheLanes&=a)===0&&(a=i.pooledCache,a!=null&&(i.pooledCache=null,Il(a)))}function Zu(){return f1(),p1(),h1(),g1()}function g1(){if(ln!==5)return!1;var i=so,a=Rh;Rh=0;var c=np(Ii),d=F.T,v=ee.p;try{ee.p=32>c?32:c,F.T=null,c=Oh,Oh=null;var b=so,j=Ii;if(ln=0,cs=so=null,Ii=0,(yt&6)!==0)throw Error(r(331));var N=yt;if(yt|=4,W0(b.current),Q0(b,b.current,j,c),yt=N,Fl(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(ft,b)}catch{}return!0}finally{ee.p=v,F.T=d,m1(i,a)}}function v1(i,a,c){a=mr(c,a),a=hh(i.stateNode,a,2),i=eo(i,a,2),i!==null&&(ul(i,2),Hr(i))}function wt(i,a,c){if(i.tag===3)v1(i,i,c);else for(;a!==null;){if(a.tag===3){v1(a,i,c);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ao===null||!ao.has(d))){i=mr(c,i),c=y0(2),d=eo(a,c,2),d!==null&&(b0(c,d,a,i),ul(d,2),Hr(d));break}}a=a.return}}function Bh(i,a,c){var d=i.pingCache;if(d===null){d=i.pingCache=new pA;var v=new Set;d.set(a,v)}else v=d.get(a),v===void 0&&(v=new Set,d.set(a,v));v.has(c)||(Mh=!0,v.add(c),i=yA.bind(null,i,a,c),a.then(i,i))}function yA(i,a,c){var d=i.pingCache;d!==null&&d.delete(a),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,Et===i&&(lt&c)===c&&(Zt===4||Zt===3&&(lt&62914560)===lt&&300>an()-qu?(yt&2)===0&&us(i,0):Nh|=c,ls===lt&&(ls=0)),Hr(i)}function y1(i,a){a===0&&(a=fb()),i=Ho(i,a),i!==null&&(ul(i,a),Hr(i))}function bA(i){var a=i.memoizedState,c=0;a!==null&&(c=a.retryLane),y1(i,c)}function xA(i,a){var c=0;switch(i.tag){case 31:case 13:var d=i.stateNode,v=i.memoizedState;v!==null&&(c=v.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(a),y1(i,c)}function wA(i,a){return dr(i,a)}var Ku=null,fs=null,qh=!1,Qu=!1,$h=!1,co=0;function Hr(i){i!==fs&&i.next===null&&(fs===null?Ku=fs=i:fs=fs.next=i),Qu=!0,qh||(qh=!0,kA())}function Fl(i,a){if(!$h&&Qu){$h=!0;do for(var c=!1,d=Ku;d!==null;){if(i!==0){var v=d.pendingLanes;if(v===0)var b=0;else{var j=d.suspendedLanes,N=d.pingedLanes;b=(1<<31-mt(42|i)+1)-1,b&=v&~(j&~N),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(c=!0,S1(d,b))}else b=lt,b=Xc(d,d===Et?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(b&3)===0||cl(d,b)||(c=!0,S1(d,b));d=d.next}while(c);$h=!1}}function SA(){b1()}function b1(){Qu=qh=!1;var i=0;co!==0&&PA()&&(i=co);for(var a=an(),c=null,d=Ku;d!==null;){var v=d.next,b=x1(d,a);b===0?(d.next=null,c===null?Ku=v:c.next=v,v===null&&(fs=c)):(c=d,(i!==0||(b&3)!==0)&&(Qu=!0)),d=v}ln!==0&&ln!==5||Fl(i),co!==0&&(co=0)}function x1(i,a){for(var c=i.suspendedLanes,d=i.pingedLanes,v=i.expirationTimes,b=i.pendingLanes&-62914561;0<b;){var j=31-mt(b),N=1<<j,H=v[j];H===-1?((N&c)===0||(N&d)!==0)&&(v[j]=GE(N,a)):H<=a&&(i.expiredLanes|=N),b&=~N}if(a=Et,c=lt,c=Xc(i,i===a?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d=i.callbackNode,c===0||i===a&&(xt===2||xt===9)||i.cancelPendingCommit!==null)return d!==null&&d!==null&&Lr(d),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||cl(i,c)){if(a=c&-c,a===i.callbackPriority)return a;switch(d!==null&&Lr(d),np(c)){case 2:case 8:c=Ie;break;case 32:c=Le;break;case 268435456:c=je;break;default:c=Le}return d=w1.bind(null,i),c=dr(c,d),i.callbackPriority=a,i.callbackNode=c,a}return d!==null&&d!==null&&Lr(d),i.callbackPriority=2,i.callbackNode=null,2}function w1(i,a){if(ln!==0&&ln!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(Zu()&&i.callbackNode!==c)return null;var d=lt;return d=Xc(i,i===Et?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d===0?null:(n1(i,d,a),x1(i,an()),i.callbackNode!=null&&i.callbackNode===c?w1.bind(null,i):null)}function S1(i,a){if(Zu())return null;n1(i,a,!0)}function kA(){OA(function(){(yt&6)!==0?dr(pe,SA):b1()})}function Uh(){if(co===0){var i=Wa;i===0&&(i=$t,$t<<=1,($t&261888)===0&&($t=256)),co=i}return co}function k1(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:nu(""+i)}function I1(i,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,i.id&&c.setAttribute("form",i.id),a.parentNode.insertBefore(c,a),i=new FormData(i),c.parentNode.removeChild(c),i}function IA(i,a,c,d,v){if(a==="submit"&&c&&c.stateNode===v){var b=k1((v[qn]||null).action),j=d.submitter;j&&(a=(a=j[qn]||null)?k1(a.formAction):j.getAttribute("formAction"),a!==null&&(b=a,j=null));var N=new au("action","action",null,d,v);i.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(co!==0){var H=j?I1(v,j):new FormData(v);lh(c,{pending:!0,data:H,method:v.method,action:b},null,H)}}else typeof b=="function"&&(N.preventDefault(),H=j?I1(v,j):new FormData(v),lh(c,{pending:!0,data:H,method:v.method,action:b},b,H))},currentTarget:v}]})}}for(var Hh=0;Hh<Tp.length;Hh++){var Fh=Tp[Hh],TA=Fh.toLowerCase(),jA=Fh[0].toUpperCase()+Fh.slice(1);_r(TA,"on"+jA)}_r(tx,"onAnimationEnd"),_r(nx,"onAnimationIteration"),_r(rx,"onAnimationStart"),_r("dblclick","onDoubleClick"),_r("focusin","onFocus"),_r("focusout","onBlur"),_r(U_,"onTransitionRun"),_r(H_,"onTransitionStart"),_r(F_,"onTransitionCancel"),_r(ix,"onTransitionEnd"),Da("onMouseEnter",["mouseout","mouseover"]),Da("onMouseLeave",["mouseout","mouseover"]),Da("onPointerEnter",["pointerout","pointerover"]),Da("onPointerLeave",["pointerout","pointerover"]),Bo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bo("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vl="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(" "),CA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vl));function T1(i,a){a=(a&4)!==0;for(var c=0;c<i.length;c++){var d=i[c],v=d.event;d=d.listeners;e:{var b=void 0;if(a)for(var j=d.length-1;0<=j;j--){var N=d[j],H=N.instance,ie=N.currentTarget;if(N=N.listener,H!==b&&v.isPropagationStopped())break e;b=N,v.currentTarget=ie;try{b(v)}catch(de){cu(de)}v.currentTarget=null,b=H}else for(j=0;j<d.length;j++){if(N=d[j],H=N.instance,ie=N.currentTarget,N=N.listener,H!==b&&v.isPropagationStopped())break e;b=N,v.currentTarget=ie;try{b(v)}catch(de){cu(de)}v.currentTarget=null,b=H}}}}function at(i,a){var c=a[rp];c===void 0&&(c=a[rp]=new Set);var d=i+"__bubble";c.has(d)||(j1(a,i,2,!1),c.add(d))}function Vh(i,a,c){var d=0;a&&(d|=4),j1(c,i,d,a)}var Gu="_reactListening"+Math.random().toString(36).slice(2);function Zh(i){if(!i[Gu]){i[Gu]=!0,bb.forEach(function(c){c!=="selectionchange"&&(CA.has(c)||Vh(c,!1,i),Vh(c,!0,i))});var a=i.nodeType===9?i:i.ownerDocument;a===null||a[Gu]||(a[Gu]=!0,Vh("selectionchange",!1,a))}}function j1(i,a,c,d){switch(tw(a)){case 2:var v=tM;break;case 8:v=nM;break;default:v=sm}c=v.bind(null,a,c,i),v=void 0,!fp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),d?v!==void 0?i.addEventListener(a,c,{capture:!0,passive:v}):i.addEventListener(a,c,!0):v!==void 0?i.addEventListener(a,c,{passive:v}):i.addEventListener(a,c,!1)}function Kh(i,a,c,d,v){var b=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var N=d.stateNode.containerInfo;if(N===v)break;if(j===4)for(j=d.return;j!==null;){var H=j.tag;if((H===3||H===4)&&j.stateNode.containerInfo===v)return;j=j.return}for(;N!==null;){if(j=Ra(N),j===null)return;if(H=j.tag,H===5||H===6||H===26||H===27){d=b=j;continue e}N=N.parentNode}}d=d.return}Mb(function(){var ie=b,de=up(c),ye=[];e:{var oe=ox.get(i);if(oe!==void 0){var se=au,Pe=i;switch(i){case"keypress":if(iu(c)===0)break e;case"keydown":case"keyup":se=x_;break;case"focusin":Pe="focus",se=gp;break;case"focusout":Pe="blur",se=gp;break;case"beforeblur":case"afterblur":se=gp;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=Rb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=l_;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=k_;break;case tx:case nx:case rx:se=d_;break;case ix:se=T_;break;case"scroll":case"scrollend":se=a_;break;case"wheel":se=C_;break;case"copy":case"cut":case"paste":se=p_;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=zb;break;case"toggle":case"beforetoggle":se=__}var Ve=(a&4)!==0,Tt=!Ve&&(i==="scroll"||i==="scrollend"),W=Ve?oe!==null?oe+"Capture":null:oe;Ve=[];for(var V=ie,re;V!==null;){var me=V;if(re=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||re===null||W===null||(me=pl(V,W),me!=null&&Ve.push(Zl(V,me,re))),Tt)break;V=V.return}0<Ve.length&&(oe=new se(oe,Pe,null,c,de),ye.push({event:oe,listeners:Ve}))}}if((a&7)===0){e:{if(oe=i==="mouseover"||i==="pointerover",se=i==="mouseout"||i==="pointerout",oe&&c!==cp&&(Pe=c.relatedTarget||c.fromElement)&&(Ra(Pe)||Pe[Pa]))break e;if((se||oe)&&(oe=de.window===de?de:(oe=de.ownerDocument)?oe.defaultView||oe.parentWindow:window,se?(Pe=c.relatedTarget||c.toElement,se=ie,Pe=Pe?Ra(Pe):null,Pe!==null&&(Tt=s(Pe),Ve=Pe.tag,Pe!==Tt||Ve!==5&&Ve!==27&&Ve!==6)&&(Pe=null)):(se=null,Pe=ie),se!==Pe)){if(Ve=Rb,me="onMouseLeave",W="onMouseEnter",V="mouse",(i==="pointerout"||i==="pointerover")&&(Ve=zb,me="onPointerLeave",W="onPointerEnter",V="pointer"),Tt=se==null?oe:fl(se),re=Pe==null?oe:fl(Pe),oe=new Ve(me,V+"leave",se,c,de),oe.target=Tt,oe.relatedTarget=re,me=null,Ra(de)===ie&&(Ve=new Ve(W,V+"enter",Pe,c,de),Ve.target=re,Ve.relatedTarget=Tt,me=Ve),Tt=me,se&&Pe)t:{for(Ve=EA,W=se,V=Pe,re=0,me=W;me;me=Ve(me))re++;me=0;for(var Ue=V;Ue;Ue=Ve(Ue))me++;for(;0<re-me;)W=Ve(W),re--;for(;0<me-re;)V=Ve(V),me--;for(;re--;){if(W===V||V!==null&&W===V.alternate){Ve=W;break t}W=Ve(W),V=Ve(V)}Ve=null}else Ve=null;se!==null&&C1(ye,oe,se,Ve,!1),Pe!==null&&Tt!==null&&C1(ye,Tt,Pe,Ve,!0)}}e:{if(oe=ie?fl(ie):window,se=oe.nodeName&&oe.nodeName.toLowerCase(),se==="select"||se==="input"&&oe.type==="file")var gt=Fb;else if(Ub(oe))if(Vb)gt=B_;else{gt=D_;var Oe=z_}else se=oe.nodeName,!se||se.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&lp(ie.elementType)&&(gt=Fb):gt=L_;if(gt&&(gt=gt(i,ie))){Hb(ye,gt,c,de);break e}Oe&&Oe(i,oe,ie),i==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&sp(oe,"number",oe.value)}switch(Oe=ie?fl(ie):window,i){case"focusin":(Ub(Oe)||Oe.contentEditable==="true")&&(Ha=Oe,Sp=ie,wl=null);break;case"focusout":wl=Sp=Ha=null;break;case"mousedown":kp=!0;break;case"contextmenu":case"mouseup":case"dragend":kp=!1,Jb(ye,c,de);break;case"selectionchange":if($_)break;case"keydown":case"keyup":Jb(ye,c,de)}var rt;if(yp)e:{switch(i){case"compositionstart":var ct="onCompositionStart";break e;case"compositionend":ct="onCompositionEnd";break e;case"compositionupdate":ct="onCompositionUpdate";break e}ct=void 0}else Ua?qb(i,c)&&(ct="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(ct="onCompositionStart");ct&&(Db&&c.locale!=="ko"&&(Ua||ct!=="onCompositionStart"?ct==="onCompositionEnd"&&Ua&&(rt=Nb()):(Ki=de,pp="value"in Ki?Ki.value:Ki.textContent,Ua=!0)),Oe=Yu(ie,ct),0<Oe.length&&(ct=new Ob(ct,i,null,c,de),ye.push({event:ct,listeners:Oe}),rt?ct.data=rt:(rt=$b(c),rt!==null&&(ct.data=rt)))),(rt=M_?N_(i,c):P_(i,c))&&(ct=Yu(ie,"onBeforeInput"),0<ct.length&&(Oe=new Ob("onBeforeInput","beforeinput",null,c,de),ye.push({event:Oe,listeners:ct}),Oe.data=rt)),IA(ye,i,ie,c,de)}T1(ye,a)})}function Zl(i,a,c){return{instance:i,listener:a,currentTarget:c}}function Yu(i,a){for(var c=a+"Capture",d=[];i!==null;){var v=i,b=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||b===null||(v=pl(i,c),v!=null&&d.unshift(Zl(i,v,b)),v=pl(i,a),v!=null&&d.push(Zl(i,v,b))),i.tag===3)return d;i=i.return}return[]}function EA(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function C1(i,a,c,d,v){for(var b=a._reactName,j=[];c!==null&&c!==d;){var N=c,H=N.alternate,ie=N.stateNode;if(N=N.tag,H!==null&&H===d)break;N!==5&&N!==26&&N!==27||ie===null||(H=ie,v?(ie=pl(c,b),ie!=null&&j.unshift(Zl(c,ie,H))):v||(ie=pl(c,b),ie!=null&&j.push(Zl(c,ie,H)))),c=c.return}j.length!==0&&i.push({event:a,listeners:j})}var _A=/\r\n?/g,AA=/\u0000|\uFFFD/g;function E1(i){return(typeof i=="string"?i:""+i).replace(_A,`
10
+ `).replace(AA,"")}function _1(i,a){return a=E1(a),E1(i)===a}function It(i,a,c,d,v,b){switch(c){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||Ba(i,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&Ba(i,""+d);break;case"className":eu(i,"class",d);break;case"tabIndex":eu(i,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":eu(i,c,d);break;case"style":_b(i,d,b);break;case"data":if(a!=="object"){eu(i,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||c!=="href")){i.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=nu(""+d),i.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){i.setAttribute(c,"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 b=="function"&&(c==="formAction"?(a!=="input"&&It(i,a,"name",v.name,v,null),It(i,a,"formEncType",v.formEncType,v,null),It(i,a,"formMethod",v.formMethod,v,null),It(i,a,"formTarget",v.formTarget,v,null)):(It(i,a,"encType",v.encType,v,null),It(i,a,"method",v.method,v,null),It(i,a,"target",v.target,v,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(c);break}d=nu(""+d),i.setAttribute(c,d);break;case"onClick":d!=null&&(i.onclick=ci);break;case"onScroll":d!=null&&at("scroll",i);break;case"onScrollEnd":d!=null&&at("scrollend",i);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"multiple":i.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":i.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){i.removeAttribute("xlink:href");break}c=nu(""+d),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""+d):i.removeAttribute(c);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":d&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":d===!0?i.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(c,d):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?i.setAttribute(c,d):i.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?i.removeAttribute(c):i.setAttribute(c,d);break;case"popover":at("beforetoggle",i),at("toggle",i),Jc(i,"popover",d);break;case"xlinkActuate":li(i,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":li(i,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":li(i,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":li(i,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":li(i,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":li(i,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":li(i,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":li(i,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":li(i,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Jc(i,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=i_.get(c)||c,Jc(i,c,d))}}function Qh(i,a,c,d,v,b){switch(c){case"style":_b(i,d,b);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(c=d.__html,c!=null){if(v.children!=null)throw Error(r(60));i.innerHTML=c}}break;case"children":typeof d=="string"?Ba(i,d):(typeof d=="number"||typeof d=="bigint")&&Ba(i,""+d);break;case"onScroll":d!=null&&at("scroll",i);break;case"onScrollEnd":d!=null&&at("scrollend",i);break;case"onClick":d!=null&&(i.onclick=ci);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xb.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),a=c.slice(2,v?c.length-7:void 0),b=i[qn]||null,b=b!=null?b[c]:null,typeof b=="function"&&i.removeEventListener(a,b,v),typeof d=="function")){typeof b!="function"&&b!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(a,d,v);break e}c in i?i[c]=d:d===!0?i.setAttribute(c,""):Jc(i,c,d)}}}function In(i,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":at("error",i),at("load",i);var d=!1,v=!1,b;for(b in c)if(c.hasOwnProperty(b)){var j=c[b];if(j!=null)switch(b){case"src":d=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:It(i,a,b,j,c,null)}}v&&It(i,a,"srcSet",c.srcSet,c,null),d&&It(i,a,"src",c.src,c,null);return;case"input":at("invalid",i);var N=b=j=v=null,H=null,ie=null;for(d in c)if(c.hasOwnProperty(d)){var de=c[d];if(de!=null)switch(d){case"name":v=de;break;case"type":j=de;break;case"checked":H=de;break;case"defaultChecked":ie=de;break;case"value":b=de;break;case"defaultValue":N=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:It(i,a,d,de,c,null)}}Tb(i,b,N,H,ie,j,v,!1);return;case"select":at("invalid",i),d=j=b=null;for(v in c)if(c.hasOwnProperty(v)&&(N=c[v],N!=null))switch(v){case"value":b=N;break;case"defaultValue":j=N;break;case"multiple":d=N;default:It(i,a,v,N,c,null)}a=b,c=j,i.multiple=!!d,a!=null?La(i,!!d,a,!1):c!=null&&La(i,!!d,c,!0);return;case"textarea":at("invalid",i),b=v=d=null;for(j in c)if(c.hasOwnProperty(j)&&(N=c[j],N!=null))switch(j){case"value":d=N;break;case"defaultValue":v=N;break;case"children":b=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:It(i,a,j,N,c,null)}Cb(i,d,v,b);return;case"option":for(H in c)c.hasOwnProperty(H)&&(d=c[H],d!=null)&&(H==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":It(i,a,H,d,c,null));return;case"dialog":at("beforetoggle",i),at("toggle",i),at("cancel",i),at("close",i);break;case"iframe":case"object":at("load",i);break;case"video":case"audio":for(d=0;d<Vl.length;d++)at(Vl[d],i);break;case"image":at("error",i),at("load",i);break;case"details":at("toggle",i);break;case"embed":case"source":case"link":at("error",i),at("load",i);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 c)if(c.hasOwnProperty(ie)&&(d=c[ie],d!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:It(i,a,ie,d,c,null)}return;default:if(lp(a)){for(de in c)c.hasOwnProperty(de)&&(d=c[de],d!==void 0&&Qh(i,a,de,d,c,void 0));return}}for(N in c)c.hasOwnProperty(N)&&(d=c[N],d!=null&&It(i,a,N,d,c,null))}function MA(i,a,c,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,b=null,j=null,N=null,H=null,ie=null,de=null;for(se in c){var ye=c[se];if(c.hasOwnProperty(se)&&ye!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=ye;default:d.hasOwnProperty(se)||It(i,a,se,null,d,ye)}}for(var oe in d){var se=d[oe];if(ye=c[oe],d.hasOwnProperty(oe)&&(se!=null||ye!=null))switch(oe){case"type":b=se;break;case"name":v=se;break;case"checked":ie=se;break;case"defaultChecked":de=se;break;case"value":j=se;break;case"defaultValue":N=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,a));break;default:se!==ye&&It(i,a,oe,se,d,ye)}}ap(i,j,N,H,ie,de,b,v);return;case"select":se=j=N=oe=null;for(b in c)if(H=c[b],c.hasOwnProperty(b)&&H!=null)switch(b){case"value":break;case"multiple":se=H;default:d.hasOwnProperty(b)||It(i,a,b,null,d,H)}for(v in d)if(b=d[v],H=c[v],d.hasOwnProperty(v)&&(b!=null||H!=null))switch(v){case"value":oe=b;break;case"defaultValue":N=b;break;case"multiple":j=b;default:b!==H&&It(i,a,v,b,d,H)}a=N,c=j,d=se,oe!=null?La(i,!!c,oe,!1):!!d!=!!c&&(a!=null?La(i,!!c,a,!0):La(i,!!c,c?[]:"",!1));return;case"textarea":se=oe=null;for(N in c)if(v=c[N],c.hasOwnProperty(N)&&v!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:It(i,a,N,null,d,v)}for(j in d)if(v=d[j],b=c[j],d.hasOwnProperty(j)&&(v!=null||b!=null))switch(j){case"value":oe=v;break;case"defaultValue":se=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(r(91));break;default:v!==b&&It(i,a,j,v,d,b)}jb(i,oe,se);return;case"option":for(var Pe in c)oe=c[Pe],c.hasOwnProperty(Pe)&&oe!=null&&!d.hasOwnProperty(Pe)&&(Pe==="selected"?i.selected=!1:It(i,a,Pe,null,d,oe));for(H in d)oe=d[H],se=c[H],d.hasOwnProperty(H)&&oe!==se&&(oe!=null||se!=null)&&(H==="selected"?i.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":It(i,a,H,oe,d,se));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 Ve in c)oe=c[Ve],c.hasOwnProperty(Ve)&&oe!=null&&!d.hasOwnProperty(Ve)&&It(i,a,Ve,null,d,oe);for(ie in d)if(oe=d[ie],se=c[ie],d.hasOwnProperty(ie)&&oe!==se&&(oe!=null||se!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(r(137,a));break;default:It(i,a,ie,oe,d,se)}return;default:if(lp(a)){for(var Tt in c)oe=c[Tt],c.hasOwnProperty(Tt)&&oe!==void 0&&!d.hasOwnProperty(Tt)&&Qh(i,a,Tt,void 0,d,oe);for(de in d)oe=d[de],se=c[de],!d.hasOwnProperty(de)||oe===se||oe===void 0&&se===void 0||Qh(i,a,de,oe,d,se);return}}for(var W in c)oe=c[W],c.hasOwnProperty(W)&&oe!=null&&!d.hasOwnProperty(W)&&It(i,a,W,null,d,oe);for(ye in d)oe=d[ye],se=c[ye],!d.hasOwnProperty(ye)||oe===se||oe==null&&se==null||It(i,a,ye,oe,d,se)}function A1(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NA(){if(typeof performance.getEntriesByType=="function"){for(var i=0,a=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var v=c[d],b=v.transferSize,j=v.initiatorType,N=v.duration;if(b&&N&&A1(j)){for(j=0,N=v.responseEnd,d+=1;d<c.length;d++){var H=c[d],ie=H.startTime;if(ie>N)break;var de=H.transferSize,ye=H.initiatorType;de&&A1(ye)&&(H=H.responseEnd,j+=de*(H<N?1:(N-ie)/(H-ie)))}if(--d,a+=8*(b+j)/(v.duration/1e3),i++,10<i)break}}if(0<i)return a/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Gh=null,Yh=null;function Wu(i){return i.nodeType===9?i:i.ownerDocument}function M1(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function N1(i,a){if(i===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&a==="foreignObject"?0:i}function Wh(i,a){return i==="textarea"||i==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Xh=null;function PA(){var i=window.event;return i&&i.type==="popstate"?i===Xh?!1:(Xh=i,!0):(Xh=null,!1)}var P1=typeof setTimeout=="function"?setTimeout:void 0,RA=typeof clearTimeout=="function"?clearTimeout:void 0,R1=typeof Promise=="function"?Promise:void 0,OA=typeof queueMicrotask=="function"?queueMicrotask:typeof R1<"u"?function(i){return R1.resolve(null).then(i).catch(zA)}:P1;function zA(i){setTimeout(function(){throw i})}function uo(i){return i==="head"}function O1(i,a){var c=a,d=0;do{var v=c.nextSibling;if(i.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(d===0){i.removeChild(v),gs(a);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Kl(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Kl(c);for(var b=c.firstChild;b;){var j=b.nextSibling,N=b.nodeName;b[dl]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&b.rel.toLowerCase()==="stylesheet"||c.removeChild(b),b=j}}else c==="body"&&Kl(i.ownerDocument.body);c=v}while(c);gs(a)}function z1(i,a){var c=i;i=0;do{var d=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=d}while(c)}function Jh(i){var a=i.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Jh(c),ip(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function DA(i,a,c,d){for(;i.nodeType===1;){var v=c;if(i.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(d){if(!i[dl])switch(a){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(b=i.getAttribute("rel"),b==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(b!==v.rel||i.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||i.getAttribute("title")!==(v.title==null?null:v.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(b=i.getAttribute("src"),(b!==(v.src==null?null:v.src)||i.getAttribute("type")!==(v.type==null?null:v.type)||i.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&b&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(a==="input"&&i.type==="hidden"){var b=v.name==null?null:""+v.name;if(v.type==="hidden"&&i.getAttribute("name")===b)return i}else return i;if(i=xr(i.nextSibling),i===null)break}return null}function LA(i,a,c){if(a==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=xr(i.nextSibling),i===null))return null;return i}function D1(i,a){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=xr(i.nextSibling),i===null))return null;return i}function em(i){return i.data==="$?"||i.data==="$~"}function tm(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function BA(i,a){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=a;else if(i.data!=="$?"||c.readyState!=="loading")a();else{var d=function(){a(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),i._reactRetry=d}}function xr(i){for(;i!=null;i=i.nextSibling){var a=i.nodeType;if(a===1||a===3)break;if(a===8){if(a=i.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return i}var nm=null;function L1(i){i=i.nextSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(a===0)return xr(i.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}i=i.nextSibling}return null}function B1(i){i=i.previousSibling;for(var a=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return i;a--}else c!=="/$"&&c!=="/&"||a++}i=i.previousSibling}return null}function q1(i,a,c){switch(a=Wu(c),i){case"html":if(i=a.documentElement,!i)throw Error(r(452));return i;case"head":if(i=a.head,!i)throw Error(r(453));return i;case"body":if(i=a.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Kl(i){for(var a=i.attributes;a.length;)i.removeAttributeNode(a[0]);ip(i)}var wr=new Map,$1=new Set;function Xu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ti=ee.d;ee.d={f:qA,r:$A,D:UA,C:HA,L:FA,m:VA,X:KA,S:ZA,M:QA};function qA(){var i=Ti.f(),a=Hu();return i||a}function $A(i){var a=Oa(i);a!==null&&a.tag===5&&a.type==="form"?i0(a):Ti.r(i)}var ps=typeof document>"u"?null:document;function U1(i,a,c){var d=ps;if(d&&typeof a=="string"&&a){var v=pr(a);v='link[rel="'+i+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),$1.has(v)||($1.add(v),i={rel:i,crossOrigin:c,href:a},d.querySelector(v)===null&&(a=d.createElement("link"),In(a,"link",i),hn(a),d.head.appendChild(a)))}}function UA(i){Ti.D(i),U1("dns-prefetch",i,null)}function HA(i,a){Ti.C(i,a),U1("preconnect",i,a)}function FA(i,a,c){Ti.L(i,a,c);var d=ps;if(d&&i&&a){var v='link[rel="preload"][as="'+pr(a)+'"]';a==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+pr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+pr(c.imageSizes)+'"]')):v+='[href="'+pr(i)+'"]';var b=v;switch(a){case"style":b=hs(i);break;case"script":b=ms(i)}wr.has(b)||(i=g({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:i,as:a},c),wr.set(b,i),d.querySelector(v)!==null||a==="style"&&d.querySelector(Ql(b))||a==="script"&&d.querySelector(Gl(b))||(a=d.createElement("link"),In(a,"link",i),hn(a),d.head.appendChild(a)))}}function VA(i,a){Ti.m(i,a);var c=ps;if(c&&i){var d=a&&typeof a.as=="string"?a.as:"script",v='link[rel="modulepreload"][as="'+pr(d)+'"][href="'+pr(i)+'"]',b=v;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=ms(i)}if(!wr.has(b)&&(i=g({rel:"modulepreload",href:i},a),wr.set(b,i),c.querySelector(v)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Gl(b)))return}d=c.createElement("link"),In(d,"link",i),hn(d),c.head.appendChild(d)}}}function ZA(i,a,c){Ti.S(i,a,c);var d=ps;if(d&&i){var v=za(d).hoistableStyles,b=hs(i);a=a||"default";var j=v.get(b);if(!j){var N={loading:0,preload:null};if(j=d.querySelector(Ql(b)))N.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":a},c),(c=wr.get(b))&&rm(i,c);var H=j=d.createElement("link");hn(H),In(H,"link",i),H._p=new Promise(function(ie,de){H.onload=ie,H.onerror=de}),H.addEventListener("load",function(){N.loading|=1}),H.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Ju(j,a,d)}j={type:"stylesheet",instance:j,count:1,state:N},v.set(b,j)}}}function KA(i,a){Ti.X(i,a);var c=ps;if(c&&i){var d=za(c).hoistableScripts,v=ms(i),b=d.get(v);b||(b=c.querySelector(Gl(v)),b||(i=g({src:i,async:!0},a),(a=wr.get(v))&&im(i,a),b=c.createElement("script"),hn(b),In(b,"link",i),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(v,b))}}function QA(i,a){Ti.M(i,a);var c=ps;if(c&&i){var d=za(c).hoistableScripts,v=ms(i),b=d.get(v);b||(b=c.querySelector(Gl(v)),b||(i=g({src:i,async:!0,type:"module"},a),(a=wr.get(v))&&im(i,a),b=c.createElement("script"),hn(b),In(b,"link",i),c.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},d.set(v,b))}}function H1(i,a,c,d){var v=(v=ue.current)?Xu(v):null;if(!v)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=hs(c.href),c=za(v).hoistableStyles,d=c.get(a),d||(d={type:"style",instance:null,count:0,state:null},c.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=hs(c.href);var b=za(v).hoistableStyles,j=b.get(i);if(j||(v=v.ownerDocument||v,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(i,j),(b=v.querySelector(Ql(i)))&&!b._p&&(j.instance=b,j.state.loading=5),wr.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},wr.set(i,c),b||GA(v,i,c,j.state))),a&&d===null)throw Error(r(528,""));return j}if(a&&d!==null)throw Error(r(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=ms(c),c=za(v).hoistableScripts,d=c.get(a),d||(d={type:"script",instance:null,count:0,state:null},c.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function hs(i){return'href="'+pr(i)+'"'}function Ql(i){return'link[rel="stylesheet"]['+i+"]"}function F1(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function GA(i,a,c,d){i.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=i.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),In(a,"link",c),hn(a),i.head.appendChild(a))}function ms(i){return'[src="'+pr(i)+'"]'}function Gl(i){return"script[async]"+i}function V1(i,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var d=i.querySelector('style[data-href~="'+pr(c.href)+'"]');if(d)return a.instance=d,hn(d),d;var v=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),hn(d),In(d,"style",v),Ju(d,c.precedence,i),a.instance=d;case"stylesheet":v=hs(c.href);var b=i.querySelector(Ql(v));if(b)return a.state.loading|=4,a.instance=b,hn(b),b;d=F1(c),(v=wr.get(v))&&rm(d,v),b=(i.ownerDocument||i).createElement("link"),hn(b);var j=b;return j._p=new Promise(function(N,H){j.onload=N,j.onerror=H}),In(b,"link",d),a.state.loading|=4,Ju(b,c.precedence,i),a.instance=b;case"script":return b=ms(c.src),(v=i.querySelector(Gl(b)))?(a.instance=v,hn(v),v):(d=c,(v=wr.get(b))&&(d=g({},c),im(d,v)),i=i.ownerDocument||i,v=i.createElement("script"),hn(v),In(v,"link",d),i.head.appendChild(v),a.instance=v);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,Ju(d,c.precedence,i));return a.instance}function Ju(i,a,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=d.length?d[d.length-1]:null,b=v,j=0;j<d.length;j++){var N=d[j];if(N.dataset.precedence===a)b=N;else if(b!==v)break}b?b.parentNode.insertBefore(i,b.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(i,a.firstChild))}function rm(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.title==null&&(i.title=a.title)}function im(i,a){i.crossOrigin==null&&(i.crossOrigin=a.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=a.referrerPolicy),i.integrity==null&&(i.integrity=a.integrity)}var ed=null;function Z1(i,a,c){if(ed===null){var d=new Map,v=ed=new Map;v.set(c,d)}else v=ed,d=v.get(c),d||(d=new Map,v.set(c,d));if(d.has(i))return d;for(d.set(i,null),c=c.getElementsByTagName(i),v=0;v<c.length;v++){var b=c[v];if(!(b[dl]||b[xn]||i==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var j=b.getAttribute(a)||"";j=i+j;var N=d.get(j);N?N.push(b):d.set(j,[b])}}return d}function K1(i,a,c){i=i.ownerDocument||i,i.head.insertBefore(c,a==="title"?i.querySelector("head > title"):null)}function YA(i,a,c){if(c===1||a.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(i=a.disabled,typeof a.precedence=="string"&&i==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Q1(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function WA(i,a,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=hs(d.href),b=a.querySelector(Ql(v));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(i.count++,i=td.bind(i),a.then(i,i)),c.state.loading|=4,c.instance=b,hn(b);return}b=a.ownerDocument||a,d=F1(d),(v=wr.get(v))&&rm(d,v),b=b.createElement("link"),hn(b);var j=b;j._p=new Promise(function(N,H){j.onload=N,j.onerror=H}),In(b,"link",d),c.instance=b}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=td.bind(i),a.addEventListener("load",c),a.addEventListener("error",c))}}var om=0;function XA(i,a){return i.stylesheets&&i.count===0&&rd(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var d=setTimeout(function(){if(i.stylesheets&&rd(i,i.stylesheets),i.unsuspend){var b=i.unsuspend;i.unsuspend=null,b()}},6e4+a);0<i.imgBytes&&om===0&&(om=62500*NA());var v=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&rd(i,i.stylesheets),i.unsuspend)){var b=i.unsuspend;i.unsuspend=null,b()}},(i.imgBytes>om?50:800)+a);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(v)}}:null}function td(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rd(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var nd=null;function rd(i,a){i.stylesheets=null,i.unsuspend!==null&&(i.count++,nd=new Map,a.forEach(JA,i),nd=null,td.call(i))}function JA(i,a){if(!(a.state.loading&4)){var c=nd.get(i);if(c)var d=c.get(null);else{c=new Map,nd.set(i,c);for(var v=i.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<v.length;b++){var j=v[b];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(c.set(j.dataset.precedence,j),d=j)}d&&c.set(null,d)}v=a.instance,j=v.getAttribute("data-precedence"),b=c.get(j)||d,b===d&&c.set(null,v),c.set(j,v),this.count++,d=td.bind(this),v.addEventListener("load",d),v.addEventListener("error",d),b?b.parentNode.insertBefore(v,b.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(v,i.firstChild)),a.state.loading|=4}}var Yl={$$typeof:C,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function eM(i,a,c,d,v,b,j,N,H){this.tag=1,this.containerInfo=i,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=ep(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ep(0),this.hiddenUpdates=ep(null),this.identifierPrefix=d,this.onUncaughtError=v,this.onCaughtError=b,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.incompleteTransitions=new Map}function G1(i,a,c,d,v,b,j,N,H,ie,de,ye){return i=new eM(i,a,c,j,H,ie,de,ye,N),a=1,b===!0&&(a|=24),b=tr(3,null,null,a),i.current=b,b.stateNode=i,a=Lp(),a.refCount++,i.pooledCache=a,a.refCount++,b.memoizedState={element:d,isDehydrated:c,cache:a},Up(b),i}function Y1(i){return i?(i=Za,i):Za}function W1(i,a,c,d,v,b){v=Y1(v),d.context===null?d.context=v:d.pendingContext=v,d=Ji(a),d.payload={element:c},b=b===void 0?null:b,b!==null&&(d.callback=b),c=eo(i,d,a),c!==null&&(Zn(c,i,a),El(c,i,a))}function X1(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<a?c:a}}function am(i,a){X1(i,a),(i=i.alternate)&&X1(i,a)}function J1(i){if(i.tag===13||i.tag===31){var a=Ho(i,67108864);a!==null&&Zn(a,i,67108864),am(i,67108864)}}function ew(i){if(i.tag===13||i.tag===31){var a=ar();a=tp(a);var c=Ho(i,a);c!==null&&Zn(c,i,a),am(i,a)}}var id=!0;function tM(i,a,c,d){var v=F.T;F.T=null;var b=ee.p;try{ee.p=2,sm(i,a,c,d)}finally{ee.p=b,F.T=v}}function nM(i,a,c,d){var v=F.T;F.T=null;var b=ee.p;try{ee.p=8,sm(i,a,c,d)}finally{ee.p=b,F.T=v}}function sm(i,a,c,d){if(id){var v=lm(d);if(v===null)Kh(i,a,d,od,c),nw(i,d);else if(iM(v,i,a,c,d))d.stopPropagation();else if(nw(i,d),a&4&&-1<rM.indexOf(i)){for(;v!==null;){var b=Oa(v);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var j=si(b.pendingLanes);if(j!==0){var N=b;for(N.pendingLanes|=2,N.entangledLanes|=2;j;){var H=1<<31-mt(j);N.entanglements[1]|=H,j&=~H}Hr(b),(yt&6)===0&&($u=an()+500,Fl(0))}}break;case 31:case 13:N=Ho(b,2),N!==null&&Zn(N,b,2),Hu(),am(b,2)}if(b=lm(d),b===null&&Kh(i,a,d,od,c),b===v)break;v=b}v!==null&&d.stopPropagation()}else Kh(i,a,d,null,c)}}function lm(i){return i=up(i),cm(i)}var od=null;function cm(i){if(od=null,i=Ra(i),i!==null){var a=s(i);if(a===null)i=null;else{var c=a.tag;if(c===13){if(i=l(a),i!==null)return i;i=null}else if(c===31){if(i=u(a),i!==null)return i;i=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return od=i,null}function tw(i){switch(i){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(ai()){case pe:return 2;case Ie:return 8;case Le:case ne:return 32;case je:return 268435456;default:return 32}default:return 32}}var um=!1,fo=null,po=null,ho=null,Wl=new Map,Xl=new Map,mo=[],rM="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 nw(i,a){switch(i){case"focusin":case"focusout":fo=null;break;case"dragenter":case"dragleave":po=null;break;case"mouseover":case"mouseout":ho=null;break;case"pointerover":case"pointerout":Wl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xl.delete(a.pointerId)}}function Jl(i,a,c,d,v,b){return i===null||i.nativeEvent!==b?(i={blockedOn:a,domEventName:c,eventSystemFlags:d,nativeEvent:b,targetContainers:[v]},a!==null&&(a=Oa(a),a!==null&&J1(a)),i):(i.eventSystemFlags|=d,a=i.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),i)}function iM(i,a,c,d,v){switch(a){case"focusin":return fo=Jl(fo,i,a,c,d,v),!0;case"dragenter":return po=Jl(po,i,a,c,d,v),!0;case"mouseover":return ho=Jl(ho,i,a,c,d,v),!0;case"pointerover":var b=v.pointerId;return Wl.set(b,Jl(Wl.get(b)||null,i,a,c,d,v)),!0;case"gotpointercapture":return b=v.pointerId,Xl.set(b,Jl(Xl.get(b)||null,i,a,c,d,v)),!0}return!1}function rw(i){var a=Ra(i.target);if(a!==null){var c=s(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){i.blockedOn=a,vb(i.priority,function(){ew(c)});return}}else if(a===31){if(a=u(c),a!==null){i.blockedOn=a,vb(i.priority,function(){ew(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function ad(i){if(i.blockedOn!==null)return!1;for(var a=i.targetContainers;0<a.length;){var c=lm(i.nativeEvent);if(c===null){c=i.nativeEvent;var d=new c.constructor(c.type,c);cp=d,c.target.dispatchEvent(d),cp=null}else return a=Oa(c),a!==null&&J1(a),i.blockedOn=c,!1;a.shift()}return!0}function iw(i,a,c){ad(i)&&c.delete(a)}function oM(){um=!1,fo!==null&&ad(fo)&&(fo=null),po!==null&&ad(po)&&(po=null),ho!==null&&ad(ho)&&(ho=null),Wl.forEach(iw),Xl.forEach(iw)}function sd(i,a){i.blockedOn===a&&(i.blockedOn=null,um||(um=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,oM)))}var ld=null;function ow(i){ld!==i&&(ld=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ld===i&&(ld=null);for(var a=0;a<i.length;a+=3){var c=i[a],d=i[a+1],v=i[a+2];if(typeof d!="function"){if(cm(d||c)===null)continue;break}var b=Oa(c);b!==null&&(i.splice(a,3),a-=3,lh(b,{pending:!0,data:v,method:c.method,action:d},d,v))}}))}function gs(i){function a(H){return sd(H,i)}fo!==null&&sd(fo,i),po!==null&&sd(po,i),ho!==null&&sd(ho,i),Wl.forEach(a),Xl.forEach(a);for(var c=0;c<mo.length;c++){var d=mo[c];d.blockedOn===i&&(d.blockedOn=null)}for(;0<mo.length&&(c=mo[0],c.blockedOn===null);)rw(c),c.blockedOn===null&&mo.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var v=c[d],b=c[d+1],j=v[qn]||null;if(typeof b=="function")j||ow(c);else if(j){var N=null;if(b&&b.hasAttribute("formAction")){if(v=b,j=b[qn]||null)N=j.formAction;else if(cm(v)!==null)continue}else N=j.action;typeof N=="function"?c[d+1]=N:(c.splice(d,3),d-=3),ow(c)}}}function aw(){function i(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(j){return v=j})},focusReset:"manual",scroll:"manual"})}function a(){v!==null&&(v(),v=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,v=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),v!==null&&(v(),v=null)}}}function dm(i){this._internalRoot=i}cd.prototype.render=dm.prototype.render=function(i){var a=this._internalRoot;if(a===null)throw Error(r(409));var c=a.current,d=ar();W1(c,d,i,a,null,null)},cd.prototype.unmount=dm.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var a=i.containerInfo;W1(i.current,2,null,i,null,null),Hu(),a[Pa]=null}};function cd(i){this._internalRoot=i}cd.prototype.unstable_scheduleHydration=function(i){if(i){var a=gb();i={blockedOn:null,target:i,priority:a};for(var c=0;c<mo.length&&a!==0&&a<mo[c].priority;c++);mo.splice(c,0,i),c===0&&rw(i)}};var sw=t.version;if(sw!=="19.2.8")throw Error(r(527,sw,"19.2.8"));ee.findDOMNode=function(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=p(a),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var aM={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ud=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ud.isDisabled&&ud.supportsFiber)try{ft=ud.inject(aM),Xe=ud}catch{}}return tc.createRoot=function(i,a){if(!o(i))throw Error(r(299));var c=!1,d="",v=h0,b=m0,j=g0;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=G1(i,1,!1,null,null,c,d,null,v,b,j,aw),i[Pa]=a.current,Zh(i),new dm(a)},tc.hydrateRoot=function(i,a,c){if(!o(i))throw Error(r(299));var d=!1,v="",b=h0,j=m0,N=g0,H=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(b=c.onUncaughtError),c.onCaughtError!==void 0&&(j=c.onCaughtError),c.onRecoverableError!==void 0&&(N=c.onRecoverableError),c.formState!==void 0&&(H=c.formState)),a=G1(i,1,!0,a,c??null,d,v,H,b,j,N,aw),a.context=Y1(null),c=a.current,d=ar(),d=tp(d),v=Ji(d),v.callback=null,eo(c,v,d),c=d,a.current.lanes=c,ul(a,c),Hr(a),i[Pa]=a.current,Zh(i),new cd(a)},tc.version="19.2.8",tc}var vw;function gM(){if(vw)return hm.exports;vw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),hm.exports=mM(),hm.exports}var vM=gM(),Us=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},yM=class extends Us{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},bv=new yM,bM={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},xM=class{#e=bM;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},la=new xM;function wM(e){setTimeout(e,0)}var SM=typeof window>"u"||"Deno"in globalThis;function Rn(){}function kM(e,t){return typeof e=="function"?e(t):e}function ng(e){return typeof e=="number"&&e>=0&&e!==1/0}function EI(e,t){return Math.max(e+(t||0)-Date.now(),0)}function To(e,t){return typeof e=="function"?e(t):e}function cr(e,t){return typeof e=="function"?e(t):e}function yw(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:s,queryKey:l,stale:u}=e;if(l){if(r){if(t.queryHash!==xv(l,t.options))return!1}else if(!Os(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||o&&o!==t.state.fetchStatus||s&&!s(t))}function bw(e,t){const{exact:n,status:r,predicate:o,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ma(t.options.mutationKey)!==ma(s))return!1}else if(!Os(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function xv(e,t){return(t?.queryKeyHashFn||ma)(e)}function ma(e){return JSON.stringify(e,(t,n)=>rg(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Os(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){for(let r=0;r<t.length;r++)if(!Os(e[r],t[r]))return!1;return!0}const n=Object.keys(t);for(const r of n)if(!Os(e[r],t[r]))return!1;return!0}return!1}var IM=Object.prototype.hasOwnProperty;function _I(e,t,n=0){if(e===t)return e;if(n>500)return t;const r=xw(e)&&xw(t);if(!r&&!(rg(e)&&rg(t)))return t;const s=(r?e:Object.keys(e)).length,l=r?t:Object.keys(t),u=l.length,f=r?new Array(u):{};let p=0;for(let m=0;m<u;m++){const g=r?m:l[m],x=e[g],y=t[g];if(x===y){f[g]=x,(r?m<s:IM.call(e,g))&&p++;continue}if(x===null||y===null||typeof x!="object"||typeof y!="object"){f[g]=y;continue}const w=_I(x,y,n+1);f[g]=w,w===x&&p++}return s===u&&p===s?e:f}function Vd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function xw(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function rg(e){if(!ww(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ww(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ww(e){return Object.prototype.toString.call(e)==="[object Object]"}function TM(e){return new Promise(t=>{la.setTimeout(t,e)})}function ig(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?_I(e,t):t}function jM(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function CM(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wv=Symbol();function AI(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===wv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Sv(e,t){return typeof e=="function"?e(...t):!!e}function EM(e,t,n){let r=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),r||(r=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var bc=(()=>{let e=()=>SM;return{isServer(){return e()},setIsServer(t){e=t}}})();function og(){let e,t;const n=new Promise((o,s)=>{e=o,t=s});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}var _M=wM;function AM(){let e=[],t=0,n=u=>{u()},r=u=>{u()},o=_M;const s=u=>{t?e.push(u):o(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&o(()=>{r(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;t++;try{f=u()}finally{t--,t||l()}return f},batchCalls:u=>(...f)=>{s(()=>{u(...f)})},schedule:s,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{r=u},setScheduler:u=>{o=u}}}var on=AM(),MM=class extends Us{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},Zd=new MM;function NM(e){return Math.min(1e3*2**e,3e4)}function MI(e){return(e??"online")==="online"?Zd.isOnline():!0}var ag=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function NI(e){let t=!1,n=0,r;const o=og(),s=()=>o.status!=="pending",l=S=>{if(!s()){const T=new ag(S);x(T),e.onCancel?.(T)}},u=()=>{t=!0},f=()=>{t=!1},p=()=>bv.isFocused()&&(e.networkMode==="always"||Zd.isOnline())&&e.canRun(),m=()=>MI(e.networkMode)&&e.canRun(),g=S=>{s()||(r?.(),o.resolve(S))},x=S=>{s()||(r?.(),o.reject(S))},y=()=>new Promise(S=>{r=T=>{(s()||p())&&S(T)},e.onPause?.()}).then(()=>{r=void 0,s()||e.onContinue?.()}),w=()=>{if(s())return;let S;const T=n===0?e.initialPromise:void 0;try{S=T??e.fn()}catch(k){S=Promise.reject(k)}Promise.resolve(S).then(g).catch(k=>{if(s())return;const _=e.retry??(bc.isServer()?0:3),C=e.retryDelay??NM,E=typeof C=="function"?C(n,k):C,O=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,k);if(t||!O){x(k);return}n++,e.onFail?.(n,k),TM(E).then(()=>p()?void 0:y()).then(()=>{t?x(k):w()})})};return{promise:o,status:()=>o.status,cancel:l,continue:()=>(r?.(),o),cancelRetry:u,continueRetry:f,canStart:m,start:()=>(m()?w():y().then(w),o)}}var PI=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ng(this.gcTime)&&(this.#e=la.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bc.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(la.clearTimeout(this.#e),this.#e=void 0)}};function PM(e){return{onFetch:(t,n)=>{const r=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let u={pages:[],pageParams:[]},f=0;const p=async()=>{let m=!1;const g=w=>{EM(w,()=>t.signal,()=>m=!0)},x=AI(t.options,t.fetchOptions),y=async(w,S,T)=>{if(m)return Promise.reject(t.signal.reason);if(S==null&&w.pages.length)return Promise.resolve(w);const _=(()=>{const M={client:t.client,queryKey:t.queryKey,pageParam:S,direction:T?"backward":"forward",meta:t.options.meta};return g(M),M})(),C=await x(_),{maxPages:E}=t.options,O=T?CM:jM;return{pages:O(w.pages,C,E),pageParams:O(w.pageParams,S,E)}};if(o&&s.length){const w=o==="backward",S=w?RM:Sw,T={pages:s,pageParams:l},k=S(r,T);u=await y(T,k,w)}else{const w=e??s.length;do{const S=f===0?l[0]??r.initialPageParam:Sw(r,u);if(f>0&&S==null)break;u=await y(u,S),f++}while(f<w)}return u};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=p}}}function Sw(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function RM(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var OM=class extends PI{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Iw(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#o?.promise}setOptions(e){if(this.options={...this.#s,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Iw(this.options);t.data!==void 0&&(this.setState(kw(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const n=ig(this.state.data,e,this.options);return this.#l({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:"setState",state:e})}cancel(e){const t=this.#o?.promise;return this.#o?.cancel(e),t?t.then(Rn).catch(Rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>cr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>To(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!EI(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#o?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#o?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#o&&(this.#a||this.#u()?this.#o.cancel({revert:!0}):this.#o.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#o?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#o)return this.#o.continueRetry(),this.#o.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(p=>p.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,r=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},o=()=>{const f=AI(this.options,t),m=(()=>{const g={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(g),g})();return this.#a=!1,this.options.persister?this.options.persister(f,m,this):f(m)},l=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return r(f),f})();(this.#e==="infinite"?PM(this.options.pages):this.options.behavior)?.onFetch(l,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#l({type:"fetch",meta:l.fetchOptions?.meta}),this.#o=NI({initialPromise:t?.initialPromise,fn:l.fetchFn,onCancel:f=>{f instanceof ag&&f.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(f,p)=>{this.#l({type:"failed",failureCount:f,error:p})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const f=await this.#o.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#r.config.onSuccess?.(f,this),this.#r.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof ag){if(f.silent)return this.#o.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#l({type:"error",error:f}),this.#r.config.onError?.(f,this),this.#r.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#l(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...RI(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...n,...kw(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?r:void 0,r;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),on.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function RI(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:MI(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function kw(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Iw(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var zM=class extends Us{constructor(e,t){super(),this.options=t,this.#e=e,this.#a=null,this.#s=og(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#o;#s;#a;#u;#l;#h;#d;#f;#c;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tw(this.#t,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return sg(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return sg(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof cr(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Vd(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&jw(this.#t,n,this.options,t)&&this.#p(),this.updateResult(),r&&(this.#t!==n||cr(this.options.enabled,this.#t)!==cr(t.enabled,this.#t)||To(this.options.staleTime,this.#t)!==To(t.staleTime,this.#t))&&this.#g();const o=this.#v();r&&(this.#t!==n||cr(this.options.enabled,this.#t)!==cr(t.enabled,this.#t)||o!==this.#c)&&this.#y(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return LM(this,n)&&(this.#r=n,this.#o=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#p(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Rn)),t}#g(){this.#x();const e=To(this.options.staleTime,this.#t);if(bc.isServer()||this.#r.isStale||!ng(e))return;const n=EI(this.#r.dataUpdatedAt,e)+1;this.#d=la.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(bc.isServer()||cr(this.options.enabled,this.#t)===!1||!ng(this.#c)||this.#c===0)&&(this.#f=la.setInterval(()=>{(this.options.refetchIntervalInBackground||bv.isFocused())&&this.#p()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(la.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(la.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const n=this.#t,r=this.options,o=this.#r,s=this.#i,l=this.#o,f=e!==n?e.state:this.#n,{state:p}=e;let m={...p},g=!1,x;if(t._optimisticResults){const z=this.hasListeners(),K=!z&&Tw(e,t),q=z&&jw(e,n,t,r);(K||q)&&(m={...m,...RI(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:y,errorUpdatedAt:w,status:S}=m;x=m.data;let T=!1;if(t.placeholderData!==void 0&&x===void 0&&S==="pending"){let z;o?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(z=o.data,T=!0):z=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,z!==void 0&&(S="success",x=ig(o?.data,z,t),g=!0)}if(t.select&&x!==void 0&&!T)if(o&&x===s?.data&&t.select===this.#u)x=this.#l;else try{this.#u=t.select,x=t.select(x),x=ig(o?.data,x,t),this.#l=x,this.#a=null}catch(z){this.#a=z}this.#a&&(y=this.#a,x=this.#l,w=Date.now(),S="error");const k=m.fetchStatus==="fetching",_=S==="pending",C=S==="error",E=_&&k,O=x!==void 0,R={status:S,fetchStatus:m.fetchStatus,isPending:_,isSuccess:S==="success",isError:C,isInitialLoading:E,isLoading:E,data:x,dataUpdatedAt:m.dataUpdatedAt,error:y,errorUpdatedAt:w,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:m.dataUpdateCount>f.dataUpdateCount||m.errorUpdateCount>f.errorUpdateCount,isFetching:k,isRefetching:k&&!_,isLoadingError:C&&!O,isPaused:m.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:C&&O,isStale:kv(e,t),refetch:this.refetch,promise:this.#s,isEnabled:cr(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const z=R.data!==void 0,K=R.status==="error"&&!z,q=ae=>{K?ae.reject(R.error):z&&ae.resolve(R.data)},Z=()=>{const ae=this.#s=R.promise=og();q(ae)},Y=this.#s;switch(Y.status){case"pending":e.queryHash===n.queryHash&&q(Y);break;case"fulfilled":(K||R.data!==Y.value)&&Z();break;case"rejected":(!K||R.error!==Y.reason)&&Z();break}}return R}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#o=this.options,this.#i.data!==void 0&&(this.#h=this.#t),Vd(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!this.#m.size)return!0;const s=new Set(o??this.#m);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(l=>{const u=l;return this.#r[u]!==e[u]&&s.has(u)})};this.#k({listeners:n()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#k(e){on.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function DM(e,t){return cr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&cr(t.retryOnMount,e)===!1)}function Tw(e,t){return DM(e,t)||e.state.data!==void 0&&sg(e,t,t.refetchOnMount)}function sg(e,t,n){if(cr(t.enabled,e)!==!1&&To(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&kv(e,t)}return!1}function jw(e,t,n,r){return(e!==t||cr(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&kv(e,n)}function kv(e,t){return cr(t.enabled,e)!==!1&&e.isStaleByTime(To(t.staleTime,e))}function LM(e,t){return!Vd(e.getCurrentResult(),t)}var BM=class extends PI{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||OI(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=NI({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(s,l)=>{this.#i({type:"failed",failureCount:s,error:l})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",o=!this.#r.canStart();try{if(r)t();else{this.#i({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const l=await this.options.onMutate?.(e,n);l!==this.state.context&&this.#i({type:"pending",context:l,variables:e,isPaused:o})}const s=await this.#r.start();return await this.#n.config.onSuccess?.(s,e,this.state.context,this,n),await this.options.onSuccess?.(s,e,this.state.context,n),await this.#n.config.onSettled?.(s,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(s,null,e,this.state.context,n),this.#i({type:"success",data:s}),s}catch(s){try{await this.#n.config.onError?.(s,e,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onError?.(s,e,this.state.context,n)}catch(l){Promise.reject(l)}try{await this.#n.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this,n)}catch(l){Promise.reject(l)}try{await this.options.onSettled?.(void 0,s,e,this.state.context,n)}catch(l){Promise.reject(l)}throw this.#i({type:"error",error:s}),s}finally{this.#n.runNext(this)}}#i(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),on.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function OI(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var qM=class extends Us{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new BM({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=dd(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=dd(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=dd(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=dd(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){on.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>bw(t,n))}findAll(e={}){return this.getAll().filter(t=>bw(e,t))}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return on.batch(()=>Promise.all(e.map(t=>t.continue().catch(Rn))))}};function dd(e){return e.options.scope?.id}var $M=class extends Us{#e;#t=void 0;#n;#r;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),Vd(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ma(n.mutationKey)!==ma(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#i(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#o()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#i(){const t=this.#n?.state??OI();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){on.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,o={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#r.onSuccess?.(t.data,n,r,o)}catch(s){Promise.reject(s)}try{this.#r.onSettled?.(t.data,null,n,r,o)}catch(s){Promise.reject(s)}}else if(t?.type==="error"){try{this.#r.onError?.(t.error,n,r,o)}catch(s){Promise.reject(s)}try{this.#r.onSettled?.(void 0,t.error,n,r,o)}catch(s){Promise.reject(s)}}}this.listeners.forEach(n=>{n(this.#t)})})}},UM=class extends Us{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,o=t.queryHash??xv(r,t);let s=this.get(o);return s||(s=new OM({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){on.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>yw(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>yw(e,n)):t}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){on.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},HM=class{#e;#t;#n;#r;#i;#o;#s;#a;constructor(e={}){this.#e=e.queryCache||new UM,this.#t=e.mutationCache||new qM,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=bv.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=Zd.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#a?.(),this.#a=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(To(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#e.get(r.queryHash)?.state.data,l=kM(t,s);if(l!==void 0)return this.#e.build(this,r).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return on.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=on.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Rn).catch(Rn)}invalidateQueries(e,t={}){return on.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=on.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let s=o.fetch(void 0,n);return n.throwOnError||(s=s.catch(Rn)),o.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Rn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(To(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rn).catch(Rn)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rn).catch(Rn)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Zd.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ma(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Os(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ma(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Os(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xv(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===wv&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},zI=I.createContext(void 0),Hs=e=>{const t=I.useContext(zI);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},FM=({client:e,children:t})=>(I.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(zI.Provider,{value:e,children:t})),DI=I.createContext(!1),VM=()=>I.useContext(DI);DI.Provider;function ZM(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var KM=I.createContext(ZM()),QM=()=>I.useContext(KM),GM=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?Sv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},YM=e=>{I.useEffect(()=>{e.clearReset()},[e])},WM=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||Sv(n,[e.error,r])),XM=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...o)=>n(r(...o)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},JM=(e,t)=>e.isLoading&&e.isFetching&&!t,eN=(e,t)=>e?.suspense&&t.isPending,Cw=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function tN(e,t,n){const r=VM(),o=QM(),s=Hs(),l=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(l);const u=s.getQueryCache().get(l.queryHash),f=e.subscribed!==!1;l._optimisticResults=r?"isRestoring":f?"optimistic":void 0,XM(l),GM(l,o,u),YM(o);const p=!s.getQueryCache().get(l.queryHash),[m]=I.useState(()=>new t(s,l)),g=m.getOptimisticResult(l),x=!r&&f;if(I.useSyncExternalStore(I.useCallback(y=>{const w=x?m.subscribe(on.batchCalls(y)):Rn;return m.updateResult(),w},[m,x]),()=>m.getCurrentResult(),()=>m.getCurrentResult()),I.useEffect(()=>{m.setOptions(l)},[l,m]),eN(l,g))throw Cw(l,m,o);if(WM({result:g,errorResetBoundary:o,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw g.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(l,g),l.experimental_prefetchInRender&&!bc.isServer()&&JM(g,r)&&(p?Cw(l,m,o):u?.promise)?.catch(Rn).finally(()=>{m.updateResult()}),l.notifyOnChangeProps?g:m.trackResult(g)}function lr(e,t){return tN(e,zM)}function nN(e,t){const n=Hs(),r=n.getQueryCache();return I.useSyncExternalStore(I.useCallback(o=>r.subscribe(on.batchCalls(o)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}function vn(e,t){const n=Hs(),[r]=I.useState(()=>new $M(n,e));I.useEffect(()=>{r.setOptions(e)},[r,e]);const o=I.useSyncExternalStore(I.useCallback(l=>r.subscribe(on.batchCalls(l)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=I.useCallback((l,u)=>{r.mutate(l,u).catch(Rn)},[r]);if(o.error&&Sv(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}var rN=Object.defineProperty,Fs=(e,t)=>rN(e,"name",{value:t,configurable:!0}),LI=!!(typeof window<"u"&&window.document&&window.document.createElement);function jt(e,t,{checkForDefaultPrevented:n=!0}={}){return Fs(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}Fs(jt,"composeEventHandlers");function iN(e){if(!LI)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Fs(iN,"getOwnerWindow");function lg(e){if(!LI)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Fs(lg,"getOwnerDocument");function BI(e,t=!1){const{activeElement:n}=lg(e);if(!n?.nodeName)return null;if(qI(n)&&n.contentDocument)return BI(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=lg(n).getElementById(r);if(o)return o}}return n}Fs(BI,"getActiveElement");function qI(e){return e.tagName==="IFRAME"}Fs(qI,"isFrame");var oN=Object.defineProperty,Iv=(e,t)=>oN(e,"name",{value:t,configurable:!0});function cg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Iv(cg,"setRef");function $I(...e){return t=>{let n=!1;const r=e.map(o=>{const s=cg(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():cg(e[o],null)}}}}Iv($I,"composeRefs");function Ut(...e){return I.useCallback($I(...e),e)}Iv(Ut,"useComposedRefs");var aN=Object.defineProperty,Ir=(e,t)=>aN(e,"name",{value:t,configurable:!0});function sN(e,t){const n=I.createContext(t);n.displayName=e+"Context";const r=Ir(s=>{const{children:l,...u}=s,f=I.useMemo(()=>u,Object.values(u));return h.jsx(n.Provider,{value:f,children:l})},"Provider");r.displayName=e+"Provider";function o(s,l={}){const{optional:u=!1}=l,f=I.useContext(n);if(f)return f;if(t!==void 0)return t;if(!u)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Ir(o,"useContext"),[r,o]}Ir(sN,"createContext");function Ta(e,t=[]){let n=[];function r(s,l){const u=I.createContext(l);u.displayName=s+"Context";const f=n.length;n=[...n,l];const p=Ir(g=>{const{scope:x,children:y,...w}=g,S=x?.[e]?.[f]||u,T=I.useMemo(()=>w,Object.values(w));return h.jsx(S.Provider,{value:T,children:y})},"Provider");p.displayName=s+"Provider";function m(g,x,y={}){const{optional:w=!1}=y,S=x?.[e]?.[f]||u,T=I.useContext(S);if(T)return T;if(l!==void 0)return l;if(!w)throw new Error(`\`${g}\` must be used within \`${s}\``)}return Ir(m,"useContext"),[p,m]}Ir(r,"createContext");const o=Ir(()=>{const s=n.map(l=>I.createContext(l));return Ir(function(u){const f=u?.[e]||s;return I.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])},"useScope")},"createScope");return o.scopeName=e,[r,UI(o,...t)]}Ir(Ta,"createContextScope");function UI(...e){const t=e[0];if(e.length===1)return t;const n=Ir(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ir(function(s){const l=r.reduce((u,{useScope:f,scopeName:p})=>{const g=f(s)[`__scope${p}`];return{...u,...g}},{});return I.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Ir(UI,"composeContextScopes");var ja=CI(),lN=Object.defineProperty,Dr=(e,t)=>lN(e,"name",{value:t,configurable:!0});function jo(e){const t=I.forwardRef((n,r)=>{let{children:o,...s}=n,l=null,u=!1;const f=[];ug(o)&&typeof fd=="function"&&(o=fd(o._payload)),I.Children.forEach(o,x=>{if(KI(x)){u=!0;const y=x;let w="child"in y.props?y.props.child:y.props.children;ug(w)&&typeof fd=="function"&&(w=fd(w._payload)),l=cN(y,w),f.push(l?.props?.children)}else f.push(x)}),l?l=I.cloneElement(l,void 0,f):!u&&I.Children.count(o)===1&&I.isValidElement(o)&&(l=o);const p=l?ZI(l):void 0,m=Ut(r,p);if(!l){if(o||o===0)throw new Error(u?fN(e):dN(e));return o}const g=VI(s,l.props??{});return l.type!==I.Fragment&&(g.ref=r?m:p),I.cloneElement(l,g)});return t.displayName=`${e}.Slot`,t}Dr(jo,"createSlot");var HI=Symbol.for("radix.slottable");function FI(e){const t=Dr(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=HI,t}Dr(FI,"createSlottable");var cN=Dr((e,t)=>{if("child"in e.props){const n=e.props.child;return I.isValidElement(n)?I.cloneElement(n,void 0,e.props.children(n.props.children)):null}return I.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function VI(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...u)=>{const f=s(...u);return o(...u),f}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}Dr(VI,"mergeProps");function ZI(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Dr(ZI,"getElementRef");function KI(e){return I.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===HI}Dr(KI,"isSlottable");var uN=Symbol.for("react.lazy");function ug(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===uN&&"_payload"in e&&QI(e._payload)}Dr(ug,"isLazyComponent");function QI(e){return typeof e=="object"&&e!==null&&"then"in e}Dr(QI,"isPromiseLike");var dN=Dr(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),fN=Dr(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),fd=Lc[" use ".trim().toString()],pN=Object.defineProperty,hN=(e,t)=>pN(e,"name",{value:t,configurable:!0}),mN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xt=mN.reduce((e,t)=>{const n=jo(`Primitive.${t}`),r=I.forwardRef((o,s)=>{const{asChild:l,...u}=o,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(f,{...u,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function GI(e,t){e&&ja.flushSync(()=>e.dispatchEvent(t))}hN(GI,"dispatchDiscreteCustomEvent");var gN=Object.defineProperty,vN=(e,t)=>gN(e,"name",{value:t,configurable:!0});function Wr(e){const t=I.useRef(e);return I.useEffect(()=>{t.current=e}),I.useMemo(()=>((...n)=>t.current?.(...n)),[])}vN(Wr,"useCallbackRef");var yN=Object.defineProperty,gn=(e,t)=>yN(e,"name",{value:t,configurable:!0}),dg="dismissableLayer.update",bN="dismissableLayer.pointerDownOutside",xN="dismissableLayer.focusOutside",Ew,YI=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Tv=I.forwardRef(gn(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:p,...m}=t,g=I.useContext(YI),[x,y]=I.useState(null),w=x?.ownerDocument??globalThis?.document,[,S]=I.useState({}),T=Ut(n,y),k=Array.from(g.layers),[_]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),C=_?k.indexOf(_):-1,E=x?k.indexOf(x):-1,O=g.layersWithOutsidePointerEventsDisabled.size>0,M=E>=C,R=I.useRef(!1),z=XI(Y=>{l?.(Y),f?.(Y),Y.defaultPrevented||p?.()},{ownerDocument:w,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:R,dismissableSurfaces:g.dismissableSurfaces,shouldHandlePointerDownOutside:I.useCallback(Y=>{if(!(Y instanceof Node))return!1;const ae=[...g.branches].some(J=>J.contains(Y));return M&&!ae},[g.branches,M])}),K=JI(Y=>{if(o&&R.current)return;const ae=Y.target;[...g.branches].some(he=>he.contains(ae))||(u?.(Y),f?.(Y),Y.defaultPrevented||p?.())},w),q=x?E===k.length-1:!1,Z=Wr(Y=>{Y.key==="Escape"&&(s?.(Y),!Y.defaultPrevented&&p&&(Y.preventDefault(),p()))});return I.useEffect(()=>{if(q)return w.addEventListener("keydown",Z,{capture:!0}),()=>w.removeEventListener("keydown",Z,{capture:!0})},[w,q,Z]),I.useEffect(()=>{if(x)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(Ew=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(x)),g.layers.add(x),fg(),()=>{r&&(g.layersWithOutsidePointerEventsDisabled.delete(x),g.layersWithOutsidePointerEventsDisabled.size===0&&(w.body.style.pointerEvents=Ew))}},[x,w,r,g]),I.useEffect(()=>()=>{x&&(g.layers.delete(x),g.layersWithOutsidePointerEventsDisabled.delete(x),fg())},[x,g]),I.useEffect(()=>{const Y=gn(()=>S({}),"handleUpdate");return document.addEventListener(dg,Y),()=>document.removeEventListener(dg,Y)},[]),h.jsx(Xt.div,{...m,ref:T,style:{pointerEvents:O?M?"auto":"none":void 0,...t.style},onFocusCapture:jt(t.onFocusCapture,K.onFocusCapture),onBlurCapture:jt(t.onBlurCapture,K.onBlurCapture),onPointerDownCapture:jt(t.onPointerDownCapture,z.onPointerDownCapture)})},"DismissableLayer"));function WI(){const e=I.useContext(YI),[t,n]=I.useState(null);return I.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}gn(WI,"useDismissableLayerSurface");var wN=gn(()=>!0,"IS_TRUE");function XI(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:l=wN}=t,u=Wr(e),f=I.useRef(!1),p=I.useRef(!1),m=I.useRef(new Map),g=I.useRef(()=>{});return I.useEffect(()=>{function x(){p.current=!1,o.current=!1,m.current.clear()}gn(x,"resetOutsideInteraction");function y(){return Array.from(m.current.values()).some(Boolean)}gn(y,"isOutsideInteractionIntercepted");function w(C){if(!p.current)return;const E=C.target;E instanceof Node&&[...s].some(M=>M.contains(E))||m.current.set(C.type,!0),C.type==="click"&&window.setTimeout(()=>{p.current&&g.current()},0)}gn(w,"handleInteractionCapture");function S(C){p.current&&m.current.set(C.type,!1)}gn(S,"handleInteractionBubble");const T=gn(C=>{if(C.target&&!f.current){let E=function(){n.removeEventListener("click",g.current);const M=y();x(),M||jv(bN,u,O,{discrete:!0})};if(gn(E,"handleAndDispatchPointerDownOutsideEvent"),!l(C.target)){n.removeEventListener("click",g.current),x(),f.current=!1;return}const O={originalEvent:C};p.current=!0,o.current=r&&C.button===0,m.current.clear(),!r||C.button!==0?E():(n.removeEventListener("click",g.current),g.current=E,n.addEventListener("click",g.current,{once:!0}))}else n.removeEventListener("click",g.current),x();f.current=!1},"handlePointerDown"),k=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const C of k)n.addEventListener(C,w,!0),n.addEventListener(C,S);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",T)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",T),n.removeEventListener("click",g.current);for(const C of k)n.removeEventListener(C,w,!0),n.removeEventListener(C,S)}},[n,u,r,o,s,l]),{onPointerDownCapture:gn(()=>f.current=!0,"onPointerDownCapture")}}gn(XI,"usePointerDownOutside");function JI(e,t=globalThis?.document){const n=Wr(e),r=I.useRef(!1);return I.useEffect(()=>{const o=gn(s=>{s.target&&!r.current&&jv(xN,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:gn(()=>r.current=!0,"onFocusCapture"),onBlurCapture:gn(()=>r.current=!1,"onBlurCapture")}}gn(JI,"useFocusOutside");function fg(){const e=new CustomEvent(dg);document.dispatchEvent(e)}gn(fg,"dispatchUpdate");function jv(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?GI(o,s):o.dispatchEvent(s)}gn(jv,"handleAndDispatchCustomEvent");var bn=globalThis?.document?I.useLayoutEffect:()=>{},SN=Object.defineProperty,kN=(e,t)=>SN(e,"name",{value:t,configurable:!0}),IN=Lc[" useId ".trim().toString()]||(()=>{}),TN=0;function fa(e){const[t,n]=I.useState(IN());return bn(()=>{e||n(r=>r??String(TN++))},[e]),e||(t?`radix-${t}`:"")}kN(fa,"useId");const jN=["top","right","bottom","left"],Co=Math.min,Ni=Math.max,Kd=Math.round,pd=Math.floor,Pi=e=>({x:e,y:e}),CN={left:"right",right:"left",bottom:"top",top:"bottom"};function eT(e,t,n){return Ni(e,Co(t,n))}function Oi(e,t){return typeof e=="function"?e(t):e}function Eo(e){return e.split("-")[0]}function Vs(e){return e.split("-")[1]}function Cv(e){return e==="x"?"y":"x"}function Ev(e){return e==="y"?"height":"width"}function Gr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _v(e){return Cv(Gr(e))}function EN(e,t,n){n===void 0&&(n=!1);const r=Vs(e),o=_v(e),s=Ev(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Qd(l)),[l,Qd(l)]}function _N(e){const t=Qd(e);return[pg(e),t,pg(t)]}function pg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const _w=["left","right"],Aw=["right","left"],AN=["top","bottom"],MN=["bottom","top"];function NN(e,t,n){switch(e){case"top":case"bottom":return n?t?Aw:_w:t?_w:Aw;case"left":case"right":return t?AN:MN;default:return[]}}function PN(e,t,n,r){const o=Vs(e);let s=NN(Eo(e),n==="start",r);return o&&(s=s.map(l=>l+"-"+o),t&&(s=s.concat(s.map(pg)))),s}function Qd(e){const t=Eo(e);return CN[t]+e.slice(t.length)}function RN(e){var t,n,r,o;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(o=e.left)!=null?o:0}}function tT(e){return typeof e!="number"?RN(e):{top:e,right:e,bottom:e,left:e}}function Gd(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Mw(e,t,n){let{reference:r,floating:o}=e;const s=Gr(t),l=_v(t),u=Ev(l),f=Eo(t),p=s==="y",m=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,x=r[u]/2-o[u]/2;let y;switch(f){case"top":y={x:m,y:r.y-o.height};break;case"bottom":y={x:m,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:g};break;case"left":y={x:r.x-o.width,y:g};break;default:y={x:r.x,y:r.y}}const w=Vs(t);return w&&(y[l]+=x*(w==="end"?1:-1)*(n&&p?-1:1)),y}async function ON(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:l,elements:u,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:x=!1,padding:y=0}=Oi(t,e),w=tT(y),T=u[x?g==="floating"?"reference":"floating":g],k=Gd(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(T)))==null||n?T:T.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:p,rootBoundary:m,strategy:f})),_=g==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),E=await(s.isElement==null?void 0:s.isElement(C))&&await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1},O=Gd(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:_,offsetParent:C,strategy:f}):_);return{top:(k.top-O.top+w.top)/E.y,bottom:(O.bottom-k.bottom+w.bottom)/E.y,left:(k.left-O.left+w.left)/E.x,right:(O.right-k.right+w.right)/E.x}}const zN=50,DN=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:ON},f=await(l.isRTL==null?void 0:l.isRTL(t));let p=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:g}=Mw(p,r,f),x=r,y=0;const w={};for(let S=0;S<s.length;S++){const T=s[S];if(!T)continue;const{name:k,fn:_}=T,{x:C,y:E,data:O,reset:M}=await _({x:m,y:g,initialPlacement:r,placement:x,strategy:o,middlewareData:w,rects:p,platform:u,elements:{reference:e,floating:t}});m=C??m,g=E??g,w[k]={...w[k],...O},M&&y<zN&&(y++,typeof M=="object"&&(M.placement&&(x=M.placement),M.rects&&(p=M.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):M.rects),{x:m,y:g}=Mw(p,x,f)),S=-1)}return{x:m,y:g,placement:x,strategy:o,middlewareData:w}},LN=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:l,elements:u,middlewareData:f}=t,{element:p,padding:m=0}=Oi(e,t)||{};if(p==null)return{};const g=tT(m),x={x:n,y:r},y=_v(o),w=Ev(y),S=await l.getDimensions(p),T=y==="y",k=T?"top":"left",_=T?"bottom":"right",C=T?"clientHeight":"clientWidth",E=s.reference[w]+s.reference[y]-x[y]-s.floating[w],O=x[y]-s.reference[y],M=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let R=M?M[C]:0;(!R||!await(l.isElement==null?void 0:l.isElement(M)))&&(R=u.floating[C]||s.floating[w]);const z=E/2-O/2,K=R/2-S[w]/2-1,q=Co(g[k],K),Z=Co(g[_],K),Y=R-S[w]-Z,ae=R/2-S[w]/2+z,J=eT(q,ae,Y),he=!f.arrow&&Vs(o)!=null&&ae!==J&&s.reference[w]/2-(ae<q?q:Z)-S[w]/2<0,F=he?ae<q?ae-q:ae-Y:0;return{[y]:x[y]+F,data:{[y]:J,centerOffset:ae-J-F,...he&&{alignmentOffset:F}},reset:he}}}),BN=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:l,initialPlacement:u,platform:f,elements:p}=t,{mainAxis:m=!0,crossAxis:g=!0,fallbackPlacements:x,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:S=!0,...T}=Oi(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const k=Eo(o),_=Gr(u),C=Eo(u)===u,E=await(f.isRTL==null?void 0:f.isRTL(p.floating)),O=x||(C||!S?[Qd(u)]:_N(u)),M=w!=="none";!x&&M&&O.push(...PN(u,S,w,E));const R=[u,...O],z=await f.detectOverflow(t,T),K=[];let q=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&K.push(z[k]),g){const J=EN(o,l,E);K.push(z[J[0]],z[J[1]])}if(q=[...q,{placement:o,overflows:K}],!K.every(J=>J<=0)){var Z,Y;const J=(((Z=s.flip)==null?void 0:Z.index)||0)+1,he=R[J];if(he&&(!(g==="alignment"?_!==Gr(he):!1)||q.every(Q=>Gr(Q.placement)===_?Q.overflows[0]>0:!0)))return{data:{index:J,overflows:q},reset:{placement:he}};let F=(Y=q.filter(ee=>ee.overflows[0]<=0).sort((ee,Q)=>ee.overflows[1]-Q.overflows[1])[0])==null?void 0:Y.placement;if(!F)switch(y){case"bestFit":{var ae;const ee=(ae=q.filter(Q=>{if(M){const xe=Gr(Q.placement);return xe===_||xe==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(xe=>xe>0).reduce((xe,P)=>xe+P,0)]).sort((Q,xe)=>Q[1]-xe[1])[0])==null?void 0:ae[0];ee&&(F=ee);break}case"initialPlacement":F=u;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function Nw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pw(e){return jN.some(t=>e[t]>=0)}const qN=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Oi(e,t);switch(o){case"referenceHidden":{const l=await r.detectOverflow(t,{...s,elementContext:"reference"}),u=Nw(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Pw(u)}}}case"escaped":{const l=await r.detectOverflow(t,{...s,altBoundary:!0}),u=Nw(l,n.floating);return{data:{escapedOffsets:u,escaped:Pw(u)}}}default:return{}}}}},nT=new Set(["left","top"]);async function $N(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=Eo(n),u=Vs(n),f=Gr(n)==="y",p=nT.has(l)?-1:1,m=s&&f?-1:1,g=Oi(t,e);let{mainAxis:x,crossAxis:y,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof w=="number"&&(y=u==="end"?w*-1:w),f?{x:y*m,y:x*p}:{x:x*p,y:y*m}}const UN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:l,middlewareData:u}=t,f=await $N(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+f.x,y:s+f.y,data:{...f,placement:l}}}}},HN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:f={fn:_=>{let{x:C,y:E}=_;return{x:C,y:E}}},...p}=Oi(e,t),m={x:n,y:r},g=await s.detectOverflow(t,p),x=Gr(o),y=Cv(x);let w=m[y],S=m[x];const T=(_,C)=>eT(C+g[_==="y"?"top":"left"],C,C-g[_==="y"?"bottom":"right"]);l&&(w=T(y,w)),u&&(S=T(x,S));const k=f.fn({...t,[y]:w,[x]:S});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[y]:l,[x]:u}}}}}},FN=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:o,y:s,placement:l,rects:u,middlewareData:f}=t,{offset:p=0,mainAxis:m=!0,crossAxis:g=!0}=Oi(e,t),x={x:o,y:s},y=Gr(l),w=Cv(y);let S=x[w],T=x[y];const k=Oi(p,t),_=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:(n=k.mainAxis)!=null?n:0,crossAxis:(r=k.crossAxis)!=null?r:0};if(m){const O=w==="y"?"height":"width",M=u.reference[w]-u.floating[O]+_.mainAxis,R=u.reference[w]+u.reference[O]-_.mainAxis;S<M?S=M:S>R&&(S=R)}if(g){var C,E;const O=w==="y"?"width":"height",M=nT.has(Eo(l)),R=u.reference[y]-u.floating[O]+(M&&((C=f.offset)==null?void 0:C[y])||0)+(M?0:_.crossAxis),z=u.reference[y]+u.reference[O]+(M?0:((E=f.offset)==null?void 0:E[y])||0)-(M?_.crossAxis:0);T<R?T=R:T>z&&(T=z)}return{[w]:S,[y]:T}}}},VN=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:l=()=>{},...u}=Oi(e,t),f=await o.detectOverflow(t,u),p=Eo(n),m=Vs(n),g=Gr(n)==="y",{width:x,height:y}=r.floating;let w,S;p==="top"||p==="bottom"?(w=p,S=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(S=p,w=m==="end"?"top":"bottom");const T=y-f.top-f.bottom,k=x-f.left-f.right,_=Co(y-f[w],T),C=Co(x-f[S],k),E=t.middlewareData.shift,O=!E;let M=_,R=C;E!=null&&E.enabled.x&&(R=k),E!=null&&E.enabled.y&&(M=T),O&&!m&&(g?R=x-2*Ni(f.left,f.right):M=y-2*Ni(f.top,f.bottom)),await l({...t,availableWidth:R,availableHeight:M});const z=await o.getDimensions(s.floating);return x!==z.width||y!==z.height?{reset:{rects:!0}}:{}}}};function mf(){return typeof window<"u"}function Zs(e){return rT(e)?(e.nodeName||"").toLowerCase():"#document"}function Yn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ui(e){var t;return(t=(rT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rT(e){return mf()?e instanceof Node||e instanceof Yn(e).Node:!1}function Xr(e){return mf()?e instanceof Element||e instanceof Yn(e).Element:!1}function Mo(e){return mf()?e instanceof HTMLElement||e instanceof Yn(e).HTMLElement:!1}function Rw(e){return!mf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Yn(e).ShadowRoot}function gf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Jr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function ZN(e){return/^(table|td|th)$/.test(Zs(e))}function vf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const KN=/transform|translate|scale|rotate|perspective|filter/,QN=/paint|layout|strict|content/,na=e=>!!e&&e!=="none";let ym;function Av(e){const t=Xr(e)?Jr(e):e;return na(t.transform)||na(t.translate)||na(t.scale)||na(t.rotate)||na(t.perspective)||!Mv()&&(na(t.backdropFilter)||na(t.filter))||KN.test(t.willChange||"")||QN.test(t.contain||"")}function GN(e){let t=ga(e);for(;Mo(t)&&!xc(t);){if(Av(t))return t;if(vf(t))return null;t=ga(t)}return null}function Mv(){return ym==null&&(ym=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ym}function xc(e){return/^(html|body|#document)$/.test(Zs(e))}function Jr(e){return Yn(e).getComputedStyle(e)}function yf(e){return Xr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ga(e){if(Zs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Rw(e)&&e.host||Ui(e);return Rw(t)?t.host:t}function iT(e){const t=ga(e);return xc(t)?(e.ownerDocument||e).body:Mo(t)&&gf(t)?t:iT(t)}function wc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=iT(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),l=Yn(o);if(s){const u=hg(l);return t.concat(l,l.visualViewport||[],gf(o)?o:[],u&&n?wc(u):[])}else return t.concat(o,wc(o,[],n))}function hg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function oT(e){const t=Jr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Mo(e),s=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=Kd(n)!==s||Kd(r)!==l;return u&&(n=s,r=l),{width:n,height:r,$:u}}function Nv(e){return Xr(e)?e:e.contextElement}function As(e){const t=Nv(e);if(!Mo(t))return Pi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=oT(t);let l=(s?Kd(n.width):n.width)/r,u=(s?Kd(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const YN=Pi(0);function aT(e){const t=Yn(e);return!Mv()||!t.visualViewport?YN:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function WN(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Yn(e)}function va(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Nv(e);let l=Pi(1);t&&(r?Xr(r)&&(l=As(r)):l=As(e));const u=WN(s,n,r)?aT(s):Pi(0);let f=(o.left+u.x)/l.x,p=(o.top+u.y)/l.y,m=o.width/l.x,g=o.height/l.y;if(s&&r){const x=Yn(s),y=Xr(r)?Yn(r):r;let w=x,S=hg(w);for(;S&&y!==w;){const T=As(S),k=S.getBoundingClientRect(),_=Jr(S),C=k.left+(S.clientLeft+parseFloat(_.paddingLeft))*T.x,E=k.top+(S.clientTop+parseFloat(_.paddingTop))*T.y;f*=T.x,p*=T.y,m*=T.x,g*=T.y,f+=C,p+=E,w=Yn(S),S=hg(w)}}return Gd({width:m,height:g,x:f,y:p})}function bf(e,t){const n=yf(e).scrollLeft;return t?t.left+n:va(Ui(e)).left+n}function sT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-bf(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function XN(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",l=Ui(r),u=t?vf(t.floating):!1;if(r===l||u&&s)return n;let f={scrollLeft:0,scrollTop:0},p=Pi(1);const m=Pi(0),g=Mo(r);if((g||!s)&&((Zs(r)!=="body"||gf(l))&&(f=yf(r)),g)){const y=va(r);p=As(r),m.x=y.x+r.clientLeft,m.y=y.y+r.clientTop}const x=l&&!g&&!s?sT(l,f):Pi(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-f.scrollLeft*p.x+m.x+x.x,y:n.y*p.y-f.scrollTop*p.y+m.y+x.y}}function JN(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function eP(e){const t=yf(e),n=e.ownerDocument.body,r=Ni(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Ni(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+bf(e);const l=-t.scrollTop;return Jr(n).direction==="rtl"&&(s+=Ni(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:s,y:l}}const tP=25;function nP(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",o=Yn(e),s=Ui(e),l=o.visualViewport;let u=s.clientWidth,f=s.clientHeight,p=0,m=0;if(l){const x=!Mv()||t==="fixed";r?x||(p=-l.offsetLeft,m=-l.offsetTop):(u=l.width,f=l.height,x&&(p=l.offsetLeft,m=l.offsetTop))}if(bf(s)<=0){const x=s.ownerDocument,y=x.body,w=getComputedStyle(y),S=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,T=Math.abs(s.clientWidth-y.clientWidth-S),k=getComputedStyle(s).scrollbarGutter==="stable both-edges"?T/2:T;k<=tP&&(u-=k)}return{width:u,height:f,x:p,y:m}}function rP(e,t){const n=va(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=As(e),l=e.clientWidth*s.x,u=e.clientHeight*s.y,f=o*s.x,p=r*s.y;return{width:l,height:u,x:f,y:p}}function Ow(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=nP(e,n,t);else if(t==="document")r=eP(Ui(e));else if(Xr(t))r=rP(t,n);else{const o=aT(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Gd(r)}function iP(e,t){const n=t.get(e);if(n)return n;let r=wc(e,[],!1).filter(u=>Xr(u)&&Zs(u)!=="body"),o=null;const s=Jr(e).position==="fixed";let l=s?ga(e):e;for(;Xr(l)&&!xc(l);){const u=Jr(l),f=Av(l),p=o?o.position:s?"fixed":"";!f&&(p==="fixed"||p==="absolute"&&u.position==="static")?r=r.filter(g=>g!==l):o=u,l=ga(l)}return t.set(e,r),r}function oP(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const l=[...n==="clippingAncestors"?vf(t)?[]:iP(t,this._c):[].concat(n),r],u=Ow(t,l[0],o);let f=u.top,p=u.right,m=u.bottom,g=u.left;for(let x=1;x<l.length;x++){const y=Ow(t,l[x],o);f=Ni(y.top,f),p=Co(y.right,p),m=Co(y.bottom,m),g=Ni(y.left,g)}return{width:p-g,height:m-f,x:g,y:f}}function aP(e){const{width:t,height:n}=oT(e);return{width:t,height:n}}function sP(e,t,n){const r=Mo(t),o=Ui(t),s=n==="fixed",l=va(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const f=Pi(0);if((r||!s)&&((Zs(t)!=="body"||gf(o))&&(u=yf(t)),r)){const x=va(t,!0,s,t);f.x=x.x+t.clientLeft,f.y=x.y+t.clientTop}!r&&o&&(f.x=bf(o));const p=o&&!r&&!s?sT(o,u):Pi(0),m=l.left+u.scrollLeft-f.x-p.x,g=l.top+u.scrollTop-f.y-p.y;return{x:m,y:g,width:l.width,height:l.height}}function bm(e){return Jr(e).position==="static"}function zw(e,t){if(!Mo(e)||Jr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ui(e)===n&&(n=n.ownerDocument.body),n}function lT(e,t){const n=Yn(e);if(vf(e))return n;if(!Mo(e)){let o=ga(e);for(;o&&!xc(o);){if(Xr(o)&&!bm(o))return o;o=ga(o)}return n}let r=zw(e,t);for(;r&&ZN(r)&&bm(r);)r=zw(r,t);return r&&xc(r)&&bm(r)&&!Av(r)?n:r||GN(e)||n}const lP=async function(e){const t=this.getOffsetParent||lT,n=this.getDimensions,r=await n(e.floating);return{reference:sP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function cP(e){return Jr(e).direction==="rtl"}const uP={convertOffsetParentRelativeRectToViewportRelativeRect:XN,getDocumentElement:Ui,getClippingRect:oP,getOffsetParent:lT,getElementRects:lP,getClientRects:JN,getDimensions:aP,getScale:As,isElement:Xr,isRTL:cP};function cT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dP(e,t,n){let r=null,o;const s=Ui(e);function l(){var m;clearTimeout(o),(m=r)==null||m.disconnect(),r=null}function u(m,g){m===void 0&&(m=!1),g===void 0&&(g=1),l();const x=e.getBoundingClientRect(),{left:y,top:w,width:S,height:T}=x;if(m||t(),!S||!T)return;const k=pd(w),_=pd(s.clientWidth-(y+S)),C=pd(s.clientHeight-(w+T)),E=pd(y),M={rootMargin:-k+"px "+-_+"px "+-C+"px "+-E+"px",threshold:Ni(0,Co(1,g))||1};let R=!0;function z(K){const q=K[0].intersectionRatio;if(!cT(x,e.getBoundingClientRect()))return u();if(q!==g){if(!R)return u();q?u(!1,q):o=setTimeout(()=>{u(!1,1e-7)},1e3)}R=!1}try{r=new IntersectionObserver(z,{...M,root:s.ownerDocument})}catch{r=new IntersectionObserver(z,M)}r.observe(e)}const f=Yn(e),p=()=>u(n);return f.addEventListener("resize",p),u(!0),()=>{f.removeEventListener("resize",p),l()}}function fP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,p=Nv(e),m=o||s?[...p?wc(p):[],...t?wc(t):[]]:[];m.forEach(k=>{o&&k.addEventListener("scroll",n),s&&k.addEventListener("resize",n)});const g=p&&u?dP(p,n,s):null;let x=-1,y=null;l&&(y=new ResizeObserver(k=>{let[_]=k;_&&_.target===p&&y&&t&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var C;(C=y)==null||C.observe(t)})),n()}),p&&!f&&y.observe(p),t&&y.observe(t));let w,S=f?va(e):null;f&&T();function T(){const k=va(e);S&&!cT(S,k)&&n(),S=k,w=requestAnimationFrame(T)}return n(),()=>{var k;m.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),g?.(),(k=y)==null||k.disconnect(),y=null,f&&cancelAnimationFrame(w)}}const pP=UN,hP=HN,mP=BN,gP=VN,vP=qN,Dw=LN,yP=FN,bP=(e,t,n)=>{const r=new Map,o=n??{},s={...uP,...o.platform,_c:r};return DN(e,t,{...o,platform:s})};var xP=typeof document<"u",wP=function(){},Pd=xP?I.useLayoutEffect:wP;function Yd(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Yd(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Yd(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function uT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lw(e,t){const n=uT(e);return Math.round(t*n)/n}function xm(e){const t=I.useRef(e);return Pd(()=>{t.current=e}),t}function SP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:l}={},transform:u=!0,whileElementsMounted:f,open:p}=e,[m,g]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,y]=I.useState(r);Yd(x,r)||y(r);const[w,S]=I.useState(null),[T,k]=I.useState(null),_=I.useCallback(Q=>{Q!==M.current&&(M.current=Q,S(Q))},[]),C=I.useCallback(Q=>{Q!==R.current&&(R.current=Q,k(Q))},[]),E=s||w,O=l||T,M=I.useRef(null),R=I.useRef(null),z=I.useRef(m),K=f!=null,q=xm(f),Z=xm(o),Y=xm(p),ae=I.useCallback(()=>{if(!M.current||!R.current)return;const Q={placement:t,strategy:n,middleware:x};Z.current&&(Q.platform=Z.current),bP(M.current,R.current,Q).then(xe=>{const P={...xe,isPositioned:Y.current!==!1};J.current&&!Yd(z.current,P)&&(z.current=P,ja.flushSync(()=>{g(P)}))})},[x,t,n,Z,Y]);Pd(()=>{p===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,g(Q=>({...Q,isPositioned:!1})))},[p]);const J=I.useRef(!1);Pd(()=>(J.current=!0,()=>{J.current=!1}),[]),Pd(()=>{if(E&&(M.current=E),O&&(R.current=O),E&&O){if(q.current)return q.current(E,O,ae);ae()}},[E,O,ae,q,K]);const he=I.useMemo(()=>({reference:M,floating:R,setReference:_,setFloating:C}),[_,C]),F=I.useMemo(()=>({reference:E,floating:O}),[E,O]),ee=I.useMemo(()=>{const Q={position:n,left:0,top:0};if(!F.floating)return Q;const xe=Lw(F.floating,m.x),P=Lw(F.floating,m.y);return u?{...Q,transform:"translate("+xe+"px, "+P+"px)",...uT(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:xe,top:P}},[n,u,F.floating,m.x,m.y]);return I.useMemo(()=>({...m,update:ae,refs:he,elements:F,floatingStyles:ee}),[m,ae,he,F,ee])}const kP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Dw({element:r.current,padding:o}).fn(n):{}:r?Dw({element:r,padding:o}).fn(n):{}}}},IP=(e,t)=>{const n=pP(e);return{name:n.name,fn:n.fn,options:[e,t]}},TP=(e,t)=>{const n=hP(e);return{name:n.name,fn:n.fn,options:[e,t]}},jP=(e,t)=>({fn:yP(e).fn,options:[e,t]}),CP=(e,t)=>{const n=mP(e);return{name:n.name,fn:n.fn,options:[e,t]}},EP=(e,t)=>{const n=gP(e);return{name:n.name,fn:n.fn,options:[e,t]}},_P=(e,t)=>{const n=vP(e);return{name:n.name,fn:n.fn,options:[e,t]}},AP=(e,t)=>{const n=kP(e);return{name:n.name,fn:n.fn,options:[e,t]}};var MP=Object.defineProperty,NP=(e,t)=>MP(e,"name",{value:t,configurable:!0}),PP=I.forwardRef(NP(function(t,n){const{children:r,width:o=10,height:s=5,...l}=t;return h.jsx(Xt.svg,{...l,ref:n,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:h.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),RP=PP,OP=Object.defineProperty,zP=(e,t)=>OP(e,"name",{value:t,configurable:!0});function dT(e){const[t,n]=I.useState(void 0);return bn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let l,u;if("borderBoxSize"in s){const f=s.borderBoxSize,p=Array.isArray(f)?f[0]:f;l=p.inlineSize,u=p.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}zP(dT,"useSize");var DP=Object.defineProperty,Ri=(e,t)=>DP(e,"name",{value:t,configurable:!0}),fT="Popper",[pT,xf]=Ta(fT),[LP,hT]=pT(fT),BP=Ri(e=>{const{__scopePopper:t,children:n}=e,[r,o]=I.useState(null),[s,l]=I.useState(void 0);return h.jsx(LP,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:l,children:n})},"Popper"),qP="PopperAnchor",$P=I.forwardRef(Ri(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,l=hT(qP,r),u=I.useRef(null),f=l.onAnchorChange,p=I.useCallback(S=>{u.current=S,S&&f(S)},[f]),m=Ut(n,p),g=I.useRef(null);I.useEffect(()=>{if(!o)return;const S=g.current;g.current=o.current,S!==g.current&&f(g.current)});const x=l.placementState&&wf(l.placementState),y=x?.[0],w=x?.[1];return o?null:h.jsx(Xt.div,{"data-radix-popper-side":y,"data-radix-popper-align":w,...s,ref:m})},"PopperAnchor")),mT="PopperContent",[UP,HP]=pT(mT),FP=I.forwardRef(Ri(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:l="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:w="optimized",onPlaced:S,...T}=t,k=hT(mT,r),[_,C]=I.useState(null),E=Ut(n,C),[O,M]=I.useState(null),R=dT(O),z=R?.width??0,K=R?.height??0,q=o+(l!=="center"?"-"+l:""),Z=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},Y=Array.isArray(m)?m:[m],ae=Y.length>0,J={padding:Z,boundary:Y.filter(gT),altBoundary:ae},{refs:he,floatingStyles:F,placement:ee,isPositioned:Q,middlewareData:xe}=SP({strategy:"fixed",placement:q,whileElementsMounted:Ri((...Se)=>fP(...Se,{animationFrame:w==="always"}),"whileElementsMounted"),elements:{reference:k.anchor},middleware:[IP({mainAxis:s+K,alignmentAxis:u}),p&&TP({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?jP():void 0,...J}),p&&CP({...J}),EP({...J,apply:Ri(({elements:Se,rects:B,availableWidth:U,availableHeight:ve})=>{const{width:_e,height:qe}=B.reference,Qe=Se.floating.style;Qe.setProperty("--radix-popper-available-width",`${U}px`),Qe.setProperty("--radix-popper-available-height",`${ve}px`),Qe.setProperty("--radix-popper-anchor-width",`${_e}px`),Qe.setProperty("--radix-popper-anchor-height",`${qe}px`)},"apply")}),O&&AP({element:O,padding:f}),QP({arrowWidth:z,arrowHeight:K}),y&&_P({strategy:"referenceHidden",...J,boundary:ae?J.boundary:void 0})]}),P=k.setPlacementState;bn(()=>(P(ee),()=>{P(void 0)}),[ee,P]);const[$,te]=wf(ee),A=Wr(S);bn(()=>{Q&&A?.()},[Q,A]);const L=xe.arrow?.x,X=xe.arrow?.y,ue=xe.arrow?.centerOffset!==0,[we,ge]=I.useState();return bn(()=>{_&&ge(window.getComputedStyle(_).zIndex)},[_]),h.jsx("div",{ref:he.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:Q?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:we,"--radix-popper-transform-origin":[xe.transformOrigin?.x,xe.transformOrigin?.y].join(" "),...xe.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:h.jsx(UP,{scope:r,placedSide:$,placedAlign:te,onArrowChange:M,arrowX:L,arrowY:X,shouldHideArrow:ue,children:h.jsx(Xt.div,{"data-side":$,"data-align":te,...T,ref:E,style:{...T.style,animation:Q?T.style?.animation:"none"}})})})},"PopperContent")),VP="PopperArrow",ZP={top:"bottom",right:"left",bottom:"top",left:"right"},KP=I.forwardRef(Ri(function(t,n){const{__scopePopper:r,...o}=t,s=HP(VP,r),l=ZP[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(RP,{...o,ref:n,style:{...o.style,display:"block"}})})},"PopperArrow"));function gT(e){return e!==null}Ri(gT,"isNotNull");var QP=Ri(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,l=o.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[p,m]=wf(n),g={start:"0%",center:"50%",end:"100%"}[m],x=(o.arrow?.x??0)+u/2,y=(o.arrow?.y??0)+f/2;let w="",S="";return p==="bottom"?(w=l?g:`${x}px`,S=`${-f}px`):p==="top"?(w=l?g:`${x}px`,S=`${r.floating.height+f}px`):p==="right"?(w=`${-f}px`,S=l?g:`${y}px`):p==="left"&&(w=`${r.floating.width+f}px`,S=l?g:`${y}px`),{data:{x:w,y:S}}}}),"transformOrigin");function wf(e){const[t,n="center"]=e.split("-");return[t,n]}Ri(wf,"getSideAndAlignFromPlacement");var vT=BP,yT=$P,bT=FP,GP=KP,YP=Object.defineProperty,WP=(e,t)=>YP(e,"name",{value:t,configurable:!0}),Pv=I.forwardRef(WP(function(t,n){const{container:r,...o}=t,[s,l]=I.useState(!1);bn(()=>l(!0),[]);const u=r||s&&globalThis?.document?.body;return u?ja.createPortal(h.jsx(Xt.div,{...o,ref:n}),u):null},"Portal")),XP=Object.defineProperty,zi=(e,t)=>XP(e,"name",{value:t,configurable:!0});function xT(e,t){return I.useReducer((n,r)=>t[n][r]??n,e)}zi(xT,"useStateMachine");var Ks=zi(e=>{const{present:t,children:n}=e,r=wT(t),o=typeof n=="function"?n({present:r.isPresent}):I.Children.only(n),s=ST(r.ref,kT(o));return typeof n=="function"||r.isPresent?I.cloneElement(o,{ref:s}):null},"Presence");function wT(e){const[t,n]=I.useState(),r=I.useRef(null),o=I.useRef(e),s=I.useRef("none"),l=I.useRef(void 0),u=e?"mounted":"unmounted",[f,p]=xT(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{f==="mounted"?(s.current=l.current??ks(r.current),l.current=void 0):s.current="none"},[f]),bn(()=>{const m=r.current,g=o.current;if(g!==e){const y=s.current,w=ks(m);e?(l.current=w,p("MOUNT")):w==="none"||m?.display==="none"?p("UNMOUNT"):p(g&&y!==w?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,p]),bn(()=>{if(t){let m;const g=t.ownerDocument.defaultView??window,x=zi(w=>{const T=ks(r.current).includes(CSS.escape(w.animationName));if(w.target===t&&T&&(p("ANIMATION_END"),!o.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",m=g.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},"handleAnimationEnd"),y=zi(w=>{w.target===t&&(s.current=ks(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{g.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:I.useCallback(m=>{if(m){const g=getComputedStyle(m);r.current=g,l.current=ks(g)}else r.current=null;n(m)},[])}}zi(wT,"usePresence");function mg(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}zi(mg,"setRef");function ST(...e){const t=I.useRef(e);return t.current=e,I.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(l=>{const u=mg(l,n);return!o&&typeof u=="function"&&(o=!0),u});if(o)return()=>{for(let l=0;l<s.length;l++){const u=s[l];typeof u=="function"?u():mg(r[l],null)}}},[])}zi(ST,"useStableComposedRefs");function ks(e){return e?.animationName||"none"}zi(ks,"getAnimationName");function kT(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}zi(kT,"getElementRef");var JP=Object.defineProperty,eR=(e,t)=>JP(e,"name",{value:t,configurable:!0}),Bw=Lc[" useEffectEvent ".trim().toString()],qw=Lc[" useInsertionEffect ".trim().toString()];function IT(e){if(typeof Bw=="function")return Bw(e);const t=I.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof qw=="function"?qw(()=>{t.current=e}):bn(()=>{t.current=e}),I.useMemo(()=>((...n)=>t.current?.(...n)),[])}eR(IT,"useEffectEvent");var tR=Object.defineProperty,Bc=(e,t)=>tR(e,"name",{value:t,configurable:!0}),nR=Lc[" useInsertionEffect ".trim().toString()]||bn;function Sc({prop:e,defaultProp:t,onChange:n=Bc(()=>{},"onChange"),caller:r}){const[o,s,l]=TT({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:o,p=I.useCallback(m=>{if(u){const g=jT(m)?m(e):m;g!==e&&l.current?.(g)}else s(m)},[u,e,s,l]);return[f,p]}Bc(Sc,"useControllableState");function TT({defaultProp:e,onChange:t}){const[n,r]=I.useState(e),o=I.useRef(n),s=I.useRef(t);return nR(()=>{s.current=t},[t]),I.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}Bc(TT,"useUncontrolledState");function jT(e){return typeof e=="function"}Bc(jT,"isFunction");var $w=Symbol("RADIX:SYNC_STATE");function rR(e,t,n,r){const{prop:o,defaultProp:s,onChange:l,caller:u}=t,f=o!==void 0,p=IT(l),m=[{...n,state:s}];r&&m.push(r);const[g,x]=I.useReducer((T,k)=>{if(k.type===$w)return{...T,state:k.state};const _=e(T,k);return f&&!Object.is(_.state,T.state)&&p(_.state),_},...m),y=g.state,w=I.useRef(y);I.useEffect(()=>{w.current!==y&&(w.current=y,f||p(y))},[y,w,f]);const S=I.useMemo(()=>o!==void 0?{...g,state:o}:g,[g,o]);return I.useEffect(()=>{f&&!Object.is(o,g.state)&&x({type:$w,state:o})},[o,g.state,f]),[S,x]}Bc(rR,"useControllableStateReducer");var iR=Object.defineProperty,oR=(e,t)=>iR(e,"name",{value:t,configurable:!0}),CT=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),aR=I.forwardRef(oR(function(t,n){return h.jsx(Xt.span,{...t,ref:n,style:{...CT,...t.style}})},"VisuallyHidden")),sR=aR,lR=Object.defineProperty,pn=(e,t)=>lR(e,"name",{value:t,configurable:!0}),[Rv,kX]=Ta("Tooltip",[xf]),Sf=xf(),cR="TooltipProvider",uR=700,gg="tooltip.open",[dR,Ov]=Rv(cR),fR=pn(e=>{const{__scopeTooltip:t,delayDuration:n=uR,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,l=I.useRef(!0),u=I.useRef(!1),f=I.useRef(0);return I.useEffect(()=>{const p=f.current;return()=>window.clearTimeout(p)},[]),h.jsx(dR,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:I.useCallback(()=>{r<=0||(window.clearTimeout(f.current),l.current=!1)},[r]),onClose:I.useCallback(()=>{r<=0||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.current=!0,r))},[r]),isPointerInTransitRef:u,onPointerInTransitChange:I.useCallback(p=>{u.current=p},[]),disableHoverableContent:o,children:s})},"TooltipProvider"),vg="Tooltip",[pR,qc]=Rv(vg),hR=pn(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:l,delayDuration:u}=e,f=Ov(vg,e.__scopeTooltip),p=Sf(t),[m,g]=I.useState(null),[x,y]=I.useState(void 0),w=fa(),S=I.useRef(0),T=l??f.disableHoverableContent,k=u??f.delayDuration,_=I.useRef(!1),[C,E]=Sc({prop:r,defaultProp:o??!1,onChange:pn(q=>{q?(f.onOpen(),document.dispatchEvent(new CustomEvent(gg))):f.onClose(),s?.(q)},"onChange"),caller:vg}),O=I.useMemo(()=>C?_.current?"delayed-open":"instant-open":"closed",[C]),M=I.useCallback(()=>{window.clearTimeout(S.current),S.current=0,_.current=!1,E(!0)},[E]),R=I.useCallback(()=>{window.clearTimeout(S.current),S.current=0,E(!1)},[E]),z=I.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{_.current=!0,E(!0),S.current=0},k)},[k,E]);I.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]);const K=x??w;return h.jsx(vT,{...p,children:h.jsx(pR,{scope:t,contentId:K,setContentId:y,open:C,stateAttribute:O,trigger:m,onTriggerChange:g,onTriggerEnter:I.useCallback(()=>{f.isOpenDelayedRef.current?z():M()},[f.isOpenDelayedRef,z,M]),onTriggerLeave:I.useCallback(()=>{T?R():(window.clearTimeout(S.current),S.current=0)},[R,T]),onOpen:M,onClose:R,disableHoverableContent:T,children:n})})},"Tooltip"),Uw="TooltipTrigger",mR=I.forwardRef(pn(function(t,n){const{__scopeTooltip:r,...o}=t,s=qc(Uw,r),l=Ov(Uw,r),u=Sf(r),f=I.useRef(null),p=Ut(n,f,s.onTriggerChange),m=I.useRef(!1),g=I.useRef(!1),x=I.useCallback(()=>m.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),h.jsx(yT,{asChild:!0,...u,children:h.jsx(Xt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...o,ref:p,onPointerMove:jt(t.onPointerMove,y=>{y.pointerType!=="touch"&&!g.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),g.current=!0)}),onPointerLeave:jt(t.onPointerLeave,()=>{s.onTriggerLeave(),g.current=!1}),onPointerDown:jt(t.onPointerDown,()=>{s.open&&s.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:jt(t.onFocus,()=>{m.current||s.onOpen()}),onBlur:jt(t.onBlur,s.onClose),onClick:jt(t.onClick,s.onClose)})})},"TooltipTrigger")),ET="TooltipPortal",[gR,vR]=Rv(ET,{forceMount:void 0}),yR=pn(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=qc(ET,t);return h.jsx(gR,{scope:t,forceMount:n,children:h.jsx(Ks,{present:n||s.open,children:h.jsx(Pv,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),kc="TooltipContent",bR=I.forwardRef(pn(function(t,n){const r=vR(kc,t.__scopeTooltip),{forceMount:o=r.forceMount,side:s="top",...l}=t,u=qc(kc,t.__scopeTooltip);return h.jsx(Ks,{present:o||u.open,children:u.disableHoverableContent?h.jsx(_T,{side:s,...l,ref:n}):h.jsx(xR,{side:s,...l,ref:n})})},"TooltipContent")),xR=I.forwardRef(pn(function(t,n){const r=qc(kc,t.__scopeTooltip),o=Ov(kc,t.__scopeTooltip),s=I.useRef(null),l=Ut(n,s),[u,f]=I.useState(null),{trigger:p,onClose:m}=r,g=s.current,{onPointerInTransitChange:x}=o,y=I.useCallback(()=>{f(null),x(!1)},[x]),w=I.useCallback((S,T)=>{const k=S.currentTarget,_={x:S.clientX,y:S.clientY},C=AT(_,k.getBoundingClientRect()),E=MT(_,C),O=NT(T.getBoundingClientRect()),M=RT([...E,...O]);f(M),x(!0)},[x]);return I.useEffect(()=>()=>y(),[y]),I.useEffect(()=>{if(p&&g){const S=pn(k=>w(k,g),"handleTriggerLeave"),T=pn(k=>w(k,p),"handleContentLeave");return p.addEventListener("pointerleave",S),g.addEventListener("pointerleave",T),()=>{p.removeEventListener("pointerleave",S),g.removeEventListener("pointerleave",T)}}},[p,g,w,y]),I.useEffect(()=>{if(u){const S=pn(T=>{const k=T.target,_={x:T.clientX,y:T.clientY},C=p?.contains(k)||g?.contains(k),E=!PT(_,u);C?y():E&&(y(),m())},"handleTrackPointerGrace");return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[p,g,u,m,y]),h.jsx(_T,{...t,ref:l})},"TooltipContentHoverable")),wR=FI("TooltipContent"),_T=I.forwardRef(pn(function(t,n){const{__scopeTooltip:r,children:o,"aria-label":s,id:l,onEscapeKeyDown:u,onPointerDownOutside:f,...p}=t,m=qc(kc,r),g=Sf(r),{onClose:x}=m;I.useEffect(()=>(document.addEventListener(gg,x),()=>document.removeEventListener(gg,x)),[x]),I.useEffect(()=>{if(m.trigger){const w=pn(S=>{S.target instanceof Node&&S.target.contains(m.trigger)&&x()},"handleScroll");return window.addEventListener("scroll",w,{capture:!0}),()=>window.removeEventListener("scroll",w,{capture:!0})}},[m.trigger,x]);const{setContentId:y}=m;return bn(()=>(y(l),()=>{y(void 0)}),[l,y]),h.jsx(Tv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:w=>w.preventDefault(),onDismiss:x,children:h.jsxs(bT,{"data-state":m.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:m.contentId,...g,...p,ref:n,style:{...p.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(wR,{children:o}),s?h.jsx(sR,{id:m.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl")),SR=I.forwardRef(pn(function(t,n){const{__scopeTooltip:r,...o}=t,s=Sf(r);return h.jsx(GP,{...s,...o,ref:n})},"TooltipArrow"));function AT(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}pn(AT,"getExitSideFromRect");function MT(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}pn(MT,"getPaddedExitPoints");function NT(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}pn(NT,"getPointsFromRect");function PT(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,l=t.length-1;s<t.length;l=s++){const u=t[s],f=t[l],p=u.x,m=u.y,g=f.x,x=f.y;m>r!=x>r&&n<(g-p)*(r-m)/(x-m)+p&&(o=!o)}return o}pn(PT,"isPointInPolygon");function RT(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),OT(t)}pn(RT,"getHull");function OT(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(o.y-l.y)>=(s.y-l.y)*(o.x-l.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],l=n[n.length-2];if((s.x-l.x)*(o.y-l.y)>=(s.y-l.y)*(o.x-l.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}pn(OT,"getHullPresorted");var kR=hR,IR=mR,TR=yR,jR=bR,CR=SR;const ER="modulepreload",_R=function(e){return"/"+e},Hw={},$c=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let f=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");o=f(n.map(p=>{if(p=_R(p),p in Hw)return;Hw[p]=!0;const m=p.endsWith(".css"),g=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const x=document.createElement("link");if(x.rel=m?"stylesheet":ER,m||(x.as="script"),x.crossOrigin="",x.href=p,u&&x.setAttribute("nonce",u),document.head.appendChild(x),m)return new Promise((y,w)=>{x.addEventListener("load",y),x.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return o.then(l=>{for(const u of l||[])u.status==="rejected"&&s(u.reason);return t().catch(s)})};const AR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),MR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fw=e=>{const t=MR(e);return t.charAt(0).toUpperCase()+t.slice(1)},zT=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),NR=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var PR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const RR=I.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:l,...u},f)=>I.createElement("svg",{ref:f,...PR,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:zT("lucide",o),...!s&&!NR(u)&&{"aria-hidden":"true"},...u},[...l.map(([p,m])=>I.createElement(p,m)),...Array.isArray(s)?s:[s]]));const Ce=(e,t)=>{const n=I.forwardRef(({className:r,...o},s)=>I.createElement(RR,{ref:s,iconNode:t,className:zT(`lucide-${AR(Fw(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fw(e),n};const OR=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],DT=Ce("activity",OR);const zR=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],zv=Ce("arrow-down",zR);const DR=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],LR=Ce("arrow-left",DR);const BR=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],qR=Ce("arrow-up-right",BR);const $R=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Rd=Ce("arrow-up",$R);const UR=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Qs=Ce("bot",UR);const HR=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],FR=Ce("box",HR);const VR=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],LT=Ce("braces",VR);const ZR=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],Dv=Ce("brain-circuit",ZR);const KR=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],QR=Ce("chart-column",KR);const GR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lv=Ce("check",GR);const YR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gs=Ce("chevron-down",YR);const WR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ys=Ce("chevron-right",WR);const XR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],BT=Ce("circle-alert",XR);const JR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kf=Ce("circle-check",JR);const eO=[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],Bv=Ce("circle-dot-dashed",eO);const tO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],nO=Ce("circle-stop",tO);const rO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],qT=Ce("circle-x",rO);const iO=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],qv=Ce("clipboard",iO);const oO=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$v=Ce("clock-3",oO);const aO=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],sO=Ce("code-xml",aO);const lO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],cO=Ce("columns-2",lO);const uO=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],dO=Ce("command",uO);const fO=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],pO=Ce("copy",fO);const hO=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],mO=Ce("corner-down-left",hO);const gO=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],$T=Ce("database",gO);const vO=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],UT=Ce("download",vO);const yO=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],HT=Ce("ellipsis",yO);const bO=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],xO=Ce("external-link",bO);const wO=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M8 14v2.2l1.6 1",key:"6m4bie"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}]],SO=Ce("file-clock",wO);const kO=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],FT=Ce("file-code-2",kO);const IO=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]],TO=Ce("file-json-2",IO);const jO=[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]],Vw=Ce("file-pen-line",jO);const CO=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]],Zw=Ce("file-search",CO);const EO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],VT=Ce("file-spreadsheet",EO);const _O=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Uc=Ce("file-text",_O);const AO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],MO=Ce("file-warning",AO);const NO=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],PO=Ce("file",NO);const RO=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ic=Ce("folder-open",RO);const OO=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Uv=Ce("folder",OO);const zO=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Kw=Ce("gauge",zO);const DO=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Tc=Ce("image",DO);const LO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],BO=Ce("info",LO);const qO=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],$O=Ce("layers",qO);const UO=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ZT=Ce("link-2",UO);const HO=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ot=Ce("loader-circle",HO);const FO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],yg=Ce("message-square-plus",FO);const VO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],ZO=Ce("message-square-text",VO);const KO=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Qw=Ce("message-square",KO);const QO=[["path",{d:"M15.033 9.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56V7.648a.645.645 0 0 1 .967-.56z",key:"vbtd3f"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]],Od=Ce("monitor-play",QO);const GO=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],YO=Ce("moon",GO);const WO=[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]],KT=Ce("package-open",WO);const XO=[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]],JO=Ce("paintbrush",XO);const ez=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],tz=Ce("panel-left-close",ez);const nz=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Wd=Ce("paperclip",nz);const rz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],iz=Ce("panels-top-left",rz);const oz=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Hv=Ce("pencil",oz);const az=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],QT=Ce("play",az);const sz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],If=Ce("plus",sz);const lz=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],cz=Ce("puzzle",lz);const uz=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],Ws=Ce("refresh-ccw",uz);const dz=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],GT=Ce("refresh-cw",dz);const fz=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Gw=Ce("rotate-ccw",fz);const pz=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],YT=Ce("rotate-cw",pz);const hz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Tf=Ce("search",hz);const mz=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],gz=Ce("send",mz);const vz=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],WT=Ce("settings-2",vz);const yz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Fv=Ce("shield-alert",yz);const bz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Vv=Ce("shield-check",bz);const xz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],wz=Ce("shield",xz);const Sz=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],XT=Ce("sparkles",Sz);const kz=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],Iz=Ce("square-arrow-out-up-right",kz);const Tz=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],jz=Ce("square-terminal",Tz);const Cz=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ez=Ce("square",Cz);const _z=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Az=Ce("sun",_z);const Mz=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]],Nz=Ce("timer-reset",Mz);const Pz=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],jf=Ce("trash-2",Pz);const Rz=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Mi=Ce("triangle-alert",Rz);const Oz=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],zz=Ce("user-round",Oz);const Dz=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Lz=Ce("wifi-off",Dz);const Bz=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],qz=Ce("wifi",Bz);const $z=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ei=Ce("x",$z);const Uz=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],JT=Ce("zap",Uz);var Yw;function fe(e,t,n){function r(u,f){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:f,constr:l,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,f);const p=l.prototype,m=Object.keys(p);for(let g=0;g<m.length;g++){const x=m[g];x in u||(u[x]=p[x].bind(u))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function l(u){var f;const p=n?.Parent?new s:this;r(p,u),(f=p._zod).deferred??(f.deferred=[]);for(const m of p._zod.deferred)m();return p}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class Ms extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ej extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Yw=globalThis).__zod_globalConfig??(Yw.__zod_globalConfig={});const Zv=globalThis.__zod_globalConfig;function Di(e){return Zv}function tj(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function bg(e,t){return typeof t=="bigint"?t.toString():t}function Cf(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Kv(e){return e==null}function Qv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Hz(e,t){const n=e/t,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}const Ww=Symbol("evaluating");function pt(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ww)return r===void 0&&(r=Ww,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ca(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function No(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Xw(e){return JSON.stringify(e)}function Fz(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const nj="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function jc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Vz=Cf(()=>{if(Zv.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function zs(e){if(jc(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(jc(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function rj(e){return zs(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Zz=new Set(["string","number","symbol"]);function Ds(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Po(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function De(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Kz(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Qz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Gz(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=No(e._zod.def,{get shape(){const l={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(l[u]=n.shape[u])}return Ca(this,"shape",l),l},checks:[]});return Po(e,s)}function Yz(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=No(e._zod.def,{get shape(){const l={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete l[u]}return Ca(this,"shape",l),l},checks:[]});return Po(e,s)}function Wz(e,t){if(!zs(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const l in t)if(Object.getOwnPropertyDescriptor(s,l)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=No(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Ca(this,"shape",s),s}});return Po(e,o)}function Xz(e,t){if(!zs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=No(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Ca(this,"shape",r),r}});return Po(e,n)}function Jz(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=No(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Ca(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Po(e,n)}function eD(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const l=No(t._zod.def,{get shape(){const u=t._zod.def.shape,f={...u};if(n)for(const p in n){if(!(p in u))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(f[p]=e?new e({type:"optional",innerType:u[p]}):u[p])}else for(const p in u)f[p]=e?new e({type:"optional",innerType:u[p]}):u[p];return Ca(this,"shape",f),f},checks:[]});return Po(t,l)}function tD(e,t,n){const r=No(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const l in n){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);n[l]&&(s[l]=new e({type:"nonoptional",innerType:o[l]}))}else for(const l in o)s[l]=new e({type:"nonoptional",innerType:o[l]});return Ca(this,"shape",s),s}});return Po(t,r)}function Es(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nD(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function _s(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function hd(e){return typeof e=="string"?e:e?.message}function Li(e,t,n){const r=e.message?e.message:hd(e.inst?._zod.def?.error?.(e))??hd(t?.error?.(e))??hd(n.customError?.(e))??hd(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:l,...u}=e;return u.path??(u.path=[]),u.message=r,t?.reportInput&&(u.input=l),u}function Gv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Cc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ij=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},oj=fe("$ZodError",ij),aj=fe("$ZodError",ij,{Parent:Error});function rD(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function iD(e,t=n=>n.message){const n={_errors:[]},r=(o,s=[])=>{for(const l of o.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u},[...s,...l.path]));else if(l.code==="invalid_key")r({issues:l.issues},[...s,...l.path]);else if(l.code==="invalid_element")r({issues:l.issues},[...s,...l.path]);else{const u=[...s,...l.path];if(u.length===0)n._errors.push(t(l));else{let f=n,p=0;for(;p<u.length;){const m=u[p];p===u.length-1?(f[m]=f[m]||{_errors:[]},f[m]._errors.push(t(l))):f[m]=f[m]||{_errors:[]},f=f[m],p++}}}};return r(e),n}const Yv=e=>(t,n,r,o)=>{const s=r?{...r,async:!1}:{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Ms;if(l.issues.length){const u=new(o?.Err??e)(l.issues.map(f=>Li(f,s,Di())));throw nj(u,o?.callee),u}return l.value},Wv=e=>async(t,n,r,o)=>{const s=r?{...r,async:!0}:{async:!0};let l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const u=new(o?.Err??e)(l.issues.map(f=>Li(f,s,Di())));throw nj(u,o?.callee),u}return l.value},Ef=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Ms;return s.issues.length?{success:!1,error:new(e??oj)(s.issues.map(l=>Li(l,o,Di())))}:{success:!0,data:s.value}},oD=Ef(aj),_f=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(l=>Li(l,o,Di())))}:{success:!0,data:s.value}},aD=_f(aj),sD=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Yv(e)(t,n,o)},lD=e=>(t,n,r)=>Yv(e)(t,n,r),cD=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Wv(e)(t,n,o)},uD=e=>async(t,n,r)=>Wv(e)(t,n,r),dD=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Ef(e)(t,n,o)},fD=e=>(t,n,r)=>Ef(e)(t,n,r),pD=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return _f(e)(t,n,o)},hD=e=>async(t,n,r)=>_f(e)(t,n,r),mD=/^[cC][0-9a-z]{6,}$/,gD=/^[0-9a-z]+$/,vD=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yD=/^[0-9a-vA-V]{20}$/,bD=/^[A-Za-z0-9]{27}$/,xD=/^[a-zA-Z0-9_-]{21}$/,wD=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,SD=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Jw=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kD=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ID="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function TD(){return new RegExp(ID,"u")}const jD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,CD=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ED=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,_D=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,AD=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sj=/^[A-Za-z0-9_-]*$/,MD=/^https?$/,ND=/^\+[1-9]\d{6,14}$/,lj="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",PD=new RegExp(`^${lj}$`);function cj(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function RD(e){return new RegExp(`^${cj(e)}$`)}function OD(e){const t=cj({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${lj}T(?:${r})$`)}const zD=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},DD=/^-?\d+$/,uj=/^-?\d+(?:\.\d+)?$/,LD=/^(?:true|false)$/i,BD=/^null$/i,qD=/^[^A-Z]*$/,$D=/^[^a-z]*$/,Wn=fe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),dj={number:"number",bigint:"bigint",object:"date"},fj=fe("$ZodCheckLessThan",(e,t)=>{Wn.init(e,t);const n=dj[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pj=fe("$ZodCheckGreaterThan",(e,t)=>{Wn.init(e,t);const n=dj[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),UD=fe("$ZodCheckMultipleOf",(e,t)=>{Wn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Hz(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),HD=fe("$ZodCheckNumberFormat",(e,t)=>{Wn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Qz[t.format];e._zod.onattach.push(l=>{const u=l._zod.bag;u.format=t.format,u.minimum=o,u.maximum=s,n&&(u.pattern=DD)}),e._zod.check=l=>{const u=l.value;if(n){if(!Number.isInteger(u)){l.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?l.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):l.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&l.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>s&&l.issues.push({origin:"number",input:u,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),FD=fe("$ZodCheckMaxLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kv(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const l=Gv(o);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),VD=fe("$ZodCheckMinLength",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kv(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const l=Gv(o);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ZD=fe("$ZodCheckLengthEquals",(e,t)=>{var n;Wn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kv(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const l=Gv(o),u=s>t.length;r.issues.push({origin:l,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Af=fe("$ZodCheckStringFormat",(e,t)=>{var n,r;Wn.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),KD=fe("$ZodCheckRegex",(e,t)=>{Af.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),QD=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qD),Af.init(e,t)}),GD=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$D),Af.init(e,t)}),YD=fe("$ZodCheckIncludes",(e,t)=>{Wn.init(e,t);const n=Ds(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),WD=fe("$ZodCheckStartsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`^${Ds(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),XD=fe("$ZodCheckEndsWith",(e,t)=>{Wn.init(e,t);const n=new RegExp(`.*${Ds(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),JD=fe("$ZodCheckOverwrite",(e,t)=>{Wn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class e3{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
11
+ `).filter(l=>l),o=Math.min(...r.map(l=>l.length-l.trimStart().length)),s=r.map(l=>l.slice(o)).map(l=>" ".repeat(this.indent*2)+l);for(const l of s)this.content.push(l)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
12
+ `))}}const t3={major:4,minor:4,patch:3},zt=fe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=t3;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(l,u,f)=>{let p=Es(l),m;for(const g of u){if(g._zod.def.when){if(nD(l)||!g._zod.def.when(l))continue}else if(p)continue;const x=l.issues.length,y=g._zod.check(l);if(y instanceof Promise&&f?.async===!1)throw new Ms;if(m||y instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await y,l.issues.length!==x&&(p||(p=Es(l,x)))});else{if(l.issues.length===x)continue;p||(p=Es(l,x))}}return m?m.then(()=>l):l},s=(l,u,f)=>{if(Es(l))return l.aborted=!0,l;const p=o(u,r,f);if(p instanceof Promise){if(f.async===!1)throw new Ms;return p.then(m=>e._zod.parse(m,f))}return e._zod.parse(p,f)};e._zod.run=(l,u)=>{if(u.skipChecks)return e._zod.parse(l,u);if(u.direction==="backward"){const p=e._zod.parse({value:l.value,issues:[]},{...u,skipChecks:!0});return p instanceof Promise?p.then(m=>s(m,l,u)):s(p,l,u)}const f=e._zod.parse(l,u);if(f instanceof Promise){if(u.async===!1)throw new Ms;return f.then(p=>o(p,r,u))}return o(f,r,u)}}pt(e,"~standard",()=>({validate:o=>{try{const s=oD(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return aD(e,o).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}))}),Xv=fe("$ZodString",(e,t)=>{zt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zD(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),qt=fe("$ZodStringFormat",(e,t)=>{Af.init(e,t),Xv.init(e,t)}),n3=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=SD),qt.init(e,t)}),r3=fe("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Jw(r))}else t.pattern??(t.pattern=Jw());qt.init(e,t)}),i3=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kD),qt.init(e,t)}),o3=fe("$ZodURL",(e,t)=>{qt.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===MD.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),a3=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=TD()),qt.init(e,t)}),s3=fe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=xD),qt.init(e,t)}),l3=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=mD),qt.init(e,t)}),c3=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gD),qt.init(e,t)}),u3=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=vD),qt.init(e,t)}),d3=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yD),qt.init(e,t)}),f3=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bD),qt.init(e,t)}),p3=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=OD(t)),qt.init(e,t)}),h3=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=PD),qt.init(e,t)}),m3=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RD(t)),qt.init(e,t)}),g3=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wD),qt.init(e,t)}),v3=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=jD),qt.init(e,t),e._zod.bag.format="ipv4"}),y3=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=CD),qt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),b3=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ED),qt.init(e,t)}),x3=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=_D),qt.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const l=Number(s);if(`${l}`!==s)throw new Error;if(l<0||l>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function hj(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const w3=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=AD),qt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{hj(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function S3(e){if(!sj.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return hj(n)}const k3=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=sj),qt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{S3(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),I3=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ND),qt.init(e,t)});function T3(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const j3=fe("$ZodJWT",(e,t)=>{qt.init(e,t),e._zod.check=n=>{T3(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),mj=fe("$ZodNumber",(e,t)=>{zt.init(e,t),e._zod.pattern=e._zod.bag.pattern??uj,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),C3=fe("$ZodNumberFormat",(e,t)=>{HD.init(e,t),mj.init(e,t)}),E3=fe("$ZodBoolean",(e,t)=>{zt.init(e,t),e._zod.pattern=LD,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),_3=fe("$ZodNull",(e,t)=>{zt.init(e,t),e._zod.pattern=BD,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),A3=fe("$ZodUnknown",(e,t)=>{zt.init(e,t),e._zod.parse=n=>n}),M3=fe("$ZodNever",(e,t)=>{zt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function eS(e,t,n){e.issues.length&&t.issues.push(..._s(n,e.issues)),t.value[n]=e.value}const N3=fe("$ZodArray",(e,t)=>{zt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let l=0;l<o.length;l++){const u=o[l],f=t.element._zod.run({value:u,issues:[]},r);f instanceof Promise?s.push(f.then(p=>eS(p,n,l))):eS(f,n,l)}return s.length?Promise.all(s).then(()=>n):n}});function Xd(e,t,n,r,o,s){const l=n in r;if(e.issues.length){if(o&&s&&!l)return;t.issues.push(..._s(n,e.issues))}if(!l&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?l&&(t.value[n]=void 0):t.value[n]=e.value}function gj(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Kz(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function vj(e,t,n,r,o,s){const l=[],u=o.keySet,f=o.catchall._zod,p=f.def.type,m=f.optin==="optional",g=f.optout==="optional";for(const x in t){if(x==="__proto__"||u.has(x))continue;if(p==="never"){l.push(x);continue}const y=f.run({value:t[x],issues:[]},r);y instanceof Promise?e.push(y.then(w=>Xd(w,n,x,t,m,g))):Xd(y,n,x,t,m,g)}return l.length&&n.issues.push({code:"unrecognized_keys",keys:l,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const P3=fe("$ZodObject",(e,t)=>{if(zt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const f={...u};return Object.defineProperty(t,"shape",{value:f}),f}})}const r=Cf(()=>gj(t));pt(e._zod,"propValues",()=>{const u=t.shape,f={};for(const p in u){const m=u[p]._zod;if(m.values){f[p]??(f[p]=new Set);for(const g of m.values)f[p].add(g)}}return f});const o=jc,s=t.catchall;let l;e._zod.parse=(u,f)=>{l??(l=r.value);const p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};const m=[],g=l.shape;for(const x of l.keys){const y=g[x],w=y._zod.optin==="optional",S=y._zod.optout==="optional",T=y._zod.run({value:p[x],issues:[]},f);T instanceof Promise?m.push(T.then(k=>Xd(k,u,x,p,w,S))):Xd(T,u,x,p,w,S)}return s?vj(m,p,u,f,r.value,e):m.length?Promise.all(m).then(()=>u):u}}),R3=fe("$ZodObjectJIT",(e,t)=>{P3.init(e,t);const n=e._zod.parse,r=Cf(()=>gj(t)),o=x=>{const y=new e3(["shape","payload","ctx"]),w=r.value,S=C=>{const E=Xw(C);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};y.write("const input = payload.value;");const T=Object.create(null);let k=0;for(const C of w.keys)T[C]=`key_${k++}`;y.write("const newResult = {};");for(const C of w.keys){const E=T[C],O=Xw(C),M=x[C],R=M?._zod?.optin==="optional",z=M?._zod?.optout==="optional";y.write(`const ${E} = ${S(C)};`),R&&z?y.write(`
13
+ if (${E}.issues.length) {
14
+ if (${O} in input) {
15
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
16
+ ...iss,
17
+ path: iss.path ? [${O}, ...iss.path] : [${O}]
18
+ })));
19
+ }
20
+ }
21
+
22
+ if (${E}.value === undefined) {
23
+ if (${O} in input) {
24
+ newResult[${O}] = undefined;
25
+ }
26
+ } else {
27
+ newResult[${O}] = ${E}.value;
28
+ }
29
+
30
+ `):R?y.write(`
31
+ if (${E}.issues.length) {
32
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
33
+ ...iss,
34
+ path: iss.path ? [${O}, ...iss.path] : [${O}]
35
+ })));
36
+ }
37
+
38
+ if (${E}.value === undefined) {
39
+ if (${O} in input) {
40
+ newResult[${O}] = undefined;
41
+ }
42
+ } else {
43
+ newResult[${O}] = ${E}.value;
44
+ }
45
+
46
+ `):y.write(`
47
+ const ${E}_present = ${O} in input;
48
+ if (${E}.issues.length) {
49
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
50
+ ...iss,
51
+ path: iss.path ? [${O}, ...iss.path] : [${O}]
52
+ })));
53
+ }
54
+ if (!${E}_present && !${E}.issues.length) {
55
+ payload.issues.push({
56
+ code: "invalid_type",
57
+ expected: "nonoptional",
58
+ input: undefined,
59
+ path: [${O}]
60
+ });
61
+ }
62
+
63
+ if (${E}_present) {
64
+ if (${E}.value === undefined) {
65
+ newResult[${O}] = undefined;
66
+ } else {
67
+ newResult[${O}] = ${E}.value;
68
+ }
69
+ }
70
+
71
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");const _=y.compile();return(C,E)=>_(x,C,E)};let s;const l=jc,u=!Zv.jitless,p=u&&Vz.value,m=t.catchall;let g;e._zod.parse=(x,y)=>{g??(g=r.value);const w=x.value;return l(w)?u&&p&&y?.async===!1&&y.jitless!==!0?(s||(s=o(t.shape)),x=s(x,y),m?vj([],w,x,y,g,e):x):n(x,y):(x.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),x)}});function tS(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Es(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(l=>Li(l,r,Di())))}),t)}const yj=fe("$ZodUnion",(e,t)=>{zt.init(e,t),pt(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),pt(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),pt(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),pt(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Qv(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const l=[];for(const u of t.options){const f=u._zod.run({value:r.value,issues:[]},o);if(f instanceof Promise)l.push(f),s=!0;else{if(f.issues.length===0)return f;l.push(f)}}return s?Promise.all(l).then(u=>tS(u,r,e,o)):tS(l,r,e,o)}}),O3=fe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,yj.init(e,t);const n=e._zod.parse;pt(e._zod,"propValues",()=>{const o={};for(const s of t.options){const l=s._zod.propValues;if(!l||Object.keys(l).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,f]of Object.entries(l)){o[u]||(o[u]=new Set);for(const p of f)o[u].add(p)}}return o});const r=Cf(()=>{const o=t.options,s=new Map;for(const l of o){const u=l._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(l)}"`);for(const f of u){if(s.has(f))throw new Error(`Duplicate discriminator value "${String(f)}"`);s.set(f,l)}}return s});e._zod.parse=(o,s)=>{const l=o.value;if(!jc(l))return o.issues.push({code:"invalid_type",expected:"object",input:l,inst:e}),o;const u=r.value.get(l?.[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback||s.direction==="backward"?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:l,path:[t.discriminator],inst:e}),o)}}),z3=fe("$ZodIntersection",(e,t)=>{zt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),l=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||l instanceof Promise?Promise.all([s,l]).then(([f,p])=>nS(n,f,p)):nS(n,s,l)}});function xg(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(zs(e)&&zs(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const l=xg(e[s],t[s]);if(!l.valid)return{valid:!1,mergeErrorPath:[s,...l.mergeErrorPath]};o[s]=l.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],l=xg(o,s);if(!l.valid)return{valid:!1,mergeErrorPath:[r,...l.mergeErrorPath]};n.push(l.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function nS(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const f of u.keys)r.has(f)||r.set(f,{}),r.get(f).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const f of u.keys)r.has(f)||r.set(f,{}),r.get(f).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),Es(e))return e;const l=xg(t.value,n.value);if(!l.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(l.mergeErrorPath)}`);return e.value=l.data,e}const D3=fe("$ZodRecord",(e,t)=>{zt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!zs(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],l=t.keyType._zod.values;if(l){n.value={};const u=new Set;for(const p of l)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){u.add(typeof p=="number"?p.toString():p);const m=t.keyType._zod.run({value:p,issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(m.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(y=>Li(y,r,Di())),input:p,path:[p],inst:e});continue}const g=m.value,x=t.valueType._zod.run({value:o[p],issues:[]},r);x instanceof Promise?s.push(x.then(y=>{y.issues.length&&n.issues.push(..._s(p,y.issues)),n.value[g]=y.value})):(x.issues.length&&n.issues.push(..._s(p,x.issues)),n.value[g]=x.value)}let f;for(const p in o)u.has(p)||(f=f??[],f.push(p));f&&f.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:f})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let f=t.keyType._zod.run({value:u,issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&uj.test(u)&&f.issues.length){const g=t.keyType._zod.run({value:Number(u),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>Li(g,r,Di())),input:u,path:[u],inst:e});continue}const m=t.valueType._zod.run({value:o[u],issues:[]},r);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&n.issues.push(..._s(u,g.issues)),n.value[f.value]=g.value})):(m.issues.length&&n.issues.push(..._s(u,m.issues)),n.value[f.value]=m.value)}}return s.length?Promise.all(s).then(()=>n):n}}),L3=fe("$ZodEnum",(e,t)=>{zt.init(e,t);const n=tj(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Zz.has(typeof o)).map(o=>typeof o=="string"?Ds(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const l=o.value;return r.has(l)||o.issues.push({code:"invalid_value",values:n,input:l,inst:e}),o}}),B3=fe("$ZodLiteral",(e,t)=>{if(zt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Ds(r):r?Ds(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),q3=fe("$ZodTransform",(e,t)=>{zt.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ej(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(l=>(n.value=l,n.fallback=!0,n));if(o instanceof Promise)throw new Ms;return n.value=o,n.fallback=!0,n}});function rS(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const bj=fe("$ZodOptional",(e,t)=>{zt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qv(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(l=>rS(l,o)):rS(s,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),$3=fe("$ZodExactOptional",(e,t)=>{bj.init(e,t),pt(e._zod,"values",()=>t.innerType._zod.values),pt(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),U3=fe("$ZodNullable",(e,t)=>{zt.init(e,t),pt(e._zod,"optin",()=>t.innerType._zod.optin),pt(e._zod,"optout",()=>t.innerType._zod.optout),pt(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Qv(n.source)}|null)$`):void 0}),pt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),H3=fe("$ZodDefault",(e,t)=>{zt.init(e,t),e._zod.optin="optional",pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>iS(s,t)):iS(o,t)}});function iS(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const F3=fe("$ZodPrefault",(e,t)=>{zt.init(e,t),e._zod.optin="optional",pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),V3=fe("$ZodNonOptional",(e,t)=>{zt.init(e,t),pt(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>oS(s,e)):oS(o,e)}});function oS(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Z3=fe("$ZodCatch",(e,t)=>{zt.init(e,t),e._zod.optin="optional",pt(e._zod,"optout",()=>t.innerType._zod.optout),pt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(l=>Li(l,r,Di()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Li(s,r,Di()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),K3=fe("$ZodPipe",(e,t)=>{zt.init(e,t),pt(e._zod,"values",()=>t.in._zod.values),pt(e._zod,"optin",()=>t.in._zod.optin),pt(e._zod,"optout",()=>t.out._zod.optout),pt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(l=>md(l,t.in,r)):md(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>md(s,t.out,r)):md(o,t.out,r)}});function md(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Q3=fe("$ZodReadonly",(e,t)=>{zt.init(e,t),pt(e._zod,"propValues",()=>t.innerType._zod.propValues),pt(e._zod,"values",()=>t.innerType._zod.values),pt(e._zod,"optin",()=>t.innerType?._zod?.optin),pt(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(aS):aS(o)}});function aS(e){return e.value=Object.freeze(e.value),e}const G3=fe("$ZodLazy",(e,t)=>{zt.init(e,t),pt(e._zod,"innerType",()=>{const n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),pt(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),pt(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),pt(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),pt(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Y3=fe("$ZodCustom",(e,t)=>{Wn.init(e,t),zt.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>sS(s,n,r,e));sS(o,n,r,e)}});function sS(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Cc(o))}}var lS;class W3{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function X3(){return new W3}(lS=globalThis).__zod_globalRegistry??(lS.__zod_globalRegistry=X3());const dc=globalThis.__zod_globalRegistry;function J3(e,t){return new e({type:"string",...De(t)})}function e4(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...De(t)})}function cS(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...De(t)})}function t4(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...De(t)})}function n4(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...De(t)})}function r4(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...De(t)})}function i4(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...De(t)})}function o4(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...De(t)})}function a4(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...De(t)})}function s4(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...De(t)})}function l4(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...De(t)})}function c4(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...De(t)})}function u4(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...De(t)})}function d4(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...De(t)})}function f4(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...De(t)})}function p4(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...De(t)})}function h4(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...De(t)})}function m4(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...De(t)})}function g4(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...De(t)})}function v4(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...De(t)})}function y4(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...De(t)})}function b4(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...De(t)})}function x4(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...De(t)})}function w4(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...De(t)})}function S4(e,t){return new e({type:"string",format:"date",check:"string_format",...De(t)})}function k4(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...De(t)})}function I4(e,t){return new e({type:"string",format:"duration",check:"string_format",...De(t)})}function T4(e,t){return new e({type:"number",checks:[],...De(t)})}function j4(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...De(t)})}function C4(e,t){return new e({type:"boolean",...De(t)})}function E4(e,t){return new e({type:"null",...De(t)})}function _4(e){return new e({type:"unknown"})}function A4(e,t){return new e({type:"never",...De(t)})}function uS(e,t){return new fj({check:"less_than",...De(t),value:e,inclusive:!1})}function wm(e,t){return new fj({check:"less_than",...De(t),value:e,inclusive:!0})}function dS(e,t){return new pj({check:"greater_than",...De(t),value:e,inclusive:!1})}function Sm(e,t){return new pj({check:"greater_than",...De(t),value:e,inclusive:!0})}function fS(e,t){return new UD({check:"multiple_of",...De(t),value:e})}function xj(e,t){return new FD({check:"max_length",...De(t),maximum:e})}function Jd(e,t){return new VD({check:"min_length",...De(t),minimum:e})}function wj(e,t){return new ZD({check:"length_equals",...De(t),length:e})}function M4(e,t){return new KD({check:"string_format",format:"regex",...De(t),pattern:e})}function N4(e){return new QD({check:"string_format",format:"lowercase",...De(e)})}function P4(e){return new GD({check:"string_format",format:"uppercase",...De(e)})}function R4(e,t){return new YD({check:"string_format",format:"includes",...De(t),includes:e})}function O4(e,t){return new WD({check:"string_format",format:"starts_with",...De(t),prefix:e})}function z4(e,t){return new XD({check:"string_format",format:"ends_with",...De(t),suffix:e})}function Xs(e){return new JD({check:"overwrite",tx:e})}function D4(e){return Xs(t=>t.normalize(e))}function L4(){return Xs(e=>e.trim())}function B4(){return Xs(e=>e.toLowerCase())}function q4(){return Xs(e=>e.toUpperCase())}function $4(){return Xs(e=>Fz(e))}function U4(e,t,n){return new e({type:"array",element:t,...De(n)})}function H4(e,t,n){return new e({type:"custom",check:"custom",fn:t,...De(n)})}function F4(e,t){const n=V4(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Cc(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Cc(s))}},e(r.value,r)),t);return n}function V4(e,t){const n=new Wn({check:"custom",...De(t)});return n._zod.check=e,n}function Sj(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??dc,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Wt(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const l={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,l);const u=e._zod.toJSONSchema?.();if(u)l.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,l.schema,m);else{const x=l.schema,y=t.processors[o.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);y(e,t,x,m)}const g=e._zod.parent;g&&(l.ref||(l.ref=g),Wt(g,t,m),t.seen.get(g).isParent=!0)}const f=t.metadataRegistry.get(e);return f&&Object.assign(l.schema,f),t.io==="input"&&Pn(e)&&(delete l.schema.examples,delete l.schema.default),t.io==="input"&&"_prefault"in l.schema&&((r=l.schema).default??(r.default=l.schema._prefault)),delete l.schema._prefault,t.seen.get(e).schema}function kj(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const l of e.seen.entries()){const u=e.metadataRegistry.get(l[0])?.id;if(u){const f=r.get(u);if(f&&f!==l[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(u,l[0])}}const o=l=>{const u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const g=e.external.registry.get(l[0])?.id,x=e.external.uri??(w=>w);if(g)return{ref:x(g)};const y=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=y,{defId:y,ref:`${x("__shared")}#/${u}/${y}`}}if(l[1]===n)return{ref:"#"};const p=`#/${u}/`,m=l[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:p+m}},s=l=>{if(l[1].schema.$ref)return;const u=l[1],{ref:f,defId:p}=o(l);u.def={...u.schema},p&&(u.defId=p);const m=u.schema;for(const g in m)delete m[g];m.$ref=f};if(e.cycles==="throw")for(const l of e.seen.entries()){const u=l[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
72
+
73
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const u=l[1];if(t===l[0]){s(l);continue}if(e.external){const p=e.external.registry.get(l[0])?.id;if(t!==l[0]&&p){s(l);continue}}if(e.metadataRegistry.get(l[0])?.id){s(l);continue}if(u.cycle){s(l);continue}if(u.count>1&&e.reused==="ref"){s(l);continue}}}function Ij(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=u=>{const f=e.seen.get(u);if(f.ref===null)return;const p=f.def??f.schema,m={...p},g=f.ref;if(f.ref=null,g){r(g);const y=e.seen.get(g),w=y.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(w)):Object.assign(p,w),Object.assign(p,m),u._zod.parent===g)for(const T in p)T==="$ref"||T==="allOf"||T in m||delete p[T];if(w.$ref&&y.def)for(const T in p)T==="$ref"||T==="allOf"||T in y.def&&JSON.stringify(p[T])===JSON.stringify(y.def[T])&&delete p[T]}const x=u._zod.parent;if(x&&x!==g){r(x);const y=e.seen.get(x);if(y?.schema.$ref&&(p.$ref=y.schema.$ref,y.def))for(const w in p)w==="$ref"||w==="allOf"||w in y.def&&JSON.stringify(p[w])===JSON.stringify(y.def[w])&&delete p[w]}e.override({zodSchema:u,jsonSchema:p,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())r(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const l=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,l[f.defId]=f.def)}e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?o.$defs=l:o.definitions=l);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:ef(t,"input",e.processors),output:ef(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function Pn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Pn(r.element,n);if(r.type==="set")return Pn(r.valueType,n);if(r.type==="lazy")return Pn(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Pn(r.innerType,n);if(r.type==="intersection")return Pn(r.left,n)||Pn(r.right,n);if(r.type==="record"||r.type==="map")return Pn(r.keyType,n)||Pn(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Pn(r.in,n)||Pn(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Pn(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Pn(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Pn(o,n))return!0;return!!(r.rest&&Pn(r.rest,n))}return!1}const Z4=(e,t={})=>n=>{const r=Sj({...n,processors:t});return Wt(e,r),kj(r,e),Ij(r,e)},ef=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},l=Sj({...o??{},target:s,io:t,processors:n});return Wt(e,l),kj(l,e),Ij(l,e)},K4={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Q4=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:l,format:u,patterns:f,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof l=="number"&&(o.maxLength=l),u&&(o.format=K4[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),p&&(o.contentEncoding=p),f&&f.size>0){const m=[...f];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},G4=(e,t,n,r)=>{const o=n,{minimum:s,maximum:l,format:u,multipleOf:f,exclusiveMaximum:p,exclusiveMinimum:m}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number";const g=typeof m=="number"&&m>=(s??Number.NEGATIVE_INFINITY),x=typeof p=="number"&&p<=(l??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";g?y?(o.minimum=m,o.exclusiveMinimum=!0):o.exclusiveMinimum=m:typeof s=="number"&&(o.minimum=s),x?y?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p:typeof l=="number"&&(o.maximum=l),typeof f=="number"&&(o.multipleOf=f)},Y4=(e,t,n,r)=>{n.type="boolean"},W4=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},X4=(e,t,n,r)=>{n.not={}},J4=(e,t,n,r)=>{},e5=(e,t,n,r)=>{const o=e._zod.def,s=tj(o.entries);s.every(l=>typeof l=="number")&&(n.type="number"),s.every(l=>typeof l=="string")&&(n.type="string"),n.enum=s},t5=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const l of o.values)if(l===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof l=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(l))}else s.push(l);if(s.length!==0)if(s.length===1){const l=s[0];n.type=l===null?"null":typeof l,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[l]:n.const=l}else s.every(l=>typeof l=="number")&&(n.type="number"),s.every(l=>typeof l=="string")&&(n.type="string"),s.every(l=>typeof l=="boolean")&&(n.type="boolean"),s.every(l=>l===null)&&(n.type="null"),n.enum=s},n5=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},r5=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},i5=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:l,maximum:u}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=Wt(s.element,t,{...r,path:[...r.path,"items"]})},o5=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const l=s.shape;for(const p in l)o.properties[p]=Wt(l[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(l)),f=new Set([...u].filter(p=>{const m=s.shape[p]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));f.size>0&&(o.required=Array.from(f)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Wt(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},a5=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,l=o.options.map((u,f)=>Wt(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",f]}));s?n.oneOf=l:n.anyOf=l},s5=(e,t,n,r)=>{const o=e._zod.def,s=Wt(o.left,t,{...r,path:[...r.path,"allOf",0]}),l=Wt(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,f=[...u(s)?s.allOf:[s],...u(l)?l.allOf:[l]];n.allOf=f},l5=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const l=s.keyType,f=l._zod.bag?.patterns;if(s.mode==="loose"&&f&&f.size>0){const m=Wt(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const g of f)o.patternProperties[g.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Wt(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Wt(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const p=l._zod.values;if(p){const m=[...p].filter(g=>typeof g=="string"||typeof g=="number");m.length>0&&(o.required=m)}},c5=(e,t,n,r)=>{const o=e._zod.def,s=Wt(o.innerType,t,r),l=t.seen.get(e);t.target==="openapi-3.0"?(l.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},u5=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},d5=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},f5=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},p5=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let l;try{l=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=l},h5=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),l=t.io==="input"?s?o.out:o.in:o.out;Wt(l,t,r);const u=t.seen.get(e);u.ref=l},m5=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Tj=(e,t,n,r)=>{const o=e._zod.def;Wt(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},g5=(e,t,n,r)=>{const o=e._zod.innerType;Wt(o,t,r);const s=t.seen.get(e);s.ref=o},v5=fe("ZodISODateTime",(e,t)=>{p3.init(e,t),Ht.init(e,t)});function y5(e){return w4(v5,e)}const b5=fe("ZodISODate",(e,t)=>{h3.init(e,t),Ht.init(e,t)});function x5(e){return S4(b5,e)}const w5=fe("ZodISOTime",(e,t)=>{m3.init(e,t),Ht.init(e,t)});function S5(e){return k4(w5,e)}const k5=fe("ZodISODuration",(e,t)=>{g3.init(e,t),Ht.init(e,t)});function I5(e){return I4(k5,e)}const T5=(e,t)=>{oj.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>iD(e,n)},flatten:{value:n=>rD(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bg,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bg,2)}},isEmpty:{get(){return e.issues.length===0}}})},Cr=fe("ZodError",T5,{Parent:Error}),j5=Yv(Cr),C5=Wv(Cr),E5=Ef(Cr),_5=_f(Cr),A5=sD(Cr),M5=lD(Cr),N5=cD(Cr),P5=uD(Cr),R5=dD(Cr),O5=fD(Cr),z5=pD(Cr),D5=hD(Cr),pS=new WeakMap;function Hc(e,t,n){const r=Object.getPrototypeOf(e);let o=pS.get(r);if(o||(o=new Set,pS.set(r,o)),!o.has(t)){o.add(t);for(const s in n){const l=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const u=l.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}}const Dt=fe("ZodType",(e,t)=>(zt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ef(e,"input"),output:ef(e,"output")}}),e.toJSONSchema=Z4(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>j5(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>E5(e,n,r),e.parseAsync=async(n,r)=>C5(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>_5(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>A5(e,n,r),e.decode=(n,r)=>M5(e,n,r),e.encodeAsync=async(n,r)=>N5(e,n,r),e.decodeAsync=async(n,r)=>P5(e,n,r),e.safeEncode=(n,r)=>R5(e,n,r),e.safeDecode=(n,r)=>O5(e,n,r),e.safeEncodeAsync=async(n,r)=>z5(e,n,r),e.safeDecodeAsync=async(n,r)=>D5(e,n,r),Hc(e,"ZodType",{check(...n){const r=this.def;return this.clone(No(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Po(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(PL(n,r))},superRefine(n,r){return this.check(RL(n,r))},overwrite(n){return this.check(Xs(n))},optional(){return yS(this)},exactOptional(){return yL(this)},nullable(){return bS(this)},nullish(){return yS(bS(this))},nonoptional(n){return IL(this,n)},array(){return et(this)},or(n){return Hi([this,n])},and(n){return pL(this,n)},transform(n){return xS(this,gL(n))},default(n){return wL(this,n)},prefault(n){return kL(this,n)},catch(n){return jL(this,n)},pipe(n){return xS(this,n)},readonly(){return _L(this)},describe(n){const r=this.clone();return dc.add(r,{description:n}),r},meta(...n){if(n.length===0)return dc.get(this);const r=this.clone();return dc.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return dc.get(e)?.description},configurable:!0}),e)),jj=fe("_ZodString",(e,t)=>{Xv.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Q4(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Hc(e,"_ZodString",{regex(...r){return this.check(M4(...r))},includes(...r){return this.check(R4(...r))},startsWith(...r){return this.check(O4(...r))},endsWith(...r){return this.check(z4(...r))},min(...r){return this.check(Jd(...r))},max(...r){return this.check(xj(...r))},length(...r){return this.check(wj(...r))},nonempty(...r){return this.check(Jd(1,...r))},lowercase(r){return this.check(N4(r))},uppercase(r){return this.check(P4(r))},trim(){return this.check(L4())},normalize(...r){return this.check(D4(...r))},toLowerCase(){return this.check(B4())},toUpperCase(){return this.check(q4())},slugify(){return this.check($4())}})}),L5=fe("ZodString",(e,t)=>{Xv.init(e,t),jj.init(e,t),e.email=n=>e.check(e4(B5,n)),e.url=n=>e.check(o4(q5,n)),e.jwt=n=>e.check(x4(tL,n)),e.emoji=n=>e.check(a4($5,n)),e.guid=n=>e.check(cS(hS,n)),e.uuid=n=>e.check(t4(gd,n)),e.uuidv4=n=>e.check(n4(gd,n)),e.uuidv6=n=>e.check(r4(gd,n)),e.uuidv7=n=>e.check(i4(gd,n)),e.nanoid=n=>e.check(s4(U5,n)),e.guid=n=>e.check(cS(hS,n)),e.cuid=n=>e.check(l4(H5,n)),e.cuid2=n=>e.check(c4(F5,n)),e.ulid=n=>e.check(u4(V5,n)),e.base64=n=>e.check(v4(X5,n)),e.base64url=n=>e.check(y4(J5,n)),e.xid=n=>e.check(d4(Z5,n)),e.ksuid=n=>e.check(f4(K5,n)),e.ipv4=n=>e.check(p4(Q5,n)),e.ipv6=n=>e.check(h4(G5,n)),e.cidrv4=n=>e.check(m4(Y5,n)),e.cidrv6=n=>e.check(g4(W5,n)),e.e164=n=>e.check(b4(eL,n)),e.datetime=n=>e.check(y5(n)),e.date=n=>e.check(x5(n)),e.time=n=>e.check(S5(n)),e.duration=n=>e.check(I5(n))});function Te(e){return J3(L5,e)}const Ht=fe("ZodStringFormat",(e,t)=>{qt.init(e,t),jj.init(e,t)}),B5=fe("ZodEmail",(e,t)=>{i3.init(e,t),Ht.init(e,t)}),hS=fe("ZodGUID",(e,t)=>{n3.init(e,t),Ht.init(e,t)}),gd=fe("ZodUUID",(e,t)=>{r3.init(e,t),Ht.init(e,t)}),q5=fe("ZodURL",(e,t)=>{o3.init(e,t),Ht.init(e,t)}),$5=fe("ZodEmoji",(e,t)=>{a3.init(e,t),Ht.init(e,t)}),U5=fe("ZodNanoID",(e,t)=>{s3.init(e,t),Ht.init(e,t)}),H5=fe("ZodCUID",(e,t)=>{l3.init(e,t),Ht.init(e,t)}),F5=fe("ZodCUID2",(e,t)=>{c3.init(e,t),Ht.init(e,t)}),V5=fe("ZodULID",(e,t)=>{u3.init(e,t),Ht.init(e,t)}),Z5=fe("ZodXID",(e,t)=>{d3.init(e,t),Ht.init(e,t)}),K5=fe("ZodKSUID",(e,t)=>{f3.init(e,t),Ht.init(e,t)}),Q5=fe("ZodIPv4",(e,t)=>{v3.init(e,t),Ht.init(e,t)}),G5=fe("ZodIPv6",(e,t)=>{y3.init(e,t),Ht.init(e,t)}),Y5=fe("ZodCIDRv4",(e,t)=>{b3.init(e,t),Ht.init(e,t)}),W5=fe("ZodCIDRv6",(e,t)=>{x3.init(e,t),Ht.init(e,t)}),X5=fe("ZodBase64",(e,t)=>{w3.init(e,t),Ht.init(e,t)}),J5=fe("ZodBase64URL",(e,t)=>{k3.init(e,t),Ht.init(e,t)}),eL=fe("ZodE164",(e,t)=>{I3.init(e,t),Ht.init(e,t)}),tL=fe("ZodJWT",(e,t)=>{j3.init(e,t),Ht.init(e,t)}),Cj=fe("ZodNumber",(e,t)=>{mj.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>G4(e,r,o),Hc(e,"ZodNumber",{gt(r,o){return this.check(dS(r,o))},gte(r,o){return this.check(Sm(r,o))},min(r,o){return this.check(Sm(r,o))},lt(r,o){return this.check(uS(r,o))},lte(r,o){return this.check(wm(r,o))},max(r,o){return this.check(wm(r,o))},int(r){return this.check(mS(r))},safe(r){return this.check(mS(r))},positive(r){return this.check(dS(0,r))},nonnegative(r){return this.check(Sm(0,r))},negative(r){return this.check(uS(0,r))},nonpositive(r){return this.check(wm(0,r))},multipleOf(r,o){return this.check(fS(r,o))},step(r,o){return this.check(fS(r,o))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function le(e){return T4(Cj,e)}const nL=fe("ZodNumberFormat",(e,t)=>{C3.init(e,t),Cj.init(e,t)});function mS(e){return j4(nL,e)}const rL=fe("ZodBoolean",(e,t)=>{E3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Y4(e,n,r)});function Ee(e){return C4(rL,e)}const iL=fe("ZodNull",(e,t)=>{_3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>W4(e,n,r)});function oL(e){return E4(iL,e)}const aL=fe("ZodUnknown",(e,t)=>{A3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>J4()});function gS(){return _4(aL)}const sL=fe("ZodNever",(e,t)=>{M3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>X4(e,n,r)});function lL(e){return A4(sL,e)}const cL=fe("ZodArray",(e,t)=>{N3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>i5(e,n,r,o),e.element=t.element,Hc(e,"ZodArray",{min(n,r){return this.check(Jd(n,r))},nonempty(n){return this.check(Jd(1,n))},max(n,r){return this.check(xj(n,r))},length(n,r){return this.check(wj(n,r))},unwrap(){return this.element}})});function et(e,t){return U4(cL,e,t)}const uL=fe("ZodObject",(e,t)=>{R3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>o5(e,n,r,o),pt(e,"shape",()=>t.shape),Hc(e,"ZodObject",{keyof(){return $e(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:gS()})},loose(){return this.clone({...this._zod.def,catchall:gS()})},strict(){return this.clone({...this._zod.def,catchall:lL()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Wz(this,n)},safeExtend(n){return Xz(this,n)},merge(n){return Jz(this,n)},pick(n){return Gz(this,n)},omit(n){return Yz(this,n)},partial(...n){return eD(_j,this,n[0])},required(...n){return tD(Aj,this,n[0])}})});function G(e,t){const n={type:"object",shape:e??{},...De(t)};return new uL(n)}const Ej=fe("ZodUnion",(e,t)=>{yj.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>a5(e,n,r,o),e.options=t.options});function Hi(e,t){return new Ej({type:"union",options:e,...De(t)})}const dL=fe("ZodDiscriminatedUnion",(e,t)=>{Ej.init(e,t),O3.init(e,t)});function Jv(e,t,n){return new dL({type:"union",options:t,discriminator:e,...De(n)})}const fL=fe("ZodIntersection",(e,t)=>{z3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>s5(e,n,r,o)});function pL(e,t){return new fL({type:"intersection",left:e,right:t})}const vS=fe("ZodRecord",(e,t)=>{D3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>l5(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Mf(e,t,n){return!t||!t._zod?new vS({type:"record",keyType:Te(),valueType:e,...De(t)}):new vS({type:"record",keyType:e,valueType:t,...De(n)})}const wg=fe("ZodEnum",(e,t)=>{L3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>e5(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const l of r)if(n.has(l))s[l]=t.entries[l];else throw new Error(`Key ${l} not found in enum`);return new wg({...t,checks:[],...De(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const l of r)if(n.has(l))delete s[l];else throw new Error(`Key ${l} not found in enum`);return new wg({...t,checks:[],...De(o),entries:s})}});function $e(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new wg({type:"enum",entries:n,...De(t)})}const hL=fe("ZodLiteral",(e,t)=>{B3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>t5(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Re(e,t){return new hL({type:"literal",values:Array.isArray(e)?e:[e],...De(t)})}const mL=fe("ZodTransform",(e,t)=>{q3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>r5(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ej(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Cc(s,n.value,t));else{const l=s;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),l.input??(l.input=n.value),l.inst??(l.inst=e),n.issues.push(Cc(l))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function gL(e){return new mL({type:"transform",transform:e})}const _j=fe("ZodOptional",(e,t)=>{bj.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tj(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yS(e){return new _j({type:"optional",innerType:e})}const vL=fe("ZodExactOptional",(e,t)=>{$3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tj(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yL(e){return new vL({type:"optional",innerType:e})}const bL=fe("ZodNullable",(e,t)=>{U3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>c5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bS(e){return new bL({type:"nullable",innerType:e})}const xL=fe("ZodDefault",(e,t)=>{H3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>d5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function wL(e,t){return new xL({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():rj(t)}})}const SL=fe("ZodPrefault",(e,t)=>{F3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>f5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function kL(e,t){return new SL({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():rj(t)}})}const Aj=fe("ZodNonOptional",(e,t)=>{V3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>u5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function IL(e,t){return new Aj({type:"nonoptional",innerType:e,...De(t)})}const TL=fe("ZodCatch",(e,t)=>{Z3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>p5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jL(e,t){return new TL({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const CL=fe("ZodPipe",(e,t)=>{K3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>h5(e,n,r,o),e.in=t.in,e.out=t.out});function xS(e,t){return new CL({type:"pipe",in:e,out:t})}const EL=fe("ZodReadonly",(e,t)=>{Q3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>m5(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _L(e){return new EL({type:"readonly",innerType:e})}const AL=fe("ZodLazy",(e,t)=>{G3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>g5(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function ML(e){return new AL({type:"lazy",getter:e})}const NL=fe("ZodCustom",(e,t)=>{Y3.init(e,t),Dt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>n5(e,n)});function PL(e,t={}){return H4(NL,e,t)}function RL(e,t){return F4(e,t)}const OL="0.1",Mj=1,Ze=Te().trim().min(1),bt=Te().trim().min(1).max(160).regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/),ce=Te().uuid(),tt=Te().datetime({offset:!0}),Ln=Te().max(32768).refine(e=>!/^(?:[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\[?.]\\)/.test(e),{message:"Expected a project-relative path"}),Bi=Te().trim().min(1).max(32768),Fi=Te().regex(/^[a-f0-9]{64}$/i),zL=Hi([Te(),le().finite(),Ee(),oL()]),ya=ML(()=>Hi([zL,et(ya),Mf(Te(),ya)])),Ea=Mf(Te(),ya),Nj=G({}).strict(),DL=$e(["auto","document"]),ey=[{id:"structure",title:"功能结构",fileName:"功能结构.md",sections:["范围","业务能力","菜单树","业务文件树","角色与内置能力边界"]},{id:"pages",title:"页面设计",fileName:"页面设计.md",sections:["页面索引","页面设计"]},{id:"apis",title:"接口设计",fileName:"接口设计.md",sections:["接口索引","接口设计"]},{id:"database",title:"数据库设计",fileName:"数据库设计.md",sections:["实体关系","数据表设计"]},{id:"flows",title:"业务流程设计",fileName:"业务流程设计.md",sections:["流程索引","业务流程设计"]}];function Fc(e){return e.length<=120&&e===e.trim()&&/^[^<>:"/\\|?*\u0000-\u001f]+\.md$/iu.test(e)&&!e.startsWith(".")&&!/[ .]\.md$/iu.test(e)&&!/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/iu.test(e)&&!/^(?:readme|agents|claude|gemini|skill)\.md$/iu.test(e)}const LL=G({id:Te().regex(/^[a-z][a-z0-9-]{0,63}$/u),title:Te().trim().min(1).max(80),fileName:Te().refine(Fc,"只能使用安全的根目录 Markdown 文件名,不能覆盖 README 或指令文件"),enabled:Ee(),guidance:Te().max(1e3).default("")}).strict(),ty=G({referenceCode:Ee().default(!1),documents:et(LL).min(5).max(20)}).strict().superRefine((e,t)=>{const n=new Set,r=new Set;e.documents.forEach((o,s)=>{const l=o.fileName.toLocaleLowerCase("en-US");(n.has(o.id)||r.has(l))&&t.addIssue({code:"custom",message:"文档标识和文件名不能重复",path:["documents",s]}),n.add(o.id),r.add(l)});for(const o of ey){const s=e.documents.find(l=>l.id===o.id);(!s||s.fileName!==o.fileName||s.title!==o.title)&&t.addIssue({code:"custom",message:`内置文档 ${o.title} 只能启用或停用,不能改名或移除`})}});function BL(){return{referenceCode:!1,documents:ey.map(({id:e,title:t,fileName:n})=>({id:e,title:t,fileName:n,enabled:!0,guidance:""}))}}const Nf=G({conversationMode:DL,documentModeConfig:ty,revision:le().int().nonnegative()}).strict();G({version:Re(2),initial:Ee()}).strict();function fc(e){const t=Nf.safeParse(e);if(t.success)return t.data;const n=BL();return e!=null?{conversationMode:"document",documentModeConfig:{...n,documents:n.documents.map(r=>({...r,enabled:!1}))},revision:0}:{conversationMode:"auto",documentModeConfig:n,revision:0}}function qL(e){return e.replace(/[`*_~]/gu,"").trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,"").replace(/\s/gu,"-")}const Pj=8,$L=G({path:Ln.refine(Fc,"只能批注合法的根目录设计 Markdown"),hash:Fi,startLine:le().int().positive(),endLine:le().int().positive()}).strict().refine(e=>e.endLine>=e.startLine,"批注行范围无效"),Vc=et($L).min(1).max(Pj),UL=G({id:ce,projectId:ce,rootPath:Bi,canonicalRootPath:Bi,access:$e(["read","read-write"]),createdAt:tt}).strict(),Js=G({id:ce,name:Ze.max(240),kind:$e(["managed","external"]).default("external"),managedState:$e(["ready","missing","invalid"]).optional(),rootPath:Bi,canonicalRootPath:Bi,grant:UL,createdAt:tt,updatedAt:tt,lastOpenedAt:tt,removedAt:tt.optional()}).strict(),HL=$e(["file","directory","symlink"]),FL=G({path:Ln,name:Ze,kind:HL,size:le().int().nonnegative().optional(),modifiedAt:tt.optional(),hasChildren:Ee().optional(),language:Te().min(1).optional(),binary:Ee().optional(),ignored:Ee().optional()}).strict(),VL=G({projectId:ce,path:Ln,hash:Fi,size:le().int().nonnegative(),modifiedAt:tt.optional(),binary:Ee(),truncated:Ee(),content:Te().optional(),language:Te().min(1).optional()}).strict(),ny=G({projectId:ce,path:Ln,hash:Fi,startLine:le().int().positive().optional(),endLine:le().int().positive().optional(),snapshot:Te().optional(),truncated:Ee().default(!1)}).strict().superRefine((e,t)=>{e.startLine!==void 0&&e.endLine!==void 0&&e.endLine<e.startLine&&t.addIssue({code:"custom",message:"endLine must be greater than or equal to startLine",path:["endLine"]})}),ZL=G({kind:Re("workspace-file"),projectId:ce,path:Ln,hash:Fi,startLine:le().int().positive().optional(),endLine:le().int().positive().optional(),snapshot:Te().optional(),truncated:Ee().default(!1)}).strict().superRefine((e,t)=>{e.startLine!==void 0&&e.endLine!==void 0&&e.endLine<e.startLine&&t.addIssue({code:"custom",message:"endLine must be greater than or equal to startLine",path:["endLine"]})}),KL=$e(["image/png","image/jpeg","image/webp"]),QL=G({kind:Re("image"),artifactId:ce,name:Ze.max(240),mediaType:KL,size:le().int().nonnegative().max(8*1024*1024),hash:Fi,width:le().int().positive(),height:le().int().positive()}).strict().refine(e=>e.width*e.height<=4e7,{message:"Image attachments may contain at most 40 megapixels",path:["width"]}),GL=G({kind:Re("text-file"),artifactId:ce,name:Ze.max(240),mediaType:Ze.max(255),size:le().int().nonnegative().max(5*1024*1024),hash:Fi,encoding:Re("utf-8")}).strict(),YL=$e(["docx","xlsx","pdf"]),WL=G({kind:Re("document"),artifactId:ce,extractedTextArtifactId:ce,name:Ze.max(240),mediaType:$e(["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf"]),size:le().int().nonnegative().max(10*1024*1024),hash:Fi,format:YL,textLength:le().int().nonnegative().max(5*1024*1024),pageCount:le().int().nonnegative().max(1e5).optional(),sheetCount:le().int().nonnegative().max(1e4).optional(),visualCount:le().int().nonnegative().max(4),textTruncated:Ee().default(!1),visualsTruncated:Ee().default(!1)}).strict(),XL=Hi([ZL,QL,GL,WL,ny.transform(e=>({kind:"workspace-file",...e}))]),Rj=et(XL).max(8).superRefine((e,t)=>{e.filter(r=>r.kind==="image").length>4&&t.addIssue({code:"custom",message:"A message may contain at most 4 images"}),e.reduce((r,o)=>o.kind==="workspace-file"?r:r+o.size,0)>20*1024*1024&&t.addIssue({code:"custom",message:"Message attachments may total at most 20 MiB"})}),JL=G({path:Ln,line:le().int().positive(),column:le().int().positive().optional(),preview:Te(),match:Te().optional()}).strict(),_a=$e(["off","minimal","low","medium","high","xhigh","max"]),el=$e(["openai","anthropic","gemini","openai-compatible"]),e6=$e(["credential-manager","environment","none"]),Pf=$e(["required","optional","none"]),t6=$e(["text","image"]),Zc=$e(["auto","enabled","disabled"]),ry=$e(["auto","enabled","disabled"]),n6=$e(["available","stale","manual"]),wS=$e(["manual","endpoint","builtin","legacy","unknown"]),Rf=G({streaming:Ee(),tools:Ee(),parallelToolCalls:Ee(),reasoningEfforts:et(_a),nativeCompaction:Ee(),promptCaching:Ee(),tokenCounting:Ee(),inputModalities:et(t6).min(1).default(["text"]),contextWindow:le().int().positive().optional(),maxOutputTokens:le().int().positive().optional()}).strict(),iy=G({id:ce,name:Ze.max(160),kind:el,preset:$e(["openai","anthropic","gemini","deepseek","groq","cerebras","ollama","vllm","custom"]),baseUrl:Te().url().optional(),model:Ze.max(240),reasoningEffort:_a,maxOutputTokens:le().int().positive(),contextWindow:le().int().positive().optional(),imageInputMode:Zc.default("auto"),reasoningContinuationMode:ry.default("auto"),capabilities:Rf,authMode:Pf,secretSource:e6,secretHint:Te().max(64).optional(),environmentVariable:bt.optional(),enabled:Ee(),defaultModelId:Ze.max(240).optional(),modelCount:le().int().nonnegative().optional(),enabledModelCount:le().int().nonnegative().optional(),modelsLastRefreshedAt:tt.optional(),createdAt:tt,updatedAt:tt}).strict(),tl=G({id:Ze.max(240),name:Ze.max(240),providerKind:el,capabilities:Rf,imageInputMode:Zc.optional(),providerProfileId:ce.optional(),enabled:Ee().optional(),availability:n6.optional(),contextWindow:le().int().positive().max(1e7).optional(),maxOutputTokens:le().int().positive().max(1e6).optional(),contextSource:wS.optional(),outputSource:wS.optional(),contextOverride:le().int().positive().max(1e7).optional(),maxOutputOverride:le().int().positive().max(1e6).optional(),lastSeenAt:tt.optional(),updatedAt:tt.optional()}).strict().superRefine((e,t)=>{const n=e.contextOverride??e.contextWindow,r=e.maxOutputOverride??e.maxOutputTokens;n!==void 0&&r!==void 0&&r>n&&t.addIssue({code:"custom",message:"maxOutputTokens must not exceed contextWindow",path:[e.maxOutputOverride!==void 0?"maxOutputOverride":"maxOutputTokens"]})}),Of=G({inputTokens:le().int().nonnegative(),cachedInputTokens:le().int().nonnegative().optional(),cacheWriteTokens:le().int().nonnegative().optional(),outputTokens:le().int().nonnegative(),reasoningTokens:le().int().nonnegative().optional(),totalTokens:le().int().nonnegative(),estimated:Ee().default(!1),availability:G({inputTokens:Ee(),outputTokens:Ee(),cachedInputTokens:Ee(),cacheWriteTokens:Ee(),reasoningTokens:Ee(),totalTokens:Ee()}).strict().optional()}).strict(),Sg=G({requestId:ce,requestIndex:le().int().positive(),round:le().int().nonnegative(),providerProfileId:ce,model:Ze.max(240),contextWindow:le().int().positive().optional(),status:$e(["completed","failed","cancelled","incomplete"]),elapsedMs:le().nonnegative(),ttftMs:le().nonnegative().optional(),firstVisibleOutputMs:le().nonnegative().optional(),generationMs:le().nonnegative().optional(),reasoningDurationMs:le().nonnegative().optional(),reasoningObserved:Ee().optional(),summaryAvailable:Ee().optional(),retryCount:le().int().nonnegative(),usage:Of.optional(),outputTokensPerSecond:le().nonnegative().optional(),incomplete:Ee(),startedAt:tt.optional(),completedAt:tt.optional()}).strict(),kg=G({requestCount:le().int().nonnegative(),completedRequestCount:le().int().nonnegative(),failedRequestCount:le().int().nonnegative(),llmDurationMs:le().nonnegative(),toolDurationMs:le().nonnegative().default(0),averageTtftMs:le().nonnegative().optional(),outputTokensPerSecond:le().nonnegative().optional(),promptTokens:le().int().nonnegative(),cacheHitRate:le().min(0).max(1).optional(),cacheHitRateKind:$e(["exact","lower-bound"]).optional(),cacheMetricCoverage:le().min(0).max(1).optional(),usage:Of,usageAvailable:Ee(),incomplete:Ee()}).strict(),tf=$e(["prompt","full-access"]),r6=$e(["queued","running","waiting-approval"]),Oj=G({position:le().int().positive(),reason:$e(["workspace-busy","concurrency-limit"])}).strict(),zj=G({providerProfileId:ce,model:Ze.max(240),reasoningEffort:_a,updatedAt:tt}).strict(),ni=G({queue:Oj.optional(),id:ce,projectId:ce,title:Ze.max(240),status:$e(["active","archived"]),parentThreadId:ce.optional(),spawnedByItemId:ce.optional(),agentRole:Te().trim().min(1).max(120).optional(),depth:le().int().nonnegative().default(0),sessionRootId:ce,approvalMode:tf.optional(),approvalModeChangedAt:tt.optional(),preferences:zj.optional(),mode:Nf.optional(),activeTurnStatus:r6.optional(),activeTurnId:ce.optional(),lastSeq:le().int().nonnegative().default(0),createdAt:tt,updatedAt:tt}).strict(),i6=$e(["queued","running","waiting-approval","completed","interrupted","failed","cancelled"]),nl=G({queue:Oj.optional(),id:ce,threadId:ce,status:i6,providerProfileId:ce,providerKind:el,model:Ze.max(240),reasoningEffort:_a,contextWindow:le().int().positive().max(1e7).optional(),maxOutputTokens:le().int().positive(),toolNames:et(bt),attempt:le().int().positive().default(1),providerRetryCount:le().int().nonnegative().optional(),createdAt:tt,startedAt:tt.optional(),completedAt:tt.optional(),error:G({code:bt,message:Ze,retryable:Ee()}).strict().optional(),usage:Of.optional()}).strict(),o6=$e(["queued","running","waiting-approval","completed","failed","cancelled","interrupted"]),Ro={id:ce,threadId:ce,turnId:ce.optional(),status:o6,createdAt:tt,completedAt:tt.optional()},a6=G({...Ro,kind:Re("userMessage"),content:Te(),attachments:Rj.default([]),documentAnnotationReferences:Vc.optional(),documentAnnotationReferencesInvalid:Ee().optional(),supersedesItemId:ce.optional()}).strict(),s6=G({...Ro,kind:Re("assistantMessage"),content:Te(),finishReason:$e(["stop","tool","length","cancelled","error"]).optional()}).strict(),l6=G({...Ro,turnId:ce,kind:Re("reasoningSummary"),content:Te(),assistantItemId:ce.optional(),source:Re("provider"),encryptedContent:Te().optional()}).strict(),Dj=$e(["read","write","delete","process","network"]),c6=G({...Ro,kind:Re("toolCall"),toolCallId:Ze.max(512),toolName:bt,pluginId:bt.optional(),arguments:Ea,sideEffect:Dj}).strict(),u6=G({...Ro,kind:Re("toolResult"),toolCallId:Ze.max(512),callItemId:ce.optional(),toolName:bt,success:Ee().optional(),summary:Te(),output:Te().optional(),artifactId:ce.optional(),artifactIds:et(ce).optional(),metadata:Ea.optional(),truncated:Ee().default(!1)}).strict(),d6=G({...Ro,kind:Re("approval"),approvalId:ce,toolCallId:Ze.max(512),decision:$e(["allow-once","allow-turn","deny"]).optional(),resolutionSource:$e(["user","full-access"]).optional(),decidedAt:tt.optional()}).strict(),f6=G({...Ro,kind:Re("compaction"),strategy:$e(["provider","local"]),summary:Te(),sourceItemIds:et(ce),inputTokensBefore:le().int().nonnegative(),inputTokensAfter:le().int().nonnegative()}).strict(),p6=G({...Ro,kind:Re("error"),code:bt,message:Ze,retryable:Ee(),details:Ea.optional()}).strict(),oy=Jv("kind",[a6,s6,l6,c6,u6,d6,f6,p6]),h6=G({id:ce,threadId:ce.optional(),turnId:ce.optional(),itemId:ce.optional(),mediaType:Ze.max(255),size:le().int().nonnegative(),hash:Fi,truncated:Ee(),createdAt:tt,metadata:Ea.optional()}).strict(),Lj=$e(["allow-once","allow-turn","deny"]),m6=$e(["pending","approved","rejected","expired","cancelled"]),zf=G({id:ce,threadId:ce,turnId:ce,itemId:ce,toolCallId:Ze.max(512),toolName:bt,pluginId:bt.optional(),sideEffect:Dj,risk:$e(["low","medium","high"]),title:Ze.max(240),summary:Ze,details:Ea.optional(),proposedDiff:Te().optional(),command:Te().optional(),cwd:Te().optional(),allowedDecisions:et(Lj).min(1),status:m6,resolutionSource:$e(["user","full-access"]).optional(),createdAt:tt,expiresAt:tt.optional()}).strict().superRefine((e,t)=>{(e.sideEffect==="delete"||e.risk==="high")&&e.allowedDecisions.includes("allow-turn")&&t.addIssue({code:"custom",message:"Delete and high-risk approvals cannot be granted for an entire turn",path:["allowedDecisions"]})}),Bj=G({requestId:ce,decision:Lj,reason:Te().max(2e3).optional(),decidedAt:tt}).strict(),ay=G({pluginId:bt,runtimeId:bt,version:Ze.max(64),abiVersion:Ze.max(64),contentHash:Fi}).strict(),g6=G({workspaceId:ce,displayName:Ze.max(240),directoryName:Ze.max(255).refine(e=>e!=="."&&e!==".."&&!/[<>:"/\\|?*\u0000-\u001F]/u.test(e)&&!/[ .]$/u.test(e)&&!/^(?:con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/iu.test(e),"Expected a portable managed application directory name")}).strict();G({schemaVersion:Re(Mj),appId:ce,runtime:ay,managed:g6.optional(),createdAt:tt,updatedAt:tt}).strict();const v6=$e(["error","warning","info"]),y6=$e(["typescript","route","runtime"]),qj=G({severity:v6,source:y6,code:Hi([Te().trim().min(1).max(160),le().int()]).optional(),message:Ze.max(8e3),path:Ln.optional(),line:le().int().positive().optional(),column:le().int().positive().optional(),endLine:le().int().positive().optional(),endColumn:le().int().positive().optional()}).strict().superRefine((e,t)=>{e.column!==void 0&&e.line===void 0&&t.addIssue({code:"custom",message:"column requires line",path:["column"]}),e.endLine!==void 0&&e.line===void 0&&t.addIssue({code:"custom",message:"endLine requires line",path:["endLine"]}),e.endColumn!==void 0&&e.endLine===void 0&&t.addIssue({code:"custom",message:"endColumn requires endLine",path:["endColumn"]})}),b6=$e(["idle","compiling","success","failed"]),$j=G({status:b6,sourceRevision:le().int().nonnegative(),successfulSourceRevision:le().int().nonnegative().optional(),diagnosticsRevision:le().int().nonnegative(),diagnostics:et(qj).max(1e3),updatedAt:tt}).strict().superRefine((e,t)=>{e.successfulSourceRevision!==void 0&&e.successfulSourceRevision>e.sourceRevision&&t.addIssue({code:"custom",message:"successfulSourceRevision cannot exceed sourceRevision",path:["successfulSourceRevision"]})}),x6=$e(["succeeded","failed"]),w6=G({projectId:ce,status:x6,sourceRevision:le().int().nonnegative(),outputPath:Ln.optional(),diagnostics:et(qj).max(1e3).default([]),error:Te().trim().min(1).max(8e3).optional(),exportedAt:tt.optional()}).strict().superRefine((e,t)=>{e.status==="succeeded"?(e.outputPath===void 0&&t.addIssue({code:"custom",message:"A successful export requires outputPath",path:["outputPath"]}),e.exportedAt===void 0&&t.addIssue({code:"custom",message:"A successful export requires exportedAt",path:["exportedAt"]}),e.error!==void 0&&t.addIssue({code:"custom",message:"A successful export cannot include error",path:["error"]})):e.error===void 0&&t.addIssue({code:"custom",message:"A failed export requires error",path:["error"]})}),Df=G({pluginId:bt,modeId:bt}).strict(),S6=G({binding:Df,settingsRevision:le().int().nonnegative()}).strict(),sy=G({assistantMode:Df.nullable(),revision:le().int().nonnegative(),updatedAt:tt}).strict(),k6={assistantMode:null,revision:0,updatedAt:"1970-01-01T00:00:00.000Z"},I6=G({pluginId:bt,templateId:bt,version:Ze.max(64)}).strict(),T6=$e(["disabled","ready","requires_preparation","blocked"]),j6=$e(["stopped","starting","running","restarting","failed"]),qi=le().int().nonnegative(),ba=G({projectId:ce,targetPath:Ln,status:j6,revision:qi.default(0),url:Te().url().optional(),error:Te().max(4e3).optional(),runtime:ay.optional(),compileState:$j.optional(),updatedAt:tt}).strict(),C6=G({projectId:ce,mode:Df.nullable(),settingsRevision:le().int().nonnegative(),state:T6,targetPath:Ln,template:I6.optional(),runtime:ay.optional(),planId:Ze.max(512).optional(),createsTemplate:Ee(),installRequired:Ee(),reason:Te().max(4e3).optional()}).strict(),E6=G({projectId:ce,targetPath:Ln,prepared:Ee(),installed:Ee(),previewSession:ba.optional()}).strict(),_6=$e(["discovered","disabled","starting","active","failed","stopping"]),A6=G({permission:Ze.max(240),resource:Te().max(2048).optional(),grantedAt:tt}).strict(),Lf=G({id:bt,name:Ze.max(160),version:Ze.max(64),description:Te().max(2e3).optional(),directoryPath:Te().min(1),hash:Te().regex(/^[a-f0-9]{64}$/i),state:_6,enabled:Ee(),hasHostEntry:Ee(),hasUiEntry:Ee(),uiTrusted:Ee(),uiEntryUrl:Te().min(1).optional(),contributions:Ea.optional(),permissions:et(A6),error:Te().optional(),installedAt:tt,updatedAt:tt}).strict(),Uj=$e(["trace","debug","info","warn","error","fatal"]),Hj=G({id:ce,seq:le().int().nonnegative(),timestamp:tt,level:Uj,message:Ze,threadId:ce.optional(),turnId:ce.optional(),itemId:ce.optional(),pluginId:bt.optional(),toolName:bt.optional(),providerProfileId:ce.optional(),durationMs:le().nonnegative().optional(),data:Ea.optional()}).strict(),Nt={schemaVersion:Re(Mj),eventId:ce,seq:le().int().nonnegative(),timestamp:tt,sessionId:ce},_n={threadId:ce,turnId:ce},M6=G({...Nt,..._n,type:Re("turn.started"),turn:nl}).strict(),N6=G({...Nt,..._n,type:Re("item.started"),itemId:ce,toolCallId:Te().min(1).optional(),pluginId:bt.optional(),item:oy}).strict(),P6=G({...Nt,..._n,type:Re("item.delta"),itemId:ce,toolCallId:Te().min(1).optional(),pluginId:bt.optional(),channel:$e(["assistant","reasoning","tool.stdout","tool.stderr"]),delta:Te(),index:le().int().nonnegative().optional()}).strict(),R6=G({...Nt,..._n,type:Re("reasoning.summary.delta"),itemId:ce,assistantItemId:ce.optional(),source:Re("provider"),delta:Te(),index:le().int().nonnegative().optional()}).strict(),O6=G({...Nt,..._n,type:Re("approval.requested"),itemId:ce,toolCallId:Te().min(1),pluginId:bt.optional(),approval:zf}).strict(),z6=G({...Nt,..._n,type:Re("approval.resolved"),itemId:ce,toolCallId:Te().min(1),pluginId:bt.optional(),approval:zf}).strict(),D6=G({...Nt,..._n,type:Re("item.completed"),itemId:ce,toolCallId:Te().min(1).optional(),pluginId:bt.optional(),item:oy}).strict(),L6=G({...Nt,..._n,type:Re("usage.updated"),itemId:ce.optional(),usage:Of,cumulative:Ee()}).strict(),B6=G({...Nt,..._n,type:Re("provider.request.retrying"),itemId:ce.optional(),retryCount:le().int().positive(),totalRetryCount:le().int().positive()}).strict(),q6=G({...Nt,..._n,type:Re("provider.request.recovered"),itemId:ce.optional(),retryCount:le().int().positive(),totalRetryCount:le().int().positive()}).strict(),$6=G({...Nt,..._n,type:Re("provider.request.started"),itemId:ce.optional(),requestId:ce,requestIndex:le().int().positive(),round:le().int().nonnegative(),providerProfileId:ce,model:Te().trim().min(1).max(240),contextWindow:le().int().positive().optional()}).strict(),U6=G({...Nt,..._n,type:Re("reasoning.content.delta"),transient:Re(!0),itemId:ce,assistantItemId:ce,delta:Te()}).strict(),H6=G({...Nt,..._n,type:Re("assistant.mode.validation"),transient:Re(!0),projectId:ce,status:$e(["running","passed","failed"]),message:Te().max(4e3).optional()}).strict(),F6=G({...Nt,..._n,type:Re("provider.request.phase.changed"),itemId:ce.optional(),requestId:ce,requestIndex:le().int().positive(),round:le().int().nonnegative(),phase:$e(["reasoning","responding","tooling"]),visibility:$e(["private","public-summary"])}).strict(),V6=G({...Nt,..._n,type:Re("provider.request.completed"),itemId:ce.optional(),metrics:Sg,turnMetrics:kg}).strict(),Z6=G({...Nt,..._n,type:Re("turn.completed"),turn:nl}).strict(),Fj=Jv("type",[M6,N6,P6,U6,H6,R6,O6,z6,D6,L6,B6,q6,$6,F6,V6,Z6]),K6=G({...Nt,type:Re("project.changed"),change:$e(["added","updated","removed","activated"]),projectId:ce,project:Js.optional()}).strict(),Q6=G({...Nt,type:Re("file.changed"),projectId:ce,path:Te(),change:$e(["added","changed","removed","renamed"]),previousPath:Te().optional()}).strict(),G6=G({...Nt,type:Re("plugin.changed"),pluginId:bt,plugin:Lf}).strict(),Y6=G({...Nt,type:Re("log.created"),log:Hj}).strict(),W6=G({...Nt,type:Re("approval.mode.changed"),threadId:ce,mode:tf,previousMode:tf,changedAt:tt,changedBy:$e(["user","system"])}).strict(),X6=G({...Nt,type:Re("thread.changed"),projectId:ce,threadId:ce,change:$e(["created","renamed","execution-updated","preferences-updated","mode-updated","archived","restored","deleted"]),thread:ni.optional()}).strict(),J6=G({...Nt,type:Re("provider.models.changed"),providerProfileId:ce,change:$e(["saved","refreshed","migrated"]).optional(),modelId:Ze.max(240).optional(),modelsLastRefreshedAt:tt.optional()}).strict(),eB=G({...Nt,type:Re("settings.changed"),settings:sy}).strict(),tB=G({...Nt,type:Re("preview.changed"),projectId:ce,session:ba.nullable(),revision:qi}).strict(),nB=G({...Nt,type:Re("frontend.compile.changed"),transient:Re(!0),projectId:ce,previewRevision:qi,state:$j}).strict(),rB=Jv("type",[K6,Q6,G6,Y6,W6,X6,J6,eB,tB,nB]),ly=Hi([Fj,rB]),iB=G({protocolVersion:Te().min(1),clientName:Ze.max(160),clientVersion:Ze.max(64),afterSeq:le().int().nonnegative().optional()}).strict(),oB=G({protocolVersion:Re(OL),serverVersion:Ze.max(64),sessionId:ce,latestSeq:le().int().nonnegative(),replayCursor:le().int().nonnegative(),replayHasMore:Ee(),replay:et(ly),appSettings:sy.default(k6),previewSession:ba.nullable().default(null),previewRevision:qi.default(0),previewSessions:et(ba).optional(),previewRevisions:Mf(ce,qi).optional(),capabilities:G({supportsProjectPreviewPool:Ee().optional(),supportsTurnQueue:Ee().optional(),supportsDocumentAnnotations:Ee().optional(),supportsDocumentSuggestions:Ee().optional(),maxReplayEvents:le().int().positive(),maxMessageBytes:le().int().positive(),supportsPlugins:Ee(),supportsCompaction:Ee(),supportsSubagents:Ee()}).strict()}).strict(),aB=G({assistantMode:Df.nullable(),expectedRevision:le().int().nonnegative()}).strict(),sB=G({appSettings:sy}).strict(),lB=G({projectId:ce}).strict(),cB=G({inspection:C6}).strict(),uB=G({projectId:ce,planId:Ze.max(512)}).strict(),dB=G({preparation:E6}).strict(),Bf=G({projectId:ce}).strict(),qf=G({session:ba.nullable(),revision:qi}).strict(),fB=Bf,pB=qf,hB=Bf,mB=qf,gB=Bf,vB=qf,yB=Bf,bB=qf,xB=G({projectId:ce,previewRevision:qi,tokens:et(Ze.max(4096)).min(1).max(8)}).strict(),wB=G({token:Ze.max(4096),reference:ny}).strict(),SB=G({annotations:et(wB).min(1).max(8)}).strict(),kB=G({projectId:ce}).strict(),IB=G({export:w6}).strict(),TB=G({query:Te().max(240).optional(),includeRemoved:Ee().default(!1)}).strict(),jB=G({projects:et(Js)}).strict(),CB=G({path:Bi.optional()}).strict(),EB=G({project:Js.nullable()}).strict(),_B=G({projectId:ce}).strict(),AB=G({opened:Re(!0)}).strict(),MB=G({path:Bi,name:Te().trim().min(1).max(240).optional()}).strict(),NB=G({project:Js}).strict(),PB=G({workspaceId:ce.nullable(),rootPath:Bi,revision:le().int().nonnegative(),updatedAt:tt,locked:Ee(),state:$e(["ready","unavailable"]),message:Te().trim().min(1).max(4e3).optional()}).strict(),RB=Nj,Vj=G({settings:PB}).strict(),OB=G({rootPath:Bi,expectedRevision:le().int().nonnegative()}).strict(),zB=Vj,DB=G({name:Te().trim().min(1).max(240)}).strict(),LB=G({project:Js,thread:ni,previewSession:ba.nullable(),previewRevision:qi}).strict(),BB=G({projectId:ce,ensurePreview:Ee().default(!0)}).strict(),qB=G({project:Js,previewSession:ba.nullable(),previewRevision:qi}).strict(),$B=G({projectId:ce}).strict(),UB=G({removed:Re(!0)}).strict(),HB=G({projectId:ce,confirmationName:Ze.max(240)}).strict(),FB=G({deleted:Re(!0),recoverable:Re(!0)}).strict(),VB=G({projectId:ce,path:Ln.default(""),includeIgnored:Ee().default(!1)}).strict(),ZB=G({projectId:ce,path:Ln,entries:et(FL)}).strict(),KB=G({projectId:ce,path:Ln,startLine:le().int().positive().optional(),endLine:le().int().positive().optional(),maxBytes:le().int().positive().max(2*1024*1024).default(2*1024*1024)}).strict(),QB=G({file:VL}).strict(),GB=G({projectId:ce,query:Ze.max(2e3),path:Ln.default(""),glob:Te().max(1e3).optional(),caseSensitive:Ee().default(!1),limit:le().int().positive().max(1e3).default(100)}).strict(),YB=G({matches:et(JL),truncated:Ee()}).strict(),WB=G({projectId:ce,includeArchived:Ee().default(!1)}).strict(),XB=G({threads:et(ni)}).strict(),JB=G({maxConcurrentApplications:le().int().positive().max(32),revision:le().int().nonnegative(),updatedAt:tt}).strict(),SS=G({settings:JB}).strict(),e8=G({maxConcurrentApplications:le().int().positive().max(32),expectedRevision:le().int().nonnegative()}).strict(),t8=G({projectId:ce,title:Te().trim().min(1).max(240).optional(),mode:Nf.omit({revision:!0}).optional()}).strict(),n8=G({thread:ni}).strict(),r8=G({threadId:ce,title:Te().trim().min(1).max(240)}).strict(),i8=G({thread:ni}).strict(),o8=G({threadId:ce,mode:Nf.omit({revision:!0}),expectedRevision:le().int().nonnegative()}).strict(),a8=G({thread:ni}).strict(),s8=G({threadId:ce,preferences:zj.omit({updatedAt:!0})}).strict(),l8=G({thread:ni}).strict(),c8=G({threadId:ce,archived:Ee()}).strict(),u8=G({thread:ni}).strict(),d8=G({threadId:ce}).strict(),f8=G({deleted:Re(!0)}).strict(),p8=G({threadId:ce,beforeItemId:ce.optional(),itemLimit:le().int().positive().max(1e3).default(200),afterSeq:le().int().nonnegative().optional(),limit:le().int().positive().max(1e4).optional()}).strict(),h8=G({threadId:ce,artifactId:ce,offset:le().int().nonnegative().default(0),limit:le().int().positive().max(256*1024).default(64*1024)}).strict(),m8=G({artifact:h6,content:Te(),offset:le().int().nonnegative(),nextOffset:le().int().nonnegative().nullable()}).strict(),g8=G({thread:ni,turns:et(nl),items:et(oy),approvals:et(zf).default([]),itemsHasMore:Ee(),nextBeforeItemId:ce.optional(),snapshotSeq:le().int().nonnegative(),events:et(Fj).optional(),latestSeq:le().int().nonnegative().optional(),hasMore:Ee().optional()}).strict(),v8=G({projectId:ce,references:Vc}).strict(),y8=G({references:et(ny).min(1).max(Pj)}).strict(),b8=G({threadId:ce,input:Te().max(1e6),attachments:Rj.default([]),providerProfileId:ce.optional(),model:Te().trim().min(1).max(240).optional(),reasoningEffort:_a.optional(),maxOutputTokens:le().int().positive().optional(),assistantModeExpectation:S6.optional(),conversationModeRevision:le().int().nonnegative().optional(),documentAnnotationReferences:Vc.optional()}).strict(),Zj=G({code:bt,message:Ze}).strict(),x8=G({turn:nl,warnings:et(Zj).default([])}).strict(),w8=G({threadId:ce,turnId:ce}).strict(),S8=G({accepted:Ee()}).strict(),k8=G({threadId:ce,turnId:ce.optional()}).strict(),I8=G({turn:nl,warnings:et(Zj).default([])}).strict(),T8=G({threadId:ce,strategy:$e(["auto","provider","local"]).default("auto")}).strict(),j8=G({accepted:Ee(),turn:nl.optional()}).strict(),C8=Bj,E8=G({approval:zf,decision:Bj}).strict(),_8=G({threadId:ce}).strict(),A8=G({threadId:ce,latestTurnId:ce.optional(),latestTurn:kg.optional(),threadTotal:kg,latestUsageRequest:Sg.optional(),requests:et(Sg)}).strict(),M8=G({threadId:ce,mode:tf}).strict(),N8=G({thread:ni}).strict(),cy=G({id:$e(["openai","anthropic","gemini","deepseek","groq","cerebras","ollama","vllm","custom"]),name:Ze.max(160),kind:el,defaultBaseUrl:Te().url().optional(),defaultModel:Te().min(1).optional(),contextWindow:le().int().positive().max(1e7).optional(),maxOutputTokens:le().int().positive().max(1e6).optional(),reasoningEfforts:et(_a).optional(),imageInputMode:Zc.optional(),reasoningContinuationMode:ry.optional(),environmentVariables:et(bt),authMode:Pf}).strict(),P8=G({includeDisabled:Ee().default(!0)}).strict(),R8=G({profiles:et(iy),presets:et(cy),models:Mf(ce,et(tl)).default({})}).strict(),Kj=G({id:ce.optional(),name:Ze.max(160),kind:el,preset:cy.shape.id,baseUrl:Te().url().optional(),model:Ze.max(240),reasoningEffort:_a,maxOutputTokens:le().int().positive().max(1e6),contextWindow:le().int().positive().max(1e7).optional(),imageInputMode:Zc.default("auto"),reasoningContinuationMode:ry.default("auto"),authMode:Pf.optional(),apiKey:Te().min(1).max(16384).optional(),environmentVariable:bt.optional(),confirmStoredCredential:Ee().default(!1),discoveryId:Te().uuid().optional(),enabled:Ee().default(!0)}).strict(),O8=G({profile:iy}).strict(),z8=G({profileId:ce}).strict(),D8=G({deleted:Re(!0)}).strict(),L8=G({profileId:ce.optional(),draft:Kj.optional()}).strict().refine(e=>e.profileId!==void 0||e.draft!==void 0,{message:"profileId or draft is required"}),B8=G({ok:Ee(),latencyMs:le().nonnegative(),capabilities:Rf.optional(),models:et(tl).optional(),error:Te().optional()}).strict(),rl=Te().trim().min(1).max(2048),uy=le().int().positive().max(500).default(100),q8=G({profileId:ce,cursor:rl.optional(),limit:uy,query:Te().trim().min(1).max(240).optional(),includeDisabled:Ee().default(!0),includeStale:Ee().default(!0)}).strict(),$8=G({models:et(tl).max(500),nextCursor:rl.optional()}).strict(),U8=G({kind:el,preset:cy.shape.id,baseUrl:Te().url().optional(),authMode:Pf.optional(),apiKey:Te().min(1).max(16384).optional(),environmentVariable:bt.optional(),confirmStoredCredential:Ee().default(!1)}).strict(),H8=G({profileId:ce.optional(),draft:U8.optional(),cursor:rl.optional(),limit:uy}).strict().refine(e=>e.profileId!==void 0||e.draft!==void 0||e.cursor!==void 0,{message:"profileId, draft, or cursor is required"}),F8=G({models:et(tl).max(500),nextCursor:rl.optional(),discoveryId:Te().uuid().optional()}).strict(),V8=G({profileId:ce,cursor:rl.optional(),limit:uy}).strict(),Z8=G({models:et(tl).max(500),nextCursor:rl.optional()}).strict(),K8=G({profileId:ce,modelId:Ze.max(240),name:Ze.max(240).optional(),enabled:Ee().optional(),contextOverride:le().int().positive().max(1e7).nullable().optional(),maxOutputOverride:le().int().positive().max(1e6).nullable().optional(),capabilities:Rf.optional(),imageInputMode:Zc.optional(),setDefault:Ee().default(!1)}).strict().superRefine((e,t)=>{typeof e.contextOverride=="number"&&typeof e.maxOutputOverride=="number"&&e.maxOutputOverride>e.contextOverride&&t.addIssue({code:"custom",message:"maxOutputOverride must not exceed contextOverride",path:["maxOutputOverride"]})}),Q8=G({profile:iy,model:tl}).strict(),G8=G({includeDisabled:Ee().default(!0)}).strict(),Y8=G({plugins:et(Lf)}).strict(),W8=G({directoryPath:Bi,trustUi:Ee().default(!1),approvedPermissions:et(Te().min(1)).default([])}).strict(),X8=G({plugin:Lf}).strict(),J8=G({pluginId:bt,enabled:Ee()}).strict(),e9=G({plugin:Lf}).strict(),Qj=G({afterSeq:le().int().nonnegative().optional(),beforeSeq:le().int().nonnegative().optional(),levels:et(Uj).optional(),threadId:ce.optional(),pluginId:bt.optional(),toolName:bt.optional(),providerProfileId:ce.optional(),query:Te().max(1e3).optional(),limit:le().int().positive().max(5e3).default(500)}).strict(),t9=G({entries:et(Hj),latestSeq:le().int().nonnegative(),hasMore:Ee()}).strict(),n9=Qj.extend({format:Re("jsonl").default("jsonl")}).strict(),r9=G({fileName:Ze,mediaType:Re("application/x-ndjson"),content:Te(),entryCount:le().int().nonnegative(),redacted:Re(!0)}).strict(),i9={initialize:{params:iB,result:oB},"app.settings.update":{params:aB,result:sB},"assistant.mode.inspect":{params:lB,result:cB},"assistant.mode.prepare":{params:uB,result:dB},"preview.status":{params:fB,result:pB},"preview.ensure":{params:hB,result:mB},"preview.restart":{params:gB,result:vB},"preview.stop":{params:yB,result:bB},"preview.annotations.resolve":{params:xB,result:SB},"frontend.export":{params:kB,result:IB},"project.list":{params:TB,result:jB},"project.open":{params:CB,result:EB},"project.reveal":{params:_B,result:AB},"project.create":{params:MB,result:NB},"project.createManaged":{params:DB,result:LB},"project.activate":{params:BB,result:qB},"project.remove":{params:$B,result:UB},"project.delete":{params:HB,result:FB},"workspace.settings.get":{params:RB,result:Vj},"workspace.settings.update":{params:OB,result:zB},"project.tree":{params:VB,result:ZB},"file.read":{params:KB,result:QB},"document.annotations.resolve":{params:v8,result:y8},"file.search":{params:GB,result:YB},"artifact.read":{params:h8,result:m8},"thread.list":{params:WB,result:XB},"scheduler.settings.get":{params:Nj,result:SS},"scheduler.settings.update":{params:e8,result:SS},"thread.create":{params:t8,result:n8},"thread.rename":{params:r8,result:i8},"thread.preferences.update":{params:s8,result:l8},"thread.mode.update":{params:o8,result:a8},"thread.archive":{params:c8,result:u8},"thread.delete":{params:d8,result:f8},"thread.history":{params:p8,result:g8},"thread.metrics":{params:_8,result:A8},"turn.start":{params:b8,result:x8},"turn.cancel":{params:w8,result:S8},"turn.retry":{params:k8,result:I8},"turn.compact":{params:T8,result:j8},"approval.resolve":{params:C8,result:E8},"approval.mode.set":{params:M8,result:N8},"provider.list":{params:P8,result:R8},"provider.save":{params:Kj,result:O8},"provider.delete":{params:z8,result:D8},"provider.test":{params:L8,result:B8},"provider.models.list":{params:q8,result:$8},"provider.models.discover":{params:H8,result:F8},"provider.models.refresh":{params:V8,result:Z8},"provider.model.save":{params:K8,result:Q8},"plugin.list":{params:G8,result:Y8},"plugin.install":{params:W8,result:X8},"plugin.setEnabled":{params:J8,result:e9},"log.list":{params:Qj,result:t9},"log.export":{params:n9,result:r9}},dy=Hi([Te().min(1),le().int().nonnegative()]),o9=G({jsonrpc:Re("2.0"),id:dy,method:Te().min(1),params:ya.optional()}).passthrough(),a9=G({jsonrpc:Re("2.0"),method:Te().min(1),params:ya.optional()}).passthrough(),s9=G({code:le().int(),message:Te().min(1),data:ya.optional()}).passthrough(),l9=G({jsonrpc:Re("2.0"),id:dy,result:ya}).passthrough(),c9=G({jsonrpc:Re("2.0"),id:dy.nullable(),error:s9}).passthrough(),u9=Hi([l9,c9]);Hi([o9,a9,u9]);G({jsonrpc:Re("2.0"),method:Re("event"),params:G({event:ly}).strict()}).strict();function d9(e,t){return i9[e].result.parse(t)}function Gj(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Gj(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function f9(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Gj(e))&&(r&&(r+=" "),r+=t);return r}const p9=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},h9=(e,t)=>({classGroupId:e,validator:t}),Yj=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),nf="-",kS=[],m9="arbitrary..",g9=e=>{const t=y9(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return v9(l);const u=l.split(nf),f=u[0]===""&&u.length>1?1:0;return Wj(u,f,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const f=r[l],p=n[l];return f?p?p9(p,f):f:p||kS}return n[l]||kS}}},Wj=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const p=Wj(e,t+1,s);if(p)return p}const l=n.validators;if(l===null)return;const u=t===0?e.join(nf):e.slice(t).join(nf),f=l.length;for(let p=0;p<f;p++){const m=l[p];if(m.validator(u))return m.classGroupId}},v9=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?m9+r:void 0})(),y9=e=>{const{theme:t,classGroups:n}=e;return b9(n,t)},b9=(e,t)=>{const n=Yj();for(const r in e){const o=e[r];fy(o,n,r,t)}return n},fy=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const l=e[s];x9(l,t,n,r)}},x9=(e,t,n,r)=>{if(typeof e=="string"){w9(e,t,n);return}if(typeof e=="function"){S9(e,t,n,r);return}k9(e,t,n,r)},w9=(e,t,n)=>{const r=e===""?t:Xj(t,e);r.classGroupId=n},S9=(e,t,n,r)=>{if(I9(e)){fy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(h9(n,e))},k9=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let l=0;l<s;l++){const[u,f]=o[l];fy(f,Xj(t,u),n,r)}},Xj=(e,t)=>{let n=e;const r=t.split(nf),o=r.length;for(let s=0;s<o;s++){const l=r[s];let u=n.nextPart.get(l);u||(u=Yj(),n.nextPart.set(l,u)),n=u}return n},I9=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,T9=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,l)=>{n[s]=l,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let l=n[s];if(l!==void 0)return l;if((l=r[s])!==void 0)return o(s,l),l},set(s,l){s in n?n[s]=l:o(s,l)}}},Ig="!",IS=":",j9=[],TS=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),C9=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let l=0,u=0,f=0,p;const m=o.length;for(let S=0;S<m;S++){const T=o[S];if(l===0&&u===0){if(T===IS){s.push(o.slice(f,S)),f=S+1;continue}if(T==="/"){p=S;continue}}T==="["?l++:T==="]"?l--:T==="("?u++:T===")"&&u--}const g=s.length===0?o:o.slice(f);let x=g,y=!1;g.endsWith(Ig)?(x=g.slice(0,-1),y=!0):g.startsWith(Ig)&&(x=g.slice(1),y=!0);const w=p&&p>f?p-f:void 0;return TS(s,y,x,w)};if(t){const o=t+IS,s=r;r=l=>l.startsWith(o)?s(l.slice(o.length)):TS(j9,!1,l,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},E9=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const l=n[s],u=l[0]==="[",f=t.has(l);u||f?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(l)):o.push(l)}return o.length>0&&(o.sort(),r.push(...o)),r}},_9=e=>({cache:T9(e.cacheSize),parseClassName:C9(e),sortModifiers:E9(e),postfixLookupClassGroupIds:A9(e),...g9(e)}),A9=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},M9=/\s+/,N9=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:l}=t,u=[],f=e.trim().split(M9);let p="";for(let m=f.length-1;m>=0;m-=1){const g=f[m],{isExternal:x,modifiers:y,hasImportantModifier:w,baseClassName:S,maybePostfixModifierPosition:T}=n(g);if(x){p=g+(p.length>0?" "+p:p);continue}let k=!!T,_;if(k){const R=S.substring(0,T);_=r(R);const z=_&&l[_]?r(S):void 0;z&&z!==_&&(_=z,k=!1)}else _=r(S);if(!_){if(!k){p=g+(p.length>0?" "+p:p);continue}if(_=r(S),!_){p=g+(p.length>0?" "+p:p);continue}k=!1}const C=y.length===0?"":y.length===1?y[0]:s(y).join(":"),E=w?C+Ig:C,O=E+_;if(u.indexOf(O)>-1)continue;u.push(O);const M=o(_,k);for(let R=0;R<M.length;++R){const z=M[R];u.push(E+z)}p=g+(p.length>0?" "+p:p)}return p},P9=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Jj(n))&&(o&&(o+=" "),o+=r);return o},Jj=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Jj(e[r]))&&(n&&(n+=" "),n+=t);return n},R9=(e,...t)=>{let n,r,o,s;const l=f=>{const p=t.reduce((m,g)=>g(m),e());return n=_9(p),r=n.cache.get,o=n.cache.set,s=u,u(f)},u=f=>{const p=r(f);if(p)return p;const m=N9(f,n);return o(f,m),m};return s=l,(...f)=>s(P9(...f))},O9=[],cn=e=>{const t=n=>n[e]||O9;return t.isThemeGetter=!0,t},e2=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,t2=/^\((?:(\w[\w-]*):)?(.+)\)$/i,z9=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,D9=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,L9=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,q9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vo=e=>z9.test(e),it=e=>!!e&&!Number.isNaN(Number(e)),Fr=e=>!!e&&Number.isInteger(Number(e)),km=e=>e.endsWith("%")&&it(e.slice(0,-1)),ji=e=>D9.test(e),n2=()=>!0,U9=e=>L9.test(e)&&!B9.test(e),py=()=>!1,H9=e=>q9.test(e),F9=e=>$9.test(e),V9=e=>!Ae(e)&&!Ne(e),Z9=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),K9=e=>Oo(e,o2,py),Ae=e=>e2.test(e),ra=e=>Oo(e,a2,U9),jS=e=>Oo(e,tq,it),Q9=e=>Oo(e,l2,n2),G9=e=>Oo(e,s2,py),CS=e=>Oo(e,r2,py),Y9=e=>Oo(e,i2,F9),vd=e=>Oo(e,c2,H9),Ne=e=>t2.test(e),nc=e=>Aa(e,a2),W9=e=>Aa(e,s2),ES=e=>Aa(e,r2),X9=e=>Aa(e,o2),J9=e=>Aa(e,i2),yd=e=>Aa(e,c2,!0),eq=e=>Aa(e,l2,!0),Oo=(e,t,n)=>{const r=e2.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Aa=(e,t,n=!1)=>{const r=t2.exec(e);return r?r[1]?t(r[1]):n:!1},r2=e=>e==="position"||e==="percentage",i2=e=>e==="image"||e==="url",o2=e=>e==="length"||e==="size"||e==="bg-size",a2=e=>e==="length",tq=e=>e==="number",s2=e=>e==="family-name",l2=e=>e==="number"||e==="weight",c2=e=>e==="shadow",nq=()=>{const e=cn("color"),t=cn("font"),n=cn("text"),r=cn("font-weight"),o=cn("tracking"),s=cn("leading"),l=cn("breakpoint"),u=cn("container"),f=cn("spacing"),p=cn("radius"),m=cn("shadow"),g=cn("inset-shadow"),x=cn("text-shadow"),y=cn("drop-shadow"),w=cn("blur"),S=cn("perspective"),T=cn("aspect"),k=cn("ease"),_=cn("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...E(),Ne,Ae],M=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],z=()=>[Ne,Ae,f],K=()=>[vo,"full","auto",...z()],q=()=>[Fr,"none","subgrid",Ne,Ae],Z=()=>["auto",{span:["full",Fr,Ne,Ae]},Fr,Ne,Ae],Y=()=>[Fr,"auto",Ne,Ae],ae=()=>["auto","min","max","fr",Ne,Ae],J=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],he=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...z()],ee=()=>[vo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],Q=()=>[vo,"screen","full","dvw","lvw","svw","min","max","fit",...z()],xe=()=>[vo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],P=()=>[e,Ne,Ae],$=()=>[...E(),ES,CS,{position:[Ne,Ae]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",X9,K9,{size:[Ne,Ae]}],L=()=>[km,nc,ra],X=()=>["","none","full",p,Ne,Ae],ue=()=>["",it,nc,ra],we=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Se=()=>[it,km,ES,CS],B=()=>["","none",w,Ne,Ae],U=()=>["none",it,Ne,Ae],ve=()=>["none",it,Ne,Ae],_e=()=>[it,Ne,Ae],qe=()=>[vo,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ji],breakpoint:[ji],color:[n2],container:[ji],"drop-shadow":[ji],ease:["in","out","in-out"],font:[V9],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ji],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ji],shadow:[ji],spacing:["px",it],text:[ji],"text-shadow":[ji],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vo,Ae,Ne,T]}],container:["container"],"container-type":[{"@container":["","normal","size",Ne,Ae]}],"container-named":[Z9],columns:[{columns:[it,Ae,Ne,u]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Fr,"auto",Ne,Ae]}],basis:[{basis:[vo,"full","auto",u,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[it,vo,"auto","initial","none",Ae]}],grow:[{grow:["",it,Ne,Ae]}],shrink:[{shrink:["",it,Ne,Ae]}],order:[{order:[Fr,"first","last","none",Ne,Ae]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...J(),"normal"]}],"justify-items":[{"justify-items":[...he(),"normal"]}],"justify-self":[{"justify-self":["auto",...he()]}],"align-content":[{content:["normal",...J()]}],"align-items":[{items:[...he(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...he(),{baseline:["","last"]}]}],"place-content":[{"place-content":J()}],"place-items":[{"place-items":[...he(),"baseline"]}],"place-self":[{"place-self":["auto",...he()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mbs:[{mbs:F()}],mbe:[{mbe:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:ee()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...xe()]}],"min-block-size":[{"min-block":["auto",...xe()]}],"max-block-size":[{"max-block":["none",...xe()]}],w:[{w:[u,"screen",...ee()]}],"min-w":[{"min-w":[u,"screen","none",...ee()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...ee()]}],h:[{h:["screen","lh",...ee()]}],"min-h":[{"min-h":["screen","lh","none",...ee()]}],"max-h":[{"max-h":["screen","lh",...ee()]}],"font-size":[{text:["base",n,nc,ra]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,eq,Q9]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",km,Ae]}],"font-family":[{font:[W9,G9,t]}],"font-features":[{"font-features":[Ae]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Ne,Ae]}],"line-clamp":[{"line-clamp":[it,"none",Ne,jS]}],leading:[{leading:[s,...z()]}],"list-image":[{"list-image":["none",Ne,Ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ne,Ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...we(),"wavy"]}],"text-decoration-thickness":[{decoration:[it,"from-font","auto",Ne,ra]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[it,"auto",Ne,Ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"tab-size":[{tab:[Fr,Ne,Ae]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne,Ae]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne,Ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fr,Ne,Ae],radial:["",Ne,Ae],conic:[Fr,Ne,Ae]},J9,Y9]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...we(),"hidden","none"]}],"divide-style":[{divide:[...we(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...we(),"none","hidden"]}],"outline-offset":[{"outline-offset":[it,Ne,Ae]}],"outline-w":[{outline:["",it,nc,ra]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",m,yd,vd]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",g,yd,vd]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[it,ra]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",x,yd,vd]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[it,Ne,Ae]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[it]}],"mask-image-linear-from-pos":[{"mask-linear-from":Se()}],"mask-image-linear-to-pos":[{"mask-linear-to":Se()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":Se()}],"mask-image-t-to-pos":[{"mask-t-to":Se()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":Se()}],"mask-image-r-to-pos":[{"mask-r-to":Se()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":Se()}],"mask-image-b-to-pos":[{"mask-b-to":Se()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":Se()}],"mask-image-l-to-pos":[{"mask-l-to":Se()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":Se()}],"mask-image-x-to-pos":[{"mask-x-to":Se()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":Se()}],"mask-image-y-to-pos":[{"mask-y-to":Se()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Ne,Ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":Se()}],"mask-image-radial-to-pos":[{"mask-radial-to":Se()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[it]}],"mask-image-conic-from-pos":[{"mask-conic-from":Se()}],"mask-image-conic-to-pos":[{"mask-conic-to":Se()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,Ae]}],filter:[{filter:["","none",Ne,Ae]}],blur:[{blur:B()}],brightness:[{brightness:[it,Ne,Ae]}],contrast:[{contrast:[it,Ne,Ae]}],"drop-shadow":[{"drop-shadow":["","none",y,yd,vd]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",it,Ne,Ae]}],"hue-rotate":[{"hue-rotate":[it,Ne,Ae]}],invert:[{invert:["",it,Ne,Ae]}],saturate:[{saturate:[it,Ne,Ae]}],sepia:[{sepia:["",it,Ne,Ae]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,Ae]}],"backdrop-blur":[{"backdrop-blur":B()}],"backdrop-brightness":[{"backdrop-brightness":[it,Ne,Ae]}],"backdrop-contrast":[{"backdrop-contrast":[it,Ne,Ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",it,Ne,Ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[it,Ne,Ae]}],"backdrop-invert":[{"backdrop-invert":["",it,Ne,Ae]}],"backdrop-opacity":[{"backdrop-opacity":[it,Ne,Ae]}],"backdrop-saturate":[{"backdrop-saturate":[it,Ne,Ae]}],"backdrop-sepia":[{"backdrop-sepia":["",it,Ne,Ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ne,Ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[it,"initial",Ne,Ae]}],ease:[{ease:["linear","initial",k,Ne,Ae]}],delay:[{delay:[it,Ne,Ae]}],animate:[{animate:["none",_,Ne,Ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ne,Ae]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[Ne,Ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:qe()}],"translate-x":[{"translate-x":qe()}],"translate-y":[{"translate-y":qe()}],"translate-z":[{"translate-z":qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Fr,Ne,Ae]}],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne,Ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne,Ae]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[it,nc,ra,jS]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},rq=R9(nq);function Me(...e){return rq(f9(e))}function iq(e){const t=Date.now()-new Date(e).getTime(),n=6e4,r=n*60,o=r*24;return t<n?"":t<r?`${Math.max(1,Math.floor(t/n))} 分钟前`:t<o?`${Math.floor(t/r)} 小时前`:t<o*2?"昨天":new Intl.DateTimeFormat("zh-CN",{month:"short",day:"numeric"}).format(new Date(e))}function Gn(e=0,{compact:t=!1}={}){if(!Number.isFinite(e))return"—";if(e<1e3)return String(e);const n=[[1e3,"k"],[1e6,"M"],[1e9,"B"]];let r=e>=1e9?2:e>=1e6?1:0;const o=()=>{const l=e/n[r][0];return l.toFixed(l<10||!t&&l===10?1:0)};Number(o())>=1e3&&r<n.length-1&&(r+=1);const s=o();return`${t||r>0?Number(s):s}${n[r][1]}`}function hy(e){const t=e.split(".").pop()?.toLowerCase();return t?{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",html:"html",yaml:"yaml",yml:"yaml",py:"python",rs:"rust",go:"go",sql:"sql"}[t]??"plaintext":"plaintext"}function Ke(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function St(e,t=""){return typeof e=="string"?e:t}function dn(e,t=0){return typeof e=="number"&&Number.isFinite(e)?e:t}class Vr extends Error{constructor(t,n=-1,r){super(t),this.code=n,this.data=r,this.name="RpcError"}code;data}class oq{socket=null;nextId=1;pending=new Map;eventListeners=new Set;statusListeners=new Set;reconnectTimer=null;reconnectAttempt=0;closedByClient=!1;connectPromise=null;lastSeq=0;hostSessionId=null;replayBaselineEstablished=!1;replayInProgress=!0;replayBuffer=new Map;status="connecting";get connectionStatus(){return this.status}get replayCursor(){return this.lastSeq}get hasReplayBaseline(){return this.replayBaselineEstablished}async connect(t=this.lastSeq){if(this.lastSeq=Math.max(this.lastSeq,t),this.socket?.readyState!==WebSocket.OPEN)return this.connectPromise?this.connectPromise:(this.closedByClient=!1,this.setStatus(this.reconnectAttempt>0?"reconnecting":"connecting"),this.connectPromise=this.openSocket().finally(()=>{this.connectPromise=null}),this.connectPromise)}disconnect(){this.closedByClient=!0,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.socket?.close(1e3,"Client closed"),this.socket=null,this.rejectPending(new Vr("Harness Host connection closed",-32001)),this.setStatus("offline","连接已关闭")}subscribe(t){return this.eventListeners.add(t),()=>this.eventListeners.delete(t)}subscribeStatus(t){return this.statusListeners.add(t),t(this.status),()=>this.statusListeners.delete(t)}ingestReplay(t,n=this.lastSeq,r){const o=r!==void 0&&this.hostSessionId!==null&&r.sessionId!==this.hostSessionId;r&&(this.hostSessionId=r.sessionId);const l=!this.replayBaselineEstablished?Math.max(this.lastSeq,n):this.lastSeq,u=new Map(this.replayBuffer);for(const f of t){if(!Ke(f))continue;const p=this.parseEvent(f);!p||p.transient===!0||u.set(p.seq,p)}if(this.replayBuffer.clear(),this.replayInProgress=!1,o){this.lastSeq=r.latestSeq;for(const f of[...u.values()].sort((p,m)=>p.seq-m.seq))if(!(f.seq<=r.latestSeq||f.seq<=this.lastSeq)){this.lastSeq=f.seq;for(const p of this.eventListeners)p(f)}this.replayBaselineEstablished=!0;return}for(const f of[...u.values()].sort((p,m)=>p.seq-m.seq))if(!(f.seq<=l||f.seq<=this.lastSeq)){this.lastSeq=f.seq;for(const p of this.eventListeners)p(f)}this.lastSeq=Math.max(this.lastSeq,n),this.replayBaselineEstablished=!0}async call(t,n,r=3e4){if(this.socket?.readyState!==WebSocket.OPEN)throw new Vr("Harness Host 未连接;当前展示的是离线预览,操作没有执行。",-32e3);if(this.pending.size>=128||this.socket.bufferedAmount>512*1024)throw new Vr("RPC 发送队列已满;请等待正在运行的操作完成。",-32006);const o=this.nextId++,s={jsonrpc:"2.0",id:o,method:t,params:n};return new Promise((l,u)=>{const f=setTimeout(()=>{this.pending.delete(o),u(new Vr(`RPC ${t} 超时`,-32002))},r);this.pending.set(o,{method:t,resolve:p=>l(p),reject:u,timer:f}),this.socket?.send(JSON.stringify(s))})}async openSocket(){try{await this.exchangeFragmentToken(),this.replayInProgress=!0,this.replayBuffer.clear(),await new Promise((t,n)=>{const r=window.location.protocol==="https:"?"wss:":"ws:",o=new URL(`${r}//${window.location.host}/ws`);o.searchParams.set("afterSeq",String(this.lastSeq));const s=new WebSocket(o);this.socket=s;const l=setTimeout(()=>{s.close(),n(new Vr("连接本地 Harness Host 超时",-32003))},5e3);s.addEventListener("open",()=>{clearTimeout(l),this.reconnectAttempt=0,this.setStatus("online"),t()},{once:!0}),s.addEventListener("message",u=>this.handleMessage(String(u.data))),s.addEventListener("error",()=>{clearTimeout(l),s.readyState!==WebSocket.OPEN&&n(new Vr("无法连接本地 Harness Host",-32004))}),s.addEventListener("close",u=>{clearTimeout(l),this.socket===s&&(this.socket=null),this.rejectPending(new Vr("Harness Host 连接中断",-32005)),u.code===1008&&/session expired|session logged out|unauthorized/iu.test(u.reason)?(this.closedByClient=!0,this.setStatus("offline","本地会话已过期,请打开终端当前链接重新连接")):this.closedByClient||this.scheduleReconnect()})})}catch(t){throw this.setStatus("offline",t instanceof Error?t.message:"无法连接本地 Harness Host"),this.closedByClient||this.scheduleReconnect(),t}}async exchangeFragmentToken(){const n=new URLSearchParams(window.location.hash.replace(/^#/,"")).get("token");if(n)try{const r=await fetch("/auth/exchange",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({token:n})});if(!r.ok)throw new Vr("一次性登录令牌无效或已过期",r.status);history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}finally{window.location.hash&&history.replaceState(null,"",`${window.location.pathname}${window.location.search}`)}}handleMessage(t){if(t.length>1048576){this.socket?.close(1009,"Message exceeds client limit");return}let n;try{n=JSON.parse(t)}catch{return}if(!(!Ke(n)||n.jsonrpc!=="2.0")){if(typeof n.id=="number"){const r=n,o=this.pending.get(r.id);if(!o)return;if(clearTimeout(o.timer),this.pending.delete(r.id),r.error)o.reject(new Vr(r.error.message,r.error.code,r.error.data));else try{o.resolve(d9(o.method,r.result))}catch(s){o.reject(new Vr(s instanceof Error?`RPC ${o.method} 返回了无效数据:${s.message}`:`RPC ${o.method} 返回了无效数据`,-32007))}return}if(n.method==="event"&&Ke(n.params)){const r=Ke(n.params.event)?n.params.event:n.params,o=this.parseEvent(r);if(!o)return;if(o.transient===!0){if(this.replayInProgress)return;for(const s of this.eventListeners)s(o);return}if(this.replayInProgress){this.replayBuffer.set(o.seq,o);return}if(o.seq<=this.lastSeq)return;this.lastSeq=o.seq;for(const s of this.eventListeners)s(o)}}}parseEvent(t){const n=ly.safeParse(t);if(!n.success)return null;const r=n.data,o=dn(r.seq,-1),s=St(r.type),l=St(r.eventId),u=Object.fromEntries(Object.entries(r).filter(([p])=>!["schemaVersion","eventId","seq","timestamp","sessionId","type","transient","threadId","turnId","itemId","toolCallId","pluginId"].includes(p))),f={schemaVersion:1,eventId:l,seq:o,timestamp:St(r.timestamp,new Date().toISOString()),type:s,payload:u};return r.transient===!0&&(f.transient=!0),typeof r.threadId=="string"&&(f.threadId=r.threadId),typeof r.turnId=="string"&&(f.turnId=r.turnId),typeof r.itemId=="string"&&(f.itemId=r.itemId),typeof r.toolCallId=="string"&&(f.toolCallId=r.toolCallId),typeof r.pluginId=="string"&&(f.pluginId=r.pluginId),f}scheduleReconnect(){if(this.reconnectTimer||this.closedByClient)return;this.reconnectAttempt+=1,this.setStatus(this.reconnectAttempt===1?"offline":"reconnecting","正在等待本地 Host");const t=Math.min(15e3,750*2**Math.min(this.reconnectAttempt-1,5));this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect().catch(()=>{})},t)}setStatus(t,n){this.status=t;for(const r of this.statusListeners)r(t,n)}rejectPending(t){for(const n of this.pending.values())clearTimeout(n.timer),n.reject(t);this.pending.clear()}}const He=new oq;function Ec(e){return{id:e.id,name:e.name,kind:e.kind,...e.managedState?{managedState:e.managedState}:{},rootPath:e.rootPath,updatedAt:e.updatedAt}}function my(e){return e.map(t=>({id:`entry:${t.path}`,name:t.name,path:t.path,kind:t.kind==="directory"?"directory":"file",...t.kind==="directory"&&t.hasChildren===!1?{children:[],loaded:!0}:{},...t.ignored?{status:"ignored"}:{}}))}function aq(e){return{id:`file:${e.path}`,path:e.path,name:e.path.split(/[\\/]/).pop()??e.path,language:e.language??hy(e.path),content:e.binary?"":e.content??"",hash:e.hash,size:e.size,...e.binary?{error:"二进制文件仅显示元数据,不能在 Monaco 中打开。"}:{}}}function sq(e){if(Ke(e)){if(e.kind==="image"&&typeof e.artifactId=="string"&&typeof e.name=="string"&&(e.mediaType==="image/png"||e.mediaType==="image/jpeg"||e.mediaType==="image/webp")&&typeof e.size=="number"&&typeof e.hash=="string"&&typeof e.width=="number"&&typeof e.height=="number")return{kind:"image",artifactId:e.artifactId,name:e.name,mediaType:e.mediaType,size:e.size,hash:e.hash,width:e.width,height:e.height};if(e.kind==="text-file"&&typeof e.artifactId=="string"&&typeof e.name=="string"&&typeof e.mediaType=="string"&&typeof e.size=="number"&&typeof e.hash=="string")return{kind:"text-file",artifactId:e.artifactId,name:e.name,mediaType:e.mediaType,size:e.size,hash:e.hash,encoding:"utf-8"};if(e.kind==="document"&&typeof e.artifactId=="string"&&typeof e.extractedTextArtifactId=="string"&&typeof e.name=="string"&&(e.format==="docx"||e.format==="xlsx"||e.format==="pdf")&&(e.mediaType==="application/pdf"||e.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")&&typeof e.size=="number"&&typeof e.hash=="string"&&typeof e.textLength=="number"&&typeof e.visualCount=="number")return{kind:"document",artifactId:e.artifactId,extractedTextArtifactId:e.extractedTextArtifactId,name:e.name,mediaType:e.mediaType,size:e.size,hash:e.hash,format:e.format,textLength:e.textLength,...typeof e.pageCount=="number"?{pageCount:e.pageCount}:{},...typeof e.sheetCount=="number"?{sheetCount:e.sheetCount}:{},visualCount:e.visualCount,textTruncated:e.textTruncated===!0,visualsTruncated:e.visualsTruncated===!0};if((e.kind===void 0||e.kind==="workspace-file")&&typeof e.projectId=="string"&&typeof e.path=="string"&&typeof e.hash=="string")return{kind:"workspace-file",projectId:e.projectId,path:e.path,hash:e.hash,truncated:e.truncated===!0,...typeof e.startLine=="number"?{startLine:e.startLine}:{},...typeof e.endLine=="number"?{endLine:e.endLine}:{},...typeof e.snapshot=="string"?{snapshot:e.snapshot}:{}}}}function u2(e){return e==="waiting-approval"?"awaiting_approval":e==="completed"?"completed":e==="failed"?"failed":e==="cancelled"||e==="interrupted"?"cancelled":e==="running"?"running":"queued"}function lq(e){return e==="completed"?"running":u2(e)}function cq(e){return e.status==="queued"||e.status==="running"||e.status==="waiting-approval"?u2(e.status):e.status==="cancelled"||e.status==="interrupted"?"cancelled":e.status==="failed"||e.success===!1?"failed":e.success===!0?"completed":"unknown"}function uq(e){if(!(!Ke(e)||typeof e.code!="string"||e.code.trim().length===0))return{code:e.code,agentRecoverable:e.agentRecoverable===!0,...typeof e.category=="string"&&e.category.trim().length>0?{category:e.category}:{},...typeof e.targetPath=="string"&&e.targetPath.trim().length>0?{targetPath:e.targetPath}:{}}}function d2(e){if(e.kind==="userMessage"){const t=e.documentAnnotationReferences,n=t===void 0?void 0:Vc.safeParse(t),r=e.attachments.flatMap(o=>{const s=sq(o);return s?[s]:[]});return{id:e.id,type:"message",role:"user",content:e.content,createdAt:e.createdAt,...e.turnId?{turnId:e.turnId}:{},references:r.flatMap(o=>o.kind==="workspace-file"?[o]:[]),attachments:r,...n?.success?{documentAnnotationReferences:n.data}:{},...e.documentAnnotationReferencesInvalid||n&&!n.success?{documentAnnotationReferencesInvalid:!0}:{},streaming:e.status==="running"}}if(e.kind==="assistantMessage")return{id:e.id,type:"message",role:"assistant",content:e.content,createdAt:e.createdAt,...e.turnId?{turnId:e.turnId}:{},...e.finishReason?{finishReason:e.finishReason}:{},streaming:e.status==="running"};if(e.kind==="reasoningSummary")return{id:e.id,type:"reasoning",...e.turnId?{turnId:e.turnId}:{},...e.assistantItemId?{assistantItemId:e.assistantItemId}:{},...e.source?{source:e.source}:{},summary:e.content,createdAt:e.createdAt,streaming:e.status==="running"};if(e.kind==="toolCall")return{id:e.id,type:"tool",...e.turnId?{turnId:e.turnId}:{},toolCallId:e.toolCallId,callItemId:e.id,recordKind:"call",toolName:e.toolName,title:_S(e.toolName,e.arguments),state:lq(e.status),createdAt:e.createdAt,...e.completedAt?{completedAt:e.completedAt}:{},input:e.arguments};if(e.kind==="toolResult"){const t=uq(e.metadata?.failure);return{id:e.id,type:"tool",...e.turnId?{turnId:e.turnId}:{},toolCallId:e.toolCallId,...e.callItemId?{callItemId:e.callItemId}:{},resultItemId:e.id,recordKind:"result",toolName:e.toolName,title:_S(e.toolName,{}),state:cq(e),createdAt:e.createdAt,...e.completedAt?{completedAt:e.completedAt}:{},...e.status==="running"||e.status==="queued"?{}:{output:e.output??e.summary},...e.artifactId?{artifactId:e.artifactId}:{},...e.artifactIds?{artifactIds:e.artifactIds}:{},...typeof e.metadata?.command=="string"?{command:e.metadata.command}:{},...typeof e.metadata?.cwd=="string"?{cwd:e.metadata.cwd}:{},...typeof e.metadata?.stdout=="string"?{stdout:e.metadata.stdout}:{},...typeof e.metadata?.stderr=="string"?{stderr:e.metadata.stderr}:{},...typeof e.metadata?.exitCode=="number"?{exitCode:e.metadata.exitCode}:{},...typeof e.metadata?.durationMs=="number"?{durationMs:e.metadata.durationMs}:{},...typeof e.metadata?.path=="string"&&e.metadata.path.trim().length>0?{workspacePath:e.metadata.path}:{},...e.truncated||e.metadata?.truncated===!0?{truncated:!0}:{},...e.metadata?.timedOut===!0?{timedOut:!0}:{},...t?{failure:t}:{}}}return e.kind==="approval"?{id:e.id,type:"approval",approvalId:e.approvalId,toolCallId:e.toolCallId,title:"工具操作审批",description:"请检查操作详情后决定是否允许。",risk:"write",status:e.decision==="deny"?"denied":e.decision?"approved":"pending",createdAt:e.createdAt}:e.kind==="compaction"?{id:e.id,type:"compaction",summary:e.summary,originalTokens:e.inputTokensBefore,compactedTokens:e.inputTokensAfter,createdAt:e.createdAt}:{id:e.id,type:"error",...e.turnId?{turnId:e.turnId}:{},code:e.code,message:e.message,...e.details?{details:e.details}:{},recoverable:e.retryable,createdAt:e.createdAt}}function dq(e,t){return e.turnId!==void 0&&t.turnId!==void 0&&e.turnId===t.turnId&&e.toolCallId===t.toolCallId}function fq(e,t){if(t.callItemId){const n=e.findIndex(r=>r.type==="tool"&&(r.callItemId===t.callItemId||r.id===t.callItemId));if(n>=0)return n}if(t.resultItemId){const n=e.findIndex(r=>r.type==="tool"&&r.resultItemId===t.resultItemId);if(n>=0)return n}for(let n=e.length-1;n>=0;n-=1){const r=e[n];if(!(!r||r.type!=="tool"||!dq(r,t))&&(t.recordKind==="result"&&r.resultItemId===void 0||t.recordKind==="call"&&r.callItemId===void 0))return n}return-1}function pq(e,t){const n=t.recordKind==="call",r=t.recordKind==="result",o=e.callItemId!==void 0||e.recordKind==="call",s=e.resultItemId!==void 0||e.recordKind==="result",l=n?t.callItemId??t.id:e.callItemId??t.callItemId,u=r?t.resultItemId??t.id:e.resultItemId??t.resultItemId,f=n?t.title:o?e.title:t.title,p=n?t.createdAt:o?e.createdAt:t.createdAt,m=r||s,g=r?t:e,x=Date.parse(p),y=m?Date.parse(g.completedAt??g.createdAt):Number.NaN,w=Number.isFinite(x)&&Number.isFinite(y)&&y>=x?y-x:e.durationMs??t.durationMs;return{...e,...t,id:l??e.id,...e.turnId??t.turnId?{turnId:e.turnId??t.turnId}:{},...l?{callItemId:l}:{},...u?{resultItemId:u}:{},recordKind:m?"result":"call",title:f,createdAt:p,state:m?g.state:t.state,...e.input??t.input?{input:e.input??t.input}:{},...m&&g.output!==void 0?{output:g.output}:e.output!==void 0?{output:e.output}:{},...m&&g.artifactId?{artifactId:g.artifactId}:e.artifactId?{artifactId:e.artifactId}:{},...m&&g.artifactIds?{artifactIds:g.artifactIds}:e.artifactIds?{artifactIds:e.artifactIds}:{},...m&&g.command?{command:g.command}:e.command?{command:e.command}:{},...m&&g.cwd?{cwd:g.cwd}:e.cwd?{cwd:e.cwd}:{},...m&&g.stdout!==void 0?{stdout:g.stdout}:e.stdout!==void 0?{stdout:e.stdout}:{},...m&&g.stderr!==void 0?{stderr:g.stderr}:e.stderr!==void 0?{stderr:e.stderr}:{},...m&&g.exitCode!==void 0?{exitCode:g.exitCode}:e.exitCode!==void 0?{exitCode:e.exitCode}:{},...m&&g.truncated?{truncated:!0}:e.truncated?{truncated:!0}:{},...m&&g.timedOut?{timedOut:!0}:e.timedOut?{timedOut:!0}:{},...m&&g.workspacePath?{workspacePath:g.workspacePath}:e.workspacePath?{workspacePath:e.workspacePath}:{},...m&&g.failure?{failure:g.failure}:e.failure?{failure:e.failure}:{},...e.approvalSource??t.approvalSource?{approvalSource:e.approvalSource??t.approvalSource}:{},...m&&g.completedAt?{completedAt:g.completedAt}:e.completedAt?{completedAt:e.completedAt}:{},...w!==void 0?{durationMs:w}:{}}}function ko(e,t){if(t.type==="tool"){const r=fq(e,t);if(r>=0)return e.map((o,s)=>s===r&&o.type==="tool"?pq(o,t):o)}const n=e.findIndex(r=>r.id===t.id);return n>=0?e.map((r,o)=>o===n?t:r):[...e,t]}function hq(e){return e.reduce((t,n)=>ko(t,d2(n)),[])}function _S(e,t){const n=typeof t.path=="string"?t.path:"",r=typeof t.command=="string"?t.command:"";return e==="read_file"?n?`读取 ${n}`:"读取文件":e==="search_files"?`搜索 ${typeof t.query=="string"?t.query:"项目"}`:e==="list_directory"?n?`浏览 ${n}`:"浏览项目目录":e==="apply_patch"?"应用文件补丁":e==="write_file"?n?`修改 ${n}`:"修改文件":e==="move_to_trash"?n?`移至回收站 ${n}`:"移至回收站":e==="run_command"?r?`运行 ${r}`:"运行命令":e==="frontend_validate"?"检查前台版本":e==="document_validate"?"检查设计文档":`运行 ${e}`}function Tg(e){const t=e.sideEffect==="delete"?"delete":e.sideEffect==="process"?"command":e.sideEffect==="network"?"network":"write";return{id:`approval:${e.id}`,type:"approval",turnId:e.turnId,approvalId:e.id,toolCallId:e.toolCallId,title:e.title,description:e.summary,risk:t,allowedDecisions:e.allowedDecisions,...e.resolutionSource?{resolutionSource:e.resolutionSource}:{},status:e.status==="approved"?"approved":e.status==="rejected"||e.status==="cancelled"?"denied":e.status,createdAt:e.createdAt,...e.proposedDiff?{diff:e.proposedDiff}:{},...e.command?{command:e.command}:{},...e.cwd?{cwd:e.cwd}:{}}}function AS(e){const t=e.cachedInputTokens,n=(t??0)>0?"hit":e.availability?.cachedInputTokens===!0?"miss":"unavailable";return{inputTokens:e.inputTokens,outputTokens:e.outputTokens,...e.reasoningTokens!==void 0?{reasoningTokens:e.reasoningTokens}:{},...t!==void 0?{cachedInputTokens:t}:{},...e.cacheWriteTokens!==void 0?{cacheWriteTokens:e.cacheWriteTokens}:{},totalTokens:e.totalTokens,estimated:e.estimated,...e.availability?{availability:{...e.availability}}:{},cacheStatus:n}}function mq(e,t){const n=e.at(-1);return n?n.status==="running"||n.status==="queued"||n.status==="waiting-approval"?"running":n.status==="failed"?"failed":n.status==="interrupted"||n.status==="cancelled"?"interrupted":"idle":t?"running":"idle"}function Rr(e,t=[],n=[],r=[]){const o=n.at(-1),s=e.activeTurnId??(o&&(o.status==="queued"||o.status==="running"||o.status==="waiting-approval")?o.id:void 0),l=hq(t).filter(f=>!(f.type==="message"&&f.role==="assistant"&&f.content.length===0&&!f.streaming&&(f.finishReason==="error"||f.finishReason==="cancelled")));for(const f of r){if(f.resolutionSource==="full-access"){const g=l.findIndex(y=>y.type==="tool"&&y.toolCallId===f.toolCallId),x=g>=0?l[g]:void 0;x?.type==="tool"&&(l[g]={...x,approvalSource:"full-access"});continue}const p=Tg(f),m=l.findIndex(g=>g.id===p.id);m>=0?l[m]=p:l.push(p)}const u=new Set(l.flatMap(f=>f.type==="error"&&f.turnId?[f.turnId]:[]));for(const f of n)!f.error||u.has(f.id)||l.push({id:`turn-error:${f.id}`,type:"error",turnId:f.id,code:f.error.code,message:f.error.message,recoverable:f.error.retryable,createdAt:f.completedAt??f.createdAt});return l.sort((f,p)=>f.createdAt.localeCompare(p.createdAt)),{id:e.id,projectId:e.projectId,title:e.title,createdAt:e.createdAt,updatedAt:e.updatedAt,lastSeq:e.lastSeq,status:e.status==="archived"?"archived":mq(n,e.activeTurnStatus),...e.activeTurnStatus?{activeTurnStatus:e.activeTurnStatus}:{},...e.queue?{queue:e.queue}:{},depth:e.depth,approvalMode:e.approvalMode??"prompt",...e.approvalModeChangedAt?{approvalModeChangedAt:e.approvalModeChangedAt}:{},...e.preferences?{preferences:{...e.preferences}}:{},...e.mode?{mode:e.mode}:{},items:l,turns:n.map(f=>{const p=f;return{id:f.id,status:f.status,...f.queue?{queue:f.queue}:{},providerProfileId:f.providerProfileId,providerKind:f.providerKind,model:f.model,...f.contextWindow!==void 0?{contextWindow:f.contextWindow}:{},maxOutputTokens:f.maxOutputTokens,reasoningEffort:f.reasoningEffort,...f.error?{error:{...f.error}}:{},createdAt:f.createdAt,...f.startedAt?{startedAt:f.startedAt}:{},...f.completedAt?{completedAt:f.completedAt}:{},...f.usage?{usage:AS(f.usage)}:{},...typeof p.providerRetryCount=="number"?{providerRetryCount:p.providerRetryCount}:{}}}),...e.parentThreadId?{parentThreadId:e.parentThreadId}:{},...e.spawnedByItemId?{spawnedByItemId:e.spawnedByItemId}:{},...e.agentRole?{agentRole:e.agentRole}:{},...s?{activeTurnId:s}:{},...o?.usage?{usage:AS(o.usage)}:{}}}function gq(e){const t=e,n=e.contextWindow??e.capabilities.contextWindow;return{id:e.id,type:e.kind,name:e.name,model:e.model,authMode:e.authMode,keySource:e.secretSource==="credential-manager"?"credential":e.secretSource,reasoningLevels:e.capabilities.reasoningEfforts,reasoningEffort:e.reasoningEffort,inputModalities:t.capabilities.inputModalities??["text"],imageInputMode:t.imageInputMode??"auto",reasoningContinuationMode:t.reasoningContinuationMode??"auto",maxOutputTokens:e.maxOutputTokens,...n!==void 0?{contextWindow:n}:{},enabled:e.enabled,...e.baseUrl?{baseUrl:e.baseUrl}:{},preset:e.preset,...e.defaultModelId?{defaultModelId:e.defaultModelId}:{},modelCount:e.modelCount??1,enabledModelCount:e.enabledModelCount??(e.enabled?1:0),...e.modelsLastRefreshedAt?{modelsLastRefreshedAt:e.modelsLastRefreshedAt}:{},...e.environmentVariable?{environmentVariable:e.environmentVariable}:{}}}function vq(e){return{id:e.id,name:e.name,type:e.kind,...e.defaultBaseUrl?{defaultBaseUrl:e.defaultBaseUrl}:{},...e.defaultModel?{defaultModel:e.defaultModel}:{},...e.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},...e.maxOutputTokens!==void 0?{maxOutputTokens:e.maxOutputTokens}:{},...e.reasoningEfforts?{reasoningLevels:e.reasoningEfforts}:{},...e.imageInputMode?{imageInputMode:e.imageInputMode}:{},...e.reasoningContinuationMode?{reasoningContinuationMode:e.reasoningContinuationMode}:{},environmentVariables:e.environmentVariables,authMode:e.authMode}}function f2(e,t){const n=e.providerProfileId??t;if(!n)throw new Error(`模型 ${e.id} 缺少 Provider ID`);return{providerId:n,id:e.id,displayName:e.name,enabled:e.enabled??!1,availability:e.availability??"available",...e.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},...e.maxOutputTokens!==void 0?{maxOutputTokens:e.maxOutputTokens}:{},contextSource:e.contextSource??"unknown",outputSource:e.outputSource??"unknown",...e.contextOverride!==void 0?{contextOverride:e.contextOverride}:{},...e.maxOutputOverride!==void 0?{maxOutputOverride:e.maxOutputOverride}:{},imageInputMode:e.imageInputMode??"auto",capabilities:{streaming:e.capabilities.streaming,tools:e.capabilities.tools,parallelToolCalls:e.capabilities.parallelToolCalls,reasoningLevels:e.capabilities.reasoningEfforts,nativeCompaction:e.capabilities.nativeCompaction,promptCaching:e.capabilities.promptCaching,tokenCounting:e.capabilities.tokenCounting,inputModalities:e.capabilities.inputModalities},...e.lastSeenAt?{lastSeenAt:e.lastSeenAt}:{},...e.updatedAt?{updatedAt:e.updatedAt}:{}}}function yq(e){if(!Ke(e))return[];const t=[];for(const[n,r]of Object.entries(e)){const o=n==="tools"||n==="tool"?"tool":n==="leftNav"?"leftNav":n==="settings"?"settings":n==="providers"?"provider":"panel",s=Array.isArray(r)?r:[r];for(const l of s)if(typeof l=="string")t.push({kind:o,id:l,label:l});else if(Ke(l)){const u=typeof l.id=="string"?l.id:`${n}-${t.length+1}`,f=typeof l.label=="string"?l.label:typeof l.title=="string"?l.title:u;t.push({kind:l.slot==="leftNav"?"leftNav":o,id:u,label:f})}}return t}function jg(e){return{id:e.id,name:e.name,version:e.version,description:e.description??"此插件没有提供描述。",state:e.state,builtin:e.id.startsWith("builtin."),trusted:e.uiTrusted,permissions:e.permissions.map(t=>t.resource?`${t.permission}:${t.resource}`:t.permission),contributions:yq(e.contributions),...e.uiEntryUrl?{uiEntryUrl:e.uiEntryUrl}:{},...e.error?{error:e.error}:{}}}function p2(e){const t=e.level==="fatal"?"error":e.level==="trace"?"debug":e.level,n=e.toolName?`tool.${e.toolName}`:e.pluginId?`plugin.${e.pluginId}`:e.providerProfileId?"provider":"host";return{id:e.id,timestamp:e.timestamp,level:t,source:n,message:e.message,...e.threadId?{threadId:e.threadId}:{},...e.pluginId?{pluginId:e.pluginId}:{},...e.data?{data:e.data}:{}}}function Im(e){return!Ke(e)||typeof e.id!="string"?null:typeof e.type=="string"?e:typeof e.kind=="string"?d2(e):null}function bq(e,t){if(!t.itemId)return e;const n=St(t.payload.delta??t.payload.text);if(!n)return e;const r=t.type==="reasoning.content.delta",o=t.type==="reasoning.summary.delta"||r?"reasoning":St(t.payload.channel,"assistant"),s=u=>r?u.slice(-32*1024):u,l=e.findIndex(u=>u.id===t.itemId||u.type==="tool"&&(u.resultItemId===t.itemId||u.turnId===t.turnId&&u.toolCallId===t.toolCallId));if(l<0){const u=t.timestamp;if(o==="reasoning")return[...e,{id:t.itemId,type:"reasoning",...t.turnId?{turnId:t.turnId}:{},...typeof t.payload.assistantItemId=="string"?{assistantItemId:t.payload.assistantItemId}:{},...t.payload.source==="provider"||t.payload.source==="generated"?{source:t.payload.source}:{},summary:s(n),createdAt:u,streaming:!0}];if(o.startsWith("tool.")){const f=o==="tool.stderr"?{stderr:n}:{stdout:n};return ko(e,{id:t.itemId,type:"tool",...t.turnId?{turnId:t.turnId}:{},toolCallId:t.toolCallId??t.itemId,resultItemId:t.itemId,recordKind:"result",toolName:St(t.payload.toolName,"tool"),title:St(t.payload.title,"运行工具"),state:"running",createdAt:u,...f})}return[...e,{id:t.itemId,type:"message",role:"assistant",content:n,createdAt:u,...t.turnId?{turnId:t.turnId}:{},streaming:!0}]}return e.map((u,f)=>{if(f!==l)return u;if(u.type==="message")return{...u,content:u.content+n,streaming:!0};if(u.type==="reasoning")return{...u,summary:s(u.summary+n),streaming:!0};if(u.type==="tool"){const p=x=>`${x??""}${n}`.slice(-65536),g=u.state==="completed"||u.state==="failed"||u.state==="cancelled"||u.state==="unknown"?u.state:"running";return o==="tool.stderr"?{...u,stderr:p(u.stderr),state:g}:o==="tool.stdout"?{...u,stdout:p(u.stdout),state:g}:{...u,output:p(u.output),state:g}}return u})}const Ns={pluginId:"harness.fast-frontend",modeId:"fast-frontend"},xq=new Set(["stopped","starting","running","restarting","failed"]),wq=new Set(["disabled","ready","requires_preparation","blocked"]),Sq=new Set(["idle","compiling","success","failed"]),kq=new Set(["error","warning","info"]),Iq=new Set(["typescript","route","runtime"]),Tq=new Set(["succeeded","failed"]);function zd(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0?e:void 0}function Zr(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0?e:void 0}function h2(e){if(!(!Ke(e)||typeof e.pluginId!="string"||typeof e.runtimeId!="string"||typeof e.version!="string"||typeof e.abiVersion!="string"||typeof e.contentHash!="string"))return{pluginId:e.pluginId,runtimeId:e.runtimeId,version:e.version,abiVersion:e.abiVersion,contentHash:e.contentHash}}function m2(e){if(!(!Ke(e)||typeof e.severity!="string"||!kq.has(e.severity)||typeof e.source!="string"||!Iq.has(e.source)||typeof e.message!="string"))return{severity:e.severity,source:e.source,message:e.message,...typeof e.code=="string"||typeof e.code=="number"&&Number.isSafeInteger(e.code)?{code:e.code}:{},...typeof e.path=="string"?{path:e.path}:{},...Zr(e.line)!==void 0?{line:Zr(e.line)}:{},...Zr(e.column)!==void 0?{column:Zr(e.column)}:{},...Zr(e.endLine)!==void 0?{endLine:Zr(e.endLine)}:{},...Zr(e.endColumn)!==void 0?{endColumn:Zr(e.endColumn)}:{}}}function g2(e){if(!Ke(e)||typeof e.status!="string"||!Sq.has(e.status))return;const t=zd(e.sourceRevision),n=zd(e.diagnosticsRevision);if(t===void 0||n===void 0||!Array.isArray(e.diagnostics))return;const r=e.diagnostics.map(m2);if(r.some(s=>s===void 0))return;const o=zd(e.successfulSourceRevision);return{status:e.status,sourceRevision:t,...o!==void 0?{successfulSourceRevision:o}:{},diagnosticsRevision:n,diagnostics:r,updatedAt:St(e.updatedAt,new Date(0).toISOString())}}function jq(e){if(!Ke(e)||typeof e.projectId!="string"||typeof e.status!="string"||!Tq.has(e.status))return;const t=zd(e.sourceRevision);if(t===void 0||!Array.isArray(e.diagnostics))return;const n=e.diagnostics.map(m2);if(!n.some(r=>r===void 0))return{projectId:e.projectId,status:e.status,sourceRevision:t,...typeof e.outputPath=="string"?{outputPath:e.outputPath}:{},diagnostics:n,...typeof e.error=="string"?{error:e.error}:{},...typeof e.exportedAt=="string"?{exportedAt:e.exportedAt}:{}}}function v2(e){if(e===null)return null;if(!(!Ke(e)||typeof e.pluginId!="string"||typeof e.modeId!="string"))return{pluginId:e.pluginId,modeId:e.modeId}}function gy(e){if(!Ke(e))return;const t=v2(e.assistantMode);if(!(t===void 0||typeof e.revision!="number"||!Number.isSafeInteger(e.revision)||e.revision<0))return{assistantMode:t,revision:e.revision,updatedAt:St(e.updatedAt,new Date(0).toISOString())}}function vy(e){return e?.assistantMode?.pluginId===Ns.pluginId&&e.assistantMode.modeId===Ns.modeId}function il(e){if(!Ke(e)||typeof e.projectId!="string"||typeof e.status!="string"||!xq.has(e.status))return;const t=h2(e.runtime),n=g2(e.compileState);return{projectId:e.projectId,targetPath:St(e.targetPath),status:e.status,revision:typeof e.revision=="number"&&Number.isSafeInteger(e.revision)&&e.revision>=0?e.revision:0,...typeof e.url=="string"?{url:e.url}:{},...typeof e.error=="string"?{error:e.error}:{},...t?{runtime:t}:{},...n?{compileState:n}:{},updatedAt:St(e.updatedAt,new Date(0).toISOString())}}function bd(e){if(!Ke(e)||typeof e.revision!="number"||!Number.isSafeInteger(e.revision)||e.revision<0)return;if(e.session===null)return{session:null,revision:e.revision};const t=il(e.session);return t?{session:t,revision:e.revision}:void 0}function Cq(e){if(!Ke(e)||typeof e.projectId!="string"||typeof e.targetPath!="string"||typeof e.state!="string"||!wq.has(e.state)||typeof e.settingsRevision!="number"||!Number.isSafeInteger(e.settingsRevision)||e.settingsRevision<0)return;const t=v2(e.mode);if(t===void 0)return;const n=Ke(e.template)&&typeof e.template.pluginId=="string"&&typeof e.template.templateId=="string"&&typeof e.template.version=="string"?{pluginId:e.template.pluginId,templateId:e.template.templateId,version:e.template.version}:void 0,r=h2(e.runtime);return{projectId:e.projectId,mode:t,settingsRevision:e.settingsRevision,targetPath:e.targetPath,state:e.state,...n?{template:n}:{},...r?{runtime:r}:{},...typeof e.planId=="string"?{planId:e.planId}:{},createsTemplate:e.createsTemplate===!0,installRequired:e.installRequired===!0,...typeof e.reason=="string"?{reason:e.reason}:{}}}function Eq(e){if(!Ke(e)||typeof e.projectId!="string"||typeof e.targetPath!="string")return;const t=il(e.previewSession);return{projectId:e.projectId,targetPath:e.targetPath,prepared:e.prepared===!0,installed:e.installed===!0,...t?{previewSession:t}:{}}}function _q(e){if(!Ke(e)||typeof e.token!="string"||!Ke(e.reference))return;const t=e.reference;if(!(typeof t.projectId!="string"||typeof t.path!="string"||typeof t.hash!="string"||!/^[a-f0-9]{64}$/iu.test(t.hash)||!Zr(t.startLine)||!Zr(t.endLine)||typeof t.truncated!="boolean"))return{token:e.token,reference:{projectId:t.projectId,path:t.path,hash:t.hash,startLine:t.startLine,endLine:t.endLine,...typeof t.snapshot=="string"?{snapshot:t.snapshot}:{},truncated:t.truncated}}}const Or=360,y2=480,yy=1,Aq=9,Mq=Or+y2+yy;function rc(e,t){const n=Number.isFinite(e)?e:Or;return Math.round(Math.max(Or,Math.min(n,t-y2-yy)))}function b2(e,t){return e?.kind==="managed"||vy(t)}function Nq(e,t,n){return e==="split"&&t&&n>=Mq?"split":"tabs"}const MS=new Intl.Collator("zh-CN",{numeric:!0,sensitivity:"base"}),Pq="\0";function ca(e,t){return`${e}${Pq}${t}`}function Rq(e,t){return JSON.stringify([e,t])}function Oq(e){return e.contextWindow!==void 0&&e.maxOutputTokens!==void 0&&e.maxOutputTokens<=e.contextWindow}function _c(e){return e.enabled&&e.availability!=="stale"&&Oq(e)}function Ps(e){return e.enabled&&(e.authMode!=="required"||e.keySource==="credential"||e.keySource==="environment")}function rf(e,t){return e?.imageInputMode==="enabled"?!0:e?.imageInputMode==="disabled"?!1:t?t.imageInputMode==="enabled"?!0:t.imageInputMode==="disabled"?!1:e?.capabilities.inputModalities.includes("image")??!1:e?.capabilities.inputModalities.includes("image")??!1}function x2(e,t){const n=e.defaultModelId??e.model;return t.map((r,o)=>({model:r,index:o})).sort((r,o)=>{const s=r.model.id===n?0:1,l=o.model.id===n?0:1;if(s!==l)return s-l;const u=MS.compare(r.model.displayName,o.model.displayName);if(u!==0)return u;const f=MS.compare(r.model.id,o.model.id);return f!==0?f:r.index-o.index}).map(({model:r})=>r)}function ol(e){const t=e.contextWindow;return{providerId:e.id,id:e.defaultModelId??e.model,displayName:e.defaultModelId??e.model,enabled:e.enabled,availability:"manual",...t!==void 0?{contextWindow:t,contextOverride:t}:{},maxOutputTokens:e.maxOutputTokens,maxOutputOverride:e.maxOutputTokens,contextSource:t!==void 0?"legacy":"unknown",outputSource:"legacy",imageInputMode:"auto",capabilities:{streaming:!0,tools:!0,parallelToolCalls:!0,reasoningLevels:e.reasoningLevels,nativeCompaction:!1,promptCaching:!1,tokenCounting:!1,inputModalities:e.inputModalities??["text"]}}}function Cg(e,t){const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return[...n.values()]}const zq=new Intl.Collator("zh-CN",{numeric:!0,sensitivity:"base"});function NS(e){return e.enabled?e.keySource==="credential"||e.keySource==="environment"?0:e.authMode==="none"?1:e.authMode==="optional"?2:3:4}function w2(e){return e.map((t,n)=>({provider:t,index:n})).sort((t,n)=>{const r=NS(t.provider)-NS(n.provider);if(r!==0)return r;const o=zq.compare(t.provider.name,n.provider.name);return o!==0?o:t.index-n.index}).map(({provider:t})=>t)}const Ac=new Set(["off","minimal","low","medium","high","xhigh","max"]),ua="__legacy__";function Dq(e,t){return t?.capabilities.reasoningLevels.length?t.capabilities.reasoningLevels:e.reasoningLevels}function Eg(e,t,n){const r=Dq(e,t);return n&&r.includes(n)?n:r.includes(e.reasoningEffort)?e.reasoningEffort:r.includes("medium")?"medium":r[0]??"off"}function by(e,t,n){const r=Object.fromEntries(Object.entries(Ke(e)?e:{}).filter(([,o])=>typeof o=="string"&&Ac.has(o)));return t&&n&&Ac.has(n)&&r[t]===void 0&&(r[t]=n),r}function xy(e){return Object.fromEntries(Object.entries(Ke(e)?e:{}).filter(([,t])=>typeof t=="string"&&Ac.has(t)))}function wy(e){return Object.fromEntries(Object.entries(Ke(e)?e:{}).filter(t=>typeof t[1]=="string"&&t[1].length>0))}function Sy(e,t){const n=t[e.id]??[];return n.length>0?n:[ol(e)]}function Lq(e,t,n){const r=x2(e,Sy(e,t)).filter(_c);return r.find(o=>o.id===n)??r.find(o=>o.id===(e.defaultModelId??e.model))??r[0]}function oa(e,t,n,r,o,s,l,u){const f=by(l,u?.providerId,u?.reasoning),p=xy(s),m=wy(o);u?.providerId&&u.modelId&&(m[u.providerId]=u.modelId);const g=f[ua];delete f[ua];const x=w2(e).filter(M=>M.enabled),y=x.find(M=>M.id===r),w=y?m[y.id]:void 0;if(y&&w&&n[y.id]!==!0&&!Sy(y,t).some(M=>M.id===w)){const M=ca(y.id,w),R=ca(y.id,ua),z=Eg(y,void 0,p[M]??p[R]??f[y.id]??g);return delete p[R],p[M]=z,f[y.id]=z,{activeProviderId:y.id,activeModelByProviderId:m,reasoning:z,reasoningByProviderModelKey:p,reasoningByProviderId:f}}const T=(y?[y,...x.filter(M=>M.id!==y.id)]:x).flatMap(M=>{const R=Lq(M,t,m[M.id]);return R?[{provider:M,model:R}]:[]})[0];if(!T)return{activeProviderId:null,activeModelByProviderId:m,reasoning:"off",reasoningByProviderModelKey:p,reasoningByProviderId:f};const{provider:k,model:_}=T;m[k.id]=_.id;const C=ca(k.id,_.id),E=ca(k.id,ua),O=Eg(k,_,p[C]??p[E]??f[k.id]??g);return delete p[E],p[C]=O,f[k.id]=O,{activeProviderId:k.id,activeModelByProviderId:m,reasoning:O,reasoningByProviderModelKey:p,reasoningByProviderId:f}}function S2(e,t,n,r){return Object.fromEntries(e.map(o=>{const s=t?.[o.id]??[],l=r?n[o.id]??[]:[],u=Cg(l,s),f=o.defaultModelId??o.model;return u.some(p=>p.id===f)||u.push(ol(o)),[o.id,u]}))}const Bq=new Set(["reasoning","responding","tooling"]),qq=new Set(["private","public-summary"]),$q=new Set(["queued","running","waiting-approval","completed","interrupted","failed","cancelled"]);function PS(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=100?e:void 0}const _g=["inputTokens","outputTokens","cachedInputTokens","cacheWriteTokens","reasoningTokens","totalTokens"];function $f(e){const t=Ke(e)?e:{},n=Ke(t.availability)?t.availability:void 0,r=n&&_g.every(l=>typeof n[l]=="boolean")?Object.fromEntries(_g.map(l=>[l,n[l]])):void 0,o=typeof t.cachedInputTokens=="number"?Math.max(0,t.cachedInputTokens):void 0,s=(o??0)>0?"hit":r?.cachedInputTokens===!0?"miss":"unavailable";return{inputTokens:Math.max(0,dn(t.inputTokens)),outputTokens:Math.max(0,dn(t.outputTokens)),...typeof t.reasoningTokens=="number"?{reasoningTokens:Math.max(0,t.reasoningTokens)}:{},...o!==void 0?{cachedInputTokens:o}:{},...typeof t.cacheWriteTokens=="number"?{cacheWriteTokens:Math.max(0,t.cacheWriteTokens)}:{},...typeof t.totalTokens=="number"?{totalTokens:Math.max(0,t.totalTokens)}:{},...typeof t.estimated=="boolean"?{estimated:t.estimated}:{},...r?{availability:r}:{},cacheStatus:s}}function Uq(e,t){if(!e)return t;const n=(e.cachedInputTokens??0)+(t.cachedInputTokens??0),r=e.availability&&t.availability?Object.fromEntries(_g.map(o=>[o,e.availability?.[o]===!0&&t.availability?.[o]===!0])):void 0;return{inputTokens:e.inputTokens+t.inputTokens,outputTokens:e.outputTokens+t.outputTokens,...e.reasoningTokens!==void 0&&t.reasoningTokens!==void 0?{reasoningTokens:e.reasoningTokens+t.reasoningTokens}:{},...e.cachedInputTokens!==void 0||t.cachedInputTokens!==void 0?{cachedInputTokens:n}:{},...e.cacheWriteTokens!==void 0||t.cacheWriteTokens!==void 0?{cacheWriteTokens:(e.cacheWriteTokens??0)+(t.cacheWriteTokens??0)}:{},...e.totalTokens!==void 0&&t.totalTokens!==void 0?{totalTokens:e.totalTokens+t.totalTokens}:{},estimated:e.estimated===!0||t.estimated===!0,...r?{availability:r}:{},cacheStatus:n>0?"hit":r?.cachedInputTokens===!0?"miss":"unavailable"}}function Ag(e){if(!Ke(e)||typeof e.requestId!="string"||typeof e.providerProfileId!="string"||typeof e.model!="string")return;const t=e.status==="completed"||e.status==="failed"||e.status==="cancelled"||e.status==="incomplete"?e.status:"incomplete";return{requestId:e.requestId,requestIndex:Math.max(1,dn(e.requestIndex,1)),round:Math.max(0,dn(e.round)),providerProfileId:e.providerProfileId,model:e.model,...typeof e.contextWindow=="number"?{contextWindow:Math.max(1,e.contextWindow)}:{},status:t,elapsedMs:Math.max(0,dn(e.elapsedMs)),...typeof e.ttftMs=="number"?{ttftMs:Math.max(0,e.ttftMs)}:{},...typeof e.firstVisibleOutputMs=="number"?{firstVisibleOutputMs:Math.max(0,e.firstVisibleOutputMs)}:{},...typeof e.reasoningDurationMs=="number"?{reasoningDurationMs:Math.max(0,e.reasoningDurationMs)}:{},...typeof e.reasoningObserved=="boolean"?{reasoningObserved:e.reasoningObserved}:{},...typeof e.summaryAvailable=="boolean"?{summaryAvailable:e.summaryAvailable}:{},...typeof e.generationMs=="number"?{generationMs:Math.max(0,e.generationMs)}:{},retryCount:Math.max(0,dn(e.retryCount)),...Ke(e.usage)?{usage:$f(e.usage)}:{},...typeof e.outputTokensPerSecond=="number"?{outputTokensPerSecond:Math.max(0,e.outputTokensPerSecond)}:{},incomplete:e.incomplete!==!1,...typeof e.startedAt=="string"?{startedAt:e.startedAt}:{},...typeof e.completedAt=="string"?{completedAt:e.completedAt}:{}}}function Mg(e){if(!(!Ke(e)||!Ke(e.usage)))return{requestCount:Math.max(0,dn(e.requestCount)),completedRequestCount:Math.max(0,dn(e.completedRequestCount)),failedRequestCount:Math.max(0,dn(e.failedRequestCount)),llmDurationMs:Math.max(0,dn(e.llmDurationMs)),toolDurationMs:Math.max(0,dn(e.toolDurationMs)),...typeof e.averageTtftMs=="number"?{averageTtftMs:Math.max(0,e.averageTtftMs)}:{},...typeof e.outputTokensPerSecond=="number"?{outputTokensPerSecond:Math.max(0,e.outputTokensPerSecond)}:{},promptTokens:Math.max(0,dn(e.promptTokens)),...typeof e.cacheHitRate=="number"?{cacheHitRate:Math.min(1,Math.max(0,e.cacheHitRate))}:{},...e.cacheHitRateKind==="exact"||e.cacheHitRateKind==="lower-bound"?{cacheHitRateKind:e.cacheHitRateKind}:{},...typeof e.cacheMetricCoverage=="number"?{cacheMetricCoverage:Math.min(1,Math.max(0,e.cacheMetricCoverage))}:{},usage:$f(e.usage),usageAvailable:e.usageAvailable===!0,incomplete:e.incomplete===!0}}function pc(){return{requestCount:0,completedRequestCount:0,failedRequestCount:0,llmDurationMs:0,toolDurationMs:0,promptTokens:0,usage:{inputTokens:0,outputTokens:0,cacheStatus:"unavailable"},usageAvailable:!1,incomplete:!0}}function Hq(e){const t=Ke(e)?e:{},n=Mg(t.latestTurn),r=Mg(t.threadTotal)??pc(),o=Ag(t.latestUsageRequest),s=Array.isArray(t.requests)?t.requests.flatMap(l=>{const u=Ag(l);return u?[u]:[]}).sort((l,u)=>l.requestIndex-u.requestIndex):[];return{...typeof t.latestTurnId=="string"?{latestTurnId:t.latestTurnId}:{},...n?{latestTurn:n}:{},threadTotal:r,...o?{latestUsageRequest:o}:{},requests:s}}function RS(e,t){const n=e.findIndex(o=>o.requestId===t.requestId);return(n<0?[...e,t]:e.map((o,s)=>s===n?t:o)).sort((o,s)=>o.requestIndex-s.requestIndex)}function OS(e){if(!Ke(e)||typeof e.id!="string")return;const t=typeof e.status=="string"&&$q.has(e.status)?e.status:"running",n=typeof e.reasoningEffort=="string"&&Ac.has(e.reasoningEffort)?e.reasoningEffort:"off",r=Ke(e.usage)?"totalTokens"in e.usage?$f(e.usage):{inputTokens:dn(e.usage.inputTokens),outputTokens:dn(e.usage.outputTokens),...typeof e.usage.reasoningTokens=="number"?{reasoningTokens:e.usage.reasoningTokens}:{},...typeof e.usage.cachedInputTokens=="number"?{cachedInputTokens:e.usage.cachedInputTokens}:{}}:void 0,o=Ke(e.error)?e.error:void 0,s=Ke(e.queue)&&typeof e.queue.position=="number"&&(e.queue.reason==="workspace-busy"||e.queue.reason==="concurrency-limit")?{position:e.queue.position,reason:e.queue.reason}:void 0,l=o&&typeof o.code=="string"&&typeof o.message=="string"&&typeof o.retryable=="boolean"?{code:o.code,message:o.message,retryable:o.retryable}:void 0;return{id:e.id,status:t,...s?{queue:s}:{},...typeof e.providerProfileId=="string"?{providerProfileId:e.providerProfileId}:{},...e.providerKind==="openai"||e.providerKind==="anthropic"||e.providerKind==="gemini"||e.providerKind==="openai-compatible"?{providerKind:e.providerKind}:{},...typeof e.model=="string"?{model:e.model}:{},...typeof e.contextWindow=="number"?{contextWindow:e.contextWindow}:{},...typeof e.maxOutputTokens=="number"?{maxOutputTokens:e.maxOutputTokens}:{},reasoningEffort:n,...l?{error:l}:{},createdAt:St(e.createdAt,new Date().toISOString()),...typeof e.startedAt=="string"?{startedAt:e.startedAt}:{},...typeof e.completedAt=="string"?{completedAt:e.completedAt}:{},...r?{usage:r}:{},...typeof e.providerRetryCount=="number"&&Number.isSafeInteger(e.providerRetryCount)&&e.providerRetryCount>=0?{providerRetryCount:e.providerRetryCount}:{}}}function Ng(e,t){const n=e??[],r=n.findIndex(o=>o.id===t.id);return r<0?[...n,t]:n.map((o,s)=>s===r?{...o,...t}:o)}function Pg(e){const t={...e};return delete t.providerPhase,delete t.providerPhaseVisibility,delete t.providerPhaseStartedAt,t}function k2(e,t){const n=Pg(e);if(e.providerPhase!=="reasoning"||!e.providerPhaseStartedAt)return n;const r=Date.parse(e.providerPhaseStartedAt),o=Date.parse(t);return!Number.isFinite(r)||!Number.isFinite(o)||o<r?n:{...n,reasoningDurationMs:(e.reasoningDurationMs??0)+(o-r)}}function Fq(e,t){const n={...k2(e,t),providerRetrying:!1};return delete n.postTurnStatus,n}function Cn(e,t,n){return e.map(r=>r.id===t?n(r):r)}function Mc(e,t){const n=(e?.mode?.revision??-1)>(t.mode?.revision??-1)?e?.mode:t.mode;return n?{mode:n}:{}}function Nc(e,t){const n=t.titleUpdatedAt??t.updatedAt,r=e?.titleUpdatedAt??"",o=e&&r>n;return{title:o?e.title:t.title,titleUpdatedAt:o?r:n,updatedAt:e&&e.updatedAt>t.updatedAt?e.updatedAt:t.updatedAt}}function Kc(e){return[...e].sort((t,n)=>{const r=(n.createdAt??n.updatedAt).localeCompare(t.createdAt??t.updatedAt);return r!==0?r:n.id.localeCompare(t.id)})}function I2(e){let t=!1;const n=e.map(r=>r.turns?.some(o=>o.postTurnStatus!==void 0)?(t=!0,{...r,turns:r.turns.map(o=>{if(o.postTurnStatus===void 0)return o;const s={...o};return delete s.postTurnStatus,s})}):r);return t?n:e}function zS(...e){return e.flat().reduce((t,n)=>{if(n.type!=="error"||!n.turnId)return ko(t,n);const r=n.id.startsWith("turn-error:"),o=t.some(l=>l.type==="error"&&l.turnId===n.turnId&&!l.id.startsWith("turn-error:"));if(r&&o)return t;const s=r?t:t.filter(l=>!(l.type==="error"&&l.turnId===n.turnId&&l.id.startsWith("turn-error:")));return ko(s,n)},[])}function DS(...e){const t=e.flatMap(n=>n??[]).reduce((n,r)=>Ng(n,r),[]);return t.length>0?t:void 0}function Pc(e,t){const n=e.threadsByProjectId[t.projectId]??(e.activeProjectId===t.projectId?e.threads:[]),r=n.some(o=>o.id===t.id)?n.map(o=>o.id===t.id?t:o):Kc([...n,t]);return{threadDetailsById:{...e.threadDetailsById,[t.id]:t},threadsByProjectId:{...e.threadsByProjectId,[t.projectId]:r},...e.activeProjectId===t.projectId||e.threads.some(o=>o.id===t.id)?{threads:e.threads.some(o=>o.id===t.id)?e.threads.map(o=>o.id===t.id?t:o):r}:{}}}function T2(e,t){const n={...e.fileTreeByProjectId},r={...e.openFilesByProjectId},o={...e.workspaceTabByProjectId},s={...e.previewRevisionsByProjectId};delete n[t],delete r[t],delete o[t],delete s[t];const l=new Set(Object.values(e.threadDetailsById).filter(f=>f.projectId===t).map(f=>f.id)),u={...e.pendingTransientEventsByThreadId};for(const f of l)delete u[f];return{fileTreeByProjectId:n,openFilesByProjectId:r,workspaceTabByProjectId:o,previewRevisionsByProjectId:s,pendingTransientEventsByThreadId:u,historyAccessOrder:e.historyAccessOrder.filter(f=>!l.has(f)),pendingThreadEvents:e.pendingThreadEvents.filter(f=>!f.threadId||!l.has(f.threadId))}}function ti(e,t){const n=e.threadDetailsById[t]??e.threads.find(r=>r.id===t);if(n)return n;for(const r of Object.values(e.threadsByProjectId)){const o=r.find(s=>s.id===t);if(o)return o}}function j2(e){return Object.fromEntries(Object.entries(Ke(e)?e:{}).flatMap(([t,n])=>{if(!Array.isArray(n))return[];const r=[...new Set(n.filter(o=>typeof o=="string"&&o.length>0&&o.length<=2048))].slice(0,2e3);return r.length>0?[[t,r]]:[]}))}function Vq(e,t,n){if(t.threadId){if(t.type==="item.started"){const r=Im(t.payload.item);return r?{...n,threads:Cn(e.threads,t.threadId,o=>({...o,items:ko(o.items,r),updatedAt:t.timestamp}))}:n}if(t.type==="item.delta"||t.type==="reasoning.summary.delta"||t.type==="reasoning.content.delta")return{...n,threads:Cn(e.threads,t.threadId,r=>({...r,items:bq(r.items,t),...(t.type==="reasoning.summary.delta"||t.type==="reasoning.content.delta")&&t.turnId&&r.turns?{turns:r.turns.map(o=>o.id===t.turnId?{...o,reasoningObserved:!0,...t.type==="reasoning.summary.delta"?{reasoningSummaryAvailable:!0}:{}}:o)}:{},updatedAt:t.timestamp}))};if(t.type==="approval.requested"){const r=t.payload.item??t.payload.approval,o=Ke(r)&&"toolName"in r&&"allowedDecisions"in r?Tg(r):Im(r);return o?{...n,threads:Cn(e.threads,t.threadId,s=>({...s,activeTurnStatus:"waiting-approval",items:ko(s.items,o)}))}:n}if(t.type==="approval.resolved"){const r=t.payload.approval;if(!Ke(r)||typeof r.id!="string")return n;const o=Tg(r);return o.resolutionSource==="full-access"?{...n,threads:Cn(e.threads,t.threadId,s=>({...s,activeTurnStatus:"running",items:s.items.map(l=>l.type==="tool"&&l.toolCallId===o.toolCallId?{...l,approvalSource:"full-access"}:l),updatedAt:t.timestamp}))}:{...n,threads:Cn(e.threads,t.threadId,s=>({...s,activeTurnStatus:"running",items:ko(s.items,o),updatedAt:t.timestamp}))}}if(t.type==="item.completed"){const r=Im(t.payload.item);return{...n,threads:Cn(e.threads,t.threadId,o=>({...o,items:(()=>{if(r){const s=r.type==="error"&&r.turnId?o.items.filter(u=>!(u.type==="error"&&u.turnId===r.turnId&&u.id.startsWith("turn-error:"))):o.items,l=ko(s,r);return r.type==="message"&&r.role==="assistant"&&r.content.length===0&&(r.finishReason==="error"||r.finishReason==="cancelled")?l.filter(u=>u.id!==r.id):l}return o.items.map(s=>s.id!==t.itemId?s:s.type==="message"||s.type==="reasoning"?{...s,streaming:!1}:s.type==="tool"?{...s,state:"completed"}:s)})()}))}}}}function Zq(e,t,n){if(t.type==="project.changed"){const r=t.payload.project,o=St(t.payload.change),s=St(t.payload.projectId);if(o==="removed"&&s){const l={...e.expandedPathsByProjectId},u={...e.previewSessionsByProjectId},f={...e.frontendCompileStatesByProjectId};delete l[s],delete u[s],delete f[s];const p={...e.threadsByProjectId},m=p[s]??[];delete p[s];const g={...e.threadDetailsById},x={...e.historyByThreadId},y={...e.lastThreadIdByProject};delete y[s];for(const C of m)delete g[C.id],delete x[C.id];const w=e.projects.filter(C=>C.id!==s),S=e.activeProjectId===s,T=S?w[0]?.id??null:e.activeProjectId,k=S?T?p[T]??[]:[]:e.threads,_=S?k.some(C=>C.id===e.lastThreadIdByProject[T??""])?e.lastThreadIdByProject[T??""]??null:k[0]?.id??null:e.activeThreadId;return{...n,...T2(e,s),projects:w,activeProjectId:T,threads:k,activeThreadId:_,lastThreadIdByProject:y,threadsByProjectId:p,threadDetailsById:g,historyByThreadId:x,expandedPathsByProjectId:l,previewSessionsByProjectId:u,frontendCompileStatesByProjectId:f,...S?{fileTree:[],openFiles:[],activeWorkspaceTab:"assistant"}:{}}}if(Ke(r)&&typeof r.id=="string"){const l=Ec(r);return{...n,projects:[l,...e.projects.filter(u=>u.id!==l.id)]}}return n}if(t.type==="thread.changed"){const r=St(t.payload.projectId),o=St(t.payload.change);if(!r||!t.threadId)return n;const s=e.threadTombstonesById[t.threadId];if(s&&t.seq<=s.seq)return n;const l={...e.threadTombstonesById},u={...e.threadsByProjectId},f={...e.threadDetailsById},p={...e.historyByThreadId};let m=[...u[r]??(e.activeProjectId===r?e.threads:[])];if(o==="deleted"||o==="archived")l[t.threadId]={projectId:r,seq:t.seq},m=m.filter(y=>y.id!==t.threadId),delete f[t.threadId],delete p[t.threadId];else if(Ke(t.payload.thread)){delete l[t.threadId];const y=Rr(t.payload.thread),w=f[y.id]??m.find(T=>T.id===y.id),S=w?o==="renamed"?{...w,...Nc(w,y)}:o==="mode-updated"?{...w,...Mc(w,y)}:{...w,...y,...Mc(w,y),...Nc(w,y),items:w.items,...w.turns?{turns:w.turns}:{},...w.metrics?{metrics:w.metrics}:{}}:y;o==="execution-updated"&&(y.activeTurnId||delete S.activeTurnId,y.activeTurnStatus||delete S.activeTurnStatus,y.queue||delete S.queue,!y.activeTurnStatus&&(w?.status==="failed"||w?.status==="interrupted")&&(S.status=w.status)),S.lastSeq=Math.max(w?.lastSeq??0,y.lastSeq??0,t.seq),m=Kc([S,...m.filter(T=>T.id!==y.id)]),f[S.id]=S}u[r]=m;const g={...e.lastThreadIdByProject};if((o==="deleted"||o==="archived")&&g[r]===t.threadId&&(m[0]?g[r]=m[0].id:delete g[r]),e.activeProjectId!==r)return{...n,threadsByProjectId:u,threadDetailsById:f,threadTombstonesById:l,historyByThreadId:p,lastThreadIdByProject:g};const x=e.activeThreadId===null||m.some(y=>y.id===e.activeThreadId)?e.activeThreadId:m[0]?.id??null;return x?g[r]=x:delete g[r],{...n,threads:m,activeThreadId:x,threadsByProjectId:u,threadDetailsById:f,threadTombstonesById:l,historyByThreadId:p,lastThreadIdByProject:g}}}function Kq(e,t,n){if(t.threadId){if(t.type==="provider.request.started"){if(!t.turnId)return n;const r=St(t.payload.requestId),o=St(t.payload.providerProfileId),s=St(t.payload.model);if(!r||!o||!s)return n;const l={requestId:r,requestIndex:Math.max(1,dn(t.payload.requestIndex,1)),round:Math.max(0,dn(t.payload.round)),providerProfileId:o,model:s,...typeof t.payload.contextWindow=="number"?{contextWindow:Math.max(1,t.payload.contextWindow)}:{},status:"running",elapsedMs:0,retryCount:0,incomplete:!0,startedAt:t.timestamp};return{...n,threads:Cn(e.threads,t.threadId,u=>{const f=u.metrics?.latestTurnId===t.turnId;return{...u,...u.turns?{turns:u.turns.map(p=>p.id===t.turnId?Pg(p):p)}:{},metrics:{latestTurnId:t.turnId,...f&&u.metrics?.latestTurn?{latestTurn:u.metrics.latestTurn}:{},threadTotal:u.metrics?.threadTotal??pc(),...u.metrics?.latestUsageRequest?{latestUsageRequest:u.metrics.latestUsageRequest}:{},requests:RS(f?u.metrics?.requests??[]:[],l)},updatedAt:t.timestamp}})}}if(t.type==="provider.request.phase.changed"){if(!t.turnId)return n;const r=t.payload.phase,o=t.payload.visibility;return typeof r!="string"||!Bq.has(r)||typeof o!="string"||!qq.has(o)?n:{...n,threads:Cn(e.threads,t.threadId,s=>({...s,...r!=="reasoning"?{items:s.items.map(l=>l.type==="reasoning"&&l.streaming&&(!l.turnId||l.turnId===t.turnId)?{...l,streaming:!1}:l)}:{},turns:(s.turns??[]).map(l=>{if(l.id!==t.turnId)return l;const u=r,f=o,p=l.providerPhase==="reasoning"&&l.providerPhaseStartedAt?Date.parse(l.providerPhaseStartedAt):Number.NaN,m=Date.parse(t.timestamp),g=l.providerPhase==="reasoning"&&u!=="reasoning"&&Number.isFinite(p)&&Number.isFinite(m)&&m>=p?(l.reasoningDurationMs??0)+(m-p):l.reasoningDurationMs;return{...Pg(l),providerPhase:u,providerPhaseVisibility:f,...u==="reasoning"?{providerPhaseStartedAt:l.providerPhase==="reasoning"?l.providerPhaseStartedAt??t.timestamp:t.timestamp}:{},...u==="reasoning"||l.reasoningObserved===!0?{reasoningObserved:!0}:{},...g!==void 0?{reasoningDurationMs:g}:{},...f==="public-summary"||l.reasoningSummaryAvailable===!0?{reasoningSummaryAvailable:!0}:{}}}),updatedAt:t.timestamp}))}}if(t.type==="provider.request.completed"){if(!t.turnId)return n;const r=Ag(t.payload.metrics),o=Mg(t.payload.turnMetrics);return!r||!o?n:{...n,threads:Cn(e.threads,t.threadId,s=>{const u=s.metrics?.latestTurnId===t.turnId?s.metrics?.requests??[]:[],f=RS(u,r),p=f.some(y=>y.reasoningObserved===!0),m=f.reduce((y,w)=>y+(w.reasoningDurationMs??0),0),g=f.some(y=>y.summaryAvailable===!0),x=s.metrics?.threadTotal.usageAvailable===!0?{...s.metrics.threadTotal}:{...o};if(s.metrics){const y=u.find(w=>w.requestId===r.requestId)?.elapsedMs??0;x.llmDurationMs=Math.max(0,s.metrics.threadTotal.llmDurationMs+r.elapsedMs-y)}return{...s,...o.usageAvailable?{usage:o.usage}:{},...s.turns?{turns:s.turns.map(y=>{if(y.id!==t.turnId)return y;const w=k2(y,t.timestamp);return{...w,...p||w.reasoningObserved===!0?{reasoningObserved:!0}:{},...m>0?{reasoningDurationMs:m}:{},...g||w.reasoningSummaryAvailable===!0?{reasoningSummaryAvailable:!0}:{}}})}:{},metrics:{latestTurnId:t.turnId,latestTurn:o,threadTotal:x,...r.usage?{latestUsageRequest:r}:s.metrics?.latestUsageRequest?{latestUsageRequest:s.metrics.latestUsageRequest}:{},requests:f},updatedAt:t.timestamp}})}}if(t.type==="provider.request.retrying"||t.type==="provider.request.recovered"){if(!t.turnId)return n;const r=PS(t.payload.totalRetryCount)??PS(t.payload.retryCount)??0,o=t.type==="provider.request.retrying";return{...n,threads:Cn(e.threads,t.threadId,s=>({...s,turns:(s.turns??[]).map(l=>l.id!==t.turnId?l:o?{...l,providerRetrying:!0,providerRetryAttempt:Math.max(1,r)}:{...l,providerRetrying:!1,providerRetryCount:Math.max(l.providerRetryCount??0,r)}),updatedAt:t.timestamp}))}}if(t.type==="usage.updated"){const r=Ke(t.payload.usage)?t.payload.usage:t.payload,o=$f(r);return{...n,threads:Cn(e.threads,t.threadId,s=>{const l=t.turnId?s.turns?.find(k=>k.id===t.turnId)?.usage:void 0,u=t.payload.cumulative===!0?o:Uq(l,o),f=u.inputTokens+(u.cachedInputTokens??0)+(u.cacheWriteTokens??0),p=u.availability?.cachedInputTokens===!0,m=s.metrics,x=(m&&m.latestTurnId===t.turnId?m:void 0)??{...t.turnId?{latestTurnId:t.turnId}:{},threadTotal:m?.threadTotal??pc(),...m?.latestUsageRequest?{latestUsageRequest:m.latestUsageRequest}:{},requests:[]},y=x.latestTurn??pc(),{cacheHitRate:w,...S}=y,T={...S,promptTokens:f,usage:u,usageAvailable:!0,incomplete:!0,...p&&f>0?{cacheHitRate:(u.cachedInputTokens??0)/f}:{}};return{...s,usage:u,metrics:{...x,latestTurn:T},...t.turnId?{turns:(s.turns??[]).map(k=>k.id===t.turnId?{...k,usage:u}:k)}:{}}})}}}}function Qq(e,t,n){if(t.threadId){if(t.type==="assistant.mode.validation"){if(!t.threadId||!t.turnId)return n;const r=St(t.payload.projectId),o=St(t.payload.status);if(!r||!["running","passed","failed"].includes(o))return n;const s=e.threads.find(u=>u.id===t.threadId&&u.projectId===r);if(!s||!s.turns?.some(u=>u.id===t.turnId))return n;const l=Cn(e.threads,t.threadId,u=>({...u,turns:(u.turns??[]).map(f=>{if(f.id!==t.turnId)return f;if(o==="running")return{...f,postTurnStatus:"validating"};const p={...f};return delete p.postTurnStatus,p})}));return{...n,threads:l}}if(t.type==="approval.mode.changed"){const r=t.payload.mode;return r!=="prompt"&&r!=="full-access"?n:{...n,threads:Cn(e.threads,t.threadId,o=>({...o,approvalMode:r,...typeof t.payload.changedAt=="string"?{approvalModeChangedAt:t.payload.changedAt}:{},updatedAt:t.timestamp}))}}if(t.type==="turn.started"){const r=OS(t.payload.turn);return{...n,threads:Cn(e.threads,t.threadId,o=>{const{usage:s,metrics:l,...u}=o,f=r?.id??t.turnId;return{...u,status:"running",activeTurnStatus:r?.status==="queued"?"queued":"running",updatedAt:t.timestamp,metrics:{...f?{latestTurnId:f}:{},threadTotal:l?.threadTotal??pc(),...l?.latestUsageRequest?{latestUsageRequest:l.latestUsageRequest}:{},requests:[]},...r?{activeTurnId:r.id,turns:Ng(o.turns,r)}:{}}})}}if(t.type==="turn.completed"){const r=Ke(t.payload.turn)?t.payload.turn:null,o=OS(r),s=t.turnId??o?.id,l=St(r?.status??t.payload.status,"completed"),u=l==="failed"?"failed":l==="interrupted"?"interrupted":"idle",f=Ke(r?.error)?r.error:null,p=St(f?.message??t.payload.error);return{...n,threads:Cn(e.threads,t.threadId,m=>{let g=m.items.map(_=>_.type==="tool"&&(_.state==="queued"||_.state==="running"||_.state==="awaiting_approval")&&(!_.turnId||_.turnId===s)?{..._,state:l==="failed"?"failed":l==="interrupted"||l==="cancelled"?"cancelled":"completed",completedAt:_.completedAt??t.timestamp,...u==="failed"&&p&&_.output===void 0?{output:p}:{}}:_.type==="reasoning"&&_.streaming&&(!_.turnId||_.turnId===s)?{..._,streaming:!1}:_.type!=="message"||_.role!=="assistant"||!_.streaming||_.turnId&&_.turnId!==s?_:{..._,streaming:!1,finishReason:l==="interrupted"||l==="cancelled"?"cancelled":l==="failed"?"error":"stop"}).filter(_=>!(_.type==="message"&&_.role==="assistant"&&_.content.length===0&&!_.streaming&&(_.finishReason==="error"||_.finishReason==="cancelled")));u==="failed"&&p&&!g.some(_=>_.type==="error"&&_.turnId===s)&&(g=[...g,{id:`turn-error:${s??t.eventId}`,type:"error",...s?{turnId:s}:{},code:St(f?.code,"turn_failed"),message:p,recoverable:f?.retryable===!0,createdAt:t.timestamp}]);const y=(o?Ng(m.turns,o):t.turnId?(m.turns??[]).map(_=>_.id!==t.turnId?_:{..._,status:l==="failed"?"failed":l==="interrupted"?"interrupted":l==="cancelled"?"cancelled":"completed",completedAt:t.timestamp}):m.turns)?.map(_=>_.id===s?Fq(_,t.timestamp):_),{activeTurnStatus:w,activeTurnId:S,queue:T,...k}=m;return{...k,items:g,status:u,updatedAt:t.timestamp,...y?{turns:y}:{}}})}}}}function Uf(e,t){return e?t.sourceRevision!==e.sourceRevision?t.sourceRevision>e.sourceRevision?t:e:t.diagnosticsRevision!==e.diagnosticsRevision?t.diagnosticsRevision>e.diagnosticsRevision?t:e:t.updatedAt>=e.updatedAt?t:e:t}function ky(e,t,n,r){const o=e.supportsProjectPreviewPool?e.previewRevisionsByProjectId[t]??-1:e.previewRevision;if(!Number.isSafeInteger(r)||r<0||r<o||n&&(n.projectId!==t||n.revision!==r))return{};const s={...e.previewSessionsByProjectId},l=!e.supportsProjectPreviewPool&&r>o?{}:{...e.frontendCompileStatesByProjectId};return n?s[t]=n:delete s[t],n?.compileState?l[t]=r>o?n.compileState:Uf(l[t],n.compileState):(!n||r>o)&&delete l[t],{previewRevision:Math.max(e.previewRevision,r),previewRevisionsByProjectId:{...e.previewRevisionsByProjectId,[t]:r},previewSessionsByProjectId:s,frontendCompileStatesByProjectId:l}}function Gq(e,t,n){if(t.type==="settings.changed"){const r=gy(t.payload.settings);return r&&r.revision>=(e.appSettings?.revision??-1)?{...n,appSettings:r}:n}if(t.type==="preview.changed"){const r=St(t.payload.projectId);if(!r)return n;const o=t.payload.session===null?null:il(t.payload.session);if(t.payload.session!==null&&(!o||o.projectId!==r))return n;const s=dn(t.payload.revision,o?.revision??0);return{...n,...ky(e,r,o??null,s)}}if(t.type==="frontend.compile.changed"){const r=St(t.payload.projectId),o=g2(t.payload.state),s=dn(t.payload.previewRevision,-1),l=r?e.previewSessionsByProjectId[r]:void 0;return!r||!o||!Number.isSafeInteger(s)||s!==(e.supportsProjectPreviewPool?e.previewRevisionsByProjectId[r]:e.previewRevision)||l?.revision!==s?n:{...n,frontendCompileStatesByProjectId:{...e.frontendCompileStatesByProjectId,[r]:Uf(e.frontendCompileStatesByProjectId[r],o)}}}if(t.type==="log.created"){const r=t.payload.log;return Ke(r)&&typeof r.id=="string"?{...n,logs:[p2(r),...e.logs].slice(0,1e3)}:n}if(t.type==="plugin.changed"){const r=t.payload.plugin;if(Ke(r)&&typeof r.id=="string"){const o=jg(r);return{...n,plugins:[...e.plugins.filter(s=>s.id!==o.id),o]}}return n}}const LS=1e4;function Yq(e,t){const n=[...e.seenEventIds,t.eventId].slice(-1e4);return{lastSeq:Math.max(e.lastSeq,t.seq),seenEventIds:n,lastThreadEventSeq:t.threadId?{...e.lastThreadEventSeq,[t.threadId]:Math.max(e.lastThreadEventSeq[t.threadId]??0,t.seq)}:e.lastThreadEventSeq}}function of(e){return e.transient===!0||e.type==="reasoning.content.delta"||e.type==="assistant.mode.validation"||e.type==="frontend.compile.changed"}function Wq(e,t){return{seenEventIds:[...e.seenEventIds,t.eventId].slice(-1e4)}}function pa(e,t){if(!t.threadId||t.type==="thread.changed"||t.type==="project.changed")return BS(e,t);const n=ti(e,t.threadId);if(!n)return{};const{threads:r,...o}=BS({...e,threads:[n]},t),s=r?.[0];return s&&s!==n?{...o,...Pc(e,of(t)?s:{...s,lastSeq:Math.max(n.lastSeq??0,t.seq)})}:o}function Rc(e,t){return{...e,status:e?.status??"idle",itemsHasMore:e?.itemsHasMore??!1,dirty:!0,dirtySinceSeq:Math.max(e?.dirtySinceSeq??0,t)}}function Xq(e,t){const n=[...e.pendingThreadEvents,t],r=n.slice(0,Math.max(0,n.length-LS)),o={...e.historyByThreadId};t.threadId&&!ti(e,t.threadId)&&(o[t.threadId]=Rc(o[t.threadId],t.seq));for(const s of r)s.threadId&&(o[s.threadId]=Rc(o[s.threadId],s.seq));return{pendingThreadEvents:n.slice(-LS),historyByThreadId:o}}function Jq(e,t){if(!t.threadId)return{};const n=[...e.pendingTransientEventsByThreadId[t.threadId]??[]],r=n.at(-1);t.type==="reasoning.content.delta"&&r?.type===t.type&&r.itemId===t.itemId&&r.turnId===t.turnId?n[n.length-1]={...t,payload:{...t.payload,delta:`${St(r.payload.delta)}${St(t.payload.delta)}`.slice(-32*1024)}}:n.push(t);let o=32*1024;const s=n.slice(-32).reverse().map(u=>{if(u.type!=="reasoning.content.delta")return u;const f=St(u.payload.delta).slice(-o),p={...u,payload:{...u.payload,delta:o>0?f:""}};return o=Math.max(0,o-f.length),p}).reverse(),l={...e.pendingTransientEventsByThreadId};delete l[t.threadId],l[t.threadId]=s;for(const u of Object.keys(l).slice(0,-16))delete l[u];return{pendingTransientEventsByThreadId:l}}function Iy(e,t){let n=e;const r={...e.pendingTransientEventsByThreadId};for(const o of t){const s=ti(n,o);if(!(!s||!r[o])){for(const l of r[o]){const u=s.turns?.find(f=>f.id===l.turnId);l.type==="reasoning.content.delta"&&(s.status!=="running"||u&&!["queued","running","waiting-approval"].includes(u.status))||(n={...n,...pa(n,l)})}delete r[o]}}return{...n===e?{}:{threads:n.threads,threadsByProjectId:n.threadsByProjectId,threadDetailsById:n.threadDetailsById},pendingTransientEventsByThreadId:r}}function af(e,t){const n=t?[...e.historyAccessOrder.filter(s=>s!==t),t]:e.historyAccessOrder,r=n.filter(s=>{const l=ti(e,s);return s!==e.activeThreadId&&l&&l.status!=="running"&&!l.turns?.some(u=>u.postTurnStatus==="validating")&&e.historyByThreadId[s]?.status==="ready"});let o=e;for(const s of r.slice(0,Math.max(0,r.length-10))){const l=ti(o,s),{turns:u,metrics:f,...p}=l;o={...o,...Pc(o,{...p,items:[]}),historyByThreadId:{...o.historyByThreadId,[s]:{status:"idle",itemsHasMore:!1,dirty:!0}}}}return{...o===e?{}:{threads:o.threads,threadsByProjectId:o.threadsByProjectId,threadDetailsById:o.threadDetailsById,historyByThreadId:o.historyByThreadId},historyAccessOrder:n}}function e$(e,t,n){if(e.seenEventIds.includes(t.eventId))return of(t)?{}:{lastSeq:Math.max(e.lastSeq,t.seq)};if(of(t))return{...t.threadId&&!ti(e,t.threadId)?Jq(e,t):pa(e,t),...Wq(e,t)};const r=Yq(e,t);if(t.threadId&&t.type!=="thread.changed"){const s=e.historyByThreadId[t.threadId],l=s?.snapshotSeq??-1;if(t.seq<=l)return r;const u=ti(e,t.threadId);if(!u&&(t.type==="item.delta"||t.type==="reasoning.summary.delta"))return{...r,historyByThreadId:{...e.historyByThreadId,[t.threadId]:Rc(s,t.seq)}};if(s?.status==="loading"||!u)return{...r,...t.type==="turn.started"||t.type==="turn.completed"||t.type==="approval.requested"||t.type==="approval.resolved"?pa(e,t):{},...Xq(e,t)}}t.type==="file.changed"&&typeof t.payload.projectId=="string"&&n.push({type:"annotations-stale",projectId:t.payload.projectId,...typeof t.payload.path=="string"?{path:t.payload.path}:{}});let o={...pa(e,t),...r};return t.type==="thread.changed"&&t.threadId&&e.pendingTransientEventsByThreadId[t.threadId]&&(o={...o,...Iy({...e,...o},[t.threadId])}),t.threadId&&!e.historyByThreadId[t.threadId]&&t.type!=="thread.changed"?{...o,historyByThreadId:{...e.historyByThreadId,[t.threadId]:Rc(void 0,t.seq)}}:t.type==="turn.completed"?{...o,...af({...e,...o})}:o}function BS(e,t){const n=of(t)?{}:{lastSeq:Math.max(e.lastSeq,t.seq)};return Zq(e,t,n)??Gq(e,t,n)??Qq(e,t,n)??Kq(e,t,n)??Vq(e,t,n)??n}function qS(e,t){const n=[];return{patch:e$(e,t,n),effects:n}}function t$(e,t){const n=typeof t.sessionId=="string"&&t.sessionId!==e.hostSessionId,r=n?[{type:"all-annotations-stale"}]:[],o=t.activeProjectId??e.activeProjectId,s=t.projects.some(z=>z.id===o)?o:t.projects[0]?.id??null,l=!e.offlinePreview&&s===e.activeProjectId,u=l&&s!==null&&e.threadsByProjectId[s]!==void 0,f=n?{}:{...e.threadsByProjectId},p=n?{}:{...e.threadDetailsById},m=Kc(t.threads.filter(z=>z.projectId===s));if(s&&m.length>0){f[s]=m;for(const z of m)p[z.id]=z}const g=l&&(u||e.threads.length>0)?e.threads:s?f[s]??[]:[],x=n?I2(g):g;s&&(u||x.length>0)&&(f[s]=x);const y=t.activeThreadId??(s?e.lastThreadIdByProject[s]:void 0),w=l&&e.activeThreadId&&x.some(z=>z.id===e.activeThreadId)?e.activeThreadId:x.some(z=>z.id===y)?y??null:u&&e.activeThreadId===null?null:x[0]?.id??null,S=S2(t.providers,t.modelsByProviderId,e.modelsByProviderId,!e.offlinePreview),T=Object.fromEntries(t.providers.map(z=>[z.id,!e.offlinePreview&&e.modelCatalogLoadedByProviderId[z.id]===!0])),k=n?t.appSettings??null:t.appSettings&&t.appSettings.revision>=(e.appSettings?.revision??-1)?t.appSettings:e.appSettings,_=t.previewRevision??t.previewSession?.revision??0,C=n||_>=e.previewRevision,E=t.previewSession?.compileState,O=n?E&&t.previewSession?{[t.previewSession.projectId]:E}:{}:C&&t.previewSession&&E?_>e.previewRevision?{[t.previewSession.projectId]:E}:{...e.frontendCompileStatesByProjectId,[t.previewSession.projectId]:Uf(e.frontendCompileStatesByProjectId[t.previewSession.projectId],E)}:C&&(!t.previewSession||_>e.previewRevision)?{}:e.frontendCompileStatesByProjectId,M=t.capabilities?.supportsProjectPreviewPool===!0;let R={supportsProjectPreviewPool:M,...n?{previewRevisionsByProjectId:{}}:{}};if(M){let z={...e,supportsProjectPreviewPool:M,...n?{previewRevision:0,previewSessionsByProjectId:{},previewRevisionsByProjectId:{},frontendCompileStatesByProjectId:{}}:{}};const K=t.previewSessions??(t.previewSession?[t.previewSession]:[]),q=new Map(K.map(Y=>[Y.projectId,Y])),Z={...Object.fromEntries(K.map(Y=>[Y.projectId,Y.revision])),...t.previewRevisions};for(const[Y,ae]of Object.entries(Z))z={...z,...ky(z,Y,q.get(Y)??null,ae)};R={supportsProjectPreviewPool:M,previewRevision:z.previewRevision,previewRevisionsByProjectId:z.previewRevisionsByProjectId,previewSessionsByProjectId:z.previewSessionsByProjectId,frontendCompileStatesByProjectId:z.frontendCompileStatesByProjectId}}return{effects:r,patch:{offlinePreview:!1,projects:t.projects,activeProjectId:s,threads:x,threadsByProjectId:f,threadDetailsById:{...p,...Object.fromEntries(x.map(z=>[z.id,z]))},activeThreadId:w,providers:t.providers,providerPresets:t.providerPresets??e.providerPresets,modelsByProviderId:S,modelCatalogLoadedByProviderId:T,...oa(t.providers,S,T,e.activeProviderId,e.activeModelByProviderId,e.reasoningByProviderModelKey,e.reasoningByProviderId,{providerId:e.activeProviderId,...e.activeProviderId&&e.activeModelByProviderId[e.activeProviderId]?{modelId:e.activeModelByProviderId[e.activeProviderId]}:{},reasoning:e.reasoning}),plugins:t.plugins,logs:[],fileTree:l?e.fileTree:[],openFiles:l?e.openFiles:[],activeWorkspaceTab:l?e.activeWorkspaceTab:"assistant",appSettings:k,hostSessionId:t.sessionId??e.hostSessionId,previewRevision:C?_:e.previewRevision,previewSessionsByProjectId:C?t.previewSession?{[t.previewSession.projectId]:t.previewSession}:{}:e.previewSessionsByProjectId,frontendCompileStatesByProjectId:O,...R,supportsTurnQueue:t.capabilities?.supportsTurnQueue===!0,supportsDocumentAnnotations:t.capabilities?.supportsDocumentAnnotations===!0,supportsDocumentSuggestions:t.capabilities?.supportsDocumentSuggestions===!0,lastSeq:n?t.lastSeq:Math.max(e.lastSeq,t.lastSeq),...n?{threadTombstonesById:{},historyByThreadId:{},seenEventIds:[],lastThreadEventSeq:{},pendingThreadEvents:[],pendingTransientEventsByThreadId:{},historyAccessOrder:[]}:{}}}}function n$(e,t,n,r){const o=new Map((e.threadsByProjectId[t]??[]).map(E=>[E.id,e.threadDetailsById[E.id]??E]));if(e.activeProjectId===t)for(const E of e.threads)o.set(E.id,E);const s={...e.threadTombstonesById},l=n.filter(E=>{const O=s[E.id];return O?(E.lastSeq??-1)<=O.seq?!1:(delete s[E.id],!0):!0}),u=new Set(l.map(E=>E.id)),f=new Set(r?.knownThreadIds),p=r?[...o.values()].filter(E=>!u.has(E.id)&&!s[E.id]&&(!f.has(E.id)||Math.max(E.lastSeq??-1,e.lastThreadEventSeq[E.id]??-1)>r.startedAtSeq)):[],m=Kc([...l.map(E=>{const O=o.get(E.id);if(!O)return E;const M=Math.max(O.lastSeq??-1,e.lastThreadEventSeq[E.id]??-1),z=(E.lastSeq!==void 0&&M>=0?E.lastSeq>M:E.updatedAt>O.updatedAt)?E:O,{activeTurnId:K,activeTurnStatus:q,queue:Z,...Y}=E;return{...Y,...Mc(O,E),...Nc(O,E),status:z.status,...z.lastSeq!==void 0?{lastSeq:z.lastSeq}:{},...z.activeTurnId?{activeTurnId:z.activeTurnId}:{},...z.activeTurnStatus?{activeTurnStatus:z.activeTurnStatus}:{},...z.queue?{queue:z.queue}:{},items:O.items,...O.turns?{turns:O.turns}:{},updatedAt:O.updatedAt>E.updatedAt?O.updatedAt:E.updatedAt,...O.usage?{usage:O.usage}:{},...O.metrics?{metrics:O.metrics}:{}}}),...p]),g={...e.threadsByProjectId,[t]:m},x={...e.threadDetailsById};for(const E of m)x[E.id]=E;const y=e.activeProjectId===t,w=e.lastThreadIdByProject[t],S=y?m.some(E=>E.id===e.activeThreadId)?e.activeThreadId:m.some(E=>E.id===w)?w??null:e.activeThreadId===null&&e.threadsByProjectId[t]!==void 0?null:m[0]?.id??null:e.activeThreadId,T={...e.lastThreadIdByProject};y&&(S?T[t]=S:delete T[t]);let k={...e,threads:y?m:e.threads,activeThreadId:S,lastThreadIdByProject:T,threadsByProjectId:g,threadDetailsById:x};const _=new Set(m.map(E=>E.id)),C=[];for(const E of e.pendingThreadEvents){if(!E.threadId||!_.has(E.threadId)||k.historyByThreadId[E.threadId]?.status==="loading"){C.push(E);continue}const O=k.historyByThreadId[E.threadId]?.snapshotSeq??-1;E.seq>O&&(k={...k,...pa(k,E)})}return k={...k,...Iy(k,_)},{threads:k.threads,activeThreadId:S,lastThreadIdByProject:T,pendingThreadEvents:C,pendingTransientEventsByThreadId:k.pendingTransientEventsByThreadId,threadsByProjectId:k.threadsByProjectId,threadDetailsById:k.threadDetailsById,threadTombstonesById:s}}function r$(e,t,n,r=!1){if(e.threadTombstonesById[t.id])return{};if(n.requestId&&n.requestId!==e.historyByThreadId[t.id]?.requestId)return{};if(!r&&n.snapshotSeq<(e.historyByThreadId[t.id]?.snapshotSeq??-1))return{};const o=ti(e,t.id);if(o&&o.projectId!==t.projectId)return{};if(!o&&!e.projects.some(S=>S.id===t.projectId))return{};const s=r?zS(t.items,o?.items??[]):zS(o?.items??[],t.items),l=r?DS(t.turns,o?.turns):DS(o?.turns,t.turns),u=(e.lastThreadEventSeq[t.id]??0)>n.snapshotSeq;let f={...o,...t,...Mc(o,t),...Nc(o,t),items:s,...l?{turns:l}:{}};o&&u&&(f={...f,status:o.status,updatedAt:o.updatedAt>f.updatedAt?o.updatedAt:f.updatedAt,...o.activeTurnId?{activeTurnId:o.activeTurnId}:{},...o.usage?{usage:o.usage}:{}},o.activeTurnId?f.activeTurnId=o.activeTurnId:delete f.activeTurnId,o.activeTurnStatus?f.activeTurnStatus=o.activeTurnStatus:delete f.activeTurnStatus,o.queue?f.queue=o.queue:delete f.queue);let p={...e,...Pc(e,f)};const m=r?e.historyByThreadId[t.id]?.snapshotSeq??n.snapshotSeq:n.snapshotSeq,g=[];for(const S of e.pendingThreadEvents){if(S.threadId!==t.id){g.push(S);continue}if(r){g.push(S);continue}!r&&S.seq>m&&(p={...p,...pa(p,S)})}p={...p,...Iy(p,[t.id])};const x=e.historyByThreadId[t.id],y=(x?.dirtySinceSeq??0)>n.snapshotSeq,w={threads:p.threads,threadsByProjectId:p.threadsByProjectId,threadDetailsById:p.threadDetailsById,pendingThreadEvents:g,pendingTransientEventsByThreadId:p.pendingTransientEventsByThreadId,historyByThreadId:{...e.historyByThreadId,[t.id]:{status:"ready",...x?.requestId?{requestId:x.requestId}:{},itemsHasMore:n.itemsHasMore,...n.nextBeforeItemId?{nextBeforeItemId:n.nextBeforeItemId}:{},snapshotSeq:m,...y?{dirty:!0,dirtySinceSeq:x?.dirtySinceSeq??0}:{}}}};return{...w,...af({...e,...w},t.id)}}function i$(e){const t=Ke(e)?e:{},n=by(t.reasoningByProviderId,t.activeProviderId,t.reasoning);!t.activeProviderId&&t.reasoning&&Ac.has(t.reasoning)&&(n[ua]??=t.reasoning);const r=wy(t.activeModelByProviderId),o=j2(t.expandedPathsByProjectId),s=xy(t.reasoningByProviderModelKey);for(const[f,p]of Object.entries(n)){if(f===ua)continue;const m=r[f]??ua;s[ca(f,m)]??=p}const l=Object.fromEntries(Object.entries(Ke(t.lastThreadIdByProject)?t.lastThreadIdByProject:{}).filter(f=>typeof f[1]=="string"));t.activeProjectId&&t.activeThreadId&&(l[t.activeProjectId]??=t.activeThreadId);const u={...t,activeModelByProviderId:r,expandedPathsByProjectId:o,reasoningByProviderModelKey:s,reasoningByProviderId:n,lastThreadIdByProject:l};return delete u.frontendCompileStatesByProjectId,delete u.projectPanelWidth,delete u.filePanelWidth,u}function o$(e,t){const n=Ke(e)?e:{},r={...n};return delete r.frontendCompileStatesByProjectId,delete r.projectPanelWidth,delete r.filePanelWidth,{...t,...r,browsedProjectId:null,navigationIntentId:0,appSettings:t.appSettings,hostSessionId:t.hostSessionId,previewRevision:t.previewRevision,previewRevisionsByProjectId:t.previewRevisionsByProjectId,supportsProjectPreviewPool:t.supportsProjectPreviewPool,supportsTurnQueue:t.supportsTurnQueue,supportsDocumentAnnotations:t.supportsDocumentAnnotations,supportsDocumentSuggestions:t.supportsDocumentSuggestions,pendingTransientEventsByThreadId:t.pendingTransientEventsByThreadId,previewSessionsByProjectId:t.previewSessionsByProjectId,frontendCompileStatesByProjectId:t.frontendCompileStatesByProjectId,previewLayout:n.previewLayout==="split"?"split":"tabs",splitChatWidth:typeof n.splitChatWidth=="number"&&Number.isFinite(n.splitChatWidth)?Math.max(Or,Math.round(n.splitChatWidth)):Or,expandedPathsByProjectId:j2(n.expandedPathsByProjectId),activeModelByProviderId:wy(n.activeModelByProviderId),reasoningByProviderModelKey:xy(n.reasoningByProviderModelKey),reasoningByProviderId:by(n.reasoningByProviderId,n.activeProviderId,n.reasoning)}}function a$(e){return{theme:e.theme,projectPanelCollapsed:e.projectPanelCollapsed,filePanelCollapsed:e.filePanelCollapsed,previewLayout:e.previewLayout,splitChatWidth:e.splitChatWidth,activeProjectId:e.activeProjectId,expandedPathsByProjectId:e.expandedPathsByProjectId,lastThreadIdByProject:e.lastThreadIdByProject,activeProviderId:e.activeProviderId,activeModelByProviderId:e.activeModelByProviderId,reasoning:e.reasoning,reasoningByProviderModelKey:e.reasoningByProviderModelKey,reasoningByProviderId:e.reasoningByProviderId}}const $S=e=>{let t;const n=new Set,r=(p,m)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const x=t;t=m??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(y=>y(t,x))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p))},f=t=e(r,o,u);return u},s$=(e=>e?$S(e):$S),l$=e=>e;function c$(e,t=l$){const n=Cs.useSyncExternalStore(e.subscribe,Cs.useCallback(()=>t(e.getState()),[e,t]),Cs.useCallback(()=>t(e.getInitialState()),[e,t]));return Cs.useDebugValue(n),n}const u$=e=>{const t=s$(e),n=r=>c$(t,r);return Object.assign(n,t),n},d$=(e=>u$);function f$(e,t){let n;try{n=e()}catch{return}return{getItem:o=>{var s;const l=f=>f===null?null:JSON.parse(f,void 0),u=(s=n.getItem(o))!=null?s:null;return u instanceof Promise?u.then(l):l(u)},setItem:(o,s)=>n.setItem(o,JSON.stringify(s,void 0)),removeItem:o=>n.removeItem(o)}}const Rg=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Rg(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Rg(r)(n)}}}},p$=(e,t)=>(n,r,o)=>{let s={storage:f$(()=>window.localStorage),partialize:T=>T,version:0,merge:(T,k)=>({...k,...T}),...t},l=!1,u=0;const f=new Set,p=new Set;let m=s.storage;if(!m)return e((...T)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...T)},r,o);const g=()=>{const T=s.partialize({...r()});return m.setItem(s.name,{state:T,version:s.version})},x=o.setState;o.setState=(T,k)=>(x(T,k),g());const y=e((...T)=>(n(...T),g()),r,o);o.getInitialState=()=>y;let w;const S=()=>{var T,k;if(!m)return;const _=++u;l=!1,f.forEach(E=>{var O;return E((O=r())!=null?O:y)});const C=((k=s.onRehydrateStorage)==null?void 0:k.call(s,(T=r())!=null?T:y))||void 0;return Rg(m.getItem.bind(m))(s.name).then(E=>{if(E)if(typeof E.version=="number"&&E.version!==s.version){if(s.migrate){const O=s.migrate(E.state,E.version);return O instanceof Promise?O.then(M=>[!0,M]):[!0,O]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,E.state];return[!1,void 0]}).then(E=>{var O;if(_!==u)return;const[M,R]=E;if(w=s.merge(R,(O=r())!=null?O:y),n(w,!0),M)return g()}).then(()=>{_===u&&(C?.(r(),void 0),w=r(),l=!0,p.forEach(E=>E(w)))}).catch(E=>{_===u&&C?.(void 0,E)})};return o.persist={setOptions:T=>{s={...s,...T},T.storage&&(m=T.storage)},clearStorage:()=>{++u,m?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:T=>(f.add(T),()=>{f.delete(T)}),onFinishHydration:T=>(p.add(T),()=>{p.delete(T)})},s.skipHydration||S(),w||y},h$=p$;function C2(e,t){if(t)return e;const{referenceCode:n,...r}=e.documentModeConfig;return{...e,documentModeConfig:r}}const m$=8,Og=16e3,US=Object.freeze([]),sf=new Map,E2=new Map,zg=new Set;function g$(e){if(!Fc(e.path))throw new Error("只能批注安全的根目录设计 Markdown,不能批注 README 或指令文件。");if(!e.id||!/^[a-f0-9]{64}$/iu.test(e.hash))throw new Error("文档批注缺少有效标识或文件哈希,请重新选择。");if(!Number.isInteger(e.startLine)||e.startLine<1||!Number.isInteger(e.endLine)||e.endLine<e.startLine)throw new Error("文档批注行范围无效,请重新选择。");if(e.locationKind!=="exact"&&e.locationKind!=="context")throw new Error("文档批注定位类型无效。");if(!e.selectedText.trim()||!e.requirement.trim())throw new Error("请选择文档内容并填写修改要求。");if(e.selectedText.length>Og||e.requirement.length>Og)throw new Error("批注内容超过 16000 字符,请缩小选择范围;不会自动截断。");if((e.startOffset!==void 0||e.endOffset!==void 0)&&(!Number.isInteger(e.startOffset)||!Number.isInteger(e.endOffset)||e.startOffset<0||e.endOffset<=e.startOffset))throw new Error("文档批注字符范围无效。")}function $i(e){return e?sf.get(e)??US:US}function Dd(e){return E2.get(e)??0}function al(e,t){if(!e)throw new Error("请先选择应用。");if(t.length>m$)throw new Error("每个应用最多保留 8 条文档批注。");if(t.forEach(g$),new Set(t.map(n=>n.id)).size!==t.length)throw new Error("文档批注标识不能重复。");t.length?sf.set(e,Object.freeze(t.map(n=>Object.freeze({...n})))):sf.delete(e),E2.set(e,Dd(e)+1);for(const n of zg)n()}function v$(e,t){const n={...t,id:t.id??crypto.randomUUID()};return al(e,[...$i(e),n]),$i(e).at(-1)}function y$(e,t,n){const r=$i(e);if(!r.some(o=>o.id===t))throw new Error("批注已移除,请重新选择。");al(e,r.map(o=>o.id===t?{...o,...n}:o))}function b$(e,t){al(e,$i(e).filter(n=>n.id!==t))}function _2(e){al(e,[])}function Ty(e,t){const n=t?.replaceAll("\\","/").toLocaleLowerCase("en-US"),r=$i(e);r.some(o=>!o.stale&&(n===void 0||o.path.toLocaleLowerCase("en-US")===n))&&al(e,r.map(o=>n===void 0||o.path.toLocaleLowerCase("en-US")===n?{...o,stale:!0}:o))}function x$(){for(const e of sf.keys())Ty(e)}function w$(e){return zg.add(e),()=>{zg.delete(e)}}const S$=Date.now(),un=e=>new Date(S$-e*6e4).toISOString(),ic=[{id:"preview-harness",name:"Harness Studio",kind:"external",rootPath:"D:\\Code\\harness-studio",updatedAt:un(4),accent:"#7357ff",isPreview:!0},{id:"preview-commerce",name:"Commerce Console",kind:"external",rootPath:"D:\\Projects\\commerce-console",updatedAt:un(82),accent:"#36b37e",isPreview:!0},{id:"preview-notes",name:"Knowledge Base",kind:"external",rootPath:"D:\\Projects\\knowledge-base",updatedAt:un(1440),accent:"#f59e42",isPreview:!0}],HS=[{id:"src",name:"src",path:"src",kind:"directory",loaded:!0,children:[{id:"src-components",name:"components",path:"src/components",kind:"directory",loaded:!0,children:[{id:"chat-tsx",name:"ChatPanel.tsx",path:"src/components/ChatPanel.tsx",kind:"file",status:"modified"},{id:"tree-tsx",name:"FileTree.tsx",path:"src/components/FileTree.tsx",kind:"file"},{id:"tool-tsx",name:"ToolCard.tsx",path:"src/components/ToolCard.tsx",kind:"file",status:"added"}]},{id:"app-tsx",name:"App.tsx",path:"src/App.tsx",kind:"file"},{id:"main-tsx",name:"main.tsx",path:"src/main.tsx",kind:"file"},{id:"styles-css",name:"styles.css",path:"src/styles.css",kind:"file"}]},{id:"packages",name:"packages",path:"packages",kind:"directory",loaded:!0,children:[{id:"kernel",name:"kernel",path:"packages/kernel",kind:"directory",loaded:!0,children:[{id:"loop-ts",name:"agent-loop.ts",path:"packages/kernel/agent-loop.ts",kind:"file"},{id:"events-ts",name:"event-store.ts",path:"packages/kernel/event-store.ts",kind:"file"}]},{id:"protocol",name:"protocol",path:"packages/protocol",kind:"directory"},{id:"plugin-sdk",name:"plugin-sdk",path:"packages/plugin-sdk",kind:"directory"}]},{id:"readme",name:"README.md",path:"README.md",kind:"file"},{id:"package-json",name:"package.json",path:"package.json",kind:"file"},{id:"pnpm",name:"pnpm-workspace.yaml",path:"pnpm-workspace.yaml",kind:"file"}],k$={"src/components/ChatPanel.tsx":`import { useMemo } from "react";
74
+
75
+ interface ChatPanelProps {
76
+ threadId: string;
77
+ readonly?: boolean;
78
+ }
79
+
80
+ export function ChatPanel({ threadId, readonly = false }: ChatPanelProps) {
81
+ const title = useMemo(() => \`Thread \${threadId}\`, [threadId]);
82
+
83
+ return (
84
+ <section aria-label={title}>
85
+ <header>{title}</header>
86
+ <div>{readonly ? "Read only" : "Ready"}</div>
87
+ </section>
88
+ );
89
+ }
90
+ `,"src/components/FileTree.tsx":`export function FileTree() {
91
+ return <nav aria-label="Project files">File tree</nav>;
92
+ }
93
+ `,"src/components/ToolCard.tsx":`export type ToolState = "running" | "completed" | "failed";
94
+
95
+ export function ToolCard({ state }: { state: ToolState }) {
96
+ return <article data-state={state}>Tool execution</article>;
97
+ }
98
+ `,"src/App.tsx":`export default function App() {
99
+ return <main>Harness Studio</main>;
100
+ }
101
+ `,"src/main.tsx":`import { createRoot } from "react-dom/client";
102
+ import App from "./App";
103
+
104
+ createRoot(document.getElementById("root")!).render(<App />);
105
+ `,"src/styles.css":`:root { color-scheme: dark; }
106
+ body { margin: 0; }
107
+ `,"README.md":`# Harness Studio
108
+
109
+ A local-first, plugin-driven AI agent workbench.
110
+ `,"package.json":JSON.stringify({name:"harness-studio",private:!0,scripts:{dev:"pnpm -r dev"}},null,2),"pnpm-workspace.yaml":`packages:
111
+ - apps/*
112
+ - packages/*
113
+ `},yo=[{id:"preview-thread-1",projectId:"preview-harness",title:"完善 Agent 工具调用界面",createdAt:un(10),updatedAt:un(3),status:"idle",depth:0,isPreview:!0,usage:{inputTokens:18420,outputTokens:2804,reasoningTokens:1122,cachedInputTokens:12640,cacheStatus:"hit"},items:[{id:"preview-user-1",type:"message",role:"user",content:"请检查当前的聊天面板,并完善工具执行与审批状态的展示。",createdAt:un(9),references:[{path:"src/components/ChatPanel.tsx",startLine:1,endLine:18}]},{id:"preview-reasoning",type:"reasoning",summary:"已梳理消息结构,接下来检查聊天面板和工具卡片的状态映射。",createdAt:un(8)},{id:"preview-tool-1",type:"tool",toolCallId:"preview-call-read",toolName:"read_file",title:"读取 ChatPanel.tsx",state:"completed",createdAt:un(8),input:{path:"src/components/ChatPanel.tsx"},output:"已读取 18 行 · 526 B",durationMs:84},{id:"preview-tool-2",type:"tool",toolCallId:"preview-call-search",toolName:"search_files",title:"搜索 ToolState 的使用位置",state:"completed",createdAt:un(7),input:{query:"ToolState",path:"src"},output:"找到 4 个结果,分布在 3 个文件中。",durationMs:112},{id:"preview-approval",type:"approval",approvalId:"preview-approval-id",toolCallId:"preview-call-patch",title:"修改 ToolCard.tsx",description:"Agent 希望新增等待审批与取消状态。这是离线示例,按钮不会执行任何操作。",risk:"write",allowedDecisions:["allow-once","allow-turn","deny"],status:"pending",createdAt:un(6),diff:`@@ -1,4 +1,9 @@
114
+ -export type ToolState = "running" | "completed" | "failed";
115
+ +export type ToolState =
116
+ + | "queued"
117
+ + | "running"
118
+ + | "awaiting_approval"
119
+ + | "completed"
120
+ + | "failed"
121
+ + | "cancelled";`},{id:"preview-assistant-1",type:"message",role:"assistant",content:`我找到了状态模型缺失的问题,并准备了一个最小补丁。
122
+
123
+ - 保留现有的运行、成功和失败状态
124
+ - 增加排队、等待审批与取消状态
125
+ - UI 将根据状态显示一致的颜色和进度反馈
126
+
127
+ 当前是 **离线预览数据**,连接本地 Host 后才能审批并真正写入文件。`,createdAt:un(5)}]},{id:"preview-thread-2",projectId:"preview-harness",title:"设计插件 Manifest",createdAt:un(100),updatedAt:un(91),status:"idle",depth:0,isPreview:!0,items:[]},{id:"preview-thread-3",projectId:"preview-harness",title:"梳理上下文压缩策略",createdAt:un(1600),updatedAt:un(1510),status:"interrupted",depth:0,isPreview:!0,items:[]}],oc=[{id:"preview-openai",type:"openai",name:"OpenAI",model:"gpt-5",authMode:"required",keySource:"none",reasoningLevels:["minimal","low","medium","high"],reasoningEffort:"medium",maxOutputTokens:8192,contextWindow:32e3,enabled:!0,preset:"openai",isPreview:!0},{id:"preview-deepseek",type:"openai-compatible",name:"DeepSeek",model:"deepseek-v4-flash",baseUrl:"https://api.deepseek.com",authMode:"required",keySource:"none",reasoningLevels:["off","low","medium","high","max"],reasoningEffort:"off",maxOutputTokens:8192,contextWindow:1e6,enabled:!0,preset:"deepseek",isPreview:!0},{id:"preview-ollama",type:"openai-compatible",name:"Ollama (本地)",model:"qwen3:8b",baseUrl:"http://127.0.0.1:11434/v1",authMode:"none",keySource:"none",reasoningLevels:["off","low","medium","high"],reasoningEffort:"medium",maxOutputTokens:8192,contextWindow:32e3,enabled:!0,preset:"ollama",isPreview:!0}],I$=[{id:"builtin.workspace",name:"Workspace",version:"0.1.0",description:"项目、目录树、文件读取与工作区授权。",state:"active",builtin:!0,trusted:!0,permissions:["workspace:read","workspace:write"],contributions:[{kind:"tool",id:"read_file",label:"读取文件"},{kind:"tool",id:"search_files",label:"搜索文件"},{kind:"panel",id:"file-tree",label:"文件"}],isPreview:!0},{id:"builtin.shell",name:"Terminal Tools",version:"0.1.0",description:"在项目根目录中执行经过审批的命令。",state:"active",builtin:!0,trusted:!0,permissions:["process:spawn"],contributions:[{kind:"tool",id:"run_command",label:"运行命令"}],isPreview:!0},{id:"example.workspace-stats",name:"Workspace Stats",version:"0.1.0",description:"示例插件:统计工作区文件类型与大小。",state:"disabled",builtin:!1,trusted:!0,permissions:["workspace:read"],contributions:[{kind:"tool",id:"workspace_stats",label:"工作区统计"},{kind:"leftNav",id:"workspace-stats",label:"统计"},{kind:"settings",id:"workspace-stats",label:"统计设置"}],isPreview:!0}],T$=[{id:"log-1",timestamp:un(3),level:"info",source:"host.connection",message:"离线预览:等待 Harness Host 连接",isPreview:!0},{id:"log-2",timestamp:un(7),level:"info",source:"tool.read_file",message:"工具完成 · 84 ms · 526 B",threadId:"preview-thread-1",isPreview:!0},{id:"log-3",timestamp:un(7),level:"debug",source:"provider.cache",message:"Prompt cache hit · 12,640 tokens",threadId:"preview-thread-1",isPreview:!0},{id:"log-4",timestamp:un(18),level:"warn",source:"agent.context",message:"上下文达到可用预算的 72%",threadId:"preview-thread-1",isPreview:!0}],j$=[];function A2(e){const t=D.getState(),n=t.threadsByProjectId[e]??(t.activeProjectId===e?t.threads:[]);return{startedAtSeq:t.lastSeq,knownThreadIds:n.map(r=>r.id)}}const D=d$()(h$((e,t)=>({route:"workbench",theme:"dark",connectionStatus:"connecting",connectionDetail:"正在连接本地 Harness Host…",offlinePreview:!0,lastSeq:0,projectPanelCollapsed:!1,filePanelCollapsed:!0,previewLayout:"tabs",splitChatWidth:Or,projects:ic,activeProjectId:ic[0]?.id??null,browsedProjectId:null,navigationIntentId:0,fileTree:HS,fileTreeByProjectId:{},expandedPathsByProjectId:ic[0]?{[ic[0].id]:["src","src/components","packages","packages/kernel"]}:{},openFiles:j$,openFilesByProjectId:{},workspaceTabByProjectId:{},activeWorkspaceTab:"assistant",appSettings:null,hostSessionId:null,previewRevision:0,previewRevisionsByProjectId:{},supportsProjectPreviewPool:!1,supportsTurnQueue:!1,supportsDocumentAnnotations:!1,supportsDocumentSuggestions:!1,previewSessionsByProjectId:{},frontendCompileStatesByProjectId:{},threads:yo,threadsByProjectId:Object.fromEntries(ic.map(n=>[n.id,yo.filter(r=>r.projectId===n.id)])),threadDetailsById:Object.fromEntries(yo.map(n=>[n.id,n])),threadTombstonesById:{},activeThreadId:yo[0]?.id??null,lastThreadIdByProject:yo[0]?{[yo[0].projectId]:yo[0].id}:{},historyByThreadId:{},historyAccessOrder:[],pendingThreadEvents:[],pendingTransientEventsByThreadId:{},seenEventIds:[],lastThreadEventSeq:{},providers:oc,providerPresets:[],activeProviderId:oc[0]?.id??null,modelsByProviderId:Object.fromEntries(oc.map(n=>[n.id,[ol(n)]])),modelCatalogLoadedByProviderId:Object.fromEntries(oc.map(n=>[n.id,!0])),activeModelByProviderId:Object.fromEntries(oc.map(n=>[n.id,n.defaultModelId??n.model])),reasoning:"medium",reasoningByProviderModelKey:{},reasoningByProviderId:{},plugins:I$,logs:T$,toasts:[],setRoute:n=>e(r=>({route:n,navigationIntentId:r.navigationIntentId+(r.route===n?0:1)})),setTheme:n=>e({theme:n}),setConnection:(n,r="")=>e(o=>{let s=o;if(n!=="online"){const l=new Map([...Object.values(o.threadDetailsById),...o.threads].map(u=>[u.id,u]));for(const u of l.values()){const f=I2([u])[0];f!==u&&(s={...s,...Pc(s,f)})}}return{connectionStatus:n,connectionDetail:r,...s===o?{}:{threads:s.threads,threadsByProjectId:s.threadsByProjectId,threadDetailsById:s.threadDetailsById}}}),hydrateHost:n=>{let r=[];e(o=>{const s=t$(o,n);return r=s.effects,s.patch}),Tm(r)},togglePanel:n=>e(r=>n==="project"?{projectPanelCollapsed:!r.projectPanelCollapsed}:{filePanelCollapsed:!r.filePanelCollapsed}),setPreviewLayout:n=>e(r=>({previewLayout:n,...n==="split"&&r.activeWorkspaceTab.startsWith("file:")?{activeWorkspaceTab:"assistant"}:{}})),setSplitChatWidth:n=>e({splitChatWidth:Number.isFinite(n)?Math.max(Or,Math.round(n)):Or}),setProjects:n=>e({projects:n}),browseProject:n=>e(r=>r.projects.some(o=>o.id===n)?{browsedProjectId:n,navigationIntentId:r.navigationIntentId+1}:{}),beginNavigationIntent:()=>{const n=t().navigationIntentId+1;return e({navigationIntentId:n}),n},removeProject:n=>e(r=>{const o=r.projects.filter(_=>_.id!==n),s={...r.threadsByProjectId},l=s[n]??[];delete s[n];const u={...r.threadDetailsById},f={...r.historyByThreadId},p={...r.expandedPathsByProjectId},m={...r.previewSessionsByProjectId},g={...r.frontendCompileStatesByProjectId},x={...r.lastThreadIdByProject};delete p[n],delete m[n],delete g[n],delete x[n];for(const _ of l)delete u[_.id],delete f[_.id];const y={...T2(r,n),projects:o,threadsByProjectId:s,threadDetailsById:u,historyByThreadId:f,expandedPathsByProjectId:p,previewSessionsByProjectId:m,frontendCompileStatesByProjectId:g,lastThreadIdByProject:x};if(r.activeProjectId!==n)return y;const w=o[0]?.id??null,S=w?s[w]??[]:[],T=w?x[w]:void 0,k=S.some(_=>_.id===T)?T??null:S[0]?.id??null;return{...y,activeProjectId:w,threads:S,activeThreadId:k,fileTree:w?r.fileTreeByProjectId[w]??[]:[],openFiles:w?r.openFilesByProjectId[w]??[]:[],activeWorkspaceTab:w?r.workspaceTabByProjectId[w]??"assistant":"assistant"}}),selectProject:n=>e(r=>{if(r.activeProjectId===n)return{};const o=r.offlinePreview?yo.filter(g=>g.projectId===n):(r.threadsByProjectId[n]??[]).map(g=>r.threadDetailsById[g.id]??g),s=r.activeProjectId&&r.activeThreadId?{...r.lastThreadIdByProject,[r.activeProjectId]:r.activeThreadId}:r.lastThreadIdByProject,l=s[n],u=r.activeProjectId?{...r.fileTreeByProjectId,[r.activeProjectId]:r.fileTree}:r.fileTreeByProjectId,f=r.activeProjectId?{...r.openFilesByProjectId,[r.activeProjectId]:r.openFiles}:r.openFilesByProjectId,p=r.activeProjectId?{...r.workspaceTabByProjectId,[r.activeProjectId]:r.activeWorkspaceTab}:r.workspaceTabByProjectId,m={activeProjectId:n,fileTree:r.offlinePreview&&n==="preview-harness"?HS:u[n]??[],openFiles:f[n]??[],activeWorkspaceTab:p[n]??"assistant",fileTreeByProjectId:u,openFilesByProjectId:f,workspaceTabByProjectId:p,threads:o,activeThreadId:o.some(g=>g.id===l)?l??null:o[0]?.id??null,lastThreadIdByProject:s};return{...m,...af({...r,...m},m.activeThreadId??void 0)}}),setFileTree:(n,r,o)=>e(s=>({...s.activeProjectId===n?{fileTree:r}:{},fileTreeByProjectId:{...s.fileTreeByProjectId,[n]:r},expandedPathsByProjectId:{...s.expandedPathsByProjectId,[n]:[...new Set(o)]}})),setDirectoryChildren:(n,r,o)=>e(s=>{const l=f=>f.map(p=>p.path===r?{...p,children:o,loaded:!0}:p.children?{...p,children:l(p.children)}:p),u=l(s.activeProjectId===n?s.fileTree:s.fileTreeByProjectId[n]??[]);return{...s.activeProjectId===n?{fileTree:u}:{},fileTreeByProjectId:{...s.fileTreeByProjectId,[n]:u}}}),toggleDirectory:n=>e(r=>({expandedPathsByProjectId:r.activeProjectId?{...r.expandedPathsByProjectId,[r.activeProjectId]:(r.expandedPathsByProjectId[r.activeProjectId]??[]).includes(n)?(r.expandedPathsByProjectId[r.activeProjectId]??[]).filter(o=>o!==n):[...r.expandedPathsByProjectId[r.activeProjectId]??[],n]}:r.expandedPathsByProjectId})),openFile:n=>e(r=>({openFiles:r.openFiles.some(o=>o.id===n.id)?r.openFiles.map(o=>o.id===n.id?n:o):[...r.openFiles,n],activeWorkspaceTab:n.id})),closeFile:n=>e(r=>{const o=r.openFiles.findIndex(u=>u.id===n),s=r.openFiles.filter(u=>u.id!==n);let l=r.activeWorkspaceTab;return l===n&&(l=s[Math.max(0,o-1)]?.id??"assistant"),{openFiles:s,activeWorkspaceTab:l}}),selectWorkspaceTab:n=>e({activeWorkspaceTab:n}),setAppSettings:n=>e(r=>n.revision>=(r.appSettings?.revision??-1)?{appSettings:n}:{}),setPreviewSession:(n,r,o=r?.revision??0)=>e(s=>ky(s,n,r,o)),setFrontendCompileState:(n,r,o)=>e(s=>o===(s.supportsProjectPreviewPool?s.previewRevisionsByProjectId[n]:s.previewRevision)&&s.previewSessionsByProjectId[n]?.revision===o?{frontendCompileStatesByProjectId:{...s.frontendCompileStatesByProjectId,[n]:Uf(s.frontendCompileStatesByProjectId[n],r)}}:{}),setThreads:(n,r,o)=>e(s=>n$(s,n,r,o)),selectThread:n=>e(r=>{const o=r.threads.find(s=>s.id===n)?.projectId??r.activeProjectId;return{...af({...r,activeThreadId:n},n),activeThreadId:n,activeWorkspaceTab:"assistant",...o?{lastThreadIdByProject:{...r.lastThreadIdByProject,[o]:n}}:{}}}),upsertThread:(n,r)=>e(o=>{const s=o.threadTombstonesById[n.id];if(s&&(n.lastSeq??-1)<=s.seq)return{};const l=s?{...o.threadTombstonesById}:o.threadTombstonesById;s&&delete l[n.id];const u=o.threadDetailsById[n.id]??o.threadsByProjectId[n.projectId]?.find(g=>g.id===n.id)??o.threads.find(g=>g.id===n.id),f=u?{...u,...n,...Mc(u,n),...Nc(u,n),items:n.items.length>0?n.items:u.items}:n,p=Kc([...(o.threadsByProjectId[n.projectId]??(o.activeProjectId===n.projectId?o.threads:[])).filter(g=>g.id!==n.id),f]),m=r?.select!==!1;return{threads:o.activeProjectId===n.projectId?p:o.threads,threadsByProjectId:{...o.threadsByProjectId,[n.projectId]:p},threadDetailsById:{...o.threadDetailsById,[n.id]:f},threadTombstonesById:l,activeThreadId:m?n.id:o.activeThreadId,activeProjectId:m?n.projectId:o.activeProjectId,lastThreadIdByProject:m?{...o.lastThreadIdByProject,[n.projectId]:n.id}:o.lastThreadIdByProject}}),removeThread:n=>e(r=>{const o=r.threadDetailsById[n]??r.threads.find(m=>m.id===n);if(!o)return{};const s=(r.threadsByProjectId[o.projectId]??r.threads).filter(m=>m.id!==n),l={...r.threadDetailsById},u={...r.historyByThreadId};delete l[n],delete u[n];const f=r.activeThreadId===n?s[0]?.id??null:r.activeThreadId,p={...r.lastThreadIdByProject};if(p[o.projectId]===n||r.activeThreadId===n){const m=r.activeProjectId===o.projectId?f:s[0]?.id;m?p[o.projectId]=m:delete p[o.projectId]}return{threads:r.activeProjectId===o.projectId?s:r.threads,activeThreadId:f,threadsByProjectId:{...r.threadsByProjectId,[o.projectId]:s},threadTombstonesById:{...r.threadTombstonesById,[n]:{projectId:o.projectId,seq:Math.max(r.lastSeq,o.lastSeq??0)}},threadDetailsById:l,historyByThreadId:u,lastThreadIdByProject:p}}),setThreadMetrics:(n,r)=>e(o=>{const s=ti(o,n);if(!s)return{};const l=Cn([s],n,u=>{const f=Hq(r),p=f.requests.some(T=>T.reasoningObserved===!0),m=f.requests.reduce((T,k)=>T+(k.reasoningDurationMs??0),0),g=f.requests.some(T=>T.summaryAvailable===!0),x=f.latestTurnId&&u.turns?u.turns.map(T=>T.id===f.latestTurnId?{...T,...p?{reasoningObserved:!0}:{},...m>0?{reasoningDurationMs:m}:{},...g?{reasoningSummaryAvailable:!0}:{}}:T):u.turns,y=f.latestTurn?.usageAvailable===!0?f.latestTurn.usage:void 0;if(y)return{...u,metrics:f,usage:y,...x?{turns:x}:{}};const{usage:w,...S}=u;return{...S,metrics:f,...x?{turns:x}:{}}})[0];return Pc(o,l)}),beginThreadHistory:(n,r=!1)=>{const o=crypto.randomUUID();return e(s=>{const l=s.historyByThreadId[n],{error:u,...f}=l??{};return{historyByThreadId:{...s.historyByThreadId,[n]:{...f,requestId:o,status:r?"loading-more":"loading",itemsHasMore:l?.itemsHasMore??!1}}}}),o},hydrateThreadHistory:(n,r,o=!1)=>e(s=>r$(s,n,r,o)),failThreadHistory:(n,r,o)=>e(s=>{const l=s.historyByThreadId[n];if(o&&o!==l?.requestId||l?.status==="ready")return{};let u=s;const f=[];for(const p of s.pendingThreadEvents){if(p.threadId!==n||!ti(s,n)){f.push(p);continue}const m=s.historyByThreadId[n]?.snapshotSeq??-1;p.seq>m&&(u={...u,...pa(u,p)})}return{threads:u.threads,threadDetailsById:u.threadDetailsById,threadsByProjectId:u.threadsByProjectId,pendingThreadEvents:f,historyByThreadId:{...s.historyByThreadId,[n]:{...l,status:"error",itemsHasMore:l?.itemsHasMore??!1,...l?.nextBeforeItemId?{nextBeforeItemId:l.nextBeforeItemId}:{},...l?.snapshotSeq!==void 0?{snapshotSeq:l.snapshotSeq}:{},error:r}}}}),markHistoriesDirty:()=>e(n=>({historyByThreadId:Object.fromEntries(Object.entries(n.historyByThreadId).map(([r,o])=>[r,Rc(o,n.lastSeq)]))})),setProviders:n=>e(r=>{const o=S2(n,void 0,r.modelsByProviderId,!0);return{providers:n,modelsByProviderId:o,...oa(n,o,r.modelCatalogLoadedByProviderId,r.activeProviderId,r.activeModelByProviderId,r.reasoningByProviderModelKey,r.reasoningByProviderId,{providerId:r.activeProviderId,...r.activeProviderId&&r.activeModelByProviderId[r.activeProviderId]?{modelId:r.activeModelByProviderId[r.activeProviderId]}:{},reasoning:r.reasoning})}}),removeProvider:n=>e(r=>{const o=r.providers.filter(x=>x.id!==n),s={...r.modelsByProviderId},l={...r.modelCatalogLoadedByProviderId},u={...r.activeModelByProviderId},f={...r.reasoningByProviderId};delete s[n],delete l[n],delete u[n],delete f[n];const p=ca(n,""),m=Object.fromEntries(Object.entries(r.reasoningByProviderModelKey).filter(([x])=>!x.startsWith(p))),g=r.activeProviderId===n;return{providers:o,modelsByProviderId:s,modelCatalogLoadedByProviderId:l,...oa(o,s,l,g?null:r.activeProviderId,u,m,f,g?void 0:{providerId:r.activeProviderId,...r.activeProviderId&&u[r.activeProviderId]?{modelId:u[r.activeProviderId]}:{},reasoning:r.reasoning})}}),setProviderModels:(n,r,o=!0)=>e(s=>{const l=o?r:Cg(s.modelsByProviderId[n]??[],r),u={...s.modelsByProviderId,[n]:l},f={...s.modelCatalogLoadedByProviderId,[n]:!0};return{modelsByProviderId:u,modelCatalogLoadedByProviderId:f,...oa(s.providers,u,f,s.activeProviderId,s.activeModelByProviderId,s.reasoningByProviderModelKey,s.reasoningByProviderId,{providerId:s.activeProviderId,...s.activeProviderId&&s.activeModelByProviderId[s.activeProviderId]?{modelId:s.activeModelByProviderId[s.activeProviderId]}:{},reasoning:s.reasoning})}}),upsertProviderModel:(n,r)=>e(o=>{const s=r?[...o.providers.filter(u=>u.id!==r.id),r]:o.providers,l={...o.modelsByProviderId,[n.providerId]:Cg(o.modelsByProviderId[n.providerId]??[],[n])};return{providers:s,modelsByProviderId:l,...oa(s,l,o.modelCatalogLoadedByProviderId,o.activeProviderId,o.activeModelByProviderId,o.reasoningByProviderModelKey,o.reasoningByProviderId,{providerId:o.activeProviderId,reasoning:o.reasoning})}}),setActiveProvider:n=>e(r=>oa(r.providers,r.modelsByProviderId,r.modelCatalogLoadedByProviderId,n,r.activeModelByProviderId,r.reasoningByProviderModelKey,r.reasoningByProviderId,{providerId:r.activeProviderId,reasoning:r.reasoning})),setActiveModel:(n,r)=>e(o=>oa(o.providers,o.modelsByProviderId,o.modelCatalogLoadedByProviderId,n,{...o.activeModelByProviderId,[n]:r},o.reasoningByProviderModelKey,o.reasoningByProviderId,{providerId:n,modelId:r,reasoning:o.reasoning})),setReasoning:n=>e(r=>{const o=r.providers.find(f=>f.id===r.activeProviderId&&f.enabled);if(!o)return{reasoning:"off"};const s=r.activeModelByProviderId[o.id],l=Sy(o,r.modelsByProviderId).find(f=>f.id===s),u=Eg(o,l,n);return{reasoning:u,reasoningByProviderModelKey:l?{...r.reasoningByProviderModelKey,[ca(o.id,l.id)]:u}:r.reasoningByProviderModelKey,reasoningByProviderId:{...r.reasoningByProviderId,[o.id]:u}}}),setPlugins:n=>e({plugins:n}),updatePlugin:n=>e(r=>({plugins:r.plugins.map(o=>o.id===n.id?n:o)})),setLogs:n=>e({logs:n}),applyEvent:n=>{let r=[];e(o=>{const s=qS(o,n);return r=s.effects,s.patch}),Tm(r)},applyEvents:n=>{const r=[];e(o=>{let s=o;for(const l of n){const u=qS(s,l);s={...s,...u.patch},r.push(...u.effects)}return s}),Tm(r)},pushToast:n=>e(r=>({toasts:[...r.toasts,{...n,id:crypto.randomUUID()}].slice(-4)})),dismissToast:n=>e(r=>({toasts:r.toasts.filter(o=>o.id!==n)}))}),{name:"harness-studio-ui-v1",version:6,migrate:i$,merge:o$,partialize:a$}));function FS(e){return{id:`file:${e}`,path:e,name:e.split(/[\\/]/).pop()??e,language:hy(e),content:k$[e]??`// 离线预览没有 ${e} 的内容。
128
+ `,isPreview:!0}}function Tm(e){for(const t of e)t.type==="all-annotations-stale"?x$():Ty(t.projectId,t.path)}function C$(){const e=D(r=>r.connectionStatus),t=D(r=>r.connectionDetail);if(e==="online")return null;const n=e==="connecting"||e==="reconnecting";return h.jsxs("div",{role:"status",className:"flex h-8 shrink-0 items-center justify-center gap-2 border-b border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] px-3 type-ui text-[var(--status-warning-fg)]",children:[n?h.jsx(Ot,{className:"size-3.5 animate-spin"}):h.jsx(Mi,{className:"size-3.5"}),h.jsxs("span",{children:[n?"正在连接本地 Harness Host — 下方为离线预览,不会写入磁盘或调用模型":"本地 Host 未连接 — 当前内容为明确标记的界面预览,任何操作都不会写入磁盘或调用模型",t&&h.jsxs("span",{className:"ml-1",children:["· ",t]})]}),!n&&h.jsxs("button",{type:"button",onClick:()=>{He.connect().catch(()=>{})},className:"ml-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 font-medium text-[var(--status-warning-fg)] hover:bg-[var(--hover)]",children:[h.jsx(YT,{className:"size-3"})," 重连"]})]})}var E$=Object.defineProperty,Dn=(e,t)=>E$(e,"name",{value:t,configurable:!0}),jm="focusScope.autoFocusOnMount",Cm="focusScope.autoFocusOnUnmount",VS={bubbles:!1,cancelable:!0},M2=I.forwardRef(Dn(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:l,...u}=t,[f,p]=I.useState(null),m=Wr(s),g=Wr(l),x=I.useRef(null),y=Ut(n,p),w=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(o){let T=function(E){if(w.paused||!f)return;const O=E.target;f.contains(O)?x.current=O:_i(x.current,{select:!0})},k=function(E){if(w.paused||!f)return;const O=E.relatedTarget;O!==null&&(f.contains(O)||_i(x.current,{select:!0}))},_=function(E){if(document.activeElement===document.body)for(const M of E)M.removedNodes.length>0&&_i(f)};Dn(T,"handleFocusIn"),Dn(k,"handleFocusOut"),Dn(_,"handleMutations"),document.addEventListener("focusin",T),document.addEventListener("focusout",k);const C=new MutationObserver(_);return f&&C.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",T),document.removeEventListener("focusout",k),C.disconnect()}}},[o,f,w.paused]),I.useEffect(()=>{if(f){ZS.add(w);const T=document.activeElement;if(!f.contains(T)){const _=new CustomEvent(jm,VS);f.addEventListener(jm,m),f.dispatchEvent(_),_.defaultPrevented||(N2(D2(jy(f)),{select:!0}),document.activeElement===T&&_i(f))}return()=>{f.removeEventListener(jm,m),setTimeout(()=>{const _=new CustomEvent(Cm,VS);f.addEventListener(Cm,g),f.dispatchEvent(_),_.defaultPrevented||_i(T??document.body,{select:!0}),f.removeEventListener(Cm,g),ZS.remove(w)},0)}}},[f,m,g,w]);const S=I.useCallback(T=>{if(!r&&!o||w.paused)return;const k=T.key==="Tab"&&!T.altKey&&!T.ctrlKey&&!T.metaKey,_=document.activeElement;if(k&&_){const C=T.currentTarget,[E,O]=P2(C);E&&O?!T.shiftKey&&_===O?(T.preventDefault(),r&&_i(E,{select:!0})):T.shiftKey&&_===E&&(T.preventDefault(),r&&_i(O,{select:!0})):_===C&&T.preventDefault()}},[r,o,w.paused]);return h.jsx(Xt.div,{tabIndex:-1,...u,ref:y,onKeyDown:S})},"FocusScope"));function N2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(_i(r,{select:t}),document.activeElement!==n)return}Dn(N2,"focusFirst");function P2(e){const t=jy(e),n=Dg(t,e),r=Dg(t.reverse(),e);return[n,r]}Dn(P2,"getTabbableEdges");function jy(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Dn(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Dn(jy,"getTabbableCandidates");function Dg(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):R2(r,{upTo:t})))return r}Dn(Dg,"findVisible");function R2(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Dn(R2,"isHidden");function O2(e){return e instanceof HTMLInputElement&&"select"in e}Dn(O2,"isSelectableInput");function _i(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&O2(e)&&t&&e.select()}}Dn(_i,"focus");var ZS=z2();function z2(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Lg(e,t),e.unshift(t)},remove(t){e=Lg(e,t),e[0]?.resume()}}}Dn(z2,"createFocusScopesStack");function Lg(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Dn(Lg,"arrayRemove");function D2(e){return e.filter(t=>t.tagName!=="A")}Dn(D2,"removeLinks");var _$=Object.defineProperty,Cy=(e,t)=>_$(e,"name",{value:t,configurable:!0}),xd=0,vs=null;function A$(e){return Hf(),e.children}Cy(A$,"FocusGuards");function Hf(){I.useEffect(()=>{vs||(vs={start:Bg(),end:Bg()});const{start:e,end:t}=vs;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),xd++,()=>{xd===1&&(vs?.start.remove(),vs?.end.remove(),vs=null),xd=Math.max(0,xd-1)}},[])}Cy(Hf,"useFocusGuards");function Bg(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Cy(Bg,"createFocusGuard");var Qr=function(){return Qr=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Qr.apply(this,arguments)};function L2(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function M$(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Ld="right-scroll-bar-position",Bd="width-before-scroll-bar",N$="with-scroll-bars-hidden",P$="--removed-body-scroll-bar-size";function Em(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function R$(e,t){var n=I.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var O$=typeof window<"u"?I.useLayoutEffect:I.useEffect,KS=new WeakMap;function z$(e,t){var n=R$(null,function(r){return e.forEach(function(o){return Em(o,r)})});return O$(function(){var r=KS.get(n);if(r){var o=new Set(r),s=new Set(e),l=n.current;o.forEach(function(u){s.has(u)||Em(u,null)}),s.forEach(function(u){o.has(u)||Em(u,l)})}KS.set(n,e)},[e]),n}function D$(e){return e}function L$(e,t){t===void 0&&(t=D$);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var l=t(s,r);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(s){for(r=!0;n.length;){var l=n;n=[],l.forEach(s)}n={push:function(u){return s(u)},filter:function(){return n}}},assignMedium:function(s){r=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(s),l=n}var f=function(){var m=l;l=[],m.forEach(s)},p=function(){return Promise.resolve().then(f)};p(),n={push:function(m){l.push(m),p()},filter:function(m){return l=l.filter(m),n}}}};return o}function B$(e){e===void 0&&(e={});var t=L$(null);return t.options=Qr({async:!0,ssr:!1},e),t}var B2=function(e){var t=e.sideCar,n=L2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return I.createElement(r,Qr({},n))};B2.isSideCarExport=!0;function q$(e,t){return e.useMedium(t),B2}var q2=B$(),_m=function(){},Ff=I.forwardRef(function(e,t){var n=I.useRef(null),r=I.useState({onScrollCapture:_m,onWheelCapture:_m,onTouchMoveCapture:_m}),o=r[0],s=r[1],l=e.forwardProps,u=e.children,f=e.className,p=e.removeScrollBar,m=e.enabled,g=e.shards,x=e.sideCar,y=e.noRelative,w=e.noIsolation,S=e.inert,T=e.allowPinchZoom,k=e.as,_=k===void 0?"div":k,C=e.gapMode,E=L2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=x,M=z$([n,t]),R=Qr(Qr({},E),o);return I.createElement(I.Fragment,null,m&&I.createElement(O,{sideCar:q2,removeScrollBar:p,shards:g,noRelative:y,noIsolation:w,inert:S,setCallbacks:s,allowPinchZoom:!!T,lockRef:n,gapMode:C}),l?I.cloneElement(I.Children.only(u),Qr(Qr({},R),{ref:M})):I.createElement(_,Qr({},R,{className:f,ref:M}),u))});Ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ff.classNames={fullWidth:Bd,zeroRight:Ld};var $$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function U$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=$$();return t&&e.setAttribute("nonce",t),e}function H$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function F$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var V$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=U$())&&(H$(t,n),F$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Z$=function(){var e=V$();return function(t,n){I.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},$2=function(){var e=Z$(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},K$={left:0,top:0,right:0,gap:0},Am=function(e){return parseInt(e||"",10)||0},Q$=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Am(n),Am(r),Am(o)]},G$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return K$;var t=Q$(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Y$=$2(),Rs="data-scroll-locked",W$=function(e,t,n,r){var o=e.left,s=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
129
+ .`.concat(N$,` {
130
+ overflow: hidden `).concat(r,`;
131
+ padding-right: `).concat(u,"px ").concat(r,`;
132
+ }
133
+ body[`).concat(Rs,`] {
134
+ overflow: hidden `).concat(r,`;
135
+ overscroll-behavior: contain;
136
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
137
+ padding-left: `.concat(o,`px;
138
+ padding-top: `).concat(s,`px;
139
+ padding-right: `).concat(l,`px;
140
+ margin-left:0;
141
+ margin-top:0;
142
+ margin-right: `).concat(u,"px ").concat(r,`;
143
+ `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(r,";")].filter(Boolean).join(""),`
144
+ }
145
+
146
+ .`).concat(Ld,` {
147
+ right: `).concat(u,"px ").concat(r,`;
148
+ }
149
+
150
+ .`).concat(Bd,` {
151
+ margin-right: `).concat(u,"px ").concat(r,`;
152
+ }
153
+
154
+ .`).concat(Ld," .").concat(Ld,` {
155
+ right: 0 `).concat(r,`;
156
+ }
157
+
158
+ .`).concat(Bd," .").concat(Bd,` {
159
+ margin-right: 0 `).concat(r,`;
160
+ }
161
+
162
+ body[`).concat(Rs,`] {
163
+ `).concat(P$,": ").concat(u,`px;
164
+ }
165
+ `)},QS=function(){var e=parseInt(document.body.getAttribute(Rs)||"0",10);return isFinite(e)?e:0},X$=function(){I.useEffect(function(){return document.body.setAttribute(Rs,(QS()+1).toString()),function(){var e=QS()-1;e<=0?document.body.removeAttribute(Rs):document.body.setAttribute(Rs,e.toString())}},[])},J$=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;X$();var s=I.useMemo(function(){return G$(o)},[o]);return I.createElement(Y$,{styles:W$(s,!t,o,n?"":"!important")})},qg=!1;if(typeof window<"u")try{var wd=Object.defineProperty({},"passive",{get:function(){return qg=!0,!0}});window.addEventListener("test",wd,wd),window.removeEventListener("test",wd,wd)}catch{qg=!1}var ys=qg?{passive:!1}:!1,eU=function(e){return e.tagName==="TEXTAREA"},U2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!eU(e)&&n[t]==="visible")},tU=function(e){return U2(e,"overflowY")},nU=function(e){return U2(e,"overflowX")},GS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=H2(e,r);if(o){var s=F2(e,r),l=s[1],u=s[2];if(l>u)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},rU=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},iU=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},H2=function(e,t){return e==="v"?tU(t):nU(t)},F2=function(e,t){return e==="v"?rU(t):iU(t)},oU=function(e,t){return e==="h"&&t==="rtl"?-1:1},aU=function(e,t,n,r,o){var s=oU(e,window.getComputedStyle(t).direction),l=s*r,u=n.target,f=t.contains(u),p=!1,m=l>0,g=0,x=0;do{if(!u)break;var y=F2(e,u),w=y[0],S=y[1],T=y[2],k=S-T-s*w;(w||k)&&H2(e,u)&&(g+=k,x+=w);var _=u.parentNode;u=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(m&&Math.abs(g)<1||!m&&Math.abs(x)<1)&&(p=!0),p},Sd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},YS=function(e){return[e.deltaX,e.deltaY]},WS=function(e){return e&&"current"in e?e.current:e},sU=function(e,t){return e[0]===t[0]&&e[1]===t[1]},lU=function(e){return`
166
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
167
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
168
+ `)},cU=0,bs=[];function uU(e){var t=I.useRef([]),n=I.useRef([0,0]),r=I.useRef(),o=I.useState(cU++)[0],s=I.useState($2)[0],l=I.useRef(e);I.useEffect(function(){l.current=e},[e]),I.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=M$([e.lockRef.current],(e.shards||[]).map(WS),!0).filter(Boolean);return S.forEach(function(T){return T.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(T){return T.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=I.useCallback(function(S,T){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=Sd(S),_=n.current,C="deltaX"in S?S.deltaX:_[0]-k[0],E="deltaY"in S?S.deltaY:_[1]-k[1],O,M=S.target,R=Math.abs(C)>Math.abs(E)?"h":"v";if("touches"in S&&R==="h"&&M.type==="range")return!1;var z=window.getSelection(),K=z&&z.anchorNode,q=K?K===M||K.contains(M):!1;if(q)return!1;var Z=GS(R,M);if(!Z)return!0;if(Z?O=R:(O=R==="v"?"h":"v",Z=GS(R,M)),!Z)return!1;if(!r.current&&"changedTouches"in S&&(C||E)&&(r.current=O),!O)return!0;var Y=r.current||O;return aU(Y,T,S,Y==="h"?C:E)},[]),f=I.useCallback(function(S){var T=S;if(!(!bs.length||bs[bs.length-1]!==s)){var k="deltaY"in T?YS(T):Sd(T),_=t.current.filter(function(O){return O.name===T.type&&(O.target===T.target||T.target===O.shadowParent)&&sU(O.delta,k)})[0];if(_&&_.should){T.cancelable&&T.preventDefault();return}if(!_){var C=(l.current.shards||[]).map(WS).filter(Boolean).filter(function(O){return O.contains(T.target)}),E=C.length>0?u(T,C[0]):!l.current.noIsolation;E&&T.cancelable&&T.preventDefault()}}},[]),p=I.useCallback(function(S,T,k,_){var C={name:S,delta:T,target:k,should:_,shadowParent:dU(k)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(E){return E!==C})},1)},[]),m=I.useCallback(function(S){n.current=Sd(S),r.current=void 0},[]),g=I.useCallback(function(S){p(S.type,YS(S),S.target,u(S,e.lockRef.current))},[]),x=I.useCallback(function(S){p(S.type,Sd(S),S.target,u(S,e.lockRef.current))},[]);I.useEffect(function(){return bs.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",f,ys),document.addEventListener("touchmove",f,ys),document.addEventListener("touchstart",m,ys),function(){bs=bs.filter(function(S){return S!==s}),document.removeEventListener("wheel",f,ys),document.removeEventListener("touchmove",f,ys),document.removeEventListener("touchstart",m,ys)}},[]);var y=e.removeScrollBar,w=e.inert;return I.createElement(I.Fragment,null,w?I.createElement(s,{styles:lU(o)}):null,y?I.createElement(J$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function dU(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const fU=q$(q2,uU);var Ey=I.forwardRef(function(e,t){return I.createElement(Ff,Qr({},e,{ref:t,sideCar:fU}))});Ey.classNames=Ff.classNames;var pU=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},xs=new WeakMap,kd=new WeakMap,Id={},Mm=0,V2=function(e){return e&&(e.host||V2(e.parentNode))},hU=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=V2(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},mU=function(e,t,n,r){var o=hU(t,Array.isArray(e)?e:[e]);Id[n]||(Id[n]=new WeakMap);var s=Id[n],l=[],u=new Set,f=new Set(o),p=function(g){!g||u.has(g)||(u.add(g),p(g.parentNode))};o.forEach(p);var m=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(x){if(u.has(x))m(x);else try{var y=x.getAttribute(r),w=y!==null&&y!=="false",S=(xs.get(x)||0)+1,T=(s.get(x)||0)+1;xs.set(x,S),s.set(x,T),l.push(x),S===1&&w&&kd.set(x,!0),T===1&&x.setAttribute(n,"true"),w||x.setAttribute(r,"true")}catch(k){console.error("aria-hidden: cannot operate on ",x,k)}})};return m(t),u.clear(),Mm++,function(){l.forEach(function(g){var x=xs.get(g)-1,y=s.get(g)-1;xs.set(g,x),s.set(g,y),x||(kd.has(g)||g.removeAttribute(r),kd.delete(g)),y||g.removeAttribute(n)}),Mm--,Mm||(xs=new WeakMap,xs=new WeakMap,kd=new WeakMap,Id={})}},Z2=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=pU(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),mU(r,o,n,"aria-hidden")):function(){return null}},gU=Object.defineProperty,Er=(e,t)=>gU(e,"name",{value:t,configurable:!0}),_y="Dialog",[K2,IX]=Ta(_y),[vU,ri]=K2(_y),yU=Er(e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:l=!0}=e,u=I.useRef(null),f=I.useRef(null),[p,m]=Sc({prop:r,defaultProp:o??!1,onChange:s,caller:_y}),[g,x]=I.useState(0),[y,w]=I.useState(0);return h.jsx(vU,{scope:t,triggerRef:u,contentRef:f,contentId:fa(),titleId:fa(),descriptionId:fa(),titlePresent:g>0,descriptionPresent:y>0,setTitleCount:x,setDescriptionCount:w,open:p,onOpenChange:m,onOpenToggle:I.useCallback(()=>m(S=>!S),[m]),modal:l,children:n})},"Dialog"),Q2="DialogPortal",[bU,G2]=K2(Q2,{forceMount:void 0}),xU=Er(e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ri(Q2,t);return h.jsx(bU,{scope:t,forceMount:n,children:I.Children.map(r,l=>h.jsx(Ks,{present:n||s.open,children:h.jsx(Pv,{asChild:!0,container:o,children:l})}))})},"DialogPortal"),$g="DialogOverlay",wU=I.forwardRef(Er(function(t,n){const r=G2($g,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,l=ri($g,t.__scopeDialog);return l.modal?h.jsx(Ks,{present:o||l.open,children:h.jsx(kU,{...s,ref:n})}):null},"DialogOverlay")),SU=jo("DialogOverlay.RemoveScroll"),kU=I.forwardRef(Er(function(t,n){const{__scopeDialog:r,...o}=t,s=ri($g,r),l=WI(),u=Ut(n,l);return h.jsx(Ey,{as:SU,allowPinchZoom:!0,shards:[s.contentRef],children:h.jsx(Xt.div,{"data-state":Ay(s.open),...o,ref:u,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),Oc="DialogContent",IU=I.forwardRef(Er(function(t,n){const r=G2(Oc,t.__scopeDialog),{forceMount:o=r.forceMount,...s}=t,l=ri(Oc,t.__scopeDialog);return h.jsx(Ks,{present:o||l.open,children:l.modal?h.jsx(TU,{...s,ref:n}):h.jsx(jU,{...s,ref:n})})},"DialogContent")),TU=I.forwardRef(Er(function(t,n){const r=ri(Oc,t.__scopeDialog),o=I.useRef(null),s=Ut(n,r.contentRef,o);return I.useEffect(()=>{const l=o.current;if(l)return Z2(l)},[]),h.jsx(Y2,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:jt(t.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:jt(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&l.preventDefault()}),onFocusOutside:jt(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),jU=I.forwardRef(Er(function(t,n){const r=ri(Oc,t.__scopeDialog),o=I.useRef(!1),s=I.useRef(!1);return h.jsx(Y2,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),l.defaultPrevented||(o.current||r.triggerRef.current?.focus(),l.preventDefault()),o.current=!1,s.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),l.defaultPrevented||(o.current=!0,l.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&s.current&&l.preventDefault()}})},"DialogContentNonModal")),Y2=I.forwardRef(Er(function(t,n){const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:l,...u}=t,f=ri(Oc,r);return Hf(),h.jsx(h.Fragment,{children:h.jsx(M2,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:s,onUnmountAutoFocus:l,children:h.jsx(Tv,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionPresent?f.descriptionId:void 0,"aria-labelledby":f.titlePresent?f.titleId:void 0,"data-state":Ay(f.open),...u,ref:n,deferPointerDownOutside:!0,onDismiss:()=>f.onOpenChange(!1)})})})},"DialogContentImpl")),CU="DialogTitle",EU=I.forwardRef(Er(function(t,n){const{__scopeDialog:r,...o}=t,s=ri(CU,r),{setTitleCount:l}=s;return bn(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),h.jsx(Xt.h2,{id:s.titleId,...o,ref:n})},"DialogTitle")),_U="DialogDescription",AU=I.forwardRef(Er(function(t,n){const{__scopeDialog:r,...o}=t,s=ri(_U,r),{setDescriptionCount:l}=s;return bn(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),h.jsx(Xt.p,{id:s.descriptionId,...o,ref:n})},"DialogDescription")),MU="DialogClose",NU=I.forwardRef(Er(function(t,n){const{__scopeDialog:r,...o}=t,s=ri(MU,r);return h.jsx(Xt.button,{type:"button",...o,ref:n,onClick:jt(t.onClick,()=>s.onOpenChange(!1))})},"DialogClose"));function Ay(e){return e?"open":"closed"}Er(Ay,"getState");var PU=Object.defineProperty,RU=(e,t)=>PU(e,"name",{value:t,configurable:!0});function Ug(e,[t,n]){return Math.min(n,Math.max(t,e))}RU(Ug,"clamp");var OU=Object.defineProperty,yn=(e,t)=>OU(e,"name",{value:t,configurable:!0});function W2(e){const t=e+"CollectionProvider",[n,r]=Ta(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=yn(S=>{const{scope:T,children:k}=S,_=I.useRef(null),C=I.useRef(new Map).current;return h.jsx(o,{scope:T,itemMap:C,collectionRef:_,children:k})},"CollectionProvider");l.displayName=t;const u=e+"CollectionSlot",f=jo(u),p=I.forwardRef((S,T)=>{const{scope:k,children:_}=S,C=s(u,k),E=Ut(T,C.collectionRef);return h.jsx(f,{ref:E,children:_})});p.displayName=u;const m=e+"CollectionItemSlot",g="data-radix-collection-item",x=jo(m),y=I.forwardRef((S,T)=>{const{scope:k,children:_,...C}=S,E=I.useRef(null),O=Ut(T,E),M=s(m,k);return I.useEffect(()=>(M.itemMap.set(E,{ref:E,...C}),()=>{M.itemMap.delete(E)})),h.jsx(x,{[g]:"",ref:O,children:_})});y.displayName=m;function w(S){const T=s(e+"CollectionConsumer",S);return I.useCallback(()=>{const _=T.collectionRef.current;if(!_)return[];const C=Array.from(_.querySelectorAll(`[${g}]`));return Array.from(T.itemMap.values()).sort((M,R)=>C.indexOf(M.ref.current)-C.indexOf(R.ref.current))},[T.collectionRef,T.itemMap])}return yn(w,"useCollection"),[{Provider:l,Slot:p,ItemSlot:y},w,r]}yn(W2,"createCollection");var XS=new WeakMap,Nm=class xo extends Map{static{yn(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],XS.set(this,!0)}set(t,n){return XS.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,r){const o=this.has(n),s=this.#e.length,l=My(t);let u=l>=0?l:s+l;const f=u<0||u>=s?-1:u;if(f===this.size||o&&f===this.size-1||f===-1)return this.set(n,r),this;const p=this.size+(o?0:1);l<0&&u++;const m=[...this.#e];let g,x=!1;for(let y=u;y<p;y++)if(u===y){let w=m[y];m[y]===n&&(w=m[y+1]),o&&this.delete(n),g=this.get(w),this.set(n,r)}else{!x&&m[y-1]===n&&(x=!0);const w=m[x?y:y-1],S=g;g=this.get(w),this.delete(w),this.set(w,S)}return this}with(t,n,r){const o=new xo(this);return o.insert(t,n,r),o}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const o=this.#e.indexOf(t);return o===-1?this:this.insert(o,n,r)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,r){const o=this.#e.indexOf(t);return o===-1?this:this.insert(o+1,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=qd(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=qd(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return qd(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(t,n){let r=0;for(const o of this){if(Reflect.apply(t,n,[o,r,this]))return o;r++}}findIndex(t,n){let r=0;for(const o of this){if(Reflect.apply(t,n,[o,r,this]))return r;r++}return-1}filter(t,n){const r=[];let o=0;for(const s of this)Reflect.apply(t,n,[s,o,this])&&r.push(s),o++;return new xo(r)}map(t,n){const r=[];let o=0;for(const s of this)r.push([s[0],Reflect.apply(t,n,[s,o,this])]),o++;return new xo(r)}reduce(...t){const[n,r]=t;let o=0,s=r??this.at(0);for(const l of this)o===0&&t.length===1?s=l:s=Reflect.apply(n,this,[s,l,o,this]),o++;return s}reduceRight(...t){const[n,r]=t;let o=r??this.at(-1);for(let s=this.size-1;s>=0;s--){const l=this.at(s);s===this.size-1&&t.length===1?o=l:o=Reflect.apply(n,this,[o,l,s,this])}return o}toSorted(t){const n=[...this.entries()].sort(t);return new xo(n)}toReversed(){const t=new xo;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),o=this.get(r);t.set(r,o)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new xo(n)}slice(t,n){const r=new xo;let o=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(o=n-1);for(let s=t;s<=o;s++){const l=this.keyAt(s),u=this.get(l);r.set(l,u)}return r}every(t,n){let r=0;for(const o of this){if(!Reflect.apply(t,n,[o,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const o of this){if(Reflect.apply(t,n,[o,r,this]))return!0;r++}return!1}};function qd(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=X2(e,t);return n===-1?void 0:e[n]}yn(qd,"at");function X2(e,t){const n=e.length,r=My(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}yn(X2,"toSafeIndex");function My(e){return e!==e||e===0?0:Math.trunc(e)}yn(My,"toSafeInteger");function zU(e){const t=e+"CollectionProvider",[n,r]=Ta(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Nm,setItemMap:yn(()=>{},"setItemMap")}),l=yn(({state:C,...E})=>C?h.jsx(f,{...E,state:C}):h.jsx(u,{...E}),"CollectionProvider");l.displayName=t;const u=yn(C=>{const E=T();return h.jsx(f,{...C,state:E})},"CollectionInit");u.displayName=t+"Init";const f=yn(C=>{const{scope:E,children:O,state:M}=C,R=I.useRef(null),[z,K]=I.useState(null),q=Ut(R,K),[Z,Y]=M;return I.useEffect(()=>{if(!z)return;const ae=tC(()=>{});return ae.observe(z,{childList:!0,subtree:!0}),()=>{ae.disconnect()}},[z]),h.jsx(o,{scope:E,itemMap:Z,setItemMap:Y,collectionRef:q,collectionRefObject:R,collectionElement:z,children:O})},"CollectionProviderImpl");f.displayName=t+"Impl";const p=e+"CollectionSlot",m=jo(p),g=I.forwardRef((C,E)=>{const{scope:O,children:M}=C,R=s(p,O),z=Ut(E,R.collectionRef);return h.jsx(m,{ref:z,children:M})});g.displayName=p;const x=e+"CollectionItemSlot",y="data-radix-collection-item",w=jo(x),S=I.forwardRef((C,E)=>{const{scope:O,children:M,...R}=C,z=I.useRef(null),[K,q]=I.useState(null),Z=Ut(E,z,q),Y=s(x,O),{setItemMap:ae}=Y,J=I.useRef(R);J2(J.current,R)||(J.current=R);const he=J.current;return I.useEffect(()=>{const F=he;return ae(ee=>K?ee.has(K)?ee.set(K,{...F,element:K}).toSorted(Hg):(ee.set(K,{...F,element:K}),ee.toSorted(Hg)):ee),()=>{ae(ee=>!K||!ee.has(K)?ee:(ee.delete(K),new Nm(ee)))}},[K,he,ae]),h.jsx(w,{[y]:"",ref:Z,children:M})});S.displayName=x;function T(){return I.useState(new Nm)}yn(T,"useInitCollection");function k(C){const{itemMap:E}=s(e+"CollectionConsumer",C);return E}return yn(k,"useCollection"),[{Provider:l,Slot:g,ItemSlot:S},{createCollectionScope:r,useCollection:k,useInitCollection:T}]}yn(zU,"createCollection");function J2(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}yn(J2,"shallowEqual");function eC(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}yn(eC,"isElementPreceding");function Hg(e,t){return!e[1].element||!t[1].element?0:eC(e[1].element,t[1].element)?-1:1}yn(Hg,"sortByDocumentPosition");function tC(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}yn(tC,"getChildListObserver");var DU=Object.defineProperty,LU=(e,t)=>DU(e,"name",{value:t,configurable:!0}),BU=I.createContext(void 0);function nC(e){const t=I.useContext(BU);return e||t||"ltr"}LU(nC,"useDirection");var qU=Object.defineProperty,$U=(e,t)=>qU(e,"name",{value:t,configurable:!0});function rC(e){const t=I.useRef({value:e,previous:e});return I.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}$U(rC,"usePrevious");var UU=Object.defineProperty,Ct=(e,t)=>UU(e,"name",{value:t,configurable:!0}),HU=[" ","Enter","ArrowUp","ArrowDown"],FU=[" ","Enter"],Ls="Select",[Vf,Ny,VU]=W2(Ls),[Ma,TX]=Ta(Ls,[VU,xf]),Py=xf(),[ZU,zo]=Ma(Ls),[KU,QU]=Ma(Ls);function iC(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:l,defaultValue:u,onValueChange:f,dir:p,name:m,autoComplete:g,disabled:x,required:y,form:w,internal_do_not_use_render:S}=e,T=Py(t),[k,_]=I.useState(null),[C,E]=I.useState(null),[O,M]=I.useState(!1),R=nC(p),[z,K]=Sc({prop:r,defaultProp:o??!1,onChange:s,caller:Ls}),[q,Z]=Sc({prop:l,defaultProp:u,onChange:f,caller:Ls}),Y=I.useRef(null),ae=I.useRef(q);I.useEffect(()=>{const te=w?k?.ownerDocument.getElementById(w):k?.form;if(te instanceof HTMLFormElement){const A=Ct(()=>Z(ae.current),"reset");return te.addEventListener("reset",A),()=>te.removeEventListener("reset",A)}},[w,k,Z]);const J=k?!!w||!!k.closest("form"):!0,[he,F]=I.useState(new Set),ee=fa(),Q=Array.from(he).map(te=>te.props.value).join(";"),xe=I.useCallback(te=>{F(A=>new Set(A).add(te))},[]),P=I.useCallback(te=>{F(A=>{const L=new Set(A);return L.delete(te),L})},[]),$={required:y,trigger:k,onTriggerChange:_,valueNode:C,onValueNodeChange:E,valueNodeHasChildren:O,onValueNodeHasChildrenChange:M,contentId:ee,value:q,onValueChange:Z,open:z,onOpenChange:K,dir:R,triggerPointerDownPosRef:Y,disabled:x,name:m,autoComplete:g,form:w,nativeOptions:he,nativeSelectKey:Q,isFormControl:J};return h.jsx(vT,{...T,children:h.jsx(ZU,{scope:t,...$,children:h.jsx(Vf.Provider,{scope:t,children:h.jsx(KU,{scope:t,onNativeOptionAdd:xe,onNativeOptionRemove:P,children:sC(S)?S($):n})})})})}Ct(iC,"SelectProvider");var GU=Ct(e=>{const{__scopeSelect:t,children:n,...r}=e;return h.jsx(iC,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:o})=>h.jsxs(h.Fragment,{children:[n,o?h.jsx(xH,{__scopeSelect:t}):null]})})},"Select"),YU="SelectTrigger",WU=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,disabled:o=!1,...s}=t,l=Py(r),u=zo(YU,r),f=u.disabled||o,p=Ut(n,u.onTriggerChange),m=Ny(r),g=I.useRef("touch"),[x,y,w]=Ry(T=>{const k=m().filter(E=>!E.disabled),_=k.find(E=>E.value===u.value),C=Oy(k,T,_);C!==void 0&&u.onValueChange(C.value)}),S=Ct(T=>{f||(u.onOpenChange(!0),w()),T&&(u.triggerPointerDownPosRef.current={x:Math.round(T.pageX),y:Math.round(T.pageY)})},"handleOpen");return h.jsx(yT,{asChild:!0,...l,children:h.jsx(Xt.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:f,"data-disabled":f?"":void 0,"data-placeholder":Qc(u.value)?"":void 0,...s,ref:p,onClick:jt(s.onClick,T=>{T.currentTarget.focus(),g.current!=="mouse"&&S(T)}),onPointerDown:jt(s.onPointerDown,T=>{g.current=T.pointerType;const k=T.target;k.hasPointerCapture(T.pointerId)&&k.releasePointerCapture(T.pointerId),T.button===0&&T.ctrlKey===!1&&T.pointerType==="mouse"&&(S(T),T.preventDefault())}),onKeyDown:jt(s.onKeyDown,T=>{const k=x.current!=="";!(T.ctrlKey||T.altKey||T.metaKey)&&T.key.length===1&&y(T.key),!(k&&T.key===" ")&&HU.includes(T.key)&&(S(),T.preventDefault())})})})},"SelectTrigger")),XU="SelectValue",JU=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,className:o,style:s,children:l,placeholder:u="",...f}=t,p=zo(XU,r),{onValueNodeHasChildrenChange:m}=p,g=l!==void 0,x=Ut(n,p.onValueNodeChange);bn(()=>{m(g)},[m,g]);const y=Qc(p.value);return h.jsx(Xt.span,{...f,asChild:y?!1:f.asChild,ref:x,style:{pointerEvents:"none"},children:h.jsx(I.Fragment,{children:y?u:l},y?"placeholder":"value")})},"SelectValue")),eH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,children:o,...s}=t;return h.jsx(Xt.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),tH="SelectPortal",[nH,rH]=Ma(tH,{forceMount:void 0}),iH=Ct(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return h.jsx(nH,{scope:e.__scopeSelect,forceMount:n,children:h.jsx(Pv,{asChild:!0,...r})})},"SelectPortal"),xa="SelectContent",oH=I.forwardRef(Ct(function(t,n){const r=rH(xa,t.__scopeSelect),{forceMount:o=r.forceMount,...s}=t,l=zo(xa,t.__scopeSelect),[u,f]=I.useState();return bn(()=>{f(new DocumentFragment)},[]),h.jsx(Ks,{present:o||l.open,children:({present:p})=>p?h.jsx(lH,{...s,ref:n}):h.jsx(aH,{...s,fragment:u})})},"SelectContent")),aH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,children:o,fragment:s}=t;return s?ja.createPortal(h.jsx(oC,{scope:r,children:h.jsx(Vf.Slot,{scope:r,children:h.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),Nr=10,[oC,Zf]=Ma(xa),sH=jo("SelectContent.RemoveScroll"),lH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r}=t,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:l,onPointerDownOutside:u,side:f,sideOffset:p,align:m,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:w,sticky:S,hideWhenDetached:T,avoidCollisions:k,..._}=t,C=zo(xa,r),[E,O]=I.useState(null),[M,R]=I.useState(null),z=Ut(n,O),[K,q]=I.useState(null),[Z,Y]=I.useState(null),ae=Ny(r),[J,he]=I.useState(!1),F=I.useRef(!1);I.useEffect(()=>{if(E)return Z2(E)},[E]),Hf();const ee=I.useCallback(ge=>{const[Se,...B]=ae().map(_e=>_e.ref.current),[U]=B.slice(-1),ve=document.activeElement;for(const _e of ge)if(_e===ve||(_e?.scrollIntoView({block:"nearest"}),_e===Se&&M&&(M.scrollTop=0),_e===U&&M&&(M.scrollTop=M.scrollHeight),_e?.focus(),document.activeElement!==ve))return},[ae,M]),Q=I.useCallback(()=>ee([K,E]),[ee,K,E]);I.useEffect(()=>{J&&Q()},[J,Q]);const{onOpenChange:xe,triggerPointerDownPosRef:P}=C;I.useEffect(()=>{if(E){let ge={x:0,y:0};const Se=Ct(U=>{ge={x:Math.abs(Math.round(U.pageX)-(P.current?.x??0)),y:Math.abs(Math.round(U.pageY)-(P.current?.y??0))}},"handlePointerMove"),B=Ct(U=>{ge.x<=10&&ge.y<=10?U.preventDefault():U.composedPath().includes(E)||xe(!1),document.removeEventListener("pointermove",Se),P.current=null},"handlePointerUp");return P.current!==null&&(document.addEventListener("pointermove",Se),document.addEventListener("pointerup",B,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Se),document.removeEventListener("pointerup",B,{capture:!0})}}},[E,xe,P]),I.useEffect(()=>{const ge=Ct(()=>xe(!1),"close");return window.addEventListener("blur",ge),window.addEventListener("resize",ge),()=>{window.removeEventListener("blur",ge),window.removeEventListener("resize",ge)}},[xe]);const[$,te]=Ry(ge=>{const Se=ae().filter(ve=>!ve.disabled),B=Se.find(ve=>ve.ref.current===document.activeElement),U=Oy(Se,ge,B);U&&setTimeout(()=>U.ref.current?.focus())}),A=I.useCallback((ge,Se,B)=>{const U=!F.current&&!B;(C.value!==void 0&&C.value===Se||U)&&(q(ge),U&&(F.current=!0))},[C.value]),L=I.useCallback(()=>E?.focus(),[E]),X=I.useCallback((ge,Se,B)=>{const U=!F.current&&!B;(C.value!==void 0&&C.value===Se||U)&&Y(ge)},[C.value]),ue=o==="popper"?JS:cH,we=ue===JS?{side:f,sideOffset:p,align:m,alignOffset:g,arrowPadding:x,collisionBoundary:y,collisionPadding:w,sticky:S,hideWhenDetached:T,avoidCollisions:k}:{};return h.jsx(oC,{scope:r,content:E,viewport:M,onViewportChange:R,itemRefCallback:A,selectedItem:K,onItemLeave:L,itemTextRefCallback:X,focusSelectedItem:Q,selectedItemText:Z,position:o,isPositioned:J,searchRef:$,children:h.jsx(Ey,{as:sH,allowPinchZoom:!0,children:h.jsx(M2,{asChild:!0,trapped:C.open,onMountAutoFocus:ge=>{ge.preventDefault()},onUnmountAutoFocus:jt(s,ge=>{C.trigger?.focus({preventScroll:!0}),ge.preventDefault()}),children:h.jsx(Tv,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ge=>ge.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:h.jsx(ue,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ge=>ge.preventDefault(),..._,...we,onPlaced:()=>he(!0),ref:z,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:jt(_.onKeyDown,ge=>{const Se=ge.ctrlKey||ge.altKey||ge.metaKey;if(ge.key==="Tab"&&ge.preventDefault(),!Se&&ge.key.length===1&&te(ge.key),["ArrowUp","ArrowDown","Home","End"].includes(ge.key)){let U=ae().filter(ve=>!ve.disabled).map(ve=>ve.ref.current);if(["ArrowUp","End"].includes(ge.key)&&(U=U.slice().reverse()),["ArrowUp","ArrowDown"].includes(ge.key)){const ve=ge.target,_e=U.indexOf(ve);U=U.slice(_e+1)}setTimeout(()=>ee(U)),ge.preventDefault()}})})})})})})},"SelectContentImpl")),cH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,onPlaced:o,...s}=t,l=zo(xa,r),u=Zf(xa,r),[f,p]=I.useState(null),[m,g]=I.useState(null),x=Ut(n,g),y=Ny(r),w=I.useRef(!1),S=I.useRef(!0),{viewport:T,selectedItem:k,selectedItemText:_,focusSelectedItem:C}=u,E=I.useCallback(()=>{if(l.trigger&&l.valueNode&&f&&m&&T&&k&&_){const z=l.trigger.getBoundingClientRect(),K=m.getBoundingClientRect(),q=l.valueNode.getBoundingClientRect(),Z=_.getBoundingClientRect();if(l.dir!=="rtl"){const ve=Z.left-K.left,_e=q.left-ve,qe=z.left-_e,Qe=z.width+qe,ze=Math.max(Qe,K.width),ut=window.innerWidth-Nr,Kt=Ug(_e,[Nr,Math.max(Nr,ut-ze)]);f.style.minWidth=Qe+"px",f.style.left=Kt+"px"}else{const ve=K.right-Z.right,_e=window.innerWidth-q.right-ve,qe=window.innerWidth-z.right-_e,Qe=z.width+qe,ze=Math.max(Qe,K.width),ut=window.innerWidth-Nr,Kt=Ug(_e,[Nr,Math.max(Nr,ut-ze)]);f.style.minWidth=Qe+"px",f.style.right=Kt+"px"}const Y=y(),ae=window.innerHeight-Nr*2,J=T.scrollHeight,he=window.getComputedStyle(m),F=parseInt(he.borderTopWidth,10),ee=parseInt(he.paddingTop,10),Q=parseInt(he.borderBottomWidth,10),xe=parseInt(he.paddingBottom,10),P=F+ee+J+xe+Q,$=Math.min(k.offsetHeight*5,P),te=window.getComputedStyle(T),A=parseInt(te.paddingTop,10),L=parseInt(te.paddingBottom,10),X=z.top+z.height/2-Nr,ue=ae-X,we=k.offsetHeight/2,ge=k.offsetTop+we,Se=F+ee+ge,B=P-Se;if(Se<=X){const ve=Y.length>0&&k===Y[Y.length-1].ref.current;f.style.bottom="0px";const _e=m.clientHeight-T.offsetTop-T.offsetHeight,qe=Math.max(ue,we+(ve?L:0)+_e+Q),Qe=Se+qe;f.style.height=Qe+"px"}else{const ve=Y.length>0&&k===Y[0].ref.current;f.style.top="0px";const qe=Math.max(X,F+T.offsetTop+(ve?A:0)+we)+B;f.style.height=qe+"px",T.scrollTop=Se-X+T.offsetTop}f.style.margin=`${Nr}px 0`,f.style.minHeight=$+"px",f.style.maxHeight=ae+"px",o?.(),requestAnimationFrame(()=>w.current=!0)}},[y,l.trigger,l.valueNode,f,m,T,k,_,l.dir,o]);bn(()=>E(),[E]);const[O,M]=I.useState();bn(()=>{m&&M(window.getComputedStyle(m).zIndex)},[m]);const R=I.useCallback(z=>{z&&S.current===!0&&(E(),C?.(),S.current=!1)},[E,C]);return h.jsx(uH,{scope:r,contentWrapper:f,shouldExpandOnScrollRef:w,onScrollButtonChange:R,children:h.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:O},children:h.jsx(Xt.div,{...s,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),JS=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,align:o="start",collisionPadding:s=Nr,...l}=t,u=Py(r);return h.jsx(bT,{...u,...l,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[uH,dH]=Ma(xa,{}),ek="SelectViewport",fH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,nonce:o,...s}=t,l=Zf(ek,r),u=dH(ek,r),f=Ut(n,l.onViewportChange),p=I.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),h.jsx(Vf.Slot,{scope:r,children:h.jsx(Xt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:f,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:jt(s.onScroll,m=>{const g=m.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:y}=u;if(y?.current&&x){const w=Math.abs(p.current-g.scrollTop);if(w>0){const S=window.innerHeight-Nr*2,T=parseFloat(x.style.minHeight),k=parseFloat(x.style.height),_=Math.max(T,k);if(_<S){const C=_+w,E=Math.min(S,C),O=C-E;x.style.height=E+"px",x.style.bottom==="0px"&&(g.scrollTop=O>0?O:0,x.style.justifyContent="flex-end")}}}p.current=g.scrollTop})})})]})},"SelectViewport")),pH="SelectGroup",[jX,CX]=Ma(pH),Fg="SelectItem",[hH,aC]=Ma(Fg),mH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,value:o,disabled:s=!1,textValue:l,...u}=t,f=zo(Fg,r),p=Zf(Fg,r),m=f.value===o,[g,x]=I.useState(l??""),[y,w]=I.useState(!1),S=Wr(E=>p.itemRefCallback?.(E,o,s)),T=Ut(n,S),k=fa(),_=I.useRef("touch"),C=Ct(()=>{s||(f.onValueChange(o),f.onOpenChange(!1))},"handleSelect");return h.jsx(hH,{scope:r,value:o,disabled:s,textId:k,isSelected:m,onItemTextChange:I.useCallback(E=>{x(O=>O||(E?.textContent??"").trim())},[]),children:h.jsx(Vf.ItemSlot,{scope:r,value:o,disabled:s,textValue:g,children:h.jsx(Xt.div,{role:"option","aria-labelledby":k,"data-highlighted":y?"":void 0,"aria-selected":m&&y,"data-state":m?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...u,ref:T,onFocus:jt(u.onFocus,()=>w(!0)),onBlur:jt(u.onBlur,()=>w(!1)),onClick:jt(u.onClick,()=>{_.current!=="mouse"&&C()}),onPointerUp:jt(u.onPointerUp,()=>{_.current==="mouse"&&C()}),onPointerDown:jt(u.onPointerDown,E=>{_.current=E.pointerType}),onPointerMove:jt(u.onPointerMove,E=>{_.current=E.pointerType,s?p.onItemLeave?.():_.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:jt(u.onPointerLeave,E=>{E.currentTarget===document.activeElement&&p.onItemLeave?.()}),onKeyDown:jt(u.onKeyDown,E=>{s||E.target!==E.currentTarget||p.searchRef?.current!==""&&E.key===" "||(FU.includes(E.key)&&C(),E.key===" "&&E.preventDefault())})})})})},"SelectItem")),Td="SelectItemText",gH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,className:o,style:s,...l}=t,u=zo(Td,r),f=Zf(Td,r),p=aC(Td,r),m=QU(Td,r),[g,x]=I.useState(null),y=Wr(C=>f.itemTextRefCallback?.(C,p.value,p.disabled)),w=Ut(n,x,p.onItemTextChange,y),S=g?.textContent,T=I.useMemo(()=>h.jsx("option",{value:p.value,disabled:p.disabled,children:S},p.value),[p.disabled,p.value,S]),{onNativeOptionAdd:k,onNativeOptionRemove:_}=m;return bn(()=>(k(T),()=>_(T)),[k,_,T]),h.jsxs(h.Fragment,{children:[h.jsx(Xt.span,{id:p.textId,...l,ref:w}),p.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Qc(u.value)?ja.createPortal(l.children,u.valueNode):null]})},"SelectItemText")),vH="SelectItemIndicator",yH=I.forwardRef(Ct(function(t,n){const{__scopeSelect:r,...o}=t;return aC(vH,r).isSelected?h.jsx(Xt.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),bH="SelectBubbleInput",xH=I.forwardRef(Ct(function({__scopeSelect:t,...n},r){const o=zo(bH,t),{value:s,onValueChange:l,required:u,disabled:f,name:p,autoComplete:m,form:g}=o,{nativeOptions:x,nativeSelectKey:y}=o,w=I.useRef(null),S=Ut(r,w),T=s??"",k=rC(T),_=Array.from(x).some(C=>(C.props.value??"")==="");return I.useEffect(()=>{const C=w.current;if(!C)return;const E=window.HTMLSelectElement.prototype,M=Object.getOwnPropertyDescriptor(E,"value").set;if(k!==T&&M){const R=new Event("change",{bubbles:!0});M.call(C,T),C.dispatchEvent(R)}},[k,T]),h.jsxs(Xt.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:p,autoComplete:m,disabled:f,form:g,onChange:C=>l(C.target.value),...n,style:{...CT,...n.style},ref:S,defaultValue:T,children:[Qc(s)&&!_?h.jsx("option",{value:""}):null,Array.from(x)]},y)},"SelectBubbleInput"));function sC(e){return typeof e=="function"}Ct(sC,"isFunction");function Qc(e){return e===""||e===void 0}Ct(Qc,"shouldShowPlaceholder");function Ry(e){const t=Wr(e),n=I.useRef(""),r=I.useRef(0),o=I.useCallback(l=>{const u=n.current+l;t(u),Ct((function f(p){n.current=p,window.clearTimeout(r.current),p!==""&&(r.current=window.setTimeout(()=>f(""),1e3))}),"updateSearch")(u)},[t]),s=I.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}Ct(Ry,"useTypeaheadSearch");function Oy(e,t,n){const o=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=lC(e,Math.max(s,0));o.length===1&&(l=l.filter(p=>p!==n));const f=l.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return f!==n?f:void 0}Ct(Oy,"findNextItem");function lC(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ct(lC,"wrapArray");const wH={neutral:"text-[var(--muted-fg)]",accent:"text-[var(--accent-soft)]",info:"text-[var(--status-info-fg)]",success:"text-[var(--status-success-fg)]",warning:"text-[var(--status-warning-fg)]",danger:"text-[var(--status-danger-fg)]"},cC={neutral:"border-[var(--control-border)] bg-[var(--control)] text-[var(--muted-fg)]",accent:"border-[var(--accent)]/30 bg-[var(--accent)]/10 text-[var(--accent-soft)]",info:"border-[var(--status-info-border)] bg-[var(--status-info-bg)] text-[var(--status-info-fg)]",success:"border-[var(--status-success-border)] bg-[var(--status-success-bg)] text-[var(--status-success-fg)]",warning:"border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] text-[var(--status-warning-fg)]",danger:"border-[var(--status-danger-border)] bg-[var(--status-danger-bg)] text-[var(--status-danger-fg)]"},SH={primary:"border-transparent bg-[var(--button)] text-[var(--button-fg)] hover:bg-[var(--button-hover)]",secondary:"border-[var(--control-border)] bg-[var(--control)] text-[var(--subtle-fg)] hover:bg-[var(--hover)]",ghost:"border-transparent bg-transparent text-[var(--muted-fg)] hover:bg-[var(--hover)] hover:text-[var(--fg)]",warning:"border-transparent bg-[var(--action-warning-bg)] text-[var(--action-warning-fg)] hover:bg-[var(--action-warning-hover)]",danger:"border-transparent bg-[var(--action-danger-bg)] text-[var(--action-danger-fg)] hover:bg-[var(--action-danger-hover)]"};function Je({className:e,type:t="button",variant:n="primary",...r}){return h.jsx("button",{type:t,"data-variant":n,className:Me("inline-flex h-8 items-center justify-center gap-1.5 rounded-lg border px-3 type-ui font-medium outline-none transition focus-visible:ring-2 focus-visible:ring-[var(--accent)]/60","disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)] disabled:opacity-100 disabled:shadow-none",SH[n],e),...r})}const kH={neutral:"border-transparent bg-transparent text-[var(--muted-fg)] enabled:hover:bg-[var(--hover)] enabled:hover:text-[var(--fg)]",accent:"border-[var(--accent)]/30 bg-[var(--accent)]/10 text-[var(--accent-soft)] enabled:hover:bg-[var(--accent)]/15",info:"border-[var(--status-info-border)] bg-[var(--status-info-bg)] text-[var(--status-info-fg)] enabled:hover:brightness-95",success:"border-[var(--status-success-border)] bg-[var(--status-success-bg)] text-[var(--status-success-fg)] enabled:hover:brightness-95",warning:"border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] text-[var(--status-warning-fg)] enabled:hover:brightness-95",danger:"border-[var(--status-danger-border)] bg-[var(--status-danger-bg)] text-[var(--status-danger-fg)] enabled:hover:brightness-95"};function At({label:e,className:t,children:n,tone:r="neutral",...o}){return h.jsx(_o,{content:e,children:h.jsx("button",{type:"button","aria-label":e,"data-tone":r,className:Me("inline-flex size-8 shrink-0 items-center justify-center rounded-lg border outline-none transition focus-visible:ring-2 focus-visible:ring-[var(--accent)]/60","disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)] disabled:opacity-100",kH[r],t),...o,children:n})})}function _o({children:e,content:t,side:n="right"}){return h.jsxs(kR,{delayDuration:350,children:[h.jsx(IR,{asChild:!0,children:e}),h.jsx(TR,{children:h.jsxs(jR,{side:n,sideOffset:7,className:"z-[100] rounded-md border border-[var(--border-strong)] bg-[var(--popover)] px-2 py-1.5 type-meta text-[var(--fg)] shadow-2xl animate-in fade-in zoom-in-95",children:[t,h.jsx(CR,{className:"fill-[var(--popover)]"})]})})]})}function uC({value:e,onValueChange:t,options:n,ariaLabel:r,className:o,compactIcon:s,disabled:l=!1}){const u=n.find(p=>p.value===e),f=(p="neutral")=>wH[p];return h.jsxs(GU,{value:e,onValueChange:t,disabled:l,children:[h.jsxs(WU,{"aria-label":r,title:s?u?.label:void 0,className:Me("inline-flex h-8 min-w-0 items-center justify-between gap-2 whitespace-nowrap rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-2.5 type-ui font-normal text-[var(--fg)] outline-none transition","hover:border-[var(--border-strong)] focus:ring-2 focus:ring-[var(--accent)]/35 data-[placeholder]:text-[var(--muted-fg)] disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",o),children:[s&&h.jsx("span",{"aria-hidden":"true",className:"select-compact-icon hidden",children:s}),h.jsx(JU,{children:u&&h.jsxs("span",{className:Me("flex min-w-0 items-center gap-2",s&&"select-expanded-value"),children:[h.jsx("span",{className:"truncate",children:u.label}),u.status&&h.jsx("span",{"data-tone":u.statusTone??"neutral",className:Me("shrink-0 type-meta",f(u.statusTone)),children:u.status})]})}),h.jsx(eH,{className:s?"select-expanded-chevron":void 0,children:h.jsx(Gs,{className:"size-3.5 text-[var(--muted-fg)]"})})]}),h.jsx(iH,{children:h.jsx(oH,{position:"popper",sideOffset:5,className:"z-[100] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-xl border border-[var(--border-strong)] bg-[var(--popover)] p-1 shadow-2xl",children:h.jsx(fH,{children:n.map(p=>h.jsxs(mH,{value:p.value,className:"relative flex min-h-8 cursor-default select-none items-center rounded-lg py-1.5 pl-8 pr-3 type-ui font-normal text-[var(--fg)] outline-none data-[highlighted]:bg-[var(--hover)]",children:[h.jsx("span",{className:"absolute left-2.5",children:h.jsx(yH,{children:h.jsx(Lv,{className:"size-3.5 text-[var(--accent)]"})})}),h.jsxs("span",{className:"flex min-w-0 flex-col",children:[h.jsx(gH,{children:p.label}),p.description&&h.jsx("span",{className:"truncate type-meta text-[var(--muted-fg)]",children:p.description}),p.status&&h.jsx("span",{"data-tone":p.statusTone??"neutral",className:Me("truncate type-meta",f(p.statusTone)),children:p.status})]})]},p.value))})})})]})}function Tr({open:e,onOpenChange:t,title:n,description:r,children:o,footer:s,contentClassName:l,closeDisabled:u=!1}){return h.jsx(yU,{open:e,onOpenChange:f=>{!f&&u||t(f)},children:h.jsxs(xU,{children:[h.jsx(wU,{className:"fixed inset-0 z-50 bg-black/65 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=open]:fade-in"}),h.jsxs(IU,{onEscapeKeyDown:f=>{u&&f.preventDefault()},onPointerDownOutside:f=>{u&&f.preventDefault()},className:Me("fixed left-1/2 top-1/2 z-50 w-[min(520px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-[var(--border-strong)] bg-[var(--panel-solid)] shadow-[0_30px_100px_rgba(0,0,0,.55)] outline-none data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95",l),children:[h.jsxs("div",{className:"border-b border-[var(--border)] px-5 py-4",children:[h.jsx(EU,{className:"text-[15px] font-semibold text-[var(--fg)]",children:n}),r&&h.jsx(AU,{className:"mt-1 type-ui leading-5 text-[var(--muted-fg)]",children:r})]}),h.jsx("div",{className:"px-5 py-4",children:o}),s&&h.jsx("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-3",children:s}),h.jsx(NU,{"aria-label":"关闭",disabled:u,className:"absolute right-3 top-3 inline-flex size-8 items-center justify-center rounded-lg text-[var(--muted-fg)] hover:bg-[var(--hover)] hover:text-[var(--fg)] disabled:cursor-not-allowed disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",children:h.jsx(ei,{className:"size-4"})})]})]})})}function hc({children:e,tone:t="neutral",className:n}){return h.jsx("span",{"data-tone":t,className:Me("inline-flex h-5 items-center rounded-full border px-2 type-meta font-medium",cC[t],n),children:e})}function On({tone:e="neutral",icon:t,children:n,className:r,...o}){return h.jsxs("div",{"data-tone":e,className:Me("flex items-start gap-2 rounded-xl border p-3 type-ui leading-5",cC[e],r),...o,children:[t&&h.jsx("span",{className:"mt-0.5 shrink-0",children:t}),h.jsx("div",{className:"min-w-0 flex-1",children:n})]})}const IH=[{id:"workbench",label:"工作台",icon:ZO},{id:"plugins",label:"插件",icon:FR},{id:"logs",label:"日志",icon:SO},{id:"settings",label:"设置",icon:WT}];function TH(){const e=D(o=>o.route),t=D(o=>o.setRoute),n=D(o=>o.plugins),r=I.useMemo(()=>n.flatMap(o=>o.state==="active"&&o.trusted&&o.uiEntryUrl?o.contributions.filter(s=>s.kind==="leftNav").map(s=>({plugin:o,contribution:s})):[]),[n]);return h.jsxs("aside",{className:"relative z-20 flex h-full w-14 shrink-0 flex-col items-center border-r border-[var(--border)] bg-[var(--rail)] py-3",children:[h.jsx("div",{className:"mb-5 flex size-9 items-center justify-center rounded-xl bg-[linear-gradient(145deg,#7157ff,#4e42d7)] text-white shadow-[0_8px_24px_rgba(104,80,255,.35)]",children:h.jsxs("span",{className:"relative flex size-5 items-center justify-center",children:[h.jsx(Qs,{className:"size-5",strokeWidth:2.2}),h.jsx(XT,{className:"absolute -right-1 -top-1 size-2.5 fill-white"})]})}),h.jsxs("nav",{"aria-label":"主导航",className:"flex w-full flex-1 flex-col items-center gap-1.5",children:[IH.map(o=>{const s=o.icon,l=e===o.id;return h.jsx(_o,{content:o.label,children:h.jsxs("button",{type:"button","aria-label":o.label,"aria-current":l?"page":void 0,onClick:()=>t(o.id),className:Me("relative flex size-10 items-center justify-center rounded-xl text-[var(--muted-fg)] transition","hover:bg-[var(--hover)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]/60",l&&"bg-[var(--accent)]/15 text-[var(--accent-soft)] shadow-[inset_0_0_0_1px_rgba(116,88,255,.2)]"),children:[l&&h.jsx("span",{className:"absolute -left-[7px] h-5 w-[3px] rounded-r bg-[var(--accent)]"}),h.jsx(s,{className:"size-[18px]",strokeWidth:1.8})]})},o.id)}),r.length>0&&h.jsx("span",{className:"my-1 h-px w-6 bg-[var(--border)]"}),r.map(({plugin:o,contribution:s})=>{const l=`plugin:${o.id}:${s.id}`,u=e===l;return h.jsx(_o,{content:s.label,children:h.jsxs("button",{type:"button","aria-label":s.label,"aria-current":u?"page":void 0,onClick:()=>t(l),className:Me("relative flex size-10 items-center justify-center rounded-xl text-[var(--muted-fg)] transition hover:bg-[var(--hover)] hover:text-[var(--fg)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]/60",u&&"bg-[var(--selected)] text-[var(--accent-soft)] ring-1 ring-[var(--border-strong)]"),children:[u&&h.jsx("span",{className:"absolute -left-[7px] h-5 w-[3px] rounded-r bg-[var(--accent)]"}),s.id.includes("stats")?h.jsx(QR,{className:"size-[18px]",strokeWidth:1.8}):h.jsx(cz,{className:"size-[18px]",strokeWidth:1.8})]})},l)})]}),h.jsxs("div",{className:"flex flex-col items-center gap-2",children:[h.jsx("div",{className:"flex size-8 items-center justify-center rounded-full bg-[linear-gradient(145deg,#2f3650,#151a29)] type-meta font-semibold text-white ring-1 ring-white/10",children:"LM"}),h.jsx("span",{className:"size-1.5 rounded-full bg-[var(--status-success-fg)] shadow-sm"})]})]})}function jH({toast:e}){const t=D(r=>r.dismissToast);I.useEffect(()=>{const r=setTimeout(()=>t(e.id),4500);return()=>clearTimeout(r)},[t,e.id]);const n=e.tone==="success"?kf:e.tone==="danger"?BT:BO;return h.jsxs("div",{className:"pointer-events-auto flex w-[340px] items-start gap-3 rounded-xl border border-[var(--border-strong)] bg-[var(--popover)] p-3 shadow-2xl animate-in slide-in-from-right-4 fade-in",children:[h.jsx(n,{className:Me("mt-0.5 size-4 shrink-0",e.tone==="success"?"text-[var(--status-success-fg)]":e.tone==="danger"?"text-[var(--status-danger-fg)]":"text-[var(--status-info-fg)]")}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"type-ui font-medium text-[var(--fg)]",children:e.title}),e.description&&h.jsx("p",{className:"mt-0.5 type-meta text-[var(--muted-fg)]",children:e.description})]}),h.jsx("button",{"aria-label":"关闭通知",type:"button",onClick:()=>t(e.id),className:"text-[var(--muted-fg)] hover:text-[var(--fg)]",children:h.jsx(ei,{className:"size-3.5"})})]})}function CH(){const e=D(t=>t.toasts);return h.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[200] flex flex-col gap-2",children:e.map(t=>h.jsx(jH,{toast:t},t.id))})}function Ci(e){throw new Error(`Host 返回了无效的 ${e} 结果`)}const Sr={async updateAppSettings(e,t){const n=await He.call("app.settings.update",{assistantMode:t?Ns:null,expectedRevision:e.revision});return gy(n.appSettings)??Ci("应用设置")},async inspect(e){const t=await He.call("assistant.mode.inspect",{projectId:e});return Cq(t.inspection)??Ci("快速前台检查")},async prepare(e,t){const n=await He.call("assistant.mode.prepare",{projectId:e,planId:t},18e5);return Eq(n.preparation)??Ci("快速前台准备")},async previewStatus(e){const t=await He.call("preview.status",{projectId:e});return bd(t)??Ci("预览状态")},async ensurePreview(e){const t=await He.call("preview.ensure",{projectId:e},12e4);return bd(t)??Ci("启动预览")},async restartPreview(e){const t=await He.call("preview.restart",{projectId:e},12e4);return bd(t)??Ci("重启预览")},async stopPreview(e){const t=await He.call("preview.stop",{projectId:e});return bd(t)??Ci("停止预览")},async resolvePreviewAnnotations(e,t,n){const o=(await He.call("preview.annotations.resolve",{projectId:e,previewRevision:t,tokens:[...n]})).annotations.map(_q);return o.some(s=>!s)?Ci("视觉圈选解析"):o},async exportFrontend(e){const t=await He.call("frontend.export",{projectId:e},6e5);return jq(t.export)??Ci("静态站点导出")}},EH={workbench:"工作台",plugins:"插件",logs:"运行日志",settings:"设置"};function _H(){const e=D(R=>R.route),t=D(R=>R.projects),n=D(R=>R.activeProjectId),r=D(R=>R.activeThreadId),o=D(R=>R.threads.find(z=>z.id===R.activeThreadId&&z.projectId===R.activeProjectId)),s=D(R=>R.connectionStatus),l=D(R=>R.projectPanelCollapsed),u=D(R=>R.filePanelCollapsed),f=D(R=>R.togglePanel),p=D(R=>R.previewLayout),m=D(R=>R.setPreviewLayout),g=D(R=>R.theme),x=D(R=>R.setTheme),y=D(R=>R.appSettings),w=D(R=>R.setAppSettings),S=D(R=>R.pushToast),T=s==="online",k=vy(y),_=t.find(R=>R.id===n),C=o?.title??(r?"加载对话…":"新对话"),E=_?.kind==="managed",O=b2(_,y),M=vn({mutationFn:R=>{if(!y)throw new Error("Host 尚未返回应用设置");return Sr.updateAppSettings(y,R)},onSuccess:w,onError:R=>S({title:"快速前台设置没有更新",description:R instanceof Error?R.message:"Host 返回未知错误",tone:"danger"})});return h.jsxs("header",{className:"flex h-[52px] shrink-0 items-center border-b border-[var(--border)] bg-[var(--topbar)] px-3",children:[h.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[h.jsxs("div",{className:"flex shrink-0 items-center gap-2 pl-1",children:[h.jsx("span",{className:"text-[14px] font-semibold tracking-[-0.01em] text-[var(--fg)]",children:"Locode Mini"}),h.jsx("span",{className:"rounded-md bg-[var(--accent)]/15 px-1.5 py-0.5 type-meta font-semibold uppercase tracking-wider text-[var(--accent-soft)]",children:"v0.1"})]}),h.jsx("span",{"aria-hidden":"true",className:"h-5 w-px shrink-0 bg-[var(--border)]"}),e==="workbench"?h.jsxs("div",{role:"group","aria-label":"面板显示",className:"flex shrink-0 items-center gap-1.5",children:[h.jsx(At,{label:l?"展开项目栏":"折叠项目栏","aria-pressed":!l,"aria-expanded":!l,tone:l?"neutral":"accent",onClick:()=>f("project"),children:h.jsx(tz,{className:Me("size-4",l&&"rotate-180")})}),h.jsx(At,{"data-file-panel-toggle":!0,label:u?"展开文件栏":"折叠文件栏","aria-pressed":!u,"aria-expanded":!u,tone:u?"neutral":"accent",onClick:()=>f("file"),children:u?h.jsx(Uv,{className:"size-4"}):h.jsx(Ic,{className:"size-4"})})]}):h.jsx("span",{className:"text-[13px] font-medium text-[var(--fg)]",children:e.startsWith("plugin:")?"插件面板":EH[e]}),e==="workbench"&&h.jsxs("div",{role:"group","aria-label":"预览布局",title:O?"页面预览布局":"当前应用未启用页面预览",className:"flex shrink-0 items-center gap-0.5 rounded-lg border border-[var(--border)] bg-[var(--control)] p-0.5",children:[h.jsx(At,{label:"标签页布局","aria-pressed":p==="tabs",disabled:!O,tone:p==="tabs"?"accent":"neutral",className:"size-7 rounded-md",onClick:()=>m("tabs"),children:h.jsx(iz,{className:"size-4"})}),h.jsx(At,{label:"聊天与预览并排","aria-pressed":p==="split",disabled:!O,tone:p==="split"?"accent":"neutral",className:"size-7 rounded-md",onClick:()=>m("split"),children:h.jsx(cO,{className:"size-4"})})]}),!E&&h.jsxs("button",{type:"button",role:"switch","aria-label":"快速前台","aria-checked":k,"aria-busy":M.isPending,title:k?"关闭快速前台模式":"开启快速前台模式",disabled:!T||!y||M.isPending,onClick:()=>M.mutate(!k),className:Me("inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full border px-2.5 type-ui font-medium outline-none transition focus-visible:ring-2 focus-visible:ring-[var(--accent)]/50","disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",k?"border-[var(--accent)]/40 bg-[var(--accent)]/14 text-[var(--accent-soft)] shadow-[0_0_16px_rgba(109,87,255,.12)]":"border-[var(--control-border)] bg-[var(--control)] text-[var(--muted-fg)] hover:border-[var(--border-strong)] hover:text-[var(--fg)]"),children:[M.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(JT,{className:Me("size-3.5",k&&"fill-current")}),h.jsx("span",{children:"快速前台"}),h.jsx("span",{className:Me("rounded-full px-1.5 py-0.5 type-meta",k?"bg-[var(--accent)]/18 text-[var(--accent-soft)]":"bg-[var(--inset)] text-[var(--dim-fg)]"),children:k?"开":"关"})]}),e==="workbench"&&l&&_&&h.jsx(_o,{content:h.jsxs("span",{className:"block max-w-sm whitespace-normal break-all",children:[_.name," / ",C]}),side:"bottom",children:h.jsxs("div",{role:"group","aria-label":"当前应用与对话",tabIndex:0,className:"mx-1 flex min-w-0 flex-1 items-center gap-2 rounded px-1 type-ui outline-none focus-visible:ring-2 focus-visible:ring-[var(--accent)]/50",children:[h.jsx("span",{className:"min-w-0 max-w-[40%] truncate font-medium text-[var(--fg)]",children:_.name}),h.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-[var(--dim-fg)]",children:"/"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--subtle-fg)]",children:C})]})})]}),h.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[h.jsxs("div",{className:Me("mr-1 flex h-7 items-center gap-1.5 rounded-full border px-2.5 type-meta font-medium",T?"border-[var(--status-success-border)] bg-[var(--status-success-bg)] text-[var(--status-success-fg)]":"border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] text-[var(--status-warning-fg)]"),children:[T?h.jsx(qz,{className:"size-3"}):h.jsx(Lz,{className:"size-3"}),T?"Host 已连接":s==="connecting"||s==="reconnecting"?"正在连接":"离线预览"]}),h.jsx(At,{label:g==="dark"?"切换浅色主题":"切换深色主题",onClick:()=>x(g==="dark"?"light":"dark"),children:g==="dark"?h.jsx(Az,{className:"size-4"}):h.jsx(YO,{className:"size-4"})}),h.jsxs("button",{type:"button",className:"ml-1 flex h-8 items-center gap-2 rounded-lg px-1.5 text-[var(--fg)] hover:bg-[var(--hover)]",children:[h.jsx("span",{className:"flex size-6 items-center justify-center rounded-full bg-[linear-gradient(145deg,#6d5cff,#3d2fb3)] type-meta font-bold text-white",children:"LM"}),h.jsx(Gs,{className:"size-3 text-[var(--muted-fg)]"})]})]})]})}const Ao=8,tk=4,AH=8*1024*1024,MH=5*1024*1024,NH=10*1024*1024,PH=20*1024*1024,RH=new Set(["image/png","image/jpeg","image/webp"]),OH=new Set(["png","jpg","jpeg","webp"]),zH=new Set(["txt","md","markdown","csv","tsv","json","jsonl","yaml","yml","xml","html","htm","css","scss","less","js","jsx","mjs","cjs","ts","tsx","py","rb","go","rs","java","kt","kts","c","h","cc","cpp","hpp","cs","php","swift","sh","bash","zsh","fish","ps1","bat","cmd","sql","graphql","gql","toml","ini","conf","properties","env","gitignore","dockerfile","makefile","log","mts","svelte","vue"]),DH=new Set(["docx","xlsx","pdf"]),LH=new Set(["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/pdf"]),Kf={text:"",attachments:[],references:[],order:[]},fn=new Map,Tn=new Map,jd=new Map,Is=new Map,Vg=new Set;function wa(){for(const e of Vg)e()}function jr(e,t){const n=t(fn.get(e)??Kf);n.text.length===0&&n.attachments.length===0&&n.references.length===0&&!n.mode?fn.delete(e):fn.set(e,n),wa()}function Bs(e){e.ownsPreviewUrl&&e.previewUrl&&typeof URL.revokeObjectURL=="function"&&URL.revokeObjectURL(e.previewUrl)}function Sa(e,t){return e?`thread:${e}`:`project:${t??"none"}:new`}function ka(e){return fn.get(e)??Kf}function Qf(e){return(Is.get(e)??0)>0}async function BH(e,t){if(zy(e))return["消息正在发送,请稍后添加附件。"];Is.set(e,(Is.get(e)??0)+1),wa();const n=(jd.get(e)??Promise.resolve()).catch(()=>{}).then(async()=>{const r=ka(e),o=await JH(t,r.attachments,r.references.length);if(o.attachments.length>0){const s=ka(e);UH(e,[...s.attachments,...o.attachments])}return o.errors});jd.set(e,n);try{return await n}finally{const r=(Is.get(e)??1)-1;r>0?Is.set(e,r):Is.delete(e),jd.get(e)===n&&jd.delete(e),wa()}}function qH(e,t){Tn.has(e)||jr(e,n=>({...n,mode:t}))}function $H(e,t="legacy"){return Tn.has(e)?!1:(Tn.set(e,t),wa(),!0)}function Zg(e,t="legacy"){Tn.get(e)===t&&Tn.delete(e)&&wa()}function zy(e){return Tn.has(e)}function Kg(e,t){Tn.has(e)||jr(e,n=>({...n,text:t}))}function UH(e,t){if(Tn.has(e)){const r=new Set((fn.get(e)?.attachments??[]).map(o=>o.localId));t.filter(o=>!r.has(o.localId)).forEach(Bs);return}const n=new Set(t.map(r=>r.localId));fn.get(e)?.attachments.forEach(r=>{n.has(r.localId)||Bs(r)}),jr(e,r=>{const o=new Set(t.map(l=>`binary:${l.localId}`)),s=r.order.filter(l=>!l.startsWith("binary:")||o.has(l));for(const l of t){const u=`binary:${l.localId}`;s.includes(u)||s.push(u)}return{...r,attachments:t,order:s}})}function Yt(e){return`${e.path}:${e.startLine??0}:${e.endLine??0}`}function Dy(e){if(!e.documentAnnotationReferences)return e;const t=e.documentAnnotationReferences.filter(o=>e.references.some(s=>Yt(s)===Yt(o)&&s.hash===o.hash)),{documentAnnotationReferences:n,...r}=e;return t.length?{...r,documentAnnotationReferences:t}:r}function dC(e,t){const n=e.documentAnnotationReferences?.find(o=>Yt(o)===Yt(t));if(!n)return;const r=e.references.find(o=>Yt(o)===Yt(n)&&o.hash===n.hash);if(!r||t.projectId!==r.projectId||t.hash!==n.hash||t.snapshot!==r.snapshot||t.truncated)return"此范围已有文档批注,不能覆盖其快照或移除校验标识;请先明确移除该引用,再重新添加。"}function nk(e,t,n={}){const r=ka(e);if(Tn.has(e)||Qf(e))return{added:!1,reason:"草稿正在发送或准备附件,请稍后重试。"};if(n.expected&&n.expected!==r)return{added:!1,reason:"草稿已发生变化,请确认后重新转交。"};if(!t.length||t.length>Ao)return{added:!1,reason:"每批需要 1 至 8 条文档批注。"};const o=[...r.references],s=g=>n.caseSensitivePaths===!1?g.toLocaleLowerCase("en-US"):g,l=g=>Yt({...g,path:s(g.path)}),u=new Map((r.documentAnnotationReferences??[]).map(g=>[Yt(g),g]));for(const{text:g,reference:x,documentAnnotationReference:y}of t){if(!g.trim()||!x.hash||Yt(x)!==Yt(y)||x.hash!==y.hash)return{added:!1,reason:"文档批注与文件引用不一致,请重新选择。"};if(x.snapshot===void 0||x.truncated||x.snapshot.length>16e3||g.length>16e3)return{added:!1,reason:"批注快照无效或超过 16000 字符,请缩小选择范围;不会自动截断。"};if(o.some(k=>s(k.path)===s(x.path)&&(k.projectId!==x.projectId||k.hash!==x.hash||l(k)===l(x)&&(k.truncated||k.snapshot!==x.snapshot))))return{added:!1,reason:"草稿中已有同一文件的不同快照,请移除冲突引用后重试。"};const w=o.find(k=>k.projectId===x.projectId&&l(k)===l(x)),S=w??{...x};w||o.push(S);const T={...y,path:S.path};u.set(Yt(T),T)}if(o.length+r.attachments.length>Ao)return{added:!1,reason:"现有附件加文档引用不能超过 8 个,请先移除部分附件。"};const f=t.map((g,x)=>`${x+1}. ${g.text}`).join(`
169
+ `),p=r.text?`${r.text}
170
+
171
+ ${f}`:f;if(p.length>16e3)return{added:!1,reason:"追加后的草稿超过 16000 字符,请精简后重试;不会自动截断。"};const m=[...r.order];for(const g of o){const x=`workspace:${Yt(g)}`;m.includes(x)||m.push(x)}return n.validateOnly||jr(e,()=>({...r,text:p,references:o,documentAnnotationReferences:[...u.values()],order:m,...n.mode?{mode:n.mode}:{}})),{added:!0}}function Qg(e,t){if(Tn.has(e))return{added:!1,reason:"消息正在发送,请发送完成后再修改附件。"};const n=fn.get(e)??Kf,r=n.references.findIndex(l=>l.path===t.path&&l.startLine===t.startLine&&l.endLine===t.endLine),o=t.snapshot&&t.snapshot.length>16e3?{...t,snapshot:t.snapshot.slice(0,16e3),truncated:!0}:t,s=dC(n,o);return s?{added:!1,reason:s}:r>=0?(jr(e,l=>Dy({...l,references:l.references.map((u,f)=>f===r?o:u)})),{added:!0}):n.references.length+n.attachments.length>=Ao?{added:!1,reason:`每条消息最多添加 ${Ao} 个附件。`}:(jr(e,l=>({...l,references:[...l.references,o],order:[...l.order,`workspace:${Yt(o)}`]})),{added:!0})}function HH(e,t){if(Tn.has(e))return{added:!1,reason:"消息正在发送,请发送完成后再添加圈选修改。"};if(t.length===0)return{added:!1,reason:"没有可提交的圈选修改。"};const n=fn.get(e)??Kf,r=new Map(n.references.map(p=>[Yt(p),p]));for(const p of t){const m=p.reference.snapshot&&p.reference.snapshot.length>16e3?{...p.reference,snapshot:p.reference.snapshot.slice(0,16e3),truncated:!0}:p.reference,g=dC(n,m);if(g)return{added:!1,reason:g};r.set(Yt(m),m)}const o=[...r.values()];if(o.length+n.attachments.length>Ao)return{added:!1,reason:`现有附件加圈选代码引用不能超过 ${Ao} 个,请先移除部分附件。`};const s=new Set(n.references.map(Yt)),l=[...n.order];for(const p of o){const m=Yt(p);s.has(m)||l.push(`workspace:${m}`)}const u=t.map((p,m)=>`${m+1}. ${p.text}`).join(`
172
+ `),f=n.text.replace(/\s+$/u,"");return jr(e,()=>Dy({...n,text:f?`${f}
173
+
174
+ ${u}`:u,references:o,order:l})),{added:!0}}function FH(e,t,n,r){Tn.has(e)||jr(e,o=>{const s=u=>u.path===t&&u.startLine===n&&u.endLine===r,l=new Set(o.references.filter(s).map(u=>`workspace:${Yt(u)}`));return Dy({...o,references:o.references.filter(u=>!s(u)),order:o.order.filter(u=>!l.has(u))})})}function Ai(e,t,n){jr(e,r=>({...r,attachments:r.attachments.map(o=>{if(o.localId!==t)return o;const{error:s,...l}=n,u={...o,...l};return s===void 0?delete u.error:u.error=s,u})}))}function fC(e,t,n,r){const o=fn.get(e)?.attachments.find(s=>s.localId===t);o&&Bs(o),jr(e,s=>({...s,attachments:s.attachments.map(l=>l.localId!==t?l:{localId:l.localId,kind:r.kind,name:r.name,mediaType:r.mediaType,size:r.size,status:"uploaded",...l.file?{file:l.file}:{},attachment:r,progress:100,...r.kind==="image"?{previewUrl:da(n,r.artifactId),ownsPreviewUrl:!1}:{}})}))}function VH(e,t){if(Tn.has(e))return;const n=fn.get(e)?.attachments.find(r=>r.localId===t);if(n)return Bs(n),jr(e,r=>({...r,attachments:r.attachments.filter(o=>o.localId!==t),order:r.order.filter(o=>o!==`binary:${t}`)})),n}function ZH(e,t){if(e===t)return;const n=fn.get(e);if(!n)return;const r=fn.get(t);fn.set(t,r?{text:n.text||r.text,attachments:[...r.attachments,...n.attachments],references:[...r.references,...n.references],order:[...r.order,...n.order],...r.documentAnnotationReferences?.length||n.documentAnnotationReferences?.length?{documentAnnotationReferences:[...r.documentAnnotationReferences??[],...n.documentAnnotationReferences??[]]}:{}}:n),fn.delete(e),n.mode&&fn.set(t,{...fn.get(t),mode:n.mode});const o=Tn.get(e);o!==void 0&&(Tn.delete(e),Tn.set(t,o)),wa()}function KH(e){fn.get(e)?.attachments.forEach(Bs),fn.delete(e),wa()}function QH(e,t){return t.flatMap(n=>n.kind==="workspace-file"?[]:[{localId:`history:${n.artifactId}`,kind:n.kind,name:n.name,mediaType:n.mediaType,size:n.size,status:"uploaded",attachment:n,...n.kind==="image"?{previewUrl:da(e,n.artifactId)}:{}}])}function GH(e,t,n,r){if(Tn.has(e))return;const o=QH(t,n),s=n.flatMap(p=>p.kind==="workspace-file"?[p]:[]),l=r?.length?Vc.parse(r):void 0;if(l?.some(p=>!s.some(m=>Yt(m)===Yt(p)&&m.hash===p.hash&&!m.truncated&&m.snapshot!==void 0&&m.snapshot.length<=16e3)))throw new Error("历史批注与文件快照不一致,无法安全恢复,请重新添加批注。");const u=new Map(o.flatMap(p=>p.attachment?[[p.attachment.artifactId,p]]:[])),f=n.map(p=>p.kind==="workspace-file"?`workspace:${Yt(p)}`:`binary:${u.get(p.artifactId)?.localId??`history:${p.artifactId}`}`);fn.get(e)?.attachments.forEach(Bs),jr(e,({documentAnnotationReferences:p,...m})=>({...m,attachments:o,references:s,order:f,...l?{documentAnnotationReferences:l}:{}}))}function YH(e){const t=e.toLowerCase();return t==="dockerfile"||t==="makefile"?t:t.includes(".")?t.split(".").pop()??"":t}async function WH(e){if(typeof e.arrayBuffer!="function")return!1;const t=new Uint8Array(await e.slice(0,Math.min(e.size,64*1024)).arrayBuffer());return!(t.length>=2&&(t[0]===255&&t[1]===254||t[0]===254&&t[1]===255))&&t.includes(0)}function XH(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`attachment-${Date.now()}-${Math.random().toString(36).slice(2)}`}async function JH(e,t,n=0){const r=[],o=[];let s=t.length+n,l=t.filter(f=>f.kind==="image").length,u=t.reduce((f,p)=>f+p.size,0);for(const f of e){const p=f.name.trim()||(f.type.startsWith("image/")?"剪贴板图片.png":"剪贴板文本.txt"),m=YH(p),g=RH.has(f.type)||OH.has(m)?"image":LH.has(f.type)||DH.has(m)?"document":f.type.startsWith("text/")||zH.has(m)?"text-file":void 0;if(!g){o.push(`${p} 不是支持的图片、纯文本、DOCX、XLSX 或 PDF 文件。`);continue}if(s>=Ao){o.push(`每条消息最多添加 ${Ao} 个附件。`);break}if(g==="image"&&l>=tk){o.push(`每条消息最多添加 ${tk} 张图片。`);continue}const x=g==="image"?AH:g==="document"?NH:MH;if(f.size>x){o.push(`${p} 超过${g==="image"?"图片 8 MiB":g==="document"?"文档 10 MiB":"文本 5 MiB"}限制。`);continue}if(u+f.size>PH){o.push("本条消息的附件总大小不能超过 20 MiB。");break}if(g==="text-file"&&await WH(f)){o.push(`${p} 看起来是二进制文件,不能作为纯文本发送。`);continue}const y=g==="image"&&typeof URL.createObjectURL=="function"?URL.createObjectURL(f):void 0;r.push({localId:XH(),kind:g,name:p,mediaType:f.type||(g==="image"?"image/png":"text/plain"),size:f.size,status:"local",file:f,...y?{previewUrl:y,ownsPreviewUrl:!0}:{}}),s+=1,u+=f.size,g==="image"&&(l+=1)}return{attachments:r,errors:o}}function e7(e,t){if(t&&typeof t=="object"&&"message"in t&&typeof t.message=="string")return t.message;if(t&&typeof t=="object"&&"error"in t){if(typeof t.error=="string")return t.error;if(t.error&&typeof t.error=="object"&&"message"in t.error&&typeof t.error.message=="string")return t.error.message}return`附件上传失败(HTTP ${e})`}function t7(e){if(!e||typeof e!="object")return!1;const t=e;return(t.kind==="image"||t.kind==="text-file"||t.kind==="document")&&typeof t.artifactId=="string"&&typeof t.name=="string"&&typeof t.mediaType=="string"&&typeof t.size=="number"&&typeof t.hash=="string"}async function pC(e,t,n,r){if(t.attachment)return t.attachment;if(!t.file)throw new Error(`${t.name} 的本地文件已经不可用,请移除后重新添加。`);return new Promise((o,s)=>{const l=new XMLHttpRequest;l.open("POST",`/api/threads/${encodeURIComponent(e)}/attachments`),l.withCredentials=!0,l.timeout=6e4,l.responseType="json",l.setRequestHeader("content-type","application/octet-stream"),l.setRequestHeader("x-file-name",encodeURIComponent(t.name)),l.setRequestHeader("x-file-media-type",t.mediaType),l.upload.addEventListener("progress",u=>{u.lengthComputable&&u.total>0&&n?.(Math.min(99,Math.round(u.loaded/u.total*100)))}),l.upload.addEventListener("load",()=>r?.()),l.addEventListener("error",()=>s(new Error("附件上传失败,请检查 Host 连接后重试。"))),l.addEventListener("timeout",()=>s(new Error("附件上传超时,请重试。"))),l.addEventListener("abort",()=>s(new Error("附件上传已取消。"))),l.addEventListener("load",()=>{let u=l.response;if(u===null)try{l.responseText&&(u=JSON.parse(l.responseText))}catch{u=void 0}if(l.status<200||l.status>=300){s(new Error(e7(l.status,u)));return}const f=u&&typeof u=="object"&&"attachment"in u?u.attachment:void 0;if(!t7(f)){s(new Error("Host 返回了无效的附件信息。请升级或重启 Host 后重试。"));return}n?.(100),o(f)}),n?.(0),l.send(t.file)})}async function n7(e,t){const n=await fetch(`/api/threads/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`,{method:"DELETE",credentials:"same-origin"});if(!n.ok&&n.status!==404&&n.status!==409)throw new Error(`暂存附件删除失败(HTTP ${n.status})`)}function da(e,t,n="source",r=0){const o=`/api/threads/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`;if(n==="source")return o;const s=new URLSearchParams({representation:n});return n==="visual"&&s.set("index",String(r)),`${o}?${s.toString()}`}async function r7(e,t,n){const r=new Array(e.length),o=new Array(e.length);let s=0;const l=async()=>{for(;s<e.length;){const p=s;s+=1;try{r[p]=await n(e[p],p)}catch(m){o[p]=m}}},u=e.length===0?0:Math.max(1,Math.min(t,e.length));await Promise.all(Array.from({length:u},l));const f=o.find(p=>p!==void 0);if(f!==void 0)throw f;return r}function Ly(e){return Vg.add(e),()=>{Vg.delete(e)}}const i7=4,Gg=e=>["project",e,"tree"];function rk(e){return e.split("/").filter(Boolean).length}function hC(e,t){for(const n of e){if(n.path===t)return n;const r=n.children?hC(n.children,t):void 0;if(r)return r}}function mC(e,t,n){return e.map(r=>r.path===t&&r.kind==="directory"?{...r,children:n,loaded:!0}:r.children?{...r,children:mC(r.children,t,n)}:r)}function gC(e,t=new Set){for(const n of e)n.kind==="directory"&&t.add(n.path),n.children&&gC(n.children,t);return t}async function o7(e,t,n){const r=new Map;let o=0;const s=async()=>{for(;;){const l=o;o+=1;const u=n[l];if(u===void 0)return;try{const f=await e.call("project.tree",{projectId:t,path:u});r.set(u,my(f.entries))}catch{r.set(u,null)}}};return await Promise.all(Array.from({length:Math.min(i7,n.length)},()=>s())),r}async function a7(e,t,n,r=[]){const o=await e.call("project.tree",{projectId:t,path:""}),s=[...new Set(n.filter(p=>p.length>0))].sort((p,m)=>rk(p)-rk(m)||p.localeCompare(m)),l=await o7(e,t,s);let u=my(o.entries);for(const p of s){const m=l.get(p),g=hC(r,p),x=m??(g?.loaded?g.children??[]:void 0);x&&(u=mC(u,p,x))}const f=gC(u);return{projectId:t,tree:u,expandedPaths:s.filter(p=>f.has(p))}}const $d=new Map;let ik=1;function ok(e,t,n,r){const o=D.getState();return o.activeProjectId===e&&$d.get(n)===r&&o.openFiles.some(s=>s.id===t)}async function zc(e,t,n=t.split(/[\\/]/).pop()??t,r=He,o={}){if(D.getState().activeProjectId!==e)return;const s=`file:${t}`,l=D.getState().openFiles.find(m=>m.id===s);if(o.background&&!l)return;const u=`${e}\0${t}`,f=ik;ik+=1,$d.set(u,f);const p={id:s,path:t,name:n,language:hy(t),content:"",loading:!0,...o.anchor?{markdownAnchor:o.anchor}:{}};o.background||D.getState().openFile(p);try{const m=await r.call("file.read",{projectId:e,path:t});if(!ok(e,s,u,f))return;D.setState(g=>({openFiles:g.openFiles.map(x=>x.id===s?{...aq(m.file),...x.markdownAnchor?{markdownAnchor:x.markdownAnchor}:{}}:x)}))}catch(m){if(!ok(e,s,u,f))return;D.setState(g=>({openFiles:g.openFiles.map(x=>x.id===s?{...x,loading:!1,error:m instanceof Error?m.message:"读取文件失败"}:x)}))}finally{$d.get(u)===f&&$d.delete(u)}}function s7({name:e}){const t=e.split(".").pop()?.toLowerCase();return t==="json"?h.jsx(TO,{className:"size-3.5 text-[var(--accent-soft)]"}):["ts","tsx","js","jsx"].includes(t??"")?h.jsx(FT,{className:"size-3.5 text-[var(--status-info-fg)]"}):["md","txt"].includes(t??"")?h.jsx(Uc,{className:"size-3.5 text-[var(--accent-soft)]"}):["yaml","yml"].includes(t??"")?h.jsx(LT,{className:"size-3.5 text-[var(--muted-fg)]"}):h.jsx(PO,{className:"size-3.5 text-[var(--dim-fg)]"})}function vC({node:e,depth:t,filter:n,onFileOpened:r}){const o=D(C=>C.activeProjectId),s=D(C=>C.activeThreadId),l=D(C=>o?(C.expandedPathsByProjectId[o]??[]).includes(e.path):!1),u=D(C=>C.toggleDirectory),f=D(C=>C.setDirectoryChildren),p=D(C=>C.openFile),m=D(C=>C.connectionStatus),g=D(C=>C.pushToast),x=D(C=>C.activeWorkspaceTab),[y,w]=I.useState(!1),S=e.kind==="directory",T=e.children?.filter(C=>!n||C.name.toLowerCase().includes(n)||C.kind==="directory"),k=async()=>{if(S){const O=!l;if(u(e.path),O&&!e.loaded&&m==="online"&&o){w(!0);try{const M=await He.call("project.tree",{projectId:o,path:e.path});f(o,e.path,my(M.entries))}catch(M){g({title:"无法读取目录",description:M instanceof Error?M.message:e.path,tone:"danger"})}finally{w(!1)}}return}if(m!=="online"){p(FS(e.path)),r?.();return}if(!o)return;await zc(o,e.path,e.name);const C=D.getState(),E=C.openFiles.find(O=>O.path===e.path);C.activeProjectId===o&&E&&!E.loading&&!E.error&&r?.()},_=async C=>{if(C.stopPropagation(),!S){if(m!=="online"){const E=FS(e.path);Qg(Sa(s,o),{path:e.path,snapshot:E.content}),g({title:"已加入预览引用",description:`${e.path} 仅会用于离线界面预览。`,tone:"neutral"});return}if(o)try{const O=(await He.call("file.read",{projectId:o,path:e.path})).file,M=Qg(Sa(s,o),{projectId:o,path:e.path,snapshot:O.content??"",hash:O.hash,truncated:O.truncated});if(!M.added){g({title:"无法附加文件",description:M.reason??"附件数量已达到上限。",tone:"neutral"});return}g({title:"已附加文件",description:e.path,tone:"success"})}catch(E){g({title:"无法附加文件",description:E instanceof Error?E.message:e.path,tone:"danger"})}}};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{role:"treeitem","aria-expanded":S?l:void 0,className:Me("group flex h-[25px] cursor-default items-center gap-1 rounded-md pr-1 type-ui text-[var(--subtle-fg)] hover:bg-[var(--hover)]",x===`file:${e.path}`&&"bg-[var(--selected)] text-[var(--fg)]"),style:{paddingLeft:7+t*13},children:[h.jsxs("button",{type:"button",title:e.path,onClick:()=>{k()},className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",children:[h.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center text-[var(--dim-fg)]",children:S?l?h.jsx(Gs,{className:"size-3"}):h.jsx(Ys,{className:"size-3"}):null}),S?l?h.jsx(Ic,{className:"size-3.5 shrink-0 text-[var(--folder)]"}):h.jsx(Uv,{className:"size-3.5 shrink-0 text-[var(--folder)]"}):h.jsx(s7,{name:e.name}),h.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),y&&h.jsx(GT,{className:"size-3 animate-spin text-[var(--dim-fg)]"}),e.status&&h.jsx("span",{className:Me("mr-1 type-meta font-semibold",e.status==="modified"?"text-[var(--status-warning-fg)]":"text-[var(--status-success-fg)]"),children:e.status==="modified"?"M":"A"})]}),!S&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button","aria-label":`复制 ${e.name} 的路径`,onClick:C=>{C.stopPropagation(),navigator.clipboard.writeText(e.path).then(()=>g({title:"已复制文件路径",description:e.path,tone:"success"}))},className:"flex size-5 items-center justify-center rounded opacity-0 transition hover:bg-[var(--hover)] hover:text-[var(--fg)] group-hover:opacity-100 focus:opacity-100",children:h.jsx(ZT,{className:"size-3"})}),h.jsx("button",{type:"button","aria-label":`引用 ${e.name}`,onClick:C=>{_(C)},className:"flex size-5 items-center justify-center rounded opacity-0 transition hover:bg-[var(--hover)] hover:text-[var(--fg)] group-hover:opacity-100 focus:opacity-100",children:h.jsx(Wd,{className:"size-3"})})]})]}),S&&l&&T?.map(C=>h.jsx(vC,{node:C,depth:t+1,filter:n,onFileOpened:r},C.id))]})}function l7({onFileOpened:e}){const t=Hs(),n=D(y=>y.fileTree),r=D(y=>y.activeProjectId),o=D(y=>y.connectionStatus),s=D(y=>y.projects),l=D(y=>y.pushToast),[u,f]=I.useState(""),p=Gg(r??""),m=nN({queryKey:p,exact:!0})>0,g=s.find(y=>y.id===r),x=async()=>{if(o!=="online"||!r){l({title:"Host 未连接",description:"文件树当前使用离线预览数据。",tone:"neutral"});return}await t.invalidateQueries({queryKey:p,exact:!0})};return h.jsxs("aside",{"aria-label":"项目文件栏",className:"workspace-file-panel relative flex h-full shrink-0 flex-col border-r border-[var(--border)] bg-[var(--panel)]",children:[h.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between px-3",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[h.jsx("h2",{className:"truncate type-ui font-semibold text-[var(--fg)]",children:"文件"}),g?.isPreview&&h.jsx("span",{className:"rounded bg-[var(--status-warning-bg)] px-1 type-meta text-[var(--status-warning-fg)]",children:"预览"})]}),h.jsxs("div",{className:"flex shrink-0 items-center",children:[h.jsx(At,{label:"复制项目路径",disabled:!g,onClick:()=>{g&&navigator.clipboard.writeText(g.rootPath).then(()=>l({title:"已复制项目路径",tone:"success"}))},children:h.jsx(ZT,{className:"size-3.5"})}),h.jsx(At,{label:"刷新文件树",disabled:m,onClick:()=>{x()},children:h.jsx(GT,{className:Me("size-3.5",m&&"animate-spin")})})]})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-2.5 focus-within:border-[var(--accent)]/50 focus-within:ring-2 focus-within:ring-[var(--accent)]/10",children:[h.jsx(Tf,{className:"size-3.5 shrink-0 text-[var(--dim-fg)]"}),h.jsx("input",{value:u,onChange:y=>f(y.target.value.toLowerCase()),placeholder:"筛选文件…",className:"min-w-0 flex-1 bg-transparent type-ui text-[var(--fg)] outline-none placeholder:text-[var(--dim-fg)]"})]})}),h.jsx("div",{role:"tree","aria-label":"项目文件",className:"min-h-0 flex-1 overflow-auto px-1.5 pb-2",children:n.length?n.map(y=>h.jsx(vC,{node:y,depth:0,filter:u,onFileOpened:e},y.id)):h.jsxs("div",{className:"flex h-36 flex-col items-center justify-center text-center type-meta text-[var(--dim-fg)]",children:[h.jsx(Uv,{className:"mb-2 size-5 opacity-60"}),h.jsx("span",{children:g?"项目目录为空":"请先选择项目"})]})}),h.jsxs("div",{className:"flex h-8 shrink-0 items-center justify-between border-t border-[var(--border)] px-3 type-meta text-[var(--dim-fg)]",children:[h.jsx("span",{className:"min-w-0 truncate",title:g?.rootPath,children:g?.rootPath??"未选择项目"}),h.jsx("span",{className:"shrink-0",children:"只读浏览"})]})]})}function c7(){const e=D(s=>s.filePanelCollapsed),[t,n]=I.useState(()=>window.innerWidth<1280),r=I.useRef(null);I.useEffect(()=>{const s=()=>n(window.innerWidth<1280);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]);const o=()=>D.setState({filePanelCollapsed:!0});return I.useEffect(()=>{if(e||!t)return;const s=document.activeElement instanceof HTMLElement?document.activeElement:null;r.current?.focus();const l=f=>{f.key==="Escape"&&!f.defaultPrevented&&(f.preventDefault(),o())},u=f=>{f.composedPath().some(m=>m instanceof Element&&(m===r.current||m.matches("[data-file-panel-toggle]")))||o()};return document.addEventListener("keydown",l),document.addEventListener("click",u),()=>{document.removeEventListener("keydown",l),document.removeEventListener("click",u),D.getState().filePanelCollapsed&&(s?.isConnected&&s!==document.body?s:document.querySelector("[data-file-panel-toggle]"))?.focus()}},[e,t]),e?null:h.jsx("div",{ref:r,className:t?"workspace-file-overlay":"flex shrink-0",tabIndex:t?-1:void 0,role:t?"dialog":void 0,"aria-label":t?"项目文件浮层":void 0,children:h.jsx(l7,{onFileOpened:t?o:void 0})})}function yC(){const e=I.useRef(0),[t,n]=I.useState(),r=D(p=>p.selectProject),o=D(p=>p.selectThread),s=D(p=>p.setProjects),l=D(p=>p.setPreviewSession),u=D(p=>p.pushToast);return{activate:I.useCallback(async(p,m)=>{const g=++e.current,{navigationIntentId:x,hostSessionId:y,route:w}=D.getState(),S=()=>{const _=D.getState();return g===e.current&&_.navigationIntentId===x&&_.hostSessionId===y&&_.route===w};n(p);const T=D.getState(),k=T.supportsProjectPreviewPool;T.activeProjectId!==p&&r(p),m&&o(m);try{const _=await He.call("project.activate",{projectId:p,...k?{ensurePreview:!1}:{}},12e4);if(D.getState().hostSessionId!==y)return!1;const C=Ec(_.project),E=D.getState();return E.projects.some(O=>O.id===C.id)?(s(E.projects.some(O=>O.id===C.id)?E.projects.map(O=>O.id===C.id?C:O):[C,...E.projects]),l(C.id,il(_.previewSession)??null,_.previewRevision),S()):!1}catch(_){return S()&&u({title:"无法切换应用",description:_ instanceof Error?_.message:"Host 返回未知错误",tone:"danger"}),!1}finally{g===e.current&&n(void 0)}},[u,r,o,l,s]),pendingProjectId:t}}function u7(){const e=D(ne=>ne.projects),t=D(ne=>ne.activeProjectId),n=D(ne=>ne.activeThreadId),r=D(ne=>ne.browsedProjectId),o=D(ne=>ne.threadsByProjectId),s=D(ne=>ne.threads),l=D(ne=>ne.connectionStatus),u=D(ne=>ne.offlinePreview),f=D(ne=>ne.hostSessionId),{setProjects:p,selectProject:m,selectThread:g,setThreads:x,upsertThread:y,removeProject:w,removeThread:S,setPreviewSession:T,selectWorkspaceTab:k,browseProject:_,beginNavigationIntent:C,togglePanel:E,pushToast:O}=D.getState(),M=e.find(ne=>ne.id===r)??e.find(ne=>ne.id===t)??e[0],[R,z]=I.useState(""),[K,q]=I.useState(""),[Z,Y]=I.useState(!1),[ae,J]=I.useState(""),[he,F]=I.useState(null),[ee,Q]=I.useState(null),[xe,P]=I.useState(null),[$,te]=I.useState(!1),A=l==="online",L=Hs(),{activate:X,pendingProjectId:ue}=yC(),we=I.useRef(!0);I.useEffect(()=>(we.current=!0,()=>{we.current=!1}),[]),I.useEffect(()=>q(""),[M?.id]);const ge=()=>{const ne=C(),{route:je,hostSessionId:Be}=D.getState();return Object.assign(()=>{const We=D.getState();return we.current&&We.navigationIntentId===ne&&We.route===je&&We.hostSessionId===Be},{sessionId:Be})},Se=(ne,je)=>window.setTimeout(()=>{je()&&D.getState().activeThreadId===ne&&window.dispatchEvent(new CustomEvent("harness:focus-composer"))},0),B=lr({queryKey:["project",M?.id??null,"threads",...f?[f]:[]],queryFn:async()=>{const ne=M.id,je=f,Be=A2(ne),We=await He.call("thread.list",{projectId:ne}),ft=D.getState();return ft.hostSessionId===je&&ft.projects.some(Xe=>Xe.id===ne)&&x(ne,We.threads.map(Xe=>Rr(Xe)),Be),{projectId:ne,sessionId:je,result:We,request:Be}},enabled:A&&!u&&!!M,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1});I.useEffect(()=>{const ne=B.data;ne?.result?.threads&&(ne.sessionId??null)===D.getState().hostSessionId&&D.getState().projects.some(je=>je.id===ne.projectId)&&x(ne.projectId,ne.result.threads.map(je=>Rr(je)),ne.request)},[B.data,x]);const U=M?o[M.id]??(M.id===t?s:void 0):void 0,ve=R.trim().toLocaleLowerCase("zh-CN"),_e=I.useMemo(()=>e.filter(ne=>!ve||ne.name.toLocaleLowerCase("zh-CN").includes(ve)||(o[ne.id]??[]).some(je=>je.title.toLocaleLowerCase("zh-CN").includes(ve))),[e,ve,o]),qe=I.useMemo(()=>{const ne=K.trim().toLocaleLowerCase("zh-CN"),je=M?.name.toLocaleLowerCase("zh-CN").includes(ve);return(U??[]).filter(Be=>Be.status!=="archived"&&(!ve||je||Be.title.toLocaleLowerCase("zh-CN").includes(ve))&&(!ne||Be.title.toLocaleLowerCase("zh-CN").includes(ne))).toSorted((Be,We)=>(We.createdAt??We.updatedAt).localeCompare(Be.createdAt??Be.updatedAt)||We.id.localeCompare(Be.id))},[U,M?.name,ve,K]),Qe=ne=>{A?ne():O({title:"Host 未连接",description:"当前是离线预览,应用和对话操作不会执行。",tone:"neutral"})},ze=ne=>_(ne),ut=async(ne,je)=>{const Be=ge();return D.getState().activeProjectId===ne.id?(je&&g(je.id),!0):A?await X(ne.id,je?.id)&&Be():(m(ne.id),je&&g(je.id),!0)},Kt=ne=>{const je=e.find(Be=>Be.id===ne.projectId);je&&ut(je,ne)},Ft=()=>{t&&_(t),z(""),q("")},dr=vn({onMutate:ge,mutationFn:async()=>{const ne=await He.call("project.open",{},6e5);return ne.project?Ec(ne.project):null},onSuccess:(ne,je,Be)=>{!ne||D.getState().hostSessionId!==Be?.sessionId||(p([ne,...D.getState().projects.filter(We=>We.id!==ne.id)]),Be?.()&&(_(ne.id),X(ne.id)))},onError:ne=>O({title:"无法打开外部代码库",description:ne.message,tone:"danger"})}),Lr=vn({onMutate:ge,mutationFn:()=>He.call("project.createManaged",{name:ae.trim()},12e4),onSuccess:(ne,je,Be)=>{if(D.getState().hostSessionId!==Be?.sessionId)return;const We=Ec(ne.project),ft=Rr(ne.thread);p([We,...D.getState().projects.filter(Xe=>Xe.id!==We.id)]),y(ft,{select:!1}),T(We.id,il(ne.previewSession)??null,ne.previewRevision),Be?.()&&(m(We.id),g(ft.id),D.setState({browsedProjectId:We.id}),k("assistant"),Se(ft.id,Be)),Y(!1),J(""),L.invalidateQueries({queryKey:["projects"]})},onError:ne=>O({title:"无法创建应用",description:ne.message,tone:"danger"})}),Lo=vn({onMutate:ge,mutationFn:ne=>He.call("thread.create",{projectId:ne}).then(je=>Rr(je.thread)),onSuccess:async(ne,je,Be)=>{const We=D.getState();if(!(We.hostSessionId!==Be?.sessionId||!We.projects.some(ft=>ft.id===je))&&(y(ne,{select:!1}),L.invalidateQueries({queryKey:["project",je,"threads"]}),!!Be?.())){if(D.getState().activeProjectId===je)g(ne.id);else if(!await X(je,ne.id))return;Be()&&(q(""),z(""),Se(ne.id,Be))}},onError:ne=>O({title:"无法创建对话",description:ne.message,tone:"danger"})}),oi=vn({onMutate:()=>D.getState().hostSessionId,mutationFn:async({project:ne,listOnly:je=!1})=>ne.kind==="managed"&&!je?He.call("project.delete",{projectId:ne.id,confirmationName:ne.name}):He.call("project.remove",{projectId:ne.id}),onSuccess:(ne,{project:je,listOnly:Be},We)=>{if(D.getState().hostSessionId!==We)return;const ft=D.getState(),Xe=ft.activeProjectId===je.id,sn=(ft.threadsByProjectId[je.id]??[]).map(Bn=>Bn.id);w(je.id),L.removeQueries({queryKey:["project",je.id]});for(const Bn of sn)L.removeQueries({queryKey:["thread",Bn]});F(null),Q(null),L.invalidateQueries({queryKey:["projects"]});const mt=D.getState().activeProjectId;Xe&&mt&&X(mt),O({title:Be?"已从列表移除":"应用已删除",tone:"success",description:Be?"仅移除应用登记,源码与对话记录均未删除。":je.kind==="managed"?"源码目录已移入系统回收站。":"应用登记已移除,原始目录没有被修改。"})},onError:(ne,{project:je,listOnly:Be})=>{je.kind==="managed"&&!Be&&Q(ne.message),O({title:Be?"无法从列表移除":"无法删除应用",description:ne.message,tone:"danger"})}}),an=vn({mutationFn:({threadId:ne,title:je})=>He.call("thread.rename",{threadId:ne,title:je}),onMutate:()=>D.getState().hostSessionId,onSuccess:({thread:ne},je,Be)=>{const We=D.getState();if(We.hostSessionId!==Be||!We.projects.some(Xe=>Xe.id===ne.projectId))return;const ft=We.threadDetailsById[ne.id]??We.threadsByProjectId[ne.projectId]?.find(Xe=>Xe.id===ne.id);ft&&(y({...ft,title:ne.title,titleUpdatedAt:ne.updatedAt,updatedAt:ne.updatedAt},{select:!1}),L.invalidateQueries({queryKey:["project",ne.projectId,"threads"]}))}}),ai=vn({onMutate:()=>D.getState().hostSessionId,mutationFn:ne=>He.call("thread.delete",{threadId:ne.id}),onSuccess:(ne,je,Be)=>{D.getState().hostSessionId===Be&&(S(je.id),L.removeQueries({queryKey:["thread",je.id]}),P(null),L.invalidateQueries({queryKey:["project",je.projectId,"threads"]}),O({title:"对话已删除",description:"历史记录和物理附件已一并清理。",tone:"success"}))},onError:ne=>O({title:"无法删除对话",description:ne.message,tone:"danger"})});return{projects:e,activeProjectId:t,activeThreadId:n,browsedProject:M,threadsByProjectId:o,projectThreads:U,visibleProjects:_e,visibleThreads:qe,search:R,setSearch:z,threadSearch:K,setThreadSearch:q,newAppOpen:Z,setNewAppOpen:Y,appName:ae,setAppName:J,removeTarget:he,setRemoveTarget:F,applicationDeleteError:ee,deleteThreadTarget:xe,setDeleteThreadTarget:P,revealing:$,online:A,pendingProjectId:ue,conversationQuery:B,requireOnline:Qe,chooseProject:ze,chooseThread:Kt,openWorkspace:ut,returnToCurrent:Ft,openExternalProject:dr,createManagedApp:Lr,newThread:Lo,removeApplication:oi,renameThread:an,deleteThread:ai,openRemoveConfirmation:ne=>{if((o[ne.id]??(ne.id===t?s:[])).some(Be=>Be.status==="running")){O({title:"暂时不能删除应用",description:"该应用仍有运行中、排队中或等待审批的任务,请先完成或取消任务。",tone:"danger"});return}Q(null),F(ne)},openThreadDeleteConfirmation:ne=>{if(ne.status==="running"){O({title:"暂时不能删除对话",description:"该对话仍有运行中、排队中或等待审批的任务,请先完成或取消任务。",tone:"danger"});return}P(ne)},revealProject:async ne=>{if(!(!A||$)){te(!0);try{await He.call("project.reveal",{projectId:ne.id})}catch(je){O({title:"无法打开应用文件夹",description:je instanceof Error?je.message:ne.rootPath,tone:"danger"})}finally{te(!1)}}},togglePanel:E}}function bC({label:e,actions:t}){const[n,r]=I.useState(!1),[o,s]=I.useState({left:0,top:0}),l=I.useRef(null),u=I.useRef(null),f=(p=!1)=>{r(!1),p&&l.current?.focus()};return I.useLayoutEffect(()=>{if(!n||!l.current||!u.current)return;const p=l.current.getBoundingClientRect(),m=u.current.getBoundingClientRect();s({left:Math.max(8,Math.min(p.left,window.innerWidth-m.width-8)),top:Math.max(8,p.bottom+m.height+6<=window.innerHeight?p.bottom+6:p.top-m.height-6)}),u.current.querySelector("button:not(:disabled)")?.focus()},[n]),I.useEffect(()=>{if(!n)return;const p=g=>{!u.current?.contains(g.target)&&!l.current?.contains(g.target)&&f()},m=()=>f();return window.addEventListener("pointerdown",p),window.addEventListener("resize",m),document.addEventListener("scroll",m,!0),()=>{window.removeEventListener("pointerdown",p),window.removeEventListener("resize",m),document.removeEventListener("scroll",m,!0)}},[n]),h.jsxs(h.Fragment,{children:[h.jsx(_o,{content:e,children:h.jsx("button",{ref:l,type:"button","aria-label":e,"aria-haspopup":"menu","aria-expanded":n,className:"navigation-menu-trigger",onClick:()=>r(!n),onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),r(!0))},children:h.jsx(HT,{className:"size-3.5"})})}),n&&ja.createPortal(h.jsx("div",{ref:u,role:"menu","aria-label":e,className:"navigation-menu",style:o,onKeyDown:p=>{const m=[...u.current?.querySelectorAll("button:not(:disabled)")??[]],g=m.indexOf(document.activeElement);if((p.key==="Escape"||p.key==="Tab")&&(f(p.key==="Escape"),p.stopPropagation()),["ArrowDown","ArrowUp","Home","End"].includes(p.key)&&m.length){p.preventDefault();const x=p.key==="Home"?0:p.key==="End"?m.length-1:(g+(p.key==="ArrowDown"?1:-1)+m.length)%m.length;m[x]?.focus()}},children:t.map(({label:p,icon:m,onSelect:g,disabled:x,danger:y,description:w})=>h.jsxs("button",{type:"button",role:"menuitem",disabled:x,"data-danger":y||void 0,onClick:()=>{f(!0),g()},children:[h.jsx(m,{className:"size-3.5 shrink-0"}),h.jsxs("span",{children:[h.jsx("span",{className:"block",children:p}),w&&h.jsx("span",{className:"navigation-meta mt-1 block",children:w})]})]},p))}),document.body)]})}function d7(e){const t={running:0,queued:0,"waiting-approval":0};for(const o of e??[])o.status==="running"&&(t[o.activeTurnStatus??"running"]+=1);const n=t["waiting-approval"]?"waiting-approval":t.running?"running":t.queued?"queued":void 0,r=[t["waiting-approval"]?`${t["waiting-approval"]} 待审批`:"",t.running?`${t.running} 运行中`:"",t.queued?`${t.queued} 排队中`:""].filter(Boolean).join(" · ");return{status:n,label:r}}function f7({navigation:e}){const t=I.useId();return h.jsxs("aside",{"aria-label":"应用列表",className:"application-column",children:[h.jsxs("header",{className:"navigation-heading",children:[h.jsxs("h2",{children:["应用 ",h.jsx("span",{className:"navigation-count",children:e.projects.length})]}),h.jsxs("div",{className:"navigation-header-actions",children:[h.jsx(At,{label:"新建应用",className:"size-7",onClick:()=>e.requireOnline(()=>e.setNewAppOpen(!0)),children:h.jsx(If,{className:"size-3.5"})}),h.jsx(At,{label:"打开外部代码库",className:"size-7",disabled:!e.online||e.openExternalProject.isPending,onClick:()=>e.openExternalProject.mutate(),children:e.openExternalProject.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(Ic,{className:"size-3.5"})})]})]}),h.jsxs("label",{className:"navigation-search",children:[h.jsx(Tf,{className:"size-3.5 shrink-0"}),h.jsx("input",{"aria-label":"搜索应用或对话",placeholder:"搜索应用/对话",value:e.search,onChange:n=>e.setSearch(n.target.value)})]}),h.jsxs("div",{className:"navigation-scroll",role:"list","aria-label":"应用",children:[e.visibleProjects.length===0&&h.jsx("div",{className:"navigation-empty",children:e.projects.length?"没有匹配的应用或对话":"创建第一个应用,开始与 AI 协作。"}),e.visibleProjects.map(n=>{const r=e.threadsByProjectId[n.id],o=d7(r),s=n.managedState==="missing"?"目录缺失":n.managedState==="invalid"?"配置损坏":null;return h.jsxs("div",{role:"listitem",className:"application-row","data-browsed":e.browsedProject?.id===n.id||void 0,children:[h.jsx(_o,{content:o.label?`${n.name} · ${o.label}`:n.name,side:"right",children:h.jsxs("button",{type:"button","aria-label":`浏览应用 ${n.name}`,"aria-describedby":`${t}-${n.id}`,"aria-current":e.browsedProject?.id===n.id?"true":void 0,onClick:()=>e.chooseProject(n.id),className:"application-choice",children:[h.jsx("span",{className:"application-icon","data-activity":o.status,"aria-hidden":"true",children:e.pendingProjectId===n.id?h.jsx(Ot,{className:"size-4 animate-spin motion-reduce:animate-none"}):n.name.slice(0,1).toUpperCase()}),h.jsxs("span",{className:"navigation-row-copy min-w-0 flex-1",children:[h.jsx("span",{className:"navigation-title",children:n.name}),h.jsx("span",{id:`${t}-${n.id}`,className:"navigation-meta block truncate","data-danger":s?!0:void 0,children:s??`${n.kind==="managed"?"托管":"外部"} · ${o.label||(r?`${r.length} 条对话`:"—")}`})]})]})}),h.jsx(bC,{label:`${n.name} 操作`,actions:[{label:"打开工作区",icon:Iz,onSelect:()=>{e.openWorkspace(n)}},{label:"打开应用文件夹",icon:Ic,disabled:!e.online||e.revealing,onSelect:()=>{e.revealProject(n)}},{label:"删除应用",icon:jf,danger:!0,disabled:!e.online,onSelect:()=>e.openRemoveConfirmation(n)}]})]},n.id)})]})]})}function p7(e,t){const n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(r);return o.setDate(o.getDate()-1),n>=r?"今天":n>=o?"昨天":"更早"}function h7({thread:e}){if(e.status==="running"&&e.activeTurnStatus==="queued"){const n=e.queue?.reason==="workspace-busy"?"等待同应用任务完成":"等待执行名额";return h.jsxs("span",{className:"navigation-thread-status","data-status":"queued",title:n,children:[h.jsx(Ot,{"aria-label":"排队中",className:"size-3 animate-spin motion-reduce:animate-none"}),"排队中",e.queue?` · 第 ${e.queue.position} 位`:""]})}if(e.status==="running"&&e.activeTurnStatus==="waiting-approval")return h.jsx("span",{className:"navigation-thread-status","data-status":"waiting-approval",children:"等待审批"});if(e.status==="running")return h.jsxs("span",{className:"navigation-thread-status","data-status":"running",children:[h.jsx(Ot,{"aria-label":"正在运行",className:"size-3 animate-spin motion-reduce:animate-none"}),"正在运行"]});if(e.status==="failed"||e.status==="interrupted")return h.jsx("span",{className:"navigation-thread-status","data-status":e.status,children:e.status==="failed"?"运行失败":"已中断"});const t=new Date(e.createdAt);return h.jsxs("span",{children:[e.isPreview?"预览 · ":"",Number.isNaN(t.valueOf())?"—":t.toLocaleDateString("zh-CN",{month:"numeric",day:"numeric"})]})}function m7({thread:e,nav:t}){const[n,r]=I.useState(!1),[o,s]=I.useState(e.title),[l,u]=I.useState(""),[f,p]=I.useState(!1),m=I.useRef(!1),g=I.useRef(null),x=e.projectId===t.activeProjectId&&e.id===t.activeThreadId;I.useEffect(()=>{n&&(g.current?.focus(),g.current?.select())},[n]);const y=()=>{!t.online||m.current||(s(e.title),u(""),r(!0))},w=async()=>{if(m.current)return;const S=o.trim();if(!S){u("标题不能为空");return}if(S.length>240){u("标题不能超过 240 个字符");return}if(S===e.title){r(!1);return}m.current=!0,p(!0),u("");try{await t.renameThread.mutateAsync({threadId:e.id,title:S}),r(!1)}catch(T){u(T instanceof Error?T.message:"无法保存标题,请重试")}finally{m.current=!1,p(!1)}};return h.jsxs("div",{role:"listitem",className:"conversation-row","data-active":x||void 0,children:[n?h.jsxs("div",{className:"conversation-choice",children:[h.jsx(Qw,{className:"mt-0.5 size-3.5 shrink-0 text-[var(--muted-fg)]"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("input",{ref:g,"aria-label":"对话标题",title:"Enter 保存,Esc 取消",className:"conversation-title-input",value:o,maxLength:240,readOnly:f,"aria-busy":f,"aria-invalid":!!l,onChange:S=>{s(S.target.value),u("")},onBlur:()=>{m.current||r(!1)},onKeyDown:S=>{S.stopPropagation(),!(S.nativeEvent.isComposing||S.keyCode===229)&&(S.key==="Enter"&&(S.preventDefault(),w()),S.key==="Escape"&&!m.current&&(S.preventDefault(),r(!1)))}}),l?h.jsx("span",{role:"alert",className:"text-xs text-[var(--status-danger-fg)]",children:l}):h.jsx("span",{className:"navigation-meta mt-1 block",children:f?"正在保存…":"Enter 保存 · Esc 取消"})]})]}):h.jsx(_o,{content:e.title,side:"right",children:h.jsxs("button",{type:"button","aria-label":`打开对话 ${e.title}`,className:"conversation-choice","aria-current":x?"page":void 0,"aria-busy":t.pendingProjectId===e.projectId,onClick:()=>t.chooseThread(e),onDoubleClick:y,onKeyDown:S=>{S.key==="F2"&&(S.preventDefault(),y())},children:[h.jsx(Qw,{className:"mt-0.5 size-3.5 shrink-0 text-[var(--muted-fg)]"}),h.jsxs("span",{className:"navigation-row-copy min-w-0 flex-1",children:[h.jsx("span",{className:"navigation-title",children:e.title}),h.jsx("span",{className:"navigation-meta mt-1 block",children:h.jsx(h7,{thread:e})})]})]})}),!n&&h.jsx(bC,{label:`${e.title} 操作`,actions:[{label:"重命名对话",icon:Hv,disabled:!t.online,onSelect:y},{label:"删除对话",icon:jf,danger:!0,disabled:!t.online,onSelect:()=>t.openThreadDeleteConfirmation(e)}]})]})}function g7({navigation:e}){const t=e.browsedProject,n=t&&t.id!==e.activeProjectId,[r,o]=I.useState(()=>new Date);I.useEffect(()=>{const l=window.setInterval(()=>o(new Date),6e4);return()=>window.clearInterval(l)},[]);const s=["今天","昨天","更早"].map(l=>({label:l,threads:e.visibleThreads.filter(u=>p7(u.createdAt,r)===l)}));return h.jsxs("aside",{"aria-label":"对话列表",className:"conversation-column",children:[h.jsxs("header",{className:"navigation-heading",children:[h.jsx("h2",{className:"min-w-0 flex-1 truncate",title:t?.name,children:t?.name??"对话"}),h.jsxs("div",{className:"navigation-header-actions",children:[h.jsx(At,{label:t?`在 ${t.name} 中新建对话`:"新建对话",className:"size-7",disabled:!e.online||!t||e.newThread.isPending,onClick:()=>{t&&e.newThread.mutate(t.id)},children:e.newThread.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(If,{className:"size-3.5"})}),h.jsx(At,{label:t?`打开 ${t.name} 文件夹`:"打开应用文件夹",className:"size-7",disabled:!e.online||!t||e.revealing,onClick:()=>{t&&e.revealProject(t)},children:h.jsx(Ic,{className:"size-3.5"})})]})]}),h.jsxs("label",{className:"navigation-search",children:[h.jsx(Tf,{className:"size-3.5 shrink-0"}),h.jsx("input",{"aria-label":"搜索当前应用的对话",placeholder:"搜索对话",value:e.threadSearch,onChange:l=>e.setThreadSearch(l.target.value)})]}),n&&h.jsxs("div",{className:"navigation-browsing navigation-meta",children:[h.jsx("span",{children:"正在浏览"}),e.activeProjectId&&h.jsxs("button",{type:"button",onClick:e.returnToCurrent,className:"navigation-return",children:[h.jsx(LR,{className:"size-3"}),"返回当前对话"]})]}),h.jsxs("div",{className:"navigation-scroll",role:"list","aria-label":"对话",children:[e.conversationQuery.isError&&h.jsxs("div",{role:"alert",className:"navigation-query-error",children:["无法加载对话",h.jsx(Je,{variant:"ghost",onClick:()=>{e.conversationQuery.refetch()},children:"重试"})]}),t&&e.projectThreads===void 0&&e.conversationQuery.isFetching&&h.jsx("div",{role:"status",className:"navigation-empty",children:"正在加载对话…"}),!e.conversationQuery.isFetching&&!e.conversationQuery.isError&&e.visibleThreads.length===0&&h.jsxs("div",{className:"navigation-empty",children:[t?e.search||e.threadSearch?"没有匹配的对话":e.online||e.projectThreads!==void 0?"此应用还没有对话":"Host 未连接,暂无缓存对话":"请先创建或选择应用",t&&!e.search&&!e.threadSearch&&h.jsx(Je,{variant:"ghost",className:"mt-3",onClick:()=>{e.openWorkspace(t)},children:"打开工作区"})]}),s.filter(l=>l.threads.length>0).map(l=>h.jsxs("section",{"aria-label":l.label,children:[h.jsx("h3",{className:"navigation-group-label",children:l.label}),l.threads.map(u=>h.jsx(m7,{thread:u,nav:e},u.id))]},l.label))]}),h.jsxs("footer",{className:"conversation-footer navigation-meta",children:[e.projectThreads?`${e.projectThreads.length} 条对话`:"对话数量待加载",h.jsx("span",{children:"本地保存"})]})]})}function v7(){const e=u7(),{newAppOpen:t,setNewAppOpen:n,createManagedApp:r,appName:o,setAppName:s,online:l,removeTarget:u,setRemoveTarget:f,removeApplication:p,applicationDeleteError:m,deleteThreadTarget:g,setDeleteThreadTarget:x,deleteThread:y}=e;return h.jsxs("div",{className:"project-navigation","aria-label":"应用与对话导航",children:[h.jsx(f7,{navigation:e}),e.browsedProject&&h.jsx(g7,{navigation:e}),h.jsx(Tr,{open:t,onOpenChange:w=>{r.isPending||n(w)},title:"新建应用",description:"Harness 会在托管工作区创建独立业务源码目录,并立即启动 Runtime 2.0 预览。",closeDisabled:r.isPending,footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",onClick:()=>n(!1),disabled:r.isPending,children:"取消"}),h.jsxs(Je,{onClick:()=>r.mutate(),disabled:!o.trim()||r.isPending,children:[r.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(If,{className:"size-3.5"}),r.isPending?"正在创建…":"创建应用"]})]}),children:h.jsxs("label",{className:"block",children:[h.jsx("span",{className:"mb-1.5 block type-ui font-medium text-[var(--subtle-fg)]",children:"应用名称"}),h.jsx("input",{autoFocus:!0,"aria-label":"应用名称",value:o,maxLength:240,onChange:w=>s(w.target.value),onKeyDown:w=>{w.key==="Enter"&&o.trim()&&!r.isPending&&r.mutate()},placeholder:"例如:客户管理",className:"h-9 w-full rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-3 type-ui text-[var(--fg)] outline-none focus:border-[var(--accent)]/55 focus:ring-2 focus:ring-[var(--accent)]/15"}),h.jsx("span",{className:"mt-2 block type-meta text-[var(--dim-fg)]",children:"物理目录由 Host 安全生成;修改显示名称不会移动源码。"})]})}),h.jsxs(Tr,{open:u!==null,onOpenChange:w=>{!w&&!p.isPending&&f(null)},closeDisabled:p.isPending,title:"删除应用?",description:u?.kind==="managed"?"源码目录会移入系统回收站;对话记录仍保留在本地数据中。":"只会移除应用登记,不会删除或修改原始目录。",footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",disabled:p.isPending,onClick:()=>f(null),children:"取消"}),m&&h.jsx(Je,{variant:"secondary",disabled:!u||p.isPending,onClick:()=>{u&&p.mutate({project:u,listOnly:!0})},children:"仅从列表移除"}),h.jsxs(Je,{variant:"danger",disabled:!u||p.isPending,onClick:()=>{u&&p.mutate({project:u})},children:[p.isPending&&h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),m?"重试删除":"确认删除"]})]}),children:[h.jsxs("p",{className:"break-all type-ui text-[var(--muted-fg)]",children:["即将删除“",u?.name,"”。"]}),m&&h.jsxs("div",{role:"alert",className:"mt-3 rounded-lg border border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] p-3 type-ui text-[var(--status-warning-fg)]",children:[h.jsx("p",{children:"删除失败。可以选择“仅从列表移除”,不删除源码和对话记录;运行中的应用仍需先结束任务。"}),h.jsx("p",{className:"mt-2 max-h-32 overflow-auto break-all type-meta",children:m})]})]}),h.jsx(Tr,{open:g!==null,onOpenChange:w=>{!w&&!y.isPending&&x(null)},closeDisabled:y.isPending,title:"删除这条对话?",description:"此操作不可恢复,并会删除历史记录、审批记录和物理附件。",footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",disabled:y.isPending,onClick:()=>x(null),children:"取消"}),h.jsxs(Je,{variant:"danger",disabled:!g||y.isPending,onClick:()=>{g&&y.mutate(g)},children:[y.isPending&&h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),"确认删除"]})]}),children:h.jsxs("p",{className:"break-all type-ui text-[var(--muted-fg)]",children:["即将删除“",g?.title,"”。"]})})]})}const ak=e=>Symbol.iterator in e,sk=e=>"entries"in e,lk=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},y7=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function b7(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:ak(e)&&ak(t)?sk(e)&&sk(t)?lk(e,t):y7(e,t):lk({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function x7(e){const t=Cs.useRef(void 0);return n=>{const r=e(n);return b7(t.current,r)?t.current:t.current=r}}const w7={getState:()=>D.getState(),request:e=>He.call("thread.history",e)};async function xC(e,t=w7){const{projectId:n,threadId:r,sessionId:o,prepend:s,beforeItemId:l,beforeApply:u}=e,f=x=>x.hostSessionId===o&&x.projects.some(y=>y.id===n)&&x.threadDetailsById[r]?.projectId===n,p=t.getState();if(!f(p))return"ignored";if(s&&!l)throw new Error("没有更早的历史记录");const m=p.beginThreadHistory(r,s),g=x=>f(x)&&x.historyByThreadId[r]?.requestId===m;try{const x=await t.request({threadId:r,itemLimit:200,...l?{beforeItemId:l}:{}}),y=t.getState();return!g(y)||x.thread.id!==r||x.thread.projectId!==n?"ignored":(u?.(),y.hydrateThreadHistory(Rr(x.thread,x.items,x.turns,x.approvals),{itemsHasMore:x.itemsHasMore,...x.nextBeforeItemId?{nextBeforeItemId:x.nextBeforeItemId}:{},snapshotSeq:x.snapshotSeq,requestId:m},s),"applied")}catch(x){const y=t.getState();throw g(y)&&y.failThreadHistory(r,x instanceof Error?x.message:"Host 返回未知错误",m),x}}const S7=96;function k7(e,t,n=typeof ResizeObserver>"u"?void 0:r=>new ResizeObserver(r)){const r=e.filter(s=>s!=null);if(!n||r.length===0)return()=>{};const o=n(t);return r.forEach(s=>o.observe(s)),()=>o.disconnect()}function I7(e){return Math.max(0,e.scrollHeight-e.scrollTop-e.clientHeight)}function T7(e,t){return e.scrollTop+Math.max(0,t-e.scrollHeight)}function j7(e,t,n,r={}){const o=r.requestFrame??(x=>window.requestAnimationFrame(x)),s=r.cancelFrame??(x=>window.cancelAnimationFrame(x)),l=["wheel","touchstart","pointerdown","keydown"];let u,f=0,p=12;const m=()=>{u!==void 0&&s(u),u=void 0;for(const x of l)e.removeEventListener(x,m)},g=()=>{u=void 0;const x=t(),y=x===void 0?void 0:x-n;y!==void 0&&Math.abs(y)>.5?(e.scrollTop+=y,f=0):f=y===void 0?0:f+1,f>=2||--p===0?m():u=o(g)};for(const x of l)e.addEventListener(x,m,{passive:!0});return u=o(g),m}function C7(e,t={}){const n=t.requestFrame??(p=>window.requestAnimationFrame(p)),r=t.cancelFrame??(p=>window.cancelAnimationFrame(p));let o=null,s=!0,l=null;const u=()=>{l!==null&&(r(l),l=null)},f=()=>{!s||l!==null||(l=n(()=>{if(l=null,!s)return;const p=e();p&&p.scrollTo({top:p.scrollHeight,behavior:"auto"})}))};return{contentChanged:f,dispose:u,scrollToBottom(){s=!0,f()},threadChanged(p){return o===p?!1:(o=p,s=!0,u(),f(),!0)},viewportScrolled(){const p=e(),m=p?I7(p):0;return s=m<=S7,{distanceFromBottom:m,showScrollButton:!s}}}}const Ts=new Map,sa=new Map;function wC(e,t){for(Ts.delete(e),Ts.set(e,t);Ts.size>10;){const n=Ts.keys().next().value;Ts.delete(n),sa.delete(n)}}function E7(e){const t=Ts.get(e)??new Map;return wC(e,t),t}function _7(e,t,n,r=900){let o=0,s=0;for(;o<e.length&&s+e[o]<t-r;)s+=e[o++];let l=o,u=s;for(;l<e.length&&u<t+n+r;)u+=e[l++];return{start:o,end:Math.max(l,Math.min(o+1,e.length)),offset:s,total:e.reduce((f,p)=>f+p,0)}}function A7({id:e,measure:t,children:n}){const r=I.useRef(null);return I.useLayoutEffect(()=>{const o=r.current;if(!o)return;const s=()=>{const u=o.getBoundingClientRect().height;u>0&&t(e,u+16)};if(s(),typeof ResizeObserver>"u")return;const l=new ResizeObserver(s);return l.observe(o),()=>l.disconnect()},[e,t]),h.jsx("div",{ref:r,className:"min-w-0",style:{marginBottom:16},children:n})}function M7({entries:e,keyOf:t,viewportRef:n,visible:r,children:o,cacheKey:s}){const l=I.useRef(null),u=I.useMemo(()=>s?E7(s):new Map,[s]),f=I.useMemo(()=>e.map(t),[e,t]),p=I.useRef(f);p.current=f;const[m,g]=I.useState(0),[x,y]=I.useState({top:0,height:800}),w=I.useMemo(()=>(k,_)=>{const C=u.get(k)??156;if(u.get(k)===_)return;const E=n.current;if(E&&l.current&&E.clientHeight>0){let O=l.current.getBoundingClientRect().top-E.getBoundingClientRect().top+E.scrollTop;for(const M of p.current){if(M===k)break;O+=u.get(M)??156}O+C<=E.scrollTop&&E.scrollHeight-E.scrollTop-E.clientHeight>96&&(E.scrollTop+=_-C)}u.set(k,_),g(O=>O+1)},[u,n]),S=I.useMemo(()=>f.map(k=>u.get(k)??156),[f,m,u]);if(I.useLayoutEffect(()=>{r&&s&&wC(s,u)},[s,u,r]),I.useLayoutEffect(()=>{const k=n.current;if(!r||!k)return;let _;const C=()=>{_=void 0;const M=l.current?l.current.getBoundingClientRect().top-k.getBoundingClientRect().top+k.scrollTop:0;y({top:Math.max(0,k.scrollTop-M),height:k.clientHeight||800})},E=()=>{_??=requestAnimationFrame(C)};C(),k.addEventListener("scroll",E,{passive:!0});const O=typeof ResizeObserver>"u"?void 0:new ResizeObserver(E);return O?.observe(k),()=>{k.removeEventListener("scroll",E),O?.disconnect(),_!==void 0&&cancelAnimationFrame(_)}},[r,n,e.length]),e.length<=60)return h.jsx(h.Fragment,{children:e.map(o)});const T=_7(S,x.top,x.height);return h.jsx("div",{ref:l,"data-chat-virtual-list":"true",style:{paddingTop:T.offset,paddingBottom:Math.max(0,T.total-S.slice(0,T.end).reduce((k,_)=>k+_,0))},children:e.slice(T.start,T.end).map((k,_)=>h.jsx(A7,{id:f[T.start+_],measure:w,children:o(k)},f[T.start+_]))})}function N7({threadId:e,thread:t,history:n,scrollKey:r,visible:o}){const s=I.useRef(null),l=I.useRef(null),u=I.useRef(null),f=I.useRef(null);f.current||(f.current=C7(()=>s.current));const p=f.current,[m,g]=I.useState(!1),x=vn({mutationFn:async({prepend:y})=>{if(!e)throw new Error("没有可恢复的会话");const w=y?n?.nextBeforeItemId:void 0;if(y&&!w)throw new Error("没有更早的历史记录");const S=e;return xC({projectId:t?.projectId??"",threadId:S,sessionId:D.getState().hostSessionId,prepend:y,...w?{beforeItemId:w}:{},beforeApply:()=>{const T=s.current;if(!y||!T||S!==D.getState().activeThreadId)return;const k=T.getBoundingClientRect(),_=Array.from(l.current?.querySelectorAll("[data-chat-entry-id]")??[]).find(C=>{const E=C.getBoundingClientRect();return E.bottom>=k.top&&E.top<=k.bottom});u.current={threadId:S,scrollHeight:T.scrollHeight,scrollTop:T.scrollTop,..._?.dataset.chatEntryId?{entryId:_.dataset.chatEntryId,entryTop:_.getBoundingClientRect().top}:{}}}})}});return I.useLayoutEffect(()=>{if(!o)return;p.threadChanged(e)&&g(!1);const y=u.current;if(y&&(u.current=null,y.threadId===e)){const w=s.current;if(w){const S=y.entryId?Array.from(l.current?.querySelectorAll("[data-chat-entry-id]")??[]).find(T=>T.dataset.chatEntryId===y.entryId):void 0;return S&&y.entryTop!==void 0?w.scrollTop+=S.getBoundingClientRect().top-y.entryTop:w.scrollTop=T7(y,w.scrollHeight),g(p.viewportScrolled().showScrollButton),y.entryId&&y.entryTop!==void 0?j7(w,()=>Array.from(l.current?.querySelectorAll("[data-chat-entry-id]")??[]).find(T=>T.dataset.chatEntryId===y.entryId)?.getBoundingClientRect().top,y.entryTop):void 0}}p.contentChanged()},[p,e,t?.items,o]),I.useLayoutEffect(()=>{if(!o)return;const y=s.current,w=sa.get(r);return y&&w&&!w.following?(y.scrollTop=w.top,p.viewportScrolled(),g(!0)):p.contentChanged(),k7([y,l.current],()=>p.contentChanged())},[p,r,o]),I.useEffect(()=>()=>p.dispose(),[p]),{scrollRef:s,scrollContentRef:l,scrollController:p,showScrollButton:m,setShowScrollButton:g,historyPage:x}}function SC(e){return e.type==="message"&&e.role==="assistant"&&e.finishReason==="tool"}function kC(e){return e.type==="message"&&e.role==="assistant"&&e.streaming===!0&&e.content.trim().length===0}function ck(e){return e.type==="tool"||e.type==="approval"||e.type==="reasoning"||SC(e)&&e.content.trim().length>0||kC(e)}function P7(e){const n=e.filter(r=>r.type==="tool").filter(r=>r.state==="completed");return{reads:n.filter(r=>["read_file","search_files","list_directory"].includes(r.toolName)).length,commands:n.filter(r=>r.toolName==="run_command").length,writes:n.filter(r=>["apply_patch","write_file","move_to_trash"].includes(r.toolName)).length}}const R7=new Set(["read_file","write_file","apply_patch"]),O7=new Set(["write_file","apply_patch"]),uk="(?:missing|[a-fA-F0-9]{64}|\\[REDACTED_BINARY_DATA\\])",z7=new RegExp(`^File changed since it was read \\(expected ${uk}, found ${uk}\\)(?:\\r?\\n|$)`,"u"),D7=[/^Patch is not a valid unified diff\. Include a numbered hunk header such as @@ -1,2 \+1,2 @@\.(?:\r?\n|$)/u,/^Patch must describe exactly one file and include at least one numbered unified-diff hunk,[\s\S]*$/u,/^Patch contains an invalid hunk range\.[\s\S]*$/u,/^Patch hunk ranges do not match their changed lines\.(?:\r?\n|$)/u,/^Patch hunk range is outside the current file;[\s\S]*$/u,/^Patch contains no changed lines\.(?:\r?\n|$)/u,/^Patch did not apply cleanly(?:\r?\n|$)/u,/^Patch produced no file changes;[\s\S]*$/u];function IC(e){return[e.stderr,e.stdout,e.output].find(t=>typeof t=="string"&&t.trim().length>0)??""}function Yg(e,t){const n=e.failure?.targetPath??e.workspacePath??e.input?.path;if(typeof n!="string")return;const r=n.trim().replaceAll("\\","/").replace(/^\.\//u,"");return t?r||void 0:r.toLocaleLowerCase("en-US")||void 0}function L7(e){if(e.state!=="failed"||!["write_file","apply_patch"].includes(e.toolName))return!1;const t=IC(e);return/^expectedHash is required; read the file before modifying it(?:\r?\n|$)/u.test(t)||z7.test(t)||/^File changed since it was read; read it again before (?:writing|patching)(?:\r?\n|$)/u.test(t)}function TC(e){if(e.state!=="failed"||e.toolName!=="apply_patch")return!1;const t=IC(e);return D7.some(n=>n.test(t))}function B7(e){return e.toolName==="apply_patch"&&(e.failure?.category==="validation"||e.failure?.code.startsWith("patch_")===!0||TC(e))}function q7(e,t){return e.state==="failed"&&Yg(e,t)!==void 0&&(e.failure?.agentRecoverable===!0||L7(e)||TC(e))}function $7(e){return e.state==="failed"&&e.toolName==="frontend_validate"&&e.failure?.agentRecoverable===!0}function dk(e,t,n){const r=e.filter(p=>p.type==="tool"),o=t?.status==="queued"||t?.status==="running"||t?.status==="waiting-approval",s={};let l=0,u=0,f=0;for(let p=0;p<r.length;p+=1){const m=r[p];if(!m||m.state!=="failed")continue;if($7(m)){r.slice(p+1).some(S=>S.toolName==="frontend_validate"&&S.state==="completed"&&S.turnId!==void 0&&S.turnId===m.turnId)||t?.status==="completed"?(s[m.id]="recovered",l+=1):o?(s[m.id]="adjusting",u+=1):f+=1;continue}if(!q7(m,n)){f+=1;continue}const g=Yg(m,n),x=B7(m)?O7:R7;r.slice(p+1).some(w=>w.state==="completed"&&x.has(w.toolName)&&Yg(w,n)===g)?(s[m.id]="recovered",l+=1):o?(s[m.id]="adjusting",u+=1):f+=1}return{presentations:s,recovered:l,adjusting:u,unresolved:f}}function fk(e,t){return e.some(n=>n.type==="approval"&&n.status==="pending")||e.some(n=>n.type==="tool"&&n.state==="awaiting_approval")?"awaiting_approval":t.unresolved>0||e.some(n=>n.type==="error")?"failed":t.adjusting>0||e.some(n=>n.type==="tool"&&n.state==="running")||e.some(n=>n.type==="reasoning"&&n.streaming)||e.some(n=>n.type==="message"&&n.streaming)?"running":e.some(n=>n.type==="tool"&&n.state==="cancelled")?"cancelled":"completed"}function pk(e,t,n){if(t==="awaiting_approval")return"等待你确认操作";if(t==="running"){if(n.adjusting>0)return`正在调整 ${n.adjusting} 项操作`;const s=[...e].reverse().find(l=>l.type==="tool"&&l.state==="running");return s?.type==="tool"&&s.toolName==="run_command"?"正在运行命令":"正在分析与处理"}const r=P7(e);if(t==="failed")return n.unresolved>0?`${n.unresolved} 项操作失败`:"工作过程出现错误";if(t==="cancelled")return"工作过程已取消";const o=[];return r.reads>0&&o.push(`查看了 ${r.reads} 项`),r.commands>0&&o.push(`运行了 ${r.commands} 条命令`),r.writes>0&&o.push(`完成了 ${r.writes} 项修改`),n.recovered>0&&o.push(`已自动修正 ${n.recovered} 次`),o.join(" · ")||(e.length===0?"分析已完成":"工作过程已完成")}function hk(e,t){return t==="failed"||t==="awaiting_approval"||t==="cancelled"||!e?t:e.status==="queued"||e.status==="running"?"running":e.status==="waiting-approval"?"awaiting_approval":e.status==="failed"?"failed":e.status==="interrupted"||e.status==="cancelled"?"cancelled":t}function mk(e,t,n,r,o){if(n?.postTurnStatus==="validating")return"validating";if(r!=="running"||n?.providerRetrying===!0||n?.providerPhase==="reasoning"||t.some(l=>l.type==="reasoning"&&l.streaming===!0))return;if([...t].reverse().find(l=>l.type==="tool"&&["queued","running"].includes(l.state)))return"running-tool";if(!t.some(l=>l.type==="approval"&&l.status==="pending"||l.type==="message"&&l.role==="assistant"&&l.streaming===!0&&l.content.trim().length>0||l.type==="message"&&l.role==="assistant"&&l.streaming!==!0&&l.finishReason!==void 0&&l.finishReason!=="tool"))return o.adjusting>0?"adjusting":t.some(l=>l.type==="tool")?"analyzing-tool-results":e.some(kC)?"waiting-model":"preparing"}function U7(e,t=[],n={}){const r=n.caseSensitivePaths??!0,o=new Set(e.flatMap(y=>{const w="turnId"in y?y.turnId:void 0;return ck(y)&&w?[w]:[]})),s=y=>{if(ck(y))return!0;const w="turnId"in y?y.turnId:void 0;return y.type==="error"&&!!(w&&o.has(w))},l=new Map;for(const y of e){if(!s(y))continue;const S=("turnId"in y?y.turnId:void 0)??`item:${y.id}`,T=l.get(S)??[];T.push(y),l.set(S,T)}const u=new Map(t.map(y=>[y.id,y])),f=new Map;for(const y of e){const w="turnId"in y?y.turnId:void 0;if(!w)continue;const S=f.get(w)??[];S.push(y),f.set(w,S)}const p=new Set([...l.keys()].filter(y=>!y.startsWith("item:")));for(const y of t)(y.status==="queued"||y.status==="running"||y.status==="waiting-approval"||y.postTurnStatus==="validating"||y.providerRetrying===!0||(y.providerRetryCount??0)>0||y.reasoningObserved===!0||(y.reasoningDurationMs??0)>0||y.usage?.reasoningTokens!==void 0)&&p.add(y.id);const m=new Set,g=[],x=y=>{if(m.has(y)||!p.has(y))return;m.add(y);const w=l.get(y)??[],S=u.get(y),T=dk(w,S,r),k=hk(S,fk(w,T)),_=mk(w,f.get(y)??w,S,k,T);g.push({type:"activity",id:`activity:${y}`,turnId:y,items:w,state:k,summary:pk(w,k,T),..._?{liveStatus:_}:{},...Object.keys(T.presentations).length>0?{toolFailurePresentation:T.presentations}:{},...T.recovered>0?{recoveredFailureCount:T.recovered}:{},...T.adjusting>0?{adjustingFailureCount:T.adjusting}:{}})};for(const y of e){if(SC(y)&&y.content.trim().length===0&&!y.streaming)continue;if(!s(y)){y.type==="message"&&y.role==="assistant"&&y.turnId&&x(y.turnId),g.push({type:"item",item:y});continue}const w="turnId"in y?y.turnId:void 0,S=w??`item:${y.id}`;if(m.has(S))continue;m.add(S);const T=l.get(S)??[y],k=w?u.get(w):void 0,_=dk(T,k,r),C=hk(k,fk(T,_)),E=mk(T,w?f.get(w)??T:T,k,C,_);g.push({type:"activity",id:`activity:${S}`,...w?{turnId:w}:{},items:T,state:C,summary:pk(T,C,_),...E?{liveStatus:E}:{},...Object.keys(_.presentations).length>0?{toolFailurePresentation:_.presentations}:{},..._.recovered>0?{recoveredFailureCount:_.recovered}:{},..._.adjusting>0?{adjustingFailureCount:_.adjusting}:{}})}for(const y of p)x(y);return g}class H7{constructor(t){this.hostSessionId=t}hostSessionId;#e;#t=!1;#n=0;#r=!1;#i;open(t){this.close(),this.#e=Object.freeze({...t}),this.#t=!0}close(){this.#t=!1,this.#n+=1,this.#r=!1,this.#i?.abort()}begin(){const t=this.#e;if(!this.#t||this.#r||!t?.threadId||t.hostSessionId!==this.hostSessionId())return;const n=++this.#n,r=new AbortController;this.#i=r,this.#r=!0;const o=()=>this.#t&&this.#n===n&&t.hostSessionId===this.hostSessionId()&&!r.signal.aborted;return{scope:t,requestId:n,signal:r.signal,current:o,finish:()=>{o()&&(this.#r=!1)}}}}async function Pm(e,t){if(!e.current())return{status:"ignored"};try{const n=await t();return e.current()?{status:"success",value:n}:{status:"ignored"}}catch(n){return e.current()?{status:"failure",error:n instanceof Error?n.message:"Host 返回未知错误"}:{status:"ignored"}}finally{e.finish()}}const By={attachment(e,t){return Pm(e,async()=>{const n=da(e.scope.threadId,t.artifactId,t.kind==="document"?"extracted-text":"source"),r=await fetch(n,{credentials:"same-origin",signal:e.signal});if(!r.ok)throw new Error(`附件正文预览加载失败(HTTP ${r.status})`);const o=await r.text();return o.length>16e3?`${o.slice(0,16e3)}
175
+
176
+ ……预览已截断`:o})},artifact(e,t,n){return Pm(e,()=>He.call("artifact.read",{threadId:e.scope.threadId,artifactId:t,offset:n,limit:64*1024}))},approval(e,t,n){return Pm(e,()=>He.call("approval.resolve",{requestId:t,decision:n,decidedAt:new Date().toISOString()}))}};function qy(e,t,n=!0){const[r]=I.useState(()=>new H7(()=>D.getState().hostSessionId));return I.useLayoutEffect(()=>(n&&r.open(e),()=>r.close()),[r,e.hostSessionId,e.projectId,e.threadId,t,n]),r}function F7(e,t){const[n,r]=I.useState(""),[o,s]=I.useState(""),[l,u]=I.useState(!1),f=qy(e,t?.artifactId,!!t);return I.useEffect(()=>{if(r(""),s(""),u(!1),!t||t.kind==="image")return;const p=f.begin();p&&(u(!0),By.attachment(p,t).then(m=>{!p.current()||m.status==="ignored"||(m.status==="success"?r(m.value):s(m.error),u(!1))}))},[f,t,e.hostSessionId,e.projectId,e.threadId]),{textPreview:n,previewError:o,setPreviewError:s,previewLoading:l}}function V7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Z7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,K7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Q7={};function gk(e,t){return(Q7.jsx?K7:Z7).test(e)}const G7=/[ \t\n\f\r]/g;function Y7(e){return typeof e=="object"?e.type==="text"?vk(e.value):!1:vk(e)}function vk(e){return e.replace(G7,"")===""}class Gc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Gc.prototype.normal={};Gc.prototype.property={};Gc.prototype.space=void 0;function jC(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Gc(n,r,t)}function Wg(e){return e.toLowerCase()}class Xn{constructor(t,n){this.attribute=n,this.property=t}}Xn.prototype.attribute="";Xn.prototype.booleanish=!1;Xn.prototype.boolean=!1;Xn.prototype.commaOrSpaceSeparated=!1;Xn.prototype.commaSeparated=!1;Xn.prototype.defined=!1;Xn.prototype.mustUseProperty=!1;Xn.prototype.number=!1;Xn.prototype.overloadedBoolean=!1;Xn.prototype.property="";Xn.prototype.spaceSeparated=!1;Xn.prototype.space=void 0;let W7=0;const Ge=Na(),rn=Na(),Xg=Na(),ke=Na(),_t=Na(),ha=Na(),sr=Na();function Na(){return 2**++W7}const Jg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ge,booleanish:rn,commaOrSpaceSeparated:sr,commaSeparated:ha,number:ke,overloadedBoolean:Xg,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Rm=Object.keys(Jg);class $y extends Xn{constructor(t,n,r,o){let s=-1;if(super(t,n),yk(this,"space",o),typeof r=="number")for(;++s<Rm.length;){const l=Rm[s];yk(this,Rm[s],(r&Jg[l])===Jg[l])}}}$y.prototype.defined=!0;function yk(e,t,n){n&&(e[t]=n)}function sl(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new $y(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Wg(r)]=r,n[Wg(s.attribute)]=r}return new Gc(t,n,e.space)}const CC=sl({properties:{ariaActiveDescendant:null,ariaAtomic:rn,ariaAutoComplete:null,ariaBusy:rn,ariaChecked:rn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:_t,ariaCurrent:null,ariaDescribedBy:_t,ariaDetails:null,ariaDisabled:rn,ariaDropEffect:_t,ariaErrorMessage:null,ariaExpanded:rn,ariaFlowTo:_t,ariaGrabbed:rn,ariaHasPopup:null,ariaHidden:rn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_t,ariaLevel:ke,ariaLive:null,ariaModal:rn,ariaMultiLine:rn,ariaMultiSelectable:rn,ariaOrientation:null,ariaOwns:_t,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:rn,ariaReadOnly:rn,ariaRelevant:null,ariaRequired:rn,ariaRoleDescription:_t,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:rn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function EC(e,t){return t in e?e[t]:t}function _C(e,t){return EC(e,t.toLowerCase())}const X7=sl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ha,acceptCharset:_t,accessKey:_t,action:null,allow:null,allowFullScreen:Ge,allowPaymentRequest:Ge,allowUserMedia:Ge,alpha:Ge,alt:null,as:null,async:Ge,autoCapitalize:null,autoComplete:_t,autoFocus:Ge,autoPlay:Ge,blocking:_t,capture:null,charSet:null,checked:Ge,cite:null,className:_t,closedBy:null,colorSpace:null,cols:ke,colSpan:ke,command:null,commandFor:null,content:null,contentEditable:rn,controls:Ge,controlsList:_t,coords:ke|ha,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ge,defer:Ge,dir:null,dirName:null,disabled:Ge,download:Xg,draggable:rn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ge,formTarget:null,headers:_t,height:ke,hidden:Xg,high:ke,href:null,hrefLang:null,htmlFor:_t,httpEquiv:_t,id:null,imageSizes:null,imageSrcSet:null,inert:Ge,inputMode:null,integrity:null,is:null,isMap:Ge,itemId:null,itemProp:_t,itemRef:_t,itemScope:Ge,itemType:_t,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ge,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:Ge,muted:Ge,name:null,nonce:null,noModule:Ge,noValidate:Ge,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:Ge,optimum:ke,pattern:null,ping:_t,placeholder:null,playsInline:Ge,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ge,referrerPolicy:null,rel:_t,required:Ge,reversed:Ge,rows:ke,rowSpan:ke,sandbox:_t,scope:null,scoped:Ge,seamless:Ge,selected:Ge,shadowRootClonable:Ge,shadowRootCustomElementRegistry:Ge,shadowRootDelegatesFocus:Ge,shadowRootMode:null,shadowRootSerializable:Ge,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:rn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:Ge,useMap:null,value:rn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_t,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ge,declare:Ge,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:Ge,noHref:Ge,noShade:Ge,noWrap:Ge,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:rn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ge,disablePictureInPicture:Ge,disableRemotePlayback:Ge,exportParts:ha,part:_t,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:_C}),J7=sl({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:sr,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:_t,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:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:Ge,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,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:ha,g2:ha,glyphName:ha,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,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:ke,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:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_t,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,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:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:EC}),AC=sl({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),MC=sl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_C}),NC=sl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),eF={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"},tF=/[A-Z]/g,bk=/-[a-z]/g,nF=/^data[-\w.:]+$/i;function rF(e,t){const n=Wg(t);let r=t,o=Xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&nF.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(bk,oF);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!bk.test(s)){let l=s.replace(tF,iF);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=$y}return new o(r,t)}function iF(e){return"-"+e.toLowerCase()}function oF(e){return e.charAt(1).toUpperCase()}const aF=jC([CC,X7,AC,MC,NC],"html"),Uy=jC([CC,J7,AC,MC,NC],"svg");function sF(e){return e.join(" ").trim()}var ac={},Om,xk;function lF(){if(xk)return Om;xk=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
177
+ `,p="/",m="*",g="",x="comment",y="declaration";Om=function(S,T){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];T=T||{};var k=1,_=1;function C(ae){var J=ae.match(t);J&&(k+=J.length);var he=ae.lastIndexOf(f);_=~he?ae.length-he:_+ae.length}function E(){var ae={line:k,column:_};return function(J){return J.position=new O(ae),z(),J}}function O(ae){this.start=ae,this.end={line:k,column:_},this.source=T.source}O.prototype.content=S;function M(ae){var J=new Error(T.source+":"+k+":"+_+": "+ae);if(J.reason=ae,J.filename=T.source,J.line=k,J.column=_,J.source=S,!T.silent)throw J}function R(ae){var J=ae.exec(S);if(J){var he=J[0];return C(he),S=S.slice(he.length),J}}function z(){R(n)}function K(ae){var J;for(ae=ae||[];J=q();)J!==!1&&ae.push(J);return ae}function q(){var ae=E();if(!(p!=S.charAt(0)||m!=S.charAt(1))){for(var J=2;g!=S.charAt(J)&&(m!=S.charAt(J)||p!=S.charAt(J+1));)++J;if(J+=2,g===S.charAt(J-1))return M("End of comment missing");var he=S.slice(2,J-2);return _+=2,C(he),S=S.slice(J),_+=2,ae({type:x,comment:he})}}function Z(){var ae=E(),J=R(r);if(J){if(q(),!R(o))return M("property missing ':'");var he=R(s),F=ae({type:y,property:w(J[0].replace(e,g)),value:he?w(he[0].replace(e,g)):g});return R(l),F}}function Y(){var ae=[];K(ae);for(var J;J=Z();)J!==!1&&(ae.push(J),K(ae));return ae}return z(),Y()};function w(S){return S?S.replace(u,g):g}return Om}var zm,wk;function cF(){if(wk)return zm;wk=1;var e=lF();function t(n,r){var o=null;if(!n||typeof n!="string")return o;for(var s,l=e(n),u=typeof r=="function",f,p,m=0,g=l.length;m<g;m++)s=l[m],f=s.property,p=s.value,u?r(f,p,s):p&&(o||(o={}),o[f]=p);return o}return zm=t,zm}var sc={},Sk;function uF(){if(Sk)return sc;Sk=1,sc.__esModule=!0,sc.camelCase=void 0;var e=/^--[a-zA-Z0-9-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o)-/,o=function(s){return!s||n.test(s)||e.test(s)?s:s.toLowerCase().replace(r,function(l,u){return u+"-"}).replace(t,function(l,u){return u.toUpperCase()})};return sc.camelCase=o,sc}var kk;function dF(){return kk||(kk=1,(function(e){var t=ac&&ac.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};e.__esModule=!0;var n=t(cF()),r=uF();function o(s){if(!s||typeof s!="string")return{};var l={};return n.default(s,function(u,f){u&&f&&(l[r.camelCase(u)]=f)}),l}e.default=o})(ac)),ac}var fF=dF();const pF=vv(fF),PC=RC("end"),Hy=RC("start");function RC(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function hF(e){const t=Hy(e),n=PC(e);if(t&&n)return{start:t,end:n}}function mc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ik(e.position):"start"in e||"end"in e?Ik(e):"line"in e||"column"in e?ev(e):""}function ev(e){return Tk(e&&e.line)+":"+Tk(e&&e.column)}function Ik(e){return ev(e&&e.start)+"-"+ev(e&&e.end)}function Tk(e){return e&&typeof e=="number"?e:1}class An extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},l=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(l=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const f=r.indexOf(":");f===-1?s.ruleId=r:(s.source=r.slice(0,f),s.ruleId=r.slice(f+1))}if(!s.place&&s.ancestors&&s.ancestors){const f=s.ancestors[s.ancestors.length-1];f&&(s.place=f.position)}const u=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=u?u.line:void 0,this.name=mc(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=l&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}An.prototype.file="";An.prototype.name="";An.prototype.reason="";An.prototype.message="";An.prototype.stack="";An.prototype.column=void 0;An.prototype.line=void 0;An.prototype.ancestors=void 0;An.prototype.cause=void 0;An.prototype.fatal=void 0;An.prototype.place=void 0;An.prototype.ruleId=void 0;An.prototype.source=void 0;const Fy={}.hasOwnProperty,mF=new Map,gF=/[A-Z]/g,vF=new Set(["table","tbody","thead","tfoot","tr"]),yF=new Set(["td","th"]),OC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function bF(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=CF(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=jF(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Uy:aF,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=zC(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function zC(e,t,n){if(t.type==="element")return xF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return wF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return kF(e,t,n);if(t.type==="mdxjsEsm")return SF(e,t);if(t.type==="root")return IF(e,t,n);if(t.type==="text")return TF(e,t)}function xF(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Uy,e.schema=o),e.ancestors.push(t);const s=LC(e,t.tagName,!1),l=EF(e,t);let u=Zy(e,t);return vF.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!Y7(f):!0})),DC(e,l,s,t),Vy(l,u),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function wF(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Dc(e,t.position)}function SF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Dc(e,t.position)}function kF(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Uy,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:LC(e,t.name,!0),l=_F(e,t),u=Zy(e,t);return DC(e,l,s,t),Vy(l,u),e.ancestors.pop(),e.schema=r,e.create(t,s,l,n)}function IF(e,t,n){const r={};return Vy(r,Zy(e,t)),e.create(t,e.Fragment,r,n)}function TF(e,t){return t.value}function DC(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function jF(e,t,n){return r;function r(o,s,l,u){const p=Array.isArray(l.children)?n:t;return u?p(s,l,u):p(s,l)}}function CF(e,t){return n;function n(r,o,s,l){const u=Array.isArray(s.children),f=Hy(r);return t(o,s,l,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function EF(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Fy.call(t.properties,o)){const s=AF(e,o,t.properties[o]);if(s){const[l,u]=s;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&yF.has(t.tagName)?r=u:n[l]=u}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function _F(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const l=s.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Dc(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const u=r.value.data.estree.body[0];u.type,s=e.evaluater.evaluateExpression(u.expression)}else Dc(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function Zy(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:mF;for(;++r<t.children.length;){const s=t.children[r];let l;if(e.passKeys){const f=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(f){const p=o.get(f)||0;l=f+"-"+p,o.set(f,p+1)}}const u=zC(e,s,l);u!==void 0&&n.push(u)}return n}function AF(e,t,n){const r=rF(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?V7(n):sF(n)),r.property==="style"){let o=typeof n=="object"?n:MF(e,String(n));return e.stylePropertyNameCase==="css"&&(o=NF(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?eF[r.property]||r.property:r.attribute,n]}}function MF(e,t){try{return pF(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new An("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=OC+"#cannot-parse-style-attribute",o}}function LC(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,l;for(;++s<o.length;){const u=gk(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(s&&u.type==="Literal"),optional:!1}:u}r=l}else r=gk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Fy.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Dc(e)}function Dc(e,t){const n=new An("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=OC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function NF(e){const t={};let n;for(n in e)Fy.call(e,n)&&(t[PF(n)]=e[n]);return t}function PF(e){let t=e.replace(gF,RF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function RF(e){return"-"+e.toLowerCase()}const Dm={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"]},OF={};function Ky(e,t){const n=OF,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return BC(e,r,o)}function BC(e,t,n){if(zF(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return jk(e.children,t,n)}return Array.isArray(e)?jk(e,t,n):""}function jk(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=BC(e[o],t,n);return r.join("")}function zF(e){return!!(e&&typeof e=="object")}const Ck=document.createElement("i");function Qy(e){const t="&"+e+";";Ck.innerHTML=t;const n=Ck.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ur(e,t,n,r){const o=e.length;let s=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);s<r.length;)l=r.slice(s,s+1e4),l.unshift(t,0),e.splice(...l),s+=1e4,t+=1e4}function kr(e,t){return e.length>0?(ur(e,e.length,0,t),e):t}const Ek={}.hasOwnProperty;function qC(e){const t={};let n=-1;for(;++n<e.length;)DF(t,e[n]);return t}function DF(e,t){let n;for(n in t){const o=(Ek.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let l;if(s)for(l in s){Ek.call(o,l)||(o[l]=[]);const u=s[l];LF(o[l],Array.isArray(u)?u:u?[u]:[])}}}function LF(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ur(e,0,0,r)}function $C(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCharCode(n)}function zr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=Do(/[A-Za-z]/),En=Do(/[\dA-Za-z]/),BF=Do(/[#-'*+\--9=?A-Z^-~]/);function lf(e){return e!==null&&(e<32||e===127)}const tv=Do(/\d/),qF=Do(/[\dA-Fa-f]/),$F=Do(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function Mt(e){return e!==null&&(e<0||e===32)}function st(e){return e===-2||e===-1||e===32}const Gf=Do(/\p{P}/u),Ia=Do(/\s/);function Do(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ll(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let l="";if(s===37&&En(e.charCodeAt(n+1))&&En(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(l=String.fromCharCode(s));else if(s>55295&&s<57344){const u=e.charCodeAt(n+1);s<56320&&u>56319&&u<57344?(l=String.fromCharCode(s,u),o=1):l="�"}else l=String.fromCharCode(s);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function ht(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return l;function l(f){return st(f)?(e.enter(n),u(f)):t(f)}function u(f){return st(f)&&s++<o?(e.consume(f),u):(e.exit(n),t(f))}}const UF={tokenize:HF};function HF(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),ht(e,t,"linePrefix")}function o(u){return e.enter("paragraph"),s(u)}function s(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Fe(u)?(e.consume(u),e.exit("chunkText"),s):(e.consume(u),l)}}const FF={tokenize:VF},_k={tokenize:ZF};function VF(e){const t=this,n=[];let r=0,o,s,l;return u;function u(C){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,f,p)(C)}return p(C)}function f(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&_();const E=t.events.length;let O=E,M;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){M=t.events[O][1].end;break}k(r);let R=E;for(;R<t.events.length;)t.events[R][1].end=Object.assign({},M),R++;return ur(t.events,O+1,0,t.events.slice(E)),t.events.length=R,p(C)}return u(C)}function p(C){if(r===n.length){if(!o)return x(C);if(o.currentConstruct&&o.currentConstruct.concrete)return w(C);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_k,m,g)(C)}function m(C){return o&&_(),k(r),x(C)}function g(C){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,w(C)}function x(C){return t.containerState={},e.attempt(_k,y,w)(C)}function y(C){return r++,n.push([t.currentConstruct,t.containerState]),x(C)}function w(C){if(C===null){o&&_(),k(0),e.consume(C);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:s,_tokenizer:o}),S(C)}function S(C){if(C===null){T(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return Fe(C)?(e.consume(C),T(e.exit("chunkFlow")),r=0,t.interrupt=void 0,u):(e.consume(C),S)}function T(C,E){const O=t.sliceStream(C);if(E&&O.push(null),C.previous=s,s&&(s.next=C),s=C,o.defineSkip(C.start),o.write(O),t.parser.lazy[C.start.line]){let M=o.events.length;for(;M--;)if(o.events[M][1].start.offset<l&&(!o.events[M][1].end||o.events[M][1].end.offset>l))return;const R=t.events.length;let z=R,K,q;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){if(K){q=t.events[z][1].end;break}K=!0}for(k(r),M=R;M<t.events.length;)t.events[M][1].end=Object.assign({},q),M++;ur(t.events,z+1,0,t.events.slice(R)),t.events.length=M}}function k(C){let E=n.length;for(;E-- >C;){const O=n[E];t.containerState=O[1],O[0].exit.call(t,e)}n.length=C}function _(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function ZF(e,t,n){return ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cf(e){if(e===null||Mt(e)||Ia(e))return 1;if(Gf(e))return 2}function Yf(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const nv={name:"attention",tokenize:QF,resolveAll:KF};function KF(e,t){let n=-1,r,o,s,l,u,f,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g=Object.assign({},e[r][1].end),x=Object.assign({},e[n][1].start);Ak(g,-f),Ak(x,f),l={type:f>1?"strongSequence":"emphasisSequence",start:g,end:Object.assign({},e[r][1].end)},u={type:f>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:x},s={type:f>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o={type:f>1?"strong":"emphasis",start:Object.assign({},l.start),end:Object.assign({},u.end)},e[r][1].end=Object.assign({},l.start),e[n][1].start=Object.assign({},u.end),p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=kr(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=kr(p,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",s,t]]),p=kr(p,Yf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=kr(p,[["exit",s,t],["enter",u,t],["exit",u,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=kr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,ur(e,r-1,n-r+3,p),n=r+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function QF(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=cf(r);let s;return l;function l(f){return s=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===s)return e.consume(f),u;const p=e.exit("attentionSequence"),m=cf(f),g=!m||m===2&&o||n.includes(f),x=!o||o===2&&m||n.includes(r);return p._open=!!(s===42?g:g&&(o||!x)),p._close=!!(s===42?x:x&&(m||!g)),t(f)}}function Ak(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const GF={name:"autolink",tokenize:YF};function YF(e,t,n){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(y){return zn(y)?(e.consume(y),l):p(y)}function l(y){return y===43||y===45||y===46||En(y)?(r=1,u(y)):p(y)}function u(y){return y===58?(e.consume(y),r=0,f):(y===43||y===45||y===46||En(y))&&r++<32?(e.consume(y),u):(r=0,p(y))}function f(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||lf(y)?n(y):(e.consume(y),f)}function p(y){return y===64?(e.consume(y),m):BF(y)?(e.consume(y),p):n(y)}function m(y){return En(y)?g(y):n(y)}function g(y){return y===46?(e.consume(y),r=0,m):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):x(y)}function x(y){if((y===45||En(y))&&r++<63){const w=y===45?x:g;return e.consume(y),w}return n(y)}}const Yc={tokenize:WF,partial:!0};function WF(e,t,n){return r;function r(s){return st(s)?ht(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Fe(s)?t(s):n(s)}}const UC={name:"blockQuote",tokenize:XF,continuation:{tokenize:JF},exit:eV};function XF(e,t,n){const r=this;return o;function o(l){if(l===62){const u=r.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),s}return n(l)}function s(l){return st(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function JF(e,t,n){const r=this;return o;function o(l){return st(l)?ht(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):s(l)}function s(l){return e.attempt(UC,t,n)(l)}}function eV(e){e.exit("blockQuote")}const HC={name:"characterEscape",tokenize:tV};function tV(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return $F(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const FC={name:"characterReference",tokenize:nV};function nV(e,t,n){const r=this;let o=0,s,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),f}function f(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),s=31,l=En,m(g))}function p(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,l=qF,m):(e.enter("characterReferenceValue"),s=7,l=tv,m(g))}function m(g){if(g===59&&o){const x=e.exit("characterReferenceValue");return l===En&&!Qy(r.sliceSerialize(x))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&o++<s?(e.consume(g),m):n(g)}}const Mk={tokenize:iV,partial:!0},Nk={name:"codeFenced",tokenize:rV,concrete:!0};function rV(e,t,n){const r=this,o={tokenize:O,partial:!0};let s=0,l=0,u;return f;function f(M){return p(M)}function p(M){const R=r.events[r.events.length-1];return s=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,u=M,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(M)}function m(M){return M===u?(l++,e.consume(M),m):l<3?n(M):(e.exit("codeFencedFenceSequence"),st(M)?ht(e,g,"whitespace")(M):g(M))}function g(M){return M===null||Fe(M)?(e.exit("codeFencedFence"),r.interrupt?t(M):e.check(Mk,S,E)(M)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===null||Fe(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(M)):st(M)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ht(e,y,"whitespace")(M)):M===96&&M===u?n(M):(e.consume(M),x)}function y(M){return M===null||Fe(M)?g(M):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(M))}function w(M){return M===null||Fe(M)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(M)):M===96&&M===u?n(M):(e.consume(M),w)}function S(M){return e.attempt(o,E,T)(M)}function T(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),k}function k(M){return s>0&&st(M)?ht(e,_,"linePrefix",s+1)(M):_(M)}function _(M){return M===null||Fe(M)?e.check(Mk,S,E)(M):(e.enter("codeFlowValue"),C(M))}function C(M){return M===null||Fe(M)?(e.exit("codeFlowValue"),_(M)):(e.consume(M),C)}function E(M){return e.exit("codeFenced"),t(M)}function O(M,R,z){let K=0;return q;function q(he){return M.enter("lineEnding"),M.consume(he),M.exit("lineEnding"),Z}function Z(he){return M.enter("codeFencedFence"),st(he)?ht(M,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(he):Y(he)}function Y(he){return he===u?(M.enter("codeFencedFenceSequence"),ae(he)):z(he)}function ae(he){return he===u?(K++,M.consume(he),ae):K>=l?(M.exit("codeFencedFenceSequence"),st(he)?ht(M,J,"whitespace")(he):J(he)):z(he)}function J(he){return he===null||Fe(he)?(M.exit("codeFencedFence"),R(he)):z(he)}}}function iV(e,t,n){const r=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Lm={name:"codeIndented",tokenize:aV},oV={tokenize:sV,partial:!0};function aV(e,t,n){const r=this;return o;function o(p){return e.enter("codeIndented"),ht(e,s,"linePrefix",5)(p)}function s(p){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?f(p):Fe(p)?e.attempt(oV,l,f)(p):(e.enter("codeFlowValue"),u(p))}function u(p){return p===null||Fe(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),u)}function f(p){return e.exit("codeIndented"),t(p)}}function sV(e,t,n){const r=this;return o;function o(l){return r.parser.lazy[r.now().line]?n(l):Fe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):ht(e,s,"linePrefix",5)(l)}function s(l){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):Fe(l)?o(l):n(l)}}const lV={name:"codeText",tokenize:dV,resolve:cV,previous:uV};function cV(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function uV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dV(e,t,n){let r=0,o,s;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),r++,u):(e.exit("codeTextSequence"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(s=e.enter("codeTextSequence"),o=0,m(g)):Fe(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(g))}function p(g){return g===null||g===32||g===96||Fe(g)?(e.exit("codeTextData"),f(g)):(e.consume(g),p)}function m(g){return g===96?(e.consume(g),o++,m):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(s.type="codeTextData",p(g))}}function VC(e){const t={};let n=-1,r,o,s,l,u,f,p;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(f=r[1]._tokenizer.events,s=0,s<f.length&&f[s][1].type==="lineEndingBlank"&&(s+=2),s<f.length&&f[s][1].type==="content"))for(;++s<f.length&&f[s][1].type!=="content";)f[s][1].type==="chunkText"&&(f[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,fV(e,n)),n=t[n],p=!0);else if(r[1]._container){for(s=n,o=void 0;s--&&(l=e[s],l[1].type==="lineEnding"||l[1].type==="lineEndingBlank");)l[0]==="enter"&&(o&&(e[o][1].type="lineEndingBlank"),l[1].type="lineEnding",o=s);o&&(r[1].end=Object.assign({},e[o][1].start),u=e.slice(o,n),u.unshift(r),ur(e,o,n-o+1,u))}}return!p}function fV(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const s=[],l=n._tokenizer||r.parser[n.contentType](n.start),u=l.events,f=[],p={};let m,g,x=-1,y=n,w=0,S=0;const T=[S];for(;y;){for(;e[++o][1]!==y;);s.push(o),y._tokenizer||(m=r.sliceStream(y),y.next||m.push(null),g&&l.defineSkip(y.start),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),y._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=n;++x<u.length;)u[x][0]==="exit"&&u[x-1][0]==="enter"&&u[x][1].type===u[x-1][1].type&&u[x][1].start.line!==u[x][1].end.line&&(S=x+1,T.push(S),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(l.events=[],y?(y._tokenizer=void 0,y.previous=void 0):T.pop(),x=T.length;x--;){const k=u.slice(T[x],T[x+1]),_=s.pop();f.unshift([_,_+k.length-1]),ur(e,_,2,k)}for(x=-1;++x<f.length;)p[w+f[x][0]]=w+f[x][1],w+=f[x][1]-f[x][0]-1;return p}const pV={tokenize:gV,resolve:mV},hV={tokenize:vV,partial:!0};function mV(e){return VC(e),e}function gV(e,t){let n;return r;function r(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(u)}function o(u){return u===null?s(u):Fe(u)?e.check(hV,l,s)(u):(e.consume(u),o)}function s(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function vV(e,t,n){const r=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),ht(e,s,"linePrefix")}function s(l){if(l===null||Fe(l))return n(l);const u=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function ZC(e,t,n,r,o,s,l,u,f){const p=f||Number.POSITIVE_INFINITY;let m=0;return g;function g(k){return k===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(k),e.exit(s),x):k===null||k===32||k===41||lf(k)?n(k):(e.enter(r),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function x(k){return k===62?(e.enter(s),e.consume(k),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(u),x(k)):k===null||k===60||Fe(k)?n(k):(e.consume(k),k===92?w:y)}function w(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function S(k){return!m&&(k===null||k===41||Mt(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(r),t(k)):m<p&&k===40?(e.consume(k),m++,S):k===41?(e.consume(k),m--,S):k===null||k===32||k===40||lf(k)?n(k):(e.consume(k),k===92?T:S)}function T(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function KC(e,t,n,r,o,s){const l=this;let u=0,f;return p;function p(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(s),m}function m(y){return u>999||y===null||y===91||y===93&&!f||y===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(y):y===93?(e.exit(s),e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):Fe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Fe(y)||u++>999?(e.exit("chunkString"),m(y)):(e.consume(y),f||(f=!st(y)),y===92?x:g)}function x(y){return y===91||y===92||y===93?(e.consume(y),u++,g):g(y)}}function QC(e,t,n,r,o,s){let l;return u;function u(x){return x===34||x===39||x===40?(e.enter(r),e.enter(o),e.consume(x),e.exit(o),l=x===40?41:x,f):n(x)}function f(x){return x===l?(e.enter(o),e.consume(x),e.exit(o),e.exit(r),t):(e.enter(s),p(x))}function p(x){return x===l?(e.exit(s),f(l)):x===null?n(x):Fe(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),ht(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Fe(x)?(e.exit("chunkString"),p(x)):(e.consume(x),x===92?g:m)}function g(x){return x===l||x===92?(e.consume(x),m):m(x)}}function gc(e,t){let n;return r;function r(o){return Fe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):st(o)?ht(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const yV={name:"definition",tokenize:xV},bV={tokenize:wV,partial:!0};function xV(e,t,n){const r=this;let o;return s;function s(y){return e.enter("definition"),l(y)}function l(y){return KC.call(r,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function u(y){return o=zr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),f):n(y)}function f(y){return Mt(y)?gc(e,p)(y):p(y)}function p(y){return ZC(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function m(y){return e.attempt(bV,g,g)(y)}function g(y){return st(y)?ht(e,x,"whitespace")(y):x(y)}function x(y){return y===null||Fe(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function wV(e,t,n){return r;function r(u){return Mt(u)?gc(e,o)(u):n(u)}function o(u){return QC(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function s(u){return st(u)?ht(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Fe(u)?t(u):n(u)}}const SV={name:"hardBreakEscape",tokenize:kV};function kV(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Fe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const IV={name:"headingAtx",tokenize:jV,resolve:TV};function TV(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ur(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function jV(e,t,n){let r=0;return o;function o(m){return e.enter("atxHeading"),s(m)}function s(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(e.consume(m),l):m===null||Mt(m)?(e.exit("atxHeadingSequence"),u(m)):n(m)}function u(m){return m===35?(e.enter("atxHeadingSequence"),f(m)):m===null||Fe(m)?(e.exit("atxHeading"),t(m)):st(m)?ht(e,u,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function f(m){return m===35?(e.consume(m),f):(e.exit("atxHeadingSequence"),u(m))}function p(m){return m===null||m===35||Mt(m)?(e.exit("atxHeadingText"),u(m)):(e.consume(m),p)}}const CV=["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"],Pk=["pre","script","style","textarea"],EV={name:"htmlFlow",tokenize:NV,resolveTo:MV,concrete:!0},_V={tokenize:RV,partial:!0},AV={tokenize:PV,partial:!0};function MV(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function NV(e,t,n){const r=this;let o,s,l,u,f;return p;function p(A){return m(A)}function m(A){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(A),g}function g(A){return A===33?(e.consume(A),x):A===47?(e.consume(A),s=!0,S):A===63?(e.consume(A),o=3,r.interrupt?t:P):zn(A)?(e.consume(A),l=String.fromCharCode(A),T):n(A)}function x(A){return A===45?(e.consume(A),o=2,y):A===91?(e.consume(A),o=5,u=0,w):zn(A)?(e.consume(A),o=4,r.interrupt?t:P):n(A)}function y(A){return A===45?(e.consume(A),r.interrupt?t:P):n(A)}function w(A){const L="CDATA[";return A===L.charCodeAt(u++)?(e.consume(A),u===L.length?r.interrupt?t:Y:w):n(A)}function S(A){return zn(A)?(e.consume(A),l=String.fromCharCode(A),T):n(A)}function T(A){if(A===null||A===47||A===62||Mt(A)){const L=A===47,X=l.toLowerCase();return!L&&!s&&Pk.includes(X)?(o=1,r.interrupt?t(A):Y(A)):CV.includes(l.toLowerCase())?(o=6,L?(e.consume(A),k):r.interrupt?t(A):Y(A)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(A):s?_(A):C(A))}return A===45||En(A)?(e.consume(A),l+=String.fromCharCode(A),T):n(A)}function k(A){return A===62?(e.consume(A),r.interrupt?t:Y):n(A)}function _(A){return st(A)?(e.consume(A),_):q(A)}function C(A){return A===47?(e.consume(A),q):A===58||A===95||zn(A)?(e.consume(A),E):st(A)?(e.consume(A),C):q(A)}function E(A){return A===45||A===46||A===58||A===95||En(A)?(e.consume(A),E):O(A)}function O(A){return A===61?(e.consume(A),M):st(A)?(e.consume(A),O):C(A)}function M(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),f=A,R):st(A)?(e.consume(A),M):z(A)}function R(A){return A===f?(e.consume(A),f=null,K):A===null||Fe(A)?n(A):(e.consume(A),R)}function z(A){return A===null||A===34||A===39||A===47||A===60||A===61||A===62||A===96||Mt(A)?O(A):(e.consume(A),z)}function K(A){return A===47||A===62||st(A)?C(A):n(A)}function q(A){return A===62?(e.consume(A),Z):n(A)}function Z(A){return A===null||Fe(A)?Y(A):st(A)?(e.consume(A),Z):n(A)}function Y(A){return A===45&&o===2?(e.consume(A),F):A===60&&o===1?(e.consume(A),ee):A===62&&o===4?(e.consume(A),$):A===63&&o===3?(e.consume(A),P):A===93&&o===5?(e.consume(A),xe):Fe(A)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(_V,te,ae)(A)):A===null||Fe(A)?(e.exit("htmlFlowData"),ae(A)):(e.consume(A),Y)}function ae(A){return e.check(AV,J,te)(A)}function J(A){return e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),he}function he(A){return A===null||Fe(A)?ae(A):(e.enter("htmlFlowData"),Y(A))}function F(A){return A===45?(e.consume(A),P):Y(A)}function ee(A){return A===47?(e.consume(A),l="",Q):Y(A)}function Q(A){if(A===62){const L=l.toLowerCase();return Pk.includes(L)?(e.consume(A),$):Y(A)}return zn(A)&&l.length<8?(e.consume(A),l+=String.fromCharCode(A),Q):Y(A)}function xe(A){return A===93?(e.consume(A),P):Y(A)}function P(A){return A===62?(e.consume(A),$):A===45&&o===2?(e.consume(A),P):Y(A)}function $(A){return A===null||Fe(A)?(e.exit("htmlFlowData"),te(A)):(e.consume(A),$)}function te(A){return e.exit("htmlFlow"),t(A)}}function PV(e,t,n){const r=this;return o;function o(l){return Fe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):n(l)}function s(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function RV(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Yc,t,n)}}const OV={name:"htmlText",tokenize:zV};function zV(e,t,n){const r=this;let o,s,l;return u;function u(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),p):P===47?(e.consume(P),O):P===63?(e.consume(P),C):zn(P)?(e.consume(P),z):n(P)}function p(P){return P===45?(e.consume(P),m):P===91?(e.consume(P),s=0,w):zn(P)?(e.consume(P),_):n(P)}function m(P){return P===45?(e.consume(P),y):n(P)}function g(P){return P===null?n(P):P===45?(e.consume(P),x):Fe(P)?(l=g,ee(P)):(e.consume(P),g)}function x(P){return P===45?(e.consume(P),y):g(P)}function y(P){return P===62?F(P):P===45?x(P):g(P)}function w(P){const $="CDATA[";return P===$.charCodeAt(s++)?(e.consume(P),s===$.length?S:w):n(P)}function S(P){return P===null?n(P):P===93?(e.consume(P),T):Fe(P)?(l=S,ee(P)):(e.consume(P),S)}function T(P){return P===93?(e.consume(P),k):S(P)}function k(P){return P===62?F(P):P===93?(e.consume(P),k):S(P)}function _(P){return P===null||P===62?F(P):Fe(P)?(l=_,ee(P)):(e.consume(P),_)}function C(P){return P===null?n(P):P===63?(e.consume(P),E):Fe(P)?(l=C,ee(P)):(e.consume(P),C)}function E(P){return P===62?F(P):C(P)}function O(P){return zn(P)?(e.consume(P),M):n(P)}function M(P){return P===45||En(P)?(e.consume(P),M):R(P)}function R(P){return Fe(P)?(l=R,ee(P)):st(P)?(e.consume(P),R):F(P)}function z(P){return P===45||En(P)?(e.consume(P),z):P===47||P===62||Mt(P)?K(P):n(P)}function K(P){return P===47?(e.consume(P),F):P===58||P===95||zn(P)?(e.consume(P),q):Fe(P)?(l=K,ee(P)):st(P)?(e.consume(P),K):F(P)}function q(P){return P===45||P===46||P===58||P===95||En(P)?(e.consume(P),q):Z(P)}function Z(P){return P===61?(e.consume(P),Y):Fe(P)?(l=Z,ee(P)):st(P)?(e.consume(P),Z):K(P)}function Y(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),o=P,ae):Fe(P)?(l=Y,ee(P)):st(P)?(e.consume(P),Y):(e.consume(P),J)}function ae(P){return P===o?(e.consume(P),o=void 0,he):P===null?n(P):Fe(P)?(l=ae,ee(P)):(e.consume(P),ae)}function J(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||Mt(P)?K(P):(e.consume(P),J)}function he(P){return P===47||P===62||Mt(P)?K(P):n(P)}function F(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function ee(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),Q}function Q(P){return st(P)?ht(e,xe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):xe(P)}function xe(P){return e.enter("htmlTextData"),l(P)}}const Gy={name:"labelEnd",tokenize:UV,resolveTo:$V,resolveAll:qV},DV={tokenize:HV},LV={tokenize:FV},BV={tokenize:VV};function qV(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function $V(e,t){let n=e.length,r=0,o,s,l,u;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(l=n);const f={type:e[s][1].type==="labelLink"?"link":"image",start:Object.assign({},e[s][1].start),end:Object.assign({},e[e.length-1][1].end)},p={type:"label",start:Object.assign({},e[s][1].start),end:Object.assign({},e[l][1].end)},m={type:"labelText",start:Object.assign({},e[s+r+2][1].end),end:Object.assign({},e[l-2][1].start)};return u=[["enter",f,t],["enter",p,t]],u=kr(u,e.slice(s+1,s+r+3)),u=kr(u,[["enter",m,t]]),u=kr(u,Yf(t.parser.constructs.insideSpan.null,e.slice(s+r+4,l-3),t)),u=kr(u,[["exit",m,t],e[l-2],e[l-1],["exit",p,t]]),u=kr(u,e.slice(l+1)),u=kr(u,[["exit",f,t]]),ur(e,s,e.length,u),e}function UV(e,t,n){const r=this;let o=r.events.length,s,l;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return u;function u(x){return s?s._inactive?g(x):(l=r.parser.defined.includes(zr(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),f):n(x)}function f(x){return x===40?e.attempt(DV,m,l?m:g)(x):x===91?e.attempt(LV,m,l?p:g)(x):l?m(x):g(x)}function p(x){return e.attempt(BV,m,g)(x)}function m(x){return t(x)}function g(x){return s._balanced=!0,n(x)}}function HV(e,t,n){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return Mt(g)?gc(e,s)(g):s(g)}function s(g){return g===41?m(g):ZC(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return Mt(g)?gc(e,f)(g):m(g)}function u(g){return n(g)}function f(g){return g===34||g===39||g===40?QC(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function p(g){return Mt(g)?gc(e,m)(g):m(g)}function m(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function FV(e,t,n){const r=this;return o;function o(u){return KC.call(r,e,s,l,"reference","referenceMarker","referenceString")(u)}function s(u){return r.parser.defined.includes(zr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function VV(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const ZV={name:"labelStartImage",tokenize:KV,resolveAll:Gy.resolveAll};function KV(e,t,n){const r=this;return o;function o(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),s}function s(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const QV={name:"labelStartLink",tokenize:GV,resolveAll:Gy.resolveAll};function GV(e,t,n){const r=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),s}function s(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Bm={name:"lineEnding",tokenize:YV};function YV(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ht(e,t,"linePrefix")}}const Ud={name:"thematicBreak",tokenize:WV};function WV(e,t,n){let r=0,o;return s;function s(p){return e.enter("thematicBreak"),l(p)}function l(p){return o=p,u(p)}function u(p){return p===o?(e.enter("thematicBreakSequence"),f(p)):r>=3&&(p===null||Fe(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===o?(e.consume(p),r++,f):(e.exit("thematicBreakSequence"),st(p)?ht(e,u,"whitespace")(p):u(p))}}const Kn={name:"list",tokenize:eZ,continuation:{tokenize:tZ},exit:rZ},XV={tokenize:iZ,partial:!0},JV={tokenize:nZ,partial:!0};function eZ(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return u;function u(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:tv(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Ud,n,p)(y):p(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(y)}return n(y)}function f(y){return tv(y)&&++l<10?(e.consume(y),f):(!r.interrupt||l<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Yc,r.interrupt?n:m,e.attempt(XV,x,g))}function m(y){return r.containerState.initialBlankLine=!0,s++,x(y)}function g(y){return st(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),x):n(y)}function x(y){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function tZ(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Yc,o,s);function o(u){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ht(e,t,"listItemIndent",r.containerState.size+1)(u)}function s(u){return r.containerState.furtherBlankLines||!st(u)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(u)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(JV,t,l)(u))}function l(u){return r.containerState._closeFlow=!0,r.interrupt=void 0,ht(e,e.attempt(Kn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function nZ(e,t,n){const r=this;return ht(e,o,"listItemIndent",r.containerState.size+1);function o(s){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(s):n(s)}}function rZ(e){e.exit(this.containerState.type)}function iZ(e,t,n){const r=this;return ht(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const l=r.events[r.events.length-1];return!st(s)&&l&&l[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const Rk={name:"setextUnderline",tokenize:aZ,resolveTo:oZ};function oZ(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const l={type:"setextHeading",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",l,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[s][1].end)):e[r][1]=l,e.push(["exit",l,t]),e}function aZ(e,t,n){const r=this;let o;return s;function s(p){let m=r.events.length,g;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){g=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),o=p,l(p)):n(p)}function l(p){return e.enter("setextHeadingLineSequence"),u(p)}function u(p){return p===o?(e.consume(p),u):(e.exit("setextHeadingLineSequence"),st(p)?ht(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Fe(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const sZ={tokenize:lZ};function lZ(e){const t=this,n=e.attempt(Yc,r,e.attempt(this.parser.constructs.flowInitial,o,ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(pV,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const cZ={resolveAll:YC()},uZ=GC("string"),dZ=GC("text");function GC(e){return{tokenize:t,resolveAll:YC(e==="text"?fZ:void 0)};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,l,u);return l;function l(m){return p(m)?s(m):u(m)}function u(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),f}function f(m){return p(m)?(n.exit("data"),s(m)):(n.consume(m),f)}function p(m){if(m===null)return!0;const g=o[m];let x=-1;if(g)for(;++x<g.length;){const y=g[x];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function YC(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function fZ(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,l=-1,u=0,f;for(;s--;){const p=o[s];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(p===-2)f=!0,u++;else if(p!==-1){s++;break}}if(u){const p={type:n===e.length||f||u<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-u,offset:r.end.offset-u,_index:r.start._index+s,_bufferIndex:s?l:r.start._bufferIndex+l},end:Object.assign({},r.end)};r.end=Object.assign({},p.start),r.start.offset===r.end.offset?Object.assign(r,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}function pZ(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},s=[];let l=[],u=[];const f={consume:_,enter:C,exit:E,attempt:R(O),check:R(M),interrupt:R(M,{interrupt:!0})},p={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:y,sliceSerialize:x,now:w,defineSkip:S,write:g};let m=t.tokenize.call(p,f);return t.resolveAll&&s.push(t),p;function g(Z){return l=kr(l,Z),T(),l[l.length-1]!==null?[]:(z(t,0),p.events=Yf(s,p.events,p),p.events)}function x(Z,Y){return mZ(y(Z),Y)}function y(Z){return hZ(l,Z)}function w(){const{line:Z,column:Y,offset:ae,_index:J,_bufferIndex:he}=r;return{line:Z,column:Y,offset:ae,_index:J,_bufferIndex:he}}function S(Z){o[Z.line]=Z.column,q()}function T(){let Z;for(;r._index<l.length;){const Y=l[r._index];if(typeof Y=="string")for(Z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===Z&&r._bufferIndex<Y.length;)k(Y.charCodeAt(r._bufferIndex));else k(Y)}}function k(Z){m=m(Z)}function _(Z){Fe(Z)?(r.line++,r.column=1,r.offset+=Z===-3?2:1,q()):Z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=Z}function C(Z,Y){const ae=Y||{};return ae.type=Z,ae.start=w(),p.events.push(["enter",ae,p]),u.push(ae),ae}function E(Z){const Y=u.pop();return Y.end=w(),p.events.push(["exit",Y,p]),Y}function O(Z,Y){z(Z,Y.from)}function M(Z,Y){Y.restore()}function R(Z,Y){return ae;function ae(J,he,F){let ee,Q,xe,P;return Array.isArray(J)?te(J):"tokenize"in J?te([J]):$(J);function $(ue){return we;function we(ge){const Se=ge!==null&&ue[ge],B=ge!==null&&ue.null,U=[...Array.isArray(Se)?Se:Se?[Se]:[],...Array.isArray(B)?B:B?[B]:[]];return te(U)(ge)}}function te(ue){return ee=ue,Q=0,ue.length===0?F:A(ue[Q])}function A(ue){return we;function we(ge){return P=K(),xe=ue,ue.partial||(p.currentConstruct=ue),ue.name&&p.parser.constructs.disable.null.includes(ue.name)?X():ue.tokenize.call(Y?Object.assign(Object.create(p),Y):p,f,L,X)(ge)}}function L(ue){return Z(xe,P),he}function X(ue){return P.restore(),++Q<ee.length?A(ee[Q]):F}}}function z(Z,Y){Z.resolveAll&&!s.includes(Z)&&s.push(Z),Z.resolve&&ur(p.events,Y,p.events.length-Y,Z.resolve(p.events.slice(Y),p)),Z.resolveTo&&(p.events=Z.resolveTo(p.events,p))}function K(){const Z=w(),Y=p.previous,ae=p.currentConstruct,J=p.events.length,he=Array.from(u);return{restore:F,from:J};function F(){r=Z,p.previous=Y,p.currentConstruct=ae,p.events.length=J,u=he,q()}}function q(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function hZ(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(r,s)];else{if(l=e.slice(n,o),r>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(r):l.shift()}s>0&&l.push(e[o].slice(0,s))}return l}function mZ(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let l;if(typeof s=="string")l=s;else switch(s){case-5:{l="\r";break}case-4:{l=`
178
+ `;break}case-3:{l=`\r
179
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(s)}o=s===-2,r.push(l)}return r.join("")}const gZ={42:Kn,43:Kn,45:Kn,48:Kn,49:Kn,50:Kn,51:Kn,52:Kn,53:Kn,54:Kn,55:Kn,56:Kn,57:Kn,62:UC},vZ={91:yV},yZ={[-2]:Lm,[-1]:Lm,32:Lm},bZ={35:IV,42:Ud,45:[Rk,Ud],60:EV,61:Rk,95:Ud,96:Nk,126:Nk},xZ={38:FC,92:HC},wZ={[-5]:Bm,[-4]:Bm,[-3]:Bm,33:ZV,38:FC,42:nv,60:[GF,OV],91:QV,92:[SV,HC],93:Gy,95:nv,96:lV},SZ={null:[nv,cZ]},kZ={null:[42,95]},IZ={null:[]},TZ=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:kZ,contentInitial:vZ,disable:IZ,document:gZ,flow:bZ,flowInitial:yZ,insideSpan:SZ,string:xZ,text:wZ},Symbol.toStringTag,{value:"Module"}));function jZ(e){const n=qC([TZ,...(e||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:o(UF),document:o(FF),flow:o(sZ),string:o(uZ),text:o(dZ)};return r;function o(s){return l;function l(u){return pZ(r,s,u)}}}function CZ(e){for(;!VC(e););return e}const Ok=/[\0\t\n\r]/g;function EZ(){let e=1,t="",n=!0,r;return o;function o(s,l,u){const f=[];let p,m,g,x,y;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(l||void 0).decode(s)),g=0,t="",n&&(s.charCodeAt(0)===65279&&g++,n=void 0);g<s.length;){if(Ok.lastIndex=g,p=Ok.exec(s),x=p&&p.index!==void 0?p.index:s.length,y=s.charCodeAt(x),!p){t=s.slice(g);break}if(y===10&&g===x&&r)f.push(-3),r=void 0;else switch(r&&(f.push(-5),r=void 0),g<x&&(f.push(s.slice(g,x)),e+=x-g),y){case 0:{f.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,f.push(-2);e++<m;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:r=!0,e=1}g=x+1}return u&&(r&&f.push(-5),t&&f.push(t),f.push(null)),f}}const _Z=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function AZ(e){return e.replace(_Z,MZ)}function MZ(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return $C(n.slice(s?2:1),s?16:10)}return Qy(n)||e}const WC={}.hasOwnProperty;function NZ(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),PZ(n)(CZ(jZ(n).document().write(EZ()(e,t,!0))))}function PZ(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ft),autolinkProtocol:K,autolinkEmail:K,atxHeading:s(Qe),blockQuote:s(B),characterEscape:K,characterReference:K,codeFenced:s(U),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:s(U,l),codeText:s(ve,l),codeTextData:K,data:K,codeFlowValue:K,definition:s(_e),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:s(qe),hardBreakEscape:s(ze),hardBreakTrailing:s(ze),htmlFlow:s(ut,l),htmlFlowData:K,htmlText:s(ut,l),htmlTextData:K,image:s(Kt),label:l,link:s(Ft),listItem:s(Lr),listItemValue:x,listOrdered:s(dr,g),listUnordered:s(dr),paragraph:s(Lo),reference:A,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:s(Qe),strong:s(oi),thematicBreak:s(ai)},exit:{atxHeading:f(),atxHeadingSequence:O,autolink:f(),autolinkEmail:Se,autolinkProtocol:ge,blockQuote:f(),characterEscapeValue:q,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:ue,characterReference:we,codeFenced:f(T),codeFencedFence:S,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:q,codeIndented:f(k),codeText:f(he),codeTextData:q,data:q,definition:f(),definitionDestinationString:E,definitionLabelString:_,definitionTitleString:C,emphasis:f(),hardBreakEscape:f(Y),hardBreakTrailing:f(Y),htmlFlow:f(ae),htmlFlowData:q,htmlText:f(J),htmlTextData:q,image:f(ee),label:xe,labelText:Q,lineEnding:Z,link:f(F),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:L,resourceDestinationString:P,resourceTitleString:$,resource:te,setextHeading:f(z),setextHeadingLineSequence:R,setextHeadingText:M,strong:f(),thematicBreak:f()}};XC(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(pe){let Ie={type:"root",children:[]};const Le={stack:[Ie],tokenStack:[],config:t,enter:u,exit:p,buffer:l,resume:m,data:n},ne=[];let je=-1;for(;++je<pe.length;)if(pe[je][1].type==="listOrdered"||pe[je][1].type==="listUnordered")if(pe[je][0]==="enter")ne.push(je);else{const Be=ne.pop();je=o(pe,Be,je)}for(je=-1;++je<pe.length;){const Be=t[pe[je][0]];WC.call(Be,pe[je][1].type)&&Be[pe[je][1].type].call(Object.assign({sliceSerialize:pe[je][2].sliceSerialize},Le),pe[je][1])}if(Le.tokenStack.length>0){const Be=Le.tokenStack[Le.tokenStack.length-1];(Be[1]||zk).call(Le,void 0,Be[0])}for(Ie.position={start:bo(pe.length>0?pe[0][1].start:{line:1,column:1,offset:0}),end:bo(pe.length>0?pe[pe.length-2][1].end:{line:1,column:1,offset:0})},je=-1;++je<t.transforms.length;)Ie=t.transforms[je](Ie)||Ie;return Ie}function o(pe,Ie,Le){let ne=Ie-1,je=-1,Be=!1,We,ft,Xe,sn;for(;++ne<=Le;){const mt=pe[ne];switch(mt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{mt[0]==="enter"?je++:je--,sn=void 0;break}case"lineEndingBlank":{mt[0]==="enter"&&(We&&!sn&&!je&&!Xe&&(Xe=ne),sn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:sn=void 0}if(!je&&mt[0]==="enter"&&mt[1].type==="listItemPrefix"||je===-1&&mt[0]==="exit"&&(mt[1].type==="listUnordered"||mt[1].type==="listOrdered")){if(We){let Bn=ne;for(ft=void 0;Bn--;){const Jn=pe[Bn];if(Jn[1].type==="lineEnding"||Jn[1].type==="lineEndingBlank"){if(Jn[0]==="exit")continue;ft&&(pe[ft][1].type="lineEndingBlank",Be=!0),Jn[1].type="lineEnding",ft=Bn}else if(!(Jn[1].type==="linePrefix"||Jn[1].type==="blockQuotePrefix"||Jn[1].type==="blockQuotePrefixWhitespace"||Jn[1].type==="blockQuoteMarker"||Jn[1].type==="listItemIndent"))break}Xe&&(!ft||Xe<ft)&&(We._spread=!0),We.end=Object.assign({},ft?pe[ft][1].start:mt[1].end),pe.splice(ft||ne,0,["exit",We,mt[2]]),ne++,Le++}if(mt[1].type==="listItemPrefix"){const Bn={type:"listItem",_spread:!1,start:Object.assign({},mt[1].start),end:void 0};We=Bn,pe.splice(ne,0,["enter",Bn,mt[2]]),ne++,Le++,Xe=void 0,sn=!0}}}return pe[Ie][1]._spread=Be,Le}function s(pe,Ie){return Le;function Le(ne){u.call(this,pe(ne),ne),Ie&&Ie.call(this,ne)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(pe,Ie,Le){this.stack[this.stack.length-1].children.push(pe),this.stack.push(pe),this.tokenStack.push([Ie,Le||void 0]),pe.position={start:bo(Ie.start),end:void 0}}function f(pe){return Ie;function Ie(Le){pe&&pe.call(this,Le),p.call(this,Le)}}function p(pe,Ie){const Le=this.stack.pop(),ne=this.tokenStack.pop();if(ne)ne[0].type!==pe.type&&(Ie?Ie.call(this,pe,ne[0]):(ne[1]||zk).call(this,pe,ne[0]));else throw new Error("Cannot close `"+pe.type+"` ("+mc({start:pe.start,end:pe.end})+"): it’s not open");Le.position.end=bo(pe.end)}function m(){return Ky(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(pe){if(this.data.expectingFirstListItemValue){const Ie=this.stack[this.stack.length-2];Ie.start=Number.parseInt(this.sliceSerialize(pe),10),this.data.expectingFirstListItemValue=void 0}}function y(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.lang=pe}function w(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.meta=pe}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function T(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=pe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=pe.replace(/(\r?\n|\r)$/g,"")}function _(pe){const Ie=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Ie,Le.identifier=zr(this.sliceSerialize(pe)).toLowerCase()}function C(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.title=pe}function E(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.url=pe}function O(pe){const Ie=this.stack[this.stack.length-1];if(!Ie.depth){const Le=this.sliceSerialize(pe).length;Ie.depth=Le}}function M(){this.data.setextHeadingSlurpLineEnding=!0}function R(pe){const Ie=this.stack[this.stack.length-1];Ie.depth=this.sliceSerialize(pe).codePointAt(0)===61?1:2}function z(){this.data.setextHeadingSlurpLineEnding=void 0}function K(pe){const Le=this.stack[this.stack.length-1].children;let ne=Le[Le.length-1];(!ne||ne.type!=="text")&&(ne=an(),ne.position={start:bo(pe.start),end:void 0},Le.push(ne)),this.stack.push(ne)}function q(pe){const Ie=this.stack.pop();Ie.value+=this.sliceSerialize(pe),Ie.position.end=bo(pe.end)}function Z(pe){const Ie=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=Ie.children[Ie.children.length-1];Le.position.end=bo(pe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ie.type)&&(K.call(this,pe),q.call(this,pe))}function Y(){this.data.atHardBreak=!0}function ae(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=pe}function J(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=pe}function he(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.value=pe}function F(){const pe=this.stack[this.stack.length-1];if(this.data.inReference){const Ie=this.data.referenceType||"shortcut";pe.type+="Reference",pe.referenceType=Ie,delete pe.url,delete pe.title}else delete pe.identifier,delete pe.label;this.data.referenceType=void 0}function ee(){const pe=this.stack[this.stack.length-1];if(this.data.inReference){const Ie=this.data.referenceType||"shortcut";pe.type+="Reference",pe.referenceType=Ie,delete pe.url,delete pe.title}else delete pe.identifier,delete pe.label;this.data.referenceType=void 0}function Q(pe){const Ie=this.sliceSerialize(pe),Le=this.stack[this.stack.length-2];Le.label=AZ(Ie),Le.identifier=zr(Ie).toLowerCase()}function xe(){const pe=this.stack[this.stack.length-1],Ie=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const ne=pe.children;Le.children=ne}else Le.alt=Ie}function P(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.url=pe}function $(){const pe=this.resume(),Ie=this.stack[this.stack.length-1];Ie.title=pe}function te(){this.data.inReference=void 0}function A(){this.data.referenceType="collapsed"}function L(pe){const Ie=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Ie,Le.identifier=zr(this.sliceSerialize(pe)).toLowerCase(),this.data.referenceType="full"}function X(pe){this.data.characterReferenceType=pe.type}function ue(pe){const Ie=this.sliceSerialize(pe),Le=this.data.characterReferenceType;let ne;Le?(ne=$C(Ie,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ne=Qy(Ie);const je=this.stack[this.stack.length-1];je.value+=ne}function we(pe){const Ie=this.stack.pop();Ie.position.end=bo(pe.end)}function ge(pe){q.call(this,pe);const Ie=this.stack[this.stack.length-1];Ie.url=this.sliceSerialize(pe)}function Se(pe){q.call(this,pe);const Ie=this.stack[this.stack.length-1];Ie.url="mailto:"+this.sliceSerialize(pe)}function B(){return{type:"blockquote",children:[]}}function U(){return{type:"code",lang:null,meta:null,value:""}}function ve(){return{type:"inlineCode",value:""}}function _e(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function Qe(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function ut(){return{type:"html",value:""}}function Kt(){return{type:"image",title:null,url:"",alt:null}}function Ft(){return{type:"link",title:null,url:"",children:[]}}function dr(pe){return{type:"list",ordered:pe.type==="listOrdered",start:null,spread:pe._spread,children:[]}}function Lr(pe){return{type:"listItem",spread:pe._spread,checked:null,children:[]}}function Lo(){return{type:"paragraph",children:[]}}function oi(){return{type:"strong",children:[]}}function an(){return{type:"text",value:""}}function ai(){return{type:"thematicBreak"}}}function bo(e){return{line:e.line,column:e.column,offset:e.offset}}function XC(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?XC(e,r):RZ(e,r)}}function RZ(e,t){let n;for(n in t)if(WC.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function zk(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+mc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+mc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+mc({start:t.start,end:t.end})+") is still open")}function OZ(e){const t=this;t.parser=n;function n(r){return NZ(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function zZ(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function DZ(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
180
+ `}]}function LZ(e,t){const n=t.value?t.value+`
181
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function BZ(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qZ(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $Z(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=ll(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let l,u=e.footnoteCounts.get(r);u===void 0?(u=0,e.footnoteOrder.push(r),l=e.footnoteOrder.length):l=s+1,u+=1,e.footnoteCounts.set(r,u);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function UZ(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HZ(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function JC(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&l.type==="text"?l.value+=r:o.push({type:"text",value:r}),o}function FZ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return JC(e,t);const o={src:ll(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function VZ(e,t){const n={src:ll(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ZZ(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function KZ(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return JC(e,t);const o={href:ll(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function QZ(e,t){const n={href:ll(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function GZ(e,t,n){const r=e.all(t),o=n?YZ(n):eE(t),s={},l=[];if(typeof t.checked=="boolean"){const m=r[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let u=-1;for(;++u<r.length;){const m=r[u];(o||u!==0||m.type!=="element"||m.tagName!=="p")&&l.push({type:"text",value:`
182
+ `}),m.type==="element"&&m.tagName==="p"&&!o?l.push(...m.children):l.push(m)}const f=r[r.length-1];f&&(o||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
183
+ `});const p={type:"element",tagName:"li",properties:s,children:l};return e.patch(t,p),e.applyData(t,p)}function YZ(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=eE(n[r])}return t}function eE(e){const t=e.spread;return t??e.children.length>1}function WZ(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const l=r[o];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function XZ(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function JZ(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function eK(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tK(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],l),o.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Hy(t.children[1]),f=PC(t.children[t.children.length-1]);u&&f&&(l.position={start:u,end:f}),o.push(l)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function nK(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let f=-1;const p=[];for(;++f<u;){const g=t.children[f],x={},y=l?l[f]:void 0;y&&(x.align=y);let w={type:"element",tagName:s,properties:x,children:[]};g&&(w.children=e.all(g),e.patch(g,w),w=e.applyData(g,w)),p.push(w)}const m={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,m),e.applyData(t,m)}function rK(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Dk=9,Lk=32;function iK(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(Bk(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(Bk(t.slice(o),o>0,!1)),s.join("")}function Bk(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===Dk||s===Lk;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===Dk||s===Lk;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function oK(e,t){const n={type:"text",value:iK(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function aK(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const sK={blockquote:zZ,break:DZ,code:LZ,delete:BZ,emphasis:qZ,footnoteReference:$Z,heading:UZ,html:HZ,imageReference:FZ,image:VZ,inlineCode:ZZ,linkReference:KZ,link:QZ,listItem:GZ,list:WZ,paragraph:XZ,root:JZ,strong:eK,table:tK,tableCell:rK,tableRow:nK,text:oK,thematicBreak:aK,toml:Cd,yaml:Cd,definition:Cd,footnoteDefinition:Cd};function Cd(){}const tE=-1,Wf=0,vc=1,uf=2,Yy=3,Wy=4,Xy=5,Jy=6,nE=7,rE=8,iE=typeof self=="object"?self:globalThis,qk=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new iE[e](t)},lK=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,l]=t[o];switch(s){case Wf:case tE:return n(l,o);case vc:{const u=n([],o);for(const f of l)u.push(r(f));return u}case uf:{const u=n({},o);for(const[f,p]of l)u[r(f)]=r(p);return u}case Yy:return n(new Date(l),o);case Wy:{const{source:u,flags:f}=l;return n(new RegExp(u,f),o)}case Xy:{const u=n(new Map,o);for(const[f,p]of l)u.set(r(f),r(p));return u}case Jy:{const u=n(new Set,o);for(const f of l)u.add(r(f));return u}case nE:{const{name:u,message:f}=l;return n(typeof iE[u]=="function"?qk(u,f):new Error(f),o)}case rE:return n(BigInt(l),o);case"BigInt":return n(Object(BigInt(l)),o);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(qk(s,l),o)};return r},$k=e=>lK(new Map,e)(0),aa="",{toString:cK}={},{keys:uK}=Object,lc=e=>{const t=typeof e;if(t!=="object"||!e)return[Wf,t];const n=cK.call(e).slice(8,-1);switch(n){case"Array":return[vc,aa];case"Object":return[uf,aa];case"Date":return[Yy,aa];case"RegExp":return[Wy,aa];case"Map":return[Xy,aa];case"Set":return[Jy,aa];case"DataView":return[vc,n]}return n.includes("Array")?[vc,n]:e instanceof Error?[nE,e.name||"Error"]:[uf,n]},Ed=([e,t])=>e===Wf&&(t==="function"||t==="symbol"),dK=(e,t,n,r)=>{const o=(l,u)=>{const f=r.push(l)-1;return n.set(u,f),f},s=l=>{if(n.has(l))return n.get(l);let[u,f]=lc(l);switch(u){case Wf:{let m=l;switch(f){case"bigint":u=rE,m=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return o([tE],l)}return o([u,m],l)}case vc:{if(f){let x=l;return f==="DataView"?x=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(x=new Uint8Array(l)),o([f,[...x]],l)}const m=[],g=o([u,m],l);for(const x of l)m.push(s(x));return g}case uf:{if(f)switch(f){case"BigInt":return o([f,l.toString()],l);case"Boolean":case"Number":case"String":return o([f,l.valueOf()],l)}if(t&&"toJSON"in l)return s(l.toJSON());const m=[],g=o([u,m],l);for(const x of uK(l))(e||!Ed(lc(l[x])))&&m.push([s(x),s(l[x])]);return g}case Yy:return o([u,isNaN(l.getTime())?aa:l.toISOString()],l);case Wy:{const{source:m,flags:g}=l;return o([u,{source:m,flags:g}],l)}case Xy:{const m=[],g=o([u,m],l);for(const[x,y]of l)(e||!(Ed(lc(x))||Ed(lc(y))))&&m.push([s(x),s(y)]);return g}case Jy:{const m=[],g=o([u,m],l);for(const x of l)(e||!Ed(lc(x)))&&m.push(s(x));return g}}const{message:p}=l;return o([u,{name:f,message:p}],l)};return s},Uk=(e,{json:t,lossy:n}={})=>{const r=[];return dK(!(t||n),!!t,new Map,r)(e),r},df=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?$k(Uk(e,t)):structuredClone(e):(e,t)=>$k(Uk(e,t));function fK(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function pK(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function hK(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||fK,r=e.options.footnoteBackLabel||pK,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const m=e.all(p),g=String(p.identifier).toUpperCase(),x=ll(g.toLowerCase());let y=0;const w=[],S=e.footnoteCounts.get(g);for(;S!==void 0&&++y<=S;){w.length>0&&w.push({type:"text",value:" "});let _=typeof n=="string"?n:n(f,y);typeof _=="string"&&(_={type:"text",value:_}),w.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(f,y),className:["data-footnote-backref"]},children:Array.isArray(_)?_:[_]})}const T=m[m.length-1];if(T&&T.type==="element"&&T.tagName==="p"){const _=T.children[T.children.length-1];_&&_.type==="text"?_.value+=" ":T.children.push({type:"text",value:" "}),T.children.push(...w)}else m.push(...w);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+x},children:e.wrap(m,!0)};e.patch(p,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...df(l),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
184
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
185
+ `}]}}const Xf=(function(e){if(e==null)return yK;if(typeof e=="function")return Jf(e);if(typeof e=="object")return Array.isArray(e)?mK(e):gK(e);if(typeof e=="string")return vK(e);throw new Error("Expected function, string, or object as test")});function mK(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Xf(e[n]);return Jf(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function gK(e){const t=e;return Jf(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function vK(e){return Jf(t);function t(n){return n&&n.type===e}}function Jf(e){return t;function t(n,r,o){return!!(bK(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function yK(){return!0}function bK(e){return e!==null&&typeof e=="object"&&"type"in e}const oE=[],xK=!0,rv=!1,wK="skip";function aE(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Xf(o),l=r?-1:1;u(e,void 0,[])();function u(f,p,m){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(f.type+(y?"<"+y+">":""))+")"})}return x;function x(){let y=oE,w,S,T;if((!t||s(f,p,m[m.length-1]||void 0))&&(y=SK(n(f,m)),y[0]===rv))return y;if("children"in f&&f.children){const k=f;if(k.children&&y[0]!==wK)for(S=(r?k.children.length:-1)+l,T=m.concat(k);S>-1&&S<k.children.length;){const _=k.children[S];if(w=u(_,S,T)(),w[0]===rv)return w;S=typeof w[1]=="number"?w[1]:S+l}}return y}}}function SK(e){return Array.isArray(e)?e:typeof e=="number"?[xK,e]:e==null?oE:[e]}function eb(e,t,n,r){let o,s,l;typeof t=="function"&&typeof n!="function"?(s=void 0,l=t,o=n):(s=t,l=n,o=r),aE(e,s,u,o);function u(f,p){const m=p[p.length-1],g=m?m.children.indexOf(f):void 0;return l(f,g,m)}}const iv={}.hasOwnProperty,kK={};function IK(e,t){const n=t||kK,r=new Map,o=new Map,s=new Map,l={...sK,...n.handlers},u={all:p,applyData:jK,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:l,one:f,options:n,patch:TK,wrap:EK};return eb(e,function(m){if(m.type==="definition"||m.type==="footnoteDefinition"){const g=m.type==="definition"?r:o,x=String(m.identifier).toUpperCase();g.has(x)||g.set(x,m)}}),u;function f(m,g){const x=m.type,y=u.handlers[x];if(iv.call(u.handlers,x)&&y)return y(u,m,g);if(u.options.passThrough&&u.options.passThrough.includes(x)){if("children"in m){const{children:S,...T}=m,k=df(T);return k.children=u.all(m),k}return df(m)}return(u.options.unknownHandler||CK)(u,m,g)}function p(m){const g=[];if("children"in m){const x=m.children;let y=-1;for(;++y<x.length;){const w=u.one(x[y],m);if(w){if(y&&x[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=Hk(w.value)),!Array.isArray(w)&&w.type==="element")){const S=w.children[0];S&&S.type==="text"&&(S.value=Hk(S.value))}Array.isArray(w)?g.push(...w):g.push(w)}}}return g}}function TK(e,t){e.position&&(t.position=hF(e))}function jK(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const l="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:l}}n.type==="element"&&s&&Object.assign(n.properties,df(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function CK(e,t){const n=t.data||{},r="value"in t&&!(iv.call(n,"hProperties")||iv.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function EK(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
186
+ `});++r<e.length;)r&&n.push({type:"text",value:`
187
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
188
+ `}),n}function Hk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fk(e,t){const n=IK(e,t),r=n.one(e,void 0),o=hK(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
189
+ `},o),s}function _K(e,t){return e&&"run"in e?async function(n,r){const o=Fk(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Fk(n,{file:r,...e||t})}}function Vk(e){if(e)throw e}var qm,Zk;function AK(){if(Zk)return qm;Zk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},s=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var m=e.call(p,"constructor"),g=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!m&&!g)return!1;var x;for(x in p);return typeof x>"u"||e.call(p,x)},l=function(p,m){n&&m.name==="__proto__"?n(p,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):p[m.name]=m.newValue},u=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return qm=function f(){var p,m,g,x,y,w,S=arguments[0],T=1,k=arguments.length,_=!1;for(typeof S=="boolean"&&(_=S,S=arguments[1]||{},T=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});T<k;++T)if(p=arguments[T],p!=null)for(m in p)g=u(S,m),x=u(p,m),S!==x&&(_&&x&&(s(x)||(y=o(x)))?(y?(y=!1,w=g&&o(g)?g:[]):w=g&&s(g)?g:{},l(S,{name:m,newValue:f(_,w,x)})):typeof x<"u"&&l(S,{name:m,newValue:x}));return S},qm}var MK=AK();const $m=vv(MK);function ov(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function NK(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...o);function u(f,...p){const m=e[++s];let g=-1;if(f){l(f);return}for(;++g<o.length;)(p[g]===null||p[g]===void 0)&&(p[g]=o[g]);o=p,m?PK(m,u)(...p):l(null,...p)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function PK(e,t){let n;return r;function r(...l){const u=e.length>l.length;let f;u&&l.push(o);try{f=e.apply(this,l)}catch(p){const m=p;if(u&&n)throw m;return o(m)}u||(f&&f.then&&typeof f.then=="function"?f.then(s,o):f instanceof Error?o(f):s(f))}function o(l,...u){n||(n=!0,t(l,...u))}function s(l){o(null,l)}}const Kr={basename:RK,dirname:OK,extname:zK,join:DK,sep:"/"};function RK(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wc(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,u=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else l<0&&(s=!0,l=o+1),u>-1&&(e.codePointAt(o)===t.codePointAt(u--)?u<0&&(r=o):(u=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function OK(e){if(Wc(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function zK(e){Wc(e);let t=e.length,n=-1,r=0,o=-1,s=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function DK(...e){let t=-1,n;for(;++t<e.length;)Wc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":LK(n)}function LK(e){Wc(e);const t=e.codePointAt(0)===47;let n=BK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BK(e,t){let n="",r=0,o=-1,s=0,l=-1,u,f;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(o===l-1||s===1))if(o!==l-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",r=0):(n=n.slice(0,f),r=n.length-1-n.lastIndexOf("/")),o=l,s=0;continue}}else if(n.length>0){n="",r=0,o=l,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,s=0}else u===46&&s>-1?s++:s=-1}return n}function Wc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const qK={cwd:$K};function $K(){return"/"}function av(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function UK(e){if(typeof e=="string")e=new URL(e);else if(!av(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return HK(e)}function HK(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Um=["history","path","basename","stem","extname","dirname"];class sE{constructor(t){let n;t?av(t)?n={path:t}:typeof t=="string"||FK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":qK.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Um.length;){const s=Um[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)Um.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Kr.basename(this.path):void 0}set basename(t){Fm(t,"basename"),Hm(t,"basename"),this.path=Kr.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Kr.dirname(this.path):void 0}set dirname(t){Kk(this.basename,"dirname"),this.path=Kr.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Kr.extname(this.path):void 0}set extname(t){if(Hm(t,"extname"),Kk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Kr.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){av(t)&&(t=UK(t)),Fm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Kr.basename(this.path,this.extname):void 0}set stem(t){Fm(t,"stem"),Hm(t,"stem"),this.path=Kr.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new An(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Hm(e,t){if(e&&e.includes(Kr.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Kr.sep+"`")}function Fm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Kk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function FK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VK=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),ZK={}.hasOwnProperty;class tb extends VK{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=NK()}copy(){const t=new tb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data($m(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Km("data",this.frozen),this.namespace[t]=n,this):ZK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Km("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=_d(t),r=this.parser||this.Parser;return Vm("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vm("process",this.parser||this.Parser),Zm("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,l){const u=_d(t),f=r.parse(u);r.run(f,u,function(m,g,x){if(m||!g||!x)return p(m);const y=g,w=r.stringify(y,x);GK(w)?x.value=w:x.result=w,p(m,x)});function p(m,g){m||!g?l(m):s?s(g):n(void 0,g)}}}processSync(t){let n=!1,r;return this.freeze(),Vm("processSync",this.parser||this.Parser),Zm("processSync",this.compiler||this.Compiler),this.process(t,o),Gk("processSync","process",n),r;function o(s,l){n=!0,Vk(s),r=l}}run(t,n,r){Qk(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(l,u){const f=_d(n);o.run(t,f,p);function p(m,g,x){const y=g||t;m?u(m):l?l(y):r(void 0,y,x)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Gk("runSync","run",r),o;function s(l,u){Vk(l),o=u,r=!0}}stringify(t,n){this.freeze();const r=_d(n),o=this.compiler||this.Compiler;return Zm("stringify",o),Qk(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Km("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...g]=p;f(m,g)}else l(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function l(p){if(!("plugins"in p)&&!("settings"in p))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");u(p.plugins),p.settings&&(o.settings=$m(!0,o.settings,p.settings))}function u(p){let m=-1;if(p!=null)if(Array.isArray(p))for(;++m<p.length;){const g=p[m];s(g)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,m){let g=-1,x=-1;for(;++g<r.length;)if(r[g][0]===p){x=g;break}if(x===-1)r.push([p,...m]);else if(m.length>0){let[y,...w]=m;const S=r[x][1];ov(S)&&ov(y)&&(y=$m(!0,S,y)),r[x]=[p,y,...w]}}}}const KK=new tb().freeze();function Vm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Zm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Km(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Qk(e){if(!ov(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Gk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _d(e){return QK(e)?e:new sE(e)}function QK(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function GK(e){return typeof e=="string"||YK(e)}function YK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const WK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Yk=[],Wk={allowDangerousHtml:!0},XK=/^(https?|ircs?|mailto|xmpp)$/i,JK=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function eQ(e){const t=tQ(e),n=nQ(e);return rQ(t.runSync(t.parse(n),n),e)}function tQ(e){const t=e.rehypePlugins||Yk,n=e.remarkPlugins||Yk,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Wk}:Wk;return KK().use(OZ).use(n).use(_K,r).use(t)}function nQ(e){const t=e.children||"",n=new sE;return typeof t=="string"&&(n.value=t),n}function rQ(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||iQ;for(const m of JK)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+WK+m.id,void 0);return eb(e,p),bF(e,{Fragment:h.Fragment,components:o,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function p(m,g,x){if(m.type==="raw"&&x&&typeof g=="number")return l?x.children.splice(g,1):x.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let y;for(y in Dm)if(Object.hasOwn(Dm,y)&&Object.hasOwn(m.properties,y)){const w=m.properties[y],S=Dm[y];(S===null||S.includes(m.tagName))&&(m.properties[y]=f(String(w||""),y,m))}}if(m.type==="element"){let y=n?!n.includes(m.tagName):s?s.includes(m.tagName):!1;if(!y&&r&&typeof g=="number"&&(y=!r(m,g,x)),y&&x&&typeof g=="number")return u&&m.children?x.children.splice(g,1,...m.children):x.children.splice(g,1),g}}}function iQ(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||XK.test(e.slice(0,t))?e:""}function Xk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;o!==-1;)r++,o=n.indexOf(t,o+t.length);return r}function oQ(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function aQ(e,t,n){const o=Xf((n||{}).ignore||[]),s=sQ(t);let l=-1;for(;++l<s.length;)aE(e,"text",u);function u(p,m){let g=-1,x;for(;++g<m.length;){const y=m[g],w=x?x.children:void 0;if(o(y,w?w.indexOf(y):void 0,x))return;x=y}if(x)return f(p,m)}function f(p,m){const g=m[m.length-1],x=s[l][0],y=s[l][1];let w=0;const T=g.children.indexOf(p);let k=!1,_=[];x.lastIndex=0;let C=x.exec(p.value);for(;C;){const E=C.index,O={index:C.index,input:C.input,stack:[...m,p]};let M=y(...C,O);if(typeof M=="string"&&(M=M.length>0?{type:"text",value:M}:void 0),M===!1?x.lastIndex=E+1:(w!==E&&_.push({type:"text",value:p.value.slice(w,E)}),Array.isArray(M)?_.push(...M):M&&_.push(M),w=E+C[0].length,k=!0),!x.global)break;C=x.exec(p.value)}return k?(w<p.value.length&&_.push({type:"text",value:p.value.slice(w)}),g.children.splice(T,1,..._)):_=[p],T+_.length}}function sQ(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const o=n[r];t.push([lQ(o[0]),cQ(o[1])])}return t}function lQ(e){return typeof e=="string"?new RegExp(oQ(e),"g"):e}function cQ(e){return typeof e=="function"?e:function(){return e}}const Qm="phrasing",Gm=["autolink","link","image","label"];function uQ(){return{transforms:[vQ],enter:{literalAutolink:fQ,literalAutolinkEmail:Ym,literalAutolinkHttp:Ym,literalAutolinkWww:Ym},exit:{literalAutolink:gQ,literalAutolinkEmail:mQ,literalAutolinkHttp:pQ,literalAutolinkWww:hQ}}}function dQ(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Qm,notInConstruct:Gm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Qm,notInConstruct:Gm},{character:":",before:"[ps]",after:"\\/",inConstruct:Qm,notInConstruct:Gm}]}}function fQ(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ym(e){this.config.enter.autolinkProtocol.call(this,e)}function pQ(e){this.config.exit.autolinkProtocol.call(this,e)}function hQ(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function mQ(e){this.config.exit.autolinkEmail.call(this,e)}function gQ(e){this.exit(e)}function vQ(e){aQ(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,yQ],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,bQ]],{ignore:["link","linkReference"]})}function yQ(e,t,n,r,o){let s="";if(!lE(o)||(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!xQ(n)))return!1;const l=wQ(n+r);if(!l[0])return!1;const u={type:"link",title:null,url:s+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function bQ(e,t,n,r){return!lE(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function xQ(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function wQ(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const o=Xk(e,"(");let s=Xk(e,")");for(;r!==-1&&o>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function lE(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ia(n)||Gf(n))&&(!t||n!==47)}cE.peek=AQ;function SQ(){this.buffer()}function kQ(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function IQ(){this.buffer()}function TQ(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function jQ(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=zr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function CQ(e){this.exit(e)}function EQ(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=zr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function _Q(e){this.exit(e)}function AQ(){return"["}function cE(e,t,n,r){const o=n.createTracker(r);let s=o.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return s+=o.move(n.safe(n.associationId(e),{after:"]",before:s})),u(),l(),s+=o.move("]"),s}function MQ(){return{enter:{gfmFootnoteCallString:SQ,gfmFootnoteCall:kQ,gfmFootnoteDefinitionLabelString:IQ,gfmFootnoteDefinition:TQ},exit:{gfmFootnoteCallString:jQ,gfmFootnoteCall:CQ,gfmFootnoteDefinitionLabelString:EQ,gfmFootnoteDefinition:_Q}}}function NQ(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:cE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,o,s,l){const u=s.createTracker(l);let f=u.move("[^");const p=s.enter("footnoteDefinition"),m=s.enter("label");return f+=u.move(s.safe(s.associationId(r),{before:f,after:"]"})),m(),f+=u.move("]:"),r.children&&r.children.length>0&&(u.shift(4),f+=u.move((t?`
190
+ `:" ")+s.indentLines(s.containerFlow(r,u.current()),t?uE:PQ))),p(),f}}function PQ(e,t,n){return t===0?e:uE(e,t,n)}function uE(e,t,n){return(n?"":" ")+e}const RQ=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];dE.peek=BQ;function OQ(){return{canContainEols:["delete"],enter:{strikethrough:DQ},exit:{strikethrough:LQ}}}function zQ(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:RQ}],handlers:{delete:dE}}}function DQ(e){this.enter({type:"delete",children:[]},e)}function LQ(e){this.exit(e)}function dE(e,t,n,r){const o=n.createTracker(r),s=n.enter("strikethrough");let l=o.move("~~");return l+=n.containerPhrasing(e,{...o.current(),before:l,after:"~"}),l+=o.move("~~"),s(),l}function BQ(){return"~"}function qQ(e){return e.length}function $Q(e,t){const n=t||{},r=(n.align||[]).concat(),o=n.stringLength||qQ,s=[],l=[],u=[],f=[];let p=0,m=-1;for(;++m<e.length;){const S=[],T=[];let k=-1;for(e[m].length>p&&(p=e[m].length);++k<e[m].length;){const _=UQ(e[m][k]);if(n.alignDelimiters!==!1){const C=o(_);T[k]=C,(f[k]===void 0||C>f[k])&&(f[k]=C)}S.push(_)}l[m]=S,u[m]=T}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<p;)s[g]=Jk(r[g]);else{const S=Jk(r);for(;++g<p;)s[g]=S}g=-1;const x=[],y=[];for(;++g<p;){const S=s[g];let T="",k="";S===99?(T=":",k=":"):S===108?T=":":S===114&&(k=":");let _=n.alignDelimiters===!1?1:Math.max(1,f[g]-T.length-k.length);const C=T+"-".repeat(_)+k;n.alignDelimiters!==!1&&(_=T.length+_+k.length,_>f[g]&&(f[g]=_),y[g]=_),x[g]=C}l.splice(1,0,x),u.splice(1,0,y),m=-1;const w=[];for(;++m<l.length;){const S=l[m],T=u[m];g=-1;const k=[];for(;++g<p;){const _=S[g]||"";let C="",E="";if(n.alignDelimiters!==!1){const O=f[g]-(T[g]||0),M=s[g];M===114?C=" ".repeat(O):M===99?O%2?(C=" ".repeat(O/2+.5),E=" ".repeat(O/2-.5)):(C=" ".repeat(O/2),E=C):E=" ".repeat(O)}n.delimiterStart!==!1&&!g&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&_==="")&&(n.delimiterStart!==!1||g)&&k.push(" "),n.alignDelimiters!==!1&&k.push(C),k.push(_),n.alignDelimiters!==!1&&k.push(E),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||g!==p-1)&&k.push("|")}w.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return w.join(`
191
+ `)}function UQ(e){return e==null?"":String(e)}function Jk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function HQ(e,t,n,r){const o=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const l=n.indentLines(n.containerFlow(e,s.current()),FQ);return o(),l}function FQ(e,t,n){return">"+(n?"":" ")+e}function VQ(e,t){return eI(e,t.inConstruct,!0)&&!eI(e,t.notInConstruct,!1)}function eI(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function tI(e,t,n,r){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
192
+ `&&VQ(n.stack,n.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\
193
+ `}function ZQ(e,t){const n=String(e);let r=n.indexOf(t),o=r,s=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++s>l&&(l=s):s=1,o=r+t.length,r=n.indexOf(t,o);return l}function KQ(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function QQ(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function GQ(e,t,n,r){const o=QQ(n),s=e.value||"",l=o==="`"?"GraveAccent":"Tilde";if(KQ(e,n)){const g=n.enter("codeIndented"),x=n.indentLines(s,YQ);return g(),x}const u=n.createTracker(r),f=o.repeat(Math.max(ZQ(s,o)+1,3)),p=n.enter("codeFenced");let m=u.move(f);if(e.lang){const g=n.enter(`codeFencedLang${l}`);m+=u.move(n.safe(e.lang,{before:m,after:" ",encode:["`"],...u.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);m+=u.move(" "),m+=u.move(n.safe(e.meta,{before:m,after:`
194
+ `,encode:["`"],...u.current()})),g()}return m+=u.move(`
195
+ `),s&&(m+=u.move(s+`
196
+ `)),m+=u.move(f),p(),m}function YQ(e,t,n){return(n?"":" ")+e}function nb(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function WQ(e,t,n,r){const o=nb(n),s=o==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const f=n.createTracker(r);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(u=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
197
+ `,...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),p+=f.move(" "+o),p+=f.move(n.safe(e.title,{before:p,after:o,...f.current()})),p+=f.move(o),u()),l(),p}function XQ(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}fE.peek=JQ;function fE(e,t,n,r){const o=XQ(n),s=n.enter("emphasis"),l=n.createTracker(r);let u=l.move(o);return u+=l.move(n.containerPhrasing(e,{before:u,after:o,...l.current()})),u+=l.move(o),s(),u}function JQ(e,t,n){return n.options.emphasis||"*"}function eG(e,t){let n=!1;return eb(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,rv}),!!((!e.depth||e.depth<3)&&Ky(e)&&(t.options.setext||n))}function tG(e,t,n,r){const o=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(eG(e,n)){const m=n.enter("headingSetext"),g=n.enter("phrasing"),x=n.containerPhrasing(e,{...s.current(),before:`
198
+ `,after:`
199
+ `});return g(),m(),x+`
200
+ `+(o===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(`
201
+ `))+1))}const l="#".repeat(o),u=n.enter("headingAtx"),f=n.enter("phrasing");s.move(l+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
202
+ `,...s.current()});return/^[\t ]/.test(p)&&(p="&#x"+p.charCodeAt(0).toString(16).toUpperCase()+";"+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),f(),u(),p}pE.peek=nG;function pE(e){return e.value||""}function nG(){return"<"}hE.peek=rG;function hE(e,t,n,r){const o=nb(n),s=o==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(r);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(u=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${s}`),p+=f.move(" "+o),p+=f.move(n.safe(e.title,{before:p,after:o,...f.current()})),p+=f.move(o),u()),p+=f.move(")"),l(),p}function rG(){return"!"}mE.peek=iG;function mE(e,t,n,r){const o=e.referenceType,s=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("![");const p=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(p+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=m,s(),o==="full"||!p||p!==g?f+=u.move(g+"]"):o==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function iG(){return"!"}function oG(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}gE.peek=aG;function gE(e,t,n){let r=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const l=n.unsafe[s],u=oG(l);let f;if(l.atBreak)for(;f=u.exec(r);){let p=f.index;r.charCodeAt(p)===10&&r.charCodeAt(p-1)===13&&p--,r=r.slice(0,p)+" "+r.slice(f.index+1)}}return o+r+o}function aG(){return"`"}function vE(e,t){const n=Ky(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}yE.peek=sG;function yE(e,t,n,r){const o=nb(n),s=o==='"'?"Quote":"Apostrophe",l=n.createTracker(r);let u,f;if(vE(e,n)){const m=n.stack;n.stack=[],u=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),u(),n.stack=m,g}u=n.enter("link"),f=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(e,{before:p,after:"](",...l.current()})),p+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(e.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(f=n.enter("destinationRaw"),p+=l.move(n.safe(e.url,{before:p,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${s}`),p+=l.move(" "+o),p+=l.move(n.safe(e.title,{before:p,after:o,...l.current()})),p+=l.move(o),f()),p+=l.move(")"),u(),p}function sG(e,t,n){return vE(e,n)?"<":"["}bE.peek=lG;function bE(e,t,n,r){const o=e.referenceType,s=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(r);let f=u.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(p+"]["),l();const m=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=m,s(),o==="full"||!p||p!==g?f+=u.move(g+"]"):o==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function lG(){return"["}function rb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function cG(e){const t=rb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function uG(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function xE(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function dG(e,t,n,r){const o=n.enter("list"),s=n.bulletCurrent;let l=e.ordered?uG(n):rb(n);const u=e.ordered?l==="."?")":".":cG(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const m=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&m&&(!m.children||!m.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),xE(n)===l&&m){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=u),n.bulletCurrent=l;const p=n.containerFlow(e,r);return n.bulletLastUsed=l,n.bulletCurrent=s,o(),p}function fG(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function pG(e,t,n,r){const o=fG(n);let s=n.bulletCurrent||rb(n);t&&t.type==="list"&&t.ordered&&(s=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let l=s.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(r);u.move(s+" ".repeat(l-s.length)),u.shift(l);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,u.current()),m);return f(),p;function m(g,x,y){return x?(y?"":" ".repeat(l))+g:(y?s:s+" ".repeat(l-s.length))+g}}function hG(e,t,n,r){const o=n.enter("paragraph"),s=n.enter("phrasing"),l=n.containerPhrasing(e,r);return s(),o(),l}const mG=Xf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function gG(e,t,n,r){return(e.children.some(function(l){return mG(l)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function vG(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}wE.peek=yG;function wE(e,t,n,r){const o=vG(n),s=n.enter("strong"),l=n.createTracker(r);let u=l.move(o+o);return u+=l.move(n.containerPhrasing(e,{before:u,after:o,...l.current()})),u+=l.move(o+o),s(),u}function yG(e,t,n){return n.options.strong||"*"}function bG(e,t,n,r){return n.safe(e.value,r)}function xG(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function wG(e,t,n){const r=(xE(n)+(n.options.ruleSpaces?" ":"")).repeat(xG(n));return n.options.ruleSpaces?r.slice(0,-1):r}const SE={blockquote:HQ,break:tI,code:GQ,definition:WQ,emphasis:fE,hardBreak:tI,heading:tG,html:pE,image:hE,imageReference:mE,inlineCode:gE,link:yE,linkReference:bE,list:dG,listItem:pG,paragraph:hG,root:gG,strong:wE,text:bG,thematicBreak:wG};function SG(){return{enter:{table:kG,tableData:nI,tableHeader:nI,tableRow:TG},exit:{codeText:jG,table:IG,tableData:Wm,tableHeader:Wm,tableRow:Wm}}}function kG(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function IG(e){this.exit(e),this.data.inTable=void 0}function TG(e){this.enter({type:"tableRow",children:[]},e)}function Wm(e){this.exit(e)}function nI(e){this.enter({type:"tableCell",children:[]},e)}function jG(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,CG));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function CG(e,t){return t==="|"?t:e}function EG(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,o=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
203
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:l,tableCell:f,tableRow:u}};function l(y,w,S,T){return p(m(y,S,T),y.align)}function u(y,w,S,T){const k=g(y,S,T),_=p([k]);return _.slice(0,_.indexOf(`
204
+ `))}function f(y,w,S,T){const k=S.enter("tableCell"),_=S.enter("phrasing"),C=S.containerPhrasing(y,{...T,before:s,after:s});return _(),k(),C}function p(y,w){return $Q(y,{align:w,alignDelimiters:r,padding:n,stringLength:o})}function m(y,w,S){const T=y.children;let k=-1;const _=[],C=w.enter("table");for(;++k<T.length;)_[k]=g(T[k],w,S);return C(),_}function g(y,w,S){const T=y.children;let k=-1;const _=[],C=w.enter("tableRow");for(;++k<T.length;)_[k]=f(T[k],y,w,S);return C(),_}function x(y,w,S){let T=SE.inlineCode(y,w,S);return S.stack.includes("tableCell")&&(T=T.replace(/\|/g,"\\$&")),T}}function _G(){return{exit:{taskListCheckValueChecked:rI,taskListCheckValueUnchecked:rI,paragraph:MG}}}function AG(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:NG}}}function rI(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function MG(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const o=t.children;let s=-1,l;for(;++s<o.length;){const u=o[s];if(u.type==="paragraph"){l=u;break}}l===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function NG(e,t,n,r){const o=e.children[0],s=typeof e.checked=="boolean"&&o&&o.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);s&&u.move(l);let f=SE.listItem(e,t,n,{...r,...u.current()});return s&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(m){return m+l}}function PG(){return[uQ(),MQ(),OQ(),SG(),_G()]}function RG(e){return{extensions:[dQ(),NQ(e),zQ(),EG(e),AG()]}}const OG={tokenize:$G,partial:!0},kE={tokenize:UG,partial:!0},IE={tokenize:HG,partial:!0},TE={tokenize:FG,partial:!0},zG={tokenize:VG,partial:!0},jE={name:"wwwAutolink",tokenize:BG,previous:EE},CE={name:"protocolAutolink",tokenize:qG,previous:_E},Vi={name:"emailAutolink",tokenize:LG,previous:AE},ii={};function DG(){return{text:ii}}let ia=48;for(;ia<123;)ii[ia]=Vi,ia++,ia===58?ia=65:ia===91&&(ia=97);ii[43]=Vi;ii[45]=Vi;ii[46]=Vi;ii[95]=Vi;ii[72]=[Vi,CE];ii[104]=[Vi,CE];ii[87]=[Vi,jE];ii[119]=[Vi,jE];function LG(e,t,n){const r=this;let o,s;return l;function l(g){return!sv(g)||!AE.call(r,r.previous)||ib(r.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(g))}function u(g){return sv(g)?(e.consume(g),u):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(zG,m,p)(g):g===45||g===95||En(g)?(s=!0,e.consume(g),f):m(g)}function p(g){return e.consume(g),o=!0,f}function m(g){return s&&o&&zn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function BG(e,t,n){const r=this;return o;function o(l){return l!==87&&l!==119||!EE.call(r,r.previous)||ib(r.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(OG,e.attempt(kE,e.attempt(IE,s),n),n)(l))}function s(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function qG(e,t,n){const r=this;let o="",s=!1;return l;function l(g){return(g===72||g===104)&&_E.call(r,r.previous)&&!ib(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),u):n(g)}function u(g){if(zn(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),u;if(g===58){const x=o.toLowerCase();if(x==="http"||x==="https")return e.consume(g),f}return n(g)}function f(g){return g===47?(e.consume(g),s?p:(s=!0,f)):n(g)}function p(g){return g===null||lf(g)||Mt(g)||Ia(g)||Gf(g)?n(g):e.attempt(kE,e.attempt(IE,m),n)(g)}function m(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function $G(e,t,n){let r=0;return o;function o(l){return(l===87||l===119)&&r<3?(r++,e.consume(l),o):l===46&&r===3?(e.consume(l),s):n(l)}function s(l){return l===null?n(l):t(l)}}function UG(e,t,n){let r,o,s;return l;function l(p){return p===46||p===95?e.check(TE,f,u)(p):p===null||Mt(p)||Ia(p)||p!==45&&Gf(p)?f(p):(s=!0,e.consume(p),l)}function u(p){return p===95?r=!0:(o=r,r=void 0),e.consume(p),l}function f(p){return o||r||!s?n(p):t(p)}}function HG(e,t){let n=0,r=0;return o;function o(l){return l===40?(n++,e.consume(l),o):l===41&&r<n?s(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(TE,t,s)(l):l===null||Mt(l)||Ia(l)?t(l):(e.consume(l),o)}function s(l){return l===41&&r++,e.consume(l),o}}function FG(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),s):u===93?(e.consume(u),o):u===60||u===null||Mt(u)||Ia(u)?t(u):n(u)}function o(u){return u===null||u===40||u===91||Mt(u)||Ia(u)?t(u):r(u)}function s(u){return zn(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),r):zn(u)?(e.consume(u),l):n(u)}}function VG(e,t,n){return r;function r(s){return e.consume(s),o}function o(s){return En(s)?n(s):t(s)}}function EE(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Mt(e)}function _E(e){return!zn(e)}function AE(e){return!(e===47||sv(e))}function sv(e){return e===43||e===45||e===46||e===95||En(e)}function ib(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZG={tokenize:eY,partial:!0};function KG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:WG,continuation:{tokenize:XG},exit:JG}},text:{91:{name:"gfmFootnoteCall",tokenize:YG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QG,resolveTo:GG}}}}function QG(e,t,n){const r=this;let o=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l;for(;o--;){const f=r.events[o][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const p=zr(r.sliceSerialize({start:l.end,end:r.now()}));return p.codePointAt(0)!==94||!s.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function GG(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",s,t],["enter",l,t],["exit",l,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function YG(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,l;return u;function u(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(g){if(s>999||g===93&&!l||g===null||g===91||Mt(g))return n(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return o.includes(zr(r.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Mt(g)||(l=!0),s++,e.consume(g),g===92?m:p}function m(g){return g===91||g===92||g===93?(e.consume(g),s++,p):p(g)}}function WG(e,t,n){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,l=0,u;return f;function f(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",m):n(w)}function m(w){if(l>999||w===93&&!u||w===null||w===91||Mt(w))return n(w);if(w===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return s=zr(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return Mt(w)||(u=!0),l++,e.consume(w),w===92?g:m}function g(w){return w===91||w===92||w===93?(e.consume(w),l++,m):m(w)}function x(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),o.includes(s)||o.push(s),ht(e,y,"gfmFootnoteDefinitionWhitespace")):n(w)}function y(w){return t(w)}}function XG(e,t,n){return e.check(Yc,t,e.attempt(ZG,t,n))}function JG(e){e.exit("gfmFootnoteDefinition")}function eY(e,t,n){const r=this;return ht(e,o,"gfmFootnoteDefinitionIndent",5);function o(s){const l=r.events[r.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(s):n(s)}}function tY(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:o};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(l,u){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let p=f;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[f][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[f][1].end)},g={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[f][1].start)},x=[["enter",m,u],["enter",l[p][1],u],["exit",l[p][1],u],["enter",g,u]],y=u.parser.constructs.insideSpan.null;y&&ur(x,x.length,0,Yf(y,l.slice(p+1,f),u)),ur(x,x.length,0,[["exit",g,u],["enter",l[f][1],u],["exit",l[f][1],u],["exit",m,u]]),ur(l,p-1,f-p+3,x),f=p+x.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function s(l,u,f){const p=this.previous,m=this.events;let g=0;return x;function x(w){return p===126&&m[m.length-1][1].type!=="characterEscape"?f(w):(l.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const S=cf(p);if(w===126)return g>1?f(w):(l.consume(w),g++,y);if(g<2&&!n)return f(w);const T=l.exit("strikethroughSequenceTemporary"),k=cf(w);return T._open=!k||k===2&&!!S,T._close=!S||S===2&&!!k,u(w)}}}class nY{constructor(){this.map=[]}add(t,n,r){rY(this,t,n,r)}consume(t){if(this.map.sort(function(s,l){return s[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let o=r.pop();for(;o;){for(const s of o)t.push(s);o=r.pop()}this.map.length=0}}function rY(e,t,n,r){let o=0;if(!(n===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...r);return}o+=1}e.map.push([t,n,r])}}function iY(e,t){let n=!1;const r=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function oY(){return{flow:{null:{name:"table",tokenize:aY,resolveAll:sY}}}}function aY(e,t,n){const r=this;let o=0,s=0,l;return u;function u(q){let Z=r.events.length-1;for(;Z>-1;){const J=r.events[Z][1].type;if(J==="lineEnding"||J==="linePrefix")Z--;else break}const Y=Z>-1?r.events[Z][1].type:null,ae=Y==="tableHead"||Y==="tableRow"?M:f;return ae===M&&r.parser.lazy[r.now().line]?n(q):ae(q)}function f(q){return e.enter("tableHead"),e.enter("tableRow"),p(q)}function p(q){return q===124||(l=!0,s+=1),m(q)}function m(q){return q===null?n(q):Fe(q)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),y):n(q):st(q)?ht(e,m,"whitespace")(q):(s+=1,l&&(l=!1,o+=1),q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),l=!0,m):(e.enter("data"),g(q)))}function g(q){return q===null||q===124||Mt(q)?(e.exit("data"),m(q)):(e.consume(q),q===92?x:g)}function x(q){return q===92||q===124?(e.consume(q),g):g(q)}function y(q){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(q):(e.enter("tableDelimiterRow"),l=!1,st(q)?ht(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):w(q))}function w(q){return q===45||q===58?T(q):q===124?(l=!0,e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),S):O(q)}function S(q){return st(q)?ht(e,T,"whitespace")(q):T(q)}function T(q){return q===58?(s+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),k):q===45?(s+=1,k(q)):q===null||Fe(q)?E(q):O(q)}function k(q){return q===45?(e.enter("tableDelimiterFiller"),_(q)):O(q)}function _(q){return q===45?(e.consume(q),_):q===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(q),e.exit("tableDelimiterMarker"),C):(e.exit("tableDelimiterFiller"),C(q))}function C(q){return st(q)?ht(e,E,"whitespace")(q):E(q)}function E(q){return q===124?w(q):q===null||Fe(q)?!l||o!==s?O(q):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(q)):O(q)}function O(q){return n(q)}function M(q){return e.enter("tableRow"),R(q)}function R(q){return q===124?(e.enter("tableCellDivider"),e.consume(q),e.exit("tableCellDivider"),R):q===null||Fe(q)?(e.exit("tableRow"),t(q)):st(q)?ht(e,R,"whitespace")(q):(e.enter("data"),z(q))}function z(q){return q===null||q===124||Mt(q)?(e.exit("data"),R(q)):(e.consume(q),q===92?K:z)}function K(q){return q===92||q===124?(e.consume(q),z):z(q)}}function sY(e,t){let n=-1,r=!0,o=0,s=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,p,m,g;const x=new nY;for(;++n<e.length;){const y=e[n],w=y[1];y[0]==="enter"?w.type==="tableHead"?(u=!1,f!==0&&(iI(x,t,f,p,m),m=void 0,f=0),p={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(n,0,[["enter",p,t]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,m={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(n,0,[["enter",m,t]])),o=w.type==="tableDelimiterRow"?2:m?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,l[2]===0&&(s[1]!==0&&(l[0]=l[1],g=Ad(x,t,s,o,void 0,g),s=[0,0,0,0]),l[2]=n)):w.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(l[0]=l[1],g=Ad(x,t,s,o,void 0,g)),s=l,l=[s[1],n,0,0])):w.type==="tableHead"?(u=!0,f=n):w.type==="tableRow"||w.type==="tableDelimiterRow"?(f=n,s[1]!==0?(l[0]=l[1],g=Ad(x,t,s,o,n,g)):l[1]!==0&&(g=Ad(x,t,l,o,n,g)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&iI(x,t,f,p,m),x.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=iY(t.events,n))}return e}function Ad(e,t,n,r,o,s){const l=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(s.end=Object.assign({},js(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const f=js(t.events,n[1]);if(s={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",s,t]]),n[2]!==0){const p=js(t.events,n[2]),m=js(t.events,n[3]),g={type:u,start:Object.assign({},p),end:Object.assign({},m)};if(e.add(n[2],0,[["enter",g,t]]),r!==2){const x=t.events[n[2]],y=t.events[n[3]];if(x[1].end=Object.assign({},y[1].end),x[1].type="chunkText",x[1].contentType="text",n[3]>n[2]+1){const w=n[2]+1,S=n[3]-n[2]-1;e.add(w,S,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return o!==void 0&&(s.end=Object.assign({},js(t.events,o)),e.add(o,0,[["exit",s,t]]),s=void 0),s}function iI(e,t,n,r,o){const s=[],l=js(t.events,n);o&&(o.end=Object.assign({},l),s.push(["exit",o,t])),r.end=Object.assign({},l),s.push(["exit",r,t]),e.add(n+1,0,s)}function js(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const lY={name:"tasklistCheck",tokenize:uY};function cY(){return{text:{91:lY}}}function uY(e,t,n){const r=this;return o;function o(f){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),s)}function s(f){return Mt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(f)}function u(f){return Fe(f)?t(f):st(f)?e.check({tokenize:dY},t,n)(f):n(f)}}function dY(e,t,n){return ht(e,r,"whitespace");function r(o){return o===null?n(o):t(o)}}function fY(e){return qC([DG(),KG(),tY(e),oY(),cY()])}const pY={};function hY(e){const t=this,n=e||pY,r=t.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),l=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(fY(n)),s.push(PG()),l.push(RG(n))}function mY(e,t=""){if(/[\u0000-\u001f\\]/u.test(e))return{kind:"blocked"};if(/^(?:https?:\/\/|mailto:)/iu.test(e))return{kind:"external",href:e};let n;try{n=decodeURIComponent(e)}catch{return{kind:"blocked"}}if(!n||/[\u0000-\u001f\\]/u.test(n)||/^(?:[a-z][a-z\d+.-]*:|\/)/iu.test(n))return{kind:"blocked"};if(n.startsWith("#"))return{kind:"anchor",anchor:n.slice(1)};const[r="",o]=n.split("#");if(!/\.md$/iu.test(r))return{kind:"blocked"};const s=t.split("/").slice(0,-1);for(const l of r.split("/"))if(!(!l||l==="."))if(l===".."){if(!s.length)return{kind:"blocked"};s.pop()}else{if(/[:<>"|?*]/u.test(l)||/[ .]$/u.test(l))return{kind:"blocked"};s.push(l)}return{kind:"workspace",path:s.join("/"),...o?{anchor:o}:{}}}function oI(e,t){const n=e.position?.start.offset,r=e.position?.end.offset;return n===void 0||r===void 0||n<0||r<=n||r>t.length?null:{"data-doc-start":n,"data-doc-end":r}}function gY(e){return()=>t=>{const n=r=>{if(r.type==="element"){const o=oI(r,e);o&&(r.properties={...r.properties,...o})}r.children&&(r.children=r.children.map(o=>{const s=oI(o,e);if(o.type==="text"&&s&&o.value){const l=o.position.start.offset,u=o.position.end.offset;return{type:"element",tagName:"span",properties:{...s,"data-doc-text":"true","data-doc-exact":String(e.slice(l,u)===o.value)},children:[o]}}return n(o),o}))};n(t)}}function ff(e,t){let n=1;for(const r of e.matchAll(/\r\n|\r|\n/gu)){if(r.index+r[0].length>t)break;n+=1}return n}const pf=new Map;function vY(e,t){pf.set(e,{...t})}function yY(e){return pf.get(e)}function aI(e,t){pf.get(e)?.id===t&&pf.delete(e)}function bY(e,t,n){const r=Math.min(t,n),o=Math.max(t,n);if(!Number.isInteger(r)||!Number.isInteger(o)||r<0||o>e.length||r>=o)return null;const s=e.slice(r,o);return s.trim()?{startOffset:r,endOffset:o,selectedText:s,locationKind:"exact",startLine:ff(e,r),endLine:ff(e,o-1)}:null}function sI(e,t,n,r){const o=e.ownerDocument.createRange(),s=n.ownerDocument.createRange();return o.setStart(e,t),o.collapse(!0),s.setStart(n,r),s.collapse(!0),o.compareBoundaryPoints(Range.START_TO_START,s)}function ME(e,t){const n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n||n.closest("[data-doc-ignore]"))return null;const r=n.closest("[data-doc-start][data-doc-end]");return r&&t.contains(r)?r:null}function xY(e,t,n){if(n.collapsed||!e.contains(n.startContainer)||!e.contains(n.endContainer))return null;const r=n.toString();if(!r.trim())return null;const o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=[];let l;for(;l=o.nextNode();){const p=l.textContent?.length??0;if(!p||sI(l,p,n.startContainer,n.startOffset)<=0||sI(l,0,n.endContainer,n.endOffset)>=0)continue;const m=ME(l,e);if(!m){if(l.textContent?.trim())return null;continue}const g=Number(m.dataset.docStart),x=Number(m.dataset.docEnd);if(!Number.isInteger(g)||!Number.isInteger(x)||g<0||x>t.length||x<=g)return null;const y=m.dataset.docExact==="true"&&m.childNodes.length===1&&m.firstChild===l&&t.slice(g,x)===l.textContent;s.push({start:y?g+(l===n.startContainer?n.startOffset:0):g,end:y?g+(l===n.endContainer?n.endOffset:p):x,exact:y})}if(!s.length)return null;const u=Math.min(...s.map(p=>p.start)),f=Math.max(...s.map(p=>p.end));return{startOffset:u,endOffset:f,selectedText:r,startLine:ff(t,u),endLine:ff(t,f-1),locationKind:s.every(p=>p.exact)&&t.slice(u,f)===r?"exact":"context"}}function lI(e,t,n){const r=[],o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);let s;for(;s=o.nextNode();){if(!s.textContent?.trim())continue;const l=ME(s,e);if(!l)continue;const u=Number(l.dataset.docStart),f=Number(l.dataset.docEnd);if(u>=n||f<=t)continue;const p=e.ownerDocument.createRange();l.dataset.docExact==="true"&&l.childNodes.length===1&&s===l.firstChild?(p.setStart(s,Math.max(0,t-u)),p.setEnd(s,Math.min(s.textContent.length,n-u))):p.selectNodeContents(s),r.push(p)}return r}function NE(e){return e.value??(e.children??[]).map(NE).join("")}function cI(){return e=>{const t=new Map,n=r=>{if(/^h[1-6]$/u.test(r.tagName??"")){const o=qL(NE(r)),s=t.get(o)??0;t.set(o,s+1),r.properties={...r.properties,id:s?`${o}-${s}`:o}}r.children?.forEach(n)};n(e)}}function lv(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(lv).join(""):e&&typeof e=="object"&&"props"in e?lv(e.props.children):""}function ob({content:e,filePath:t="",anchor:n,sourceMapping:r=!1}){const o=I.useRef(null),s=D(m=>m.activeProjectId),l=D(m=>m.pushToast),u=I.useMemo(()=>r?[cI,gY(e)]:[cI],[r,e]),f=I.useCallback(m=>{[...o.current?.querySelectorAll("[id]")??[]].find(x=>x.id===m.toLowerCase())?.scrollIntoView?.({block:"start"})},[]);I.useEffect(()=>{n&&f(n)},[n,e,f]);const p=I.useMemo(()=>{const m=g=>r&&g?.properties?Object.fromEntries(Object.entries(g.properties).filter(([x])=>x.startsWith("data-doc-"))):{};return{a:({children:g,href:x,node:y})=>{const w=mY(x??"",t);return w.kind==="blocked"?h.jsx("span",{...m(y),title:"不支持或不安全的链接",children:g}):w.kind==="external"?h.jsx("a",{...m(y),href:w.href,target:"_blank",rel:"noopener noreferrer",children:g}):h.jsx("a",{...m(y),href:x,onClick:S=>{S.preventDefault(),w.kind==="anchor"?f(w.anchor):s&&zc(s,w.path,void 0,He,{...w.anchor?{anchor:w.anchor}:{}})},children:g})},table:({children:g,node:x})=>h.jsx("div",{className:"max-w-full overflow-x-auto",children:h.jsx("table",{...m(x),children:g})}),pre:({children:g,node:x})=>h.jsxs("div",{className:"code-block group/code",children:[h.jsxs("div",{...r?{"data-doc-ignore":!0}:{},className:"code-block-bar",children:[h.jsx("span",{children:"code"}),h.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(lv(g).replace(/\n$/u,"")).then(()=>l({title:"代码已复制",tone:"success"}))},children:[h.jsx(qv,{className:"size-3"}),"复制"]})]}),h.jsx("pre",{...m(x),children:g})]})}},[t,s,l,f,r]);return h.jsx("div",{ref:o,className:"prose-harness",children:h.jsx(eQ,{skipHtml:!0,remarkPlugins:[hY],rehypePlugins:u,components:p,children:e})})}function PE({label:e}){return h.jsxs("span",{role:"status","aria-label":e,"aria-live":"polite","aria-atomic":"true",className:"assistant-thinking",children:[h.jsx("span",{children:e}),h.jsxs("span",{"aria-hidden":"true",className:"assistant-thinking-dots",children:[h.jsx("span",{className:"assistant-thinking-dot"}),h.jsx("span",{className:"assistant-thinking-dot"}),h.jsx("span",{className:"assistant-thinking-dot"})]})]})}function wY({item:e,nested:t=!1}){return h.jsxs("details",{className:Me("rounded-lg border border-[var(--border)] bg-[var(--card)] px-3 py-2 type-meta text-[var(--muted-fg)]",!t&&"ml-10 max-w-[760px]"),children:[h.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 type-meta font-medium text-[var(--subtle-fg)]",children:[h.jsx(Dv,{className:"size-3.5 text-[var(--accent-soft)]"}),"思考摘要",e.streaming&&h.jsx(Bv,{className:"size-3 animate-spin text-[var(--accent)]"}),h.jsx(Ys,{className:"ml-auto size-3 details-chevron"})]}),h.jsx("p",{className:"mt-2 border-t border-[var(--border)] pt-2 leading-5",children:e.summary})]})}const cv=180;function SY(e,t){const[n,r]=I.useState(e),o=I.useRef(e),s=I.useRef(0);return I.useEffect(()=>{o.current=e;const l=Date.now()-s.current;if(l>=cv){s.current=Date.now(),r(e);return}const u=window.setTimeout(()=>{s.current=Date.now(),r(o.current)},cv-l);return()=>window.clearTimeout(u)},[t,e]),n}function kY({items:e}){const n=e.map(l=>l.summary.trim()).filter(Boolean).join(`
205
+
206
+ `).replace(/\s+/gu," ").trim(),o=(n.length>180?`…${n.slice(-180)}`:n)||"正在思考…",s=SY(o,!0);return h.jsxs("div",{role:"status","aria-label":`正在思考:${s}`,"aria-live":"polite","aria-atomic":"true",className:"reasoning-stream-row reasoning-stream-row-active",title:n||"正在思考","data-update-throttle-ms":cv,children:[h.jsx(Dv,{"aria-hidden":!0,className:"reasoning-stream-icon"}),h.jsx("span",{className:"reasoning-stream-text reasoning-stream-text-active",children:s})]})}function uI(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function IY({attachments:e,user:t,scope:n}){const r=n.threadId,[o,s]=I.useState(),{textPreview:l,previewError:u,setPreviewError:f,previewLoading:p}=F7(n,o),[m,g]=I.useState(()=>new Set),x=e.filter(y=>y.kind!=="workspace-file");return!r||x.length===0?null:h.jsxs(h.Fragment,{children:[h.jsx("div",{className:Me("mt-2 flex flex-wrap gap-2",t&&"justify-end"),children:x.map(y=>{const w=da(r,y.artifactId);return y.kind==="image"?h.jsxs("button",{type:"button","aria-label":`预览图片 ${y.name}`,onClick:()=>{f(""),s(y)},className:"group/image relative overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--inset)] outline-none hover:border-[var(--accent)]/45 focus-visible:ring-2 focus-visible:ring-[var(--accent)]/45",children:[m.has(y.artifactId)?h.jsxs("span",{className:"flex h-28 w-48 flex-col items-center justify-center gap-2 px-3 text-center type-meta text-[var(--muted-fg)]",children:[h.jsx(Tc,{className:"size-5 text-[var(--dim-fg)]"}),"图片暂时无法显示"]}):h.jsx("img",{src:w,alt:y.name,loading:"lazy",onError:()=>g(S=>new Set(S).add(y.artifactId)),className:"max-h-52 min-h-20 max-w-[min(320px,62vw)] object-contain"}),h.jsxs("span",{className:"absolute inset-x-0 bottom-0 truncate bg-black/65 px-2 py-1 text-left type-meta text-white opacity-0 transition group-hover/image:opacity-100 group-focus-visible/image:opacity-100",children:[y.name," · ",y.width,"×",y.height]})]},y.artifactId):y.kind==="document"?h.jsxs("button",{type:"button","aria-label":`预览文档 ${y.name}`,onClick:()=>{f(""),s(y)},className:"flex max-w-[320px] items-center gap-2 rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-2.5 py-2 text-left outline-none hover:border-[var(--accent)]/35 hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/45",children:[h.jsx(VT,{className:"size-4 shrink-0 text-[var(--accent-soft)]"}),h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block truncate type-ui text-[var(--subtle-fg)]",children:y.name}),h.jsxs("span",{className:"block type-meta text-[var(--dim-fg)]",children:[y.pageCount!==void 0?`${y.pageCount} 页`:y.sheetCount!==void 0?`${y.sheetCount} 个工作表`:y.format.toUpperCase()," · ",y.visualCount," 个视觉内容",y.textTruncated||y.visualsTruncated?" · 已截断":""]})]})]},y.artifactId):h.jsxs("button",{type:"button","aria-label":`预览文本文件 ${y.name}`,onClick:()=>{f(""),s(y)},className:"flex max-w-[280px] items-center gap-2 rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-2.5 py-2 text-left outline-none hover:border-[var(--accent)]/35 hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/45",children:[h.jsx(Uc,{className:"size-4 shrink-0 text-[var(--accent-soft)]"}),h.jsxs("span",{className:"min-w-0",children:[h.jsx("span",{className:"block truncate type-ui text-[var(--subtle-fg)]",children:y.name}),h.jsxs("span",{className:"block type-meta text-[var(--dim-fg)]",children:[uI(y.size)," · UTF-8"]})]})]},y.artifactId)})}),h.jsx(Tr,{open:!!o,onOpenChange:y=>{y||s(void 0)},title:o?.name??"附件预览",...o?{description:`${uI(o.size)}${o.kind==="image"?` · ${o.width}×${o.height}`:o.kind==="document"?` · ${o.format.toUpperCase()} · ${o.visualCount} 个视觉内容`:" · UTF-8 纯文本"}`}:{},children:o?.kind==="image"?h.jsx("div",{className:"flex max-h-[70vh] items-center justify-center overflow-auto rounded-xl bg-[var(--inset)] p-2",children:u?h.jsxs("p",{className:"flex flex-col items-center gap-2 p-6 type-ui text-[var(--muted-fg)]",children:[h.jsx(Tc,{className:"size-6 text-[var(--dim-fg)]"}),u]}):h.jsx("img",{src:da(r,o.artifactId),alt:o.name,className:"max-h-[66vh] max-w-full object-contain",onError:()=>f("图片已经不可用或加载失败。对话记录仍然保留。 ")})}):o?.kind==="document"?h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsxs("a",{href:da(r,o.artifactId),download:o.name,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-[var(--control-border)] bg-[var(--control)] px-2.5 type-ui text-[var(--subtle-fg)] hover:bg-[var(--hover)]",children:[h.jsx(UT,{className:"size-3.5"}),"下载原文件"]}),(o.textTruncated||o.visualsTruncated)&&h.jsx(hc,{tone:"warning",children:"内容已按安全限制截断"})]}),o.visualCount>0&&h.jsx("div",{className:"grid max-h-[34vh] grid-cols-2 gap-2 overflow-auto rounded-xl bg-[var(--inset)] p-2",children:Array.from({length:o.visualCount},(y,w)=>h.jsx("img",{src:da(r,o.artifactId,"visual",w),alt:`${o.name} 视觉内容 ${w+1}`,loading:"lazy",className:"max-h-60 w-full rounded-lg border border-[var(--border)] bg-white object-contain"},w))}),h.jsx("div",{className:"max-h-[34vh] overflow-auto rounded-xl border border-[var(--border)] bg-[var(--inset)] p-3",children:p?h.jsx("p",{className:"type-ui text-[var(--muted-fg)]",children:"正在加载提取正文…"}):u?h.jsx("p",{className:"type-ui text-[var(--muted-fg)]",children:u}):h.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono type-meta leading-5 text-[var(--subtle-fg)]",children:l||"(未提取到正文,扫描页需要视觉模型读取)"})})]}):o?.kind==="text-file"?h.jsx("div",{className:"max-h-[60vh] overflow-auto rounded-xl border border-[var(--border)] bg-[var(--inset)] p-3",children:p?h.jsx("p",{className:"type-ui text-[var(--muted-fg)]",children:"正在加载预览…"}):u?h.jsx("p",{className:"type-ui text-[var(--muted-fg)]",children:u}):h.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono type-meta leading-5 text-[var(--subtle-fg)]",children:l||"(空文件)"})}):null})]})}function TY({item:e,editable:t,onEdit:n,scope:r}){const o=e.role==="user",s=e.role==="assistant"&&e.streaming===!0&&e.content.trim().length===0,l=iq(e.createdAt);return h.jsxs("article",{className:Me("group/message flex gap-3",o&&"justify-end"),children:[!o&&h.jsx("div",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-[linear-gradient(145deg,rgba(109,87,255,.25),rgba(88,69,220,.12))] text-[var(--accent-soft)] ring-1 ring-[var(--accent)]/20",children:h.jsx(Qs,{className:"size-4"})}),h.jsxs("div",{className:Me("min-w-0",o?"max-w-[78%]":"max-w-[min(760px,88%)] flex-1"),children:[o&&e.content.length===0&&!e.streaming?h.jsx("span",{className:"sr-only",children:"仅包含附件的消息"}):h.jsxs("div",{className:Me("text-[12.5px] leading-[1.72]",o?"rounded-2xl rounded-tr-md bg-[var(--user-bubble)] px-3.5 py-2.5 text-[var(--fg)] shadow-sm":"text-[var(--subtle-fg)]"),children:[o?h.jsx("p",{className:"whitespace-pre-wrap",children:e.content}):s?h.jsx(PE,{label:"正在思考"}):h.jsx(ob,{content:e.content}),e.streaming&&!s&&h.jsx("span",{"aria-hidden":"true",className:"assistant-stream-cursor ml-1 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse rounded bg-[var(--accent)] motion-reduce:animate-none"})]}),e.attachments?.some(u=>u.kind!=="workspace-file")&&h.jsx(IY,{scope:r,attachments:e.attachments,user:o}),e.references&&e.references.length>0&&h.jsx("div",{className:Me("mt-2 flex flex-wrap gap-1.5",o&&"justify-end"),children:e.references.map(u=>h.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--control)] px-2 py-1 type-meta text-[var(--muted-fg)]",children:[h.jsx(sO,{className:"size-3"}),u.path.split(/[\\/]/).pop(),u.startLine?`:${u.startLine}-${u.endLine??u.startLine}`:""]},`${u.path}:${u.startLine??0}`))}),(l||t)&&h.jsxs("div",{className:Me("mt-1.5 flex h-5 items-center gap-1.5 type-meta text-[var(--dim-fg)]",o&&"justify-end"),children:[l&&h.jsx("span",{children:l}),t&&h.jsxs("button",{type:"button",onClick:()=>n(e),className:"inline-flex items-center gap-1 rounded px-1 py-0.5 opacity-0 transition hover:bg-[var(--hover)] hover:text-[var(--fg)] group-hover/message:opacity-100 focus:opacity-100",children:[h.jsx(Hv,{className:"size-2.5"}),"编辑并重发"]})]})]}),o&&h.jsx("div",{className:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-[var(--control)] text-[var(--muted-fg)] ring-1 ring-[var(--border)]",children:h.jsx(zz,{className:"size-3.5"})})]})}function jY(e,t,n){const[r,o]=I.useState(""),[s,l]=I.useState(0),[u,f]=I.useState(!1),[p,m]=I.useState(""),g=qy(e,t,n),x=async(y,w)=>{const S=g.begin();if(!S)return;f(!0),m("");const T=await By.artifact(S,t,y);!S.current()||T.status==="ignored"||(T.status==="success"?(o(k=>w?`${k}${T.value.content}`:T.value.content),l(T.value.nextOffset)):m(T.error),f(!1))};return I.useEffect(()=>{o(""),l(0),m(""),f(!1),n&&x(0,!1)},[n,t,e.hostSessionId,e.projectId,e.threadId]),{content:r,nextOffset:s,loading:u,error:p,load:x}}const CY=/(?:\u001B\][^\u0007]*?(?:\u0007|\u001B\\)|\u001B\[[0-?]*[ -/]*[@-~]|\u009B[0-?]*[ -/]*[@-~]|\u001B[()][0-2A-Za-z]|\u001B[=>])/gu;function Xm(e){return e.replace(CY,"")}const EY={read_file:Zw,search_files:Zw,list_directory:KT,apply_patch:Vw,write_file:Vw,run_command:jz,frontend_validate:Vv,document_validate:Uc};function _Y({item:e}){const t=`运行 ${e.toolName}`;return e.title!==t?e.title:h.jsxs(h.Fragment,{children:["运行 ",h.jsx("code",{className:"font-mono font-medium text-[var(--accent-soft)]",children:e.toolName})]})}const AY={queued:{label:"排队中",color:"text-[var(--dim-fg)]",icon:$v,showLabel:!0},running:{label:"运行中",color:"text-[var(--status-info-fg)]",icon:Ot,showLabel:!0},awaiting_approval:{label:"等待审批",color:"text-[var(--status-warning-fg)]",icon:Fv,showLabel:!0},completed:{label:"已完成",color:"text-[var(--status-success-fg)]",icon:kf,showLabel:!1},failed:{label:"失败",color:"text-[var(--status-danger-fg)]",icon:qT,showLabel:!1},cancelled:{label:"已取消",color:"text-[var(--dim-fg)]",icon:ei,showLabel:!0},unknown:{label:"结果未标记",color:"text-[var(--dim-fg)]",icon:Bv,showLabel:!0}};function Md(...e){for(const t of e){const n=t?.split(/\r?\n/u).find(r=>r.trim().length>0)?.trim();if(n)return n}return""}function RE({item:e,scope:t,nested:n=!1,failurePresentation:r}){const o=e.state==="failed"&&r===void 0,[s,l]=I.useState(e.state==="awaiting_approval"),[u,f]=I.useState(!1),p=EY[e.toolName]??JT,m=r==="adjusting"?{label:"正在调整",color:"text-[var(--muted-fg)]",icon:Ws,showLabel:!0}:r==="recovered"?{label:"已自动修正",color:"text-[var(--muted-fg)]",icon:kf,showLabel:!0}:AY[e.state],g=m.icon,x=e.artifactIds?.[0]??e.artifactId,y=e.toolName==="run_command",w=e.stdout===void 0?void 0:Xm(e.stdout),S=e.stderr===void 0?void 0:Xm(e.stderr),T=e.output===void 0?void 0:Xm(e.output),k=Md(w).length>0,_=Md(S).length>0,C=Md(T).length>0,E=y&&!k&&!_&&!C&&!["queued","running","awaiting_approval"].includes(e.state),O=e.input!==void 0||e.output!==void 0||e.stdout!==void 0||e.stderr!==void 0||x!==void 0||E||y&&(e.exitCode!==void 0||e.timedOut||e.truncated),M=o?Md(S,w,T)||(e.exitCode!==void 0?`退出码 ${e.exitCode}`:"工具执行失败"):"";I.useEffect(()=>{e.state==="awaiting_approval"&&l(!0)},[e.state]);const R=()=>{O&&l(z=>!z)};return h.jsxs("article",{className:Me("-my-1.5",!n&&"ml-10 max-w-[760px]"),children:[h.jsxs("button",{type:"button","aria-expanded":O?s:void 0,onClick:R,className:Me("group/tool flex min-h-7 w-full items-center gap-2 rounded-lg px-2 text-left transition-colors",O?"cursor-pointer hover:bg-[var(--hover)]":"cursor-default",o&&"bg-[var(--status-danger-bg)]"),children:[h.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center text-[var(--muted-fg)]",children:h.jsx(p,{className:"size-3.5"})}),h.jsx("span",{className:"min-w-0 truncate type-ui text-[var(--subtle-fg)]",children:h.jsx(_Y,{item:e})}),M&&h.jsxs(h.Fragment,{children:[h.jsx("span",{"aria-hidden":!0,className:"size-0.5 shrink-0 rounded-full bg-[var(--status-danger-fg)]"}),h.jsx("span",{className:"min-w-0 flex-1 truncate type-meta text-[var(--status-danger-fg)]",children:M})]}),!M&&h.jsx("span",{className:"min-w-0 flex-1"}),e.durationMs!==void 0&&e.state!=="running"&&h.jsxs("span",{className:"shrink-0 type-meta tabular-nums text-[var(--dim-fg)]",children:[e.durationMs," ms"]}),e.approvalSource==="full-access"&&h.jsx(Vv,{"aria-label":"已由 Full access 自动允许",className:"size-3 shrink-0 text-[var(--status-success-fg)]"}),h.jsxs("span",{className:Me("flex shrink-0 items-center gap-1 type-meta",m.color),title:m.label,children:[h.jsx(g,{"aria-hidden":!0,className:Me("size-3",e.state==="running"&&"animate-spin motion-reduce:animate-none")}),m.showLabel?m.label:h.jsx("span",{className:"sr-only",children:m.label})]}),O&&(s?h.jsx(Gs,{"aria-hidden":!0,className:"size-3 text-[var(--dim-fg)]"}):h.jsx(Ys,{"aria-hidden":!0,className:"size-3 text-[var(--dim-fg)] opacity-0 transition-opacity group-hover/tool:opacity-100 group-focus-visible/tool:opacity-100"}))]}),s&&O&&h.jsxs("div",{className:"ml-7 mt-1 overflow-hidden rounded-xl border border-[var(--border)] bg-[var(--inset)] font-mono type-meta text-[var(--subtle-fg)]",children:[y&&(e.command??(typeof e.input?.command=="string"?e.input.command:void 0))&&h.jsxs("div",{className:"border-b border-[var(--border)] px-3 py-2.5",children:[h.jsxs("div",{className:"mb-1 flex items-center gap-2 font-sans type-meta text-[var(--dim-fg)]",children:[h.jsx("span",{children:"命令"}),e.cwd&&h.jsxs("span",{className:"truncate",children:["cwd · ",e.cwd]})]}),h.jsx("code",{className:"block whitespace-pre-wrap break-words text-[var(--subtle-fg)]",children:e.command??String(e.input?.command)})]}),!y&&e.input!==void 0&&h.jsxs("div",{className:"grid max-h-[150px] grid-cols-[36px_minmax(0,1fr)] gap-3 overflow-auto px-3 py-2.5",children:[h.jsx("span",{className:"sticky top-0 self-start font-sans type-meta text-[var(--dim-fg)]",children:"输入"}),h.jsx("pre",{className:"min-w-0 whitespace-pre-wrap break-words",children:JSON.stringify(e.input,null,2)})]}),!y&&e.input!==void 0&&e.output!==void 0&&h.jsx("div",{className:"h-px bg-[var(--border)]"}),y&&k&&h.jsxs("div",{className:"grid max-h-[150px] grid-cols-[42px_minmax(0,1fr)] gap-3 overflow-auto border-b border-[var(--border)] px-3 py-2.5",children:[h.jsx("span",{className:"sticky top-0 self-start font-sans type-meta text-[var(--dim-fg)]",children:"stdout"}),h.jsx("pre",{className:"min-w-0 whitespace-pre-wrap break-words",children:w})]}),y&&_&&h.jsxs("div",{className:Me("grid max-h-[150px] grid-cols-[42px_minmax(0,1fr)] gap-3 overflow-auto border-b border-[var(--border)] px-3 py-2.5",o&&"text-[var(--status-danger-fg)]"),children:[h.jsx("span",{className:Me("sticky top-0 self-start font-sans type-meta",o?"text-[var(--status-danger-fg)]":"text-[var(--dim-fg)]"),children:"stderr"}),h.jsx("pre",{className:"min-w-0 whitespace-pre-wrap break-words",children:S})]}),(!y||!k&&!_)&&C&&h.jsxs("div",{className:"grid max-h-[150px] grid-cols-[36px_minmax(0,1fr)] gap-3 overflow-auto px-3 py-2.5",children:[h.jsx("span",{className:"sticky top-0 self-start font-sans type-meta text-[var(--dim-fg)]",children:"输出"}),h.jsx("pre",{className:Me("min-w-0 whitespace-pre-wrap break-words",o&&"text-[var(--status-danger-fg)]"),children:T})]}),E&&h.jsx("div",{className:"px-3 py-2.5 font-sans type-meta text-[var(--dim-fg)]",children:"命令未产生输出"}),y&&(e.exitCode!==void 0||e.timedOut||e.truncated)&&h.jsxs("div",{className:"flex items-center gap-3 border-t border-[var(--border)] px-3 py-2 font-sans type-meta text-[var(--dim-fg)]",children:[e.exitCode!==void 0&&h.jsxs("span",{className:e.exitCode===0?"text-[var(--status-success-fg)]":"text-[var(--status-danger-fg)]",children:["退出码 ",e.exitCode]}),e.timedOut&&h.jsx("span",{className:"text-[var(--status-warning-fg)]",children:"已超时"}),e.truncated&&h.jsx("span",{children:"预览已截断"})]}),x&&h.jsx("button",{type:"button",onClick:()=>f(!0),className:"mx-3 mb-2.5 font-sans type-meta text-[var(--accent-soft)] underline-offset-4 hover:underline",children:"查看完整输出"})]}),x&&t.threadId&&h.jsx(MY,{open:u,onOpenChange:f,scope:t,artifactId:x})]})}function MY({open:e,onOpenChange:t,scope:n,artifactId:r}){const o=D(m=>m.pushToast),{content:s,nextOffset:l,loading:u,error:f,load:p}=jY(n,r,e);return h.jsx(Tr,{open:e,onOpenChange:t,title:"完整工具输出",description:"输出按 64 KiB 分段读取,并校验其属于当前会话。",footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{className:"bg-transparent text-[var(--muted-fg)] hover:bg-[var(--hover)]",onClick:()=>t(!1),children:"关闭"}),h.jsxs(Je,{disabled:!s,onClick:()=>{navigator.clipboard.writeText(s).then(()=>o({title:"输出已复制",tone:"success"}))},children:[h.jsx(qv,{className:"size-3"}),"复制已加载内容"]})]}),children:h.jsxs("div",{className:"space-y-2",children:[f&&h.jsx(On,{tone:"danger",className:"px-3 py-2 type-meta",children:f}),h.jsx("pre",{className:"max-h-[58vh] min-h-40 overflow-auto rounded-xl border border-[var(--border)] bg-[var(--inset)] p-3 font-mono type-meta leading-5 text-[var(--subtle-fg)]",children:s||(u?"正在读取输出…":"(无输出)")}),l!==null&&h.jsx("button",{type:"button",disabled:u,onClick:()=>{p(l,!0)},className:"type-meta text-[var(--accent-soft)] hover:underline disabled:cursor-not-allowed disabled:text-[var(--disabled-fg)]",children:u?"正在加载…":"加载下一段"})]})})}function NY(e,t){const n=D(g=>g.connectionStatus==="online"),r=D(g=>g.pushToast),[o,s]=I.useState(!1),[l,u]=I.useState(),f=qy(e,t.approvalId,t.status==="pending");I.useEffect(()=>{u(void 0),s(!1)},[e.hostSessionId,e.projectId,e.threadId,t.approvalId,t.status]);const p=t.status==="pending"?l??t.status:t.status;return{pending:o,localStatus:p,resolve:async g=>{if(p!=="pending")return;if(!n){r({title:"审批未执行",description:"这是离线示例;连接本地 Host 后才可审批真实操作。",tone:"neutral"});return}const x=f.begin();if(!x)return;s(!0);const y=await By.approval(x,t.approvalId,g);!x.current()||y.status==="ignored"||(y.status==="success"?u(g==="deny"?"denied":"approved"):r({title:"审批失败",description:y.error,tone:"danger"}),s(!1))}}}const PY={warning:{card:"border-[var(--status-warning-border)] bg-[var(--status-warning-bg)]",divider:"border-[var(--status-warning-border)]",icon:"border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] text-[var(--status-warning-fg)]",label:"text-[var(--status-warning-fg)]"},success:{card:"border-[var(--status-success-border)] bg-[var(--status-success-bg)]",divider:"border-[var(--status-success-border)]",icon:"border-[var(--status-success-border)] bg-[var(--status-success-bg)] text-[var(--status-success-fg)]",label:"text-[var(--status-success-fg)]"},danger:{card:"border-[var(--status-danger-border)] bg-[var(--status-danger-bg)]",divider:"border-[var(--status-danger-border)]",icon:"border-[var(--status-danger-border)] bg-[var(--status-danger-bg)] text-[var(--status-danger-fg)]",label:"text-[var(--status-danger-fg)]"}};function OE({item:e,scope:t,nested:n=!1}){const{pending:r,localStatus:o,resolve:s}=NY(t,e),l=e.risk==="write"?"文件写入请求":e.risk==="delete"?"删除请求":e.risk==="command"?"命令执行请求":"网络访问请求",u=e.allowedDecisions?.includes("allow-turn")===!0,f=o==="pending"?"warning":o==="approved"?"success":"danger",p=PY[f];return h.jsxs("article",{"data-tone":f,className:Me("overflow-hidden rounded-xl border shadow-[0_12px_35px_rgba(0,0,0,.12)]",p.card,!n&&"ml-10 max-w-[760px]"),children:[h.jsxs("div",{className:Me("flex items-start gap-3 border-b px-3.5 py-3",p.divider),children:[h.jsx("span",{className:Me("flex size-7 shrink-0 items-center justify-center rounded-lg border",p.icon),children:h.jsx(Fv,{className:"size-4"})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:Me("type-meta font-semibold uppercase tracking-[.08em]",p.label),children:l}),h.jsx("h4",{className:"mt-0.5 type-ui font-medium text-[var(--fg)]",children:e.title}),h.jsx("p",{className:"mt-1 type-meta text-[var(--muted-fg)]",children:e.description})]}),h.jsx(hc,{tone:o==="pending"?"warning":o==="approved"?"success":"danger",children:o==="pending"?"等待决定":o==="approved"?"已允许":"已拒绝"})]}),e.command&&h.jsxs("div",{className:"m-3 rounded-lg border border-[var(--border)] bg-[var(--inset)] p-2.5",children:[h.jsxs("div",{className:"mb-1 type-meta uppercase tracking-wider text-[var(--dim-fg)]",children:["PowerShell · ",e.cwd]}),h.jsx("code",{className:"font-mono type-meta text-[var(--subtle-fg)]",children:e.command})]}),e.diff&&h.jsx("pre",{className:"m-3 max-h-52 overflow-auto rounded-lg border border-[var(--border)] bg-[#080b11] p-2.5 font-mono type-meta",children:e.diff.split(`
207
+ `).map((m,g)=>h.jsx("span",{className:Me("block whitespace-pre",m.startsWith("+")?"bg-emerald-500/8 text-emerald-300":m.startsWith("-")?"bg-rose-500/8 text-rose-300":m.startsWith("@@")?"text-sky-400":"text-slate-300"),children:m||" "},g))}),o==="pending"&&h.jsxs("div",{className:Me("flex flex-wrap items-center justify-end gap-2 border-t px-3 py-2.5",p.divider),children:[h.jsxs(Je,{variant:"ghost",disabled:r,onClick:()=>{s("deny")},children:[h.jsx(ei,{className:"size-3"}),"拒绝"]}),u&&h.jsxs(Je,{variant:"secondary","aria-label":"本次任务内允许:仅当前 Turn 的同名工具",title:"仅允许当前 Turn 内后续的同名工具调用;下一次对话仍会再次询问",disabled:r,onClick:()=>{s("allow-turn")},children:[h.jsx(Lv,{className:"size-3"}),"本次任务内允许"]}),h.jsxs(Je,{variant:"warning",disabled:r,onClick:()=>{s("allow-once")},children:[h.jsx(QT,{className:"size-3"}),"允许一次"]})]})]})}function zE({item:e,nested:t=!1,providerLabel:n,onRetry:r,retrying:o=!1,retryDisabled:s=!1}){const l=D(x=>x.pushToast),u=e.turnId,f=e.recoverable&&u&&r?()=>r(u):void 0,p=ab(e),m=e.code==="context_too_large"?"整理后的上下文仍然过长,请缩短输入或新建对话后再试。":e.code==="context_history_invalid"||RY(e)?"整理上下文时没有保留完整提问,对话记录仍在,可以直接重试":OY(e)?"本次模型请求连接中断,服务可能仍在线。对话记录仍在,可以直接重试。":e.recoverable?"对话记录仍在,可以直接重试。":"对话记录仍在,可以查看技术详情了解原因。",g=async()=>{try{await navigator.clipboard.writeText(p),l({title:"技术详情已复制",tone:"success"})}catch{l({title:"复制失败",description:"请展开技术详情后手动复制。",tone:"neutral"})}};return h.jsxs("article",{role:"status","aria-live":"polite",className:Me("min-w-0 max-w-[760px] rounded-xl border border-[var(--border-strong)] bg-[var(--card)] text-[var(--subtle-fg)] shadow-[0_8px_28px_rgba(0,0,0,.08)]",t?"w-full":"ml-10"),children:[h.jsxs("div",{className:"flex min-w-0 items-start gap-3 px-3.5 py-3",children:[h.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--control)] text-[var(--muted-fg)] ring-1 ring-[var(--border)]",children:h.jsx(Mi,{className:"size-4"})}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h.jsx("p",{className:"type-ui font-semibold text-[var(--fg)]",children:"这次没有完成"}),n&&h.jsx("span",{"aria-label":`失败时使用的模型:${n}`,title:n,className:"max-w-full truncate rounded-md border border-[var(--border)] bg-[var(--control)] px-1.5 py-0.5 type-meta text-[var(--muted-fg)]",children:n})]}),h.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words type-ui leading-5 text-[var(--muted-fg)]",children:m})]})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-[var(--border)] px-3.5 py-2",children:[h.jsxs("details",{className:"min-w-0 flex-1 type-meta text-[var(--muted-fg)]",children:[h.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 rounded-md py-1 outline-none hover:text-[var(--fg)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/45",children:[h.jsx(Ys,{"aria-hidden":!0,className:"details-chevron size-3 shrink-0 transition-transform"}),h.jsx("span",{children:"技术详情"})]}),h.jsxs("div",{className:"mt-2 overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--inset)]",children:[h.jsx("div",{className:"flex items-center justify-end border-b border-[var(--border)] px-2 py-1",children:h.jsxs("button",{type:"button","aria-label":"复制技术详情",onClick:()=>{g()},className:"inline-flex items-center gap-1 rounded px-2 py-1 hover:bg-[var(--hover)] hover:text-[var(--fg)]",children:[h.jsx(qv,{className:"size-3"}),"复制"]})}),h.jsx("pre",{className:"max-h-[240px] overflow-auto whitespace-pre-wrap break-words p-2.5 font-mono type-meta leading-5 text-[var(--subtle-fg)]",children:p})]})]}),f&&h.jsxs(Je,{variant:"secondary","aria-label":"重试本轮执行",className:"shrink-0",onClick:f,disabled:s||o,children:[h.jsx(Ws,{className:Me("size-3.5",o&&"animate-spin motion-reduce:animate-none")}),o?"正在重试…":"重试"]})]})]})}function ab(e){return[e.code?`code: ${e.code}`:void 0,`message:
208
+ ${e.message}`,e.details?`details:
209
+ ${JSON.stringify(e.details,null,2)}`:void 0].filter(n=>!!n).join(`
210
+
211
+ `)}function RY(e){return/no\s+user\s+query\s+found\s+in\s+messages/iu.test(ab(e))}function OY(e){return["provider_transport_error","provider_connection_error","provider_timeout","provider_stream_error"].includes(e.code??"")?!0:/\bconnection error\b|\brequest timed out\b|\bfetch failed\b|\bstream (?:ended|closed|terminated|interrupted)\b/iu.test(ab(e))}function dI(e){return e<1e3?e.toLocaleString():`${(e/1e3).toFixed(1)}K`}function zY({item:e}){return h.jsxs("details",{className:"ml-10 max-w-[760px] overflow-hidden rounded-lg border border-[var(--border)] bg-[var(--card)] type-meta text-[var(--muted-fg)]",children:[h.jsxs("summary",{className:"group/compaction flex min-h-8 cursor-pointer list-none items-center gap-2 px-3 py-2 outline-none hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--accent)]/45",children:[h.jsx(KT,{className:"size-3.5 shrink-0 text-[var(--dim-fg)]"}),h.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["已整理较早的对话 · ",dI(e.originalTokens)," → ",dI(e.compactedTokens)," tokens"]}),h.jsx(Ys,{"aria-hidden":!0,className:"details-chevron size-3 shrink-0 transition-transform"})]}),h.jsx("div",{className:"max-h-[240px] overflow-y-auto whitespace-pre-wrap break-words border-t border-[var(--border)] px-3 py-2.5 leading-5 text-[var(--subtle-fg)]",children:e.summary||"(没有可显示的摘要)"})]})}const DY={running:{label:"工作中",icon:Bv,color:"text-[var(--status-info-fg)]"},awaiting_approval:{label:"待审批",icon:Fv,color:"text-[var(--status-warning-fg)]"},failed:{label:"存在失败",icon:qT,color:"text-[var(--status-danger-fg)]"},cancelled:{label:"已取消",icon:ei,color:"text-[var(--dim-fg)]"},completed:{label:"已完成",icon:kf,color:"text-[var(--status-success-fg)]"}};function LY({item:e}){return h.jsxs("div",{className:"flex gap-2.5 py-1 text-[var(--subtle-fg)]",children:[h.jsx("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md bg-[var(--accent)]/10 text-[var(--accent-soft)]",children:h.jsx(Qs,{className:"size-3"})}),h.jsx("div",{className:"min-w-0 flex-1 type-ui leading-[1.65]",children:h.jsx(ob,{content:e.content})})]})}const BY={preparing:"正在准备任务","waiting-model":"正在等待模型响应","running-tool":"正在执行工具","analyzing-tool-results":"正在分析工具结果",adjusting:"正在调整方案",validating:"正在校验路由、类型和生产构建"};function fI({label:e}){return h.jsxs("div",{className:"flex gap-2.5 py-1 text-[var(--subtle-fg)]",children:[h.jsx("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md bg-[var(--accent)]/10 text-[var(--accent-soft)]",children:h.jsx(Qs,{className:"size-3"})}),h.jsx(PE,{label:e})]})}function qY({group:e,scope:t,turn:n,providerLabel:r,onRetry:o,retrying:s=!1,retryDisabled:l=!1}){const u=e.state==="failed"||e.state==="awaiting_approval",[f,p]=I.useState(e.state==="running"||u),m=I.useRef(e.state),g=I.useRef(!1),x=DY[e.state],y=x.icon,w=e.items.filter(R=>R.type==="reasoning"),S=e.items.filter(R=>R.type!=="reasoning"),T=e.state==="running"&&(n?.providerPhase==="reasoning"||w.some(R=>R.streaming)),k=[...S].reverse().find(R=>R.type==="tool"&&["queued","running"].includes(R.state)),_=n?.providerRetryCount??0,C=e.state==="running"&&n?.providerRetrying===!0,E=n?.providerRetryAttempt??Math.max(1,_+1),O=C?void 0:e.liveStatus,M=O==="running-tool"&&k?k.state==="queued"?`等待执行 ${k.title}`:`正在${k.title}`:O?BY[O]:void 0;return I.useEffect(()=>{const R=m.current==="running";e.state==="failed"||e.state==="awaiting_approval"?(p(!0),g.current=!1):e.state==="running"?g.current||p(!0):R&&!g.current&&p(!1),m.current=e.state},[e.state]),h.jsxs("article",{className:"ml-10 max-w-[760px]",children:[!C&&_>0&&h.jsxs("div",{className:"flex min-h-8 items-center gap-2 rounded-lg px-2 type-meta text-[var(--dim-fg)]",children:[h.jsx(Ws,{"aria-hidden":!0,className:"size-3.5 shrink-0 text-[var(--muted-fg)]"}),h.jsx("span",{children:`连接已自动恢复 ${_} 次`})]}),S.length>0&&h.jsxs("button",{type:"button","aria-expanded":f,onClick:()=>{g.current=!0,p(R=>!R)},className:Me("group/activity flex min-h-8 w-full items-center gap-2 rounded-lg px-2 text-left type-ui transition-colors duration-150 hover:bg-[var(--hover)] motion-reduce:transition-none",e.state==="failed"&&"bg-[var(--status-danger-bg)]",e.state==="awaiting_approval"&&"bg-[var(--status-warning-bg)]"),children:[h.jsx(dO,{className:Me("size-3.5 shrink-0",e.state==="running"?"text-[var(--accent-soft)]":"text-[var(--muted-fg)]")}),h.jsx("span",{className:"font-medium text-[var(--subtle-fg)]",children:"工作过程"}),h.jsx("span",{className:"min-w-0 flex-1 truncate type-meta text-[var(--dim-fg)]",children:e.summary}),h.jsxs("span",{className:Me("flex shrink-0 items-center gap-1 type-meta",x.color),children:[h.jsx(y,{className:Me("size-3",e.state==="running"&&"animate-spin motion-reduce:animate-none")}),x.label]}),f?h.jsx(Gs,{className:"size-3 text-[var(--dim-fg)]"}):h.jsx(Ys,{className:"size-3 text-[var(--dim-fg)]"})]}),S.length>0&&f&&h.jsx("div",{className:"ml-3 border-l border-[var(--border)] py-2 pl-4 [transition:opacity_180ms_ease,transform_180ms_ease] motion-reduce:transition-none",children:h.jsx("div",{className:"flex flex-col gap-2",children:S.map(R=>R.type==="message"?R.content.trim()?h.jsx(LY,{item:R},R.id):null:R.type==="tool"?h.jsx(RE,{scope:t,item:R,nested:!0,...e.toolFailurePresentation?.[R.id]?{failurePresentation:e.toolFailurePresentation[R.id]}:{}},R.id):R.type==="approval"?h.jsx(OE,{scope:t,item:R,nested:!0},R.id):R.type==="error"?h.jsx(zE,{item:R,nested:!0,...r?{providerLabel:r}:{},...o?{onRetry:o}:{},retrying:s&&R.turnId===e.turnId,retryDisabled:l},R.id):null)})}),T?h.jsx(kY,{items:w}):C?h.jsx("div",{className:"px-2 py-1",children:h.jsx(fI,{label:`正在恢复模型连接 · 第 ${E} 次`})}):M?h.jsx("div",{className:"px-2 py-1",children:h.jsx(fI,{label:M})}):null]})}function $Y({item:e,scope:t,editable:n,onEdit:r,onRetry:o,retrying:s=!1,retryDisabled:l=!1,providerLabel:u}){return e.type==="message"?h.jsx(TY,{scope:t,item:e,editable:n&&e.role==="user",onEdit:r}):e.type==="reasoning"?h.jsx(wY,{item:e}):e.type==="tool"?h.jsx(RE,{scope:t,item:e}):e.type==="approval"?h.jsx(OE,{scope:t,item:e}):e.type==="compaction"?h.jsx(zY,{item:e}):h.jsx(zE,{item:e,...u?{providerLabel:u}:{},...o?{onRetry:o}:{},retrying:s,retryDisabled:l})}function DE(e,t){const n=e.at(-1);if(!(!t||!n||n.completedAt||!n.startedAt||n.status!=="running"&&n.status!=="incomplete"||!Number.isFinite(Date.parse(n.startedAt))))return n}function UY(e,t){const n=DE(e.requests,e.running),r=n?Math.max(n.elapsedMs,t-Date.parse(n.startedAt)):0,o=n?r-n.elapsedMs:0;return{active:!!n,latestTurn:e.latestTurn&&{...e.latestTurn,llmDurationMs:e.latestTurn.llmDurationMs+o},threadTotal:e.threadTotal&&{...e.threadTotal,llmDurationMs:e.threadTotal.llmDurationMs+o},requests:n?e.requests.map(s=>s===n?{...s,elapsedMs:r}:s):e.requests}}function HY(e,t,n){const[r,o]=I.useState(Date.now),l=DE(e.requests,e.running)?.requestId;return I.useEffect(()=>{if(!l||!t||!n)return;let u;const f=()=>{clearInterval(u),!document.hidden&&(o(Date.now()),u=setInterval(()=>o(Date.now()),1e3))};return f(),document.addEventListener("visibilitychange",f),()=>{clearInterval(u),document.removeEventListener("visibilitychange",f)}},[l,t,n]),UY(e,r)}const Bt="—";function Io(e){if(e===void 0||!Number.isFinite(e))return Bt;if(e<1e3)return`${Math.round(e)} ms`;if(e<1e4)return`${(e/1e3).toFixed(1)} s`;if(e<6e4)return`${Math.round(e/1e3)} s`;const t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return`${t}m ${n}s`}function sb(e){return e===void 0||!Number.isFinite(e)?Bt:`${e<10?e.toFixed(1):Math.round(e)} tok/s`}function FY(e){if(!Number.isFinite(e))return Bt;if(e<6e4)return Io(e).replaceAll(" ","");const t=Math.round(e/1e3),n=Math.floor(t/60);if(n<60)return`${n}m${t%60}s`;const r=Math.floor(n/60);return r<24?`${r}h${n%60}m`:`${Math.floor(r/24)}d${r%24}h`}function cc(e){return Gn(e,{compact:!0})}function lb(e){return e===void 0||!Number.isFinite(e)?Bt:`${Math.round(e*100)}%`}function LE(e){return e?.cacheHitRate===void 0?Bt:`${e.cacheHitRateKind==="lower-bound"?"≥":""}${lb(e.cacheHitRate)}`}function VY(e,t){if(e.cacheHitRate===void 0)return"Provider 未提供";const n=`${Gn(t?.cachedInputTokens??0)} cached tok`;if(e.cacheHitRateKind!=="lower-bound")return n;const r=e.cacheMetricCoverage===void 0?Bt:lb(e.cacheMetricCoverage);return`${n} · 统计覆盖 ${r}`}function BE(e){const t=e?.usage;if(t)return t.inputTokens+(t.cachedInputTokens??0)+(t.cacheWriteTokens??0)}function ZY(e){return!e.usage||e.usage.availability?.cachedInputTokens!==!0&&(e.usage.cachedInputTokens??0)===0?Bt:Gn(e.usage.cachedInputTokens??0)}function ws({icon:e,label:t,value:n,tooltip:r,valueClassName:o,compactValue:s,testId:l,compact:u=!1}){return h.jsx(_o,{content:r,side:"top",children:h.jsxs("span",{"data-testid":l,"data-compact":u||void 0,"aria-label":`${t}:${n}`,className:"metric-cell flex h-5 shrink-0 items-center gap-1 rounded-md px-1.5 text-[var(--dim-fg)] motion-safe:transition-colors group-hover:text-[var(--muted-fg)]",children:[h.jsx("span",{"aria-hidden":"true",className:"inline-flex shrink-0 items-center text-[var(--dim-fg)]",children:e}),h.jsx("span",{className:"metric-label hidden shrink-0 min-[980px]:inline",children:t}),h.jsx("span",{"aria-hidden":s!==void 0||void 0,className:Me("metric-value inline-block whitespace-nowrap text-right font-mono tabular-nums text-[var(--subtle-fg)]",s!==void 0&&"metric-full-value",o),children:n}),s!==void 0&&h.jsx("span",{"aria-hidden":"true",className:"metric-value metric-compact-value whitespace-nowrap text-right font-mono tabular-nums text-[var(--subtle-fg)]",children:s})]})})}function wo({label:e,value:t,detail:n,icon:r}){return h.jsxs("div",{className:"min-w-0 rounded-xl border border-[var(--border)] bg-[var(--card)] px-3 py-2.5",children:[h.jsxs("div",{className:"flex items-center gap-1.5 type-meta text-[var(--dim-fg)]",children:[r,h.jsx("span",{children:e})]}),h.jsx("div",{className:"mt-1 truncate font-mono text-[13px] font-medium tabular-nums text-[var(--fg)]",children:t}),n&&h.jsx("div",{className:"mt-0.5 truncate type-meta text-[var(--muted-fg)]",children:n})]})}function pI({metrics:e,emptyLabel:t}){if(!e)return h.jsx("div",{className:"rounded-xl border border-dashed border-[var(--border)] px-3 py-5 text-center type-ui text-[var(--dim-fg)]",children:t});const n=e.usageAvailable?e.usage:void 0;return h.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[h.jsx(wo,{icon:h.jsx($v,{className:"size-3"}),label:"LLM 用时",value:Io(e.llmDurationMs),detail:`${e.requestCount} 次模型调用`}),h.jsx(wo,{icon:h.jsx(DT,{className:"size-3"}),label:"平均速度",value:sb(e.outputTokensPerSecond),detail:"Host 观测完成请求"}),h.jsx(wo,{icon:h.jsx(Nz,{className:"size-3"}),label:"平均 TTFT",value:Io(e.averageTtftMs),detail:"首个真实模型输出"}),h.jsx(wo,{icon:h.jsx($T,{className:"size-3"}),label:"缓存命中",value:LE(e),detail:VY(e,n)}),h.jsx(wo,{icon:h.jsx(zv,{className:"size-3"}),label:"输入 Token",value:n?Gn(e.promptTokens):Bt,detail:"含缓存读取与写入"}),h.jsx(wo,{icon:h.jsx(Rd,{className:"size-3"}),label:"输出 Token",value:n?Gn(n.outputTokens):Bt,detail:n?.reasoningTokens!==void 0?`含思考 ${Gn(n.reasoningTokens)}`:"思考已包含在输出中"})]})}const KY={running:{label:"进行中",className:"text-[var(--accent-soft)]"},completed:{label:"完成",className:"text-[var(--status-success-fg)]"},failed:{label:"失败",className:"text-[var(--status-danger-fg)]"},cancelled:{label:"取消",className:"text-[var(--status-warning-fg)]"},incomplete:{label:"不完整",className:"text-[var(--status-warning-fg)]"}};function QY({requests:e}){return e.length===0?h.jsx("div",{className:"rounded-xl border border-dashed border-[var(--border)] px-3 py-5 text-center type-ui text-[var(--dim-fg)]",children:"暂无模型调用明细"}):h.jsx("div",{className:"overflow-x-auto rounded-xl border border-[var(--border)]",children:h.jsxs("table",{className:"w-full min-w-[860px] border-collapse text-left type-meta",children:[h.jsx("thead",{className:"bg-[var(--control)] text-[var(--muted-fg)]",children:h.jsxs("tr",{children:[h.jsx("th",{className:"px-3 py-2 font-medium",children:"调用"}),h.jsx("th",{className:"px-3 py-2 font-medium",children:"状态"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"耗时"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"TTFT"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"首个可见"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"思考"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"速度"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"输入"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"缓存"}),h.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"输出"})]})}),h.jsx("tbody",{children:e.map(t=>{const n=KY[t.status],r=BE(t);return h.jsxs("tr",{className:"border-t border-[var(--border)] text-[var(--subtle-fg)]",children:[h.jsxs("td",{className:"max-w-[180px] px-3 py-2",children:[h.jsxs("div",{className:"truncate type-ui font-medium text-[var(--fg)]",children:["#",t.requestIndex," · ",t.model]}),h.jsxs("div",{className:"truncate text-[var(--dim-fg)]",children:["第 ",t.round+1," 轮 · 重试 ",t.retryCount]})]}),h.jsx("td",{className:Me("px-3 py-2 font-medium",n.className),children:n.label}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:Io(t.elapsedMs)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:Io(t.ttftMs)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:Io(t.firstVisibleOutputMs)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:t.reasoningObserved===!0?Io(t.reasoningDurationMs):Bt}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:sb(t.outputTokensPerSecond)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:r===void 0?Bt:Gn(r)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:ZY(t)}),h.jsx("td",{className:"px-3 py-2 text-right font-mono tabular-nums",children:t.usage?Gn(t.usage.outputTokens):Bt})]},t.requestId)})})]})})}function GY({latestTurn:e,threadTotal:t,latestUsageRequest:n,requests:r=[],contextWindow:o,maxOutputTokens:s,running:l,visible:u=!0,connected:f=!0,className:p}){const[m,g]=I.useState(!1),{latestTurn:x,threadTotal:y,requests:w,active:S}=HY({...e?{latestTurn:e}:{},...t?{threadTotal:t}:{},requests:r,running:l},u,f),T=n??[...w].reverse().find(Z=>Z.usage!==void 0),k=BE(T),_=y??x,C=_?.usageAvailable?_.usage:void 0,E=T?.contextWindow??o,O=E===void 0?Bt:Gn(E),M=k===void 0?`${Bt} / ${O}`:`${Gn(k)} / ${O}`,R=C?`${Gn(_.promptTokens)} / ${Gn(C.outputTokens)}`:`${Bt} / ${Bt}`,z=`${k===void 0?Bt:cc(k)}/${E===void 0?Bt:cc(E)}`,K=C?`${cc(_.promptTokens)}/${cc(C.outputTokens)}`:`${Bt}/${Bt}`,q=_?.cacheHitRateKind==="lower-bound"?`本会话已明确报告的缓存 Token / 全部输入 Token 的安全下界;统计覆盖 ${lb(_.cacheMetricCoverage)}`:"本会话缓存读取 Token / 全部输入 Token 的加权命中率;Provider 未报告时显示不可用";return h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button","aria-label":"查看性能指标详情","aria-haspopup":"dialog","aria-expanded":m,onClick:()=>g(!0),className:Me("chat-metrics group relative flex h-7 w-full shrink-0 flex-nowrap items-center justify-center gap-0.5 overflow-hidden border-t border-[var(--border)] bg-[var(--panel)] px-12 type-meta outline-none","hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--accent)]/55 motion-safe:transition-colors",p),children:[h.jsx(ws,{icon:h.jsx(Kw,{className:"size-3"}),testId:"metric-context",compact:!0,label:"上下文",value:M,compactValue:z,tooltip:"本会话最后一次有 Usage 的模型请求输入 Token(未缓存输入 + 缓存读取 + 缓存写入)/ 该请求的上下文窗口"}),h.jsx("span",{"aria-hidden":"true",className:"metric-divider h-3 w-px shrink-0 bg-[var(--border)]"}),h.jsx(ws,{icon:h.jsx(Rd,{className:"size-3"}),testId:"metric-output-limit",label:"输出上限",value:s===void 0?Bt:Gn(s),tooltip:"当前模型冻结到新 Turn 的最大输出 Token;历史 Turn 使用各自快照"}),h.jsx(ws,{icon:h.jsx($v,{className:Me("size-3",l&&"animate-pulse motion-reduce:animate-none text-[var(--accent-soft)]")}),testId:"metric-llm-time",compact:!0,label:"LLM",value:_?Io(_.llmDurationMs):l?"计时中":Bt,compactValue:_?FY(_.llmDurationMs):l?"计时中":Bt,tooltip:"本会话全部 Provider 请求的累计耗时,包含连接重试和当前活动请求"}),h.jsx(ws,{icon:h.jsx(DT,{className:"size-3"}),testId:"metric-output-speed",compact:!0,label:"均速",value:_?.outputTokensPerSecond===void 0&&S&&f?"统计中":sb(_?.outputTokensPerSecond),tooltip:"已完成调用的平均生成速度(含思考 Token),不是当前实时速度。当前调用结束并返回 Token 统计后更新;首次统计前显示“统计中”",..._?.outputTokensPerSecond!==void 0&&_.outputTokensPerSecond>=1e4?{compactValue:`${cc(_.outputTokensPerSecond)} tok/s`}:{}}),h.jsx(ws,{icon:h.jsx($T,{className:"size-3"}),testId:"metric-cache-rate",compact:!0,label:"缓存",value:LE(_),tooltip:q}),h.jsx(ws,{icon:h.jsxs(h.Fragment,{children:[h.jsx(zv,{className:"size-3"}),h.jsx(Rd,{className:"-ml-1 size-3"})]}),testId:"metric-token-io",compact:!0,label:"输入/输出",value:R,compactValue:K,tooltip:"本会话累计输入 / 输出 Token;思考 Token 已包含在输出中"}),h.jsxs("span",{className:"metric-details absolute right-2 flex shrink-0 items-center gap-1 whitespace-nowrap px-1 text-[var(--dim-fg)]",children:[l&&h.jsx("span",{"aria-hidden":"true",className:"size-1.5 animate-pulse rounded-full bg-[var(--accent)] motion-reduce:animate-none"}),h.jsx("span",{className:"hidden min-[760px]:inline",children:l?"采集中":"详情"})]})]}),h.jsx(Tr,{open:m,onOpenChange:g,title:"性能指标",description:"由本地 Host 根据 Provider 事件计算。私有思考内容不会进入指标,思考 Token 已包含在输出 Token 中。",children:h.jsxs("div",{className:"max-h-[min(66vh,640px)] space-y-5 overflow-y-auto pr-1",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[h.jsx(wo,{icon:h.jsx(Kw,{className:"size-3"}),label:"当前上下文",value:M}),h.jsx(wo,{icon:h.jsx(Rd,{className:"size-3"}),label:"输出上限",value:s===void 0?Bt:Gn(s)})]}),h.jsxs("section",{"aria-labelledby":"latest-turn-metrics-heading",children:[h.jsx("h3",{id:"latest-turn-metrics-heading",className:"mb-2 type-ui font-medium text-[var(--fg)]",children:"最近任务"}),h.jsx(pI,{metrics:x,emptyLabel:"暂无最近任务指标"})]}),h.jsxs("section",{"aria-labelledby":"thread-total-metrics-heading",children:[h.jsx("h3",{id:"thread-total-metrics-heading",className:"mb-2 type-ui font-medium text-[var(--fg)]",children:"本会话累计"}),h.jsx(pI,{metrics:y,emptyLabel:"暂无会话累计指标"})]}),h.jsxs("section",{"aria-labelledby":"provider-request-metrics-heading",children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[h.jsx("h3",{id:"provider-request-metrics-heading",className:"type-ui font-medium text-[var(--fg)]",children:"逐次模型调用"}),h.jsxs("span",{className:"type-meta tabular-nums text-[var(--dim-fg)]",children:[w.length," 次"]})]}),h.jsx(QY,{requests:w})]})]})})]})}function YY({visible:e,fullAccessConfirmOpen:t,setFullAccessConfirmOpen:n,approvalPending:r,updateApprovalMode:o,preparationInspection:s,modePreparing:l,cancelPreparation:u,confirmPreparation:f}){const p=s?.runtime!==void 0;return h.jsxs(h.Fragment,{children:[h.jsx(Tr,{open:e&&t,onOpenChange:n,title:"为当前会话开启 Full access?",description:"开启后,此会话后续新产生的 Agent 工具审批会被自动允许;其他会话不会继承。",footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",onClick:()=>n(!1),children:"取消"}),h.jsx(Je,{variant:"warning",disabled:r,onClick:()=>o("full-access"),children:"确认开启"})]}),children:h.jsxs("div",{className:"space-y-3 type-ui text-[var(--subtle-fg)]",children:[h.jsx(On,{role:"note",tone:"warning",icon:h.jsx(Mi,{className:"size-4"}),children:"PowerShell 并不是文件系统沙箱,命令仍拥有当前 Windows 用户的权限。"}),h.jsxs("ul",{className:"list-disc space-y-1.5 pl-5 text-[var(--muted-fg)]",children:[h.jsx("li",{children:"文件写入、PowerShell、移入回收站,以及已授权插件的网络或高风险工具将自动允许。"}),h.jsx("li",{children:"开启前已经等待审批的卡片仍需手动处理。"}),h.jsx("li",{children:"路径守卫、文件哈希冲突、命令超时、插件既有权限及“无永久删除工具”等硬边界保持不变。"}),h.jsx("li",{children:"该模式会随当前会话保存,直到你手动关闭。"})]})]})}),h.jsx(Tr,{open:e&&s!==null,onOpenChange:m=>{m||u()},closeDisabled:l,title:p?"初始化快速前台应用?":"准备快速前台环境?",description:p?"当前目录还没有 Runtime 2.0 应用。确认后,Host 只会初始化业务源码并绑定共享运行时,再发送这条消息。":"当前项目还不能直接执行快速前台任务。确认后,Host 会先完成受控准备,再发送这条消息。",footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",disabled:l,onClick:u,children:"取消"}),h.jsxs(Je,{disabled:l,onClick:f,children:[l&&h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}),l?p?"正在初始化…":"正在准备…":p?"初始化并发送":"准备并发送"]})]}),children:s&&h.jsxs("div",{className:"space-y-3 type-ui text-[var(--subtle-fg)]",children:[s.reason&&h.jsx(On,{tone:"info",children:s.reason}),h.jsxs("dl",{className:"grid grid-cols-[88px_minmax(0,1fr)] gap-x-3 gap-y-2 rounded-xl border border-[var(--border)] bg-[var(--inset)] p-3",children:[h.jsx("dt",{className:"text-[var(--muted-fg)]",children:"目标目录"}),h.jsx("dd",{className:"break-all font-mono type-meta text-[var(--fg)]",children:s.targetPath||"."}),s.template&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{className:"text-[var(--muted-fg)]",children:"项目模板"}),h.jsxs("dd",{className:"break-all font-mono type-meta text-[var(--fg)]",children:[s.template.templateId,"@",s.template.version]})]}),s.runtime&&h.jsxs(h.Fragment,{children:[h.jsx("dt",{className:"text-[var(--muted-fg)]",children:"共享运行时"}),h.jsxs("dd",{className:"break-all font-mono type-meta text-[var(--fg)]",children:[s.runtime.runtimeId,"@",s.runtime.version,h.jsxs("span",{className:"ml-1 text-[var(--muted-fg)]",children:["ABI ",s.runtime.abiVersion]})]})]}),h.jsx("dt",{className:"text-[var(--muted-fg)]",children:"准备内容"}),h.jsx("dd",{className:"text-[var(--fg)]",children:s.runtime?[s.createsTemplate?"初始化业务源码":"复用业务源码","绑定只读共享 Runtime","无需安装依赖"].join(" · "):[s.createsTemplate?"创建模板文件":"复用现有文件",s.installRequired?"安装锁定依赖":"无需安装依赖"].join(" · ")})]}),s.installRequired&&!s.runtime&&h.jsxs(On,{role:"note",tone:"warning",icon:h.jsx(Mi,{className:"size-4"}),children:["Host 将执行 ",h.jsx("code",{className:"rounded bg-black/10 px-1 font-mono type-meta",children:"pnpm install --frozen-lockfile --prefer-offline --ignore-scripts"}),";不会执行项目生命周期脚本,但本地缓存未命中时仍可能访问软件源。"]}),s.runtime&&h.jsxs(On,{role:"note",tone:"info",children:["框架、React 与 Ant Design 由 Harness 的版本化 Runtime 提供;不会复制框架源码、创建 ",h.jsx("code",{className:"rounded bg-black/10 px-1 font-mono type-meta",children:"node_modules"}),"、运行包管理器或项目脚本。"]}),h.jsx("p",{className:"type-meta leading-5 text-[var(--muted-fg)]",children:"取消或准备失败都不会创建 Turn,当前草稿和附件会原样保留。"})]})})]})}const WY={off:"关闭思考",minimal:"最少",low:"低",medium:"中等",high:"高",xhigh:"超高",max:"最大"},XY={openai:"OpenAI",anthropic:"Anthropic",gemini:"Gemini","openai-compatible":"OpenAI 兼容"};function JY(e,t){if(!e)return;const n=e.providerProfileId?t.find(s=>s.id===e.providerProfileId):void 0,r=n?.name??(e.providerKind?XY[e.providerKind]:void 0)??e.providerProfileId,o=e.model??n?.model;return r&&o?`${r} · ${o}`:r??o}function hI(e,t){const n=t?e.turns?.find(s=>s.id===t):e.turns?.at(-1),r=t??n?.id,o=[...e.items].reverse().find(s=>s.type==="error"&&(!r||s.turnId===r));return o?.type==="error"?o.recoverable:n?.error?.retryable??!0}function Pr(e){return e?.status==="running"||e?.activeTurnStatus==="queued"||e?.activeTurnStatus==="running"||e?.activeTurnStatus==="waiting-approval"}function eW(e){return!e||!/^(?:[a-zA-Z]:[\\/]|\\\\)/u.test(e)}function tW(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function nW({pendingAttachments:e,locked:t,retryAttachment:n,removeAttachment:r}){return h.jsx(h.Fragment,{children:e.length>0&&h.jsx("div",{className:"flex flex-wrap gap-2 border-b border-[var(--border)] px-3 py-2",children:e.map(o=>h.jsxs("div",{role:"group","aria-label":`待发送附件 ${o.name}`,className:"group/attachment relative flex min-w-0 max-w-[240px] items-center gap-2 rounded-lg border border-[var(--border)] bg-[var(--control)] p-1.5 pr-7",children:[o.kind==="image"?o.previewUrl?h.jsx("img",{src:o.previewUrl,alt:"",className:"size-10 shrink-0 rounded-md object-cover"}):h.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-[var(--inset)]",children:h.jsx(Tc,{className:"size-4"})}):h.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-[var(--inset)] text-[var(--accent-soft)]",children:o.kind==="document"?h.jsx(VT,{className:"size-4"}):h.jsx(Uc,{className:"size-4"})}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("p",{className:"truncate type-meta text-[var(--subtle-fg)]",children:o.name}),h.jsx("p",{className:Me("mt-0.5 truncate type-meta text-[var(--dim-fg)]",o.status==="failed"&&"text-[var(--status-danger-fg)]"),title:o.error,children:o.status==="uploading"?`正在上传 ${o.progress??0}%`:o.status==="processing"?"正在解析文档…":o.status==="failed"?o.error??"上传失败":o.attachment?.kind==="document"?`${o.attachment.pageCount!==void 0?`${o.attachment.pageCount} 页`:o.attachment.sheetCount!==void 0?`${o.attachment.sheetCount} 个工作表`:o.attachment.format.toUpperCase()} · ${o.attachment.visualCount} 个视觉内容${o.attachment.textTruncated||o.attachment.visualsTruncated?" · 已截断":""}`:tW(o.size)}),(o.status==="uploading"||o.status==="processing")&&h.jsx("span",{role:"progressbar","aria-label":o.status==="processing"?`正在解析 ${o.name}`:`正在上传 ${o.name}`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o.status==="processing"?void 0:o.progress??0,className:"mt-1 block h-0.5 overflow-hidden rounded-full bg-[var(--inset)]",children:h.jsx("span",{className:Me("block h-full rounded-full bg-[var(--accent)] transition-[width]",o.status==="processing"&&"w-1/2 animate-pulse"),style:o.status==="uploading"?{width:`${o.progress??0}%`}:void 0})}),o.status==="failed"&&h.jsx("button",{type:"button",disabled:t,onClick:()=>{n(o)},className:"type-meta text-[var(--accent-soft)] hover:underline disabled:cursor-not-allowed disabled:text-[var(--disabled-fg)]",children:"重试上传"})]}),(o.status==="uploading"||o.status==="processing")&&h.jsx(Ot,{"aria-label":o.status==="processing"?"正在解析附件":"正在上传附件",className:"absolute right-2 top-2 size-3 animate-spin text-[var(--accent-soft)] motion-reduce:animate-none"}),h.jsx("button",{type:"button","aria-label":`移除 ${o.name}`,disabled:t||o.status==="uploading"||o.status==="processing",onClick:()=>r(o),className:"absolute right-1.5 top-1.5 rounded p-0.5 text-[var(--dim-fg)] hover:bg-[var(--hover)] hover:text-[var(--fg)] disabled:cursor-not-allowed disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",children:h.jsx(ei,{className:"size-3"})})]},o.localId))})})}class rW{constructor(t){this.deps=t}deps;#e=null;#t={phase:"idle",inspection:null};#n=!1;async check(t,n){if(this.#n||this.#e){this.deps.release(t);return}if(t.mode.conversationMode==="document"||n.managedProject||!n.frontendEnabled){this.deps.submit(t);return}this.#e=t,this.#s({phase:"checking",inspection:null});try{const r=await this.deps.inspect(t.projectId);if(!this.#r(t))return;if(r.projectId!==t.projectId||!this.#i(t)){this.#a("快速前台检查已失效","当前项目已经切换,请重新发送。","neutral");return}if(r.state==="blocked"){this.#a("快速前台暂时不可用",r.reason??"当前项目无法进入快速前台模式。");return}if(r.mode?.pluginId!==Ns.pluginId||r.mode.modeId!==Ns.modeId||r.state==="disabled"){this.#a("快速前台模式已变化","全局快速前台模式已被关闭或切换,草稿已保留,请确认当前模式后重新发送。","neutral");return}if(r.state==="requires_preparation"){if(!r.planId){this.#a("快速前台准备信息无效","Host 没有返回可确认的准备计划。");return}this.#s({phase:"confirming",inspection:r});return}if(r.state!=="ready"){this.#a("快速前台检查未就绪","草稿已保留,请稍后重新发送。","neutral");return}this.#o(t,r)}catch(r){this.#r(t)&&this.#a("快速前台检查失败",r instanceof Error?r.message:"Host 返回未知错误")}}async confirm(){const t=this.#e,n=this.#t.inspection;if(!(!t||!n?.planId||this.#t.phase!=="confirming"||!this.#r(t))){if(!this.#i(t)){this.#a("快速前台检查已失效","当前项目已经切换,请重新发送。","neutral");return}this.#s({phase:"preparing",inspection:n});try{const r=await this.deps.prepare(n.projectId,n.planId);if(!r.prepared)throw new Error("Host 未能完成快速前台准备");if(!this.#r(t))return;if(r.projectId!==n.projectId||!this.#i(t)){this.#a("快速前台准备已完成","当前项目已经切换,草稿未发送。","neutral");return}r.previewSession&&this.deps.preview(r.projectId,r.previewSession),this.#o(t,n)}catch(r){this.#r(t)&&this.#a("快速前台准备失败",r instanceof Error?r.message:"Host 返回未知错误")}}}cancel(){this.#t.phase!=="preparing"&&this.reset()}reset(){this.#e&&this.deps.release(this.#e),this.#e=null,this.#s({phase:"idle",inspection:null}),this.#n||this.deps.released()}dispose(){this.#n=!0,this.reset()}#r(t){return this.#n||this.#e!==t?!1:this.deps.currentTarget().sessionId!==t.hostSessionId?(this.reset(),!1):!0}#i(t){const n=this.deps.currentTarget();return n.projectId===t.projectId&&n.threadId===t.threadId&&n.navigationIntentId===t.navigationIntentId}#o(t,n){this.#e=null,this.#s({phase:"idle",inspection:null}),this.deps.submit({...t,assistantModeExpectation:{binding:Ns,settingsRevision:n.settingsRevision}})}#s(t){this.#t=t,this.#n||this.deps.changed(t)}#a(t,n,r="danger"){this.reset(),this.deps.notice({title:t,description:n,tone:r})}}const qs=new Map;function iW(e){if(qs.has(e.submissionId)||Qf(e.sourceKey)||!$H(e.sourceKey,e.submissionId))return!1;const t=e.documentAnnotationReferences??ka(e.sourceKey).documentAnnotationReferences,n={...e,mode:structuredClone(e.mode),references:structuredClone(e.references),...t?.length?{documentAnnotationReferences:structuredClone(t)}:{},attachmentOrder:[...e.attachmentOrder],files:e.files.map(r=>({...r,...r.attachment?{attachment:structuredClone(r.attachment)}:{}})),...e.assistantModeExpectation?{assistantModeExpectation:structuredClone(e.assistantModeExpectation)}:{}};return qs.set(e.submissionId,{snapshot:n,workingKey:e.sourceKey,threadId:e.threadId}),!0}function oW(e){const t=qs.get(e.submissionId);!t||t.promise||(Zg(t.workingKey,e.submissionId),qs.delete(e.submissionId))}function Ss(e){const t=D.getState();if(t.hostSessionId!==e.hostSessionId||t.connectionStatus!=="online")throw new Error("Host 连接已更换或断开,草稿已保留。请确认对话后重新发送。")}function qE(e,t){const n=D.getState();return n.hostSessionId===e.hostSessionId&&n.activeProjectId===e.projectId&&n.activeThreadId===t&&n.navigationIntentId===e.navigationIntentId}function aW(e){const t=qs.get(e.submissionId);if(!t)return Promise.resolve();if(t.promise)return t.promise;const n={...t.snapshot,...e.assistantModeExpectation?{assistantModeExpectation:structuredClone(e.assistantModeExpectation)}:{}};return t.promise=sW(t,n).catch(r=>{D.getState().pushToast({title:"消息没有发送",description:r instanceof Error?r.message:"Host 返回未知错误",tone:"danger"})}).finally(()=>{Zg(t.workingKey,e.submissionId),Zg(e.sourceKey,e.submissionId),qs.delete(e.submissionId),qE(e,t.threadId)&&window.dispatchEvent(new CustomEvent("harness:focus-composer"))}),t.promise}async function sW(e,t){if(Ss(t),!t.projectId||!t.providerProfileId||!t.model)throw new Error("请选择应用和可用模型。");if(!D.getState().supportsDocumentAnnotations&&t.mode.conversationMode==="document"&&t.mode.documentModeConfig.referenceCode)throw new Error("当前 Host 不支持文档模式参考代码,请升级后重试;草稿已保留。");if(t.documentAnnotationReferences?.length){if(!D.getState().supportsDocumentAnnotations)throw new Error("当前 Host 不支持文档批注,请升级后重试;草稿已保留。");if(t.mode.conversationMode!=="document")throw new Error("文档批注只能在文档模式发送,请先切换模式;草稿已保留。");if(t.documentAnnotationReferences.length>8||t.documentAnnotationReferences.some(m=>!t.references.some(g=>g.projectId===t.projectId&&g.path===m.path&&g.hash===m.hash&&g.startLine===m.startLine&&g.endLine===m.endLine&&g.snapshot!==void 0&&g.snapshot.length<=16e3&&!g.truncated)))throw new Error("文档批注与草稿中的文件引用不一致,请重新转交;草稿已保留。")}if(t.files.some(m=>m.kind==="image")&&!t.supportsImages)throw new Error("当前模型不支持图片输入。");let n=t.threadId,r=t.mode.revision;if(!n){const m=C2(t.mode,D.getState().supportsDocumentAnnotations),g=await He.call("thread.create",{projectId:t.projectId,...t.explicitMode?{mode:{conversationMode:m.conversationMode,documentModeConfig:m.documentModeConfig}}:{}});Ss(t);const x=Rr(g.thread);if(x.projectId!==t.projectId)throw new Error("Host 返回了其他应用的对话。");r=x.mode?.revision??0,n=x.id,e.threadId=n,e.workingKey=Sa(n,t.projectId),ZH(t.sourceKey,e.workingKey);const y=qE(t,null);if(D.getState().upsertThread(x,{select:!1}),y&&D.getState().selectThread(n),t.requestedFullAccess){const w=await He.call("approval.mode.set",{threadId:n,mode:"full-access"});if(Ss(t),w.thread.id!==n||w.thread.projectId!==t.projectId)throw new Error("Host 返回了其他对话的权限设置,草稿已保留。");const S=D.getState().threadDetailsById[n]??x;D.getState().upsertThread({...S,approvalMode:w.thread.approvalMode??"prompt",...w.thread.approvalModeChangedAt?{approvalModeChangedAt:w.thread.approvalModeChangedAt}:{},updatedAt:w.thread.updatedAt},{select:!1})}}const o=n,s=e.workingKey,l=await r7(t.files,2,async m=>{if(Ss(t),m.attachment)return{localId:m.localId,attachment:m.attachment};Ai(s,m.localId,{status:"uploading",progress:0,error:void 0});try{const g=await pC(o,m,x=>Ai(s,m.localId,{progress:x}),()=>Ai(s,m.localId,{status:"processing",progress:100}));return Ss(t),fC(s,m.localId,o,g),{localId:m.localId,attachment:g}}catch(g){throw Ai(s,m.localId,{status:"failed",progress:0,error:g instanceof Error?g.message:"附件上传失败"}),g}});if(l.some(m=>m.attachment.kind==="image")&&!t.supportsImages)throw new Error("Host 将附件识别为图片,但当前模型不支持图片输入。附件和文字已保留,请切换到可看图模型。");const u=new Map;for(const m of t.references){if(m.projectId!==t.projectId||!m.hash)throw new Error(`文件引用缺少当前应用的可复现快照:${m.path}`);u.set(`workspace:${m.path}:${m.startLine??0}:${m.endLine??0}`,{kind:"workspace-file",projectId:m.projectId,path:m.path,hash:m.hash,truncated:m.truncated??!1,...m.startLine!==void 0?{startLine:m.startLine}:{},...m.endLine!==void 0?{endLine:m.endLine}:{},...m.snapshot!==void 0?{snapshot:m.snapshot}:{}})}for(const m of l)u.set(`binary:${m.localId}`,m.attachment);const f=t.attachmentOrder.flatMap(m=>{const g=u.get(m);return u.delete(m),g?[g]:[]});f.push(...u.values()),Ss(t);const p=await He.call("turn.start",{threadId:o,input:t.content,conversationModeRevision:r,attachments:f,providerProfileId:t.providerProfileId,model:t.model,reasoningEffort:t.reasoningEffort,...t.documentAnnotationReferences?.length?{documentAnnotationReferences:t.documentAnnotationReferences}:{},...t.assistantModeExpectation?{assistantModeExpectation:t.assistantModeExpectation}:{}});if(D.getState().hostSessionId!==t.hostSessionId)throw new Error("Host 连接已更换,草稿已保留,请核对原对话。");if(!p.turn||p.turn.threadId!==o)throw new Error("Host 返回的消息回执不属于原对话,草稿已保留,请核对原对话后重试。");KH(s);for(const m of p.warnings??[])D.getState().pushToast({title:"已发送,但有一项提示",description:m.message,tone:"neutral"})}function lW(e,t,n,r){const o=D(y=>y.pushToast),s=D(y=>y.setPreviewSession),[l,u]=I.useState({phase:"idle",inspection:null}),f=l.inspection,p=l.phase==="checking",m=l.phase==="preparing",g=I.useRef(null),x=I.useRef({activeProjectId:e,activeThreadId:t,focusComposer:r});return x.current={activeProjectId:e,activeThreadId:t,focusComposer:r},I.useEffect(()=>{const y=new rW({inspect:w=>Sr.inspect(w),prepare:(w,S)=>Sr.prepare(w,S),currentTarget:()=>({projectId:x.current.activeProjectId,threadId:x.current.activeThreadId,sessionId:D.getState().hostSessionId,navigationIntentId:D.getState().navigationIntentId}),release:oW,submit:w=>{aW(w)},preview:(w,S)=>s(w,S,S.revision),notice:o,changed:u,released:()=>x.current.focusComposer()});return g.current=y,()=>{y.dispose(),g.current=null}},[o,s]),I.useEffect(()=>{g.current?.reset()},[n]),{preparationController:g,preparationInspection:f,modeInspecting:p,modePreparing:m}}function mI(e,t){return{threadId:e,projectId:t,hostSessionId:D.getState().hostSessionId}}function Nd(e){return D.getState().hostSessionId===e.hostSessionId}function cW(e,t,n,r){const o=D(C=>C.upsertThread),s=D(C=>C.pushToast),l=D(C=>C.setActiveModel),u=D(C=>C.setReasoning),f=D(C=>C.providers),p=D(C=>C.modelsByProviderId),m=D(C=>C.reasoning),[g,x]=I.useState(null),y=vn({mutationFn:({threadId:C,mode:E})=>He.call("thread.mode.update",{threadId:C,mode:{conversationMode:E.conversationMode,documentModeConfig:E.documentModeConfig},expectedRevision:E.revision}),onSuccess:(C,E)=>{if(!Nd(E)||C.thread.id!==E.threadId||C.thread.projectId!==E.projectId)return;const O=D.getState(),M=O.threadDetailsById[C.thread.id]??O.threads.find(R=>R.id===C.thread.id);o(M?{...M,mode:fc(C.thread.mode)}:Rr(C.thread),{select:!1})},onError:(C,E)=>{Nd(E)&&s({title:"对话模式未保存",description:C instanceof Error?C.message:"Host 返回未知错误",tone:"danger"})}}),w=C=>{e?y.mutate({...mI(e.id,t),mode:C}):qH(n,C)};I.useEffect(()=>{if(!r)return;const C=e?.preferences;if(!C){x(null);return}const E={providerProfileId:C.providerProfileId,model:C.model,reasoningEffort:C.reasoningEffort};x(E),D.getState().providers.some(O=>O.id===E.providerProfileId&&O.enabled)&&(l(E.providerProfileId,E.model),u(E.reasoningEffort))},[t,l,u,e?.id,e?.preferences?.updatedAt,r]);const S=vn({mutationFn:({threadId:C,next:E})=>He.call("thread.preferences.update",{threadId:C,preferences:E}),onSuccess:(C,E)=>{!Nd(E)||C.thread.id!==E.threadId||C.thread.projectId!==E.projectId||o(Rr(C.thread),{select:!1})},onError:(C,E)=>{Nd(E)&&(D.getState().activeThreadId===E.threadId&&(x(E.previous),E.previous&&(l(E.previous.providerProfileId,E.previous.model),u(E.previous.reasoningEffort))),s({title:"对话模型设置未保存",description:C instanceof Error?C.message:"Host 返回未知错误",tone:"danger"}))}}),T=C=>{const E=g;x(C),l(C.providerProfileId,C.model),u(C.reasoningEffort),e&&S.mutate({...mI(e.id,t),next:C,previous:E})};return{preferenceDraft:g,preferences:S,selectModel:(C,E)=>{const O=f.find(q=>q.id===C),M=p[C]?.find(q=>q.id===E);if(!O||!Ps(O)||!M||!_c(M))return;const R=M.capabilities.reasoningLevels.length>0?M.capabilities.reasoningLevels:O.reasoningLevels,z=g?.reasoningEffort??m,K=R.includes(z)?z:R.includes(O.reasoningEffort)?O.reasoningEffort:R.includes("medium")?"medium":R[0]??"off";T({providerProfileId:C,model:E,reasoningEffort:K})},selectReasoning:C=>{const E=D.getState(),O=g?.providerProfileId??E.activeProviderId,M=f.find(K=>K.id===O&&Ps(K)),R=g?.model??(M?E.activeModelByProviderId[M.id]??M.defaultModelId??M.model:void 0),z=M?(p[M.id]??[ol(M)]).find(K=>K.id===R&&_c(K)):void 0;!M||!z||T({providerProfileId:M.id,model:z.id,reasoningEffort:C})},modeSettings:y,saveMode:w}}function uW(e){const{activeProjectId:t,activeThreadId:n,draftKey:r,draft:o,draftLocked:s,visible:l,initialDraft:u}=e,[f,p]=I.useState(!1),m=I.useRef(null),g=I.useRef(!1),x=D(S=>S.pushToast),y=()=>{window.setTimeout(()=>{const S=D.getState();l&&S.activeProjectId===t&&S.activeThreadId===n&&m.current?.focus({preventScroll:!0})},0)};I.useEffect(()=>{if(!l)return;const S=()=>y();return window.addEventListener("harness:focus-composer",S),()=>window.removeEventListener("harness:focus-composer",S)},[t,n,l]),I.useEffect(()=>{g.current||(g.current=!0,u&&o.length===0&&Kg(r,u))},[o.length,r,u]),I.useEffect(()=>{w(),!s&&!o&&p(!1)},[o,s]),I.useEffect(()=>{if(!l)return;const S=T=>{if(!(T.detail.threadId&&T.detail.threadId!==n)){try{const k=T.detail.attachments??[];GH(r,T.detail.threadId??n??"",k,T.detail.documentAnnotationReferences),Kg(r,T.detail.content)}catch(k){x({title:"无法编辑重发",description:k instanceof Error?k.message:"历史附件无法恢复,当前草稿未更改。",tone:"danger"});return}p(T.detail.editing===!0),y()}};return window.addEventListener("harness:edit-message",S),()=>window.removeEventListener("harness:edit-message",S)},[n,r,l,x]);const w=()=>{const S=m.current;S&&(S.style.height="40px",S.style.height=`${Math.min(150,S.scrollHeight)}px`)};return{editing:f,setEditing:p,textareaRef:m,focusComposer:y,resizeTextarea:w}}function dW(e,t,n,r){return{addFiles:async u=>{try{const f=await BH(e,u);for(const p of f)n({title:"无法添加附件",description:p,tone:"neutral"});r()}catch(f){n({title:"无法添加附件",description:f instanceof Error?f.message:"读取本地附件失败。",tone:"neutral"})}},removeAttachment:u=>{const f=VH(e,u.localId);f?.attachment&&t&&n7(t,f.attachment.artifactId).catch(()=>{})},retryAttachment:async u=>{if(!t){Ai(e,u.localId,{status:"local",progress:0,error:void 0});return}Ai(e,u.localId,{status:"uploading",progress:0,error:void 0});try{const f=await pC(t,u,p=>Ai(e,u.localId,{progress:p}),()=>Ai(e,u.localId,{status:"processing",progress:100}));fC(e,u.localId,t,f)}catch(f){const p=f instanceof Error?f.message:"附件上传失败";Ai(e,u.localId,{status:"failed",progress:0,error:p}),n({title:"附件仍未上传",description:p,tone:"danger"})}}}}const fW={text:"",attachments:[],references:[],order:[]};function pW(e){return I.useSyncExternalStore(Ly,()=>ka(e),()=>fW)}function hW(e){return I.useSyncExternalStore(Ly,()=>zy(e),()=>!1)}function mW(e){return I.useSyncExternalStore(Ly,()=>Qf(e),()=>!1)}async function cb(e,t,n){const r=[];let o,s;for(let l=0;l<20;l+=1){const u={...t,...o?{cursor:o}:{}},f=await He.call(e,u);if(r.push(...f.models.map(p=>f2(p,n))),s??=f.discoveryId,o=f.nextCursor,!o)return{models:r,...s?{discoveryId:s}:{}}}throw new Error("模型目录分页超过 10,000 条,已停止加载")}function uv(e,t){return cb("provider.models.list",{profileId:e,limit:500,includeDisabled:!0,includeStale:!0,...t?.trim()?{query:t.trim()}:{}},e).then(n=>n.models)}function EX(e,t){return cb("provider.models.discover",{...e,limit:500},t)}function _X(e){return cb("provider.models.refresh",{profileId:e,limit:500},e).then(t=>t.models)}function gW(e){const t=e?.reasoningLevels??[],n=t.includes("medium")?"medium":t[0]??"off";return{type:e?.type??"openai",preset:e?.id??"openai",name:e?.name??"OpenAI",model:e?.defaultModel??"",baseUrl:e?.defaultBaseUrl??"",apiKey:"",reasoningEffort:n,...e?.maxOutputTokens!==void 0?{maxOutputTokens:e.maxOutputTokens}:{},...e?.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},imageInputMode:e?.imageInputMode??"auto",reasoningContinuationMode:e?.reasoningContinuationMode??"auto",enabled:!0,authMode:e?.authMode??"required",keySource:"none",...e?.environmentVariables[0]?{environmentVariable:e.environmentVariables[0]}:{}}}function AX(e){return{id:e.id,type:e.type,preset:e.preset,name:e.name,model:e.model,baseUrl:e.baseUrl??"",apiKey:"",reasoningEffort:e.reasoningEffort,maxOutputTokens:e.maxOutputTokens,...e.contextWindow!==void 0?{contextWindow:e.contextWindow}:{},imageInputMode:e.imageInputMode??"auto",reasoningContinuationMode:e.reasoningContinuationMode??"auto",enabled:e.enabled,authMode:e.authMode,keySource:e.keySource,...e.environmentVariable?{environmentVariable:e.environmentVariable}:{}}}function MX(e){return e==="openai-compatible"?"custom":e}function NX(e){const t=gW(e);return{type:t.type,preset:t.preset,name:t.name,model:t.model,baseUrl:t.baseUrl,reasoningEffort:t.reasoningEffort,...t.maxOutputTokens!==void 0?{maxOutputTokens:t.maxOutputTokens}:{},...t.contextWindow!==void 0?{contextWindow:t.contextWindow}:{},authMode:t.authMode,imageInputMode:t.imageInputMode,reasoningContinuationMode:t.reasoningContinuationMode,...t.environmentVariable?{environmentVariable:t.environmentVariable}:{}}}function vW(e,t){return e==="credential"?{label:"已配置 · Windows 凭据",description:"密钥保存在 Windows Credential Manager 中",tone:"success"}:e==="environment"?{label:"已配置 · 环境变量",description:"密钥由 Host 进程的环境变量提供",tone:"success"}:t==="none"?{label:"无需密钥",description:"此 Provider 声明为无需鉴权",tone:"neutral"}:t==="optional"?{label:"密钥可选",description:"此 Provider 可以在没有密钥时使用",tone:"neutral"}:{label:"未配置密钥",description:"当前没有 Credential Manager 或环境变量密钥",tone:"warning"}}function PX(e,t=!1){if(e.maxOutputTokens===void 0)throw new Error("默认模型缺少最大输出限制");const n={name:e.name.trim(),kind:e.type,preset:e.preset,model:e.model.trim(),reasoningEffort:e.reasoningEffort,maxOutputTokens:e.maxOutputTokens,authMode:e.authMode,enabled:e.enabled,imageInputMode:e.imageInputMode,reasoningContinuationMode:e.reasoningContinuationMode,confirmStoredCredential:t};return e.contextWindow!==void 0&&(n.contextWindow=e.contextWindow),e.id&&(n.id=e.id),e.baseUrl.trim()&&(n.baseUrl=e.baseUrl.trim()),e.apiKey&&(n.apiKey=e.apiKey),e.environmentVariable&&(n.environmentVariable=e.environmentVariable),n}function yW({provider:e,model:t,disabled:n,onSelect:r,unavailableLabel:o}){const[s,l]=I.useState(!1),[u,f]=I.useState(""),[p,m]=I.useState(!1),g=I.useRef(new Set),x=D(R=>R.providers),y=D(R=>R.modelsByProviderId),w=D(R=>R.activeModelByProviderId),S=D(R=>R.setProviderModels),T=D(R=>R.setActiveModel),k=D(R=>R.pushToast),_=x.some(Ps),C=!!(n||!_),E=I.useMemo(()=>{const R=u.trim().toLocaleLowerCase("zh-CN");return w2(x).filter(Ps).flatMap(z=>{const K=x2(z,y[z.id]??[]).filter(_c).filter(q=>!R||z.name.toLocaleLowerCase("zh-CN").includes(R)||q.displayName.toLocaleLowerCase("zh-CN").includes(R)||q.id.toLocaleLowerCase("zh-CN").includes(R));return K.length>0?[{provider:z,models:K}]:[]})},[y,x,u]),O=async()=>{const R=x.filter(q=>Ps(q)&&!g.current.has(q.id));if(R.length===0)return;m(!0);const z=await Promise.allSettled(R.map(async q=>{const Z=await uv(q.id);g.current.add(q.id),S(q.id,Z)}));m(!1);const K=z.filter(q=>q.status==="rejected").length;K>0&&k({title:"部分模型目录未能加载",description:`${K} 个 Provider 暂时不可用;已有模型仍可选择。`,tone:"neutral"})},M=R=>{l(R),R?O():f("")};return h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",role:"combobox","aria-label":"模型 Provider","aria-haspopup":"dialog","aria-expanded":s,disabled:C,onClick:()=>M(!0),className:"inline-flex h-7 min-w-0 max-w-[360px] items-center gap-1.5 rounded-lg px-2 type-ui text-[var(--fg)] outline-none hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/55 disabled:cursor-not-allowed disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",children:[h.jsx("span",{className:"truncate",children:o??(e?`${e.name} · ${t?.displayName??w[e.id]??"加载目录…"}`:"尚未配置可用模型")}),rf(t,e)&&h.jsx(Tc,{"aria-label":"支持图片",className:Me("size-3 shrink-0 text-[var(--accent-soft)]",C&&"text-[var(--disabled-fg)]")}),h.jsx(Gs,{className:Me("size-3.5 shrink-0 text-[var(--muted-fg)]",C&&"text-[var(--disabled-fg)]")})]}),h.jsxs(Tr,{open:s,onOpenChange:M,title:"选择模型",description:"模型按 Provider 分组;同名模型使用 Provider 与模型 ID 的复合身份。",contentClassName:"w-[min(620px,calc(100vw-32px))]",children:[h.jsxs("div",{className:"relative mb-3",children:[h.jsx(Tf,{className:"pointer-events-none absolute left-3 top-2.5 size-3.5 text-[var(--dim-fg)]"}),h.jsx("input",{autoFocus:!0,"aria-label":"搜索模型",value:u,onChange:R=>f(R.target.value),placeholder:"搜索 Provider、名称或模型 ID",className:"h-9 w-full rounded-lg border border-[var(--control-border)] bg-[var(--control)] pl-9 pr-3 type-ui outline-none focus:border-[var(--accent)]/50"})]}),h.jsxs("div",{role:"listbox","aria-label":"可用模型",className:"max-h-[min(55vh,480px)] space-y-3 overflow-y-auto pr-1",children:[E.map(R=>{const z=vW(R.provider.keySource,R.provider.authMode);return h.jsxs("section",{"aria-label":R.provider.name,children:[h.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 bg-[var(--panel-solid)] px-1 py-1.5",children:[h.jsx("h3",{className:"type-meta font-medium text-[var(--muted-fg)]",children:R.provider.name}),h.jsx("span",{className:Me("ml-auto type-meta",z.tone==="warning"?"text-[var(--status-warning-fg)]":z.tone==="success"?"text-[var(--status-success-fg)]":"text-[var(--dim-fg)]"),children:z.label})]}),h.jsx("div",{className:"space-y-1",children:R.models.map(K=>{const q=K.providerId===e?.id&&K.id===t?.id;return h.jsxs("button",{type:"button",role:"option","aria-selected":q,onClick:()=>{r?r(K.providerId,K.id):T(K.providerId,K.id),M(!1)},className:Me("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left outline-none hover:bg-[var(--hover)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/50",q&&"bg-[var(--selected)]"),children:[h.jsxs("span",{className:"min-w-0 flex-1",children:[h.jsx("span",{className:"block truncate type-ui text-[var(--fg)]",children:K.displayName}),h.jsxs("span",{className:"block truncate type-meta text-[var(--dim-fg)]",children:[K.id," · ",gI(K.contextWindow)," / ",gI(K.maxOutputTokens)]})]}),rf(K,R.provider)&&h.jsx(Tc,{className:"size-3.5 shrink-0 text-[var(--accent-soft)]"}),q&&h.jsx(Lv,{className:"size-4 shrink-0 text-[var(--accent)]"})]},Rq(K.providerId,K.id))})})]},R.provider.id)}),p&&h.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-6 type-ui text-[var(--muted-fg)]",children:[h.jsx(Ot,{className:"size-4 animate-spin motion-reduce:animate-none"}),"正在加载完整模型目录…"]}),!p&&E.length===0&&h.jsx("p",{className:"py-8 text-center type-ui text-[var(--dim-fg)]",children:"没有匹配的可用模型"})]})]})]})}function gI(e){return e>=1e3?`${Math.round(e/1e3)}K`:String(e)}function bW({mode:e,disabled:t,onChange:n}){const[r,o]=I.useState(!1),[s,l]=I.useState(e.documentModeConfig),[u,f]=I.useState(""),p=D(S=>S.supportsDocumentAnnotations),m=D(S=>S.supportsDocumentSuggestions),g=S=>n(C2(S,p)),x=e.documentModeConfig.documents.filter(S=>S.enabled).length,y=(S,T)=>l(k=>({...k,documents:k.documents.map(_=>_.id===S?{..._,...T}:_)})),w="w-full min-w-0 rounded-md border border-[var(--control-border)] bg-[var(--control)] px-2 py-1.5 type-ui text-[var(--fg)] outline-none focus:border-[var(--accent)]";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"mx-auto mb-1.5 flex h-8 max-w-[820px] items-center gap-2 whitespace-nowrap","data-testid":"conversation-mode-row",children:[h.jsx(uC,{ariaLabel:"对话模式",value:e.conversationMode,disabled:t,className:"h-7 w-[96px] shrink-0 border-transparent bg-transparent",onValueChange:S=>g({...e,conversationMode:S}),options:[{value:"auto",label:"自动",description:"沿用当前工作区提示词和执行方式"},{value:"document",label:"文档",description:"只生成并检查 Markdown 设计文档"}]}),e.conversationMode==="document"&&h.jsxs(Je,{variant:"ghost",className:"h-7 min-w-0 gap-1.5 px-2",disabled:t,onClick:()=>{l(structuredClone(e.documentModeConfig)),f(""),o(!0)},children:[h.jsx(Uc,{className:"size-3.5"}),m?`初始文档建议 · ${x} 项`:`${x} 项文档`,h.jsx(WT,{className:"size-3"})]})]}),h.jsx(Tr,{open:r,onOpenChange:o,title:m?"初始文档建议":"文档清单",description:m?"勾选项作为初始生成建议,不限制后续可修改的设计文档。可以全部关闭,按对话要求生成或更新文档;取消或移除建议不会删除已有文件。":"只修改勾选的根目录 Markdown。取消或移除配置不会删除已有文件。",closeDisabled:t,footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",onClick:()=>o(!1),children:"取消"}),h.jsx(Je,{disabled:t,onClick:()=>{const S=ty.safeParse(s);if(!S.success){f(S.error.issues[0]?.message??"配置无效");return}g({...e,documentModeConfig:S.data}),o(!1)},children:m?"保存建议":"保存清单"})]}),children:h.jsxs("div",{className:"max-h-[55vh] space-y-3 overflow-y-auto pr-1",children:[h.jsxs("label",{className:"flex items-start gap-2 rounded-lg border border-[var(--border)] p-3 type-ui",children:[h.jsx("input",{type:"checkbox","aria-label":"参考现有代码",checked:s.referenceCode??!1,disabled:t||!p,onChange:S=>l(T=>({...T,referenceCode:S.target.checked})),className:"mt-0.5 accent-[var(--accent)]"}),h.jsxs("span",{children:["参考现有代码",h.jsxs("span",{className:"mt-1 block type-meta text-[var(--muted-fg)]",children:["只读参考代码,不允许修改代码。",!p&&"当前 Host 不支持,请升级后启用。"]})]})]}),s.documents.map(S=>{const T=ey.some(k=>k.id===S.id);return h.jsxs("div",{className:"space-y-2 rounded-lg border border-[var(--border)] p-3",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"checkbox","aria-label":`${m?"建议生成":"生成"} ${S.title}`,checked:S.enabled,onChange:k=>y(S.id,{enabled:k.target.checked}),className:"accent-[var(--accent)]"}),h.jsx("span",{className:"min-w-0 flex-1 truncate type-ui font-medium",children:S.title||"自定义文档"}),!T&&h.jsx(At,{label:`移除文档配置 ${S.title}`,onClick:()=>l(k=>({...k,documents:k.documents.filter(_=>_.id!==S.id)})),children:h.jsx(jf,{className:"size-3.5"})})]}),T?h.jsx("p",{className:"type-meta text-[var(--muted-fg)]",children:S.fileName}):h.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[h.jsxs("label",{className:"space-y-1 type-meta",children:["名称",h.jsx("input",{"aria-label":`文档名称 ${S.id}`,className:w,value:S.title,maxLength:80,onChange:k=>y(S.id,{title:k.target.value})})]}),h.jsxs("label",{className:"space-y-1 type-meta",children:["根目录文件名",h.jsx("input",{"aria-label":`文档文件名 ${S.id}`,className:w,value:S.fileName,maxLength:120,onChange:k=>y(S.id,{fileName:k.target.value})})]})]}),h.jsx("textarea",{"aria-label":`${S.title}生成要求`,className:w,rows:2,maxLength:1e3,placeholder:"补充生成要求(可选)",value:S.guidance,onChange:k=>y(S.id,{guidance:k.target.value})})]},S.id)}),h.jsxs(Je,{variant:"secondary",disabled:s.documents.length>=20,onClick:()=>l(S=>({...S,documents:[...S.documents,{id:`custom-${crypto.randomUUID()}`,title:"自定义文档",fileName:`自定义文档${S.documents.length-4}.md`,enabled:!0,guidance:""}]})),children:[h.jsx(If,{className:"size-3.5"}),"添加文档"]}),u&&h.jsx(On,{role:"alert",tone:"danger",children:u}),!m&&s.documents.every(S=>!S.enabled)&&h.jsx(On,{tone:"warning",children:"发送前至少需要勾选一份文档。"}),h.jsx("p",{className:"type-meta text-[var(--muted-fg)]",children:"修改自定义文件名不会移动旧文件;已有文件原位增量更新,保留无关人工内容。"})]})})]})}function xW({thread:e,initialDraft:t,projectId:n,visible:r=!0}){const[o,s]=I.useState(!1),[l,u]=I.useState(!1),[f,p]=I.useState(!1),m=I.useRef(null),g=I.useRef(!1),x=D(be=>be.connectionStatus),y=D(be=>n===void 0?be.activeProjectId:n),w=D(be=>be.projects.find($t=>$t.id===y)),S=D(be=>n===void 0?be.activeThreadId:e?.id??null),T=D(be=>be.upsertThread),k=D(be=>be.providers),_=D(be=>be.modelsByProviderId),C=D(be=>be.activeProviderId),E=D(be=>be.activeModelByProviderId),O=D(be=>be.reasoning),M=D(be=>be.pushToast),R=D(be=>be.appSettings),z=D(be=>be.supportsDocumentSuggestions),K=x==="online",q=Sa(S,y),{preferenceDraft:Z,preferences:Y,selectModel:ae,selectReasoning:J,modeSettings:he,saveMode:F}=cW(e,y,q,r),ee=Z?.providerProfileId??C,Q=k.find(be=>be.id===ee&&Ps(be)),xe=Z?.model??(Q?E[Q.id]??Q.defaultModelId??Q.model:void 0),P=Q?(_[Q.id]??[ol(Q)]).find(be=>be.id===xe&&_c(be)):void 0,$=Z?.reasoningEffort??O,te=!!(e?.preferences&&(!Q||!P)),A=pW(q),L=fc(e?e.mode:A.mode),X=L.conversationMode==="document",ue=X&&!z&&L.documentModeConfig.documents.every(be=>!be.enabled),we=hW(q),ge=mW(q),Se=A.text,B=A.attachments,U=A.references,ve=B.some(be=>be.kind==="image"),_e=B.some(be=>be.status==="uploading"||be.status==="processing"),qe=ve&&Q!==void 0&&!rf(P,Q),Qe=Se.trim().length>0||B.length>0||U.length>0,ze=e?e.approvalMode==="full-access":f,ut=w?.kind==="managed",Kt=!X&&(ut||vy(R)),Ft=e?.turns?.some(be=>be.postTurnStatus==="validating")??!1,{editing:dr,setEditing:Lr,textareaRef:Lo,focusComposer:oi,resizeTextarea:an}=uW({activeProjectId:y,activeThreadId:S,draftKey:q,draft:Se,draftLocked:we,visible:r,...t!==void 0?{initialDraft:t}:{}}),{preparationController:ai,preparationInspection:pe,modeInspecting:Ie,modePreparing:Le}=lW(y,S,q,oi),{addFiles:ne,removeAttachment:je,retryAttachment:Be}=dW(q,S,M,oi);I.useEffect(()=>{Lr(!1),s(!1),p(!1)},[q]);const We=vn({mutationFn:async({mode:be,targetThreadId:$t})=>{if(!$t){p(be==="full-access");return}return He.call("approval.mode.set",{threadId:$t,mode:be})},onSuccess:(be,$t)=>{const Mn=D.getState();if(Mn.hostSessionId!==$t.hostSessionId||be&&(be.thread.id!==$t.targetThreadId||be.thread.projectId!==$t.targetProjectId))return;const Br=be?Mn.threadDetailsById[be.thread.id]??Mn.threads.find(si=>si.id===be.thread.id):void 0;be&&Br&&T({...Br,approvalMode:be.thread.approvalMode??"prompt",...be.thread.approvalModeChangedAt?{approvalModeChangedAt:be.thread.approvalModeChangedAt}:{},updatedAt:be.thread.updatedAt},{select:!1}),(!be||Mn.activeThreadId===be.thread.id)&&(u(!1),oi())},onError:(be,$t)=>{D.getState().hostSessionId===$t.hostSessionId&&M({title:"无法更新 Full access",description:be instanceof Error?be.message:"Host 返回未知错误",tone:"danger"})}}),ft=be=>We.mutate({mode:be,targetThreadId:S,targetProjectId:y,hostSessionId:D.getState().hostSessionId}),Xe={isPending:we},sn=vn({mutationFn:()=>{if(!e)throw new Error("没有正在运行的会话");if(!e.activeTurnId)throw new Error("当前 Turn ID 不可用,无法安全取消");return He.call("turn.cancel",{threadId:e.id,turnId:e.activeTurnId})},onError:be=>M({title:"停止失败",description:be instanceof Error?be.message:"Host 返回未知错误",tone:"danger"})}),mt=()=>{const be=Se.trim();if(!Qe||ue||he.isPending||qe||ge||_e||we||Xe.isPending||Ie||Le||Ft||Pr(e))return;if(!Q||!P){M({title:"请选择可用模型",description:"请检查模型是否启用、限制是否完整,以及所需密钥是否已配置。",tone:"neutral"});return}const $t={submissionId:crypto.randomUUID(),hostSessionId:D.getState().hostSessionId,navigationIntentId:D.getState().navigationIntentId,providerProfileId:Q.id,model:P.id,reasoningEffort:$,supportsImages:rf(P,Q),references:structuredClone(U),explicitMode:L.conversationMode!=="auto"||!!A.mode,mode:structuredClone(L),projectId:y??"",threadId:S,content:be,sourceKey:q,files:B.map(Mn=>({...Mn})),attachmentOrder:[...A.order],requestedFullAccess:ze};iW($t)&&ai.current?.check($t,{managedProject:ut,frontendEnabled:Kt})},Bn=()=>ai.current?.cancel(),Jn=()=>{ai.current?.confirm()};return h.jsxs("div",{className:"chat-composer shrink-0 px-4 pb-3 pt-2",children:[e?.queue&&h.jsxs("div",{role:"status",className:"mx-auto mb-2 flex max-w-[820px] items-center gap-2 type-meta text-[var(--muted-fg)]",children:[h.jsx(Ot,{className:"size-3 animate-spin motion-reduce:animate-none"}),"队列第 ",e.queue.position," 位 · ",e.queue.reason==="workspace-busy"?"等待此应用的上一项任务完成":"等待应用并发执行名额"]}),h.jsx(bW,{mode:L,onChange:F,disabled:!K||he.isPending||Pr(e)||e?.status==="archived"||Xe.isPending||we||_e||ge||Ie||Le||Ft},q),h.jsxs("div",{onDragEnter:be=>{be.preventDefault(),!Xe.isPending&&!Ie&&!Le&&!we&&s(!0)},onDragOver:be=>{be.preventDefault(),be.dataTransfer.dropEffect="copy"},onDragLeave:be=>{be.currentTarget.contains(be.relatedTarget)||s(!1)},onDrop:be=>{be.preventDefault(),s(!1),!Xe.isPending&&!we&&ne(Array.from(be.dataTransfer.files))},className:Me("relative mx-auto max-w-[820px] overflow-hidden rounded-2xl border border-[var(--border-strong)] bg-[var(--composer)] shadow-[0_15px_45px_rgba(0,0,0,.18)] focus-within:border-[var(--accent)]/45 focus-within:shadow-[0_15px_45px_rgba(0,0,0,.22),0_0_0_2px_rgba(109,87,255,.08)]",o&&"border-[var(--accent)] bg-[var(--accent)]/[0.06] ring-2 ring-[var(--accent)]/15"),children:[o&&h.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center bg-[var(--composer)]/90 type-ui font-medium text-[var(--accent-soft)]",children:"松开即可添加图片、文本或文档"}),dr&&h.jsxs("div",{className:"flex h-7 items-center gap-2 border-b border-[var(--border)] bg-[var(--accent)]/[0.06] px-3 type-meta text-[var(--accent-soft)]",children:[h.jsx(Ws,{className:"size-3"}),"编辑最近一条消息并作为新 Turn 重发;旧记录会保留",h.jsx("button",{type:"button",className:"ml-auto",onClick:()=>Lr(!1),children:h.jsx(ei,{className:"size-3"})})]}),U.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1.5 border-b border-[var(--border)] px-3 py-2",children:U.map(be=>h.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-md border border-[var(--border)] bg-[var(--control)] px-2 py-1 type-meta text-[var(--subtle-fg)]",children:[h.jsx(Wd,{className:"size-2.5 text-[var(--accent-soft)]"}),h.jsx("span",{className:"max-w-[180px] truncate",children:be.path}),be.startLine&&h.jsxs("span",{className:"text-[var(--dim-fg)]",children:[":",be.startLine,"-",be.endLine]}),h.jsx("button",{type:"button","aria-label":`移除 ${be.path}`,disabled:Xe.isPending||we,onClick:()=>FH(q,be.path,be.startLine,be.endLine),className:"ml-0.5 text-[var(--dim-fg)] hover:text-[var(--fg)] disabled:cursor-not-allowed disabled:text-[var(--disabled-fg)]",children:h.jsx(ei,{className:"size-2.5"})})]},`${be.path}:${be.startLine??0}:${be.endLine??0}`))}),h.jsx(nW,{pendingAttachments:B,locked:we,retryAttachment:Be,removeAttachment:je}),qe&&h.jsx(On,{role:"status",tone:"warning",className:"rounded-none border-x-0 border-t-0 px-3 py-2 type-meta",children:"当前模型不支持图片输入。附件和文字会保留,请选择带“可看图”标识的模型。"}),te&&h.jsx(On,{role:"status",tone:"warning",className:"rounded-none border-x-0 border-t-0 px-3 py-2 type-meta",children:"此对话保存的 Provider 或模型当前不可用。原配置已保留,请重新选择后再发送。"}),h.jsxs("div",{className:"flex items-end gap-2 px-3 pt-2.5",children:[h.jsx("textarea",{ref:Lo,autoFocus:r,rows:1,value:Se,disabled:!K||Xe.isPending||Ie||Le||we,onChange:be=>{Kg(q,be.target.value),an()},onPaste:be=>{const $t=Array.from(be.clipboardData.items).filter(Mn=>Mn.kind==="file").flatMap(Mn=>{const Br=Mn.getAsFile();return Br?[Br]:[]});$t.length>0&&ne($t)},onCompositionStart:()=>{g.current=!0},onCompositionEnd:()=>{g.current=!1},onKeyDown:be=>{be.key==="Enter"&&!be.shiftKey&&!g.current&&!be.nativeEvent.isComposing&&(be.preventDefault(),mt())},placeholder:K?X?"描述需求,生成或更新设计文档…":"描述你想完成的任务…":"连接本地 Harness Host 后即可开始对话",className:"min-h-10 min-w-0 flex-1 resize-none bg-transparent py-2 type-ui text-[var(--fg)] outline-none placeholder:text-[var(--dim-fg)] disabled:cursor-not-allowed"}),Pr(e)?h.jsx(At,{label:e?.activeTurnStatus==="queued"?"取消排队":"停止当前 Turn",tone:"danger",onClick:()=>sn.mutate(),disabled:!K||sn.isPending,className:"mb-1",children:h.jsx(nO,{className:"size-4"})}):h.jsx(At,{label:"发送消息",onClick:mt,disabled:!K||!Q||!P||!Qe||ue||he.isPending||qe||ge||_e||we||Xe.isPending||Ie||Le||Ft,className:"mb-1 border-transparent bg-[var(--accent)] text-white hover:bg-[var(--accent-hover)] hover:text-white",children:Ie||Le||Ft?h.jsx(Ot,{className:"size-4 animate-spin motion-reduce:animate-none"}):h.jsx(gz,{className:"size-4"})})]}),h.jsxs("div",{className:"chat-composer-toolbar flex h-9 items-center gap-1.5 px-2.5 pb-1.5",children:[h.jsx("input",{ref:m,type:"file",multiple:!0,className:"sr-only",tabIndex:-1,accept:"image/png,image/jpeg,image/webp,text/*,.docx,.xlsx,.pdf,.txt,.md,.markdown,.csv,.tsv,.json,.jsonl,.yaml,.yml,.xml,.html,.htm,.css,.scss,.less,.js,.jsx,.mjs,.cjs,.mts,.ts,.tsx,.py,.rb,.go,.rs,.java,.kt,.kts,.c,.h,.cc,.cpp,.hpp,.cs,.php,.swift,.sh,.bash,.zsh,.fish,.ps1,.bat,.cmd,.sql,.graphql,.gql,.toml,.ini,.conf,.properties,.env,.gitignore,.log,.svelte,.vue",onChange:be=>{const $t=Array.from(be.target.files??[]);be.target.value="",ne($t)}}),h.jsx(At,{label:"添加图片、文本或文档",onClick:()=>m.current?.click(),disabled:!K||Xe.isPending||we,children:h.jsx(Wd,{className:"size-3.5"})}),h.jsxs("button",{type:"button",role:"switch","aria-checked":ze,"aria-label":"Full access",title:ze?"此会话后续新审批将自动允许":"开启此会话的自动审批",disabled:!K||We.isPending||Xe.isPending||we,onClick:()=>ze?ft("prompt"):u(!0),className:Me("inline-flex h-7 shrink-0 items-center gap-1.5 rounded-lg border px-2 type-ui transition-colors disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",ze?"border-[var(--status-success-border)] bg-[var(--status-success-bg)] text-[var(--status-success-fg)]":"border-transparent bg-transparent text-[var(--muted-fg)] hover:bg-[var(--hover)] hover:text-[var(--fg)]"),children:[ze?h.jsx(Vv,{className:"size-3.5"}):h.jsx(wz,{className:"size-3.5"}),h.jsx("span",{className:"chat-full-access-label hidden md:inline",children:"Full access"})]}),ge&&h.jsxs("span",{role:"status","aria-label":"正在读取附件",title:"正在读取附件…",className:"inline-flex shrink-0 items-center gap-1 px-1 type-meta text-[var(--muted-fg)]",children:[h.jsx(Ot,{className:"size-3 animate-spin motion-reduce:animate-none"}),h.jsx("span",{className:"chat-preparation-label",children:"正在读取附件…"})]}),h.jsx(yW,{...Q?{provider:Q}:{},...P?{model:P}:{},...te?{unavailableLabel:"当前模型不可用"}:{},onSelect:ae,disabled:!K||Xe.isPending||we||Pr(e)||Y.isPending}),Q&&P&&(P.capabilities.reasoningLevels.length>0||Q.reasoningLevels.length>0)&&h.jsx(uC,{ariaLabel:"推理强度",value:$,onValueChange:be=>J(be),options:(P.capabilities.reasoningLevels.length>0?P.capabilities.reasoningLevels:Q.reasoningLevels).map(be=>({value:be,label:`思考 · ${WY[be]}`})),disabled:!K||Xe.isPending||we||Pr(e)||Y.isPending,compactIcon:h.jsx(Dv,{className:Me("size-3.5",$!=="off"&&"text-[var(--accent-soft)]")}),className:"h-7 w-[124px] border-transparent bg-transparent px-2 hover:bg-[var(--hover)]"}),h.jsxs("span",{className:"chat-composer-hint ml-auto hidden items-center gap-1 type-meta text-[var(--dim-fg)] sm:flex",children:[h.jsx(mO,{className:"size-2.5"}),"Enter 发送 · Shift+Enter 换行"]})]})]}),h.jsx(YY,{visible:r,fullAccessConfirmOpen:l,setFullAccessConfirmOpen:u,approvalPending:We.isPending,updateApprovalMode:ft,preparationInspection:pe,modePreparing:Le,cancelPreparation:Bn,confirmPreparation:Jn})]})}function wW({online:e,onPrompt:t}){const n=["解释这个项目的整体架构","查找最值得优先修复的问题","为当前代码补充关键测试"];return h.jsxs("div",{className:"flex h-full min-h-[360px] flex-col items-center justify-center px-8 text-center",children:[h.jsxs("div",{className:"relative mb-5 flex size-12 items-center justify-center rounded-2xl bg-[linear-gradient(145deg,rgba(109,87,255,.23),rgba(109,87,255,.06))] text-[var(--accent-soft)] ring-1 ring-[var(--accent)]/20",children:[h.jsx(Qs,{className:"size-6"}),h.jsx(XT,{className:"absolute -right-1 -top-1 size-4 text-[var(--accent-soft)]"})]}),h.jsx("h2",{className:"text-[17px] font-semibold tracking-[-.02em] text-[var(--fg)]",children:"从哪里开始?"}),h.jsx("p",{className:"mt-2 max-w-md type-ui text-[var(--muted-fg)]",children:"Harness 可以读取和搜索项目;写入文件或执行命令前会向你请求审批。"}),h.jsx("div",{className:"chat-empty-prompts mt-5 grid w-full max-w-[570px] grid-cols-3 gap-2",children:n.map(r=>h.jsx("button",{type:"button",onClick:()=>t(r),className:"rounded-xl border border-[var(--border)] bg-[var(--card)] px-3 py-3 text-left type-ui text-[var(--subtle-fg)] transition hover:border-[var(--accent)]/30 hover:bg-[var(--hover)] disabled:cursor-not-allowed disabled:border-[var(--disabled-border)] disabled:bg-[var(--disabled-bg)] disabled:text-[var(--disabled-fg)]",disabled:!e,children:r},r))})]})}function SW({headerActionsTarget:e,threadId:t,projectId:n,visible:r=!0}){const o=D(U=>t===void 0?U.activeThreadId:t),s=D(U=>o?U.threadDetailsById[o]??U.threads.find(ve=>ve.id===o):void 0),l=D(U=>U.hostSessionId),u={hostSessionId:l,projectId:n??s?.projectId??null,threadId:o??null},f=`${l}:${n??s?.projectId}:${o??"draft"}`,p=D(U=>U.projects.find(ve=>ve.id===s?.projectId)?.rootPath),m=D(U=>U.providers),g=D(U=>U.modelsByProviderId),x=D(U=>U.activeProviderId),y=D(U=>U.activeModelByProviderId),w=D(U=>U.connectionStatus),S=D(U=>U.pushToast),T=D(U=>o?U.historyByThreadId[o]:void 0),{scrollRef:k,scrollContentRef:_,scrollController:C,showScrollButton:E,setShowScrollButton:O,historyPage:M}=N7({threadId:o,thread:s,history:T,scrollKey:f,visible:r}),R=w==="online",z=m.find(U=>U.id===x&&U.enabled),K=z?(g[z.id]??[ol(z)]).find(U=>U.id===(y[z.id]??z.defaultModelId??z.model)):void 0,q=s?.metrics?.latestUsageRequest?.providerProfileId??s?.metrics?.requests.at(-1)?.providerProfileId??s?.turns?.find(U=>U.id===s.metrics?.latestTurnId)?.providerProfileId,Z=m.find(U=>U.id===q),Y=s?.metrics?.latestUsageRequest?.model??s?.metrics?.requests.at(-1)?.model??s?.turns?.find(U=>U.id===s.metrics?.latestTurnId)?.model,ae=Z&&Y?g[Z.id]?.find(U=>U.id===Y):void 0,J=s?.turns?.find(U=>U.id===s.metrics?.latestTurnId),he=J?.contextWindow??ae?.contextWindow??K?.contextWindow??Z?.contextWindow??z?.contextWindow,F=J?.maxOutputTokens??ae?.maxOutputTokens??K?.maxOutputTokens??Z?.maxOutputTokens??z?.maxOutputTokens,ee=s?.items??[],Q=eW(p),xe=I.useMemo(()=>U7(ee,s?.turns,{caseSensitivePaths:Q}),[Q,ee,s?.turns]),P=I.useMemo(()=>new Map((s?.turns??[]).map(U=>[U.id,U])),[s?.turns]),$=I.useMemo(()=>new Map((s?.turns??[]).flatMap(U=>{const ve=JY(U,m);return ve?[[U.id,ve]]:[]})),[m,s?.turns]),te=s?hI(s):!1,A=I.useMemo(()=>{if(!s)return null;for(let U=s.items.length-1;U>=0;U-=1){const ve=s.items[U];if(ve?.type==="message"&&ve.role==="user")return ve.id}return null},[s]),L=vn({mutationFn:async U=>{if(!s||!R)throw new Error("请先连接本地 Host。");return await He.call("turn.retry",{threadId:s.id,...U?{turnId:U}:{}})},onError:U=>S({title:"重试失败",description:U instanceof Error?U.message:"Host 返回未知错误",tone:"danger"}),onSuccess:U=>{for(const ve of U.warnings??[])S({title:"本轮已重试,但有一项提示",description:ve.message,tone:"neutral"})}}),X=U=>{if(!s||!R){S({title:"无法重试",description:"请先连接本地 Host。",tone:"neutral"});return}if(!hI(s,U)){S({title:"无法直接重试",description:"请调整输入或新建对话后再试。",tone:"neutral"});return}Pr(s)||L.isPending||L.mutate(U)},ue=async()=>{if(!s||!R){S({title:"无法压缩上下文",description:"请先连接本地 Host。",tone:"neutral"});return}try{await He.call("turn.compact",{threadId:s.id,strategy:"auto"})}catch(U){S({title:"压缩失败",description:U instanceof Error?U.message:"Host 返回未知错误",tone:"danger"})}},we=U=>{if(U.documentAnnotationReferencesInvalid){S({title:"无法编辑重发",description:"历史文档批注记录不完整,请重新选择批注;当前草稿未更改。",tone:"danger"});return}window.dispatchEvent(new CustomEvent("harness:edit-message",{detail:{content:U.content,attachments:U.attachments??[],editing:!0,...U.documentAnnotationReferences?{documentAnnotationReferences:U.documentAnnotationReferences}:{},...o?{threadId:o}:{}}}))},ge=!!(s&&!s.isPreview&&(!T||T.status==="loading")),Se=T?.status==="error"&&ee.length===0,B=h.jsxs("div",{role:"group","aria-label":"对话操作",className:"flex shrink-0 items-center gap-0.5 px-1",children:[h.jsx(At,{label:"压缩上下文",className:"size-7",onClick:()=>{ue()},disabled:!s||Pr(s),children:h.jsx($O,{className:"size-3.5"})}),h.jsx(At,{label:"重试最后一次回答",className:"size-7",onClick:()=>X(),disabled:!s||!te||Pr(s)||L.isPending,children:h.jsx(Ws,{className:Me("size-3.5",L.isPending&&"animate-spin motion-reduce:animate-none")})}),h.jsx(At,{label:"更多操作",className:"size-7",children:h.jsx(HT,{className:"size-3.5"})})]});return h.jsxs("section",{className:"flex h-full min-h-0 flex-col bg-[var(--workspace)]",children:[r&&(e?ja.createPortal(B,e):e===void 0?B:null),h.jsxs("div",{className:"relative min-h-0 flex-1",children:[h.jsx("div",{ref:k,onScroll:()=>{if(!r||!k.current)return;const U=C.viewportScrolled();O(U.showScrollButton),sa.delete(f),sa.set(f,{top:k.current.scrollTop,following:!U.showScrollButton}),sa.size>100&&sa.delete(sa.keys().next().value)},className:"h-full overflow-y-auto [overflow-anchor:none]",children:h.jsx("div",{ref:_,className:"min-h-full",children:ge&&ee.length===0?h.jsx("div",{"aria-label":"正在加载历史记录",className:"mx-auto flex max-w-[820px] animate-pulse flex-col gap-4 px-6 py-8 motion-reduce:animate-none",children:["w-2/3","w-5/6","w-1/2","w-3/4"].map((U,ve)=>h.jsx("div",{className:Me("h-12 rounded-xl bg-[var(--control)]",U)},ve))}):Se?h.jsxs("div",{className:"flex h-full min-h-[320px] flex-col items-center justify-center px-8 text-center",children:[h.jsx("p",{className:"type-ui font-medium text-[var(--fg)]",children:"历史记录加载失败"}),h.jsx("p",{className:"mt-2 max-w-xl type-ui text-[var(--muted-fg)]",children:T.error??"Host 返回未知错误"}),h.jsx(Je,{className:"mt-4",onClick:()=>M.mutate({prepend:!1}),disabled:!R||M.isPending,children:"重试"})]}):ee.length===0?h.jsx(wW,{online:R,onPrompt:U=>{window.dispatchEvent(new CustomEvent("harness:edit-message",{detail:{content:U}}))}}):h.jsxs("div",{className:"chat-messages mx-auto flex max-w-[900px] flex-col gap-4 px-5 py-5",children:[T?.status==="error"&&h.jsx(On,{tone:"danger",className:"px-3 py-2 type-ui",children:h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("span",{className:"min-w-0 flex-1 truncate",children:["历史记录加载失败:",T.error??"Host 返回未知错误"]}),h.jsx(Je,{variant:"secondary",onClick:()=>M.mutate({prepend:!1}),disabled:!R||M.isPending,children:"重试"})]})}),T?.itemsHasMore&&T.nextBeforeItemId&&h.jsx("div",{className:"flex justify-center",children:h.jsx(Je,{onClick:()=>M.mutate({prepend:!0}),disabled:!R||T.status==="loading-more"||M.isPending,children:T.status==="loading-more"?"正在加载更早记录…":"加载更早记录"})}),h.jsx(M7,{entries:xe,cacheKey:f,viewportRef:k,visible:r,keyOf:U=>U.type==="activity"?U.id:U.item.id,children:U=>{const ve=U.type==="activity"?U.id:U.item.id,_e=U.type==="activity"?U.turnId:"turnId"in U.item?U.item.turnId:void 0,qe=_e?$.get(_e):void 0;return h.jsx("div",{"data-chat-entry-id":ve,className:"min-w-0",children:U.type==="activity"?h.jsx(qY,{scope:u,group:U,...U.turnId&&P.has(U.turnId)?{turn:P.get(U.turnId)}:{},...qe?{providerLabel:qe}:{},onRetry:X,retrying:L.isPending&&L.variables===U.turnId,retryDisabled:!R||Pr(s)||L.isPending}):h.jsx($Y,{scope:u,item:U.item,editable:U.item.id===A&&!Pr(s),onEdit:we,onRetry:X,retrying:L.isPending&&U.item.type==="error"&&L.variables===U.item.turnId,retryDisabled:!R||Pr(s)||L.isPending,...qe?{providerLabel:qe}:{}})},ve)}})]})})}),E&&h.jsx("button",{type:"button","aria-label":"滚动到底部",onClick:()=>{C.scrollToBottom(),O(!1)},className:"absolute bottom-2 left-1/2 flex size-7 -translate-x-1/2 items-center justify-center rounded-full border border-[var(--border-strong)] bg-[var(--popover)] text-[var(--muted-fg)] shadow-lg hover:text-[var(--fg)]",children:h.jsx(zv,{className:"size-3.5"})})]}),h.jsx(xW,{thread:s,visible:r,...n!==void 0?{projectId:n}:{}},o??`draft:${n??"active"}`),h.jsx(GY,{className:"chat-metrics",visible:r,connected:R,...s?.metrics?.latestTurn?{latestTurn:s.metrics.latestTurn}:{},...s?.metrics?.threadTotal?{threadTotal:s.metrics.threadTotal}:{},...s?.metrics?.latestUsageRequest?{latestUsageRequest:s.metrics.latestUsageRequest}:{},...s?.metrics?.requests?{requests:s.metrics.requests}:{},...he!==void 0?{contextWindow:he}:{},...F!==void 0?{maxOutputTokens:F}:{},running:s?.activeTurnStatus==="running"&&s.metrics?.latestTurnId===s.activeTurnId},f)]})}const So=e=>`${e.projectId??"none"}:${e.threadId??"draft"}`;function vI(e,t,n){const r=So(t),o=[...e.filter(u=>So(u)!==r),t],s=o.filter(u=>So(u)!==r&&!n.has(u.threadId??"")),l=new Set(s.slice(0,Math.max(0,s.length-10)).map(So));return o.filter(u=>!l.has(So(u)))}function kW(e,t,n,r){const o=e.filter(s=>n.has(s));for(t&&n.has(t)&&!o.includes(t)&&o.push(t);o.length>r;){const s=o.findIndex(l=>l!==t);if(s<0)break;o.splice(s,1)}return o}function $E(e){return I.useSyncExternalStore(w$,()=>$i(e),()=>$i(null))}function uc(e,t){if(!t)return;const n=D.getState(),r=n.threadDetailsById[t]??n.threads.find(o=>o.id===t);return r?.projectId===e?r:void 0}function Jm(e){return e?.status==="running"||e?.activeTurnStatus!==void 0||e?.turns?.some(t=>["queued","running","waiting-approval"].includes(t.status)||t.postTurnStatus==="validating")===!0}function eg(e,t){return JSON.stringify(e)===JSON.stringify(t)}function IW(e){const t=D(k=>k.activeProjectId===e&&k.activeThreadId?k.threadDetailsById[k.activeThreadId]?.title??k.threads.find(_=>_.id===k.activeThreadId)?.title??"对话":"新对话"),[n,r]=I.useState(!1),[o,s]=I.useState(null),[l,u]=I.useState(null),f=I.useRef(null),p=I.useRef(0),m=I.useRef(!1),g=I.useRef(!0);I.useEffect(()=>(g.current=!0,()=>{g.current=!1,p.current+=1}),[]);const x=(k,_=k.mode)=>{const C=D.getState();if(!g.current||p.current!==k.generation||C.hostSessionId!==k.sessionId||C.connectionStatus!=="online"||C.activeProjectId!==k.projectId||C.activeThreadId!==k.threadId||C.navigationIntentId!==k.navigationIntentId)throw new Error("应用、对话或 Host 连接已切换,批注已保留,请重新转交。");if(!C.supportsDocumentAnnotations)throw new Error("当前 Host 不支持文档批注,请升级后重试。");if(C.supportsDocumentSuggestions!==k.supportsDocumentSuggestions)throw new Error("Host 的文档能力已变化,批注已保留,请重新转交。");if(Dd(k.projectId)!==k.annotationVersion)throw new Error("批注或文档已发生变化,请确认后重新转交。");if(ka(k.draftKey)!==k.draft)throw new Error("目标草稿已发生变化,请确认后重新转交。");if(zy(k.draftKey)||Qf(k.draftKey))throw new Error("目标草稿正在发送或准备附件,请稍后重试。");const E=uc(k.projectId,k.threadId);if(k.threadId&&(!E||E.status==="archived"))throw new Error("目标对话已移除或归档,批注已保留。");if(!eg(fc(E?E.mode:k.draft.mode),_))throw new Error("对话模式已被修改,请确认后重新转交。")},y=async k=>{if(m.current)return!1;m.current=!0,r(!0),s(null);try{x(k);const _=!eg(k.mode,k.nextMode);if(_&&Jm(uc(k.projectId,k.threadId)))throw new Error("对话正在执行任务,不能修改文档模式或清单,请任务结束后重试。");const C=new Map,E=Z=>`${k.caseSensitivePaths?Z.path:Z.path.toLocaleLowerCase("en-US")}:${Z.startLine}:${Z.endLine}:${Z.hash}`;for(const Z of k.annotations)C.has(E(Z))||C.set(E(Z),{path:Z.path,hash:Z.hash,startLine:Z.startLine,endLine:Z.endLine});const O=await He.call("document.annotations.resolve",{projectId:k.projectId,references:[...C.values()]});if(x(k),O.references.length!==C.size)throw new Error("Host 返回的批注引用数量不一致,批注已保留。");const M=new Map;for(const Z of O.references){if(Z.projectId!==k.projectId||Z.startLine===void 0||Z.endLine===void 0)throw new Error("Host 返回了其他应用或无效范围的引用。");const Y=E({...Z,startLine:Z.startLine,endLine:Z.endLine});if(!C.has(Y)||M.has(Y))throw new Error("Host 返回的文件、哈希或行号与批注不一致。");M.set(Y,Z)}const R=k.annotations.map(Z=>({reference:{projectId:k.projectId,path:C.get(E(Z)).path,hash:Z.hash,startLine:Z.startLine,endLine:Z.endLine,truncated:M.get(E(Z)).truncated,...M.get(E(Z)).snapshot!==void 0?{snapshot:M.get(E(Z)).snapshot}:{}},documentAnnotationReference:C.get(E(Z)),text:`${Z.path}:${Z.startLine}-${Z.endLine}${Z.locationKind==="context"?"(所在段落)":""} · “${Z.selectedText}”:${Z.requirement}`})),z=nk(k.draftKey,R,{expected:k.draft,validateOnly:!0,caseSensitivePaths:k.caseSensitivePaths});if(!z.added)throw new Error(z.reason);let K=k.mode;if(_&&k.threadId){if(Jm(uc(k.projectId,k.threadId)))throw new Error("对话正在执行任务,不能修改文档模式或清单。");const Z=await He.call("thread.mode.update",{threadId:k.threadId,expectedRevision:k.mode.revision,mode:{conversationMode:k.nextMode.conversationMode,documentModeConfig:k.nextMode.documentModeConfig}}),Y=D.getState();if(Z.thread.id!==k.threadId||Z.thread.projectId!==k.projectId)throw new Error("Host 返回了其他对话的模式,批注已保留。");if(K=fc(Z.thread.mode),K.conversationMode!=="document"||JSON.stringify(K.documentModeConfig)!==JSON.stringify(k.nextMode.documentModeConfig))throw new Error("Host 未保存预期的文档模式或清单,批注已保留。");const ae=uc(k.projectId,k.threadId);Y.hostSessionId===k.sessionId&&ae&&Y.upsertThread({...ae,mode:K},{select:!1})}x(k,K);const q=nk(k.draftKey,R,{expected:k.draft,caseSensitivePaths:k.caseSensitivePaths,...k.threadId?{}:{mode:k.nextMode}});if(!q.added)throw new Error(q.reason);return _2(k.projectId),f.current=null,u(null),D.getState().selectWorkspaceTab("assistant"),setTimeout(()=>{const Z=D.getState();Z.hostSessionId===k.sessionId&&Z.activeProjectId===k.projectId&&Z.activeThreadId===k.threadId&&window.dispatchEvent(new CustomEvent("harness:focus-composer"))},0),!0}catch(_){const C=_&&typeof _=="object"&&"data"in _?_.data:void 0,E=D.getState();if(g.current&&p.current===k.generation&&E.hostSessionId===k.sessionId&&E.activeProjectId===k.projectId&&E.activeThreadId===k.threadId&&E.navigationIntentId===k.navigationIntentId&&Dd(k.projectId)===k.annotationVersion&&C&&typeof C=="object"&&"code"in C&&(C.code==="document_annotation_source_stale"||C.code==="document_annotation_source_unavailable")){const O=new Map(k.annotations.map(M=>[M.id,M]));al(k.projectId,$i(k.projectId).map(M=>{const R=O.get(M.id);return R?.hash===M.hash&&R.path===M.path?{...M,stale:!0}:M}))}return g.current&&p.current===k.generation&&s(_ instanceof Error?_.message:"文档批注转交失败,批注已保留。"),!1}finally{m.current=!1,g.current&&r(!1)}};return{pending:n,error:o,confirmation:l,targetThreadTitle:t,prepareTransfer:async()=>{if(m.current)return!1;s(null),u(null),f.current=null;try{const k=D.getState();if(!k.supportsDocumentAnnotations)throw new Error("当前 Host 不支持文档批注,请升级后重试。");if(k.connectionStatus!=="online"||k.activeProjectId!==e)throw new Error("请先连接 Host 并打开批注所属应用。");const _=$i(e);if(!_.length)throw new Error("请先添加文档批注。");if(_.some(J=>J.stale))throw new Error("部分批注需要重新选择,请先更新失效批注。");const C=uc(e,k.activeThreadId),E=k.projects.find(J=>J.id===e)?.rootPath,O=!E||!/^(?:[a-zA-Z]:[\\/]|\\\\)/u.test(E),M=Sa(k.activeThreadId,e),R=ka(M),z=fc(C?C.mode:R.mode),K=z.documentModeConfig.documents.map(J=>({...J})),q=[];for(const J of new Set(_.map(he=>he.path))){if(!Fc(J))throw new Error("只能修改安全的根目录设计 Markdown,不能批注 README 或指令文件。");if(k.supportsDocumentSuggestions)continue;const he=K.find(F=>O?F.fileName===J:F.fileName.toLocaleLowerCase("en-US")===J.toLocaleLowerCase("en-US"));he?.enabled||(q.push(J),he?he.enabled=!0:K.push({id:`custom-${crypto.randomUUID()}`,title:J.slice(0,-3).slice(0,80),fileName:J,enabled:!0,guidance:""}))}const Z={...z,conversationMode:"document",documentModeConfig:ty.parse({...z.documentModeConfig,documents:K})},Y={requiresModeSwitch:z.conversationMode!=="document",filesToEnable:q,targetThreadTitle:t},ae={generation:++p.current,sessionId:k.hostSessionId,projectId:e,threadId:k.activeThreadId,navigationIntentId:k.navigationIntentId,annotationVersion:Dd(e),caseSensitivePaths:O,supportsDocumentSuggestions:k.supportsDocumentSuggestions,annotations:_,draftKey:M,draft:R,mode:z,nextMode:Z,confirmation:Y};if(x(ae),!eg(z,Z)&&Jm(C))throw new Error("对话正在执行任务,不能修改文档模式或清单,请任务结束后重试。");return f.current=ae,Y.requiresModeSwitch||q.length?(u(Y),!1):await y(ae)}catch(k){return s(k instanceof Error?k.message:"无法转交文档批注。"),!1}},confirmTransfer:async()=>f.current?y(f.current):!1,cancelTransfer:()=>{p.current+=1,f.current=null,u(null),s(null)}}}function UE({annotation:e,editing:t=!1,onSave:n,onCancel:r}){const[o,s]=I.useState(e.requirement??""),[l,u]=I.useState(""),f=()=>{if(!o.trim()){u("请填写修改要求。");return}try{n(o.trim())}catch(p){u(p instanceof Error?p.message:"保存批注失败")}};return h.jsx(Tr,{open:!0,title:t?"编辑文档批注":"添加文档批注",description:"批注只加入当前应用的清单,不会自动发送。",onOpenChange:p=>{p||r()},footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",onClick:r,children:"取消"}),h.jsx(Je,{onClick:f,children:"保存批注"})]}),children:h.jsxs("div",{className:"document-annotation-editor",children:[h.jsxs("p",{className:"document-annotation-location",children:[e.path,":",e.startLine,"–",e.endLine]}),h.jsx("p",{className:"document-annotation-location-kind",children:e.locationKind==="exact"?"精确选区":"上下文定位 · 引用最小可信源码范围,可能包含 Markdown 标记"}),h.jsx("blockquote",{"aria-label":"所选文字",children:e.selectedText}),h.jsxs("label",{children:["修改要求",h.jsx("textarea",{autoFocus:!0,required:!0,"aria-label":"修改要求",rows:4,maxLength:Og,value:o,placeholder:"描述这段内容需要如何修改…",onChange:p=>{s(p.target.value),u("")},onKeyDown:p=>{p.nativeEvent.isComposing||(p.key==="Enter"&&(p.ctrlKey||p.metaKey)&&(p.preventDefault(),f()),p.key==="Escape"&&(p.preventDefault(),r()))}})]}),h.jsx("p",{className:"document-annotation-hint",children:"Enter 换行 · Ctrl/⌘+Enter 保存 · Esc 取消"}),l&&h.jsx("p",{role:"alert",className:"document-annotation-error",children:l})]})})}function TW({projectId:e,onLocate:t,onClose:n}){const r=$E(e),o=IW(e),s=D(g=>g.connectionStatus==="online"),l=D(g=>g.supportsDocumentAnnotations),[u,f]=I.useState(null),p=r.find(g=>g.id===u),m=r.some(g=>g.stale);return h.jsxs("aside",{"aria-label":"文档批注列表",className:"document-annotation-panel",children:[h.jsxs("header",{children:[h.jsxs("h3",{children:["文档批注 ",h.jsxs("span",{children:[r.length,"/8"]})]}),h.jsx(At,{label:"收起文档批注",onClick:n,children:h.jsx(ei,{className:"size-4"})})]}),h.jsxs("div",{className:"document-annotation-list",children:[!r.length&&h.jsx("p",{className:"document-annotation-hint",children:"在根目录 Markdown 中选择文字,添加修改意见。可跨文档收集,最多 8 条。"}),h.jsx("ol",{children:r.map((g,x)=>h.jsxs("li",{"data-annotation-id":g.id,children:[h.jsxs("div",{className:"document-annotation-item-heading",children:[h.jsxs("span",{children:[x+1,". ",g.path,":",g.startLine,"–",g.endLine]}),h.jsx(At,{label:"返回原处",onClick:()=>t(g),children:h.jsx(qR,{className:"size-3.5"})})]}),h.jsx("p",{className:"document-annotation-location-kind",children:g.locationKind==="context"?"上下文定位":"精确选区"}),h.jsx("blockquote",{children:g.selectedText}),h.jsx("p",{className:"document-annotation-requirement",children:g.requirement}),g.stale&&h.jsx("p",{className:"document-annotation-error",children:"源码已变化,需重新划词;修改要求已保留。"}),h.jsxs("div",{className:"document-annotation-item-actions",children:[h.jsx(At,{label:"编辑批注",disabled:o.pending,onClick:()=>f(g.id),children:h.jsx(Hv,{className:"size-3.5"})}),h.jsx(At,{label:"删除批注",disabled:o.pending,onClick:()=>b$(e,g.id),children:h.jsx(jf,{className:"size-3.5"})})]})]},g.id))})]}),h.jsxs("footer",{children:[h.jsxs("p",{className:"document-annotation-hint",children:["目标对话:",h.jsx("strong",{children:o.targetThreadTitle})]}),!l&&h.jsx("p",{role:"status",className:"document-annotation-hint",children:"请升级 Host 后使用文档批注。"}),!s&&h.jsx("p",{role:"status",className:"document-annotation-hint",children:"连接 Host 后可转交批注。"}),o.error&&h.jsx("p",{role:"alert",className:"document-annotation-error",children:o.error}),h.jsxs("div",{className:"document-annotation-footer-actions",children:[h.jsx(Je,{variant:"ghost",disabled:!r.length||o.pending,onClick:()=>_2(e),children:"清空批注"}),h.jsxs(Je,{disabled:!r.length||o.pending||!s||!l||m,onClick:()=>{o.prepareTransfer()},children:[h.jsx(yg,{className:"size-3.5"}),o.pending?"正在校验…":"送到 AI 助手"]})]})]}),p&&h.jsx(UE,{annotation:p,editing:!0,onCancel:()=>f(null),onSave:g=>{y$(e,p.id,{requirement:g}),f(null)}},p.id),h.jsx(Tr,{open:!!o.confirmation,title:"确认文档批注转交",description:"只更新文档模式配置并追加草稿,不会自动发送模型请求。",closeDisabled:o.pending,onOpenChange:g=>{g||o.cancelTransfer()},footer:h.jsxs(h.Fragment,{children:[h.jsx(Je,{variant:"ghost",disabled:o.pending,onClick:o.cancelTransfer,children:"取消"}),h.jsx(Je,{disabled:o.pending,onClick:()=>{o.confirmTransfer()},children:"确认并送到 AI 助手"})]}),children:h.jsxs("div",{className:"document-annotation-editor",children:[h.jsxs("p",{children:["目标对话:",o.confirmation?.targetThreadTitle]}),o.confirmation?.requiresModeSwitch&&h.jsx("p",{children:"将目标对话切换为文档模式。"}),!!o.confirmation?.filesToEnable.length&&h.jsxs("div",{children:[h.jsx("p",{children:"纳入本次文档清单:"}),h.jsx("ul",{children:o.confirmation?.filesToEnable.map(g=>h.jsx("li",{children:g},g))})]}),o.error&&h.jsx("p",{role:"alert",className:"document-annotation-error",children:o.error})]})})]})}const jW=I.lazy(async()=>({default:(await $c(()=>import("./LocalMonacoEditor-WKAHQmzG.js").then(t=>t.L),__vite__mapDeps([0,1]))).default}));function yI(e,t,n){const r=[...e.matchAll(/\r\n|\r|\n/gu)],o=t<=1?0:(r[t-2]?.index??e.length)+(r[t-2]?.[0].length??0);return Math.min(e.length,o+n-1)}function CW({file:e}){const t=D(A=>A.theme),n=D(A=>A.activeProjectId),r=D(A=>A.activeThreadId),o=D(A=>A.hostSessionId),s=D(A=>A.route),l=D(A=>A.activeWorkspaceTab),u=D(A=>A.connectionStatus),f=D(A=>A.supportsDocumentAnnotations),p=D(A=>A.pushToast),m=$E(n),[g,x]=I.useState(null),[y,w]=I.useState(!1),[S,T]=I.useState(""),[k,_]=I.useState(document.visibilityState!=="hidden"),[C,E]=I.useState(!1),[O,M]=I.useState(null),[R,z]=I.useState(null),[K,q]=I.useState([]),Z=I.useRef(null),Y=I.useRef(null),ae=I.useRef(null),J=I.useRef(e);J.current=e;const he=/\.md$/iu.test(e.path),F=Fc(e.path)&&!e.isPreview,ee=s==="workbench"&&l===e.id&&k,Q=ee&&F&&!!(n&&/^[a-f0-9]{64}$/iu.test(e.hash??""))&&u==="online"&&f&&!e.loading&&!e.error;I.useEffect(()=>{w(!1),x(null),T(""),M(null)},[n,e.path,e.markdownAnchor]),I.useEffect(()=>{const A=()=>_(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",A),()=>document.removeEventListener("visibilitychange",A)},[]),I.useEffect(()=>{x(null),M(null)},[e.hash,e.content,o]),I.useEffect(()=>{Q||(M(null),x(null))},[Q]),I.useEffect(()=>()=>ae.current?.dispose(),[]),I.useEffect(()=>{n&&e.hash&&!e.loading&&m.some(A=>A.path===e.path&&A.hash!==e.hash&&!A.stale)&&Ty(n,e.path)},[n,m,e.path,e.hash,e.loading]);const xe=I.useCallback(A=>{Y.current=A,ae.current?.dispose();const L=()=>{const X=A.getSelection(),ue=J.current;if(!X||X.isEmpty()){x(null);return}const we=bY(ue.content,yI(ue.content,X.startLineNumber,X.startColumn),yI(ue.content,X.endLineNumber,X.endColumn));x(we?{...we,content:we.selectedText}:null)};ae.current=A.onDidChangeCursorSelection(L)},[]),P=I.useCallback(()=>{if(!Q||y||O)return;const A=Z.current,L=A?.ownerDocument.getSelection(),X=L?.rangeCount?L.getRangeAt(0):null,ue=A&&X?xY(A,e.content,X):null;T(A&&X&&A.contains(X.startContainer)&&A.contains(X.endContainer)&&X.toString().trim()&&!ue?"这段内容无法可靠定位到源码,请切换“源码”后选择。":""),x(ue?{...ue,content:e.content.slice(ue.startOffset,ue.endOffset)}:null)},[Q,y,O,e.content]);I.useEffect(()=>{if(!(!Q||y||O))return document.addEventListener("selectionchange",P),()=>document.removeEventListener("selectionchange",P)},[Q,y,O,P]),I.useEffect(()=>{const A=Z.current;if(!A||!ee||y||!Q||!m.length||A.closest("[hidden]")){q([]);return}let L=0;const X=()=>{if(L=0,A.closest("[hidden]")){q([]);return}const ge=A.getBoundingClientRect(),Se=[];for(const B of m)if(!(B.path!==e.path||B.hash!==e.hash||B.stale||B.startOffset===void 0||B.endOffset===void 0))for(const U of lI(A,B.startOffset,B.endOffset))for(const ve of Array.from(U.getClientRects?.()??[]))ve.bottom<ge.top||ve.top>ge.bottom||ve.right<ge.left||ve.left>ge.right||Se.push({left:ve.left-ge.left,top:ve.top-ge.top,width:ve.width,height:ve.height,id:B.id,context:B.locationKind==="context"});q(Se)},ue=()=>{L||(L=requestAnimationFrame(X))},we=typeof ResizeObserver>"u"?null:new ResizeObserver(ue);return we?.observe(A),A.firstElementChild&&we?.observe(A.firstElementChild),A.addEventListener("scroll",ue,!0),window.addEventListener("resize",ue),window.visualViewport?.addEventListener("resize",ue),ue(),()=>{L&&cancelAnimationFrame(L),we?.disconnect(),A.removeEventListener("scroll",ue,!0),window.removeEventListener("resize",ue),window.visualViewport?.removeEventListener("resize",ue)}},[ee,Q,y,m,e.path,e.hash,e.content,C]),I.useEffect(()=>{const A=R??(n?yY(n):void 0);if(!(!A||A.path!==e.path||e.loading||!ee)){if(A.hash!==e.hash||A.stale){p({title:"源码已变化,需重新划词",description:"不会跳转到可能失效的旧行号。",tone:"neutral"}),n&&aI(n,A.id),z(null);return}y&&Y.current?(Y.current.revealLineInCenter(A.startLine),Y.current.setSelection({startLineNumber:A.startLine,startColumn:1,endLineNumber:A.endLine,endColumn:1})):Z.current&&A.startOffset!==void 0&&A.endOffset!==void 0&&lI(Z.current,A.startOffset,A.endOffset)[0]?.startContainer.parentElement?.scrollIntoView?.({block:"center",behavior:"instant"}),n&&aI(n,A.id),z(null)}},[R,n,e.path,e.hash,e.loading,e.content,ee,y,p]);const $=()=>{const A=Qg(Sa(r,n),g?{path:e.path,startLine:g.startLine,endLine:g.endLine,snapshot:g.content,...n?{projectId:n}:{},...e.hash?{hash:e.hash}:{}}:{path:e.path,snapshot:e.content,...n?{projectId:n}:{},...e.hash?{hash:e.hash}:{}});if(!A.added){p({title:"无法附加文件",description:A.reason??"附件数量已达到上限。",tone:"neutral"});return}p({title:g?"已引用所选代码":"已附加整个文件",description:g?`${e.path}:${g.startLine}-${g.endLine}`:e.path,tone:"success"})},te=()=>{if(!Q||!g||!n||!e.hash)return;const{content:A,...L}=g;M({projectId:n,hostSessionId:o,annotation:{...L,path:e.path,hash:e.hash}})};return h.jsxs("section",{className:"flex h-full min-h-0 flex-col",children:[h.jsxs("div",{className:"flex min-h-10 shrink-0 flex-wrap items-center justify-between gap-1 border-b border-[var(--border)] bg-[var(--workspace)] px-3",children:[h.jsxs("div",{className:"flex min-w-0 items-center gap-2 type-meta text-[var(--muted-fg)]",children:[h.jsx(LT,{className:"size-3.5 text-[var(--status-info-fg)]"}),h.jsx("span",{className:"truncate",children:e.path}),e.isPreview&&h.jsx("span",{className:"rounded border border-[var(--status-warning-border)] bg-[var(--status-warning-bg)] px-1.5 py-0.5 type-meta text-[var(--status-warning-fg)]",children:"离线预览"}),h.jsx("span",{className:"rounded border border-[var(--border)] px-1.5 py-0.5 type-meta uppercase tracking-wide text-[var(--dim-fg)]",children:"只读"})]}),h.jsxs("div",{className:"flex items-center gap-1",children:[he&&h.jsxs("div",{role:"group","aria-label":"Markdown 查看方式",className:"flex shrink-0 gap-1",children:[h.jsx(Je,{variant:y?"ghost":"secondary",className:"h-7 px-2","aria-pressed":!y,onClick:()=>{w(!1),x(null)},children:"预览"}),h.jsx(Je,{variant:y?"secondary":"ghost",className:"h-7 px-2","aria-pressed":y,onClick:()=>{w(!0),x(null)},children:"源码"})]}),n&&(F||m.length>0)&&h.jsxs(Je,{variant:C?"secondary":"ghost",className:"h-7 px-2","aria-label":"文档批注","aria-expanded":C,onClick:()=>E(A=>!A),children:[h.jsx(yg,{className:"size-3.5"}),"批注 ",m.length,"/8"]}),h.jsx(At,{label:"复制文件路径",onClick:()=>{navigator.clipboard.writeText(e.path).then(()=>p({title:"已复制文件路径",tone:"success"}))},children:h.jsx(pO,{className:"size-3.5"})}),h.jsxs(Je,{variant:"secondary",className:"h-7 px-2.5",onClick:$,disabled:!!(e.loading||e.error),children:[h.jsx(Wd,{className:"size-3"}),g?`引用 ${g.startLine}–${g.endLine} 行`:"附加到对话"]})]})]}),F&&!f&&h.jsx("p",{role:"status",className:"document-annotation-availability",children:"当前 Host 不支持文档批注,请升级 Host;仍可复制或附加到对话。"}),F&&f&&u!=="online"&&h.jsx("p",{role:"status",className:"document-annotation-availability",children:"连接 Host 后可划词批注。"}),he&&!F&&h.jsx("p",{role:"status",className:"document-annotation-availability",children:"此文档仅供只读参考,不支持批注(仅支持根目录设计 Markdown,不含 README 或指令文件);仍可附加到对话。"}),S&&h.jsx("p",{role:"status",className:"document-annotation-availability",children:S}),h.jsxs("div",{className:"document-annotation-workspace",children:[h.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1 bg-[var(--editor)]",children:[e.loading?h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 type-ui text-[var(--muted-fg)]",children:[h.jsx(Ot,{className:"size-5 animate-spin text-[var(--accent)]"}),"正在读取文件…"]}):e.error?h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 text-center",children:[h.jsx(MO,{className:"size-7 text-[var(--status-danger-fg)]"}),h.jsxs("div",{children:[h.jsx("p",{className:"type-ui font-medium text-[var(--fg)]",children:"无法打开文件"}),h.jsx("p",{className:"mt-1 max-w-md type-meta text-[var(--muted-fg)]",children:e.error})]}),h.jsxs(Je,{variant:"secondary",disabled:u!=="online"||!n,onClick:()=>n&&void zc(n,e.path,e.name),children:[h.jsx(YT,{className:"size-3"}),"重新加载"]})]}):he&&!y?h.jsx("div",{ref:Z,"aria-label":"Markdown 文档预览",tabIndex:0,onMouseUp:P,onKeyUp:P,className:"h-full overflow-auto bg-[var(--workspace)] p-5",children:h.jsx(ob,{content:e.content,filePath:e.path,sourceMapping:!!Q,...e.markdownAnchor?{anchor:e.markdownAnchor}:{}})}):h.jsx(I.Suspense,{fallback:h.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-2 type-ui text-[var(--muted-fg)]",children:[h.jsx(Ot,{className:"size-4 animate-spin"}),"正在加载 Monaco…"]}),children:h.jsx(jW,{path:e.path,language:e.language,value:e.content,theme:t==="dark"?"vs-dark":"light",onMount:xe,options:{readOnly:!0,domReadOnly:!0,minimap:{enabled:!1},fontFamily:"JetBrains Mono, Cascadia Code, Consolas, monospace",fontSize:12,lineHeight:20,renderLineHighlight:"line",scrollBeyondLastLine:!1,smoothScrolling:!0,automaticLayout:!0,padding:{top:14,bottom:14},overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,bracketPairColorization:{enabled:!0},guides:{indentation:!0,bracketPairs:!1},stickyScroll:{enabled:!0}}})}),!y&&h.jsx("div",{className:"document-annotation-highlights","aria-hidden":"true",children:K.map((A,L)=>h.jsx("span",{"data-context":A.context,style:{left:A.left,top:A.top,width:A.width,height:A.height}},`${A.id}:${L}`))}),Q&&g&&!O&&h.jsxs("div",{className:"document-annotation-selection-action",children:[h.jsxs(Je,{disabled:m.length>=8,onMouseDown:A=>A.preventDefault(),onClick:te,children:[h.jsx(yg,{className:"size-3.5"}),"添加修改意见"]}),h.jsx("span",{children:m.length>=8?"最多 8 条,请先删除或转交":`${e.path}:${g.startLine}–${g.endLine} · ${g.locationKind==="exact"?"精确选区":"上下文定位"}`})]})]}),C&&n&&h.jsx(TW,{projectId:n,onClose:()=>E(!1),onLocate:A=>{vY(n,A),z(A),A.path!==e.path&&zc(n,A.path)}},n)]}),h.jsxs("div",{className:"flex h-6 shrink-0 items-center justify-between border-t border-[var(--border)] bg-[var(--panel)] px-3 type-meta text-[var(--dim-fg)]",children:[h.jsx("span",{children:g?`已选择 ${g.endLine-g.startLine+1} 行`:`${e.content.split(`
212
+ `).length} 行`}),h.jsxs("span",{children:[e.language," · UTF-8 · ",e.content.includes(`\r
213
+ `)?"CRLF":"LF"]})]}),O&&h.jsx(UE,{annotation:O.annotation,onCancel:()=>M(null),onSave:A=>{const L=D.getState();if(L.activeProjectId!==O.projectId||L.hostSessionId!==O.hostSessionId||!Q||e.path!==O.annotation.path||e.hash!==O.annotation.hash)throw new Error("文档或连接已变化,请重新划词。");v$(O.projectId,{...O.annotation,requirement:A}),M(null),x(null),E(!0),Z.current?.ownerDocument.getSelection()?.removeAllRanges()}})]})}const bI=1,EW="harness.preview-annotations.ready",_W="harness.preview-annotations.candidates",xI="harness.preview-annotations.candidates-result",AW="harness.preview-annotations.sync",wI="harness.preview-annotations.mode",MW="harness.preview-annotations.modifier",NW="harness.preview-annotations.cancel",PW="harness.preview-annotations.state",RW="harness.preview-annotations.submit",OW="harness.preview-annotations.mode-changed",SI=128*1024;function ub(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function HE(e){if(!(!ub(e)||typeof e.token!="string"||e.token.length>4096||typeof e.elementType!="string"||e.elementType.length>120||typeof e.visibleText!="string"||e.visibleText.length>160||!Number.isSafeInteger(e.tokenIndex)||e.tokenIndex<0||typeof e.score!="number"||!Number.isFinite(e.score)))return e}function zW(e,t){const n=HE(e);if(!n||!ub(e)||typeof e.id!="string"||e.id.length>160||typeof e.requirement!="string"||!e.requirement.trim()||e.requirement.length>4e3||typeof e.path!="string"||e.path.length>1024||!Number.isSafeInteger(e.startLine)||!Number.isSafeInteger(e.endLine))return;const r=Number.isSafeInteger(e.previewRevision)&&e.previewRevision>=0?e.previewRevision:t;return{...n,id:e.id,requirement:e.requirement.trim(),path:e.path,startLine:e.startLine,endLine:e.endLine,previewRevision:r,...e.stale===!0||r!==t?{stale:!0}:{}}}function DW(e){let t=!1,n=!1,r=e.initialAnnotations;const o=u=>{t||e.frameWindow.postMessage({...u,version:bI,channelId:e.channelId},"*")},s=u=>{r=u,o({type:AW,annotations:u})},l=u=>{if(t||u.source!==e.frameWindow||u.origin!=="null"||!ub(u.data))return;let f=SI+1;try{f=new TextEncoder().encode(JSON.stringify(u.data)).byteLength}catch{return}if(!(f>SI||u.data.version!==bI||u.data.channelId!==e.channelId)){if(u.data.type===EW){o({type:wI,locked:n}),s(r);return}if(u.data.type===_W&&typeof u.data.requestId=="string"&&u.data.requestId.length<=160&&Array.isArray(u.data.candidates)){const p=u.data.requestId,m=u.data.candidates.map(HE);if(m.length===0||m.length>5||m.some(x=>!x))return;const g=m;e.resolve(g.map(x=>x.token)).then(x=>{if(x.length!==g.length)throw new Error("Host 返回的圈选候选数量不一致");o({type:xI,requestId:p,candidates:g.map((y,w)=>{const S=x[w];if(!S||S.token!==y.token||!S.reference.startLine||!S.reference.endLine)throw new Error("Host 返回的圈选候选顺序或行号无效");return{...y,path:S.reference.path,startLine:S.reference.startLine,endLine:S.reference.endLine}})})}).catch(x=>{const y=x instanceof Error?x.message:"无法解析圈选源码";o({type:xI,requestId:p,error:y}),e.onError(y)});return}if(u.data.type===PW&&Array.isArray(u.data.annotations)){if(u.data.annotations.length>8)return;const p=u.data.annotations.map(m=>zW(m,e.previewRevision));if(p.some(m=>!m))return;r=p,e.onAnnotations(r);return}u.data.type===RW&&e.onSubmit(),u.data.type===OW&&typeof u.data.locked=="boolean"&&typeof u.data.active=="boolean"&&(n=u.data.locked,e.onModeChanged?.({locked:n,active:u.data.active}))}};return window.addEventListener("message",l),{setLocked(u){n=u,o({type:wI,locked:n})},setModifier(u){o({type:MW,active:u})},cancel(){o({type:NW})},sync:s,requestSubmit(){e.onSubmit()},dispose(){t=!0,window.removeEventListener("message",l)}}}const Yr=1,LW="harness.runtime-storage.ready",BW="harness.runtime-storage.initialize",qW="harness.runtime-storage.mutation",$W="harness.runtime-storage.result",UW="harness.runtime-storage.v1:",FE=128,VE=512,ZE=256*1024,KE=512,dv=1024*1024,HW=128,fv=new Map,hf=new Set,FW=new TextEncoder;function Qn(e){return FW.encode(e).byteLength}function Hd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function VW(){return{version:Yr,namespaces:Object.create(null)}}function pv(e){const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]=Object.assign(Object.create(null),r);return t}function ZW(e){if(!(e===null||Qn(e)>dv*2))try{const t=JSON.parse(e);if(!Hd(t)||t.version!==Yr||!Hd(t.namespaces))return;const n=Object.create(null);let r=0,o=0;for(const[s,l]of Object.entries(t.namespaces)){if(Qn(s)===0||Qn(s)>FE||!Hd(l))return;const u=Object.create(null);for(const[f,p]of Object.entries(l)){if(typeof p!="string"||Qn(f)===0||Qn(f)>VE)return;const m=Qn(p);if(m>ZE||(r+=1,o+=Qn(s)+Qn(f)+m,r>KE||o>dv))return;u[f]=p}n[s]=u}return{version:Yr,namespaces:n}}catch{return}}function KW(e){if(e!==void 0)return e;try{return window.localStorage}catch{return}}function QE(e){return`${UW}${encodeURIComponent(e)}`}function kI(e,t){const n=QE(e);if(t!==void 0&&!hf.has(e))try{const o=ZW(t.getItem(n));if(o!==void 0)return fv.set(e,o),{version:Yr,namespaces:pv(o.namespaces)}}catch{hf.add(e)}const r=fv.get(e);return r===void 0?VW():{version:Yr,namespaces:pv(r.namespaces)}}function QW(e,t,n){const r={version:Yr,namespaces:pv(n.namespaces)};if(fv.set(e,r),t===void 0)return!0;try{return t.setItem(QE(e),JSON.stringify(r)),hf.delete(e),!0}catch{return hf.add(e),!1}}function yc(e,t){return typeof e=="string"&&Qn(e)>0&&Qn(e)<=t}function GW(e){let t=0,n=0;for(const[r,o]of Object.entries(e))for(const[s,l]of Object.entries(o))t+=1,n+=Qn(r)+Qn(s)+Qn(l);return{count:t,bytes:n}}function YW(e,t){const n=t.namespace;if(!yc(n,FE))return{ok:!1,error:"invalid_namespace"};const r=t.operation;if(r!=="set"&&r!=="remove"&&r!=="clear")return{ok:!1,error:"invalid_operation"};if(r==="clear")return delete e.namespaces[n],{ok:!0};const o=t.key;if(!yc(o,VE))return{ok:!1,error:"invalid_key"};if(r==="remove"){const p=e.namespaces[n];return p!==void 0&&(delete p[o],Object.keys(p).length===0&&delete e.namespaces[n]),{ok:!0}}const s=t.value;if(typeof s!="string"||Qn(s)>ZE)return{ok:!1,error:"value_too_large"};const l=e.namespaces[n]??=Object.create(null),u=l[o];l[o]=s;const f=GW(e.namespaces);return f.count>KE||f.bytes>dv?(u===void 0?delete l[o]:l[o]=u,Object.keys(l).length===0&&delete e.namespaces[n],{ok:!1,error:"scope_quota_exceeded"}):{ok:!0}}function II(e,t){try{e.postMessage(t,"*")}catch{}}function WW(e){if(!yc(e.scopeId,512))throw new Error("Runtime storage scope is invalid");if(!yc(e.channelId,128))throw new Error("Runtime storage channel is invalid");const t=e.hostWindow??window,n=KW(e.storage);let r=!1;const o=()=>{if(r)return;const l=kI(e.scopeId,n);II(e.frameWindow,{type:BW,version:Yr,channelId:e.channelId,namespaces:l.namespaces})},s=l=>{if(r||l.source!==e.frameWindow||l.origin!=="null"||!Hd(l.data))return;if(l.data.type===LW&&l.data.version===Yr&&l.data.channelId===e.channelId){o();return}if(l.data.type!==qW||l.data.version!==Yr||l.data.channelId!==e.channelId)return;const u=l.data.requestId;if(!yc(u,HW))return;const f=kI(e.scopeId,n),p=YW(f,l.data),m=p.ok&&QW(e.scopeId,n,f);II(e.frameWindow,{type:$W,version:Yr,channelId:e.channelId,requestId:u,ok:p.ok&&m,...p.ok?m?{}:{error:"parent_storage_unavailable"}:{error:p.error}})};return t.addEventListener("message",s),{dispose:()=>{r||(r=!0,t.removeEventListener("message",s))}}}function XW(){return crypto.randomUUID()}const JW=8,$s=new Map,hv=new Set,mv=[];function db(){for(const e of hv)e()}function Fd(e){return $s.get(e)??mv}function gv(e,t){t.length===0?$s.delete(e):$s.set(e,t.slice(0,JW)),db()}function TI(e,t){const n=$s.get(e);if(!n)return;const r=n.map(o=>o.previewRevision===t?o:{...o,stale:!0});r.some((o,s)=>o!==n[s])&&($s.set(e,r),db())}function eX(e){$s.delete(e)&&db()}function tX(e){return I.useSyncExternalStore(t=>(hv.add(t),()=>hv.delete(t)),()=>e?Fd(e):mv,()=>mv)}const nX={stopped:"已停止",starting:"正在启动",running:"运行中",restarting:"正在重启",failed:"启动失败"},rX={stopped:"neutral",starting:"info",running:"success",restarting:"warning",failed:"danger"},iX={idle:"等待编译",compiling:"正在编译",success:"编译通过",failed:"编译失败"},oX={idle:"neutral",compiling:"info",success:"success",failed:"danger"};function jI(e){if(e.path)return e.line?`${e.path}:${e.line}${e.column?`:${e.column}`:""}`:e.path}function aX(e,t){const n=Date.parse(e),r=Date.parse(t);return Number.isFinite(n)&&Number.isFinite(r)&&n>r}function tg({diagnostics:e}){if(e.length===0)return null;const t=e.slice(0,5);return h.jsxs("ul",{"aria-label":"编译诊断",className:"mt-2 space-y-1 font-mono type-meta",children:[t.map((n,r)=>h.jsxs("li",{className:"break-words",children:[jI(n)&&h.jsxs("span",{className:"font-semibold",children:[jI(n)," "]}),n.code!==void 0&&h.jsxs("span",{children:["[",n.code,"] "]}),n.message]},`${n.source}:${n.code??""}:${n.path??""}:${n.line??""}:${r}`)),e.length>t.length&&h.jsxs("li",{children:["另有 ",e.length-t.length," 条诊断,请修复后重新编译。"]})]})}function sX({compileState:e,exportResult:t}){const n=e?.successfulSourceRevision!==void 0;return h.jsxs("div",{className:"max-h-[42%] shrink-0 space-y-2 overflow-y-auto px-3 py-2 empty:hidden",children:[e?.status==="failed"&&h.jsxs(On,{role:"status",tone:"danger",icon:h.jsx(BT,{className:"size-4"}),className:"px-3 py-2",children:[h.jsx("p",{className:"font-medium",children:n?`版本 ${e.sourceRevision} 未通过,预览仍固定在版本 ${e.successfulSourceRevision}。`:`版本 ${e.sourceRevision} 未通过;尚无通过检查的版本,当前显示安全空壳。`}),h.jsx(tg,{diagnostics:e.diagnostics})]}),e?.status==="compiling"&&h.jsx(On,{role:"status",tone:"info",className:"px-3 py-2",children:n?`正在检查版本 ${e.sourceRevision},预览仍为版本 ${e.successfulSourceRevision}。`:`正在检查版本 ${e.sourceRevision};尚无通过检查的版本,当前显示安全空壳。`}),e?.status==="success"&&e.diagnostics.length>0&&h.jsxs(On,{role:"status",tone:"warning",className:"px-3 py-2",children:[h.jsxs("p",{className:"font-medium",children:["编译成功,但有 ",e.diagnostics.length," 条提示。"]}),h.jsx(tg,{diagnostics:e.diagnostics})]}),t?.status==="succeeded"&&h.jsxs(On,{role:"status",tone:"success",className:"px-3 py-2",children:["静态站点已导出到 ",h.jsx("code",{className:"break-all font-mono type-meta",children:t.outputPath}),"。"]}),t?.status==="failed"&&h.jsxs(On,{role:"status",tone:"danger",icon:h.jsx(Mi,{className:"size-4"}),className:"px-3 py-2",children:[h.jsxs("p",{className:"font-medium",children:["静态站点导出失败:",t.error]}),h.jsx(tg,{diagnostics:t.diagnostics})]})]})}function lX(e){if(e)try{const t=new URL(e);return!(t.hostname==="127.0.0.1"||t.hostname==="localhost"||t.hostname==="[::1]")||t.protocol!=="http:"&&t.protocol!=="https:"||t.username||t.password||typeof window<"u"&&t.origin===window.location.origin?void 0:t.href}catch{return}}function Ei({icon:e,title:t,description:n,children:r}){return h.jsx("div",{className:"flex h-full min-h-[360px] items-center justify-center p-8",children:h.jsxs("div",{className:"flex max-w-lg flex-col items-center text-center",children:[h.jsx("span",{className:"mb-4 flex size-12 items-center justify-center rounded-2xl border border-[var(--border)] bg-[var(--card)] text-[var(--accent-soft)] shadow-sm",children:e}),h.jsx("h2",{className:"text-[16px] font-semibold text-[var(--fg)]",children:t}),h.jsx("p",{className:"mt-2 type-ui leading-5 text-[var(--muted-fg)]",children:n}),r&&h.jsx("div",{className:"mt-5 flex items-center gap-2",children:r})]})})}function cX({projectId:e,src:t,previewRevision:n,visible:r,annotations:o,onController:s,onSubmit:l,onModeChanged:u,onError:f}){const p=I.useRef(null),m=I.useRef(null),g=I.useRef({annotations:o,onController:s,onSubmit:l,onModeChanged:u,onError:f});g.current={annotations:o,onController:s,onSubmit:l,onModeChanged:u,onError:f};const[x]=I.useState(XW);return I.useLayoutEffect(()=>{const y=p.current;if(y===null)return;const w=new URL(t,window.location.href);w.searchParams.set("__harness_runtime_storage_channel",x),y.src=w.toString();const S=y.contentWindow;if(S==null)return;const T=WW({scopeId:e,channelId:x,frameWindow:S});return()=>T.dispose()},[x,e,t]),I.useLayoutEffect(()=>{const y=p.current?.contentWindow;if(!r||!y)return;const w=DW({channelId:x,frameWindow:y,previewRevision:n,initialAnnotations:g.current.annotations,resolve:async S=>await Sr.resolvePreviewAnnotations(e,n,S),onAnnotations:S=>gv(e,S),onSubmit:()=>g.current.onSubmit(),onModeChanged:S=>g.current.onModeChanged(S),onError:S=>g.current.onError(S)});return m.current=w,g.current.onController(w),()=>{w.setModifier(!1),w.setLocked(!1),w.cancel(),w.dispose(),m.current=null,g.current.onController(null)}},[x,n,e,t,r]),I.useEffect(()=>{m.current?.sync(o)},[o]),h.jsx("iframe",{ref:p,title:"页面预览",src:"about:blank",sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-downloads",referrerPolicy:"no-referrer",className:"h-full w-full border-0 bg-white"})}function uX({projectId:e,visible:t=!0}){const[n,r]=I.useState(0),[o,s]=I.useState(),l=D(L=>e??L.activeProjectId),u=D(L=>L.projects.find(X=>X.id===l)),f=D(L=>L.hostSessionId),p=D(L=>L.connectionStatus==="online"),m=D(L=>L.supportsProjectPreviewPool&&l?L.previewRevisionsByProjectId?.[l]??L.previewSessionsByProjectId[l]?.revision??L.previewRevision:L.previewRevision),g=D(L=>l?L.previewSessionsByProjectId[l]:void 0),x=D(L=>l?L.frontendCompileStatesByProjectId[l]:void 0),y=g?.revision===m?g:void 0,w=y?x:void 0,S=D(L=>L.setPreviewSession),T=D(L=>L.pushToast),k=D(L=>L.activeThreadId),_=D(L=>L.threads.find(X=>X.id===L.activeThreadId)),C=D(L=>L.selectWorkspaceTab),E=tX(l),O=I.useRef(null),[M,R]=I.useState({locked:!1,active:!1}),z=lr({queryKey:["preview",l,"status",f],queryFn:async()=>({snapshot:await Sr.previewStatus(l??""),hostSessionId:f}),enabled:t&&p&&!!l,retry:1,staleTime:3e4});I.useEffect(()=>{!l||!z.data||z.data.hostSessionId!==D.getState().hostSessionId||S(l,z.data.snapshot.session,z.data.snapshot.revision)},[l,S,z.data]),I.useEffect(()=>r(0),[l]),I.useEffect(()=>{l&&TI(l,m)},[l,m]),I.useEffect(()=>{if(!t)return;const L=ge=>O.current?.setModifier(ge),X=ge=>{(ge.key==="Control"||ge.key==="Meta")&&L(!0),ge.key==="Escape"&&O.current?.cancel()},ue=ge=>{(ge.key==="Control"||ge.key==="Meta")&&L(ge.ctrlKey||ge.metaKey)},we=()=>L(!1);return window.addEventListener("keydown",X,!0),window.addEventListener("keyup",ue,!0),window.addEventListener("blur",we),()=>{window.removeEventListener("keydown",X,!0),window.removeEventListener("keyup",ue,!0),window.removeEventListener("blur",we)}},[t]),I.useEffect(()=>{if(!t||!p||!l||E.length===0||E.some(X=>X.stale))return;if(E.some(X=>X.previewRevision!==m)){TI(l,m);return}let L=!1;return Sr.resolvePreviewAnnotations(l,m,E.map(X=>X.token)).catch(X=>{if(L)return;const ue=typeof X=="object"&&X!==null&&"data"in X&&typeof X.data=="object"&&X.data!==null?X.data:void 0;typeof ue?.code=="string"&&ue.code.startsWith("preview_annotation_")&&gv(l,E.map(we=>({...we,stale:!0})))}),()=>{L=!0}},[l,E,w?.sourceRevision,p,m,t]);const K=(L,X)=>T({title:L,description:X instanceof Error?X.message:"Host 返回未知错误",tone:"danger"}),q=(L,X,ue)=>{if(ue===D.getState().hostSessionId){if(X.session&&X.session.projectId!==L){K("预览状态无效",new Error("Host 返回了其他项目的预览会话"));return}S(L,X.session,X.revision)}},Z=vn({mutationFn:async L=>{const X=D.getState().hostSessionId;return{snapshot:await Sr.ensurePreview(L),sessionId:X}},onSuccess:(L,X)=>q(X,L.snapshot,L.sessionId),onError:L=>K("预览没有启动",L)}),Y=vn({mutationFn:async L=>{const X=D.getState().hostSessionId;return{snapshot:await Sr.restartPreview(L),sessionId:X}},onSuccess:(L,X)=>q(X,L.snapshot,L.sessionId),onError:L=>K("预览重启失败",L)}),ae=vn({mutationFn:async L=>{const X=D.getState().hostSessionId;return{snapshot:await Sr.stopPreview(L),sessionId:X}},onSuccess:(L,X)=>q(X,L.snapshot,L.sessionId),onError:L=>K("预览停止失败",L)}),J=vn({mutationFn:({projectId:L})=>Sr.exportFrontend(L),onSuccess:(L,X)=>{if(L.projectId!==X.projectId){K("导出结果无效",new Error("Host 返回了其他项目的导出结果"));return}s({...X,result:L}),L.status==="succeeded"?T({title:"静态站点已导出",description:L.outputPath??"dist",tone:"success"}):T({title:"静态站点导出失败",description:L.error??"Host 未返回失败原因",tone:"danger"})},onError:L=>K("静态站点导出失败",L)}),he=vn({mutationFn:async({projectId:L,revision:X,threadId:ue})=>{const we=D.getState().hostSessionId,ge=Fd(L);if(ge.length===0)throw new Error("还没有圈选修改内容。");if(ge.some(ve=>ve.stale||ve.previewRevision!==X))throw new Error("有标注对应的预览或源码已变化,请重新圈选后再提交。");const Se=await Sr.resolvePreviewAnnotations(L,X,ge.map(ve=>ve.token));if(we!==D.getState().hostSessionId)throw new Error("Host 连接已更换,请重新校验标注。");if(Fd(L)!==ge)throw new Error("圈选内容已变化,请重新提交。");if(Se.length!==ge.length)throw new Error("Host 返回的圈选解析结果不完整。");const B=Sa(ue,L),U=HH(B,ge.map((ve,_e)=>{const qe=Se[_e];if(!qe||qe.token!==ve.token)throw new Error("圈选解析结果顺序不一致,请重试。");const Qe=qe.reference,ze=Qe.startLine===Qe.endLine?`${Qe.startLine}`:`${Qe.startLine}-${Qe.endLine}`,ut=ve.visibleText?`“${ve.visibleText}”`:"",Kt=ve.elementType.split("[",1)[0],Ft=Kt==="button"?"按钮":Kt==="a"?"链接":Kt==="input"?"输入框":`元素 ${ve.elementType}`;return{text:`${Qe.path}:${ze} · ${Ft}${ut}:${ve.requirement}`,reference:Qe}}));if(!U.added)throw new Error(U.reason??"圈选修改未能加入草稿。");return{projectId:L,threadId:ue,sessionId:we}},onSuccess:({projectId:L,threadId:X,sessionId:ue})=>{if(D.getState().hostSessionId!==ue)return;eX(L);const we=D.getState();we.activeProjectId===L&&we.activeThreadId===X&&(C("assistant"),window.setTimeout(()=>{const ge=D.getState();ge.activeProjectId===L&&ge.activeThreadId===X&&window.dispatchEvent(new CustomEvent("harness:focus-composer"))},0)),T({title:"圈选修改已加入草稿",description:"请确认内容后按回车发送,系统不会自动提交。",tone:"success"})},onError:(L,X)=>{const ue=typeof L=="object"&&L!==null&&"data"in L&&typeof L.data=="object"&&L.data!==null?L.data:void 0;typeof ue?.code=="string"&&ue.code.startsWith("preview_annotation_")&&gv(X.projectId,Fd(X.projectId).map(we=>({...we,stale:!0}))),K("圈选修改没有转移",L)}}),F=()=>{if(!t||!l||D.getState().activeProjectId!==l)return;const L=_?.projectId===l?k:null;he.mutate({projectId:l,revision:m,threadId:L})},ee=L=>{O.current=L,L&&L.setLocked(t&&M.locked)},Q=z.isFetching||Z.isPending||Y.isPending||ae.isPending,xe=y?.status==="running"?lX(y.url):void 0,P=!!(y?.runtime||w),$=w?.status==="success"&&w.diagnostics.some(L=>L.code==="HARNESS_NO_PAGES"),te=o?.result.status==="succeeded"&&o.result.exportedAt!==void 0&&w!==void 0&&aX(w.updatedAt,o.result.exportedAt),A=o?.projectId===l&&o.previewRevision===m&&!te?o.result:void 0;return!l||!u?h.jsx("section",{"aria-label":"页面预览",className:"h-full bg-[var(--workspace)]",children:h.jsx(Ei,{icon:h.jsx(Od,{className:"size-5"}),title:"尚未选择项目",description:"选择一个项目后即可启动页面预览。"})}):h.jsxs("section",{"aria-label":"页面预览",className:"flex h-full min-h-0 flex-col bg-[var(--workspace)]",children:[h.jsxs("div",{className:"flex min-h-10 shrink-0 flex-wrap items-center gap-2 border-b border-[var(--border)] bg-[var(--panel)] px-3 py-1",children:[h.jsx("span",{className:"min-w-[96px] flex-1 truncate type-ui text-[var(--subtle-fg)]",children:u.name}),y?.runtime&&h.jsxs(hc,{tone:"neutral",children:["Runtime ",y.runtime.version]}),y&&h.jsx(hc,{tone:rX[y.status],children:nX[y.status]}),w&&h.jsx(hc,{tone:$?"neutral":oX[w.status],children:$?"尚无页面":iX[w.status]}),xe&&P&&!$&&h.jsxs("button",{type:"button","aria-label":"画圈修改","aria-pressed":M.locked,title:"进入后按住鼠标直接画圈;也可按住 Ctrl/⌘ 临时圈选",onClick:()=>{const L=!M.locked;R({locked:L,active:L}),O.current?.setLocked(L)},className:Me("inline-flex h-8 items-center gap-1.5 rounded-xl border px-2.5 type-meta shadow-sm backdrop-blur-md transition",M.active?"border-[var(--accent)]/70 bg-[var(--accent)]/20 text-[var(--accent-soft)] shadow-[0_0_18px_rgba(112,87,255,0.18)]":"border-[var(--border)] bg-[var(--card)]/75 text-[var(--muted-fg)] hover:border-[var(--border-strong)] hover:bg-[var(--hover)] hover:text-[var(--fg)]"),children:[h.jsx(JO,{className:"size-3.5"}),"画圈修改",E.length>0&&h.jsx("span",{className:"rounded-full bg-[var(--accent)] px-1.5 py-0.5 text-[10px] leading-none text-white",children:E.length})]}),E.length>0&&P&&h.jsxs(Je,{variant:"secondary",disabled:he.isPending||E.some(L=>L.stale),title:E.some(L=>L.stale)?"存在需重新圈选的失效标注":"追加到 AI 助手草稿",onClick:F,className:"h-8 px-2 type-meta",children:[he.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin"}):null,"送到 AI 助手"]}),P&&h.jsx(At,{label:"导出静态站点","aria-busy":J.isPending,disabled:!p||J.isPending||$,onClick:()=>J.mutate({projectId:l,previewRevision:m}),children:J.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(UT,{className:"size-3.5"})}),xe&&h.jsx(At,{label:"刷新预览",disabled:Q,onClick:()=>r(L=>L+1),children:h.jsx(Ws,{className:"size-3.5"})}),y&&y.status!=="stopped"&&h.jsx(At,{label:"重启预览",disabled:!p||Q,onClick:()=>Y.mutate(l),children:h.jsx(Gw,{className:Me("size-3.5",Y.isPending&&"animate-spin motion-reduce:animate-none")})}),y&&y.status!=="stopped"&&h.jsx(At,{label:"停止预览",disabled:!p||Q,onClick:()=>ae.mutate(l),children:h.jsx(Ez,{className:"size-3.5"})}),xe&&h.jsx("a",{href:xe,target:"_blank",rel:"noopener noreferrer","aria-label":"在外部浏览器打开预览",title:"在外部浏览器打开预览",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-lg border border-transparent text-[var(--muted-fg)] outline-none transition hover:bg-[var(--hover)] hover:text-[var(--fg)] focus-visible:ring-2 focus-visible:ring-[var(--accent)]/60",children:h.jsx(xO,{className:"size-3.5"})})]}),h.jsx(sX,{compileState:w,exportResult:A}),h.jsx("div",{className:"min-h-0 flex-1",children:p?z.isPending&&!y?h.jsx(Ei,{icon:h.jsx(Ot,{className:"size-5 animate-spin motion-reduce:animate-none"}),title:"正在读取预览状态",description:"正在向 Host 查询当前项目的预览进程。"}):z.isError&&!y?h.jsx(Ei,{icon:h.jsx(Mi,{className:"size-5"}),title:"无法读取预览状态",description:z.error instanceof Error?z.error.message:"Host 返回未知错误",children:h.jsx(Je,{variant:"secondary",onClick:()=>{z.refetch()},children:"重新加载"})}):!y||y.status==="stopped"?h.jsx(Ei,{icon:h.jsx(Od,{className:"size-5"}),title:"页面预览尚未启动",description:"启动后,Harness 会在独立沙箱中加载当前项目的开发服务器。",children:h.jsxs(Je,{disabled:Q,onClick:()=>Z.mutate(l),children:[Z.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(QT,{className:"size-3.5"}),Z.isPending?"正在启动…":"启动预览"]})}):y.status==="starting"||y.status==="restarting"?h.jsx(Ei,{icon:h.jsx(Ot,{className:"size-5 animate-spin motion-reduce:animate-none"}),title:y.status==="restarting"?"正在重启页面预览":"正在启动页面预览",description:"Host 正在等待开发服务器就绪,完成后会自动显示页面。"}):$?h.jsx(Ei,{icon:h.jsx(Od,{className:"size-5"}),title:"尚无可预览页面",description:"可以继续讨论需求或编写文档;需要页面时再创建,空应用不影响对话完成。"}):y.status==="failed"?h.jsx(Ei,{icon:h.jsx(Mi,{className:"size-5"}),title:"页面预览启动失败",description:y.error??"开发服务器未能正常启动。",children:h.jsxs(Je,{disabled:Y.isPending,onClick:()=>Y.mutate(l),children:[Y.isPending?h.jsx(Ot,{className:"size-3.5 animate-spin motion-reduce:animate-none"}):h.jsx(Gw,{className:"size-3.5"}),"重试"]})}):xe?h.jsx(cX,{projectId:l,src:xe,previewRevision:m,visible:t,annotations:E,onController:ee,onSubmit:F,onModeChanged:R,onError:L=>T({title:"圈选定位失败",description:L,tone:"danger"})},`${f}:${l}:${m}:${xe}:${n}`):h.jsx(Ei,{icon:h.jsx(Mi,{className:"size-5"}),title:"预览地址不可用",description:"Host 报告预览正在运行,但没有返回可加载的地址。",children:h.jsx(Je,{variant:"secondary",disabled:Y.isPending,onClick:()=>Y.mutate(l),children:"重启预览"})}):h.jsx(Ei,{icon:h.jsx(Mi,{className:"size-5"}),title:"Host 未连接",description:"恢复与本地 Harness Host 的连接后才能管理页面预览。"})})]})}function dX(){const e=D(B=>B.openFiles),t=D(B=>B.activeWorkspaceTab),n=D(B=>B.selectWorkspaceTab),r=D(B=>B.closeFile),o=D(B=>B.activeProjectId),s=D(B=>B.activeThreadId),l=D(B=>B.hostSessionId),u=D(x7(B=>{const U=B.activeThreadId?B.threadDetailsById[B.activeThreadId]??B.threads.find(ve=>ve.id===B.activeThreadId):void 0;return U?{title:U.title,itemCount:U.items.length,isPreview:U.isPreview}:void 0})),f=D(B=>Object.values(B.threadDetailsById).filter(U=>U.status==="running").map(U=>U.id).sort().join(",")),p=D(B=>B.previewSessionsByProjectId),m=D(B=>B.supportsProjectPreviewPool),g=D(B=>B.projects),[x,y]=I.useState([]),[w,S]=I.useState([]),T={projectId:o,threadId:s},k=So(T),_=vI(x.filter(B=>!B.projectId||g.some(U=>U.id===B.projectId)),T,new Set(f.split(",")));I.useLayoutEffect(()=>{y(B=>vI(B.filter(U=>!U.projectId||g.some(ve=>ve.id===U.projectId)),T,new Set(f.split(","))))},[o,s,f,g]);const C=I.useRef(l);I.useLayoutEffect(()=>{C.current!==l&&(C.current=l,y([T]),S(L&&o?[o]:[]))},[l]);const[E,O]=I.useState(null),M=D(B=>B.previewLayout),R=D(B=>B.splitChatWidth),z=D(B=>B.setSplitChatWidth),K=D(B=>{const U=B.projects.find(ve=>ve.id===B.activeProjectId);return b2(U,B.appSettings)}),q=I.useRef(null),[Z,Y]=I.useState(0);I.useLayoutEffect(()=>{const B=q.current;if(!B)return;Y(B.getBoundingClientRect().width);const ve=new ResizeObserver(([_e])=>{_e&&Y(_e.contentRect.width)});return ve.observe(B),()=>ve.disconnect()},[]);const ae=Nq(M,K,Z),J=ae==="split",he=I.useRef(null),F=I.useRef(null),[ee,Q]=I.useState(null),xe=rc(ee??R,Z),P=rc(Z,Z),$=B=>{const U=F.current;U&&(F.current=null,Q(null),B&&z(rc(U.width,Z)),he.current?.hasPointerCapture(U.pointerId)&&he.current.releasePointerCapture(U.pointerId))};I.useEffect(()=>{J||$(!1)},[J]),I.useEffect(()=>{if(ee!==null)return document.body.classList.add("is-resizing"),()=>document.body.classList.remove("is-resizing")},[ee===null]);const te=e.find(B=>B.id===t),A=!!te,L=K&&!A&&(J||t==="preview"),X=J||!A&&!L,ue=new Set(Object.entries(p).filter(([,B])=>B&&B.status!=="stopped").map(([B])=>B));if(K&&o&&ue.add(o),!m)for(const B of ue)B!==o&&ue.delete(B);for(const B of ue)g.some(U=>U.id===B)||ue.delete(B);const we=kW(w,L?o:null,ue,m?3:1),ge=we.join(",");I.useLayoutEffect(()=>{S(we)},[ge]);const Se=K&&M==="split"&&!J&&Z>0;return I.useEffect(()=>{!K&&t==="preview"&&n("assistant")},[t,K,n]),h.jsxs("main",{ref:q,"data-preview-layout":ae,"data-requested-preview-layout":M,style:{"--workspace-chat-width":`${xe}px`,"--workspace-divider-width":`${yy}px`,"--workspace-divider-hit-width":`${Aq}px`},className:"workspace-tabs relative flex min-h-0 min-w-0 flex-1 flex-col bg-[var(--workspace)]",children:[h.jsxs("div",{className:"workspace-header flex h-10 shrink-0 items-stretch overflow-x-auto border-b border-[var(--border)] bg-[var(--panel)]",children:[h.jsxs("div",{className:Me("workspace-chat-tab relative flex min-w-0 shrink-0 items-stretch border-[var(--border)]",!J&&"border-r",!J&&(K||e.length>0)?"max-w-[360px]":"flex-1",X?"bg-[var(--workspace)] text-[var(--fg)]":"text-[var(--muted-fg)] hover:bg-[var(--hover)]"),children:[X&&h.jsx("span",{className:"absolute inset-x-0 top-0 h-[2px] bg-[var(--accent)]"}),h.jsx("h2",{"aria-label":u?.title??"AI 助手",className:"min-w-0 flex-1 type-ui font-medium",children:h.jsxs("button",{type:"button","aria-label":"AI 助手","aria-pressed":X,onClick:()=>n("assistant"),title:u?`${u.title} · ${u.itemCount} 条记录${u.isPreview?" · 离线预览":""}`:"AI 助手",className:"flex h-full w-full min-w-0 items-center gap-2 px-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--accent)]",children:[h.jsx("span",{className:"flex size-5 shrink-0 items-center justify-center rounded-md bg-[var(--accent)]/15 text-[var(--accent-soft)]",children:h.jsx(Qs,{className:"size-3.5"})}),h.jsx("span",{className:"truncate",children:u?.title??"AI 助手"})]})}),h.jsx("div",{ref:O,hidden:!X,className:"workspace-chat-actions"})]}),K&&h.jsxs("button",{type:"button","aria-pressed":L,onClick:()=>n("preview"),className:Me("group relative flex min-w-[142px] shrink-0 items-center gap-2 border-r border-[var(--border)] px-3 type-ui transition",L?"bg-[var(--workspace)] text-[var(--fg)]":"text-[var(--muted-fg)] hover:bg-[var(--hover)]"),children:[L&&h.jsx("span",{className:"absolute inset-x-0 top-0 h-[2px] bg-[var(--accent)]"}),h.jsx("span",{className:"flex size-5 items-center justify-center rounded-md bg-[var(--status-info-bg)] text-[var(--status-info-fg)]",children:h.jsx(Od,{className:"size-3.5"})}),h.jsx("span",{className:"truncate",children:"页面预览"})]}),h.jsx("div",{className:Me("min-w-0 flex-1 overflow-x-auto",e.length>0?"flex":"hidden"),children:e.map(B=>h.jsxs("button",{type:"button",onClick:()=>n(B.id),className:Me("group relative flex max-w-[220px] min-w-[130px] items-center gap-2 border-r border-[var(--border)] px-3 type-ui transition",t===B.id?"bg-[var(--workspace)] text-[var(--fg)]":"text-[var(--muted-fg)] hover:bg-[var(--hover)]"),children:[t===B.id&&h.jsx("span",{className:"absolute inset-x-0 top-0 h-[2px] bg-[var(--accent)]"}),h.jsx(FT,{className:"size-3.5 shrink-0 text-[var(--status-info-fg)]"}),h.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:B.name}),B.loading?h.jsx("span",{className:"size-2.5 animate-spin rounded-full border border-current border-t-transparent"}):h.jsx("span",{role:"button",tabIndex:0,"aria-label":`关闭 ${B.name}`,onClick:U=>{U.stopPropagation(),r(B.id)},onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),U.stopPropagation(),r(B.id))},className:"flex size-5 items-center justify-center rounded opacity-0 hover:bg-[var(--hover)] group-hover:opacity-100",children:h.jsx(ei,{className:"size-3"})})]},B.id))})]}),Se&&h.jsx("div",{role:"status",className:"shrink-0 border-b border-[var(--border)] bg-[var(--panel)] px-3 py-1.5 type-meta text-[var(--muted-fg)]",children:"空间不足,暂用标签页。收起左侧面板或扩大窗口后自动恢复并排。"}),h.jsxs("div",{className:"workspace-panes min-h-0 flex-1",children:[h.jsx("div",{className:"workspace-pane workspace-chat-pane",hidden:!X,children:_.map(B=>{const U=So(B)===k;return h.jsx("div",{className:"h-full min-h-0",hidden:!U,children:h.jsx(SW,{projectId:B.projectId,threadId:B.threadId,visible:U&&X,headerActionsTarget:U&&X?E:null})},`${l}:${So(B)}`)})}),h.jsx("div",{className:"workspace-pane workspace-preview-pane",hidden:!L,children:we.map(B=>h.jsx("div",{className:"h-full min-h-0",hidden:B!==o,children:h.jsx(uX,{projectId:B,visible:L&&B===o})},`${l}:${B}`))}),h.jsx("div",{className:"workspace-pane workspace-file-pane",hidden:!A,children:te&&h.jsx(CW,{file:te})})]}),h.jsx("div",{ref:he,hidden:!J,role:"separator","aria-label":"调整聊天与预览宽度","aria-orientation":"vertical","aria-valuemin":Or,"aria-valuemax":P,"aria-valuenow":xe,"aria-valuetext":`聊天宽度 ${xe} 像素`,tabIndex:J?0:-1,className:"workspace-splitter",title:"拖动调整宽度;方向键微调;双击恢复默认宽度",onPointerDown:B=>{B.button!==0||!J||(B.preventDefault(),B.currentTarget.focus(),B.currentTarget.setPointerCapture(B.pointerId),F.current={pointerId:B.pointerId,startX:B.clientX,startWidth:xe,width:xe},Q(xe))},onPointerMove:B=>{const U=F.current;!U||U.pointerId!==B.pointerId||(U.width=rc(U.startWidth+B.clientX-U.startX,Z),Q(U.width))},onPointerUp:B=>{F.current?.pointerId===B.pointerId&&$(!0)},onPointerCancel:()=>$(!1),onLostPointerCapture:()=>$(!0),onDoubleClick:()=>z(Or),onKeyDown:B=>{if(B.key==="Escape"){$(!1);return}const U=B.key==="Home"?Or:B.key==="End"?P:B.key==="ArrowLeft"?xe-(B.shiftKey?48:16):B.key==="ArrowRight"?xe+(B.shiftKey?48:16):void 0;U!==void 0&&(B.preventDefault(),z(rc(U,Z)))}}),ee!==null&&J&&h.jsx("div",{"aria-hidden":"true",className:"workspace-resize-shield"})]})}async function fX(e=He){let t=e.replayCursor,n=e.hasReplayBaseline;const r=[];for(let o=0;o<1e3;o+=1){const s=await e.call("initialize",{protocolVersion:"0.1",clientName:"Harness Studio Web",clientVersion:"0.1.0",...n?{afterSeq:t}:{}});if(r.push(...s.replay),!s.replayHasMore)return{...s,replay:r};if(s.replayCursor<=t)throw new Error("Host 事件回放游标没有前进,已停止恢复以避免死循环");t=s.replayCursor,n=!0}throw new Error("Host 事件回放页数超过安全上限")}function pX(){const e=Hs(),{activate:t}=yC(),n=I.useRef(new Map),r=I.useRef(new Map),o=I.useRef(void 0),s=I.useRef(new Map),l=D(B=>B.connectionStatus),u=D(B=>B.offlinePreview),f=D(B=>B.activeProjectId),p=D(B=>B.projects.find(U=>U.id===B.activeProjectId)),m=D(B=>B.activeProjectId?B.previewSessionsByProjectId[B.activeProjectId]:void 0),g=D(B=>B.providers),y=D(B=>B.activeProviderId)??g.find(B=>B.enabled)?.id??null,w=D(B=>y?B.modelCatalogLoadedByProviderId[y]===!0:!1),S=D(B=>B.route),T=D(B=>B.hydrateHost),k=D(B=>B.hostSessionId),_=D(B=>B.setConnection),C=D(B=>B.applyEvent),E=D(B=>B.applyEvents),O=D(B=>B.markHistoriesDirty),M=D(B=>B.setFileTree),R=D(B=>B.setThreads),z=D(B=>B.setPlugins),K=D(B=>B.removeProvider),q=D(B=>B.setProviderModels),Z=D(B=>B.setLogs),Y=D(B=>B.setThreadMetrics),ae=D(B=>B.pushToast),J=D(B=>B.activeThreadId),he=D(B=>B.threads.find(U=>U.id===B.activeThreadId)?.status),F=D(B=>J?B.historyByThreadId[J]?.status:void 0),ee=D(B=>J?B.historyByThreadId[J]?.dirty===!0:!1);I.useEffect(()=>{let B=[],U,ve;const _e=()=>{if(U!==void 0&&cancelAnimationFrame(U),ve!==void 0&&clearTimeout(ve),U=void 0,ve=void 0,B.length){const ze=B;B=[],E(ze)}},qe=He.subscribe(ze=>{if(ze.type==="item.delta"||ze.type==="reasoning.content.delta"||ze.type==="reasoning.summary.delta"?(B.push(ze),ve===void 0&&(typeof requestAnimationFrame=="function"&&(U=requestAnimationFrame(_e)),ve=setTimeout(_e,32)),B.length>=256&&_e()):(_e(),C(ze)),ze.type==="file.changed"&&typeof ze.payload.projectId=="string"){const ut=ze.payload.projectId;if(typeof ze.payload.path=="string"&&/\.md$/iu.test(ze.payload.path)){const Ft=r.current.get(ut)??new Set;Ft.add(ze.payload.path),r.current.set(ut,Ft)}const Kt=n.current.get(ut);Kt&&clearTimeout(Kt),n.current.set(ut,setTimeout(()=>{n.current.delete(ut),e.invalidateQueries({queryKey:Gg(ut)});const Ft=r.current.get(ut);r.current.delete(ut);for(const dr of Ft??[])zc(ut,dr,void 0,He,{background:!0})},120))}if(ze.type==="project.changed"&&(ze.payload.change!=="activated"&&e.invalidateQueries({queryKey:["projects"]}),ze.payload.change==="removed"&&typeof ze.payload.projectId=="string"&&e.removeQueries({queryKey:["project",ze.payload.projectId]})),ze.type==="thread.changed"&&typeof ze.payload.projectId=="string"){const ut=ze.payload.projectId;e.invalidateQueries({queryKey:["project",ut,"threads"]}),e.invalidateQueries({queryKey:["project",ut,"threads","archived"]})}if(ze.type==="provider.models.changed"&&typeof ze.payload.providerProfileId=="string"){const ut=ze.payload.providerProfileId;if(ze.payload.change===void 0)K(ut);else{const Kt=D.getState().hostSessionId;uv(ut).then(Ft=>{D.getState().hostSessionId===Kt&&q(ut,Ft)}).catch(()=>{})}e.invalidateQueries({queryKey:["providers"]})}ze.threadId&&(ze.type==="turn.started"||ze.type==="turn.completed"||ze.type==="provider.request.started"||ze.type==="provider.request.completed"||ze.type==="usage.updated")&&e.invalidateQueries({queryKey:["thread",ze.threadId,"metrics"]})}),Qe=He.subscribeStatus((ze,ut)=>{_e(),ze!=="online"&&D.getState().connectionStatus==="online"&&O(),_(ze,ut)});return He.connect().catch(()=>{}),()=>{qe(),Qe(),_e();for(const ze of n.current.values())clearTimeout(ze);n.current.clear(),r.current.clear()}},[C,E,O,e,K,_,q]);const Q=lr({queryKey:["host","initialize",l],queryFn:()=>fX(),enabled:l==="online",retry:1,staleTime:0,refetchOnWindowFocus:!1}),xe=Q.isSuccess&&!u&&k===Q.data.sessionId,P=lr({queryKey:["projects",Q.data?.sessionId],queryFn:()=>He.call("project.list",{}),enabled:Q.isSuccess&&l==="online"}),$=lr({queryKey:["providers",Q.data?.sessionId],queryFn:()=>He.call("provider.list",{}),enabled:Q.isSuccess&&l==="online"}),te=lr({queryKey:["plugins","initial",Q.data?.sessionId],queryFn:()=>He.call("plugin.list",{}),enabled:Q.isSuccess&&l==="online"});I.useEffect(()=>{if(!Q.data||!P.data||!$.data||!te.data)return;const B=Object.fromEntries(Object.entries($.data.models).map(([_e,qe])=>[_e,qe.map(Qe=>f2(Qe,_e))])),U=gy(Q.data.appSettings),ve=il(Q.data.previewSession);T({protocolVersion:Q.data.protocolVersion,serverVersion:Q.data.serverVersion,sessionId:Q.data.sessionId,projects:P.data.projects.map(Ec),threads:[],providers:$.data.profiles.map(gq),providerPresets:$.data.presets.map(vq),modelsByProviderId:B,plugins:te.data.plugins.map(jg),...U?{appSettings:U}:{},previewSession:ve??null,previewRevision:Q.data.previewRevision,...Q.data.previewSessions?{previewSessions:Q.data.previewSessions}:{},...Q.data.previewRevisions?{previewRevisions:Q.data.previewRevisions}:{},capabilities:{supportsProjectPreviewPool:Q.data.capabilities.supportsProjectPreviewPool===!0,supportsTurnQueue:Q.data.capabilities.supportsTurnQueue===!0,supportsDocumentAnnotations:Q.data.capabilities.supportsDocumentAnnotations===!0,supportsDocumentSuggestions:Q.data.capabilities.supportsDocumentSuggestions===!0},lastSeq:Q.data.latestSeq}),He.ingestReplay(Q.data.replay,Q.data.replayCursor,{sessionId:Q.data.sessionId,latestSeq:Q.data.latestSeq})},[T,te.data,Q.data,P.data,$.data]),I.useEffect(()=>{if(l!=="online"||!Q.isSuccess||p?.kind!=="managed"||p.managedState!=="ready"||m)return;const B=`${Q.data?.sessionId??"host"}:${p.id}`;if(o.current!==B)if(o.current=B,D.getState().supportsProjectPreviewPool){const U=p.id,ve=D.getState().hostSessionId;Sr.ensurePreview(U).then(_e=>{const qe=D.getState();qe.hostSessionId===ve&&qe.projects.some(Qe=>Qe.id===U)&&qe.setPreviewSession(U,_e.session,_e.revision)}).catch(()=>{})}else t(p.id)},[t,m,p,l,Q.data?.sessionId,Q.isSuccess]);const A=lr({queryKey:["provider",y,"models","complete",k],queryFn:async()=>{const B=y??"";return{providerId:B,sessionId:k,models:await uv(B)}},enabled:Q.isSuccess&&l==="online"&&!u&&!!y&&!w,retry:1,staleTime:Number.POSITIVE_INFINITY});I.useEffect(()=>{!A.data||A.data.sessionId!==D.getState().hostSessionId||u||w||q(A.data.providerId,A.data.models)},[w,A.data,u,q]);const L=lr({queryKey:[...Gg(f??""),k],queryFn:async()=>{const B=f??"",U=D.getState(),ve=U.hostSessionId,_e=await a7(He,B,U.expandedPathsByProjectId[B]??[],U.activeProjectId===B?U.fileTree:U.fileTreeByProjectId[B]??[]),qe=D.getState();return qe.hostSessionId===ve&&qe.projects.some(Qe=>Qe.id===B)&&M(B,_e.tree,_e.expandedPaths),{..._e,sessionId:ve}},enabled:xe&&l==="online"&&!!f,staleTime:3e4,refetchOnWindowFocus:!1});I.useEffect(()=>{const B=D.getState();L.data&&L.data.sessionId===B.hostSessionId&&B.projects.some(U=>U.id===L.data.projectId)&&M(L.data.projectId,L.data.tree,L.data.expandedPaths)},[M,L.data]),I.useEffect(()=>{L.error&&ae({title:"刷新失败",description:L.error instanceof Error?L.error.message:"无法读取项目文件",tone:"danger"})},[ae,L.error]);const X=lr({queryKey:["project",f,"threads",...k?[k]:[]],queryFn:async()=>{const B=f??"",U=k,ve=A2(B),_e=await He.call("thread.list",{projectId:B}),qe=D.getState();return qe.hostSessionId===U&&qe.projects.some(Qe=>Qe.id===B)&&R(B,_e.threads.map(Qe=>Rr(Qe)),ve),{projectId:B,sessionId:U,result:_e,request:ve}},enabled:xe&&l==="online"&&!!f,staleTime:3e4,refetchOnWindowFocus:!1});I.useEffect(()=>{X.data&&X.data.sessionId===D.getState().hostSessionId&&R(X.data.projectId,X.data.result.threads.map(B=>Rr(B)),X.data.request)},[R,X.data]);const ue=lr({queryKey:["plugins","route"],queryFn:()=>He.call("plugin.list",{}),enabled:l==="online"&&S==="plugins"});I.useEffect(()=>{ue.data&&z(ue.data.plugins.map(jg))},[ue.data,z]);const we=lr({queryKey:["logs"],queryFn:()=>He.call("log.list",{limit:500}),enabled:l==="online"&&S==="logs",refetchInterval:S==="logs"&&l==="online"?5e3:!1});I.useEffect(()=>{we.data&&Z(we.data.entries.map(p2))},[we.data,Z]);const ge=lr({queryKey:["project",f,"thread",J,"history",Q.data?.sessionId],queryFn:()=>xC({projectId:f??"",threadId:J??"",sessionId:Q.data?.sessionId??null}),enabled:xe&&l==="online"&&!!J&&F!=="loading-more"&&(F!=="ready"||ee),retry:!1,staleTime:Number.POSITIVE_INFINITY,gcTime:0});I.useEffect(()=>{const B=`${k}:${f}:${J}`;for(const _e of s.current.keys())_e!==B&&s.current.delete(_e);if(!ee){s.current.delete(B);return}if(!xe||l!=="online"||!f||!J||F!=="ready"||ge.isFetching)return;const U=s.current.get(B)??0,ve=setTimeout(()=>{const _e=D.getState();_e.hostSessionId!==k||_e.activeProjectId!==f||_e.activeThreadId!==J||_e.connectionStatus!=="online"||_e.historyByThreadId[J]?.status!=="ready"||_e.historyByThreadId[J]?.dirty!==!0||(s.current.set(B,U+1),ge.refetch({cancelRefetch:!1}))},Math.min(2e3,50*2**Math.min(U,6)));return()=>clearTimeout(ve)},[ee,F,f,J,l,ge.dataUpdatedAt,ge.isError,ge.isFetching,ge.refetch,xe,k]);const Se=lr({queryKey:["thread",J,"metrics",k],queryFn:async()=>{const B=J??"";return{threadId:B,sessionId:k,result:await He.call("thread.metrics",{threadId:B})}},enabled:Q.isSuccess&&l==="online"&&!!J&&he!==void 0,retry:1,staleTime:3e4,refetchOnWindowFocus:!1});I.useEffect(()=>{if(!Se.data||Se.data.sessionId!==D.getState().hostSessionId)return;const{threadId:B,latestTurnId:U,latestTurn:ve,threadTotal:_e,latestUsageRequest:qe,requests:Qe}=Se.data.result;Y(B,{...U?{latestTurnId:U}:{},...ve?{latestTurn:ve}:{},threadTotal:_e,...qe?{latestUsageRequest:qe}:{},requests:Qe})},[Se.data,Y])}const hX=I.lazy(async()=>({default:(await $c(async()=>{const{PluginsView:e}=await import("./PluginsView-DM_ZnENS.js");return{PluginsView:e}},__vite__mapDeps([2,3]))).PluginsView})),mX=I.lazy(async()=>({default:(await $c(async()=>{const{PluginPanelView:e}=await import("./PluginsView-DM_ZnENS.js");return{PluginPanelView:e}},__vite__mapDeps([2,3]))).PluginPanelView})),gX=I.lazy(async()=>({default:(await $c(async()=>{const{LogsView:e}=await import("./LogsView-BFFFSFB-.js");return{LogsView:e}},[])).LogsView})),vX=I.lazy(async()=>({default:(await $c(async()=>{const{SettingsView:e}=await import("./SettingsView-Cb5Q4ile.js");return{SettingsView:e}},__vite__mapDeps([4,3]))).SettingsView}));function yX(){return h.jsxs("div",{className:"flex min-h-0 flex-1 items-center justify-center bg-[var(--workspace)] text-[10px] text-[var(--muted-fg)]",children:[h.jsx("span",{className:"mr-2 size-3 animate-spin rounded-full border border-[var(--accent)] border-t-transparent"}),"正在加载工作区…"]})}function bX(){const e=D(t=>t.projectPanelCollapsed);return h.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[!e&&h.jsx(v7,{}),h.jsxs("div",{className:"relative flex min-w-0 flex-1","data-workspace-content":!0,children:[h.jsx(c7,{}),h.jsx(dX,{})]})]})}function xX(){pX();const e=D(n=>n.route),t=D(n=>n.theme);return I.useEffect(()=>{document.documentElement.dataset.theme=t,document.documentElement.style.colorScheme=t},[t]),h.jsxs("div",{className:"h-screen min-h-[640px] w-screen min-w-[980px] overflow-hidden bg-[var(--app)] text-[var(--fg)] selection:bg-[var(--accent)]/35 selection:text-white",children:[h.jsxs("div",{className:"flex h-full",children:[h.jsx(TH,{}),h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[h.jsx(_H,{}),h.jsx(C$,{}),e==="workbench"&&h.jsx(bX,{}),h.jsxs(I.Suspense,{fallback:h.jsx(yX,{}),children:[e==="plugins"&&h.jsx(hX,{}),e==="logs"&&h.jsx(gX,{}),e==="settings"&&h.jsx(vX,{}),e.startsWith("plugin:")&&h.jsx(mX,{pluginId:e.split(":").slice(1,-1).join(":")})]})]})]}),h.jsx(CH,{})]})}const wX=new HM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1},mutations:{retry:!1}}});vM.createRoot(document.getElementById("root")).render(h.jsx(I.StrictMode,{children:h.jsx(FM,{client:wX,children:h.jsx(fR,{children:h.jsx(xX,{})})})}));export{Cs as $,gW as A,Je as B,Ys as C,UT as D,xO as E,w2 as F,ol as G,x2 as H,At as I,XT as J,Qs as K,Ot as L,Tr as M,Hv as N,Lv as O,If as P,AX as Q,Gw as R,Tf as S,jf as T,Hs as U,lr as V,vn as W,ei as X,On as Y,YO as Z,Az as _,Me as a,$c as a0,hc as b,Ce as c,Vv as d,kf as e,FR as f,BT as g,He as h,uC as i,h as j,BO as k,PX as l,gq as m,f2 as n,_X as o,uv as p,NX as q,I as r,vW as s,jg as t,D as u,MX as v,Oq as w,Ws as x,rf as y,EX as z};