@modality-counter/core 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -367,7 +367,7 @@ Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the toke
367
367
  Error message: ${Qsi(t)}`,cause:t}),this[iui]=!0,this.text=e}static isInstance(e){return t_.hasMarker(e,nui)}};iui=Mua;var Rua="AI_LoadAPIKeyError",Pua=`vercel.ai.error.${Rua}`,Dua=Symbol.for(Pua),Nua;Nua=Dua;var $ua="AI_LoadSettingError",Fua=`vercel.ai.error.${$ua}`,Lua=Symbol.for(Fua),zua;zua=Lua;var Uua="AI_NoContentGeneratedError",jua=`vercel.ai.error.${Uua}`,Bua=Symbol.for(jua),qua;qua=Bua;var Zua="AI_NoSuchModelError",Wua=`vercel.ai.error.${Zua}`,Vua=Symbol.for(Wua),Hua;Hua=Vua;var oui="AI_TooManyEmbeddingValuesForCallError",aui=`vercel.ai.error.${oui}`,Gua=Symbol.for(aui),sui,Jua=class extends t_{constructor(e){super({name:oui,message:`Too many values for a single embedding call. The ${e.provider} model "${e.modelId}" can only embed up to ${e.maxEmbeddingsPerCall} values per call, but ${e.values.length} values were provided.`}),this[sui]=!0,this.provider=e.provider,this.modelId=e.modelId,this.maxEmbeddingsPerCall=e.maxEmbeddingsPerCall,this.values=e.values}static isInstance(e){return t_.hasMarker(e,aui)}};sui=Gua;var uui="AI_TypeValidationError",cui=`vercel.ai.error.${uui}`,Kua=Symbol.for(cui),lui,Yua=class V2t extends t_{constructor({value:t,cause:r}){super({name:uui,message:`Type validation failed: Value: ${JSON.stringify(t)}.
368
368
  Error message: ${Qsi(r)}`,cause:r}),this[lui]=!0,this.value=t}static isInstance(t){return t_.hasMarker(t,cui)}static wrap({value:t,cause:r}){return V2t.isInstance(r)&&r.value===t?r:new V2t({value:t,cause:r})}};lui=Kua;var Z9e=Yua,fui="AI_UnsupportedFunctionalityError",dui=`vercel.ai.error.${fui}`,Qua=Symbol.for(dui),pui,hui=class extends t_{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:fui,message:t}),this[pui]=!0,this.functionality=e}static isInstance(e){return t_.hasMarker(e,dui)}};pui=Qua;var Xua=(e,t=21)=>(r=t)=>{let n="",i=r|0;for(;i--;)n+=e[Math.random()*e.length|0];return n},mui=W9e(Cko(),1);function RMr(...e){return e.reduce((t,r)=>({...t,...r??{}}),{})}function qje(e){let t={};return e.headers.forEach((r,n)=>{t[n]=r}),t}var eca=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{let i=Xua(r,t);if(e==null)return i;if(r.includes(n))throw new Sua({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return o=>`${e}${n}${i(o)}`},gui=eca();function tca(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>r!=null))}function Qyt(e){return e instanceof Error&&(e.name==="AbortError"||e.name==="TimeoutError")}var H2t=Symbol.for("vercel.ai.validator");function rca(e){return{[H2t]:!0,validate:e}}function nca(e){return typeof e=="object"&&e!==null&&H2t in e&&e[H2t]===!0&&"validate"in e}function ica(e){return nca(e)?e:oca(e)}function oca(e){return rca(t=>{let r=e.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}})}function aca({value:e,schema:t}){let r=yui({value:e,schema:t});if(!r.success)throw Z9e.wrap({value:e,cause:r.error});return r.value}function yui({value:e,schema:t}){let r=ica(t);try{if(r.validate==null)return{success:!0,value:e};let n=r.validate(e);return n.success?n:{success:!1,error:Z9e.wrap({value:e,cause:n.error})}}catch(n){return{success:!1,error:Z9e.wrap({value:e,cause:n})}}}function sca({text:e,schema:t}){try{let r=mui.default.parse(e);return t==null?r:aca({value:r,schema:t})}catch(r){throw q9e.isInstance(r)||Z9e.isInstance(r)?r:new q9e({text:e,cause:r})}}function bui({text:e,schema:t}){try{let r=mui.default.parse(e);if(t==null)return{success:!0,value:r,rawValue:r};let n=yui({value:r,schema:t});return n.success?{...n,rawValue:r}:n}catch(r){return{success:!1,error:q9e.isInstance(r)?r:new q9e({text:e,cause:r})}}}var uca=()=>globalThis.fetch,G2t=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:i,abortSignal:o,fetch:a})=>cca({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:i,abortSignal:o,fetch:a}),cca=async({url:e,headers:t={},body:r,successfulResponseHandler:n,failedResponseHandler:i,abortSignal:o,fetch:a=uca()})=>{try{let s=await a(e,{method:"POST",headers:tca(t),body:r.content,signal:o}),u=qje(s);if(!s.ok){let c;try{c=await i({response:s,url:e,requestBodyValues:r.values})}catch(l){throw Qyt(l)||QM.isInstance(l)?l:new QM({message:"Failed to process error response",cause:l,statusCode:s.status,url:e,responseHeaders:u,requestBodyValues:r.values})}throw c.value}try{return await n({response:s,url:e,requestBodyValues:r.values})}catch(c){throw c instanceof Error&&(Qyt(c)||QM.isInstance(c))?c:new QM({message:"Failed to process successful response",cause:c,statusCode:s.status,url:e,responseHeaders:u,requestBodyValues:r.values})}}catch(s){if(Qyt(s))throw s;if(s instanceof TypeError&&s.message==="fetch failed"){let u=s.cause;if(u!=null)throw new QM({message:`Cannot connect to API: ${u.message}`,cause:u,url:e,requestBodyValues:r.values,isRetryable:!0})}throw s}},lca=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:n,url:i,requestBodyValues:o})=>{let a=await n.text(),s=qje(n);if(a.trim()==="")return{responseHeaders:s,value:new QM({message:n.statusText,url:i,requestBodyValues:o,statusCode:n.status,responseHeaders:s,responseBody:a,isRetryable:r?.(n)})};try{let u=sca({text:a,schema:e});return{responseHeaders:s,value:new QM({message:t(u),url:i,requestBodyValues:o,statusCode:n.status,responseHeaders:s,responseBody:a,data:u,isRetryable:r?.(n,u)})}}catch{return{responseHeaders:s,value:new QM({message:n.statusText,url:i,requestBodyValues:o,statusCode:n.status,responseHeaders:s,responseBody:a,isRetryable:r?.(n)})}}},xui=e=>async({response:t,url:r,requestBodyValues:n})=>{let i=await t.text(),o=bui({text:i,schema:e}),a=qje(t);if(!o.success)throw new QM({message:"Invalid JSON response",cause:o.error,statusCode:t.status,responseHeaders:a,responseBody:i,url:r,requestBodyValues:n});return{responseHeaders:a,value:o.value,rawValue:o.rawValue}},{btoa:fca,atob:AWs}=globalThis;function dca(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return fca(t)}function pca(e){return e?.replace(/\/$/,"")}var hca=W9e(Oko(),1);function Xyt(e){let t=[];for(let{content:r,role:n}of e)switch(n){case"system":{t.push({content:r,role:"system"});break}case"user":{t.push({...r.reduce((i,o)=>{if(o.type==="text")i.content+=o.text;else{if(o.type==="image"&&o.image instanceof URL)throw new hui({functionality:"Image URLs in user messages"});o.type==="image"&&o.image instanceof Uint8Array&&(i.images=i.images||[],i.images.push(dca(o.image)))}return i},{content:""}),role:"user"});break}case"assistant":{let i=[],o=[];for(let a of r)switch(a.type){case"text":{i.push(a.text);break}case"tool-call":{o.push({function:{arguments:a.args,name:a.toolName},id:a.toolCallId,type:"function"});break}default:{let s=a;throw new Error(`Unsupported part: ${s}`)}}t.push({content:i.join(","),role:"assistant",tool_calls:o.length>0?o:void 0});break}case"tool":{t.push(...r.map(i=>({content:typeof i.result=="object"?JSON.stringify(i.result):`${i.result}`,role:"tool",tool_call_id:i.toolCallId})));break}default:{let i=n;throw new Error(`Unsupported role: ${i}`)}}return t}var mca=class{constructor({tools:e,type:t}){this._firstMessage=!0,this._tools=e,this._toolPartial="",this._toolCalls=[],this._type=t,this._detectedToolCall=!1}get toolCalls(){return this._toolCalls}get detectedToolCall(){return this._detectedToolCall}parse({controller:e,delta:t}){var r;if(this.detectToolCall(t),!this._detectedToolCall)return!1;this._toolPartial+=t;let n=hca.parse(this._toolPartial);Array.isArray(n)||(n=[n]);for(let[i,o]of n.entries()){let a=(r=JSON.stringify(o?.parameters))!=null?r:"";if(a==="")continue;this._toolCalls[i]||(this._toolCalls[i]={function:{arguments:"",name:o.name},id:gui(),type:"function"});let s=this._toolCalls[i];s.function.arguments=a,e.enqueue({argsTextDelta:t,toolCallId:s.id,toolCallType:"function",toolName:s.function.name,type:"tool-call-delta"})}return!0}finish({controller:e}){for(let t of this.toolCalls)e.enqueue({args:t.function.arguments,toolCallId:t.id,toolCallType:"function",toolName:t.function.name,type:"tool-call"});return this.finishReason()}detectToolCall(e){!this._tools||this._tools.length===0||this._firstMessage&&(this._type==="object-tool"?this._detectedToolCall=!0:this._type==="regular"&&(e.trim().startsWith("{")||e.trim().startsWith("["))&&(this._detectedToolCall=!0),this._firstMessage=!1)}finishReason(){return this.detectedToolCall?this._type==="object-tool"?"stop":"tool-calls":"stop"}};function gca({finishReason:e,hasToolCalls:t}){return e==="stop"?t?"tool-calls":"stop":"other"}var yca=U.object({error:U.object({code:U.string().nullable(),message:U.string(),param:U.any().nullable(),type:U.string()})}),J2t=lca({errorSchema:yca,errorToMessage:e=>e.error.message});function bca({mode:e}){var t;let r=(t=e.tools)!=null&&t.length?e.tools:void 0,n=[],i=e.toolChoice;if(r===void 0)return{tools:void 0,toolWarnings:n};let o=[];for(let s of r)s.type==="provider-defined"?n.push({tool:s,type:"unsupported-tool"}):o.push({function:{description:s.description,name:s.name,parameters:s.parameters},type:"function"});if(i===void 0)return{tools:o,toolWarnings:n};let a=i.type;switch(a){case"auto":return{tools:o,toolWarnings:n};case"none":return{tools:void 0,toolWarnings:n};default:{let s=a;throw new hui({functionality:`Unsupported tool choice type: ${s}`})}}}function xca(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}var vca=class extends TransformStream{constructor(){super({flush:e=>{this.buffer.length!==0&&e.enqueue(this.buffer)},transform:(e,t)=>{for(e=this.buffer+e;;){let r=e.indexOf(`
369
369
  `);if(r===-1)break;t.enqueue(e.slice(0,r)),e=e.slice(r+1)}this.buffer=e}}),this.buffer=""}},_ca=e=>async({response:t})=>{let r=qje(t);if(t.body===null)throw new vua({});return{responseHeaders:r,value:t.body.pipeThrough(new TextDecoderStream).pipeThrough(new vca).pipeThrough(new TransformStream({transform(n,i){i.enqueue(bui({schema:e,text:n}))}}))}},Sca=class{constructor(e,t,r){this.modelId=e,this.settings=t,this.config=r,this.specificationVersion="v1",this.defaultObjectGenerationMode="json",this.supportsImageUrls=!1}get supportsStructuredOutputs(){var e;return(e=this.settings.structuredOutputs)!=null?e:!1}get provider(){return this.config.provider}getArguments({frequencyPenalty:e,maxTokens:t,mode:r,presencePenalty:n,prompt:i,responseFormat:o,seed:a,stopSequences:s,temperature:u,topK:c,topP:l}){let f=r.type,d=[];o!==void 0&&o.type==="json"&&o.schema!==void 0&&!this.supportsStructuredOutputs&&d.push({details:"JSON response format schema is only supported with structuredOutputs",setting:"responseFormat",type:"unsupported-setting"});let p={format:o?.type,model:this.modelId,options:xca({f16_kv:this.settings.f16Kv,frequency_penalty:e,low_vram:this.settings.lowVram,main_gpu:this.settings.mainGpu,min_p:this.settings.minP,mirostat:this.settings.mirostat,mirostat_eta:this.settings.mirostatEta,mirostat_tau:this.settings.mirostatTau,num_batch:this.settings.numBatch,num_ctx:this.settings.numCtx,num_gpu:this.settings.numGpu,num_keep:this.settings.numKeep,num_predict:t,num_thread:this.settings.numThread,numa:this.settings.numa,penalize_newline:this.settings.penalizeNewline,presence_penalty:n,repeat_last_n:this.settings.repeatLastN,repeat_penalty:this.settings.repeatPenalty,seed:a,stop:s,temperature:u,tfs_z:this.settings.tfsZ,top_k:c,top_p:l,typical_p:this.settings.typicalP,use_mlock:this.settings.useMlock,use_mmap:this.settings.useMmap,vocab_only:this.settings.vocabOnly})};switch(f){case"regular":{let{tools:g,toolWarnings:x}=bca({mode:r});return{args:{...p,messages:Xyt(i),tools:g},type:f,warnings:[...d,...x]}}case"object-json":return{args:{...p,format:this.supportsStructuredOutputs&&r.schema!==void 0?r.schema:"json",messages:Xyt(i)},type:f,warnings:d};case"object-tool":return{args:{...p,messages:Xyt(i),tool_choice:{function:{name:r.tool.name},type:"function"},tools:[{function:{description:r.tool.description,name:r.tool.name,parameters:r.tool.parameters},type:"function"}]},type:f,warnings:d};default:{let g=f;throw new Error(`Unsupported type: ${g}`)}}}async doGenerate(e){var t,r;let{args:n,warnings:i}=this.getArguments(e),o={...n,stream:!1},{responseHeaders:a,value:s}=await G2t({abortSignal:e.abortSignal,body:o,failedResponseHandler:J2t,fetch:this.config.fetch,headers:RMr(this.config.headers(),e.headers),successfulResponseHandler:xui(wca),url:`${this.config.baseURL}/chat`}),{messages:u,...c}=o,l=(t=s.message.tool_calls)==null?void 0:t.map(f=>{var d;return{args:JSON.stringify(f.function.arguments),toolCallId:(d=f.id)!=null?d:gui(),toolCallType:"function",toolName:f.function.name}});return{finishReason:gca({finishReason:s.done_reason,hasToolCalls:l!==void 0&&l.length>0}),rawCall:{rawPrompt:u,rawSettings:c},rawResponse:{headers:a},request:{body:JSON.stringify(o)},text:(r=s.message.content)!=null?r:void 0,toolCalls:l,usage:{completionTokens:s.eval_count||0,promptTokens:s.prompt_eval_count||0},warnings:i}}async doStream(e){if(this.settings.simulateStreaming){let p=await this.doGenerate(e),g=new ReadableStream({start(x){if(x.enqueue({type:"response-metadata",...p.response}),p.text&&x.enqueue({textDelta:p.text,type:"text-delta"}),p.toolCalls)for(let T of p.toolCalls)x.enqueue({argsTextDelta:T.args,toolCallId:T.toolCallId,toolCallType:"function",toolName:T.toolName,type:"tool-call-delta"}),x.enqueue({type:"tool-call",...T});x.enqueue({finishReason:p.finishReason,logprobs:p.logprobs,providerMetadata:p.providerMetadata,type:"finish",usage:p.usage}),x.close()}});return{rawCall:p.rawCall,rawResponse:p.rawResponse,stream:g,warnings:p.warnings}}let{args:t,type:r,warnings:n}=this.getArguments(e),{responseHeaders:i,value:o}=await G2t({abortSignal:e.abortSignal,body:t,failedResponseHandler:J2t,fetch:this.config.fetch,headers:RMr(this.config.headers(),e.headers),successfulResponseHandler:_ca(kca),url:`${this.config.baseURL}/chat`}),{messages:a,...s}=t,u=e.mode.type==="regular"?e.mode.tools:e.mode.type==="object-tool"?[e.mode.tool]:void 0,c=new mca({tools:u,type:r}),l="other",f={completionTokens:Number.NaN,promptTokens:Number.NaN},{experimentalStreamTools:d=!0}=this.settings;return{rawCall:{rawPrompt:a,rawSettings:s},rawResponse:{headers:i},request:{body:JSON.stringify(t)},stream:o.pipeThrough(new TransformStream({async flush(p){p.enqueue({finishReason:l,type:"finish",usage:f})},async transform(p,g){if(!p.success){g.enqueue({error:p.error,type:"error"});return}let x=p.value;if(x.done){l=c.finish({controller:g}),f={completionTokens:x.eval_count,promptTokens:x.prompt_eval_count||0};return}d&&c.parse({controller:g,delta:x.message.content})||x.message.content!==null&&g.enqueue({textDelta:x.message.content,type:"text-delta"})}})),warnings:n}}},wca=U.object({created_at:U.string(),done:U.literal(!0),done_reason:U.string().optional().nullable(),eval_count:U.number(),eval_duration:U.number(),load_duration:U.number().optional(),message:U.object({content:U.string(),role:U.string(),tool_calls:U.array(U.object({function:U.object({arguments:U.record(U.any()),name:U.string()}),id:U.string().optional()})).optional().nullable()}),model:U.string(),prompt_eval_count:U.number().optional(),prompt_eval_duration:U.number().optional(),total_duration:U.number()}),kca=U.discriminatedUnion("done",[U.object({created_at:U.string(),done:U.literal(!1),message:U.object({content:U.string(),role:U.string()}),model:U.string()}),U.object({created_at:U.string(),done:U.literal(!0),eval_count:U.number(),eval_duration:U.number(),load_duration:U.number().optional(),model:U.string(),prompt_eval_count:U.number().optional(),prompt_eval_duration:U.number().optional(),total_duration:U.number()})]),Eca=class{constructor(e,t,r){this.specificationVersion="v1",this.modelId=e,this.settings=t,this.config=r}get provider(){return this.config.provider}get maxEmbeddingsPerCall(){var e;return(e=this.settings.maxEmbeddingsPerCall)!=null?e:2048}get supportsParallelCalls(){return!1}async doEmbed({abortSignal:e,values:t}){if(t.length>this.maxEmbeddingsPerCall)throw new Jua({maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,modelId:this.modelId,provider:this.provider,values:t});let{responseHeaders:r,value:n}=await G2t({abortSignal:e,body:{input:t,model:this.modelId},failedResponseHandler:J2t,fetch:this.config.fetch,headers:this.config.headers(),successfulResponseHandler:xui(Ica),url:`${this.config.baseURL}/embed`});return{embeddings:n.embeddings,rawResponse:{headers:r},usage:n.prompt_eval_count?{tokens:n.prompt_eval_count}:void 0}}},Ica=U.object({embeddings:U.array(U.array(U.number())),prompt_eval_count:U.number().nullable()});function Tca(e={}){var t;let r=(t=pca(e.baseURL))!=null?t:"http://127.0.0.1:11434/api",n=()=>({...e.headers}),i=(s,u={})=>new Sca(s,u,{baseURL:r,fetch:e.fetch,headers:n,provider:"ollama.chat"}),o=(s,u={})=>new Eca(s,u,{baseURL:r,fetch:e.fetch,headers:n,provider:"ollama.embedding"}),a=function(s,u){if(new.target)throw new Error("The Ollama model function cannot be called with the new keyword.");return i(s,u)};return a.chat=i,a.embedding=o,a.languageModel=i,a.textEmbedding=o,a.textEmbeddingModel=o,a}var CWs=Tca();k1();xFe();xFe();var Aca=V$("stream-mcp"),K2t=class{constructor(t,r){v(this,"transport");v(this,"onStreamingContent");v(this,"onclose");v(this,"onerror");v(this,"onmessage");let n=new xG(new URL(t));this.transport=n,this.transport.onclose=()=>this.onclose?.(),this.transport.onerror=i=>this.onerror?.(i),this.transport.onmessage=i=>{this.interceptStreamingMessage(i),this.onmessage?.(i)},this.onStreamingContent=r}interceptStreamingMessage(t){if(t&&typeof t=="object"){if("method"in t&&t.method==="notifications/tool/streamContent"){let r=t.params;if(r&&r.content&&Array.isArray(r.content))for(let n of r.content)n.type==="text"&&n.text&&(console.log(`\u{1F4E2} Captured streaming content: "${n.text}"`),this.onStreamingContent?.(n.text))}if("result"in t&&t.result&&typeof t.result=="object"){let r=t.result;if(r.content&&Array.isArray(r.content))for(let n of r.content)n.type==="text"&&n.text&&console.log(`\u{1F4E2} Final result content: "${n.text}"`)}}}async start(){return this.transport.start()}async close(){return this.transport.close()}async send(t){return Aca.info("\u{1F50D} Intercepting send operation to monitor for SSE streaming..."),this.transport.send(t)}get sessionId(){return this.transport.sessionId}};xFe();var vui="modality-client",CMe=V$(vui),Dge=class{constructor(t,r=6e4){v(this,"client");v(this,"transportConfig");v(this,"timeout");this.client=new a3e({name:vui,version:"1.0.0"}),this.transportConfig=t,this.timeout=r}createTransport(){switch(this.transportConfig.type){case"http":return new xG(new URL(this.transportConfig.url),this.transportConfig.options);case"stdio":return new p3e(this.transportConfig.serverParams);case"sse":return new b3e(new URL(this.transportConfig.url),this.transportConfig.options);default:throw new Error(`Unsupported transport type: ${this.transportConfig.type}`)}}getTransportIdentifier(){switch(this.transportConfig.type){case"http":case"sse":return this.transportConfig.url;case"stdio":return`stdio:${this.transportConfig.serverParams.command}`;default:return"unknown-transport"}}async call(t,r,n=!0){try{let i=this.client,o=this.createTransport();await i.connect(o);let a=await i.callTool({name:t,arguments:r},void 0,{timeout:this.timeout});return n?this.parseContent(a):a}catch(i){let o=this.getTransportIdentifier();throw CMe.error(`${o}-call-failed`,i),i}}async callOnce(t,r,n=!0){let i;try{i=await this.call(t,r,n)}catch{this.client.close()}return this.client.close(),i}callStream(t,r,n){try{let i=this.client;if(this.transportConfig.type!=="http")throw new Error(`Streaming not supported for ${this.transportConfig.type} transport`);let o=this.transportConfig.url;return new ReadableStream({async start(s){try{let u=new K2t(o,l=>s.enqueue(l));await i.connect(u);let c=await i.callTool({name:t,arguments:r});await u.close(),s.close(),n?.(c)}catch(u){CMe.error("Streaming error:",u),s.error(u)}}})}catch(i){let o=this.getTransportIdentifier();return CMe.error(`${o}-stream-failed`,i),new ReadableStream({start(s){s.enqueue(`Error: ${i instanceof Error?i.message:String(i)}`),s.close()}})}}close(){this.client.close()}async listTools(){try{let t=this.client,r=this.createTransport();return await t.connect(r),await t.listTools()}catch(t){let r=this.getTransportIdentifier();throw CMe.error(`${r}-listTools-failed`,t),t}}parseContent(t){try{return JSON.parse(t.content[0].text)}catch{return t.content[0].text}}};function Cca(e,t,r){return new Dge({type:"http",url:e,options:r},t)}function Oca(e,t){return new Dge({type:"stdio",serverParams:e},t)}function Mca(e,t,r){return new Dge({type:"sse",url:e,options:r},t)}var _ui={http:Cca,stdio:Oca,sse:Mca},NWs=V$("vscode-lm");xFe();var ZLt=class{constructor(t){v(this,"client",_ui.http("https://mcp.deepwiki.com/mcp"));v(this,"toolParams");v(this,"toolName","");v(this,"repoName");this.repoName=t}read_wiki_structure(){return this.toolParams={repoName:this.repoName},this.toolName="ask_question",this}read_wiki_contents(){return this.toolParams={repoName:this.repoName},this.toolName="read_wiki_contents",this}ask_question(t){return this.toolParams={repoName:this.repoName,question:t},this.toolName="ask_question",this}async callOnce(){return await this.client.callOnce(this.toolName,this.toolParams)}listTools(){return this.client.listTools()}getToolParams(){return this.toolParams}};var pee=23e3,B5="_Counter__ExecuteMethod";var Rca=new Set(["shopee.tw"]);function Pca(e){try{let r=new URL(e).hostname;for(let n of Rca)if(r===n||r.endsWith(`.${n}`))return!0;return!1}catch{return!1}}function WLt(e,t){let r=t?.size??4096;if(r<=0)throw new Error("Chunk size must be greater than 0");let n=Dca(e,r),i=n.length;return{getChunk(o=0){if(!Number.isInteger(o)||o<0||o>=i)throw new Error(`Invalid chunk index: ${o}. Valid range: 0-${i-1}`);return{index:o,content:n[o],total:i,is_last:o===i-1}},getChunks(){return n.map((o,a)=>({index:a,content:o,total:i,is_last:a===i-1}))},streamChunks(o){for(let a=0;a<i;a++)o({index:a,content:n[a],total:i,is_last:a===i-1})},getTotalChunks(){return i},isValidIndex(o){return Number.isInteger(o)&&o>=0&&o<i}}}function Dca(e,t){if(!e)return e?[""]:[];let r=[],n=0;for(;n<e.length;){let i=Math.min(n+t,e.length);if(i>=e.length){r.push(e.slice(n));break}let o=Nca(e,n,i);r.push(e.slice(n,o)),n=o}return r.length===0?[""]:r}function Nca(e,t,r){if(r>=e.length)return e.length;let n=Math.max(10,Math.floor((r-t)*.1)),i=Math.max(t,r-n);for(let o=r;o>=i;o--)if(e[o]===`
370
- `)return o+1;for(let o=r;o>=i;o--){let a=e[o];if(a===" "||a===" "||a==="-"||a===",")return o+1}return r}function $ca(e,t,r=23e3){let n;return Array.isArray(e)?n=Sui(e,r).length:n=WLt(e,{size:r}).getTotalChunks(),{chunk_index:t,next_chunk_index:t+1,total_chunks:n,is_last:t===n-1,chunk_pagination_guide:zca({maxChars:r}).chunk_pagination_guide}}function Fca(e,t=23e3){return Array.isArray(e)?JSON.stringify(e).length>t:e.length>t}function Sui(e,t){if(e.length===0)return[];let r=[],n=[],i=0;for(let o of e){let a=JSON.stringify(o).length;i+a>t&&n.length>0&&(r.push(n),n=[],i=0),n.push(o),i+=a}return n.length>0&&r.push(n),r}function Lca(e,t=0,r=23e3){if(Array.isArray(e)){let i=Sui(e,r);if(t<0||t>=i.length)throw new Error(`Invalid chunk index: ${t}. Valid range: 0-${i.length-1}`);return i[t]}let n=WLt(e,{size:r});if(!n.isValidIndex(t))throw new Error(`Invalid chunk index: ${t}. Valid range: 0-${n.getTotalChunks()-1}`);return n.getChunk(t).content}function zca(e={}){let{maxChars:t=23e3,description:r="File too large - exceeds character limit"}=e;return{chunk_pagination_guide:{issue:`${r} (${t}K max)`,solution:"Retrieve file in chunks using chunk_index pagination",approach:["1. Request next_chunk_index: chunk_index={next_chunk_index}","2. Read pagination metadata in response (is_last)","3. Request next chunk by incrementing chunk_index until is_last=true"],example:{chunk_0:"{chunk_index: 0}",chunk_1:"{chunk_index: 1}",continue:"Increment chunk_index sequentially until is_last=true"},chunk_index:{meaning:"Zero-based chunk identifier for pagination",start:"0 (always start with first chunk)",increment:"Add 1 to fetch next chunk"},strategy:"Fetch chunks sequentially, read each chunk until is_last=true for complete file"}}}import{readFileSync as rgi}from"fs";import{join as Uba,dirname as jba}from"path";var mx=q5(/[A-Za-z]/),qg=q5(/[\dA-Za-z]/),wui=q5(/[#-'*+\--9=?A-Z^-~]/);function xbe(e){return e!==null&&(e<32||e===127)}var vbe=q5(/\d/),kui=q5(/[\dA-Fa-f]/),Eui=q5(/[!-/:-@[-`{-~]/);function Wr(e){return e!==null&&e<-2}function bl(e){return e!==null&&(e<0||e===32)}function Zn(e){return e===-2||e===-1||e===32}var Iui=q5(/\p{P}|\p{S}/u),NT=q5(/\s/);function q5(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}var Aui=Y2(Tui(),1),_be=Object.assign(lB(Error),{eval:lB(EvalError),range:lB(RangeError),reference:lB(ReferenceError),syntax:lB(SyntaxError),type:lB(TypeError),uri:lB(URIError)});function lB(e){return t.displayName=e.displayName||e.name,t;function t(r,...n){let i=r&&(0,Aui.default)(r,...n);return new e(i)}}var Zje={}.hasOwnProperty,Cui={yaml:"-",toml:"+"};function hee(e){let t=[],r=-1,n=Array.isArray(e)?e:e?[e]:["yaml"];for(;++r<n.length;)t[r]=Uca(n[r]);return t}function Uca(e){let t=e;if(typeof t=="string"){if(!Zje.call(Cui,t))throw _be("Missing matter definition for `%s`",t);t={type:t,marker:Cui[t]}}else if(typeof t!="object")throw _be("Expected matter to be an object, not `%j`",t);if(!Zje.call(t,"type"))throw _be("Missing `type` in matter `%j`",t);if(!Zje.call(t,"fence")&&!Zje.call(t,"marker"))throw _be("Missing `marker` or `fence` in matter `%j`",t);return t}function GLt(e){let t=hee(e),r={},n=-1;for(;++n<t.length;){let i=t[n],o=HLt(i,"open").charCodeAt(0),a=jca(i),s=r[o];Array.isArray(s)?s.push(a):r[o]=[a]}return{flow:r}}function jca(e){let t=e.anywhere,r=e.type,n=r+"Fence",i=n+"Sequence",o=r+"Value",a={tokenize:l,partial:!0},s,u=0;return{tokenize:c,concrete:!0};function c(f,d,p){let g=this;return x;function x(q){let G=g.now();return G.column===1&&(G.line===1||t)&&(s=HLt(e,"open"),u=0,q===s.charCodeAt(u))?(f.enter(r),f.enter(n),f.enter(i),T(q)):p(q)}function T(q){return u===s.length?(f.exit(i),Zn(q)?(f.enter("whitespace"),O(q)):F(q)):q===s.charCodeAt(u++)?(f.consume(q),T):p(q)}function O(q){return Zn(q)?(f.consume(q),O):(f.exit("whitespace"),F(q))}function F(q){return Wr(q)?(f.exit(n),f.enter("lineEnding"),f.consume(q),f.exit("lineEnding"),s=HLt(e,"close"),u=0,f.attempt(a,B,$)):p(q)}function $(q){return q===null||Wr(q)?z(q):(f.enter(o),P(q))}function P(q){return q===null||Wr(q)?(f.exit(o),z(q)):(f.consume(q),P)}function z(q){return q===null?p(q):(f.enter("lineEnding"),f.consume(q),f.exit("lineEnding"),f.attempt(a,B,$))}function B(q){return f.exit(r),d(q)}}function l(f,d,p){let g=0;return x;function x($){return $===s.charCodeAt(g)?(f.enter(n),f.enter(i),T($)):p($)}function T($){return g===s.length?(f.exit(i),Zn($)?(f.enter("whitespace"),O($)):F($)):$===s.charCodeAt(g++)?(f.consume($),T):p($)}function O($){return Zn($)?(f.consume($),O):(f.exit("whitespace"),F($))}function F($){return $===null||Wr($)?(f.exit(n),d($)):p($)}}}function HLt(e,t){return e.marker?Oui(e.marker,t).repeat(3):Oui(e.fence,t)}function Oui(e,t){return typeof e=="string"?e:e[t]}function JLt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function YLt(e){let t=hee(e),r={},n={},i=-1;for(;++i<t.length;){let o=t[i];r[o.type]=Bca(o),n[o.type]=qca,n[o.type+"Value"]=Zca}return{enter:r,exit:n}}function Bca(e){return t;function t(r){this.enter({type:e.type,value:""},r),this.buffer()}}function qca(e){let t=this.resume(),r=this.stack[this.stack.length-1];"value"in r,this.exit(e),r.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function Zca(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function QLt(e){let t=[],r={},n=hee(e),i=-1;for(;++i<n.length;){let o=n[i];r[o.type]=Wca(o);let a=KLt(o,"open");t.push({atBreak:!0,character:a.charAt(0),after:JLt(a.charAt(1))})}return{unsafe:t,handlers:r}}function Wca(e){let t=KLt(e,"open"),r=KLt(e,"close");return n;function n(i){return t+(i.value?`
370
+ `)return o+1;for(let o=r;o>=i;o--){let a=e[o];if(a===" "||a===" "||a==="-"||a===",")return o+1}return r}function $ca(e,t,r=23e3){let n;return Array.isArray(e)?n=Sui(e,r).length:n=WLt(e,{size:r}).getTotalChunks(),{chunk_index:t,next_chunk_index:t+1,total_chunks:n,is_last:t===n-1,chunk_pagination_guide:zca({maxChars:r}).chunk_pagination_guide}}function Fca(e,t=23e3){return Array.isArray(e)?JSON.stringify(e).length>t:e.length>t}function Sui(e,t){if(e.length===0)return[];let r=[],n=[],i=0;for(let o of e){let a=JSON.stringify(o).length;i+a>t&&n.length>0&&(r.push(n),n=[],i=0),n.push(o),i+=a}return n.length>0&&r.push(n),r}function Lca(e,t=0,r=23e3){if(Array.isArray(e)){let i=Sui(e,r);if(t<0||t>=i.length)throw new Error(`Invalid chunk index: ${t}. Valid range: 0-${i.length-1}`);return i[t]}let n=WLt(e,{size:r});if(!n.isValidIndex(t))throw new Error(`Invalid chunk index: ${t}. Valid range: 0-${n.getTotalChunks()-1}`);return n.getChunk(t).content}function zca(e={}){let{maxChars:t=23e3,description:r="File too large - exceeds character limit"}=e;return{chunk_pagination_guide:{strategy:`${r} (${t}K max) - Retrieve file in chunks using chunk_index pagination: fetch sequentially from chunk 0, incrementing until is_last=true for complete file`,approach:["1. Request next_chunk_index: chunk_index={next_chunk_index}","2. Read pagination metadata in response (is_last)","3. Request next chunk by incrementing chunk_index until is_last=true"],example:{chunk_0:"{chunk_index: 0}",chunk_1:"{chunk_index: 1}",continue:"Increment chunk_index sequentially until is_last=true"},chunk_index:{meaning:"Zero-based chunk identifier for pagination",start:"0 (always start with first chunk)",increment:"Add 1 to fetch next chunk"}}}}import{readFileSync as rgi}from"fs";import{join as Uba,dirname as jba}from"path";var mx=q5(/[A-Za-z]/),qg=q5(/[\dA-Za-z]/),wui=q5(/[#-'*+\--9=?A-Z^-~]/);function xbe(e){return e!==null&&(e<32||e===127)}var vbe=q5(/\d/),kui=q5(/[\dA-Fa-f]/),Eui=q5(/[!-/:-@[-`{-~]/);function Wr(e){return e!==null&&e<-2}function bl(e){return e!==null&&(e<0||e===32)}function Zn(e){return e===-2||e===-1||e===32}var Iui=q5(/\p{P}|\p{S}/u),NT=q5(/\s/);function q5(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}var Aui=Y2(Tui(),1),_be=Object.assign(lB(Error),{eval:lB(EvalError),range:lB(RangeError),reference:lB(ReferenceError),syntax:lB(SyntaxError),type:lB(TypeError),uri:lB(URIError)});function lB(e){return t.displayName=e.displayName||e.name,t;function t(r,...n){let i=r&&(0,Aui.default)(r,...n);return new e(i)}}var Zje={}.hasOwnProperty,Cui={yaml:"-",toml:"+"};function hee(e){let t=[],r=-1,n=Array.isArray(e)?e:e?[e]:["yaml"];for(;++r<n.length;)t[r]=Uca(n[r]);return t}function Uca(e){let t=e;if(typeof t=="string"){if(!Zje.call(Cui,t))throw _be("Missing matter definition for `%s`",t);t={type:t,marker:Cui[t]}}else if(typeof t!="object")throw _be("Expected matter to be an object, not `%j`",t);if(!Zje.call(t,"type"))throw _be("Missing `type` in matter `%j`",t);if(!Zje.call(t,"fence")&&!Zje.call(t,"marker"))throw _be("Missing `marker` or `fence` in matter `%j`",t);return t}function GLt(e){let t=hee(e),r={},n=-1;for(;++n<t.length;){let i=t[n],o=HLt(i,"open").charCodeAt(0),a=jca(i),s=r[o];Array.isArray(s)?s.push(a):r[o]=[a]}return{flow:r}}function jca(e){let t=e.anywhere,r=e.type,n=r+"Fence",i=n+"Sequence",o=r+"Value",a={tokenize:l,partial:!0},s,u=0;return{tokenize:c,concrete:!0};function c(f,d,p){let g=this;return x;function x(q){let G=g.now();return G.column===1&&(G.line===1||t)&&(s=HLt(e,"open"),u=0,q===s.charCodeAt(u))?(f.enter(r),f.enter(n),f.enter(i),T(q)):p(q)}function T(q){return u===s.length?(f.exit(i),Zn(q)?(f.enter("whitespace"),O(q)):F(q)):q===s.charCodeAt(u++)?(f.consume(q),T):p(q)}function O(q){return Zn(q)?(f.consume(q),O):(f.exit("whitespace"),F(q))}function F(q){return Wr(q)?(f.exit(n),f.enter("lineEnding"),f.consume(q),f.exit("lineEnding"),s=HLt(e,"close"),u=0,f.attempt(a,B,$)):p(q)}function $(q){return q===null||Wr(q)?z(q):(f.enter(o),P(q))}function P(q){return q===null||Wr(q)?(f.exit(o),z(q)):(f.consume(q),P)}function z(q){return q===null?p(q):(f.enter("lineEnding"),f.consume(q),f.exit("lineEnding"),f.attempt(a,B,$))}function B(q){return f.exit(r),d(q)}}function l(f,d,p){let g=0;return x;function x($){return $===s.charCodeAt(g)?(f.enter(n),f.enter(i),T($)):p($)}function T($){return g===s.length?(f.exit(i),Zn($)?(f.enter("whitespace"),O($)):F($)):$===s.charCodeAt(g++)?(f.consume($),T):p($)}function O($){return Zn($)?(f.consume($),O):(f.exit("whitespace"),F($))}function F($){return $===null||Wr($)?(f.exit(n),d($)):p($)}}}function HLt(e,t){return e.marker?Oui(e.marker,t).repeat(3):Oui(e.fence,t)}function Oui(e,t){return typeof e=="string"?e:e[t]}function JLt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function YLt(e){let t=hee(e),r={},n={},i=-1;for(;++i<t.length;){let o=t[i];r[o.type]=Bca(o),n[o.type]=qca,n[o.type+"Value"]=Zca}return{enter:r,exit:n}}function Bca(e){return t;function t(r){this.enter({type:e.type,value:""},r),this.buffer()}}function qca(e){let t=this.resume(),r=this.stack[this.stack.length-1];"value"in r,this.exit(e),r.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function Zca(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function QLt(e){let t=[],r={},n=hee(e),i=-1;for(;++i<n.length;){let o=n[i];r[o.type]=Wca(o);let a=KLt(o,"open");t.push({atBreak:!0,character:a.charAt(0),after:JLt(a.charAt(1))})}return{unsafe:t,handlers:r}}function Wca(e){let t=KLt(e,"open"),r=KLt(e,"close");return n;function n(i){return t+(i.value?`
371
371
  `+i.value:"")+`
372
372
  `+r}}function KLt(e,t){return e.marker?Mui(e.marker,t).repeat(3):Mui(e.fence,t)}function Mui(e,t){return typeof e=="string"?e:e[t]}var Vca="yaml";function Wje(e){let t=this,r=e||Vca,n=t.data(),i=n.micromarkExtensions||(n.micromarkExtensions=[]),o=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),a=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);i.push(GLt(r)),o.push(YLt(r)),a.push(QLt(r))}var pE="function";var Rui="string";var Vje="undefined";var Pui="TypeError",o_=void 0,Z5=null,XLt=!0;var ezt=Object.keys,mee=Array.isArray,Dui=function(t){return t?ezt(t).length:0},tzt=function(){return Object.create(null)};var Hca=function(t,r,n,i){return r===void 0&&(r=[]),n===void 0&&(n=o_),i===void 0&&(i=o_),pE===typeof t?t.apply(n,r):Vje!==typeof i?i:t},W5=Hca;var Gca=function(t,r){var n;return r===void 0&&(r={obj:o_,prev:o_,next:o_,nextIndex:o_,path:[]}),pE===typeof t?t(r):t??((n=r)===null||n===void 0?void 0:n.next)},gee=Gca;var Jca=function(t,r){return typeof t.get===pE?W5(t.get,[r],t):t[r]},Kca=function(t,r,n){if(r===void 0&&(r=[]),n===void 0&&(n=o_),t==null)return gee(n,{obj:t});var i=t;if(!r||mee(r)&&!r.length)return i;if(!mee(r))throw new TypeError("path should be array, but got "+r);try{for(var o=r.length,a=r.length-1;o--;){var s=r[a-o];if(i!=null){var u=Jca(i,s);if(u!=null)i=u;else{i=gee(n,{obj:t,prev:i,next:u,nextIndex:s,path:r});break}}else{i=gee(n);break}}}catch(c){console.warn({e:c}),i=gee(n)}return i},a6=Kca;var Nui=Object.keys,Xca=Array.isArray,ela=function(t,r,n){if(!t)return t;r&&pE!==typeof r&&(r=function(a){return Vje!==typeof a});var i={};return Nui(t).forEach(function(o){var a=t[o];n&&n.length&&n.indexOf(o)!==-1||(a||r&&r(a))&&(i[o]=a)}),Xca(t)?Nui(i).map(function(o){return i[o]}):i},rzt=ela;import*as tla from"react";import{jsx as $ui}from"react/jsx-runtime";import"react";var{isValidElement:Hje,cloneElement:rla,createElement:nla,Children:ila,Fragment:ola}=tla,ala=function(t,r,n,i){var{altWrap:o,doCallFunction:a}=i||{};if(pE===typeof t&&(!t.name||t.name==="children")||a)try{n!=Z5&&(r.children=n);var s=t(r);if(Hje(s)){var u=s.key||r.key;return u!=null?fB(s,{key:u}):s}else return o?fB(o,r,s):fB(s,r)}catch(c){if(c.name===Pui)return fB(t,r,n);throw c}else return fB(t,r,n)},fB=function(t,r,n){if(r===void 0&&(r={}),n===void 0&&(n=o_),Z5==t)return Z5;var i=Hje(t);if(i&&!Dui(r)&&n==null)return t;var o=[t,r];if(n!=Z5&&o.push(n),!t||XLt===t||Rui===typeof t&&t!==t.replace(/[^a-z1-6]/g,"")){if(r.children!=null)throw new TypeError("String component should not have child");return fB($ui("span",{children:t}),r)}else return(i?rla:nla).apply(Z5,o)},sla=function(t,r){return r===void 0&&(r={}),(function(n,i){if(n===void 0&&(n={}),i===void 0&&(i=o_),Z5==t)return Z5;var{altWrap:o}=r||{};o&&pE!==typeof t&&!Hje(t)&&(i=t,t=o);var a=function(c){return n=rzt(n,XLt),(Hje(c)?fB:ala)(c,n,i,r)};if(mee(t)){var s=n.key;return n.key=o_,$ui(ola,{children:ila.map(t.map(function(u){return a(u)}),function(u){return u})},s)}else return a(t)})},Fui=sla;var egi=Y2(rfi());import{plugin as Mba,YAML as Rba}from"bun";import{renderToStaticMarkup as Pba}from"react-dom/server";import{dirname as Dba,resolve as Nba}from"path";import Iba from"node:assert";import{Buffer as Tba}from"node:buffer";import Aba from"node:fs/promises";import Cba from"node:path";var Apa=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Cpa=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Opa={};function EBe(e,t){return((t||Opa).jsx?Cpa:Apa).test(e)}var Zbe=class{constructor(){this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:t=>this.replacement=t}}replace(t,r,n,i){t&&r&&(n!=null?t[r][n]=i:t[r]=i)}remove(t,r,n){t&&r&&(n!=null?t[r].splice(n,1):delete t[r])}};var IBe=class extends Zbe{constructor(t,r){super(),this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.context={skip:()=>this.should_skip=!0,remove:()=>this.should_remove=!0,replace:n=>this.replacement=n},this.enter=t,this.leave=r}visit(t,r,n,i){if(t){if(this.enter){let a=this.should_skip,s=this.should_remove,u=this.replacement;this.should_skip=!1,this.should_remove=!1,this.replacement=null,this.enter.call(this.context,t,r,n,i),this.replacement&&(t=this.replacement,this.replace(r,n,i,t)),this.should_remove&&this.remove(r,n,i);let c=this.should_skip,l=this.should_remove;if(this.should_skip=a,this.should_remove=s,this.replacement=u,c)return t;if(l)return null}let o;for(o in t){let a=t[o];if(a&&typeof a=="object")if(Array.isArray(a)){let s=a;for(let u=0;u<s.length;u+=1){let c=s[u];nfi(c)&&(this.visit(c,t,o,u)||u--)}}else nfi(a)&&this.visit(a,t,o,null)}if(this.leave){let a=this.replacement,s=this.should_remove;this.replacement=null,this.should_remove=!1,this.leave.call(this.context,t,r,n,i),this.replacement&&(t=this.replacement,this.replace(r,n,i,t)),this.should_remove&&this.remove(r,n,i);let u=this.should_remove;if(this.replacement=a,this.should_remove=s,u)return null}}return t}};function nfi(e){return e!==null&&typeof e=="object"&&"type"in e&&typeof e.type=="string"}function m6(e,{enter:t,leave:r}){return new IBe(t,r).visit(e,null)}var s7t=/@(jsx|jsxFrag|jsxImportSource|jsxRuntime)\s+(\S+)/g;function u7t(e,t){let r=t||{},n=r.runtime==="automatic",i={},o={};m6(e,{enter(a){if(a.type==="Program"){let s=a.comments||[],u=-1;for(;++u<s.length;){s7t.lastIndex=0;let c=s7t.exec(s[u].value);for(;c;)i[c[1]]=c[2],c=s7t.exec(s[u].value)}if(i.jsxRuntime)if(i.jsxRuntime==="automatic"){if(n=!0,i.jsx)throw new Error("Unexpected `@jsx` pragma w/ automatic runtime");if(i.jsxFrag)throw new Error("Unexpected `@jsxFrag` pragma w/ automatic runtime")}else if(i.jsxRuntime==="classic"){if(n=!1,i.jsxImportSource)throw new Error("Unexpected `@jsxImportSource` w/ classic runtime")}else throw new Error("Unexpected `jsxRuntime` `"+i.jsxRuntime+"`, expected `automatic` or `classic`")}},leave(a){if(a.type==="Program"){let x=[];if(o.fragment&&x.push({type:"ImportSpecifier",imported:{type:"Identifier",name:"Fragment"},local:{type:"Identifier",name:"_Fragment"}}),o.jsx&&x.push({type:"ImportSpecifier",imported:{type:"Identifier",name:"jsx"},local:{type:"Identifier",name:"_jsx"}}),o.jsxs&&x.push({type:"ImportSpecifier",imported:{type:"Identifier",name:"jsxs"},local:{type:"Identifier",name:"_jsxs"}}),o.jsxDEV&&x.push({type:"ImportSpecifier",imported:{type:"Identifier",name:"jsxDEV"},local:{type:"Identifier",name:"_jsxDEV"}}),x.length>0){let T=0;for(;T<a.body.length;){let O=a.body[T];if("directive"in O&&O.directive)T++;else break}a.body.splice(T,0,{type:"ImportDeclaration",specifiers:x,source:{type:"Literal",value:(i.jsxImportSource||r.importSource||"react")+(r.development?"/jsx-dev-runtime":"/jsx-runtime")}})}}if(a.type!=="JSXElement"&&a.type!=="JSXFragment")return;let s=[],u=-1;for(;++u<a.children.length;){let x=a.children[u];if(x.type==="JSXExpressionContainer")x.expression.type!=="JSXEmptyExpression"&&s.push(x.expression);else if(x.type==="JSXText"){let T=x.value.replace(/\t/g," ").replace(/ *(\r?\n|\r) */g,`
373
373
  `).replace(/\n+/g,`
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.1",
2
+ "version": "0.3.2",
3
3
  "name": "@modality-counter/core",
4
4
  "repository": {
5
5
  "type": "git",