@p4code/cli 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +665 -47
- package/dist/client/assets/Diagram-CP713Hf0.js +3 -0
- package/dist/client/assets/DiffPanel-DeU85qmp.js +98 -0
- package/dist/client/assets/FilePreviewPanel-Ck-1V54G.js +1778 -0
- package/dist/client/assets/PreviewPanel-C9f2_i6J.js +2 -0
- package/dist/client/assets/abnfDiagram-N423BO3Z-BYQKJNsP.js +2 -0
- package/dist/client/assets/angular-html-BVBpGdXr.js +2 -0
- package/dist/client/assets/{angular-ts-CXoIeuGh.js → angular-ts-BfdufMKP.js} +2 -2
- package/dist/client/assets/{apl-C6oPUNZZ.js → apl-DWBSSoBH.js} +2 -2
- package/dist/client/assets/arc-BjSQqbzd.js +2 -0
- package/dist/client/assets/architecture-TIHT7OUA-DOwndo9a.js +1 -0
- package/dist/client/assets/architectureDiagram-T3A2C74G-Dkoxezw8.js +37 -0
- package/dist/client/assets/array-BifhSqXX.js +2 -0
- package/dist/client/assets/arrow-right-DdiaD_l3.js +2 -0
- package/dist/client/assets/{astro-Bq_n5uKv.js → astro-3LtMP0Sq.js} +2 -2
- package/dist/client/assets/{blade-DYe65h_C.js → blade-llJRbbtR.js} +2 -2
- package/dist/client/assets/blockDiagram-VBNYF7ZC-sVeCAPAa.js +133 -0
- package/dist/client/assets/c-Wt1voDr2.js +2 -0
- package/dist/client/assets/c4Diagram-5PPSVZJV-CW_Wfxep.js +11 -0
- package/dist/client/assets/channel-Cc8SQh1U.js +2 -0
- package/dist/client/assets/chunk-2GRJ4B5K-ChihPphX.js +2 -0
- package/dist/client/assets/chunk-2Q5K7J3B-C1jixKkw.js +2 -0
- package/dist/client/assets/chunk-3NCLNEKW-lgePDcrq.js +2 -0
- package/dist/client/assets/chunk-4I5QYGJK-CYvb6li-.js +2 -0
- package/dist/client/assets/chunk-5RXB4S5H-BzE89W2t.js +232 -0
- package/dist/client/assets/chunk-5VM5RSS4-ZNzvKenW.js +16 -0
- package/dist/client/assets/chunk-6Q2QTUOP-CyDe-FPc.js +89 -0
- package/dist/client/assets/chunk-7BUUIJ7U-Bb538aSH.js +2 -0
- package/dist/client/assets/chunk-7Z6QIM7H-kaZRbPTV.js +11 -0
- package/dist/client/assets/chunk-GF5L2VYU-CHJWyX-t.js +207 -0
- package/dist/client/assets/chunk-I66GZJ75-CJWXi3bs.js +128 -0
- package/dist/client/assets/chunk-J7OUQ5F2-D19QWtqC.js +3 -0
- package/dist/client/assets/chunk-JQJVKLGR-oHxUxbQ4.js +157 -0
- package/dist/client/assets/chunk-JWPE2WC7-DVXcaiue.js +2 -0
- package/dist/client/assets/chunk-KBJHAD2P-D81b6htr.js +2 -0
- package/dist/client/assets/chunk-KEIR6QF5-BfrZ3jm6.js +162 -0
- package/dist/client/assets/chunk-NSK5VX7P-CoeZ_Lgi.js +3 -0
- package/dist/client/assets/chunk-QR6OTTB3-D0IyLhez.js +63 -0
- package/dist/client/assets/chunk-RYQCIY6F-CZ4ia6G4.js +2 -0
- package/dist/client/assets/chunk-UBXNYLIW-F4hmeeiG.js +2 -0
- package/dist/client/assets/chunk-W5SLKNZC-Bwmo9x3j.js +2 -0
- package/dist/client/assets/chunk-WRU74C26-C2Rb3ATV.js +71 -0
- package/dist/client/assets/chunk-XXDRQBXY-BuE3VzE_.js +2 -0
- package/dist/client/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +2 -0
- package/dist/client/assets/chunk-ZIRB5QZD-C6fEPe3t.js +33 -0
- package/dist/client/assets/classDiagram-JCYQIIEL-oYJOinll.js +2 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-oYJOinll.js +2 -0
- package/dist/client/assets/{cobol-CoC31Rpg.js → cobol-x_HIyl2P.js} +2 -2
- package/dist/client/assets/{coffee-DU1_O9cH.js → coffee-CThvmt4R.js} +2 -2
- package/dist/client/assets/compiler-runtime-CLAvuQ-D.js +2 -0
- package/dist/client/assets/cose-bilkent-JH36ORCC-CU59zlcZ.js +2 -0
- package/dist/client/assets/cpp-NtAeskI3.js +2 -0
- package/dist/client/assets/{crystal-3iIyvfhL.js → crystal-DNu_sX0G.js} +2 -2
- package/dist/client/assets/css-DJp_X0uY.js +2 -0
- package/dist/client/assets/cynefin-VYW2F7L2-CjLioxN7.js +1 -0
- package/dist/client/assets/cynefinDiagram-MW4NZA55-DvNvdTNB.js +63 -0
- package/dist/client/assets/cytoscape.esm-B3I8pqwA.js +322 -0
- package/dist/client/assets/dagre-CXRCoUWR.js +2 -0
- package/dist/client/assets/dagre-VZM6K2ZE-bNpBL3bS.js +5 -0
- package/dist/client/assets/defaultLocale-C8Fc0cco.js +2 -0
- package/dist/client/assets/diagram-7IWD3JNH-DJveh2nY.js +31 -0
- package/dist/client/assets/diagram-B4RE2ZJO-CslhjucF.js +4 -0
- package/dist/client/assets/diagram-LBJQPF4R-DrVsyR2w.js +25 -0
- package/dist/client/assets/diagram-Q27KOJAE-Dp_H6G_V.js +25 -0
- package/dist/client/assets/diagram-UB23O5K3-ttWj4O6A.js +42 -0
- package/dist/client/assets/dist-D9sYb5Oa.js +2 -0
- package/dist/client/assets/ebnfDiagram-BXEA7PRR-DU7xTW-M.js +2 -0
- package/dist/client/assets/{edge--YoYp8s_.js → edge-ozw5tpLl.js} +2 -2
- package/dist/client/assets/{elixir-CZ1wqlQn.js → elixir-VhA6FeZt.js} +2 -2
- package/dist/client/assets/{elm-DKdyYY92.js → elm-dREJmIFz.js} +2 -2
- package/dist/client/assets/erDiagram-JOGREHBK-J8OGMeJ9.js +86 -0
- package/dist/client/assets/{erb-PeUqy_9N.js → erb-CIg6G69l.js} +2 -2
- package/dist/client/assets/eventmodeling-45OFAUF4-bPdt--LC.js +1 -0
- package/dist/client/assets/fileCommentAnnotations-BZURe-eK.js +2 -0
- package/dist/client/assets/flowDiagram-UKHOOZJN-Xh4ZxM-b.js +1 -0
- package/dist/client/assets/ganttDiagram-PKOTCBZU-CTzbq3xg.js +293 -0
- package/dist/client/assets/{git-rebase-1Z5OxWid.js → git-rebase-B44mJPta.js} +2 -2
- package/dist/client/assets/gitGraph-TEB2WS4Q-D4WztIzM.js +1 -0
- package/dist/client/assets/gitGraphDiagram-DS77QQ5N-BYWChpgP.js +107 -0
- package/dist/client/assets/{glimmer-js-Br0y4u5b.js → glimmer-js-vH_gHG0-.js} +2 -2
- package/dist/client/assets/{glimmer-ts-Oh0AMNJv.js → glimmer-ts--abOzSAQ.js} +2 -2
- package/dist/client/assets/glsl-Dv5r7kPw.js +2 -0
- package/dist/client/assets/graphlib-B8gBHxth.js +2 -0
- package/dist/client/assets/graphql-CB4jsw2E.js +2 -0
- package/dist/client/assets/{hack-4xJQMtbZ.js → hack-DvEYX148.js} +2 -2
- package/dist/client/assets/haml-zE6W3STP.js +2 -0
- package/dist/client/assets/{handlebars-Znb8TzWA.js → handlebars-CzBR2SDs.js} +2 -2
- package/dist/client/assets/html-C8UlPnhE.js +2 -0
- package/dist/client/assets/{html-derivative-D6Fn1mLE.js → html-derivative-CY6NRz-J.js} +2 -2
- package/dist/client/assets/{http-CSdnm1Wh.js → http-Cyd7bS_S.js} +2 -2
- package/dist/client/assets/{hurl-DKOuNoWT.js → hurl-CWPsiEpf.js} +2 -2
- package/dist/client/assets/index-2NU5L8X3.css +1 -0
- package/dist/client/assets/index-coKrfdge.js +859 -0
- package/dist/client/assets/info-DKCQHKI2-a_IxCZlD.js +1 -0
- package/dist/client/assets/infoDiagram-6WML65LV-CNHt7MRQ.js +3 -0
- package/dist/client/assets/init-D6jRqBbL.js +2 -0
- package/dist/client/assets/ishikawaDiagram-WSZJBQD7-GfzwW5bv.js +71 -0
- package/dist/client/assets/java-CGc3VwQr.js +2 -0
- package/dist/client/assets/javascript-CUt1pgmJ.js +2 -0
- package/dist/client/assets/{jinja-CvJhR5Z5.js → jinja-CD-Z-FLd.js} +2 -2
- package/dist/client/assets/{jison-DSlj1sEU.js → jison-imPNup1l.js} +2 -2
- package/dist/client/assets/journeyDiagram-NVQOT4AX-BSwGpG7U.js +140 -0
- package/dist/client/assets/json-Bg9ijW3F.js +2 -0
- package/dist/client/assets/jsx-CY6oMTks.js +2 -0
- package/dist/client/assets/{julia-CmLSMgqX.js → julia-Dc3O-irA.js} +2 -2
- package/dist/client/assets/{just-D9KdTXpD.js → just-BhOq_Kbv.js} +2 -2
- package/dist/client/assets/kanban-definition-27J2QSJJ-D_T9V6VW.js +90 -0
- package/dist/client/assets/katex-CddkPoXu.js +258 -0
- package/dist/client/assets/{latex-BZoE-Z3X.js → latex-Cu4Y1d5w.js} +2 -2
- package/dist/client/assets/line-DSV8zekT.js +2 -0
- package/dist/client/assets/linear-B7l8qgEw.js +2 -0
- package/dist/client/assets/{liquid-DW5UrT3Q.js → liquid-CvXMrjlQ.js} +2 -2
- package/dist/client/assets/lua-BjLEUjKY.js +2 -0
- package/dist/client/assets/map-DsCK-0Cs.js +2 -0
- package/dist/client/assets/{marko-EN2dMS-t.js → marko-DvhNOisQ.js} +2 -2
- package/dist/client/assets/{mdc-DV5R0Zdp.js → mdc-Bm9TpL1X.js} +2 -2
- package/dist/client/assets/mdx-host-BSmJn2Ra.css +1 -0
- package/dist/client/assets/mdx-host-ykYobBl4.js +4 -0
- package/dist/client/assets/mermaid-parser.core-B5tsyPlM.js +8 -0
- package/dist/client/assets/mermaid.core-0eNWrEyK.js +12 -0
- package/dist/client/assets/mindmap-definition-FAOFIHXS-CCatf1G5.js +97 -0
- package/dist/client/assets/{nginx-BhF2pPjp.js → nginx-Bhc82uuv.js} +2 -2
- package/dist/client/assets/{nim-Ck0oR8VY.js → nim-DXTVBFnF.js} +2 -2
- package/dist/client/assets/ordinal-hYBb2elL.js +2 -0
- package/dist/client/assets/packet-7NZHBO7P-TVG5WLAg.js +1 -0
- package/dist/client/assets/path-BWPyau1x.js +2 -0
- package/dist/client/assets/pegDiagram-VL7TDLO6-cVET6VY2.js +2 -0
- package/dist/client/assets/{perl-B4V1RSOt.js → perl-C7veXV9z.js} +2 -2
- package/dist/client/assets/{php-BvwSzqRH.js → php-BRiuMnnr.js} +2 -2
- package/dist/client/assets/pie-RZYD4A2V-_HnCx0-n.js +1 -0
- package/dist/client/assets/pieDiagram-7S7Q4E2Y-my4weM7I.js +40 -0
- package/dist/client/assets/preload-helper-CEhsl8MR.js +10 -0
- package/dist/client/assets/{pug-DB3guzOM.js → pug-C5hz5LQ7.js} +2 -2
- package/dist/client/assets/{qml-CohVRZGq.js → qml-BdUV3aTS.js} +2 -2
- package/dist/client/assets/quadrantDiagram-CIZ2JOQS-DbbX4CCn.js +8 -0
- package/dist/client/assets/r-8R7vtdQc.js +2 -0
- package/dist/client/assets/radar-I7S5WNFK-CxNqBWNL.js +1 -0
- package/dist/client/assets/railroad-3IZDKUUU-x01a2S92.js +1 -0
- package/dist/client/assets/railroad-abnf-AHOZXSZD-CMSmMh88.js +1 -0
- package/dist/client/assets/railroad-ebnf-EBAXGLYW-BtYYxacN.js +1 -0
- package/dist/client/assets/railroad-peg-LSFZ7HO6-BlXAsNZI.js +1 -0
- package/dist/client/assets/railroadDiagram-AXF67PYL-CA2XP-eT.js +2 -0
- package/dist/client/assets/{razor-CtBV-RZa.js → razor-DRL52XO2.js} +2 -2
- package/dist/client/assets/regexp-Omp9DhTb.js +2 -0
- package/dist/client/assets/requirementDiagram-LRYGKXZP-DPky6FEM.js +85 -0
- package/dist/client/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/dist/client/assets/rough.esm-CSKSodPl.js +2 -0
- package/dist/client/assets/{rst-1GlNPFb8.js → rst-BHX71KW9.js} +2 -2
- package/dist/client/assets/{ruby-C_Jg-W0j.js → ruby-B--HzjGU.js} +2 -2
- package/dist/client/assets/sankeyDiagram-W5VNT64P-Im_lfZl5.js +41 -0
- package/dist/client/assets/{sas-IRPqQRQC.js → sas-DrLaYOK_.js} +2 -2
- package/dist/client/assets/scss-DdSxiZKl.js +2 -0
- package/dist/client/assets/sequenceDiagram-SI44F4Z6-DaepaQXs.js +163 -0
- package/dist/client/assets/shellscript-DwcUjJBL.js +2 -0
- package/dist/client/assets/{shellsession-bEniUyPe.js → shellsession-CPZkydE6.js} +2 -2
- package/dist/client/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +2 -0
- package/dist/client/assets/{soy-D0Pcy9LW.js → soy-Br5FhD7c.js} +2 -2
- package/dist/client/assets/sql-DNssxck8.js +2 -0
- package/dist/client/assets/src-_wZywoZs.js +2 -0
- package/dist/client/assets/{stata-BLI2BTCU.js → stata-DXn1tqOr.js} +2 -2
- package/dist/client/assets/stateDiagram-OKZ733FA-CfYrJbpr.js +2 -0
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-Dj9TN_Qe.js +2 -0
- package/dist/client/assets/{surrealql-BjtO5tmi.js → surrealql-IeLNQw0f.js} +2 -2
- package/dist/client/assets/{svelte-IyvKNOcX.js → svelte-DOdLCIlh.js} +2 -2
- package/dist/client/assets/swimlanes-SLNWSIFB-DaoN2lsp.js +3 -0
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BKWIjosV.js +9 -0
- package/dist/client/assets/{templ-qRJlnfHP.js → templ-CIwIngms.js} +2 -2
- package/dist/client/assets/terminal-links-McQ4PMJM.js +46 -0
- package/dist/client/assets/{tex-CgYv5ALc.js → tex-D8QMumu5.js} +2 -2
- package/dist/client/assets/timeline-definition-Z64GVDOM-I6R4kaBM.js +121 -0
- package/dist/client/assets/treeView-QDETBFTQ-FHUGB9GE.js +1 -0
- package/dist/client/assets/treemap-6X3UGDF4-C2oSUZ4V.js +1 -0
- package/dist/client/assets/{ts-tags-YasuuPCT.js → ts-tags-BMVY4q-l.js} +2 -2
- package/dist/client/assets/tsx-5Eka4NBX.js +2 -0
- package/dist/client/assets/{twig-BF-FIMTp.js → twig-C8o_5mgw.js} +2 -2
- package/dist/client/assets/typescript-DOu2WMV5.js +2 -0
- package/dist/client/assets/vennDiagram-T6HMQDX7-uVbqilLL.js +35 -0
- package/dist/client/assets/{vue-BTbCYZab.js → vue-BU18DNDL.js} +2 -2
- package/dist/client/assets/{vue-html-1KQNz6IV.js → vue-html-BeluIYX0.js} +2 -2
- package/dist/client/assets/{vue-vine-BVHOJ5oI.js → vue-vine-DGUAbOCX.js} +2 -2
- package/dist/client/assets/wardley-OPB4EBWU-C8z79vwT.js +1 -0
- package/dist/client/assets/wardleyDiagram-T6FBY63Y-Bh4kXS4j.js +79 -0
- package/dist/client/assets/xml-DIqSwXR3.js +2 -0
- package/dist/client/assets/{xsl-DoQ9dHRM.js → xsl-Ct_-YIAy.js} +2 -2
- package/dist/client/assets/xychartDiagram-ELKLHX3M-aKLyYtge.js +8 -0
- package/dist/client/assets/yaml-DTtCYNlS.js +2 -0
- package/dist/client/index.html +6 -3
- package/dist/client/mdx-host.html +25 -0
- package/dist/client/mdx-jsx-runtime.js +23 -0
- package/package.json +4 -1
- package/dist/client/assets/DiffPanel-Cdf69_RS.js +0 -98
- package/dist/client/assets/FilePreviewPanel-CkKXCbcG.js +0 -1778
- package/dist/client/assets/PreviewPanel-BtqdQqtN.js +0 -2
- package/dist/client/assets/angular-html-BPHFZwgm.js +0 -2
- package/dist/client/assets/arrow-right-7YX6fLbL.js +0 -2
- package/dist/client/assets/c-BsDji_bt.js +0 -2
- package/dist/client/assets/cpp-D5_eYHZr.js +0 -2
- package/dist/client/assets/css-B4bpFXEv.js +0 -2
- package/dist/client/assets/fileCommentAnnotations-BTb-0nj3.js +0 -2
- package/dist/client/assets/glsl-DI6kM2gF.js +0 -2
- package/dist/client/assets/graphql-VCSJCQkl.js +0 -2
- package/dist/client/assets/haml-Bc0kPVkr.js +0 -2
- package/dist/client/assets/html-_Zw71zQT.js +0 -2
- package/dist/client/assets/index-CeztlSXj.js +0 -853
- package/dist/client/assets/index-eSuLivhH.css +0 -1
- package/dist/client/assets/java-Czo4Dn1f.js +0 -2
- package/dist/client/assets/javascript-fyReKHSS.js +0 -2
- package/dist/client/assets/json-fCB7n2pX.js +0 -2
- package/dist/client/assets/jsx-C1OJlXdb.js +0 -2
- package/dist/client/assets/lua-DMAjig-8.js +0 -2
- package/dist/client/assets/r-Doi-hRR2.js +0 -2
- package/dist/client/assets/regexp-DgF6jh6T.js +0 -2
- package/dist/client/assets/scss-BPKDbfld.js +0 -2
- package/dist/client/assets/shellscript-D5KbVhsx.js +0 -2
- package/dist/client/assets/sql-DF2TL966.js +0 -2
- package/dist/client/assets/textarea-B03Qe3NX.js +0 -46
- package/dist/client/assets/tsx-BF7eypTR.js +0 -2
- package/dist/client/assets/typescript-CtOBCMI7.js +0 -2
- package/dist/client/assets/xml-CftlzqvG.js +0 -2
- package/dist/client/assets/yaml-DMUX1MAF.js +0 -2
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ee(e,t){return E(e.type,t,e.props)}function te(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function D(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ne=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?D(``+e.key):t.toString(36)}function ie(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function O(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,O(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ne,`$&/`)+`/`),O(o,r,i,``,function(e){return e})):o!=null&&(te(o)&&(o=ee(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ne,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+re(a,u),c+=O(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+re(a,u++),c+=O(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return O(ie(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ae(e,t,n){if(e==null)return e;var r=[],i=0;return O(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function oe(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var k=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},se={map:ae,forEach:function(e,t,n){ae(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ae(e,function(){t++}),t},toArray:function(e){return ae(e,function(e){return e})||[]},only:function(e){if(!te(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=se,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=te,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:oe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,k)}catch(e){k(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.6`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&re(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&re(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var D=new MessageChannel,ne=D.port2;D.port1.onmessage=ee,te=function(){ne.postMessage(null)}}else te=function(){_(ee,0)};function re(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,re(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.6`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()}));function g(e){return e[e.length-1]}function _(e){return typeof e==`function`}function v(e,t){return _(e)?e(t):e}var y=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;function x(e){for(let t in e)if(y.call(e,t))return!0;return!1}var S=()=>Object.create(null),C=(e,t)=>w(e,t,S);function w(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=te(e)&&te(i);if(!a&&!(E(e)&&E(i)))return i;let o=a?e:T(e);if(!o)return i;let s=a?i:T(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:y.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=w(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function T(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!b.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!b.call(e,t))return!1;r.push(t)}return r}function E(e){if(!ee(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ee(n)||!n.hasOwnProperty(`isPrototypeOf`))}function ee(e){return Object.prototype.toString.call(e)===`[object Object]`}function te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function D(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!D(e[r],t[r],n))return!1;return!0}if(E(e)&&E(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!D(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!D(e[o],t[o],n)))return!1;return i===a}return!1}function ne(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function re(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function ie(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function O(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return ie(t)}var ae=[`http:`,`https:`,`mailto:`,`tel:`];function oe(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function k(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=O(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=O(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function se(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ce(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function le(){throw Error(`Invariant failed`)}var ue=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),de=o(((e,t)=>{t.exports=ue()})),A=l(d(),1),fe=A.createContext(null);function pe(e){return A.useContext(fe)}var me=A.createContext(void 0),he=A.createContext(void 0),ge=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),_e=o(((e,t)=>{t.exports=ge()})),ve=o((e=>{var t=d(),n=_e();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),ye=o(((e,t)=>{t.exports=ve()})),be=ye();function xe(e,t){return e===t}function Se(e,t,n=xe){let r=(0,A.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,A.useCallback)(()=>e?.get(),[e]);return(0,be.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ce={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function we(e){let t=pe(),n=A.useContext(e.from?he:me),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=A.useRef(void 0);return Se(i??Ce,n=>{if((e.shouldThrow??!0)&&!n&&le(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=w(a.current,r);return a.current=e,e}return r})}function Te(e){return we({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}var Ee=o((e=>{var t=d().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;e.c=function(e){return t.H.useMemoCache(e)}})),De=o(((e,t)=>{t.exports=Ee()})),Oe=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let e=0,r=t.length;e<r;e++)n=t[e](n);return n}}},ke={pipe(){return Oe(this,arguments)}},Ae=function(){function e(){}return e.prototype=ke,e}(),j=function(e,t){if(typeof e==`function`)return function(){return e(arguments)?t.apply(this,arguments):e=>t(e,...arguments)};switch(e){case 0:case 1:throw RangeError(`Invalid arity ${e}`);case 2:return function(e,n){return arguments.length>=2?t(e,n):function(n){return t(n,e)}};case 3:return function(e,n,r){return arguments.length>=3?t(e,n,r):function(r){return t(r,e,n)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);let n=arguments;return function(e){return t(e,...n)}}}},je=e=>e,Me=e=>()=>e,Ne=Me(!0),Pe=Me(!1),Fe=Me(null),Ie=Me(void 0),Le=Ie;function Re(e,...t){return Oe(e,t)}function ze(e,t,n,r,i,a,o,s,c){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return r(n(t(e.apply(this,arguments))))};case 5:return function(){return i(r(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(r(n(t(e.apply(this,arguments))))))};case 7:return function(){return o(a(i(r(n(t(e.apply(this,arguments)))))))};case 8:return function(){return s(o(a(i(r(n(t(e.apply(this,arguments))))))))};case 9:return function(){return c(s(o(a(i(r(n(t(e.apply(this,arguments)))))))))}}}function Be(e){let t=new WeakMap;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}var Ve=e=>{let t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete(`stack`);let n=Object.getPrototypeOf(e),r=n;for(;r!==null&&r!==Object.prototype;){let e=Reflect.ownKeys(r);for(let n=0;n<e.length;n++)t.add(e[n]);r=Object.getPrototypeOf(r)}return t.has(`constructor`)&&typeof e.constructor==`function`&&n===e.constructor.prototype&&t.delete(`constructor`),t},He=new WeakSet;function Ue(e){return typeof e==`string`}function We(e){return typeof e==`number`}function Ge(e){return typeof e==`boolean`}function Ke(e){return typeof e==`bigint`}function qe(e){return typeof e==`symbol`}function Je(e){return Ue(e)||We(e)||qe(e)}function Ye(e){return typeof e==`function`}function Xe(e){return e!==void 0}function Ze(e){return e!=null}function Qe(e){return!1}function $e(e){return!0}function et(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tt(e){return typeof e==`object`&&!!e||Ye(e)}var nt=j(2,(e,t)=>tt(e)&&t in e),rt=j(2,(e,t)=>nt(e,`_tag`)&&e._tag===t);function eee(e){return e instanceof Error}function it(e){return nt(e,Symbol.iterator)||Ue(e)}var at=j(2,(e,t)=>n=>e(n)||t(n)),ot=`~effect/interfaces/Hash`,st=e=>{switch(typeof e){case`number`:return ft(e);case`bigint`:return pt(e.toString(10));case`boolean`:return pt(String(e));case`symbol`:return pt(String(e));case`string`:return pt(e);case`undefined`:return pt(`undefined`);case`function`:case`object`:if(e===null)return pt(`null`);if(e instanceof Date)return pt(e.toISOString());if(e instanceof RegExp)return pt(e.toString());{if(He.has(e))return ct(e);if(bt.has(e))return bt.get(e);let t=St(e,()=>dt(e)?e[ot]():typeof e==`function`?ct(e):Array.isArray(e)||ArrayBuffer.isView(e)?gt(e):e instanceof Map?_t(e):e instanceof Set?vt(e):mt(e));return bt.set(e,t),t}default:throw Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},ct=e=>(yt.has(e)||yt.set(e,ft(Math.floor(Math.random()*(2**53-1)))),yt.get(e)),lt=j(2,(e,t)=>e*53^t),ut=e=>e&3221225471|e>>>1&1073741824,dt=e=>nt(e,ot),ft=e=>{if(e!==e)return pt(`NaN`);if(e===1/0)return pt(`Infinity`);if(e===-1/0)return pt(`-Infinity`);let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return ut(t)},pt=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ut(t)},tee=(e,t)=>{let n=12289;for(let r of t)n^=lt(st(r),st(e[r]));return ut(n)},mt=e=>tee(e,Ve(e)),ht=(e,t)=>n=>{let r=e;for(let e of n)r^=t(e);return ut(r)},gt=ht(6151,st),_t=ht(pt(`Map`),([e,t])=>lt(st(e),st(t))),vt=ht(pt(`Set`),st),yt=new WeakMap,bt=new WeakMap,xt=new WeakSet;function St(e,t){if(xt.has(e))return pt(`[Circular]`);xt.add(e);let n=t();return xt.delete(e),n}var Ct=`~effect/interfaces/Equal`;function wt(){return arguments.length===1?e=>Tt(e,arguments[0]):Tt(arguments[0],arguments[1])}function Tt(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=typeof e;return n===typeof t?n===`number`&&e!==e&&t!==t?!0:n!==`object`&&n!==`function`||He.has(e)||He.has(t)?!1:Ot(e,t,ree):!1}function nee(e,t,n){let r=Et.has(e),i=Dt.has(t);if(r&&i)return!0;if(r||i)return!1;Et.add(e),Dt.add(t);let a=n();return Et.delete(e),Dt.delete(t),a}var Et=new WeakSet,Dt=new WeakSet;function ree(e,t){if(st(e)!==st(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;let n=It(e),r=It(t);if(n!==r)return!1;let i=n&&r;return typeof e==`function`&&!i?!1:nee(e,t,()=>i?e[Ct](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:iee(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:At(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:Nt(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:Ft(e,t):jt(e,t))}function Ot(e,t,n){let r=kt.get(e);if(!r)r=new WeakMap,kt.set(e,r);else if(r.has(t))return r.get(t);let i=n(e,t);r.set(t,i);let a=kt.get(t);return a||(a=new WeakMap,kt.set(t,a)),a.set(e,i),i}var kt=new WeakMap;function iee(e,t){for(let n=0;n<e.length;n++)if(!Tt(e[n],t[n]))return!1;return!0}function At(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function jt(e,t){let n=Ve(e),r=Ve(t);if(n.size!==r.size)return!1;for(let i of n)if(!r.has(i)||!Tt(e[i],t[i]))return!1;return!0}function Mt(e,t){return function(n,r){for(let[i,a]of n){let n=!1;for(let[o,s]of r)if(e(i,o)&&t(a,s)){n=!0;break}if(!n)return!1}return!0}}var Nt=Mt(Tt,Tt);function Pt(e){return function(t,n){for(let r of t){let t=!1;for(let i of n)if(e(r,i)){t=!0;break}if(!t)return!1}return!0}}var Ft=Pt(Tt),It=e=>nt(e,Ct),Lt=Symbol.for(`~effect/Redactable`),Rt=e=>nt(e,Lt);function zt(e){return Rt(e)?Bt(e):e}function Bt(e){return e[Lt](globalThis[`~effect/Fiber/currentFiber`]?.context??Ht)}var Vt=`~effect/Fiber/currentFiber`,Ht={"~effect/Context":{},mapUnsafe:new Map,pipe(){return Oe(this,arguments)}};function Ut(e,t){let n=t?.space??0,r=new WeakSet,i=n?typeof n==`number`?` `.repeat(n):n:``,a=e=>i.repeat(e),o=(e,t)=>{let n=e?.constructor;return n&&n!==Object.prototype.constructor&&n.name?`${n.name}(${t})`:t},s=e=>{try{return Reflect.ownKeys(e)}catch{return[`[ownKeys threw]`]}};function c(e,n=0){if(Array.isArray(e)){if(r.has(e))return Wt;if(r.add(e),!i||e.length<=1)return`[${e.map(e=>c(e,n)).join(`,`)}]`;let t=e.map(e=>c(e,n+1)).join(`,
|
|
2
|
-
`+a(n+1));return`[\n${a(n+1)}${t}\n${a(n)}]`}if(e instanceof Date)return oee(e);if(!t?.ignoreToString&&nt(e,`toString`)&&typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString){let t=see(e);return e instanceof Error&&e.cause?`${t} (cause: ${c(e.cause,n)})`:t}if(typeof e==`string`)return JSON.stringify(e);if(typeof e==`number`||e==null||typeof e==`boolean`||typeof e==`symbol`)return String(e);if(typeof e==`bigint`)return String(e)+`n`;if(typeof e==`object`||typeof e==`function`){if(r.has(e))return Wt;if(r.add(e),Lt in e)return Ut(Bt(e));if(Symbol.iterator in e)return`${e.constructor.name}(${c(Array.from(e),n)})`;let t=s(e);if(!i||t.length<=1){let r=`{${t.map(t=>`${Gt(t)}:${c(e[t],n)}`).join(`,`)}}`;return o(e,r)}let l=`{\n${t.map(t=>`${a(n+1)}${Gt(t)}: ${c(e[t],n+1)}`).join(`,
|
|
3
|
-
`)}\n${a(n)}}`;return o(e,l)}return String(e)}return c(e,0)}var Wt=`[Circular]`;function Gt(e){return typeof e==`string`?JSON.stringify(e):String(e)}function aee(e){return e.map(e=>`[${Gt(e)}]`).join(``)}function oee(e){try{return e.toISOString()}catch{return`Invalid Date`}}function see(e){try{let t=e.toString();return typeof t==`string`?t:String(t)}catch{return`[toString threw]`}}function Kt(e,t){let n=[];return JSON.stringify(e,function(e,t){let r=zt(t);if(typeof r!=`object`||!r)return r;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(!n.includes(r))return n.push(r),r},t?.space)}var qt=Symbol.for(`nodejs.util.inspect.custom`),Jt=e=>{try{if(nt(e,`toJSON`)&&Ye(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(Jt)}catch{return`[toJSON threw]`}return zt(e)},cee=(e,t=2)=>{if(typeof e==`string`)return e;try{return typeof e==`object`?Kt(e,{space:t}):String(e)}catch{return String(e)}},Yt={toJSON(){return Jt(this)},[qt](){return this.toJSON()},toString(){return Ut(this.toJSON())}},lee=class{[qt](){return this.toJSON()}toString(){return Ut(this.toJSON())}},Xt=class e{called=!1;self;constructor(e){this.self=e}next(e){return this.called?{value:e,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new e(this.self)}},Zt=(()=>{let e=`~effect/Utils/internal`,t={[e]:e=>e()},n={[e]:e=>{try{return e()}finally{}}};return t[e](()=>Error().stack)?.includes(e)===!0?t[e]:n[e]})();function Qt(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function $t(e,t){for(let n of Reflect.ownKeys(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Qt(e,n,t[n])}var en=`~effect/Effect`,tn=`~effect/Exit`,uee={_A:je,_E:je,_R:je},nn=`${en}/identifier`,rn=`${en}/args`,an=`${en}/evaluate`,on=`${en}/successCont`,sn=`${en}/failureCont`,cn=`${en}/ensureCont`,ln=Symbol.for(`effect/Effect/Yield`),un={pipe(){return Oe(this,arguments)},toJSON(){return{...this}},toString(){return Ut(this.toJSON(),{ignoreToString:!0,space:2})},[qt](){return this.toJSON()}},dn={[en]:uee,...un,[Symbol.iterator](){return new Xt(this)},toJSON(){return{_id:`Effect`,op:this[nn],...rn in this?{args:this[rn]}:void 0}}},fn=e=>nt(e,en),pn=e=>nt(e,tn),mn=`~effect/Cause`,hn=`~effect/Cause/Reason`,gn=e=>nt(e,mn),_n=e=>nt(e,hn),vn=class{[mn];reasons;constructor(e){this[mn]=mn,this.reasons=e}pipe(){return Oe(this,arguments)}toJSON(){return{_id:`Cause`,failures:this.reasons.map(e=>e.toJSON())}}toString(){return`Cause(${Ut(this.reasons)})`}[qt](){return this.toJSON()}[Ct](e){return gn(e)&&this.reasons.length===e.reasons.length&&this.reasons.every((t,n)=>wt(t,e.reasons[n]))}[ot](){return gt(this.reasons)}},yn=new WeakMap,bn=class{[hn];annotations;_tag;constructor(e,t,n){if(this[hn]=hn,this._tag=e,t!==xn&&typeof n==`object`&&n&&t.size>0){let e=yn.get(n);e&&(t=new Map([...e,...t])),yn.set(n,t)}this.annotations=t}annotate(e,t){if(e.mapUnsafe.size===0)return this;let n=new Map(this.annotations);e.mapUnsafe.forEach((e,r)=>{t?.overwrite!==!0&&n.has(r)||n.set(r,e)});let r=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return r.annotations=n,r}pipe(){return Oe(this,arguments)}toString(){return Ut(this)}[qt](){return this.toString()}},xn=new Map,Sn=class extends bn{error;constructor(e,t=xn){super(`Fail`,t,e),this.error=e}toString(){return`Fail(${Ut(this.error)})`}toJSON(){return{_tag:`Fail`,error:this.error}}[Ct](e){return kn(e)&&wt(this.error,e.error)&&wt(this.annotations,e.annotations)}[ot](){return lt(pt(this._tag))(lt(st(this.error))(st(this.annotations)))}},Cn=e=>new vn(e),wn=new vn([]),Tn=e=>new vn([new Sn(e)]),En=class extends bn{defect;constructor(e,t=xn){super(`Die`,t,e),this.defect=e}toString(){return`Die(${Ut(this.defect)})`}toJSON(){return{_tag:`Die`,defect:this.defect}}[Ct](e){return An(e)&&wt(this.defect,e.defect)&&wt(this.annotations,e.annotations)}[ot](){return lt(pt(this._tag))(lt(st(this.defect))(st(this.annotations)))}},Dn=e=>new vn([new En(e)]),On=j(e=>gn(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new vn(e.reasons.map(e=>e.annotate(t,n)))),kn=e=>e._tag===`Fail`,An=e=>e._tag===`Die`,jn=e=>e._tag===`Interrupt`;function dee(e){return Bn(`Effect.evaluate: Not implemented`)}var Mn=e=>({...dn,[nn]:e.op,[an]:e[an]??dee,[on]:e[on],[sn]:e[sn],[cn]:e[cn]}),Nn=e=>{let t=Mn(e);return function(){let n=Object.create(t);return n[rn]=e.single===!1?arguments:arguments[0],n}},Pn=e=>{let t={...Mn(e),[tn]:tn,_tag:e.op,get[e.prop](){return this[rn]},toString(){return`${e.op}(${Ut(this[rn])})`},toJSON(){return{_id:`Exit`,_tag:e.op,[e.prop]:this[rn]}},[Ct](e){return pn(e)&&e._tag===this._tag&&wt(this[rn],e[rn])},[ot](){return lt(pt(e.op),st(this[rn]))}};return function(e){let n=Object.create(t);return n[rn]=e,n}},Fn=Pn({op:`Success`,prop:`value`,[an](e){let t=e.getCont(on);return t?t[on](this[rn],e,this):e.yieldWith(this)}}),In={key:`effect/Cause/StackTrace`},Ln={key:`effect/Cause/InterruptorStackTrace`},Rn=Pn({op:`Failure`,prop:`cause`,[an](e){let t=this[rn],n=!1;e.currentStackFrame&&(t=On(t,{mapUnsafe:new Map([[In.key,e.currentStackFrame]])}),n=!0);let r=e.getCont(sn);for(;e.interruptible&&e._interruptedCause&&r;)r=e.getCont(sn);return r?r[sn](t,e,n?void 0:this):e.yieldWith(n?Rn(t):this)}}),zn=e=>Rn(Tn(e)),Bn=e=>Rn(Dn(e)),Vn=Nn({op:`WithFiber`,[an](e){return this[rn](e)}}),fee=function(){class e extends globalThis.Error{}let t=Mn({op:`YieldableError`,[an](){return zn(this)}});return delete t.toString,Object.assign(e.prototype,t),e}(),Hn=function(){let e=Symbol.for(`effect/Data/Error/plainArgs`);return class extends fee{constructor(t){super(t?.message,t?.cause?{cause:t.cause}:void 0),t&&($t(this,t),Object.defineProperty(this,e,{value:t,enumerable:!1}))}toJSON(){return{...this[e],...this}}}}(),Un=e=>{class t extends Hn{_tag=e}return t.prototype.name=e,t},Wn=`~effect/Cause/NoSuchElementError`,pee=class extends Un(`NoSuchElementError`){[Wn]=Wn;constructor(e){super({message:e})}},Gn=`~effect/Cause/Done`,Kn=e=>nt(e,Gn),qn={[Gn]:Gn,_tag:`Done`,value:void 0},Jn=e=>e===void 0?qn:{[Gn]:Gn,_tag:`Done`,value:e},Yn=zn(qn),mee=e=>e===void 0?Yn:zn(Jn(e)),Xn=e=>Mn({op:e.label,[an]:e.evaluate}),hee=(()=>{let e=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return e===void 0?Object.isExtensible(Error):Object.hasOwn(e,`writable`)?e.writable===!0:e.set!==void 0})(),Zn=()=>Error.stackTraceLimit,Qn=e=>{hee&&(Error.stackTraceLimit=e)},$n=e=>(t,n)=>t===n||e(t,n),er=(e,t)=>e===t,tr=()=>er;function nr(e){return $n((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e[r](t[r],n[r]))return!1;return!0})}function rr(e){return $n((t,n)=>{if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0})}var ir=`~effect/data/Option`,ar={[ir]:{_A:e=>e},...un,[Symbol.iterator](){return new Xt(this)}},or=Object.defineProperty(Object.assign(Object.create(ar),{_tag:`Some`,_op:`Some`,[Ct](e){return lr(e)&&dr(e)&&wt(this.value,e.value)},[ot](){return lt(st(this._tag))(st(this.value))},toString(){return`some(${Ut(this.value)})`},toJSON(){return{_id:`Option`,_tag:this._tag,value:Jt(this.value)}}}),"valueOrUndefined",{get(){return this.value}}),sr=st(`None`),cr=Object.assign(Object.create(ar),{_tag:`None`,_op:`None`,valueOrUndefined:void 0,[Ct](e){return lr(e)&&ur(e)},[ot](){return sr},toString(){return`none()`},toJSON(){return{_id:`Option`,_tag:this._tag}}}),lr=e=>nt(e,ir),ur=e=>e._tag===`None`,dr=e=>e._tag===`Some`,gee=Object.create(cr),_ee=e=>{let t=Object.create(or);return t.value=e,t},fr=`~effect/data/Result`,pr={[fr]:{_A:e=>e,_E:e=>e},...un,[Symbol.iterator](){return new Xt(this)}},vee=Object.assign(Object.create(pr),{_tag:`Success`,_op:`Success`,[Ct](e){return mr(e)&&gr(e)&&wt(this.success,e.success)},[ot](){return lt(st(this._tag))(st(this.success))},toString(){return`success(${Ut(this.success)})`},toJSON(){return{_id:`Result`,_tag:this._tag,value:Jt(this.success)}}}),yee=Object.assign(Object.create(pr),{_tag:`Failure`,_op:`Failure`,[Ct](e){return mr(e)&&hr(e)&&wt(this.failure,e.failure)},[ot](){return lt(st(this._tag))(st(this.failure))},toString(){return`failure(${Ut(this.failure)})`},toJSON(){return{_id:`Result`,_tag:this._tag,failure:Jt(this.failure)}}}),mr=e=>nt(e,fr),hr=e=>e._tag===`Failure`,gr=e=>e._tag===`Success`,_r=e=>{let t=Object.create(yee);return t.failure=e,t},vr=e=>{let t=Object.create(vee);return t.success=e,t};function yr(e){return(t,n)=>t===n?0:e(t,n)}var br=yr((e,t)=>e<t?-1:1),xr=yr((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),Sr=yr((e,t)=>e<t?-1:1);function Cr(e){return yr((t,n)=>e(n,t))}var wr=j(2,(e,t)=>yr((n,r)=>{let i=e(n,r);return i===0?t(n,r):i}));function Tr(e){return yr((t,n)=>{let r=0;for(let i of e)if(r=i(t,n),r!==0)return r;return r})}var Er=j(2,(e,t)=>yr((n,r)=>e(t(n),t(r))));function Dr(e){let t=Object.keys(e);return yr((n,r)=>{for(let i of t){let t=e[i](n[i],r[i]);if(t!==0)return t}return 0})}var Or=e=>j(2,(t,n)=>e(t,n)===-1),kr=e=>j(2,(t,n)=>e(t,n)===1),Ar=e=>j(2,(t,n)=>e(t,n)!==1),jr=e=>j(2,(t,n)=>e(t,n)!==-1),Mr=e=>j(2,(t,n)=>t===n||e(t,n)<1?t:n),Nr=e=>j(2,(t,n)=>t===n||e(t,n)>-1?t:n),Pr=()=>gee,Fr=_ee,Ir=lr,Lr=ur,Rr=dr,zr=j(2,(e,{onNone:t,onSome:n})=>Lr(e)?t():n(e.value)),Br=j(2,(e,t)=>Lr(e)?t():e.value),Vr=e=>{let t=Pr();for(t of e)if(Rr(t))return t;return t},Hr=e=>e==null?Pr():Fr(e),Ur=e=>e===void 0?Pr():Fr(e),Wr=Br(Fe),Gr=Br(Ie),Kr=e=>(...t)=>{try{return Fr(e(...t))}catch{return Pr()}},qr=j(2,(e,t)=>{if(Rr(e))return e.value;throw t()}),Jr=qr(()=>Error(`getOrThrow called on a None`)),Yr=j(2,(e,t)=>Lr(e)?Pr():Fr(t(e.value))),Xr=j(2,(e,t)=>Lr(e)?Pr():t(e.value)),Zr=j(2,(e,t)=>Lr(e)?Pr():Hr(t(e.value))),Qr=j(2,(e,t)=>Lr(e)?Pr():t(e.value)?Fr(e.value):Pr()),$r=e=>$n((t,n)=>Lr(t)?Lr(n):Lr(n)?!1:e(t.value,n.value)),ei=`~effect/Context/Service`,ti=function(){let e=Zn();Qn(2);let t=Error();Qn(e);function n(){}let r=n;return Object.setPrototypeOf(r,ni),Object.defineProperty(r,"stack",{get(){return t.stack}}),arguments.length>0?(r.key=arguments[0],arguments[1]?.defaultValue&&(r[ri]=ri,r.defaultValue=arguments[1].defaultValue),r):function(e,t){return r.key=e,t?.make&&(r.make=t.make),r}},ni={[ei]:ei,...Xn({label:`Service`,evaluate(e){return Fn(di(e.context,this))}}),toJSON(){return{_id:`Service`,key:this.key,stack:this.stack}},of(e){return e},context(e){return ci(this,e)},use(e){return Vn(t=>e(di(t.context,this)))},useSync(e){return Vn(t=>Fn(e(di(t.context,this))))}},ri=`~effect/Context/Reference`,ii=`~effect/Context`,ai=e=>{let t=Object.create(bee);return t.mapUnsafe=e,t.mutable=!1,t},bee={...un,[ii]:{_Services:e=>e},toJSON(){return{_id:`Context`,services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Ct](e){if(!oi(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(let t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!wt(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[ot](){return ft(this.mapUnsafe.size)}},oi=e=>nt(e,ii),xee=e=>nt(e,ri),si=()=>See,See=ai(new Map),ci=(e,t)=>ai(new Map([[e.key,t]])),li=j(3,(e,t,n)=>hi(e,e=>{e.set(t.key,n)})),Cee=j(2,(e,t)=>e.mapUnsafe.get(t.key)),ui=j(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(ri in t)return pi(t);throw Tee(t)}return e.mapUnsafe.get(t.key)}),di=ui,wee=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):pi(t),fi=`~effect/Context/defaultValue`,pi=e=>fi in e?e[fi]:e[fi]=e.defaultValue(),Tee=e=>{let t=Error(`Service not found${e.key?`: ${String(e.key)}`:``}`);if(e.stack){let n=e.stack.split(`
|
|
4
|
-
`);if(n.length>2){let e=n[2].match(/at (.*)/);e&&(t.message+=` (defined at ${e[1]})`)}}if(t.stack){let e=t.stack.split(`
|
|
5
|
-
`);e.splice(1,3),t.stack=e.join(`
|
|
6
|
-
`)}return t},Eee=j(2,(e,t)=>e.mapUnsafe.has(t.key)?Fr(e.mapUnsafe.get(t.key)):xee(t)?Fr(pi(t)):Pr()),mi=j(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:hi(e,e=>{t.mapUnsafe.forEach((t,n)=>e.set(n,t))})),Dee=(...e)=>{let t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((e,n)=>{t.set(n,e)});return ai(t)},hi=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;let n=new Map(e.mapUnsafe);return t(n),ai(n)},gi=ti,_i=`~effect/time/Duration`,Oee=BigInt(0),kee=BigInt(1),Aee=BigInt(1e3),vi=e=>BigInt(e<0?Math.ceil(e-.5):Math.floor(e+.5)),yi=e=>vi(e*1e6),bi=(e,t)=>e.includes(`.`)?vi(Number(e)*Number(t)):BigInt(e)*t,jee=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,xi=e=>{switch(typeof e){case`number`:return Ai(e);case`bigint`:return ki(e);case`string`:{if(e===`Infinity`)return Di;if(e===`-Infinity`)return Oi;let t=jee.exec(e);if(!t)break;let[n,r,i]=t;if(i===`nano`||i===`nanos`)return ki(bi(r,kee));if(i===`micro`||i===`micros`)return ki(bi(r,Aee));let a=Number(r);switch(i){case`milli`:case`millis`:return Ai(a);case`second`:case`seconds`:return ji(a);case`minute`:case`minutes`:return Iee(a);case`hour`:case`hours`:return Lee(a);case`day`:case`days`:return Ree(a);case`week`:case`weeks`:return zee(a)}break}case`object`:{if(e===null)break;if(_i in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(We)?Si(e):Number.isNaN(e[0])||Number.isNaN(e[1])?Ei:e[0]===-1/0||e[1]===-1/0?Oi:e[0]===1/0||e[1]===1/0?Di:wi(vi(e[0]*1e9+e[1]));let t=e,n=0;return t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds?wi(n):wi(vi(n*1e6+(t.microseconds??0)*1e3+(t.nanoseconds??0)))}}return Si(e)},Si=e=>{throw Error(`Invalid Input: ${e}`)},Ci={_tag:`Millis`,millis:0},Mee={_tag:`Infinity`},Nee={_tag:`NegativeInfinity`},Pee={[_i]:_i,[ot](){return mt(this.value)},[Ct](e){return Ti(e)&&Bi(this,e)},toString(){switch(this.value._tag){case`Infinity`:return`Infinity`;case`NegativeInfinity`:return`-Infinity`;case`Nanos`:return`${this.value.nanos} nanos`;case`Millis`:return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case`Millis`:return{_id:`Duration`,_tag:`Millis`,millis:this.value.millis};case`Nanos`:return{_id:`Duration`,_tag:`Nanos`,nanos:String(this.value.nanos)};case`Infinity`:return{_id:`Duration`,_tag:`Infinity`};case`NegativeInfinity`:return{_id:`Duration`,_tag:`NegativeInfinity`}}},[qt](){return this.toJSON()},pipe(){return Oe(this,arguments)}},wi=e=>{let t=Object.create(Pee);return typeof e==`number`?isNaN(e)||e===0||Object.is(e,-0)?t.value=Ci:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:`Millis`,millis:e}:t.value={_tag:`Nanos`,nanos:yi(e)}:t.value=e>0?Mee:Nee:e===Oee?t.value=Ci:t.value={_tag:`Nanos`,nanos:e},t},Ti=e=>nt(e,_i),Fee=e=>e.value._tag!==`Infinity`&&e.value._tag!==`NegativeInfinity`,Ei=wi(0),Di=wi(1/0),Oi=wi(-1/0),ki=e=>wi(e),Ai=e=>wi(e),ji=e=>wi(e*1e3),Iee=e=>wi(e*6e4),Lee=e=>wi(e*36e5),Ree=e=>wi(e*864e5),zee=e=>wi(e*6048e5),Mi=e=>Bee(xi(e),{onMillis:je,onNanos:e=>Number(e)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),Ni=e=>{let t=xi(e);switch(t.value._tag){case`Infinity`:case`NegativeInfinity`:throw Error(`Cannot convert infinite duration to nanos`);case`Nanos`:return t.value.nanos;case`Millis`:return yi(t.value.millis)}},Bee=j(2,(e,t)=>{switch(e.value._tag){case`Millis`:return t.onMillis(e.value.millis);case`Nanos`:return t.onNanos(e.value.nanos);case`Infinity`:return t.onInfinity();case`NegativeInfinity`:return(t.onNegativeInfinity??t.onInfinity)()}}),Pi=j(3,(e,t,n)=>e.value._tag===`Infinity`||e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`||t.value._tag===`NegativeInfinity`?n.onInfinity(e,t):e.value._tag===`Millis`?t.value._tag===`Millis`?n.onMillis(e.value.millis,t.value.millis):n.onNanos(Ni(e),t.value.nanos):n.onNanos(e.value.nanos,Ni(t))),Fi=yr((e,t)=>Pi(e,t,{onMillis:(e,t)=>e<t?-1:+(e>t),onNanos:(e,t)=>e<t?-1:+(e>t),onInfinity:(e,t)=>e.value._tag===t.value._tag?0:e.value._tag===`Infinity`?1:e.value._tag===`NegativeInfinity`||t.value._tag===`Infinity`?-1:1})),Ii=(e,t)=>Pi(e,t,{onMillis:(e,t)=>e===t,onNanos:(e,t)=>e===t,onInfinity:(e,t)=>e.value._tag===t.value._tag}),Li=Mr(Fi),Ri=Nr(Fi),zi=j(2,(e,t)=>Pi(e,t,{onMillis:(e,t)=>wi(e+t),onNanos:(e,t)=>wi(e+t),onInfinity:(e,t)=>{let n=e.value._tag,r=t.value._tag;return n===`Infinity`&&r===`NegativeInfinity`||n===`NegativeInfinity`&&r===`Infinity`?Ei:n===`Infinity`||r===`Infinity`?Di:n===`NegativeInfinity`||r===`NegativeInfinity`?Oi:Ei}})),Bi=j(2,(e,t)=>Ii(e,t)),Vi=e=>e.length>0,Hi=vr,Ui=_r,Wi=Ui(void 0),Gi=e=>{if(Ye(e))try{return Hi(e())}catch(e){return Ui(e)}else try{return Hi(e.try())}catch(t){return Ui(e.catch(t))}},Ki=hr,qi=gr,Vee=j(2,(e,{onFailure:t,onSuccess:n})=>Ki(e)?t(e.failure):n(e.success)),Hee=nr,Ji=e=>{let t=e[Symbol.iterator]().next();if(t.done)throw Error(`headUnsafe: empty iterable`);return t.value},Uee={[Symbol.iterator](){return Wee}},Wee={next(){return{done:!0,value:void 0}}},Gee=()=>Uee,Kee=j(2,(e,t)=>Object.hasOwn(e,t)),Yi=j(2,(e,t)=>{let n={...e};for(let r of Xi(e))Qt(n,r,t(e[r],r));return n}),Xi=e=>Object.keys(e),qee=e=>j(2,(t,n)=>{for(let r of Xi(t))if(!Kee(n,r)||!e(t[r],n[r]))return!1;return!0}),Jee=e=>{let t=qee(e);return(e,n)=>t(e,n)&&t(n,e)},Zi=globalThis.Array,Qi=e=>Zi.isArray(e)?e:Zi.from(e),$i=e=>Zi.isArray(e)?e:[e],ea=j(2,(e,t)=>[...e,t]),ta=j(2,(e,t)=>Qi(e).concat(Qi(t))),na=Zi.isArray,ra=Vi,ia=Vi;function aa(e,t){return e<0||e>=t.length}var oa=j(2,(e,t)=>{let n=Math.floor(t);if(aa(n,e))throw Error(`Index out of bounds: ${n}`);return e[n]}),sa=e=>ia(e)?Fr(ca(e)):Pr(),ca=e=>e[e.length-1],la=j(2,(e,t)=>{let n=Qi(e);for(let e=n.length-1;e>=0;e--){let r=n[e],i=t(r,e);if(typeof i==`boolean`){if(i)return Fr(r)}else if(Rr(i))return i}return Pr()}),ua=j(2,(e,t)=>{let n=Zi.from(e);return n.sort(t),n}),da=(e,t)=>{let n=st(t),r=e.get(n);if(r===void 0)return e.set(n,[t]),!0;for(let e of r)if(wt(e,t))return!1;return r.push(t),!0},fa=j(2,(e,t)=>{let n=Qi(e),r=Qi(t);return ia(n)?ia(r)?ya(ta(n,r)):n:r}),pa=()=>[],ma=e=>[e],ha=j(2,(e,t)=>e.map(t)),ga=j(2,(e,t)=>{let n=Qi(e),r=[];for(let e=0;e<n.length;e++){let i=t(n[e],e);qi(i)&&r.push(i.success)}return r}),_a=j(2,(e,t)=>{let n=Qi(e),r=[];for(let e=0;e<n.length;e++)t(n[e],e)&&r.push(n[e]);return r}),va=rr,ya=e=>{let t=Qi(e);if(t.length<2)return[...t];let n=new Map,r=[];for(let e of t)da(n,e)&&r.push(e);return r},ba=e=>t=>!Ki(e(t)),xa=e=>t=>t.has(e)?Hi(t):Ui(t),Sa=j(2,(e,t)=>n=>{let r=e(n);return Ki(r)?r:t(r.success)}),Ca=j(2,(e,t)=>n=>{let r=e(n);if(Ki(r))return Ui(n);let i=t(r.success);return Ki(i)?Ui(n):i}),wa=gi(`effect/Scheduler`,{defaultValue:()=>new Ea}),Ta=`setImmediate`in globalThis?e=>{let t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{let t=setTimeout(e,0);return()=>clearTimeout(t)},Yee=class{buckets=[];scheduleTask(e,t){let n=this.buckets,r=n.length,i,a=0;for(;a<r&&!(n[a][0]>t);a++)i=n[a];i&&i[0]===t?i[1].push(e):a===r?n.push([t,[e]]):n.splice(a,0,[t,[e]])}drain(){let e=this.buckets;return this.buckets=[],e}},Ea=class{executionMode;setImmediate;constructor(e=`async`,t=Ta){this.executionMode=e,this.setImmediate=t}shouldYield(e){return e.currentOpCount>=e.maxOpsBeforeYield}makeDispatcher(){return new Xee(this.setImmediate)}},Xee=class{tasks=new Yee;running=void 0;setImmediate;constructor(e=Ta){this.setImmediate=e}scheduleTask(e,t){this.tasks.scheduleTask(e,t),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}afterScheduled=()=>{this.running=void 0,this.runTasks()};runTasks(){let e=this.tasks.drain();for(let t=0;t<e.length;t++){let n=e[t][1];for(let e=0;e<n.length;e++)n[e]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}},Zee=gi(`effect/Scheduler/MaxOpsBeforeYield`,{defaultValue:()=>2048}),Qee=gi(`effect/Scheduler/PreventSchedulerYield`,{defaultValue:()=>!1}),Da=`effect/Tracer/ParentSpan`,Oa=class extends ti()(Da){},ka=e=>e,Aa=gi(`effect/Tracer/DisablePropagation`,{defaultValue:Pe}),$ee=gi(`effect/Tracer/CurrentTraceLevel`,{defaultValue:()=>`Info`}),ete=gi(`effect/Tracer/MinimumTraceLevel`,{defaultValue:()=>`All`}),ja=`effect/Tracer`,Ma=gi(ja,{defaultValue:()=>ka({span:e=>new Na(e)})}),Na=class{_tag=`Span`;spanId;traceId=`native`;sampled;name;parent;annotations;links;startTime;kind;status;attributes;events=[];constructor(e){this.name=e.name,this.parent=e.parent,this.annotations=e.annotations,this.links=e.links,this.startTime=e.startTime,this.kind=e.kind,this.sampled=e.sampled,this.status={_tag:`Started`,startTime:e.startTime},this.attributes=new Map,this.traceId=Gr(e.parent)?.traceId??Pa(32),this.spanId=Pa(16)}end(e,t){this.status={_tag:`Ended`,endTime:e,exit:t,startTime:this.status.startTime}}attribute(e,t){this.attributes.set(e,t)}event(e,t,n){this.events.push([e,t,n??{}])}addLinks(e){this.links.push(...e)}},Pa=function(){return function(e){let t=``;for(let n=0;n<e;n++)t+=`abcdef0123456789`.charAt(Math.floor(Math.random()*16));return t}}(),tte=`effect/observability/Metric/FiberRuntimeMetricsKey`,Fa=gi(`effect/References/CurrentStackFrame`,{defaultValue:Ie}),Ia=gi(`effect/References/TracerEnabled`,{defaultValue:Ne}),La=gi(`effect/References/TracerTimingEnabled`,{defaultValue:Ne}),nte=gi(`effect/References/TracerSpanAnnotations`,{defaultValue:()=>({})}),rte=gi(`effect/References/TracerSpanLinks`,{defaultValue:()=>[]}),Ra=gi(`effect/References/CurrentLogAnnotations`,{defaultValue:()=>({})}),ite=gi(`effect/References/CurrentLogLevel`,{defaultValue:()=>`Info`}),ate=gi(`effect/References/MinimumLogLevel`,{defaultValue:()=>`Info`}),ote=gi(`effect/References/CurrentLogSpans`,{defaultValue:()=>[]}),za=e=>{if(e?.captureStackTrace===!1||e?.captureStackTrace!==void 0&&typeof e.captureStackTrace!=`boolean`)return e;let t=Zn();Qn(3);let n=Error();return Qn(t),{...e,captureStackTrace:ste(()=>n.stack)}},Ba=e=>t=>{let n;return()=>{if(n!==void 0)return n;let r=t();if(!r)return;let i=r.split(`
|
|
7
|
-
`);if(i[e]!==void 0)return n=i[e].trim(),n}},ste=Ba(3),Va=class extends bn{fiberId;constructor(e,t=xn){super(`Interrupt`,t,`Interrupted`),this.fiberId=e}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:`Interrupt`,fiberId:this.fiberId}}[Ct](e){return jn(e)&&this.fiberId===e.fiberId&&this.annotations===e.annotations}[ot](){return lt(pt(`${this._tag}:${this.fiberId}`))(ct(this.annotations))}},cte=e=>new Va(e),Ha=e=>new vn([new Va(e)]),lte=e=>{let t=e.reasons.find(kn);return t?Hi(t):Ui(e)},Ua=e=>{for(let t=0;t<e.reasons.length;t++){let n=e.reasons[t];if(n._tag===`Fail`)return Hi(n.error)}return Ui(e)},ute=e=>e.reasons.some(An),Wa=e=>e.reasons.some(jn),Ga=e=>{let t;for(let n=0;n<e.reasons.length;n++){let r=e.reasons[n];r._tag===`Interrupt`&&(t??=new Set,r.fiberId!==void 0&&t.add(r.fiberId))}return t?Hi(t):Ui(e)},dte=e=>{let t=Ga(e);return Ki(t)?fte:t.success},fte=new Set,pte=e=>e.reasons.length>0&&e.reasons.every(jn),Ka=j(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;let n=new vn(fa(e.reasons,t.reasons));return wt(e,n)?e:n}),mte=j(2,(e,t)=>{let n=!1,r=e.reasons.map(e=>kn(e)?(n=!0,new Sn(t(e.error))):e);return n?Cn(r):e}),qa=e=>{let t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},Ja=e=>{let t=qa(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error(`All fibers interrupted without error`):new globalThis.Error(`Empty cause`)},Ya=(e,t)=>{let n=[],r=[];if(e.reasons.length===0)return n;let i=Zn();Qn(1);for(let i of e.reasons){if(i._tag===`Interrupt`){r.push(i);continue}n.push(Xa(i._tag===`Die`?i.defect:i.error,i.annotations,t))}if(n.length===0){let e=Error(`The fiber was interrupted by:`);e.name=`InterruptCause`,e.stack=to(e,r);let i=new globalThis.Error(`All fibers interrupted without error`,{cause:e});i.name=`InterruptError`,i.stack=`${i.name}: ${i.message}`,n.push(Xa(i,r[0].annotations,t))}return Qn(i),n},Xa=(e,t,n)=>{let r=typeof e,i;if(e&&r===`object`){if(i=new globalThis.Error(Za(e),{cause:e.cause?Xa(e.cause):void 0}),typeof e.name==`string`&&(i.name=e.name),typeof e.stack==`string`)i.stack=$a(e.stack,i,t);else{let e=`${i.name}: ${i.message}`;i.stack=t?eo(e,t):e}n?.includeCauseInStack&&(i.stack=io(i));for(let t of Object.keys(e))t in i||(i[t]=e[t])}else i=new globalThis.Error(e?r===`string`?e:Kt(e):`Unknown error: ${e}`);return i},Za=e=>{if(typeof e.message==`string`)return e.message;if(typeof e.toString==`function`&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Kt(e)},Qa=/\((.*)\)/g,$a=(e,t,n)=>{let r=`${t.name}: ${t.message}`,i=(e.startsWith(r)?e.slice(r.length):e).split(`
|
|
8
|
-
`),a=[r];for(let e=1;e<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[e]);e++)a.push(i[e]);return n?eo(a.join(`
|
|
9
|
-
`),n):a.join(`
|
|
10
|
-
`)},eo=(e,t)=>{let n=t?.get(In.key);return n&&(e=`${e}\n${no(n)}`),e},to=(e,t)=>{let n=[`${e.name}: ${e.message}`];for(let e of t){let t=e.fiberId===void 0?`unknown`:`#${e.fiberId}`,r=e.annotations.get(Ln.key);n.push(` at fiber (${t})`),r&&n.push(no(r))}return n.join(`
|
|
11
|
-
`)},no=e=>{let t=[],n=e,r=0;for(;n&&r<10;){let e=n.stack();if(e){let r=e.matchAll(Qa),i=!1;for(let[,e]of r)i=!0,t.push(` at ${n.name} (${e})`);i||t.push(` at ${n.name} (${e.replace(/^at /,``)})`)}else t.push(` at ${n.name}`);n=n.parent,r++}return t.join(`
|
|
12
|
-
`)},ro=e=>Ya(e).map(io).join(`
|
|
13
|
-
`),io=e=>e.cause?`${e.stack} {\n${ao(e.cause,` `)}\n}`:e.stack,ao=(e,t)=>{let n=e.stack.split(`
|
|
14
|
-
`),r=`${t}[cause]: ${n[0]}`;for(let e=1,i=n.length;e<i;e++)r+=`\n${t}${n[e]}`;return e.cause&&(r+=` {\n${ao(e.cause,`${t} `)}\n${t}}`),r},oo=`~effect/Fiber/dev`,so={_A:je,_E:je},co={id:0},lo=()=>globalThis[Vt],uo=class{constructor(e,t=!0){this[oo]=so,this.setContext(e),this.id=++co.id,this.currentOpCount=0,this.interruptible=t,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0,this._running=!1,this._deferredInterrupt=!1,this.runtimeMetrics?.recordFiberStart(this.context)}[oo];id;interruptible;currentOpCount;_stack;_observers;_exit;_children;_interruptedCause;_yielded;_running;_deferredInterrupt;context;currentScheduler;currentTracerContext;currentSpan;currentLogLevel;minimumLogLevel;currentStackFrame;runtimeMetrics;maxOpsBeforeYield;currentPreventYield;_dispatcher=void 0;get currentDispatcher(){return this._dispatcher??=this.currentScheduler.makeDispatcher()}getRef(e){return wee(this.context,e)}addObserver(e){return this._exit?(e(this._exit),Le):(this._observers.push(e),()=>{let t=this._observers.indexOf(e);t>=0&&this._observers.splice(t,1)})}interruptUnsafe(e,t){if(this._exit)return;let n=Ha(e);this.currentStackFrame&&(n=On(n,ci(In,this.currentStackFrame))),t&&(n=On(n,t)),this._interruptedCause=this._interruptedCause?Ka(this._interruptedCause,n):n,this.interruptible&&(this._running?this._deferredInterrupt=!0:this.evaluate(wo(this._interruptedCause)))}pollUnsafe(){return this._exit}evaluate(e){if(this._exit)return;if(this._yielded!==void 0){let e=this._yielded;this._yielded=void 0,e()}let t=this.runLoop(e);if(t===ln)return;let n=po.interruptChildren&&po.interruptChildren(this);if(n!==void 0)return this.evaluate(os(n,()=>t));this._exit=t,this.runtimeMetrics?.recordFiberEnd(this.context,this._exit);for(let e=0;e<this._observers.length;e++)this._observers[e](t);this._observers.length=0,this._stack.length=0,this._children=void 0,this.context=si()}runLoop(e){let t=globalThis[Vt];globalThis[Vt]=this;let n=this._running;this._running=!0;let r=!1,i=e;this.currentOpCount=0;try{for(;;){if(this._deferredInterrupt&&(this._deferredInterrupt=!1,i=wo(this._interruptedCause)),this.currentOpCount++,!r&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){r=!0;let e=i;i=os(ko,()=>e)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[an](this),i===ln){let e=this._yielded;if(tn in e)return this._deferredInterrupt=!1,this._yielded=void 0,e;if(this._deferredInterrupt){this._yielded=void 0,e();continue}return ln}}}catch(e){return nt(i,an)?this.runLoop(Bn(e)):Bn(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{this._running=n,globalThis[Vt]=t}}getCont(e){if(this._deferredInterrupt)return this._deferredInterrupt=!1,fo;for(;;){let t=this._stack.pop();if(!t)return;let n=t[cn]&&t[cn](this);if(n)return n[e]=n,n;if(t[e])return t}}yieldWith(e){return this._yielded=e,ln}children(){return this._children??=new Set}pipe(){return Oe(this,arguments)}setContext(e){this.context=e;let t=this.getRef(wa);t!==this.currentScheduler&&(this.currentScheduler=t,this._dispatcher=void 0),this.currentSpan=e.mapUnsafe.get(Da),this.currentLogLevel=this.getRef(ite),this.minimumLogLevel=this.getRef(ate),this.currentStackFrame=e.mapUnsafe.get(Fa.key),this.maxOpsBeforeYield=this.getRef(Zee),this.currentPreventYield=this.getRef(Qee),this.runtimeMetrics=e.mapUnsafe.get(tte);let n=e.mapUnsafe.get(ja);this.currentTracerContext=n?n.context:void 0}get currentSpanLocal(){return this.currentSpan?._tag===`Span`?this.currentSpan:void 0}},fo={[on](e,t){return wo(t._interruptedCause)},[sn](e,t){return wo(t._interruptedCause)}},po={interruptChildren:void 0},mo=e=>{if(!e.currentStackFrame)return;let t=new Map;return t.set(Ln.key,e.currentStackFrame),ai(t)},ho=e=>{if(!(e._children===void 0||e._children.size===0))return So(e._children)},go=e=>{let t=e;return t._exit?Co(t._exit):Ho(n=>t._exit?n(Co(t._exit)):Eo(e.addObserver(e=>n(Co(e)))))},_o=e=>Ho(t=>{let n=e[Symbol.iterator](),r=[],i;function a(){let e=n.next();for(;!e.done;){if(e.value._exit){r.push(e.value._exit),e=n.next();continue}i=e.value.addObserver(e=>{r.push(e),a()});return}t(Co(r))}return a(),Eo(()=>i?.())}),vo=e=>{let t=e;return t._exit?t._exit:Ho(n=>t._exit?n(t._exit):Eo(e.addObserver(n)))},yo=e=>Ho(t=>{let n=Array.from(e);if(n.length===0)return t(Co(pa()));let r=Array(n.length),i=pa(),a=0,o=!1;for(let e=0;e<n.length&&!o;e++)i.push(n[e].addObserver(s=>{if(a++,s._tag===`Failure`)return o=!0,i.forEach(e=>e()),t(s);r[e]=s.value,a===n.length&&t(Co(r))}));return Eo(()=>{o=!0,i.forEach(e=>e())})}),bo=e=>Vn(t=>xo(e,t.id)),xo=j(e=>nt(e[0],oo),(e,t,n)=>Vn(r=>{let i=mo(r);return i=i&&n?mi(i,n):i??n,e.interruptUnsafe(t,i),rs(go(e))})),So=e=>Vn(t=>{let n=mo(t),r=pa();for(let i of e)i.interruptUnsafe(t.id,n),r.push(i);return rs(_o(r))}),Co=Fn,wo=Rn,To=zn,Eo=Nn({op:`Sync`,[an](e){let t=this[rn](),n=e.getCont(on);return n?n[on](t,e):e.yieldWith(Fn(t))}}),Do=Nn({op:`Suspend`,[an](e){return this[rn]()}}),Oo=Vee({onFailure:To,onSuccess:Co}),ko=Nn({op:`Yield`,[an](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(bs)},this[rn]??0),e.yieldWith(()=>{t=!0})}})(0),Ao=e=>Co(Fr(e)),jo=Co(Pr()),Mo=e=>Do(()=>wo(Zt(e))),No=e=>Bn(e),Po=e=>Do(()=>To(Zt(e))),Fo=Co(void 0),Io=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new rl(e,`An error occurred in Effect.try`):e.catch;return Do(()=>{try{return Co(Zt(t))}catch(e){return To(Zt(()=>n(e)))}})},Lo=e=>Bo(function(t,n){Zt(()=>e(n)).then(e=>t(Co(e)),e=>t(No(e)))},e.length!==0),Ro=e=>{let t=typeof e==`function`?e:e.try,n=typeof e==`function`?e=>new rl(e,`An error occurred in Effect.tryPromise`):e.catch;return Bo(function(e,r){let i=t=>{try{e(To(Zt(()=>n(t))))}catch(t){e(No(t))}};try{Zt(()=>t(r)).then(t=>e(Co(t)),i)}catch(e){i(e)}},t.length!==0)},zo=e=>Vn(t=>e(t.id)),Bo=Nn({op:`Async`,single:!1,[an](e){let t=Zt(()=>this[rn][0].bind(e.currentScheduler)),n=!1,r=!1,i=this[rn][1]?new AbortController:void 0,a=t(t=>{n||(n=!0,r?e.evaluate(t):r=t)},i?.signal);return r===!1?(r=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(Vo(()=>(n=!0,i?.abort(),a??bs))),ln):r}}),Vo=Nn({op:`AsyncFinalizer`,[cn](e){e.interruptible&&(e.interruptible=!1,e._stack.push(Cc))},[sn](e,t){return Wa(e)?os(this[rn](),()=>wo(e)):wo(e)}}),Ho=e=>Bo(e,e.length>=2),Uo=Ho(Le),Wo=(...e)=>Do(()=>Qo(e.length===1?e[0]():e[1].call(e[0].self))),Go=(e,...t)=>{let n=t.length===0?function(){return Do(()=>Qo(e.apply(this,arguments)))}:function(){let n=Do(()=>Qo(e.apply(this,arguments)));for(let e=0;e<t.length;e++)n=t[e](n,...arguments);return n};return Ko(e.length,n)},Ko=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),qo=Ba(2),Jo=function(){let e=typeof arguments[0]==`string`,t=e?arguments[0]:`Effect.fn`,n=e?arguments[1]:void 0,r=Zn();Qn(2);let i=new globalThis.Error;return Qn(r),e?(r,...a)=>Yo(t,r,i,a,e,n):Yo(t,arguments[0],i,Array.prototype.slice.call(arguments,1),e,n)},Yo=(e,t,n,r,i,a)=>{let o=typeof t==`function`?t:r.pop().bind(t.self);return Ko(o.length,function(...t){let s=Do(()=>{let e=o.apply(this,arguments);return fn(e)?e:Qo(e)});for(let e=0;e<r.length;e++)s=r[e](s,...t);if(!fn(s))return s;let c=Zn();Qn(2);let l=new globalThis.Error;return Qn(c),Os(i?Kc(e,a,e=>qc(s,e)):s,Fa,t=>({name:e,stack:qo(()=>l.stack),parent:{name:`${e} (definition)`,stack:qo(()=>n.stack),parent:t}}))})},Xo=(e,...t)=>Ko(e.length,t.length===0?function(){return Zo(()=>e.apply(this,arguments))}:function(){let n=Zo(()=>e.apply(this,arguments));for(let e of t)n=e(n);return n}),Zo=e=>{try{let t=e(),n;for(;;){let r=t.next(n);if(r.done)return Co(r.value);let i=r.value;if(i&&i._tag===`Success`){n=i.value;continue}else if(i&&i._tag===`Failure`)return r.value;else{let n=!0;return Do(()=>n?(n=!1,os(r.value,e=>Qo(t,e))):Do(()=>Qo(e())))}}}catch(e){return No(e)}},Qo=Nn({op:`Iterator`,single:!1,[on](e,t){let n=this[rn][0];for(;;){let r=n.next(e);if(r.done)return Co(r.value);if(!cs(r.value))return t._stack.push(this),r.value;if(r.value._tag===`Failure`)return r.value;e=r.value.value}},[an](e){return this[on](this[rn][1],e)}}),$o=j(2,(e,t)=>{let n=Co(t);return os(e,e=>n)}),es=e=>ds(e,Fr),ts=j(2,(e,t)=>os(e,e=>fn(t)?t:Zt(()=>t(e)))),ns=j(2,(e,t)=>os(e,e=>$o(fn(t)?t:Zt(()=>t(e)),e))),rs=e=>os(e,e=>bs),is=(e,t)=>Vn(n=>Ho(r=>{let i=!1,a=new Set,o=e=>{i=!0,r(a.size===0?e:os(xc(So(a)),()=>e))},s=0;for(let r of e){if(i)break;let e=s++,c=jc(n,r,!0,!0,!1);a.add(c),c.addObserver(r=>{a.delete(c);let s=!i;o(r),s&&t?.onWinner&&t.onWinner({fiber:c,index:e,parentFiber:n})})}return So(a)})),as=j(e=>fn(e[1]),(e,t,n)=>is([e,t],n)),os=j(2,(e,t)=>{let n=Object.create(ss);return n[rn]=e,n[on]=t.length===1?t:e=>t(e),n}),ss=Mn({op:`OnSuccess`,[an](e){return e._stack.push(this),this[rn]}}),cs=e=>tn in e,ls=j(2,(e,t)=>cs(e)?e._tag===`Success`?t(e.value):e:os(e,t)),us=e=>os(e,je),ds=j(2,(e,t)=>os(e,e=>Co(Zt(()=>t(e))))),fs=j(2,(e,t)=>cs(e)?xs(e,t):ds(e,t)),ps=j(2,(e,t)=>cs(e)?Ss(e,t):Js(e,t)),ms=j(2,(e,t)=>cs(e)?Cs(e,t):Ys(e,t)),hs=j(2,(e,t)=>{if(cs(e)){if(e._tag===`Success`)return e;let n=Ua(e.cause);return Ki(n)?e:t(n.success)}return Bs(e,t)}),gs=e=>Rn(Ha(e)),_s=e=>e._tag===`Success`,vs=e=>e._tag===`Failure`,ys=e=>e._tag===`Failure`?Hi(e.cause):Ui(e),bs=Fn(void 0),xs=j(2,(e,t)=>e._tag===`Success`?Fn(t(e.value)):e),Ss=j(2,(e,t)=>{if(e._tag===`Success`)return e;let n=Ua(e.cause);return Ki(n)?e:zn(t(n.success))}),Cs=j(2,(e,t)=>{if(e._tag===`Success`)return Fn(t.onSuccess(e.value));let n=Ua(e.cause);return Ki(n)?e:zn(t.onFailure(n.success))}),ws=j(2,(e,t)=>_s(e)?t:e),Ts=e=>{let t=[];for(let n of e)n._tag===`Failure`&&t.push(...n.cause.reasons);return t.length===0?bs:Rn(Cn(t))},Es=e=>Vn(t=>Co(Eee(t.context,e))),Ds=j(2,(e,t)=>Vn(n=>{let r=n.context,i=t(r);return r===i?e:(n.setContext(i),yc(e,()=>{n.setContext(r)}))})),Os=j(3,(e,t,n)=>Ds(e,e=>{let r=ui(e,t),i=n(r);return r===i?e:li(e,t,i)})),ks=()=>As,As=Vn(e=>Co(e.context)),js=e=>Vn(t=>e(t.context)),Ms=j(2,(e,t)=>cs(e)?e:Ds(e,mi(t))),Ns=function(){return arguments.length===1?j(2,(e,t)=>Ps(e,arguments[0],t)):j(3,(e,t,n)=>Ps(e,t,n)).apply(this,arguments)},Ps=(e,t,n)=>Ds(e,e=>e.mapUnsafe.get(t.key)===n?e:li(e,t,n)),Fs=j(2,(e,t)=>os(t,t=>t?es(e):jo)),Is=j(e=>fn(e[0]),(e,t)=>Dc({while:Ne,body:Me(t?.disableYield?e:os(e,e=>ko)),step:Le})),Ls=j(2,(e,t)=>{let n=Object.create(Rs);return n[rn]=e,n[sn]=t.length===1?t:e=>t(e),n}),Rs=Mn({op:`OnFailure`,[an](e){return e._stack.push(this),this[rn]}}),zs=j(3,(e,t,n)=>Ls(e,e=>{let r=t(e);return Ki(r)?wo(r.failure):Zt(()=>n(r.success,e))})),Bs=j(2,(e,t)=>zs(e,Ua,e=>t(e))),Vs=j(2,(e,t)=>Ls(e,e=>ts(Zt(()=>t(e)),wo(e)))),Hs=j(3,(e,t,n)=>Ls(e,e=>{let r=t(e);return Ki(r)?wo(e):ts(Zt(()=>n(r.success,e)),wo(e))})),Us=j(2,(e,t)=>Hs(e,Ua,e=>t(e))),Ws=j(e=>fn(e[0]),(e,t,n,r)=>Ls(e,e=>{let i=Ua(e);return Ki(i)?wo(i.failure):t(i.success)?Zt(()=>n(i.success)):r?Zt(()=>r(i.success)):wo(e)})),Gs=j(e=>fn(e[0]),(e,t,n,r)=>Ls(e,e=>{let i=Ua(e);if(Ki(i))return wo(i.failure);let a=t(i.success);return Ki(a)?r?Zt(()=>r(a.failure)):wo(e):Zt(()=>n(a.success))})),Ks=j(e=>fn(e[0]),(e,t,n,r)=>Ws(e,Array.isArray(t)?e=>nt(e,`_tag`)&&t.includes(e._tag):rt(t),n,r)),qs=j(e=>fn(e[0]),(e,t,n)=>{let r;return Gs(e,e=>(r??=Object.keys(t),nt(e,`_tag`)&&Ue(e._tag)&&r.includes(e._tag)?Hi(e):Ui(e)),e=>Zt(()=>t[e._tag](e)),n)}),Js=j(2,(e,t)=>Bs(e,e=>Po(()=>t(e)))),Ys=j(2,(e,t)=>rc(e,{onFailure:e=>Po(()=>t.onFailure(e)),onSuccess:e=>Eo(()=>t.onSuccess(e))})),Xs=e=>Bs(e,No),Zs=j(2,(e,t)=>Bs(e,e=>Eo(t))),Qs=j(e=>fn(e[0]),(e,t)=>{if(!t?.log)return rc(e,{onFailure:e=>Fo,onSuccess:e=>Fo});let n=ol(t.log===!0?void 0:t.log);return tc(e,{onFailure(e){let r=lte(e);return Ki(r)?wo(r.failure):t.message===void 0?n(e):n(t.message,e)},onSuccess:e=>Fo})}),$s=e=>ic(e,{onFailure:Pr,onSuccess:Fr}),ec=e=>ac(e,{onFailure:Ui,onSuccess:Hi}),tc=j(2,(e,t)=>{let n=Object.create(nc);return n[rn]=e,n[on]=t.onSuccess.length===1?t.onSuccess:e=>t.onSuccess(e),n[sn]=t.onFailure.length===1?t.onFailure:e=>t.onFailure(e),n}),nc=Mn({op:`OnSuccessAndFailure`,[an](e){return e._stack.push(this),this[rn]}}),rc=j(2,(e,t)=>tc(e,{onFailure:e=>{let n=e.reasons.find(kn);return n?Zt(()=>t.onFailure(n.error)):wo(e)},onSuccess:t.onSuccess})),ic=j(2,(e,t)=>rc(e,{onFailure:e=>Eo(()=>t.onFailure(e)),onSuccess:e=>Eo(()=>t.onSuccess(e))})),ac=j(2,(e,t)=>{if(cs(e)){if(e._tag===`Success`)return Fn(t.onSuccess(e.value));let n=Ua(e.cause);return Ki(n)?e:Fn(t.onFailure(n.success))}return ic(e,t)}),oc=e=>cs(e)?Fn(e):hte(e),hte=Nn({op:`Exit`,[an](e){return e._stack.push(this),this[rn]},[on](e,t,n){return Co(n??Fn(e))},[sn](e,t,n){return Co(n??Rn(e))}}),gte=j(2,(e,t)=>ts(Qc(t),e)),sc=j(2,(e,t)=>as(e,os(Qc(t.duration),t.orElse))),_te=j(2,(e,t)=>sc(e,{duration:t,orElse:()=>To(new pne)})),vte=j(2,(e,t)=>as(es(e),$o(Qc(t),Pr()))),cc=`~effect/Scope`,lc=`~effect/Scope/Closeable`,uc=ti(`effect/Scope`),dc=(e,t)=>Do(()=>fc(e,t)??Fo),fc=(e,t)=>{if(e.state._tag===`Closed`)return;let n={_tag:`Closed`,exit:t};if(e.state._tag===`Empty`){e.state=n;return}let{finalizers:r}=e.state;if(e.state=n,r.size!==0)return r.size===1?r.values().next().value(t):yte(e,r,t)},yte=Go(function*(e,t,n){let r=[],i=[],a=Array.from(t.values()),o=lo();for(let t=a.length-1;t>=0;t--){let s=a[t];e.strategy===`sequential`?r.push(yield*oc(s(n))):i.push(jc(o,s(n),!0,!0,`inherit`))}return i.length>0&&(r=yield*_o(i)),yield*Ts(r)}),bte=(e,t)=>{let n=gc(t);if(e.state._tag===`Closed`)return n.state=e.state,n;let r={};return mc(e,r,e=>dc(n,e)),mc(n,r,t=>Eo(()=>hc(e,r))),n},pc=(e,t)=>Do(()=>e.state._tag===`Closed`?t(e.state.exit):(mc(e,{},t),Fo)),xte=(e,t)=>pc(e,Me(t)),mc=(e,t,n)=>{e.state._tag===`Empty`?e.state={_tag:`Open`,finalizers:new Map([[t,n]])}:e.state._tag===`Open`&&e.state.finalizers.set(t,n)},hc=(e,t)=>{e.state._tag===`Open`&&e.state.finalizers.delete(t)},gc=(e=`sequential`)=>({[lc]:lc,[cc]:cc,strategy:e,state:Ste}),Ste={_tag:`Empty`},Cte=e=>Eo(()=>gc(e)),_c=uc,wte=Ns(uc),Tte=e=>Vn(t=>{let n=t.context,r=gc();return t.setContext(li(t.context,uc,r)),yc(e,e=>(t.setContext(n),fc(r,e)))}),vc=e=>Do(()=>{let t=gc();return bc(e(t),e=>Do(()=>fc(t,e)??Fo))}),Ete=(e,t,n)=>js(r=>Tc(i=>os(_c,a=>ns(n?.interruptible?i(e):e,e=>pc(a,n=>Ms(t(e,n),r)))))),Dte=e=>os(_c,t=>js(n=>pc(t,t=>Ms(e(t),n)))),yc=Nn({op:`OnExit`,single:!1,[an](e){return e._stack.push(this),this[rn][0]},[cn](e){e.interruptible&&this[rn][2]!==!0&&(e._stack.push(Cc),e.interruptible=!1)},[on](e,t,n){n??=Fn(e);let r=this[rn][1](n);return r?os(r,e=>n):n},[sn](e,t,n){n??=Rn(e);let r=this[rn][1](n);return r?os(r,e=>n):n}}),bc=j(2,yc),Ote=j(2,(e,t)=>bc(e,e=>t)),kte=j(3,(e,t,n)=>bc(e,e=>{let r=t(e);return Ki(r)?Fo:n(r.success,e)})),Ate=j(2,(e,t)=>kte(e,ys,t)),jte=j(3,(e,t,n)=>bc(e,e=>{if(e._tag!==`Failure`)return Fo;let r=t(e.cause);return Ki(r)?Fo:n(r.success,e.cause)})),Mte=j(2,(e,t)=>jte(Ga,t)(e)),Nte=(e,t,n)=>Tc(r=>os(e,e=>yc(r(t(e)),t=>n(e,t),!0))),Pte=j(2,(e,t)=>Eo(()=>{let n=Mi(xi(t)),r=Number.isFinite(n),i=Vc(!1),a=0,o=!1,s,c=os(i.await,()=>s);return[Vn(t=>{let l=t.getRef(Yc),u=r?l.currentTimeMillisUnsafe():0;return o||u<a?s??c:(o=!0,i.closeUnsafe(),s=void 0,bc(e,e=>Eo(()=>{o=!1,a=l.currentTimeMillisUnsafe()+n,s=e,i.openUnsafe()})))}),Eo(()=>{a=0,i.closeUnsafe(),s=void 0})]})),Fte=j(2,(e,t)=>ds(Pte(e,t),e=>e[0])),Ite=e=>Fte(e,Di),Lte=Vn(e=>wo(Ha(e.id))),xc=e=>Vn(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Cc),e):e),Sc=Nn({op:`SetInterruptible`,[cn](e){if(e.interruptible=this[rn],e._interruptedCause&&e.interruptible)return()=>wo(e._interruptedCause)}}),Cc=Sc(!0),Rte=Sc(!1),zte=e=>{if(e.interruptible=!0,e._stack.push(Rte),e._interruptedCause)return wo(e._interruptedCause)},wc=e=>Vn(t=>t.interruptible?e:zte(t)??e),Tc=e=>Vn(t=>t.interruptible?(t.interruptible=!1,t._stack.push(Cc),e(wc)):e(je)),Ec=(e,t)=>it(e)?t?.mode===`result`?Oc(e,ec,t):Oc(e,je,t):t?.discard?t.mode===`result`?Oc(Object.values(e),ec,t):Oc(Object.values(e),je,t):Do(()=>{let n={};return $o(Oc(Object.entries(e),([e,r])=>ds(t?.mode===`result`?ec(r):r,t=>{Qt(n,e,t)}),{discard:!0,concurrency:t?.concurrency}),n)}),Dc=Nn({op:`While`,[on](e,t){return this[rn].step(e),this[rn].while()?(t._stack.push(this),this[rn].body()):bs},[an](e){return this[rn].while()?(e._stack.push(this),this[rn].body()):bs}}),Oc=j(e=>typeof e[1]==`function`,(e,t,n)=>Do(()=>{let r=n?.concurrency??1,i=r===`unbounded`?1/0:Math.max(1,r);if(i===1)return Bte(e,t,n);let a=Qi(e),o=a.length;if(o===0)return n?.discard?Fo:Co([]);let s=n?.discard?void 0:Array(o),c=Vte({f:t,out:s},a,{concurrency:i});return c?$o(c,s):Co(s)})),Bte=(e,t,n)=>Do(()=>{let r=n?.discard?void 0:[],i=e[Symbol.iterator](),a=i.next(),o=0;return $o(Dc({while:()=>!a.done,body:()=>t(a.value,o++),step:e=>{r&&r.push(e),a=i.next()}}),r)}),kc=e=>{let t=e.onItem,n=e.step;return(e,r,i)=>{let a=i?.start??0,o=i?.end??r.length,s=i?.concurrency??1,c=i?.orderedStep===!0&&s>1,l=!1,u,d,f,p=!1,m,h,g=a,_=c?Array(o):void 0,v=e=>{let t=Bn(e);return m=t,l=!0,p=!0,d&&d.size>0?os(xc(So(Array.from(d))),()=>t):t},y=(t,i,a)=>{if(!c)return n(e,t,i,a);if(m)return m;for(_[a]=i;g<o;){let t=_[g];if(t===void 0)return;_[g]=void 0;let i=g++,a=n(e,r[i],t,i);if(a)return a}},b=()=>{let n=!1;for(;!m&&a<o;a++){let i=r[a],o=h??t(e,i,a);if(cs(o)){if(m=y(i,o,a),m)break}else if(s===1)return os(oc(o),e=>(m=y(i,e,a),a++,m??b()??Fo));else if(u){h=void 0;let e=jc(u,o,!0,!0,`inherit`);if(e._exit){if(m=y(i,e._exit,a),m)break;continue}d.add(e);let t=a;if(e.addObserver(r=>{d.delete(e);try{if(m){if(!p&&r._tag===`Failure`)for(let e of r.cause.reasons)if(e._tag===`Interrupt`)continue;else m._tag===`Failure`?m.cause.reasons.push(e):m=Rn(Cn([e]))}else{let e=y(i,r,t);e&&(m=e._tag===`Failure`?Rn(Cn(e.cause.reasons.slice())):e,b())}if(n){let e=b();e&&f(e)}else l&&d.size===0&&f(m??Fo)}catch(e){f(v(e))}}),d.size<s)continue;n=!0,a++;return}else return Ho(e=>{u=lo(),d=new Set,h=o,f=e;let t;try{t=b()}catch(t){return e(v(t))}return t?e(t):Do(()=>(m=bs,p=!0,d?So(d):Fo))})}if(l=!0,m){if(d&&d.size>0){let e=mo(u);d.forEach(t=>t.interruptUnsafe(u.id,e));return}if(f||m._tag===`Failure`)return m}else if(f)if(d)d.size===0&&f(Fo);else return bs};return b()}},Ac=()=>kc,Vte=kc({onItem(e,t,n){return e.f(t,n)},step(e,t,n,r){if(n._tag===`Failure`)return n;e.out&&(e.out[r]=n.value)}}),Hte=j(e=>fn(e[0]),(e,t)=>Vn(n=>(Tne(),Co(jc(n,e,t?.startImmediately,!1,t?.uninterruptible??!1))))),jc=(e,t,n=!1,r=!1,i=!1)=>{let a=i===`inherit`?e.interruptible:!i,o=new uo(e.context,a);return n?o.evaluate(t):e.currentDispatcher.scheduleTask(()=>o.evaluate(t),0),!r&&!o._exit&&(e.children().add(o),o.addObserver(()=>e._children.delete(o))),o},Ute=j(e=>fn(e[0]),(e,t)=>Vn(n=>Co(jc(n,e,t?.startImmediately,!0,t?.uninterruptible)))),Mc=j(e=>fn(e[0]),(e,t,n)=>Vn(r=>{let i=jc(r,e,n?.startImmediately,!0,n?.uninterruptible);if(!i._exit)if(t.state._tag!==`Closed`){let e={};mc(t,e,()=>zo(e=>e===i.id?Fo:bo(i))),i.addObserver(()=>hc(t,e))}else i.interruptUnsafe(r.id,mo(r));return Co(i)})),Wte=j(e=>fn(e[0]),(e,t)=>os(_c,n=>Mc(e,n,t))),Nc=e=>(t,n)=>{let r=new uo(n?.scheduler?li(e,wa,n.scheduler):e,n?.uninterruptible!==!0);if(r.evaluate(t),r._exit)return r;if(n?.signal)if(n.signal.aborted)r.interruptUnsafe();else{let e=()=>r.interruptUnsafe();n.signal.addEventListener(`abort`,e,{once:!0}),r.addObserver(()=>n.signal.removeEventListener(`abort`,e))}return n?.onFiberStart&&n.onFiberStart(r),r},Gte=j(2,(e,t)=>{if(e._exit)return e;if(t.state._tag===`Closed`)return e.interruptUnsafe(e.id),e;let n={};return mc(t,n,()=>bo(e)),e.addObserver(()=>hc(t,n)),e}),Kte=Nc(si()),Pc=e=>{let t=Nc(e);return(e,n)=>{let r=t(e,n);return n?.onExit&&r.addObserver(n.onExit),e=>r.interruptUnsafe(e)}},qte=Pc(si()),Fc=e=>{let t=Nc(e);return(e,n)=>{let r=t(e,n);return new Promise(e=>{r.addObserver(t=>e(t))})}},Jte=Fc(si()),Ic=e=>{let t=Fc(e);return(e,n)=>t(e,n).then(e=>{if(e._tag===`Failure`)throw Ja(e.cause);return e.value})},Yte=Ic(si()),Lc=e=>{let t=Nc(e);return e=>{if(cs(e))return e;let n=new Ea(`sync`),r=t(e,{scheduler:n});return r._dispatcher?.flush(),r._exit??Bn(new hne(r))}},Xte=Lc(si()),Rc=e=>{let t=Lc(e);return e=>{let n=t(e);if(n._tag===`Failure`)throw Ja(n.cause);return n.value}},Zte=Rc(si()),zc=Co(!0),Bc=Co(!1),Qte=class{waiters=[];scheduled=void 0;_isOpen;constructor(e){this._isOpen=e}scheduleUnsafe(e){if(this.waiters.length===0)return zc;if(this.scheduled===void 0)this.scheduled=this.waiters,e.currentDispatcher.scheduleTask(this.flushScheduled,0);else for(let e=0;e<this.waiters.length;e++)this.scheduled.push(this.waiters[e]);return this.waiters=[],zc}flushScheduled=()=>{if(this.scheduled===void 0)return;let e=this.scheduled;this.scheduled=void 0;for(let t=0;t<e.length;t++)e[t](bs)};flushWaiters(){let e=this.waiters;this.waiters=[],this.flushScheduled();for(let t=0;t<e.length;t++)e[t](bs)}open=Vn(e=>this._isOpen?Bc:(this._isOpen=!0,this.scheduleUnsafe(e)));release=Vn(e=>this._isOpen?Bc:this.scheduleUnsafe(e));openUnsafe(){return this._isOpen?!1:(this._isOpen=!0,this.flushWaiters(),!0)}await=Ho(e=>this._isOpen?e(Fo):(this.waiters.push(e),Eo(()=>{let t=this.waiters.indexOf(e);t===-1?this.scheduled!==void 0&&(t=this.scheduled.indexOf(e),t!==-1&&this.scheduled.splice(t,1)):this.waiters.splice(t,1)})));closeUnsafe(){return this._isOpen?(this._isOpen=!1,!0):!1}close=Eo(()=>this.closeUnsafe());whenOpen=e=>os(this.await,()=>e);isOpen(){return this._isOpen}},Vc=e=>new Qte(e??!1),$te=e=>Eo(()=>Vc(e)),ene=Ns(Ia),Hc=BigInt(0),tne={_tag:`Span`,spanId:`noop`,traceId:`noop`,sampled:!1,status:{_tag:`Ended`,startTime:Hc,endTime:Hc,exit:bs},attributes:new Map,links:[],kind:`internal`,attribute(){},event(){},end(){},addLinks(){}},nne=e=>Object.assign(Object.create(tne),e),Uc=e=>e?di(e.annotations,Aa)?e._tag===`Span`?Uc(Gr(e.parent)):Pr():Fr(e):Pr(),Wc=(e,t,n)=>{let r=!e.getRef(Ia)||n?.annotations&&di(n.annotations,Aa),i=n?.parent===void 0?n?.root?Pr():Uc(e.currentSpan):Fr(n.parent),a;if(r)a=nne({name:t,parent:i,annotations:li(n?.annotations??si(),Aa,!0)});else{let r=e.getRef(Ma),o=e.getRef(Yc),s=e.getRef(La),c=e.getRef(nte),l=e.getRef(rte),u=n?.level??e.getRef($ee),d=n?.links===void 0?l.slice():[...l,...n.links];a=r.span({name:t,parent:i,annotations:n?.annotations??si(),links:d,startTime:s?o.currentTimeNanosUnsafe():BigInt(0),kind:n?.kind??`internal`,root:n?.root??Lr(i),sampled:n?.sampled??(Rr(i)&&i.value.sampled===!1?!1:!il(e.getRef(ete),u))});for(let[e,t]of Object.entries(c))a.attribute(e,t);if(n?.attributes!==void 0)for(let[e,t]of Object.entries(n.attributes))a.attribute(e,t)}return a},rne=(e,t)=>Vn(n=>Co(Wc(n,e,t))),ine=(e,t)=>xc(Vn(n=>{let r=ui(n.context,uc),i=Wc(n,e,t??{}),a=n.getRef(Yc),o=n.getRef(La);return $o(pc(r,e=>Gc(i,e,a,o)),i)})),ane=(e,t)=>(t=typeof t==`function`?t:Ie,Os(Fa,n=>({name:e,stack:t,parent:n}))),Gc=(e,t,n,r)=>Eo(()=>{e.status._tag!==`Ended`&&e.end(r?n.currentTimeNanosUnsafe():Hc,t)}),Kc=(e,...t)=>{let n=t.length===1?void 0:t[0],r=t[t.length-1];return Vn(t=>{let i=Wc(t,e,n),a=t.getRef(Yc);return bc(Zt(()=>r(i)),e=>Eo(()=>{i.status._tag!==`Ended`&&i.end(a.currentTimeNanosUnsafe(),e)}))})},qc=Ns(Oa),Jc=function(){let e=fn(arguments[0]),t=e?arguments[1]:arguments[0],n=e?arguments[2]:arguments[1],r=je;return t._tag===`Span`&&(n=za(n),r=ane(t.name,n?.captureStackTrace)),e?qc(r(arguments[0]),t):e=>qc(r(e),t)},one=function(){let e=typeof arguments[0]!=`string`,t=e?arguments[1]:arguments[0],n=za(arguments[2]);if(e){let e=arguments[0];return Kc(t,arguments[2],t=>Jc(e,t,n))}let r=typeof arguments[1]==`function`?arguments[1]:void 0,i=r?void 0:arguments[1];return(e,...a)=>Kc(t,r?r(...a):i,t=>Jc(e,t,n))},sne=(...e)=>Vn(t=>{let n=t.currentSpanLocal;if(n)if(e.length===1)for(let[t,r]of Object.entries(e[0]))n.attribute(t,r);else n.attribute(e[0],e[1]);return Fo}),Yc=gi(`effect/Clock`,{defaultValue:()=>new cne}),Xc=2**31-1,cne=class{currentTimeMillisUnsafe(){return Date.now()}currentTimeMillis=Eo(()=>this.currentTimeMillisUnsafe());currentTimeNanosUnsafe(){return une()}currentTimeNanos=Eo(()=>this.currentTimeNanosUnsafe());sleep(e){return this.sleepMillis(Mi(e))}sleepMillis(e){return e<=0?ko:Number.isFinite(e)?Ho(t=>{let n=e>Xc?this.sleepMillis(e-Xc):Fo,r=setTimeout(()=>t(n),Math.min(e,Xc));return Eo(()=>clearTimeout(r))}):Uo}},lne=function(){let e=BigInt(1e6);if(typeof performance>`u`||performance.now===void 0)return()=>BigInt(Date.now())*e;let t;return()=>(t??=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6)),t+BigInt(Math.round(performance.now()*1e6)))}(),une=function(){let e=typeof process==`object`&&`hrtime`in process&&typeof process.hrtime.bigint==`function`?process.hrtime:void 0;if(!e)return lne;let t=BigInt(Date.now())*BigInt(1e6)-e.bigint();return()=>t+e.bigint()}(),Zc=e=>Vn(t=>e(t.getRef(Yc))),Qc=e=>Zc(t=>t.sleep(xi(e))),dne=Zc(e=>e.currentTimeMillis),$c=`~effect/Cause/TimeoutError`,fne=e=>nt(e,$c),pne=class extends Un(`TimeoutError`){[$c]=$c;constructor(e){super({message:e})}},el=`~effect/Cause/IllegalArgumentError`,mne=class extends Un(`IllegalArgumentError`){[el]=el;constructor(e){super({message:e})}};Un(`ExceededCapacityError`);var tl=`~effect/Cause/AsyncFiberError`,hne=class extends Un(`AsyncFiberError`){[tl]=tl;constructor(e){super({message:`An asynchronous Effect was executed with Effect.runSync`,fiber:e})}},nl=`~effect/Cause/UnknownError`,rl=class extends Un(`UnknownError`){[nl]=nl;constructor(e,t){super({message:t,cause:e})}},gne=gi(`effect/Console/CurrentConsole`,{defaultValue:()=>globalThis.console}),il=kr(Er(xr,e=>{switch(e){case`All`:return-(2**53-1);case`Fatal`:return 5e4;case`Error`:return 4e4;case`Warn`:return 3e4;case`Info`:return 2e4;case`Debug`:return 1e4;case`Trace`:return 0;case`None`:return 2**53-1}})),_ne=gi(`effect/Loggers/CurrentLoggers`,{defaultValue:()=>new Set([Cne,wne])}),vne=gi(`effect/Logger/LogToStderr`,{defaultValue:Pe}),yne={"~effect/Logger":{_Message:je,_Output:je},pipe(){return Oe(this,arguments)}},al=e=>{let t=Object.create(yne);return t.log=e,t},bne=e=>e.replace(/[\s="]/g,`_`),xne=(e,t)=>`${bne(e[0])}=${t-e[1]}ms`,ol=e=>(...t)=>{let n;for(let e=0,r=t.length;e<r;e++){let r=t[e];gn(r)&&(n?t.splice(e,1):t=t.slice(0,e).concat(t.slice(e+1)),n=n?Cn(n.reasons.concat(r.reasons)):r,e--)}return n===void 0&&(n=wn),Vn(r=>{let i=e??r.currentLogLevel;if(il(r.minimumLogLevel,i))return Fo;let a=r.getRef(Yc),o=r.getRef(_ne);if(o.size>0){let e=new Date(a.currentTimeMillisUnsafe());for(let a of o)a.log({cause:n,fiber:r,date:e,logLevel:i,message:t})}return Fo})},sl={bold:`1`,red:`31`,green:`32`,yellow:`33`,blue:`34`,cyan:`36`,white:`37`,gray:`90`,black:`30`,bgBrightRed:`101`};sl.gray,sl.blue,sl.green,sl.yellow,sl.red,sl.bgBrightRed,sl.black;var Sne=e=>`${e.getHours().toString().padStart(2,`0`)}:${e.getMinutes().toString().padStart(2,`0`)}:${e.getSeconds().toString().padStart(2,`0`)}.${e.getMilliseconds().toString().padStart(3,`0`)}`,Cne=al(({cause:e,date:t,fiber:n,logLevel:r,message:i})=>{let a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(ro(e));let o=t.getTime(),s=n.getRef(ote),c=``;for(let e of s)c+=` ${xne(e,o)}`;let l=n.getRef(Ra);Object.keys(l).length>0&&a.push(l);let u=n.getRef(gne);(n.getRef(vne)?u.error:u.log)(`[${Sne(t)}] ${r.toUpperCase()} (#${n.id})${c}:`,...a)}),wne=al(({cause:e,fiber:t,logLevel:n,message:r})=>{let i=t.getRef(Yc),a=t.getRef(Ra),o=t.currentSpan;if(o===void 0||o._tag===`ExternalSpan`)return;let s={};for(let[e,t]of Object.entries(a))Qt(s,e,t);s[`effect.fiberId`]=t.id,s[`effect.logLevel`]=n.toUpperCase(),e.reasons.length>0&&(s[`effect.cause`]=ro(e)),o.event(cee(Array.isArray(r)&&r.length===1?r[0]:r),i.currentTimeNanosUnsafe(),s)});function Tne(){po.interruptChildren??=ho}var Ene=Co(void 0),cl=pn,ll=Fn,ul=Rn,dl=zn,Dne=Bn,One=gs,fl=bs,pl=_s,ml=vs,kne={"~effect/Deferred":{_A:je,_E:je},pipe(){return Oe(this,arguments)}},hl=()=>{let e=Object.create(kne);return e.resumes=void 0,e.effect=void 0,e},gl=()=>Eo(()=>hl()),_l=e=>Ho(t=>e.effect?t(e.effect):(e.resumes??=[],e.resumes.push(t),Eo(()=>{let n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),vl=j(2,(e,t)=>Eo(()=>Tl(e,t))),yl=j(2,(e,t)=>vl(e,zn(t))),bl=j(2,(e,t)=>vl(e,Rn(t))),xl=j(2,(e,t)=>bl(e,Ha(t))),Sl=e=>Eo(()=>Cl(e)),Cl=e=>e.effect!==void 0,wl=j(2,(e,t)=>vl(e,Fn(t))),Tl=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},El=j(2,(e,t)=>Tc(n=>os(oc(n(e)),e=>vl(t,e)))),Dl=Ra,Ane=La,Ol=uc,kl=Cte,Al=gc,jl=wte,Ml=pc,Nl=xte,Pl=bte,Fl=dc,jne=`~effect/Layer`,Il=`~effect/Layer/MemoMap`,Mne=(e,t)=>(e.observers++,ts(pc(t,t=>e.finalizer(t)),e.effect)),Nne={[jne]:{_ROut:je,_E:je,_RIn:je},pipe(){return Oe(this,arguments)}},Ll=e=>{let t=Object.create(Nne);return t.build=e,t},Rl=e=>Ll((t,n)=>{let r=Pl(n);return bc(e(t,r),e=>e._tag===`Failure`?Fl(r,e):Fo)}),zl=e=>{let t=Rl((n,r)=>n.getOrElseMemoize(t,r,e));return t},Bl=(e,t,n,r)=>{let i=Al(),a=hl(),o={observers:1,effect:_l(a),finalizer:n=>Do(()=>(o.observers--,o.observers===0?(e.map.delete(t),Fl(i,n)):Fo))};return e.map.set(t,o),pc(n,o.finalizer).pipe(os(()=>r(e,i)),bc(e=>(o.effect=e,vl(a,e))))},Vl=class{get[Il](){return Il}parent;constructor(e){this.parent=e}map=new Map;get(e,t){let n=this.map.get(e);return n?Mne(n,t):this.parent?.get(e,t)}getOrElseMemoize(e,t,n){return this.get(e,t)||Bl(this,e,t,n)}},Hl=()=>new Vl,Ul=e=>new Vl(e),Wl=class e extends ti()(`effect/Layer/CurrentMemoMap`){static forkOrCreate(t){let n=Cee(t,e);return n?Ul(n):Hl()}},Gl=j(3,(e,t,n)=>Ns(ds(e.build(t,n),li(Wl,t)),Wl,t)),Kl=e=>Vn(t=>Gl(e,Wl.forkOrCreate(t.context),ui(t.context,Ol))),ql=j(2,(e,t)=>Vn(n=>Gl(e,Wl.forkOrCreate(n.context),t))),Jl=function(){return arguments.length===1?e=>Yl(ci(arguments[0],e)):Yl(ci(arguments[0],arguments[1]))},Yl=e=>Ll(Me(Co(e))),Xl=function(){return arguments.length===1?e=>Zl(()=>ci(arguments[0],e())):Zl(()=>ci(arguments[0],arguments[1]()))},Zl=e=>zl(Me(Eo(e))),Ql=function(){return arguments.length===1?e=>$l(arguments[0],e):$l(arguments[0],arguments[1])},$l=(e,t)=>eu(ds(t,t=>ci(e,t))),eu=e=>zl((t,n)=>jl(e,n)),tu=e=>eu($o(e,si())),nu=e=>{let t=ti(`effect/Layer/unwrap`);return lu(Ql(t)(e),di(t))},ru=(e,t,n)=>{let r=Pl(n,`parallel`);return Oc(e,e=>e.build(t,Pl(r,`sequential`)),{concurrency:e.length}).pipe(ds(e=>Dee(...e)))},iu=(...e)=>Rl((t,n)=>ru(e,t,n)),au=j(2,(e,t)=>iu(e,...Array.isArray(t)?t:[t])),ou=(e,t,n)=>Rl((r,i)=>os(Array.isArray(t)?ru(t,r,i):t.build(r,i),t=>e.build(r,i).pipe(Ms(t),ds(e=>n(e,t))))),su=j(2,(e,t)=>ou(e,t,je)),cu=j(2,(e,t)=>ou(e,t,(e,t)=>mi(t,e))),lu=j(2,(e,t)=>Rl((n,r)=>os(e.build(n,r),e=>t(e).build(n,r)))),uu=gn,du=_n,fu=kn,pu=An,mu=Cn,Pne=wn,hu=Tn,gu=Dn,Fne=Ha,_u=e=>new Sn(e),vu=e=>new En(e),yu=cte,bu=pte,xu=mte,Ine=Ka,Su=Ja,Cu=Ua,Lne=ute,wu=Wa,Rne=dte,zne=Ga,Bne=Ya,Tu=ro,Eu=pee,Du=Kn,Ou=mee,Vne=fne,Hne=mne;ti()(`effect/Cause/StackTrace`),ti()(`effect/Cause/InterruptorStackTrace`);var ku=class extends Ae{constructor(e){super(),e&&$t(this,e)}},Une=e=>class extends ku{_tag=e},Au=Un,ju=Yc,Mu=dne,Nu=`~effect/time/DateTime`,Pu=`~effect/time/DateTime/TimeZone`,Fu={[Nu]:Nu,pipe(){return Oe(this,arguments)},[qt](){return this.toString()},toJSON(){return $u(this).toJSON()}},Iu={...Fu,_tag:`Utc`,[ot](){return ft(this.epochMilliseconds)},[Ct](e){return Bu(e)&&e._tag===`Utc`&&this.epochMilliseconds===e.epochMilliseconds},toString(){return`DateTime.Utc(${$u(this).toJSON()})`}},Lu={...Fu,_tag:`Zoned`,[ot](){return lt(ft(this.epochMilliseconds))(st(this.zone))},[Ct](e){return Bu(e)&&e._tag===`Zoned`&&this.epochMilliseconds===e.epochMilliseconds&&wt(this.zone,e.zone)},toString(){return`DateTime.Zoned(${gd(this)})`}},Ru={[Pu]:Pu,[qt](){return this.toString()}};({...Ru}),{...Ru};var zu=(e,t,n)=>{let r=Object.create(Lu);return r.epochMilliseconds=e,r.zone=t,Object.defineProperty(r,"partsUtc",{value:n,enumerable:!1,writable:!0}),Object.defineProperty(r,"adjustedEpochMillis",{value:void 0,enumerable:!1,writable:!0}),Object.defineProperty(r,"partsAdjusted",{value:void 0,enumerable:!1,writable:!0}),r},Bu=e=>nt(e,Nu),Vu=e=>Bu(e[0]),Hu=e=>e._tag===`Utc`,Uu=$n((e,t)=>e.epochMilliseconds===t.epochMilliseconds),Wu=yr((e,t)=>e.epochMilliseconds<t.epochMilliseconds?-1:+(e.epochMilliseconds>t.epochMilliseconds)),Gu=e=>{let t=Object.create(Iu);return t.epochMilliseconds=e,Object.defineProperty(t,"partsUtc",{value:void 0,enumerable:!1,writable:!0}),t},Ku=e=>{let t=e.getTime();if(Number.isNaN(t))throw new Hne(`Invalid date`);return Gu(t)},qu=e=>{if(Bu(e))return e;if(e instanceof Date)return Ku(e);if(typeof e==`object`){if(`epochMilliseconds`in e)return Gu(e.epochMilliseconds);let t=new Date(0);return ad(t,e),Ku(t)}else if(typeof e==`string`&&!Ju(e))return Ku(new Date(e+`Z`));return Ku(new Date(e))},Ju=e=>/Z|GMT|[+-]\d{2}$|[+-]\d{2}:?\d{2}$|\]$/.test(e),Yu=Kr(qu),Xu=ds(Mu,Gu),Zu=()=>Gu(Date.now()),Qu=e=>Gu(e.epochMilliseconds),$u=e=>new Date(e.epochMilliseconds),ed=e=>{if(e._tag===`Utc`)return new Date(e.epochMilliseconds);if(e.zone._tag===`Offset`)return new Date(e.epochMilliseconds+e.zone.offset);if(e.adjustedEpochMilliseconds!==void 0)return new Date(e.adjustedEpochMilliseconds);let t=e.zone.format.formatToParts(e.epochMilliseconds).filter(e=>e.type!==`literal`),n=new Date(0);return n.setUTCFullYear(Number(t[2].value),Number(t[0].value)-1,Number(t[1].value)),n.setUTCHours(Number(t[3].value),Number(t[4].value),Number(t[5].value),Number(t[6].value)),e.adjustedEpochMilliseconds=n.getTime(),n},td=e=>ed(e).getTime()-id(e),nd=e=>{let t=Math.abs(e),n=Math.floor(t/(3600*1e3)),r=Math.round(t%(3600*1e3)/(60*1e3));return r===60&&(n+=1,r=0),`${e<0?`-`:`+`}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`},rd=e=>nd(td(e)),id=e=>e.epochMilliseconds,ad=(e,t)=>{if(t.year!==void 0&&e.setUTCFullYear(t.year),t.month!==void 0&&e.setUTCMonth(t.month-1),t.day!==void 0&&e.setUTCDate(t.day),t.weekDay!==void 0){let n=t.weekDay-e.getUTCDay();e.setUTCDate(e.getUTCDate()+n)}t.hour!==void 0&&e.setUTCHours(t.hour),t.minute!==void 0&&e.setUTCMinutes(t.minute),t.second!==void 0&&e.setUTCSeconds(t.second),t.millisecond!==void 0&&e.setUTCMilliseconds(t.millisecond)},od=1440*60*1e3,sd=(e,t,n)=>{if(t._tag===`Offset`)return zu(e-t.offset,t);let r=ud(e-od,e,t),i=ud(e+od,e,t);if(r===i)return zu(e-r,t);let a=r<i,o=r-i;if(a){if(ud(e-i,e,t)===i)return zu(e-i,t);let a=zu(e-r,t);if(e!==ed(a).getTime())switch(n){case`reject`:{let n=new Date(e).toISOString();throw RangeError(`Gap time: ${n} does not exist in time zone ${t.id}`)}case`earlier`:return zu(e-i,t);case`compatible`:case`later`:return a}return a}if(ud(e-r,e,t)===r){if(n===`earlier`||n===`compatible`||ud(e-r+o,e+o,t)===r)return zu(e-r,t);if(n===`reject`){let n=new Date(e).toISOString();throw RangeError(`Ambiguous time: ${n} occurs twice in time zone ${t.id}`)}}return zu(e-i,t)},cd=/([+-])(\d{2}):(\d{2})$/,ld=e=>{let t=cd.exec(e);if(t===null)return null;let[,n,r,i]=t;return(n===`+`?1:-1)*(Number(r)*60+Number(i))*60*1e3},ud=(e,t,n)=>{let r=n.format.formatToParts(e).find(e=>e.type===`timeZoneName`)?.value??``;if(r===`GMT`)return 0;let i=ld(r);return i===null?td(zu(t,n)):i},dd=j(Vu,(e,t,n)=>{if(e._tag===`Utc`){let n=$u(e);return t(n),Gu(n.getTime())}let r=ed(e),i=new Date(r.getTime());return t(i),sd(i.getTime(),e.zone,n?.disambiguation??`compatible`)}),fd=(e,t)=>{e.setTime(e.getTime()+t)},pd=j(2,(e,t)=>dd(e,e=>{if(t.milliseconds&&fd(e,t.milliseconds),t.seconds&&fd(e,t.seconds*1e3),t.minutes&&fd(e,t.minutes*60*1e3),t.hours&&fd(e,t.hours*60*60*1e3),t.days&&e.setUTCDate(e.getUTCDate()+t.days),t.weeks&&e.setUTCDate(e.getUTCDate()+t.weeks*7),t.months){let n=e.getUTCDate();e.setUTCMonth(e.getUTCMonth()+t.months+1,0),n<e.getUTCDate()&&e.setUTCDate(n)}if(t.years){let n=e.getUTCDate(),r=e.getUTCMonth();e.setUTCFullYear(e.getUTCFullYear()+t.years,r+1,0),n<e.getUTCDate()&&e.setUTCDate(n)}})),md=e=>$u(e).toISOString(),hd=e=>{let t=ed(e);return e._tag===`Utc`?t.toISOString():`${t.toISOString().slice(0,-1)}${rd(e)}`},gd=e=>e.zone._tag===`Offset`?hd(e):`${hd(e)}[${e.zone.id}]`,_d=globalThis.Number,vd=e=>{if(e===`NaN`)return Fr(NaN);if(e===`Infinity`)return Fr(1/0);if(e===`-Infinity`)return Fr(-1/0);if(e.trim()===``)return Pr();let t=_d(e);return _d.isNaN(t)?Pr():Fr(t)};globalThis.String;var yd=e=>e.trim(),bd=j(2,(e,t)=>zs(e,wd,e=>t(e))),xd=e=>e.reasons.some(Sd),Sd=e=>e._tag===`Fail`&&Du(e.error),Cd=Ca(Cu,e=>Du(e)?Hi(e):Ui(e)),wd=Ca(Cu,e=>Du(e)?Hi(e.value):Ui(e)),Td=e=>{let t=Cd(e);return Ki(t)?ul(t.failure):ll(t.success.value)},Ed=j(2,(e,t)=>tc(e,{onSuccess:t.onSuccess,onFailure:e=>{let n=Cd(e);return Ki(n)?t.onFailure(n.failure):t.onDone(n.success.value)}})),Dd=`~effect/Schedule`,Od=gi(`effect/Schedule/CurrentMetadata`,{defaultValue:Me({input:void 0,output:void 0,duration:Ei,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),kd={[Dd]:{_Out:je,_In:je,_Env:je},pipe(){return Oe(this,arguments)}},Ad=e=>nt(e,Dd),jd=e=>{let t=Object.create(kd);return t.step=e,t},Md=()=>{let e=0,t,n;return(r,i)=>{n===void 0&&(n=r);let a=r-n,o=t===void 0?0:r-t;return t=r,{input:i,attempt:++e,start:n,now:r,elapsed:a,elapsedSincePrevious:o}}},Nd=e=>jd(ds(e,e=>{let t=Md();return(n,r)=>e(t(n,r))})),Pd=e=>Ls(e.step,e=>Co(()=>wo(e))),Fd=e=>Zc(t=>ds(Pd(e),e=>{let n=Md();return r=>Do(()=>{let i=t.currentTimeMillisUnsafe();return os(e(i,r),([e,t])=>{let a=n(i,r);return a.output=e,a.duration=t,$o(Qc(t),a)})})})),Id=j(2,(e,t)=>Bd(e,e=>ds(t(e),t=>zi(xi(t),e.duration)))),Ld=e=>jd(ds(Ec(e.map(Pd)),e=>(t,n)=>os(Oc(e,e=>Ed(e(t,n),{onSuccess:e=>Co(e[1]),onDone:()=>Ene,onFailure:wo})),e=>{let t=Rd(e);return t===void 0?Ou(Ei):Co([t,t])}))),Rd=e=>{let t;for(let n=0;n<e.length;n++){let r=e[n];r!==void 0&&(t=t===void 0?r:Li(t,r))}return t},zd=(e,t=2)=>{let n=Mi(xi(e));return Nd(Co(e=>{let r=Ai(n*t**(e.attempt-1));return Co([r,r])}))},Bd=j(2,(e,t)=>jd(ds(Pd(e),e=>{let n=Md();return(r,i)=>os(e(r,i),([e,a])=>ds(t({...n(r,i),output:e,duration:a}),t=>[e,xi(t)]))}))),Vd=e=>jd(ds(Pd(e),e=>(t,n)=>Ed(e(t,n),{onSuccess:e=>Co([n,e[1]]),onFailure:wo,onDone:()=>Ou(n)}))),Hd=e=>Wd(Gd,({attempt:t})=>Co(t<=e)),Ud=e=>{let t=xi(e);return Nd(Co(e=>Co([e.attempt-1,t])))},Wd=j(2,(e,t)=>jd(ds(Pd(e),e=>{let n=Md();return(r,i)=>os(e(r,i),e=>{let[a,o]=e,s=t({...n(r,i),output:a,duration:o});return os(fn(s)?s:Co(s),t=>t?Co(e):Ou(a))})}))),Gd=Ud(Ei),Kd=(e,t,n)=>vc(r=>os(n?.local?Gl(t,Hl(),r):ql(t,r),t=>Ms(e,t))),qd=j(e=>fn(e[0]),(e,t,n)=>oi(t)?Ms(e,t):Kd(e,Array.isArray(t)?iu(...t):t,n)),Jd=j(3,(e,t,n)=>os(Fd(t),t=>{let r=Od.defaultValue();return Bs(Is(ns(os(Do(()=>Ns(e,Od,r)),t),e=>Eo(()=>{r=e})),{disableYield:!0}),e=>Kn(e)?Co(e.value):n(e,r.attempt===0?Pr():Fr(r)))})),Yd=j(3,(e,t,n)=>os(Fd(t),t=>{let r=Od.defaultValue(),i,a=Bs(Do(()=>Ns(e,Od,r)),e=>(i=e,os(t(e),e=>(r=e,a))));return bd(a,e=>Zt(()=>n(i,e)))})),Wne=j(2,(e,t)=>Jd(e,typeof t==`function`?t(je):Ad(t)?t:Xd(t),To)),Gne=j(2,(e,t)=>Yd(e,typeof t==`function`?t(je):Ad(t)?t:Xd(t),To)),Kne=Vd(Gd),Xd=e=>{let t=e.schedule?Vd(e.schedule):Kne;return e.while&&(t=Wd(t,({input:t})=>{let n=e.while(t);return fn(n)?n:Co(n)})),e.until&&(t=Wd(t,({input:t})=>{let n=e.until(t);return fn(n)?ds(n,e=>!e):Co(!n)})),e.times!==void 0&&(t=Wd(t,({attempt:t})=>Co(t<=e.times))),t},Zd=fn,Qd=Ec,$d=Oc,ef=Dc,tf=Lo,nf=Ro,M=Co,rf=jo,af=Ao,of=Do,sf=Eo,cf=Fo,lf=Ho,uf=Uo,df=Wo,ff=To,pf=wo,mf=Mo,qne=No,hf=Io,Jne=ko,gf=Vn,Yne=Oo,_f=os,vf=us,yf=ts,bf=ns,xf=$s,Sf=oc,Cf=ds,wf=$o,Tf=es,Ef=rs,Df=Bs,Of=Ks,kf=qs,Af=Ls,Xne=Gs,jf=Js,Mf=Xs,Nf=Us,Zne=Vs,Pf=Gne,Ff=Qs,If=Zs,Qne=_te,Lf=vte,Rf=sc,zf=gte,Bf=Qc,$ne=is,Vf=as,ere=Fs,tre=ic,Hf=tc,Uf=ks,Wf=js,Gf=qd,Kf=Ms,qf=Es,Jf=Ds,Yf=Ns,nre=_c,Xf=Tte,Zf=vc,Qf=Ete,rre=Nte,$f=Dte,ep=Ote,tp=Ate,np=bc,rp=Ite,ip=Lte,ap=wc,op=Mte,sp=xc,cp=Tc,lp=Is,up=Wne,dp=ene,fp=sne,pp=rne,mp=ine,hp=Kc,gp=one,_p=Jc,vp=Hte,yp=Mc,bp=Wte,xp=Ute,Sp=Kte,Cp=Nc,wp=Pc,Tp=qte,Ep=Yte,Dp=Ic,Op=Jte,kp=Fc,Ap=Zte,jp=Rc,Mp=Xte,Np=Lc,Pp=Go,Fp=Jo,Ip=Zc,Lp=ol(`Warn`),Rp=ol(`Error`),zp=ol(`Debug`),Bp=j(e=>Zd(e[0]),(e,...t)=>Os(e,Dl,e=>{let n=t.length===1?{...e,...t[0]}:{...e};return t.length===1||Qt(n,t[0],t[1]),n}));ti()(`effect/Effect/Transaction`);var Vp=fs,Hp=ps,Up=ms,Wp=ls,Gp=hs,Kp=Xo,qp=l(p(),1),Jp=l(h()),N=de(),Yp=_e(),Xp=De();function Zp(e){let t=new URL(e);if(t.protocol===`ws:`?t.protocol=`http:`:t.protocol===`wss:`&&(t.protocol=`https:`),t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`Endpoint must use HTTP or HTTPS. Received ${t.protocol}`);return t.pathname=`/`,t.search=``,t.hash=``,t.toString()}function Qp(e){let t=new URL(Zp(e));return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.toString()}var $p=(e,t)=>{let n=new URL(e);return n.pathname=t,n.search=``,n.hash=``,n.toString()},em=`~effect/BigDecimal`,tm={[em]:em,[ot](){let e=cm(this);return lt(st(e.value),ft(e.scale))},[Ct](e){return nm(e)&&fm(this,e)},toString(){return`BigDecimal(${pm(this)})`},toJSON(){return{_id:`BigDecimal`,value:String(this.value),scale:this.scale}},[qt](){return this.toJSON()},pipe(){return Oe(this,arguments)}},nm=e=>nt(e,em),rm=(e,t)=>{let n=Object.create(tm);return n.value=e,n.scale=t,n},im=(e,t)=>{if(e!==am&&e%om===am)throw RangeError(`Value must be normalized`);let n=rm(e,t);return n.normalized=n,n},am=BigInt(0),om=BigInt(10),sm=im(am,0),cm=e=>{if(e.normalized===void 0)if(e.value===am)e.normalized=sm;else{let t=`${e.value}`,n=0;for(let e=t.length-1;e>=0&&t[e]===`0`;e--)n++;n===0&&(e.normalized=e),e.normalized=im(BigInt(t.substring(0,t.length-n)),e.scale-n)}return e.normalized},lm=j(2,(e,t)=>t>e.scale?rm(e.value*om**BigInt(t-e.scale),t):t<e.scale?rm(e.value/om**BigInt(e.scale-t),t):e),um=e=>e.value<am?rm(-e.value,e.scale):e,dm=$n((e,t)=>e.scale>t.scale?lm(t,e.scale).value===e.value:e.scale<t.scale?lm(e,t.scale).value===t.value:e.value===t.value),fm=j(2,(e,t)=>dm(e,t)),pm=e=>{let t=cm(e);if(Math.abs(t.scale)>=16)return mm(t);let n=t.value<am,r=n?`${t.value}`.substring(1):`${t.value}`,i,a;if(t.scale>=r.length)i=`0`,a=`0`.repeat(t.scale-r.length)+r;else{let e=r.length-t.scale;if(e>r.length){let t=e-r.length;i=`${r}${`0`.repeat(t)}`,a=``}else a=r.slice(e),i=r.slice(0,e)}let o=a===``?i:`${i}.${a}`;return n?`-${o}`:o},mm=e=>{if(hm(e))return`0e+0`;let t=cm(e),n=`${um(t).value}`,r=n.slice(0,1),i=n.slice(1),a=`${gm(t)?`-`:``}${r}`;i!==``&&(a+=`.${i}`);let o=i.length-t.scale;return`${a}e${o>=0?`+`:``}${o}`},hm=e=>e.value===am,gm=e=>e.value<am,_m=Bu,vm=Hu,ym=Uu,bm=Wu,xm=Ku,Sm=Yu,Cm=Xu,wm=Zu,Tm=Qu,Em=$u,Dm=id;ti()(`effect/DateTime/CurrentTimeZone`);var Om=pd,km=md,Am=`~effect/encoding/EncodingError`,jm=class extends Au(`EncodingError`){[Am]=Am},Mm=e=>Lm(typeof e==`string`?Fm.encode(e):e),Nm=e=>{let t=Im(e),n=t.length;if(n%4!=0)return Ui(new jm({kind:`Decode`,module:`Base64`,input:t,message:`Length must be a multiple of 4, but is ${n}`}));let r=t.indexOf(`=`);if(r!==-1&&(r<n-2||r===n-2&&t[n-1]!==`=`))return Ui(new jm({kind:`Decode`,module:`Base64`,input:t,message:`Found a '=' character, but it is not at the end`}));try{let e=t.endsWith(`==`)?2:+!!t.endsWith(`=`),r=new Uint8Array(n/4*3-e);for(let e=0,i=0;e<n;e+=4,i+=3){let n=Rm(t.charCodeAt(e))<<18|Rm(t.charCodeAt(e+1))<<12|Rm(t.charCodeAt(e+2))<<6|Rm(t.charCodeAt(e+3));r[i]=n>>16,r[i+1]=n>>8&255,r[i+2]=n&255}return Hi(r)}catch(e){return Ui(new jm({kind:`Decode`,module:`Base64`,input:t,message:e instanceof Error?e.message:`Invalid input`}))}},Pm=e=>Vm(typeof e==`string`?Fm.encode(e):e),Fm=new TextEncoder,Im=e=>e.replace(/[\n\r]/g,``),Lm=e=>{let t=e.length,n=``,r;for(r=2;r<t;r+=3)n+=zm[e[r-2]>>2],n+=zm[(e[r-2]&3)<<4|e[r-1]>>4],n+=zm[(e[r-1]&15)<<2|e[r]>>6],n+=zm[e[r]&63];return r===t+1&&(n+=zm[e[r-2]>>2],n+=zm[(e[r-2]&3)<<4],n+=`==`),r===t&&(n+=zm[e[r-2]>>2],n+=zm[(e[r-2]&3)<<4|e[r-1]>>4],n+=zm[(e[r-1]&15)<<2],n+=`=`),n};function Rm(e){if(e>=Bm.length)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);let t=Bm[e];if(t===255)throw TypeError(`Invalid character ${String.fromCharCode(e)}`);return t}var zm=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Bm=[255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,62,255,255,255,63,52,53,54,55,56,57,58,59,60,61,255,255,255,0,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Vm=e=>{let t=``;for(let n=0;n<e.length;++n)t+=Hm[e[n]];return t},Hm=`00.01.02.03.04.05.06.07.08.09.0a.0b.0c.0d.0e.0f.10.11.12.13.14.15.16.17.18.19.1a.1b.1c.1d.1e.1f.20.21.22.23.24.25.26.27.28.29.2a.2b.2c.2d.2e.2f.30.31.32.33.34.35.36.37.38.39.3a.3b.3c.3d.3e.3f.40.41.42.43.44.45.46.47.48.49.4a.4b.4c.4d.4e.4f.50.51.52.53.54.55.56.57.58.59.5a.5b.5c.5d.5e.5f.60.61.62.63.64.65.66.67.68.69.6a.6b.6c.6d.6e.6f.70.71.72.73.74.75.76.77.78.79.7a.7b.7c.7d.7e.7f.80.81.82.83.84.85.86.87.88.89.8a.8b.8c.8d.8e.8f.90.91.92.93.94.95.96.97.98.99.9a.9b.9c.9d.9e.9f.a0.a1.a2.a3.a4.a5.a6.a7.a8.a9.aa.ab.ac.ad.ae.af.b0.b1.b2.b3.b4.b5.b6.b7.b8.b9.ba.bb.bc.bd.be.bf.c0.c1.c2.c3.c4.c5.c6.c7.c8.c9.ca.cb.cc.cd.ce.cf.d0.d1.d2.d3.d4.d5.d6.d7.d8.d9.da.db.dc.dd.de.df.e0.e1.e2.e3.e4.e5.e6.e7.e8.e9.ea.eb.ec.ed.ee.ef.f0.f1.f2.f3.f4.f5.f6.f7.f8.f9.fa.fb.fc.fd.fe.ff`.split(`.`);function Um(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function Wm(e){return t=>Um(t)?.[e]}var Gm=`~structural`,Km=`~identifier`,qm=`~sentinels`,Jm=Wm(`identifier`),Ym=Wm(Km),Xm=Wm(`brands`),Zm=Be(e=>{let t=Jm(e);return typeof t==`string`?t:e.getExpected(Zm)}),Qm=new WeakMap,$m=e=>{if(Qm.has(e))return Qm.get(e);throw Error(`Unable to get redacted value`+(e.label?` with label: "${e.label}"`:``))},eh=e=>typeof e==`string`?e:$m(e),th=`~effect/data/Redacted`,nh=e=>nt(e,th),rh=(e,t)=>{let n=Object.create(ih);return t?.label&&(n.label=t.label),Qm.set(n,e),n},ih={[th]:{_A:e=>e},label:void 0,...un,toJSON(){return this.toString()},toString(){return`<redacted${Ue(this.label)?`:`+this.label:``}>`},[ot](){return st(Qm.get(this))},[Ct](e){return nh(e)&&wt(Qm.get(this),Qm.get(e))}},ah=`~effect/SchemaIssue/Issue`;function oh(e){return nt(e,ah)&&e[ah]===ah}var sh=class{[ah]=ah;toString(){return Oh(this)}},ch=class extends sh{_tag=`Filter`;actual;filter;issue;constructor(e,t,n){super(),this.actual=e,this.filter=t,this.issue=n}},lh=class extends sh{_tag=`Encoding`;ast;actual;issue;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issue=n}},uh=class extends sh{_tag=`Pointer`;path;issue;constructor(e,t){super(),this.path=e,this.issue=t}},dh=class extends sh{_tag=`MissingKey`;annotations;constructor(e){super(),this.annotations=e}},fh=class extends sh{_tag=`UnexpectedKey`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},ph=class extends sh{_tag=`Composite`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},mh=class extends sh{_tag=`InvalidType`;ast;actual;constructor(e,t){super(),this.ast=e,this.actual=t}},hh=class extends sh{_tag=`InvalidValue`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},gh=class extends sh{_tag=`Forbidden`;actual;annotations;constructor(e,t){super(),this.actual=e,this.annotations=t}},_h=class extends sh{_tag=`AnyOf`;ast;actual;issues;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.issues=n}},vh=class extends sh{_tag=`OneOf`;ast;actual;successes;constructor(e,t,n){super(),this.ast=e,this.actual=t,this.successes=n}};function yh(e,t){if(oh(t))return t;if(typeof t==`string`)return new hh(Fr(e),{message:t});let n=typeof t.issue==`string`?new hh(Fr(e),{message:t.issue}):t.issue;return new uh(t.path,n)}function bh(e,t){if(t!==void 0)return typeof t==`boolean`?t?void 0:new hh(Fr(e)):yh(e,t)}function xh(e,t,n){return Array.isArray(n)?ia(n)?n.length===1?yh(e,n[0]):new ph(t,Fr(e),ha(n,t=>yh(e,t))):void 0:bh(e,n)}var Sh=e=>{let t=Ah(e);if(t!==void 0)return t;switch(e._tag){case`InvalidType`:return wh(Zm(e.ast),Mh(e.actual));case`InvalidValue`:return`Invalid data ${Mh(e.actual)}`;case`MissingKey`:return`Missing key`;case`UnexpectedKey`:return`Unexpected key with value ${Ut(e.actual)}`;case`Forbidden`:return`Forbidden operation`;case`OneOf`:return`Expected exactly one member to match the input ${Ut(e.actual)}`}},Ch=e=>Ah(e.issue)??Ah(e);function wh(e,t){return`Expected ${e}, got ${t}`}function Th(e,t,n,r){switch(e._tag){case`Filter`:{let i=r(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case`InvalidValue`:return[{path:t,message:wh(Eh(e.filter),Ut(e.actual))}];default:return Th(e.issue,t,n,r)}}case`Encoding`:return Th(e.issue,t,n,r);case`Pointer`:return Th(e.issue,[...t,...e.path],n,r);case`Composite`:return e.issues.flatMap(e=>Th(e,t,n,r));case`AnyOf`:{let i=Ah(e);return e.issues.length===0?i===void 0?[{path:t,message:wh(Zm(e.ast),Ut(e.actual))}]:[{path:t,message:i}]:e.issues.flatMap(e=>Th(e,t,n,r))}default:return[{path:t,message:n(e)}]}}function Eh(e){let t=e.annotations?.expected;if(typeof t==`string`)return t;switch(e._tag){case`Filter`:return`<filter>`;case`FilterGroup`:return e.checks.map(e=>Eh(e)).join(` & `)}}function Dh(){return e=>Th(e,[],Sh,Ch).map(kh).join(`
|
|
15
|
-
`)}var Oh=Dh();function kh(e){let t=e.message;if(e.path&&e.path.length>0){let n=aee(e.path);t+=`\n at ${n}`}return t}function Ah(e){switch(e._tag){case`InvalidType`:case`OneOf`:case`Composite`:case`AnyOf`:return jh(e.ast.annotations);case`InvalidValue`:case`Forbidden`:return jh(e.annotations);case`MissingKey`:return jh(e.annotations,`messageMissingKey`);case`UnexpectedKey`:return jh(e.ast.annotations,`messageUnexpectedKey`);case`Filter`:return jh(e.filter.annotations);case`Encoding`:return Ah(e.issue)}}function jh(e,t=`message`){let n=e?.[t];if(typeof n==`string`)return n}function Mh(e){return Lr(e)?`no value provided`:Ut(e.value)}function Nh(e){let t;for(let n of e.reasons){if(!fu(n)||!oh(n.error))return;t??=n.error}return t}function Ph(e,t){let n=Nh(e);if(n===void 0)throw Error(t,{cause:e});return n}var Fh=class e extends Ae{run;constructor(e){super(),this.run=e}map(t){return new e((e,n)=>this.run(e,n).pipe(Vp(Yr(t))))}compose(t){return Lh(this)?t:Lh(t)?this:new e((e,n)=>this.run(e,n).pipe(Wp(e=>t.run(e,n))))}},Ih=new Fh(M);function Lh(e){return e.run===Ih.run}function Rh(){return Ih}function zh(e){return new Fh((t,n)=>Lr(t)?rf:e(t.value,n))}function Bh(e){return Hh(Yr(e))}function Vh(e){return zh((t,n)=>e(t,n).pipe(Vp(Fr)))}function Hh(e){return new Fh(t=>M(e(t)))}function Uh(){return new Fh(()=>rf)}function Wh(e){return new Fh(t=>{let n=Qr(t,Xe);return Rr(n)?M(n):Vp(e,Fr)})}function Gh(){return Bh(globalThis.String)}function Kh(){return Bh(globalThis.Number)}function qh(){return Bh(globalThis.BigInt)}function Jh(){return Bh(yd)}function Yh(e){return zh(t=>hf({try:()=>Fr(JSON.parse(t,e?.reviver)),catch:e=>new hh(Fr(t),{message:globalThis.String(e)})}))}function Xh(e){return zh(t=>hf({try:()=>{let n=JSON.stringify(t,e?.replacer,e?.space);if(n===void 0)throw TypeError(`Value cannot be represented as JSON`);return Fr(n)},catch:e=>new hh(Fr(t),{message:globalThis.String(e)})}))}function Zh(e){let t=e?.separator??`,`,n=e?.keyValueSeparator??`=`;return Bh(e=>e.split(t).reduce((e,t)=>{let[r,i]=t.split(n);return r&&i&&Qt(e,r,i),e},{}))}function Qh(e){let t=e?.separator??`,`,n=e?.keyValueSeparator??`=`;return Bh(e=>Object.entries(e).map(([e,t])=>`${e}${n}${t}`).join(t))}function $h(){return Bh(Mm)}function eg(){return Vh(e=>Hp(Yne(Nm(e)),t=>new hh(Fr(e),{message:t.message})))}var tg=class e{_tag=`Middleware`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}},ng=`~effect/SchemaTransformation/Transformation`,rg=class e{[ng]=ng;_tag=`Transformation`;decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}compose(t){return new e(this.decode.compose(t.decode),t.encode.compose(this.encode))}};function ig(e){return nt(e,ng)&&e[ng]===ng}var ag=e=>ig(e)?e:new rg(e.decode,e.encode);function og(e){return new rg(Vh(e.decode),Vh(e.encode))}function sg(e){return new rg(Bh(e.decode),Bh(e.encode))}function cg(){return new rg(Jh(),Rh())}function lg(e){return new rg(Zh(e),Qh(e))}var ug=new rg(Rh(),Rh());function dg(){return ug}var fg=new rg(Kh(),Gh()),pg=new rg(qh(),Gh()),mg=sg({decode:e=>Ai(e),encode:e=>Mi(e)}),hg=e=>et(e)&&typeof e.message==`string`,gg=e=>{let t=Object.hasOwn(e,`cause`)?Error(e.message,{cause:bg(e.cause)}):Error(e.message);return typeof e.name==`string`&&e.name!==`Error`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t},_g=e=>{try{let t=Kt(e);return t===void 0?Ut(e):JSON.parse(t)}catch{return Ut(e)}},vg=(e,t,n)=>{let r={name:e.name,message:typeof e.message==`string`?e.message:``};return t?.includeStack&&typeof e.stack==`string`&&(r.stack=e.stack),!t?.excludeCause&&e.cause!==void 0&&(r.cause=n(e.cause)),r},yg=e=>{let t=new WeakSet,n=r=>{if(eee(r)){if(t.has(r))return`[Circular]`;t.add(r);let i=vg(r,e,n);return t.delete(r),i}return _g(r)};return n},bg=e=>hg(e)?gg(e):e,xg=e=>sg({decode:bg,encode:yg(e)}),Sg=new rg(eg(),$h()),Cg=new rg(Yh(),Xh()),wg=og({decode:e=>zr(Sm(e),{onNone:()=>ff(new hh(Fr(e),{message:`Invalid UTC DateTime string: ${e}`})),onSome:e=>M(Tm(e))}),encode:e=>M(km(e))});function Tg(e){return t=>t._tag===e}var Eg=Tg(`Declaration`),Dg=Tg(`Null`),Og=Tg(`Void`),kg=Tg(`Never`),Ag=Tg(`Literal`),jg=Tg(`UniqueSymbol`),Mg=Tg(`Arrays`),Ng=Tg(`Objects`),Pg=Tg(`Union`),Fg=Tg(`Suspend`),Ig=class{to;transformation;constructor(e,t){this.to=e,this.transformation=t}},Lg={},Rg=class{isOptional;isMutable;defaultValue;annotations;constructor(e,t,n=void 0,r=void 0){this.isOptional=e,this.isMutable=t,this.defaultValue=n,this.annotations=r}},zg=`~effect/Schema`,Bg=class{[zg]=zg;annotations;checks;encoding;context;constructor(e=void 0,t=void 0,n=void 0,r=void 0){this.annotations=e,this.checks=t,this.encoding=n,this.context=r}toString(){return`<${this._tag}>`}},Vg=class e extends Bg{_tag=`Declaration`;typeParameters;run;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.typeParameters=e,this.run=t,this.encodingChecks=o}getParser(){let e=this.run(this.typeParameters);return(t,n)=>Lr(t)?rf:Vp(e(t.value,this,n),Fr)}_rebuild(t,n,r){let i=av(this.typeParameters,t);return i===this.typeParameters&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.run,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){let e=this.annotations?.expected;return typeof e==`string`?e:`<Declaration>`}},Hg=new class extends Bg{_tag=`Null`;getParser(){return xv(this,null)}getExpected(){return`null`}},Ug=class extends Bg{_tag=`Undefined`;getParser(){return xv(this,void 0)}toCodecJson(){return G_(this,[Wg])}getExpected(){return`undefined`}},Wg=new Ig(Hg,new rg(Bh(()=>void 0),Bh(()=>null))),Gg=new Ug,Kg=new class extends Bg{_tag=`Void`;getParser(){return Sv(void 0)}toCodecJson(){return G_(this,[Wg])}getExpected(){return`void`}},qg=new class extends Bg{_tag=`Never`;getParser(){return Cv(this,Qe)}getExpected(){return`never`}},Jg=new class extends Bg{_tag=`Unknown`;getParser(){return Cv(this,$e)}getExpected(){return`unknown`}};function Yg(e){switch(e._tag){case`String`:case`Number`:case`BigInt`:return!0;case`Literal`:case`TemplateLiteral`:return e.checks===void 0;case`Union`:return e.checks===void 0&&e.types.every(Yg);default:return!1}}var Xg=class extends Bg{_tag=`TemplateLiteral`;parts;encodedParts;constructor(e,t,n,r,i){super(t,n,r,i);let a=[];for(let t of e){let e=_v(t);if(Yg(e))a.push(e);else throw Error(`Invalid TemplateLiteral part ${e._tag}`)}this.parts=e,this.encodedParts=a}getParser(e){let t=e(this.asTemplateLiteralParser());return(e,n)=>Up(t(e,n),{onSuccess:()=>e,onFailure:t=>new ph(this,e,[t])})}getExpected(){return`string`}matchPart(e,t){return Tv(this.encodedParts,e,t)===void 0?void 0:e}asTemplateLiteralParser(){return uv($g,new o_(!1,this.parts.map(Ov),[]),new rg(Vh((e,t)=>{let n=Tv(this.encodedParts,e,t);return n===void 0?ff(new hh(Fr(e),{message:`Expected a string matching template literal parts, got ${Ut(e)}`})):M(n)}),Bh(e=>e.join(``))))}},Zg=class extends Bg{_tag=`Literal`;literal;constructor(e,t,n,r,i){if(super(t,n,r,i),typeof e==`number`&&!globalThis.Number.isFinite(e))throw Error(`A numeric literal must be finite, got ${Ut(e)}`);this.literal=e}getParser(){return xv(this,this.literal)}matchPart(e,t){return e===globalThis.String(this.literal)?this.literal:void 0}toCodecJson(){return typeof this.literal==`bigint`?Qg(this):this}toCodecStringTree(){return typeof this.literal==`string`?this:Qg(this)}getExpected(){return typeof this.literal==`string`?JSON.stringify(this.literal):globalThis.String(this.literal)}};function Qg(e){let t=globalThis.String(e.literal);return G_(e,[new Ig(new Zg(t),new rg(Bh(()=>e.literal),Bh(()=>t)))])}var $g=new class extends Bg{_tag=`String`;getParser(){return Cv(this,Ue)}matchPart(e,t){return wv(this,e,t)}getExpected(){return`string`}},e_=class extends Bg{_tag=`Number`;getParser(){return Cv(this,We)}matchKey(e,t){return this._match(Av,e,t)}matchPart(e,t){return this._match(kv,e,t)}_match(e,t,n){return e.test(t)?wv(this,globalThis.Number(t),n):void 0}toCodecJson(){return this.checks&&(t_(this.checks,`effect/schema/isFinite`)||t_(this.checks,`effect/schema/isInt`))?this:G_(this,[n_(this.checks)])}toCodecStringTree(){return this.toCodecJson()===this?G_(this,[Nv]):G_(this,[Pv])}getExpected(){return`number`}};function t_(e,t){return e.some(e=>e.annotations?.representation?.id===t||e._tag===`FilterGroup`&&t_(e.checks,t))}function n_(e){return new Ig(new j_([e===void 0?H_:X_(H_,e),N_],`anyOf`),new rg(Kh(),Bh(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))))}var r_=new e_,i_=new class extends Bg{_tag=`Boolean`;getParser(){return Cv(this,Ge)}getExpected(){return`boolean`}},a_=new class extends Bg{_tag=`BigInt`;getParser(){return Cv(this,Ke)}matchPart(e,t){return Fv.test(e)?wv(this,globalThis.BigInt(e),t):void 0}toCodecStringTree(){return G_(this,[Lv])}getExpected(){return`bigint`}},o_=class e extends Bg{_tag=`Arrays`;isMutable;elements;rest;encodingChecks;constructor(e,t,n,r,i,a,o,s){super(r,i,a,o),this.isMutable=e,this.elements=t,this.rest=n,this.encodingChecks=s;let c=t.findIndex(pv);if(c!==-1&&(t.slice(c+1).some(e=>!pv(e))||n.length>1))throw Error(`A required element cannot follow an optional element. ts(1257)`);if(n.length>1&&n.slice(1).some(pv))throw Error(`An optional element cannot follow a rest element. ts(1266)`)}getParser(e){let t=this,n=t.elements.map(t=>({ast:t,parser:e(t)})),r=t.rest.map(t=>({ast:t,parser:e(t)})),i=n.length,[a,...o]=r,s=o.length;function c(e,t){return t<i?n[t]:t>=e?o[t-e]:a}return Kp(function*(e,n){if(e._tag===`None`)return e;let r=e.value;if(!Array.isArray(r))return yield*ff(new mh(t,e));let a=r.length,o={ast:t,getParser:c,oinput:e,len:a,tailThreshold:c_(a,i,s),output:new globalThis.Array(a),issues:void 0,options:n},l=s_(o,r,{concurrency:l_(n?.concurrency)?.concurrency,end:t.rest.length===0?i:Math.max(a,i+s)});if(l&&(yield*l),t.rest.length===0&&a>i)for(let s=i;s<=a-1;s++){let i=new uh([s],new fh(t,r[s]));if(n.errors===`all`)o.issues?o.issues.push(i):o.issues=[i];else return yield*ff(new ph(t,e,[i]))}return o.issues?yield*ff(new ph(t,e,o.issues)):Fr(o.output)})}_rebuild(t,n,r){let i=av(this.elements,t),a=av(this.rest,t);return i===this.elements&&a===this.rest&&n===this.checks&&r===this.encodingChecks?this:new e(this.isMutable,i,a,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}getExpected(){return`array`}},s_=Ac()({onItem(e,t,n){let r=n<e.len?Fr(t):Pr();return e.getParser(e.tailThreshold,n).parser(r,e.options)},step(e,t,n,r){if(n._tag===`Failure`)return u_(e,e.ast,r,n);if(n.value._tag===`Some`)e.output[r]=n.value.value;else{let t=e.getParser(e.tailThreshold,r);if(pv(t.ast))return;let n=new uh([r],new dh(t.ast.context?.annotations));if(e.options.errors===`all`)e.issues?e.issues.push(n):e.issues=[n];else return dl(new ph(e.ast,e.oinput,[n]))}}});function c_(e,t,n){return Math.max(t,e-n)}var l_=e=>(e=e===`unbounded`?1/0:e??1,e>1?{concurrency:e}:void 0),u_=(e,t,n,r)=>{if(r.cause.reasons.length===0)return r;let i=Nh(r.cause);if(i===void 0)return ul(xu(r.cause,r=>new ph(t,e.oinput,[new uh([n],r)])));let a=new uh([n],i);if(e.options.errors===`all`)e.issues?e.issues.push(a):e.issues=[a];else return dl(new ph(t,e.oinput,[a]))},d_=`[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?`;function f_(e,t,n=Lg){let r,i;function a(t){switch(t._tag){case`String`:case`TemplateLiteral`:return(r??=Object.keys(e)).filter(e=>t.matchPart(e,n)!==void 0);case`Number`:return(r??=Object.keys(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Symbol`:return(i??=Object.getOwnPropertySymbols(e)).filter(e=>t.matchKey(e,n)!==void 0);case`Union`:return[...new Set(t.types.flatMap(a))];default:return[]}}return a(Ev(_v(t)))}var p_=class{name;type;constructor(e,t){this.name=e,this.type=t}},m_=class e{decode;encode;constructor(e,t){this.decode=e,this.encode=t}flip(){return new e(this.encode,this.decode)}};function h_(e){switch(e._tag){case`String`:case`Number`:case`Symbol`:case`TemplateLiteral`:return!0;case`Union`:return e.types.every(h_);default:return!1}}function g_(e){return h_(e)&&h_(_v(e))}var __=class{parameter;type;merge;constructor(e,t,n){if(!g_(e))throw Error(`Invalid index signature parameter ${e._tag}`);if(this.parameter=e,this.type=t,this.merge=n,pv(t)&&!bv(t))throw Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}},v_=class e extends Bg{_tag=`Objects`;propertySignatures;indexSignatures;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.propertySignatures=e,this.indexSignatures=t,this.encodingChecks=o;let s=e.map(e=>e.name).filter((e,t,n)=>n.indexOf(e)!==t);if(s.length>0)throw Error(`Duplicate identifiers: ${JSON.stringify(s)}. ts(2300)`)}getParser(e){let t=this,n=[],r=new Set,i=[];for(let a of t.propertySignatures)n.push(a.name),r.add(a.name),i.push({ps:a,parser:e(a.type),name:a.name,type:a.type});let a=t.indexSignatures.length;if(t.propertySignatures.length===0&&t.indexSignatures.length===0)return Cv(t,Ze);let o=a>0?Ac()({onItem:Kp(function*(n,[i,a]){let o=e(Ev(a.parameter))(Fr(i),n.options),s=cs(o)?o:yield*Sf(o);if(s._tag===`Failure`){let e=u_(n,t,i,s);e&&(yield*e);return}let c=Fr(n.input[i]),l=e(a.type)(c,n.options),u=cs(l)?l:yield*Sf(l);if(u._tag===`Failure`){let e=u_(n,t,i,u);e&&(yield*e);return}else if(s.value._tag===`Some`&&u.value._tag===`Some`){let e=s.value.value;if(r.has(i)||r.has(e))return;let t=u.value.value;if(a.merge&&a.merge.decode&&Object.hasOwn(n.out,e)){let[r,i]=a.merge.decode.combine([e,n.out[e]],[e,t]);Qt(n.out,r,i)}else Qt(n.out,e,t)}}),step:(e,t,n)=>n._tag===`Failure`?n:void 0}):void 0;return Kp(function*(e,s){if(e._tag===`None`)return e;let c=e.value;if(!(typeof c==`object`&&c&&!Array.isArray(c)))return yield*ff(new mh(t,e));let l={},u={ast:t,oinput:e,input:c,out:l,issues:void 0,options:s},d=s.errors===`all`,f=s.onExcessProperty===`error`,p=s.onExcessProperty===`preserve`,m;if(t.indexSignatures.length===0&&(f||p)){m=Reflect.ownKeys(c);for(let n=0;n<m.length;n++){let i=m[n];if(!r.has(i))if(f){let n=new uh([i],new fh(t,c[i]));if(d){u.issues?u.issues.push(n):u.issues=[n];continue}else return yield*ff(new ph(t,e,[n]))}else Qt(l,i,c[i])}}let h=l_(s?.concurrency),g=y_(u,i,h);if(g&&(yield*g),o){let e=pa();for(let n=0;n<a;n++){let r=t.indexSignatures[n],i=f_(c,r.parameter,s);for(let t=0;t<i.length;t++){let n=i[t];e.push([n,r])}}let n=o(u,e,h);n&&(yield*n)}if(u.issues)return yield*ff(new ph(t,e,u.issues));if(s.propertyOrder===`original`){let e=(m??Reflect.ownKeys(c)).concat(n),t={};for(let n of e)Object.hasOwn(l,n)&&Qt(t,n,l[n]);return Fr(t)}return Fr(l)})}_rebuild(t,n,r,i,a){let o=av(this.propertySignatures,e=>{let n=t(e.type);return n===e.type?e:new p_(e.name,n)}),s=av(this.indexSignatures,e=>{let i=n(e.parameter),a=t(e.type),o=r?e.merge?.flip():e.merge;return i===e.parameter&&a===e.type&&o===e.merge?e:new __(i,a,o)});return o===this.propertySignatures&&s===this.indexSignatures&&i===this.checks&&a===this.encodingChecks?this:new e(o,s,this.annotations,i,void 0,this.context,a)}flip(e){return this._rebuild(e,e,!0,this.encodingChecks,this.checks)}recur(e,t=e){return this._rebuild(e,t,!1,this.checks,this.encodingChecks)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?`object | array`:`object`}},y_=Ac()({onItem(e,t){let n=Object.hasOwn(e.input,t.name)?Fr(e.input[t.name]):Pr();return t.parser(n,e.options)},step(e,t,n){if(n._tag===`Failure`)return u_(e,e.ast,t.name,n);if(n.value._tag===`Some`)Qt(e.out,t.name,n.value.value);else if(!pv(t.type)){let n=new uh([t.name],new dh(t.type.context?.annotations));if(e.options.errors===`all`){e.issues?e.issues.push(n):e.issues=[n];return}else return dl(new ph(e.ast,e.oinput,[n]))}}});function b_(e,t){return e?t?[...e,...t]:e:t}function x_(e,t,n){return new v_(Reflect.ownKeys(e).map(t=>new p_(t,e[t].ast)),[],n,t)}function S_(e){return e.ast}function C_(e,t=void 0){return new o_(!1,e.map(e=>e.ast),[],void 0,t)}function w_(e,t,n){return new j_(e.map(S_),t,void 0,n)}function T_(e){switch(e._tag){case`Null`:return[`null`];case`Undefined`:return[`undefined`];case`String`:case`TemplateLiteral`:return[`string`];case`Number`:return[`number`];case`Boolean`:return[`boolean`];case`Symbol`:case`UniqueSymbol`:return[`symbol`];case`BigInt`:return[`bigint`];case`Arrays`:return[`array`];case`ObjectKeyword`:return[`object`,`array`,`function`];case`Objects`:return e.propertySignatures.length||e.indexSignatures.length?[`object`]:[`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`];case`Enum`:return Array.from(new Set(e.enums.map(([,e])=>typeof e)));case`Literal`:return[typeof e.literal];case`Union`:return Array.from(new Set(e.types.flatMap(T_)));default:return[`null`,`undefined`,`string`,`number`,`boolean`,`symbol`,`bigint`,`object`,`array`,`function`]}}function E_(e){switch(e._tag){default:return[];case`Declaration`:{let t=e.annotations?.[qm];return Array.isArray(t)?t:[]}case`Objects`:return e.propertySignatures.flatMap(e=>{let t=e.type;if(!pv(t)){if(Ag(t))return[{key:e.name,literal:t.literal}];if(jg(t))return[{key:e.name,literal:t.symbol}]}return[]});case`Arrays`:return e.elements.flatMap((e,t)=>Ag(e)&&!pv(e)?[{key:t,literal:e.literal}]:[]);case`Suspend`:return E_(e.thunk())}}var D_=new WeakMap;function O_(e){let t=D_.get(e);if(t)return t;t={};for(let n=0;n<e.length;n++){let r=e[n],i=_v(r);if(kg(i))continue;let a=T_(i),o=E_(i);t.byType??={};for(let e of a)(t.byType[e]??=[]).push(n);if(o.length>0){t.bySentinel??=new Map;for(let{key:e,literal:r}of o){let i=t.bySentinel.get(e);i||t.bySentinel.set(e,i=new Map);let a=i.get(r);a||i.set(r,a=[]),a.push(n)}}else{t.otherwise??={};for(let e of a)(t.otherwise[e]??=[]).push(n)}}return D_.set(e,t),t}function k_(e){return t=>{let n=_v(t);return n._tag===`Literal`?n.literal===e:n._tag===`UniqueSymbol`?n.symbol===e:!0}}function A_(e,t){let n=O_(t),r=e===null?`null`:Array.isArray(e)?`array`:typeof e;if(n.bySentinel){let i=n.otherwise?.[r]??[];if(r===`object`||r===`array`){let r=new Set(i);for(let[t,i]of n.bySentinel)if(Object.hasOwn(e,t)){let n=i.get(e[t]);if(n)for(let e of n)r.add(e)}return Array.from(r).sort((e,t)=>e-t).map(e=>t[e]).filter(k_(e))}return i.map(e=>t[e])}return(n.byType?.[r]??[]).map(e=>t[e]).filter(k_(e))}var j_=class e extends Bg{_tag=`Union`;types;mode;encodingChecks;constructor(e,t,n,r,i,a,o){super(n,r,i,a),this.types=e,this.mode=t,this.encodingChecks=o}getParser(e){let t=this;return(n,r)=>{if(n._tag===`None`)return M(n);let i=n.value,a=A_(i,t.types),o={ast:t,recur:e,oinput:n,input:i,out:void 0,successes:[],issues:void 0,options:r},s=l_(r?.concurrency),c=M_(o,a,s?{...s,orderedStep:!0}:void 0);return c?_f(c,e=>o.out?M(o.out):ff(new _h(t,i,o.issues??[]))):o.out?M(o.out):ff(new _h(t,i,o.issues??[]))}}_rebuild(t,n,r){let i=av(this.types,t);return i===this.types&&n===this.checks&&r===this.encodingChecks?this:new e(i,this.mode,this.annotations,n,void 0,this.context,r)}recur(e){return this._rebuild(e,this.checks,this.encodingChecks)}flip(e){return this._rebuild(e,this.encodingChecks,this.checks)}matchPart(e,t){for(let n of this.types){let r=n.matchPart(e,t);if(r!==void 0)return r}}getExpected(e){let t=this.annotations?.expected;if(typeof t==`string`)return t;if(this.types.length===0)return`never`;let n=this.types.map(t=>{let n=_v(t);switch(n._tag){case`Arrays`:{let t=n.elements.filter(Ag);if(t.length>0)return`${P_(n.isMutable)}[ ${t.map(t=>e(t)+F_(t.context?.isOptional)).join(`, `)}, ... ]`;break}case`Objects`:{let t=n.propertySignatures.filter(e=>Ag(e.type));if(t.length>0)return`{ ${t.map(t=>`${P_(t.type.context?.isMutable)}${Gt(t.name)}${F_(t.type.context?.isOptional)}: ${e(t.type)}`).join(`, `)}, ... }`;break}}return e(n)});return Array.from(new Set(n)).join(` | `)}},M_=Ac()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag===`Failure`){let t=Nh(n.cause);if(t===void 0)return n;e.issues?e.issues.push(t):e.issues=[t]}else{if(e.out&&e.ast.mode===`oneOf`)return e.successes.push(t),dl(new vh(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode===`anyOf`)return fl}}}),N_=new j_([new Zg(`Infinity`),new Zg(`-Infinity`),new Zg(`NaN`)],`anyOf`);function P_(e){return e?``:`readonly `}function F_(e){return e?`?`:``}function I_(e){let t=!1,n;return()=>t?n:(n=e(),t=!0,n)}var L_=class e extends Bg{_tag=`Suspend`;thunk;constructor(e,t,n,r,i){if(n!==void 0)throw Error(`Cannot add checks to Suspend`);super(t,void 0,r,i),this.thunk=I_(e)}getParser(e){return e(this.thunk())}recur(t){return new e(()=>t(this.thunk()),this.annotations,void 0,void 0,this.context)}getExpected(e){return e(this.thunk())}},R_=class e extends Ae{_tag=`Filter`;run;annotations;aborted;constructor(e,t=void 0,n=!1){super(),this.run=e,this.annotations=t,this.aborted=n}annotate(t){return new e(this.run,{...this.annotations,...t},this.aborted)}abort(){return new e(this.run,this.annotations,!0)}and(e,t){return new z_([this,e],t)}},z_=class e extends Ae{_tag=`FilterGroup`;checks;annotations;constructor(e,t=void 0){super(),this.checks=e,this.annotations=t}annotate(t){return new e(this.checks,{...this.annotations,...t})}and(t,n){return new e([this,t],n)}};function B_(e,t,n=!1){return new R_((t,n,r)=>xh(t,n,e(t,n,r)),t,n)}function V_(e){return B_(e=>globalThis.Number.isFinite(e),{expected:`a finite number`,representation:{id:`effect/schema/isFinite`,payload:null},toJsonSchema:()=>({type:`number`}),toCode:()=>({runtime:`Schema.isFinite()`}),arbitrary:{constraint:{noInfinity:!0,noNaN:!0}},...e})}var H_=X_(r_,[V_()]);function U_(e,t){let n=e.source;return B_(t=>e.test(t),{expected:`a string matching the RegExp ${n}`,representation:{id:`effect/schema/isPattern`,payload:{source:n,flags:e.flags}},toJsonSchema:()=>({pattern:n}),arbitrary:{constraint:{patterns:[e.source]}},...t})}function W_(e,t){let n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function G_(e,t){return e.encoding===t?e:W_(e,e=>{e.encoding.value=t})}function K_(e,t){return e.context===t?e:W_(e,e=>{e.context.value=t})}function q_(e){return e.encoding?q_(e.encoding[e.encoding.length-1].to):e}function J_(e,t){if(e.checks){let n=e.checks[e.checks.length-1];return Y_(e,ea(e.checks.slice(0,-1),n.annotate(t)))}return W_(e,e=>{e.annotations.value={...e.annotations.value,...t}})}function Y_(e,t){if(e._tag===`Suspend`&&t!==void 0)throw Error(`Cannot add checks to Suspend`);return e.checks===t?e:W_(e,e=>{e.checks.value=t})}function X_(e,t){return Y_(e,b_(e.checks,t))}function Z_(e,t){let n=t(e.to);return n===e.to?e:new Ig(n,e.transformation)}function Q_(e,t){let n=e,r=n[n.length-1],i=Z_(r,t);return i===r?e:ea(e.slice(0,e.length-1),i)}function $_(e){return t=>t.encoding?G_(t,Q_(t.encoding,e)):t}function ev(e,t){return $_(e=>K_(e,t))(e)}function tv(e){function t(n){return n.encoding?G_(n,Q_(n.encoding,t)):e(n)}return Be(t)}function nv(e,t){return rv(e,t,gv(e))}function rv(e,t,n){let r=new Ig(e,t);return G_(n,n.encoding?[...n.encoding,r]:[r])}function iv(e,t){let n=Xm(e);return J_(e,{brands:n?[...n,t]:[t]})}function av(e,t){let n=!1,r=Array(e.length);for(let i=0;i<e.length;i++){let a=e[i],o=t(a);o!==a&&(n=!0),r[i]=o}return n?r:e}function ov(e,t){return K_(e,e.context?new Rg(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Rg(!1,!1,void 0,t))}var sv=$_(cv);function cv(e){return sv(K_(e,e.context?e.context.isOptional===!1?new Rg(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Rg(!0,!1)))}function lv(e,t){let n=[new Ig(Jg,new rg(Wh(t),Rh()))];return K_(e,e.context?new Rg(e.context.isOptional,e.context.isMutable,n,e.context.annotations):new Rg(!1,!1,n))}function uv(e,t,n){return rv(e,n,t)}function dv(e){let t=[],n=[];function r(e){switch(e._tag){case`Literal`:Je(e.literal)&&t.push(e.literal);return;case`UniqueSymbol`:t.push(e.symbol);return;case`Never`:return;case`Union`:for(let t=0;t<e.types.length;t++)r(e.types[t]);return;default:n.push(e)}}return r(e),{literals:t,parameters:n}}function fv(e,t,n){let{literals:r,parameters:i}=dv(e);return new v_(r.map(e=>new p_(e,t)),i.map(e=>new __(e,t,n)))}function pv(e){return e.context?.isOptional??!1}function mv(e){return e.annotations?.[`~structural`]===!0||e._tag===`FilterGroup`&&e.checks.every(mv)}function hv(e){function t(e){return mv(e)?[e]:e._tag===`FilterGroup`?e.checks.flatMap(t):[]}let n=e.flatMap(t);return ra(n)?n:void 0}var gv=Be(e=>{if(e.encoding)return gv(G_(e,void 0));let t=e,n=t.recur?.(gv)??t,r=n.encodingChecks;if(r){let t=n===e?r:Mg(n)||Ng(n)||Eg(n)&&n.typeParameters.length>0?hv(r):void 0;return W_(n,e=>{e.encodingChecks.value=void 0,e.checks.value=b_(n.checks,t)})}return n}),_v=Be(e=>gv(yv(e)));function vv(e,t){let n=t,r=n.length,i=n[r-1],a=[new Ig(yv(G_(e,void 0)),n[0].transformation.flip())];for(let e=1;e<r;e++)a.unshift(new Ig(yv(n[e-1].to),n[e].transformation.flip()));let o=yv(i.to);return o.encoding?G_(o,[...o.encoding,...a]):G_(o,a)}var yv=Be(e=>{if(e.encoding)return vv(e,e.encoding);let t=e;return t.flip?.(yv)??t.recur?.(yv)??t});function bv(e){switch(e._tag){case`Undefined`:return!0;case`Union`:return e.types.some(bv);default:return!1}}function xv(e,t){let n=af(t);return r=>r._tag===`None`?rf:r.value===t?n:ff(new mh(e,r))}function Sv(e){let t=af(e);return e=>e._tag===`None`?rf:t}function Cv(e,t){return n=>n._tag===`None`?rf:t(n.value)?M(n):ff(new mh(e,n))}function wv(e,t,n){if(n?.disableChecks||e.checks===void 0)return t;let r=[];return Rv(e.checks,t,r,e,n),r.length===0?t:void 0}function Tv(e,t,n){let r=e.map(e=>e._tag===`Literal`?globalThis.String(e.literal):void 0);if(r.some(e=>e!==void 0&&!t.includes(e)))return;let i=Array(e.length+1);i[e.length]=0;for(let t=e.length-1;t>=0;t--)i[t]=i[t+1]+(r[t]?.length??0);if(i[0]>t.length)return;let a=Array(e.length),o=e.map(()=>new Set);function s(c,l){if(c===e.length)return l===t.length;if(o[c].has(l))return!1;let u=e[c];if(c===e.length-1){let e=t.slice(l);if(u.matchPart(e,n)!==void 0)return a[c]=e,!0}else if(u._tag===`Literal`){let e=r[c];if(t.startsWith(e,l)&&s(c+1,l+e.length))return a[c]=e,!0}else{let e=t.length-i[c+1],o=r[c+1],d=o===void 0?e:t.lastIndexOf(o,e);for(;d>=l;){let e=t.slice(l,d);if(u.matchPart(e,n)!==void 0&&s(c+1,d))return a[c]=e,!0;if(d===0)break;d=o===void 0?d-1:t.lastIndexOf(o,d-1)}}return o[c].add(l),!1}return s(0,0)?a:void 0}var Ev=tv(e=>{switch(e._tag){default:return e;case`Number`:return e.toCodecStringTree();case`Union`:return e.recur(Ev)}}),Dv=tv(e=>{switch(e._tag){default:return e;case`Symbol`:case`UniqueSymbol`:return e.toCodecStringTree();case`Union`:return e.recur(Dv)}}),Ov=tv(e=>{switch(e._tag){default:return e;case`Number`:case`Literal`:case`BigInt`:return e.toCodecStringTree();case`Union`:return e.recur(Ov)}}),kv=new globalThis.RegExp(`^${d_}$`),Av=new globalThis.RegExp(`^(?:${d_}|Infinity|-Infinity|NaN)$`);function jv(e){return U_(kv,{expected:`a string representing a finite number`,representation:{id:`effect/schema/isStringFinite`,payload:null},toJsonSchema:()=>({pattern:kv.source}),...e})}var Mv=X_($g,[jv()]),Nv=new Ig(Mv,fg),Pv=new Ig(new j_([Mv,N_],`anyOf`),fg),Fv=new globalThis.RegExp(`^-?\\d+$`);function Iv(e){return U_(Fv,{expected:`a string representing a bigint`,representation:{id:`effect/schema/isStringBigInt`,payload:null},toJsonSchema:()=>({pattern:Fv.source}),...e})}var Lv=new Ig(X_($g,[Iv({expected:`a string representing a bigint`})]),pg);function Rv(e,t,n,r,i){for(let a=0;a<e.length;a++){let o=e[a];if(o._tag===`FilterGroup`)Rv(o.checks,t,n,r,i);else{let e=o.run(t,r,i);if(e&&(n.push(new ch(t,o,e)),o.aborted||i?.errors!==`all`))return}}}var zv=`~effect/Schema/Class`,Bv=Wm;function Vv(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&globalThis.Number.isFinite(e)}function ire(e){return e===void 0||typeof e==`string`}function Hv(e,t){let n=new WeakMap,r=[];outer:for(;;){if(typeof e!=`object`||!e){if(!t(e))return!1}else{let t=e,i=n.get(t);if(i===!1)return!1;if(i===void 0){let e=Array.isArray(t);if(!e){let e=Object.getPrototypeOf(t);if(e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null)return!1}n.set(t,!1),r.push({value:t,keys:e?t.length:Object.keys(t),index:0})}}for(;r.length>0;){let t=r[r.length-1],i=t.keys;if(typeof i==`number`){if(t.index<i){e=t.value[t.index++];continue outer}}else if(t.index<i.length){e=t.value[i[t.index++]];continue outer}n.set(t.value,!0),r.pop()}return!0}}function are(e){return Hv(e,Vv)}var Uv=new Vg([],()=>(e,t)=>are(e)?M(e):ff(new mh(t,Fr(e))),{representation:{id:`effect/schema/Json`,payload:null},expected:`JSON value`,toCodecJson:()=>void 0,toCodecStringTree:()=>Gv,toArbitrary:()=>e=>e.jsonValue()}),Wv=new Ig(Uv,dg()),ore=new Ig(new j_([new o_(!1,[],[Uv]),new v_([],[new __($g,Uv,void 0)])],`anyOf`),dg());function sre(e){return Hv(e,ire)}var Gv=new Ig(new Vg([],()=>(e,t)=>sre(e)?M(e):ff(new mh(t,Fr(e))),{expected:`StringTree`,toCodecStringTree:()=>void 0}),dg()),Kv=`~effect/SchemaError/SchemaError`,qv=class extends Au(`SchemaError`){[Kv]=Kv;constructor(e){super({issue:e})}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}};function Jv(e){return nt(e,Kv)&&e[Kv]===Kv}var Yv=Be(e=>{switch(e._tag){case`Declaration`:{let t=e.annotations?.[zv];return Ye(t)?G_(e,[Z_(t(e.typeParameters),Yv)]):e}case`Objects`:case`Arrays`:return e.recur(e=>{let t=e.context?.defaultValue;if(t){let n=Yv(e);return G_(n,n.encoding?[...n.encoding,...t]:t)}return Yv(e)});case`Suspend`:return e.recur(Yv);default:return e}});function Xv(e){let t=ny(Yv(gv(e.ast)));return(e,n)=>t(e,n?.disableChecks?n?.parseOptions?{...n.parseOptions,disableChecks:!0}:{disableChecks:!0}:n?.parseOptions)}function Zv(e){let t=Xv(e);return(e,n)=>{let r=Mp(t(e,n));return pl(r)?Fr(r.value):(Ph(r.cause,`Option adapter can only return none for schema issues`),Pr())}}function cre(e){let t=Xv(e);return(e,n)=>{let r=Mp(t(e,n));if(pl(r))return r.value;let i=Ph(r.cause,`Constructor adapter can only throw schema issues`);throw Error(i.toString(),{cause:i})}}function lre(e){return Qv(e.ast)}function Qv(e){let t=ry(ny(gv(e)));return e=>{let n=t(e,Lg);return pl(n)?!0:(Ph(n.cause,`Type guard adapter can only return false for schema issues`),!1)}}function $v(e,t){let n=ny(e.ast);return t===void 0?n:(e,r)=>n(e,ty(t,r))}function ure(e,t){return ry($v(e,t))}function dre(e,t){return fre($v(e,t))}function ey(e,t){let n=ny(yv(e.ast));return t===void 0?n:(e,r)=>n(e,ty(t,r))}var ty=(e,t)=>t===void 0?e:{...e,...t};function ny(e){let t=iy(e);return(e,n)=>Wp(t(Fr(e),n??Lg),e=>e._tag===`None`?ff(new hh(e)):M(e.value))}function ry(e){return(t,n)=>Mp(e(t,n))}function fre(e){let t=ry(e);return(e,n)=>{let r=t(e,n);return pl(r)?Fr(r.value):(Ph(r.cause,`Option adapter can only return none for schema issues`),Pr())}}function pre(e,t){return Af(e,e=>mf(()=>xu(e,t)))}var iy=Be(e=>{let t,n=e.checks,r=e.encoding,i=r,a=i?.length??0,o=e.encodingChecks,s=(n?n[n.length-1].annotations:e.annotations)?.parseOptions;return!e.context&&!r&&!n&&!o?(n,r)=>(t??=e.getParser(iy),s&&(r={...r,...s}),t(n,r)):(r,c)=>{s&&(c={...c,...s});let l;if(i){for(let e=a-1;e>=0;e--){let t=i[e],n=t.to,a=iy(n);if(l=l?Wp(l,e=>a(e,c)):a(r,c),t.transformation._tag===`Transformation`){let e=t.transformation.decode;l=Wp(l,t=>e.run(t,c))}else l=t.transformation.decode(l,c)}l=pre(l,t=>new lh(e,r,t))}t??=e.getParser(iy);let u=r=>{let i=t(r,c);return o&&!c?.disableChecks&&(i=Wp(i,t=>{if(Rr(r)&&Rr(t)){let t=[];if(Rv(o,r.value,t,e,c),ra(t))return ff(new ph(e,r,t))}return M(t)})),n&&!c?.disableChecks&&(i=Wp(i,t=>{if(Rr(t)){let r=t.value,i=[];if(Rv(n,r,i,e,c),ra(i))return ff(new ph(e,t,i))}return M(t)})),i};return l?Wp(l,u):u(r)}}),ay=`~effect/Schema/Schema`,mre={[ay]:ay,pipe(){return Oe(this,arguments)},annotate(e){return this.rebuild(J_(this.ast,e))},annotateKey(e){return this.rebuild(ov(this.ast,e))},check(...e){return this.rebuild(X_(this.ast,e))}};function oy(e,t){function n(){}let r=Object.defineProperties(Object.setPrototypeOf(n,mre),Object.getOwnPropertyDescriptors({...t}));r.ast=e,r.rebuild=e=>oy(e,t);let i=Xv(r);return r.makeEffect=(e,t)=>sy(i(e,t)),r.make=cre(r),r.makeOption=Zv(r),r}function sy(e){return Af(e,e=>mf(()=>xu(e,e=>new qv(e))))}var hre=e=>Object.keys(e),cy=j(2,(e,t)=>({...e,...t})),ly=e=>e,uy=j(2,(e,t)=>e===void 0?void 0:t(e)),dy=ay;function fy(){return(e,t,n)=>Ty(new Vg(e.map(S_),e=>t(e.map(e=>Ty(e))),n))}function py(e,t){return fy()([],()=>(t,n)=>e(t)?M(t):ff(new mh(n,Fr(t))),t)}function gre(e){return t=>t.annotate(e)}function my(e){return t=>Oy(Oy(t).annotate(e))}function hy(e){return t=>t.rebuild(ov(t.ast,e))}var gy=lre;function _y(e,t){let n=$v(e,t);return(e,t)=>sy(n(e,t))}var vy=_y;function _re(e,t){let n;for(let r of e.reasons){if(!fu(r)||!Jv(r.error))throw new globalThis.Error(t,{cause:e});n??=r.error}if(n===void 0)throw new globalThis.Error(t,{cause:e});return n}function yy(e){let t=Mp(e);if(pl(t))return t.value;throw _re(t.cause,`Sync adapter can only throw schema errors`)}function by(e,t){let n=ure(e,t);return(e,t)=>vre(n(e,t))}function vre(e){return pl(e)?ll(e.value):ul(xu(e.cause,e=>new qv(e)))}var yre=by,bre=dre;function xy(e,t){let n=_y(e,t);return(e,t)=>yy(n(e,t))}var Sy=xy;function Cy(e,t){let n=ey(e,t);return(e,t)=>sy(n(e,t))}var wy=Cy;function xre(e,t){let n=Cy(e,t);return(e,t)=>yy(n(e,t))}var Sre=xre,Ty=oy;function Ey(e){return nt(e,dy)&&e[dy]===dy}var P=ly(e=>Ty(cv(e.ast),{schema:e})),F=ly(e=>P(Vy(e))),Cre=ly(e=>Ty(_v(e.ast),{schema:e})),Dy=`~effect/Schema/flip`;function wre(e){return nt(e,Dy)&&e[Dy]===Dy}function Oy(e){return wre(e)?e.schema.rebuild(yv(e.ast)):Ty(yv(e.ast),{[Dy]:Dy,schema:e})}function I(e){let t=Ty(new Zg(e),{literal:e,transform(n){return t.pipe(Wy(I(n),{decode:Bh(()=>n),encode:Bh(()=>e)}))}});return t}function Tre(e){return new Xg(e.map(e=>Ey(e)?e.ast:new Zg(e)))}function ky(e){return Ty(Tre(e),{parts:e})}var Ay=Ty(qg),jy=Ty(Jg),Ere=Ty(Hg),My=Ty(Gg),L=Ty($g),Ny=Ty(r_),R=Ty(i_),Dre=Ty(a_),Py=Ty(Kg);function Fy(e,t){return Ty(e,{fields:t,mapFields(e,t){let n=e(this.fields);return Fy(x_(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function z(e){return Fy(x_(e,void 0),e)}function Iy(e,t,n){let r=n?.keyValueCombiner?.decode||n?.keyValueCombiner?.encode?new m_(n.keyValueCombiner.decode,n.keyValueCombiner.encode):void 0;return Ty(fv(e.ast,t.ast,r),{key:e,value:t})}function Ly(e,t){return Ty(e,{elements:t,mapElements(e,t){let n=e(this.elements);return Ly(C_(n,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function Ry(e){return Ly(C_(e),e)}var B=ly(e=>Ty(new o_(!1,[],[e.ast]),{value:e})),zy=ly(e=>Ty(new o_(!1,[e.ast],[e.ast]),{value:e}));function By(e,t){return Ty(e,{members:t,mapMembers(e,t){let n=e(this.members);return By(w_(n,this.ast.mode,t?.unsafePreserveChecks?this.ast.checks:void 0),n)}})}function V(e,t){return By(w_(e,t?.mode??`anyOf`,void 0),e)}function H(e){let t=e.map(I);return Ty(w_(t,`anyOf`,void 0),{literals:e,members:t,mapMembers(e){return V(e(this.members))},pick(e){return H(e)},transform(e){return V(t.map((t,n)=>t.transform(e[n])))}})}var U=ly(e=>V([e,Ere])),Vy=ly(e=>V([e,My]));function Hy(e){return Ty(new L_(()=>e().ast))}function Uy(e){return t=>Ty(iv(t.ast,e),{schema:t,identifier:e})}function Ore(e){return t=>Ty(nv(t.ast,new tg(e,je)),{schema:t})}function kre(e){return Are(e)}function Are(e){return t=>Ore(Gp(e))(t)}function Wy(e,t){return n=>Ty(uv(n.ast,e.ast,t?ag(t):dg()),{from:n,to:e})}function Gy(e){return t=>Ty(lv(t.ast,Ky(e)),{schema:t})}function Ky(e){return Af(e,e=>mf(()=>xu(e,e=>e.issue)))}function W(e,t){let n=t?.encodingStrategy===`omit`?Uh():Rh();return t=>F(Cre(t)).pipe(Wy(t,{decode:Wh(Ky(e)),encode:n}))}function qy(e){return I(e).pipe(Gy(M(e)))}function Jy(e,t){return z({_tag:qy(e),...t})}function Yy(e,t){return py(t=>t instanceof e,t)}function Xy(){return(e,t)=>new Ig(e.ast,ag(t))}var Zy=B_,Qy=`^\\S[\\s\\S]*\\S$|^\\S$|^$`;function $y(e){let t=new globalThis.RegExp(Qy);return Zy(e=>e.trim()===e,{expected:`a string with no leading or trailing whitespace`,representation:{id:`effect/schema/isTrimmed`,payload:null},toJsonSchema:()=>({pattern:t.source}),toCode:()=>({runtime:`Schema.isTrimmed()`}),arbitrary:{constraint:{patterns:[Qy]}},...e})}function eb(e,t){let n=e.source,r=e.flags,i=r===``?`new RegExp(${Ut(n)})`:`new RegExp(${Ut(n)}, ${Ut(r)})`;return U_(e,{toCode:()=>({runtime:`Schema.isPattern(${i})`}),...t})}var tb=Ty(H_);function jre(e){let t=kr(e.order),n=e.formatter??Ut;return(r,i)=>Zy(e=>t(e,r),{expected:`a value greater than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r,exclusiveMinimum:!0}}},...e.annotate?.(r),...i})}function Mre(e){let t=jr(e.order),n=e.formatter??Ut;return(r,i)=>Zy(e=>t(e,r),{expected:`a value greater than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:r}}},...e.annotate?.(r),...i})}function Nre(e){let t=Or(e.order),n=e.formatter??Ut;return(r,i)=>Zy(e=>t(e,r),{expected:`a value less than ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r,exclusiveMaximum:!0}}},...e.annotate?.(r),...i})}function Pre(e){let t=Ar(e.order),n=e.formatter??Ut;return(r,i)=>Zy(e=>t(e,r),{expected:`a value less than or equal to ${n(r)}`,arbitrary:{constraint:{ordered:{order:e.order,maximum:r}}},...e.annotate?.(r),...i})}function Fre(e){let t=jr(e.order),n=kr(e.order),r=Ar(e.order),i=Or(e.order),a=e.formatter??Ut;return(o,s)=>{let c=o.exclusiveMinimum?n:t,l=o.exclusiveMaximum?i:r;return Zy(e=>c(e,o.minimum)&&l(e,o.maximum),{expected:`a value between ${a(o.minimum)}${o.exclusiveMinimum?` (excluded)`:``} and ${a(o.maximum)}${o.exclusiveMaximum?` (excluded)`:``}`,arbitrary:{constraint:{ordered:{order:e.order,minimum:o.minimum,maximum:o.maximum,...o.exclusiveMinimum&&{exclusiveMinimum:!0},...o.exclusiveMaximum&&{exclusiveMaximum:!0}}}},...e.annotate?.(o),...s})}}function nb(e){if(!globalThis.Number.isFinite(e))throw new globalThis.RangeError(`Expected a finite number, got ${Ut(e)}`);return e}var rb=jre({order:xr,annotate:e=>({representation:{id:`effect/schema/isGreaterThan`,payload:{exclusiveMinimum:nb(e)}},toJsonSchema:()=>({exclusiveMinimum:e}),toCode:()=>({runtime:`Schema.isGreaterThan(${Ut(e)})`})})}),ib=Mre({order:xr,annotate:e=>({representation:{id:`effect/schema/isGreaterThanOrEqualTo`,payload:{minimum:nb(e)}},toJsonSchema:()=>({minimum:e}),toCode:()=>({runtime:`Schema.isGreaterThanOrEqualTo(${Ut(e)})`})})}),ab=Nre({order:xr,annotate:e=>({representation:{id:`effect/schema/isLessThan`,payload:{exclusiveMaximum:nb(e)}},toJsonSchema:()=>({exclusiveMaximum:e}),toCode:()=>({runtime:`Schema.isLessThan(${Ut(e)})`})})}),ob=Pre({order:xr,annotate:e=>({representation:{id:`effect/schema/isLessThanOrEqualTo`,payload:{maximum:nb(e)}},toJsonSchema:()=>({maximum:e}),toCode:()=>({runtime:`Schema.isLessThanOrEqualTo(${Ut(e)})`})})}),sb=Fre({order:xr,annotate:e=>{let t=e.exclusiveMinimum?!0:void 0,n=e.exclusiveMaximum?!0:void 0;return{representation:{id:`effect/schema/isBetween`,payload:{minimum:nb(e.minimum),maximum:nb(e.maximum),...t&&{exclusiveMinimum:t},...n&&{exclusiveMaximum:n}}},toJsonSchema:()=>({[t?`exclusiveMinimum`:`minimum`]:e.minimum,[n?`exclusiveMaximum`:`maximum`]:e.maximum}),toCode:()=>({runtime:`Schema.isBetween({ minimum: ${Ut(e.minimum)}, maximum: ${Ut(e.maximum)}, exclusiveMinimum: ${Ut(t)}, exclusiveMaximum: ${Ut(n)} })`})}}});function Ire(e){return Zy(e=>globalThis.Number.isSafeInteger(e),{expected:`an integer`,representation:{id:`effect/schema/isInt`,payload:null},toJsonSchema:()=>({type:`integer`}),toCode:()=>({runtime:`Schema.isInt()`}),arbitrary:{constraint:{integer:!0}},...e})}var cb=Ny.check(Ire());function lb(e,t){return e=Math.max(0,Math.floor(e)),Zy(t=>t.length>=e,{expected:`a value with a length of at least ${e}`,representation:{id:`effect/schema/isMinLength`,payload:{minLength:e}},toJsonSchema:({type:t})=>t===`array`?{minItems:e}:{minLength:e},toCode:()=>({runtime:`Schema.isMinLength(${e})`}),[Gm]:!0,arbitrary:{constraint:{minLength:e}},...t})}function ub(e){return lb(1,e)}function db(e,t){return e=Math.max(0,Math.floor(e)),Zy(t=>t.length<=e,{expected:`a value with a length of at most ${e}`,representation:{id:`effect/schema/isMaxLength`,payload:{maxLength:e}},toJsonSchema:({type:t})=>t===`array`?{maxItems:e}:{maxLength:e},toCode:()=>({runtime:`Schema.isMaxLength(${e})`}),[Gm]:!0,arbitrary:{constraint:{maxLength:e}},...t})}function Lre(e,t){return e=Math.max(0,Math.floor(e)),Zy(t=>Reflect.ownKeys(t).length<=e,{expected:`a value with at most ${e===1?`1 entry`:`${e} entries`}`,representation:{id:`effect/schema/isMaxProperties`,payload:{maxProperties:e}},toJsonSchema:()=>({maxProperties:e}),toCode:()=>({runtime:`Schema.isMaxProperties(${e})`}),[Gm]:!0,arbitrary:{constraint:{maxLength:e}},...t})}var fb=L.check(ub());function pb(e){return Ty(fy()([e],([e])=>(t,n,r)=>Ir(t)?Lr(t)?rf:Up($v(e)(t.value,r),{onSuccess:Fr,onFailure:e=>new ph(n,Fr(t),[new uh([`value`],e)])}):ff(new mh(n,Fr(t))),{representation:{id:`effect/schema/Option`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Option(${e[0].runtime})`,Type:`Option.Option<${e[0].Type}>`,importDeclarations:[`import * as Option from "effect/Option"`]}),expected:`Option`,toCodec:([e])=>Xy()(V([z({_tag:I(`Some`),value:e}),z({_tag:I(`None`)})]),sg({decode:e=>e._tag===`None`?Pr():Fr(e.value),encode:e=>Rr(e)?{_tag:`Some`,value:e.value}:{_tag:`None`}})),toArbitrary:([e])=>(t,n)=>{let r=t.constant(Pr());return wb(t,n,r,t.oneof(r,e.arbitrary.map(Fr)))},toEquivalence:([e])=>$r(e),toFormatter:([e])=>zr({onNone:()=>`none()`,onSome:t=>`some(${e(t)})`})}).ast,{value:e})}function mb(e,t){return Ty(fy()([e,t],([e,t])=>(n,r,i)=>{if(!du(n))return ff(new mh(r,Fr(n)));switch(n._tag){case`Fail`:return Up($v(e)(n.error,i),{onSuccess:_u,onFailure:e=>new ph(r,Fr(n),[new uh([`error`],e)])});case`Die`:return Up($v(t)(n.defect,i),{onSuccess:vu,onFailure:e=>new ph(r,Fr(n),[new uh([`defect`],e)])});case`Interrupt`:return M(n)}},{representation:{id:`effect/schema/CauseReason`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.CauseReason(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Failure<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause.Failure`,toCodec:([e,t])=>Xy()(V([z({_tag:I(`Fail`),error:e}),z({_tag:I(`Die`),defect:t}),z({_tag:I(`Interrupt`),fiberId:Vy(tb)})]),sg({decode:e=>{switch(e._tag){case`Fail`:return _u(e.error);case`Die`:return vu(e.defect);case`Interrupt`:return yu(e.fiberId)}},encode:je})),toArbitrary:([e,t])=>hb(e,t),toEquivalence:([e,t])=>gb(e,t),toFormatter:([e,t])=>_b(e,t)}).ast,{error:e,defect:t})}function hb(e,t){return(n,r)=>{let i=n.constant(yu());return wb(n,r,i,n.oneof(i,n.integer({min:1}).map(yu),e.arbitrary.map(e=>_u(e)),t.arbitrary.map(e=>vu(e))))}}function gb(e,t){return(n,r)=>{if(n._tag!==r._tag)return!1;switch(n._tag){case`Fail`:return e(n.error,r.error);case`Die`:return t(n.defect,r.defect);case`Interrupt`:return n.fiberId===r.fiberId}}}function _b(e,t){return n=>{switch(n._tag){case`Fail`:return`Fail(${e(n.error)})`;case`Die`:return`Die(${t(n.defect)})`;case`Interrupt`:return`Interrupt`}}}function vb(e,t){return Ty(fy()([e,t],([e,t])=>{let n=B(mb(e,t));return(e,t,r)=>uu(e)?Up($v(n)(e.reasons,r),{onSuccess:mu,onFailure:n=>new ph(t,Fr(e),[new uh([`failures`],n)])}):ff(new mh(t,Fr(e)))},{representation:{id:`effect/schema/Cause`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Cause(${e[0].runtime}, ${e[1].runtime})`,Type:`Cause.Cause<${e[0].Type}, ${e[1].Type}>`,importDeclarations:[`import * as Cause from "effect/Cause"`]}),expected:`Cause`,toCodec:([e,t])=>Xy()(B(mb(e,t)),sg({decode:mu,encode:({reasons:e})=>e})),toArbitrary:([e,t])=>yb(e,t),toEquivalence:([e,t])=>bb(e,t),toFormatter:([e,t])=>xb(e,t)}).ast,{error:e,defect:t})}function yb(e,t){return(n,r)=>{let i=hb(e,t)(n,r);return wb(n,r,n.constant(Pne),n.array(i.arbitrary).map(mu))}}function bb(e,t){let n=rr(gb(e,t));return(e,t)=>n(e.reasons,t.reasons)}function xb(e,t){let n=_b(e,t);return e=>`Cause([${e.reasons.map(n).join(`, `)}])`}var Rre=e=>e?.includeStack===!0|(e?.excludeCause===!0?2:0),zre=e=>{switch(e){case 0:return;case 1:return{includeStack:!0};case 2:return{excludeCause:!0};case 3:return{includeStack:!0,excludeCause:!0}}},Sb=[];function Cb(e){let t=Rre(e),n=Sb[t];if(n!==void 0)return n;let r=iie.pipe(Wy(jy,xg(zre(t))));return Sb[t]=r,r}function Bre(e,t,n){return Ty(fy()([e,t,n],([e,t,n])=>{let r=vb(t,n);return(t,n,i)=>{if(!cl(t))return ff(new mh(n,Fr(t)));switch(t._tag){case`Success`:return Up($v(e)(t.value,i),{onSuccess:ll,onFailure:e=>new ph(n,Fr(t),[new uh([`value`],e)])});case`Failure`:return Up($v(r)(t.cause,i),{onSuccess:ul,onFailure:e=>new ph(n,Fr(t),[new uh([`cause`],e)])})}}},{representation:{id:`effect/schema/Exit`,payload:null},toCode:({typeParameters:e})=>({runtime:`Schema.Exit(${e[0].runtime}, ${e[1].runtime}, ${e[2].runtime})`,Type:`Exit.Exit<${e[0].Type}, ${e[1].Type}, ${e[2].Type}>`,importDeclarations:[`import * as Exit from "effect/Exit"`]}),expected:`Exit`,toCodec:([e,t,n])=>Xy()(V([z({_tag:I(`Success`),value:e}),z({_tag:I(`Failure`),cause:vb(t,n)})]),sg({decode:e=>e._tag===`Success`?ll(e.value):ul(e.cause),encode:e=>pl(e)?{_tag:`Success`,value:e.value}:{_tag:`Failure`,cause:e.cause}})),toArbitrary:([e,t,n])=>(r,i)=>{let a=yb(t,n)(r,i);return wb(r,i,Vre(r,e.terminal?.map(e=>ll(e)),a.terminal?.map(e=>ul(e))),r.oneof(e.arbitrary.map(e=>ll(e)),a.arbitrary.map(e=>ul(e))))},toEquivalence:([e,t,n])=>{let r=bb(t,n);return(t,n)=>{if(t._tag!==n._tag)return!1;switch(t._tag){case`Success`:return e(t.value,n.value);case`Failure`:return r(t.cause,n.cause)}}},toFormatter:([e,t,n])=>{let r=xb(t,n);return t=>{switch(t._tag){case`Success`:return`Exit.Success(${e(t.value)})`;case`Failure`:return`Exit.Failure(${r(t.cause)})`}}}}).ast,{value:e,error:t,defect:n})}function Vre(e,t,n){return t===void 0?n:n===void 0?t:e.oneof(t,n)}function wb(e,t,n,r){return{arbitrary:n===void 0||t.recursion===void 0?r:e.oneof(t.recursion,n,r),terminal:n}}globalThis.RegExp,globalThis.URL;function Hre(e,t,n){let r={...t};if(e?.minimum!==void 0){let t=n===void 0?e.minimum:n(e.minimum),i=e.exclusiveMinimum?new globalThis.Date(t.getTime()+1):t;(r.min===void 0||i.getTime()>r.min.getTime())&&(r.min=i)}if(e?.maximum!==void 0){let t=n===void 0?e.maximum:n(e.maximum),i=e.exclusiveMaximum?new globalThis.Date(t.getTime()-1):t;(r.max===void 0||i.getTime()<r.max.getTime())&&(r.max=i)}return r}var Ure=py(Ti,{representation:{id:`effect/schema/Duration`,payload:null},toCode:()=>({runtime:`Schema.Duration`,Type:`Duration.Duration`,importDeclarations:[`import * as Duration from "effect/Duration"`]}),expected:`Duration`,toCodecJson:()=>Xy()(V([z({_tag:I(`Infinity`)}),z({_tag:I(`NegativeInfinity`)}),z({_tag:I(`Nanos`),value:Dre}),z({_tag:I(`Millis`),value:cb})]),sg({decode:e=>{switch(e._tag){case`Infinity`:return Di;case`NegativeInfinity`:return Oi;case`Nanos`:return ki(e.value);case`Millis`:return Ai(e.value)}},encode:e=>{switch(e.value._tag){case`Infinity`:return{_tag:`Infinity`};case`NegativeInfinity`:return{_tag:`NegativeInfinity`};case`Nanos`:return{_tag:`Nanos`,value:e.value.nanos};case`Millis`:return{_tag:`Millis`,value:e.value.millis}}}})),toArbitrary:()=>e=>e.oneof(e.constant(Di),e.constant(Oi),e.bigInt().map(ki),e.maxSafeInteger().map(Ai)),toFormatter:()=>globalThis.String,toEquivalence:()=>Ii}),Tb=Ny.pipe(Wy(Ure,mg)),Wre=L.annotate({expected:`a string that will be decoded as JSON`,contentMediaType:`application/json`}),Eb=Db(jy);function Db(e){return Wre.pipe(Wy(e,Cg))}globalThis.File,globalThis.FormData,globalThis.URLSearchParams;var Gre=L.annotate({expected:`a base64 encoded string that will be decoded as Uint8Array`,format:`byte`,contentEncoding:`base64`}),Ob=Yy(globalThis.Uint8Array,{representation:{id:`effect/schema/Uint8Array`,payload:null},toCode:()=>({runtime:`Schema.Uint8Array`,Type:`globalThis.Uint8Array`}),expected:`Uint8Array`,toCodecJson:()=>Xy()(Gre,Sg),toArbitrary:()=>e=>e.uint8Array()}),kb=py(e=>_m(e)&&vm(e),{representation:{id:`effect/schema/DateTimeUtc`,payload:null},toCode:()=>({runtime:`Schema.DateTimeUtc`,Type:`DateTime.Utc`,importDeclarations:[`import * as DateTime from "effect/DateTime"`]}),expected:`DateTime.Utc`,toCodecJson:()=>Xy()(L,wg),toArbitrary:()=>(e,t)=>e.date(Hre(t?.constraint?.ordered?.order===bm?t.constraint.ordered:void 0,{noInvalidDate:!0},Em)).map(e=>xm(e)),toFormatter:()=>e=>e.toString(),toEquivalence:()=>ym}),Kre=globalThis.Symbol.for(`immer-draftable`),Ab={};function jb(e,t,n,r,i){let a=Jre(n,t,r),o=Mb(t),s=class extends e{constructor(...[e,t]){let r=t?.[`~payload`],i=r?.token===Ab?r.value:n.make(e??{},t);super(i,{...t,disableChecks:!0,"~payload":{token:Ab,value:i}})}static[dy]=dy;get[o](){return o}static[Kre]=!0;static identifier=t;static fields=n.fields;static get ast(){return a(this).ast}static pipe(){return Oe(this,arguments)}static rebuild(e){return a(this).rebuild(e)}static make(e,t){return new this(e,t)}static makeOption(e,t){return Zv(a(this))(e??{},t)}static makeEffect(e,t){return a(this).makeEffect(e??{},t)}static annotate(e){return this.rebuild(J_(this.ast,e))}static annotateKey(e){return this.rebuild(ov(this.ast,e))}static check(...e){return this.rebuild(X_(this.ast,e))}static extend(e){return(t,r)=>{let a=Nb(t)?t:z(t),o={...n.fields,...a.fields},s=x_(o,n.ast.checks,{identifier:e});return jb(this,e,Fy(X_(s,a.ast.checks),o),r,i)}}static mapFields(e,t){return n.mapFields(e,t)}};return i!==void 0&&Object.assign(s.prototype,i(t)),s}function qre(e){return new rg(Bh(t=>new e(t)),Rh())}function Mb(e){return`~effect/Schema/Class/${e}`}function Jre(e,t,n){let r;return i=>{if(r!==void 0)return r;let a=qre(i);return r=Wy(Ty(new Vg([e.ast],()=>(e,n)=>e instanceof i||nt(e,Mb(t))?M(e):ff(new mh(n,Fr(e))),{identifier:t,[zv]:([e])=>new Ig(e,a),toCodec:([e])=>new Ig(e.ast,a),toArbitrary:([e])=>()=>({arbitrary:e.arbitrary.map(e=>new i(e)),terminal:e.terminal?.map(e=>new i(e))}),toFormatter:([e])=>t=>`${i.identifier}(${e(t)})`,[qm]:E_(e.ast),...n})),a)(e)}}function Nb(e){return Ey(e)}var Pb=e=>(t,n)=>jb(ku,e,Nb(t)?t:z(t),n,e=>({toString(){return`${e}(${Ut({...this})})`}})),Fb=e=>(t,n,r)=>{let i=Nb(n)?n.mapFields(e=>({_tag:qy(t),...e}),{unsafePreserveChecks:!0}):Jy(t,n);return Pb(e??t)(i,r)},Ib=e=>(t,n)=>jb(Hn,e,Nb(t)?t:z(t),n,e=>({name:e})),G=e=>(t,n,r)=>{let i=Nb(n)?n.mapFields(e=>({_tag:qy(t),...e}),{unsafePreserveChecks:!0}):Jy(t,n);return Ib(e??t)(i,r)};function Lb(e){return Ty(Rb(e.ast),{schema:e})}var Yre=tv(e=>{let t=Zre(e,Rb),n=e.context;return t===e||n===void 0?t:ev(t,zb(n))}),Rb=Be(e=>{let t=Jm(e),n=Yre(e);if(t===void 0||n.encoding===void 0)return n;let r=q_(n);if(Jm(r)!==void 0||Ym(r)===t)return n;let i=J_(r,{[Km]:t});return tv(()=>i)(n)});function zb(e){return e.defaultValue===void 0?e:new Rg(e.isOptional,e.isMutable,void 0,e.annotations)}function Bb(e){if(e.propertySignatures.some(e=>typeof e.name!=`string`))throw new globalThis.Error(`Objects property names must be strings`,{cause:e})}function Vb(e){return t=>{let n=new Map;for(let e=0;e<t.length;e++)n.set(_v(t[e]),e);let r=[...t].sort((t,r)=>{t=_v(t),r=_v(r);let i=e(t),a=e(r);return i===a?n.get(t)-n.get(r):i-a});return r.some((e,n)=>e!==t[n])?r:t}}var Xre=Vb(e=>{switch(e._tag){case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function Zre(e,t){switch(e._tag){case`Declaration`:{let n=e.annotations?.toCodecJson??e.annotations?.toCodec;if(!Ye(n))return G_(e,[Wv]);let r=n(e.typeParameters.map(e=>oy(_v(e))));return r===void 0?e:G_(e,[Z_(r,t)])}case`Unknown`:return G_(e,[Wv]);case`ObjectKeyword`:return G_(e,[ore]);case`Undefined`:case`Void`:case`Literal`:case`Number`:return e.toCodecJson();case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return Bb(e),e.recur(t,Dv);case`Union`:{let n=Xre(e.types);return n===e.types?e.recur(t):new j_(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}function Hb(e){return Ty(Ub(e.ast),{schema:e})}var Qre=Vb(e=>{switch(e._tag){case`Null`:case`Boolean`:case`Number`:case`BigInt`:case`Symbol`:case`UniqueSymbol`:return 0;default:return 1}});function $re(e,t,n){switch(e._tag){case`Declaration`:{let r=e.typeParameters.map(e=>Ty(t(_v(e)))),i=e.annotations?.toCodecStringTree;if(Ye(i)){let n=i(r);return n===void 0?e:G_(e,[Z_(n,t)])}let a=e.annotations?.toCodecJson,o=Ye(a)?a(r):void 0,s=o===void 0?e.annotations?.toCodec:void 0,c=o??(Ye(s)?s(r):void 0);return c===void 0?n(e):G_(e,[Z_(c,t)])}case`Null`:return G_(e,[eie]);case`Boolean`:return G_(e,[tie]);case`Unknown`:case`ObjectKeyword`:return G_(e,[Gv]);case`Enum`:case`Number`:case`Literal`:case`UniqueSymbol`:case`Symbol`:case`BigInt`:return e.toCodecStringTree();case`Objects`:return Bb(e),e.recur(t,Dv);case`Union`:{let n=Qre(e.types);return n===e.types?e.recur(t):new j_(n,e.mode,e.annotations,e.checks,e.encoding,e.context,e.encodingChecks).recur(t)}case`Arrays`:case`Suspend`:return e.recur(t)}return e}var eie=new Ig(new Zg(`null`),new rg(Bh(()=>null),Bh(()=>`null`))),tie=new Ig(new j_([new Zg(`true`),new Zg(`false`)],`anyOf`),new rg(Bh(e=>e===`true`),Gh())),nie=`~effect/Schema/SERIALIZER_ENSURE_ARRAY`,rie=e=>Pg(e)&&e.annotations?.[nie]===!0,Ub=tv(e=>{if(rie(e))return e;let t=$re(e,Ub,e=>{throw new globalThis.Error(`Missing structural codec for StringTree`,{cause:e})});return t!==e&&e.context!==void 0?ev(t,zb(e.context)):t}),iie=Ty(J_(Uv,{toCode:()=>({runtime:`Schema.Json`,Type:`Schema.Json`})}));function aie(e){return Um(e.ast)}function oie(e){return e.ast.context?.annotations}var Wb=L.pipe(Wy(L,og({decode:e=>M(e.trim()),encode:e=>M(e.trim())}))),K=Wb.check(ub()),q=cb.check(ib(0)),Gb=cb.check(ib(1)),Kb=cb.check(sb({minimum:1,maximum:65535})),J=L,qb=e=>K.pipe(Uy(e)),Y=qb(`ThreadId`),Jb=qb(`ProjectId`),Yb=qb(`TaskId`),Xb=qb(`EnvironmentId`),sie=qb(`AgentAssetId`),Zb=qb(`CommandId`),Qb=qb(`EventId`),$b=qb(`MessageId`),ex=qb(`TurnId`),tx=qb(`AuthSessionId`),nx=qb(`ProviderItemId`);qb(`RuntimeSessionId`);var cie=qb(`RuntimeItemId`),lie=qb(`RuntimeRequestId`),rx=qb(`RuntimeTaskId`),ix=qb(`ApprovalRequestId`),ax=qb(`CheckpointRef`),ox=go,sx=vo,uie=yo,cx=bo,die=So,lx=lo,ux=Gte,dx=Vc,fie=$te,fx=Symbol.for(`effect/MutableList/Empty`),px=()=>({head:void 0,tail:void 0,length:0}),mx=()=>({array:[],mutable:!0,offset:0,next:void 0}),hx=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=mx(),e.tail=e.tail.next):e.head=e.tail=mx(),e.tail.array.push(t),e.length++},pie=(e,t)=>{e.head={array:[t],mutable:!0,offset:0,next:e.head},e.length++},mie=(e,t)=>hie(e,Qi(t),!Array.isArray(t)),hie=(e,t,n=!1)=>{if(t.length===0)return 0;let r={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=r:e.head=e.tail=r,e.length+=t.length,t.length},gx=e=>{e.head=e.tail=void 0,e.length=0},_x=(e,t)=>{if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&e.head?.offset===0&&!e.head.next){let t=e.head.array;return gx(e),t}let n=Array(t),r=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[r++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,r===t)return e.head=i,e.length-=t,e.length===0&&gx(e),n;i=i.next}return gx(e),n},gie=e=>_x(e,e.length),vx=e=>{if(!e.head)return fx;let t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:gx(e)),t},_ie=(e,t)=>{let n=[],r=e.head;for(;r;){for(let e=r.offset;e<r.array.length;e++)t(r.array[e],e)&&n.push(r.array[e]);r=r.next}if(n.length===0){gx(e);return}e.head=e.tail={array:n,mutable:!0,offset:0,next:void 0},e.length=n.length},vie=(e,t)=>_ie(e,e=>e!==t),yx=`~effect/MutableRef`,yie={[yx]:yx,...un,toJSON(){return{_id:`MutableRef`,current:Jt(this.current)}}},bx=e=>{let t=Object.create(yie);return t.current=e,t},xx=j(2,(e,t)=>(e.current=t,e)),bie=`~effect/PubSub`,xie=`~effect/PubSub/Subscription`,Sie=e=>sf(()=>Iie(e.atomicPubSub(),new Map,Al(),dx(!1),bx(!1),e.strategy())),Cie=e=>Sie({atomicPubSub:()=>wie(e),strategy:()=>new Lie}),wie=e=>new Mie(e?.replay?new Bie(e.replay):void 0),Sx=j(2,(e,t)=>e.shutdownFlag.current?!1:e.pubsub.publish(t)?(e.strategy.completeSubscribersUnsafe(e.pubsub,e.subscribers),!0):!1),Tie=e=>sp(Wf(t=>{let n=di(t,Ol),r=Pl(e.scope),i=jie(e.pubsub,e.subscribers,e.strategy);return Nl(r,Eie(i)).pipe(yf(Ml(n,e=>Fl(r,e))),wf(i))})),Eie=e=>sp(gf(t=>(xx(e.shutdownFlag,!0),$d(gie(e.pollers),e=>xl(e,t.id),{discard:!0,concurrency:`unbounded`}).pipe(bf(()=>sf(()=>{e.subscribers.delete(e.subscription),e.subscription.unsubscribe(),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers)})),ere(e.shutdownHook.open),Ef)))),Die=e=>of(function t(n){if(e.shutdownFlag.current)return ip;let r=e.pollers.length===0?e.subscription.pollUpTo(1/0):[];return n&&(r=n.concat(r)),e.strategy.onPubSubEmptySpaceUnsafe(e.pubsub,e.subscribers),e.replayWindow.remaining>0?M(e.replayWindow.takeAll().concat(r)):ra(r)?M(r):_f(Oie(e),e=>t([e]))}),Oie=e=>{let t=hl(),n=e.subscribers.get(e.subscription);return n||(n=new Set,e.subscribers.set(e.subscription,n)),n.add(e.pollers),hx(e.pollers,t),e.strategy.completePollersUnsafe(e.pubsub,e.subscribers,e.subscription,e.pollers),op(_l(t),()=>(vie(e.pollers,t),cf))},Cx=Symbol.for(`effect/PubSub/AbsentValue`),kie=(e,t,n)=>{e.has(t)||e.set(t,new Set),e.get(t).add(n)},Aie=(e,t,n)=>{if(!e.has(t))return;let r=e.get(t);r.delete(n),r.size===0&&e.delete(t)},jie=(e,t,n)=>new Pie(e,t,e.subscribe(),px(),dx(!1),bx(!1),n,e.replayWindow()),Mie=class{publisherHead={value:Cx,subscribers:0,next:null};publisherTail=this.publisherHead;publisherIndex=0;subscribersIndex=0;capacity=2**53-1;replayBuffer;constructor(e){this.replayBuffer=e}replayWindow(){return this.replayBuffer?new Vie(this.replayBuffer):Hie}isEmpty(){return this.publisherHead===this.publisherTail}isFull(){return!1}size(){return this.publisherIndex-this.subscribersIndex}publish(e){let t=this.publisherTail.subscribers;return t!==0&&(this.publisherTail.next={value:e,subscribers:t,next:null},this.publisherTail=this.publisherTail.next,this.publisherIndex+=1),this.replayBuffer&&this.replayBuffer.offer(e),!0}publishAll(e){if(this.publisherTail.subscribers!==0)for(let t of e)this.publish(t);else this.replayBuffer&&this.replayBuffer.offerAll(e);return[]}slide(){this.publisherHead!==this.publisherTail&&(this.publisherHead=this.publisherHead.next,this.publisherHead.value=Cx,this.subscribersIndex+=1),this.replayBuffer&&this.replayBuffer.slide()}subscribe(){return this.publisherTail.subscribers+=1,new Nie(this,this.publisherTail,this.publisherIndex,!1)}},Nie=class{self;subscriberHead;subscriberIndex;unsubscribed;constructor(e,t,n,r){this.self=e,this.subscriberHead=t,this.subscriberIndex=n,this.unsubscribed=r}isEmpty(){if(this.unsubscribed)return!0;let e=!0,t=!0;for(;t;)this.subscriberHead===this.self.publisherTail?t=!1:this.subscriberHead.next.value===Cx?(this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1):(e=!1,t=!1);return e}size(){return this.unsubscribed?0:this.self.publisherIndex-Math.max(this.subscriberIndex,this.self.subscribersIndex)}poll(){if(this.unsubscribed)return fx;let e=!0,t=fx;for(;e;)if(this.subscriberHead===this.self.publisherTail)e=!1;else{let n=this.subscriberHead.next.value;n!==Cx&&(t=n,--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Cx,this.self.subscribersIndex+=1),e=!1),this.subscriberHead=this.subscriberHead.next,this.subscriberIndex+=1}return t}pollUpTo(e){let t=[],n=0;for(;n!==e;){let r=this.poll();r===fx?n=e:(t.push(r),n+=1)}return t}unsubscribe(){if(!this.unsubscribed)for(this.unsubscribed=!0,--this.self.publisherTail.subscribers;this.subscriberHead!==this.self.publisherTail;)this.subscriberHead.next.value!==Cx&&(--this.subscriberHead.subscribers,this.subscriberHead.subscribers===0&&(this.self.publisherHead=this.self.publisherHead.next,this.self.publisherHead.value=Cx,this.self.subscribersIndex+=1)),this.subscriberHead=this.subscriberHead.next}},Pie=class{[xie]={_A:je};pubsub;subscribers;subscription;pollers;shutdownHook;shutdownFlag;strategy;replayWindow;constructor(e,t,n,r,i,a,o,s){this.pubsub=e,this.subscribers=t,this.subscription=n,this.pollers=r,this.shutdownHook=i,this.shutdownFlag=a,this.strategy=o,this.replayWindow=s}pipe(){return Oe(this,arguments)}},Fie=class{[bie]={_A:je};pubsub;subscribers;scope;shutdownHook;shutdownFlag;strategy;constructor(e,t,n,r,i,a){this.pubsub=e,this.subscribers=t,this.scope=n,this.shutdownHook=r,this.shutdownFlag=i,this.strategy=a}pipe(){return Oe(this,arguments)}},Iie=(e,t,n,r,i,a)=>new Fie(e,t,n,r,i,a),Lie=class{get shutdown(){return cf}handleSurplus(e,t,n,r){return M(!1)}onPubSubEmptySpaceUnsafe(e,t){}completePollersUnsafe(e,t,n,r){return Rie(this,e,t,n,r)}completeSubscribersUnsafe(e,t){return zie(this,e,t)}},Rie=(e,t,n,r,i)=>{let a=!0;for(;a&&!r.isEmpty();){let o=vx(i);if(o===fx)Aie(n,r,i),i.length===0?a=!1:kie(n,r,i);else{let a=r.poll();a===fx?pie(i,o):(Tl(o,ll(a)),e.onPubSubEmptySpaceUnsafe(t,n))}}},zie=(e,t,n)=>{for(let[r,i]of n)for(let a of i)e.completePollersUnsafe(t,n,r,a)},Bie=class{capacity;head={value:Cx,next:null};tail=this.head;size=0;index=0;constructor(e){this.capacity=e}slide(){this.index++}offer(e){this.tail.value=e,this.tail.next={value:Cx,next:null},this.tail=this.tail.next,this.size===this.capacity?this.head=this.head.next:this.size+=1}offerAll(e){for(let t of e)this.offer(t)}},Vie=class{head;index;remaining;buffer;constructor(e){this.buffer=e,this.index=e.index,this.remaining=e.size,this.head=e.head}fastForward(){for(;this.index<this.buffer.index;)this.head=this.head.next,this.index++}take(){if(this.remaining===0)return;this.index<this.buffer.index&&this.fastForward(),this.remaining--;let e=this.head.value;return this.head=this.head.next,e}takeN(e){if(this.remaining===0)return[];this.index<this.buffer.index&&this.fastForward();let t=Math.min(e,this.remaining),n=Array(t);for(let e=0;e<t;e++){let t=this.head.value;this.head=this.head.next,n[e]=t}return this.remaining-=t,n}takeAll(){return this.takeN(this.remaining)}},Hie={remaining:0,take:()=>void 0,takeN:()=>[],takeAll:()=>[]},Uie=`~effect/Queue`,Wie=`~effect/Queue/Enqueue`,Gie=`~effect/Queue/Dequeue`,wx={_A:je,_E:je},Kie={[Uie]:wx,[Wie]:wx,[Gie]:wx,...un,toJSON(){return{_id:`effect/Queue`,state:this.state._tag,size:Zie(this)}}},Tx=e=>Vn(t=>{let n=Object.create(Kie);return n.dispatcher=t.currentDispatcher,n.capacity=e?.capacity??1/0,n.strategy=e?.strategy??`suspend`,n.messages=px(),n.scheduleRunning=!1,n.state={_tag:`Open`,takers:new Set,offers:new Set,awaiters:new Set},Co(n)}),Ex=e=>Tx({capacity:e}),Dx=e=>Tx({capacity:e,strategy:`sliding`}),qie=()=>Tx(),Ox=(e,t)=>Do(()=>{if(e.state._tag!==`Open`)return Lx;if(e.messages.length>=e.capacity)switch(e.strategy){case`dropping`:return Lx;case`suspend`:return e.capacity<=0&&e.state.takers.size>0?(hx(e.messages,t),zx(e),Rx):tae(e,t);case`sliding`:return vx(e.messages),hx(e.messages,t),Rx}return hx(e.messages,t),Bx(e),Rx}),kx=(e,t)=>e.state._tag===`Open`?e.messages.length>=e.capacity?e.strategy===`sliding`?(vx(e.messages),hx(e.messages,t),!0):e.capacity<=0&&e.state.takers.size>0?(hx(e.messages,t),zx(e),!0):!1:(hx(e.messages,t),Bx(e),!0):!1,Jie=(e,t)=>Do(()=>{if(e.state._tag!==`Open`)return Co(Qi(t));let n=Yie(e,t);return n.length===0?Fn([]):e.strategy===`dropping`?Co(n):nae(e,n)}),Yie=(e,t)=>{if(e.state._tag!==`Open`)return Qi(t);if(e.capacity===1/0||e.strategy===`sliding`)return mie(e.messages,t),e.strategy===`sliding`&&_x(e.messages,e.messages.length-e.capacity),Bx(e),[];let n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return Qi(t);let r=[],i=0;for(let a of t)i<n?hx(e.messages,a):r.push(a),i++;return Bx(e),r},Ax=j(2,(e,t)=>Eo(()=>jx(e,t))),jx=(e,t)=>{if(e.state._tag!==`Open`)return!1;let n=ws(Rn(t),Qie);return e.state.offers.size===0&&e.messages.length===0?(Ux(e,n),!0):(e.state={...e.state,_tag:`Closing`,exit:n},!0)},Mx=e=>Ax(e,Tn(Jn())),Nx=e=>Eo(()=>{if(e.state._tag===`Done`)return!0;gx(e.messages);let t=e.state.offers;if(Ux(e,e.state._tag===`Open`?$ie:e.state.exit),t.size>0){for(let e of t)e._tag===`Single`?e.resume(Lx):e.resume(Fn(e.remaining.slice(e.offset)));t.clear()}return!0}),Px=e=>Fx(e,1,1/0),Fx=(e,t,n)=>Do(()=>eae(e,t,n)??ts(Hx(e),Fx(e,1,n))),Ix=e=>Do(()=>Xie(e)??ts(Hx(e),Ix(e))),Xie=e=>{if(e.state._tag===`Done`)return e.state.exit;if(e.messages.length>0){let t=vx(e.messages);return Vx(e),Fn(t)}else if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Vx(e),e.capacity=0;let t=vx(e.messages);return Vx(e),Fn(t)}},Zie=e=>e.state._tag===`Done`?0:e.messages.length,Lx=Fn(!1),Rx=Fn(!0),Qie=zn(Jn()),$ie=gs(),zx=e=>{if(e.scheduleRunning=!1,!(e.state._tag===`Done`||e.state.takers.size===0)){for(let t of e.state.takers)if(e.state.takers.delete(t),t(bs),e.messages.length===0)break}},Bx=e=>{e.scheduleRunning||e.state._tag===`Done`||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>zx(e),0))},eae=(e,t,n)=>{if(e.state._tag===`Done`)return e.state.exit;if(n<=0||t<=0)return Fn([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,Vx(e),e.capacity=0;let t=[vx(e.messages)];return Vx(e),Fn(t)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){let t=_x(e.messages,n);return Vx(e),Fn(t)}},tae=(e,t)=>Ho(n=>{if(e.state._tag!==`Open`)return n(Lx);let r={_tag:`Single`,message:t,resume:n};return e.state.offers.add(r),Eo(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),nae=(e,t)=>Ho(n=>{if(e.state._tag!==`Open`)return n(Fn(t));let r={_tag:`Array`,remaining:t,offset:0,resume:n};return e.state.offers.add(r),Eo(()=>{e.state._tag===`Open`&&e.state.offers.delete(r)})}),Vx=e=>{if(e.state._tag===`Done`)return xd(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag===`Closing`&&e.messages.length===0?(Ux(e,e.state.exit),xd(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(let n of e.state.offers)if(t===0)break;else if(n._tag===`Single`)hx(e.messages,n.message),t--,n.resume(Rx),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;hx(e.messages,n.remaining[n.offset]),t--}n.resume(Fn([])),e.state.offers.delete(n)}return!1},Hx=e=>Ho(t=>e.state._tag===`Done`?t(e.state.exit):(e.state.takers.add(t),Eo(()=>{e.state._tag!==`Done`&&e.state.takers.delete(t)}))),Ux=(e,t)=>{if(e.state._tag===`Done`)return;let n=e.state;e.state={_tag:`Done`,exit:t};for(let e of n.takers)e(t);n.takers.clear();for(let e of n.awaiters)e(t);n.awaiters.clear()},Wx=e=>new Gx(e),Gx=class{waiters=new Set;taken=0;permits;constructor(e){this.permits=e}get free(){return this.permits-this.taken}take(e){let t=Do(()=>this.free<e?Ho(n=>{if(this.free>=e)return n(t);let r=()=>{this.free<e||(this.waiters.delete(r),n(t))};return this.waiters.add(r),Eo(()=>{this.waiters.delete(r)})}):(this.taken+=e,Co(e)));return t}updateTakenUnsafe(e,t){return this.taken=t(this.taken),this.waiters.size>0&&e.currentDispatcher.scheduleTask(()=>{let e=this.waiters.values(),t=e.next();for(;t.done===!1&&this.free>0;)t.value(),t=e.next()},0),this.free}updateTaken(e){return Vn(t=>Co(this.updateTakenUnsafe(t,e)))}resize(e){return Vn(t=>(this.permits=e,this.free<0||this.updateTakenUnsafe(t,e=>e),Fo))}release(e){return this.updateTaken(t=>t-e)}get releaseAll(){return this.updateTaken(e=>0)}withPermits(e){return t=>Tc(n=>os(n(this.take(e)),e=>yc(n(t),()=>{this.updateTakenUnsafe(lo(),t=>t-e)},!0)))}withPermit=this.withPermits(1);withPermitsIfAvailable(e){return t=>Tc(n=>this.free<e?jo:(this.taken+=e,yc(n(es(t)),()=>{this.updateTakenUnsafe(lo(),t=>t-e)},!0)))}},Kx=e=>Eo(()=>new Gx(e)),qx=`~effect/Channel`,Jx=e=>nt(e,qx),rae={[qx]:{_Env:je,_InErr:je,_InElem:je,_OutErr:je,_OutElem:je},pipe(){return Oe(this,arguments)}},Yx=e=>{let t=Object.create(rae);return t.transform=(t,n)=>Af(e(t,n),e=>M(pf(e))),t},Xx=(e,t)=>Yx((n,r)=>_f($x(e)(n,r),e=>t(e,r))),Zx=e=>Yx((t,n)=>e),Qx=e=>Yx(Pp(function*(t,n){let r=Pl(n),i=e=>Fl(r,Td(e));return tp(yield*tp(e(t,n,r),i),i)})),$x=e=>e.transform,iae=(e,t,n)=>Tx({capacity:n?.bufferSize,strategy:n?.strategy}).pipe(bf(t=>Nl(e,Nx(t))),bf(n=>yp(jl(t(n),e),e))),aae=(e,t)=>Yx((n,r)=>Cf(iae(r,e,t),Px)),eS=e=>Yx((t,n)=>of(()=>$x(e())(t,n))),oae=(e,t,n)=>Qx(Pp(function*(r,i,a){let o=Pr();yield*Ml(a,e=>Rr(o)?n(o.value,e):cf);let s=yield*sp(e);return o=Fr(s),yield*$x(t(s))(r,i)})),sae=e=>rS(M(e)),cae=Zx(M(Ou())),lae=Zx(M(uf)),tS=e=>Zx(M(ff(e))),nS=e=>Zx(pf(e)),rS=e=>Zx(sf(()=>{let t=!1;return of(()=>t?Ou():(t=!0,e))})),uae=e=>Zx(M(Px(e))),dae=e=>Zx(M(op(Die(e),()=>Ou()))),fae=e=>xS(Cf(Tie(e),dae)),iS=j(2,(e,t)=>Xx(e,e=>sf(()=>{let n=0;return Cf(e,e=>t(e,n++))}))),aS=e=>e===void 0||e!==`unbounded`&&e<=1,oS=j(e=>Jx(e[0]),(e,t,n)=>aS(n?.concurrency)?sS(e,t):cS(e,t,n)),sS=(e,t)=>Yx((n,r)=>{let i=0;return Cf($x(e)(n,r),_f(e=>t(e,i++)))}),cS=(e,t,n)=>Qx(Pp(function*(r,i,a){let o=0,s=yield*$x(e)(r,i),c=n.concurrency===`unbounded`?2**53-1:n.concurrency,l=yield*Ex(0);yield*Nl(a,Nx(l));let u=Cp(yield*Uf()),d=ux(a);if(n.unordered){let e=Wx(c),n=Me(e.release(1)),r=Hf({onFailure:e=>_f(Ax(l,e),n),onSuccess:e=>_f(Ox(l,e),n)});yield*e.take(1).pipe(_f(()=>s),_f(e=>(d(u(r(t(e,o++)))),cf)),lp({disableYield:!0}),Af(t=>e.withPermits(c-1)(Ax(l,t))),yp(a))}else{let e=yield*Ex(c-2);yield*Nl(a,Nx(l)),yield*Ix(e).pipe(vf,_f(e=>Ox(l,e)),lp({disableYield:!0}),Af(e=>Ax(l,e)),yp(a));let n,r=e=>{e._tag!==`Success`&&(n=e.cause,jx(l,e.cause))};yield*s.pipe(_f(i=>{if(n)return pf(n);let a=u(t(i,o++));return d(a),a.addObserver(r),Ox(e,sx(a))}),lp({disableYield:!0}),Af(t=>Ox(e,ul(t)).pipe(yf(Ax(e,t)))),yp(a))}return Ix(l)})),lS=j(e=>Jx(e[0]),(e,t,n)=>aS(n?.concurrency)?uS(e,t):dS(e,t,n)),uS=(e,t)=>Yx((n,r)=>Cf($x(e)(n,r),e=>{let i,a,o=_f(e,e=>(a??=Pl(r),Wp($x(t(e))(n,a),e=>(i=s(e),i)))),s=bd(e=>{if(i=void 0,a.state._tag===`Open`&&a.state.finalizers.size===1)return o;let t=Fl(a,fl);return a=void 0,_f(t,()=>o)});return of(()=>i??o)})),dS=(e,t,n)=>e.pipe(iS(t),vS(n)),fS=e=>Xx(e,e=>{let t,n=0;return M(of(function r(){if(t===void 0)return _f(e,e=>{switch(e.length){case 0:return r();case 1:return M(e[0]);default:return t=e,M(e[n++])}});let i=t[n++];return n>=t.length&&(t=void 0,n=0),M(i)}))}),pS=e=>Xx(e,e=>M(lp(e,{disableYield:!0}))),mS=j(2,(e,t)=>Xx(e,e=>M(_f(e,function n(r){let i=[];for(let e=0;e<r.length;e++)t(r[e])&&i.push(r[e]);return ia(i)?M(i):_f(e,n)})))),hS=j(2,(e,t)=>Xx(e,e=>M(_f(e,function n(r){let i=[];for(let e=0;e<r.length;e++){let n=t(r[e]);qi(n)&&i.push(n.success)}return ia(i)?M(i):_f(e,n)})))),gS=j(e=>Jx(e[0]),(e,t,n,r)=>Yx((i,a)=>Cf($x(e)(i,a),e=>{let i=t(),a,o=0,s,c=Hf(e,{onFailure(e){s=e;let t=r?.onHalt&&r.onHalt(i);return t&&t.length>0?M([i,t]):pf(e)},onSuccess(e){let t=n(i,e);return na(t)?M(t):t}});return of(function e(){if(a===void 0)return s?pf(s):_f(c,([t,n])=>(i=t,n.length===0?e():n.length===1?M(n[0]):(a=n,e())));let t=a[o++];return o>=a.length&&(a=void 0,o=0),M(t)})}))),_S=j(2,(e,t)=>Yx((n,r)=>{let i=Pl(r);return Cf($x(e)(n,i),e=>{let a=e.pipe(Af(e=>{if(xd(e))return pf(e);let o=i;return i=Pl(r),Fl(o,ul(e)).pipe(yf($x(t(e))(n,i)),_f(e=>(a=e,e)))}));return of(()=>a)})})),pae=j(3,(e,t,n)=>_S(e,e=>{let r=t(e);return Ki(r)?nS(r.failure):n(r.success,e)})),mae=j(2,(e,t)=>pae(e,Cu,e=>t(e))),hae=j(2,(e,t)=>eS(()=>{let n,r=Od.defaultValue(),i=CS(OS(e,Od,sf(()=>r)),()=>(n=void 0,cf)),a=typeof t==`function`?t(je):t,o=mae(i,Pp(function*(e){return n||=yield*Fd(a),r=yield*n(e),o},(e,t)=>bd(e,()=>M(tS(t))),xS));return o})),gae=j(e=>Jx(e[0]),(e,t,n)=>e.pipe(iS(t),vS({...n,concurrency:n?.concurrency??1,switch:!0}))),vS=j(2,(e,{bufferSize:t=16,concurrency:n,switch:r=!1})=>Qx(Pp(function*(i,a,o){let s=n===`unbounded`?2**53-1:Math.max(1,n),c=r?void 0:Wx(s),l=yield*fie(!0),u=new Set,d=yield*Ex(t);yield*Nl(o,Nx(d));let f=yield*$x(e)(i,a);return yield*df(function*(){for(;;){let e;c&&(u.size<s?yield*c.take(1):(e=yield*vp(f),yield*Vf(c.take(1),yf(sx(e),uf))));let t=e===void 0?yield*f:yield*sx(e),n=Pl(o),r=yield*$x(t)(i,n);for(;u.size>=s;){let e=Ji(u);u.delete(e),u.size===0&&(yield*l.open),yield*cx(e)}let a=yield*r.pipe(bf(()=>Jne),_f(e=>Ox(d,e)),lp({disableYield:!0}),tp(Pp(function*(e){let t=Cd(e);if(yield*Sf(Fl(n,Ki(t)?ul(t.failure):ll(t.success.value))),u.has(a)&&(u.delete(a),c&&(yield*c.release(1)),u.size===0&&(yield*l.open),!qi(t)))return yield*Ax(d,e)})),vp);l.closeUnsafe(),u.add(a)}}).pipe(Af(e=>qi(Cd(e))?l.whenOpen(Ax(d,e)):Ax(d,e)),yp(o)),Ix(d)}))),yS=j(e=>Jx(e[0])&&Jx(e[1]),(e,t,n)=>Qx(Pp(function*(r,i,a){let o=n?.haltStrategy??`both`,s=yield*Ex(0);yield*Nl(a,Nx(s));let c=0;function l(e,t){if(c++,!xd(t))return Ax(s,t);switch(o){case`both`:return c===2?Ax(s,t):cf;case`left`:case`right`:return e===o?Ax(s,t):cf;case`either`:return Ax(s,t)}}let u=(e,t,n)=>$x(t)(r,n).pipe(_f(e=>e.pipe(_f(e=>Ox(s,e)),lp)),tp(t=>yf(Fl(n,Td(t)),l(e,t))),yp(a));return yield*u(`left`,e,Pl(a)),yield*u(`right`,t,Pl(a)),Ix(s)}))),bS=j(2,(e,t)=>Yx((n,r)=>_f($x(e)(n,r),e=>$x(t)(e,r)))),xS=e=>Yx((t,n)=>{let r;return M(of(()=>r||e.pipe(jl(n),_f(e=>$x(e)(t,n)),_f(e=>r=e))))}),SS=j(2,(e,t)=>Qx((n,r,i)=>Ml(i,t).pipe(yf($x(e)(n,r))))),CS=j(2,(e,t)=>Xx(e,e=>sf(()=>{let n=!0,r=bf(e,e=>(n=!1,t(e)));return of(()=>n?r:e)}))),wS=j(2,(e,t)=>SS(e,e=>t)),TS=(e,t,n)=>of(()=>{let r=Al();return bd(_f($x(e)(Ou(),r),t),n||M).pipe(np(e=>Fl(r,e)))}),ES=j(2,(e,t)=>Yx((n,r)=>Cf(Kf($x(e)(n,r),t),Kf(t)))),DS=j(3,(e,t,n)=>Yx((r,i)=>Cf(Yf($x(e)(r,i),t,n),Yf(t,n)))),OS=j(3,(e,t,n)=>Yx((r,i)=>_f(n,n=>$x(DS(e,t,n))(r,i)))),kS=function(){let e=Jx(arguments[0]),t=e?arguments[1]:arguments[0],n=za(e?arguments[2]:arguments[1]);if(e){let e=arguments[0];return AS(e,t,n)}return e=>AS(e,t,n)},AS=(e,t,n)=>oae(pp(t,n),t=>DS(e,Oa,t),(e,t)=>gf(n=>Gc(e,t,n.getRef(Yc),n.getRef(Ane)))),jS=j(2,(e,t)=>TS(e,e=>lp(_f(e,t),{disableYield:!0}))),MS=e=>of(()=>{let t=Pr();return TS(e,e=>e.pipe(Tf,_f(e=>(t=e,Ou()))),()=>M(t))}),NS=Pp(function*(e){let t=Wx(1),n=yield*Uf(),r=di(n,Ol);return(yield*$x(e)(Ou(),r)).pipe(Kf(n),t.withPermits(1))},Af(e=>M(pf(e)))),PS=(e,t)=>$x(e)(Ou(),t),FS=`~effect/Stream`,IS={_R:je,_E:je,_A:je},LS={[FS]:IS,pipe(){return Oe(this,arguments)}},RS=e=>{let t=Object.create(LS);return t.channel=e,t},zS=`~effect/collections/MutableHashMap`,BS={[zS]:zS,[Symbol.iterator](){return this.backing[Symbol.iterator]()},toString(){return`MutableHashMap(${Ut(Array.from(this))})`},toJSON(){return{_id:`MutableHashMap`,values:Jt(Array.from(this))}},[qt](){return this.toJSON()},pipe(){return Oe(this,arguments)}},VS=()=>{let e=Object.create(BS);return e.backing=new Map,e.buckets=new Map,e},HS=j(2,(e,t)=>{if(e.backing.has(t))return Fr(e.backing.get(t));if(WS(t))return Pr();let n=US.get(e);if(n!==void 0)return e.backing.has(n)?Fr(e.backing.get(n)):Pr();let r=st(t),i=e.buckets.get(r);return i===void 0?Pr():GS(e,i,t)}),US=new WeakMap,WS=e=>typeof e!=`object`&&typeof e!=`function`,GS=(e,t,n)=>{for(let r=0,i=t.length;r<i;r++)if(wt(n,t[r])){let i=t[r];return US.set(n,i),Fr(e.backing.get(i))}return Pr()},KS=j(3,(e,t,n)=>{if(e.backing.has(t)||WS(t))return e.backing.set(t,n),e;let r=US.get(e);if(r!==void 0&&e.backing.has(r))return e.backing.set(r,n),e;let i=st(t),a=e.buckets.get(i);return a===void 0?(e.buckets.set(i,[t]),e.backing.set(t,n),e):(r=qS(a,t),r===void 0&&(a.push(t),r=t),e.backing.set(r,n),e)}),qS=(e,t)=>{for(let n=0,r=e.length;n<r;n++)if(wt(t,e[n]))return US.set(t,e[n]),e[n]},JS=j(2,(e,t)=>{if(WS(t))return e.backing.delete(t),e;let n=US.get(e)??t,r=st(n),i=e.buckets.get(r);if(i===void 0)return e;for(let t=0,r=i.length;t<r;t++){let r=i[t];if(r===n||wt(n,r)){e.backing.delete(r),i.splice(t,1);break}}return i.length===0&&e.buckets.delete(r),e}),_ae=`~effect/Stream`,YS=e=>nt(e,_ae),XS=RS,ZS=e=>XS(rS(Cf(e,ma))),vae=e=>yae(sf(()=>{let t=!0,n=M(ma(void 0)),r=zf(n,e);return of(()=>t?(t=!1,n):r)})),yae=e=>XS(Zx(e)),QS=(e,t)=>XS(Yx((n,r)=>_f(PS(e.channel,r),e=>t(e,r)))),$S=e=>e.channel,eC=(e,t)=>XS(aae(e,t)),tC=XS(cae),nC=e=>XS(eS(()=>e().channel)),bae=e=>XS(tS(e)),xae=e=>XS(nS(e)),Sae=e=>ia(e)?XS(sae(e)):tC,rC=e=>XS(uae(e)),Cae=e=>XS(fae(e)),wae=e=>XS(Yx(Pp(function*(t,n){let r=e.evaluate().getReader();return yield*Nl(n,e.releaseLockOnEnd?sf(()=>r.releaseLock()):tf(()=>r.cancel().catch(Le))),_f(nf({try:()=>r.read(),catch:t=>e.onError(t)}),({done:e,value:t})=>e?Ou():M(ma(t)))}))),iC=XS(lae),aC=e=>XS(xS(Cf(e,$S))),oC=j(2,(e,t)=>nC(()=>{let n=0;return XS(iS(e.channel,ha(e=>t(e,n++))))})),sC=j(e=>YS(e[0]),(e,t,n)=>e.channel.pipe(fS,oS(t,n),iS(ma),XS)),Tae=j(e=>YS(e[0]),(e,t,n)=>e.channel.pipe(fS,lS(e=>t(e).channel,n),XS)),cC=j(e=>YS(e[0]),(e,t,n)=>e.channel.pipe(fS,gae(e=>t(e).channel,n),XS)),Eae=j(e=>YS(e[0]),(e,t)=>Tae(e,je,t)),lC=e=>XS(pS(e.channel)),uC=j(2,(e,t)=>Eae(Sae([e,t]))),dC=j(e=>YS(e[0])&&YS(e[1]),(e,t,n)=>XS(yS($S(e),$S(t),n))),fC=j(2,(e,t)=>XS(mS($S(e),t))),pC=j(2,(e,t)=>XS(hS($S(e),t))),mC=j(2,(e,t)=>e.channel.pipe(_S(e=>t(e).channel),XS)),hC=j(2,(e,t)=>XS(hae(e.channel,t))),gC=j(e=>YS(e[0]),(e,t,n,r)=>XS(gS(e.channel,t,(e,t)=>{let r=pa();for(let i=0;i<t.length;i++){let[a,o]=n(e,t[i]);e=a,r.push(...o)}return[e,ra(r)?ma(r):_C]},r?.onHalt?{onHalt(e){let t=r.onHalt(e);return ia(t)?ma(t):_C}}:void 0))),_C=pa(),vC=j(3,(e,t,n)=>nC(()=>{let r=!0;return XS(gS(e.channel,Me(t),(e,t)=>{let i=pa();r&&(r=!1,i.push(e));for(let r=0;r<t.length;r++)e=n(e,t[r]),i.push(e);return[e,ma(i)]}))})),yC=j(2,(e,t)=>QS(e,Pp(function*(e,n){let r=yield*ju,i=Mi(xi(t)),a,o,s=1/0,c=dx(),l=dx(),u=dx();yield*e.pipe(c.whenOpen,_f(e=>(l.openUnsafe(),a=e,s=r.currentTimeMillisUnsafe()+i,cf)),lp({disableYield:!0}),tp(e=>(o=e,s=r.currentTimeMillisUnsafe(),l.openUnsafe(),u.openUnsafe(),cf)),yp(n));let d=of(function e(){let t=r.currentTimeMillisUnsafe();return _f(Vf(Bf(s<t?i:Math.min(i,s-t)),u.await),()=>{if(r.currentTimeMillisUnsafe()<s)return e();if(a){l.closeUnsafe(),c.closeUnsafe();let e=M(ma(ca(a)));return a=void 0,e}else if(o)return pf(o);return e()})});return of(()=>{if(o){if(a){let e=M(ma(ca(a)));return a=void 0,e}return pf(o)}return c.openUnsafe(),l.whenOpen(d)})}))),bC=j(2,(e,t)=>XS(bS(e.channel,t))),xC=e=>SC(e,wt),SC=j(2,(e,t)=>QS(e,(e,n)=>sf(()=>{let n=!0,r;return _f(e,function i(a){let o=[],s=0;for(n&&(n=!1,r=a[0],s=1,o.push(r));s<a.length;s++){let e=a[s];t(e,r)||(r=e,o.push(e))}return ra(o)?M(o):_f(e,i)})}))),CC=j(e=>YS(e[0]),(e,t)=>nC(()=>{let n=new TextDecoder(t?.encoding);return oC(e,e=>n.decode(e,{stream:!0}))})),wC=j(2,(e,t)=>XS(wS(e.channel,t))),TC=j(2,(e,t)=>XS(ES(e.channel,t))),EC=j(3,(e,t,n)=>XS(DS(e.channel,t,n))),DC=function(){let e=YS(arguments[0]),t=e?arguments[1]:arguments[0],n=za(e?arguments[2]:arguments[1]);if(e){let e=arguments[0];return XS(kS(e.channel,t,n))}return e=>XS(kS(e.channel,t,n))},OC=e=>Cf(MS(e.channel),Yr(oa(0))),kC=j(2,(e,t)=>jS(e.channel,e=>{let n=0;return ef({while:()=>n<e.length,body:()=>t(e[n++]),step:Le})})),AC=j(2,(e,t)=>jS(e.channel,t)),jC=e=>NS(e.channel),MC=j(e=>YS(e[0]),(e,t,n)=>{let r,i,a=dx(!1);return new ReadableStream({start(n){i=Sp(Kf(AC(e,e=>a.whenOpen(sf(()=>{a.closeUnsafe();for(let t=0;t<e.length;t++)n.enqueue(e[t]);r(),r=void 0}))),t)),i.addObserver(e=>{e._tag===`Failure`?n.error(Su(e.cause)):n.close()})},pull(){return new Promise(e=>{r=e,a.openUnsafe()})},cancel(){if(i)return Ep(Ef(cx(i)))}},n?.strategy)}),NC=j(e=>YS(e[0]),(e,t)=>Cf(Uf(),n=>MC(e,n,t))),PC=e=>e!==`GET`&&e!==`HEAD`&&e!==`OPTIONS`&&e!==`TRACE`,FC=[[`GET`,`get`],[`POST`,`post`],[`PUT`,`put`],[`DELETE`,`del`],[`PATCH`,`patch`],[`HEAD`,`head`],[`OPTIONS`,`options`],[`TRACE`,`trace`]],IC={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,OK:200,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511},LC=`~effect/httpapi/HttpApiSchema/Stream`;function RC(e){let t=typeof e==`string`?IC[e]:e;return e=>e.annotate({httpApiStatus:t})}var zC=(e=>Py.pipe(RC(e)))(204),BC=e=>Ey(e)&&nt(e,LC),VC=e=>BC(e)&&e._tag===`StreamSse`,HC=e=>BC(e)&&e._tag===`StreamUint8Array`;function UC(e,t){return e.annotate({"~httpApiEncoding":{_tag:t._tag,contentType:t.contentType??WC(t._tag)}})}function WC(e){switch(e){case`Multipart`:return`multipart/form-data`;case`Json`:return`application/json`;case`FormUrlEncoded`:return`application/x-www-form-urlencoded`;case`Uint8Array`:return`application/octet-stream`;case`Text`:return`text/plain`}}function GC(e){return t=>UC(t,{_tag:`FormUrlEncoded`,...e})}var KC=e=>{if(Og(e)||Og(_v(e)))return!0;let t=e.encoding?.[0].to;return t===void 0?!1:Og(t)},qC=Bv(`~httpApiEncoding`),JC=Bv(`httpApiStatus`),YC={_tag:`Json`,contentType:`application/json`},XC={_tag:`FormUrlEncoded`,contentType:`application/x-www-form-urlencoded`};function ZC(e){return qC(e)??YC}function QC(e,t){return qC(e)||(PC(t)?YC:XC)}function $C(e){let t=ZC(e);if(t._tag===`Multipart`)throw Error(`Multipart is not supported in response`);return t}function ew(e){return JC(e)??200}function tw(e){return ew(e.ast)}function nw(e){return JC(e)??500}var rw=H([`desktop-managed-local`,`loopback-browser`,`remote-reachable`,`unsafe-no-auth`]),iw=H([`desktop-bootstrap`,`one-time-token`]),aw=H([`browser-session-cookie`,`bearer-access-token`]),ow=`orchestration:read`,sw=`orchestration:operate`,cw=`terminal:operate`,lw=`review:write`,uw=`access:read`,dw=`access:write`,fw=H([ow,sw,cw,lw,uw,dw]),pw=B(fw),mw=[ow,sw,cw,lw],hw=[...mw,uw,dw],gw=`urn:ietf:params:oauth:grant-type:token-exchange`,_w=`urn:ietf:params:oauth:token-type:access_token`,vw=`urn:p4:params:oauth:token-type:environment-bootstrap`,yw=z({policy:rw,bootstrapMethods:B(iw),sessionMethods:B(aw),sessionCookieName:K}),bw=z({credential:K}),xw=z({authenticated:I(!0),scopes:pw,sessionMethod:aw,expiresAt:kb}),Sw=H([`desktop`,`mobile`,`tablet`,`bot`,`unknown`]);z({label:P(K),deviceType:P(Sw),os:P(K)});var Cw=z({grant_type:I(gw),subject_token:K,subject_token_type:I(vw),requested_token_type:I(_w),scope:P(K),client_label:P(K),client_device_type:P(Sw),client_os:P(K)}).pipe(GC()),ww=z({access_token:K,issued_token_type:I(_w),token_type:H([`Bearer`,`DPoP`]),expires_in:Ny,scope:K}),Tw=z({ticket:K,expiresAt:kb}),Ew=z({id:K,credential:K,label:P(K),expiresAt:kb}),Dw=z({id:K,credential:K,scopes:pw,subject:K,label:P(K),createdAt:kb,expiresAt:kb}),Ow=z({sessionId:tx,subject:K,scopes:pw,method:aw,client:z({label:P(K),ipAddress:P(K),userAgent:P(K),deviceType:Sw,os:P(K),browser:P(K)}),issuedAt:kb,expiresAt:kb,lastConnectedAt:U(kb),connected:R,current:R}),kw=z({pairingLinks:B(Dw),clientSessions:B(Ow)}),Aw=z({version:I(1),revision:Ny,type:I(`snapshot`),payload:kw}),jw=z({version:I(1),revision:Ny,type:I(`pairingLinkUpserted`),payload:Dw}),Mw=z({version:I(1),revision:Ny,type:I(`pairingLinkRemoved`),payload:z({id:K})}),Nw=class extends G()(`AuthAccessStreamError`,{message:L}){},Pw=class extends G()(`EnvironmentAuthorizationError`,{message:L,requiredScope:fw}){},Fw=V([Aw,jw,Mw,z({version:I(1),revision:Ny,type:I(`clientUpserted`),payload:Ow}),z({version:I(1),revision:Ny,type:I(`clientRemoved`),payload:z({sessionId:tx})})]),Iw=z({id:K}),Lw=z({sessionId:tx}),Rw=z({label:P(K),scopes:P(pw)}),zw=z({authenticated:R,auth:yw,scopes:P(pw),sessionMethod:P(aw),expiresAt:P(kb)}),Bw=z({os:H([`darwin`,`linux`,`windows`,`unknown`]),arch:H([`arm64`,`x64`,`other`])}),Vw=`@p4code/cli`;function Hw(e){return`${Vw}@${e}`}var Uw=H([`boot-service`,`respawn`]),Ww=H([`boot-service`,`respawn`,`desktop-managed`]),Gw=z({environmentId:Xb,label:K,platform:Bw,serverVersion:K,capabilities:z({repositoryIdentity:R.pipe(W(M(!1))),connectionProbe:P(R),threadSettlement:P(R),threadSnooze:P(R),serverSelfUpdate:P(Ww),serverServiceSupervised:P(R)})});H([`connecting`,`connected`,`disconnected`,`error`]);var Kw=z({canonicalKey:K,locator:z({source:I(`git-remote`),remoteName:K,remoteUrl:K}),rootPath:P(K),displayName:P(K),provider:P(K),owner:P(K),name:P(K)});z({environmentId:Xb,projectId:Jb}),z({environmentId:Xb,threadId:Y}),z({environmentId:Xb,threadId:Y});var qw=`~effect/platform/PlatformError`,Jw=class extends Au(`BadArgument`){get message(){return`${this.module}.${this.method}${this.description?`: ${this.description}`:``}`}},Yw=class extends Au(`PlatformError`){constructor(e){`cause`in e?super({reason:e,cause:e.cause}):super({reason:e})}[qw]=qw;get message(){return this.reason.message}},Xw=e=>new Yw(new Jw(e)),Zw=BigInt(1024);Zw*Zw*Zw*Zw*Zw,ti()(`effect/platform/FileSystem/WatchBackend`);var Qw=`~effect/http/UrlParams`,$w=e=>nt(e,Qw),Dae={...un,[Qw]:Qw,[Symbol.iterator](){return this.params[Symbol.iterator]()},toJSON(){return{_id:`UrlParams`,params:Object.fromEntries(this.params)}},[Ct](e){return rT(this,e)},[ot](){return gt(this.params.flat())}},eT=e=>{let t=Object.create(Dae);return t.params=e,t},tT=e=>{if($w(e))return e;let t=nT(e),n=[];for(let e=0;e<t.length;e++)if(Array.isArray(t[e][0])){let[r,i]=t[e];n.push([`${r[0]}[${r.slice(1).join(`][`)}]`,i])}else n.push(t[e]);return eT(n)},nT=e=>{let t=typeof e[Symbol.iterator]==`function`?Qi(e):Object.entries(e),n=[];for(let[e,r]of t)if(Array.isArray(r))for(let t=0;t<r.length;t++)r[t]!==void 0&&n.push([e,String(r[t])]);else if(typeof r==`object`){let t=nT(r);for(let[r,i]of t)n.push([[e,...typeof r==`string`?[r]:r],i])}else r!==void 0&&n.push([e,String(r)]);return n},rT=$n((e,t)=>Oae(e.params,t.params)),Oae=va(Hee([tr(),tr()])),kae=py($w,{representation:{id:`effect/http/UrlParams`,payload:null},toCode:()=>({runtime:`UrlParams.UrlParamsSchema`,Type:`UrlParams.UrlParams`,importDeclarations:[`import * as UrlParams from "effect/unstable/http/UrlParams"`]}),expected:`UrlParams`,toEquivalence:()=>rT,toCodec:()=>Xy()(B(Ry([L,L])),sg({decode:eT,encode:e=>e.params}))}),Aae=eT([]),jae=j(2,(e,t)=>eT(t(e.params))),Mae=j(2,(e,t)=>{let n=tT(t),r=n.params,i=new Set;for(let e=0;e<r.length;e++)i.add(r[e][0]);for(let t=0;t<e.params.length;t++)i.has(e.params[t][0])||r.push(e.params[t]);return n}),Nae=j(2,(e,t)=>jae(e,ta(tT(t).params))),Pae=e=>new URLSearchParams(tT(e).params).toString(),Fae=kae.pipe(Wy(Iy(L,V([L,zy(L)])),sg({decode:e=>{let t={};for(let[n,r]of e.params)if(!Object.hasOwn(t,n))Qt(t,n,r);else{let e=t[n];typeof e==`string`?Qt(t,n,[e,r]):e.push(r)}return t},encode:tT}))),iT=`~effect/http/HttpBody`,Iae=e=>nt(e,iT),aT=`~effect/http/HttpBody/HttpBodyError`,oT=class extends Au(`HttpBodyError`){[aT]=aT},sT=class{[iT];constructor(){this[iT]=iT}[qt](){return this.toJSON()}toString(){return Ut(this,{ignoreToString:!0})}},cT=new class extends sT{_tag=`Empty`;toJSON(){return{_id:`effect/HttpBody`,_tag:`Empty`}}},Lae=class extends sT{_tag=`Uint8Array`;body;contentType;contentLength;constructor(e,t,n){super(),this.body=e,this.contentType=t,this.contentLength=n}toJSON(){return{_id:`effect/HttpBody`,_tag:`Uint8Array`,body:this.contentType.startsWith(`text/`)||this.contentType.endsWith(`json`)?new TextDecoder().decode(this.body):`Uint8Array(${this.body.length})`,contentType:this.contentType,contentLength:this.contentLength}}},lT=(e,t)=>new Lae(e,t??`application/octet-stream`,e.length),Rae=new TextEncoder,uT=(e,t)=>lT(Rae.encode(e),t??`text/plain`),zae=(e,t)=>uT(JSON.stringify(e),t??`application/json`),Bae=(e,t)=>hf({try:()=>uT(JSON.stringify(e),t??`application/json`),catch:e=>new oT({reason:{_tag:`JsonError`},cause:e})}),Vae=(e,t)=>{let n=ey(Lb(e));return(e,r)=>n(e,t).pipe(jf(e=>new oT({reason:{_tag:`SchemaError`,issue:e},cause:e})),_f(e=>Bae(e,r)))},Hae=(e,t)=>uT(Pae(tT(e)),t??`application/x-www-form-urlencoded`),Uae=class extends sT{_tag=`FormData`;contentType=void 0;contentLength=void 0;formData;constructor(e){super(),this.formData=e}toJSON(){return{_id:`effect/HttpBody`,_tag:`FormData`,formData:this.formData}}},Wae=e=>new Uae(e),dT=Symbol.for(`~effect/http/Headers`),fT=Object.defineProperties(Object.create(null),{[dT]:{value:dT},[Lt]:{value(e){return bT(this,di(e,xT))}},toJSON:{value(){return zt(this)}},[Ct]:{value(e){return Gae(this,e)}},[ot]:{value(){return mt(this)}},toString:{value:Yt.toString},[qt]:{value:Yt[qt]}}),pT=e=>Object.assign(Object.create(fT),e),Gae=Jee(tr()),mT=Object.create(fT),hT=e=>{if(e===void 0)return mT;if(Symbol.iterator in e){let t=Object.create(fT);for(let[n,r]of e)t[n.toLowerCase()]=r;return t}let t=Object.create(fT);for(let[n,r]of Object.entries(e))Array.isArray(r)?t[n.toLowerCase()]=r.join(`, `):r!==void 0&&(t[n.toLowerCase()]=r);return t},gT=e=>Object.setPrototypeOf(e,fT),_T=j(3,(e,t,n)=>{let r=pT(e);return r[t.toLowerCase()]=n,r}),Kae=j(2,(e,t)=>pT({...e,...hT(t)})),vT=j(2,(e,t)=>{let n=pT(e);return Object.assign(n,t),n}),yT=j(2,(e,t)=>{let n=pT(e);return delete n[t.toLowerCase()],n}),bT=j(2,(e,t)=>{let n={...e},r=t=>{if(typeof t==`string`){let r=t.toLowerCase();r in e&&(n[r]=rh(e[r]))}else for(let r in e)t.test(r)&&(n[r]=rh(e[r]))};if(Array.isArray(t))for(let e=0;e<t.length;e++)r(t[e]);else r(t);return n}),xT=gi(`effect/Headers/CurrentRedactedNames`,{defaultValue:()=>[`authorization`,`cookie`,`set-cookie`,`x-api-key`]}),qae=`~effect/ErrorReporter/ignore`,ST=`~effect/http/Cookies`,CT=`~effect/http/Cookies/Cookie`;Au(`CookieError`);var Jae={[ST]:ST,...Yt,toJSON(){return{_id:`effect/Cookies`,cookies:Yi(this.cookies,e=>e.toJSON())}},pipe(){return Oe(this,arguments)}},Yae=e=>{let t=Object.create(Jae);return t.cookies=e,t},wT=e=>{let t={};for(let n of e)Qt(t,n.name,n);return Yae(t)},Xae=e=>{let t=typeof e==`string`?[e]:e,n=[];for(let e of t){let t=Zae(e.trim());t&&n.push(t)}return wT(n)};function Zae(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``);if(t.length===0)return;let n=t[0].indexOf(`=`);if(n===-1)return;let r=t[0].slice(0,n);if(!$ae.test(r))return;let i=t[0].slice(n+1),a=eoe(i);if(t.length===1)return Object.assign(Object.create(TT),{name:r,value:a,valueEncoded:i});let o={};for(let e=1;e<t.length;e++){let n=t[e],r=n.indexOf(`=`),i=r===-1?n:n.slice(0,r).trim(),a=r===-1?void 0:n.slice(r+1).trim();switch(i.toLowerCase()){case`domain`:{if(a===void 0)break;let e=a.trim().replace(/^\./,``);e&&(o.domain=e);break}case`expires`:{if(a===void 0)break;let e=new Date(a);isNaN(e.getTime())||(o.expires=e);break}case`max-age`:{if(a===void 0)break;let e=parseInt(a,10);isNaN(e)||(o.maxAge=ji(e));break}case`path`:if(a===void 0)break;a[0]===`/`&&(o.path=a);break;case`priority`:if(a===void 0)break;switch(a.toLowerCase()){case`low`:o.priority=`low`;break;case`medium`:o.priority=`medium`;break;case`high`:o.priority=`high`;break}break;case`httponly`:o.httpOnly=!0;break;case`secure`:o.secure=!0;break;case`partitioned`:o.partitioned=!0;break;case`samesite`:if(a===void 0)break;switch(a.toLowerCase()){case`lax`:o.sameSite=`lax`;break;case`strict`:o.sameSite=`strict`;break;case`none`:o.sameSite=`none`;break}break}}return Object.assign(Object.create(TT),{name:r,value:a,valueEncoded:i,options:Object.keys(o).length>0?o:void 0})}var Qae=wT([]),$ae=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,TT={[CT]:CT,...Yt,toJSON(){return{_id:`effect/Cookies/Cookie`,name:this.name,value:this.value,options:this.options}}},eoe=e=>{try{return decodeURIComponent(e)}catch{return e}},ET=`~effect/http/HttpClientError`,DT=e=>nt(e,ET),OT=class extends Au(`HttpClientError`){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[ET]=ET;get request(){return this.reason.request}get response(){return`response`in this.reason?this.reason.response:void 0}get message(){return this.reason.message}},kT=e=>e.endsWith(`Error`)?e.slice(0,-5):e,AT=(e,t,n)=>t?`${e}: ${t} (${n})`:`${e} error (${n})`,toe=class extends Au(`TransportError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return AT(kT(this._tag),this.description,this.methodAndUrl)}};Au(`EncodeError`);var noe=class extends Au(`InvalidUrlError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){return AT(kT(this._tag),this.description,this.methodAndUrl)}},jT=class extends Au(`StatusCodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return AT(kT(this._tag),this.description,e)}},MT=class extends Au(`DecodeError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return AT(kT(this._tag),this.description,e)}},roe=class extends Au(`EmptyBodyError`){get methodAndUrl(){return`${this.request.method} ${this.request.url}`}get message(){let e=`${this.response.status} ${this.methodAndUrl}`;return AT(kT(this._tag),this.description,e)}},ioe=class e extends Ib(ET)({_tag:qy(`HttpError`),kind:H([`EncodeError`,`DecodeError`,`TransportError`,`InvalidUrlError`,`StatusCodeError`,`EmptyBodyError`]),cause:F(Cb())}){static fromHttpClientError(t){return new e({_tag:`HttpError`,kind:t.reason._tag,cause:t.reason})}},aoe=class extends Au(`UrlError`){},ooe=(e,t,n)=>Gi({try:()=>{let r=new URL(e,soe());for(let e=0;e<t.params.length;e++){let[n,i]=t.params[e];i!==void 0&&r.searchParams.append(n,i)}return n!==void 0&&(r.hash=n),r},catch:e=>new aoe({cause:e})}),soe=()=>{if(`location`in globalThis&&globalThis.location!==void 0&&globalThis.location.origin!==void 0&&globalThis.location.pathname!==void 0)return location.origin+location.pathname},NT=`~effect/http/HttpClientRequest`,coe={[NT]:NT,...Yt,toJSON(){return{_id:`HttpClientRequest`,method:this.method,url:this.url,urlParams:this.urlParams,hash:this.hash,headers:zt(this.headers),body:this.body.toJSON()}},pipe(){return Oe(this,arguments)}};function PT(e,t,n,r,i,a){let o=Object.create(coe);return o.method=e,o.url=t,o.urlParams=n,o.hash=r,o.headers=i,o.body=a,o}var loe=PT(`GET`,``,Aae,Pr(),mT,cT),FT=e=>(t,n)=>doe(loe,{method:e,url:t,...n??void 0}),uoe=FT(`POST`),doe=j(2,(e,t)=>{let n=e;return t.method&&(n=foe(n,t.method)),t.url&&(n=zT(n,t.url)),t.headers&&(n=LT(n,t.headers)),t.urlParams&&(n=_oe(n,t.urlParams)),t.hash&&(n=voe(n,t.hash)),t.body&&(n=VT(n,t.body)),t.accept&&(n=RT(n,t.accept)),t.acceptJson&&(n=moe(n)),n}),foe=j(2,(e,t)=>PT(t,e.url,e.urlParams,e.hash,e.headers,e.body)),IT=j(3,(e,t,n)=>PT(e.method,e.url,e.urlParams,e.hash,_T(e.headers,t,n),e.body)),LT=j(2,(e,t)=>PT(e.method,e.url,e.urlParams,e.hash,Kae(e.headers,t),e.body)),poe=j(2,(e,t)=>IT(e,`Authorization`,`Bearer ${eh(t)}`)),RT=j(2,(e,t)=>IT(e,`Accept`,t)),moe=RT(`application/json`),zT=j(2,(e,t)=>{if(typeof t==`string`)return PT(e.method,t,e.urlParams,e.hash,e.headers,e.body);let n=new URL(t.toString()),r=tT(n.searchParams),i=Hr(n.hash===``?void 0:n.hash.slice(1));return n.search=``,n.hash=``,PT(e.method,n.toString(),r,i,e.headers,e.body)}),hoe=j(2,(e,t)=>t===``?e:PT(e.method,goe(t,e.url),e.urlParams,e.hash,e.headers,e.body)),goe=(e,t)=>{let n=e.endsWith(`/`),r=t.startsWith(`/`);return n&&r?e+t.slice(1):!n&&!r?e+`/`+t:e+t},_oe=j(2,(e,t)=>PT(e.method,e.url,Mae(e.urlParams,t),e.hash,e.headers,e.body)),BT=j(2,(e,t)=>PT(e.method,e.url,Nae(e.urlParams,t),e.hash,e.headers,e.body)),voe=j(2,(e,t)=>PT(e.method,e.url,e.urlParams,Fr(t),e.headers,e.body)),VT=j(2,(e,t)=>{let n=e.headers;return t._tag===`Empty`||t._tag===`FormData`?n=yT(yT(n,`Content-Type`),`Content-length`):(t.contentType&&(n=_T(n,`content-type`,t.contentType)),t.contentLength!==void 0&&(n=_T(n,`content-length`,t.contentLength.toString()))),PT(e.method,e.url,e.urlParams,e.hash,n,t)}),yoe=j(2,(e,t)=>VT(e,Wae(t))),HT=`~effect/http/HttpIncomingMessage`,UT=(e,t)=>{let n=e.headers[`content-type`]??``,r;if(n.includes(`application/json`))try{r=Ap(e.json)}catch{}else if(n.includes(`text/`)||n.includes(`urlencoded`))try{r=Ap(e.text)}catch{}let i={...t,headers:zt(e.headers),remoteAddress:e.remoteAddress};return r!==void 0&&(i.body=r),i},WT=`~effect/http/HttpClientResponse`,GT=(e,t)=>new JT(e,t),KT=j(2,(e,t)=>{let n=e.status;return t[n]?t[n](e):n>=200&&n<300&&t[`2xx`]?t[`2xx`](e):n>=300&&n<400&&t[`3xx`]?t[`3xx`](e):n>=400&&n<500&&t[`4xx`]?t[`4xx`](e):n>=500&&n<600&&t[`5xx`]?t[`5xx`](e):t.orElse(e)}),qT=e=>e.status>=200&&e.status<300?M(e):ff(new OT({reason:new jT({response:e,request:e.request,description:`non 2xx status code`})})),JT=class extends lee{[HT];[WT];request;source;constructor(e,t){super(),this.request=e,this.source=t,this[HT]=HT,this[WT]=WT}toJSON(){return UT(this,{_id:`HttpClientResponse`,request:this.request.toJSON(),status:this.status})}get status(){return this.source.status}get headers(){return hT(this.source.headers)}cachedCookies;get cookies(){return this.cachedCookies?this.cachedCookies:this.cachedCookies=Xae(this.source.headers.getSetCookie())}get remoteAddress(){return Pr()}get stream(){return this.source.body?wae({evaluate:()=>this.source.body,onError:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}):bae(new OT({reason:new roe({request:this.request,response:this,description:`can not create stream from empty body`})}))}get json(){return _f(this.text,e=>hf({try:()=>e===``?null:JSON.parse(e),catch:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}))}textBody;get text(){return this.textBody?this.textBody:(this.textBody=nf({try:()=>this.source.text(),catch:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}).pipe(rp,Ap),this.arrayBufferBody=Cf(this.textBody,e=>new TextEncoder().encode(e).buffer),this.textBody)}get urlParamsBody(){return _f(this.text,e=>hf({try:()=>tT(new URLSearchParams(e)),catch:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}))}formDataBody;get formData(){return this.formDataBody??=nf({try:()=>this.source.formData(),catch:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}).pipe(rp,Ap)}arrayBufferBody;get arrayBuffer(){return this.arrayBufferBody?this.arrayBufferBody:(this.arrayBufferBody=nf({try:()=>this.source.arrayBuffer(),catch:e=>new OT({reason:new MT({request:this.request,response:this,cause:e})})}).pipe(rp,Ap),this.textBody=Cf(this.arrayBufferBody,e=>new TextDecoder().decode(e)),this.arrayBufferBody)}pipe(){return Oe(this,arguments)}},YT=`~effect/http/HttpServerResponse`,XT=(e,t)=>{if(e?.contentType)return e.contentType;if(e?.headers)return t[`content-type`]},ZT=(e,t)=>{let n=Vae(e,t);return(e,t)=>{let r=t?.headers?hT(t.headers):mT;return Cf(n(e,XT(t,r)),e=>$T({status:t?.status??200,statusText:t?.statusText,headers:r,cookies:t?.cookies,body:e}))}},QT={...un,[YT]:YT,[qae]:!0,toJSON(){return{_id:`HttpServerResponse`,status:this.status,statusText:this.statusText,headers:zt(this.headers),cookies:this.cookies.toJSON(),body:this.body.toJSON()}}},$T=e=>{let t=Object.create(QT);if(t.status=e.status,t.statusText=e.statusText,t.cookies=e.cookies??Qae,t.body=e.body??cT,t.body._tag!==`Empty`&&(t.body.contentType||t.body.contentLength)){let n=gT({...e.headers});t.body.contentType&&(n[`content-type`]=t.body.contentType),t.body.contentLength&&(n[`content-length`]=t.body.contentLength.toString()),t.headers=n}else t.headers=e.headers??mT;return t},eE=`~effect/http/HttpServerRespondable`;Au(`HttpServerError`),Au(`RequestParseError`),Au(`RouteNotFound`),Au(`InternalError`),Au(`ResponseError`),Au(`ServeError`),ti()(`effect/http/HttpServerError/ClientAbort`);var tE=`~effect/FiberSet`,nE=e=>nt(e,tE),rE={[tE]:tE,[Symbol.iterator](){return this.state._tag===`Closed`?Gee():this.state.backing[Symbol.iterator]()},...un,toJSON(){return{_id:`FiberMap`,state:this.state}}},iE=(e,t)=>{let n=Object.create(rE);return n.state={_tag:`Open`,backing:e},n.deferred=t,n},aE=()=>Qf(sf(()=>iE(new Set,hl())),e=>of(()=>{let t=e.state;if(t._tag===`Closed`)return cf;e.state={_tag:`Closed`};let n=t.backing;return die(n).pipe(El(e.deferred))})),oE=-1,sE=ba(Sa(zne,xa(oE))),cE=j(e=>nE(e[0]),(e,t,n)=>{if(e.state._tag===`Closed`){t.interruptUnsafe(oE);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(r=>{e.state._tag!==`Closed`&&(e.state.backing.delete(t),ml(r)&&(n?.propagateInterruption===!0?!sE(r.cause):!bu(r.cause))&&Tl(e.deferred,r))})}),lE=function(){let e;return()=>(e===void 0&&(e=Sp(ip)),e)}(),uE=function(){let e=arguments[0];if(!Zd(arguments[1])){let t=arguments[1];return n=>dE(e,n,t)}return dE(e,arguments[1],arguments[2])},dE=(e,t,n)=>gf(r=>{if(e.state._tag===`Closed`)return sf(lE);let i=Cp(r.context)(t);return cE(e,i,n),M(i)}),fE=e=>()=>Cf(Uf(),t=>{let n=Cp(t);return(t,r)=>{if(e.state._tag===`Closed`)return lE();let i=n(t,r);return cE(e,i),i}}),pE=e=>_l(e.deferred),mE=e=>ef({while:()=>e.state._tag===`Open`&&e.state.backing.size>0,body:()=>ox(Ji(e)),step:Le}),hE=`~effect/socket/Socket`,gE=ti(`effect/socket/Socket`),_E=e=>gE.of({[hE]:hE,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(e=>typeof e==`string`?t(vE.encode(e)):e instanceof Uint8Array?t(e):t(new Uint8Array(e)),n)),runString:e.runString??(e.run?(t,n)=>e.run(e=>t(yE.decode(e)),n):(t,n)=>e.runRaw(e=>typeof e==`string`?t(e):e instanceof Uint8Array?t(yE.decode(e)):t(yE.decode(new Uint8Array(e))),n)),writer:e.writer}),vE=new TextEncoder,yE=new TextDecoder,bE=`~effect/socket/Socket/CloseEvent`,xE=e=>nt(e,bE),SE=`~effect/socket/Socket/SocketError`,CE=e=>nt(e,SE),wE=class extends Ib(`effect/socket/Socket/SocketReadError`)({_tag:qy(`SocketReadError`),cause:Cb()}){message=`An error occurred during Read`},TE=class extends Ib(`effect/socket/Socket/SocketWriteError`)({_tag:qy(`SocketWriteError`),cause:Cb()}){message=`An error occurred during Write`},EE=class extends Ib(`effect/socket/Socket/SocketOpenError`)({_tag:qy(`SocketOpenError`),kind:H([`Unknown`,`Timeout`]),cause:Cb()}){get message(){return this.kind===`Timeout`?`timeout waiting for "open"`:`An error occurred during Open`}},DE=class extends Ib(`effect/socket/Socket/SocketCloseError`)({_tag:qy(`SocketCloseError`),code:cb,closeReason:F(L)}){static filterClean(e){return function(t){return kE.is(t)&&t.reason._tag===`SocketCloseError`&&e(t.reason.code)?Hi(t.reason):Ui(t)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}},OE=V([wE,TE,EE,DE]),kE=class extends G(SE)(`SocketError`,{_tag:qy(`SocketError`),reason:OE}){constructor(e){`cause`in e.reason?super({...e,cause:e.reason.cause}):super(e)}[SE]=SE;static is(e){return CE(e)}message=this.reason.message},AE=e=>!0,jE=class extends ti()(`~effect/socket/Socket/WebSocket`){},ME=class extends ti()(`@effect/platform/Socket/WebSocketConstructor`){},NE=Jl(ME)((e,t)=>new globalThis.WebSocket(e,t)),PE=(e,t)=>ME.use(n=>FE(Qf((typeof e==`string`?M(e):e).pipe(Cf(e=>n(e,t?.protocols))),e=>sf(()=>e.close(1e3))),t)),FE=(e,t)=>gf(n=>{let r,i=dx(!1),a=n.context,o=t?.closeCodeIsError??AE;return M(_E({runRaw:(n,s)=>Zf(Pp(function*(a){let c=yield*aE().pipe(jl(a)),l=yield*jl(e,a),u=yield*Yf(fE(c)(),jE,l),d=!1;function f(e){if(e.data instanceof Blob){let t=_f(tf(()=>e.data.arrayBuffer()),e=>{let t=n(new Uint8Array(e));return Zd(t)?t:cf});return u(t)}let t=n(e.data);Zd(t)&&u(t)}function p(e){l.removeEventListener(`message`,f),l.removeEventListener(`close`,m),Tl(c.deferred,ff(new kE({reason:d?new wE({cause:e}):new EE({kind:`Unknown`,cause:e})})))}function m(e){let t=typeof e.code==`number`?e.code:1001;l.removeEventListener(`message`,f),l.removeEventListener(`error`,p),Tl(c.deferred,ff(new kE({reason:new DE({code:t,closeReason:e.reason})})))}if(l.addEventListener(`close`,m,{once:!0}),l.addEventListener(`error`,p,{once:!0}),l.addEventListener(`message`,f),l.readyState!==1){let e=hl();l.addEventListener(`open`,()=>{d=!0,Tl(e,cf)},{once:!0}),yield*_l(e).pipe(Rf({duration:t?.openTimeout??1e4,orElse:()=>ff(new kE({reason:new EE({kind:`Timeout`,cause:Error(`timeout waiting for "open"`)})}))}),Vf(pE(c)))}return d=!0,r=l,i.openUnsafe(),s?.onOpen&&(yield*s.onOpen),yield*Xne(pE(c),DE.filterClean(e=>!o(e)),()=>cf)})).pipe(Jf(e=>mi(a,e)),ep(sf(()=>{i.closeUnsafe(),r=void 0}))),writer:M(e=>i.whenOpen(sf(()=>{let t=r;xE(e)?t.close(e.code,e.reason):t.send(e)})))}))}),IE=ze(PE,Ql(gE)),LE;(function(e){e[e.key=0]=`key`,e[e.whitespace=1]=`whitespace`,e[e.value=2]=`value`})(LE||={});var RE;(function(e){e[e.headers=0]=`headers`,e[e.body=1]=`body`})(RE||={}),Au(`MultipartError`);var zE=ti(`effect/http/HttpServerRequest`);ti()(`effect/http/ParsedSearchParams`);var BE=e=>gT({b3:`${e.traceId}-${e.spanId}-${e.sampled?`1`:`0`}${zr(e.parent,{onNone:()=>``,onSome:e=>`-${e.spanId}`})}`,traceparent:`00-${e.traceId}-${e.spanId}-${e.sampled?`01`:`00`}`}),VE=new WeakSet,HE=e=>gf(t=>{let n=ui(t.context,zE);return VE.add(n.source),e}),UE={"~effect/Ref":{_A:je},...un,toJSON(){return{_id:`Ref`,ref:this.ref}}},WE=e=>{let t=Object.create(UE);return t.ref=bx(e),t},GE=e=>sf(()=>WE(e)),KE=e=>sf(()=>e.ref.current),qE=j(2,(e,t)=>sf(()=>xx(e.ref,t))),JE=j(2,(e,t)=>sf(()=>{let n=e.ref.current;return e.ref.current=t,n})),YE=j(2,(e,t)=>sf(()=>{let[n,r]=t(e.ref.current);return e.ref.current=r,n})),XE=j(2,(e,t)=>sf(()=>{e.ref.current=t(e.ref.current)})),ZE=`~effect/http/HttpClient`,QE=ti(`effect/HttpClient`),$E=j(2,(e,t)=>tD(n=>t(e.postprocess(n)),e.preprocess)),eD=$E(_f(qT)),tD=(e,t)=>{let n=Object.create(nD);return n.preprocess=t,n.postprocess=e,n.execute=function(n){return e(t(n))},n},nD={[ZE]:ZE,pipe(){return Oe(this,arguments)},...Yt,toJSON(){return{_id:`effect/HttpClient`}},...Object.fromEntries(FC.map(([e,t])=>[t,function(t,n){return this.execute(FT(e)(t,n))}]))},rD=e=>tD(t=>_f(t,t=>gf(n=>{let r=fD.get(t),i=r??new AbortController,a=ooe(t.url,t.urlParams,Gr(t.hash));if(Ki(a))return ff(new OT({reason:new noe({request:t,cause:a.failure})}));let o=a.success;if(n.getRef(Aa)||n.getRef(sD)(t)){let a=e(t,o,i.signal,n);return r?a:cp(e=>Hf(e(a),{onSuccess(e){return dD.register(e,i),M(new pD(e,i))},onFailure(e){return wu(e)&&i.abort(),pf(e)}}))}return hp(n.getRef(lD)(t),{kind:`client`},a=>{a.attribute(`http.request.method`,t.method),a.attribute(`server.address`,o.origin),o.port!==``&&a.attribute(`server.port`,+o.port),a.attribute(`url.full`,o.toString()),a.attribute(`url.path`,o.pathname),a.attribute(`url.scheme`,o.protocol.slice(0,-1));let s=o.search.slice(1);s!==``&&a.attribute(`url.query`,s);let c=n.getRef(xT),l=bT(t.headers,c);for(let e in l)a.attribute(`http.request.header.${e}`,String(l[e]));return t=n.getRef(cD)?LT(t,BE(a)):t,cp(s=>s(e(t,o,i.signal,n)).pipe(_p(a,{captureStackTrace:!1}),Hf({onSuccess:e=>{a.attribute(`http.response.status_code`,e.status);let t=bT(e.headers,c);for(let e in t)a.attribute(`http.response.header.${e}`,String(t[e]));return r?M(e):(dD.register(e,i),M(new pD(e,i)))},onFailure(e){return!r&&wu(e)&&i.abort(),pf(e)}})))})})),M),iD=j(2,(e,t)=>tD(e.postprocess,n=>Cf(e.preprocess(n),t))),aD=j(2,(e,t)=>tD(e.postprocess,n=>_f(e.preprocess(n),t))),oD=j(2,(e,t)=>{let n=Ad(t),r=n?`errors-and-responses`:t.retryOn??`errors-and-responses`,i=n?t:t.schedule,a=i&&Vd(i),o=n?void 0:t.times;return $E(e,ze(r===`errors-only`?je:up({schedule:a,times:o,while:gD}),r===`response-only`?je:Pf({while:n||t.while===void 0?mD:at(mD,t.while),schedule:i,times:o})))}),sD=gi(`effect/http/HttpClient/TracerDisabledWhen`,{defaultValue:()=>Pe}),cD=gi(`effect/HttpClient/TracerPropagationEnabled`,{defaultValue:Ne}),lD=gi(`effect/http/HttpClient/SpanNameGenerator`,{defaultValue:()=>e=>`http.client ${e.method}`}),uD=e=>Ql(QE)(Wf(t=>Cf(e,e=>$E(e,Jf(e=>mi(t,e)))))),dD=(()=>{if(`FinalizationRegistry`in globalThis&&globalThis.FinalizationRegistry){let e=new FinalizationRegistry(e=>{e.abort()});return{register(t,n){e.register(t,n,t)},unregister(t){e.unregister(t)}}}let e=new Map;return{register(t,n){e.set(t,setTimeout(()=>n.abort(),5e3))},unregister(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))}}})(),fD=new WeakMap,pD=class{original;controller;constructor(e,t){this.original=e,this.controller=t}[WT]=WT;[HT]=HT;applyInterrupt(e){return of(()=>(dD.unregister(this.original),op(e,()=>sf(()=>{this.controller.abort()}))))}get request(){return this.original.request}get status(){return this.original.status}get headers(){return this.original.headers}get cookies(){return this.original.cookies}get remoteAddress(){return this.original.remoteAddress}get formData(){return this.applyInterrupt(this.original.formData)}get text(){return this.applyInterrupt(this.original.text)}get json(){return this.applyInterrupt(this.original.json)}get urlParamsBody(){return this.applyInterrupt(this.original.urlParamsBody)}get arrayBuffer(){return this.applyInterrupt(this.original.arrayBuffer)}get stream(){return nC(()=>(dD.unregister(this.original),wC(this.original.stream,sf(()=>{this.controller.abort()}))))}toJSON(){return this.original.toJSON()}[qt](){return this.original[qt]()}pipe(){return Oe(this,arguments)}},mD=e=>Vne(e)||hD(e),hD=e=>DT(e)&&(e.reason._tag===`TransportError`||e.reason._tag===`StatusCodeError`&&gD(e.reason.response)),gD=e=>e.status===408||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504,_D=ti(`effect/http/HttpRouter`);ti()(`effect/http/HttpRouter/RouteContext`);var vD=e=>e.endsWith(`/`)?e.slice(0,-1):e,yD=j(2,(e,t)=>(t=vD(t),e===`*`?`${t}/*`:e===`/`?t:t+e)),bD=`~effect/http/HttpRouter/Middleware`,xD=function(){return arguments.length===0?SD:SD(arguments[0],arguments[1])},SD=(e,t)=>t?.global?tu(df(function*(){let t=yield*_D,n=Zd(e)?yield*e:e;yield*t.addGlobalMiddleware(n)})):new TD(Zd(e)?eu(Cf(e,e=>ai(new Map([[wD,e]])))):Yl(ai(new Map([[wD,e]])))),CD=0,wD=`effect/http/HttpRouter/MiddlewareFn`,TD=class e{[bD]={};layerFn;dependencies;constructor(e,t){this.layerFn=e,this.dependencies=t;let n=`effect/http/HttpRouter/Middleware-${++CD}`;this.layer=eu(df({self:this},function*(){let e=yield*Uf(),t=[e.mapUnsafe.get(wD)];if(this.dependencies){let n=yield*Wl,r=di(e,Ol),i=yield*Gl(this.dependencies,n,r);t.push(...DD(i))}return ai(new Map([[n,t]]))})).pipe(su(this.layerFn))}layer;combine(t){return new e(this.layerFn,this.dependencies?cu(this.dependencies,t.layer):t.layer)}},ED=new WeakMap,DD=e=>{let t=ED.get(e);if(t)return t;let n=pa(),r=0;for(let[t,i]of e.mapUnsafe)t.startsWith(`effect/http/HttpRouter/Middleware-`)&&(n.push(i),i.length>r&&(r=i.length));if(n.length===0)t=[];else{let e=new Set;for(let t=r-1;t>=0;t--)for(let r of n)t<r.length&&e.add(r[t]);t=Qi(e).reverse()}return ED.set(e,t),t};xD(HE).layer;function OD(e){let t=e.toLowerCase().trim(),n=t.indexOf(`;`);return n===-1?t:t.slice(0,n).trim()}var kD=`~effect/httpapi/HttpApiEndpoint`;function AD(e){let t=[];for(let{schemas:n}of e.payload.values())t.push(...n);return t}function jD(e){let t=Array.from(e.success);return ra(t)?t:[zC]}function MD(e){let t=new Set(e.error);for(let n of e.middlewares){let e=n;for(let n of e.error)t.add(n)}return Array.from(t)}var ND={[kD]:kD,pipe(){return Oe(this,arguments)},prefix(e){return FD({...PD(this),path:yD(this.path,e)})},middleware(e){return FD({...PD(this),middlewares:new Set([...this.middlewares,e])})},annotate(e,t){return FD({...PD(this),annotations:li(this.annotations,e,t)})},annotateMerge(e){return FD({...PD(this),annotations:mi(this.annotations,e)})}},PD=e=>({identifier:e.identifier,path:e.path,method:e.method,params:e.params,query:e.query,headers:e.headers,payload:e.payload,success:e.success,error:e.error,annotations:e.annotations,middlewares:e.middlewares});function FD(e){function t(){}return Object.setPrototypeOf(t,ND),Object.assign(t,e)}var ID=e=>(t,n,r)=>{let i=r?.disableCodecs??!1,a=i?je:Hb;return FD({identifier:t,path:n,method:e,params:LD(r?.params,a),query:LD(r?.query,a),headers:LD(r?.headers,a),payload:RD(r?.payload,e,i),success:BD(r?.success,e,i),error:VD(r?.error,i),annotations:si(),middlewares:new Set})};function LD(e,t){if(e!==void 0)return Ey(e)?t(e):t(z(e))}function RD(e,t,n){let r=new Map;if(e===void 0)return r;let i=Array.isArray(e)?e:Ey(e)?[e]:[z(e).pipe(GC())],a=n?je:YD;for(let e of i){let n=QC(e.ast,t),i=OD(n.contentType),o=r.get(i);if(o){if(o.encoding._tag!==n._tag)throw Error(`Multiple payload encodings for content-type: ${n.contentType}`);if(o.encoding._tag===`Multipart`)throw Error(`Multiple multipart payloads for content-type: ${n.contentType}`);o.schemas.push(a(e,t))}else r.set(i,{encoding:n,schemas:[a(e,t)]})}return r}var zD=`effect/httpapi/stream/failure`;function BD(e,t,n){if(e===void 0)return new Set;let r=$i(e);return HD(r,t),new Set(n?r:r.map(e=>BC(e)?e:JD(e)))}function VD(e,t){if(e===void 0)return new Set;let n=$i(e);for(let e of n)if(BC(e))throw Error(`Streaming schemas are not supported in error responses`);return new Set(t?n:n.map(JD))}function HD(e,t){let n=new Map;for(let r of e)if(BC(r)){WD(r,t);let e=tw(r),i=UD(n,e);if(i.stream!==void 0)throw Error(`Multiple streaming success responses for status: ${e}`);if(i.noContent)throw Error(`Cannot combine no-content and streaming success responses for status: ${e}`);if(i.bufferedContentTypes.has(OD(r.contentType)))throw Error(`Cannot combine buffered and streaming success responses for status ${e} and content-type: ${r.contentType}`);n.set(e,{...i,stream:r})}else{let e=ew(r.ast),t=UD(n,e),i=KC(r.ast);if(t.stream!==void 0){if(i)throw Error(`Cannot combine no-content and streaming success responses for status: ${e}`);let n=$C(r.ast);if(OD(n.contentType)===OD(t.stream.contentType))throw Error(`Cannot combine buffered and streaming success responses for status ${e} and content-type: ${n.contentType}`)}i||t.bufferedContentTypes.add(OD($C(r.ast).contentType)),t.noContent=t.noContent||i}}function UD(e,t){let n=e.get(t);return n===void 0&&(n={bufferedContentTypes:new Set,noContent:!1},e.set(t,n)),n}function WD(e,t){if(t===`HEAD`)throw Error(`HEAD endpoints cannot declare streaming success responses`);if(VC(e)&&GD(e.events.ast))throw Error(`SSE event name is reserved: ${zD}`)}function GD(e){return KD(_v(e),new Set)}function KD(e,t){if(t.has(e))return!1;if(t.add(e),Pg(e))return e.types.some(e=>KD(e,t));if(Fg(e))return KD(e.thunk(),t);if(!Ng(e))return!1;let n=e.propertySignatures.find(e=>e.name===`event`);return n!==void 0&&qD(n.type,t)}function qD(e,t){if(t.has(e))return!1;t.add(e);let n=_v(e);return n===e?Ag(e)?e.literal===zD:Pg(e)?e.types.some(e=>qD(e,t)):Fg(e)?qD(e.thunk(),t):!1:qD(n,t)}function JD(e){switch($C(e.ast)._tag){case`Json`:return Lb(e);case`FormUrlEncoded`:return Hb(e);case`Text`:case`Uint8Array`:return e}}function YD(e,t){switch(QC(e.ast,t)._tag){case`Json`:return Lb(e);case`FormUrlEncoded`:return Hb(e);case`Text`:case`Uint8Array`:case`Multipart`:return e}}var XD=ID(`GET`),ZD=ID(`POST`),QD=`~effect/httpapi/HttpApi`,$D={[QD]:QD,pipe(){return Oe(this,arguments)},add(...e){let t={...this.groups};for(let n of e)Qt(t,n.identifier,n);return tO({...eO(this),groups:t})},addHttpApi(e){let t={...this.groups};for(let n of Object.keys(e.groups)){let r=e.groups[n];Qt(t,n,r.annotateMerge(mi(e.annotations,r.annotations)))}return tO({...eO(this),groups:t})},prefix(e){return tO({...eO(this),groups:Yi(this.groups,t=>t.prefix(e))})},middleware(e){return tO({...eO(this),groups:Yi(this.groups,t=>t.middleware(e))})},annotate(e,t){return tO({...eO(this),annotations:li(this.annotations,e,t)})},annotateMerge(e){return tO({...eO(this),annotations:mi(this.annotations,e)})}},eO=e=>({identifier:e.identifier,groups:e.groups,annotations:e.annotations}),tO=e=>{function t(){}return Object.setPrototypeOf(t,$D),Object.assign(t,e)},nO=e=>tO({identifier:e,groups:{},annotations:si()}),rO=(e,t)=>{let n=Object.values(e.groups);for(let r of n){let n=mi(e.annotations,r.annotations);t.onGroup({group:r,mergedAnnotations:n});let i=Object.values(r.endpoints);for(let e of i)t.predicate&&!t.predicate({endpoint:e,group:r})||t.onEndpoint({group:r,endpoint:e,middleware:e.middlewares,mergedAnnotations:mi(n,e.annotations),successes:iO(jD(e),ew),errors:iO(MD(e),nw)})}},iO=(e,t)=>{let n=new Map;return e.forEach(r),n;function r(e){if(BC(e))return;let r=e.ast,i=t(r),a=n.get(i);a===void 0?n.set(i,[e]):a.push(e)}};ti()(`effect/httpapi/HttpApi/AdditionalSchemas`);var aO=`~effect/httpapi/HttpApiGroup`,oO={[aO]:aO,add(...e){let t={...this.endpoints};for(let n of e)Qt(t,n.identifier,n);return cO({...sO(this),endpoints:t})},prefix(e){return cO({...sO(this),endpoints:Yi(this.endpoints,t=>t.prefix(e))})},middleware(e){return cO({...sO(this),endpoints:Yi(this.endpoints,t=>t.middleware(e))})},annotateMerge(e){return cO({...sO(this),annotations:mi(this.annotations,e)})},annotate(e,t){return cO({...sO(this),annotations:li(this.annotations,e,t)})},annotateEndpointsMerge(e){return cO({...sO(this),endpoints:Yi(this.endpoints,t=>t.annotateMerge(e))})},annotateEndpoints(e,t){return cO({...sO(this),endpoints:Yi(this.endpoints,n=>n.annotate(e,t))})},pipe(){return Oe(this,arguments)}},sO=e=>({identifier:e.identifier,topLevel:e.topLevel,endpoints:e.endpoints,annotations:e.annotations}),cO=e=>{function t(){}return Object.setPrototypeOf(t,oO),t.key=`effect/httpapi/HttpApiGroup/${e.identifier}`,Object.assign(t,e)},lO=(e,t)=>cO({identifier:e,topLevel:t?.topLevel??!1,endpoints:{},annotations:si()}),uO=`~effect/httpapi/HttpApiMiddleware`,dO=`~effect/httpapi/HttpApiMiddleware/Security`,fO=()=>(e,t)=>{let n=globalThis.Error,r=Zn();Qn(2);let i=new n;Qn(r);class a extends ti()(e){}let o=a;if(Object.defineProperty(a,"stack",{get(){return i.stack}}),o[uO]=uO,o.error=pO(t?.error),o.requiredForClient=t?.requiredForClient??!1,t?.security!==void 0){if(Object.keys(t.security).length===0)throw Error(`HttpApiMiddleware.Service: security object must not be empty`);o[dO]=dO,o.security=t.security}return o};function pO(e){return e===void 0?new Set:new Set(Array.isArray(e)?e:[e])}var mO=64,hO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,gO=128,_O=/^[a-zA-Z_][a-zA-Z0-9_]*$/,vO=K.check(db(mO),eb(hO)),yO=vO.pipe(Uy(`ProviderDriverKind`)),bO=gy(yO),xO=e=>bO(e),SO=vO.pipe(Uy(`ProviderInstanceId`));z({instanceId:SO,driver:yO});var CO=B(z({name:K.check(db(gO),eb(_O)),value:L.pipe(W(M(``))),sensitive:R.pipe(W(M(!1))),valueRedacted:P(R)})),wO=z({driver:yO,displayName:F(K),accentColor:F(K),environment:P(CO),enabled:P(R),config:P(jy)});Iy(SO,wO);var TO=e=>SO.make(e);H([`select`,`boolean`]);var EO=z({id:K,label:K,description:F(K),isDefault:F(R)}),DO={id:K,label:K,description:F(K)},OO=V([z({...DO,type:I(`select`),options:B(EO),currentValue:F(K),promptInjectedValues:F(B(K))}),z({...DO,type:I(`boolean`),currentValue:F(R)})]),kO=z({id:K,value:V([K,R])}),AO=Iy(L,jy).pipe(Wy(B(kO),og({decode:e=>M(MO(e)),encode:e=>M(NO(e))}))),jO=V([B(kO),AO]);function MO(e){let t=[];for(let[n,r]of Object.entries(e)){let e=typeof n==`string`?n.trim():``;if(e.length!==0)if(typeof r==`string`){let n=r.trim();n.length>0&&t.push({id:e,value:n})}else typeof r==`boolean`&&t.push({id:e,value:r})}return t}function NO(e){let t={};for(let{id:n,value:r}of e)t[n]=r;return t}var PO=z({optionDescriptors:F(B(OO))}),FO=yO.make(`codex`),IO=yO.make(`claudeAgent`),LO=yO.make(`cursor`),RO=yO.make(`grok`),zO=yO.make(`muse`),BO=yO.make(`opencode`),VO=`gpt-5.6-sol`,HO=`gpt-5.6-luna`,UO={[FO]:VO,[IO]:`claude-sonnet-5`,[LO]:`auto`,[RO]:`grok-build`,[zO]:`muse-spark-1.2`,[BO]:`openai/gpt-5`},WO={[FO]:HO,[IO]:`claude-haiku-4-5`,[LO]:`composer-2`,[zO]:`muse-spark-1.2-contributor`,[BO]:`openai/gpt-5`},GO={[FO]:{"gpt-5-codex":`gpt-5.4`,"5.4":`gpt-5.4`,"5.3":`gpt-5.3-codex`,"gpt-5.3":`gpt-5.3-codex`,"5.3-spark":`gpt-5.3-codex-spark`,"gpt-5.3-spark":`gpt-5.3-codex-spark`},[IO]:{opus:`claude-opus-5`,"opus-5":`claude-opus-5`,"claude-opus-5.0":`claude-opus-5`,"claude-opus-5-0":`claude-opus-5`,"opus-4.8":`claude-opus-4-8`,"claude-opus-4.8":`claude-opus-4-8`,"opus-4.7":`claude-opus-4-7`,"claude-opus-4.7":`claude-opus-4-7`,"opus-4.6":`claude-opus-4-6`,"claude-opus-4.6":`claude-opus-4-6`,"claude-opus-4-6-20251117":`claude-opus-4-6`,sonnet:`claude-sonnet-5`,"sonnet-5":`claude-sonnet-5`,"claude-sonnet-5.0":`claude-sonnet-5`,"claude-sonnet-5-0":`claude-sonnet-5`,"sonnet-4.6":`claude-sonnet-4-6`,"claude-sonnet-4.6":`claude-sonnet-4-6`,"claude-sonnet-4-6-20251117":`claude-sonnet-4-6`,haiku:`claude-haiku-4-5`,"haiku-4.5":`claude-haiku-4-5`,"claude-haiku-4.5":`claude-haiku-4-5`,"claude-haiku-4-5-20251001":`claude-haiku-4-5`},[LO]:{composer:`composer-2`,"composer-1.5":`composer-1.5`,"composer-1":`composer-1.5`,"opus-4.6-thinking":`claude-opus-4-6`,"opus-4.6":`claude-opus-4-6`,"sonnet-4.6-thinking":`claude-sonnet-4-6`,"sonnet-4.6":`claude-sonnet-4-6`,"opus-4.5-thinking":`claude-opus-4-5`,"opus-4.5":`claude-opus-4-5`},[BO]:{}},KO={[FO]:`Codex`,[IO]:`Claude`,[LO]:`Cursor`,[RO]:`Grok`,[zO]:`Muse Code`,[BO]:`OpenCode`},qO={dispatchCommand:`orchestration.dispatchCommand`,getTurnDiff:`orchestration.getTurnDiff`,getFullThreadDiff:`orchestration.getFullThreadDiff`,getArchivedShellSnapshot:`orchestration.getArchivedShellSnapshot`,subscribeShell:`orchestration.subscribeShell`,subscribeThread:`orchestration.subscribeThread`},JO=H([`untrusted`,`on-failure`,`on-request`,`never`]),YO=H([`read-only`,`workspace-write`,`danger-full-access`]),XO=z({instanceId:SO,model:K,options:P(jO)}),ZO=z({provider:F(jy),instanceId:F(jy),model:jy,options:F(jy)}).pipe(Wy(XO,og({decode:e=>{let t={instanceId:e.instanceId===void 0?typeof e.provider==`string`?e.provider:void 0:e.instanceId,model:e.model};return e.options!==void 0&&(t.options=e.options),M(t)},encode:e=>{let t={model:e.model,instanceId:e.instanceId};return e.options!==void 0&&(t.options=e.options),M(t)}}))),QO=H([`approval-required`,`auto-accept-edits`,`auto`,`full-access`]),$O=`full-access`,ek=H([`default`,`plan`]),tk=`default`,nk=H([`off`,`lite`,`full`,`ultra`]),rk=`full`,ik=H([`command`,`file-read`,`file-change`]);H([`buffered`,`streaming`]);var ak=H([`accept`,`acceptForSession`,`decline`,`cancel`]),ok=Iy(L,jy),sk=12e4,ck=10*1024*1024,lk=14e6,uk=K.check(db(128),eb(/^[a-z0-9_-]+$/i)),dk=z({type:I(`image`),id:uk,name:K.check(db(255)),mimeType:K.check(db(100),eb(/^image\//i)),sizeBytes:q.check(ob(ck))}),fk=z({type:I(`image`),name:K.check(db(255)),mimeType:K.check(db(100),eb(/^image\//i)),sizeBytes:q.check(ob(ck)),dataUrl:K.check(db(lk))}),pk=V([dk]),mk=V([fk]),hk=H([`play`,`test`,`lint`,`configure`,`build`,`debug`]),gk=z({id:K,name:K,command:K,icon:hk,runOnWorktreeCreate:R,previewUrl:F(K),autoOpenPreview:F(R)}),_k=z({id:Jb,title:K,workspaceRoot:K,repositoryIdentity:F(U(Kw)),defaultModelSelection:U(ZO),scripts:B(gk),createdAt:J,updatedAt:J,deletedAt:U(J)}),vk=H([`user`,`assistant`,`system`]),yk=z({id:$b,role:vk,text:L,attachments:F(B(pk)),turnId:U(ex),streaming:R,createdAt:J,updatedAt:J}),bk=K,xk=z({id:bk,turnId:U(ex),planMarkdown:K,implementedAt:U(J).pipe(W(M(null))),implementationThreadId:U(Y).pipe(W(M(null))),createdAt:J,updatedAt:J}),Sk=z({threadId:Y,planId:bk}),Ck=z({threadId:Y,status:H([`idle`,`starting`,`running`,`ready`,`interrupted`,`stopped`,`error`]),providerName:U(K),providerInstanceId:F(SO),runtimeMode:QO.pipe(W(M($O))),activeTurnId:U(ex),lastError:U(K),updatedAt:J}),wk=z({path:K,kind:K,additions:q,deletions:q}),Tk=H([`ready`,`missing`,`error`]),Ek=z({turnId:ex,checkpointTurnCount:q,checkpointRef:ax,status:Tk,files:B(wk),assistantMessageId:U($b),completedAt:J}),Dk=z({id:Qb,tone:H([`info`,`tool`,`approval`,`error`]),kind:K,summary:K,payload:jy,turnId:U(ex),sequence:F(q),createdAt:J}),Ok=z({turnId:ex,state:H([`running`,`interrupted`,`completed`,`error`]),requestedAt:J,startedAt:U(J),completedAt:U(J),assistantMessageId:U($b),sourceProposedPlan:F(Sk)}),kk=z({id:Y,projectId:Jb,title:K,modelSelection:ZO,runtimeMode:QO,interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),branch:U(K),worktreePath:U(K),latestTurn:U(Ok),createdAt:J,updatedAt:J,archivedAt:U(J).pipe(W(M(null))),settledOverride:U(H([`settled`,`active`])).pipe(W(M(null))),settledAt:U(J).pipe(W(M(null))),snoozedUntil:F(U(J)),snoozedAt:F(U(J)),deletedAt:U(J),messages:B(yk),proposedPlans:B(xk).pipe(W(M([]))),activities:B(Dk),checkpoints:B(Ek),session:U(Ck)}),Ak=z({snapshotSequence:q,projects:B(_k),threads:B(kk),updatedAt:J}),jk=z({id:Jb,title:K,workspaceRoot:K,repositoryIdentity:F(U(Kw)),defaultModelSelection:U(ZO),scripts:B(gk),createdAt:J,updatedAt:J}),Mk=z({id:Y,projectId:Jb,title:K,modelSelection:ZO,runtimeMode:QO,interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),branch:U(K),worktreePath:U(K),latestTurn:U(Ok),createdAt:J,updatedAt:J,archivedAt:U(J).pipe(W(M(null))),settledOverride:U(H([`settled`,`active`])).pipe(W(M(null))),settledAt:U(J).pipe(W(M(null))),snoozedUntil:F(U(J)),snoozedAt:F(U(J)),session:U(Ck),latestUserMessageAt:U(J),hasPendingApprovals:R,hasPendingUserInput:R,hasActionableProposedPlan:R}),Nk=z({snapshotSequence:q,projects:B(jk),threads:B(Mk),updatedAt:J}),Pk=V([z({kind:I(`project-upserted`),sequence:q,project:jk}),z({kind:I(`project-removed`),sequence:q,projectId:Jb}),z({kind:I(`thread-upserted`),sequence:q,thread:Mk}),z({kind:I(`thread-removed`),sequence:q,threadId:Y})]),Fk=V([z({kind:I(`synchronized`)}),z({kind:I(`snapshot`),snapshot:Nk}),Pk]),Ik=z({afterSequence:P(q),requestCompletionMarker:P(R)}),Lk=z({threadId:Y,afterSequence:P(q),requestCompletionMarker:P(R)}),Rk=z({snapshotSequence:q,thread:kk}),zk=z({type:I(`project.create`),commandId:Zb,projectId:Jb,title:K,workspaceRoot:K,createWorkspaceRootIfMissing:F(R),defaultModelSelection:F(U(ZO)),createdAt:J}),Bk=z({type:I(`project.meta.update`),commandId:Zb,projectId:Jb,title:F(K),workspaceRoot:F(K),defaultModelSelection:F(U(ZO)),scripts:F(B(gk))}),Vk=z({type:I(`project.delete`),commandId:Zb,projectId:Jb,force:F(R)}),Hk=z({type:I(`thread.create`),commandId:Zb,threadId:Y,projectId:Jb,title:K,modelSelection:ZO,runtimeMode:QO,interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),branch:U(K),worktreePath:U(K),createdAt:J}),Uk=z({type:I(`thread.delete`),commandId:Zb,threadId:Y}),Wk=z({type:I(`thread.archive`),commandId:Zb,threadId:Y}),Gk=z({type:I(`thread.unarchive`),commandId:Zb,threadId:Y}),Kk=z({type:I(`thread.settle`),commandId:Zb,threadId:Y}),qk=z({type:I(`thread.unsettle`),commandId:Zb,threadId:Y,reason:I(`user`)}),Jk=z({type:I(`thread.snooze`),commandId:Zb,threadId:Y,snoozedUntil:J}),Yk=z({type:I(`thread.unsnooze`),commandId:Zb,threadId:Y,reason:I(`user`)}),Xk=z({type:I(`thread.meta.update`),commandId:Zb,threadId:Y,title:F(K),modelSelection:F(ZO),branch:F(U(K)),expectedBranch:F(U(K)),worktreePath:F(U(K))}),Zk=z({type:I(`thread.runtime-mode.set`),commandId:Zb,threadId:Y,runtimeMode:QO,createdAt:J}),Qk=z({type:I(`thread.interaction-mode.set`),commandId:Zb,threadId:Y,interactionMode:ek,createdAt:J}),$k=z({type:I(`thread.compress-mode.set`),commandId:Zb,threadId:Y,compressMode:nk,createdAt:J}),eA=z({type:I(`thread.unprompted-subagents.set`),commandId:Zb,threadId:Y,unpromptedSubagents:R,createdAt:J}),tA=z({projectId:Jb,title:K,modelSelection:ZO,runtimeMode:QO,interactionMode:ek,compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),branch:U(K),worktreePath:U(K),createdAt:J}),nA=z({projectCwd:K,baseBranch:K,branch:F(K),startFromOrigin:F(R)}),rA=z({createThread:F(tA),prepareWorktree:F(nA),runSetupScript:F(R)}),iA=z({type:I(`thread.turn.start`),commandId:Zb,threadId:Y,message:z({messageId:$b,role:I(`user`),text:L,attachments:B(pk)}),modelSelection:F(ZO),titleSeed:F(K),runtimeMode:QO.pipe(W(M($O))),interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),bootstrap:F(rA),sourceProposedPlan:F(Sk),createdAt:J}),aA=z({type:I(`thread.turn.start`),commandId:Zb,threadId:Y,message:z({messageId:$b,role:I(`user`),text:L,attachments:B(mk)}),modelSelection:F(ZO),titleSeed:F(K),runtimeMode:QO,interactionMode:ek,compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),bootstrap:F(rA),sourceProposedPlan:F(Sk),createdAt:J}),oA=z({type:I(`thread.turn.interrupt`),commandId:Zb,threadId:Y,turnId:F(ex),createdAt:J}),sA=z({type:I(`thread.approval.respond`),commandId:Zb,threadId:Y,requestId:ix,decision:ak,createdAt:J}),cA=z({type:I(`thread.user-input.respond`),commandId:Zb,threadId:Y,requestId:ix,answers:ok,createdAt:J}),lA=z({type:I(`thread.checkpoint.revert`),commandId:Zb,threadId:Y,turnCount:q,createdAt:J}),uA=z({type:I(`thread.session.stop`),commandId:Zb,threadId:Y,createdAt:J}),dA=V([zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k,eA,iA,oA,sA,cA,lA,uA]),fA=V([zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k,eA,aA,oA,sA,cA,lA,uA]);V([dA,V([z({type:I(`thread.session.set`),commandId:Zb,threadId:Y,session:Ck,createdAt:J}),z({type:I(`thread.message.assistant.delta`),commandId:Zb,threadId:Y,messageId:$b,delta:L,turnId:F(ex),createdAt:J}),z({type:I(`thread.message.assistant.complete`),commandId:Zb,threadId:Y,messageId:$b,turnId:F(ex),createdAt:J}),z({type:I(`thread.proposed-plan.upsert`),commandId:Zb,threadId:Y,proposedPlan:xk,createdAt:J}),z({type:I(`thread.turn.diff.complete`),commandId:Zb,threadId:Y,turnId:ex,completedAt:J,checkpointRef:ax,status:Tk,files:B(wk),assistantMessageId:F($b),checkpointTurnCount:q,createdAt:J}),z({type:I(`thread.activity.append`),commandId:Zb,threadId:Y,activity:Dk,createdAt:J}),z({type:I(`thread.revert.complete`),commandId:Zb,threadId:Y,turnCount:q,createdAt:J})])]),H(`project.created,project.meta-updated,project.deleted,thread.created,thread.deleted,thread.archived,thread.unarchived,thread.settled,thread.unsettled,thread.snoozed,thread.unsnoozed,thread.meta-updated,thread.runtime-mode-set,thread.interaction-mode-set,thread.compress-mode-set,thread.unprompted-subagents-set,thread.message-sent,thread.turn-start-requested,thread.turn-interrupt-requested,thread.approval-response-requested,thread.user-input-response-requested,thread.checkpoint-revert-requested,thread.reverted,thread.session-stop-requested,thread.session-set,thread.proposed-plan-upserted,thread.turn-diff-completed,thread.activity-appended`.split(`,`));var pA=H([`project`,`thread`]);H([`client`,`server`,`provider`]);var mA=z({projectId:Jb,title:K,workspaceRoot:K,repositoryIdentity:F(U(Kw)),defaultModelSelection:U(ZO),scripts:B(gk),createdAt:J,updatedAt:J}),hA=z({projectId:Jb,title:F(K),workspaceRoot:F(K),repositoryIdentity:F(U(Kw)),defaultModelSelection:F(U(ZO)),scripts:F(B(gk)),updatedAt:J}),gA=z({projectId:Jb,deletedAt:J}),_A=z({threadId:Y,projectId:Jb,title:K,modelSelection:ZO,runtimeMode:QO.pipe(W(M($O))),interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),branch:U(K),worktreePath:U(K),createdAt:J,updatedAt:J}),vA=z({threadId:Y,deletedAt:J}),yA=z({threadId:Y,archivedAt:J,updatedAt:J}),bA=z({threadId:Y,updatedAt:J}),xA=z({threadId:Y,settledAt:J,updatedAt:J}),SA=z({threadId:Y,reason:H([`user`,`activity`]),updatedAt:J}),CA=z({threadId:Y,snoozedUntil:J,snoozedAt:J,updatedAt:J}),wA=z({threadId:Y,reason:H([`user`,`activity`]),updatedAt:J}),TA=z({threadId:Y,title:F(K),modelSelection:F(ZO),branch:F(U(K)),worktreePath:F(U(K)),updatedAt:J}),EA=z({threadId:Y,runtimeMode:QO,updatedAt:J}),DA=z({threadId:Y,interactionMode:ek.pipe(W(M(tk))),updatedAt:J}),OA=z({threadId:Y,compressMode:nk.pipe(W(M(rk))),updatedAt:J}),kA=z({threadId:Y,unpromptedSubagents:R.pipe(W(M(!0))),updatedAt:J}),AA=z({threadId:Y,messageId:$b,role:vk,text:L,attachments:F(B(pk)),turnId:U(ex),streaming:R,createdAt:J,updatedAt:J}),jA=z({threadId:Y,messageId:$b,modelSelection:F(ZO),titleSeed:F(K),runtimeMode:QO.pipe(W(M($O))),interactionMode:ek.pipe(W(M(tk))),compressMode:nk.pipe(W(M(rk))),unpromptedSubagents:R.pipe(W(M(!0))),sourceProposedPlan:F(Sk),createdAt:J}),MA=z({threadId:Y,turnId:F(ex),createdAt:J}),NA=z({threadId:Y,requestId:ix,decision:ak,createdAt:J}),PA=z({threadId:Y,requestId:ix,answers:ok,createdAt:J}),FA=z({threadId:Y,turnCount:q,createdAt:J}),IA=z({threadId:Y,turnCount:q}),LA=z({threadId:Y,createdAt:J}),RA=z({threadId:Y,session:Ck}),zA=z({threadId:Y,proposedPlan:xk}),BA=z({threadId:Y,turnId:ex,checkpointTurnCount:q,checkpointRef:ax,status:Tk,files:B(wk),assistantMessageId:U($b),completedAt:J}),VA=z({threadId:Y,activity:Dk}),HA=z({providerTurnId:F(K),providerItemId:F(nx),adapterKey:F(K),requestId:F(ix),ingestedAt:F(J)}),UA={sequence:q,eventId:Qb,aggregateKind:pA,aggregateId:V([Jb,Y]),occurredAt:J,commandId:U(Zb),causationEventId:U(Qb),correlationId:U(Zb),metadata:HA},WA=V([z({...UA,type:I(`project.created`),payload:mA}),z({...UA,type:I(`project.meta-updated`),payload:hA}),z({...UA,type:I(`project.deleted`),payload:gA}),z({...UA,type:I(`thread.created`),payload:_A}),z({...UA,type:I(`thread.deleted`),payload:vA}),z({...UA,type:I(`thread.archived`),payload:yA}),z({...UA,type:I(`thread.unarchived`),payload:bA}),z({...UA,type:I(`thread.settled`),payload:xA}),z({...UA,type:I(`thread.unsettled`),payload:SA}),z({...UA,type:I(`thread.snoozed`),payload:CA}),z({...UA,type:I(`thread.unsnoozed`),payload:wA}),z({...UA,type:I(`thread.meta-updated`),payload:TA}),z({...UA,type:I(`thread.runtime-mode-set`),payload:EA}),z({...UA,type:I(`thread.interaction-mode-set`),payload:DA}),z({...UA,type:I(`thread.compress-mode-set`),payload:OA}),z({...UA,type:I(`thread.unprompted-subagents-set`),payload:kA}),z({...UA,type:I(`thread.message-sent`),payload:AA}),z({...UA,type:I(`thread.turn-start-requested`),payload:jA}),z({...UA,type:I(`thread.turn-interrupt-requested`),payload:MA}),z({...UA,type:I(`thread.approval-response-requested`),payload:NA}),z({...UA,type:I(`thread.user-input-response-requested`),payload:PA}),z({...UA,type:I(`thread.checkpoint-revert-requested`),payload:FA}),z({...UA,type:I(`thread.reverted`),payload:IA}),z({...UA,type:I(`thread.session-stop-requested`),payload:LA}),z({...UA,type:I(`thread.session-set`),payload:RA}),z({...UA,type:I(`thread.proposed-plan-upserted`),payload:zA}),z({...UA,type:I(`thread.turn-diff-completed`),payload:BA}),z({...UA,type:I(`thread.activity-appended`),payload:VA})]),GA=V([z({kind:I(`synchronized`)}),z({kind:I(`snapshot`),snapshot:Rk}),z({kind:I(`event`),event:WA})]);H([`accepted`,`rejected`]);var KA=z({fromTurnCount:q,toTurnCount:q}).check(Zy(e=>e.fromTurnCount<=e.toTurnCount||new hh(Fr(e.fromTurnCount),{message:`fromTurnCount must be less than or equal to toTurnCount`}),{identifier:`OrchestrationTurnDiffRange`})),qA=KA.mapFields(cy({threadId:Y,diff:L}),{unsafePreserveChecks:!0});H([`starting`,`running`,`stopped`,`error`]),H([`running`,`completed`,`interrupted`,`error`]),z({threadId:Y,turnId:ex,checkpointTurnCount:q,checkpointRef:ax,status:Tk,files:B(wk),assistantMessageId:U($b),completedAt:J}),H([`pending`,`resolved`]),U(ak);var JA=z({sequence:q}),YA=KA.mapFields(cy({threadId:Y,ignoreWhitespace:P(R)}),{unsafePreserveChecks:!0}),XA=qA,ZA=z({threadId:Y,toTurnCount:q,ignoreWhitespace:P(R)}),QA={dispatchCommand:{input:fA,output:JA},getTurnDiff:{input:YA,output:XA},getFullThreadDiff:{input:ZA,output:qA},getArchivedShellSnapshot:{input:z({}),output:Nk},subscribeThread:{input:Lk,output:GA},subscribeShell:{input:Ik,output:Fk}},$A=class extends G()(`OrchestrationGetSnapshotError`,{message:K,cause:F(Cb())}){},ej=class extends G()(`OrchestrationDispatchCommandError`,{message:K,cause:F(Cb())}){},tj=class extends G()(`OrchestrationGetTurnDiffError`,{message:K,cause:F(Cb())}){},nj=class extends G()(`OrchestrationGetFullThreadDiffError`,{message:K,cause:F(Cb())}){},rj=z({authorization:P(L),dpop:P(L)}),ij=z({dpop:P(L)}),aj=H([`invalid_scope`,`scope_not_granted`,`invalid_command`]),oj=H([`missing_credential`,`invalid_credential`]),sj=H([`current_session_revoke_not_allowed`]),cj=H([`bootstrap_validation_failed`,`browser_session_issuance_failed`,`browser_session_cookie_failed`,`access_token_issuance_failed`,`websocket_ticket_issuance_failed`,`pairing_credential_issuance_failed`,`pairing_links_load_failed`,`pairing_link_revoke_failed`,`client_sessions_load_failed`,`client_session_revoke_failed`,`orchestration_snapshot_failed`,`orchestration_thread_snapshot_failed`,`orchestration_dispatch_failed`,`internal_error`]),lj=class e extends G()(`EnvironmentRequestInvalidError`,{code:I(`invalid_request`),reason:aj,traceId:K},{httpApiStatus:400}){[eE](){return ZT(e)(this,{status:400})}},uj=class e extends G()(`EnvironmentAuthInvalidError`,{code:I(`auth_invalid`),reason:oj,traceId:K},{httpApiStatus:401}){[eE](){return ZT(e)(this,{status:401})}},dj=class e extends G()(`EnvironmentScopeRequiredError`,{code:I(`insufficient_scope`),requiredScope:fw,traceId:K},{httpApiStatus:403}){[eE](){return ZT(e)(this,{status:403})}},fj=class e extends G()(`EnvironmentOperationForbiddenError`,{code:I(`operation_forbidden`),reason:sj,traceId:K},{httpApiStatus:403}){[eE](){return ZT(e)(this,{status:403})}},pj=class e extends G()(`EnvironmentInternalError`,{code:I(`internal_error`),reason:cj,traceId:K},{httpApiStatus:500}){[eE](){return ZT(e)(this,{status:500})}},mj=H([`thread_not_found`]),hj=class e extends G()(`EnvironmentResourceNotFoundError`,{code:I(`not_found`),reason:mj,traceId:K},{httpApiStatus:404}){[eE](){return ZT(e)(this,{status:404})}},gj=V([lj,uj,dj,fj,hj,pj]),_j=[uj,pj];G()(`EnvironmentHttpBadRequestError`,{message:L},{httpApiStatus:400}),G()(`EnvironmentHttpUnauthorizedError`,{message:L},{httpApiStatus:401}),G()(`EnvironmentHttpForbiddenError`,{message:L},{httpApiStatus:403}),G()(`EnvironmentHttpInternalServerError`,{message:L},{httpApiStatus:500}),G()(`EnvironmentHttpConflictError`,{message:L},{httpApiStatus:409});var vj=[uj,pj],yj=[lj,uj,pj],bj=[dj,pj],boe=[lj,...bj],xoe=[dj,fj,pj],xj=[dj,pj],Soe=[dj,hj,pj],Coe=[lj,dj,pj];ti()(`@p4code/contracts/environmentHttp/EnvironmentAuthenticatedPrincipal`);var Sj=class extends fO()(`EnvironmentAuthenticatedAuth`,{error:_j}){},woe=z({revoked:R}),Toe=z({revoked:R}),Eoe=z({revokedCount:Ny}),Doe=class extends lO(`metadata`).add(XD(`descriptor`,`/.well-known/p4/environment`,{success:Gw})){},Ooe=class extends lO(`auth`).add(XD(`session`,`/api/auth/session`,{headers:rj,success:zw,error:[pj]})).add(ZD(`browserSession`,`/api/auth/browser-session`,{payload:bw,success:xw,error:vj})).add(ZD(`token`,`/oauth/token`,{headers:ij,payload:Cw,success:ww,error:yj})).add(ZD(`webSocketTicket`,`/api/auth/websocket-ticket`,{headers:rj,success:Tw,error:[pj]}).middleware(Sj)).add(ZD(`pairingCredential`,`/api/auth/pairing-token`,{headers:rj,payload:Rw,success:Ew,error:boe}).middleware(Sj)).add(XD(`pairingLinks`,`/api/auth/pairing-links`,{headers:rj,success:B(Dw),error:bj}).middleware(Sj)).add(ZD(`revokePairingLink`,`/api/auth/pairing-links/revoke`,{headers:rj,payload:Iw,success:woe,error:bj}).middleware(Sj)).add(XD(`clients`,`/api/auth/clients`,{headers:rj,success:B(Ow),error:bj}).middleware(Sj)).add(ZD(`revokeClient`,`/api/auth/clients/revoke`,{headers:rj,payload:Lw,success:Toe,error:xoe}).middleware(Sj)).add(ZD(`revokeOtherClients`,`/api/auth/clients/revoke-others`,{headers:rj,success:Eoe,error:bj}).middleware(Sj)){},koe=z({threadId:Y}),Aoe=class extends lO(`orchestration`).add(XD(`snapshot`,`/api/orchestration/snapshot`,{headers:rj,success:Ak,error:xj}).middleware(Sj)).add(XD(`shellSnapshot`,`/api/orchestration/shell`,{headers:rj,success:Nk,error:xj}).middleware(Sj)).add(XD(`threadSnapshot`,`/api/orchestration/threads/:threadId`,{headers:rj,params:koe,success:Rk,error:Soe}).middleware(Sj)).add(ZD(`dispatch`,`/api/orchestration/dispatch`,{headers:rj,payload:fA,success:JA,error:Coe}).middleware(Sj)){},joe=class extends nO(`environment`).add(Doe).add(Ooe).add(Aoe){};z({mode:I(`desktop`),noBrowser:R,port:Kb,p4Home:F(L),host:L,desktopBootstrapToken:L,tailscaleServeEnabled:R,tailscaleServePort:Kb,otlpTracesUrl:F(L),otlpMetricsUrl:F(L)});var Moe=H([`core`,`private-network`,`tunnel`,`manual`]),Noe=H([`loopback`,`lan`,`private-network`,`public`]),Poe=H([`compatible`,`mixed-content-blocked`,`requires-configuration`,`unknown`]),Foe=H([`available`,`unavailable`,`unknown`]),Ioe=H([`desktop-core`,`desktop-addon`,`server`,`user`]);z({id:K,label:K,provider:z({id:K,label:K,kind:Moe,isAddon:R}),httpBaseUrl:K,wsBaseUrl:K,reachability:Noe,compatibility:z({hostedHttpsApp:Poe,desktopApp:H([`compatible`,`unknown`])}),source:Ioe,status:Foe,isDefault:F(R),description:F(K)});var Loe=e=>()=>{let t=vy(zy(e));return Yx((e,n)=>M(_f(e,e=>t(e))))},Cj=`~effect/platform/Crypto`,wj=ti(`effect/Crypto`),Roe=e=>{let t=e.randomBytes,n=e=>Cf(zoe(`randomBytes`,e),t),r=()=>{let e=t(7);return((e[0]&31)*2**48+e[1]*2**40+e[2]*2**32+e[3]*2**24+e[4]*2**16+e[5]*2**8+e[6])/2**53},i=()=>Math.floor(r()*(2**53-1- -(2**53-1)+1))+-(2**53-1);return wj.of({[Cj]:Cj,randomBytes:n,nextDoubleUnsafe:r,nextIntUnsafe:i,digest:e.digest,random:sf(()=>r()),randomBoolean:sf(()=>r()>.5),randomInt:sf(()=>i()),randomBetween:(e,t)=>sf(()=>r()*(t-e)+e),randomIntBetween(e,t,n){let i=n?.halfOpen===!0?0:1;return sf(()=>{let n=Math.ceil(e),a=Math.floor(t);return Math.floor(r()*(a-n+i))+n})},randomShuffle:e=>sf(()=>{let t=Array.from(e);for(let e=t.length-1;e>=1;--e){let n=Math.min(e,Math.floor(r()*(e+1))),i=t[e];t[e]=t[n],t[n]=i}return t}),randomUUIDv4:sf(()=>Voe(t(16))),randomUUIDv7:Ip(e=>M(Uoe(e.currentTimeMillisUnsafe(),t(16))))})},zoe=(e,t)=>Number.isSafeInteger(t)&&t>=0?M(t):ff(Xw({module:`Crypto`,method:e,description:`size must be a non-negative safe integer`})),Boe=e=>e.toString(16).padStart(2,`0`),Tj=e=>[e.subarray(0,4),e.subarray(4,6),e.subarray(6,8),e.subarray(8,10),e.subarray(10,16)].map(e=>Array.from(e,Boe).join(``)).join(`-`),Voe=e=>(e[6]=e[6]&15|64,e[8]=e[8]&63|128,Tj(e)),Hoe=2**48-1,Uoe=(e,t)=>{let n=Math.min(Math.max(0,Math.trunc(e)),Hoe);return t[0]=Math.floor(n/2**40),t[1]=Math.floor(n/2**32)&255,t[2]=Math.floor(n/2**24)&255,t[3]=Math.floor(n/2**16)&255,t[4]=Math.floor(n/2**8)&255,t[5]=n&255,t[6]=t[6]&15|112,t[8]=t[8]&63|128,Tj(t)},Woe=`~effect/interfaces/PrimaryKey`,Ej=`~effect/ManagedRuntime`,Dj=(e,t)=>{let n=t?.memoMap??Hl(),r=Al(`parallel`),i=Pl(r,`sequential`),a={onFiberStart:ux(r)},o=e=>e?{...e,onFiberStart:e.onFiberStart?t=>{a.onFiberStart(t),e.onFiberStart(t)}:a.onFiberStart}:a,s,c=gf(t=>(s||=Sp(bf(Gl(e,n,i),e=>sf(()=>{l.cachedContext=e})),{...a,scheduler:t.currentScheduler}),vf(ox(s)))),l={[Ej]:Ej,memoMap:n,scope:r,contextEffect:c,cachedContext:void 0,context(){return l.cachedContext===void 0?Ep(l.contextEffect):Promise.resolve(l.cachedContext)},dispose(){return Ep(l.disposeEffect)},[Symbol.asyncDispose](){return l.dispose()},disposeEffect:of(()=>(l.contextEffect=qne(`ManagedRuntime disposed`),l.cachedContext=void 0,Fl(l.scope,fl))),runFork(e,t){return l.cachedContext===void 0?Sp(Oj(l,e),o(t)):Cp(l.cachedContext)(e,o(t))},runCallback(e,t){return l.cachedContext===void 0?Tp(Oj(l,e),o(t)):wp(l.cachedContext)(e,o(t))},runSyncExit(e){return l.cachedContext===void 0?Mp(Oj(l,e)):Np(l.cachedContext)(e)},runSync(e){return l.cachedContext===void 0?Ap(Oj(l,e)):jp(l.cachedContext)(e)},runPromiseExit(e,t){return l.cachedContext===void 0?Op(Oj(l,e),o(t)):kp(l.cachedContext)(e,o(t))},runPromise(e,t){return l.cachedContext===void 0?Ep(Oj(l,e),o(t)):Dp(l.cachedContext)(e,o(t))}};return l};function Oj(e,t){return _f(e.contextEffect,e=>Kf(t,e))}var kj=class extends ti()(`effect/reactivity/Reactivity`){},Goe=sf(()=>{let e=new Map,t=t=>{Nj(t,t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})},n=e=>Wf(n=>{let r=n.mapUnsafe.get(Aj.key);return r?Nj(e,e=>{r.add(e)}):t(e),cf}),r=(e,t)=>bf(t,n(e)),i=(t,n)=>{let r=[];return Nj(t,t=>{r.push(t);let i=e.get(t);i===void 0&&(i=new Set,e.set(t,i)),i.add(n)}),()=>{for(let t=0;t<r.length;t++){let i=e.get(r[t]);i.delete(n),i.size===0&&e.delete(r[t])}}},a=(e,t)=>df(function*(){let n=yield*Uf(),r=di(n,Ol),a=yield*Tx(),o=ze(Cp(n),ux(r)),s=!1,c=!1,l=e=>{e._tag===`Failure`?jx(a,e.cause):kx(a,e.value),c?(c=!1,o(t).addObserver(l)):s=!1};function u(){if(s){c=!0;return}s=!0,o(t).addObserver(l)}return yield*Nl(r,sf(i(e,u))),u(),a});return kj.of({mutation:r,query:a,stream:(e,t)=>a(e,t).pipe(Cf(rC),aC),invalidateUnsafe:t,invalidate:n,registerUnsafe:i,withBatch:t=>of(()=>{let n=new Set;return t.pipe(Yf(Aj,n),np(t=>sf(()=>{n.forEach(t=>{let n=e.get(t);n!==void 0&&n.forEach(e=>e())})})))})})}),Aj=class extends ti()(`effect/reactivity/Reactivity/PendingInvalidation`){},Koe=j(2,(e,t)=>kj.use(n=>n.mutation(t,e))),qoe=e=>kj.use(t=>t.invalidate(e)),jj=Ql(kj)(Goe);function Mj(e){switch(typeof e){case`string`:case`number`:case`bigint`:case`boolean`:return String(e);default:return st(e)}}var Nj=(e,t)=>{if(Array.isArray(e)){for(let n=0;n<e.length;n++)t(Mj(e[n]));return}for(let n in e){t(n);let r=e[n];for(let e=0;e<r.length;e++)t(`${n}:${Mj(r[e])}`)}},Pj=`~effect/SubscriptionRef`,Fj=e=>nt(e,Pj),Joe={...un,[Pj]:{_A:je},toJSON(){return{_id:`SubscriptionRef`,value:this.value}}},Ij=e=>Cf(Cie({replay:1}),t=>{let n=Object.create(Joe);return n.semaphore=Wx(1),n.value=e,n.pubsub=t,Sx(n.pubsub,e),n}),Lj=e=>Cae(e.pubsub),Rj=e=>sf(()=>e.value),zj=(e,t)=>{e.value=t,Sx(e.pubsub,t)},Bj=j(2,(e,t)=>e.semaphore.withPermit(sf(()=>zj(e,t)))),Vj=j(2,(e,t)=>e.semaphore.withPermit(sf(()=>zj(e,t(e.value))))),Hj=K.check(db(2048)),Uj=L.check(db(512)),Wj=K.check(db(128)),Gj=3840,Kj=3840*2160,qj=cb.check(sb({minimum:240,maximum:Gj})),Jj=Zy(({width:e,height:t})=>e*t<=8294400||`Viewport area must not exceed 8294400 pixels.`),Yj=z({width:qj,height:qj}).check(Jj),Xj=z({width:cb.check(rb(0)),height:cb.check(rb(0))}),Zj=[`iphone-se`,`iphone-xr`,`iphone-12-pro`,`iphone-14-pro-max`,`pixel-7`,`samsung-galaxy-s8-plus`,`samsung-galaxy-s20-ultra`,`ipad-mini`,`ipad-air`,`ipad-pro`,`surface-pro-7`,`surface-duo`,`galaxy-z-fold-5`,`asus-zenbook-fold`,`samsung-galaxy-a51-71`,`nest-hub`,`nest-hub-max`],Yoe=H(Zj),Xoe=[`desktop-1920x1080`,`desktop-1440x900`,`laptop-1366x768`,`laptop-1280x800`,`ipad-pro-11`,`iphone-15-pro`,`pixel-8`,`galaxy-s24`],Zoe=H([...Zj,...Xoe]),Qj=V([Jy(`fill`,{}),Jy(`freeform`,{...Yj.fields}).check(Jj),Jy(`preset`,{...Yj.fields,presetId:Zoe}).check(Jj)]),Qoe={_tag:`fill`},$j=V([Jy(`Idle`,{}),Jy(`Loading`,{url:Hj,title:Uj}),Jy(`Success`,{url:Hj,title:Uj}),Jy(`LoadFailed`,{url:Hj,title:Uj,code:cb,description:L})]),eM=z({threadId:K,tabId:Wj,navStatus:$j,canGoBack:R,canGoForward:R,viewport:F(Qj),updatedAt:L}),$oe=z({threadId:Y,url:F(Hj)}),ese=z({threadId:Y,tabId:Wj,url:Hj,resolvedTitle:F(Uj)}),tse=z({threadId:Y,tabId:Wj,navStatus:$j,canGoBack:R,canGoForward:R}),nse=z({threadId:Y,tabId:Wj}),rse=z({threadId:Y,tabId:Wj,viewport:Qj}),ise=z({threadId:Y,tabId:F(Wj)}),ase=z({threadId:Y}),ose=z({sessions:B(eM),serverEpoch:K,revision:q}),tM=z({threadId:K,tabId:Wj,createdAt:L,serverEpoch:K,revision:Gb}),sse=V([z({...tM.fields,type:I(`opened`),snapshot:eM}),z({...tM.fields,type:I(`navigated`),snapshot:eM}),z({...tM.fields,type:I(`resized`),snapshot:eM}),z({...tM.fields,type:I(`failed`),url:Hj,title:Uj,code:cb,description:L}),z({...tM.fields,type:I(`closed`)})]),cse=z({servers:B(z({host:K,port:cb.check(rb(0)).check(ab(65536)),url:Hj,processName:U(K),pid:U(cb.check(rb(0))),terminal:U(z({threadId:Y,terminalId:K}))})),scannedAt:L}),nM=V([class extends G()(`PreviewSessionLookupError`,{threadId:L,tabId:L}){get message(){return`Unknown preview session: thread=${this.threadId}, tab=${this.tabId}`}},class extends G()(`PreviewInvalidUrlError`,{inputLength:Ny,reason:H([`empty`,`parse`,`unsupported-protocol`,`unexpected`]),protocol:F(L),cause:Cb()}){get message(){let e=this.protocol===void 0?``:`: ${this.protocol}`;return`Invalid preview URL (${this.reason}${e}; input length ${this.inputLength}).`}}]),rM=L.check($y()).check(ub({description:`Absolute http(s) URL or a schemeless host such as p4.chat or localhost:5173. Schemeless public hosts use https; loopback hosts use http.`})).check(db(2048)),iM=F(cb.check(rb(0)).check(ob(6e4)).annotate({description:`Maximum wait in milliseconds. Defaults to 15000; maximum 60000.`})).annotate({description:`Maximum wait in milliseconds. Defaults to 15000; maximum 60000.`}),aM=[`status`,`open`,`navigate`,`snapshot`,`click`,`type`,`press`,`scroll`,`evaluate`,`waitFor`,`recordingStart`,`recordingStop`,`resize`,`setColorScheme`],oM=H(aM),sM={tabId:F(Wj.annotate({description:`Exact collaborative browser tab to target. Omit to use this agent session's current tab.`})).annotate({description:`Exact collaborative browser tab to target. Omit to use this agent session's current tab.`})};z(sM),z({available:R,visible:R,tabId:U(Wj),url:U(L),title:U(L),loading:R,viewportSetting:F(Qj),viewport:F(Xj)}),z({...sM,url:F(rM).annotate({description:`Optional initial page URL, for example https://p4.chat or localhost:5173. Omit to open a blank tab.`}),open:F(R.annotate({description:`Whether to open the thread-bound inline preview for the human. Defaults to true; set false for background-only automation.`})),show:F(R.annotate({description:`Deprecated alias for open. Whether to reveal the thread-bound inline preview to the human.`})),reuseExistingTab:F(R.annotate({description:`Reuse tabId when supplied, otherwise this agent session's current tab. Defaults to true; set false to create a new tab.`}))}).check(Zy(e=>!(e.tabId!==void 0&&e.reuseExistingTab===!1)||`tabId cannot be combined with reuseExistingTab=false.`)).annotate({description:`Opens the collaborative browser for the current thread. Use preview_navigate afterward when readiness waiting matters.`});var lse=V([z({kind:I(`url`).annotate({description:`Selects direct URL navigation.`}),url:rM.annotate({description:`Direct website URL.`})}),z({kind:I(`environment-port`).annotate({description:`Selects a dev-server port relative to the current execution environment.`}),port:cb.check(rb(0)).check(ab(65536)).annotate({description:`Dev-server TCP port inside the current environment.`}),protocol:F(H([`http`,`https`]).annotate({description:`Dev-server protocol. Defaults to http.`})),path:F(L.annotate({description:`Optional path, query, and fragment, for example /settings?tab=account.`}))})]);z({...sM,url:F(rM).annotate({description:`Website URL, for example https://p4.chat. Use this for public pages and directly reachable URLs.`}),target:F(lse.annotate({description:`Environment-relative target. Prefer {kind:'environment-port',port:5173} for a dev server in the current environment.`})).annotate({description:`Environment-relative target. Prefer {kind:'environment-port',port:5173} for a dev server in the current environment.`}),readiness:F(H([`load`,`domContentLoaded`,`none`]).annotate({description:`Readiness milestone before returning. 'load' waits for loading to stop (default), 'domContentLoaded' waits for an interactive document, and 'none' returns immediately.`})).annotate({description:`Readiness milestone before returning. 'load' is the default; use 'none' only when a later wait call will verify the page.`}),timeoutMs:iM}).check(Zy(e=>Number(e.url!==void 0)+Number(e.target!==void 0)===1||`Provide exactly one of url or target.`)).annotate({description:`Navigates the active browser tab. Provide exactly one of url or target; for most public pages use url.`}),z({...sM,mode:H([`fill`,`freeform`,`preset`]).annotate({description:`Viewport mode: fill follows the preview panel, freeform uses exact independently resizable dimensions, and preset uses a named device size.`}),preset:F(Yoe.annotate({description:`Named viewport from Chrome DevTools' standard device catalog.`})).annotate({description:`Named device size. Required only when mode is preset.`}),width:F(Yj.fields.width.annotate({description:`Freeform viewport width in CSS pixels. Required only in freeform mode.`})).annotate({description:`Freeform viewport width in CSS pixels. Required only in freeform mode.`}),height:F(Yj.fields.height.annotate({description:`Freeform viewport height in CSS pixels. Required only in freeform mode.`})).annotate({description:`Freeform viewport height in CSS pixels. Required only in freeform mode.`}),orientation:F(H([`portrait`,`landscape`]).annotate({description:`Orientation for a fixed device preset. Defaults to the preset's native orientation.`})).annotate({description:`Orientation for a named device preset. It is not accepted in fill or freeform mode.`}),timeoutMs:iM}).check(Zy(e=>{let t=e.preset!==void 0,n=e.width!==void 0,r=e.height!==void 0;if(n!==r)return`Custom dimensions require both width and height.`;if(e.mode===`fill`)return!t&&!n&&e.orientation===void 0?!0:`Fill mode does not accept a preset, dimensions, or orientation.`;if(e.mode===`freeform`){if(!n||!r||t||e.orientation!==void 0)return`Freeform mode requires width and height and does not accept a preset or orientation.`}else if(!t||n||r)return`Preset mode requires a preset and does not accept custom dimensions.`;return n&&r&&e.width*e.height>8294400?`Custom viewport area must not exceed ${Kj} pixels.`:!0})).annotate({description:`Sets the active browser tab to fill-panel, independently resizable freeform, or named device-preset sizing.`}),z({tabId:Wj,setting:Qj,viewport:Xj});var cM=H([`system`,`light`,`dark`]);z({...sM,colorScheme:cM.annotate({description:`Emulated prefers-color-scheme for the page: light, dark, or system to follow the OS appearance.`})}).annotate({description:`Emulates prefers-color-scheme in the active browser tab without changing the OS or app theme.`}),z({tabId:Wj,colorScheme:cM});var lM=K.annotate({description:`Playwright selector, preferably role/text based, for example role=button[name='Send'] or text=Continue. Use snapshot first to inspect the page.`}),uM=K.annotate({description:`Legacy CSS selector such as button[type='submit']. Prefer locator for resilient role/text targeting.`}),use=z({...sM,selector:F(uM).annotate({description:`Legacy CSS selector such as button[type='submit']. Prefer locator for resilient role/text targeting.`}),locator:F(lM).annotate({description:`Playwright selector, preferably role/text based, for example role=button[name='Send'] or text=Continue. Use snapshot first to inspect the page.`}),x:F(tb.annotate({description:`Viewport-relative X coordinate in CSS pixels. Must be paired with y.`})),y:F(tb.annotate({description:`Viewport-relative Y coordinate in CSS pixels. Must be paired with x.`})),timeoutMs:iM}).check(Zy(e=>{let t=Number(e.selector!==void 0)+Number(e.locator!==void 0),n=e.x!==void 0,r=e.y!==void 0;return n===r?t+(n&&r?1:0)===1||`Provide exactly one click target.`:`Coordinates require both x and y.`})).annotate({description:`Clicks one target. Provide exactly one of locator, selector, or the x/y coordinate pair.`}),dse=z({...sM,text:L.annotate({description:`Literal text to insert.`}),selector:F(uM).annotate({description:`Legacy CSS selector for the input. Prefer locator.`}),locator:F(lM).annotate({description:`Playwright selector for the input, for example role=textbox[name='Message'] or textarea[placeholder*='Message'].`}),clear:F(R.annotate({description:`Clear the existing input value before inserting text. Defaults to false.`})),timeoutMs:iM}).check(Zy(e=>!(e.selector!==void 0&&e.locator!==void 0)||`Provide at most one of selector or locator.`)).annotate({description:`Types into locator/selector, or into the currently focused element when neither target is provided.`}),fse=z({...sM,key:L.check($y()).check(ub({description:`Keyboard key name such as Enter, Escape, Tab, ArrowDown, Backspace, or a single character.`})).annotateKey({description:`Keyboard key name such as Enter, Escape, Tab, ArrowDown, Backspace, or a single character.`}),modifiers:F(B(H([`Alt`,`Control`,`Meta`,`Shift`])).annotate({description:`Modifier keys held while pressing key.`}))}).annotate({description:`Presses one keyboard key in the active browser tab.`}),pse=z({...sM,deltaX:F(tb.annotate({description:`Horizontal scroll delta in CSS pixels. Positive scrolls right. Defaults to 0.`})),deltaY:F(tb.annotate({description:`Vertical scroll delta in CSS pixels. Positive scrolls down. Defaults to 0.`})),selector:F(uM).annotate({description:`Legacy CSS selector for a scrollable container. Omit to scroll the viewport.`}),locator:F(lM).annotate({description:`Playwright selector for a scrollable container. Omit to scroll the viewport.`})}).check(Zy(e=>e.selector!==void 0&&e.locator!==void 0?`Provide at most one of selector or locator.`:e.deltaX!==void 0||e.deltaY!==void 0||`Provide deltaX or deltaY.`)).annotate({description:`Scrolls the viewport, or a locator/selector container. Provide deltaX, deltaY, or both.`}),mse=z({...sM,expression:L.check($y()).check(ub({description:`JavaScript expression evaluated in the page's main frame, for example document.title or (() => ({href: location.href}))().`})).check(db(64e3)).annotateKey({description:`JavaScript expression evaluated in the page's main frame, for example document.title or (() => ({href: location.href}))().`}),awaitPromise:F(R.annotate({description:`Await a returned Promise. Defaults to true.`})),returnByValue:F(R.annotate({description:`Serialize and return the value instead of a remote object reference. Defaults to true.`}))}).annotate({description:`Evaluates JavaScript in the page. Prefer snapshot and semantic actions; use evaluate for inspection or unsupported interactions.`}),hse=z({...sM,selector:F(uM).annotate({description:`Legacy CSS selector that must match an element. Prefer locator.`}),locator:F(lM).annotate({description:`Playwright selector that must match an element, for example role=button[name='Send'].`}),text:F(K.annotate({description:`Case-sensitive substring that must appear in visible document text.`})).annotate({description:`Case-sensitive substring that must appear in visible document text.`}),urlIncludes:F(K.annotate({description:`Substring that must appear in the current absolute URL.`})).annotate({description:`Substring that must appear in the current absolute URL.`}),timeoutMs:iM}).check(Zy(e=>e.selector!==void 0&&e.locator!==void 0?`Provide at most one of selector or locator.`:e.selector!==void 0||e.locator!==void 0||e.text!==void 0||e.urlIncludes!==void 0||`Provide at least one wait condition.`)).annotate({description:`Waits until all provided conditions match. Use after click/type when the page changes asynchronously.`}),gse=z({tag:L,role:U(L),name:L,selector:L,x:Ny,y:Ny,width:Ny,height:Ny}),_se=z({level:L,text:L,timestamp:L,source:F(L)}),vse=z({url:L,method:L,status:U(Ny),failed:R,errorText:F(L),timestamp:L}),yse=V([L,Ny,R]),bse=z({nodes:B(z({id:L,parentId:F(L),role:L,name:F(L),description:F(L),value:F(L),states:F(Iy(L,yse))})),totalNodes:cb,truncated:R}),xse=z({id:L,action:L,status:H([`running`,`succeeded`,`failed`,`interrupted`]),startedAt:L,completedAt:F(L),error:F(L)});z({url:L,title:L,loading:R,visibleText:L,interactiveElements:B(gse),accessibilityTree:bse,consoleEntries:B(_se),networkEntries:B(vse),actionTimeline:B(xse),screenshot:z({mimeType:I(`image/png`),data:L,width:cb,height:cb})}),z({tabId:Wj,recording:R,startedAt:U(L)}),z({id:L,tabId:Wj,path:L,mimeType:L,sizeBytes:cb,createdAt:L});var dM=K.check(db(128)),fM=K.check(db(64)),pM=z({clientId:dM,environmentId:Xb}),Sse=z({...pM.fields,supportedOperations:F(B(oM))}),Cse=z({...pM.fields,connectionId:fM,focused:R}),wse=z({requestId:K,threadId:Y,tabId:F(Wj),tabIdExplicit:F(R),operation:oM,input:jy,timeoutMs:cb.check(rb(0))}),Tse=V([z({type:I(`connected`),connectionId:fM}),z({type:I(`request`),connectionId:fM,request:wse})]),Ese=z({clientId:dM,connectionId:fM,requestId:K,ok:R,result:F(jy),error:F(z({_tag:K,message:L,detail:F(jy)}))}),Dse=class extends G()(`PreviewAutomationUnavailableError`,{capability:I(`preview`),environmentId:Xb,threadId:Y,providerSessionId:K,providerInstanceId:SO}){get message(){return`MCP credential does not grant the ${this.capability} capability.`}},mM={operation:oM,environmentId:Xb,threadId:Y,providerSessionId:K,providerInstanceId:SO},hM={...mM,clientId:K,connectionId:fM,requestId:K,tabId:F(Wj),timeoutMs:cb.check(rb(0))},gM={remoteTag:K,remoteMessageLength:cb.check(ib(0)),remoteDetailKind:F(H([`null`,`array`,`object`,`string`,`number`,`boolean`])),cause:Cb()},_M={remoteTag:F(K),remoteMessageLength:F(cb.check(ib(0))),remoteDetailKind:F(H([`null`,`array`,`object`,`string`,`number`,`boolean`])),cause:F(Cb())},vM=V([Dse,class extends G()(`PreviewAutomationNoAvailableHostError`,{...mM,clientId:F(K),connectionId:F(fM),requestId:F(K),tabId:F(Wj),timeoutMs:F(cb.check(rb(0))),..._M}){get message(){return`No preview automation host is available for ${this.operation} in environment ${this.environmentId}.`}},class extends G()(`PreviewAutomationUnsupportedClientError`,{...hM,...gM}){get message(){return`Preview automation client ${this.clientId} does not support ${this.operation}.`}},class extends G()(`PreviewAutomationTabNotFoundError`,{...hM,...gM}){get message(){return this.tabId?`Preview tab ${this.tabId} was not found for ${this.operation}.`:`No active preview tab was found for ${this.operation}.`}},class extends G()(`PreviewAutomationTimeoutError`,{...hM,..._M}){get message(){return`Preview automation ${this.operation} timed out after ${this.timeoutMs}ms.`}},class extends G()(`PreviewAutomationControlInterruptedError`,{...hM,...gM}){get message(){return`Preview automation ${this.operation} was interrupted on client ${this.clientId}.`}},class extends G()(`PreviewAutomationExecutionError`,{...hM,...gM}){get message(){return`Preview automation ${this.operation} failed on client ${this.clientId}.`}},class extends G()(`PreviewAutomationInvalidSelectorError`,{...hM,...gM,selectorKind:F(H([`locator`,`selector`])),selectorLength:F(cb.check(ib(0)))}){get message(){return this.selectorKind!==void 0&&this.selectorLength!==void 0?`Preview automation ${this.operation} received an invalid ${this.selectorKind} (${this.selectorLength} characters).`:`Preview automation ${this.operation} received an invalid selector.`}},class extends G()(`PreviewAutomationTargetNotEditableError`,{...hM,...gM,selectorKind:F(H([`focused-element`,`locator`,`selector`])),selectorLength:F(cb.check(ib(0)))}){get message(){return this.selectorKind===`focused-element`?`Preview automation ${this.operation} requires an editable focused element.`:this.selectorKind!==void 0&&this.selectorLength!==void 0?`Preview automation ${this.operation} requires an editable ${this.selectorKind} (${this.selectorLength} characters).`:`Preview automation ${this.operation} requires an editable target.`}},class extends G()(`PreviewAutomationResultTooLargeError`,{...hM,...gM,maximumBytes:F(cb.check(rb(0)))}){get message(){return this.maximumBytes===void 0?`Preview automation ${this.operation} produced a result that is too large.`:`Preview automation ${this.operation} produced a result larger than ${this.maximumBytes} bytes.`}},class extends G()(`PreviewAutomationClientDisconnectedError`,hM){get message(){return`Preview automation client ${this.clientId} disconnected during ${this.operation}.`}},class extends G()(`PreviewAutomationRequestQueueClosedError`,hM){get message(){return`Preview automation client ${this.clientId} stopped accepting ${this.operation} requests.`}},class extends G()(`PreviewAutomationRemoteUnavailableError`,{...hM,...gM}){get message(){return`Preview automation ${this.operation} is unavailable on client ${this.clientId}.`}},class extends G()(`PreviewAutomationMalformedResponseError`,hM){get message(){return`Preview automation client ${this.clientId} returned a malformed response for ${this.operation}.`}}]);z({requestedUrl:L,resolvedUrl:L,resolutionKind:H([`direct`,`direct-private-network`]),environmentId:Xb}),H([`direct-path`,`goto`,`line-column`]);var yM=[{id:`cursor`,label:`Cursor`,commands:[`cursor`],launchStyle:`goto`},{id:`trae`,label:`Trae`,commands:[`trae`],launchStyle:`goto`},{id:`kiro`,label:`Kiro`,commands:[`kiro`],baseArgs:[`ide`],launchStyle:`goto`},{id:`vscode`,label:`VS Code`,commands:[`code`],launchStyle:`goto`},{id:`vscode-insiders`,label:`VS Code Insiders`,commands:[`code-insiders`],launchStyle:`goto`},{id:`vscodium`,label:`VSCodium`,commands:[`codium`],launchStyle:`goto`},{id:`zed`,label:`Zed`,commands:[`zed`,`zeditor`],launchStyle:`direct-path`},{id:`antigravity`,label:`Antigravity`,commands:[`agy`],launchStyle:`goto`},{id:`idea`,label:`IntelliJ IDEA`,commands:[`idea`],launchStyle:`line-column`},{id:`aqua`,label:`Aqua`,commands:[`aqua`],launchStyle:`line-column`},{id:`clion`,label:`CLion`,commands:[`clion`],launchStyle:`line-column`},{id:`datagrip`,label:`DataGrip`,commands:[`datagrip`],launchStyle:`line-column`},{id:`dataspell`,label:`DataSpell`,commands:[`dataspell`],launchStyle:`line-column`},{id:`goland`,label:`GoLand`,commands:[`goland`],launchStyle:`line-column`},{id:`phpstorm`,label:`PhpStorm`,commands:[`phpstorm`],launchStyle:`line-column`},{id:`pycharm`,label:`PyCharm`,commands:[`pycharm`],launchStyle:`line-column`},{id:`rider`,label:`Rider`,commands:[`rider`],launchStyle:`line-column`},{id:`rubymine`,label:`RubyMine`,commands:[`rubymine`],launchStyle:`line-column`},{id:`rustrover`,label:`RustRover`,commands:[`rustrover`],launchStyle:`line-column`},{id:`webstorm`,label:`WebStorm`,commands:[`webstorm`],launchStyle:`line-column`},{id:`file-manager`,label:`File Manager`,commands:null,launchStyle:`direct-path`}],bM=H(yM.map(e=>e.id)),Ose=z({cwd:K,editor:bM}),kse=class extends G()(`ExternalLauncherUnknownEditorError`,{editor:L}){get message(){return`Unknown editor: ${this.editor}`}},Ase=class extends G()(`ExternalLauncherUnsupportedEditorError`,{editor:bM}){get message(){return`Unsupported editor: ${this.editor}`}},jse=class extends G()(`ExternalLauncherCommandNotFoundError`,{editor:bM,command:L}){get message(){return`Editor command not found: ${this.command}`}},xM={command:L,args:B(L),cause:Cb()},SM=V([kse,Ase,jse,class extends G()(`ExternalLauncherBrowserSpawnError`,{...xM,target:L}){get message(){return`Failed to launch browser target '${this.target}' with '${[this.command,...this.args].join(` `)}'`}},class extends G()(`ExternalLauncherEditorSpawnError`,{...xM,editor:bM,target:L}){get message(){return`Failed to launch '${this.target}' in ${this.editor} with '${[this.command,...this.args].join(` `)}'`}}]);gy(SM);var Mse=z({id:L,label:L,destructive:P(R),disabled:P(R),header:P(R),icon:P(L),children:P(B(Hy(()=>Mse)))}),Nse=H([`disabled`,`idle`,`checking`,`up-to-date`,`available`,`downloading`,`downloaded`,`error`]),CM=H([`arm64`,`x64`,`other`]);H([`light`,`dark`,`system`]);var Pse=H([`Latest`,`Alpha`,`Dev`,`Nightly`]);function Fse(e){return e.stageLabel.trim().toLowerCase()===`latest`?e.baseName:`${e.baseName} (${e.stageLabel})`}z({baseName:L,stageLabel:Pse,displayName:L}),z({hostArch:CM,appArch:CM,runningUnderArm64Translation:R});var Ise=z({version:L,items:B(L)}),wM=z({enabled:R,status:Nse,currentVersion:L,hostArch:CM,appArch:CM,runningUnderArm64Translation:R,availableVersion:U(L),downloadedVersion:U(L),releaseNotes:B(Ise),downloadPercent:U(Ny),checkedAt:U(L),message:U(L),errorContext:U(H([`check`,`download`,`install`])),canRetry:R});z({accepted:R,completed:R,state:wM}),z({checked:R,state:wM});var TM=`primary`;z({id:L,label:L,httpBaseUrl:U(L),wsBaseUrl:U(L),bootstrapToken:P(L)});var EM=z({alias:L,hostname:L,username:U(L),port:U(Ny)}),Lse=H([`ssh-config`,`known-hosts`]);z({alias:L,hostname:L,username:U(L),port:U(Ny),source:Lse});var Rse=z({target:EM,httpBaseUrl:L,wsBaseUrl:L,pairingToken:U(L),remotePort:P(Ny),remoteServerKind:P(H([`external`,`managed`]))});z({requestId:L,destination:L,username:U(L),prompt:L,expiresAt:L});var zse=z({type:I(`ssh-password-prompt-cancelled`),message:L});z({target:EM,options:P(z({issuePairingToken:P(R)}))}),V([Rse,zse]),z({httpBaseUrl:L}),z({httpBaseUrl:L,bearerToken:L}),z({httpBaseUrl:L,credential:L}),z({requestId:L,password:U(L)}),z({environmentId:Xb,label:L,wsBaseUrl:L,httpBaseUrl:L,createdAt:L,lastConnectedAt:U(L),desktopSsh:P(EM),relayManaged:P(z({relayUrl:L}))}),z({mode:H([`local-only`,`network-accessible`]),endpointUrl:U(L),advertisedHost:U(L),tailscaleServeEnabled:R,tailscaleServePort:Ny}),z({initialPath:P(U(L)),targetEnvironmentId:P(L)});var DM=H([`system`,`light`,`dark`]),OM=L.check($y()).check(ub()),Bse=V([z({kind:I(`Idle`)}),z({kind:I(`Loading`),url:L,title:L}),z({kind:I(`Success`),url:L,title:L}),z({kind:I(`LoadFailed`),url:L,title:L,code:Ny,description:L})]);z({tabId:OM,webContentsId:U(cb),navStatus:Bse,canGoBack:R,canGoForward:R,zoomFactor:Ny,pictureInPicture:R,colorScheme:DM,controller:H([`human`,`agent`,`none`]),updatedAt:L}),z({tabId:OM,phase:H([`move`,`click`]),x:Ny,y:Ny,sequence:cb,createdAt:L}),z({partition:L,webPreferences:L,preloadUrl:U(L)});var Vse=z({colorScheme:H([`light`,`dark`]),radius:L,background:L,foreground:L,popover:L,popoverForeground:L,primary:L,primaryForeground:L,muted:L,mutedForeground:L,accent:L,accentForeground:L,border:L,input:L,ring:L,fontSans:L,fontMono:L});z({tabId:OM,data:L,width:Ny,height:Ny,receivedAt:L}),z({id:L,tabId:OM,path:L,mimeType:L,sizeBytes:cb,createdAt:L}),z({id:L,tabId:OM,path:L,mimeType:I(`image/png`),sizeBytes:cb,createdAt:L});var kM=z({functionName:U(L),fileName:U(L),lineNumber:U(Ny),columnNumber:U(Ny)}),Hse=z({pageUrl:L,pageTitle:U(L),tagName:L,selector:U(L),htmlPreview:L,componentName:U(L),source:U(kM),stack:B(kM),styles:L,pickedAt:L}),AM=z({x:Ny,y:Ny,width:Ny,height:Ny}),Use=z({x:Ny,y:Ny}),Wse=z({id:L,element:Hse,rect:AM}),Gse=z({id:L,rect:AM}),Kse=z({id:L,color:L,width:Ny,points:B(Use),bounds:AM}),qse=z({targetId:L,selector:U(L),property:L,previousValue:L,value:L}),Jse=z({dataUrl:L,width:Ny,height:Ny,cropRect:AM}),Yse=z({id:L,pageUrl:L,pageTitle:U(L),comment:L,elements:B(Wse),regions:B(Gse),strokes:B(Kse),styleChanges:B(qse),screenshot:U(Jse),createdAt:L});z({tabId:OM}),z({tabId:OM,webContentsId:cb.check(rb(0))}),z({tabId:OM,url:L}),z({environmentId:Xb}),z({tabId:OM,colorScheme:DM}),z({theme:Vse}),z({path:L.check($y()).check(ub())}),z({tabId:OM,mimeType:L.check($y()).check(ub()),data:Ob}),z({tabId:OM,input:use}),z({tabId:OM,input:dse}),z({tabId:OM,input:fse}),z({tabId:OM,input:pse}),z({tabId:OM,input:mse}),z({tabId:OM,input:hse});var jM=K,MM=cb.check(ib(1)).check(ob(1e3)),NM=cb.check(ib(1)).check(ob(500)),PM=jM.check(db(128)),FM=Iy(L.check(eb(/^[A-Za-z_][A-Za-z0-9_]*$/)).check(db(128)),L.check(db(8192))).check(Lre(128)),IM=z({threadId:jM}),LM=z({...IM.fields,terminalId:PM}),Xse=z({...LM.fields,cwd:jM,worktreePath:F(U(jM)),cols:F(MM),rows:F(NM),env:F(FM)}),Zse=z({...LM.fields,cwd:F(jM),worktreePath:F(U(jM)),cols:F(MM),rows:F(NM),env:F(FM),restartIfNotRunning:F(R)}),Qse=z({...LM.fields,data:L.check(ub()).check(db(65536))}),$se=z({...LM.fields,cols:MM,rows:NM}),ece=LM,tce=z({...LM.fields,cwd:jM,worktreePath:F(U(jM)),cols:MM,rows:NM,env:F(FM)}),nce=z({...IM.fields,terminalId:F(PM),deleteHistory:F(R)}),RM=H([`starting`,`running`,`exited`,`error`]),zM=z({threadId:L.check(ub()),terminalId:L.check(ub()),cwd:L.check(ub()),worktreePath:U(jM),status:RM,pid:U(cb.check(rb(0))),history:L,exitCode:U(cb),exitSignal:U(cb),label:L.check(db(128)),updatedAt:L,sequence:F(cb.check(ib(0)))}),BM=z({threadId:L.check(ub()),terminalId:L.check(ub()),cwd:L.check(ub()),worktreePath:U(jM),status:RM,pid:U(cb.check(rb(0))),exitCode:U(cb),exitSignal:U(cb),hasRunningSubprocess:R,label:L.check(db(128)),updatedAt:L}),rce=V([z({type:I(`snapshot`),terminals:B(BM)}),z({type:I(`upsert`),terminal:BM}),z({type:I(`remove`),threadId:L.check(ub()),terminalId:L.check(ub())})]),VM=z({threadId:L.check(ub()),terminalId:L.check(ub()),sequence:F(cb.check(ib(0)))}),ice=z({...VM.fields,type:I(`started`),snapshot:zM}),HM=z({...VM.fields,type:I(`output`),data:L}),UM=z({...VM.fields,type:I(`exited`),exitCode:U(cb),exitSignal:U(cb)}),WM=z({...VM.fields,type:I(`closed`)}),GM=z({...VM.fields,type:I(`error`),message:L.check(ub())}),KM=z({...VM.fields,type:I(`cleared`)}),qM=z({...VM.fields,type:I(`restarted`),snapshot:zM}),JM=z({...VM.fields,type:I(`activity`),hasRunningSubprocess:R,label:L.check(db(128))}),ace=V([ice,HM,UM,WM,GM,KM,qM,JM]),oce=V([z({type:I(`snapshot`),snapshot:zM}),HM,UM,WM,GM,KM,qM,JM]),YM=V([V([class extends G()(`TerminalCwdNotFoundError`,{cwd:L}){get message(){return`Terminal cwd does not exist: ${this.cwd}`}},class extends G()(`TerminalCwdNotDirectoryError`,{cwd:L}){get message(){return`Terminal cwd is not a directory: ${this.cwd}`}},class extends G()(`TerminalCwdStatError`,{cwd:L,cause:Cb()}){get message(){return`Failed to access terminal cwd: ${this.cwd}`}}]),class extends G()(`TerminalHistoryError`,{operation:H([`read`,`truncate`,`migrate`]),threadId:L,terminalId:L,cause:F(Cb())}){get message(){return`Failed to ${this.operation} terminal history for thread: ${this.threadId}, terminal: ${this.terminalId}`}},class extends G()(`TerminalSessionLookupError`,{threadId:L,terminalId:L}){get message(){return`Unknown terminal thread: ${this.threadId}, terminal: ${this.terminalId}`}},class extends G()(`TerminalNotRunningError`,{threadId:L,terminalId:L}){get message(){return`Terminal is not running for thread: ${this.threadId}, terminal: ${this.terminalId}`}},class extends G()(`TerminalWriteError`,{threadId:L,terminalId:L,terminalPid:Ny,cause:Cb()}){get message(){return`Failed to write to terminal for thread: ${this.threadId}, terminal: ${this.terminalId}, PID: ${this.terminalPid}`}},class extends G()(`TerminalResizeError`,{threadId:L,terminalId:L,terminalPid:Ny,cols:MM,rows:NM,cause:Cb()}){get message(){return`Failed to resize terminal for thread: ${this.threadId}, terminal: ${this.terminalId}, PID: ${this.terminalPid} to ${this.cols}x${this.rows}`}}]),sce=H([`connecting`,`ready`,`running`,`error`,`closed`]);z({provider:yO,providerInstanceId:F(SO),status:sce,runtimeMode:QO,cwd:F(K),model:F(K),threadId:Y,resumeCursor:F(jy),activeTurnId:F(ex),createdAt:J,updatedAt:J,lastError:F(K)}),z({threadId:Y,provider:F(yO),providerInstanceId:F(SO),cwd:F(K),modelSelection:F(ZO),resumeCursor:F(jy),approvalPolicy:F(JO),sandboxMode:F(YO),runtimeMode:QO,compressMode:F(nk),unpromptedSubagents:F(R)}),z({threadId:Y,input:F(K.check(db(sk))),attachments:F(B(pk).check(db(8))),modelSelection:F(ZO),interactionMode:F(ek),compressMode:F(nk),unpromptedSubagents:F(R)}),z({threadId:Y,turnId:ex,resumeCursor:F(jy)}),z({threadId:Y,turnId:F(ex)}),z({threadId:Y}),z({threadId:Y,requestId:ix,decision:ak}),z({threadId:Y,requestId:ix,answers:ok}),z({id:Qb,kind:H([`session`,`notification`,`request`,`error`]),provider:yO,providerInstanceId:F(SO),threadId:Y,createdAt:J,method:K,message:F(K),turnId:F(ex),itemId:F(nx),requestId:F(ix),requestKind:F(ik),textDelta:F(L),payload:F(jy)});var XM=K,ZM=Iy(L,jy),cce=z({source:V([I(`codex.app-server.notification`),I(`codex.app-server.request`),I(`codex.eventmsg`),I(`claude.sdk.message`),I(`claude.sdk.permission`),I(`codex.sdk.thread-event`),I(`opencode.sdk.event`),I(`muse.exec.jsonl`),I(`acp.jsonrpc`),ky([`acp.`,L,`.extension`])]),method:F(XM),messageType:F(XM),payload:jy}),lce=XM,uce=z({providerTurnId:F(XM),providerItemId:F(nx),providerRequestId:F(lce)}),dce=H([`starting`,`ready`,`running`,`waiting`,`stopped`,`error`]),fce=H([`active`,`idle`,`archived`,`closed`,`compacted`,`error`]),pce=H([`completed`,`failed`,`interrupted`,`cancelled`]),mce=H([`pending`,`inProgress`,`completed`]),hce=H([`inProgress`,`completed`,`failed`,`declined`]),gce=H([`assistant_text`,`reasoning_text`,`reasoning_summary_text`,`plan_text`,`command_output`,`file_change_output`,`unknown`]),_ce=H([`graceful`,`error`]),vce=H([`provider_error`,`transport_error`,`permission_error`,`validation_error`,`unknown`]),QM=[`command_execution`,`file_change`,`mcp_tool_call`,`dynamic_tool_call`,`collab_agent_tool_call`,`web_search`,`image_view`];H(QM);function yce(e){return QM.includes(e)}var bce=H([`user_message`,`assistant_message`,`reasoning`,`plan`,...QM,`review_entered`,`review_exited`,`context_compaction`,`error`,`unknown`]),$M=H([`command_execution_approval`,`file_read_approval`,`file_change_approval`,`apply_patch_approval`,`exec_command_approval`,`tool_user_input`,`dynamic_tool_call`,`auth_tokens_refresh`,`unknown`]);H(`session.started,session.configured,session.state.changed,session.exited,thread.started,thread.state.changed,thread.metadata.updated,thread.token-usage.updated,thread.realtime.started,thread.realtime.item-added,thread.realtime.audio.delta,thread.realtime.error,thread.realtime.closed,turn.started,turn.completed,turn.aborted,turn.plan.updated,turn.proposed.delta,turn.proposed.completed,turn.diff.updated,item.started,item.updated,item.completed,content.delta,request.opened,request.resolved,user-input.requested,user-input.resolved,task.started,task.progress,task.completed,hook.started,hook.progress,hook.completed,tool.progress,tool.summary,auth.status,account.updated,account.rate-limits.updated,mcp.status.updated,mcp.oauth.completed,model.rerouted,config.warning,deprecation.notice,files.persisted,code.published,runtime.warning,runtime.error`.split(`,`));var xce=I(`session.started`),Sce=I(`session.configured`),Cce=I(`session.state.changed`),wce=I(`session.exited`),Tce=I(`thread.started`),Ece=I(`thread.state.changed`),Dce=I(`thread.metadata.updated`),Oce=I(`thread.token-usage.updated`),kce=I(`thread.realtime.started`),Ace=I(`thread.realtime.item-added`),jce=I(`thread.realtime.audio.delta`),Mce=I(`thread.realtime.error`),Nce=I(`thread.realtime.closed`),Pce=I(`turn.started`),Fce=I(`turn.completed`),Ice=I(`turn.aborted`),Lce=I(`turn.plan.updated`),Rce=I(`turn.proposed.delta`),zce=I(`turn.proposed.completed`),Bce=I(`turn.diff.updated`),Vce=I(`item.started`),Hce=I(`item.updated`),Uce=I(`item.completed`),Wce=I(`content.delta`),Gce=I(`request.opened`),Kce=I(`request.resolved`),qce=I(`user-input.requested`),Jce=I(`user-input.resolved`),Yce=I(`task.started`),Xce=I(`task.progress`),Zce=I(`task.completed`),Qce=I(`hook.started`),$ce=I(`hook.progress`),ele=I(`hook.completed`),tle=I(`tool.progress`),nle=I(`tool.summary`),rle=I(`auth.status`),ile=I(`account.updated`),ale=I(`account.rate-limits.updated`),ole=I(`mcp.status.updated`),sle=I(`mcp.oauth.completed`),cle=I(`model.rerouted`),lle=I(`config.warning`),ule=I(`deprecation.notice`),dle=I(`files.persisted`),fle=I(`code.published`),ple=I(`tool.denied`),mle=I(`runtime.warning`),hle=I(`runtime.error`),eN=z({eventId:Qb,provider:yO,providerInstanceId:F(SO),threadId:Y,createdAt:J,turnId:F(ex),itemId:F(cie),requestId:F(lie),providerRefs:F(uce),raw:F(cce)}),gle=z({message:F(XM),resume:F(jy)}),_le=z({config:ZM}),vle=z({state:dce,reason:F(XM),detail:F(jy)}),yle=z({reason:F(XM),recoverable:F(R),exitKind:F(_ce)}),ble=z({providerThreadId:F(XM)}),xle=z({state:fce,detail:F(jy)}),Sle=z({name:F(XM),metadata:F(ZM)}),tN=z({name:XM,tokens:q}),Cle=z({name:XM,tokens:q,isLoaded:F(R)}),nN=z({model:F(XM),categories:F(B(z({name:XM,tokens:q,isDeferred:F(R)}))),mcpTools:F(B(z({name:XM,serverName:XM,tokens:q,isLoaded:F(R)}))),skills:F(z({totalSkills:q,includedSkills:q,tokens:q,entries:F(B(z({name:XM,source:F(XM),tokens:q})))})),memoryFiles:F(B(z({path:XM,type:F(XM),tokens:q}))),agents:F(B(z({agentType:XM,source:F(XM),tokens:q}))),systemTools:F(B(tN)),deferredBuiltinTools:F(B(Cle)),systemPromptSections:F(B(tN)),slashCommands:F(z({totalCommands:q,includedCommands:q,tokens:q})),messages:F(z({toolCallTokens:q,toolResultTokens:q,attachmentTokens:q,assistantMessageTokens:q,userMessageTokens:q,redirectedContextTokens:q,unattributedTokens:q,toolCallsByType:F(B(z({name:XM,callTokens:q,resultTokens:q}))),attachmentsByType:F(B(tN))})),autoCompactThreshold:F(q)}),wle=z({usage:z({usedTokens:q,totalProcessedTokens:F(q),maxTokens:F(Gb),inputTokens:F(q),cachedInputTokens:F(q),outputTokens:F(q),reasoningOutputTokens:F(q),lastUsedTokens:F(q),lastInputTokens:F(q),lastCachedInputTokens:F(q),lastOutputTokens:F(q),lastReasoningOutputTokens:F(q),toolUses:F(q),durationMs:F(q),compactsAutomatically:F(R),breakdown:F(nN)})}),Tle=z({realtimeSessionId:F(XM)}),Ele=z({item:jy}),Dle=z({audio:jy}),Ole=z({message:XM}),kle=z({reason:F(XM)}),Ale=z({model:F(XM),effort:F(XM)}),jle=z({state:pce,stopReason:F(U(XM)),usage:F(jy),modelUsage:F(ZM),totalCostUsd:F(Ny),errorMessage:F(XM)}),Mle=z({reason:XM}),Nle=z({step:XM,status:mce}),Ple=z({explanation:F(U(XM)),plan:B(Nle)}),Fle=z({delta:L}),Ile=z({planMarkdown:XM}),Lle=z({unifiedDiff:L}),rN=z({itemType:bce,status:F(hce),title:F(XM),detail:F(XM),data:F(jy)}),Rle=z({streamKind:gce,delta:L,contentIndex:F(cb),summaryIndex:F(cb)}),zle=z({requestType:$M,detail:F(XM),args:F(jy)}),Ble=z({requestType:$M,decision:F(XM),resolution:F(jy)}),Vle=z({questions:B(z({id:XM,header:XM,question:XM,options:B(z({label:XM,description:XM})),multiSelect:F(R).pipe(Gy(M(!1)))}))}),Hle=z({answers:ZM}),Ule=z({taskId:rx,description:F(XM),taskType:F(XM),toolUseId:F(XM),subagentType:F(XM)}),Wle=z({taskId:rx,description:XM,summary:F(XM),usage:F(jy),lastToolName:F(XM),toolUseId:F(XM),subagentType:F(XM)}),Gle=z({taskId:rx,status:H([`completed`,`failed`,`stopped`]),summary:F(XM),usage:F(jy),toolUseId:F(XM)}),Kle=z({hookId:XM,hookName:XM,hookEvent:XM}),qle=z({hookId:XM,output:F(L),stdout:F(L),stderr:F(L)}),Jle=z({hookId:XM,outcome:H([`success`,`error`,`cancelled`]),output:F(L),stdout:F(L),stderr:F(L),exitCode:F(cb)}),Yle=z({toolUseId:F(XM),toolName:F(XM),summary:F(XM),elapsedSeconds:F(Ny)}),Xle=z({summary:XM,precedingToolUseIds:F(B(XM))}),Zle=z({isAuthenticating:F(R),output:F(B(L)),error:F(XM)}),Qle=z({account:jy}),$le=z({rateLimits:jy}),eue=z({status:jy}),tue=z({success:R,name:F(XM),error:F(XM)}),nue=z({fromModel:XM,toModel:XM,reason:XM}),rue=z({summary:XM,details:F(XM),path:F(XM),range:F(jy)}),iue=z({summary:XM,details:F(XM)}),aue=z({files:B(z({filename:XM,fileId:XM})),failed:F(B(z({filename:XM,error:XM})))}),oue=z({hostingProvider:XM,url:XM,repo:F(XM),identifier:F(XM)}),sue=z({toolName:XM,toolUseId:F(XM),reason:F(XM),agentId:F(XM)}),cue=z({message:XM,detail:F(jy)}),lue=z({message:XM,class:F(vce),detail:F(jy)});V([z({...eN.fields,type:xce,payload:gle}),z({...eN.fields,type:Sce,payload:_le}),z({...eN.fields,type:Cce,payload:vle}),z({...eN.fields,type:wce,payload:yle}),z({...eN.fields,type:Tce,payload:ble}),z({...eN.fields,type:Ece,payload:xle}),z({...eN.fields,type:Dce,payload:Sle}),z({...eN.fields,type:Oce,payload:wle}),z({...eN.fields,type:kce,payload:Tle}),z({...eN.fields,type:Ace,payload:Ele}),z({...eN.fields,type:jce,payload:Dle}),z({...eN.fields,type:Mce,payload:Ole}),z({...eN.fields,type:Nce,payload:kle}),z({...eN.fields,type:Pce,payload:Ale}),z({...eN.fields,type:Fce,payload:jle}),z({...eN.fields,type:Ice,payload:Mle}),z({...eN.fields,type:Lce,payload:Ple}),z({...eN.fields,type:Rce,payload:Fle}),z({...eN.fields,type:zce,payload:Ile}),z({...eN.fields,type:Bce,payload:Lle}),z({...eN.fields,type:Vce,payload:rN}),z({...eN.fields,type:Hce,payload:rN}),z({...eN.fields,type:Uce,payload:rN}),z({...eN.fields,type:Wce,payload:Rle}),z({...eN.fields,type:Gce,payload:zle}),z({...eN.fields,type:Kce,payload:Ble}),z({...eN.fields,type:qce,payload:Vle}),z({...eN.fields,type:Jce,payload:Hle}),z({...eN.fields,type:Yce,payload:Ule}),z({...eN.fields,type:Xce,payload:Wle}),z({...eN.fields,type:Zce,payload:Gle}),z({...eN.fields,type:Qce,payload:Kle}),z({...eN.fields,type:$ce,payload:qle}),z({...eN.fields,type:ele,payload:Jle}),z({...eN.fields,type:tle,payload:Yle}),z({...eN.fields,type:nle,payload:Xle}),z({...eN.fields,type:rle,payload:Zle}),z({...eN.fields,type:ile,payload:Qle}),z({...eN.fields,type:ale,payload:$le}),z({...eN.fields,type:ole,payload:eue}),z({...eN.fields,type:sle,payload:tue}),z({...eN.fields,type:cle,payload:nue}),z({...eN.fields,type:lle,payload:rue}),z({...eN.fields,type:ule,payload:iue}),z({...eN.fields,type:dle,payload:aue}),z({...eN.fields,type:fle,payload:oue}),z({...eN.fields,type:ple,payload:sue}),z({...eN.fields,type:mle,payload:cue}),z({...eN.fields,type:hle,payload:lue})]),H([`command`,`file-read`,`file-change`,`other`]);var iN=[`thread.jump.1`,`thread.jump.2`,`thread.jump.3`,`thread.jump.4`,`thread.jump.5`,`thread.jump.6`,`thread.jump.7`,`thread.jump.8`,`thread.jump.9`],aN=[`modelPicker.jump.1`,`modelPicker.jump.2`,`modelPicker.jump.3`,`modelPicker.jump.4`,`modelPicker.jump.5`,`modelPicker.jump.6`,`modelPicker.jump.7`,`modelPicker.jump.8`,`modelPicker.jump.9`],uue=[`thread.previous`,`thread.next`,...iN],due=[`sidebar.toggle`,`terminal.toggle`,`terminal.split`,`terminal.splitVertical`,`terminal.new`,`terminal.close`,`rightPanel.toggle`,`diff.toggle`,`preview.toggle`,`preview.refresh`,`preview.focusUrl`,`preview.zoomIn`,`preview.zoomOut`,`preview.resetZoom`,`commandPalette.toggle`,`composer.stash`,`chat.new`,`chat.newLocal`,`editor.openFavorite`,`modelPicker.toggle`,...aN,...uue],oN=ky([I(`script.`),fb.check(db(24),eb(/^[a-z0-9][a-z0-9-]*$/)),I(`.run`)]),sN=V([H(due),oN]),cN=Wb.check(lb(1),db(64)),lN=Wb.check(lb(1),db(256)),uN=z({key:cN,command:sN,when:F(lN)});B(uN).check(db(256));var fue=z({key:cN,metaKey:R,ctrlKey:R,shiftKey:R,altKey:R,modKey:R}),dN=Hy(()=>fN),fN=V([z({type:I(`identifier`),name:fb}),z({type:I(`not`),node:dN}),z({type:I(`and`),left:dN,right:dN}),z({type:I(`or`),left:dN,right:dN})]),pN=B(z({command:sN,shortcut:fue,whenAst:F(fN)}).annotate({parseOptions:{onExcessProperty:`ignore`}})).check(db(256)),mN=class extends G()(`KeybindingsConfigParseError`,{configPath:L,detail:L,cause:F(Cb())}){get message(){return`Unable to parse keybindings config at ${this.configPath}: ${this.detail}`}},hN=H([`locale`,`12-hour`,`24-hour`]),pue=`locale`,gN=H([`updated_at`,`created_at`,`manual`]),mue=`updated_at`,_N=H([`updated_at`,`created_at`]),hue=`updated_at`,vN=H([`repository`,`repository_path`,`separate`]),gue=`repository`,yN=cb.check(sb({minimum:1,maximum:15})),bN=Ny.check(sb({minimum:1,maximum:90})),xN=cb.check(sb({minimum:40,maximum:100})),SN=H([`artwork`,`pill`,`none`]),CN=`artwork`,wN=z({autoOpenPlanSidebar:R.pipe(W(M(!1))),confirmThreadArchive:R.pipe(W(M(!1))),confirmThreadDelete:R.pipe(W(M(!0))),dismissedProviderUpdateNotificationKeys:B(K).pipe(W(M([]))),diffIgnoreWhitespace:R.pipe(W(M(!0))),environmentIdentificationMode:SN.pipe(W(M(CN))),glassOpacity:xN.pipe(W(M(80))),favorites:B(z({provider:SO,model:K})).pipe(W(M([]))),providerModelPreferences:Iy(SO,z({hiddenModels:B(L).pipe(W(M([]))),modelOrder:B(L).pipe(W(M([])))})).pipe(W(M({}))),sidebarAutoSettleAfterDays:U(bN).pipe(W(M(3))),sidebarProjectGroupingMode:vN.pipe(W(M(gue))),sidebarProjectGroupingOverrides:Iy(K,vN).pipe(W(M({}))),sidebarProjectSortOrder:gN.pipe(W(M(mue))),sidebarThreadSortOrder:_N.pipe(W(M(hue))),sidebarThreadPreviewCount:yN.pipe(W(M(6))),timestampFormat:hN.pipe(W(M(pue))),wordWrap:R.pipe(W(M(!0)))}),TN=Sy(wN)({}),EN=H([`local`,`worktree`]),DN=e=>Wb.pipe(Wy(L,og({decode:t=>M(t||e),encode:e=>M(e)})),W(M(e)));function ON(e,t){return z(e).pipe(gre({providerSettingsFormSchema:t?.order===void 0?void 0:{order:t.order}}))}var kN=ON({enabled:R.pipe(W(M(!0)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`codex`).pipe(hy({title:`Binary path`,description:`Path to the Codex binary used by this instance.`,providerSettingsForm:{placeholder:`codex`,clearWhenEmpty:`omit`}})),homePath:Wb.pipe(W(M(``)),hy({title:`CODEX_HOME path`,description:`Custom Codex home and config directory.`,providerSettingsForm:{placeholder:`~/.codex`,clearWhenEmpty:`omit`}})),shadowHomePath:Wb.pipe(W(M(``)),hy({title:`Shadow home path`,description:`Account-specific Codex home. Keeps auth.json separate while sharing state from CODEX_HOME.`,providerSettingsForm:{placeholder:`~/.codex-p4/personal`,clearWhenEmpty:`omit`}})),launchArgs:Wb.pipe(W(M(``)),hy({title:`Launch arguments`,description:`Additional CLI arguments passed to codex app-server on session start.`})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`homePath`,`shadowHomePath`,`launchArgs`]}),AN=ON({enabled:R.pipe(W(M(!0)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`claude`).pipe(hy({title:`Binary path`,description:`Path to the Claude binary used by this instance.`,providerSettingsForm:{placeholder:`claude`,clearWhenEmpty:`omit`}})),homePath:Wb.pipe(W(M(``)),hy({title:`CLAUDE_CONFIG_DIR path`,description:`Custom Claude home and config directory. Keeps .claude.json and .claude separate.`,providerSettingsForm:{placeholder:`~/.claude`,clearWhenEmpty:`omit`}})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}})),launchArgs:L.pipe(W(M(``)),hy({title:`Launch arguments`,description:`Additional CLI arguments passed on session start.`,providerSettingsForm:{placeholder:`e.g. --chrome`,clearWhenEmpty:`omit`}}))},{order:[`binaryPath`,`homePath`,`launchArgs`]}),jN=ON({enabled:R.pipe(W(M(!1)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`cursor-agent`).pipe(hy({title:`Binary path`,description:`Path to the Cursor agent binary.`,providerSettingsForm:{placeholder:`cursor-agent`,clearWhenEmpty:`omit`}})),apiEndpoint:Wb.pipe(W(M(``)),hy({title:`API endpoint`,description:`Override the Cursor API endpoint for this instance.`,providerSettingsForm:{placeholder:`https://...`,clearWhenEmpty:`omit`}})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`apiEndpoint`]}),MN=ON({enabled:R.pipe(W(M(!0)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`grok`).pipe(hy({title:`Binary path`,description:`Path to the Grok CLI binary.`,providerSettingsForm:{placeholder:`grok`,clearWhenEmpty:`omit`}})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`]}),NN=ON({enabled:R.pipe(W(M(!1)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`muse`).pipe(hy({title:`Binary path`,description:`Path to the Muse Code binary.`,providerSettingsForm:{placeholder:`muse`,clearWhenEmpty:`omit`}})),baseUrl:Wb.pipe(W(M(``)),hy({title:`Base URL`,description:`Override the Meta Model API base URL for this instance.`,providerSettingsForm:{placeholder:`https://api.meta.ai/v1`,clearWhenEmpty:`omit`}})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`baseUrl`]}),PN=ON({enabled:R.pipe(W(M(!0)),hy({providerSettingsForm:{hidden:!0}})),binaryPath:DN(`opencode`).pipe(hy({title:`Binary path`,description:`Path to the OpenCode binary.`,providerSettingsForm:{placeholder:`opencode`,clearWhenEmpty:`omit`}})),serverUrl:Wb.pipe(W(M(``)),hy({title:`Server URL`,description:`Leave blank to let P4Code spawn the server when needed.`,providerSettingsForm:{placeholder:`http://127.0.0.1:4096`,clearWhenEmpty:`omit`}})),serverPassword:Wb.pipe(W(M(``)),hy({title:`Server password`,description:`Stored in plain text on disk.`,providerSettingsForm:{control:`password`,placeholder:`Optional`,clearWhenEmpty:`omit`}})),customModels:B(L).pipe(W(M([])),hy({providerSettingsForm:{hidden:!0}}))},{order:[`binaryPath`,`serverUrl`,`serverPassword`]}),_ue=z({otlpTracesUrl:Wb.pipe(W(M(``))),otlpMetricsUrl:Wb.pipe(W(M(``)))}),FN=H([`repo_conventions`,`conventional_commits`,`custom`]),vue=z({mode:FN.pipe(W(M(`repo_conventions`))),customInstructions:Wb.pipe(W(M(``))),followChangeRequestTemplates:R.pipe(W(M(!0)))}),yue=ji(30),IN=H([`local`,`hub`]),LN=z({enableAssistantStreaming:R.pipe(W(M(!1))),enableProviderUpdateChecks:R.pipe(W(M(!0))),enableToolCallNarration:R.pipe(W(M(!0))),enableUnpromptedSubagents:R.pipe(W(M(!0))),enableScopingAgent:R.pipe(W(M(!0))),enablePlanPhase:R.pipe(W(M(!0))),writeGeneratedSkillsToRepo:R.pipe(W(M(!0))),automaticGitFetchInterval:Tb.pipe(W(M(Mi(yue)))),defaultThreadEnvMode:EN.pipe(W(M(`local`))),newWorktreesStartFromOrigin:R.pipe(W(M(!0))),addProjectBaseDirectory:Wb.pipe(W(M(``))),textGenerationModelSelection:ZO.pipe(W(M({instanceId:SO.make(`codex`),model:HO}))),sourceControlWritingStyle:vue.pipe(W(M({}))),sourceControlWriterModelSelection:U(ZO).pipe(W(M(null))),taskBoardSource:IN.pipe(W(M(`local`))),disabledSkills:B(K).pipe(W(M([]))),providers:z({codex:kN.pipe(W(M({}))),claudeAgent:AN.pipe(W(M({}))),cursor:jN.pipe(W(M({}))),grok:MN.pipe(W(M({}))),muse:NN.pipe(W(M({}))),opencode:PN.pipe(W(M({})))}).pipe(W(M({}))),providerInstances:Iy(SO,wO).pipe(W(M({}))),observability:_ue.pipe(W(M({})))}),RN=Sy(LN)({}),bue=H([`normalize`,`check-exists`,`read-file`,`read-secret`,`remove-secret`,`remove-stale-secret`,`write-secret`,`write-file`,`prepare-directory`]),zN=class extends G()(`ServerSettingsError`,{settingsPath:L,operation:bue,providerInstanceId:F(L),environmentVariable:F(L),cause:Cb()}){get message(){let e=this.providerInstanceId===void 0?``:` for provider ${this.providerInstanceId}`,t=this.environmentVariable===void 0?``:` and environment variable ${this.environmentVariable}`;return`Server settings ${this.operation} failed${e}${t} at ${this.settingsPath}.`}},xue={...RN,...TN},Sue=z({instanceId:P(SO),model:P(K),options:P(jO)}),Cue=z({enabled:P(R),binaryPath:P(Wb),homePath:P(Wb),shadowHomePath:P(Wb),launchArgs:P(Wb),customModels:P(B(L))}),wue=z({enabled:P(R),binaryPath:P(Wb),homePath:P(Wb),customModels:P(B(L)),launchArgs:P(Wb)}),Tue=z({enabled:P(R),binaryPath:P(Wb),apiEndpoint:P(Wb),customModels:P(B(L))}),Eue=z({enabled:P(R),binaryPath:P(Wb),customModels:P(B(L))}),Due=z({enabled:P(R),binaryPath:P(Wb),baseUrl:P(Wb),customModels:P(B(L))}),Oue=z({enabled:P(R),binaryPath:P(Wb),serverUrl:P(Wb),serverPassword:P(Wb),customModels:P(B(L))}),kue=z({enableAssistantStreaming:P(R),enableProviderUpdateChecks:P(R),enableToolCallNarration:P(R),enableUnpromptedSubagents:P(R),enableScopingAgent:P(R),enablePlanPhase:P(R),writeGeneratedSkillsToRepo:P(R),automaticGitFetchInterval:P(Tb),defaultThreadEnvMode:P(EN),newWorktreesStartFromOrigin:P(R),addProjectBaseDirectory:P(Wb),textGenerationModelSelection:P(Sue),sourceControlWritingStyle:P(z({mode:P(FN),customInstructions:P(Wb),followChangeRequestTemplates:P(R)})),sourceControlWriterModelSelection:P(U(ZO)),disabledSkills:P(B(K)),taskBoardSource:P(IN),observability:P(z({otlpTracesUrl:P(Wb),otlpMetricsUrl:P(Wb)})),providers:P(z({codex:P(Cue),claudeAgent:P(wue),cursor:P(Tue),grok:P(Eue),muse:P(Due),opencode:P(Oue)})),providerInstances:P(Iy(SO,wO))});z({autoOpenPlanSidebar:P(R),confirmThreadArchive:P(R),confirmThreadDelete:P(R),diffIgnoreWhitespace:P(R),environmentIdentificationMode:P(SN),glassOpacity:P(xN),favorites:P(B(z({provider:SO,model:K}))),providerModelPreferences:P(Iy(SO,z({hiddenModels:B(L).pipe(W(M([]))),modelOrder:B(L).pipe(W(M([])))}))),sidebarAutoSettleAfterDays:P(U(bN)),sidebarProjectGroupingMode:P(vN),sidebarProjectGroupingOverrides:P(Iy(K,vN)),sidebarProjectSortOrder:P(gN),sidebarThreadSortOrder:P(_N),sidebarThreadPreviewCount:P(yN),timestampFormat:P(hN),wordWrap:P(R)});var BN=B(V([z({kind:I(`keybindings.malformed-config`),message:K}),z({kind:I(`keybindings.invalid-entry`),message:K,index:Ny})])),Aue=H([`ready`,`warning`,`error`,`disabled`]),jue=z({status:H([`authenticated`,`unauthenticated`,`unknown`]),type:F(K),label:F(K),email:F(K)}),Mue=z({slug:K,name:K,shortName:F(K),subProvider:F(K),isCustom:R,isDefault:F(R),capabilities:U(PO)}),Nue=z({hint:K}),Pue=z({name:K,description:F(K),input:F(Nue)}),Fue=z({name:K,description:F(K),path:K,scope:F(K),enabled:R,displayName:F(K),shortDescription:F(K)}),Iue=H([`available`,`unavailable`]),Lue=z({groupKey:K}),Rue=z({status:H([`unknown`,`current`,`behind_latest`]),currentVersion:U(K),latestVersion:U(K),updateCommand:U(K),canUpdate:R.pipe(W(M(!1))),checkedAt:U(J),message:U(K)}),zue=z({status:H([`idle`,`queued`,`running`,`succeeded`,`failed`,`unchanged`]),startedAt:U(J),finishedAt:U(J),message:U(K),output:U(L.check(db(1e4)))}),VN=B(z({instanceId:SO,driver:yO,displayName:F(K),accentColor:F(K),badgeLabel:F(K),continuation:F(Lue),showInteractionModeToggle:F(R),requiresNewThreadForModelChange:F(R),supportedRuntimeModes:F(B(QO)),enabled:R,installed:R,version:U(K),status:Aue,auth:jue,checkedAt:J,message:F(K),availability:F(Iue),unavailableReason:F(K),models:B(Mue),slashCommands:B(Pue).pipe(W(M([]))),skills:B(Fue).pipe(W(M([]))),versionAdvisory:P(Rue),updateState:P(zue)})),Bue=e=>e.availability!==`unavailable`,Vue=z({logsDirectoryPath:K,localTracingEnabled:R,otlpTracesUrl:F(K),otlpTracesEnabled:R,otlpMetricsUrl:F(K),otlpMetricsEnabled:R}),Hue=H([`trace-file-not-found`,`trace-file-read-failed`]),Uue=z({name:K,count:q,failureCount:q,totalDurationMs:Ny,averageDurationMs:Ny,maxDurationMs:Ny}),Wue=z({name:K,cause:K,count:q,lastSeenAt:kb,traceId:K,spanId:K}),Gue=z({name:K,cause:K,durationMs:Ny,endedAt:kb,traceId:K,spanId:K}),Kue=z({name:K,durationMs:Ny,endedAt:kb,traceId:K,spanId:K}),que=z({spanName:K,level:K,message:K,seenAt:kb,traceId:K,spanId:K}),Jue=z({traceFilePath:K,scannedFilePaths:B(K),readAt:kb,recordCount:q,parseErrorCount:q,firstSpanAt:pb(kb),lastSpanAt:pb(kb),failureCount:q,interruptionCount:q,slowSpanThresholdMs:q,slowSpanCount:q,logLevelCounts:Iy(K,q),topSpansByCount:B(Uue),slowestSpans:B(Kue),commonFailures:B(Wue),latestFailures:B(Gue),latestWarningAndErrorLogs:B(que),partialFailure:pb(R),error:pb(z({kind:Hue,message:K}))}),HN=H([`SIGINT`,`SIGKILL`]),Yue=z({serverPid:Gb,readAt:kb,processCount:q,totalRssBytes:q,totalCpuPercent:Ny,processes:B(z({pid:Gb,ppid:q,pgid:pb(cb),status:K,cpuPercent:Ny,rssBytes:q,elapsed:K,command:K,depth:q,childPids:B(Gb)})),error:pb(z({message:K}))}),Xue=z({windowMs:q,bucketMs:q}),Zue=z({startedAt:kb,endedAt:kb,avgCpuPercent:Ny,maxCpuPercent:Ny,maxRssBytes:q,maxProcessCount:q}),Que=z({processKey:K,pid:Gb,ppid:q,command:K,depth:q,isServerRoot:R,firstSeenAt:kb,lastSeenAt:kb,currentCpuPercent:Ny,avgCpuPercent:Ny,maxCpuPercent:Ny,cpuSecondsApprox:Ny,currentRssBytes:q,maxRssBytes:q,sampleCount:q}),$ue=H([`ProcessDiagnosticsQueryTimeoutError`,`ProcessDiagnosticsQueryFailedError`,`ProcessDiagnosticsServerProcessSignalError`,`ProcessDiagnosticsNotDescendantError`,`ProcessDiagnosticsSignalFailedError`]),ede=z({readAt:kb,windowMs:q,bucketMs:q,sampleIntervalMs:q,retainedSampleCount:q,totalCpuSecondsApprox:Ny,buckets:B(Zue),topProcesses:B(Que),error:pb(z({failureTag:$ue,message:K}))}),UN=z({pid:Gb,signal:HN}),WN=z({pid:Gb,signal:HN,signaled:R,message:pb(K)}),GN=z({environment:Gw,auth:yw,cwd:K,keybindingsConfigPath:K,keybindings:pN,issues:BN,providers:VN,availableEditors:B(bM),observability:Vue,settings:LN,shellResumeCompletionMarker:P(R),threadResumeCompletionMarker:P(R)}),KN=z({key:cN,command:sN,when:F(lN)}),qN=z({key:cN,command:sN,when:F(lN),replace:F(KN)}),JN=KN,YN=z({keybindings:pN,issues:BN}),XN=YN;z({issues:BN,providers:VN,settings:F(LN)});var ZN=z({keybindings:pN,issues:BN}),QN=z({providers:VN}),$N=z({settings:LN}),eP=V([z({version:I(1),type:I(`snapshot`),config:GN}),z({version:I(1),type:I(`keybindingsUpdated`),payload:ZN}),z({version:I(1),type:I(`providerStatuses`),payload:QN}),z({version:I(1),type:I(`settingsUpdated`),payload:$N})]),tP=z({at:J,environment:Gw}),nP=z({environment:Gw,cwd:K,projectName:K,bootstrapProjectId:F(Jb),bootstrapThreadId:F(Y)}),rP=V([z({version:I(1),sequence:q,type:I(`welcome`),payload:nP}),z({version:I(1),sequence:q,type:I(`ready`),payload:tP})]),iP=z({providers:VN}),aP=z({provider:yO,instanceId:P(SO)}),oP=class extends G()(`ServerProviderUpdateError`,{provider:yO,reason:K,cause:F(Cb())}){get message(){return`Provider update failed for ${this.provider}: ${this.reason}`}},sP=z({targetVersion:K}),cP=z({targetVersion:K,method:Uw}),lP=class extends G()(`ServerSelfUpdateError`,{reason:K,cause:F(Cb())}){get message(){return`Server update failed: ${this.reason}`}},uP=H([`git`,`jj`,`unknown`]),dP=z({source:H([`live-local`,`cached-local`,`cached-remote`,`explicit-remote`]),observedAt:kb,expiresAt:pb(kb)});z({kind:uP,supportsWorktrees:R,supportsBookmarks:R,supportsAtomicSnapshot:R,supportsPushDefaultRemote:R,ignoreClassifier:H([`native`,`git-compatible-fallback`])}),z({kind:uP,rootPath:K,metadataPath:U(K),freshness:dP}),z({paths:B(K),truncated:R,freshness:dP}),z({remotes:B(z({name:K,url:K,pushUrl:pb(K),isPrimary:R})),freshness:dP});var fP=H([`authentication`,`not-found`,`command-failed`]),pP=class e extends G()(`VcsProcessSpawnError`,{operation:L,command:L,cwd:L,argumentCount:F(q),cause:Cb()}){get message(){return`VCS process failed to spawn in ${this.operation}: ${this.command} (${this.cwd})`}static fromProcessSpawnError(t,n){return new e({...t,cause:n.cause})}},mP=class e extends G()(`VcsProcessExitError`,{operation:L,command:L,cwd:L,argumentCount:F(q),exitCode:Ny,detail:L,failureKind:F(fP),stderrLength:F(q),stderrTruncated:F(R)}){get message(){return`VCS process failed in ${this.operation}: ${this.command} (${this.cwd}) exited with ${this.exitCode} - ${this.detail}`}static fromProcessExit(t,n,r){let i=r===`authentication`?`Authentication failed.`:r===`not-found`?t.command===`glab`?`Merge request not found.`:t.command===`gh`||t.command===`az`?`Pull request not found.`:`VCS resource not found.`:`Process exited with a non-zero status.`;return new e({...t,exitCode:n.exitCode,detail:i,failureKind:r,stderrLength:n.stderr.length,stderrTruncated:n.stderrTruncated})}},hP=class e extends G()(`VcsProcessTimeoutError`,{operation:L,command:L,cwd:L,argumentCount:F(q),timeoutMs:Ny}){get message(){return`VCS process timed out in ${this.operation}: ${this.command} (${this.cwd}) after ${this.timeoutMs}ms`}static fromProcessTimeoutError(t,n){return new e({...t,timeoutMs:n.timeoutMs})}},gP={operation:L,command:L,cwd:L,argumentCount:F(q)},_P=class extends G()(`VcsProcessStdinWriteError`,{...gP,stdinBytes:q,cause:Cb()}){get message(){return`VCS process failed to write ${this.stdinBytes} bytes to stdin in ${this.operation}: ${this.command} (${this.cwd})`}},vP=class extends G()(`VcsProcessOutputReadError`,{...gP,stream:H([`stdout`,`stderr`,`exitCode`]),cause:Cb()}){get message(){return`VCS process failed to read ${this.stream} in ${this.operation}: ${this.command} (${this.cwd})`}},yP=class extends G()(`VcsProcessOutputLimitError`,{...gP,stream:H([`stdout`,`stderr`]),maxBytes:q,observedBytes:q}){get message(){return`VCS process ${this.stream} produced ${this.observedBytes} bytes in ${this.operation}: ${this.command} (${this.cwd}), exceeding the ${this.maxBytes} byte limit`}},bP=class extends G()(`VcsProcessMissingExitCodeError`,gP){get message(){return`VCS process completed without an exit code in ${this.operation}: ${this.command} (${this.cwd})`}};V([_P,vP,yP,bP]);var xP=V([pP,mP,hP,_P,vP,yP,bP,class extends G()(`VcsRepositoryDetectionError`,{operation:L,cwd:L,detail:L,cause:F(Cb())}){get message(){return`VCS repository detection failed in ${this.operation}: ${this.cwd} - ${this.detail}`}},class extends G()(`VcsUnsupportedOperationError`,{operation:L,kind:uP,detail:L}){get message(){return`VCS operation is unsupported for ${this.kind} in ${this.operation}: ${this.detail}`}}]),SP=H([`github`,`gitlab`,`azure-devops`,`bitbucket`,`unknown`]),CP=z({kind:SP,name:K,baseUrl:L});z({provider:SP,number:Gb,title:K,url:L,baseRefName:K,headRefName:K,state:H([`open`,`closed`,`merged`]),updatedAt:pb(kb),isCrossRepository:F(R),headRepositoryNameWithOwner:F(U(K)),headRepositoryOwnerLogin:F(U(K))}),z({nameWithOwner:K,url:K,sshUrl:K});var wP=H([`private`,`public`]),TP=H([`auto`,`ssh`,`https`]),EP=z({provider:SP,nameWithOwner:K,url:K,sshUrl:K}),DP=z({provider:SP,repository:K,cwd:F(K)}),OP=z({provider:F(SP),repository:F(K),remoteUrl:F(K),destinationPath:K,protocol:F(TP)}),kP=z({cwd:K,remoteUrl:K,repository:U(EP)}),AP=z({cwd:K,provider:SP,repository:K,visibility:wP,remoteName:F(K),protocol:F(TP)}),jP=H([`pushed`,`remote_added`]),MP=z({repository:EP,remoteName:K,remoteUrl:K,branch:K,upstreamBranch:F(K),status:jP}),NP=H([`available`,`missing`]),PP=z({status:H([`authenticated`,`unauthenticated`,`unknown`]),account:pb(K),host:pb(K),detail:pb(K)}),FP={label:K,executable:F(K),status:NP,version:pb(K),installHint:K,detail:pb(K)},IP=z({kind:uP,implemented:R,...FP}),LP=z({kind:SP,...FP,auth:PP}),RP=z({versionControlSystems:B(IP),sourceControlProviders:B(LP)}),zP=class extends G()(`SourceControlProviderError`,{provider:SP,operation:L,cwd:L,command:F(L),repository:F(L),reference:F(L),detail:L,cause:F(Cb())}){get message(){return`Source control provider ${this.provider} failed in ${this.operation}: ${this.detail}`}},BP=class extends G()(`SourceControlRepositoryError`,{provider:SP,operation:L,detail:L,cause:F(Cb())}){get message(){return`Source control repository operation ${this.operation} failed for ${this.provider}: ${this.detail}`}},VP=K,HP=200,UP=H([`commit`,`push`,`create_pr`,`commit_push`,`commit_push_pr`]),WP=H([`branch`,`commit`,`push`,`pr`]);H([`action_started`,`phase_started`,`hook_started`,`hook_output`,`hook_finished`,`action_finished`,`action_failed`]);var GP=H([`stdout`,`stderr`]),KP=H([`created`,`skipped_no_changes`,`skipped_not_requested`]),qP=H([`pushed`,`skipped_not_requested`,`skipped_up_to_date`]),JP=H([`created`,`skipped_not_requested`]),YP=H([`created`,`opened_existing`,`skipped_not_requested`]),XP=H([`open`,`closed`,`merged`]),ZP=VP,QP=H([`open`,`closed`,`merged`]),$P=H([`local`,`worktree`]),eF=z({kind:UP}),tF=V([z({kind:I(`none`)}),z({kind:I(`open_pr`),label:VP,url:L}),z({kind:I(`run_action`),label:VP,action:eF})]),nF=z({title:VP,description:F(VP),cta:tF}),rF=z({name:VP,isRemote:F(R),remoteName:F(VP),current:R,isDefault:R,worktreePath:VP.pipe(U)}),iF=z({path:VP,refName:VP}),aF=z({number:Gb,title:VP,url:L,baseBranch:VP,headBranch:VP,state:QP}),oF=z({cwd:VP}),sF=z({cwd:VP}),cF=z({actionId:VP,cwd:VP,action:UP,commitMessage:F(VP.check(db(1e4))),featureBranch:F(R),filePaths:F(B(VP).check(lb(1)))}),lF=z({cwd:VP,query:F(VP.check(db(256))),cursor:F(q),includeMatchingRemoteRefs:F(R),refKind:F(H([`all`,`local`,`remote`])),refresh:F(R),limit:F(Gb.check(ob(HP)))}),uF=z({cwd:VP,refName:VP,newRefName:F(VP),baseRefName:F(VP),path:U(VP)}),dF=z({cwd:VP,reference:ZP}),fF=z({cwd:VP,reference:ZP,mode:$P,threadId:F(Y)}),pF=z({cwd:VP,path:VP,force:F(R)}),mF=z({cwd:VP,refName:VP,switchRef:F(R)}),hF=z({refName:VP}),gF=z({cwd:VP,refName:VP}),_F=z({cwd:VP,kind:F(uP)}),vF=z({number:Gb,title:VP,url:L,baseRef:VP,headRef:VP,state:XP}),yF={isRepo:R,sourceControlProvider:F(CP),hasPrimaryRemote:R,isDefaultRef:R,refName:U(VP),hasWorkingTreeChanges:R,workingTree:z({files:B(z({path:VP,insertions:q,deletions:q})),insertions:q,deletions:q})},bF={hasUpstream:R,aheadCount:q,behindCount:q,aheadOfDefaultCount:F(q),pr:U(vF)},xF=z(yF),SF=z(bF),CF=z({...yF,...bF}),wF=V([Jy(`snapshot`,{local:xF,remote:U(SF)}),Jy(`localUpdated`,{local:xF}),Jy(`remoteUpdated`,{remote:U(SF)})]),TF=z({refs:B(rF),isRepo:R,hasPrimaryRemote:R,nextCursor:q.pipe(U),totalCount:q}),EF=z({worktree:iF}),DF=z({pullRequest:aF}),OF=z({pullRequest:aF,branch:VP,worktreePath:VP.pipe(U)}),kF=z({refName:U(VP)}),AF=z({action:UP,branch:z({status:JP,name:F(VP)}),commit:z({status:KP,commitSha:F(VP),subject:F(VP)}),push:z({status:qP,branch:F(VP),upstreamBranch:F(VP),setUpstream:F(R)}),pr:z({status:YP,url:F(L),number:F(Gb),baseBranch:F(VP),headBranch:F(VP),title:F(VP)}),toast:nF}),jF=z({status:H([`pulled`,`skipped_up_to_date`]),refName:VP,upstreamRef:VP.pipe(U)}),MF=class extends G()(`GitCommandError`,{operation:L,command:L,cwd:L,argumentCount:F(Ny),exitCode:F(Ny),stdoutLength:F(Ny),stderrLength:F(Ny),outputLength:F(Ny),detail:L,cause:F(Cb())}){get message(){return`Git command failed in ${this.operation} (${this.cwd}): ${this.detail}`}},NF=class extends G()(`TextGenerationError`,{operation:L,detail:L,cause:F(Cb())}){get message(){return`Text generation failed in ${this.operation}: ${this.detail}`}},PF=V([class extends G()(`GitManagerError`,{operation:L,cwd:L,detail:L,cause:F(Cb())}){get message(){return`Git manager failed in ${this.operation}: ${this.detail}`}},class extends G()(`GitPullRequestMaterializationError`,{cwd:VP,pullRequestNumber:Gb,headRepository:U(VP),headBranch:VP,localBranch:VP,cause:Cb()}){get message(){return`Failed to materialize pull request #${this.pullRequestNumber} branch ${this.headBranch} as ${this.localBranch}.`}},MF,zP,NF]),FF=z({actionId:VP,cwd:VP,action:UP}),IF=V([z({...FF.fields,kind:I(`action_started`),phases:B(WP)}),z({...FF.fields,kind:I(`phase_started`),phase:WP,label:VP}),z({...FF.fields,kind:I(`hook_started`),hookName:VP}),z({...FF.fields,kind:I(`hook_output`),hookName:U(VP),stream:GP,text:VP}),z({...FF.fields,kind:I(`hook_finished`),hookName:VP,exitCode:U(cb),durationMs:U(q)}),z({...FF.fields,kind:I(`action_finished`),result:AF}),z({...FF.fields,kind:I(`action_failed`),phase:U(WP),message:VP})]),LF=512,RF=64,zF=32,BF=128,VF=H([`backlog`,`todo`,`in_progress`,`in_review`,`done`,`cancelled`]),HF=`backlog`,UF=H([`none`,`low`,`medium`,`high`,`urgent`]),WF=/^[A-Za-z][A-Za-z0-9]{0,9}$/,GF=/^[A-Za-z][A-Za-z0-9]{0,9}-[1-9][0-9]*$/,KF=e=>GF.test(e),qF=e=>e.toUpperCase(),JF=K.check(db(RF)),YF=Jb.pipe(my({description:`Id of the project this task belongs to.`})),XF=Y.pipe(my({description:`Id of the agent thread working this task.`})),ZF=K.check(db(LF)).pipe(my({description:`One-line summary of the work. Required.`})),QF=L.pipe(my({description:`Markdown detail: context, acceptance criteria, links.`})),$F=VF.pipe(my({description:`Board column: backlog (recorded, not queued), todo (queued next), in_progress, in_review, done, cancelled (closed without doing the work).`})),eI=VF.pipe(kre(()=>af(HF))),tI=UF.pipe(my({description:`Relative urgency: none, low, medium, high or urgent.`})),nI=K.check(db(BF)).pipe(my({description:`Who owns the task — a person's handle or an agent name.`})),rI=K.pipe(my({description:`Canonical repository key (normalized git remote, e.g. github.com/owner/repo). Portable across machines, unlike projectId.`})),iI=K.pipe(my({description:`Manual board position key. Lexicographic: smaller sorts higher in the column. Null means no manual position.`})),aI=z({source:H([`linear`]),identifier:K,url:K}),oI=aI.pipe(my({description:`The tracker issue this task mirrors, e.g. a Linear ticket. Null for a task that originated on this board.`})),sI=Yb.pipe(my({description:`The task this one is a subtask of - the parent's UUID or readable id (e.g. P4-12). Null for a task that is not part of a larger one.`})),cI=B(JF).check(db(zF)).pipe(my({description:`Free-form tags used to group and filter tasks.`})),lI=Yb.pipe(my({description:`Id of the task to act on - the UUID or the readable id (e.g. P4-12).`})),uI=z({taskId:Yb,readableId:U(K).pipe(W(M(null))),orderKey:U(K).pipe(W(M(null))),projectId:U(Jb),repositoryKey:U(K),threadId:U(Y),externalRef:U(aI).pipe(W(M(null))),parentTaskId:U(Yb).pipe(W(M(null))),title:K.check(db(LF)),body:L,status:eI,priority:UF,assignee:U(K.check(db(BF))),labels:B(JF).check(db(zF)),createdAt:J,updatedAt:J}),dI=z({projectId:F(YF),repositoryKey:F(rI),threadId:F(XF),externalRef:F(oI),parentTaskId:F(sI),title:ZF,body:F(QF),status:F($F),priority:F(tI),assignee:F(nI),labels:F(cI)});z({...dI.fields,readableIdPrefix:F(K),orderKey:F(iI)});var fI=z({taskId:lI,projectId:F(U(YF)),repositoryKey:F(U(rI)),threadId:F(U(XF)),externalRef:F(U(oI)),parentTaskId:F(U(sI)),title:F(ZF),body:F(QF),status:F($F),priority:F(tI),assignee:F(U(nI)),labels:F(cI),orderKey:F(U(iI))});z({projectId:F(YF),title:ZF,body:F(QF),priority:F(tI),assignee:F(nI),labels:F(cI)}),z({awaitingConfirmation:I(!0)}),z({threadId:F(Y.pipe(my({description:`Thread whose linked task to read. Defaults to this agent session's own thread.`})))});var pI=z({taskId:lI}),mI=z({projectId:F(YF),repositoryKey:F(rI),threadId:F(XF),status:F($F),assignee:F(nI)});V([z({type:I(`upserted`),task:uI}),z({type:I(`deleted`),taskId:Yb})]);var hI=V([z({type:I(`snapshot`),tasks:B(uI)}),z({type:I(`upserted`),task:uI}),z({type:I(`deleted`),taskId:Yb})]);z({patch:fI,expectedStatus:VF}),V([z({outcome:I(`updated`),task:uI}),z({outcome:I(`missing`)}),z({outcome:I(`conflict`),current:uI})]);var gI=z({taskId:lI}),_I=z({task:uI,threadId:Y}),vI=H([`no-project`,`project-missing`,`no-model`]),yI=class extends G()(`TaskNotStartableError`,{taskId:Yb,reason:vI}){get message(){switch(this.reason){case`no-project`:return`This task has no project, so there is nowhere to run it. Set a project on the task first.`;case`project-missing`:return`This task's project is not registered on this server. Point it at a project that is.`;case`no-model`:return`This task's project has no default model. Choose one in the project's settings, then start the task again.`}}},bI=z({tasks:B(uI)}),xI=z({task:uI}),SI=z({task:U(uI)}),CI=class extends G()(`TaskToolUnavailableError`,{capability:I(`tasks`),environmentId:Xb,threadId:Y,providerSessionId:K,providerInstanceId:SO}){get message(){return`MCP credential does not grant the ${this.capability} capability.`}},wI=class extends G()(`TaskNotFoundError`,{taskId:Yb}){get message(){return`No task exists with id ${this.taskId}.`}},TI=class extends G()(`TaskStoreError`,{operation:K}){get message(){return`The task store failed during ${this.operation}.`}};V([CI,wI,class extends G()(`TaskNotLinkedError`,{threadId:Y}){get message(){return`No task is linked to thread ${this.threadId}.`}},TI]);var EI=`p4.json`,DI=`https://p4.codes/schema/p4.json`,OI=512,kI=50,AI=(e,t)=>{let n=L.annotate(e),r=t===void 0?n.check(ub()):n.check(ub(),db(t));return r.pipe(Wy(r,cg()))},jI=z({name:AI({description:`Display name for the script, shown in the P4Code scripts menu.`}),command:AI({description:`Shell command executed in a P4Code terminal at the project root.`}),icon:P(hk.annotate({description:`Icon shown next to the script in the scripts menu. Defaults to "play".`})),runOnWorktreeCreate:P(R.annotate({description:`When true, the script runs automatically after a worktree is created for a new thread.`})),previewUrl:P(AI({description:`URL opened in the in-app browser preview when this script runs. Only honored on the desktop build.`})),autoOpenPreview:P(R.annotate({description:"When true, automatically open the preview panel at `previewUrl` the moment the script starts."}))}).annotate({description:`A project script that team members can import into P4Code.`}),MI=z({$schema:P(L.annotate({description:`URL of the JSON Schema for this file, typically "${DI}".`})),iconPath:P(AI({description:`Workspace-relative path to the project icon (e.g. "assets/logo.svg"). Checked before P4Code's built-in icon locations.`},OI)),scripts:P(B(jI).annotate({description:`Project scripts shared with everyone who opens this repository in P4Code.`}).check(db(kI))),taskPrefix:P(AI({description:`Prefix for this project's readable task ids on the task board (e.g. "P4" numbers tasks P4-1, P4-2, ...). Letters and digits, starting with a letter, at most 10 characters; compared case-insensitively. Tasks without a project use "T".`}).check(eb(WF)))}).annotate({title:`P4 project file`,description:`Checked-in project configuration for P4Code (p4.json at the repository root). See https://p4.codes for documentation.`}),NI=200,PI=512,FI=512,II=z({cwd:K,query:K.check(db(256)),limit:Gb.check(ob(NI))}),LI=z({path:K,kind:H([`file`,`directory`])}),RI=z({entries:B(LI),truncated:R}),zI=z({cwd:K}),BI=z({entries:B(LI),truncated:R}),VI=H([`workspace_root_not_found`,`workspace_root_create_failed`,`workspace_root_stat_failed`,`workspace_root_not_directory`,`search_index_create_failed`,`search_index_scan_timed_out`,`search_index_search_failed`]);function HI(e){if(`message`in e)return typeof e.message==`string`?e.message:void 0}var UI=class extends G()(`ProjectSearchEntriesError`,{cwd:F(K),queryLength:F(q),limit:F(Gb),failure:F(VI),normalizedCwd:F(K),timeout:F(K),detail:F(K),message:K,cause:F(Cb())}){constructor(e){super({...e,message:HI(e)??`Failed to search workspace entries in '${e.cwd}'.`})}},WI=class extends G()(`ProjectListEntriesError`,{cwd:F(K),failure:F(VI),normalizedCwd:F(K),timeout:F(K),detail:F(K),message:K,cause:F(Cb())}){constructor(e){super({...e,message:HI(e)??`Failed to list workspace entries in '${e.cwd}'.`})}},GI=z({cwd:K,relativePath:K.check(db(FI))}),KI=z({relativePath:K,contents:L,byteLength:q,truncated:R}),qI=H([`workspace_path_outside_root`,`resolved_path_outside_root`,`path_not_file`,`binary_file`,`operation_failed`]),JI=H([`realpath-workspace-root`,`realpath-target`,`open`,`stat`,`read`,`close`,`make-directory`,`write-file`]),YI=class extends G()(`ProjectReadFileError`,{cwd:F(K),relativePath:F(K),failure:F(qI),resolvedPath:F(K),resolvedWorkspaceRoot:F(K),operation:F(JI),operationPath:F(K),message:K,cause:F(Cb())}){constructor(e){super({...e,message:HI(e)??`Failed to read workspace file '${e.relativePath}' in '${e.cwd}'.`})}},XI=z({cwd:K,relativePath:K.check(db(PI)),contents:L}),ZI=z({relativePath:K}),QI=class extends G()(`ProjectWriteFileError`,{cwd:F(K),relativePath:F(K),failure:F(qI),resolvedPath:F(K),resolvedWorkspaceRoot:F(K),operation:F(JI),operationPath:F(K),message:K,cause:F(Cb())}){constructor(e){super({...e,message:HI(e)??`Failed to write workspace file '${e.relativePath}' in '${e.cwd}'.`})}},$I=z({reference:K.pipe(my({description:`The ticket as it was written: an identifier like MOBILE-12241, or a tracker URL. Pass it through verbatim rather than reformatting it.`}))}),eL=z({externalRef:aI,title:K,description:F(K)}),tL=H([`not_configured`,`not_authorized`,`not_found`,`unavailable`]),nL=class extends G()(`TicketResolveError`,{reason:tL,detail:L}){get message(){return this.detail}};z({title:K.annotate({description:`The new thread title. Replaces the current one.`})}),z({threadId:Y,title:K});var rL=F(Y.annotate({description:`The thread to act on. Omit for this session's own thread. Only threads this session started with thread_spawn can be named here; any other id is refused.`}));z({title:K.annotate({description:`Title for the new thread. Shown on the board and in the sidebar.`}),prompt:K.annotate({description:`The first message to send. The thread starts its turn immediately, so this is the whole brief the new agent gets.`}),projectId:F(Jb.annotate({description:`Project to start the thread in. Defaults to this session's own project.`})),runtimeMode:F(QO.annotate({description:`Permission mode for the new thread. Defaults to this session's own.`})),interactionMode:F(ek),compressMode:F(nk),unpromptedSubagents:F(R)}),z({threadId:Y,projectId:Jb,title:K}),z({threadId:rL,title:F(K),modelSelection:F(ZO),runtimeMode:F(QO),interactionMode:F(ek),compressMode:F(nk),unpromptedSubagents:F(R)}),z({threadId:Y,applied:B(L)}),z({threadId:rL}),z({threadId:Y,outcome:H([`settled`,`queued`])}),z({threadId:rL,snoozedUntil:J.annotate({description:`When the thread should come back, as an ISO 8601 timestamp.`})}),z({threadId:Y,snoozedUntil:J});var iL=H([`CLAUDE.md`,`AGENTS.md`]);z({text:K.annotate({description:`Markdown to append to the user-scope memory file, as its own block.`}),file:F(iL.annotate({description:`Which memory file to append to. Defaults to CLAUDE.md.`}))}),z({file:iL,path:L}),z({path:K.annotate({description:`Absolute path of the asset file to overwrite. Must sit inside one of this machine's agent asset directories: user skills, the provider config directory that holds the memory files, or the subagent definitions directory.`}),content:L.check(ub()).annotate({description:`The compressed file, whole. Headings, fenced code blocks, inline code, URLs, paths and any YAML frontmatter must come back unchanged; only the prose around them may be rewritten.`})}),z({path:L,backupPath:L,charsBefore:Ny,charsAfter:Ny,estimatedTokensBefore:Ny,estimatedTokensAfter:Ny,warnings:B(L)});var aL=class extends G()(`ThreadToolUnavailableError`,{capability:I(`threads`),environmentId:Xb,threadId:Y,providerSessionId:K,providerInstanceId:SO}){get message(){return`MCP credential does not grant the ${this.capability} capability.`}},oL=class extends G()(`ThreadRenameRejectedError`,{threadId:Y,detail:L}){get message(){return`Renaming thread ${this.threadId} failed: ${this.detail}`}},sL=class extends G()(`MemoryAppendFailedError`,{file:iL,detail:L}){get message(){return`Appending to ${this.file} failed: ${this.detail}`}},cL=class extends G()(`AssetCompressRefusedError`,{path:L,detail:L}){get message(){return`Compressing ${this.path} was refused: ${this.detail}`}},lL=class extends G()(`AssetCompressValidationFailedError`,{path:L,errors:B(L)}){get message(){return`The compressed ${this.path} did not validate, so nothing was written: ${this.errors.join(` `)}`}};V([aL,class extends G()(`ThreadControlNotPermittedError`,{threadId:Y}){get message(){return`This session cannot act on thread ${this.threadId}. A session may act on its own thread and on threads it started with thread_spawn.`}},class extends G()(`ThreadSpawnNotPermittedError`,{threadId:Y,detail:L}){get message(){return`Thread ${this.threadId} cannot start another thread: ${this.detail}`}},class extends G()(`ThreadControlRejectedError`,{threadId:Y,commandType:L,detail:L}){get message(){return`${this.commandType} on thread ${this.threadId} failed: ${this.detail}`}},oL,sL,cL,lL]),z({threadId:Y.annotate({description:`The watched thread to read events from. Must be explicitly granted.`}),afterSequence:F(q.annotate({description:`Exclusive sequence cursor. Events with a higher sequence are returned. Omit to read from the beginning.`})),limit:F(q.check(ob(200)).annotate({description:`Maximum events to return (default 50, max 200).`}))}),z({threadId:Y,events:B(WA),headSequence:q,hasMore:R}),V([class extends G()(`WatchToolUnavailableError`,{capability:I(`watch`),environmentId:Xb,threadId:Y,providerSessionId:K,providerInstanceId:SO}){get message(){return`MCP credential does not grant the ${this.capability} capability.`}},class extends G()(`ThreadWatchNotPermittedError`,{threadId:Y}){get message(){return`This session was not granted watch access to thread ${this.threadId}.`}},class extends G()(`ThreadWatchFailedError`,{threadId:Y,detail:L}){get message(){return`Reading events for thread ${this.threadId} failed: ${this.detail}`}}]);var uL=128,dL=256,fL=512*1024,pL=H([`skill`,`memory`,`mcp`,`agent`]),mL=K.check(db(uL),eb(/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/u,{title:`agentAssetName`,description:`Letters, digits, dot, dash and underscore; must not start with a separator.`})),hL=z({kind:pL,name:mL}),gL=z({path:K.check(db(dL),eb(/^[a-zA-Z0-9][a-zA-Z0-9._-]*(?:\/[a-zA-Z0-9][a-zA-Z0-9._-]*)*$/u,{title:`agentAssetFilePath`,description:"Forward-slash relative path; no leading slash, no `..`, no backslashes."})),content:L.check(db(fL))}),_L=B(gL).check(lb(1),db(512));z({assetId:sie,kind:pL,name:mL,files:_L,version:Gb,createdAt:J,updatedAt:J}),z({kind:pL,name:mL,files:_L,expectedVersion:F(Gb)}),z({kind:F(pL)});var vL=H([`auto`,`paused`]),yL=H([`all`,`selected`]),bL=z({mode:yL}),xL=H([`environment`,`stored`,`none`]),SL=z({kind:pL,name:L,state:H([`synced`,`pending`,`local-edit`,`conflict`,`unmanaged`,`hub-only`]),version:U(cb),detail:U(L)}),CL=z({kind:pL,name:L,reason:L}),wL=z({kind:pL,name:L,reason:L}),TL=z({kind:pL,path:U(L)}),EL=z({configured:R,hubUrl:U(L),syncMode:vL,shareMode:yL,source:xL,roots:B(TL),entries:B(SL),refused:B(CL),unavailable:U(L)}),DL=z({ran:R,roots:B(TL),materialized:B(hL),published:B(hL),removed:B(hL),conflicts:B(wL),unmanaged:B(hL),refused:B(CL),unavailable:U(L)}),OL=z({baseUrl:K,token:K}),kL=z({mode:vL}),AL=z({token:L,digest:L}),jL=hL,ML=z({found:R,kind:pL,name:mL,files:B(gL),version:U(cb),updatedAt:U(J),unavailable:U(L)}),NL=z({kind:pL,name:mL,files:_L,expectedVersion:Gb}),PL=z({kind:pL,name:mL,expectedVersion:F(Gb)}),FL=z({kind:pL,name:mL,files:_L}),IL=z({outcome:H([`created`,`removed`,`exists`,`missing`,`managed`,`refused`,`no-root`,`failed`]),path:U(L),detail:U(L)}),LL=class extends G()(`HubLinkError`,{detail:L}){get message(){return this.detail}};new TextEncoder;var RL=mL,zL=z({target:H([`header`,`env`]),key:K}),BL={name:RL,enabled:R,secrets:F(B(zL))},VL=V([z({...BL,transport:I(`stdio`),command:K,args:F(B(L)),env:F(Iy(L,L))}),z({...BL,transport:H([`http`,`sse`]),url:K,headers:F(Iy(L,L))})]),HL=z({required:R,connected:R}),UL=H([`registry`,`claude`,`project`]),WL=z({registration:VL,missingSecrets:B(zL),ready:R,oauth:F(HL),source:F(UL),projectDir:F(L)}),GL=z({dir:L,title:L}),KL=z({servers:B(WL),projects:F(B(GL))}),qL=z({registration:VL,source:F(UL),projectDir:F(L)}),JL=z({name:RL,source:F(UL),projectDir:F(L)}),YL=z({name:RL,slot:zL,value:L}),XL=z({authorizeUrl:L}),ZL=class extends G()(`McpRegistryError`,{detail:L}){get message(){return this.detail}},QL=z({id:K,name:K,source:K,installs:cb}),$L=z({query:K}),eR=z({results:B(QL),unavailable:U(L)}),tR=z({id:K}),nR=z({path:L,reason:H([`too-large`,`too-many-files`,`over-total-size`])}),rR=z({found:R,id:K,name:L,source:L,sourceUrl:L,files:B(gL),skipped:B(nR),unavailable:U(L)}),iR=512,aR=z({partialPath:K.check(db(iR)),cwd:F(K.check(db(iR)))}),oR=z({parentPath:K,entries:B(z({name:K,fullPath:K}))}),sR=H([`windows_path_unsupported`,`current_project_required`,`read_directory_failed`]);function cR(e){if(`message`in e)return typeof e.message==`string`?e.message:void 0}var lR=class extends G()(`FilesystemBrowseError`,{partialPath:F(K),cwd:F(K),failure:F(sR),parentPath:F(K),platform:F(K),message:K,cause:F(Cb())}){constructor(e){let t=e.cwd===void 0?``:` from '${e.cwd}'`;super({...e,message:cR(e)??`Failed to browse filesystem path '${e.partialPath}'${t}.`})}},uR=1024,dR=V([Jy(`workspace-file`,{threadId:Y,path:K.check(db(uR))}),Jy(`attachment`,{attachmentId:K.check(db(256))}),Jy(`project-favicon`,{cwd:K.check(db(uR))})]),fR=z({resource:dR}),pR=z({relativeUrl:K.check(db(4096)),expiresAt:Ny}),mR=V([class extends G()(`AssetWorkspaceContextNotFoundError`,{resource:dR}){get message(){return`Workspace context was not found.`}},class extends G()(`AssetWorkspaceContextResolutionError`,{resource:dR,cause:Cb()}){get message(){return`Failed to resolve workspace context.`}},class extends G()(`AssetWorkspaceRootNormalizationError`,{resource:dR,cause:Cb()}){get message(){return`Failed to normalize the workspace root.`}},class extends G()(`AssetWorkspacePathValidationError`,{resource:dR,cause:Cb()}){get message(){return`Workspace file path must be relative to the project root.`}},class extends G()(`AssetPreviewTypeValidationError`,{resource:dR}){get message(){return`Only browser documents and images can be previewed.`}},class extends G()(`AssetWorkspaceAssetInspectionError`,{resource:dR,cause:Cb()}){get message(){return`Failed to inspect the workspace asset.`}},class extends G()(`AssetWorkspaceAssetNotFoundError`,{resource:dR}){get message(){return`Workspace asset was not found.`}},class extends G()(`AssetWorkspaceResolutionError`,{resource:dR,cause:Cb()}){get message(){return`Failed to resolve workspace.`}},class extends G()(`AssetAttachmentNotFoundError`,{resource:dR}){get message(){return`Attachment was not found.`}},class extends G()(`AssetProjectFaviconResolutionError`,{resource:dR,cause:Cb()}){get message(){return`Failed to resolve project favicon.`}},class extends G()(`AssetProjectFaviconInspectionError`,{resource:dR,cause:Cb()}){get message(){return`Failed to inspect the project favicon.`}},class extends G()(`AssetProjectFaviconNotFoundError`,{resource:dR}){get message(){return`Project favicon was not found.`}},class extends G()(`AssetSigningKeyLoadError`,{resource:dR,cause:Cb()}){get message(){return`Failed to load the asset signing key.`}}]),hR=z({cwd:K,baseRef:F(K),ignoreWhitespace:P(R)}),gR=z({cwd:K,generatedAt:kb,sources:B(z({id:K,kind:H([`working-tree`,`branch-range`]),title:K,baseRef:U(K),headRef:U(K),diff:L,diffHash:K,truncated:R}))}),_R=V([xP,MF]),vR=`~effect/rpc/RpcSchema/StreamSchema`;function yR(e){return nt(e,vR)}function bR(e){return yR(e)?Fr({success:e.success,error:e.error}):Pr()}var xR=py(YS);function SR(e,t){return Ty(xR.ast,{[vR]:vR,success:e,error:t})}ti()(`effect/rpc/RpcSchema/ClientAbort`);var CR=`~effect/rpc/Rpc`,wR={[CR]:CR,pipe(){return Oe(this,arguments)},setSuccess(e){return TR({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return TR({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return TR({_tag:this._tag,payloadSchema:Ey(e)?e:z(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return TR({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return TR({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return TR({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:li(this.annotations,e,t)})},annotateMerge(e){return TR({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:mi(this.annotations,e)})}},TR=e=>{function t(){}return Object.setPrototypeOf(t,wR),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},ER=(e,t)=>{let n=t?.success??Py,r=t?.error??Ay,i=t?.defect??Cb(),a;return a=t?.primaryKey?class extends Pb(`effect/rpc/Rpc/${e}`)(t.payload){[Woe](){return t.primaryKey(this)}}:Ey(t?.payload)?t?.payload:t?.payload?z(t?.payload):Py,TR({_tag:e,payloadSchema:a,successSchema:t?.stream?SR(n,r):n,errorSchema:t?.stream?Ay:r,defectSchema:i,annotations:si(),middlewares:new Set})},DR=new WeakMap,OR=e=>{if(DR.has(e))return DR.get(e);let t=e,n=new Set([t.errorSchema]),r=bR(t.successSchema);Rr(r)&&n.add(r.value.error);for(let e of t.middlewares)n.add(e.error);let i=Bre(Rr(r)?Py:t.successSchema,V([...n]),t.defectSchema);return DR.set(e,i),i},kR=`~effect/rpc/Rpc/Wrapper`,AR=e=>kR in e,jR={add(...e){let t=new Map(this.requests);for(let n of e)t.set(n._tag,n);return MR({requests:t,annotations:this.annotations})},merge(...e){let t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(let r of e){for(let[e,n]of r.requests)t.set(e,n);for(let[e,t]of r.annotations.mapUnsafe)n.set(e,t)}return MR({requests:t,annotations:ai(n)})},omit(...e){let t=new Map(this.requests);for(let n of e)t.delete(n);return MR({requests:t,annotations:this.annotations})},middleware(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.middleware(e));return MR({requests:t,annotations:this.annotations})},toHandlers(e){let t=this;return df(function*(){let n=yield*Uf(),r=Zd(e)?yield*e:e,i=new Map;return t.requests.forEach((e,t)=>{i.set(e.key,{tag:e._tag,handler:r[t],context:n})}),ai(i)})},prefix(e){let t=new Map;for(let n of this.requests.values()){let r=n.prefix(e);t.set(r._tag,r)}return MR({requests:t,annotations:this.annotations})},toLayer(e){return eu(this.toHandlers(e))},of:je,toLayerHandler(e,t){let n=this;return eu(df(function*(){let r=yield*Uf(),i=Zd(t)?yield*t:t,a=new Map,o=n.requests.get(e);return a.set(o.key,{handler:i,context:r}),ai(a)}))},accessHandler(e){return Wf(t=>{let n=this.requests.get(e),{handler:r,context:i}=t.mapUnsafe.get(n.key);return M((e,t)=>{t.rpc=n;let a=r(e,t),o=AR(a)?a.value:a;return Zd(o)?Gf(o,i):TC(o,i)})})},annotate(e,t){return MR({requests:this.requests,annotations:li(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(ci(e,t))},annotateMerge(e){return MR({requests:this.requests,annotations:mi(this.annotations,e)})},annotateRpcsMerge(e){let t=new Map;for(let[n,r]of this.requests)t.set(n,r.annotateMerge(mi(e,r.annotations)));return MR({requests:t,annotations:this.annotations})}},MR=e=>Object.assign(function(){},jR,{requests:e.requests,annotations:e.annotations}),NR=(...e)=>MR({requests:new Map(e.map(e=>[e._tag,e])),annotations:si()}),X={projectsList:`projects.list`,projectsAdd:`projects.add`,projectsRemove:`projects.remove`,projectsListEntries:`projects.listEntries`,projectsReadFile:`projects.readFile`,projectsSearchEntries:`projects.searchEntries`,projectsWriteFile:`projects.writeFile`,shellOpenInEditor:`shell.openInEditor`,filesystemBrowse:`filesystem.browse`,assetsCreateUrl:`assets.createUrl`,vcsPull:`vcs.pull`,vcsRefreshStatus:`vcs.refreshStatus`,vcsListRefs:`vcs.listRefs`,vcsCreateWorktree:`vcs.createWorktree`,vcsRemoveWorktree:`vcs.removeWorktree`,vcsCreateRef:`vcs.createRef`,vcsSwitchRef:`vcs.switchRef`,vcsInit:`vcs.init`,gitRunStackedAction:`git.runStackedAction`,gitResolvePullRequest:`git.resolvePullRequest`,gitPreparePullRequestThread:`git.preparePullRequestThread`,reviewGetDiffPreview:`review.getDiffPreview`,terminalOpen:`terminal.open`,terminalAttach:`terminal.attach`,terminalWrite:`terminal.write`,terminalResize:`terminal.resize`,terminalClear:`terminal.clear`,terminalRestart:`terminal.restart`,terminalClose:`terminal.close`,previewOpen:`preview.open`,previewNavigate:`preview.navigate`,previewResize:`preview.resize`,previewRefresh:`preview.refresh`,previewClose:`preview.close`,previewList:`preview.list`,previewReportStatus:`preview.reportStatus`,previewAutomationConnect:`previewAutomation.connect`,previewAutomationRespond:`previewAutomation.respond`,previewAutomationFocusHost:`previewAutomation.focusHost`,serverProbe:`server.probe`,serverGetConfig:`server.getConfig`,serverRefreshProviders:`server.refreshProviders`,serverUpdateProvider:`server.updateProvider`,serverUpdateServer:`server.updateServer`,serverUpsertKeybinding:`server.upsertKeybinding`,serverRemoveKeybinding:`server.removeKeybinding`,serverGetSettings:`server.getSettings`,serverUpdateSettings:`server.updateSettings`,serverDiscoverSourceControl:`server.discoverSourceControl`,serverGetProviderUsage:`server.getProviderUsage`,serverGetTraceDiagnostics:`server.getTraceDiagnostics`,serverGetProcessDiagnostics:`server.getProcessDiagnostics`,serverGetProcessResourceHistory:`server.getProcessResourceHistory`,serverSignalProcess:`server.signalProcess`,tasksList:`tasks.list`,tasksGet:`tasks.get`,tasksCreate:`tasks.create`,tasksUpdate:`tasks.update`,tasksDelete:`tasks.delete`,tasksStartThread:`tasks.startThread`,ticketsResolve:`tickets.resolve`,hubGetSyncStatus:`hub.getSyncStatus`,hubConnect:`hub.connect`,hubDisconnect:`hub.disconnect`,hubSetSyncMode:`hub.setSyncMode`,hubSetShareMode:`hub.setShareMode`,hubMintToken:`hub.mintToken`,skillsSync:`skills.sync`,skillsPublish:`skills.publish`,skillsPublishAll:`skills.publishAll`,skillsUnpublish:`skills.unpublish`,assetsRead:`assets.read`,assetsSave:`assets.save`,assetsDelete:`assets.delete`,assetsCreateLocal:`assets.createLocal`,assetsRemoveLocal:`assets.removeLocal`,skillRegistrySearch:`skillRegistry.search`,skillRegistryFetch:`skillRegistry.fetch`,mcpList:`mcp.list`,mcpSave:`mcp.save`,mcpRemove:`mcp.remove`,mcpSetSecret:`mcp.setSecret`,mcpOAuthBegin:`mcp.oauthBegin`,mcpOAuthDisconnect:`mcp.oauthDisconnect`,sourceControlLookupRepository:`sourceControl.lookupRepository`,sourceControlCloneRepository:`sourceControl.cloneRepository`,sourceControlPublishRepository:`sourceControl.publishRepository`,subscribeVcsStatus:`subscribeVcsStatus`,subscribeTerminalEvents:`subscribeTerminalEvents`,subscribeTerminalMetadata:`subscribeTerminalMetadata`,subscribePreviewEvents:`subscribePreviewEvents`,subscribeDiscoveredLocalServers:`subscribeDiscoveredLocalServers`,subscribeServerConfig:`subscribeServerConfig`,subscribeServerLifecycle:`subscribeServerLifecycle`,subscribeAuthAccess:`subscribeAuthAccess`,subscribeTasks:`subscribeTasks`},PR=V([TI,Pw]),FR=ER(X.tasksList,{payload:mI,success:bI,error:PR}),IR=ER(X.tasksGet,{payload:pI,success:SI,error:PR}),LR=ER(X.tasksCreate,{payload:dI,success:xI,error:PR}),RR=ER(X.tasksUpdate,{payload:fI,success:xI,error:V([wI,TI,Pw])}),zR=ER(X.tasksDelete,{payload:pI,success:z({}),error:PR}),BR=ER(X.tasksStartThread,{payload:gI,success:_I,error:V([wI,yI,TI,ej,Pw])}),VR=V([LL,Pw]),HR=ER(X.hubGetSyncStatus,{payload:z({}),success:EL,error:V([Pw])}),UR=ER(X.hubConnect,{payload:OL,success:EL,error:VR}),WR=ER(X.hubDisconnect,{payload:z({}),success:EL,error:VR}),GR=ER(X.hubSetSyncMode,{payload:kL,success:EL,error:VR}),KR=ER(X.hubSetShareMode,{payload:bL,success:EL,error:VR}),qR=ER(X.hubMintToken,{payload:z({}),success:AL,error:V([Pw])}),JR=ER(X.skillsSync,{payload:z({}),success:z({report:DL,status:EL}),error:V([Pw])}),YR=ER(X.skillsPublish,{payload:jL,success:z({report:DL,status:EL}),error:V([Pw])}),XR=ER(X.skillsPublishAll,{payload:z({}),success:z({report:DL,status:EL}),error:V([Pw])}),ZR=ER(X.skillsUnpublish,{payload:jL,success:z({report:DL,status:EL}),error:V([Pw])}),QR=ER(X.assetsRead,{payload:jL,success:ML,error:V([Pw])}),$R=ER(X.assetsSave,{payload:NL,success:z({report:DL,status:EL}),error:V([Pw])}),ez=ER(X.assetsDelete,{payload:PL,success:z({report:DL,status:EL}),error:V([Pw])}),tz=ER(X.assetsCreateLocal,{payload:FL,success:z({result:IL,status:EL}),error:V([Pw])}),nz=ER(X.assetsRemoveLocal,{payload:jL,success:z({result:IL,status:EL}),error:V([Pw])}),rz=ER(X.skillRegistrySearch,{payload:$L,success:eR,error:V([Pw])}),iz=ER(X.skillRegistryFetch,{payload:tR,success:rR,error:V([Pw])}),az=ER(X.mcpList,{payload:z({}),success:KL,error:V([Pw])}),oz=ER(X.mcpSave,{payload:qL,success:KL,error:V([ZL,Pw])}),sz=ER(X.mcpRemove,{payload:JL,success:KL,error:V([ZL,Pw])}),cz=ER(X.mcpSetSecret,{payload:YL,success:KL,error:V([ZL,Pw])}),lz=ER(X.mcpOAuthBegin,{payload:JL,success:XL,error:V([ZL,Pw])}),uz=ER(X.mcpOAuthDisconnect,{payload:JL,success:KL,error:V([ZL,Pw])}),dz=ER(X.ticketsResolve,{payload:$I,success:eL,error:V([nL,Pw])}),fz=ER(X.subscribeTasks,{payload:z({}),success:hI,error:V([TI,Pw]),stream:!0}),pz=ER(X.serverUpsertKeybinding,{payload:qN,success:YN,error:V([mN,Pw])}),mz=ER(X.serverRemoveKeybinding,{payload:JN,success:XN,error:V([mN,Pw])}),hz=ER(X.serverProbe,{payload:z({}),success:z({}),error:Pw}),gz=ER(X.serverGetConfig,{payload:z({}),success:GN,error:V([mN,zN,Pw])}),_z=ER(X.serverRefreshProviders,{payload:z({instanceId:F(SO)}),success:iP,error:Pw}),vz=ER(X.serverUpdateProvider,{payload:aP,success:iP,error:V([oP,Pw])}),yz=ER(X.serverUpdateServer,{payload:sP,success:cP,error:V([lP,Pw])}),bz=ER(X.serverGetSettings,{payload:z({}),success:LN,error:V([zN,Pw])}),xz=ER(X.serverUpdateSettings,{payload:z({patch:kue}),success:LN,error:V([zN,Pw])}),Sz=ER(X.serverDiscoverSourceControl,{payload:z({}),success:RP,error:Pw}),Cz=ER(X.serverGetProviderUsage,{payload:z({instanceId:SO}),success:z({report:L}),error:V([NF,Pw])}),wz=ER(X.serverGetTraceDiagnostics,{payload:z({}),success:Jue,error:Pw}),Tz=ER(X.serverGetProcessDiagnostics,{payload:z({}),success:Yue,error:Pw}),Ez=ER(X.serverGetProcessResourceHistory,{payload:Xue,success:ede,error:Pw}),Dz=ER(X.serverSignalProcess,{payload:UN,success:WN,error:Pw}),Oz=ER(X.sourceControlLookupRepository,{payload:DP,success:EP,error:V([BP,Pw])}),kz=ER(X.sourceControlCloneRepository,{payload:OP,success:kP,error:V([BP,Pw])}),Az=ER(X.sourceControlPublishRepository,{payload:AP,success:MP,error:V([BP,Pw])}),jz=ER(X.projectsSearchEntries,{payload:II,success:RI,error:V([UI,Pw])}),Mz=ER(X.projectsListEntries,{payload:zI,success:BI,error:V([WI,Pw])}),Nz=ER(X.projectsReadFile,{payload:GI,success:KI,error:V([YI,Pw])}),Pz=ER(X.projectsWriteFile,{payload:XI,success:ZI,error:V([QI,Pw])}),Fz=ER(X.shellOpenInEditor,{payload:Ose,error:V([SM,Pw])}),Iz=ER(X.filesystemBrowse,{payload:aR,success:oR,error:V([lR,Pw])}),Lz=ER(X.assetsCreateUrl,{payload:fR,success:pR,error:V([mR,Pw])}),Rz=ER(X.subscribeVcsStatus,{payload:oF,success:wF,error:V([PF,Pw]),stream:!0}),zz=ER(X.vcsPull,{payload:sF,success:jF,error:V([MF,Pw])}),Bz=ER(X.vcsRefreshStatus,{payload:oF,success:CF,error:V([PF,Pw])}),Vz=ER(X.gitRunStackedAction,{payload:cF,success:IF,error:V([PF,Pw]),stream:!0}),Hz=ER(X.gitResolvePullRequest,{payload:dF,success:DF,error:V([PF,Pw])}),Uz=ER(X.gitPreparePullRequestThread,{payload:fF,success:OF,error:V([PF,Pw])}),Wz=ER(X.vcsListRefs,{payload:lF,success:TF,error:V([MF,Pw])}),Gz=ER(X.vcsCreateWorktree,{payload:uF,success:EF,error:V([MF,Pw])}),Kz=ER(X.vcsRemoveWorktree,{payload:pF,error:V([MF,Pw])}),qz=ER(X.vcsCreateRef,{payload:mF,success:hF,error:V([MF,Pw])}),Jz=ER(X.vcsSwitchRef,{payload:gF,success:kF,error:V([MF,Pw])}),Yz=ER(X.vcsInit,{payload:_F,error:V([xP,Pw])}),Xz=ER(X.reviewGetDiffPreview,{payload:hR,success:gR,error:V([_R,Pw])}),Zz=ER(X.terminalOpen,{payload:Xse,success:zM,error:V([YM,Pw])}),Qz=ER(X.terminalAttach,{payload:Zse,success:oce,error:V([YM,Pw]),stream:!0}),$z=ER(X.terminalWrite,{payload:Qse,error:V([YM,Pw])}),eB=ER(X.terminalResize,{payload:$se,error:V([YM,Pw])}),tB=ER(X.terminalClear,{payload:ece,error:V([YM,Pw])}),nB=ER(X.terminalRestart,{payload:tce,success:zM,error:V([YM,Pw])}),rB=ER(X.terminalClose,{payload:nce,error:V([YM,Pw])}),iB=ER(X.previewOpen,{payload:$oe,success:eM,error:V([nM,Pw])}),aB=ER(X.previewNavigate,{payload:ese,success:eM,error:V([nM,Pw])}),oB=ER(X.previewResize,{payload:rse,success:eM,error:V([nM,Pw])}),sB=ER(X.previewRefresh,{payload:nse,error:V([nM,Pw])}),cB=ER(X.previewClose,{payload:ise,error:V([nM,Pw])}),lB=ER(X.previewList,{payload:ase,success:ose,error:Pw}),uB=ER(X.previewReportStatus,{payload:tse,error:V([nM,Pw])}),dB=ER(X.previewAutomationConnect,{payload:Sse,success:Tse,error:V([vM,Pw]),stream:!0}),fB=ER(X.previewAutomationRespond,{payload:Ese,error:V([vM,Pw])}),pB=ER(X.previewAutomationFocusHost,{payload:Cse,error:Pw}),mB=ER(X.subscribePreviewEvents,{payload:z({}),success:sse,error:Pw,stream:!0}),hB=ER(X.subscribeDiscoveredLocalServers,{payload:z({}),success:cse,error:Pw,stream:!0}),gB=ER(qO.dispatchCommand,{payload:fA,success:QA.dispatchCommand.output,error:V([ej,Pw])}),_B=ER(qO.getTurnDiff,{payload:YA,success:QA.getTurnDiff.output,error:V([tj,Pw])}),vB=ER(qO.getFullThreadDiff,{payload:ZA,success:QA.getFullThreadDiff.output,error:V([nj,Pw])}),yB=ER(qO.getArchivedShellSnapshot,{payload:QA.getArchivedShellSnapshot.input,success:QA.getArchivedShellSnapshot.output,error:V([$A,Pw])}),bB=ER(qO.subscribeShell,{payload:QA.subscribeShell.input,success:QA.subscribeShell.output,error:V([$A,Pw]),stream:!0}),xB=ER(qO.subscribeThread,{payload:QA.subscribeThread.input,success:QA.subscribeThread.output,error:V([$A,Pw]),stream:!0}),SB=NR(hz,gz,_z,vz,yz,pz,mz,bz,xz,Sz,Cz,wz,Tz,Ez,Dz,Oz,kz,Az,Mz,Nz,jz,Pz,Fz,Iz,Lz,Rz,zz,Bz,Vz,Hz,Uz,Wz,Gz,Kz,qz,Jz,Yz,Xz,Zz,Qz,$z,eB,tB,nB,rB,ER(X.subscribeTerminalEvents,{payload:z({}),success:ace,error:Pw,stream:!0}),ER(X.subscribeTerminalMetadata,{payload:z({}),success:rce,error:Pw,stream:!0}),iB,aB,oB,sB,cB,lB,uB,dB,fB,pB,mB,hB,ER(X.subscribeServerConfig,{payload:z({}),success:eP,error:V([mN,zN,Pw]),stream:!0}),ER(X.subscribeServerLifecycle,{payload:z({}),success:rP,error:Pw,stream:!0}),ER(X.subscribeAuthAccess,{payload:z({}),success:Fw,error:V([Nw,Pw]),stream:!0}),FR,IR,LR,RR,zR,BR,fz,HR,UR,WR,GR,KR,qR,JR,YR,XR,ZR,QR,$R,ez,tz,nz,rz,iz,az,oz,sz,cz,lz,uz,dz,gB,_B,vB,yB,bB,xB),CB=gi(`effect/http/FetchHttpClient/Fetch`,{defaultValue:()=>globalThis.fetch}),wB=class extends ti()(`effect/http/FetchHttpClient/RequestInit`){},TB=uD(M(rD((e,t,n,r)=>{let i=r.getRef(CB),a=r.context.mapUnsafe.get(wB.key)??{},o=a.headers?vT(hT(a.headers),e.headers):e.headers;o[`content-length`]&&(o=yT(o,`content-length`));let s=r=>Cf(nf({try:()=>i(t,{...a,method:e.method,headers:o,body:r,duplex:e.body._tag===`Stream`?`half`:void 0,signal:n}),catch:t=>new OT({reason:new toe({request:e,cause:t})})}),t=>GT(e,t));switch(e.body._tag){case`Raw`:case`Uint8Array`:return s(e.body.body);case`FormData`:return s(e.body.formData);case`Stream`:return _f(NC(e.body.stream),s)}return s(void 0)}))),EB=()=>Yx((e,t)=>sf(()=>{let t=[],n,r=OB(e=>{e._tag===`Retry`?n=e:t.push(e)}),i=_f(e,e=>{for(let t=0;t<e.length;t++)r.feed(e[t]);return cf});return of(function e(){if(ra(t)){let e=t;return t=[],M(e)}else if(n)return ff(n);return _f(i,e)})})),DB=e=>bS(EB(),Loe(jB.pipe(Wy(e)))());function OB(e){let t,n,r,i,a,o,s,c;return l(),{feed:u,reset:l};function l(){t=!0,n=``,r=0,i=-1,a=void 0,s=void 0,c=``}function u(e){n=n?n+e:e,t&&AB(n)&&(n=n.slice(kB.length)),t=!1;let a=n.length,o=0,s=!1;for(;o<a;){s&&=(n[o]===`
|
|
16
|
-
`&&++o,!1);let e=-1,t=i,c;for(let i=r;e<0&&i<a;++i)c=n[i],c===`:`&&t<0?t=i-o:c===`\r`?(s=!0,e=i-o):c===`
|
|
17
|
-
`&&(e=i-o);if(e<0){r=a-o,i=t;break}else r=0,i=-1;d(n,o,t,e),o+=e+1}o===a?n=``:o>0&&(n=n.slice(o))}function d(t,n,r,i){if(i===0){c.length>0&&(e({_tag:`Event`,id:a,event:s??`message`,data:c.slice(0,-1)}),c=``,a=void 0),s=void 0;return}let l=r<0,u=t.slice(n,n+(l?i:r)),d=0;d=l?i:t[n+r+1]===` `?r+2:r+1;let f=n+d,p=i-d,m=t.slice(f,f+p).toString();if(u===`data`)c+=m?`${m}\n`:`
|
|
18
|
-
`;else if(u===`event`)s=m;else if(u===`id`&&!m.includes(`\0`))a=m,o=m;else if(u===`retry`){let t=parseInt(m,10);Number.isNaN(t)||e(new NB({duration:Ai(t),lastEventId:o}))}}}var kB=[239,187,191];function AB(e){return kB.every((t,n)=>e.charCodeAt(n)===t)}var jB=z({id:F(L),event:L,data:L}),MB=`~effect/encoding/Sse/Retry`,NB=class e extends Une(`Retry`){[MB]=MB;static is(e){return nt(e,MB)}static filter(t){return e.is(t)?Hi(t):Ui(t)}},PB=(e,t)=>df(function*(){let n=yield*Uf(),r=t.httpClient.pipe(t?.baseUrl===void 0?je:iD(hoe(t.baseUrl.toString())));function i(e,t,a,o,s){if(s===-1)return r.execute(a);let c=n.mapUnsafe.get(o[s]);return c===void 0?i(e,t,a,o,s-1):c({endpoint:t,group:e,request:a,next(n){return i(e,t,n,o,s-1)}})}rO(e,{predicate:t?.predicate,onGroup(e){t.onGroup?.(e)},onEndpoint(e){let{group:n,endpoint:r,errors:a,successes:o}=e,s=RB(r.path),c={orElse:eV},l=KT(c),u=new Map;for(let[e,t]of a.entries()){let n=HB(t);for(let[t,r]of n.entries())BB(u,e,t,zB(r))}for(let[e,t]of u.entries()){let n=VB(t);c[e]=e=>_f(Af(n(e),t=>pf(Ine(hu(new OT({reason:new jT({request:e.request,response:e})})),t))),ff)}let d=new Map;for(let[e,t]of o.entries()){let n=HB(t);for(let[t,r]of n.entries())BB(d,e,t,zB(r))}for(let e of GB(r))BB(d,tw(e),e.contentType,KB(e));for(let[e,t]of d.entries())c[e]=VB(t);let f=uy(r.params,Cy),p=AD(r),m=ra(p)?PC(r.method)?Cy(nV(p,r.method)):Cy(V(p)):void 0,h=uy(r.headers,Cy),g=uy(r.query,Cy),_=Array.from(e.middleware,e=>`${e.key}/Client`),v=Pp(function*(e){let a=FT(r.method)(r.path);if(e!==void 0){if(f!==void 0){let t=yield*f(e.params);a=zT(a,s(t))}if(m!==void 0)if(PC(r.method))if(e.payload instanceof FormData)a=yoe(a,e.payload);else{let t=yield*m(e.payload);a=VT(a,t)}else{let t=yield*m(e.payload);a=BT(a,t)}if(h!==void 0){let t=yield*h(e.headers);a=LT(a,t)}if(g!==void 0){let t=yield*g(e.query);a=BT(a,t)}}let o=yield*i(n,r,a,_,_.length-1);if(e?.responseMode===`response-only`)return o;let c=yield*t.transformResponse===void 0?l(o):t.transformResponse(l(o));return e?.responseMode===`decoded-and-response`?[c,o]:c});t.onEndpoint({...e,endpointFn:v})}})}),FB=(e,t)=>_f(QE,n=>IB(e,{...t,httpClient:t?.transformClient?t.transformClient(n):n})),IB=(e,t)=>{let n={};return PB(e,{...t,onGroup({group:e}){e.topLevel||Qt(n,e.identifier,{})},onEndpoint({endpoint:e,endpointFn:t,group:r}){Qt(r.topLevel?n:n[r.identifier],e.identifier,t)}}).pipe(wf(n))},LB=/(\/?):(\w+)(\?)?/g,RB=e=>LB.test(e)?(LB.lastIndex=0,t=>(LB.lastIndex=0,e.replace(LB,(e,n,r,i)=>{let a=t[r];if(a===void 0){if(i!==void 0)return``;throw Error(`Missing path parameter: ${r}`)}return`${n}${encodeURIComponent(a)}`}))):t=>e;function zB(e){let t=vy($B(e));return e=>_f(e.arrayBuffer,t)}function BB(e,t,n,r){let i=OD(n),a=e.get(t);a===void 0?e.set(t,[{contentType:i,decode:r}]):a.push({contentType:i,decode:r})}function VB(e){let t=e[0];return e.length===1&&t!==void 0?t.decode:t=>{let n=OD(t.headers[`content-type`]??``),r=e.find(e=>e.contentType===n);return r===void 0?UB(t,n,e):r.decode(t)}}function HB(e){let t=new Map;for(let n of e){let e=KC(n.ast)?``:OD($C(n.ast).contentType),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return t}function UB(e,t,n){let r=Array.from(new Set(n.map(e=>e.contentType))).join(`, `);return ff(new OT({reason:new MT({request:e.request,response:e,description:`Unsupported response content-type for status ${e.status}: ${t||`<missing>`}. Expected one of: ${r}`})}))}var WB=`effect/httpapi/stream/failure`;function GB(e){let t=[];for(let n of e.success)BC(n)&&t.push(n);return t}function KB(e){let t=HC(e)?void 0:{declaration:e,decoder:qB(e)};return e=>Cf(Uf(),n=>TC(t===void 0?e.stream:JB(e.stream,t.declaration,t.decoder),n))}function qB(e){return DB(V([z({event:I(WB),data:Db(Lb(vb(e.error,Cb())))}),e.events]))}function JB(e,t,n){let r=QS(e.pipe(CC,bC(n)),e=>sf(()=>{let t;return of(()=>t===void 0?_f(e,e=>{for(let n=0;n<e.length;n++){let r=e[n];if(r.event===WB&&uu(r.data)){if(n===0)return pf(r.data);t=r.data,e=e.slice(0,n);break}}return M(e)}):pf(t))}));return t.sseMode===`data`?oC(r,e=>e.data):r}var YB=Yy(globalThis.ArrayBuffer,{expected:`ArrayBuffer`}),XB=YB.pipe(Wy(Ob,sg({decode(e){return new Uint8Array(e)},encode(e){return e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}}))),ZB=YB.pipe(Wy(L,sg({decode(e){return new TextDecoder().decode(e)},encode(e){let t=new TextEncoder().encode(e);return t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}}))),QB=ZB.pipe(Wy(V([I(``).pipe(Wy(My,sg({decode:()=>void 0,encode:()=>``}))),Eb])));function $B(e){return V(e.map(t));function t(e){switch($C(e.ast)._tag){case`Json`:{let t=Dg(_v(e.ast));return QB.pipe(Wy(e,t?sg({decode:e=>e===void 0?null:e,encode:e=>e===null?void 0:e}):void 0))}case`FormUrlEncoded`:return ZB.pipe(Wy(Fae),Wy(e));case`Uint8Array`:return XB.pipe(Wy(e));case`Text`:return ZB.pipe(Wy(e))}}}var eV=e=>ff(new OT({reason:new MT({request:e.request,response:e})})),tV=py(Iae);function nV(e,t){return V(e.map(e=>iV(e,t)))}var rV=new WeakMap;function iV(e,t){let n=e.ast,r=rV.get(n);if(r!==void 0)return r;let i=QC(n,t),a=tV.pipe(Wy(e,og({decode(e){return ff(new gh(Fr(e),{message:`Encode only schema`}))},encode(e){switch(i._tag){case`Multipart`:return ff(new gh(Fr(e),{message:`Payload must be a FormData`}));case`Json`:try{return M(uT(JSON.stringify(e),i.contentType))}catch(t){return ff(new hh(Fr(e),{message:globalThis.String(t)}))}case`Text`:return typeof e==`string`?M(uT(e,i.contentType)):ff(new hh(Fr(e),{message:`Expected a string`}));case`FormUrlEncoded`:return et(e)?M(Hae(tT(e),i.contentType)):ff(new hh(Fr(e),{message:`Expected a record`}));case`Uint8Array`:return e instanceof Uint8Array?M(lT(e,i.contentType)):ff(new hh(Fr(e),{message:`Expected a Uint8Array`}))}}})));return rV.set(n,a),a}var aV=gy(gj),oV=class extends Au(`RemoteEnvironmentAuthFetchError`){},sV=class extends Au(`RemoteEnvironmentAuthInvalidJsonError`){},cV=class extends Au(`RemoteEnvironmentAuthUndeclaredStatusError`){constructor(e,t){super({message:`Remote environment endpoint ${e} returned undeclared status ${t}.`,requestUrl:e,status:t})}},lV=class extends Au(`RemoteEnvironmentAuthTimeoutError`){constructor(e,t){super({message:`Remote environment endpoint ${e} timed out after ${t}ms.`,requestUrl:e,timeoutMs:t})}},uV=e=>TB.pipe(su(Jl(CB,e))),dV=e=>{let t=new URL(e);return t.pathname=`/`,t.search=``,t.hash=``,t.toString()},fV=e=>FB(joe,{baseUrl:dV(e)}),pV=(e,t)=>{if(t instanceof lV||aV(t))return ff(t);if(Jv(t))return ff(new sV({message:`Remote environment endpoint returned an invalid response from ${e}.`,cause:t}));if(DT(t)&&t.response!==void 0){let n=t.response;return n.status<200||n.status>=300?ff(new cV(e,n.status)):ff(new sV({message:`Remote environment endpoint returned an invalid response from ${e}.`,cause:t}))}return ff(new oV({message:`Failed to fetch remote environment endpoint ${e} (${String(t)}).`,cause:t}))},mV=(e,t,n)=>n.pipe(Lf(Ai(t)),_f(zr({onNone:()=>ff(new lV(e,t)),onSome:M})),Df(t=>pV(e,t))),hV=1e4,gV=Fp(`clientRuntime.environment.fetchRemoteEnvironmentDescriptor`)(function*(e){let t=yield*fV(e.httpBaseUrl);return yield*mV($p(e.httpBaseUrl,`/.well-known/p4/environment`),e.timeoutMs??hV,t.metadata.descriptor())});function _V(e,t){return{environmentId:e,projectId:t}}function vV(e,t){return{environmentId:e,threadId:t}}function yV(e){let t=`projectId`in e?e.projectId:e.threadId;return`${e.environmentId}:${t}`}function bV(e){return yV(e)}function xV(e){return yV(e)}function SV(e){let t=e.indexOf(`:`);return t<=0||t>=e.length-1?null:{environmentId:Xb.make(e.slice(0,t)),localId:e.slice(t+1)}}function CV(e){let t=SV(e);return t?{environmentId:t.environmentId,projectId:Jb.make(t.localId)}:null}function wV(e){let t=SV(e);return t?{environmentId:t.environmentId,threadId:Y.make(t.localId)}:null}var TV={"~effect/reactivity/AsyncResult":{E:je,A:je},pipe(){return Oe(this,arguments)},[Ct](e){if(this._tag!==e._tag||this.waiting!==e.waiting)return!1;switch(this._tag){case`Initial`:return!0;case`Success`:return wt(this.value,e.value);case`Failure`:return wt(this.cause,e.cause)}},[ot](){let e=pt(`${this._tag}:${this.waiting}`);return this._tag===`Initial`?e:lt(e)(this._tag===`Success`?st(this.value):st(this.cause))}},EV=e=>e._tag===`Success`?MV(e.value):PV(e.cause),DV=(e,t)=>e._tag===`Success`?MV(e.value):FV(e.cause,{previous:t}),OV=e=>e._tag===`None`?AV(!0):LV(e.value),kV=e=>e._tag!==`Initial`,AV=(e=!1)=>{let t=Object.create(TV);return t._tag=`Initial`,t.waiting=e,t},jV=e=>e._tag===`Success`,MV=(e,t)=>{let n=Object.create(TV);return n._tag=`Success`,n.value=e,n.waiting=t?.waiting??!1,n.timestamp=t?.timestamp??Date.now(),n},NV=e=>e._tag===`Failure`,PV=(e,t)=>{let n=Object.create(TV);return n._tag=`Failure`,n.cause=e,n.previousSuccess=t?.previousSuccess??Pr(),n.waiting=t?.waiting??!1,n},FV=(e,t)=>PV(e,{previousSuccess:Xr(t.previous,e=>jV(e)?Fr(e):NV(e)?e.previousSuccess:Pr()),waiting:t.waiting}),IV=(e,t)=>FV(hu(e),t),LV=(e,t)=>{if(e.waiting)return t?.touch?RV(e):e;let n=Object.assign(Object.create(TV),e);return n.waiting=!0,t?.touch&&jV(n)&&(n.timestamp=Date.now()),n},RV=e=>jV(e)?MV(e.value,{waiting:e.waiting}):e,zV=(e,t)=>e._tag===`Failure`?FV(e.cause,{previous:t,waiting:e.waiting}):e,BV=e=>e._tag===`Success`?Fr(e.value):e._tag===`Failure`?Yr(e.previousSuccess,e=>e.value):Pr(),VV=j(2,(e,t)=>Br(BV(e),t)),HV=e=>qr(BV(e),()=>new Eu(`AsyncResult.getOrThrow: no value found`)),UV=e=>{switch(e._tag){case`Success`:return ll(e.value);case`Failure`:return ul(e.cause);default:return dl(new Eu)}},WV=`~effect/reactivity/AtomRegistry`,GV=e=>nt(e,WV),KV=e=>new eH(e?.initialValues,e?.scheduleTask,e?.timeoutResolution,e?.defaultIdleTTL),qV=ti(WV),JV=j(e=>GV(e[0]),(e,t,n)=>{let r=n?.suspendOnWaiting??!1;return lf(n=>{let i=e.get(t);if(i._tag!==`Initial`&&!(r&&i.waiting))return n(UV(i));let a=e.subscribe(t,e=>{e._tag!==`Initial`&&!(r&&e.waiting)&&(n(UV(e)),a())});return sf(a)})}),YV=j(2,(e,t)=>Qf(sf(()=>e.mount(t)),e=>sf(e))),XV={immediate:!0},ZV=e=>{e()},QV=`~effect-atom/atom/Atom/Serializable`,$V=e=>QV in e?e[QV].key:e,eH=class{[WV];timeoutResolution;defaultIdleTTL;scheduler;schedulerAsync;dispatcher;onNodeAdded;onNodeRemoved;constructor(e,t,n,r){if(this[WV]=WV,this.scheduler=new Ea(`sync`,t),this.schedulerAsync=new Ea(`async`,t),this.dispatcher=this.schedulerAsync.makeDispatcher(),this.defaultIdleTTL=r,n===void 0&&r!==void 0?this.timeoutResolution=Math.round(r/2):this.timeoutResolution=n??1e3,e!==void 0)for(let[t,n]of e){let e=t;for(;e.initialValueTarget;)e=e.initialValueTarget;this.ensureNode(e).setInitialValue(n)}}nodes=new Map;preloadedSerializable=new Map;timeoutBuckets=new Map;nodeTimeoutBucket=new Map;disposed=!1;getNodes(){return this.nodes}get(e){return this.ensureNode(e).value()}set(e,t){e.write(this.ensureNode(e).writeContext,t)}setSerializable(e,t){this.preloadedSerializable.set(e,t)}modify(e,t){let n=this.ensureNode(e),r=t(n.value());return e.write(n.writeContext,r[1]),r[0]}update(e,t){let n=this.ensureNode(e);e.write(n.writeContext,t(n.value()))}refresh=e=>{e.refresh===void 0?this.invalidateAtom(e):e.refresh(this.refresh)};subscribe(e,t,n){let r=this.ensureNode(e);n?.immediate&&t(r.value());let i=r.subscribe(function(){t(r._value)});return()=>{i(),r.canBeRemoved&&this.scheduleNodeRemoval(r)}}mount(e){return this.subscribe(e,Le,XV)}atomHasTtl(e){return!e.keepAlive&&e.idleTTL!==0&&(e.idleTTL!==void 0||this.defaultIdleTTL!==void 0)}ensureNode(e){let t=$V(e),n=this.nodes.get(t);if(n===void 0?(n=this.createNode(e),this.nodes.set(t,n),this.onNodeAdded?.(n)):this.atomHasTtl(e)&&this.removeNodeTimeout(n),typeof t==`string`&&this.preloadedSerializable.has(t)){let r=this.preloadedSerializable.get(t);this.preloadedSerializable.delete(t);let i=e[QV].decode(r);n.setValue(i)}return n}createNode(e){if(this.disposed)throw Error(`Cannot access Atom ${e}: registry is disposed`);return e.keepAlive||this.scheduleAtomRemoval(e),new rH(this,e)}invalidateAtom=e=>{this.ensureNode(e).invalidate()};scheduleAtomRemoval(e){this.dispatcher.scheduleTask(()=>{let t=this.nodes.get($V(e));t!==void 0&&t.canBeRemoved&&this.removeNode(t)},0)}scheduleNodeRemoval(e){this.dispatcher.scheduleTask(()=>{e.canBeRemoved&&this.removeNode(e)},0)}removeNode(e){this.atomHasTtl(e.atom)?this.setNodeTimeout(e):(this.nodes.delete($V(e.atom)),e.remove(),this.onNodeRemoved?.(e))}setNodeTimeout(e){if(this.nodeTimeoutBucket.has(e))return;let t=e.atom.idleTTL??this.defaultIdleTTL;if(this.#e!==null&&(t-=this.#e,t<=0)){this.nodes.delete($V(e.atom)),e.remove(),this.onNodeRemoved?.(e);return}let n=Math.ceil(t/this.timeoutResolution)*this.timeoutResolution,r=Date.now()+n,i=r-r%this.timeoutResolution+this.timeoutResolution,a=this.timeoutBuckets.get(i);a===void 0&&(a=[new Set,setTimeout(()=>this.sweepBucket(i),i-Date.now())],this.timeoutBuckets.set(i,a)),a[0].add(e),this.nodeTimeoutBucket.set(e,i)}removeNodeTimeout(e){let t=this.nodeTimeoutBucket.get(e);if(t===void 0)return;this.nodeTimeoutBucket.delete(e),this.scheduleNodeRemoval(e);let[n,r]=this.timeoutBuckets.get(t);n.delete(e),n.size===0&&(clearTimeout(r),this.timeoutBuckets.delete(t))}#e=null;sweepBucket(e){let t=this.timeoutBuckets.get(e)[0];this.timeoutBuckets.delete(e),t.forEach(e=>{this.nodeTimeoutBucket.delete(e),e.canBeRemoved&&(this.nodes.delete($V(e.atom)),this.onNodeRemoved?.(e),this.#e=e.atom.idleTTL??this.defaultIdleTTL,e.remove(),this.#e=null)})}reset(){this.timeoutBuckets.forEach(([,e])=>clearTimeout(e)),this.timeoutBuckets.clear(),this.nodeTimeoutBucket.clear(),this.nodes.forEach(e=>{e.remove(),this.onNodeRemoved?.(e)}),this.nodes.clear()}dispose(){this.disposed=!0,this.reset()}},tH={alive:1,initialized:2,waitingForValue:4},nH={uninitialized:tH.alive|tH.waitingForValue,stale:tH.alive|tH.initialized|tH.waitingForValue,valid:tH.alive|tH.initialized,removed:0},rH=class{constructor(e,t){this.registry=e,this.atom=t,this.writeContext=new sH(e,this)}registry;atom;state=nH.uninitialized;lifetime;writeContext;preserveInitialValueOnBuild=!1;parents=new Set;previousParents;children=new Set;listeners=new Set;skipInvalidation=!1;currentState(){switch(this.state){case nH.uninitialized:return`uninitialized`;case nH.stale:return`stale`;case nH.valid:return`valid`;default:return`removed`}}get canBeRemoved(){return!this.atom.keepAlive&&this.listeners.size===0&&this.children.size===0&&this.state!==0}_value=void 0;value(){if((this.state&tH.waitingForValue)!==0){this.lifetime=oH(this);let e=this.atom.read(this.lifetime);if((this.state&tH.waitingForValue)!==0&&(this.preserveInitialValueOnBuild?(this.preserveInitialValueOnBuild=!1,this.state=nH.valid):this.setValue(e)),this.previousParents){let e=this.previousParents;this.previousParents=void 0;for(let t of e)t.removeChild(this),t.canBeRemoved&&this.registry.scheduleNodeRemoval(t)}}return this._value}valueOption(){return(this.state&tH.initialized)===0?Pr():Fr(this._value)}setInitialValue(e){if((this.state&tH.initialized)===0){this.preserveInitialValueOnBuild=!0,this.state=nH.stale,this._value=e,lH.phase===cH.collect?lH.notify.add(this):this.notify();return}this.setValue(e)}setValue(e){if((this.state&tH.initialized)===0){this.state=nH.valid,this._value=e,lH.phase===cH.collect?lH.notify.add(this):this.notify();return}this.state=nH.valid,!this.atom.equals(this._value,e)&&(this._value=e,this.skipInvalidation?this.skipInvalidation=!1:this.invalidateChildren(),this.listeners.size>0&&(lH.phase===cH.collect?lH.notify.add(this):this.notify()))}addParent(e){this.parents.add(e),this.previousParents!==void 0&&(this.previousParents.delete(e),this.previousParents.size===0&&(this.previousParents=void 0)),e.children.has(this)||(e.children.add(this),e.skipInvalidation&&=!1)}removeChild(e){this.children.delete(e)}invalidate(){this.state===nH.valid&&(this.state=nH.stale,this.disposeLifetime()),lH.phase===cH.collect?lH.stale.push(this):this.atom.lazy&&this.listeners.size===0&&!iH(this.children)?(this.invalidateChildren(),this.skipInvalidation=!0):this.value()}invalidateChildren(){if(this.children.size===0)return;let e=this.children;this.children=new Set;for(let t of e)t.invalidate()}notify(){this.listeners.forEach(ZV),lH.phase===cH.commit&&lH.notify.delete(this)}disposeLifetime(){this.lifetime!==void 0&&(this.lifetime.dispose(),this.lifetime=void 0),this.parents.size!==0&&(this.previousParents=this.parents,this.parents=new Set)}remove(){if(this.state=nH.removed,this.listeners.clear(),this.lifetime===void 0||(this.disposeLifetime(),this.previousParents===void 0))return;let e=this.previousParents;this.previousParents=void 0;for(let t of e)t.removeChild(this),t.canBeRemoved&&this.registry.removeNode(t)}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}};function iH(e){if(e.size===0)return!1;let t=e,n,r=0;for(;t!==void 0;){for(let e of t)if(!e.atom.lazy||e.listeners.size>0)return!0;else e.children.size>0&&(n===void 0?n=[e.children]:n.push(e.children));t=n?.[r++]}return!1}var aH={get registry(){return this.node.registry},addFinalizer(e){if(this.disposed)return e();this.finalizers??=[],this.finalizers.push(e)},get(e){if(this.disposed)return this.node.registry.get(e);let t=this.node.registry.ensureNode(e);return this.node.addParent(t),t.value()},result(e,t){if(this.disposed||this.isFn)return this.resultOnce(e,t);let n=this.get(e);if(t?.suspendOnWaiting&&n.waiting)return uf;switch(n._tag){case`Initial`:return uf;case`Failure`:return ul(n.cause);case`Success`:return M(n.value)}},resultOnce(e,t){return lf(n=>{let r=this.once(e);if(r._tag!==`Initial`&&!(t?.suspendOnWaiting&&r.waiting))return n(UV(r));let i=this.node.registry.subscribe(e,e=>{e._tag===`Initial`||t?.suspendOnWaiting&&e.waiting||(i(),n(UV(e)))},{immediate:!1});return sf(i)})},setResult(e,t){return this.disposed?uf:(this.node.registry.set(e,t),this.resultOnce(e,{suspendOnWaiting:!0}))},some(e){if(this.disposed||this.isFn)return this.someOnce(e);let t=this.get(e);return t._tag===`None`?uf:M(t.value)},someOnce(e){return lf(t=>{let n=this.once(e);if(Rr(n))return t(M(n.value));let r=this.node.registry.subscribe(e,e=>{Lr(e)||(r(),t(M(e.value)))},{immediate:!1});return sf(r)})},once(e){return this.node.registry.get(e)},self(){return this.disposed?Pr():this.node.valueOption()},refresh(e){this.disposed||this.node.registry.refresh(e)},refreshSelf(){this.disposed||this.node.invalidate()},mount(e){this.disposed||this.addFinalizer(this.node.registry.mount(e))},subscribe(e,t,n){this.disposed||this.addFinalizer(this.node.registry.subscribe(e,t,n))},setSelf(e){this.disposed||this.node.setValue(e)},set(e,t){this.disposed||this.node.registry.set(e,t)},stream(e,t){return this.disposed?tC:eC(n=>sf(()=>{this.subscribe(e,e=>kx(n,e),{immediate:!t?.withoutInitialValue})}))},streamResult(e,t){return this.stream(e,t).pipe(fC(kV),sC(e=>e._tag===`Success`?M(e.value):pf(e.cause)))},dispose(){if(this.disposed=!0,this.finalizers===void 0)return;let e=this.finalizers;this.finalizers=void 0;for(let t=e.length-1;t>=0;t--)e[t]()}},oH=e=>{function t(n){if(t.disposed||t.isFn)return e.registry.get(n);let r=e.registry.ensureNode(n),i=r.value();return e.addParent(r),i}return Object.setPrototypeOf(t,aH),t.isFn=!1,t.disposed=!1,t.finalizers=void 0,t.node=e,t},sH=class{constructor(e,t){this.registry=e,this.node=t}registry;node;get(e){return this.registry.get(e)}set(e,t){return this.registry.set(e,t)}setSelf(e){return this.node.setValue(e)}refreshSelf(){return this.node.invalidate()}},cH={disabled:0,collect:1,commit:2},lH={phase:cH.disabled,depth:0,stale:[],notify:new Set};function uH(e){lH.phase=cH.collect,lH.depth++;try{if(e(),lH.depth===1){for(let e=0;e<lH.stale.length;e++)dH(lH.stale[e]);lH.phase=cH.commit;for(let e of lH.notify)e.notify();lH.notify.clear()}}finally{lH.depth--,lH.depth===0&&(lH.phase=cH.disabled,lH.stale=[])}}function dH(e){if(e.state!==nH.valid){for(let t of e.parents)t.state!==nH.valid&&dH(t);e.state!==nH.valid&&e.value()}}var fH=`~effect/reactivity/Atom`,pH=e=>nt(e,fH),mH=`~effect/reactivity/Atom/Writable`,hH=j(2,(e,t)=>{let n=xi(t),r=Fee(n);return Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!r,idleTTL:r?Mi(n):void 0})}),gH=hH(0),_H={[fH]:fH,equals:Object.is,...un,toJSON(){return{_id:`Atom`,keepAlive:this.keepAlive,lazy:this.lazy,label:this.label}}},vH={..._H,atom(e,t){let n=EH(e,t);return SH(e=>{let t=e.self(),r=e(this);return r._tag===`Success`?n(e,r.value):zV(r,t)})},fn(e,t){return arguments.length===0?(e,t)=>yH(this,e,t):yH(this,e,t)},pull(e,t){let n=gH(kH(0));return HH(n,SH(r=>{let i=r.self(),a=r(this);return a._tag===`Success`?jH(r,VH(r,n,e,t),AV(!0),a.value):zV(a,i)}))},subscriptionRef(e){return LH(gH(SH(t=>{let n=t.self(),r=t(this);if(r._tag!==`Success`)return zV(r,n);let i=typeof e==`function`?e(t):e;return Fj(i)?i:jH(t,i,AV(!0),r.value)})),(e,t)=>IH(e,t,HV(e(this))))}},yH=(e,t,n)=>{let[r,i,a]=BH(n?.reactivityKeys?(e,r)=>{let i=t(e,r);return Zd(i)?Koe(i,n.reactivityKeys):wC(i,qoe(n.reactivityKeys))}:t,n);return CH(t=>{t.get(a);let n=t.self(),i=t.get(e);return i._tag===`Success`?r(t,i.value):zV(i,n)},i)},bH={..._H,[mH]:mH},xH=e=>mH in e,SH=(e,t)=>{let n=Object.create(_H);return n.keepAlive=!1,n.lazy=!0,n.read=e,n.refresh=t,n},CH=(e,t,n)=>{let r=Object.create(bH);return r.keepAlive=!1,r.lazy=!0,r.read=e,r.write=t,r.refresh=n,r};function wH(e,t){e.setSelf(t)}var TH=(e,t)=>{let n=EH(e,t);return`~effect/reactivity/Atom`in n?n:SH(n)},EH=(e,t)=>{if(typeof e==`function`&&!Zd(e)&&!YS(e)){let n=e;return function(e,r){let i=n(e);switch(typeof i){case`function`:case`object`:return i===null?i:DH in i?AH(e,i,t,r):OH in i?PH(e,i,t,r):i;default:return i}}}else if(Zd(e))return function(n,r){return AH(n,e,t,r)};else if(YS(e))return function(n,r){return PH(n,e,t,r)};return kH(e)},DH=`~effect/Effect`,OH=`~effect/Stream`,kH=e=>CH(function(t){return e},wH),AH=(e,t,n,r)=>jH(e,t,n?.initialValue===void 0?AV():MV(n.initialValue),r,n?.uninterruptible);function jH(e,t,n,r=si(),i=!1){let a=e.self(),o=Al();e.addFinalizer(()=>{Cp(r)(Fl(o,fl))});let s=new Map(r.mapUnsafe);s.set(Ol.key,o),s.set(qV.key,e.registry),s.set(wa.key,e.registry.scheduler);let c,l=!1,u=MH(ai(s),t,function(t){c=DV(t,a),l&&e.setSelf(c)},i);return l=!0,u!==void 0&&e.addFinalizer(u),c===void 0?a._tag===`Some`?OV(a):LV(n):c}function MH(e,t,n,r=!1){if(cl(t)){n(t);return}let i=Cp(e)(t);i.currentDispatcher?.flush();let a=i.pollUnsafe();if(a){n(a);return}let o=i.addObserver(n);function s(){o(),r||i.interruptUnsafe()}return s}var NH=(e=>{let t=jj;function n(r){let i=Object.create(vH);i.keepAlive=!1,i.lazy=!0,i.refresh=void 0,i.factory=n;let a=WH(SH(typeof r==`function`?e=>cu(r(e),t):()=>cu(r,t)));return i.layer=a,i.read=function(t){let n=t(a);return AH(t,_f(nre,t=>Gl(n,e.memoMap,t)),{uninterruptible:!0})},i}n.memoMap=e.memoMap,n.addGlobalLayer=e=>{t=cu(t,su(e,jj))};let r=gH(TH(Wf(t=>Gl(jj,e.memoMap,di(t,Ol))).pipe(Cf(di(kj)))));return n.withReactivity=e=>t=>KH(t,n=>{let i=HV(n(r));return n.addFinalizer(i.registerUnsafe(e,()=>{n.refresh(t)})),n.subscribe(t,e=>n.setSelf(e)),n.once(t)},{initialValueTarget:t}),n})({memoMap:Hl()});NH.withReactivity;var PH=(e,t,n,r)=>FH(e,t,n?.initialValue===void 0?AV():MV(n.initialValue),r);function FH(e,t,n,r=si()){let i=e.self();r=li(r,qV,e.registry);let a=Zf(n=>_f(PS(t.channel,n),t=>ef({while:Ne,body:()=>t,step(t){e.setSelf(MV(ca(t),{waiting:!0}))}}))).pipe(Af(t=>(xd(t)?Re(e.self(),Xr(BV),zr({onNone:()=>e.setSelf(IV(new Eu,{previous:e.self()})),onSome:t=>e.setSelf(MV(t))})):e.setSelf(FV(t,{previous:e.self()})),cf))),o=new Map(r.mapUnsafe);o.set(qV.key,e.registry),o.set(wa.key,e.registry.scheduler);let s=MH(ai(o),a,Le,!1);return s!==void 0&&e.addFinalizer(s),i._tag===`Some`?OV(i):LV(n)}var IH=(e,t,n=si())=>Fj(t)?(e.addFinalizer(Lj(t).pipe(AC(t=>{for(let n=0;n<t.length;n++)e.setSelf(t[n]);return cf}),wp(n))),jp(n)(Rj(t))):t._tag===`Success`?FH(e,Lj(t.value),AV(!0),n):t,LH=(e,t)=>{function n(t,n){let r=t.get(e);Fj(r)?Ap(Bj(r,n)):jV(r)&&Ap(Bj(r.value,n))}return CH(n=>{let r=n(e);return Fj(r)||jV(r)?t(n,r):r},n)},RH=Symbol.for(`effect/reactivity/atom/Atom/Reset`),zH=Symbol.for(`effect/reactivity/atom/Atom/Interrupt`);function BH(e,t){let n=gH(kH([0,void 0])),r=t?.initialValue===void 0?AV():MV(t.initialValue),i=t?.concurrent?gH(SH(e=>{let t=new Set;return e.addFinalizer(()=>t.forEach(e=>e.interruptUnsafe())),t})):void 0;function a(t,a){let o=i?t(i):void 0;t.isFn=!0;let[s,c]=t.get(n);if(s===0)return r;if(c===zH)return FV(Fne(),{previous:t.self()});let l=e(c,t);return DH in l?(o&&(l=_f(xp(l,{startImmediately:!0}),e=>(o.add(e),e.addObserver(()=>o.delete(e)),Cf(uie(o),e=>e[0])))),jH(t,l,r,a,!1)):FH(t,l,r,a)}function o(e,t){eU(()=>{t===RH?e.set(n,[0,void 0]):t===zH?e.set(n,[e.get(n)[0]+1,zH]):e.set(n,[e.get(n)[0]+1,t]),e.refreshSelf()})}return[a,o,n]}var VH=(e,t,n,r)=>_f(jC(typeof n==`function`?n(e):n),n=>{let i=lx().context,a=pa(),o=Hf(n,{onFailure(e){return xd(e)?ia(a)?M({done:!0,items:a}):ff(new Eu(`Atom.pull: no items`)):pf(e)},onSuccess(e){let t;return r?.disableAccumulation?t=e:(t=ta(a,e),a=t),M({done:!1,items:t})}}),s=new Set;return e.addFinalizer(()=>{for(let e of s)e()}),e.once(t),e.subscribe(t,()=>{e.setSelf(OV(e.self()));let t;t=MH(i,o,n=>{t&&s.delete(t);let r=DV(n,e.self()),i=s.size>0;e.setSelf(i?LV(r):r)}),t&&s.add(t)}),o}),HH=(e,t)=>CH(t.read,function(t,n){t.set(e,t.get(e)+1)}),UH=typeof WeakRef>`u`||typeof FinalizationRegistry>`u`?e=>{let t=VS();return function(n){let r=HS(t,n);if(r._tag===`Some`)return r.value;let i=e(n);return KS(t,n,i),i}}:e=>{let t=VS(),n=new FinalizationRegistry(e=>{JS(t,e)});return function(r){let i=HS(t,r).pipe(Zr(e=>e.deref()));if(i._tag===`Some`)return i.value;let a=e(r);return KS(t,r,new WeakRef(a)),n.register(a,r),a}},WH=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,keepAlive:!0}),GH=j(2,(e,t)=>Object.assign(Object.create(Object.getPrototypeOf(e)),{...e,label:[t,Error().stack?.split(`
|
|
19
|
-
`)[5]??``]})),KH=j(e=>pH(e[0]),(e,t,n)=>{let r=gH(xH(e)?CH(n=>t(n,e),function(t,n){t.set(e,n)},e.refresh??function(t){t(e)}):SH(n=>t(n,e),e.refresh??function(t){t(e)}));return n?.initialValueTarget&&(r.initialValueTarget=qH(n.initialValueTarget)),r}),qH=e=>{let t=e;for(;t.initialValueTarget;)t=t.initialValueTarget;return t},JH=j(2,(e,t)=>KH(e,n=>t(n(e)))),YH=j(2,(e,t)=>{let n=Mi(xi(t));return KH(e,function(t){let r=setTimeout(()=>t.refresh(e),n);return t.addFinalizer(()=>clearTimeout(r)),t(e)},{initialValueTarget:e})}),XH=j(2,(e,t)=>{let n=Mi(xi(t.staleTime));return KH(e,r=>{let i=r.once(e);return r.subscribe(e,e=>{r.setSelf(e)}),t.revalidateOnFocus&&t.focusSignal&&(r.once(t.focusSignal),r.subscribe(t.focusSignal,t.revalidateOnFocus===`always`?()=>r.refresh(e):()=>{$H(r.once(e),n)&&r.refresh(e)})),Lr(r.self())&&t.revalidateOnMount===!1||$H(i,n)&&r.refresh(e),i},{initialValueTarget:e})}),ZH=e=>e._tag===`Success`?Fr(e.timestamp):e._tag===`Failure`?Yr(e.previousSuccess,e=>e.timestamp):Pr(),QH=(e,t,n)=>n-e<t,$H=(e,t)=>{if(e.waiting)return!1;let n=Gr(ZH(e));return n===void 0?e._tag!==`Initial`:!QH(n,t,Date.now())},eU=uH,tU=`~effect-atom/atom/Atom/ServerValue`,nU=j(2,(e,t)=>`~effect-atom/atom/Atom/ServerValue`in e?e[tU](e=>t.get(e)):t.get(e)),rU=class extends ti()(`effect/workers/Transferable/Collector`){},iU=()=>{let e=[],t=t=>{e.push(...t)},n=()=>e,r=()=>{let t=e;return e=[],t};return rU.of({addAllUnsafe:t,addAll:e=>sf(()=>t(e)),readUnsafe:n,read:sf(n),clearUnsafe:r,clear:sf(r)})},aU=`~effect/workers/WorkerError`,oU=V([class extends Ib(`effect/workers/WorkerError/WorkerSpawnError`)({_tag:qy(`WorkerSpawnError`),message:L,cause:F(Cb())}){},class extends Ib(`effect/workers/WorkerError/WorkerSendError`)({_tag:qy(`WorkerSendError`),message:L,cause:F(Cb())}){},class extends Ib(`effect/workers/WorkerError/WorkerReceiveError`)({_tag:qy(`WorkerReceiveError`),message:L,cause:F(Cb())}){},class extends Ib(`effect/workers/WorkerError/WorkerUnknownError`)({_tag:qy(`WorkerUnknownError`),message:L,cause:F(Cb())}){}]);Ib(aU)({_tag:qy(`WorkerError`),reason:oU});var sU=`~effect/rpc/RpcClientError`,cU=class extends Ib(`effect/rpc/RpcClientError/RpcClientDefect`)({_tag:qy(`RpcClientDefect`),message:L,cause:Cb()}){},lU=class extends Ib(sU)({_tag:qy(`RpcClientError`),reason:V([oU,OE,ioe,cU])}){[sU]=sU;get message(){return`${this.reason._tag}: ${this.reason.message}`}},uU=e=>e,dU={_tag:`Ping`},fU;try{fU=new TextDecoder}catch{}var pU,mU,Z=0,hU=[],gU=hU,_U=0,vU={},yU,bU,xU=0,SU=0,CU,wU,TU=[],EU,DU={useRecords:!1,mapsAsObjects:!0},OU=class{},kU=new OU;kU.name=`MessagePack 0xC1`;var AU=!1,jU=2,MU=class e{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=0&&(e.structures=[],e.maxSharedStructures||=0)),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType=`number`)),Object.assign(this,e)}unpack(t,n){if(pU)return sW(()=>(cW(),this?this.unpack(t,n):e.prototype.unpack.call(DU,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<`u`?Buffer.from(t):new Uint8Array(t)),typeof n==`object`?(mU=n.end||t.length,Z=n.start||0):(Z=0,mU=n>-1?n:t.length),_U=0,SU=0,bU=null,gU=hU,CU=null,pU=t;try{EU=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw pU=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(vU=this,this.structures)return yU=this.structures,NU(n);(!yU||yU.length>0)&&(yU=[])}else vU=DU,(!yU||yU.length>0)&&(yU=[]);return NU(n)}unpackMultiple(e,t){let n,r=0;try{AU=!0;let i=e.length,a=this?this.unpack(e,i):uW.unpack(e,i);if(t){if(t(a,r,Z)===!1)return;for(;Z<i;)if(r=Z,t(NU(),r,Z)===!1)return}else{for(n=[a];Z<i;)r=Z,n.push(NU());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{AU=!1,cW()}}_mergeStructures(e,t){this._onLoadedStructures&&(e=this._onLoadedStructures(e)),e||=[],Object.isFrozen(e)&&(e=e.map(e=>e.slice(0)));for(let t=0,n=e.length;t<n;t++){let n=e[t];n&&(n.isShared=!0,t>=32&&(n.highByte=t-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let r=e[n],i=t[n];i&&(r&&((e.restoreStructures||=[])[n]=r),e[n]=i)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function NU(e){try{if(!vU.trusted&&!AU){let e=yU.sharedLength||0;e<yU.length&&(yU.length=e)}let t;if(vU._readStruct&&pU[Z]<64&&pU[Z]>=32?(t=vU._readStruct(pU,Z,mU),pU=null,!(e&&e.lazy)&&t&&(t=t.toJSON()),Z=mU):t=FU(),CU&&=(Z=CU.postBundlePosition,null),AU&&(yU.restoreStructures=null),Z==mU)yU&&yU.restoreStructures&&PU(),yU=null,pU=null,wU&&=null;else if(Z>mU)throw Error(`Unexpected end of MessagePack data`);else if(!AU){let e;try{e=JSON.stringify(t,(e,t)=>typeof t==`bigint`?`${t}n`:t).slice(0,100)}catch(t){e=`(JSON view not available `+t+`)`}throw Error(`Data read, but end of buffer not reached `+e)}return t}catch(e){throw yU&&yU.restoreStructures&&PU(),cW(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`)||Z>mU)&&(e.incomplete=!0),e}}function PU(){for(let e in yU.restoreStructures)yU[e]=yU.restoreStructures[e];yU.restoreStructures=null}function FU(){let e=pU[Z++];if(e<160)if(e<128){if(e<64)return e;{let t=yU[e&63]||vU.getStructures&&zU()[e&63];return t?(t.read||=LU(t,e&63),t.read()):e}}else if(e<144)if(e-=128,vU.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=eW();e===`__proto__`&&(e=`__proto_`),t[e]=FU()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(FU(),FU());return t}else{e-=144;let t=Array(e);for(let n=0;n<e;n++)t[n]=FU();return vU.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(SU>=Z)return bU.slice(Z-xU,(Z+=t)-xU);if(SU==0&&mU<140){let e=t<16?YU(t):JU(t);if(e!=null)return e}return BU(t)}else{let t;switch(e){case 192:return null;case 193:return CU?(t=FU(),t>0?CU[1].slice(CU.position1,CU.position1+=t):CU[0].slice(CU.position0,CU.position0-=t)):kU;case 194:return!1;case 195:return!0;case 196:if(t=pU[Z++],t===void 0)throw Error(`Unexpected end of buffer`);return ZU(t);case 197:return t=EU.getUint16(Z),Z+=2,ZU(t);case 198:return t=EU.getUint32(Z),Z+=4,ZU(t);case 199:return QU(pU[Z++]);case 200:return t=EU.getUint16(Z),Z+=2,QU(t);case 201:return t=EU.getUint32(Z),Z+=4,QU(t);case 202:if(t=EU.getFloat32(Z),vU.useFloat32>2){let e=lW[(pU[Z]&127)<<1|pU[Z+1]>>7];return Z+=4,(e*t+(t>0?.5:-.5)>>0)/e}return Z+=4,t;case 203:return t=EU.getFloat64(Z),Z+=8,t;case 204:return pU[Z++];case 205:return t=EU.getUint16(Z),Z+=2,t;case 206:return t=EU.getUint32(Z),Z+=4,t;case 207:return vU.int64AsType===`number`?(t=EU.getUint32(Z)*4294967296,t+=EU.getUint32(Z+4)):vU.int64AsType===`string`?t=EU.getBigUint64(Z).toString():vU.int64AsType===`auto`?(t=EU.getBigUint64(Z),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=EU.getBigUint64(Z),Z+=8,t;case 208:return EU.getInt8(Z++);case 209:return t=EU.getInt16(Z),Z+=2,t;case 210:return t=EU.getInt32(Z),Z+=4,t;case 211:return vU.int64AsType===`number`?(t=EU.getInt32(Z)*4294967296,t+=EU.getUint32(Z+4)):vU.int64AsType===`string`?t=EU.getBigInt64(Z).toString():vU.int64AsType===`auto`?(t=EU.getBigInt64(Z),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=EU.getBigInt64(Z),Z+=8,t;case 212:if(t=pU[Z++],t==114)return nW(pU[Z++]&63);{let e=TU[t];if(e)return e.read?(Z++,e.read(FU())):e.noBuffer?(Z++,e()):e(pU.subarray(Z,++Z));throw Error(`Unknown extension `+t)}case 213:return t=pU[Z],t==114?(Z++,nW(pU[Z++]&63,pU[Z++])):QU(2);case 214:return QU(4);case 215:return QU(8);case 216:return QU(16);case 217:return t=pU[Z++],SU>=Z?bU.slice(Z-xU,(Z+=t)-xU):VU(t);case 218:return t=EU.getUint16(Z),Z+=2,SU>=Z?bU.slice(Z-xU,(Z+=t)-xU):HU(t);case 219:return t=EU.getUint32(Z),Z+=4,SU>=Z?bU.slice(Z-xU,(Z+=t)-xU):UU(t);case 220:return t=EU.getUint16(Z),Z+=2,GU(t);case 221:return t=EU.getUint32(Z),Z+=4,GU(t);case 222:return t=EU.getUint16(Z),Z+=2,KU(t);case 223:return t=EU.getUint32(Z),Z+=4,KU(t);default:if(e>=224)return e-256;if(e===void 0){let e=Error(`Unexpected end of MessagePack data`);throw e.incomplete=!0,e}throw Error(`Unknown MessagePack token `+e)}}}var IU=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function LU(e,t){function n(){if(n.count++>jU){let r;try{r=e.read=Function(`r`,`return function(){return `+(vU.freezeData?`Object.freeze`:``)+`({`+e.map(e=>e===`__proto__`?`__proto_:r()`:IU.test(e)?e+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`})}`)(FU)}catch{return jU=1/0,n()}return e.read0=r,e.highByte===0&&(e.read=RU(t,e.read)),r()}let r={};for(let t=0,n=e.length;t<n;t++){let n=e[t];n===`__proto__`&&(n=`__proto_`),r[n]=FU()}return vU.freezeData?Object.freeze(r):r}return n.count=0,e.read0=n,e.highByte===0?RU(t,n):n}var RU=(e,t)=>function(){let n=pU[Z++];if(n===0)return t();let r=e<32?-(e+(n<<5)):e+(n<<5),i=yU[r]||zU()[r];if(!i)throw Error(`Record id is not defined for `+r);return i.read||=LU(i,e),i.read()};function zU(){let e=sW(()=>(pU=null,vU.getStructures()));return yU=vU._mergeStructures(e,yU)}var BU=WU,VU=WU,HU=WU,UU=WU;function WU(e){let t;if(e<16&&(t=YU(e)))return t;if(e>64&&fU)return fU.decode(pU.subarray(Z,Z+=e));let n=Z+e,r=[];for(t=``;Z<n;){let e=pU[Z++];if(!(e&128))r.push(e);else if((e&224)==192){let t=pU[Z++]&63,n=(e&31)<<6|t;n<128?r.push(65533):r.push(n)}else if((e&240)==224){let t=pU[Z++]&63,n=pU[Z++]&63,i=(e&31)<<12|t<<6|n;i<2048||i>=55296&&i<=57343?r.push(65533):r.push(i)}else if((e&248)==240){let t=pU[Z++]&63,n=pU[Z++]&63,i=pU[Z++]&63,a=(e&7)<<18|t<<12|n<<6|i;a<65536||a>1114111?r.push(65533):a>65535?(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023,r.push(a)):r.push(a)}else r.push(65533);r.length>=4096&&(t+=qU.apply(String,r),r.length=0)}return r.length>0&&(t+=qU.apply(String,r)),t}function GU(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=FU();return vU.freezeData?Object.freeze(t):t}function KU(e){if(vU.mapsAsObjects){let t={};for(let n=0;n<e;n++){let e=eW();e===`__proto__`&&(e=`__proto_`),t[e]=FU()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(FU(),FU());return t}}var qU=String.fromCharCode;function JU(e){let t=Z,n=Array(e);for(let r=0;r<e;r++){let e=pU[Z++];if((e&128)>0){Z=t;return}n[r]=e}return qU.apply(String,n)}function YU(e){if(e<4)if(e<2){if(e===0)return``;{let e=pU[Z++];if((e&128)>1){--Z;return}return qU(e)}}else{let t=pU[Z++],n=pU[Z++];if((t&128)>0||(n&128)>0){Z-=2;return}if(e<3)return qU(t,n);let r=pU[Z++];if((r&128)>0){Z-=3;return}return qU(t,n,r)}else{let t=pU[Z++],n=pU[Z++],r=pU[Z++],i=pU[Z++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){Z-=4;return}if(e<6){if(e===4)return qU(t,n,r,i);{let e=pU[Z++];if((e&128)>0){Z-=5;return}return qU(t,n,r,i,e)}}else if(e<8){let a=pU[Z++],o=pU[Z++];if((a&128)>0||(o&128)>0){Z-=6;return}if(e<7)return qU(t,n,r,i,a,o);let s=pU[Z++];if((s&128)>0){Z-=7;return}return qU(t,n,r,i,a,o,s)}else{let a=pU[Z++],o=pU[Z++],s=pU[Z++],c=pU[Z++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){Z-=8;return}if(e<10){if(e===8)return qU(t,n,r,i,a,o,s,c);{let e=pU[Z++];if((e&128)>0){Z-=9;return}return qU(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=pU[Z++],u=pU[Z++];if((l&128)>0||(u&128)>0){Z-=10;return}if(e<11)return qU(t,n,r,i,a,o,s,c,l,u);let d=pU[Z++];if((d&128)>0){Z-=11;return}return qU(t,n,r,i,a,o,s,c,l,u,d)}else{let l=pU[Z++],u=pU[Z++],d=pU[Z++],f=pU[Z++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){Z-=12;return}if(e<14){if(e===12)return qU(t,n,r,i,a,o,s,c,l,u,d,f);{let e=pU[Z++];if((e&128)>0){Z-=13;return}return qU(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=pU[Z++],m=pU[Z++];if((p&128)>0||(m&128)>0){Z-=14;return}if(e<15)return qU(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=pU[Z++];if((h&128)>0){Z-=15;return}return qU(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function XU(){let e=pU[Z++],t;if(e<192)t=e-160;else switch(e){case 217:t=pU[Z++];break;case 218:t=EU.getUint16(Z),Z+=2;break;case 219:t=EU.getUint32(Z),Z+=4;break;default:throw Error(`Expected string`)}return WU(t)}function ZU(e){return vU.copyBuffers?Uint8Array.prototype.slice.call(pU,Z,Z+=e):pU.subarray(Z,Z+=e)}function QU(e){let t=pU[Z++];if(TU[t]){let n;return TU[t](pU.subarray(Z,n=Z+=e),e=>{Z=e;try{return FU()}finally{Z=n}})}else throw Error(`Unknown extension type `+t)}var $U=Array(4096);function eW(){let e=pU[Z++];if(e>=160&&e<192){if(e-=160,SU>=Z)return bU.slice(Z-xU,(Z+=e)-xU);if(!(SU==0&&mU<180))return BU(e)}else return Z--,tW(FU());let t=(e<<5^(e>1?EU.getUint16(Z):e>0?pU[Z]:0))&4095,n=$U[t],r=Z,i=Z+e-3,a,o=0;if(n&&n.bytes==e){for(;r<i;){if(a=EU.getUint32(r),a!=n[o++]){r=1879048192;break}r+=4}for(i+=3;r<i;)if(a=pU[r++],a!=n[o++]){r=1879048192;break}if(r===i)return Z=r,n.string;i-=3,r=Z}for(n=[],$U[t]=n,n.bytes=e;r<i;)a=EU.getUint32(r),n.push(a),r+=4;for(i+=3;r<i;)a=pU[r++],n.push(a);let s=e<16?YU(e):JU(e);return s==null?n.string=BU(e):n.string=s}function tW(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;if(vU.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(e=>[`string`,`number`,`boolean`,`bigint`].includes(typeof e)))return e.flat().toString();throw Error(`Invalid property type for record: ${typeof e}`)}var nW=(e,t)=>{let n=FU().map(tW),r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=yU[e];return i&&(i.isShared||AU)&&((yU.restoreStructures||=[])[e]=i),yU[e]=n,n.read=LU(n,r),(n.read0||n.read)()};TU[0]=()=>{},TU[0].noBuffer=!0,TU[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let r=1;r<t;r++)n<<=BigInt(8),n+=BigInt(e[r]);if(e.byteLength!==t){let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(e,t)=>{let n=t-e;if(n<=40){let n=r.getBigUint64(e);for(let i=e+8;i<t;i+=8)n<<=BigInt(64),n|=r.getBigUint64(i);return n}let a=e+(n>>4<<3),o=i(e,a),s=i(a,t);return o<<BigInt((t-a)*8)|s};n=n<<BigInt((r.byteLength-t)*8)|i(t,r.byteLength)}return n};var rW={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError==`function`?AggregateError:null};TU[101]=()=>{let e=FU();if(!rW[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return rW[e[0]](e[1],{cause:e[2]})},TU[105]=e=>{if(vU.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=EU.getUint32(Z-4);wU||=new Map;let n=pU[Z],r;r=n>=144&&n<160||n==220||n==221?[]:n>=128&&n<144||n==222||n==223?new Map:(n>=199&&n<=201||n>=212&&n<=216)&&pU[Z+1]===115?new Set:{};let i={target:r};wU.set(t,i);let a=FU();if(i.used)Object.assign(r,a);else return i.target=a;if(r instanceof Map)for(let[e,t]of a.entries())r.set(e,t);if(r instanceof Set)for(let e of Array.from(a))r.add(e);return r},TU[112]=e=>{if(vU.structuredClone===!1)throw Error(`Structured clone extension is disabled`);let t=EU.getUint32(Z-4),n=wU.get(t);return n.used=!0,n.target},TU[115]=()=>new Set(FU());var iW=[`Int8`,`Uint8`,`Uint8Clamped`,`Int16`,`Uint16`,`Int32`,`Uint32`,`Float32`,`Float64`,`BigInt64`,`BigUint64`].map(e=>e+`Array`),aW=typeof globalThis==`object`?globalThis:window;TU[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,r=iW[t];if(!r){if(t===16)return n;if(t===17)return new DataView(n);throw Error(`Could not find typed array for code `+t)}return new aW[r](n)},TU[120]=()=>{let e=FU();return new RegExp(e[0],e[1])};var oW=[];TU[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=Z;return Z+=t-e.length,CU=oW,CU=[XU(),XU()],CU.position0=0,CU.position1=0,CU.postBundlePosition=Z,Z=n,FU()},TU[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date(`invalid`);function sW(e){vU&&vU._onSaveState&&vU._onSaveState();let t=mU,n=Z,r=_U,i=xU,a=SU,o=bU,s=gU,c=wU,l=CU,u=new Uint8Array(pU.slice(0,mU)),d=yU,f=yU.slice(0,yU.length),p=vU,m=AU,h=e();return mU=t,Z=n,_U=r,xU=i,SU=a,bU=o,gU=s,wU=c,CU=l,pU=u,AU=m,yU=d,yU.splice(0,yU.length,...f),vU=p,EU=new DataView(pU.buffer,pU.byteOffset,pU.byteLength),h}function cW(){pU=null,wU=null,yU=null}var lW=Array(147);for(let e=0;e<256;e++)lW[e]=+(`1e`+Math.floor(45.15-e*.30103));var uW=new MU({useRecords:!1});uW.unpack,uW.unpackMultiple,uW.unpack;var dW={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};new Uint8Array(new Float32Array(1).buffer,0,4),MU.SUPPORTS_STRUCT_HOOKS=!0;var fW;try{fW=new TextEncoder}catch{}var pW,mW,hW=typeof Buffer<`u`,gW=hW?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,_W=hW?Buffer:Uint8Array,vW=hW?4294967296:2144337920,Q,yW,bW,$=0,xW,SW=null,CW=21760,wW=/[\u0080-\uFFFF]/,TW=Symbol(`record-id`),EW=class extends MU{constructor(e){super(e),this.offset=0;let t,n,r,i,a=_W.prototype.utf8Write?function(e,t){return Q.utf8Write(e,t,Q.byteLength-t)}:fW&&fW.encodeInto?function(e,t){return fW.encodeInto(e,Q.subarray(t)).written}:!1,o=this;e||={};let s=e&&e.sequential,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?32:0,l>8160)throw Error(`Maximum maxSharedStructure is 8160`);e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let u=e.maxOwnStructures;u??=c?32:64,!this.structures&&e.useRecords!=0&&(this.structures=[]);let d=l>32||u+l>64,f=l+64,p=l+u+64;if(p>8256)throw Error(`Maximum maxSharedStructure + maxOwnStructure is 8192`);let m=[],h=0,g=0;this.pack=this.encode=function(e,a){if(Q||(Q=new gW(8192),bW=Q.dataView||=new DataView(Q.buffer,0,8192),$=0),xW=Q.length-10,xW-$<2048?(Q=new gW(Q.length),bW=Q.dataView||=new DataView(Q.buffer,0,Q.length),xW=Q.length-10,$=0):$=$+7&2147483640,t=$,a&2048&&($+=a&255),i=o.structuredClone?new Map:null,o.bundleStrings&&typeof e!=`string`?(SW=[],SW.size=1/0):SW=null,r=o.structures,r){r.uninitialized&&(r=o._mergeStructures(o.getStructures()));let e=r.sharedLength||0;if(e>l)throw Error(`Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to `+r.sharedLength);if(!r.transitions){r.transitions=Object.create(null);for(let t=0;t<e;t++){let e=r[t];if(!e)continue;let n,i=r.transitions;for(let t=0,r=e.length;t<r;t++){let r=e[t];n=i[r],n||=i[r]=Object.create(null),i=n}i[TW]=t+64}this.lastNamedStructuresLength=e}s||(r.nextId=e+64)}n&&=!1;let c;try{o._writeStruct&&e&&typeof e==`object`?e.constructor===Object?w(e):e.constructor!==Map&&!Array.isArray(e)&&!mW.some(t=>e instanceof t)?w(e.toJSON?e.toJSON():e):y(e):y(e);let n=SW;if(SW&&jW(t,y,0),i&&i.idsToInsert){let e=i.idsToInsert.sort((e,t)=>e.offset>t.offset?1:-1),r=e.length,a=-1;for(;n&&r>0;){let i=e[--r].offset+t;i<n.stringsPosition+t&&a===-1&&(a=0),i>n.position+t?a>=0&&(a+=6):(a>=0&&(bW.setUint32(n.position+t,bW.getUint32(n.position+t)+a),a=-1),n=n.previous,r++)}a>=0&&n&&bW.setUint32(n.position+t,bW.getUint32(n.position+t)+a),$+=e.length*6,$>xW&&T($),o.offset=$;let s=AW(Q.subarray(t,$),e);return i=null,s}return o.offset=$,a&512?(Q.start=t,Q.end=$,Q):Q.subarray(t,$)}catch(e){throw c=e,e}finally{if(r&&(_(),n&&o.saveStructures)){let n=r.sharedLength||0,i=Q.subarray(t,$),s=(o._prepareStructures||MW)(r,o);if(!c)return o.saveStructures(s,s.isCompatible)===!1?(r.uninitialized=!0,o.pack(e,a)):(o.lastNamedStructuresLength=n,Q.length>1073741824&&(Q=null),i)}Q.length>1073741824&&(Q=null),a&1024&&($=t)}};let _=()=>{g<10&&g++;let e=r.sharedLength||0;if(r.length>e&&!s&&(r.length=e),h>1e4)r.transitions=null,g=0,h=0,m.length>0&&(m=[]);else if(m.length>0&&!s){for(let e=0,t=m.length;e<t;e++)m[e][TW]=0;m=[]}},v=e=>{var t=e.length;t<16?Q[$++]=144|t:t<65536?(Q[$++]=220,Q[$++]=t>>8,Q[$++]=t&255):(Q[$++]=221,bW.setUint32($,t),$+=4);for(let n=0;n<t;n++)y(e[n])},y=e=>{$>xW&&(Q=T($));var n=typeof e,r;if(n===`string`){let n=e.length;if(SW&&n>=4&&n<4096){if((SW.size+=n)>CW){let e,n=(SW[0]?SW[0].length*3+SW[1].length:0)+10;$+n>xW&&(Q=T($+n));let r;SW.position?(r=SW,Q[$]=200,$+=3,Q[$++]=98,e=$-t,$+=4,jW(t,y,0),bW.setUint16(e+t-3,$-t-e)):(Q[$++]=214,Q[$++]=98,e=$-t,$+=4),SW=[``,``],SW.previous=r,SW.size=0,SW.position=e}let r=wW.test(e);SW[+!r]+=e,Q[$++]=193,y(r?-n:n);return}let i;i=n<32?1:n<256?2:n<65536?3:5;let o=n*3;if($+o>xW&&(Q=T($+o)),n<64||!a){let t,a,o,s=$+i;for(t=0;t<n;t++)a=e.charCodeAt(t),a<128?Q[s++]=a:a<2048?(Q[s++]=a>>6|192,Q[s++]=a&63|128):(a&64512)==55296&&((o=e.charCodeAt(t+1))&64512)==56320?(a=65536+((a&1023)<<10)+(o&1023),t++,Q[s++]=a>>18|240,Q[s++]=a>>12&63|128,Q[s++]=a>>6&63|128,Q[s++]=a&63|128):(Q[s++]=a>>12|224,Q[s++]=a>>6&63|128,Q[s++]=a&63|128);r=s-$-i}else r=a(e,$+i);r<32?Q[$++]=160|r:r<256?(i<2&&Q.copyWithin($+2,$+1,$+1+r),Q[$++]=217,Q[$++]=r):r<65536?(i<3&&Q.copyWithin($+3,$+2,$+2+r),Q[$++]=218,Q[$++]=r>>8,Q[$++]=r&255):(i<5&&Q.copyWithin($+5,$+3,$+3+r),Q[$++]=219,bW.setUint32($,r),$+=4),$+=r}else if(n===`number`)if(e>>>0===e)e<32||e<128&&this.useRecords===!1||e<64&&!this._writeStruct?Q[$++]=e:e<256?(Q[$++]=204,Q[$++]=e):e<65536?(Q[$++]=205,Q[$++]=e>>8,Q[$++]=e&255):(Q[$++]=206,bW.setUint32($,e),$+=4);else if(e>>0===e)e>=-32?Q[$++]=256+e:e>=-128?(Q[$++]=208,Q[$++]=e+256):e>=-32768?(Q[$++]=209,bW.setInt16($,e),$+=2):(Q[$++]=210,bW.setInt32($,e),$+=4);else{let t;if((t=this.useFloat32)>0&&e<4294967296&&e>=-2147483648){Q[$++]=202,bW.setFloat32($,e);let n;if(t<4||(n=e*lW[(Q[$]&127)<<1|Q[$+1]>>7])>>0===n){$+=4;return}else $--}Q[$++]=203,bW.setFloat64($,e),$+=8}else if(n===`object`||n===`function`)if(!e)Q[$++]=192;else{if(i){let n=i.get(e);if(n){n.id||=(i.idsToInsert||=[]).push(n),Q[$++]=214,Q[$++]=112,bW.setUint32($,n.id),$+=4;return}else i.set(e,{offset:$-t})}let a=e.constructor;if(a===Object)C(e);else if(a===Array)v(e);else if(a===Map)if(this.mapAsEmptyObject)Q[$++]=128;else{r=e.size,r<16?Q[$++]=128|r:r<65536?(Q[$++]=222,Q[$++]=r>>8,Q[$++]=r&255):(Q[$++]=223,bW.setUint32($,r),$+=4);for(let[t,n]of e)y(t),y(n)}else{for(let t=0,n=pW.length;t<n;t++){let n=mW[t];if(e instanceof n){let n=pW[t];if(n.write){n.type&&(Q[$++]=212,Q[$++]=n.type,Q[$++]=0);let t=n.write.call(this,e);t===e?Array.isArray(e)?v(e):C(e):y(t);return}let r=Q,i=bW,a=$;Q=null;let o;try{o=n.pack.call(this,e,e=>(Q=r,r=null,$+=e,$>xW&&T($),{target:Q,targetView:bW,position:$-e}),y)}finally{r&&(Q=r,bW=i,$=a,xW=Q.length-10)}o&&(o.length+$>xW&&T(o.length+$),$=kW(o,Q,$,n.type));return}}if(Array.isArray(e))v(e);else{if(e.toJSON){let t=e.toJSON();if(t!==e)return y(t)}if(n===`function`)return y(this.writeFunction&&this.writeFunction(e));C(e)}}}else if(n===`boolean`)Q[$++]=e?195:194;else if(n===`bigint`){if(e<0x8000000000000000&&e>=-0x8000000000000000)Q[$++]=211,bW.setBigInt64($,e);else if(e<0x10000000000000000&&e>0)Q[$++]=207,bW.setBigUint64($,e);else if(this.largeBigIntToFloat)Q[$++]=203,bW.setFloat64($,Number(e));else if(this.largeBigIntToString)return y(e.toString());else if(this.useBigIntExtension||this.moreTypes){let t=BigInt(e<0?-1:0),n;if(e>>BigInt(65536)===t){let r=BigInt(0x10000000000000000)-BigInt(1),i=[];for(;i.push(e&r),e>>BigInt(63)!==t;)e>>=BigInt(64);n=new Uint8Array(new BigUint64Array(i).buffer),n.reverse()}else{let t=e<0,r=(t?~e:e).toString(16);if(r.length%2?r=`0`+r:parseInt(r.charAt(0),16)>=8&&(r=`00`+r),hW)n=Buffer.from(r,`hex`);else{n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++)n[e]=parseInt(r.slice(e*2,e*2+2),16)}if(t)for(let e=0;e<n.length;e++)n[e]=~n[e]}n.length+$>xW&&T(n.length+$),$=kW(n,Q,$,66);return}else throw RangeError(e+` was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string`);$+=8}else if(n===`undefined`)this.encodeUndefinedAsNil?Q[$++]=192:(Q[$++]=212,Q[$++]=0,Q[$++]=0);else throw Error(`Unknown type: `+n)},b=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?e=>{let t;if(this.skipValues){t=[];for(let n in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(n))&&!this.skipValues.includes(e[n])&&t.push(n)}else t=Object.keys(e);let n=t.length;n<16?Q[$++]=128|n:n<65536?(Q[$++]=222,Q[$++]=n>>8,Q[$++]=n&255):(Q[$++]=223,bW.setUint32($,n),$+=4);let r;if(this.coercibleKeyAsNumber)for(let i=0;i<n;i++){r=t[i];let n=Number(r);y(isNaN(n)?r:n),y(e[r])}else for(let i=0;i<n;i++)y(r=t[i]),y(e[r])}:e=>{Q[$++]=222;let n=$-t;$+=2;let r=0;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(y(t),y(e[t]),r++);if(r>65535)throw Error(`Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object`);Q[n+++t]=r>>8,Q[n+t]=r&255},x=this.useRecords===!1?b:e.progressiveRecords&&!d?e=>{let n,i=r.transitions||=Object.create(null),a=$++-t,o;for(let s in e)if(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(s)){if(n=i[s],n)i=n;else{let c=Object.keys(e),l=i;i=r.transitions;let u=0;for(let e=0,t=c.length;e<t;e++){let t=c[e];n=i[t],n||(n=i[t]=Object.create(null),u++),i=n}a+t+1==$?($--,E(i,c,u)):ee(i,c,a,u),o=!0,i=l[s]}y(e[s])}if(!o){let n=i[TW];n?Q[a+t]=n:ee(i,Object.keys(e),a,0)}}:e=>{let t,n=r.transitions||=Object.create(null),i=0;for(let r in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(r))&&(t=n[r],t||(t=n[r]=Object.create(null),i++),n=t);let a=n[TW];a?a>=96&&d?(Q[$++]=((a-=96)&31)+96,Q[$++]=a>>5):Q[$++]=a:E(n,n.__keys__||Object.keys(e),i);for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&y(e[t])},S=typeof this.useRecords==`function`&&this.useRecords,C=S?e=>{S(e)?x(e):b(e)}:x,w=e=>{let i=o._writeStruct(e,Q,t,$,r,T,(e,t,r)=>{if(r)return n=!0;$=t;let i=Q;return y(e),_(),i===Q?$:{position:$,targetView:bW,target:Q}});if(i===0)return C(e);$=i},T=e=>{let n;if(e>16777216){if(e-t>vW)throw Error(`Packed buffer would be larger than maximum buffer size`);n=Math.min(vW,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,Q.length-1)>>12)+1<<12;let r=new gW(n);return bW=r.dataView||=new DataView(r.buffer,0,n),e=Math.min(e,Q.length),Q.copy?Q.copy(r,0,t,e):r.set(Q.slice(t,e)),$-=t,t=0,xW=r.length-10,Q=r},E=(e,t,i)=>{let a=r.nextId;a||=64,a<f&&this.shouldShareStructure&&!this.shouldShareStructure(t)?(a=r.nextOwnId,a<p||(a=f),r.nextOwnId=a+1):(a>=p&&(a=f),r.nextId=a+1);let o=t.highByte=a>=96&&d?a-96>>5:-1;e[TW]=a,e.__keys__=t,r[a-64]=t,a<f?(t.isShared=!0,r.sharedLength=a-63,n=!0,o>=0?(Q[$++]=(a&31)+96,Q[$++]=o):Q[$++]=a):(o>=0?(Q[$++]=213,Q[$++]=114,Q[$++]=(a&31)+96,Q[$++]=o):(Q[$++]=212,Q[$++]=114,Q[$++]=a),i&&(h+=g*i),m.length>=u&&(m.shift()[TW]=0),m.push(e),y(t))},ee=(e,n,r,i)=>{let a=Q,o=$,s=xW,c=t;Q=yW,$=0,t=0,Q||(yW=Q=new gW(8192)),xW=Q.length-10,E(e,n,i),yW=Q;let l=$;if(Q=a,$=o,xW=s,t=c,l>1){let e=$+l-1;e>xW&&T(e);let n=r+t;Q.copyWithin(n+l,n+1,$),Q.set(yW.slice(0,l),n),$=e}else Q[r+t]=yW[0]}}useBuffer(e){Q=e,Q.dataView||=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),bW=Q.dataView,$=0}set position(e){$=e}get position(){return $}clearSharedData(){this.structures&&=[],this.typedStructs&&=[]}};mW=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,OU],pW=[{pack(e,t,n){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:e,targetView:n,position:i}=t(6);e[i++]=214,e[i++]=255,n.setUint32(i,r)}else if(r>0&&r<4294967296){let{target:n,targetView:i,position:a}=t(10);n[a++]=215,n[a++]=255,i.setUint32(a,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),i.setUint32(a+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:e,targetView:r,position:i}=t(3);e[i++]=212,e[i++]=255,e[i++]=255}else{let{target:n,targetView:i,position:a}=t(15);n[a++]=199,n[a++]=12,n[a++]=255,i.setUint32(a,e.getMilliseconds()*1e6),i.setBigInt64(a+4,BigInt(Math.floor(r)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let r=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(r)}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=101,r[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:r,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(r[i++]=212,r[i++]=120,r[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?DW(e,16,t):OW(hW?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==_W&&this.moreTypes?DW(e,iW.indexOf(n.name),t):OW(e,t)}},{pack(e,t){this.moreTypes?DW(e,17,t):OW(hW?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:r}=t(1);n[r]=193}}];function DW(e,t,n,r){let i=e.byteLength;if(i+1<256){var{target:a,position:o}=n(4+i);a[o++]=199,a[o++]=i+1}else if(i+1<65536){var{target:a,position:o}=n(5+i);a[o++]=200,a[o++]=i+1>>8,a[o++]=i+1&255}else{var{target:a,position:o,targetView:s}=n(7+i);a[o++]=201,s.setUint32(o,i+1),o+=4}a[o++]=116,a[o++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),o)}function OW(e,t){let n=e.byteLength;var r,i;if(n<256){var{target:r,position:i}=t(n+2);r[i++]=196,r[i++]=n}else if(n<65536){var{target:r,position:i}=t(n+3);r[i++]=197,r[i++]=n>>8,r[i++]=n&255}else{var{target:r,position:i,targetView:a}=t(n+5);r[i++]=198,a.setUint32(i,n),i+=4}r.set(e,i)}function kW(e,t,n,r){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=r,t.set(e,n),n+=i,n}function AW(e,t){let n,r=t.length*6,i=e.length-r;for(;n=t.pop();){let t=n.offset,a=n.id;e.copyWithin(t+r,t,i),r-=6;let o=t+r;e[o++]=214,e[o++]=105,e[o++]=a>>24,e[o++]=a>>16&255,e[o++]=a>>8&255,e[o++]=a&255,i=t}return e}function jW(e,t,n){if(SW.length>0){bW.setUint32(SW.position+e,$+n-SW.position-e),SW.stringsPosition=$-e;let r=SW;SW=null,t(r[0]),t(r[1])}}function MW(e,t){return e.isCompatible=e=>{let n=!e||(t.lastNamedStructuresLength||0)===e.length;return n||t._mergeStructures(e),n},e}EW.SUPPORTS_STRUCT_HOOKS=!0;var NW=new EW({useRecords:!1});NW.pack,NW.pack;var{NEVER:tde,ALWAYS:nde,DECIMAL_ROUND:rde,DECIMAL_FIT:ide}=dW,PW=class extends ti()(`effect/rpc/RpcSerialization`){},FW=PW.of({contentType:`application/json`,includesFraming:!1,makeUnsafe:()=>{let e=new TextDecoder;return{decode:t=>{let n=JSON.parse(typeof t==`string`?t:e.decode(t));return Array.isArray(n)?n:[n]},encode:e=>JSON.stringify(e)}}}),IW=Jl(PW)(FW),LW=e=>of(()=>{let t=new Set,n=new Map,r=new Map,i=(e,t)=>Wf(r=>{let i=n.get(e);return i||(i=[],n.set(e,i)),i.push([t,r]),cf});return Cf(e((e,t)=>{let n=r.get(e);return n?n(t):i(e,t)},t),e=>({...e,run(e,i){return df(function*(){t.add(e),r.set(e,i);let a=n.get(e);if(a){n.delete(e);for(let[e,t]of a)yield*Kf(of(()=>i(e)),t)}return yield*np(uf,()=>(t.delete(e),r.delete(e),cf))})}}))}),RW=0,zW=Pp(function*(e,t){let n=t?.spanPrefix??`RpcClient`,r=t?.supportsAck??!0,i=t?.disableTracing??!1,a=t?.generateRequestId??(()=>RW++),o=yield*Uf(),s=di(o,Ol),c=new Map,l=yield*qf(YW),u=!1;yield*Nl(s,gf(e=>(u=!0,d(One(e.id)))));let d=Pp(function*(e){for(let[t,n]of c)c.delete(t),n._tag===`Queue`?yield*e._tag===`Success`?Mx(n.queue):Ax(n.queue,e.cause):n.resume(e)}),f=e=>{let r=yR(e.successSchema),a=h(e);return(o,s)=>{let c=s?.headers?hT(s.headers):mT,l=s?.context??si();if(!r){let r=t=>p(e,a,t,e.payloadSchema.make(o),c,l,s?.discard??!1);return i?r(void 0):hp(`${n}.${e._tag}`,{attributes:t.spanAttributes},r)}let u=m(e,a,e.payloadSchema.make(o),c,s?.streamBufferSize??16,l);return s?.asQueue?u:aC(Cf(u,rC))}},p=(e,n,r,i,o,s,d)=>gf(f=>{if(u)return ip;let p=a(),m=Rr(l)&&l.value.onRequestStart?l.value.onRequestStart({id:p,tag:e._tag,stream:!1}):cf,h=n(e=>t.onFromClient({message:e,context:s,discard:d}),{_tag:`Request`,id:p,tag:e._tag,payload:i,...r?{traceId:r.traceId,spanId:r.spanId,sampled:r.sampled}:{},headers:vT(f.getRef(WW),o)});if(d)return m.pipe(yf(h));let _;return op(lf(t=>{let n={_tag:`Effect`,rpc:e,context:s,resume(e){t(e),_&&!_.pollUnsafe()&&f.currentDispatcher.scheduleTask(()=>{_.interruptUnsafe(f.id)},0)}};c.set(p,n),_=m.pipe(yf(h),r?_p(r,{captureStackTrace:!1}):je,Cp(f.context)),_.addObserver(e=>{if(e._tag===`Failure`)return t(e)})}),e=>{let t=c.get(p);return c.delete(p),yf(cx(_),g(p,Array.from(e),s,t?.rpc._tag))})}),m=Pp(function*(e,r,o,s,d,f){if(u)return yield*ip;let p=i?void 0:yield*mp(`${n}.${e._tag}`,{attributes:t.spanAttributes}),m=lx(),h=a(),_=Rr(l)&&l.value.onRequestStart?l.value.onRequestStart({id:h,tag:e._tag,stream:!0}):cf,v=ui(m.context,Ol);yield*Ml(v,e=>{let t=c.get(h);return t?(c.delete(h),g(h,ml(e)?Array.from(Rne(e.cause)):[],f,t.rpc._tag)):cf});let y=yield*Ex(d);return c.set(h,{_tag:`Queue`,rpc:e,queue:y,scope:v,context:f,chunkCount:0}),yield*_.pipe(yf(r(e=>t.onFromClient({message:e,context:f,discard:!1}),{_tag:`Request`,id:h,tag:e._tag,payload:o,...p?{traceId:p.traceId,spanId:p.spanId,sampled:p.sampled}:{},headers:vT(m.getRef(WW),s)}))).pipe(p?_p(p,{captureStackTrace:!1}):je,Af(e=>Ax(y,e)),ap,yp(v,{startImmediately:!0})),y}),h=e=>{let t=[];for(let n of e.middlewares.values()){let e=o.mapUnsafe.get(`${n.key}/Client`);e&&t.push(e)}return t.length===0?(e,t)=>e(t):function n(r,i,a=t.length-1){return a===-1?r(i):t[a]({rpc:e,request:i,next(e){return n(r,e,a-1)}})}},g=(e,n,r,i)=>(Rr(l)&&l.value.onRequestInterrupt?l.value.onRequestInterrupt({id:e,tag:i}):cf).pipe(yf(lf(i=>{let a=lx();t.onFromClient({message:{_tag:`Interrupt`,requestId:e,interruptors:n},context:r,discard:!1}).pipe(Qne(1e3),Cp(a.context)).addObserver(()=>{i(cf)})}))),_=e=>{switch(e._tag){case`Chunk`:{let n=e.requestId,i=c.get(n);if(!i||i._tag!==`Queue`)return cf;let a=i.chunkCount+=e.values.length,o=Rr(l)&&l.value.onRequestChunk?l.value.onRequestChunk({id:n,tag:i.rpc._tag,chunkCount:a}):cf;return Jie(i.queue,e.values).pipe(yf(o),r?_f(()=>t.onFromClient({message:{_tag:`Ack`,requestId:e.requestId},context:i.context,discard:!1})):je,Af(e=>Ax(i.queue,e)))}case`Exit`:{let t=e.requestId,n=c.get(t);if(!n)return cf;c.delete(t);let r=Rr(l)&&l.value.onRequestExit?l.value.onRequestExit({id:t,tag:n.rpc._tag,stream:n._tag===`Queue`,exit:e.exit}):cf;return n._tag===`Effect`?r.pipe(yf(sf(()=>{n.resume(e.exit)}))):r.pipe(yf(e.exit._tag===`Success`?Mx(n.queue):Ax(n.queue,e.exit.cause)))}case`Defect`:return d(Dne(e.defect));case`ClientEnd`:return cf}},v;if(t.flatten){let t=new Map;v=function(n,r,i){let a=t.get(n);return a||(a=f(e.requests.get(n)),t.set(n,a)),a(r,i)}}else v={},e.requests.forEach(e=>{Qt(v,e._tag,f(e))});return{client:v,write:_}}),BW=0,VW=Pp(function*(e,t){let n=BW++,{run:r,send:i,supportsAck:a,supportsTransferables:o}=yield*GW,s=new Map,{client:c,write:l}=yield*zW(e,{...t,supportsAck:a,onFromClient({message:t}){switch(t._tag){case`Request`:{let r=e.requests.get(t.tag),a=o?iU():void 0,c=lx(),l={rpc:r,context:a?li(c.context,rU,a):c.context,schemas:UW(r)};return s.set(t.id,l),l.schemas.encodePayload(t.payload).pipe(Kf(l.context),Mf,_f(e=>i(n,{...t,id:t.id,payload:e,headers:Object.entries(t.headers)},a&&a.readUnsafe())))}case`Ack`:return s.get(t.requestId)?i(n,{_tag:`Ack`,requestId:t.requestId}):cf;case`Interrupt`:return s.get(t.requestId)?(s.delete(t.requestId),i(n,{_tag:`Interrupt`,requestId:t.requestId})):cf;case`Eof`:return cf}}});return yield*r(n,e=>{switch(e._tag){case`Chunk`:{let t=uU(e.requestId),n=s.get(t);return!n||Lr(n.schemas.decodeChunk)?cf:n.schemas.decodeChunk.value(e.values).pipe(Kf(n.context),Mf,_f(t=>l({_tag:`Chunk`,clientId:0,requestId:uU(e.requestId),values:t})),tp(t=>l({_tag:`Exit`,clientId:0,requestId:uU(e.requestId),exit:ul(t)})))}case`Exit`:{let t=uU(e.requestId),n=s.get(t);return n?(s.delete(t),n.schemas.decodeExit(e.exit).pipe(Kf(n.context),Mf,Hf({onSuccess:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:e}),onFailure:e=>l({_tag:`Exit`,clientId:0,requestId:t,exit:ul(e)})}))):cf}case`Defect`:return l({_tag:`Defect`,clientId:0,defect:ZW(e.defect)});case`ClientProtocolError`:{let t=dl(e.error);return $d(s.keys(),e=>l({_tag:`Exit`,clientId:0,requestId:e,exit:t}))}default:return cf}}).pipe(Af(Rp),ap,bp),c}),HW=new WeakMap,UW=e=>{let t=HW.get(e);return t===void 0?(t={decodeChunk:Yr(bR(e.successSchema),e=>_y(Lb(zy(e.success)))),encodePayload:wy(Lb(e.payloadSchema)),decodeExit:_y(Lb(OR(e)))},HW.set(e,t),t):t},WW=gi(`effect/rpc/RpcClient/CurrentHeaders`,{defaultValue:()=>mT}),GW=class extends ti()(`effect/rpc/RpcClient/Protocol`){static make=LW},KW=e=>GW.make(Pp(function*(t,n){let r=yield*gE,i=yield*PW,a=yield*qf(XW),o=new Map,s=yield*r.writer,c=i.makeUnsafe(),l=yield*JW(s(c.encode(dU)),Rr(a)?a.value:void 0),u,d=of(()=>(u=void 0,Rr(a)?a.value.onConnect:cf)),f=e=>$d(n,n=>t(n,e));return yield*of(()=>(c=i.makeUnsafe(),l.reset(),r.runRaw(e=>{try{let n=c.decode(e);if(n.length===0)return;let r=0;return ef({while:()=>r<n.length,body:()=>{let e=n[r++];if(e._tag===`Pong`)return l.onPong;if(`requestId`in e){let n=o.get(e.requestId);if(n!==void 0)return e._tag===`Exit`&&o.delete(e.requestId),t(n,e)}return f(e)},step:Le})}catch(e){return f({_tag:`ClientProtocolError`,error:new lU({reason:new cU({message:`Error decoding message`,cause:e})})})}},{onOpen:d}).pipe(Vf(_f(l.timeout,()=>(Rr(a)&&a.value.onPingTimeout?a.value.onPingTimeout:cf).pipe(yf(ff(new kE({reason:new EE({kind:`Timeout`,cause:Error(`ping timeout`)})}))))))))).pipe(_f(()=>ff(new kE({reason:new DE({code:1e3})}))),Rr(a)?ep(a.value.onDisconnect):je,Zne(t=>{let n=Cu(t),r=qi(n);return e?.retryTransientErrors&&r&&n.success.reason._tag===`SocketOpenError`?cf:(u=new lU({reason:r?n.success.reason:new cU({message:`Unknown socket error`,cause:Su(t)})}),f({_tag:`ClientProtocolError`,error:u}))}),Pf(e?.retryPolicy??qW),Bp({module:`RpcClient`,method:`makeProtocolSocket`}),bp),{send(e,t){if(u)return ff(u);t._tag===`Request`&&o.set(t.id,e);let n=c.encode(t);return n===void 0?cf:Mf(s(n))},supportsAck:!0,supportsTransferables:!1}})),qW=Ld([zd(500,1.5),Ud(5e3)]),JW=Pp(function*(e,t){let n=!0,r=dx(),i=()=>{n=!0,r.closeUnsafe()},a=sf(()=>{n=!0}).pipe(yf(t?.onPong??cf));return yield*of(()=>n?(n=!1,(t?.onPing??cf).pipe(yf(e))):r.open).pipe(zf(`5 seconds`),Ff,lp,ap,bp),{timeout:r.await,reset:i,onPong:a}}),YW=class extends ti()(`effect/rpc/RpcClient/RequestHooks`){},XW=class extends ti()(`effect/rpc/RpcClient/ConnectionHooks`){},ZW=Sy(Cb()),QW=class extends ti()(`@p4code/client-runtime/platform/capabilities/ClientPresentation`){},$W=class extends ti()(`@p4code/client-runtime/platform/capabilities/PrimaryEnvironmentAuth`){},eG=class extends ti()(`@p4code/client-runtime/platform/capabilities/SshEnvironmentGateway`){},tG={environmentId:Xb,label:L},nG=class extends Fb()(`PrimaryConnectionTarget`,{...tG,httpBaseUrl:L,wsBaseUrl:L}){},rG=class extends Fb()(`BearerConnectionTarget`,{...tG,connectionId:L}){},iG=class extends Fb()(`SshConnectionTarget`,{...tG,connectionId:L}){};V([nG,rG,iG]);var aG=V([rG,iG]),oG=H([`network`,`timeout`,`transport`,`endpoint-unavailable`,`remote-unavailable`]),sG=H([`authentication`,`configuration`,`permission`,`unsupported`]),cG=class extends G()(`ConnectionTransientError`,{reason:oG,detail:L,traceId:P(L)}){get message(){return this.detail}},lG=class extends G()(`ConnectionBlockedError`,{reason:sG,detail:L,traceId:P(L)}){get message(){return this.detail}};function uG(e){switch(e.phase){case`connecting`:return`synchronizing`;case`connected`:return`ready`;case`available`:case`offline`:case`backoff`:case`blocked`:return`disconnected`}}var dG=Object.freeze({desired:!1,network:`unknown`,phase:`available`,stage:null,attempt:0,generation:0,lastFailure:null,retryAt:null}),fG={connectionId:L,environmentId:Xb,label:L},pG=class extends Fb()(`BearerConnectionProfile`,{...fG,httpBaseUrl:L,wsBaseUrl:L}){},mG=class extends Fb()(`SshConnectionProfile`,{...fG,target:EM}){},hG=V([pG,mG]),gG=class extends Fb()(`BearerConnectionCredential`,{token:L}){},_G=V([gG]),vG=class extends Fb()(`PrimaryConnectionRegistration`,{target:nG}){},yG=class extends Fb()(`BearerConnectionRegistration`,{target:rG,profile:pG,credential:gG}){},bG=class extends Fb()(`SshConnectionRegistration`,{target:iG,profile:mG}){};V([yG,bG]),V([vG,yG]);function xG(e){switch(e._tag){case`PrimaryConnectionRegistration`:return{target:e.target,profile:Pr()};case`BearerConnectionRegistration`:case`SshConnectionRegistration`:return{target:e.target,profile:Fr(e.profile)}}}var SG=class extends ti()(`@p4code/client-runtime/connection/credentialStore/ConnectionCredentialStore`){},CG=e=>SG.of(e),wG=class extends ti()(`@p4code/client-runtime/connection/profileStore/ConnectionProfileStore`){},TG=e=>wG.of(e),EG=class extends ti()(`@p4code/client-runtime/connection/connectivity`){},DG=e=>EG.of(e),OG=e=>Jl(EG,DG(e)),kG=class extends G()(`ConnectionPersistenceError`,{operation:H([`list-targets`,`register-connection`,`remove-connection`,`load-shell`,`save-shell`,`load-thread`,`save-thread`,`remove-thread`,`load-server-config`,`save-server-config`,`load-vcs-refs`,`save-vcs-refs`,`remove-vcs-refs`,`clear-vcs-refs`,`clear-environment`]),message:L}){},AG=class extends ti()(`@p4code/client-runtime/platform/persistence/ConnectionTargetStore`){},jG=class extends ti()(`@p4code/client-runtime/platform/persistence/ConnectionRegistrationStore`){},MG=class extends ti()(`@p4code/client-runtime/platform/persistence/EnvironmentCacheStore`){},NG=class extends gi(`@p4code/client-runtime/platform/persistence/EnvironmentOwnedDataCleanup`,{defaultValue:()=>({clear:()=>cf})}){},PG=/^[\u0021\u0023-\u005b\u005d-\u007e]+$/u,FG=class extends G()(`OAuthScopeEncodingError`,{scopes:B(L),invalidScopes:B(L),duplicateScopes:B(L)}){get message(){return`OAuth scopes must be non-empty, syntactically valid, and unique.`}};function IG(e){let t=e.filter(e=>!PG.test(e)),n=new Set,r=new Set;for(let t of e)n.has(t)&&r.add(t),n.add(t);if(e.length===0||t.length>0||r.size>0)throw new FG({scopes:e,invalidScopes:t,duplicateScopes:[...r]});return e.join(` `)}var LG=1e4,RG=e=>({...e?.label?{client_label:e.label}:{},...e?.deviceType?{client_device_type:e.deviceType}:{},...e?.os?{client_os:e.os}:{}}),zG=Fp(`clientRuntime.authorization.bootstrapRemoteBearerSession`)(function*(e){let t=yield*fV(e.httpBaseUrl);return yield*mV($p(e.httpBaseUrl,`/oauth/token`),e.timeoutMs??LG,t.auth.token({headers:{},payload:{grant_type:gw,subject_token:e.credential,subject_token_type:vw,requested_token_type:_w,...e.scopes?{scope:IG(e.scopes)}:{},...RG(e.clientMetadata)}}))});Fp(`clientRuntime.authorization.fetchRemoteSessionState`)(function*(e){let t=yield*fV(e.httpBaseUrl);return yield*mV($p(e.httpBaseUrl,`/api/auth/session`),e.timeoutMs??LG,t.auth.session({headers:{authorization:`Bearer ${e.bearerToken}`}}))});var BG=Fp(`clientRuntime.authorization.issueRemoteWebSocketTicket`)(function*(e){let t=yield*fV(e.httpBaseUrl);return yield*mV($p(e.httpBaseUrl,`/api/auth/websocket-ticket`),e.timeoutMs??LG,t.auth.webSocketTicket({headers:{authorization:`Bearer ${e.bearerToken}`}}))}),VG=Fp(`clientRuntime.authorization.resolveRemoteWebSocketConnectionUrl`)(function*(e){let t=yield*BG({httpBaseUrl:e.httpBaseUrl,bearerToken:e.bearerToken,...e.timeoutMs?{timeoutMs:e.timeoutMs}:{}}),n=new URL(e.wsBaseUrl);return(n.pathname===``||n.pathname===`/`)&&(n.pathname=`/ws`),n.searchParams.set(`wsTicket`,t.ticket),n.toString()});function HG(e){return new lG({reason:`configuration`,detail:`Connection profile ${e} is unavailable.`})}function UG(e){return new lG({reason:`authentication`,detail:`Connection credential ${e} is unavailable.`})}function WG(e){return new lG({reason:`configuration`,detail:`Connected environment ${e.actual} does not match ${e.expected}.`})}function GG(e){switch(e._tag){case`EnvironmentAuthInvalidError`:return new lG({reason:`authentication`,detail:`The environment credential is invalid.`,traceId:e.traceId});case`EnvironmentScopeRequiredError`:case`EnvironmentOperationForbiddenError`:return new lG({reason:`permission`,detail:`The environment credential does not grant the required access.`,traceId:e.traceId});case`EnvironmentRequestInvalidError`:return new lG({reason:`configuration`,detail:`The environment rejected the authentication request.`,traceId:e.traceId});case`EnvironmentResourceNotFoundError`:return new lG({reason:`configuration`,detail:`The environment endpoint could not be found.`,traceId:e.traceId});case`RemoteEnvironmentAuthTimeoutError`:return new cG({reason:`timeout`,detail:e.message});case`RemoteEnvironmentAuthFetchError`:return new cG({reason:`network`,detail:e.message});case`EnvironmentInternalError`:return new cG({reason:`remote-unavailable`,detail:`The environment could not authorize the connection.`,traceId:e.traceId});case`RemoteEnvironmentAuthInvalidJsonError`:case`RemoteEnvironmentAuthUndeclaredStatusError`:return new cG({reason:`remote-unavailable`,detail:e.message})}}var KG=class extends ti()(`@p4code/client-runtime/authorization/service/RemoteEnvironmentAuthorization`){},qG=Fp(`clientRuntime.connection.remote.fetchDescriptor`)(function*(e){return yield*gV({httpBaseUrl:e}).pipe(jf(GG))}),JG=Ql(KG,df(function*(){let e=yield*QE,t=Fp(`clientRuntime.connection.remote.authorizeBearer`)(function*(t){let n=yield*qG(t.httpBaseUrl).pipe(Yf(QE,e));if(n.environmentId!==t.expectedEnvironmentId)return yield*WG({expected:t.expectedEnvironmentId,actual:n.environmentId});let r=yield*VG({wsBaseUrl:t.wsBaseUrl,httpBaseUrl:t.httpBaseUrl,bearerToken:t.bearerToken}).pipe(jf(GG),Yf(QE,e));return{environmentId:n.environmentId,label:n.label,httpBaseUrl:t.httpBaseUrl,socketUrl:r,httpAuthorization:{_tag:`Bearer`,token:t.bearerToken}}});return KG.of({authorizeBearer:t})})),YG=class extends ti()(`@p4code/client-runtime/connection/resolver/ConnectionResolver`){},XG=gy(pG),ZG=gy(mG),QG=gy(gG);function $G(e){let t=new URL(e.wsBaseUrl);return(t.pathname===``||t.pathname===`/`)&&(t.pathname=`/ws`),t.toString()}var eK=Fp(`clientRuntime.connection.broker.makePrimary`)(function*(){let e=yield*$W,t=yield*KG;return Fp(`clientRuntime.connection.broker.primary`)(function*(n){let r=yield*e.bearerToken;return Lr(r)?{environmentId:n.environmentId,label:n.label,httpBaseUrl:n.httpBaseUrl,socketUrl:$G(n),httpAuthorization:null,target:n}:{...yield*t.authorizeBearer({expectedEnvironmentId:n.environmentId,httpBaseUrl:n.httpBaseUrl,wsBaseUrl:n.wsBaseUrl,bearerToken:r.value}),target:n}})}),tK=Fp(`clientRuntime.connection.broker.makeBearer`)(function*(){let e=yield*SG,t=yield*KG;return Fp(`clientRuntime.connection.broker.bearer`)(function*(n){let r=n.target,i=yield*zr(n.profile,{onNone:()=>ff(HG(r.connectionId)),onSome:M});if(!XG(i))return yield*new lG({reason:`configuration`,detail:`Connection profile ${r.connectionId} is not a bearer connection.`});if(i.environmentId!==r.environmentId)return yield*WG({expected:r.environmentId,actual:i.environmentId});let a=yield*e.get(r.connectionId).pipe(_f(zr({onNone:()=>ff(UG(r.connectionId)),onSome:M})));if(!QG(a))return yield*UG(r.connectionId);let o=yield*t.authorizeBearer({expectedEnvironmentId:r.environmentId,httpBaseUrl:i.httpBaseUrl,wsBaseUrl:i.wsBaseUrl,bearerToken:a.token});return{environmentId:o.environmentId,label:o.label,httpBaseUrl:o.httpBaseUrl,socketUrl:o.socketUrl,httpAuthorization:o.httpAuthorization,target:r}})}),nK=Fp(`clientRuntime.connection.broker.makeSsh`)(function*(){let e=yield*wG,t=yield*eG,n=yield*KG;return Fp(`clientRuntime.connection.broker.ssh`)(function*(r){let i=r.target,a=yield*zr(r.profile,{onNone:()=>ff(HG(i.connectionId)),onSome:M});if(!ZG(a))return yield*new lG({reason:`configuration`,detail:`Connection profile ${i.connectionId} is not an SSH connection.`});if(a.environmentId!==i.environmentId)return yield*WG({expected:i.environmentId,actual:a.environmentId});let o=yield*t.prepare({connectionId:i.connectionId,expectedEnvironmentId:i.environmentId,target:a.target});yield*e.put(new mG({connectionId:a.connectionId,environmentId:a.environmentId,label:a.label,target:o.bootstrap.target}));let s=yield*n.authorizeBearer({expectedEnvironmentId:i.environmentId,httpBaseUrl:o.bootstrap.httpBaseUrl,wsBaseUrl:o.bootstrap.wsBaseUrl,bearerToken:o.bearerToken});return{environmentId:s.environmentId,label:s.label,httpBaseUrl:s.httpBaseUrl,socketUrl:s.socketUrl,httpAuthorization:s.httpAuthorization,target:i}})}),rK=Ql(YG,df(function*(){let e=yield*eK(),t=yield*tK(),n=yield*nK(),r=Fp(`clientRuntime.connection.broker.prepare`)(function*(r){let i=r.target;switch(yield*fp({"connection.environment.id":i.environmentId,"connection.target.kind":i._tag}),i._tag){case`PrimaryConnectionTarget`:return yield*e(i);case`BearerConnectionTarget`:return yield*t({...r,target:i});case`SshConnectionTarget`:return yield*n({...r,target:i})}});return YG.of({prepare:r})})),iK=VW(SB),aK=`15 seconds`,oK=class extends ti()(`@p4code/client-runtime/rpc/session/RpcSessionFactory`){};function sK(e){switch(e._tag){case`EnvironmentAuthorizationError`:return new lG({reason:`permission`,detail:e.message});case`KeybindingsConfigParseError`:case`ServerSettingsError`:return new cG({reason:`remote-unavailable`,detail:e.message});case`RpcClientError`:return new cG({reason:`transport`,detail:e.message})}}var cK=Ql(oK,df(function*(){let e=yield*ME,t=Pp(function*(t){yield*fp({"connection.environment.id":t.environmentId});let n=yield*gl(),r=yield*gl(),i=XW.of({onConnect:wl(n,void 0).pipe(Ef),onDisconnect:Sl(n).pipe(_f(e=>yl(r,new cG({reason:`transport`,detail:e?`${t.label} disconnected.`:`${t.label} could not establish a WebSocket connection.`}))),Ef)}),a=IE(t.socketUrl,{openTimeout:aK}).pipe(su(Jl(ME,e))),o=yield*Kl(Ql(GW,KW({retryTransientErrors:!1,retryPolicy:Hd(0)})).pipe(su(iu(a,IW,Jl(XW,i))))).pipe(gp(`environment.websocket.connect`)),s=yield*iK.pipe(Gf(o)),c=yield*rp(s[X.serverGetConfig]({}).pipe(jf(sK),gp(`environment.initialSync`))),l=c.pipe(_f(e=>(e.environment.capabilities.connectionProbe===!0?s[X.serverProbe]({}):s[X.serverGetConfig]({})).pipe(jf(sK))),Ef,gp(`clientRuntime.connection.rpcSession.probe`));return{client:s,initialConfig:c,ready:_l(n).pipe(yf(c),Ef,Vf(_l(r))),probe:l,closed:_l(r)}});return oK.of({connect:t})})),lK=class extends ti()(`@p4code/client-runtime/connection/driver/ConnectionDriver`){},uK=Ql(lK,df(function*(){let e=yield*YG,t=yield*oK,n=Fp(`ConnectionDriver.connect`)(function*(n,r){let i=n.target;yield*fp({"connection.environment.id":i.environmentId,"connection.target.kind":i._tag}),yield*r({stage:`preparing`});let a=yield*e.prepare(n);yield*r({stage:`opening`,prepared:a});let o=yield*t.connect(a);return yield*r({stage:`synchronizing`,prepared:a}),yield*o.ready,{prepared:a,session:o}});return lK.of({connect:n})})),dK=/^(?:Error|EvalError|RangeError|ReferenceError|SyntaxError|TypeError|URIError|AggregateError|DOMException|[A-Za-z][A-Za-z0-9]*(?:Error|Failure))$/,fK=/^[A-Za-z0-9._:-]{1,128}$/,pK=32;function mK(e){return typeof e==`string`&&dK.test(e)?e:void 0}function hK(e){try{let t=new URL(e);return t.username=``,t.password=``,t.search=``,t.hash=``,t.toString()}catch{return e}}function gK(e){return e.replace(/(?:https?|file):\/\/[^\s)]+/g,hK)}function _K(e){try{let t=e.stack?.split(/\r?\n/).filter(e=>/^\s*at\s+/.test(e)||/^[^@\s]+@(?:https?|file):\/\//.test(e)).slice(0,pK).map(gK);return t&&t.length>0?t.join(`
|
|
20
|
-
`):void 0}catch{return}}function vK(e){try{return typeof e!=`object`||!e?void 0:mK(e._tag)}catch{return}}function yK(e){try{let t=new Set,n=e;for(;typeof n==`object`&&n&&!t.has(n);){t.add(n);let e=n;if(typeof e.traceId==`string`&&fK.test(e.traceId))return e.traceId;n=e.cause}return}catch{return}}function bK(e){let t=vK(e),n=yK(e);if(e instanceof Error){let r=mK(e.name),i=_K(e);return{errorType:`error`,...r===void 0?{}:{errorName:r},...t===void 0?{}:{errorTag:t},...n===void 0?{}:{traceId:n},...i===void 0?{}:{stack:i}}}return{errorType:e===null?`null`:Array.isArray(e)?`array`:typeof e==`object`?`object`:`primitive`,...t===void 0?{}:{errorTag:t},...n===void 0?{}:{traceId:n}}}var xK=class extends ti()(`@p4code/client-runtime/connection/wakeups/ConnectionWakeups`){},SK=e=>xK.of(e),CK=e=>Jl(xK,SK(e)),wK=[1e3,2e3,4e3,8e3,16e3],TK=`15 seconds`,EK=`15 seconds`,DK=3e4;function OK(e){return Hf(e,{onFailure:e=>wu(e)?ip:M(ul(e)),onSuccess:e=>M(ll(e))})}function kK(e){return wK[Math.min(e,wK.length-1)]??16e3}function AK(e){return fp({"environment.id":e.environmentId,"environment.label":e.label,"environment.target.kind":e._tag})}function jK(e,t){return{desired:!1,network:e.network,phase:`available`,stage:null,attempt:0,generation:t,lastFailure:null,retryAt:null}}function MK(e,t,n,r){return{desired:!0,network:e.network,phase:`offline`,stage:null,attempt:n,generation:t,lastFailure:r,retryAt:null}}function NK(e,t,n,r,i=`preparing`){return{desired:!0,network:e.network,phase:`connecting`,stage:i,attempt:n,generation:t,lastFailure:r,retryAt:null}}function PK(e,t,n,r){if(pl(t)||bu(t.cause))return{_tag:`Interrupted`,established:n,stable:r};let i=t.cause.reasons.find(fu);return i?{_tag:`Failure`,established:n,stable:r,failure:i.error}:{_tag:`Failure`,established:n,stable:r,failure:{error:new cG({reason:`transport`,detail:`${e.label} connection failed unexpectedly.`})}}}var FK=class extends ti()(`@p4code/client-runtime/connection/supervisor/EnvironmentSupervisor`){},IK=Fp(`EnvironmentSupervisor.make`)(function*(e,t){let n=e.target;yield*AK(n);let r=yield*EG,i=yield*lK,a=yield*xK,o={desired:t?.initiallyDesired??!1,network:yield*r.status},s=yield*GE(o),c=yield*qie(),l=yield*Ij(o.desired?o.network===`offline`?MK(o,0,0,null):NK(o,0,1,null):jK(o,0)),u=yield*Ij(Pr()),d=yield*Ij(Pr()),f=Qd([Bj(u,Pr()),Bj(d,Pr())],{discard:!0}),p=Fp(`EnvironmentSupervisor.setState`)(function*(e){yield*Bj(l,e)}),m=Fp(`EnvironmentSupervisor.signal`)(function*(e){yield*Ox(c,e)}),h=Fp(`EnvironmentSupervisor.reportProgress`)(function*(e,t,n,r){`prepared`in r&&(yield*Bj(d,Fr(r.prepared))),yield*p(NK(yield*KE(s),t,e,n,r.stage))}),g=Pp(function*(t,n,r){return yield*i.connect(e,e=>h(t,n,r,e))}),_=Pp(function*(e,t,n){return yield*g(e,t,n).pipe(Cf(e=>({lease:e})),jf(e=>({error:e})))}),v=Pp(function*(){for(;;){let e=yield*Ix(c);switch(e._tag){case`DisconnectRequested`:case`RetryRequested`:return;case`NetworkChanged`:if(e.network===`offline`)return;break;case`ConnectRequested`:break;case`Wakeup`:break}}}),y=Pp(function*(e){for(;;){let t=yield*Ix(c);switch(t._tag){case`DisconnectRequested`:case`RetryRequested`:return;case`NetworkChanged`:if(t.network===`offline`)return;break;case`Wakeup`:if(t.reason===`application-active`){let t=yield*e.session.probe.pipe(Rf({duration:EK,orElse:()=>ff(new cG({reason:`timeout`,detail:`${n.label} did not respond to a connection health check.`}))}),vp);for(;;){let e=yield*Vf(ox(t).pipe(Cf(e=>({_tag:`ProbeCompleted`,exit:e}))),Ix(c).pipe(Cf(e=>({_tag:`Signal`,signal:e}))));if(e._tag===`ProbeCompleted`){yield*e.exit;break}switch(e.signal._tag){case`DisconnectRequested`:case`RetryRequested`:yield*cx(t);return;case`NetworkChanged`:if(e.signal.network===`offline`){yield*cx(t);return}break;case`ConnectRequested`:case`Wakeup`:break}}}break;case`ConnectRequested`:break}}}),b=Pp(function*(e,t,r){yield*Bj(d,Pr());let i=yield*$ne([OK(_(e,t,r)).pipe(Cf(e=>({_tag:`Completed`,exit:e}))),v().pipe(wf({_tag:`Interrupted`})),Bf(TK).pipe(wf({_tag:`TimedOut`}))]);if(i._tag===`Interrupted`)return{_tag:`Interrupted`,established:!1,stable:!1};if(i._tag===`TimedOut`)return{_tag:`Failure`,established:!1,stable:!1,failure:{error:new cG({reason:`timeout`,detail:`${n.label} did not respond during connection setup.`})}};if(ml(i.exit)){let e=!bu(i.exit.cause)&&!i.exit.cause.reasons.some(fu),t=PK(n,i.exit,!1,!1);if(e){let e=i.exit.cause.reasons.find(pu)?.defect;yield*Rp(`Connection attempt failed with an unexpected defect.`).pipe(Bp({"environment.id":n.environmentId,"environment.label":n.label,"cause.reason_count":i.exit.cause.reasons.length,...bK(e)}))}return t}let a=i.exit.value,o=yield*KE(s);if(!o.desired||o.network===`offline`)return{_tag:`Interrupted`,established:!1,stable:!1};let c=yield*Mu;yield*Bj(d,Fr(a.lease.prepared)),yield*Bj(u,Fr(a.lease.session)),yield*p({desired:!0,network:o.network,phase:`connected`,stage:null,attempt:e,generation:t,lastFailure:null,retryAt:null});let l=yield*Vf(a.lease.session.closed.pipe(jf(e=>({error:e}))),y(a.lease).pipe(jf(e=>({error:e})))).pipe(OK),f=(yield*Mu)-c;return PK(n,l,!0,f>=DK)},ep(f)),x=Pp(function*(e){return yield*Vf(Bf(e),df(function*(){for(;;)switch((yield*Ix(c))._tag){case`ConnectRequested`:case`DisconnectRequested`:case`RetryRequested`:case`NetworkChanged`:case`Wakeup`:return}}))}),S=Ix(c),C=Pp(function*(){let e=0,t=0,n=null;for(;;){let r=yield*KE(s);if(!r.desired){e=0,n=null,yield*f,yield*p(jK(r,t)),yield*S;continue}if(r.network===`offline`){yield*f,yield*p(MK(r,t,e+1,n)),yield*S;continue}let i=e+1,a=t+1,o=yield*Xf(b(i,a,n));if(o.established&&(t=a,o.stable&&(e=0,n=null)),o._tag===`Interrupted`)continue;let c=o.failure.error;if(n=c,c._tag===`ConnectionBlockedError`){let e=yield*KE(s);yield*p({desired:e.desired,network:e.network,phase:`blocked`,stage:null,attempt:i,generation:t,lastFailure:c,retryAt:null}),yield*S;continue}e+=1;let l=kK(e-1),u=yield*KE(s);yield*p({desired:u.desired,network:u.network,phase:`backoff`,stage:null,attempt:i,generation:t,lastFailure:c,retryAt:(yield*Mu)+l}),yield*x(l)}});yield*r.changes.pipe(kC(e=>YE(s,t=>t.network===e?[!1,t]:[!0,{...t,network:e}]).pipe(_f(t=>t?m({_tag:`NetworkChanged`,network:e}):cf))),bp),yield*a.changes.pipe(kC(e=>m({_tag:`Wakeup`,reason:e})),bp),yield*C().pipe(bp);let w=XE(s,e=>({...e,desired:!0})).pipe(yf(m({_tag:`ConnectRequested`})),gp(`EnvironmentSupervisor.connect`)),T=XE(s,e=>({...e,desired:!1})).pipe(yf(m({_tag:`DisconnectRequested`})),gp(`EnvironmentSupervisor.disconnect`)),E=m({_tag:`RetryRequested`}).pipe(gp(`EnvironmentSupervisor.retryNow`));return yield*$f(()=>Nx(c).pipe(yf(f))),FK.of({target:n,state:l,session:u,prepared:d,connect:w,disconnect:T,retryNow:E})}),LK=gy(mG),RK=class extends G()(`EnvironmentNotRegisteredError`,{environmentId:Xb}){get message(){return`Environment ${this.environmentId} is not registered.`}},zK=class extends G()(`PlatformEnvironmentRemovalError`,{environmentId:Xb}){get message(){return`Platform-managed environment ${this.environmentId} cannot be removed.`}},BK=class extends ti()(`@p4code/client-runtime/connection/registry/EnvironmentRegistry`){},VK=Ql(BK,df(function*(){let e=yield*AG,t=yield*jG,n=yield*MG,r=yield*NG,i=yield*wG,a=yield*SG,o=yield*EG,s=yield*lK,c=yield*xK,l=yield*eG,u=yield*e.list,d=yield*Ij(new Map(yield*$d(u,Fp(`EnvironmentRegistry.loadCatalogEntry`)(function*(e){let t=e._tag===`BearerConnectionTarget`||e._tag===`SshConnectionTarget`?yield*i.get(e.connectionId):Pr();return[e.environmentId,{target:e,profile:t}]}),{concurrency:`unbounded`}))),f=yield*Ij(yield*o.status),p=yield*Ij(new Map),m=yield*GE(new Set),h=yield*GE(new Map(u.map(e=>[e.environmentId,e]))),g=yield*GE(new Map),_=yield*Kx(1),v=yield*GE(!1),y=(e,t)=>rre(_.withPermits(1)(df(function*(){let t=yield*KE(g),n=t.get(e);if(n!==void 0)return yield*qE(g,new Map(t).set(e,{semaphore:n.semaphore,users:n.users+1})),n.semaphore;let r=yield*Kx(1);return yield*qE(g,new Map(t).set(e,{semaphore:r,users:1})),r})),e=>e.withPermits(1)(t),t=>_.withPermits(1)(XE(g,n=>{let r=n.get(e);if(r===void 0||r.semaphore!==t)return n;let i=new Map(n);return r.users===1?i.delete(e):i.set(e,{semaphore:t,users:r.users-1}),i}))).pipe(gp(`EnvironmentRegistry.withLeaseLock`)),b=Fp(`EnvironmentRegistry.getEntry`)(function*(e){let t=(yield*Rj(d)).get(e);return t===void 0?yield*new RK({environmentId:e}):t}),x=Fp(`EnvironmentRegistry.closeServiceScope`)(function*(e){let t=yield*Rj(p),n=t.get(e);if(n===void 0)return;let r=new Map(t);r.delete(e),yield*Bj(p,r),yield*Fl(n.scope,fl)}),S=Fp(`EnvironmentRegistry.createServiceScope`)(e=>sp(df(function*(){let t=e.target.environmentId,n=yield*kl(),r=yield*IK(e,{initiallyDesired:!1}).pipe(Yf(EG,o),Yf(lK,s),Yf(xK,c),jl(n),tp(()=>Fl(n,fl)));return yield*r.connect,yield*Vj(p,i=>{let a=new Map(i);return a.set(t,{entry:e,supervisor:r,scope:n}),a}),r}))),C=Fp(`EnvironmentRegistry.acquireSupervisor`)(function*(e){return yield*y(e,df(function*(){let t=yield*b(e),n=(yield*Rj(p)).get(e);if(n!==void 0){if(wt(n.entry,t))return n.supervisor;yield*x(e)}return yield*S(t)}))}),w=Fp(`EnvironmentRegistry.run`)(function*(e,t){return yield*Yf(t,FK,yield*C(e))}),T=(e,t)=>aC(C(e).pipe(Cf(e=>EC(t,FK,e)))),E=(e,t)=>uC(ZS(Rj(d)),Lj(d)).pipe(oC(t=>Ur(t.get(e))),xC,cC(zr({onNone:()=>tC,onSome:()=>aC(C(e).pipe(tre({onFailure:()=>tC,onSuccess:e=>EC(t,FK,e)})))}))),ee=df(function*(){(yield*JE(v,!0))||(yield*$d(u,e=>C(e.environmentId).pipe(Of(`EnvironmentNotRegisteredError`,()=>cf)),{concurrency:`unbounded`,discard:!0}))}).pipe(gp(`EnvironmentRegistry.start`)),te=Fp(`EnvironmentRegistry.installEntryLocked`)(function*(e,t){let n=e.target,r=(yield*Rj(d)).get(n.environmentId),i=(yield*Rj(p)).get(n.environmentId);t?.retainEquivalentRuntime===!0&&r!==void 0&&wt(r,e)&&i!==void 0&&wt(i.entry,e)||(yield*x(n.environmentId),yield*Vj(d,t=>{let r=new Map(t);return r.set(n.environmentId,e),r}),yield*S(e))}),D=Fp(`EnvironmentRegistry.register`)(function*(e){let n=xG(e),r=n.target.environmentId;yield*y(r,df(function*(){(yield*KE(m)).has(r)||(yield*t.register(e),yield*XE(h,t=>{let n=new Map(t);return n.set(r,e.target),n}),yield*te(n))}))}),ne=Fp(`EnvironmentRegistry.installPlatformRegistration`)(function*(e){let n=xG(e),r=n.target;yield*y(r.environmentId,df(function*(){yield*XE(m,e=>{let t=new Set(e);return t.add(r.environmentId),t}),e._tag===`BearerConnectionRegistration`&&(yield*a.put(e.target.connectionId,e.credential).pipe(Df(e=>Lp(`Could not store the platform bearer credential.`,{environmentId:r.environmentId,error:e}))));let i=(yield*KE(h)).get(r.environmentId);i!==void 0&&(yield*t.remove(i).pipe(bf(()=>XE(h,e=>{let t=new Map(e);return t.delete(r.environmentId),t})),Df(e=>Lp(`Could not remove a persisted registration shadowed by a platform environment.`,{environmentId:r.environmentId,error:e})))),yield*te(n,{retainEquivalentRuntime:!0})}))}),re=Fp(`EnvironmentRegistry.removePlatformEnvironment`)(function*(e){yield*y(e,df(function*(){let t=(yield*Rj(d)).get(e);yield*XE(m,t=>{let n=new Set(t);return n.delete(e),n}),yield*x(e),yield*Vj(d,t=>{let n=new Map(t);return n.delete(e),n}),t!==void 0&&t.target._tag===`BearerConnectionTarget`&&(yield*a.remove(t.target.connectionId).pipe(Df(t=>Lp(`Could not clear the platform bearer credential.`,{environmentId:e,error:t})))),yield*Qd([n.clear(e).pipe(Df(t=>Lp(`Could not clear cached environment data after removal.`,{environmentId:e,error:t}))),r.clear(e)],{concurrency:`unbounded`,discard:!0})}))}),ie=Fp(`EnvironmentRegistry.registerPlatform`)(function*(e){yield*ne(e)}),O=Fp(`EnvironmentRegistry.reconcilePlatform`)(function*(e){let t=new Set(e.map(e=>e.target.environmentId));yield*$d(yield*KE(m),e=>t.has(e)?cf:re(e),{discard:!0}),yield*$d(e,ne,{discard:!0})}),ae=Fp(`EnvironmentRegistry.remove`)(function*(e){return yield*y(e,df(function*(){if((yield*KE(m)).has(e))return yield*new zK({environmentId:e});let a=(yield*b(e)).target,o=a._tag===`BearerConnectionTarget`||a._tag===`SshConnectionTarget`?yield*i.get(a.connectionId):Pr();yield*t.remove(a),yield*XE(h,t=>{let n=new Map(t);return n.delete(e),n}),yield*x(e),yield*Vj(d,t=>{let n=new Map(t);return n.delete(e),n}),yield*Qd([n.clear(e).pipe(Df(t=>Lp(`Could not clear cached environment data after removal.`,{environmentId:e,error:t}))),r.clear(e)],{concurrency:`unbounded`,discard:!0}),a._tag===`SshConnectionTarget`&&Rr(o)&&LK(o.value)&&(yield*l.disconnect(o.value.target).pipe(Nf(t=>Lp(`Could not disconnect the managed SSH environment.`,{environmentId:e,error:t})),Ff))}))}),oe=e=>C(e).pipe(_f(e=>e.retryNow),Of(`EnvironmentNotRegisteredError`,()=>cf),gp(`EnvironmentRegistry.retryNow`)),k=Fp(`EnvironmentRegistry.state`)(function*(e){return yield*Rj((yield*C(e)).state)});return yield*$f(()=>Rj(p).pipe(_f(e=>$d(e.values(),e=>Fl(e.scope,fl),{concurrency:`unbounded`,discard:!0})))),yield*o.changes.pipe(kC(e=>Bj(f,e)),bp),BK.of({entries:d,networkStatus:f,start:ee,register:D,registerPlatform:ie,reconcilePlatform:O,remove:ae,retryNow:oe,state:k,stateChanges:e=>E(e,aC(FK.pipe(Cf(e=>Lj(e.state))))),run:w,runStream:T,followStream:E})})),HK=class extends G()(`EnvironmentRpcUnavailableError`,{environmentId:L,message:L}){},UK=class extends gi(`@p4code/client-runtime/rpc/EnvironmentRpcRequestObserver`,{defaultValue:()=>({observe:()=>M(cf)})}){},WK=gy(lU),GK=Fp(`EnvironmentRpc.currentSession`)(function*(){let e=yield*FK;return yield*Rj(e.session).pipe(_f(zr({onNone:()=>ff(new HK({environmentId:e.target.environmentId,message:`${e.target.label} is not connected.`})),onSome:M})))}),KK=Fp(`EnvironmentRpc.request`)(function*(e,t){let n=yield*FK;yield*fp({"environment.id":n.target.environmentId,"rpc.method":e});let r=yield*GK(),i=yield*UK,a=r.client[e],o=yield*i.observe({environmentId:n.target.environmentId,method:e});return yield*a(t).pipe(ep(o))});function qK(e,t){return aC(GK().pipe(Cf(n=>{let r=n.client[e];return r(t)}))).pipe(DC(`EnvironmentRpc.runStream`,{attributes:{"rpc.method":e}}))}function JK(e,t,n){return aC(FK.pipe(Cf(r=>{let i=Lj(r.session);return(n?.resubscribe===void 0?i:dC(i,n.resubscribe.pipe(sC(()=>Rj(r.session))))).pipe(cC(zr({onNone:()=>tC,onSome:i=>{let a=i.client[e],o=()=>nC(()=>aC(t(i).pipe(Cf(t=>a(t).pipe(mC(t=>{let i=t.reasons.length>0&&t.reasons.every(e=>e._tag===`Fail`);if(i&&t.reasons.every(e=>e._tag===`Fail`&&WK(e.error)))return ZS(Lp(`Durable RPC subscription lost its transport; waiting for the next session.`,{cause:Tu(t),method:e,environmentId:r.target.environmentId})).pipe(lC);if(i&&n?.onExpectedFailure!==void 0){let e=ZS(n.onExpectedFailure(t)).pipe(lC);return n.retryExpectedFailureAfter===void 0?e:e.pipe(uC(ZS(Bf(n.retryExpectedFailureAfter)).pipe(lC)),uC(o()))}return xae(t)}))))));return o()}})))}))).pipe(DC(`EnvironmentRpc.subscribe`,{attributes:{"rpc.method":e}}))}function YK(e,t,n){return JK(e,()=>M(t),n)}df(function*(){return yield*(yield*GK()).initialConfig}).pipe(gp(`EnvironmentRpc.config`));async function XK(e){try{return await e()}catch(e){return PV(gu(e))}}function ZK(){let e=new WeakMap,t=t=>{let n=e.get(t);if(n!==void 0)return n;let r={serial:new Map,singleFlight:new Map,latest:new Map};return e.set(t,r),r};return{schedule:(e,n,r,i)=>{if(n.mode===`parallel`)return i();let a=n.key(r),o=t(e);if(n.mode===`singleFlight`){let e=o.singleFlight.get(a);if(e!==void 0)return e;let t=i();return o.singleFlight.set(a,t),t.then(()=>{o.singleFlight.get(a)===t&&o.singleFlight.delete(a)},()=>{o.singleFlight.get(a)===t&&o.singleFlight.delete(a)}),t}if(n.mode===`serial`){let e=o.serial.get(a),t=e===void 0?i():e.then(i,i);return o.serial.set(a,t),t.then(()=>{o.serial.get(a)===t&&o.serial.delete(a)},()=>{o.serial.get(a)===t&&o.serial.delete(a)}),t}let s=o.latest.get(a);s===void 0&&(s={running:!1,pending:void 0},o.latest.set(a,s));let c=s,l=new Promise(e=>{if(c.pending===void 0){c.pending={execute:i,resolve:[e]};return}c.pending.execute=i,c.pending.resolve.push(e)});return c.running||(c.running=!0,(async()=>{for(;c.pending!==void 0;){let e=c.pending;c.pending=void 0;let t;try{t=await e.execute()}catch(e){t=PV(gu(e))}for(let n of e.resolve)n(t)}c.running=!1,o.latest.get(a)===c&&o.latest.delete(a)})()),l}}}async function QK(e,t,n,r={},i=console){let a=await XK(()=>t.run(e,n));return oq(a,{...r,label:r.label??t.label},i),a}function $K(e,t){return e._tag===`Success`?MV(t(e.value)):PV(e.cause)}function eq(e){return e._tag===`Failure`&&bu(e.cause)}function tq(e){return Su(e.cause)}async function nq(e){try{return EV(await e())}catch(e){return PV(gu(e))}}async function rq(e,t={},n=console){let r=await nq(e);return oq(r,t,n),r}async function iq(e,t,n={},r=console){let i=Xf(df(function*(){return yield*YV(e,t),yield*JV(e,t,{suspendOnWaiting:!0})}));return rq(()=>Op(i),n,r)}function aq(e,t){let n=t.scheduler??ZK(),r=t.concurrency??{mode:`parallel`};return{label:t.label,run:(i,a)=>XK(()=>n.schedule(i,r,a,()=>iq(i,e.atom(t.execute(a,i)).pipe(GH(t.label)),{reportDefect:!1,reportFailure:!1})))}}function oq(e,t={},n=console){if(jV(e)||bu(e.cause))return;let r=t.label??`atom command`;Lne(e.cause)?(t.reportDefect??!0)&&n.error(`[atom-command] ${r} defected`,e.cause):(t.reportFailure??!0)&&n.warn(`[atom-command] ${r} failed`,e.cause)}async function sq(e){try{return MV(await e())}catch(e){return PV(gu(e))}}function cq(e){return JSON.stringify([e.environmentId,e.input])}function lq(e){let t=JSON.parse(e);return{environmentId:Xb.make(t[0]),input:t[1]}}function uq(e,t){return BK.pipe(_f(n=>n.run(e,t)))}function dq(e,t){return aC(BK.pipe(Cf(n=>n.runStream(e,t))))}function fq(e,t){return aC(BK.pipe(Cf(n=>n.followStream(e,t))))}function pq(e,t){let n=UH(t=>e.atom(fq(t,aC(FK.pipe(Cf(e=>Lj(e.state).pipe(pC(e=>e.phase===`connected`?Hi(e.generation):Wi),xC,oC(e=>e)))))),{initialValue:null})),r=UH(r=>{let i=lq(r),a=t.idleTtlMs??5*6e4,o=e.atom(e=>Wr(BV(e(n(i.environmentId))))===null?uf:uq(i.environmentId,t.execute(i.input))).pipe(XH({staleTime:t.staleTimeMs??3e4,revalidateOnMount:!0}),hH(a));return(t.refreshIntervalMs===void 0?o:o.pipe(YH(t.refreshIntervalMs))).pipe(hH(a),GH(`${t.label}:${r}`))});return e=>r(cq(e))}function mq(e,t){let n=UH(n=>{let r=lq(n);return e.atom(fq(r.environmentId,t.subscribe(r.input))).pipe(hH(t.idleTtlMs??5*6e4),GH(`${t.label}:${n}`))});return e=>n(cq(e))}function hq(e,t){return aq(e,{label:t.label,...t.scheduler===void 0?{}:{scheduler:t.scheduler},...t.concurrency===void 0?{}:{concurrency:t.concurrency},execute:(e,n)=>uq(e.environmentId,t.execute(e.input,n,e.environmentId))})}function gq(e,t){return pq(e,{label:t.label,...t.staleTimeMs===void 0?{}:{staleTimeMs:t.staleTimeMs},...t.idleTtlMs===void 0?{}:{idleTtlMs:t.idleTtlMs},...t.refreshIntervalMs===void 0?{}:{refreshIntervalMs:t.refreshIntervalMs},execute:e=>KK(t.tag,e)})}function _q(e,t){return mq(e,{label:t.label,...t.idleTtlMs===void 0?{}:{idleTtlMs:t.idleTtlMs},subscribe:e=>{let n=YK(t.tag,e);return t.transform===void 0?n:t.transform(n)}})}function vq(e,t){return hq(e,{label:t.label,...t.scheduler===void 0?{}:{scheduler:t.scheduler},...t.concurrency===void 0?{}:{concurrency:t.concurrency},execute:(e,n,r)=>{let i={environmentId:r,input:e};return KK(t.tag,e).pipe(bf(()=>t.onSuccess?.(i,n)??cf),ep(t.onSettled?.(i,n)??cf))}})}function yq(e){let t=qp.unstable_scheduleCallback(4,e);return()=>qp.unstable_cancelCallback(t)}var bq=A.createContext(KV({scheduleTask:yq,defaultIdleTTL:400})),xq=new WeakMap;function Sq(e,t){let n=xq.get(e);n===void 0&&(n=new WeakMap,xq.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i={subscribe(n){return e.subscribe(t,n)},snapshot(){return e.get(t)},getServerSnapshot(){return nU(t,e)}};return n.set(t,i),i}function Cq(e,t){let n=Sq(e,t);return A.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}var wq=(e,t)=>{let n=A.useContext(bq);return t?Cq(n,A.useMemo(()=>JH(e,t),[e,t])):Cq(n,e)};function Tq(e,t){A.useEffect(()=>e.mount(t),[t,e])}function Eq(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?A.useCallback(r=>{e.set(t,r);let i=Op(JV(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(Dq):i},[e,t,n.mode]):A.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var Dq=e=>{if(pl(e))return e.value;throw Su(e.cause)},Oq=(e,t)=>{let n=A.useContext(bq);return Tq(n,e),Eq(n,e,t)},kq=e=>{let t=A.useContext(bq);return Tq(t,e),A.useCallback(()=>{t.refresh(e)},[t,e])},Aq=class extends G()(`LocalStorageOperationError`,{operation:H([`read`,`decode`,`encode`,`update`,`write`,`remove`,`notify`]),storageKey:L,cause:Cb()}){get message(){return`Failed to ${this.operation} local storage item ${this.storageKey}.`}},jq=typeof window<`u`?window.localStorage:function(){let e=new Map;return{clear:()=>e.clear(),getItem:t=>e.get(t)??null,key:t=>Xi(e).at(t)??null,get length(){return e.size},removeItem:t=>e.delete(t),setItem:(t,n)=>e.set(t,n)}}(),Mq=e=>{try{return jq.getItem(e)}catch(t){throw new Aq({operation:`read`,storageKey:e,cause:t})}},Nq=(e,t,n)=>{try{return Sy(Db(t))(n)}catch(t){throw new Aq({operation:`decode`,storageKey:e,cause:t})}},Pq=(e,t,n)=>{try{return Sre(Db(t))(n)}catch(t){throw new Aq({operation:`encode`,storageKey:e,cause:t})}},Fq=(e,t)=>{let n=Mq(e);return n?Nq(e,t,n):null},Iq=(e,t,n)=>{let r=Pq(e,n,t);try{jq.setItem(e,r)}catch(t){throw new Aq({operation:`write`,storageKey:e,cause:t})}},Lq=e=>{try{jq.removeItem(e)}catch(t){throw new Aq({operation:`remove`,storageKey:e,cause:t})}},Rq=`p4code:local_storage_change`;function zq(e){if(!(typeof window>`u`))try{window.dispatchEvent(new CustomEvent(Rq,{detail:{key:e}}))}catch(t){throw new Aq({operation:`notify`,storageKey:e,cause:t})}}function Bq(e,t,n){let r=(0,A.useCallback)(()=>{try{return Mq(e)}catch(e){return console.error(`[LOCALSTORAGE] Could not read stored value.`,e),null}},[e]),i=(0,A.useSyncExternalStore)((0,A.useCallback)(t=>{let n=n=>{n.key===e&&t()},r=n=>{n.detail.key===e&&t()};return window.addEventListener(`storage`,n),window.addEventListener(Rq,r),()=>{window.removeEventListener(`storage`,n),window.removeEventListener(Rq,r)}},[e]),r,r);return[(0,A.useMemo)(()=>{if(i===null)return t;try{return Nq(e,n,i)}catch(e){return console.error(`[LOCALSTORAGE] Could not decode stored value.`,e),t}},[t,e,n,i]),(0,A.useCallback)(r=>{try{let i=Fq(e,n)??t,a;if(typeof r==`function`)try{a=r(i)}catch(t){throw new Aq({operation:`update`,storageKey:e,cause:t})}else a=r;a===null?Lq(e):Iq(e,a,n),zq(e)}catch(e){console.error(`[LOCALSTORAGE] Could not update stored value.`,e)}},[t,e,n])]}function Vq(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Vq(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Hq(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Vq(e))&&(r&&(r+=` `),r+=t);return r}var Uq=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Wq=Hq,Gq=(e,t)=>n=>{if(t?.variants==null)return Wq(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Uq(t)||Uq(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Wq(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Kq=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},qq=(e,t)=>({classGroupId:e,validator:t}),Jq=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Yq=`-`,Xq=[],Zq=`arbitrary..`,Qq=e=>{let t=tJ(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return eJ(e);let n=e.split(Yq);return $q(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Kq(i,t):t:i||Xq}return n[e]||Xq}}},$q=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=$q(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Yq):e.slice(t).join(Yq),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},eJ=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Zq+r:void 0})(),tJ=e=>{let{theme:t,classGroups:n}=e;return nJ(n,t)},nJ=(e,t)=>{let n=Jq();for(let r in e){let i=e[r];rJ(i,n,r,t)}return n},rJ=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];iJ(i,t,n,r)}},iJ=(e,t,n,r)=>{if(typeof e==`string`){aJ(e,t,n);return}if(typeof e==`function`){oJ(e,t,n,r);return}sJ(e,t,n,r)},aJ=(e,t,n)=>{let r=e===``?t:cJ(t,e);r.classGroupId=n},oJ=(e,t,n,r)=>{if(lJ(e)){rJ(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(qq(n,e))},sJ=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];rJ(o,cJ(t,a),n,r)}},cJ=(e,t)=>{let n=e,r=t.split(Yq),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Jq(),n.nextPart.set(t,i)),n=i}return n},lJ=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,uJ=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},dJ=`!`,fJ=`:`,pJ=[],mJ=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),hJ=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===fJ){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(dJ)?(c=s.slice(0,-1),l=!0):s.startsWith(dJ)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return mJ(t,l,c,u)};if(t){let e=t+fJ,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):mJ(pJ,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},gJ=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},_J=e=>({cache:uJ(e.cacheSize),parseClassName:hJ(e),sortModifiers:gJ(e),postfixLookupClassGroupIds:vJ(e),...Qq(e)}),vJ=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},yJ=/\s+/,bJ=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(yJ),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+dJ:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},xJ=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=SJ(n))&&(i&&(i+=` `),i+=r);return i},SJ=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=SJ(e[r]))&&(n&&(n+=` `),n+=t);return n},CJ=(e,...t)=>{let n,r,i,a,o=o=>(n=_J(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=bJ(e,n);return i(e,a),a};return a=o,(...e)=>a(xJ(...e))},wJ=[],TJ=e=>{let t=t=>t[e]||wJ;return t.isThemeGetter=!0,t},EJ=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,DJ=/^\((?:(\w[\w-]*):)?(.+)\)$/i,OJ=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kJ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,AJ=/\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$/,jJ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,MJ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,NJ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,PJ=e=>OJ.test(e),FJ=e=>!!e&&!Number.isNaN(Number(e)),IJ=e=>!!e&&Number.isInteger(Number(e)),LJ=e=>e.endsWith(`%`)&&FJ(e.slice(0,-1)),RJ=e=>kJ.test(e),zJ=()=>!0,BJ=e=>AJ.test(e)&&!jJ.test(e),VJ=()=>!1,HJ=e=>MJ.test(e),UJ=e=>NJ.test(e),WJ=e=>!qJ(e)&&!tY(e),GJ=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)),KJ=e=>lY(e,pY,VJ),qJ=e=>EJ.test(e),JJ=e=>lY(e,mY,BJ),YJ=e=>lY(e,hY,FJ),XJ=e=>lY(e,_Y,zJ),ZJ=e=>lY(e,gY,VJ),QJ=e=>lY(e,dY,VJ),$J=e=>lY(e,fY,UJ),eY=e=>lY(e,vY,HJ),tY=e=>DJ.test(e),nY=e=>uY(e,mY),rY=e=>uY(e,gY),iY=e=>uY(e,dY),aY=e=>uY(e,pY),oY=e=>uY(e,fY),sY=e=>uY(e,vY,!0),cY=e=>uY(e,_Y,!0),lY=(e,t,n)=>{let r=EJ.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},uY=(e,t,n=!1)=>{let r=DJ.exec(e);return r?r[1]?t(r[1]):n:!1},dY=e=>e===`position`||e===`percentage`,fY=e=>e===`image`||e===`url`,pY=e=>e===`length`||e===`size`||e===`bg-size`,mY=e=>e===`length`,hY=e=>e===`number`,gY=e=>e===`family-name`,_Y=e=>e===`number`||e===`weight`,vY=e=>e===`shadow`,yY=CJ(()=>{let e=TJ(`color`),t=TJ(`font`),n=TJ(`text`),r=TJ(`font-weight`),i=TJ(`tracking`),a=TJ(`leading`),o=TJ(`breakpoint`),s=TJ(`container`),c=TJ(`spacing`),l=TJ(`radius`),u=TJ(`shadow`),d=TJ(`inset-shadow`),f=TJ(`text-shadow`),p=TJ(`drop-shadow`),m=TJ(`blur`),h=TJ(`perspective`),g=TJ(`aspect`),_=TJ(`ease`),v=TJ(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),tY,qJ],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[tY,qJ,c],T=()=>[PJ,`full`,`auto`,...w()],E=()=>[IJ,`none`,`subgrid`,tY,qJ],ee=()=>[`auto`,{span:[`full`,IJ,tY,qJ]},IJ,tY,qJ],te=()=>[IJ,`auto`,tY,qJ],D=()=>[`auto`,`min`,`max`,`fr`,tY,qJ],ne=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],re=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],ie=()=>[`auto`,...w()],O=()=>[PJ,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ae=()=>[PJ,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],oe=()=>[PJ,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],k=()=>[e,tY,qJ],se=()=>[...b(),iY,QJ,{position:[tY,qJ]}],ce=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],le=()=>[`auto`,`cover`,`contain`,aY,KJ,{size:[tY,qJ]}],ue=()=>[LJ,nY,JJ],de=()=>[``,`none`,`full`,l,tY,qJ],A=()=>[``,FJ,nY,JJ],fe=()=>[`solid`,`dashed`,`dotted`,`double`],pe=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],me=()=>[FJ,LJ,iY,QJ],he=()=>[``,`none`,m,tY,qJ],ge=()=>[`none`,FJ,tY,qJ],_e=()=>[`none`,FJ,tY,qJ],ve=()=>[FJ,tY,qJ],ye=()=>[PJ,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[RJ],breakpoint:[RJ],color:[zJ],container:[RJ],"drop-shadow":[RJ],ease:[`in`,`out`,`in-out`],font:[WJ],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[RJ],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[RJ],shadow:[RJ],spacing:[`px`,FJ],text:[RJ],"text-shadow":[RJ],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,PJ,qJ,tY,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,tY,qJ]}],"container-named":[GJ],columns:[{columns:[FJ,qJ,tY,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[IJ,`auto`,tY,qJ]}],basis:[{basis:[PJ,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[FJ,PJ,`auto`,`initial`,`none`,qJ]}],grow:[{grow:[``,FJ,tY,qJ]}],shrink:[{shrink:[``,FJ,tY,qJ]}],order:[{order:[IJ,`first`,`last`,`none`,tY,qJ]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ne(),`normal`]}],"justify-items":[{"justify-items":[...re(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...re()]}],"align-content":[{content:[`normal`,...ne()]}],"align-items":[{items:[...re(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...re(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...re(),`baseline`]}],"place-self":[{"place-self":[`auto`,...re()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:ie()}],mx:[{mx:ie()}],my:[{my:ie()}],ms:[{ms:ie()}],me:[{me:ie()}],mbs:[{mbs:ie()}],mbe:[{mbe:ie()}],mt:[{mt:ie()}],mr:[{mr:ie()}],mb:[{mb:ie()}],ml:[{ml:ie()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:O()}],"inline-size":[{inline:[`auto`,...ae()]}],"min-inline-size":[{"min-inline":[`auto`,...ae()]}],"max-inline-size":[{"max-inline":[`none`,...ae()]}],"block-size":[{block:[`auto`,...oe()]}],"min-block-size":[{"min-block":[`auto`,...oe()]}],"max-block-size":[{"max-block":[`none`,...oe()]}],w:[{w:[s,`screen`,...O()]}],"min-w":[{"min-w":[s,`screen`,`none`,...O()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...O()]}],h:[{h:[`screen`,`lh`,...O()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...O()]}],"max-h":[{"max-h":[`screen`,`lh`,...O()]}],"font-size":[{text:[`base`,n,nY,JJ]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,cY,XJ]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,LJ,qJ]}],"font-family":[{font:[rY,ZJ,t]}],"font-features":[{"font-features":[qJ]}],"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:[i,tY,qJ]}],"line-clamp":[{"line-clamp":[FJ,`none`,tY,YJ]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,tY,qJ]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,tY,qJ]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:k()}],"text-color":[{text:k()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...fe(),`wavy`]}],"text-decoration-thickness":[{decoration:[FJ,`from-font`,`auto`,tY,JJ]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[FJ,`auto`,tY,qJ]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[IJ,tY,qJ]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,tY,qJ]}],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`,tY,qJ]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:ce()}],"bg-size":[{bg:le()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},IJ,tY,qJ],radial:[``,tY,qJ],conic:[IJ,tY,qJ]},oY,$J]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:k()}],"gradient-via":[{via:k()}],"gradient-to":[{to:k()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:A()}],"border-w-x":[{"border-x":A()}],"border-w-y":[{"border-y":A()}],"border-w-s":[{"border-s":A()}],"border-w-e":[{"border-e":A()}],"border-w-bs":[{"border-bs":A()}],"border-w-be":[{"border-be":A()}],"border-w-t":[{"border-t":A()}],"border-w-r":[{"border-r":A()}],"border-w-b":[{"border-b":A()}],"border-w-l":[{"border-l":A()}],"divide-x":[{"divide-x":A()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":A()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...fe(),`hidden`,`none`]}],"divide-style":[{divide:[...fe(),`hidden`,`none`]}],"border-color":[{border:k()}],"border-color-x":[{"border-x":k()}],"border-color-y":[{"border-y":k()}],"border-color-s":[{"border-s":k()}],"border-color-e":[{"border-e":k()}],"border-color-bs":[{"border-bs":k()}],"border-color-be":[{"border-be":k()}],"border-color-t":[{"border-t":k()}],"border-color-r":[{"border-r":k()}],"border-color-b":[{"border-b":k()}],"border-color-l":[{"border-l":k()}],"divide-color":[{divide:k()}],"outline-style":[{outline:[...fe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[FJ,tY,qJ]}],"outline-w":[{outline:[``,FJ,nY,JJ]}],"outline-color":[{outline:k()}],shadow:[{shadow:[``,`none`,u,sY,eY]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":[`none`,d,sY,eY]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:A()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[FJ,JJ]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":A()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":[`none`,f,sY,eY]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[FJ,tY,qJ]}],"mix-blend":[{"mix-blend":[...pe(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":pe()}],"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":[FJ]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":k()}],"mask-image-linear-to-color":[{"mask-linear-to":k()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":k()}],"mask-image-t-to-color":[{"mask-t-to":k()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":k()}],"mask-image-r-to-color":[{"mask-r-to":k()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":k()}],"mask-image-b-to-color":[{"mask-b-to":k()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":k()}],"mask-image-l-to-color":[{"mask-l-to":k()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":k()}],"mask-image-x-to-color":[{"mask-x-to":k()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":k()}],"mask-image-y-to-color":[{"mask-y-to":k()}],"mask-image-radial":[{"mask-radial":[tY,qJ]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":k()}],"mask-image-radial-to-color":[{"mask-radial-to":k()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[FJ]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":k()}],"mask-image-conic-to-color":[{"mask-conic-to":k()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:ce()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,tY,qJ]}],filter:[{filter:[``,`none`,tY,qJ]}],blur:[{blur:he()}],brightness:[{brightness:[FJ,tY,qJ]}],contrast:[{contrast:[FJ,tY,qJ]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,sY,eY]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:[``,FJ,tY,qJ]}],"hue-rotate":[{"hue-rotate":[FJ,tY,qJ]}],invert:[{invert:[``,FJ,tY,qJ]}],saturate:[{saturate:[FJ,tY,qJ]}],sepia:[{sepia:[``,FJ,tY,qJ]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,tY,qJ]}],"backdrop-blur":[{"backdrop-blur":he()}],"backdrop-brightness":[{"backdrop-brightness":[FJ,tY,qJ]}],"backdrop-contrast":[{"backdrop-contrast":[FJ,tY,qJ]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,FJ,tY,qJ]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[FJ,tY,qJ]}],"backdrop-invert":[{"backdrop-invert":[``,FJ,tY,qJ]}],"backdrop-opacity":[{"backdrop-opacity":[FJ,tY,qJ]}],"backdrop-saturate":[{"backdrop-saturate":[FJ,tY,qJ]}],"backdrop-sepia":[{"backdrop-sepia":[``,FJ,tY,qJ]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,tY,qJ]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[FJ,`initial`,tY,qJ]}],ease:[{ease:[`linear`,`initial`,_,tY,qJ]}],delay:[{delay:[FJ,tY,qJ]}],animate:[{animate:[`none`,v,tY,qJ]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,tY,qJ]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ge()}],"rotate-x":[{"rotate-x":ge()}],"rotate-y":[{"rotate-y":ge()}],"rotate-z":[{"rotate-z":ge()}],scale:[{scale:_e()}],"scale-x":[{"scale-x":_e()}],"scale-y":[{"scale-y":_e()}],"scale-z":[{"scale-z":_e()}],"scale-3d":[`scale-3d`],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[tY,qJ,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":[`translate-none`],zoom:[{zoom:[IJ,tY,qJ]}],accent:[{accent:k()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:k()}],"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`,tY,qJ]}],"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":k()}],"scrollbar-track-color":[{"scrollbar-track":k()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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`,tY,qJ]}],fill:[{fill:[`none`,...k()]}],"stroke-w":[{stroke:[FJ,nY,JJ,YJ]}],stroke:[{stroke:[`none`,...k()]}],"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`]}}),bY=yO.make(`codex`);function xY(e){return{optionDescriptors:e.optionDescriptors.map(wY)}}function SY(e,t){return e?.find(e=>e.id===t)?.value}function CY(e,t){let n=FY(t);return n?e.options.length===0?n:e.promptInjectedValues?.includes(n)&&e.options.some(e=>e.id===n)?e.options.find(e=>e.isDefault)?.id:e.options.some(e=>e.id===n)?n:e.currentValue??e.options.find(e=>e.isDefault)?.id:e.currentValue??e.options.find(e=>e.isDefault)?.id}function wY(e){return e.type===`select`?{...e,options:[...e.options],...e.promptInjectedValues?{promptInjectedValues:[...e.promptInjectedValues]}:{}}:{...e}}function TY(e){return{...e}}function EY(e,t){if(e.type===`boolean`)return typeof t==`boolean`?{...e,currentValue:t}:e;let n=typeof t==`string`?CY(e,t):CY(e,e.currentValue);if(!n){let{currentValue:t,...n}=e;return n}return{...e,currentValue:n}}function DY(e){let{caps:t,selections:n}=e;return(t.optionDescriptors??[]).map(wY).map(e=>EY(e,SY(n,e.id)??e.currentValue))}function OY(e){if(e)return e.type===`boolean`||e.currentValue?e.currentValue:e.options.find(e=>e.isDefault)?.id}function kY(e){if(!e)return;if(e.type===`boolean`)return typeof e.currentValue==`boolean`?e.currentValue?`On`:`Off`:void 0;let t=OY(e);if(typeof t==`string`)return e.options.find(e=>e.id===t)?.label}function AY(e){if(!e||e.length===0)return;let t=[];for(let n of e){let e=OY(n);(typeof e==`string`||typeof e==`boolean`)&&t.push({id:n.id,value:e})}return t.length>0?t:void 0}function jY(e){return typeof e==`string`&&/\bultrathink\b/i.test(e)}function MY(e,t=bY){let n=NY(e);if(!n)return null;let r=GO[t]??{},i=Object.prototype.hasOwnProperty.call(r,n)?r[n]:void 0;return typeof i==`string`?i:n}function NY(e){return typeof e==`string`&&e.trim()||null}function PY(e,t,n){if(typeof t!=`string`)return null;let r=t.trim();if(!r)return null;let i=n.find(e=>e.slug===r);if(i)return i.slug;let a=n.find(e=>e.name.toLowerCase()===r.toLowerCase());if(a)return a.slug;let o=MY(r,e);if(!o)return null;let s=n.find(e=>e.slug===o);return s?s.slug:null}function FY(e){return typeof e==`string`&&e.trim()||null}function IY(e){return e.map(TY)}function LY(e,t,n){let r=n?IY(n):[],i={instanceId:e,model:t};return r.length>0?{...i,options:r}:i}function RY(e,t){let n=FY(t);if(!n)return null;let r=DY({caps:e});for(let e of r)if(e.type===`select`&&e.promptInjectedValues?.includes(n))return n;return null}function zY(e,t){let n=e.trim();return!n||t!==`ultrathink`||n.startsWith(`Ultrathink:`)?n:`Ultrathink:\n${n}`}var BY=xY({optionDescriptors:[]}),VY=yO.make(`codex`);function HY(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function UY(e,t){return WY(e,t)?.models??[]}function WY(e,t){let n=TO(t);return e.find(e=>e.instanceId===n)}function GY(e,t){return WY(e,t)?.displayName?.trim()||HY(t)}function KY(e,t){return WY(e,t)?.showInteractionModeToggle??!0}function qY(e,t){let n=e.find(e=>e.instanceId===t);return n?.enabled?n.driver:e.find(e=>e.enabled)?.driver??VY}function JY(e,t,n){let r=MY(t,n);return e.find(e=>e.slug===r)?.capabilities??BY}function YY(e,t){let n=UY(e,t);return n.find(e=>e.isDefault&&!e.isCustom)?.slug??n.find(e=>!e.isCustom)?.slug??n[0]?.slug??UO[t]??`gpt-5.6-sol`}var XY=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ZY=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),QY=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),$Y=e=>{let t=QY(e);return t.charAt(0).toUpperCase()+t.slice(1)},eX={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`},tX=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},nX=(0,A.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,A.createElement)(`svg`,{ref:c,...eX,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:XY(`lucide`,i),...!a&&!tX(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,A.createElement)(e,t)),...Array.isArray(a)?a:[a]])),rX=(e,t)=>{let n=(0,A.forwardRef)(({className:n,...r},i)=>(0,A.createElement)(nX,{ref:i,iconNode:t,className:XY(`lucide-${ZY($Y(e))}`,`lucide-${e}`,n),...r}));return n.displayName=$Y(e),n},iX=rX(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),aX=rX(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),oX=rX(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),sX=rX(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),cX=rX(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),lX=rX(`zap`,[[`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`}]]);function uX(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var dX=uX(`https://base-ui.com/production-error`,`Base UI`),fX=A.createContext(void 0);function pX(e){let t=A.useContext(fX);if(t===void 0&&!e)throw Error(dX(33));return t}var mX=A.createContext(void 0);function hX(e){let t=A.useContext(mX);if(t===void 0&&!e)throw Error(dX(36));return t}var gX={};function _X(e,t){let n=A.useRef(gX);return n.current===gX&&(n.current=e(t)),n}function vX(e,t,n,r){let i=_X(bX).current;return xX(i,e,t,n,r)&&CX(i,[e,t,n,r]),i.callback}function yX(e){let t=_X(bX).current;return SX(t,e)&&CX(t,e),t.callback}function bX(){return{callback:null,cleanup:null,refs:[]}}function xX(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function SX(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function CX(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var wX=19;function TX(e){return wX>=e}function EX(e){if(!A.isValidElement(e))return null;let t=e,n=t.props;return(TX(19)?n?.ref:t.ref)??null}function DX(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function OX(){}var kX=Object.freeze([]),AX=Object.freeze({});function jX(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function MX(e,t){return typeof e==`function`?e(t):e}function NX(e,t){return typeof e==`function`?e(t):e}var PX={};function FX(e,t,n,r,i){if(!n&&!r&&!i&&!e)return LX(t);let a=LX(e);return t&&(a=RX(a,t)),n&&(a=RX(a,n)),r&&(a=RX(a,r)),i&&(a=RX(a,i)),a}function IX(e){if(e.length===0)return PX;if(e.length===1)return LX(e[0]);let t=LX(e[0]);for(let n=1;n<e.length;n+=1)t=RX(t,e[n]);return t}function LX(e){return HX(e)?{...UX(e,PX)}:zX(e)}function RX(e,t){return HX(t)?UX(t,e):BX(e,t)}function zX(e){let t={...e};for(let e in t){let n=t[e];VX(e,n)&&(t[e]=GX(n))}return t}function BX(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=DX(e.style,r);break;case`className`:e[n]=qX(e.className,r);break;default:VX(n,r)?e[n]=WX(e[n],r):e[n]=r}}return e}function VX(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function HX(e){return typeof e==`function`}function UX(e,t){return HX(e)?e(t):e??PX}function WX(e,t){return t?e?(...n)=>{let r=n[0];if(JX(r)){let i=r;KX(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:GX(t):e}function GX(e){return e&&((...t)=>{let n=t[0];return JX(n)&&KX(n),e(...t)})}function KX(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function qX(e,t){return t?e?t+` `+e:t:e}function JX(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function YX(e,t,n={}){let r=t.render,i=XX(t,n);return n.enabled===!1?null:$X(e,r,i,n.state??AX)}function XX(e,t={}){let{className:n,style:r,render:i}=e,{state:a=AX,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?MX(n,a):void 0,d=l?NX(r,a):void 0,f=l?jX(a,c):AX,p=l&&s?ZX(s):void 0,m=l?DX(f,p)??{}:AX;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=yX([m.ref,EX(i),...o]):m.ref=vX(m.ref,EX(i),o):vX(null,null)),l?(u!==void 0&&(m.className=qX(m.className,u)),d!==void 0&&(m.style=DX(m.style,d)),m):AX}function ZX(e){return Array.isArray(e)?IX(e):FX(void 0,e)}var QX=Symbol.for(`react.lazy`);function $X(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=FX(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===QX&&(i=A.Children.toArray(t)[0]),A.cloneElement(i,e)}if(e&&typeof e==`string`)return eZ(e,n);throw Error(dX(8))}function eZ(e,t){return e===`button`?(0,A.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,A.createElement)(`img`,{alt:``,...t,key:t.key}):A.createElement(e,t)}var tZ=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),nZ={[tZ.startingStyle]:``},rZ={[tZ.endingStyle]:``},iZ={transitionStatus(e){return e===`starting`?nZ:e===`ending`?rZ:null}},aZ=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=tZ.startingStyle]=`startingStyle`,e[e.endingStyle=tZ.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),oZ=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),sZ={[oZ.popupOpen]:``},cZ={[oZ.popupOpen]:``,[oZ.pressed]:``},lZ={[aZ.open]:``},uZ={[aZ.closed]:``},dZ={[aZ.anchorHidden]:``},fZ={open(e){return e?sZ:null}},pZ={open(e){return e?cZ:null}},mZ={open(e){return e?lZ:uZ},anchorHidden(e){return e?dZ:null}},hZ=A.createContext(void 0);function gZ(e=!0){let t=A.useContext(hZ);if(t===void 0&&!e)throw Error(dX(25));return t}var _Z=`none`,vZ=`trigger-press`,yZ=`trigger-hover`,bZ=`trigger-focus`,xZ=`outside-press`,SZ=`item-press`,CZ=`close-press`,wZ=`clear-press`,TZ=`increment-press`,EZ=`decrement-press`,DZ=`input-change`,OZ=`input-clear`,kZ=`input-blur`,AZ=`input-paste`,jZ=`input-press`,MZ=`focus-out`,NZ=`escape-key`,PZ=`list-navigation`,FZ=`keyboard`,IZ=`pointer`,LZ=`cancel-open`,RZ=`sibling-open`,zZ=`disabled`,BZ=`imperative-action`,VZ=`window-resize`;function HZ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=A.useRef(e!==void 0),[a,o]=A.useState(t);return[i?e:a,A.useCallback(e=>{i||o(e)},[])]}function UZ(){return typeof window<`u`}function WZ(e){return qZ(e)?(e.nodeName||``).toLowerCase():`#document`}function GZ(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function KZ(e){return((qZ(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function qZ(e){return UZ()?e instanceof Node||e instanceof GZ(e).Node:!1}function JZ(e){return UZ()?e instanceof Element||e instanceof GZ(e).Element:!1}function YZ(e){return UZ()?e instanceof HTMLElement||e instanceof GZ(e).HTMLElement:!1}function XZ(e){return!UZ()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof GZ(e).ShadowRoot}function ZZ(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=cQ(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function QZ(e){return/^(table|td|th)$/.test(WZ(e))}function $Z(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var eQ=/transform|translate|scale|rotate|perspective|filter/,tQ=/paint|layout|strict|content/,nQ=e=>!!e&&e!==`none`,rQ;function iQ(e){let t=JZ(e)?cQ(e):e;return nQ(t.transform)||nQ(t.translate)||nQ(t.scale)||nQ(t.rotate)||nQ(t.perspective)||!oQ()&&(nQ(t.backdropFilter)||nQ(t.filter))||eQ.test(t.willChange||``)||tQ.test(t.contain||``)}function aQ(e){let t=uQ(e);for(;YZ(t)&&!sQ(t);){if(iQ(t))return t;if($Z(t))return null;t=uQ(t)}return null}function oQ(){return rQ??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),rQ}function sQ(e){return/^(html|body|#document)$/.test(WZ(e))}function cQ(e){return GZ(e).getComputedStyle(e)}function lQ(e){return JZ(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uQ(e){if(WZ(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||XZ(e)&&e.host||KZ(e);return XZ(t)?t.host:t}function dQ(e){let t=uQ(e);return sQ(t)?e.ownerDocument?e.ownerDocument.body:e.body:YZ(t)&&ZZ(t)?t:dQ(t)}function fQ(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=dQ(e),i=r===e.ownerDocument?.body,a=GZ(r);if(i){let e=pQ(a);return t.concat(a,a.visualViewport||[],ZZ(r)?r:[],e&&n?fQ(e):[])}else return t.concat(r,fQ(r,[],n))}function pQ(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var mQ={...A},hQ=mQ.useInsertionEffect,gQ=hQ&&hQ!==mQ.useLayoutEffect?hQ:e=>e();function _Q(e){let t=_X(vQ).current;return t.next=e,gQ(t.effect),t.trampoline}function vQ(){let e={next:void 0,callback:yQ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function yQ(){}var bQ=typeof document<`u`?A.useLayoutEffect:()=>{},xQ=A.createContext(void 0);function SQ(e=!1){let t=A.useContext(xQ);if(t===void 0&&!e)throw Error(dX(16));return t}function CQ(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:A.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function wQ(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=A.useRef(null),s=SQ(!0),c=a??s!==void 0,{props:l}=CQ({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=A.useCallback(()=>{let e=o.current;TQ(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return bQ(u,[u]),{getButtonProps:A.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return FX({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(KX(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=TQ(a),l=!i&&EQ(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(KX(e),a?.(e),e.target===e.currentTarget&&i&&c&&TQ(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:_Q(e=>{o.current=e,u()})}}function TQ(e){return YZ(e)&&e.tagName===`BUTTON`}function EQ(e){return!!(e?.tagName===`A`&&e?.href)}var DQ=typeof navigator<`u`,OQ=RQ(),kQ=BQ(),AQ=zQ(),jQ=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),MQ=OQ.platform===`MacIntel`&&OQ.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(OQ.platform),NQ=DQ&&/firefox/i.test(AQ),PQ=DQ&&/apple/i.test(navigator.vendor);DQ&&/Edg/i.test(AQ);var FQ=DQ&&/android/i.test(kQ)||/android/i.test(AQ),IQ=DQ&&kQ.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,LQ=AQ.includes(`jsdom/`);function RQ(){if(!DQ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function zQ(){if(!DQ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function BQ(){if(!DQ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function VQ(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=gZ(!0),d=u!==void 0;return A.useMemo(()=>({id:r,role:`menuitem`,tabIndex:n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:SZ})},onMouseUp(e){if(u){let t=u.initialCursorPointRef.current;if(u.initialCursorPointRef.current=null,d&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||d&&!IQ&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!d||e.button===2)&&(!c||c.type===`regular-item`)&&s.current.click()}}),[t,n,r,l,i,a,o,s,u,d,c])}var HQ={type:`regular-item`};function UQ(e){let{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=A.useRef(null),{getButtonProps:d,buttonRef:f}=wQ({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=VQ({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=A.useCallback(e=>FX(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=vX(u,f);return A.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var WQ=A.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function GQ(){return A.useContext(WQ)}var KQ=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function qQ(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=GQ(),f=A.useRef(-1),[p,m]=A.useState(a??(i===KQ.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=A.useRef(null),g=A.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return bQ(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),bQ(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),A.useMemo(()=>({ref:g,index:p}),[p,g])}var JQ=0;function YQ(e,t=`mui`){let[n,r]=A.useState(e),i=e||n;return A.useEffect(()=>{n??(JQ+=1,r(`${t}-${JQ}`))},[n,t]),i}var XQ=mQ.useId;function ZQ(e,t){if(XQ!==void 0){let n=XQ();return e??(t?`${t}-${n}`:n)}return YQ(e,t)}function QQ(e){return ZQ(e,`base-ui`)}var $Q=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),ade={checked(e){return e?{[$Q.checked]:``}:{[$Q.unchecked]:``}},...iZ};function e$(e,t,n,r){let i=!1,a=!1,o=r??AX;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function ode(e,t,n){let r=n??AX;return{reason:e,event:t??new Event(`base-ui`),...r}}var sde=[];function t$(e){A.useEffect(e,sde)}var n$=null;globalThis.requestAnimationFrame;var r$=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},i$=class e{static create(){return new e}static request(e){return r$.request(e)}static cancel(e){return r$.cancel(e)}currentId=n$;request(e){this.cancel(),this.currentId=r$.request(()=>{this.currentId=n$,e()})}cancel=()=>{this.currentId!==n$&&(r$.cancel(this.currentId),this.currentId=n$)};disposeEffect=()=>this.cancel};function a$(){let e=_X(i$.create).current;return t$(e.disposeEffect),e}function o$(e,t=!1,n=!1){let[r,i]=A.useState(e&&t?`idle`:void 0),[a,o]=A.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),bQ(()=>{if(!e&&a&&r!==`ending`&&n){let e=i$.request(()=>{i(`ending`)});return()=>{i$.cancel(e)}}},[e,a,r,n]),bQ(()=>{if(!e||t)return;let n=i$.request(()=>{i(void 0)});return()=>{i$.cancel(n)}},[t,e]),bQ(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=i$.request(()=>{i(`idle`)});return()=>{i$.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function s$(e){return e==null?e:`current`in e?e.current:e}function c$(e,t=!1,n=!0){let r=a$();return _Q((i,a=null)=>{r.cancel();let o=s$(e);if(o==null)return;let s=o,c=()=>{Jp.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=tZ.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function l$(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=_Q(i),o=c$(r,n,!1);A.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var u$=A.createContext(void 0);function cde(){let e=A.useContext(u$);if(e===void 0)throw Error(dX(31));return e}var lde=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=A.useState(void 0),c=YX(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,N.jsx)(u$.Provider,{value:s,children:c})}),ude=A.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=QQ(a),c=cde();return bQ(()=>(c(s),()=>{c(void 0)}),[c,s]),YX(`div`,e,{ref:t,props:{id:s,role:`presentation`,...o}})}),d$=A.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=qQ({label:a}),f=pX(!0),p=QQ(i),{store:m}=hX(),h=m.useState(`isActive`,d.index),g=m.useState(`itemProps`),{getItemProps:_,itemRef:v}=UQ({closeOnClick:c,disabled:s,highlighted:h,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:HQ});return YX(`div`,e,{state:{disabled:s,highlighted:h},props:[g,u,_],ref:[v,t,d.ref]})}),f$=0,p$=class e{static create(){return new e}currentId=f$;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=f$,t()},e)}isStarted(){return this.currentId!==f$}clear=()=>{this.currentId!==f$&&(clearTimeout(this.currentId),this.currentId=f$)};disposeEffect=()=>this.clear};function m$(){let e=_X(p$.create).current;return t$(e.disposeEffect),e}function h$(e){e.preventDefault(),e.stopPropagation()}function dde(e){return`nativeEvent`in e}function g$(e){return e.pointerType===``&&e.isTrusted?!0:FQ&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function _$(e){return LQ?!1:!FQ&&e.width===0&&e.height===0||FQ&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function v$(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function fde(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var pde=`data-base-ui-focusable`,mde=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,y$=`ArrowLeft`,b$=`ArrowRight`,hde=`ArrowUp`,gde=`ArrowDown`;function x$(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function S$(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&XZ(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function C$(e){return`composedPath`in e?e.composedPath()[0]:e.target}function w$(e,t){if(!JZ(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(S$(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function T$(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function _de(e){return e.matches(`html,body`)}function E$(e){return YZ(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function vde(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${mde}`)!=null}function D$(e){return e?e.getAttribute(`role`)===`combobox`&&E$(e):!1}function O$(e){if(!e||LQ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function k$(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function yde(e,t){return t!=null&&!v$(t)?0:typeof e==`function`?e():e}function A$(e,t,n){let r=yde(e,n);return typeof r==`number`?r:r?.[t]}function j$(e){return typeof e==`function`?e():e}function M$(e,t){return t||e===`click`||e===`mousedown`}function bde(e){return e?.includes(`mouse`)&&e!==`mousedown`}var N$=A.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new p$,currentIdRef:{current:null},currentContextRef:{current:null}});function xde(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=A.useRef(n),a=A.useRef(n),o=A.useRef(null),s=A.useRef(null),c=m$();return(0,N.jsx)(N$.Provider,{value:A.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function Sde(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=A.useContext(N$),[f,p]=A.useState(!1);return bQ(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),bQ(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:A$(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,e$(_Z))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),bQ(()=>()=>{l.current=null},[l]),A.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function P$(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function F$(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function I$(e){let t=_X(Cde,e).current;return t.next=e,bQ(t.effect),t}function Cde(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function L$(e){return e?.ownerDocument||document}var R$={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},z$={...R$,position:`fixed`,top:0,left:0},B$={...R$,position:`absolute`},V$=A.forwardRef(function(e,t){let[n,r]=A.useState();bQ(()=>{PQ&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,N.jsx)(`span`,{...e,ref:t,style:z$,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),wde=[`top`,`right`,`bottom`,`left`],H$=Math.min,U$=Math.max,W$=Math.round,G$=Math.floor,K$=e=>({x:e,y:e}),Tde={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function q$(e,t,n){return U$(e,H$(t,n))}function J$(e,t){return typeof e==`function`?e(t):e}function Y$(e){return e.split(`-`)[0]}function X$(e){return e.split(`-`)[1]}function Z$(e){return e===`x`?`y`:`x`}function Q$(e){return e===`y`?`height`:`width`}function $$(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function e1(e){return Z$($$(e))}function Ede(e,t,n){n===void 0&&(n=!1);let r=X$(e),i=e1(e),a=Q$(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=i1(o)),[o,i1(o)]}function Dde(e){let t=i1(e);return[t1(e),t,t1(t)]}function t1(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var n1=[`left`,`right`],r1=[`right`,`left`],Ode=[`top`,`bottom`],kde=[`bottom`,`top`];function Ade(e,t,n){switch(e){case`top`:case`bottom`:return n?t?r1:n1:t?n1:r1;case`left`:case`right`:return t?Ode:kde;default:return[]}}function jde(e,t,n,r){let i=X$(e),a=Ade(Y$(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(t1)))),a}function i1(e){let t=Y$(e);return Tde[t]+e.slice(t.length)}function Mde(e){return{top:0,right:0,bottom:0,left:0,...e}}function a1(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Mde(e)}function o1(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function s1(e,t,n){return Math.floor(e/t)!==n}function c1(e,t){return t<0||t>=e.length}function l1(e,t){return d1(e.current,{disabledIndices:t})}function u1(e,t){return d1(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function d1(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&g1(e,a,r));return a}function f1(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!g1(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=G$(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!g1(e,r,s))return r}};d&&h$(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=d1(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=d1(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}c1(e,f)&&(f=u)}if(n===`both`){let n=G$(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&h$(t),u%o===o-1?r&&(f=d1(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=d1(e,{startingIndex:u,disabledIndices:s}),r&&s1(f,o,n)&&(f=d1(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),s1(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&h$(t),u%o===0?r&&(f=d1(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=d1(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&s1(f,o,n)&&(f=d1(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),s1(f,o,n)&&(f=u));let c=G$(l/o)===n;c1(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:d1(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function p1(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function m1(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function h1(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function g1(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?_1(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Nde(e){return e.visibility===`hidden`||e.visibility===`collapse`}function _1(e,t=e?cQ(e):null){return!e||!e.isConnected||!t||Nde(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Pde=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Fde(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return XZ(n)?n.host:null}function v1(e){for(let t of Array.from(e.children))if(WZ(t)===`summary`)return t;return null}function Ide(e,t){let n=v1(t);return!!n&&(e===n||S$(n,e))}function y1(e){let t=e?WZ(e):``;return e!=null&&e.matches(Pde)&&(t!==`summary`||e.parentElement!=null&&WZ(e.parentElement)===`details`&&v1(e.parentElement)===e)&&(t!==`details`||v1(e)==null)&&(t!==`input`||e.type!==`hidden`)}function b1(e){if(!y1(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Fde(t)){let n=t!==e,r=WZ(t)===`slot`;if(t.hasAttribute(`inert`)||n&&WZ(t)===`details`&&!t.open&&!Ide(e,t)||t.hasAttribute(`hidden`)||!r&&!Lde(t,n))return!1}return!0}function Lde(e,t){let n=cQ(e);return t?n.display!==`none`:_1(e,n)}function x1(e){let t=e.tabIndex;if(t<0){let t=WZ(e);if(t===`details`||t===`audio`||t===`video`||YZ(e)&&e.isContentEditable)return 0}return t}function S1(e){if(WZ(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Rde(e,t){let n=S1(e);if(!n)return!0;let r=t.find(e=>{let t=S1(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=S1(e);return t?.name===n.name&&t.form===n.form})===n}function C1(e){if(YZ(e)&&WZ(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return YZ(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function w1(e,t){C1(e).forEach(e=>{y1(e)&&t.push(e),w1(e,t)})}function T1(e,t,n){C1(e).forEach(e=>{YZ(e)&&e.matches(t)&&n.push(e),T1(e,t,n)})}function E1(e){return b1(e)&&x1(e)>=0}function D1(e){let t=[];return w1(e,t),t.filter(b1)}function O1(e){let t=D1(e);return t.filter(e=>x1(e)>=0&&Rde(e,t))}function k1(e,t){let n=O1(e),r=n.length;if(r===0)return;let i=x$(L$(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function A1(e){return k1(L$(e).body,1)||e}function j1(e){return k1(L$(e).body,-1)||e}function M1(e,t){if(!e)return null;let n=O1(L$(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function zde(e){return M1(e,1)}function Bde(e){return M1(e,-1)}function N1(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!S$(n,r)}function Vde(e){O1(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function P1(e){let t=[];T1(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function F1(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...F1(e,t.id,n)])}function I1(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function L1(e){return`data-base-ui-${e}`}var R1=0;function z1(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(R1);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),OX;let o=requestAnimationFrame(a);return R1=o,()=>{R1===o&&(cancelAnimationFrame(o),R1=0)}}var B1={inert:new WeakMap,"aria-hidden":new WeakMap},V1=`data-base-ui-inert`,H1={inert:new WeakSet,"aria-hidden":new WeakSet},U1=new WeakMap,W1=0;function Hde(e){return H1[e]}function G1(e){return e?XZ(e)?e.host:G1(e.parentNode):null}var K1=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=G1(t);return e.contains(n)?n:null}).filter(e=>e!=null),q1=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},J1=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{WZ(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function Ude(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=K1(t,e),u=i?K1(t,a):[],d=new Set(u),f=i?J1(t,q1(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=B1[o],n=Hde(o);c=n,s=e;let r=K1(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);J1(t,q1(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(U1.get(e)||0)+1;U1.set(e,t),m.push(e),t===1&&e.setAttribute(V1,``)}),W1+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(U1.get(e)||0)-1;U1.set(e,t),t||e.removeAttribute(V1)}),--W1,W1||(B1.inert=new WeakMap,B1[`aria-hidden`]=new WeakMap,H1.inert=new WeakSet,H1[`aria-hidden`]=new WeakSet,U1=new WeakMap)}}function Y1(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=L$(e[0]).body;return Ude(e,o,n,r,{mark:i,markerIgnoreElements:a})}var Wde={style:{transition:`none`}},Gde=`data-base-ui-click-trigger`,Kde=`data-base-ui-swipe-ignore`,qde=`data-swipe-ignore`,Jde=`[${Kde}]`,Yde=`[${qde}]`,X1={fallbackAxisSide:`none`},Z1={fallbackAxisSide:`end`},Xde={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Q1=A.createContext(null),$1=()=>A.useContext(Q1),Zde=L1(`portal`);function e0(e={}){let{ref:t,container:n,componentProps:r=AX,elementProps:i}=e,a=ZQ(),o=$1()?.portalNode,[s,c]=A.useState(null),[l,u]=A.useState(null),d=_Q(e=>{e!==null&&u(e)}),f=A.useRef(null);bQ(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(qZ(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=YX(`div`,r,{ref:[t,d],props:[{id:a,[Zde]:``},i]});return{portalNode:l,portalSubtree:s&&p?Jp.createPortal(p,s):null}}var t0=A.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=e0({container:o,ref:t,componentProps:e,elementProps:c}),d=A.useRef(null),f=A.useRef(null),p=A.useRef(null),m=A.useRef(null),[h,g]=A.useState(null),_=A.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;A.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&N1(e)&&(e.type===`focusin`?_.current&&=(P1(l),!1):(Vde(l),_.current=!0))}return F$(P$(l,`focusin`,e,!0),P$(l,`focusout`,e,!0))},[l,v]),A.useEffect(()=>{!l||y!==!1||(P1(l),_.current=!1)},[y,l]);let x=A.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,N.jsxs)(A.Fragment,{children:[u,(0,N.jsxs)(Q1.Provider,{value:x,children:[b&&l&&(0,N.jsx)(V$,{"data-type":`outside`,ref:d,onFocus:e=>{N1(e,l)?p.current?.focus():j1(h?h.domReference:null)?.focus()}}),b&&l&&(0,N.jsx)(`span`,{"aria-owns":l.id,style:Xde}),l&&Jp.createPortal(a,l),b&&l&&(0,N.jsx)(V$,{"data-type":`outside`,ref:f,onFocus:e=>{N1(e,l)?m.current?.focus():(A1(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,e$(`focus-out`,e.nativeEvent)))}})]})]})});function n0(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var r0=class{nodesRef={current:[]};events=n0();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},i0=A.createContext(null),a0=A.createContext(null),o0=()=>A.useContext(i0)?.id||null,s0=e=>{let t=A.useContext(a0);return e??t};function c0(e){let t=ZQ(),n=s0(e),r=o0();return bQ(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function l0(e){let{children:t,id:n}=e,r=o0();return(0,N.jsx)(i0.Provider,{value:A.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function u0(e){let{children:t,externalTree:n}=e,r=_X(()=>n??new r0).current;return(0,N.jsx)(a0.Provider,{value:r,children:t})}function Qde(e,t){let n=GZ(C$(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var $de=20,d0=[];function f0(){d0=d0.filter(e=>e.deref()?.isConnected)}function efe(e){f0(),e&&WZ(e)!==`body`&&(d0.push(new WeakRef(e)),d0.length>$de&&(d0=d0.slice(-20)))}function p0(){return f0(),d0[d0.length-1]?.deref()}function tfe(e){return e?E1(e)?e:O1(e)[0]||e:null}function m0(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=D1(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return E1(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function h0(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=_Q(()=>b.current.floatingContext?.nodeId),S=i===!1,C=D$(_)&&S,w=A.useRef([`content`]),T=I$(i),E=I$(a),ee=I$(l),te=s0(p),D=$1(),ne=A.useRef(!1),re=A.useRef(!1),ie=A.useRef(!1),O=A.useRef(null),ae=A.useRef(``),oe=A.useRef(``),k=A.useRef(null),se=A.useRef(null),ce=vX(k,f,D?.beforeInsideRef),le=vX(se,D?.afterInsideRef),ue=m$(),de=m$(),fe=a$(),pe=D!=null,me=k$(v),he=_Q((e=me)=>e?O1(e):[]),ge=_Q(()=>m?.().filter(e=>e!=null)??[]);A.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&S$(me,x$(L$(me)))&&he().length===0&&!C&&h$(e)}return P$(L$(me),`keydown`,e)},[r,me,s,C,he]),A.useEffect(()=>{if(r||!g)return;let e=L$(me);function t(){ie.current=!1}function n(e){let t=C$(e),n=ge(),r=S$(v,t)||S$(_,t)||S$(D?.portalNode,t)||n.some(e=>e===t||S$(e,t));ie.current=!r,oe.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(re.current=!0)}function i(){oe.current=`keyboard`}return F$(P$(e,`pointerdown`,n,!0),P$(e,`pointerup`,t,!0),P$(e,`pointercancel`,t,!0),P$(e,`keydown`,i,!0))},[r,v,_,me,g,D,ge]),A.useEffect(()=>{if(r||!c)return;let e=L$(me);function t(){re.current=!0,de.start(0,()=>{re.current=!1})}function n(e){let t=C$(e);E1(t)&&(O.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=C$(t);queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=ge(),f=n?.hasAttribute(L1(`focus-guard`))&&[k.current,se.current,D?.beforeInsideRef.current,D?.afterInsideRef.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,s$(d),s$(u)].includes(n),p=!(S$(_,n)||S$(v,n)||S$(n,v)||S$(D?.portalNode,n)||l.some(e=>e===n||S$(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>S$(e,n))||f||te&&(F1(te.nodesRef.current,a).find(e=>S$(e.context?.elements.floating,n)||S$(e.context?.elements.domReference,n))||I1(te.nodesRef.current,a).find(e=>[e.context?.elements.floating,k$(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&me&&m0(me,w),o&&r!==_&&!_1(i)&&x$(e)===e.body){if(YZ(me)&&(me.focus(),o===`popup`)){fe.request(()=>{me.focus()});return}let e=he(),t=O.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||me;YZ(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!re.current&&(C||n!==p0())&&(ne.current=!0,h.setOpen(!1,e$(MZ,t)))})}function a(){ie.current||(b.current.insideReactTree=!0,ue.start(0,()=>{b.current.insideReactTree=!1}))}let l=YZ(_)?_:null;if(!(!v&&!l))return F$(l&&P$(l,`focusout`,i),l&&P$(l,`pointerdown`,t),v&&P$(v,`focusin`,n),v&&P$(v,`focusout`,i),v&&D&&P$(v,`focusout`,a,!0))},[r,_,v,me,s,te,D,h,c,o,he,C,x,w,b,ue,de,fe,u,d,ge]),A.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(D?.portalNode?.querySelectorAll(`[${L1(`portal`)}]`)||[]),t=(te?I1(te.nodesRef.current,x()):[]).find(e=>D$(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Y1([v,...e,k.current,se.current,D?.beforeOutsideRef.current,D?.afterOutsideRef.current,...ge(),t,s$(d),s$(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=Y1([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,D,C,te,x,u,d,ge]),bQ(()=>{if(!g||r||!YZ(me))return;let e=L$(me),t=x$(e);queueMicrotask(()=>{let n=T.current,r=typeof n==`function`?n(ee.current||``):n;if(r===void 0||r===!1||S$(me,t))return;let i=null,a=()=>(i??=he(me),i[0]||me),o;o=r===!0||r===null?a():s$(r),o||=a();let s=S$(me,x$(e));z1(o,{preventScroll:o===me,shouldFocus(){if(s)return!0;let t=x$(e);return!(t!==o&&S$(me,t))}})})},[r,g,me,he,T,ee]),bQ(()=>{if(r||!me)return;let e=L$(me);efe(x$(e));function t(e){if(e.open||(ae.current=Qde(e.nativeEvent,oe.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(ne.current=!0),e.reason===`outside-press`)if(e.nested)ne.current=!1;else if(g$(e.nativeEvent)||_$(e.nativeEvent))ne.current=!1;else{let e=!1;L$(me).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?ne.current=!1:ne.current=!0}}y.on(`openchange`,t);function n(){let e=E.current,t=typeof e==`function`?e(ae.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return _?.isConnected?_:p0()||null;let n=_?.isConnected?_:p0();return s$(t)||n||null}return()=>{y.off(`openchange`,t);let r=x$(e),i=ge(),a=S$(v,r)||i.some(e=>e===r||S$(e,r))||te&&F1(te.nodesRef.current,x(),!1).some(e=>S$(e.context?.elements.floating,r)),o=E.current,s=n();queueMicrotask(()=>{let t=tfe(s),n=typeof o!=`boolean`;o&&!ne.current&&YZ(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),ne.current=!1})}},[r,v,me,E,y,te,_,x,ge]),bQ(()=>{if(!jQ||g||!v)return;let e=x$(L$(v));!YZ(e)||!E$(e)||S$(v,e)&&e.blur()},[g,v]),bQ(()=>{if(!(r||!D))return D.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{D.setFocusManagerState(null)}},[r,D,s,g,h,c,_]),bQ(()=>{if(!(r||!me))return m0(me,w),()=>{queueMicrotask(f0)}},[r,me,w]);let _e=!r&&(s?!C:!0)&&(pe||s);return(0,N.jsxs)(A.Fragment,{children:[_e&&(0,N.jsx)(V$,{"data-type":`inside`,ref:ce,onFocus:e=>{if(s){let e=he();z1(e[e.length-1])}else D?.portalNode&&(ne.current=!1,N1(e,D.portalNode)?A1(_)?.focus():s$(d??D.beforeOutsideRef)?.focus())}}),n,_e&&(0,N.jsx)(V$,{"data-type":`inside`,ref:le,onFocus:e=>{s?z1(he()[0]):D?.portalNode&&(c&&(ne.current=!0),N1(e,D.portalNode)?j1(_)?.focus():s$(u??D.afterOutsideRef)?.focus())}})]})}function g0(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=vZ}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=A.useRef(void 0),f=a$(),p=m$(),m=A.useMemo(()=>{function e(e,t,n,r){let i=e$(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||v$(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=C$(o);if(E$(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}v$(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return A.useMemo(()=>n?{reference:m}:AX,[n,m])}function nfe(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function _0(e){return e!=null&&e.clientX!=null}function rfe(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=A.useRef(!1),u=A.useRef(null),[d,f]=A.useState(),[p,m]=A.useState([]),h=_Q(e=>{i.set(`positionReference`,e)}),g=_Q((e,t,n)=>{l.current||c.current.openEvent&&!_0(c.current.openEvent)||i.set(`positionReference`,nfe(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=_Q(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=v$(d)?o:a;A.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=GZ(o);function r(t){let n=C$(t);S$(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||_0(c.current.openEvent)?u.current=P$(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),A.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),A.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),A.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=A.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return A.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}var ife={intentional:`onClick`,sloppy:`onPointerDown`};function afe(){return!1}function ofe(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function v0(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=afe,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=u.useState(`floatingElement`),{dataRef:p}=u.context,m=s0(l),h=_Q(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,v=_Q(()=>a),{escapeKey:y,outsidePress:b}=ofe(c),x=A.useRef(!1),S=A.useRef(!1),C=A.useRef(!1),w=A.useRef(!1),T=A.useRef(``),E=A.useRef(null),ee=m$(),te=m$(),D=_Q(()=>{te.clear(),p.current.insideReactTree=!1}),ne=_Q(e=>{let t=p.current.floatingContext?.nodeId;return(m?F1(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),re=_Q(e=>T$(e,u.select(`floatingElement`))||T$(e,u.select(`domReferenceElement`))),ie=_Q(e=>{o()&&u.setOpen(!1,e$(vZ,e.nativeEvent))}),O=_Q(e=>{if(!d||!n||!r||e.key!==`Escape`||w.current||!y&&ne(`__escapeKeyBubbles`))return;let t=e$(NZ,dde(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!y&&!t.isPropagationAllowed&&e.stopPropagation()}),ae=_Q(()=>{p.current.insideReactTree=!0,te.start(0,D)}),oe=_Q(e=>{if(!d||!n||e.button!==0)return;let t=C$(e.nativeEvent);S$(u.select(`floatingElement`),t)&&(x.current||(x.current=!0,S.current=!1))}),k=_Q(e=>{!d||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&x.current&&(S.current=!0)});A.useEffect(()=>{if(!d||!n)return;p.current.__escapeKeyBubbles=y,p.current.__outsidePressBubbles=b;let e=new p$,t=new p$;function i(){e.clear(),w.current=!0}function a(){e.start(oQ()?5:0,()=>{w.current=!1})}function o(){C.current=!0,t.start(0,()=>{C.current=!1})}function s(){x.current=!1,S.current=!1}function c(){let e=T.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=p.current.floatingContext?.nodeId,n=m&&F1(m.nodesRef.current,t).some(t=>T$(e,t.context?.elements.floating));return re(e)||n}function te(e){if(l(e)){e.type!==`click`&&!re(e)&&(t.clear(),C.current=!1),D();return}if(p.current.insideReactTree){D();return}let n=C$(e),r=`[${L1(`inert`)}]`,i=JZ(n)?n.getRootNode():null,a=Array.from((XZ(i)?i:L$(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>S$(e,n))))return;let s=JZ(n)?n:null;for(;s&&!sQ(s);){let e=uQ(s);if(sQ(e)||!JZ(e))break;s=e}if(!(a.length&&JZ(n)&&!_de(n)&&!S$(n,u.select(`floatingElement`))&&a.every(e=>!S$(s,e)))){if(YZ(n)&&!(`touches`in e)){let t=sQ(n),r=cQ(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!h(e)){if(c()===`intentional`&&C.current){t.clear(),C.current=!1;return}typeof g==`function`&&!g(e)||ne(`__outsidePressBubbles`)||(u.setOpen(!1,e$(xZ,e)),D())}}}function ie(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||re(e)||te(e)}function ae(e){if(c()!==`sloppy`||!u.select(`open`)||!n||re(e))return;let t=e.touches[0];t&&(E.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ee.start(1e3,()=>{E.current&&(E.current.dismissOnTouchEnd=!1,E.current.dismissOnMouseDown=!1)}))}function oe(e,t){let n=C$(e);if(!n)return;let r=P$(n,e.type,()=>{t(e),r()})}function k(e){T.current=`touch`,oe(e,ae)}function se(e){ee.clear(),e.type===`pointerdown`&&(T.current=e.pointerType),!(e.type===`mousedown`&&E.current&&!E.current.dismissOnMouseDown)&&oe(e,e=>{e.type===`pointerdown`?ie(e):te(e)})}function ce(e){if(!x.current)return;let n=S.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!h(e)){if(n){o();return}typeof g==`function`&&!g(e)||(t.clear(),C.current=!0,D())}}}function le(e){if(c()!==`sloppy`||!E.current||re(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-E.current.startX),r=Math.abs(t.clientY-E.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(E.current.dismissOnTouchEnd=!0),i>10&&(te(e),ee.clear(),E.current=null)}function ue(e){oe(e,le)}function de(e){c()!==`sloppy`||!E.current||re(e)||(E.current.dismissOnTouchEnd&&te(e),ee.clear(),E.current=null)}function A(e){oe(e,de)}let fe=L$(f),pe=F$(r&&F$(P$(fe,`keydown`,O),P$(fe,`compositionstart`,i),P$(fe,`compositionend`,a)),_&&F$(P$(fe,`click`,se,!0),P$(fe,`pointerdown`,se,!0),P$(fe,`pointerup`,ce,!0),P$(fe,`pointercancel`,ce,!0),P$(fe,`mousedown`,se,!0),P$(fe,`mouseup`,ce,!0),P$(fe,`touchstart`,k,!0),P$(fe,`touchmove`,ue,!0),P$(fe,`touchend`,A,!0)));return()=>{pe(),e.clear(),t.clear(),s(),C.current=!1}},[p,f,r,_,g,d,n,y,b,O,D,v,ne,re,m,u,ee]),A.useEffect(D,[g,D]);let se=A.useMemo(()=>({onKeyDown:O,[ife[s]]:ie,...s!==`intentional`&&{onClick:ie}}),[O,ie,s]),ce=A.useMemo(()=>({onKeyDown:O,onPointerDown:k,onMouseDown:k,onClickCapture:ae,onMouseDownCapture(e){ae(),oe(e)},onPointerDownCapture(e){ae(),oe(e)},onMouseUpCapture:ae,onTouchEndCapture:ae,onTouchMoveCapture:ae}),[O,ae,oe,k]);return A.useMemo(()=>n?{reference:se,floating:ce,trigger:se}:{},[n,se,ce])}function y0(e,t,n){let{reference:r,floating:i}=e,a=$$(t),o=e1(t),s=Q$(o),c=Y$(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(X$(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function sfe(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=J$(t,e),p=a1(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=o1(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=o1(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var cfe=50,lfe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:sfe},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=y0(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<cfe&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=y0(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ufe=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=J$(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Y$(r),_=$$(o),v=Y$(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[i1(o)]:Dde(o)),x=p!==`none`;!d&&x&&b.push(...jde(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ede(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==$$(t))||T.every(e=>$$(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=$$(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function b0(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function x0(e){return wde.some(t=>e[t]>=0)}var dfe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=J$(e,t);switch(i){case`referenceHidden`:{let e=b0(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:x0(e)}}}case`escaped`:{let e=b0(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:x0(e)}}}default:return{}}}}},S0=new Set([`left`,`top`]);async function ffe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Y$(n),s=X$(n),c=$$(n)===`y`,l=S0.has(o)?-1:1,u=a&&c?-1:1,d=J$(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var pfe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ffe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},mfe=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=J$(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=$$(Y$(i)),p=Z$(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=q$(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=q$(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},hfe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=J$(e,t),u={x:n,y:r},d=$$(i),f=Z$(d),p=u[f],m=u[d],h=J$(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=S0.has(Y$(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},gfe=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=J$(e,t),u=await o.detectOverflow(t,l),d=Y$(i),f=X$(i),p=$$(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=H$(h-u[g],v),x=H$(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=U$(u.left,0),t=U$(u.right,0),n=U$(u.top,0),r=U$(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:U$(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:U$(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function C0(e){let t=cQ(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=YZ(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=W$(n)!==a||W$(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function w0(e){return JZ(e)?e:e.contextElement}function T0(e){let t=w0(e);if(!YZ(t))return K$(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=C0(t),o=(a?W$(n.width):n.width)/r,s=(a?W$(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var _fe=K$(0);function E0(e){let t=GZ(e);return!oQ()||!t.visualViewport?_fe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vfe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==GZ(e)?!1:t}function D0(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=w0(e),o=K$(1);t&&(r?JZ(r)&&(o=T0(r)):o=T0(e));let s=vfe(a,n,r)?E0(a):K$(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=GZ(a),t=r&&JZ(r)?GZ(r):r,n=e,i=pQ(n);for(;i&&r&&t!==n;){let e=T0(i),t=i.getBoundingClientRect(),r=cQ(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=GZ(i),i=pQ(n)}}return o1({width:u,height:d,x:c,y:l})}function O0(e,t){let n=lQ(e).scrollLeft;return t?t.left+n:D0(KZ(e)).left+n}function k0(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-O0(e,n),y:n.top+t.scrollTop}}function yfe(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=KZ(r),s=t?$Z(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=K$(1),u=K$(0),d=YZ(r);if((d||!d&&!a)&&((WZ(r)!==`body`||ZZ(o))&&(c=lQ(r)),d)){let e=D0(r);l=T0(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?k0(o,c):K$(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bfe(e){return Array.from(e.getClientRects())}function xfe(e){let t=KZ(e),n=lQ(e),r=e.ownerDocument.body,i=U$(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=U$(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+O0(e),s=-n.scrollTop;return cQ(r).direction===`rtl`&&(o+=U$(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var A0=25;function Sfe(e,t){let n=GZ(e),r=KZ(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=oQ();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=O0(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=A0&&(a-=o)}else l<=A0&&(a+=l);return{width:a,height:o,x:s,y:c}}function Cfe(e,t){let n=D0(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=YZ(e)?T0(e):K$(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function j0(e,t,n){let r;if(t===`viewport`)r=Sfe(e,n);else if(t===`document`)r=xfe(KZ(e));else if(JZ(t))r=Cfe(t,n);else{let n=E0(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return o1(r)}function M0(e,t){let n=uQ(e);return n===t||!JZ(n)||sQ(n)?!1:cQ(n).position===`fixed`||M0(n,t)}function wfe(e,t){let n=t.get(e);if(n)return n;let r=fQ(e,[],!1).filter(e=>JZ(e)&&WZ(e)!==`body`),i=null,a=cQ(e).position===`fixed`,o=a?uQ(e):e;for(;JZ(o)&&!sQ(o);){let t=cQ(o),n=iQ(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ZZ(o)&&!n&&M0(e,o))?r=r.filter(e=>e!==o):i=t,o=uQ(o)}return t.set(e,r),r}function Tfe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?$Z(t)?[]:wfe(t,this._c):[].concat(n),r],o=j0(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=j0(t,a[e],i);s=U$(n.top,s),c=H$(n.right,c),l=H$(n.bottom,l),u=U$(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Efe(e){let{width:t,height:n}=C0(e);return{width:t,height:n}}function Dfe(e,t,n){let r=YZ(t),i=KZ(t),a=n===`fixed`,o=D0(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=K$(0);function l(){c.x=O0(i)}if(r||!r&&!a)if((WZ(t)!==`body`||ZZ(i))&&(s=lQ(t)),r){let e=D0(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?k0(i,s):K$(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function N0(e){return cQ(e).position===`static`}function P0(e,t){if(!YZ(e)||cQ(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return KZ(e)===n&&(n=n.ownerDocument.body),n}function F0(e,t){let n=GZ(e);if($Z(e))return n;if(!YZ(e)){let t=uQ(e);for(;t&&!sQ(t);){if(JZ(t)&&!N0(t))return t;t=uQ(t)}return n}let r=P0(e,t);for(;r&&QZ(r)&&N0(r);)r=P0(r,t);return r&&sQ(r)&&N0(r)&&!iQ(r)?n:r||aQ(e)||n}var Ofe=async function(e){let t=this.getOffsetParent||F0,n=this.getDimensions,r=await n(e.floating);return{reference:Dfe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kfe(e){return cQ(e).direction===`rtl`}var I0={convertOffsetParentRelativeRectToViewportRelativeRect:yfe,getDocumentElement:KZ,getClippingRect:Tfe,getOffsetParent:F0,getElementRects:Ofe,getClientRects:bfe,getDimensions:Efe,getScale:T0,isElement:JZ,isRTL:kfe};function L0(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Afe(e,t){let n=null,r,i=KZ(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=G$(d),h=G$(i.clientWidth-(u+f)),g=G$(i.clientHeight-(d+p)),_=G$(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:U$(0,H$(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!L0(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function R0(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=w0(e),u=i||a?[...l?fQ(l):[],...t?fQ(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Afe(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?D0(e):null;c&&g();function g(){let t=D0(e);h&&!L0(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var jfe=pfe,Mfe=mfe,Nfe=ufe,Pfe=gfe,Ffe=dfe,Ife=hfe,Lfe=(e,t,n)=>{let r=new Map,i={platform:I0,...n},a={...i.platform,_c:r};return lfe(e,t,{...i,platform:a})},z0=typeof document<`u`?A.useLayoutEffect:function(){};function B0(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,i;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(!B0(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!B0(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function V0(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function H0(e,t){let n=V0(e);return Math.round(t*n)/n}function U0(e){let t=A.useRef(e);return z0(()=>{t.current=e}),t}function Rfe(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=A.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=A.useState(r);B0(f,r)||p(r);let[m,h]=A.useState(null),[g,_]=A.useState(null),v=A.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=A.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=A.useRef(null),C=A.useRef(null),w=A.useRef(u),T=c!=null,E=U0(c),ee=U0(i),te=U0(l),D=A.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};ee.current&&(e.platform=ee.current),Lfe(S.current,C.current,e).then(e=>{let t={...e,isPositioned:te.current!==!1};ne.current&&!B0(w.current,t)&&(w.current=t,Jp.flushSync(()=>{d(t)}))})},[f,t,n,ee,te]);z0(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ne=A.useRef(!1);z0(()=>(ne.current=!0,()=>{ne.current=!1}),[]),z0(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,D);D()}},[b,x,D,E,T]);let re=A.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),ie=A.useMemo(()=>({reference:b,floating:x}),[b,x]),O=A.useMemo(()=>{let e={position:n,left:0,top:0};if(!ie.floating)return e;let t=H0(ie.floating,u.x),r=H0(ie.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...V0(ie.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,ie.floating,u.x,u.y]);return A.useMemo(()=>({...u,update:D,refs:re,elements:ie,floatingStyles:O}),[u,D,re,ie,O])}var zfe=(e,t)=>{let n=jfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Bfe=(e,t)=>{let n=Mfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vfe=(e,t)=>({fn:Ife(e).fn,options:[e,t]}),Hfe=(e,t)=>{let n=Nfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ufe=(e,t)=>{let n=Pfe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wfe=(e,t)=>{let n=Ffe(e);return{name:n.name,fn:n.fn,options:[e,t]}},W0=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(dX(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},G0=[],K0=void 0;function Gfe(){return K0}function Kfe(e){G0.push(e)}function q0(e){let t=(t,n)=>{let r=_X(qfe).current,i;try{K0=r;for(let e of G0)e.before(r);i=e(t,n);for(let e of G0)e.after(r);r.didInitialize=!0}finally{K0=void 0}return i};return t.displayName=e.displayName||e.name,t}function J0(e){return A.forwardRef(q0(e))}function qfe(){return{didInitialize:!1}}var Jfe=TX(19)?Xfe:Zfe;function Y0(e,t,n,r,i){return Jfe(e,t,n,r,i)}function Yfe(e,t,n,r,i){let a=A.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Yp.useSyncExternalStore)(e.subscribe,a,a)}Kfe({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Yp.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Xfe(e,t,n,r,i){let a=Gfe();if(!a)return Yfe(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function Zfe(e,t,n,r,i){return(0,be.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var X0=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Y0(this,e,t,n,r)}},Z0=class extends X0{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){A.useDebugValue(e);let n=this;bQ(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;bQ(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;bQ(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){A.useDebugValue(e);let n=this,r=t!==void 0;bQ(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return A.useDebugValue(e),Y0(this,this.selectors[e],t,n,r)}useContextCallback(e,t){A.useDebugValue(e);let n=_Q(t??OX);this.context[e]=n}useStateSetter(e){let t=A.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},Qfe={open:W0(e=>e.open),transitionStatus:W0(e=>e.transitionStatus),domReferenceElement:W0(e=>e.domReferenceElement),referenceElement:W0(e=>e.positionReference??e.referenceElement),floatingElement:W0(e=>e.floatingElement),floatingId:W0(e=>e.floatingId)},Q0=class extends Z0{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:n0(),nested:n,triggerElements:i},Qfe),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&fde(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function $0(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=A.useRef(null);r===void 0&&f.current===null&&(f.current=new Q0({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),bQ(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};JZ(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}var e2={tabIndex:-1,[pde]:``};function t2(e,t,n=!1){let r=ZQ(),i=o0()!=null,a=A.useRef(null);e===void 0&&a.current===null&&(a.current=t(r,i));let o=e??a.current;return $0({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:o.setOpen}),{store:o,internalStore:a.current}}function n2(e,t){let n=A.useRef(null),r=A.useRef(null);return A.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function r2(e,t,n){let r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function i2(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=n2(e,n),o=_Q(t=>{if(a(t),!t)return;let i=n.select(`open`),o=n.select(`activeTriggerId`);if(o===e){n.update({activeTriggerElement:t,...i?r:null});return}o==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return bQ(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function a2(e){let t=e.useState(`open`);bQ(()=>{if(!t){e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let n=e.context.triggerElements.size,r={};if(e.state.triggerCount!==n&&(r.triggerCount=n),!e.select(`activeTriggerId`)&&n===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;r.activeTriggerId=e,r.activeTriggerElement=n}}(r.triggerCount!==void 0||r.activeTriggerId!==void 0)&&e.update(r)},[t,e,e.useState(`triggerCount`)])}function o2(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=o$(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=_Q(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),s=t.useState(`preventUnmountingOnClose`);return l$({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}function s2(e,t){e.useSyncedValues(t),bQ(()=>()=>{e.update({activeTriggerProps:AX,inactiveTriggerProps:AX,popupProps:AX})},[e])}function $fe(e,t){bQ(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),bQ(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var c2=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function epe(){return new Q0({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new c2,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function l2(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:epe(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:AX,inactiveTriggerProps:AX,popupProps:AX}}function u2(e,t,n=!1){return new Q0({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var d2=W0(e=>e.triggerIdProp??e.activeTriggerId),f2=W0(e=>e.openProp??e.open),p2=W0(e=>(e.popupElement?.id??e.floatingId)||void 0);function m2(e,t){return t!==void 0&&f2(e)&&d2(e)===t}function tpe(e,t){return m2(e,t)?!0:t!==void 0&&f2(e)&&d2(e)==null&&e.triggerCount===1}var h2={open:f2,mounted:W0(e=>e.mounted),transitionStatus:W0(e=>e.transitionStatus),floatingRootContext:W0(e=>e.floatingRootContext),triggerCount:W0(e=>e.triggerCount),preventUnmountingOnClose:W0(e=>e.preventUnmountingOnClose),payload:W0(e=>e.payload),activeTriggerId:d2,activeTriggerElement:W0(e=>e.mounted?e.activeTriggerElement:null),popupId:p2,isTriggerActive:W0((e,t)=>t!==void 0&&d2(e)===t),isOpenedByTrigger:W0((e,t)=>m2(e,t)),isMountedByTrigger:W0((e,t)=>t!==void 0&&d2(e)===t&&e.mounted),triggerProps:W0((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:W0((e,t)=>tpe(e,t)?p2(e):void 0),popupProps:W0(e=>e.popupProps),popupElement:W0(e=>e.popupElement),positionerElement:W0(e=>e.positionerElement)};function g2(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=ZQ(),a=o0()!=null,o=_X(()=>new Q0({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new c2,floatingId:i,syncOnly:!1,nested:a})).current;return bQ(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=JZ(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function npe(e={}){let{nodeId:t,externalTree:n}=e,r=g2(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=A.useState(null),[f,p]=A.useState(void 0),[m,h]=A.useState(void 0),g=A.useRef(null),_=s0(n),v=A.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),y=Rfe({...e,elements:{...v,...u&&{reference:u}}}),b=JZ(f)?f:null,x=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:b),i.useSyncedValue(`floatingElement`,x);let S=A.useCallback(e=>{let t=JZ(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),y.refs.setReference(t)},[y.refs]),C=A.useCallback(e=>{(JZ(e)||e===null)&&(g.current=e,p(e)),(JZ(y.refs.reference.current)||y.refs.reference.current===null||e!==null&&!JZ(e))&&y.refs.setReference(e)},[y.refs,p]),w=A.useCallback(e=>{h(e),y.refs.setFloating(e)},[y.refs]),T=A.useMemo(()=>({...y.refs,setReference:C,setFloating:w,setPositionReference:S,domReference:g}),[y.refs,C,w,S]),E=A.useMemo(()=>({...y.elements,domReference:s}),[y.elements,s]),ee=A.useMemo(()=>({...y,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:T,elements:E,nodeId:t,rootStore:i}),[y,T,E,t,i,c,l]);return bQ(()=>{s&&(g.current=s)},[s]),bQ(()=>{i.context.dataRef.current.floatingContext=ee;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=ee)}),A.useMemo(()=>({...y,context:ee,refs:T,elements:E,rootStore:i}),[y,T,E,ee,i])}var _2=IQ&&PQ;function v2(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=A.useRef(!1),c=A.useRef(null),l=A.useRef(!0),u=m$();A.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=GZ(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&YZ(e)&&e===x$(L$(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return F$(P$(t,`blur`,r),_2&&P$(t,`keydown`,a,!0),_2&&P$(t,`pointerdown`,o,!0))},[i,n]),A.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);JZ(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=A.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=C$(t.nativeEvent);if(JZ(a)){if(_2&&!t.relatedTarget){if(!l.current&&!E$(a))return}else if(!O$(a))return}let o=w$(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,e$(bZ,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,e$(bZ,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=JZ(n)&&n.hasAttribute(L1(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=x$(L$(e));!n&&t===e||S$(o.current.floatingContext?.refs.floating.current,t)||S$(e,t)||a||w$(n??t,i.context.triggerElements)||i.setOpen(!1,e$(bZ,r))})}}},[o,r,i,u]);return A.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var rpe=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new p$,this.restTimeout=new p$,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},y2=new WeakMap;function b2(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&y2.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),y2.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function x2(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=y2.get(n);a&&a!==e&&b2(a),b2(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,y2.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function S2(e){let t=e.context.dataRef.current,n=_X(()=>t.hoverInteractionState??rpe.create()).current;return t.hoverInteractionState||=n,t$(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function C2(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=s0(),d=o0(),f=S2(a),p=m$(),m=_Q(()=>M$(l.current.openEvent?.type,f.interactedInside)),h=_Q(()=>bde(l.current.openEvent?.type)),g=_Q(()=>{b2(f)});bQ(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),A.useEffect(()=>g,[g]),bQ(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&JZ(c)&&s){let e=c,t=s,n=L$(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return x2(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),A.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&F1(u.nodesRef.current,d).length>0)}function t(e){let t=A$(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,e$(yZ,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=C$(e);if(!vde(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,_),g()}function h(n){if(e()&&u){u.events.on(`floating.closed`,_);return}if(w$(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&JZ(o)&&F1(u.nodesRef.current,r,!1).some(e=>S$(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),m()||t(n)}}function _(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,_),a.setOpen(!1,e$(yZ,t)),u.events.emit(`floating.closed`,t)})}let v=s;return F$(v&&P$(v,`mouseenter`,c),v&&P$(v,`mouseleave`,h),v&&P$(v,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,_)})},[n,s,a,l,r,i,m,g,f,u,d,p])}var ipe={current:null};function w2(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=ipe,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p}=t,m=`rootStore`in e?e.rootStore:e,{dataRef:h,events:g}=m.context,_=s0(l),v=S2(m),y=A.useRef(!1),b=I$(i),x=I$(r),S=I$(o),C=I$(n),w=I$(p),T=I$(f),E=_Q(()=>M$(h.current.openEvent?.type,v.interactedInside)),ee=_Q(()=>w.current?.()!==!1),te=_Q((e,t,n)=>{let r=m.context.triggerElements;if(r.hasElement(t))return!e||!S$(e,t);if(!JZ(n))return!1;let i=n;return r.hasMatchingElement(e=>S$(e,i))&&(!e||!S$(e,i))}),D=_Q(()=>{v.handler&&=(L$(m.select(`domReferenceElement`)).removeEventListener(`mousemove`,v.handler),void 0)}),ne=_Q(()=>{b2(v)});return u&&(v.handleCloseOptions=b.current?.__options),A.useEffect(()=>D,[D]),A.useEffect(()=>{if(!n)return;function e(e){e.open?y.current=!1:(y.current=e.reason===yZ,D(),v.openChangeTimeout.clear(),v.restTimeout.clear(),v.blockMouseMove=!0,v.restTimeoutPending=!1)}return g.on(`openchange`,e),()=>{g.off(`openchange`,e)}},[n,g,v,D]),A.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=A$(x.current,`close`,v.pointerType);n?v.openChangeTimeout.start(n,()=>{m.setOpen(!1,e$(yZ,e)),_?.events.emit(`floating.closed`,e)}):t&&(v.openChangeTimeout.clear(),m.setOpen(!1,e$(yZ,e)),_?.events.emit(`floating.closed`,e))}let t=c.current??(u?m.select(`domReferenceElement`):null);if(!JZ(t))return;function r(e){if(v.openChangeTimeout.clear(),v.blockMouseMove=!1,a&&!v$(v.pointerType))return;let t=j$(S.current),n=A$(x.current,`open`,v.pointerType),r=C$(e),i=e.currentTarget??null,o=m.select(`domReferenceElement`),s=i;if(JZ(r)&&!m.context.triggerElements.hasElement(r)){for(let e of m.context.triggerElements.elements())if(S$(e,r)){s=e;break}}JZ(i)&&JZ(o)&&!m.context.triggerElements.hasElement(i)&&S$(i,o)&&(s=o);let c=s==null?!1:te(o,s,r),l=m.select(`open`),u=T.current?.()??m.select(`transitionStatus`)===`ending`,d=!l&&u&&y.current,f=!c&&JZ(s)&&JZ(o)&&S$(o,s)&&d,p=t>0&&!n,h=c&&(l||d)||f,g=!l||c;if(h){ee()&&m.setOpen(!0,e$(yZ,e,s));return}p||(n?v.openChangeTimeout.start(n,()=>{g&&ee()&&m.setOpen(!0,e$(yZ,e,s))}):g&&ee()&&m.setOpen(!0,e$(yZ,e,s)))}function i(t){if(E()){ne();return}D();let n=L$(m.select(`domReferenceElement`));v.restTimeout.clear(),v.restTimeoutPending=!1;let r=h.current.floatingContext??d?.();if(!w$(t.relatedTarget,m.context.triggerElements)){if(b.current&&r){m.select(`open`)||v.openChangeTimeout.clear();let i=c.current;v.handler=b.current({...r,tree:_,x:t.clientX,y:t.clientY,onClose(){ne(),D(),C.current&&!E()&&i===m.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,v.handler),v.handler(t);return}(v.pointerType!==`touch`||!S$(m.select(`floatingElement`),t.relatedTarget))&&e(t)}}return s?F$(P$(t,`mousemove`,r,{once:!0}),P$(t,`mouseenter`,r),P$(t,`mouseleave`,i)):F$(P$(t,`mouseenter`,r),P$(t,`mouseleave`,i))},[D,ne,h,x,m,n,b,v,u,te,E,a,s,S,c,_,C,d,T,ee]),A.useMemo(()=>{if(!n)return;function e(e){v.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=m.select(`domReferenceElement`),i=m.select(`open`),o=te(r,n,e.target);if(a&&!v$(v.pointerType))return;if(i&&o&&v.handleCloseOptions?.blockPointerEvents){let e=m.select(`floatingElement`);if(e){let t=v.handleCloseOptions?.getScope?.()??n.ownerDocument.body;x2(v,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=j$(S.current);if(i&&!o||s===0||!o&&v.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;v.restTimeout.clear();function c(){if(v.restTimeoutPending=!1,E())return;let e=m.select(`open`);!v.blockMouseMove&&(!e||o)&&ee()&&m.setOpen(!0,e$(yZ,t,n))}v.pointerType===`touch`?Jp.flushSync(()=>{c()}):o&&i?c():(v.restTimeoutPending=!0,v.restTimeout.start(s,c))}}},[n,v,E,te,a,m,S,ee])}var ape=`Escape`;function T2(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function E2(e,t){return T2(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function D2(e,t,n){return T2(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ope(e,t,n){return T2(t,n?e===y$:e===b$,e===gde)}function spe(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ape:T2(t,n?e===b$:e===y$,e===hde)}function O2(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,cols:v=1,id:y,resetOnPointerLeave:b=!0,externalTree:x}=t,S=`rootStore`in e?e.rootStore:e,C=S.useState(`open`),w=S.useState(`floatingElement`),T=S.useState(`domReferenceElement`),E=S.context.dataRef,ee=k$(w),te=D$(T),D=I$(ee),ne=o0(),re=s0(x),ie=A.useRef(f),O=A.useRef(o??-1),ae=A.useRef(null),oe=A.useRef(!0),k=_Q(e=>{i(O.current===-1?null:O.current,e)}),se=A.useRef(k),ce=A.useRef(!!w),le=A.useRef(C),ue=A.useRef(!1),de=A.useRef(!1),fe=A.useRef(null),pe=I$(h),me=I$(C),he=I$(o),ge=I$(b),_e=a$(),ve=a$(),ye=_Q(()=>{function e(e){d?re?.events.emit(`virtualfocus`,e):fe.current=z1(e,{sync:ue.current,preventScroll:!0})}let t=n.current[O.current],r=de.current;t&&e(t),(ue.current?e=>e():e=>_e.request(e))(()=>{let i=n.current[O.current]||t;i&&(t||e(i),Te&&(r||!oe.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});bQ(()=>{E.current.orientation=g},[E,g]),bQ(()=>{a&&(C&&w?(O.current=o??-1,ie.current&&o!=null&&(de.current=!0,k())):ce.current&&(O.current=-1,se.current()))},[a,C,w,o,k]),bQ(()=>{if(a){if(!C){ue.current=!1;return}if(w)if(r==null){if(ue.current=!1,he.current!=null)return;if(ce.current&&(O.current=-1,ye()),(!le.current||!ce.current)&&ie.current&&(ae.current!=null||ie.current===!0&&ae.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ve.request(e):queueMicrotask)(t),e+=1):(O.current=ae.current==null||D2(ae.current,g,u)||l?l1(n):u1(n),ae.current=null,k())};t()}}else c1(n.current,r)||(O.current=r,ye(),de.current=!1)}},[a,C,w,r,he,l,n,g,u,k,ye,ve]),bQ(()=>{if(!a||w||!re||d||!ce.current)return;let e=re.nodesRef.current,t=e.find(e=>e.id===ne)?.context?.elements.floating,n=x$(L$(w)),r=e.some(e=>e.context&&S$(e.context.elements.floating,n));t&&!r&&oe.current&&t.focus({preventScroll:!0})},[a,w,re,ne,d]),bQ(()=>{se.current=k,le.current=C,ce.current=!!w}),bQ(()=>{C||(ae.current=null,ie.current=f)},[C,f]);let be=r!=null,xe=_Q(e=>{if(!me.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(O.current!==t||r!==t)&&(O.current=t,k(e))}),Se=_Q(()=>_??re?.nodesRef.current.find(e=>e.id===ne)?.context?.dataRef?.current.orientation),Ce=_Q(()=>l1(n,pe.current)),we=_Q(e=>{if(oe.current=!1,ue.current=!0,e.which===229||!me.current&&e.currentTarget===D.current)return;if(l&&spe(e.key,g,u,v)){E2(e.key,Se())||h$(e),S.setOpen(!1,e$(PZ,e.nativeEvent)),YZ(T)&&(d?re?.events.emit(`virtualfocus`,T):T.focus());return}let t=O.current,r=l1(n,h),i=u1(n,h);if(te||(e.key===`Home`&&(h$(e),O.current=r,k(e)),e.key===`End`&&(h$(e),O.current=i,k(e))),v>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=p1(t,v,!1),o=a.findIndex(e=>e!=null&&!g1(n.current,e,h)),s=a.reduce((e,t,r)=>t!=null&&!g1(n.current,t,h)?r:e,-1),l=a[f1(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:g,loopFocus:c,rtl:u,cols:v,disabledIndices:h1([...(typeof h==`function`?null:h)||n.current.map((e,t)=>g1(n.current,t,h)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:m1(O.current>i?r:O.current,t,a,v,e.key===`ArrowDown`?`bl`:e.key===(u?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(l!=null&&(O.current=l,k(e)),g===`both`)return}if(E2(e.key,g)){if(h$(e),C&&!d&&x$(e.currentTarget.ownerDocument)===e.currentTarget){O.current=D2(e.key,g,u)?r:i,k(e);return}D2(e.key,g,u)?c?t>=i?s&&t!==n.current.length?O.current=-1:(ue.current=!1,O.current=r):O.current=d1(n.current,{startingIndex:t,disabledIndices:h}):O.current=Math.min(i,d1(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?O.current=n.current.length:(ue.current=!1,O.current=i):O.current=d1(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):O.current=Math.max(r,d1(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),c1(n.current,O.current)&&(O.current=-1),k(e)}}),Te=A.useMemo(()=>({onFocus(e){ue.current=!0,xe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){ue.current=!0,de.current=!1,p&&xe(e)},onPointerLeave(e){if(!me.current||!oe.current||e.pointerType===`touch`)return;ue.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&ge.current&&(fe.current?.(),fe.current=null,O.current=-1,k(e),!d)){let e=D.current,t=x$(L$(e));e&&S$(e,t)&&e.focus({preventScroll:!0})}}}),[xe,me,D,p,n,k,ge,d]),Ee=A.useMemo(()=>d&&C&&be&&{"aria-activedescendant":`${y}-${r}`},[d,C,be,y,r]),De=A.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...te?{}:Ee,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&C&&!d){let t=C$(e.nativeEvent);if(t&&!S$(D.current,t))return;h$(e),S.setOpen(!1,e$(MZ,e.nativeEvent)),YZ(T)&&T.focus();return}we(e)},onPointerMove(){oe.current=!0}}),[Ee,we,D,g,te,S,C,d,T]),Oe=A.useMemo(()=>{function e(e){S.setOpen(!0,e$(PZ,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&g$(e.nativeEvent)&&(ie.current=!d)}function n(e){ie.current=f,f===`auto`&&_$(e.nativeEvent)&&(ie.current=!0)}return{onKeyDown(t){let n=S.select(`open`);oe.current=!1;let r=t.key.startsWith(`Arrow`),i=ope(t.key,Se(),u),a=E2(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return we(t);if(!(!n&&!m&&r)){if(o){let e=E2(t.key,Se());ae.current=l&&e?null:t.key}if(l){i&&(h$(t),n?(O.current=Ce(),k(t)):e(t));return}a&&(he.current!=null&&(O.current=he.current),h$(t),!n&&m?e(t):we(t),n&&k(t))}},onFocus(e){S.select(`open`)&&!d&&(O.current=-1,k(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[we,f,Ce,l,k,S,m,g,Se,u,he,d]),ke=A.useMemo(()=>({...Ee,...Oe}),[Ee,Oe]);return A.useMemo(()=>a?{reference:ke,floating:De,item:Te,trigger:Oe}:{},[a,ke,De,Oe,Te])}function k2(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,onTyping:o,enabled:s=!0,resetMs:c=750,selectedIndex:l=null}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=m$(),p=A.useRef(``),m=A.useRef(l??i??-1),h=A.useRef(null),g=_Q(e=>{function t(e){let t=r?.current[e];return!t||_1(t)}function s(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let u=n.current;if(p.current.length>0&&e.key===` `&&(h$(e),o?.(!0)),p.current.length>0&&p.current[0]!==` `&&s(u,p.current)===-1&&e.key!==` `&&o?.(!1),u==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;d&&e.key!==` `&&(h$(e),o?.(!0));let g=p.current===``;g&&(m.current=l??i??-1),u.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&p.current===e.key&&(p.current=``,m.current=h.current),p.current+=e.key,f.start(c,()=>{p.current=``,m.current=h.current,o?.(!1)});let _=((g?l??i??-1:m.current)??0)+1,v=s(u,p.current,_);v===-1?e.key!==` `&&(p.current=``,o?.(!1)):(a?.(v),h.current=v)}),_=_Q(e=>{let t=e.relatedTarget,n=u.select(`domReferenceElement`),r=u.select(`floatingElement`);S$(n,t)||S$(r,t)||(f.clear(),p.current=``,m.current=h.current,o?.(!1))});bQ(()=>{!d&&l!==null||(f.clear(),h.current=null,p.current!==``&&(p.current=``))},[d,l,f]),bQ(()=>{d&&p.current===``&&(m.current=l??i??-1)},[d,l,i]);let v=A.useMemo(()=>({onKeyDown:g,onBlur:_}),[g,_]);return A.useMemo(()=>s?{reference:v,floating:v}:{},[s,v])}var A2=.1,cpe=A2*A2,j2=.5;function M2(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function N2(e,t,n,r,i,a,o,s,c,l){let u=!1;return M2(e,t,n,r,i,a)&&(u=!u),M2(e,t,i,a,o,s)&&(u=!u),M2(e,t,o,s,c,l)&&(u=!u),M2(e,t,c,l,n,r)&&(u=!u),u}function lpe(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function P2(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function F2(e={}){let{blockPointerEvents:t=!1}=e,n=new p$,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*cpe;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=C$(r),g=r.type===`mouseleave`,_=S$(u,h),v=S$(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&JZ(r.relatedTarget)&&S$(u,r.relatedTarget))return;function y(){return!!(s&&F1(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,ee=(T?x:S).left,te=(T?x:S).right,D=(E?x:S).top,ne=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let re=!1;switch(c){case`top`:re=P2(d,f,ee,x.top+1,te,S.bottom-1);break;case`bottom`:re=P2(d,f,ee,S.top+1,te,x.bottom-1);break;case`left`:re=P2(d,f,S.right-1,ne,x.left+1,D);break;case`right`:re=P2(d,f,x.right-1,ne,S.left+1,D);break;default:}if(re)return;if(l&&!lpe(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let ie=!1;switch(c){case`top`:{let n=T?j2/2:j2*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+j2+1,o=C||T?S.bottom-j2:S.top,s=C?T?S.bottom-j2:S.top:S.bottom-j2;ie=N2(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?j2/2:j2*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-j2,o=C||T?S.top+j2:S.bottom,s=C?T?S.top+j2:S.bottom:S.top+j2;ie=N2(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?j2/2:j2*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+j2+1,o=w||E?S.right-j2:S.left,s=w?E?S.right-j2:S.left:S.right-j2;ie=N2(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?j2/2:j2*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-j2,o=w||E?S.left+j2:S.right,s=w?E?S.left+j2:S.right:S.left+j2;ie=N2(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}ie?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var upe=A.createContext(void 0);function I2(e){let t=A.useContext(upe);if(t===void 0&&!e)throw Error(dX(69));return t}var L2=`ArrowUp`,R2=`ArrowDown`,z2=`ArrowLeft`,B2=`ArrowRight`,V2=`Home`,H2=new Set([z2,B2]),dpe=new Set([z2,B2,V2,`End`]),U2=new Set([L2,R2]),fpe=new Set([L2,R2,V2,`End`]),W2=new Set([...H2,...U2]),G2=new Set([...W2,V2,`End`]),K2=`Shift`,ppe=new Set([K2,`Control`,`Alt`,`Meta`]);function mpe(e){return YZ(e)&&e.tagName===`INPUT`}function hpe(e){return!!(mpe(e)&&e.selectionStart!=null||YZ(e)&&e.tagName===`TEXTAREA`)}function gpe(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=q2(e,t,`left`),a=J2(e),o=J2(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=q2(e,t,`top`),r=J2(e),i=J2(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function q2(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function J2(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}function Y2(e){return e===`starting`?Wde:AX}var _pe={...mZ,...iZ},X2=A.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=hX(),{side:c,align:l}=pX(),u=I2(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`activeTriggerElement`),w=s.useState(`hoverEnabled`),T=s.useState(`disabled`),E=_.type===`context-menu`;l$({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),A.useEffect(()=>{function e(e){s.setOpen(!1,e$(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),C2(b,{enabled:w&&!T&&!E&&_.type!==`menubar`,closeDelay:S});let ee=A.useCallback(e=>{s.set(`popupElement`,e)},[s]),te=YX(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,ee],stateAttributesMapping:_pe,props:[p,{onKeyDown(e){u&&G2.has(e.key)&&e.stopPropagation()}},Y2(f),o,{"data-rootownerid":y}]}),D=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(D=!0),(0,N.jsx)(h0,{context:b,modal:E,disabled:!m,returnFocus:a===void 0?D:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:C,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:te})}),Z2=A.createContext(void 0);function vpe(){let e=A.useContext(Z2);if(e===void 0)throw Error(dX(32));return e}var Q2=A.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=hX();return i.useState(`mounted`)||n?(0,N.jsx)(Z2.Provider,{value:n,children:(0,N.jsx)(t0,{ref:t,...r})}):null});function $2(e){return TX(19)?e:e?`true`:void 0}var ype=A.createContext(void 0);function e4(){return A.useContext(ype)?.direction??`ltr`}var bpe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=J$(e,t)||{};if(l==null)return{};let f=a1(u),p={x:n,y:r},m=e1(i),h=Q$(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,ee=Math.min(f[v],E),te=Math.min(f[y],E),D=ee,ne=w-g[h]-te,re=w/2-g[h]/2+T,ie=q$(D,re,ne),O=!c.arrow&&X$(i)!=null&&re!==ie&&a.reference[h]/2-(re<D?ee:te)-g[h]/2<0,ae=O?re<D?re-D:re-ne:0;return{[m]:p[m]+ae,data:{[m]:ie,centerOffset:re-ie-ae,...O&&{alignmentOffset:ae}},reset:O}}}),xpe=(e,t)=>({...bpe(e),options:[e,t]}),Spe={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Wfe().fn(e)).data?.referenceHidden||a}}}},t4={sideX:`left`,sideY:`top`},n4={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=GZ(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:t4};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=L$(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Y$(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:t4.sideX,g=f===`top`?`bottom`:t4.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function r4(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function i4(e,t,n){let{rects:r,placement:i}=e;return{side:r4(t,Y$(i),n),align:X$(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function a4(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:v,adaptiveOrigin:y,lazyFlip:b=!1,externalTree:x}=e,[S,C]=A.useState(null);!h&&S!==null&&C(null);let w=g.side||`flip`,T=g.align||`flip`,E=g.fallbackAxisSide||`end`,ee=typeof t==`function`?t:void 0,te=_Q(ee),D=ee?te:t,ne=I$(t),re=I$(h),ie=e4()===`rtl`,O=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":ie?`left`:`right`,"inline-start":ie?`right`:`left`}[r],ae=a===`center`?O:`${O}-${a}`,oe=c,k=+(r===`bottom`),se=+(r===`top`),ce=+(r===`right`),le=+(r===`left`);typeof oe==`number`?oe={top:oe+k,right:oe+le,bottom:oe+se,left:oe+ce}:oe&&={top:(oe.top||0)+k,right:(oe.right||0)+le,bottom:(oe.bottom||0)+se,left:(oe.left||0)+ce};let ue={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:oe},de=A.useRef(null),fe=I$(i),pe=I$(o),me=typeof i==`function`?0:i,he=typeof o==`function`?0:o,ge=[];f&&ge.push(f),ge.push(zfe(e=>{let t=i4(e,r,ie),n=typeof fe.current==`function`?fe.current(t):fe.current,i=typeof pe.current==`function`?pe.current(t):pe.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[me,he,ie,r]));let _e=T===`none`&&w!==`shift`,ve=!_e&&(l||_||w===`shift`),ye=w===`none`?null:Hfe({...ue,padding:{top:oe.top+1,right:oe.right+1,bottom:oe.bottom+1,left:oe.left+1},mainAxis:!_&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),be=_e?null:Bfe(e=>{let t=L$(e.elements.floating).documentElement;return{...ue,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:ve,limiter:l||_?void 0:Vfe(e=>{if(!de.current)return{};let{width:t,height:n}=de.current.getBoundingClientRect(),r=$$(Y$(e.placement)),i=r===`y`?t:n,a=r===`y`?oe.left+oe.right:oe.top+oe.bottom;return{offset:i/2+a/2}})}},[ue,l,_,oe,T]);w===`shift`||T===`shift`||a===`center`?ge.push(be,ye):ge.push(ye,be),ge.push(Ufe({...ue,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!re.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=GZ(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),xpe(e=>({element:de.current||L$(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=Y$(a),l=$$(c),u=de.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(i4(e,r,ie)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ve&&l===`y`&&b?S:x),{}}},Spe,y),bQ(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let xe=A.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:Se,elements:Ce,x:we,y:Te,middlewareData:Ee,update:De,placement:Oe,context:ke,isPositioned:Ae,floatingStyles:j}=npe({rootContext:m,open:p?h:void 0,placement:ae,middleware:ge,strategy:n,whileElementsMounted:p?void 0:(...e)=>R0(...e,xe),nodeId:v,externalTree:x}),{sideX:je,sideY:Me}=Ee.adaptiveOrigin||t4,Ne=Ae?n:`fixed`,Pe=A.useMemo(()=>{let e=y?{position:Ne,[je]:we,[Me]:Te}:{position:Ne,...j};return Ae||(e.opacity=0),e},[y,Ne,je,we,Me,Te,j,Ae]),Fe=A.useRef(null);bQ(()=>{if(!h)return;let e=ne.current,t=typeof e==`function`?e():e,n=(o4(t)?t.current:t)||null;n!==Fe.current&&(Se.setPositionReference(n),Fe.current=n)},[h,Se,D,ne]),A.useEffect(()=>{if(!h)return;let e=ne.current;typeof e!=`function`&&o4(e)&&e.current!==Fe.current&&(Se.setPositionReference(e.current),Fe.current=e.current)},[h,Se,D,ne]),A.useEffect(()=>{if(p&&h&&Ce.domReference&&Ce.floating)return R0(Ce.domReference,Ce.floating,De,xe)},[p,h,Ce,De,xe]);let Ie=Y$(Oe),Le=r4(r,Ie,ie),Re=X$(Oe)||`center`,ze=!!Ee.hide?.referenceHidden;bQ(()=>{b&&h&&Ae&&C(Ie)},[b,h,Ae,Ie]);let Be=A.useMemo(()=>({position:`absolute`,top:Ee.arrow?.y,left:Ee.arrow?.x}),[Ee.arrow]),Ve=Ee.arrow?.centerOffset!==0;return A.useMemo(()=>({positionerStyles:Pe,arrowStyles:Be,arrowRef:de,arrowUncentered:Ve,side:Le,align:Re,physicalSide:Ie,anchorHidden:ze,refs:Se,context:ke,isPositioned:Ae,update:De}),[Pe,Be,de,Ve,Le,Re,Ie,ze,Se,ke,Ae,De])}function o4(e){return e!=null&&`current`in e}function s4(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=_Q(i),o=A.useRef(0),s=_X(wpe).current,c=_X(Cpe).current,[l,u]=A.useState(0),d=A.useRef(l),f=_Q((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=_Q(e=>{c.delete(e),d.current+=1,u(d.current)}),m=A.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(Tpe).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);bQ(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),bQ(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),bQ(()=>()=>{n.current=[]},[n]),bQ(()=>()=>{r&&(r.current=[])},[r]);let h=_Q(e=>(s.add(e),()=>{s.delete(e)}));bQ(()=>{s.forEach(e=>e(m))},[s,m]);let g=A.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,N.jsx)(WQ.Provider,{value:g,children:t})}function Cpe(){return new Map}function wpe(){return new Set}function Tpe(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var c4=A.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,N.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function l4(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),YX(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Y2(r),i],stateAttributesMapping:mZ})}var u4={},d4={},f4=``;function Epe(e){if(typeof document>`u`)return!1;let t=L$(e);return GZ(t).innerWidth-t.documentElement.clientWidth>0}function Dpe(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=L$(e),n=t.documentElement,r=t.body,i=ZZ(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function Ope(e){let t=L$(e),n=t.documentElement,r=t.body,i=ZZ(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function kpe(e){let t=L$(e),n=t.documentElement,r=t.body,i=GZ(n),a=0,o=0,s=!1,c=i$.create();if(jQ&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,u4={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},f4=n.style.scrollBehavior,d4={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=ZZ(n)?n:r;if(s=Dpe(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,u4),Object.assign(r.style,d4),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=f4)}function d(){u(),c.request(l)}l();let f=P$(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Ape=new class{lockCount=0;restore=null;timeoutLock=p$.create();timeoutUnlock=p$.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=L$(e).documentElement,n=GZ(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=OX;return}let r=MQ||!Epe(e);this.restore=r?Ope(e):kpe(e)}};function p4(e=!0,t=null){bQ(()=>{if(e)return Ape.acquire(t)},[e,t])}var jpe=20;function m4(e,t,n,r){let[i,a]=A.useState(!1);bQ(()=>{if(!e||!t||n==null){a(!1);return}let r=L$(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-jpe)},[e,t,n]),p4(e&&(!t||i),r)}var h4=A.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=X1,style:g,..._}=e,{store:v}=hX(),y=vpe(),b=gZ(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),ee=v.useState(`openMethod`),te=v.useState(`activeTriggerElement`),D=v.useState(`transitionStatus`),ne=v.useState(`positionerElement`),re=v.useState(`instantType`),ie=v.useState(`hasViewport`),O=v.useState(`lastOpenChangeReason`),ae=v.useState(`floatingNodeId`),oe=v.useState(`floatingParentNodeId`),k=S.useState(`domReferenceElement`),se=A.useRef(null),ce=c$(ne,!1,!1),le=n,ue=c,de=l,fe=s,pe=h;x.type===`context-menu`&&(le=n??x.context?.anchor,fe??=`start`,!o&&fe!==`center`&&(de=e.alignOffset??2,ue=e.sideOffset??-5));let me=o,he=fe;x.type===`menu`?(me??=`inline-end`,he??=`start`,pe=e.collisionAvoidance??Z1):x.type===`menubar`&&(me??=`bottom`,he??=`start`);let ge=x.type===`context-menu`,_e=a4({anchor:le,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:me,sideOffset:ue,align:he,alignOffset:de,arrowPadding:ge?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:ae,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:pe,shiftCrossAxis:ge&&!(`side`in pe&&pe.side===`flip`),externalTree:C,adaptiveOrigin:ie?n4:void 0});A.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===ae&&v.set(`hoverEnabled`,!1),e.nodeId!==ae&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,e$(RZ)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,ae]),A.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,e$(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let ve=m$();A.useEffect(()=>{T||ve.clear()},[T,ve]),A.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`)))if(e.target&&te&&te!==e.target){let e=v.select(`closeDelay`);e>0?ve.isStarted()||ve.start(e,()=>{v.setOpen(!1,e$(RZ))}):v.setOpen(!1,e$(RZ))}else ve.clear()}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,te,v,ve]),A.useEffect(()=>{let e={open:T,nodeId:ae,parentNodeId:oe,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,ae,oe]),bQ(()=>{let e=k,t=se.current;if(e&&(se.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return ce(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[k,ce,v]);let ye={open:T,side:_e.side,align:_e.align,anchorHidden:_e.anchorHidden,nested:x.type===`menu`,instant:re},be=x.type===`menubar`&&x.context.modal;m4(T&&(be||E&&O!==`trigger-hover`),ee===`touch`,ne,te);let xe=l4(e,ye,{styles:_e.positionerStyles,transitionStatus:D,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),Se=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&O!==`trigger-hover`||x.type===`menubar`&&x.context.modal),Ce=null;return x.type===`menubar`?Ce=x.context.contentElement:x.type===void 0&&(Ce=te),(0,N.jsxs)(fX.Provider,{value:_e,children:[Se&&(0,N.jsx)(c4,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:$2(!T),cutout:Ce}),(0,N.jsx)(l0,{id:ae,children:(0,N.jsx)(s4,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:xe})})]})}),g4=A.createContext(void 0);function Mpe(){let e=A.useContext(g4);if(e===void 0)throw Error(dX(34));return e}var Npe=A.memo(A.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=A.useState(void 0),[p,m]=HZ({controlled:i,default:a,name:`MenuRadioGroup`}),h=_Q((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=YX(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=A.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,N.jsx)(u$.Provider,{value:f,children:(0,N.jsx)(g4.Provider,{value:_,children:g})})})),Ppe=A.createContext(void 0),Fpe=A.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=qQ({label:a}),p=pX(!0),m=QQ(i),{store:h}=hX(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=Mpe(),x=b||s,S=v===l,{getItemProps:C,itemRef:w}=UQ({closeOnClick:c,disabled:x,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:HQ}),T=A.useMemo(()=>({disabled:x,highlighted:g,checked:S}),[x,g,S]);function E(e){let t=e$(SZ,e.nativeEvent,void 0,{preventUnmountOnClose(){}});y(l,t)}let ee=YX(`div`,e,{state:T,stateAttributesMapping:ade,props:[_,{role:`menuitemradio`,"aria-checked":S,onClick:E},d,C],ref:[w,t,f.ref]});return(0,N.jsx)(Ppe.Provider,{value:T,children:ee})});function _4(e){let t=A.useRef(!0);t.current&&(t.current=!1,e())}var Ipe=A.createContext(null);function v4(e){let t=A.useContext(Ipe);if(t===null&&!e)throw Error(dX(5));return t}function Lpe(e){let t=A.useRef(``),n=A.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:A.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function y4(e,t){let n=A.useRef(e),r=_Q(t);bQ(()=>{n.current!==e&&r(n.current)},[e,r]),bQ(()=>{n.current=e},[e])}function b4(e,t){let{onClick:n,onPointerDown:r}=Lpe(_Q((n,r)=>{(typeof e==`function`?e():e)||t(r||(MQ?`touch`:``))}));return A.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function x4(e){let[t,n]=A.useState(null),r=b4(e,n);return y4(e,t=>{t&&!e&&n(null)}),A.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Rpe={...h2,disabled:W0(e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled),modal:W0(e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0)),openMethod:W0(e=>e.openMethod),allowMouseEnter:W0(e=>e.allowMouseEnter),stickIfOpen:W0(e=>e.stickIfOpen),parent:W0(e=>e.parent),rootId:W0(e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId),activeIndex:W0(e=>e.activeIndex),isActive:W0((e,t)=>e.activeIndex===t),hoverEnabled:W0(e=>e.hoverEnabled),instantType:W0(e=>e.instantType),lastOpenChangeReason:W0(e=>e.openChangeReason),floatingTreeRoot:W0(e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot),floatingNodeId:W0(e=>e.floatingNodeId),floatingParentNodeId:W0(e=>e.floatingParentNodeId),itemProps:W0(e=>e.itemProps),closeDelay:W0(e=>e.closeDelay),hasViewport:W0(e=>e.hasViewport),keyboardEventRelay:W0(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)})},zpe=class e extends Z0{constructor(e){super({...Bpe(),...e},{positionerRef:A.createRef(),popupRef:A.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:A.createRef(),beforeContentFocusGuardRef:A.createRef(),onOpenChangeComplete:void 0,triggerElements:new c2},Rpe),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);t===i&&n===a&&r===o||(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}static useStore(t,n){let r=_X(()=>new e(n)).current;return t??r}unsubscribeParentListener=null};function Bpe(){return{...l2(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new r0,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:AX,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}var S4=A.createContext(void 0);function C4(){return A.useContext(S4)}var w4=q0(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=gZ(!0),_=hX(!0),v=v4(!0),y=C4(),b=A.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=zpe.useStore(f?.store,{open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});_4(()=>{n===void 0&&x.state.open===!1&&a===!0&&x.update({open:!0,activeTriggerId:m})}),x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=ZQ(),C=ZQ(),w=x.useState(`floatingTreeRoot`),T=c0(w),E=o0(),ee=x.useState(`open`),te=x.useState(`activeTriggerElement`),D=x.useState(`positionerElement`),ne=x.useState(`hoverEnabled`),re=x.useState(`disabled`),ie=x.useState(`lastOpenChangeReason`),O=x.useState(`parent`),ae=x.useState(`activeIndex`),oe=x.useState(`payload`),k=x.useState(`floatingParentNodeId`),se=A.useRef(null),ce=A.useRef(O.type!==`context-menu`),le=m$(),ue=A.useRef(!0),de=m$(),fe=k!=null,{openMethod:pe,triggerProps:me}=x4(ee);x.useSyncedValues({disabled:o,modal:O.type===void 0?s:void 0,openMethod:pe,rootId:S}),a2(x);let{forceUnmount:he}=o2(ee,x,()=>{x.update({allowMouseEnter:!1,stickIfOpen:!0})});bQ(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),A.useEffect(()=>{if(ee||(se.current=null),O.type===`context-menu`){if(!ee){le.clear(),ce.current=!1;return}le.start(500,()=>{ce.current=!0})}},[le,ee,O.type]),bQ(()=>{!ee&&!ne&&x.set(`hoverEnabled`,!0)},[ee,ne,x]);let ge=_Q((e,t)=>{let n=t.reason;if(ee===e&&t.trigger===te&&ie===n||(t.preventUnmountOnClose=()=>{x.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&(t.trigger=te??void 0),r?.(e,t),t.isCanceled))return;x.state.floatingRootContext.dispatchOpenChange(e,t);let i=t.event;if(e===!1&&i?.type===`click`&&i.pointerType===`touch`&&!ue.current)return;if(!e&&ae!==null){let e=x.context.itemDomElements.current[ae];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}e&&n===`trigger-focus`?(ue.current=!1,de.start(300,()=>{ue.current=!0})):(ue.current=!0,de.clear());let a=(n===`trigger-press`||n===`item-press`)&&i.detail===0&&i?.isTrusted,o=!e&&(n===`escape-key`||n==null),s={open:e,openChangeReason:n};se.current=t.event??null;let c=t.trigger?.id??null;(c||e)&&(s.activeTriggerId=c,s.activeTriggerElement=t.trigger??null),x.update(s),O.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):a||o?x.set(`instantType`,a?`click`:`dismiss`):x.set(`instantType`,void 0)}),_e=$0({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:ge}),ve=_e.context.events;A.useEffect(()=>{let e=({open:e,eventDetails:t})=>ge(e,t);return ve.on(`setOpen`,e),()=>{ve?.off(`setOpen`,e)}},[ve,ge]);let ye=A.useCallback(()=>{x.setOpen(!1,e$(BZ))},[x]);A.useImperativeHandle(u,()=>({unmount:he,close:ye}),[he,ye]);let be;O.type===`context-menu`&&(be=O.context),A.useImperativeHandle(be?.positionerRef,()=>D,[D]),A.useImperativeHandle(be?.actionsRef,()=>({setOpen:ge}),[ge]);let xe=v0(_e,{enabled:!re,bubbles:{escapeKey:d&&O.type===`menu`},outsidePress(){return O.type!==`context-menu`||se.current?.type===`contextmenu`?!0:ce.current},externalTree:fe?w:void 0}),Se=e4(),Ce=A.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),we=O2(_e,{enabled:!re,listRef:x.context.itemDomElements,activeIndex:ae,nested:O.type!==void 0,loopFocus:c,orientation:l,parentOrientation:O.type===`menubar`?O.context.orientation:void 0,rtl:Se===`rtl`,disabledIndices:kX,onNavigate:Ce,openOnArrowKeyDown:O.type!==`context-menu`,externalTree:fe?w:void 0,focusItemOnHover:h}),Te=A.useCallback(e=>{x.context.typingRef.current=e},[x]),Ee=k2(_e,{listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:ae,resetMs:500,onMatch:e=>{ee&&e!==ae&&x.set(`activeIndex`,e)},onTyping:Te});s2(x,{floatingRootContext:_e,activeTriggerProps:A.useMemo(()=>{let e=FX(Ee.reference,we.reference,xe.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=ee,e},[x,Ee.reference,we.reference,xe.reference,me,ee]),inactiveTriggerProps:A.useMemo(()=>{let e=FX(we.trigger,xe.trigger,me);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[we.trigger,xe.trigger,me]),popupProps:A.useMemo(()=>FX(e2,{id:C,role:`menu`,"aria-labelledby":te?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),O.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Ee.floating,we.floating,xe.floating),[te,C,O.type,x,Ee.floating,we.floating,xe.floating]),itemProps:we.item??AX});let De=A.useMemo(()=>({store:x,parent:b}),[x,b]),Oe=(0,N.jsx)(mX.Provider,{value:De,children:typeof t==`function`?t({payload:oe}):t});return O.type===void 0||O.type===`context-menu`?(0,N.jsx)(u0,{externalTree:w,children:Oe}):Oe});function T4(e){let t=hX().store,n=A.useMemo(()=>({parentMenu:t}),[t]);return(0,N.jsx)(S4.Provider,{value:n,children:(0,N.jsx)(w4,{...e})})}function E4(e){let t=e.getBoundingClientRect(),n=GZ(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function Vpe(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=SQ(),{ref:i,index:a}=qQ(e),o=n===a,s=A.useRef(null),c=vX(i,s);return{compositeProps:A.useMemo(()=>({tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}}),[o,r,a,t]),compositeRef:c,index:a}}function D4(e){let{render:t,className:n,style:r,state:i=AX,props:a=kX,refs:o=kX,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Vpe({metadata:s});return YX(l,e,{state:i,ref:[...o,f],props:[d,...a,u],stateAttributesMapping:c})}function O4(e){if(YZ(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`)??void 0;if(!sQ(e))return O4(uQ(e))}function k4(e,t){let n=A.useRef(null);function r(t){Jp.flushSync(()=>{e.setOpen(!1,e$(MZ,t.nativeEvent,t.currentTarget))}),Bde(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&N1(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Jp.flushSync(()=>{e.setOpen(!1,e$(MZ,n.nativeEvent,n.currentTarget))});let i=zde(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&S$(r,i);){let e=i;if(i=A1(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Hpe(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=A.useRef(!1);return A.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,L$(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:AX,[t,n,r])}var A4=2,Upe=J0(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=hX(!0),h=d?.store??m?.store;if(!h)throw Error(dX(85));let g=QQ(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=A.useRef(null),S=Gpe(),C=SQ(!0),w=s0(),T=A.useMemo(()=>w??new r0,[w]),{registerTrigger:E,isMountedByThisTrigger:ee}=i2(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:c0(T),floatingParentNodeId:o0(),keyboardEventRelay:C?.relayKeyboardEvent}),te=S.type===`menubar`,D=h.useState(`disabled`),ne=a||D||te&&S.context.disabled,{getButtonProps:re,buttonRef:ie}=wQ({disabled:ne,native:o});A.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let O=A.useRef(null),ae=m$(),oe=_Q(e=>{if(!O.current)return;ae.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;if(S$(O.current,t)||S$(h.select(`positionerElement`),t)||t===O.current||t!=null&&O4(t)===h.select(`rootId`))return;let n=E4(O.current);e.clientX>=n.left-A4&&e.clientX<=n.right+A4&&e.clientY>=n.top-A4&&e.clientY<=n.bottom+A4||T.events.emit(`close`,{domEvent:e,reason:LZ})});A.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&L$(O.current).addEventListener(`mouseup`,oe,{once:!0})},[y,oe,h]);let k=te&&S.context.hasSubmenuOpen,se=w2(v,{enabled:(c??k)&&!ne&&S.type!==`context-menu`&&(!te||k&&!ee),handleClose:F2({blockPointerEvents:!te}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),ce=Wpe(y,h.select(`lastOpenChangeReason`)),le=g0(v,{enabled:!ne&&S.type!==`context-menu`,event:y&&te?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0?ce:!1}),ue=v2(v,{enabled:!ne&&k}),de=Hpe({open:y,enabled:te,mouseDownAction:`open`}),fe=A.useMemo(()=>FX(ue.reference,le.reference),[ue.reference,le.reference]),pe=h.useState(`triggerProps`,ee),{preFocusGuardRef:me,handlePreFocusGuardFocus:he,handleFocusTargetFocus:ge}=k4(h,x),_e={disabled:ne,open:y},ve=[O,t,ie,E,x],ye=[fe,se??AX,pe,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(ae.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),L$(e.currentTarget).addEventListener(`mouseup`,oe,{once:!0}))}},te?{role:`menuitem`}:{},de,p,re],be=YX(`button`,e,{enabled:!te,stateAttributesMapping:pZ,state:_e,ref:ve,props:ye});return te?(0,N.jsx)(D4,{tag:`button`,render:n,className:r,style:i,state:_e,refs:ve,props:ye,stateAttributesMapping:pZ}):y?(0,N.jsxs)(A.Fragment,{children:[(0,N.jsx)(V$,{ref:me,onFocus:he},`${g}-pre-focus-guard`),(0,N.jsx)(A.Fragment,{children:be},g),(0,N.jsx)(V$,{ref:h.context.triggerFocusTargetRef,onFocus:ge},`${g}-post-focus-guard`)]}):(0,N.jsx)(A.Fragment,{children:be},g)});function Wpe(e,t){let n=m$(),[r,i]=A.useState(!1);return bQ(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Gpe(){let e=gZ(!0),t=hX(!0),n=v4(!0);return A.useMemo(()=>n?{type:`menubar`,context:n}:e&&!t?{type:`context-menu`,context:e}:{type:void 0},[e,t,n])}function j4(e){let[t,n]=A.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function M4(e){let t=cQ(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=YZ(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(W$(n)!==a||W$(r)!==o)&&(n=a,r=o),{width:n,height:r}}var Kpe=()=>!0;function qpe(e){let{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=Kpe,onMeasureLayout:o,onMeasureLayoutComplete:s,side:c,direction:l}=e,u=c$(t,!0,!1),d=a$(),f=A.useRef(null),p=A.useRef(null),m=A.useRef(!0),h=A.useRef(OX),g=_Q(o),_=_Q(s),v=A.useMemo(()=>{let e=c===`top`,t=c===`left`;return l===`rtl`?(e||=c===`inline-end`,t||=c===`inline-end`):(e||=c===`inline-start`,t||=c===`inline-start`),e?{position:`absolute`,[c===`top`?`bottom`:`top`]:`0`,[t?`right`:`left`]:`0`}:AX},[c,l]);bQ(()=>{if(!i||!a()||typeof ResizeObserver!=`function`){h.current=OX,m.current=!0,f.current=null,p.current=null;return}if(!t||!n)return;h.current=P4(t,v);let e=new ResizeObserver(e=>{let t=e[0];t&&(p.current={width:Math.ceil(t.borderBoxSize[0].inlineSize),height:Math.ceil(t.borderBoxSize[0].blockSize)})});e.observe(t),F4(t,`auto`);let r=N4(t,`position`,`static`),o=N4(t,`transform`,`none`),s=N4(t,`scale`,`1`),c=P4(n,{"--available-width":`max-content`,"--available-height":`max-content`});function l(){r(),o(),c()}function y(){l(),s()}if(g?.(),m.current||f.current===null){I4(n,`max-content`);let r=M4(t);return f.current=r,I4(n,r),y(),_?.(null,r),m.current=!1,()=>{e.disconnect(),h.current(),h.current=OX}}F4(t,`auto`),I4(n,`max-content`);let b=f.current??p.current,x=M4(t);if(f.current=x,!b)return I4(n,x),y(),_?.(null,x),()=>{e.disconnect(),d.cancel(),h.current(),h.current=OX};F4(t,b),y(),_?.(b,x),I4(n,x);let S=new AbortController;return d.request(()=>{F4(t,x),u(()=>{t.style.setProperty(`--popup-width`,`auto`),t.style.setProperty(`--popup-height`,`auto`)},S.signal)}),()=>{e.disconnect(),S.abort(),d.cancel(),h.current(),h.current=OX}},[r,t,n,u,d,a,i,g,_,v])}function N4(e,t,n){let r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}function P4(e,t){let n=[];for(let[r,i]of Object.entries(t))n.push(N4(e,r,i));return n.length?()=>{n.forEach(e=>e())}:OX}function F4(e,t){let n=t===`auto`?`auto`:`${t.width}px`,r=t===`auto`?`auto`:`${t.height}px`;e.style.setProperty(`--popup-width`,n),e.style.setProperty(`--popup-height`,r)}function I4(e,t){let n=t===`max-content`?`max-content`:`${t.width}px`,r=t===`max-content`?`max-content`:`${t.height}px`;e.style.setProperty(`--positioner-width`,n),e.style.setProperty(`--positioner-height`,r)}function L4(e){let{store:t,side:n,cssVars:r,children:i}=e,a=e4(),o=t.useState(`activeTriggerElement`),s=t.useState(`activeTriggerId`),c=t.useState(`open`),l=t.useState(`payload`),u=t.useState(`mounted`),d=t.useState(`popupElement`),f=t.useState(`positionerElement`),p=j4(c?o:null),m=Xpe(s,l),h=A.useRef(null),[g,_]=A.useState(null),[v,y]=A.useState(null),b=A.useRef(null),x=A.useRef(null),S=c$(b,!0,!1),C=a$(),[w,T]=A.useState(null),[E,ee]=A.useState(!1);bQ(()=>(t.set(`hasViewport`,!0),()=>{t.set(`hasViewport`,!1)}),[t]);let te=_Q(()=>{b.current?.style.setProperty(`animation`,`none`),b.current?.style.setProperty(`transition`,`none`),x.current?.style.setProperty(`display`,`none`)}),D=_Q(e=>{b.current?.style.removeProperty(`animation`),b.current?.style.removeProperty(`transition`),x.current?.style.removeProperty(`display`),e&&T(e)}),ne=A.useRef(null);bQ(()=>{if(o&&p&&o!==p&&ne.current!==o&&h.current){_(h.current),ee(!0);let e=Ype(p,o);y(e),C.request(()=>{Jp.flushSync(()=>{ee(!1)}),S(()=>{_(null),T(null),h.current=null})}),ne.current=o}},[o,p,g,S,C]),bQ(()=>{let e=b.current;if(!e)return;let t=L$(e).createElement(`div`);for(let n of Array.from(e.childNodes))t.appendChild(n.cloneNode(!0));h.current=t});let re=g!=null,ie;ie=re?(0,N.jsxs)(A.Fragment,{children:[(0,N.jsx)(`div`,{"data-previous":!0,inert:$2(!0),ref:x,style:{...w?{[r.popupWidth]:`${w.width}px`,[r.popupHeight]:`${w.height}px`}:null,position:`absolute`},"data-ending-style":E?void 0:``},`previous`),(0,N.jsx)(`div`,{"data-current":!0,ref:b,"data-starting-style":E?``:void 0,children:i},m)]}):(0,N.jsx)(`div`,{"data-current":!0,ref:b,children:i},m),bQ(()=>{let e=x.current;!e||!g||e.replaceChildren(...Array.from(g.childNodes))},[g]),qpe({popupElement:d,positionerElement:f,mounted:u,content:l,onMeasureLayout:te,onMeasureLayoutComplete:D,side:n,direction:a});let O={activationDirection:Jpe(v),transitioning:re};return{children:ie,state:O}}function Jpe(e){if(e)return`${R4(e.horizontal,5,`right`,`left`)} ${R4(e.vertical,5,`down`,`up`)}`}function R4(e,t,n,r){return e>t?n:e<-t?r:``}function Ype(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i={x:n.left+n.width/2,y:n.top+n.height/2},a={x:r.left+r.width/2,y:r.top+r.height/2};return{horizontal:a.x-i.x,vertical:a.y-i.y}}function Xpe(e,t){let[n,r]=A.useState(0),i=A.useRef(e),a=A.useRef(t),o=A.useRef(!1);return bQ(()=>{let n=i.current,s=a.current,c=e!==n,l=t!==s;c?(r(e=>e+1),o.current=!l):o.current&&l&&(r(e=>e+1),o.current=!1),i.current=e,a.current=t},[e,t]),`${e??`current`}-${n}`}var z4=A.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return YX(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function Zpe(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}var B4=A.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=qQ(),m=pX(),{store:h}=hX(),g=QQ(o),_=h.useState(`open`),v=h.useState(`floatingRootContext`),y=h.useState(`floatingTreeRoot`),b=h.useState(`triggerPopupId`,g),x=n2(g,h),S=A.useCallback(e=>{let t=x(e);return e!==null&&h.select(`open`)&&h.select(`activeTriggerId`)==null&&h.update({activeTriggerId:g,activeTriggerElement:e,closeDelay:u}),t},[x,u,h,g]),C=A.useRef(null),w=A.useCallback(e=>{C.current=e,h.set(`activeTriggerElement`,e)},[h]),T=C4();if(!T?.parentMenu)throw Error(dX(37));h.useSyncedValue(`closeDelay`,u);let E=T.parentMenu,ee=E.useState(`itemProps`),te=E.useState(`isActive`,p.index),D=A.useMemo(()=>({type:`submenu-trigger`,setActive(){E.set(`activeIndex`,p.index)}}),[E,p.index]),ne=h.useState(`disabled`),re=d||ne,{getItemProps:ie,itemRef:O}=UQ({closeOnClick:!1,disabled:re,highlighted:te,id:g,store:h,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:D,nodeId:m?.context.nodeId}),ae=h.useState(`hoverEnabled`),oe=E.useState(`allowMouseEnter`),k=w2(v,{enabled:ae&&c&&!re,handleClose:F2({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:oe?{open:l,close:u}:0,triggerElementRef:C,externalTree:y,isClosing:()=>h.select(`transitionStatus`)===`ending`}),se=g0(v,{enabled:!re,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??AX,ce=h.useState(`triggerProps`,!0);return delete ce.id,YX(`div`,e,{state:{disabled:re,highlighted:te,open:_},stateAttributesMapping:fZ,props:[se,k,ce,ee,{"aria-controls":b,tabIndex:_||te?0:-1,onBlur(){te&&E.set(`activeIndex`,null)}},f,ie],ref:[t,p.ref,O,S,w]})}),V4=w4;function H4(e){let t=(0,Xp.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,N.jsx)(Upe,{className:r,"data-slot":`menu-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U4(e){let t=(0,Xp.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({children:i,className:a,sideOffset:s,align:c,alignOffset:n,side:l,anchor:r,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=s===void 0?4:s,d=c===void 0?`center`:c,f=l===void 0?`bottom`:l,p;t[9]===a?p=t[10]:(p=x5(`dropdown-glass relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg outline-none focus:outline-none`,a),t[9]=a,t[10]=p);let m;t[11]===i?m=t[12]:(m=(0,N.jsx)(`div`,{className:`max-h-(--available-height) w-full overflow-y-auto p-1`,children:i}),t[11]=i,t[12]=m);let h;t[13]!==o||t[14]!==p||t[15]!==m?(h=(0,N.jsx)(X2,{className:p,"data-slot":`menu-popup`,...o,children:m}),t[13]=o,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;return t[17]!==d||t[18]!==n||t[19]!==r||t[20]!==f||t[21]!==u||t[22]!==h?(g=(0,N.jsx)(Q2,{children:(0,N.jsx)(h4,{align:d,alignOffset:n,anchor:r,className:`z-[60]`,"data-slot":`menu-positioner`,side:f,sideOffset:u,children:h})}),t[17]=d,t[18]=n,t[19]=r,t[20]=f,t[21]=u,t[22]=h,t[23]=g):g=t[23],g}function W4(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(lde,{"data-slot":`menu-group`,...e}),t[0]=e,t[1]=n),n}function Qpe(e){let t=(0,Xp.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=x5(`[&>svg]:-mx-0.5 flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:[&>svg:not([class*='text-'])]:text-current [&>svg]:pointer-events-none [&>svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,N.jsx)(d$,{className:s,"data-inset":r,"data-slot":`menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function G4(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(Npe,{"data-slot":`menu-radio-group`,...e}),t[0]=e,t[1]=n),n}function K4(e){let t=(0,Xp.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,hideIndicator:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=x5(`flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base text-foreground outline-none data-checked:bg-foreground/[0.08] data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,N.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==o||t[11]!==s?(c=(0,N.jsx)(Fpe,{className:o,"data-slot":`menu-radio-item`,...i,children:s}),t[9]=i,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function $pe(e){let t=(0,Xp.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,inset:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=x5(`px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,N.jsx)(ude,{className:a,"data-inset":r,"data-slot":`menu-label`,...i}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function q4(e){let t=(0,Xp.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x5(`mx-2 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,N.jsx)(z4,{className:i,"data-slot":`menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function eme(e){let t=(0,Xp.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x5(`ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,N.jsx)(`kbd`,{className:i,"data-slot":`menu-shortcut`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function tme(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(T4,{"data-slot":`menu-sub`,...e}),t[0]=e,t[1]=n),n}function nme(e){let t=(0,Xp.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=x5(`flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,N.jsx)(oX,{className:`-me-0.5 ms-auto opacity-80`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,N.jsxs)(B4,{className:o,"data-inset":i,"data-slot":`menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function rme(e){let t=(0,Xp.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,sideOffset:a,alignOffset:n,align:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?0:a,c=o===void 0?`start`:o,l=n??(c===`center`?void 0:-5),u;return t[6]!==c||t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==l?(u=(0,N.jsx)(U4,{align:c,alignOffset:l,className:r,"data-slot":`menu-sub-content`,side:`inline-end`,sideOffset:s,...i}),t[6]=c,t[7]=r,t[8]=i,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function J4(e){return YX(e.defaultTagName??`div`,e,e)}var ime=Gq(`relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-5.5 min-w-5.5 px-[calc(--spacing(1)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs`,lg:`h-6.5 min-w-6.5 px-[calc(--spacing(1.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm`,sm:`h-5 min-w-5 rounded-[.25rem] px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]`},variant:{default:`bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90`,destructive:`bg-destructive text-white [button&,a&]:hover:bg-destructive/90`,error:`bg-destructive/8 text-destructive-foreground dark:bg-destructive/16`,info:`bg-info/8 text-info-foreground dark:bg-info/16`,outline:`border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48`,secondary:`bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90`,success:`bg-success/8 text-success-foreground dark:bg-success/16`,warning:`bg-warning/8 text-warning-foreground dark:bg-warning/16`}}});function Y4(e){let t=(0,Xp.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,variant:s,size:c,render:l,...u}=e;n=l;let d={className:x5(ime({className:o,size:c,variant:s})),"data-slot":`badge`};a=J4,r=`span`,i=FX(d,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var X4=Gq(`[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,{defaultVariants:{size:`default`,variant:`default`},variants:{size:{default:`h-9 px-[calc(--spacing(3)-1px)] sm:h-8`,icon:`size-9 sm:size-8`,"icon-lg":`size-10 sm:size-9`,"icon-sm":`size-8 sm:size-7`,"icon-xl":`size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,"icon-xs":`size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5`,lg:`h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9`,sm:`h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7`,xl:`h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`},variant:{default:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-primary/90`,destructive:`not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-destructive/90`,"destructive-outline":`border-input bg-popover not-dark:bg-clip-padding text-destructive-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4`,ghost:`border-transparent text-foreground data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [&_svg:not([class*='text-'])]:text-muted-foreground`,link:`border-transparent underline-offset-4 [:hover,[data-pressed]]:underline`,outline:`border-input bg-popover not-dark:bg-clip-padding text-foreground shadow-xs/5 not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64 [&_svg:not([class*='text-'])]:text-muted-foreground`,secondary:`border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90`}}});function Z4(e){let t=(0,Xp.c)(9),n,r,i,a;if(t[0]!==e){let{className:o,variant:s,size:c,render:l,...u}=e;n=l;let d=n?void 0:`button`,f={className:x5(X4({className:o,size:c,variant:s})),"data-slot":`button`,type:d};a=J4,r=`button`,i=FX(f,u),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a}else n=t[1],r=t[2],i=t[3],a=t[4];let o;return t[5]!==n||t[6]!==r||t[7]!==i?(o={defaultTagName:r,props:i,render:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8],a(o)}var Q4=A.createContext(null),$4=A.createContext(null);function e3(){let e=A.useContext(Q4);if(e===null)throw Error(dX(60));return e}function t3(){let e=A.useContext($4);if(e===null)throw Error(dX(61));return e}var n3=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),ame={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},r3={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ome={disabled:!1,...r3},i3={valid(e){return e===null?null:e?{[n3.valid]:``}:{[n3.invalid]:``}}},a3={invalid:void 0,name:void 0,validityData:{state:ame,errors:[],error:``,value:``,initialValue:null},setValidityData:OX,disabled:void 0,touched:r3.touched,setTouched:OX,dirty:r3.dirty,setDirty:OX,filled:r3.filled,setFilled:OX,focused:r3.focused,setFocused:OX,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ome,markedDirtyRef:{current:!1},registerFieldControl:OX,validation:{getValidationProps:(e=AX)=>e,getInputValidationProps:(e=AX)=>e,inputRef:{current:null},commit:async()=>{}}},o3=A.createContext(a3);function s3(e=!0){let t=A.useContext(o3);if(t.setValidityData===OX&&!e)throw Error(dX(28));return t}function c3(e,t,n,r,i=!0){let{registerFieldControl:a}=s3(),o=A.useRef(null);o.current||=Symbol(),bQ(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}var sme=A.createContext({controlId:void 0,registerControlId:OX,labelId:void 0,setLabelId:OX,messageIds:[],setMessageIds:OX,getDescriptionProps:e=>e});function l3(){return A.useContext(sme)}function u3(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=l3(),o=QQ(t),s=n?i:void 0,c=_X(()=>Symbol(`labelable-control`)),l=A.useRef(!1),u=A.useRef(t!=null),d=_Q(()=>{!l.current||a===OX||(l.current=!1,a(c.current,void 0))});return bQ(()=>{if(a===OX)return;let e;if(n){let n=r?.current;e=JZ(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),A.useEffect(()=>d,[d]),i??o}var d3=(e,t)=>Object.is(e,t);function f3(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function p3(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:f3(t,e,n))}function m3(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:f3(e,t,n))}function h3(e,t,n){return e.filter(e=>!f3(t,e,n))}function g3(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function _3(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function v3(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(_3(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function y3(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return g3(e)}function b3(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?g3(e.value):g3(e)}function x3(e,t,n){function r(){return y3(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=_3(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function cme(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,N.jsx)(A.Fragment,{children:x3(r,t,n)},i)),e),[])}var S3={id:W0(e=>e.id),labelId:W0(e=>e.labelId),modal:W0(e=>e.modal),multiple:W0(e=>e.multiple),items:W0(e=>e.items),itemToStringLabel:W0(e=>e.itemToStringLabel),itemToStringValue:W0(e=>e.itemToStringValue),isItemEqualToValue:W0(e=>e.isItemEqualToValue),value:W0(e=>e.value),hasSelectedValue:W0(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:b3(t,r)!==``}),hasNullItemLabel:W0((e,t)=>t?v3(e.items):!1),open:W0(e=>e.open),mounted:W0(e=>e.mounted),forceMount:W0(e=>e.forceMount),transitionStatus:W0(e=>e.transitionStatus),openMethod:W0(e=>e.openMethod),activeIndex:W0(e=>e.activeIndex),selectedIndex:W0(e=>e.selectedIndex),isActive:W0((e,t)=>e.activeIndex===t),isSelected:W0((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>f3(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:f3(n,i,r)}),isSelectedByFocus:W0((e,t)=>e.selectedIndex===t),popupProps:W0(e=>e.popupProps),triggerProps:W0(e=>e.triggerProps),triggerElement:W0(e=>e.triggerElement),positionerElement:W0(e=>e.positionerElement),listElement:W0(e=>e.listElement),popupSide:W0(e=>e.popupSide),scrollUpArrowVisible:W0(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:W0(e=>e.scrollDownArrowVisible),hasScrollArrows:W0(e=>e.hasScrollArrows)},lme=A.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:OX,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function C3(){return A.useContext(lme)}function w3(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function T3(e,t){return Math.max(0,e-t)}function E3(e,t){if(t<=0)return 0;let n=w3(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function ume(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=d3,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=C3(),{setDirty:E,setTouched:ee,setFocused:te,shouldValidateOnChange:D,validityData:ne,setFilled:re,name:ie,disabled:O,validation:ae,validationMode:oe}=s3(),k=u3({id:t}),se=O||d,ce=ie??c,[le,ue]=HZ({controlled:n,default:y?r??kX:r,name:`Select`,state:`value`}),[de,fe]=HZ({controlled:a,default:o,name:`Select`,state:`open`}),pe=A.useRef([]),me=A.useRef([]),he=A.useRef(null),ge=A.useRef(null),_e=A.useRef(0),ve=A.useRef(null),ye=A.useRef([]),be=A.useRef(!1),xe=A.useRef(!1),Se=A.useRef(null),Ce=A.useRef(null),we=A.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Te=A.useRef(!1),{mounted:Ee,setMounted:De,transitionStatus:Oe}=o$(de),{openMethod:ke,triggerProps:Ae}=x4(de),j=_X(()=>new X0({id:k,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:le,open:de,mounted:Ee,transitionStatus:Oe,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,je=Y0(j,S3.activeIndex),Me=Y0(j,S3.selectedIndex),Ne=Y0(j,S3.triggerElement),Pe=Y0(j,S3.positionerElement),Fe=j4(ke),Ie=ke??Fe,Le=A.useMemo(()=>y&&Array.isArray(le)&&le.length===0?``:b3(le,x),[y,le,x]),Re=A.useMemo(()=>y&&Array.isArray(le)?le.map(e=>b3(e,x)):b3(le,x),[y,le,x]);c3(I$(j.state.triggerElement),k,le,_Q(()=>Re));let ze=A.useRef(le),Be=y?Array.isArray(le)&&le.length>0:le!=null;bQ(()=>{le!==ze.current&&j.set(`forceMount`,!0)},[j,le]),bQ(()=>{re(Be)},[Be,re]),bQ(function(){let e=ye.current,t;if(y){let n=Array.isArray(le)?le:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=m3(e,r,S);t=i===-1?null:i}}else{let n=m3(e,le,S);t=n===-1?null:n}t===null&&(Ce.current=null),!de&&j.set(`selectedIndex`,t)},[Be,y,de,le,ye,S,j,Ce]),y4(le,()=>{T(ce),E(le!==ne.initialValue),D()?ae.commit(le):ae.commit(le,!0)});let Ve=_Q((e,t)=>{if(s?.(e,t),!t.isCanceled&&(fe(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(ee(!0),te(!1),oe===`onBlur`&&ae.commit(le)),!e&&j.state.activeIndex!==null)){let e=pe.current[j.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),He=_Q(()=>{De(!1),j.update({activeIndex:null,openMethod:null}),_?.(!1)});l$({enabled:!h,open:de,ref:he,onComplete(){de||He()}}),A.useImperativeHandle(h,()=>({unmount:He}),[He]);let Ue=_Q((e,t)=>{i?.(e,t),!t.isCanceled&&ue(e)}),We=_Q(()=>{let e=j.state.listElement||he.current;if(!e)return;let t=T3(e.scrollHeight,e.clientHeight),n=E3(e.scrollTop,t),r=n>0,i=n<t;j.state.scrollUpArrowVisible!==r&&j.set(`scrollUpArrowVisible`,r),j.state.scrollDownArrowVisible!==i&&j.set(`scrollDownArrowVisible`,i)}),Ge=g2({open:de,onOpenChange:Ve,elements:{reference:Ne,floating:Pe}}),Ke=g0(Ge,{enabled:!f&&!se,event:`mousedown`}),qe=v0(Ge),Je=O2(Ge,{enabled:!f&&!se,listRef:pe,activeIndex:je,selectedIndex:Me,disabledIndices:kX,onNavigate(e){e===null&&!de||j.set(`activeIndex`,e)},focusItemOnHover:C}),Ye=k2(Ge,{enabled:!f&&!se&&(de||!y),listRef:me,activeIndex:je,selectedIndex:Me,onMatch(e){de?j.set(`activeIndex`,e):Ue(ye.current[e],e$(`none`))},onTyping(e){be.current=e}}),Xe=A.useMemo(()=>{let e=FX(Ye.reference,Je.reference,qe.reference,Ke.reference,Ae);return k&&(e.id=k),e},[Ke.reference,Ye.reference,Je.reference,qe.reference,Ae,k]),Ze=A.useMemo(()=>FX(e2,Ye.floating,Je.floating,qe.floating),[Ye.floating,Je.floating,qe.floating]),Qe=Je.item??AX;_4(()=>{j.update({popupProps:Ze,triggerProps:Xe})}),bQ(()=>{j.update({id:k,modal:m,multiple:y,value:le,open:de,mounted:Ee,transitionStatus:Oe,popupProps:Ze,triggerProps:Xe,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:Ie})},[j,k,m,y,le,de,Ee,Oe,Ze,Xe,v,b,x,S,Ie]);let $e=A.useMemo(()=>({store:j,name:ce,required:p,disabled:se,readOnly:f,multiple:y,highlightItemOnHover:C,setValue:Ue,setOpen:Ve,listRef:pe,popupRef:he,scrollHandlerRef:ge,handleScrollArrowVisibility:We,scrollArrowsMountedCountRef:_e,itemProps:Qe,events:Ge.context.events,valueRef:ve,valuesRef:ye,labelsRef:me,typingRef:be,selectionRef:we,firstItemTextRef:Se,selectedItemTextRef:Ce,validation:ae,onOpenChangeComplete:_,keyboardActiveRef:xe,alignItemWithTriggerActiveRef:Te,initialValueRef:ze}),[j,ce,p,se,f,y,C,Ue,Ve,Qe,Ge.context.events,ae,_,We]),et=vX(g,ae.inputRef),tt=y&&Array.isArray(le)&&le.length>0,nt=y?void 0:ce,rt=A.useMemo(()=>!y||!Array.isArray(le)||!ce?null:le.map(e=>{let t=b3(e,x);return(0,N.jsx)(`input`,{type:`hidden`,form:l,name:ce,value:t},t)}),[y,le,l,ce,x]);return(0,N.jsx)(Q4.Provider,{value:$e,children:(0,N.jsxs)($4.Provider,{value:Ge,children:[w,(0,N.jsx)(`input`,{...ae.getInputValidationProps({onFocus(){j.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||se||f){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=e$(_Z,e.nativeEvent);function r(){if(y)return;let e=ye.current.find(e=>b3(e,x).toLowerCase()===t.toLowerCase()||y3(e,b).toLowerCase()===t.toLowerCase());e!=null&&(E(e!==ne.initialValue),Ue(e,n),D()&&ae.commit(e))}j.set(`forceMount`,!0),queueMicrotask(r)}}),id:k&&nt==null?`${k}-hidden-input`:void 0,form:l,name:nt,autoComplete:u,value:Le,disabled:se,required:p&&!tt,readOnly:f,ref:et,style:ce?B$:z$,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),rt]})})}function D3(e,t){return e??t}var O3=2,dme=400,fme={...pZ,...i3,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},pme=A.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=s3(),{labelId:m}=l3(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:x,disabled:S,keyboardActiveRef:C}=e3(),w=p||S||a,T=Y0(h,S3.open),E=Y0(h,S3.mounted),ee=Y0(h,S3.value),te=Y0(h,S3.triggerProps),D=Y0(h,S3.positionerElement),ne=Y0(h,S3.listElement),re=Y0(h,S3.popupSide),ie=Y0(h,S3.id),O=Y0(h,S3.labelId),ae=Y0(h,S3.hasSelectedValue),oe=E&&D?re:null,k=i??ie,se=D3(m,O);u3({id:k});let ce=I$(D),le=A.useRef(null),{getButtonProps:ue,buttonRef:de}=wQ({disabled:w,native:o}),fe=vX(t,le,de,_Q(e=>{h.set(`triggerElement`,e)})),pe=m$(),me=m$(),he=m$();A.useEffect(()=>{if(T)return he.start(dme,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{he.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},me.clear()},[T,_,me,he]);let ge=FX(te,{id:k,role:`combobox`,"aria-expanded":T?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":T?ne?.id??k$(D)?.id:void 0,"aria-labelledby":se,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:w?-1:0,ref:fe,onFocus(e){u(!0),T&&x.current&&g(!1,e$(_Z,e.nativeEvent)),pe.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){S$(D,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(ee))},onPointerMove(){C.current=!1},onKeyDown(){C.current=!0},onMouseDown(e){if(T)return;let t=L$(e.currentTarget);function n(e){if(!le.current)return;let t=e.target;if(S$(le.current,t)||S$(ce.current,t)||t===le.current)return;let n=E4(le.current);e.clientX>=n.left-O3&&e.clientX<=n.right+O3&&e.clientY>=n.top-O3&&e.clientY<=n.bottom+O3||g(!1,e$(LZ,e))}me.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,ue);ge.role=`combobox`;let _e={...f,open:T,disabled:w,value:ee,readOnly:y,popupSide:oe,placeholder:!ae};return YX(`button`,e,{ref:[t,le],state:_e,stateAttributesMapping:fme,props:ge})}),mme={value:()=>null},hme=A.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=e3(),u=Y0(c,S3.value),d=Y0(c,S3.items),f=Y0(c,S3.itemToStringLabel),p=Y0(c,S3.hasSelectedValue),m=!p&&a!=null&&i==null,h=Y0(c,S3.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?cme(u,d,f):x3(u,d,f)),YX(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:mme})}),gme=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=e3();return YX(`span`,e,{state:{open:Y0(o,S3.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:fZ})}),_me=A.createContext(void 0),vme=A.forwardRef(function(e,t){let{store:n}=e3(),r=Y0(n,S3.mounted),i=Y0(n,S3.forceMount);return r||i?(0,N.jsx)(_me.Provider,{value:!0,children:(0,N.jsx)(t0,{ref:t,...e})}):null}),k3=A.createContext(void 0);function A3(){let e=A.useContext(k3);if(!e)throw Error(dX(59));return e}function j3(e,t){e&&Object.assign(e.style,t)}var M3={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},yme={position:`fixed`},bme=A.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=X1,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:ee}=e3(),te=t3(),D=Y0(y,S3.open),ne=Y0(y,S3.mounted),re=Y0(y,S3.modal),ie=Y0(y,S3.value),O=Y0(y,S3.openMethod),ae=Y0(y,S3.positionerElement),oe=Y0(y,S3.triggerElement),k=Y0(y,S3.isItemEqualToValue),se=Y0(y,S3.transitionStatus),ce=A.useRef(null),le=A.useRef(null),[ue,de]=A.useState(h),fe=ne&&ue&&O!==`touch`;!ne&&ue!==h&&de(h),bQ(()=>{ne||(S3.scrollUpArrowVisible(y.state)&&y.set(`scrollUpArrowVisible`,!1),S3.scrollDownArrowVisible(y.state)&&y.set(`scrollDownArrowVisible`,!1))},[y,ne]),A.useImperativeHandle(S,()=>fe),m4((fe||re)&&D,O===`touch`,ae,oe);let pe=a4({anchor:n,floatingRootContext:te,positionMethod:r,mounted:ne,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??fe,collisionAvoidance:g,keepMounted:!0}),me=fe?`none`:pe.side,he=fe?yme:pe.positionerStyles,ge={open:D,side:me,align:pe.align,anchorHidden:pe.anchorHidden};bQ(()=>{y.set(`popupSide`,pe.side)},[y,pe.side]);let _e=l4(e,ge,{styles:he,transitionStatus:se,props:v,refs:[t,_Q(e=>{y.set(`positionerElement`,e)})],hidden:!ne,inert:!D}),ve=A.useRef(0),ye=_Q(e=>{if(e.size===0&&ve.current===0||w.current.length===0)return;let t=ve.current;if(ve.current=e.size,e.size===t)return;let n=e$(_Z);if(t!==0&&!y.state.multiple&&ie!==null&&m3(w.current,ie,k)===-1){let e=T.current,t=e!=null&&m3(w.current,e,k)!==-1?e:null;ee(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(ie)){let e=e=>m3(w.current,e,k)!==-1,t=ie.filter(t=>e(t));(t.length!==ie.length||t.some(e=>!p3(ie,e,k)))&&(ee(t,n),t.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(D&&fe){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};j3(ae,e),j3(E.current,e)}}),be=A.useMemo(()=>({...pe,side:me,alignItemWithTriggerActive:fe,setControlledAlignItemWithTrigger:de,scrollUpArrowRef:ce,scrollDownArrowRef:le}),[pe,me,fe,de]);return(0,N.jsx)(s4,{elementsRef:b,labelsRef:x,onMapChange:ye,children:(0,N.jsxs)(k3.Provider,{value:be,children:[ne&&re&&(0,N.jsx)(c4,{inert:$2(!D),cutout:oe}),_e]})})}),N3=`base-ui-disable-scrollbar`,P3={className:N3,getElement(e){return(0,N.jsx)(`style`,{nonce:e,href:N3,precedence:`base-ui:low`,children:`.${N3}{scrollbar-width:none}.${N3}::-webkit-scrollbar{display:none}`})}},xme=A.createContext(void 0),Sme={disableStyleElements:!1};function F3(){return A.useContext(xme)??Sme}var Cme={...mZ,...iZ},wme=A.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,keyboardActiveRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:v,highlightItemOnHover:y}=e3(),{side:b,align:x,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:T,scrollUpArrowRef:E}=A3(),ee=I2(!0)!=null,te=t3(),D=e4(),{nonce:ne,disableStyleElements:re}=F3(),ie=Y0(s,S3.id),O=Y0(s,S3.open),ae=Y0(s,S3.mounted),oe=Y0(s,S3.popupProps),k=Y0(s,S3.transitionStatus),se=Y0(s,S3.triggerElement),ce=Y0(s,S3.positionerElement),le=Y0(s,S3.listElement),ue=A.useRef(!1),de=A.useRef(!1),fe=A.useRef({}),pe=a$(),me=_Q(e=>{if(!ce||!c.current||!de.current)return;if(ue.current||!S){g();return}let t=ce.style.top===`0px`,n=ce.style.bottom===`0px`;if(!t&&!n){g();return}let r=R3(ce),i=z3(ce.getBoundingClientRect().height,`y`,r),a=L$(ce),o=getComputedStyle(ce),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=I3(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=L3(e),m=0,h=null,_=!1,v=!1,y=e=>{ce.style.height=`${e}px`},b=(t,n)=>{let r=w3(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(ue.current=!0),g()},x=t?p-f:f,C=Math.min(i+x,d);if(m=C,x<=1){b(x,t?p:0);return}if(d-C>1?t?v=!0:h=0:(_=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||h!=null){let t=L3(e),n=v?t:w3(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(ue.current=!0),g()});A.useImperativeHandle(_,()=>me,[me]),l$({open:O,ref:c,onComplete(){O&&l?.(!0)}});let he={open:O,transitionStatus:k,side:b,align:x};bQ(()=>{!ce||!c.current||Object.keys(fe.current).length||(fe.current={top:ce.style.top||`0`,left:ce.style.left||`0`,right:ce.style.right,height:ce.style.height,bottom:ce.style.bottom,minHeight:ce.style.minHeight,maxHeight:ce.style.maxHeight,marginTop:ce.style.marginTop,marginBottom:ce.style.marginBottom})},[c,ce]),bQ(()=>{O||S||(de.current=!1,ue.current=!1,j3(ce,fe.current))},[O,S,ce,c]),bQ(()=>{let e=c.current;if(!O||!se||!ce||!e||S&&!C||s.state.transitionStatus===`ending`)return;if(!S){de.current=!0,pe.request(g),e.style.removeProperty(`--transform-origin`);return}let t=Tme(e);e.style.removeProperty(`--transform-origin`);try{let t=p.current;t?.isConnected||(t=!S3.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=getComputedStyle(ce),i=getComputedStyle(e),a=L$(se),o=GZ(ce),c=R3(se),l=B3(se.getBoundingClientRect(),c),u=B3(ce.getBoundingClientRect(),c),m=l.height,h=le||e,_=h.scrollHeight,b=parseFloat(i.borderBottomWidth),x=parseFloat(r.marginTop)||10,S=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,T=I3(i),E=a.documentElement.clientHeight-x-S,ee=a.documentElement.clientWidth,te=E-l.bottom+m,ne,re=D===`rtl`?l.right-u.width:l.left,ie=0;if(t&&n){let e=B3(n.getBoundingClientRect(),c);ne=B3(t.getBoundingClientRect(),c),re=u.left+(D===`rtl`?e.right-ne.right:e.left-ne.left);let r=e.top-l.top+e.height/2;ie=ne.top-u.top+ne.height/2-r}let O=te+ie+S+b,ae=Math.min(E,O),oe=E-x-S,k=O-ae,A=ee-5;ce.style.left=`${w3(re,5,A-u.width)}px`,ce.style.height=`${ae}px`,ce.style.maxHeight=`auto`,ce.style.marginTop=`${x}px`,ce.style.marginBottom=`${S}px`,e.style.height=`100%`;let pe=L3(h),me=k>=pe-1;me&&(ae=Math.min(E,u.height)-(k-pe));let he=l.top<20||l.bottom>E-20||Math.ceil(ae)+1<Math.min(_,C),ge=(o.visualViewport?.scale??1)!==1&&jQ;if(he||ge){de.current=!0,j3(ce,fe.current),w(!1);return}let _e=Math.max(C,ae);if(me){let e=Math.max(0,E-O);ce.style.top=u.height>=oe?`0`:`${e}px`,ce.style.height=`${ae}px`,h.scrollTop=L3(h)}else ce.style.bottom=`0`,h.scrollTop=k;if(ne){let t=u.top,n=u.height,r=ne.top+ne.height/2,i=w3(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(_e===E||ae>=T)&&(ue.current=!0),g(),y&&s.state.selectedIndex===null&&s.state.activeIndex===null&&v.current[0]!=null&&s.set(`activeIndex`,0),de.current=!0}finally{t()}},[s,O,ce,se,d,f,p,c,g,S,w,pe,T,E,le,v,y,D,C]),A.useEffect(()=>{if(!S||!ce||!O)return;let e=GZ(ce);function t(e){u(!1,e$(VZ,e))}return P$(e,`resize`,t)},[u,S,ce,O]);let ge={...le?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${ie}-list`},onKeyDown(e){m.current=!0,ee&&G2.has(e.key)&&e.stopPropagation()},onMouseMove(){m.current=!1},onScroll(e){le||me(e.currentTarget)},...S&&{style:le?{height:`100%`}:M3}},_e=YX(`div`,e,{ref:[t,c],state:he,stateAttributesMapping:Cme,props:[oe,ge,Y2(k),{className:!le&&S?P3.className:void 0},o]});return(0,N.jsxs)(A.Fragment,{children:[!re&&P3.getElement(ne),(0,N.jsx)(h0,{context:te,modal:!1,disabled:!ae,returnFocus:a,restoreFocus:!0,children:_e})]})});function I3(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function L3(e){return T3(e.scrollHeight,e.clientHeight)}function R3(e){return I0.getScale(e)}function z3(e,t,n){return e/n[t]}function B3(e,t){return o1({x:z3(e.x,`x`,t),y:z3(e.y,`y`,t),width:z3(e.width,`x`,t),height:z3(e.height,`y`,t)})}var V3=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Tme(e){let{style:t}=e,n={};for(let[e,r]of V3)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of V3){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Eme=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=e3(),{alignItemWithTriggerActive:c}=A3(),l=Y0(o,S3.hasScrollArrows),u=Y0(o,S3.openMethod),d=Y0(o,S3.multiple),f={id:`${Y0(o,S3.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:M3},className:l&&u!==`touch`?P3.className:void 0};return YX(`div`,e,{ref:[t,_Q(e=>{o.set(`listElement`,e)})],props:[f,a]})}),H3=A.createContext(void 0);function Dme(){let e=A.useContext(H3);if(!e)throw Error(dX(57));return e}var Ome=A.memo(A.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=A.useRef(null),d=qQ({label:o,textRef:u,indexGuessBehavior:KQ.GuessFromOrder}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b}=e3(),x=Y0(f,S3.isActive,d.index),S=Y0(f,S3.isSelected,d.index,a),C=Y0(f,S3.isSelectedByFocus,d.index),w=Y0(f,S3.isItemEqualToValue),T=d.index,E=T!==-1,ee=A.useRef(null);bQ(()=>{if(!E)return;let e=v.current;return e[T]=a,()=>{delete e[T]}},[E,T,a,v]),bQ(()=>{if(!E)return;let e=f.state.value,t=e;y&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&f3(a,t,w)&&(f.set(`selectedIndex`,T),u.current&&(b.current=u.current))},[E,T,y,w,f,a,b]);let te=A.useRef(null),D=A.useRef(`mouse`),ne=A.useRef(!1),{getButtonProps:re,buttonRef:ie}=wQ({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),O={disabled:s,selected:S,highlighted:x};function ae(e){let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=S?h3(n,a,w):[...n,a];h(r,e$(SZ,e))}else h(a,e$(SZ,e)),m(!1,e$(SZ,e))}function oe(){g.current.dragY=0}let k={role:`option`,"aria-selected":S,tabIndex:x?0:-1,onKeyDown(e){te.current=e.key,f.set(`activeIndex`,T),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&D.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&g$(e.nativeEvent)&&(n!==void 0||x),i=t&&!r&&!ne.current;ne.current=!1,!(e.type===`keydown`&&te.current===null)&&(s||e.type===`keydown`&&te.current===` `&&_.current||i||(te.current=null,ae(e.nativeEvent)))},onPointerEnter(e){D.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){D.current=e.pointerType,ne.current=!0,oe()},onMouseUp(){if(oe(),s||D.current===`touch`||ne.current)return;let e=!g.current.allowSelectedMouseUp&&S,t=!g.current.allowUnselectedMouseUp&&!S;e||t||(ne.current=!0,ee.current?.click(),ne.current=!1)}},se=YX(`div`,e,{ref:[ie,t,d.ref,ee],state:O,props:[p,k,l,re]}),ce=A.useMemo(()=>({selected:S,index:T,textRef:u,selectedByFocus:C,hasRegistered:E}),[S,T,u,C,E]);return(0,N.jsx)(H3.Provider,{value:ce,children:se})})),kme=A.memo(A.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=Dme(),{firstItemTextRef:o,selectedItemTextRef:s}=e3(),{render:c,className:l,style:u,...d}=e;return YX(`div`,e,{ref:[A.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:d})})),U3=A.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=e3(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=A3(),_=Y0(l,c?S3.scrollUpArrowVisible:S3.scrollDownArrowVisible),v=Y0(l,S3.openMethod),y=_&&v!==`touch`,b=m$(),x=c?g:h,{transitionStatus:S,setMounted:C}=o$(y);bQ(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),l$({open:y,ref:x,onComplete(){y||C(!1)}});let w=YX(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=T3(e.scrollHeight,e.clientHeight),r=E3(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=Ame(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function Ame(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?E3(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?E3(l.offsetTop+l.offsetHeight-r+i,a):a}var jme=A.forwardRef(function(e,t){return(0,N.jsx)(U3,{...e,ref:t,direction:`down`})}),Mme=A.forwardRef(function(e,t){return(0,N.jsx)(U3,{...e,ref:t,direction:`up`})}),W3=A.createContext(void 0);function Nme(){let e=A.useContext(W3);if(e===void 0)throw Error(dX(56));return e}var Pme=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=A.useState(),c=A.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=YX(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,N.jsx)(W3.Provider,{value:c,children:l})}),Fme=A.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=Nme(),c=QQ(a);return bQ(()=>{s(c)},[c,s]),YX(`div`,e,{ref:t,props:[{id:c},o]})}),Ime=ume,Lme=Gq(`relative inline-flex cursor-pointer select-none items-center justify-between gap-2 border rounded-lg text-left text-base outline-none transition-[color,box-shadow,background-color] data-disabled:pointer-events-none data-disabled:opacity-64 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4`,{defaultVariants:{size:`default`,variant:`default`},variants:{variant:{default:`w-full min-w-36 border-input bg-background not-dark:bg-clip-padding text-foreground shadow-xs/5 ring-ring/24 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='text-'])]:text-muted-foreground [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none`,ghost:`border-transparent text-muted-foreground/70 focus-visible:ring-2 focus-visible:ring-ring data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent [:hover,[data-pressed]]:text-foreground/80`},size:{default:`min-h-9 px-[calc(--spacing(3)-1px)] sm:min-h-8`,lg:`min-h-10 px-[calc(--spacing(3)-1px)] sm:min-h-9`,sm:`min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7`,xs:`h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5`}}});function G3(e){let t=(0,Xp.c)(20),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,size:o,variant:s,children:n,icon:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=o===void 0?`default`:o,l=s===void 0?`default`:s,u;t[7]!==r||t[8]!==c||t[9]!==l?(u=x5(Lme({size:c,variant:l}),r),t[7]=r,t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]===i?d=t[12]:(d=i??(0,N.jsx)(aX,{className:`-me-1 size-3 opacity-50`}),t[11]=i,t[12]=d);let f;t[13]===d?f=t[14]:(f=(0,N.jsx)(gme,{"data-slot":`select-icon`,children:d}),t[13]=d,t[14]=f);let p;return t[15]!==n||t[16]!==a||t[17]!==u||t[18]!==f?(p=(0,N.jsxs)(pme,{className:u,"data-slot":`select-trigger`,...a,children:[n,f]}),t[15]=n,t[16]=a,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function Rme(e){let t=(0,Xp.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=x5(`flex-1 truncate data-placeholder:text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,N.jsx)(hme,{className:i,"data-slot":`select-value`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zme(e){let t=(0,Xp.c)(36),n,r,i,a,o,s,c,l,u,d,f;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11]):({className:i,popupClassName:a,children:r,side:s,sideOffset:c,align:l,alignOffset:u,alignItemWithTrigger:d,matchTriggerWidth:f,anchor:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f);let p=s===void 0?`bottom`:s,m=c===void 0?4:c,h=l===void 0?`start`:l,g=u===void 0?0:u,_=d===void 0?!0:d,v=f===void 0?!0:f,y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,N.jsx)(Mme,{className:`top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover`,"data-slot":`select-scroll-up-arrow`,children:(0,N.jsx)(sX,{className:`relative size-4.5 sm:size-4`})}),t[12]=y):y=t[12];let b=v&&`min-w-(--anchor-width)`,x;t[13]!==a||t[14]!==b?(x=x5(`dropdown-glass relative h-full rounded-lg`,b,a),t[13]=a,t[14]=b,t[15]=x):x=t[15];let S;t[16]===i?S=t[17]:(S=x5(`max-h-(--available-height) overflow-y-auto p-1`,i),t[16]=i,t[17]=S);let C;t[18]!==r||t[19]!==S?(C=(0,N.jsx)(Eme,{className:S,"data-slot":`select-list`,children:r}),t[18]=r,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==C||t[22]!==x?(w=(0,N.jsx)(`div`,{className:x,children:C}),t[21]=C,t[22]=x,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,N.jsx)(jme,{className:`bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover`,"data-slot":`select-scroll-down-arrow`,children:(0,N.jsx)(aX,{className:`relative size-4.5 sm:size-4`})}),t[24]=T):T=t[24];let E;t[25]!==o||t[26]!==w?(E=(0,N.jsxs)(wme,{className:`origin-(--transform-origin) rounded-lg text-foreground outline-none`,"data-slot":`select-popup`,...o,children:[y,w,T]}),t[25]=o,t[26]=w,t[27]=E):E=t[27];let ee;return t[28]!==h||t[29]!==_||t[30]!==g||t[31]!==n||t[32]!==p||t[33]!==m||t[34]!==E?(ee=(0,N.jsx)(vme,{children:(0,N.jsx)(bme,{align:h,alignItemWithTrigger:_,alignOffset:g,anchor:n,className:`z-50 select-none`,"data-slot":`select-positioner`,side:p,sideOffset:m,children:E})}),t[28]=h,t[29]=_,t[30]=g,t[31]=n,t[32]=p,t[33]=m,t[34]=E,t[35]=ee):ee=t[35],ee}function Bme(e){let t=(0,Xp.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,hideIndicator:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=x5(`flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center rounded-sm px-2 py-1 text-base outline-none data-selected:bg-foreground/[0.08] data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===n?s=t[8]:(s=(0,N.jsx)(kme,{className:`min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground`,"data-slot":`select-item-text`,children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==o||t[11]!==s?(c=(0,N.jsx)(Ome,{className:o,"data-slot":`select-item`,...i,children:s}),t[9]=i,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Vme(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(Pme,{"data-slot":`select-group`,...e}),t[0]=e,t[1]=n),n}function Hme(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(Fme,{className:`px-2 py-1.5 font-medium text-muted-foreground text-xs`,"data-slot":`select-group-label`,...e}),t[0]=e,t[1]=n),n}var K3=`h-7 min-h-7 gap-1.5 px-2.5 text-muted-foreground/70 transition-none hover:text-foreground/80 [&_svg[data-composer-control-icon]]:mx-0 [&_svg[data-composer-control-chevron]]:-mx-0.5`;function q3(e){let t=(0,Xp.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,size:i,variant:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`sm`:i,s=a===void 0?`ghost`:a,c;t[5]===n?c=t[6]:(c=x5(K3,n),t[5]=n,t[6]=c);let l;return t[7]!==r||t[8]!==o||t[9]!==c||t[10]!==s?(l=(0,N.jsx)(Z4,{className:c,size:o,variant:s,...r}),t[7]=r,t[8]=o,t[9]=c,t[10]=s,t[11]=l):l=t[11],l}function J3(e){let t=(0,Xp.c)(6),{icon:n,className:r,opticalSize:i}=e,a=(i===void 0?`default`:i)===`large`?`size-4.5`:`size-4`,o;t[0]!==r||t[1]!==a?(o=x5(`shrink-0`,a,r),t[0]=r,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,N.jsx)(n,{"aria-hidden":`true`,className:o,"data-composer-control-icon":!0}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function Y3(){let e=(0,Xp.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsx)(aX,{"aria-hidden":`true`,className:`-mx-0.5 size-3.5 shrink-0 text-muted-foreground opacity-70`,"data-composer-control-chevron":!0,strokeWidth:2.25}),e[0]=t):t=e[0],t}function Ume(e){let t=(0,Xp.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,size:i,variant:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`sm`:i,s=a===void 0?`ghost`:a,c;t[5]===n?c=t[6]:(c=x5(K3,n),t[5]=n,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,N.jsx)(Y3,{}),t[7]=l):l=t[7];let u;return t[8]!==r||t[9]!==o||t[10]!==c||t[11]!==s?(u=(0,N.jsx)(G3,{className:c,icon:l,size:o,variant:s,...r}),t[8]=r,t[9]=o,t[10]=c,t[11]=s,t[12]=u):u=t[12],u}var Wme=`Ultrathink:
|
|
21
|
-
`,Gme=yO.make(`claudeAgent`),X3=e=>e===Gme,Kme=[`off`,`lite`,`full`,`ultra`],Z3={off:{label:`Off`,description:`Agent's normal style`},lite:{label:`Lite`,description:`No filler, full sentences`},full:{label:`Full`,description:`Terse fragments`},ultra:{label:`Ultra`,description:`Maximum terseness`}};function Q3(e){let t=(0,Xp.c)(7),{label:n,description:r}=e,i;t[0]===n?i=t[1]:(i=(0,N.jsx)(`span`,{className:`shrink-0`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,N.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground text-xs`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,N.jsxs)(`span`,{className:`flex w-full min-w-0 items-center justify-between gap-3`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function qme(){let e=(0,Xp.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsx)(Y4,{variant:`outline`,className:`inline-flex h-4 w-fit min-w-0 items-center justify-center gap-0 border-border/70 bg-muted/60 px-1.5 py-0 font-semibold text-[10px] text-muted-foreground leading-none sm:h-4`,children:`Default`}),e[0]=t):t=e[0],t}function $3(e,t,n){return e.map(e=>e.id===t?e.type===`boolean`?{...e,...typeof n==`boolean`?{currentValue:n}:{}}:{...e,...typeof n==`string`?{currentValue:n}:{}}:e)}function e6(e){if(!e)return null;let t=OY(e);return typeof t==`string`?t:null}function Jme(e,t,n,r,i,a){let o=JY(t,n,e),s=DY({caps:o,selections:i}),c=s.filter(e=>e.type===`select`),l=s.filter(e=>e.type===`boolean`),u=c[0]??null,d=c.find(e=>e.id===`contextWindow`)??null,f=c.find(e=>e.id===`agent`)??null,p=l.find(e=>e.id===`fastMode`)??null,m=l.find(e=>e.id===`thinking`)??null,h=a&&(u?.promptInjectedValues?.length??0)>0&&jY(r),g=h&&jY(r.replace(/^Ultrathink:\s*/i,``));return{caps:o,descriptors:s,selectDescriptors:c,booleanDescriptors:l,primarySelectDescriptor:u,contextWindowDescriptor:d,agentDescriptor:f,fastModeDescriptor:p,thinkingDescriptor:m,effort:(h?`ultrathink`:e6(u))??null,thinkingEnabled:typeof m?.currentValue==`boolean`?m.currentValue:null,fastModeEnabled:typeof p?.currentValue==`boolean`?p.currentValue:!1,contextWindow:e6(d),ultrathinkPromptControlled:h,ultrathinkInBodyText:g,selectedAgent:e6(f),selectedAgentLabel:f?kY(f):null}}function t6(e){let t=Jme(e.provider,e.models,e.model,e.prompt,e.modelOptions,e.allowPromptInjectedEffort??!0),n=t.primarySelectDescriptor!==null,r=t.thinkingDescriptor!==null,i=t.fastModeDescriptor!==null,a=t.contextWindowDescriptor!==null,o=t.agentDescriptor!==null;return{...t,showEffort:n,showThinking:r,showFastMode:i,showContextWindow:a,showAgent:o,hasAnyControls:n||r||i||a||o}}function n6(e){return t6(e).hasAnyControls}var r6=(0,A.memo)(function(e){let t=(0,Xp.c)(63),n,r,i,a,o,s,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13]):({provider:f,instanceId:r,models:o,model:i,prompt:d,onPromptChange:c,modelOptions:a,allowPromptInjectedEffort:p,compressMode:n,onCompressModeChange:s,unpromptedSubagents:m,onUnpromptedSubagentsChange:l,...u}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m);let h=p===void 0?!0:p,g=b5(Xme),_;t[14]!==r||t[15]!==i||t[16]!==u||t[17]!==f||t[18]!==g?(_=e=>{if(`onModelOptionsChange`in u){u.onModelOptionsChange(e);return}let t=u.threadRef??u.draftId;t&&g(t,f,e,{...r?{instanceId:r}:{},model:i,persistSticky:!0})},t[14]=r,t[15]=i,t[16]=u,t[17]=f,t[18]=g,t[19]=_):_=t[19];let v=_,y,b,x,S,C,w,T;if(t[20]!==h||t[21]!==n||t[22]!==i||t[23]!==a||t[24]!==o||t[25]!==s||t[26]!==c||t[27]!==l||t[28]!==d||t[29]!==f||t[30]!==m||t[31]!==v){T=Symbol.for(`react.early_return_sentinel`);bb0:{let{descriptors:e,selectDescriptors:r,booleanDescriptors:u,primarySelectDescriptor:p,ultrathinkPromptControlled:g,ultrathinkInBodyText:_,hasAnyControls:E}=t6({provider:f,models:o,model:i,prompt:d,modelOptions:a,allowPromptInjectedEffort:h});b=r,y=u;let ee;t[39]===v?ee=t[40]:(ee=e=>{v(AY(e))},t[39]=v,t[40]=ee);let te=ee,D=(t,n)=>{if(n){if(t.promptInjectedValues?.includes(n)){let e=d.trim().length===0?Wme:zY(d,`ultrathink`);c(e);return}if(!(_&&t.id===p?.id)){if(g&&t.id===p?.id){let e=d.replace(/^Ultrathink:\s*/i,``);c(e)}te($3(e,t.id,n))}}};x=n!==void 0&&s!==void 0;let ne;if(t[41]!==l||t[42]!==f||t[43]!==m?(ne=m!==void 0&&l!==void 0&&X3(f),t[41]=l,t[42]=f,t[43]=m,t[44]=ne):ne=t[44],S=ne,!E&&!x&&!S){T=null;break bb0}C=b.map((e,t)=>{let n=g&&e.id===p?.id?`ultrathink`:e6(e)??``;return(0,N.jsxs)(`div`,{children:[t>0?(0,N.jsx)(q4,{}):null,(0,N.jsxs)(W4,{children:[(0,N.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs`,children:e.label}),_&&e.id===p?.id?(0,N.jsx)(`div`,{className:`px-2 pb-1.5 text-muted-foreground/80 text-xs`,children:`Your prompt contains "ultrathink" in the text. Remove it to change this option.`}):null,(0,N.jsx)(G4,{value:n,onValueChange:t=>D(e,t),children:e.options.map(t=>(0,N.jsx)(K4,{value:t.id,hideIndicator:!0,disabled:_&&e.id===p?.id,children:(0,N.jsx)(`span`,{className:`flex w-full min-w-0 items-center justify-between gap-3`,children:(0,N.jsxs)(`span`,{className:`min-w-0 truncate`,children:[t.label,t.isDefault?(0,N.jsxs)(N.Fragment,{children:[` `,(0,N.jsx)(qme,{})]}):null]})})},t.id))})]})]},e.id)}),w=y.map((t,n)=>{let r=t.currentValue===!0?`on`:`off`;return(0,N.jsxs)(`div`,{children:[n>0||b.length>0?(0,N.jsx)(q4,{}):null,(0,N.jsxs)(W4,{children:[(0,N.jsx)(`div`,{className:`px-2 py-1.5 font-medium text-muted-foreground text-xs`,children:t.label}),(0,N.jsx)(G4,{value:r,onValueChange:n=>{te($3(e,t.id,n===`on`))},children:[`on`,`off`].map(Zme)})]})]},t.id)})}t[20]=h,t[21]=n,t[22]=i,t[23]=a,t[24]=o,t[25]=s,t[26]=c,t[27]=l,t[28]=d,t[29]=f,t[30]=m,t[31]=v,t[32]=y,t[33]=b,t[34]=x,t[35]=S,t[36]=C,t[37]=w,t[38]=T}else y=t[32],b=t[33],x=t[34],S=t[35],C=t[36],w=t[37],T=t[38];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let E;t[45]!==y||t[46]!==n||t[47]!==s||t[48]!==b||t[49]!==x?(E=x?(0,N.jsxs)(`div`,{children:[b.length>0||y.length>0?(0,N.jsx)(q4,{}):null,(0,N.jsxs)(W4,{children:[(0,N.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs`,children:`Compress`}),(0,N.jsx)(G4,{value:n,onValueChange:e=>{!e||e===n||s(e)},children:Kme.map(Qme)})]})]}):null,t[45]=y,t[46]=n,t[47]=s,t[48]=b,t[49]=x,t[50]=E):E=t[50];let ee;t[51]!==y||t[52]!==l||t[53]!==b||t[54]!==x||t[55]!==S||t[56]!==m?(ee=S?(0,N.jsxs)(`div`,{children:[b.length>0||y.length>0||x?(0,N.jsx)(q4,{}):null,(0,N.jsxs)(W4,{children:[(0,N.jsx)(`div`,{className:`px-2 pt-1.5 pb-1 font-medium text-muted-foreground text-xs`,children:`Subagents`}),(0,N.jsxs)(G4,{value:m?`on`:`off`,onValueChange:e=>{if(!e)return;let t=e===`on`;t!==m&&l?.(t)},children:[(0,N.jsx)(K4,{value:`on`,hideIndicator:!0,children:(0,N.jsx)(Q3,{label:`Without asking`,description:`Spawns one when it helps`})}),(0,N.jsx)(K4,{value:`off`,hideIndicator:!0,children:(0,N.jsx)(Q3,{label:`Only when asked`,description:`Works inline until asked`})})]})]})]}):null,t[51]=y,t[52]=l,t[53]=b,t[54]=x,t[55]=S,t[56]=m,t[57]=ee):ee=t[57];let te;return t[58]!==C||t[59]!==w||t[60]!==E||t[61]!==ee?(te=(0,N.jsxs)(N.Fragment,{children:[C,w,E,ee]}),t[58]=C,t[59]=w,t[60]=E,t[61]=ee,t[62]=te):te=t[62],te});function Yme(e){let t=!1,n=[];for(let r of e.descriptors){if(r.id===`fastMode`&&r.type===`boolean`){t=!0;continue}let i=e.ultrathinkPromptControlled&&r.id===e.primarySelectDescriptorId?`Ultrathink`:r.type===`boolean`?`${r.label} ${r.currentValue===!0?`On`:`Off`}`:kY(r);typeof i==`string`&&i.length>0&&n.push(i)}return n.length===0&&t&&!e.compressLabel?{label:e.fastModeEnabled?`Fast`:`Normal`,showFastModeIcon:!1}:(e.compressLabel&&n.push(e.compressLabel),{label:n.join(` · `),showFastModeIcon:e.fastModeEnabled})}var i6=(0,A.memo)(function(e){let t=(0,Xp.c)(72),n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13],h=t[14],g=t[15]):({provider:f,instanceId:r,models:o,model:i,prompt:d,onPromptChange:c,modelOptions:a,allowPromptInjectedEffort:p,compressMode:n,onCompressModeChange:s,unpromptedSubagents:g,onUnpromptedSubagentsChange:l,triggerVariant:h,triggerClassName:m,...u}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m,t[14]=h,t[15]=g);let _=p===void 0?!0:p,[v,y]=(0,A.useState)(!1),b,x;if(t[16]!==_||t[17]!==n||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==s||t[22]!==l||t[23]!==d||t[24]!==f||t[25]!==g){x=Symbol.for(`react.early_return_sentinel`);bb0:{let{descriptors:e,primarySelectDescriptor:t,ultrathinkPromptControlled:r,fastModeEnabled:c}=t6({provider:f,models:o,model:i,prompt:d,modelOptions:a,allowPromptInjectedEffort:_}),u=n!==void 0&&s!==void 0,p=g!==void 0&&l!==void 0&&X3(f);if(!u&&!p&&!n6({provider:f,models:o,model:i,prompt:d,modelOptions:a,allowPromptInjectedEffort:_})){x=null;break bb0}b=Yme({descriptors:e,primarySelectDescriptorId:t?.id??null,ultrathinkPromptControlled:r,fastModeEnabled:c,compressLabel:u?Z3[n].label:null})}t[16]=_,t[17]=n,t[18]=i,t[19]=a,t[20]=o,t[21]=s,t[22]=l,t[23]=d,t[24]=f,t[25]=g,t[26]=b,t[27]=x}else b=t[26],x=t[27];if(x!==Symbol.for(`react.early_return_sentinel`))return x;let{label:S,showFastModeIcon:C}=b,w;t[28]===C?w=t[29]:(w=C?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(J3,{icon:lX,className:`text-foreground/80 opacity-100`}),(0,N.jsx)(`span`,{className:`sr-only`,children:`Fast mode on`})]}):null,t[28]=C,t[29]=w);let T=w,E=f===`codex`,ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>{y(e)},t[30]=ee):ee=t[30];let te=h??`ghost`,D=E?`min-w-0 max-w-40 shrink justify-start overflow-hidden whitespace-nowrap sm:max-w-48`:`shrink-0 whitespace-nowrap`,ne;t[31]!==D||t[32]!==m?(ne=x5(D,m),t[31]=D,t[32]=m,t[33]=ne):ne=t[33];let re;t[34]!==te||t[35]!==ne?(re=(0,N.jsx)(q3,{variant:te,className:ne}),t[34]=te,t[35]=ne,t[36]=re):re=t[36];let ie;t[37]!==T||t[38]!==E||t[39]!==S?(ie=E?(0,N.jsxs)(`span`,{className:`flex min-w-0 w-full items-center gap-1.5 overflow-hidden`,children:[T,(0,N.jsx)(`span`,{className:`min-w-0 truncate`,children:S}),(0,N.jsx)(Y3,{})]}):(0,N.jsxs)(N.Fragment,{children:[T,(0,N.jsx)(`span`,{children:S}),(0,N.jsx)(Y3,{})]}),t[37]=T,t[38]=E,t[39]=S,t[40]=ie):ie=t[40];let O;t[41]!==ie||t[42]!==re?(O=(0,N.jsx)(H4,{render:re,children:ie}),t[41]=ie,t[42]=re,t[43]=O):O=t[43];let ae;t[44]===r?ae=t[45]:(ae=r?{instanceId:r}:{},t[44]=r,t[45]=ae);let oe;t[46]===n?oe=t[47]:(oe=n===void 0?{}:{compressMode:n},t[46]=n,t[47]=oe);let k;t[48]===s?k=t[49]:(k=s?{onCompressModeChange:s}:{},t[48]=s,t[49]=k);let se;t[50]===g?se=t[51]:(se=g===void 0?{}:{unpromptedSubagents:g},t[50]=g,t[51]=se);let ce;t[52]===l?ce=t[53]:(ce=l?{onUnpromptedSubagentsChange:l}:{},t[52]=l,t[53]=ce);let le;t[54]!==_||t[55]!==i||t[56]!==a||t[57]!==o||t[58]!==c||t[59]!==u||t[60]!==d||t[61]!==f||t[62]!==ae||t[63]!==oe||t[64]!==k||t[65]!==se||t[66]!==ce?(le=(0,N.jsx)(U4,{align:`start`,children:(0,N.jsx)(r6,{provider:f,...ae,models:o,model:i,prompt:d,onPromptChange:c,modelOptions:a,allowPromptInjectedEffort:_,...oe,...k,...se,...ce,...u})}),t[54]=_,t[55]=i,t[56]=a,t[57]=o,t[58]=c,t[59]=u,t[60]=d,t[61]=f,t[62]=ae,t[63]=oe,t[64]=k,t[65]=se,t[66]=ce,t[67]=le):le=t[67];let ue;return t[68]!==v||t[69]!==O||t[70]!==le?(ue=(0,N.jsxs)(V4,{open:v,onOpenChange:ee,children:[O,le]}),t[68]=v,t[69]=O,t[70]=le,t[71]=ue):ue=t[71],ue});function Xme(e){return e.setProviderModelOptions}function Zme(e){return(0,N.jsx)(K4,{value:e,hideIndicator:!0,children:(0,N.jsx)(`span`,{className:`flex w-full min-w-0 items-center justify-between gap-3`,children:(0,N.jsx)(`span`,{children:e===`on`?`On`:`Off`})})},e)}function Qme(e){let t=Z3[e];return(0,N.jsx)(K4,{value:e,hideIndicator:!0,children:(0,N.jsx)(Q3,{label:t.label,description:t.description})},e)}function $me(e){return jY(e)?`ultrathink`:`none`}function a6(e){let{provider:t,model:n,models:r,modelOptions:i,promptInjectionState:a=`none`}=e,o=DY({caps:JY(r,n,t),selections:i}),s=o.find(e=>e.type===`select`),c=OY(s??null),l=typeof c==`string`?c:null,u=(s?.promptInjectedValues?.length??0)>0&&a===`ultrathink`;return{provider:t,promptEffort:l,modelOptionsForDispatch:AY(o),...u?{composerFrameClassName:`ultrathink-frame`,composerSurfaceClassName:`shadow-[0_0_0_1px_rgba(255,255,255,0.07)_inset]`,modelPickerIconClassName:`ultrathink-chroma`}:{}}}function o6(e,t){let{provider:n,instanceId:r,threadRef:i,draftId:a,model:o,models:s,modelOptions:c,prompt:l,onPromptChange:u,compressMode:d,onCompressModeChange:f,unpromptedSubagents:p,onUnpromptedSubagentsChange:m}=t,h=i!==void 0||a!==void 0,g=d!==void 0&&f!==void 0,_=p!==void 0&&m!==void 0&&X3(n);return!h||!g&&!_&&!n6({provider:n,models:s,model:o,modelOptions:c,prompt:l})?null:(0,N.jsx)(e,{provider:n,...r?{instanceId:r}:{},models:s,...i?{threadRef:i}:{},...a?{draftId:a}:{},model:o,modelOptions:c,prompt:l,onPromptChange:u,...d===void 0?{}:{compressMode:d},...f?{onCompressModeChange:f}:{},...p===void 0?{}:{unpromptedSubagents:p},...m?{onUnpromptedSubagentsChange:m}:{}})}function ehe(e){return o6(r6,e)}function the(e){return o6(i6,e)}var nhe={instanceId:SO.make(`p4code_no_provider`),model:``};function s6(e){return e.enabled&&e.isAvailable&&e.status===`ready`}function rhe(e){return e.enabled}function ihe(e){let t=[];for(let n of e.replace(/[_-]+/g,` `).replace(/([a-z])([A-Z])/g,`$1 $2`).split(` `))n.length!==0&&t.push(n.charAt(0).toUpperCase()+n.slice(1));return t.join(` `)}function ahe(e){return KO[e]??HY(e)}function c6(e){let t=e?.trim();if(t)return/^#[0-9a-fA-F]{6}$/u.test(t)?t:void 0}function ohe(e,t,n,r){let i=e.displayName?.trim(),a=ahe(n);if(i&&i!==a)return i;if(!r){let e=ihe(t);if(e.length>0)return e}return i||a}function l6(e){return e.map(e=>{let t=e.instanceId,n=e.driver,r=t===TO(n);return{instanceId:t,driverKind:n,displayName:ohe(e,t,n,r),accentColor:c6(e.accentColor),continuationGroupKey:e.continuation?.groupKey,enabled:e.enabled,installed:e.installed,status:e.status,isDefault:r,isAvailable:e.availability!==`unavailable`,snapshot:e,models:e.models}})}function she(e,t){let n=t.providers;return e.map(e=>{let r=t.providerInstances?.[e.instanceId],i=r?r.enabled??!0:e.isDefault?n[e.driverKind]?.enabled??e.enabled:!1;return i===e.enabled?e:{...e,enabled:i}})}function che(e){let t=new Map;for(let n of e){let e=t.get(n.driverKind);e?e.push(n):t.set(n.driverKind,[n])}let n=[];for(let e of t.values()){let t=e.filter(e=>e.isDefault),r=e.filter(e=>!e.isDefault);n.push(...t,...r)}return n}function lhe(e,t){return l6(e).find(e=>e.instanceId===t)}function uhe(e,t){let n=lhe(e,t);if(n)return n.models.find(e=>e.isDefault&&!e.isCustom)?.slug??n.models.find(e=>!e.isCustom)?.slug??n.models[0]?.slug??UO[n.driverKind]}var u6=e=>e.enabled&&e.isAvailable;function d6(e,t){if(t!==void 0){let n=e.find(e=>e.instanceId===t);if(n&&u6(n))return n}return e.find(s6)??e.find(e=>u6(e)&&e.status!==`error`)}function dhe(e,t){return d6(l6(e),t)?.instanceId}function fhe(e,t){let n=dhe(e,t?.instanceId);if(n===void 0)return null;if(t?.instanceId===n)return t;let r=uhe(e,n);return r?{instanceId:n,model:r}:null}function phe(e,t,n){let r=e.find(e=>e.instanceId===n);if(r)return r.driverKind}function f6(e,t){return`${e}:${t}`}function p6(e){return new Map(ha(e,(e,t)=>[e,t]))}function m6(e){return e instanceof Set?e:new Set(e??[])}function h6(e){return Er(xr,t=>e(t)??1/0)}function g6(e){return Er(Cr(Sr),e)}function _6(e,t){let n=t?.modelOrder??[],r=m6(t?.favoriteModels),i=p6(n),a=p6(ha(e,e=>e.slug));return ua(e,Tr([...t?.groupFavorites===!0?[g6(e=>r.has(e.slug))]:[],h6(e=>i.get(e.slug)),h6(e=>a.get(e.slug))]))}function mhe(e,t){let n=m6(t?.favoriteModelKeys),r=new Map(ha(t?.instanceOrder??[],(e,t)=>[e,t])),i=p6(ha(e,e=>f6(e.instanceId,e.slug)));return ua(e,Tr([...t?.groupFavorites===!0?[g6(e=>n.has(f6(e.instanceId,e.slug)))]:[],h6(e=>r.get(e.instanceId)),h6(e=>i.get(f6(e.instanceId,e.slug)))]))}var hhe=32,ghe=SO.make(`codex`);function v6(e,t,n){let r=e.providerInstances?.[t]?.config;if(typeof r==`object`&&r){let e=r.customModels;if(Array.isArray(e))return e.filter(e=>typeof e==`string`)}return t===TO(n)?e.providers[n]?.customModels??[]:[]}function y6(e){let t={slug:e.slug,name:e.name,isCustom:e.isCustom};return e.shortName&&(t.shortName=e.shortName),e.subProvider&&(t.subProvider=e.subProvider),e.isDefault&&(t.isDefault=!0),t}function b6(e,t){return e.providerModelPreferences?.[t]??{hiddenModels:[],modelOrder:[]}}function x6(e,t){let n=new Set(t.hiddenModels);return _6(e.filter(e=>e.isCustom||!n.has(e.slug)),{modelOrder:t.modelOrder})}function S6(e,t){let n=[],r=new Set;for(let i of e){let e=NY(i);if(!(!e||e.length>256||t.has(e)||r.has(e))&&(r.add(e),n.push(e),n.length>=hhe))break}return n}function _he(e,t,n,r){let i=UY(t,n).map(y6),a=new Set(i.map(e=>e.slug)),o=new Set(ga(UY(t,n),e=>e.isCustom?Wi:Hi(e.slug))),s=TO(n),c=v6(e,s,n);for(let e of S6(c,o))a.has(e)||(a.add(e),i.push({slug:e,name:e,isCustom:!0}));return x6(i,b6(e,s))}function C6(e,t){let n=t.models.map(y6),r=new Set(n.map(e=>e.slug)),i=new Set(ga(t.models,e=>e.isCustom?Wi:Hi(e.slug))),a=v6(e,t.instanceId,t.driverKind);for(let e of S6(a,i))r.has(e)||(r.add(e),n.push({slug:e,name:e,isCustom:!0}));return x6(n,b6(e,t.instanceId))}function w6(e,t,n,r){let i=qY(n,e);return PY(i,r,_he(t,n,i,r))??YY(n,i)}function T6(e,t,n,r){let i=l6(n).find(t=>t.instanceId===e);if(!i)return null;let a=C6(t,i);return PY(i.driverKind,r,a)??a.find(e=>e.isDefault)?.slug??a[0]?.slug??i.models.find(e=>e.isDefault)?.slug??i.models[0]?.slug??null}function vhe(e,t,n,r){let i=new Map;for(let n of l6(t))i.set(n.instanceId,C6(e,n));return i}function yhe(e,t){let n=e.textGenerationModelSelection??{instanceId:ghe,model:`gpt-5.6-luna`},r=l6(t),i=r.find(e=>e.instanceId===n.instanceId&&e.enabled&&e.isAvailable),a=i??r.find(e=>e.enabled&&e.isAvailable);if(a){let r=i?n.model:null,o=T6(a.instanceId,e,t,r)??a.models[0]?.slug??WO[a.driverKind];if(!o)return LY(a.instanceId,``,[]);let s=a.driverKind,{modelOptionsForDispatch:c}=a6({provider:s,model:o,models:a.models,modelOptions:i?n.options:void 0});return LY(a.instanceId,o,c)}let o=qY(t,null),s=w6(o,e,t,null),{modelOptionsForDispatch:c}=a6({provider:o,model:s,models:UY(t,o),modelOptions:void 0});return LY(TO(o),s,c)}var E6=`full-access`,D6=`default`,bhe=`full`,xhe=`term-1`,She=4e3,Che=4e3,O6=24,whe=/\n*<element_context>\n([\s\S]*?)\n<\/element_context>\s*$/;function k6(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1))}…`}function A6(e){return e.replace(/\r\n/g,`
|
|
22
|
-
`).replace(/^\n+|\n+$/g,``)}function The(e){let t=e.pageUrl.trim(),n=e.tagName.trim().toLowerCase();if(t.length===0||n.length===0)return null;let r=e.source??e.stack[0]??null;return{pageUrl:t,pageTitle:e.pageTitle?.trim()??null,tagName:n,selector:e.selector?.trim()||null,htmlPreview:k6(A6(e.htmlPreview),She),componentName:e.componentName?.trim()||null,source:r?{functionName:r.functionName?.trim()||null,fileName:r.fileName?.trim()||null,lineNumber:r.lineNumber??null,columnNumber:r.columnNumber??null}:null,styles:k6(A6(e.styles),Che)}}function j6(e){return[e.pageUrl,e.selector??``,e.tagName,e.componentName??``].join(`|`).toLowerCase()}function Ehe(e){return e.length<=O6?e:`${e.slice(0,O6-1)}…`}function M6(e){return e.componentName?`<${e.componentName}>`:`<${Ehe(e.tagName)}>`}function Dhe(e){let t=e.split(/[\\/]/);return t[t.length-1]??e}function N6(e){let t=e.source;if(!t?.fileName)return null;let n=Dhe(t.fileName);return t.lineNumber==null?n:`${n}:${t.lineNumber}`}function Ohe(e){let t=M6(e),n=N6(e);return n?`${t} (${n})`:t}function P6(e){return e.split(`
|
|
23
|
-
`).map(e=>` ${e}`)}function khe(e){let t=[];if(t.push(`- ${Ohe(e)}:`),e.pageUrl.length>0&&t.push(` url: ${e.pageUrl}`),e.selector&&t.push(` selector: ${e.selector}`),e.source?.fileName){let{fileName:n,lineNumber:r,columnNumber:i}=e.source,a=r==null?n:`${n}:${r}${i==null?``:`:${i}`}`;t.push(` source: ${a}`)}let n=e.htmlPreview.trim();n.length>0&&(t.push(` html:`),t.push(...P6(n)));let r=e.styles.trim();return r.length>0&&(t.push(` styles:`),t.push(...P6(r))),t}function F6(e){if(e.length===0)return``;let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];t.push(...khe(r)),n<e.length-1&&t.push(``)}return[`<element_context>`,...t,`</element_context>`].join(`
|
|
24
|
-
`)}function Ahe(e,t){let n=F6(t);if(n.length===0)return e;let r=e.trim();return r.length>0?`${r}\n\n${n}`:n}var jhe=`el_`,I6=0;function Mhe(){return I6+=1,`${jhe}${I6.toString(36)}`}function L6(e){let t=whe.exec(e);if(!t)return{promptText:e,contextCount:0,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,``),r=Nhe(t[1]??``);return{promptText:n,contextCount:r.length,contexts:r}}function Nhe(e){let t=[],n=null,r=()=>{n&&=(t.push({header:n.header,body:n.bodyLines.join(`
|
|
25
|
-
`).trimEnd()}),null)};for(let t of e.split(`
|
|
26
|
-
`)){let e=/^- (.+):$/.exec(t);if(e){r(),n={header:e[1],bodyLines:[]};continue}n&&(t.startsWith(` `)?n.bodyLines.push(t.slice(2)):t.length===0&&n.bodyLines.push(``))}return r(),t}var Phe=/\n*<terminal_context>\n([\s\S]*?)\n<\/terminal_context>\s*$/;function R6(e){return e.replace(/\r\n/g,`
|
|
27
|
-
`).replace(/^\n+|\n+$/g,``)}function z6(e){return R6(e.text).length>0}function Fhe(e){return!z6(e)}function Ihe(e){return e.filter(e=>z6(e))}function Lhe(e){let t=R6(e.text),n=e.terminalId.trim(),r=e.terminalLabel.trim();if(t.length===0||n.length===0||r.length===0)return null;let i=Math.max(1,Math.floor(e.lineStart));return{terminalId:n,terminalLabel:r,lineStart:i,lineEnd:Math.max(i,Math.floor(e.lineEnd)),text:t}}function Rhe(e){return e.lineStart===e.lineEnd?`line ${e.lineStart}`:`lines ${e.lineStart}-${e.lineEnd}`}function B6(e){return`${e.terminalLabel} ${Rhe(e)}`}function V6(e){return`@${e.terminalLabel.trim().toLowerCase().replace(/\s+/g,`-`)}:${e.lineStart===e.lineEnd?`${e.lineStart}`:`${e.lineStart}-${e.lineEnd}`}`}function zhe(e){return R6(e.text).split(`
|
|
28
|
-
`).map((t,n)=>` ${e.lineStart+n} | ${t}`)}function Bhe(e){let t=[];for(let n of e){let e=Lhe(n);e!==null&&t.push(e)}if(t.length===0)return``;let n=[];for(let e=0;e<t.length;e+=1){let r=t[e];n.push(`- ${B6(r)}:`),n.push(...zhe(r)),e<t.length-1&&n.push(``)}return[`<terminal_context>`,...n,`</terminal_context>`].join(`
|
|
29
|
-
`)}function Vhe(e,t){let n=0,r=``;for(let i of e){if(i!==``){r+=i;continue}let e=t[n]??null;n+=1,e&&(r+=V6(e))}return r}function Hhe(e,t){let n=Vhe(e,t).trim(),r=Bhe(t);return r.length===0?n:n.length>0?`${n}\n\n${r}`:r}function Uhe(e){let t=Phe.exec(e);if(!t)return{promptText:e,contextCount:0,previewTitle:null,contexts:[]};let n=e.slice(0,t.index).replace(/\n+$/,``),r=Ghe(t[1]??``);return{promptText:n,contextCount:r.length,previewTitle:r.length>0?r.map(({header:e,body:t})=>t.length>0?`${e}\n${t}`:e).join(`
|
|
30
|
-
|
|
31
|
-
`):null,contexts:r}}function Whe(e){let t=L6(e),n=Uhe(t.promptText);return{visibleText:n.promptText,copyText:e,contextCount:n.contextCount,previewTitle:n.previewTitle,contexts:n.contexts,elementContexts:t.contexts}}function Ghe(e){let t=[],n=null,r=()=>{n&&=(t.push({header:n.header,body:n.bodyLines.join(`
|
|
32
|
-
`).trimEnd()}),null)};for(let t of e.split(`
|
|
33
|
-
`)){let e=/^- (.+):$/.exec(t);if(e){r(),n={header:e[1],bodyLines:[]};continue}if(n){if(t.startsWith(` `)){n.bodyLines.push(t.slice(2));continue}t.length===0&&n.bodyLines.push(``)}}return r(),t}function H6(e){let t=0;for(let n of e)n===``&&(t+=1);return t}function U6(e,t){let n=t-H6(e);return n<=0?e:`${``.repeat(n)}${e}`}function Khe(e){return e===void 0||e===` `||e===`
|
|
34
|
-
`||e===` `||e===`\r`}function qhe(e,t){let n=Math.max(0,Math.min(e.length,Math.floor(t))),r=`${Khe(e[n-1])?``:` `} `,i=e[n]===` `?n+1:n;return{prompt:`${e.slice(0,n)}${r}${e.slice(i)}`,cursor:n+r.length,contextIndex:H6(e.slice(0,n))}}function Jhe(e){return e.replaceAll(``,``)}function Yhe(e,t){if(t<0)return{prompt:e,cursor:e.length};let n=0;for(let r=0;r<e.length;r+=1)if(e[r]===``){if(n===t)return{prompt:e.slice(0,r)+e.slice(r+1),cursor:r};n+=1}return{prompt:e,cursor:e.length}}var W6=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Xhe=(e=>e?W6(e):W6),Zhe=e=>e;function Qhe(e,t=Zhe){let n=A.useSyncExternalStore(e.subscribe,A.useCallback(()=>t(e.getState()),[e,t]),A.useCallback(()=>t(e.getInitialState()),[e,t]));return A.useDebugValue(n),n}var G6=e=>{let t=Xhe(e),n=e=>Qhe(t,e);return Object.assign(n,t),n},K6=(e=>e?G6(e):G6);function q6(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var J6=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return J6(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return J6(t)(e)}}}},Y6=(e,t)=>(n,r,i)=>{let a={storage:q6(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,l=new Set,u=a.storage;if(!u)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let d=()=>{let e=a.partialize({...r()});return u.setItem(a.name,{state:e,version:a.version})},f=i.setState;i.setState=(e,t)=>(f(e,t),d());let p=e((...e)=>(n(...e),d()),r,i);i.getInitialState=()=>p;let m,h=()=>{if(!u)return;let e=++s;o=!1,c.forEach(e=>e(r()??p));let t=a.onRehydrateStorage?.call(a,r()??p)||void 0;return J6(u.getItem.bind(u))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}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(t=>{if(e!==s)return;let[i,o]=t;if(m=a.merge(o,r()??p),n(m,!0),i)return d()}).then(()=>{e===s&&(t?.(r(),void 0),m=r(),o=!0,l.forEach(e=>e(m)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{u?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(l.add(e),()=>{l.delete(e)})},a.skipHydration||h(),m||p},X6=e=>Symbol.iterator in e,Z6=e=>`entries`in e,Q6=(e,t)=>{let 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(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},$he=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function ege(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:X6(e)&&X6(t)?Z6(e)&&Z6(t)?Q6(e,t):$he(e,t):Q6({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function $6(e){let t=A.useRef(void 0);return n=>{let r=e(n);return ege(t.current,r)?t.current:t.current=r}}function tge(e){return typeof e==`function`}function e8(e,...t){return tge(e)?e(...t):e}var nge=class{#e=!0;#t;#n;#r;#i;#a;#o;#s;#c=0;#l=5;#u=!1;#d=!1;#f=null;#p=()=>{this.debugLog(`Connected to event bus`),this.#a=!0,this.#u=!1,this.debugLog(`Emitting queued events`,this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener(`tanstack-connect-success`,this.#p)};#m=()=>{if(this.#c<this.#l){this.#c++,this.dispatchCustomEvent(`tanstack-connect`,{});return}this.#n().removeEventListener(`tanstack-connect`,this.#m),this.#d=!0,this.debugLog(`Max retries reached, giving up on connection`),this.stopConnectLoop()};#h=()=>{this.#u||(this.#u=!0,this.#n().addEventListener(`tanstack-connect-success`,this.#p),this.#m())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(` Initializing event subscription for plugin`,this.#t),this.#i=[],this.#a=!1,this.#d=!1,this.#o=null,this.#s=r}startConnectLoop(){this.#o!==null||this.#a||(this.debugLog(`Starting connect loop (every ${this.#s}ms)`),this.#o=setInterval(this.#m,this.#s))}stopConnectLoop(){this.#u=!1,this.#o!==null&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog(`Stopped connect loop`))}debugLog(...e){this.#r&&console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if(typeof globalThis<`u`&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog(`Using global event target`),globalThis.__TANSTACK_EVENT_TARGET__;if(typeof window<`u`&&window.addEventListener!==void 0)return this.debugLog(`Using window as event target`),window;let e=typeof EventTarget<`u`?new EventTarget:void 0;return e===void 0||e.addEventListener===void 0?(this.debugLog(`No event mechanism available, running in non-web environment`),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog(`Using new EventTarget as fallback`),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch{this.debugLog(`Failed to dispatch shim event`)}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch{this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog(`Emitting event to client bus`,e),this.dispatchCustomEvent(`tanstack-dispatch-event`,e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e){this.debugLog(`Event bus client is disabled, not emitting event`,e,t);return}if(this.#f&&(this.debugLog(`Emitting event to internal event target`,e,t),this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d){this.debugLog(`Previously failed to connect, not emitting to bus`);return}if(!this.#a){this.debugLog(`Bus not available, will be pushed as soon as connected`),this.#i.push(this.createEventPayload(e,t)),typeof CustomEvent<`u`&&!this.#u&&(this.#h(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#f||=new EventTarget,this.#f.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`,i),()=>{};let a=e=>{this.debugLog(`Received event from bus`,e.detail),t(e.detail)};return this.#n().addEventListener(i,a),this.debugLog(`Registered event to bus`,i),()=>{r&&this.#f?.removeEventListener(i,a),this.#n().removeEventListener(i,a)}}onAll(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog(`Event bus client is disabled, not registering event`),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener(`tanstack-devtools-global`,t),()=>this.#n().removeEventListener(`tanstack-devtools-global`,t)}},rge=class extends nge{constructor(e){super({pluginId:`pacer`,debug:e?.debug})}},ige=(e,t)=>{t.key&&t8.emit(e,t)},t8=new rge,n8=new WeakMap,r8=new WeakMap,i8={current:[]},a8=!1,o8=0,s8=new Set,c8=new Map;function l8(e){let t=Array.from(e).sort((e,t)=>e instanceof d8&&e.options.deps.includes(t)?1:t instanceof d8&&t.options.deps.includes(e)?-1:0);for(let e of t){if(i8.current.includes(e))continue;i8.current.push(e),e.recompute();let t=r8.get(e);if(t)for(let e of t){let t=n8.get(e);t&&l8(t)}}}function age(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function oge(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function sge(e){if(o8>0&&!c8.has(e)&&c8.set(e,e.prevState),s8.add(e),!(o8>0)&&!a8)try{for(a8=!0;s8.size>0;){let e=Array.from(s8);s8.clear();for(let t of e)t.prevState=c8.get(t)??t.prevState,age(t);for(let t of e){let e=n8.get(t);e&&(i8.current.push(t),l8(e))}for(let t of e){let e=n8.get(t);if(e)for(let t of e)oge(t)}}}finally{a8=!1,i8.current=[],c8.clear()}}function cge(e){return typeof e==`function`}var u8=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):cge(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),sge(this)}},d8=class e{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=this.options.deps.length,t=Array(e),n=Array(e);for(let r=0;r<e;r++){let e=this.options.deps[r];t[r]=e.prevState,n[r]=e.state}return this.lastSeenDepValues=n,{prevDepVals:t,currDepVals:n,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let n=this.getDepVals();this.state=this.options.fn(n),(t=(e=this.options).onUpdate)==null||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let t of this.options.deps)t instanceof e&&t.checkIfRecalculationNeededDeeply();let t=!1,n=this.lastSeenDepValues,{currDepVals:r}=this.getDepVals();for(let e=0;e<r.length;e++)if(r[e]!==n[e]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(let e of this._subscriptions)e()}),this.subscribe=e=>{var t;this.listeners.add(e);let n=(t=this.options).onSubscribe?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(let n of t)if(n instanceof e)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof u8){let e=n8.get(n);e||(e=new Set,n8.set(n,e)),e.add(this);let t=r8.get(this);t||(t=new Set,r8.set(this,t)),t.add(n)}}unregisterFromGraph(t=this.options.deps){for(let n of t)if(n instanceof e)this.unregisterFromGraph(n.options.deps);else if(n instanceof u8){let e=n8.get(n);e&&e.delete(this);let t=r8.get(this);t&&t.delete(n)}}};function f8(){return{canLeadingExecute:!0,executionCount:0,isPending:!1,lastArgs:void 0,status:`idle`,maybeExecuteCount:0}}var lge={enabled:!0,leading:!1,trailing:!0,wait:0},p8=class{#e;constructor(e,t){this.fn=e,this.store=new u8(f8()),this.setOptions=e=>{this.options={...this.options,...e},this.#n()||this.cancel()},this.maybeExecute=(...e)=>{if(!this.#n())return;this.#t({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=!1;this.options.leading&&this.store.state.canLeadingExecute&&(this.#t({canLeadingExecute:!1}),t=!0,this.#i(...e)),this.options.trailing&&this.#t({isPending:!0,lastArgs:e}),this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{this.#t({canLeadingExecute:!0}),this.options.trailing&&!t&&this.#i(...e)},this.#r())},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&(this.#a(),this.#i(...this.store.state.lastArgs))},this.cancel=()=>{this.#a(),this.#t({canLeadingExecute:!0,isPending:!1})},this.reset=()=>{this.#t(f8())},this.key=t.key,this.options={...lge,...t},this.#t(this.options.initialState??{}),this.key&&t8.on(`d-Debouncer`,e=>{e.payload.key===this.key&&(this.#t(e.payload.store.state),this.setOptions(e.payload.options))})}#t=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#n()?r?`pending`:`idle`:`disabled`}}),ige(`Debouncer`,this)};#n=()=>!!e8(this.options.enabled,this);#r=()=>e8(this.options.wait,this);#i=(...e)=>{this.#n()&&(this.fn(...e),this.#t({executionCount:this.store.state.executionCount+1,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this))};#a=()=>{this.#e&&=(clearTimeout(this.#e),void 0)}};function m8(){let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}function uge(e){return e!=null&&typeof e.getItem==`function`&&typeof e.setItem==`function`&&typeof e.removeItem==`function`}function h8(e){return uge(e)?e:m8()}function dge(e,t=300){let n=h8(e),r=new p8((e,t)=>{n.setItem(e,t)},{wait:t});return{getItem:e=>n.getItem(e),setItem:(e,t)=>{r.maybeExecute(e,t)},removeItem:e=>{r.cancel(),n.removeItem(e)},flush:()=>{r.flush()}}}var g8=z({id:L,sectionId:L,sectionTitle:L,filePath:L,startIndex:Ny,endIndex:Ny,rangeLabel:L,text:L,diff:L,fenceLanguage:F(L)}),fge=/<review_comment\b([^>]*)>\s*([\s\S]*?)<\/review_comment>/g,pge=/([a-zA-Z][a-zA-Z0-9_-]*)="([^"]*)"/g,mge=/(`{3,})([^\s`]*)[^\n]*\n([\s\S]*?)\n\1/g;function _8(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function hge(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/&/g,`&`)}function gge(e){let t={};for(let n of e.matchAll(pge))t[n[1]]=hge(n[2]??``);return t}function v8(e){return e===void 0||!/^\d+$/.test(e)?null:Number(e)}function _ge(e){let t=Array.from(e.matchAll(mge)).at(-1),n=t?.index;return{text:e.slice(0,n??e.length).trim(),language:t?.[2]?.trim()||`diff`,contents:t?.[3]??``}}function vge(e,t,n){let r=gge(e),i=v8(r.startIndex),a=v8(r.endIndex),o=r.filePath?.trim(),s=r.sectionId?.trim();if(!o||!s||i===null||a===null)return null;let c=_ge(t);return{id:`review-comment:${n}:${s}:${o}:${i}:${a}`,sectionId:s,sectionTitle:r.sectionTitle?.trim()||`Review`,filePath:o,startIndex:Math.min(i,a),endIndex:Math.max(i,a),rangeLabel:r.rangeLabel?.trim()||`line`,text:c.text,diff:c.contents,fenceLanguage:c.language}}function yge(e){let t=[],n=0,r=0;for(let i of e.matchAll(fge)){let a=i.index??0,o=e.slice(n,a);o.length>0&&t.push({kind:`text`,id:`review-comment-text:${n}`,text:o});let s=vge(i[1]??``,i[2]??``,r);s?(t.push({kind:`review-comment`,comment:s}),r+=1):t.push({kind:`text`,id:`review-comment-invalid:${a}`,text:i[0]}),n=a+i[0].length}let i=e.slice(n);return i.length>0&&t.push({kind:`text`,id:`review-comment-text:${n}`,text:i}),t}function y8(e,t){let n=Math.max(0,...Array.from(t.matchAll(/`+/g),e=>e[0].length)),r="`".repeat(Math.max(3,n+1));return[`${r}${e}`,t.trimEnd(),r].join(`
|
|
35
|
-
`)}function bge(e){return[[`<review_comment`,` sectionId="${_8(e.sectionId)}"`,` sectionTitle="${_8(e.sectionTitle)}"`,` filePath="${_8(e.filePath)}"`,` startIndex="${e.startIndex}"`,` endIndex="${e.endIndex}"`,` rangeLabel="${_8(e.rangeLabel)}"`,`>`].join(``),e.text.trim(),y8(e.fenceLanguage??`diff`,e.diff),`</review_comment>`].join(`
|
|
36
|
-
`)}function xge(e,t){let n=t.map(bge);if(n.length===0)return e;let r=e.trim();return r.length>0?`${r}\n\n${n.join(`
|
|
37
|
-
|
|
38
|
-
`)}`:n.join(`
|
|
39
|
-
|
|
40
|
-
`)}function Sge(e){let t=Math.max(1,Math.min(e.startLine,e.endLine)),n=Math.max(t,Math.max(e.startLine,e.endLine)),r=e.contents.split(`
|
|
41
|
-
`).slice(t-1,n);return{id:e.id,sectionId:`file:${e.filePath}`,sectionTitle:`File comment`,filePath:e.filePath,startIndex:t-1,endIndex:n-1,rangeLabel:t===n?`L${t}`:`L${t} to L${n}`,text:e.text.trim(),diff:r.join(`
|
|
42
|
-
`),fenceLanguage:Cge(e.filePath)}}function Cge(e){let t=e.replaceAll(`\\`,`/`),n=t.slice(t.lastIndexOf(`/`)+1).toLowerCase(),r=n.lastIndexOf(`.`);return r>0&&r<n.length-1?n.slice(r+1):n.startsWith(`.`)&&n.length>1?n.slice(1):`text`}function b8(e){return e.endsWith(`
|
|
43
|
-
`)?e.slice(0,-1):e}function x8(e){let t=[];for(let n of e.hunks){let r=n.deletionStart,i=n.additionStart,a=n.deletionLineIndex,o=n.additionLineIndex;for(let s of n.hunkContent){if(s.type===`context`){for(let n=0;n<s.lines;n+=1)t.push({change:`context`,oldLineNumber:r,newLineNumber:i,content:b8(e.additionLines[o]??e.deletionLines[a]??``)}),r+=1,i+=1,a+=1,o+=1;continue}for(let n=0;n<s.deletions;n+=1)t.push({change:`delete`,oldLineNumber:r,newLineNumber:null,content:b8(e.deletionLines[a]??``)}),r+=1,a+=1;for(let n=0;n<s.additions;n+=1)t.push({change:`add`,oldLineNumber:null,newLineNumber:i,content:b8(e.additionLines[o]??``)}),i+=1,o+=1}}return t}function S8(e){return e.change===`delete`&&e.oldLineNumber!==null?{lineNumber:e.oldLineNumber,side:`deletions`}:e.newLineNumber===null?e.oldLineNumber===null?null:{lineNumber:e.oldLineNumber,side:`deletions`}:{lineNumber:e.newLineNumber,side:`additions`}}function wge(e,t){let n=x8(e),r=n[t.startIndex],i=n[t.endIndex];if(!r||!i)return null;let a=S8(r),o=S8(i);return!a||!o?null:{start:a.lineNumber,side:a.side,end:o.lineNumber,endSide:o.side}}function C8(e,t,n){let r=n===`deletions`?`oldLineNumber`:`newLineNumber`,i=e.findIndex(e=>e[r]===t);if(i>=0)return i;let a=r===`oldLineNumber`?`newLineNumber`:`oldLineNumber`;return e.findIndex(e=>e[a]===t)}function w8(e,t){let n=e.filter(e=>e[t]!==null);return{start:n[0]?.[t]??0,count:n.length}}function T8(e){return e===`add`?`+`:e===`delete`?`-`:` `}function Tge(e){let t=e[0],n=e.at(-1);if(!t||!n)return`line`;let r=t.newLineNumber??t.oldLineNumber,i=n.newLineNumber??n.oldLineNumber;if(r===null||i===null)return e.length===1?`line`:`${e.length} lines`;let a=T8(t.change).trim(),o=a.length>0&&e.every(e=>e.change===t.change)?a:``;return r===i?`${o}${r}`:`${o}${r} to ${o}${i}`}function Ege(e){let t=x8(e.fileDiff),n=C8(t,e.range.start,e.range.side),r=C8(t,e.range.end,e.range.endSide??e.range.side);if(n<0||r<0)return null;let i=Math.min(n,r),a=Math.max(n,r),o=t.slice(i,a+1),s=w8(o,`oldLineNumber`),c=w8(o,`newLineNumber`);return{id:e.id,sectionId:e.sectionId,sectionTitle:e.sectionTitle,filePath:e.filePath,startIndex:i,endIndex:a,rangeLabel:Tge(o),text:e.text.trim(),diff:[`@@ -${s.start},${s.count} +${c.start},${c.count} @@`,...o.map(e=>`${T8(e.change)}${e.content}`)].join(`
|
|
44
|
-
`),fenceLanguage:`diff`}}function Dge(e){if((e.fenceLanguage??`diff`)!==`diff`)return``;let t=e.diff.trim();if(t.length===0)return``;if(t.startsWith(`diff --git `))return t;let n=e.filePath.replaceAll(`\\`,`/`);return[`diff --git a/${n} b/${n}`,`--- a/${n}`,`+++ b/${n}`,t].join(`
|
|
45
|
-
`)}var E8=gy(QO),Oge=gy(yO),D8=gy(g8),O8=`p4code:composer-drafts:v1`,k8=8,kge=H([`local`,`worktree`]),A8=L.pipe(Uy(`DraftId`)),j8=dge(typeof localStorage<`u`?localStorage:m8(),300);typeof window<`u`&&typeof window.addEventListener==`function`&&window.addEventListener(`beforeunload`,()=>{j8.flush()});var M8=z({id:L,name:L,mimeType:L,sizeBytes:Ny,dataUrl:L}),Age=z({id:L,threadId:Y,createdAt:L,terminalId:L,terminalLabel:L,lineStart:Ny,lineEnd:Ny}),jge=z({functionName:U(L),fileName:U(L),lineNumber:U(Ny),columnNumber:U(Ny)}),Mge=z({id:L,threadId:Y,pickedAt:L,pageUrl:L,pageTitle:U(L),tagName:L,selector:U(L),htmlPreview:L,componentName:U(L),source:U(jge),styles:L}),Nge=z({prompt:L,attachments:B(M8),terminalContexts:P(B(Age)),elementContexts:P(B(Mge)),previewAnnotations:P(B(Yse)),reviewComments:P(B(g8)),modelSelectionByProvider:P(Iy(SO,ZO)),activeProvider:P(U(SO)),runtimeMode:P(QO),interactionMode:P(ek),compressMode:P(nk),unpromptedSubagents:P(R)}),Pge=z({threadId:Y,environmentId:L,projectId:Jb,logicalProjectKey:P(L),createdAt:L,runtimeMode:QO,interactionMode:ek,branch:U(L),worktreePath:U(L),envMode:kge,startFromOrigin:R.pipe(W(M(!1))),promotedTo:P(U(z({environmentId:L,threadId:L})))}),Fge=z({version:Ny,state:z({draftsByThreadKey:Iy(L,Nge),draftThreadsByThreadKey:Iy(L,Pge),logicalProjectDraftThreadKeyByLogicalProjectKey:Iy(L,L),stickyModelSelectionByProvider:P(Iy(SO,ZO)),stickyActiveProvider:P(U(SO))})});function N8(e){if(!e)return null;let t=e.options;return!t||t.length===0?null:{[e.instanceId]:t}}function Ige(e){if(!e)return null;let t={};for(let[n,r]of Object.entries(e))r?.options&&r.options.length>0&&(t[n]=r.options);return Object.keys(t).length>0?t:null}function Lge(e){return{...e,...e.options?{options:e.options.map(e=>({...e}))}:{}}}function P8(e){let t=[];for(let[n,r]of Object.entries(e))r!==void 0&&t.push([n,Lge(r)]);return Object.fromEntries(t)}var F8=Object.freeze({draftsByThreadKey:{},draftThreadsByThreadKey:{},logicalProjectDraftThreadKeyByLogicalProjectKey:{},stickyModelSelectionByProvider:{},stickyActiveProvider:null}),I8=[],L8=[],R8=[],Rge=[],z8=[],B8=[],V8=[];Object.freeze(I8),Object.freeze(L8),Object.freeze(R8),Object.freeze(z8),Object.freeze(B8),Object.freeze(V8);var H8=Object.freeze({}),zge=Object.freeze({activeProvider:null,modelSelectionByProvider:H8}),Bge=Object.freeze({prompt:``,images:I8,nonPersistedImageIds:L8,persistedAttachments:R8,terminalContexts:Rge,elementContexts:z8,previewAnnotations:B8,reviewComments:V8,modelSelectionByProvider:H8,activeProvider:null,runtimeMode:null,interactionMode:null,compressMode:null,unpromptedSubagents:null});function U8(){return{prompt:``,images:[],nonPersistedImageIds:[],persistedAttachments:[],terminalContexts:[],elementContexts:[],previewAnnotations:[],reviewComments:[],modelSelectionByProvider:{},activeProvider:null,runtimeMode:null,interactionMode:null,compressMode:null,unpromptedSubagents:null}}function W8(e){return`${e.mimeType}\u0000${e.sizeBytes}\u0000${e.name}`}function G8(e){return`${e.terminalId}\u0000${e.lineStart}\u0000${e.lineEnd}`}function K8(e,t){let n=t.terminalId.trim(),r=t.terminalLabel.trim();if(n.length===0||r.length===0)return null;let i=Math.max(1,Math.floor(t.lineStart)),a=Math.max(i,Math.floor(t.lineEnd));return{...t,threadId:e,terminalId:n,terminalLabel:r,lineStart:i,lineEnd:a,text:R6(t.text)}}function q8(e,t){let n=new Set,r=new Set,i=[];for(let a of t){let t=K8(e,a);if(!t)continue;let o=G8(t);n.has(t.id)||r.has(o)||(i.push(t),n.add(t.id),r.add(o))}return i}function J8(e){return e.prompt.length===0&&e.images.length===0&&e.persistedAttachments.length===0&&e.terminalContexts.length===0&&e.elementContexts.length===0&&e.previewAnnotations.length===0&&e.reviewComments.length===0&&Object.keys(e.modelSelectionByProvider).length===0&&e.activeProvider===null&&e.runtimeMode===null&&e.interactionMode===null&&e.compressMode===null&&e.unpromptedSubagents===null}function Y8(e){return Oge(e)?e:null}var Vge=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/;function X8(e){return typeof e!=`string`||!Vge.test(e)?null:e}function Z8(e){if(Array.isArray(e)){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n,r=e.id,i=e.value;typeof r!=`string`||r.length===0||(typeof i==`string`||typeof i==`boolean`)&&t.push({id:r,value:i})}return t.length>0?t:void 0}if(e&&typeof e==`object`){let t=e,n=[];for(let[e,r]of Object.entries(t))(typeof r==`string`||typeof r==`boolean`)&&n.push({id:e,value:r});return n.length>0?n:void 0}}function Q8(e,t,n){let r=e&&typeof e==`object`?e:null,i={};for(let e of[`codex`,`claudeAgent`,`cursor`,`opencode`]){let t=Z8(r?.[e]);t&&(i[e]=t)}if(t===`codex`&&n){let e=[];if(typeof n.effort==`string`&&n.effort.length>0&&e.push({id:`reasoningEffort`,value:n.effort}),(n.codexFastMode===!0||typeof n.serviceTier==`string`&&n.serviceTier===`fast`)&&e.push({id:`fastMode`,value:!0}),e.length>0){let t=i.codex??[],n=new Set(t.map(e=>e.id)),r=[...t];for(let t of e)n.has(t.id)||r.push(t);i.codex=r}}return Object.keys(i).length>0?i:null}function $8(e,t){let n=e&&typeof e==`object`?e:null,r=X8(n?.instanceId??n?.provider??t?.provider);if(r===null)return null;let i=n?.model??t?.model;if(typeof i!=`string`)return null;let a=MY(i,Y8(n?.provider??t?.provider)??yO.make(`codex`));if(!a)return null;if(Array.isArray(n?.options))return LY(r,a,Z8(n.options));let o=Y8(r),s=o?Q8(n?.options?{[o]:n.options}:t?.modelOptions,o,o===`codex`?t?.legacyCodex:void 0):null;return LY(r,a,o?s?.[o]:void 0)}function e5(e,t){if(e===null)return null;let n=Y8(e.instanceId),r=n?t?.[n]:void 0;return LY(e.instanceId,e.model,r)}function t5(e,t){if(!e?.options||e.options.length===0)return Q8(t);let n=Y8(e.instanceId);return n?Hge(Q8(t),n,e.options):Q8(t)}function Hge(e,t,n){let{[t]:r,...i}=e??{},a={...i};return n&&n.length>0&&(a[t]=n),Object.keys(a).length>0?a:null}function n5(e,t){let n={};if(t)for(let r of[`codex`,`claudeAgent`,`cursor`,`opencode`]){let i=t[r];if(i&&i.length>0){let t=yO.make(r),a=TO(t);n[a]=LY(a,e?.instanceId===a?e.model:UO[t]??`gpt-5.6-sol`,i)}}return e&&(n[e.instanceId]=e),n}function Uge(e){let t=e.threadModelSelection?.model??e.projectModelSelection?.model??null,n=(e.selectedInstanceId?T6(e.selectedInstanceId,e.settings,e.providers,t):null)??w6(e.selectedProvider,e.settings,e.providers,t)??MY(t,e.selectedProvider)??YY(e.providers,e.selectedProvider),r=e.selectedInstanceId?e.draft?.modelSelectionByProvider?.[e.selectedInstanceId]:void 0,i=e.draft?.modelSelectionByProvider?.[SO.make(e.selectedProvider)],a=r??i,o=r?e.selectedInstanceId??SO.make(e.selectedProvider):SO.make(e.selectedProvider);return{selectedModel:a?.model?T6(o,e.settings,e.providers,a.model)??w6(e.selectedProvider,e.settings,e.providers,a.model):n,modelOptions:Ige(e.draft?.modelSelectionByProvider)??N8(e.threadModelSelection)??N8(e.projectModelSelection)??null}}function r5(e){typeof URL>`u`||e.startsWith(`blob:`)&&URL.revokeObjectURL(e)}function i5(e){if(e)for(let t of e.images)r5(t.previewUrl)}function Wge(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.id,r=t.name,i=t.mimeType,a=t.sizeBytes,o=t.dataUrl;return typeof n!=`string`||typeof r!=`string`||typeof i!=`string`||typeof a!=`number`||!Number.isFinite(a)||typeof o!=`string`||n.length===0||o.length===0?null:{id:n,name:r,mimeType:i,sizeBytes:a,dataUrl:o}}function Gge(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.id,r=t.threadId,i=t.pickedAt,a=t.pageUrl,o=t.tagName;if(typeof n!=`string`||n.length===0||typeof r!=`string`||r.length===0||typeof i!=`string`||i.length===0||typeof a!=`string`||a.length===0||typeof o!=`string`||o.length===0)return null;let s=t.source,c=null;if(s&&typeof s==`object`){let e=s;c={functionName:typeof e.functionName==`string`?e.functionName:null,fileName:typeof e.fileName==`string`?e.fileName:null,lineNumber:typeof e.lineNumber==`number`&&Number.isFinite(e.lineNumber)?e.lineNumber:null,columnNumber:typeof e.columnNumber==`number`&&Number.isFinite(e.columnNumber)?e.columnNumber:null}}return{id:n,threadId:r,pickedAt:i,pageUrl:a,pageTitle:typeof t.pageTitle==`string`?t.pageTitle:null,tagName:o,selector:typeof t.selector==`string`?t.selector:null,htmlPreview:typeof t.htmlPreview==`string`?t.htmlPreview:``,componentName:typeof t.componentName==`string`?t.componentName:null,source:c,styles:typeof t.styles==`string`?t.styles:``}}function Kge(e){if(!e||typeof e!=`object`)return null;let t=e,n=t.id,r=t.threadId,i=t.createdAt,a=t.lineStart,o=t.lineEnd;if(typeof n!=`string`||n.length===0||typeof r!=`string`||r.length===0||typeof i!=`string`||i.length===0||typeof a!=`number`||!Number.isFinite(a)||typeof o!=`number`||!Number.isFinite(o))return null;let s=typeof t.terminalId==`string`?t.terminalId.trim():``,c=typeof t.terminalLabel==`string`?t.terminalLabel.trim():``;if(s.length===0||c.length===0)return null;let l=Math.max(1,Math.floor(a));return{id:n,threadId:r,createdAt:i,terminalId:s,terminalLabel:c,lineStart:l,lineEnd:Math.max(l,Math.floor(o))}}function qge(e,t){return e===`local`||e===`worktree`?e:t?`worktree`:`local`}function a5(e){return bV(e)}function o5(e){return e.trim()}function s5(e){return typeof e==`string`?e.trim():xV(e)}function c5(e,t){let n=wV(e);return n?s5(n):t?.environmentId?s5(vV(t.environmentId,e)):e}function Jge(e){return wV(e)}function l5(e,t){if(typeof t==`string`){let e=t.trim();return e.length>0?A8.make(e):null}return t}function u5(e,t){let n=l5(e,t);if(!n)return null;if(typeof n!=`string`){let t=s5(n);if(e.draftsByThreadKey[t])return t;for(let[t,r]of Object.entries(e.draftThreadsByThreadKey))if(r.environmentId===n.environmentId&&r.threadId===n.threadId)return t;return t}let r=s5(n);return r.length>0?r:null}function d5(e,t){let n=l5(e,t);return n?typeof n==`string`?e.draftThreadsByThreadKey[n]?.threadId??null:n.threadId:null}function f5(e,t){let n=u5(e,t);return n?e.draftsByThreadKey[n]??null:null}function Yge(e,t){return Object.values(e).includes(t)}function p5(e,t){return{draftId:e,...t}}function Xge(e,t,n,r,i){let a=r!==void 0&&(r.environmentId!==e.environmentId||r.projectId!==e.projectId),o=i?.worktreePath===void 0?a?null:r?.worktreePath??null:i.worktreePath??null,s=i?.branch===void 0?a?null:r?.branch??null:i.branch??null,c=i?.startFromOrigin===void 0?a?!1:r?.startFromOrigin??!1:i.startFromOrigin;return{threadId:t,environmentId:e.environmentId,projectId:e.projectId,logicalProjectKey:n,createdAt:i?.createdAt??r?.createdAt??new Date().toISOString(),runtimeMode:i?.runtimeMode??r?.runtimeMode??`full-access`,interactionMode:i?.interactionMode??r?.interactionMode??`default`,branch:s,worktreePath:o,envMode:i?.envMode??(o?`worktree`:a?`local`:r?.envMode??`local`),startFromOrigin:c,promotedTo:null}}function m5(e,t){return!e||!t?e===t:e.environmentId===t.environmentId&&e.threadId===t.threadId}function h5(e){return e?.promotedTo!==null&&e?.promotedTo!==void 0}function Zge(e,t){return!!e&&e.threadId===t.threadId&&e.environmentId===t.environmentId&&e.projectId===t.projectId&&e.logicalProjectKey===t.logicalProjectKey&&e.createdAt===t.createdAt&&e.runtimeMode===t.runtimeMode&&e.interactionMode===t.interactionMode&&e.branch===t.branch&&e.worktreePath===t.worktreePath&&e.envMode===t.envMode&&e.startFromOrigin===t.startFromOrigin&&m5(e.promotedTo,t.promotedTo)}function g5(e,t){let n=Object.fromEntries(Object.entries(e.logicalProjectDraftThreadKeyByLogicalProjectKey).filter(([,e])=>e!==t)),{[t]:r,...i}=e.draftThreadsByThreadKey,{[t]:a,...o}=e.draftsByThreadKey;return i5(a),{draftsByThreadKey:o,draftThreadsByThreadKey:i,logicalProjectDraftThreadKeyByLogicalProjectKey:n}}function _5(e,t){let n={},r=new Map;if(t&&typeof t==`object`)for(let[e,n]of Object.entries(t)){if(typeof n!=`string`||n.length===0)continue;let t=CV(e);if(!t)continue;let i=wV(n);if(i){r.set(i.threadId,i.environmentId);continue}r.set(n,t.environmentId)}if(e&&typeof e==`object`)for(let[t,i]of Object.entries(e)){if(typeof t!=`string`||t.length===0||!i||typeof i!=`object`)continue;let e=i,a=wV(t),o=c5(t),s=a?.threadId??(typeof e.threadId==`string`&&e.threadId.length>0?e.threadId:t),c=a?.environmentId??(typeof e.environmentId==`string`&&e.environmentId.length>0?e.environmentId:r.get(t)),l=e.projectId,u=e.createdAt,d=e.branch,f=e.worktreePath,p=e.startFromOrigin===!0,m=typeof f==`string`?f:null,h=e.promotedTo,g=h&&typeof h==`object`?h:null,_=g&&typeof g.environmentId==`string`&&g.environmentId.length>0&&typeof g.threadId==`string`&&g.threadId.length>0?vV(g.environmentId,g.threadId):null;if(typeof l!=`string`||l.length===0||c===void 0)continue;let v=c;n[o]={threadId:s,environmentId:v,projectId:l,logicalProjectKey:typeof e.logicalProjectKey==`string`&&e.logicalProjectKey.length>0?e.logicalProjectKey:a?a5(_V(v,l)):t,createdAt:typeof u==`string`&&u.length>0?u:new Date().toISOString(),runtimeMode:E8(e.runtimeMode)?e.runtimeMode:E6,interactionMode:e.interactionMode===`plan`||e.interactionMode==="default"?e.interactionMode:D6,branch:typeof d==`string`?d:null,worktreePath:m,envMode:qge(e.envMode,m),startFromOrigin:p,promotedTo:_}}let i={};if(t&&typeof t==`object`)for(let[e,a]of Object.entries(t)){if(typeof a!=`string`||a.length===0)continue;let t=CV(e),o=wV(a),s=c5(a);if(i[e]=s,o&&r.set(o.threadId,o.environmentId),!t){let t=n[s];t&&!t.logicalProjectKey&&(n[s]={...t,logicalProjectKey:e});continue}n[s]?(n[s]?.projectId!==t.projectId||n[s]?.environmentId!==t.environmentId)&&(n[s]={...n[s],threadId:n[s].threadId,environmentId:t.environmentId,projectId:t.projectId,logicalProjectKey:e}):n[s]={threadId:o?.threadId??s,environmentId:t.environmentId,projectId:t.projectId,logicalProjectKey:e,createdAt:new Date().toISOString(),runtimeMode:E6,interactionMode:D6,branch:null,worktreePath:null,envMode:`local`,startFromOrigin:!1,promotedTo:null}}return{draftThreadsByThreadKey:n,logicalProjectDraftThreadKeyByLogicalProjectKey:i}}function v5(e,t){if(!e||typeof e!=`object`)return{};let n=new Map;for(let[e,r]of Object.entries(t)){let t=Jge(e);t&&n.set(t.threadId,r.environmentId)}let r={};for(let[i,a]of Object.entries(e)){if(typeof i!=`string`||i.length===0||!a||typeof a!=`object`)continue;let e=a,o=typeof e.prompt==`string`?e.prompt:``,s=Array.isArray(e.attachments)?e.attachments.flatMap(e=>{let t=Wge(e);return t?[t]:[]}):[],c=Array.isArray(e.terminalContexts)?e.terminalContexts.flatMap(e=>{let t=Kge(e);return t?[t]:[]}):[],l=Array.isArray(e.elementContexts)?e.elementContexts.flatMap(e=>{let t=Gge(e);return t?[t]:[]}):[],u=Array.isArray(e.reviewComments)?e.reviewComments.filter(D8):[],d=E8(e.runtimeMode)?e.runtimeMode:null,f=e.interactionMode===`plan`||e.interactionMode==="default"?e.interactionMode:null,p=U6(o,c.length),m=a,h={},g=null;if(e.modelSelectionByProvider&&typeof e.modelSelectionByProvider==`object`)h=e.modelSelectionByProvider,g=X8(e.activeProvider);else{let e=Q8(m.modelOptions,void 0,m)??null,t=$8(m.modelSelection,{provider:m.provider,model:m.model,modelOptions:e??m.modelOptions,legacyCodex:m}),n=t5(t,e),r=e5(t,n);h=n5(r,n),g=r?.instanceId??null}let _=Object.keys(h).length>0||g!==null;if(o.length===0&&s.length===0&&c.length===0&&l.length===0&&u.length===0&&!_&&!d&&!f)continue;let v=wV(i)===null?t[i]===void 0?(()=>{let e=n.get(i);return e?c5(i,{environmentId:e}):i})():i:c5(i);r[v]={prompt:p,attachments:s,...c.length>0?{terminalContexts:c}:{},...l.length>0?{elementContexts:l}:{},...u.length>0?{reviewComments:u}:{},..._?{modelSelectionByProvider:P8(h),activeProvider:g}:{},...d?{runtimeMode:d}:{},...f?{interactionMode:f}:{}}}return r}function Qge(e){if(!e||typeof e!=`object`)return F8;let t=e,n=t.draftsByThreadKey??t.draftsByThreadId,r=t.draftThreadsByThreadKey??t.draftThreadsByThreadId,i=t.logicalProjectDraftThreadKeyByLogicalProjectKey??t.projectDraftThreadKeyByProjectKey??t.projectDraftThreadIdByProjectKey??t.projectDraftThreadIdByProjectId,a=Q8(t.stickyModelOptions)??{},o=$8(t.stickyModelSelection,{provider:t.stickyProvider??`codex`,model:t.stickyModel,modelOptions:a}),s=t5(o,a),c=n5(e5(o,s),s),l=X8(t.stickyProvider)??null,{draftThreadsByThreadKey:u,logicalProjectDraftThreadKeyByLogicalProjectKey:d}=_5(r,i);return{draftsByThreadKey:v5(n,u),draftThreadsByThreadKey:u,logicalProjectDraftThreadKeyByLogicalProjectKey:d,stickyModelSelectionByProvider:P8(c),stickyActiveProvider:l}}function $ge(e){let t={};for(let[n,r]of Object.entries(e.draftsByThreadKey)){if(typeof n!=`string`||n.length===0)continue;let e=Object.keys(r.modelSelectionByProvider).length>0||r.activeProvider!==null;r.prompt.length===0&&r.persistedAttachments.length===0&&r.terminalContexts.length===0&&r.elementContexts.length===0&&r.previewAnnotations.length===0&&r.reviewComments.length===0&&!e&&r.runtimeMode===null&&r.interactionMode===null&&r.compressMode===null&&r.unpromptedSubagents===null||(t[n]={prompt:r.prompt,attachments:r.persistedAttachments,...r.terminalContexts.length>0?{terminalContexts:r.terminalContexts.map(e=>({id:e.id,threadId:e.threadId,createdAt:e.createdAt,terminalId:e.terminalId,terminalLabel:e.terminalLabel,lineStart:e.lineStart,lineEnd:e.lineEnd}))}:{},...r.elementContexts.length>0?{elementContexts:r.elementContexts.map(e=>({id:e.id,threadId:e.threadId,pickedAt:e.pickedAt,pageUrl:e.pageUrl,pageTitle:e.pageTitle,tagName:e.tagName,selector:e.selector,htmlPreview:e.htmlPreview,componentName:e.componentName,source:e.source,styles:e.styles}))}:{},...r.previewAnnotations.length>0?{previewAnnotations:r.previewAnnotations.map(e=>({...e}))}:{},...r.reviewComments.length>0?{reviewComments:r.reviewComments.map(e=>({...e}))}:{},...e?{modelSelectionByProvider:P8(r.modelSelectionByProvider),activeProvider:r.activeProvider}:{},...r.runtimeMode?{runtimeMode:r.runtimeMode}:{},...r.interactionMode?{interactionMode:r.interactionMode}:{},...r.compressMode?{compressMode:r.compressMode}:{},...r.unpromptedSubagents===null?{}:{unpromptedSubagents:r.unpromptedSubagents}})}return{draftsByThreadKey:t,draftThreadsByThreadKey:e.draftThreadsByThreadKey,logicalProjectDraftThreadKeyByLogicalProjectKey:e.logicalProjectDraftThreadKeyByLogicalProjectKey,stickyModelSelectionByProvider:P8(e.stickyModelSelectionByProvider),stickyActiveProvider:e.stickyActiveProvider}}function e_e(e){if(!e||typeof e!=`object`)return F8;let t=e,{draftThreadsByThreadKey:n,logicalProjectDraftThreadKeyByLogicalProjectKey:r}=_5(t.draftThreadsByThreadKey??t.draftThreadsByThreadId,t.logicalProjectDraftThreadKeyByLogicalProjectKey??t.projectDraftThreadKeyByProjectKey??t.projectDraftThreadIdByProjectKey??t.projectDraftThreadIdByProjectId),i={},a=null;if(t.stickyModelSelectionByProvider&&typeof t.stickyModelSelectionByProvider==`object`)i=t.stickyModelSelectionByProvider,a=X8(t.stickyActiveProvider);else{let e=Q8(t.stickyModelOptions)??{},n=$8(t.stickyModelSelection,{provider:t.stickyProvider,model:t.stickyModel,modelOptions:e}),r=t5(n,e);i=n5(e5(n,r),r),a=X8(t.stickyProvider)}return{draftsByThreadKey:v5(t.draftsByThreadKey??t.draftsByThreadId,n),draftThreadsByThreadKey:n,logicalProjectDraftThreadKeyByLogicalProjectKey:r,stickyModelSelectionByProvider:P8(i),stickyActiveProvider:a}}function t_e(e){if(e.length===0)return[];try{let t=Fq(O8,Fge);return!t||t.version!==k8?[]:(t.state.draftsByThreadKey[e]?.attachments??[]).map(e=>e.id)}catch{return[]}}function n_e(e,t,n){let r=new Set;try{j8.flush(),r=new Set(t_e(e))}catch{r=new Set}n(n=>{let i=n.draftsByThreadKey[e];if(!i)return n;let a=new Set(i.images.map(e=>e.id)),o=t.filter(e=>a.has(e.id)&&r.has(e.id)),s=[];for(let e of i.images)r.has(e.id)||s.push(e.id);let c={...i,persistedAttachments:o,nonPersistedImageIds:s},l={...n.draftsByThreadKey};return J8(c)?delete l[e]:l[e]=c,{draftsByThreadKey:l}})}function r_e(e){let t=e.dataUrl.indexOf(`,`),n=t===-1?e.dataUrl:e.dataUrl.slice(0,t),r=t===-1?``:e.dataUrl.slice(t+1);if(r.length===0)return null;try{if(!n.includes(`;base64`)){let t=decodeURIComponent(r),i=n.startsWith(`data:`)&&n.includes(`;`)?n.slice(5,n.indexOf(`;`)):e.mimeType;return new File([t],e.name,{type:i||e.mimeType})}let t=atob(r),i=new Uint8Array(t.length);for(let e=0;e<t.length;e+=1)i[e]=t.charCodeAt(e);return new File([i],e.name,{type:e.mimeType})}catch{return null}}function y5(e){return e.flatMap(e=>{let t=r_e(e);return t?[{type:`image`,id:e.id,name:e.name,mimeType:e.mimeType,sizeBytes:e.sizeBytes,previewUrl:e.dataUrl,file:t}]:[]})}function i_e(e){let t=e.modelSelectionByProvider??{},n=X8(e.activeProvider)??null;return{prompt:e.prompt,images:y5(e.attachments),nonPersistedImageIds:[],persistedAttachments:[...e.attachments],terminalContexts:e.terminalContexts?.map(e=>({...e,text:``}))??[],elementContexts:e.elementContexts?.map(e=>({...e}))??[],previewAnnotations:e.previewAnnotations?.map(e=>({...e}))??[],reviewComments:e.reviewComments?.map(e=>({...e}))??[],modelSelectionByProvider:t,activeProvider:n,runtimeMode:e.runtimeMode??null,interactionMode:e.interactionMode??null,compressMode:e.compressMode??null,unpromptedSubagents:e.unpromptedSubagents??null}}function a_e(e){return{threadId:e.threadId,environmentId:e.environmentId,projectId:e.projectId,logicalProjectKey:e.logicalProjectKey??a5(_V(e.environmentId,e.projectId)),createdAt:e.createdAt,runtimeMode:e.runtimeMode,interactionMode:e.interactionMode,branch:e.branch,worktreePath:e.worktreePath,envMode:e.envMode,startFromOrigin:e.startFromOrigin,promotedTo:e.promotedTo?vV(e.promotedTo.environmentId,e.promotedTo.threadId):null}}var b5=K6()(Y6((e,t)=>{let n=e;return{draftsByThreadKey:{},draftThreadsByThreadKey:{},logicalProjectDraftThreadKeyByLogicalProjectKey:{},stickyModelSelectionByProvider:{},stickyActiveProvider:null,getComposerDraft:e=>f5(t(),e),getDraftThreadByLogicalProjectKey:e=>t().getDraftSessionByLogicalProjectKey(e),getDraftSessionByLogicalProjectKey:e=>{let n=o5(e);if(n.length===0)return null;let r=t().logicalProjectDraftThreadKeyByLogicalProjectKey[n];if(!r)return null;let i=t().draftThreadsByThreadKey[r];return!i||h5(i)?null:p5(A8.make(r),i)},getDraftThreadByProjectRef:e=>t().getDraftSessionByProjectRef(e),getDraftSessionByProjectRef:e=>{for(let[n,r]of Object.entries(t().draftThreadsByThreadKey))if(!h5(r)&&r.projectId===e.projectId&&r.environmentId===e.environmentId)return p5(A8.make(n),r);return null},getDraftSession:e=>t().draftThreadsByThreadKey[e]??null,getDraftSessionByRef:e=>{for(let n of Object.values(t().draftThreadsByThreadKey))if(n.environmentId===e.environmentId&&n.threadId===e.threadId)return n;return null},getDraftThread:e=>typeof e==`string`?t().getDraftSession(A8.make(e)):t().getDraftSessionByRef(e),getDraftThreadByRef:e=>t().getDraftSessionByRef(e),listDraftThreadKeys:()=>Object.values(t().draftThreadsByThreadKey).map(e=>xV(vV(e.environmentId,e.threadId))),hasDraftThreadsInEnvironment:e=>Object.values(t().draftThreadsByThreadKey).some(t=>t.environmentId===e),setLogicalProjectDraftThreadId:(e,t,r,i)=>{let a=o5(e);a.length===0||r.length===0||n(e=>{let n=e.draftThreadsByThreadKey[r],o=e.logicalProjectDraftThreadKeyByLogicalProjectKey[a],s=Xge(t,i?.threadId??n?.threadId??Y.make(r),a,n,i);if(o===r&&Zge(n,s))return e;let c={...e.logicalProjectDraftThreadKeyByLogicalProjectKey,[a]:r},l={...e.draftThreadsByThreadKey,[r]:s},u=e.draftsByThreadKey,d=o===void 0?void 0:l[o];return o&&o!==r&&!Yge(c,o)&&!h5(d)&&(delete l[o],e.draftsByThreadKey[o]!==void 0&&(u={...e.draftsByThreadKey},delete u[o])),{draftsByThreadKey:u,draftThreadsByThreadKey:l,logicalProjectDraftThreadKeyByLogicalProjectKey:c}})},setProjectDraftThreadId:(e,n,r)=>{t().setLogicalProjectDraftThreadId(a5(e),e,n,r)},setDraftThreadContext:(e,r)=>{let i=u5(t(),e)??``;i.length!==0&&n(e=>{let t=e.draftThreadsByThreadKey[i];if(!t)return e;let n=r.projectRef??{environmentId:t.environmentId,projectId:t.projectId};if(n.projectId.length===0||n.environmentId.length===0)return e;let a=n.environmentId!==t.environmentId||n.projectId!==t.projectId,o=r.worktreePath===void 0?a?null:t.worktreePath:r.worktreePath??null,s=r.branch===void 0?a?null:t.branch:r.branch??null,c=r.startFromOrigin===void 0?a?!1:t.startFromOrigin:r.startFromOrigin,l={threadId:t.threadId,environmentId:n.environmentId,projectId:n.projectId,logicalProjectKey:t.logicalProjectKey,createdAt:r.createdAt===void 0?t.createdAt:r.createdAt||t.createdAt,runtimeMode:r.runtimeMode??t.runtimeMode,interactionMode:r.interactionMode??t.interactionMode,branch:s,worktreePath:o,envMode:r.envMode??(o?`worktree`:a?`local`:t.envMode??`local`),startFromOrigin:c,promotedTo:t.promotedTo??null};return l.environmentId===t.environmentId&&l.projectId===t.projectId&&l.logicalProjectKey===t.logicalProjectKey&&l.createdAt===t.createdAt&&l.runtimeMode===t.runtimeMode&&l.interactionMode===t.interactionMode&&l.branch===t.branch&&l.worktreePath===t.worktreePath&&l.envMode===t.envMode&&l.startFromOrigin===t.startFromOrigin&&m5(l.promotedTo,t.promotedTo)?e:{draftThreadsByThreadKey:{...e.draftThreadsByThreadKey,[i]:l}}})},clearProjectDraftThreadId:e=>{n(t=>{let n=Object.entries(t.draftThreadsByThreadKey).find(([,t])=>t.projectId===e.projectId&&t.environmentId===e.environmentId);return n?g5(t,n[0]):t})},clearProjectDraftThreadById:(e,r)=>{let i=u5(t(),r)??``;i.length!==0&&n(t=>{let n=t.draftThreadsByThreadKey[i];return!n||n.projectId!==e.projectId||n.environmentId!==e.environmentId?t:g5(t,i)})},markDraftThreadPromoting:(e,r)=>{let i=u5(t(),e);i&&n(e=>{let t=e.draftThreadsByThreadKey[i];if(!t)return e;let n=r??vV(t.environmentId,t.threadId);return m5(t.promotedTo,n)?e:{draftThreadsByThreadKey:{...e.draftThreadsByThreadKey,[i]:{...t,promotedTo:n}}}})},finalizePromotedDraftThread:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftThreadsByThreadKey[r];return h5(t)?g5(e,r):e})},clearDraftThread:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftThreadsByThreadKey[r]!==void 0,n=Object.values(e.logicalProjectDraftThreadKeyByLogicalProjectKey).includes(r),i=e.draftsByThreadKey[r]!==void 0;return!t&&!n&&!i?e:g5(e,r)})},setStickyModelSelection:e=>{let t=$8(e);n(e=>{if(!t)return e;let n={...e.stickyModelSelectionByProvider,[t.instanceId]:t};return wt(e.stickyModelSelectionByProvider,n)?e.stickyActiveProvider===t.instanceId?e:{stickyActiveProvider:t.instanceId}:{stickyModelSelectionByProvider:n,stickyActiveProvider:t.instanceId}})},applyStickyState:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.stickyModelSelectionByProvider,n=e.stickyActiveProvider;if(Object.keys(t).length===0&&n===null)return e;let i=e.draftsByThreadKey[r]??U8(),a={...i.modelSelectionByProvider};for(let[e,n]of Object.entries(t))if(n){let t=e,r=a[t];a[t]={...n,model:r?.model??n.model}}if(wt(i.modelSelectionByProvider,a)&&i.activeProvider===n)return e;let o={...i,modelSelectionByProvider:a,activeProvider:n},s={...e.draftsByThreadKey};return J8(o)?delete s[r]:s[r]=o,{draftsByThreadKey:s}})},setPrompt:(e,r)=>{let i=u5(t(),e)??``;i.length!==0&&n(e=>{let t={...e.draftsByThreadKey[i]??U8(),prompt:r},n={...e.draftsByThreadKey};return J8(t)?delete n[i]:n[i]=t,{draftsByThreadKey:n}})},setTerminalContexts:(e,r)=>{let i=u5(t(),e),a=d5(t(),e);if(!i||!a)return;let o=q8(a,r);n(e=>{let t=e.draftsByThreadKey[i]??U8(),n={...t,prompt:U6(t.prompt,o.length),terminalContexts:o},r={...e.draftsByThreadKey};return J8(n)?delete r[i]:r[i]=n,{draftsByThreadKey:r}})},setModelSelection:(e,r,i)=>{let a=u5(t(),e)??``;if(a.length===0)return;let o=$8(r);n(e=>{let t=e.draftsByThreadKey[a];if(!t&&o===null)return e;let n=t??U8(),r={...n.modelSelectionByProvider};if(o){let e=r[o.instanceId];o.options!==void 0||i?.replaceOptions?r[o.instanceId]=o:r[o.instanceId]=LY(o.instanceId,o.model,e?.options)}let s=o?.instanceId??n.activeProvider;if(wt(n.modelSelectionByProvider,r)&&n.activeProvider===s)return e;let c={...n,modelSelectionByProvider:r,activeProvider:s},l={...e.draftsByThreadKey};return J8(c)?delete l[a]:l[a]=c,{draftsByThreadKey:l}})},setModelOptions:(e,r)=>{let i=u5(t(),e)??``;i.length!==0&&n(e=>{let t=e.draftsByThreadKey[i];if(!t&&(!r||Object.keys(r).length===0))return e;let n=t??U8(),a={...n.modelSelectionByProvider};for(let e of[`codex`,`claudeAgent`,`cursor`,`opencode`]){if(!r||!(e in r))continue;let t=r[e],n=yO.make(e),i=TO(n),o=a[i];if(t&&t.length>0)a[i]=LY(i,o?.model??UO[n]??`gpt-5.6-sol`,t);else if(o?.options){let{options:e,...t}=o;a[i]=t}}if(wt(n.modelSelectionByProvider,a))return e;let o={...n,modelSelectionByProvider:a},s={...e.draftsByThreadKey};return J8(o)?delete s[i]:s[i]=o,{draftsByThreadKey:s}})},setProviderModelOptions:(e,r,i,a)=>{let o=u5(t(),e)??``;if(o.length===0)return;let s=Y8(r);if(s===null)return;let c=a?.instanceId??TO(s),l=MY(a?.model,s)??UO[s]??`gpt-5.6-sol`,u=i&&i.length>0?i:void 0;n(e=>{let t=e.draftsByThreadKey[o]??U8(),n={...t.modelSelectionByProvider},r=n[c];if(u)n[c]=LY(c,r?.model??l,u);else if(r&&(r.options?.length??0)>0){let{options:e,...t}=r;n[c]=t}let i=e.stickyModelSelectionByProvider,s=e.stickyActiveProvider;if(a?.persistSticky===!0){i={...e.stickyModelSelectionByProvider};let n=i[c]??t.modelSelectionByProvider[c]??LY(c,l);if(u)i[c]=LY(c,n.model,u);else if((n.options?.length??0)>0){let{options:e,...t}=n;i[c]=t}s=a.instanceId?c:t.activeProvider??c}if(wt(t.modelSelectionByProvider,n)&&wt(e.stickyModelSelectionByProvider,i)&&e.stickyActiveProvider===s)return e;let d={...t,...a?.instanceId?{activeProvider:c}:{},modelSelectionByProvider:n},f={...e.draftsByThreadKey};return J8(d)?delete f[o]:f[o]=d,{draftsByThreadKey:f,...a?.persistSticky===!0?{stickyModelSelectionByProvider:i,stickyActiveProvider:s}:{}}})},setRuntimeMode:(e,r)=>{let i=u5(t(),e)??``;if(i.length===0)return;let a=E8(r)?r:null;n(e=>{let t=e.draftsByThreadKey[i];if(!t&&a===null)return e;let n=t??U8();if(n.runtimeMode===a)return e;let r={...n,runtimeMode:a},o={...e.draftsByThreadKey};return J8(r)?delete o[i]:o[i]=r,{draftsByThreadKey:o}})},setInteractionMode:(e,r)=>{let i=u5(t(),e)??``;if(i.length===0)return;let a=r===`plan`||r==="default"?r:null;n(e=>{let t=e.draftsByThreadKey[i];if(!t&&a===null)return e;let n=t??U8();if(n.interactionMode===a)return e;let r={...n,interactionMode:a},o={...e.draftsByThreadKey};return J8(r)?delete o[i]:o[i]=r,{draftsByThreadKey:o}})},setCompressMode:(e,r)=>{let i=u5(t(),e)??``;if(i.length===0)return;let a=r===`off`||r===`lite`||r===`full`||r===`ultra`?r:null;n(e=>{let t=e.draftsByThreadKey[i];if(!t&&a===null)return e;let n=t??U8();if(n.compressMode===a)return e;let r={...n,compressMode:a},o={...e.draftsByThreadKey};return J8(r)?delete o[i]:o[i]=r,{draftsByThreadKey:o}})},setUnpromptedSubagents:(e,r)=>{let i=u5(t(),e)??``;if(i.length===0)return;let a=typeof r==`boolean`?r:null;n(e=>{let t=e.draftsByThreadKey[i];if(!t&&a===null)return e;let n=t??U8();if(n.unpromptedSubagents===a)return e;let r={...n,unpromptedSubagents:a},o={...e.draftsByThreadKey};return J8(r)?delete o[i]:o[i]=r,{draftsByThreadKey:o}})},addImage:(e,n)=>{let r=u5(t(),e),i=d5(t(),e);!r||!i||t().addImages(typeof e==`string`?A8.make(r):e,[n])},addImages:(e,r)=>{let i=u5(t(),e)??``;i.length===0||r.length===0||n(e=>{let t=e.draftsByThreadKey[i]??U8(),n=new Set(t.images.map(e=>e.id)),a=new Set(t.images.map(e=>W8(e))),o=new Set(t.images.map(e=>e.previewUrl)),s=[];for(let e of r){let t=W8(e);if(n.has(e.id)||a.has(t)){o.has(e.previewUrl)||r5(e.previewUrl);continue}s.push(e),n.add(e.id),a.add(t),o.add(e.previewUrl)}return s.length===0?e:{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,images:[...t.images,...s]}}}})},removeImage:(e,r)=>{let i=u5(t(),e)??``;if(i.length===0)return;let a=t().draftsByThreadKey[i];if(!a)return;let o=a.images.find(e=>e.id===r);o&&r5(o.previewUrl),n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n={...t,images:t.images.filter(e=>e.id!==r),nonPersistedImageIds:t.nonPersistedImageIds.filter(e=>e!==r),persistedAttachments:t.persistedAttachments.filter(e=>e.id!==r)},a={...e.draftsByThreadKey};return J8(n)?delete a[i]:a[i]=n,{draftsByThreadKey:a}})},insertTerminalContext:(e,r,i,a)=>{let o=u5(t(),e),s=d5(t(),e);if(!o||!s)return!1;let c=!1;return n(e=>{let t=e.draftsByThreadKey[o]??U8(),n=K8(s,i);if(!n)return e;let l=G8(n);if(t.terminalContexts.some(e=>e.id===n.id)||t.terminalContexts.some(e=>G8(e)===l))return e;c=!0;let u=Math.max(0,Math.min(t.terminalContexts.length,a)),d={...t,prompt:r,terminalContexts:[...t.terminalContexts.slice(0,u),n,...t.terminalContexts.slice(u)]};return{draftsByThreadKey:{...e.draftsByThreadKey,[o]:d}}}),c},addTerminalContext:(e,n)=>{let r=u5(t(),e),i=d5(t(),e);!r||!i||t().addTerminalContexts(typeof e==`string`?A8.make(r):e,[n])},addTerminalContexts:(e,r)=>{let i=u5(t(),e),a=d5(t(),e);!i||!a||r.length===0||n(e=>{let t=e.draftsByThreadKey[i]??U8(),n=q8(a,[...t.terminalContexts,...r]).slice(t.terminalContexts.length);return n.length===0?e:{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,prompt:U6(t.prompt,t.terminalContexts.length+n.length),terminalContexts:[...t.terminalContexts,...n]}}}})},removeTerminalContext:(e,r)=>{let i=u5(t(),e)??``;i.length===0||r.length===0||n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n={...t,terminalContexts:t.terminalContexts.filter(e=>e.id!==r)},a={...e.draftsByThreadKey};return J8(n)?delete a[i]:a[i]=n,{draftsByThreadKey:a}})},clearTerminalContexts:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftsByThreadKey[r];if(!t||t.terminalContexts.length===0)return e;let n={...t,terminalContexts:[]},i={...e.draftsByThreadKey};return J8(n)?delete i[r]:i[r]=n,{draftsByThreadKey:i}})},addElementContext:(e,r)=>{let i=u5(t(),e),a=d5(t(),e);if(!i||!a)return!1;let o=!1;return n(e=>{let t=e.draftsByThreadKey[i]??U8(),n=j6(r);if(t.elementContexts.some(e=>j6(e)===n))return e;o=!0;let s={...r,id:Mhe(),threadId:a,pickedAt:new Date().toISOString()};return{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,elementContexts:[...t.elementContexts,s]}}}}),o},setElementContexts:(e,r)=>{let i=u5(t(),e);i&&n(e=>{let t={...e.draftsByThreadKey[i]??U8(),elementContexts:[...r]},n={...e.draftsByThreadKey};return J8(t)?delete n[i]:n[i]=t,{draftsByThreadKey:n}})},removeElementContext:(e,r)=>{let i=u5(t(),e)??``;i.length===0||r.length===0||n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n=t.elementContexts.filter(e=>e.id!==r);if(n.length===t.elementContexts.length)return e;let a={...t,elementContexts:n},o={...e.draftsByThreadKey};return J8(a)?delete o[i]:o[i]=a,{draftsByThreadKey:o}})},clearElementContexts:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftsByThreadKey[r];if(!t||t.elementContexts.length===0)return e;let n={...t,elementContexts:[]},i={...e.draftsByThreadKey};return J8(n)?delete i[r]:i[r]=n,{draftsByThreadKey:i}})},addPreviewAnnotation:(e,r)=>{let i=u5(t(),e);i&&n(e=>{let t=e.draftsByThreadKey[i]??U8(),n=t.previewAnnotations.filter(e=>e.id!==r.id),a={...r,screenshot:r.screenshot?{...r.screenshot,dataUrl:``}:null};return{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,previewAnnotations:[...n,a]}}}})},setPreviewAnnotations:(e,r)=>{let i=u5(t(),e);i&&n(e=>{let t=e.draftsByThreadKey[i]??U8();return{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,previewAnnotations:[...r]}}}})},removePreviewAnnotation:(e,r)=>{let i=u5(t(),e);!i||!r||n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n=t.previewAnnotations.filter(e=>e.id!==r);if(n.length===t.previewAnnotations.length)return e;let a={...t,previewAnnotations:n,images:t.images.filter(e=>e.id!==r),persistedAttachments:t.persistedAttachments.filter(e=>e.id!==r),nonPersistedImageIds:t.nonPersistedImageIds.filter(e=>e!==r)},o={...e.draftsByThreadKey};return J8(a)?delete o[i]:o[i]=a,{draftsByThreadKey:o}})},addReviewComment:(e,r)=>{let i=u5(t(),e);!i||!D8(r)||n(e=>{let t=e.draftsByThreadKey[i]??U8(),n=t.reviewComments.filter(e=>e.id!==r.id);return{draftsByThreadKey:{...e.draftsByThreadKey,[i]:{...t,reviewComments:[...n,{...r}]}}}})},setReviewComments:(e,r)=>{let i=u5(t(),e);if(!i)return;let a=r.filter(D8).map(e=>({...e}));n(e=>{let t={...e.draftsByThreadKey[i]??U8(),reviewComments:a},n={...e.draftsByThreadKey};return J8(t)?delete n[i]:n[i]=t,{draftsByThreadKey:n}})},removeReviewComment:(e,r)=>{let i=u5(t(),e);!i||!r||n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n=t.reviewComments.filter(e=>e.id!==r);if(n.length===t.reviewComments.length)return e;let a={...t,reviewComments:n},o={...e.draftsByThreadKey};return J8(a)?delete o[i]:o[i]=a,{draftsByThreadKey:o}})},clearPersistedAttachments:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftsByThreadKey[r];if(!t)return e;let n={...t,persistedAttachments:[],nonPersistedImageIds:[]},i={...e.draftsByThreadKey};return J8(n)?delete i[r]:i[r]=n,{draftsByThreadKey:i}})},syncPersistedAttachments:(e,r)=>{let i=u5(t(),e);if(!i)return;let a=new Set(r.map(e=>e.id));n(e=>{let t=e.draftsByThreadKey[i];if(!t)return e;let n={...t,persistedAttachments:r,nonPersistedImageIds:t.nonPersistedImageIds.filter(e=>!a.has(e))},o={...e.draftsByThreadKey};return J8(n)?delete o[i]:o[i]=n,{draftsByThreadKey:o}}),Promise.resolve().then(()=>{n_e(i,r,n)})},clearComposerContent:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftsByThreadKey[r];if(!t)return e;let n={...t,prompt:``,images:[],nonPersistedImageIds:[],persistedAttachments:[],terminalContexts:[],elementContexts:[],previewAnnotations:[],reviewComments:[]},i={...e.draftsByThreadKey};return J8(n)?delete i[r]:i[r]=n,{draftsByThreadKey:i}})},clearComposerPromptAndImages:e=>{let r=u5(t(),e)??``;r.length!==0&&n(e=>{let t=e.draftsByThreadKey[r];if(!t)return e;for(let e of t.images)r5(e.previewUrl);let n={...t,prompt:U6(``,t.terminalContexts.length),images:[],nonPersistedImageIds:[],persistedAttachments:[]},i={...e.draftsByThreadKey};return J8(n)?delete i[r]:i[r]=n,{draftsByThreadKey:i}})}}},{name:O8,version:k8,storage:q6(()=>j8),migrate:Qge,partialize:$ge,merge:(e,t)=>{let n=e_e(e),r=Object.fromEntries(Object.entries(n.draftsByThreadKey).map(([e,t])=>[e,i_e(t)])),i=Object.fromEntries(Object.entries(n.draftThreadsByThreadKey).map(([e,t])=>[e,a_e(t)]));return{...t,draftsByThreadKey:r,draftThreadsByThreadKey:i,logicalProjectDraftThreadKeyByLogicalProjectKey:n.logicalProjectDraftThreadKeyByLogicalProjectKey,stickyModelSelectionByProvider:n.stickyModelSelectionByProvider??{},stickyActiveProvider:n.stickyActiveProvider??null}}}));function o_e(e){b5.setState(t=>{let n=new Set;for(let[r,i]of Object.entries(t.draftThreadsByThreadKey))i.environmentId===e&&n.add(r);for(let r of Object.keys(t.draftsByThreadKey))wV(r)?.environmentId===e&&n.add(r);for(let[r,i]of Object.entries(t.logicalProjectDraftThreadKeyByLogicalProjectKey))CV(r)?.environmentId===e&&n.add(i);let r=Object.fromEntries(Object.entries(t.logicalProjectDraftThreadKeyByLogicalProjectKey).filter(([t,r])=>CV(t)?.environmentId!==e&&!n.has(r))),i=Object.fromEntries(Object.entries(t.draftThreadsByThreadKey).filter(([t,r])=>r.environmentId!==e&&!n.has(t)));return{draftsByThreadKey:Object.fromEntries(Object.entries(t.draftsByThreadKey).filter(([e,t])=>n.has(e)?(i5(t),!1):!0)),draftThreadsByThreadKey:i,logicalProjectDraftThreadKeyByLogicalProjectKey:r}}),j8.flush()}function s_e(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=t=>f5(t,e)??Bge,t[0]=e,t[1]=n),b5(n)}function c_e(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=t=>{let n=f5(t,e);return n?{activeProvider:n.activeProvider,modelSelectionByProvider:n.modelSelectionByProvider}:zge},t[0]=e,t[1]=n),b5($6(n))}function l_e(e){let t=(0,Xp.c)(11),n;t[0]!==e.draftId||t[1]!==e.threadRef?(n=e.threadRef??e.draftId??A8.make(``),t[0]=e.draftId,t[1]=e.threadRef,t[2]=n):n=t[2];let r=c_e(n),i;return t[3]!==r||t[4]!==e.projectModelSelection||t[5]!==e.providers||t[6]!==e.selectedInstanceId||t[7]!==e.selectedProvider||t[8]!==e.settings||t[9]!==e.threadModelSelection?(i=Uge({draft:r,providers:e.providers,selectedProvider:e.selectedProvider,selectedInstanceId:e.selectedInstanceId,threadModelSelection:e.threadModelSelection,projectModelSelection:e.projectModelSelection,settings:e.settings}),t[3]=r,t[4]=e.projectModelSelection,t[5]=e.providers,t[6]=e.selectedInstanceId,t[7]=e.selectedProvider,t[8]=e.settings,t[9]=e.threadModelSelection,t[10]=i):i=t[10],i}function u_e(e){let t=b5.getState();for(let[n,r]of Object.entries(t.draftThreadsByThreadKey))r.environmentId===e.environmentId&&r.threadId===e.threadId&&t.markDraftThreadPromoting(A8.make(n),e)}function d_e(e){let t=b5.getState();for(let[n,r]of Object.entries(t.draftThreadsByThreadKey)){let i=r.promotedTo;if(i?i.environmentId===e.environmentId&&i.threadId===e.threadId:r.environmentId===e.environmentId&&r.threadId===e.threadId){let r=A8.make(n);t.markDraftThreadPromoting(r,e),t.finalizePromotedDraftThread(r)}}}function x5(...e){return yY(Wq(e))}function f_e(e){return/mac|iphone|ipad|ipod/i.test(e)}function p_e(e){return/^win(dows)?/i.test(e)}function m_e(e){return Pm(globalThis.crypto.getRandomValues(new Uint8Array(e)))}function S5(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Pm(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var h_e=()=>Jb.make(S5()),g_e=()=>Y.make(S5()),__e=()=>A8.make(S5()),v_e=()=>$b.make(S5());function y_e(e,t){switch(t.type){case`snapshot`:return Fr({config:t.config,latestEvent:t,source:`live`});case`keybindingsUpdated`:return Yr(e,e=>({config:{...e.config,keybindings:t.payload.keybindings,issues:t.payload.issues},latestEvent:t,source:`live`}));case`providerStatuses`:return Yr(e,e=>({config:{...e.config,providers:t.payload.providers},latestEvent:t,source:`live`}));case`settingsUpdated`:return Yr(e,e=>({config:{...e.config,settings:t.payload.settings},latestEvent:t,source:`live`}))}}var b_e=e=>({version:1,type:`snapshot`,config:e}),x_e=Fp(`EnvironmentServerConfigState.make`)(function*(){let e=yield*FK,t=yield*MG,n=e.target.environmentId,r=yield*Ij(Yr(yield*t.loadServerConfig(n).pipe(Df(e=>Lp(`Could not load cached server configuration.`).pipe(Bp({environmentId:n,...bK(e)}),wf(Pr())))),e=>({config:e,latestEvent:b_e(e),source:`cache`}))),i=yield*Dx(1),a=yield*GE(Pr()),o=Fp(`EnvironmentServerConfigState.persist`)(function*(e){return yield*t.saveServerConfig(n,e).pipe(wf(!0),Df(e=>Lp(`Could not persist cached server configuration.`).pipe(Bp({environmentId:n,...bK(e)}),wf(!1))))}),s=Fp(`EnvironmentServerConfigState.persistPending`)(function*(e){(yield*o(e))&&(yield*XE(a,t=>Rr(t)&&t.value===e?Pr():t))});return yield*rC(i).pipe(yC(`500 millis`),kC(s),bp),yield*YK(X.subscribeServerConfig,{}).pipe(kC(e=>df(function*(){let t=y_e(yield*Rj(r),e);Lr(t)||(yield*qE(a,Fr(t.value.config)),yield*Bj(r,t),yield*Ox(i,t.value.config))})),bp),yield*$f(()=>KE(a).pipe(_f(zr({onNone:()=>cf,onSome:e=>o(e).pipe(Ef)})))),r});function S_e(e){return fq(e,aC(x_e().pipe(Cf(e=>Lj(e).pipe(pC(e=>zr(e,{onNone:()=>Wi,onSome:e=>Hi(e)})))))))}function C_e(e,t){if(t.type!==`welcome`)return[e,[]];let n=t.payload;return[Fr(n),[n]]}function w_e(e,t){return e?.source===`live`?e.config:t??e?.config??null}function T_e(e,t){let n=ZK(),r={mode:`serial`,key:({environmentId:e})=>e},i=UH(t=>e.atom(S_e(t)).pipe(hH(5*6e4),GH(`environment-data:server:config-projection:${t}`))),a=e=>i(e.environmentId),o=TH(null).pipe(GH(`environment-data:server:config:empty`)),s=UH(e=>e===null?o:TH(n=>w_e(Wr(BV(n(a({environmentId:e,input:{}})))),n(t.initialConfigValueAtom(e)))).pipe(GH(`environment-data:server:config:${e}`)));return{configValueAtom:s,settingsValueAtom:UH(e=>TH(t=>t(s(e))?.settings??null).pipe(GH(`environment-data:server:settings:${e}`))),providersValueAtom:UH(e=>TH(t=>t(s(e))?.providers??null).pipe(GH(`environment-data:server:providers:${e}`))),traceDiagnostics:gq(e,{label:`environment-data:server:trace-diagnostics`,tag:X.serverGetTraceDiagnostics}),processDiagnostics:gq(e,{label:`environment-data:server:process-diagnostics`,tag:X.serverGetProcessDiagnostics}),processResourceHistory:gq(e,{label:`environment-data:server:process-resource-history`,tag:X.serverGetProcessResourceHistory}),configProjection:a,welcome:_q(e,{label:`environment-data:server:welcome`,tag:X.subscribeServerLifecycle,transform:e=>e.pipe(gC(Pr,C_e))}),refreshProviders:vq(e,{label:`environment-data:server:refresh-providers`,tag:X.serverRefreshProviders,concurrency:{mode:`singleFlight`,key:({environmentId:e})=>e}}),getProviderUsage:vq(e,{label:`environment-data:server:get-provider-usage`,tag:X.serverGetProviderUsage}),updateProvider:vq(e,{label:`environment-data:server:update-provider`,tag:X.serverUpdateProvider,scheduler:n,concurrency:r}),updateServer:vq(e,{label:`environment-data:server:update-server`,tag:X.serverUpdateServer,scheduler:n,concurrency:r}),upsertKeybinding:vq(e,{label:`environment-data:server:upsert-keybinding`,tag:X.serverUpsertKeybinding,scheduler:n,concurrency:r}),removeKeybinding:vq(e,{label:`environment-data:server:remove-keybinding`,tag:X.serverRemoveKeybinding,scheduler:n,concurrency:r}),updateSettings:vq(e,{label:`environment-data:server:update-settings`,tag:X.serverUpdateSettings,scheduler:n,concurrency:r}),signalProcess:vq(e,{label:`environment-data:server:signal-process`,tag:X.serverSignalProcess})}}var C5=(e,t)=>e===null?t.pipe(Yf(wB,{credentials:`include`})):t,w5=e=>e===null?{}:{authorization:`Bearer ${e.token}`},E_e=6e3,D_e=Fp(`clientRuntime.state.fetchEnvironmentShellSnapshot`)(function*(e){let t=$p(e.prepared.httpBaseUrl,`/api/orchestration/shell`),n=yield*fV(e.prepared.httpBaseUrl),r=w5(e.prepared.httpAuthorization);return yield*mV(t,e.timeoutMs??E_e,C5(e.prepared.httpAuthorization,n.orchestration.shellSnapshot({headers:r})))}),T5=class extends ti()(`@p4code/client-runtime/state/shellSnapshotHttp/ShellSnapshotLoader`){},O_e=Ql(T5,df(function*(){let e=yield*QE;return T5.of({load:t=>D_e({prepared:t}).pipe(Cf(Fr),Yf(QE,e),Af(e=>Lp(`Could not load the environment shell snapshot over HTTP; using the socket snapshot instead.`).pipe(Bp({cause:Tu(e)}),wf(Pr()))))})}));function k_e(e,t){if(t.sequence<=e.snapshotSequence)return e;switch(t.kind){case`project-upserted`:{let n=e.projects.some(e=>e.id===t.project.id)?ha(e.projects,e=>e.id===t.project.id?t.project:e):ea(e.projects,t.project);return{...e,projects:n,snapshotSequence:t.sequence}}case`project-removed`:return{...e,projects:_a(e.projects,e=>e.id!==t.projectId),snapshotSequence:t.sequence};case`thread-upserted`:{let n=e.threads.some(e=>e.id===t.thread.id)?ha(e.threads,e=>e.id===t.thread.id?t.thread:e):ea(e.threads,t.thread);return{...e,threads:n,snapshotSequence:t.sequence}}case`thread-removed`:return{...e,threads:_a(e.threads,e=>e.id!==t.threadId),snapshotSequence:t.sequence};default:return e}}function A_e(e,t){return{...t,environmentId:e}}function j_e(e,t){return{...t,environmentId:e}}function M_e(e,t){return{...t,environmentId:e}}function N_e(e){return{openInEditor:vq(e,{label:`environment-data:shell:open-in-editor`,tag:X.shellOpenInEditor})}}function P_e(e){return UH(t=>TH(n=>zr(BV(n(e(t))),{onNone:()=>null,onSome:e=>Wr(e.snapshot)})).pipe(GH(`environment-snapshot:${t}`)))}var E5={snapshot:Pr(),status:`empty`,error:Pr()};function D5(e){return Rr(e)?`cached`:`empty`}var F_e=`Could not synchronize environment data.`,I_e=Fp(`EnvironmentShellState.make`)(function*(){let e=yield*FK,t=yield*MG,n=yield*T5,r=yield*qf(xK),i=e.target.environmentId,a=yield*t.loadShell(i).pipe(Df(e=>Lp(`Could not load cached environment shell.`).pipe(Bp({environmentId:i,...bK(e)}),wf(Pr())))),o=yield*Ij({snapshot:a,status:D5(a),error:Pr()}),s=yield*GE(!1),c=yield*Dx(1),l=Fp(`EnvironmentShellState.persist`)(function*(e){yield*t.saveShell(i,e).pipe(Df(e=>Lp(`Could not persist environment shell cache.`).pipe(Bp({environmentId:i,...bK(e)}))))});yield*rC(c).pipe(yC(`500 millis`),kC(l),bp);let u=qE(s,!1).pipe(yf(Vj(o,e=>({...e,status:D5(e.snapshot)})))),d=Vj(o,e=>({...e,status:`synchronizing`,error:Pr()})),f=Vj(o,e=>e.status===`live`?e:{...e,status:`synchronizing`,error:Pr()}),p=e=>qE(s,!1).pipe(yf(Lp(`Could not synchronize the environment shell.`)),Bp({environmentId:i,...bK(e)}),yf(Vj(o,e=>({...e,status:D5(e.snapshot),error:Fr(F_e)})))),m=Fp(`EnvironmentShellState.applyItem`)(function*(e){if(e.kind===`synchronized`){yield*qE(s,!1),yield*Vj(o,e=>Rr(e.snapshot)?{...e,status:`live`,error:Pr()}:e);return}let t=yield*Rj(o),n=e.kind===`snapshot`?e.snapshot:zr(t.snapshot,{onNone:()=>null,onSome:t=>e.sequence>t.snapshotSequence?k_e(t,e):t});if(n===null)return;let r=yield*KE(s);yield*Bj(o,{snapshot:Fr(n),status:r?`synchronizing`:`live`,error:Pr()}),yield*Ox(c,n)}),h=zr(r,{onNone:()=>iC,onSome:e=>e.changes.pipe(fC(e=>e===`application-active`))});return yield*d,yield*bp(JK(qO.subscribeShell,Fp(`EnvironmentShellState.makeSubscribeInput`)(function*(t){let r=yield*t.initialConfig.pipe(Cf(e=>e.shellResumeCompletionMarker===!0),If(()=>!1));yield*qE(s,r),yield*d;let i=yield*Rj(e.prepared).pipe(_f(zr({onSome:M,onNone:()=>Lj(e.prepared).pipe(fC(Rr),oC(e=>e.value),OC,Cf(Jr))}))),a=yield*n.load(i);return Rr(a)?(yield*m({kind:`snapshot`,snapshot:a.value}),{afterSequence:a.value.snapshotSequence,...r?{requestCompletionMarker:!0}:{}}):r?{requestCompletionMarker:!0}:{}}),{onExpectedFailure:e=>p(Su(e)),retryExpectedFailureAfter:`250 millis`,resubscribe:h}).pipe(kC(m))),yield*Lj(e.state).pipe(kC(e=>{switch(uG(e)){case`synchronizing`:return d;case`disconnected`:return u;case`ready`:return f}}),bp),o});function L_e(e){return fq(e,aC(I_e().pipe(Cf(Lj))))}var R_e=Object.freeze({hasSnapshot:!1,hasSynchronizingShell:!1,hasCachedShell:!1,hasLiveShell:!1,firstError:null,latestSnapshotUpdatedAt:null}),z_e=new Map;function B_e(e,t){return e.hasSnapshot===t.hasSnapshot&&e.hasSynchronizingShell===t.hasSynchronizingShell&&e.hasCachedShell===t.hasCachedShell&&e.hasLiveShell===t.hasLiveShell&&e.firstError===t.firstError&&e.latestSnapshotUpdatedAt===t.latestSnapshotUpdatedAt}function V_e(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function H_e(e){let t=R_e;return TH(n=>{let r=!1,i=!1,a=!1,o=!1,s=null,c=null;for(let t of n(e.catalogValueAtom).entries.keys()){let l=n(e.shellStateValueAtom(t));if(i||=l.status===`synchronizing`,a||=l.status===`cached`,o||=l.status===`live`,s===null&&(s=Wr(l.error)),Lr(l.snapshot))continue;r=!0;let u=l.snapshot.value.updatedAt;(c===null||u>c)&&(c=u)}let l={hasSnapshot:r,hasSynchronizingShell:i,hasCachedShell:a,hasLiveShell:o,firstError:s,latestSnapshotUpdatedAt:c};return B_e(t,l)||(t=l),t}).pipe(GH(`environment-shell-summary`))}function U_e(e){let t=z_e;return TH(n=>{let r=new Map;for(let t of n(e.catalogValueAtom).entries.keys()){let i=n(e.serverConfigValueAtom(t));i!==null&&r.set(t,i)}return V_e(t,r)||(t=r),t}).pipe(GH(`environment-server-configs`))}function W_e(e){let t=UH(t=>e.atom(L_e(t),{initialValue:E5}));return{stateAtom:t,stateValueAtom:UH(e=>TH(n=>Br(BV(n(t(e))),()=>E5)).pipe(GH(`environment-shell-state-value:${e}`)))}}var G_e=[{key:`mod+b`,command:`sidebar.toggle`},{key:`mod+j`,command:`terminal.toggle`},{key:`mod+alt+b`,command:`rightPanel.toggle`},{key:`mod+d`,command:`terminal.split`,when:`terminalFocus`},{key:`mod+shift+d`,command:`terminal.splitVertical`,when:`terminalFocus`},{key:`mod+n`,command:`terminal.new`,when:`terminalFocus`},{key:`mod+w`,command:`terminal.close`,when:`terminalFocus`},{key:`mod+d`,command:`diff.toggle`,when:`!terminalFocus`},{key:`mod+shift+j`,command:`preview.toggle`},{key:`mod+r`,command:`preview.refresh`,when:`previewFocus`},{key:`mod+l`,command:`preview.focusUrl`,when:`previewFocus`},{key:`mod+=`,command:`preview.zoomIn`,when:`previewFocus`},{key:`mod++`,command:`preview.zoomIn`,when:`previewFocus`},{key:`mod+-`,command:`preview.zoomOut`,when:`previewFocus`},{key:`mod+0`,command:`preview.resetZoom`,when:`previewFocus`},{key:`mod+k`,command:`commandPalette.toggle`,when:`!terminalFocus`},{key:`mod+s`,command:`composer.stash`,when:`!terminalFocus`},{key:`mod+n`,command:`chat.new`,when:`!terminalFocus`},{key:`mod+shift+o`,command:`chat.new`,when:`!terminalFocus`},{key:`mod+shift+n`,command:`chat.newLocal`,when:`!terminalFocus`},{key:`mod+shift+m`,command:`modelPicker.toggle`,when:`!terminalFocus`},{key:`mod+o`,command:`editor.openFavorite`},{key:`mod+shift+[`,command:`thread.previous`},{key:`mod+shift+]`,command:`thread.next`},...iN.map((e,t)=>({key:`mod+${t+1}`,command:e})),...aN.map((e,t)=>({key:`mod+${t+1}`,command:e,when:`modelPickerOpen`}))];function K_e(e){return e===`space`?` `:e===`esc`?`escape`:e}function q_e(e){let t=[...e.toLowerCase().split(`+`).map(e=>e.trim())],n=0;for(;t[t.length-1]===``;)n+=1,t.pop();if(n>0&&t.push(`+`),t.some(e=>e.length===0)||t.length===0)return null;let r=null,i=!1,a=!1,o=!1,s=!1,c=!1;for(let e of t)switch(e){case`cmd`:case`meta`:i=!0;break;case`ctrl`:case`control`:a=!0;break;case`shift`:o=!0;break;case`alt`:case`option`:s=!0;break;case`mod`:c=!0;break;default:if(r!==null)return null;r=K_e(e)}return r===null?null:{key:r,metaKey:i,ctrlKey:a,shiftKey:o,altKey:s,modKey:c}}function J_e(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!r)break;if(/\s/.test(r)){n+=1;continue}if(e.startsWith(`&&`,n)){t.push({type:`and`}),n+=2;continue}if(e.startsWith(`||`,n)){t.push({type:`or`}),n+=2;continue}if(r===`!`){t.push({type:`not`}),n+=1;continue}if(r===`(`){t.push({type:`lparen`}),n+=1;continue}if(r===`)`){t.push({type:`rparen`}),n+=1;continue}let i=/^[A-Za-z_][A-Za-z0-9_.-]*/.exec(e.slice(n));if(!i)return null;t.push({type:`identifier`,value:i[0]}),n+=i[0].length}return t}function O5(e){let t=J_e(e);if(!t||t.length===0)return null;let n=0,r=e=>{if(e>64)return null;let r=t[n];if(!r)return null;if(r.type===`identifier`)return n+=1,{type:`identifier`,name:r.value};if(r.type===`lparen`){n+=1;let r=o(e+1),i=t[n];return!r||!i||i.type!==`rparen`?null:(n+=1,r)}return null},i=e=>{let i=0;for(;t[n]?.type===`not`;)if(n+=1,i+=1,i>64)return null;let a=r(e);if(!a)return null;for(;i>0;)a={type:`not`,node:a},--i;return a},a=e=>{let r=i(e);if(!r)return null;for(;t[n]?.type===`and`;){n+=1;let t=i(e);if(!t)return null;r={type:`and`,left:r,right:t}}return r},o=e=>{let r=a(e);if(!r)return null;for(;t[n]?.type===`or`;){n+=1;let t=a(e);if(!t)return null;r={type:`or`,left:r,right:t}}return r},s=o(0);return!s||n!==t.length?null:s}function Y_e(e){let t=q_e(e.key);if(!t)return null;if(e.when!==void 0){let n=O5(e.when);return n?{command:e.command,shortcut:t,whenAst:n}:null}return{command:e.command,shortcut:t}}function X_e(e){let t=[];for(let n of e){let e=Y_e(n);e&&t.push(e)}return t.slice(-256)}var k5=X_e(G_e),A5=Object.freeze({isReady:!1,entries:new Map});function Z_e(e){let t=ZK(),n={mode:`serial`,key:()=>`environment-catalog`},r=e.atom(aC(BK.pipe(Cf(e=>Lj(e.entries).pipe(oC(e=>({isReady:!0,entries:e})))))),{initialValue:A5}),i=TH(e=>Br(BV(e(r)),()=>A5)).pipe(GH(`environment-catalog-value`)),a=e.atom(aC(BK.pipe(Cf(e=>Lj(e.networkStatus)))),{initialValue:`unknown`});return{catalogAtom:r,catalogValueAtom:i,networkStatusAtom:a,networkStatusValueAtom:TH(e=>Br(BV(e(a)),()=>`unknown`)).pipe(GH(`environment-network-status-value`)),stateAtom:UH(t=>e.atom(fq(t,aC(FK.pipe(Cf(e=>Lj(e.state))))),{initialValue:dG})),register:aq(e,{label:`environment-catalog:register`,scheduler:t,concurrency:n,execute:e=>BK.pipe(_f(t=>t.register(e)))}),remove:aq(e,{label:`environment-catalog:remove`,scheduler:t,concurrency:n,execute:e=>BK.pipe(_f(t=>t.remove(e)))}),retryNow:aq(e,{label:`environment-catalog:retry-now`,scheduler:t,concurrency:n,execute:e=>BK.pipe(_f(t=>t.retryNow(e)))})}}var j5=`token`,Q_e=`host`,$_e=`label`,eve=new Set([`http:`,`https:`,`ws:`,`wss:`]),M5=e=>new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash),N5=class extends G()(`RemoteBackendUrlMissingError`,{}){get message(){return`Enter a backend URL.`}},P5=class extends G()(`RemotePairingUrlInvalidError`,{cause:F(Cb()),protocol:F(L)}){get message(){return`Pairing URL is invalid.`}},F5=class extends G()(`RemoteBackendUrlInvalidError`,{source:H([`direct-host`,`hosted-pairing-host`]),cause:F(Cb()),protocol:F(L)}){get message(){return`Backend URL is invalid.`}},I5=class extends G()(`RemotePairingTokenMissingError`,{host:L}){get message(){return`Pairing URL is missing its token.`}},L5=class extends G()(`RemotePairingCodeMissingError`,{host:L}){get message(){return`Enter a pairing code.`}};V([N5,P5,F5,I5,L5]);var R5=e=>eve.has(e.protocol),z5=(e,t)=>{let n=e.trim();if(!n)throw new N5;let r=n.replace(/^\/+/,``),i=/^[a-zA-Z][a-zA-Z\d+-]*:\/\//.test(r)?r:`https://${r}`,a;try{a=new URL(i)}catch(e){throw new F5({source:t,cause:e})}if(!R5(a))throw new F5({source:t,protocol:a.protocol});return a.pathname=`/`,a.search=``,a.hash=``,a},B5=e=>{let t=new URL(e.toString());return t.protocol===`ws:`?t.protocol=`http:`:t.protocol===`wss:`&&(t.protocol=`https:`),t.pathname=`/`,t.search=``,t.hash=``,t.toString()},V5=e=>{let t=new URL(e.toString());return t.protocol===`http:`?t.protocol=`ws:`:t.protocol===`https:`&&(t.protocol=`wss:`),t.pathname=`/`,t.search=``,t.hash=``,t.toString()},H5=e=>{let t=M5(e).get(j5)?.trim()??``;if(t.length>0)return t;let n=e.searchParams.get(j5)?.trim()??``;return n.length>0?n:null},tve=e=>{let t=new URL(e.toString()),n=M5(t);return n.has(j5)&&(n.delete(j5),t.hash=n.toString()),t.searchParams.delete(j5),t},U5=(e,t)=>{let n=new URL(e.toString());return n.searchParams.delete(j5),n.hash=new URLSearchParams([[j5,t]]).toString(),n},nve=e=>{let t=e.searchParams.get(Q_e)?.trim()??``,n=H5(e)?.trim()??``,r=e.searchParams.get($_e)?.trim()??``;return!t||!n?null:{host:t,token:n,label:r}},rve=e=>{let t=e.pairingUrl?.trim()??``;if(t.length>0){let e;try{e=new URL(t)}catch(e){throw new P5({cause:e})}if(!R5(e))throw new P5({protocol:e.protocol});let n=nve(e);if(n){let e=z5(n.host,`hosted-pairing-host`);return{credential:n.token,httpBaseUrl:B5(e),wsBaseUrl:V5(e)}}let r=H5(e)??``;if(!r)throw new I5({host:e.host});return{credential:r,httpBaseUrl:B5(e),wsBaseUrl:V5(e)}}let n=e.host?.trim()??``,r=e.pairingCode?.trim()??``;if(!n)throw new N5;let i=z5(n,`direct-host`);if(!r)throw new L5({host:i.host});return{credential:r,httpBaseUrl:B5(i),wsBaseUrl:V5(i)}},W5=class extends ti()(`@p4code/client-runtime/connection/onboarding/ConnectionOnboarding`){},ive=Fp(`clientRuntime.connection.onboarding.resolvePairingTarget`)(function*(e){return yield*hf({try:()=>rve(e),catch:e=>new lG({reason:`configuration`,detail:e instanceof Error?e.message:`The pairing details are invalid.`})})}),ave=Fp(`clientRuntime.connection.onboarding.preparePairingRegistration`)(function*(e){let t=yield*ive(e),n=yield*QW,r=yield*gV({httpBaseUrl:t.httpBaseUrl}).pipe(jf(GG)),i=yield*zG({httpBaseUrl:t.httpBaseUrl,credential:t.credential,scopes:n.scopes,clientMetadata:n.metadata}).pipe(jf(GG)),a=`bearer:${r.environmentId}`;return new yG({target:new rG({environmentId:r.environmentId,label:r.label,connectionId:a}),profile:new pG({connectionId:a,environmentId:r.environmentId,label:r.label,httpBaseUrl:t.httpBaseUrl,wsBaseUrl:t.wsBaseUrl}),credential:new gG({token:i.access_token})})}),ove=Fp(`clientRuntime.connection.onboarding.registerPairingConnection`)(function*(e){let t=yield*ave(e);return yield*(yield*BK).register(t),t.target.environmentId}),sve=gy(gG),cve=gy(pG),lve=Fp(`clientRuntime.connection.onboarding.updateBearerConnection`)(function*(e){let t=yield*BK,n=yield*SG,r=(yield*Rj(t.entries)).get(e.environmentId),i=r?.target._tag===`BearerConnectionTarget`?yield*n.get(r.target.connectionId):Pr(),a=yield*uve({input:e,entry:Ur(r),credential:i});yield*t.register(a)}),uve=Fp(`clientRuntime.connection.onboarding.prepareBearerConnectionUpdate`)(function*(e){let t=Wr(e.entry);if(t==null||t.target._tag!==`BearerConnectionTarget`||Lr(t.profile)||!cve(t.profile.value))return yield*new lG({reason:`configuration`,detail:`Only saved bearer environments can be edited.`});let n=e.credential;if(Lr(n)||!sve(n.value))return yield*new lG({reason:`authentication`,detail:`The saved bearer credential is unavailable.`});let r=e.input.label.trim();if(r===``)return yield*new lG({reason:`configuration`,detail:`Environment label cannot be empty.`});let i=yield*hf({try:()=>Zp(e.input.httpBaseUrl),catch:e=>new lG({reason:`configuration`,detail:e instanceof Error?e.message:`The environment URL is invalid.`})}),a=t.target.connectionId;return new yG({target:new rG({environmentId:e.input.environmentId,label:r,connectionId:a}),profile:new pG({connectionId:a,environmentId:e.input.environmentId,label:r,httpBaseUrl:i,wsBaseUrl:Qp(i)}),credential:n.value})}),dve=Fp(`clientRuntime.connection.onboarding.prepareSshRegistration`)(function*(e){let t=yield*(yield*eG).provision(e.target),n=`ssh:${t.environmentId}`,r=e.label?.trim()||t.label||t.bootstrap.target.alias;return new bG({target:new iG({environmentId:t.environmentId,label:r,connectionId:n}),profile:new mG({connectionId:n,environmentId:t.environmentId,label:r,target:t.bootstrap.target})})}),fve=Fp(`clientRuntime.connection.onboarding.registerSshConnection`)(function*(e){let t=yield*dve(e);return yield*(yield*BK).register(t),t.target.environmentId}),pve=Ql(W5,df(function*(){let e=yield*BK,t=yield*QW,n=yield*QE,r=yield*eG,i=yield*SG;return W5.of({registerPairing:r=>ove(r).pipe(Yf(BK,e),Yf(QW,t),Yf(QE,n)),registerSsh:t=>fve(t).pipe(Yf(BK,e),Yf(eG,r)),updateBearer:t=>lve(t).pipe(Yf(BK,e),Yf(SG,i))})})),G5=class extends ti()(`@p4code/client-runtime/platform/source/PlatformConnectionSource`){},mve=rK.pipe(su(JG)),hve=uK.pipe(su(iu(mve,cK))),K5=VK.pipe(su(hve)),gve=iu(K5,pve.pipe(su(K5))),_ve=tu(df(function*(){let e=yield*BK,t=yield*G5;yield*e.start,yield*t.registrations.pipe(kC(e.reconcilePlatform),bp)}).pipe(gp(`clientRuntime.connection.application.start`))).pipe(cu(gve));function vve(e){switch(e.phase){case`available`:return{phase:`available`,error:null,traceId:null};case`offline`:return{phase:`offline`,error:null,traceId:null};case`connecting`:return{phase:e.attempt<=1&&e.lastFailure===null?`connecting`:`reconnecting`,error:e.lastFailure?.message??null,traceId:e.lastFailure?.traceId??null};case`connected`:return{phase:`connected`,error:null,traceId:null};case`backoff`:return{phase:`reconnecting`,error:e.lastFailure?.message??null,traceId:e.lastFailure?.traceId??null};case`blocked`:return{phase:`error`,error:e.lastFailure?.message??null,traceId:e.lastFailure?.traceId??null}}}function q5(e){switch(e.phase){case`available`:return`Available`;case`offline`:return`Offline`;case`connecting`:return`Connecting...`;case`reconnecting`:return e.error?`Failed to connect. Reconnecting... Reason: ${e.error}`:`Reconnecting...`;case`connected`:return`Connected`;case`error`:return e.error?`Connection failed. Reason: ${e.error}`:`Connection failed`}}function yve(e){return e.phase===`reconnecting`&&e.error?`Failed to connect. Reconnecting...`:q5({...e,error:null})}function bve(e){return vve(e)}function xve(e){switch(e.target._tag){case`PrimaryConnectionTarget`:return e.target.httpBaseUrl;case`BearerConnectionTarget`:return Rr(e.profile)&&e.profile.value._tag===`BearerConnectionProfile`?e.profile.value.httpBaseUrl:null;case`SshConnectionTarget`:return Rr(e.profile)&&e.profile.value._tag===`SshConnectionProfile`?`${e.profile.value.target.username}@${e.profile.value.target.hostname}`:null}}var Sve=6e3,Cve=Fp(`clientRuntime.state.fetchEnvironmentThreadSnapshot`)(function*(e){let t=$p(e.prepared.httpBaseUrl,`/api/orchestration/threads/${e.threadId}`),n=yield*fV(e.prepared.httpBaseUrl),r=w5(e.prepared.httpAuthorization);return yield*mV(t,e.timeoutMs??Sve,C5(e.prepared.httpAuthorization,n.orchestration.threadSnapshot({params:{threadId:e.threadId},headers:r})))}),J5=class extends ti()(`@p4code/client-runtime/state/threadSnapshotHttp/ThreadSnapshotLoader`){},wve=Ql(J5,df(function*(){let e=yield*QE;return J5.of({load:(t,n)=>Cve({prepared:t,threadId:n}).pipe(Cf(Fr),Yf(QE,e),kf({EnvironmentResourceNotFoundError:()=>zp(`Thread snapshot not found over HTTP; deferring to the socket subscription.`).pipe(Bp({threadId:n}),wf(Pr()))}),Af(e=>Lp(`Could not load the thread snapshot over HTTP; using the socket snapshot instead.`).pipe(Bp({threadId:n,cause:Tu(e)}),wf(Pr()))))})})),Tve=class extends G()(`InvalidScopedProjectKeyError`,{key:L}){get message(){return`Invalid scoped project atom key: ${JSON.stringify(this.key)}.`}},Eve=class extends G()(`InvalidScopedThreadKeyError`,{key:L}){get message(){return`Invalid scoped thread atom key: ${JSON.stringify(this.key)}.`}},Dve=class extends G()(`InvalidScopedProjectRefCollectionKeyError`,{key:L,cause:Cb()}){get message(){return`Invalid scoped project reference collection atom key: ${JSON.stringify(this.key)}.`}},Ove=xy(B(Ry([L,L])));function kve(e){return`${e.environmentId}\u0000${e.projectId}`}function Y5(e){return`${e.environmentId}\u0000${e.threadId}`}function Ave(e){return JSON.stringify(e.map(e=>[e.environmentId,e.projectId]))}function jve(e){let t=e.indexOf(`\0`);if(t<0)throw new Tve({key:e});return{environmentId:Xb.make(e.slice(0,t)),projectId:Jb.make(e.slice(t+1))}}function Mve(e){let t;try{t=Ove(JSON.parse(e))}catch(t){throw new Dve({key:e,cause:t})}return t.map(([e,t])=>({environmentId:Xb.make(e),projectId:Jb.make(t)}))}function X5(e){let t=e.indexOf(`\0`);if(t<0)throw new Eve({key:e});return{environmentId:Xb.make(e.slice(0,t)),threadId:Y.make(e.slice(t+1))}}function Nve(e,t){return e.length===t.length&&e.every((e,n)=>e.environmentId===t[n]?.environmentId&&e.projectId===t[n]?.projectId)}function Z5(e,t){return e.length===t.length&&e.every((e,n)=>e.environmentId===t[n]?.environmentId&&e.threadId===t[n]?.threadId)}function Q5(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}var Pve=wr(Er(br,e=>e.createdAt),Er(br,e=>e.id)),$5=Er(xr,e=>e.checkpointTurnCount??2**53-1),Fve=Tr([Er(xr,e=>e.sequence??2**53-1),Er(br,e=>e.createdAt),Er(br,e=>e.id)]);function Ive(e,t){switch(t.type){case`project.created`:case`project.meta-updated`:case`project.deleted`:return{kind:`unchanged`};case`thread.created`:return{kind:`updated`,thread:{id:t.payload.threadId,projectId:t.payload.projectId,title:t.payload.title,modelSelection:t.payload.modelSelection,runtimeMode:t.payload.runtimeMode,interactionMode:t.payload.interactionMode,compressMode:t.payload.compressMode,unpromptedSubagents:t.payload.unpromptedSubagents,branch:t.payload.branch,worktreePath:t.payload.worktreePath,latestTurn:null,createdAt:t.payload.createdAt,updatedAt:t.payload.updatedAt,archivedAt:null,settledOverride:null,settledAt:null,snoozedUntil:null,snoozedAt:null,deletedAt:null,messages:[],proposedPlans:[],activities:[],checkpoints:[],session:null}};case`thread.deleted`:return{kind:`deleted`};case`thread.archived`:return{kind:`updated`,thread:{...e,archivedAt:t.payload.archivedAt,updatedAt:t.payload.updatedAt}};case`thread.unarchived`:return{kind:`updated`,thread:{...e,archivedAt:null,updatedAt:t.payload.updatedAt}};case`thread.settled`:return{kind:`updated`,thread:{...e,settledOverride:`settled`,settledAt:t.payload.settledAt,updatedAt:t.payload.updatedAt}};case`thread.unsettled`:return{kind:`updated`,thread:{...e,settledOverride:t.payload.reason===`user`?`active`:null,settledAt:null,updatedAt:t.payload.updatedAt}};case`thread.snoozed`:return{kind:`updated`,thread:{...e,snoozedUntil:t.payload.snoozedUntil,snoozedAt:t.payload.snoozedAt,updatedAt:t.payload.updatedAt}};case`thread.unsnoozed`:return{kind:`updated`,thread:{...e,snoozedUntil:null,snoozedAt:null,updatedAt:t.payload.updatedAt}};case`thread.meta-updated`:return{kind:`updated`,thread:{...e,...t.payload.title===void 0?{}:{title:t.payload.title},...t.payload.modelSelection===void 0?{}:{modelSelection:t.payload.modelSelection},...t.payload.branch===void 0?{}:{branch:t.payload.branch},...t.payload.worktreePath===void 0?{}:{worktreePath:t.payload.worktreePath},updatedAt:t.payload.updatedAt}};case`thread.runtime-mode-set`:return{kind:`updated`,thread:{...e,runtimeMode:t.payload.runtimeMode,updatedAt:t.payload.updatedAt}};case`thread.interaction-mode-set`:return{kind:`updated`,thread:{...e,interactionMode:t.payload.interactionMode,updatedAt:t.payload.updatedAt}};case`thread.compress-mode-set`:return{kind:`updated`,thread:{...e,compressMode:t.payload.compressMode,updatedAt:t.payload.updatedAt}};case`thread.unprompted-subagents-set`:return{kind:`updated`,thread:{...e,unpromptedSubagents:t.payload.unpromptedSubagents,updatedAt:t.payload.updatedAt}};case`thread.turn-start-requested`:return{kind:`updated`,thread:{...e,...t.payload.modelSelection===void 0?{}:{modelSelection:t.payload.modelSelection},runtimeMode:t.payload.runtimeMode,interactionMode:t.payload.interactionMode,compressMode:t.payload.compressMode,unpromptedSubagents:t.payload.unpromptedSubagents,updatedAt:t.occurredAt}};case`thread.turn-interrupt-requested`:{if(t.payload.turnId===void 0)return{kind:`unchanged`};let n=e.latestTurn;return n===null||n.turnId!==t.payload.turnId?{kind:`unchanged`}:{kind:`updated`,thread:{...e,latestTurn:{...n,state:`interrupted`,startedAt:n.startedAt??t.payload.createdAt,completedAt:n.completedAt??t.payload.createdAt},updatedAt:t.occurredAt}}}case`thread.message-sent`:{let n={id:t.payload.messageId,role:t.payload.role,text:t.payload.text,...t.payload.attachments===void 0?{}:{attachments:t.payload.attachments},turnId:t.payload.turnId,streaming:t.payload.streaming,createdAt:t.payload.createdAt,updatedAt:t.payload.updatedAt},r=e.messages.find(e=>e.id===n.id)?ha(e.messages,e=>e.id===n.id?{...e,text:n.streaming?`${e.text}${n.text}`:n.text.length>0?n.text:e.text,streaming:n.streaming,...n.turnId===void 0?{}:{turnId:n.turnId},...n.streaming?{}:{updatedAt:n.updatedAt},...n.attachments===void 0?{}:{attachments:n.attachments}}:e):ea(e.messages,n),i=t.payload.turnId!==null&&e.session?.status===`running`&&e.session.activeTurnId===t.payload.turnId,a=!t.payload.streaming&&!i,o=t.payload.role===`assistant`&&t.payload.turnId!==null&&(e.latestTurn===null||e.latestTurn.turnId===t.payload.turnId)?{turnId:t.payload.turnId,state:a?e.latestTurn?.state===`interrupted`?`interrupted`:e.latestTurn?.state===`error`?`error`:`completed`:`running`,requestedAt:e.latestTurn?.turnId===t.payload.turnId?e.latestTurn.requestedAt:t.payload.createdAt,startedAt:e.latestTurn?.turnId===t.payload.turnId?e.latestTurn.startedAt??t.payload.createdAt:t.payload.createdAt,completedAt:a?t.payload.updatedAt:e.latestTurn?.turnId===t.payload.turnId?e.latestTurn.completedAt??null:null,assistantMessageId:t.payload.messageId}:e.latestTurn,s=t.payload.role===`assistant`&&t.payload.turnId!==null?Rve(e.checkpoints,t.payload.turnId,t.payload.messageId):e.checkpoints;return{kind:`updated`,thread:{...e,messages:r,checkpoints:s,latestTurn:o,updatedAt:t.occurredAt}}}case`thread.session-set`:{let n=Lve(t.payload.session.status),r=t.payload.session.status===`running`&&t.payload.session.activeTurnId!==null?{turnId:t.payload.session.activeTurnId,state:`running`,requestedAt:e.latestTurn?.turnId===t.payload.session.activeTurnId?e.latestTurn.requestedAt:t.payload.session.updatedAt,startedAt:e.latestTurn?.turnId===t.payload.session.activeTurnId?e.latestTurn.startedAt??t.payload.session.updatedAt:t.payload.session.updatedAt,completedAt:null,assistantMessageId:e.latestTurn?.turnId===t.payload.session.activeTurnId?e.latestTurn.assistantMessageId:null}:e.latestTurn!==null&&e.latestTurn.state===`running`&&n!==null?{...e.latestTurn,state:n,completedAt:t.payload.session.updatedAt}:e.latestTurn;return{kind:`updated`,thread:{...e,session:t.payload.session,latestTurn:r,updatedAt:t.occurredAt}}}case`thread.session-stop-requested`:return e.session===null?{kind:`unchanged`}:{kind:`updated`,thread:{...e,session:{...e.session,status:`stopped`,activeTurnId:null,updatedAt:t.payload.createdAt},updatedAt:t.occurredAt}};case`thread.proposed-plan-upserted`:{let n=t.payload.proposedPlan,r=Re(e.proposedPlans,_a(e=>e.id!==n.id),ea(n),ua(Pve));return{kind:`updated`,thread:{...e,proposedPlans:r,updatedAt:t.occurredAt}}}case`thread.turn-diff-completed`:{let n={turnId:t.payload.turnId,checkpointTurnCount:t.payload.checkpointTurnCount,checkpointRef:t.payload.checkpointRef,status:t.payload.status,files:t.payload.files,assistantMessageId:t.payload.assistantMessageId,completedAt:t.payload.completedAt},r=e.checkpoints.find(e=>e.turnId===n.turnId);if(r&&r.status!==`missing`&&n.status===`missing`)return{kind:`unchanged`};let i=Re(e.checkpoints,_a(e=>e.turnId!==n.turnId),ea(n),ua($5)),a=!(e.session?.status===`running`&&e.session.activeTurnId===t.payload.turnId)&&(e.latestTurn===null||e.latestTurn.turnId===t.payload.turnId)?{turnId:t.payload.turnId,state:e7(t.payload.status),requestedAt:e.latestTurn?.requestedAt??t.payload.completedAt,startedAt:e.latestTurn?.startedAt??t.payload.completedAt,completedAt:t.payload.completedAt,assistantMessageId:t.payload.assistantMessageId}:e.latestTurn;return{kind:`updated`,thread:{...e,checkpoints:i,latestTurn:a,updatedAt:t.occurredAt}}}case`thread.reverted`:{let n=Re(e.checkpoints,_a(e=>e.checkpointTurnCount!==void 0&&e.checkpointTurnCount<=t.payload.turnCount),ua($5)),r=new Set(ha(n,e=>e.turnId)),i=zve(e.messages,r),a=Re(e.proposedPlans,_a(e=>e.turnId===null||r.has(e.turnId))),o=Re(e.activities,_a(e=>e.turnId===null||r.has(e.turnId))),s=n.at(-1)??null;return{kind:`updated`,thread:{...e,checkpoints:n,messages:i,proposedPlans:a,activities:o,latestTurn:s===null?null:{turnId:s.turnId,state:e7(s.status),requestedAt:s.completedAt,startedAt:s.completedAt,completedAt:s.completedAt,assistantMessageId:s.assistantMessageId??null},updatedAt:t.occurredAt}}}case`thread.activity-appended`:{let n=Re(e.activities,_a(e=>e.id!==t.payload.activity.id),ea(t.payload.activity),ua(Fve));return{kind:`updated`,thread:{...e,activities:n,updatedAt:t.occurredAt}}}case`thread.approval-response-requested`:case`thread.user-input-response-requested`:case`thread.checkpoint-revert-requested`:return{kind:`unchanged`}}return{kind:`unchanged`}}function Lve(e){switch(e){case`idle`:case`ready`:return`completed`;case`error`:return`error`;case`interrupted`:case`stopped`:return`interrupted`;case`starting`:case`running`:return null}}function e7(e){switch(e){case`ready`:return`completed`;case`error`:return`error`;case`missing`:return`completed`}}function Rve(e,t,n){return ha(e,e=>e.turnId===t?{...e,assistantMessageId:n}:e)}function zve(e,t){return _a(e,e=>e.role===`system`||e.turnId===null?!0:t.has(e.turnId))}var t7=5*6e4,n7={data:Pr(),status:`empty`,error:Pr()},r7=``,Bve=br;function Vve(e){return Re(e,ua(Bve),e=>e.join(r7))}function Hve(e){return e.length===0?[]:Re(e.split(r7),ha(e=>Xb.make(e)))}function Uve(e){return UH(t=>TH(n=>{let r=[],i=null,a=!1;for(let o of Hve(t)){let t=n(e.getSnapshotAtom(o));a||=t.waiting;let s=Wr(BV(t));s!==null&&r.push({environmentId:o,snapshot:s}),i===null&&t._tag===`Failure`&&(i=`Failed to load archived threads.`)}return{snapshots:r,error:i,isLoading:a}}).pipe(GH(`${e.labelPrefix}:${t}`)))}function i7(e){return df(function*(){return e.commandId===void 0?yield*(yield*wj).randomUUIDv4.pipe(Mf,Cf(Zb.make)):e.commandId})}function a7(e){return Qd({commandId:i7(e),createdAt:e.createdAt===void 0?Cm.pipe(Cf(km)):M(e.createdAt)})}function o7(e){return KK(qO.dispatchCommand,e)}var Wve=Fp(`EnvironmentCommands.createProject`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`project.create`,commandId:t.commandId,createdAt:t.createdAt})}),Gve=Fp(`EnvironmentCommands.updateProject`)(function*(e){return yield*o7({...e,type:`project.meta.update`,commandId:yield*i7(e)})}),Kve=Fp(`EnvironmentCommands.deleteProject`)(function*(e){return yield*o7({...e,type:`project.delete`,commandId:yield*i7(e)})}),qve=Fp(`EnvironmentCommands.createThread`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.create`,commandId:t.commandId,createdAt:t.createdAt})}),Jve=Fp(`EnvironmentCommands.deleteThread`)(function*(e){return yield*o7({...e,type:`thread.delete`,commandId:yield*i7(e)})}),Yve=Fp(`EnvironmentCommands.archiveThread`)(function*(e){return yield*o7({...e,type:`thread.archive`,commandId:yield*i7(e)})}),Xve=Fp(`EnvironmentCommands.unarchiveThread`)(function*(e){return yield*o7({...e,type:`thread.unarchive`,commandId:yield*i7(e)})}),Zve=Fp(`EnvironmentCommands.settleThread`)(function*(e){return yield*o7({...e,type:`thread.settle`,commandId:yield*i7(e)})}),Qve=Fp(`EnvironmentCommands.unsettleThread`)(function*(e){return yield*o7({...e,type:`thread.unsettle`,commandId:yield*i7(e)})}),$ve=Fp(`EnvironmentCommands.snoozeThread`)(function*(e){return yield*o7({...e,type:`thread.snooze`,commandId:yield*i7(e)})}),eye=Fp(`EnvironmentCommands.unsnoozeThread`)(function*(e){return yield*o7({...e,type:`thread.unsnooze`,commandId:yield*i7(e)})}),tye=Fp(`EnvironmentCommands.updateThreadMetadata`)(function*(e){return yield*o7({...e,type:`thread.meta.update`,commandId:yield*i7(e)})}),nye=Fp(`EnvironmentCommands.setThreadRuntimeMode`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.runtime-mode.set`,commandId:t.commandId,createdAt:t.createdAt})}),rye=Fp(`EnvironmentCommands.setThreadInteractionMode`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.interaction-mode.set`,commandId:t.commandId,createdAt:t.createdAt})}),iye=Fp(`EnvironmentCommands.setThreadCompressMode`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.compress-mode.set`,commandId:t.commandId,createdAt:t.createdAt})}),aye=Fp(`EnvironmentCommands.setThreadUnpromptedSubagents`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.unprompted-subagents.set`,commandId:t.commandId,createdAt:t.createdAt})}),oye=Fp(`EnvironmentCommands.startThreadTurn`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.turn.start`,commandId:t.commandId,createdAt:t.createdAt})}),sye=Fp(`EnvironmentCommands.interruptThreadTurn`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.turn.interrupt`,commandId:t.commandId,createdAt:t.createdAt})}),cye=Fp(`EnvironmentCommands.respondToThreadApproval`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.approval.respond`,commandId:t.commandId,createdAt:t.createdAt})}),lye=Fp(`EnvironmentCommands.respondToThreadUserInput`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.user-input.respond`,commandId:t.commandId,createdAt:t.createdAt})}),uye=Fp(`EnvironmentCommands.revertThreadCheckpoint`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.checkpoint.revert`,commandId:t.commandId,createdAt:t.createdAt})}),dye=Fp(`EnvironmentCommands.stopThreadSession`)(function*(e){let t=yield*a7(e);return yield*o7({...e,type:`thread.session.stop`,commandId:t.commandId,createdAt:t.createdAt})});function fye(e){let t=ZK(),n={mode:`serial`,key:({environmentId:e,input:t})=>JSON.stringify([e,t.threadId])};return{create:hq(e,{label:`environment-data:commands:thread:create`,execute:e=>qve(e),scheduler:t,concurrency:n}),delete:hq(e,{label:`environment-data:commands:thread:delete`,execute:e=>Jve(e),scheduler:t,concurrency:n}),archive:hq(e,{label:`environment-data:commands:thread:archive`,execute:e=>Yve(e),scheduler:t,concurrency:n}),unarchive:hq(e,{label:`environment-data:commands:thread:unarchive`,execute:e=>Xve(e),scheduler:t,concurrency:n}),settle:hq(e,{label:`environment-data:commands:thread:settle`,execute:e=>Zve(e),scheduler:t,concurrency:n}),unsettle:hq(e,{label:`environment-data:commands:thread:unsettle`,execute:e=>Qve(e),scheduler:t,concurrency:n}),snooze:hq(e,{label:`environment-data:commands:thread:snooze`,execute:e=>$ve(e),scheduler:t,concurrency:n}),unsnooze:hq(e,{label:`environment-data:commands:thread:unsnooze`,execute:e=>eye(e),scheduler:t,concurrency:n}),updateMetadata:hq(e,{label:`environment-data:commands:thread:update-metadata`,execute:e=>tye(e),scheduler:t,concurrency:n}),setRuntimeMode:hq(e,{label:`environment-data:commands:thread:set-runtime-mode`,execute:e=>nye(e),scheduler:t,concurrency:n}),setInteractionMode:hq(e,{label:`environment-data:commands:thread:set-interaction-mode`,execute:e=>rye(e),scheduler:t,concurrency:n}),setCompressMode:hq(e,{label:`environment-data:commands:thread:set-compress-mode`,execute:e=>iye(e),scheduler:t,concurrency:n}),setUnpromptedSubagents:hq(e,{label:`environment-data:commands:thread:set-unprompted-subagents`,execute:e=>aye(e),scheduler:t,concurrency:n}),startTurn:hq(e,{label:`environment-data:commands:thread:start-turn`,execute:e=>oye(e),scheduler:t,concurrency:n}),interruptTurn:hq(e,{label:`environment-data:commands:thread:interrupt-turn`,execute:e=>sye(e),scheduler:t,concurrency:n}),respondToApproval:hq(e,{label:`environment-data:commands:thread:respond-to-approval`,execute:e=>cye(e),scheduler:t,concurrency:n}),respondToUserInput:hq(e,{label:`environment-data:commands:thread:respond-to-user-input`,execute:e=>lye(e),scheduler:t,concurrency:n}),revertCheckpoint:hq(e,{label:`environment-data:commands:thread:revert-checkpoint`,execute:e=>uye(e),scheduler:t,concurrency:n}),stopSession:hq(e,{label:`environment-data:commands:thread:stop-session`,execute:e=>dye(e),scheduler:t,concurrency:n})}}var pye=Object.freeze([]),mye=Object.freeze([]),hye=Object.freeze([]),gye=Object.freeze([]);function _ye(e,t){return e===null||t===null||e.environmentId!==t.environmentId||e.id!==t.id?e:{...e,environmentId:t.environmentId,id:t.id,projectId:t.projectId,title:t.title,modelSelection:t.modelSelection,runtimeMode:t.runtimeMode,interactionMode:t.interactionMode,compressMode:t.compressMode,unpromptedSubagents:t.unpromptedSubagents,branch:t.branch,worktreePath:t.worktreePath,latestTurn:t.latestTurn,createdAt:t.createdAt,updatedAt:t.updatedAt,archivedAt:t.archivedAt,settledOverride:t.settledOverride,settledAt:t.settledAt,snoozedUntil:t.snoozedUntil,snoozedAt:t.snoozedAt,session:t.session}}function vye(e){let t=UH(t=>{let n=X5(t);return TH(t=>Br(BV(t(e(n.environmentId,n.threadId))),()=>n7)).pipe(hH(t7),GH(`environment-thread-state-value:${t}`))}),n=UH(e=>{let n=X5(e),r=null,i=null;return TH(a=>{let o=Wr(a(t(e)).data);return o===r?i:(r=o,i=o===null?null:M_e(n.environmentId,o),i)}).pipe(hH(t7),GH(`environment-thread-detail:${e}`))}),r=UH(e=>TH(n=>n(t(e)).status).pipe(hH(t7),GH(`environment-thread-status:${e}`))),i=UH(e=>TH(n=>Wr(n(t(e)).error)).pipe(hH(t7),GH(`environment-thread-error:${e}`))),a=UH(e=>TH(t=>t(n(e))?.messages??pye).pipe(hH(t7),GH(`environment-thread-messages:${e}`))),o=UH(e=>TH(t=>t(n(e))?.activities??mye).pipe(hH(t7),GH(`environment-thread-activities:${e}`))),s=UH(e=>TH(t=>t(n(e))?.proposedPlans??hye).pipe(hH(t7),GH(`environment-thread-proposed-plans:${e}`))),c=UH(e=>TH(t=>t(n(e))?.checkpoints??gye).pipe(hH(t7),GH(`environment-thread-checkpoints:${e}`))),l=UH(e=>TH(t=>t(n(e))?.session??null).pipe(hH(t7),GH(`environment-thread-session:${e}`))),u=UH(e=>TH(t=>t(n(e))?.latestTurn??null).pipe(hH(t7),GH(`environment-thread-latest-turn:${e}`)));return{stateAtom:e=>t(Y5(e)),detailAtom:e=>n(Y5(e)),statusAtom:e=>r(Y5(e)),errorAtom:e=>i(Y5(e)),messagesAtom:e=>a(Y5(e)),activitiesAtom:e=>o(Y5(e)),proposedPlansAtom:e=>s(Y5(e)),checkpointsAtom:e=>c(Y5(e)),sessionAtom:e=>l(Y5(e)),latestTurnAtom:e=>u(Y5(e))}}var yye=Object.freeze([]),bye=Object.freeze([]),xye=new Map,s7=new Map;function Sye(e){let t=UH(t=>TH(n=>n(e.snapshotAtom(t))?.threads??yye).pipe(GH(`environment-threads:${t}`))),n=UH(e=>TH(n=>{let r=n(t(e));return r.length===0?xye:new Map(r.map(e=>[e.id,e]))}).pipe(GH(`environment-thread-index:${e}`))),r=UH(e=>{let n=[];return TH(r=>{let i=r(t(e)).map(t=>({environmentId:e,threadId:t.id}));return Z5(n,i)?n:(n=i,i)}).pipe(GH(`environment-thread-refs:${e}`))}),i=UH(e=>{let n=s7;return TH(r=>{let i=new Map;for(let n of r(t(e))){let t=i.get(n.projectId),r={environmentId:e,threadId:n.id};t===void 0?i.set(n.projectId,[r]):t.push(r)}if(i.size===0)return n=s7,n;let a=new Map;for(let[e,t]of i){let r=n.get(e);a.set(e,r!==void 0&&Z5(r,t)?r:t)}return n=a,n}).pipe(GH(`environment-thread-refs-by-project:${e}`))}),a=UH(e=>{let t=X5(e),r=null,i=null;return TH(e=>{let a=e(n(t.environmentId)).get(t.threadId)??null;return a===r?i:(r=a,i=a===null?null:j_e(t.environmentId,a),i)}).pipe(GH(`environment-thread-shell:${e}`))}),o=UH(e=>{let t=Mve(e),n=[];return TH(e=>{let r=[],o=new Set;for(let n of t){let t=e(i(n.environmentId)).get(n.projectId)??bye;for(let n of t){let t=Y5(n);if(o.has(t))continue;o.add(t);let i=e(a(t));i!==null&&r.push(i)}}return Q5(n,r)||(n=r),n}).pipe(GH(`environment-thread-shells-for-projects:${e}`))}),s=[],c=TH(t=>{let n=[];for(let i of t(e.catalogValueAtom).entries.keys())n.push(...t(r(i)));return Z5(s,n)?s:(s=n,n)}).pipe(GH(`environment-thread-refs`)),l=[];return{environmentThreadsAtom:t,environmentThreadIndexAtom:n,environmentThreadRefsAtom:r,environmentThreadRefsByProjectAtom:i,threadRefsAtom:c,threadShellsAtom:TH(e=>{let t=e(c).flatMap(t=>{let n=e(a(Y5(t)));return n===null?[]:[n]});return Q5(l,t)||(l=t),l}).pipe(GH(`environment-thread-shell-list`)),threadShellsForProjectRefsAtom:e=>o(Ave(e)),threadShellAtom:e=>a(Y5(e))}}function c7(e){return Rr(e)?`cached`:`empty`}function Cye(e){let t=Su(e);return t instanceof Error&&t.message.trim().length>0?t.message:`Could not synchronize the thread.`}function l7(e){let t=e.session?.status;return t!==`starting`&&t!==`running`}var wye=Fp(`EnvironmentThreadState.make`)(function*(e){let t=yield*FK,n=yield*MG,r=yield*J5,i=yield*qf(xK),a=t.target.environmentId,o=yield*n.loadThread(a,e).pipe(Df(t=>Lp(`Could not load cached thread.`).pipe(Bp({environmentId:a,threadId:e,error:t.message}),wf(Pr())))),s=Yr(o,e=>e.thread),c=yield*Ij({data:s,status:c7(s),error:Pr()}),l=yield*Ij(zr(o,{onNone:()=>0,onSome:e=>e.snapshotSequence})),u=yield*GE(!1),d=yield*Dx(1),f=Fp(`EnvironmentThreadState.persist`)(function*(t){yield*n.saveThread(a,t).pipe(Df(t=>Lp(`Could not persist the thread cache.`).pipe(Bp({environmentId:a,threadId:e,error:t.message}))))});yield*rC(d).pipe(yC(`500 millis`),kC(f),bp);let p=Vj(c,e=>e.status===`deleted`?e:{...e,status:`synchronizing`,error:Pr()}),m=Vj(c,e=>e.status===`live`||e.status===`deleted`?e:{...e,status:`synchronizing`,error:Pr()}),h=df(function*(){yield*qE(u,!1),yield*Vj(c,e=>({...e,status:e.status===`deleted`?e.status:c7(e.data)}))}),g=e=>qE(u,!1).pipe(yf(Vj(c,t=>({...t,status:t.status===`deleted`?t.status:c7(t.data),error:Fr(Cye(e))})))),_=Fp(`EnvironmentThreadState.setThread`)(function*(e){let t=yield*KE(u);if(yield*Bj(c,{data:Fr(e),status:t?`synchronizing`:`live`,error:Pr()}),l7(e)){let t=yield*Rj(l);yield*Ox(d,{snapshotSequence:t,thread:e})}}),v=Fp(`EnvironmentThreadState.setDeleted`)(function*(){yield*qE(u,!1),yield*Bj(c,{data:Pr(),status:`deleted`,error:Pr()}),yield*n.removeThread(a,e).pipe(Df(t=>Lp(`Could not remove the cached thread.`).pipe(Bp({environmentId:a,threadId:e,error:t.message}))))}),y=Fp(`EnvironmentThreadState.applyItem`)(function*(e){if(e.kind===`synchronized`){yield*qE(u,!1),yield*Vj(c,e=>Rr(e.data)&&e.status!==`deleted`?{...e,status:`live`,error:Pr()}:e);return}if(e.kind===`snapshot`){yield*Bj(l,e.snapshot.snapshotSequence),yield*_(e.snapshot.thread);return}let t=yield*Rj(l);if(e.event.sequence<=t)return;yield*Bj(l,e.event.sequence);let n=yield*Rj(c);if(Lr(n.data)){e.event.type===`thread.deleted`&&(yield*v());return}let r=Ive(n.data.value,e.event);r.kind===`updated`?yield*_(r.thread):r.kind===`deleted`&&(yield*v())});yield*Lj(t.state).pipe(kC(e=>{switch(uG(e)){case`synchronizing`:return p;case`disconnected`:return h;case`ready`:return m}}),bp);let b=zr(i,{onNone:()=>iC,onSome:e=>e.changes.pipe(fC(e=>e===`application-active`))});return yield*p,yield*bp(JK(qO.subscribeThread,Fp(`EnvironmentThreadState.makeSubscribeInput`)(function*(n){let i=yield*n.initialConfig.pipe(Cf(e=>e.threadResumeCompletionMarker===!0),If(()=>!1));yield*qE(u,i),yield*p;let a=yield*Rj(c);if(Lr(a.data)&&a.status!==`deleted`){let n=yield*Rj(t.prepared).pipe(_f(zr({onSome:M,onNone:()=>Lj(t.prepared).pipe(fC(Rr),oC(e=>e.value),OC,Cf(Jr))}))),i=yield*r.load(n,e);Rr(i)&&(yield*y({kind:`snapshot`,snapshot:i.value}),a=yield*Rj(c))}let o=yield*Rj(l),s=Rr(a.data);return!i&&s&&(yield*Vj(c,e=>({...e,status:e.status===`deleted`?e.status:`live`,error:Pr()}))),{threadId:e,...s?{afterSequence:o}:{},...i?{requestCompletionMarker:!0}:{}}}),{onExpectedFailure:g,retryExpectedFailureAfter:`250 millis`,resubscribe:b}).pipe(kC(y))),yield*$f(()=>Qd([Rj(c),Rj(l)]).pipe(_f(([e,t])=>zr(e.data,{onNone:()=>cf,onSome:e=>l7(e)?f({snapshotSequence:t,thread:e}):cf})))),c});function Tye(e,t){return fq(e,aC(wye(t).pipe(Cf(Lj))))}function Eye(e){let t=UH(t=>{let{environmentId:n,threadId:r}=X5(t);return e.atom(Tye(n,r),{initialValue:n7}).pipe(hH(t7),GH(`environment-thread-state:${t}`))});return{stateAtom:(e,n)=>t(Y5({environmentId:e,threadId:n}))}}var Dye=Jl(wj,Roe({randomBytes:e=>globalThis.crypto.getRandomValues(new Uint8Array(e)),digest:(e,t)=>tf(async()=>{let n=new Uint8Array(t.length);return n.set(t),new Uint8Array(await globalThis.crypto.subtle.digest(e,n.buffer))})})),u7=H([`configured`,`window-origin`,`desktop-managed`]),Oye=H([`http-base-url`,`websocket-base-url`,`development-server-url`,`window-location-url`]),d7=class extends G()(`PrimaryEnvironmentUrlInvalidError`,{source:u7,urlKind:Oye,cause:Cb()}){get message(){return`Could not parse ${this.urlKind} for the ${this.source} primary environment target.`}},f7=class extends G()(`PrimaryEnvironmentProtocolUnsupportedError`,{source:u7,protocol:L}){get message(){return`The ${this.source} primary environment target uses unsupported protocol ${this.protocol}.`}},p7=class extends G()(`DesktopEnvironmentBootstrapIncompleteError`,{hasHttpBaseUrl:R,hasWsBaseUrl:R}){get message(){return`Desktop bootstrap is missing ${[...this.hasHttpBaseUrl?[]:[`httpBaseUrl`],...this.hasWsBaseUrl?[]:[`wsBaseUrl`]].join(` and `)} for the local environment.`}};gy(d7),gy(f7),gy(p7);var kye=new Set([`127.0.0.1`,`::1`,`localhost`]);function Aye(){return(window.desktopBridge?.getLocalEnvironmentBootstraps()??[]).find(e=>e.id===`primary`)??null}function m7(e){try{return e.baseUrl===void 0?new URL(e.rawValue):new URL(e.rawValue,e.baseUrl)}catch(t){throw new d7({source:e.source,urlKind:e.urlKind,cause:t})}}function h7(e,t,n){return m7({rawValue:e,baseUrl:window.location.origin,source:t,urlKind:n}).toString()}function jye(e){return e.trim().toLowerCase().replace(/^\[(.*)\]$/,`$1`)}function Mye(e){return kye.has(jye(e))}function Nye(e){return e.target.httpBaseUrl}function Pye(){return null}function Fye(){let e=m7({rawValue:window.location.origin,source:`window-origin`,urlKind:`http-base-url`}),t=e.toString();if(e.protocol===`http:`)e.protocol=`ws:`;else if(e.protocol===`https:`)e.protocol=`wss:`;else throw new f7({source:`window-origin`,protocol:e.protocol});return{source:`window-origin`,target:{httpBaseUrl:t,wsBaseUrl:e.toString()}}}function Iye(){let e=Aye();if(!e||!e.httpBaseUrl&&!e.wsBaseUrl)return null;if(!e.httpBaseUrl||!e.wsBaseUrl)throw new p7({hasHttpBaseUrl:!!e.httpBaseUrl,hasWsBaseUrl:!!e.wsBaseUrl});return{source:`desktop-managed`,target:{httpBaseUrl:h7(e.httpBaseUrl,`desktop-managed`,`http-base-url`),wsBaseUrl:h7(e.wsBaseUrl,`desktop-managed`,`websocket-base-url`)}}}function g7(e,t){let n=_7(),r=m7({rawValue:Nye(n),source:n.source,urlKind:`http-base-url`});return r.pathname=e,t&&(r.search=new URLSearchParams(t).toString()),r.toString()}function _7(){return Iye()??Pye()??Fye()}var v7=class extends ti()(`@p4code/web/environments/primary/httpClient/PrimaryEnvironmentHttpClient`){},Lye=Ql(v7,of(()=>fV(g7(`/`)))),y7=`p4code:primary-bearer:v1`,Rye=3e4;function b7(){return typeof window<`u`}function x7(e){try{return`${y7}:${new URL(e).origin}`}catch{return`${y7}:${e}`}}function zye(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t,r=n.token;if(typeof r!=`string`||r.trim().length===0)return null;let i=n.expiresAtMs;return{token:r,expiresAtMs:typeof i==`number`&&Number.isFinite(i)?i:null}}catch{return null}}function Bye(e){if(!b7())return null;let t=null;try{t=window.localStorage.getItem(x7(e))}catch{return null}if(t===null)return null;let n=zye(t);return n===null||n.expiresAtMs!==null&&n.expiresAtMs-Rye<=Date.now()?(S7(e),null):n.token}function Vye(e){if(!b7())return;let t=typeof e.expiresInSeconds==`number`&&Number.isFinite(e.expiresInSeconds)?Date.now()+e.expiresInSeconds*1e3:null,n={token:e.token,expiresAtMs:t};try{window.localStorage.setItem(x7(e.httpBaseUrl),JSON.stringify(n))}catch{}}function S7(e){if(b7())try{window.localStorage.removeItem(x7(e))}catch{}}var C7=null;function Hye(){if(typeof window>`u`)return Promise.resolve(null);let e=window.desktopBridge;return e?(C7??=e.getLocalEnvironmentBearerToken().catch(e=>{throw C7=null,e}),C7):Promise.resolve(null)}function w7(){return typeof window>`u`||window.desktopBridge!==void 0||window.nativeApi!==void 0||!window.location.origin.startsWith(`http`)?!1:new URL(g7(`/`)).origin===window.location.origin}function Uye(){return typeof window>`u`||window.desktopBridge!==void 0?!1:!w7()}async function T7(){return await Hye()||Bye(g7(`/`))}function Wye(e){return e.pipe(aD(e=>tf(T7).pipe(Cf(t=>t?poe(e,t):e))))}function Gye(){return nu(sf(()=>{let e=uV(globalThis.fetch);return w7()?au(e,Jl(wB,{credentials:`include`})):au(Ql(QE,Cf(QE,Wye)).pipe(su(e)),Jl(wB,{credentials:`omit`}))}))}var E7=Gye(),D7=uV((e,t)=>globalThis.fetch(e,t));Dj(D7);var Kye=Dj(Lye.pipe(su(E7))),qye=e=>Kye.runPromise(e),Jye=e=>qye(e),O7=eu(Dj(iu(D7,Dye,NE)).contextEffect),Yye=z({connectionId:L,credential:_G}),Xye=z({schemaVersion:I(1),targets:B(aG),profiles:B(hG),credentials:B(Yye)}),k7=Object.freeze({schemaVersion:1,targets:[],profiles:[],credentials:[]});function A7(e,t,n){let r=t(n);return[...e.filter(e=>t(e)!==r),n]}function j7(e,t,n){return e.filter(e=>t(e)!==n)}function Zye(e){switch(e._tag){case`PrimaryConnectionTarget`:return null;case`BearerConnectionTarget`:case`SshConnectionTarget`:return e.connectionId}}function M7(e,t){let n=Zye(t);return{...e,targets:j7(e.targets,e=>e.environmentId,t.environmentId),profiles:n===null?e.profiles:j7(e.profiles,e=>e.connectionId,n),credentials:n===null?e.credentials:j7(e.credentials,e=>e.connectionId,n)}}function Qye(e,t){let n=t.target,r=e.targets.find(e=>e.environmentId===n.environmentId),i=r===void 0?e:M7(e,r),a={...i,targets:A7(i.targets,e=>e.environmentId,n)};switch(t._tag){case`BearerConnectionRegistration`:return{...a,profiles:A7(a.profiles,e=>e.connectionId,t.profile),credentials:A7(a.credentials,e=>e.connectionId,{connectionId:t.target.connectionId,credential:t.credential})};case`SshConnectionRegistration`:return{...a,profiles:A7(a.profiles,e=>e.connectionId,t.profile)}}}function $ye(e,t){return M7(e,t)}function N7(){return``}function ebe(){return N7()||window.location.origin}function tbe(){return``}function nbe(){return null}function rbe(e){try{return new URL(e).origin}catch{return null}}function P7(e=new URL(window.location.href)){if(tbe())return!1;if(nbe())return!0;let t=rbe(N7());return t!==null&&e.origin===t}function F7(e=new URL(window.location.href)){let t=e.searchParams.get(`host`)?.trim()??``,n=H5(e)?.trim()??``,r=e.searchParams.get(`label`)?.trim()??``;return!t||!n?null:{host:t,token:n,label:r}}function ibe(e=new URL(window.location.href)){return F7(e)!==null}function abe(e){let t=new URL(`/pair`,ebe());t.searchParams.set(`host`,e.host);let n=e.label?.trim();return n&&t.searchParams.set(`label`,n),U5(t,e.token).toString()}var I7=KV();function obe({children:e}){return(0,A.createElement)(bq.Provider,{value:I7},e)}var L7=15e3,R7=new Map,sbe=new Set([X.previewAutomationConnect]),z7=TH([]).pipe(WH,GH(`slow-rpc-ack-requests`));function B7(e){I7.set(z7,[...e])}function V7(){return I7.get(z7)}function cbe(e){return!e.includes(`subscribe`)&&!sbe.has(e)}function lbe(e,t){if(!cbe(t))return;H7(e),fbe();let n=Date.now(),r={requestId:e,startedAt:new Date(n).toISOString(),startedAtMs:n,tag:t,thresholdMs:L7},i=setTimeout(()=>{R7.delete(e),dbe(r)},L7);R7.set(e,{request:r,timeoutId:i})}function ube(e){H7(e);let t=V7();t.some(t=>t.requestId===e)&&B7(t.filter(t=>t.requestId!==e))}function H7(e){let t=R7.get(e);t&&(clearTimeout(t.timeoutId),R7.delete(e))}function dbe(e){let t=[...V7(),e];if(t.length<=256){B7(t);return}B7(t.slice(-256))}function fbe(){for(;R7.size>=256;){let e=R7.keys().next().value;if(e===void 0)return;H7(e)}}function pbe(){return wq(z7)}var mbe=`local:`;function hbe(e){return`${mbe}${e}`}function gbe(e){return e._tag===`BearerConnectionTarget`&&e.connectionId.startsWith(`local:`)}function _be(e){let t=[],n=()=>{let n=e();if(n===void 0)return t=[],{_tag:`Success`,bootstraps:t};try{return t=n.getLocalEnvironmentBootstraps().filter(e=>e.id!==TM),{_tag:`Success`,bootstraps:t}}catch(e){return{_tag:`Failure`,cause:e}}};return{readResult:n,readSnapshot:()=>{let e=n();return e._tag===`Success`?e.bootstraps:t}}}var U7=_be(()=>window.desktopBridge);function vbe(){return U7.readResult()}function ybe(){return U7.readSnapshot()}var bbe=`p4code:connection-runtime`,xbe=4,W7=`catalog`,G7=`shell`,K7=`thread`,q7=`server-config`,J7=`vcs-refs`,Y7=`document`,X7=1,Z7=Db(z({schemaVersion:I(X7),environmentId:Xb,snapshot:Nk})),Q7=Db(z({schemaVersion:I(2),environmentId:Xb,threadId:Y,snapshot:Rk})),$7=Db(z({schemaVersion:I(1),environmentId:Xb,config:GN})),e9=Db(z({schemaVersion:I(1),environmentId:Xb,cwd:L,refs:TF})),t9=Db(Xye),Sbe=_y(t9),Cbe=wy(t9),wbe=_y(Z7),Tbe=wy(Z7),Ebe=_y(Q7),Dbe=wy(Q7),Obe=_y($7),kbe=wy($7),Abe=_y(e9),jbe=wy(e9);function n9(e,t){return new cG({reason:`remote-unavailable`,detail:`Could not ${e} the local connection catalog: ${String(t)}`})}function r9(e,t){return new kG({operation:e,message:`Could not ${e.replaceAll(`-`,` `)}: ${String(t)}`})}var Mbe=Fp(`web.connectionStorage.openDatabase`)(function*(){return yield*lf(e=>{if(typeof indexedDB>`u`){e(ff(n9(`open`,`IndexedDB is unavailable in this browser context.`)));return}let t=indexedDB.open(bbe,xbe);t.addEventListener(`upgradeneeded`,()=>{t.result.objectStoreNames.contains(W7)||t.result.createObjectStore(W7),t.result.objectStoreNames.contains(G7)||t.result.createObjectStore(G7),t.result.objectStoreNames.contains(K7)||t.result.createObjectStore(K7),t.result.objectStoreNames.contains(q7)||t.result.createObjectStore(q7),t.result.objectStoreNames.contains(J7)||t.result.createObjectStore(J7)}),t.addEventListener(`error`,()=>{e(ff(n9(`open`,t.error??`Unknown IndexedDB error`)))}),t.addEventListener(`success`,()=>{e(M(t.result))})})});function i9(e,t,n){return lf(r=>{let i=e.transaction(t,`readonly`).objectStore(t).get(n);i.addEventListener(`error`,()=>{r(ff(n9(`read`,i.error??`Unknown IndexedDB read error`)))}),i.addEventListener(`success`,()=>{r(M(i.result))})}).pipe(gp(`web.connectionStorage.readDatabaseValue`))}function a9(e,t,n,r){return lf(i=>{let a=e.transaction(t,`readwrite`);a.addEventListener(`error`,()=>{i(ff(n9(`write`,a.error??`Unknown IndexedDB write error`)))}),a.addEventListener(`complete`,()=>{i(cf)}),a.objectStore(t).put(r,n)}).pipe(gp(`web.connectionStorage.writeDatabaseValue`))}function o9(e,t,n){return lf(r=>{let i=e.transaction(t,`readwrite`);i.addEventListener(`error`,()=>{r(ff(n9(`remove`,i.error??`Unknown IndexedDB remove error`)))}),i.addEventListener(`complete`,()=>{r(cf)}),i.objectStore(t).delete(n)}).pipe(gp(`web.connectionStorage.removeDatabaseValue`))}function s9(e,t,n){return lf(r=>{let i=e.transaction(t,`readwrite`);i.addEventListener(`error`,()=>{r(ff(n9(`remove`,i.error??`Unknown IndexedDB cursor error`)))}),i.addEventListener(`complete`,()=>{r(cf)});let a=i.objectStore(t).openCursor(n);a.addEventListener(`error`,()=>{r(ff(n9(`remove`,a.error??`Unknown IndexedDB cursor error`)))}),a.addEventListener(`success`,()=>{let e=a.result;e!==null&&(e.delete(),e.continue())})}).pipe(gp(`web.connectionStorage.removeDatabaseValuesInRange`))}function c9(e,t){return`${e}:${t}`}function l9(e,t){return`${e}:${t}`}var Nbe=Fp(`web.connectionStorage.decodeCatalog`)(function*(e){return yield*Sbe(e).pipe(jf(e=>n9(`decode`,e)))}),u9=Fp(`web.connectionStorage.encodeCatalog`)(function*(e){return yield*Cbe(e).pipe(jf(e=>n9(`encode`,e)))});function Pbe(e){let t=window.desktopBridge;return t?.getConnectionCatalog!==void 0&&t.setConnectionCatalog!==void 0?{read:nf({try:()=>t.getConnectionCatalog(),catch:e=>n9(`load`,e)}),write:e=>nf({try:()=>t.setConnectionCatalog(e),catch:e=>n9(`save`,e)}).pipe(_f(e=>e?cf:ff(n9(`save`,`Desktop secure storage is unavailable in this system context.`))))}:{read:i9(e,W7,Y7).pipe(Cf(e=>typeof e==`string`?e:null)),write:t=>a9(e,W7,Y7,t),quarantine:t=>a9(e,W7,`${Y7}:corrupt:${Date.now()}`,t)}}var Fbe=Fp(`web.connectionStorage.makeCatalogStore`)(function*(e){let t=yield*GE(Pr()),n=yield*Kx(1),r=Fp(`web.connectionStorage.loadCatalog`)(function*(){let n=yield*KE(t);if(Rr(n))return n.value;let r=yield*e.read,i=k7;return r!==null&&r.trim()!==``&&(i=yield*Nbe(r).pipe(Df(t=>df(function*(){yield*Lp(`Discarding a corrupt web connection catalog.`,{error:t.message}),e.quarantine!==void 0&&(yield*e.quarantine(r).pipe(Df(e=>Lp(`Could not quarantine the corrupt web connection catalog.`,{error:e.message}))));let n=yield*u9(k7);return yield*e.write(n).pipe(Df(e=>Lp(`Could not persist the recovered web connection catalog.`,{error:e.message}))),k7})))),yield*qE(t,Fr(i)),i});return{read:n.withPermits(1)(r()),update:Fp(`web.connectionStorage.updateCatalog`)(function*(i){yield*n.withPermits(1)(df(function*(){let n=i(yield*r());yield*e.write(yield*u9(n)),yield*qE(t,Fr(n))}))})}}),Ibe=eu(df(function*(){let e=yield*Qf(Mbe(),e=>sf(()=>e.close())),t=yield*Fbe(Pbe(e)),n=AG.of({list:t.read.pipe(Cf(e=>e.targets),jf(e=>r9(`list-targets`,e)))}),r=jG.of({register:e=>t.update(t=>Qye(t,e)).pipe(jf(e=>r9(`register-connection`,e))),remove:e=>t.update(t=>$ye(t,e)).pipe(jf(e=>r9(`remove-connection`,e)))}),i=TG({get:e=>t.read.pipe(Cf(t=>Ur(t.profiles.find(t=>t.connectionId===e)))),put:e=>t.update(t=>({...t,profiles:A7(t.profiles,e=>e.connectionId,e)})),remove:e=>t.update(t=>({...t,profiles:j7(t.profiles,e=>e.connectionId,e)}))}),a=CG({get:e=>t.read.pipe(Cf(t=>Ur(t.credentials.find(t=>t.connectionId===e)?.credential))),put:(e,n)=>t.update(t=>({...t,credentials:A7(t.credentials,e=>e.connectionId,{connectionId:e,credential:n})})),remove:e=>t.update(t=>({...t,credentials:j7(t.credentials,e=>e.connectionId,e)}))}),o=MG.of({loadShell:t=>i9(e,G7,t).pipe(_f(e=>typeof e==`string`?wbe(e).pipe(jf(e=>r9(`load-shell`,e)),Cf(e=>e.environmentId===t?Fr(e.snapshot):Pr())):M(Pr())),jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`load-shell`,e))),saveShell:(t,n)=>df(function*(){let r=yield*Tbe({schemaVersion:X7,environmentId:t,snapshot:n}).pipe(jf(e=>r9(`save-shell`,e)));yield*a9(e,G7,t,r)}).pipe(jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`save-shell`,e))),loadServerConfig:t=>i9(e,q7,t).pipe(_f(e=>typeof e==`string`?Obe(e).pipe(jf(e=>r9(`load-server-config`,e)),Cf(e=>e.environmentId===t?Fr(e.config):Pr())):M(Pr())),jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`load-server-config`,e))),saveServerConfig:(t,n)=>df(function*(){let r=yield*kbe({schemaVersion:1,environmentId:t,config:n}).pipe(jf(e=>r9(`save-server-config`,e)));yield*a9(e,q7,t,r)}).pipe(jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`save-server-config`,e))),loadThread:(t,n)=>i9(e,K7,c9(t,n)).pipe(_f(e=>typeof e==`string`?Ebe(e).pipe(jf(e=>r9(`load-thread`,e)),Cf(e=>e.environmentId===t&&e.threadId===n?Fr(e.snapshot):Pr())):M(Pr())),jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`load-thread`,e))),saveThread:(t,n)=>df(function*(){let r=yield*Dbe({schemaVersion:2,environmentId:t,threadId:n.thread.id,snapshot:n}).pipe(jf(e=>r9(`save-thread`,e)));yield*a9(e,K7,c9(t,n.thread.id),r)}).pipe(jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`save-thread`,e))),loadVcsRefs:(t,n)=>i9(e,J7,l9(t,n)).pipe(_f(e=>typeof e==`string`?Abe(e).pipe(jf(e=>r9(`load-vcs-refs`,e)),Cf(e=>e.environmentId===t&&e.cwd===n?Fr(e.refs):Pr())):M(Pr())),jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`load-vcs-refs`,e))),saveVcsRefs:(t,n,r)=>df(function*(){let i=yield*jbe({schemaVersion:1,environmentId:t,cwd:n,refs:r}).pipe(jf(e=>r9(`save-vcs-refs`,e)));yield*a9(e,J7,l9(t,n),i)}).pipe(jf(e=>e._tag===`ConnectionPersistenceError`?e:r9(`save-vcs-refs`,e))),removeVcsRefs:(t,n)=>o9(e,J7,l9(t,n)).pipe(jf(e=>r9(`remove-vcs-refs`,e))),clearVcsRefs:t=>s9(e,J7,IDBKeyRange.bound(`${t}:`,`${t}:\uffff`)).pipe(jf(e=>r9(`clear-vcs-refs`,e))),removeThread:(t,n)=>o9(e,K7,c9(t,n)).pipe(jf(e=>r9(`remove-thread`,e))),clear:t=>Qd([o9(e,G7,t),s9(e,K7,IDBKeyRange.bound(`${t}:`,`${t}:\uffff`)),o9(e,q7,t),s9(e,J7,IDBKeyRange.bound(`${t}:`,`${t}:\uffff`))],{concurrency:`unbounded`,discard:!0}).pipe(jf(e=>r9(`clear-environment`,e)))});return ci(AG,n).pipe(li(jG,r),li(wG,i),li(SG,a),li(MG,o))})),d9=0;function Lbe(){return typeof navigator>`u`?`unknown`:navigator.onLine?`online`:`offline`}var Rbe=OG({status:sf(Lbe),changes:eC(e=>Qf(sf(()=>{let t=()=>kx(e,`online`),n=()=>kx(e,`offline`);return window.addEventListener(`online`,t),window.addEventListener(`offline`,n),{online:t,offline:n}}),({online:e,offline:t})=>sf(()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,t)})).pipe(Ef))}),zbe=CK({changes:eC(e=>Qf(sf(()=>{let t=()=>{document.visibilityState===`visible`&&kx(e,`application-active`)};return document.addEventListener(`visibilitychange`,t),t}),e=>sf(()=>{document.removeEventListener(`visibilitychange`,e)})).pipe(Ef))});function f9(){let e=window.desktopBridge!==void 0,t=navigator.platform.trim();return{label:e?`P4Code Desktop`:`P4Code Web`,deviceType:`desktop`,...t===``?{}:{os:t}}}function p9(e){let t=e instanceof Error?e.message:String(e);return t.toLowerCase().includes(`cancel`)?new lG({reason:`authentication`,detail:t}):new cG({reason:`remote-unavailable`,detail:`Could not prepare the SSH environment: ${t}`})}var Bbe=Fp(`web.connectionPlatform.ssh.provisionDesktop`)(function*(e,t){let n=yield*nf({try:()=>e.ensureSshEnvironment(t,{issuePairingToken:!0}),catch:p9}),r=n.pairingToken;if(r===null)return yield*new lG({reason:`authentication`,detail:`The SSH environment did not issue a pairing credential.`});let i=yield*nf({try:()=>e.fetchSshEnvironmentDescriptor(n.httpBaseUrl),catch:p9}),a=yield*nf({try:()=>e.bootstrapSshBearerSession(n.httpBaseUrl,r),catch:p9});return{environmentId:i.environmentId,label:i.label,bootstrap:n,bearerToken:a.access_token}}),Vbe=eu(sf(()=>{let e=QW.of({metadata:f9(),scopes:mw}),t=$W.of({bearerToken:nf({try:T7,catch:e=>new cG({reason:`remote-unavailable`,detail:`Could not load the primary environment credential: ${String(e)}`})}).pipe(Cf(Hr))}),n=eG.of({provision:Fp(`web.connectionPlatform.ssh.provision`)(function*(e){let t=window.desktopBridge;return t===void 0?yield*new lG({reason:`unsupported`,detail:`SSH environments are only available in the desktop app.`}):yield*Bbe(t,e)}),prepare:Fp(`web.connectionPlatform.ssh.prepare`)(function*(e){let t=window.desktopBridge;if(t===void 0)return yield*new lG({reason:`unsupported`,detail:`SSH environments are only available in the desktop app.`});let n=yield*nf({try:()=>t.ensureSshEnvironment(e.target,{issuePairingToken:!0}),catch:p9});return n.pairingToken===null?yield*new lG({reason:`authentication`,detail:`The SSH environment did not issue a pairing credential.`}):{bootstrap:n,bearerToken:(yield*nf({try:()=>t.bootstrapSshBearerSession(n.httpBaseUrl,n.pairingToken),catch:p9})).access_token}}),disconnect:Fp(`web.connectionPlatform.ssh.disconnect`)(function*(e){let t=window.desktopBridge;t!==void 0&&(yield*nf({try:()=>t.disconnectSshEnvironment(e),catch:e=>new cG({reason:`remote-unavailable`,detail:`Could not disconnect the SSH environment: ${String(e)}`})}))})});return ci($W,t).pipe(li(QW,e),li(eG,n))})),Hbe=Fp(`web.connectionPlatform.loadPrimaryConnectionRegistration`)(function*(e){let t=yield*gV({httpBaseUrl:e.target.httpBaseUrl}).pipe(Gf(E7),jf(GG));return new vG({target:new nG({environmentId:t.environmentId,label:t.label,httpBaseUrl:e.target.httpBaseUrl,wsBaseUrl:e.target.wsBaseUrl})})}),Ube=Fp(`web.connectionPlatform.loadSecondaryConnectionRegistration`)(function*(e){if(e.httpBaseUrl===null||e.wsBaseUrl===null||e.bootstrapToken===void 0)return yield*new cG({reason:`endpoint-unavailable`,detail:`Desktop-local backend ${e.id} is not ready yet.`});let t=e.httpBaseUrl,n=e.wsBaseUrl,r=yield*gV({httpBaseUrl:t}).pipe(jf(GG)),i=yield*Mu,a=yield*zG({httpBaseUrl:t,credential:e.bootstrapToken,scopes:mw,clientMetadata:f9()}).pipe(jf(GG)),o=hbe(e.id),s=e.label||r.label;return{registration:new yG({target:new rG({environmentId:r.environmentId,label:s,connectionId:o}),profile:new pG({connectionId:o,environmentId:r.environmentId,label:s,httpBaseUrl:t,wsBaseUrl:n}),credential:new gG({token:a.access_token})}),expiresAtEpochMs:m9(i,a.expires_in),refreshAtEpochMs:Kbe(i,a.expires_in)}}),Wbe=`3 seconds`,Gbe=5e3;function m9(e,t){return e+Math.max(0,t*1e3)}function Kbe(e,t){return Math.max(e,m9(e,t)-Gbe)}function qbe(e=_7){try{return{_tag:`Success`,target:e()}}catch(e){return{_tag:`Failure`,cause:e}}}function Jbe(e,t){return t._tag===`Failure`?e.get(TM):void 0}function h9(e,t,n){return e.signature===t&&(e.refreshAtEpochMs===void 0||n<e.refreshAtEpochMs)}function Ybe(e,t,n){return e.signature===t&&e.expiresAtEpochMs!==void 0&&n<e.expiresAtEpochMs}function Xbe(e,t,n){return t._tag===`Success`?new Map:new Map([...e].filter(([,e])=>e.expiresAtEpochMs!==void 0&&n<e.expiresAtEpochMs))}var Zbe=iu(Ibe,Rbe,zbe,Vbe,Ql(G5,df(function*(){if(P7())return G5.of({registrations:tC});let e=yield*GE(new Map),t=df(function*(){let t=yield*KE(e),n=yield*Mu,r=new Map,i=[],a=qbe(),o=Jbe(t,a);if(o!==void 0&&(r.set(TM,o),i.push(o.registration)),a._tag===`Failure`)yield*Lp(`Could not read the primary environment topology.`,{cause:a.cause});else if(a.target!==null){let e=a.target,o=`primary|${e.target.httpBaseUrl}|${e.target.wsBaseUrl}`,s=t.get(TM);if(s!==void 0&&h9(s,o,n))r.set(TM,s),i.push(s.registration);else{let t=yield*Hbe(e).pipe(Nf(e=>Lp(`Could not discover the primary environment.`,{error:e})),xf);if(Rr(t)){let e={signature:o,registration:t.value};r.set(TM,e),i.push(t.value)}}}let s=vbe();for(let[e,a]of Xbe(t,s,n))r.set(e,a),i.push(a.registration);if(s._tag===`Failure`)yield*Lp(`Could not read the desktop-local backend topology.`,{cause:s.cause});else for(let e of s.bootstraps){let a=`${e.httpBaseUrl}|${e.wsBaseUrl}|${e.bootstrapToken??``}`,o=t.get(e.id);if(o!==void 0&&h9(o,a,n)){r.set(e.id,o),i.push(o.registration);continue}let s=yield*Ube(e).pipe(Nf(t=>Lp(`Could not connect a desktop-local backend.`,{id:e.id,error:t})),xf);if(Rr(s)){let t={signature:a,...s.value};r.set(e.id,t),i.push(s.value.registration)}else o!==void 0&&Ybe(o,a,n)&&(r.set(e.id,o),i.push(o.registration))}return yield*qE(e,r),i}).pipe(Gf(TB));return G5.of({registrations:vae(Wbe).pipe(sC(()=>t))})})),Jl(NG,NG.of({clear:e=>sf(()=>{o_e(e)})})),Jl(UK,UK.of({observe:({environmentId:e,method:t})=>sf(()=>{d9+=1;let n=`${e}:${d9}`;return lbe(n,`${t} · ${e}`),sf(()=>{ube(n)})})}))).pipe(su(O7)),g9=NH(au(_ve,au(wve,O_e)).pipe(cu(iu(O7,Zbe)))),_9=Z_e(g9),v9=TH(e=>{for(let[t,n]of e(_9.catalogValueAtom).entries)if(n.target._tag===`PrimaryConnectionTarget`)return t;return null}).pipe(GH(`web-primary-environment-id`));function Qbe(e){return e.pipe(Cf(Fr),Df(e=>Lp(`Could not load the initial environment configuration.`).pipe(Bp({...bK(e)}),wf(Pr()))))}function $be(e){let t=UH(t=>e.atom(fq(t,aC(FK.pipe(Cf(e=>Lj(e.session).pipe(sC(zr({onNone:()=>M(Pr()),onSome:e=>Qbe(e.initialConfig)}))))))),{initialValue:Pr()})),n=UH(e=>TH(n=>Wr(Br(BV(n(t(e))),()=>Pr()))).pipe(GH(`environment-config-value:${e}`))),r=UH(t=>e.atom(fq(t,aC(FK.pipe(Cf(e=>Lj(e.prepared))))),{initialValue:Pr()}));return{initialConfigAtom:t,initialConfigValueAtom:n,preparedConnectionAtom:r,preparedConnectionValueAtom:UH(e=>TH(t=>Br(BV(t(r(e))),()=>Pr())).pipe(GH(`environment-prepared-connection:${e}`)))}}var y9=$be(g9),exe=TH(Pr()).pipe(GH(`web-prepared-connection:empty`));function b9(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=e===null?exe:y9.preparedConnectionValueAtom(e),t[0]=e,t[1]=n),wq(n)}function txe(e){return Wr(I7.get(y9.preparedConnectionValueAtom(e)))}var x9=T_e(g9,{initialConfigValueAtom:y9.initialConfigValueAtom}),nxe=U_e({catalogValueAtom:_9.catalogValueAtom,serverConfigValueAtom:x9.configValueAtom}),rxe=[],ixe=[],axe={config:null,latestEvent:null,welcome:null},S9=TH(e=>{let t=e(v9);if(t===null)return axe;let n={environmentId:t,input:{}},r=Wr(BV(e(x9.configProjection(n)))),i=Wr(BV(e(x9.welcome(n))));return{config:e(x9.configValueAtom(t)),latestEvent:r?.latestEvent??null,welcome:i}}).pipe(GH(`web-primary-server-state`)),C9=TH(e=>e(S9).config).pipe(GH(`web-primary-server-config`)),oxe=TH(e=>e(S9).latestEvent).pipe(GH(`web-primary-server-config-event`)),sxe=TH(e=>e(S9).welcome).pipe(GH(`web-primary-server-welcome`)),cxe=TH(e=>e(C9)?.settings??RN).pipe(GH(`web-primary-server-settings`)),lxe=TH(e=>e(C9)?.providers??ixe).pipe(GH(`web-primary-server-providers`)),uxe=TH(e=>e(C9)?.keybindings??k5).pipe(GH(`web-primary-server-keybindings`)),dxe=TH(e=>e(C9)?.availableEditors??rxe).pipe(GH(`web-primary-server-available-editors`)),fxe=TH(e=>e(C9)?.keybindingsConfigPath??null).pipe(GH(`web-primary-server-keybindings-config-path`)),pxe=TH(e=>e(C9)?.observability??null).pipe(GH(`web-primary-server-observability`)),w9=`http://www.w3.org/2000/svg`,mxe={pencil:[{tag:`path`,attrs:{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`}},{tag:`path`,attrs:{d:`m15 5 4 4`}}],copy:[{tag:`rect`,attrs:{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}},{tag:`path`,attrs:{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}}],"folder-tree":[{tag:`path`,attrs:{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`}},{tag:`path`,attrs:{d:`M3 5a2 2 0 0 0 2 2h3`}},{tag:`path`,attrs:{d:`M3 3v13a2 2 0 0 0 2 2h3`}}],trash:[{tag:`path`,attrs:{d:`M3 6h18`}},{tag:`path`,attrs:{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}},{tag:`path`,attrs:{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}},{tag:`line`,attrs:{x1:`10`,x2:`10`,y1:`11`,y2:`17`}},{tag:`line`,attrs:{x1:`14`,x2:`14`,y1:`11`,y2:`17`}}]};function hxe(e,t){let n=mxe[e];if(!n)return null;let r=document.createElementNS(w9,`svg`);r.setAttribute(`xmlns`,w9),r.setAttribute(`viewBox`,`0 0 24 24`),r.setAttribute(`fill`,`none`),r.setAttribute(`stroke`,`currentColor`),r.setAttribute(`stroke-width`,`2`),r.setAttribute(`stroke-linecap`,`round`),r.setAttribute(`stroke-linejoin`,`round`),r.setAttribute(`class`,t===`destructive`?`size-3.5 shrink-0`:`size-3.5 shrink-0 text-muted-foreground`);for(let e of n){let t=document.createElementNS(w9,e.tag);for(let[n,r]of Object.entries(e.attrs))t.setAttribute(n,r);r.appendChild(t)}return r}function T9(e,t,n){let r=e.getBoundingClientRect(),i=Math.min(Math.max(4,t),Math.max(4,window.innerWidth-r.width-4)),a=Math.min(Math.max(4,n),Math.max(4,window.innerHeight-r.height-4));e.style.left=`${i}px`,e.style.top=`${a}px`}function E9(e,t){if(typeof Node<`u`&&e instanceof Node)return t.some(t=>t.contains(e));if(!e||typeof e!=`object`)return!1;let n=e;for(;n&&typeof n==`object`;){if(t.includes(n))return!0;n=n.parent}return!1}function gxe(e,t){return new Promise(n=>{let r=[],i=!1,a=!1,o=e=>{if(!i){i=!0,document.removeEventListener(`keydown`,s),document.removeEventListener(`pointerdown`,c,!0),document.removeEventListener(`contextmenu`,l,!0);for(let e of r)e.remove();n(e)}},s=e=>{e.key===`Escape`&&(e.preventDefault(),o(null))},c=e=>{!a||E9(e.target,r)||o(null)},l=e=>{!a||E9(e.target,r)||(e.preventDefault(),o(null))},u=e=>{for(;r.length>e;)r.pop()?.remove()},d=(e,t,n,i)=>{u(i);let s=document.createElement(`div`);s.className=`dropdown-glass fixed z-[10000] min-w-32 max-w-sm overflow-hidden rounded-lg bg-clip-padding text-popover-foreground outline-none`,s.style.cssText=`position:fixed;z-index:10000;min-width:8rem;max-width:24rem;overflow:hidden;border-radius:var(--radius-lg);background-clip:padding-box;color:var(--popover-foreground);outline:none;pointer-events:auto;`,s.style.left=`${t}px`,s.style.top=`${n}px`,s.dataset.level=String(i);let c=document.createElement(`div`);c.className=`max-h-[min(24rem,70vh)] min-w-0 max-w-sm overflow-y-auto overflow-x-hidden p-1`,c.style.cssText=`max-height:min(24rem,70vh);min-width:0;max-width:24rem;overflow-x:hidden;overflow-y:auto;padding:0.25rem;`;for(let t of e){if(t.header===!0){let e=document.createElement(`div`);e.className=`px-2 py-1.5 font-medium text-muted-foreground text-xs`,e.textContent=t.label,c.appendChild(e);continue}let e=Array.isArray(t.children)&&t.children.length>0,n=!e&&(t.destructive===!0||t.id===`delete`),s=document.createElement(`button`);s.type=`button`;let l=t.disabled===!0;s.disabled=l;let f=`flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-left outline-none transition-colors sm:min-h-7 sm:text-sm min-h-8 text-base`;if(s.className=l?`${f} pointer-events-none cursor-not-allowed text-muted-foreground opacity-64`:n?`${f} text-destructive-foreground hover:bg-destructive/10 hover:text-destructive-foreground`:`${f} text-foreground hover:bg-accent hover:text-accent-foreground`,s.style.cssText=`display:flex;width:100%;min-height:1.75rem;align-items:center;gap:0.5rem;border:0;border-radius:var(--radius-sm);background:transparent;padding:0.25rem 0.5rem;color:var(--foreground);font-family:var(--font-sans,system-ui,sans-serif);font-size:0.875rem;line-height:1.25rem;text-align:left;cursor:default;`,n&&(s.style.color=`var(--destructive-foreground)`),l&&(s.style.color=`var(--muted-foreground)`,s.style.opacity=`0.64`,s.style.pointerEvents=`none`),typeof t.icon==`string`){let e=hxe(t.icon,n?`destructive`:`neutral`);e&&s.appendChild(e)}let p=document.createElement(`span`);if(p.className=`min-w-0 flex-1 truncate`,p.textContent=t.label,s.appendChild(p),e){let e=document.createElement(`span`);e.className=`ms-auto shrink-0 text-muted-foreground/80 text-sm leading-none`,e.textContent=`>`,s.appendChild(e)}l||(s.addEventListener(`mouseenter`,()=>{s.style.background=n?`color-mix(in srgb, var(--destructive) 10%, transparent)`:`var(--accent)`,s.style.color=n?`var(--destructive-foreground)`:`var(--accent-foreground)`}),s.addEventListener(`mouseleave`,()=>{s.style.background=`transparent`,s.style.color=n?`var(--destructive-foreground)`:`var(--foreground)`}),e?(s.addEventListener(`mouseenter`,()=>{let e=s.getBoundingClientRect(),n=e.right+4,a=e.top;d(t.children,n,a,i+1);let o=r[i+1];if(!o)return;let c=o.getBoundingClientRect();c.right>window.innerWidth&&T9(o,e.left-c.width-4,e.top)}),s.addEventListener(`click`,e=>{e.preventDefault()})):(s.addEventListener(`mouseenter`,()=>{u(i+1)}),s.addEventListener(`click`,()=>{a&&o(t.id)}))),c.appendChild(s)}s.appendChild(c),s.addEventListener(`mouseenter`,()=>{u(i+1)}),document.body.appendChild(s),r[i]=s,requestAnimationFrame(()=>{T9(s,t,n)})};document.addEventListener(`keydown`,s),document.addEventListener(`pointerdown`,c,!0),document.addEventListener(`contextmenu`,l,!0),d(e,t?.x??0,t?.y??0,0),requestAnimationFrame(()=>{a=!0})})}var D9=`p4code:client-settings:v1`;function O9(){return typeof window<`u`}function _xe(){if(!O9())return null;try{return Fq(D9,wN)}catch(e){return console.error(`Could not read persisted client settings.`,e),null}}function vxe(e){O9()&&Iq(D9,e,wN)}var yxe=`modulepreload`,bxe=function(e){return`/`+e},k9={},xxe=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../../../../vite/packages/vite/src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=bxe(t,n),t=s(t),t in k9)return;k9[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:yxe,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},A9;function j9(){return Error(`Local backend API is unavailable before a backend is paired.`)}function Sxe(){return{dialogs:{pickFolder:async e=>window.desktopBridge?window.desktopBridge.pickFolder(e):null,confirm:async e=>window.desktopBridge?window.desktopBridge.confirm(e):window.confirm(e)},shell:{openInEditor:()=>Promise.reject(j9()),openExternal:async e=>{if(window.desktopBridge){if(!await window.desktopBridge.openExternal(e))throw Error(`Unable to open link.`);return}window.open(e,`_blank`,`noopener,noreferrer`)}},contextMenu:{show:async(e,t)=>window.desktopBridge?window.desktopBridge.showContextMenu(e,t):gxe(e,t)},persistence:{getClientSettings:async()=>window.desktopBridge?window.desktopBridge.getClientSettings():_xe(),setClientSettings:async e=>{if(window.desktopBridge)return window.desktopBridge.setClientSettings(e);vxe(e)}},server:{getConfig:()=>Promise.reject(j9()),refreshProviders:()=>Promise.reject(j9()),updateProvider:()=>Promise.reject(j9()),upsertKeybinding:()=>Promise.reject(j9()),removeKeybinding:()=>Promise.reject(j9()),getSettings:()=>Promise.reject(j9()),updateSettings:()=>Promise.reject(j9()),discoverSourceControl:()=>Promise.reject(j9()),getTraceDiagnostics:()=>Promise.reject(j9()),getProcessDiagnostics:()=>Promise.reject(j9()),getProcessResourceHistory:()=>Promise.reject(j9()),signalProcess:()=>Promise.reject(j9())}}}function M9(){if(!(typeof window>`u`))return A9||(window.nativeApi?(A9=window.nativeApi,A9):(A9=Sxe(),A9))}function Cxe(){let e=M9();if(!e)throw Error(`Local API not found`);return e}function wxe(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function Txe(e){let t=UH(t=>TH(n=>{let r=n(e.catalogValueAtom).entries.get(t);return r===void 0?null:{entry:r,connection:bve(Br(BV(n(e.stateAtom(t))),()=>dG)),serverConfig:n(e.serverConfigValueAtom(t))}}).pipe(GH(`environment-presentation:${t}`))),n=new Map;return{presentationAtom:t,presentationsAtom:TH(r=>{let i=new Map;for(let n of r(e.catalogValueAtom).entries.keys()){let e=r(t(n));e!==null&&i.set(n,e)}return wxe(n,i)||(n=i),n}).pipe(GH(`environment-presentations`))}}var N9=Txe({catalogValueAtom:_9.catalogValueAtom,stateAtom:_9.stateAtom,serverConfigValueAtom:x9.configValueAtom}),Exe=TH(null).pipe(GH(`web-environment-presentation:empty`));function Dxe(e){let t=(0,Xp.c)(5),n=wq(_9.catalogValueAtom),r;t[0]===e?r=t[1]:(r=e===null?Exe:N9.presentationAtom(e),t[0]=e,t[1]=r);let i=wq(r),a;return t[2]!==n.isReady||t[3]!==i?(a={isReady:n.isReady,presentation:i},t[2]=n.isReady,t[3]=i,t[4]=a):a=t[4],a}var Oxe=TH(AV(!1)).pipe(GH(`web-environment-query:empty`));function kxe(e){let t=Su(e);return t instanceof Error&&t.message.trim().length>0?t.message:`The environment request failed.`}function Axe(e){let t=(0,Xp.c)(10),n=e??Oxe,r=wq(n),i=kq(n),a;t[0]===r?a=t[1]:(a=Wr(BV(r)),t[0]=r,t[1]=a);let o;t[2]!==r._tag||t[3]!==r.cause?(o=r._tag===`Failure`?kxe(r.cause):null,t[2]=r._tag,t[3]=r.cause,t[4]=o):o=t[4];let s=e!==null&&r.waiting,c;return t[5]!==i||t[6]!==a||t[7]!==o||t[8]!==s?(c={data:a,error:o,isPending:s,refresh:i},t[5]=i,t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function P9(e,t){return{...t,environmentId:e,label:t.entry.target.label,displayUrl:xve(t.entry)}}function jxe(){let e=(0,Xp.c)(7),t=wq(_9.catalogValueAtom),n=wq(_9.networkStatusValueAtom),r=wq(N9.presentationsAtom),i;e[0]===r?i=e[1]:(i=[...r.entries()].map(Mxe),e[0]=r,e[1]=i);let a=i,o;return e[2]!==t.isReady||e[3]!==a||e[4]!==n||e[5]!==r?(o={isReady:t.isReady,networkStatus:n,environments:a,presentationById:r},e[2]=t.isReady,e[3]=a,e[4]=n,e[5]=r,e[6]=o):o=e[6],o}function Mxe(e){let[t,n]=e;return P9(t,n)}function F9(){return wq(v9)}function I9(e){let t=(0,Xp.c)(3),{presentation:n}=Dxe(e),r;return t[0]!==e||t[1]!==n?(r=e===null||n===null?null:P9(e,n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function Nxe(){return I9(F9())}function Pxe(e){let t=(0,Xp.c)(2),n=b9(e),r;return t[0]===n?r=t[1]:(r=Rr(n)?n.value.httpBaseUrl:null,t[0]=n,t[1]=r),r}function Fxe(e,t){let n=(0,Xp.c)(6),r=(0,A.useContext)(bq),i=typeof t==`string`?t:t?.label??e.label,a=typeof t==`string`?!0:t?.reportFailure??!0,o=typeof t==`string`?!0:t?.reportDefect??!0,s;return n[0]!==e||n[1]!==i||n[2]!==r||n[3]!==o||n[4]!==a?(s=t=>QK(r,e,t,{label:i,reportFailure:a,reportDefect:o}),n[0]=e,n[1]=i,n[2]=r,n[3]=o,n[4]=a,n[5]=s):s=n[5],s}var L9=A.createContext(void 0);function R9(e){let t=A.useContext(L9);if(t===void 0&&!e)throw Error(dX(72));return t}var Ixe={...h2,disabled:W0(e=>e.disabled),instantType:W0(e=>e.instantType),isInstantPhase:W0(e=>e.isInstantPhase),trackCursorAxis:W0(e=>e.trackCursorAxis),disableHoverablePopup:W0(e=>e.disableHoverablePopup),lastOpenChangeReason:W0(e=>e.openChangeReason),closeOnClick:W0(e=>e.closeOnClick),closeDelay:W0(e=>e.closeDelay),hasViewport:W0(e=>e.hasViewport)},Lxe=class e extends Z0{constructor(e,t,n=!1){let r=new c2,i={...Rxe(),...e};i.floatingRootContext=u2(r,t,n),super(i,{popupRef:A.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:r},Ixe)}setOpen=(e,t)=>{let n=t.reason,r=n===yZ,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0),r2(r,e,t.trigger),this.update(r)};r?Jp.flushSync(o):o()};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,e$(vZ,e))}static useStore(t,n){return t2(t,(t,r)=>new e(n,t,r)).store}};function Rxe(){return{...l2(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var zxe=q0(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=Lxe.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});_4(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),p.useSyncedValue(`disabled`,t),a2(p);let{forceUnmount:y,transitionStatus:b}=o2(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=A.useRef(null);bQ(()=>{m&&t&&p.setOpen(!1,e$(zZ))},[m,t,p]),bQ(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),bQ(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let T=A.useCallback(()=>{p.setOpen(!1,e$(BZ))},[p]);A.useImperativeHandle(o,()=>({unmount:y,close:T}),[y,T]);let E=h||_||!t&&a!==`none`;return(0,N.jsxs)(L9.Provider,{value:p,children:[E&&(0,N.jsx)(Bxe,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function Bxe({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=v0(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=rfe(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n});return s2(e,{activeTriggerProps:A.useMemo(()=>FX(a.reference,i.reference),[a.reference,i.reference]),inactiveTriggerProps:A.useMemo(()=>FX(a.trigger,i.trigger),[a.trigger,i.trigger]),popupProps:A.useMemo(()=>FX(e2,a.floating,i.floating),[a.floating,i.floating])}),null}var z9=A.createContext(void 0);function Vxe(){return A.useContext(z9)}var Hxe=function(e){return e[e.popupOpen=oZ.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),B9=`data-base-ui-tooltip-trigger`;function V9(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(JZ(n))return n}}let t=e.target;return JZ(t)?t:null}function Uxe(e){let t=e;for(;t;){if(t.hasAttribute(B9))return t;let e=t.parentElement;if(e){t=e;continue}let n=t.getRootNode();t=`host`in n&&JZ(n.host)?n.host:null}return null}var Wxe=J0(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=R9(!0),m=a?.store??p;if(!m)throw Error(dX(82));let h=QQ(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=A.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=i2(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=Vxe(),{delayRef:T,isInstantPhase:E,hasProvider:ee}=Sde(v,{open:_}),te=S2(v);m.useSyncedValue(`isInstantPhase`,E);let D=m.useState(`disabled`),ne=s??D,re=I$(ne),ie=m.useState(`trackCursorAxis`),O=m.useState(`disableHoverablePopup`),ae=A.useRef(!1),oe=m$(),k=A.useRef(void 0);function se(){let e=w?.delay,t=typeof T.current==`object`?T.current.open:void 0,n=b;return ee&&(n=t===0?0:c??e??b),n}function ce(e){let t=y.current;if(!t||!e)return!1;let n=Uxe(e);return n!==null&&n!==t&&S$(t,n)}function le(e){let t=ce(e);return ae.current=t,t&&(te.openChangeTimeout.clear(),te.restTimeout.clear(),te.restTimeoutPending=!1,oe.clear()),t}let ue=w2(v,{enabled:!ne,mouseOnly:!0,move:!1,handleClose:!O&&ie!==`both`?F2():null,restMs:se,delay(){let e=typeof T.current==`object`?T.current.close:void 0,t=x;return u==null&&ee&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!ae.current}}),de=v2(v,{enabled:!ne}).reference,fe=e=>{let t=ae.current,n=V9(e),r=le(n),i=y.current,a=i&&n&&S$(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,e$(yZ,e));return}if(t&&!r&&a&&!re.current&&!m.select(`open`)&&i&&v$(k.current)){let t=()=>{!ae.current&&!re.current&&!m.select(`open`)&&m.setOpen(!0,e$(yZ,e,i))},n=se();n===0?(oe.clear(),t()):oe.start(n,t)}},pe=m.useState(`triggerProps`,C);return YX(`button`,e,{state:{open:_},ref:[t,S,y],props:[ue,de,C||ie!==`none`?pe:void 0,{onMouseOver(e){fe(e.nativeEvent)},onFocus(e){ce(V9(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){ae.current=!1,oe.clear(),k.current=void 0},onPointerEnter(e){k.current=e.pointerType},onPointerDown(e){k.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,[Hxe.triggerDisabled]:ne?``:void 0,[B9]:ne?void 0:``},f],stateAttributesMapping:fZ})}),H9=A.createContext(void 0);function Gxe(){let e=A.useContext(H9);if(e===void 0)throw Error(dX(70));return e}var U9=A.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=e0({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,N.jsxs)(A.Fragment,{children:[l,c&&Jp.createPortal(n,c)]})}),Kxe=A.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return R9().useState(`mounted`)||n?(0,N.jsx)(H9.Provider,{value:n,children:(0,N.jsx)(U9,{ref:t,...r})}):null}),W9=A.createContext(void 0);function G9(){let e=A.useContext(W9);if(e===void 0)throw Error(dX(71));return e}var qxe=A.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=Z1,style:g,..._}=e,v=R9(),y=Gxe(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),ee=a4({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?n4:void 0}),te=l4(e,A.useMemo(()=>({open:b,side:ee.side,align:ee.align,anchorHidden:ee.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,ee.side,ee.align,ee.anchorHidden,S,T]),{styles:ee.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,N.jsx)(W9.Provider,{value:ee,children:te})}),Jxe={...mZ,...iZ},Yxe=A.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=R9(),{side:s,align:c}=G9(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);l$({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),C2(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return YX(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[f,Y2(d),a],stateAttributesMapping:Jxe})}),Xxe=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=A.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=A.useMemo(()=>({open:t,close:n}),[t,n]);return(0,N.jsx)(z9.Provider,{value:i,children:(0,N.jsx)(xde,{delay:a,timeoutMs:r,children:e.children})})},Zxe=function(e){return e.popupWidth=`--popup-width`,e.popupHeight=`--popup-height`,e}({}),Qxe={activationDirection:e=>e?{"data-activation-direction":e}:null},$xe=A.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=R9(),c=G9(),l=s.useState(`instantType`),{children:u,state:d}=L4({store:s,side:c.side,cssVars:Zxe,children:a});return YX(`div`,e,{state:{activationDirection:d.activationDirection,transitioning:d.transitioning,instant:l},ref:t,props:[o,{children:u}],stateAttributesMapping:Qxe})}),eSe=Xxe,tSe=zxe;function nSe(e){let t=(0,Xp.c)(2),n;return t[0]===e?n=t[1]:(n=(0,N.jsx)(Wxe,{"data-slot":`tooltip-trigger`,...e}),t[0]=e,t[1]=n),n}function rSe(e){let t=(0,Xp.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:i,align:o,sideOffset:s,side:c,variant:l,anchor:n,children:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=o===void 0?`center`:o,d=s===void 0?4:s,f=c===void 0?`top`:c,p=(l===void 0?`default`:l)===`glass`?`dropdown-glass shadow-xl shadow-black/25 before:hidden`:`border bg-popover not-dark:bg-clip-padding shadow-md/5`,m;t[9]!==i||t[10]!==p?(m=x5(`relative flex h-(--popup-height,auto) w-(--popup-width,auto) origin-(--transform-origin) text-balance rounded-md text-popover-foreground text-xs transition-[width,height,scale,opacity] before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-md)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 data-instant:duration-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,p,i),t[9]=i,t[10]=p,t[11]=m):m=t[11];let h;t[12]===r?h=t[13]:(h=(0,N.jsx)($xe,{className:`relative size-full overflow-clip px-(--viewport-inline-padding) py-1 [--viewport-inline-padding:--spacing(2)] data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:truncate **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity`,"data-slot":`tooltip-viewport`,children:r}),t[12]=r,t[13]=h);let g;t[14]!==a||t[15]!==m||t[16]!==h?(g=(0,N.jsx)(Yxe,{className:m,"data-slot":`tooltip-popup`,...a,children:h}),t[14]=a,t[15]=m,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==u||t[19]!==n||t[20]!==f||t[21]!==d||t[22]!==g?(_=(0,N.jsx)(Kxe,{children:(0,N.jsx)(qxe,{align:u,anchor:n,className:`pointer-events-none z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) transition-[top,left,right,bottom,transform] data-instant:transition-none`,"data-slot":`tooltip-positioner`,side:f,sideOffset:d,children:g})}),t[18]=u,t[19]=n,t[20]=f,t[21]=d,t[22]=g,t[23]=_):_=t[23],_}function iSe(e){return e.bootstrapComplete?e.serverThreadDetailExists||e.draftThreadExists?`ready`:e.serverThreadDetailDeleted?`missing`:e.serverThreadShellExists?`loading`:`missing`:`loading`}function aSe(e){return{environmentId:e.environmentId,threadId:e.threadId}}function oSe(e){return{draftId:e}}function sSe(e){return!e.environmentId||!e.threadId?null:vV(e.environmentId,e.threadId)}function cSe(e){return e.environmentId&&e.threadId?{kind:`server`,threadRef:vV(e.environmentId,e.threadId)}:e.draftId?{kind:`draft`,draftId:e.draftId}:null}function lSe(e,t){return e?.kind===`server`?e.threadRef:e?.kind!==`draft`||!t?.promotedTo?null:t.promotedTo}var K9=`task`,uSe=`p4code:right-panel-state:v2`,dSe=7,q9={isOpen:!1,activeSurfaceId:null,surfaces:[]},J9=e=>{switch(e){case`diff`:return{id:`diff`,kind:e};case`files`:return{id:`files`,kind:e};case`plan`:return{id:`plan`,kind:e};case`task`:return{id:K9,kind:e}}},Y9=e=>e?{id:`browser:${e}`,kind:`preview`,resourceId:e}:{id:`browser:new`,kind:`preview`,resourceId:null},fSe=(e,t,n)=>({id:`file:${e}`,kind:`file`,relativePath:e,revealLine:t,revealRequestId:n}),pSe=e=>({id:`terminal:${e}`,kind:`terminal`,resourceId:e,terminalIds:[e],activeTerminalId:e}),X9=(e,t,n=!0)=>({isOpen:!0,surfaces:e.surfaces.some(e=>e.id===t.id)?e.surfaces:[...e.surfaces,t],activeSurfaceId:n?t.id:e.activeSurfaceId}),Z9=(e,t,n)=>{let r=e[t]??q9,i=n(r);if(!i.isOpen&&i.activeSurfaceId===null&&i.surfaces.length===0){if(!(t in e))return e;let{[t]:n,...r}=e;return r}return i===r?e:{...e,[t]:i}};function mSe(e){return e===void 0||!Number.isFinite(e)?null:Math.max(1,Math.trunc(e))}function hSe(e){return!e||typeof e!=`object`?{byThreadKey:{}}:{byThreadKey:`byThreadKey`in e&&e.byThreadKey&&typeof e.byThreadKey==`object`?Object.fromEntries(Object.entries(e.byThreadKey).map(([e,t])=>{let n=t&&typeof t==`object`?t:null,r=Array.isArray(n?.surfaces)?n.surfaces.flatMap(e=>{if(e.kind===`file`){let t=typeof e.revealLine==`number`&&Number.isFinite(e.revealLine)?Math.max(1,Math.trunc(e.revealLine)):null,n=typeof e.revealRequestId==`number`&&Number.isSafeInteger(e.revealRequestId)&&e.revealRequestId>=0?e.revealRequestId:0;return[{...e,revealLine:t,revealRequestId:n}]}if(e.kind!==`terminal`)return[e];if(!(`resourceId`in e)||typeof e.resourceId!=`string`||e.id!==`terminal:${e.resourceId}`)return[];let t=`terminalIds`in e&&Array.isArray(e.terminalIds)?[...new Set(e.terminalIds.filter(e=>typeof e==`string`))]:[e.resourceId],n=`activeTerminalId`in e&&typeof e.activeTerminalId==`string`&&t.includes(e.activeTerminalId)?e.activeTerminalId:t[0]??e.resourceId;return[{...e,terminalIds:t.length>0?t:[e.resourceId],activeTerminalId:n}]}):[],i=r.some(e=>e.id===n?.activeSurfaceId)?n?.activeSurfaceId??null:null;return[e,{isOpen:typeof n?.isOpen==`boolean`?n.isOpen:i!==null,surfaces:r,activeSurfaceId:i}]})):{}}}var gSe=K6()(Y6(e=>({byThreadKey:{},open:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>n===`preview`?X9(e,e.surfaces.find(e=>e.kind===`preview`)??Y9(null)):X9(e,J9(n)))})),openBrowser:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=Y9(n),r=n?e.surfaces.filter(e=>e.id!==`browser:new`):e.surfaces;return X9({...e,surfaces:r},t)})})),openFile:(t,n,r)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.filter(e=>e.kind!==`files`),i=`file:${n}`,a=t.find(e=>e.id===i&&e.kind===`file`),o=fSe(n,mSe(r),(a?.revealRequestId??0)+1);return{isOpen:!0,activeSurfaceId:o.id,surfaces:a?t.map(e=>e.id===o.id?o:e):[...t,o]}})})),openTerminal:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>X9(e,pSe(n)))})),splitTerminal:(t,n,r,i=`horizontal`)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>({...e,isOpen:!0,activeSurfaceId:n,surfaces:e.surfaces.map(e=>{if(e.id!==n||e.kind!==`terminal`)return e;let{splitDirection:t,...a}=e;return{...a,terminalIds:e.terminalIds.includes(r)?e.terminalIds:[...e.terminalIds,r],activeTerminalId:r,...i===`vertical`?{splitDirection:`vertical`}:{}}})}))})),activateTerminal:(t,n,r)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>({...e,activeSurfaceId:n,surfaces:e.surfaces.map(e=>e.id===n&&e.kind===`terminal`&&e.terminalIds.includes(r)?{...e,activeTerminalId:r}:e)}))})),closeTerminal:(t,n,r)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.find(e=>e.id===n&&e.kind===`terminal`);if(!t||t.kind!==`terminal`)return e;let i=t.terminalIds.filter(e=>e!==r);if(i.length===0){let t=e.surfaces.findIndex(e=>e.id===n),r=e.surfaces.filter(e=>e.id!==n),i=r[Math.min(t,r.length-1)]??null;return{...e,isOpen:r.length>0&&e.isOpen,surfaces:r,activeSurfaceId:e.activeSurfaceId===n?i?.id??null:e.activeSurfaceId}}return{...e,surfaces:e.surfaces.map(e=>e.id===n&&e.kind===`terminal`?{...e,terminalIds:i,activeTerminalId:e.activeTerminalId===r?i.at(-1)??i[0]:e.activeTerminalId}:e)}})})),activateSurface:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>e.surfaces.some(e=>e.id===n)?{...e,isOpen:!0,activeSurfaceId:n}:e)})),closeSurface:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.findIndex(e=>e.id===n);if(t<0)return e;let r=e.surfaces.filter(e=>e.id!==n);if(e.activeSurfaceId!==n)return{...e,isOpen:r.length>0&&e.isOpen,surfaces:r};let i=r[Math.min(t,r.length-1)]??null;return{...e,isOpen:r.length>0&&e.isOpen,surfaces:r,activeSurfaceId:i?.id??null}})})),closeOtherSurfaces:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.find(e=>e.id===n);return!t||e.surfaces.length===1?e:{...e,isOpen:!0,surfaces:[t],activeSurfaceId:t.id}})})),closeSurfacesToRight:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.findIndex(e=>e.id===n);if(t<0||t===e.surfaces.length-1)return e;let r=e.surfaces.slice(0,t+1),i=r.some(t=>t.id===e.activeSurfaceId);return{...e,surfaces:r,activeSurfaceId:i?e.activeSurfaceId:n}})})),closeAllSurfaces:t=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>e.surfaces.length===0?e:{...e,isOpen:!1,surfaces:[],activeSurfaceId:null})})),reconcileBrowserSurfaces:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=new Set(n.map(e=>`browser:${e}`)),r=e.surfaces.filter(e=>e.kind!==`preview`),i=e.surfaces.filter(e=>e.kind===`preview`&&e.id!==`browser:new`&&t.has(e.id)),a=new Set(i.map(e=>e.id)),o=n.filter(e=>!a.has(`browser:${e}`)).map(e=>Y9(e)),s=[...r,...i,...o],c=s.some(t=>t.id===e.activeSurfaceId),l=s.find(e=>e.kind===`preview`);return{...e,surfaces:s,activeSurfaceId:c?e.activeSurfaceId:l?.id??s[0]?.id??null}})})),reconcileFileSurfaces:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{if(n)return e;let t=e.surfaces.filter(e=>e.kind!==`files`&&e.kind!==`file`);if(t.length===e.surfaces.length)return e;let r=t.some(t=>t.id===e.activeSurfaceId);return{...e,isOpen:t.length>0?e.isOpen:!1,surfaces:t,activeSurfaceId:r?e.activeSurfaceId:t.at(-1)?.id??null}})})),show:t=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>e.isOpen?e:{...e,isOpen:!0})})),close:t=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>e.isOpen?{...e,isOpen:!1}:e)})),toggleVisibility:t=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>({...e,isOpen:!e.isOpen}))})),toggle:(t,n)=>e(e=>({byThreadKey:Z9(e.byThreadKey,xV(t),e=>{let t=e.surfaces.find(t=>t.id===e.activeSurfaceId);return e.isOpen&&t?.kind===n?{...e,isOpen:!1}:n===`preview`?X9(e,e.surfaces.find(e=>e.kind===`preview`)??Y9(null)):X9(e,J9(n))})})),removeThread:t=>e(e=>{let n=xV(t);if(!(n in e.byThreadKey))return e;let{[n]:r,...i}=e.byThreadKey;return{byThreadKey:i}})}),{name:uSe,version:dSe,storage:q6(()=>h8(typeof window<`u`?window.localStorage:void 0)),partialize:e=>({byThreadKey:e.byThreadKey}),migrate:hSe}));function Q9(e,t){return t?e[xV(t)]??q9:q9}function _Se(e,t){let n=Q9(e,t);return n.isOpen?n.surfaces.find(e=>e.id===n.activeSurfaceId)?.kind??null:null}function vSe(e,t){let n=Q9(e,t);return n.isOpen?n.surfaces.find(e=>e.id===n.activeSurfaceId)??null:null}var $9=A.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:b,validationMode:x,validation:S}=s3(),C=h||s,w=m??a,T={...p,disabled:C},{labelId:E}=l3(),ee=u3({id:i});bQ(()=>{let e=o!=null;S.inputRef.current?.value||e&&o!==``?b(!0):e&&o===``&&b(!1)},[S.inputRef,b,o]);let te=A.useRef(null);bQ(()=>{u&&te.current===x$(L$(te.current))&&y(!0)},[u,y]);let[D]=HZ({controlled:o,default:l,name:`FieldControl`,state:`value`}),ne=o!==void 0,re=ne?D:void 0,ie=_Q(()=>S.inputRef.current?.value);return c3(S.inputRef,ee,re,ie),YX(`input`,e,{ref:[t,te],state:T,props:[{id:ee,disabled:C,name:w,ref:S.inputRef,"aria-labelledby":E,autoFocus:u,...ne?{value:re}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,e$(_Z,e.nativeEvent)),_(t!==v.initialValue),b(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),x===`onBlur`&&S.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),S.commit(e.currentTarget.value))}},S.getInputValidationProps(),f],stateAttributesMapping:i3})});function ySe(e){let t=(0,Xp.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,size:i,unstyled:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?!1:a,c;t[5]!==n||t[6]!==s?(c=x5(!s&&`relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]`,n)||void 0,t[5]=n,t[6]=s,t[7]=c):c=t[7];let l;t[8]!==r||t[9]!==o?(l=(0,N.jsx)($9,{render:e=>(0,N.jsx)(`textarea`,{className:x5(`field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5`,o===`sm`&&`min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5`,o===`lg`&&`min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5`),"data-slot":`textarea`,...FX(e,r)})}),t[8]=r,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==o||t[12]!==c||t[13]!==l?(u=(0,N.jsx)(`span`,{className:c,"data-size":o,"data-slot":`textarea-control`,children:l}),t[11]=o,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}export{Jye as $,ZQ as $a,Dj as $c,Au as $d,wt as $f,o2 as $i,aC as $l,q3 as $n,dX as $o,z4 as $r,XH as $s,Ege as $t,wm as $u,dxe as A,V$ as Aa,MN as Ac,Hp as Ad,gi as Af,V2 as Ai,_w as Al,xhe as An,_Z as Ao,l as Ap,o3 as Ar,_q as As,W_e as At,by as Au,txe as B,C$ as Ba,TM as Bc,Nf as Bd,Rr as Bf,F2 as Bi,gw as Bl,l6 as Bn,fZ as Bo,$pe as Br,tq as Bs,h_e as Bt,hre as Bu,Nxe as C,m1 as Ca,AN as Cc,Ff as Cd,Hi as Cf,Y2 as Ci,DT as Cl,L6 as Cn,DZ as Co,C as Cp,m3 as Cr,Oq as Cs,yve as Ct,Ry as Cu,M9 as D,l1 as Da,CN as Dc,Lp as Dd,ji as Df,B2 as Di,zae as Dl,bhe as Dn,SZ as Do,d as Dp,l3 as Dr,hq as Ds,tve as Dt,vy as Du,Cxe as E,u1 as Ea,TN as Ec,Rp as Ed,Li as Ef,z2 as Ei,vT as El,The as En,jZ as Eo,p as Ep,u3 as Er,ZK as Es,U5 as Et,Eb as Eu,pxe as F,F$ as Fa,aN as Fc,Pf as Fd,Ur as Ff,U2 as Fi,sw as Fl,f6 as Fn,hZ as Fo,X4 as Fr,eq as Fs,x5 as Ft,F as Fu,ybe as G,l$ as Ga,oM as Gc,dp as Gd,br as Gf,g2 as Gi,pC as Gl,phe as Gn,NX as Go,q4 as Gr,bK as Gs,M8 as Gt,rg as Gu,_9 as H,p$ as Ha,yM as Hc,nf as Hd,Pr as Hf,O2 as Hi,xC as Hl,rhe as Hn,iZ as Ho,U4 as Hr,qK as Hs,m_e as Ht,$v as Hu,lxe as I,P$ as Ia,oN as Ic,Bf as Id,Br as If,fpe as Ii,ow as Il,_6 as In,gZ as Io,Y4 as Ir,$K as Is,f_e as It,P as Iu,I7 as J,i$ as Ja,Gj as Jc,Gd as Jd,Er as Jf,h2 as Ji,gC as Jl,$me as Jn,OX as Jo,rme as Jr,uG as Js,u_e as Jt,Yh as Ju,pbe as K,c$ as Ka,Qoe as Kc,Id as Kd,Dr as Kf,l2 as Ki,ZS as Kl,d6 as Kn,kX as Ko,eme as Kr,MG as Ks,d_e as Kt,lg as Ku,cxe as L,O$ as La,iN as Lc,M as Ld,Wr as Lf,hpe as Li,lw as Ll,mhe as Ln,aZ as Lo,J4 as Lr,dq as Ls,p_e as Lt,aie as Lu,oxe as M,B$ as Ma,PN as Mc,Mf as Md,di as Mf,dpe as Mi,hw as Ml,vhe as Mn,IZ as Mo,r3 as Mr,aq as Ms,P_e as Mt,xy as Mu,uxe as N,L$ as Na,LN as Nc,tf as Nd,Vr as Nf,ppe as Ni,vw as Nl,T6 as Nn,yZ as No,i3 as Nr,iq as Ns,N_e as Nt,gy as Nu,xxe as O,c1 as Oa,RN as Oc,Cf as Od,Mi as Of,L2 as Oi,Hw as Ol,D6 as On,FZ as Oo,o as Op,c3 as Or,vq as Os,k5 as Ot,yre as Ou,fxe as P,I$ as Pa,uN as Pc,Yf as Pd,Xr as Pf,K2 as Pi,fw as Pl,yhe as Pn,vZ as Po,Z4 as Pr,fq as Ps,A_e as Pt,ib as Pu,F7 as Q,QQ as Qa,Rj as Qc,ju as Qd,Ut as Qf,a2 as Qi,cC as Ql,i6 as Qn,hX as Qo,Zpe as Qr,hH as Qs,xge as Qt,km as Qu,sxe as R,x$ as Ra,nN as Rc,of as Rd,Gr as Rf,gpe as Ri,mw as Rl,nhe as Rn,mZ as Ro,V4 as Rr,nq as Rs,__e as Rt,oie as Ru,jxe as S,d1 as Sa,Bue as Sc,df as Sd,Wi as Sf,X2 as Si,VT as Sl,F6 as Sn,kZ as So,g as Sp,d3 as Sr,kq as Ss,q5 as St,G as Su,Axe as T,f1 as Ta,jN as Tc,zp as Td,Ri as Tf,W2 as Ti,gT as Tl,N6 as Tn,AZ as To,h as Tp,p3 as Tr,bq as Ts,H5 as Tt,V as Tu,g9 as U,m$ as Ua,bM as Uc,cp as Ud,Fr as Uf,w2 as Ui,uC as Ul,c6 as Un,YX as Uo,G4 as Ur,YK as Us,S5 as Ut,qv as Uu,b9 as V,h$ as Va,Fse as Vc,Lf as Vd,zr as Vf,k2 as Vi,eC as Vl,s6 as Vn,tZ as Vo,Qpe as Vr,KK as Vs,g_e as Vt,Qv as Vu,gbe as W,d$ as Wa,aM as Wc,cf as Wd,xr as Wf,C2 as Wi,tC as Wl,fhe as Wn,FX as Wo,K4 as Wr,FK as Ws,A8 as Wt,_v as Wu,ibe as X,e$ as Xa,Wj as Xc,Vd as Xd,un as Xf,e2 as Xi,kC as Xl,ehe as Xn,_X as Xo,H4 as Xr,WH as Xs,s_e as Xt,uh as Xu,abe as Y,t$ as Ya,Zj as Yc,Bd as Yd,Xn as Yf,c2 as Yi,hC as Yl,a6 as Yn,vX as Yo,nme as Yr,UH as Ys,b5 as Yt,Xh as Yu,P7 as Z,ode as Za,Lj as Zc,vd as Zd,Qt as Zf,r2 as Zi,vC as Zl,the as Zn,mX as Zo,B4 as Zr,TH as Zs,l_e as Zt,Om as Zu,nSe as _,Gde as _a,EI as _c,Fp as _d,ka as _f,a4 as _i,mE as _l,qhe as _n,EZ as _o,se as _p,_3 as _r,PY as _s,n7 as _t,U as _u,vSe as a,X0 as aa,jV as ac,wf as ad,iu as af,T4 as ai,VO as al,m8 as an,jQ as ao,ye as ap,Hme as ar,iX as as,Mye as at,ox as au,I9 as b,Z1 as ba,WP as bc,lp as bd,sa as bf,$2 as bi,fE as bl,Jhe as bn,BZ as bo,oe as bp,g3 as br,Iq as bs,kve as bt,L as bu,oSe as c,v0 as ca,wV as cc,lf as cd,Ol as cf,b4 as ci,SO as cl,$6 as cn,bQ as co,pe as cp,G3 as cr,GY as cs,Sye as ct,Jb as cu,sSe as d,l0 as da,bV as dc,Df as dd,kl as df,h4 as di,QE as dl,K6 as dn,JZ as do,le as dp,P3 as dr,qY as ds,fye as dt,B as du,s2 as ea,GH as ec,Dm as ed,gu as ef,L4 as ei,gj as el,Sge as en,KQ as eo,je as ep,Y3 as er,lX as es,E7 as et,VS as eu,iSe as f,u0 as fa,xV as fc,Uf as fd,jl as ff,m4 as fi,sD as fl,Hhe as fn,YZ as fo,ae as fp,D3 as fr,zY as fs,Wve as ft,R as fu,eSe as g,Jde as ga,MI as gc,Wp as gd,Ma as gf,s4 as gi,$E as gl,B6 as gn,CZ as go,D as gp,v3 as gr,RY as gs,Vve as gt,H as gu,rSe as h,t0 as ha,RL as hc,_f as hd,Na as hf,c4 as hi,oD as hl,V6 as hn,wZ as ho,k as hp,C3 as hr,MY as hs,Uve as ht,cb as hu,_Se as i,Z0 as ia,AV as ic,Bp as id,Su as if,E4 as ii,sk as il,wge as in,MQ as io,Se as ip,Vme as ir,aX as is,v7 as it,kx as iu,C9 as j,z$ as ja,NN as jc,uf as jd,ti as jf,H2 as ji,dw as jl,C6 as jn,xZ as jo,s3 as jr,mq as js,H_e as jt,bre as ju,nxe as k,g1 as ka,xue as kc,jf as kd,Ei as kf,G2 as ki,uw as kl,E6 as kn,PZ as ko,s as kp,a3 as kr,gq as ks,O5 as kt,Wy as ku,aSe as l,g0 as la,_V as lc,Af as ld,Nl as lf,y4 as li,TO as ll,q6 as ln,_Q as lo,fe as lp,Rme as lr,KY as ls,vye as lt,Y as lu,tSe as m,o0 as ma,dR as mc,ff as md,fl as mf,l4 as mi,eD as ml,Ihe as mn,LZ as mo,ne as mp,w3 as mr,NY as ms,Gve as mt,tb as mu,$9 as n,t2 as na,PV as nc,Qd as nd,bu as nf,O4 as ni,qO as nl,y8 as nn,FQ as no,Te as np,Ume as nr,sX as ns,S7 as nt,JS as nu,Q9 as o,Y0 as oa,MV as oc,Tf as od,Jl as of,w4 as oi,KO as ol,h8 as on,wQ as oo,_e as op,Bme as or,rX as os,g7 as ot,ix as ou,cSe as p,c0 as pa,X as pc,ep as pd,ml as pf,p4 as pi,cD as pl,Whe as pn,HZ as po,ce as pp,E3 as pr,LY as ps,Kve as pt,Cb as pu,obe as q,o$ as qa,Kj as qc,zd as qd,Cr as qf,u2 as qi,oC as ql,che as qn,AX as qo,tme as qr,dG as qs,y5 as qt,zh as qu,K9 as r,i2 as ra,VV as rc,yf as rd,Bne as rf,D4 as ri,ck as rl,yge as rn,NQ as ro,we as rp,Ime as rr,oX as rs,Vye as rt,KS as ru,gSe as s,W0 as sa,BV as sc,Ef as sd,Xl as sf,x4 as si,yO as sl,p8 as sn,xQ as so,me as sp,zme as sr,HY as ss,Eye as st,Xb as su,ySe as t,$fe as ta,qV as tc,Qf as td,hu as tf,k4 as ti,$O as tl,Dge as tn,qQ as to,De as tp,J3 as tr,cX as ts,Uye as tt,HS as tu,lSe as u,h0 as ua,vV as uc,kf as ud,Fl as uf,_4 as ui,xO as ul,Y6 as un,GZ as uo,de as up,F3 as ur,JY as us,_ye as ut,K as uu,U9 as v,X1 as va,KF as vc,Pp as vd,ga as vf,n4 as vi,aE as vl,Fhe as vn,NZ as vo,v as vp,y3 as vr,Gq as vs,Q5 as vt,Ny as vu,F9 as w,h1 as wa,kN as wc,ap as wd,xi as wf,R2 as wi,hT as wl,M6 as wn,OZ as wo,w as wp,h3 as wr,wq as ws,W5 as wt,Vy as wu,Pxe as x,p1 as xa,UP as xc,yp as xd,ua as xf,Q2 as xi,uoe as xl,Ahe as xn,TZ as xo,re as xp,f3 as xr,Bq as xs,Nve as xt,z as xu,Fxe as y,Yde as ya,qF as yc,$d as yd,la as yf,e4 as yi,uE as yl,Yhe as yn,MZ as yo,x as yp,b3 as yr,Fq as ys,jve as yt,Iy as yu,x9 as z,S$ as za,yce as zc,sf as zd,Lr as zf,I2 as zi,cw as zl,she as zn,pZ as zo,W4 as zr,sq as zs,v_e as zt,Hb as zu};
|
|
46
|
-
//# sourceMappingURL=textarea-B03Qe3NX.js.map
|