sliccy 3.35.0 → 3.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/node-server/chrome-launch.d.ts +16 -1
  2. package/dist/node-server/chrome-launch.js +54 -4
  3. package/dist/node-server/index.js +6 -3
  4. package/dist/ui/assets/{adobe-BRQEfz1I.js → adobe-BDx0xZZN.js} +2 -2
  5. package/dist/ui/assets/{adobe-DqEEV7K5.js → adobe-cxXajJ1A.js} +1 -1
  6. package/dist/ui/assets/{agent-bridge--aoB7za4.js → agent-bridge-DyKUTtuo.js} +1 -1
  7. package/dist/ui/assets/{agent-message-to-chat-Cf-PA3PL.js → agent-message-to-chat-Bi5-2WlC.js} +1 -1
  8. package/dist/ui/assets/{anthropic-oHjoP5Qp.js → anthropic-BLr6vgjL.js} +1 -1
  9. package/dist/ui/assets/{anthropic-CP-ouum5.js → anthropic-DhlxlRUi.js} +1 -1
  10. package/dist/ui/assets/{apps-P8w2nNUB.js → apps-CMXlIt7l.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-Dgh02LJw.js → azure-openai-BemTM7cG.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-BDajo6ba.js → azure-openai-D6erH762.js} +1 -1
  13. package/dist/ui/assets/{azure-openai-responses-BhEyP5io.js → azure-openai-responses-BCdijGeI.js} +1 -1
  14. package/dist/ui/assets/{azure-openai-responses-D_Emnwqm.js → azure-openai-responses-Ckbzibre.js} +1 -1
  15. package/dist/ui/assets/{biome_wasm-Cj2t2Sqp.js → biome_wasm-DcVkLcac.js} +1 -1
  16. package/dist/ui/assets/{bsh-watchdog-BHM3lIIW.js → bsh-watchdog-C6PTBGjJ.js} +1 -1
  17. package/dist/ui/assets/{cdp-DzsLEquc.js → cdp-84XjVz0a.js} +3 -3
  18. package/dist/ui/assets/{cdp-ws-page-bridge-Cq3dnPCj.js → cdp-ws-page-bridge-Br3RDWMc.js} +1 -1
  19. package/dist/ui/assets/{common-Bes6Rp5g.js → common-Kgrp69uW.js} +1 -1
  20. package/dist/ui/assets/{connect-surface-6MDb65af.js → connect-surface-BPBamnV2.js} +1 -1
  21. package/dist/ui/assets/cost-command-BzwhcR5V.js +1 -0
  22. package/dist/ui/assets/{dist-BvikTLzU.js → dist-BwrS08So.js} +1 -1
  23. package/dist/ui/assets/{dist-iTrcpjMt.js → dist-CoGx23Mh.js} +1 -1
  24. package/dist/ui/assets/{dist-BR9SH6f-.js → dist-Cp7UAJid.js} +1 -1
  25. package/dist/ui/assets/{dist-B_L1hx85.js → dist-rL8usQYO.js} +1 -1
  26. package/dist/ui/assets/{es-CcN0if_N.js → es-CPRTyRS4.js} +1 -1
  27. package/dist/ui/assets/{follower-sprinkle-bridge-BnXbVmXR.js → follower-sprinkle-bridge-DvVGjC8f.js} +1 -1
  28. package/dist/ui/assets/{github-kxRKas0e.js → github-BIvONWqz.js} +1 -1
  29. package/dist/ui/assets/{github-copilot-r5E168qG.js → github-copilot-904lM2o2.js} +1 -1
  30. package/dist/ui/assets/{github-copilot-O8gRRubZ.js → github-copilot-ClJae8xc.js} +2 -2
  31. package/dist/ui/assets/{github-BVkjHtni.js → github-zokiXPzN.js} +2 -2
  32. package/dist/ui/assets/{google-C4UaifIA.js → google-Cjha4joL.js} +1 -1
  33. package/dist/ui/assets/{google-DhgTyv3k.js → google-Doi2Ohn6.js} +1 -1
  34. package/dist/ui/assets/{google-shared-CfTcRL_l.js → google-shared-BzEbof8A.js} +1 -1
  35. package/dist/ui/assets/{google-shared-cbPEawjU.js → google-shared-CNKdXbm8.js} +1 -1
  36. package/dist/ui/assets/{google-vertex-DCwY7SpP.js → google-vertex-B5vBchlU.js} +1 -1
  37. package/dist/ui/assets/{google-vertex-DrVy9tT-.js → google-vertex-OUoxkWRz.js} +1 -1
  38. package/dist/ui/assets/{hosted-config-apply-6JWS8OfU.js → hosted-config-apply-_WyR0PnY.js} +1 -1
  39. package/dist/ui/assets/{intercepted-oauth-BeA89evx.js → intercepted-oauth-E-RJ_38y.js} +1 -1
  40. package/dist/ui/assets/{kernel-worker-CsVAcCa0.js → kernel-worker-jD7bcOG1.js} +21 -21
  41. package/dist/ui/assets/{lick-ws-bridge-BeO_NfAN.js → lick-ws-bridge-Bu0447pg.js} +1 -1
  42. package/dist/ui/assets/{local-llm-BExlcRTe.js → local-llm-DTfJxIXt.js} +1 -1
  43. package/dist/ui/assets/{magick-wasm-52jtVvFN.js → magick-wasm-Dilg8m3U.js} +1 -1
  44. package/dist/ui/assets/{main-lrS_5wG0.js → main-BuR1AKEt.js} +228 -156
  45. package/dist/ui/assets/{main-cherry-DDFIq_gA.js → main-cherry-DQ9DcLoo.js} +1 -1
  46. package/dist/ui/assets/{migration-run-Blb3KPMp.js → migration-run-EL8p-R1L.js} +1 -1
  47. package/dist/ui/assets/{mistral-anetp8MW.js → mistral-BTJY2iBI.js} +1 -1
  48. package/dist/ui/assets/{mistral-Bml5xQsA.js → mistral-CQpf9iQh.js} +1 -1
  49. package/dist/ui/assets/{nodejs-TWe3ARKT.js → nodejs-Cl5Op5oH.js} +1 -1
  50. package/dist/ui/assets/{nuke-command-Be-RNfyH.js → nuke-command-EsWO-99-.js} +1 -1
  51. package/dist/ui/assets/{oauth-B68JgGW1.js → oauth-COh1tidH.js} +1 -1
  52. package/dist/ui/assets/{oauth-bootstrap-hbzMsWI8.js → oauth-bootstrap-CnTMAvSf.js} +2 -2
  53. package/dist/ui/assets/{oauth-service-DUrh0AYU.js → oauth-service-CHFZzMAM.js} +1 -1
  54. package/dist/ui/assets/{oauth-service-DbPObLKr.js → oauth-service-DwylaCdf.js} +1 -1
  55. package/dist/ui/assets/{offscreen-client-BujqsTo-.js → offscreen-client-CY2P6ZpH.js} +1 -1
  56. package/dist/ui/assets/{onboarding-orchestrator-BD4FQQVL.js → onboarding-orchestrator-Dy5rLil-.js} +1 -1
  57. package/dist/ui/assets/{openai-codex-CxjIoboc.js → openai-codex-CSExyJdK.js} +1 -1
  58. package/dist/ui/assets/{openai-codex-Cbrr6rGT.js → openai-codex-hQxy0wsX.js} +1 -1
  59. package/dist/ui/assets/{openai-codex-responses-C9vLfgL2.js → openai-codex-responses-BUfFqzRl.js} +1 -1
  60. package/dist/ui/assets/{openai-codex-responses-Ck2q17sa.js → openai-codex-responses-YNMSm_9-.js} +1 -1
  61. package/dist/ui/assets/{openai-completions-wICCJVuW.js → openai-completions-jY0XduoF.js} +1 -1
  62. package/dist/ui/assets/{openai-responses-DxgM2J96.js → openai-responses-KsCBEvUD.js} +1 -1
  63. package/dist/ui/assets/{openai-responses-Bjsbtb8-.js → openai-responses-KvO6yZ53.js} +1 -1
  64. package/dist/ui/assets/{openai-responses-shared-COkNR-Pr.js → openai-responses-shared-B8LvbBLm.js} +1 -1
  65. package/dist/ui/assets/{openai-responses-shared-DfPgySbe.js → openai-responses-shared-BEfL_4Jo.js} +1 -1
  66. package/dist/ui/assets/{openrouter-DJdg9hUw.js → openrouter-BDi20ID7.js} +1 -1
  67. package/dist/ui/assets/{openrouter-DJeU4Mbk.js → openrouter-Bg9dnwH0.js} +1 -1
  68. package/dist/ui/assets/{panel-rpc-handlers-CYxO9OxE.js → panel-rpc-handlers-BXEiLAAr.js} +1 -1
  69. package/dist/ui/assets/{provider-D1Ft0Nb8.js → provider-CfArdY9x.js} +2 -2
  70. package/dist/ui/assets/{provider-p23r1B9g.js → provider-DE_36sNg.js} +1 -1
  71. package/dist/ui/assets/provider-store-access-B6gI9Cfx.js +1 -0
  72. package/dist/ui/assets/provider-store-access-DK_UYwgf.js +1 -0
  73. package/dist/ui/assets/{proxied-fetch-KHVJs3Kj.js → proxied-fetch-CeUEVmxJ.js} +1 -1
  74. package/dist/ui/assets/{pyodide-BJTshnbo.js → pyodide-1sA0caY8.js} +2 -2
  75. package/dist/ui/assets/{remote-terminal-view-D53aNTEz.js → remote-terminal-view-CWAelr73.js} +1 -1
  76. package/dist/ui/assets/{remote-vfs-client-Cm2KnQKl.js → remote-vfs-client-DccrPQK3.js} +1 -1
  77. package/dist/ui/assets/{secret-env-ChcPNQmy.js → secret-env-CCuKboWk.js} +1 -1
  78. package/dist/ui/assets/{slicc-editor-CjKFECEG.js → slicc-editor-C91M-_Ki.js} +1 -1
  79. package/dist/ui/assets/{spawn-BQcHMJGU.js → spawn-BVUlR8PQ.js} +1 -1
  80. package/dist/ui/assets/{sql-wasm-C9SZBPLh.js → sql-wasm-C_8iNeNy.js} +1 -1
  81. package/dist/ui/assets/{src-Duh03CdO.js → src-Dt77-cQy.js} +1 -1
  82. package/dist/ui/assets/{store-gTLi8tdo.js → store-DhPN9ghF.js} +1 -1
  83. package/dist/ui/assets/terminal-session-client-C_tYJ1IB.js +1 -0
  84. package/dist/ui/assets/{tray-leave-runtime-COlsOS8N.js → tray-leave-runtime-C9WjcJt7.js} +1 -1
  85. package/dist/ui/assets/{typescript-rk7H1_FE.js → typescript-CXc3cH84.js} +1 -1
  86. package/dist/ui/assets/{upgrade-detection--HvC0q7X.js → upgrade-detection-C8SKVajA.js} +1 -1
  87. package/dist/ui/assets/{web-SsRbZ_tV.js → web-CBnsPMLv.js} +1 -1
  88. package/dist/ui/assets/{writable-vfs-client-CmIlnwCv.js → writable-vfs-client-8kaPaUvR.js} +1 -1
  89. package/dist/ui/assets/{ws-subscribers-CVS-pepL.js → ws-subscribers-r7MB4Tl5.js} +1 -1
  90. package/dist/ui/assets/{xai-grok-C0k59tLJ.js → xai-grok-DYhZ5bwG.js} +1 -1
  91. package/dist/ui/assets/{xai-grok-BR7eM-uM.js → xai-grok-VZlQG8z0.js} +1 -1
  92. package/dist/ui/index.html +1 -1
  93. package/dist/ui/packages/webapp/index.html +1 -1
  94. package/package.json +1 -1
  95. package/dist/ui/assets/cost-command-BJFKPD-9.js +0 -1
  96. package/dist/ui/assets/provider-store-access-BIempBYx.js +0 -1
  97. package/dist/ui/assets/provider-store-access-D-VyHV75.js +0 -1
@@ -1 +1 @@
1
- import{I as e}from"./main-lrS_5wG0.js";import{BrowserAPI as t}from"./cdp-DzsLEquc.js";var n=new Set([`handshake.hello`,`handshake.welcome`,`cdp.request`,`cdp.response`,`cdp.event`,`permission.request`,`permission.response`,`host.event`,`slicc.event`]);function r(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.cherry===1&&typeof t.channelId==`string`&&typeof t.kind==`string`&&n.has(t.kind)}function i(e,t){return!(!t.allowOrigins.includes(e.origin)||t.expectedSource!==null&&e.source!==t.expectedSource||!r(e.data)||t.channelId!==null&&e.data.channelId!==t.channelId)}var a=e(`cherry-transport`),o=`cherry-session`,s=`cherry-target`,c=`cherry-frame`,l=3e4,u=class{opts;channelId=null;nextId=1;_state=`disconnected`;pending=new Map;listeners=new Map;connectResolve=null;connectTimer=null;_joinUrl=null;boundHandler=e=>this.handleMessage(e);onHostEvent=null;constructor(e){this.opts=e}get state(){return this._state}get joinUrl(){return this._joinUrl}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);this._state=`connecting`,this.channelId=`cherry-${crypto.randomUUID()}`,typeof window<`u`&&window.addEventListener(`message`,this.boundHandler);let t=e?.timeout??l;return new Promise((e,n)=>{this.connectResolve=e,this.connectTimer=setTimeout(()=>{this.connectTimer=null,typeof window<`u`&&window.removeEventListener(`message`,this.boundHandler),this._state=`disconnected`,this.channelId=null,this.connectResolve=null,n(Error(`Cherry handshake timed out after ${t}ms`))},t),this.post({cherry:1,channelId:this.channelId,kind:`handshake.hello`,capabilities:this.opts.capabilities??{navigate:!0,screenshot:!0,openUrl:!0}})})}disconnect(){this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null),typeof window<`u`&&window.removeEventListener(`message`,this.boundHandler);for(let[,e]of this.pending)e.reject(Error(`Cherry transport disconnected`));this.pending.clear(),this._state=`disconnected`,this.channelId=null}async send(e,t,n,r=3e4){if(this._state!==`connected`)throw Error(`Cherry transport is not connected`);let i=this.handleSynthetic(e,t);if(i)return i;let a=this.nextId++,o=await new Promise((n,i)=>{let o=setTimeout(()=>{this.pending.delete(a),i(Error(`Cherry CDP timed out after ${r}ms: ${e}`))},r);this.pending.set(a,{resolve:e=>{clearTimeout(o),n(e)},reject:e=>{clearTimeout(o),i(e)}}),this.post({cherry:1,channelId:this.channelId,kind:`cdp.request`,id:a,method:e,params:t})});return e===`Page.navigate`&&this.synthesizeNavigationLifecycle(o,t?.url),o}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,t=3e4){return new Promise((n,r)=>{let i=setTimeout(()=>{this.off(e,a),r(Error(`Timed out waiting for event: ${e}`))},t),a=t=>{clearTimeout(i),this.off(e,a),n(t)};this.on(e,a)})}__test_receive(e){this.handleMessage(e)}emitSliccEventToHost(e,t){if(!this.channelId){a.warn(`Dropping slicc.event before handshake (no channelId yet)`,{name:e});return}this.post({cherry:1,channelId:this.channelId,kind:`slicc.event`,name:e,detail:t})}post(e){this.opts.counterpart.postMessage(e,this.opts.targetOrigin)}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of n)try{e(t)}catch{}}handleSynthetic(e,t){switch(e){case`Target.getTargets`:return Promise.resolve({targetInfos:[{targetId:s,type:`page`,title:`Cherry Host Page`,url:typeof location<`u`?location.href:`about:blank`,attached:!0}]});case`Target.attachToTarget`:return Promise.resolve({sessionId:o});case`Target.detachFromTarget`:case`Target.closeTarget`:return Promise.resolve({success:!0});case`Page.enable`:case`Runtime.enable`:case`DOM.enable`:case`Page.bringToFront`:return Promise.resolve({});case`Page.getFrameTree`:return Promise.resolve({frameTree:{frame:{id:c,loaderId:`cherry-loader`,url:typeof location<`u`?location.href:`about:blank`,securityOrigin:this.opts.targetOrigin,mimeType:`text/html`},childFrames:[]}});case`Runtime.createIsolatedWorld`:return Promise.resolve({executionContextId:1});default:return null}}synthesizeNavigationLifecycle(e,t){let n=e.frameId??c,r=t??(typeof location<`u`?location.href:`about:blank`);this.emit(`Page.frameNavigated`,{frame:{id:n,loaderId:`cherry-loader`,url:r,securityOrigin:this.opts.targetOrigin,mimeType:`text/html`},sessionId:o}),this.emit(`Page.loadEventFired`,{timestamp:Date.now()/1e3,sessionId:o})}handleMessage(e){if(!i(e,{allowOrigins:this.opts.allowOrigins,expectedSource:this.opts.counterpart,channelId:this.channelId})){r(e.data)&&a.warn(`Rejected a cherry envelope (origin/source/channel mismatch)`,{origin:e.origin,allowOrigins:this.opts.allowOrigins});return}let t=e.data;switch(t.kind){case`handshake.welcome`:this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null),this._state=`connected`,this._joinUrl=t.joinUrl??null,a.info(`Cherry handshake complete`,{channelId:this.channelId}),this.connectResolve?.(),this.connectResolve=null;return;case`cdp.response`:{let e=this.pending.get(t.id);if(!e)return;this.pending.delete(t.id),t.error?e.reject(Error(`Cherry CDP error: ${t.error.message} (${t.error.code})`)):e.resolve(t.result??{});return}case`cdp.event`:this.emit(t.method,{...t.params??{},sessionId:t.sessionId??o});return;case`host.event`:this.onHostEvent?.(t.name,t.detail);return;default:return}}},d=e(`cherry-boot`);async function f(){let e=[document.referrer?new URL(document.referrer).origin:location.origin],n=e[0],r=new u({counterpart:window.parent,allowOrigins:e,targetOrigin:n});await r.connect(),d.info(`Cherry transport connected`);let i=r.joinUrl;if(!i)throw Error(`cherry boot: no joinUrl from handshake`);return{transport:r,browser:new t(r),joinUrl:i}}export{f as setupCherryFollower};
1
+ import{I as e}from"./main-BuR1AKEt.js";import{BrowserAPI as t}from"./cdp-84XjVz0a.js";var n=new Set([`handshake.hello`,`handshake.welcome`,`cdp.request`,`cdp.response`,`cdp.event`,`permission.request`,`permission.response`,`host.event`,`slicc.event`]);function r(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.cherry===1&&typeof t.channelId==`string`&&typeof t.kind==`string`&&n.has(t.kind)}function i(e,t){return!(!t.allowOrigins.includes(e.origin)||t.expectedSource!==null&&e.source!==t.expectedSource||!r(e.data)||t.channelId!==null&&e.data.channelId!==t.channelId)}var a=e(`cherry-transport`),o=`cherry-session`,s=`cherry-target`,c=`cherry-frame`,l=3e4,u=class{opts;channelId=null;nextId=1;_state=`disconnected`;pending=new Map;listeners=new Map;connectResolve=null;connectTimer=null;_joinUrl=null;boundHandler=e=>this.handleMessage(e);onHostEvent=null;constructor(e){this.opts=e}get state(){return this._state}get joinUrl(){return this._joinUrl}async connect(e){if(this._state!==`disconnected`)throw Error(`Cannot connect: state is ${this._state}`);this._state=`connecting`,this.channelId=`cherry-${crypto.randomUUID()}`,typeof window<`u`&&window.addEventListener(`message`,this.boundHandler);let t=e?.timeout??l;return new Promise((e,n)=>{this.connectResolve=e,this.connectTimer=setTimeout(()=>{this.connectTimer=null,typeof window<`u`&&window.removeEventListener(`message`,this.boundHandler),this._state=`disconnected`,this.channelId=null,this.connectResolve=null,n(Error(`Cherry handshake timed out after ${t}ms`))},t),this.post({cherry:1,channelId:this.channelId,kind:`handshake.hello`,capabilities:this.opts.capabilities??{navigate:!0,screenshot:!0,openUrl:!0}})})}disconnect(){this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null),typeof window<`u`&&window.removeEventListener(`message`,this.boundHandler);for(let[,e]of this.pending)e.reject(Error(`Cherry transport disconnected`));this.pending.clear(),this._state=`disconnected`,this.channelId=null}async send(e,t,n,r=3e4){if(this._state!==`connected`)throw Error(`Cherry transport is not connected`);let i=this.handleSynthetic(e,t);if(i)return i;let a=this.nextId++,o=await new Promise((n,i)=>{let o=setTimeout(()=>{this.pending.delete(a),i(Error(`Cherry CDP timed out after ${r}ms: ${e}`))},r);this.pending.set(a,{resolve:e=>{clearTimeout(o),n(e)},reject:e=>{clearTimeout(o),i(e)}}),this.post({cherry:1,channelId:this.channelId,kind:`cdp.request`,id:a,method:e,params:t})});return e===`Page.navigate`&&this.synthesizeNavigationLifecycle(o,t?.url),o}on(e,t){let n=this.listeners.get(e);n||(n=new Set,this.listeners.set(e,n)),n.add(t)}off(e,t){let n=this.listeners.get(e);n&&(n.delete(t),n.size===0&&this.listeners.delete(e))}once(e,t=3e4){return new Promise((n,r)=>{let i=setTimeout(()=>{this.off(e,a),r(Error(`Timed out waiting for event: ${e}`))},t),a=t=>{clearTimeout(i),this.off(e,a),n(t)};this.on(e,a)})}__test_receive(e){this.handleMessage(e)}emitSliccEventToHost(e,t){if(!this.channelId){a.warn(`Dropping slicc.event before handshake (no channelId yet)`,{name:e});return}this.post({cherry:1,channelId:this.channelId,kind:`slicc.event`,name:e,detail:t})}post(e){this.opts.counterpart.postMessage(e,this.opts.targetOrigin)}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of n)try{e(t)}catch{}}handleSynthetic(e,t){switch(e){case`Target.getTargets`:return Promise.resolve({targetInfos:[{targetId:s,type:`page`,title:`Cherry Host Page`,url:typeof location<`u`?location.href:`about:blank`,attached:!0}]});case`Target.attachToTarget`:return Promise.resolve({sessionId:o});case`Target.detachFromTarget`:case`Target.closeTarget`:return Promise.resolve({success:!0});case`Page.enable`:case`Runtime.enable`:case`DOM.enable`:case`Page.bringToFront`:return Promise.resolve({});case`Page.getFrameTree`:return Promise.resolve({frameTree:{frame:{id:c,loaderId:`cherry-loader`,url:typeof location<`u`?location.href:`about:blank`,securityOrigin:this.opts.targetOrigin,mimeType:`text/html`},childFrames:[]}});case`Runtime.createIsolatedWorld`:return Promise.resolve({executionContextId:1});default:return null}}synthesizeNavigationLifecycle(e,t){let n=e.frameId??c,r=t??(typeof location<`u`?location.href:`about:blank`);this.emit(`Page.frameNavigated`,{frame:{id:n,loaderId:`cherry-loader`,url:r,securityOrigin:this.opts.targetOrigin,mimeType:`text/html`},sessionId:o}),this.emit(`Page.loadEventFired`,{timestamp:Date.now()/1e3,sessionId:o})}handleMessage(e){if(!i(e,{allowOrigins:this.opts.allowOrigins,expectedSource:this.opts.counterpart,channelId:this.channelId})){r(e.data)&&a.warn(`Rejected a cherry envelope (origin/source/channel mismatch)`,{origin:e.origin,allowOrigins:this.opts.allowOrigins});return}let t=e.data;switch(t.kind){case`handshake.welcome`:this.connectTimer!==null&&(clearTimeout(this.connectTimer),this.connectTimer=null),this._state=`connected`,this._joinUrl=t.joinUrl??null,a.info(`Cherry handshake complete`,{channelId:this.channelId}),this.connectResolve?.(),this.connectResolve=null;return;case`cdp.response`:{let e=this.pending.get(t.id);if(!e)return;this.pending.delete(t.id),t.error?e.reject(Error(`Cherry CDP error: ${t.error.message} (${t.error.code})`)):e.resolve(t.result??{});return}case`cdp.event`:this.emit(t.method,{...t.params??{},sessionId:t.sessionId??o});return;case`host.event`:this.onHostEvent?.(t.name,t.detail);return;default:return}}},d=e(`cherry-boot`);async function f(){let e=[document.referrer?new URL(document.referrer).origin:location.origin],n=e[0],r=new u({counterpart:window.parent,allowOrigins:e,targetOrigin:n});await r.connect(),d.info(`Cherry transport connected`);let i=r.joinUrl;if(!i)throw Error(`cherry boot: no joinUrl from handshake`);return{transport:r,browser:new t(r),joinUrl:i}}export{f as setupCherryFollower};
@@ -1 +1 @@
1
- import{Ct as e,_t as t,h as n,m as r}from"./kernel-worker-CsVAcCa0.js";const i=`/.slicc-migrated`;async function a(e){let{manifest:t,source:n,target:r,logger:i}=e,a={fileCount:t.fileCount,totalBytes:t.totalBytes},c=t.entries.filter(e=>e.type===`dir`).sort((e,t)=>o(e.path)-o(t.path)),l=t.entries.filter(e=>e.type===`file`),u=t.entries.filter(e=>e.type===`symlink`);for(let e of c)try{await r.mkdir(e.path)}catch(e){return i?.warn?.(`[migration] mkdir failed during C2 copy`,{copiedFiles:0,stage:`mkdir`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:0,stage:`mkdir`}}let d=0;try{e.onProgress?.({copied:0,total:a.fileCount})}catch{}for(let t of l){if(t.type!==`file`)continue;let o;try{o=await n.readFile(t.path)}catch(e){return i?.warn?.(`[migration] legacy read failed during C2 copy`,{copiedFiles:d,stage:`read`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`read`}}try{await r.writeFile(t.path,o)}catch(e){return i?.warn?.(`[migration] OPFS write failed during C2 copy`,{copiedFiles:d,stage:`writeFile`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`writeFile`}}d++;try{e.onProgress?.({copied:d,total:a.fileCount})}catch{}}let f=0;for(let e of u)if(e.type===`symlink`)try{await r.symlink(e.target,e.path)}catch(e){if(s(e)===`EEXIST`){f++;continue}return i?.warn?.(`[migration] symlink failed during C2 copy`,{copiedFiles:d,stage:`symlink`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`symlink`}}if(f>0&&i?.info?.(`[migration] tolerated pre-existing symlinks during C2 re-run`,{skipped:f,symlinks:t.symlinkCount}),e.flushBeforeSentinel)try{await e.flushBeforeSentinel()}catch(e){return i?.warn?.(`[migration] sidecar flush failed before parity`,{code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`writeFile`}}let p=await e.countOpfsFiles(),m=p.totalBytes-a.totalBytes;return p.fileCount===a.fileCount?(m!==0&&i?.info?.(`[migration] byte drift tolerated (count parity matched)`,{expectedBytes:a.totalBytes,actualBytes:p.totalBytes,byteDelta:m}),await e.writeSentinel(),i?.info?.(`[migration] C2 copy complete, sentinel written`,{files:p.fileCount,totalBytes:p.totalBytes,expectedBytes:a.totalBytes,byteDelta:m,symlinks:t.symlinkCount,dirs:t.dirCount}),{kind:`success`,fileCount:p.fileCount,totalBytes:p.totalBytes}):(i?.warn?.(`[migration] parity mismatch — sentinel NOT written`,{expectedFiles:a.fileCount,actualFiles:p.fileCount,expectedBytes:a.totalBytes,actualBytes:p.totalBytes,byteDelta:m}),{kind:`parity-mismatch`,expected:a,actual:p})}function o(e){if(e===`/`)return 0;let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===47&&t++;return t}function s(e){let t=e?.code;return typeof t==`string`?t:void 0}const c=t(`migration-guard`);function l(){let e=globalThis;return{hasExtensionRuntime:typeof e.chrome?.runtime?.id==`string`,hasDocument:e.document!==void 0,pathname:e.window?.location?.pathname??``}}function u(e){return!e.hasExtensionRuntime||!e.hasDocument?!1:!/offscreen\.html$/.test(e.pathname)}var d=class extends Error{constructor(e){super(`runLegacyMigrationFromVfs invoked from the chrome extension side panel (pathname='${e.pathname}'). Migration must run only in the offscreen document; the panel should wait on the kernel-ready RPC (OffscreenClient.onReady).`),this.name=`MigrationFromSidePanelError`}};function f(e=l()){if(u(e)){let t=new d(e);throw c.error(t.message),t}}async function p(e,t={}){f(t.callerEnv);let r=t.logger,o=await n({sentinelExists:async()=>{try{return await e.stat(i),!0}catch{return!1}},probeLegacyDbExists:t.probeLegacyDbExists??y,lfsFactory:t.legacyLfsFactory??v,logger:r});if(o.kind===`sentinel-present`)return{kind:`sentinel-present`};if(o.kind===`legacy-absent`)return{kind:`legacy-absent`};let s=await(t.legacyReaderFactory??_)(),c=m(e);return{kind:`copied`,result:await a({manifest:o.manifest,source:s,target:c,countOpfsFiles:()=>g(e,o.manifest),flushBeforeSentinel:()=>e.flush().catch(()=>{}),writeSentinel:async()=>{await e.writeFile(i,``),await e.flush().catch(()=>{})},onProgress:t.onProgress,logger:r})}}function m(e){return{mkdir:async t=>{await e.mkdir(t,{recursive:!0})},writeFile:async(t,n)=>{await e.writeFile(t,n)},symlink:async(t,n)=>{try{await e.symlink(t,n);return}catch(e){if(h(e)!==`EEXIST`)throw e}let r;try{r=await e.readlink(n)}catch{}r!==t&&(await e.rm(n,{recursive:!0}),await e.symlink(t,n))}}}function h(e){let t=e?.code;return typeof t==`string`?t:void 0}async function g(e,t){let n=0,r=0;for(let i of t.entries){if(i.type!==`file`)continue;let t;try{t=await e.lstat(i.path)}catch{continue}t.type===`file`&&(n++,r+=t.size??0)}return{fileCount:n,totalBytes:r}}async function _(){let t=(await import(`./src-Duh03CdO.js`).then(t=>e(t.default,1))).default,n=new t(r).promises;return{readFile:async e=>{let t=await n.readFile(e);return t instanceof Uint8Array?t:new TextEncoder().encode(String(t))}}}async function v(){let t=(await import(`./src-Duh03CdO.js`).then(t=>e(t.default,1))).default;return new t(r).promises}async function y(){try{let e=globalThis.indexedDB;if(!e)return!1;let t=e.databases;return typeof t==`function`?(await t.call(e)).some(e=>e.name===r):!0}catch{return!0}}export{p as runLegacyMigrationFromVfs};
1
+ import{Ct as e,_t as t,h as n,m as r}from"./kernel-worker-jD7bcOG1.js";const i=`/.slicc-migrated`;async function a(e){let{manifest:t,source:n,target:r,logger:i}=e,a={fileCount:t.fileCount,totalBytes:t.totalBytes},c=t.entries.filter(e=>e.type===`dir`).sort((e,t)=>o(e.path)-o(t.path)),l=t.entries.filter(e=>e.type===`file`),u=t.entries.filter(e=>e.type===`symlink`);for(let e of c)try{await r.mkdir(e.path)}catch(e){return i?.warn?.(`[migration] mkdir failed during C2 copy`,{copiedFiles:0,stage:`mkdir`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:0,stage:`mkdir`}}let d=0;try{e.onProgress?.({copied:0,total:a.fileCount})}catch{}for(let t of l){if(t.type!==`file`)continue;let o;try{o=await n.readFile(t.path)}catch(e){return i?.warn?.(`[migration] legacy read failed during C2 copy`,{copiedFiles:d,stage:`read`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`read`}}try{await r.writeFile(t.path,o)}catch(e){return i?.warn?.(`[migration] OPFS write failed during C2 copy`,{copiedFiles:d,stage:`writeFile`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`writeFile`}}d++;try{e.onProgress?.({copied:d,total:a.fileCount})}catch{}}let f=0;for(let e of u)if(e.type===`symlink`)try{await r.symlink(e.target,e.path)}catch(e){if(s(e)===`EEXIST`){f++;continue}return i?.warn?.(`[migration] symlink failed during C2 copy`,{copiedFiles:d,stage:`symlink`,code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`symlink`}}if(f>0&&i?.info?.(`[migration] tolerated pre-existing symlinks during C2 re-run`,{skipped:f,symlinks:t.symlinkCount}),e.flushBeforeSentinel)try{await e.flushBeforeSentinel()}catch(e){return i?.warn?.(`[migration] sidecar flush failed before parity`,{code:s(e)}),{kind:`copy-error`,expected:a,copiedFiles:d,stage:`writeFile`}}let p=await e.countOpfsFiles(),m=p.totalBytes-a.totalBytes;return p.fileCount===a.fileCount?(m!==0&&i?.info?.(`[migration] byte drift tolerated (count parity matched)`,{expectedBytes:a.totalBytes,actualBytes:p.totalBytes,byteDelta:m}),await e.writeSentinel(),i?.info?.(`[migration] C2 copy complete, sentinel written`,{files:p.fileCount,totalBytes:p.totalBytes,expectedBytes:a.totalBytes,byteDelta:m,symlinks:t.symlinkCount,dirs:t.dirCount}),{kind:`success`,fileCount:p.fileCount,totalBytes:p.totalBytes}):(i?.warn?.(`[migration] parity mismatch — sentinel NOT written`,{expectedFiles:a.fileCount,actualFiles:p.fileCount,expectedBytes:a.totalBytes,actualBytes:p.totalBytes,byteDelta:m}),{kind:`parity-mismatch`,expected:a,actual:p})}function o(e){if(e===`/`)return 0;let t=0;for(let n=0;n<e.length;n++)e.charCodeAt(n)===47&&t++;return t}function s(e){let t=e?.code;return typeof t==`string`?t:void 0}const c=t(`migration-guard`);function l(){let e=globalThis;return{hasExtensionRuntime:typeof e.chrome?.runtime?.id==`string`,hasDocument:e.document!==void 0,pathname:e.window?.location?.pathname??``}}function u(e){return!e.hasExtensionRuntime||!e.hasDocument?!1:!/offscreen\.html$/.test(e.pathname)}var d=class extends Error{constructor(e){super(`runLegacyMigrationFromVfs invoked from the chrome extension side panel (pathname='${e.pathname}'). Migration must run only in the offscreen document; the panel should wait on the kernel-ready RPC (OffscreenClient.onReady).`),this.name=`MigrationFromSidePanelError`}};function f(e=l()){if(u(e)){let t=new d(e);throw c.error(t.message),t}}async function p(e,t={}){f(t.callerEnv);let r=t.logger,o=await n({sentinelExists:async()=>{try{return await e.stat(i),!0}catch{return!1}},probeLegacyDbExists:t.probeLegacyDbExists??y,lfsFactory:t.legacyLfsFactory??v,logger:r});if(o.kind===`sentinel-present`)return{kind:`sentinel-present`};if(o.kind===`legacy-absent`)return{kind:`legacy-absent`};let s=await(t.legacyReaderFactory??_)(),c=m(e);return{kind:`copied`,result:await a({manifest:o.manifest,source:s,target:c,countOpfsFiles:()=>g(e,o.manifest),flushBeforeSentinel:()=>e.flush().catch(()=>{}),writeSentinel:async()=>{await e.writeFile(i,``),await e.flush().catch(()=>{})},onProgress:t.onProgress,logger:r})}}function m(e){return{mkdir:async t=>{await e.mkdir(t,{recursive:!0})},writeFile:async(t,n)=>{await e.writeFile(t,n)},symlink:async(t,n)=>{try{await e.symlink(t,n);return}catch(e){if(h(e)!==`EEXIST`)throw e}let r;try{r=await e.readlink(n)}catch{}r!==t&&(await e.rm(n,{recursive:!0}),await e.symlink(t,n))}}}function h(e){let t=e?.code;return typeof t==`string`?t:void 0}async function g(e,t){let n=0,r=0;for(let i of t.entries){if(i.type!==`file`)continue;let t;try{t=await e.lstat(i.path)}catch{continue}t.type===`file`&&(n++,r+=t.size??0)}return{fileCount:n,totalBytes:r}}async function _(){let t=(await import(`./src-Dt77-cQy.js`).then(t=>e(t.default,1))).default,n=new t(r).promises;return{readFile:async e=>{let t=await n.readFile(e);return t instanceof Uint8Array?t:new TextEncoder().encode(String(t))}}}async function v(){let t=(await import(`./src-Dt77-cQy.js`).then(t=>e(t.default,1))).default;return new t(r).promises}async function y(){try{let e=globalThis.indexedDB;if(!e)return!1;let t=e.databases;return typeof t==`function`?(await t.call(e)).some(e=>e.name===r):!0}catch{return!0}}export{p as runLegacyMigrationFromVfs};
@@ -1,4 +1,4 @@
1
- import{$ as e,R as t,Z as n,_ as r,et as i,it as a,y as o}from"./main-lrS_5wG0.js";import{t as s}from"./sanitize-unicode-DmIE6hZJ.js";import{t as c}from"./hash-yQufAZII.js";var l=Object.prototype.hasOwnProperty;function u(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!l.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}var d={eu:`https://api.mistral.ai`};function f(e){let t=e.serverURL,n={};t||=d[e.server??`eu`]||``;let r=u(t)(n);return new URL(r)}var p={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function m(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function h(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function g(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}var _=(e,t)=>t==null?fetch(e):fetch(e,t),v=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||_}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},ee=/\s*;\s*/g;function te(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(ee);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(ee),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}var ne=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!ne.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function re(e,t,n){return y(e,t)&&te(e,n)}function ie(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function ae(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var se=class{beforeRequest(e,t){let n=`mistral-client-typescript/${p.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}},ce=`x-model-deprecation-timestamp`,le=class{afterSuccess(e,t){return t.headers.has(ce)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(ce)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function ue(e){let t=new se;e.registerBeforeRequestHook(t);let n=new le;e.registerAfterSuccessHook(n)}var de=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);ue(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},fe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},pe=class extends fe{name=`UnexpectedClientError`},me=class extends fe{name=`InvalidRequestError`},he=class extends fe{name=`RequestAbortedError`},ge=class extends fe{name=`RequestTimeoutError`},_e=class extends fe{name=`ConnectionError`};function ve(e){return{ok:!0,value:e}}function ye(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}var be=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var xe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Se=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ce={};function we(e){return e&&Object.assign(Ce,e),Ce}function Te(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ee(e,t){return typeof t==`bigint`?t.toString():t}function De(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Oe(e){return e==null}function ke(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ae(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var je=Symbol(`evaluating`);function Me(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==je)return r===void 0&&(r=je,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ze=De(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}var He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ee,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
1
+ import{$ as e,R as t,Z as n,_ as r,et as i,it as a,y as o}from"./main-BuR1AKEt.js";import{t as s}from"./sanitize-unicode-DmIE6hZJ.js";import{t as c}from"./hash-yQufAZII.js";var l=Object.prototype.hasOwnProperty;function u(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!l.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}var d={eu:`https://api.mistral.ai`};function f(e){let t=e.serverURL,n={};t||=d[e.server??`eu`]||``;let r=u(t)(n);return new URL(r)}var p={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function m(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function h(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function g(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}var _=(e,t)=>t==null?fetch(e):fetch(e,t),v=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||_}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},ee=/\s*;\s*/g;function te(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(ee);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(ee),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}var ne=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!ne.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function re(e,t,n){return y(e,t)&&te(e,n)}function ie(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function ae(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var se=class{beforeRequest(e,t){let n=`mistral-client-typescript/${p.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}},ce=`x-model-deprecation-timestamp`,le=class{afterSuccess(e,t){return t.headers.has(ce)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(ce)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function ue(e){let t=new se;e.registerBeforeRequestHook(t);let n=new le;e.registerAfterSuccessHook(n)}var de=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);ue(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},fe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},pe=class extends fe{name=`UnexpectedClientError`},me=class extends fe{name=`InvalidRequestError`},he=class extends fe{name=`RequestAbortedError`},ge=class extends fe{name=`RequestTimeoutError`},_e=class extends fe{name=`ConnectionError`};function ve(e){return{ok:!0,value:e}}function ye(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}var be=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var xe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Se=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Ce={};function we(e){return e&&Object.assign(Ce,e),Ce}function Te(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ee(e,t){return typeof t==`bigint`?t.toString():t}function De(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Oe(e){return e==null}function ke(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ae(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var je=Symbol(`evaluating`);function Me(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==je)return r===void 0&&(r=je,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ze=De(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}var He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ee,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
2
2
  `)}var pt=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new xe;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,we())));throw Le(t,i?.callee),t}return o.value},mt=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,we())));throw Le(t,i?.callee),t}return o.value},ht=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xe;return a.issues.length?{success:!1,error:new(e??st)(a.issues.map(e=>rt(e,i,we())))}:{success:!0,data:a.value}},gt=ht(ct),_t=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rt(e,i,we())))}:{success:!0,data:a.value}},vt=_t(ct),yt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pt(e)(t,n,i)},bt=e=>(t,n,r)=>pt(e)(t,n,r),xt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mt(e)(t,n,i)},St=e=>async(t,n,r)=>mt(e)(t,n,r),Ct=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ht(e)(t,n,i)},wt=e=>(t,n,r)=>ht(e)(t,n,r),Tt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _t(e)(t,n,i)},Et=e=>async(t,n,r)=>_t(e)(t,n,r),Dt=/^[cC][^\s-]{8,}$/,Ot=/^[0-9a-z]+$/,kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,At=/^[0-9a-vA-V]{20}$/,jt=/^[A-Za-z0-9]{27}$/,Mt=/^[a-zA-Z0-9_-]{21}$/,Nt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Pt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Rt(){return new RegExp(Lt,`u`)}var zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wt=/^[A-Za-z0-9_-]*$/,Gt=/^\+[1-9]\d{6,14}$/,Kt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,qt=RegExp(`^${Kt}$`);function Jt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yt(e){return RegExp(`^${Jt(e)}$`)}function Xt(e){let t=Jt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Kt}T(?:${r})$`)}var Zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^[^A-Z]*$/,nn=/^[^a-z]*$/,rn=x(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),an={number:`number`,bigint:`bigint`,object:`date`},on=x(`$ZodCheckLessThan`,(e,t)=>{rn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sn=x(`$ZodCheckGreaterThan`,(e,t)=>{rn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=x(`$ZodCheckMultipleOf`,(e,t)=>{rn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ae(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=x(`$ZodCheckNumberFormat`,(e,t)=>{rn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ke[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Qt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=x(`$ZodCheckMaxLength`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=it(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=x(`$ZodCheckMinLength`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=it(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=x(`$ZodCheckLengthEquals`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=it(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=x(`$ZodCheckStringFormat`,(e,t)=>{var n,r;rn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=x(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=x(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),gn=x(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=nn,pn.init(e,t)}),_n=x(`$ZodCheckIncludes`,(e,t)=>{rn.init(e,t);let n=Ue(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=x(`$ZodCheckStartsWith`,(e,t)=>{rn.init(e,t);let n=RegExp(`^${Ue(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=x(`$ZodCheckEndsWith`,(e,t)=>{rn.init(e,t);let n=RegExp(`.*${Ue(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=x(`$ZodCheckOverwrite`,(e,t)=>{rn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
4
4
  `))}},Sn={major:4,minor:3,patch:6},Cn=x(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=et(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new xe;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=et(e,t))});else{if(e.issues.length===t)continue;r||=et(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(et(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new xe;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new xe;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Me(e,`~standard`,()=>({validate:t=>{try{let n=gt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return vt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),wn=x(`$ZodString`,(e,t)=>{Cn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Tn=x(`$ZodStringFormat`,(e,t)=>{pn.init(e,t),wn.init(e,t)}),En=x(`$ZodGUID`,(e,t)=>{t.pattern??=Pt,Tn.init(e,t)}),Dn=x(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();Tn.init(e,t)}),On=x(`$ZodEmail`,(e,t)=>{t.pattern??=It,Tn.init(e,t)}),kn=x(`$ZodURL`,(e,t)=>{Tn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),An=x(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),Tn.init(e,t)}),jn=x(`$ZodNanoID`,(e,t)=>{t.pattern??=Mt,Tn.init(e,t)}),Mn=x(`$ZodCUID`,(e,t)=>{t.pattern??=Dt,Tn.init(e,t)}),Nn=x(`$ZodCUID2`,(e,t)=>{t.pattern??=Ot,Tn.init(e,t)}),Pn=x(`$ZodULID`,(e,t)=>{t.pattern??=kt,Tn.init(e,t)}),Fn=x(`$ZodXID`,(e,t)=>{t.pattern??=At,Tn.init(e,t)}),In=x(`$ZodKSUID`,(e,t)=>{t.pattern??=jt,Tn.init(e,t)}),Ln=x(`$ZodISODateTime`,(e,t)=>{t.pattern??=Xt(t),Tn.init(e,t)}),Rn=x(`$ZodISODate`,(e,t)=>{t.pattern??=qt,Tn.init(e,t)}),zn=x(`$ZodISOTime`,(e,t)=>{t.pattern??=Yt(t),Tn.init(e,t)}),Bn=x(`$ZodISODuration`,(e,t)=>{t.pattern??=Nt,Tn.init(e,t)}),Vn=x(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,Tn.init(e,t),e._zod.bag.format=`ipv4`}),Hn=x(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,Tn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Un=x(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,Tn.init(e,t)}),Wn=x(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,Tn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Gn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Kn=x(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,Tn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Gn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function qn(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Gn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Jn=x(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,Tn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Yn=x(`$ZodE164`,(e,t)=>{t.pattern??=Gt,Tn.init(e,t)});function Xn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Zn=x(`$ZodJWT`,(e,t)=>{Tn.init(e,t),e._zod.check=n=>{Xn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Qn=x(`$ZodNumber`,(e,t)=>{Cn.init(e,t),e._zod.pattern=e._zod.bag.pattern??$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$n=x(`$ZodNumberFormat`,(e,t)=>{ln.init(e,t),Qn.init(e,t)}),er=x(`$ZodBoolean`,(e,t)=>{Cn.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),tr=x(`$ZodAny`,(e,t)=>{Cn.init(e,t),e._zod.parse=e=>e}),nr=x(`$ZodUnknown`,(e,t)=>{Cn.init(e,t),e._zod.parse=e=>e}),rr=x(`$ZodNever`,(e,t)=>{Cn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ir=x(`$ZodVoid`,(e,t)=>{Cn.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),ar=x(`$ZodDate`,(e,t)=>{Cn.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function or(e,t,n){e.issues.length&&t.issues.push(...tt(n,e.issues)),t.value[n]=e.value}var sr=x(`$ZodArray`,(e,t)=>{Cn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>or(t,n,e))):or(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cr(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...tt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function lr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ur(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cr(e,n,i,t,u))):cr(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var dr=x(`$ZodObject`,(e,t)=>{if(Cn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=De(()=>lr(t));Me(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Re,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>cr(n,t,e,s,r))):cr(i,t,e,s,r)}return i?ur(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),fr=x(`$ZodObjectJIT`,(e,t)=>{dr.init(e,t);let n=e._zod.parse,r=De(()=>lr(t)),i=e=>{let t=new xn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Fe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Fe(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
@@ -1,4 +1,4 @@
1
- import{I as e,M as t,P as n,Q as r,Y as i,Z as a,nt as o,u as s}from"./kernel-worker-CsVAcCa0.js";import{t as c}from"./hash-yQufAZII.js";const l=Object.prototype.hasOwnProperty;function u(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!l.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}const d={eu:`https://api.mistral.ai`};function f(e){let t=e.serverURL,n={};t||=d[e.server??`eu`]||``;let r=u(t)(n);return new URL(r)}const p={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function m(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function h(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function g(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}const _=(e,t)=>t==null?fetch(e):fetch(e,t);var v=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||_}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}};const ee=/\s*;\s*/g;function te(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(ee);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(ee),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}const ne=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!ne.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function re(e,t,n){return y(e,t)&&te(e,n)}function ie(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function ae(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var se=class{beforeRequest(e,t){let n=`mistral-client-typescript/${p.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}};const ce=`x-model-deprecation-timestamp`;var le=class{afterSuccess(e,t){return t.headers.has(ce)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(ce)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function ue(e){let t=new se;e.registerBeforeRequestHook(t);let n=new le;e.registerAfterSuccessHook(n)}var de=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);ue(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},fe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},pe=class extends fe{name=`UnexpectedClientError`},me=class extends fe{name=`InvalidRequestError`},he=class extends fe{name=`RequestAbortedError`},ge=class extends fe{name=`RequestTimeoutError`},_e=class extends fe{name=`ConnectionError`};function ve(e){return{ok:!0,value:e}}function ye(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}const be=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var xe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Se=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const Ce={};function we(e){return e&&Object.assign(Ce,e),Ce}function Te(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ee(e,t){return typeof t==`bigint`?t.toString():t}function De(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Oe(e){return e==null}function ke(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ae(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const je=Symbol(`evaluating`);function Me(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==je)return r===void 0&&(r=je,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ze=De(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}const He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ee,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
1
+ import{I as e,M as t,P as n,Q as r,Y as i,Z as a,nt as o,u as s}from"./kernel-worker-jD7bcOG1.js";import{t as c}from"./hash-yQufAZII.js";const l=Object.prototype.hasOwnProperty;function u(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!l.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}const d={eu:`https://api.mistral.ai`};function f(e){let t=e.serverURL,n={};t||=d[e.server??`eu`]||``;let r=u(t)(n);return new URL(r)}const p={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function m(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function h(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function g(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}const _=(e,t)=>t==null?fetch(e):fetch(e,t);var v=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||_}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}};const ee=/\s*;\s*/g;function te(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(ee);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(ee),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}const ne=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!ne.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function re(e,t,n){return y(e,t)&&te(e,n)}function ie(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function ae(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var se=class{beforeRequest(e,t){let n=`mistral-client-typescript/${p.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}};const ce=`x-model-deprecation-timestamp`;var le=class{afterSuccess(e,t){return t.headers.has(ce)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(ce)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function ue(e){let t=new se;e.registerBeforeRequestHook(t);let n=new le;e.registerAfterSuccessHook(n)}var de=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);ue(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},fe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},pe=class extends fe{name=`UnexpectedClientError`},me=class extends fe{name=`InvalidRequestError`},he=class extends fe{name=`RequestAbortedError`},ge=class extends fe{name=`RequestTimeoutError`},_e=class extends fe{name=`ConnectionError`};function ve(e){return{ok:!0,value:e}}function ye(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}const be=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var xe=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Se=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const Ce={};function we(e){return e&&Object.assign(Ce,e),Ce}function Te(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ee(e,t){return typeof t==`bigint`?t.toString():t}function De(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Oe(e){return e==null}function ke(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ae(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const je=Symbol(`evaluating`);function Me(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==je)return r===void 0&&(r=je,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const ze=De(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}const He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}const ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ee,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
2
2
  `)}const pt=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new xe;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,we())));throw Le(t,i?.callee),t}return o.value},mt=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,we())));throw Le(t,i?.callee),t}return o.value},ht=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new xe;return a.issues.length?{success:!1,error:new(e??st)(a.issues.map(e=>rt(e,i,we())))}:{success:!0,data:a.value}},gt=ht(ct),_t=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rt(e,i,we())))}:{success:!0,data:a.value}},vt=_t(ct),yt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pt(e)(t,n,i)},bt=e=>(t,n,r)=>pt(e)(t,n,r),xt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mt(e)(t,n,i)},St=e=>async(t,n,r)=>mt(e)(t,n,r),Ct=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ht(e)(t,n,i)},wt=e=>(t,n,r)=>ht(e)(t,n,r),Tt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _t(e)(t,n,i)},Et=e=>async(t,n,r)=>_t(e)(t,n,r),Dt=/^[cC][^\s-]{8,}$/,Ot=/^[0-9a-z]+$/,kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,At=/^[0-9a-vA-V]{20}$/,jt=/^[A-Za-z0-9]{27}$/,Mt=/^[a-zA-Z0-9_-]{21}$/,Nt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Pt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Lt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Rt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ht=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ut=/^[A-Za-z0-9_-]*$/,Wt=/^\+[1-9]\d{6,14}$/,Gt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Kt=RegExp(`^${Gt}$`);function qt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Jt(e){return RegExp(`^${qt(e)}$`)}function Yt(e){let t=qt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Gt}T(?:${r})$`)}const Xt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Zt=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,$t=/^(?:true|false)$/i,en=/^[^A-Z]*$/,tn=/^[^a-z]*$/,nn=x(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rn={number:`number`,bigint:`bigint`,object:`date`},an=x(`$ZodCheckLessThan`,(e,t)=>{nn.init(e,t);let n=rn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),on=x(`$ZodCheckGreaterThan`,(e,t)=>{nn.init(e,t);let n=rn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sn=x(`$ZodCheckMultipleOf`,(e,t)=>{nn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ae(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cn=x(`$ZodCheckNumberFormat`,(e,t)=>{nn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ke[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Zt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ln=x(`$ZodCheckMaxLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=it(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),un=x(`$ZodCheckMinLength`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=it(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=x(`$ZodCheckLengthEquals`,(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Oe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=it(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fn=x(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),pn=x(`$ZodCheckRegex`,(e,t)=>{fn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mn=x(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=en,fn.init(e,t)}),hn=x(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tn,fn.init(e,t)}),gn=x(`$ZodCheckIncludes`,(e,t)=>{nn.init(e,t);let n=Ue(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_n=x(`$ZodCheckStartsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`^${Ue(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vn=x(`$ZodCheckEndsWith`,(e,t)=>{nn.init(e,t);let n=RegExp(`.*${Ue(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yn=x(`$ZodCheckOverwrite`,(e,t)=>{nn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var bn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
4
4
  `))}};const xn={major:4,minor:3,patch:6},Sn=x(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=et(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new xe;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=et(e,t))});else{if(e.issues.length===t)continue;r||=et(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(et(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new xe;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new xe;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Me(e,`~standard`,()=>({validate:t=>{try{let n=gt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return vt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Cn=x(`$ZodString`,(e,t)=>{Sn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Xt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),wn=x(`$ZodStringFormat`,(e,t)=>{fn.init(e,t),Cn.init(e,t)}),Tn=x(`$ZodGUID`,(e,t)=>{t.pattern??=Pt,wn.init(e,t)}),En=x(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();wn.init(e,t)}),Dn=x(`$ZodEmail`,(e,t)=>{t.pattern??=It,wn.init(e,t)}),On=x(`$ZodURL`,(e,t)=>{wn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),kn=x(`$ZodEmoji`,(e,t)=>{t.pattern??=Lt(),wn.init(e,t)}),An=x(`$ZodNanoID`,(e,t)=>{t.pattern??=Mt,wn.init(e,t)}),jn=x(`$ZodCUID`,(e,t)=>{t.pattern??=Dt,wn.init(e,t)}),Mn=x(`$ZodCUID2`,(e,t)=>{t.pattern??=Ot,wn.init(e,t)}),Nn=x(`$ZodULID`,(e,t)=>{t.pattern??=kt,wn.init(e,t)}),Pn=x(`$ZodXID`,(e,t)=>{t.pattern??=At,wn.init(e,t)}),Fn=x(`$ZodKSUID`,(e,t)=>{t.pattern??=jt,wn.init(e,t)}),In=x(`$ZodISODateTime`,(e,t)=>{t.pattern??=Yt(t),wn.init(e,t)}),Ln=x(`$ZodISODate`,(e,t)=>{t.pattern??=Kt,wn.init(e,t)}),Rn=x(`$ZodISOTime`,(e,t)=>{t.pattern??=Jt(t),wn.init(e,t)}),zn=x(`$ZodISODuration`,(e,t)=>{t.pattern??=Nt,wn.init(e,t)}),Bn=x(`$ZodIPv4`,(e,t)=>{t.pattern??=Rt,wn.init(e,t),e._zod.bag.format=`ipv4`}),Vn=x(`$ZodIPv6`,(e,t)=>{t.pattern??=zt,wn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Hn=x(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Bt,wn.init(e,t)}),Un=x(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Vt,wn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Wn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Gn=x(`$ZodBase64`,(e,t)=>{t.pattern??=Ht,wn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Wn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Kn(e){if(!Ut.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Wn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const qn=x(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ut,wn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Kn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Jn=x(`$ZodE164`,(e,t)=>{t.pattern??=Wt,wn.init(e,t)});function Yn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Xn=x(`$ZodJWT`,(e,t)=>{wn.init(e,t),e._zod.check=n=>{Yn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Zn=x(`$ZodNumber`,(e,t)=>{Sn.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Qn=x(`$ZodNumberFormat`,(e,t)=>{cn.init(e,t),Zn.init(e,t)}),$n=x(`$ZodBoolean`,(e,t)=>{Sn.init(e,t),e._zod.pattern=$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),er=x(`$ZodAny`,(e,t)=>{Sn.init(e,t),e._zod.parse=e=>e}),tr=x(`$ZodUnknown`,(e,t)=>{Sn.init(e,t),e._zod.parse=e=>e}),nr=x(`$ZodNever`,(e,t)=>{Sn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),rr=x(`$ZodVoid`,(e,t)=>{Sn.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),ir=x(`$ZodDate`,(e,t)=>{Sn.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function ar(e,t,n){e.issues.length&&t.issues.push(...tt(n,e.issues)),t.value[n]=e.value}const or=x(`$ZodArray`,(e,t)=>{Sn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>ar(t,n,e))):ar(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function sr(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...tt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function cr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function lr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>sr(e,n,i,t,u))):sr(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const ur=x(`$ZodObject`,(e,t)=>{if(Sn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=De(()=>cr(t));Me(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Re,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>sr(n,t,e,s,r))):sr(i,t,e,s,r)}return i?lr(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),dr=x(`$ZodObjectJIT`,(e,t)=>{ur.init(e,t);let n=e._zod.parse,r=De(()=>cr(t)),i=e=>{let t=new bn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Fe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Fe(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
@@ -1 +1 @@
1
- import{rt as e,vt as t}from"./kernel-worker-CsVAcCa0.js";import{t as n}from"./common-Bes6Rp5g.js";var r=t((t=>{var n=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,s.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_diagnosticprinter_free(e,0)}finish(){let e,t;try{let i=this.__destroy_into_raw(),a=j.diagnosticprinter_finish(i);var n=a[0],r=a[1];if(a[3])throw n=0,r=0,C(a[2]);return e=n,t=r,g(n,r)}finally{j.__wbindgen_free(e,t,1)}}constructor(e,t){let n=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),r=D,i=S(t,j.__wbindgen_malloc,j.__wbindgen_realloc),a=D,o=j.diagnosticprinter_new(n,r,i,a);return this.__wbg_ptr=o>>>0,s.register(this,this.__wbg_ptr,this),this}print_simple(e){let t=j.diagnosticprinter_print_simple(this.__wbg_ptr,e);if(t[1])throw C(t[0])}print_verbose(e){let t=j.diagnosticprinter_print_verbose(this.__wbg_ptr,e);if(t[1])throw C(t[0])}};Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free),t.DiagnosticPrinter=n;var r=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,c.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_memoryfilesystem_free(e,0)}insert(e,t){let n=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),r=D,i=x(t,j.__wbindgen_malloc),a=D;j.memoryfilesystem_insert(this.__wbg_ptr,n,r,i,a)}constructor(){let e=j.memoryfilesystem_new();return this.__wbg_ptr=e>>>0,c.register(this,this.__wbg_ptr,this),this}remove(e){let t=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),n=D;j.memoryfilesystem_remove(this.__wbg_ptr,t,n)}};Symbol.dispose&&(r.prototype[Symbol.dispose]=r.prototype.free),t.MemoryFileSystem=r;var i=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,l.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,l.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_workspace_free(e,0)}changeFile(e){let t=j.workspace_changeFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}closeFile(e){let t=j.workspace_closeFile(this.__wbg_ptr,e);if(t[1])throw C(t[0])}dropPattern(e){let t=j.workspace_dropPattern(this.__wbg_ptr,e);if(t[1])throw C(t[0])}fileExists(e){let t=j.workspace_fileExists(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return t[0]!==0}fileFeatures(e){let t=j.workspace_fileFeatures(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}fixFile(e){let t=j.workspace_fixFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatFile(e){let t=j.workspace_formatFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatOnType(e){let t=j.workspace_formatOnType(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatRange(e){let t=j.workspace_formatRange(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getControlFlowGraph(e){let t,n;try{let a=j.workspace_getControlFlowGraph(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getFileContent(e){let t,n;try{let a=j.workspace_getFileContent(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getFormatterIr(e){let t,n;try{let a=j.workspace_getFormatterIr(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getModuleGraph(e){let t=j.workspace_getModuleGraph(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getRegisteredTypes(e){let t,n;try{let a=j.workspace_getRegisteredTypes(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getSemanticModel(e){let t,n;try{let a=j.workspace_getSemanticModel(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getSyntaxTree(e){let t=j.workspace_getSyntaxTree(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getTypeInfo(e){let t,n;try{let a=j.workspace_getTypeInfo(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}isPathIgnored(e){let t=j.workspace_isPathIgnored(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return t[0]!==0}constructor(){let e=j.workspace_new();return this.__wbg_ptr=e>>>0,l.register(this,this.__wbg_ptr,this),this}openFile(e){let t=j.workspace_openFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}openProject(e){let t=j.workspace_openProject(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}parsePattern(e){let t=j.workspace_parsePattern(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}pullActions(e){let t=j.workspace_pullActions(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}pullDiagnostics(e){let t=j.workspace_pullDiagnostics(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}rename(e){let t=j.workspace_rename(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}scanProject(e){let t=j.workspace_scanProject(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}searchPattern(e){let t=j.workspace_searchPattern(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}updateModuleGraph(e){let t=j.workspace_updateModuleGraph(this.__wbg_ptr,e);if(t[1])throw C(t[0])}updateSettings(e){let t=j.workspace_updateSettings(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}static withFileSystem(t){d(t,r);let n=j.workspace_withFileSystem(t.__wbg_ptr);return e.__wrap(n)}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free),t.Workspace=i;function a(){j.main()}t.main=a;function o(){return{__proto__:null,"./biome_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(g(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=S(String(t),j.__wbindgen_malloc,j.__wbindgen_realloc),r=D;h().setInt32(e+4,r,!0),h().setInt32(e+0,n,!0)},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;h().setBigInt64(e+8,b(r)?BigInt(0):r,!0),h().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return b(n)?16777215:+!!n},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=S(f(t),j.__wbindgen_malloc,j.__wbindgen_realloc),r=D;h().setInt32(e+4,r,!0),h().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;h().setFloat64(e+8,b(r)?0:r,!0),h().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=b(r)?0:S(r,j.__wbindgen_malloc,j.__wbindgen_realloc),a=D;h().setInt32(e+4,a,!0),h().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(g(e,t))},__wbg_call_7f2987183bb62793:function(){return y(function(e,t){return e.call(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(g(e,t))}finally{j.__wbindgen_free(n,r,1)}},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return y(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(g(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return y(function(e){return e.next()},arguments)},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(p(e,t),n)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=S(n,j.__wbindgen_malloc,j.__wbindgen_realloc),i=D;h().setInt32(e+4,i,!0),h().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return b(e)?0:u(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof globalThis>`u`?null:globalThis;return b(e)?0:u(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return b(e)?0:u(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return b(e)?0:u(e)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e){return e},__wbindgen_cast_0000000000000003:function(e,t){return g(e,t)},__wbindgen_cast_0000000000000004:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=j.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}let s=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_diagnosticprinter_free(e>>>0,1)),c=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_memoryfilesystem_free(e>>>0,1)),l=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_workspace_free(e>>>0,1));function u(e){let t=j.__externref_table_alloc();return j.__wbindgen_externrefs.set(t,e),t}function d(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function f(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=f(e[0]));for(let r=1;r<t;r++)n+=`, `+f(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function p(e,t){return e>>>=0,v().subarray(e/1,e/1+t)}let m=null;function h(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==j.memory.buffer)&&(m=new DataView(j.memory.buffer)),m}function g(e,t){return e>>>=0,T(e,t)}let _=null;function v(){return(_===null||_.byteLength===0)&&(_=new Uint8Array(j.memory.buffer)),_}function y(e,t){try{return e.apply(this,t)}catch(e){let t=u(e);j.__wbindgen_exn_store(t)}}function b(e){return e==null}function x(e,t){let n=t(e.length*1,1)>>>0;return v().set(e,n/1),D=e.length,n}function S(e,t,n){if(n===void 0){let n=E.encode(e),r=t(n.length,1)>>>0;return v().subarray(r,r+n.length).set(n),D=n.length,r}let r=e.length,i=t(r,1)>>>0,a=v(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=v().subarray(i+o,i+r),a=E.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return D=o,i}function C(e){let t=j.__wbindgen_externrefs.get(e);return j.__externref_table_dealloc(e),t}let w=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});w.decode();function T(e,t){return w.decode(v().subarray(e,e+t))}let E=new TextEncoder;`encodeInto`in E||(E.encodeInto=function(e,t){let n=E.encode(e);return t.set(n),{read:e.length,written:n.length}});let D=0,O=`${__dirname}/biome_wasm_bg.wasm`,k=e().readFileSync(O),A=new WebAssembly.Module(k),j=new WebAssembly.Instance(A,o()).exports;j.__wbindgen_start()})),i=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),i=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),a=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(n){if(n&&n.__esModule)return n;var r={};if(n!=null)for(var a=e(n),o=0;o<a.length;o++)a[o]!==`default`&&t(r,n,a[o]);return i(r,n),r}})();Object.defineProperty(e,"__esModule",{value:!0}),e.Biome=void 0;let o=a(r()),s=n();e.Biome=class extends s.BiomeCommon{constructor(){super(o)}}}));export default i();
1
+ import{rt as e,vt as t}from"./kernel-worker-jD7bcOG1.js";import{t as n}from"./common-Kgrp69uW.js";var r=t((t=>{var n=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,s.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_diagnosticprinter_free(e,0)}finish(){let e,t;try{let i=this.__destroy_into_raw(),a=j.diagnosticprinter_finish(i);var n=a[0],r=a[1];if(a[3])throw n=0,r=0,C(a[2]);return e=n,t=r,g(n,r)}finally{j.__wbindgen_free(e,t,1)}}constructor(e,t){let n=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),r=D,i=S(t,j.__wbindgen_malloc,j.__wbindgen_realloc),a=D,o=j.diagnosticprinter_new(n,r,i,a);return this.__wbg_ptr=o>>>0,s.register(this,this.__wbg_ptr,this),this}print_simple(e){let t=j.diagnosticprinter_print_simple(this.__wbg_ptr,e);if(t[1])throw C(t[0])}print_verbose(e){let t=j.diagnosticprinter_print_verbose(this.__wbg_ptr,e);if(t[1])throw C(t[0])}};Symbol.dispose&&(n.prototype[Symbol.dispose]=n.prototype.free),t.DiagnosticPrinter=n;var r=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,c.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_memoryfilesystem_free(e,0)}insert(e,t){let n=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),r=D,i=x(t,j.__wbindgen_malloc),a=D;j.memoryfilesystem_insert(this.__wbg_ptr,n,r,i,a)}constructor(){let e=j.memoryfilesystem_new();return this.__wbg_ptr=e>>>0,c.register(this,this.__wbg_ptr,this),this}remove(e){let t=S(e,j.__wbindgen_malloc,j.__wbindgen_realloc),n=D;j.memoryfilesystem_remove(this.__wbg_ptr,t,n)}};Symbol.dispose&&(r.prototype[Symbol.dispose]=r.prototype.free),t.MemoryFileSystem=r;var i=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,l.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,l.unregister(this),e}free(){let e=this.__destroy_into_raw();j.__wbg_workspace_free(e,0)}changeFile(e){let t=j.workspace_changeFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}closeFile(e){let t=j.workspace_closeFile(this.__wbg_ptr,e);if(t[1])throw C(t[0])}dropPattern(e){let t=j.workspace_dropPattern(this.__wbg_ptr,e);if(t[1])throw C(t[0])}fileExists(e){let t=j.workspace_fileExists(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return t[0]!==0}fileFeatures(e){let t=j.workspace_fileFeatures(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}fixFile(e){let t=j.workspace_fixFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatFile(e){let t=j.workspace_formatFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatOnType(e){let t=j.workspace_formatOnType(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}formatRange(e){let t=j.workspace_formatRange(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getControlFlowGraph(e){let t,n;try{let a=j.workspace_getControlFlowGraph(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getFileContent(e){let t,n;try{let a=j.workspace_getFileContent(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getFormatterIr(e){let t,n;try{let a=j.workspace_getFormatterIr(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getModuleGraph(e){let t=j.workspace_getModuleGraph(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getRegisteredTypes(e){let t,n;try{let a=j.workspace_getRegisteredTypes(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getSemanticModel(e){let t,n;try{let a=j.workspace_getSemanticModel(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}getSyntaxTree(e){let t=j.workspace_getSyntaxTree(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}getTypeInfo(e){let t,n;try{let a=j.workspace_getTypeInfo(this.__wbg_ptr,e);var r=a[0],i=a[1];if(a[3])throw r=0,i=0,C(a[2]);return t=r,n=i,g(r,i)}finally{j.__wbindgen_free(t,n,1)}}isPathIgnored(e){let t=j.workspace_isPathIgnored(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return t[0]!==0}constructor(){let e=j.workspace_new();return this.__wbg_ptr=e>>>0,l.register(this,this.__wbg_ptr,this),this}openFile(e){let t=j.workspace_openFile(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}openProject(e){let t=j.workspace_openProject(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}parsePattern(e){let t=j.workspace_parsePattern(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}pullActions(e){let t=j.workspace_pullActions(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}pullDiagnostics(e){let t=j.workspace_pullDiagnostics(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}rename(e){let t=j.workspace_rename(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}scanProject(e){let t=j.workspace_scanProject(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}searchPattern(e){let t=j.workspace_searchPattern(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}updateModuleGraph(e){let t=j.workspace_updateModuleGraph(this.__wbg_ptr,e);if(t[1])throw C(t[0])}updateSettings(e){let t=j.workspace_updateSettings(this.__wbg_ptr,e);if(t[2])throw C(t[1]);return C(t[0])}static withFileSystem(t){d(t,r);let n=j.workspace_withFileSystem(t.__wbg_ptr);return e.__wrap(n)}};Symbol.dispose&&(i.prototype[Symbol.dispose]=i.prototype.free),t.Workspace=i;function a(){j.main()}t.main=a;function o(){return{__proto__:null,"./biome_wasm_bg.js":{__proto__:null,__wbg_Error_2e59b1b37a9a34c3:function(e,t){return Error(g(e,t))},__wbg_Number_e6ffdb596c888833:function(e){return Number(e)},__wbg_String_8564e559799eccda:function(e,t){let n=S(String(t),j.__wbindgen_malloc,j.__wbindgen_realloc),r=D;h().setInt32(e+4,r,!0),h().setInt32(e+0,n,!0)},__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2:function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;h().setBigInt64(e+8,b(r)?BigInt(0):r,!0),h().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_boolean_get_a86c216575a75c30:function(e){let t=e,n=typeof t==`boolean`?t:void 0;return b(n)?16777215:+!!n},__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57:function(e,t){let n=S(f(t),j.__wbindgen_malloc,j.__wbindgen_realloc),r=D;h().setInt32(e+4,r,!0),h().setInt32(e+0,n,!0)},__wbg___wbindgen_in_4bd7a57e54337366:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6c98f7e945dacdde:function(e){return typeof e==`bigint`},__wbg___wbindgen_is_function_49868bde5eb1e745:function(e){return typeof e==`function`},__wbg___wbindgen_is_object_40c5a80572e8f9d3:function(e){let t=e;return typeof t==`object`&&!!t},__wbg___wbindgen_is_string_b29b5c5a8065ba1a:function(e){return typeof e==`string`},__wbg___wbindgen_is_undefined_c0cca72b82b86f4d:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_7d430e744a913d26:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944:function(e,t){return e==t},__wbg___wbindgen_number_get_7579aab02a8a620c:function(e,t){let n=t,r=typeof n==`number`?n:void 0;h().setFloat64(e+8,b(r)?0:r,!0),h().setInt32(e+0,!b(r),!0)},__wbg___wbindgen_string_get_914df97fcfa788f2:function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=b(r)?0:S(r,j.__wbindgen_malloc,j.__wbindgen_realloc),a=D;h().setInt32(e+4,a,!0),h().setInt32(e+0,i,!0)},__wbg___wbindgen_throw_81fc77679af83bc6:function(e,t){throw Error(g(e,t))},__wbg_call_7f2987183bb62793:function(){return y(function(e,t){return e.call(t)},arguments)},__wbg_done_547d467e97529006:function(e){return e.done},__wbg_entries_616b1a459b85be0b:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(g(e,t))}finally{j.__wbindgen_free(n,r,1)}},__wbg_get_4848e350b40afc16:function(e,t){return e[t>>>0]},__wbg_get_ed0642c4b9d31ddf:function(){return y(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_7d7babe32e9e6a54:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_a10a2795ef4bfe97:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Uint8Array_4b8da683deb25d72:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_db61795ad004c139:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ea83862ba994770c:function(e){return Number.isSafeInteger(e)},__wbg_iterator_de403ef31815a3e6:function(){return Symbol.iterator},__wbg_length_0c32cb8543c8e4c8:function(e){return e.length},__wbg_length_6e821edde497a532:function(e){return e.length},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_new_4f9fafbb3909af72:function(){return{}},__wbg_new_99cabae501c0a8a0:function(){return new Map},__wbg_new_a560378ea1240b14:function(e){return new Uint8Array(e)},__wbg_new_e3b04b4d53d1b593:function(e,t){return Error(g(e,t))},__wbg_new_f3c9df4f38f3f798:function(){return[]},__wbg_next_01132ed6134b8ef5:function(e){return e.next},__wbg_next_b3713ec761a9dbfd:function(){return y(function(e){return e.next()},arguments)},__wbg_now_e7c6795a7f81e10f:function(e){return e.now()},__wbg_performance_3fcf6e32a7e1ed0a:function(e){return e.performance},__wbg_prototypesetcall_3e05eb9545565046:function(e,t,n){Uint8Array.prototype.set.call(p(e,t),n)},__wbg_set_08463b1df38a7e29:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_6c60b2e8ad0e9383:function(e,t,n){e[t>>>0]=n},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=S(n,j.__wbindgen_malloc,j.__wbindgen_realloc),i=D;h().setInt32(e+4,i,!0),h().setInt32(e+0,r,!0)},__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f:function(){let e=typeof globalThis>`u`?null:globalThis;return b(e)?0:u(e)},__wbg_static_accessor_GLOBAL_f2e0f995a21329ff:function(){let e=typeof globalThis>`u`?null:globalThis;return b(e)?0:u(e)},__wbg_static_accessor_SELF_24f78b6d23f286ea:function(){let e=typeof self>`u`?null:self;return b(e)?0:u(e)},__wbg_static_accessor_WINDOW_59fd959c540fe405:function(){let e=typeof window>`u`?null:window;return b(e)?0:u(e)},__wbg_value_7f6052747ccf940f:function(e){return e.value},__wbindgen_cast_0000000000000001:function(e){return e},__wbindgen_cast_0000000000000002:function(e){return e},__wbindgen_cast_0000000000000003:function(e,t){return g(e,t)},__wbindgen_cast_0000000000000004:function(e){return BigInt.asUintN(64,e)},__wbindgen_init_externref_table:function(){let e=j.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}let s=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_diagnosticprinter_free(e>>>0,1)),c=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_memoryfilesystem_free(e>>>0,1)),l=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>j.__wbg_workspace_free(e>>>0,1));function u(e){let t=j.__externref_table_alloc();return j.__wbindgen_externrefs.set(t,e),t}function d(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function f(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=f(e[0]));for(let r=1;r<t;r++)n+=`, `+f(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function p(e,t){return e>>>=0,v().subarray(e/1,e/1+t)}let m=null;function h(){return(m===null||m.buffer.detached===!0||m.buffer.detached===void 0&&m.buffer!==j.memory.buffer)&&(m=new DataView(j.memory.buffer)),m}function g(e,t){return e>>>=0,T(e,t)}let _=null;function v(){return(_===null||_.byteLength===0)&&(_=new Uint8Array(j.memory.buffer)),_}function y(e,t){try{return e.apply(this,t)}catch(e){let t=u(e);j.__wbindgen_exn_store(t)}}function b(e){return e==null}function x(e,t){let n=t(e.length*1,1)>>>0;return v().set(e,n/1),D=e.length,n}function S(e,t,n){if(n===void 0){let n=E.encode(e),r=t(n.length,1)>>>0;return v().subarray(r,r+n.length).set(n),D=n.length,r}let r=e.length,i=t(r,1)>>>0,a=v(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=v().subarray(i+o,i+r),a=E.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return D=o,i}function C(e){let t=j.__wbindgen_externrefs.get(e);return j.__externref_table_dealloc(e),t}let w=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});w.decode();function T(e,t){return w.decode(v().subarray(e,e+t))}let E=new TextEncoder;`encodeInto`in E||(E.encodeInto=function(e,t){let n=E.encode(e);return t.set(n),{read:e.length,written:n.length}});let D=0,O=`${__dirname}/biome_wasm_bg.wasm`,k=e().readFileSync(O),A=new WebAssembly.Module(k),j=new WebAssembly.Instance(A,o()).exports;j.__wbindgen_start()})),i=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),i=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),a=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(n){if(n&&n.__esModule)return n;var r={};if(n!=null)for(var a=e(n),o=0;o<a.length;o++)a[o]!==`default`&&t(r,n,a[o]);return i(r,n),r}})();Object.defineProperty(e,"__esModule",{value:!0}),e.Biome=void 0;let o=a(r()),s=n();e.Biome=class extends s.BiomeCommon{constructor(){super(o)}}}));export default i();
@@ -1 +1 @@
1
- import"./main-lrS_5wG0.js";var e=`slicc-nuke-control`;function t(t=()=>location.reload()){if(typeof BroadcastChannel!=`function`)return()=>{};let n=new BroadcastChannel(e),r=e=>{let n=e.data;if(n?.type===`nuke-reload`){if(Array.isArray(n.keysToRemove)){for(let e of n.keysToRemove)if(typeof e==`string`)try{localStorage.removeItem(e)}catch{}}t()}};return n.addEventListener(`message`,r),()=>{n.removeEventListener(`message`,r),n.close()}}export{t as installNukeReloadListener};
1
+ import"./main-BuR1AKEt.js";var e=`slicc-nuke-control`;function t(t=()=>location.reload()){if(typeof BroadcastChannel!=`function`)return()=>{};let n=new BroadcastChannel(e),r=e=>{let n=e.data;if(n?.type===`nuke-reload`){if(Array.isArray(n.keysToRemove)){for(let e of n.keysToRemove)if(typeof e==`string`)try{localStorage.removeItem(e)}catch{}}t()}};return n.addEventListener(`message`,r),()=>{n.removeEventListener(`message`,r),n.close()}}export{t as installNukeReloadListener};
@@ -1 +1 @@
1
- import{_t as e}from"./kernel-worker-CsVAcCa0.js";const t=e(`mcp-oauth`);async function n(e,n,r){let i=new URL(e).origin,a=n??`${i}/.well-known/oauth-protected-resource`,o=null,s=null;t.debug(`Fetching PRM`,{prmUrl:a});try{let e=await r(a,{headers:{Accept:`application/json`}});if(!e.ok)s=`${e.status} ${e.statusText}`;else{let t=await e.json();!t.authorization_servers||t.authorization_servers.length===0?s=`lists no authorization_servers`:o=t}}catch(e){s=e instanceof Error?e.message:String(e)}let c,l,u;o?.authorization_servers&&o.authorization_servers.length>0?(c=o.authorization_servers[0].replace(/\/+$/,``),l=`${c}/.well-known/oauth-authorization-server`,u=`prm`,t.debug(`Discovery via PRM`,{prmUrl:a,asmUrl:l})):(c=i,l=`${i}/.well-known/oauth-authorization-server`,u=`asm-origin-fallback`,t.debug(`PRM unavailable; falling back to ASM at server origin`,{prmUrl:a,prmReason:s,asmUrl:l}));let d=null,f=null;t.debug(`Fetching ASM`,{asmUrl:l});try{let e=await r(l,{headers:{Accept:`application/json`}});e.ok?d=await e.json():f=`${e.status} ${e.statusText}`}catch(e){f=e instanceof Error?e.message:String(e)}if(!d)throw Error(u===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${a}): ${s}. ASM fallback (${l}): ${f}.`:`ASM fetch failed: ${f} (${l})`);if(!d.authorization_endpoint||!d.token_endpoint)throw Error(u===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${a}): ${s}. ASM fallback (${l}) is missing required endpoints (authorization_endpoint, token_endpoint).`:`ASM at ${l} is missing required endpoints`);return{issuer:d.issuer||c,authorizationEndpoint:d.authorization_endpoint,tokenEndpoint:d.token_endpoint,registrationEndpoint:d.registration_endpoint,supportedScopes:d.scopes_supported??o?.scopes_supported,codeChallengeMethods:d.code_challenge_methods_supported,grantTypes:d.grant_types_supported,discoveryPath:u}}async function r(e,t,n){if(!e.registrationEndpoint)throw Error(`Authorization server does not advertise a registration_endpoint (RFC 7591)`);let r=e.grantTypes,i=r&&r.length>0&&!r.includes(`refresh_token`)?[`authorization_code`]:[`authorization_code`,`refresh_token`],a=JSON.stringify({client_name:`SLICC`,redirect_uris:[t],token_endpoint_auth_method:`none`,grant_types:i,response_types:[`code`]}),o=await n(e.registrationEndpoint,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:a});if(!o.ok)throw Error(`DCR failed: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.client_id)throw Error(`DCR response missing client_id`);return{clientId:s.client_id,registrationClientUri:s.registration_client_uri}}function i(e){return!e||e.length===0||e.includes(`S256`)?`S256`:e.includes(`plain`)?`plain`:`S256`}function a(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function o(e){let t=new Uint8Array(32);crypto.getRandomValues(t);let n=a(t);if(e===`plain`)return{codeVerifier:n,codeChallenge:n,method:e};let r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return{codeVerifier:n,codeChallenge:a(new Uint8Array(r)),method:e}}function s(e){try{let t=new URL(e);return{code:t.searchParams.get(`code`),state:t.searchParams.get(`state`)}}catch{return{code:null,state:null}}}async function c(e){let t=await o(i(e.asMetadata.codeChallengeMethods)),n=a(crypto.getRandomValues(new Uint8Array(16))),r=new URLSearchParams({response_type:`code`,client_id:e.clientId,redirect_uri:e.redirectUri,code_challenge:t.codeChallenge,code_challenge_method:t.method,state:n});e.scope&&r.set(`scope`,e.scope);let c=`${e.asMetadata.authorizationEndpoint}?${r.toString()}`,l=await e.launcher(c);if(!l)throw Error(`MCP OAuth flow cancelled or timed out`);let{code:d,state:f}=s(l);if(!d)throw Error("MCP OAuth redirect missing `code` parameter");if(f!==n)throw Error(`MCP OAuth state mismatch — possible CSRF`);return u({tokenEndpoint:e.asMetadata.tokenEndpoint,clientId:e.clientId,code:d,codeVerifier:t.codeVerifier,redirectUri:e.redirectUri,fetchImpl:e.fetchImpl})}function l(e){if(e.error||!e.access_token)throw Error(`Token endpoint error: ${e.error??`no_access_token`}${e.error_description?` — ${e.error_description}`:``}`);return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:e.expires_in?Date.now()+e.expires_in*1e3:void 0,scope:e.scope,tokenType:e.token_type}}async function u(e){let t=new URLSearchParams({grant_type:`authorization_code`,code:e.code,redirect_uri:e.redirectUri,client_id:e.clientId,code_verifier:e.codeVerifier}).toString(),n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token exchange failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return l(r)}async function d(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:e.clientId});e.scope&&t.set(`scope`,e.scope);let n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t.toString()}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token refresh failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return l(r)}export{n as discoverAuth,r as dynamicRegister,d as refreshAccessToken,c as runAuthFlow};
1
+ import{_t as e}from"./kernel-worker-jD7bcOG1.js";const t=e(`mcp-oauth`);async function n(e,n,r){let i=new URL(e).origin,a=n??`${i}/.well-known/oauth-protected-resource`,o=null,s=null;t.debug(`Fetching PRM`,{prmUrl:a});try{let e=await r(a,{headers:{Accept:`application/json`}});if(!e.ok)s=`${e.status} ${e.statusText}`;else{let t=await e.json();!t.authorization_servers||t.authorization_servers.length===0?s=`lists no authorization_servers`:o=t}}catch(e){s=e instanceof Error?e.message:String(e)}let c,l,u;o?.authorization_servers&&o.authorization_servers.length>0?(c=o.authorization_servers[0].replace(/\/+$/,``),l=`${c}/.well-known/oauth-authorization-server`,u=`prm`,t.debug(`Discovery via PRM`,{prmUrl:a,asmUrl:l})):(c=i,l=`${i}/.well-known/oauth-authorization-server`,u=`asm-origin-fallback`,t.debug(`PRM unavailable; falling back to ASM at server origin`,{prmUrl:a,prmReason:s,asmUrl:l}));let d=null,f=null;t.debug(`Fetching ASM`,{asmUrl:l});try{let e=await r(l,{headers:{Accept:`application/json`}});e.ok?d=await e.json():f=`${e.status} ${e.statusText}`}catch(e){f=e instanceof Error?e.message:String(e)}if(!d)throw Error(u===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${a}): ${s}. ASM fallback (${l}): ${f}.`:`ASM fetch failed: ${f} (${l})`);if(!d.authorization_endpoint||!d.token_endpoint)throw Error(u===`asm-origin-fallback`?`MCP OAuth discovery failed. PRM (${a}): ${s}. ASM fallback (${l}) is missing required endpoints (authorization_endpoint, token_endpoint).`:`ASM at ${l} is missing required endpoints`);return{issuer:d.issuer||c,authorizationEndpoint:d.authorization_endpoint,tokenEndpoint:d.token_endpoint,registrationEndpoint:d.registration_endpoint,supportedScopes:d.scopes_supported??o?.scopes_supported,codeChallengeMethods:d.code_challenge_methods_supported,grantTypes:d.grant_types_supported,discoveryPath:u}}async function r(e,t,n){if(!e.registrationEndpoint)throw Error(`Authorization server does not advertise a registration_endpoint (RFC 7591)`);let r=e.grantTypes,i=r&&r.length>0&&!r.includes(`refresh_token`)?[`authorization_code`]:[`authorization_code`,`refresh_token`],a=JSON.stringify({client_name:`SLICC`,redirect_uris:[t],token_endpoint_auth_method:`none`,grant_types:i,response_types:[`code`]}),o=await n(e.registrationEndpoint,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:a});if(!o.ok)throw Error(`DCR failed: ${o.status} ${o.statusText}`);let s=await o.json();if(!s.client_id)throw Error(`DCR response missing client_id`);return{clientId:s.client_id,registrationClientUri:s.registration_client_uri}}function i(e){return!e||e.length===0||e.includes(`S256`)?`S256`:e.includes(`plain`)?`plain`:`S256`}function a(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function o(e){let t=new Uint8Array(32);crypto.getRandomValues(t);let n=a(t);if(e===`plain`)return{codeVerifier:n,codeChallenge:n,method:e};let r=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(n));return{codeVerifier:n,codeChallenge:a(new Uint8Array(r)),method:e}}function s(e){try{let t=new URL(e);return{code:t.searchParams.get(`code`),state:t.searchParams.get(`state`)}}catch{return{code:null,state:null}}}async function c(e){let t=await o(i(e.asMetadata.codeChallengeMethods)),n=a(crypto.getRandomValues(new Uint8Array(16))),r=new URLSearchParams({response_type:`code`,client_id:e.clientId,redirect_uri:e.redirectUri,code_challenge:t.codeChallenge,code_challenge_method:t.method,state:n});e.scope&&r.set(`scope`,e.scope);let c=`${e.asMetadata.authorizationEndpoint}?${r.toString()}`,l=await e.launcher(c);if(!l)throw Error(`MCP OAuth flow cancelled or timed out`);let{code:d,state:f}=s(l);if(!d)throw Error("MCP OAuth redirect missing `code` parameter");if(f!==n)throw Error(`MCP OAuth state mismatch — possible CSRF`);return u({tokenEndpoint:e.asMetadata.tokenEndpoint,clientId:e.clientId,code:d,codeVerifier:t.codeVerifier,redirectUri:e.redirectUri,fetchImpl:e.fetchImpl})}function l(e){if(e.error||!e.access_token)throw Error(`Token endpoint error: ${e.error??`no_access_token`}${e.error_description?` — ${e.error_description}`:``}`);return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:e.expires_in?Date.now()+e.expires_in*1e3:void 0,scope:e.scope,tokenType:e.token_type}}async function u(e){let t=new URLSearchParams({grant_type:`authorization_code`,code:e.code,redirect_uri:e.redirectUri,client_id:e.clientId,code_verifier:e.codeVerifier}).toString(),n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token exchange failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return l(r)}async function d(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:e.clientId});e.scope&&t.set(`scope`,e.scope);let n=await e.fetchImpl(e.tokenEndpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,Accept:`application/json`},body:t.toString()}),r=await n.json();if(!n.ok&&!r.access_token)throw Error(`Token refresh failed: ${n.status} ${n.statusText}${r.error?` (${r.error})`:``}`);return l(r)}export{n as discoverAuth,r as dynamicRegister,d as refreshAccessToken,c as runAuthFlow};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/provider-D1Ft0Nb8.js","assets/main-lrS_5wG0.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-D683Koa8.css","assets/global-db-CbuLl-zx.js"])))=>i.map(i=>d[i]);
2
- import{I as e,at as t,f as n,j as r,r as i}from"./main-lrS_5wG0.js";var a=e(`oauth-bootstrap`),o=6e4;async function s(){try{let{ensureAllMcpProvidersRegistered:e}=await t(async()=>{let{ensureAllMcpProvidersRegistered:e}=await import(`./provider-D1Ft0Nb8.js`);return{ensureAllMcpProvidersRegistered:e}},__vite__mapDeps([0,1,2,3,4])),n=await e();n.length>0&&a.debug(`Pre-registered MCP providers for OAuth bootstrap`,{count:n.length})}catch(e){a.warn(`Failed to pre-register MCP providers for OAuth bootstrap`,{error:e instanceof Error?e.message:String(e)})}let e=i();a.info(`Bootstrap OAuth replicas`,{count:e.length});for(let t of e){if(!t.accessToken){a.debug(`Skipping account without token`,{providerId:t.providerId});continue}if((t.tokenExpiresAt??1/0)-Date.now()<=o){let e=r(t.providerId);if(e?.onSilentRenew)try{if(await e.onSilentRenew()){a.info(`Silently renewed OAuth token`,{providerId:t.providerId});continue}a.warn(`Silent renewal yielded no token; user must re-authenticate`,{providerId:t.providerId});continue}catch(e){a.warn(`Silent renewal failed`,{providerId:t.providerId,error:e instanceof Error?e.message:String(e)});continue}a.debug(`Skipping expired account (no silent-renew hook)`,{providerId:t.providerId});continue}try{await n({providerId:t.providerId,accessToken:t.accessToken,refreshToken:t.refreshToken,tokenExpiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar}),a.debug(`Bootstrapped OAuth replica`,{providerId:t.providerId})}catch(e){a.error(`OAuth bootstrap failed`,{providerId:t.providerId,error:e instanceof Error?e.message:String(e)})}}}export{s as bootstrapOAuthReplicas};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/provider-CfArdY9x.js","assets/main-BuR1AKEt.js","assets/modulepreload-polyfill-Dezn_h7o.js","assets/main-D683Koa8.css","assets/global-db-CbuLl-zx.js"])))=>i.map(i=>d[i]);
2
+ import{I as e,at as t,f as n,j as r,r as i}from"./main-BuR1AKEt.js";var a=e(`oauth-bootstrap`),o=6e4;async function s(){try{let{ensureAllMcpProvidersRegistered:e}=await t(async()=>{let{ensureAllMcpProvidersRegistered:e}=await import(`./provider-CfArdY9x.js`);return{ensureAllMcpProvidersRegistered:e}},__vite__mapDeps([0,1,2,3,4])),n=await e();n.length>0&&a.debug(`Pre-registered MCP providers for OAuth bootstrap`,{count:n.length})}catch(e){a.warn(`Failed to pre-register MCP providers for OAuth bootstrap`,{error:e instanceof Error?e.message:String(e)})}let e=i();a.info(`Bootstrap OAuth replicas`,{count:e.length});for(let t of e){if(!t.accessToken){a.debug(`Skipping account without token`,{providerId:t.providerId});continue}if((t.tokenExpiresAt??1/0)-Date.now()<=o){let e=r(t.providerId);if(e?.onSilentRenew)try{if(await e.onSilentRenew()){a.info(`Silently renewed OAuth token`,{providerId:t.providerId});continue}a.warn(`Silent renewal yielded no token; user must re-authenticate`,{providerId:t.providerId});continue}catch(e){a.warn(`Silent renewal failed`,{providerId:t.providerId,error:e instanceof Error?e.message:String(e)});continue}a.debug(`Skipping expired account (no silent-renew hook)`,{providerId:t.providerId});continue}try{await n({providerId:t.providerId,accessToken:t.accessToken,refreshToken:t.refreshToken,tokenExpiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar}),a.debug(`Bootstrapped OAuth replica`,{providerId:t.providerId})}catch(e){a.error(`OAuth bootstrap failed`,{providerId:t.providerId,error:e instanceof Error?e.message:String(e)})}}}export{s as bootstrapOAuthReplicas};
@@ -1 +1 @@
1
- import{lt as e}from"./kernel-worker-CsVAcCa0.js";import{t}from"./intercepted-oauth-BeA89evx.js";const n=typeof chrome<`u`&&!!chrome?.runtime?.id;function r(){return n?u:typeof window>`u`?s:c}async function i(){let e=await a();return e?t(e):null}async function a(){try{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function o(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let t=e();if(!t)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let n=await t.call(`page-info`,void 0);return{origin:n.origin,href:n.href}}async function s(t){let n=e();if(!n)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await n.call(`oauth-popup`,{url:t},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function c(e){return new Promise(t=>{let n=window.open(e,`_blank`,`width=500,height=700,popup=yes`),r=!1,i=null,a=null,o=()=>{r||(r=!0,window.removeEventListener(`message`,s),clearTimeout(c),i&&clearInterval(i),a&&clearInterval(a))},s=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(o(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),t(null);return}let r=e.data.redirectUrl;typeof r!=`string`&&r!=null||t(r??null)};window.addEventListener(`message`,s),i=setInterval(async()=>{if(!r)try{let e=await fetch(`/api/oauth-result`);if(e.status===204||!e.ok)return;let n=await e.json();if(r)return;if(o(),n.error){console.error(`[oauth-service] Server relay OAuth error:`,n.error),t(null);return}t(n.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(a=setInterval(()=>{n.closed&&(clearInterval(a),a=null,setTimeout(()=>{r||(o(),t(null))},1500))},500));let c=setTimeout(()=>{o();try{n?.close()}catch{}t(null)},12e4)})}async function l(e,t=180*1e3){if(typeof window>`u`||n)return;let r=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!r){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let n=setTimeout(()=>{clearInterval(i);try{r.close()}catch{}e()},t),i=setInterval(()=>{r.closed&&(clearTimeout(n),clearInterval(i),e())},500)})}async function u(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{i as createInterceptingOAuthLauncherForCurrentRuntime,r as createOAuthLauncher,o as getOAuthPageOrigin,l as openIdpLogoutUrl};
1
+ import{lt as e}from"./kernel-worker-jD7bcOG1.js";import{t}from"./intercepted-oauth-E-RJ_38y.js";const n=typeof chrome<`u`&&!!chrome?.runtime?.id;function r(){return n?u:typeof window>`u`?s:c}async function i(){let e=await a();return e?t(e):null}async function a(){try{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function o(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let t=e();if(!t)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let n=await t.call(`page-info`,void 0);return{origin:n.origin,href:n.href}}async function s(t){let n=e();if(!n)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await n.call(`oauth-popup`,{url:t},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function c(e){return new Promise(t=>{let n=window.open(e,`_blank`,`width=500,height=700,popup=yes`),r=!1,i=null,a=null,o=()=>{r||(r=!0,window.removeEventListener(`message`,s),clearTimeout(c),i&&clearInterval(i),a&&clearInterval(a))},s=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(o(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),t(null);return}let r=e.data.redirectUrl;typeof r!=`string`&&r!=null||t(r??null)};window.addEventListener(`message`,s),i=setInterval(async()=>{if(!r)try{let e=await fetch(`/api/oauth-result`);if(e.status===204||!e.ok)return;let n=await e.json();if(r)return;if(o(),n.error){console.error(`[oauth-service] Server relay OAuth error:`,n.error),t(null);return}t(n.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(a=setInterval(()=>{n.closed&&(clearInterval(a),a=null,setTimeout(()=>{r||(o(),t(null))},1500))},500));let c=setTimeout(()=>{o();try{n?.close()}catch{}t(null)},12e4)})}async function l(e,t=180*1e3){if(typeof window>`u`||n)return;let r=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!r){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let n=setTimeout(()=>{clearInterval(i);try{r.close()}catch{}e()},t),i=setInterval(()=>{r.closed&&(clearTimeout(n),clearInterval(i),e())},500)})}async function u(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{i as createInterceptingOAuthLauncherForCurrentRuntime,r as createOAuthLauncher,o as getOAuthPageOrigin,l as openIdpLogoutUrl};
@@ -1 +1 @@
1
- import{N as e,at as t}from"./main-lrS_5wG0.js";var n=12e4;function r(e,t){return t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}#`)}function i(e){return e.endsWith(`*`)?e:`${e}*`}function a(e,t){if(!t||t.length===0)return e;let n=e;for(let e of t)if(n.includes(e.match)){if(e.replaceUrl){n=e.replaceUrl;continue}if(e.appendParams)try{let t=new URL(n);for(let[n,r]of Object.entries(e.appendParams))t.searchParams.set(n,r);n=t.toString()}catch{}}return n}function o(e){return async t=>{let o=t.timeoutMs??n,s=t.rewrite??[],c=t.onCapture??`close`,l,u,d=!1,f=null,p=async()=>{if(u){try{await e.send(`Fetch.disable`,{},u)}catch{}try{await e.send(`Target.detachFromTarget`,{sessionId:u})}catch{}}if(l&&c===`close`)try{await e.send(`Target.closeTarget`,{targetId:l})}catch{}};return await new Promise(n=>{let c=async t=>{d||(d=!0,clearTimeout(h),e.off(`Fetch.requestPaused`,m),await p(),n(t))},m=n=>{let i=n;if(!i?.request?.url||!u||(typeof n.sessionId==`string`?n.sessionId:void 0)!==u)return;if(r(i.request.url,t.redirectUriPattern)){f=i.request.url,e.send(`Fetch.failRequest`,{requestId:i.requestId,errorReason:`Aborted`},u).catch(()=>{}),c(f);return}let o=a(i.request.url,s);if(o!==i.request.url){e.send(`Fetch.continueRequest`,{requestId:i.requestId,url:o},u).catch(e=>{console.warn(`[intercepted-oauth] continueRequest (rewrite) failed:`,e instanceof Error?e.message:String(e))});return}e.send(`Fetch.continueRequest`,{requestId:i.requestId},u).catch(()=>{})},h=setTimeout(()=>{c(null)},o);(async()=>{try{l=(await e.send(`Target.createTarget`,{url:`about:blank`})).targetId,u=(await e.send(`Target.attachToTarget`,{targetId:l,flatten:!0})).sessionId,e.on(`Fetch.requestPaused`,m),await e.send(`Fetch.enable`,{patterns:[{urlPattern:i(t.redirectUriPattern),requestStage:`Request`},...s.map(e=>({urlPattern:`*${e.match}*`,requestStage:`Request`}))]},u),await e.send(`Page.navigate`,{url:t.authorizeUrl},u)}catch(e){console.error(`[intercepted-oauth] setup failed:`,e instanceof Error?e.message:String(e)),c(null)}})()})}}var s=typeof chrome<`u`&&!!chrome?.runtime?.id;function c(){return s?h:typeof window>`u`?f:p}async function l(){let e=await u();return e?o(e):null}async function u(){try{let{getActiveCdpTransport:e}=await t(async()=>{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return{getActiveCdpTransport:e}},[]);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function d(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let t=e();if(!t)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let n=await t.call(`page-info`,void 0);return{origin:n.origin,href:n.href}}async function f(t){let n=e();if(!n)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await n.call(`oauth-popup`,{url:t},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function p(e){return new Promise(t=>{let n=window.open(e,`_blank`,`width=500,height=700,popup=yes`),r=!1,i=null,a=null,o=()=>{r||(r=!0,window.removeEventListener(`message`,s),clearTimeout(c),i&&clearInterval(i),a&&clearInterval(a))},s=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(o(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),t(null);return}let r=e.data.redirectUrl;typeof r!=`string`&&r!=null||t(r??null)};window.addEventListener(`message`,s),i=setInterval(async()=>{if(!r)try{let e=await fetch(`/api/oauth-result`);if(e.status===204||!e.ok)return;let n=await e.json();if(r)return;if(o(),n.error){console.error(`[oauth-service] Server relay OAuth error:`,n.error),t(null);return}t(n.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(a=setInterval(()=>{n.closed&&(clearInterval(a),a=null,setTimeout(()=>{r||(o(),t(null))},1500))},500));let c=setTimeout(()=>{o();try{n?.close()}catch{}t(null)},12e4)})}async function m(e,t=180*1e3){if(typeof window>`u`||s)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function h(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{l as createInterceptingOAuthLauncherForCurrentRuntime,c as createOAuthLauncher,d as getOAuthPageOrigin,m as openIdpLogoutUrl};
1
+ import{N as e,at as t}from"./main-BuR1AKEt.js";var n=12e4;function r(e,t){return t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}#`)}function i(e){return e.endsWith(`*`)?e:`${e}*`}function a(e,t){if(!t||t.length===0)return e;let n=e;for(let e of t)if(n.includes(e.match)){if(e.replaceUrl){n=e.replaceUrl;continue}if(e.appendParams)try{let t=new URL(n);for(let[n,r]of Object.entries(e.appendParams))t.searchParams.set(n,r);n=t.toString()}catch{}}return n}function o(e){return async t=>{let o=t.timeoutMs??n,s=t.rewrite??[],c=t.onCapture??`close`,l,u,d=!1,f=null,p=async()=>{if(u){try{await e.send(`Fetch.disable`,{},u)}catch{}try{await e.send(`Target.detachFromTarget`,{sessionId:u})}catch{}}if(l&&c===`close`)try{await e.send(`Target.closeTarget`,{targetId:l})}catch{}};return await new Promise(n=>{let c=async t=>{d||(d=!0,clearTimeout(h),e.off(`Fetch.requestPaused`,m),await p(),n(t))},m=n=>{let i=n;if(!i?.request?.url||!u||(typeof n.sessionId==`string`?n.sessionId:void 0)!==u)return;if(r(i.request.url,t.redirectUriPattern)){f=i.request.url,e.send(`Fetch.failRequest`,{requestId:i.requestId,errorReason:`Aborted`},u).catch(()=>{}),c(f);return}let o=a(i.request.url,s);if(o!==i.request.url){e.send(`Fetch.continueRequest`,{requestId:i.requestId,url:o},u).catch(e=>{console.warn(`[intercepted-oauth] continueRequest (rewrite) failed:`,e instanceof Error?e.message:String(e))});return}e.send(`Fetch.continueRequest`,{requestId:i.requestId},u).catch(()=>{})},h=setTimeout(()=>{c(null)},o);(async()=>{try{l=(await e.send(`Target.createTarget`,{url:`about:blank`})).targetId,u=(await e.send(`Target.attachToTarget`,{targetId:l,flatten:!0})).sessionId,e.on(`Fetch.requestPaused`,m),await e.send(`Fetch.enable`,{patterns:[{urlPattern:i(t.redirectUriPattern),requestStage:`Request`},...s.map(e=>({urlPattern:`*${e.match}*`,requestStage:`Request`}))]},u),await e.send(`Page.navigate`,{url:t.authorizeUrl},u)}catch(e){console.error(`[intercepted-oauth] setup failed:`,e instanceof Error?e.message:String(e)),c(null)}})()})}}var s=typeof chrome<`u`&&!!chrome?.runtime?.id;function c(){return s?h:typeof window>`u`?f:p}async function l(){let e=await u();return e?o(e):null}async function u(){try{let{getActiveCdpTransport:e}=await t(async()=>{let{getActiveCdpTransport:e}=await import(`./active-transport-BIjzxdwv.js`);return{getActiveCdpTransport:e}},[]);return await e()}catch(e){return console.warn(`[oauth-service] could not resolve active CDP transport:`,e instanceof Error?e.message:String(e)),null}}async function d(){if(typeof window<`u`)return{origin:window.location.origin,href:window.location.href};let t=e();if(!t)throw Error(`OAuth from worker context requires the panel-RPC bridge (no page-info available)`);let n=await t.call(`page-info`,void 0);return{origin:n.origin,href:n.href}}async function f(t){let n=e();if(!n)return console.error(`[oauth-service] panel-RPC client unavailable in worker`),null;try{return(await n.call(`oauth-popup`,{url:t},{timeoutMs:13e4})).redirectUrl}catch(e){return console.error(`[oauth-service] oauth-popup RPC failed:`,e instanceof Error?e.message:String(e)),null}}async function p(e){return new Promise(t=>{let n=window.open(e,`_blank`,`width=500,height=700,popup=yes`),r=!1,i=null,a=null,o=()=>{r||(r=!0,window.removeEventListener(`message`,s),clearTimeout(c),i&&clearInterval(i),a&&clearInterval(a))},s=e=>{if(e.data?.type!==`oauth-callback`||e.origin!==window.location.origin||n&&e.source!==n)return;if(o(),e.data.error){console.error(`[oauth-service] CLI OAuth error:`,e.data.error),t(null);return}let r=e.data.redirectUrl;typeof r!=`string`&&r!=null||t(r??null)};window.addEventListener(`message`,s),i=setInterval(async()=>{if(!r)try{let e=await fetch(`/api/oauth-result`);if(e.status===204||!e.ok)return;let n=await e.json();if(r)return;if(o(),n.error){console.error(`[oauth-service] Server relay OAuth error:`,n.error),t(null);return}t(n.redirectUrl??null)}catch(e){console.warn(`[oauth-service] Poll failed:`,e instanceof Error?e.message:String(e))}},1e3),n&&(a=setInterval(()=>{n.closed&&(clearInterval(a),a=null,setTimeout(()=>{r||(o(),t(null))},1500))},500));let c=setTimeout(()=>{o();try{n?.close()}catch{}t(null)},12e4)})}async function m(e,t=180*1e3){if(typeof window>`u`||s)return;let n=window.open(e,`_blank`,`width=500,height=600,popup=yes`);if(!n){console.warn(`[oauth-service] Could not open IdP logout popup — popups may be blocked`);return}await new Promise(e=>{let r=setTimeout(()=>{clearInterval(i);try{n.close()}catch{}e()},t),i=setInterval(()=>{n.closed&&(clearTimeout(r),clearInterval(i),e())},500)})}async function h(e,t){return new Promise(n=>{let r=!1,i=()=>{r||(r=!0,chrome.runtime.onMessage.removeListener(a),clearTimeout(o))},a=e=>{if(e?.source===`service-worker`&&e?.payload?.type===`oauth-result`){if(i(),e.payload.error){console.error(`[oauth-service] Extension OAuth error:`,e.payload.error),n(null);return}n(e.payload.redirectUrl??null)}};chrome.runtime.onMessage.addListener(a),chrome.runtime.sendMessage({source:`panel`,payload:{type:`oauth-request`,providerId:`oauth`,authorizeUrl:e,interactive:t?.interactive??!0}}).catch(e=>{console.error(`[oauth-service] Failed to send OAuth request to service worker:`,e)});let o=setTimeout(()=>{i(),n(null)},12e4)})}export{l as createInterceptingOAuthLauncherForCurrentRuntime,c as createOAuthLauncher,d as getOAuthPageOrigin,m as openIdpLogoutUrl};
@@ -1 +1 @@
1
- import{C as e,I as t,T as n}from"./main-lrS_5wG0.js";var r=`__slicc_binary__`,i=`b64`;function a(e){if(!e||typeof e!=`object`)return!1;let t=e;return t[r]===i&&typeof t.data==`string`}function o(e){let t=32768,n=``;for(let r=0;r<e.byteLength;r+=t){let i=e.subarray(r,Math.min(r+t,e.byteLength));n+=String.fromCharCode.apply(null,i)}return btoa(n)}function s(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function c(e){if(e instanceof Uint8Array)return{[r]:i,data:o(e)};if(Array.isArray(e))return e.map(c);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=c(r);return t}return e}function l(e){if(a(e))return s(e.data);if(Array.isArray(e))return e.map(l);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=l(r);return t}return e}var u=t(`panel-transport`);function d(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function f(){return{onMessage:e=>{let t=(t,n,r)=>(d(t)&&e(l(t)),!1);return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)},send:(e,t)=>{let n=c(e);chrome.runtime.sendMessage({source:`panel`,payload:n}).catch(e=>{u.error(`failed to send to offscreen`,{error:e instanceof Error?e.message:String(e)})})}}}var p=t(`offscreen-client`),m=class{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;pendingClearAcks=new Map;pendingTranscriptRequests=new Map;transport;_selectedScoopJid=null;get selectedScoopJid(){return this._selectedScoopJid}scoopSelectedListeners=new Set;onScoopSelected(e){return this.scoopSelectedListeners.add(e),()=>{this.scoopSelectedListeners.delete(e)}}setSelectedScoopJid(e){if(this._selectedScoopJid!==e&&(this._selectedScoopJid=e,e!==null))for(let t of this.scoopSelectedListeners)try{t(e)}catch(e){p.error(`onScoopSelected handler threw`,{error:e instanceof Error?e.message:String(e)})}}locked=!1;constructor(e,t){this.callbacks=e,this.transport=t??f(),this.setupMessageListener()}setLocalFS(e){this.localFs=e}getTransport(){return this.transport}createAgentHandle(){return{sendMessage:(e,t,n)=>{if(!this.selectedScoopJid){this.emitToUI({type:`error`,error:`No scoop selected`});return}this.send({type:`user-message`,scoopJid:this.selectedScoopJid,text:e,attachments:n,messageId:t??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`})},onEvent:e=>(this.eventListeners.add(e),()=>this.eventListeners.delete(e)),stop:()=>{this.selectedScoopJid&&this.send({type:`abort`,scoopJid:this.selectedScoopJid})}}}getScoops(){return this.scoops}getScoop(e){return this.scoops.find(t=>t.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)===`processing`}async registerScoop(e){if(!e.isCone)throw Error(`OffscreenClient.registerScoop is cone-only; use scoop_scoop for non-cone scoops`);this.scoops.find(t=>t.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,`initializing`)),this.send({type:`cone-create`,name:e.name})}async unregisterScoop(e){this.send({type:`scoop-drop`,scoopJid:e}),this.scoops=this.scoops.filter(t=>t.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return``;try{let e=await this.localFs.readFile(`/shared/CLAUDE.md`,{encoding:`utf-8`});return typeof e==`string`?e:new TextDecoder().decode(e)}catch{return``}}getScoopContext(e){if(this.localFs)return{getFS:()=>this.localFs}}getSharedFS(){return this.localFs}stopScoop(e){this.send({type:`abort`,scoopJid:e})}async clearQueuedMessages(e){}async deleteQueuedMessage(e,t){}updateModel(){this.send({type:`refresh-model`})}setLocked(e){this.locked=e}setScoopThinkingLevel(e,t){this.send({type:`set-thinking-level`,scoopJid:e,level:t})}async clearAllMessages(){let e=`clear-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,t=new Promise(t=>{this.pendingClearAcks.set(e,t)});this.send({type:`clear-chat`,requestId:e}),await Promise.race([t,new Promise(e=>setTimeout(e,5e3))]),this.pendingClearAcks.delete(e)}clearFilesystem(){this.send({type:`clear-filesystem`})}requestScoopMessages(e){this.send({type:`request-scoop-messages`,scoopJid:e})}async getScoopTranscript(e){let t=`tr-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=new Promise(e=>{this.pendingTranscriptRequests.set(t,e)});this.send({type:`request-scoop-transcript`,requestId:t,scoopJid:e});let r=await Promise.race([n,new Promise(e=>setTimeout(()=>e(``),5e3))]);return this.pendingTranscriptRequests.delete(t),r}requestState(){this.send({type:`request-state`});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null);return}p.debug(`Retrying request-state`,{attempt:e}),this.send({type:`request-state`})},500)}isReady(){return this.ready}sprinkleOpHandler=null;forwardLickHandler=null;sendSprinkleLick(e,t,n,r){this.send({type:`sprinkle-lick`,sprinkleName:e,body:t,targetScoop:n,originLabel:r})}sendWebhookEvent(e,t,n){this.send({type:`lick-webhook-event`,webhookId:e,headers:t,body:n})}sendSetFollowerForwarding(e){this.send({type:`set-follower-forwarding`,enabled:e})}sendForwardedLick(e){this.send({type:`inject-forwarded-lick`,event:e})}setForwardLickHandler(e){this.forwardLickHandler=e}sendCherryHostEvent(e,t,n){this.send({type:`lick-cherry-host-event`,cherryRuntimeId:e,name:t,detail:n})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}sendRaw(e){this.send(e)}setupMessageListener(){this.transport.onMessage(e=>{if(e.source!==`offscreen`)return;let t=e.payload;t?.type===`sprinkle-op`&&this.sprinkleOpHandler?this.sprinkleOpHandler(t):this.handleOffscreenMessage(e.payload)})}handleOffscreenMessage(e){switch(e.type){case`offscreen-ready`:this.ready?(p.warn(`Offscreen restarted — re-requesting state`),this.ready=!1):p.info(`Offscreen engine ready`),this.send({type:`request-state`});break;case`agent-event`:this.handleAgentEvent(e);break;case`scoop-status`:this.handleScoopStatus(e);break;case`compaction-state`:this.callbacks.onCompactionStateChange?.(e.scoopJid,e.state);break;case`clear-chat-ack`:{let t=this.pendingClearAcks.get(e.requestId);t&&(this.pendingClearAcks.delete(e.requestId),t());break}case`scoop-created`:this.handleScoopCreated(e);break;case`scoop-list`:this.handleScoopList(e);break;case`state-snapshot`:this.handleStateSnapshot(e);break;case`error`:this.handleError(e);break;case`incoming-message`:this.handleIncomingMessage(e);break;case`scoop-messages-replaced`:{let t=e;this.callbacks.onScoopMessagesReplaced?.(t.scoopJid,t.messages);break}case`scoop-transcript`:{let t=e,n=this.pendingTranscriptRequests.get(t.requestId);n&&(this.pendingTranscriptRequests.delete(t.requestId),n(t.transcript));break}case`tray-runtime-status`:{let t=e;g(t.leader,t.follower);break}case`forward-lick`:this.forwardLickHandler?.(e.event);break;case`terminal-status`:case`terminal-output`:case`terminal-media-preview`:case`terminal-exit`:case`terminal-cleared`:for(let t of this.terminalEventListeners)try{t(e)}catch(e){p.error(`terminal event listener error`,{error:e instanceof Error?e.message:String(e)})}break}}terminalEventListeners=new Set;onTerminalEvent(e){return this.terminalEventListeners.add(e),()=>this.terminalEventListeners.delete(e)}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case`text_delta`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`content_delta`,messageId:t,text:e.text??``});break}case`tool_start`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_use_start`,messageId:t,toolName:e.toolName??``,toolInput:e.toolInput});break}case`tool_end`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_result`,messageId:t,toolName:e.toolName??``,result:e.toolResult??``,isError:e.isError});break}case`tool_ui`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_ui`,messageId:t,toolName:e.toolName??``,requestId:e.requestId??``,html:e.html??``});break}case`tool_ui_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_ui_done`,messageId:t,requestId:e.requestId??``});break}case`response_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&(this.emitToUI({type:`content_done`,messageId:t}),this.currentMessageId.delete(e.scoopJid));break}case`turn_end`:{let t=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${h()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:`turn_end`,messageId:t});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){let t=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(e=>e.name!==t.name||e.jid===t.jid),this.scoops.find(e=>e.jid===t.jid)||this.scoops.push(t),this.scoopStatuses.set(t.jid,e.scoop.status),this.callbacks.onScoopCreated(t)}handleScoopList(e){this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){p.info(`Received state snapshot`,{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);e.trayRuntimeStatus&&g(e.trayRuntimeStatus.leader,e.trayRuntimeStatus.follower);let t=!this.ready;t&&(this.ready=!0,this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null)),this.callbacks.onScoopListUpdate(e.scoops),t&&this.callbacks.onReady?.()}handleError(e){e.scoopJid===this.selectedScoopJid&&this.emitToUI({type:`error`,error:e.error})}handleIncomingMessage(e){this.callbacks.onIncomingMessage(e.scoopJid,e.message)}msgScoopToRegistered(e){return{jid:e.jid,name:e.name,folder:e.folder,isCone:e.isCone,type:e.isCone?`cone`:`scoop`,requiresTrigger:!e.isCone,assistantLabel:e.assistantLabel,addedAt:new Date().toISOString(),...e.config?{config:{...e.config}}:{}}}emitToUI(e){for(let t of this.eventListeners)try{t(e)}catch(e){p.error(`Listener error`,{error:e instanceof Error?e.message:String(e)})}}send(e){if(this.locked){this.emitToUI({type:`error`,error:`This window is detached. Close it and use the detached tab.`});return}this.transport.send(e)}};function h(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function g(t,r){n({state:t.state,error:t.error,reconnectAttempts:t.reconnectAttempts,session:t.session?{...t.session}:null}),e({state:r.state,joinUrl:r.joinUrl,trayId:r.trayId,error:r.error,lastError:r.lastError,reconnectAttempts:r.reconnectAttempts,attachAttempts:r.attachAttempts,lastAttachCode:r.lastAttachCode,connectingSince:r.connectingSince,lastPingTime:r.lastPingTime})}export{m as OffscreenClient};
1
+ import{C as e,I as t,T as n}from"./main-BuR1AKEt.js";var r=`__slicc_binary__`,i=`b64`;function a(e){if(!e||typeof e!=`object`)return!1;let t=e;return t[r]===i&&typeof t.data==`string`}function o(e){let t=32768,n=``;for(let r=0;r<e.byteLength;r+=t){let i=e.subarray(r,Math.min(r+t,e.byteLength));n+=String.fromCharCode.apply(null,i)}return btoa(n)}function s(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function c(e){if(e instanceof Uint8Array)return{[r]:i,data:o(e)};if(Array.isArray(e))return e.map(c);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=c(r);return t}return e}function l(e){if(a(e))return s(e.data);if(Array.isArray(e))return e.map(l);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=l(r);return t}return e}var u=t(`panel-transport`);function d(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function f(){return{onMessage:e=>{let t=(t,n,r)=>(d(t)&&e(l(t)),!1);return chrome.runtime.onMessage.addListener(t),()=>chrome.runtime.onMessage.removeListener(t)},send:(e,t)=>{let n=c(e);chrome.runtime.sendMessage({source:`panel`,payload:n}).catch(e=>{u.error(`failed to send to offscreen`,{error:e instanceof Error?e.message:String(e)})})}}}var p=t(`offscreen-client`),m=class{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;pendingClearAcks=new Map;pendingTranscriptRequests=new Map;transport;_selectedScoopJid=null;get selectedScoopJid(){return this._selectedScoopJid}scoopSelectedListeners=new Set;onScoopSelected(e){return this.scoopSelectedListeners.add(e),()=>{this.scoopSelectedListeners.delete(e)}}setSelectedScoopJid(e){if(this._selectedScoopJid!==e&&(this._selectedScoopJid=e,e!==null))for(let t of this.scoopSelectedListeners)try{t(e)}catch(e){p.error(`onScoopSelected handler threw`,{error:e instanceof Error?e.message:String(e)})}}locked=!1;constructor(e,t){this.callbacks=e,this.transport=t??f(),this.setupMessageListener()}setLocalFS(e){this.localFs=e}getTransport(){return this.transport}createAgentHandle(){return{sendMessage:(e,t,n)=>{if(!this.selectedScoopJid){this.emitToUI({type:`error`,error:`No scoop selected`});return}this.send({type:`user-message`,scoopJid:this.selectedScoopJid,text:e,attachments:n,messageId:t??`msg-${Date.now()}-${Math.random().toString(36).slice(2,8)}`})},onEvent:e=>(this.eventListeners.add(e),()=>this.eventListeners.delete(e)),stop:()=>{this.selectedScoopJid&&this.send({type:`abort`,scoopJid:this.selectedScoopJid})}}}getScoops(){return this.scoops}getScoop(e){return this.scoops.find(t=>t.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)===`processing`}async registerScoop(e){if(!e.isCone)throw Error(`OffscreenClient.registerScoop is cone-only; use scoop_scoop for non-cone scoops`);this.scoops.find(t=>t.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,`initializing`)),this.send({type:`cone-create`,name:e.name})}async unregisterScoop(e){this.send({type:`scoop-drop`,scoopJid:e}),this.scoops=this.scoops.filter(t=>t.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return``;try{let e=await this.localFs.readFile(`/shared/CLAUDE.md`,{encoding:`utf-8`});return typeof e==`string`?e:new TextDecoder().decode(e)}catch{return``}}getScoopContext(e){if(this.localFs)return{getFS:()=>this.localFs}}getSharedFS(){return this.localFs}stopScoop(e){this.send({type:`abort`,scoopJid:e})}async clearQueuedMessages(e){}async deleteQueuedMessage(e,t){}updateModel(){this.send({type:`refresh-model`})}setLocked(e){this.locked=e}setScoopThinkingLevel(e,t){this.send({type:`set-thinking-level`,scoopJid:e,level:t})}async clearAllMessages(){let e=`clear-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,t=new Promise(t=>{this.pendingClearAcks.set(e,t)});this.send({type:`clear-chat`,requestId:e}),await Promise.race([t,new Promise(e=>setTimeout(e,5e3))]),this.pendingClearAcks.delete(e)}clearFilesystem(){this.send({type:`clear-filesystem`})}requestScoopMessages(e){this.send({type:`request-scoop-messages`,scoopJid:e})}async getScoopTranscript(e){let t=`tr-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,n=new Promise(e=>{this.pendingTranscriptRequests.set(t,e)});this.send({type:`request-scoop-transcript`,requestId:t,scoopJid:e});let r=await Promise.race([n,new Promise(e=>setTimeout(()=>e(``),5e3))]);return this.pendingTranscriptRequests.delete(t),r}requestState(){this.send({type:`request-state`});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null);return}p.debug(`Retrying request-state`,{attempt:e}),this.send({type:`request-state`})},500)}isReady(){return this.ready}sprinkleOpHandler=null;forwardLickHandler=null;sendSprinkleLick(e,t,n,r){this.send({type:`sprinkle-lick`,sprinkleName:e,body:t,targetScoop:n,originLabel:r})}sendWebhookEvent(e,t,n){this.send({type:`lick-webhook-event`,webhookId:e,headers:t,body:n})}sendSetFollowerForwarding(e){this.send({type:`set-follower-forwarding`,enabled:e})}sendForwardedLick(e){this.send({type:`inject-forwarded-lick`,event:e})}setForwardLickHandler(e){this.forwardLickHandler=e}sendCherryHostEvent(e,t,n){this.send({type:`lick-cherry-host-event`,cherryRuntimeId:e,name:t,detail:n})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}sendRaw(e){this.send(e)}setupMessageListener(){this.transport.onMessage(e=>{if(e.source!==`offscreen`)return;let t=e.payload;t?.type===`sprinkle-op`&&this.sprinkleOpHandler?this.sprinkleOpHandler(t):this.handleOffscreenMessage(e.payload)})}handleOffscreenMessage(e){switch(e.type){case`offscreen-ready`:this.ready?(p.warn(`Offscreen restarted — re-requesting state`),this.ready=!1):p.info(`Offscreen engine ready`),this.send({type:`request-state`});break;case`agent-event`:this.handleAgentEvent(e);break;case`scoop-status`:this.handleScoopStatus(e);break;case`compaction-state`:this.callbacks.onCompactionStateChange?.(e.scoopJid,e.state);break;case`clear-chat-ack`:{let t=this.pendingClearAcks.get(e.requestId);t&&(this.pendingClearAcks.delete(e.requestId),t());break}case`scoop-created`:this.handleScoopCreated(e);break;case`scoop-list`:this.handleScoopList(e);break;case`state-snapshot`:this.handleStateSnapshot(e);break;case`error`:this.handleError(e);break;case`incoming-message`:this.handleIncomingMessage(e);break;case`scoop-messages-replaced`:{let t=e;this.callbacks.onScoopMessagesReplaced?.(t.scoopJid,t.messages);break}case`scoop-transcript`:{let t=e,n=this.pendingTranscriptRequests.get(t.requestId);n&&(this.pendingTranscriptRequests.delete(t.requestId),n(t.transcript));break}case`tray-runtime-status`:{let t=e;g(t.leader,t.follower);break}case`forward-lick`:this.forwardLickHandler?.(e.event);break;case`terminal-status`:case`terminal-output`:case`terminal-media-preview`:case`terminal-exit`:case`terminal-cleared`:for(let t of this.terminalEventListeners)try{t(e)}catch(e){p.error(`terminal event listener error`,{error:e instanceof Error?e.message:String(e)})}break}}terminalEventListeners=new Set;onTerminalEvent(e){return this.terminalEventListeners.add(e),()=>this.terminalEventListeners.delete(e)}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case`text_delta`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`content_delta`,messageId:t,text:e.text??``});break}case`tool_start`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_use_start`,messageId:t,toolName:e.toolName??``,toolInput:e.toolInput});break}case`tool_end`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_result`,messageId:t,toolName:e.toolName??``,result:e.toolResult??``,isError:e.isError});break}case`tool_ui`:{let t=this.currentMessageId.get(e.scoopJid);t||(t=`scoop-${e.scoopJid}-${h()}`,this.currentMessageId.set(e.scoopJid,t),this.emitToUI({type:`message_start`,messageId:t})),this.emitToUI({type:`tool_ui`,messageId:t,toolName:e.toolName??``,requestId:e.requestId??``,html:e.html??``});break}case`tool_ui_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&this.emitToUI({type:`tool_ui_done`,messageId:t,requestId:e.requestId??``});break}case`response_done`:{let t=this.currentMessageId.get(e.scoopJid);t&&(this.emitToUI({type:`content_done`,messageId:t}),this.currentMessageId.delete(e.scoopJid));break}case`turn_end`:{let t=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${h()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:`turn_end`,messageId:t});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){let t=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(e=>e.name!==t.name||e.jid===t.jid),this.scoops.find(e=>e.jid===t.jid)||this.scoops.push(t),this.scoopStatuses.set(t.jid,e.scoop.status),this.callbacks.onScoopCreated(t)}handleScoopList(e){this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){p.info(`Received state snapshot`,{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(e=>this.msgScoopToRegistered(e));for(let t of e.scoops)this.scoopStatuses.set(t.jid,t.status);e.trayRuntimeStatus&&g(e.trayRuntimeStatus.leader,e.trayRuntimeStatus.follower);let t=!this.ready;t&&(this.ready=!0,this.stateRetryTimer&&=(clearInterval(this.stateRetryTimer),null)),this.callbacks.onScoopListUpdate(e.scoops),t&&this.callbacks.onReady?.()}handleError(e){e.scoopJid===this.selectedScoopJid&&this.emitToUI({type:`error`,error:e.error})}handleIncomingMessage(e){this.callbacks.onIncomingMessage(e.scoopJid,e.message)}msgScoopToRegistered(e){return{jid:e.jid,name:e.name,folder:e.folder,isCone:e.isCone,type:e.isCone?`cone`:`scoop`,requiresTrigger:!e.isCone,assistantLabel:e.assistantLabel,addedAt:new Date().toISOString(),...e.config?{config:{...e.config}}:{}}}emitToUI(e){for(let t of this.eventListeners)try{t(e)}catch(e){p.error(`Listener error`,{error:e instanceof Error?e.message:String(e)})}}send(e){if(this.locked){this.emitToUI({type:`error`,error:`This window is detached. Close it and use the detached tab.`});return}this.transport.send(e)}};function h(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function g(t,r){n({state:t.state,error:t.error,reconnectAttempts:t.reconnectAttempts,session:t.session?{...t.session}:null}),e({state:r.state,joinUrl:r.joinUrl,trayId:r.trayId,error:r.error,lastError:r.lastError,reconnectAttempts:r.reconnectAttempts,attachAttempts:r.attachAttempts,lastAttachCode:r.lastAttachCode,connectingSince:r.connectingSince,lastPingTime:r.lastPingTime})}export{m as OffscreenClient};