sliccy 1.23.0 → 1.23.2

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 (32) hide show
  1. package/dist/ui/assets/{___vite-browser-external_commonjs-proxy-50mizaS1.js → ___vite-browser-external_commonjs-proxy-DJjtBAzT.js} +1 -1
  2. package/dist/ui/assets/anthropic-D2LAO3ec.js +2 -0
  3. package/dist/ui/assets/azure-openai-responses-CRZc4-49.js +1 -0
  4. package/dist/ui/assets/{bsh-watchdog-CczyJzjN.js → bsh-watchdog-DF1jz7YG.js} +1 -1
  5. package/dist/ui/assets/client-DFw1b8C8.js +23 -0
  6. package/dist/ui/assets/github-copilot-headers-CrHPofPv.js +1 -0
  7. package/dist/ui/assets/google-U_C7Pazm.js +1 -0
  8. package/dist/ui/assets/google-gemini-cli-CzBfYt4_.js +2 -0
  9. package/dist/ui/assets/google-shared-FSIbZjLZ.js +2 -0
  10. package/dist/ui/assets/google-vertex-C732IhNh.js +1 -0
  11. package/dist/ui/assets/hash-DMDecQcg.js +1 -0
  12. package/dist/ui/assets/{index-WwWPiryP.js → index-B-xljX2v.js} +1 -1
  13. package/dist/ui/assets/{index-NCsQEpn3.js → index-BKFeHvuQ.js} +1614 -1614
  14. package/dist/ui/assets/{index-BTswoVMz.js → index-BfTbMhIq.js} +1 -1
  15. package/dist/ui/assets/{index-HsoH0Sk6.js → index-CKEflIkf.js} +2 -2
  16. package/dist/ui/assets/{index-Dxn4RFzC.js → index-CNJf5i_6.js} +1 -1
  17. package/dist/ui/assets/{index-CIHgLbGj.js → index-CaNBjh71.js} +1 -1
  18. package/dist/ui/assets/{index-BpDEWpj8.js → index-CeyfbT1z.js} +1 -1
  19. package/dist/ui/assets/{index-Bv_aqUU6.js → index-DknnmEPX.js} +2 -2
  20. package/dist/ui/assets/{index-BQr4jU2K.js → index-YmeV9Jqf.js} +1 -1
  21. package/dist/ui/assets/json-parse-BCE40htG.js +1 -0
  22. package/dist/ui/assets/mistral-BDvM3VUI.js +8 -0
  23. package/dist/ui/assets/{offscreen-client-CH6VFyiS.js → offscreen-client-L-9S-Lfw.js} +1 -1
  24. package/dist/ui/assets/openai-codex-responses-B17sbyI5.js +7 -0
  25. package/dist/ui/assets/openai-completions-4N9csiit.js +6 -0
  26. package/dist/ui/assets/openai-responses-j29whBIs.js +1 -0
  27. package/dist/ui/assets/openai-responses-shared-CNs3k_0q.js +10 -0
  28. package/dist/ui/assets/{sql-wasm-CcBbLZgC.js → sql-wasm-D8k4OLXL.js} +1 -1
  29. package/dist/ui/assets/transform-messages-BkE2P08Y.js +1 -0
  30. package/dist/ui/index.html +1 -1
  31. package/dist/ui/packages/webapp/index.html +1 -1
  32. package/package.json +2 -26
@@ -1 +1 @@
1
- import{c as d}from"./index-NCsQEpn3.js";const i=d("offscreen-client");class h{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;selectedScoopJid=null;constructor(e){this.callbacks=e,this.setupMessageListener()}setLocalFS(e){this.localFs=e}createAgentHandle(){return{sendMessage:(e,s)=>{if(!this.selectedScoopJid){this.emitToUI({type:"error",error:"No scoop selected"});return}this.send({type:"user-message",scoopJid:this.selectedScoopJid,text:e,messageId:s??`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(s=>s.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)==="processing"}async registerScoop(e){this.scoops.find(s=>s.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,"initializing")),this.send({type:"scoop-create",name:e.name,isCone:e.isCone})}async unregisterScoop(e){this.send({type:"scoop-drop",scoopJid:e}),this.scoops=this.scoops.filter(s=>s.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return"";try{const 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,s){}updateModel(){this.send({type:"refresh-model"})}async clearAllMessages(){this.send({type:"clear-chat"})}clearFilesystem(){this.send({type:"clear-filesystem"})}requestState(){this.send({type:"request-state"});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null);return}i.debug("Retrying request-state",{attempt:e}),this.send({type:"request-state"})},500)}isReady(){return this.ready}sprinkleOpHandler=null;sendSprinkleLick(e,s){this.send({type:"sprinkle-lick",sprinkleName:e,body:s})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}setupMessageListener(){chrome.runtime.onMessage.addListener((e,s,t)=>{if(!p(e))return!1;const a=e;if(a.source==="offscreen"){const r=a.payload;if(r?.type==="debug-tabs"){const c=window.__slicc_debug_tabs;c?.(!!r.show)}else r?.type==="sprinkle-op"&&this.sprinkleOpHandler?this.sprinkleOpHandler(r):this.handleOffscreenMessage(a.payload)}return!1})}handleOffscreenMessage(e){switch(e.type){case"offscreen-ready":i.info("Offscreen engine ready"),this.ready||this.send({type:"request-state"});break;case"agent-event":this.handleAgentEvent(e);break;case"scoop-status":this.handleScoopStatus(e);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}}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case"text_delta":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"content_delta",messageId:s,text:e.text??""});break}case"tool_start":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"tool_use_start",messageId:s,toolName:e.toolName??"",toolInput:e.toolInput});break}case"tool_end":{const s=this.currentMessageId.get(e.scoopJid);s&&this.emitToUI({type:"tool_result",messageId:s,toolName:e.toolName??"",result:e.toolResult??"",isError:e.isError});break}case"response_done":{const s=this.currentMessageId.get(e.scoopJid);s&&(this.emitToUI({type:"content_done",messageId:s}),this.currentMessageId.delete(e.scoopJid));break}case"turn_end":{const s=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${n()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:"turn_end",messageId:s});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){const s=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(t=>t.name!==s.name||t.jid===s.jid),this.scoops.find(t=>t.jid===s.jid)||this.scoops.push(s),this.scoopStatuses.set(s.jid,e.scoop.status),this.callbacks.onScoopCreated(s)}handleScoopList(e){this.scoops=e.scoops.map(s=>this.msgScoopToRegistered(s));for(const s of e.scoops)this.scoopStatuses.set(s.jid,s.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){i.info("Received state snapshot",{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(t=>this.msgScoopToRegistered(t));for(const t of e.scoops)this.scoopStatuses.set(t.jid,t.status);const s=!this.ready;s&&(this.ready=!0,this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null)),this.callbacks.onScoopListUpdate(e.scoops),s&&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()}}emitToUI(e){for(const s of this.eventListeners)try{s(e)}catch(t){i.error("Listener error",{error:t instanceof Error?t.message:String(t)})}}send(e){chrome.runtime.sendMessage({source:"panel",payload:e}).catch(s=>{i.error("Failed to send to offscreen",{error:s instanceof Error?s.message:String(s)})})}}function n(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function p(o){return typeof o=="object"&&o!==null&&"source"in o&&"payload"in o}export{h as OffscreenClient};
1
+ import{c as d}from"./index-BKFeHvuQ.js";const i=d("offscreen-client");class h{eventListeners=new Set;callbacks;scoops=[];scoopStatuses=new Map;currentMessageId=new Map;ready=!1;stateRetryTimer=null;localFs=null;selectedScoopJid=null;constructor(e){this.callbacks=e,this.setupMessageListener()}setLocalFS(e){this.localFs=e}createAgentHandle(){return{sendMessage:(e,s)=>{if(!this.selectedScoopJid){this.emitToUI({type:"error",error:"No scoop selected"});return}this.send({type:"user-message",scoopJid:this.selectedScoopJid,text:e,messageId:s??`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(s=>s.jid===e)}isProcessing(e){return this.scoopStatuses.get(e)==="processing"}async registerScoop(e){this.scoops.find(s=>s.name===e.name)||(this.scoops.push(e),this.scoopStatuses.set(e.jid,"initializing")),this.send({type:"scoop-create",name:e.name,isCone:e.isCone})}async unregisterScoop(e){this.send({type:"scoop-drop",scoopJid:e}),this.scoops=this.scoops.filter(s=>s.jid!==e),this.scoopStatuses.delete(e)}createScoopTab(e){}async getGlobalMemory(){if(!this.localFs)return"";try{const 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,s){}updateModel(){this.send({type:"refresh-model"})}async clearAllMessages(){this.send({type:"clear-chat"})}clearFilesystem(){this.send({type:"clear-filesystem"})}requestState(){this.send({type:"request-state"});let e=0;this.stateRetryTimer=setInterval(()=>{if(e++,this.ready||e>20){this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null);return}i.debug("Retrying request-state",{attempt:e}),this.send({type:"request-state"})},500)}isReady(){return this.ready}sprinkleOpHandler=null;sendSprinkleLick(e,s){this.send({type:"sprinkle-lick",sprinkleName:e,body:s})}setSprinkleOpHandler(e){this.sprinkleOpHandler=e}setupMessageListener(){chrome.runtime.onMessage.addListener((e,s,t)=>{if(!p(e))return!1;const a=e;if(a.source==="offscreen"){const r=a.payload;if(r?.type==="debug-tabs"){const c=window.__slicc_debug_tabs;c?.(!!r.show)}else r?.type==="sprinkle-op"&&this.sprinkleOpHandler?this.sprinkleOpHandler(r):this.handleOffscreenMessage(a.payload)}return!1})}handleOffscreenMessage(e){switch(e.type){case"offscreen-ready":i.info("Offscreen engine ready"),this.ready||this.send({type:"request-state"});break;case"agent-event":this.handleAgentEvent(e);break;case"scoop-status":this.handleScoopStatus(e);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}}handleAgentEvent(e){if(e.scoopJid===this.selectedScoopJid)switch(e.eventType){case"text_delta":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"content_delta",messageId:s,text:e.text??""});break}case"tool_start":{let s=this.currentMessageId.get(e.scoopJid);s||(s=`scoop-${e.scoopJid}-${n()}`,this.currentMessageId.set(e.scoopJid,s),this.emitToUI({type:"message_start",messageId:s})),this.emitToUI({type:"tool_use_start",messageId:s,toolName:e.toolName??"",toolInput:e.toolInput});break}case"tool_end":{const s=this.currentMessageId.get(e.scoopJid);s&&this.emitToUI({type:"tool_result",messageId:s,toolName:e.toolName??"",result:e.toolResult??"",isError:e.isError});break}case"response_done":{const s=this.currentMessageId.get(e.scoopJid);s&&(this.emitToUI({type:"content_done",messageId:s}),this.currentMessageId.delete(e.scoopJid));break}case"turn_end":{const s=this.currentMessageId.get(e.scoopJid)??`done-${e.scoopJid}-${n()}`;this.currentMessageId.delete(e.scoopJid),this.emitToUI({type:"turn_end",messageId:s});break}}}handleScoopStatus(e){this.scoopStatuses.set(e.scoopJid,e.status),this.callbacks.onStatusChange(e.scoopJid,e.status)}handleScoopCreated(e){const s=this.msgScoopToRegistered(e.scoop);this.scoops=this.scoops.filter(t=>t.name!==s.name||t.jid===s.jid),this.scoops.find(t=>t.jid===s.jid)||this.scoops.push(s),this.scoopStatuses.set(s.jid,e.scoop.status),this.callbacks.onScoopCreated(s)}handleScoopList(e){this.scoops=e.scoops.map(s=>this.msgScoopToRegistered(s));for(const s of e.scoops)this.scoopStatuses.set(s.jid,s.status);this.callbacks.onScoopListUpdate(e.scoops)}handleStateSnapshot(e){i.info("Received state snapshot",{scoopCount:e.scoops.length}),this.scoops=e.scoops.map(t=>this.msgScoopToRegistered(t));for(const t of e.scoops)this.scoopStatuses.set(t.jid,t.status);const s=!this.ready;s&&(this.ready=!0,this.stateRetryTimer&&(clearInterval(this.stateRetryTimer),this.stateRetryTimer=null)),this.callbacks.onScoopListUpdate(e.scoops),s&&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()}}emitToUI(e){for(const s of this.eventListeners)try{s(e)}catch(t){i.error("Listener error",{error:t instanceof Error?t.message:String(t)})}}send(e){chrome.runtime.sendMessage({source:"panel",payload:e}).catch(s=>{i.error("Failed to send to offscreen",{error:s instanceof Error?s.message:String(s)})})}}function n(){return Date.now().toString(36)+Math.random().toString(36).slice(2,8)}function p(o){return typeof o=="object"&&o!==null&&"source"in o&&"payload"in o}export{h as OffscreenClient};
@@ -0,0 +1,7 @@
1
+ import{A as q,g as O,s as N}from"./index-BKFeHvuQ.js";import{c as M,a as P,p as L}from"./openai-responses-shared-CNs3k_0q.js";import{b as U,c as H}from"./transform-messages-BkE2P08Y.js";import"./hash-DMDecQcg.js";import"./json-parse-BCE40htG.js";let E=null;const J=e=>import(e),K="node:os";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&J(K).then(e=>{E=e});const X="https://chatgpt.com/backend-api",z="https://api.openai.com/auth",v=3,R=1e3,F=new Set(["openai","openai-codex","opencode"]),j=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function V(e,t){return e===429||e===500||e===502||e===503||e===504?!0:/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(t)}function T(e,t){return new Promise((r,n)=>{if(t?.aborted){n(new Error("Request was aborted"));return}const o=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(o),n(new Error("Request was aborted"))})})}const Y=(e,t,r)=>{const n=new q;return(async()=>{const o={role:"assistant",content:[],api:"openai-codex-responses",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{const s=r?.apiKey||O(e.provider)||"";if(!s)throw new Error(`No API key for provider: ${e.provider}`);const i=pe(s);let a=G(e,t,r);const c=await r?.onPayload?.(a,e);c!==void 0&&(a=c);const d=r?.sessionId||ye(),p=we(e.headers,r?.headers,i,s,r?.sessionId),m=me(e.headers,r?.headers,i,s,d),l=JSON.stringify(a),w=r?.transport||"sse";if(w!=="sse"){let h=!1;try{if(await le(Z(e.baseUrl),a,m,o,n,e,()=>{h=!0},r),r?.signal?.aborted)throw new Error("Request was aborted");n.push({type:"done",reason:o.stopReason,message:o}),n.end();return}catch(y){if(w==="websocket"||h)throw y}}let u,f;for(let h=0;h<=v;h++){if(r?.signal?.aborted)throw new Error("Request was aborted");try{if(u=await fetch(W(e.baseUrl),{method:"POST",headers:p,body:l,signal:r?.signal}),u.ok)break;const y=await u.text();if(h<v&&V(u.status,y)){const I=R*2**h;await T(I,r?.signal);continue}const k=new Response(y,{status:u.status,statusText:u.statusText}),x=await fe(k);throw new Error(x.friendlyMessage||x.message)}catch(y){if(y instanceof Error&&(y.name==="AbortError"||y.message==="Request was aborted"))throw new Error("Request was aborted");if(f=y instanceof Error?y:new Error(String(y)),h<v&&!f.message.includes("usage limit")){const k=R*2**h;await T(k,r?.signal);continue}throw f}}if(!u?.ok)throw f??new Error("Failed after retries");if(!u.body)throw new Error("No response body");if(n.push({type:"start",partial:o}),await ee(u,o,n,e),r?.signal?.aborted)throw new Error("Request was aborted");n.push({type:"done",reason:o.stopReason,message:o}),n.end()}catch(s){o.stopReason=r?.signal?.aborted?"aborted":"error",o.errorMessage=s instanceof Error?s.message:String(s),n.push({type:"error",reason:o.stopReason,error:o}),n.end()}})(),n},ke=(e,t,r)=>{const n=r?.apiKey||O(e.provider);if(!n)throw new Error(`No API key for provider: ${e.provider}`);const o=U(e,r,n),s=N(e)?r?.reasoning:H(r?.reasoning);return Y(e,t,{...o,reasoningEffort:s})};function G(e,t,r){const n=M(e,t,F,{includeSystemPrompt:!1}),o={model:e.id,store:!1,stream:!0,instructions:t.systemPrompt,input:n,text:{verbosity:r?.textVerbosity||"medium"},include:["reasoning.encrypted_content"],prompt_cache_key:r?.sessionId,tool_choice:"auto",parallel_tool_calls:!0};return r?.temperature!==void 0&&(o.temperature=r.temperature),t.tools&&(o.tools=P(t.tools,{strict:null})),r?.reasoningEffort!==void 0&&(o.reasoning={effort:Q(e.id,r.reasoningEffort),summary:r.reasoningSummary??"auto"}),o}function Q(e,t){const r=e.includes("/")?e.split("/").pop():e;return(r.startsWith("gpt-5.2")||r.startsWith("gpt-5.3")||r.startsWith("gpt-5.4"))&&t==="minimal"?"low":r==="gpt-5.1"&&t==="xhigh"?"high":r==="gpt-5.1-codex-mini"?t==="high"||t==="xhigh"?"high":"medium":t}function W(e){const r=(e&&e.trim().length>0?e:X).replace(/\/+$/,"");return r.endsWith("/codex/responses")?r:r.endsWith("/codex")?`${r}/responses`:`${r}/codex/responses`}function Z(e){const t=new URL(W(e));return t.protocol==="https:"&&(t.protocol="wss:"),t.protocol==="http:"&&(t.protocol="ws:"),t.toString()}async function ee(e,t,r,n){await L(C(re(e)),t,r,n)}async function*C(e){for await(const t of e){const r=typeof t.type=="string"?t.type:void 0;if(r){if(r==="error"){const n=t.code||"",o=t.message||"";throw new Error(`Codex error: ${o||n||JSON.stringify(t)}`)}if(r==="response.failed"){const n=t.response?.error?.message;throw new Error(n||"Codex response failed")}if(r==="response.done"||r==="response.completed"||r==="response.incomplete"){const n=t.response,o=n&&{...n,status:te(n.status)};yield{...t,type:"response.completed",response:o};return}yield t}}}function te(e){if(typeof e=="string")return j.has(e)?e:void 0}async function*re(e){if(!e.body)return;const t=e.body.getReader(),r=new TextDecoder;let n="";try{for(;;){const{done:o,value:s}=await t.read();if(o)break;n+=r.decode(s,{stream:!0});let i=n.indexOf(`
2
+
3
+ `);for(;i!==-1;){const a=n.slice(0,i);n=n.slice(i+2);const c=a.split(`
4
+ `).filter(d=>d.startsWith("data:")).map(d=>d.slice(5).trim());if(c.length>0){const d=c.join(`
5
+ `).trim();if(d&&d!=="[DONE]")try{yield JSON.parse(d)}catch{}}i=n.indexOf(`
6
+
7
+ `)}}}finally{try{await t.cancel()}catch{}try{t.releaseLock()}catch{}}}const oe="responses_websockets=2026-02-06",ne=300*1e3,b=new Map;function se(){const e=globalThis.WebSocket;return typeof e!="function"?null:e}function ae(e){const t={};for(const[r,n]of e.entries())t[r]=n;return t}function ie(e){const t=e.readyState;return typeof t=="number"?t:void 0}function S(e){const t=ie(e);return t===void 0||t===1}function g(e,t=1e3,r="done"){try{e.close(t,r)}catch{}}function A(e,t){t.idleTimer&&clearTimeout(t.idleTimer),t.idleTimer=setTimeout(()=>{t.busy||(g(t.socket,1e3,"idle_timeout"),b.delete(e))},ne)}async function _(e,t,r){const n=se();if(!n)throw new Error("WebSocket transport is not available in this runtime");const o=ae(t);return delete o["OpenAI-Beta"],new Promise((s,i)=>{let a=!1,c;try{c=new n(e,{headers:o})}catch(u){i(u instanceof Error?u:new Error(String(u)));return}const d=()=>{a||(a=!0,w(),s(c))},p=u=>{const f=$(u);a||(a=!0,w(),i(f))},m=u=>{const f=B(u);a||(a=!0,w(),i(f))},l=()=>{a||(a=!0,w(),c.close(1e3,"aborted"),i(new Error("Request was aborted")))},w=()=>{c.removeEventListener("open",d),c.removeEventListener("error",p),c.removeEventListener("close",m),r?.removeEventListener("abort",l)};c.addEventListener("open",d),c.addEventListener("error",p),c.addEventListener("close",m),r?.addEventListener("abort",l)})}async function ce(e,t,r,n){if(!r){const a=await _(e,t,n);return{socket:a,release:({keep:c}={})=>{if(c===!1){g(a);return}g(a)}}}const o=b.get(r);if(o){if(o.idleTimer&&(clearTimeout(o.idleTimer),o.idleTimer=void 0),!o.busy&&S(o.socket))return o.busy=!0,{socket:o.socket,release:({keep:a}={})=>{if(!a||!S(o.socket)){g(o.socket),b.delete(r);return}o.busy=!1,A(r,o)}};if(o.busy){const a=await _(e,t,n);return{socket:a,release:()=>{g(a)}}}S(o.socket)||(g(o.socket),b.delete(r))}const s=await _(e,t,n),i={socket:s,busy:!0};return b.set(r,i),{socket:s,release:({keep:a}={})=>{if(!a||!S(i.socket)){g(i.socket),i.idleTimer&&clearTimeout(i.idleTimer),b.get(r)===i&&b.delete(r);return}i.busy=!1,A(r,i)}}}function $(e){if(e&&typeof e=="object"&&"message"in e){const t=e.message;if(typeof t=="string"&&t.length>0)return new Error(t)}return new Error("WebSocket error")}function B(e){if(e&&typeof e=="object"){const t="code"in e?e.code:void 0,r="reason"in e?e.reason:void 0,n=typeof t=="number"?` ${t}`:"",o=typeof r=="string"&&r.length>0?` ${r}`:"";return new Error(`WebSocket closed${n}${o}`.trim())}return new Error("WebSocket closed")}async function ue(e){if(typeof e=="string")return e;if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(ArrayBuffer.isView(e)){const t=e;return new TextDecoder().decode(new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}if(e&&typeof e=="object"&&"arrayBuffer"in e){const r=await e.arrayBuffer();return new TextDecoder().decode(new Uint8Array(r))}return null}async function*de(e,t){const r=[];let n=null,o=!1,s=null,i=!1;const a=()=>{if(!n)return;const l=n;n=null,l()},c=l=>{(async()=>{if(!l||typeof l!="object"||!("data"in l))return;const w=await ue(l.data);if(w)try{const u=JSON.parse(w),f=typeof u.type=="string"?u.type:"";(f==="response.completed"||f==="response.done"||f==="response.incomplete")&&(i=!0,o=!0),r.push(u),a()}catch{}})()},d=l=>{s=$(l),o=!0,a()},p=l=>{if(i){o=!0,a();return}s||(s=B(l)),o=!0,a()},m=()=>{s=new Error("Request was aborted"),o=!0,a()};e.addEventListener("message",c),e.addEventListener("error",d),e.addEventListener("close",p),t?.addEventListener("abort",m);try{for(;;){if(t?.aborted)throw new Error("Request was aborted");if(r.length>0){yield r.shift();continue}if(o)break;await new Promise(l=>{n=l})}if(s)throw s;if(!i)throw new Error("WebSocket stream closed before response.completed")}finally{e.removeEventListener("message",c),e.removeEventListener("error",d),e.removeEventListener("close",p),t?.removeEventListener("abort",m)}}async function le(e,t,r,n,o,s,i,a){const{socket:c,release:d}=await ce(e,r,a?.sessionId,a?.signal);let p=!0;try{c.send(JSON.stringify({type:"response.create",...t})),i(),o.push({type:"start",partial:n}),await L(C(de(c,a?.signal)),n,o,s),a?.signal?.aborted&&(p=!1)}catch(m){throw p=!1,m}finally{d({keep:p})}}async function fe(e){const t=await e.text();let r=t||e.statusText||"Request failed",n;try{const s=JSON.parse(t)?.error;if(s){const i=s.code||s.type||"";if(/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(i)||e.status===429){const a=s.plan_type?` (${s.plan_type.toLowerCase()} plan)`:"",c=s.resets_at?Math.max(0,Math.round((s.resets_at*1e3-Date.now())/6e4)):void 0,d=c!==void 0?` Try again in ~${c} min.`:"";n=`You have hit your ChatGPT usage limit${a}.${d}`.trim()}r=s.message||n||r}}catch{}return{message:r,friendlyMessage:n}}function pe(e){try{const t=e.split(".");if(t.length!==3)throw new Error("Invalid token");const n=JSON.parse(atob(t[1]))?.[z]?.chatgpt_account_id;if(!n)throw new Error("No account ID in token");return n}catch{throw new Error("Failed to extract accountId from token")}}function ye(){return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():`codex_${Date.now()}_${Math.random().toString(36).slice(2,10)}`}function D(e,t,r,n){const o=new Headers(e);for(const[i,a]of Object.entries(t||{}))o.set(i,a);o.set("Authorization",`Bearer ${n}`),o.set("chatgpt-account-id",r),o.set("originator","pi");const s=E?`pi (${E.platform()} ${E.release()}; ${E.arch()})`:"pi (browser)";return o.set("User-Agent",s),o}function we(e,t,r,n,o){const s=D(e,t,r,n);return s.set("OpenAI-Beta","responses=experimental"),s.set("accept","text/event-stream"),s.set("content-type","application/json"),o&&s.set("session_id",o),s}function me(e,t,r,n,o){const s=D(e,t,r,n);return s.delete("accept"),s.delete("content-type"),s.delete("OpenAI-Beta"),s.delete("openai-beta"),s.set("OpenAI-Beta",oe),s.set("x-client-request-id",o),s.set("session_id",o),s}export{Y as streamOpenAICodexResponses,ke as streamSimpleOpenAICodexResponses};
@@ -0,0 +1,6 @@
1
+ import{O as C}from"./client-DFw1b8C8.js";import{A as S,g as I,s as M,a as q}from"./index-BKFeHvuQ.js";import{p as v}from"./json-parse-BCE40htG.js";import{t as b,s as x,b as O,c as P}from"./transform-messages-BkE2P08Y.js";import{h as N,b as F}from"./github-copilot-headers-CrHPofPv.js";var T={};function B(e){for(const s of e)if(s.role==="toolResult"||s.role==="assistant"&&s.content.some(t=>t.type==="toolCall"))return!0;return!1}const j=(e,s,t)=>{const n=new S;return(async()=>{const o={role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{const r=t?.apiKey||I(e.provider)||"",i=D(e,s,r,t?.headers);let p=U(e,s,t);const g=await t?.onPayload?.(p,e);g!==void 0&&(p=g);const h=await i.chat.completions.create(p,{signal:t?.signal});n.push({type:"start",partial:o});let a=null;const d=o.content,R=()=>d.length-1,k=f=>{f&&(f.type==="text"?n.push({type:"text_end",contentIndex:R(),content:f.text,partial:o}):f.type==="thinking"?n.push({type:"thinking_end",contentIndex:R(),content:f.thinking,partial:o}):f.type==="toolCall"&&(f.arguments=v(f.partialArgs),delete f.partialArgs,n.push({type:"toolcall_end",contentIndex:R(),toolCall:f,partial:o})))};for await(const f of h){if(!f||typeof f!="object")continue;o.responseId||=f.id,f.usage&&(o.usage=E(f.usage,e));const c=Array.isArray(f.choices)?f.choices[0]:void 0;if(c){if(!f.usage&&c.usage&&(o.usage=E(c.usage,e)),c.finish_reason){const m=K(c.finish_reason);o.stopReason=m.stopReason,m.errorMessage&&(o.errorMessage=m.errorMessage)}if(c.delta){c.delta.content!==null&&c.delta.content!==void 0&&c.delta.content.length>0&&((!a||a.type!=="text")&&(k(a),a={type:"text",text:""},o.content.push(a),n.push({type:"text_start",contentIndex:R(),partial:o})),a.type==="text"&&(a.text+=c.delta.content,n.push({type:"text_delta",contentIndex:R(),delta:c.delta.content,partial:o})));const m=["reasoning_content","reasoning","reasoning_text"];let l=null;for(const u of m)if(c.delta[u]!==null&&c.delta[u]!==void 0&&c.delta[u].length>0&&!l){l=u;break}if(l&&((!a||a.type!=="thinking")&&(k(a),a={type:"thinking",thinking:"",thinkingSignature:l},o.content.push(a),n.push({type:"thinking_start",contentIndex:R(),partial:o})),a.type==="thinking")){const u=c.delta[l];a.thinking+=u,n.push({type:"thinking_delta",contentIndex:R(),delta:u,partial:o})}if(c?.delta?.tool_calls){for(const u of c.delta.tool_calls)if((!a||a.type!=="toolCall"||u.id&&a.id!==u.id)&&(k(a),a={type:"toolCall",id:u.id||"",name:u.function?.name||"",arguments:{},partialArgs:""},o.content.push(a),n.push({type:"toolcall_start",contentIndex:R(),partial:o})),a.type==="toolCall"){u.id&&(a.id=u.id),u.function?.name&&(a.name=u.function.name);let _="";u.function?.arguments&&(_=u.function.arguments,a.partialArgs+=u.function.arguments,a.arguments=v(a.partialArgs)),n.push({type:"toolcall_delta",contentIndex:R(),delta:_,partial:o})}}const y=c.delta.reasoning_details;if(y&&Array.isArray(y)){for(const u of y)if(u.type==="reasoning.encrypted"&&u.id&&u.data){const _=o.content.find(A=>A.type==="toolCall"&&A.id===u.id);_&&(_.thoughtSignature=JSON.stringify(u))}}}}}if(k(a),t?.signal?.aborted)throw new Error("Request was aborted");if(o.stopReason==="aborted")throw new Error("Request was aborted");if(o.stopReason==="error")throw new Error(o.errorMessage||"Provider returned an error stop reason");n.push({type:"done",reason:o.stopReason,message:o}),n.end()}catch(r){for(const p of o.content)delete p.index;o.stopReason=t?.signal?.aborted?"aborted":"error",o.errorMessage=r instanceof Error?r.message:JSON.stringify(r);const i=r?.error?.metadata?.raw;i&&(o.errorMessage+=`
2
+ ${i}`),n.push({type:"error",reason:o.stopReason,error:o}),n.end()}})(),n},X=(e,s,t)=>{const n=t?.apiKey||I(e.provider);if(!n)throw new Error(`No API key for provider: ${e.provider}`);const o=O(e,t,n),r=M(e)?t?.reasoning:P(t?.reasoning),i=t?.toolChoice;return j(e,s,{...o,reasoningEffort:r,toolChoice:i})};function D(e,s,t,n){if(!t){if(!T.OPENAI_API_KEY)throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");t=T.OPENAI_API_KEY}const o={...e.headers};if(e.provider==="github-copilot"){const r=N(s.messages),i=F({messages:s.messages,hasImages:r});Object.assign(o,i)}return n&&Object.assign(o,n),new C({apiKey:t,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:o})}function U(e,s,t){const n=W(e),o=z(e,s,n);G(e,o);const r={model:e.id,messages:o,stream:!0};if(n.supportsUsageInStreaming!==!1&&(r.stream_options={include_usage:!0}),n.supportsStore&&(r.store=!1),t?.maxTokens&&(n.maxTokensField==="max_tokens"?r.max_tokens=t.maxTokens:r.max_completion_tokens=t.maxTokens),t?.temperature!==void 0&&(r.temperature=t.temperature),s.tools?r.tools=$(s.tools,n):B(s.messages)&&(r.tools=[]),t?.toolChoice&&(r.tool_choice=t.toolChoice),n.thinkingFormat==="zai"&&e.reasoning)r.enable_thinking=!!t?.reasoningEffort;else if(n.thinkingFormat==="qwen"&&e.reasoning)r.enable_thinking=!!t?.reasoningEffort;else if(n.thinkingFormat==="qwen-chat-template"&&e.reasoning)r.chat_template_kwargs={enable_thinking:!!t?.reasoningEffort};else if(n.thinkingFormat==="openrouter"&&e.reasoning){const i=r;t?.reasoningEffort?i.reasoning={effort:w(t.reasoningEffort,n.reasoningEffortMap)}:i.reasoning={effort:"none"}}else t?.reasoningEffort&&e.reasoning&&n.supportsReasoningEffort&&(r.reasoning_effort=w(t.reasoningEffort,n.reasoningEffortMap));if(e.baseUrl.includes("openrouter.ai")&&e.compat?.openRouterRouting&&(r.provider=e.compat.openRouterRouting),e.baseUrl.includes("ai-gateway.vercel.sh")&&e.compat?.vercelGatewayRouting){const i=e.compat.vercelGatewayRouting;if(i.only||i.order){const p={};i.only&&(p.only=i.only),i.order&&(p.order=i.order),r.providerOptions={gateway:p}}}return r}function w(e,s){return s[e]??e}function G(e,s){if(!(e.provider!=="openrouter"||!e.id.startsWith("anthropic/")))for(let t=s.length-1;t>=0;t--){const n=s[t];if(n.role!=="user"&&n.role!=="assistant")continue;const o=n.content;if(typeof o=="string"){n.content=[Object.assign({type:"text",text:o},{cache_control:{type:"ephemeral"}})];return}if(Array.isArray(o))for(let r=o.length-1;r>=0;r--){const i=o[r];if(i?.type==="text"){Object.assign(i,{cache_control:{type:"ephemeral"}});return}}}}function z(e,s,t){const n=[],o=p=>{if(p.includes("|")){const[g]=p.split("|");return g.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,40)}return e.provider==="openai"&&p.length>40?p.slice(0,40):p},r=b(s.messages,e,p=>o(p));if(s.systemPrompt){const g=e.reasoning&&t.supportsDeveloperRole?"developer":"system";n.push({role:g,content:x(s.systemPrompt)})}let i=null;for(let p=0;p<r.length;p++){const g=r[p];if(t.requiresAssistantAfterToolResult&&i==="toolResult"&&g.role==="user"&&n.push({role:"assistant",content:"I have processed the tool results."}),g.role==="user")if(typeof g.content=="string")n.push({role:"user",content:x(g.content)});else{const h=g.content.map(d=>d.type==="text"?{type:"text",text:x(d.text)}:{type:"image_url",image_url:{url:`data:${d.mimeType};base64,${d.data}`}}),a=e.input.includes("image")?h:h.filter(d=>d.type!=="image_url");if(a.length===0)continue;n.push({role:"user",content:a})}else if(g.role==="assistant"){const h={role:"assistant",content:t.requiresAssistantAfterToolResult?"":null},d=g.content.filter(l=>l.type==="text").filter(l=>l.text&&l.text.trim().length>0);d.length>0&&(h.content=d.map(l=>x(l.text)).join(""));const k=g.content.filter(l=>l.type==="thinking").filter(l=>l.thinking&&l.thinking.trim().length>0);if(k.length>0)if(t.requiresThinkingAsText){const l=k.map(u=>u.thinking).join(`
3
+
4
+ `),y=h.content;y?y.unshift({type:"text",text:l}):h.content=[{type:"text",text:l}]}else{const l=k[0].thinkingSignature;l&&l.length>0&&(h[l]=k.map(y=>y.thinking).join(`
5
+ `))}const f=g.content.filter(l=>l.type==="toolCall");if(f.length>0){h.tool_calls=f.map(y=>({id:y.id,type:"function",function:{name:y.name,arguments:JSON.stringify(y.arguments)}}));const l=f.filter(y=>y.thoughtSignature).map(y=>{try{return JSON.parse(y.thoughtSignature)}catch{return null}}).filter(Boolean);l.length>0&&(h.reasoning_details=l)}const c=h.content;if(!(c!=null&&c.length>0)&&!h.tool_calls)continue;n.push(h)}else if(g.role==="toolResult"){const h=[];let a=p;for(;a<r.length&&r[a].role==="toolResult";a++){const d=r[a],R=d.content.filter(m=>m.type==="text").map(m=>m.text).join(`
6
+ `),k=d.content.some(m=>m.type==="image"),f=R.length>0,c={role:"tool",content:x(f?R:"(see attached image)"),tool_call_id:d.toolCallId};if(t.requiresToolResultName&&d.toolName&&(c.name=d.toolName),n.push(c),k&&e.input.includes("image"))for(const m of d.content)m.type==="image"&&h.push({type:"image_url",image_url:{url:`data:${m.mimeType};base64,${m.data}`}})}p=a-1,h.length>0?(t.requiresAssistantAfterToolResult&&n.push({role:"assistant",content:"I have processed the tool results."}),n.push({role:"user",content:[{type:"text",text:"Attached image(s) from tool result:"},...h]}),i="user"):i="toolResult";continue}i=g.role}return n}function $(e,s){return e.map(t=>({type:"function",function:{name:t.name,description:t.description,parameters:t.parameters,...s.supportsStrictMode!==!1&&{strict:!1}}}))}function E(e,s){const t=e.prompt_tokens_details?.cached_tokens||0,n=e.completion_tokens_details?.reasoning_tokens||0,o=(e.prompt_tokens||0)-t,r=(e.completion_tokens||0)+n,i={input:o,output:r,cacheRead:t,cacheWrite:0,totalTokens:o+r+t,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}};return q(s,i),i}function K(e){if(e===null)return{stopReason:"stop"};switch(e){case"stop":case"end":return{stopReason:"stop"};case"length":return{stopReason:"length"};case"function_call":case"tool_calls":return{stopReason:"toolUse"};case"content_filter":return{stopReason:"error",errorMessage:"Provider finish_reason: content_filter"};case"network_error":return{stopReason:"error",errorMessage:"Provider finish_reason: network_error"};default:return{stopReason:"error",errorMessage:`Provider finish_reason: ${e}`}}}function J(e){const s=e.provider,t=e.baseUrl,n=s==="zai"||t.includes("api.z.ai"),o=s==="cerebras"||t.includes("cerebras.ai")||s==="xai"||t.includes("api.x.ai")||t.includes("chutes.ai")||t.includes("deepseek.com")||n||s==="opencode"||t.includes("opencode.ai"),r=t.includes("chutes.ai"),i=s==="xai"||t.includes("api.x.ai"),g=(s==="groq"||t.includes("groq.com"))&&e.id==="qwen/qwen3-32b"?{minimal:"default",low:"default",medium:"default",high:"default",xhigh:"default"}:{};return{supportsStore:!o,supportsDeveloperRole:!o,supportsReasoningEffort:!i&&!n,reasoningEffortMap:g,supportsUsageInStreaming:!0,maxTokensField:r?"max_tokens":"max_completion_tokens",requiresToolResultName:!1,requiresAssistantAfterToolResult:!1,requiresThinkingAsText:!1,thinkingFormat:n?"zai":s==="openrouter"||t.includes("openrouter.ai")?"openrouter":"openai",openRouterRouting:{},vercelGatewayRouting:{},supportsStrictMode:!0}}function W(e){const s=J(e);return e.compat?{supportsStore:e.compat.supportsStore??s.supportsStore,supportsDeveloperRole:e.compat.supportsDeveloperRole??s.supportsDeveloperRole,supportsReasoningEffort:e.compat.supportsReasoningEffort??s.supportsReasoningEffort,reasoningEffortMap:e.compat.reasoningEffortMap??s.reasoningEffortMap,supportsUsageInStreaming:e.compat.supportsUsageInStreaming??s.supportsUsageInStreaming,maxTokensField:e.compat.maxTokensField??s.maxTokensField,requiresToolResultName:e.compat.requiresToolResultName??s.requiresToolResultName,requiresAssistantAfterToolResult:e.compat.requiresAssistantAfterToolResult??s.requiresAssistantAfterToolResult,requiresThinkingAsText:e.compat.requiresThinkingAsText??s.requiresThinkingAsText,thinkingFormat:e.compat.thinkingFormat??s.thinkingFormat,openRouterRouting:e.compat.openRouterRouting??{},vercelGatewayRouting:e.compat.vercelGatewayRouting??s.vercelGatewayRouting,supportsStrictMode:e.compat.supportsStrictMode??s.supportsStrictMode}:s}export{z as convertMessages,j as streamOpenAICompletions,X as streamSimpleOpenAICompletions};
@@ -0,0 +1 @@
1
+ import{O as m}from"./client-DFw1b8C8.js";import{A as d,g as u,s as l}from"./index-BKFeHvuQ.js";import{h as g,b as h}from"./github-copilot-headers-CrHPofPv.js";import{p as v,c as R,a as y}from"./openai-responses-shared-CNs3k_0q.js";import{b as _,c as E}from"./transform-messages-BkE2P08Y.js";import"./hash-DMDecQcg.js";import"./json-parse-BCE40htG.js";var c={};const w=new Set(["openai","openai-codex","opencode"]);function A(e){return e||(typeof process<"u"&&c.PI_CACHE_RETENTION==="long"?"long":"short")}function b(e,a){if(a==="long"&&e.includes("api.openai.com"))return"24h"}const I=(e,a,r)=>{const n=new d;return(async()=>{const t={role:"assistant",content:[],api:e.api,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{const s=r?.apiKey||u(e.provider)||"",o=O(e,a,s,r?.headers);let i=P(e,a,r);const p=await r?.onPayload?.(i,e);p!==void 0&&(i=p);const f=await o.responses.create(i,r?.signal?{signal:r.signal}:void 0);if(n.push({type:"start",partial:t}),await v(f,t,n,e,{serviceTier:r?.serviceTier,applyServiceTierPricing:S}),r?.signal?.aborted)throw new Error("Request was aborted");if(t.stopReason==="aborted"||t.stopReason==="error")throw new Error("An unknown error occurred");n.push({type:"done",reason:t.stopReason,message:t}),n.end()}catch(s){for(const o of t.content)delete o.index;t.stopReason=r?.signal?.aborted?"aborted":"error",t.errorMessage=s instanceof Error?s.message:JSON.stringify(s),n.push({type:"error",reason:t.stopReason,error:t}),n.end()}})(),n},W=(e,a,r)=>{const n=r?.apiKey||u(e.provider);if(!n)throw new Error(`No API key for provider: ${e.provider}`);const t=_(e,r,n),s=l(e)?r?.reasoning:E(r?.reasoning);return I(e,a,{...t,reasoningEffort:s})};function O(e,a,r,n){if(!r){if(!c.OPENAI_API_KEY)throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");r=c.OPENAI_API_KEY}const t={...e.headers};if(e.provider==="github-copilot"){const s=g(a.messages),o=h({messages:a.messages,hasImages:s});Object.assign(t,o)}return n&&Object.assign(t,n),new m({apiKey:r,baseURL:e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:t})}function P(e,a,r){const n=R(e,a,w),t=A(r?.cacheRetention),s={model:e.id,input:n,stream:!0,prompt_cache_key:t==="none"?void 0:r?.sessionId,prompt_cache_retention:b(e.baseUrl,t),store:!1};return r?.maxTokens&&(s.max_output_tokens=r?.maxTokens),r?.temperature!==void 0&&(s.temperature=r?.temperature),r?.serviceTier!==void 0&&(s.service_tier=r.serviceTier),a.tools&&(s.tools=y(a.tools)),e.reasoning&&(r?.reasoningEffort||r?.reasoningSummary?(s.reasoning={effort:r?.reasoningEffort||"medium",summary:r?.reasoningSummary||"auto"},s.include=["reasoning.encrypted_content"]):s.reasoning={effort:"none"}),s}function T(e){switch(e){case"flex":return .5;case"priority":return 2;default:return 1}}function S(e,a){const r=T(a);r!==1&&(e.cost.input*=r,e.cost.output*=r,e.cost.cacheRead*=r,e.cost.cacheWrite*=r,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite)}export{I as streamOpenAIResponses,W as streamSimpleOpenAIResponses};
@@ -0,0 +1,10 @@
1
+ import{a as $}from"./index-BKFeHvuQ.js";import{s as S}from"./hash-DMDecQcg.js";import{p as x}from"./json-parse-BCE40htG.js";import{t as v,s as _}from"./transform-messages-BkE2P08Y.js";function C(o,t){const l={v:1,id:o};return t&&(l.phase=t),JSON.stringify(l)}function T(o){if(o){if(o.startsWith("{"))try{const t=JSON.parse(o);if(t.v===1&&typeof t.id=="string")return t.phase==="commentary"||t.phase==="final_answer"?{id:t.id,phase:t.phase}:{id:t.id}}catch{}return{id:o}}}function b(o,t,l,h){const y=[],s=n=>{const r=n.replace(/[^a-zA-Z0-9_-]/g,"_");return(r.length>64?r.slice(0,64):r).replace(/_+$/,"")},i=n=>{const r=`fc_${S(n)}`;return r.length>64?r.slice(0,64):r},k=(n,r,m)=>{if(!l.has(o.provider)||!n.includes("|"))return s(n);const[f,g]=n.split("|"),d=s(f);let p=m.provider!==o.provider||m.api!==o.api?i(g):s(g);return p.startsWith("fc_")||(p=s(`fc_${p}`)),`${d}|${p}`},u=v(t.messages,o,k);if((h?.includeSystemPrompt??!0)&&t.systemPrompt){const n=o.reasoning?"developer":"system";y.push({role:n,content:_(t.systemPrompt)})}let e=0;for(const n of u){if(n.role==="user")if(typeof n.content=="string")y.push({role:"user",content:[{type:"input_text",text:_(n.content)}]});else{const r=n.content.map(f=>f.type==="text"?{type:"input_text",text:_(f.text)}:{type:"input_image",detail:"auto",image_url:`data:${f.mimeType};base64,${f.data}`}),m=o.input.includes("image")?r:r.filter(f=>f.type!=="input_image");if(m.length===0)continue;y.push({role:"user",content:m})}else if(n.role==="assistant"){const r=[],m=n,f=m.model!==o.id&&m.provider===o.provider&&m.api===o.api;for(const g of n.content)if(g.type==="thinking"){if(g.thinkingSignature){const d=JSON.parse(g.thinkingSignature);r.push(d)}}else if(g.type==="text"){const d=g,c=T(d.textSignature);let p=c?.id;p?p.length>64&&(p=`msg_${S(p)}`):p=`msg_${e}`,r.push({type:"message",role:"assistant",content:[{type:"output_text",text:_(d.text),annotations:[]}],status:"completed",id:p,phase:c?.phase})}else if(g.type==="toolCall"){const d=g,[c,p]=d.id.split("|");let I=p;f&&I?.startsWith("fc_")&&(I=void 0),r.push({type:"function_call",id:I,call_id:c,name:d.name,arguments:JSON.stringify(d.arguments)})}if(r.length===0)continue;y.push(...r)}else if(n.role==="toolResult"){const r=n.content.filter(c=>c.type==="text").map(c=>c.text).join(`
2
+ `),m=n.content.some(c=>c.type==="image"),f=r.length>0,[g]=n.toolCallId.split("|");let d;if(m&&o.input.includes("image")){const c=[];f&&c.push({type:"input_text",text:_(r)});for(const p of n.content)p.type==="image"&&c.push({type:"input_image",detail:"auto",image_url:`data:${p.mimeType};base64,${p.data}`});d=c}else d=_(f?r:"(see attached image)");y.push({type:"function_call_output",call_id:g,output:d})}e++}return y}function M(o,t){const l=t?.strict===void 0?!1:t.strict;return o.map(h=>({type:"function",name:h.name,description:h.description,parameters:h.parameters,strict:l}))}async function N(o,t,l,h,y){let s=null,i=null;const k=t.content,u=()=>k.length-1;for await(const a of o)if(a.type==="response.created")t.responseId=a.response.id;else if(a.type==="response.output_item.added"){const e=a.item;e.type==="reasoning"?(s=e,i={type:"thinking",thinking:""},t.content.push(i),l.push({type:"thinking_start",contentIndex:u(),partial:t})):e.type==="message"?(s=e,i={type:"text",text:""},t.content.push(i),l.push({type:"text_start",contentIndex:u(),partial:t})):e.type==="function_call"&&(s=e,i={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},partialJson:e.arguments||""},t.content.push(i),l.push({type:"toolcall_start",contentIndex:u(),partial:t}))}else if(a.type==="response.reasoning_summary_part.added")s&&s.type==="reasoning"&&(s.summary=s.summary||[],s.summary.push(a.part));else if(a.type==="response.reasoning_summary_text.delta"){if(s?.type==="reasoning"&&i?.type==="thinking"){s.summary=s.summary||[];const e=s.summary[s.summary.length-1];e&&(i.thinking+=a.delta,e.text+=a.delta,l.push({type:"thinking_delta",contentIndex:u(),delta:a.delta,partial:t}))}}else if(a.type==="response.reasoning_summary_part.done"){if(s?.type==="reasoning"&&i?.type==="thinking"){s.summary=s.summary||[];const e=s.summary[s.summary.length-1];e&&(i.thinking+=`
3
+
4
+ `,e.text+=`
5
+
6
+ `,l.push({type:"thinking_delta",contentIndex:u(),delta:`
7
+
8
+ `,partial:t}))}}else if(a.type==="response.content_part.added")s?.type==="message"&&(s.content=s.content||[],(a.part.type==="output_text"||a.part.type==="refusal")&&s.content.push(a.part));else if(a.type==="response.output_text.delta"){if(s?.type==="message"&&i?.type==="text"){if(!s.content||s.content.length===0)continue;const e=s.content[s.content.length-1];e?.type==="output_text"&&(i.text+=a.delta,e.text+=a.delta,l.push({type:"text_delta",contentIndex:u(),delta:a.delta,partial:t}))}}else if(a.type==="response.refusal.delta"){if(s?.type==="message"&&i?.type==="text"){if(!s.content||s.content.length===0)continue;const e=s.content[s.content.length-1];e?.type==="refusal"&&(i.text+=a.delta,e.refusal+=a.delta,l.push({type:"text_delta",contentIndex:u(),delta:a.delta,partial:t}))}}else if(a.type==="response.function_call_arguments.delta")s?.type==="function_call"&&i?.type==="toolCall"&&(i.partialJson+=a.delta,i.arguments=x(i.partialJson),l.push({type:"toolcall_delta",contentIndex:u(),delta:a.delta,partial:t}));else if(a.type==="response.function_call_arguments.done")s?.type==="function_call"&&i?.type==="toolCall"&&(i.partialJson=a.arguments,i.arguments=x(i.partialJson));else if(a.type==="response.output_item.done"){const e=a.item;if(e.type==="reasoning"&&i?.type==="thinking")i.thinking=e.summary?.map(n=>n.text).join(`
9
+
10
+ `)||"",i.thinkingSignature=JSON.stringify(e),l.push({type:"thinking_end",contentIndex:u(),content:i.thinking,partial:t}),i=null;else if(e.type==="message"&&i?.type==="text")i.text=e.content.map(n=>n.type==="output_text"?n.text:n.refusal).join(""),i.textSignature=C(e.id,e.phase??void 0),l.push({type:"text_end",contentIndex:u(),content:i.text,partial:t}),i=null;else if(e.type==="function_call"){const n=i?.type==="toolCall"&&i.partialJson?x(i.partialJson):x(e.arguments||"{}"),r={type:"toolCall",id:`${e.call_id}|${e.id}`,name:e.name,arguments:n};i=null,l.push({type:"toolcall_end",contentIndex:u(),toolCall:r,partial:t})}}else if(a.type==="response.completed"){const e=a.response;if(e?.id&&(t.responseId=e.id),e?.usage){const n=e.usage.input_tokens_details?.cached_tokens||0;t.usage={input:(e.usage.input_tokens||0)-n,output:e.usage.output_tokens||0,cacheRead:n,cacheWrite:0,totalTokens:e.usage.total_tokens||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}}}if($(h,t.usage),y?.applyServiceTierPricing){const n=e?.service_tier??y.serviceTier;y.applyServiceTierPricing(t.usage,n)}t.stopReason=w(e?.status),t.content.some(n=>n.type==="toolCall")&&t.stopReason==="stop"&&(t.stopReason="toolUse")}else{if(a.type==="error")throw new Error(`Error Code ${a.code}: ${a.message}`||"Unknown error");if(a.type==="response.failed"){const e=a.response?.error,n=a.response?.incomplete_details,r=e?`${e.code||"unknown"}: ${e.message||"no message"}`:n?.reason?`incomplete: ${n.reason}`:"Unknown error (no error details in response)";throw new Error(r)}}}function w(o){if(!o)return"stop";switch(o){case"completed":return"stop";case"incomplete":return"length";case"failed":case"cancelled":return"error";case"in_progress":case"queued":return"stop";default:{const t=o;throw new Error(`Unhandled stop reason: ${t}`)}}}export{M as a,b as c,N as p};
@@ -1,2 +1,2 @@
1
- import{A as nn}from"./index-NCsQEpn3.js";import{r as nt}from"./___vite-browser-external_commonjs-proxy-50mizaS1.js";function on(j,De){for(var z=0;z<De.length;z++){const Q=De[z];if(typeof Q!="string"&&!Array.isArray(Q)){for(const F in Q)if(F!=="default"&&!(F in j)){const ie=Object.getOwnPropertyDescriptor(Q,F);ie&&Object.defineProperty(j,F,ie.get?ie:{enumerable:!0,get:()=>Q[F]})}}}return Object.freeze(Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}))}var hr={exports:{}},it;function an(){return it||(it=1,(function(j,De){var z=void 0,Q=function(F){return z||(z=new Promise(function(ie,at){var I=typeof F<"u"?F:{},mr=I.onAbort;I.onAbort=function(e){at(new Error(e)),mr&&mr(e)},I.postRun=I.postRun||[],I.postRun.push(function(){ie(I)}),j=void 0;var s;s||=typeof I<"u"?I:{};var ut=!!globalThis.window,Ie=!!globalThis.WorkerGlobalScope,de=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";s.onRuntimeInitialized=function(){function e(o,l){switch(typeof l){case"boolean":rn(o,l?1:0);break;case"number":Ht(o,l);break;case"string":Kt(o,l,-1,-1);break;case"object":if(l===null)Kr(o);else if(l.length!=null){var h=Le(l.length);q.set(l,h),en(o,h,l.length,-1),ce(h)}else Ue(o,"Wrong API use : tried to return a value of an unknown type ("+l+").",-1);break;default:Kr(o)}}function r(o,l){for(var h=[],m=0;m<o;m+=1){var w=W(l+4*m,"i32"),y=Yt(w);if(y===1||y===2)w=Jt(w);else if(y===3)w=Gt(w);else if(y===4){y=w,w=Ct(y),y=Zt(y);for(var T=new Uint8Array(w),L=0;L<w;L+=1)T[L]=q[y+L];w=T}else w=null;h.push(w)}return h}function t(o,l){this.Qa=o,this.db=l,this.Oa=1,this.lb=[]}function n(o,l){if(this.db=l,this.eb=Oe(o),this.eb===null)throw Error("Unable to allocate memory for the SQL string");this.kb=this.eb,this.Za=this.qb=null}function i(o){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),o!=null){var l=this.filename,h="/",m=l;if(h&&(h=typeof h=="string"?h:Je(h),m=l?Ce(h+"/"+l):h),l=qr(!0,!0),m=kt(m,l),o){if(typeof o=="string"){h=Array(o.length);for(var w=0,y=o.length;w<y;++w)h[w]=o.charCodeAt(w);o=h}Ne(m,l|146),h=ne(m,577),Qr(h,o,0,o.length,0),nr(h),Ne(m,l)}}this.handleError(c(this.filename,a)),this.db=W(a,"i32"),rt(this.db),this.fb={},this.Sa={}}var a=H(4),u=s.cwrap,c=u("sqlite3_open","number",["string","number"]),b=u("sqlite3_close_v2","number",["number"]),p=u("sqlite3_exec","number",["number","string","number","number","number"]),g=u("sqlite3_changes","number",["number"]),M=u("sqlite3_prepare_v2","number",["number","string","number","number","number"]),Cr=u("sqlite3_sql","string",["number"]),Ot=u("sqlite3_normalized_sql","string",["number"]),Gr=u("sqlite3_prepare_v2","number",["number","number","number","number","number"]),Lt=u("sqlite3_bind_text","number",["number","number","number","number","number"]),Zr=u("sqlite3_bind_blob","number",["number","number","number","number","number"]),xt=u("sqlite3_bind_double","number",["number","number","number"]),Tt=u("sqlite3_bind_int","number",["number","number","number"]),Pt=u("sqlite3_bind_parameter_index","number",["number","string"]),Ut=u("sqlite3_step","number",["number"]),Dt=u("sqlite3_errmsg","string",["number"]),It=u("sqlite3_column_count","number",["number"]),Wt=u("sqlite3_data_count","number",["number"]),jt=u("sqlite3_column_double","number",["number","number"]),Jr=u("sqlite3_column_text","string",["number","number"]),zt=u("sqlite3_column_blob","number",["number","number"]),Qt=u("sqlite3_column_bytes","number",["number","number"]),Ft=u("sqlite3_column_type","number",["number","number"]),$t=u("sqlite3_column_name","string",["number","number"]),Bt=u("sqlite3_reset","number",["number"]),Vt=u("sqlite3_clear_bindings","number",["number"]),Xt=u("sqlite3_finalize","number",["number"]),Hr=u("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),Yt=u("sqlite3_value_type","number",["number"]),Ct=u("sqlite3_value_bytes","number",["number"]),Gt=u("sqlite3_value_text","string",["number"]),Zt=u("sqlite3_value_blob","number",["number"]),Jt=u("sqlite3_value_double","number",["number"]),Ht=u("sqlite3_result_double","",["number","number"]),Kr=u("sqlite3_result_null","",["number"]),Kt=u("sqlite3_result_text","",["number","string","number","number"]),en=u("sqlite3_result_blob","",["number","number","number","number"]),rn=u("sqlite3_result_int","",["number","number"]),Ue=u("sqlite3_result_error","",["number","string","number"]),et=u("sqlite3_aggregate_context","number",["number","number"]),rt=u("RegisterExtensionFunctions","number",["number"]),tt=u("sqlite3_update_hook","number",["number","number","number"]);t.prototype.bind=function(o){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(o)?this.Cb(o):o!=null&&typeof o=="object"?this.Db(o):!0},t.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var o=Ut(this.Qa);switch(o){case 100:return!0;case 101:return!1;default:throw this.db.handleError(o)}},t.prototype.wb=function(o){return o==null&&(o=this.Oa,this.Oa+=1),jt(this.Qa,o)},t.prototype.Gb=function(o){if(o==null&&(o=this.Oa,this.Oa+=1),o=Jr(this.Qa,o),typeof BigInt!="function")throw Error("BigInt is not supported");return BigInt(o)},t.prototype.Hb=function(o){return o==null&&(o=this.Oa,this.Oa+=1),Jr(this.Qa,o)},t.prototype.getBlob=function(o){o==null&&(o=this.Oa,this.Oa+=1);var l=Qt(this.Qa,o);o=zt(this.Qa,o);for(var h=new Uint8Array(l),m=0;m<l;m+=1)h[m]=q[o+m];return h},t.prototype.get=function(o,l){l=l||{},o!=null&&this.bind(o)&&this.step(),o=[];for(var h=Wt(this.Qa),m=0;m<h;m+=1)switch(Ft(this.Qa,m)){case 1:var w=l.useBigInt?this.Gb(m):this.wb(m);o.push(w);break;case 2:o.push(this.wb(m));break;case 3:o.push(this.Hb(m));break;case 4:o.push(this.getBlob(m));break;default:o.push(null)}return o},t.prototype.getColumnNames=function(){for(var o=[],l=It(this.Qa),h=0;h<l;h+=1)o.push($t(this.Qa,h));return o},t.prototype.getAsObject=function(o,l){o=this.get(o,l),l=this.getColumnNames();for(var h={},m=0;m<l.length;m+=1)h[l[m]]=o[m];return h},t.prototype.getSQL=function(){return Cr(this.Qa)},t.prototype.getNormalizedSQL=function(){return Ot(this.Qa)},t.prototype.run=function(o){return o!=null&&this.bind(o),this.step(),this.reset()},t.prototype.tb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1),o=Oe(o),this.lb.push(o),this.db.handleError(Lt(this.Qa,l,o,-1,0))},t.prototype.Bb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1);var h=Le(o.length);q.set(o,h),this.lb.push(h),this.db.handleError(Zr(this.Qa,l,h,o.length,0))},t.prototype.sb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1),this.db.handleError((o===(o|0)?Tt:xt)(this.Qa,l,o))},t.prototype.Eb=function(o){o==null&&(o=this.Oa,this.Oa+=1),Zr(this.Qa,o,0,0,0)},t.prototype.ub=function(o,l){switch(l==null&&(l=this.Oa,this.Oa+=1),typeof o){case"string":this.tb(o,l);return;case"number":this.sb(o,l);return;case"bigint":this.tb(o.toString(),l);return;case"boolean":this.sb(o+0,l);return;case"object":if(o===null){this.Eb(l);return}if(o.length!=null){this.Bb(o,l);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+o+")."},t.prototype.Db=function(o){var l=this;return Object.keys(o).forEach(function(h){var m=Pt(l.Qa,h);m!==0&&l.ub(o[h],m)}),!0},t.prototype.Cb=function(o){for(var l=0;l<o.length;l+=1)this.ub(o[l],l+1);return!0},t.prototype.reset=function(){return this.freemem(),Vt(this.Qa)===0&&Bt(this.Qa)===0},t.prototype.freemem=function(){for(var o;(o=this.lb.pop())!==void 0;)ce(o)},t.prototype.free=function(){this.freemem();var o=Xt(this.Qa)===0;return delete this.db.fb[this.Qa],this.Qa=0,o},n.prototype.next=function(){if(this.eb===null)return{done:!0};if(this.Za!==null&&(this.Za.free(),this.Za=null),!this.db.db)throw this.nb(),Error("Database closed");var o=Te(),l=H(4);le(a),le(l);try{this.db.handleError(Gr(this.db.db,this.kb,-1,a,l)),this.kb=W(l,"i32");var h=W(a,"i32");return h===0?(this.nb(),{done:!0}):(this.Za=new t(h,this.db),this.db.fb[h]=this.Za,{value:this.Za,done:!1})}catch(m){throw this.qb=E(this.kb),this.nb(),m}finally{xe(o)}},n.prototype.nb=function(){ce(this.eb),this.eb=null},n.prototype.getRemainingSQL=function(){return this.qb!==null?this.qb:E(this.kb)},typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(n.prototype[Symbol.iterator]=function(){return this}),i.prototype.run=function(o,l){if(!this.db)throw"Database closed";if(l){o=this.prepare(o,l);try{o.step()}finally{o.free()}}else this.handleError(p(this.db,o,0,0,a));return this},i.prototype.exec=function(o,l,h){if(!this.db)throw"Database closed";var m=null,w=null,y=null;try{y=w=Oe(o);var T=H(4);for(o=[];W(y,"i8")!==0;){le(a),le(T),this.handleError(Gr(this.db,y,-1,a,T));var L=W(a,"i32");if(y=W(T,"i32"),L!==0){var R=null;for(m=new t(L,this),l!=null&&m.bind(l);m.step();)R===null&&(R={columns:m.getColumnNames(),values:[]},o.push(R)),R.values.push(m.get(null,h));m.free()}}return o}catch(P){throw m&&m.free(),P}finally{w&&ce(w)}},i.prototype.each=function(o,l,h,m,w){typeof l=="function"&&(m=h,h=l,l=void 0),o=this.prepare(o,l);try{for(;o.step();)h(o.getAsObject(null,w))}finally{o.free()}if(typeof m=="function")return m()},i.prototype.prepare=function(o,l){if(le(a),this.handleError(M(this.db,o,-1,a,0)),o=W(a,"i32"),o===0)throw"Nothing to prepare";var h=new t(o,this);return l!=null&&h.bind(l),this.fb[o]=h},i.prototype.iterateStatements=function(o){return new n(o,this)},i.prototype.export=function(){Object.values(this.fb).forEach(function(l){l.free()}),Object.values(this.Sa).forEach(V),this.Sa={},this.handleError(b(this.db));var o=Et(this.filename);return this.handleError(c(this.filename,a)),this.db=W(a,"i32"),rt(this.db),o},i.prototype.close=function(){this.db!==null&&(Object.values(this.fb).forEach(function(o){o.free()}),Object.values(this.Sa).forEach(V),this.Sa={},this.Ya&&(V(this.Ya),this.Ya=void 0),this.handleError(b(this.db)),Dr("/"+this.filename),this.db=null)},i.prototype.handleError=function(o){if(o===0)return null;throw o=Dt(this.db),Error(o)},i.prototype.getRowsModified=function(){return g(this.db)},i.prototype.create_function=function(o,l){Object.prototype.hasOwnProperty.call(this.Sa,o)&&(V(this.Sa[o]),delete this.Sa[o]);var h=me(function(m,w,y){w=r(w,y);try{var T=l.apply(null,w)}catch(L){Ue(m,L,-1);return}e(m,T)},"viii");return this.Sa[o]=h,this.handleError(Hr(this.db,o,l.length,1,0,h,0,0,0)),this},i.prototype.create_aggregate=function(o,l){var h=l.init||function(){return null},m=l.finalize||function(R){return R},w=l.step;if(!w)throw"An aggregate function must have a step function in "+o;var y={};Object.hasOwnProperty.call(this.Sa,o)&&(V(this.Sa[o]),delete this.Sa[o]),l=o+"__finalize",Object.hasOwnProperty.call(this.Sa,l)&&(V(this.Sa[l]),delete this.Sa[l]);var T=me(function(R,P,fr){var K=et(R,1);Object.hasOwnProperty.call(y,K)||(y[K]=h()),P=r(P,fr),P=[y[K]].concat(P);try{y[K]=w.apply(null,P)}catch(tn){delete y[K],Ue(R,tn,-1)}},"viii"),L=me(function(R){var P=et(R,1);try{var fr=m(y[P])}catch(K){delete y[P],Ue(R,K,-1);return}e(R,fr),delete y[P]},"vi");return this.Sa[o]=T,this.Sa[l]=L,this.handleError(Hr(this.db,o,w.length-1,1,0,0,T,L,0)),this},i.prototype.updateHook=function(o){return this.Ya&&(tt(this.db,0,0),V(this.Ya),this.Ya=void 0),o?(this.Ya=me(function(l,h,m,w,y){switch(h){case 18:l="insert";break;case 23:l="update";break;case 9:l="delete";break;default:throw"unknown operationCode in updateHook callback: "+h}if(m=E(m),w=E(w),y>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";o(l,m,w,Number(y))},"viiiij"),tt(this.db,this.Ya,0),this):this},s.Database=i};var We="./this.program",pe=(e,r)=>{throw r},je=globalThis.document?.currentScript?.src;typeof __filename<"u"?je=__filename:Ie&&(je=self.location.href);var we="",ze,be;if(de){var Qe=nt;we=__dirname+"/",be=e=>(e=ve(e)?new URL(e):e,Qe.readFileSync(e)),ze=async e=>(e=ve(e)?new URL(e):e,Qe.readFileSync(e,void 0)),1<process.argv.length&&(We=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),j.exports=s,pe=(e,r)=>{throw process.exitCode=e,r}}else if(ut||Ie){try{we=new URL(".",je).href}catch{}Ie&&(be=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),ze=async e=>{if(ve(e))return new Promise((t,n)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{i.status==200||i.status==0&&i.response?t(i.response):n(i.status)},i.onerror=n,i.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw Error(r.status+" : "+r.url)}}var Fe=console.log.bind(console),Y=console.error.bind(console),oe,ye=!1,$e,ve=e=>e.startsWith("file://"),q,N,ae,k,v,Be,Ve,x;function cr(){var e=Pe.buffer;q=new Int8Array(e),ae=new Int16Array(e),N=new Uint8Array(e),k=new Int32Array(e),v=new Uint32Array(e),Be=new Float32Array(e),Ve=new Float64Array(e),x=new BigInt64Array(e),new BigUint64Array(e)}function ue(e){throw s.onAbort?.(e),e="Aborted("+e+")",Y(e),ye=!0,new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.")}var Xe;async function st(e){if(!oe)try{var r=await ze(e);return new Uint8Array(r)}catch{}if(e==Xe&&oe)e=new Uint8Array(oe);else if(be)e=be(e);else throw"both async and sync fetching of the wasm failed";return e}async function lt(e,r){try{var t=await st(e);return await WebAssembly.instantiate(t,r)}catch(n){Y(`failed to asynchronously prepare wasm: ${n}`),ue(n)}}async function ft(e){var r=Xe;if(!oe&&!ve(r)&&!de)try{var t=fetch(r,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(t,e)}catch(n){Y(`wasm streaming compile failed: ${n}`),Y("falling back to ArrayBuffer instantiation")}return lt(r,e)}class Ye{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var dr=e=>{for(;0<e.length;)e.shift()(s)},pr=[],wr=[],ht=()=>{var e=s.preRun.shift();wr.push(e)},C=0,se=null;function W(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return q[e];case"i8":return q[e];case"i16":return ae[e>>1];case"i32":return k[e>>2];case"i64":return x[e>>3];case"float":return Be[e>>2];case"double":return Ve[e>>3];case"*":return v[e>>2];default:ue(`invalid type for getValue: ${r}`)}}var _e=!0;function le(e){var r="i32";switch(r.endsWith("*")&&(r="*"),r){case"i1":q[e]=0;break;case"i8":q[e]=0;break;case"i16":ae[e>>1]=0;break;case"i32":k[e>>2]=0;break;case"i64":x[e>>3]=BigInt(0);break;case"float":Be[e>>2]=0;break;case"double":Ve[e>>3]=0;break;case"*":v[e>>2]=0;break;default:ue(`invalid type for setValue: ${r}`)}}var br=new TextDecoder,yr=(e,r,t,n)=>{if(t=r+t,n)return t;for(;e[r]&&!(r>=t);)++r;return r},E=(e,r,t)=>e?br.decode(N.subarray(e,yr(N,e,r,t))):"",vr=(e,r)=>{for(var t=0,n=e.length-1;0<=n;n--){var i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},Ce=e=>{var r=e.charAt(0)==="/",t=e.slice(-1)==="/";return(e=vr(e.split("/").filter(n=>!!n),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},_r=e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=r[0],r=r[1],!e&&!r?".":(r&&=r.slice(0,-1),e+r)},ge=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],mt=()=>{if(de){var e=nt;return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},gr=e=>{(gr=mt())(e)},ct=(...e)=>{for(var r="",t=!1,n=e.length-1;-1<=n&&!t;n--){if(t=0<=n?e[n]:"/",typeof t!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";r=t+"/"+r,t=t.charAt(0)==="/"}return r=vr(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},ke=e=>{var r=yr(e,0);return br.decode(e.buffer?e.subarray(0,r):new Uint8Array(e.slice(0,r)))},Ge=[],ee=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);127>=n?r++:2047>=n?r+=2:55296<=n&&57343>=n?(r+=4,++t):r+=3}return r},U=(e,r,t,n)=>{if(!(0<n))return 0;var i=t;n=t+n-1;for(var a=0;a<e.length;++a){var u=e.codePointAt(a);if(127>=u){if(t>=n)break;r[t++]=u}else if(2047>=u){if(t+1>=n)break;r[t++]=192|u>>6,r[t++]=128|u&63}else if(65535>=u){if(t+2>=n)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|u&63}else{if(t+3>=n)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|u&63,a++}}return r[t]=0,t-i},kr=[];function Er(e,r){kr[e]={input:[],output:[],cb:r},rr(e,dt)}var dt={open(e){var r=kr[e.node.rdev];if(!r)throw new f(43);e.tty=r,e.seekable=!1},close(e){e.tty.cb.fsync(e.tty)},fsync(e){e.tty.cb.fsync(e.tty)},read(e,r,t,n){if(!e.tty||!e.tty.cb.xb)throw new f(60);for(var i=0,a=0;a<n;a++){try{var u=e.tty.cb.xb(e.tty)}catch{throw new f(29)}if(u===void 0&&i===0)throw new f(6);if(u==null)break;i++,r[t+a]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,n){if(!e.tty||!e.tty.cb.rb)throw new f(60);try{for(var i=0;i<n;i++)e.tty.cb.rb(e.tty,r[t+i])}catch{throw new f(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},pt={xb(){e:{if(!Ge.length){var e=null;if(de){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=Qe.readSync(n,r,0,256)}catch(i){if(i.toString().includes("EOF"))t=0;else throw i}0<t&&(e=r.slice(0,t).toString("utf-8"))}else globalThis.window?.prompt&&(e=window.prompt("Input: "),e!==null&&(e+=`
1
+ import{J as nn}from"./index-BKFeHvuQ.js";import{r as nt}from"./___vite-browser-external_commonjs-proxy-DJjtBAzT.js";function on(j,De){for(var z=0;z<De.length;z++){const Q=De[z];if(typeof Q!="string"&&!Array.isArray(Q)){for(const F in Q)if(F!=="default"&&!(F in j)){const ie=Object.getOwnPropertyDescriptor(Q,F);ie&&Object.defineProperty(j,F,ie.get?ie:{enumerable:!0,get:()=>Q[F]})}}}return Object.freeze(Object.defineProperty(j,Symbol.toStringTag,{value:"Module"}))}var hr={exports:{}},it;function an(){return it||(it=1,(function(j,De){var z=void 0,Q=function(F){return z||(z=new Promise(function(ie,at){var I=typeof F<"u"?F:{},mr=I.onAbort;I.onAbort=function(e){at(new Error(e)),mr&&mr(e)},I.postRun=I.postRun||[],I.postRun.push(function(){ie(I)}),j=void 0;var s;s||=typeof I<"u"?I:{};var ut=!!globalThis.window,Ie=!!globalThis.WorkerGlobalScope,de=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";s.onRuntimeInitialized=function(){function e(o,l){switch(typeof l){case"boolean":rn(o,l?1:0);break;case"number":Ht(o,l);break;case"string":Kt(o,l,-1,-1);break;case"object":if(l===null)Kr(o);else if(l.length!=null){var h=Le(l.length);q.set(l,h),en(o,h,l.length,-1),ce(h)}else Ue(o,"Wrong API use : tried to return a value of an unknown type ("+l+").",-1);break;default:Kr(o)}}function r(o,l){for(var h=[],m=0;m<o;m+=1){var w=W(l+4*m,"i32"),y=Yt(w);if(y===1||y===2)w=Jt(w);else if(y===3)w=Gt(w);else if(y===4){y=w,w=Ct(y),y=Zt(y);for(var T=new Uint8Array(w),L=0;L<w;L+=1)T[L]=q[y+L];w=T}else w=null;h.push(w)}return h}function t(o,l){this.Qa=o,this.db=l,this.Oa=1,this.lb=[]}function n(o,l){if(this.db=l,this.eb=Oe(o),this.eb===null)throw Error("Unable to allocate memory for the SQL string");this.kb=this.eb,this.Za=this.qb=null}function i(o){if(this.filename="dbfile_"+(4294967295*Math.random()>>>0),o!=null){var l=this.filename,h="/",m=l;if(h&&(h=typeof h=="string"?h:Je(h),m=l?Ce(h+"/"+l):h),l=qr(!0,!0),m=kt(m,l),o){if(typeof o=="string"){h=Array(o.length);for(var w=0,y=o.length;w<y;++w)h[w]=o.charCodeAt(w);o=h}Ne(m,l|146),h=ne(m,577),Qr(h,o,0,o.length,0),nr(h),Ne(m,l)}}this.handleError(c(this.filename,a)),this.db=W(a,"i32"),rt(this.db),this.fb={},this.Sa={}}var a=H(4),u=s.cwrap,c=u("sqlite3_open","number",["string","number"]),b=u("sqlite3_close_v2","number",["number"]),p=u("sqlite3_exec","number",["number","string","number","number","number"]),g=u("sqlite3_changes","number",["number"]),M=u("sqlite3_prepare_v2","number",["number","string","number","number","number"]),Cr=u("sqlite3_sql","string",["number"]),Ot=u("sqlite3_normalized_sql","string",["number"]),Gr=u("sqlite3_prepare_v2","number",["number","number","number","number","number"]),Lt=u("sqlite3_bind_text","number",["number","number","number","number","number"]),Zr=u("sqlite3_bind_blob","number",["number","number","number","number","number"]),xt=u("sqlite3_bind_double","number",["number","number","number"]),Tt=u("sqlite3_bind_int","number",["number","number","number"]),Pt=u("sqlite3_bind_parameter_index","number",["number","string"]),Ut=u("sqlite3_step","number",["number"]),Dt=u("sqlite3_errmsg","string",["number"]),It=u("sqlite3_column_count","number",["number"]),Wt=u("sqlite3_data_count","number",["number"]),jt=u("sqlite3_column_double","number",["number","number"]),Jr=u("sqlite3_column_text","string",["number","number"]),zt=u("sqlite3_column_blob","number",["number","number"]),Qt=u("sqlite3_column_bytes","number",["number","number"]),Ft=u("sqlite3_column_type","number",["number","number"]),$t=u("sqlite3_column_name","string",["number","number"]),Bt=u("sqlite3_reset","number",["number"]),Vt=u("sqlite3_clear_bindings","number",["number"]),Xt=u("sqlite3_finalize","number",["number"]),Hr=u("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),Yt=u("sqlite3_value_type","number",["number"]),Ct=u("sqlite3_value_bytes","number",["number"]),Gt=u("sqlite3_value_text","string",["number"]),Zt=u("sqlite3_value_blob","number",["number"]),Jt=u("sqlite3_value_double","number",["number"]),Ht=u("sqlite3_result_double","",["number","number"]),Kr=u("sqlite3_result_null","",["number"]),Kt=u("sqlite3_result_text","",["number","string","number","number"]),en=u("sqlite3_result_blob","",["number","number","number","number"]),rn=u("sqlite3_result_int","",["number","number"]),Ue=u("sqlite3_result_error","",["number","string","number"]),et=u("sqlite3_aggregate_context","number",["number","number"]),rt=u("RegisterExtensionFunctions","number",["number"]),tt=u("sqlite3_update_hook","number",["number","number","number"]);t.prototype.bind=function(o){if(!this.Qa)throw"Statement closed";return this.reset(),Array.isArray(o)?this.Cb(o):o!=null&&typeof o=="object"?this.Db(o):!0},t.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var o=Ut(this.Qa);switch(o){case 100:return!0;case 101:return!1;default:throw this.db.handleError(o)}},t.prototype.wb=function(o){return o==null&&(o=this.Oa,this.Oa+=1),jt(this.Qa,o)},t.prototype.Gb=function(o){if(o==null&&(o=this.Oa,this.Oa+=1),o=Jr(this.Qa,o),typeof BigInt!="function")throw Error("BigInt is not supported");return BigInt(o)},t.prototype.Hb=function(o){return o==null&&(o=this.Oa,this.Oa+=1),Jr(this.Qa,o)},t.prototype.getBlob=function(o){o==null&&(o=this.Oa,this.Oa+=1);var l=Qt(this.Qa,o);o=zt(this.Qa,o);for(var h=new Uint8Array(l),m=0;m<l;m+=1)h[m]=q[o+m];return h},t.prototype.get=function(o,l){l=l||{},o!=null&&this.bind(o)&&this.step(),o=[];for(var h=Wt(this.Qa),m=0;m<h;m+=1)switch(Ft(this.Qa,m)){case 1:var w=l.useBigInt?this.Gb(m):this.wb(m);o.push(w);break;case 2:o.push(this.wb(m));break;case 3:o.push(this.Hb(m));break;case 4:o.push(this.getBlob(m));break;default:o.push(null)}return o},t.prototype.getColumnNames=function(){for(var o=[],l=It(this.Qa),h=0;h<l;h+=1)o.push($t(this.Qa,h));return o},t.prototype.getAsObject=function(o,l){o=this.get(o,l),l=this.getColumnNames();for(var h={},m=0;m<l.length;m+=1)h[l[m]]=o[m];return h},t.prototype.getSQL=function(){return Cr(this.Qa)},t.prototype.getNormalizedSQL=function(){return Ot(this.Qa)},t.prototype.run=function(o){return o!=null&&this.bind(o),this.step(),this.reset()},t.prototype.tb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1),o=Oe(o),this.lb.push(o),this.db.handleError(Lt(this.Qa,l,o,-1,0))},t.prototype.Bb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1);var h=Le(o.length);q.set(o,h),this.lb.push(h),this.db.handleError(Zr(this.Qa,l,h,o.length,0))},t.prototype.sb=function(o,l){l==null&&(l=this.Oa,this.Oa+=1),this.db.handleError((o===(o|0)?Tt:xt)(this.Qa,l,o))},t.prototype.Eb=function(o){o==null&&(o=this.Oa,this.Oa+=1),Zr(this.Qa,o,0,0,0)},t.prototype.ub=function(o,l){switch(l==null&&(l=this.Oa,this.Oa+=1),typeof o){case"string":this.tb(o,l);return;case"number":this.sb(o,l);return;case"bigint":this.tb(o.toString(),l);return;case"boolean":this.sb(o+0,l);return;case"object":if(o===null){this.Eb(l);return}if(o.length!=null){this.Bb(o,l);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+o+")."},t.prototype.Db=function(o){var l=this;return Object.keys(o).forEach(function(h){var m=Pt(l.Qa,h);m!==0&&l.ub(o[h],m)}),!0},t.prototype.Cb=function(o){for(var l=0;l<o.length;l+=1)this.ub(o[l],l+1);return!0},t.prototype.reset=function(){return this.freemem(),Vt(this.Qa)===0&&Bt(this.Qa)===0},t.prototype.freemem=function(){for(var o;(o=this.lb.pop())!==void 0;)ce(o)},t.prototype.free=function(){this.freemem();var o=Xt(this.Qa)===0;return delete this.db.fb[this.Qa],this.Qa=0,o},n.prototype.next=function(){if(this.eb===null)return{done:!0};if(this.Za!==null&&(this.Za.free(),this.Za=null),!this.db.db)throw this.nb(),Error("Database closed");var o=Te(),l=H(4);le(a),le(l);try{this.db.handleError(Gr(this.db.db,this.kb,-1,a,l)),this.kb=W(l,"i32");var h=W(a,"i32");return h===0?(this.nb(),{done:!0}):(this.Za=new t(h,this.db),this.db.fb[h]=this.Za,{value:this.Za,done:!1})}catch(m){throw this.qb=E(this.kb),this.nb(),m}finally{xe(o)}},n.prototype.nb=function(){ce(this.eb),this.eb=null},n.prototype.getRemainingSQL=function(){return this.qb!==null?this.qb:E(this.kb)},typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"&&(n.prototype[Symbol.iterator]=function(){return this}),i.prototype.run=function(o,l){if(!this.db)throw"Database closed";if(l){o=this.prepare(o,l);try{o.step()}finally{o.free()}}else this.handleError(p(this.db,o,0,0,a));return this},i.prototype.exec=function(o,l,h){if(!this.db)throw"Database closed";var m=null,w=null,y=null;try{y=w=Oe(o);var T=H(4);for(o=[];W(y,"i8")!==0;){le(a),le(T),this.handleError(Gr(this.db,y,-1,a,T));var L=W(a,"i32");if(y=W(T,"i32"),L!==0){var R=null;for(m=new t(L,this),l!=null&&m.bind(l);m.step();)R===null&&(R={columns:m.getColumnNames(),values:[]},o.push(R)),R.values.push(m.get(null,h));m.free()}}return o}catch(P){throw m&&m.free(),P}finally{w&&ce(w)}},i.prototype.each=function(o,l,h,m,w){typeof l=="function"&&(m=h,h=l,l=void 0),o=this.prepare(o,l);try{for(;o.step();)h(o.getAsObject(null,w))}finally{o.free()}if(typeof m=="function")return m()},i.prototype.prepare=function(o,l){if(le(a),this.handleError(M(this.db,o,-1,a,0)),o=W(a,"i32"),o===0)throw"Nothing to prepare";var h=new t(o,this);return l!=null&&h.bind(l),this.fb[o]=h},i.prototype.iterateStatements=function(o){return new n(o,this)},i.prototype.export=function(){Object.values(this.fb).forEach(function(l){l.free()}),Object.values(this.Sa).forEach(V),this.Sa={},this.handleError(b(this.db));var o=Et(this.filename);return this.handleError(c(this.filename,a)),this.db=W(a,"i32"),rt(this.db),o},i.prototype.close=function(){this.db!==null&&(Object.values(this.fb).forEach(function(o){o.free()}),Object.values(this.Sa).forEach(V),this.Sa={},this.Ya&&(V(this.Ya),this.Ya=void 0),this.handleError(b(this.db)),Dr("/"+this.filename),this.db=null)},i.prototype.handleError=function(o){if(o===0)return null;throw o=Dt(this.db),Error(o)},i.prototype.getRowsModified=function(){return g(this.db)},i.prototype.create_function=function(o,l){Object.prototype.hasOwnProperty.call(this.Sa,o)&&(V(this.Sa[o]),delete this.Sa[o]);var h=me(function(m,w,y){w=r(w,y);try{var T=l.apply(null,w)}catch(L){Ue(m,L,-1);return}e(m,T)},"viii");return this.Sa[o]=h,this.handleError(Hr(this.db,o,l.length,1,0,h,0,0,0)),this},i.prototype.create_aggregate=function(o,l){var h=l.init||function(){return null},m=l.finalize||function(R){return R},w=l.step;if(!w)throw"An aggregate function must have a step function in "+o;var y={};Object.hasOwnProperty.call(this.Sa,o)&&(V(this.Sa[o]),delete this.Sa[o]),l=o+"__finalize",Object.hasOwnProperty.call(this.Sa,l)&&(V(this.Sa[l]),delete this.Sa[l]);var T=me(function(R,P,fr){var K=et(R,1);Object.hasOwnProperty.call(y,K)||(y[K]=h()),P=r(P,fr),P=[y[K]].concat(P);try{y[K]=w.apply(null,P)}catch(tn){delete y[K],Ue(R,tn,-1)}},"viii"),L=me(function(R){var P=et(R,1);try{var fr=m(y[P])}catch(K){delete y[P],Ue(R,K,-1);return}e(R,fr),delete y[P]},"vi");return this.Sa[o]=T,this.Sa[l]=L,this.handleError(Hr(this.db,o,w.length-1,1,0,0,T,L,0)),this},i.prototype.updateHook=function(o){return this.Ya&&(tt(this.db,0,0),V(this.Ya),this.Ya=void 0),o?(this.Ya=me(function(l,h,m,w,y){switch(h){case 18:l="insert";break;case 23:l="update";break;case 9:l="delete";break;default:throw"unknown operationCode in updateHook callback: "+h}if(m=E(m),w=E(w),y>Number.MAX_SAFE_INTEGER)throw"rowId too big to fit inside a Number";o(l,m,w,Number(y))},"viiiij"),tt(this.db,this.Ya,0),this):this},s.Database=i};var We="./this.program",pe=(e,r)=>{throw r},je=globalThis.document?.currentScript?.src;typeof __filename<"u"?je=__filename:Ie&&(je=self.location.href);var we="",ze,be;if(de){var Qe=nt;we=__dirname+"/",be=e=>(e=ve(e)?new URL(e):e,Qe.readFileSync(e)),ze=async e=>(e=ve(e)?new URL(e):e,Qe.readFileSync(e,void 0)),1<process.argv.length&&(We=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),j.exports=s,pe=(e,r)=>{throw process.exitCode=e,r}}else if(ut||Ie){try{we=new URL(".",je).href}catch{}Ie&&(be=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),ze=async e=>{if(ve(e))return new Promise((t,n)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{i.status==200||i.status==0&&i.response?t(i.response):n(i.status)},i.onerror=n,i.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw Error(r.status+" : "+r.url)}}var Fe=console.log.bind(console),Y=console.error.bind(console),oe,ye=!1,$e,ve=e=>e.startsWith("file://"),q,N,ae,k,v,Be,Ve,x;function cr(){var e=Pe.buffer;q=new Int8Array(e),ae=new Int16Array(e),N=new Uint8Array(e),k=new Int32Array(e),v=new Uint32Array(e),Be=new Float32Array(e),Ve=new Float64Array(e),x=new BigInt64Array(e),new BigUint64Array(e)}function ue(e){throw s.onAbort?.(e),e="Aborted("+e+")",Y(e),ye=!0,new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.")}var Xe;async function st(e){if(!oe)try{var r=await ze(e);return new Uint8Array(r)}catch{}if(e==Xe&&oe)e=new Uint8Array(oe);else if(be)e=be(e);else throw"both async and sync fetching of the wasm failed";return e}async function lt(e,r){try{var t=await st(e);return await WebAssembly.instantiate(t,r)}catch(n){Y(`failed to asynchronously prepare wasm: ${n}`),ue(n)}}async function ft(e){var r=Xe;if(!oe&&!ve(r)&&!de)try{var t=fetch(r,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(t,e)}catch(n){Y(`wasm streaming compile failed: ${n}`),Y("falling back to ArrayBuffer instantiation")}return lt(r,e)}class Ye{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var dr=e=>{for(;0<e.length;)e.shift()(s)},pr=[],wr=[],ht=()=>{var e=s.preRun.shift();wr.push(e)},C=0,se=null;function W(e,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":return q[e];case"i8":return q[e];case"i16":return ae[e>>1];case"i32":return k[e>>2];case"i64":return x[e>>3];case"float":return Be[e>>2];case"double":return Ve[e>>3];case"*":return v[e>>2];default:ue(`invalid type for getValue: ${r}`)}}var _e=!0;function le(e){var r="i32";switch(r.endsWith("*")&&(r="*"),r){case"i1":q[e]=0;break;case"i8":q[e]=0;break;case"i16":ae[e>>1]=0;break;case"i32":k[e>>2]=0;break;case"i64":x[e>>3]=BigInt(0);break;case"float":Be[e>>2]=0;break;case"double":Ve[e>>3]=0;break;case"*":v[e>>2]=0;break;default:ue(`invalid type for setValue: ${r}`)}}var br=new TextDecoder,yr=(e,r,t,n)=>{if(t=r+t,n)return t;for(;e[r]&&!(r>=t);)++r;return r},E=(e,r,t)=>e?br.decode(N.subarray(e,yr(N,e,r,t))):"",vr=(e,r)=>{for(var t=0,n=e.length-1;0<=n;n--){var i=e[n];i==="."?e.splice(n,1):i===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},Ce=e=>{var r=e.charAt(0)==="/",t=e.slice(-1)==="/";return(e=vr(e.split("/").filter(n=>!!n),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},_r=e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=r[0],r=r[1],!e&&!r?".":(r&&=r.slice(0,-1),e+r)},ge=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],mt=()=>{if(de){var e=nt;return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},gr=e=>{(gr=mt())(e)},ct=(...e)=>{for(var r="",t=!1,n=e.length-1;-1<=n&&!t;n--){if(t=0<=n?e[n]:"/",typeof t!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";r=t+"/"+r,t=t.charAt(0)==="/"}return r=vr(r.split("/").filter(i=>!!i),!t).join("/"),(t?"/":"")+r||"."},ke=e=>{var r=yr(e,0);return br.decode(e.buffer?e.subarray(0,r):new Uint8Array(e.slice(0,r)))},Ge=[],ee=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);127>=n?r++:2047>=n?r+=2:55296<=n&&57343>=n?(r+=4,++t):r+=3}return r},U=(e,r,t,n)=>{if(!(0<n))return 0;var i=t;n=t+n-1;for(var a=0;a<e.length;++a){var u=e.codePointAt(a);if(127>=u){if(t>=n)break;r[t++]=u}else if(2047>=u){if(t+1>=n)break;r[t++]=192|u>>6,r[t++]=128|u&63}else if(65535>=u){if(t+2>=n)break;r[t++]=224|u>>12,r[t++]=128|u>>6&63,r[t++]=128|u&63}else{if(t+3>=n)break;r[t++]=240|u>>18,r[t++]=128|u>>12&63,r[t++]=128|u>>6&63,r[t++]=128|u&63,a++}}return r[t]=0,t-i},kr=[];function Er(e,r){kr[e]={input:[],output:[],cb:r},rr(e,dt)}var dt={open(e){var r=kr[e.node.rdev];if(!r)throw new f(43);e.tty=r,e.seekable=!1},close(e){e.tty.cb.fsync(e.tty)},fsync(e){e.tty.cb.fsync(e.tty)},read(e,r,t,n){if(!e.tty||!e.tty.cb.xb)throw new f(60);for(var i=0,a=0;a<n;a++){try{var u=e.tty.cb.xb(e.tty)}catch{throw new f(29)}if(u===void 0&&i===0)throw new f(6);if(u==null)break;i++,r[t+a]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,n){if(!e.tty||!e.tty.cb.rb)throw new f(60);try{for(var i=0;i<n;i++)e.tty.cb.rb(e.tty,r[t+i])}catch{throw new f(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},pt={xb(){e:{if(!Ge.length){var e=null;if(de){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=Qe.readSync(n,r,0,256)}catch(i){if(i.toString().includes("EOF"))t=0;else throw i}0<t&&(e=r.slice(0,t).toString("utf-8"))}else globalThis.window?.prompt&&(e=window.prompt("Input: "),e!==null&&(e+=`
2
2
  `));if(!e){e=null;break e}r=Array(ee(e)+1),e=U(e,r,0,r.length),r.length=e,Ge=r}e=Ge.shift()}return e},rb(e,r){r===null||r===10?(Fe(ke(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){0<e.output?.length&&(Fe(ke(e.output)),e.output=[])},Tb(){return{Ob:25856,Qb:5,Nb:191,Pb:35387,Mb:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},Ub(){return 0},Vb(){return[24,80]}},wt={rb(e,r){r===null||r===10?(Y(ke(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){0<e.output?.length&&(Y(ke(e.output)),e.output=[])}},d={Wa:null,Xa(){return d.createNode(null,"/",16895,0)},createNode(e,r,t,n){if((t&61440)===24576||(t&61440)===4096)throw new f(63);return d.Wa||(d.Wa={dir:{node:{Ta:d.La.Ta,Ua:d.La.Ua,lookup:d.La.lookup,hb:d.La.hb,rename:d.La.rename,unlink:d.La.unlink,rmdir:d.La.rmdir,readdir:d.La.readdir,symlink:d.La.symlink},stream:{Va:d.Ma.Va}},file:{node:{Ta:d.La.Ta,Ua:d.La.Ua},stream:{Va:d.Ma.Va,read:d.Ma.read,write:d.Ma.write,ib:d.Ma.ib,jb:d.Ma.jb}},link:{node:{Ta:d.La.Ta,Ua:d.La.Ua,readlink:d.La.readlink},stream:{}},vb:{node:{Ta:d.La.Ta,Ua:d.La.Ua},stream:gt}}),t=Rr(e,r,t,n),S(t.mode)?(t.La=d.Wa.dir.node,t.Ma=d.Wa.dir.stream,t.Na={}):(t.mode&61440)===32768?(t.La=d.Wa.file.node,t.Ma=d.Wa.file.stream,t.Ra=0,t.Na=null):(t.mode&61440)===40960?(t.La=d.Wa.link.node,t.Ma=d.Wa.link.stream):(t.mode&61440)===8192&&(t.La=d.Wa.vb.node,t.Ma=d.Wa.vb.stream),t.atime=t.mtime=t.ctime=Date.now(),e&&(e.Na[r]=t,e.atime=e.mtime=e.ctime=t.atime),t},Sb(e){return e.Na?e.Na.subarray?e.Na.subarray(0,e.Ra):new Uint8Array(e.Na):new Uint8Array(0)},La:{Ta(e){var r={};return r.dev=(e.mode&61440)===8192?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,S(e.mode)?r.size=4096:(e.mode&61440)===32768?r.size=e.Ra:(e.mode&61440)===40960?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},Ua(e,r){for(var t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&(r=r.size,e.Ra!=r&&(r==0?(e.Na=null,e.Ra=0):(t=e.Na,e.Na=new Uint8Array(r),t&&e.Na.set(t.subarray(0,Math.min(r,e.Ra))),e.Ra=r)))},lookup(){throw d.mb||(d.mb=new f(44),d.mb.stack="<generic error, no stack>"),d.mb},hb(e,r,t,n){return d.createNode(e,r,t,n)},rename(e,r,t){try{var n=G(r,t)}catch{}if(n){if(S(e.mode))for(var i in n.Na)throw new f(55);Ke(n)}delete e.parent.Na[e.name],r.Na[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.Na[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=G(e,r),n;for(n in t.Na)throw new f(55);delete e.Na[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.Na)]},symlink(e,r,t){return e=d.createNode(e,r,41471,0),e.link=t,e},readlink(e){if((e.mode&61440)!==40960)throw new f(28);return e.link}},Ma:{read(e,r,t,n,i){var a=e.node.Na;if(i>=e.node.Ra)return 0;if(e=Math.min(e.node.Ra-i,n),8<e&&a.subarray)r.set(a.subarray(i,i+e),t);else for(n=0;n<e;n++)r[t+n]=a[i+n];return e},write(e,r,t,n,i,a){if(r.buffer===q.buffer&&(a=!1),!n)return 0;if(e=e.node,e.mtime=e.ctime=Date.now(),r.subarray&&(!e.Na||e.Na.subarray)){if(a)return e.Na=r.subarray(t,t+n),e.Ra=n;if(e.Ra===0&&i===0)return e.Na=r.slice(t,t+n),e.Ra=n;if(i+n<=e.Ra)return e.Na.set(r.subarray(t,t+n),i),n}a=i+n;var u=e.Na?e.Na.length:0;if(u>=a||(a=Math.max(a,u*(1048576>u?2:1.125)>>>0),u!=0&&(a=Math.max(a,256)),u=e.Na,e.Na=new Uint8Array(a),0<e.Ra&&e.Na.set(u.subarray(0,e.Ra),0)),e.Na.subarray&&r.subarray)e.Na.set(r.subarray(t,t+n),i);else for(a=0;a<n;a++)e.Na[i+a]=r[t+a];return e.Ra=Math.max(e.Ra,i+n),n},Va(e,r,t){if(t===1?r+=e.position:t===2&&(e.node.mode&61440)===32768&&(r+=e.node.Ra),0>r)throw new f(28);return r},ib(e,r,t,n,i){if((e.node.mode&61440)!==32768)throw new f(43);if(e=e.node.Na,i&2||!e||e.buffer!==q.buffer){i=!0,n=65536*Math.ceil(r/65536);var a=Xr(65536,n);if(a&&N.fill(0,a,a+n),n=a,!n)throw new f(48);e&&((0<t||t+r<e.length)&&(e.subarray?e=e.subarray(t,t+r):e=Array.prototype.slice.call(e,t,t+r)),q.set(e,n))}else i=!1,n=e.byteOffset;return{Kb:n,Ab:i}},jb(e,r,t,n){return d.Ma.write(e,r,0,n,t,!1),0}}},qr=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},Ze=null,Mr={},re=[],bt=1,$=null,Nr=!1,Ar=!0,Sr={},f=class{name="ErrnoError";constructor(e){this.Pa=e}},yt=class{gb={};node=null;get flags(){return this.gb.flags}set flags(e){this.gb.flags=e}get position(){return this.gb.position}set position(e){this.gb.position=e}},vt=class{La={};Ma={};ab=null;constructor(e,r,t,n){e||=this,this.parent=e,this.Xa=e.Xa,this.id=bt++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&365)===365}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return(this.mode&146)===146}set write(e){e?this.mode|=146:this.mode&=-147}};function O(e,r={}){if(!e)throw new f(44);r.ob??(r.ob=!0),e.charAt(0)==="/"||(e="//"+e);var t=0;e:for(;40>t;t++){e=e.split("/").filter(c=>!!c);for(var n=Ze,i="/",a=0;a<e.length;a++){var u=a===e.length-1;if(u&&r.parent)break;if(e[a]!==".")if(e[a]==="..")if(i=_r(i),n===n.parent){e=i+"/"+e.slice(a+1).join("/"),t--;continue e}else n=n.parent;else{i=Ce(i+"/"+e[a]);try{n=G(n,e[a])}catch(c){if(c?.Pa===44&&u&&r.Jb)return{path:i};throw c}if(!n.ab||u&&!r.ob||(n=n.ab.root),(n.mode&61440)===40960&&(!u||r.$a)){if(!n.La.readlink)throw new f(52);n=n.La.readlink(n),n.charAt(0)==="/"||(n=_r(i)+"/"+n),e=n+"/"+e.slice(a+1).join("/");continue e}}}return{path:i,node:n}}throw new f(32)}function Je(e){for(var r;;){if(e===e.parent)return e=e.Xa.zb,r?e[e.length-1]!=="/"?`${e}/${r}`:e+r:e;r=r?`${e.name}/${r}`:e.name,e=e.parent}}function He(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%$.length}function Ke(e){var r=He(e.parent.id,e.name);if($[r]===e)$[r]=e.bb;else for(r=$[r];r;){if(r.bb===e){r.bb=e.bb;break}r=r.bb}}function G(e,r){var t=S(e.mode)?(t=te(e,"x"))?t:e.La.lookup?0:2:54;if(t)throw new f(t);for(t=$[He(e.id,r)];t;t=t.bb){var n=t.name;if(t.parent.id===e.id&&n===r)return t}return e.La.lookup(e,r)}function Rr(e,r,t,n){return e=new vt(e,r,t,n),r=He(e.parent.id,e.name),e.bb=$[r],$[r]=e}function S(e){return(e&61440)===16384}function Or(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r}function te(e,r){if(Ar)return 0;if(!r.includes("r")||e.mode&292){if(r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73))return 2}else return 2;return 0}function Lr(e,r){if(!S(e.mode))return 54;try{return G(e,r),20}catch{}return te(e,"wx")}function xr(e,r,t){try{var n=G(e,r)}catch(i){return i.Pa}if(e=te(e,"wx"))return e;if(t){if(!S(n.mode))return 54;if(n===n.parent||Je(n)==="/")return 10}else if(S(n.mode))return 31;return 0}function Ee(e){if(!e)throw new f(63);return e}function A(e){if(e=re[e],!e)throw new f(8);return e}function Tr(e,r=-1){if(e=Object.assign(new yt,e),r==-1)e:{for(r=0;4096>=r;r++)if(!re[r])break e;throw new f(33)}return e.fd=r,re[r]=e}function _t(e,r=-1){return e=Tr(e,r),e.Ma?.Rb?.(e),e}function er(e,r,t){var n=e?.Ma.Ua;e=n?e:r,n??=r.La.Ua,Ee(n),n(e,t)}var gt={open(e){e.Ma=Mr[e.node.rdev].Ma,e.Ma.open?.(e)},Va(){throw new f(70)}};function rr(e,r){Mr[e]={Ma:r}}function Pr(e,r){var t=r==="/";if(t&&Ze)throw new f(10);if(!t&&r){var n=O(r,{ob:!1});if(r=n.path,n=n.node,n.ab)throw new f(10);if(!S(n.mode))throw new f(54)}r={type:e,Wb:{},zb:r,Ib:[]},e=e.Xa(r),e.Xa=r,r.root=e,t?Ze=e:n&&(n.ab=r,n.Xa&&n.Xa.Ib.push(r))}function qe(e,r,t){var n=O(e,{parent:!0}).node;if(e=ge(e),!e)throw new f(28);if(e==="."||e==="..")throw new f(20);var i=Lr(n,e);if(i)throw new f(i);if(!n.La.hb)throw new f(63);return n.La.hb(n,e,r,t)}function kt(e,r=438){return qe(e,r&4095|32768,0)}function D(e,r=511){return qe(e,r&1023|16384,0)}function Me(e,r,t){typeof t>"u"&&(t=r,r=438),qe(e,r|8192,t)}function tr(e,r){if(!ct(e))throw new f(44);var t=O(r,{parent:!0}).node;if(!t)throw new f(44);r=ge(r);var n=Lr(t,r);if(n)throw new f(n);if(!t.La.symlink)throw new f(63);t.La.symlink(t,r,e)}function Ur(e){var r=O(e,{parent:!0}).node;e=ge(e);var t=G(r,e),n=xr(r,e,!0);if(n)throw new f(n);if(!r.La.rmdir)throw new f(63);if(t.ab)throw new f(10);r.La.rmdir(r,e),Ke(t)}function Dr(e){var r=O(e,{parent:!0}).node;if(!r)throw new f(44);e=ge(e);var t=G(r,e),n=xr(r,e,!1);if(n)throw new f(n);if(!r.La.unlink)throw new f(63);if(t.ab)throw new f(10);r.La.unlink(r,e),Ke(t)}function fe(e,r){return e=O(e,{$a:!r}).node,Ee(e.La.Ta)(e)}function Ir(e,r,t,n){er(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),Fb:n})}function Ne(e,r){e=typeof e=="string"?O(e,{$a:!0}).node:e,Ir(null,e,r)}function Wr(e,r,t){if(S(r.mode))throw new f(31);if((r.mode&61440)!==32768)throw new f(28);var n=te(r,"w");if(n)throw new f(n);er(e,r,{size:t,timestamp:Date.now()})}function ne(e,r,t=438){if(e==="")throw new f(44);if(typeof r=="string"){var n={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(typeof n>"u")throw Error(`Unknown file open mode: ${r}`);r=n}if(t=r&64?t&4095|32768:0,typeof e=="object")n=e;else{var i=e.endsWith("/");e=O(e,{$a:!(r&131072),Jb:!0}),n=e.node,e=e.path}var a=!1;if(r&64)if(n){if(r&128)throw new f(20)}else{if(i)throw new f(31);n=qe(e,t|511,0),a=!0}if(!n)throw new f(44);if((n.mode&61440)===8192&&(r&=-513),r&65536&&!S(n.mode))throw new f(54);if(!a&&(i=n?(n.mode&61440)===40960?32:S(n.mode)&&(Or(r)!=="r"||r&576)?31:te(n,Or(r)):44))throw new f(i);return r&512&&!a&&(i=n,i=typeof i=="string"?O(i,{$a:!0}).node:i,Wr(null,i,0)),r&=-131713,i=Tr({node:n,path:Je(n),flags:r,seekable:!0,position:0,Ma:n.Ma,Lb:[],error:!1}),i.Ma.open&&i.Ma.open(i),a&&Ne(n,t&511),!s.logReadFiles||r&1||e in Sr||(Sr[e]=1),i}function nr(e){if(e.fd===null)throw new f(8);e.pb&&(e.pb=null);try{e.Ma.close&&e.Ma.close(e)}catch(r){throw r}finally{re[e.fd]=null}e.fd=null}function jr(e,r,t){if(e.fd===null)throw new f(8);if(!e.seekable||!e.Ma.Va)throw new f(70);if(t!=0&&t!=1&&t!=2)throw new f(28);e.position=e.Ma.Va(e,r,t),e.Lb=[]}function zr(e,r,t,n,i){if(0>n||0>i)throw new f(28);if(e.fd===null)throw new f(8);if((e.flags&2097155)===1)throw new f(8);if(S(e.node.mode))throw new f(31);if(!e.Ma.read)throw new f(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new f(70);return r=e.Ma.read(e,r,t,n,i),a||(e.position+=r),r}function Qr(e,r,t,n,i){if(0>n||0>i)throw new f(28);if(e.fd===null)throw new f(8);if((e.flags&2097155)===0)throw new f(8);if(S(e.node.mode))throw new f(31);if(!e.Ma.write)throw new f(28);e.seekable&&e.flags&1024&&jr(e,0,2);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new f(70);return r=e.Ma.write(e,r,t,n,i,void 0),a||(e.position+=r),r}function Et(e){var r=r||0;r=ne(e,r),e=fe(e).size;var t=new Uint8Array(e);return zr(r,t,0,e,0),nr(r),t}function B(e,r,t){e=Ce("/dev/"+e);var n=qr(!!r,!!t);B.yb??(B.yb=64);var i=B.yb++<<8|0;rr(i,{open(a){a.seekable=!1},close(){t?.buffer?.length&&t(10)},read(a,u,c,b){for(var p=0,g=0;g<b;g++){try{var M=r()}catch{throw new f(29)}if(M===void 0&&p===0)throw new f(6);if(M==null)break;p++,u[c+g]=M}return p&&(a.node.atime=Date.now()),p},write(a,u,c,b){for(var p=0;p<b;p++)try{t(u[c+p])}catch{throw new f(29)}return b&&(a.node.mtime=a.node.ctime=Date.now()),p}}),Me(e,n,i)}var _={};function Z(e,r,t){if(r.charAt(0)==="/")return r;if(e=e===-100?"/":A(e).path,r.length==0){if(!t)throw new f(44);return e}return e+"/"+r}function Ae(e,r){v[e>>2]=r.dev,v[e+4>>2]=r.mode,v[e+8>>2]=r.nlink,v[e+12>>2]=r.uid,v[e+16>>2]=r.gid,v[e+20>>2]=r.rdev,x[e+24>>3]=BigInt(r.size),k[e+32>>2]=4096,k[e+36>>2]=r.blocks;var t=r.atime.getTime(),n=r.mtime.getTime(),i=r.ctime.getTime();return x[e+40>>3]=BigInt(Math.floor(t/1e3)),v[e+48>>2]=t%1e3*1e6,x[e+56>>3]=BigInt(Math.floor(n/1e3)),v[e+64>>2]=n%1e3*1e6,x[e+72>>3]=BigInt(Math.floor(i/1e3)),v[e+80>>2]=i%1e3*1e6,x[e+88>>3]=BigInt(r.ino),0}var Se=void 0,Re=()=>{var e=k[+Se>>2];return Se+=4,e},ir=0,qt=[0,31,60,91,121,152,182,213,244,274,305,335],Mt=[0,31,59,90,120,151,181,212,243,273,304,334],he={},Fr=e=>{$e=e,_e||0<ir||(s.onExit?.(e),ye=!0),pe(e,new Ye(e))},Nt=e=>{if(!ye)try{e()}catch(r){r instanceof Ye||r=="unwind"||pe(1,r)}finally{if(!(_e||0<ir))try{$e=e=$e,Fr(e)}catch(r){r instanceof Ye||r=="unwind"||pe(1,r)}}},or={},$r=()=>{if(!ar){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:We||"./this.program"},r;for(r in or)or[r]===void 0?delete e[r]:e[r]=or[r];var t=[];for(r in e)t.push(`${r}=${e[r]}`);ar=t}return ar},ar,At=(e,r,t,n)=>{var i={string:p=>{var g=0;if(p!=null&&p!==0){g=ee(p)+1;var M=H(g);U(p,N,M,g),g=M}return g},array:p=>{var g=H(p.length);return q.set(p,g),g}};e=s["_"+e];var a=[],u=0;if(n)for(var c=0;c<n.length;c++){var b=i[t[c]];b?(u===0&&(u=Te()),a[c]=b(n[c])):a[c]=n[c]}return t=e(...a),t=(function(p){return u!==0&&xe(u),r==="string"?E(p):r==="boolean"?!!p:p})(t)},Oe=e=>{var r=ee(e)+1,t=Le(r);return t&&U(e,N,t,r),t},J,ur=[],V=e=>{J.delete(X.get(e)),X.set(e,null),ur.push(e)},Br=e=>{const r=e.length;return[r%128|128,r>>7,...e]},St={i:127,p:127,j:126,f:125,d:124,e:111},Vr=e=>Br(Array.from(e,r=>St[r])),me=(e,r)=>{if(!J){J=new WeakMap;var t=X.length;if(J)for(var n=0;n<0+t;n++){var i=X.get(n);i&&J.set(i,n)}}if(t=J.get(e)||0)return t;t=ur.length?ur.pop():X.grow(1);try{X.set(t,e)}catch(a){if(!(a instanceof TypeError))throw a;r=Uint8Array.of(0,97,115,109,1,0,0,0,1,...Br([1,96,...Vr(r.slice(1)),...Vr(r[0]==="v"?"":r[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),r=new WebAssembly.Module(r),r=new WebAssembly.Instance(r,{e:{f:e}}).exports.f,X.set(t,r)}return J.set(e,t),t};if($=Array(4096),Pr(d,"/"),D("/tmp"),D("/home"),D("/home/web_user"),(function(){D("/dev"),rr(259,{read:()=>0,write:(n,i,a,u)=>u,Va:()=>0}),Me("/dev/null",259),Er(1280,pt),Er(1536,wt),Me("/dev/tty",1280),Me("/dev/tty1",1536);var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(gr(e),r=e.byteLength),e[--r]);B("random",t),B("urandom",t),D("/dev/shm"),D("/dev/shm/tmp")})(),(function(){D("/proc");var e=D("/proc/self");D("/proc/self/fd"),Pr({Xa(){var r=Rr(e,"fd",16895,73);return r.Ma={Va:d.Ma.Va},r.La={lookup(t,n){t=+n;var i=A(t);return t={parent:null,Xa:{zb:"fake"},La:{readlink:()=>i.path},id:t+1},t.parent=t},readdir(){return Array.from(re.entries()).filter(([,t])=>t).map(([t])=>t.toString())}},r}},"/proc/self/fd")})(),s.noExitRuntime&&(_e=s.noExitRuntime),s.print&&(Fe=s.print),s.printErr&&(Y=s.printErr),s.wasmBinary&&(oe=s.wasmBinary),s.thisProgram&&(We=s.thisProgram),s.preInit)for(typeof s.preInit=="function"&&(s.preInit=[s.preInit]);0<s.preInit.length;)s.preInit.shift()();s.stackSave=()=>Te(),s.stackRestore=e=>xe(e),s.stackAlloc=e=>H(e),s.cwrap=(e,r,t,n)=>{var i=!t||t.every(a=>a==="number"||a==="boolean");return r!=="string"&&i&&!n?s["_"+e]:(...a)=>At(e,r,t,a)},s.addFunction=me,s.removeFunction=V,s.UTF8ToString=E,s.stringToNewUTF8=Oe,s.writeArrayToMemory=(e,r)=>{q.set(e,r)};var Le,ce,Xr,Yr,xe,H,Te,Pe,X,Rt={a:(e,r,t,n)=>ue(`Assertion failed: ${E(e)}, at: `+[r?E(r):"unknown filename",t,n?E(n):"unknown function"]),i:function(e,r){try{return e=E(e),Ne(e,r),0}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return-t.Pa}},L:function(e,r,t){try{if(r=E(r),r=Z(e,r),t&-8)return-28;var n=O(r,{$a:!0}).node;return n?(e="",t&4&&(e+="r"),t&2&&(e+="w"),t&1&&(e+="x"),e&&te(n,e)?-2:0):-44}catch(i){if(typeof _>"u"||i.name!=="ErrnoError")throw i;return-i.Pa}},j:function(e,r){try{var t=A(e);return Ir(t,t.node,r,!1),0}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return-n.Pa}},h:function(e){try{var r=A(e);return er(r,r.node,{timestamp:Date.now(),Fb:!1}),0}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return-t.Pa}},b:function(e,r,t){Se=t;try{var n=A(e);switch(r){case 0:var i=Re();if(0>i)break;for(;re[i];)i++;return _t(n,i).fd;case 1:case 2:return 0;case 3:return n.flags;case 4:return i=Re(),n.flags|=i,0;case 12:return i=Re(),ae[i+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(a){if(typeof _>"u"||a.name!=="ErrnoError")throw a;return-a.Pa}},g:function(e,r){try{var t=A(e),n=t.node,i=t.Ma.Ta;e=i?t:n,i??=n.La.Ta,Ee(i);var a=i(e);return Ae(r,a)}catch(u){if(typeof _>"u"||u.name!=="ErrnoError")throw u;return-u.Pa}},H:function(e,r){r=-9007199254740992>r||9007199254740992<r?NaN:Number(r);try{if(isNaN(r))return-61;var t=A(e);if(0>r||(t.flags&2097155)===0)throw new f(28);return Wr(t,t.node,r),0}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return-n.Pa}},G:function(e,r){try{if(r===0)return-28;var t=ee("/")+1;return r<t?-68:(U("/",N,e,r),t)}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return-n.Pa}},K:function(e,r){try{return e=E(e),Ae(r,fe(e,!0))}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return-t.Pa}},C:function(e,r,t){try{return r=E(r),r=Z(e,r),D(r,t),0}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return-n.Pa}},J:function(e,r,t,n){try{r=E(r);var i=n&256;return r=Z(e,r,n&4096),Ae(t,i?fe(r,!0):fe(r))}catch(a){if(typeof _>"u"||a.name!=="ErrnoError")throw a;return-a.Pa}},x:function(e,r,t,n){Se=n;try{r=E(r),r=Z(e,r);var i=n?Re():0;return ne(r,t,i).fd}catch(a){if(typeof _>"u"||a.name!=="ErrnoError")throw a;return-a.Pa}},v:function(e,r,t,n){try{if(r=E(r),r=Z(e,r),0>=n)return-28;var i=O(r).node;if(!i)throw new f(44);if(!i.La.readlink)throw new f(28);var a=i.La.readlink(i),u=Math.min(n,ee(a)),c=q[t+u];return U(a,N,t,n+1),q[t+u]=c,u}catch(b){if(typeof _>"u"||b.name!=="ErrnoError")throw b;return-b.Pa}},u:function(e){try{return e=E(e),Ur(e),0}catch(r){if(typeof _>"u"||r.name!=="ErrnoError")throw r;return-r.Pa}},f:function(e,r){try{return e=E(e),Ae(r,fe(e))}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return-t.Pa}},r:function(e,r,t){try{if(r=E(r),r=Z(e,r),t)if(t===512)Ur(r);else return-28;else Dr(r);return 0}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return-n.Pa}},q:function(e,r,t){try{r=E(r),r=Z(e,r,!0);var n=Date.now(),i,a;if(t){var u=v[t>>2]+4294967296*k[t+4>>2],c=k[t+8>>2];c==1073741823?i=n:c==1073741822?i=null:i=1e3*u+c/1e6,t+=16,u=v[t>>2]+4294967296*k[t+4>>2],c=k[t+8>>2],c==1073741823?a=n:c==1073741822?a=null:a=1e3*u+c/1e6}else a=i=n;if((a??i)!==null){e=i;var b=O(r,{$a:!0}).node;Ee(b.La.Ua)(b,{atime:e,mtime:a})}return 0}catch(p){if(typeof _>"u"||p.name!=="ErrnoError")throw p;return-p.Pa}},m:()=>ue(""),l:()=>{_e=!1,ir=0},A:function(e,r){e=-9007199254740992>e||9007199254740992<e?NaN:Number(e),e=new Date(1e3*e),k[r>>2]=e.getSeconds(),k[r+4>>2]=e.getMinutes(),k[r+8>>2]=e.getHours(),k[r+12>>2]=e.getDate(),k[r+16>>2]=e.getMonth(),k[r+20>>2]=e.getFullYear()-1900,k[r+24>>2]=e.getDay();var t=e.getFullYear();k[r+28>>2]=(t%4!==0||t%100===0&&t%400!==0?Mt:qt)[e.getMonth()]+e.getDate()-1|0,k[r+36>>2]=-(60*e.getTimezoneOffset()),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var n=new Date(e.getFullYear(),0,1).getTimezoneOffset();k[r+32>>2]=(t!=n&&e.getTimezoneOffset()==Math.min(n,t))|0},y:function(e,r,t,n,i,a,u){i=-9007199254740992>i||9007199254740992<i?NaN:Number(i);try{var c=A(n);if((r&2)!==0&&(t&2)===0&&(c.flags&2097155)!==2)throw new f(2);if((c.flags&2097155)===1)throw new f(2);if(!c.Ma.ib)throw new f(43);if(!e)throw new f(28);var b=c.Ma.ib(c,e,i,r,t),p=b.Kb;return k[a>>2]=b.Ab,v[u>>2]=p,0}catch(g){if(typeof _>"u"||g.name!=="ErrnoError")throw g;return-g.Pa}},z:function(e,r,t,n,i,a){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);try{var u=A(i);if(t&2){if(t=a,(u.node.mode&61440)!==32768)throw new f(43);if(!(n&2)){var c=N.slice(e,e+r);u.Ma.jb&&u.Ma.jb(u,c,t,r,n)}}}catch(b){if(typeof _>"u"||b.name!=="ErrnoError")throw b;return-b.Pa}},n:(e,r)=>{if(he[e]&&(clearTimeout(he[e].id),delete he[e]),!r)return 0;var t=setTimeout(()=>{delete he[e],Nt(()=>Yr(e,performance.now()))},r);return he[e]={id:t,Xb:r},0},B:(e,r,t,n)=>{var i=new Date().getFullYear(),a=new Date(i,0,1).getTimezoneOffset();i=new Date(i,6,1).getTimezoneOffset(),v[e>>2]=60*Math.max(a,i),k[r>>2]=+(a!=i),r=u=>{var c=Math.abs(u);return`UTC${0<=u?"-":"+"}${String(Math.floor(c/60)).padStart(2,"0")}${String(c%60).padStart(2,"0")}`},e=r(a),r=r(i),i<a?(U(e,N,t,17),U(r,N,n,17)):(U(e,N,n,17),U(r,N,t,17))},d:()=>Date.now(),s:()=>2147483648,c:()=>performance.now(),o:e=>{var r=N.length;if(e>>>=0,2147483648<e)return!1;for(var t=1;4>=t;t*=2){var n=r*(1+.2/t);n=Math.min(n,e+100663296);e:{n=(Math.min(2147483648,65536*Math.ceil(Math.max(e,n)/65536))-Pe.buffer.byteLength+65535)/65536|0;try{Pe.grow(n),cr();var i=1;break e}catch{}i=void 0}if(i)return!0}return!1},E:(e,r)=>{var t=0,n=0,i;for(i of $r()){var a=r+t;v[e+n>>2]=a,t+=U(i,N,a,1/0)+1,n+=4}return 0},F:(e,r)=>{var t=$r();v[e>>2]=t.length,e=0;for(var n of t)e+=ee(n)+1;return v[r>>2]=e,0},e:function(e){try{var r=A(e);return nr(r),0}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return t.Pa}},p:function(e,r){try{var t=A(e);return q[r]=t.tty?2:S(t.mode)?3:(t.mode&61440)===40960?7:4,ae[r+2>>1]=0,x[r+8>>3]=BigInt(0),x[r+16>>3]=BigInt(0),0}catch(n){if(typeof _>"u"||n.name!=="ErrnoError")throw n;return n.Pa}},w:function(e,r,t,n){try{e:{var i=A(e);e=r;for(var a,u=r=0;u<t;u++){var c=v[e>>2],b=v[e+4>>2];e+=8;var p=zr(i,q,c,b,a);if(0>p){var g=-1;break e}if(r+=p,p<b)break;typeof a<"u"&&(a+=p)}g=r}return v[n>>2]=g,0}catch(M){if(typeof _>"u"||M.name!=="ErrnoError")throw M;return M.Pa}},D:function(e,r,t,n){r=-9007199254740992>r||9007199254740992<r?NaN:Number(r);try{if(isNaN(r))return 61;var i=A(e);return jr(i,r,t),x[n>>3]=BigInt(i.position),i.pb&&r===0&&t===0&&(i.pb=null),0}catch(a){if(typeof _>"u"||a.name!=="ErrnoError")throw a;return a.Pa}},I:function(e){try{var r=A(e);return r.Ma?.fsync?.(r)}catch(t){if(typeof _>"u"||t.name!=="ErrnoError")throw t;return t.Pa}},t:function(e,r,t,n){try{e:{var i=A(e);e=r;for(var a,u=r=0;u<t;u++){var c=v[e>>2],b=v[e+4>>2];e+=8;var p=Qr(i,q,c,b,a);if(0>p){var g=-1;break e}if(r+=p,p<b)break;typeof a<"u"&&(a+=p)}g=r}return v[n>>2]=g,0}catch(M){if(typeof _>"u"||M.name!=="ErrnoError")throw M;return M.Pa}},k:Fr};function sr(){function e(){if(s.calledRun=!0,!ye){if(!s.noFSInit&&!Nr){var r,t;Nr=!0,r??=s.stdin,t??=s.stdout,n??=s.stderr,r?B("stdin",r):tr("/dev/tty","/dev/stdin"),t?B("stdout",null,t):tr("/dev/tty","/dev/stdout"),n?B("stderr",null,n):tr("/dev/tty1","/dev/stderr"),ne("/dev/stdin",0),ne("/dev/stdout",1),ne("/dev/stderr",1)}if(lr.N(),Ar=!1,s.onRuntimeInitialized?.(),s.postRun)for(typeof s.postRun=="function"&&(s.postRun=[s.postRun]);s.postRun.length;){var n=s.postRun.shift();pr.push(n)}dr(pr)}}if(0<C)se=sr;else{if(s.preRun)for(typeof s.preRun=="function"&&(s.preRun=[s.preRun]);s.preRun.length;)ht();dr(wr),0<C?se=sr:s.setStatus?(s.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>s.setStatus(""),1),e()},1)):e()}}var lr;return(async function(){function e(t){return t=lr=t.exports,s._sqlite3_free=t.P,s._sqlite3_value_text=t.Q,s._sqlite3_prepare_v2=t.R,s._sqlite3_step=t.S,s._sqlite3_reset=t.T,s._sqlite3_exec=t.U,s._sqlite3_finalize=t.V,s._sqlite3_column_name=t.W,s._sqlite3_column_text=t.X,s._sqlite3_column_type=t.Y,s._sqlite3_errmsg=t.Z,s._sqlite3_clear_bindings=t._,s._sqlite3_value_blob=t.$,s._sqlite3_value_bytes=t.aa,s._sqlite3_value_double=t.ba,s._sqlite3_value_int=t.ca,s._sqlite3_value_type=t.da,s._sqlite3_result_blob=t.ea,s._sqlite3_result_double=t.fa,s._sqlite3_result_error=t.ga,s._sqlite3_result_int=t.ha,s._sqlite3_result_int64=t.ia,s._sqlite3_result_null=t.ja,s._sqlite3_result_text=t.ka,s._sqlite3_aggregate_context=t.la,s._sqlite3_column_count=t.ma,s._sqlite3_data_count=t.na,s._sqlite3_column_blob=t.oa,s._sqlite3_column_bytes=t.pa,s._sqlite3_column_double=t.qa,s._sqlite3_bind_blob=t.ra,s._sqlite3_bind_double=t.sa,s._sqlite3_bind_int=t.ta,s._sqlite3_bind_text=t.ua,s._sqlite3_bind_parameter_index=t.va,s._sqlite3_sql=t.wa,s._sqlite3_normalized_sql=t.xa,s._sqlite3_changes=t.ya,s._sqlite3_close_v2=t.za,s._sqlite3_create_function_v2=t.Aa,s._sqlite3_update_hook=t.Ba,s._sqlite3_open=t.Ca,Le=s._malloc=t.Da,ce=s._free=t.Ea,s._RegisterExtensionFunctions=t.Fa,Xr=t.Ga,Yr=t.Ha,xe=t.Ia,H=t.Ja,Te=t.Ka,Pe=t.M,X=t.O,cr(),C--,s.monitorRunDependencies?.(C),C==0&&se&&(t=se,se=null,t()),lr}C++,s.monitorRunDependencies?.(C);var r={a:Rt};return s.instantiateWasm?new Promise(t=>{s.instantiateWasm(r,(n,i)=>{t(e(n))})}):(Xe??=s.locateFile?s.locateFile("sql-wasm.wasm",we):we+"sql-wasm.wasm",e((await ft(r)).instance))})(),sr(),I}),z)};j.exports=Q,j.exports.default=Q})(hr)),hr.exports}var ot=an();const un=nn(ot),fn=on({__proto__:null,default:un},[ot]);export{fn as s};
@@ -0,0 +1 @@
1
+ function x(i){return i.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}function y(i,a,u){return{temperature:a?.temperature,maxTokens:a?.maxTokens||Math.min(i.maxTokens,32e3),signal:a?.signal,apiKey:u||a?.apiKey,cacheRetention:a?.cacheRetention,sessionId:a?.sessionId,headers:a?.headers,onPayload:a?.onPayload,maxRetryDelayMs:a?.maxRetryDelayMs,metadata:a?.metadata}}function m(i){return i==="xhigh"?"high":i}function C(i,a,u,h){const o={...{minimal:1024,low:2048,medium:8192,high:16384},...h},s=1024,l=m(u);let n=o[l];const t=Math.min(i+n,a);return t<=n&&(n=Math.max(0,t-s)),{maxTokens:t,thinkingBudget:n}}function M(i,a,u){const h=new Map,c=i.map(n=>{if(n.role==="user")return n;if(n.role==="toolResult"){const t=h.get(n.toolCallId);return t&&t!==n.toolCallId?{...n,toolCallId:t}:n}if(n.role==="assistant"){const t=n,r=t.provider===a.provider&&t.api===a.api&&t.model===a.id,p=t.content.flatMap(e=>{if(e.type==="thinking")return e.redacted?r?e:[]:r&&e.thinkingSignature?e:!e.thinking||e.thinking.trim()===""?[]:r?e:{type:"text",text:e.thinking};if(e.type==="text")return r?e:{type:"text",text:e.text};if(e.type==="toolCall"){const d=e;let f=d;if(!r&&d.thoughtSignature&&(f={...d},delete f.thoughtSignature),!r&&u){const g=u(d.id,a,t);g!==d.id&&(h.set(d.id,g),f={...f,id:g})}return f}return e});return{...t,content:p}}return n}),o=[];let s=[],l=new Set;for(let n=0;n<c.length;n++){const t=c[n];if(t.role==="assistant"){if(s.length>0){for(const e of s)l.has(e.id)||o.push({role:"toolResult",toolCallId:e.id,toolName:e.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});s=[],l=new Set}const r=t;if(r.stopReason==="error"||r.stopReason==="aborted")continue;const p=r.content.filter(e=>e.type==="toolCall");p.length>0&&(s=p,l=new Set),o.push(t)}else if(t.role==="toolResult")l.add(t.toolCallId),o.push(t);else if(t.role==="user"){if(s.length>0){for(const r of s)l.has(r.id)||o.push({role:"toolResult",toolCallId:r.id,toolName:r.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});s=[],l=new Set}o.push(t)}else o.push(t)}return o}export{C as a,y as b,m as c,x as s,M as t};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/index-NCsQEpn3.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BKFeHvuQ.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BlSQnyL2.css">
10
10
  </head>
11
11
  <body>
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>slicc</title>
7
7
  <link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
8
- <script type="module" crossorigin src="/assets/index-NCsQEpn3.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BKFeHvuQ.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-BlSQnyL2.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliccy",
3
- "version": "1.23.0",
3
+ "version": "1.23.2",
4
4
  "description": "Browser-based coding agent with thin CLI server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -47,27 +47,10 @@
47
47
  "prepare": "husky"
48
48
  },
49
49
  "dependencies": {
50
- "@adobe/helix-rum-js": "^2.14.2",
51
- "@cantoo/pdf-lib": "^2.6.1",
52
- "@imagemagick/magick-wasm": "^0.0.39",
53
- "@isomorphic-git/lightning-fs": "4.6.2",
54
- "@mariozechner/pi-agent-core": "^0.55.4",
55
- "@mariozechner/pi-ai": "^0.55.4",
56
- "@mariozechner/pi-coding-agent": "^0.57.1",
57
- "@xterm/addon-fit": "^0.11.0",
58
- "@xterm/xterm": "^6.0.0",
59
- "buffer": "6.0.3",
60
50
  "express": "^4.21.2",
61
- "fflate": "^0.8.2",
62
- "isomorphic-dompurify": "^3.1.0",
63
- "isomorphic-git": "1.37.4",
64
- "just-bash": "2.11.7",
65
- "marked": "^17.0.4",
66
- "unpdf": "^1.4.0",
67
51
  "ws": "^8.18.0"
68
52
  },
69
53
  "devDependencies": {
70
- "@cloudflare/workers-types": "4.20260317.1",
71
54
  "@eslint/js": "10.0.1",
72
55
  "@playwright/test": "^1.58.2",
73
56
  "@semantic-release/commit-analyzer": "13.0.1",
@@ -75,25 +58,18 @@
75
58
  "@semantic-release/github": "12.0.6",
76
59
  "@semantic-release/npm": "13.1.5",
77
60
  "@semantic-release/release-notes-generator": "14.1.0",
78
- "@types/express": "^5.0.0",
79
- "@types/jsdom": "^28.0.0",
80
61
  "@types/node": "^22.13.0",
81
- "@types/ws": "^8.5.14",
82
- "electron": "41.0.4",
83
62
  "eslint": "10.1.0",
84
63
  "eslint-config-prettier": "10.1.8",
85
- "fake-indexeddb": "6.2.5",
86
64
  "globals": "17.4.0",
87
65
  "husky": "9.1.7",
88
- "jsdom": "^28.1.0",
89
66
  "lint-staged": "16.4.0",
90
67
  "prettier": "3.8.1",
91
- "puppeteer-core": "^24.39.1",
92
68
  "semantic-release": "25.0.3",
93
69
  "typescript": "^5.7.3",
94
70
  "typescript-eslint": "8.57.2",
95
71
  "vite": "^6.1.0",
96
- "vitest": "4.0.18"
72
+ "vitest": "4.1.1"
97
73
  },
98
74
  "lint-staged": {
99
75
  "**/*.{ts,js,mjs}": [