zcode-app-cli 3.14.3-27 → 3.14.4-29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/bin/zcode.js +2 -0
- package/package.json +2 -2
- package/vendor/cli-config.cjs +560 -0
- package/vendor/extraction.json +14 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +535 -37
- package/vendor/packages/node-repl-host/dist/mcp/server.js +1 -1
- package/vendor/zcode.cjs +5 -5
- package/zcode-runtime.lock.json +3 -3
package/vendor/zcode.cjs
CHANGED
|
@@ -1819,7 +1819,7 @@ WHERE id IN (SELECT id FROM repairs);
|
|
|
1819
1819
|
error_type = coalesce(excluded.error_type, tool_usage.error_type),
|
|
1820
1820
|
error_code = coalesce(excluded.error_code, tool_usage.error_code),
|
|
1821
1821
|
error_message = coalesce(excluded.error_message, tool_usage.error_message)
|
|
1822
|
-
`).run(...nas(t)),await gRe(e)}async function gRe(e,t={}){let n=t.beforeTime??Date.now()-tas;e.exec("begin immediate");try{e.prepare("delete from model_usage where started_at < ?").run(n),e.prepare("delete from turn_usage where started_at < ?").run(n),e.prepare("delete from tool_usage where started_at < ?").run(n),e.exec("commit")}catch(o){throw e.exec("rollback"),o}}function nas(e){return[e.id,e.sessionID,e.turnID??null,e.traceID??null,e.toolCallID,e.toolName,e.sideEffectScope??null,Jkr(e.readOnly),Jkr(e.destructive),e.approvalStatus??null,e.status,e.startedAt,e.firstOutputAt??null,e.completedAt??null,e.durationMs??null,e.timeToFirstOutputMs??null,e.exitCode??null,Ih(e.outputBytes),Ih(e.stdoutBytes),Ih(e.stderrBytes),p3(e.truncated),Ih(e.retryCount),p3(e.retryable),p3(e.cancelledByUser),e.errorType??null,e.errorCode??null,e.errorMessage??null]}async function Xkr(e,t){let{since:n,until:o,tzOffsetMs:s}=t,a=864e5,l=e.prepare(`select
|
|
1822
|
+
`).run(...nas(t)),await gRe(e)}async function gRe(e,t={}){let n=t.beforeTime??Date.now()-tas;return require(require("node:path").join(__dirname,"cli-config.cjs")).pruneSqliteUsage(e,t,n,()=>{e.exec("begin immediate");try{e.prepare("delete from model_usage where started_at < ?").run(n),e.prepare("delete from turn_usage where started_at < ?").run(n),e.prepare("delete from tool_usage where started_at < ?").run(n),e.exec("commit")}catch(o){throw e.exec("rollback"),o}})}function nas(e){return[e.id,e.sessionID,e.turnID??null,e.traceID??null,e.toolCallID,e.toolName,e.sideEffectScope??null,Jkr(e.readOnly),Jkr(e.destructive),e.approvalStatus??null,e.status,e.startedAt,e.firstOutputAt??null,e.completedAt??null,e.durationMs??null,e.timeToFirstOutputMs??null,e.exitCode??null,Ih(e.outputBytes),Ih(e.stdoutBytes),Ih(e.stderrBytes),p3(e.truncated),Ih(e.retryCount),p3(e.retryable),p3(e.cancelledByUser),e.errorType??null,e.errorCode??null,e.errorMessage??null]}async function Xkr(e,t){let{since:n,until:o,tzOffsetMs:s}=t,a=864e5,l=e.prepare(`select
|
|
1823
1823
|
coalesce(sum(computed_total_tokens), 0) as totalTokens,
|
|
1824
1824
|
coalesce(sum(input_tokens), 0) as inputTokens,
|
|
1825
1825
|
coalesce(sum(output_tokens), 0) as outputTokens,
|
|
@@ -1893,7 +1893,7 @@ WHERE id IN (SELECT id FROM repairs);
|
|
|
1893
1893
|
provider_total_tokens as providerTotalTokens
|
|
1894
1894
|
from model_usage
|
|
1895
1895
|
where session_id = ?
|
|
1896
|
-
order by started_at asc, id asc`).all(t.sessionID),o=0,s=0,a=0,l=0,u=0,f=0,g=0,_={};for(let b of n){let w=Number(b.providerTotalTokens??b.computedTotalTokens??0),T=oas(b),I=ias(b.querySource),E=I===void 0?T:Math.max(0,T-(_[I]??0));I!==void 0&&(_[I]=T);let R=Math.max(0,w-T),L=Number(b.outputTokens??0),U=Number(b.reasoningTokens??0);o+=E+R,s+=E,a+=L,l+=U,I===void 0&&(u+=Number(b.cacheCreationTokens??0),f+=Number(b.cacheReadTokens??0)),b.status==="error"&&(g+=1)}return{sessionID:t.sessionID,totalTokens:o,inputTokens:s,outputTokens:a,reasoningTokens:l,cacheCreationTokens:u,cacheReadTokens:f,modelRequestCount:n.length,modelErrorCount:g,inputBaselineBySource:_}}function ras(e,t,n){let o=Ih(e);return o>0?o:Ih(t)+Ih(n)}function oas(e){let t=Ih(e.inputTokens),n=Ih(e.cacheCreationTokens)+Ih(e.cacheReadTokens);if(t<=0)return n;if(n<=0)return t;let o=Ih(e.outputTokens),s=Ih(e.providerTotalTokens??e.computedTotalTokens);if(s>0){let a=Math.abs(s-(t+o));if(Math.abs(s-(t+n+o))<a)return t+n}return t}function ias(e){if(e==="main_turn"||e==="subagent"||e==="workflow_child")return e}function Ih(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function p3(e){return e?1:0}function Jkr(e){return e===void 0?null:p3(e)}var eas,tas,exr=Y(()=>{"use strict";bA();eas=30,tas=eas*24*60*60*1e3;r(Kkr,"recordModelUsage");r(Zkr,"upsertTurnUsage");r(Ykr,"upsertToolUsage");r(gRe,"pruneUsage");r(nas,"toolUsageValues");r(Xkr,"queryAppUsage");r(Qkr,"queryTaskUsage");r(ras,"inputSideTokensFromNormalizedUsage");r(oas,"inputSideTokensFromStoredUsage");r(ias,"taskUsageInputBaselineSource");r(Ih,"integer");r(p3,"boolean");r(Jkr,"nullableBoolean")});function txr(e){if(!e.data||typeof e.data!="object"||Array.isArray(e.data))return null;let t=e.data.ack;if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t.result;if(!n||typeof n!="object"||Array.isArray(n))return null;let o=n.sessionId;return typeof o=="string"&&o.length>0?o:null}function aas(e){let t=String(e.child.id),n=e.commandFact.ack.result,o=n&&typeof n=="object"&&!Array.isArray(n)?n:null,s=typeof o?.sessionId=="string"?o.sessionId.trim():"";if(!(o?.type==="forkAssistant"||o?.type==="createSelectionSideSession"||o?.type==="editUserQuery"&&o.disposition==="fork")||!s||s!==t)throw new Error("Fork bundle command result is missing, invalid, or not child-local");let l=new Set(e.messages.map(g=>String(g.info.id))),u=r((g,_)=>{if(typeof g=="string"&&!l.has(g))throw new Error(`Fork bundle ${_} is not child-local: ${g}`)},"assertMessage"),f=new Set;e.goal&&f.add(e.goal.source.targetID);for(let g of e.messages){if(String(g.info.sessionID)!==t)throw new Error("Fork bundle message session is not child-local");if(g.info.role==="assistant"&&!l.has(String(g.info.parentID)))throw new Error("Fork bundle assistant parent is not child-local");let _=g.info.anchor;for(let b of _?.orderedMessageIds??[])u(b,"anchor orderedMessageId");if(u(_?.boundaryMessageId,"anchor boundaryMessageId"),_?.goalBoundary?.kind==="snapshot"){if(String(_.goalBoundary.target.sessionID)!==t)throw new Error("Fork bundle anchor goal session is not child-local");f.add(_.goalBoundary.target.targetID)}for(let b of g.parts){if(String(b.sessionID)!==t||String(b.messageID)!==String(g.info.id))throw new Error("Fork bundle part owner is not child-local");if(b.type==="timeline"&&(u(b.anchorMessageId,"timeline anchorMessageId"),b.timelineType==="context_compaction"&&u(b.summaryMessageId,"timeline summaryMessageId"),b.timelineType==="goal_verification"&&f.add(b.targetId)),b.type==="compaction"){u(b.tail_start_id,"compaction tail_start_id"),u(b.summaryMessageId,"compaction summaryMessageId");let w=b.compactBoundary;u(w?.lastSummarizedMessageId,"compact lastSummarizedMessageId");for(let T of w?.summaryMessageIds??[])u(T,"compact summaryMessageId");for(let T of w?.attachmentMessageIds??[])u(T,"compact attachmentMessageId");for(let T of w?.hookResultMessageIds??[])u(T,"compact hookResultMessageId");u(w?.preservedSegment?.headMessageId,"compact preserved head"),u(w?.preservedSegment?.anchorMessageId,"compact preserved anchor"),u(w?.preservedSegment?.tailMessageId,"compact preserved tail")}if(b.type==="tool"&&b.state.status==="completed"){for(let w of b.state.attachments??[])if(String(w.sessionID)!==t||String(w.messageID)!==String(g.info.id))throw new Error("Fork bundle tool attachment owner is not child-local")}}}if(e.goal&&String(e.goal.source.sessionID)!==t)throw new Error("Fork bundle goal session is not child-local");for(let g of e.entries){if(String(g.sessionID)!==t)throw new Error("Fork bundle verifier entry session is not child-local");let _=g.data&&typeof g.data=="object"&&!Array.isArray(g.data)?g.data:{},b=_.payload&&typeof _.payload=="object"&&!Array.isArray(_.payload)?_.payload:{};if(u(b.anchorAssistantMessageId,"verifier assistant anchor"),typeof b.targetId=="string"&&!f.has(b.targetId))throw new Error("Fork bundle verifier target is not child-local")}}function dtt(e={}){return new fH(e)}var rxr,nxr,fH,oxr=Y(()=>{"use strict";XSr();rxr=require("node:sqlite");pwr();ett();Nwr();jwr();gfe();zwr();$Qt();skr();pkr();HQt();Akr();Nkr();Qet();Wkr();mRe();Gkr();exr();r(txr,"forkChildSessionId");r(aas,"assertForkBundleChildLocal");nxr=Symbol("deferredSqliteStartup"),fH=class e{static{r(this,"SqliteSessionStore")}db;dbPath;forkCommitFaultAt;dwfJournalStore;constructor(t={},n){this.dbPath=t.dbPath??MQt(),this.forkCommitFaultAt=t.forkCommitFaultAt;let o=t.startupLockTimeoutMs??ntt;try{Fwr(this.dbPath),xb({operation:"sqliteOpen",path:this.dbPath}),this.db=new rxr.DatabaseSync(this.dbPath,{timeout:o})}catch(s){throw new aF(`Failed to open SQLite session database at ${this.dbPath}`,{cause:s,dbPath:this.dbPath,kind:"open_failed"})}try{n!==nxr&&(Cwr(this.db,this.dbPath,o),this.db.exec("pragma busy_timeout = 10000"))}catch(s){try{this.db.close()}catch{}throw s}}static async openStartup(t={},n={}){let o=new e(t,nxr);try{return await Ewr(o.db,o.dbPath,n),o.db.exec("pragma busy_timeout = 10000"),o}catch(s){try{o.close()}catch{}throw s}}getDatabasePath(){return this.dbPath}close(){this.db.close()}throwBeforeWrite(){xb({operation:"sqliteRun",path:this.dbPath})}maybeThrowForkCommitFault(t){if(this.forkCommitFaultAt===t)throw new Error(`injected fork commit fault: ${t}`)}async createSession(t){return this.throwBeforeWrite(),fRe(this.db,t)}async createForkedSessionWithMetadata(t,n){if(this.throwBeforeWrite(),!t.parentID||String(t.parentID)!==n.parentSessionId)throw new Error("Fork child metadata parent does not match session parentID");let o=n.forkTarget.orderedMessageIds,s=n.forkTarget.boundaryMessageId.trim().length>0&&(o.length===0||o.at(-1)===n.forkTarget.boundaryMessageId);if(!n.sourceCommandId.trim()||!s)throw new Error("Fork child metadata is invalid");let a=`v4_command_fact:child:${n.parentSessionId}:${n.sourceCommandId}`;this.db.exec("begin immediate");try{let l=uH(this.db,{sessionID:t.parentID,type:"v4/command_fact"}).find(g=>g.id===a);if(l){let g=txr(l);if(!g)throw new Error(`Fork child command fact is corrupt: ${a}`);let _=Vte(this.db,g);if(!_)throw new Error(`Fork child session is missing: ${g}`);return this.db.exec("commit"),_}let u=fRe(this.db,t),f=Date.now();return tM(this.db,{id:a,sessionID:t.parentID,type:"v4/command_fact",time:{created:f,updated:f},data:{source:"child",ack:{commandId:n.sourceCommandId,status:"accepted",revisionAtDecision:0,result:{type:"forkAssistant",sessionId:String(u.id)}},metadata:n}}),this.db.exec("commit"),u}catch(l){throw this.db.exec("rollback"),l}}async commitForkBundle(t){this.throwBeforeWrite();let{child:n,commandFact:o,initialInput:s}=t;if(!n.parentID||String(n.parentID)!==o.parentSessionId||s&&String(s.sessionID)!==String(n.id)||o.ack.commandId!==o.sourceCommandId)throw new Error("Fork commit bundle identity is invalid");let a=`v4_command_fact:child:${o.parentSessionId}:${o.sourceCommandId}`;this.db.exec("begin immediate");try{let l=uH(this.db,{sessionID:n.parentID,type:"v4/command_fact"}).find(g=>g.id===a);if(l){let g=txr(l),_=g?Vte(this.db,g):null;if(!_)throw new Error(`Fork bundle command fact is corrupt: ${a}`);return this.db.exec("commit"),_}aas(t);let u=fRe(this.db,n);this.maybeThrowForkCommitFault("afterChild");for(let g of t.messages){let _=t.copySources?.messages[g.info.id];await pH(this.db,g.info,_?{sessionID:n.parentID,id:_}:void 0);for(let b of g.parts){let w=t.copySources?.parts[b.id];await pme(this.db,b,w?{sessionID:n.parentID,id:w}:void 0)}}this.maybeThrowForkCommitFault("afterMessages"),t.goal&&DQt(this.db,{source:t.goal.source,sessionID:n.id,status:t.goal.status}),this.maybeThrowForkCommitFault("afterGoal");for(let g of t.entries)tM(this.db,g);this.maybeThrowForkCommitFault("afterEntries"),s&&await ZQt(this.db,s),this.maybeThrowForkCommitFault("afterInput");let f=Date.now();return tM(this.db,{id:a,sessionID:n.parentID,type:"v4/command_fact",time:{created:f,updated:f},data:{source:"child",ack:o.ack,metadata:o.metadata}}),this.maybeThrowForkCommitFault("afterCommandFact"),this.maybeThrowForkCommitFault("beforeCommit"),this.db.exec("commit"),u}catch(l){throw this.db.exec("rollback"),l}}async commitSharedContextImportBundle(t){this.throwBeforeWrite();let{session:n,contextMessage:o,provenance:s}=t;if(String(o.info.sessionID)!==String(n.id)||String(s.sessionID)!==String(n.id)||!s.id.includes(String(n.id))||o.info.role!=="user"||o.info.visibility!=="model-only"||o.info.source!=="shared_context")throw new Error("Shared context import bundle identity is invalid");this.db.exec("begin immediate");try{let a=Vte(this.db,n.id);if(a){if(!uH(this.db,{sessionID:n.id,type:s.type}).find(f=>f.id===s.id))throw new Error("Shared context import session is incomplete");return this.db.exec("commit"),a}let l=fRe(this.db,n);await pH(this.db,o.info);for(let u of o.parts)await pme(this.db,u);return tM(this.db,s),this.db.exec("commit"),l}catch(a){throw this.db.exec("rollback"),a}}async transitionSharedContextImport(t){this.throwBeforeWrite(),this.db.exec("begin immediate");try{let n=uH(this.db,{sessionID:t.sessionID,type:"v4/shared_context_import"}).find(l=>{let u=l.data;return!!(u&&typeof u=="object"&&!Array.isArray(u)&&u.contextId===t.contextId)});if(!n)return this.db.exec("rollback"),!1;let o=n.data;if(!(Array.isArray(t.expectedStatus)?t.expectedStatus:[t.expectedStatus]).includes(o.status))return this.db.exec("rollback"),!1;tM(this.db,{...n,time:{...n.time,updated:Date.now()},data:{...o,status:t.status,...t.sourceId?{sourceId:t.sourceId}:{}}});let a=(await hRe(this.db,{sessionID:t.sessionID})).find(l=>{let u=l.info.metadata;return!!(u&&typeof u=="object"&&u.contextId===t.contextId)});return a&&await pH(this.db,{...a.info,metadata:{...a.info.metadata??{},sharedContextStatus:t.status}}),this.db.exec("commit"),!0}catch(n){throw this.db.exec("rollback"),n}}async updateSession(t){return this.throwBeforeWrite(),Xet(this.db,t)}async getSession(t){return Vte(this.db,t)}async listSessions(t={}){return qSr(this.db,t)}async claimLegacySessionWorkspace(t){return this.throwBeforeWrite(),WSr(this.db,t)}async repairLegacyRemoteSessionWorkspace(t){return this.throwBeforeWrite(),VSr(this.db,t)}async repairRemoteSessionPaths(t){return this.throwBeforeWrite(),HSr(this.db,t)}async saveMessage(t,n){return this.throwBeforeWrite(),pH(this.db,t,n)}async removeMessage(t){return this.throwBeforeWrite(),mkr(this.db,t)}async savePart(t,n){return this.throwBeforeWrite(),pme(this.db,t,n)}async removePart(t){return this.throwBeforeWrite(),gkr(this.db,t)}async messageWithParts(t){return _kr(this.db,t)}async messages(t){return hRe(this.db,t)}async saveSessionEntry(t){return this.throwBeforeWrite(),tM(this.db,t)}async sessionEntries(t){return uH(this.db,t)}async saveSessionInput(t){return this.throwBeforeWrite(),ZQt(this.db,t)}async commitPermissionFullAccess(t){return this.throwBeforeWrite(),YSr(this.db,t)}async updateSessionInputs(t){return this.throwBeforeWrite(),Fkr(this.db,t)}async promoteSessionInput(t){return this.throwBeforeWrite(),jkr(this.db,t)}async markSessionInputPromoted(t){return this.throwBeforeWrite(),Bkr(this.db,t)}async settleSessionInput(t){return this.throwBeforeWrite(),Ukr(this.db,t)}async listSessionInputs(t){return zkr(this.db,t)}async getSessionInputById(t){return $kr(this.db,t)}async readTodos(t){return Vkr(this.db,t)}async updateTodos(t){return this.throwBeforeWrite(),Hkr(this.db,t)}async readTarget(t){return JR(this.db,t)}async setTarget(t){return ewr(this.db,{objective:t.objective,sessionID:t.sessionID,status:t.status??"active",tokenBudget:t.tokenBudget})}async cloneTargetForFork(t){return this.throwBeforeWrite(),DQt(this.db,{source:t.source,sessionID:t.sessionID,status:t.status??t.source.status})}async createTarget(t){return twr(this.db,t)}async updateTargetStatus(t){return nwr(this.db,t)}async startTargetRun(t){return rwr(this.db,t)}async heartbeatTargetRun(t){return owr(this.db,t)}async finishTargetRun(t){return iwr(this.db,t)}async recoverInterruptedTargetRun(t){return swr(this.db,t)}async accountTargetUsage(t){return awr(this.db,t)}async updateTargetSummaryTitle(t){return cwr(this.db,t)}async clearTarget(t){return lwr(this.db,t)}async recordModelUsage(t){return Kkr(this.db,t)}async upsertTurnUsage(t){return Zkr(this.db,t)}async upsertToolUsage(t){return Ykr(this.db,t)}async pruneUsage(t){return gRe(this.db,t)}async queryAppUsage(t){return Xkr(this.db,t)}async queryTaskUsage(t){return Qkr(this.db,t)}async recordInputHistory(t){return okr(this.db,t)}async recallPreviousInputHistory(t){return qQt(this.db,t)}async getProjectPermission(t){return VQt(this.db,t)}async saveProjectPermission(t){return akr(this.db,t)}getProjectPermissionMode(t){return ckr(this.db,t)}saveProjectPermissionMode(t){return lkr(this.db,t)}async setRevert(t){return GSr(this.db,t)}async clearRevert(t){return JSr(this.db,t)}async upsertScriptWorkflowDefinition(t){return Pkr(this.db,t)}async createScriptWorkflowRun(t){return Rkr(this.db,t)}async updateScriptWorkflowRun(t){return Dkr(this.db,t)}async getScriptWorkflowRun(t){return utt(this.db,t)}async listScriptWorkflowRuns(t){return Okr(this.db,t)}async createScriptWorkflowActivity(t){return bkr(this.db,t)}async updateScriptWorkflowActivity(t){return Skr(this.db,t)}async findCachedScriptWorkflowActivity(t){return wkr(this.db,t)}async listScriptWorkflowActivities(t){return kkr(this.db,t)}async appendScriptWorkflowEvent(t){return xkr(this.db,t)}async listScriptWorkflowEvents(t){return Tkr(this.db,t)}async createSessionTaskLink(t){return Ikr(this.db,t)}workflowJournalStore(){return this.dwfJournalStore??=zQt(this.db),this.dwfJournalStore}debugMigrationIds(){return Bwr(this.db)}debugCounts(t){return Uwr(this.db,t)}};r(dtt,"openStartupSqliteSessionStore")});var ixr=Y(()=>{"use strict";oxr();$Qt();ett()});async function gas(e,t){await e.writeFile(t,"utf8")}function pxr(){return YQt===void 0&&(YQt=Math.round(Date.now()-(0,yRe.uptime)()*1e3)),YQt}async function _as(e){if(e===process.pid)return pxr();try{if(process.platform==="linux"){let t=await(0,J0.readFile)(`/proc/${e}/stat`,"utf8"),n=t.lastIndexOf(")");if(n<0)return null;let o=t.slice(n+2).split(" "),s=Number(o[19]);if(!Number.isFinite(s))return null;let a=Date.now()-(0,yRe.uptime)()*1e3;return Math.round(a+s*1e3/has)}if(process.platform==="darwin"){let{stdout:t}=await sxr("ps",["-o","lstart=","-p",String(e)]),n=Date.parse(t.trim());return Number.isFinite(n)?n:null}if(process.platform==="win32"){let{stdout:t}=await sxr("powershell.exe",["-NoProfile","-Command",`[DateTimeOffset]::new((Get-Process -Id ${e}).StartTime).ToUnixTimeMilliseconds()`]),n=Number(t.trim());return Number.isFinite(n)?n:null}return null}catch{return null}}async function yas(e={}){let t=(0,hw.resolve)(e.homeDir??(0,yRe.homedir)()),n=(0,hw.resolve)(e.userConfigPath??(0,hw.join)(t,".zcode","cli","config.json")),o=await was(n),s=fxr(o.storage)?o.storage:{},a=typeof s.dir=="string"?s.dir.trim():"",l=a?kas(a,t):(0,hw.join)(t,".zcode");return(0,hw.join)(l,pas,fas)}async function mme(e={}){return vas({...e,filePath:await yas(e)})}function vas(e){return new XQt(e)}async function bas(e,t,n,o){for(let s=0;;s+=1)try{await e(t,n);return}catch(a){let l=o[s];if(l===void 0||!Sas(a))throw a;await(0,dxr.setTimeout)(l)}}function Sas(e){if(!(e instanceof Error)||!("code"in e))return!1;let t=e.code;return t==="EPERM"||t==="EBUSY"||t==="EACCES"}async function was(e){try{let t=JSON.parse(await(0,J0.readFile)(e,"utf8"));return fxr(t)?t:{}}catch(t){if(_Re(t,"ENOENT"))return{};throw new Error(`Unable to read trusted user config for Workspace Hook Trust store: ${e}`,{cause:t})}}function kas(e,t){return e.startsWith("~/")?(0,hw.join)(t,e.slice(2)):(0,hw.isAbsolute)(e)?(0,hw.resolve)(e):(0,hw.resolve)(t,e)}function fme(e){return`${e.workspaceIdentity}\0${e.hookDeclarationDigest}`}function axr(e){return Date.parse(e.lastUsedAt??e.grantedAt)}function fxr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _Re(e,t){return e instanceof Error&&"code"in e&&e.code===t}function xas(e){return new Promise(t=>setTimeout(t,e))}var J0,cxr,lxr,uxr,yRe,hw,dxr,cas,las,uas,das,pas,fas,mas,has,sxr,YQt,XQt,mxr=Y(()=>{"use strict";J0=require("node:fs/promises"),cxr=require("node:child_process"),lxr=require("node:util"),uxr=require("node:crypto"),yRe=require("node:os"),hw=require("node:path"),dxr=require("node:timers/promises");nr();cas=5e3,las=3e4,uas=10,das=[50,100,200,400,800],pas="security",fas="workspace-hook-trust-v1.json",mas=2e3,has=100,sxr=(0,lxr.promisify)(cxr.execFile);r(gas,"defaultWriteLockOwnerMetadata");r(pxr,"currentProcessStartTimeMs");r(_as,"probeProcessStartTimeDefault");r(yas,"resolveWorkspaceHookTrustStorePath");r(mme,"createDefaultFileWorkspaceHookTrustStore");r(vas,"createFileWorkspaceHookTrustStore");XQt=class{static{r(this,"FileWorkspaceHookTrustStore")}filePath;lockPath;now;lockTimeoutMs;staleLockMs;beforeRename;renameFile;renameRetryDelaysMs;probeProcessStartTime;writeLockOwnerMetadata;mutationQueue=Promise.resolve();constructor(t){this.filePath=(0,hw.resolve)(t.filePath),this.lockPath=`${this.filePath}.lock`,this.now=t.now??Date.now,this.lockTimeoutMs=t.lockTimeoutMs??cas,this.staleLockMs=t.staleLockMs??las,this.beforeRename=t.beforeRename,this.renameFile=t.renameFile??J0.rename,this.renameRetryDelaysMs=t.renameRetryDelaysMs??das,this.probeProcessStartTime=t.probeProcessStartTime??_as,this.writeLockOwnerMetadata=t.writeLockOwnerMetadata??gas}load(){return this.enqueue(async()=>(await this.ensureSecurityDirectory(),this.withLock(()=>this.readCurrent(!0))))}grant(t){let n=t.map(o=>QV.parse(o));return this.mutate(o=>{let s=new Map(o.records.map(a=>[fme(a),a]));for(let a of n)s.set(fme(a),a);return{schemaVersion:XV,records:[...s.values()]}})}revoke(t){if(t.hookDeclarationDigests?.length===0)return Promise.reject(new Error("hookDeclarationDigests must be undefined or non-empty"));let n=t.hookDeclarationDigests?new Set(t.hookDeclarationDigests):void 0;return this.mutate(o=>({schemaVersion:XV,records:o.records.filter(s=>s.workspaceIdentity!==t.workspaceIdentity||n!==void 0&&!n.has(s.hookDeclarationDigest))}))}touch(t){let n=new Set(t.hookDeclarationDigests),o=t.usedAt??new Date(this.now()).toISOString();return this.mutate(s=>({schemaVersion:XV,records:s.records.map(a=>a.workspaceIdentity===t.workspaceIdentity&&n.has(a.hookDeclarationDigest)?{...a,lastUsedAt:o}:a)}))}compact(t){if(!Number.isFinite(t.maxAgeMs)||t.maxAgeMs<0)throw new Error("maxAgeMs must be a nonnegative finite number");if(!Number.isInteger(t.maxRecords)||t.maxRecords<1)throw new Error("maxRecords must be a positive integer");let n=t.now??this.now(),o=new Set(t.current.map(s=>fme({workspaceIdentity:s.workspaceIdentity,hookDeclarationDigest:s.hookDeclarationDigest})));return this.mutate(s=>{let a=s.records.filter(g=>{if(o.has(fme(g)))return!0;let _=Date.parse(g.lastUsedAt??g.grantedAt);return Number.isFinite(_)&&n-_<=t.maxAgeMs}),l=a.filter(g=>o.has(fme(g))),u=a.filter(g=>!o.has(fme(g))).sort((g,_)=>axr(_)-axr(g)),f=Math.max(0,t.maxRecords-l.length);return{schemaVersion:XV,records:[...l,...u.slice(0,f)]}})}mutate(t){return this.enqueue(async()=>(await this.ensureSecurityDirectory(),this.withLock(async()=>{let n=await this.readCurrent(!0),o={schemaVersion:XV,records:n.status==="ok"?n.records:[]},s=$Qe.parse(t(o));return await this.atomicWrite(s),s})))}enqueue(t){let n=this.mutationQueue.then(t,t);return this.mutationQueue=n.then(()=>{},()=>{}),n}async withLock(t){let{handle:n,token:o}=await this.acquireLock();try{return await t()}finally{await n.close().catch(()=>{}),await this.releaseLockIfOwned(o)}}async acquireLock(){let t=Date.now();for(;;){let n;try{n=await(0,J0.open)(this.lockPath,"wx",384);let o=(0,uxr.randomUUID)(),s=`${JSON.stringify({pid:process.pid,startTime:pxr(),token:o})}
|
|
1896
|
+
order by started_at asc, id asc`).all(t.sessionID),o=0,s=0,a=0,l=0,u=0,f=0,g=0,_={};for(let b of n){let w=Number(b.providerTotalTokens??b.computedTotalTokens??0),T=oas(b),I=ias(b.querySource),E=I===void 0?T:Math.max(0,T-(_[I]??0));I!==void 0&&(_[I]=T);let R=Math.max(0,w-T),L=Number(b.outputTokens??0),U=Number(b.reasoningTokens??0);o+=E+R,s+=E,a+=L,l+=U,I===void 0&&(u+=Number(b.cacheCreationTokens??0),f+=Number(b.cacheReadTokens??0)),b.status==="error"&&(g+=1)}return{sessionID:t.sessionID,totalTokens:o,inputTokens:s,outputTokens:a,reasoningTokens:l,cacheCreationTokens:u,cacheReadTokens:f,modelRequestCount:n.length,modelErrorCount:g,inputBaselineBySource:_}}function ras(e,t,n){let o=Ih(e);return o>0?o:Ih(t)+Ih(n)}function oas(e){let t=Ih(e.inputTokens),n=Ih(e.cacheCreationTokens)+Ih(e.cacheReadTokens);if(t<=0)return n;if(n<=0)return t;let o=Ih(e.outputTokens),s=Ih(e.providerTotalTokens??e.computedTotalTokens);if(s>0){let a=Math.abs(s-(t+o));if(Math.abs(s-(t+n+o))<a)return t+n}return t}function ias(e){if(e==="main_turn"||e==="subagent"||e==="workflow_child")return e}function Ih(e){return typeof e!="number"||!Number.isFinite(e)?0:Math.max(0,Math.trunc(e))}function p3(e){return e?1:0}function Jkr(e){return e===void 0?null:p3(e)}var eas,tas,exr=Y(()=>{"use strict";bA();eas=30,tas=eas*24*60*60*1e3;r(Kkr,"recordModelUsage");r(Zkr,"upsertTurnUsage");r(Ykr,"upsertToolUsage");r(gRe,"pruneUsage");r(nas,"toolUsageValues");r(Xkr,"queryAppUsage");r(Qkr,"queryTaskUsage");r(ras,"inputSideTokensFromNormalizedUsage");r(oas,"inputSideTokensFromStoredUsage");r(ias,"taskUsageInputBaselineSource");r(Ih,"integer");r(p3,"boolean");r(Jkr,"nullableBoolean")});function txr(e){if(!e.data||typeof e.data!="object"||Array.isArray(e.data))return null;let t=e.data.ack;if(!t||typeof t!="object"||Array.isArray(t))return null;let n=t.result;if(!n||typeof n!="object"||Array.isArray(n))return null;let o=n.sessionId;return typeof o=="string"&&o.length>0?o:null}function aas(e){let t=String(e.child.id),n=e.commandFact.ack.result,o=n&&typeof n=="object"&&!Array.isArray(n)?n:null,s=typeof o?.sessionId=="string"?o.sessionId.trim():"";if(!(o?.type==="forkAssistant"||o?.type==="createSelectionSideSession"||o?.type==="editUserQuery"&&o.disposition==="fork")||!s||s!==t)throw new Error("Fork bundle command result is missing, invalid, or not child-local");let l=new Set(e.messages.map(g=>String(g.info.id))),u=r((g,_)=>{if(typeof g=="string"&&!l.has(g))throw new Error(`Fork bundle ${_} is not child-local: ${g}`)},"assertMessage"),f=new Set;e.goal&&f.add(e.goal.source.targetID);for(let g of e.messages){if(String(g.info.sessionID)!==t)throw new Error("Fork bundle message session is not child-local");if(g.info.role==="assistant"&&!l.has(String(g.info.parentID)))throw new Error("Fork bundle assistant parent is not child-local");let _=g.info.anchor;for(let b of _?.orderedMessageIds??[])u(b,"anchor orderedMessageId");if(u(_?.boundaryMessageId,"anchor boundaryMessageId"),_?.goalBoundary?.kind==="snapshot"){if(String(_.goalBoundary.target.sessionID)!==t)throw new Error("Fork bundle anchor goal session is not child-local");f.add(_.goalBoundary.target.targetID)}for(let b of g.parts){if(String(b.sessionID)!==t||String(b.messageID)!==String(g.info.id))throw new Error("Fork bundle part owner is not child-local");if(b.type==="timeline"&&(u(b.anchorMessageId,"timeline anchorMessageId"),b.timelineType==="context_compaction"&&u(b.summaryMessageId,"timeline summaryMessageId"),b.timelineType==="goal_verification"&&f.add(b.targetId)),b.type==="compaction"){u(b.tail_start_id,"compaction tail_start_id"),u(b.summaryMessageId,"compaction summaryMessageId");let w=b.compactBoundary;u(w?.lastSummarizedMessageId,"compact lastSummarizedMessageId");for(let T of w?.summaryMessageIds??[])u(T,"compact summaryMessageId");for(let T of w?.attachmentMessageIds??[])u(T,"compact attachmentMessageId");for(let T of w?.hookResultMessageIds??[])u(T,"compact hookResultMessageId");u(w?.preservedSegment?.headMessageId,"compact preserved head"),u(w?.preservedSegment?.anchorMessageId,"compact preserved anchor"),u(w?.preservedSegment?.tailMessageId,"compact preserved tail")}if(b.type==="tool"&&b.state.status==="completed"){for(let w of b.state.attachments??[])if(String(w.sessionID)!==t||String(w.messageID)!==String(g.info.id))throw new Error("Fork bundle tool attachment owner is not child-local")}}}if(e.goal&&String(e.goal.source.sessionID)!==t)throw new Error("Fork bundle goal session is not child-local");for(let g of e.entries){if(String(g.sessionID)!==t)throw new Error("Fork bundle verifier entry session is not child-local");let _=g.data&&typeof g.data=="object"&&!Array.isArray(g.data)?g.data:{},b=_.payload&&typeof _.payload=="object"&&!Array.isArray(_.payload)?_.payload:{};if(u(b.anchorAssistantMessageId,"verifier assistant anchor"),typeof b.targetId=="string"&&!f.has(b.targetId))throw new Error("Fork bundle verifier target is not child-local")}}function dtt(e={}){return new fH(e)}var rxr,nxr,fH,oxr=Y(()=>{"use strict";XSr();rxr=require("node:sqlite");pwr();ett();Nwr();jwr();gfe();zwr();$Qt();skr();pkr();HQt();Akr();Nkr();Qet();Wkr();mRe();Gkr();exr();r(txr,"forkChildSessionId");r(aas,"assertForkBundleChildLocal");nxr=Symbol("deferredSqliteStartup"),fH=class e{static{r(this,"SqliteSessionStore")}db;dbPath;forkCommitFaultAt;dwfJournalStore;constructor(t={},n){this.dbPath=t.dbPath??MQt(),this.forkCommitFaultAt=t.forkCommitFaultAt;let o=t.startupLockTimeoutMs??ntt;try{Fwr(this.dbPath),xb({operation:"sqliteOpen",path:this.dbPath}),this.db=new rxr.DatabaseSync(this.dbPath,{timeout:o})}catch(s){throw new aF(`Failed to open SQLite session database at ${this.dbPath}`,{cause:s,dbPath:this.dbPath,kind:"open_failed"})}try{n!==nxr&&(Cwr(this.db,this.dbPath,o),this.db.exec("pragma busy_timeout = 10000"),require(require("node:path").join(__dirname,"cli-config.cjs")).installSqliteWriteRecovery(this))}catch(s){try{this.db.close()}catch{}throw s}}static async openStartup(t={},n={}){let o=new e(t,nxr);try{return await Ewr(o.db,o.dbPath,n),o.db.exec("pragma busy_timeout = 10000"),require(require("node:path").join(__dirname,"cli-config.cjs")).installSqliteWriteRecovery(o),o}catch(s){try{o.close()}catch{}throw s}}getDatabasePath(){return this.dbPath}close(){this.db.close()}throwBeforeWrite(){xb({operation:"sqliteRun",path:this.dbPath})}maybeThrowForkCommitFault(t){if(this.forkCommitFaultAt===t)throw new Error(`injected fork commit fault: ${t}`)}async createSession(t){return this.throwBeforeWrite(),fRe(this.db,t)}async createForkedSessionWithMetadata(t,n){if(this.throwBeforeWrite(),!t.parentID||String(t.parentID)!==n.parentSessionId)throw new Error("Fork child metadata parent does not match session parentID");let o=n.forkTarget.orderedMessageIds,s=n.forkTarget.boundaryMessageId.trim().length>0&&(o.length===0||o.at(-1)===n.forkTarget.boundaryMessageId);if(!n.sourceCommandId.trim()||!s)throw new Error("Fork child metadata is invalid");let a=`v4_command_fact:child:${n.parentSessionId}:${n.sourceCommandId}`;this.db.exec("begin immediate");try{let l=uH(this.db,{sessionID:t.parentID,type:"v4/command_fact"}).find(g=>g.id===a);if(l){let g=txr(l);if(!g)throw new Error(`Fork child command fact is corrupt: ${a}`);let _=Vte(this.db,g);if(!_)throw new Error(`Fork child session is missing: ${g}`);return this.db.exec("commit"),_}let u=fRe(this.db,t),f=Date.now();return tM(this.db,{id:a,sessionID:t.parentID,type:"v4/command_fact",time:{created:f,updated:f},data:{source:"child",ack:{commandId:n.sourceCommandId,status:"accepted",revisionAtDecision:0,result:{type:"forkAssistant",sessionId:String(u.id)}},metadata:n}}),this.db.exec("commit"),u}catch(l){throw this.db.exec("rollback"),l}}async commitForkBundle(t){this.throwBeforeWrite();let{child:n,commandFact:o,initialInput:s}=t;if(!n.parentID||String(n.parentID)!==o.parentSessionId||s&&String(s.sessionID)!==String(n.id)||o.ack.commandId!==o.sourceCommandId)throw new Error("Fork commit bundle identity is invalid");let a=`v4_command_fact:child:${o.parentSessionId}:${o.sourceCommandId}`;this.db.exec("begin immediate");try{let l=uH(this.db,{sessionID:n.parentID,type:"v4/command_fact"}).find(g=>g.id===a);if(l){let g=txr(l),_=g?Vte(this.db,g):null;if(!_)throw new Error(`Fork bundle command fact is corrupt: ${a}`);return this.db.exec("commit"),_}aas(t);let u=fRe(this.db,n);this.maybeThrowForkCommitFault("afterChild");for(let g of t.messages){let _=t.copySources?.messages[g.info.id];await pH(this.db,g.info,_?{sessionID:n.parentID,id:_}:void 0);for(let b of g.parts){let w=t.copySources?.parts[b.id];await pme(this.db,b,w?{sessionID:n.parentID,id:w}:void 0)}}this.maybeThrowForkCommitFault("afterMessages"),t.goal&&DQt(this.db,{source:t.goal.source,sessionID:n.id,status:t.goal.status}),this.maybeThrowForkCommitFault("afterGoal");for(let g of t.entries)tM(this.db,g);this.maybeThrowForkCommitFault("afterEntries"),s&&await ZQt(this.db,s),this.maybeThrowForkCommitFault("afterInput");let f=Date.now();return tM(this.db,{id:a,sessionID:n.parentID,type:"v4/command_fact",time:{created:f,updated:f},data:{source:"child",ack:o.ack,metadata:o.metadata}}),this.maybeThrowForkCommitFault("afterCommandFact"),this.maybeThrowForkCommitFault("beforeCommit"),this.db.exec("commit"),u}catch(l){throw this.db.exec("rollback"),l}}async commitSharedContextImportBundle(t){this.throwBeforeWrite();let{session:n,contextMessage:o,provenance:s}=t;if(String(o.info.sessionID)!==String(n.id)||String(s.sessionID)!==String(n.id)||!s.id.includes(String(n.id))||o.info.role!=="user"||o.info.visibility!=="model-only"||o.info.source!=="shared_context")throw new Error("Shared context import bundle identity is invalid");this.db.exec("begin immediate");try{let a=Vte(this.db,n.id);if(a){if(!uH(this.db,{sessionID:n.id,type:s.type}).find(f=>f.id===s.id))throw new Error("Shared context import session is incomplete");return this.db.exec("commit"),a}let l=fRe(this.db,n);await pH(this.db,o.info);for(let u of o.parts)await pme(this.db,u);return tM(this.db,s),this.db.exec("commit"),l}catch(a){throw this.db.exec("rollback"),a}}async transitionSharedContextImport(t){this.throwBeforeWrite(),this.db.exec("begin immediate");try{let n=uH(this.db,{sessionID:t.sessionID,type:"v4/shared_context_import"}).find(l=>{let u=l.data;return!!(u&&typeof u=="object"&&!Array.isArray(u)&&u.contextId===t.contextId)});if(!n)return this.db.exec("rollback"),!1;let o=n.data;if(!(Array.isArray(t.expectedStatus)?t.expectedStatus:[t.expectedStatus]).includes(o.status))return this.db.exec("rollback"),!1;tM(this.db,{...n,time:{...n.time,updated:Date.now()},data:{...o,status:t.status,...t.sourceId?{sourceId:t.sourceId}:{}}});let a=(await hRe(this.db,{sessionID:t.sessionID})).find(l=>{let u=l.info.metadata;return!!(u&&typeof u=="object"&&u.contextId===t.contextId)});return a&&await pH(this.db,{...a.info,metadata:{...a.info.metadata??{},sharedContextStatus:t.status}}),this.db.exec("commit"),!0}catch(n){throw this.db.exec("rollback"),n}}async updateSession(t){return this.throwBeforeWrite(),Xet(this.db,t)}async getSession(t){return Vte(this.db,t)}async listSessions(t={}){return qSr(this.db,t)}async claimLegacySessionWorkspace(t){return this.throwBeforeWrite(),WSr(this.db,t)}async repairLegacyRemoteSessionWorkspace(t){return this.throwBeforeWrite(),VSr(this.db,t)}async repairRemoteSessionPaths(t){return this.throwBeforeWrite(),HSr(this.db,t)}async saveMessage(t,n){return this.throwBeforeWrite(),pH(this.db,t,n)}async removeMessage(t){return this.throwBeforeWrite(),mkr(this.db,t)}async savePart(t,n){return this.throwBeforeWrite(),pme(this.db,t,n)}async removePart(t){return this.throwBeforeWrite(),gkr(this.db,t)}async messageWithParts(t){return _kr(this.db,t)}async messages(t){return hRe(this.db,t)}async saveSessionEntry(t){return this.throwBeforeWrite(),tM(this.db,t)}async sessionEntries(t){return uH(this.db,t)}async saveSessionInput(t){return this.throwBeforeWrite(),ZQt(this.db,t)}async commitPermissionFullAccess(t){return this.throwBeforeWrite(),YSr(this.db,t)}async updateSessionInputs(t){return this.throwBeforeWrite(),Fkr(this.db,t)}async promoteSessionInput(t){return this.throwBeforeWrite(),jkr(this.db,t)}async markSessionInputPromoted(t){return this.throwBeforeWrite(),Bkr(this.db,t)}async settleSessionInput(t){return this.throwBeforeWrite(),Ukr(this.db,t)}async listSessionInputs(t){return zkr(this.db,t)}async getSessionInputById(t){return $kr(this.db,t)}async readTodos(t){return Vkr(this.db,t)}async updateTodos(t){return this.throwBeforeWrite(),Hkr(this.db,t)}async readTarget(t){return JR(this.db,t)}async setTarget(t){return ewr(this.db,{objective:t.objective,sessionID:t.sessionID,status:t.status??"active",tokenBudget:t.tokenBudget})}async cloneTargetForFork(t){return this.throwBeforeWrite(),DQt(this.db,{source:t.source,sessionID:t.sessionID,status:t.status??t.source.status})}async createTarget(t){return twr(this.db,t)}async updateTargetStatus(t){return nwr(this.db,t)}async startTargetRun(t){return rwr(this.db,t)}async heartbeatTargetRun(t){return owr(this.db,t)}async finishTargetRun(t){return iwr(this.db,t)}async recoverInterruptedTargetRun(t){return swr(this.db,t)}async accountTargetUsage(t){return awr(this.db,t)}async updateTargetSummaryTitle(t){return cwr(this.db,t)}async clearTarget(t){return lwr(this.db,t)}async recordModelUsage(t){return Kkr(this.db,t)}async upsertTurnUsage(t){return Zkr(this.db,t)}async upsertToolUsage(t){return Ykr(this.db,t)}async pruneUsage(t){return gRe(this.db,t)}async queryAppUsage(t){return Xkr(this.db,t)}async queryTaskUsage(t){return Qkr(this.db,t)}async recordInputHistory(t){return okr(this.db,t)}async recallPreviousInputHistory(t){return qQt(this.db,t)}async getProjectPermission(t){return VQt(this.db,t)}async saveProjectPermission(t){return akr(this.db,t)}getProjectPermissionMode(t){return ckr(this.db,t)}saveProjectPermissionMode(t){return lkr(this.db,t)}async setRevert(t){return GSr(this.db,t)}async clearRevert(t){return JSr(this.db,t)}async upsertScriptWorkflowDefinition(t){return Pkr(this.db,t)}async createScriptWorkflowRun(t){return Rkr(this.db,t)}async updateScriptWorkflowRun(t){return Dkr(this.db,t)}async getScriptWorkflowRun(t){return utt(this.db,t)}async listScriptWorkflowRuns(t){return Okr(this.db,t)}async createScriptWorkflowActivity(t){return bkr(this.db,t)}async updateScriptWorkflowActivity(t){return Skr(this.db,t)}async findCachedScriptWorkflowActivity(t){return wkr(this.db,t)}async listScriptWorkflowActivities(t){return kkr(this.db,t)}async appendScriptWorkflowEvent(t){return xkr(this.db,t)}async listScriptWorkflowEvents(t){return Tkr(this.db,t)}async createSessionTaskLink(t){return Ikr(this.db,t)}workflowJournalStore(){return this.dwfJournalStore??=zQt(this.db),this.dwfJournalStore}debugMigrationIds(){return Bwr(this.db)}debugCounts(t){return Uwr(this.db,t)}};r(dtt,"openStartupSqliteSessionStore")});var ixr=Y(()=>{"use strict";oxr();$Qt();ett()});async function gas(e,t){await e.writeFile(t,"utf8")}function pxr(){return YQt===void 0&&(YQt=Math.round(Date.now()-(0,yRe.uptime)()*1e3)),YQt}async function _as(e){if(e===process.pid)return pxr();try{if(process.platform==="linux"){let t=await(0,J0.readFile)(`/proc/${e}/stat`,"utf8"),n=t.lastIndexOf(")");if(n<0)return null;let o=t.slice(n+2).split(" "),s=Number(o[19]);if(!Number.isFinite(s))return null;let a=Date.now()-(0,yRe.uptime)()*1e3;return Math.round(a+s*1e3/has)}if(process.platform==="darwin"){let{stdout:t}=await sxr("ps",["-o","lstart=","-p",String(e)]),n=Date.parse(t.trim());return Number.isFinite(n)?n:null}if(process.platform==="win32"){let{stdout:t}=await sxr("powershell.exe",["-NoProfile","-Command",`[DateTimeOffset]::new((Get-Process -Id ${e}).StartTime).ToUnixTimeMilliseconds()`]),n=Number(t.trim());return Number.isFinite(n)?n:null}return null}catch{return null}}async function yas(e={}){let t=(0,hw.resolve)(e.homeDir??(0,yRe.homedir)()),n=(0,hw.resolve)(e.userConfigPath??(0,hw.join)(t,".zcode","cli","config.json")),o=await was(n),s=fxr(o.storage)?o.storage:{},a=typeof s.dir=="string"?s.dir.trim():"",l=a?kas(a,t):(0,hw.join)(t,".zcode");return(0,hw.join)(l,pas,fas)}async function mme(e={}){return vas({...e,filePath:await yas(e)})}function vas(e){return new XQt(e)}async function bas(e,t,n,o){for(let s=0;;s+=1)try{await e(t,n);return}catch(a){let l=o[s];if(l===void 0||!Sas(a))throw a;await(0,dxr.setTimeout)(l)}}function Sas(e){if(!(e instanceof Error)||!("code"in e))return!1;let t=e.code;return t==="EPERM"||t==="EBUSY"||t==="EACCES"}async function was(e){try{let t=JSON.parse(await(0,J0.readFile)(e,"utf8"));return fxr(t)?t:{}}catch(t){if(_Re(t,"ENOENT"))return{};throw new Error(`Unable to read trusted user config for Workspace Hook Trust store: ${e}`,{cause:t})}}function kas(e,t){return e.startsWith("~/")?(0,hw.join)(t,e.slice(2)):(0,hw.isAbsolute)(e)?(0,hw.resolve)(e):(0,hw.resolve)(t,e)}function fme(e){return`${e.workspaceIdentity}\0${e.hookDeclarationDigest}`}function axr(e){return Date.parse(e.lastUsedAt??e.grantedAt)}function fxr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _Re(e,t){return e instanceof Error&&"code"in e&&e.code===t}function xas(e){return new Promise(t=>setTimeout(t,e))}var J0,cxr,lxr,uxr,yRe,hw,dxr,cas,las,uas,das,pas,fas,mas,has,sxr,YQt,XQt,mxr=Y(()=>{"use strict";J0=require("node:fs/promises"),cxr=require("node:child_process"),lxr=require("node:util"),uxr=require("node:crypto"),yRe=require("node:os"),hw=require("node:path"),dxr=require("node:timers/promises");nr();cas=5e3,las=3e4,uas=10,das=[50,100,200,400,800],pas="security",fas="workspace-hook-trust-v1.json",mas=2e3,has=100,sxr=(0,lxr.promisify)(cxr.execFile);r(gas,"defaultWriteLockOwnerMetadata");r(pxr,"currentProcessStartTimeMs");r(_as,"probeProcessStartTimeDefault");r(yas,"resolveWorkspaceHookTrustStorePath");r(mme,"createDefaultFileWorkspaceHookTrustStore");r(vas,"createFileWorkspaceHookTrustStore");XQt=class{static{r(this,"FileWorkspaceHookTrustStore")}filePath;lockPath;now;lockTimeoutMs;staleLockMs;beforeRename;renameFile;renameRetryDelaysMs;probeProcessStartTime;writeLockOwnerMetadata;mutationQueue=Promise.resolve();constructor(t){this.filePath=(0,hw.resolve)(t.filePath),this.lockPath=`${this.filePath}.lock`,this.now=t.now??Date.now,this.lockTimeoutMs=t.lockTimeoutMs??cas,this.staleLockMs=t.staleLockMs??las,this.beforeRename=t.beforeRename,this.renameFile=t.renameFile??J0.rename,this.renameRetryDelaysMs=t.renameRetryDelaysMs??das,this.probeProcessStartTime=t.probeProcessStartTime??_as,this.writeLockOwnerMetadata=t.writeLockOwnerMetadata??gas}load(){return this.enqueue(async()=>(await this.ensureSecurityDirectory(),this.withLock(()=>this.readCurrent(!0))))}grant(t){let n=t.map(o=>QV.parse(o));return this.mutate(o=>{let s=new Map(o.records.map(a=>[fme(a),a]));for(let a of n)s.set(fme(a),a);return{schemaVersion:XV,records:[...s.values()]}})}revoke(t){if(t.hookDeclarationDigests?.length===0)return Promise.reject(new Error("hookDeclarationDigests must be undefined or non-empty"));let n=t.hookDeclarationDigests?new Set(t.hookDeclarationDigests):void 0;return this.mutate(o=>({schemaVersion:XV,records:o.records.filter(s=>s.workspaceIdentity!==t.workspaceIdentity||n!==void 0&&!n.has(s.hookDeclarationDigest))}))}touch(t){let n=new Set(t.hookDeclarationDigests),o=t.usedAt??new Date(this.now()).toISOString();return this.mutate(s=>({schemaVersion:XV,records:s.records.map(a=>a.workspaceIdentity===t.workspaceIdentity&&n.has(a.hookDeclarationDigest)?{...a,lastUsedAt:o}:a)}))}compact(t){if(!Number.isFinite(t.maxAgeMs)||t.maxAgeMs<0)throw new Error("maxAgeMs must be a nonnegative finite number");if(!Number.isInteger(t.maxRecords)||t.maxRecords<1)throw new Error("maxRecords must be a positive integer");let n=t.now??this.now(),o=new Set(t.current.map(s=>fme({workspaceIdentity:s.workspaceIdentity,hookDeclarationDigest:s.hookDeclarationDigest})));return this.mutate(s=>{let a=s.records.filter(g=>{if(o.has(fme(g)))return!0;let _=Date.parse(g.lastUsedAt??g.grantedAt);return Number.isFinite(_)&&n-_<=t.maxAgeMs}),l=a.filter(g=>o.has(fme(g))),u=a.filter(g=>!o.has(fme(g))).sort((g,_)=>axr(_)-axr(g)),f=Math.max(0,t.maxRecords-l.length);return{schemaVersion:XV,records:[...l,...u.slice(0,f)]}})}mutate(t){return this.enqueue(async()=>(await this.ensureSecurityDirectory(),this.withLock(async()=>{let n=await this.readCurrent(!0),o={schemaVersion:XV,records:n.status==="ok"?n.records:[]},s=$Qe.parse(t(o));return await this.atomicWrite(s),s})))}enqueue(t){let n=this.mutationQueue.then(t,t);return this.mutationQueue=n.then(()=>{},()=>{}),n}async withLock(t){let{handle:n,token:o}=await this.acquireLock();try{return await t()}finally{await n.close().catch(()=>{}),await this.releaseLockIfOwned(o)}}async acquireLock(){let t=Date.now();for(;;){let n;try{n=await(0,J0.open)(this.lockPath,"wx",384);let o=(0,uxr.randomUUID)(),s=`${JSON.stringify({pid:process.pid,startTime:pxr(),token:o})}
|
|
1897
1897
|
`;return await this.writeLockOwnerMetadata(n,s),{handle:n,token:o}}catch(o){if(n&&(await n.close().catch(()=>{}),await(0,J0.unlink)(this.lockPath).catch(()=>{})),!_Re(o,"EEXIST"))throw o;if(await this.removeStaleLock(),Date.now()-t>=this.lockTimeoutMs)throw new Error(`Timed out acquiring Workspace Hook Trust store lock: ${this.lockPath}`);await xas(uas)}}}async releaseLockIfOwned(t){let n=await this.readLockOwner();!n||n.token!==t||await(0,J0.unlink)(this.lockPath).catch(()=>{})}async readLockOwner(){try{let t=JSON.parse(await(0,J0.readFile)(this.lockPath,"utf8"));return t&&typeof t=="object"&&typeof t.pid=="number"&&typeof t.token=="string"?{pid:t.pid,token:t.token,startTime:typeof t.startTime=="number"?t.startTime:void 0}:null}catch{return null}}isProcessAlive(t){if(t===process.pid)return!0;try{return process.kill(t,0),!0}catch(n){return _Re(n,"EPERM")}}async removeStaleLock(){try{let t=await(0,J0.stat)(this.lockPath);if(Date.now()-t.mtimeMs<=this.staleLockMs)return;let n=await this.readLockOwner();if(!n){await(0,J0.rm)(this.lockPath,{force:!0});return}if(n.pid===process.pid)return;if(!this.isProcessAlive(n.pid)){await(0,J0.rm)(this.lockPath,{force:!0});return}let o=await this.probeProcessStartTime(n.pid);if(o===null||n.startTime===void 0)return;Math.abs(o-n.startTime)>mas&&await(0,J0.rm)(this.lockPath,{force:!0})}catch(t){if(!_Re(t,"ENOENT"))throw t}}async ensureSecurityDirectory(){let t=(0,hw.dirname)(this.filePath);await(0,J0.mkdir)(t,{recursive:!0,mode:448}),await(0,J0.chmod)(t,448)}async readCurrent(t){let n;try{n=await(0,J0.readFile)(this.filePath,"utf8")}catch(o){if(_Re(o,"ENOENT"))return{status:"missing",records:[]};throw o}try{let o=$Qe.parse(JSON.parse(n));return await(0,J0.chmod)(this.filePath,384).catch(()=>{}),{status:"ok",records:o.records}}catch(o){if(!t)throw o;let s=`${this.filePath}.corrupt-${this.now()}`;try{await(0,J0.rename)(this.filePath,s),await(0,J0.chmod)(s,384).catch(()=>{})}catch{}return{status:"corrupt",records:[],recoveredCorruptPath:s}}}async atomicWrite(t){let n=(0,hw.dirname)(this.filePath),o=(0,hw.join)(n,`.${(0,hw.basename)(this.filePath)}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`),s;try{s=await(0,J0.open)(o,"wx",384),await s.writeFile(`${JSON.stringify(t,null,2)}
|
|
1898
1898
|
`,"utf8"),await s.sync(),await s.close(),s=void 0,await this.beforeRename?.(),await bas(this.renameFile,o,this.filePath,this.renameRetryDelaysMs),await(0,J0.chmod)(this.filePath,384)}catch(a){throw await s?.close().catch(()=>{}),await(0,J0.rm)(o,{force:!0}).catch(()=>{}),a}}};r(bas,"renameWithRetry");r(Sas,"isRetryableRenameError");r(was,"readUserConfig");r(kas,"resolveTrustedUserPath");r(fme,"trustKey");r(axr,"recordTimestamp");r(fxr,"isRecord");r(_Re,"isNodeError");r(xas,"delay")});function yxr(e){return new QQt(e)}function Kte(e){return e.replace(/[^a-zA-Z0-9._-]/g,"_").slice(0,120)||"unknown"}function vxr(e){switch(e.split(";")[0]?.trim().toLowerCase()??""){case"text/plain":return".txt";case"text/markdown":return".md";case"application/json":return".json";case"image/png":return".png";case"image/jpeg":case"image/jpg":return".jpg";case"image/gif":return".gif";case"image/webp":return".webp";case"application/pdf":return".pdf";default:return".json"}}function Tas(e){let t=vxr(e);return t===".json"&&!e.toLowerCase().includes("json")?".bin":t}function Ias(e){let n=(e.startsWith(".")?e:`.${e}`).replace(/[^a-zA-Z0-9.]/g,"").slice(0,16).toLowerCase();return/^\.[a-z0-9]+$/.test(n)?n:".bin"}function hxr(e){let t=e.toLowerCase();return t.endsWith(".txt")?"text/plain":t.endsWith(".md")?"text/markdown":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".gif")?"image/gif":t.endsWith(".webp")?"image/webp":t.endsWith(".pdf")?"application/pdf":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".html")||t.endsWith(".htm")?"text/html":t.endsWith(".csv")?"text/csv":t.endsWith(".svg")?"image/svg+xml":t.endsWith(".json")?"application/json":"application/octet-stream"}function Cas(e){return e==="application/json"||e.startsWith("text/")}function Eas(e){return e.byteLength>=5&&e[0]===37&&e[1]===80&&e[2]===68&&e[3]===70&&e[4]===45}function gxr(e,t,n,o,s){let{sessionId:a}=een(o),l=ptt(s),u=Aas(s);if(!l||!u)return;let f=l==="image"?e:l==="video"?n:t,g=(0,ftt.createHash)("sha256").update(o).digest("hex").slice(0,32);return(0,SA.join)(f,Kte(a),`${l}-${g}${u}`)}function ptt(e){let t=e.split(";")[0]?.trim().toLowerCase()??"";if(t.startsWith("image/"))return"image";if(t.startsWith("video/"))return"video";if(t==="application/pdf")return"pdf"}function Aas(e){switch(e.split(";")[0]?.trim().toLowerCase()){case"image/png":return".png";case"image/jpeg":case"image/jpg":return".jpg";case"image/gif":return".gif";case"image/webp":return".webp";case"video/mp4":return".mp4";case"video/quicktime":return".mov";case"video/webm":return".webm";case"video/x-matroska":return".mkv";case"video/x-m4v":return".m4v";case"video/x-msvideo":return".avi";case"application/pdf":return".pdf";default:return}}function Pas(e,t,n){let o=e.indexOf(","),s=e.slice(0,5).toLowerCase()==="data:"&&o>=0?e.slice(5,o).split(";"):[],a=s.shift()?.trim();if(ptt(a??"")!==n||s.at(-1)?.trim().toLowerCase()!=="base64"||o<0)throw new Error(`Media attachment artifact is not a base64 ${n} data URL: ${t}`);let l=Buffer.from(e.slice(o+1),"base64");if(l.byteLength===0)throw new Error(`Media attachment artifact is empty: ${t}`);return{bytes:l,mediaType:a}}async function _xr(e){try{return(await(0,dS.stat)(e)).isFile()}catch(t){if(t.code==="ENOENT")return!1;throw t}}function een(e){let t;try{t=new URL(e)}catch(s){throw new Error(`Invalid tool artifact URI: ${e}`,{cause:s instanceof Error?s:void 0})}if(t.protocol!=="zcode-artifact:")throw new Error(`Unsupported tool artifact URI: ${e}`);let n=decodeURIComponent(t.hostname),o=decodeURIComponent(t.pathname.replace(/^\/+/,""));if(!n||!o)throw new Error(`Invalid tool artifact URI: ${e}`);return{artifactId:o,sessionId:n}}var ftt,dS,SA,QQt,f3=Y(()=>{"use strict";ftt=require("node:crypto"),dS=require("node:fs/promises"),SA=require("node:path");gfe();ixr();nr();mxr();QQt=class{static{r(this,"NodeToolArtifactStore")}imageCacheRootDir;pdfCacheRootDir;rootDir;videoCacheRootDir;mediaAttachmentPathFlights=new Map;constructor(t){this.imageCacheRootDir=t.imageCacheRootDir,this.rootDir=t.rootDir,this.pdfCacheRootDir=t.pdfCacheRootDir??(0,SA.join)((0,SA.dirname)(t.rootDir),"pdf-cache"),this.videoCacheRootDir=t.videoCacheRootDir}async writeToolResultArtifact(t,n){if(n?.signal?.aborted)throw n.signal.reason instanceof Error?n.signal.reason:new Error("Tool artifact write cancelled");let o=`tool-result-${crypto.randomUUID()}`,s=t.contentType??"application/json",a=vxr(s),l=(0,SA.join)(this.rootDir,Kte(t.sessionId)),u=`${Kte(String(t.toolCallId))}-${o}${a}`,f=(0,SA.join)(l,u);return xb({operation:"mkdir",path:l}),await(0,dS.mkdir)(l,{recursive:!0}),xb({operation:"writeFile",path:f}),await(0,dS.writeFile)(f,t.content,"utf8"),{id:o,uri:`zcode-artifact://${encodeURIComponent(t.sessionId)}/${encodeURIComponent(o)}`,path:f,bytes:Buffer.byteLength(t.content,"utf8"),contentType:s,createdAt:new Date}}async writeToolResultBinaryArtifact(t,n){if(n?.signal?.aborted)throw n.signal.reason instanceof Error?n.signal.reason:new Error("Tool binary artifact write cancelled");let o=`tool-result-${crypto.randomUUID()}`,s=Ias(t.extension??Tas(t.contentType)),a=(0,SA.join)(this.rootDir,Kte(t.sessionId)),l=`${Kte(String(t.toolCallId))}-${o}${s}`,u=(0,SA.join)(a,l),f=Buffer.from(t.content);return xb({operation:"mkdir",path:a}),await(0,dS.mkdir)(a,{recursive:!0}),xb({operation:"writeFile",path:u}),await(0,dS.writeFile)(u,f),{id:o,uri:`zcode-artifact://${encodeURIComponent(t.sessionId)}/${encodeURIComponent(o)}`,path:u,bytes:f.byteLength,contentType:t.contentType,createdAt:new Date}}async readToolResultArtifact(t,n){if(n?.signal?.aborted)throw n.signal.reason instanceof Error?n.signal.reason:new Error("Tool artifact read cancelled");let{path:o,contentType:s,bytes:a}=await this.readArtifactFile(t.uri),l=Cas(s)?a.toString("utf8"):a.toString("base64");return{uri:t.uri,path:o,content:l,bytes:a.byteLength,contentType:s}}async readToolResultBinaryArtifact(t,n){if(n?.signal?.aborted)throw n.signal.reason instanceof Error?n.signal.reason:new Error("Tool artifact read cancelled");let{path:o,contentType:s,bytes:a}=await this.readArtifactFile(t.uri);return{uri:t.uri,path:o,bytes:new Uint8Array(a),contentType:s}}async readArtifactFile(t){let{artifactId:n,sessionId:o}=een(t),s=(0,SA.join)(this.rootDir,Kte(o)),l=(await(0,dS.readdir)(s)).find(f=>f.includes(n));if(!l)throw new Error(`Tool artifact not found: ${t}`);let u=(0,SA.join)(s,l);return{path:u,contentType:hxr(l),bytes:await(0,dS.readFile)(u)}}async statToolResultArtifact(t,n){if(n?.signal?.aborted)throw n.signal.reason instanceof Error?n.signal.reason:new Error("Tool artifact stat cancelled");let{artifactId:o,sessionId:s}=een(t.uri),a=(0,SA.join)(this.rootDir,Kte(s)),u=(await(0,dS.readdir)(a)).find(_=>_.includes(o));if(!u)throw new Error(`Tool artifact not found: ${t.uri}`);let f=(0,SA.join)(a,u),g=await(0,dS.stat)(f);return{uri:t.uri,bytes:g.size,contentType:hxr(u),path:f,mtimeMs:g.mtimeMs}}primeImageAttachmentPath(t){return this.primeMediaAttachmentPath(t)}primeMediaAttachmentPath(t){return this.runMediaAttachmentPathFlight(t.uri,()=>this.writeDerivedMediaAttachment(t.uri,t.mediaType,Buffer.from(t.bytes)))}ensureMediaAttachmentPath(t){return this.runMediaAttachmentPathFlight(t.uri,async()=>{let n=gxr(this.imageCacheRootDir,this.pdfCacheRootDir,this.videoCacheRootDir,t.uri,t.mediaType);if(!n)return{status:"unsupported"};if(await _xr(n))return{status:"ready",path:n};let o=await this.readToolResultArtifact({uri:t.uri}),s=Pas(o.content,t.uri,ptt(t.mediaType));if(ptt(s.mediaType)==="pdf"&&!Eas(s.bytes))throw new Error(`Media attachment artifact is not a PDF: ${t.uri}`);return this.writeDerivedMediaAttachment(t.uri,s.mediaType,s.bytes)})}runMediaAttachmentPathFlight(t,n){let o=this.mediaAttachmentPathFlights.get(t);if(o)return o;let s;return s=n().finally(()=>{this.mediaAttachmentPathFlights.get(t)===s&&this.mediaAttachmentPathFlights.delete(t)}),this.mediaAttachmentPathFlights.set(t,s),s}async writeDerivedMediaAttachment(t,n,o){let s=gxr(this.imageCacheRootDir,this.pdfCacheRootDir,this.videoCacheRootDir,t,n);if(!s)return{status:"unsupported"};if(await _xr(s))return{status:"ready",path:s};let a=(0,SA.dirname)(s),l=`${s}.tmp-${(0,ftt.randomUUID)()}`;xb({operation:"mkdir",path:a}),await(0,dS.mkdir)(a,{recursive:!0});try{xb({operation:"writeFile",path:l}),await(0,dS.writeFile)(l,o),xb({operation:"rename",path:s}),await(0,dS.rename)(l,s)}catch(u){throw await(0,dS.unlink)(l).catch(()=>{}),u}return{status:"ready",path:s}}};r(yxr,"createNodeToolArtifactStore");r(Kte,"sanitizePathSegment");r(vxr,"extensionForContentType");r(Tas,"extensionForBinaryContentType");r(Ias,"normalizeArtifactExtension");r(hxr,"contentTypeForFileName");r(Cas,"isTextArtifactContentType");r(Eas,"isPdfBytes");r(gxr,"derivedMediaAttachmentPath");r(ptt,"mediaKindForContentType");r(Aas,"extensionForDerivedMediaContentType");r(Pas,"decodeMediaDataUrlArtifact");r(_xr,"isRegularFile");r(een,"parseArtifactUri")});var Zz=At((wBc,bxr)=>{"use strict";var mtt=require("buffer"),hme=mtt.Buffer,nM={},rM;for(rM in mtt)mtt.hasOwnProperty(rM)&&(rM==="SlowBuffer"||rM==="Buffer"||(nM[rM]=mtt[rM]));var gme=nM.Buffer={};for(rM in hme)hme.hasOwnProperty(rM)&&(rM==="allocUnsafe"||rM==="allocUnsafeSlow"||(gme[rM]=hme[rM]));nM.Buffer.prototype=hme.prototype;(!gme.from||gme.from===Uint8Array.from)&&(gme.from=function(e,t,n){if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&typeof e.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return hme(e,t,n)});gme.alloc||(gme.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var o=hme(e);return!t||t.length===0?o.fill(0):typeof n=="string"?o.fill(t,n):o.fill(t),o});if(!nM.kStringMaxLength)try{nM.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch{}nM.constants||(nM.constants={MAX_LENGTH:nM.kMaxLength},nM.kStringMaxLength&&(nM.constants.MAX_STRING_LENGTH=nM.kStringMaxLength));bxr.exports=nM});var wxr=At(ren=>{"use strict";var Sxr="\uFEFF";ren.PrependBOM=ten;function ten(e,t){this.encoder=e,this.addBOM=!0}r(ten,"PrependBOMWrapper");ten.prototype.write=function(e){return this.addBOM&&(e=Sxr+e,this.addBOM=!1),this.encoder.write(e)};ten.prototype.end=function(){return this.encoder.end()};ren.StripBOM=nen;function nen(e,t){this.decoder=e,this.pass=!1,this.options=t||{}}r(nen,"StripBOMWrapper");nen.prototype.write=function(e){var t=this.decoder.write(e);return this.pass||!t||(t[0]===Sxr&&(t=t.slice(1),typeof this.options.stripBOM=="function"&&this.options.stripBOM()),this.pass=!0),t};nen.prototype.end=function(){return this.decoder.end()}});var oen=At((TBc,kxr)=>{"use strict";var Ras=typeof Object.hasOwn>"u"?Function.call.bind(Object.prototype.hasOwnProperty):Object.hasOwn;function Das(e,t){for(var n in t)Ras(t,n)&&(e[n]=t[n])}r(Das,"mergeModules");kxr.exports=Das});var Txr=At((CBc,xxr)=>{"use strict";var Yz=Zz().Buffer;xxr.exports={utf8:{type:"_internal",bomAware:!0},cesu8:{type:"_internal",bomAware:!0},unicode11utf8:"utf8",ucs2:{type:"_internal",bomAware:!0},utf16le:"ucs2",binary:{type:"_internal"},base64:{type:"_internal"},hex:{type:"_internal"},_internal:ien};function ien(e,t){this.enc=e.encodingName,this.bomAware=e.bomAware,this.enc==="base64"?this.encoder=cen:this.enc==="utf8"?this.encoder=den:this.enc==="cesu8"&&(this.enc="utf8",this.encoder=len,Yz.from("eda0bdedb2a9","hex").toString()!=="\u{1F4A9}"&&(this.decoder=uen,this.defaultCharUnicode=t.defaultCharUnicode))}r(ien,"InternalCodec");ien.prototype.encoder=aen;ien.prototype.decoder=sen;var Oas=require("string_decoder").StringDecoder;function sen(e,t){this.decoder=new Oas(t.enc)}r(sen,"InternalDecoder");sen.prototype.write=function(e){return Yz.isBuffer(e)||(e=Yz.from(e)),this.decoder.write(e)};sen.prototype.end=function(){return this.decoder.end()};function aen(e,t){this.enc=t.enc}r(aen,"InternalEncoder");aen.prototype.write=function(e){return Yz.from(e,this.enc)};aen.prototype.end=function(){};function cen(e,t){this.prevStr=""}r(cen,"InternalEncoderBase64");cen.prototype.write=function(e){e=this.prevStr+e;var t=e.length-e.length%4;return this.prevStr=e.slice(t),e=e.slice(0,t),Yz.from(e,"base64")};cen.prototype.end=function(){return Yz.from(this.prevStr,"base64")};function len(e,t){}r(len,"InternalEncoderCesu8");len.prototype.write=function(e){for(var t=Yz.alloc(e.length*3),n=0,o=0;o<e.length;o++){var s=e.charCodeAt(o);s<128?t[n++]=s:s<2048?(t[n++]=192+(s>>>6),t[n++]=128+(s&63)):(t[n++]=224+(s>>>12),t[n++]=128+(s>>>6&63),t[n++]=128+(s&63))}return t.slice(0,n)};len.prototype.end=function(){};function uen(e,t){this.acc=0,this.contBytes=0,this.accBytes=0,this.defaultCharUnicode=t.defaultCharUnicode}r(uen,"InternalDecoderCesu8");uen.prototype.write=function(e){for(var t=this.acc,n=this.contBytes,o=this.accBytes,s="",a=0;a<e.length;a++){var l=e[a];(l&192)!==128?(n>0&&(s+=this.defaultCharUnicode,n=0),l<128?s+=String.fromCharCode(l):l<224?(t=l&31,n=1,o=1):l<240?(t=l&15,n=2,o=1):s+=this.defaultCharUnicode):n>0?(t=t<<6|l&63,n--,o++,n===0&&(o===2&&t<128&&t>0?s+=this.defaultCharUnicode:o===3&&t<2048?s+=this.defaultCharUnicode:s+=String.fromCharCode(t))):s+=this.defaultCharUnicode}return this.acc=t,this.contBytes=n,this.accBytes=o,s};uen.prototype.end=function(){var e=0;return this.contBytes>0&&(e+=this.defaultCharUnicode),e};function den(e,t){this.highSurrogate=""}r(den,"InternalEncoderUtf8");den.prototype.write=function(e){if(this.highSurrogate&&(e=this.highSurrogate+e,this.highSurrogate=""),e.length>0){var t=e.charCodeAt(e.length-1);t>=55296&&t<56320&&(this.highSurrogate=e[e.length-1],e=e.slice(0,e.length-1))}return Yz.from(e,this.enc)};den.prototype.end=function(){if(this.highSurrogate){var e=this.highSurrogate;return this.highSurrogate="",Yz.from(e,this.enc)}}});var Exr=At(mH=>{"use strict";var htt=Zz().Buffer;mH._utf32=pen;function pen(e,t){this.iconv=t,this.bomAware=!0,this.isLE=e.isLE}r(pen,"Utf32Codec");mH.utf32le={type:"_utf32",isLE:!0};mH.utf32be={type:"_utf32",isLE:!1};mH.ucs4le="utf32le";mH.ucs4be="utf32be";pen.prototype.encoder=fen;pen.prototype.decoder=men;function fen(e,t){this.isLE=t.isLE,this.highSurrogate=0}r(fen,"Utf32Encoder");fen.prototype.write=function(e){for(var t=htt.from(e,"ucs2"),n=htt.alloc(t.length*2),o=this.isLE?n.writeUInt32LE:n.writeUInt32BE,s=0,a=0;a<t.length;a+=2){var l=t.readUInt16LE(a),u=l>=55296&&l<56320,f=l>=56320&&l<57344;if(this.highSurrogate)if(u||!f)o.call(n,this.highSurrogate,s),s+=4;else{var g=(this.highSurrogate-55296<<10|l-56320)+65536;o.call(n,g,s),s+=4,this.highSurrogate=0;continue}u?this.highSurrogate=l:(o.call(n,l,s),s+=4,this.highSurrogate=0)}return s<n.length&&(n=n.slice(0,s)),n};fen.prototype.end=function(){if(this.highSurrogate){var e=htt.alloc(4);return this.isLE?e.writeUInt32LE(this.highSurrogate,0):e.writeUInt32BE(this.highSurrogate,0),this.highSurrogate=0,e}};function men(e,t){this.isLE=t.isLE,this.badChar=t.iconv.defaultCharUnicode.charCodeAt(0),this.overflow=[]}r(men,"Utf32Decoder");men.prototype.write=function(e){if(e.length===0)return"";var t=0,n=0,o=htt.alloc(e.length+4),s=0,a=this.isLE,l=this.overflow,u=this.badChar;if(l.length>0){for(;t<e.length&&l.length<4;t++)l.push(e[t]);l.length===4&&(a?n=l[t]|l[t+1]<<8|l[t+2]<<16|l[t+3]<<24:n=l[t+3]|l[t+2]<<8|l[t+1]<<16|l[t]<<24,l.length=0,s=Ixr(o,s,n,u))}for(;t<e.length-3;t+=4)a?n=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24:n=e[t+3]|e[t+2]<<8|e[t+1]<<16|e[t]<<24,s=Ixr(o,s,n,u);for(;t<e.length;t++)l.push(e[t]);return o.slice(0,s).toString("ucs2")};function Ixr(e,t,n,o){if((n<0||n>1114111)&&(n=o),n>=65536){n-=65536;var s=55296|n>>10;e[t++]=s&255,e[t++]=s>>8;var n=56320|n&1023}return e[t++]=n&255,e[t++]=n>>8,t}r(Ixr,"_writeCodepoint");men.prototype.end=function(){this.overflow.length=0};mH.utf32=hen;mH.ucs4="utf32";function hen(e,t){this.iconv=t}r(hen,"Utf32AutoCodec");hen.prototype.encoder=gen;hen.prototype.decoder=_en;function gen(e,t){e=e||{},e.addBOM===void 0&&(e.addBOM=!0),this.encoder=t.iconv.getEncoder(e.defaultEncoding||"utf-32le",e)}r(gen,"Utf32AutoEncoder");gen.prototype.write=function(e){return this.encoder.write(e)};gen.prototype.end=function(){return this.encoder.end()};function _en(e,t){this.decoder=null,this.initialBufs=[],this.initialBufsLen=0,this.options=e||{},this.iconv=t.iconv}r(_en,"Utf32AutoDecoder");_en.prototype.write=function(e){if(!this.decoder){if(this.initialBufs.push(e),this.initialBufsLen+=e.length,this.initialBufsLen<32)return"";var t=Cxr(this.initialBufs,this.options.defaultEncoding);this.decoder=this.iconv.getDecoder(t,this.options);for(var n="",o=0;o<this.initialBufs.length;o++)n+=this.decoder.write(this.initialBufs[o]);return this.initialBufs.length=this.initialBufsLen=0,n}return this.decoder.write(e)};_en.prototype.end=function(){if(!this.decoder){var e=Cxr(this.initialBufs,this.options.defaultEncoding);this.decoder=this.iconv.getDecoder(e,this.options);for(var t="",n=0;n<this.initialBufs.length;n++)t+=this.decoder.write(this.initialBufs[n]);var o=this.decoder.end();return o&&(t+=o),this.initialBufs.length=this.initialBufsLen=0,t}return this.decoder.end()};function Cxr(e,t){var n=[],o=0,s=0,a=0,l=0,u=0;e:for(var f=0;f<e.length;f++)for(var g=e[f],_=0;_<g.length;_++)if(n.push(g[_]),n.length===4){if(o===0){if(n[0]===255&&n[1]===254&&n[2]===0&&n[3]===0)return"utf-32le";if(n[0]===0&&n[1]===0&&n[2]===254&&n[3]===255)return"utf-32be"}if((n[0]!==0||n[1]>16)&&a++,(n[3]!==0||n[2]>16)&&s++,n[0]===0&&n[1]===0&&(n[2]!==0||n[3]!==0)&&u++,(n[0]!==0||n[1]!==0)&&n[2]===0&&n[3]===0&&l++,n.length=0,o++,o>=100)break e}return u-a>l-s?"utf-32be":u-a<l-s?"utf-32le":t||"utf-32le"}r(Cxr,"detectEncoding")});var Rxr=At(ken=>{"use strict";var Axr=Zz().Buffer;ken.utf16be=gtt;function gtt(){}r(gtt,"Utf16BECodec");gtt.prototype.encoder=yen;gtt.prototype.decoder=ven;gtt.prototype.bomAware=!0;function yen(){}r(yen,"Utf16BEEncoder");yen.prototype.write=function(e){for(var t=Axr.from(e,"ucs2"),n=0;n<t.length;n+=2){var o=t[n];t[n]=t[n+1],t[n+1]=o}return t};yen.prototype.end=function(){};function ven(){this.overflowByte=-1}r(ven,"Utf16BEDecoder");ven.prototype.write=function(e){if(e.length==0)return"";var t=Axr.alloc(e.length+1),n=0,o=0;for(this.overflowByte!==-1&&(t[0]=e[0],t[1]=this.overflowByte,n=1,o=2);n<e.length-1;n+=2,o+=2)t[o]=e[n+1],t[o+1]=e[n];return this.overflowByte=n==e.length-1?e[e.length-1]:-1,t.slice(0,o).toString("ucs2")};ven.prototype.end=function(){this.overflowByte=-1};ken.utf16=ben;function ben(e,t){this.iconv=t}r(ben,"Utf16Codec");ben.prototype.encoder=Sen;ben.prototype.decoder=wen;function Sen(e,t){e=e||{},e.addBOM===void 0&&(e.addBOM=!0),this.encoder=t.iconv.getEncoder("utf-16le",e)}r(Sen,"Utf16Encoder");Sen.prototype.write=function(e){return this.encoder.write(e)};Sen.prototype.end=function(){return this.encoder.end()};function wen(e,t){this.decoder=null,this.initialBufs=[],this.initialBufsLen=0,this.options=e||{},this.iconv=t.iconv}r(wen,"Utf16Decoder");wen.prototype.write=function(e){if(!this.decoder){if(this.initialBufs.push(e),this.initialBufsLen+=e.length,this.initialBufsLen<16)return"";var t=Pxr(this.initialBufs,this.options.defaultEncoding);this.decoder=this.iconv.getDecoder(t,this.options);for(var n="",o=0;o<this.initialBufs.length;o++)n+=this.decoder.write(this.initialBufs[o]);return this.initialBufs.length=this.initialBufsLen=0,n}return this.decoder.write(e)};wen.prototype.end=function(){if(!this.decoder){var e=Pxr(this.initialBufs,this.options.defaultEncoding);this.decoder=this.iconv.getDecoder(e,this.options);for(var t="",n=0;n<this.initialBufs.length;n++)t+=this.decoder.write(this.initialBufs[n]);var o=this.decoder.end();return o&&(t+=o),this.initialBufs.length=this.initialBufsLen=0,t}return this.decoder.end()};function Pxr(e,t){var n=[],o=0,s=0,a=0;e:for(var l=0;l<e.length;l++)for(var u=e[l],f=0;f<u.length;f++)if(n.push(u[f]),n.length===2){if(o===0){if(n[0]===255&&n[1]===254)return"utf-16le";if(n[0]===254&&n[1]===255)return"utf-16be"}if(n[0]===0&&n[1]!==0&&a++,n[0]!==0&&n[1]===0&&s++,n.length=0,o++,o>=100)break e}return a>s?"utf-16be":a<s?"utf-16le":t||"utf-16le"}r(Pxr,"detectEncoding")});var Oxr=At(vtt=>{"use strict";var m3=Zz().Buffer;vtt.utf7=_tt;vtt.unicode11utf7="utf7";function _tt(e,t){this.iconv=t}r(_tt,"Utf7Codec");_tt.prototype.encoder=Ten;_tt.prototype.decoder=Ien;_tt.prototype.bomAware=!0;var Mas=/[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;function Ten(e,t){this.iconv=t.iconv}r(Ten,"Utf7Encoder");Ten.prototype.write=function(e){return m3.from(e.replace(Mas,function(t){return"+"+(t==="+"?"":this.iconv.encode(t,"utf16-be").toString("base64").replace(/=+$/,""))+"-"}.bind(this)))};Ten.prototype.end=function(){};function Ien(e,t){this.iconv=t.iconv,this.inBase64=!1,this.base64Accum=""}r(Ien,"Utf7Decoder");var Nas=/[A-Za-z0-9\/+]/,Cen=[];for(vRe=0;vRe<256;vRe++)Cen[vRe]=Nas.test(String.fromCharCode(vRe));var vRe,Las=43,Zte=45,xen=38;Ien.prototype.write=function(e){for(var t="",n=0,o=this.inBase64,s=this.base64Accum,a=0;a<e.length;a++)if(!o)e[a]==Las&&(t+=this.iconv.decode(e.slice(n,a),"ascii"),n=a+1,o=!0);else if(!Cen[e[a]]){if(a==n&&e[a]==Zte)t+="+";else{var l=s+this.iconv.decode(e.slice(n,a),"ascii");t+=this.iconv.decode(m3.from(l,"base64"),"utf16-be")}e[a]!=Zte&&a--,n=a+1,o=!1,s=""}if(!o)t+=this.iconv.decode(e.slice(n),"ascii");else{var l=s+this.iconv.decode(e.slice(n),"ascii"),u=l.length-l.length%8;s=l.slice(u),l=l.slice(0,u),t+=this.iconv.decode(m3.from(l,"base64"),"utf16-be")}return this.inBase64=o,this.base64Accum=s,t};Ien.prototype.end=function(){var e="";return this.inBase64&&this.base64Accum.length>0&&(e=this.iconv.decode(m3.from(this.base64Accum,"base64"),"utf16-be")),this.inBase64=!1,this.base64Accum="",e};vtt.utf7imap=ytt;function ytt(e,t){this.iconv=t}r(ytt,"Utf7IMAPCodec");ytt.prototype.encoder=Een;ytt.prototype.decoder=Aen;ytt.prototype.bomAware=!0;function Een(e,t){this.iconv=t.iconv,this.inBase64=!1,this.base64Accum=m3.alloc(6),this.base64AccumIdx=0}r(Een,"Utf7IMAPEncoder");Een.prototype.write=function(e){for(var t=this.inBase64,n=this.base64Accum,o=this.base64AccumIdx,s=m3.alloc(e.length*5+10),a=0,l=0;l<e.length;l++){var u=e.charCodeAt(l);u>=32&&u<=126?(t&&(o>0&&(a+=s.write(n.slice(0,o).toString("base64").replace(/\//g,",").replace(/=+$/,""),a),o=0),s[a++]=Zte,t=!1),t||(s[a++]=u,u===xen&&(s[a++]=Zte))):(t||(s[a++]=xen,t=!0),t&&(n[o++]=u>>8,n[o++]=u&255,o==n.length&&(a+=s.write(n.toString("base64").replace(/\//g,","),a),o=0)))}return this.inBase64=t,this.base64AccumIdx=o,s.slice(0,a)};Een.prototype.end=function(){var e=m3.alloc(10),t=0;return this.inBase64&&(this.base64AccumIdx>0&&(t+=e.write(this.base64Accum.slice(0,this.base64AccumIdx).toString("base64").replace(/\//g,",").replace(/=+$/,""),t),this.base64AccumIdx=0),e[t++]=Zte,this.inBase64=!1),e.slice(0,t)};function Aen(e,t){this.iconv=t.iconv,this.inBase64=!1,this.base64Accum=""}r(Aen,"Utf7IMAPDecoder");var Dxr=Cen.slice();Dxr[44]=!0;Aen.prototype.write=function(e){for(var t="",n=0,o=this.inBase64,s=this.base64Accum,a=0;a<e.length;a++)if(!o)e[a]==xen&&(t+=this.iconv.decode(e.slice(n,a),"ascii"),n=a+1,o=!0);else if(!Dxr[e[a]]){if(a==n&&e[a]==Zte)t+="&";else{var l=s+this.iconv.decode(e.slice(n,a),"ascii").replace(/,/g,"/");t+=this.iconv.decode(m3.from(l,"base64"),"utf16-be")}e[a]!=Zte&&a--,n=a+1,o=!1,s=""}if(!o)t+=this.iconv.decode(e.slice(n),"ascii");else{var l=s+this.iconv.decode(e.slice(n),"ascii").replace(/,/g,"/"),u=l.length-l.length%8;s=l.slice(u),l=l.slice(0,u),t+=this.iconv.decode(m3.from(l,"base64"),"utf16-be")}return this.inBase64=o,this.base64Accum=s,t};Aen.prototype.end=function(){var e="";return this.inBase64&&this.base64Accum.length>0&&(e=this.iconv.decode(m3.from(this.base64Accum,"base64"),"utf16-be")),this.inBase64=!1,this.base64Accum="",e}});var Nxr=At(Mxr=>{"use strict";var btt=Zz().Buffer;Mxr._sbcs=Pen;function Pen(e,t){if(!e)throw new Error("SBCS codec is called without the data.");if(!e.chars||e.chars.length!==128&&e.chars.length!==256)throw new Error("Encoding '"+e.type+"' has incorrect 'chars' (must be of len 128 or 256)");if(e.chars.length===128){for(var n="",o=0;o<128;o++)n+=String.fromCharCode(o);e.chars=n+e.chars}this.decodeBuf=btt.from(e.chars,"ucs2");for(var s=btt.alloc(65536,t.defaultCharSingleByte.charCodeAt(0)),o=0;o<e.chars.length;o++)s[e.chars.charCodeAt(o)]=o;this.encodeBuf=s}r(Pen,"SBCSCodec");Pen.prototype.encoder=Ren;Pen.prototype.decoder=Den;function Ren(e,t){this.encodeBuf=t.encodeBuf}r(Ren,"SBCSEncoder");Ren.prototype.write=function(e){for(var t=btt.alloc(e.length),n=0;n<e.length;n++)t[n]=this.encodeBuf[e.charCodeAt(n)];return t};Ren.prototype.end=function(){};function Den(e,t){this.decodeBuf=t.decodeBuf}r(Den,"SBCSDecoder");Den.prototype.write=function(e){for(var t=this.decodeBuf,n=btt.alloc(e.length*2),o=0,s=0,a=0;a<e.length;a++)o=e[a]*2,s=a*2,n[s]=t[o],n[s+1]=t[o+1];return n.toString("ucs2")};Den.prototype.end=function(){}});var Fxr=At((FBc,Lxr)=>{"use strict";Lxr.exports={10029:"maccenteuro",maccenteuro:{type:"_sbcs",chars:"\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7"},808:"cp808",ibm808:"cp808",cp808:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\u20AC\u25A0\xA0"},mik:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2514\u2534\u252C\u251C\u2500\u253C\u2563\u2551\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2510\u2591\u2592\u2593\u2502\u2524\u2116\xA7\u2557\u255D\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},cp720:{type:"_sbcs",chars:"\x80\x81\xE9\xE2\x84\xE0\x86\xE7\xEA\xEB\xE8\xEF\xEE\x8D\x8E\x8F\x90\u0651\u0652\xF4\xA4\u0640\xFB\xF9\u0621\u0622\u0623\u0624\xA3\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0636\u0637\u0638\u0639\u063A\u0641\xB5\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u2261\u064B\u064C\u064D\u064E\u064F\u0650\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ascii8bit:"ascii",usascii:"ascii",ansix34:"ascii",ansix341968:"ascii",ansix341986:"ascii",csascii:"ascii",cp367:"ascii",ibm367:"ascii",isoir6:"ascii",iso646us:"ascii",iso646irv:"ascii",us:"ascii",latin1:"iso88591",latin2:"iso88592",latin3:"iso88593",latin4:"iso88594",latin5:"iso88599",latin6:"iso885910",latin7:"iso885913",latin8:"iso885914",latin9:"iso885915",latin10:"iso885916",csisolatin1:"iso88591",csisolatin2:"iso88592",csisolatin3:"iso88593",csisolatin4:"iso88594",csisolatincyrillic:"iso88595",csisolatinarabic:"iso88596",csisolatingreek:"iso88597",csisolatinhebrew:"iso88598",csisolatin5:"iso88599",csisolatin6:"iso885910",l1:"iso88591",l2:"iso88592",l3:"iso88593",l4:"iso88594",l5:"iso88599",l6:"iso885910",l7:"iso885913",l8:"iso885914",l9:"iso885915",l10:"iso885916",isoir14:"iso646jp",isoir57:"iso646cn",isoir100:"iso88591",isoir101:"iso88592",isoir109:"iso88593",isoir110:"iso88594",isoir144:"iso88595",isoir127:"iso88596",isoir126:"iso88597",isoir138:"iso88598",isoir148:"iso88599",isoir157:"iso885910",isoir166:"tis620",isoir179:"iso885913",isoir199:"iso885914",isoir203:"iso885915",isoir226:"iso885916",cp819:"iso88591",ibm819:"iso88591",cyrillic:"iso88595",arabic:"iso88596",arabic8:"iso88596",ecma114:"iso88596",asmo708:"iso88596",greek:"iso88597",greek8:"iso88597",ecma118:"iso88597",elot928:"iso88597",hebrew:"iso88598",hebrew8:"iso88598",turkish:"iso88599",turkish8:"iso88599",thai:"iso885911",thai8:"iso885911",celtic:"iso885914",celtic8:"iso885914",isoceltic:"iso885914",tis6200:"tis620",tis62025291:"tis620",tis62025330:"tis620",1e4:"macroman",10006:"macgreek",10007:"maccyrillic",10079:"maciceland",10081:"macturkish",cspc8codepage437:"cp437",cspc775baltic:"cp775",cspc850multilingual:"cp850",cspcp852:"cp852",cspc862latinhebrew:"cp862",cpgr:"cp869",msee:"cp1250",mscyrl:"cp1251",msansi:"cp1252",msgreek:"cp1253",msturk:"cp1254",mshebr:"cp1255",msarab:"cp1256",winbaltrim:"cp1257",cp20866:"koi8r",20866:"koi8r",ibm878:"koi8r",cskoi8r:"koi8r",cp21866:"koi8u",21866:"koi8u",ibm1168:"koi8u",strk10482002:"rk1048",tcvn5712:"tcvn",tcvn57121:"tcvn",gb198880:"iso646cn",cn:"iso646cn",csiso14jisc6220ro:"iso646jp",jisc62201969ro:"iso646jp",jp:"iso646jp",cshproman8:"hproman8",r8:"hproman8",roman8:"hproman8",xroman8:"hproman8",ibm1051:"hproman8",mac:"macintosh",csmacintosh:"macintosh"}});var Bxr=At((jBc,jxr)=>{"use strict";jxr.exports={437:"cp437",737:"cp737",775:"cp775",850:"cp850",852:"cp852",855:"cp855",856:"cp856",857:"cp857",858:"cp858",860:"cp860",861:"cp861",862:"cp862",863:"cp863",864:"cp864",865:"cp865",866:"cp866",869:"cp869",874:"windows874",922:"cp922",1046:"cp1046",1124:"cp1124",1125:"cp1125",1129:"cp1129",1133:"cp1133",1161:"cp1161",1162:"cp1162",1163:"cp1163",1250:"windows1250",1251:"windows1251",1252:"windows1252",1253:"windows1253",1254:"windows1254",1255:"windows1255",1256:"windows1256",1257:"windows1257",1258:"windows1258",28591:"iso88591",28592:"iso88592",28593:"iso88593",28594:"iso88594",28595:"iso88595",28596:"iso88596",28597:"iso88597",28598:"iso88598",28599:"iso88599",28600:"iso885910",28601:"iso885911",28603:"iso885913",28604:"iso885914",28605:"iso885915",28606:"iso885916",windows874:{type:"_sbcs",chars:"\u20AC\uFFFD\uFFFD\uFFFD\uFFFD\u2026\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"},win874:"windows874",cp874:"windows874",windows1250:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021\uFFFD\u2030\u0160\u2039\u015A\u0164\u017D\u0179\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\u0161\u203A\u015B\u0165\u017E\u017A\xA0\u02C7\u02D8\u0141\xA4\u0104\xA6\xA7\xA8\xA9\u015E\xAB\xAC\xAD\xAE\u017B\xB0\xB1\u02DB\u0142\xB4\xB5\xB6\xB7\xB8\u0105\u015F\xBB\u013D\u02DD\u013E\u017C\u0154\xC1\xC2\u0102\xC4\u0139\u0106\xC7\u010C\xC9\u0118\xCB\u011A\xCD\xCE\u010E\u0110\u0143\u0147\xD3\xD4\u0150\xD6\xD7\u0158\u016E\xDA\u0170\xDC\xDD\u0162\xDF\u0155\xE1\xE2\u0103\xE4\u013A\u0107\xE7\u010D\xE9\u0119\xEB\u011B\xED\xEE\u010F\u0111\u0144\u0148\xF3\xF4\u0151\xF6\xF7\u0159\u016F\xFA\u0171\xFC\xFD\u0163\u02D9"},win1250:"windows1250",cp1250:"windows1250",windows1251:{type:"_sbcs",chars:"\u0402\u0403\u201A\u0453\u201E\u2026\u2020\u2021\u20AC\u2030\u0409\u2039\u040A\u040C\u040B\u040F\u0452\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\u0459\u203A\u045A\u045C\u045B\u045F\xA0\u040E\u045E\u0408\xA4\u0490\xA6\xA7\u0401\xA9\u0404\xAB\xAC\xAD\xAE\u0407\xB0\xB1\u0406\u0456\u0491\xB5\xB6\xB7\u0451\u2116\u0454\xBB\u0458\u0405\u0455\u0457\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"},win1251:"windows1251",cp1251:"windows1251",windows1252:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\uFFFD\u017D\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\uFFFD\u017E\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},win1252:"windows1252",cp1252:"windows1252",windows1253:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\uFFFD\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD\xA0\u0385\u0386\xA3\xA4\xA5\xA6\xA7\xA8\xA9\uFFFD\xAB\xAC\xAD\xAE\u2015\xB0\xB1\xB2\xB3\u0384\xB5\xB6\xB7\u0388\u0389\u038A\xBB\u038C\xBD\u038E\u038F\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD"},win1253:"windows1253",cp1253:"windows1253",windows1254:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0160\u2039\u0152\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\u0161\u203A\u0153\uFFFD\uFFFD\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u011E\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u0130\u015E\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u011F\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u0131\u015F\xFF"},win1254:"windows1254",cp1254:"windows1254",windows1255:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD\xA0\xA1\xA2\xA3\u20AA\xA5\xA6\xA7\xA8\xA9\xD7\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xF7\xBB\xBC\xBD\xBE\xBF\u05B0\u05B1\u05B2\u05B3\u05B4\u05B5\u05B6\u05B7\u05B8\u05B9\u05BA\u05BB\u05BC\u05BD\u05BE\u05BF\u05C0\u05C1\u05C2\u05C3\u05F0\u05F1\u05F2\u05F3\u05F4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD"},win1255:"windows1255",cp1255:"windows1255",windows1256:{type:"_sbcs",chars:"\u20AC\u067E\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\u0679\u2039\u0152\u0686\u0698\u0688\u06AF\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u06A9\u2122\u0691\u203A\u0153\u200C\u200D\u06BA\xA0\u060C\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\u06BE\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\u061B\xBB\xBC\xBD\xBE\u061F\u06C1\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\xD7\u0637\u0638\u0639\u063A\u0640\u0641\u0642\u0643\xE0\u0644\xE2\u0645\u0646\u0647\u0648\xE7\xE8\xE9\xEA\xEB\u0649\u064A\xEE\xEF\u064B\u064C\u064D\u064E\xF4\u064F\u0650\xF7\u0651\xF9\u0652\xFB\xFC\u200E\u200F\u06D2"},win1256:"windows1256",cp1256:"windows1256",windows1257:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021\uFFFD\u2030\uFFFD\u2039\uFFFD\xA8\u02C7\xB8\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\uFFFD\u203A\uFFFD\xAF\u02DB\uFFFD\xA0\uFFFD\xA2\xA3\xA4\uFFFD\xA6\xA7\xD8\xA9\u0156\xAB\xAC\xAD\xAE\xC6\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xF8\xB9\u0157\xBB\xBC\xBD\xBE\xE6\u0104\u012E\u0100\u0106\xC4\xC5\u0118\u0112\u010C\xC9\u0179\u0116\u0122\u0136\u012A\u013B\u0160\u0143\u0145\xD3\u014C\xD5\xD6\xD7\u0172\u0141\u015A\u016A\xDC\u017B\u017D\xDF\u0105\u012F\u0101\u0107\xE4\xE5\u0119\u0113\u010D\xE9\u017A\u0117\u0123\u0137\u012B\u013C\u0161\u0144\u0146\xF3\u014D\xF5\xF6\xF7\u0173\u0142\u015B\u016B\xFC\u017C\u017E\u02D9"},win1257:"windows1257",cp1257:"windows1257",windows1258:{type:"_sbcs",chars:"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021\u02C6\u2030\uFFFD\u2039\u0152\uFFFD\uFFFD\uFFFD\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014\u02DC\u2122\uFFFD\u203A\u0153\uFFFD\uFFFD\u0178\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"},win1258:"windows1258",cp1258:"windows1258",iso88591:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},cp28591:"iso88591",iso88592:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u02D8\u0141\xA4\u013D\u015A\xA7\xA8\u0160\u015E\u0164\u0179\xAD\u017D\u017B\xB0\u0105\u02DB\u0142\xB4\u013E\u015B\u02C7\xB8\u0161\u015F\u0165\u017A\u02DD\u017E\u017C\u0154\xC1\xC2\u0102\xC4\u0139\u0106\xC7\u010C\xC9\u0118\xCB\u011A\xCD\xCE\u010E\u0110\u0143\u0147\xD3\xD4\u0150\xD6\xD7\u0158\u016E\xDA\u0170\xDC\xDD\u0162\xDF\u0155\xE1\xE2\u0103\xE4\u013A\u0107\xE7\u010D\xE9\u0119\xEB\u011B\xED\xEE\u010F\u0111\u0144\u0148\xF3\xF4\u0151\xF6\xF7\u0159\u016F\xFA\u0171\xFC\xFD\u0163\u02D9"},cp28592:"iso88592",iso88593:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0126\u02D8\xA3\xA4\uFFFD\u0124\xA7\xA8\u0130\u015E\u011E\u0134\xAD\uFFFD\u017B\xB0\u0127\xB2\xB3\xB4\xB5\u0125\xB7\xB8\u0131\u015F\u011F\u0135\xBD\uFFFD\u017C\xC0\xC1\xC2\uFFFD\xC4\u010A\u0108\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\uFFFD\xD1\xD2\xD3\xD4\u0120\xD6\xD7\u011C\xD9\xDA\xDB\xDC\u016C\u015C\xDF\xE0\xE1\xE2\uFFFD\xE4\u010B\u0109\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\uFFFD\xF1\xF2\xF3\xF4\u0121\xF6\xF7\u011D\xF9\xFA\xFB\xFC\u016D\u015D\u02D9"},cp28593:"iso88593",iso88594:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0138\u0156\xA4\u0128\u013B\xA7\xA8\u0160\u0112\u0122\u0166\xAD\u017D\xAF\xB0\u0105\u02DB\u0157\xB4\u0129\u013C\u02C7\xB8\u0161\u0113\u0123\u0167\u014A\u017E\u014B\u0100\xC1\xC2\xC3\xC4\xC5\xC6\u012E\u010C\xC9\u0118\xCB\u0116\xCD\xCE\u012A\u0110\u0145\u014C\u0136\xD4\xD5\xD6\xD7\xD8\u0172\xDA\xDB\xDC\u0168\u016A\xDF\u0101\xE1\xE2\xE3\xE4\xE5\xE6\u012F\u010D\xE9\u0119\xEB\u0117\xED\xEE\u012B\u0111\u0146\u014D\u0137\xF4\xF5\xF6\xF7\xF8\u0173\xFA\xFB\xFC\u0169\u016B\u02D9"},cp28594:"iso88594",iso88595:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\xA7\u045E\u045F"},cp28595:"iso88595",iso88596:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\uFFFD\uFFFD\uFFFD\xA4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u060C\xAD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u061B\uFFFD\uFFFD\uFFFD\u061F\uFFFD\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"},cp28596:"iso88596",iso88597:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u2018\u2019\xA3\u20AC\u20AF\xA6\xA7\xA8\xA9\u037A\xAB\xAC\xAD\uFFFD\u2015\xB0\xB1\xB2\xB3\u0384\u0385\u0386\xB7\u0388\u0389\u038A\xBB\u038C\xBD\u038E\u038F\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD"},cp28597:"iso88597",iso88598:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\uFFFD\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xD7\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xF7\xBB\xBC\xBD\xBE\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2017\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD"},cp28598:"iso88598",iso88599:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u011E\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u0130\u015E\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u011F\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u0131\u015F\xFF"},cp28599:"iso88599",iso885910:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0112\u0122\u012A\u0128\u0136\xA7\u013B\u0110\u0160\u0166\u017D\xAD\u016A\u014A\xB0\u0105\u0113\u0123\u012B\u0129\u0137\xB7\u013C\u0111\u0161\u0167\u017E\u2015\u016B\u014B\u0100\xC1\xC2\xC3\xC4\xC5\xC6\u012E\u010C\xC9\u0118\xCB\u0116\xCD\xCE\xCF\xD0\u0145\u014C\xD3\xD4\xD5\xD6\u0168\xD8\u0172\xDA\xDB\xDC\xDD\xDE\xDF\u0101\xE1\xE2\xE3\xE4\xE5\xE6\u012F\u010D\xE9\u0119\xEB\u0117\xED\xEE\xEF\xF0\u0146\u014D\xF3\xF4\xF5\xF6\u0169\xF8\u0173\xFA\xFB\xFC\xFD\xFE\u0138"},cp28600:"iso885910",iso885911:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"},cp28601:"iso885911",iso885913:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u201D\xA2\xA3\xA4\u201E\xA6\xA7\xD8\xA9\u0156\xAB\xAC\xAD\xAE\xC6\xB0\xB1\xB2\xB3\u201C\xB5\xB6\xB7\xF8\xB9\u0157\xBB\xBC\xBD\xBE\xE6\u0104\u012E\u0100\u0106\xC4\xC5\u0118\u0112\u010C\xC9\u0179\u0116\u0122\u0136\u012A\u013B\u0160\u0143\u0145\xD3\u014C\xD5\xD6\xD7\u0172\u0141\u015A\u016A\xDC\u017B\u017D\xDF\u0105\u012F\u0101\u0107\xE4\xE5\u0119\u0113\u010D\xE9\u017A\u0117\u0123\u0137\u012B\u013C\u0161\u0144\u0146\xF3\u014D\xF5\xF6\xF7\u0173\u0142\u015B\u016B\xFC\u017C\u017E\u2019"},cp28603:"iso885913",iso885914:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u1E02\u1E03\xA3\u010A\u010B\u1E0A\xA7\u1E80\xA9\u1E82\u1E0B\u1EF2\xAD\xAE\u0178\u1E1E\u1E1F\u0120\u0121\u1E40\u1E41\xB6\u1E56\u1E81\u1E57\u1E83\u1E60\u1EF3\u1E84\u1E85\u1E61\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0174\xD1\xD2\xD3\xD4\xD5\xD6\u1E6A\xD8\xD9\xDA\xDB\xDC\xDD\u0176\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0175\xF1\xF2\xF3\xF4\xF5\xF6\u1E6B\xF8\xF9\xFA\xFB\xFC\xFD\u0177\xFF"},cp28604:"iso885914",iso885915:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\u20AC\xA5\u0160\xA7\u0161\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u017D\xB5\xB6\xB7\u017E\xB9\xBA\xBB\u0152\u0153\u0178\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"},cp28605:"iso885915",iso885916:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0104\u0105\u0141\u20AC\u201E\u0160\xA7\u0161\xA9\u0218\xAB\u0179\xAD\u017A\u017B\xB0\xB1\u010C\u0142\u017D\u201D\xB6\xB7\u017E\u010D\u0219\xBB\u0152\u0153\u0178\u017C\xC0\xC1\xC2\u0102\xC4\u0106\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0110\u0143\xD2\xD3\xD4\u0150\xD6\u015A\u0170\xD9\xDA\xDB\xDC\u0118\u021A\xDF\xE0\xE1\xE2\u0103\xE4\u0107\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0111\u0144\xF2\xF3\xF4\u0151\xF6\u015B\u0171\xF9\xFA\xFB\xFC\u0119\u021B\xFF"},cp28606:"iso885916",cp437:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm437:"cp437",csibm437:"cp437",cp737:{type:"_sbcs",chars:"\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03C9\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD\u03CB\u03CE\u0386\u0388\u0389\u038A\u038C\u038E\u038F\xB1\u2265\u2264\u03AA\u03AB\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm737:"cp737",csibm737:"cp737",cp775:{type:"_sbcs",chars:"\u0106\xFC\xE9\u0101\xE4\u0123\xE5\u0107\u0142\u0113\u0156\u0157\u012B\u0179\xC4\xC5\xC9\xE6\xC6\u014D\xF6\u0122\xA2\u015A\u015B\xD6\xDC\xF8\xA3\xD8\xD7\xA4\u0100\u012A\xF3\u017B\u017C\u017A\u201D\xA6\xA9\xAE\xAC\xBD\xBC\u0141\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u0104\u010C\u0118\u0116\u2563\u2551\u2557\u255D\u012E\u0160\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u0172\u016A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u017D\u0105\u010D\u0119\u0117\u012F\u0161\u0173\u016B\u017E\u2518\u250C\u2588\u2584\u258C\u2590\u2580\xD3\xDF\u014C\u0143\xF5\xD5\xB5\u0144\u0136\u0137\u013B\u013C\u0146\u0112\u0145\u2019\xAD\xB1\u201C\xBE\xB6\xA7\xF7\u201E\xB0\u2219\xB7\xB9\xB3\xB2\u25A0\xA0"},ibm775:"cp775",csibm775:"cp775",cp850:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\xD7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xF0\xD0\xCA\xCB\xC8\u0131\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\xFE\xDE\xDA\xDB\xD9\xFD\xDD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"},ibm850:"cp850",csibm850:"cp850",cp852:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\u016F\u0107\xE7\u0142\xEB\u0150\u0151\xEE\u0179\xC4\u0106\xC9\u0139\u013A\xF4\xF6\u013D\u013E\u015A\u015B\xD6\xDC\u0164\u0165\u0141\xD7\u010D\xE1\xED\xF3\xFA\u0104\u0105\u017D\u017E\u0118\u0119\xAC\u017A\u010C\u015F\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\u011A\u015E\u2563\u2551\u2557\u255D\u017B\u017C\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u0102\u0103\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\u0111\u0110\u010E\xCB\u010F\u0147\xCD\xCE\u011B\u2518\u250C\u2588\u2584\u0162\u016E\u2580\xD3\xDF\xD4\u0143\u0144\u0148\u0160\u0161\u0154\xDA\u0155\u0170\xFD\xDD\u0163\xB4\xAD\u02DD\u02DB\u02C7\u02D8\xA7\xF7\xB8\xB0\xA8\u02D9\u0171\u0158\u0159\u25A0\xA0"},ibm852:"cp852",csibm852:"cp852",cp855:{type:"_sbcs",chars:"\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408\u0459\u0409\u045A\u040A\u045B\u040B\u045C\u040C\u045E\u040E\u045F\u040F\u044E\u042E\u044A\u042A\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438\u0418\u2563\u2551\u2557\u255D\u0439\u0419\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u043A\u041A\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\u043B\u041B\u043C\u041C\u043D\u041D\u043E\u041E\u043F\u2518\u250C\u2588\u2584\u041F\u044F\u2580\u042F\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044C\u042C\u2116\xAD\u044B\u042B\u0437\u0417\u0448\u0428\u044D\u042D\u0449\u0429\u0447\u0427\xA7\u25A0\xA0"},ibm855:"cp855",csibm855:"cp855",cp856:{type:"_sbcs",chars:"\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\uFFFD\xA3\uFFFD\xD7\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xAE\xAC\xBD\xBC\uFFFD\xAB\xBB\u2591\u2592\u2593\u2502\u2524\uFFFD\uFFFD\uFFFD\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\uFFFD\uFFFD\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2518\u250C\u2588\u2584\xA6\uFFFD\u2580\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xB5\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"},ibm856:"cp856",csibm856:"cp856",cp857:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\u0131\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\u0130\xD6\xDC\xF8\xA3\xD8\u015E\u015F\xE1\xED\xF3\xFA\xF1\xD1\u011E\u011F\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xBA\xAA\xCA\xCB\xC8\uFFFD\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\uFFFD\xD7\xDA\xDB\xD9\xEC\xFF\xAF\xB4\xAD\xB1\uFFFD\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"},ibm857:"cp857",csibm857:"cp857",cp858:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\xD7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xAE\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\xC1\xC2\xC0\xA9\u2563\u2551\u2557\u255D\xA2\xA5\u2510\u2514\u2534\u252C\u251C\u2500\u253C\xE3\xC3\u255A\u2554\u2569\u2566\u2560\u2550\u256C\xA4\xF0\xD0\xCA\xCB\xC8\u20AC\xCD\xCE\xCF\u2518\u250C\u2588\u2584\xA6\xCC\u2580\xD3\xDF\xD4\xD2\xF5\xD5\xB5\xFE\xDE\xDA\xDB\xD9\xFD\xDD\xAF\xB4\xAD\xB1\u2017\xBE\xB6\xA7\xF7\xB8\xB0\xA8\xB7\xB9\xB3\xB2\u25A0\xA0"},ibm858:"cp858",csibm858:"cp858",cp860:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE3\xE0\xC1\xE7\xEA\xCA\xE8\xCD\xD4\xEC\xC3\xC2\xC9\xC0\xC8\xF4\xF5\xF2\xDA\xF9\xCC\xD5\xDC\xA2\xA3\xD9\u20A7\xD3\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\xD2\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm860:"cp860",csibm860:"cp860",cp861:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xD0\xF0\xDE\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xFE\xFB\xDD\xFD\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xC1\xCD\xD3\xDA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm861:"cp861",csibm861:"cp861",cp862:{type:"_sbcs",chars:"\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm862:"cp862",csibm862:"cp862",cp863:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xC2\xE0\xB6\xE7\xEA\xEB\xE8\xEF\xEE\u2017\xC0\xA7\xC9\xC8\xCA\xF4\xCB\xCF\xFB\xF9\xA4\xD4\xDC\xA2\xA3\xD9\xDB\u0192\xA6\xB4\xF3\xFA\xA8\xB8\xB3\xAF\xCE\u2310\xAC\xBD\xBC\xBE\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm863:"cp863",csibm863:"cp863",cp864:{type:"_sbcs",chars:`\0\x07\b
|
|
1899
1899
|
\v\f\r\x1B !"#$\u066A&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~\x7F\xB0\xB7\u2219\u221A\u2592\u2500\u2502\u253C\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518\u03B2\u221E\u03C6\xB1\xBD\xBC\u2248\xAB\xBB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD\xA0\xAD\uFE82\xA3\xA4\uFE84\uFFFD\uFFFD\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F\xA2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1\uFEC5\uFECB\uFECF\xA6\xAC\xF7\xD7\uFEC9\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xF8\xA3\xD8\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xA4\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0"},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E\xB0\u2219\xB7\u221A\u2116\xA4\u25A0\xA0"},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD\xB7\xAC\xA6\u2018\u2019\u0388\u2015\u0389\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\xA9\u038F\xB2\xB3\u03AC\xA3\u03AD\u03AE\u03AF\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394\u0395\u0396\u0397\xBD\u0398\u0399\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384\xAD\xB1\u03C5\u03C6\u03C7\xA7\u03C8\u0385\xB0\xA8\u03C9\u03CB\u03B0\u03CE\u25A0\xA0"},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\u203E\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\u0160\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\u017D\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\u0161\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\u017E\xFF"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"\uFE88\xD7\xF7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71\x88\u25A0\u2502\u2500\u2510\u250C\u2514\u2518\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC\xA0\uF8FA\uF8F9\uF8F8\xA4\uF8FB\uFE8B\uFE91\uFE97\uFE9B\uFE9F\uFEA3\u060C\xAD\uFEA7\uFEB3\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F\uFECB\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\uFEC7\u0639\u063A\uFECC\uFE82\uFE84\uFE8E\uFED3\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F\u0650\u0651\u0652\uFED7\uFEDB\uFEDF\uF8FC\uFEF5\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0401\u0402\u0490\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\xAD\u040E\u040F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u2116\u0451\u0452\u0491\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\xA7\u045E\u045F"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0401\u0451\u0490\u0491\u0404\u0454\u0406\u0456\u0407\u0457\xB7\u221A\u2116\xA4\u25A0\xA0"},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\u0153\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u0178\xB5\xB6\xB7\u0152\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E81\u0E82\u0E84\u0E87\u0E88\u0EAA\u0E8A\u0E8D\u0E94\u0E95\u0E96\u0E97\u0E99\u0E9A\u0E9B\u0E9C\u0E9D\u0E9E\u0E9F\u0EA1\u0EA2\u0EA3\u0EA5\u0EA7\u0EAB\u0EAD\u0EAE\uFFFD\uFFFD\uFFFD\u0EAF\u0EB0\u0EB2\u0EB3\u0EB4\u0EB5\u0EB6\u0EB7\u0EB8\u0EB9\u0EBC\u0EB1\u0EBB\u0EBD\uFFFD\uFFFD\uFFFD\u0EC0\u0EC1\u0EC2\u0EC3\u0EC4\u0EC8\u0EC9\u0ECA\u0ECB\u0ECC\u0ECD\u0EC6\uFFFD\u0EDC\u0EDD\u20AD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0ED0\u0ED1\u0ED2\u0ED3\u0ED4\u0ED5\u0ED6\u0ED7\u0ED8\u0ED9\uFFFD\uFFFD\xA2\xAC\xA6\uFFFD"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0E48\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\u0E49\u0E4A\u0E4B\u20AC\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\xA2\xAC\xA6\xA0"},ibm1161:"cp1161",csibm1161:"cp1161",cp1162:{type:"_sbcs",chars:"\u20AC\x81\x82\x83\x84\u2026\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\u2018\u2019\u201C\u201D\u2022\u2013\u2014\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD"},ibm1162:"cp1162",csibm1162:"cp1162",cp1163:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\u20AC\xA5\xA6\xA7\u0153\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\u0178\xB5\xB6\xB7\u0152\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\u0102\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\u0300\xCD\xCE\xCF\u0110\xD1\u0309\xD3\xD4\u01A0\xD6\xD7\xD8\xD9\xDA\xDB\xDC\u01AF\u0303\xDF\xE0\xE1\xE2\u0103\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\u0301\xED\xEE\xEF\u0111\xF1\u0323\xF3\xF4\u01A1\xF6\xF7\xF8\xF9\xFA\xFB\xFC\u01B0\u20AB\xFF"},ibm1163:"cp1163",csibm1163:"cp1163",maccroatian:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\u0160\u2122\xB4\xA8\u2260\u017D\xD8\u221E\xB1\u2264\u2265\u2206\xB5\u2202\u2211\u220F\u0161\u222B\xAA\xBA\u2126\u017E\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u0106\xAB\u010C\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u0110\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\uFFFD\xA9\u2044\xA4\u2039\u203A\xC6\xBB\u2013\xB7\u201A\u201E\u2030\xC2\u0107\xC1\u010D\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u0111\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u03C0\xCB\u02DA\xB8\xCA\xE6\u02C7"},maccyrillic:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\xA2\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u2202\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\xA4"},macgreek:{type:"_sbcs",chars:"\xC4\xB9\xB2\xC9\xB3\xD6\xDC\u0385\xE0\xE2\xE4\u0384\xA8\xE7\xE9\xE8\xEA\xEB\xA3\u2122\xEE\xEF\u2022\xBD\u2030\xF4\xF6\xA6\xAD\xF9\xFB\xFC\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\xDF\xAE\xA9\u03A3\u03AA\xA7\u2260\xB0\u0387\u0391\xB1\u2264\u2265\xA5\u0392\u0395\u0396\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9\u03AC\u039D\xAC\u039F\u03A1\u2248\u03A4\xAB\xBB\u2026\xA0\u03A5\u03A7\u0386\u0388\u0153\u2013\u2015\u201C\u201D\u2018\u2019\xF7\u0389\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\uFFFD"},maciceland:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\xDD\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\xD0\xF0\xDE\xFE\xFD\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},macroman:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},macromania:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\u0102\u015E\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\u0103\u015F\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\xA4\u2039\u203A\u0162\u0163\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},macthai:{type:"_sbcs",chars:"\xAB\xBB\u2026\uF88C\uF88F\uF892\uF895\uF898\uF88B\uF88E\uF891\uF894\uF897\u201C\u201D\uF899\uFFFD\u2022\uF884\uF889\uF885\uF886\uF887\uF888\uF88A\uF88D\uF890\uF893\uF896\u2018\u2019\uFFFD\xA0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37\u0E38\u0E39\u0E3A\uFEFF\u200B\u2013\u2014\u0E3F\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u2122\u0E4F\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57\u0E58\u0E59\xAE\xA9\uFFFD\uFFFD\uFFFD\uFFFD"},macturkish:{type:"_sbcs",chars:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u2126\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u011E\u011F\u0130\u0131\u015E\u015F\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uFFFD\xD2\xDA\xDB\xD9\uFFFD\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"},macukraine:{type:"_sbcs",chars:"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\u0490\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\xA4"},koi8r:{type:"_sbcs",chars:"\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\xA0\u2321\xB0\xB2\xB7\xF7\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556\u2557\u2558\u2559\u255A\u255B\u255C\u255D\u255E\u255F\u2560\u2561\u0401\u2562\u2563\u2564\u2565\u2566\u2567\u2568\u2569\u256A\u256B\u256C\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"},koi8u:{type:"_sbcs",chars:"\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\xA0\u2321\xB0\xB2\xB7\xF7\u2550\u2551\u2552\u0451\u0454\u2554\u0456\u0457\u2557\u2558\u2559\u255A\u255B\u0491\u255D\u255E\u255F\u2560\u2561\u0401\u0404\u2563\u0406\u0407\u2566\u2567\u2568\u2569\u256A\u0490\u256C\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"},koi8ru:{type:"_sbcs",chars:"\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248\u2264\u2265\xA0\u2321\xB0\xB2\xB7\xF7\u2550\u2551\u2552\u0451\u0454\u2554\u0456\u0457\u2557\u2558\u2559\u255A\u255B\u0491\u045E\u255E\u255F\u2560\u2561\u0401\u0404\u2563\u0406\u0407\u2566\u2567\u2568\u2569\u256A\u0490\u040E\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"},koi8t:{type:"_sbcs",chars:"\u049B\u0493\u201A\u0492\u201E\u2026\u2020\u2021\uFFFD\u2030\u04B3\u2039\u04B2\u04B7\u04B6\uFFFD\u049A\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u04EF\u04EE\u0451\xA4\u04E3\xA6\xA7\uFFFD\uFFFD\uFFFD\xAB\xAC\xAD\xAE\uFFFD\xB0\xB1\xB2\u0401\uFFFD\u04E2\xB6\xB7\uFFFD\u2116\uFFFD\xBB\uFFFD\uFFFD\uFFFD\xA9\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A"},armscii8:{type:"_sbcs",chars:"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\uFFFD\u0587\u0589)(\xBB\xAB\u2014.\u055D,-\u058A\u2026\u055C\u055B\u055E\u0531\u0561\u0532\u0562\u0533\u0563\u0534\u0564\u0535\u0565\u0536\u0566\u0537\u0567\u0538\u0568\u0539\u0569\u053A\u056A\u053B\u056B\u053C\u056C\u053D\u056D\u053E\u056E\u053F\u056F\u0540\u0570\u0541\u0571\u0542\u0572\u0543\u0573\u0544\u0574\u0545\u0575\u0546\u0576\u0547\u0577\u0548\u0578\u0549\u0579\u054A\u057A\u054B\u057B\u054C\u057C\u054D\u057D\u054E\u057E\u054F\u057F\u0550\u0580\u0551\u0581\u0552\u0582\u0553\u0583\u0554\u0584\u0555\u0585\u0556\u0586\u055A\uFFFD"},rk1048:{type:"_sbcs",chars:"\u0402\u0403\u201A\u0453\u201E\u2026\u2020\u2021\u20AC\u2030\u0409\u2039\u040A\u049A\u04BA\u040F\u0452\u2018\u2019\u201C\u201D\u2022\u2013\u2014\uFFFD\u2122\u0459\u203A\u045A\u049B\u04BB\u045F\xA0\u04B0\u04B1\u04D8\xA4\u04E8\xA6\xA7\u0401\xA9\u0492\xAB\xAC\xAD\xAE\u04AE\xB0\xB1\u0406\u0456\u04E9\xB5\xB6\xB7\u0451\u2116\u0493\xBB\u04D9\u04A2\u04A3\u04AF\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F"},tcvn:{type:"_sbcs",chars:`\0\xDA\u1EE4\u1EEA\u1EEC\u1EEE\x07\b
|
|
@@ -2070,7 +2070,7 @@ ${t}:`]}}function EUr({id:e,model:t,created:n}){return{id:e??void 0,modelId:t??v
|
|
|
2070
2070
|
`?`\r
|
|
2071
2071
|
`:n==="\r\r"?"\r":`
|
|
2072
2072
|
`,s=JSON.stringify({type:"content_block_delta",index:e.index,delta:{type:"signature_delta",signature:e.signature}});return`event: content_block_delta${o}data: ${s}${n}`}function BPs(e){let t=[];for(let n of e.split(/\r\n|\n|\r/)){if(!n.startsWith("data:"))continue;let o=n.slice(5);o.startsWith(" ")&&(o=o.slice(1)),t.push(o)}return t.length===0?void 0:t.join(`
|
|
2073
|
-
`)}function Lan(e){try{return MF(JSON.parse(e))}catch{return}}function MF(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}var kPs,zUr=Y(()=>{"use strict";kPs=/\r\n\r\n|\n\n|\r\r/;r(BUr,"createAnthropicCompatFetch");r(xPs,"applyAnthropicRequestBodyCompatibility");r(TPs,"restoreMemorySelectorMessageBoundaries");r(IPs,"restoreMidConversationSystemStringContent");r(CPs,"singlePlainTextBlock");r(EPs,"isMemorySelectorOutput");r(FUr,"hasTextPrefix");r(APs,"shouldFilterAnthropicStream");r(PPs,"filterAnthropicStream");r(RPs,"rewriteAnthropicJsonThinkingResponse");r(DPs,"shouldRewriteAnthropicJson");r(OPs,"cloneTextResponse");r(MPs,"sanitizeJsonThinkingBlocks");r(NPs,"isUnsignedThinkingBlock");r(LPs,"createAnthropicStreamCompatTransform");r(jUr,"emitCompleteFrames");r(UUr,"emitFrame");r(FPs,"decideFrame");r(jPs,"createSignatureDeltaFrame");r(BPs,"readSseData");r(Lan,"safeParseRecord");r(MF,"safeRecord")});function $Ur(e,t){return((t?.headers?new Headers(t.headers).get("x-request-id"):null)??(e instanceof Request?e.headers.get("x-request-id"):null))?.trim()||void 0}var Dit,qUr=Y(()=>{"use strict";Dit=class{static{r(this,"ClientSigningObservationStore")}entries=new Map;record(t,n){let o=this.entries.get(t);if(!o){if(this.entries.size>=64){let s=this.entries.keys().next().value;s!==void 0&&this.entries.delete(s)}o=[],this.entries.set(t,o)}o.push(n)}take(t){let n=this.entries.get(t)??[];return this.entries.delete(t),n}get size(){return this.entries.size}};r($Ur,"readClientSigningRequestId")});function VUr(e){return async(t,n)=>{let o=await e(t,n);if(!o.ok||zPs(o))return o;let s=await $Ps(o);if(!s)return o;let a=UPs(s);if(!a)return o;let l=new Headers(o.headers);return l.delete("content-length"),l.delete("content-encoding"),new Response(JSON.stringify(a),{headers:l,status:o.status,statusText:o.statusText})}}function UPs(e){let t=Oit(e);if(!t||!Array.isArray(t.output))return;let n=typeof t.id=="string"&&t.id.length>0?t.id:void 0,o=!1,s=t.output.map(a=>{let l=Oit(a);if(l?.type!=="message")return a;let u=l;if(l.id===void 0&&n&&(u={...u,id:`msg_${(0,WUr.randomUUID)()}`},o=!0),!Array.isArray(l.content))return u;let f=!1,g=l.content.map(_=>{let b=Oit(_);return b?.type!=="output_text"||b.annotations!==void 0?_:(f=!0,{...b,annotations:[]})});return f?(o=!0,{...u,content:g}):u});return o?{...t,output:s}:void 0}function zPs(e){return e.headers.get("content-type")?.toLowerCase().includes("event-stream")===!0}async function $Ps(e){try{return Oit(JSON.parse(await e.clone().text()))}catch{return}}function Oit(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}var WUr,HUr=Y(()=>{"use strict";WUr=require("node:crypto");r(VUr,"createOpenAIResponsesJsonCompatFetch");r(UPs,"normalizeOpenAIResponsesJson");r(zPs,"isEventStream");r($Ps,"parseJsonObject");r(Oit,"asRecord")});function GUr(e){return async(t,n)=>{let o=await qPs(t,n);if(o===void 0)return e.fetch(t,n);let s=WPs(o),a=e.maps.apply(s,e.values);e.capture&&(e.capture.body=a);let l=JSON.stringify(a);return t instanceof Request?e.fetch(new Request(t,{...n,body:l})):e.fetch(t,{...n,body:l})}}async function qPs(e,t){if(typeof t?.body=="string")return t.body;if(t?.body!==void 0&&t.body!==null)throw new Error("Model option maps require a JSON text request body.");if(e instanceof Request)return e.clone().text()}function WPs(e){let t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("Model option maps require a JSON object request body.");return t}var JUr=Y(()=>{"use strict";r(GUr,"createModelOptionMapFetch");r(qPs,"readRequestBody");r(WPs,"parseJsonObject")});function Nit(e){let t=e.fetch??globalThis.fetch.bind(globalThis);if(!VPs(e))return t;let n,o=!1,s=r(()=>(o||(n=Drt(e),o=!0),n),"getTlsCaCertificates");return async(a,l)=>{let u=HPs(a);if(!u||u.protocol!=="http:"&&u.protocol!=="https:")return t(a,l);let f=ZRr(u,e),g=qrn(e);if(!f&&!g)return t(a,l);let _=await GPs(a,l);return JPs(_,{ca:g?s():void 0,proxyUrl:f})}}function VPs(e){return!!(e.caCertFile||e.env||e.httpProxy||e.noProxy)}function HPs(e){try{return e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(String(e))}catch{return}}async function GPs(e,t){let n=new Request(e,t),o=n.method.toUpperCase(),s=o==="GET"||o==="HEAD"?void 0:await n.arrayBuffer();return{body:s&&s.byteLength>0?Buffer.from(s):void 0,headers:n.headers,method:o,signal:n.signal,url:new URL(n.url)}}function JPs(e,t){let n=e.url.protocol==="https:"?Mit.default:Fan.default;return new Promise((o,s)=>{let a=e.signal??void 0;if(a?.aborted){s(KUr(a));return}let l=!1,u,f,g=r(()=>{a?.removeEventListener("abort",I),f?.off("error",b),f?.off("close",w),u?.off("close",g),u?.off("error",T)},"cleanupAll"),_=r(E=>{l||(l=!0,g(),s(E))},"rejectOnce"),b=r(E=>{_(E)},"onRequestError"),w=r(()=>{!u&&l&&g()},"onRequestClose"),T=r(()=>{},"onResponseError"),I=r(()=>{let E=KUr(a);u?.destroy(E),f?.destroy(E),l||(l=!0,s(E))},"onAbort");a?.addEventListener("abort",I,{once:!0}),f=n.request({agent:KPs(e.url,t),headers:ZPs(e.headers),hostname:e.url.hostname,method:e.method,path:`${e.url.pathname}${e.url.search}`,port:e.url.port||void 0,protocol:e.url.protocol},E=>{u=E,u.once("close",g),u.once("error",T);let R=new Headers;for(let[L,U]of Object.entries(E.headers))if(Array.isArray(U))for(let B of U)R.append(L,B);else U!==void 0&&R.append(L,String(U));l=!0,o(new Response(E.statusCode===204||E.statusCode===205||E.statusCode===304?void 0:ZUr.Readable.toWeb(E),{headers:R,status:E.statusCode??502,statusText:E.statusMessage}))}),f.once("error",b),f.once("close",w),f.end(e.body)})}function KUr(e){if(e?.reason instanceof Error)return e.reason;let t=new Error("The operation was aborted.");return t.name="AbortError",t}function KPs(e,t){return t.proxyUrl?new lhe({ca:t.ca,getProxyForUrl:r(()=>t.proxyUrl??"","getProxyForUrl"),httpsAgent:t.ca?new Mit.default.Agent({ca:t.ca}):void 0}):e.protocol==="https:"?new Mit.default.Agent({ca:t.ca}):new Fan.default.Agent}function ZPs(e){let t={};return e.forEach((n,o)=>{t[o]=n}),t}var Fan,Mit,ZUr,jan=Y(()=>{"use strict";Fan=Ci(require("node:http"),1),Mit=Ci(require("node:https"),1),ZUr=require("node:stream");Urn();Wrn();r(Nit,"createNetworkProxyFetch");r(VPs,"hasNetworkFetchPolicy");r(HPs,"readFetchInputUrl");r(GPs,"normalizeFetchRequest");r(JPs,"fetchWithAgent");r(KUr,"abortReason");r(KPs,"createRequestAgent");r(ZPs,"headersToOutgoing")});function Ban(e){return async(t,n)=>{let o=QPs(t);if(!o)return await e.fetch(t,n);let s=n?.signal??(t instanceof Request?t.signal:void 0),a=YUr(t,n).get("x-api-key")?.trim(),l=await e.routingPort.resolve(o,{...a?{apiKey:a}:{},signal:s??void 0,trace:tRs(t,n)});if(!l.routed)return await e.fetch(t,n);let u=eRs(t,l.url);return u instanceof Request&&u.headers.delete("host"),await e.fetch(u,XPs(n))}}function XPs(e){if(!e?.headers)return e;let t=new Headers(e.headers);return t.has("host")?(t.delete("host"),{...e,headers:t}):e}function QPs(e){try{return e instanceof Request?e.url:e instanceof URL?e.href:new URL(String(e)).href}catch{return}}function eRs(e,t){return e instanceof Request?new Request(t,e):e instanceof URL?new URL(t):t}function tRs(e,t){let n=YUr(e,t).get(YPs)?.trim();return n?{traceId:n}:void 0}function YUr(e,t){return new Headers(t?.headers??(e instanceof Request?e.headers:void 0))}var YPs,Uan=Y(()=>{"use strict";YPs="x-zcode-trace-id";r(Ban,"createProviderEndpointRoutingFetch");r(XPs,"withoutHostHeader");r(QPs,"readRequestUrl");r(eRs,"rewriteInput");r(tRs,"readTraceContext");r(YUr,"readRequestHeaders")});function XUr(e){return e instanceof Lit||!QUr(e)?e:new Lit(e)}function zan(e){let t=e?.toUpperCase();return!!(t?.includes("CERT")||t?.includes("TLS")||t==="UNABLE_TO_VERIFY_LEAF_SIGNATURE")}function QUr(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e))return!1;t.add(e);let n=e;return zan(typeof n.code=="string"?n.code:void 0)?!0:QUr(n.cause,t)}var nRs,Lit,$an=Y(()=>{"use strict";nRs="MODEL_TLS_VALIDATION_FAILED",Lit=class extends Error{static{r(this,"ModelTlsValidationError")}code=nRs;constructor(t){super("TLS validation failed for the provider request.",{cause:t}),this.name="ModelTlsValidationError"}};r(XUr,"normalizeModelTlsFailure");r(zan,"isTlsFailure");r(QUr,"hasTlsFailureCode")});function qan(...e){let t={};for(let n of e)for(let[o,s]of Object.entries(n??{})){for(let a of Object.keys(t))a.toLowerCase()===o.toLowerCase()&&delete t[a];t[o]=s}return t}var ezr=Y(()=>{"use strict";r(qan,"mergeModelRequestHeaders")});function tG(e){if(e instanceof S2)return!0;let t=eG(e);return t?.isProviderBusinessError===!0&&t.name==="ProviderBusinessError"}function aRs(e,t){let n={...t.access.type!=="zhipu-account"&&t.access.apiKey?{apiKey:t.access.apiKey}:{},baseURL:t.api.baseUrl,...t.api.headers?{headers:{...t.api.headers}}:{},providerOptions:{apiFormat:t.api.type},access:t.access};switch(t.api.type){case"anthropic-messages":return{kind:"anthropic",...n};case"openai-responses":return{kind:"openai",...n};case"openai-chat-completions":return{kind:"openai-compatible",name:e,...n}}throw new Error(`Unsupported Provider API type: ${String(t.api.type)}`)}function cRs({access:e,baseURL:t}){if(e.type==="zhipu-account"&&(e.mode==="start-plan"||e.mode==="off-peak"))return!1;if(e.type==="zhipu-coding-plan-api-key"||e.type==="zhipu-account"&&(e.mode==="individual-coding-plan"||e.mode==="team-coding-plan")||kXe(t)!==null)return!0;try{return rRs.has(new URL(t).hostname.toLowerCase())}catch{return!1}}function lRs(e,t){return t?{...e,...t.apiKey?{apiKey:t.apiKey}:{},...t.headers?{headers:qan(e.headers,t.headers)}:{}}:e}function uRs(e){return JSON.stringify({configUrl:e.configUrl,headers:Object.entries(e.headers).sort(([t],[n])=>t.localeCompare(n)),network:{caCertFile:e.network.caCertFile,httpProxy:e.network.httpProxy,noProxy:e.network.noProxy}})}function dRs(e,t){return!e||pRs(t,tzr)?t:{[tzr]:`Bearer ${e}`,...t}}function pRs(e,t){if(!e)return!1;let n=t.toLowerCase();return Object.keys(e).some(o=>o.toLowerCase()===n)}function fRs(e,t){if(!e)return;let n=t.toLowerCase();return Object.entries(e).find(([s])=>s.toLowerCase()===n)?.[1]?.trim()||void 0}function mRs(e){let t=e?.trim();if(t)try{let n=new URL(t),o=n.pathname.replace(/\/+$/u,"");return o.toLowerCase().endsWith("/v1")?(n.pathname=o,n.href):(n.pathname=`${o}/v1`,n.href)}catch{let n=t.replace(/\/+$/u,"");return n.toLowerCase().endsWith("/v1")?n:`${n}/v1`}}function hRs(e){let t=Wan(e),n=e.endpointRoutingPort?Ban({fetch:t,routingPort:e.endpointRoutingPort}):t;return async(o,s)=>{let a;try{a=await n(o,s)}catch(u){throw XUr(u)}if(!a.ok){let u=await rzr(a,e);if(u)throw await nzr(a),u}if(yRs(a))return vRs(a,e);let l=await rzr(a,e);if(l)throw await nzr(a),l;return a}}async function nzr(e){if(!e.body)return;let n;try{await Promise.race([e.arrayBuffer().then(()=>{}),new Promise(o=>{n=setTimeout(o,oRs)})])}catch{}finally{n!==void 0&&clearTimeout(n)}}function Wan(e){return Nit(e)}async function rzr(e,t){if(!gRs(e))return;let n;try{let s=await _Rs(e);if(s===void 0||s.trim().length===0)return;n=JSON.parse(s)}catch{return}let o=CDe(n);if(o)return new S2({providerCode:o.providerCode,providerId:t.providerId,providerKind:t.providerKind,providerMessage:o.providerMessage,providerRequestId:o.providerRequestId,responseBodySummary:o.responseBodySummary,responseHeaders:czr(e.headers),responseStatus:e.status,statusCode:o.statusCode})}function CDe(e){let t=eG(e);if(!t)return;let n=eG(t.error),o=AM(t.providerCode)??AM(n?.providerCode)??AM(t.error_code)??AM(n?.error_code)??AM(t.code)??AM(n?.code),s=dzr(t),a=t.success===!1,l=xRs(o);if(!(!a&&!l))return{providerCode:o,providerMessage:s,providerRequestId:Van(t),responseBodySummary:pzr(t),statusCode:uzr(o)}}function gRs(e){if(!e.ok)return!0;let t=e.headers.get("content-type")?.toLowerCase()??"";if(t.includes("event-stream"))return!1;if(t.includes("json"))return!0;let n=azr(e.headers.get("content-length"));return n!==void 0&&n<=IDe}async function _Rs(e){let t=azr(e.headers.get("content-length"));if(t!==void 0&&t>IDe)return;let n=e.clone();if(!n.body){let l=await n.text();return l.length>IDe?void 0:l}let o=n.body.getReader(),s=new TextDecoder,a="";try{for(;;){let l=await o.read();if(l.done)return a+=s.decode(),a.length>IDe?void 0:a;if(a+=s.decode(l.value,{stream:!0}),a.length>IDe){await o.cancel();return}}}finally{o.releaseLock()}}function azr(e){if(!e)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function yRs(e){return e.body!==null&&e.headers.get("content-type")?.toLowerCase().includes("event-stream")===!0}function czr(e){let t={};return e.forEach((n,o)=>{t[o]=n}),t}function vRs(e,t){let n=e.body;if(!n)return e;let o=new Headers(e.headers);o.delete("content-length"),o.delete("content-encoding");let s=czr(e.headers);return new Response(n.pipeThrough(bRs(t,e.status,s)),{headers:o,status:e.status,statusText:e.statusText})}function bRs(e,t,n){let o=new TextDecoder,s=new TextEncoder,a="",l=!1;return new TransformStream({transform(u,f){l||(a+=o.decode(u,{stream:!0}),a=ozr(a,f,s,e,t,n,()=>{l=!0}))},flush(u){l||(a+=o.decode(),a=ozr(a,u,s,e,t,n,()=>{l=!0}),!l&&a.length>0&&lzr(a,"",u,s,e,t,n,()=>{l=!0}))}})}function ozr(e,t,n,o,s,a,l){let u=e;for(;;){let f=sRs.exec(u);if(!f)return u;let g=f[0]??"",_=u.slice(0,f.index);if(u=u.slice(f.index+g.length),!lzr(_,g,t,n,o,s,a,l))return""}}function lzr(e,t,n,o,s,a,l,u){let f=SRs(e);return f?(n.error(new S2({providerCode:f.providerCode,providerId:s.providerId,providerKind:s.providerKind,providerMessage:f.providerMessage,providerRequestId:f.providerRequestId,responseBodySummary:f.responseBodySummary,responseHeaders:l,responseStatus:a,statusCode:f.statusCode})),u(),!1):(n.enqueue(o.encode(`${e}${t}`)),!0)}function SRs(e){let t=wRs(e),n=t.data?.trim();if(!n||n==="[DONE]")return;let o=kRs(n);if(!o)return;let s=CDe(o);if(s)return{...s,providerRequestId:Van(o)};if(t.event?.toLowerCase()!=="error")return;let a=eG(o.error),l=AM(o.providerCode)??AM(a?.providerCode)??AM(o.error_code)??AM(a?.error_code)??AM(o.code)??AM(a?.code);return{providerCode:l,providerMessage:dzr(o),providerRequestId:Van(o),responseBodySummary:pzr(o),statusCode:uzr(l)}}function wRs(e){let t=[],n;for(let o of e.split(/\r\n|\n|\r/)){if(o.startsWith("event:")){n=izr(o.slice(6));continue}o.startsWith("data:")&&t.push(izr(o.slice(5)))}return{data:t.length===0?void 0:t.join(`
|
|
2073
|
+
`)}function Lan(e){try{return MF(JSON.parse(e))}catch{return}}function MF(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}var kPs,zUr=Y(()=>{"use strict";kPs=/\r\n\r\n|\n\n|\r\r/;r(BUr,"createAnthropicCompatFetch");r(xPs,"applyAnthropicRequestBodyCompatibility");r(TPs,"restoreMemorySelectorMessageBoundaries");r(IPs,"restoreMidConversationSystemStringContent");r(CPs,"singlePlainTextBlock");r(EPs,"isMemorySelectorOutput");r(FUr,"hasTextPrefix");r(APs,"shouldFilterAnthropicStream");r(PPs,"filterAnthropicStream");r(RPs,"rewriteAnthropicJsonThinkingResponse");r(DPs,"shouldRewriteAnthropicJson");r(OPs,"cloneTextResponse");r(MPs,"sanitizeJsonThinkingBlocks");r(NPs,"isUnsignedThinkingBlock");r(LPs,"createAnthropicStreamCompatTransform");r(jUr,"emitCompleteFrames");r(UUr,"emitFrame");r(FPs,"decideFrame");r(jPs,"createSignatureDeltaFrame");r(BPs,"readSseData");r(Lan,"safeParseRecord");r(MF,"safeRecord")});function $Ur(e,t){return((t?.headers?new Headers(t.headers).get("x-request-id"):null)??(e instanceof Request?e.headers.get("x-request-id"):null))?.trim()||void 0}var Dit,qUr=Y(()=>{"use strict";Dit=class{static{r(this,"ClientSigningObservationStore")}entries=new Map;record(t,n){let o=this.entries.get(t);if(!o){if(this.entries.size>=64){let s=this.entries.keys().next().value;s!==void 0&&this.entries.delete(s)}o=[],this.entries.set(t,o)}o.push(n)}take(t){let n=this.entries.get(t)??[];return this.entries.delete(t),n}get size(){return this.entries.size}};r($Ur,"readClientSigningRequestId")});function VUr(e){return async(t,n)=>{let o=await e(t,n);if(!o.ok||zPs(o))return o;let s=await $Ps(o);if(!s)return o;let a=UPs(s);if(!a)return o;let l=new Headers(o.headers);return l.delete("content-length"),l.delete("content-encoding"),new Response(JSON.stringify(a),{headers:l,status:o.status,statusText:o.statusText})}}function UPs(e){let t=Oit(e);if(!t||!Array.isArray(t.output))return;let n=typeof t.id=="string"&&t.id.length>0?t.id:void 0,o=!1,s=t.output.map(a=>{let l=Oit(a);if(l?.type!=="message")return a;let u=l;if(l.id===void 0&&n&&(u={...u,id:`msg_${(0,WUr.randomUUID)()}`},o=!0),!Array.isArray(l.content))return u;let f=!1,g=l.content.map(_=>{let b=Oit(_);return b?.type!=="output_text"||b.annotations!==void 0?_:(f=!0,{...b,annotations:[]})});return f?(o=!0,{...u,content:g}):u});return o?{...t,output:s}:void 0}function zPs(e){return e.headers.get("content-type")?.toLowerCase().includes("event-stream")===!0}async function $Ps(e){try{return Oit(JSON.parse(await e.clone().text()))}catch{return}}function Oit(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e}var WUr,HUr=Y(()=>{"use strict";WUr=require("node:crypto");r(VUr,"createOpenAIResponsesJsonCompatFetch");r(UPs,"normalizeOpenAIResponsesJson");r(zPs,"isEventStream");r($Ps,"parseJsonObject");r(Oit,"asRecord")});function GUr(e){return async(t,n)=>{let o=await qPs(t,n);if(o===void 0)return e.fetch(t,n);let s=WPs(o),a=e.maps.apply(s,e.values);e.capture&&(e.capture.body=a);let l=JSON.stringify(a);return t instanceof Request?e.fetch(new Request(t,{...n,body:l})):e.fetch(t,{...n,body:l})}}async function qPs(e,t){if(typeof t?.body=="string")return t.body;if(t?.body!==void 0&&t.body!==null)throw new Error("Model option maps require a JSON text request body.");if(e instanceof Request)return e.clone().text()}function WPs(e){let t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))throw new Error("Model option maps require a JSON object request body.");return t}var JUr=Y(()=>{"use strict";r(GUr,"createModelOptionMapFetch");r(qPs,"readRequestBody");r(WPs,"parseJsonObject")});function Nit(e){let t=e.fetch??globalThis.fetch.bind(globalThis);if(!VPs(e))return t;let n,o=!1,s=r(()=>(o||(n=Drt(e),o=!0),n),"getTlsCaCertificates");return async(a,l)=>{let u=HPs(a);if(!u||u.protocol!=="http:"&&u.protocol!=="https:")return t(a,l);let f=ZRr(u,e),g=qrn(e);if(!f&&!g)return t(a,l);let _=await GPs(a,l);return JPs(_,{ca:g?s():void 0,proxyUrl:f})}}function VPs(e){return!!(e.caCertFile||e.env||e.httpProxy||e.noProxy)}function HPs(e){try{return e instanceof URL?e:e instanceof Request?new URL(e.url):new URL(String(e))}catch{return}}async function GPs(e,t){let n=new Request(e,t),o=n.method.toUpperCase(),s=o==="GET"||o==="HEAD"?void 0:await n.arrayBuffer();return{body:s&&s.byteLength>0?Buffer.from(s):void 0,headers:n.headers,method:o,signal:n.signal,url:new URL(n.url)}}function JPs(e,t){let n=e.url.protocol==="https:"?Mit.default:Fan.default;return new Promise((o,s)=>{let a=e.signal??void 0;if(a?.aborted){s(KUr(a));return}let l=!1,u,f,g=r(()=>{a?.removeEventListener("abort",I),f?.off("error",b),f?.off("close",w),u?.off("close",g),u?.off("error",T)},"cleanupAll"),_=r(E=>{l||(l=!0,g(),s(E))},"rejectOnce"),b=r(E=>{_(E)},"onRequestError"),w=r(()=>{!u&&l&&g()},"onRequestClose"),T=r(()=>{},"onResponseError"),I=r(()=>{let E=KUr(a);u?.destroy(E),f?.destroy(E),l||(l=!0,s(E))},"onAbort");a?.addEventListener("abort",I,{once:!0}),f=n.request({agent:KPs(e.url,t),headers:ZPs(e.headers),hostname:e.url.hostname,method:e.method,path:`${e.url.pathname}${e.url.search}`,port:e.url.port||void 0,protocol:e.url.protocol},E=>{u=E,u.once("close",g),u.once("error",T);let R=new Headers;for(let[L,U]of Object.entries(E.headers))if(Array.isArray(U))for(let B of U)R.append(L,B);else U!==void 0&&R.append(L,String(U));l=!0,o(new Response(E.statusCode===204||E.statusCode===205||E.statusCode===304?void 0:ZUr.Readable.toWeb(E),{headers:R,status:E.statusCode??502,statusText:E.statusMessage}))}),f.once("error",b),f.once("close",w),f.end(e.body)})}function KUr(e){if(e?.reason instanceof Error)return e.reason;let t=new Error("The operation was aborted.");return t.name="AbortError",t}function KPs(e,t){return t.proxyUrl?new lhe({ca:t.ca,getProxyForUrl:r(()=>t.proxyUrl??"","getProxyForUrl"),httpsAgent:t.ca?new Mit.default.Agent({ca:t.ca}):void 0}):e.protocol==="https:"?new Mit.default.Agent({ca:t.ca}):new Fan.default.Agent}function ZPs(e){let t={};return e.forEach((n,o)=>{t[o]=n}),t}var Fan,Mit,ZUr,jan=Y(()=>{"use strict";Fan=Ci(require("node:http"),1),Mit=Ci(require("node:https"),1),ZUr=require("node:stream");Urn();Wrn();r(Nit,"createNetworkProxyFetch");r(VPs,"hasNetworkFetchPolicy");r(HPs,"readFetchInputUrl");r(GPs,"normalizeFetchRequest");r(JPs,"fetchWithAgent");r(KUr,"abortReason");r(KPs,"createRequestAgent");r(ZPs,"headersToOutgoing")});function Ban(e){return async(t,n)=>{let o=QPs(t);if(!o)return await e.fetch(t,n);let s=n?.signal??(t instanceof Request?t.signal:void 0),a=YUr(t,n).get("x-api-key")?.trim(),l=await e.routingPort.resolve(o,{...a?{apiKey:a}:{},signal:s??void 0,trace:tRs(t,n)});if(!l.routed)return await e.fetch(t,n);let u=eRs(t,l.url);return u instanceof Request&&u.headers.delete("host"),await e.fetch(u,XPs(n))}}function XPs(e){if(!e?.headers)return e;let t=new Headers(e.headers);return t.has("host")?(t.delete("host"),{...e,headers:t}):e}function QPs(e){try{return e instanceof Request?e.url:e instanceof URL?e.href:new URL(String(e)).href}catch{return}}function eRs(e,t){return e instanceof Request?new Request(t,e):e instanceof URL?new URL(t):t}function tRs(e,t){let n=YUr(e,t).get(YPs)?.trim();return n?{traceId:n}:void 0}function YUr(e,t){return new Headers(t?.headers??(e instanceof Request?e.headers:void 0))}var YPs,Uan=Y(()=>{"use strict";YPs="x-zcode-trace-id";r(Ban,"createProviderEndpointRoutingFetch");r(XPs,"withoutHostHeader");r(QPs,"readRequestUrl");r(eRs,"rewriteInput");r(tRs,"readTraceContext");r(YUr,"readRequestHeaders")});function XUr(e){return e instanceof Lit||!QUr(e)?e:new Lit(e)}function zan(e){let t=e?.toUpperCase();return!!(t?.includes("CERT")||t?.includes("TLS")||t==="UNABLE_TO_VERIFY_LEAF_SIGNATURE")}function QUr(e,t=new WeakSet){if(e===null||typeof e!="object"||t.has(e))return!1;t.add(e);let n=e;return zan(typeof n.code=="string"?n.code:void 0)?!0:QUr(n.cause,t)}var nRs,Lit,$an=Y(()=>{"use strict";nRs="MODEL_TLS_VALIDATION_FAILED",Lit=class extends Error{static{r(this,"ModelTlsValidationError")}code=nRs;constructor(t){super("TLS validation failed for the provider request.",{cause:t}),this.name="ModelTlsValidationError"}};r(XUr,"normalizeModelTlsFailure");r(zan,"isTlsFailure");r(QUr,"hasTlsFailureCode")});function qan(...e){let t={};for(let n of e)for(let[o,s]of Object.entries(n??{})){for(let a of Object.keys(t))a.toLowerCase()===o.toLowerCase()&&delete t[a];t[o]=s}return t}var ezr=Y(()=>{"use strict";r(qan,"mergeModelRequestHeaders")});function tG(e){if(e instanceof S2)return!0;let t=eG(e);return t?.isProviderBusinessError===!0&&t.name==="ProviderBusinessError"}function aRs(e,t){let n={...t.access.type!=="zhipu-account"&&t.access.apiKey?{apiKey:t.access.apiKey}:{},baseURL:t.api.baseUrl,...t.api.headers?{headers:{...t.api.headers}}:{},providerOptions:{apiFormat:t.api.type},access:t.access};switch(t.api.type){case"anthropic-messages":return{kind:"anthropic",...n};case"openai-responses":return{kind:"openai",...n};case"openai-chat-completions":return{kind:"openai-compatible",name:e,...n}}throw new Error(`Unsupported Provider API type: ${String(t.api.type)}`)}function cRs({access:e,baseURL:t}){if(e.type==="zhipu-account"&&(e.mode==="start-plan"||e.mode==="off-peak"))return!1;if(e.type==="zhipu-coding-plan-api-key"||e.type==="zhipu-account"&&(e.mode==="individual-coding-plan"||e.mode==="team-coding-plan")||kXe(t)!==null)return!0;try{return rRs.has(new URL(t).hostname.toLowerCase())}catch{return!1}}function lRs(e,t){if(!t)return e;let n=Object.fromEntries(Object.entries(e.headers??{}).filter(([o])=>!["x-aliyun-captcha-verify-param","x-aliyun-captcha-verify-region"].includes(o.toLowerCase())));return{...e,...t.apiKey?{apiKey:t.apiKey}:{},headers:qan(n,t.headers)}}function uRs(e){return JSON.stringify({configUrl:e.configUrl,headers:Object.entries(e.headers).sort(([t],[n])=>t.localeCompare(n)),network:{caCertFile:e.network.caCertFile,httpProxy:e.network.httpProxy,noProxy:e.network.noProxy}})}function dRs(e,t){return!e||pRs(t,tzr)?t:{[tzr]:`Bearer ${e}`,...t}}function pRs(e,t){if(!e)return!1;let n=t.toLowerCase();return Object.keys(e).some(o=>o.toLowerCase()===n)}function fRs(e,t){if(!e)return;let n=t.toLowerCase();return Object.entries(e).find(([s])=>s.toLowerCase()===n)?.[1]?.trim()||void 0}function mRs(e){let t=e?.trim();if(t)try{let n=new URL(t),o=n.pathname.replace(/\/+$/u,"");return o.toLowerCase().endsWith("/v1")?(n.pathname=o,n.href):(n.pathname=`${o}/v1`,n.href)}catch{let n=t.replace(/\/+$/u,"");return n.toLowerCase().endsWith("/v1")?n:`${n}/v1`}}function hRs(e){let t=Wan(e),n=e.endpointRoutingPort?Ban({fetch:t,routingPort:e.endpointRoutingPort}):t;return async(o,s)=>{let a;try{a=await n(o,s)}catch(u){throw XUr(u)}if(!a.ok){let u=await rzr(a,e);if(u)throw await nzr(a),u}if(yRs(a))return vRs(a,e);let l=await rzr(a,e);if(l)throw await nzr(a),l;return a}}async function nzr(e){if(!e.body)return;let n;try{await Promise.race([e.arrayBuffer().then(()=>{}),new Promise(o=>{n=setTimeout(o,oRs)})])}catch{}finally{n!==void 0&&clearTimeout(n)}}function Wan(e){return Nit(e)}async function rzr(e,t){if(!gRs(e))return;let n;try{let s=await _Rs(e);if(s===void 0||s.trim().length===0)return;n=JSON.parse(s)}catch{return}let o=CDe(n);if(o)return new S2({providerCode:o.providerCode,providerId:t.providerId,providerKind:t.providerKind,providerMessage:o.providerMessage,providerRequestId:o.providerRequestId,responseBodySummary:o.responseBodySummary,responseHeaders:czr(e.headers),responseStatus:e.status,statusCode:o.statusCode})}function CDe(e){let t=eG(e);if(!t)return;let n=eG(t.error),o=AM(t.providerCode)??AM(n?.providerCode)??AM(t.error_code)??AM(n?.error_code)??AM(t.code)??AM(n?.code),s=dzr(t),a=t.success===!1,l=xRs(o);if(!(!a&&!l))return{providerCode:o,providerMessage:s,providerRequestId:Van(t),responseBodySummary:pzr(t),statusCode:uzr(o)}}function gRs(e){if(!e.ok)return!0;let t=e.headers.get("content-type")?.toLowerCase()??"";if(t.includes("event-stream"))return!1;if(t.includes("json"))return!0;let n=azr(e.headers.get("content-length"));return n!==void 0&&n<=IDe}async function _Rs(e){let t=azr(e.headers.get("content-length"));if(t!==void 0&&t>IDe)return;let n=e.clone();if(!n.body){let l=await n.text();return l.length>IDe?void 0:l}let o=n.body.getReader(),s=new TextDecoder,a="";try{for(;;){let l=await o.read();if(l.done)return a+=s.decode(),a.length>IDe?void 0:a;if(a+=s.decode(l.value,{stream:!0}),a.length>IDe){await o.cancel();return}}}finally{o.releaseLock()}}function azr(e){if(!e)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function yRs(e){return e.body!==null&&e.headers.get("content-type")?.toLowerCase().includes("event-stream")===!0}function czr(e){let t={};return e.forEach((n,o)=>{t[o]=n}),t}function vRs(e,t){let n=e.body;if(!n)return e;let o=new Headers(e.headers);o.delete("content-length"),o.delete("content-encoding");let s=czr(e.headers);return new Response(n.pipeThrough(bRs(t,e.status,s)),{headers:o,status:e.status,statusText:e.statusText})}function bRs(e,t,n){let o=new TextDecoder,s=new TextEncoder,a="",l=!1;return new TransformStream({transform(u,f){l||(a+=o.decode(u,{stream:!0}),a=ozr(a,f,s,e,t,n,()=>{l=!0}))},flush(u){l||(a+=o.decode(),a=ozr(a,u,s,e,t,n,()=>{l=!0}),!l&&a.length>0&&lzr(a,"",u,s,e,t,n,()=>{l=!0}))}})}function ozr(e,t,n,o,s,a,l){let u=e;for(;;){let f=sRs.exec(u);if(!f)return u;let g=f[0]??"",_=u.slice(0,f.index);if(u=u.slice(f.index+g.length),!lzr(_,g,t,n,o,s,a,l))return""}}function lzr(e,t,n,o,s,a,l,u){let f=SRs(e);return f?(n.error(new S2({providerCode:f.providerCode,providerId:s.providerId,providerKind:s.providerKind,providerMessage:f.providerMessage,providerRequestId:f.providerRequestId,responseBodySummary:f.responseBodySummary,responseHeaders:l,responseStatus:a,statusCode:f.statusCode})),u(),!1):(n.enqueue(o.encode(`${e}${t}`)),!0)}function SRs(e){let t=wRs(e),n=t.data?.trim();if(!n||n==="[DONE]")return;let o=kRs(n);if(!o)return;let s=CDe(o);if(s)return{...s,providerRequestId:Van(o)};if(t.event?.toLowerCase()!=="error")return;let a=eG(o.error),l=AM(o.providerCode)??AM(a?.providerCode)??AM(o.error_code)??AM(a?.error_code)??AM(o.code)??AM(a?.code);return{providerCode:l,providerMessage:dzr(o),providerRequestId:Van(o),responseBodySummary:pzr(o),statusCode:uzr(l)}}function wRs(e){let t=[],n;for(let o of e.split(/\r\n|\n|\r/)){if(o.startsWith("event:")){n=izr(o.slice(6));continue}o.startsWith("data:")&&t.push(izr(o.slice(5)))}return{data:t.length===0?void 0:t.join(`
|
|
2074
2074
|
`),event:n}}function izr(e){return e.startsWith(" ")?e.slice(1):e}function kRs(e){try{return eG(JSON.parse(e))}catch{return}}function xRs(e){if(e===void 0)return!1;if(typeof e=="number")return Number.isFinite(e)&&e!==0;let t=e.trim();if(t.length===0)return!1;let n=Number(t);return Number.isFinite(n)?n!==0:!0}function uzr(e){if(typeof e=="number"&&Number.isFinite(e)){let o=Math.trunc(e);return szr(o)?o:void 0}if(typeof e!="string")return;let t=e.trim();if(!/^\d+$/.test(t))return;let n=Number(t);return szr(n)?n:void 0}function szr(e){return Number.isInteger(e)&&e>=100&&e<=599}function AM(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim().length>0){let t=e.trim();return t.toUpperCase()===iRs?void 0:t}}function dzr(e){let t=eG(e.error);return b0e(e.msg)??b0e(e.message)??b0e(t?.msg)??b0e(t?.message)??b0e(e.error)}function Van(e){let t=eG(e.error);return v0e(e.request_id)??v0e(e.requestId)??v0e(e.id)??v0e(t?.request_id)??v0e(t?.requestId)??v0e(t?.id)}function b0e(e){if(typeof e!="string")return;let t=e.trim().replace(/\s+/g," ");if(t.length!==0)return t.length>jit?`${t.slice(0,jit)}...`:t}function v0e(e){if(typeof e!="string")return;let t=e.trim();if(t.length!==0)return t.length>jit?`${t.slice(0,jit)}...`:t}function pzr(e){let t={keys:Object.keys(e).slice(0,20)};PA(e,t,"success"),PA(e,t,"code"),PA(e,t,"error_code"),PA(e,t,"msg"),PA(e,t,"message"),PA(e,t,"request_id"),PA(e,t,"requestId");let n=eG(e.error);if(n){let o={keys:Object.keys(n).slice(0,20)};PA(n,o,"code"),PA(n,o,"error_code"),PA(n,o,"msg"),PA(n,o,"message"),PA(n,o,"request_id"),PA(n,o,"requestId"),PA(n,o,"type"),t.error=o}return t}function PA(e,t,n){let o=e[n];(o==null||typeof o=="string"||typeof o=="number"||typeof o=="boolean")&&(t[n]=o)}function eG(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}var rRs,Fit,S2,IDe,jit,oRs,iRs,sRs,tzr,Bit,P7=Y(()=>{"use strict";man();K8r();LUr();cWt();ms();zUr();qUr();HUr();JUr();jan();Uan();$an();ezr();rRs=new Set(["api.chatglm.site","zcode.chatglm.site"]),Fit=class{static{r(this,"AiSdkClientRequestSigningState")}keyCache=new cPe;featureGates=new Map;resolveFeatureGate(t){let n=this.featureGates.get(t.apiKey);n||(n=new Map,this.featureGates.set(t.apiKey,n));let o=n.get(t.scopeKey);if(o)return o;let s=t.create();return n.set(t.scopeKey,s),s}},S2=class extends Error{static{r(this,"ProviderBusinessError")}code="PROVIDER_BUSINESS_ERROR";isProviderBusinessError=!0;providerCode;providerId;providerKind;providerMessage;providerRequestId;responseBodySummary;responseHeaders;responseStatus;statusCode;constructor(t){let n=b0e(t.providerMessage)??"Provider returned a business error.";super(n),this.name="ProviderBusinessError",this.providerCode=t.providerCode,this.providerId=t.providerId,this.providerKind=t.providerKind,this.providerMessage=n,this.providerRequestId=t.providerRequestId,this.responseBodySummary=t.responseBodySummary,this.responseHeaders=t.responseHeaders,this.responseStatus=t.responseStatus,this.statusCode=t.statusCode}};r(tG,"isProviderBusinessError");IDe=64e3,jit=1e3,oRs=1e3,iRs="PROVIDER_BUSINESS_ERROR",sRs=/\r\n\r\n|\n\n|\r\r/,tzr="Authorization",Bit=class{static{r(this,"AiSdkModelExecution")}env;defaultHeaders;network;endpointRoutingPort;logger;baseTransport;clientRequestSigningState;providerTransports=new Map;signingManager;clientSigningObservations=new Dit;accessModeUnsignedLoggedProviders=new Set;constructor(t={},n={}){this.env=t.env??process.env,this.defaultHeaders={...t.defaultHeaders},this.network={...t.network},this.endpointRoutingPort=t.endpointRoutingPort,this.logger=n.logger,this.baseTransport=n.transport,this.clientRequestSigningState=n.clientRequestSigningState;let o=new Map,s=r(a=>{if(!t.codingPlanSignature)return;let l=o.get(a);if(l&&!this.clientRequestSigningState)return l;let u={...t.codingPlanSignature.headers,"x-api-key":a},f=Wan({caCertFile:this.network.caCertFile,env:this.env,fetch:this.baseTransport,httpProxy:this.network.httpProxy,noProxy:this.network.noProxy}),g=r(()=>new aPe({headers:u,onResult:r(b=>this.logFeatureGateResult(b),"onResult"),transport:f,url:t.codingPlanSignature.configUrl}),"createFeatureGate"),_=this.clientRequestSigningState?this.clientRequestSigningState.resolveFeatureGate({apiKey:a,create:g,scopeKey:uRs({configUrl:t.codingPlanSignature.configUrl,headers:t.codingPlanSignature.headers,network:this.network})}):g();return this.clientRequestSigningState||o.set(a,_),_},"resolveSigningFeatureGate");this.signingManager=new lPe({isEnabled:r((a,l)=>s(a)?.isEnabled(l)??Promise.resolve(!1),"isEnabled"),keyCache:this.clientRequestSigningState?.keyCache,observer:r(a=>this.observeClientSigning(a),"observer")})}observeClientSigning(t){t.requestId&&this.clientSigningObservations.record(t.requestId,t.observation);let{kind:n,...o}=t.observation,s={...o,event:`model.client_signing.${n}`,providerId:t.providerId,requestId:t.requestId,sessionId:t.sessionId};switch(n){case"signed_sent":this.logger?.debug("Client request signing applied",s);return;case"unsigned_sent":this.logger?.info("Client request sent without signature",s);return;case"handshake_failed":this.logger?.warn("Client signing handshake failed",s);return;case"verify_rejected":this.logger?.warn("Client signing rejected by gateway",s);return;case"bypass_entered":this.logger?.warn("Client signing entered BYPASS for current signer generation",s);return;case"request_failed_closed":this.logger?.warn("Client signing failed closed",s)}}logFeatureGateResult(t){let n={cacheable:t.cacheable,enabled:t.enabled,event:"model.client_signing.feature_gate",failure:t.failure,httpStatus:t.httpStatus};if(t.failure){this.logger?.warn("Client signing feature gate unavailable",n);return}this.logger?.info(t.enabled?"Client signing feature gate enabled":"Client signing feature gate disabled",n)}createAccessModeUnsignedFetch(t,n){return(o,s)=>{let a=$Ur(o,s),l={kind:"unsigned_sent",reason:"access_mode"};return a&&this.clientSigningObservations.record(a,l),this.accessModeUnsignedLoggedProviders.has(t)||(this.accessModeUnsignedLoggedProviders.add(t),this.logger?.info("Client request signing skipped by provider access mode",{event:"model.client_signing.unsigned_sent",providerId:t,reason:"access_mode",requestId:a})),n(o,s)}}bindModel(t){let n=this.captureModelSnapshot(t),o=Otr(t.optionSpecs);return{resolved:this.resolveSnapshot(n,void 0,void 0,void 0),resolveRequest:r(({options:s,requestAuth:a})=>this.resolveSnapshot(n,a,o,s),"resolveRequest")}}captureModelSnapshot(t){let n=aRs(t.providerId,t.providerConfig);n.headers=qan(lZt(this.defaultHeaders,n.baseURL),n.headers);let o=this.resolveApiKey(n);return{providerConfig:{...n,...o?{apiKey:o}:{},...n.headers?{headers:{...n.headers}}:{},...n.providerOptions?{providerOptions:{...n.providerOptions}}:{}},providerId:t.providerId,modelId:t.modelId,supportsJsonSchemaOutput:t.supportsJsonSchemaOutput}}resolveSnapshot(t,n,o,s){let a=lRs(t.providerConfig,n),l={},u=this.createFactory(t.providerId,a,cRs(t.providerConfig),o,s,l,t.supportsJsonSchemaOutput);return{baseURL:a.baseURL,headers:a.headers,providerId:t.providerId,modelId:t.modelId,model:u(t.modelId.toString()),providerKind:a.kind,providerOptions:a.providerOptions,rawRequestBodyCapture:l,clientSigningObservations:this.clientSigningObservations}}createFactory(t,n,o,s,a,l,u){let f=this.resolveApiKey(n),g=n.headers,_=this.resolveProviderTransport(t),b=o?this.resolveClientSigningFetch(t,n,f,_):kXe(n.baseURL)!==null?this.createAccessModeUnsignedFetch(t,_):_,w=hRs({fetch:b,providerId:t,providerKind:n.kind}),T=s&&a?GUr({capture:l,fetch:w,maps:s,values:a}):w;switch(n.kind){case"openai":return kan({apiKey:f,baseURL:n.baseURL,fetch:VUr(T),headers:g}).responses;case"anthropic":return fan({apiKey:f,baseURL:mRs(n.baseURL),fetch:BUr(T),headers:dRs(f,g)});case"openai-compatible":return NUr({name:n.name??t,baseURL:n.baseURL,apiKey:f,fetch:T,headers:g,includeUsage:!0,supportsStructuredOutputs:u})}}resolveApiKey(t){return t.apiKey}resolveProviderTransport(t){let n=this.providerTransports.get(t);if(n)return n;let o=Wan({caCertFile:this.network.caCertFile,env:this.env,fetch:this.baseTransport,httpProxy:this.network.httpProxy,noProxy:this.network.noProxy}),s=this.endpointRoutingPort?Ban({fetch:o,routingPort:this.endpointRoutingPort}):o;return this.providerTransports.set(t,s),s}resolveClientSigningFetch(t,n,o,s){let a=n.baseURL;return a?this.signingManager.createFetch({apiKey:o??"",baseURL:a,clientVersion:fRs(n.headers,"X-ZCode-App-Version")??HL,providerId:t},s):s}};r(aRs,"toAiSdkProviderConfig");r(cRs,"requiresClientRequestSigning");r(lRs,"applyModelRequestAuth");r(uRs,"clientRequestSigningFeatureScopeKey");r(dRs,"withAnthropicAuthorizationHeader");r(pRs,"hasHeader");r(fRs,"readHeader");r(mRs,"normalizeAnthropicBaseURL");r(hRs,"createProviderBusinessErrorFetch");r(nzr,"consumeBusinessErrorResponseBodyBestEffort");r(Wan,"createProviderProxyFetch");r(rzr,"detectProviderBusinessError");r(CDe,"readProviderBusinessFailureFromBody");r(gRs,"responseMayContainBusinessJson");r(_Rs,"readLimitedResponseText");r(azr,"parseContentLength");r(yRs,"responseMayContainSseBusinessError");r(czr,"responseHeadersToRecord");r(vRs,"createProviderBusinessErrorSseResponse");r(bRs,"createProviderBusinessErrorSseTransform");r(ozr,"emitCompleteProviderBusinessSseFrames");r(lzr,"emitProviderBusinessSseFrame");r(SRs,"detectProviderBusinessSseFrameFailure");r(wRs,"readSseFrame");r(izr,"trimSseFieldValue");r(kRs,"safeParseRecord");r(xRs,"isNonZeroProviderCode");r(uzr,"providerCodeToStatusCode");r(szr,"isHttpStatusCode");r(AM,"toProviderCode");r(dzr,"readProviderMessage");r(Van,"readProviderRequestId");r(b0e,"normalizeProviderMessage");r(v0e,"normalizeProviderId");r(pzr,"summarizeProviderBusinessBody");r(PA,"copyScalar");r(eG,"asRecord")});function hzr(e,t){let n=ARs(t);return{backoffFactor:mzr(e?.backoffFactor,mzr(n.backoffFactor,EDe.backoffFactor)),baseDelayMs:Uit(e?.baseDelayMs,Uit(n.baseDelayMs,EDe.baseDelayMs)),jitter:e?.jitter??EDe.jitter,maxAttempts:fzr(e?.maxAttempts,fzr(n.maxAttempts,EDe.maxAttempts)),maxDelayMs:Uit(e?.maxDelayMs,Uit(n.maxDelayMs,EDe.maxDelayMs))}}function ARs(e){let t=Han(e[TRs]);return{backoffFactor:PRs(e[CRs]),baseDelayMs:Han(e[IRs]),maxAttempts:t===void 0?void 0:t+1,maxDelayMs:Han(e[ERs])}}function Han(e){if(e===void 0||e.trim().length===0)return;let t=Number(e);if(!(!Number.isFinite(t)||t<0))return Math.floor(t)}function PRs(e){if(e===void 0||e.trim().length===0)return;let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t}function fzr(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(1,Math.floor(e))}function mzr(e,t){return e===void 0||!Number.isFinite(e)||e<=0?t:e}function Uit(e,t){return e===void 0||!Number.isFinite(e)?t:Math.max(0,Math.floor(e))}var TRs,IRs,CRs,ERs,EDe,Gan=Y(()=>{"use strict";TRs="ZCODE_MODEL_RETRY_MAX_RETRIES",IRs="ZCODE_MODEL_RETRY_BASE_DELAY_MS",CRs="ZCODE_MODEL_RETRY_BACKOFF_FACTOR",ERs="ZCODE_MODEL_RETRY_MAX_DELAY_MS",EDe={backoffFactor:2,baseDelayMs:2e3,jitter:!0,maxAttempts:11,maxDelayMs:6e4};r(hzr,"resolveAiSdkModelRetryOptions");r(ARs,"readRetryOptionsFromEnv");r(Han,"parseNonNegativeInteger");r(PRs,"parsePositiveNumber");r(fzr,"normalizePositiveInteger");r(mzr,"normalizePositiveNumber");r(Uit,"normalizeNonNegativeInteger")});function gzr(e){let t=e.baseTimeoutMs===void 0||!Number.isFinite(e.baseTimeoutMs)?YV:e.baseTimeoutMs;if(t<=0)return t;let n=e.retryNumber===void 0||!Number.isFinite(e.retryNumber)?0:Math.max(0,Math.floor(e.retryNumber));return t+n*RRs}function zit(e){if(e instanceof ADe)return!0;if(e===null||typeof e!="object")return!1;let t=e;return t.code==="MODEL_STREAM_IDLE_TIMEOUT"||t.name==="ModelStreamIdleTimeoutError"}function _zr(e){let t=new AbortController;if(!e)return{controller:t,signal:t.signal,cleanup(){}};if(e.aborted)return t.abort(e.reason),{controller:t,signal:t.signal,cleanup(){}};let n=r(()=>{t.signal.aborted||t.abort(e.reason)},"abortFromParent");return e.addEventListener("abort",n,{once:!0}),{controller:t,signal:t.signal,cleanup(){e.removeEventListener("abort",n)}}}async function yzr(e,t){if(!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)return e.next();let n=Date.now(),o,s,a=!1,l,u=new Promise((g,_)=>{o=setTimeout(()=>{if(t.abortController.signal.aborted){_(t.abortController.signal.reason??new Error("Model stream aborted."));return}a=!0,l=new ADe({idleMs:Math.max(0,Date.now()-n),timeoutMs:t.timeoutMs}),t.abortController.abort(l),_(l)},t.timeoutMs)}),f=new Promise((g,_)=>{let b=t.abortController.signal,w=r(()=>{_(b.reason??new Error("Model stream aborted."))},"rejectAbort");if(b.aborted){w();return}b.addEventListener("abort",w,{once:!0}),s=r(()=>b.removeEventListener("abort",w),"removeAbortListener")});try{return await Promise.race([e.next(),u,f])}catch(g){if(!a)throw g;let _=l??new ADe({idleMs:Math.max(0,Date.now()-n),timeoutMs:t.timeoutMs});throw await t.onTimeout?.(_),_}finally{o&&clearTimeout(o),s?.()}}var RRs,ADe,$it=Y(()=>{"use strict";nr();nr();RRs=3e4;r(gzr,"resolveModelStreamIdleTimeoutMs");ADe=class extends Error{static{r(this,"ModelStreamIdleTimeoutError")}code="MODEL_STREAM_IDLE_TIMEOUT";idleMs;timeoutMs;constructor(t){super(`Model stream stalled: no event received for ${t.timeoutMs}ms.`),this.name="ModelStreamIdleTimeoutError",this.idleMs=t.idleMs,this.timeoutMs=t.timeoutMs}};r(zit,"isModelStreamIdleTimeoutError");r(_zr,"createLinkedAbortController");r(yzr,"readNextWithStreamIdleTimeout")});var Kan=At((tsl,Szr)=>{"use strict";var Jan=Object.defineProperty,DRs=Object.getOwnPropertyDescriptor,ORs=Object.getOwnPropertyNames,MRs=Object.prototype.hasOwnProperty,NRs=r((e,t)=>{for(var n in t)Jan(e,n,{get:t[n],enumerable:!0})},"__export"),LRs=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ORs(t))!MRs.call(e,s)&&s!==n&&Jan(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=DRs(t,s))||o.enumerable});return e},"__copyProps"),FRs=r(e=>LRs(Jan({},"__esModule",{value:!0}),e),"__toCommonJS"),vzr={};NRs(vzr,{SYMBOL_FOR_REQ_CONTEXT:r(()=>bzr,"SYMBOL_FOR_REQ_CONTEXT"),getContext:r(()=>jRs,"getContext")});Szr.exports=FRs(vzr);var bzr=Symbol.for("@vercel/request-context");function jRs(){return globalThis[bzr]?.get?.()??{}}r(jRs,"getContext")});var PDe=At((rsl,kzr)=>{"use strict";var Yan=Object.defineProperty,BRs=Object.getOwnPropertyDescriptor,URs=Object.getOwnPropertyNames,zRs=Object.prototype.hasOwnProperty,$Rs=r((e,t)=>{for(var n in t)Yan(e,n,{get:t[n],enumerable:!0})},"__export"),qRs=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of URs(t))!zRs.call(e,s)&&s!==n&&Yan(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=BRs(t,s))||o.enumerable});return e},"__copyProps"),WRs=r(e=>qRs(Yan({},"__esModule",{value:!0}),e),"__toCommonJS"),wzr={};$Rs(wzr,{VercelOidcTokenError:r(()=>Zan,"VercelOidcTokenError")});kzr.exports=WRs(wzr);var Zan=class extends Error{static{r(this,"VercelOidcTokenError")}constructor(t,n){super(t),this.name="VercelOidcTokenError",this.cause=n}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}}});var Czr=At((isl,Izr)=>{"use strict";var VRs=Object.create,qit=Object.defineProperty,HRs=Object.getOwnPropertyDescriptor,GRs=Object.getOwnPropertyNames,JRs=Object.getPrototypeOf,KRs=Object.prototype.hasOwnProperty,ZRs=r((e,t)=>{for(var n in t)qit(e,n,{get:t[n],enumerable:!0})},"__export"),xzr=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of GRs(t))!KRs.call(e,s)&&s!==n&&qit(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=HRs(t,s))||o.enumerable});return e},"__copyProps"),Qan=r((e,t,n)=>(n=e!=null?VRs(JRs(e)):{},xzr(t||!e||!e.__esModule?qit(n,"default",{value:e,enumerable:!0}):n,e)),"__toESM"),YRs=r(e=>xzr(qit({},"__esModule",{value:!0}),e),"__toCommonJS"),Tzr={};ZRs(Tzr,{findRootDir:r(()=>e2s,"findRootDir"),getUserDataDir:r(()=>t2s,"getUserDataDir")});Izr.exports=YRs(Tzr);var RDe=Qan(require("path")),XRs=Qan(require("fs")),Xan=Qan(require("os")),QRs=PDe();function e2s(){try{let e=process.cwd();for(;e!==RDe.default.dirname(e);){let t=RDe.default.join(e,".vercel");if(XRs.default.existsSync(t))return e;e=RDe.default.dirname(e)}}catch{throw new QRs.VercelOidcTokenError("Token refresh only supported in node server environments")}return null}r(e2s,"findRootDir");function t2s(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(Xan.default.platform()){case"darwin":return RDe.default.join(Xan.default.homedir(),"Library/Application Support");case"linux":return RDe.default.join(Xan.default.homedir(),".local/share");case"win32":return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}r(t2s,"getUserDataDir")});var Mzr=At((asl,Ozr)=>{"use strict";var n2s=Object.create,Wit=Object.defineProperty,r2s=Object.getOwnPropertyDescriptor,o2s=Object.getOwnPropertyNames,i2s=Object.getPrototypeOf,s2s=Object.prototype.hasOwnProperty,a2s=r((e,t)=>{for(var n in t)Wit(e,n,{get:t[n],enumerable:!0})},"__export"),Ezr=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of o2s(t))!s2s.call(e,s)&&s!==n&&Wit(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=r2s(t,s))||o.enumerable});return e},"__copyProps"),Azr=r((e,t,n)=>(n=e!=null?n2s(i2s(e)):{},Ezr(t||!e||!e.__esModule?Wit(n,"default",{value:e,enumerable:!0}):n,e)),"__toESM"),c2s=r(e=>Ezr(Wit({},"__esModule",{value:!0}),e),"__toCommonJS"),Pzr={};a2s(Pzr,{isValidAccessToken:r(()=>p2s,"isValidAccessToken"),readAuthConfig:r(()=>u2s,"readAuthConfig"),writeAuthConfig:r(()=>d2s,"writeAuthConfig")});Ozr.exports=c2s(Pzr);var DDe=Azr(require("fs")),Rzr=Azr(require("path")),l2s=ODe();function Dzr(){let e=(0,l2s.getVercelDataDir)();if(!e)throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return Rzr.join(e,"auth.json")}r(Dzr,"getAuthConfigPath");function u2s(){try{let e=Dzr();if(!DDe.existsSync(e))return null;let t=DDe.readFileSync(e,"utf8");return t?JSON.parse(t):null}catch{return null}}r(u2s,"readAuthConfig");function d2s(e){let t=Dzr(),n=Rzr.dirname(t);DDe.existsSync(n)||DDe.mkdirSync(n,{mode:504,recursive:!0}),DDe.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}r(d2s,"writeAuthConfig");function p2s(e,t=0){if(!e.token)return!1;if(typeof e.expiresAt!="number")return!0;let n=Math.floor(Date.now()/1e3),o=t/1e3;return e.expiresAt>=n+o}r(p2s,"isValidAccessToken")});var jzr=At((lsl,Fzr)=>{"use strict";var ncn=Object.defineProperty,f2s=Object.getOwnPropertyDescriptor,m2s=Object.getOwnPropertyNames,h2s=Object.prototype.hasOwnProperty,g2s=r((e,t)=>{for(var n in t)ncn(e,n,{get:t[n],enumerable:!0})},"__export"),_2s=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of m2s(t))!h2s.call(e,s)&&s!==n&&ncn(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=f2s(t,s))||o.enumerable});return e},"__copyProps"),y2s=r(e=>_2s(ncn({},"__esModule",{value:!0}),e),"__toCommonJS"),Nzr={};g2s(Nzr,{processTokenResponse:r(()=>k2s,"processTokenResponse"),refreshTokenRequest:r(()=>w2s,"refreshTokenRequest")});Fzr.exports=y2s(Nzr);var ecn=require("os"),v2s="https://vercel.com",b2s="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",Lzr=`@vercel/oidc node-${process.version} ${(0,ecn.platform)()} (${(0,ecn.arch)()}) ${(0,ecn.hostname)()}`,tcn=null;async function S2s(){if(tcn)return tcn;let e=`${v2s}/.well-known/openid-configuration`,t=await fetch(e,{headers:{"user-agent":Lzr}});if(!t.ok)throw new Error("Failed to discover OAuth endpoints");let n=await t.json();if(!n||typeof n.token_endpoint!="string")throw new Error("Invalid OAuth discovery response");let o=n.token_endpoint;return tcn=o,o}r(S2s,"getTokenEndpoint");async function w2s(e){let t=await S2s();return await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":Lzr},body:new URLSearchParams({client_id:b2s,grant_type:"refresh_token",...e})})}r(w2s,"refreshTokenRequest");async function k2s(e){let t=await e.json();if(!e.ok){let n=typeof t=="object"&&t&&"error"in t?String(t.error):"Token refresh failed";return[new Error(n)]}return typeof t!="object"||t===null?[new Error("Invalid token response")]:typeof t.access_token!="string"?[new Error("Missing access_token in response")]:t.token_type!=="Bearer"?[new Error("Invalid token_type in response")]:typeof t.expires_in!="number"?[new Error("Missing expires_in in response")]:[null,t]}r(k2s,"processTokenResponse")});var scn=At((dsl,Uzr)=>{"use strict";var icn=Object.defineProperty,x2s=Object.getOwnPropertyDescriptor,T2s=Object.getOwnPropertyNames,I2s=Object.prototype.hasOwnProperty,C2s=r((e,t)=>{for(var n in t)icn(e,n,{get:t[n],enumerable:!0})},"__export"),E2s=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of T2s(t))!I2s.call(e,s)&&s!==n&&icn(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=x2s(t,s))||o.enumerable});return e},"__copyProps"),A2s=r(e=>E2s(icn({},"__esModule",{value:!0}),e),"__toCommonJS"),Bzr={};C2s(Bzr,{AccessTokenMissingError:r(()=>rcn,"AccessTokenMissingError"),RefreshAccessTokenFailedError:r(()=>ocn,"RefreshAccessTokenFailedError")});Uzr.exports=A2s(Bzr);var rcn=class extends Error{static{r(this,"AccessTokenMissingError")}constructor(){super("No authentication found. Please log in with the Vercel CLI (vercel login)."),this.name="AccessTokenMissingError"}},ocn=class extends Error{static{r(this,"RefreshAccessTokenFailedError")}constructor(t){super("Failed to refresh authentication token.",{cause:t}),this.name="RefreshAccessTokenFailedError"}}});var ODe=At((fsl,Vzr)=>{"use strict";var P2s=Object.create,Vit=Object.defineProperty,R2s=Object.getOwnPropertyDescriptor,D2s=Object.getOwnPropertyNames,O2s=Object.getPrototypeOf,M2s=Object.prototype.hasOwnProperty,N2s=r((e,t)=>{for(var n in t)Vit(e,n,{get:t[n],enumerable:!0})},"__export"),$zr=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of D2s(t))!M2s.call(e,s)&&s!==n&&Vit(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=R2s(t,s))||o.enumerable});return e},"__copyProps"),qzr=r((e,t,n)=>(n=e!=null?P2s(O2s(e)):{},$zr(t||!e||!e.__esModule?Vit(n,"default",{value:e,enumerable:!0}):n,e)),"__toESM"),L2s=r(e=>$zr(Vit({},"__esModule",{value:!0}),e),"__toCommonJS"),Wzr={};N2s(Wzr,{assertVercelOidcTokenResponse:r(()=>acn,"assertVercelOidcTokenResponse"),findProjectInfo:r(()=>U2s,"findProjectInfo"),getTokenPayload:r(()=>q2s,"getTokenPayload"),getVercelDataDir:r(()=>F2s,"getVercelDataDir"),getVercelOidcToken:r(()=>B2s,"getVercelOidcToken"),getVercelToken:r(()=>j2s,"getVercelToken"),isExpired:r(()=>W2s,"isExpired"),loadToken:r(()=>$2s,"loadToken"),saveToken:r(()=>z2s,"saveToken")});Vzr.exports=L2s(Wzr);var MDe=qzr(require("path")),Xne=qzr(require("fs")),k0e=PDe(),Hit=Czr(),S0e=Mzr(),zzr=jzr(),w0e=scn();function F2s(){let e="com.vercel.cli",t=(0,Hit.getUserDataDir)();return t?MDe.join(t,e):null}r(F2s,"getVercelDataDir");async function j2s(e){let t=(0,S0e.readAuthConfig)();if(!t?.token)throw new w0e.AccessTokenMissingError;if((0,S0e.isValidAccessToken)(t,e?.expirationBufferMs))return t.token;if(!t.refreshToken)throw(0,S0e.writeAuthConfig)({}),new w0e.RefreshAccessTokenFailedError("No refresh token available");try{let n=await(0,zzr.refreshTokenRequest)({refresh_token:t.refreshToken}),[o,s]=await(0,zzr.processTokenResponse)(n);if(o||!s)throw(0,S0e.writeAuthConfig)({}),new w0e.RefreshAccessTokenFailedError(o);let a={token:s.access_token,expiresAt:Math.floor(Date.now()/1e3)+s.expires_in};return s.refresh_token&&(a.refreshToken=s.refresh_token),(0,S0e.writeAuthConfig)(a),a.token}catch(n){throw(0,S0e.writeAuthConfig)({}),n instanceof w0e.AccessTokenMissingError||n instanceof w0e.RefreshAccessTokenFailedError?n:new w0e.RefreshAccessTokenFailedError(n)}}r(j2s,"getVercelToken");async function B2s(e,t,n){let o=`https://api.vercel.com/v1/projects/${t}/token?source=vercel-oidc-refresh${n?`&teamId=${n}`:""}`,s=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!s.ok)throw new k0e.VercelOidcTokenError(`Failed to refresh OIDC token: ${s.statusText}`);let a=await s.json();return acn(a),a}r(B2s,"getVercelOidcToken");function acn(e){if(!e||typeof e!="object")throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!("token"in e)||typeof e.token!="string")throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}r(acn,"assertVercelOidcTokenResponse");function U2s(){let e=(0,Hit.findRootDir)();if(!e)throw new k0e.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");let t=MDe.join(e,".vercel","project.json");if(!Xne.existsSync(t))throw new k0e.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");let n=JSON.parse(Xne.readFileSync(t,"utf8"));if(typeof n.projectId!="string"&&typeof n.orgId!="string")throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:n.projectId,teamId:n.orgId}}r(U2s,"findProjectInfo");function z2s(e,t){let n=(0,Hit.getUserDataDir)();if(!n)throw new k0e.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let o=MDe.join(n,"com.vercel.token",`${t}.json`),s=JSON.stringify(e);Xne.mkdirSync(MDe.dirname(o),{mode:504,recursive:!0}),Xne.writeFileSync(o,s),Xne.chmodSync(o,432)}r(z2s,"saveToken");function $2s(e){let t=(0,Hit.getUserDataDir)();if(!t)throw new k0e.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");let n=MDe.join(t,"com.vercel.token",`${e}.json`);if(!Xne.existsSync(n))return null;let o=JSON.parse(Xne.readFileSync(n,"utf8"));return acn(o),o}r($2s,"loadToken");function q2s(e){let t=e.split(".");if(t.length!==3)throw new k0e.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");let n=t[1].replace(/-/g,"+").replace(/_/g,"/"),o=n.padEnd(n.length+(4-n.length%4)%4,"=");return JSON.parse(Buffer.from(o,"base64").toString("utf8"))}r(q2s,"getTokenPayload");function W2s(e,t=0){return e.exp*1e3<Date.now()+t}r(W2s,"isExpired")});var Kzr=At((hsl,Jzr)=>{"use strict";var ccn=Object.defineProperty,V2s=Object.getOwnPropertyDescriptor,H2s=Object.getOwnPropertyNames,G2s=Object.prototype.hasOwnProperty,J2s=r((e,t)=>{for(var n in t)ccn(e,n,{get:t[n],enumerable:!0})},"__export"),K2s=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of H2s(t))!G2s.call(e,s)&&s!==n&&ccn(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=V2s(t,s))||o.enumerable});return e},"__copyProps"),Z2s=r(e=>K2s(ccn({},"__esModule",{value:!0}),e),"__toCommonJS"),Gzr={};J2s(Gzr,{refreshToken:r(()=>Y2s,"refreshToken")});Jzr.exports=Z2s(Gzr);var Hzr=PDe(),nG=ODe();async function Y2s(e){let t=e?.project,n=e?.team;if(!t&&!n){let s=(0,nG.findProjectInfo)();t=s.projectId,n=s.teamId}else if(!t||!n){let s=(0,nG.findProjectInfo)();t=t??s.projectId,n=n??s.teamId}if(!t)throw new Hzr.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let o=(0,nG.loadToken)(t);if(!o||(0,nG.isExpired)((0,nG.getTokenPayload)(o.token),e?.expirationBufferMs)){let s=await(0,nG.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});if(o=await(0,nG.getVercelOidcToken)(s,t,n),!o)throw new Hzr.VercelOidcTokenError("Failed to refresh OIDC token");(0,nG.saveToken)(o,t)}process.env.VERCEL_OIDC_TOKEN=o.token}r(Y2s,"refreshToken")});var Xzr=At((_sl,Yzr)=>{"use strict";var ucn=Object.defineProperty,X2s=Object.getOwnPropertyDescriptor,Q2s=Object.getOwnPropertyNames,eDs=Object.prototype.hasOwnProperty,tDs=r((e,t)=>{for(var n in t)ucn(e,n,{get:t[n],enumerable:!0})},"__export"),nDs=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Q2s(t))!eDs.call(e,s)&&s!==n&&ucn(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=X2s(t,s))||o.enumerable});return e},"__copyProps"),rDs=r(e=>nDs(ucn({},"__esModule",{value:!0}),e),"__toCommonJS"),Zzr={};tDs(Zzr,{getVercelOidcToken:r(()=>sDs,"getVercelOidcToken"),getVercelOidcTokenSync:r(()=>lcn,"getVercelOidcTokenSync")});Yzr.exports=rDs(Zzr);var oDs=Kan(),iDs=PDe();async function sDs(e){let t="",n;try{t=lcn()}catch(o){n=o}try{let[{getTokenPayload:o,isExpired:s},{refreshToken:a}]=await Promise.all([await Promise.resolve().then(()=>Ci(ODe())),await Promise.resolve().then(()=>Ci(Kzr()))]);(!t||s(o(t),e?.expirationBufferMs))&&(await a(e),t=lcn())}catch(o){let s=n instanceof Error?n.message:"";throw o instanceof Error&&(s=`${s}
|
|
2075
2075
|
${o.message}`),s?new iDs.VercelOidcTokenError(s):o}return t}r(sDs,"getVercelOidcToken");function lcn(){let e=(0,oDs.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return e}r(lcn,"getVercelOidcTokenSync")});var pcn=At((vsl,n7r)=>{"use strict";var dcn=Object.defineProperty,aDs=Object.getOwnPropertyDescriptor,cDs=Object.getOwnPropertyNames,lDs=Object.prototype.hasOwnProperty,uDs=r((e,t)=>{for(var n in t)dcn(e,n,{get:t[n],enumerable:!0})},"__export"),dDs=r((e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of cDs(t))!lDs.call(e,s)&&s!==n&&dcn(e,s,{get:r(()=>t[s],"get"),enumerable:!(o=aDs(t,s))||o.enumerable});return e},"__copyProps"),pDs=r(e=>dDs(dcn({},"__esModule",{value:!0}),e),"__toCommonJS"),t7r={};uDs(t7r,{AccessTokenMissingError:r(()=>e7r.AccessTokenMissingError,"AccessTokenMissingError"),RefreshAccessTokenFailedError:r(()=>e7r.RefreshAccessTokenFailedError,"RefreshAccessTokenFailedError"),getContext:r(()=>fDs.getContext,"getContext"),getVercelOidcToken:r(()=>Qzr.getVercelOidcToken,"getVercelOidcToken"),getVercelOidcTokenSync:r(()=>Qzr.getVercelOidcTokenSync,"getVercelOidcTokenSync"),getVercelToken:r(()=>mDs.getVercelToken,"getVercelToken")});n7r.exports=pDs(t7r);var Qzr=Xzr(),fDs=Kan(),e7r=scn(),mDs=ODe()});async function x7r({response:e,statusCode:t,defaultMessage:n="Gateway request failed",cause:o,authMethod:s}){var a;let l=await x1({value:e,schema:CDs});if(!l.success){let b=typeof e=="object"&&e!==null&&"generationId"in e?e.generationId:void 0;return new IDs({message:`Invalid error response format: ${n}`,statusCode:t,response:e,validationError:l.error,cause:o,generationId:b})}let u=l.value,f=u.error.type,g=u.error.message,_=(a=u.generationId)!=null?a:void 0;switch(f){case"authentication_error":return Git.createContextualError({apiKeyProvided:s==="api-key",oidcTokenProvided:s==="oidc",statusCode:t,cause:o,generationId:_});case"invalid_request_error":return new yDs({message:g,statusCode:t,cause:o,generationId:_});case"rate_limit_exceeded":return new bDs({message:g,statusCode:t,cause:o,generationId:_});case"model_not_found":{let b=await x1({value:u.error.param,schema:wDs});return new kDs({message:g,statusCode:t,modelId:b.success?b.value.modelId:void 0,cause:o,generationId:_})}case"internal_server_error":return new b7r({message:g,statusCode:t,cause:o,generationId:_});default:return new b7r({message:g,statusCode:t,cause:o,generationId:_})}}function EDs(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return JSON.parse(e.responseBody)}catch{return e.responseBody}return{}}function A7r(e){if(!(e instanceof Error))return!1;let t=e.code;return typeof t=="string"?["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(t):!1}async function RA(e,t){var n;return eT.isInstance(e)?e:A7r(e)?E7r.createTimeoutError({originalMessage:e instanceof Error?e.message:"Unknown error",cause:e}):Nd.isInstance(e)?e.cause&&A7r(e.cause)?E7r.createTimeoutError({originalMessage:e.message,cause:e}):await x7r({response:EDs(e),statusCode:(n=e.statusCode)!=null?n:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):await x7r({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}async function Z3(e){let t=await x1({value:e[$7r],schema:PDs});return t.success?t.value:void 0}function R7r(e){return e.type==="file"&&e.data instanceof Uint8Array?{...e,data:q3(e.data)}:e}function GDs(e){return e.type==="file"&&e.data instanceof Uint8Array?{...e,data:q3(e.data)}:e}async function lOs(){var e;return(e=(0,q7r.getContext)().headers)==null?void 0:e["x-vercel-id"]}function pOs(e={}){var t,n;let o=null,s=null,a=(t=e.metadataCacheRefreshMillis)!=null?t:1e3*60*5,l=0,u=(n=g0e(e.baseURL))!=null?n:"https://ai-gateway.vercel.sh/v3/ai",f=r(async()=>{try{let U=await fOs(e);return _2({Authorization:`Bearer ${U.token}`,"ai-gateway-protocol-version":dOs,[$7r]:U.authMethod,...e.headers},`ai-sdk/gateway/${uOs}`)}catch(U){throw Git.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:U})}},"getHeaders"),g=r(()=>{let U=V3({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),B=V3({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),z=V3({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),$=V3({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let J=await lOs();return{...U&&{"ai-o11y-deployment-id":U},...B&&{"ai-o11y-environment":B},...z&&{"ai-o11y-region":z},...J&&{"ai-o11y-request-id":J},...$&&{"ai-o11y-project-id":$}}}},"createO11yHeaders"),_=r(U=>new jDs(U,{provider:"gateway",baseURL:u,headers:f,fetch:e.fetch,o11yHeaders:g()}),"createLanguageModel"),b=r(async()=>{var U,B,z;let $=(z=(B=(U=e._internal)==null?void 0:U.currentDate)==null?void 0:B.call(U).getTime())!=null?z:Date.now();return(!o||$-l>a)&&(l=$,o=new P7r({baseURL:u,headers:f,fetch:e.fetch}).getAvailableModels().then(J=>(s=J,J)).catch(async J=>{throw await RA(J,await Z3(await f()))})),s?Promise.resolve(s):o},"getAvailableModels"),w=r(async()=>new P7r({baseURL:u,headers:f,fetch:e.fetch}).getCredits().catch(async U=>{throw await RA(U,await Z3(await f()))}),"getCredits"),T=r(async U=>new MDs({baseURL:u,headers:f,fetch:e.fetch}).getSpendReport(U).catch(async B=>{throw await RA(B,await Z3(await f()))}),"getSpendReport"),I=r(async U=>new LDs({baseURL:u,headers:f,fetch:e.fetch}).getGenerationInfo(U).catch(async B=>{throw await RA(B,await Z3(await f()))}),"getGenerationInfo"),E=r(function(U){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return _(U)},"provider");E.specificationVersion="v3",E.getAvailableModels=b,E.getCredits=w,E.getSpendReport=T,E.getGenerationInfo=I,E.imageModel=U=>new zDs(U,{provider:"gateway",baseURL:u,headers:f,fetch:e.fetch,o11yHeaders:g()}),E.languageModel=_;let R=r(U=>new BDs(U,{provider:"gateway",baseURL:u,headers:f,fetch:e.fetch,o11yHeaders:g()}),"createEmbeddingModel");E.embeddingModel=R,E.textEmbeddingModel=R,E.videoModel=U=>new HDs(U,{provider:"gateway",baseURL:u,headers:f,fetch:e.fetch,o11yHeaders:g()});let L=r(U=>new XDs(U,{provider:"gateway",baseURL:u,headers:f,fetch:e.fetch,o11yHeaders:g()}),"createRerankingModel");return E.rerankingModel=L,E.reranking=L,E.chat=E.languageModel,E.embedding=E.embeddingModel,E.image=E.imageModel,E.video=E.videoModel,E.tools=cOs,E}async function fOs(e){let t=V3({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});return t?{token:t,authMethod:"api-key"}:{token:await(0,W7r.getVercelOidcToken)(),authMethod:"oidc"}}var q7r,W7r,hDs,fcn,r7r,o7r,eT,O7r,gDs,i7r,s7r,a7r,Git,N7r,_Ds,c7r,l7r,u7r,yDs,L7r,vDs,d7r,p7r,f7r,bDs,F7r,SDs,m7r,wDs,h7r,g7r,kDs,j7r,xDs,_7r,y7r,v7r,b7r,B7r,TDs,S7r,w7r,k7r,IDs,CDs,U7r,ADs,T7r,I7r,C7r,E7r,$7r,PDs,RDs,P7r,DDs,ODs,MDs,NDs,LDs,FDs,jDs,BDs,UDs,zDs,$Ds,qDs,WDs,VDs,HDs,JDs,KDs,ZDs,YDs,XDs,QDs,eOs,tOs,nOs,rOs,oOs,iOs,sOs,aOs,cOs,uOs,dOs,V7r,Jit=Y(()=>{sa();bd();tc();tc();sa();sa();tc();sa();sa();tc();sa();tc();sa();tc();sa();tc();sa();tc();sa();tc();bd();sa();tc();sa();tc();sa();Fa();sa();Fa();q7r=Ci(pcn(),1),W7r=Ci(pcn(),1),hDs="vercel.ai.gateway.error",fcn=Symbol.for(hDs),eT=class D7r extends(o7r=Error,r7r=fcn,o7r){static{r(this,"_GatewayError")}constructor({message:t,statusCode:n=500,cause:o,generationId:s,isRetryable:a=n!=null&&(n===408||n===409||n===429||n>=500)}){super(s?`${t} [${s}]`:t),this[r7r]=!0,this.statusCode=n,this.cause=o,this.generationId=s,this.isRetryable=a}static isInstance(t){return D7r.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&fcn in t&&t[fcn]===!0}},O7r="GatewayAuthenticationError",gDs=`vercel.ai.gateway.error.${O7r}`,i7r=Symbol.for(gDs),Git=class M7r extends(a7r=eT,s7r=i7r,a7r){static{r(this,"_GatewayAuthenticationError")}constructor({message:t="Authentication failed",statusCode:n=401,cause:o,generationId:s}={}){super({message:t,statusCode:n,cause:o,generationId:s}),this[s7r]=!0,this.name=O7r,this.type="authentication_error"}static isInstance(t){return eT.hasMarker(t)&&i7r in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:o="Authentication failed",statusCode:s=401,cause:a,generationId:l}){let u;return t?u=`AI Gateway authentication failed: Invalid API key.
|
|
2076
2076
|
|
|
@@ -15414,8 +15414,8 @@ Commands:
|
|
|
15414
15414
|
marketplace remove <name> Remove a configured marketplace
|
|
15415
15415
|
marketplace update [name] Refresh one marketplace, or all when omitted
|
|
15416
15416
|
|
|
15417
|
-
Scopes: user (default), project. \`zcode plugin\` is an alias of \`zcode plugins\`.`;r(Zei,"runPluginsCommand");r(nrc,"runPluginsListCommand");r(rrc,"runPluginsInstallCommand");r(orc,"runPluginsUpdateCommand");r(irc,"reportInstallOutcome");r(Yei,"runPluginsSetCommand");r(src,"runPluginsDisableCommand");r(arc,"runPluginsUninstallCommand");r(crc,"runPluginsValidateCommand")});function urc(e=process.env){let t=e.ZCODE_STORAGE_DIR?.trim()||(0,dse.join)((0,eti.homedir)(),".zcode");return(0,dse.join)(t,"clipboard")}function tti(e={}){let t=e.platform??process.platform,n=e.maxBytes??lrc,o=e.runCommand??mrc,s=e.tempDirectory??urc(e.processEnv);return async(a={})=>t==="darwin"?await drc({maxBytes:n,runCommand:o,signal:a.abortSignal,tempDirectory:s}):t==="linux"?await prc({maxBytes:n,runCommand:o,signal:a.abortSignal}):t==="win32"?await frc({maxBytes:n,runCommand:o,signal:a.abortSignal,tempDirectory:s}):null}async function drc(e){await(0,M4.mkdir)(e.tempDirectory,{recursive:!0});let t=await(0,M4.mkdtemp)((0,dse.join)(e.tempDirectory,"zcode-clipboard-")),n=(0,dse.join)(t,"clipboard.png");try{return(await e.runCommand("osascript",["-e","set png_data to (the clipboard as \xABclass PNGf\xBB)","-e",`set fp to open for access POSIX file ${hrc(n)} with write permission`,"-e","write png_data to fp","-e","close access fp"],{maxBytes:e.maxBytes,signal:e.signal})).exitCode!==0?null:await nti(n,"image/png",e.maxBytes)}finally{await(0,M4.rm)(t,{force:!0,recursive:!0})}}async function prc(e){let t=[{args:["--type","image/png"],file:"wl-paste",mediaType:"image/png"},{args:["--type","image/jpeg"],file:"wl-paste",mediaType:"image/jpeg"},{args:["--type","image/gif"],file:"wl-paste",mediaType:"image/gif"},{args:["--type","image/webp"],file:"wl-paste",mediaType:"image/webp"},{args:["-selection","clipboard","-t","image/png","-o"],file:"xclip",mediaType:"image/png"},{args:["-selection","clipboard","-t","image/jpeg","-o"],file:"xclip",mediaType:"image/jpeg"},{args:["-selection","clipboard","-t","image/gif","-o"],file:"xclip",mediaType:"image/gif"},{args:["-selection","clipboard","-t","image/webp","-o"],file:"xclip",mediaType:"image/webp"}];for(let n of t){let o=await e.runCommand(n.file,n.args,{maxBytes:e.maxBytes,signal:e.signal}),s=rti(o.stdout,n.mediaType,e.maxBytes);if(o.exitCode===0&&s)return s}return null}async function frc(e){await(0,M4.mkdir)(e.tempDirectory,{recursive:!0});let t=await(0,M4.mkdtemp)((0,dse.join)(e.tempDirectory,"zcode-clipboard-")),n=(0,dse.join)(t,"clipboard.png"),o=["Add-Type -AssemblyName System.Windows.Forms;","$img = Get-Clipboard -Format Image;","if ($null -eq $img) { exit 2 }",`$img.Save(${grc(n)}, [System.Drawing.Imaging.ImageFormat]::Png);`].join(" ");try{return(await e.runCommand("powershell.exe",["-NoProfile","-NonInteractive","-Command",o],{maxBytes:e.maxBytes,signal:e.signal})).exitCode!==0?null:await nti(n,"image/png",e.maxBytes)}finally{await(0,M4.rm)(t,{force:!0,recursive:!0})}}async function nti(e,t,n){let o=await(0,M4.readFile)(e);return rti(o,t,n)}function rti(e,t,n){return e.byteLength===0||e.byteLength>n?null:{dataUrl:`data:${t};base64,${e.toString("base64")}`,mediaType:t,sizeBytes:e.byteLength}}async function mrc(e,t,n){return await new Promise(o=>{let s;try{s=(0,Qei.spawn)(e,t,{signal:n.signal,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{o({exitCode:-1,stdout:Buffer.alloc(0)});return}let a=[],l=0,u=!1,f=r(g=>{u||(u=!0,o(g))},"finish");s.stdout?.on("data",g=>{if(l+=g.byteLength,l>n.maxBytes){s.kill();return}a.push(g)}),s.on("error",()=>f({exitCode:-1,stdout:Buffer.alloc(0)})),s.on("close",(g,_)=>{f({exitCode:g,signal:_,stdout:Buffer.concat(a)})})})}function hrc(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function grc(e){return`'${e.replace(/'/g,"''")}'`}var Qei,M4,eti,dse,lrc,oti=Y(()=>{"use strict";Qei=require("node:child_process"),M4=require("node:fs/promises"),eti=require("node:os"),dse=require("node:path"),lrc=20*1024*1024;r(urc,"resolveDefaultClipboardDirectory");r(tti,"createNodeClipboardImageReader");r(drc,"readMacClipboardImage");r(prc,"readLinuxClipboardImage");r(frc,"readWindowsClipboardImage");r(nti,"readImageFile");r(rti,"bufferToClipboardImage");r(mrc,"runCommandBuffer");r(hrc,"appleScriptString");r(grc,"powershellString")});function sti(e={}){let t=e.maxBytes??_rc,n=e.platform??process.platform,o=e.runCommand??Irc;return async s=>{let a=Trc(s,t);if(a.byteLength===0)return;let l=wrc(e.stdout,a),u=await krc({input:s,platform:n,runCommand:o});if(!l&&!u)throw new Error("No text clipboard target accepted the selected text.")}}function wrc(e,t){if(!e)return!1;try{return e.write(`${vrc}${yrc};${t.toString("base64")}${brc}`),!0}catch{return!1}}async function krc(e){for(let t of xrc(e.platform))if((await e.runCommand(t.file,t.args,{input:e.input})).exitCode===0)return!0;return!1}function xrc(e){return e==="darwin"?[{args:[],file:"pbcopy"}]:e==="linux"?[{args:[],file:"wl-copy"},{args:["-selection","clipboard"],file:"xclip"},{args:["--clipboard","--input"],file:"xsel"}]:e==="win32"?[{args:["-NoProfile","-NonInteractive","-Command",Src],file:"powershell.exe"}]:[]}function Trc(e,t){let n=Buffer.from(e,"utf8");if(n.byteLength>t)throw new Error(`Clipboard text exceeds ${t} bytes.`);return n}async function Irc(e,t,n){return await new Promise(o=>{let s;try{s=(0,iti.spawn)(e,t,{stdio:["pipe","ignore","ignore"],windowsHide:!0})}catch{o({exitCode:-1});return}let a=!1,l=r(u=>{a||(a=!0,o(u))},"finish");s.stdin?.on("error",()=>{}),s.stdin?.end(n.input),s.on("error",()=>l({exitCode:-1})),s.on("close",(u,f)=>l({exitCode:u,signal:f}))})}var iti,_rc,yrc,vrc,brc,Src,ati=Y(()=>{"use strict";iti=require("node:child_process"),_rc=1024*1024,yrc="c",vrc="\x1B]52;",brc="\x07",Src="Set-Clipboard -Value ([Console]::In.ReadToEnd())";r(sti,"createNodeClipboardTextWriter");r(wrc,"writeOsc52");r(krc,"writeNativeClipboardText");r(xrc,"nativeClipboardCommands");r(Trc,"assertClipboardTextSize");r(Irc,"runCommandText")});async function BTt(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return e.listCustomCommands?await e.listCustomCommands({env:t,logger:e.logger,workingDirectory:n}):await(await Qg()).listZCodeCustomCommands({env:t,logger:e.logger,workingDirectory:n})}async function cti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)();return e.loadCustomCommand?await e.loadCustomCommand({env:n,logger:e.logger,name:t,workingDirectory:o}):await(await Qg()).loadZCodeCustomCommand({env:n,logger:e.logger,name:t,workingDirectory:o})}async function lti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return await(e.listSkills??(await Qg()).listZCodeSkills)({env:t,logger:e.logger,workingDirectory:n})}async function uti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return(await(e.listSessions??(await Qg()).listZCodeSessions)({directory:n,env:t,limit:50})).map(a=>({directory:a.directory,id:a.id,parentId:a.parentID,title:a.title,updatedAt:a.time.updated}))}async function dti(e){try{return await e.getSessionMetadata?.()??{}}catch(t){if(Crc(t))throw t;return{}}}function Crc(e){return e instanceof Error?e.name==="SqliteSessionMigrationError":!1}var j2n=Y(()=>{"use strict";b9();r(BTt,"listCustomCommandsForTui");r(cti,"loadCustomCommandForTui");r(lti,"listSkillsForTui");r(uti,"listSessionsForTui");r(dti,"loadInitialTuiSessionMetadata");r(Crc,"isStartupGateError")});function pti(e){let t=new Set,n,o=r(()=>{n?.(),n=void 0},"detach"),s=r(()=>{if(o(),t.size===0)return;n=e.readSubscriber(e.currentRuntime())?.({onSessionEvent:r(l=>{for(let u of t)u(l)},"onSessionEvent")})},"reattach");return{addSink:r(a=>(t.add(a),t.size===1&&s(),()=>{t.delete(a),t.size===0&&o()}),"addSink"),reattach:s,detach:o,isAttached:r(()=>n!==void 0,"isAttached")}}var fti=Y(()=>{"use strict";r(pti,"createTuiSessionEventRelay")});var mti,hti=Y(()=>{"use strict";TTt();mti=r((e,t)=>{const $zTuiBridge=e,$zTuiGetApp=t;$zTuiBridge.loadSessionTranscript=async()=>await(await $zTuiGetApp()).loadSessionTranscript?.()??[],$zTuiBridge.loadSessionContextMessages=async()=>await(await $zTuiGetApp()).loadSessionContextMessages?.()??[],$zTuiBridge.readGoal=async()=>await(await $zTuiGetApp()).readTarget?.()??null,$zTuiBridge.readTodos=async()=>await(await $zTuiGetApp()).readTodos?.()??[],$zTuiBridge.readRuntimeProjection=async()=>{let $zRuntimeProjectionBridge=await $zTuiGetApp();let $zExecutionState=await $zRuntimeProjectionBridge.readExecutionState();await $zTuiBridge.$zRestorePersistedBackgroundTasks?.($zRuntimeProjectionBridge);let t=await $zRuntimeProjectionBridge.runtime?.getProjection?.();if(!t)return null;let r=Object.values($zRuntimeProjectionBridge.runtime?.runtimeTaskRegistry?.all?.()??{}).filter(o=>o.isBackgrounded===!0).map(o=>({taskId:o.taskId,taskKind:o.taskType??o.type,agentId:o.agentId,agentType:o.agentType,childSessionId:o.childSessionId,parentSessionId:o.parentSessionId,parentToolCallId:o.parentToolCallId,turnId:o.turnId,prompt:o.prompt,error:o.status==="running"?null:o.error instanceof Error?o.error.message:typeof o.error==="string"?o.error:void 0,outputPath:o.outputFile,status:o.status,description:o.description,startedAt:o.startedAt,completedAt:o.status==="running"?null:o.completedAt,cancelRequestedAt:o.status==="running"?null:o.cancelRequestedAt,blocked:o.status==="running"?null:o.blocked,blockedReason:o.status==="running"?null:o.blockedReason,cancellable:(o.taskType??o.type)==="local_agent"?o.status==="running":o.cancellable}));let s=Array.isArray(t.backgroundTasks)?t.backgroundTasks.slice():[];for(let $zDetail of r){let $zIndex=s.findIndex($zExisting=>$zExisting.taskId===$zDetail.taskId);if($zIndex<0)s.push($zDetail);else s[$zIndex]={...s[$zIndex],...Object.fromEntries(Object.entries($zDetail).filter(([,v])=>v!==void 0))}}return{...t,...$zExecutionState,backgroundTasks:s,backgroundTaskDetails:r,restoredBackgroundTasks:Array.isArray($zRuntimeProjectionBridge.$zRestoredBackgroundTasksLog)?$zRuntimeProjectionBridge.$zRestoredBackgroundTasksLog:[]}},$zTuiBridge.$zRestorePersistedBackgroundTasks=async $zApp=>{let $zRuntime=$zApp?.runtime,$zRegistry=$zRuntime?.runtimeTaskRegistry;if(!$zRegistry?.register||typeof $zApp?.sessionId!="string"||$zApp.sessionId===$zApp.$zRestoredBackgroundTasksSession)return;$zApp.$zRestoredBackgroundTasksSession=$zApp.sessionId,$zApp.$zRestoredBackgroundTasksLog=[];try{let $zMessages=await $zApp.loadSessionTranscript?.()??[],$zRestored=[];for(let $zMessage of $zMessages){let $zParts=Array.isArray($zMessage?.parts)?$zMessage.parts:[];for(let $zPart of $zParts){if($zPart?.type!=="tool")continue;let $zToolName=typeof $zPart.toolName==="string"?$zPart.toolName:typeof $zPart.tool==="string"?$zPart.tool:"";$zToolName=$zToolName.trim().toLowerCase();if($zToolName!=="agent"&&$zToolName!=="subagent"&&$zToolName!=="task")continue;let $zInput=$zPart.input??$zPart.state?.input,$zOutput=typeof $zPart.output==="string"?$zPart.output:$zPart.state?.output;if(typeof $zOutput!=="string"||$zOutput.trim().length===0)continue;let $zSpawn;try{$zSpawn=JSON.parse($zOutput)}catch{}if(!$zSpawn||typeof $zSpawn!=="object"||Array.isArray($zSpawn)){if(!$zOutput.includes("Async agent launched successfully."))continue;let $zAgentId=/(?:^|\n)agentId:\s*([^\s(]+)/u.exec($zOutput)?.[1],$zOutputFile=/(?:^|\n)output_file:\s*([^\r\n]+)/u.exec($zOutput)?.[1]?.trim();if(typeof $zAgentId!=="string"||$zAgentId.length===0)continue;$zSpawn={status:"async_launched",agentId:$zAgentId,agentType:typeof $zInput?.subagent_type==="string"&&$zInput.subagent_type.length>0?$zInput.subagent_type:typeof $zInput?.agentType==="string"&&$zInput.agentType.length>0?$zInput.agentType:void 0,childSessionId:"sess_subagent_"+$zAgentId,description:typeof $zInput?.description==="string"&&$zInput.description.length>0?$zInput.description:void 0,prompt:typeof $zInput?.prompt==="string"&&$zInput.prompt.length>0?$zInput.prompt:void 0,...$zOutputFile?{outputFile:$zOutputFile}:{}}}if(($zSpawn.status!=="async_launched"&&$zSpawn.status!=="backgrounded")||typeof $zSpawn.agentId!=="string"||$zSpawn.agentId.length===0)continue;let $zMetadata;if(typeof $zSpawn.outputFile==="string"&&$zSpawn.outputFile.length>0)try{let $zBuiltin=process.getBuiltinModule;if(typeof $zBuiltin==="function"){let $zFs=$zBuiltin.call(process,"node:fs"),$zPath=$zBuiltin.call(process,"node:path");$zMetadata=JSON.parse($zFs.readFileSync($zPath.join($zPath.dirname($zSpawn.outputFile),"metadata.json"),"utf8"))}}catch{}if($zMetadata&&typeof $zMetadata==="object"&&!Array.isArray($zMetadata)&&(typeof $zMetadata.agentId!=="string"||$zMetadata.agentId===$zSpawn.agentId)&&(typeof $zMetadata.parentSessionId!=="string"||$zMetadata.parentSessionId===$zApp.sessionId))$zSpawn={...$zSpawn,agentType:typeof $zMetadata.profileId==="string"&&$zMetadata.profileId.length>0?$zMetadata.profileId:$zSpawn.agentType,childSessionId:typeof $zMetadata.childSessionId==="string"&&$zMetadata.childSessionId.length>0?$zMetadata.childSessionId:$zSpawn.childSessionId,description:typeof $zMetadata.description==="string"&&$zMetadata.description.length>0?$zMetadata.description:$zSpawn.description,outputFile:typeof $zMetadata.outputFile==="string"&&$zMetadata.outputFile.length>0?$zMetadata.outputFile:$zSpawn.outputFile,prompt:typeof $zMetadata.prompt==="string"&&$zMetadata.prompt.length>0?$zMetadata.prompt:$zSpawn.prompt,error:typeof $zMetadata.error==="string"&&$zMetadata.error.length>0?$zMetadata.error:$zSpawn.error};if(typeof $zSpawn.childSessionId!=="string"||$zSpawn.childSessionId.length===0)$zSpawn.childSessionId="sess_subagent_"+$zSpawn.agentId;if($zRegistry.get?.($zSpawn.agentId))continue;let $zStatus="stopped";if($zMetadata?.status==="completed")$zStatus="completed";else if($zMetadata?.status==="failed")$zStatus="failed";let $zTask={taskId:$zSpawn.agentId,agentId:$zSpawn.agentId,agentType:typeof $zSpawn.agentType==="string"&&$zSpawn.agentType.length>0?$zSpawn.agentType:"general-purpose",childSessionId:$zSpawn.childSessionId,description:typeof $zSpawn.description==="string"&&$zSpawn.description.length>0?$zSpawn.description:void 0,error:typeof $zSpawn.error==="string"&&$zSpawn.error.length>0?$zSpawn.error:void 0,isBackgrounded:!0,outputFile:typeof $zSpawn.outputFile==="string"&&$zSpawn.outputFile.length>0?$zSpawn.outputFile:void 0,parentToolCallId:typeof $zPart.toolCallId==="string"&&$zPart.toolCallId.length>0?$zPart.toolCallId:typeof $zPart.callID==="string"&&$zPart.callID.length>0?$zPart.callID:void 0,parentSessionId:$zApp.sessionId,prompt:typeof $zSpawn.prompt==="string"&&$zSpawn.prompt.length>0?$zSpawn.prompt:void 0,startedAt:$zPart.state?.time?.start,status:$zStatus,taskType:"local_agent",type:"local_agent"};$zRegistry.register($zTask),$zRestored.push($zTask)}}if($zRestored.length>0){let $zTaskIds=$zRestored.slice(-32).map($zTask=>"- "+$zTask.taskId+" ("+$zTask.status+")").join("\n").slice(0,4e3);$zRuntime?.messageHistory?.addAttachment?.("task_status","Background agent tasks from this resumed session have been restored and are available again.\nEarlier TaskOutput errors saying \"No task found\" occurred before restoration and are stale.\nUse TaskOutput to collect results or SendMessage to continue a task. Do not assume these tasks were lost.\nRestored task IDs:\n"+$zTaskIds),$zApp.$zRestoredBackgroundTasksLog=[...($zApp.$zRestoredBackgroundTasksLog??[]),...$zRestored].slice(-64)}}catch{$zApp.$zRestoredBackgroundTasksSession=void 0}},$zTuiBridge.readSessionUsage=async()=>await(await $zTuiGetApp()).readSessionUsage?.()??null,$zTuiBridge.cancelBackgroundTask=async e=>await(await $zTuiGetApp()).cancelBackgroundTask?.(e)??null,$zTuiBridge.previewFileRewind=async e=>{let t=await $zTuiGetApp();return await t.runtime?.previewWorkspaceFileRewind?.({targetMessageIds:e})??null},$zTuiBridge.applyFileRewind=async e=>{let t=await $zTuiGetApp();return await t.runtime?.applyWorkspaceFileRewind?.({targetMessageIds:e})??null},$zTuiBridge.setCustomSessionTitle=async e=>{let t=await $zTuiGetApp();let r=t.runtime?.setCustomSessionTitle?.bind(t.runtime)??t.setCustomSessionTitle?.bind(t);if(!r)throw new Error("Session renaming is unavailable in this runtime.");return await r({title:e.title,traceContext:e.traceContext??t.runtime?.rootTraceContext})},$zTuiBridge.readCustomSessionTitle=async()=>{let t=await $zTuiGetApp(),o=t.sessionStore??t.runtime?.sessionStore,r=await o?.getSession?.(t.sessionId);return r?.titleSource==="custom"&&typeof r.title==="string"?r.title:void 0},$zTuiBridge.setMode=async e=>{return await(await $zTuiGetApp()).setMode(e)},$zTuiBridge.readExecutionState=async()=>await(await $zTuiGetApp()).readExecutionState(),$zTuiBridge.setPlanEnabled=async e=>await(await $zTuiGetApp()).setPlanEnabled(e),$zTuiBridge.setTransientModel=async e=>{if(e==="main"){e=await $zTuiBridge.readDefaultModel();if(!e)throw new Error("No default model is configured.")}let t=await $zTuiGetApp(),r=await t.setModel(e);return{...r,thoughtLevel:t.getThoughtLevel(),effortOptions:t.listThoughtLevels()}},$zTuiBridge.readSessionModel=async()=>{let $zSessionModelApp=await $zTuiGetApp(),s=await $zSessionModelApp.readSessionModelState();if(s?.selection&&!s.issue)await $zSessionModelApp.setModel(s.selection,{transient:!0});return s},$zTuiBridge.sendBackgroundTaskMessage=async e=>{let t=await $zTuiGetApp();await $zTuiBridge.$zRestorePersistedBackgroundTasks?.(t);let r=t.runtime,o=r?.runtimeTaskRegistry?.get?.(e?.taskId);if(!o&&typeof t.sessionId==="string"){t.$zRestoredBackgroundTasksSession=void 0;await $zTuiBridge.$zRestorePersistedBackgroundTasks?.(t);o=r?.runtimeTaskRegistry?.get?.(e?.taskId)}if(!r?.subagentPort?.sendMessage)throw new Error("Background agent messaging is unavailable in this runtime.");if(!o||(o.type??o.taskType)!=="local_agent")throw new Error("The selected task is not a local agent.");if(typeof e?.message!=="string"||!e.message.trim())throw new Error("Enter a message for the background agent.");let n=e.message.trim().slice(0,2e4),i=(typeof e.summary==="string"?e.summary:n).replace(/\s+/g," ").trim().slice(0,200);if(e?.restart===!0&&o.status==="running"){if(!r.subagentPort.stopTask)throw new Error("Background agent restart is unavailable in this runtime.");await r.subagentPort.stopTask(e.taskId),o=r.runtimeTaskRegistry?.get?.(e.taskId);if(!o)throw new Error("The background agent stopped but could not be restored.")}return await r.subagentPort.sendMessage({sessionId:o.parentSessionId??r.getSessionId?.(),turnId:o.turnId??"tui-task-message",parentToolCallId:o.parentToolCallId??"tui-task-message",to:o.agentId??e.taskId,summary:i,message:n,workingDirectory:o.workingDirectory??r.workingDirectory,workspaceRoot:o.workspaceRoot??r.workingDirectory,trace:o.traceContext??r.rootTraceContext})},$zTuiBridge.interruptTurn=async e=>{let t=await $zTuiGetApp(),r=e?.reservationId??"tui-steer-interrupt",o=(Array.isArray(e?.pendingInputIds)?e.pendingInputIds:[]).filter(Boolean),n=[],i=async()=>{for(let a of n)await t.releaseQueueItemReservation?.(a,r);n=[]};try{if(t.reserveQueueItem&&t.releaseQueueItemReservation)for(let a of o)if(await t.reserveQueueItem(a,r))n.push(a);else{await i();break}let a=t.runtime?.stopActiveForegroundExecution?.({preserveQueueAutoDrainOnCancel:o.length>0&&n.length===o.length,reason:e?.reason??"TUI steer interrupt"})??{kind:"unsupported"};if(a.kind==="stopped"&&e?.waitForIdle===!0&&t.runtime?.getActiveForegroundExecutionId){let u=Date.now()+5e3;for(;t.runtime.getActiveForegroundExecutionId()!==void 0;){if(Date.now()>=u)throw new Error("Timed out waiting for background result processing to stop.");await new Promise(l=>setTimeout(l,25))}}return a.kind!=="stopped"&&await i(),a}catch(a){await i();throw a}},$zTuiBridge.promoteQueuedInput=async(e,t,r)=>{let o=await $zTuiGetApp(),n=r?.pendingInputReservationId??r?.queryId??r?.inputId??"tui-promotion",i=(Array.isArray(t)?t:[t]).filter(Boolean);if(i.length===0||!o.reserveQueueItem||!o.markQueueItemPromoting||!o.releaseQueueItemReservation||!o.removeQueueItem)return $zTuiBridge.sendInput(e,{...r,delivery:"start_turn"});let a=[],u=!1;try{for(let l of i){if(await o.markQueueItemPromoting(l,n)){a.push(l);continue}if(!await o.reserveQueueItem(l,n))throw new Error("TUI queued input is already reserved: "+l);a.push(l);if(!await o.markQueueItemPromoting(l,n))throw new Error("TUI queued input promotion failed: "+l)}let c=await $zTuiBridge.sendInput(e,{...r,delivery:"start_turn"});if(c?.kind==="rejected")return c;u=!0;for(let l of a)if(!await o.removeQueueItem(l,{reason:"promoted",reservationId:n}))throw new Error("TUI queued input promotion commit failed: "+l);return c}finally{if(!u)for(let l of a)await o.releaseQueueItemReservation(l,n)}},$zTuiBridge.$zSendInputWithoutBackgroundRestore=$zTuiBridge.sendInput,$zTuiBridge.sendInput=async(...$zArgs)=>{let $zApp=await $zTuiGetApp();await $zTuiBridge.$zRestorePersistedBackgroundTasks?.($zApp);return await $zTuiBridge.$zSendInputWithoutBackgroundRestore.apply($zTuiBridge,$zArgs)},e.recallPreviousInput=async n=>await(await t()).recallPreviousInputHistory?.(n)??null,e.getSessionMetadata=async()=>{let n=await t();return{locale:n.getLocale?.(),model:n.getModel?.(),theme:n.getTheme?.(),thoughtLevel:n.getThoughtLevel?.()}},e.reloadModelOptions=async()=>await(await t()).reloadModels(),e.readDefaultModel=async()=>{await t();let $zSelection=await(await e.$zReadProviderRegistryRuntime()).modelSelectionConfigRepository.read();return $zSelection?$zSelection.providerId+"/"+$zSelection.modelId:void 0},e.setDefaultModel=async $zModel=>{let $zApp=await t(),$zIndex=$zModel.indexOf("/"),$zSelection={providerId:$zModel.slice(0,$zIndex),modelId:$zModel.slice($zIndex+1)};if($zIndex<=0||!$zApp.getModelOption($zSelection))throw new Error("Unknown default model: "+$zModel);await(await e.$zReadProviderRegistryRuntime()).modelSelectionConfigRepository.saveConfiguredDefault($zSelection);return await e.setTransientModel($zModel)},e.listModelOptions=async()=>(await t()).listModels?.()??[],e.listEffortOptions=async()=>{let n=await t();return await j3e(n)??[]},e.listMcpServers=async()=>(await t()).listMcpServers?.()??{},e.listWorkflowRuns=async()=>await(await t()).listDynamicWorkflowRuns?.({})??[],e.replayWorkflowRuns=async n=>await(await t()).replayDynamicWorkflowRuns?.(n)??[]},"attachTuiAppQueries")});async function _ti(e,t,n,o){let s=e.env??process.env,a=(e.cwd??process.cwd)(),l=(e.loadDotenv??rA)({cwd:a,env:s});if(l.error)throw new Error(`Failed to load environment file: ${l.path}`,{cause:l.error});let u=await OTt(n,a,s,e),f=e.createZCodeApp?void 0:await Qg(),g=e.createZCodeApp??f?.createZCodeApp;if(!g)throw new Error("ZCode app factory is unavailable.");let _=e.prepareZCodeTelemetryEnv??f?.prepareZCodeTelemetryEnv;_&&(o.shutdownTelemetry=e.shutdownZCodeTelemetry??f?.shutdownZCodeTelemetry);let b=_?await _(s,{cliVersion:t,productVersion:s.ZCODE_APP_VERSION}):s,w=e.startProcessProviderRegistryRuntime??f?.startProcessProviderRegistryRuntime;if(!w)throw new Error("Provider Registry runtime is unavailable.");o.providerRegistryRuntimePromise??=w(b,e.skipUserConfig?{}:{standalone:{...gPe(),...e.userConfigPath?{legacyCliUserConfigFilePath:e.userConfigPath}:{}}});let T=await o.providerRegistryRuntimePromise,I=T?.modelSelectionConfigRepository?await T.modelSelectionConfigRepository.read():T?.configuredDefaultModelSelection,E=e.createProviderEndpointRoutingPort??f?.createDefaultProviderEndpointRoutingPort;return o.providerEndpointRoutingPort??=E?.({appVersion:t,env:s,projectConfigPath:e.projectConfigPath,skipUserConfig:e.skipUserConfig,userConfigPath:e.userConfigPath,workingDirectory:a}),{appEnv:b,configuredDefaultModelSelection:I,createAppFactory:g,providerRegistryRuntime:T,sessionId:u,workingDirectory:a}}var gti,yti=Y(()=>{"use strict";b9();jQ();NXe();A2n();gti=r(()=>({providerEndpointRoutingPort:void 0,providerRegistryRuntimePromise:void 0,shutdownTelemetry:void 0}),"createTuiProcessRuntimeState");r(_ti,"prepareTuiAppRuntime")});async function vti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)(),s=(e.loadDotenv??rA)({cwd:o,env:n});if(s.error)throw new Error(`Failed to load environment file: ${s.path}`,{cause:s.error});return await(e.loginZCodeCli??(await Qg()).loginZCodeCli)({abortSignal:t?.abortSignal,env:n,onAuthorizeUrl:t?.onAuthorizeUrl})}async function bti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)(),s=(e.loadDotenv??rA)({cwd:o,env:n});if(s.error)throw new Error(`Failed to load environment file: ${s.path}`,{cause:s.error});return await(e.loginBigmodelCodingPlan??(await Qg()).loginBigmodelCodingPlan)({abortSignal:t?.abortSignal,env:n,onAuthorizeUrl:t?.onAuthorizeUrl})}async function Sti(e,t){return await(e.configureCodingPlanApiKey??(await Qg()).configureCodingPlanApiKey)({apiKey:t.apiKey,env:e.env??process.env,providerId:t.providerId})}async function wti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)(),o=(e.loadDotenv??rA)({cwd:n,env:t});if(o.error)throw new Error(`Failed to load environment file: ${o.path}`,{cause:o.error});return await(e.logoutZCodeCli??(await Qg()).logoutZCodeCli)({env:t})}var kti=Y(()=>{"use strict";b9();jQ();r(vti,"loginForTui");r(bti,"loginBigmodelForTui");r(Sti,"configureApiKeyForTui");r(wti,"logoutForTui")});var xti,Tti,XK,B2n=Y(()=>{"use strict";xti={},Tti=r(e=>({current:e,override:e}),"createCliModeState"),XK=r(e=>e.current??e.override??"build","currentCliMode")});function U2n(e,t,n){return{kind:"started_turn",result:{...e,locale:e.locale??t.getLocale?.(),mode:n,model:e.model??t.getModel?.(),theme:e.theme??t.getTheme?.(),thoughtLevel:e.thoughtLevel??t.getThoughtLevel?.()}}}var Iti=Y(()=>{"use strict";r(U2n,"withTuiMetadata")});function Cti(e,t,n,o={continueSession:!1},s,a,l=Myt,u,f=!1,g,_){let b,w=s,T=gti(),I,E=new WeakMap,R=new WeakMap,L,U=Math.max(1,Math.trunc(e.shutdownCleanupTimeoutMs??nGe)),B={requestPermission:r(async(Pe,Tt)=>{let Ye=L;return Ye?await Ye(Pe,Tt):{decision:"deny",reason:`No interactive approval handler configured for ${Pe.toolName}`,resolvedAt:new Date}},"requestPermission")},z=r(async(Pe=b)=>{if(!Pe)return;let Tt=Pe,Ye=E.get(Tt);Ye||(Ye=(async()=>{await FL(async()=>Pe.close?.(),U),await FL(async()=>R.get(Tt)?.close(),U)})(),E.set(Tt,Ye)),await Ye},"closeApp"),$=pti({currentRuntime:r(()=>b?.runtime,"currentRuntime"),readSubscriber:RTt}),J=r(async Pe=>{let Tt=b,Ye=await Pe();return b=Ye,Tt&&Tt!==Ye&&await z(Tt),$.reattach(),t.current=b.getMode?.()??XK(t),b},"replaceApp"),q=r(async Pe=>{if(I)throw new Error("TUI prompt handler is closed");let{appEnv:Tt,configuredDefaultModelSelection:Ye,createAppFactory:Fe,providerRegistryRuntime:St,sessionId:kt,workingDirectory:st}=await _ti(e,n,Pe,T),$e=T.providerEndpointRoutingPort,jt=ATt({browserExecutable:_,browserUse:g},e),Je;try{Je=await Fe({browserControlPort:jt?.browserControlPort,env:Tt,projectConfigPath:e.projectConfigPath,...$e?{providerEndpointRoutingPort:$e}:{},providerRegistry:St.runtime.registryService,configuredDefaultModelSelection:Ye,...St.providerRuntimeHeadersPort?{providerRuntimeHeadersPort:St.providerRuntimeHeadersPort}:{},resume:kt!==void 0,runtimeConfig:{...t.override?{mode:t.override}:{},...u?{toolDisallowlist:u}:{},...f?{midConversationSystem:{mode:"force"}}:{},modelStreaming:"on",titleGeneration:xti,workingDirectory:st},permissionBroker:B,sessionId:kt,skipUserConfig:e.skipUserConfig,uiDetectedLocale:a,uiLocale:w,userConfigPath:e.userConfigPath,version:n})}catch(Xe){throw await FL(async()=>jt?.close(),U),Xe}if(jt&&R.set(Je,jt),I)throw await z(Je),new Error("TUI prompt handler is closed");return t.current=Je.getMode?.()??t.override??t.current??"build",Je},"createApp"),ie=r(async()=>(b??=await q(o),t.current=b.getMode?.()??XK(t),b),"getApp"),ae=r(async Pe=>await J(async()=>await q(Pe?{continueSession:!1,resumeSessionId:Pe}:{continueSession:!0})),"resumeApp"),Ce=r(async()=>await J(async()=>await q({continueSession:!1})),"newApp"),pe=r(async Pe=>{if(t.override=Pe,b){let Tt=b;if(Tt.setMode){let Ye=await Tt.setMode(Pe);return t.current=Ye.mode,Ye.mode}Tt.runtime.updateConfig({mode:Pe})}return t.current=Pe,Pe},"setCliMode"),ze=$3e({forkApp:r(async Pe=>{let Ye=await(await ie()).forkFromCheckpoint?.({targetCheckpointId:Pe});if(!Ye)throw new Error("Forking is not available in this client.");return await J(async()=>await q({continueSession:!1,resumeSessionId:Ye.forkedSessionId})),{copiedMessageCount:Ye.copiedMessageCount,forkedSessionId:Ye.forkedSessionId,response:`${Ye.response}
|
|
15418
|
-
Switched to forked session ${Ye.forkedSessionId}.`,restoredFileCount:Ye.restoredFileCount??Ye.restoredFiles?.length??0}},"forkApp"),getApp:ie,getMode:r(()=>XK(t),"getMode"),getLocale:r(()=>b?.getLocale?.()??YRn(w,a)??l,"getLocale"),hasConfiguredCodingPlanAccess:k2n(e),listCustomCommands:r(()=>BTt(e),"listCustomCommands"),listSessions:r(()=>uti(e),"listSessions"),listSkills:r(()=>lti(e),"listSkills"),configureApiKey:r(Pe=>Sti(e,Pe),"configureApiKey"),login:r(Pe=>vti(e,Pe),"login"),loginBigmodel:r(Pe=>bti(e,Pe),"loginBigmodel"),loadCustomCommand:r(Pe=>cti(e,Pe),"loadCustomCommand"),newApp:Ce,recordInputHistory:r(async(Pe,Tt)=>{await b?.recordInputHistory?.(Pe,Tt)},"recordInputHistory"),resumeApp:ae,logout:r(()=>wti(e),"logout"),setLocale:r(async Pe=>{if(b?.setLocale){let Ye=await b.setLocale(Pe);return w=Pe,Ye}return w=Pe,{configPath:(await yOe(e.userConfigPath??U7(),Pe)).path,locale:YRn(Pe,a)??"en-US",requestedLocale:Pe}},"setLocale"),setMode:pe}),rt=r(async(Pe,Tt)=>{let Ye=L;L=Tt.requestPermission;try{return await ze(Pe,Tt)}finally{L=Ye}},"submitPrompt");return rt.setMode=async Pe=>({mode:await pe(Pe)}),rt.sendInput=async(Pe,Tt)=>{let Ye=L;L=Tt?.requestPermission;try{let Fe=await ie();if(Fe.sendInput){let St=await Fe.sendInput(Pe,Tt);return St.kind!=="started_turn"?St:U2n(await(St.result??St.completion),Fe,XK(t))}return U2n(await Fe.submitPrompt(Pe,Tt),Fe,XK(t))}finally{L=Ye}},rt.listSkills=async()=>await lti(e),rt.$zReadProviderRegistryRuntime=()=>T.providerRegistryRuntimePromise,mti(rt,ie),rt.subscribeSessionEvents=Pe=>{let Tt=$.addSink(Pe);return ie().then(()=>$.reattach(),()=>{}),Tt},rt.getMainSessionId=()=>{let Tt=b?.runtime?.getSessionId?.();return typeof Tt=="string"&&Tt.length>0?Tt:void 0},rt.close=async()=>{I??=(async()=>{await z(),await FL(async()=>T.shutdownTelemetry?.(),U),(await T.providerRegistryRuntimePromise)?.dispose()})(),await I},rt}var Eti=Y(()=>{"use strict";vw();eN();ETt();XRn();I2n();DTt();fti();hti();yti();Tde();kti();j2n();B2n();CTt();Iti();r(Cti,"createTuiSubmitPrompt")});var Ati,Pti,Y1,QK,cP,Rti,Dti,Erc,Arc,Oti,Mti,Prc,Rrc,Drc,Orc,Mrc,Nrc,Nti=Y(()=>{"use strict";Ati=require("node:crypto"),Pti=require("node:fs"),Y1=require("node:fs/promises"),QK=require("node:os"),cP=require("node:path"),Rti=require("node:url"),Dti="zcode-tui-runtime/",Erc=`${Dti}manifest.json`,Arc="node_modules/@zcode/tui/dist/index.js",Oti="manifest.json",Mti=r(async()=>{let e=await import("node:sea");if(!e.isSea())return await import("@zcode/tui");let t=await Prc(e);return await import((0,Rti.pathToFileURL)((0,cP.join)(t,Arc)).href)},"loadTuiRuntime"),Prc=r(async e=>{let t=Rrc(e),n=(0,cP.join)(Orc(),"0.16.9",t.target,t.hash),o=(0,cP.join)(n,Oti);if(await Drc(o,t))return n;let s=`${n}.tmp-${process.pid}-${Date.now()}`;await(0,Y1.rm)(s,{force:!0,recursive:!0}),await(0,Y1.mkdir)(s,{recursive:!0});for(let a of t.files){let l=e.getRawAsset(`${Dti}${a.path}`),u=Buffer.from(l);if((0,Ati.createHash)("sha256").update(u).digest("hex")!==a.sha256)throw new Error(`SEA TUI asset hash mismatch for ${a.path}`);let g=(0,cP.join)(s,a.path);await(0,Y1.mkdir)((0,cP.dirname)(g),{recursive:!0}),await(0,Y1.writeFile)(g,u),await(0,Y1.chmod)(g,a.mode??Nrc(a.path))}return await(0,Y1.writeFile)(Mrc(s),JSON.stringify(t,null,2)),await(0,Y1.rm)(n,{force:!0,recursive:!0}),await(0,Y1.mkdir)((0,cP.dirname)(n),{recursive:!0}),await(0,Y1.rename)(s,n),n},"ensureSeaTuiRuntime"),Rrc=r(e=>{let t=e.getAsset(Erc,"utf8"),n=JSON.parse(t);if(n.version!==1||!n.hash||!Array.isArray(n.files))throw new Error("Invalid SEA TUI runtime manifest.");return n},"readManifest"),Drc=r(async(e,t)=>{if(!(0,Pti.existsSync)(e))return!1;try{let n=JSON.parse(await(0,Y1.readFile)(e,"utf8"));return n.hash===t.hash&&n.target===t.target}catch{return!1}},"isCacheCurrent"),Orc=r(()=>{let e=(0,QK.homedir)();return(0,QK.platform)()==="darwin"&&e?(0,cP.join)(e,"Library","Caches","zcode","sea-assets"):(0,QK.platform)()==="win32"?(0,cP.join)(process.env.LOCALAPPDATA??(0,cP.join)(e||(0,QK.tmpdir)(),"AppData","Local"),"zcode","Cache","sea-assets"):(0,cP.join)(process.env.XDG_CACHE_HOME??(0,cP.join)(e||(0,QK.tmpdir)(),".cache"),"zcode","sea-assets")},"cacheBaseDirectory"),Mrc=r(e=>(0,cP.join)(e,Oti),"markerPathForDirectory"),Nrc=r(e=>/\.(?:dll|dylib|node|so)$/i.test(e)?493:420,"modeForPath")});function Lti({deps:e,options:t,workingDirectory:n}){let o=K0({cliOverrides:Lrc(t.locale),env:e.env??process.env,projectConfigPath:e.projectConfigPath,skipUserConfig:e.skipUserConfig,userConfigPath:e.userConfigPath,workingDirectory:n});return e8(o.config.ui.locale,t.detectedLocale)}var Lrc,Fti=Y(()=>{"use strict";vw();eN();Lrc=r(e=>e?{ui:{locale:e}}:void 0,"localeCliOverrides");r(Lti,"resolveTuiStartupLocale")});function Bti(e){let t=e.fileSystemPort??hH(),n=(0,pN.resolve)(e.workspaceDirectory);return async o=>{let s=zrc(o.token);if(!s)return{items:[],truncated:!1};let a=(0,pN.resolve)(n,s.directoryToken);if(!Vrc(n,a))return{items:[],truncated:!1};try{let u=(await t.listDirectory({path:a},{signal:o.abortSignal})).entries.flatMap(g=>{if(g.kind!=="directory"&&g.kind!=="file")return[];if(g.kind==="directory"&&Urc.has(g.name))return[];if(!s.query.startsWith(".")&&g.name.startsWith("."))return[];if(!$rc(g.name,s.query))return[];let _=Wrc(n,g.path);return _?[{kind:g.kind,path:g.kind==="directory"?`${_}/`:_}]:[]}).sort((g,_)=>qrc(g,_,s.query)),f=Math.max(1,Math.floor(o.limit??Frc));return{items:u.slice(0,f),truncated:u.length>f}}catch{return{items:[],truncated:!1}}}}function zrc(e){let t=e.replace(/^@/u,"");if(t.startsWith("/")||t.startsWith("\\")||(0,pN.isAbsolute)(t)||Brc.test(t))return;let n=t.replace(jrc,"/");if(n.split("/").some(s=>s===".."))return;let o=n.lastIndexOf("/");return o<0?{directoryToken:"",query:n}:{directoryToken:n.slice(0,o+1),query:n.slice(o+1)}}function $rc(e,t){return t.length===0?!0:e.toLowerCase().includes(t.toLowerCase())}function qrc(e,t,n){if(e.kind!==t.kind)return e.kind==="directory"?-1:1;let o=jti(e.path),s=jti(t.path),a=n.toLowerCase(),l=o.toLowerCase().startsWith(a),u=s.toLowerCase().startsWith(a);return l!==u?l?-1:1:e.path.localeCompare(t.path)}function jti(e){let t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function Wrc(e,t){let n=(0,pN.relative)(e,t);if(!(!n||n.startsWith("..")||(0,pN.isAbsolute)(n)))return n.split(pN.sep).join("/")}function Vrc(e,t){let n=(0,pN.relative)(e,t);return n===""||!n.startsWith("..")&&!(0,pN.isAbsolute)(n)}var pN,Frc,jrc,Brc,Urc,Uti=Y(()=>{"use strict";yme();pN=require("node:path"),Frc=50,jrc=/[\\/]+/gu,Brc=/^[a-zA-Z]:[\\/]/u,Urc=new Set([".bzr",".git",".hg",".jj",".sl",".svn","node_modules"]);r(Bti,"createWorkspacePathSuggestionProvider");r(zrc,"parseWorkspacePathToken");r($rc,"matchesPathQuery");r(qrc,"compareWorkspacePathSuggestion");r(jti,"basenameFromSuggestion");r(Wrc,"toWorkspaceRelativePath");r(Vrc,"isPathInside")});async function $ti(e){let t=e.maxOutputBytes??Krc,n=e.timeoutMs??Jrc,s=await(e.runCommand??Yrc)(Hrc,["-C",e.workspaceDirectory,...Grc],{maxOutputBytes:t,timeoutMs:n}).catch(()=>({exitCode:-1,stdout:""}));if(s.exitCode!==0)return;let a=s.stdout.trim().split(/\r?\n/,1)[0]?.trim();if(!(!a||a===Zrc))return a}async function Yrc(e,t,n){return await new Promise(o=>{let s;try{s=(0,zti.spawn)(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{o({exitCode:-1,stdout:""});return}let a="",l=!1,u=setTimeout(()=>{s.kill(),f({exitCode:-1,stdout:a})},n.timeoutMs),f=r(g=>{l||(l=!0,clearTimeout(u),o(g))},"finish");s.stdout?.on("data",g=>{a+=g.toString("utf8"),Buffer.byteLength(a,"utf8")>n.maxOutputBytes&&(s.kill(),f({exitCode:-1,stdout:a}))}),s.on("error",()=>f({exitCode:-1,stdout:a})),s.on("close",g=>f({exitCode:g,stdout:a}))})}var zti,Hrc,Grc,Jrc,Krc,Zrc,qti=Y(()=>{"use strict";zti=require("node:child_process"),Hrc="git",Grc=["symbolic-ref","--quiet","--short","HEAD"],Jrc=750,Krc=512,Zrc="HEAD";r($ti,"resolveWorkspaceGitBranch");r(Yrc,"runGitCommand")});var Wti,Vti=Y(()=>{"use strict";ms();oti();ati();ETt();Tde();j2n();CTt();Eti();Nti();Fti();Uti();qti();B2n();Wti=r(async(e,t,n,o,s,a,l,u=!1)=>{try{let f=Tti(s),g=n.runTui??(await Mti()).runTui,_=(n.cwd??process.cwd)(),b=n.env??process.env,w=OCe(b)==="development",T=await(n.resolveWorkspaceGitBranch??$ti)({workspaceDirectory:_}).catch(()=>{}),I=Lti({deps:n,options:t,workingDirectory:_}),E=Cti(n,f,o,a,t.locale,t.detectedLocale,I,l,u,t.browserUse,t.browserExecutable),R=rGe({cleanup:r(async()=>{await E.close?.()},"cleanup"),cleanupTimeoutMs:n.shutdownCleanupTimeoutMs,exitProcess:n.exitProcess,process:n.shutdownProcess});try{let L=await fei(n),U=L?{locale:I}:await dti(E),B=L||!U.model?[]:await E.listModelOptions?.().catch(()=>[]),z=L||!U.model?[]:await E.listEffortOptions?.().catch(()=>[]),$=await BTt(n).catch(()=>{});return await g({initialMode:XK(f),initialModel:U.model,initialThoughtLevel:U.thoughtLevel,loginRequired:L,locale:U.locale??I,theme:U.theme??"auto",developerMode:w,version:o,workspaceDirectory:_,workspaceGitBranch:T,noColor:t.noColor,readClipboardImage:n.readClipboardImage??tti(),effortOptions:z,modelOptions:B,listWorkspacePathSuggestions:Bti({workspaceDirectory:_}),listMcpServers:E.listMcpServers,listWorkflowRuns:E.listWorkflowRuns,replayWorkflowRuns:E.replayWorkflowRuns,getMainSessionId:E.getMainSessionId,writeClipboardText:n.writeClipboardText??sti({stdout:e.stdout}),stderr:e.stderr,stdin:e.stdin,stdout:e.stdout,loadSessionTranscript:E.loadSessionTranscript,loadSessionContextMessages:E.loadSessionContextMessages,readGoal:E.readGoal,readTodos:E.readTodos,readRuntimeProjection:E.readRuntimeProjection,readSessionUsage:E.readSessionUsage,cancelBackgroundTask:E.cancelBackgroundTask,previewFileRewind:E.previewFileRewind,applyFileRewind:E.applyFileRewind,setCustomSessionTitle:E.setCustomSessionTitle,readCustomSessionTitle:E.readCustomSessionTitle,interruptTurn:E.interruptTurn,promoteQueuedInput:E.promoteQueuedInput,listSkills:E.listSkills,readDefaultModel:E.readDefaultModel,setDefaultModel:E.setDefaultModel,reloadModelOptions:E.reloadModelOptions,listModelOptions:E.listModelOptions,readExecutionState:E.readExecutionState,setPlanEnabled:E.setPlanEnabled,setTransientModel:E.setTransientModel,readSessionModel:E.readSessionModel,sendBackgroundTaskMessage:E.sendBackgroundTaskMessage,recallPreviousInput:E.recallPreviousInput,sendInput:E.sendInput,setMode:E.setMode,slashCommands:v2n($),submitPrompt:E,subscribeSessionEvents:E.subscribeSessionEvents})}finally{R(),await E.close?.()}}catch(f){let g=f instanceof Error?f.message:String(f);return e.stderr.write(`Error: ${g}
|
|
15417
|
+
Scopes: user (default), project. \`zcode plugin\` is an alias of \`zcode plugins\`.`;r(Zei,"runPluginsCommand");r(nrc,"runPluginsListCommand");r(rrc,"runPluginsInstallCommand");r(orc,"runPluginsUpdateCommand");r(irc,"reportInstallOutcome");r(Yei,"runPluginsSetCommand");r(src,"runPluginsDisableCommand");r(arc,"runPluginsUninstallCommand");r(crc,"runPluginsValidateCommand")});function urc(e=process.env){let t=e.ZCODE_STORAGE_DIR?.trim()||(0,dse.join)((0,eti.homedir)(),".zcode");return(0,dse.join)(t,"clipboard")}function tti(e={}){let t=e.platform??process.platform,n=e.maxBytes??lrc,o=e.runCommand??mrc,s=e.tempDirectory??urc(e.processEnv);return async(a={})=>t==="darwin"?await drc({maxBytes:n,runCommand:o,signal:a.abortSignal,tempDirectory:s}):t==="linux"?await prc({maxBytes:n,runCommand:o,signal:a.abortSignal}):t==="win32"?await frc({maxBytes:n,runCommand:o,signal:a.abortSignal,tempDirectory:s}):null}async function drc(e){await(0,M4.mkdir)(e.tempDirectory,{recursive:!0});let t=await(0,M4.mkdtemp)((0,dse.join)(e.tempDirectory,"zcode-clipboard-")),n=(0,dse.join)(t,"clipboard.png");try{return(await e.runCommand("osascript",["-e","set png_data to (the clipboard as \xABclass PNGf\xBB)","-e",`set fp to open for access POSIX file ${hrc(n)} with write permission`,"-e","write png_data to fp","-e","close access fp"],{maxBytes:e.maxBytes,signal:e.signal})).exitCode!==0?null:await nti(n,"image/png",e.maxBytes)}finally{await(0,M4.rm)(t,{force:!0,recursive:!0})}}async function prc(e){let t=[{args:["--type","image/png"],file:"wl-paste",mediaType:"image/png"},{args:["--type","image/jpeg"],file:"wl-paste",mediaType:"image/jpeg"},{args:["--type","image/gif"],file:"wl-paste",mediaType:"image/gif"},{args:["--type","image/webp"],file:"wl-paste",mediaType:"image/webp"},{args:["-selection","clipboard","-t","image/png","-o"],file:"xclip",mediaType:"image/png"},{args:["-selection","clipboard","-t","image/jpeg","-o"],file:"xclip",mediaType:"image/jpeg"},{args:["-selection","clipboard","-t","image/gif","-o"],file:"xclip",mediaType:"image/gif"},{args:["-selection","clipboard","-t","image/webp","-o"],file:"xclip",mediaType:"image/webp"}];for(let n of t){let o=await e.runCommand(n.file,n.args,{maxBytes:e.maxBytes,signal:e.signal}),s=rti(o.stdout,n.mediaType,e.maxBytes);if(o.exitCode===0&&s)return s}return null}async function frc(e){await(0,M4.mkdir)(e.tempDirectory,{recursive:!0});let t=await(0,M4.mkdtemp)((0,dse.join)(e.tempDirectory,"zcode-clipboard-")),n=(0,dse.join)(t,"clipboard.png"),o=["Add-Type -AssemblyName System.Windows.Forms;","$img = Get-Clipboard -Format Image;","if ($null -eq $img) { exit 2 }",`$img.Save(${grc(n)}, [System.Drawing.Imaging.ImageFormat]::Png);`].join(" ");try{return(await e.runCommand("powershell.exe",["-NoProfile","-NonInteractive","-Command",o],{maxBytes:e.maxBytes,signal:e.signal})).exitCode!==0?null:await nti(n,"image/png",e.maxBytes)}finally{await(0,M4.rm)(t,{force:!0,recursive:!0})}}async function nti(e,t,n){let o=await(0,M4.readFile)(e);return rti(o,t,n)}function rti(e,t,n){return e.byteLength===0||e.byteLength>n?null:{dataUrl:`data:${t};base64,${e.toString("base64")}`,mediaType:t,sizeBytes:e.byteLength}}async function mrc(e,t,n){return await new Promise(o=>{let s;try{s=(0,Qei.spawn)(e,t,{signal:n.signal,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{o({exitCode:-1,stdout:Buffer.alloc(0)});return}let a=[],l=0,u=!1,f=r(g=>{u||(u=!0,o(g))},"finish");s.stdout?.on("data",g=>{if(l+=g.byteLength,l>n.maxBytes){s.kill();return}a.push(g)}),s.on("error",()=>f({exitCode:-1,stdout:Buffer.alloc(0)})),s.on("close",(g,_)=>{f({exitCode:g,signal:_,stdout:Buffer.concat(a)})})})}function hrc(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function grc(e){return`'${e.replace(/'/g,"''")}'`}var Qei,M4,eti,dse,lrc,oti=Y(()=>{"use strict";Qei=require("node:child_process"),M4=require("node:fs/promises"),eti=require("node:os"),dse=require("node:path"),lrc=20*1024*1024;r(urc,"resolveDefaultClipboardDirectory");r(tti,"createNodeClipboardImageReader");r(drc,"readMacClipboardImage");r(prc,"readLinuxClipboardImage");r(frc,"readWindowsClipboardImage");r(nti,"readImageFile");r(rti,"bufferToClipboardImage");r(mrc,"runCommandBuffer");r(hrc,"appleScriptString");r(grc,"powershellString")});function sti(e={}){let t=e.maxBytes??_rc,n=e.platform??process.platform,o=e.runCommand??Irc;return async s=>{let a=Trc(s,t);if(a.byteLength===0)return;let l=wrc(e.stdout,a),u=await krc({input:s,platform:n,runCommand:o});if(!l&&!u)throw new Error("No text clipboard target accepted the selected text.")}}function wrc(e,t){if(!e)return!1;try{return e.write(`${vrc}${yrc};${t.toString("base64")}${brc}`),!0}catch{return!1}}async function krc(e){for(let t of xrc(e.platform))if((await e.runCommand(t.file,t.args,{input:e.input})).exitCode===0)return!0;return!1}function xrc(e){return e==="darwin"?[{args:[],file:"pbcopy"}]:e==="linux"?[{args:[],file:"wl-copy"},{args:["-selection","clipboard"],file:"xclip"},{args:["--clipboard","--input"],file:"xsel"}]:e==="win32"?[{args:["-NoProfile","-NonInteractive","-Command",Src],file:"powershell.exe"}]:[]}function Trc(e,t){let n=Buffer.from(e,"utf8");if(n.byteLength>t)throw new Error(`Clipboard text exceeds ${t} bytes.`);return n}async function Irc(e,t,n){return await new Promise(o=>{let s;try{s=(0,iti.spawn)(e,t,{stdio:["pipe","ignore","ignore"],windowsHide:!0})}catch{o({exitCode:-1});return}let a=!1,l=r(u=>{a||(a=!0,o(u))},"finish");s.stdin?.on("error",()=>{}),s.stdin?.end(n.input),s.on("error",()=>l({exitCode:-1})),s.on("close",(u,f)=>l({exitCode:u,signal:f}))})}var iti,_rc,yrc,vrc,brc,Src,ati=Y(()=>{"use strict";iti=require("node:child_process"),_rc=1024*1024,yrc="c",vrc="\x1B]52;",brc="\x07",Src="Set-Clipboard -Value ([Console]::In.ReadToEnd())";r(sti,"createNodeClipboardTextWriter");r(wrc,"writeOsc52");r(krc,"writeNativeClipboardText");r(xrc,"nativeClipboardCommands");r(Trc,"assertClipboardTextSize");r(Irc,"runCommandText")});async function BTt(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return e.listCustomCommands?await e.listCustomCommands({env:t,logger:e.logger,workingDirectory:n}):await(await Qg()).listZCodeCustomCommands({env:t,logger:e.logger,workingDirectory:n})}async function cti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)();return e.loadCustomCommand?await e.loadCustomCommand({env:n,logger:e.logger,name:t,workingDirectory:o}):await(await Qg()).loadZCodeCustomCommand({env:n,logger:e.logger,name:t,workingDirectory:o})}async function lti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return await(e.listSkills??(await Qg()).listZCodeSkills)({env:t,logger:e.logger,workingDirectory:n})}async function uti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)();return(await(e.listSessions??(await Qg()).listZCodeSessions)({directory:n,env:t,limit:50})).map(a=>({directory:a.directory,id:a.id,parentId:a.parentID,title:a.title,updatedAt:a.time.updated}))}async function dti(e){try{return await e.getSessionMetadata?.()??{}}catch(t){if(Crc(t))throw t;return{}}}function Crc(e){return e instanceof Error?e.name==="SqliteSessionMigrationError":!1}var j2n=Y(()=>{"use strict";b9();r(BTt,"listCustomCommandsForTui");r(cti,"loadCustomCommandForTui");r(lti,"listSkillsForTui");r(uti,"listSessionsForTui");r(dti,"loadInitialTuiSessionMetadata");r(Crc,"isStartupGateError")});function pti(e){let t=new Set,n,o=r(()=>{n?.(),n=void 0},"detach"),s=r(()=>{if(o(),t.size===0)return;n=e.readSubscriber(e.currentRuntime())?.({onSessionEvent:r(l=>{for(let u of t)u(l)},"onSessionEvent")})},"reattach");return{addSink:r(a=>(t.add(a),t.size===1&&s(),()=>{t.delete(a),t.size===0&&o()}),"addSink"),reattach:s,detach:o,isAttached:r(()=>n!==void 0,"isAttached")}}var fti=Y(()=>{"use strict";r(pti,"createTuiSessionEventRelay")});var mti,hti=Y(()=>{"use strict";TTt();mti=r((e,t)=>{const $zTuiBridge=e,$zTuiGetApp=t;$zTuiBridge.loadSessionTranscript=async()=>await(await $zTuiGetApp()).loadSessionTranscript?.()??[],$zTuiBridge.loadSessionContextMessages=async()=>await(await $zTuiGetApp()).loadSessionContextMessages?.()??[],$zTuiBridge.readGoal=async()=>await(await $zTuiGetApp()).readTarget?.()??null,$zTuiBridge.readTodos=async()=>await(await $zTuiGetApp()).readTodos?.()??[],$zTuiBridge.readRuntimeProjection=async()=>{let $zRuntimeProjectionBridge=await $zTuiGetApp();return await require(require("node:path").join(__dirname,"cli-config.cjs")).readTuiRuntimeProjection($zRuntimeProjectionBridge,$zTuiBridge)},$zTuiBridge.$zRestorePersistedBackgroundTasks=async $zApp=>await require(require("node:path").join(__dirname,"cli-config.cjs")).restoreTuiBackgroundTasks($zApp,(kKo(),H_r(),{collectChildSessionIds:bKo,projectSubagents:SKo,projectChildEvents:e=>new Ate().reduce(e)})),$zTuiBridge.readSessionUsage=async()=>await(await $zTuiGetApp()).readSessionUsage?.()??null,$zTuiBridge.cancelBackgroundTask=async e=>await(await $zTuiGetApp()).cancelBackgroundTask?.(e)??null,$zTuiBridge.previewFileRewind=async e=>{let t=await $zTuiGetApp();return await t.runtime?.previewWorkspaceFileRewind?.({targetMessageIds:e})??null},$zTuiBridge.applyFileRewind=async e=>{let t=await $zTuiGetApp();return await t.runtime?.applyWorkspaceFileRewind?.({targetMessageIds:e})??null},$zTuiBridge.setCustomSessionTitle=async e=>{let t=await $zTuiGetApp();let r=t.runtime?.setCustomSessionTitle?.bind(t.runtime)??t.setCustomSessionTitle?.bind(t);if(!r)throw new Error("Session renaming is unavailable in this runtime.");return await r({title:e.title,traceContext:e.traceContext??t.runtime?.rootTraceContext})},$zTuiBridge.readCustomSessionTitle=async()=>{let t=await $zTuiGetApp(),o=t.sessionStore??t.runtime?.sessionStore,r=await o?.getSession?.(t.sessionId);return r?.titleSource==="custom"&&typeof r.title==="string"?r.title:void 0},$zTuiBridge.setMode=async e=>{return await(await $zTuiGetApp()).setMode(e)},$zTuiBridge.readExecutionState=async()=>await(await $zTuiGetApp()).readExecutionState(),$zTuiBridge.setPlanEnabled=async e=>await(await $zTuiGetApp()).setPlanEnabled(e),$zTuiBridge.setTransientModel=async e=>{if(e==="main"){e=await $zTuiBridge.readDefaultModel();if(!e)throw new Error("No default model is configured.")}let t=await $zTuiGetApp(),r=await t.setModel(e);return{...r,thoughtLevel:t.getThoughtLevel(),effortOptions:t.listThoughtLevels()}},$zTuiBridge.readSessionModel=async()=>{let $zSessionModelApp=await $zTuiGetApp(),s=await $zSessionModelApp.readSessionModelState();if(s?.selection&&!s.issue)await $zSessionModelApp.setModel(s.selection,{transient:!0});return s},$zTuiBridge.sendBackgroundTaskMessage=async e=>await require(require("node:path").join(__dirname,"cli-config.cjs")).sendTuiBackgroundTaskMessage(await $zTuiGetApp(),$zTuiBridge,e),$zTuiBridge.interruptTurn=async e=>{let t=await $zTuiGetApp(),r=e?.reservationId??"tui-steer-interrupt",o=(Array.isArray(e?.pendingInputIds)?e.pendingInputIds:[]).filter(Boolean),n=[],i=async()=>{for(let a of n)await t.releaseQueueItemReservation?.(a,r);n=[]};try{if(t.reserveQueueItem&&t.releaseQueueItemReservation)for(let a of o)if(await t.reserveQueueItem(a,r))n.push(a);else{await i();break}let a=t.runtime?.stopActiveForegroundExecution?.({preserveQueueAutoDrainOnCancel:o.length>0&&n.length===o.length,reason:e?.reason??"TUI steer interrupt"})??{kind:"unsupported"};if(a.kind==="stopped"&&e?.waitForIdle===!0&&t.runtime?.getActiveForegroundExecutionId){let u=Date.now()+5e3;for(;t.runtime.getActiveForegroundExecutionId()!==void 0;){if(Date.now()>=u)throw new Error("Timed out waiting for background result processing to stop.");await new Promise(l=>setTimeout(l,25))}}return a.kind!=="stopped"&&await i(),a}catch(a){await i();throw a}},$zTuiBridge.promoteQueuedInput=async(e,t,r)=>{let o=await $zTuiGetApp(),n=r?.pendingInputReservationId??r?.queryId??r?.inputId??"tui-promotion",i=(Array.isArray(t)?t:[t]).filter(Boolean);if(i.length===0||!o.reserveQueueItem||!o.markQueueItemPromoting||!o.releaseQueueItemReservation||!o.removeQueueItem)return $zTuiBridge.sendInput(e,{...r,delivery:"start_turn"});let a=[],u=!1;try{for(let l of i){if(await o.markQueueItemPromoting(l,n)){a.push(l);continue}if(!await o.reserveQueueItem(l,n))throw new Error("TUI queued input is already reserved: "+l);a.push(l);if(!await o.markQueueItemPromoting(l,n))throw new Error("TUI queued input promotion failed: "+l)}let c=await $zTuiBridge.sendInput(e,{...r,delivery:"start_turn"});if(c?.kind==="rejected")return c;u=!0;for(let l of a)if(!await o.removeQueueItem(l,{reason:"promoted",reservationId:n}))throw new Error("TUI queued input promotion commit failed: "+l);return c}finally{if(!u)for(let l of a)await o.releaseQueueItemReservation(l,n)}},$zTuiBridge.$zSendInputWithoutBackgroundRestore=$zTuiBridge.sendInput,$zTuiBridge.sendInput=async(...$zArgs)=>{let $zApp=await $zTuiGetApp();await $zTuiBridge.$zRestorePersistedBackgroundTasks?.($zApp);return await $zTuiBridge.$zSendInputWithoutBackgroundRestore.apply($zTuiBridge,$zArgs)},e.recallPreviousInput=async n=>await(await t()).recallPreviousInputHistory?.(n)??null,e.getSessionMetadata=async()=>{let n=await t();return{locale:n.getLocale?.(),model:n.getModel?.(),theme:n.getTheme?.(),thoughtLevel:n.getThoughtLevel?.()}},e.reloadModelOptions=async()=>await(await t()).reloadModels(),e.readDefaultModel=async()=>{await t();let $zSelection=await(await e.$zReadProviderRegistryRuntime()).modelSelectionConfigRepository.read();return $zSelection?$zSelection.providerId+"/"+$zSelection.modelId:void 0},e.setDefaultModel=async $zModel=>{let $zApp=await t(),$zIndex=$zModel.indexOf("/"),$zSelection={providerId:$zModel.slice(0,$zIndex),modelId:$zModel.slice($zIndex+1)};if($zIndex<=0||!$zApp.getModelOption($zSelection))throw new Error("Unknown default model: "+$zModel);await(await e.$zReadProviderRegistryRuntime()).modelSelectionConfigRepository.saveConfiguredDefault($zSelection);return await e.setTransientModel($zModel)},e.listModelOptions=async()=>(await t()).listModels?.()??[],e.listEffortOptions=async()=>{let n=await t();return await j3e(n)??[]},e.listMcpServers=async()=>(await t()).listMcpServers?.()??{},e.listWorkflowRuns=async()=>await(await t()).listDynamicWorkflowRuns?.({})??[],e.replayWorkflowRuns=async n=>await(await t()).replayDynamicWorkflowRuns?.(n)??[]},"attachTuiAppQueries")});async function _ti(e,t,n,o){let s=e.env??process.env,a=(e.cwd??process.cwd)(),l=(e.loadDotenv??rA)({cwd:a,env:s});if(l.error)throw new Error(`Failed to load environment file: ${l.path}`,{cause:l.error});let u=await OTt(n,a,s,e),f=e.createZCodeApp?void 0:await Qg(),g=e.createZCodeApp??f?.createZCodeApp;if(!g)throw new Error("ZCode app factory is unavailable.");let _=e.prepareZCodeTelemetryEnv??f?.prepareZCodeTelemetryEnv;_&&(o.shutdownTelemetry=e.shutdownZCodeTelemetry??f?.shutdownZCodeTelemetry);let b=_?await _(s,{cliVersion:t,productVersion:s.ZCODE_APP_VERSION}):s,w=e.startProcessProviderRegistryRuntime??f?.startProcessProviderRegistryRuntime;if(!w)throw new Error("Provider Registry runtime is unavailable.");o.providerRegistryRuntimePromise??=w(b,e.skipUserConfig?{}:{standalone:{...gPe(),...e.userConfigPath?{legacyCliUserConfigFilePath:e.userConfigPath}:{}}});let T=await o.providerRegistryRuntimePromise,I=T?.modelSelectionConfigRepository?await T.modelSelectionConfigRepository.read():T?.configuredDefaultModelSelection,E=e.createProviderEndpointRoutingPort??f?.createDefaultProviderEndpointRoutingPort;return o.providerEndpointRoutingPort??=E?.({appVersion:t,env:s,projectConfigPath:e.projectConfigPath,skipUserConfig:e.skipUserConfig,userConfigPath:e.userConfigPath,workingDirectory:a}),{appEnv:b,configuredDefaultModelSelection:I,createAppFactory:g,providerRegistryRuntime:T,sessionId:u,workingDirectory:a}}var gti,yti=Y(()=>{"use strict";b9();jQ();NXe();A2n();gti=r(()=>({providerEndpointRoutingPort:void 0,providerRegistryRuntimePromise:void 0,shutdownTelemetry:void 0}),"createTuiProcessRuntimeState");r(_ti,"prepareTuiAppRuntime")});async function vti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)(),s=(e.loadDotenv??rA)({cwd:o,env:n});if(s.error)throw new Error(`Failed to load environment file: ${s.path}`,{cause:s.error});return await(e.loginZCodeCli??(await Qg()).loginZCodeCli)({abortSignal:t?.abortSignal,env:n,onAuthorizeUrl:t?.onAuthorizeUrl})}async function bti(e,t){let n=e.env??process.env,o=(e.cwd??process.cwd)(),s=(e.loadDotenv??rA)({cwd:o,env:n});if(s.error)throw new Error(`Failed to load environment file: ${s.path}`,{cause:s.error});return await(e.loginBigmodelCodingPlan??(await Qg()).loginBigmodelCodingPlan)({abortSignal:t?.abortSignal,env:n,onAuthorizeUrl:t?.onAuthorizeUrl})}async function Sti(e,t){return await(e.configureCodingPlanApiKey??(await Qg()).configureCodingPlanApiKey)({apiKey:t.apiKey,env:e.env??process.env,providerId:t.providerId})}async function wti(e){let t=e.env??process.env,n=(e.cwd??process.cwd)(),o=(e.loadDotenv??rA)({cwd:n,env:t});if(o.error)throw new Error(`Failed to load environment file: ${o.path}`,{cause:o.error});return await(e.logoutZCodeCli??(await Qg()).logoutZCodeCli)({env:t})}var kti=Y(()=>{"use strict";b9();jQ();r(vti,"loginForTui");r(bti,"loginBigmodelForTui");r(Sti,"configureApiKeyForTui");r(wti,"logoutForTui")});var xti,Tti,XK,B2n=Y(()=>{"use strict";xti={},Tti=r(e=>({current:e,override:e}),"createCliModeState"),XK=r(e=>e.current??e.override??"build","currentCliMode")});function U2n(e,t,n){return{kind:"started_turn",result:{...e,locale:e.locale??t.getLocale?.(),mode:n,model:e.model??t.getModel?.(),theme:e.theme??t.getTheme?.(),thoughtLevel:e.thoughtLevel??t.getThoughtLevel?.()}}}var Iti=Y(()=>{"use strict";r(U2n,"withTuiMetadata")});function Cti(e,t,n,o={continueSession:!1},s,a,l=Myt,u,f=!1,g,_){let b,w=s,T=gti(),I,E=new WeakMap,R=new WeakMap,L,U=Math.max(1,Math.trunc(e.shutdownCleanupTimeoutMs??nGe)),B={requestPermission:r(async(Pe,Tt)=>{let Ye=L;return Ye?await Ye(Pe,Tt):{decision:"deny",reason:`No interactive approval handler configured for ${Pe.toolName}`,resolvedAt:new Date}},"requestPermission")},z=r(async(Pe=b)=>{if(!Pe)return;let Tt=Pe,Ye=E.get(Tt);Ye||(Ye=(async()=>{await FL(async()=>Pe.close?.(),U),await FL(async()=>R.get(Tt)?.close(),U)})(),E.set(Tt,Ye)),await Ye},"closeApp"),$=pti({currentRuntime:r(()=>b?.runtime,"currentRuntime"),readSubscriber:RTt}),J=r(async Pe=>{let Tt=b,Ye=await Pe();return b=Ye,Tt&&Tt!==Ye&&await z(Tt),$.reattach(),t.current=b.getMode?.()??XK(t),b},"replaceApp"),q=r(async Pe=>{if(I)throw new Error("TUI prompt handler is closed");let{appEnv:Tt,configuredDefaultModelSelection:Ye,createAppFactory:Fe,providerRegistryRuntime:St,sessionId:kt,workingDirectory:st}=await _ti(e,n,Pe,T),$e=T.providerEndpointRoutingPort,jt=ATt({browserExecutable:_,browserUse:g},e),Je;try{Je=await Fe({browserControlPort:jt?.browserControlPort,env:Tt,projectConfigPath:e.projectConfigPath,...$e?{providerEndpointRoutingPort:$e}:{},providerRegistry:St.runtime.registryService,configuredDefaultModelSelection:Ye,...St.providerRuntimeHeadersPort?{providerRuntimeHeadersPort:St.providerRuntimeHeadersPort}:{},resume:kt!==void 0,runtimeConfig:{...t.override?{mode:t.override}:{},...u?{toolDisallowlist:u}:{},...f?{midConversationSystem:{mode:"force"}}:{},modelStreaming:"on",titleGeneration:xti,workingDirectory:st},permissionBroker:B,sessionId:kt,skipUserConfig:e.skipUserConfig,uiDetectedLocale:a,uiLocale:w,userConfigPath:e.userConfigPath,version:n})}catch(Xe){throw await FL(async()=>jt?.close(),U),Xe}if(jt&&R.set(Je,jt),I)throw await z(Je),new Error("TUI prompt handler is closed");return t.current=Je.getMode?.()??t.override??t.current??"build",Je},"createApp"),ie=r(async()=>(b??=await q(o),t.current=b.getMode?.()??XK(t),b),"getApp"),ae=r(async Pe=>await J(async()=>await q(Pe?{continueSession:!1,resumeSessionId:Pe}:{continueSession:!0})),"resumeApp"),Ce=r(async()=>await J(async()=>await q({continueSession:!1})),"newApp"),pe=r(async Pe=>{if(t.override=Pe,b){let Tt=b;if(Tt.setMode){let Ye=await Tt.setMode(Pe);return t.current=Ye.mode,Ye.mode}Tt.runtime.updateConfig({mode:Pe})}return t.current=Pe,Pe},"setCliMode"),ze=$3e({forkApp:r(async Pe=>{let Ye=await(await ie()).forkFromCheckpoint?.({targetCheckpointId:Pe});if(!Ye)throw new Error("Forking is not available in this client.");return await J(async()=>await q({continueSession:!1,resumeSessionId:Ye.forkedSessionId})),{copiedMessageCount:Ye.copiedMessageCount,forkedSessionId:Ye.forkedSessionId,response:`${Ye.response}
|
|
15418
|
+
Switched to forked session ${Ye.forkedSessionId}.`,restoredFileCount:Ye.restoredFileCount??Ye.restoredFiles?.length??0}},"forkApp"),getApp:ie,getMode:r(()=>XK(t),"getMode"),getLocale:r(()=>b?.getLocale?.()??YRn(w,a)??l,"getLocale"),hasConfiguredCodingPlanAccess:k2n(e),listCustomCommands:r(()=>BTt(e),"listCustomCommands"),listSessions:r(()=>uti(e),"listSessions"),listSkills:r(()=>lti(e),"listSkills"),configureApiKey:r(Pe=>Sti(e,Pe),"configureApiKey"),login:r(Pe=>vti(e,Pe),"login"),loginBigmodel:r(Pe=>bti(e,Pe),"loginBigmodel"),loadCustomCommand:r(Pe=>cti(e,Pe),"loadCustomCommand"),newApp:Ce,recordInputHistory:r(async(Pe,Tt)=>{await b?.recordInputHistory?.(Pe,Tt)},"recordInputHistory"),resumeApp:ae,logout:r(()=>wti(e),"logout"),setLocale:r(async Pe=>{if(b?.setLocale){let Ye=await b.setLocale(Pe);return w=Pe,Ye}return w=Pe,{configPath:(await yOe(e.userConfigPath??U7(),Pe)).path,locale:YRn(Pe,a)??"en-US",requestedLocale:Pe}},"setLocale"),setMode:pe}),rt=r(async(Pe,Tt)=>{let Ye=L;L=Tt.requestPermission;try{return await ze(Pe,Tt)}finally{L=Ye}},"submitPrompt");return rt.setMode=async Pe=>({mode:await pe(Pe)}),rt.sendInput=async(Pe,Tt)=>{let Ye=L;L=Tt?.requestPermission;try{let Fe=await ie();if(Fe.sendInput){let St=await Fe.sendInput(Pe,Tt);return St.kind!=="started_turn"?St:U2n(await(St.result??St.completion),Fe,XK(t))}return U2n(await Fe.submitPrompt(Pe,Tt),Fe,XK(t))}finally{L=Ye}},rt.listSkills=async()=>await lti(e),rt.$zReadProviderRegistryRuntime=()=>T.providerRegistryRuntimePromise,mti(rt,ie),rt.subscribeSessionEvents=Pe=>{let Tt=$.addSink(Pe);return ie().then(()=>$.reattach(),()=>{}),Tt},rt.getMainSessionId=()=>{let Tt=b?.runtime?.getSessionId?.();return typeof Tt=="string"&&Tt.length>0?Tt:void 0},rt.close=async()=>{I??=(async()=>{await z(),await FL(async()=>T.shutdownTelemetry?.(),U),(await T.providerRegistryRuntimePromise)?.dispose()})(),await I},rt}var Eti=Y(()=>{"use strict";vw();eN();ETt();XRn();I2n();DTt();fti();hti();yti();Tde();kti();j2n();B2n();CTt();Iti();r(Cti,"createTuiSubmitPrompt")});var Ati,Pti,Y1,QK,cP,Rti,Dti,Erc,Arc,Oti,Mti,Prc,Rrc,Drc,Orc,Mrc,Nrc,Nti=Y(()=>{"use strict";Ati=require("node:crypto"),Pti=require("node:fs"),Y1=require("node:fs/promises"),QK=require("node:os"),cP=require("node:path"),Rti=require("node:url"),Dti="zcode-tui-runtime/",Erc=`${Dti}manifest.json`,Arc="node_modules/@zcode/tui/dist/index.js",Oti="manifest.json",Mti=r(async()=>{let e=await import("node:sea");if(!e.isSea())return await import("@zcode/tui");let t=await Prc(e);return await import((0,Rti.pathToFileURL)((0,cP.join)(t,Arc)).href)},"loadTuiRuntime"),Prc=r(async e=>{let t=Rrc(e),n=(0,cP.join)(Orc(),"0.16.9",t.target,t.hash),o=(0,cP.join)(n,Oti);if(await Drc(o,t))return n;let s=`${n}.tmp-${process.pid}-${Date.now()}`;await(0,Y1.rm)(s,{force:!0,recursive:!0}),await(0,Y1.mkdir)(s,{recursive:!0});for(let a of t.files){let l=e.getRawAsset(`${Dti}${a.path}`),u=Buffer.from(l);if((0,Ati.createHash)("sha256").update(u).digest("hex")!==a.sha256)throw new Error(`SEA TUI asset hash mismatch for ${a.path}`);let g=(0,cP.join)(s,a.path);await(0,Y1.mkdir)((0,cP.dirname)(g),{recursive:!0}),await(0,Y1.writeFile)(g,u),await(0,Y1.chmod)(g,a.mode??Nrc(a.path))}return await(0,Y1.writeFile)(Mrc(s),JSON.stringify(t,null,2)),await(0,Y1.rm)(n,{force:!0,recursive:!0}),await(0,Y1.mkdir)((0,cP.dirname)(n),{recursive:!0}),await(0,Y1.rename)(s,n),n},"ensureSeaTuiRuntime"),Rrc=r(e=>{let t=e.getAsset(Erc,"utf8"),n=JSON.parse(t);if(n.version!==1||!n.hash||!Array.isArray(n.files))throw new Error("Invalid SEA TUI runtime manifest.");return n},"readManifest"),Drc=r(async(e,t)=>{if(!(0,Pti.existsSync)(e))return!1;try{let n=JSON.parse(await(0,Y1.readFile)(e,"utf8"));return n.hash===t.hash&&n.target===t.target}catch{return!1}},"isCacheCurrent"),Orc=r(()=>{let e=(0,QK.homedir)();return(0,QK.platform)()==="darwin"&&e?(0,cP.join)(e,"Library","Caches","zcode","sea-assets"):(0,QK.platform)()==="win32"?(0,cP.join)(process.env.LOCALAPPDATA??(0,cP.join)(e||(0,QK.tmpdir)(),"AppData","Local"),"zcode","Cache","sea-assets"):(0,cP.join)(process.env.XDG_CACHE_HOME??(0,cP.join)(e||(0,QK.tmpdir)(),".cache"),"zcode","sea-assets")},"cacheBaseDirectory"),Mrc=r(e=>(0,cP.join)(e,Oti),"markerPathForDirectory"),Nrc=r(e=>/\.(?:dll|dylib|node|so)$/i.test(e)?493:420,"modeForPath")});function Lti({deps:e,options:t,workingDirectory:n}){let o=K0({cliOverrides:Lrc(t.locale),env:e.env??process.env,projectConfigPath:e.projectConfigPath,skipUserConfig:e.skipUserConfig,userConfigPath:e.userConfigPath,workingDirectory:n});return e8(o.config.ui.locale,t.detectedLocale)}var Lrc,Fti=Y(()=>{"use strict";vw();eN();Lrc=r(e=>e?{ui:{locale:e}}:void 0,"localeCliOverrides");r(Lti,"resolveTuiStartupLocale")});function Bti(e){let t=e.fileSystemPort??hH(),n=(0,pN.resolve)(e.workspaceDirectory);return async o=>{let s=zrc(o.token);if(!s)return{items:[],truncated:!1};let a=(0,pN.resolve)(n,s.directoryToken);if(!Vrc(n,a))return{items:[],truncated:!1};try{let u=(await t.listDirectory({path:a},{signal:o.abortSignal})).entries.flatMap(g=>{if(g.kind!=="directory"&&g.kind!=="file")return[];if(g.kind==="directory"&&Urc.has(g.name))return[];if(!s.query.startsWith(".")&&g.name.startsWith("."))return[];if(!$rc(g.name,s.query))return[];let _=Wrc(n,g.path);return _?[{kind:g.kind,path:g.kind==="directory"?`${_}/`:_}]:[]}).sort((g,_)=>qrc(g,_,s.query)),f=Math.max(1,Math.floor(o.limit??Frc));return{items:u.slice(0,f),truncated:u.length>f}}catch{return{items:[],truncated:!1}}}}function zrc(e){let t=e.replace(/^@/u,"");if(t.startsWith("/")||t.startsWith("\\")||(0,pN.isAbsolute)(t)||Brc.test(t))return;let n=t.replace(jrc,"/");if(n.split("/").some(s=>s===".."))return;let o=n.lastIndexOf("/");return o<0?{directoryToken:"",query:n}:{directoryToken:n.slice(0,o+1),query:n.slice(o+1)}}function $rc(e,t){return t.length===0?!0:e.toLowerCase().includes(t.toLowerCase())}function qrc(e,t,n){if(e.kind!==t.kind)return e.kind==="directory"?-1:1;let o=jti(e.path),s=jti(t.path),a=n.toLowerCase(),l=o.toLowerCase().startsWith(a),u=s.toLowerCase().startsWith(a);return l!==u?l?-1:1:e.path.localeCompare(t.path)}function jti(e){let t=e.endsWith("/")?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?t:t.slice(n+1)}function Wrc(e,t){let n=(0,pN.relative)(e,t);if(!(!n||n.startsWith("..")||(0,pN.isAbsolute)(n)))return n.split(pN.sep).join("/")}function Vrc(e,t){let n=(0,pN.relative)(e,t);return n===""||!n.startsWith("..")&&!(0,pN.isAbsolute)(n)}var pN,Frc,jrc,Brc,Urc,Uti=Y(()=>{"use strict";yme();pN=require("node:path"),Frc=50,jrc=/[\\/]+/gu,Brc=/^[a-zA-Z]:[\\/]/u,Urc=new Set([".bzr",".git",".hg",".jj",".sl",".svn","node_modules"]);r(Bti,"createWorkspacePathSuggestionProvider");r(zrc,"parseWorkspacePathToken");r($rc,"matchesPathQuery");r(qrc,"compareWorkspacePathSuggestion");r(jti,"basenameFromSuggestion");r(Wrc,"toWorkspaceRelativePath");r(Vrc,"isPathInside")});async function $ti(e){let t=e.maxOutputBytes??Krc,n=e.timeoutMs??Jrc,s=await(e.runCommand??Yrc)(Hrc,["-C",e.workspaceDirectory,...Grc],{maxOutputBytes:t,timeoutMs:n}).catch(()=>({exitCode:-1,stdout:""}));if(s.exitCode!==0)return;let a=s.stdout.trim().split(/\r?\n/,1)[0]?.trim();if(!(!a||a===Zrc))return a}async function Yrc(e,t,n){return await new Promise(o=>{let s;try{s=(0,zti.spawn)(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{o({exitCode:-1,stdout:""});return}let a="",l=!1,u=setTimeout(()=>{s.kill(),f({exitCode:-1,stdout:a})},n.timeoutMs),f=r(g=>{l||(l=!0,clearTimeout(u),o(g))},"finish");s.stdout?.on("data",g=>{a+=g.toString("utf8"),Buffer.byteLength(a,"utf8")>n.maxOutputBytes&&(s.kill(),f({exitCode:-1,stdout:a}))}),s.on("error",()=>f({exitCode:-1,stdout:a})),s.on("close",g=>f({exitCode:g,stdout:a}))})}var zti,Hrc,Grc,Jrc,Krc,Zrc,qti=Y(()=>{"use strict";zti=require("node:child_process"),Hrc="git",Grc=["symbolic-ref","--quiet","--short","HEAD"],Jrc=750,Krc=512,Zrc="HEAD";r($ti,"resolveWorkspaceGitBranch");r(Yrc,"runGitCommand")});var Wti,Vti=Y(()=>{"use strict";ms();oti();ati();ETt();Tde();j2n();CTt();Eti();Nti();Fti();Uti();qti();B2n();Wti=r(async(e,t,n,o,s,a,l,u=!1)=>{try{let f=Tti(s),g=n.runTui??(await Mti()).runTui,_=(n.cwd??process.cwd)(),b=n.env??process.env,w=OCe(b)==="development",T=await(n.resolveWorkspaceGitBranch??$ti)({workspaceDirectory:_}).catch(()=>{}),I=Lti({deps:n,options:t,workingDirectory:_}),E=Cti(n,f,o,a,t.locale,t.detectedLocale,I,l,u,t.browserUse,t.browserExecutable),R=rGe({cleanup:r(async()=>{await E.close?.()},"cleanup"),cleanupTimeoutMs:n.shutdownCleanupTimeoutMs,exitProcess:n.exitProcess,process:n.shutdownProcess});try{let L=await fei(n),U=L?{locale:I}:await dti(E),B=L||!U.model?[]:await E.listModelOptions?.().catch(()=>[]),z=L||!U.model?[]:await E.listEffortOptions?.().catch(()=>[]),$=await BTt(n).catch(()=>{});return await g({initialMode:XK(f),initialModel:U.model,initialThoughtLevel:U.thoughtLevel,loginRequired:L,locale:U.locale??I,theme:U.theme??"auto",developerMode:w,version:o,workspaceDirectory:_,workspaceGitBranch:T,noColor:t.noColor,readClipboardImage:n.readClipboardImage??tti(),effortOptions:z,modelOptions:B,listWorkspacePathSuggestions:Bti({workspaceDirectory:_}),listMcpServers:E.listMcpServers,listWorkflowRuns:E.listWorkflowRuns,replayWorkflowRuns:E.replayWorkflowRuns,reduceWorkflowRuns:($zState,$zEvent)=>{zhr();return oQe($zState,$zEvent)},getMainSessionId:E.getMainSessionId,writeClipboardText:n.writeClipboardText??sti({stdout:e.stdout}),stderr:e.stderr,stdin:e.stdin,stdout:e.stdout,loadSessionTranscript:E.loadSessionTranscript,loadSessionContextMessages:E.loadSessionContextMessages,readGoal:E.readGoal,readTodos:E.readTodos,readRuntimeProjection:E.readRuntimeProjection,readSessionUsage:E.readSessionUsage,cancelBackgroundTask:E.cancelBackgroundTask,previewFileRewind:E.previewFileRewind,applyFileRewind:E.applyFileRewind,setCustomSessionTitle:E.setCustomSessionTitle,readCustomSessionTitle:E.readCustomSessionTitle,interruptTurn:E.interruptTurn,promoteQueuedInput:E.promoteQueuedInput,listSkills:E.listSkills,readDefaultModel:E.readDefaultModel,setDefaultModel:E.setDefaultModel,reloadModelOptions:E.reloadModelOptions,listModelOptions:E.listModelOptions,readExecutionState:E.readExecutionState,setPlanEnabled:E.setPlanEnabled,setTransientModel:E.setTransientModel,readSessionModel:E.readSessionModel,sendBackgroundTaskMessage:E.sendBackgroundTaskMessage,recallPreviousInput:E.recallPreviousInput,sendInput:E.sendInput,setMode:E.setMode,slashCommands:v2n($),submitPrompt:E,subscribeSessionEvents:E.subscribeSessionEvents})}finally{R(),await E.close?.()}}catch(f){let g=f instanceof Error?f.message:String(f);return e.stderr.write(`Error: ${g}
|
|
15419
15419
|
`),t.verbose&&f instanceof Error&&f.stack&&e.stderr.write(`${f.stack}
|
|
15420
15420
|
`),1}},"runTuiCommand")});var Jti={};Ng(Jti,{run:()=>Toc});var S9,Xrc,Qrc,eoc,toc,noc,roc,ooc,ioc,soc,aoc,coc,zTt,Hti,loc,uoc,Gti,doc,poc,foc,moc,hoc,goc,_oc,yoc,voc,boc,Soc,woc,UTt,koc,xoc,Toc,Kti=Y(()=>{"use strict";Dqt();adt();Y0();Y0();eN();jQ();L2o();WXo();XRn();b9();ZXo();oQo();cQo();n2n();F8t();X8t();mQo();jei();Xei();P2n();Vti();S9="0.16.9",Xrc="--target requires non-empty text.",Qrc="yolo",eoc="--force-mcs can only be used with --prompt, --target, or tui.",toc="--target-replace requires --target.",noc='--target cannot be used with --prompt. Use either --target <objective> or --prompt "/goal <objective>".',roc=new Set(["--disallowedTools","--disallowed-tools"]),ooc="--browser-executable requires --browser-use=headless.",ioc="--browser-use=headless can only be used with --prompt, --target, or tui.",soc="--surface can only be used with --prompt, --target, app-server, or agent-server.",aoc="--memory-bench can only be used with -p/--prompt.",coc=r(e=>({...e.all===!0?{all:!0}:{},...e.available===!0?{available:!0}:{},...e["keep-data"]===!0?{keepData:!0}:{},...typeof e.scope=="string"?{scope:e.scope}:{},...Array.isArray(e.sparse)?{sparse:e.sparse}:{}}),"pluginsCommandFlags"),zTt=r(e=>e[0]??"tui","commandName"),Hti=r(e=>typeof e.prompt=="string"||e.targetRequest!==void 0||zTt(e.positionals)==="tui","isForceMcsSupportedInvocation"),loc=r(e=>{let t=zTt(e.positionals);return typeof e.prompt=="string"||e.targetRequest!==void 0||t==="app-server"||t==="agent-server"},"isPresentationSurfaceSupportedInvocation"),uoc=r((e,t,n,o,s,a)=>({browserExecutable:s,browserUse:o,detectedLocale:n,force:e.force===!0,json:e.json===!0,locale:t,...e["memory-bench"]===!0?{memoryBench:!0}:{},noColor:e["no-color"]===!0,...a?{outputFormat:a}:{},verbose:e.verbose===!0}),"globalOptions"),Gti=["text","json","stream-json"],doc=r(e=>{if(e!==void 0){if(Gti.includes(e))return e;throw new Error(`--output-format must be one of ${Gti.join(", ")} (received: ${e}).`)}},"normalizeOutputFormat"),poc=r(e=>{if(e!==void 0){if(L6e(e))return e;throw new Error(S4().cli.errors.localeUnsupported(e))}},"normalizeLocaleOption"),foc=r(e=>{if(e===void 0)return;let t=e.toLowerCase();if(t==="build"||t==="edit"||t==="yolo")return t;throw new Error(`Unsupported --mode value: ${e}. Supported modes: build, edit, yolo. Use /plan in the TUI to toggle planning.`)},"normalizePromptMode"),moc=r(e=>{if(e!==void 0){if(e.toLowerCase()==="headless")return"headless";throw new Error(`Unsupported --browser-use value: ${e}. Supported value: headless.`)}},"normalizeBrowserUse"),hoc=r(e=>{if(e===void 0||e.toLowerCase()==="terminal")return"terminal";if(e.toLowerCase()==="desktop")return"zcode_desktop";throw new Error(`Unsupported --surface value: ${e}. Supported surfaces: terminal, desktop.`)},"normalizePresentationSurface"),goc=r(e=>{let t=[],n=[];for(let o=0;o<e.length;o+=1){let s=e[o],a=s.match(/^(--disallowedTools|--disallowed-tools)=(.*)$/);if(a){n.push(a[2]??"");continue}if(!roc.has(s)){t.push(s);continue}let l=!1;for(;o+1<e.length&&!_oc(e[o+1]);)n.push(e[o+1]),o+=1,l=!0;if(!l)throw new Error(`${s} requires at least one tool.`)}return{args:t,toolDisallowlist:yoc(n)}},"extractDisallowedToolsArgs"),_oc=r(e=>e==="--"||/^-[^-]?|^--/.test(e),"isCliOptionToken"),yoc=r(e=>{let t=[],n=new Set;for(let o of e)for(let s of voc(o)){let a=boc(s);!a||n.has(a)||(n.add(a),t.push(a))}return t.length>0?t:void 0},"normalizeCliToolRuleList"),voc=r(e=>{let t=[],n="",o=!1,s=r(()=>{let a=n.trim();a&&t.push(a),n=""},"flush");for(let a of e)switch(a){case"(":o=!0,n+=a;break;case")":o=!1,n+=a;break;case",":o?n+=a:s();break;case" ":o?n+=a:s();break;default:n+=a;break}return s(),t},"splitCliToolRules"),boc=r(e=>e?e==="web_search"?"WebSearch":e.startsWith("web_search(")?`WebSearch${e.slice(10)}`:e:"","normalizeCliToolRule"),Soc=r(e=>{let t=e.target,n=e["target-replace"]===!0;if(t===void 0){if(n)throw new Error(toc);return}let o=t.trim();if(o.length===0)throw new Error(Xrc);return{objective:o,replaceExisting:n}},"normalizeTargetRequest"),woc=r(e=>e.replaceExisting?`/goal replace ${e.objective}`:`/goal ${e.objective}`,"buildHeadlessTargetCommand"),UTt=r((e,t,n)=>{e.write(N2o(S9,t,n))},"writeHelp"),koc=r((e,t,n)=>{let o=wTn(),s={cli:{name:aZn,processName:L8t,version:S9},runtime:{arch:o.arch,cwd:n,execPath:o.execPath,node:o.node,platform:o.platform,processTitle:process.title,sea:o.sea},packaging:{default:"node-bundle",sea:"optional"}};if(t.json)return e.stdout.write(e0(s)),0;let a=bTn(e.stdout,t.noColor);return e.stdout.write(`${STn.bold("zcode doctor",a)}
|
|
15421
15421
|
`),e.stdout.write(`version: ${s.cli.version}
|