"use strict";exports.id=9396,exports.ids=[9396],exports.modules={12557:(a,b,c)=>{c.d(b,{Bl:()=>j,Qo:()=>f,S5:()=>l,hk:()=>e,kJ:()=>k});var d=c(3662);function e(a,b,c=0){let f=b?("string"==typeof b?b:JSON.stringify(b)).toLowerCase():"";for(let b of d.t2)if(b.text&&f&&f.includes(b.text)||b.status&&b.status===a){if(b.backoff){let a=Math.min(c+1,d.EQ.maxLevel);return{shouldFallback:!0,cooldownMs:function(a=0){let b=Math.max(0,a-1);return Math.min(d.EQ.base*Math.pow(2,b),d.EQ.max)}(a),newBackoffLevel:a}}return{shouldFallback:!0,cooldownMs:b.cooldownMs}}return{shouldFallback:!0,cooldownMs:d.wf}}function f(a){if(!a)return"";let b=new Date(a).getTime()-Date.now();if(b<=0)return"reset after 0s";let c=Math.ceil(b/1e3),d=Math.floor(c/3600),e=Math.floor(c%3600/60),f=c%60,g=[];return d>0&&g.push(`${d}h`),e>0&&g.push(`${e}m`),(f>0||0===g.length)&&g.push(`${f}s`),`reset after ${g.join(" ")}`}let g="modelLock_",h=`${g}__all`;function i(a){return a?`${g}${a}`:h}function j(a,b){let c=a[i(b)]||a[h];return!!c&&new Date(c).getTime()>Date.now()}function k(a){if(!a)return null;let b=null,c=Date.now();for(let[d,e]of Object.entries(a)){if(!d.startsWith(g)||!e)continue;let a=new Date(e).getTime();a<=c||(!b||a<b)&&(b=a)}return b?new Date(b).toISOString():null}function l(a,b){return{[i(a)]:new Date(Date.now()+b).toISOString()}}},32330:(a,b,c)=>{c.d(b,{BI:()=>F,fT:()=>H,L:()=>E});let d=["node_modules",".git","target","__pycache__",".next","dist","build",".venv","venv",".cache",".idea",".vscode",".DS_Store"];function e(a,b=500){let c=[],d="",f=0,g=0,h=!1,i=0,j=0,k=!1;for(let e of a.split("\n")){if(e.startsWith("diff --git")){j>0&&(c.push(`  ... (${j} lines truncated)`),k=!0,j=0),d&&(f>0||g>0)&&c.push(`  +${f} -${g}`);let a=e.split(" b/");d=a.length>1?a.slice(1).join(" b/"):"unknown",c.push(`
${d}`),f=0,g=0,h=!1,i=0}else e.startsWith("@@")?(j>0&&(c.push(`  ... (${j} lines truncated)`),k=!0,j=0),h=!0,i=0,c.push(`  ${e}`)):h&&(e.startsWith("+")&&!e.startsWith("+++")?(f+=1,i<100?(c.push(`  ${e}`),i+=1):j+=1):e.startsWith("-")&&!e.startsWith("---")?(g+=1,i<100?(c.push(`  ${e}`),i+=1):j+=1):i<100&&!e.startsWith("\\")&&i>0&&(c.push(`  ${e}`),i+=1));if(c.length>=b){c.push("\n... (more changes truncated)"),k=!0;break}}return j>0&&(c.push(`  ... (${j} lines truncated)`),k=!0),d&&(f>0||g>0)&&c.push(`  +${f} -${g}`),k&&c.push("[full diff: rtk git diff --no-compact]"),c.join("\n")}function f(a){let b=a.split("\n");if(0===b.length||1===b.length&&!b[0].trim())return"Clean working tree";let c="",d=[],e=[],f=[],g=0,h=0,i=0,j=0;for(let a of b){if(!a.trim())continue;let b=a.match(/^On branch (\S+)/);if(b){c=b[1];continue}if(a.startsWith("##")){c=a.replace(/^##\s*/,"");continue}if(a.length>=3&&/^[ MADRCU?!][ MADRCU?!] /.test(a)){let b=a[0],c=a[1],k=a.slice(3);if("??"===a.slice(0,2)){i++,f.push(k);continue}"MADRC".includes(b)?(g++,d.push(k)):"U"===b&&j++,("M"===c||"D"===c)&&(h++,e.push(k));continue}let k=a.match(/^\s*(modified|new file|deleted|renamed|both modified):\s+(.+)$/);if(k){let a=k[1],b=k[2].trim();"both modified"===a?j++:"modified"===a||"deleted"===a?(h++,e.push(b)):("new file"===a||"renamed"===a)&&(g++,d.push(b));continue}}let k="";if(c&&(k+=`* ${c}
`),g>0){for(let a of(k+=`+ Staged: ${g} files
`,d.slice(0,10)))k+=`   ${a}
`;d.length>10&&(k+=`   ... +${d.length-10} more
`)}if(h>0){for(let a of(k+=`~ Modified: ${h} files
`,e.slice(0,10)))k+=`   ${a}
`;e.length>10&&(k+=`   ... +${e.length-10} more
`)}if(i>0){for(let a of(k+=`? Untracked: ${i} files
`,f.slice(0,10)))k+=`   ${a}
`;f.length>10&&(k+=`   ... +${f.length-10} more
`)}return j>0&&(k+=`conflicts: ${j} files
`),0===g&&0===h&&0===i&&0===j&&(k+="clean — nothing to commit\n"),k.replace(/\n+$/,"")}e.filterName="git-diff",f.filterName="git-status";let g=/^\s*(-->|\||\d+\s*\||=)/;function h(a){let b=a.split("\n");if(0===b.length)return a;let c=[],d=[],e=[],f=null,h=0,i=0,j=!1;for(let a of b){let b=a.trim();if(j){if(!b){j=!1;continue}if(g.test(a)){c.push(a);continue}j=!1}if(b){if(/^npm (ERR!|error)/i.test(b)||/^yarn error/i.test(b)){c.push(a);continue}if(/^npm warn deprecated/i.test(b)){e.push(a);continue}if(/^npm warn/i.test(b)||/^yarn warn/i.test(b)){d.push(a);continue}if(/^error(\[|:)/i.test(b)||b.startsWith("error --\x3e")){c.push(a),j=!0;continue}if(/^warning(\[|:)/i.test(b)||b.startsWith("warning --\x3e")){d.push(a),j=!0;continue}if(/^ERROR:/i.test(b)||/^\[ERROR\]/i.test(b)||/^BUILD FAILED/i.test(b)){c.push(a);continue}if(/^\[WARNING\]/i.test(b)){d.push(a);continue}if(/^\s*Compiling\s+\S+/i.test(b)){h++;continue}if(/^\s*Downloading\s+\S+/i.test(b)||/^Fetching\s+/i.test(b)){i++;continue}if(/^(added|removed|changed|audited|installed)\s+\d+\s+package/i.test(b)||/^\s*Finished\s+/i.test(b)||/^BUILD SUCCESS/i.test(b)||/^\d+\s+(vulnerabilities|packages?|warnings?|errors?)/i.test(b)||/^Successfully (installed|built)/i.test(b)||/^To address .* issues/i.test(b)||/^Run `npm (audit|fund)`/i.test(b)||/packages are looking for funding/i.test(b)){f=f?`${f}
${a}`:a;continue}}}let k="";for(let a of e.slice(0,3))k+=`${a}
`;for(let a of(e.length>3&&(k+=`... +${e.length-3} more deprecated packages
`),h>0&&(k+=`Compiled ${h} packages
`),i>0&&(k+=`Downloaded ${i} packages
`),c))k+=`${a}
`;for(let a of d.slice(0,5))k+=`${a}
`;return d.length>5&&(k+=`... +${d.length-5} more warnings
`),f&&(k+=`${f}
`),k.replace(/\n+$/,"")||a}function i(a){let b=new Map,c=0;for(let d of a.split("\n")){let a=d.indexOf(":");if(-1===a)continue;let e=d.indexOf(":",a+1);if(-1===e)continue;let f=d.slice(0,a),g=d.slice(a+1,e),h=d.slice(e+1);/^\d+$/.test(g)&&(c++,b.has(f)||b.set(f,[]),b.get(f).push([g,h]))}if(0===c)return a;let d=Array.from(b.keys()).sort(),e=`${c} matches in ${d.length}F:

`;for(let a of d){let c=b.get(a);for(let[b,d]of(e+=`[file] ${a} (${c.length}):
`,c.slice(0,10)))e+=`  ${b.padStart(4)}: ${d.trim()}
`;c.length>10&&(e+=`  +${c.length-10}
`),e+="\n"}return e}function j(a){let b=a.split("\n").filter(a=>a.trim());if(0===b.length)return a;let c=new Map;for(let a of b){let b,d,e=a.lastIndexOf("/");-1===e?(b=".",d=a):(b=a.slice(0,e)||"/",d=a.slice(e+1)),c.has(b)||c.set(b,[]),c.get(b).push(d)}let d=Array.from(c.keys()).sort(),e=`${b.length} files in ${d.length} dirs:

`;for(let a of d.slice(0,20)){let b=c.get(a);for(let c of(e+=`${a}/ (${b.length}):
`,b.slice(0,10)))e+=`  ${c}
`;b.length>10&&(e+=`  +${b.length-10}
`),e+="\n"}return d.length>20&&(e+=`+${d.length-20} more dirs
`),e}function k(a){let b=a.split("\n"),c=[],d=null,e=0,f=0,g=()=>{null!==d&&e>1&&c.push(`  ... (${e-1} duplicate lines)`)};for(let a of b){if(""===a.trim()){f<1&&c.push(a),f+=1,g(),d=null,e=0;continue}if(f=0,a===d){e+=1;continue}if(g(),c.push(a),d=a,e=1,c.length>=2e3)return c.push("... (truncated at 2000 lines)"),c.join("\n")}return g(),c.join("\n")}h.filterName="build-output",i.filterName="grep",j.filterName="find",k.filterName="dedup-log";let l=/\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+\d{1,2}\s+(\d{4}|\d{2}:\d{2})\s+/;function m(a){let b=[],c=[],e=new Map;for(let g of a.split("\n")){if(g.startsWith("total ")||0===g.length)continue;let a=function(a){let b=l.exec(a);if(!b)return null;let c=a.slice(b.index+b[0].length),d=a.slice(0,b.index).split(/\s+/).filter(Boolean);if(d.length<4)return null;let e=d[0].charAt(0),f=0;for(let a=d.length-1;a>=0;a--){let b=Number(d[a]);if(Number.isInteger(b)&&String(b)===d[a]){f=b;break}}return{fileType:e,size:f,name:c}}(g);if(a&&"."!==a.name&&".."!==a.name&&!d.includes(a.name)){if("d"===a.fileType)b.push(a.name);else if("-"===a.fileType||"l"===a.fileType){var f;let b=a.name.lastIndexOf("."),d=b>0?a.name.slice(b):"no ext";e.set(d,(e.get(d)||0)+1),c.push([a.name,(f=a.size)>=1048576?`${(f/1048576).toFixed(1)}M`:f>=1024?`${(f/1024).toFixed(1)}K`:`${f}B`])}}}if(0===b.length&&0===c.length)return a;let g="";for(let a of b)g+=`${a}/
`;for(let[a,b]of c)g+=`${a}  ${b}
`;let h=`
Summary: ${c.length} files, ${b.length} dirs`;if(e.size>0){let a=Array.from(e.entries()).sort((a,b)=>b[1]-a[1]),b=a.slice(0,5).map(([a,b])=>`${b} ${a}`);h+=` (${b.join(", ")}`,a.length>5&&(h+=`, +${a.length-5} more`),h+=")"}return g+h}function n(a){let b=a.split("\n");if(0===b.length)return a;let c=[];for(let a of b)a.includes("director")&&a.includes("file")||(""!==a.trim()||0!==c.length)&&c.push(a);for(;c.length>0&&""===c[c.length-1].trim();)c.pop();if(c.length>200){let a=c.length-200;return c.slice(0,200).join("\n")+`
... +${a} more lines`}return c.join("\n")}function o(a){let b=a.split("\n");if(b.length<250)return a;let c=b.slice(0,120),d=b.slice(b.length-60),e=b.length-c.length-d.length;return[...c,`... +${e} lines truncated`,...d].join("\n")}function p(a){let b=a.split("\n");if(b.length<250)return a;let c=b.slice(0,120),d=b.slice(b.length-60),e=b.length-c.length-d.length;return[...c,`... +${e} lines truncated (file continues)`,...d].join("\n")}m.filterName="ls",n.filterName="tree",o.filterName="smart-truncate",p.filterName="read-numbered";let q=/^\s*\d+\|/;function r(a){let b=a.split("\n");if(0===b.length)return a;let c=b[0]||"",d=b.slice(1),e=[];for(let a of d){let b=a.trim();b.startsWith("- ")&&e.push(b.slice(2))}if(0===e.length)return a;let f=new Map;for(let a of e){let b=a.lastIndexOf("/"),c=-1===b?".":a.slice(0,b)||"/",d=-1===b?a:a.slice(b+1);f.has(c)||f.set(c,[]),f.get(c).push(d)}let g=Array.from(f.keys()).sort(),h=`${c}
${e.length} files in ${g.length} dirs:

`;for(let a of g.slice(0,20)){let b=f.get(a);for(let c of(h+=`${a}/ (${b.length}):
`,b.slice(0,10)))h+=`  ${c}
`;b.length>10&&(h+=`  +${b.length-10}
`),h+="\n"}return g.length>20&&(h+=`+${g.length-20} more dirs
`),h.replace(/\n+$/,"")}r.filterName="search-list";let s=/^Result of search in '[^']*' \(total (\d+) files?\):/,t=/^diff --git /m,u=/^@@ /m,v=/^On branch |^nothing to commit|^Changes (not |to be )|^Untracked files:/m,w=/^[ MADRCU?!][ MADRCU?!] \S/m,x=/^(npm (warn|error|ERR!)|yarn (warn|error)|\s*Compiling\s+\S+|\s*Downloading\s+\S+|added \d+ package|\[ERROR\]|BUILD (SUCCESS|FAILED)|\s*Finished\s+|Successfully (installed|built)|ERROR:)/im,y=/[├└]──|│  /,z=/^[-dlbcps][rwx-]{9}/m,A=/^total \d+$/m;function B(a){let b=a.indexOf(":");if(-1===b)return!1;let c=a.indexOf(":",b+1);if(-1===c)return!1;let d=a.slice(b+1,c);return/^\d+$/.test(d)}function C(a){let b=a.trim();return!(0===b.length||b.includes(":"))&&(b.startsWith(".")||b.startsWith("/")||b.includes("/"))}let D=!1;function E(a){D=!!a}function F(a,b=D){if(!b||!a)return null;if(a.conversationState){var c=a;let b={bytesBefore:0,bytesAfter:0,hits:[]};try{let a=c.conversationState,d=[...Array.isArray(a?.history)?a.history:[]];for(let c of(a?.currentMessage&&d.push(a.currentMessage),d)){let a=c?.userInputMessage?.userInputMessageContext?.toolResults;if(Array.isArray(a)){for(let c of a)if("error"!==c.status&&Array.isArray(c.content))for(let a of c.content)a&&"string"==typeof a.text&&(a.text=G(a.text,b,"kiro-tool-result"))}}}catch(a){return console.warn("[RTK] compressKiroFormat error:",a.message),null}return b}let d=Array.isArray(a.messages)?a.messages:Array.isArray(a.input)?a.input:null;if(!d)return null;let e={bytesBefore:0,bytesAfter:0,hits:[]};try{for(let a=0;a<d.length;a++){let b=d[a];if(b){if("function_call_output"===b.type){if("string"==typeof b.output)b.output=G(b.output,e,"openai-responses-string");else if(Array.isArray(b.output))for(let a=0;a<b.output.length;a++){let c=b.output[a];c&&"input_text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-responses-array"))}continue}if("tool"===b.role&&"string"==typeof b.content){b.content=G(b.content,e,"openai-tool");continue}if(Array.isArray(b.content)){if("tool"===b.role){for(let a=0;a<b.content.length;a++){let c=b.content[a];c&&"text"===c.type&&"string"==typeof c.text&&(c.text=G(c.text,e,"openai-tool-array"))}continue}for(let a=0;a<b.content.length;a++){let c=b.content[a];if(c&&"tool_result"===c.type&&!0!==c.is_error){if("string"==typeof c.content)c.content=G(c.content,e,"claude-string");else if(Array.isArray(c.content))for(let a=0;a<c.content.length;a++){let b=c.content[a];b&&"text"===b.type&&"string"==typeof b.text&&(b.text=G(b.text,e,"claude-array"))}}}}}}}catch(a){return console.warn("[RTK] compressMessages error:",a.message),null}return e}function G(a,b,c){let d=a.length;if(b.bytesBefore+=d,d<500||d>0xa00000)return b.bytesAfter+=d,a;let g=function(a){var b,c;let d,g,l=a.length>1024?a.slice(0,1024):a;if(t.test(l)||u.test(l))return e;if(v.test(l))return f;if(x.test(l))return h;if(!((d=l.split("\n").filter(a=>a.trim())).length<3)&&d.filter(a=>w.test(a)).length/d.length>=.6)return f;let D=l.split("\n"),E=D.filter(a=>a.trim().length>0);return E.slice(0,5).some(B)?i:E.length>=3&&E.every(C)?j:y.test(l)?n:A.test(l)||(b=l,g=new RegExp((c=z).source,c.flags.includes("g")?c.flags:c.flags+"g"),(b.match(g)||[]).length>=3)?m:s.test(l)?r:D.length>=250&&function(a){let b=0,c=0;for(let d of a.slice(0,100))0!==d.length&&(c++,q.test(d)&&b++);return!(c<5)&&b/c>=.7}(D)?p:E.length>=5?k:a.split("\n").length>=250?o:null}(a);if(!g)return b.bytesAfter+=d,a;let l=function(a,b){if("function"!=typeof a)return b;try{let c=a(b);if("string"!=typeof c)return b;return c}catch(d){let c=a.filterName||a.name||"anonymous";return console.warn(`[rtk] warning: filter '${c}' panicked — passing through raw output: ${d?.message||d}`),b}}(g,a);return!l||0===l.length||l.length>=d?(b.bytesAfter+=d,a):(b.bytesAfter+=l.length,b.hits.push({shape:c,filter:g.filterName||g.name,saved:d-l.length}),l)}function H(a){if(!a||!a.hits||0===a.hits.length)return null;let b=a.bytesBefore-a.bytesAfter,c=a.bytesBefore>0?(b/a.bytesBefore*100).toFixed(1):"0",d=Array.from(new Set(a.hits.map(a=>a.filter))).join(",");return`[RTK] saved ${b}B / ${a.bytesBefore}B (${c}%) via [${d}] hits=${a.hits.length}`}},43659:(a,b,c)=>{c.d(b,{A1:()=>g,lR:()=>i,wO:()=>h,yj:()=>e,zL:()=>f});var d=c(3662);function e(a,b){let c;return new Response(JSON.stringify((c=d.LY[a]||(a>=500?{type:"server_error",code:"internal_server_error"}:{type:"invalid_request_error",code:""}),{error:{message:b||d.O[a]||"An error occurred",type:c.type,code:c.code}})),{status:a,headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})}async function f(a,b=null){let c="";try{c=await a.text()}catch{c=""}if(b&&"function"==typeof b.parseError)try{let e=b.parseError(a,c);if(e&&"object"==typeof e){let b=e.message||d.O[a.status]||`Upstream error: ${a.status}`;return{statusCode:e.status||a.status,message:b,resetsAtMs:e.resetsAtMs}}}catch{}let e="";try{let a=JSON.parse(c);e=a.error?.message||a.message||a.error||c}catch{e=c}let g=("string"==typeof e?e:JSON.stringify(e))||d.O[a.status]||`Upstream error: ${a.status}`;return{statusCode:a.status,message:g}}function g(a,b,c){return{success:!1,status:a,error:b,resetsAtMs:c,response:e(a,b)}}function h(a,b,c,d){let e=Math.max(Math.ceil((new Date(c).getTime()-Date.now())/1e3),1);return new Response(JSON.stringify({error:{message:`${b} (${d})`}}),{status:a,headers:{"Content-Type":"application/json","Retry-After":String(e)}})}function i(a,b,c,d){let e=d||a.code||"FETCH_FAILED",f=a.message||"Unknown error",g=a.cause?.code,h=a.cause?.message,i=g||h?` (cause: ${[g,h].filter(Boolean).join(": ")})`:"";return`[${e}]: ${f}${i}`}}};